@wordpress/style-engine 2.49.1-next.v.202606191442.0 → 2.50.1-next.v.202607070741.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 +3 -1
- package/build/styles/typography/index.cjs +12 -0
- package/build/styles/typography/index.cjs.map +2 -2
- package/build/types.cjs.map +1 -1
- package/build-module/styles/typography/index.mjs +12 -0
- package/build-module/styles/typography/index.mjs.map +2 -2
- package/build-types/types.d.ts +1 -0
- package/build-types/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/class-wp-style-engine-css-declarations.php +64 -4
- package/src/class-wp-style-engine-css-rule.php +10 -2
- package/src/class-wp-style-engine-processor.php +16 -2
- package/src/class-wp-style-engine.php +9 -2
- package/src/style-engine.php +10 -4
- package/src/styles/typography/index.ts +13 -0
- package/src/test/index.js +8 -1
- package/src/types.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -145,6 +145,17 @@ var writingMode = {
|
|
|
145
145
|
);
|
|
146
146
|
}
|
|
147
147
|
};
|
|
148
|
+
var textShadow = {
|
|
149
|
+
name: "textShadow",
|
|
150
|
+
generate: (style, options) => {
|
|
151
|
+
return (0, import_utils.generateRule)(
|
|
152
|
+
style,
|
|
153
|
+
options,
|
|
154
|
+
["typography", "textShadow"],
|
|
155
|
+
"textShadow"
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
};
|
|
148
159
|
var typography_default = [
|
|
149
160
|
fontFamily,
|
|
150
161
|
fontSize,
|
|
@@ -155,6 +166,7 @@ var typography_default = [
|
|
|
155
166
|
textColumns,
|
|
156
167
|
textDecoration,
|
|
157
168
|
textIndent,
|
|
169
|
+
textShadow,
|
|
158
170
|
textTransform,
|
|
159
171
|
writingMode
|
|
160
172
|
];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/styles/typography/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { Style, StyleOptions } from '../../types';\nimport { generateRule } from '../utils';\n\nconst fontSize = {\n\tname: 'fontSize',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'fontSize' ],\n\t\t\t'fontSize'\n\t\t);\n\t},\n};\n\nconst fontStyle = {\n\tname: 'fontStyle',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'fontStyle' ],\n\t\t\t'fontStyle'\n\t\t);\n\t},\n};\n\nconst fontWeight = {\n\tname: 'fontWeight',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'fontWeight' ],\n\t\t\t'fontWeight'\n\t\t);\n\t},\n};\n\nconst fontFamily = {\n\tname: 'fontFamily',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'fontFamily' ],\n\t\t\t'fontFamily'\n\t\t);\n\t},\n};\n\nconst letterSpacing = {\n\tname: 'letterSpacing',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'letterSpacing' ],\n\t\t\t'letterSpacing'\n\t\t);\n\t},\n};\n\nconst lineHeight = {\n\tname: 'lineHeight',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'lineHeight' ],\n\t\t\t'lineHeight'\n\t\t);\n\t},\n};\n\nconst textColumns = {\n\tname: 'textColumns',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'textColumns' ],\n\t\t\t'columnCount'\n\t\t);\n\t},\n};\n\nconst textDecoration = {\n\tname: 'textDecoration',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'textDecoration' ],\n\t\t\t'textDecoration'\n\t\t);\n\t},\n};\n\nconst textIndent = {\n\tname: 'textIndent',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'textIndent' ],\n\t\t\t'textIndent'\n\t\t);\n\t},\n};\n\nconst textTransform = {\n\tname: 'textTransform',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'textTransform' ],\n\t\t\t'textTransform'\n\t\t);\n\t},\n};\n\nconst writingMode = {\n\tname: 'writingMode',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'writingMode' ],\n\t\t\t'writingMode'\n\t\t);\n\t},\n};\n\nexport default [\n\tfontFamily,\n\tfontSize,\n\tfontStyle,\n\tfontWeight,\n\tletterSpacing,\n\tlineHeight,\n\ttextColumns,\n\ttextDecoration,\n\ttextIndent,\n\ttextTransform,\n\twritingMode,\n];\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,mBAA6B;AAE7B,IAAM,WAAW;AAAA,EAChB,MAAM;AAAA,EACN,UAAU,CAAE,OAAc,YAA2B;AACpD,eAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA,CAAE,cAAc,UAAW;AAAA,MAC3B;AAAA,IACD;AAAA,EACD;AACD;AAEA,IAAM,YAAY;AAAA,EACjB,MAAM;AAAA,EACN,UAAU,CAAE,OAA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A2B;AACpD,eAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA,CAAE,cAAc,YAAa;AAAA,MAC7B;AAAA,IACD;AAAA,EACD;AACD;AAEA,IAAM,gBAAgB;AAAA,EACrB,MAAM;AAAA,EACN,UAAU,CAAE,OAAc,YAA2B;AACpD,eAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA,CAAE,cAAc,eAAgB;AAAA,MAChC;AAAA,IACD;AAAA,EACD;AACD;AAEA,IAAM,cAAc;AAAA,EACnB,MAAM;AAAA,EACN,UAAU,CAAE,OAAc,YAA2B;AACpD,eAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA,CAAE,cAAc,aAAc;AAAA,MAC9B;AAAA,IACD;AAAA,EACD;AACD;AAEA,IAAO,qBAAQ;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;",
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { Style, StyleOptions } from '../../types';\nimport { generateRule } from '../utils';\n\nconst fontSize = {\n\tname: 'fontSize',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'fontSize' ],\n\t\t\t'fontSize'\n\t\t);\n\t},\n};\n\nconst fontStyle = {\n\tname: 'fontStyle',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'fontStyle' ],\n\t\t\t'fontStyle'\n\t\t);\n\t},\n};\n\nconst fontWeight = {\n\tname: 'fontWeight',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'fontWeight' ],\n\t\t\t'fontWeight'\n\t\t);\n\t},\n};\n\nconst fontFamily = {\n\tname: 'fontFamily',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'fontFamily' ],\n\t\t\t'fontFamily'\n\t\t);\n\t},\n};\n\nconst letterSpacing = {\n\tname: 'letterSpacing',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'letterSpacing' ],\n\t\t\t'letterSpacing'\n\t\t);\n\t},\n};\n\nconst lineHeight = {\n\tname: 'lineHeight',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'lineHeight' ],\n\t\t\t'lineHeight'\n\t\t);\n\t},\n};\n\nconst textColumns = {\n\tname: 'textColumns',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'textColumns' ],\n\t\t\t'columnCount'\n\t\t);\n\t},\n};\n\nconst textDecoration = {\n\tname: 'textDecoration',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'textDecoration' ],\n\t\t\t'textDecoration'\n\t\t);\n\t},\n};\n\nconst textIndent = {\n\tname: 'textIndent',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'textIndent' ],\n\t\t\t'textIndent'\n\t\t);\n\t},\n};\n\nconst textTransform = {\n\tname: 'textTransform',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'textTransform' ],\n\t\t\t'textTransform'\n\t\t);\n\t},\n};\n\nconst writingMode = {\n\tname: 'writingMode',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'writingMode' ],\n\t\t\t'writingMode'\n\t\t);\n\t},\n};\n\nconst textShadow = {\n\tname: 'textShadow',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'textShadow' ],\n\t\t\t'textShadow'\n\t\t);\n\t},\n};\n\nexport default [\n\tfontFamily,\n\tfontSize,\n\tfontStyle,\n\tfontWeight,\n\tletterSpacing,\n\tlineHeight,\n\ttextColumns,\n\ttextDecoration,\n\ttextIndent,\n\ttextShadow,\n\ttextTransform,\n\twritingMode,\n];\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,mBAA6B;AAE7B,IAAM,WAAW;AAAA,EAChB,MAAM;AAAA,EACN,UAAU,CAAE,OAAc,YAA2B;AACpD,eAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA,CAAE,cAAc,UAAW;AAAA,MAC3B;AAAA,IACD;AAAA,EACD;AACD;AAEA,IAAM,YAAY;AAAA,EACjB,MAAM;AAAA,EACN,UAAU,CAAE,OAAc,YAA2B;AACpD,eAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA,CAAE,cAAc,WAAY;AAAA,MAC5B;AAAA,IACD;AAAA,EACD;AACD;AAEA,IAAM,aAAa;AAAA,EAClB,MAAM;AAAA,EACN,UAAU,CAAE,OAAc,YAA2B;AACpD,eAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA,CAAE,cAAc,YAAa;AAAA,MAC7B;AAAA,IACD;AAAA,EACD;AACD;AAEA,IAAM,aAAa;AAAA,EAClB,MAAM;AAAA,EACN,UAAU,CAAE,OAAc,YAA2B;AACpD,eAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA,CAAE,cAAc,YAAa;AAAA,MA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B;AAAA,IACD;AAAA,EACD;AACD;AAEA,IAAM,aAAa;AAAA,EAClB,MAAM;AAAA,EACN,UAAU,CAAE,OAAc,YAA2B;AACpD,eAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA,CAAE,cAAc,YAAa;AAAA,MAC7B;AAAA,IACD;AAAA,EACD;AACD;AAEA,IAAO,qBAAQ;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build/types.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/types.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport type { CSSProperties } from 'react';\n\ntype BoxVariant = 'margin' | 'padding';\nexport interface Box< T extends BoxVariant | undefined = undefined > {\n\ttop?: CSSProperties[ T extends undefined ? 'top' : `${ T }Top` ];\n\tright?: CSSProperties[ T extends undefined ? 'right' : `${ T }Right` ];\n\tbottom?: CSSProperties[ T extends undefined ? 'bottom' : `${ T }Bottom` ];\n\tleft?: CSSProperties[ T extends undefined ? 'left' : `${ T }Left` ];\n}\n\nexport type BoxEdge = 'top' | 'right' | 'bottom' | 'left';\n\n// `T` is one of the values in `BorderIndividualProperty`. The expected CSSProperties key is something like `borderTopColor`.\nexport interface BorderIndividualStyles< T extends BoxEdge > {\n\tcolor?: CSSProperties[ `border${ Capitalize< T > }Color` ];\n\tstyle?: CSSProperties[ `border${ Capitalize< T > }Style` ];\n\twidth?: CSSProperties[ `border${ Capitalize< T > }Width` ];\n}\n\n/**\n * A style object — for example a block's `attributes.style` or the top-level\n * styles in `theme.json`. Groups visual style properties such as color,\n * typography, spacing, dimensions, borders, backgrounds and element styles,\n * and is the input `compileCSS` and `getCSSRules` turn into CSS.\n */\nexport interface Style {\n\tbackground?: {\n\t\tbackgroundImage?:\n\t\t\t| { url?: CSSProperties[ 'backgroundImage' ]; source?: string }\n\t\t\t| CSSProperties[ 'backgroundImage' ];\n\t\tbackgroundPosition?: CSSProperties[ 'backgroundPosition' ];\n\t\tbackgroundRepeat?: CSSProperties[ 'backgroundRepeat' ];\n\t\tbackgroundSize?: CSSProperties[ 'backgroundSize' ];\n\t\tgradient?: CSSProperties[ 'backgroundImage' ];\n\t};\n\tborder?: {\n\t\tcolor?: CSSProperties[ 'borderColor' ];\n\t\tradius?:\n\t\t\t| CSSProperties[ 'borderRadius' ]\n\t\t\t| {\n\t\t\t\t\ttopLeft?: CSSProperties[ 'borderTopLeftRadius' ];\n\t\t\t\t\ttopRight?: CSSProperties[ 'borderTopRightRadius' ];\n\t\t\t\t\tbottomLeft?: CSSProperties[ 'borderBottomLeftRadius' ];\n\t\t\t\t\tbottomRight?: CSSProperties[ 'borderBottomLeftRadius' ];\n\t\t\t };\n\t\tstyle?: CSSProperties[ 'borderStyle' ];\n\t\twidth?: CSSProperties[ 'borderWidth' ];\n\t\ttop?: BorderIndividualStyles< 'top' >;\n\t\tright?: BorderIndividualStyles< 'right' >;\n\t\tbottom?: BorderIndividualStyles< 'bottom' >;\n\t\tleft?: BorderIndividualStyles< 'left' >;\n\t};\n\tdimensions?: {\n\t\taspectRatio?: CSSProperties[ 'aspectRatio' ];\n\t\theight?: CSSProperties[ 'height' ];\n\t\tminHeight?: CSSProperties[ 'minHeight' ];\n\t\tminWidth?: CSSProperties[ 'minWidth' ];\n\t\tobjectFit?: CSSProperties[ 'objectFit' ];\n\t\twidth?: CSSProperties[ 'width' ];\n\t};\n\tspacing?: {\n\t\tmargin?: CSSProperties[ 'margin' ] | Box< 'margin' >;\n\t\tpadding?: CSSProperties[ 'padding' ] | Box< 'padding' >;\n\t};\n\ttypography?: {\n\t\tfontSize?: CSSProperties[ 'fontSize' ];\n\t\tfontFamily?: CSSProperties[ 'fontFamily' ];\n\t\tfontWeight?: CSSProperties[ 'fontWeight' ];\n\t\tfontStyle?: CSSProperties[ 'fontStyle' ];\n\t\tletterSpacing?: CSSProperties[ 'letterSpacing' ];\n\t\tlineHeight?: CSSProperties[ 'lineHeight' ];\n\t\ttextColumns?: CSSProperties[ 'columnCount' ];\n\t\ttextDecoration?: CSSProperties[ 'textDecoration' ];\n\t\ttextTransform?: CSSProperties[ 'textTransform' ];\n\t\twritingMode?: CSSProperties[ 'writingMode' ];\n\t};\n\tcolor?: {\n\t\ttext?: CSSProperties[ 'color' ];\n\t\tbackground?: CSSProperties[ 'backgroundColor' ];\n\t\tgradient?: CSSProperties[ 'background' ];\n\t};\n\telements?: {\n\t\tlink?: {\n\t\t\tcolor?: {\n\t\t\t\ttext?: CSSProperties[ 'color' ];\n\t\t\t};\n\t\t};\n\t};\n}\n\nexport interface CssRulesKeys {\n\tdefault: string;\n\tindividual: string;\n}\n\n/**\n * Options that adjust how styles are generated — notably the CSS `selector` to\n * scope the output to. With no selector, declarations are returned inline.\n */\nexport interface StyleOptions {\n\t/**\n\t * CSS selector for the generated style.\n\t */\n\tselector?: string;\n}\n\n/**\n * A single generated CSS rule: an optional `selector`, the `value`, and the\n * `key` in React/JS style-attribute format (e.g. `paddingTop` rather than\n * `padding-top`).\n */\nexport interface GeneratedCSSRule {\n\tselector?: string;\n\tvalue: string | unknown;\n\t/**\n\t * The CSS key in JS style attribute format, compatible with React.\n\t * E.g. `paddingTop` instead of `padding-top`.\n\t */\n\tkey: string;\n}\n\nexport interface GenerateFunction {\n\t( style: Style, options: StyleOptions ): GeneratedCSSRule[];\n}\n\nexport interface StyleDefinition {\n\tname: string;\n\tgenerate?: GenerateFunction;\n}\n"],
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport type { CSSProperties } from 'react';\n\ntype BoxVariant = 'margin' | 'padding';\nexport interface Box< T extends BoxVariant | undefined = undefined > {\n\ttop?: CSSProperties[ T extends undefined ? 'top' : `${ T }Top` ];\n\tright?: CSSProperties[ T extends undefined ? 'right' : `${ T }Right` ];\n\tbottom?: CSSProperties[ T extends undefined ? 'bottom' : `${ T }Bottom` ];\n\tleft?: CSSProperties[ T extends undefined ? 'left' : `${ T }Left` ];\n}\n\nexport type BoxEdge = 'top' | 'right' | 'bottom' | 'left';\n\n// `T` is one of the values in `BorderIndividualProperty`. The expected CSSProperties key is something like `borderTopColor`.\nexport interface BorderIndividualStyles< T extends BoxEdge > {\n\tcolor?: CSSProperties[ `border${ Capitalize< T > }Color` ];\n\tstyle?: CSSProperties[ `border${ Capitalize< T > }Style` ];\n\twidth?: CSSProperties[ `border${ Capitalize< T > }Width` ];\n}\n\n/**\n * A style object — for example a block's `attributes.style` or the top-level\n * styles in `theme.json`. Groups visual style properties such as color,\n * typography, spacing, dimensions, borders, backgrounds and element styles,\n * and is the input `compileCSS` and `getCSSRules` turn into CSS.\n */\nexport interface Style {\n\tbackground?: {\n\t\tbackgroundImage?:\n\t\t\t| { url?: CSSProperties[ 'backgroundImage' ]; source?: string }\n\t\t\t| CSSProperties[ 'backgroundImage' ];\n\t\tbackgroundPosition?: CSSProperties[ 'backgroundPosition' ];\n\t\tbackgroundRepeat?: CSSProperties[ 'backgroundRepeat' ];\n\t\tbackgroundSize?: CSSProperties[ 'backgroundSize' ];\n\t\tgradient?: CSSProperties[ 'backgroundImage' ];\n\t};\n\tborder?: {\n\t\tcolor?: CSSProperties[ 'borderColor' ];\n\t\tradius?:\n\t\t\t| CSSProperties[ 'borderRadius' ]\n\t\t\t| {\n\t\t\t\t\ttopLeft?: CSSProperties[ 'borderTopLeftRadius' ];\n\t\t\t\t\ttopRight?: CSSProperties[ 'borderTopRightRadius' ];\n\t\t\t\t\tbottomLeft?: CSSProperties[ 'borderBottomLeftRadius' ];\n\t\t\t\t\tbottomRight?: CSSProperties[ 'borderBottomLeftRadius' ];\n\t\t\t };\n\t\tstyle?: CSSProperties[ 'borderStyle' ];\n\t\twidth?: CSSProperties[ 'borderWidth' ];\n\t\ttop?: BorderIndividualStyles< 'top' >;\n\t\tright?: BorderIndividualStyles< 'right' >;\n\t\tbottom?: BorderIndividualStyles< 'bottom' >;\n\t\tleft?: BorderIndividualStyles< 'left' >;\n\t};\n\tdimensions?: {\n\t\taspectRatio?: CSSProperties[ 'aspectRatio' ];\n\t\theight?: CSSProperties[ 'height' ];\n\t\tminHeight?: CSSProperties[ 'minHeight' ];\n\t\tminWidth?: CSSProperties[ 'minWidth' ];\n\t\tobjectFit?: CSSProperties[ 'objectFit' ];\n\t\twidth?: CSSProperties[ 'width' ];\n\t};\n\tspacing?: {\n\t\tmargin?: CSSProperties[ 'margin' ] | Box< 'margin' >;\n\t\tpadding?: CSSProperties[ 'padding' ] | Box< 'padding' >;\n\t};\n\ttypography?: {\n\t\tfontSize?: CSSProperties[ 'fontSize' ];\n\t\tfontFamily?: CSSProperties[ 'fontFamily' ];\n\t\tfontWeight?: CSSProperties[ 'fontWeight' ];\n\t\tfontStyle?: CSSProperties[ 'fontStyle' ];\n\t\tletterSpacing?: CSSProperties[ 'letterSpacing' ];\n\t\tlineHeight?: CSSProperties[ 'lineHeight' ];\n\t\ttextColumns?: CSSProperties[ 'columnCount' ];\n\t\ttextDecoration?: CSSProperties[ 'textDecoration' ];\n\t\ttextShadow?: CSSProperties[ 'textShadow' ];\n\t\ttextTransform?: CSSProperties[ 'textTransform' ];\n\t\twritingMode?: CSSProperties[ 'writingMode' ];\n\t};\n\tcolor?: {\n\t\ttext?: CSSProperties[ 'color' ];\n\t\tbackground?: CSSProperties[ 'backgroundColor' ];\n\t\tgradient?: CSSProperties[ 'background' ];\n\t};\n\telements?: {\n\t\tlink?: {\n\t\t\tcolor?: {\n\t\t\t\ttext?: CSSProperties[ 'color' ];\n\t\t\t};\n\t\t};\n\t};\n}\n\nexport interface CssRulesKeys {\n\tdefault: string;\n\tindividual: string;\n}\n\n/**\n * Options that adjust how styles are generated — notably the CSS `selector` to\n * scope the output to. With no selector, declarations are returned inline.\n */\nexport interface StyleOptions {\n\t/**\n\t * CSS selector for the generated style.\n\t */\n\tselector?: string;\n}\n\n/**\n * A single generated CSS rule: an optional `selector`, the `value`, and the\n * `key` in React/JS style-attribute format (e.g. `paddingTop` rather than\n * `padding-top`).\n */\nexport interface GeneratedCSSRule {\n\tselector?: string;\n\tvalue: string | unknown;\n\t/**\n\t * The CSS key in JS style attribute format, compatible with React.\n\t * E.g. `paddingTop` instead of `padding-top`.\n\t */\n\tkey: string;\n}\n\nexport interface GenerateFunction {\n\t( style: Style, options: StyleOptions ): GeneratedCSSRule[];\n}\n\nexport interface StyleDefinition {\n\tname: string;\n\tgenerate?: GenerateFunction;\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -121,6 +121,17 @@ var writingMode = {
|
|
|
121
121
|
);
|
|
122
122
|
}
|
|
123
123
|
};
|
|
124
|
+
var textShadow = {
|
|
125
|
+
name: "textShadow",
|
|
126
|
+
generate: (style, options) => {
|
|
127
|
+
return generateRule(
|
|
128
|
+
style,
|
|
129
|
+
options,
|
|
130
|
+
["typography", "textShadow"],
|
|
131
|
+
"textShadow"
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
124
135
|
var typography_default = [
|
|
125
136
|
fontFamily,
|
|
126
137
|
fontSize,
|
|
@@ -131,6 +142,7 @@ var typography_default = [
|
|
|
131
142
|
textColumns,
|
|
132
143
|
textDecoration,
|
|
133
144
|
textIndent,
|
|
145
|
+
textShadow,
|
|
134
146
|
textTransform,
|
|
135
147
|
writingMode
|
|
136
148
|
];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/styles/typography/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { Style, StyleOptions } from '../../types';\nimport { generateRule } from '../utils';\n\nconst fontSize = {\n\tname: 'fontSize',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'fontSize' ],\n\t\t\t'fontSize'\n\t\t);\n\t},\n};\n\nconst fontStyle = {\n\tname: 'fontStyle',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'fontStyle' ],\n\t\t\t'fontStyle'\n\t\t);\n\t},\n};\n\nconst fontWeight = {\n\tname: 'fontWeight',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'fontWeight' ],\n\t\t\t'fontWeight'\n\t\t);\n\t},\n};\n\nconst fontFamily = {\n\tname: 'fontFamily',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'fontFamily' ],\n\t\t\t'fontFamily'\n\t\t);\n\t},\n};\n\nconst letterSpacing = {\n\tname: 'letterSpacing',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'letterSpacing' ],\n\t\t\t'letterSpacing'\n\t\t);\n\t},\n};\n\nconst lineHeight = {\n\tname: 'lineHeight',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'lineHeight' ],\n\t\t\t'lineHeight'\n\t\t);\n\t},\n};\n\nconst textColumns = {\n\tname: 'textColumns',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'textColumns' ],\n\t\t\t'columnCount'\n\t\t);\n\t},\n};\n\nconst textDecoration = {\n\tname: 'textDecoration',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'textDecoration' ],\n\t\t\t'textDecoration'\n\t\t);\n\t},\n};\n\nconst textIndent = {\n\tname: 'textIndent',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'textIndent' ],\n\t\t\t'textIndent'\n\t\t);\n\t},\n};\n\nconst textTransform = {\n\tname: 'textTransform',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'textTransform' ],\n\t\t\t'textTransform'\n\t\t);\n\t},\n};\n\nconst writingMode = {\n\tname: 'writingMode',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'writingMode' ],\n\t\t\t'writingMode'\n\t\t);\n\t},\n};\n\nexport default [\n\tfontFamily,\n\tfontSize,\n\tfontStyle,\n\tfontWeight,\n\tletterSpacing,\n\tlineHeight,\n\ttextColumns,\n\ttextDecoration,\n\ttextIndent,\n\ttextTransform,\n\twritingMode,\n];\n"],
|
|
5
|
-
"mappings": ";AAIA,SAAS,oBAAoB;AAE7B,IAAM,WAAW;AAAA,EAChB,MAAM;AAAA,EACN,UAAU,CAAE,OAAc,YAA2B;AACpD,WAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA,CAAE,cAAc,UAAW;AAAA,MAC3B;AAAA,IACD;AAAA,EACD;AACD;AAEA,IAAM,YAAY;AAAA,EACjB,MAAM;AAAA,EACN,UAAU,CAAE,OAAc,YAA2B;AACpD,WAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA,CAAE,cAAc,WAAY;AAAA,MAC5B;AAAA,IACD;AAAA,EACD;AACD;AAEA,IAAM,aAAa;AAAA,EAClB,MAAM;AAAA,EACN,UAAU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AAE,OAAc,YAA2B;AACpD,WAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA,CAAE,cAAc,eAAgB;AAAA,MAChC;AAAA,IACD;AAAA,EACD;AACD;AAEA,IAAM,cAAc;AAAA,EACnB,MAAM;AAAA,EACN,UAAU,CAAE,OAAc,YAA2B;AACpD,WAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA,CAAE,cAAc,aAAc;AAAA,MAC9B;AAAA,IACD;AAAA,EACD;AACD;AAEA,IAAO,qBAAQ;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;",
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { Style, StyleOptions } from '../../types';\nimport { generateRule } from '../utils';\n\nconst fontSize = {\n\tname: 'fontSize',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'fontSize' ],\n\t\t\t'fontSize'\n\t\t);\n\t},\n};\n\nconst fontStyle = {\n\tname: 'fontStyle',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'fontStyle' ],\n\t\t\t'fontStyle'\n\t\t);\n\t},\n};\n\nconst fontWeight = {\n\tname: 'fontWeight',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'fontWeight' ],\n\t\t\t'fontWeight'\n\t\t);\n\t},\n};\n\nconst fontFamily = {\n\tname: 'fontFamily',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'fontFamily' ],\n\t\t\t'fontFamily'\n\t\t);\n\t},\n};\n\nconst letterSpacing = {\n\tname: 'letterSpacing',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'letterSpacing' ],\n\t\t\t'letterSpacing'\n\t\t);\n\t},\n};\n\nconst lineHeight = {\n\tname: 'lineHeight',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'lineHeight' ],\n\t\t\t'lineHeight'\n\t\t);\n\t},\n};\n\nconst textColumns = {\n\tname: 'textColumns',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'textColumns' ],\n\t\t\t'columnCount'\n\t\t);\n\t},\n};\n\nconst textDecoration = {\n\tname: 'textDecoration',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'textDecoration' ],\n\t\t\t'textDecoration'\n\t\t);\n\t},\n};\n\nconst textIndent = {\n\tname: 'textIndent',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'textIndent' ],\n\t\t\t'textIndent'\n\t\t);\n\t},\n};\n\nconst textTransform = {\n\tname: 'textTransform',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'textTransform' ],\n\t\t\t'textTransform'\n\t\t);\n\t},\n};\n\nconst writingMode = {\n\tname: 'writingMode',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'writingMode' ],\n\t\t\t'writingMode'\n\t\t);\n\t},\n};\n\nconst textShadow = {\n\tname: 'textShadow',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'textShadow' ],\n\t\t\t'textShadow'\n\t\t);\n\t},\n};\n\nexport default [\n\tfontFamily,\n\tfontSize,\n\tfontStyle,\n\tfontWeight,\n\tletterSpacing,\n\tlineHeight,\n\ttextColumns,\n\ttextDecoration,\n\ttextIndent,\n\ttextShadow,\n\ttextTransform,\n\twritingMode,\n];\n"],
|
|
5
|
+
"mappings": ";AAIA,SAAS,oBAAoB;AAE7B,IAAM,WAAW;AAAA,EAChB,MAAM;AAAA,EACN,UAAU,CAAE,OAAc,YAA2B;AACpD,WAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA,CAAE,cAAc,UAAW;AAAA,MAC3B;AAAA,IACD;AAAA,EACD;AACD;AAEA,IAAM,YAAY;AAAA,EACjB,MAAM;AAAA,EACN,UAAU,CAAE,OAAc,YAA2B;AACpD,WAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA,CAAE,cAAc,WAAY;AAAA,MAC5B;AAAA,IACD;AAAA,EACD;AACD;AAEA,IAAM,aAAa;AAAA,EAClB,MAAM;AAAA,EACN,UAAU,CAAE,OAAc,YAA2B;AACpD,WAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA,CAAE,cAAc,YAAa;AAAA,MAC7B;AAAA,IACD;AAAA,EACD;AACD;AAEA,IAAM,aAAa;AAAA,EAClB,MAAM;AAAA,EACN,UAAU,CAAE,OAAc,YAA2B;AACpD,WAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA,CAAE,cAAc,YAAa;AAAA,MAC7B;AAAA,IACD;AAAA,EACD;AACD;AAEA,IAAM,gBAAgB;AAAA,EACrB,MAAM;AAAA,EACN,UAAU,CAAE,OAAc,YAA2B;AACpD,WAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA,CAAE,cAAc,eAAgB;AAAA,MAChC;AAAA,IACD;AAAA,EACD;AACD;AA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AAO,qBAAQ;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build-types/types.d.ts
CHANGED
|
@@ -68,6 +68,7 @@ export interface Style {
|
|
|
68
68
|
lineHeight?: CSSProperties['lineHeight'];
|
|
69
69
|
textColumns?: CSSProperties['columnCount'];
|
|
70
70
|
textDecoration?: CSSProperties['textDecoration'];
|
|
71
|
+
textShadow?: CSSProperties['textShadow'];
|
|
71
72
|
textTransform?: CSSProperties['textTransform'];
|
|
72
73
|
writingMode?: CSSProperties['writingMode'];
|
|
73
74
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,KAAK,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAC;AACvC,MAAM,WAAW,GAAG,CAAE,CAAC,SAAS,UAAU,GAAG,SAAS,GAAG,SAAS;IACjE,GAAG,CAAC,EAAE,aAAa,CAAE,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,GAAI,CAAE,KAAK,CAAE,CAAC;IACjE,KAAK,CAAC,EAAE,aAAa,CAAE,CAAC,SAAS,SAAS,GAAG,OAAO,GAAG,GAAI,CAAE,OAAO,CAAE,CAAC;IACvE,MAAM,CAAC,EAAE,aAAa,CAAE,CAAC,SAAS,SAAS,GAAG,QAAQ,GAAG,GAAI,CAAE,QAAQ,CAAE,CAAC;IAC1E,IAAI,CAAC,EAAE,aAAa,CAAE,CAAC,SAAS,SAAS,GAAG,MAAM,GAAG,GAAI,CAAE,MAAM,CAAE,CAAC;CACpE;AAED,MAAM,MAAM,OAAO,GAAG,KAAK,GAAG,OAAO,GAAG,Q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AAE,CAAC;aAChC,CAAC;SACF,CAAC;KACF,CAAC;CACF;AAED,MAAM,WAAW,YAAY;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC5B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IACxB;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,gBAAgB;IAChC,CAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,YAAY,GAAI,gBAAgB,EAAE,CAAC;CAC5D;AAED,MAAM,WAAW,eAAe;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,gBAAgB,CAAC;CAC5B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/style-engine",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.50.1-next.v.202607070741.0+a51d59513",
|
|
4
4
|
"description": "A suite of parsers and compilers for WordPress styles.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"publishConfig": {
|
|
78
78
|
"access": "public"
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "f637726e370c8b23695ed9af82adbe171ad235d8"
|
|
81
81
|
}
|
|
@@ -22,6 +22,13 @@ if ( ! class_exists( 'WP_Style_Engine_CSS_Declarations' ) ) {
|
|
|
22
22
|
*/
|
|
23
23
|
protected $declarations = array();
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* CSS declaration options keyed by property name.
|
|
27
|
+
*
|
|
28
|
+
* @var array
|
|
29
|
+
*/
|
|
30
|
+
protected $declaration_options = array();
|
|
31
|
+
|
|
25
32
|
/**
|
|
26
33
|
* Constructor for this object.
|
|
27
34
|
*
|
|
@@ -39,10 +46,15 @@ if ( ! class_exists( 'WP_Style_Engine_CSS_Declarations' ) ) {
|
|
|
39
46
|
*
|
|
40
47
|
* @param string $property The CSS property.
|
|
41
48
|
* @param string $value The CSS value.
|
|
49
|
+
* @param array $options {
|
|
50
|
+
* Optional. An array of options. Default empty array.
|
|
51
|
+
*
|
|
52
|
+
* @type bool $important Whether to output the declaration with !important. Default false.
|
|
53
|
+
* }
|
|
42
54
|
*
|
|
43
55
|
* @return WP_Style_Engine_CSS_Declarations Returns the object to allow chaining methods.
|
|
44
56
|
*/
|
|
45
|
-
public function add_declaration( $property, $value ) {
|
|
57
|
+
public function add_declaration( $property, $value, $options = array() ) {
|
|
46
58
|
// Sanitizes the property.
|
|
47
59
|
$property = $this->sanitize_property( $property );
|
|
48
60
|
// Bails early if the property is empty.
|
|
@@ -59,8 +71,22 @@ if ( ! class_exists( 'WP_Style_Engine_CSS_Declarations' ) ) {
|
|
|
59
71
|
return $this;
|
|
60
72
|
}
|
|
61
73
|
|
|
74
|
+
$options = wp_parse_args(
|
|
75
|
+
$options,
|
|
76
|
+
array(
|
|
77
|
+
'important' => false,
|
|
78
|
+
)
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
$options = array_filter( $options );
|
|
82
|
+
|
|
62
83
|
// Adds the declaration property/value pair.
|
|
63
84
|
$this->declarations[ $property ] = $value;
|
|
85
|
+
if ( $options ) {
|
|
86
|
+
$this->declaration_options[ $property ] = $options;
|
|
87
|
+
} else {
|
|
88
|
+
unset( $this->declaration_options[ $property ] );
|
|
89
|
+
}
|
|
64
90
|
|
|
65
91
|
return $this;
|
|
66
92
|
}
|
|
@@ -74,6 +100,7 @@ if ( ! class_exists( 'WP_Style_Engine_CSS_Declarations' ) ) {
|
|
|
74
100
|
*/
|
|
75
101
|
public function remove_declaration( $property ) {
|
|
76
102
|
unset( $this->declarations[ $property ] );
|
|
103
|
+
unset( $this->declaration_options[ $property ] );
|
|
77
104
|
return $this;
|
|
78
105
|
}
|
|
79
106
|
|
|
@@ -114,20 +141,48 @@ if ( ! class_exists( 'WP_Style_Engine_CSS_Declarations' ) ) {
|
|
|
114
141
|
return $this->declarations;
|
|
115
142
|
}
|
|
116
143
|
|
|
144
|
+
/**
|
|
145
|
+
* Gets declaration options keyed by property name.
|
|
146
|
+
*
|
|
147
|
+
* @return array
|
|
148
|
+
*/
|
|
149
|
+
public function get_declaration_options() {
|
|
150
|
+
return $this->declaration_options;
|
|
151
|
+
}
|
|
152
|
+
|
|
117
153
|
/**
|
|
118
154
|
* Filters a CSS property + value pair.
|
|
119
155
|
*
|
|
120
156
|
* @param string $property The CSS property.
|
|
121
157
|
* @param string $value The value to be filtered.
|
|
122
158
|
* @param string $spacer The spacer between the colon and the value. Defaults to an empty string.
|
|
159
|
+
* @param array $options {
|
|
160
|
+
* Optional. An array of options. Default empty array.
|
|
161
|
+
*
|
|
162
|
+
* @type bool $important Whether to output the declaration with !important. Default false.
|
|
163
|
+
* }
|
|
123
164
|
*
|
|
124
165
|
* @return string The filtered declaration or an empty string.
|
|
125
166
|
*/
|
|
126
|
-
protected static function filter_declaration( $property, $value, $spacer = '' ) {
|
|
167
|
+
protected static function filter_declaration( $property, $value, $spacer = '', $options = array() ) {
|
|
127
168
|
$filtered_value = wp_strip_all_tags( $value, true );
|
|
128
169
|
|
|
129
170
|
if ( '' !== $filtered_value ) {
|
|
130
|
-
|
|
171
|
+
$options = wp_parse_args(
|
|
172
|
+
$options,
|
|
173
|
+
array(
|
|
174
|
+
'important' => false,
|
|
175
|
+
)
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
$filtered_declaration = safecss_filter_attr( "{$property}:{$spacer}{$filtered_value}" );
|
|
179
|
+
|
|
180
|
+
// Only append !important in the presence of an option value and when sanitization returns a single declaration.
|
|
181
|
+
if ( true === $options['important'] && '' !== $filtered_declaration && ! str_contains( $filtered_declaration, ';' ) ) {
|
|
182
|
+
return "$filtered_declaration !important";
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return $filtered_declaration;
|
|
131
186
|
}
|
|
132
187
|
return '';
|
|
133
188
|
}
|
|
@@ -149,7 +204,12 @@ if ( ! class_exists( 'WP_Style_Engine_CSS_Declarations' ) ) {
|
|
|
149
204
|
$spacer = $should_prettify ? ' ' : '';
|
|
150
205
|
|
|
151
206
|
foreach ( $declarations_array as $property => $value ) {
|
|
152
|
-
$filtered_declaration = static::filter_declaration(
|
|
207
|
+
$filtered_declaration = static::filter_declaration(
|
|
208
|
+
$property,
|
|
209
|
+
$value,
|
|
210
|
+
$spacer,
|
|
211
|
+
$this->declaration_options[ $property ] ?? array()
|
|
212
|
+
);
|
|
153
213
|
if ( $filtered_declaration ) {
|
|
154
214
|
$declarations_output .= "{$indent}{$filtered_declaration};$suffix";
|
|
155
215
|
}
|
|
@@ -77,15 +77,23 @@ if ( ! class_exists( 'WP_Style_Engine_CSS_Rule' ) ) {
|
|
|
77
77
|
public function add_declarations( $declarations ) {
|
|
78
78
|
$is_declarations_object = ! is_array( $declarations );
|
|
79
79
|
$declarations_array = $is_declarations_object ? $declarations->get_declarations() : $declarations;
|
|
80
|
+
$declaration_options = $is_declarations_object ? $declarations->get_declaration_options() : array();
|
|
80
81
|
|
|
81
82
|
if ( null === $this->declarations ) {
|
|
82
83
|
if ( $is_declarations_object ) {
|
|
83
84
|
$this->declarations = $declarations;
|
|
84
85
|
return $this;
|
|
85
86
|
}
|
|
86
|
-
$this->declarations = new WP_Style_Engine_CSS_Declarations(
|
|
87
|
+
$this->declarations = new WP_Style_Engine_CSS_Declarations();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
foreach ( $declarations_array as $property => $value ) {
|
|
91
|
+
$this->declarations->add_declaration(
|
|
92
|
+
$property,
|
|
93
|
+
$value,
|
|
94
|
+
$declaration_options[ $property ] ?? array()
|
|
95
|
+
);
|
|
87
96
|
}
|
|
88
|
-
$this->declarations->add_declarations( $declarations_array );
|
|
89
97
|
|
|
90
98
|
return $this;
|
|
91
99
|
}
|
|
@@ -142,9 +142,23 @@ if ( ! class_exists( 'WP_Style_Engine_Processor' ) ) {
|
|
|
142
142
|
// Build an array of selectors along with the JSON-ified styles to make comparisons easier.
|
|
143
143
|
$selectors_json = array();
|
|
144
144
|
foreach ( $this->css_rules as $rule ) {
|
|
145
|
-
$declarations
|
|
145
|
+
$declarations = $rule->get_declarations()->get_declarations();
|
|
146
|
+
$declaration_options = $rule->get_declarations()->get_declaration_options();
|
|
146
147
|
ksort( $declarations );
|
|
147
|
-
|
|
148
|
+
// Declaration options are keyed by property and are part of the rule identity.
|
|
149
|
+
ksort( $declaration_options );
|
|
150
|
+
foreach ( $declaration_options as $property => $options ) {
|
|
151
|
+
if ( is_array( $options ) ) {
|
|
152
|
+
ksort( $options );
|
|
153
|
+
$declaration_options[ $property ] = $options;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
$selectors_json[ $rule->get_selector() ] = wp_json_encode(
|
|
157
|
+
array(
|
|
158
|
+
'declarations' => $declarations,
|
|
159
|
+
'declaration_options' => $declaration_options,
|
|
160
|
+
)
|
|
161
|
+
);
|
|
148
162
|
}
|
|
149
163
|
|
|
150
164
|
// Combine selectors that have the same styles.
|
|
@@ -336,6 +336,12 @@ if ( ! class_exists( 'WP_Style_Engine' ) ) {
|
|
|
336
336
|
),
|
|
337
337
|
'path' => array( 'typography', 'textIndent' ),
|
|
338
338
|
),
|
|
339
|
+
'textShadow' => array(
|
|
340
|
+
'property_keys' => array(
|
|
341
|
+
'default' => 'text-shadow',
|
|
342
|
+
),
|
|
343
|
+
'path' => array( 'typography', 'textShadow' ),
|
|
344
|
+
),
|
|
339
345
|
'textTransform' => array(
|
|
340
346
|
'property_keys' => array(
|
|
341
347
|
'default' => 'text-transform',
|
|
@@ -411,8 +417,9 @@ if ( ! class_exists( 'WP_Style_Engine' ) ) {
|
|
|
411
417
|
*
|
|
412
418
|
* @param string $store_name A valid store key.
|
|
413
419
|
* @param string $css_selector When a selector is passed, the function will return a full CSS rule `$selector { ...rules }`, otherwise a concatenated string of properties and values.
|
|
414
|
-
* @param string[] $css_declarations An associative array of CSS definitions, e.g., array( "$property" => "$value", "$property" => "$value" )
|
|
415
|
-
*
|
|
420
|
+
* @param string[]|WP_Style_Engine_CSS_Declarations $css_declarations An associative array of CSS definitions, e.g., array( "$property" => "$value", "$property" => "$value" ),
|
|
421
|
+
* or a WP_Style_Engine_CSS_Declarations object.
|
|
422
|
+
* @param string $rules_group Optional. A parent CSS selector in the case of nested CSS, or a CSS nested @rule, such as `@media (min-width: 80rem)` or `@layer module`.
|
|
416
423
|
*
|
|
417
424
|
* @return void.
|
|
418
425
|
*/
|
package/src/style-engine.php
CHANGED
|
@@ -85,7 +85,8 @@ function wp_style_engine_get_styles( $block_styles, $options = array() ) {
|
|
|
85
85
|
* @type array ...$0 {
|
|
86
86
|
* @type string $rules_group A parent CSS selector in the case of nested CSS, or a CSS nested @rule, such as `@media (min-width: 80rem)` or `@layer module`.
|
|
87
87
|
* @type string $selector A CSS selector.
|
|
88
|
-
* @type string[] $declarations An associative array of CSS definitions, e.g., array( "$property" => "$value", "$property" => "$value" )
|
|
88
|
+
* @type string[]|WP_Style_Engine_CSS_Declarations $declarations An associative array of CSS definitions, e.g., array( "$property" => "$value", "$property" => "$value" ),
|
|
89
|
+
* or a WP_Style_Engine_CSS_Declarations object.
|
|
89
90
|
* }
|
|
90
91
|
* }
|
|
91
92
|
* @param array $options {
|
|
@@ -113,16 +114,21 @@ function wp_style_engine_get_stylesheet_from_css_rules( $css_rules, $options = a
|
|
|
113
114
|
|
|
114
115
|
$css_rule_objects = array();
|
|
115
116
|
foreach ( $css_rules as $css_rule ) {
|
|
116
|
-
|
|
117
|
+
$declarations = $css_rule['declarations'] ?? null;
|
|
118
|
+
if (
|
|
119
|
+
empty( $css_rule['selector'] ) ||
|
|
120
|
+
empty( $declarations ) ||
|
|
121
|
+
( ! is_array( $declarations ) && ! $declarations instanceof WP_Style_Engine_CSS_Declarations )
|
|
122
|
+
) {
|
|
117
123
|
continue;
|
|
118
124
|
}
|
|
119
125
|
|
|
120
126
|
$rules_group = $css_rule['rules_group'] ?? null;
|
|
121
127
|
if ( ! empty( $options['context'] ) ) {
|
|
122
|
-
WP_Style_Engine::store_css_rule( $options['context'], $css_rule['selector'], $
|
|
128
|
+
WP_Style_Engine::store_css_rule( $options['context'], $css_rule['selector'], $declarations, $rules_group );
|
|
123
129
|
}
|
|
124
130
|
|
|
125
|
-
$css_rule_objects[] = new WP_Style_Engine_CSS_Rule( $css_rule['selector'], $
|
|
131
|
+
$css_rule_objects[] = new WP_Style_Engine_CSS_Rule( $css_rule['selector'], $declarations, $rules_group );
|
|
126
132
|
}
|
|
127
133
|
|
|
128
134
|
if ( empty( $css_rule_objects ) ) {
|
|
@@ -136,6 +136,18 @@ const writingMode = {
|
|
|
136
136
|
},
|
|
137
137
|
};
|
|
138
138
|
|
|
139
|
+
const textShadow = {
|
|
140
|
+
name: 'textShadow',
|
|
141
|
+
generate: ( style: Style, options: StyleOptions ) => {
|
|
142
|
+
return generateRule(
|
|
143
|
+
style,
|
|
144
|
+
options,
|
|
145
|
+
[ 'typography', 'textShadow' ],
|
|
146
|
+
'textShadow'
|
|
147
|
+
);
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
|
|
139
151
|
export default [
|
|
140
152
|
fontFamily,
|
|
141
153
|
fontSize,
|
|
@@ -146,6 +158,7 @@ export default [
|
|
|
146
158
|
textColumns,
|
|
147
159
|
textDecoration,
|
|
148
160
|
textIndent,
|
|
161
|
+
textShadow,
|
|
149
162
|
textTransform,
|
|
150
163
|
writingMode,
|
|
151
164
|
];
|
package/src/test/index.js
CHANGED
|
@@ -76,6 +76,7 @@ describe( 'generate', () => {
|
|
|
76
76
|
lineHeight: '3.3',
|
|
77
77
|
textColumns: '2',
|
|
78
78
|
textDecoration: 'line-through',
|
|
79
|
+
textShadow: '1px 1px 2px red',
|
|
79
80
|
letterSpacing: '12px',
|
|
80
81
|
textTransform: 'uppercase',
|
|
81
82
|
},
|
|
@@ -91,7 +92,7 @@ describe( 'generate', () => {
|
|
|
91
92
|
}
|
|
92
93
|
)
|
|
93
94
|
).toEqual(
|
|
94
|
-
".some-selector { color: #cccccc; background: linear-gradient(135deg,rgb(255,203,112) 0%,rgb(33,32,33) 42%,rgb(65,88,208) 100%); background-color: #111111; min-height: 50vh; min-width: 25vw; object-fit: cover; outline-color: red; outline-style: dashed; outline-offset: 2px; outline-width: 4px; margin-top: 11px; margin-right: 12px; margin-bottom: 13px; margin-left: 14px; padding-top: 10px; padding-bottom: 5px; font-family: 'Helvetica Neue',sans-serif; font-size: 2.2rem; font-style: italic; font-weight: 800; letter-spacing: 12px; line-height: 3.3; column-count: 2; text-decoration: line-through; text-transform: uppercase; }"
|
|
95
|
+
".some-selector { color: #cccccc; background: linear-gradient(135deg,rgb(255,203,112) 0%,rgb(33,32,33) 42%,rgb(65,88,208) 100%); background-color: #111111; min-height: 50vh; min-width: 25vw; object-fit: cover; outline-color: red; outline-style: dashed; outline-offset: 2px; outline-width: 4px; margin-top: 11px; margin-right: 12px; margin-bottom: 13px; margin-left: 14px; padding-top: 10px; padding-bottom: 5px; font-family: 'Helvetica Neue',sans-serif; font-size: 2.2rem; font-style: italic; font-weight: 800; letter-spacing: 12px; line-height: 3.3; column-count: 2; text-decoration: line-through; text-shadow: 1px 1px 2px red; text-transform: uppercase; }"
|
|
95
96
|
);
|
|
96
97
|
} );
|
|
97
98
|
|
|
@@ -257,6 +258,7 @@ describe( 'getCSSRules', () => {
|
|
|
257
258
|
lineHeight: '3.3',
|
|
258
259
|
textColumns: '2',
|
|
259
260
|
textDecoration: 'line-through',
|
|
261
|
+
textShadow: '1px 1px 2px red',
|
|
260
262
|
letterSpacing: '12px',
|
|
261
263
|
textTransform: 'uppercase',
|
|
262
264
|
},
|
|
@@ -378,6 +380,11 @@ describe( 'getCSSRules', () => {
|
|
|
378
380
|
key: 'textDecoration',
|
|
379
381
|
value: 'line-through',
|
|
380
382
|
},
|
|
383
|
+
{
|
|
384
|
+
selector: '.some-selector',
|
|
385
|
+
key: 'textShadow',
|
|
386
|
+
value: '1px 1px 2px red',
|
|
387
|
+
},
|
|
381
388
|
{
|
|
382
389
|
selector: '.some-selector',
|
|
383
390
|
key: 'textTransform',
|
package/src/types.ts
CHANGED
|
@@ -74,6 +74,7 @@ export interface Style {
|
|
|
74
74
|
lineHeight?: CSSProperties[ 'lineHeight' ];
|
|
75
75
|
textColumns?: CSSProperties[ 'columnCount' ];
|
|
76
76
|
textDecoration?: CSSProperties[ 'textDecoration' ];
|
|
77
|
+
textShadow?: CSSProperties[ 'textShadow' ];
|
|
77
78
|
textTransform?: CSSProperties[ 'textTransform' ];
|
|
78
79
|
writingMode?: CSSProperties[ 'writingMode' ];
|
|
79
80
|
};
|