@wordpress/block-editor 15.6.0 → 15.6.1-next.36001005c.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.
Files changed (101) hide show
  1. package/build/components/background-image-control/index.js +2 -2
  2. package/build/components/background-image-control/index.js.map +2 -2
  3. package/build/components/block-quick-navigation/index.js +1 -0
  4. package/build/components/block-quick-navigation/index.js.map +2 -2
  5. package/build/components/global-styles/border-panel.js +2 -1
  6. package/build/components/global-styles/border-panel.js.map +2 -2
  7. package/build/components/global-styles/color-panel.js +2 -1
  8. package/build/components/global-styles/color-panel.js.map +2 -2
  9. package/build/components/global-styles/dimensions-panel.js +3 -2
  10. package/build/components/global-styles/dimensions-panel.js.map +2 -2
  11. package/build/components/global-styles/filters-panel.js +2 -1
  12. package/build/components/global-styles/filters-panel.js.map +2 -2
  13. package/build/components/global-styles/hooks.js +23 -95
  14. package/build/components/global-styles/hooks.js.map +2 -2
  15. package/build/components/global-styles/index.js +0 -14
  16. package/build/components/global-styles/index.js.map +2 -2
  17. package/build/components/global-styles/typography-panel.js +2 -1
  18. package/build/components/global-styles/typography-panel.js.map +2 -2
  19. package/build/components/global-styles/typography-utils.js +2 -49
  20. package/build/components/global-styles/typography-utils.js.map +2 -2
  21. package/build/components/global-styles/utils.js +0 -377
  22. package/build/components/global-styles/utils.js.map +2 -2
  23. package/build/hooks/block-style-variation.js +6 -10
  24. package/build/hooks/block-style-variation.js.map +2 -2
  25. package/build/hooks/duotone.js +3 -3
  26. package/build/hooks/duotone.js.map +2 -2
  27. package/build/hooks/font-size.js +2 -2
  28. package/build/hooks/font-size.js.map +2 -2
  29. package/build/hooks/use-typography-props.js +2 -2
  30. package/build/hooks/use-typography-props.js.map +2 -2
  31. package/build-module/components/background-image-control/index.js +1 -1
  32. package/build-module/components/background-image-control/index.js.map +2 -2
  33. package/build-module/components/block-quick-navigation/index.js +1 -0
  34. package/build-module/components/block-quick-navigation/index.js.map +2 -2
  35. package/build-module/components/global-styles/border-panel.js +2 -1
  36. package/build-module/components/global-styles/border-panel.js.map +2 -2
  37. package/build-module/components/global-styles/color-panel.js +2 -1
  38. package/build-module/components/global-styles/color-panel.js.map +2 -2
  39. package/build-module/components/global-styles/dimensions-panel.js +2 -1
  40. package/build-module/components/global-styles/dimensions-panel.js.map +2 -2
  41. package/build-module/components/global-styles/filters-panel.js +2 -1
  42. package/build-module/components/global-styles/filters-panel.js.map +2 -2
  43. package/build-module/components/global-styles/hooks.js +27 -95
  44. package/build-module/components/global-styles/hooks.js.map +2 -2
  45. package/build-module/components/global-styles/index.js +0 -14
  46. package/build-module/components/global-styles/index.js.map +2 -2
  47. package/build-module/components/global-styles/typography-panel.js +2 -1
  48. package/build-module/components/global-styles/typography-panel.js.map +2 -2
  49. package/build-module/components/global-styles/typography-utils.js +1 -49
  50. package/build-module/components/global-styles/typography-utils.js.map +2 -2
  51. package/build-module/components/global-styles/utils.js +0 -364
  52. package/build-module/components/global-styles/utils.js.map +2 -2
  53. package/build-module/hooks/block-style-variation.js +4 -12
  54. package/build-module/hooks/block-style-variation.js.map +2 -2
  55. package/build-module/hooks/duotone.js +3 -3
  56. package/build-module/hooks/duotone.js.map +2 -2
  57. package/build-module/hooks/font-size.js +1 -1
  58. package/build-module/hooks/font-size.js.map +2 -2
  59. package/build-module/hooks/use-typography-props.js +1 -1
  60. package/build-module/hooks/use-typography-props.js.map +2 -2
  61. package/build-style/style-rtl.css +10 -6
  62. package/build-style/style.css +10 -6
  63. package/package.json +36 -35
  64. package/src/components/background-image-control/index.js +1 -1
  65. package/src/components/block-card/style.scss +1 -1
  66. package/src/components/block-navigation/style.scss +1 -1
  67. package/src/components/block-quick-navigation/index.js +1 -0
  68. package/src/components/block-quick-navigation/style.scss +5 -0
  69. package/src/components/block-switcher/style.scss +1 -1
  70. package/src/components/color-palette/test/__snapshots__/control.js.snap +1 -1
  71. package/src/components/global-styles/border-panel.js +2 -1
  72. package/src/components/global-styles/color-panel.js +2 -1
  73. package/src/components/global-styles/color-panel.native.js +1 -1
  74. package/src/components/global-styles/dimensions-panel.js +2 -1
  75. package/src/components/global-styles/filters-panel.js +2 -1
  76. package/src/components/global-styles/hooks.js +29 -108
  77. package/src/components/global-styles/index.js +0 -8
  78. package/src/components/global-styles/test/typography-utils.js +0 -806
  79. package/src/components/global-styles/test/utils.js +1 -442
  80. package/src/components/global-styles/typography-panel.js +2 -1
  81. package/src/components/global-styles/typography-utils.js +0 -133
  82. package/src/components/global-styles/utils.js +0 -537
  83. package/src/components/inserter/style.scss +2 -2
  84. package/src/components/multi-selection-inspector/style.scss +1 -1
  85. package/src/hooks/block-style-variation.js +4 -12
  86. package/src/hooks/duotone.js +3 -3
  87. package/src/hooks/font-size.js +1 -1
  88. package/src/hooks/use-typography-props.js +1 -1
  89. package/src/style.scss +1 -0
  90. package/tsconfig.json +1 -0
  91. package/build/components/global-styles/get-block-css-selector.js +0 -78
  92. package/build/components/global-styles/get-block-css-selector.js.map +0 -7
  93. package/build/components/global-styles/use-global-styles-output.js +0 -998
  94. package/build/components/global-styles/use-global-styles-output.js.map +0 -7
  95. package/build-module/components/global-styles/get-block-css-selector.js +0 -54
  96. package/build-module/components/global-styles/get-block-css-selector.js.map +0 -7
  97. package/build-module/components/global-styles/use-global-styles-output.js +0 -979
  98. package/build-module/components/global-styles/use-global-styles-output.js.map +0 -7
  99. package/src/components/global-styles/get-block-css-selector.js +0 -114
  100. package/src/components/global-styles/test/use-global-styles-output.js +0 -1131
  101. package/src/components/global-styles/use-global-styles-output.js +0 -1487
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/hooks/duotone.js"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport { extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tgetBlockSupport,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { useMemo, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBlockControls,\n\tInspectorControls,\n\t__experimentalDuotoneControl as DuotoneControl,\n\tuseSettings,\n} from '../components';\nimport {\n\tgetDuotoneFilter,\n\tgetDuotoneStylesheet,\n\tgetDuotoneUnsetStylesheet,\n} from '../components/duotone/utils';\nimport { getBlockCSSSelector } from '../components/global-styles/get-block-css-selector';\nimport { scopeSelector } from '../components/global-styles/utils';\nimport {\n\tcleanEmptyObject,\n\tuseBlockSettings,\n\tusePrivateStyleOverride,\n} from './utils';\nimport { default as StylesFiltersPanel } from '../components/global-styles/filters-panel';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\nimport { useBlockElement } from '../components/block-list/use-block-props/use-block-refs';\n\nconst EMPTY_ARRAY = [];\n\n// Safari does not always update the duotone filter when the duotone colors\n// are changed. This browser check is later used to force a re-render of the block\n// element to ensure the duotone filter is updated. The check is included at the\n// root of this file as it only needs to be run once per page load.\nconst isSafari =\n\twindow?.navigator.userAgent &&\n\twindow.navigator.userAgent.includes( 'Safari' ) &&\n\t! window.navigator.userAgent.includes( 'Chrome' ) &&\n\t! window.navigator.userAgent.includes( 'Chromium' );\n\nextend( [ namesPlugin ] );\n\nfunction useMultiOriginPresets( { presetSetting, defaultSetting } ) {\n\tconst [ enableDefault, userPresets, themePresets, defaultPresets ] =\n\t\tuseSettings(\n\t\t\tdefaultSetting,\n\t\t\t`${ presetSetting }.custom`,\n\t\t\t`${ presetSetting }.theme`,\n\t\t\t`${ presetSetting }.default`\n\t\t);\n\treturn useMemo(\n\t\t() => [\n\t\t\t...( userPresets || EMPTY_ARRAY ),\n\t\t\t...( themePresets || EMPTY_ARRAY ),\n\t\t\t...( ( enableDefault && defaultPresets ) || EMPTY_ARRAY ),\n\t\t],\n\t\t[ enableDefault, userPresets, themePresets, defaultPresets ]\n\t);\n}\n\nexport function getColorsFromDuotonePreset( duotone, duotonePalette ) {\n\tif ( ! duotone ) {\n\t\treturn;\n\t}\n\tconst preset = duotonePalette?.find( ( { slug } ) => {\n\t\treturn duotone === `var:preset|duotone|${ slug }`;\n\t} );\n\n\treturn preset ? preset.colors : undefined;\n}\n\nexport function getDuotonePresetFromColors( colors, duotonePalette ) {\n\tif ( ! colors || ! Array.isArray( colors ) ) {\n\t\treturn;\n\t}\n\n\tconst preset = duotonePalette?.find( ( duotonePreset ) => {\n\t\treturn duotonePreset?.colors?.every(\n\t\t\t( val, index ) => val === colors[ index ]\n\t\t);\n\t} );\n\n\treturn preset ? `var:preset|duotone|${ preset.slug }` : undefined;\n}\n\nfunction DuotonePanelPure( { style, setAttributes, name } ) {\n\tconst duotoneStyle = style?.color?.duotone;\n\tconst settings = useBlockSettings( name );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\tconst colorPalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.palette',\n\t\tdefaultSetting: 'color.defaultPalette',\n\t} );\n\tconst [ enableCustomColors, enableCustomDuotone ] = useSettings(\n\t\t'color.custom',\n\t\t'color.customDuotone'\n\t);\n\tconst disableCustomColors = ! enableCustomColors;\n\tconst disableCustomDuotone =\n\t\t! enableCustomDuotone ||\n\t\t( colorPalette?.length === 0 && disableCustomColors );\n\n\tif ( duotonePalette?.length === 0 && disableCustomDuotone ) {\n\t\treturn null;\n\t}\n\n\tif ( blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\tconst duotonePresetOrColors =\n\t\tduotoneStyle === 'unset' || Array.isArray( duotoneStyle )\n\t\t\t? duotoneStyle\n\t\t\t: getColorsFromDuotonePreset( duotoneStyle, duotonePalette );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls group=\"filter\">\n\t\t\t\t<StylesFiltersPanel\n\t\t\t\t\tvalue={ { filter: { duotone: duotonePresetOrColors } } }\n\t\t\t\t\tonChange={ ( newDuotone ) => {\n\t\t\t\t\t\tconst newStyle = {\n\t\t\t\t\t\t\t...style,\n\t\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t\t...newDuotone?.filter,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<BlockControls group=\"block\" __experimentalShareWithChildBlocks>\n\t\t\t\t<DuotoneControl\n\t\t\t\t\tduotonePalette={ duotonePalette }\n\t\t\t\t\tcolorPalette={ colorPalette }\n\t\t\t\t\tdisableCustomDuotone={ disableCustomDuotone }\n\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\tvalue={ duotonePresetOrColors }\n\t\t\t\t\tonChange={ ( newDuotone ) => {\n\t\t\t\t\t\tconst maybePreset = getDuotonePresetFromColors(\n\t\t\t\t\t\t\tnewDuotone,\n\t\t\t\t\t\t\tduotonePalette\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst newStyle = {\n\t\t\t\t\t\t\t...style,\n\t\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t\t...style?.color,\n\t\t\t\t\t\t\t\tduotone: maybePreset ?? newDuotone, // use preset or fallback to custom colors.\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t</>\n\t);\n}\n\nexport default {\n\tshareWithChildBlocks: true,\n\tedit: DuotonePanelPure,\n\tuseBlockProps,\n\tattributeKeys: [ 'style' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, 'filter.duotone' );\n\t},\n};\n\n/**\n * Filters registered block settings, extending attributes to include\n * the `duotone` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addDuotoneAttributes( settings ) {\n\t// Previous `color.__experimentalDuotone` support flag is migrated via\n\t// block_type_metadata_settings filter in `lib/block-supports/duotone.php`.\n\tif ( ! hasBlockSupport( settings, 'filter.duotone' ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default\n\t// values if needed.\n\tif ( ! settings.attributes.style ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tstyle: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\nfunction useDuotoneStyles( {\n\tclientId,\n\tid: filterId,\n\tselector: duotoneSelector,\n\tattribute: duotoneAttr,\n} ) {\n\tconst duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\n\t// Possible values for duotone attribute:\n\t// 1. Array of colors - e.g. ['#000000', '#ffffff'].\n\t// 2. Variable for an existing Duotone preset - e.g. 'var:preset|duotone|green-blue' or 'var(--wp--preset--duotone--green-blue)''\n\t// 3. A CSS string - e.g. 'unset' to remove globally applied duotone.\n\tconst isCustom = Array.isArray( duotoneAttr );\n\tconst duotonePreset = isCustom\n\t\t? undefined\n\t\t: getColorsFromDuotonePreset( duotoneAttr, duotonePalette );\n\tconst isPreset = typeof duotoneAttr === 'string' && duotonePreset;\n\tconst isCSS = typeof duotoneAttr === 'string' && ! isPreset;\n\n\t// Match the structure of WP_Duotone_Gutenberg::render_duotone_support() in PHP.\n\tlet colors = null;\n\tif ( isPreset ) {\n\t\t// Array of colors.\n\t\tcolors = duotonePreset;\n\t} else if ( isCSS ) {\n\t\t// CSS filter property string (e.g. 'unset').\n\t\tcolors = duotoneAttr;\n\t} else if ( isCustom ) {\n\t\t// Array of colors.\n\t\tcolors = duotoneAttr;\n\t}\n\n\t// Build the CSS selectors to which the filter will be applied.\n\tconst selectors = duotoneSelector.split( ',' );\n\n\tconst selectorsScoped = selectors.map( ( selectorPart ) => {\n\t\t// Assuming the selector part is a subclass selector (not a tag name)\n\t\t// so we can prepend the filter id class. If we want to support elements\n\t\t// such as `img` or namespaces, we'll need to add a case for that here.\n\t\treturn `.${ filterId }${ selectorPart.trim() }`;\n\t} );\n\n\tconst selector = selectorsScoped.join( ', ' );\n\n\tconst isValidFilter = Array.isArray( colors ) || colors === 'unset';\n\n\tusePrivateStyleOverride(\n\t\tisValidFilter\n\t\t\t? {\n\t\t\t\t\tcss:\n\t\t\t\t\t\tcolors !== 'unset'\n\t\t\t\t\t\t\t? getDuotoneStylesheet( selector, filterId )\n\t\t\t\t\t\t\t: getDuotoneUnsetStylesheet( selector ),\n\t\t\t\t\t__unstableType: 'presets',\n\t\t\t }\n\t\t\t: undefined\n\t);\n\tusePrivateStyleOverride(\n\t\tisValidFilter\n\t\t\t? {\n\t\t\t\t\tassets:\n\t\t\t\t\t\tcolors !== 'unset'\n\t\t\t\t\t\t\t? getDuotoneFilter( filterId, colors )\n\t\t\t\t\t\t\t: '',\n\t\t\t\t\t__unstableType: 'svgs',\n\t\t\t }\n\t\t\t: undefined\n\t);\n\n\tconst blockElement = useBlockElement( clientId );\n\n\tuseEffect( () => {\n\t\tif ( ! isValidFilter ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Safari does not always update the duotone filter when the duotone\n\t\t// colors are changed. When using Safari, force the block element to be\n\t\t// repainted by the browser to ensure any changes are reflected\n\t\t// visually. This logic matches that used on the site frontend in\n\t\t// `block-supports/duotone.php`.\n\t\tif ( blockElement && isSafari ) {\n\t\t\tconst display = blockElement.style.display;\n\t\t\t// Switch to `inline-block` to force a repaint. In the editor,\n\t\t\t// `inline-block` is used instead of `none` to ensure that scroll\n\t\t\t// position is not affected, as `none` results in the editor\n\t\t\t// scrolling to the top of the block.\n\t\t\tblockElement.style.setProperty( 'display', 'inline-block' );\n\t\t\t// Simply accessing el.offsetHeight flushes layout and style changes\n\t\t\t// in WebKit without having to wait for setTimeout.\n\t\t\t// eslint-disable-next-line no-unused-expressions\n\t\t\tblockElement.offsetHeight;\n\t\t\tblockElement.style.setProperty( 'display', display );\n\t\t}\n\t\t// `colors` must be a dependency so this effect runs when the colors\n\t\t// change in Safari.\n\t}, [ isValidFilter, blockElement, colors ] );\n}\n\n// Used for generating the instance ID\nconst DUOTONE_BLOCK_PROPS_REFERENCE = {};\n\nfunction useBlockProps( { clientId, name, style } ) {\n\tconst id = useInstanceId( DUOTONE_BLOCK_PROPS_REFERENCE );\n\tconst selector = useMemo( () => {\n\t\tconst blockType = getBlockType( name );\n\n\t\tif ( blockType ) {\n\t\t\t// Backwards compatibility for `supports.color.__experimentalDuotone`\n\t\t\t// is provided via the `block_type_metadata_settings` filter. If\n\t\t\t// `supports.filter.duotone` has not been set and the\n\t\t\t// experimental property has been, the experimental property\n\t\t\t// value is copied into `supports.filter.duotone`.\n\t\t\tconst duotoneSupport = getBlockSupport(\n\t\t\t\tblockType,\n\t\t\t\t'filter.duotone',\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tif ( ! duotoneSupport ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\t// If the experimental duotone support was set, that value is\n\t\t\t// to be treated as a selector and requires scoping.\n\t\t\tconst experimentalDuotone = getBlockSupport(\n\t\t\t\tblockType,\n\t\t\t\t'color.__experimentalDuotone',\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tif ( experimentalDuotone ) {\n\t\t\t\tconst rootSelector = getBlockCSSSelector( blockType );\n\t\t\t\treturn typeof experimentalDuotone === 'string'\n\t\t\t\t\t? scopeSelector( rootSelector, experimentalDuotone )\n\t\t\t\t\t: rootSelector;\n\t\t\t}\n\n\t\t\t// Regular filter.duotone support uses filter.duotone selectors with fallbacks.\n\t\t\treturn getBlockCSSSelector( blockType, 'filter.duotone', {\n\t\t\t\tfallback: true,\n\t\t\t} );\n\t\t}\n\t}, [ name ] );\n\n\tconst attribute = style?.color?.duotone;\n\n\tconst filterClass = `wp-duotone-${ id }`;\n\n\tconst shouldRender = selector && attribute;\n\n\tuseDuotoneStyles( {\n\t\tclientId,\n\t\tid: filterClass,\n\t\tselector,\n\t\tattribute,\n\t} );\n\n\treturn {\n\t\tclassName: shouldRender ? filterClass : '',\n\t};\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/duotone/add-attributes',\n\taddDuotoneAttributes\n);\n"],
5
- "mappings": "AAwIE,mBAEE,KAFF;AArIF,SAAS,cAAc;AACvB,OAAO,iBAAiB;AAKxB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,qBAAqB;AAC9B,SAAS,iBAAiB;AAC1B,SAAS,SAAS,iBAAiB;AAKnC;AAAA,EACC;AAAA,EACA;AAAA,EACA,gCAAgC;AAAA,EAChC;AAAA,OACM;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,2BAA2B;AACpC,SAAS,qBAAqB;AAC9B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,WAAW,0BAA0B;AAC9C,SAAS,2BAA2B;AACpC,SAAS,uBAAuB;AAEhC,MAAM,cAAc,CAAC;AAMrB,MAAM,WACL,QAAQ,UAAU,aAClB,OAAO,UAAU,UAAU,SAAU,QAAS,KAC9C,CAAE,OAAO,UAAU,UAAU,SAAU,QAAS,KAChD,CAAE,OAAO,UAAU,UAAU,SAAU,UAAW;AAEnD,OAAQ,CAAE,WAAY,CAAE;AAExB,SAAS,sBAAuB,EAAE,eAAe,eAAe,GAAI;AACnE,QAAM,CAAE,eAAe,aAAa,cAAc,cAAe,IAChE;AAAA,IACC;AAAA,IACA,GAAI,aAAc;AAAA,IAClB,GAAI,aAAc;AAAA,IAClB,GAAI,aAAc;AAAA,EACnB;AACD,SAAO;AAAA,IACN,MAAM;AAAA,MACL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AAK,gBAAgB,UAAW;AAC/B,YAAM,UAAU,aAAa,MAAM;AAKnC,mBAAa,MAAM,YAAa,WAAW,cAAe;AAI1D,mBAAa;AACb,mBAAa,MAAM,YAAa,WAAW,OAAQ;AAAA,IACpD;AAAA,EAGD,GAAG,CAAE,eAAe,cAAc,MAAO,CAAE;AAC5C;AAGA,MAAM,gCAAgC,CAAC;AAEvC,SAAS,cAAe,EAAE,UAAU,MAAM,MAAM,GAAI;AACnD,QAAM,KAAK,cAAe,6BAA8B;AACxD,QAAM,WAAW,QAAS,MAAM;AAC/B,UAAM,YAAY,aAAc,IAAK;AAErC,QAAK,WAAY;AAMhB,YAAM,iBAAiB;AAAA,QACtB;AAAA,QACA;AAAA,QACA;AAAA,MACD;AACA,UAAK,CAAE,gBAAiB;AACvB,eAAO;AAAA,MACR;AAIA,YAAM,sBAAsB;AAAA,QAC3B;AAAA,QACA;AAAA,QACA;AAAA,MACD;AACA,UAAK,qBAAsB;AAC1B,cAAM,eAAe,oBAAqB,SAAU;AACpD,eAAO,OAAO,wBAAwB,WACnC,cAAe,cAAc,mBAAoB,IACjD;AAAA,MACJ;AAGA,aAAO,oBAAqB,WAAW,kBAAkB;AAAA,QACxD,UAAU;AAAA,MACX,CAAE;AAAA,IACH;AAAA,EACD,GAAG,CAAE,IAAK,CAAE;AAEZ,QAAM,YAAY,OAAO,OAAO;AAEhC,QAAM,cAAc,cAAe,EAAG;AAEtC,QAAM,eAAe,YAAY;AAEjC,mBAAkB;AAAA,IACjB;AAAA,IACA,IAAI;AAAA,IACJ;AAAA,IACA;AAAA,EACD,CAAE;AAEF,SAAO;AAAA,IACN,WAAW,eAAe,cAAc;AAAA,EACzC;AACD;AAEA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AACD;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport { extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tgetBlockSupport,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { useMemo, useEffect } from '@wordpress/element';\nimport { getBlockSelector } from '@wordpress/global-styles-engine';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBlockControls,\n\tInspectorControls,\n\t__experimentalDuotoneControl as DuotoneControl,\n\tuseSettings,\n} from '../components';\nimport {\n\tgetDuotoneFilter,\n\tgetDuotoneStylesheet,\n\tgetDuotoneUnsetStylesheet,\n} from '../components/duotone/utils';\nimport { scopeSelector } from '../components/global-styles/utils';\nimport {\n\tcleanEmptyObject,\n\tuseBlockSettings,\n\tusePrivateStyleOverride,\n} from './utils';\nimport { default as StylesFiltersPanel } from '../components/global-styles/filters-panel';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\nimport { useBlockElement } from '../components/block-list/use-block-props/use-block-refs';\n\nconst EMPTY_ARRAY = [];\n\n// Safari does not always update the duotone filter when the duotone colors\n// are changed. This browser check is later used to force a re-render of the block\n// element to ensure the duotone filter is updated. The check is included at the\n// root of this file as it only needs to be run once per page load.\nconst isSafari =\n\twindow?.navigator.userAgent &&\n\twindow.navigator.userAgent.includes( 'Safari' ) &&\n\t! window.navigator.userAgent.includes( 'Chrome' ) &&\n\t! window.navigator.userAgent.includes( 'Chromium' );\n\nextend( [ namesPlugin ] );\n\nfunction useMultiOriginPresets( { presetSetting, defaultSetting } ) {\n\tconst [ enableDefault, userPresets, themePresets, defaultPresets ] =\n\t\tuseSettings(\n\t\t\tdefaultSetting,\n\t\t\t`${ presetSetting }.custom`,\n\t\t\t`${ presetSetting }.theme`,\n\t\t\t`${ presetSetting }.default`\n\t\t);\n\treturn useMemo(\n\t\t() => [\n\t\t\t...( userPresets || EMPTY_ARRAY ),\n\t\t\t...( themePresets || EMPTY_ARRAY ),\n\t\t\t...( ( enableDefault && defaultPresets ) || EMPTY_ARRAY ),\n\t\t],\n\t\t[ enableDefault, userPresets, themePresets, defaultPresets ]\n\t);\n}\n\nexport function getColorsFromDuotonePreset( duotone, duotonePalette ) {\n\tif ( ! duotone ) {\n\t\treturn;\n\t}\n\tconst preset = duotonePalette?.find( ( { slug } ) => {\n\t\treturn duotone === `var:preset|duotone|${ slug }`;\n\t} );\n\n\treturn preset ? preset.colors : undefined;\n}\n\nexport function getDuotonePresetFromColors( colors, duotonePalette ) {\n\tif ( ! colors || ! Array.isArray( colors ) ) {\n\t\treturn;\n\t}\n\n\tconst preset = duotonePalette?.find( ( duotonePreset ) => {\n\t\treturn duotonePreset?.colors?.every(\n\t\t\t( val, index ) => val === colors[ index ]\n\t\t);\n\t} );\n\n\treturn preset ? `var:preset|duotone|${ preset.slug }` : undefined;\n}\n\nfunction DuotonePanelPure( { style, setAttributes, name } ) {\n\tconst duotoneStyle = style?.color?.duotone;\n\tconst settings = useBlockSettings( name );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\tconst colorPalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.palette',\n\t\tdefaultSetting: 'color.defaultPalette',\n\t} );\n\tconst [ enableCustomColors, enableCustomDuotone ] = useSettings(\n\t\t'color.custom',\n\t\t'color.customDuotone'\n\t);\n\tconst disableCustomColors = ! enableCustomColors;\n\tconst disableCustomDuotone =\n\t\t! enableCustomDuotone ||\n\t\t( colorPalette?.length === 0 && disableCustomColors );\n\n\tif ( duotonePalette?.length === 0 && disableCustomDuotone ) {\n\t\treturn null;\n\t}\n\n\tif ( blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\tconst duotonePresetOrColors =\n\t\tduotoneStyle === 'unset' || Array.isArray( duotoneStyle )\n\t\t\t? duotoneStyle\n\t\t\t: getColorsFromDuotonePreset( duotoneStyle, duotonePalette );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls group=\"filter\">\n\t\t\t\t<StylesFiltersPanel\n\t\t\t\t\tvalue={ { filter: { duotone: duotonePresetOrColors } } }\n\t\t\t\t\tonChange={ ( newDuotone ) => {\n\t\t\t\t\t\tconst newStyle = {\n\t\t\t\t\t\t\t...style,\n\t\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t\t...newDuotone?.filter,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<BlockControls group=\"block\" __experimentalShareWithChildBlocks>\n\t\t\t\t<DuotoneControl\n\t\t\t\t\tduotonePalette={ duotonePalette }\n\t\t\t\t\tcolorPalette={ colorPalette }\n\t\t\t\t\tdisableCustomDuotone={ disableCustomDuotone }\n\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\tvalue={ duotonePresetOrColors }\n\t\t\t\t\tonChange={ ( newDuotone ) => {\n\t\t\t\t\t\tconst maybePreset = getDuotonePresetFromColors(\n\t\t\t\t\t\t\tnewDuotone,\n\t\t\t\t\t\t\tduotonePalette\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst newStyle = {\n\t\t\t\t\t\t\t...style,\n\t\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t\t...style?.color,\n\t\t\t\t\t\t\t\tduotone: maybePreset ?? newDuotone, // use preset or fallback to custom colors.\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t</>\n\t);\n}\n\nexport default {\n\tshareWithChildBlocks: true,\n\tedit: DuotonePanelPure,\n\tuseBlockProps,\n\tattributeKeys: [ 'style' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, 'filter.duotone' );\n\t},\n};\n\n/**\n * Filters registered block settings, extending attributes to include\n * the `duotone` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addDuotoneAttributes( settings ) {\n\t// Previous `color.__experimentalDuotone` support flag is migrated via\n\t// block_type_metadata_settings filter in `lib/block-supports/duotone.php`.\n\tif ( ! hasBlockSupport( settings, 'filter.duotone' ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default\n\t// values if needed.\n\tif ( ! settings.attributes.style ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tstyle: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\nfunction useDuotoneStyles( {\n\tclientId,\n\tid: filterId,\n\tselector: duotoneSelector,\n\tattribute: duotoneAttr,\n} ) {\n\tconst duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\n\t// Possible values for duotone attribute:\n\t// 1. Array of colors - e.g. ['#000000', '#ffffff'].\n\t// 2. Variable for an existing Duotone preset - e.g. 'var:preset|duotone|green-blue' or 'var(--wp--preset--duotone--green-blue)''\n\t// 3. A CSS string - e.g. 'unset' to remove globally applied duotone.\n\tconst isCustom = Array.isArray( duotoneAttr );\n\tconst duotonePreset = isCustom\n\t\t? undefined\n\t\t: getColorsFromDuotonePreset( duotoneAttr, duotonePalette );\n\tconst isPreset = typeof duotoneAttr === 'string' && duotonePreset;\n\tconst isCSS = typeof duotoneAttr === 'string' && ! isPreset;\n\n\t// Match the structure of WP_Duotone_Gutenberg::render_duotone_support() in PHP.\n\tlet colors = null;\n\tif ( isPreset ) {\n\t\t// Array of colors.\n\t\tcolors = duotonePreset;\n\t} else if ( isCSS ) {\n\t\t// CSS filter property string (e.g. 'unset').\n\t\tcolors = duotoneAttr;\n\t} else if ( isCustom ) {\n\t\t// Array of colors.\n\t\tcolors = duotoneAttr;\n\t}\n\n\t// Build the CSS selectors to which the filter will be applied.\n\tconst selectors = duotoneSelector.split( ',' );\n\n\tconst selectorsScoped = selectors.map( ( selectorPart ) => {\n\t\t// Assuming the selector part is a subclass selector (not a tag name)\n\t\t// so we can prepend the filter id class. If we want to support elements\n\t\t// such as `img` or namespaces, we'll need to add a case for that here.\n\t\treturn `.${ filterId }${ selectorPart.trim() }`;\n\t} );\n\n\tconst selector = selectorsScoped.join( ', ' );\n\n\tconst isValidFilter = Array.isArray( colors ) || colors === 'unset';\n\n\tusePrivateStyleOverride(\n\t\tisValidFilter\n\t\t\t? {\n\t\t\t\t\tcss:\n\t\t\t\t\t\tcolors !== 'unset'\n\t\t\t\t\t\t\t? getDuotoneStylesheet( selector, filterId )\n\t\t\t\t\t\t\t: getDuotoneUnsetStylesheet( selector ),\n\t\t\t\t\t__unstableType: 'presets',\n\t\t\t }\n\t\t\t: undefined\n\t);\n\tusePrivateStyleOverride(\n\t\tisValidFilter\n\t\t\t? {\n\t\t\t\t\tassets:\n\t\t\t\t\t\tcolors !== 'unset'\n\t\t\t\t\t\t\t? getDuotoneFilter( filterId, colors )\n\t\t\t\t\t\t\t: '',\n\t\t\t\t\t__unstableType: 'svgs',\n\t\t\t }\n\t\t\t: undefined\n\t);\n\n\tconst blockElement = useBlockElement( clientId );\n\n\tuseEffect( () => {\n\t\tif ( ! isValidFilter ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Safari does not always update the duotone filter when the duotone\n\t\t// colors are changed. When using Safari, force the block element to be\n\t\t// repainted by the browser to ensure any changes are reflected\n\t\t// visually. This logic matches that used on the site frontend in\n\t\t// `block-supports/duotone.php`.\n\t\tif ( blockElement && isSafari ) {\n\t\t\tconst display = blockElement.style.display;\n\t\t\t// Switch to `inline-block` to force a repaint. In the editor,\n\t\t\t// `inline-block` is used instead of `none` to ensure that scroll\n\t\t\t// position is not affected, as `none` results in the editor\n\t\t\t// scrolling to the top of the block.\n\t\t\tblockElement.style.setProperty( 'display', 'inline-block' );\n\t\t\t// Simply accessing el.offsetHeight flushes layout and style changes\n\t\t\t// in WebKit without having to wait for setTimeout.\n\t\t\t// eslint-disable-next-line no-unused-expressions\n\t\t\tblockElement.offsetHeight;\n\t\t\tblockElement.style.setProperty( 'display', display );\n\t\t}\n\t\t// `colors` must be a dependency so this effect runs when the colors\n\t\t// change in Safari.\n\t}, [ isValidFilter, blockElement, colors ] );\n}\n\n// Used for generating the instance ID\nconst DUOTONE_BLOCK_PROPS_REFERENCE = {};\n\nfunction useBlockProps( { clientId, name, style } ) {\n\tconst id = useInstanceId( DUOTONE_BLOCK_PROPS_REFERENCE );\n\tconst selector = useMemo( () => {\n\t\tconst blockType = getBlockType( name );\n\n\t\tif ( blockType ) {\n\t\t\t// Backwards compatibility for `supports.color.__experimentalDuotone`\n\t\t\t// is provided via the `block_type_metadata_settings` filter. If\n\t\t\t// `supports.filter.duotone` has not been set and the\n\t\t\t// experimental property has been, the experimental property\n\t\t\t// value is copied into `supports.filter.duotone`.\n\t\t\tconst duotoneSupport = getBlockSupport(\n\t\t\t\tblockType,\n\t\t\t\t'filter.duotone',\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tif ( ! duotoneSupport ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\t// If the experimental duotone support was set, that value is\n\t\t\t// to be treated as a selector and requires scoping.\n\t\t\tconst experimentalDuotone = getBlockSupport(\n\t\t\t\tblockType,\n\t\t\t\t'color.__experimentalDuotone',\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tif ( experimentalDuotone ) {\n\t\t\t\tconst rootSelector = getBlockSelector( blockType );\n\t\t\t\treturn typeof experimentalDuotone === 'string'\n\t\t\t\t\t? scopeSelector( rootSelector, experimentalDuotone )\n\t\t\t\t\t: rootSelector;\n\t\t\t}\n\n\t\t\t// Regular filter.duotone support uses filter.duotone selectors with fallbacks.\n\t\t\treturn getBlockSelector( blockType, 'filter.duotone', {\n\t\t\t\tfallback: true,\n\t\t\t} );\n\t\t}\n\t}, [ name ] );\n\n\tconst attribute = style?.color?.duotone;\n\n\tconst filterClass = `wp-duotone-${ id }`;\n\n\tconst shouldRender = selector && attribute;\n\n\tuseDuotoneStyles( {\n\t\tclientId,\n\t\tid: filterClass,\n\t\tselector,\n\t\tattribute,\n\t} );\n\n\treturn {\n\t\tclassName: shouldRender ? filterClass : '',\n\t};\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/duotone/add-attributes',\n\taddDuotoneAttributes\n);\n"],
5
+ "mappings": "AAwIE,mBAEE,KAFF;AArIF,SAAS,cAAc;AACvB,OAAO,iBAAiB;AAKxB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,qBAAqB;AAC9B,SAAS,iBAAiB;AAC1B,SAAS,SAAS,iBAAiB;AACnC,SAAS,wBAAwB;AAKjC;AAAA,EACC;AAAA,EACA;AAAA,EACA,gCAAgC;AAAA,EAChC;AAAA,OACM;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,qBAAqB;AAC9B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,WAAW,0BAA0B;AAC9C,SAAS,2BAA2B;AACpC,SAAS,uBAAuB;AAEhC,MAAM,cAAc,CAAC;AAMrB,MAAM,WACL,QAAQ,UAAU,aAClB,OAAO,UAAU,UAAU,SAAU,QAAS,KAC9C,CAAE,OAAO,UAAU,UAAU,SAAU,QAAS,KAChD,CAAE,OAAO,UAAU,UAAU,SAAU,UAAW;AAEnD,OAAQ,CAAE,WAAY,CAAE;AAExB,SAAS,sBAAuB,EAAE,eAAe,eAAe,GAAI;AACnE,QAAM,CAAE,eAAe,aAAa,cAAc,cAAe,IAChE;AAAA,IACC;AAAA,IACA,GAAI,aAAc;AAAA,IAClB,GAAI,aAAc;AAAA,IAClB,GAAI,aA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ooks";
3
3
  import { hasBlockSupport } from "@wordpress/blocks";
