@wordpress/block-editor 12.12.0 → 12.13.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 +12 -10
- package/README.md +35 -3
- package/build/components/block-alignment-control/use-available-alignments.js +30 -28
- package/build/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build/components/block-list/block.native.js +4 -4
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/layout.js +2 -3
- package/build/components/block-list/layout.js.map +1 -1
- package/build/components/border-radius-control/index.js +3 -2
- package/build/components/border-radius-control/index.js.map +1 -1
- package/build/components/color-palette/with-color-context.js +6 -6
- package/build/components/color-palette/with-color-context.js.map +1 -1
- package/build/components/colors/with-colors.js +2 -8
- package/build/components/colors/with-colors.js.map +1 -1
- package/build/components/colors-gradients/control.js +6 -7
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +5 -13
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build/components/font-family/index.js +2 -3
- package/build/components/font-family/index.js.map +1 -1
- package/build/components/font-sizes/font-size-picker.js +3 -5
- package/build/components/font-sizes/font-size-picker.js.map +1 -1
- package/build/components/font-sizes/with-font-sizes.js +3 -4
- package/build/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build/components/global-styles/filters-panel.js +7 -8
- package/build/components/global-styles/filters-panel.js.map +1 -1
- package/build/components/global-styles/image-settings-panel.js +2 -2
- package/build/components/global-styles/image-settings-panel.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +1 -1
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/gradients/use-gradient.js +2 -5
- package/build/components/gradients/use-gradient.js.map +1 -1
- package/build/components/height-control/index.js +3 -3
- package/build/components/height-control/index.js.map +1 -1
- package/build/components/index.js +9 -2
- package/build/components/index.js.map +1 -1
- package/build/components/index.native.js +9 -2
- package/build/components/index.native.js.map +1 -1
- package/build/components/inner-blocks/index.js +2 -2
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/letter-spacing-control/index.js +3 -3
- package/build/components/letter-spacing-control/index.js.map +1 -1
- package/build/components/link-control/search-item.js +11 -0
- package/build/components/link-control/search-item.js.map +1 -1
- package/build/components/link-control/search-results.js +2 -1
- package/build/components/link-control/search-results.js.map +1 -1
- package/build/components/link-control/use-search-handler.js +10 -5
- package/build/components/link-control/use-search-handler.js.map +1 -1
- package/build/components/resizable-box-popover/index.js +1 -1
- package/build/components/resizable-box-popover/index.js.map +1 -1
- package/build/components/rich-text/index.js +1 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.js +6 -3
- package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +3 -3
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/unit-control/index.js +3 -3
- package/build/components/unit-control/index.js.map +1 -1
- package/build/components/use-block-commands/index.js +6 -1
- package/build/components/use-block-commands/index.js.map +1 -1
- package/build/components/use-settings/index.js +212 -0
- package/build/components/use-settings/index.js.map +1 -0
- package/build/hooks/align.js +51 -35
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/anchor.js +37 -32
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/background.js +4 -4
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/color.js +2 -4
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/duotone.js +10 -9
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/font-size.js +4 -4
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/layout.js +10 -11
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/line-height.js +3 -3
- package/build/hooks/line-height.js.map +1 -1
- package/build/hooks/position.js +2 -3
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/use-color-props.js +3 -11
- package/build/hooks/use-color-props.js.map +1 -1
- package/build/hooks/utils.js +1 -42
- package/build/hooks/utils.js.map +1 -1
- package/build/layouts/constrained.js +3 -3
- package/build/layouts/constrained.js.map +1 -1
- package/build/utils/object.js +4 -1
- package/build/utils/object.js.map +1 -1
- package/build/utils/transform-styles/index.js +19 -24
- package/build/utils/transform-styles/index.js.map +1 -1
- package/build-module/components/block-alignment-control/use-available-alignments.js +30 -28
- package/build-module/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build-module/components/block-list/block.native.js +4 -4
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/layout.js +2 -2
- package/build-module/components/block-list/layout.js.map +1 -1
- package/build-module/components/border-radius-control/index.js +3 -2
- package/build-module/components/border-radius-control/index.js.map +1 -1
- package/build-module/components/color-palette/with-color-context.js +6 -5
- package/build-module/components/color-palette/with-color-context.js.map +1 -1
- package/build-module/components/colors/with-colors.js +2 -7
- package/build-module/components/colors/with-colors.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +6 -7
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +5 -12
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build-module/components/font-family/index.js +2 -2
- package/build-module/components/font-family/index.js.map +1 -1
- package/build-module/components/font-sizes/font-size-picker.js +3 -4
- package/build-module/components/font-sizes/font-size-picker.js.map +1 -1
- package/build-module/components/font-sizes/with-font-sizes.js +3 -3
- package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build-module/components/global-styles/filters-panel.js +7 -8
- package/build-module/components/global-styles/filters-panel.js.map +1 -1
- package/build-module/components/global-styles/image-settings-panel.js +2 -2
- package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +1 -1
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/gradients/use-gradient.js +2 -4
- package/build-module/components/gradients/use-gradient.js.map +1 -1
- package/build-module/components/height-control/index.js +3 -2
- package/build-module/components/height-control/index.js.map +1 -1
- package/build-module/components/index.js +1 -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 +2 -2
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/letter-spacing-control/index.js +3 -2
- package/build-module/components/letter-spacing-control/index.js.map +1 -1
- package/build-module/components/link-control/search-item.js +12 -1
- package/build-module/components/link-control/search-item.js.map +1 -1
- package/build-module/components/link-control/search-results.js +2 -1
- package/build-module/components/link-control/search-results.js.map +1 -1
- package/build-module/components/link-control/use-search-handler.js +10 -5
- package/build-module/components/link-control/use-search-handler.js.map +1 -1
- package/build-module/components/resizable-box-popover/index.js +1 -1
- package/build-module/components/resizable-box-popover/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +1 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js +6 -2
- package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +3 -2
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/unit-control/index.js +3 -2
- package/build-module/components/unit-control/index.js.map +1 -1
- package/build-module/components/use-block-commands/index.js +5 -1
- package/build-module/components/use-block-commands/index.js.map +1 -1
- package/build-module/components/use-settings/index.js +203 -0
- package/build-module/components/use-settings/index.js.map +1 -0
- package/build-module/hooks/align.js +51 -35
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/anchor.js +37 -32
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/background.js +4 -4
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/color.js +2 -4
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/duotone.js +11 -10
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/font-size.js +4 -4
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/layout.js +10 -11
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/line-height.js +3 -3
- package/build-module/hooks/line-height.js.map +1 -1
- package/build-module/hooks/position.js +2 -3
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/use-color-props.js +3 -11
- package/build-module/hooks/use-color-props.js.map +1 -1
- package/build-module/hooks/utils.js +2 -43
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/layouts/constrained.js +3 -2
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/utils/object.js +3 -1
- package/build-module/utils/object.js.map +1 -1
- package/build-module/utils/transform-styles/index.js +20 -24
- package/build-module/utils/transform-styles/index.js.map +1 -1
- package/build-style/style-rtl.css +13 -6
- package/build-style/style.css +13 -6
- package/package.json +36 -34
- package/src/components/block-alignment-control/use-available-alignments.js +49 -34
- package/src/components/block-list/block.native.js +4 -4
- package/src/components/block-list/layout.js +2 -2
- package/src/components/block-styles/style.scss +1 -1
- package/src/components/border-radius-control/index.js +3 -2
- package/src/components/color-palette/with-color-context.js +9 -9
- package/src/components/colors/with-colors.js +6 -7
- package/src/components/colors-gradients/control.js +10 -7
- package/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +29 -15
- package/src/components/font-family/index.js +2 -2
- package/src/components/font-sizes/font-size-picker.js +6 -4
- package/src/components/font-sizes/with-font-sizes.js +3 -5
- package/src/components/global-styles/filters-panel.js +9 -15
- package/src/components/global-styles/image-settings-panel.js +2 -2
- package/src/components/global-styles/typography-panel.js +1 -1
- package/src/components/gradients/use-gradient.js +10 -4
- package/src/components/height-control/index.js +3 -2
- package/src/components/index.js +1 -1
- package/src/components/index.native.js +1 -1
- package/src/components/inner-blocks/index.js +2 -2
- package/src/components/inserter/style.scss +9 -1
- package/src/components/letter-spacing-control/index.js +3 -2
- package/src/components/link-control/search-item.js +14 -0
- package/src/components/link-control/search-results.js +1 -0
- package/src/components/link-control/use-search-handler.js +22 -15
- package/src/components/resizable-box-popover/index.js +1 -1
- package/src/components/rich-text/index.js +1 -1
- package/src/components/spacing-sizes-control/hooks/use-spacing-sizes.js +7 -5
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +3 -2
- package/src/components/unit-control/index.js +3 -8
- package/src/components/use-block-commands/index.js +2 -1
- package/src/components/{use-setting → use-settings}/README.md +9 -10
- package/src/components/use-settings/index.js +272 -0
- package/src/components/{use-setting → use-settings}/test/index.js +47 -5
- package/src/hooks/align.js +79 -54
- package/src/hooks/anchor.js +75 -65
- package/src/hooks/background.js +7 -9
- package/src/hooks/color.js +7 -4
- package/src/hooks/duotone.js +24 -19
- package/src/hooks/font-size.js +4 -4
- package/src/hooks/layout.js +11 -11
- package/src/hooks/line-height.js +3 -3
- package/src/hooks/position.js +5 -3
- package/src/hooks/use-color-props.js +21 -14
- package/src/hooks/utils.js +88 -43
- package/src/layouts/constrained.js +3 -8
- package/src/utils/object.js +4 -1
- package/src/utils/test/__snapshots__/transform-styles.js.snap +103 -0
- package/src/utils/test/transform-styles.js +217 -0
- package/src/utils/transform-styles/index.js +25 -25
- package/build/components/use-setting/index.js +0 -161
- package/build/components/use-setting/index.js.map +0 -1
- package/build/utils/transform-styles/ast/index.js +0 -21
- package/build/utils/transform-styles/ast/index.js.map +0 -1
- package/build/utils/transform-styles/ast/parse.js +0 -660
- package/build/utils/transform-styles/ast/parse.js.map +0 -1
- package/build/utils/transform-styles/ast/stringify/compiler.js +0 -52
- package/build/utils/transform-styles/ast/stringify/compiler.js.map +0 -1
- package/build/utils/transform-styles/ast/stringify/compress.js +0 -178
- package/build/utils/transform-styles/ast/stringify/compress.js.map +0 -1
- package/build/utils/transform-styles/ast/stringify/identity.js +0 -207
- package/build/utils/transform-styles/ast/stringify/identity.js.map +0 -1
- package/build/utils/transform-styles/ast/stringify/index.js +0 -36
- package/build/utils/transform-styles/ast/stringify/index.js.map +0 -1
- package/build/utils/transform-styles/transforms/url-rewrite.js +0 -130
- package/build/utils/transform-styles/transforms/url-rewrite.js.map +0 -1
- package/build/utils/transform-styles/transforms/wrap.js +0 -59
- package/build/utils/transform-styles/transforms/wrap.js.map +0 -1
- package/build/utils/transform-styles/traverse.js +0 -37
- package/build/utils/transform-styles/traverse.js.map +0 -1
- package/build-module/components/use-setting/index.js +0 -154
- package/build-module/components/use-setting/index.js.map +0 -1
- package/build-module/utils/transform-styles/ast/index.js +0 -6
- package/build-module/utils/transform-styles/ast/index.js.map +0 -1
- package/build-module/utils/transform-styles/ast/parse.js +0 -654
- package/build-module/utils/transform-styles/ast/parse.js.map +0 -1
- package/build-module/utils/transform-styles/ast/stringify/compiler.js +0 -49
- package/build-module/utils/transform-styles/ast/stringify/compiler.js.map +0 -1
- package/build-module/utils/transform-styles/ast/stringify/compress.js +0 -176
- package/build-module/utils/transform-styles/ast/stringify/compress.js.map +0 -1
- package/build-module/utils/transform-styles/ast/stringify/identity.js +0 -206
- package/build-module/utils/transform-styles/ast/stringify/identity.js.map +0 -1
- package/build-module/utils/transform-styles/ast/stringify/index.js +0 -29
- package/build-module/utils/transform-styles/ast/stringify/index.js.map +0 -1
- package/build-module/utils/transform-styles/transforms/url-rewrite.js +0 -123
- package/build-module/utils/transform-styles/transforms/url-rewrite.js.map +0 -1
- package/build-module/utils/transform-styles/transforms/wrap.js +0 -52
- package/build-module/utils/transform-styles/transforms/wrap.js.map +0 -1
- package/build-module/utils/transform-styles/traverse.js +0 -28
- package/build-module/utils/transform-styles/traverse.js.map +0 -1
- package/src/components/use-setting/index.js +0 -218
- package/src/utils/transform-styles/ast/index.js +0 -5
- package/src/utils/transform-styles/ast/parse.js +0 -732
- package/src/utils/transform-styles/ast/stringify/compiler.js +0 -50
- package/src/utils/transform-styles/ast/stringify/compress.js +0 -238
- package/src/utils/transform-styles/ast/stringify/identity.js +0 -286
- package/src/utils/transform-styles/ast/stringify/index.js +0 -32
- package/src/utils/transform-styles/test/__snapshots__/traverse.js.snap +0 -7
- package/src/utils/transform-styles/test/traverse.js +0 -24
- package/src/utils/transform-styles/transforms/test/__snapshots__/url-rewrite.js.snap +0 -25
- package/src/utils/transform-styles/transforms/test/__snapshots__/wrap.js.snap +0 -64
- package/src/utils/transform-styles/transforms/test/url-rewrite.js +0 -39
- package/src/utils/transform-styles/transforms/test/wrap.js +0 -95
- package/src/utils/transform-styles/transforms/url-rewrite.js +0 -139
- package/src/utils/transform-styles/transforms/wrap.js +0 -56
- package/src/utils/transform-styles/traverse.js +0 -32
package/src/hooks/background.js
CHANGED
|
@@ -29,7 +29,7 @@ import { getFilename } from '@wordpress/url';
|
|
|
29
29
|
*/
|
|
30
30
|
import InspectorControls from '../components/inspector-controls';
|
|
31
31
|
import MediaReplaceFlow from '../components/media-replace-flow';
|
|
32
|
-
import
|
|
32
|
+
import { useSettings } from '../components/use-settings';
|
|
33
33
|
import { cleanEmptyObject } from './utils';
|
|
34
34
|
import { store as blockEditorStore } from '../store';
|
|
35
35
|
|
|
@@ -281,19 +281,17 @@ function BackgroundImagePanelItem( props ) {
|
|
|
281
281
|
}
|
|
282
282
|
|
|
283
283
|
export function BackgroundImagePanel( props ) {
|
|
284
|
-
const
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
284
|
+
const [ backgroundImage ] = useSettings( 'background.backgroundImage' );
|
|
285
|
+
if (
|
|
286
|
+
! backgroundImage ||
|
|
287
|
+
! hasBackgroundSupport( props.name, 'backgroundImage' )
|
|
288
|
+
) {
|
|
289
289
|
return null;
|
|
290
290
|
}
|
|
291
291
|
|
|
292
292
|
return (
|
|
293
293
|
<InspectorControls group="background">
|
|
294
|
-
{
|
|
295
|
-
<BackgroundImagePanelItem { ...props } />
|
|
296
|
-
) }
|
|
294
|
+
<BackgroundImagePanelItem { ...props } />
|
|
297
295
|
</InspectorControls>
|
|
298
296
|
);
|
|
299
297
|
}
|
package/src/hooks/color.js
CHANGED
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
shouldSkipSerialization,
|
|
26
26
|
useBlockSettings,
|
|
27
27
|
} from './utils';
|
|
28
|
-
import
|
|
28
|
+
import { useSettings } from '../components/use-settings';
|
|
29
29
|
import InspectorControls from '../components/inspector-controls';
|
|
30
30
|
import {
|
|
31
31
|
useHasColorPanel,
|
|
@@ -368,9 +368,12 @@ export const withColorPaletteStyles = createHigherOrderComponent(
|
|
|
368
368
|
( BlockListBlock ) => ( props ) => {
|
|
369
369
|
const { name, attributes } = props;
|
|
370
370
|
const { backgroundColor, textColor } = attributes;
|
|
371
|
-
const userPalette =
|
|
372
|
-
|
|
373
|
-
|
|
371
|
+
const [ userPalette, themePalette, defaultPalette ] = useSettings(
|
|
372
|
+
'color.palette.custom',
|
|
373
|
+
'color.palette.theme',
|
|
374
|
+
'color.palette.default'
|
|
375
|
+
);
|
|
376
|
+
|
|
374
377
|
const colors = useMemo(
|
|
375
378
|
() => [
|
|
376
379
|
...( userPalette || [] ),
|
package/src/hooks/duotone.js
CHANGED
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
BlockControls,
|
|
26
26
|
InspectorControls,
|
|
27
27
|
__experimentalDuotoneControl as DuotoneControl,
|
|
28
|
-
|
|
28
|
+
useSettings,
|
|
29
29
|
} from '../components';
|
|
30
30
|
import {
|
|
31
31
|
getDuotoneFilter,
|
|
@@ -56,20 +56,20 @@ const isSafari =
|
|
|
56
56
|
extend( [ namesPlugin ] );
|
|
57
57
|
|
|
58
58
|
function useMultiOriginPresets( { presetSetting, defaultSetting } ) {
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
const [ enableDefault, userPresets, themePresets, defaultPresets ] =
|
|
60
|
+
useSettings(
|
|
61
|
+
defaultSetting,
|
|
62
|
+
`${ presetSetting }.custom`,
|
|
63
|
+
`${ presetSetting }.theme`,
|
|
64
|
+
`${ presetSetting }.default`
|
|
65
|
+
);
|
|
66
66
|
return useMemo(
|
|
67
67
|
() => [
|
|
68
|
-
...userPresets,
|
|
69
|
-
...themePresets,
|
|
70
|
-
...(
|
|
68
|
+
...( userPresets || EMPTY_ARRAY ),
|
|
69
|
+
...( themePresets || EMPTY_ARRAY ),
|
|
70
|
+
...( ( enableDefault && defaultPresets ) || EMPTY_ARRAY ),
|
|
71
71
|
],
|
|
72
|
-
[
|
|
72
|
+
[ enableDefault, userPresets, themePresets, defaultPresets ]
|
|
73
73
|
);
|
|
74
74
|
}
|
|
75
75
|
|
|
@@ -102,6 +102,7 @@ function DuotonePanel( { attributes, setAttributes, name } ) {
|
|
|
102
102
|
const style = attributes?.style;
|
|
103
103
|
const duotoneStyle = style?.color?.duotone;
|
|
104
104
|
const settings = useBlockSettings( name );
|
|
105
|
+
const blockEditingMode = useBlockEditingMode();
|
|
105
106
|
|
|
106
107
|
const duotonePalette = useMultiOriginPresets( {
|
|
107
108
|
presetSetting: 'color.duotone',
|
|
@@ -111,15 +112,23 @@ function DuotonePanel( { attributes, setAttributes, name } ) {
|
|
|
111
112
|
presetSetting: 'color.palette',
|
|
112
113
|
defaultSetting: 'color.defaultPalette',
|
|
113
114
|
} );
|
|
114
|
-
const
|
|
115
|
+
const [ enableCustomColors, enableCustomDuotone ] = useSettings(
|
|
116
|
+
'color.custom',
|
|
117
|
+
'color.customDuotone'
|
|
118
|
+
);
|
|
119
|
+
const disableCustomColors = ! enableCustomColors;
|
|
115
120
|
const disableCustomDuotone =
|
|
116
|
-
!
|
|
121
|
+
! enableCustomDuotone ||
|
|
117
122
|
( colorPalette?.length === 0 && disableCustomColors );
|
|
118
123
|
|
|
119
124
|
if ( duotonePalette?.length === 0 && disableCustomDuotone ) {
|
|
120
125
|
return null;
|
|
121
126
|
}
|
|
122
127
|
|
|
128
|
+
if ( blockEditingMode !== 'default' ) {
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
|
|
123
132
|
const duotonePresetOrColors = ! Array.isArray( duotoneStyle )
|
|
124
133
|
? getColorsFromDuotonePreset( duotoneStyle, duotonePalette )
|
|
125
134
|
: duotoneStyle;
|
|
@@ -215,17 +224,13 @@ const withDuotoneControls = createHigherOrderComponent(
|
|
|
215
224
|
'filter.duotone'
|
|
216
225
|
);
|
|
217
226
|
|
|
218
|
-
const blockEditingMode = useBlockEditingMode();
|
|
219
|
-
|
|
220
227
|
// CAUTION: code added before this line will be executed
|
|
221
228
|
// for all blocks, not just those that support duotone. Code added
|
|
222
229
|
// above this line should be carefully evaluated for its impact on
|
|
223
230
|
// performance.
|
|
224
231
|
return (
|
|
225
232
|
<>
|
|
226
|
-
{ hasDuotoneSupport &&
|
|
227
|
-
<DuotonePanel { ...props } />
|
|
228
|
-
) }
|
|
233
|
+
{ hasDuotoneSupport && <DuotonePanel { ...props } /> }
|
|
229
234
|
<BlockEdit { ...props } />
|
|
230
235
|
</>
|
|
231
236
|
);
|
package/src/hooks/font-size.js
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
transformStyles,
|
|
23
23
|
shouldSkipSerialization,
|
|
24
24
|
} from './utils';
|
|
25
|
-
import
|
|
25
|
+
import { useSettings } from '../components/use-settings';
|
|
26
26
|
import { store as blockEditorStore } from '../store';
|
|
27
27
|
import {
|
|
28
28
|
getTypographyFontSizeValue,
|
|
@@ -122,7 +122,7 @@ export function FontSizeEdit( props ) {
|
|
|
122
122
|
attributes: { fontSize, style },
|
|
123
123
|
setAttributes,
|
|
124
124
|
} = props;
|
|
125
|
-
const fontSizes =
|
|
125
|
+
const [ fontSizes ] = useSettings( 'typography.fontSizes' );
|
|
126
126
|
|
|
127
127
|
const onChange = ( value ) => {
|
|
128
128
|
const fontSizeSlug = getFontSizeObjectByValue( fontSizes, value ).slug;
|
|
@@ -167,7 +167,7 @@ export function FontSizeEdit( props ) {
|
|
|
167
167
|
* @return {boolean} Whether setting is disabled.
|
|
168
168
|
*/
|
|
169
169
|
export function useIsFontSizeDisabled( { name: blockName } = {} ) {
|
|
170
|
-
const fontSizes =
|
|
170
|
+
const [ fontSizes ] = useSettings( 'typography.fontSizes' );
|
|
171
171
|
const hasFontSizes = !! fontSizes?.length;
|
|
172
172
|
|
|
173
173
|
return (
|
|
@@ -186,7 +186,7 @@ export function useIsFontSizeDisabled( { name: blockName } = {} ) {
|
|
|
186
186
|
*/
|
|
187
187
|
const withFontSizeInlineStyles = createHigherOrderComponent(
|
|
188
188
|
( BlockListBlock ) => ( props ) => {
|
|
189
|
-
const fontSizes =
|
|
189
|
+
const [ fontSizes ] = useSettings( 'typography.fontSizes' );
|
|
190
190
|
const {
|
|
191
191
|
name: blockName,
|
|
192
192
|
attributes: { fontSize, style },
|
package/src/hooks/layout.js
CHANGED
|
@@ -24,7 +24,7 @@ import { useEffect } from '@wordpress/element';
|
|
|
24
24
|
*/
|
|
25
25
|
import { store as blockEditorStore } from '../store';
|
|
26
26
|
import { InspectorControls } from '../components';
|
|
27
|
-
import
|
|
27
|
+
import { useSettings } from '../components/use-settings';
|
|
28
28
|
import { getLayoutType, getLayoutTypes } from '../layouts';
|
|
29
29
|
import { useBlockEditingMode } from '../components/block-editing-mode';
|
|
30
30
|
import { LAYOUT_DEFINITIONS } from '../layouts/definitions';
|
|
@@ -123,7 +123,7 @@ export function useLayoutStyles( blockAttributes = {}, blockName, selector ) {
|
|
|
123
123
|
? { ...layout, type: 'constrained' }
|
|
124
124
|
: layout || {};
|
|
125
125
|
const fullLayoutType = getLayoutType( usedLayout?.type || 'default' );
|
|
126
|
-
const blockGapSupport =
|
|
126
|
+
const [ blockGapSupport ] = useSettings( 'spacing.blockGap' );
|
|
127
127
|
const hasBlockGapSupport = blockGapSupport !== null;
|
|
128
128
|
const css = fullLayoutType?.getLayoutStyle?.( {
|
|
129
129
|
blockName,
|
|
@@ -142,7 +142,7 @@ function LayoutPanel( { setAttributes, attributes, name: blockName } ) {
|
|
|
142
142
|
} = settings;
|
|
143
143
|
|
|
144
144
|
const { layout } = attributes;
|
|
145
|
-
const defaultThemeLayout =
|
|
145
|
+
const [ defaultThemeLayout ] = useSettings( 'layout' );
|
|
146
146
|
const { themeSupportsLayout } = useSelect( ( select ) => {
|
|
147
147
|
const { getSettings } = select( blockEditorStore );
|
|
148
148
|
return {
|
|
@@ -151,6 +151,10 @@ function LayoutPanel( { setAttributes, attributes, name: blockName } ) {
|
|
|
151
151
|
}, [] );
|
|
152
152
|
const blockEditingMode = useBlockEditingMode();
|
|
153
153
|
|
|
154
|
+
if ( blockEditingMode !== 'default' ) {
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
|
|
154
158
|
const layoutBlockSupport = getBlockSupport(
|
|
155
159
|
blockName,
|
|
156
160
|
layoutBlockSupportKey,
|
|
@@ -270,7 +274,7 @@ function LayoutPanel( { setAttributes, attributes, name: blockName } ) {
|
|
|
270
274
|
) }
|
|
271
275
|
</PanelBody>
|
|
272
276
|
</InspectorControls>
|
|
273
|
-
{ ! inherit &&
|
|
277
|
+
{ ! inherit && layoutType && (
|
|
274
278
|
<layoutType.toolBarControls
|
|
275
279
|
layout={ usedLayout }
|
|
276
280
|
onChange={ onChangeLayout }
|
|
@@ -331,14 +335,10 @@ export function addAttribute( settings ) {
|
|
|
331
335
|
*/
|
|
332
336
|
export const withInspectorControls = createHigherOrderComponent(
|
|
333
337
|
( BlockEdit ) => ( props ) => {
|
|
334
|
-
const
|
|
335
|
-
const supportLayout = hasLayoutBlockSupport( blockName );
|
|
338
|
+
const supportLayout = hasLayoutBlockSupport( props.name );
|
|
336
339
|
|
|
337
|
-
const blockEditingMode = useBlockEditingMode();
|
|
338
340
|
return [
|
|
339
|
-
supportLayout &&
|
|
340
|
-
<LayoutPanel key="layout" { ...props } />
|
|
341
|
-
),
|
|
341
|
+
supportLayout && <LayoutPanel key="layout" { ...props } />,
|
|
342
342
|
<BlockEdit key="edit" { ...props } />,
|
|
343
343
|
];
|
|
344
344
|
},
|
|
@@ -375,7 +375,7 @@ export const withLayoutStyles = createHigherOrderComponent(
|
|
|
375
375
|
: null;
|
|
376
376
|
// Higher specificity to override defaults from theme.json.
|
|
377
377
|
const selector = `.wp-container-${ id }.wp-container-${ id }`;
|
|
378
|
-
const blockGapSupport =
|
|
378
|
+
const [ blockGapSupport ] = useSettings( 'spacing.blockGap' );
|
|
379
379
|
const hasBlockGapSupport = blockGapSupport !== null;
|
|
380
380
|
|
|
381
381
|
// Get CSS string for the current layout type.
|
package/src/hooks/line-height.js
CHANGED
|
@@ -8,7 +8,7 @@ import { hasBlockSupport } from '@wordpress/blocks';
|
|
|
8
8
|
*/
|
|
9
9
|
import LineHeightControl from '../components/line-height-control';
|
|
10
10
|
import { cleanEmptyObject } from './utils';
|
|
11
|
-
import
|
|
11
|
+
import { useSettings } from '../components/use-settings';
|
|
12
12
|
|
|
13
13
|
export const LINE_HEIGHT_SUPPORT_KEY = 'typography.lineHeight';
|
|
14
14
|
|
|
@@ -54,9 +54,9 @@ export function LineHeightEdit( props ) {
|
|
|
54
54
|
* @return {boolean} Whether setting is disabled.
|
|
55
55
|
*/
|
|
56
56
|
export function useIsLineHeightDisabled( { name: blockName } = {} ) {
|
|
57
|
-
const
|
|
57
|
+
const [ isEnabled ] = useSettings( 'typography.lineHeight' );
|
|
58
58
|
|
|
59
59
|
return (
|
|
60
|
-
! hasBlockSupport( blockName, LINE_HEIGHT_SUPPORT_KEY )
|
|
60
|
+
! isEnabled || ! hasBlockSupport( blockName, LINE_HEIGHT_SUPPORT_KEY )
|
|
61
61
|
);
|
|
62
62
|
}
|
package/src/hooks/position.js
CHANGED
|
@@ -26,7 +26,7 @@ import { addFilter } from '@wordpress/hooks';
|
|
|
26
26
|
* Internal dependencies
|
|
27
27
|
*/
|
|
28
28
|
import BlockList from '../components/block-list';
|
|
29
|
-
import
|
|
29
|
+
import { useSettings } from '../components/use-settings';
|
|
30
30
|
import InspectorControls from '../components/inspector-controls';
|
|
31
31
|
import useBlockDisplayInformation from '../components/use-block-display-information';
|
|
32
32
|
import { cleanEmptyObject } from './utils';
|
|
@@ -197,8 +197,10 @@ export function resetPosition( { attributes = {}, setAttributes } ) {
|
|
|
197
197
|
* @return {boolean} Whether padding setting is disabled.
|
|
198
198
|
*/
|
|
199
199
|
export function useIsPositionDisabled( { name: blockName } = {} ) {
|
|
200
|
-
const allowFixed =
|
|
201
|
-
|
|
200
|
+
const [ allowFixed, allowSticky ] = useSettings(
|
|
201
|
+
'position.fixed',
|
|
202
|
+
'position.sticky'
|
|
203
|
+
);
|
|
202
204
|
const isDisabled = ! allowFixed && ! allowSticky;
|
|
203
205
|
|
|
204
206
|
return ! hasPositionSupport( blockName ) || isDisabled;
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
__experimentalGetGradientClass,
|
|
21
21
|
getGradientValueBySlug,
|
|
22
22
|
} from '../components/gradients';
|
|
23
|
-
import
|
|
23
|
+
import { useSettings } from '../components/use-settings';
|
|
24
24
|
|
|
25
25
|
// The code in this file has largely been lifted from the color block support
|
|
26
26
|
// hook.
|
|
@@ -73,8 +73,6 @@ export function getColorClassesAndStyles( attributes ) {
|
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
const EMPTY_OBJECT = {};
|
|
77
|
-
|
|
78
76
|
/**
|
|
79
77
|
* Determines the color related props for a block derived from its color block
|
|
80
78
|
* support attributes.
|
|
@@ -89,13 +87,22 @@ const EMPTY_OBJECT = {};
|
|
|
89
87
|
export function useColorProps( attributes ) {
|
|
90
88
|
const { backgroundColor, textColor, gradient } = attributes;
|
|
91
89
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
90
|
+
const [
|
|
91
|
+
userPalette,
|
|
92
|
+
themePalette,
|
|
93
|
+
defaultPalette,
|
|
94
|
+
userGradients,
|
|
95
|
+
themeGradients,
|
|
96
|
+
defaultGradients,
|
|
97
|
+
] = useSettings(
|
|
98
|
+
'color.palette.custom',
|
|
99
|
+
'color.palette.theme',
|
|
100
|
+
'color.palette.default',
|
|
101
|
+
'color.gradients.custom',
|
|
102
|
+
'color.gradients.theme',
|
|
103
|
+
'color.gradients.default'
|
|
104
|
+
);
|
|
105
|
+
|
|
99
106
|
const colors = useMemo(
|
|
100
107
|
() => [
|
|
101
108
|
...( userPalette || [] ),
|
|
@@ -106,11 +113,11 @@ export function useColorProps( attributes ) {
|
|
|
106
113
|
);
|
|
107
114
|
const gradients = useMemo(
|
|
108
115
|
() => [
|
|
109
|
-
...(
|
|
110
|
-
...(
|
|
111
|
-
...(
|
|
116
|
+
...( userGradients || [] ),
|
|
117
|
+
...( themeGradients || [] ),
|
|
118
|
+
...( defaultGradients || [] ),
|
|
112
119
|
],
|
|
113
|
-
[
|
|
120
|
+
[ userGradients, themeGradients, defaultGradients ]
|
|
114
121
|
);
|
|
115
122
|
|
|
116
123
|
const colorProps = getColorClassesAndStyles( attributes );
|
package/src/hooks/utils.js
CHANGED
|
@@ -7,7 +7,7 @@ import { useMemo } from '@wordpress/element';
|
|
|
7
7
|
/**
|
|
8
8
|
* Internal dependencies
|
|
9
9
|
*/
|
|
10
|
-
import {
|
|
10
|
+
import { useSettings } from '../components';
|
|
11
11
|
import { useSettingsForBlockElement } from '../components/global-styles/hooks';
|
|
12
12
|
import { getValueFromObjectPath, setImmutably } from '../utils/object';
|
|
13
13
|
|
|
@@ -126,48 +126,93 @@ export function shouldSkipSerialization( blockType, featureSet, feature ) {
|
|
|
126
126
|
* @return {Object} Settings object.
|
|
127
127
|
*/
|
|
128
128
|
export function useBlockSettings( name, parentLayout ) {
|
|
129
|
-
const
|
|
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
|
-
|
|
170
|
-
|
|
129
|
+
const [
|
|
130
|
+
fontFamilies,
|
|
131
|
+
fontSizes,
|
|
132
|
+
customFontSize,
|
|
133
|
+
fontStyle,
|
|
134
|
+
fontWeight,
|
|
135
|
+
lineHeight,
|
|
136
|
+
textColumns,
|
|
137
|
+
textDecoration,
|
|
138
|
+
writingMode,
|
|
139
|
+
textTransform,
|
|
140
|
+
letterSpacing,
|
|
141
|
+
padding,
|
|
142
|
+
margin,
|
|
143
|
+
blockGap,
|
|
144
|
+
spacingSizes,
|
|
145
|
+
units,
|
|
146
|
+
minHeight,
|
|
147
|
+
layout,
|
|
148
|
+
borderColor,
|
|
149
|
+
borderRadius,
|
|
150
|
+
borderStyle,
|
|
151
|
+
borderWidth,
|
|
152
|
+
customColorsEnabled,
|
|
153
|
+
customColors,
|
|
154
|
+
customDuotone,
|
|
155
|
+
themeColors,
|
|
156
|
+
defaultColors,
|
|
157
|
+
defaultPalette,
|
|
158
|
+
defaultDuotone,
|
|
159
|
+
userDuotonePalette,
|
|
160
|
+
themeDuotonePalette,
|
|
161
|
+
defaultDuotonePalette,
|
|
162
|
+
userGradientPalette,
|
|
163
|
+
themeGradientPalette,
|
|
164
|
+
defaultGradientPalette,
|
|
165
|
+
defaultGradients,
|
|
166
|
+
areCustomGradientsEnabled,
|
|
167
|
+
isBackgroundEnabled,
|
|
168
|
+
isLinkEnabled,
|
|
169
|
+
isTextEnabled,
|
|
170
|
+
isHeadingEnabled,
|
|
171
|
+
isButtonEnabled,
|
|
172
|
+
] = useSettings(
|
|
173
|
+
'typography.fontFamilies',
|
|
174
|
+
'typography.fontSizes',
|
|
175
|
+
'typography.customFontSize',
|
|
176
|
+
'typography.fontStyle',
|
|
177
|
+
'typography.fontWeight',
|
|
178
|
+
'typography.lineHeight',
|
|
179
|
+
'typography.textColumns',
|
|
180
|
+
'typography.textDecoration',
|
|
181
|
+
'typography.writingMode',
|
|
182
|
+
'typography.textTransform',
|
|
183
|
+
'typography.letterSpacing',
|
|
184
|
+
'spacing.padding',
|
|
185
|
+
'spacing.margin',
|
|
186
|
+
'spacing.blockGap',
|
|
187
|
+
'spacing.spacingSizes',
|
|
188
|
+
'spacing.units',
|
|
189
|
+
'dimensions.minHeight',
|
|
190
|
+
'layout',
|
|
191
|
+
'border.color',
|
|
192
|
+
'border.radius',
|
|
193
|
+
'border.style',
|
|
194
|
+
'border.width',
|
|
195
|
+
'color.custom',
|
|
196
|
+
'color.palette.custom',
|
|
197
|
+
'color.customDuotone',
|
|
198
|
+
'color.palette.theme',
|
|
199
|
+
'color.palette.default',
|
|
200
|
+
'color.defaultPalette',
|
|
201
|
+
'color.defaultDuotone',
|
|
202
|
+
'color.duotone.custom',
|
|
203
|
+
'color.duotone.theme',
|
|
204
|
+
'color.duotone.default',
|
|
205
|
+
'color.gradients.custom',
|
|
206
|
+
'color.gradients.theme',
|
|
207
|
+
'color.gradients.default',
|
|
208
|
+
'color.defaultGradients',
|
|
209
|
+
'color.customGradient',
|
|
210
|
+
'color.background',
|
|
211
|
+
'color.link',
|
|
212
|
+
'color.text',
|
|
213
|
+
'color.heading',
|
|
214
|
+
'color.button'
|
|
215
|
+
);
|
|
171
216
|
|
|
172
217
|
const rawSettings = useMemo( () => {
|
|
173
218
|
return {
|
|
@@ -21,7 +21,7 @@ import { getCSSRules } from '@wordpress/style-engine';
|
|
|
21
21
|
/**
|
|
22
22
|
* Internal dependencies
|
|
23
23
|
*/
|
|
24
|
-
import
|
|
24
|
+
import { useSettings } from '../components/use-settings';
|
|
25
25
|
import { appendSelectors, getBlockGapCSS, getAlignmentsInfo } from './utils';
|
|
26
26
|
import { getGapCSSValue } from '../hooks/gap';
|
|
27
27
|
import { shouldSkipSerialization } from '../hooks/utils';
|
|
@@ -60,14 +60,9 @@ export default {
|
|
|
60
60
|
label: __( 'Justify items right' ),
|
|
61
61
|
},
|
|
62
62
|
];
|
|
63
|
+
const [ availableUnits ] = useSettings( 'spacing.units' );
|
|
63
64
|
const units = useCustomUnits( {
|
|
64
|
-
availableUnits:
|
|
65
|
-
'%',
|
|
66
|
-
'px',
|
|
67
|
-
'em',
|
|
68
|
-
'rem',
|
|
69
|
-
'vw',
|
|
70
|
-
],
|
|
65
|
+
availableUnits: availableUnits || [ '%', 'px', 'em', 'rem', 'vw' ],
|
|
71
66
|
} );
|
|
72
67
|
return (
|
|
73
68
|
<>
|
package/src/utils/object.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { paramCase } from 'change-case';
|
|
5
|
+
import memoize from 'memize';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Converts a path to an array of its fragments.
|
|
@@ -112,6 +113,8 @@ export function setImmutably( object, path, value ) {
|
|
|
112
113
|
return newObject;
|
|
113
114
|
}
|
|
114
115
|
|
|
116
|
+
const stringToPath = memoize( ( path ) => path.split( '.' ) );
|
|
117
|
+
|
|
115
118
|
/**
|
|
116
119
|
* Helper util to return a value from a certain path of the object.
|
|
117
120
|
* Path is specified as either:
|
|
@@ -125,7 +128,7 @@ export function setImmutably( object, path, value ) {
|
|
|
125
128
|
* @return {*} Value of the object property at the specified path.
|
|
126
129
|
*/
|
|
127
130
|
export const getValueFromObjectPath = ( object, path, defaultValue ) => {
|
|
128
|
-
const normalizedPath = Array.isArray( path ) ? path :
|
|
131
|
+
const normalizedPath = Array.isArray( path ) ? path : stringToPath( path );
|
|
129
132
|
let value = object;
|
|
130
133
|
normalizedPath.forEach( ( fieldName ) => {
|
|
131
134
|
value = value?.[ fieldName ];
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`transformStyles URL rewrite should not replace absolute paths 1`] = `
|
|
4
|
+
[
|
|
5
|
+
"h1 { background: url(/images/test.png); }",
|
|
6
|
+
]
|
|
7
|
+
`;
|
|
8
|
+
|
|
9
|
+
exports[`transformStyles URL rewrite should not replace remote paths 1`] = `
|
|
10
|
+
[
|
|
11
|
+
"h1 { background: url(http://wp.org/images/test.png); }",
|
|
12
|
+
]
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
exports[`transformStyles URL rewrite should replace complex relative paths 1`] = `
|
|
16
|
+
[
|
|
17
|
+
"h1 { background: url(http://wp-site.local/themes/gut/images/test.png); }",
|
|
18
|
+
]
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
exports[`transformStyles URL rewrite should rewrite relative paths 1`] = `
|
|
22
|
+
[
|
|
23
|
+
"h1 { background: url(http://wp-site.local/themes/gut/css/images/test.png); }",
|
|
24
|
+
]
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
exports[`transformStyles selector wrap should ignore font-face selectors 1`] = `
|
|
28
|
+
[
|
|
29
|
+
"
|
|
30
|
+
@font-face {
|
|
31
|
+
font-family: myFirstFont;
|
|
32
|
+
src: url(sansation_light.woff);
|
|
33
|
+
}",
|
|
34
|
+
]
|
|
35
|
+
`;
|
|
36
|
+
|
|
37
|
+
exports[`transformStyles selector wrap should ignore keyframes 1`] = `
|
|
38
|
+
[
|
|
39
|
+
"
|
|
40
|
+
@keyframes edit-post__fade-in-animation {
|
|
41
|
+
from {
|
|
42
|
+
opacity: 0;
|
|
43
|
+
}
|
|
44
|
+
}",
|
|
45
|
+
]
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
exports[`transformStyles selector wrap should ignore selectors 1`] = `
|
|
49
|
+
[
|
|
50
|
+
".my-namespace h1, body { color: red; }",
|
|
51
|
+
]
|
|
52
|
+
`;
|
|
53
|
+
|
|
54
|
+
exports[`transformStyles selector wrap should not double wrap selectors 1`] = `
|
|
55
|
+
[
|
|
56
|
+
" .my-namespace h1, .my-namespace .red { color: red; }",
|
|
57
|
+
]
|
|
58
|
+
`;
|
|
59
|
+
|
|
60
|
+
exports[`transformStyles selector wrap should replace :root selectors 1`] = `
|
|
61
|
+
[
|
|
62
|
+
"
|
|
63
|
+
.my-namespace {
|
|
64
|
+
--my-color: #ff0000;
|
|
65
|
+
}",
|
|
66
|
+
]
|
|
67
|
+
`;
|
|
68
|
+
|
|
69
|
+
exports[`transformStyles selector wrap should replace root tags 1`] = `
|
|
70
|
+
[
|
|
71
|
+
".my-namespace, .my-namespace h1 { color: red; }",
|
|
72
|
+
]
|
|
73
|
+
`;
|
|
74
|
+
|
|
75
|
+
exports[`transformStyles selector wrap should wrap multiple selectors 1`] = `
|
|
76
|
+
[
|
|
77
|
+
".my-namespace h1, .my-namespace h2 { color: red; }",
|
|
78
|
+
]
|
|
79
|
+
`;
|
|
80
|
+
|
|
81
|
+
exports[`transformStyles selector wrap should wrap regular selectors 1`] = `
|
|
82
|
+
[
|
|
83
|
+
".my-namespace h1 { color: red; }",
|
|
84
|
+
]
|
|
85
|
+
`;
|
|
86
|
+
|
|
87
|
+
exports[`transformStyles selector wrap should wrap selectors inside container queries 1`] = `
|
|
88
|
+
[
|
|
89
|
+
"
|
|
90
|
+
@container (width > 400px) {
|
|
91
|
+
.my-namespace h1 { color: red; }
|
|
92
|
+
}",
|
|
93
|
+
]
|
|
94
|
+
`;
|
|
95
|
+
|
|
96
|
+
exports[`transformStyles should not break with data urls 1`] = `
|
|
97
|
+
[
|
|
98
|
+
".wp-block-group {
|
|
99
|
+
background-image: url("data:image/svg+xml,%3Csvg%3E.b%7Bclip-path:url(test);%7D%3C/svg%3E");
|
|
100
|
+
color: red !important;
|
|
101
|
+
}",
|
|
102
|
+
]
|
|
103
|
+
`;
|