@wordpress/block-editor 7.0.4 → 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 +31 -0
- package/build/components/alignment-control/ui.js +1 -2
- package/build/components/alignment-control/ui.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-inspector/index.js +4 -0
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/index.native.js +1 -1
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/use-block-props/use-multi-selection.js +21 -8
- package/build/components/block-list/use-block-props/use-multi-selection.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-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 +22 -2
- package/build/components/block-settings-menu/block-settings-dropdown.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/colors-gradients/control.js +8 -47
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.js +81 -6
- package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build/components/duotone-control/index.js +5 -2
- package/build/components/duotone-control/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +27 -15
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/iframe/index.js +1 -1
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/index.js +20 -2
- package/build/components/index.js.map +1 -1
- package/build/components/index.native.js +2 -2
- package/build/components/index.native.js.map +1 -1
- package/build/components/inner-blocks/index.js +5 -4
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/index.native.js +4 -3
- package/build/components/inner-blocks/index.native.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 -45
- package/build/components/inserter/block-patterns-tab.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/pattern-panel.js +19 -10
- package/build/components/inserter/pattern-panel.js.map +1 -1
- package/build/components/inspector-controls/groups.js +3 -1
- package/build/components/inspector-controls/groups.js.map +1 -1
- package/build/components/letter-spacing-control/index.js +9 -6
- package/build/components/letter-spacing-control/index.js.map +1 -1
- package/build/components/link-control/index.js +88 -35
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/link-preview.js +19 -6
- package/build/components/link-control/link-preview.js.map +1 -1
- package/build/components/link-control/search-input.js +12 -3
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/list-view/block.js +49 -23
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +92 -73
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/index.js +39 -16
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/leaf.js +1 -1
- package/build/components/list-view/leaf.js.map +1 -1
- package/build/components/list-view/use-list-view-client-ids.js +8 -58
- package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build/components/rich-text/embed-handler-picker.native.js +1 -0
- package/build/components/rich-text/embed-handler-picker.native.js.map +1 -1
- 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 +2 -1
- package/build/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build/components/url-input/index.js +11 -4
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-setting/index.js +48 -9
- package/build/components/use-setting/index.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 +2 -1
- package/build/hooks/color-panel.js.map +1 -1
- package/build/hooks/duotone.js +16 -5
- 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 +37 -16
- 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/index.js +8 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/index.native.js +8 -0
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/letter-spacing.js +44 -7
- 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/margin.js +1 -1
- package/build/hooks/margin.js.map +1 -1
- package/build/hooks/padding.js +1 -1
- package/build/hooks/padding.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 +108 -8
- package/build/hooks/typography.js.map +1 -1
- 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 +120 -28
- package/build/layouts/flex.js.map +1 -1
- package/build/store/actions.js +303 -265
- package/build/store/actions.js.map +1 -1
- package/build/store/index.js +1 -3
- package/build/store/index.js.map +1 -1
- package/build/store/reducer.js +23 -22
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +44 -35
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/alignment-control/ui.js +1 -2
- package/build-module/components/alignment-control/ui.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-inspector/index.js +4 -0
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/index.native.js +1 -1
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-multi-selection.js +21 -8
- package/build-module/components/block-list/use-block-props/use-multi-selection.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-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 +24 -4
- package/build-module/components/block-settings-menu/block-settings-dropdown.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/colors-gradients/control.js +12 -53
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +82 -6
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/duotone-control/index.js +5 -2
- package/build-module/components/duotone-control/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +23 -15
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/iframe/index.js +1 -1
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/index.js +3 -1
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/index.native.js +1 -1
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +6 -5
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.native.js +5 -4
- package/build-module/components/inner-blocks/index.native.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 -46
- package/build-module/components/inserter/block-patterns-tab.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/pattern-panel.js +21 -13
- package/build-module/components/inserter/pattern-panel.js.map +1 -1
- package/build-module/components/inspector-controls/groups.js +3 -1
- package/build-module/components/inspector-controls/groups.js.map +1 -1
- 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/link-control/index.js +88 -36
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +19 -7
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/link-control/search-input.js +11 -3
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/list-view/block.js +49 -24
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +92 -73
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/index.js +41 -18
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/leaf.js +1 -1
- package/build-module/components/list-view/leaf.js.map +1 -1
- package/build-module/components/list-view/use-list-view-client-ids.js +8 -58
- package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build-module/components/rich-text/embed-handler-picker.native.js +1 -0
- package/build-module/components/rich-text/embed-handler-picker.native.js.map +1 -1
- 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 +2 -1
- package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build-module/components/url-input/index.js +11 -4
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-setting/index.js +48 -9
- package/build-module/components/use-setting/index.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 +2 -1
- package/build-module/hooks/color-panel.js.map +1 -1
- package/build-module/hooks/duotone.js +16 -5
- 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 +33 -16
- 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/index.js +1 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/index.native.js +1 -0
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/hooks/letter-spacing.js +40 -7
- 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/margin.js +1 -1
- package/build-module/hooks/margin.js.map +1 -1
- package/build-module/hooks/padding.js +1 -1
- package/build-module/hooks/padding.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 +117 -17
- package/build-module/hooks/typography.js.map +1 -1
- 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 +124 -32
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/store/actions.js +266 -241
- package/build-module/store/actions.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 +23 -22
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +42 -30
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +160 -57
- package/build-style/style.css +160 -57
- package/package.json +13 -14
- package/src/components/alignment-control/test/__snapshots__/index.js.snap +0 -2
- package/src/components/alignment-control/ui.js +1 -4
- package/src/components/block-draggable/style.scss +19 -4
- package/src/components/block-icon/index.js +4 -1
- package/src/components/block-inspector/index.js +5 -0
- package/src/components/block-list/index.native.js +1 -1
- package/src/components/block-list/use-block-props/use-multi-selection.js +27 -7
- 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-settings/container.native.js +7 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +19 -7
- package/src/components/block-styles/preview.native.js +2 -2
- package/src/components/block-switcher/test/__snapshots__/index.js.snap +1 -1
- package/src/components/color-palette/test/__snapshots__/control.js.snap +88 -63
- package/src/components/colors-gradients/control.js +19 -62
- package/src/components/colors-gradients/panel-color-gradient-settings.js +76 -6
- package/src/components/colors-gradients/style.scss +3 -14
- package/src/components/colors-gradients/test/control.js +0 -16
- package/src/components/duotone-control/index.js +6 -0
- package/src/components/duotone-control/style.scss +27 -12
- package/src/components/font-appearance-control/index.js +22 -14
- package/src/components/iframe/index.js +1 -1
- package/src/components/index.js +3 -4
- package/src/components/index.native.js +1 -4
- package/src/components/inner-blocks/index.js +4 -4
- package/src/components/inner-blocks/index.native.js +7 -4
- 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 -80
- package/src/components/inserter/hooks/use-block-type-impressions.native.js +14 -21
- package/src/components/inserter/pattern-panel.js +33 -16
- package/src/components/inserter/style.scss +64 -1
- package/src/components/inserter/test/block-types-tab.native.js +1 -1
- package/src/components/inserter/test/fixtures/index.native.js +12 -0
- package/src/components/inspector-controls/groups.js +4 -0
- package/src/components/letter-spacing-control/index.js +12 -6
- package/src/components/link-control/README.md +7 -0
- package/src/components/link-control/index.js +99 -34
- package/src/components/link-control/link-preview.js +21 -9
- package/src/components/link-control/search-input.js +9 -3
- package/src/components/link-control/style.scss +32 -16
- package/src/components/link-control/test/index.js +179 -4
- package/src/components/list-view/block.js +67 -23
- package/src/components/list-view/branch.js +113 -91
- package/src/components/list-view/index.js +58 -19
- package/src/components/list-view/leaf.js +1 -1
- package/src/components/list-view/style.scss +14 -3
- package/src/components/list-view/use-list-view-client-ids.js +7 -66
- package/src/components/rich-text/embed-handler-picker.native.js +1 -0
- package/src/components/rich-text/format-edit.js +36 -2
- package/src/components/rich-text/format-toolbar/index.js +3 -0
- package/src/components/url-input/index.js +14 -4
- package/src/components/use-setting/index.js +49 -11
- package/src/hooks/border.js +8 -11
- package/src/hooks/color-panel.js +1 -0
- package/src/hooks/duotone.js +21 -7
- package/src/hooks/font-appearance.js +38 -7
- package/src/hooks/font-family.js +29 -13
- package/src/hooks/font-size.js +42 -6
- package/src/hooks/index.js +1 -0
- package/src/hooks/index.native.js +1 -0
- package/src/hooks/layout.scss +3 -1
- package/src/hooks/letter-spacing.js +35 -7
- package/src/hooks/line-height.js +37 -9
- package/src/hooks/margin.js +1 -1
- package/src/hooks/padding.js +1 -1
- package/src/hooks/text-decoration.js +34 -6
- package/src/hooks/text-transform.js +34 -6
- package/src/hooks/typography.js +165 -15
- 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 +137 -41
- package/src/store/actions.js +223 -391
- package/src/store/index.js +1 -2
- package/src/store/reducer.js +36 -18
- package/src/store/selectors.js +52 -47
- package/src/store/test/actions.js +395 -694
- package/src/store/test/selectors.js +79 -21
- package/src/style.scss +1 -1
- package/src/utils/test/parse-css-unit-to-px.js +127 -167
- 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/store/controls.js +0 -44
- package/build/store/controls.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/store/controls.js +0 -32
- package/build-module/store/controls.js.map +0 -1
- package/src/components/text-decoration-and-transform/index.js +0 -36
- package/src/components/text-decoration-and-transform/style.scss +0 -3
- package/src/store/controls.js +0 -39
|
@@ -70,8 +70,8 @@ const {
|
|
|
70
70
|
__experimentalGetLastBlockAttributeChanges,
|
|
71
71
|
getLowestCommonAncestorWithSelectedBlock,
|
|
72
72
|
__experimentalGetActiveBlockIdByBlockNames: getActiveBlockIdByBlockNames,
|
|
73
|
-
__experimentalGetParsedReusableBlock,
|
|
74
73
|
__experimentalGetAllowedPatterns,
|
|
74
|
+
__experimentalGetParsedPattern,
|
|
75
75
|
__experimentalGetPatternsByBlockTypes,
|
|
76
76
|
__unstableGetClientIdWithClientIdsTree,
|
|
77
77
|
__unstableGetClientIdsTree,
|
|
@@ -3331,6 +3331,13 @@ describe( 'selectors', () => {
|
|
|
3331
3331
|
content:
|
|
3332
3332
|
'<!-- wp:test-block-b --><!-- /wp:test-block-b -->',
|
|
3333
3333
|
},
|
|
3334
|
+
{
|
|
3335
|
+
name: 'pattern-c',
|
|
3336
|
+
title: 'pattern hidden from UI',
|
|
3337
|
+
inserter: false,
|
|
3338
|
+
content:
|
|
3339
|
+
'<!-- wp:test-block-a --><!-- /wp:test-block-a -->',
|
|
3340
|
+
},
|
|
3334
3341
|
],
|
|
3335
3342
|
},
|
|
3336
3343
|
};
|
|
@@ -3350,6 +3357,77 @@ describe( 'selectors', () => {
|
|
|
3350
3357
|
__experimentalGetAllowedPatterns( state, 'block2' )
|
|
3351
3358
|
).toHaveLength( 0 );
|
|
3352
3359
|
} );
|
|
3360
|
+
it( 'should return empty array if only patterns hidden from UI exist', () => {
|
|
3361
|
+
expect(
|
|
3362
|
+
__experimentalGetAllowedPatterns( {
|
|
3363
|
+
blocks: { byClientId: {} },
|
|
3364
|
+
blockListSettings: {},
|
|
3365
|
+
settings: {
|
|
3366
|
+
__experimentalBlockPatterns: [
|
|
3367
|
+
{
|
|
3368
|
+
name: 'pattern-c',
|
|
3369
|
+
title: 'pattern hidden from UI',
|
|
3370
|
+
inserter: false,
|
|
3371
|
+
content:
|
|
3372
|
+
'<!-- wp:test-block-a --><!-- /wp:test-block-a -->',
|
|
3373
|
+
},
|
|
3374
|
+
],
|
|
3375
|
+
},
|
|
3376
|
+
} )
|
|
3377
|
+
).toHaveLength( 0 );
|
|
3378
|
+
} );
|
|
3379
|
+
} );
|
|
3380
|
+
describe( '__experimentalGetParsedPattern', () => {
|
|
3381
|
+
const state = {
|
|
3382
|
+
settings: {
|
|
3383
|
+
__experimentalBlockPatterns: [
|
|
3384
|
+
{
|
|
3385
|
+
name: 'pattern-a',
|
|
3386
|
+
title: 'pattern with a',
|
|
3387
|
+
content: `<!-- wp:test-block-a --><!-- /wp:test-block-a -->`,
|
|
3388
|
+
},
|
|
3389
|
+
{
|
|
3390
|
+
name: 'pattern-hidden-from-ui',
|
|
3391
|
+
title: 'pattern hidden from UI',
|
|
3392
|
+
inserter: false,
|
|
3393
|
+
content:
|
|
3394
|
+
'<!-- wp:test-block-a --><!-- /wp:test-block-a --><!-- wp:test-block-b --><!-- /wp:test-block-b -->',
|
|
3395
|
+
},
|
|
3396
|
+
],
|
|
3397
|
+
},
|
|
3398
|
+
};
|
|
3399
|
+
it( 'should return proper results when pattern does not exist', () => {
|
|
3400
|
+
expect(
|
|
3401
|
+
__experimentalGetParsedPattern( state, 'not there' )
|
|
3402
|
+
).toBeNull();
|
|
3403
|
+
} );
|
|
3404
|
+
it( 'should return existing pattern properly parsed', () => {
|
|
3405
|
+
const { name, blocks } = __experimentalGetParsedPattern(
|
|
3406
|
+
state,
|
|
3407
|
+
'pattern-a'
|
|
3408
|
+
);
|
|
3409
|
+
expect( name ).toEqual( 'pattern-a' );
|
|
3410
|
+
expect( blocks ).toHaveLength( 1 );
|
|
3411
|
+
expect( blocks[ 0 ] ).toEqual(
|
|
3412
|
+
expect.objectContaining( {
|
|
3413
|
+
name: 'core/test-block-a',
|
|
3414
|
+
} )
|
|
3415
|
+
);
|
|
3416
|
+
} );
|
|
3417
|
+
it( 'should return hidden from UI pattern when requested', () => {
|
|
3418
|
+
const { name, blocks, inserter } = __experimentalGetParsedPattern(
|
|
3419
|
+
state,
|
|
3420
|
+
'pattern-hidden-from-ui'
|
|
3421
|
+
);
|
|
3422
|
+
expect( name ).toEqual( 'pattern-hidden-from-ui' );
|
|
3423
|
+
expect( inserter ).toBeFalsy();
|
|
3424
|
+
expect( blocks ).toHaveLength( 2 );
|
|
3425
|
+
expect( blocks[ 0 ] ).toEqual(
|
|
3426
|
+
expect.objectContaining( {
|
|
3427
|
+
name: 'core/test-block-a',
|
|
3428
|
+
} )
|
|
3429
|
+
);
|
|
3430
|
+
} );
|
|
3353
3431
|
} );
|
|
3354
3432
|
describe( '__experimentalGetPatternsByBlockTypes', () => {
|
|
3355
3433
|
const state = {
|
|
@@ -3625,26 +3703,6 @@ describe( 'selectors', () => {
|
|
|
3625
3703
|
} );
|
|
3626
3704
|
} );
|
|
3627
3705
|
|
|
3628
|
-
describe( '__experimentalGetParsedReusableBlock', () => {
|
|
3629
|
-
const state = {
|
|
3630
|
-
settings: {
|
|
3631
|
-
__experimentalReusableBlocks: [
|
|
3632
|
-
{
|
|
3633
|
-
id: 1,
|
|
3634
|
-
content: { raw: '' },
|
|
3635
|
-
},
|
|
3636
|
-
],
|
|
3637
|
-
},
|
|
3638
|
-
};
|
|
3639
|
-
|
|
3640
|
-
// Regression test for https://github.com/WordPress/gutenberg/issues/26485. See https://github.com/WordPress/gutenberg/issues/26548.
|
|
3641
|
-
it( "Should return an empty array if reusable block's content.raw is an empty string", () => {
|
|
3642
|
-
expect( __experimentalGetParsedReusableBlock( state, 1 ) ).toEqual(
|
|
3643
|
-
[]
|
|
3644
|
-
);
|
|
3645
|
-
} );
|
|
3646
|
-
} );
|
|
3647
|
-
|
|
3648
3706
|
describe( 'getInserterItems with core blocks prioritization', () => {
|
|
3649
3707
|
// This test is in a seperate `describe` because all other tests register
|
|
3650
3708
|
// some test `core` blocks and interfere with the purpose of the specific test.
|
package/src/style.scss
CHANGED
|
@@ -46,7 +46,6 @@
|
|
|
46
46
|
@import "./components/responsive-block-control/style.scss";
|
|
47
47
|
@import "./components/rich-text/style.scss";
|
|
48
48
|
@import "./components/skip-to-selected-block/style.scss";
|
|
49
|
-
@import "./components/text-decoration-and-transform/style.scss";
|
|
50
49
|
@import "./components/text-transform-control/style.scss";
|
|
51
50
|
@import "./components/text-decoration-control/style.scss";
|
|
52
51
|
@import "./components/tool-selector/style.scss";
|
|
@@ -56,6 +55,7 @@
|
|
|
56
55
|
@import "./hooks/anchor.scss";
|
|
57
56
|
@import "./hooks/layout.scss";
|
|
58
57
|
@import "./hooks/border.scss";
|
|
58
|
+
@import "./hooks/typography.scss";
|
|
59
59
|
|
|
60
60
|
@import "./components/block-toolbar/style.scss";
|
|
61
61
|
@import "./components/inserter/style.scss";
|
|
@@ -8,183 +8,143 @@ import {
|
|
|
8
8
|
|
|
9
9
|
describe( 'getPxFromCssUnit', () => {
|
|
10
10
|
// Absolute units
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
expect( getPxFromCssUnit( '1in' ) ).toBe( '96px' );
|
|
29
|
-
} );
|
|
30
|
-
|
|
31
|
-
it( 'test pt return px unit', () => {
|
|
32
|
-
expect( getPxFromCssUnit( '12pt' ) ).toBe( '16px' );
|
|
33
|
-
} );
|
|
34
|
-
|
|
35
|
-
it( 'test pc return px unit', () => {
|
|
36
|
-
expect( getPxFromCssUnit( '1pc' ) ).toBe( '16px' );
|
|
37
|
-
} );
|
|
38
|
-
|
|
39
|
-
it( 'test Q return px unit', () => {
|
|
40
|
-
expect( getPxFromCssUnit( '40Q' ) ).toBe( '38px' ); // 40 Q should be 1 cm
|
|
41
|
-
} );
|
|
42
|
-
|
|
43
|
-
// Relative units
|
|
44
|
-
it( 'test em return px unit', () => {
|
|
45
|
-
expect( getPxFromCssUnit( '2em', { fontSize: 10 } ) ).toBe( '20px' );
|
|
46
|
-
} );
|
|
47
|
-
|
|
48
|
-
it( 'test rem return px unit', () => {
|
|
49
|
-
expect( getPxFromCssUnit( '2rem', { fontSize: 10 } ) ).toBe( '20px' );
|
|
50
|
-
} );
|
|
51
|
-
|
|
52
|
-
it( 'test vw return px unit', () => {
|
|
53
|
-
expect( getPxFromCssUnit( '20vw', { width: 100 } ) ).toBe( '20px' );
|
|
54
|
-
} );
|
|
55
|
-
|
|
56
|
-
it( 'test vh return px unit', () => {
|
|
57
|
-
expect( getPxFromCssUnit( '20vh', { height: 200 } ) ).toBe( '40px' );
|
|
58
|
-
} );
|
|
59
|
-
|
|
60
|
-
it( 'test vmin return px unit', () => {
|
|
61
|
-
expect(
|
|
62
|
-
getPxFromCssUnit( '20vmin', { height: 200, width: 100 } )
|
|
63
|
-
).toBe( '20px' );
|
|
64
|
-
} );
|
|
65
|
-
|
|
66
|
-
it( 'test vmax return px unit', () => {
|
|
67
|
-
expect(
|
|
68
|
-
getPxFromCssUnit( '20vmax', { height: 200, width: 100 } )
|
|
69
|
-
).toBe( '40px' );
|
|
70
|
-
} );
|
|
71
|
-
|
|
72
|
-
it( 'test lh return px unit', () => {
|
|
73
|
-
expect( getPxFromCssUnit( '20lh', { lineHeight: 2 } ) ).toBe( '40px' );
|
|
74
|
-
} );
|
|
75
|
-
|
|
76
|
-
it( 'test % return px unit', () => {
|
|
77
|
-
expect(
|
|
78
|
-
getPxFromCssUnit( '120%', {
|
|
79
|
-
height: 200,
|
|
80
|
-
width: 100,
|
|
81
|
-
fontSize: 10,
|
|
82
|
-
type: 'font',
|
|
83
|
-
} )
|
|
84
|
-
).toBe( '12px' );
|
|
85
|
-
} );
|
|
86
|
-
|
|
87
|
-
// Function units
|
|
88
|
-
it( 'test min() return px unit', () => {
|
|
89
|
-
expect( getPxFromCssUnit( 'min(20px, 25px)' ) ).toBe( '20px' );
|
|
90
|
-
} );
|
|
91
|
-
|
|
92
|
-
it( 'test min() function with many arguments return px unit', () => {
|
|
93
|
-
expect( getPxFromCssUnit( 'min(20px, 9px, 12pt, 25px)' ) ).toBe(
|
|
94
|
-
'9px'
|
|
11
|
+
describe( 'absolute unites should return px values', () => {
|
|
12
|
+
const testData = [
|
|
13
|
+
[ '25px', '25px' ],
|
|
14
|
+
[ '25.5', '26px' ],
|
|
15
|
+
[ '1cm', '38px' ],
|
|
16
|
+
[ '10mm', '38px' ],
|
|
17
|
+
[ '1in', '96px' ],
|
|
18
|
+
[ '12pt', '16px' ],
|
|
19
|
+
[ '1pc', '16px' ],
|
|
20
|
+
[ '40Q', '38px' ], // 40 Q should be 1 cm
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
test.each( testData )(
|
|
24
|
+
'test getPxFromCssUnit( %s )',
|
|
25
|
+
( unit, expected ) => {
|
|
26
|
+
expect( getPxFromCssUnit( unit ) ).toBe( expected );
|
|
27
|
+
}
|
|
95
28
|
);
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
it( 'test clamp() lower return px unit', () => {
|
|
103
|
-
expect( getPxFromCssUnit( 'clamp(10px, 9px, 25px)' ) ).toBe( '10px' );
|
|
104
|
-
} );
|
|
105
|
-
|
|
106
|
-
it( 'test clamp() upper return px unit', () => {
|
|
107
|
-
expect( getPxFromCssUnit( 'clamp(10px, 35px, 25px)' ) ).toBe( '25px' );
|
|
108
|
-
} );
|
|
109
|
-
|
|
110
|
-
it( 'test clamp() middle return px unit', () => {
|
|
111
|
-
expect( getPxFromCssUnit( 'clamp(10px, 15px, 25px)' ) ).toBe( '15px' );
|
|
112
|
-
} );
|
|
113
|
-
|
|
114
|
-
it( 'test nested max min function return px unit', () => {
|
|
115
|
-
expect( getPxFromCssUnit( 'min(max(20px,25px), 35px)' ) ).toBe(
|
|
116
|
-
'25px'
|
|
29
|
+
test.each( testData )(
|
|
30
|
+
'test memoizedGetPxFromCssUnit( %s )',
|
|
31
|
+
( unit, expected ) => {
|
|
32
|
+
expect( memoizedGetPxFromCssUnit( unit ) ).toBe( expected );
|
|
33
|
+
}
|
|
117
34
|
);
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
35
|
+
test.each( testData )(
|
|
36
|
+
'test cached memoizedGetPxFromCssUnit( %s )',
|
|
37
|
+
( unit, expected ) => {
|
|
38
|
+
expect( memoizedGetPxFromCssUnit( unit ) ).toBe( expected );
|
|
39
|
+
}
|
|
123
40
|
);
|
|
124
41
|
} );
|
|
125
42
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
it( 'test text string', () => {
|
|
170
|
-
expect( getPxFromCssUnit( 'abc' ) ).toBe( null );
|
|
43
|
+
describe( 'relative unites should return px values', () => {
|
|
44
|
+
const settings = {
|
|
45
|
+
fontSize: 10,
|
|
46
|
+
width: 100,
|
|
47
|
+
height: 200,
|
|
48
|
+
lineHeight: 2,
|
|
49
|
+
type: 'font',
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const testData = [
|
|
53
|
+
[ '2em', '20px' ],
|
|
54
|
+
[ '2rem', '20px' ],
|
|
55
|
+
[ '20vw', '20px' ],
|
|
56
|
+
[ '20vh', '40px' ],
|
|
57
|
+
[ '20vmin', '20px' ],
|
|
58
|
+
[ '20vmax', '40px' ],
|
|
59
|
+
[ '20lh', '40px' ],
|
|
60
|
+
[ '120%', '12px' ],
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
test.each( testData )(
|
|
64
|
+
'test getPxFromCssUnit( %s )',
|
|
65
|
+
( unit, expected ) => {
|
|
66
|
+
expect( getPxFromCssUnit( unit, settings ) ).toBe( expected );
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
test.each( testData )(
|
|
70
|
+
'test memoizedGetPxFromCssUnit( %s )',
|
|
71
|
+
( unit, expected ) => {
|
|
72
|
+
expect( memoizedGetPxFromCssUnit( unit, settings ) ).toBe(
|
|
73
|
+
expected
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
test.each( testData )(
|
|
78
|
+
'test cached memoizedGetPxFromCssUnit( %s )',
|
|
79
|
+
( unit, expected ) => {
|
|
80
|
+
expect( memoizedGetPxFromCssUnit( unit, settings ) ).toBe(
|
|
81
|
+
expected
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
);
|
|
171
85
|
} );
|
|
172
86
|
|
|
173
|
-
|
|
174
|
-
expect( getPxFromCssUnit( 'abc + num' ) ).toBe( null );
|
|
175
|
-
} );
|
|
87
|
+
// Function units
|
|
176
88
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
89
|
+
describe( 'function unites should return px values', () => {
|
|
90
|
+
const settings = {
|
|
91
|
+
fontSize: 10,
|
|
92
|
+
width: 100,
|
|
93
|
+
height: 200,
|
|
94
|
+
lineHeight: 2,
|
|
95
|
+
type: 'font',
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const testData = [
|
|
99
|
+
[ 'min(20px, 25px)', '20px' ],
|
|
100
|
+
[ 'min(20px, 9px, 12pt, 25px)', '9px' ],
|
|
101
|
+
[ 'max(20px, 25px)', '25px' ],
|
|
102
|
+
[ 'clamp(10px, 9px, 25px)', '10px' ],
|
|
103
|
+
[ 'clamp(10px, 35px, 25px)', '25px' ],
|
|
104
|
+
[ 'clamp(10px, 15px, 25px)', '15px' ],
|
|
105
|
+
[ 'min(max(20px,25px), 35px)', '25px' ],
|
|
106
|
+
[ 'max(min(20px,25px), 35px)', '35px' ],
|
|
107
|
+
[ '10px + 25px', '35px' ],
|
|
108
|
+
[ 'calc(10px + 25px)', '35px' ],
|
|
109
|
+
[ 'calc( 2 * 20px)', '40px' ],
|
|
110
|
+
[ 'calc(25px - 10px)', '15px' ],
|
|
111
|
+
[ 'min(10px + 25px, 55pt)', '35px' ],
|
|
112
|
+
[ 'calc(12vw * 10px)', '450px' ],
|
|
113
|
+
[ 'calc(45vw / 10px)', '17px' ],
|
|
114
|
+
[ '', null ],
|
|
115
|
+
[ undefined, null ],
|
|
116
|
+
[ 123, '123px' ],
|
|
117
|
+
[ 123.456, '123px' ],
|
|
118
|
+
[ 'abc', null ],
|
|
119
|
+
[ 'console.log("howdy"); + 10px', null ],
|
|
120
|
+
[ 'calc(12vw * 10px', null ], // missing closing bracket
|
|
121
|
+
];
|
|
122
|
+
|
|
123
|
+
test.each( testData )(
|
|
124
|
+
'test getPxFromCssUnit( %s )',
|
|
125
|
+
( unit, expected ) => {
|
|
126
|
+
expect( getPxFromCssUnit( unit, settings ) ).toBe( expected );
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
test.each( testData )(
|
|
130
|
+
'test memoizedGetPxFromCssUnit( %s )',
|
|
131
|
+
( unit, expected ) => {
|
|
132
|
+
expect( memoizedGetPxFromCssUnit( unit, settings ) ).toBe(
|
|
133
|
+
expected
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
test.each( testData )(
|
|
138
|
+
'test cached memoizedGetPxFromCssUnit( %s )',
|
|
139
|
+
( unit, expected ) => {
|
|
140
|
+
expect( memoizedGetPxFromCssUnit( unit, settings ) ).toBe(
|
|
141
|
+
expected
|
|
142
|
+
);
|
|
143
|
+
}
|
|
180
144
|
);
|
|
181
145
|
} );
|
|
182
|
-
|
|
183
|
-
it( 'test
|
|
184
|
-
expect( getPxFromCssUnit( 'calc(12vw * 10px' ) ).toBe( null );
|
|
185
|
-
} );
|
|
186
|
-
|
|
187
|
-
it( 'test performance of memoizedGetPxFromCssUnit function', () => {
|
|
146
|
+
// Skip this test it might be useful in dev.
|
|
147
|
+
it.skip( 'test performance of memoizedGetPxFromCssUnit function', () => {
|
|
188
148
|
const start = Date.now();
|
|
189
149
|
let i = 0;
|
|
190
150
|
const intervals = 1000;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = TextDecorationAndTransformEdit;
|
|
7
|
-
|
|
8
|
-
var _element = require("@wordpress/element");
|
|
9
|
-
|
|
10
|
-
var _textDecoration = require("../../hooks/text-decoration");
|
|
11
|
-
|
|
12
|
-
var _textTransform = require("../../hooks/text-transform");
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Internal dependencies
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Handles grouping related text decoration and text transform edit components
|
|
20
|
-
* so they can be laid out in a more flexible manner within the Typography
|
|
21
|
-
* InspectorControls panel.
|
|
22
|
-
*
|
|
23
|
-
* @param {Object} props Block props to be passed on to individual controls.
|
|
24
|
-
*
|
|
25
|
-
* @return {WPElement} Component containing text decoration or transform controls.
|
|
26
|
-
*/
|
|
27
|
-
function TextDecorationAndTransformEdit(props) {
|
|
28
|
-
const decorationAvailable = !(0, _textDecoration.useIsTextDecorationDisabled)(props);
|
|
29
|
-
const transformAvailable = !(0, _textTransform.useIsTextTransformDisabled)(props);
|
|
30
|
-
|
|
31
|
-
if (!decorationAvailable && !transformAvailable) {
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return (0, _element.createElement)("div", {
|
|
36
|
-
className: "block-editor-text-decoration-and-transform"
|
|
37
|
-
}, decorationAvailable && (0, _element.createElement)(_textDecoration.TextDecorationEdit, props), transformAvailable && (0, _element.createElement)(_textTransform.TextTransformEdit, props));
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/text-decoration-and-transform/index.js"],"names":["TextDecorationAndTransformEdit","props","decorationAvailable","transformAvailable"],"mappings":";;;;;;;;;AAGA;;AAIA;;AAPA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,8BAAT,CAAyCC,KAAzC,EAAiD;AAC/D,QAAMC,mBAAmB,GAAG,CAAE,iDAA6BD,KAA7B,CAA9B;AACA,QAAME,kBAAkB,GAAG,CAAE,+CAA4BF,KAA5B,CAA7B;;AAEA,MAAK,CAAEC,mBAAF,IAAyB,CAAEC,kBAAhC,EAAqD;AACpD,WAAO,IAAP;AACA;;AAED,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGD,mBAAmB,IAAI,4BAAC,kCAAD,EAAyBD,KAAzB,CAD1B,EAEGE,kBAAkB,IAAI,4BAAC,gCAAD,EAAwBF,KAAxB,CAFzB,CADD;AAMA","sourcesContent":["/**\n * Internal dependencies\n */\nimport {\n\tTextDecorationEdit,\n\tuseIsTextDecorationDisabled,\n} from '../../hooks/text-decoration';\nimport {\n\tTextTransformEdit,\n\tuseIsTextTransformDisabled,\n} from '../../hooks/text-transform';\n\n/**\n * Handles grouping related text decoration and text transform edit components\n * so they can be laid out in a more flexible manner within the Typography\n * InspectorControls panel.\n *\n * @param {Object} props Block props to be passed on to individual controls.\n *\n * @return {WPElement} Component containing text decoration or transform controls.\n */\nexport default function TextDecorationAndTransformEdit( props ) {\n\tconst decorationAvailable = ! useIsTextDecorationDisabled( props );\n\tconst transformAvailable = ! useIsTextTransformDisabled( props );\n\n\tif ( ! decorationAvailable && ! transformAvailable ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div className=\"block-editor-text-decoration-and-transform\">\n\t\t\t{ decorationAvailable && <TextDecorationEdit { ...props } /> }\n\t\t\t{ transformAvailable && <TextTransformEdit { ...props } /> }\n\t\t</div>\n\t);\n}\n"]}
|
package/build/store/controls.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.__unstableMarkAutomaticChangeFinalControl = void 0;
|
|
7
|
-
|
|
8
|
-
var _data = require("@wordpress/data");
|
|
9
|
-
|
|
10
|
-
var _store = require("../store");
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* WordPress dependencies
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Internal dependencies
|
|
18
|
-
*/
|
|
19
|
-
const __unstableMarkAutomaticChangeFinalControl = function () {
|
|
20
|
-
return {
|
|
21
|
-
type: 'MARK_AUTOMATIC_CHANGE_FINAL_CONTROL'
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
exports.__unstableMarkAutomaticChangeFinalControl = __unstableMarkAutomaticChangeFinalControl;
|
|
26
|
-
const controls = {
|
|
27
|
-
SLEEP({
|
|
28
|
-
duration
|
|
29
|
-
}) {
|
|
30
|
-
return new Promise(resolve => {
|
|
31
|
-
setTimeout(resolve, duration);
|
|
32
|
-
});
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
MARK_AUTOMATIC_CHANGE_FINAL_CONTROL: (0, _data.createRegistryControl)(registry => () => {
|
|
36
|
-
const {
|
|
37
|
-
requestIdleCallback = callback => setTimeout(callback, 100)
|
|
38
|
-
} = window;
|
|
39
|
-
requestIdleCallback(() => registry.dispatch(_store.store).__unstableMarkAutomaticChangeFinal());
|
|
40
|
-
})
|
|
41
|
-
};
|
|
42
|
-
var _default = controls;
|
|
43
|
-
exports.default = _default;
|
|
44
|
-
//# sourceMappingURL=controls.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/store/controls.js"],"names":["__unstableMarkAutomaticChangeFinalControl","type","controls","SLEEP","duration","Promise","resolve","setTimeout","MARK_AUTOMATIC_CHANGE_FINAL_CONTROL","registry","requestIdleCallback","callback","window","dispatch","blockEditorStore","__unstableMarkAutomaticChangeFinal"],"mappings":";;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAGO,MAAMA,yCAAyC,GAAG,YAAY;AACpE,SAAO;AACNC,IAAAA,IAAI,EAAE;AADA,GAAP;AAGA,CAJM;;;AAMP,MAAMC,QAAQ,GAAG;AAChBC,EAAAA,KAAK,CAAE;AAAEC,IAAAA;AAAF,GAAF,EAAiB;AACrB,WAAO,IAAIC,OAAJ,CAAeC,OAAF,IAAe;AAClCC,MAAAA,UAAU,CAAED,OAAF,EAAWF,QAAX,CAAV;AACA,KAFM,CAAP;AAGA,GALe;;AAOhBI,EAAAA,mCAAmC,EAAE,iCAClCC,QAAF,IAAgB,MAAM;AACrB,UAAM;AACLC,MAAAA,mBAAmB,GAAKC,QAAF,IACrBJ,UAAU,CAAEI,QAAF,EAAY,GAAZ;AAFN,QAGFC,MAHJ;AAIAF,IAAAA,mBAAmB,CAAE,MACpBD,QAAQ,CACNI,QADF,CACYC,YADZ,EAEEC,kCAFF,EADkB,CAAnB;AAKA,GAXmC;AAPrB,CAAjB;eAsBeb,Q","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createRegistryControl } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\n\nexport const __unstableMarkAutomaticChangeFinalControl = function () {\n\treturn {\n\t\ttype: 'MARK_AUTOMATIC_CHANGE_FINAL_CONTROL',\n\t};\n};\n\nconst controls = {\n\tSLEEP( { duration } ) {\n\t\treturn new Promise( ( resolve ) => {\n\t\t\tsetTimeout( resolve, duration );\n\t\t} );\n\t},\n\n\tMARK_AUTOMATIC_CHANGE_FINAL_CONTROL: createRegistryControl(\n\t\t( registry ) => () => {\n\t\t\tconst {\n\t\t\t\trequestIdleCallback = ( callback ) =>\n\t\t\t\t\tsetTimeout( callback, 100 ),\n\t\t\t} = window;\n\t\t\trequestIdleCallback( () =>\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( blockEditorStore )\n\t\t\t\t\t.__unstableMarkAutomaticChangeFinal()\n\t\t\t);\n\t\t}\n\t),\n};\n\nexport default controls;\n"]}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Internal dependencies
|
|
5
|
-
*/
|
|
6
|
-
import { TextDecorationEdit, useIsTextDecorationDisabled } from '../../hooks/text-decoration';
|
|
7
|
-
import { TextTransformEdit, useIsTextTransformDisabled } from '../../hooks/text-transform';
|
|
8
|
-
/**
|
|
9
|
-
* Handles grouping related text decoration and text transform edit components
|
|
10
|
-
* so they can be laid out in a more flexible manner within the Typography
|
|
11
|
-
* InspectorControls panel.
|
|
12
|
-
*
|
|
13
|
-
* @param {Object} props Block props to be passed on to individual controls.
|
|
14
|
-
*
|
|
15
|
-
* @return {WPElement} Component containing text decoration or transform controls.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
export default function TextDecorationAndTransformEdit(props) {
|
|
19
|
-
const decorationAvailable = !useIsTextDecorationDisabled(props);
|
|
20
|
-
const transformAvailable = !useIsTextTransformDisabled(props);
|
|
21
|
-
|
|
22
|
-
if (!decorationAvailable && !transformAvailable) {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return createElement("div", {
|
|
27
|
-
className: "block-editor-text-decoration-and-transform"
|
|
28
|
-
}, decorationAvailable && createElement(TextDecorationEdit, props), transformAvailable && createElement(TextTransformEdit, props));
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/text-decoration-and-transform/index.js"],"names":["TextDecorationEdit","useIsTextDecorationDisabled","TextTransformEdit","useIsTextTransformDisabled","TextDecorationAndTransformEdit","props","decorationAvailable","transformAvailable"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,kBADD,EAECC,2BAFD,QAGO,6BAHP;AAIA,SACCC,iBADD,EAECC,0BAFD,QAGO,4BAHP;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,8BAAT,CAAyCC,KAAzC,EAAiD;AAC/D,QAAMC,mBAAmB,GAAG,CAAEL,2BAA2B,CAAEI,KAAF,CAAzD;AACA,QAAME,kBAAkB,GAAG,CAAEJ,0BAA0B,CAAEE,KAAF,CAAvD;;AAEA,MAAK,CAAEC,mBAAF,IAAyB,CAAEC,kBAAhC,EAAqD;AACpD,WAAO,IAAP;AACA;;AAED,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGD,mBAAmB,IAAI,cAAC,kBAAD,EAAyBD,KAAzB,CAD1B,EAEGE,kBAAkB,IAAI,cAAC,iBAAD,EAAwBF,KAAxB,CAFzB,CADD;AAMA","sourcesContent":["/**\n * Internal dependencies\n */\nimport {\n\tTextDecorationEdit,\n\tuseIsTextDecorationDisabled,\n} from '../../hooks/text-decoration';\nimport {\n\tTextTransformEdit,\n\tuseIsTextTransformDisabled,\n} from '../../hooks/text-transform';\n\n/**\n * Handles grouping related text decoration and text transform edit components\n * so they can be laid out in a more flexible manner within the Typography\n * InspectorControls panel.\n *\n * @param {Object} props Block props to be passed on to individual controls.\n *\n * @return {WPElement} Component containing text decoration or transform controls.\n */\nexport default function TextDecorationAndTransformEdit( props ) {\n\tconst decorationAvailable = ! useIsTextDecorationDisabled( props );\n\tconst transformAvailable = ! useIsTextTransformDisabled( props );\n\n\tif ( ! decorationAvailable && ! transformAvailable ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div className=\"block-editor-text-decoration-and-transform\">\n\t\t\t{ decorationAvailable && <TextDecorationEdit { ...props } /> }\n\t\t\t{ transformAvailable && <TextTransformEdit { ...props } /> }\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { createRegistryControl } from '@wordpress/data';
|
|
5
|
-
/**
|
|
6
|
-
* Internal dependencies
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { store as blockEditorStore } from '../store';
|
|
10
|
-
export const __unstableMarkAutomaticChangeFinalControl = function () {
|
|
11
|
-
return {
|
|
12
|
-
type: 'MARK_AUTOMATIC_CHANGE_FINAL_CONTROL'
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
const controls = {
|
|
16
|
-
SLEEP({
|
|
17
|
-
duration
|
|
18
|
-
}) {
|
|
19
|
-
return new Promise(resolve => {
|
|
20
|
-
setTimeout(resolve, duration);
|
|
21
|
-
});
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
MARK_AUTOMATIC_CHANGE_FINAL_CONTROL: createRegistryControl(registry => () => {
|
|
25
|
-
const {
|
|
26
|
-
requestIdleCallback = callback => setTimeout(callback, 100)
|
|
27
|
-
} = window;
|
|
28
|
-
requestIdleCallback(() => registry.dispatch(blockEditorStore).__unstableMarkAutomaticChangeFinal());
|
|
29
|
-
})
|
|
30
|
-
};
|
|
31
|
-
export default controls;
|
|
32
|
-
//# sourceMappingURL=controls.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/store/controls.js"],"names":["createRegistryControl","store","blockEditorStore","__unstableMarkAutomaticChangeFinalControl","type","controls","SLEEP","duration","Promise","resolve","setTimeout","MARK_AUTOMATIC_CHANGE_FINAL_CONTROL","registry","requestIdleCallback","callback","window","dispatch","__unstableMarkAutomaticChangeFinal"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,qBAAT,QAAsC,iBAAtC;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,UAA1C;AAEA,OAAO,MAAMC,yCAAyC,GAAG,YAAY;AACpE,SAAO;AACNC,IAAAA,IAAI,EAAE;AADA,GAAP;AAGA,CAJM;AAMP,MAAMC,QAAQ,GAAG;AAChBC,EAAAA,KAAK,CAAE;AAAEC,IAAAA;AAAF,GAAF,EAAiB;AACrB,WAAO,IAAIC,OAAJ,CAAeC,OAAF,IAAe;AAClCC,MAAAA,UAAU,CAAED,OAAF,EAAWF,QAAX,CAAV;AACA,KAFM,CAAP;AAGA,GALe;;AAOhBI,EAAAA,mCAAmC,EAAEX,qBAAqB,CACvDY,QAAF,IAAgB,MAAM;AACrB,UAAM;AACLC,MAAAA,mBAAmB,GAAKC,QAAF,IACrBJ,UAAU,CAAEI,QAAF,EAAY,GAAZ;AAFN,QAGFC,MAHJ;AAIAF,IAAAA,mBAAmB,CAAE,MACpBD,QAAQ,CACNI,QADF,CACYd,gBADZ,EAEEe,kCAFF,EADkB,CAAnB;AAKA,GAXwD;AAP1C,CAAjB;AAsBA,eAAeZ,QAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createRegistryControl } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\n\nexport const __unstableMarkAutomaticChangeFinalControl = function () {\n\treturn {\n\t\ttype: 'MARK_AUTOMATIC_CHANGE_FINAL_CONTROL',\n\t};\n};\n\nconst controls = {\n\tSLEEP( { duration } ) {\n\t\treturn new Promise( ( resolve ) => {\n\t\t\tsetTimeout( resolve, duration );\n\t\t} );\n\t},\n\n\tMARK_AUTOMATIC_CHANGE_FINAL_CONTROL: createRegistryControl(\n\t\t( registry ) => () => {\n\t\t\tconst {\n\t\t\t\trequestIdleCallback = ( callback ) =>\n\t\t\t\t\tsetTimeout( callback, 100 ),\n\t\t\t} = window;\n\t\t\trequestIdleCallback( () =>\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( blockEditorStore )\n\t\t\t\t\t.__unstableMarkAutomaticChangeFinal()\n\t\t\t);\n\t\t}\n\t),\n};\n\nexport default controls;\n"]}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal dependencies
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
TextDecorationEdit,
|
|
6
|
-
useIsTextDecorationDisabled,
|
|
7
|
-
} from '../../hooks/text-decoration';
|
|
8
|
-
import {
|
|
9
|
-
TextTransformEdit,
|
|
10
|
-
useIsTextTransformDisabled,
|
|
11
|
-
} from '../../hooks/text-transform';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Handles grouping related text decoration and text transform edit components
|
|
15
|
-
* so they can be laid out in a more flexible manner within the Typography
|
|
16
|
-
* InspectorControls panel.
|
|
17
|
-
*
|
|
18
|
-
* @param {Object} props Block props to be passed on to individual controls.
|
|
19
|
-
*
|
|
20
|
-
* @return {WPElement} Component containing text decoration or transform controls.
|
|
21
|
-
*/
|
|
22
|
-
export default function TextDecorationAndTransformEdit( props ) {
|
|
23
|
-
const decorationAvailable = ! useIsTextDecorationDisabled( props );
|
|
24
|
-
const transformAvailable = ! useIsTextTransformDisabled( props );
|
|
25
|
-
|
|
26
|
-
if ( ! decorationAvailable && ! transformAvailable ) {
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
<div className="block-editor-text-decoration-and-transform">
|
|
32
|
-
{ decorationAvailable && <TextDecorationEdit { ...props } /> }
|
|
33
|
-
{ transformAvailable && <TextTransformEdit { ...props } /> }
|
|
34
|
-
</div>
|
|
35
|
-
);
|
|
36
|
-
}
|