4
4
  import TokenList from "@wordpress/token-list";
5
+ import { getTypographyFontSizeValue } from "@wordpress/global-styles-engine";
5
6
  import {
6
7
  getFontSize,
7
8
  getFontSizeClass,
@@ -15,7 +16,6 @@ import {
15
16
  shouldSkipSerialization
16
17
  } from "./utils";
17
18
  import { useSettings } from "../components/use-settings";
18
- import { getTypographyFontSizeValue } from "../components/global-styles/typography-utils";
19
19
  const FONT_SIZE_SUPPORT_KEY = "typography.fontSize";
20
20
  function addAttributes(settings) {
21
21
  if (!hasBlockSupport(settings, FONT_SIZE_SUPPORT_KEY)) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/hooks/font-size.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport TokenList from '@wordpress/token-list';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetFontSize,\n\tgetFontSizeClass,\n\tgetFontSizeObjectByValue,\n\tFontSizePicker,\n} from '../components/font-sizes';\nimport { TYPOGRAPHY_SUPPORT_KEY } from './typography';\nimport {\n\tcleanEmptyObject,\n\ttransformStyles,\n\tshouldSkipSerialization,\n} from './utils';\nimport { useSettings } from '../components/use-settings';\nimport { getTypographyFontSizeValue } from '../components/global-styles/typography-utils';\n\nexport const FONT_SIZE_SUPPORT_KEY = 'typography.fontSize';\n\n/**\n * Filters registered block settings, extending attributes to include\n * `fontSize` and `fontWeight` attributes.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addAttributes( settings ) {\n\tif ( ! hasBlockSupport( settings, FONT_SIZE_SUPPORT_KEY ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify a default value if needed.\n\tif ( ! settings.attributes.fontSize ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tfontSize: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override props assigned to save component to inject font size.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object} blockNameOrType Block type.\n * @param {Object} attributes Block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nfunction addSaveProps( props, blockNameOrType, attributes ) {\n\tif ( ! hasBlockSupport( blockNameOrType, FONT_SIZE_SUPPORT_KEY ) ) {\n\t\treturn props;\n\t}\n\n\tif (\n\t\tshouldSkipSerialization(\n\t\t\tblockNameOrType,\n\t\t\tTYPOGRAPHY_SUPPORT_KEY,\n\t\t\t'fontSize'\n\t\t)\n\t) {\n\t\treturn props;\n\t}\n\n\t// Use TokenList to dedupe classes.\n\tconst classes = new TokenList( props.className );\n\tclasses.add( getFontSizeClass( attributes.fontSize ) );\n\tconst newClassName = classes.value;\n\tprops.className = newClassName ? newClassName : undefined;\n\n\treturn props;\n}\n\n/**\n * Inspector control panel containing the font size related configuration\n *\n * @param {Object} props\n *\n * @return {Element} Font size edit element.\n */\nexport function FontSizeEdit( props ) {\n\tconst {\n\t\tattributes: { fontSize, style },\n\t\tsetAttributes,\n\t} = props;\n\tconst [ fontSizes ] = useSettings( 'typography.fontSizes' );\n\n\tconst onChange = ( value ) => {\n\t\tconst fontSizeSlug = getFontSizeObjectByValue( fontSizes, value ).slug;\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t...style,\n\t\t\t\ttypography: {\n\t\t\t\t\t...style?.typography,\n\t\t\t\t\tfontSize: fontSizeSlug ? undefined : value,\n\t\t\t\t},\n\t\t\t} ),\n\t\t\tfontSize: fontSizeSlug,\n\t\t} );\n\t};\n\n\tconst fontSizeObject = getFontSize(\n\t\tfontSizes,\n\t\tfontSize,\n\t\tstyle?.typography?.fontSize\n\t);\n\n\tconst fontSizeValue =\n\t\tfontSizeObject?.size || style?.typography?.fontSize || fontSize;\n\n\treturn (\n\t\t<FontSizePicker\n\t\t\tonChange={ onChange }\n\t\t\tvalue={ fontSizeValue }\n\t\t\twithReset={ false }\n\t\t\twithSlider\n\t\t\tsize=\"__unstable-large\"\n\t\t/>\n\t);\n}\n\n/**\n * Custom hook that checks if font-size settings have been disabled.\n *\n * @param {string} name The name of the block.\n * @return {boolean} Whether setting is disabled.\n */\nexport function useIsFontSizeDisabled( { name: blockName } = {} ) {\n\tconst [ fontSizes ] = useSettings( 'typography.fontSizes' );\n\tconst hasFontSizes = !! fontSizes?.length;\n\n\treturn (\n\t\t! hasBlockSupport( blockName, FONT_SIZE_SUPPORT_KEY ) || ! hasFontSizes\n\t);\n}\n\nfunction useBlockProps( { name, fontSize, style } ) {\n\tconst [ fontSizes, fluidTypographySettings, layoutSettings ] = useSettings(\n\t\t'typography.fontSizes',\n\t\t'typography.fluid',\n\t\t'layout'\n\t);\n\n\t/*\n\t * Only add inline styles if the block supports font sizes,\n\t * doesn't skip serialization of font sizes,\n\t * and has either a custom font size or a preset font size.\n\t */\n\tif (\n\t\t! hasBlockSupport( name, FONT_SIZE_SUPPORT_KEY ) ||\n\t\tshouldSkipSerialization( name, TYPOGRAPHY_SUPPORT_KEY, 'fontSize' ) ||\n\t\t( ! fontSize && ! style?.typography?.fontSize )\n\t) {\n\t\treturn;\n\t}\n\n\tlet props;\n\n\tif ( style?.typography?.fontSize ) {\n\t\tprops = {\n\t\t\tstyle: {\n\t\t\t\tfontSize: getTypographyFontSizeValue(\n\t\t\t\t\t{ size: style.typography.fontSize },\n\t\t\t\t\t{\n\t\t\t\t\t\ttypography: {\n\t\t\t\t\t\t\tfluid: fluidTypographySettings,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tlayout: layoutSettings,\n\t\t\t\t\t}\n\t\t\t\t),\n\t\t\t},\n\t\t};\n\t}\n\n\tif ( fontSize ) {\n\t\tprops = {\n\t\t\tstyle: {\n\t\t\t\tfontSize: getFontSize(\n\t\t\t\t\tfontSizes,\n\t\t\t\t\tfontSize,\n\t\t\t\t\tstyle?.typography?.fontSize\n\t\t\t\t).size,\n\t\t\t},\n\t\t};\n\t}\n\n\tif ( ! props ) {\n\t\treturn;\n\t}\n\n\treturn addSaveProps( props, name, { fontSize } );\n}\n\nexport default {\n\tuseBlockProps,\n\taddSaveProps,\n\tattributeKeys: [ 'fontSize', 'style' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, FONT_SIZE_SUPPORT_KEY );\n\t},\n};\n\nconst MIGRATION_PATHS = {\n\tfontSize: [ [ 'fontSize' ], [ 'style', 'typography', 'fontSize' ] ],\n};\n\nfunction addTransforms( result, source, index, results ) {\n\tconst destinationBlockType = result.name;\n\tconst activeSupports = {\n\t\tfontSize: hasBlockSupport(\n\t\t\tdestinationBlockType,\n\t\t\tFONT_SIZE_SUPPORT_KEY\n\t\t),\n\t};\n\treturn transformStyles(\n\t\tactiveSupports,\n\t\tMIGRATION_PATHS,\n\t\tresult,\n\t\tsource,\n\t\tindex,\n\t\tresults\n\t);\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/font/addAttribute',\n\taddAttributes\n);\n\naddFilter(\n\t'blocks.switchToBlockType.transformedBlock',\n\t'core/font-size/addTransforms',\n\taddTransforms\n);\n"],
