@wordpress/format-library 4.14.0 → 4.15.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 CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 4.15.0 (2023-07-20)
6
+
5
7
  ## 4.14.0 (2023-07-05)
6
8
 
7
9
  ## 4.13.0 (2023-06-23)
@@ -103,7 +103,9 @@ function TextColorEdit({
103
103
  onChange((0, _richText.removeFormat)(value, name));
104
104
  }
105
105
  }, [hasColorsToChoose, value]);
106
- const outlineStyle = (0, _compose.usePreferredColorSchemeStyle)(_style.default['components-inline-color__outline'], _style.default['components-inline-color__outline--dark']);
106
+ const outlineStyle = [(0, _compose.usePreferredColorSchemeStyle)(_style.default['components-inline-color__outline'], _style.default['components-inline-color__outline--dark']), {
107
+ borderWidth: _reactNative.StyleSheet.hairlineWidth
108
+ }];
107
109
 
108
110
  if (!hasColorsToChoose && !isActive) {
109
111
  return null;
@@ -123,7 +125,7 @@ function TextColorEdit({
123
125
  name: "text-color",
124
126
  isActive: isActive,
125
127
  icon: (0, _element.createElement)(_icons.Icon, {
126
- icon: _icons.textColor,
128
+ icon: Object.keys(activeAttributes).length ? _icons.textColor : _icons.color,
127
129
  style: colorIndicatorStyle?.color && {
128
130
  color: colorIndicatorStyle.color
129
131
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/format-library/src/text-color/index.native.js"],"names":["name","title","getComputedStyleProperty","element","property","props","style","backgroundColor","baseColors","color","background","fillComputedColors","TextColorEdit","value","onChange","isActive","activeAttributes","contentRef","allowCustomControl","colors","isAddingColor","setIsAddingColor","enableIsAddingColor","disableIsAddingColor","colorIndicatorStyle","hasColorsToChoose","length","onPressButton","outlineStyle","styles","isActiveStyle","customContainerStyles","textColorIcon","textColor","tagName","className","attributes","class","__unstableFilterAttributeValue","key","newValue","replace","includes","addedCSS","transparentValue","join","edit"],"mappings":";;;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,GAAG3B,KAAK,EAAE4B,OAAP,CAAgB,IAAhB,EAAsB,EAAtB,CAAjB,CAH4C,CAI5C;;AACA,QAAKD,QAAQ,IAAIA,QAAQ,CAACE,QAAT,CAAmB,kBAAnB,CAAjB,EACC,OAAOF,QAAP;AACD,UAAMG,QAAQ,GAAG,CAAE,kBAAF,EAAsBC,uBAAtB,EAAyCC,IAAzC,CAA+C,GAA/C,CAAjB,CAP4C,CAQ5C;AACA;;AACA,WAAOL,QAAQ,GAAG,CAAEG,QAAF,EAAYH,QAAZ,EAAuBK,IAAvB,CAA6B,GAA7B,CAAH,GAAwCF,QAAvD;AACA,GA7BuB;;AA8BxBG,EAAAA,IAAI,EAAElC;AA9BkB,CAAlB","sourcesContent":["/**\n * External dependencies\n */\nimport { View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useCallback, useMemo, useState } from '@wordpress/element';\nimport { BlockControls, useSetting } from '@wordpress/block-editor';\nimport {\n\tToolbarGroup,\n\tToolbarButton,\n\tuseMobileGlobalStylesColors,\n} from '@wordpress/components';\nimport { Icon, textColor as textColorIcon } from '@wordpress/icons';\nimport { removeFormat } from '@wordpress/rich-text';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { getActiveColors } from './inline.js';\nimport { transparentValue } from './index.js';\nimport { default as InlineColorUI } from './inline';\nimport styles from './style.scss';\n\nconst name = 'core/text-color';\nconst title = __( 'Text color' );\n\nfunction getComputedStyleProperty( element, property ) {\n\tconst {\n\t\tprops: { style = {} },\n\t} = element;\n\n\tif ( property === 'background-color' ) {\n\t\tconst { backgroundColor, baseColors } = style;\n\n\t\tif ( backgroundColor !== 'transparent' ) {\n\t\t\treturn backgroundColor;\n\t\t} else if ( baseColors && baseColors?.color?.background ) {\n\t\t\treturn baseColors?.color?.background;\n\t\t}\n\n\t\treturn 'transparent';\n\t}\n}\n\nfunction fillComputedColors( element, { color, backgroundColor } ) {\n\tif ( ! color && ! backgroundColor ) {\n\t\treturn;\n\t}\n\n\treturn {\n\t\tcolor: color || getComputedStyleProperty( element, 'color' ),\n\t\tbackgroundColor: getComputedStyleProperty(\n\t\t\telement,\n\t\t\t'background-color'\n\t\t),\n\t};\n}\n\nfunction TextColorEdit( {\n\tvalue,\n\tonChange,\n\tisActive,\n\tactiveAttributes,\n\tcontentRef,\n} ) {\n\tconst allowCustomControl = useSetting( 'color.custom' );\n\tconst colors = useMobileGlobalStylesColors();\n\tconst [ isAddingColor, setIsAddingColor ] = useState( false );\n\tconst enableIsAddingColor = useCallback(\n\t\t() => setIsAddingColor( true ),\n\t\t[ setIsAddingColor ]\n\t);\n\tconst disableIsAddingColor = useCallback(\n\t\t() => setIsAddingColor( false ),\n\t\t[ setIsAddingColor ]\n\t);\n\tconst colorIndicatorStyle = useMemo(\n\t\t() =>\n\t\t\tfillComputedColors(\n\t\t\t\tcontentRef,\n\t\t\t\tgetActiveColors( value, name, colors )\n\t\t\t),\n\t\t[ value, colors ]\n\t);\n\n\tconst hasColorsToChoose = colors.length || ! allowCustomControl;\n\n\tconst onPressButton = useCallback( () => {\n\t\tif ( hasColorsToChoose ) {\n\t\t\tenableIsAddingColor();\n\t\t} else {\n\t\t\tonChange( removeFormat( value, name ) );\n\t\t}\n\t}, [ hasColorsToChoose, value ] );\n\n\tconst outlineStyle = usePreferredColorSchemeStyle(\n\t\tstyles[ 'components-inline-color__outline' ],\n\t\tstyles[ 'components-inline-color__outline--dark' ]\n\t);\n\n\tif ( ! hasColorsToChoose && ! isActive ) {\n\t\treturn null;\n\t}\n\n\tconst isActiveStyle = {\n\t\t...colorIndicatorStyle,\n\t\t...( ! colorIndicatorStyle?.backgroundColor\n\t\t\t? { backgroundColor: 'transparent' }\n\t\t\t: {} ),\n\t\t...styles[ 'components-inline-color--is-active' ],\n\t};\n\n\tconst customContainerStyles =\n\t\tstyles[ 'components-inline-color__button-container' ];\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t{ isActive && (\n\t\t\t\t\t\t<View style={ outlineStyle } pointerEvents=\"none\" />\n\t\t\t\t\t) }\n\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tname=\"text-color\"\n\t\t\t\t\t\tisActive={ isActive }\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\ticon={ textColorIcon }\n\t\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t\tcolorIndicatorStyle?.color && {\n\t\t\t\t\t\t\t\t\t\tcolor: colorIndicatorStyle.color,\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttitle={ title }\n\t\t\t\t\t\textraProps={ {\n\t\t\t\t\t\t\tisActiveStyle,\n\t\t\t\t\t\t\tcustomContainerStyles,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\t// If has no colors to choose but a color is active remove the color onClick\n\t\t\t\t\t\tonClick={ onPressButton }\n\t\t\t\t\t/>\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t\t{ isAddingColor && (\n\t\t\t\t<InlineColorUI\n\t\t\t\t\tname={ name }\n\t\t\t\t\tonClose={ disableIsAddingColor }\n\t\t\t\t\tactiveAttributes={ activeAttributes }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport const textColor = {\n\tname,\n\ttitle,\n\ttagName: 'mark',\n\tclassName: 'has-inline-color',\n\tattributes: {\n\t\tstyle: 'style',\n\t\tclass: 'class',\n\t},\n\t/*\n\t * Since this format relies on the <mark> tag, it's important to\n\t * prevent the default yellow background color applied by most\n\t * browsers. The solution is to detect when this format is used with a\n\t * text color but no background color, and in such cases to override\n\t * the default styling with a transparent background.\n\t *\n\t * @see https://github.com/WordPress/gutenberg/pull/35516\n\t */\n\t__unstableFilterAttributeValue( key, value ) {\n\t\tif ( key !== 'style' ) return value;\n\t\t// We need to remove the extra spaces within the styles on mobile\n\t\tconst newValue = value?.replace( / /g, '' );\n\t\t// We should not add a background-color if it's already set\n\t\tif ( newValue && newValue.includes( 'background-color' ) )\n\t\t\treturn newValue;\n\t\tconst addedCSS = [ 'background-color', transparentValue ].join( ':' );\n\t\t// Prepend `addedCSS` to avoid a double `;;` as any the existing CSS\n\t\t// rules will already include a `;`.\n\t\treturn newValue ? [ addedCSS, newValue ].join( ';' ) : addedCSS;\n\t},\n\tedit: TextColorEdit,\n};\n"]}
1
+ {"version":3,"sources":["@wordpress/format-library/src/text-color/index.native.js"],"names":["name","title","getComputedStyleProperty","element","property","props","style","backgroundColor","baseColors","color","background","fillComputedColors","TextColorEdit","value","onChange","isActive","activeAttributes","contentRef","allowCustomControl","colors","isAddingColor","setIsAddingColor","enableIsAddingColor","disableIsAddingColor","colorIndicatorStyle","hasColorsToChoose","length","onPressButton","outlineStyle","styles","borderWidth","StyleSheet","hairlineWidth","isActiveStyle","customContainerStyles","Object","keys","textColorIcon","colorIcon","textColor","tagName","className","attributes","class","__unstableFilterAttributeValue","key","newValue","replace","includes","addedCSS","transparentValue","join","edit"],"mappings":";;;;;;;;;AASA;;AANA;;AAKA;;AAEA;;AACA;;AAKA;;AAKA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AA9BA;AACA;AACA;;AAGA;AACA;AACA;;AAiBA;AACA;AACA;AAMA,MAAMA,IAAI,GAAG,iBAAb;AACA,MAAMC,KAAK,GAAG,cAAI,YAAJ,CAAd;;AAEA,SAASC,wBAAT,CAAmCC,OAAnC,EAA4CC,QAA5C,EAAuD;AACtD,QAAM;AACLC,IAAAA,KAAK,EAAE;AAAEC,MAAAA,KAAK,GAAG;AAAV;AADF,MAEFH,OAFJ;;AAIA,MAAKC,QAAQ,KAAK,kBAAlB,EAAuC;A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AQ5C;AACA;;AACA,WAAOL,QAAQ,GAAG,CAAEG,QAAF,EAAYH,QAAZ,EAAuBK,IAAvB,CAA6B,GAA7B,CAAH,GAAwCF,QAAvD;AACA,GA7BuB;;AA8BxBG,EAAAA,IAAI,EAAExC;AA9BkB,CAAlB","sourcesContent":["/**\n * External dependencies\n */\nimport { StyleSheet, View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useCallback, useMemo, useState } from '@wordpress/element';\nimport { BlockControls, useSetting } from '@wordpress/block-editor';\nimport {\n\tToolbarGroup,\n\tToolbarButton,\n\tuseMobileGlobalStylesColors,\n} from '@wordpress/components';\nimport {\n\tIcon,\n\tcolor as colorIcon,\n\ttextColor as textColorIcon,\n} from '@wordpress/icons';\nimport { removeFormat } from '@wordpress/rich-text';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { getActiveColors } from './inline.js';\nimport { transparentValue } from './index.js';\nimport { default as InlineColorUI } from './inline';\nimport styles from './style.scss';\n\nconst name = 'core/text-color';\nconst title = __( 'Text color' );\n\nfunction getComputedStyleProperty( element, property ) {\n\tconst {\n\t\tprops: { style = {} },\n\t} = element;\n\n\tif ( property === 'background-color' ) {\n\t\tconst { backgroundColor, baseColors } = style;\n\n\t\tif ( backgroundColor !== 'transparent' ) {\n\t\t\treturn backgroundColor;\n\t\t} else if ( baseColors && baseColors?.color?.background ) {\n\t\t\treturn baseColors?.color?.background;\n\t\t}\n\n\t\treturn 'transparent';\n\t}\n}\n\nfunction fillComputedColors( element, { color, backgroundColor } ) {\n\tif ( ! color && ! backgroundColor ) {\n\t\treturn;\n\t}\n\n\treturn {\n\t\tcolor: color || getComputedStyleProperty( element, 'color' ),\n\t\tbackgroundColor: getComputedStyleProperty(\n\t\t\telement,\n\t\t\t'background-color'\n\t\t),\n\t};\n}\n\nfunction TextColorEdit( {\n\tvalue,\n\tonChange,\n\tisActive,\n\tactiveAttributes,\n\tcontentRef,\n} ) {\n\tconst allowCustomControl = useSetting( 'color.custom' );\n\tconst colors = useMobileGlobalStylesColors();\n\tconst [ isAddingColor, setIsAddingColor ] = useState( false );\n\tconst enableIsAddingColor = useCallback(\n\t\t() => setIsAddingColor( true ),\n\t\t[ setIsAddingColor ]\n\t);\n\tconst disableIsAddingColor = useCallback(\n\t\t() => setIsAddingColor( false ),\n\t\t[ setIsAddingColor ]\n\t);\n\tconst colorIndicatorStyle = useMemo(\n\t\t() =>\n\t\t\tfillComputedColors(\n\t\t\t\tcontentRef,\n\t\t\t\tgetActiveColors( value, name, colors )\n\t\t\t),\n\t\t[ value, colors ]\n\t);\n\n\tconst hasColorsToChoose = colors.length || ! allowCustomControl;\n\n\tconst onPressButton = useCallback( () => {\n\t\tif ( hasColorsToChoose ) {\n\t\t\tenableIsAddingColor();\n\t\t} else {\n\t\t\tonChange( removeFormat( value, name ) );\n\t\t}\n\t}, [ hasColorsToChoose, value ] );\n\n\tconst outlineStyle = [\n\t\tusePreferredColorSchemeStyle(\n\t\t\tstyles[ 'components-inline-color__outline' ],\n\t\t\tstyles[ 'components-inline-color__outline--dark' ]\n\t\t),\n\t\t{ borderWidth: StyleSheet.hairlineWidth },\n\t];\n\n\tif ( ! hasColorsToChoose && ! isActive ) {\n\t\treturn null;\n\t}\n\n\tconst isActiveStyle = {\n\t\t...colorIndicatorStyle,\n\t\t...( ! colorIndicatorStyle?.backgroundColor\n\t\t\t? { backgroundColor: 'transparent' }\n\t\t\t: {} ),\n\t\t...styles[ 'components-inline-color--is-active' ],\n\t};\n\n\tconst customContainerStyles =\n\t\tstyles[ 'components-inline-color__button-container' ];\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t{ isActive && (\n\t\t\t\t\t\t<View style={ outlineStyle } pointerEvents=\"none\" />\n\t\t\t\t\t) }\n\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tname=\"text-color\"\n\t\t\t\t\t\tisActive={ isActive }\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\tObject.keys( activeAttributes ).length\n\t\t\t\t\t\t\t\t\t\t? textColorIcon\n\t\t\t\t\t\t\t\t\t\t: colorIcon\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t\tcolorIndicatorStyle?.color && {\n\t\t\t\t\t\t\t\t\t\tcolor: colorIndicatorStyle.color,\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttitle={ title }\n\t\t\t\t\t\textraProps={ {\n\t\t\t\t\t\t\tisActiveStyle,\n\t\t\t\t\t\t\tcustomContainerStyles,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\t// If has no colors to choose but a color is active remove the color onClick\n\t\t\t\t\t\tonClick={ onPressButton }\n\t\t\t\t\t/>\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t\t{ isAddingColor && (\n\t\t\t\t<InlineColorUI\n\t\t\t\t\tname={ name }\n\t\t\t\t\tonClose={ disableIsAddingColor }\n\t\t\t\t\tactiveAttributes={ activeAttributes }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport const textColor = {\n\tname,\n\ttitle,\n\ttagName: 'mark',\n\tclassName: 'has-inline-color',\n\tattributes: {\n\t\tstyle: 'style',\n\t\tclass: 'class',\n\t},\n\t/*\n\t * Since this format relies on the <mark> tag, it's important to\n\t * prevent the default yellow background color applied by most\n\t * browsers. The solution is to detect when this format is used with a\n\t * text color but no background color, and in such cases to override\n\t * the default styling with a transparent background.\n\t *\n\t * @see https://github.com/WordPress/gutenberg/pull/35516\n\t */\n\t__unstableFilterAttributeValue( key, value ) {\n\t\tif ( key !== 'style' ) return value;\n\t\t// We need to remove the extra spaces within the styles on mobile\n\t\tconst newValue = value?.replace( / /g, '' );\n\t\t// We should not add a background-color if it's already set\n\t\tif ( newValue && newValue.includes( 'background-color' ) )\n\t\t\treturn newValue;\n\t\tconst addedCSS = [ 'background-color', transparentValue ].join( ':' );\n\t\t// Prepend `addedCSS` to avoid a double `;;` as any the existing CSS\n\t\t// rules will already include a `;`.\n\t\treturn newValue ? [ addedCSS, newValue ].join( ';' ) : addedCSS;\n\t},\n\tedit: TextColorEdit,\n};\n"]}
@@ -3,7 +3,7 @@ import { createElement, Fragment } from "@wordpress/element";
3
3
  /**
4
4
  * External dependencies
5
5
  */
6
- import { View } from 'react-native';
6
+ import { StyleSheet, View } from 'react-native';
7
7
  /**
8
8
  * WordPress dependencies
9
9
  */
@@ -12,7 +12,7 @@ import { __ } from '@wordpress/i18n';
12
12
  import { useCallback, useMemo, useState } from '@wordpress/element';
13
13
  import { BlockControls, useSetting } from '@wordpress/block-editor';
14
14
  import { ToolbarGroup, ToolbarButton, useMobileGlobalStylesColors } from '@wordpress/components';
15
- import { Icon, textColor as textColorIcon } from '@wordpress/icons';
15
+ import { Icon, color as colorIcon, textColor as textColorIcon } from '@wordpress/icons';
16
16
  import { removeFormat } from '@wordpress/rich-text';
17
17
  import { usePreferredColorSchemeStyle } from '@wordpress/compose';
18
18
  /**
@@ -85,7 +85,9 @@ function TextColorEdit({
85
85
  onChange(removeFormat(value, name));
86
86
  }
87
87
  }, [hasColorsToChoose, value]);
88
- const outlineStyle = usePreferredColorSchemeStyle(styles['components-inline-color__outline'], styles['components-inline-color__outline--dark']);
88
+ const outlineStyle = [usePreferredColorSchemeStyle(styles['components-inline-color__outline'], styles['components-inline-color__outline--dark']), {
89
+ borderWidth: StyleSheet.hairlineWidth
90
+ }];
89
91
 
90
92
  if (!hasColorsToChoose && !isActive) {
91
93
  return null;
@@ -105,7 +107,7 @@ function TextColorEdit({
105
107
  name: "text-color",
106
108
  isActive: isActive,
107
109
  icon: createElement(Icon, {
108
- icon: textColorIcon,
110
+ icon: Object.keys(activeAttributes).length ? textColorIcon : colorIcon,
109
111
  style: colorIndicatorStyle?.color && {
110
112
  color: colorIndicatorStyle.color
111
113
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/format-library/src/text-color/index.native.js"],"names":["View","__","useCallback","useMemo","useState","BlockControls","useSetting","ToolbarGroup","ToolbarButton","useMobileGlobalStylesColors","Icon","textColor","textColorIcon","removeFormat","usePreferredColorSchemeStyle","getActiveColors","transparentValue","default","InlineColorUI","styles","name","title","getComputedStyleProperty","element","property","props","style","backgroundColor","baseColors","color","background","fillComputedColors","TextColorEdit","value","onChange","isActive","activeAttributes","contentRef","allowCustomControl","colors","isAddingColor","setIsAddingColor","enableIsAddingColor","disableIsAddingColor","colorIndicatorStyle","hasColorsToChoose","length","onPressButton","outlineStyle","isActiveStyle","customContainerStyles","tagName","className","attributes","class","__unstableFilterAttributeValue","key","newValue","replace","includes","addedCSS","join","edit"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,cAArB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,EAAsBC,OAAtB,EAA+BC,QAA/B,QAA+C,oBAA/C;AACA,SAASC,aAAT,EAAwBC,UAAxB,QAA0C,yBAA1C;AACA,SACCC,YADD,EAECC,aAFD,EAGCC,2BAHD,QAIO,uBAJP;AAKA,SAASC,IAAT,EAAeC,SAAS,IAAIC,aAA5B,QAAiD,kBAAjD;AACA,SAASC,YAAT,QAA6B,sBAA7B;AACA,SAASC,4BAAT,QAA6C,oBAA7C;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,aAAhC;AACA,SAASC,gBAAT,QAAiC,YAAjC;AACA,SAASC,OAAO,IAAIC,aAApB,QAAyC,UAAzC;AACA,OAAOC,MAAP,MAAmB,cAAnB;AAEA,MAAMC,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AtB,CAAjB,CAH4C,CAI5C;;AACA,QAAKD,QAAQ,IAAIA,QAAQ,CAACE,QAAT,CAAmB,kBAAnB,CAAjB,EACC,OAAOF,QAAP;AACD,UAAMG,QAAQ,GAAG,CAAE,kBAAF,EAAsB5C,gBAAtB,EAAyC6C,IAAzC,CAA+C,GAA/C,CAAjB,CAP4C,CAQ5C;AACA;;AACA,WAAOJ,QAAQ,GAAG,CAAEG,QAAF,EAAYH,QAAZ,EAAuBI,IAAvB,CAA6B,GAA7B,CAAH,GAAwCD,QAAvD;AACA,GA7BuB;;AA8BxBE,EAAAA,IAAI,EAAE9B;AA9BkB,CAAlB","sourcesContent":["/**\n * External dependencies\n */\nimport { View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useCallback, useMemo, useState } from '@wordpress/element';\nimport { BlockControls, useSetting } from '@wordpress/block-editor';\nimport {\n\tToolbarGroup,\n\tToolbarButton,\n\tuseMobileGlobalStylesColors,\n} from '@wordpress/components';\nimport { Icon, textColor as textColorIcon } from '@wordpress/icons';\nimport { removeFormat } from '@wordpress/rich-text';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { getActiveColors } from './inline.js';\nimport { transparentValue } from './index.js';\nimport { default as InlineColorUI } from './inline';\nimport styles from './style.scss';\n\nconst name = 'core/text-color';\nconst title = __( 'Text color' );\n\nfunction getComputedStyleProperty( element, property ) {\n\tconst {\n\t\tprops: { style = {} },\n\t} = element;\n\n\tif ( property === 'background-color' ) {\n\t\tconst { backgroundColor, baseColors } = style;\n\n\t\tif ( backgroundColor !== 'transparent' ) {\n\t\t\treturn backgroundColor;\n\t\t} else if ( baseColors && baseColors?.color?.background ) {\n\t\t\treturn baseColors?.color?.background;\n\t\t}\n\n\t\treturn 'transparent';\n\t}\n}\n\nfunction fillComputedColors( element, { color, backgroundColor } ) {\n\tif ( ! color && ! backgroundColor ) {\n\t\treturn;\n\t}\n\n\treturn {\n\t\tcolor: color || getComputedStyleProperty( element, 'color' ),\n\t\tbackgroundColor: getComputedStyleProperty(\n\t\t\telement,\n\t\t\t'background-color'\n\t\t),\n\t};\n}\n\nfunction TextColorEdit( {\n\tvalue,\n\tonChange,\n\tisActive,\n\tactiveAttributes,\n\tcontentRef,\n} ) {\n\tconst allowCustomControl = useSetting( 'color.custom' );\n\tconst colors = useMobileGlobalStylesColors();\n\tconst [ isAddingColor, setIsAddingColor ] = useState( false );\n\tconst enableIsAddingColor = useCallback(\n\t\t() => setIsAddingColor( true ),\n\t\t[ setIsAddingColor ]\n\t);\n\tconst disableIsAddingColor = useCallback(\n\t\t() => setIsAddingColor( false ),\n\t\t[ setIsAddingColor ]\n\t);\n\tconst colorIndicatorStyle = useMemo(\n\t\t() =>\n\t\t\tfillComputedColors(\n\t\t\t\tcontentRef,\n\t\t\t\tgetActiveColors( value, name, colors )\n\t\t\t),\n\t\t[ value, colors ]\n\t);\n\n\tconst hasColorsToChoose = colors.length || ! allowCustomControl;\n\n\tconst onPressButton = useCallback( () => {\n\t\tif ( hasColorsToChoose ) {\n\t\t\tenableIsAddingColor();\n\t\t} else {\n\t\t\tonChange( removeFormat( value, name ) );\n\t\t}\n\t}, [ hasColorsToChoose, value ] );\n\n\tconst outlineStyle = usePreferredColorSchemeStyle(\n\t\tstyles[ 'components-inline-color__outline' ],\n\t\tstyles[ 'components-inline-color__outline--dark' ]\n\t);\n\n\tif ( ! hasColorsToChoose && ! isActive ) {\n\t\treturn null;\n\t}\n\n\tconst isActiveStyle = {\n\t\t...colorIndicatorStyle,\n\t\t...( ! colorIndicatorStyle?.backgroundColor\n\t\t\t? { backgroundColor: 'transparent' }\n\t\t\t: {} ),\n\t\t...styles[ 'components-inline-color--is-active' ],\n\t};\n\n\tconst customContainerStyles =\n\t\tstyles[ 'components-inline-color__button-container' ];\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t{ isActive && (\n\t\t\t\t\t\t<View style={ outlineStyle } pointerEvents=\"none\" />\n\t\t\t\t\t) }\n\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tname=\"text-color\"\n\t\t\t\t\t\tisActive={ isActive }\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\ticon={ textColorIcon }\n\t\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t\tcolorIndicatorStyle?.color && {\n\t\t\t\t\t\t\t\t\t\tcolor: colorIndicatorStyle.color,\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttitle={ title }\n\t\t\t\t\t\textraProps={ {\n\t\t\t\t\t\t\tisActiveStyle,\n\t\t\t\t\t\t\tcustomContainerStyles,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\t// If has no colors to choose but a color is active remove the color onClick\n\t\t\t\t\t\tonClick={ onPressButton }\n\t\t\t\t\t/>\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t\t{ isAddingColor && (\n\t\t\t\t<InlineColorUI\n\t\t\t\t\tname={ name }\n\t\t\t\t\tonClose={ disableIsAddingColor }\n\t\t\t\t\tactiveAttributes={ activeAttributes }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport const textColor = {\n\tname,\n\ttitle,\n\ttagName: 'mark',\n\tclassName: 'has-inline-color',\n\tattributes: {\n\t\tstyle: 'style',\n\t\tclass: 'class',\n\t},\n\t/*\n\t * Since this format relies on the <mark> tag, it's important to\n\t * prevent the default yellow background color applied by most\n\t * browsers. The solution is to detect when this format is used with a\n\t * text color but no background color, and in such cases to override\n\t * the default styling with a transparent background.\n\t *\n\t * @see https://github.com/WordPress/gutenberg/pull/35516\n\t */\n\t__unstableFilterAttributeValue( key, value ) {\n\t\tif ( key !== 'style' ) return value;\n\t\t// We need to remove the extra spaces within the styles on mobile\n\t\tconst newValue = value?.replace( / /g, '' );\n\t\t// We should not add a background-color if it's already set\n\t\tif ( newValue && newValue.includes( 'background-color' ) )\n\t\t\treturn newValue;\n\t\tconst addedCSS = [ 'background-color', transparentValue ].join( ':' );\n\t\t// Prepend `addedCSS` to avoid a double `;;` as any the existing CSS\n\t\t// rules will already include a `;`.\n\t\treturn newValue ? [ addedCSS, newValue ].join( ';' ) : addedCSS;\n\t},\n\tedit: TextColorEdit,\n};\n"]}
1
+ {"version":3,"sources":["@wordpress/format-library/src/text-color/index.native.js"],"names":["StyleSheet","View","__","useCallback","useMemo","useState","BlockControls","useSetting","ToolbarGroup","ToolbarButton","useMobileGlobalStylesColors","Icon","color","colorIcon","textColor","textColorIcon","removeFormat","usePreferredColorSchemeStyle","getActiveColors","transparentValue","default","InlineColorUI","styles","name","title","getComputedStyleProperty","element","property","props","style","backgroundColor","baseColors","background","fillComputedColors","TextColorEdit","value","onChange","isActive","activeAttributes","contentRef","allowCustomControl","colors","isAddingColor","setIsAddingColor","enableIsAddingColor","disableIsAddingColor","colorIndicatorStyle","hasColorsToChoose","length","onPressButton","outlineStyle","borderWidth","hairlineWidth","isActiveStyle","customContainerStyles","Object","keys","tagName","className","attributes","class","__unstableFilterAttributeValue","key","newValue","replace","includes","addedCSS","join","edit"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,UAAT,EAAqBC,IAArB,QAAiC,cAAjC;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,EAAsBC,OAAtB,EAA+BC,QAA/B,QAA+C,oBAA/C;AACA,SAASC,aAAT,EAAwBC,UAAxB,QAA0C,yBAA1C;AACA,SACCC,YADD,EAECC,aAFD,EAGCC,2BAHD,QAIO,uBAJP;AAKA,SACCC,IADD,EAECC,KAAK,IAAIC,SAFV,EAGCC,SAAS,IA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AA,KAFwB;AAGxBiC,EAAAA,OAAO,EAAE,MAHe;AAIxBC,EAAAA,SAAS,EAAE,kBAJa;AAKxBC,EAAAA,UAAU,EAAE;AACX9B,IAAAA,KAAK,EAAE,OADI;AAEX+B,IAAAA,KAAK,EAAE;AAFI,GALY;;AASxB;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACCC,EAAAA,8BAA8B,CAAEC,GAAF,EAAO3B,KAAP,EAAe;AAC5C,QAAK2B,GAAG,KAAK,OAAb,EAAuB,OAAO3B,KAAP,CADqB,CAE5C;;AACA,UAAM4B,QAAQ,GAAG5B,KAAK,EAAE6B,OAAP,CAAgB,IAAhB,EAAsB,EAAtB,CAAjB,CAH4C,CAI5C;;AACA,QAAKD,QAAQ,IAAIA,QAAQ,CAACE,QAAT,CAAmB,kBAAnB,CAAjB,EACC,OAAOF,QAAP;AACD,UAAMG,QAAQ,GAAG,CAAE,kBAAF,EAAsB/C,gBAAtB,EAAyCgD,IAAzC,CAA+C,GAA/C,CAAjB,CAP4C,CAQ5C;AACA;;AACA,WAAOJ,QAAQ,GAAG,CAAEG,QAAF,EAAYH,QAAZ,EAAuBI,IAAvB,CAA6B,GAA7B,CAAH,GAAwCD,QAAvD;AACA,GA7BuB;;AA8BxBE,EAAAA,IAAI,EAAElC;AA9BkB,CAAlB","sourcesContent":["/**\n * External dependencies\n */\nimport { StyleSheet, View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useCallback, useMemo, useState } from '@wordpress/element';\nimport { BlockControls, useSetting } from '@wordpress/block-editor';\nimport {\n\tToolbarGroup,\n\tToolbarButton,\n\tuseMobileGlobalStylesColors,\n} from '@wordpress/components';\nimport {\n\tIcon,\n\tcolor as colorIcon,\n\ttextColor as textColorIcon,\n} from '@wordpress/icons';\nimport { removeFormat } from '@wordpress/rich-text';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { getActiveColors } from './inline.js';\nimport { transparentValue } from './index.js';\nimport { default as InlineColorUI } from './inline';\nimport styles from './style.scss';\n\nconst name = 'core/text-color';\nconst title = __( 'Text color' );\n\nfunction getComputedStyleProperty( element, property ) {\n\tconst {\n\t\tprops: { style = {} },\n\t} = element;\n\n\tif ( property === 'background-color' ) {\n\t\tconst { backgroundColor, baseColors } = style;\n\n\t\tif ( backgroundColor !== 'transparent' ) {\n\t\t\treturn backgroundColor;\n\t\t} else if ( baseColors && baseColors?.color?.background ) {\n\t\t\treturn baseColors?.color?.background;\n\t\t}\n\n\t\treturn 'transparent';\n\t}\n}\n\nfunction fillComputedColors( element, { color, backgroundColor } ) {\n\tif ( ! color && ! backgroundColor ) {\n\t\treturn;\n\t}\n\n\treturn {\n\t\tcolor: color || getComputedStyleProperty( element, 'color' ),\n\t\tbackgroundColor: getComputedStyleProperty(\n\t\t\telement,\n\t\t\t'background-color'\n\t\t),\n\t};\n}\n\nfunction TextColorEdit( {\n\tvalue,\n\tonChange,\n\tisActive,\n\tactiveAttributes,\n\tcontentRef,\n} ) {\n\tconst allowCustomControl = useSetting( 'color.custom' );\n\tconst colors = useMobileGlobalStylesColors();\n\tconst [ isAddingColor, setIsAddingColor ] = useState( false );\n\tconst enableIsAddingColor = useCallback(\n\t\t() => setIsAddingColor( true ),\n\t\t[ setIsAddingColor ]\n\t);\n\tconst disableIsAddingColor = useCallback(\n\t\t() => setIsAddingColor( false ),\n\t\t[ setIsAddingColor ]\n\t);\n\tconst colorIndicatorStyle = useMemo(\n\t\t() =>\n\t\t\tfillComputedColors(\n\t\t\t\tcontentRef,\n\t\t\t\tgetActiveColors( value, name, colors )\n\t\t\t),\n\t\t[ value, colors ]\n\t);\n\n\tconst hasColorsToChoose = colors.length || ! allowCustomControl;\n\n\tconst onPressButton = useCallback( () => {\n\t\tif ( hasColorsToChoose ) {\n\t\t\tenableIsAddingColor();\n\t\t} else {\n\t\t\tonChange( removeFormat( value, name ) );\n\t\t}\n\t}, [ hasColorsToChoose, value ] );\n\n\tconst outlineStyle = [\n\t\tusePreferredColorSchemeStyle(\n\t\t\tstyles[ 'components-inline-color__outline' ],\n\t\t\tstyles[ 'components-inline-color__outline--dark' ]\n\t\t),\n\t\t{ borderWidth: StyleSheet.hairlineWidth },\n\t];\n\n\tif ( ! hasColorsToChoose && ! isActive ) {\n\t\treturn null;\n\t}\n\n\tconst isActiveStyle = {\n\t\t...colorIndicatorStyle,\n\t\t...( ! colorIndicatorStyle?.backgroundColor\n\t\t\t? { backgroundColor: 'transparent' }\n\t\t\t: {} ),\n\t\t...styles[ 'components-inline-color--is-active' ],\n\t};\n\n\tconst customContainerStyles =\n\t\tstyles[ 'components-inline-color__button-container' ];\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t{ isActive && (\n\t\t\t\t\t\t<View style={ outlineStyle } pointerEvents=\"none\" />\n\t\t\t\t\t) }\n\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tname=\"text-color\"\n\t\t\t\t\t\tisActive={ isActive }\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\tObject.keys( activeAttributes ).length\n\t\t\t\t\t\t\t\t\t\t? textColorIcon\n\t\t\t\t\t\t\t\t\t\t: colorIcon\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t\tcolorIndicatorStyle?.color && {\n\t\t\t\t\t\t\t\t\t\tcolor: colorIndicatorStyle.color,\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttitle={ title }\n\t\t\t\t\t\textraProps={ {\n\t\t\t\t\t\t\tisActiveStyle,\n\t\t\t\t\t\t\tcustomContainerStyles,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\t// If has no colors to choose but a color is active remove the color onClick\n\t\t\t\t\t\tonClick={ onPressButton }\n\t\t\t\t\t/>\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t\t{ isAddingColor && (\n\t\t\t\t<InlineColorUI\n\t\t\t\t\tname={ name }\n\t\t\t\t\tonClose={ disableIsAddingColor }\n\t\t\t\t\tactiveAttributes={ activeAttributes }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport const textColor = {\n\tname,\n\ttitle,\n\ttagName: 'mark',\n\tclassName: 'has-inline-color',\n\tattributes: {\n\t\tstyle: 'style',\n\t\tclass: 'class',\n\t},\n\t/*\n\t * Since this format relies on the <mark> tag, it's important to\n\t * prevent the default yellow background color applied by most\n\t * browsers. The solution is to detect when this format is used with a\n\t * text color but no background color, and in such cases to override\n\t * the default styling with a transparent background.\n\t *\n\t * @see https://github.com/WordPress/gutenberg/pull/35516\n\t */\n\t__unstableFilterAttributeValue( key, value ) {\n\t\tif ( key !== 'style' ) return value;\n\t\t// We need to remove the extra spaces within the styles on mobile\n\t\tconst newValue = value?.replace( / /g, '' );\n\t\t// We should not add a background-color if it's already set\n\t\tif ( newValue && newValue.includes( 'background-color' ) )\n\t\t\treturn newValue;\n\t\tconst addedCSS = [ 'background-color', transparentValue ].join( ':' );\n\t\t// Prepend `addedCSS` to avoid a double `;;` as any the existing CSS\n\t\t// rules will already include a `;`.\n\t\treturn newValue ? [ addedCSS, newValue ].join( ';' ) : addedCSS;\n\t},\n\tedit: TextColorEdit,\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/format-library",
3
- "version": "4.14.0",
3
+ "version": "4.15.0",
4
4
  "description": "Format library for the WordPress editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -26,17 +26,17 @@
26
26
  "react-native": "src/index",
27
27
  "dependencies": {
28
28
  "@babel/runtime": "^7.16.0",
29
- "@wordpress/a11y": "^3.37.0",
30
- "@wordpress/block-editor": "^12.5.0",
31
- "@wordpress/components": "^25.3.0",
32
- "@wordpress/compose": "^6.14.0",
33
- "@wordpress/data": "^9.7.0",
34
- "@wordpress/element": "^5.14.0",
35
- "@wordpress/html-entities": "^3.37.0",
36
- "@wordpress/i18n": "^4.37.0",
37
- "@wordpress/icons": "^9.28.0",
38
- "@wordpress/rich-text": "^6.14.0",
39
- "@wordpress/url": "^3.38.0"
29
+ "@wordpress/a11y": "^3.38.0",
30
+ "@wordpress/block-editor": "^12.6.0",
31
+ "@wordpress/components": "^25.4.0",
32
+ "@wordpress/compose": "^6.15.0",
33
+ "@wordpress/data": "^9.8.0",
34
+ "@wordpress/element": "^5.15.0",
35
+ "@wordpress/html-entities": "^3.38.0",
36
+ "@wordpress/i18n": "^4.38.0",
37
+ "@wordpress/icons": "^9.29.0",
38
+ "@wordpress/rich-text": "^6.15.0",
39
+ "@wordpress/url": "^3.39.0"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "react": "^18.0.0",
@@ -45,5 +45,5 @@
45
45
  "publishConfig": {
46
46
  "access": "public"
47
47
  },
48
- "gitHead": "bcd13d59b22553b3c9dc5869077bff1e864cf9f5"
48
+ "gitHead": "6f14d11ed4cb59df110a28ebaa23ecba95eb673a"
49
49
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { View } from 'react-native';
4
+ import { StyleSheet, View } from 'react-native';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -14,7 +14,11 @@ import {
14
14
  ToolbarButton,
15
15
  useMobileGlobalStylesColors,
16
16
  } from '@wordpress/components';
17
- import { Icon, textColor as textColorIcon } from '@wordpress/icons';
17
+ import {
18
+ Icon,
19
+ color as colorIcon,
20
+ textColor as textColorIcon,
21
+ } from '@wordpress/icons';
18
22
  import { removeFormat } from '@wordpress/rich-text';
19
23
  import { usePreferredColorSchemeStyle } from '@wordpress/compose';
20
24
 
@@ -98,10 +102,13 @@ function TextColorEdit( {
98
102
  }
99
103
  }, [ hasColorsToChoose, value ] );
100
104
 
101
- const outlineStyle = usePreferredColorSchemeStyle(
102
- styles[ 'components-inline-color__outline' ],
103
- styles[ 'components-inline-color__outline--dark' ]
104
- );
105
+ const outlineStyle = [
106
+ usePreferredColorSchemeStyle(
107
+ styles[ 'components-inline-color__outline' ],
108
+ styles[ 'components-inline-color__outline--dark' ]
109
+ ),
110
+ { borderWidth: StyleSheet.hairlineWidth },
111
+ ];
105
112
 
106
113
  if ( ! hasColorsToChoose && ! isActive ) {
107
114
  return null;
@@ -131,7 +138,11 @@ function TextColorEdit( {
131
138
  isActive={ isActive }
132
139
  icon={
133
140
  <Icon
134
- icon={ textColorIcon }
141
+ icon={
142
+ Object.keys( activeAttributes ).length
143
+ ? textColorIcon
144
+ : colorIcon
145
+ }
135
146
  style={
136
147
  colorIndicatorStyle?.color && {
137
148
  color: colorIndicatorStyle.color,
@@ -3,19 +3,18 @@
3
3
  }
4
4
 
5
5
  .components-inline-color__outline {
6
- border-color: $light-dim;
6
+ border-color: $light-quaternary;
7
7
  top: 6px;
8
8
  bottom: 6px;
9
9
  left: 11px;
10
10
  right: 11px;
11
11
  border-radius: 24px;
12
- border-width: $border-width;
13
12
  position: absolute;
14
13
  z-index: 2;
15
14
  }
16
15
 
17
16
  .components-inline-color__outline--dark {
18
- border-color: $dark-ultra-dim;
17
+ border-color: $dark-quaternary;
19
18
  }
20
19
 
21
20
  .components-inline-color__button-container {