@wordpress/block-editor 7.0.1 → 8.0.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 +11 -0
- package/README.md +47 -4
- package/build/components/autocomplete/index.js +1 -1
- package/build/components/autocomplete/index.js.map +1 -1
- package/build/components/block-actions/index.js +8 -4
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-alignment-control/ui.js +61 -14
- package/build/components/block-alignment-control/ui.js.map +1 -1
- package/build/components/block-alignment-control/use-available-alignments.js +25 -3
- package/build/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build/components/block-content-overlay/index.js +2 -4
- package/build/components/block-content-overlay/index.js.map +1 -1
- package/build/components/block-controls/fill.js +6 -6
- package/build/components/block-controls/fill.js.map +1 -1
- package/build/components/block-controls/groups.js +3 -1
- package/build/components/block-controls/groups.js.map +1 -1
- package/build/components/block-controls/hook.js +57 -0
- package/build/components/block-controls/hook.js.map +1 -0
- package/build/components/block-edit/context.js +6 -5
- package/build/components/block-edit/context.js.map +1 -1
- package/build/components/block-edit/edit.js +1 -1
- package/build/components/block-edit/edit.js.map +1 -1
- package/build/components/block-icon/index.js +5 -1
- package/build/components/block-icon/index.js.map +1 -1
- package/build/components/block-icon/index.native.js +13 -9
- package/build/components/block-icon/index.native.js.map +1 -1
- package/build/components/block-inspector/index.js +14 -7
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-html.js +5 -0
- package/build/components/block-list/block-html.js.map +1 -1
- package/build/components/block-list/block-list-item.native.js +31 -12
- package/build/components/block-list/block-list-item.native.js.map +1 -1
- package/build/components/block-list/block-selection-button.native.js +4 -4
- package/build/components/block-list/block-selection-button.native.js.map +1 -1
- package/build/components/block-list/block.js +15 -9
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +6 -7
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/grid-item.native.js +68 -0
- package/build/components/block-list/grid-item.native.js.map +1 -0
- package/build/components/block-list/index.js +19 -15
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-list/index.native.js +13 -9
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +6 -6
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-block-custom-class-name.js +4 -6
- package/build/components/block-list/use-block-props/use-block-custom-class-name.js.map +1 -1
- package/build/components/block-list/use-block-props/use-block-default-class-name.js +1 -1
- package/build/components/block-list/use-block-props/use-block-default-class-name.js.map +1 -1
- package/build/components/block-list/use-block-props/use-multi-selection.js +21 -6
- package/build/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +9 -1
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-list-appender/index.js +9 -1
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-mover/index.js +4 -4
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-mover/index.native.js +4 -4
- package/build/components/block-mover/index.native.js.map +1 -1
- package/build/components/block-navigation/dropdown.js +0 -1
- package/build/components/block-navigation/dropdown.js.map +1 -1
- package/build/components/block-patterns-list/index.js +1 -8
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-preview/auto.js +42 -14
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-settings/container.native.js +5 -2
- package/build/components/block-settings/container.native.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +26 -5
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +10 -3
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-styles/index.js +5 -1
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-styles/preview.native.js +2 -2
- package/build/components/block-styles/preview.native.js.map +1 -1
- package/build/components/block-switcher/block-styles-menu.js +1 -1
- package/build/components/block-switcher/block-styles-menu.js.map +1 -1
- package/build/components/block-switcher/index.js +10 -3
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-title/index.js +3 -2
- package/build/components/block-title/index.js.map +1 -1
- package/build/components/block-toolbar/index.js +3 -0
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build/components/block-tools/block-popover.js +8 -7
- package/build/components/block-tools/block-popover.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +2 -4
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/index.js +4 -1
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +96 -7
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-types-list/index.native.js +3 -2
- package/build/components/block-types-list/index.native.js.map +1 -1
- package/build/components/border-radius-control/index.js.map +1 -1
- package/build/components/border-radius-control/utils.js +17 -8
- package/build/components/border-radius-control/utils.js.map +1 -1
- package/build/components/colors/utils.js +11 -3
- package/build/components/colors/utils.js.map +1 -1
- package/build/components/colors-gradients/control.js +22 -57
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.js +83 -7
- package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build/components/contrast-checker/index.js +18 -12
- package/build/components/contrast-checker/index.js.map +1 -1
- package/build/components/copy-handler/index.js +9 -3
- package/build/components/copy-handler/index.js.map +1 -1
- package/build/components/default-block-appender/index.js +2 -2
- package/build/components/default-block-appender/index.js.map +1 -1
- package/build/components/duotone-control/index.js +41 -39
- package/build/components/duotone-control/index.js.map +1 -1
- package/build/components/editor-styles/index.js +9 -3
- package/build/components/editor-styles/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +44 -12
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/font-sizes/index.native.js +24 -0
- package/build/components/font-sizes/index.native.js.map +1 -1
- package/build/components/iframe/index.js +46 -63
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/aspect-ratio-dropdown.js +126 -0
- package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -0
- package/build/components/image-editor/constants.js +16 -0
- package/build/components/image-editor/constants.js.map +1 -0
- package/build/components/image-editor/context.js +59 -0
- package/build/components/image-editor/context.js.map +1 -0
- package/build/components/image-editor/cropper.js +83 -0
- package/build/components/image-editor/cropper.js.map +1 -0
- package/build/components/image-editor/form-controls.js +36 -0
- package/build/components/image-editor/form-controls.js.map +1 -0
- package/build/components/image-editor/index.js +60 -0
- package/build/components/image-editor/index.js.map +1 -0
- package/build/components/image-editor/rotation-button.js +37 -0
- package/build/components/image-editor/rotation-button.js.map +1 -0
- package/build/components/image-editor/use-save-image.js +84 -0
- package/build/components/image-editor/use-save-image.js.map +1 -0
- package/build/components/image-editor/use-transform-image.js +135 -0
- package/build/components/image-editor/use-transform-image.js.map +1 -0
- package/build/components/image-editor/zoom-dropdown.js +55 -0
- package/build/components/image-editor/zoom-dropdown.js.map +1 -0
- package/build/components/image-size-control/use-dimension-handler.js +14 -3
- package/build/components/image-size-control/use-dimension-handler.js.map +1 -1
- package/build/components/index.js +42 -37
- package/build/components/index.js.map +1 -1
- package/build/components/index.native.js +12 -7
- package/build/components/index.native.js.map +1 -1
- package/build/components/inner-blocks/button-block-appender.js +11 -1
- package/build/components/inner-blocks/button-block-appender.js.map +1 -1
- package/build/components/inner-blocks/index.js +28 -10
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/index.native.js +42 -4
- package/build/components/inner-blocks/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +24 -13
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/explorer.js +62 -0
- package/build/components/inserter/block-patterns-explorer/explorer.js.map +1 -0
- package/build/components/inserter/block-patterns-explorer/patterns-list.js +111 -0
- package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -0
- package/build/components/inserter/block-patterns-explorer/sidebar.js +78 -0
- package/build/components/inserter/block-patterns-explorer/sidebar.js.map +1 -0
- package/build/components/inserter/block-patterns-tab.js +74 -35
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/block-types-tab.native.js +3 -6
- package/build/components/inserter/block-types-tab.native.js.map +1 -1
- package/build/components/inserter/hooks/use-block-type-impressions.native.js +4 -7
- package/build/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
- package/build/components/inserter/hooks/use-clipboard-block.native.js +5 -4
- package/build/components/inserter/hooks/use-clipboard-block.native.js.map +1 -1
- package/build/components/inserter/index.js +12 -4
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/index.native.js +1 -7
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter/library.js +2 -0
- package/build/components/inserter/library.js.map +1 -1
- package/build/components/inserter/menu.js +2 -1
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/menu.native.js +18 -17
- package/build/components/inserter/menu.native.js.map +1 -1
- package/build/components/inserter/pattern-panel.js +19 -10
- package/build/components/inserter/pattern-panel.js.map +1 -1
- package/build/components/inserter/preview-panel.js +1 -1
- package/build/components/inserter/preview-panel.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +2 -1
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/reusable-blocks-tab.native.js +5 -6
- package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build/components/inserter/search-results.native.js +9 -2
- package/build/components/inserter/search-results.native.js.map +1 -1
- package/build/components/inserter/tabs.native.js +1 -4
- package/build/components/inserter/tabs.native.js.map +1 -1
- package/build/components/inserter/utils.native.js +44 -0
- package/build/components/inserter/utils.native.js.map +1 -0
- package/build/components/inspector-controls/block-support-slot-container.js +28 -0
- package/build/components/inspector-controls/block-support-slot-container.js.map +1 -0
- package/build/components/inspector-controls/block-support-tools-panel.js +78 -0
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -0
- package/build/components/inspector-controls/fill.js +64 -0
- package/build/components/inspector-controls/fill.js.map +1 -0
- package/build/components/inspector-controls/{index.native.js → fill.native.js} +20 -19
- package/build/components/inspector-controls/fill.native.js.map +1 -0
- package/build/components/inspector-controls/groups.js +25 -0
- package/build/components/inspector-controls/groups.js.map +1 -0
- package/build/components/inspector-controls/index.js +22 -20
- package/build/components/inspector-controls/index.js.map +1 -1
- package/build/components/inspector-controls/slot.js +67 -0
- package/build/components/inspector-controls/slot.js.map +1 -0
- package/build/components/inspector-controls/slot.native.js +38 -0
- package/build/components/inspector-controls/slot.native.js.map +1 -0
- package/build/components/letter-spacing-control/index.js +9 -6
- package/build/components/letter-spacing-control/index.js.map +1 -1
- package/build/components/line-height-control/index.native.js +39 -0
- package/build/components/line-height-control/index.native.js.map +1 -0
- package/build/components/link-control/index.js +93 -34
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/link-preview.js +45 -15
- package/build/components/link-control/link-preview.js.map +1 -1
- package/build/components/link-control/search-input.js +25 -7
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/list-view/block-contents.js +1 -20
- package/build/components/list-view/block-contents.js.map +1 -1
- package/build/components/list-view/block.js +54 -69
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +102 -76
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/index.js +53 -23
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/leaf.js +2 -2
- package/build/components/list-view/leaf.js.map +1 -1
- package/build/components/list-view/list-item.js +3 -2
- package/build/components/list-view/list-item.js.map +1 -1
- package/build/components/list-view/use-list-view-client-ids.js +13 -54
- package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build/components/media-placeholder/index.js +35 -21
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-placeholder/index.native.js +2 -1
- package/build/components/media-placeholder/index.native.js.map +1 -1
- package/build/components/media-replace-flow/index.js +5 -3
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +1 -4
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/observe-typing/index.js +1 -1
- package/build/components/observe-typing/index.js.map +1 -1
- package/build/components/plain-text/index.native.js +30 -1
- package/build/components/plain-text/index.native.js.map +1 -1
- package/build/components/rich-text/embed-handler-picker.native.js +66 -0
- package/build/components/rich-text/embed-handler-picker.native.js.map +1 -0
- package/build/components/rich-text/format-edit.js +28 -2
- package/build/components/rich-text/format-edit.js.map +1 -1
- package/build/components/rich-text/format-toolbar/index.js +32 -11
- package/build/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build/components/rich-text/index.js +29 -7
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +43 -5
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/input-event.js +25 -24
- package/build/components/rich-text/input-event.js.map +1 -1
- package/build/components/rich-text/shortcut.js +23 -9
- package/build/components/rich-text/shortcut.js.map +1 -1
- package/build/components/rich-text/use-input-events.js +27 -0
- package/build/components/rich-text/use-input-events.js.map +1 -0
- package/build/components/rich-text/use-paste-handler.js +45 -10
- package/build/components/rich-text/use-paste-handler.js.map +1 -1
- package/build/components/rich-text/use-shortcuts.js +27 -0
- package/build/components/rich-text/use-shortcuts.js.map +1 -0
- package/build/components/rich-text/utils.js +22 -0
- package/build/components/rich-text/utils.js.map +1 -1
- package/build/components/typewriter/index.js +1 -1
- package/build/components/typewriter/index.js.map +1 -1
- package/build/components/url-input/index.js +25 -11
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-display-block-controls/index.js +5 -7
- package/build/components/use-display-block-controls/index.js.map +1 -1
- package/build/components/use-moving-animation/index.js +13 -10
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/components/use-on-block-drop/index.js +2 -1
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/use-resize-canvas/index.js +2 -13
- package/build/components/use-resize-canvas/index.js.map +1 -1
- package/build/components/use-setting/index.js +49 -14
- package/build/components/use-setting/index.js.map +1 -1
- package/build/components/writing-flow/use-multi-selection.js +6 -0
- package/build/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +18 -3
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/hooks/align.js +14 -14
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/anchor.js +4 -2
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/border-color.js +9 -5
- package/build/hooks/border-color.js.map +1 -1
- package/build/hooks/border.js +5 -5
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color-panel.js +5 -2
- package/build/hooks/color-panel.js.map +1 -1
- package/build/hooks/color.js +6 -4
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/compat.js +23 -0
- package/build/hooks/compat.js.map +1 -0
- package/build/hooks/custom-class-name.js +3 -1
- package/build/hooks/custom-class-name.js.map +1 -1
- package/build/hooks/dimensions.js +63 -28
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/duotone.js +63 -18
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/font-appearance.js +49 -6
- package/build/hooks/font-appearance.js.map +1 -1
- package/build/hooks/font-family.js +123 -32
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +51 -9
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/gap.js +163 -0
- package/build/hooks/gap.js.map +1 -0
- package/build/hooks/index.js +12 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/index.native.js +10 -0
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/layout.js +47 -30
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/letter-spacing.js +45 -8
- package/build/hooks/letter-spacing.js.map +1 -1
- package/build/hooks/line-height.js +45 -8
- package/build/hooks/line-height.js.map +1 -1
- package/build/hooks/lock.js +43 -0
- package/build/hooks/lock.js.map +1 -0
- package/build/hooks/margin.js +6 -3
- package/build/hooks/margin.js.map +1 -1
- package/build/hooks/padding.js +6 -3
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/style.js +39 -11
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/text-decoration.js +42 -6
- package/build/hooks/text-decoration.js.map +1 -1
- package/build/hooks/text-transform.js +42 -6
- package/build/hooks/text-transform.js.map +1 -1
- package/build/hooks/typography.js +109 -9
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/typography.native.js +60 -0
- package/build/hooks/typography.native.js.map +1 -0
- package/build/hooks/use-cached-truthy.js +29 -0
- package/build/hooks/use-cached-truthy.js.map +1 -0
- package/build/index.js +7 -0
- package/build/index.js.map +1 -1
- package/build/layouts/flex.js +215 -11
- package/build/layouts/flex.js.map +1 -1
- package/build/layouts/flow.js +99 -6
- package/build/layouts/flow.js.map +1 -1
- package/build/store/actions.js +331 -266
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +2 -0
- package/build/store/defaults.js.map +1 -1
- package/build/store/defaults.native.js +16 -1
- package/build/store/defaults.native.js.map +1 -1
- package/build/store/index.js +1 -3
- package/build/store/index.js.map +1 -1
- package/build/store/reducer.js +165 -114
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +203 -115
- package/build/store/selectors.js.map +1 -1
- package/build/utils/index.js +10 -1
- package/build/utils/index.js.map +1 -1
- package/build/utils/parse-css-unit-to-px.js +295 -0
- package/build/utils/parse-css-unit-to-px.js.map +1 -0
- package/build/utils/transform-styles/transforms/wrap.js +16 -0
- package/build/utils/transform-styles/transforms/wrap.js.map +1 -1
- package/build-module/components/autocomplete/index.js +2 -2
- package/build-module/components/autocomplete/index.js.map +1 -1
- package/build-module/components/block-actions/index.js +8 -4
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.js +64 -17
- package/build-module/components/block-alignment-control/ui.js.map +1 -1
- package/build-module/components/block-alignment-control/use-available-alignments.js +25 -3
- package/build-module/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build-module/components/block-content-overlay/index.js +2 -4
- package/build-module/components/block-content-overlay/index.js.map +1 -1
- package/build-module/components/block-controls/fill.js +6 -5
- package/build-module/components/block-controls/fill.js.map +1 -1
- package/build-module/components/block-controls/groups.js +3 -1
- package/build-module/components/block-controls/groups.js.map +1 -1
- package/build-module/components/block-controls/hook.js +42 -0
- package/build-module/components/block-controls/hook.js.map +1 -0
- package/build-module/components/block-edit/context.js +4 -4
- package/build-module/components/block-edit/context.js.map +1 -1
- package/build-module/components/block-edit/edit.js +1 -1
- package/build-module/components/block-edit/edit.js.map +1 -1
- package/build-module/components/block-icon/index.js +5 -1
- package/build-module/components/block-icon/index.js.map +1 -1
- package/build-module/components/block-icon/index.native.js +14 -9
- package/build-module/components/block-icon/index.native.js.map +1 -1
- package/build-module/components/block-inspector/index.js +12 -6
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-html.js +5 -0
- package/build-module/components/block-list/block-html.js.map +1 -1
- package/build-module/components/block-list/block-list-item.native.js +30 -12
- package/build-module/components/block-list/block-list-item.native.js.map +1 -1
- package/build-module/components/block-list/block-selection-button.native.js +3 -4
- package/build-module/components/block-list/block-selection-button.native.js.map +1 -1
- package/build-module/components/block-list/block.js +16 -10
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +6 -7
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/grid-item.native.js +57 -0
- package/build-module/components/block-list/grid-item.native.js.map +1 -0
- package/build-module/components/block-list/index.js +17 -14
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-list/index.native.js +13 -9
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +7 -7
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js +5 -7
- package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-block-default-class-name.js +2 -2
- package/build-module/components/block-list/use-block-props/use-block-default-class-name.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-multi-selection.js +21 -6
- package/build-module/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +9 -1
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-list-appender/index.js +9 -1
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-mover/index.js +4 -4
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-mover/index.native.js +4 -4
- package/build-module/components/block-mover/index.native.js.map +1 -1
- package/build-module/components/block-navigation/dropdown.js +0 -1
- package/build-module/components/block-navigation/dropdown.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +1 -6
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-preview/auto.js +40 -16
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-settings/container.native.js +6 -3
- package/build-module/components/block-settings/container.native.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +28 -7
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +10 -3
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-styles/index.js +5 -1
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-styles/preview.native.js +2 -2
- package/build-module/components/block-styles/preview.native.js.map +1 -1
- package/build-module/components/block-switcher/block-styles-menu.js +1 -1
- package/build-module/components/block-switcher/block-styles-menu.js.map +1 -1
- package/build-module/components/block-switcher/index.js +10 -3
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-title/index.js +3 -2
- package/build-module/components/block-title/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +3 -0
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build-module/components/block-tools/block-popover.js +9 -8
- package/build-module/components/block-tools/block-popover.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +2 -4
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/index.js +4 -1
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +96 -8
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-types-list/index.native.js +3 -2
- package/build-module/components/block-types-list/index.native.js.map +1 -1
- package/build-module/components/border-radius-control/index.js.map +1 -1
- package/build-module/components/border-radius-control/utils.js +16 -9
- package/build-module/components/border-radius-control/utils.js.map +1 -1
- package/build-module/components/colors/utils.js +9 -3
- package/build-module/components/colors/utils.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +26 -63
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +84 -7
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/contrast-checker/index.js +13 -10
- package/build-module/components/contrast-checker/index.js.map +1 -1
- package/build-module/components/copy-handler/index.js +9 -3
- package/build-module/components/copy-handler/index.js.map +1 -1
- package/build-module/components/default-block-appender/index.js +2 -2
- package/build-module/components/default-block-appender/index.js.map +1 -1
- package/build-module/components/duotone-control/index.js +43 -39
- package/build-module/components/duotone-control/index.js.map +1 -1
- package/build-module/components/editor-styles/index.js +7 -3
- package/build-module/components/editor-styles/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +40 -12
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/font-sizes/index.native.js +3 -1
- package/build-module/components/font-sizes/index.native.js.map +1 -1
- package/build-module/components/iframe/index.js +47 -65
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.js +115 -0
- package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -0
- package/build-module/components/image-editor/constants.js +7 -0
- package/build-module/components/image-editor/constants.js.map +1 -0
- package/build-module/components/image-editor/context.js +44 -0
- package/build-module/components/image-editor/context.js.map +1 -0
- package/build-module/components/image-editor/cropper.js +69 -0
- package/build-module/components/image-editor/cropper.js.map +1 -0
- package/build-module/components/image-editor/form-controls.js +26 -0
- package/build-module/components/image-editor/form-controls.js.map +1 -0
- package/build-module/components/image-editor/index.js +37 -0
- package/build-module/components/image-editor/index.js.map +1 -0
- package/build-module/components/image-editor/rotation-button.js +26 -0
- package/build-module/components/image-editor/rotation-button.js.map +1 -0
- package/build-module/components/image-editor/use-save-image.js +70 -0
- package/build-module/components/image-editor/use-save-image.js.map +1 -0
- package/build-module/components/image-editor/use-transform-image.js +127 -0
- package/build-module/components/image-editor/use-transform-image.js.map +1 -0
- package/build-module/components/image-editor/zoom-dropdown.js +43 -0
- package/build-module/components/image-editor/zoom-dropdown.js.map +1 -0
- package/build-module/components/image-size-control/use-dimension-handler.js +13 -2
- package/build-module/components/image-size-control/use-dimension-handler.js.map +1 -1
- package/build-module/components/index.js +5 -6
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/index.native.js +2 -3
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/button-block-appender.js +10 -1
- package/build-module/components/inner-blocks/button-block-appender.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +29 -11
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.native.js +41 -5
- package/build-module/components/inner-blocks/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +24 -13
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/explorer.js +50 -0
- package/build-module/components/inserter/block-patterns-explorer/explorer.js.map +1 -0
- package/build-module/components/inserter/block-patterns-explorer/patterns-list.js +92 -0
- package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -0
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js +69 -0
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +1 -0
- package/build-module/components/inserter/block-patterns-tab.js +75 -36
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.native.js +2 -5
- package/build-module/components/inserter/block-types-tab.native.js.map +1 -1
- package/build-module/components/inserter/hooks/use-block-type-impressions.native.js +4 -7
- package/build-module/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
- package/build-module/components/inserter/hooks/use-clipboard-block.native.js +5 -4
- package/build-module/components/inserter/hooks/use-clipboard-block.native.js.map +1 -1
- package/build-module/components/inserter/index.js +12 -4
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js +1 -7
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/library.js +2 -0
- package/build-module/components/inserter/library.js.map +1 -1
- package/build-module/components/inserter/menu.js +2 -1
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/menu.native.js +17 -17
- package/build-module/components/inserter/menu.native.js.map +1 -1
- package/build-module/components/inserter/pattern-panel.js +21 -13
- package/build-module/components/inserter/pattern-panel.js.map +1 -1
- package/build-module/components/inserter/preview-panel.js +1 -1
- package/build-module/components/inserter/preview-panel.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +2 -1
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/reusable-blocks-tab.native.js +4 -5
- package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build-module/components/inserter/search-results.native.js +8 -2
- package/build-module/components/inserter/search-results.native.js.map +1 -1
- package/build-module/components/inserter/tabs.native.js +1 -4
- package/build-module/components/inserter/tabs.native.js.map +1 -1
- package/build-module/components/inserter/utils.native.js +35 -0
- package/build-module/components/inserter/utils.native.js.map +1 -0
- package/build-module/components/inspector-controls/block-support-slot-container.js +18 -0
- package/build-module/components/inspector-controls/block-support-slot-container.js.map +1 -0
- package/build-module/components/inspector-controls/block-support-tools-panel.js +67 -0
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -0
- package/build-module/components/inspector-controls/fill.js +50 -0
- package/build-module/components/inspector-controls/fill.js.map +1 -0
- package/build-module/components/inspector-controls/{index.native.js → fill.native.js} +16 -18
- package/build-module/components/inspector-controls/fill.native.js.map +1 -0
- package/build-module/components/inspector-controls/groups.js +16 -0
- package/build-module/components/inspector-controls/groups.js.map +1 -0
- package/build-module/components/inspector-controls/index.js +16 -17
- package/build-module/components/inspector-controls/index.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js +52 -0
- package/build-module/components/inspector-controls/slot.js.map +1 -0
- package/build-module/components/inspector-controls/slot.native.js +27 -0
- package/build-module/components/inspector-controls/slot.native.js.map +1 -0
- package/build-module/components/letter-spacing-control/index.js +9 -6
- package/build-module/components/letter-spacing-control/index.js.map +1 -1
- package/build-module/components/line-height-control/index.native.js +29 -0
- package/build-module/components/line-height-control/index.native.js.map +1 -0
- package/build-module/components/link-control/index.js +93 -35
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +46 -17
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/link-control/search-input.js +24 -7
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/list-view/block-contents.js +1 -18
- package/build-module/components/list-view/block-contents.js.map +1 -1
- package/build-module/components/list-view/block.js +56 -71
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +102 -78
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/index.js +55 -27
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/leaf.js +2 -2
- package/build-module/components/list-view/leaf.js.map +1 -1
- package/build-module/components/list-view/list-item.js +3 -2
- package/build-module/components/list-view/list-item.js.map +1 -1
- package/build-module/components/list-view/use-list-view-client-ids.js +13 -54
- package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +35 -21
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-placeholder/index.native.js +2 -1
- package/build-module/components/media-placeholder/index.native.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +5 -3
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +1 -4
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/observe-typing/index.js +1 -1
- package/build-module/components/observe-typing/index.js.map +1 -1
- package/build-module/components/plain-text/index.native.js +29 -2
- package/build-module/components/plain-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/embed-handler-picker.native.js +54 -0
- package/build-module/components/rich-text/embed-handler-picker.native.js.map +1 -0
- package/build-module/components/rich-text/format-edit.js +28 -3
- package/build-module/components/rich-text/format-edit.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar/index.js +29 -11
- package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +22 -6
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +43 -6
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/input-event.js +24 -22
- package/build-module/components/rich-text/input-event.js.map +1 -1
- package/build-module/components/rich-text/shortcut.js +22 -9
- package/build-module/components/rich-text/shortcut.js.map +1 -1
- package/build-module/components/rich-text/use-input-events.js +19 -0
- package/build-module/components/rich-text/use-input-events.js.map +1 -0
- package/build-module/components/rich-text/use-paste-handler.js +44 -10
- package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
- package/build-module/components/rich-text/use-shortcuts.js +19 -0
- package/build-module/components/rich-text/use-shortcuts.js.map +1 -0
- package/build-module/components/rich-text/utils.js +20 -0
- package/build-module/components/rich-text/utils.js.map +1 -1
- package/build-module/components/typewriter/index.js +1 -1
- package/build-module/components/typewriter/index.js.map +1 -1
- package/build-module/components/url-input/index.js +25 -11
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-display-block-controls/index.js +5 -7
- package/build-module/components/use-display-block-controls/index.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js +13 -10
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/components/use-on-block-drop/index.js +3 -2
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/use-resize-canvas/index.js +2 -10
- package/build-module/components/use-resize-canvas/index.js.map +1 -1
- package/build-module/components/use-setting/index.js +48 -14
- package/build-module/components/use-setting/index.js.map +1 -1
- package/build-module/components/writing-flow/use-multi-selection.js +6 -0
- package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +18 -3
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/hooks/align.js +15 -15
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/anchor.js +5 -3
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/border-color.js +10 -5
- package/build-module/hooks/border-color.js.map +1 -1
- package/build-module/hooks/border.js +5 -5
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color-panel.js +6 -3
- package/build-module/hooks/color-panel.js.map +1 -1
- package/build-module/hooks/color.js +6 -4
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/compat.js +20 -0
- package/build-module/hooks/compat.js.map +1 -0
- package/build-module/hooks/custom-class-name.js +4 -2
- package/build-module/hooks/custom-class-name.js.map +1 -1
- package/build-module/hooks/dimensions.js +57 -26
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +62 -18
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/font-appearance.js +45 -6
- package/build-module/hooks/font-appearance.js.map +1 -1
- package/build-module/hooks/font-family.js +117 -33
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +47 -9
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/gap.js +140 -0
- package/build-module/hooks/gap.js.map +1 -0
- package/build-module/hooks/index.js +3 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/index.native.js +2 -0
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/hooks/layout.js +47 -30
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/letter-spacing.js +41 -8
- package/build-module/hooks/letter-spacing.js.map +1 -1
- package/build-module/hooks/line-height.js +41 -8
- package/build-module/hooks/line-height.js.map +1 -1
- package/build-module/hooks/lock.js +33 -0
- package/build-module/hooks/lock.js.map +1 -0
- package/build-module/hooks/margin.js +7 -4
- package/build-module/hooks/margin.js.map +1 -1
- package/build-module/hooks/padding.js +7 -4
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/style.js +39 -11
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/text-decoration.js +38 -6
- package/build-module/hooks/text-decoration.js.map +1 -1
- package/build-module/hooks/text-transform.js +38 -6
- package/build-module/hooks/text-transform.js.map +1 -1
- package/build-module/hooks/typography.js +118 -19
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/typography.native.js +41 -0
- package/build-module/hooks/typography.native.js.map +1 -0
- package/build-module/hooks/use-cached-truthy.js +21 -0
- package/build-module/hooks/use-cached-truthy.js.map +1 -0
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/layouts/flex.js +210 -12
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/layouts/flow.js +99 -7
- package/build-module/layouts/flow.js.map +1 -1
- package/build-module/store/actions.js +294 -242
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +2 -0
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/defaults.native.js +15 -1
- package/build-module/store/defaults.native.js.map +1 -1
- package/build-module/store/index.js +1 -2
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/reducer.js +167 -115
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +189 -104
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/index.js +1 -0
- package/build-module/utils/index.js.map +1 -1
- package/build-module/utils/parse-css-unit-to-px.js +285 -0
- package/build-module/utils/parse-css-unit-to-px.js.map +1 -0
- package/build-module/utils/transform-styles/transforms/wrap.js +16 -0
- package/build-module/utils/transform-styles/transforms/wrap.js.map +1 -1
- package/build-style/default-editor-styles-rtl.css +114 -0
- package/build-style/default-editor-styles.css +114 -0
- package/build-style/style-rtl.css +292 -181
- package/build-style/style.css +292 -181
- package/build-types/components/block-context/index.d.ts +1 -1
- package/build-types/components/block-context/index.d.ts.map +1 -1
- package/package.json +28 -27
- package/src/components/autocomplete/index.js +5 -2
- package/src/components/block-actions/index.js +9 -5
- package/src/components/block-alignment-control/style.scss +5 -0
- package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +15 -1
- package/src/components/block-alignment-control/test/index.native.js +37 -0
- package/src/components/block-alignment-control/ui.js +98 -27
- package/src/components/block-alignment-control/use-available-alignments.js +31 -10
- package/src/components/block-content-overlay/index.js +3 -6
- package/src/components/block-content-overlay/style.scss +9 -21
- package/src/components/block-controls/fill.js +7 -4
- package/src/components/block-controls/groups.js +2 -0
- package/src/components/block-controls/hook.js +44 -0
- package/src/components/block-draggable/style.scss +19 -4
- package/src/components/block-edit/context.js +4 -3
- package/src/components/block-edit/edit.js +1 -4
- package/src/components/block-icon/index.js +4 -1
- package/src/components/block-icon/index.native.js +11 -12
- package/src/components/block-inspector/index.js +19 -9
- package/src/components/block-list/block-html.js +5 -0
- package/src/components/block-list/block-list-item.native.js +34 -11
- package/src/components/block-list/block-list-item.native.scss +4 -0
- package/src/components/block-list/block-selection-button.native.js +8 -5
- package/src/components/block-list/block.js +13 -9
- package/src/components/block-list/block.native.js +7 -5
- package/src/components/block-list/grid-item.native.js +58 -0
- package/src/components/block-list/index.js +33 -27
- package/src/components/block-list/index.native.js +10 -4
- package/src/components/block-list/style.native.scss +0 -1
- package/src/components/block-list/style.scss +15 -0
- package/src/components/block-list/use-block-props/index.js +4 -7
- package/src/components/block-list/use-block-props/use-block-custom-class-name.js +5 -7
- package/src/components/block-list/use-block-props/use-block-default-class-name.js +2 -8
- package/src/components/block-list/use-block-props/use-multi-selection.js +30 -4
- package/src/components/block-list/use-in-between-inserter.js +9 -0
- package/src/components/block-list-appender/index.js +8 -0
- package/src/components/block-mover/index.js +4 -4
- package/src/components/block-mover/index.native.js +4 -4
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +10 -6
- package/src/components/block-mover/test/index.native.js +26 -28
- package/src/components/block-navigation/dropdown.js +0 -1
- package/src/components/block-patterns-list/index.js +1 -8
- package/src/components/block-patterns-list/style.scss +22 -12
- package/src/components/block-preview/README.md +1 -1
- package/src/components/block-preview/auto.js +36 -18
- package/src/components/block-preview/style.scss +0 -20
- package/src/components/block-settings/container.native.js +7 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +26 -13
- package/src/components/block-settings-menu-controls/index.js +9 -6
- package/src/components/block-styles/index.js +6 -1
- package/src/components/block-styles/preview.native.js +2 -2
- package/src/components/block-switcher/block-styles-menu.js +1 -1
- package/src/components/block-switcher/index.js +7 -3
- package/src/components/block-switcher/test/__snapshots__/index.js.snap +1 -1
- package/src/components/block-switcher/test/index.js +3 -0
- package/src/components/block-title/index.js +5 -2
- package/src/components/block-toolbar/index.js +4 -0
- package/src/components/block-tools/block-contextual-toolbar.js +7 -5
- package/src/components/block-tools/block-popover.js +8 -8
- package/src/components/block-tools/block-selection-button.js +2 -4
- package/src/components/block-tools/index.js +5 -2
- package/src/components/block-tools/insertion-point.js +97 -9
- package/src/components/block-tools/style.scss +4 -35
- package/src/components/block-types-list/index.native.js +8 -2
- package/src/components/block-types-list/style.scss +0 -3
- package/src/components/block-variation-picker/README.md +47 -14
- package/src/components/block-variation-picker/style.native.scss +4 -0
- package/src/components/border-radius-control/index.js +1 -0
- package/src/components/border-radius-control/test/utils.js +216 -0
- package/src/components/border-radius-control/utils.js +18 -10
- package/src/components/color-palette/test/__snapshots__/control.js.snap +128 -71
- package/src/components/colors/test/utils.js +41 -0
- package/src/components/colors/utils.js +9 -5
- package/src/components/colors-gradients/control.js +70 -110
- package/src/components/colors-gradients/panel-color-gradient-settings.js +79 -7
- package/src/components/colors-gradients/style.scss +10 -18
- package/src/components/colors-gradients/test/control.js +41 -66
- package/src/components/contrast-checker/index.js +14 -10
- package/src/components/copy-handler/index.js +6 -1
- package/src/components/default-block-appender/index.js +2 -2
- package/src/components/default-block-appender/test/__snapshots__/index.js.snap +3 -3
- package/src/components/duotone-control/index.js +49 -41
- package/src/components/duotone-control/style.scss +27 -12
- package/src/components/editor-styles/index.js +8 -4
- package/src/components/font-appearance-control/index.js +62 -24
- package/src/components/font-appearance-control/style.scss +1 -1
- package/src/components/font-sizes/index.native.js +7 -1
- package/src/components/iframe/index.js +64 -75
- package/src/components/image-editor/aspect-ratio-dropdown.js +129 -0
- package/src/components/image-editor/constants.js +6 -0
- package/src/components/image-editor/context.js +56 -0
- package/src/components/image-editor/cropper.js +74 -0
- package/src/components/image-editor/form-controls.js +22 -0
- package/src/components/image-editor/index.js +52 -0
- package/src/components/image-editor/rotation-button.js +24 -0
- package/src/components/image-editor/use-save-image.js +97 -0
- package/src/components/image-editor/use-transform-image.js +162 -0
- package/src/components/image-editor/zoom-dropdown.js +40 -0
- package/src/components/image-size-control/use-dimension-handler.js +18 -1
- package/src/components/index.js +10 -8
- package/src/components/index.native.js +5 -3
- package/src/components/inner-blocks/button-block-appender.js +9 -0
- package/src/components/inner-blocks/index.js +43 -14
- package/src/components/inner-blocks/index.native.js +48 -4
- package/src/components/inner-blocks/use-nested-settings-update.js +26 -11
- package/src/components/inserter/block-patterns-explorer/explorer.js +50 -0
- package/src/components/inserter/block-patterns-explorer/patterns-list.js +122 -0
- package/src/components/inserter/block-patterns-explorer/sidebar.js +73 -0
- package/src/components/inserter/block-patterns-tab.js +107 -73
- package/src/components/inserter/block-types-tab.native.js +3 -6
- package/src/components/inserter/hooks/use-block-type-impressions.native.js +14 -21
- package/src/components/inserter/hooks/use-clipboard-block.native.js +3 -2
- package/src/components/inserter/index.js +15 -3
- package/src/components/inserter/index.native.js +2 -19
- package/src/components/inserter/library.js +2 -0
- package/src/components/inserter/menu.js +4 -1
- package/src/components/inserter/menu.native.js +18 -15
- package/src/components/inserter/pattern-panel.js +33 -16
- package/src/components/inserter/preview-panel.js +1 -1
- package/src/components/inserter/quick-inserter.js +1 -1
- package/src/components/inserter/reusable-blocks-tab.native.js +4 -6
- package/src/components/inserter/search-results.native.js +8 -1
- package/src/components/inserter/style.native.scss +8 -5
- package/src/components/inserter/style.scss +80 -16
- package/src/components/inserter/tabs.native.js +1 -7
- package/src/components/inserter/test/block-types-tab.native.js +3 -2
- package/src/components/inserter/test/fixtures/index.native.js +12 -0
- package/src/components/inserter/utils.native.js +35 -0
- package/src/components/inserter-list-item/style.scss +4 -2
- package/src/components/inspector-controls/README.md +43 -198
- package/src/components/inspector-controls/block-support-slot-container.js +10 -0
- package/src/components/inspector-controls/block-support-tools-panel.js +60 -0
- package/src/components/inspector-controls/fill.js +53 -0
- package/src/components/inspector-controls/{index.native.js → fill.native.js} +14 -14
- package/src/components/inspector-controls/groups.js +22 -0
- package/src/components/inspector-controls/index.js +16 -18
- package/src/components/inspector-controls/slot.js +45 -0
- package/src/components/inspector-controls/slot.native.js +22 -0
- package/src/components/letter-spacing-control/index.js +12 -6
- package/src/components/line-height-control/index.native.js +25 -0
- package/src/components/link-control/README.md +47 -14
- package/src/components/link-control/index.js +102 -31
- package/src/components/link-control/link-preview.js +53 -20
- package/src/components/link-control/search-input.js +21 -7
- package/src/components/link-control/style.scss +66 -19
- package/src/components/link-control/test/index.js +311 -4
- package/src/components/list-view/block-contents.js +17 -38
- package/src/components/list-view/block.js +73 -84
- package/src/components/list-view/branch.js +123 -94
- package/src/components/list-view/index.js +95 -37
- package/src/components/list-view/leaf.js +2 -2
- package/src/components/list-view/list-item.js +5 -4
- package/src/components/list-view/style.scss +70 -33
- package/src/components/list-view/use-list-view-client-ids.js +9 -68
- package/src/components/media-placeholder/README.md +9 -0
- package/src/components/media-placeholder/index.js +31 -20
- package/src/components/media-placeholder/index.native.js +2 -1
- package/src/components/media-placeholder/style.scss +2 -0
- package/src/components/media-replace-flow/README.md +7 -0
- package/src/components/media-replace-flow/index.js +4 -1
- package/src/components/media-replace-flow/style.scss +11 -12
- package/src/components/media-upload/README.md +1 -1
- package/src/components/navigable-toolbar/index.js +1 -4
- package/src/components/observe-typing/index.js +3 -2
- package/src/components/plain-text/index.native.js +26 -4
- package/src/components/rich-text/embed-handler-picker.native.js +68 -0
- package/src/components/rich-text/format-edit.js +36 -2
- package/src/components/rich-text/format-toolbar/index.js +25 -6
- package/src/components/rich-text/index.js +38 -12
- package/src/components/rich-text/index.native.js +37 -4
- package/src/components/rich-text/input-event.js +21 -20
- package/src/components/rich-text/shortcut.js +24 -9
- package/src/components/rich-text/style.scss +7 -5
- package/src/components/rich-text/use-input-events.js +19 -0
- package/src/components/rich-text/use-paste-handler.js +47 -12
- package/src/components/rich-text/use-shortcuts.js +19 -0
- package/src/components/rich-text/utils.js +16 -0
- package/src/components/skip-to-selected-block/README.md +39 -0
- package/src/components/tool-selector/style.scss +5 -5
- package/src/components/typewriter/index.js +3 -2
- package/src/components/url-input/index.js +26 -10
- package/src/components/use-display-block-controls/index.js +7 -10
- package/src/components/use-moving-animation/index.js +9 -8
- package/src/components/use-on-block-drop/index.js +5 -1
- package/src/components/use-resize-canvas/index.js +2 -17
- package/src/components/use-setting/index.js +48 -16
- package/src/components/writing-flow/use-multi-selection.js +6 -0
- package/src/components/writing-flow/use-tab-nav.js +21 -11
- package/src/default-editor-styles.scss +24 -0
- package/src/hooks/align.js +28 -20
- package/src/hooks/anchor.js +5 -5
- package/src/hooks/border-color.js +12 -1
- package/src/hooks/border.js +8 -11
- package/src/hooks/color-panel.js +4 -1
- package/src/hooks/color.js +11 -4
- package/src/hooks/compat.js +23 -0
- package/src/hooks/custom-class-name.js +3 -3
- package/src/hooks/dimensions.js +94 -50
- package/src/hooks/duotone.js +70 -21
- package/src/hooks/font-appearance.js +38 -7
- package/src/hooks/font-family.js +129 -33
- package/src/hooks/font-size.js +42 -6
- package/src/hooks/gap.js +146 -0
- package/src/hooks/index.js +3 -0
- package/src/hooks/index.native.js +2 -0
- package/src/hooks/layout.js +82 -56
- package/src/hooks/layout.scss +8 -0
- package/src/hooks/letter-spacing.js +37 -8
- package/src/hooks/line-height.js +37 -9
- package/src/hooks/lock.js +34 -0
- package/src/hooks/margin.js +13 -3
- package/src/hooks/padding.js +13 -3
- package/src/hooks/style.js +57 -18
- package/src/hooks/test/style.js +4 -0
- package/src/hooks/text-decoration.js +34 -6
- package/src/hooks/text-transform.js +34 -6
- package/src/hooks/typography.js +167 -21
- package/src/hooks/typography.native.js +64 -0
- package/src/hooks/typography.scss +16 -0
- package/src/hooks/use-cached-truthy.js +20 -0
- package/src/index.js +1 -0
- package/src/layouts/flex.js +237 -14
- package/src/layouts/flow.js +81 -14
- package/src/store/actions.js +248 -378
- package/src/store/defaults.js +2 -0
- package/src/store/defaults.native.js +15 -0
- package/src/store/index.js +1 -2
- package/src/store/reducer.js +248 -145
- package/src/store/selectors.js +212 -158
- package/src/store/test/actions.js +407 -705
- package/src/store/test/reducer.js +184 -146
- package/src/store/test/selectors.js +197 -177
- package/src/style.scss +2 -15
- package/src/utils/index.js +1 -0
- package/src/utils/parse-css-unit-to-px.js +272 -0
- package/src/utils/test/parse-css-unit-to-px.js +166 -0
- package/src/utils/transform-styles/transforms/test/wrap.js +1 -1
- package/src/utils/transform-styles/transforms/wrap.js +16 -0
- package/tsconfig.tsbuildinfo +1 -466
- package/build/components/block-list/head.js +0 -27
- package/build/components/block-list/head.js.map +0 -1
- package/build/components/duotone-control/duotone-picker-popover.js +0 -44
- package/build/components/duotone-control/duotone-picker-popover.js.map +0 -1
- package/build/components/inspector-advanced-controls/index.js +0 -46
- package/build/components/inspector-advanced-controls/index.js.map +0 -1
- package/build/components/inspector-controls/index.native.js.map +0 -1
- package/build/components/list-view/block-slot.js +0 -121
- package/build/components/list-view/block-slot.js.map +0 -1
- package/build/components/list-view/editor.js +0 -35
- package/build/components/list-view/editor.js.map +0 -1
- package/build/components/text-decoration-and-transform/index.js +0 -39
- package/build/components/text-decoration-and-transform/index.js.map +0 -1
- package/build/components/use-simulated-media-query/index.js +0 -137
- package/build/components/use-simulated-media-query/index.js.map +0 -1
- package/build/store/controls.js +0 -44
- package/build/store/controls.js.map +0 -1
- package/build-module/components/block-list/head.js +0 -19
- package/build-module/components/block-list/head.js.map +0 -1
- package/build-module/components/duotone-control/duotone-picker-popover.js +0 -35
- package/build-module/components/duotone-control/duotone-picker-popover.js.map +0 -1
- package/build-module/components/inspector-advanced-controls/index.js +0 -36
- package/build-module/components/inspector-advanced-controls/index.js.map +0 -1
- package/build-module/components/inspector-controls/index.native.js.map +0 -1
- package/build-module/components/list-view/block-slot.js +0 -96
- package/build-module/components/list-view/block-slot.js.map +0 -1
- package/build-module/components/list-view/editor.js +0 -25
- package/build-module/components/list-view/editor.js.map +0 -1
- package/build-module/components/text-decoration-and-transform/index.js +0 -30
- package/build-module/components/text-decoration-and-transform/index.js.map +0 -1
- package/build-module/components/use-simulated-media-query/index.js +0 -126
- package/build-module/components/use-simulated-media-query/index.js.map +0 -1
- package/build-module/store/controls.js +0 -32
- package/build-module/store/controls.js.map +0 -1
- package/src/components/block-list/head.js +0 -18
- package/src/components/duotone-control/duotone-picker-popover.js +0 -36
- package/src/components/inspector-advanced-controls/README.md +0 -72
- package/src/components/inspector-advanced-controls/index.js +0 -32
- package/src/components/list-view/block-slot.js +0 -120
- package/src/components/list-view/editor.js +0 -29
- package/src/components/text-decoration-and-transform/index.js +0 -36
- package/src/components/text-decoration-and-transform/style.scss +0 -3
- package/src/components/use-simulated-media-query/index.js +0 -144
- package/src/store/controls.js +0 -39
|
@@ -7,15 +7,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.FontFamilyEdit = FontFamilyEdit;
|
|
9
9
|
exports.useIsFontFamilyDisabled = useIsFontFamilyDisabled;
|
|
10
|
+
exports.hasFontFamilyValue = hasFontFamilyValue;
|
|
11
|
+
exports.resetFontFamily = resetFontFamily;
|
|
10
12
|
exports.FONT_FAMILY_SUPPORT_KEY = void 0;
|
|
11
13
|
|
|
12
14
|
var _element = require("@wordpress/element");
|
|
13
15
|
|
|
14
16
|
var _lodash = require("lodash");
|
|
15
17
|
|
|
18
|
+
var _hooks = require("@wordpress/hooks");
|
|
19
|
+
|
|
16
20
|
var _blocks = require("@wordpress/blocks");
|
|
17
21
|
|
|
18
|
-
var
|
|
22
|
+
var _tokenList = _interopRequireDefault(require("@wordpress/token-list"));
|
|
19
23
|
|
|
20
24
|
var _useSetting = _interopRequireDefault(require("../components/use-setting"));
|
|
21
25
|
|
|
@@ -33,56 +37,111 @@ var _fontFamily = _interopRequireDefault(require("../components/font-family"));
|
|
|
33
37
|
* Internal dependencies
|
|
34
38
|
*/
|
|
35
39
|
const FONT_FAMILY_SUPPORT_KEY = 'typography.__experimentalFontFamily';
|
|
40
|
+
/**
|
|
41
|
+
* Filters registered block settings, extending attributes to include
|
|
42
|
+
* the `fontFamily` attribute.
|
|
43
|
+
*
|
|
44
|
+
* @param {Object} settings Original block settings
|
|
45
|
+
* @return {Object} Filtered block settings
|
|
46
|
+
*/
|
|
47
|
+
|
|
36
48
|
exports.FONT_FAMILY_SUPPORT_KEY = FONT_FAMILY_SUPPORT_KEY;
|
|
37
49
|
|
|
38
|
-
|
|
39
|
-
|
|
50
|
+
function addAttributes(settings) {
|
|
51
|
+
if (!(0, _blocks.hasBlockSupport)(settings, FONT_FAMILY_SUPPORT_KEY)) {
|
|
52
|
+
return settings;
|
|
53
|
+
} // Allow blocks to specify a default value if needed.
|
|
54
|
+
|
|
40
55
|
|
|
41
|
-
if (
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
56
|
+
if (!settings.attributes.fontFamily) {
|
|
57
|
+
Object.assign(settings.attributes, {
|
|
58
|
+
fontFamily: {
|
|
59
|
+
type: 'string'
|
|
60
|
+
}
|
|
46
61
|
});
|
|
62
|
+
}
|
|
47
63
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
64
|
+
return settings;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Override props assigned to save component to inject font family.
|
|
68
|
+
*
|
|
69
|
+
* @param {Object} props Additional props applied to save element
|
|
70
|
+
* @param {Object} blockType Block type
|
|
71
|
+
* @param {Object} attributes Block attributes
|
|
72
|
+
* @return {Object} Filtered props applied to save element
|
|
73
|
+
*/
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
function addSaveProps(props, blockType, attributes) {
|
|
77
|
+
if (!(0, _blocks.hasBlockSupport)(blockType, FONT_FAMILY_SUPPORT_KEY)) {
|
|
78
|
+
return props;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if ((0, _blocks.hasBlockSupport)(blockType, 'typography.__experimentalSkipSerialization')) {
|
|
82
|
+
return props;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (!(attributes !== null && attributes !== void 0 && attributes.fontFamily)) {
|
|
86
|
+
return props;
|
|
87
|
+
} // Use TokenList to dedupe classes.
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
const classes = new _tokenList.default(props.className);
|
|
91
|
+
classes.add(`has-${(0, _lodash.kebabCase)(attributes === null || attributes === void 0 ? void 0 : attributes.fontFamily)}-font-family`);
|
|
92
|
+
const newClassName = classes.value;
|
|
93
|
+
props.className = newClassName ? newClassName : undefined;
|
|
94
|
+
return props;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Filters registered block settings to expand the block edit wrapper
|
|
98
|
+
* by applying the desired styles and classnames.
|
|
99
|
+
*
|
|
100
|
+
* @param {Object} settings Original block settings.
|
|
101
|
+
*
|
|
102
|
+
* @return {Object} Filtered block settings.
|
|
103
|
+
*/
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
function addEditProps(settings) {
|
|
107
|
+
if (!(0, _blocks.hasBlockSupport)(settings, FONT_FAMILY_SUPPORT_KEY)) {
|
|
108
|
+
return settings;
|
|
51
109
|
}
|
|
52
110
|
|
|
53
|
-
|
|
54
|
-
|
|
111
|
+
const existingGetEditWrapperProps = settings.getEditWrapperProps;
|
|
112
|
+
|
|
113
|
+
settings.getEditWrapperProps = attributes => {
|
|
114
|
+
let props = {};
|
|
115
|
+
|
|
116
|
+
if (existingGetEditWrapperProps) {
|
|
117
|
+
props = existingGetEditWrapperProps(attributes);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return addSaveProps(props, settings, attributes);
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
return settings;
|
|
124
|
+
}
|
|
55
125
|
|
|
56
126
|
function FontFamilyEdit({
|
|
57
|
-
name,
|
|
58
127
|
setAttributes,
|
|
59
128
|
attributes: {
|
|
60
|
-
|
|
129
|
+
fontFamily
|
|
61
130
|
}
|
|
62
131
|
}) {
|
|
63
|
-
var
|
|
132
|
+
var _find;
|
|
64
133
|
|
|
65
134
|
const fontFamilies = (0, _useSetting.default)('typography.fontFamilies');
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
if (isDisable) {
|
|
71
|
-
return null;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const value = getFontFamilyFromAttributeValue(fontFamilies, (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.fontFamily);
|
|
135
|
+
const value = (_find = (0, _lodash.find)(fontFamilies, ({
|
|
136
|
+
slug
|
|
137
|
+
}) => fontFamily === slug)) === null || _find === void 0 ? void 0 : _find.fontFamily;
|
|
75
138
|
|
|
76
139
|
function onChange(newValue) {
|
|
77
140
|
const predefinedFontFamily = (0, _lodash.find)(fontFamilies, ({
|
|
78
|
-
fontFamily
|
|
79
|
-
}) =>
|
|
141
|
+
fontFamily: f
|
|
142
|
+
}) => f === newValue);
|
|
80
143
|
setAttributes({
|
|
81
|
-
|
|
82
|
-
typography: { ...(style.typography || {}),
|
|
83
|
-
fontFamily: predefinedFontFamily ? `var:preset|font-family|${predefinedFontFamily.slug}` : newValue || undefined
|
|
84
|
-
}
|
|
85
|
-
})
|
|
144
|
+
fontFamily: predefinedFontFamily === null || predefinedFontFamily === void 0 ? void 0 : predefinedFontFamily.slug
|
|
86
145
|
});
|
|
87
146
|
}
|
|
88
147
|
|
|
@@ -107,4 +166,36 @@ function useIsFontFamilyDisabled({
|
|
|
107
166
|
const fontFamilies = (0, _useSetting.default)('typography.fontFamilies');
|
|
108
167
|
return !fontFamilies || fontFamilies.length === 0 || !(0, _blocks.hasBlockSupport)(name, FONT_FAMILY_SUPPORT_KEY);
|
|
109
168
|
}
|
|
169
|
+
/**
|
|
170
|
+
* Checks if there is a current value set for the font family block support.
|
|
171
|
+
*
|
|
172
|
+
* @param {Object} props Block props.
|
|
173
|
+
* @return {boolean} Whether or not the block has a font family value set.
|
|
174
|
+
*/
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
function hasFontFamilyValue(props) {
|
|
178
|
+
return !!props.attributes.fontFamily;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Resets the font family block support attribute. This can be used when
|
|
182
|
+
* disabling the font family support controls for a block via a progressive
|
|
183
|
+
* discovery panel.
|
|
184
|
+
*
|
|
185
|
+
* @param {Object} props Block props.
|
|
186
|
+
* @param {Object} props.setAttributes Function to set block's attributes.
|
|
187
|
+
*/
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
function resetFontFamily({
|
|
191
|
+
setAttributes
|
|
192
|
+
}) {
|
|
193
|
+
setAttributes({
|
|
194
|
+
fontFamily: undefined
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
(0, _hooks.addFilter)('blocks.registerBlockType', 'core/fontFamily/addAttribute', addAttributes);
|
|
199
|
+
(0, _hooks.addFilter)('blocks.getSaveContent.extraProps', 'core/fontFamily/addSaveProps', addSaveProps);
|
|
200
|
+
(0, _hooks.addFilter)('blocks.registerBlockType', 'core/fontFamily/addEditProps', addEditProps);
|
|
110
201
|
//# sourceMappingURL=font-family.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/hooks/font-family.js"],"names":["FONT_FAMILY_SUPPORT_KEY","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/hooks/font-family.js"],"names":["FONT_FAMILY_SUPPORT_KEY","addAttributes","settings","attributes","fontFamily","Object","assign","type","addSaveProps","props","blockType","classes","TokenList","className","add","newClassName","value","undefined","addEditProps","existingGetEditWrapperProps","getEditWrapperProps","FontFamilyEdit","setAttributes","fontFamilies","slug","onChange","newValue","predefinedFontFamily","f","useIsFontFamilyDisabled","name","length","hasFontFamilyValue","resetFontFamily"],"mappings":";;;;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAKA;;AACA;;AAhBA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;AAIO,MAAMA,uBAAuB,GAAG,qCAAhC;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACA,SAASC,aAAT,CAAwBC,QAAxB,EAAmC;AAClC,MAAK,CAAE,6BAAiBA,QAAjB,EAA2BF,uBAA3B,CAAP,EAA8D;AAC7D,WAAOE,QAAP;AACA,GAHiC,CAKlC;;;AACA,MAAK,CAAEA,QAAQ,CAACC,UAAT,CAAoBC,UAA3B,EAAwC;AACvCC,IAAAA,MAAM,CAACC,MAAP,CAAeJ,QAAQ,CAACC,UAAxB,EAAoC;AACnCC,MAAAA,UAAU,EAAE;AACXG,QAAAA,IAAI,EAAE;AADK;AADuB,KAApC;AAKA;;AAED,SAAOL,QAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASM,YAAT,CAAuBC,KAAvB,EAA8BC,SAA9B,EAA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UAAU,EAAEa;AAAd,GAAF,CAAb;AACA;;AAED,sBACC,0BADD,EAEC,8BAFD,EAGChB,aAHD;AAMA,sBACC,kCADD,EAEC,8BAFD,EAGCO,YAHD;AAMA,sBACC,0BADD,EAEC,8BAFD,EAGCU,YAHD","sourcesContent":["/**\n * External dependencies\n */\nimport { find, kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport TokenList from '@wordpress/token-list';\n\n/**\n * Internal dependencies\n */\nimport useSetting from '../components/use-setting';\nimport FontFamilyControl from '../components/font-family';\n\nexport const FONT_FAMILY_SUPPORT_KEY = 'typography.__experimentalFontFamily';\n\n/**\n * Filters registered block settings, extending attributes to include\n * the `fontFamily` attribute.\n *\n * @param {Object} settings Original block settings\n * @return {Object} Filtered block settings\n */\nfunction addAttributes( settings ) {\n\tif ( ! hasBlockSupport( settings, FONT_FAMILY_SUPPORT_KEY ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify a default value if needed.\n\tif ( ! settings.attributes.fontFamily ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tfontFamily: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override props assigned to save component to inject font family.\n *\n * @param {Object} props Additional props applied to save element\n * @param {Object} blockType Block type\n * @param {Object} attributes Block attributes\n * @return {Object} Filtered props applied to save element\n */\nfunction addSaveProps( props, blockType, attributes ) {\n\tif ( ! hasBlockSupport( blockType, FONT_FAMILY_SUPPORT_KEY ) ) {\n\t\treturn props;\n\t}\n\n\tif (\n\t\thasBlockSupport(\n\t\t\tblockType,\n\t\t\t'typography.__experimentalSkipSerialization'\n\t\t)\n\t) {\n\t\treturn props;\n\t}\n\n\tif ( ! attributes?.fontFamily ) {\n\t\treturn props;\n\t}\n\n\t// Use TokenList to dedupe classes.\n\tconst classes = new TokenList( props.className );\n\tclasses.add( `has-${ kebabCase( attributes?.fontFamily ) }-font-family` );\n\tconst newClassName = classes.value;\n\tprops.className = newClassName ? newClassName : undefined;\n\n\treturn props;\n}\n\n/**\n * Filters registered block settings to expand the block edit wrapper\n * by applying the desired styles and classnames.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addEditProps( settings ) {\n\tif ( ! hasBlockSupport( settings, FONT_FAMILY_SUPPORT_KEY ) ) {\n\t\treturn settings;\n\t}\n\n\tconst existingGetEditWrapperProps = settings.getEditWrapperProps;\n\tsettings.getEditWrapperProps = ( attributes ) => {\n\t\tlet props = {};\n\t\tif ( existingGetEditWrapperProps ) {\n\t\t\tprops = existingGetEditWrapperProps( attributes );\n\t\t}\n\t\treturn addSaveProps( props, settings, attributes );\n\t};\n\n\treturn settings;\n}\n\nexport function FontFamilyEdit( {\n\tsetAttributes,\n\tattributes: { fontFamily },\n} ) {\n\tconst fontFamilies = useSetting( 'typography.fontFamilies' );\n\n\tconst value = find( fontFamilies, ( { slug } ) => fontFamily === slug )\n\t\t?.fontFamily;\n\n\tfunction onChange( newValue ) {\n\t\tconst predefinedFontFamily = find(\n\t\t\tfontFamilies,\n\t\t\t( { fontFamily: f } ) => f === newValue\n\t\t);\n\t\tsetAttributes( {\n\t\t\tfontFamily: predefinedFontFamily?.slug,\n\t\t} );\n\t}\n\n\treturn (\n\t\t<FontFamilyControl\n\t\t\tclassName=\"block-editor-hooks-font-family-control\"\n\t\t\tfontFamilies={ fontFamilies }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t/>\n\t);\n}\n\n/**\n * Custom hook that checks if font-family functionality is disabled.\n *\n * @param {string} name The name of the block.\n * @return {boolean} Whether setting is disabled.\n */\nexport function useIsFontFamilyDisabled( { name } ) {\n\tconst fontFamilies = useSetting( 'typography.fontFamilies' );\n\treturn (\n\t\t! fontFamilies ||\n\t\tfontFamilies.length === 0 ||\n\t\t! hasBlockSupport( name, FONT_FAMILY_SUPPORT_KEY )\n\t);\n}\n\n/**\n * Checks if there is a current value set for the font family block support.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a font family value set.\n */\nexport function hasFontFamilyValue( props ) {\n\treturn !! props.attributes.fontFamily;\n}\n\n/**\n * Resets the font family block support attribute. This can be used when\n * disabling the font family support controls for a block via a progressive\n * discovery panel.\n *\n * @param {Object} props Block props.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetFontFamily( { setAttributes } ) {\n\tsetAttributes( { fontFamily: undefined } );\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/fontFamily/addAttribute',\n\taddAttributes\n);\n\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/fontFamily/addSaveProps',\n\taddSaveProps\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/fontFamily/addEditProps',\n\taddEditProps\n);\n"]}
|
package/build/hooks/font-size.js
CHANGED
|
@@ -6,6 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.FontSizeEdit = FontSizeEdit;
|
|
9
|
+
exports.hasFontSizeValue = hasFontSizeValue;
|
|
10
|
+
exports.resetFontSize = resetFontSize;
|
|
9
11
|
exports.useIsFontSizeDisabled = useIsFontSizeDisabled;
|
|
10
12
|
exports.FONT_SIZE_SUPPORT_KEY = void 0;
|
|
11
13
|
|
|
@@ -135,7 +137,6 @@ function FontSizeEdit(props) {
|
|
|
135
137
|
},
|
|
136
138
|
setAttributes
|
|
137
139
|
} = props;
|
|
138
|
-
const isDisabled = useIsFontSizeDisabled(props);
|
|
139
140
|
const fontSizes = (0, _useSetting.default)('typography.fontSizes');
|
|
140
141
|
|
|
141
142
|
const onChange = value => {
|
|
@@ -150,15 +151,56 @@ function FontSizeEdit(props) {
|
|
|
150
151
|
});
|
|
151
152
|
};
|
|
152
153
|
|
|
153
|
-
if (isDisabled) {
|
|
154
|
-
return null;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
154
|
const fontSizeObject = (0, _fontSizes.getFontSize)(fontSizes, fontSize, style === null || style === void 0 ? void 0 : (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.fontSize);
|
|
158
155
|
const fontSizeValue = (fontSizeObject === null || fontSizeObject === void 0 ? void 0 : fontSizeObject.size) || (style === null || style === void 0 ? void 0 : (_style$typography2 = style.typography) === null || _style$typography2 === void 0 ? void 0 : _style$typography2.fontSize) || fontSize;
|
|
159
156
|
return (0, _element.createElement)(_fontSizes.FontSizePicker, {
|
|
160
157
|
onChange: onChange,
|
|
161
|
-
value: fontSizeValue
|
|
158
|
+
value: fontSizeValue,
|
|
159
|
+
withReset: false
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Checks if there is a current value set for the font size block support.
|
|
164
|
+
*
|
|
165
|
+
* @param {Object} props Block props.
|
|
166
|
+
* @return {boolean} Whether or not the block has a font size value set.
|
|
167
|
+
*/
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
function hasFontSizeValue(props) {
|
|
171
|
+
var _style$typography3;
|
|
172
|
+
|
|
173
|
+
const {
|
|
174
|
+
fontSize,
|
|
175
|
+
style
|
|
176
|
+
} = props.attributes;
|
|
177
|
+
return !!fontSize || !!(style !== null && style !== void 0 && (_style$typography3 = style.typography) !== null && _style$typography3 !== void 0 && _style$typography3.fontSize);
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Resets the font size block support attribute. This can be used when
|
|
181
|
+
* disabling the font size support controls for a block via a progressive
|
|
182
|
+
* discovery panel.
|
|
183
|
+
*
|
|
184
|
+
* @param {Object} props Block props.
|
|
185
|
+
* @param {Object} props.attributes Block's attributes.
|
|
186
|
+
* @param {Object} props.setAttributes Function to set block's attributes.
|
|
187
|
+
*/
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
function resetFontSize({
|
|
191
|
+
attributes = {},
|
|
192
|
+
setAttributes
|
|
193
|
+
}) {
|
|
194
|
+
const {
|
|
195
|
+
style
|
|
196
|
+
} = attributes;
|
|
197
|
+
setAttributes({
|
|
198
|
+
fontSize: undefined,
|
|
199
|
+
style: (0, _utils.cleanEmptyObject)({ ...style,
|
|
200
|
+
typography: { ...(style === null || style === void 0 ? void 0 : style.typography),
|
|
201
|
+
fontSize: undefined
|
|
202
|
+
}
|
|
203
|
+
})
|
|
162
204
|
});
|
|
163
205
|
}
|
|
164
206
|
/**
|
|
@@ -188,7 +230,7 @@ function useIsFontSizeDisabled({
|
|
|
188
230
|
|
|
189
231
|
|
|
190
232
|
const withFontSizeInlineStyles = (0, _compose.createHigherOrderComponent)(BlockListBlock => props => {
|
|
191
|
-
var _style$
|
|
233
|
+
var _style$typography4, _style$typography5;
|
|
192
234
|
|
|
193
235
|
const fontSizes = (0, _useSetting.default)('typography.fontSizes');
|
|
194
236
|
const {
|
|
@@ -203,11 +245,11 @@ const withFontSizeInlineStyles = (0, _compose.createHigherOrderComponent)(BlockL
|
|
|
203
245
|
// doesn't already have an inline font size,
|
|
204
246
|
// and does have a class to extract the font size from.
|
|
205
247
|
|
|
206
|
-
if (!(0, _blocks.hasBlockSupport)(blockName, FONT_SIZE_SUPPORT_KEY) || (0, _blocks.hasBlockSupport)(blockName, 'typography.__experimentalSkipSerialization') || !fontSize || style !== null && style !== void 0 && (_style$
|
|
248
|
+
if (!(0, _blocks.hasBlockSupport)(blockName, FONT_SIZE_SUPPORT_KEY) || (0, _blocks.hasBlockSupport)(blockName, 'typography.__experimentalSkipSerialization') || !fontSize || style !== null && style !== void 0 && (_style$typography4 = style.typography) !== null && _style$typography4 !== void 0 && _style$typography4.fontSize) {
|
|
207
249
|
return (0, _element.createElement)(BlockListBlock, props);
|
|
208
250
|
}
|
|
209
251
|
|
|
210
|
-
const fontSizeValue = (0, _fontSizes.getFontSize)(fontSizes, fontSize, style === null || style === void 0 ? void 0 : (_style$
|
|
252
|
+
const fontSizeValue = (0, _fontSizes.getFontSize)(fontSizes, fontSize, style === null || style === void 0 ? void 0 : (_style$typography5 = style.typography) === null || _style$typography5 === void 0 ? void 0 : _style$typography5.fontSize).size;
|
|
211
253
|
const newProps = { ...props,
|
|
212
254
|
wrapperProps: { ...wrapperProps,
|
|
213
255
|
style: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/hooks/font-size.js"],"names":["FONT_SIZE_SUPPORT_KEY","addAttributes","settings","attributes","fontSize","Object","assign","type","addSaveProps","props","blockType","classes","TokenList","className","add","newClassName","value","undefined","addEditProps","existingGetEditWrapperProps","getEditWrapperProps","FontSizeEdit","style","setAttributes","isDisabled","useIsFontSizeDisabled","fontSizes","onChange","fontSizeSlug","slug","typography","fontSizeObject","fontSizeValue","size","name","blockName","hasFontSizes","length","withFontSizeInlineStyles","BlockListBlock","wrapperProps","newProps"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AAMA;;AACA;;AAlBA;AACA;AACA;;AAMA;AACA;AACA;AAUO,MAAMA,qBAAqB,GAAG,qBAA9B;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACA,SAASC,aAAT,CAAwBC,QAAxB,EAAmC;AAClC,MAAK,CAAE,6BAAiBA,QAAjB,EAA2BF,qBAA3B,CAAP,EAA4D;AAC3D,WAAOE,QAAP;AACA,GAHiC,CAKlC;;;AACA,MAAK,CAAEA,QAAQ,CAACC,UAAT,CAAoBC,QAA3B,EAAsC;AACrCC,IAAAA,MAAM,CAACC,MAAP,CAAeJ,QAAQ,CAACC,UAAxB,EAAoC;AACnCC,MAAAA,QAAQ,EAAE;AACTG,QAAAA,IAAI,EAAE;AADG;AADyB,KAApC;AAKA;;AAED,SAAOL,QAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASM,YAAT,CAAuBC,KAAvB,EAA8BC,SAA9B,EAAyCP,UAAzC,EAAsD;AACrD,MAAK,CAAE,6BAAiBO,SAAj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,YAHD;AAMA,sBAAW,0BAAX,EAAuC,wBAAvC,EAAiEU,YAAjE;AAEA,sBACC,uBADD,EAEC,6CAFD,EAGCoB,wBAHD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport TokenList from '@wordpress/token-list';\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetFontSize,\n\tgetFontSizeClass,\n\tgetFontSizeObjectByValue,\n\tFontSizePicker,\n} from '../components/font-sizes';\nimport { cleanEmptyObject } from './utils';\nimport useSetting from '../components/use-setting';\n\nexport const FONT_SIZE_SUPPORT_KEY = 'typography.fontSize';\n\n/**\n * Filters registered block settings, extending attributes to include\n * `fontSize` and `fontWeight` attributes.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addAttributes( settings ) {\n\tif ( ! hasBlockSupport( settings, FONT_SIZE_SUPPORT_KEY ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify a default value if needed.\n\tif ( ! settings.attributes.fontSize ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tfontSize: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override props assigned to save component to inject font size.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nfunction addSaveProps( props, blockType, attributes ) {\n\tif ( ! hasBlockSupport( blockType, FONT_SIZE_SUPPORT_KEY ) ) {\n\t\treturn props;\n\t}\n\n\tif (\n\t\thasBlockSupport(\n\t\t\tblockType,\n\t\t\t'typography.__experimentalSkipSerialization'\n\t\t)\n\t) {\n\t\treturn props;\n\t}\n\n\t// Use TokenList to dedupe classes.\n\tconst classes = new TokenList( props.className );\n\tclasses.add( getFontSizeClass( attributes.fontSize ) );\n\tconst newClassName = classes.value;\n\tprops.className = newClassName ? newClassName : undefined;\n\n\treturn props;\n}\n\n/**\n * Filters registered block settings to expand the block edit wrapper\n * by applying the desired styles and classnames.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addEditProps( settings ) {\n\tif ( ! hasBlockSupport( settings, FONT_SIZE_SUPPORT_KEY ) ) {\n\t\treturn settings;\n\t}\n\n\tconst existingGetEditWrapperProps = settings.getEditWrapperProps;\n\tsettings.getEditWrapperProps = ( attributes ) => {\n\t\tlet props = {};\n\t\tif ( existingGetEditWrapperProps ) {\n\t\t\tprops = existingGetEditWrapperProps( attributes );\n\t\t}\n\t\treturn addSaveProps( props, settings, attributes );\n\t};\n\n\treturn settings;\n}\n\n/**\n * Inspector control panel containing the font size related configuration\n *\n * @param {Object} props\n *\n * @return {WPElement} Font size edit element.\n */\nexport function FontSizeEdit( props ) {\n\tconst {\n\t\tattributes: { fontSize, style },\n\t\tsetAttributes,\n\t} = props;\n\tconst isDisabled = useIsFontSizeDisabled( props );\n\tconst fontSizes = useSetting( 'typography.fontSizes' );\n\n\tconst onChange = ( value ) => {\n\t\tconst fontSizeSlug = getFontSizeObjectByValue( fontSizes, value ).slug;\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t...style,\n\t\t\t\ttypography: {\n\t\t\t\t\t...style?.typography,\n\t\t\t\t\tfontSize: fontSizeSlug ? undefined : value,\n\t\t\t\t},\n\t\t\t} ),\n\t\t\tfontSize: fontSizeSlug,\n\t\t} );\n\t};\n\n\tif ( isDisabled ) {\n\t\treturn null;\n\t}\n\n\tconst fontSizeObject = getFontSize(\n\t\tfontSizes,\n\t\tfontSize,\n\t\tstyle?.typography?.fontSize\n\t);\n\n\tconst fontSizeValue =\n\t\tfontSizeObject?.size || style?.typography?.fontSize || fontSize;\n\n\treturn <FontSizePicker onChange={ onChange } value={ fontSizeValue } />;\n}\n\n/**\n * Custom hook that checks if font-size settings have been disabled.\n *\n * @param {string} name The name of the block.\n * @return {boolean} Whether setting is disabled.\n */\nexport function useIsFontSizeDisabled( { name: blockName } = {} ) {\n\tconst fontSizes = useSetting( 'typography.fontSizes' );\n\tconst hasFontSizes = !! fontSizes?.length;\n\n\treturn (\n\t\t! hasBlockSupport( blockName, FONT_SIZE_SUPPORT_KEY ) || ! hasFontSizes\n\t);\n}\n\n/**\n * Add inline styles for font sizes.\n * Ideally, this is not needed and themes load the font-size classes on the\n * editor.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nconst withFontSizeInlineStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst fontSizes = useSetting( 'typography.fontSizes' );\n\t\tconst {\n\t\t\tname: blockName,\n\t\t\tattributes: { fontSize, style },\n\t\t\twrapperProps,\n\t\t} = props;\n\n\t\t// Only add inline styles if the block supports font sizes,\n\t\t// doesn't skip serialization of font sizes,\n\t\t// doesn't already have an inline font size,\n\t\t// and does have a class to extract the font size from.\n\t\tif (\n\t\t\t! hasBlockSupport( blockName, FONT_SIZE_SUPPORT_KEY ) ||\n\t\t\thasBlockSupport(\n\t\t\t\tblockName,\n\t\t\t\t'typography.__experimentalSkipSerialization'\n\t\t\t) ||\n\t\t\t! fontSize ||\n\t\t\tstyle?.typography?.fontSize\n\t\t) {\n\t\t\treturn <BlockListBlock { ...props } />;\n\t\t}\n\n\t\tconst fontSizeValue = getFontSize(\n\t\t\tfontSizes,\n\t\t\tfontSize,\n\t\t\tstyle?.typography?.fontSize\n\t\t).size;\n\n\t\tconst newProps = {\n\t\t\t...props,\n\t\t\twrapperProps: {\n\t\t\t\t...wrapperProps,\n\t\t\t\tstyle: {\n\t\t\t\t\tfontSize: fontSizeValue,\n\t\t\t\t\t...wrapperProps?.style,\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\n\t\treturn <BlockListBlock { ...newProps } />;\n\t},\n\t'withFontSizeInlineStyles'\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/font/addAttribute',\n\taddAttributes\n);\n\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/font/addSaveProps',\n\taddSaveProps\n);\n\naddFilter( 'blocks.registerBlockType', 'core/font/addEditProps', addEditProps );\n\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/font-size/with-font-size-inline-styles',\n\twithFontSizeInlineStyles\n);\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/hooks/font-size.js"],"names":["FONT_SIZE_SUPPORT_KEY","addAttributes","settings","attributes","fontSize","Object","assign","type","addSaveProps","props","blockType","classes","TokenList","className","add","newClassName","value","undefined","addEditProps","existingGetEditWrapperProps","getEditWrapperProps","FontSizeEdit","style","setAttributes","fontSizes","onChange","fontSizeSlug","slug","typography","fontSizeObject","fontSizeValue","size","hasFontSizeValue","resetFontSize","useIsFontSizeDisabled","name","blockName","hasFontSizes","length","withFontSizeInlineStyles","BlockListBlock","wrapperProps","newProps"],"mappings":";;;;;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AAMA;;AACA;;AAlBA;AACA;AACA;;AAMA;AACA;AACA;AAUO,MAAMA,qBAAqB,GAAG,qBAA9B;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACA,SAASC,aAAT,CAAwBC,QAAxB,EAAmC;AAClC,MAAK,CAAE,6BAAiBA,QAAjB,EAA2BF,qBAA3B,CAAP,EAA4D;AAC3D,WAAOE,QAAP;AACA,GAHiC,CAKlC;;;AACA,MAAK,CAAEA,QAAQ,CAACC,UAAT,CAAoBC,QAA3B,EAAsC;AACrCC,IAAAA,MAAM,CAACC,MAAP,CAAeJ,QAAQ,CAACC,UAAxB,EAAoC;AACnCC,MAAAA,QAAQ,EAAE;AACTG,QAAAA,IAAI,EAAE;AADG;AADyB,KAApC;AAKA;;AAED,SAAOL,QAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASM,Y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5B,CAAF,IACA,6BACCoC,SADD,EAEC,4CAFD,CADA,IAKA,CAAEhC,QALF,IAMAkB,KANA,aAMAA,KANA,qCAMAA,KAAK,CAAEM,UANP,+CAMA,mBAAmBxB,QAPpB,EAQE;AACD,WAAO,4BAAC,cAAD,EAAqBK,KAArB,CAAP;AACA;;AAED,QAAMqB,aAAa,GAAG,4BACrBN,SADqB,EAErBpB,QAFqB,EAGrBkB,KAHqB,aAGrBA,KAHqB,6CAGrBA,KAAK,CAAEM,UAHc,uDAGrB,mBAAmBxB,QAHE,EAIpB2B,IAJF;AAMA,QAAMW,QAAQ,GAAG,EAChB,GAAGjC,KADa;AAEhBgC,IAAAA,YAAY,EAAE,EACb,GAAGA,YADU;AAEbnB,MAAAA,KAAK,EAAE;AACNlB,QAAAA,QAAQ,EAAE0B,aADJ;AAEN,YAAGW,YAAH,aAAGA,YAAH,uBAAGA,YAAY,CAAEnB,KAAjB;AAFM;AAFM;AAFE,GAAjB;AAWA,SAAO,4BAAC,cAAD,EAAqBoB,QAArB,CAAP;AACA,CA3C+B,EA4ChC,0BA5CgC,CAAjC;AA+CA,sBACC,0BADD,EAEC,wBAFD,EAGCzC,aAHD;AAMA,sBACC,kCADD,EAEC,wBAFD,EAGCO,YAHD;AAMA,sBAAW,0BAAX,EAAuC,wBAAvC,EAAiEU,YAAjE;AAEA,sBACC,uBADD,EAEC,6CAFD,EAGCqB,wBAHD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport TokenList from '@wordpress/token-list';\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetFontSize,\n\tgetFontSizeClass,\n\tgetFontSizeObjectByValue,\n\tFontSizePicker,\n} from '../components/font-sizes';\nimport { cleanEmptyObject } from './utils';\nimport useSetting from '../components/use-setting';\n\nexport const FONT_SIZE_SUPPORT_KEY = 'typography.fontSize';\n\n/**\n * Filters registered block settings, extending attributes to include\n * `fontSize` and `fontWeight` attributes.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addAttributes( settings ) {\n\tif ( ! hasBlockSupport( settings, FONT_SIZE_SUPPORT_KEY ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify a default value if needed.\n\tif ( ! settings.attributes.fontSize ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tfontSize: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override props assigned to save component to inject font size.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nfunction addSaveProps( props, blockType, attributes ) {\n\tif ( ! hasBlockSupport( blockType, FONT_SIZE_SUPPORT_KEY ) ) {\n\t\treturn props;\n\t}\n\n\tif (\n\t\thasBlockSupport(\n\t\t\tblockType,\n\t\t\t'typography.__experimentalSkipSerialization'\n\t\t)\n\t) {\n\t\treturn props;\n\t}\n\n\t// Use TokenList to dedupe classes.\n\tconst classes = new TokenList( props.className );\n\tclasses.add( getFontSizeClass( attributes.fontSize ) );\n\tconst newClassName = classes.value;\n\tprops.className = newClassName ? newClassName : undefined;\n\n\treturn props;\n}\n\n/**\n * Filters registered block settings to expand the block edit wrapper\n * by applying the desired styles and classnames.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addEditProps( settings ) {\n\tif ( ! hasBlockSupport( settings, FONT_SIZE_SUPPORT_KEY ) ) {\n\t\treturn settings;\n\t}\n\n\tconst existingGetEditWrapperProps = settings.getEditWrapperProps;\n\tsettings.getEditWrapperProps = ( attributes ) => {\n\t\tlet props = {};\n\t\tif ( existingGetEditWrapperProps ) {\n\t\t\tprops = existingGetEditWrapperProps( attributes );\n\t\t}\n\t\treturn addSaveProps( props, settings, attributes );\n\t};\n\n\treturn settings;\n}\n\n/**\n * Inspector control panel containing the font size related configuration\n *\n * @param {Object} props\n *\n * @return {WPElement} Font size edit element.\n */\nexport function FontSizeEdit( props ) {\n\tconst {\n\t\tattributes: { fontSize, style },\n\t\tsetAttributes,\n\t} = props;\n\tconst fontSizes = useSetting( 'typography.fontSizes' );\n\n\tconst onChange = ( value ) => {\n\t\tconst fontSizeSlug = getFontSizeObjectByValue( fontSizes, value ).slug;\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t...style,\n\t\t\t\ttypography: {\n\t\t\t\t\t...style?.typography,\n\t\t\t\t\tfontSize: fontSizeSlug ? undefined : value,\n\t\t\t\t},\n\t\t\t} ),\n\t\t\tfontSize: fontSizeSlug,\n\t\t} );\n\t};\n\n\tconst fontSizeObject = getFontSize(\n\t\tfontSizes,\n\t\tfontSize,\n\t\tstyle?.typography?.fontSize\n\t);\n\n\tconst fontSizeValue =\n\t\tfontSizeObject?.size || style?.typography?.fontSize || fontSize;\n\n\treturn (\n\t\t<FontSizePicker\n\t\t\tonChange={ onChange }\n\t\t\tvalue={ fontSizeValue }\n\t\t\twithReset={ false }\n\t\t/>\n\t);\n}\n\n/**\n * Checks if there is a current value set for the font size block support.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a font size value set.\n */\nexport function hasFontSizeValue( props ) {\n\tconst { fontSize, style } = props.attributes;\n\treturn !! fontSize || !! style?.typography?.fontSize;\n}\n\n/**\n * Resets the font size block support attribute. This can be used when\n * disabling the font size support controls for a block via a progressive\n * discovery panel.\n *\n * @param {Object} props Block props.\n * @param {Object} props.attributes Block's attributes.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetFontSize( { attributes = {}, setAttributes } ) {\n\tconst { style } = attributes;\n\n\tsetAttributes( {\n\t\tfontSize: undefined,\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\ttypography: {\n\t\t\t\t...style?.typography,\n\t\t\t\tfontSize: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n\n/**\n * Custom hook that checks if font-size settings have been disabled.\n *\n * @param {string} name The name of the block.\n * @return {boolean} Whether setting is disabled.\n */\nexport function useIsFontSizeDisabled( { name: blockName } = {} ) {\n\tconst fontSizes = useSetting( 'typography.fontSizes' );\n\tconst hasFontSizes = !! fontSizes?.length;\n\n\treturn (\n\t\t! hasBlockSupport( blockName, FONT_SIZE_SUPPORT_KEY ) || ! hasFontSizes\n\t);\n}\n\n/**\n * Add inline styles for font sizes.\n * Ideally, this is not needed and themes load the font-size classes on the\n * editor.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nconst withFontSizeInlineStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst fontSizes = useSetting( 'typography.fontSizes' );\n\t\tconst {\n\t\t\tname: blockName,\n\t\t\tattributes: { fontSize, style },\n\t\t\twrapperProps,\n\t\t} = props;\n\n\t\t// Only add inline styles if the block supports font sizes,\n\t\t// doesn't skip serialization of font sizes,\n\t\t// doesn't already have an inline font size,\n\t\t// and does have a class to extract the font size from.\n\t\tif (\n\t\t\t! hasBlockSupport( blockName, FONT_SIZE_SUPPORT_KEY ) ||\n\t\t\thasBlockSupport(\n\t\t\t\tblockName,\n\t\t\t\t'typography.__experimentalSkipSerialization'\n\t\t\t) ||\n\t\t\t! fontSize ||\n\t\t\tstyle?.typography?.fontSize\n\t\t) {\n\t\t\treturn <BlockListBlock { ...props } />;\n\t\t}\n\n\t\tconst fontSizeValue = getFontSize(\n\t\t\tfontSizes,\n\t\t\tfontSize,\n\t\t\tstyle?.typography?.fontSize\n\t\t).size;\n\n\t\tconst newProps = {\n\t\t\t...props,\n\t\t\twrapperProps: {\n\t\t\t\t...wrapperProps,\n\t\t\t\tstyle: {\n\t\t\t\t\tfontSize: fontSizeValue,\n\t\t\t\t\t...wrapperProps?.style,\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\n\t\treturn <BlockListBlock { ...newProps } />;\n\t},\n\t'withFontSizeInlineStyles'\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/font/addAttribute',\n\taddAttributes\n);\n\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/font/addSaveProps',\n\taddSaveProps\n);\n\naddFilter( 'blocks.registerBlockType', 'core/font/addEditProps', addEditProps );\n\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/font-size/with-font-size-inline-styles',\n\twithFontSizeInlineStyles\n);\n"]}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.hasGapSupport = hasGapSupport;
|
|
9
|
+
exports.hasGapValue = hasGapValue;
|
|
10
|
+
exports.resetGap = resetGap;
|
|
11
|
+
exports.useIsGapDisabled = useIsGapDisabled;
|
|
12
|
+
exports.GapEdit = GapEdit;
|
|
13
|
+
|
|
14
|
+
var _element = require("@wordpress/element");
|
|
15
|
+
|
|
16
|
+
var _i18n = require("@wordpress/i18n");
|
|
17
|
+
|
|
18
|
+
var _blocks = require("@wordpress/blocks");
|
|
19
|
+
|
|
20
|
+
var _components = require("@wordpress/components");
|
|
21
|
+
|
|
22
|
+
var _useBlockRefs = require("../components/block-list/use-block-props/use-block-refs");
|
|
23
|
+
|
|
24
|
+
var _useSetting = _interopRequireDefault(require("../components/use-setting"));
|
|
25
|
+
|
|
26
|
+
var _dimensions = require("./dimensions");
|
|
27
|
+
|
|
28
|
+
var _utils = require("./utils");
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* WordPress dependencies
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Internal dependencies
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Determines if there is gap support.
|
|
40
|
+
*
|
|
41
|
+
* @param {string|Object} blockType Block name or Block Type object.
|
|
42
|
+
* @return {boolean} Whether there is support.
|
|
43
|
+
*/
|
|
44
|
+
function hasGapSupport(blockType) {
|
|
45
|
+
const support = (0, _blocks.getBlockSupport)(blockType, _dimensions.SPACING_SUPPORT_KEY);
|
|
46
|
+
return !!(true === support || support !== null && support !== void 0 && support.blockGap);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Checks if there is a current value in the gap block support attributes.
|
|
50
|
+
*
|
|
51
|
+
* @param {Object} props Block props.
|
|
52
|
+
* @return {boolean} Whether or not the block has a gap value set.
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
function hasGapValue(props) {
|
|
57
|
+
var _props$attributes$sty, _props$attributes$sty2;
|
|
58
|
+
|
|
59
|
+
return ((_props$attributes$sty = props.attributes.style) === null || _props$attributes$sty === void 0 ? void 0 : (_props$attributes$sty2 = _props$attributes$sty.spacing) === null || _props$attributes$sty2 === void 0 ? void 0 : _props$attributes$sty2.blockGap) !== undefined;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Resets the gap block support attribute. This can be used when disabling
|
|
63
|
+
* the gap support controls for a block via a progressive discovery panel.
|
|
64
|
+
*
|
|
65
|
+
* @param {Object} props Block props.
|
|
66
|
+
* @param {Object} props.attributes Block's attributes.
|
|
67
|
+
* @param {Object} props.setAttributes Function to set block's attributes.
|
|
68
|
+
*/
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
function resetGap({
|
|
72
|
+
attributes = {},
|
|
73
|
+
setAttributes
|
|
74
|
+
}) {
|
|
75
|
+
const {
|
|
76
|
+
style
|
|
77
|
+
} = attributes;
|
|
78
|
+
setAttributes({
|
|
79
|
+
style: { ...style,
|
|
80
|
+
spacing: { ...(style === null || style === void 0 ? void 0 : style.spacing),
|
|
81
|
+
blockGap: undefined
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Custom hook that checks if gap settings have been disabled.
|
|
88
|
+
*
|
|
89
|
+
* @param {string} name The name of the block.
|
|
90
|
+
* @return {boolean} Whether the gap setting is disabled.
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
function useIsGapDisabled({
|
|
95
|
+
name: blockName
|
|
96
|
+
} = {}) {
|
|
97
|
+
const isDisabled = !(0, _useSetting.default)('spacing.blockGap');
|
|
98
|
+
return !hasGapSupport(blockName) || isDisabled;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Inspector control panel containing the gap related configuration
|
|
102
|
+
*
|
|
103
|
+
* @param {Object} props
|
|
104
|
+
*
|
|
105
|
+
* @return {WPElement} Gap edit element.
|
|
106
|
+
*/
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
function GapEdit(props) {
|
|
110
|
+
var _style$spacing;
|
|
111
|
+
|
|
112
|
+
const {
|
|
113
|
+
clientId,
|
|
114
|
+
attributes: {
|
|
115
|
+
style
|
|
116
|
+
},
|
|
117
|
+
setAttributes
|
|
118
|
+
} = props;
|
|
119
|
+
const units = (0, _components.__experimentalUseCustomUnits)({
|
|
120
|
+
availableUnits: (0, _useSetting.default)('spacing.units') || ['%', 'px', 'em', 'rem', 'vw']
|
|
121
|
+
});
|
|
122
|
+
const ref = (0, _useBlockRefs.__unstableUseBlockRef)(clientId);
|
|
123
|
+
|
|
124
|
+
if (useIsGapDisabled(props)) {
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const onChange = next => {
|
|
129
|
+
var _window;
|
|
130
|
+
|
|
131
|
+
const newStyle = { ...style,
|
|
132
|
+
spacing: { ...(style === null || style === void 0 ? void 0 : style.spacing),
|
|
133
|
+
blockGap: next
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
setAttributes({
|
|
137
|
+
style: (0, _utils.cleanEmptyObject)(newStyle)
|
|
138
|
+
}); // In Safari, changing the `gap` CSS value on its own will not trigger the layout
|
|
139
|
+
// to be recalculated / re-rendered. To force the updated gap to re-render, here
|
|
140
|
+
// we replace the block's node with itself.
|
|
141
|
+
|
|
142
|
+
const isSafari = ((_window = window) === null || _window === void 0 ? void 0 : _window.navigator.userAgent) && window.navigator.userAgent.includes('Safari') && !window.navigator.userAgent.includes('Chrome ') && !window.navigator.userAgent.includes('Chromium ');
|
|
143
|
+
|
|
144
|
+
if (ref.current && isSafari) {
|
|
145
|
+
var _ref$current$parentNo;
|
|
146
|
+
|
|
147
|
+
(_ref$current$parentNo = ref.current.parentNode) === null || _ref$current$parentNo === void 0 ? void 0 : _ref$current$parentNo.replaceChild(ref.current, ref.current);
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
return _element.Platform.select({
|
|
152
|
+
web: (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.__experimentalUnitControl, {
|
|
153
|
+
label: (0, _i18n.__)('Block spacing'),
|
|
154
|
+
__unstableInputWidth: "80px",
|
|
155
|
+
min: 0,
|
|
156
|
+
onChange: onChange,
|
|
157
|
+
units: units,
|
|
158
|
+
value: style === null || style === void 0 ? void 0 : (_style$spacing = style.spacing) === null || _style$spacing === void 0 ? void 0 : _style$spacing.blockGap
|
|
159
|
+
})),
|
|
160
|
+
native: null
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=gap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/hooks/gap.js"],"names":["hasGapSupport","blockType","support","SPACING_SUPPORT_KEY","blockGap","hasGapValue","props","attributes","style","spacing","undefined","resetGap","setAttributes","useIsGapDisabled","name","blockName","isDisabled","GapEdit","clientId","units","availableUnits","ref","onChange","next","newStyle","isSafari","window","navigator","userAgent","includes","current","parentNode","replaceChild","Platform","select","web","native"],"mappings":";;;;;;;;;;;;;AAIA;;AADA;;AAEA;;AACA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ACD,GAzBD;;AA2BA,SAAOG,kBAASC,MAAT,CAAiB;AACvBC,IAAAA,GAAG,EACF,qDACC,4BAAC,qCAAD;AACC,MAAA,KAAK,EAAG,cAAI,eAAJ,CADT;AAEC,MAAA,oBAAoB,EAAC,MAFtB;AAGC,MAAA,GAAG,EAAG,CAHP;AAIC,MAAA,QAAQ,EAAGb,QAJZ;AAKC,MAAA,KAAK,EAAGH,KALT;AAMC,MAAA,KAAK,EAAGX,KAAH,aAAGA,KAAH,yCAAGA,KAAK,CAAEC,OAAV,mDAAG,eAAgBL;AANzB,MADD,CAFsB;AAavBgC,IAAAA,MAAM,EAAE;AAbe,GAAjB,CAAP;AAeA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Platform } from '@wordpress/element';\nimport { getBlockSupport } from '@wordpress/blocks';\nimport {\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalUnitControl as UnitControl,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { __unstableUseBlockRef as useBlockRef } from '../components/block-list/use-block-props/use-block-refs';\nimport useSetting from '../components/use-setting';\nimport { SPACING_SUPPORT_KEY } from './dimensions';\nimport { cleanEmptyObject } from './utils';\n\n/**\n * Determines if there is gap support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n * @return {boolean} Whether there is support.\n */\nexport function hasGapSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, SPACING_SUPPORT_KEY );\n\treturn !! ( true === support || support?.blockGap );\n}\n\n/**\n * Checks if there is a current value in the gap block support attributes.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a gap value set.\n */\nexport function hasGapValue( props ) {\n\treturn props.attributes.style?.spacing?.blockGap !== undefined;\n}\n\n/**\n * Resets the gap block support attribute. This can be used when disabling\n * the gap support controls for a block via a progressive discovery panel.\n *\n * @param {Object} props Block props.\n * @param {Object} props.attributes Block's attributes.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetGap( { attributes = {}, setAttributes } ) {\n\tconst { style } = attributes;\n\n\tsetAttributes( {\n\t\tstyle: {\n\t\t\t...style,\n\t\t\tspacing: {\n\t\t\t\t...style?.spacing,\n\t\t\t\tblockGap: undefined,\n\t\t\t},\n\t\t},\n\t} );\n}\n\n/**\n * Custom hook that checks if gap settings have been disabled.\n *\n * @param {string} name The name of the block.\n * @return {boolean} Whether the gap setting is disabled.\n */\nexport function useIsGapDisabled( { name: blockName } = {} ) {\n\tconst isDisabled = ! useSetting( 'spacing.blockGap' );\n\treturn ! hasGapSupport( blockName ) || isDisabled;\n}\n\n/**\n * Inspector control panel containing the gap related configuration\n *\n * @param {Object} props\n *\n * @return {WPElement} Gap edit element.\n */\nexport function GapEdit( props ) {\n\tconst {\n\t\tclientId,\n\t\tattributes: { style },\n\t\tsetAttributes,\n\t} = props;\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: useSetting( 'spacing.units' ) || [\n\t\t\t'%',\n\t\t\t'px',\n\t\t\t'em',\n\t\t\t'rem',\n\t\t\t'vw',\n\t\t],\n\t} );\n\n\tconst ref = useBlockRef( clientId );\n\n\tif ( useIsGapDisabled( props ) ) {\n\t\treturn null;\n\t}\n\n\tconst onChange = ( next ) => {\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\tspacing: {\n\t\t\t\t...style?.spacing,\n\t\t\t\tblockGap: next,\n\t\t\t},\n\t\t};\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t} );\n\n\t\t// In Safari, changing the `gap` CSS value on its own will not trigger the layout\n\t\t// to be recalculated / re-rendered. To force the updated gap to re-render, here\n\t\t// we replace the block's node with itself.\n\t\tconst isSafari =\n\t\t\twindow?.navigator.userAgent &&\n\t\t\twindow.navigator.userAgent.includes( 'Safari' ) &&\n\t\t\t! window.navigator.userAgent.includes( 'Chrome ' ) &&\n\t\t\t! window.navigator.userAgent.includes( 'Chromium ' );\n\n\t\tif ( ref.current && isSafari ) {\n\t\t\tref.current.parentNode?.replaceChild( ref.current, ref.current );\n\t\t}\n\t};\n\n\treturn Platform.select( {\n\t\tweb: (\n\t\t\t<>\n\t\t\t\t<UnitControl\n\t\t\t\t\tlabel={ __( 'Block spacing' ) }\n\t\t\t\t\t__unstableInputWidth=\"80px\"\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tunits={ units }\n\t\t\t\t\tvalue={ style?.spacing?.blockGap }\n\t\t\t\t/>\n\t\t\t</>\n\t\t),\n\t\tnative: null,\n\t} );\n}\n"]}
|
package/build/hooks/index.js
CHANGED
|
@@ -39,9 +39,19 @@ Object.defineProperty(exports, "getSpacingClassesAndStyles", {
|
|
|
39
39
|
return _useSpacingProps.getSpacingClassesAndStyles;
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
|
+
Object.defineProperty(exports, "useCachedTruthy", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _useCachedTruthy.useCachedTruthy;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
require("./compat");
|
|
42
50
|
|
|
43
51
|
require("./align");
|
|
44
52
|
|
|
53
|
+
require("./lock");
|
|
54
|
+
|
|
45
55
|
require("./anchor");
|
|
46
56
|
|
|
47
57
|
require("./custom-class-name");
|
|
@@ -67,4 +77,6 @@ var _useBorderProps = require("./use-border-props");
|
|
|
67
77
|
var _useColorProps = require("./use-color-props");
|
|
68
78
|
|
|
69
79
|
var _useSpacingProps = require("./use-spacing-props");
|
|
80
|
+
|
|
81
|
+
var _useCachedTruthy = require("./use-cached-truthy");
|
|
70
82
|
//# sourceMappingURL=index.js.map
|
package/build/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/hooks/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/hooks/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport './compat';\nimport './align';\nimport './lock';\nimport './anchor';\nimport './custom-class-name';\nimport './generated-class-name';\nimport './style';\nimport './color';\nimport './duotone';\nimport './font-size';\nimport './border-color';\nimport './layout';\n\nexport { useCustomSides } from './dimensions';\nexport { getBorderClassesAndStyles, useBorderProps } from './use-border-props';\nexport { getColorClassesAndStyles, useColorProps } from './use-color-props';\nexport { getSpacingClassesAndStyles } from './use-spacing-props';\nexport { useCachedTruthy } from './use-cached-truthy';\n"]}
|
|
@@ -33,6 +33,14 @@ Object.defineProperty(exports, "getSpacingClassesAndStyles", {
|
|
|
33
33
|
return _useSpacingProps.getSpacingClassesAndStyles;
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
|
+
Object.defineProperty(exports, "useCachedTruthy", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _useCachedTruthy.useCachedTruthy;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
require("./compat");
|
|
36
44
|
|
|
37
45
|
require("./align");
|
|
38
46
|
|
|
@@ -53,4 +61,6 @@ var _useBorderProps = require("./use-border-props");
|
|
|
53
61
|
var _useColorProps = require("./use-color-props");
|
|
54
62
|
|
|
55
63
|
var _useSpacingProps = require("./use-spacing-props");
|
|
64
|
+
|
|
65
|
+
var _useCachedTruthy = require("./use-cached-truthy");
|
|
56
66
|
//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/hooks/index.native.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/hooks/index.native.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport './compat';\nimport './align';\nimport './anchor';\nimport './custom-class-name';\nimport './generated-class-name';\nimport './style';\nimport './color';\nimport './font-size';\n\nexport { getBorderClassesAndStyles, useBorderProps } from './use-border-props';\nexport { getColorClassesAndStyles, useColorProps } from './use-color-props';\nexport { getSpacingClassesAndStyles } from './use-spacing-props';\nexport { useCachedTruthy } from './use-cached-truthy';\n"]}
|