5
- "mappings": "AA4HE;AAzHF,SAAS,iBAAiB;AAC1B,SAAS,uBAAuB;AAChC,OAAO,eAAe;AAKtB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,8BAA8B;AACvC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,mBAAmB;AAC5B,SAAS,kCAAkC;AAEpC,MAAM,wBAAwB;AAUrC,SAAS,cAAe,UAAW;AAClC,MAAK,CAAE,gBAAiB,UAAU,qBAAsB,GAAI;AAC3D,WAAO;AAAA,EACR;AAGA,MAAK,CAAE,SAAS,WAAW,UAAW;AACrC,WAAO,OAAQ,SAAS,YAAY;AAAA,MACnC,UAAU;AAAA,QACT,MAAM;AAAA,MACP;AAAA,IACD,CAAE;AA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;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;AAEA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AACD;AAEA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AACD;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport TokenList from '@wordpress/token-list';\nimport { getTypographyFontSizeValue } from '@wordpress/global-styles-engine';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetFontSize,\n\tgetFontSizeClass,\n\tgetFontSizeObjectByValue,\n\tFontSizePicker,\n} from '../components/font-sizes';\nimport { TYPOGRAPHY_SUPPORT_KEY } from './typography';\nimport {\n\tcleanEmptyObject,\n\ttransformStyles,\n\tshouldSkipSerialization,\n} from './utils';\nimport { useSettings } from '../components/use-settings';\n\nexport const FONT_SIZE_SUPPORT_KEY = 'typography.fontSize';\n\n/**\n * Filters registered block settings, extending attributes to include\n * `fontSize` and `fontWeight` attributes.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addAttributes( settings ) {\n\tif ( ! hasBlockSupport( settings, FONT_SIZE_SUPPORT_KEY ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify a default value if needed.\n\tif ( ! settings.attributes.fontSize ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tfontSize: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override props assigned to save component to inject font size.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object} blockNameOrType Block type.\n * @param {Object} attributes Block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nfunction addSaveProps( props, blockNameOrType, attributes ) {\n\tif ( ! hasBlockSupport( blockNameOrType, FONT_SIZE_SUPPORT_KEY ) ) {\n\t\treturn props;\n\t}\n\n\tif (\n\t\tshouldSkipSerialization(\n\t\t\tblockNameOrType,\n\t\t\tTYPOGRAPHY_SUPPORT_KEY,\n\t\t\t'fontSize'\n\t\t)\n\t) {\n\t\treturn props;\n\t}\n\n\t// Use TokenList to dedupe classes.\n\tconst classes = new TokenList( props.className );\n\tclasses.add( getFontSizeClass( attributes.fontSize ) );\n\tconst newClassName = classes.value;\n\tprops.className = newClassName ? newClassName : undefined;\n\n\treturn props;\n}\n\n/**\n * Inspector control panel containing the font size related configuration\n *\n * @param {Object} props\n *\n * @return {Element} Font size edit element.\n */\nexport function FontSizeEdit( props ) {\n\tconst {\n\t\tattributes: { fontSize, style },\n\t\tsetAttributes,\n\t} = props;\n\tconst [ fontSizes ] = useSettings( 'typography.fontSizes' );\n\n\tconst onChange = ( value ) => {\n\t\tconst fontSizeSlug = getFontSizeObjectByValue( fontSizes, value ).slug;\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t...style,\n\t\t\t\ttypography: {\n\t\t\t\t\t...style?.typography,\n\t\t\t\t\tfontSize: fontSizeSlug ? undefined : value,\n\t\t\t\t},\n\t\t\t} ),\n\t\t\tfontSize: fontSizeSlug,\n\t\t} );\n\t};\n\n\tconst fontSizeObject = getFontSize(\n\t\tfontSizes,\n\t\tfontSize,\n\t\tstyle?.typography?.fontSize\n\t);\n\n\tconst fontSizeValue =\n\t\tfontSizeObject?.size || style?.typography?.fontSize || fontSize;\n\n\treturn (\n\t\t<FontSizePicker\n\t\t\tonChange={ onChange }\n\t\t\tvalue={ fontSizeValue }\n\t\t\twithReset={ false }\n\t\t\twithSlider\n\t\t\tsize=\"__unstable-large\"\n\t\t/>\n\t);\n}\n\n/**\n * Custom hook that checks if font-size settings have been disabled.\n *\n * @param {string} name The name of the block.\n * @return {boolean} Whether setting is disabled.\n */\nexport function useIsFontSizeDisabled( { name: blockName } = {} ) {\n\tconst [ fontSizes ] = useSettings( 'typography.fontSizes' );\n\tconst hasFontSizes = !! fontSizes?.length;\n\n\treturn (\n\t\t! hasBlockSupport( blockName, FONT_SIZE_SUPPORT_KEY ) || ! hasFontSizes\n\t);\n}\n\nfunction useBlockProps( { name, fontSize, style } ) {\n\tconst [ fontSizes, fluidTypographySettings, layoutSettings ] = useSettings(\n\t\t'typography.fontSizes',\n\t\t'typography.fluid',\n\t\t'layout'\n\t);\n\n\t/*\n\t * Only add inline styles if the block supports font sizes,\n\t * doesn't skip serialization of font sizes,\n\t * and has either a custom font size or a preset font size.\n\t */\n\tif (\n\t\t! hasBlockSupport( name, FONT_SIZE_SUPPORT_KEY ) ||\n\t\tshouldSkipSerialization( name, TYPOGRAPHY_SUPPORT_KEY, 'fontSize' ) ||\n\t\t( ! fontSize && ! style?.typography?.fontSize )\n\t) {\n\t\treturn;\n\t}\n\n\tlet props;\n\n\tif ( style?.typography?.fontSize ) {\n\t\tprops = {\n\t\t\tstyle: {\n\t\t\t\tfontSize: getTypographyFontSizeValue(\n\t\t\t\t\t{ size: style.typography.fontSize },\n\t\t\t\t\t{\n\t\t\t\t\t\ttypography: {\n\t\t\t\t\t\t\tfluid: fluidTypographySettings,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tlayout: layoutSettings,\n\t\t\t\t\t}\n\t\t\t\t),\n\t\t\t},\n\t\t};\n\t}\n\n\tif ( fontSize ) {\n\t\tprops = {\n\t\t\tstyle: {\n\t\t\t\tfontSize: getFontSize(\n\t\t\t\t\tfontSizes,\n\t\t\t\t\tfontSize,\n\t\t\t\t\tstyle?.typography?.fontSize\n\t\t\t\t).size,\n\t\t\t},\n\t\t};\n\t}\n\n\tif ( ! props ) {\n\t\treturn;\n\t}\n\n\treturn addSaveProps( props, name, { fontSize } );\n}\n\nexport default {\n\tuseBlockProps,\n\taddSaveProps,\n\tattributeKeys: [ 'fontSize', 'style' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, FONT_SIZE_SUPPORT_KEY );\n\t},\n};\n\nconst MIGRATION_PATHS = {\n\tfontSize: [ [ 'fontSize' ], [ 'style', 'typography', 'fontSize' ] ],\n};\n\nfunction addTransforms( result, source, index, results ) {\n\tconst destinationBlockType = result.name;\n\tconst activeSupports = {\n\t\tfontSize: hasBlockSupport(\n\t\t\tdestinationBlockType,\n\t\t\tFONT_SIZE_SUPPORT_KEY\n\t\t),\n\t};\n\treturn transformStyles(\n\t\tactiveSupports,\n\t\tMIGRATION_PATHS,\n\t\tresult,\n\t\tsource,\n\t\tindex,\n\t\tresults\n\t);\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/font/addAttribute',\n\taddAttributes\n);\n\naddFilter(\n\t'blocks.switchToBlockType.transformedBlock',\n\t'core/font-size/addTransforms',\n\taddTransforms\n);\n"],
5
+ "mappings": "AA4HE;AAzHF,SAAS,iBAAiB;AAC1B,SAAS,uBAAuB;AAChC,OAAO,eAAe;AACtB,SAAS,kCAAkC;AAK3C;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,8BAA8B;AACvC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,mBAAmB;AAErB,MAAM,wBAAwB;AAUrC,SAAS,cAAe,UAAW;AAClC,MAAK,CAAE,gBAAiB,UAAU,qBAAsB,GAAI;AAC3D,WAAO;AAAA,EACR;AAGA,MAAK,CAAE,SAAS,WAAW,UAAW;AACrC,WAAO,OAAQ,SAAS,YAAY;AAAA,MACnC,UAAU;AAAA,QACT,MAAM;AAAA,MACP;AAAA,IACD,CAAE;AAAA,EACH;AAEA,SAAO;AACR;AAWA,SAAS,aAAc,OAAO,iBAAiB,YAAa;AAC3D,MAAK,CAAE,gBAAiB,iBAAiB,qBAAsB,GAAI;AAClE,WAAO;AAAA,EACR;AAEA,MACC;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,EACD,GACC;AACD,WAAO;AAAA,EACR;AAGA,QAAM,UAAU,IAAI,UAAW,MAAM,SAAU;AAC/C,UAAQ,IAAK,iBAAkB,WAAW,QAAS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ACD;AAEA,MAAI;AAEJ,MAAK,OAAO,YAAY,UAAW;AAClC,YAAQ;AAAA,MACP,OAAO;AAAA,QACN,UAAU;AAAA,UACT,EAAE,MAAM,MAAM,WAAW,SAAS;AAAA,UAClC;AAAA,YACC,YAAY;AAAA,cACX,OAAO;AAAA,YACR;AAAA,YACA,QAAQ;AAAA,UACT;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAEA,MAAK,UAAW;AACf,YAAQ;AAAA,MACP,OAAO;AAAA,QACN,UAAU;AAAA,UACT;AAAA,UACA;AAAA,UACA,OAAO,YAAY;AAAA,QACpB,EAAE;AAAA,MACH;AAAA,IACD;AAAA,EACD;AAEA,MAAK,CAAE,OAAQ;AACd;AAAA,EACD;AAEA,SAAO,aAAc,OAAO,MAAM,EAAE,SAAS,CAAE;AAChD;AAEA,IAAO,oBAAQ;AAAA,EACd;AAAA,EACA;AAAA,EACA,eAAe,CAAE,YAAY,OAAQ;AAAA,EACrC,WAAY,MAAO;AAClB,WAAO,gBAAiB,MAAM,qBAAsB;AAAA,EACrD;AACD;AAEA,MAAM,kBAAkB;AAAA,EACvB,UAAU,CAAE,CAAE,UAAW,GAAG,CAAE,SAAS,cAAc,UAAW,CAAE;AACnE;AAEA,SAAS,cAAe,QAAQ,QAAQ,OAAO,SAAU;AACxD,QAAM,uBAAuB,OAAO;AACpC,QAAM,iBAAiB;AAAA,IACtB,UAAU;AAAA,MACT;AAAA,MACA;AAAA,IACD;AAAA,EACD;AACA,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;AAEA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AACD;AAEA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AACD;",
6
6
  "names": []
