@wordpress/block-editor 15.19.1-next.v.202605131006.0 → 15.20.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 +15 -1
- package/build/components/block-card/index.cjs +51 -41
- package/build/components/block-card/index.cjs.map +3 -3
- package/build/components/block-heading-level-dropdown/heading-level-icon.cjs.map +3 -3
- package/build/components/block-icon/index.cjs +7 -1
- package/build/components/block-icon/index.cjs.map +3 -3
- package/build/components/block-inspector/index.cjs +156 -11
- package/build/components/block-inspector/index.cjs.map +3 -3
- package/build/components/block-inspector/inspector-pre-tabs-slot-fill.cjs +38 -0
- package/build/components/block-inspector/inspector-pre-tabs-slot-fill.cjs.map +7 -0
- package/build/components/block-list/use-block-props/index.cjs +1 -1
- package/build/components/block-list/use-block-props/index.cjs.map +2 -2
- package/build/components/block-list/use-block-props/use-focus-handler.cjs +3 -4
- package/build/components/block-list/use-block-props/use-focus-handler.cjs.map +3 -3
- package/build/components/block-list/use-block-props/use-is-hovered.cjs +24 -14
- package/build/components/block-list/use-block-props/use-is-hovered.cjs.map +3 -3
- package/build/components/block-lock/modal.cjs.map +3 -3
- package/build/components/block-patterns-list/index.cjs +13 -2
- package/build/components/block-patterns-list/index.cjs.map +2 -2
- package/build/components/block-popover/index.cjs +13 -3
- package/build/components/block-popover/index.cjs.map +2 -2
- package/build/components/block-toolbar/switch-section-style.cjs.map +3 -3
- package/build/components/block-visibility/modal.cjs.map +3 -3
- package/build/components/block-visibility/viewport-visibility-info.cjs.map +3 -3
- package/build/components/colors-gradients/control.cjs +7 -4
- package/build/components/colors-gradients/control.cjs.map +2 -2
- package/build/components/global-styles/advanced-panel.cjs +24 -22
- package/build/components/global-styles/advanced-panel.cjs.map +3 -3
- package/build/components/global-styles/color-panel.cjs +95 -58
- package/build/components/global-styles/color-panel.cjs.map +2 -2
- package/build/components/global-styles/dimensions-panel.cjs +11 -5
- package/build/components/global-styles/dimensions-panel.cjs.map +2 -2
- package/build/components/global-styles/index.cjs +3 -0
- package/build/components/global-styles/index.cjs.map +2 -2
- package/build/components/global-styles/shadow-panel-components.cjs +38 -26
- package/build/components/global-styles/shadow-panel-components.cjs.map +2 -2
- package/build/components/global-styles/state-control-badges.cjs +69 -0
- package/build/components/global-styles/state-control-badges.cjs.map +7 -0
- package/build/components/global-styles/state-control.cjs +54 -63
- package/build/components/global-styles/state-control.cjs.map +3 -3
- package/build/components/iframe/index.cjs +0 -3
- package/build/components/iframe/index.cjs.map +2 -2
- package/build/components/iframe/use-scale-canvas.cjs +4 -1
- package/build/components/iframe/use-scale-canvas.cjs.map +2 -2
- package/build/components/inserter/hooks/use-patterns-state.cjs +4 -6
- package/build/components/inserter/hooks/use-patterns-state.cjs.map +2 -2
- package/build/components/inserter/index.cjs +1 -0
- package/build/components/inserter/index.cjs.map +2 -2
- package/build/components/inserter/media-tab/media-preview.cjs +27 -18
- package/build/components/inserter/media-tab/media-preview.cjs.map +2 -2
- package/build/components/inserter/media-tab/utils.cjs +1 -1
- package/build/components/inserter/media-tab/utils.cjs.map +2 -2
- package/build/components/inserter/panel.cjs.map +3 -3
- package/build/components/inspector-controls/block-support-tools-panel.cjs +10 -2
- package/build/components/inspector-controls/block-support-tools-panel.cjs.map +2 -2
- package/build/components/inspector-controls/fill.cjs +14 -4
- package/build/components/inspector-controls/fill.cjs.map +2 -2
- package/build/components/inspector-controls/groups.cjs +2 -0
- package/build/components/inspector-controls/groups.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/index.cjs +13 -8
- package/build/components/inspector-controls-tabs/index.cjs.map +3 -3
- package/build/components/inspector-controls-tabs/settings-tab.cjs +1 -4
- package/build/components/inspector-controls-tabs/settings-tab.cjs.map +3 -3
- package/build/components/inspector-controls-tabs/styles-tab.cjs +9 -0
- package/build/components/inspector-controls-tabs/styles-tab.cjs.map +3 -3
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.cjs +11 -5
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.cjs.map +2 -2
- package/build/components/list-view/block-select-button.cjs +20 -8
- package/build/components/list-view/block-select-button.cjs.map +2 -2
- package/build/components/list-view/block.cjs +2 -1
- package/build/components/list-view/block.cjs.map +2 -2
- package/build/components/preset-input-control/custom-value-controls.cjs +10 -1
- package/build/components/preset-input-control/custom-value-controls.cjs.map +2 -2
- package/build/components/preset-input-control/index.cjs.map +3 -3
- package/build/components/provider/use-media-upload-settings.cjs +1 -0
- package/build/components/provider/use-media-upload-settings.cjs.map +2 -2
- package/build/components/rich-text/event-listeners/enter.cjs +9 -2
- package/build/components/rich-text/event-listeners/enter.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/paste-handler.cjs +4 -4
- package/build/components/rich-text/event-listeners/paste-handler.cjs.map +3 -3
- package/build/hooks/background.cjs +13 -3
- package/build/hooks/background.cjs.map +2 -2
- package/build/hooks/block-fields/link/index.cjs.map +3 -3
- package/build/hooks/block-fields/media/index.cjs.map +3 -3
- package/build/hooks/block-style-state.cjs +112 -0
- package/build/hooks/block-style-state.cjs.map +7 -0
- package/build/hooks/border.cjs +13 -3
- package/build/hooks/border.cjs.map +2 -2
- package/build/hooks/color.cjs +28 -9
- package/build/hooks/color.cjs.map +2 -2
- package/build/hooks/dimensions.cjs +15 -6
- package/build/hooks/dimensions.cjs.map +2 -2
- package/build/hooks/layout-child.cjs +147 -61
- package/build/hooks/layout-child.cjs.map +2 -2
- package/build/hooks/layout.cjs +263 -56
- package/build/hooks/layout.cjs.map +3 -3
- package/build/hooks/state-utils.cjs +94 -0
- package/build/hooks/state-utils.cjs.map +7 -0
- package/build/hooks/states.cjs +124 -0
- package/build/hooks/states.cjs.map +7 -0
- package/build/hooks/style.cjs +304 -17
- package/build/hooks/style.cjs.map +3 -3
- package/build/hooks/typography.cjs +14 -5
- package/build/hooks/typography.cjs.map +2 -2
- package/build/layouts/constrained.cjs +128 -55
- package/build/layouts/constrained.cjs.map +3 -3
- package/build/layouts/flex.cjs +119 -31
- package/build/layouts/flex.cjs.map +3 -3
- package/build/layouts/grid.cjs +103 -40
- package/build/layouts/grid.cjs.map +3 -3
- package/build/private-apis.cjs +2 -0
- package/build/private-apis.cjs.map +2 -2
- package/build/store/private-actions.cjs +18 -0
- package/build/store/private-actions.cjs.map +2 -2
- package/build/store/private-keys.cjs +10 -2
- package/build/store/private-keys.cjs.map +2 -2
- package/build/store/private-selectors.cjs +26 -2
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/reducer.cjs +70 -1
- package/build/store/reducer.cjs.map +2 -2
- package/build/store/utils.cjs +1 -1
- package/build/store/utils.cjs.map +2 -2
- package/build/utils/color-values.cjs +44 -0
- package/build/utils/color-values.cjs.map +7 -0
- package/build-module/components/block-card/index.mjs +52 -45
- package/build-module/components/block-card/index.mjs.map +2 -2
- package/build-module/components/block-heading-level-dropdown/heading-level-icon.mjs +2 -2
- package/build-module/components/block-heading-level-dropdown/heading-level-icon.mjs.map +2 -2
- package/build-module/components/block-icon/index.mjs +8 -2
- package/build-module/components/block-icon/index.mjs.map +2 -2
- package/build-module/components/block-inspector/index.mjs +166 -13
- package/build-module/components/block-inspector/index.mjs.map +2 -2
- package/build-module/components/block-inspector/inspector-pre-tabs-slot-fill.mjs +12 -0
- package/build-module/components/block-inspector/inspector-pre-tabs-slot-fill.mjs.map +7 -0
- package/build-module/components/block-list/use-block-props/index.mjs +1 -1
- package/build-module/components/block-list/use-block-props/index.mjs.map +2 -2
- package/build-module/components/block-list/use-block-props/use-focus-handler.mjs +7 -5
- package/build-module/components/block-list/use-block-props/use-focus-handler.mjs.map +2 -2
- package/build-module/components/block-list/use-block-props/use-is-hovered.mjs +28 -15
- package/build-module/components/block-list/use-block-props/use-is-hovered.mjs.map +2 -2
- package/build-module/components/block-lock/modal.mjs +4 -4
- package/build-module/components/block-lock/modal.mjs.map +2 -2
- package/build-module/components/block-patterns-list/index.mjs +14 -4
- package/build-module/components/block-patterns-list/index.mjs.map +2 -2
- package/build-module/components/block-popover/index.mjs +13 -3
- package/build-module/components/block-popover/index.mjs.map +2 -2
- package/build-module/components/block-toolbar/switch-section-style.mjs +2 -2
- package/build-module/components/block-toolbar/switch-section-style.mjs.map +2 -2
- package/build-module/components/block-visibility/modal.mjs +2 -2
- package/build-module/components/block-visibility/modal.mjs.map +2 -2
- package/build-module/components/block-visibility/viewport-visibility-info.mjs +2 -2
- package/build-module/components/block-visibility/viewport-visibility-info.mjs.map +2 -2
- package/build-module/components/colors-gradients/control.mjs +7 -4
- package/build-module/components/colors-gradients/control.mjs.map +2 -2
- package/build-module/components/global-styles/advanced-panel.mjs +25 -27
- package/build-module/components/global-styles/advanced-panel.mjs.map +2 -2
- package/build-module/components/global-styles/color-panel.mjs +96 -59
- package/build-module/components/global-styles/color-panel.mjs.map +2 -2
- package/build-module/components/global-styles/dimensions-panel.mjs +14 -5
- package/build-module/components/global-styles/dimensions-panel.mjs.map +2 -2
- package/build-module/components/global-styles/index.mjs +2 -0
- package/build-module/components/global-styles/index.mjs.map +2 -2
- package/build-module/components/global-styles/shadow-panel-components.mjs +39 -28
- package/build-module/components/global-styles/shadow-panel-components.mjs.map +2 -2
- package/build-module/components/global-styles/state-control-badges.mjs +48 -0
- package/build-module/components/global-styles/state-control-badges.mjs.map +7 -0
- package/build-module/components/global-styles/state-control.mjs +57 -71
- package/build-module/components/global-styles/state-control.mjs.map +2 -2
- package/build-module/components/iframe/index.mjs +0 -3
- package/build-module/components/iframe/index.mjs.map +2 -2
- package/build-module/components/iframe/use-scale-canvas.mjs +4 -1
- package/build-module/components/iframe/use-scale-canvas.mjs.map +2 -2
- package/build-module/components/inserter/hooks/use-patterns-state.mjs +8 -7
- package/build-module/components/inserter/hooks/use-patterns-state.mjs.map +2 -2
- package/build-module/components/inserter/index.mjs +1 -0
- package/build-module/components/inserter/index.mjs.map +2 -2
- package/build-module/components/inserter/media-tab/media-preview.mjs +27 -19
- package/build-module/components/inserter/media-tab/media-preview.mjs.map +2 -2
- package/build-module/components/inserter/media-tab/utils.mjs +1 -1
- package/build-module/components/inserter/media-tab/utils.mjs.map +2 -2
- package/build-module/components/inserter/panel.mjs +2 -2
- package/build-module/components/inserter/panel.mjs.map +2 -2
- package/build-module/components/inspector-controls/block-support-tools-panel.mjs +10 -2
- package/build-module/components/inspector-controls/block-support-tools-panel.mjs.map +2 -2
- package/build-module/components/inspector-controls/fill.mjs +18 -5
- package/build-module/components/inspector-controls/fill.mjs.map +2 -2
- package/build-module/components/inspector-controls/groups.mjs +2 -0
- package/build-module/components/inspector-controls/groups.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/index.mjs +14 -10
- package/build-module/components/inspector-controls-tabs/index.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/settings-tab.mjs +1 -4
- package/build-module/components/inspector-controls-tabs/settings-tab.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs +9 -0
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.mjs +11 -5
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.mjs.map +2 -2
- package/build-module/components/list-view/block-select-button.mjs +20 -9
- package/build-module/components/list-view/block-select-button.mjs.map +2 -2
- package/build-module/components/list-view/block.mjs +2 -1
- package/build-module/components/list-view/block.mjs.map +2 -2
- package/build-module/components/preset-input-control/custom-value-controls.mjs +10 -2
- package/build-module/components/preset-input-control/custom-value-controls.mjs.map +2 -2
- package/build-module/components/preset-input-control/index.mjs +2 -2
- package/build-module/components/preset-input-control/index.mjs.map +2 -2
- package/build-module/components/provider/use-media-upload-settings.mjs +1 -0
- package/build-module/components/provider/use-media-upload-settings.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/enter.mjs +9 -2
- package/build-module/components/rich-text/event-listeners/enter.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/paste-handler.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/paste-handler.mjs.map +2 -2
- package/build-module/hooks/background.mjs +18 -3
- package/build-module/hooks/background.mjs.map +2 -2
- package/build-module/hooks/block-fields/link/index.mjs +3 -3
- package/build-module/hooks/block-fields/link/index.mjs.map +2 -2
- package/build-module/hooks/block-fields/media/index.mjs +3 -3
- package/build-module/hooks/block-fields/media/index.mjs.map +2 -2
- package/build-module/hooks/block-style-state.mjs +79 -0
- package/build-module/hooks/block-style-state.mjs.map +7 -0
- package/build-module/hooks/border.mjs +18 -3
- package/build-module/hooks/border.mjs.map +2 -2
- package/build-module/hooks/color.mjs +33 -9
- package/build-module/hooks/color.mjs.map +2 -2
- package/build-module/hooks/dimensions.mjs +20 -6
- package/build-module/hooks/dimensions.mjs.map +2 -2
- package/build-module/hooks/layout-child.mjs +141 -61
- package/build-module/hooks/layout-child.mjs.map +2 -2
- package/build-module/hooks/layout.mjs +270 -58
- package/build-module/hooks/layout.mjs.map +2 -2
- package/build-module/hooks/state-utils.mjs +64 -0
- package/build-module/hooks/state-utils.mjs.map +7 -0
- package/build-module/hooks/states.mjs +85 -0
- package/build-module/hooks/states.mjs.map +7 -0
- package/build-module/hooks/style.mjs +309 -18
- package/build-module/hooks/style.mjs.map +2 -2
- package/build-module/hooks/typography.mjs +19 -5
- package/build-module/hooks/typography.mjs.map +2 -2
- package/build-module/layouts/constrained.mjs +130 -57
- package/build-module/layouts/constrained.mjs.map +2 -2
- package/build-module/layouts/flex.mjs +123 -35
- package/build-module/layouts/flex.mjs.map +2 -2
- package/build-module/layouts/grid.mjs +105 -42
- package/build-module/layouts/grid.mjs.map +2 -2
- package/build-module/private-apis.mjs +4 -0
- package/build-module/private-apis.mjs.map +2 -2
- package/build-module/store/private-actions.mjs +16 -0
- package/build-module/store/private-actions.mjs.map +2 -2
- package/build-module/store/private-keys.mjs +7 -1
- package/build-module/store/private-keys.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +25 -2
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs +69 -1
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/store/utils.mjs +5 -2
- package/build-module/store/utils.mjs.map +2 -2
- package/build-module/utils/color-values.mjs +19 -0
- package/build-module/utils/color-values.mjs.map +7 -0
- package/build-style/content-rtl.css +18 -3
- package/build-style/content.css +18 -3
- package/build-style/style-rtl.css +14 -17
- package/build-style/style.css +14 -17
- package/package.json +41 -41
- package/src/components/audio-player/index.native.js +7 -3
- package/src/components/block-card/index.js +67 -60
- package/src/components/block-heading-level-dropdown/heading-level-icon.js +2 -2
- package/src/components/block-icon/index.js +5 -2
- package/src/components/block-icon/index.native.js +2 -2
- package/src/components/block-inspector/index.js +153 -7
- package/src/components/block-inspector/inspector-pre-tabs-slot-fill.js +11 -0
- package/src/components/block-list/block-selection-button.native.js +3 -3
- package/src/components/block-list/content.scss +0 -6
- package/src/components/block-list/use-block-props/index.js +1 -1
- package/src/components/block-list/use-block-props/use-focus-handler.js +8 -6
- package/src/components/block-list/use-block-props/use-is-hovered.js +32 -15
- package/src/components/block-lock/modal.js +4 -4
- package/src/components/block-patterns-list/index.js +14 -5
- package/src/components/block-patterns-list/stories/index.story.jsx +2 -0
- package/src/components/block-patterns-list/style.scss +0 -1
- package/src/components/block-popover/index.js +20 -10
- package/src/components/block-toolbar/switch-section-style.js +2 -2
- package/src/components/block-visibility/modal.js +2 -2
- package/src/components/block-visibility/viewport-visibility-info.js +2 -2
- package/src/components/colors/test/with-colors.js +1 -1
- package/src/components/colors-gradients/control.js +10 -8
- package/src/components/colors-gradients/test/control.js +98 -1
- package/src/components/global-styles/advanced-panel.js +44 -39
- package/src/components/global-styles/color-panel.js +133 -60
- package/src/components/global-styles/dimensions-panel.js +17 -4
- package/src/components/global-styles/index.js +1 -0
- package/src/components/global-styles/shadow-panel-components.js +29 -19
- package/src/components/global-styles/state-control-badges.js +58 -0
- package/src/components/global-styles/state-control.js +28 -36
- package/src/components/global-styles/test/color-panel.js +135 -0
- package/src/components/iframe/index.js +0 -3
- package/src/components/iframe/use-scale-canvas.js +8 -2
- package/src/components/inserter/hooks/use-patterns-state.js +12 -7
- package/src/components/inserter/index.js +1 -0
- package/src/components/inserter/media-tab/media-preview.js +29 -20
- package/src/components/inserter/media-tab/utils.js +1 -1
- package/src/components/inserter/panel.js +2 -2
- package/src/components/inserter/style.scss +1 -0
- package/src/components/inserter-button/index.native.js +5 -2
- package/src/components/inspector-controls/block-support-tools-panel.js +10 -2
- package/src/components/inspector-controls/fill.js +18 -5
- package/src/components/inspector-controls/groups.js +2 -0
- package/src/components/inspector-controls-tabs/index.js +9 -5
- package/src/components/inspector-controls-tabs/settings-tab.js +1 -7
- package/src/components/inspector-controls-tabs/styles-tab.js +6 -0
- package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +13 -7
- package/src/components/list-view/block-select-button.js +19 -9
- package/src/components/list-view/block.js +6 -1
- package/src/components/media-replace-flow/style.scss +0 -18
- package/src/components/preset-input-control/custom-value-controls.js +13 -6
- package/src/components/preset-input-control/index.js +2 -2
- package/src/components/provider/use-media-upload-settings.js +1 -0
- package/src/components/rich-text/event-listeners/enter.js +14 -2
- package/src/components/rich-text/event-listeners/paste-handler.js +5 -4
- package/src/components/unsupported-block-details/index.native.js +6 -2
- package/src/components/video-player/index.native.js +2 -2
- package/src/components/warning/index.native.js +2 -2
- package/src/hooks/background.js +59 -37
- package/src/hooks/block-fields/link/index.js +3 -3
- package/src/hooks/block-fields/media/index.js +3 -3
- package/src/hooks/block-style-state.js +127 -0
- package/src/hooks/border.js +25 -6
- package/src/hooks/color.js +40 -18
- package/src/hooks/dimensions.js +32 -11
- package/src/hooks/layout-child.js +179 -62
- package/src/hooks/layout.js +349 -75
- package/src/hooks/layout.scss +6 -0
- package/src/hooks/state-utils.js +158 -0
- package/src/hooks/states.js +109 -0
- package/src/hooks/style.js +456 -19
- package/src/hooks/test/block-style-state.js +270 -0
- package/src/hooks/test/layout.js +185 -0
- package/src/hooks/test/state-utils.js +193 -0
- package/src/hooks/test/style.js +301 -1
- package/src/hooks/typography.js +33 -14
- package/src/layouts/constrained.js +182 -95
- package/src/layouts/flex.js +141 -36
- package/src/layouts/grid.js +122 -32
- package/src/layouts/test/flex.js +57 -20
- package/src/private-apis.js +4 -0
- package/src/store/private-actions.js +32 -0
- package/src/store/private-keys.js +4 -0
- package/src/store/private-selectors.js +44 -2
- package/src/store/reducer.js +105 -1
- package/src/store/test/private-actions.js +26 -0
- package/src/store/test/private-selectors.js +90 -0
- package/src/store/test/reducer.js +363 -0
- package/src/store/utils.js +6 -2
- package/src/utils/color-values.js +28 -0
- package/src/utils/test/color-values.js +78 -0
package/build/store/utils.cjs
CHANGED
|
@@ -130,7 +130,7 @@ var checkAllowListRecursive = (blocks, allowedBlockTypes) => {
|
|
|
130
130
|
var getAllPatternsDependants = (select) => (state) => {
|
|
131
131
|
return [
|
|
132
132
|
state.settings.__experimentalBlockPatterns,
|
|
133
|
-
state.settings.__experimentalUserPatternCategories,
|
|
133
|
+
state.settings[import_private_keys.userPatternCategoriesSelectKey]?.(select) ?? state.settings.__experimentalUserPatternCategories,
|
|
134
134
|
state.settings.__experimentalReusableBlocks,
|
|
135
135
|
state.settings[import_private_keys.selectBlockPatternsKey]?.(select),
|
|
136
136
|
state.blockPatterns,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/store/utils.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { parse } from '@wordpress/blocks';\nimport { parse as grammarParse } from '@wordpress/block-serialization-default-parser';\n\n/**\n * Internal dependencies\n */\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAAsB;AACtB,gDAAsC;AAKtC,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { parse } from '@wordpress/blocks';\nimport { parse as grammarParse } from '@wordpress/block-serialization-default-parser';\n\n/**\n * Internal dependencies\n */\nimport {\n\tselectBlockPatternsKey,\n\tuserPatternCategoriesSelectKey,\n} from './private-keys';\nimport { unlock } from '../lock-unlock';\nimport { STORE_NAME } from './constants';\nimport {\n\tgetSectionRootClientId,\n\tisSectionBlock,\n\tgetParentSectionBlock,\n} from './private-selectors';\nimport { getBlockEditingMode } from './selectors';\nimport { INSERTER_PATTERN_TYPES } from '../components/inserter/block-patterns-tab/utils';\n\nexport const isFiltered = Symbol( 'isFiltered' );\nconst parsedPatternCache = new WeakMap();\nconst grammarMapCache = new WeakMap();\n\nexport function mapUserPattern(\n\tuserPattern,\n\t__experimentalUserPatternCategories = []\n) {\n\treturn {\n\t\tname: `core/block/${ userPattern.id }`,\n\t\tid: userPattern.id,\n\t\ttype: INSERTER_PATTERN_TYPES.user,\n\t\ttitle: userPattern.title?.raw,\n\t\tcategories: userPattern.wp_pattern_category?.map( ( catId ) => {\n\t\t\tconst category = __experimentalUserPatternCategories.find(\n\t\t\t\t( { id } ) => id === catId\n\t\t\t);\n\t\t\treturn category ? category.slug : catId;\n\t\t} ),\n\t\tcontent: userPattern.content?.raw,\n\t\tsyncStatus: userPattern.wp_pattern_sync_status,\n\t};\n}\n\nfunction parsePattern( pattern ) {\n\tconst blocks = parse( pattern.content, {\n\t\t__unstableSkipMigrationLogs: true,\n\t} );\n\tif ( blocks.length === 1 ) {\n\t\tblocks[ 0 ].attributes = {\n\t\t\t...blocks[ 0 ].attributes,\n\t\t\tmetadata: {\n\t\t\t\t...( blocks[ 0 ].attributes.metadata || {} ),\n\t\t\t\tcategories: pattern.categories,\n\t\t\t\tpatternName: pattern.name,\n\t\t\t\tname: blocks[ 0 ].attributes.metadata?.name || pattern.title,\n\t\t\t},\n\t\t};\n\t}\n\treturn {\n\t\t...pattern,\n\t\tblocks,\n\t};\n}\n\nexport function getParsedPattern( pattern ) {\n\tlet parsedPattern = parsedPatternCache.get( pattern );\n\tif ( ! parsedPattern ) {\n\t\tparsedPattern = parsePattern( pattern );\n\t\tparsedPatternCache.set( pattern, parsedPattern );\n\t}\n\treturn parsedPattern;\n}\n\nexport function getGrammar( pattern ) {\n\tlet grammarMap = grammarMapCache.get( pattern );\n\tif ( ! grammarMap ) {\n\t\tgrammarMap = grammarParse( pattern.content );\n\t\t// Block names are null only at the top level for whitespace.\n\t\tgrammarMap = grammarMap.filter( ( block ) => block.blockName !== null );\n\t\tgrammarMapCache.set( pattern, grammarMap );\n\t}\n\treturn grammarMap;\n}\n\nexport const checkAllowList = ( list, item, defaultResult = null ) => {\n\tif ( typeof list === 'boolean' ) {\n\t\treturn list;\n\t}\n\tif ( Array.isArray( list ) ) {\n\t\t// TODO: when there is a canonical way to detect that we are editing a post\n\t\t// the following check should be changed to something like:\n\t\t// if ( list.includes( 'core/post-content' ) && getEditorMode() === 'post-content' && item === null )\n\t\tif ( list.includes( 'core/post-content' ) && item === null ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn list.includes( item );\n\t}\n\treturn defaultResult;\n};\n\nexport const checkAllowListRecursive = ( blocks, allowedBlockTypes ) => {\n\tif ( typeof allowedBlockTypes === 'boolean' ) {\n\t\treturn allowedBlockTypes;\n\t}\n\n\tconst blocksQueue = [ ...blocks ];\n\twhile ( blocksQueue.length > 0 ) {\n\t\tconst block = blocksQueue.shift();\n\n\t\tconst isAllowed = checkAllowList(\n\t\t\tallowedBlockTypes,\n\t\t\tblock.name || block.blockName,\n\t\t\ttrue\n\t\t);\n\t\tif ( ! isAllowed ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tblock.innerBlocks?.forEach( ( innerBlock ) => {\n\t\t\tblocksQueue.push( innerBlock );\n\t\t} );\n\t}\n\n\treturn true;\n};\n\nexport const getAllPatternsDependants = ( select ) => ( state ) => {\n\treturn [\n\t\tstate.settings.__experimentalBlockPatterns,\n\t\tstate.settings[ userPatternCategoriesSelectKey ]?.( select ) ??\n\t\t\tstate.settings.__experimentalUserPatternCategories,\n\t\tstate.settings.__experimentalReusableBlocks,\n\t\tstate.settings[ selectBlockPatternsKey ]?.( select ),\n\t\tstate.blockPatterns,\n\t\tunlock( select( STORE_NAME ) ).getReusableBlocks(),\n\t];\n};\n\nexport const getInsertBlockTypeDependants = () => ( state, rootClientId ) => {\n\treturn [\n\t\tstate.blockListSettings.get( rootClientId ),\n\t\tstate.blocks.byClientId.get( rootClientId ),\n\t\tstate.blocks.order.get( rootClientId || '' ),\n\t\tstate.settings.allowedBlockTypes,\n\t\tstate.settings.templateLock,\n\t\tgetBlockEditingMode( state, rootClientId ),\n\t\tgetSectionRootClientId( state ),\n\t\tisSectionBlock( state, rootClientId ),\n\t\tgetParentSectionBlock( state, rootClientId ),\n\t];\n};\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": ["grammarParse"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
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/utils/color-values.js
|
|
21
|
+
var color_values_exports = {};
|
|
22
|
+
__export(color_values_exports, {
|
|
23
|
+
extractPresetSlug: () => extractPresetSlug
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(color_values_exports);
|
|
26
|
+
function extractPresetSlug(rawValue, type) {
|
|
27
|
+
if (typeof rawValue !== "string") {
|
|
28
|
+
return void 0;
|
|
29
|
+
}
|
|
30
|
+
const userPrefix = `var:preset|${type}|`;
|
|
31
|
+
if (rawValue.startsWith(userPrefix)) {
|
|
32
|
+
return rawValue.slice(userPrefix.length);
|
|
33
|
+
}
|
|
34
|
+
const cssVarPrefix = `--wp--preset--${type}--`;
|
|
35
|
+
const themeFormatMatch = rawValue.match(
|
|
36
|
+
new RegExp(`^var\\(${cssVarPrefix}([^)]+)\\)$`)
|
|
37
|
+
);
|
|
38
|
+
return themeFormatMatch?.[1];
|
|
39
|
+
}
|
|
40
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
+
0 && (module.exports = {
|
|
42
|
+
extractPresetSlug
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=color-values.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils/color-values.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Extracts the palette slug from a style value for any preset type, supporting\n * both the user preset format and the theme CSS-variable format:\n *\n * - User format: `var:preset|<type>|slug`\n * - Theme format: `var(--wp--preset--<type>--slug)`\n *\n * Returns `undefined` for plain values, non-strings, or any other\n * unrecognised format.\n *\n * @param {*} rawValue Raw style value stored in the style object.\n * @param {'color'|'gradient'} type Preset type, e.g. `'color'` or `'gradient'`.\n * @return {string|undefined} The palette slug, or undefined.\n */\nexport function extractPresetSlug( rawValue, type ) {\n\tif ( typeof rawValue !== 'string' ) {\n\t\treturn undefined;\n\t}\n\tconst userPrefix = `var:preset|${ type }|`;\n\tif ( rawValue.startsWith( userPrefix ) ) {\n\t\treturn rawValue.slice( userPrefix.length );\n\t}\n\tconst cssVarPrefix = `--wp--preset--${ type }--`;\n\tconst themeFormatMatch = rawValue.match(\n\t\tnew RegExp( `^var\\\\(${ cssVarPrefix }([^)]+)\\\\)$` )\n\t);\n\treturn themeFormatMatch?.[ 1 ];\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAcO,SAAS,kBAAmB,UAAU,MAAO;AACnD,MAAK,OAAO,aAAa,UAAW;AACnC,WAAO;AAAA,EACR;AACA,QAAM,aAAa,cAAe,IAAK;AACvC,MAAK,SAAS,WAAY,UAAW,GAAI;AACxC,WAAO,SAAS,MAAO,WAAW,MAAO;AAAA,EAC1C;AACA,QAAM,eAAe,iBAAkB,IAAK;AAC5C,QAAM,mBAAmB,SAAS;AAAA,IACjC,IAAI,OAAQ,UAAW,YAAa,aAAc;AAAA,EACnD;AACA,SAAO,mBAAoB,CAAE;AAC9B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -2,12 +2,10 @@
|
|
|
2
2
|
import clsx from "clsx";
|
|
3
3
|
import {
|
|
4
4
|
Button,
|
|
5
|
-
Icon,
|
|
6
|
-
__experimentalText as WCText,
|
|
7
|
-
__experimentalVStack as VStack,
|
|
8
|
-
__experimentalHStack as HStack,
|
|
5
|
+
Icon as WCIcon,
|
|
9
6
|
privateApis as componentsPrivateApis
|
|
10
7
|
} from "@wordpress/components";
|
|
8
|
+
import { Text, Stack } from "@wordpress/ui";
|
|
11
9
|
import { useDispatch, useSelect } from "@wordpress/data";
|
|
12
10
|
import deprecated from "@wordpress/deprecated";
|
|
13
11
|
import { __, sprintf, isRTL } from "@wordpress/i18n";
|
|
@@ -48,7 +46,8 @@ function BlockCard({
|
|
|
48
46
|
parentClientId,
|
|
49
47
|
isChild,
|
|
50
48
|
children,
|
|
51
|
-
clientId
|
|
49
|
+
clientId,
|
|
50
|
+
controls
|
|
52
51
|
}) {
|
|
53
52
|
if (blockType) {
|
|
54
53
|
deprecated("`blockType` property in `BlockCard component`", {
|
|
@@ -88,47 +87,55 @@ function BlockCard({
|
|
|
88
87
|
},
|
|
89
88
|
className
|
|
90
89
|
),
|
|
91
|
-
children: /* @__PURE__ */ jsxs(
|
|
92
|
-
/* @__PURE__ */ jsxs(
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
90
|
+
children: /* @__PURE__ */ jsxs(Stack, { direction: "column", gap: "sm", children: [
|
|
91
|
+
/* @__PURE__ */ jsxs(Stack, { direction: "row", align: "center", justify: "space-between", children: [
|
|
92
|
+
/* @__PURE__ */ jsxs(Stack, { direction: "row", align: "center", justify: "flex-start", children: [
|
|
93
|
+
parentBlockClientId && /* @__PURE__ */ jsx(
|
|
94
|
+
Button,
|
|
95
|
+
{
|
|
96
|
+
onClick: () => selectBlock(parentBlockClientId),
|
|
97
|
+
label: parentBlockName ? sprintf(
|
|
98
|
+
/* translators: %s: The name of the parent block. */
|
|
99
|
+
__('Go to "%s" block'),
|
|
100
|
+
getBlockType(parentBlockName)?.title
|
|
101
|
+
) : __("Go to parent block"),
|
|
102
|
+
style: (
|
|
103
|
+
// TODO: This style override is also used in ToolsPanelHeader.
|
|
104
|
+
// It should be supported out-of-the-box by Button.
|
|
105
|
+
{ minWidth: 24, padding: 0 }
|
|
106
|
+
),
|
|
107
|
+
icon: isRTL() ? chevronRight : chevronLeft,
|
|
108
|
+
size: "small"
|
|
109
|
+
}
|
|
110
|
+
),
|
|
111
|
+
isChild && /* @__PURE__ */ jsx("span", { className: "block-editor-block-card__child-indicator-icon", children: /* @__PURE__ */ jsx(
|
|
112
|
+
WCIcon,
|
|
113
|
+
{
|
|
114
|
+
icon: isRTL() ? arrowLeft : arrowRight
|
|
115
|
+
}
|
|
116
|
+
) }),
|
|
117
|
+
/* @__PURE__ */ jsxs(
|
|
118
|
+
OptionalParentSelectButton,
|
|
119
|
+
{
|
|
120
|
+
onClick: parentClientId ? () => {
|
|
121
|
+
selectBlock(parentClientId);
|
|
122
|
+
} : void 0,
|
|
123
|
+
children: [
|
|
124
|
+
/* @__PURE__ */ jsx(BlockIcon, { icon, showColors: true }),
|
|
125
|
+
/* @__PURE__ */ jsxs(Stack, { direction: "column", gap: "xs", children: [
|
|
126
|
+
/* @__PURE__ */ jsxs(TitleElement, { className: "block-editor-block-card__title", children: [
|
|
127
|
+
/* @__PURE__ */ jsx("span", { className: "block-editor-block-card__name", children: !!name?.length ? name : title }),
|
|
128
|
+
!parentClientId && !isChild && !!name?.length && /* @__PURE__ */ jsx(WCBadge, { children: title })
|
|
129
|
+
] }),
|
|
130
|
+
children
|
|
131
|
+
] })
|
|
132
|
+
]
|
|
133
|
+
}
|
|
134
|
+
)
|
|
135
|
+
] }),
|
|
136
|
+
controls
|
|
130
137
|
] }),
|
|
131
|
-
!parentClientId && !isChild && description && /* @__PURE__ */ jsx(
|
|
138
|
+
!parentClientId && !isChild && description && /* @__PURE__ */ jsx(Text, { className: "block-editor-block-card__description", children: description })
|
|
132
139
|
] })
|
|
133
140
|
}
|
|
134
141
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-card/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tIcon
|
|
5
|
-
"mappings": ";AAGA,OAAO,UAAU;AAKjB;AAAA,EACC;AAAA,EACA
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tIcon as WCIcon,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { Text, Stack } from '@wordpress/ui';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { __, sprintf, isRTL } from '@wordpress/i18n';\nimport {\n\tchevronLeft,\n\tchevronRight,\n\tarrowRight,\n\tarrowLeft,\n} from '@wordpress/icons';\nimport { getBlockType, hasBlockSupport } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as blockEditorStore } from '../../store';\nimport BlockIcon from '../block-icon';\n\nconst { Badge: WCBadge } = unlock( componentsPrivateApis );\n\nfunction OptionalParentSelectButton( { children, onClick } ) {\n\tif ( ! onClick ) {\n\t\treturn children;\n\t}\n\n\treturn (\n\t\t<Button\n\t\t\t__next40pxDefaultSize\n\t\t\tclassName=\"block-editor-block-card__parent-select-button\"\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ children }\n\t\t</Button>\n\t);\n}\n\n/**\n * A card component that displays block information including title, icon, and description.\n * Can be used to show block metadata and navigation controls for parent blocks.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-card/README.md\n *\n * @example\n * ```jsx\n * function Example() {\n * return (\n * <BlockCard\n * title=\"My Block\"\n * icon=\"smiley\"\n * description=\"A simple block example\"\n * name=\"Custom Block\"\n * />\n * );\n * }\n * ```\n *\n * @param {Object} props Component props.\n * @param {string} props.title The title of the block.\n * @param {string|Object} props.icon The icon of the block. This can be any of [WordPress' Dashicons](https://developer.wordpress.org/resource/dashicons/), or a custom `svg` element.\n * @param {string} props.description The description of the block.\n * @param {Object} [props.blockType] Deprecated: Object containing block type data.\n * @param {string} [props.className] Additional classes to apply to the card.\n * @param {string} [props.name] Custom block name to display before the title.\n * @param {string} [props.allowParentNavigation] Show a back arrow to the parent block in some situations.\n * @param {string} [props.parentClientId] The parent clientId, if this card is for a parent block.\n * @param {string} [props.isChild] Whether the block card is for a child block, in which case, indent the block using an arrow.\n * @param {string} [props.clientId] Whether the block card is for a child block, in which case, indent the block using an arrow.\n * @param {Element} [props.controls] Controls rendered beside the block title.\n * @param {Element} [props.children] Children.\n * @return {Element} Block card component.\n */\nfunction BlockCard( {\n\ttitle,\n\ticon,\n\tdescription,\n\tblockType,\n\tclassName,\n\tname,\n\tallowParentNavigation,\n\tparentClientId,\n\tisChild,\n\tchildren,\n\tclientId,\n\tcontrols,\n} ) {\n\tif ( blockType ) {\n\t\tdeprecated( '`blockType` property in `BlockCard component`', {\n\t\t\tsince: '5.7',\n\t\t\talternative: '`title, icon and description` properties',\n\t\t} );\n\t\t( { title, icon, description } = blockType );\n\t}\n\n\tconst { parentBlockClientId, parentBlockName } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( parentClientId || isChild || ! allowParentNavigation ) {\n\t\t\t\treturn {};\n\t\t\t}\n\t\t\tconst { getBlockParents, getBlockName } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\t// Find the top-most parent block that is either:\n\t\t\t// 1. A navigation block (special case for ad-hoc list view support)\n\t\t\t// 2. Any block with listView support\n\t\t\tconst parents = getBlockParents( clientId, false );\n\t\t\tconst foundParentId = parents.find( ( parentId ) => {\n\t\t\t\tconst parentName = getBlockName( parentId );\n\t\t\t\treturn (\n\t\t\t\t\tparentName === 'core/navigation' ||\n\t\t\t\t\thasBlockSupport( parentName, 'listView' )\n\t\t\t\t);\n\t\t\t} );\n\n\t\t\treturn {\n\t\t\t\tparentBlockClientId: foundParentId,\n\t\t\t\tparentBlockName: foundParentId\n\t\t\t\t\t? getBlockName( foundParentId )\n\t\t\t\t\t: null,\n\t\t\t};\n\t\t},\n\t\t[ clientId, allowParentNavigation, isChild, parentClientId ]\n\t);\n\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\n\tconst TitleElement = parentClientId ? 'div' : 'h2';\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx(\n\t\t\t\t'block-editor-block-card',\n\t\t\t\t{\n\t\t\t\t\t'is-parent': parentClientId,\n\t\t\t\t\t'is-child': isChild,\n\t\t\t\t},\n\t\t\t\tclassName\n\t\t\t) }\n\t\t>\n\t\t\t<Stack direction=\"column\" gap=\"sm\">\n\t\t\t\t<Stack direction=\"row\" align=\"center\" justify=\"space-between\">\n\t\t\t\t\t<Stack direction=\"row\" align=\"center\" justify=\"flex-start\">\n\t\t\t\t\t\t{ parentBlockClientId && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tselectBlock( parentBlockClientId )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t\tparentBlockName\n\t\t\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: The name of the parent block. */\n\t\t\t\t\t\t\t\t\t\t\t\t__( 'Go to \"%s\" block' ),\n\t\t\t\t\t\t\t\t\t\t\t\tgetBlockType( parentBlockName )\n\t\t\t\t\t\t\t\t\t\t\t\t\t?.title\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t: __( 'Go to parent block' )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t\t// TODO: This style override is also used in ToolsPanelHeader.\n\t\t\t\t\t\t\t\t\t// It should be supported out-of-the-box by Button.\n\t\t\t\t\t\t\t\t\t{ minWidth: 24, padding: 0 }\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isChild && (\n\t\t\t\t\t\t\t<span className=\"block-editor-block-card__child-indicator-icon\">\n\t\t\t\t\t\t\t\t<WCIcon\n\t\t\t\t\t\t\t\t\ticon={ isRTL() ? arrowLeft : arrowRight }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<OptionalParentSelectButton\n\t\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\t\tparentClientId\n\t\t\t\t\t\t\t\t\t? () => {\n\t\t\t\t\t\t\t\t\t\t\tselectBlock( parentClientId );\n\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockIcon icon={ icon } showColors />\n\t\t\t\t\t\t\t<Stack direction=\"column\" gap=\"xs\">\n\t\t\t\t\t\t\t\t<TitleElement className=\"block-editor-block-card__title\">\n\t\t\t\t\t\t\t\t\t<span className=\"block-editor-block-card__name\">\n\t\t\t\t\t\t\t\t\t\t{ !! name?.length ? name : title }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t{ ! parentClientId &&\n\t\t\t\t\t\t\t\t\t\t! isChild &&\n\t\t\t\t\t\t\t\t\t\t!! name?.length && (\n\t\t\t\t\t\t\t\t\t\t\t<WCBadge>{ title }</WCBadge>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</TitleElement>\n\t\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t</OptionalParentSelectButton>\n\t\t\t\t\t</Stack>\n\t\t\t\t\t{ controls }\n\t\t\t\t</Stack>\n\t\t\t\t{ ! parentClientId && ! isChild && description && (\n\t\t\t\t\t<Text className=\"block-editor-block-card__description\">\n\t\t\t\t\t\t{ description }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\t\t\t</Stack>\n\t\t</div>\n\t);\n}\n\nexport default BlockCard;\n"],
|
|
5
|
+
"mappings": ";AAGA,OAAO,UAAU;AAKjB;AAAA,EACC;AAAA,EACA,QAAQ;AAAA,EACR,eAAe;AAAA,OACT;AACP,SAAS,MAAM,aAAa;AAC5B,SAAS,aAAa,iBAAiB;AACvC,OAAO,gBAAgB;AACvB,SAAS,IAAI,SAAS,aAAa;AACnC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,cAAc,uBAAuB;AAK9C,SAAS,cAAc;AACvB,SAAS,SAAS,wBAAwB;AAC1C,OAAO,eAAe;AAUpB,cA6JM,YA7JN;AARF,IAAM,EAAE,OAAO,QAAQ,IAAI,OAAQ,qBAAsB;AAEzD,SAAS,2BAA4B,EAAE,UAAU,QAAQ,GAAI;AAC5D,MAAK,CAAE,SAAU;AAChB,WAAO;AAAA,EACR;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,uBAAqB;AAAA,MACrB,WAAU;AAAA,MACV;AAAA,MAEE;AAAA;AAAA,EACH;AAEF;AAqCA,SAAS,UAAW;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,MAAK,WAAY;AAChB,eAAY,iDAAiD;AAAA,MAC5D,OAAO;AAAA,MACP,aAAa;AAAA,IACd,CAAE;AACF,KAAE,EAAE,OAAO,MAAM,YAAY,IAAI;AAAA,EAClC;AAEA,QAAM,EAAE,qBAAqB,gBAAgB,IAAI;AAAA,IAChD,CAAE,WAAY;AACb,UAAK,kBAAkB,WAAW,CAAE,uBAAwB;AAC3D,eAAO,CAAC;AAAA,MACT;AACA,YAAM,EAAE,iBAAiB,aAAa,IACrC,OAAQ,gBAAiB;AAK1B,YAAM,UAAU,gBAAiB,UAAU,KAAM;AACjD,YAAM,gBAAgB,QAAQ,KAAM,CAAE,aAAc;AACnD,cAAM,aAAa,aAAc,QAAS;AAC1C,eACC,eAAe,qBACf,gBAAiB,YAAY,UAAW;AAAA,MAE1C,CAAE;AAEF,aAAO;AAAA,QACN,qBAAqB;AAAA,QACrB,iBAAiB,gBACd,aAAc,aAAc,IAC5B;AAAA,MACJ;AAAA,IACD;AAAA,IACA,CAAE,UAAU,uBAAuB,SAAS,cAAe;AAAA,EAC5D;AAEA,QAAM,EAAE,YAAY,IAAI,YAAa,gBAAiB;AAEtD,QAAM,eAAe,iBAAiB,QAAQ;AAE9C,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAY;AAAA,QACX;AAAA,QACA;AAAA,UACC,aAAa;AAAA,UACb,YAAY;AAAA,QACb;AAAA,QACA;AAAA,MACD;AAAA,MAEA,+BAAC,SAAM,WAAU,UAAS,KAAI,MAC7B;AAAA,6BAAC,SAAM,WAAU,OAAM,OAAM,UAAS,SAAQ,iBAC7C;AAAA,+BAAC,SAAM,WAAU,OAAM,OAAM,UAAS,SAAQ,cAC3C;AAAA,mCACD;AAAA,cAAC;AAAA;AAAA,gBACA,SAAU,MACT,YAAa,mBAAoB;AAAA,gBAElC,OACC,kBACG;AAAA;AAAA,kBAEA,GAAI,kBAAmB;AAAA,kBACvB,aAAc,eAAgB,GAC3B;AAAA,gBACH,IACA,GAAI,oBAAqB;AAAA,gBAE7B;AAAA;AAAA;AAAA,kBAGC,EAAE,UAAU,IAAI,SAAS,EAAE;AAAA;AAAA,gBAE5B,MAAO,MAAM,IAAI,eAAe;AAAA,gBAChC,MAAK;AAAA;AAAA,YACN;AAAA,YAEC,WACD,oBAAC,UAAK,WAAU,iDACf;AAAA,cAAC;AAAA;AAAA,gBACA,MAAO,MAAM,IAAI,YAAY;AAAA;AAAA,YAC9B,GACD;AAAA,YAED;AAAA,cAAC;AAAA;AAAA,gBACA,SACC,iBACG,MAAM;AACN,8BAAa,cAAe;AAAA,gBAC5B,IACA;AAAA,gBAGJ;AAAA,sCAAC,aAAU,MAAc,YAAU,MAAC;AAAA,kBACpC,qBAAC,SAAM,WAAU,UAAS,KAAI,MAC7B;AAAA,yCAAC,gBAAa,WAAU,kCACvB;AAAA,0CAAC,UAAK,WAAU,iCACb,WAAC,CAAE,MAAM,SAAS,OAAO,OAC5B;AAAA,sBACE,CAAE,kBACH,CAAE,WACF,CAAC,CAAE,MAAM,UACR,oBAAC,WAAU,iBAAO;AAAA,uBAErB;AAAA,oBACE;AAAA,qBACH;AAAA;AAAA;AAAA,YACD;AAAA,aACD;AAAA,UACE;AAAA,WACH;AAAA,QACE,CAAE,kBAAkB,CAAE,WAAW,eAClC,oBAAC,QAAK,WAAU,wCACb,uBACH;AAAA,SAEF;AAAA;AAAA,EACD;AAEF;AAEA,IAAO,qBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
headingLevel6,
|
|
9
9
|
paragraph
|
|
10
10
|
} from "@wordpress/icons";
|
|
11
|
-
import { Icon } from "@wordpress/components";
|
|
11
|
+
import { Icon as WCIcon } from "@wordpress/components";
|
|
12
12
|
import { jsx } from "react/jsx-runtime";
|
|
13
13
|
var LEVEL_TO_PATH = {
|
|
14
14
|
0: paragraph,
|
|
@@ -21,7 +21,7 @@ var LEVEL_TO_PATH = {
|
|
|
21
21
|
};
|
|
22
22
|
function HeadingLevelIcon({ level }) {
|
|
23
23
|
if (LEVEL_TO_PATH[level]) {
|
|
24
|
-
return /* @__PURE__ */ jsx(
|
|
24
|
+
return /* @__PURE__ */ jsx(WCIcon, { icon: LEVEL_TO_PATH[level] });
|
|
25
25
|
}
|
|
26
26
|
return null;
|
|
27
27
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-heading-level-dropdown/heading-level-icon.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\theadingLevel1,\n\theadingLevel2,\n\theadingLevel3,\n\theadingLevel4,\n\theadingLevel5,\n\theadingLevel6,\n\tparagraph,\n} from '@wordpress/icons';\nimport { Icon } from '@wordpress/components';\n\n/** @typedef {React.ComponentType} ComponentType */\n\n/**\n * HeadingLevelIcon props.\n *\n * @typedef WPHeadingLevelIconProps\n *\n * @property {number} level The heading level to show an icon for.\n */\n\nconst LEVEL_TO_PATH = {\n\t0: paragraph,\n\t1: headingLevel1,\n\t2: headingLevel2,\n\t3: headingLevel3,\n\t4: headingLevel4,\n\t5: headingLevel5,\n\t6: headingLevel6,\n};\n\n/**\n * Heading level icon.\n *\n * @param {WPHeadingLevelIconProps} props Component props.\n *\n * @return {?ComponentType} The icon.\n */\nexport default function HeadingLevelIcon( { level } ) {\n\tif ( LEVEL_TO_PATH[ level ] ) {\n\t\treturn <
|
|
5
|
-
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\theadingLevel1,\n\theadingLevel2,\n\theadingLevel3,\n\theadingLevel4,\n\theadingLevel5,\n\theadingLevel6,\n\tparagraph,\n} from '@wordpress/icons';\nimport { Icon as WCIcon } from '@wordpress/components';\n\n/** @typedef {React.ComponentType} ComponentType */\n\n/**\n * HeadingLevelIcon props.\n *\n * @typedef WPHeadingLevelIconProps\n *\n * @property {number} level The heading level to show an icon for.\n */\n\nconst LEVEL_TO_PATH = {\n\t0: paragraph,\n\t1: headingLevel1,\n\t2: headingLevel2,\n\t3: headingLevel3,\n\t4: headingLevel4,\n\t5: headingLevel5,\n\t6: headingLevel6,\n};\n\n/**\n * Heading level icon.\n *\n * @param {WPHeadingLevelIconProps} props Component props.\n *\n * @return {?ComponentType} The icon.\n */\nexport default function HeadingLevelIcon( { level } ) {\n\tif ( LEVEL_TO_PATH[ level ] ) {\n\t\treturn <WCIcon icon={ LEVEL_TO_PATH[ level ] } />;\n\t}\n\n\treturn null;\n}\n"],
|
|
5
|
+
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,QAAQ,cAAc;AA+BtB;AAnBT,IAAM,gBAAgB;AAAA,EACrB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACJ;AASe,SAAR,iBAAmC,EAAE,MAAM,GAAI;AACrD,MAAK,cAAe,KAAM,GAAI;AAC7B,WAAO,oBAAC,UAAO,MAAO,cAAe,KAAM,GAAI;AAAA,EAChD;AAEA,SAAO;AACR;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// packages/block-editor/src/components/block-icon/index.js
|
|
2
2
|
import clsx from "clsx";
|
|
3
|
-
import { Icon } from "@wordpress/components";
|
|
3
|
+
import { Icon as WCIcon } from "@wordpress/components";
|
|
4
4
|
import { blockDefault } from "@wordpress/icons";
|
|
5
5
|
import { memo } from "@wordpress/element";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -10,7 +10,13 @@ function BlockIcon({ icon, showColors = false, className, context }) {
|
|
|
10
10
|
src: blockDefault
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
const renderedIcon = /* @__PURE__ */ jsx(
|
|
13
|
+
const renderedIcon = /* @__PURE__ */ jsx(
|
|
14
|
+
WCIcon,
|
|
15
|
+
{
|
|
16
|
+
icon: icon && icon.src ? icon.src : icon,
|
|
17
|
+
context
|
|
18
|
+
}
|
|
19
|
+
);
|
|
14
20
|
const style = showColors ? {
|
|
15
21
|
backgroundColor: icon && icon.background,
|
|
16
22
|
color: icon && icon.foreground
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-icon/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { Icon } from '@wordpress/components';\nimport { blockDefault } from '@wordpress/icons';\nimport { memo } from '@wordpress/element';\n\nfunction BlockIcon( { icon, showColors = false, className, context } ) {\n\tif ( icon?.src === 'block-default' ) {\n\t\ticon = {\n\t\t\tsrc: blockDefault,\n\t\t};\n\t}\n\n\tconst renderedIcon = (\n\t\t<
|
|
5
|
-
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { Icon as WCIcon } from '@wordpress/components';\nimport { blockDefault } from '@wordpress/icons';\nimport { memo } from '@wordpress/element';\n\nfunction BlockIcon( { icon, showColors = false, className, context } ) {\n\tif ( icon?.src === 'block-default' ) {\n\t\ticon = {\n\t\t\tsrc: blockDefault,\n\t\t};\n\t}\n\n\tconst renderedIcon = (\n\t\t<WCIcon\n\t\t\ticon={ icon && icon.src ? icon.src : icon }\n\t\t\tcontext={ context }\n\t\t/>\n\t);\n\tconst style = showColors\n\t\t? {\n\t\t\t\tbackgroundColor: icon && icon.background,\n\t\t\t\tcolor: icon && icon.foreground,\n\t\t }\n\t\t: {};\n\n\treturn (\n\t\t<span\n\t\t\tstyle={ style }\n\t\t\tclassName={ clsx( 'block-editor-block-icon', className, {\n\t\t\t\t'has-colors': showColors,\n\t\t\t} ) }\n\t\t>\n\t\t\t{ renderedIcon }\n\t\t</span>\n\t);\n}\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-icon/README.md\n */\nexport default memo( BlockIcon );\n"],
|
|
5
|
+
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,QAAQ,cAAc;AAC/B,SAAS,oBAAoB;AAC7B,SAAS,YAAY;AAUnB;AARF,SAAS,UAAW,EAAE,MAAM,aAAa,OAAO,WAAW,QAAQ,GAAI;AACtE,MAAK,MAAM,QAAQ,iBAAkB;AACpC,WAAO;AAAA,MACN,KAAK;AAAA,IACN;AAAA,EACD;AAEA,QAAM,eACL;AAAA,IAAC;AAAA;AAAA,MACA,MAAO,QAAQ,KAAK,MAAM,KAAK,MAAM;AAAA,MACrC;AAAA;AAAA,EACD;AAED,QAAM,QAAQ,aACX;AAAA,IACA,iBAAiB,QAAQ,KAAK;AAAA,IAC9B,OAAO,QAAQ,KAAK;AAAA,EACpB,IACA,CAAC;AAEJ,SACC;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA,WAAY,KAAM,2BAA2B,WAAW;AAAA,QACvD,cAAc;AAAA,MACf,CAAE;AAAA,MAEA;AAAA;AAAA,EACH;AAEF;AAKA,IAAO,qBAAQ,KAAM,SAAU;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|