@wordpress/block-editor 15.8.1-next.16d95556a.0 → 15.9.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 +2 -0
- package/build/components/block-inspector/edit-contents.js +19 -23
- package/build/components/block-inspector/edit-contents.js.map +3 -3
- package/build/components/block-inspector/index.js +7 -1
- package/build/components/block-inspector/index.js.map +2 -2
- package/build/components/block-list/block.js +4 -0
- package/build/components/block-list/block.js.map +2 -2
- package/build/components/block-list/index.js +2 -1
- package/build/components/block-list/index.js.map +2 -2
- package/build/components/block-list/use-block-props/index.js +3 -1
- package/build/components/block-list/use-block-props/index.js.map +2 -2
- package/build/components/block-list/use-block-props/use-is-hovered.js +16 -10
- package/build/components/block-list/use-block-props/use-is-hovered.js.map +2 -2
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +27 -5
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +2 -2
- package/build/components/block-lock/modal.js +5 -5
- package/build/components/block-lock/modal.js.map +2 -2
- package/build/components/block-lock/use-block-lock.js +10 -13
- package/build/components/block-lock/use-block-lock.js.map +2 -2
- package/build/components/block-settings-menu-controls/edit-section-menu-item.js +64 -0
- package/build/components/block-settings-menu-controls/edit-section-menu-item.js.map +7 -0
- package/build/components/block-settings-menu-controls/index.js +9 -1
- package/build/components/block-settings-menu-controls/index.js.map +2 -2
- package/build/components/block-toolbar/block-toolbar-icon.js +9 -9
- package/build/components/block-toolbar/block-toolbar-icon.js.map +2 -2
- package/build/components/block-tools/index.js +56 -45
- package/build/components/block-tools/index.js.map +3 -3
- package/build/components/block-variation-transforms/index.js +32 -5
- package/build/components/block-variation-transforms/index.js.map +2 -2
- package/build/components/block-visibility/toolbar.js +1 -1
- package/build/components/block-visibility/toolbar.js.map +1 -1
- package/build/components/border-radius-control/single-input-control.js +1 -0
- package/build/components/border-radius-control/single-input-control.js.map +2 -2
- package/build/components/content-only-controls/fields-dropdown-menu.js +66 -0
- package/build/components/content-only-controls/fields-dropdown-menu.js.map +7 -0
- package/build/components/content-only-controls/index.js +444 -0
- package/build/components/content-only-controls/index.js.map +7 -0
- package/build/components/content-only-controls/link/index.js +193 -0
- package/build/components/content-only-controls/link/index.js.map +7 -0
- package/build/components/content-only-controls/media/index.js +264 -0
- package/build/components/content-only-controls/media/index.js.map +7 -0
- package/build/components/content-only-controls/rich-text/index.js +188 -0
- package/build/components/content-only-controls/rich-text/index.js.map +7 -0
- package/build/components/content-only-controls/use-inspector-popover-placement.js +41 -0
- package/build/components/content-only-controls/use-inspector-popover-placement.js.map +7 -0
- package/build/components/font-family/index.js +1 -15
- package/build/components/font-family/index.js.map +2 -2
- package/build/components/global-styles/dimensions-panel.js +35 -2
- package/build/components/global-styles/dimensions-panel.js.map +2 -2
- package/build/components/global-styles/hooks.js +1 -1
- package/build/components/global-styles/hooks.js.map +2 -2
- package/build/components/global-styles/typography-panel.js +1 -2
- package/build/components/global-styles/typography-panel.js.map +2 -2
- package/build/components/inserter/media-tab/media-tab.js +1 -33
- package/build/components/inserter/media-tab/media-tab.js.map +3 -3
- package/build/components/inspector-controls-tabs/content-tab.js +6 -2
- package/build/components/inspector-controls-tabs/content-tab.js.map +3 -3
- package/build/components/inspector-controls-tabs/index.js +7 -1
- package/build/components/inspector-controls-tabs/index.js.map +2 -2
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +1 -1
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +2 -2
- package/build/components/link-control/index.js +15 -7
- package/build/components/link-control/index.js.map +2 -2
- package/build/components/list-view/block-select-button.js +7 -8
- package/build/components/list-view/block-select-button.js.map +2 -2
- package/build/components/list-view/block.js +9 -7
- package/build/components/list-view/block.js.map +2 -2
- package/build/components/media-placeholder/index.js +18 -35
- package/build/components/media-placeholder/index.js.map +3 -3
- package/build/components/media-placeholder/utils.js +60 -0
- package/build/components/media-placeholder/utils.js.map +7 -0
- package/build/components/media-replace-flow/index.js +24 -33
- package/build/components/media-replace-flow/index.js.map +3 -3
- package/build/components/use-block-commands/index.js +1 -1
- package/build/components/use-block-commands/index.js.map +2 -2
- package/build/components/use-block-display-information/index.js +21 -1
- package/build/components/use-block-display-information/index.js.map +3 -3
- package/build/components/use-block-drop-zone/index.js +1 -5
- package/build/components/use-block-drop-zone/index.js.map +2 -2
- package/build/hooks/block-bindings.js +52 -61
- package/build/hooks/block-bindings.js.map +3 -3
- package/build/hooks/dimensions.js +3 -3
- package/build/hooks/dimensions.js.map +2 -2
- package/build/hooks/metadata.js +1 -1
- package/build/hooks/metadata.js.map +2 -2
- package/build/hooks/use-content-only-section-edit.js +67 -0
- package/build/hooks/use-content-only-section-edit.js.map +7 -0
- package/build/hooks/utils.js +5 -1
- package/build/hooks/utils.js.map +2 -2
- package/build/layouts/constrained.js +2 -2
- package/build/layouts/constrained.js.map +2 -2
- package/build/private-apis.js +2 -3
- package/build/private-apis.js.map +3 -3
- package/build/store/private-keys.js +3 -0
- package/build/store/private-keys.js.map +2 -2
- package/build/store/private-selectors.js +41 -2
- package/build/store/private-selectors.js.map +2 -2
- package/build/store/selectors.js +6 -4
- package/build/store/selectors.js.map +2 -2
- package/build/utils/fit-text-utils.js +9 -1
- package/build/utils/fit-text-utils.js.map +2 -2
- package/build-module/components/block-inspector/edit-contents.js +9 -23
- package/build-module/components/block-inspector/edit-contents.js.map +2 -2
- package/build-module/components/block-inspector/index.js +7 -1
- package/build-module/components/block-inspector/index.js.map +2 -2
- package/build-module/components/block-list/block.js +4 -0
- package/build-module/components/block-list/block.js.map +2 -2
- package/build-module/components/block-list/index.js +2 -1
- package/build-module/components/block-list/index.js.map +2 -2
- package/build-module/components/block-list/use-block-props/index.js +3 -1
- package/build-module/components/block-list/use-block-props/index.js.map +2 -2
- package/build-module/components/block-list/use-block-props/use-is-hovered.js +16 -10
- package/build-module/components/block-list/use-block-props/use-is-hovered.js.map +2 -2
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +27 -5
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +2 -2
- package/build-module/components/block-lock/modal.js +5 -5
- package/build-module/components/block-lock/modal.js.map +2 -2
- package/build-module/components/block-lock/use-block-lock.js +10 -13
- package/build-module/components/block-lock/use-block-lock.js.map +2 -2
- package/build-module/components/block-settings-menu-controls/edit-section-menu-item.js +29 -0
- package/build-module/components/block-settings-menu-controls/edit-section-menu-item.js.map +7 -0
- package/build-module/components/block-settings-menu-controls/index.js +9 -1
- package/build-module/components/block-settings-menu-controls/index.js.map +2 -2
- package/build-module/components/block-toolbar/block-toolbar-icon.js +10 -10
- package/build-module/components/block-toolbar/block-toolbar-icon.js.map +2 -2
- package/build-module/components/block-tools/index.js +56 -45
- package/build-module/components/block-tools/index.js.map +2 -2
- package/build-module/components/block-variation-transforms/index.js +32 -5
- package/build-module/components/block-variation-transforms/index.js.map +2 -2
- package/build-module/components/block-visibility/toolbar.js +1 -1
- package/build-module/components/block-visibility/toolbar.js.map +1 -1
- package/build-module/components/border-radius-control/single-input-control.js +1 -0
- package/build-module/components/border-radius-control/single-input-control.js.map +2 -2
- package/build-module/components/content-only-controls/fields-dropdown-menu.js +45 -0
- package/build-module/components/content-only-controls/fields-dropdown-menu.js.map +7 -0
- package/build-module/components/content-only-controls/index.js +420 -0
- package/build-module/components/content-only-controls/index.js.map +7 -0
- package/build-module/components/content-only-controls/link/index.js +160 -0
- package/build-module/components/content-only-controls/link/index.js.map +7 -0
- package/build-module/components/content-only-controls/media/index.js +242 -0
- package/build-module/components/content-only-controls/media/index.js.map +7 -0
- package/build-module/components/content-only-controls/rich-text/index.js +160 -0
- package/build-module/components/content-only-controls/rich-text/index.js.map +7 -0
- package/build-module/components/content-only-controls/use-inspector-popover-placement.js +16 -0
- package/build-module/components/content-only-controls/use-inspector-popover-placement.js.map +7 -0
- package/build-module/components/font-family/index.js +1 -15
- package/build-module/components/font-family/index.js.map +2 -2
- package/build-module/components/global-styles/dimensions-panel.js +35 -2
- package/build-module/components/global-styles/dimensions-panel.js.map +2 -2
- package/build-module/components/global-styles/hooks.js +1 -1
- package/build-module/components/global-styles/hooks.js.map +2 -2
- package/build-module/components/global-styles/typography-panel.js +1 -2
- package/build-module/components/global-styles/typography-panel.js.map +2 -2
- package/build-module/components/inserter/media-tab/media-tab.js +2 -34
- package/build-module/components/inserter/media-tab/media-tab.js.map +2 -2
- package/build-module/components/inspector-controls-tabs/content-tab.js +7 -3
- package/build-module/components/inspector-controls-tabs/content-tab.js.map +2 -2
- package/build-module/components/inspector-controls-tabs/index.js +7 -1
- package/build-module/components/inspector-controls-tabs/index.js.map +2 -2
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +1 -1
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +2 -2
- package/build-module/components/link-control/index.js +16 -8
- package/build-module/components/link-control/index.js.map +2 -2
- package/build-module/components/list-view/block-select-button.js +14 -9
- package/build-module/components/list-view/block-select-button.js.map +2 -2
- package/build-module/components/list-view/block.js +9 -7
- package/build-module/components/list-view/block.js.map +2 -2
- package/build-module/components/media-placeholder/index.js +19 -36
- package/build-module/components/media-placeholder/index.js.map +2 -2
- package/build-module/components/media-placeholder/utils.js +35 -0
- package/build-module/components/media-placeholder/utils.js.map +7 -0
- package/build-module/components/media-replace-flow/index.js +24 -33
- package/build-module/components/media-replace-flow/index.js.map +2 -2
- package/build-module/components/use-block-commands/index.js +1 -1
- package/build-module/components/use-block-commands/index.js.map +2 -2
- package/build-module/components/use-block-display-information/index.js +21 -1
- package/build-module/components/use-block-display-information/index.js.map +3 -3
- package/build-module/components/use-block-drop-zone/index.js +1 -5
- package/build-module/components/use-block-drop-zone/index.js.map +2 -2
- package/build-module/hooks/block-bindings.js +57 -62
- package/build-module/hooks/block-bindings.js.map +2 -2
- package/build-module/hooks/dimensions.js +3 -3
- package/build-module/hooks/dimensions.js.map +2 -2
- package/build-module/hooks/metadata.js +1 -1
- package/build-module/hooks/metadata.js.map +2 -2
- package/build-module/hooks/use-content-only-section-edit.js +46 -0
- package/build-module/hooks/use-content-only-section-edit.js.map +7 -0
- package/build-module/hooks/utils.js +5 -1
- package/build-module/hooks/utils.js.map +2 -2
- package/build-module/layouts/constrained.js +2 -2
- package/build-module/layouts/constrained.js.map +2 -2
- package/build-module/private-apis.js +3 -3
- package/build-module/private-apis.js.map +2 -2
- package/build-module/store/private-keys.js +2 -0
- package/build-module/store/private-keys.js.map +2 -2
- package/build-module/store/private-selectors.js +37 -2
- package/build-module/store/private-selectors.js.map +2 -2
- package/build-module/store/selectors.js +6 -4
- package/build-module/store/selectors.js.map +2 -2
- package/build-module/utils/fit-text-utils.js +9 -1
- package/build-module/utils/fit-text-utils.js.map +2 -2
- package/build-style/content-rtl.css +3 -0
- package/build-style/content.css +3 -0
- package/build-style/style-rtl.css +145 -4
- package/build-style/style.css +145 -4
- package/package.json +38 -37
- package/src/components/block-inspector/edit-contents.js +10 -29
- package/src/components/block-inspector/index.js +4 -2
- package/src/components/block-list/block.js +6 -0
- package/src/components/block-list/content.scss +5 -0
- package/src/components/block-list/index.js +3 -1
- package/src/components/block-list/use-block-props/index.js +3 -1
- package/src/components/block-list/use-block-props/use-is-hovered.js +24 -12
- package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +34 -3
- package/src/components/block-lock/modal.js +6 -5
- package/src/components/block-lock/use-block-lock.js +10 -14
- package/src/components/block-patterns-list/stories/{index.story.js → index.story.jsx} +3 -1
- package/src/components/block-settings-menu-controls/edit-section-menu-item.js +39 -0
- package/src/components/block-settings-menu-controls/index.js +8 -1
- package/src/components/block-toolbar/block-toolbar-icon.js +14 -10
- package/src/components/block-tools/index.js +15 -2
- package/src/components/block-tools/style.scss +4 -0
- package/src/components/block-variation-transforms/index.js +96 -35
- package/src/components/block-visibility/toolbar.js +1 -1
- package/src/components/border-radius-control/single-input-control.js +1 -0
- package/src/components/content-only-controls/fields-dropdown-menu.js +53 -0
- package/src/components/content-only-controls/index.js +560 -0
- package/src/components/content-only-controls/link/index.js +200 -0
- package/src/components/content-only-controls/link/styles.scss +23 -0
- package/src/components/content-only-controls/media/index.js +306 -0
- package/src/components/content-only-controls/media/styles.scss +47 -0
- package/src/components/content-only-controls/rich-text/index.js +179 -0
- package/src/components/content-only-controls/rich-text/styles.scss +24 -0
- package/src/components/content-only-controls/styles.scss +44 -0
- package/src/components/content-only-controls/use-inspector-popover-placement.js +19 -0
- package/src/components/font-family/README.md +0 -9
- package/src/components/font-family/index.js +1 -16
- package/src/components/font-family/stories/{index.story.js → index.story.jsx} +0 -1
- package/src/components/global-styles/dimensions-panel.js +36 -0
- package/src/components/global-styles/hooks.js +1 -1
- package/src/components/global-styles/typography-panel.js +0 -1
- package/src/components/inserter/media-tab/media-tab.js +2 -44
- package/src/components/inspector-controls-tabs/content-tab.js +12 -4
- package/src/components/inspector-controls-tabs/index.js +4 -1
- package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +1 -5
- package/src/components/link-control/index.js +36 -12
- package/src/components/list-view/block-select-button.js +15 -10
- package/src/components/list-view/block.js +9 -7
- package/src/components/media-placeholder/index.js +21 -46
- package/src/components/media-placeholder/test/get-computed-accept-attribute.js +164 -0
- package/src/components/media-placeholder/utils.js +65 -0
- package/src/components/media-replace-flow/index.js +25 -42
- package/src/components/use-block-commands/index.js +1 -1
- package/src/components/use-block-display-information/index.js +30 -2
- package/src/components/use-block-drop-zone/index.js +1 -5
- package/src/hooks/block-bindings.js +71 -82
- package/src/hooks/dimensions.js +8 -3
- package/src/hooks/metadata.js +1 -1
- package/src/hooks/test/metadata.js +1 -1
- package/src/hooks/use-content-only-section-edit.js +63 -0
- package/src/hooks/utils.js +4 -0
- package/src/layouts/constrained.js +8 -2
- package/src/private-apis.js +2 -2
- package/src/store/private-keys.js +1 -0
- package/src/store/private-selectors.js +121 -5
- package/src/store/selectors.js +6 -4
- package/src/store/test/private-selectors.js +242 -0
- package/src/style.scss +1 -1
- package/src/utils/fit-text-utils.js +19 -1
- package/tsconfig.json +1 -0
- package/build/components/media-upload-modal/index.js +0 -29
- package/build/components/media-upload-modal/index.js.map +0 -7
- package/build-module/components/media-upload-modal/index.js +0 -8
- package/build-module/components/media-upload-modal/index.js.map +0 -7
- package/src/components/font-family/style.scss +0 -7
- package/src/components/media-upload-modal/index.js +0 -18
- /package/src/components/alignment-control/stories/{aliginment-toolbar.story.js → aliginment-toolbar.story.jsx} +0 -0
- /package/src/components/alignment-control/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/block-alignment-matrix-control/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/block-draggable/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/block-heading-level-dropdown/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/block-mover/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/block-title/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/border-radius-control/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/date-format-picker/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/dimensions-tool/stories/{aspect-ratio-tool.story.js → aspect-ratio-tool.story.jsx} +0 -0
- /package/src/components/dimensions-tool/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/dimensions-tool/stories/{scale-tool.story.js → scale-tool.story.jsx} +0 -0
- /package/src/components/dimensions-tool/stories/{width-height-tool.story.js → width-height-tool.story.jsx} +0 -0
- /package/src/components/height-control/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/inserter/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/line-height-control/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/plain-text/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/resolution-tool/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/tabbed-sidebar/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/text-alignment-control/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/text-decoration-control/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/text-transform-control/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/unit-control/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/url-popover/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/warning/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/writing-mode-control/stories/{index.story.js → index.story.jsx} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-toolbar/block-toolbar-icon.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { ToolbarButton } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { copy } from '@wordpress/icons';\nimport { getBlockType, store as blocksStore } from '@wordpress/blocks';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport BlockSwitcher from '../block-switcher';\nimport BlockIcon from '../block-icon';\nimport PatternOverridesDropdown from './pattern-overrides-dropdown';\nimport useBlockDisplayTitle from '../block-title/use-block-display-title';\nimport { store as blockEditorStore } from '../../store';\nimport { hasPatternOverridesDefaultBinding } from '../../utils/block-bindings';\nimport { unlock } from '../../lock-unlock';\n\nfunction getBlockIconVariant( { select, clientIds } ) {\n\tconst {\n\t\tgetBlockName,\n\t\tgetBlockAttributes,\n\t\tgetBlockParentsByBlockName,\n\t\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAA8B;AAC9B,kBAAmB;AACnB,kBAA0B;AAC1B,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { ToolbarButton } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { copy, symbol } from '@wordpress/icons';\nimport { getBlockType, store as blocksStore } from '@wordpress/blocks';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport BlockSwitcher from '../block-switcher';\nimport BlockIcon from '../block-icon';\nimport PatternOverridesDropdown from './pattern-overrides-dropdown';\nimport useBlockDisplayTitle from '../block-title/use-block-display-title';\nimport { store as blockEditorStore } from '../../store';\nimport { hasPatternOverridesDefaultBinding } from '../../utils/block-bindings';\nimport { unlock } from '../../lock-unlock';\n\nfunction getBlockIconVariant( { select, clientIds } ) {\n\tconst {\n\t\tgetBlockName,\n\t\tgetBlockAttributes,\n\t\tgetBlockParentsByBlockName,\n\t\tcanRemoveBlocks,\n\t\tgetTemplateLock,\n\t\tgetBlockEditingMode,\n\t} = unlock( select( blockEditorStore ) );\n\tconst { getBlockStyles } = select( blocksStore );\n\n\tconst hasTemplateLock = clientIds.some(\n\t\t( id ) => getTemplateLock( id ) === 'contentOnly'\n\t);\n\n\t// Calculate props only used in this function\n\tconst isSingleBlock = clientIds.length === 1;\n\tconst blockName = isSingleBlock && getBlockName( clientIds[ 0 ] );\n\tconst hasBlockStyles =\n\t\tisSingleBlock && !! getBlockStyles( blockName )?.length;\n\tconst hasPatternNameInSelection = clientIds.some(\n\t\t( id ) => !! getBlockAttributes( id )?.metadata?.patternName\n\t);\n\tconst hasPatternOverrides = clientIds.every( ( clientId ) =>\n\t\thasPatternOverridesDefaultBinding(\n\t\t\tgetBlockAttributes( clientId )?.metadata?.bindings\n\t\t)\n\t);\n\tconst hasParentPattern = clientIds.every(\n\t\t( clientId ) =>\n\t\t\tgetBlockParentsByBlockName( clientId, 'core/block', true ).length >\n\t\t\t0\n\t);\n\tconst canRemove = canRemoveBlocks( clientIds );\n\n\tconst isDefaultEditingMode =\n\t\tgetBlockEditingMode( clientIds[ 0 ] ) === 'default';\n\tconst _hideTransformsForSections =\n\t\twindow?.__experimentalContentOnlyPatternInsertion &&\n\t\thasPatternNameInSelection;\n\tconst _showBlockSwitcher =\n\t\t! _hideTransformsForSections &&\n\t\tisDefaultEditingMode &&\n\t\t( hasBlockStyles || canRemove ) &&\n\t\t! hasTemplateLock;\n\n\tconst _showPatternOverrides = hasPatternOverrides && hasParentPattern;\n\n\tif ( _showBlockSwitcher ) {\n\t\treturn 'switcher';\n\t} else if ( _showPatternOverrides ) {\n\t\treturn 'pattern-overrides';\n\t}\n\n\treturn 'default';\n}\n\nfunction getBlockIcon( { select, clientIds } ) {\n\tconst { getBlockName, getBlockAttributes } = unlock(\n\t\tselect( blockEditorStore )\n\t);\n\n\tconst _isSingleBlock = clientIds.length === 1;\n\tconst firstClientId = clientIds[ 0 ];\n\tconst blockAttributes = getBlockAttributes( firstClientId );\n\tif (\n\t\t_isSingleBlock &&\n\t\tblockAttributes?.metadata?.patternName &&\n\t\twindow?.__experimentalContentOnlyPatternInsertion\n\t) {\n\t\treturn symbol;\n\t}\n\n\tconst blockName = getBlockName( firstClientId );\n\tconst blockType = getBlockType( blockName );\n\n\tif ( _isSingleBlock ) {\n\t\tconst { getActiveBlockVariation } = select( blocksStore );\n\t\tconst match = getActiveBlockVariation( blockName, blockAttributes );\n\t\treturn match?.icon || blockType?.icon;\n\t}\n\n\tconst blockNames = clientIds.map( ( id ) => getBlockName( id ) );\n\tconst isSelectionOfSameType = new Set( blockNames ).size === 1;\n\treturn isSelectionOfSameType ? blockType?.icon : copy;\n}\n\nexport default function BlockToolbarIcon( { clientIds, isSynced } ) {\n\tconst { icon, showIconLabels, variant } = useSelect(\n\t\t( select ) => {\n\t\t\treturn {\n\t\t\t\ticon: getBlockIcon( { select, clientIds } ),\n\t\t\t\tshowIconLabels: select( preferencesStore ).get(\n\t\t\t\t\t'core',\n\t\t\t\t\t'showIconLabels'\n\t\t\t\t),\n\t\t\t\tvariant: getBlockIconVariant( {\n\t\t\t\t\tselect,\n\t\t\t\t\tclientIds,\n\t\t\t\t} ),\n\t\t\t};\n\t\t},\n\t\t[ clientIds ]\n\t);\n\n\tconst blockTitle = useBlockDisplayTitle( {\n\t\tclientId: clientIds?.[ 0 ],\n\t\tmaximumLength: 35,\n\t} );\n\n\tconst isSingleBlock = clientIds.length === 1;\n\tconst showBlockTitle = isSingleBlock && isSynced && ! showIconLabels;\n\tconst label = isSingleBlock ? blockTitle : __( 'Multiple blocks selected' );\n\t// Used to hide the block icon when the showIconLabels preference is enabled, or to display the template title when it's a template.\n\tconst text = showBlockTitle && blockTitle ? blockTitle : undefined;\n\n\tconst BlockIconElement = (\n\t\t<BlockIcon\n\t\t\tclassName=\"block-editor-block-toolbar__block-icon\"\n\t\t\ticon={ icon }\n\t\t/>\n\t);\n\n\tif ( variant === 'switcher' ) {\n\t\treturn (\n\t\t\t<BlockSwitcher\n\t\t\t\tclientIds={ clientIds }\n\t\t\t\tlabel={ label }\n\t\t\t\ttext={ text }\n\t\t\t>\n\t\t\t\t{ BlockIconElement }\n\t\t\t</BlockSwitcher>\n\t\t);\n\t}\n\n\tif ( variant === 'pattern-overrides' ) {\n\t\treturn (\n\t\t\t<PatternOverridesDropdown\n\t\t\t\ticon={ BlockIconElement }\n\t\t\t\tclientIds={ clientIds }\n\t\t\t\tblockTitle={ blockTitle }\n\t\t\t\tlabel={ label }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<ToolbarButton\n\t\t\tdisabled\n\t\t\tclassName=\"block-editor-block-toolbar__block-icon-button\"\n\t\t\ttitle={ label }\n\t\t\ticon={ BlockIconElement }\n\t\t\ttext={ text }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAA8B;AAC9B,kBAAmB;AACnB,kBAA0B;AAC1B,mBAA6B;AAC7B,oBAAmD;AACnD,yBAA0C;AAK1C,4BAA0B;AAC1B,wBAAsB;AACtB,wCAAqC;AACrC,qCAAiC;AACjC,mBAA0C;AAC1C,4BAAkD;AAClD,yBAAuB;AAuHrB;AArHF,SAAS,oBAAqB,EAAE,QAAQ,UAAU,GAAI;AACrD,QAAM;AAAA,IACL;AAAA,IACA;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AC;AAAA,MAAA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QAEE;AAAA;AAAA,IACH;AAAA,EAEF;AAEA,MAAK,YAAY,qBAAsB;AACtC,WACC;AAAA,MAAC,kCAAAC;AAAA,MAAA;AAAA,QACA,MAAO;AAAA,QACP;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACD;AAAA,EAEF;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,UAAQ;AAAA,MACR,WAAU;AAAA,MACV,OAAQ;AAAA,MACR,MAAO;AAAA,MACP;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": ["blockEditorStore", "blocksStore", "preferencesStore", "useBlockDisplayTitle", "BlockIcon", "BlockSwitcher", "PatternOverridesDropdown"]
|
|
7
7
|
}
|
|
@@ -33,6 +33,7 @@ __export(block_tools_exports, {
|
|
|
33
33
|
default: () => BlockTools
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(block_tools_exports);
|
|
36
|
+
var import_clsx = __toESM(require("clsx"));
|
|
36
37
|
var import_data = require("@wordpress/data");
|
|
37
38
|
var import_dom = require("@wordpress/dom");
|
|
38
39
|
var import_components = require("@wordpress/components");
|
|
@@ -197,7 +198,7 @@ function BlockTools({
|
|
|
197
198
|
const canToggleBlockVisibility = blocks.every(
|
|
198
199
|
(block) => (0, import_blocks.hasBlockSupport)(
|
|
199
200
|
getBlockName(block.clientId),
|
|
200
|
-
"
|
|
201
|
+
"visibility",
|
|
201
202
|
true
|
|
202
203
|
)
|
|
203
204
|
);
|
|
@@ -233,50 +234,60 @@ function BlockTools({
|
|
|
233
234
|
const blockToolbarAfterRef = (0, import_use_popover_scroll.default)(__unstableContentRef);
|
|
234
235
|
return (
|
|
235
236
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
236
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
237
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
238
|
+
"div",
|
|
239
|
+
{
|
|
240
|
+
...props,
|
|
241
|
+
onKeyDown,
|
|
242
|
+
className: (0, import_clsx.default)(props.className, {
|
|
243
|
+
"block-editor-block-tools--is-dragging": isDragging
|
|
244
|
+
}),
|
|
245
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_insertion_point.InsertionPointOpenRef.Provider, { value: (0, import_element.useRef)(false), children: [
|
|
246
|
+
!isTyping && !isZoomOutMode && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
247
|
+
import_insertion_point.default,
|
|
248
|
+
{
|
|
249
|
+
__unstableContentRef
|
|
250
|
+
}
|
|
251
|
+
),
|
|
252
|
+
showEmptyBlockSideInserter && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
253
|
+
import_empty_block_inserter.default,
|
|
254
|
+
{
|
|
255
|
+
__unstableContentRef,
|
|
256
|
+
clientId
|
|
257
|
+
}
|
|
258
|
+
),
|
|
259
|
+
showBlockToolbarPopover && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
260
|
+
import_block_toolbar_popover.default,
|
|
261
|
+
{
|
|
262
|
+
__unstableContentRef,
|
|
263
|
+
clientId,
|
|
264
|
+
isTyping
|
|
265
|
+
}
|
|
266
|
+
),
|
|
267
|
+
!isZoomOutMode && !hasFixedToolbar && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
268
|
+
import_components.Popover.Slot,
|
|
269
|
+
{
|
|
270
|
+
name: "block-toolbar",
|
|
271
|
+
ref: blockToolbarRef
|
|
272
|
+
}
|
|
273
|
+
),
|
|
274
|
+
children,
|
|
275
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
276
|
+
import_components.Popover.Slot,
|
|
277
|
+
{
|
|
278
|
+
name: "__unstable-block-tools-after",
|
|
279
|
+
ref: blockToolbarAfterRef
|
|
280
|
+
}
|
|
281
|
+
),
|
|
282
|
+
isZoomOutMode && !isDragging && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
283
|
+
import_zoom_out_mode_inserters.default,
|
|
284
|
+
{
|
|
285
|
+
__unstableContentRef
|
|
286
|
+
}
|
|
287
|
+
)
|
|
288
|
+
] })
|
|
289
|
+
}
|
|
290
|
+
)
|
|
280
291
|
);
|
|
281
292
|
}
|
|
282
293
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-tools/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { isTextField } from '@wordpress/dom';\nimport { Popover } from '@wordpress/components';\nimport { __unstableUseShortcutEventMatch as useShortcutEventMatch } from '@wordpress/keyboard-shortcuts';\nimport { useRef } from '@wordpress/element';\nimport {\n\tswitchToBlockType,\n\tstore as blocksStore,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { speak } from '@wordpress/a11y';\nimport { __, sprintf, _n } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport EmptyBlockInserter from './empty-block-inserter';\nimport {\n\tInsertionPointOpenRef,\n\tdefault as InsertionPoint,\n} from './insertion-point';\nimport BlockToolbarPopover from './block-toolbar-popover';\nimport { store as blockEditorStore } from '../../store';\nimport usePopoverScroll from '../block-popover/use-popover-scroll';\nimport ZoomOutModeInserters from './zoom-out-mode-inserters';\nimport { useShowBlockTools } from './use-show-block-tools';\nimport { unlock } from '../../lock-unlock';\nimport { cleanEmptyObject } from '../../hooks/utils';\nimport usePasteStyles from '../use-paste-styles';\n\nfunction selector( select ) {\n\tconst {\n\t\tgetSelectedBlockClientId,\n\t\tgetFirstMultiSelectedBlockClientId,\n\t\tgetSettings,\n\t\tisTyping,\n\t\tisDragging,\n\t\tisZoomOut,\n\t} = unlock( select( blockEditorStore ) );\n\n\tconst clientId =\n\t\tgetSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();\n\n\treturn {\n\t\tclientId,\n\t\thasFixedToolbar: getSettings().hasFixedToolbar,\n\t\tisTyping: isTyping(),\n\t\tisZoomOutMode: isZoomOut(),\n\t\tisDragging: isDragging(),\n\t};\n}\n\n/**\n * Renders block tools (the block toolbar, select/navigation mode toolbar, the\n * insertion point and a slot for the inline rich text toolbar). Must be wrapped\n * around the block content and editor styles wrapper or iframe.\n *\n * @param {Object} $0 Props.\n * @param {Object} $0.children The block content and style container.\n * @param {Object} $0.__unstableContentRef Ref holding the content scroll container.\n */\nexport default function BlockTools( {\n\tchildren,\n\t__unstableContentRef,\n\t...props\n} ) {\n\tconst { clientId, hasFixedToolbar, isTyping, isZoomOutMode, isDragging } =\n\t\tuseSelect( selector, [] );\n\n\tconst isMatch = useShortcutEventMatch();\n\tconst {\n\t\tgetBlocksByClientId,\n\t\tgetSelectedBlockClientIds,\n\t\tgetBlockRootClientId,\n\t\tisGroupable,\n\t\tgetBlockName,\n\t\tgetEditedContentOnlySection,\n\t} = unlock( useSelect( blockEditorStore ) );\n\tconst { getGroupingBlockName } = useSelect( blocksStore );\n\tconst { showEmptyBlockSideInserter, showBlockToolbarPopover } =\n\t\tuseShowBlockTools();\n\tconst pasteStyles = usePasteStyles();\n\n\tconst {\n\t\tduplicateBlocks,\n\t\tremoveBlocks,\n\t\treplaceBlocks,\n\t\tinsertAfterBlock,\n\t\tinsertBeforeBlock,\n\t\tselectBlock,\n\t\tmoveBlocksUp,\n\t\tmoveBlocksDown,\n\t\texpandBlock,\n\t\tupdateBlockAttributes,\n\t\tstopEditingContentOnlySection,\n\t} = unlock( useDispatch( blockEditorStore ) );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( event.defaultPrevented ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\tisMatch( 'core/block-editor/move-up', event ) ||\n\t\t\tisMatch( 'core/block-editor/move-down', event )\n\t\t) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\t\t\t\tconst direction = isMatch( 'core/block-editor/move-up', event )\n\t\t\t\t\t? 'up'\n\t\t\t\t\t: 'down';\n\t\t\t\tif ( direction === 'up' ) {\n\t\t\t\t\tmoveBlocksUp( clientIds, rootClientId );\n\t\t\t\t} else {\n\t\t\t\t\tmoveBlocksDown( clientIds, rootClientId );\n\t\t\t\t}\n\t\t\t\tconst blockLength = Array.isArray( clientIds )\n\t\t\t\t\t? clientIds.length\n\t\t\t\t\t: 1;\n\t\t\t\tconst message = sprintf(\n\t\t\t\t\t// translators: %d: the name of the block that has been moved\n\t\t\t\t\t_n(\n\t\t\t\t\t\t'%d block moved.',\n\t\t\t\t\t\t'%d blocks moved.',\n\t\t\t\t\t\tclientIds.length\n\t\t\t\t\t),\n\t\t\t\t\tblockLength\n\t\t\t\t);\n\t\t\t\tspeak( message );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/duplicate', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tduplicateBlocks( clientIds );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/remove', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tremoveBlocks( clientIds );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/paste-styles', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst blocks = getBlocksByClientId( clientIds );\n\t\t\t\tpasteStyles( blocks );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/insert-after', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tinsertAfterBlock( clientIds[ clientIds.length - 1 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/insert-before', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tinsertBeforeBlock( clientIds[ 0 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/unselect', event ) ) {\n\t\t\tif ( event.target.closest( '[role=toolbar]' ) ) {\n\t\t\t\t// This shouldn't be necessary, but we have a combination of a few things all combining to create a situation where:\n\t\t\t\t// - Because the block toolbar uses createPortal to populate the block toolbar fills, we can't rely on the React event bubbling to hit the onKeyDown listener for the block toolbar\n\t\t\t\t// - Since we can't use the React tree, we use the DOM tree which _should_ handle the event bubbling correctly from a `createPortal` element.\n\t\t\t\t// - This bubbles via the React tree, which hits this `unselect` escape keypress before the block toolbar DOM event listener has access to it.\n\t\t\t\t// An alternative would be to remove the addEventListener on the navigableToolbar and use this event to handle it directly right here. That feels hacky too though.\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length > 1 ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\t// If there is more than one block selected, select the first\n\t\t\t\t// block so that focus is directed back to the beginning of the selection.\n\t\t\t\t// In effect, to the user this feels like deselecting the multi-selection.\n\t\t\t\tselectBlock( clientIds[ 0 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/collapse-list-view', event ) ) {\n\t\t\t// If focus is currently within a text field, such as a rich text block or other editable field,\n\t\t\t// skip collapsing the list view, and allow the keyboard shortcut to be handled by the text field.\n\t\t\t// This condition checks for both the active element and the active element within an iframed editor.\n\t\t\tif (\n\t\t\t\tisTextField( event.target ) ||\n\t\t\t\tisTextField(\n\t\t\t\t\tevent.target?.contentWindow?.document?.activeElement\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tevent.preventDefault();\n\t\t\texpandBlock( clientId );\n\t\t} else if ( isMatch( 'core/block-editor/group', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length > 1 && isGroupable( clientIds ) ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst blocks = getBlocksByClientId( clientIds );\n\t\t\t\tconst groupingBlockName = getGroupingBlockName();\n\t\t\t\tconst newBlocks = switchToBlockType(\n\t\t\t\t\tblocks,\n\t\t\t\t\tgroupingBlockName\n\t\t\t\t);\n\t\t\t\treplaceBlocks( clientIds, newBlocks );\n\t\t\t\tspeak( __( 'Selected blocks are grouped.' ) );\n\t\t\t}\n\t\t} else if (\n\t\t\tisMatch( 'core/block-editor/toggle-block-visibility', event )\n\t\t) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst blocks = getBlocksByClientId( clientIds );\n\t\t\t\tconst canToggleBlockVisibility = blocks.every( ( block ) =>\n\t\t\t\t\thasBlockSupport(\n\t\t\t\t\t\tgetBlockName( block.clientId ),\n\t\t\t\t\t\t'blockVisibility',\n\t\t\t\t\t\ttrue\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t\tif ( ! canToggleBlockVisibility ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst hasHiddenBlock = blocks.some(\n\t\t\t\t\t( block ) =>\n\t\t\t\t\t\tblock.attributes.metadata?.blockVisibility === false\n\t\t\t\t);\n\t\t\t\tconst attributesByClientId = Object.fromEntries(\n\t\t\t\t\tblocks.map( ( { clientId: mapClientId, attributes } ) => [\n\t\t\t\t\t\tmapClientId,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmetadata: cleanEmptyObject( {\n\t\t\t\t\t\t\t\t...attributes?.metadata,\n\t\t\t\t\t\t\t\tblockVisibility: hasHiddenBlock\n\t\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t\t: false,\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\tupdateBlockAttributes( clientIds, attributesByClientId, {\n\t\t\t\t\tuniqueByBlock: true,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\n\t\t// Has the same keyboard shortcut as 'unselect', so can't be within the\n\t\t// if/else chain above.\n\t\tif ( isMatch( 'core/block-editor/stop-editing-as-blocks', event ) ) {\n\t\t\tif ( getEditedContentOnlySection() ) {\n\t\t\t\tstopEditingContentOnlySection();\n\t\t\t}\n\t\t}\n\t}\n\tconst blockToolbarRef = usePopoverScroll( __unstableContentRef );\n\tconst blockToolbarAfterRef = usePopoverScroll( __unstableContentRef );\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div { ...props } onKeyDown={ onKeyDown }>\n\t\t\t<InsertionPointOpenRef.Provider value={ useRef( false ) }>\n\t\t\t\t{ ! isTyping && ! isZoomOutMode && (\n\t\t\t\t\t<InsertionPoint\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ showEmptyBlockSideInserter && (\n\t\t\t\t\t<EmptyBlockInserter\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ showBlockToolbarPopover && (\n\t\t\t\t\t<BlockToolbarPopover\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tisTyping={ isTyping }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ /* Used for the inline rich text toolbar. Until this toolbar is combined into BlockToolbar, someone implementing their own BlockToolbar will also need to use this to see the image caption toolbar. */ }\n\t\t\t\t{ ! isZoomOutMode && ! hasFixedToolbar && (\n\t\t\t\t\t<Popover.Slot\n\t\t\t\t\t\tname=\"block-toolbar\"\n\t\t\t\t\t\tref={ blockToolbarRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ children }\n\t\t\t\t{ /* Used for inline rich text popovers. */ }\n\t\t\t\t<Popover.Slot\n\t\t\t\t\tname=\"__unstable-block-tools-after\"\n\t\t\t\t\tref={ blockToolbarAfterRef }\n\t\t\t\t/>\n\t\t\t\t{ isZoomOutMode && ! isDragging && (\n\t\t\t\t\t<ZoomOutModeInserters\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</InsertionPointOpenRef.Provider>\n\t\t</div>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAuC;AACvC,iBAA4B;AAC5B,wBAAwB;AACxB,gCAAyE;AACzE,qBAAuB;AACvB,oBAIO;AACP,kBAAsB;AACtB,kBAAgC;AAKhC,kCAA+B;AAC/B,6BAGO;AACP,mCAAgC;AAChC,mBAA0C;AAC1C,gCAA6B;AAC7B,qCAAiC;AACjC,kCAAkC;AAClC,yBAAuB;AACvB,mBAAiC;AACjC,8BAA2B;
|
|
6
|
-
"names": ["blockEditorStore", "useShortcutEventMatch", "blocksStore", "usePasteStyles", "usePopoverScroll", "InsertionPoint", "EmptyBlockInserter", "BlockToolbarPopover", "ZoomOutModeInserters"]
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { isTextField } from '@wordpress/dom';\nimport { Popover } from '@wordpress/components';\nimport { __unstableUseShortcutEventMatch as useShortcutEventMatch } from '@wordpress/keyboard-shortcuts';\nimport { useRef } from '@wordpress/element';\nimport {\n\tswitchToBlockType,\n\tstore as blocksStore,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { speak } from '@wordpress/a11y';\nimport { __, sprintf, _n } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport EmptyBlockInserter from './empty-block-inserter';\nimport {\n\tInsertionPointOpenRef,\n\tdefault as InsertionPoint,\n} from './insertion-point';\nimport BlockToolbarPopover from './block-toolbar-popover';\nimport { store as blockEditorStore } from '../../store';\nimport usePopoverScroll from '../block-popover/use-popover-scroll';\nimport ZoomOutModeInserters from './zoom-out-mode-inserters';\nimport { useShowBlockTools } from './use-show-block-tools';\nimport { unlock } from '../../lock-unlock';\nimport { cleanEmptyObject } from '../../hooks/utils';\nimport usePasteStyles from '../use-paste-styles';\n\nfunction selector( select ) {\n\tconst {\n\t\tgetSelectedBlockClientId,\n\t\tgetFirstMultiSelectedBlockClientId,\n\t\tgetSettings,\n\t\tisTyping,\n\t\tisDragging,\n\t\tisZoomOut,\n\t} = unlock( select( blockEditorStore ) );\n\n\tconst clientId =\n\t\tgetSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();\n\n\treturn {\n\t\tclientId,\n\t\thasFixedToolbar: getSettings().hasFixedToolbar,\n\t\tisTyping: isTyping(),\n\t\tisZoomOutMode: isZoomOut(),\n\t\tisDragging: isDragging(),\n\t};\n}\n\n/**\n * Renders block tools (the block toolbar, select/navigation mode toolbar, the\n * insertion point and a slot for the inline rich text toolbar). Must be wrapped\n * around the block content and editor styles wrapper or iframe.\n *\n * @param {Object} $0 Props.\n * @param {Object} $0.children The block content and style container.\n * @param {Object} $0.__unstableContentRef Ref holding the content scroll container.\n */\nexport default function BlockTools( {\n\tchildren,\n\t__unstableContentRef,\n\t...props\n} ) {\n\tconst { clientId, hasFixedToolbar, isTyping, isZoomOutMode, isDragging } =\n\t\tuseSelect( selector, [] );\n\n\tconst isMatch = useShortcutEventMatch();\n\tconst {\n\t\tgetBlocksByClientId,\n\t\tgetSelectedBlockClientIds,\n\t\tgetBlockRootClientId,\n\t\tisGroupable,\n\t\tgetBlockName,\n\t\tgetEditedContentOnlySection,\n\t} = unlock( useSelect( blockEditorStore ) );\n\tconst { getGroupingBlockName } = useSelect( blocksStore );\n\tconst { showEmptyBlockSideInserter, showBlockToolbarPopover } =\n\t\tuseShowBlockTools();\n\tconst pasteStyles = usePasteStyles();\n\n\tconst {\n\t\tduplicateBlocks,\n\t\tremoveBlocks,\n\t\treplaceBlocks,\n\t\tinsertAfterBlock,\n\t\tinsertBeforeBlock,\n\t\tselectBlock,\n\t\tmoveBlocksUp,\n\t\tmoveBlocksDown,\n\t\texpandBlock,\n\t\tupdateBlockAttributes,\n\t\tstopEditingContentOnlySection,\n\t} = unlock( useDispatch( blockEditorStore ) );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( event.defaultPrevented ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\tisMatch( 'core/block-editor/move-up', event ) ||\n\t\t\tisMatch( 'core/block-editor/move-down', event )\n\t\t) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\t\t\t\tconst direction = isMatch( 'core/block-editor/move-up', event )\n\t\t\t\t\t? 'up'\n\t\t\t\t\t: 'down';\n\t\t\t\tif ( direction === 'up' ) {\n\t\t\t\t\tmoveBlocksUp( clientIds, rootClientId );\n\t\t\t\t} else {\n\t\t\t\t\tmoveBlocksDown( clientIds, rootClientId );\n\t\t\t\t}\n\t\t\t\tconst blockLength = Array.isArray( clientIds )\n\t\t\t\t\t? clientIds.length\n\t\t\t\t\t: 1;\n\t\t\t\tconst message = sprintf(\n\t\t\t\t\t// translators: %d: the name of the block that has been moved\n\t\t\t\t\t_n(\n\t\t\t\t\t\t'%d block moved.',\n\t\t\t\t\t\t'%d blocks moved.',\n\t\t\t\t\t\tclientIds.length\n\t\t\t\t\t),\n\t\t\t\t\tblockLength\n\t\t\t\t);\n\t\t\t\tspeak( message );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/duplicate', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tduplicateBlocks( clientIds );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/remove', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tremoveBlocks( clientIds );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/paste-styles', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst blocks = getBlocksByClientId( clientIds );\n\t\t\t\tpasteStyles( blocks );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/insert-after', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tinsertAfterBlock( clientIds[ clientIds.length - 1 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/insert-before', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tinsertBeforeBlock( clientIds[ 0 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/unselect', event ) ) {\n\t\t\tif ( event.target.closest( '[role=toolbar]' ) ) {\n\t\t\t\t// This shouldn't be necessary, but we have a combination of a few things all combining to create a situation where:\n\t\t\t\t// - Because the block toolbar uses createPortal to populate the block toolbar fills, we can't rely on the React event bubbling to hit the onKeyDown listener for the block toolbar\n\t\t\t\t// - Since we can't use the React tree, we use the DOM tree which _should_ handle the event bubbling correctly from a `createPortal` element.\n\t\t\t\t// - This bubbles via the React tree, which hits this `unselect` escape keypress before the block toolbar DOM event listener has access to it.\n\t\t\t\t// An alternative would be to remove the addEventListener on the navigableToolbar and use this event to handle it directly right here. That feels hacky too though.\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length > 1 ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\t// If there is more than one block selected, select the first\n\t\t\t\t// block so that focus is directed back to the beginning of the selection.\n\t\t\t\t// In effect, to the user this feels like deselecting the multi-selection.\n\t\t\t\tselectBlock( clientIds[ 0 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/collapse-list-view', event ) ) {\n\t\t\t// If focus is currently within a text field, such as a rich text block or other editable field,\n\t\t\t// skip collapsing the list view, and allow the keyboard shortcut to be handled by the text field.\n\t\t\t// This condition checks for both the active element and the active element within an iframed editor.\n\t\t\tif (\n\t\t\t\tisTextField( event.target ) ||\n\t\t\t\tisTextField(\n\t\t\t\t\tevent.target?.contentWindow?.document?.activeElement\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tevent.preventDefault();\n\t\t\texpandBlock( clientId );\n\t\t} else if ( isMatch( 'core/block-editor/group', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length > 1 && isGroupable( clientIds ) ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst blocks = getBlocksByClientId( clientIds );\n\t\t\t\tconst groupingBlockName = getGroupingBlockName();\n\t\t\t\tconst newBlocks = switchToBlockType(\n\t\t\t\t\tblocks,\n\t\t\t\t\tgroupingBlockName\n\t\t\t\t);\n\t\t\t\treplaceBlocks( clientIds, newBlocks );\n\t\t\t\tspeak( __( 'Selected blocks are grouped.' ) );\n\t\t\t}\n\t\t} else if (\n\t\t\tisMatch( 'core/block-editor/toggle-block-visibility', event )\n\t\t) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst blocks = getBlocksByClientId( clientIds );\n\t\t\t\tconst canToggleBlockVisibility = blocks.every( ( block ) =>\n\t\t\t\t\thasBlockSupport(\n\t\t\t\t\t\tgetBlockName( block.clientId ),\n\t\t\t\t\t\t'visibility',\n\t\t\t\t\t\ttrue\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t\tif ( ! canToggleBlockVisibility ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst hasHiddenBlock = blocks.some(\n\t\t\t\t\t( block ) =>\n\t\t\t\t\t\tblock.attributes.metadata?.blockVisibility === false\n\t\t\t\t);\n\t\t\t\tconst attributesByClientId = Object.fromEntries(\n\t\t\t\t\tblocks.map( ( { clientId: mapClientId, attributes } ) => [\n\t\t\t\t\t\tmapClientId,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmetadata: cleanEmptyObject( {\n\t\t\t\t\t\t\t\t...attributes?.metadata,\n\t\t\t\t\t\t\t\tblockVisibility: hasHiddenBlock\n\t\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t\t: false,\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\tupdateBlockAttributes( clientIds, attributesByClientId, {\n\t\t\t\t\tuniqueByBlock: true,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\n\t\t// Has the same keyboard shortcut as 'unselect', so can't be within the\n\t\t// if/else chain above.\n\t\tif ( isMatch( 'core/block-editor/stop-editing-as-blocks', event ) ) {\n\t\t\tif ( getEditedContentOnlySection() ) {\n\t\t\t\tstopEditingContentOnlySection();\n\t\t\t}\n\t\t}\n\t}\n\tconst blockToolbarRef = usePopoverScroll( __unstableContentRef );\n\tconst blockToolbarAfterRef = usePopoverScroll( __unstableContentRef );\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\t{ ...props }\n\t\t\tonKeyDown={ onKeyDown }\n\t\t\t// Popover slots cannot be unmounted during dragging because the\n\t\t\t// will just be rendered in a fallback popover slot instead.\n\t\t\tclassName={ clsx( props.className, {\n\t\t\t\t'block-editor-block-tools--is-dragging': isDragging,\n\t\t\t} ) }\n\t\t>\n\t\t\t<InsertionPointOpenRef.Provider value={ useRef( false ) }>\n\t\t\t\t{ ! isTyping && ! isZoomOutMode && (\n\t\t\t\t\t<InsertionPoint\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ showEmptyBlockSideInserter && (\n\t\t\t\t\t<EmptyBlockInserter\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ showBlockToolbarPopover && (\n\t\t\t\t\t<BlockToolbarPopover\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tisTyping={ isTyping }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ /* Used for the inline rich text toolbar. Until this toolbar is combined into BlockToolbar, someone implementing their own BlockToolbar will also need to use this to see the image caption toolbar. */ }\n\t\t\t\t{ ! isZoomOutMode && ! hasFixedToolbar && (\n\t\t\t\t\t<Popover.Slot\n\t\t\t\t\t\tname=\"block-toolbar\"\n\t\t\t\t\t\tref={ blockToolbarRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ children }\n\t\t\t\t{ /* Used for inline rich text popovers. */ }\n\t\t\t\t<Popover.Slot\n\t\t\t\t\tname=\"__unstable-block-tools-after\"\n\t\t\t\t\tref={ blockToolbarAfterRef }\n\t\t\t\t/>\n\t\t\t\t{ isZoomOutMode && ! isDragging && (\n\t\t\t\t\t<ZoomOutModeInserters\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</InsertionPointOpenRef.Provider>\n\t\t</div>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,kBAAuC;AACvC,iBAA4B;AAC5B,wBAAwB;AACxB,gCAAyE;AACzE,qBAAuB;AACvB,oBAIO;AACP,kBAAsB;AACtB,kBAAgC;AAKhC,kCAA+B;AAC/B,6BAGO;AACP,mCAAgC;AAChC,mBAA0C;AAC1C,gCAA6B;AAC7B,qCAAiC;AACjC,kCAAkC;AAClC,yBAAuB;AACvB,mBAAiC;AACjC,8BAA2B;AAkPxB;AAhPH,SAAS,SAAU,QAAS;AAC3B,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,QAAI,2BAAQ,OAAQ,aAAAA,KAAiB,CAAE;AAEvC,QAAM,WACL,yBAAyB,KAAK,mCAAmC;AAElE,SAAO;AAAA,IACN;AAAA,IACA,iBAAiB,YAAY,EAAE;AAAA,IAC/B,UAAU,SAAS;AAAA,IAC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BAAkB,0BAAAI,SAAkB,oBAAqB;AAC/D,QAAM,2BAAuB,0BAAAA,SAAkB,oBAAqB;AAEpE;AAAA;AAAA,IAEC;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QACL;AAAA,QAGA,eAAY,YAAAC,SAAM,MAAM,WAAW;AAAA,UAClC,yCAAyC;AAAA,QAC1C,CAAE;AAAA,QAEF,uDAAC,6CAAsB,UAAtB,EAA+B,WAAQ,uBAAQ,KAAM,GACnD;AAAA,WAAE,YAAY,CAAE,iBACjB;AAAA,YAAC,uBAAAC;AAAA,YAAA;AAAA,cACA;AAAA;AAAA,UACD;AAAA,UAGC,8BACD;AAAA,YAAC,4BAAAC;AAAA,YAAA;AAAA,cACA;AAAA,cACA;AAAA;AAAA,UACD;AAAA,UAGC,2BACD;AAAA,YAAC,6BAAAC;AAAA,YAAA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA;AAAA,UACD;AAAA,UAIC,CAAE,iBAAiB,CAAE,mBACtB;AAAA,YAAC,0BAAQ;AAAA,YAAR;AAAA,cACA,MAAK;AAAA,cACL,KAAM;AAAA;AAAA,UACP;AAAA,UAEC;AAAA,UAEF;AAAA,YAAC,0BAAQ;AAAA,YAAR;AAAA,cACA,MAAK;AAAA,cACL,KAAM;AAAA;AAAA,UACP;AAAA,UACE,iBAAiB,CAAE,cACpB;AAAA,YAAC,+BAAAC;AAAA,YAAA;AAAA,cACA;AAAA;AAAA,UACD;AAAA,WAEF;AAAA;AAAA,IACD;AAAA;AAEF;",
|
|
6
|
+
"names": ["blockEditorStore", "useShortcutEventMatch", "blocksStore", "usePasteStyles", "usePopoverScroll", "clsx", "InsertionPoint", "EmptyBlockInserter", "BlockToolbarPopover", "ZoomOutModeInserters"]
|
|
7
7
|
}
|
|
@@ -140,7 +140,13 @@ function VariationsToggleGroupControl({
|
|
|
140
140
|
}
|
|
141
141
|
function __experimentalBlockVariationTransforms({ blockClientId }) {
|
|
142
142
|
const { updateBlockAttributes } = (0, import_data.useDispatch)(import_store.store);
|
|
143
|
-
const {
|
|
143
|
+
const {
|
|
144
|
+
activeBlockVariation,
|
|
145
|
+
unfilteredVariations,
|
|
146
|
+
blockName,
|
|
147
|
+
isContentOnly,
|
|
148
|
+
isSection
|
|
149
|
+
} = (0, import_data.useSelect)(
|
|
144
150
|
(select) => {
|
|
145
151
|
const { getActiveBlockVariation, getBlockVariations } = select(import_blocks.store);
|
|
146
152
|
const {
|
|
@@ -150,9 +156,7 @@ function __experimentalBlockVariationTransforms({ blockClientId }) {
|
|
|
150
156
|
isSectionBlock
|
|
151
157
|
} = (0, import_lock_unlock.unlock)(select(import_store.store));
|
|
152
158
|
const name = blockClientId && getBlockName(blockClientId);
|
|
153
|
-
const { hasContentRoleAttribute } = (0, import_lock_unlock.unlock)(
|
|
154
|
-
select(import_blocks.store)
|
|
155
|
-
);
|
|
159
|
+
const { hasContentRoleAttribute } = (0, import_lock_unlock.unlock)(select(import_blocks.store));
|
|
156
160
|
const isContentBlock = hasContentRoleAttribute(name);
|
|
157
161
|
return {
|
|
158
162
|
activeBlockVariation: getActiveBlockVariation(
|
|
@@ -160,13 +164,36 @@ function __experimentalBlockVariationTransforms({ blockClientId }) {
|
|
|
160
164
|
getBlockAttributes(blockClientId),
|
|
161
165
|
"transform"
|
|
162
166
|
),
|
|
163
|
-
|
|
167
|
+
unfilteredVariations: name && getBlockVariations(name, "transform"),
|
|
168
|
+
blockName: name,
|
|
164
169
|
isContentOnly: getBlockEditingMode(blockClientId) === "contentOnly" && !isContentBlock,
|
|
165
170
|
isSection: isSectionBlock(blockClientId)
|
|
166
171
|
};
|
|
167
172
|
},
|
|
168
173
|
[blockClientId]
|
|
169
174
|
);
|
|
175
|
+
const variations = (0, import_element.useMemo)(() => {
|
|
176
|
+
if (blockName === "core/paragraph") {
|
|
177
|
+
if (activeBlockVariation?.name === "stretchy-paragraph" || unfilteredVariations.every(
|
|
178
|
+
(v) => ["paragraph", "stretchy-paragraph"].includes(v.name)
|
|
179
|
+
)) {
|
|
180
|
+
return [];
|
|
181
|
+
}
|
|
182
|
+
return unfilteredVariations.filter(
|
|
183
|
+
(v) => v.name !== "stretchy-paragraph"
|
|
184
|
+
);
|
|
185
|
+
} else if (blockName === "core/heading") {
|
|
186
|
+
if (activeBlockVariation?.name === "stretchy-heading" || unfilteredVariations.every(
|
|
187
|
+
(v) => ["heading", "stretchy-heading"].includes(v.name)
|
|
188
|
+
)) {
|
|
189
|
+
return [];
|
|
190
|
+
}
|
|
191
|
+
return unfilteredVariations.filter(
|
|
192
|
+
(v) => v.name !== "stretchy-heading"
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
return unfilteredVariations;
|
|
196
|
+
}, [activeBlockVariation?.name, blockName, unfilteredVariations]);
|
|
170
197
|
const selectedValue = activeBlockVariation?.name;
|
|
171
198
|
const hasUniqueIcons = (0, import_element.useMemo)(() => {
|
|
172
199
|
const variationIcons = /* @__PURE__ */ new Set();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-variation-transforms/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tButton,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,\n\tVisuallyHidden,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { Menu } = unlock( componentsPrivateApis );\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: Block or block variation name. */\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\treturn (\n\t\t<div className={ className }>\n\t\t\t<Menu>\n\t\t\t\t<Menu.TriggerButton\n\t\t\t\t\trender={\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"block-editor-block-variation-transforms__button\"\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Transform to variation' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t<Menu.Popover position=\"bottom\">\n\t\t\t\t\t<Menu.Group>\n\t\t\t\t\t\t{ variations.map( ( variation ) => (\n\t\t\t\t\t\t\t<Menu.RadioItem\n\t\t\t\t\t\t\t\tkey={ variation.name }\n\t\t\t\t\t\t\t\tvalue={ variation.name }\n\t\t\t\t\t\t\t\tchecked={ selectedValue === variation.name }\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tonSelectVariation( variation.name )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t{ variation.title }\n\t\t\t\t\t\t\t\t</Menu.ItemLabel>\n\t\t\t\t\t\t\t\t{ variation.description && (\n\t\t\t\t\t\t\t\t\t<Menu.ItemHelpText>\n\t\t\t\t\t\t\t\t\t\t{ variation.description }\n\t\t\t\t\t\t\t\t\t</Menu.ItemHelpText>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</Menu.RadioItem>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t</Menu.Group>\n\t\t\t\t</Menu.Popover>\n\t\t\t</Menu>\n\t\t</div>\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: Block or block variation name. */\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 {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAAqC;AACrC,kBAA4B;AAC5B,wBAMO;AACP,kBAAuC;AACvC,qBAAwB;AAKxB,wBAAsB;AACtB,mBAA0C;AAC1C,yBAAuB;AAWrB;AATF,IAAM,EAAE,KAAK,QAAI,2BAAQ,kBAAAA,WAAsB;AAE/C,SAAS,kBAAmB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,SACC,6CAAC,cAAS,WACT;AAAA,gDAAC,oCAAe,IAAG,UAChB,8BAAI,wBAAyB,GAChC;AAAA,IACE,WAAW,IAAK,CAAE,cACnB;AAAA,MAAC;AAAA;AAAA,QACA,uBAAqB;AAAA,QACrB,MAAK;AAAA,QAEL,MAAO,4CAAC,kBAAAC,SAAA,EAAU,MAAO,UAAU,MAAO,YAAU,MAAC;AAAA,QACrD,WAAY,kBAAkB,UAAU;AAAA,QACxC,OACC,kBAAkB,UAAU,OACzB,UAAU,YACV;AAAA;AAAA,cAEA,gBAAI,iBAAkB;AAAA,UACtB,UAAU;AAAA,QACV;AAAA,QAEJ,SAAU,MAAM,kBAAmB,UAAU,IAAK;AAAA,QAClD,cAAa,UAAU;AAAA,QACvB,aAAW;AAAA;AAAA,MAdL,UAAU;AAAA,IAejB,CACC;AAAA,KACH;AAEF;AAEA,SAAS,mBAAoB;AAAA,EAC5B;AAAA,EACA;AAAA,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AAAA,QAZE,UAAU;AAAA,MAcjB,CACC;AAAA;AAAA,EACH,GACD;AAEF;AAEA,SAAS,uCAAwC,EAAE,cAAc,GAAI;AACpE,QAAM,EAAE,sBAAsB,QAAI,yBAAa,aAAAG,KAAiB;AAChE,QAAM,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tButton,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,\n\tVisuallyHidden,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { Menu } = unlock( componentsPrivateApis );\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: Block or block variation name. */\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\treturn (\n\t\t<div className={ className }>\n\t\t\t<Menu>\n\t\t\t\t<Menu.TriggerButton\n\t\t\t\t\trender={\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"block-editor-block-variation-transforms__button\"\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Transform to variation' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t<Menu.Popover position=\"bottom\">\n\t\t\t\t\t<Menu.Group>\n\t\t\t\t\t\t{ variations.map( ( variation ) => (\n\t\t\t\t\t\t\t<Menu.RadioItem\n\t\t\t\t\t\t\t\tkey={ variation.name }\n\t\t\t\t\t\t\t\tvalue={ variation.name }\n\t\t\t\t\t\t\t\tchecked={ selectedValue === variation.name }\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tonSelectVariation( variation.name )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t{ variation.title }\n\t\t\t\t\t\t\t\t</Menu.ItemLabel>\n\t\t\t\t\t\t\t\t{ variation.description && (\n\t\t\t\t\t\t\t\t\t<Menu.ItemHelpText>\n\t\t\t\t\t\t\t\t\t\t{ variation.description }\n\t\t\t\t\t\t\t\t\t</Menu.ItemHelpText>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</Menu.RadioItem>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t</Menu.Group>\n\t\t\t\t</Menu.Popover>\n\t\t\t</Menu>\n\t\t</div>\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: Block or block variation name. */\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 {\n\t\tactiveBlockVariation,\n\t\tunfilteredVariations,\n\t\tblockName,\n\t\tisContentOnly,\n\t\tisSection,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getActiveBlockVariation, getBlockVariations } =\n\t\t\t\tselect( blocksStore );\n\n\t\t\tconst {\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetBlockEditingMode,\n\t\t\t\tisSectionBlock,\n\t\t\t} = unlock( select( 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\t'transform'\n\t\t\t\t),\n\t\t\t\tunfilteredVariations:\n\t\t\t\t\tname && getBlockVariations( name, 'transform' ),\n\t\t\t\tblockName: name,\n\t\t\t\tisContentOnly:\n\t\t\t\t\tgetBlockEditingMode( blockClientId ) === 'contentOnly' &&\n\t\t\t\t\t! isContentBlock,\n\t\t\t\tisSection: isSectionBlock( blockClientId ),\n\t\t\t};\n\t\t},\n\t\t[ blockClientId ]\n\t);\n\n\t/*\n\t * Hack for WordPress 6.9\n\t *\n\t * The Stretchy blocks shipped in 6.9 were ultimately\n\t * implemented as block variations of the base types Paragraph\n\t * and Heading. See #73056 for discussion and trade-offs.\n\t *\n\t * The main drawback of this choice is that the Variations API\n\t * doesn't offer enough control over how prominent and how tied\n\t * to the base type a variation should be.\n\t *\n\t * In order to ship these new \"blocks\" with an acceptable UX,\n\t * we need two hacks until the Variations API is improved:\n\t *\n\t * - Don't show the variations switcher in the block inspector\n\t * for Paragraph, Heading, Stretchy Paragraph and Stretchy\n\t * Heading (implemented below). Transformations are still\n\t * available in the block switcher.\n\t *\n\t * - Move the stretchy variations to the end of the core blocks\n\t * list in the block inserter (implemented in\n\t * getInserterItems in #73056).\n\t */\n\tconst variations = useMemo( () => {\n\t\tif ( blockName === 'core/paragraph' ) {\n\t\t\t// Always hide options when active variation is stretchy, but\n\t\t\t// ensure that there are no third-party variations before doing the\n\t\t\t// same elsewhere.\n\t\t\tif (\n\t\t\t\tactiveBlockVariation?.name === 'stretchy-paragraph' ||\n\t\t\t\tunfilteredVariations.every( ( v ) =>\n\t\t\t\t\t[ 'paragraph', 'stretchy-paragraph' ].includes( v.name )\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\t// If there are other variations, only hide the stretchy one.\n\t\t\treturn unfilteredVariations.filter(\n\t\t\t\t( v ) => v.name !== 'stretchy-paragraph'\n\t\t\t);\n\t\t} else if ( blockName === 'core/heading' ) {\n\t\t\tif (\n\t\t\t\tactiveBlockVariation?.name === 'stretchy-heading' ||\n\t\t\t\tunfilteredVariations.every( ( v ) =>\n\t\t\t\t\t[ 'heading', 'stretchy-heading' ].includes( v.name )\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\treturn unfilteredVariations.filter(\n\t\t\t\t( v ) => v.name !== 'stretchy-heading'\n\t\t\t);\n\t\t}\n\t\treturn unfilteredVariations;\n\t}, [ activeBlockVariation?.name, blockName, unfilteredVariations ] );\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\tconst hideVariationsForSections =\n\t\twindow?.__experimentalContentOnlyPatternInsertion && isSection;\n\n\tif ( ! variations?.length || isContentOnly || hideVariationsForSections ) {\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"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAAqC;AACrC,kBAA4B;AAC5B,wBAMO;AACP,kBAAuC;AACvC,qBAAwB;AAKxB,wBAAsB;AACtB,mBAA0C;AAC1C,yBAAuB;AAWrB;AATF,IAAM,EAAE,KAAK,QAAI,2BAAQ,kBAAAA,WAAsB;AAE/C,SAAS,kBAAmB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,SACC,6CAAC,cAAS,WACT;AAAA,gDAAC,oCAAe,IAAG,UAChB,8BAAI,wBAAyB,GAChC;AAAA,IACE,WAAW,IAAK,CAAE,cACnB;AAAA,MAAC;AAAA;AAAA,QACA,uBAAqB;AAAA,QACrB,MAAK;AAAA,QAEL,MAAO,4CAAC,kBAAAC,SAAA,EAAU,MAAO,UAAU,MAAO,YAAU,MAAC;AAAA,QACrD,WAAY,kBAAkB,UAAU;AAAA,QACxC,OACC,kBAAkB,UAAU,OACzB,UAAU,YACV;AAAA;AAAA,cAEA,gBAAI,iBAAkB;AAAA,UACtB,UAAU;AAAA,QACV;AAAA,QAEJ,SAAU,MAAM,kBAAmB,UAAU,IAAK;AAAA,QAClD,cAAa,UAAU;AAAA,QACvB,aAAW;AAAA;AAAA,MAdL,UAAU;AAAA,IAejB,CACC;AAAA,KACH;AAEF;AAEA,SAAS,mBAAoB;AAAA,EAC5B;AAAA,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
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-visibility/toolbar.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { ToolbarButton, ToolbarGroup } from '@wordpress/components';\nimport { useRef, useEffect } from '@wordpress/element';\nimport { seen, unseen } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { hasBlockSupport } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { cleanEmptyObject } from '../../hooks/utils';\n\nexport default function BlockVisibilityToolbar( { clientIds } ) {\n\tconst { blocks, canToggleBlockVisibility } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockName, getBlocksByClientId } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst _blocks = getBlocksByClientId( clientIds );\n\t\t\treturn {\n\t\t\t\tblocks: _blocks,\n\t\t\t\tcanToggleBlockVisibility: _blocks.every( ( { clientId } ) =>\n\t\t\t\t\thasBlockSupport(\n\t\t\t\t\t\tgetBlockName( clientId ),\n\t\t\t\t\t\t'
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { ToolbarButton, ToolbarGroup } from '@wordpress/components';\nimport { useRef, useEffect } from '@wordpress/element';\nimport { seen, unseen } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { hasBlockSupport } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { cleanEmptyObject } from '../../hooks/utils';\n\nexport default function BlockVisibilityToolbar( { clientIds } ) {\n\tconst { blocks, canToggleBlockVisibility } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockName, getBlocksByClientId } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst _blocks = getBlocksByClientId( clientIds );\n\t\t\treturn {\n\t\t\t\tblocks: _blocks,\n\t\t\t\tcanToggleBlockVisibility: _blocks.every( ( { clientId } ) =>\n\t\t\t\t\thasBlockSupport(\n\t\t\t\t\t\tgetBlockName( clientId ),\n\t\t\t\t\t\t'visibility',\n\t\t\t\t\t\ttrue\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ clientIds ]\n\t);\n\n\tconst hasHiddenBlock = blocks.some(\n\t\t( block ) => block.attributes.metadata?.blockVisibility === false\n\t);\n\n\tconst hasBlockVisibilityButtonShownRef = useRef( false );\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\n\t// If the block visibility button has been shown, we don't want to\n\t// remove it from the toolbar until the toolbar is rendered again\n\t// without it. Removing it beforehand can cause focus loss issues.\n\t// It needs to return focus from whence it came, and to do that,\n\t// we need to leave the button in the toolbar.\n\tuseEffect( () => {\n\t\tif ( hasHiddenBlock ) {\n\t\t\thasBlockVisibilityButtonShownRef.current = true;\n\t\t}\n\t}, [ hasHiddenBlock ] );\n\n\tif ( ! hasHiddenBlock && ! hasBlockVisibilityButtonShownRef.current ) {\n\t\treturn null;\n\t}\n\n\tconst toggleBlockVisibility = () => {\n\t\tconst attributesByClientId = Object.fromEntries(\n\t\t\tblocks?.map( ( { clientId, attributes } ) => [\n\t\t\t\tclientId,\n\t\t\t\t{\n\t\t\t\t\tmetadata: cleanEmptyObject( {\n\t\t\t\t\t\t...attributes?.metadata,\n\t\t\t\t\t\tblockVisibility: hasHiddenBlock ? undefined : false,\n\t\t\t\t\t} ),\n\t\t\t\t},\n\t\t\t] )\n\t\t);\n\t\tupdateBlockAttributes( clientIds, attributesByClientId, {\n\t\t\tuniqueByBlock: true,\n\t\t} );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<ToolbarGroup className=\"block-editor-block-lock-toolbar\">\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tdisabled={ ! canToggleBlockVisibility }\n\t\t\t\t\ticon={ hasH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AAE,EAAE,UAAU,WAAW,MAAO;AAAA,QAC5C;AAAA,QACA;AAAA,UACC,cAAU,+BAAkB;AAAA,YAC3B,GAAG,YAAY;AAAA,YACf,iBAAiB,iBAAiB,SAAY;AAAA,UAC/C,CAAE;AAAA,QACH;AAAA,MACD,CAAE;AAAA,IACH;AACA,0BAAuB,WAAW,sBAAsB;AAAA,MACvD,eAAe;AAAA,IAChB,CAAE;AAAA,EACH;AAEA,SACC,2EACC,sDAAC,kCAAa,WAAU,mCACvB;AAAA,IAAC;AAAA;AAAA,MACA,UAAW,CAAE;AAAA,MACb,MAAO,iBAAiB,sBAAS;AAAA,MACjC,OAAQ,qBAAiB,gBAAI,QAAS,QAAI,gBAAI,SAAU;AAAA,MACxD,SAAU;AAAA;AAAA,EACX,GACD,GACD;AAEF;",
|
|
6
6
|
"names": ["blockEditorStore"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/border-radius-control/single-input-control.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalHStack as HStack,\n\tIcon,\n\tTooltip,\n\tRangeControl,\n\tButton,\n\tCustomSelectControl,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { settings } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetAllValue,\n\tgetCustomValueFromPreset,\n\tgetPresetValueFromControlValue,\n\tgetPresetValueFromCustomValue,\n\tgetSliderValueFromPreset,\n\tisValuePreset,\n\tconvertPresetsToCustomValues,\n} from './utils';\nimport {\n\tCORNERS,\n\tICONS,\n\tMIN_BORDER_RADIUS_VALUE,\n\tMAX_BORDER_RADIUS_VALUES,\n\tRANGE_CONTROL_MAX_SIZE,\n} from './constants';\n\nexport default function SingleInputControl( {\n\tcorner,\n\tonChange,\n\tselectedUnits,\n\tsetSelectedUnits,\n\tvalues: valuesProp,\n\tunits,\n\tpresets,\n} ) {\n\tconst changeCornerValue = ( validatedValue ) => {\n\t\tif ( corner === 'all' ) {\n\t\t\tonChange( {\n\t\t\t\ttopLeft: validatedValue,\n\t\t\t\ttopRight: validatedValue,\n\t\t\t\tbottomLeft: validatedValue,\n\t\t\t\tbottomRight: validatedValue,\n\t\t\t} );\n\t\t} else {\n\t\t\tonChange( {\n\t\t\t\t...values,\n\t\t\t\t[ corner ]: validatedValue,\n\t\t\t} );\n\t\t}\n\t};\n\n\tconst onChangeValue = ( next ) => {\n\t\tif ( ! onChange ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Filter out CSS-unit-only values to prevent invalid styles.\n\t\tconst isNumeric = ! isNaN( parseFloat( next ) );\n\t\tconst nextValue = isNumeric ? next : undefined;\n\t\tchangeCornerValue( nextValue );\n\t};\n\n\tconst onChangeUnit = ( next ) => {\n\t\tconst newUnits = { ...selectedUnits };\n\t\tif ( corner === 'all' ) {\n\t\t\tnewUnits.topLeft = next;\n\t\t\tnewUnits.topRight = next;\n\t\t\tnewUnits.bottomLeft = next;\n\t\t\tnewUnits.bottomRight = next;\n\t\t} else {\n\t\t\tnewUnits[ corner ] = next;\n\t\t}\n\t\tsetSelectedUnits( newUnits );\n\t};\n\n\t// For shorthand style & backwards compatibility, handle flat string value.\n\tconst values =\n\t\ttypeof valuesProp !== 'string'\n\t\t\t? valuesProp\n\t\t\t: {\n\t\t\t\t\ttopLeft: valuesProp,\n\t\t\t\t\ttopRight: valuesProp,\n\t\t\t\t\tbottomLeft: valuesProp,\n\t\t\t\t\tbottomRight: valuesProp,\n\t\t\t };\n\n\t// For 'all' corner, convert presets to custom values before calling getAllValue\n\t// For individual corners, check if the value should be converted to a preset\n\tlet value;\n\tif ( corner === 'all' ) {\n\t\tconst convertedValues = convertPresetsToCustomValues( values, presets );\n\t\tconst customValue = getAllValue( convertedValues );\n\t\tvalue = getPresetValueFromCustomValue( customValue, presets );\n\t} else {\n\t\tvalue = getPresetValueFromCustomValue( values[ corner ], presets );\n\t}\n\tconst resolvedPresetValue = isValuePreset( value )\n\t\t? getCustomValueFromPreset( value, presets )\n\t\t: value;\n\tconst [ parsedQuantity, parsedUnit ] =\n\t\tparseQuantityAndUnitFromRawValue( resolvedPresetValue );\n\tconst computedUnit = value\n\t\t? parsedUnit\n\t\t: selectedUnits[ corner ] || selectedUnits.flat || 'px';\n\tconst unitConfig =\n\t\tunits && units.find( ( item ) => item.value === computedUnit );\n\tconst step = unitConfig?.step || 1;\n\tconst [ showCustomValueControl, setShowCustomValueControl ] = useState(\n\t\tvalue !== undefined && ! isValuePreset( value )\n\t);\n\tconst showRangeControl = presets.length <= RANGE_CONTROL_MAX_SIZE;\n\tconst presetIndex = getSliderValueFromPreset( value, presets );\n\tconst rangeTooltip = ( newValue ) =>\n\t\tvalue === undefined ? undefined : presets[ newValue ]?.name;\n\tconst marks = presets\n\t\t.slice( 1, presets.length - 1 )\n\t\t.map( ( _newValue, index ) => ( {\n\t\t\tvalue: index + 1,\n\t\t\tlabel: undefined,\n\t\t} ) );\n\tconst hasPresets = marks.length > 0;\n\tlet options = [];\n\tif ( ! showRangeControl ) {\n\t\toptions = [\n\t\t\t...presets,\n\t\t\t{\n\t\t\t\tname: __( 'Custom' ),\n\t\t\t\tslug: 'custom',\n\t\t\t\tsize: resolvedPresetValue,\n\t\t\t},\n\t\t].map( ( size, index ) => ( {\n\t\t\tkey: index,\n\t\t\tname: size.name,\n\t\t} ) );\n\t}\n\tconst icon = ICONS[ corner ];\n\n\tconst handleSliderChange = ( next ) => {\n\t\tconst val =\n\t\t\tnext !== undefined ? `${ next }${ computedUnit }` : undefined;\n\t\tchangeCornerValue( val );\n\t};\n\n\t// Controls are wrapped in tooltips as visible labels aren't desired here.\n\t// Tooltip rendering also requires the UnitControl to be wrapped. See:\n\t// https://github.com/WordPress/gutenberg/pull/24966#issuecomment-685875026\n\treturn (\n\t\t<HStack>\n\t\t\t{ icon && (\n\t\t\t\t<Icon\n\t\t\t\t\tclassName=\"components-border-radius-control__icon\"\n\t\t\t\t\ticon={ icon }\n\t\t\t\t\tsize={ 24 }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ( ! hasPresets || showCustomValueControl ) && (\n\t\t\t\t<div className=\"components-border-radius-control__input-controls-wrapper\">\n\t\t\t\t\t<Tooltip text={ CORNERS[ corner ] } placement=\"top\">\n\t\t\t\t\t\t<div className=\"components-border-radius-control__tooltip-wrapper\">\n\t\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\t\tclassName=\"components-border-radius-control__unit-control\"\n\t\t\t\t\t\t\t\taria-label={ CORNERS[ corner ] }\n\t\t\t\t\t\t\t\tvalue={ [ parsedQuantity, computedUnit ].join(\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\tonChange={ onChangeValue }\n\t\t\t\t\t\t\t\tonUnitChange={ onChangeUnit }\n\t\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\t\tmin={ MIN_BORDER_RADIUS_VALUE }\n\t\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</Tooltip>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Border radius' ) }\n\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\tclassName=\"components-border-radius-control__range-control\"\n\t\t\t\t\t\tvalue={ parsedQuantity ?? '' }\n\t\t\t\t\t\tmin={ MIN_BORDER_RADIUS_VALUE }\n\t\t\t\t\t\tmax={ MAX_BORDER_RADIUS_VALUES[ computedUnit ] }\n\t\t\t\t\t\tinitialPosition={ 0 }\n\t\t\t\t\t\twithInputField={ false }\n\t\t\t\t\t\tonChange={ handleSliderChange }\n\t\t\t\t\t\tstep={ step }\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ hasPresets && showRangeControl && ! showCustomValueControl && (\n\t\t\t\t<RangeControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tclassName=\"components-border-radius-control__range-control\"\n\t\t\t\t\tvalue={ presetIndex }\n\t\t\t\t\tonChange={ ( newSize ) => {\n\t\t\t\t\t\tchangeCornerValue(\n\t\t\t\t\t\t\tgetPresetValueFromControlValue(\n\t\t\t\t\t\t\t\tnewSize,\n\t\t\t\t\t\t\t\t'range',\n\t\t\t\t\t\t\t\tpresets\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\twithInputField={ false }\n\t\t\t\t\taria-valuenow={ presetIndex }\n\t\t\t\t\taria-valuetext={ presets[ presetIndex ]?.name }\n\t\t\t\t\trenderTooltipContent={ rangeTooltip }\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tmax={ presets.length - 1 }\n\t\t\t\t\tmarks={ marks }\n\t\t\t\t\tlabel={ CORNERS[ corner ] }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ ! showRangeControl && ! showCustomValueControl && (\n\t\t\t\t<CustomSelectControl\n\t\t\t\t\tclassName=\"components-border-radius-control__custom-select-control\"\n\t\t\t\t\tvalue={\n\t\t\t\t\t\toptions.find(\n\t\t\t\t\t\t\t( option ) => option.key === presetIndex\n\t\t\t\t\t\t) || options[ options.length - 1 ]\n\t\t\t\t\t}\n\t\t\t\t\tonChange={ ( selection ) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tselection.selectedItem.key ===\n\t\t\t\t\t\t\toptions.length - 1\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tsetShowCustomValueControl( true );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tchangeCornerValue(\n\t\t\t\t\t\t\t\tgetPresetValueFromControlValue(\n\t\t\t\t\t\t\t\t\tselection.selectedItem.key,\n\t\t\t\t\t\t\t\t\t'selectList',\n\t\t\t\t\t\t\t\t\tpresets\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\toptions={ options }\n\t\t\t\t\tlabel={ CORNERS[ corner ] }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasPresets && (\n\t\t\t\t<Button\n\t\t\t\t\tlabel={\n\t\t\t\t\t\tshowCustomValueControl\n\t\t\t\t\t\t\t? __( 'Use border radius preset' )\n\t\t\t\t\t\t\t: __( 'Set custom border radius' )\n\t\t\t\t\t}\n\t\t\t\t\ticon={ settings }\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tsetShowCustomValueControl( ! showCustomValueControl );\n\t\t\t\t\t} }\n\t\t\t\t\tisPressed={ showCustomValueControl }\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t\tclassName=\"components-border-radius-control__custom-toggle\"\n\t\t\t\t\ticonSize={ 24 }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</HStack>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBASO;AACP,kBAAmB;AACnB,qBAAyB;AACzB,mBAAyB;AAKzB,mBAQO;AACP,uBAMO;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalHStack as HStack,\n\tIcon,\n\tTooltip,\n\tRangeControl,\n\tButton,\n\tCustomSelectControl,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { settings } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetAllValue,\n\tgetCustomValueFromPreset,\n\tgetPresetValueFromControlValue,\n\tgetPresetValueFromCustomValue,\n\tgetSliderValueFromPreset,\n\tisValuePreset,\n\tconvertPresetsToCustomValues,\n} from './utils';\nimport {\n\tCORNERS,\n\tICONS,\n\tMIN_BORDER_RADIUS_VALUE,\n\tMAX_BORDER_RADIUS_VALUES,\n\tRANGE_CONTROL_MAX_SIZE,\n} from './constants';\n\nexport default function SingleInputControl( {\n\tcorner,\n\tonChange,\n\tselectedUnits,\n\tsetSelectedUnits,\n\tvalues: valuesProp,\n\tunits,\n\tpresets,\n} ) {\n\tconst changeCornerValue = ( validatedValue ) => {\n\t\tif ( corner === 'all' ) {\n\t\t\tonChange( {\n\t\t\t\ttopLeft: validatedValue,\n\t\t\t\ttopRight: validatedValue,\n\t\t\t\tbottomLeft: validatedValue,\n\t\t\t\tbottomRight: validatedValue,\n\t\t\t} );\n\t\t} else {\n\t\t\tonChange( {\n\t\t\t\t...values,\n\t\t\t\t[ corner ]: validatedValue,\n\t\t\t} );\n\t\t}\n\t};\n\n\tconst onChangeValue = ( next ) => {\n\t\tif ( ! onChange ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Filter out CSS-unit-only values to prevent invalid styles.\n\t\tconst isNumeric = ! isNaN( parseFloat( next ) );\n\t\tconst nextValue = isNumeric ? next : undefined;\n\t\tchangeCornerValue( nextValue );\n\t};\n\n\tconst onChangeUnit = ( next ) => {\n\t\tconst newUnits = { ...selectedUnits };\n\t\tif ( corner === 'all' ) {\n\t\t\tnewUnits.flat = next;\n\t\t\tnewUnits.topLeft = next;\n\t\t\tnewUnits.topRight = next;\n\t\t\tnewUnits.bottomLeft = next;\n\t\t\tnewUnits.bottomRight = next;\n\t\t} else {\n\t\t\tnewUnits[ corner ] = next;\n\t\t}\n\t\tsetSelectedUnits( newUnits );\n\t};\n\n\t// For shorthand style & backwards compatibility, handle flat string value.\n\tconst values =\n\t\ttypeof valuesProp !== 'string'\n\t\t\t? valuesProp\n\t\t\t: {\n\t\t\t\t\ttopLeft: valuesProp,\n\t\t\t\t\ttopRight: valuesProp,\n\t\t\t\t\tbottomLeft: valuesProp,\n\t\t\t\t\tbottomRight: valuesProp,\n\t\t\t };\n\n\t// For 'all' corner, convert presets to custom values before calling getAllValue\n\t// For individual corners, check if the value should be converted to a preset\n\tlet value;\n\tif ( corner === 'all' ) {\n\t\tconst convertedValues = convertPresetsToCustomValues( values, presets );\n\t\tconst customValue = getAllValue( convertedValues );\n\t\tvalue = getPresetValueFromCustomValue( customValue, presets );\n\t} else {\n\t\tvalue = getPresetValueFromCustomValue( values[ corner ], presets );\n\t}\n\tconst resolvedPresetValue = isValuePreset( value )\n\t\t? getCustomValueFromPreset( value, presets )\n\t\t: value;\n\tconst [ parsedQuantity, parsedUnit ] =\n\t\tparseQuantityAndUnitFromRawValue( resolvedPresetValue );\n\tconst computedUnit = value\n\t\t? parsedUnit\n\t\t: selectedUnits[ corner ] || selectedUnits.flat || 'px';\n\tconst unitConfig =\n\t\tunits && units.find( ( item ) => item.value === computedUnit );\n\tconst step = unitConfig?.step || 1;\n\tconst [ showCustomValueControl, setShowCustomValueControl ] = useState(\n\t\tvalue !== undefined && ! isValuePreset( value )\n\t);\n\tconst showRangeControl = presets.length <= RANGE_CONTROL_MAX_SIZE;\n\tconst presetIndex = getSliderValueFromPreset( value, presets );\n\tconst rangeTooltip = ( newValue ) =>\n\t\tvalue === undefined ? undefined : presets[ newValue ]?.name;\n\tconst marks = presets\n\t\t.slice( 1, presets.length - 1 )\n\t\t.map( ( _newValue, index ) => ( {\n\t\t\tvalue: index + 1,\n\t\t\tlabel: undefined,\n\t\t} ) );\n\tconst hasPresets = marks.length > 0;\n\tlet options = [];\n\tif ( ! showRangeControl ) {\n\t\toptions = [\n\t\t\t...presets,\n\t\t\t{\n\t\t\t\tname: __( 'Custom' ),\n\t\t\t\tslug: 'custom',\n\t\t\t\tsize: resolvedPresetValue,\n\t\t\t},\n\t\t].map( ( size, index ) => ( {\n\t\t\tkey: index,\n\t\t\tname: size.name,\n\t\t} ) );\n\t}\n\tconst icon = ICONS[ corner ];\n\n\tconst handleSliderChange = ( next ) => {\n\t\tconst val =\n\t\t\tnext !== undefined ? `${ next }${ computedUnit }` : undefined;\n\t\tchangeCornerValue( val );\n\t};\n\n\t// Controls are wrapped in tooltips as visible labels aren't desired here.\n\t// Tooltip rendering also requires the UnitControl to be wrapped. See:\n\t// https://github.com/WordPress/gutenberg/pull/24966#issuecomment-685875026\n\treturn (\n\t\t<HStack>\n\t\t\t{ icon && (\n\t\t\t\t<Icon\n\t\t\t\t\tclassName=\"components-border-radius-control__icon\"\n\t\t\t\t\ticon={ icon }\n\t\t\t\t\tsize={ 24 }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ( ! hasPresets || showCustomValueControl ) && (\n\t\t\t\t<div className=\"components-border-radius-control__input-controls-wrapper\">\n\t\t\t\t\t<Tooltip text={ CORNERS[ corner ] } placement=\"top\">\n\t\t\t\t\t\t<div className=\"components-border-radius-control__tooltip-wrapper\">\n\t\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\t\tclassName=\"components-border-radius-control__unit-control\"\n\t\t\t\t\t\t\t\taria-label={ CORNERS[ corner ] }\n\t\t\t\t\t\t\t\tvalue={ [ parsedQuantity, computedUnit ].join(\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\tonChange={ onChangeValue }\n\t\t\t\t\t\t\t\tonUnitChange={ onChangeUnit }\n\t\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\t\tmin={ MIN_BORDER_RADIUS_VALUE }\n\t\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</Tooltip>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Border radius' ) }\n\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\tclassName=\"components-border-radius-control__range-control\"\n\t\t\t\t\t\tvalue={ parsedQuantity ?? '' }\n\t\t\t\t\t\tmin={ MIN_BORDER_RADIUS_VALUE }\n\t\t\t\t\t\tmax={ MAX_BORDER_RADIUS_VALUES[ computedUnit ] }\n\t\t\t\t\t\tinitialPosition={ 0 }\n\t\t\t\t\t\twithInputField={ false }\n\t\t\t\t\t\tonChange={ handleSliderChange }\n\t\t\t\t\t\tstep={ step }\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ hasPresets && showRangeControl && ! showCustomValueControl && (\n\t\t\t\t<RangeControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tclassName=\"components-border-radius-control__range-control\"\n\t\t\t\t\tvalue={ presetIndex }\n\t\t\t\t\tonChange={ ( newSize ) => {\n\t\t\t\t\t\tchangeCornerValue(\n\t\t\t\t\t\t\tgetPresetValueFromControlValue(\n\t\t\t\t\t\t\t\tnewSize,\n\t\t\t\t\t\t\t\t'range',\n\t\t\t\t\t\t\t\tpresets\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\twithInputField={ false }\n\t\t\t\t\taria-valuenow={ presetIndex }\n\t\t\t\t\taria-valuetext={ presets[ presetIndex ]?.name }\n\t\t\t\t\trenderTooltipContent={ rangeTooltip }\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tmax={ presets.length - 1 }\n\t\t\t\t\tmarks={ marks }\n\t\t\t\t\tlabel={ CORNERS[ corner ] }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ ! showRangeControl && ! showCustomValueControl && (\n\t\t\t\t<CustomSelectControl\n\t\t\t\t\tclassName=\"components-border-radius-control__custom-select-control\"\n\t\t\t\t\tvalue={\n\t\t\t\t\t\toptions.find(\n\t\t\t\t\t\t\t( option ) => option.key === presetIndex\n\t\t\t\t\t\t) || options[ options.length - 1 ]\n\t\t\t\t\t}\n\t\t\t\t\tonChange={ ( selection ) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tselection.selectedItem.key ===\n\t\t\t\t\t\t\toptions.length - 1\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tsetShowCustomValueControl( true );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tchangeCornerValue(\n\t\t\t\t\t\t\t\tgetPresetValueFromControlValue(\n\t\t\t\t\t\t\t\t\tselection.selectedItem.key,\n\t\t\t\t\t\t\t\t\t'selectList',\n\t\t\t\t\t\t\t\t\tpresets\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\toptions={ options }\n\t\t\t\t\tlabel={ CORNERS[ corner ] }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasPresets && (\n\t\t\t\t<Button\n\t\t\t\t\tlabel={\n\t\t\t\t\t\tshowCustomValueControl\n\t\t\t\t\t\t\t? __( 'Use border radius preset' )\n\t\t\t\t\t\t\t: __( 'Set custom border radius' )\n\t\t\t\t\t}\n\t\t\t\t\ticon={ settings }\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tsetShowCustomValueControl( ! showCustomValueControl );\n\t\t\t\t\t} }\n\t\t\t\t\tisPressed={ showCustomValueControl }\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t\tclassName=\"components-border-radius-control__custom-toggle\"\n\t\t\t\t\ticonSize={ 24 }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</HStack>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;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BAAS,MAAO;AAAA,QACxB,qBAAmB;AAAA,QACnB,yBAAuB;AAAA;AAAA,IACxB;AAAA,IAGC,CAAE,oBAAoB,CAAE,0BACzB;AAAA,MAAC;AAAA;AAAA,QACA,WAAU;AAAA,QACV,OACC,QAAQ;AAAA,UACP,CAAE,WAAY,OAAO,QAAQ;AAAA,QAC9B,KAAK,QAAS,QAAQ,SAAS,CAAE;AAAA,QAElC,UAAW,CAAE,cAAe;AAC3B,cACC,UAAU,aAAa,QACvB,QAAQ,SAAS,GAChB;AACD,sCAA2B,IAAK;AAAA,UACjC,OAAO;AACN;AAAA,kBACC;AAAA,gBACC,UAAU,aAAa;AAAA,gBACvB;AAAA,gBACA;AAAA,cACD;AAAA,YACD;AAAA,UACD;AAAA,QACD;AAAA,QACA;AAAA,QACA,OAAQ,yBAAS,MAAO;AAAA,QACxB,qBAAmB;AAAA,QACnB,MAAK;AAAA;AAAA,IACN;AAAA,IAEC,cACD;AAAA,MAAC;AAAA;AAAA,QACA,OACC,6BACG,gBAAI,0BAA2B,QAC/B,gBAAI,0BAA2B;AAAA,QAEnC,MAAO;AAAA,QACP,SAAU,MAAM;AACf,oCAA2B,CAAE,sBAAuB;AAAA,QACrD;AAAA,QACA,WAAY;AAAA,QACZ,MAAK;AAAA,QACL,WAAU;AAAA,QACV,UAAW;AAAA;AAAA,IACZ;AAAA,KAEF;AAEF;",
|
|
6
6
|
"names": ["parseQuantityAndUnitFromRawValue", "HStack", "UnitControl"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/block-editor/src/components/content-only-controls/fields-dropdown-menu.js
|
|
21
|
+
var fields_dropdown_menu_exports = {};
|
|
22
|
+
__export(fields_dropdown_menu_exports, {
|
|
23
|
+
default: () => FieldsDropdownMenu
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(fields_dropdown_menu_exports);
|
|
26
|
+
var import_components = require("@wordpress/components");
|
|
27
|
+
var import_icons = require("@wordpress/icons");
|
|
28
|
+
var import_i18n = require("@wordpress/i18n");
|
|
29
|
+
var import_use_inspector_popover_placement = require("./use-inspector-popover-placement");
|
|
30
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
31
|
+
function FieldsDropdownMenu({
|
|
32
|
+
fields,
|
|
33
|
+
visibleFields,
|
|
34
|
+
onToggleField
|
|
35
|
+
}) {
|
|
36
|
+
const { popoverProps } = (0, import_use_inspector_popover_placement.useInspectorPopoverPlacement)();
|
|
37
|
+
if (!fields || fields.length === 0) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
41
|
+
import_components.DropdownMenu,
|
|
42
|
+
{
|
|
43
|
+
icon: import_icons.moreVertical,
|
|
44
|
+
label: (0, import_i18n.__)("Options"),
|
|
45
|
+
popoverProps,
|
|
46
|
+
children: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.MenuGroup, { label: (0, import_i18n.__)("Show / Hide"), children: fields.map((field) => {
|
|
47
|
+
const isVisible = visibleFields.includes(field.id);
|
|
48
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
49
|
+
import_components.MenuItem,
|
|
50
|
+
{
|
|
51
|
+
isSelected: isVisible,
|
|
52
|
+
onClick: () => {
|
|
53
|
+
onToggleField(field.id);
|
|
54
|
+
onClose();
|
|
55
|
+
},
|
|
56
|
+
role: "menuitemcheckbox",
|
|
57
|
+
icon: isVisible ? import_icons.check : null,
|
|
58
|
+
children: field.label
|
|
59
|
+
},
|
|
60
|
+
field.id
|
|
61
|
+
);
|
|
62
|
+
}) })
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=fields-dropdown-menu.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/content-only-controls/fields-dropdown-menu.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { moreVertical, check } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useInspectorPopoverPlacement } from './use-inspector-popover-placement';\n\nexport default function FieldsDropdownMenu( {\n\tfields,\n\tvisibleFields,\n\tonToggleField,\n} ) {\n\tconst { popoverProps } = useInspectorPopoverPlacement();\n\n\tif ( ! fields || fields.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\ticon={ moreVertical }\n\t\t\tlabel={ __( 'Options' ) }\n\t\t\tpopoverProps={ popoverProps }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<MenuGroup label={ __( 'Show / Hide' ) }>\n\t\t\t\t\t{ fields.map( ( field ) => {\n\t\t\t\t\t\tconst isVisible = visibleFields.includes( field.id );\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tkey={ field.id }\n\t\t\t\t\t\t\t\tisSelected={ isVisible }\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tonToggleField( field.id );\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t\t\t\t\t\ticon={ isVisible ? check : null }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ field.label }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t);\n\t\t\t\t\t} ) }\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAAkD;AAClD,mBAAoC;AACpC,kBAAmB;AAKnB,6CAA6C;AAwBtC;AAtBQ,SAAR,mBAAqC;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,EAAE,aAAa,QAAI,qEAA6B;AAEtD,MAAK,CAAE,UAAU,OAAO,WAAW,GAAI;AACtC,WAAO;AAAA,EACR;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,MAAO;AAAA,MACP,WAAQ,gBAAI,SAAU;AAAA,MACtB;AAAA,MAEE,WAAE,EAAE,QAAQ,MACb,4CAAC,+BAAU,WAAQ,gBAAI,aAAc,GAClC,iBAAO,IAAK,CAAE,UAAW;AAC1B,cAAM,YAAY,cAAc,SAAU,MAAM,EAAG;AACnD,eACC;AAAA,UAAC;AAAA;AAAA,YAEA,YAAa;AAAA,YACb,SAAU,MAAM;AACf,4BAAe,MAAM,EAAG;AACxB,sBAAQ;AAAA,YACT;AAAA,YACA,MAAK;AAAA,YACL,MAAO,YAAY,qBAAQ;AAAA,YAEzB,gBAAM;AAAA;AAAA,UATF,MAAM;AAAA,QAUb;AAAA,MAEF,CAAE,GACH;AAAA;AAAA,EAEF;AAEF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|