7
7
  }
@@ -1,8 +1,8 @@
1
1
  import clsx from "clsx";
2
2
  import { privateApis as componentsPrivateApis } from "@wordpress/components";
3
+ import { getTypographyFontSizeValue } from "@wordpress/global-styles-engine";
3
4
  import { getInlineStyles } from "./style";
4
5
  import { getFontSizeClass } from "../components/font-sizes";
5
- import { getTypographyFontSizeValue } from "../components/global-styles/typography-utils";
6
6
  import { unlock } from "../lock-unlock";
7
7
  const { kebabCase } = unlock(componentsPrivateApis);
8
8
  function getTypographyClassesAndStyles(attributes, settings) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/hooks/use-typography-props.js"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { getInlineStyles } from './style';\nimport { getFontSizeClass } from '../components/font-sizes';\nimport { getTypographyFontSizeValue } from '../components/global-styles/typography-utils';\nimport { unlock } from '../lock-unlock';\n\nconst { kebabCase } = unlock( componentsPrivateApis );\n\n/*\n * This utility is intended to assist where the serialization of the typography\n * block support is being skipped for a block but the typography related CSS\n * styles still need to be generated so they can be applied to inner elements.\n */\n/**\n * Provides the CSS class names and inline styles for a block's typography support\n * attributes.\n *\n * @param {Object} attributes Block attributes.\n * @param {Object|boolean} settings Merged theme.json settings\n *\n * @return {Object} Typography block support derived CSS classes & styles.\n */\nexport function getTypographyClassesAndStyles( attributes, settings ) {\n\tlet typographyStyles = attributes?.style?.typography || {};\n\ttypographyStyles = {\n\t\t...typographyStyles,\n\t\tfontSize: getTypographyFontSizeValue(\n\t\t\t{ size: attributes?.style?.typography?.fontSize },\n\t\t\tsettings\n\t\t),\n\t};\n\n\tconst style = getInlineStyles( { typography: typographyStyles } );\n\tconst fontFamilyClassName = !! attributes?.fontFamily\n\t\t? `has-${ kebabCase( attributes.fontFamily ) }-font-family`\n\t\t: '';\n\tconst textAlignClassName = !! attributes?.style?.typography?.textAlign\n\t\t? `has-text-align-${ attributes?.style?.typography?.textAlign }`\n\t\t: '';\n\tconst className = clsx(\n\t\tfontFamilyClassName,\n\t\ttextAlignClassName,\n\t\tgetFontSizeClass( attributes?.fontSize )\n\t);\n\n\treturn {\n\t\tclassName,\n\t\tstyle,\n\t};\n}\n"],
5
- "mappings": "AAGA,OAAO,UAAU;AAKjB,SAAS,eAAe,6BAA6B;AAKrD,SAAS,uBAAuB;AAChC,SAAS,wBAAwB;AACjC,SAAS,kCAAkC;AAC3C,SAAS,cAAc;AAEvB,MAAM,EAAE,UAAU,IAAI,OAAQ,qBAAsB;AAgB7C,SAAS,8BAA+B,YAAY,UAAW;AACrE,MAAI,mBAAmB,YAAY,OAAO,cAAc,CAAC;AACzD,qBAAmB;AAAA,IAClB,GAAG;AAAA,IACH,UAAU;AAAA,MACT,EAAE,MAAM,YAAY,OAAO,YAAY,SAAS;AAAA,MAChD;AAAA,IACD;AAAA,EACD;AAEA,QAAM,QAAQ,gBAAiB,EAAE,YAAY,iBAAiB,CAAE;AAChE,QAAM,sBAAsB,CAAC,CAAE,YAAY,aACxC,OAAQ,UAAW,WAAW,UAAW,CAAE,iBAC3C;AACH,QAAM,qBAAqB,CAAC,CAAE,YAAY,OAAO,YAAY,YAC1D,kBAAmB,YAAY,OAAO,YAAY,SAAU,KAC5D;AACH,QAAM,YAAY;AAAA,IACjB;AAAA,IACA;AAAA,IACA,iBAAkB,YAAY,QAAS;AAAA,EACxC;AAEA,SAAO;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\nimport { getTypographyFontSizeValue } from '@wordpress/global-styles-engine';\n\n/**\n * Internal dependencies\n */\nimport { getInlineStyles } from './style';\nimport { getFontSizeClass } from '../components/font-sizes';\nimport { unlock } from '../lock-unlock';\n\nconst { kebabCase } = unlock( componentsPrivateApis );\n\n/*\n * This utility is intended to assist where the serialization of the typography\n * block support is being skipped for a block but the typography related CSS\n * styles still need to be generated so they can be applied to inner elements.\n */\n/**\n * Provides the CSS class names and inline styles for a block's typography support\n * attributes.\n *\n * @param {Object} attributes Block attributes.\n * @param {Object|boolean} settings Merged theme.json settings\n *\n * @return {Object} Typography block support derived CSS classes & styles.\n */\nexport function getTypographyClassesAndStyles( attributes, settings ) {\n\tlet typographyStyles = attributes?.style?.typography || {};\n\ttypographyStyles = {\n\t\t...typographyStyles,\n\t\tfontSize: getTypographyFontSizeValue(\n\t\t\t{ size: attributes?.style?.typography?.fontSize },\n\t\t\tsettings\n\t\t),\n\t};\n\n\tconst style = getInlineStyles( { typography: typographyStyles } );\n\tconst fontFamilyClassName = !! attributes?.fontFamily\n\t\t? `has-${ kebabCase( attributes.fontFamily ) }-font-family`\n\t\t: '';\n\tconst textAlignClassName = !! attributes?.style?.typography?.textAlign\n\t\t? `has-text-align-${ attributes?.style?.typography?.textAlign }`\n\t\t: '';\n\tconst className = clsx(\n\t\tfontFamilyClassName,\n\t\ttextAlignClassName,\n\t\tgetFontSizeClass( attributes?.fontSize )\n\t);\n\n\treturn {\n\t\tclassName,\n\t\tstyle,\n\t};\n}\n"],
5
+ "mappings": "AAGA,OAAO,UAAU;AAKjB,SAAS,eAAe,6BAA6B;AACrD,SAAS,kCAAkC;AAK3C,SAAS,uBAAuB;AAChC,SAAS,wBAAwB;AACjC,SAAS,cAAc;AAEvB,MAAM,EAAE,UAAU,IAAI,OAAQ,qBAAsB;AAgB7C,SAAS,8BAA+B,YAAY,UAAW;AACrE,MAAI,mBAAmB,YAAY,OAAO,cAAc,CAAC;AACzD,qBAAmB;AAAA,IAClB,GAAG;AAAA,IACH,UAAU;AAAA,MACT,EAAE,MAAM,YAAY,OAAO,YAAY,SAAS;AAAA,MAChD;AAAA,IACD;AAAA,EACD;AAEA,QAAM,QAAQ,gBAAiB,EAAE,YAAY,iBAAiB,CAAE;AAChE,QAAM,sBAAsB,CAAC,CAAE,YAAY,aACxC,OAAQ,UAAW,WAAW,UAAW,CAAE,iBAC3C;AACH,QAAM,qBAAqB,CAAC,CAAE,YAAY,OAAO,YAAY,YAC1D,kBAAmB,YAAY,OAAO,YAAY,SAAU,KAC5D;AACH,QAAM,YAAY;AAAA,IACjB;AAAA,IACA;AAAA,IACA,iBAAkB,YAAY,QAAS;AAAA,EACxC;AAEA,SAAO;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;",
6
6
  "names": []
7
7
  }
@@ -661,7 +661,7 @@ iframe[name=editor-canvas] {
661
661
  }
662
662
 
663
663
  .block-editor-block-card__title {
664
- font-weight: 500;
664
+ font-weight: 499;
665
665
  display: flex;
666
666
  align-items: center;
667
667
  flex-wrap: wrap;
@@ -979,7 +979,7 @@ iframe[name=editor-canvas] {
979
979
  color: #757575;
980
980
  text-transform: uppercase;
981
981
  font-size: 11px;
982
- font-weight: 500;
982
+ font-weight: 499;
983
983
  }
984
984
 
985
985
  .block-editor-block-patterns-list__list-item {
@@ -1132,6 +1132,10 @@ iframe[name=editor-canvas] {
1132
1132
  z-index: 1;
1133
1133
  }
1134
1134
 
1135
+ .block-editor-block-quick-navigation__item {
1136
+ font-weight: 400;
1137
+ }
1138
+
1135
1139
  .block-editor-block-rename-modal {
1136
1140
  z-index: 1000001;
1137
1141
  }
@@ -1267,7 +1271,7 @@ iframe[name=editor-canvas] {
1267
1271
  color: #757575;
1268
1272
  text-transform: uppercase;
1269
1273
  font-size: 11px;
1270
- font-weight: 500;
1274
+ font-weight: 499;
1271
1275
  }
1272
1276
 
1273
1277
  .block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__no-switcher-icon {
@@ -3110,7 +3114,7 @@ iframe[name=editor-canvas] {
3110
3114
  }
3111
3115
 
3112
3116
  .block-editor-multi-selection-inspector__card-title {
3113
- font-weight: 500;
3117
+ font-weight: 499;
3114
3118
  }
3115
3119
 
3116
3120
  .block-editor-multi-selection-inspector__card .block-editor-block-icon {
@@ -3917,7 +3921,7 @@ div.block-editor-bindings__panel button:hover .block-editor-bindings__item span
3917
3921
  color: #757575;
3918
3922
  text-transform: uppercase;
3919
3923
  font-size: 11px;
3920
- font-weight: 500;
3924
+ font-weight: 499;
3921
3925
  }
3922
3926
 
3923
3927
  .block-editor-inserter__panel-dropdown select.components-select-control__input.components-select-control__input.components-select-control__input {
@@ -4188,7 +4192,7 @@ div.block-editor-bindings__panel button:hover .block-editor-bindings__item span
4188
4192
  }
4189
4193
 
4190
4194
  .components-heading.block-editor-inserter__patterns-category-panel-title {
4191
- font-weight: 500;
4195
+ font-weight: 499;
4192
4196
  }
4193
4197
 
4194
4198
  .block-editor-inserter__patterns-explore-button.components-button,
@@ -661,7 +661,7 @@ iframe[name=editor-canvas] {
661
661
  }
662
662
 
663
663
  .block-editor-block-card__title {
664
- font-weight: 500;
664
+ font-weight: 499;
665
665
  display: flex;
666
666
  align-items: center;
667
667
  flex-wrap: wrap;
@@ -979,7 +979,7 @@ iframe[name=editor-canvas] {
979
979
  color: #757575;
980
980
  text-transform: uppercase;
981
981
  font-size: 11px;
982
- font-weight: 500;
982
+ font-weight: 499;
983
983
  }
984
984
 
985
985
  .block-editor-block-patterns-list__list-item {
@@ -1132,6 +1132,10 @@ iframe[name=editor-canvas] {
1132
1132
  z-index: 1;
1133
1133
  }
1134
1134
 
1135
+ .block-editor-block-quick-navigation__item {
1136
+ font-weight: 400;
1137
+ }
1138
+
1135
1139
  .block-editor-block-rename-modal {
1136
1140
  z-index: 1000001;
1137
1141
  }
@@ -1267,7 +1271,7 @@ iframe[name=editor-canvas] {
1267
1271
  color: #757575;
1268
1272
  text-transform: uppercase;
1269
1273
  font-size: 11px;
1270
- font-weight: 500;
1274
+ font-weight: 499;
1271
1275
  }
1272
1276
 
1273
1277
  .block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__no-switcher-icon {
@@ -3112,7 +3116,7 @@ iframe[name=editor-canvas] {
3112
3116
  }
3113
3117
 
3114
3118
  .block-editor-multi-selection-inspector__card-title {
3115
- font-weight: 500;
3119
+ font-weight: 499;
3116
3120
  }
3117
3121
 
3118
3122
  .block-editor-multi-selection-inspector__card .block-editor-block-icon {
@@ -3919,7 +3923,7 @@ div.block-editor-bindings__panel button:hover .block-editor-bindings__item span
3919
3923
  color: #757575;
3920
3924
  text-transform: uppercase;
3921
3925
  font-size: 11px;
3922
- font-weight: 500;
3926
+ font-weight: 499;
3923
3927
  }
3924
3928
 
3925
3929
  .block-editor-inserter__panel-dropdown select.components-select-control__input.components-select-control__input.components-select-control__input {
@@ -4190,7 +4194,7 @@ div.block-editor-bindings__panel button:hover .block-editor-bindings__item span
4190
4194
  }
4191
4195
 
4192
4196
  .components-heading.block-editor-inserter__patterns-category-panel-title {
4193
- font-weight: 500;
4197
+ font-weight: 499;
4194
4198
  }
4195
4199
 
4196
4200
  .block-editor-inserter__patterns-explore-button.components-button,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-editor",
3
- "version": "15.6.0",
3
+ "version": "15.6.1-next.36001005c.0",
4
4
  "description": "Generic block editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -56,39 +56,40 @@
56
56
  "@emotion/react": "^11.7.1",
57
57
  "@emotion/styled": "^11.6.0",
58
58
  "@react-spring/web": "^9.4.5",
59
- "@wordpress/a11y": "^4.33.0",
60
- "@wordpress/api-fetch": "^7.33.0",
61
- "@wordpress/base-styles": "^6.9.0",
62
- "@wordpress/blob": "^4.33.0",
63
- "@wordpress/block-serialization-default-parser": "^5.33.0",
64
- "@wordpress/blocks": "^15.6.0",
65
- "@wordpress/commands": "^1.33.0",
66
- "@wordpress/components": "^30.6.0",
67
- "@wordpress/compose": "^7.33.0",
68
- "@wordpress/data": "^10.33.0",
69
- "@wordpress/date": "^5.33.0",
70
- "@wordpress/deprecated": "^4.33.0",
71
- "@wordpress/dom": "^4.33.0",
72
- "@wordpress/element": "^6.33.0",
73
- "@wordpress/escape-html": "^3.33.0",
74
- "@wordpress/hooks": "^4.33.0",
75
- "@wordpress/html-entities": "^4.33.0",
76
- "@wordpress/i18n": "^6.6.0",
77
- "@wordpress/icons": "^11.0.0",
78
- "@wordpress/is-shallow-equal": "^5.33.0",
79
- "@wordpress/keyboard-shortcuts": "^5.33.0",
80
- "@wordpress/keycodes": "^4.33.0",
81
- "@wordpress/notices": "^5.33.0",
82
- "@wordpress/preferences": "^4.33.0",
83
- "@wordpress/priority-queue": "^3.33.0",
84
- "@wordpress/private-apis": "^1.33.0",
85
- "@wordpress/rich-text": "^7.33.0",
86
- "@wordpress/style-engine": "^2.33.0",
87
- "@wordpress/token-list": "^3.33.0",
88
- "@wordpress/upload-media": "^0.18.0",
89
- "@wordpress/url": "^4.33.0",
90
- "@wordpress/warning": "^3.33.0",
91
- "@wordpress/wordcount": "^4.33.0",
59
+ "@wordpress/a11y": "^4.33.1-next.36001005c.0",
60
+ "@wordpress/api-fetch": "^7.33.1-next.36001005c.0",
61
+ "@wordpress/base-styles": "^6.10.1-next.36001005c.0",
62
+ "@wordpress/blob": "^4.33.1-next.36001005c.0",
63
+ "@wordpress/block-serialization-default-parser": "^5.33.1-next.36001005c.0",
64
+ "@wordpress/blocks": "^15.6.1-next.36001005c.0",
65
+ "@wordpress/commands": "^1.33.1-next.36001005c.0",
66
+ "@wordpress/components": "^30.7.1-next.36001005c.0",
67
+ "@wordpress/compose": "^7.33.1-next.36001005c.0",
68
+ "@wordpress/data": "^10.33.1-next.36001005c.0",
69
+ "@wordpress/date": "^5.33.1-next.36001005c.0",
70
+ "@wordpress/deprecated": "^4.33.1-next.36001005c.0",
71
+ "@wordpress/dom": "^4.33.1-next.36001005c.0",
72
+ "@wordpress/element": "^6.33.1-next.36001005c.0",
73
+ "@wordpress/escape-html": "^3.33.1-next.36001005c.0",
74
+ "@wordpress/global-styles-engine": "^1.0.1-next.36001005c.0",
75
+ "@wordpress/hooks": "^4.33.1-next.36001005c.0",
76
+ "@wordpress/html-entities": "^4.33.1-next.36001005c.0",
77
+ "@wordpress/i18n": "^6.6.1-next.36001005c.0",
78
+ "@wordpress/icons": "^11.0.1-next.36001005c.0",
79
+ "@wordpress/is-shallow-equal": "^5.33.1-next.36001005c.0",
80
+ "@wordpress/keyboard-shortcuts": "^5.33.1-next.36001005c.0",
81
+ "@wordpress/keycodes": "^4.33.1-next.36001005c.0",
82
+ "@wordpress/notices": "^5.33.1-next.36001005c.0",
83
+ "@wordpress/preferences": "^4.33.1-next.36001005c.0",
84
+ "@wordpress/priority-queue": "^3.33.1-next.36001005c.0",
85
+ "@wordpress/private-apis": "^1.33.1-next.36001005c.0",
86
+ "@wordpress/rich-text": "^7.33.1-next.36001005c.0",
87
+ "@wordpress/style-engine": "^2.33.1-next.36001005c.0",
88
+ "@wordpress/token-list": "^3.33.1-next.36001005c.0",
89
+ "@wordpress/upload-media": "^0.18.1-next.36001005c.0",
90
+ "@wordpress/url": "^4.33.1-next.36001005c.0",
91
+ "@wordpress/warning": "^3.33.1-next.36001005c.0",
92
+ "@wordpress/wordcount": "^4.33.1-next.36001005c.0",
92
93
  "change-case": "^4.1.2",
93
94
  "clsx": "^2.1.1",
94
95
  "colord": "^2.7.0",
@@ -111,5 +112,5 @@
111
112
  "publishConfig": {
112
113
  "access": "public"
113
114
  },
114
- "gitHead": "2bbe0d34ab65458468758c48826296d7a753428b"
115
+ "gitHead": "b73a8a22e779c59efb8f911e32b681652f237d60"
115
116
  }
@@ -33,11 +33,11 @@ import { useRef, useState, useEffect, useMemo } from '@wordpress/element';
33
33
  import { useDispatch, useSelect } from '@wordpress/data';
34
34
  import { focus } from '@wordpress/dom';
35
35
  import { isBlobURL } from '@wordpress/blob';
36
+ import { getResolvedValue } from '@wordpress/global-styles-engine';
36
37
 
37
38
  /**
38
39
  * Internal dependencies
39
40
  */
40
- import { getResolvedValue } from '../global-styles/utils';
41
41
  import { hasBackgroundImageValue } from '../global-styles/background-panel';
42
42
  import { setImmutably } from '../../utils/object';
43
43
  import MediaReplaceFlow from '../media-replace-flow';
@@ -9,7 +9,7 @@
9
9
  }
10
10
 
11
11
  .block-editor-block-card__title {
12
- font-weight: 500;
12
+ font-weight: $font-weight-medium;
13
13
  display: flex;
14
14
  align-items: center;
15
15
  flex-wrap: wrap;
@@ -10,5 +10,5 @@
10
10
  color: $gray-700;
11
11
  text-transform: uppercase;
12
12
  font-size: 11px;
13
- font-weight: 500;
13
+ font-weight: $font-weight-medium;
14
14
  }
@@ -60,6 +60,7 @@ function BlockQuickNavigationItem( { clientId, onSelect } ) {
60
60
  return (
61
61
  <Button
62
62
  __next40pxDefaultSize
63
+ className="block-editor-block-quick-navigation__item"
63
64
  isPressed={ isSelected }
64
65
  onClick={ async () => {
65
66
  await selectBlock( clientId );
@@ -0,0 +1,5 @@
1
+ @use "@wordpress/base-styles/variables";
2
+
3
+ .block-editor-block-quick-navigation__item {
4
+ font-weight: variables.$font-weight-regular;
5
+ }
@@ -94,7 +94,7 @@
94
94
  color: $gray-700;
95
95
  text-transform: uppercase;
96
96
  font-size: 11px;
97
- font-weight: 500;
97
+ font-weight: $font-weight-medium;
98
98
  }
99
99
 
100
100
  // The block switcher in the contextual toolbar should be bigger.
@@ -42,7 +42,7 @@ exports[`ColorPaletteControl matches the snapshot 1`] = `
42
42
 
43
43
  .emotion-6 {
44
44
  font-size: 11px;
45
- font-weight: 500;
45
+ font-weight: 499;
46
46
  line-height: 1.4;
47
47
  text-transform: uppercase;
48
48
  display: block;
@@ -11,13 +11,14 @@ import {
11
11
  } from '@wordpress/components';
12
12
  import { useCallback, useMemo } from '@wordpress/element';
13
13
  import { __ } from '@wordpress/i18n';
14
+ import { getValueFromVariable } from '@wordpress/global-styles-engine';
14
15
 
15
16
  /**
16
17
  * Internal dependencies
17
18
  */
18
19
  import BorderRadiusControl from '../border-radius-control';
19
20
  import { useColorsPerOrigin } from './hooks';
20
- import { getValueFromVariable, useToolsPanelDropdownMenuProps } from './utils';
21
+ import { useToolsPanelDropdownMenuProps } from './utils';
21
22
  import { setImmutably } from '../../utils/object';
22
23
  import { useBorderPanelLabel } from '../../hooks/border';
23
24
  import { ShadowPopover, useShadowPresets } from './shadow-panel-components';
@@ -21,13 +21,14 @@ import {
21
21
  } from '@wordpress/components';
22
22
  import { useCallback, useRef } from '@wordpress/element';
23
23
  import { __ } from '@wordpress/i18n';
24
+ import { getValueFromVariable } from '@wordpress/global-styles-engine';
24
25
 
25
26
  /**
26
27
  * Internal dependencies
27
28
  */
28
29
  import ColorGradientControl from '../colors-gradients/control';
29
30
  import { useColorsPerOrigin, useGradientsPerOrigin } from './hooks';
30
- import { getValueFromVariable, useToolsPanelDropdownMenuProps } from './utils';
31
+ import { useToolsPanelDropdownMenuProps } from './utils';
31
32
  import { setImmutably } from '../../utils/object';
32
33
  import { unlock } from '../../lock-unlock';
33
34
  import { reset as resetIcon } from '@wordpress/icons';
@@ -5,13 +5,13 @@ import { useSelect } from '@wordpress/data';
5
5
  import { useEffect, useState, useMemo, useCallback } from '@wordpress/element';
6
6
  import { __ } from '@wordpress/i18n';
7
7
  import { store as blockEditorStore } from '@wordpress/block-editor';
8
+ import { getValueFromVariable } from '@wordpress/global-styles-engine';
8
9
 
9
10
  /**
10
11
  * Internal dependencies
11
12
  */
12
13
  import PanelColorGradientSettings from '../colors-gradients/panel-color-gradient-settings';
13
14
  import { useColorsPerOrigin, useGradientsPerOrigin } from './hooks';
14
- import { getValueFromVariable } from './utils';
15
15
  import { setImmutably } from '../../utils/object';
16
16
  import ContrastChecker from '../contrast-checker';
17
17
  import InspectorControls from '../inspector-controls';
@@ -17,11 +17,12 @@ import {
17
17
  } from '@wordpress/components';
18
18
  import { Icon, alignNone, stretchWide } from '@wordpress/icons';
19
19
  import { useCallback, useState, Platform } from '@wordpress/element';
20
+ import { getValueFromVariable } from '@wordpress/global-styles-engine';
20
21
 
21
22
  /**
22
23
  * Internal dependencies
23
24
  */
24
- import { getValueFromVariable, useToolsPanelDropdownMenuProps } from './utils';
25
+ import { useToolsPanelDropdownMenuProps } from './utils';
25
26
  import SpacingSizesControl from '../spacing-sizes-control';
26
27
  import HeightControl from '../height-control';
27
28
  import ChildLayoutControl from '../child-layout-control';
@@ -24,11 +24,12 @@ import {
24
24
  import { __, _x } from '@wordpress/i18n';
25
25
  import { useCallback, useMemo, useRef } from '@wordpress/element';
26
26
  import { reset as resetIcon } from '@wordpress/icons';
27
+ import { getValueFromVariable } from '@wordpress/global-styles-engine';
27
28
 
28
29
  /**
29
30
  * Internal dependencies
30
31
  */
31
- import { getValueFromVariable, useToolsPanelDropdownMenuProps } from './utils';
32
+ import { useToolsPanelDropdownMenuProps } from './utils';
32
33
  import { setImmutably } from '../../utils/object';
33
34
 
34
35
  const EMPTY_ARRAY = [];