@wordpress/style-engine 2.48.1 → 2.49.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 +6 -0
- package/README.md +44 -0
- package/build/index.cjs.map +2 -2
- package/build/styles/dimensions/index.cjs +12 -1
- package/build/styles/dimensions/index.cjs.map +2 -2
- 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/index.mjs.map +2 -2
- package/build-module/styles/dimensions/index.mjs +12 -1
- package/build-module/styles/dimensions/index.mjs.map +2 -2
- package/build-module/styles/typography/index.mjs +12 -0
- package/build-module/styles/typography/index.mjs.map +2 -2
- package/build-types/index.d.ts +42 -0
- package/build-types/index.d.ts.map +1 -1
- package/build-types/styles/background/index.d.ts +1 -1
- package/build-types/styles/color/background.d.ts +1 -1
- package/build-types/styles/color/gradient.d.ts +1 -1
- package/build-types/styles/color/index.d.ts +1 -1
- package/build-types/styles/color/text.d.ts +1 -1
- package/build-types/styles/dimensions/index.d.ts +1 -1
- package/build-types/styles/index.d.ts +1 -1
- package/build-types/styles/shadow/index.d.ts +1 -1
- package/build-types/styles/spacing/index.d.ts +1 -1
- package/build-types/styles/spacing/margin.d.ts +1 -1
- package/build-types/styles/spacing/padding.d.ts +1 -1
- package/build-types/styles/typography/index.d.ts +1 -1
- package/build-types/types.d.ts +17 -0
- package/build-types/types.d.ts.map +1 -1
- package/package.json +10 -3
- package/src/class-wp-style-engine.php +12 -0
- package/src/index.ts +45 -0
- package/src/styles/dimensions/index.ts +13 -1
- package/src/styles/typography/index.ts +13 -0
- package/src/test/index.js +9 -1
- package/src/types.ts +17 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 2.49.0 (2026-06-24)
|
|
6
|
+
|
|
7
|
+
### Enhancements
|
|
8
|
+
|
|
9
|
+
- Export the `Style`, `StyleOptions`, and `GeneratedCSSRule` TypeScript types so that consumers of the public API can type their usage of `compileCSS` and `getCSSRules`.
|
|
10
|
+
|
|
5
11
|
## 2.48.1 (2026-06-16)
|
|
6
12
|
|
|
7
13
|
## 2.48.0 (2026-06-10)
|
package/README.md
CHANGED
|
@@ -228,6 +228,23 @@ _This package assumes that your code will run in an **ES2015+** environment. If
|
|
|
228
228
|
|
|
229
229
|
Generates a stylesheet for a given style object and selector.
|
|
230
230
|
|
|
231
|
+
_Usage_
|
|
232
|
+
|
|
233
|
+
```js
|
|
234
|
+
import { compileCSS } from '@wordpress/style-engine';
|
|
235
|
+
|
|
236
|
+
// With a selector, a full stylesheet string is returned.
|
|
237
|
+
compileCSS(
|
|
238
|
+
{ spacing: { padding: '10px', margin: '12px' } },
|
|
239
|
+
{ selector: '.my-block' }
|
|
240
|
+
);
|
|
241
|
+
// '.my-block { margin: 12px; padding: 10px; }'
|
|
242
|
+
|
|
243
|
+
// Without a selector, inline declarations are returned.
|
|
244
|
+
compileCSS( { spacing: { padding: '10px', margin: '12px' } } );
|
|
245
|
+
// 'margin: 12px; padding: 10px;'
|
|
246
|
+
```
|
|
247
|
+
|
|
231
248
|
_Parameters_
|
|
232
249
|
|
|
233
250
|
- _style_ `Style`: Style object, for example, the value of a block's attributes.style object or the top level styles in theme.json
|
|
@@ -241,10 +258,29 @@ _Changelog_
|
|
|
241
258
|
|
|
242
259
|
`6.1.0` Introduced in WordPress core.
|
|
243
260
|
|
|
261
|
+
### GeneratedCSSRule
|
|
262
|
+
|
|
263
|
+
A single CSS rule produced by `getCSSRules`.
|
|
264
|
+
|
|
244
265
|
### getCSSRules
|
|
245
266
|
|
|
246
267
|
Returns a JSON representation of the generated CSS rules.
|
|
247
268
|
|
|
269
|
+
_Usage_
|
|
270
|
+
|
|
271
|
+
```js
|
|
272
|
+
import { getCSSRules } from '@wordpress/style-engine';
|
|
273
|
+
|
|
274
|
+
getCSSRules(
|
|
275
|
+
{ spacing: { padding: '10px', margin: '12px' } },
|
|
276
|
+
{ selector: '.my-block' }
|
|
277
|
+
);
|
|
278
|
+
// [
|
|
279
|
+
// { selector: '.my-block', key: 'margin', value: '12px' },
|
|
280
|
+
// { selector: '.my-block', key: 'padding', value: '10px' },
|
|
281
|
+
// ]
|
|
282
|
+
```
|
|
283
|
+
|
|
248
284
|
_Parameters_
|
|
249
285
|
|
|
250
286
|
- _style_ `Style`: Style object, for example, the value of a block's attributes.style object or the top level styles in theme.json
|
|
@@ -276,6 +312,14 @@ _Returns_
|
|
|
276
312
|
|
|
277
313
|
- `StyleValue`: A CSS custom var value if the incoming style value is a preset value.
|
|
278
314
|
|
|
315
|
+
### Style
|
|
316
|
+
|
|
317
|
+
A block or theme style object accepted by `compileCSS` and `getCSSRules`.
|
|
318
|
+
|
|
319
|
+
### StyleOptions
|
|
320
|
+
|
|
321
|
+
Options for `compileCSS` and `getCSSRules`.
|
|
322
|
+
|
|
279
323
|
<!-- END TOKEN(Autogenerated API docs) -->
|
|
280
324
|
|
|
281
325
|
## Glossary
|
package/build/index.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport { paramCase as kebabCase } from 'change-case';\n\n/**\n * Internal dependencies\n */\nimport type {\n\tStyle,\n\tStyleOptions,\n\tGeneratedCSSRule,\n\tStyleDefinition,\n} from './types';\nimport { styleDefinitions } from './styles';\n\n/**\n * Generates a stylesheet for a given style object and selector.\n *\n * @since 6.1.0 Introduced in WordPress core.\n *\n * @param style Style object, for example, the value of a block's attributes.style object or the top level styles in theme.json\n * @param options Options object with settings to adjust how the styles are generated.\n *\n * @return A generated stylesheet or inline style declarations.\n */\nexport function compileCSS( style: Style, options: StyleOptions = {} ): string {\n\tconst rules = getCSSRules( style, options );\n\n\t// If no selector is provided, treat generated rules as inline styles to be returned as a single string.\n\tif ( ! options?.selector ) {\n\t\tconst inlineRules: string[] = [];\n\t\trules.forEach( ( rule ) => {\n\t\t\tinlineRules.push( `${ kebabCase( rule.key ) }: ${ rule.value };` );\n\t\t} );\n\t\treturn inlineRules.join( ' ' );\n\t}\n\n\tconst groupedRules = rules.reduce(\n\t\t( acc: Record< string, GeneratedCSSRule[] >, rule ) => {\n\t\t\tconst { selector } = rule;\n\t\t\tif ( ! selector ) {\n\t\t\t\treturn acc;\n\t\t\t}\n\t\t\tif ( ! acc[ selector ] ) {\n\t\t\t\tacc[ selector ] = [];\n\t\t\t}\n\t\t\tacc[ selector ].push( rule );\n\t\t\treturn acc;\n\t\t},\n\t\t{}\n\t);\n\tconst selectorRules = Object.keys( groupedRules ).reduce(\n\t\t( acc: string[], subSelector: string ) => {\n\t\t\tacc.push(\n\t\t\t\t`${ subSelector } { ${ groupedRules[ subSelector ]\n\t\t\t\t\t.map(\n\t\t\t\t\t\t( rule: GeneratedCSSRule ) =>\n\t\t\t\t\t\t\t`${ kebabCase( rule.key ) }: ${ rule.value };`\n\t\t\t\t\t)\n\t\t\t\t\t.join( ' ' ) } }`\n\t\t\t);\n\t\t\treturn acc;\n\t\t},\n\t\t[]\n\t);\n\n\treturn selectorRules.join( '\\n' );\n}\n\n/**\n * Returns a JSON representation of the generated CSS rules.\n *\n * @since 6.1.0 Introduced in WordPress core.\n *\n * @param style Style object, for example, the value of a block's attributes.style object or the top level styles in theme.json\n * @param options Options object with settings to adjust how the styles are generated.\n *\n * @return A collection of objects containing the selector, if any, the CSS property key (camelcase) and parsed CSS value.\n */\nexport function getCSSRules(\n\tstyle: Style,\n\toptions: StyleOptions = {}\n): GeneratedCSSRule[] {\n\tconst rules: GeneratedCSSRule[] = [];\n\tstyleDefinitions.forEach( ( definition: StyleDefinition ) => {\n\t\tif ( typeof definition.generate === 'function' ) {\n\t\t\trules.push( ...definition.generate( style, options ) );\n\t\t}\n\t} );\n\n\treturn rules;\n}\n\n// Export style utils.\nexport { getCSSValueFromRawStyle } from './styles/utils';\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,yBAAuC;AAWvC,oBAAiC;
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport { paramCase as kebabCase } from 'change-case';\n\n/**\n * Internal dependencies\n */\nimport type {\n\tStyle,\n\tStyleOptions,\n\tGeneratedCSSRule,\n\tStyleDefinition,\n} from './types';\nimport { styleDefinitions } from './styles';\n\n/**\n * A block or theme style object accepted by `compileCSS` and `getCSSRules`.\n */\nexport type { Style } from './types';\n\n/**\n * Options for `compileCSS` and `getCSSRules`.\n */\nexport type { StyleOptions } from './types';\n\n/**\n * A single CSS rule produced by `getCSSRules`.\n */\nexport type { GeneratedCSSRule } from './types';\n\n/**\n * Generates a stylesheet for a given style object and selector.\n *\n * @since 6.1.0 Introduced in WordPress core.\n *\n * @param style Style object, for example, the value of a block's attributes.style object or the top level styles in theme.json\n * @param options Options object with settings to adjust how the styles are generated.\n *\n * @example\n * ```js\n * import { compileCSS } from '@wordpress/style-engine';\n *\n * // With a selector, a full stylesheet string is returned.\n * compileCSS(\n * \t{ spacing: { padding: '10px', margin: '12px' } },\n * \t{ selector: '.my-block' }\n * );\n * // '.my-block { margin: 12px; padding: 10px; }'\n *\n * // Without a selector, inline declarations are returned.\n * compileCSS( { spacing: { padding: '10px', margin: '12px' } } );\n * // 'margin: 12px; padding: 10px;'\n * ```\n *\n * @return A generated stylesheet or inline style declarations.\n */\nexport function compileCSS( style: Style, options: StyleOptions = {} ): string {\n\tconst rules = getCSSRules( style, options );\n\n\t// If no selector is provided, treat generated rules as inline styles to be returned as a single string.\n\tif ( ! options?.selector ) {\n\t\tconst inlineRules: string[] = [];\n\t\trules.forEach( ( rule ) => {\n\t\t\tinlineRules.push( `${ kebabCase( rule.key ) }: ${ rule.value };` );\n\t\t} );\n\t\treturn inlineRules.join( ' ' );\n\t}\n\n\tconst groupedRules = rules.reduce(\n\t\t( acc: Record< string, GeneratedCSSRule[] >, rule ) => {\n\t\t\tconst { selector } = rule;\n\t\t\tif ( ! selector ) {\n\t\t\t\treturn acc;\n\t\t\t}\n\t\t\tif ( ! acc[ selector ] ) {\n\t\t\t\tacc[ selector ] = [];\n\t\t\t}\n\t\t\tacc[ selector ].push( rule );\n\t\t\treturn acc;\n\t\t},\n\t\t{}\n\t);\n\tconst selectorRules = Object.keys( groupedRules ).reduce(\n\t\t( acc: string[], subSelector: string ) => {\n\t\t\tacc.push(\n\t\t\t\t`${ subSelector } { ${ groupedRules[ subSelector ]\n\t\t\t\t\t.map(\n\t\t\t\t\t\t( rule: GeneratedCSSRule ) =>\n\t\t\t\t\t\t\t`${ kebabCase( rule.key ) }: ${ rule.value };`\n\t\t\t\t\t)\n\t\t\t\t\t.join( ' ' ) } }`\n\t\t\t);\n\t\t\treturn acc;\n\t\t},\n\t\t[]\n\t);\n\n\treturn selectorRules.join( '\\n' );\n}\n\n/**\n * Returns a JSON representation of the generated CSS rules.\n *\n * @since 6.1.0 Introduced in WordPress core.\n *\n * @param style Style object, for example, the value of a block's attributes.style object or the top level styles in theme.json\n * @param options Options object with settings to adjust how the styles are generated.\n *\n * @example\n * ```js\n * import { getCSSRules } from '@wordpress/style-engine';\n *\n * getCSSRules(\n * \t{ spacing: { padding: '10px', margin: '12px' } },\n * \t{ selector: '.my-block' }\n * );\n * // [\n * // { selector: '.my-block', key: 'margin', value: '12px' },\n * // { selector: '.my-block', key: 'padding', value: '10px' },\n * // ]\n * ```\n *\n * @return A collection of objects containing the selector, if any, the CSS property key (camelcase) and parsed CSS value.\n */\nexport function getCSSRules(\n\tstyle: Style,\n\toptions: StyleOptions = {}\n): GeneratedCSSRule[] {\n\tconst rules: GeneratedCSSRule[] = [];\n\tstyleDefinitions.forEach( ( definition: StyleDefinition ) => {\n\t\tif ( typeof definition.generate === 'function' ) {\n\t\t\trules.push( ...definition.generate( style, options ) );\n\t\t}\n\t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AACnC,iCAAiB,QAAS,CAAE,eAAiC;AAC5D,QAAK,OAAO,WAAW,aAAa,YAAa;AAChD,YAAM,KAAM,GAAG,WAAW,SAAU,OAAO,OAAQ,CAAE;AAAA,IACtD;AAAA,EACD,CAAE;AAEF,SAAO;AACR;",
|
|
6
6
|
"names": ["kebabCase"]
|
|
7
7
|
}
|
|
@@ -79,5 +79,16 @@ var width = {
|
|
|
79
79
|
);
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
|
-
var
|
|
82
|
+
var objectFit = {
|
|
83
|
+
name: "objectFit",
|
|
84
|
+
generate: (style, options) => {
|
|
85
|
+
return (0, import_utils.generateRule)(
|
|
86
|
+
style,
|
|
87
|
+
options,
|
|
88
|
+
["dimensions", "objectFit"],
|
|
89
|
+
"objectFit"
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
var dimensions_default = [height, minHeight, minWidth, aspectRatio, width, objectFit];
|
|
83
94
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/styles/dimensions/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { Style, StyleOptions } from '../../types';\nimport { generateRule } from '../utils';\n\nconst height = {\n\tname: 'height',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'dimensions', 'height' ],\n\t\t\t'height'\n\t\t);\n\t},\n};\n\nconst minHeight = {\n\tname: 'minHeight',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'dimensions', 'minHeight' ],\n\t\t\t'minHeight'\n\t\t);\n\t},\n};\n\nconst minWidth = {\n\tname: 'minWidth',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'dimensions', 'minWidth' ],\n\t\t\t'minWidth'\n\t\t);\n\t},\n};\n\nconst aspectRatio = {\n\tname: 'aspectRatio',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'dimensions', 'aspectRatio' ],\n\t\t\t'aspectRatio'\n\t\t);\n\t},\n};\n\nconst width = {\n\tname: 'width',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'dimensions', 'width' ],\n\t\t\t'width'\n\t\t);\n\t},\n};\n\nexport default [ height, minHeight, minWidth, aspectRatio, width ];\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,mBAA6B;AAE7B,IAAM,SAAS;AAAA,EACd,MAAM;AAAA,EACN,UAAU,CAAE,OAAc,YAA2B;AACpD,eAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA,CAAE,cAAc,QAAS;AAAA,MACzB;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,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,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,IAAM,QAAQ;AAAA,EACb,MAAM;AAAA,EACN,UAAU,CAAE,OAAc,YAA2B;AACpD,eAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA,CAAE,cAAc,OAAQ;AAAA,MACxB;AAAA,IACD;AAAA,EACD;AACD;AAEA,IAAO,qBAAQ,CAAE,QAAQ,WAAW,UAAU,aAAa,
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { Style, StyleOptions } from '../../types';\nimport { generateRule } from '../utils';\n\nconst height = {\n\tname: 'height',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'dimensions', 'height' ],\n\t\t\t'height'\n\t\t);\n\t},\n};\n\nconst minHeight = {\n\tname: 'minHeight',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'dimensions', 'minHeight' ],\n\t\t\t'minHeight'\n\t\t);\n\t},\n};\n\nconst minWidth = {\n\tname: 'minWidth',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'dimensions', 'minWidth' ],\n\t\t\t'minWidth'\n\t\t);\n\t},\n};\n\nconst aspectRatio = {\n\tname: 'aspectRatio',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'dimensions', 'aspectRatio' ],\n\t\t\t'aspectRatio'\n\t\t);\n\t},\n};\n\nconst width = {\n\tname: 'width',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'dimensions', 'width' ],\n\t\t\t'width'\n\t\t);\n\t},\n};\n\nconst objectFit = {\n\tname: 'objectFit',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'dimensions', 'objectFit' ],\n\t\t\t'objectFit'\n\t\t);\n\t},\n};\n\nexport default [ height, minHeight, minWidth, aspectRatio, width, objectFit ];\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,mBAA6B;AAE7B,IAAM,SAAS;AAAA,EACd,MAAM;AAAA,EACN,UAAU,CAAE,OAAc,YAA2B;AACpD,eAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA,CAAE,cAAc,QAAS;AAAA,MACzB;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,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,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,IAAM,QAAQ;AAAA,EACb,MAAM;AAAA,EACN,UAAU,CAAE,OAAc,YAA2B;AACpD,eAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA,CAAE,cAAc,OAAQ;AAAA,MACxB;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,IAAO,qBAAQ,CAAE,QAAQ,WAAW,UAAU,aAAa,OAAO,SAAU;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -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,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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AAc,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,\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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\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\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\nexport interface StyleOptions {\n\t/**\n\t * CSS selector for the generated style.\n\t */\n\tselector?: string;\n}\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
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport { paramCase as kebabCase } from 'change-case';\n\n/**\n * Internal dependencies\n */\nimport type {\n\tStyle,\n\tStyleOptions,\n\tGeneratedCSSRule,\n\tStyleDefinition,\n} from './types';\nimport { styleDefinitions } from './styles';\n\n/**\n * Generates a stylesheet for a given style object and selector.\n *\n * @since 6.1.0 Introduced in WordPress core.\n *\n * @param style Style object, for example, the value of a block's attributes.style object or the top level styles in theme.json\n * @param options Options object with settings to adjust how the styles are generated.\n *\n * @return A generated stylesheet or inline style declarations.\n */\nexport function compileCSS( style: Style, options: StyleOptions = {} ): string {\n\tconst rules = getCSSRules( style, options );\n\n\t// If no selector is provided, treat generated rules as inline styles to be returned as a single string.\n\tif ( ! options?.selector ) {\n\t\tconst inlineRules: string[] = [];\n\t\trules.forEach( ( rule ) => {\n\t\t\tinlineRules.push( `${ kebabCase( rule.key ) }: ${ rule.value };` );\n\t\t} );\n\t\treturn inlineRules.join( ' ' );\n\t}\n\n\tconst groupedRules = rules.reduce(\n\t\t( acc: Record< string, GeneratedCSSRule[] >, rule ) => {\n\t\t\tconst { selector } = rule;\n\t\t\tif ( ! selector ) {\n\t\t\t\treturn acc;\n\t\t\t}\n\t\t\tif ( ! acc[ selector ] ) {\n\t\t\t\tacc[ selector ] = [];\n\t\t\t}\n\t\t\tacc[ selector ].push( rule );\n\t\t\treturn acc;\n\t\t},\n\t\t{}\n\t);\n\tconst selectorRules = Object.keys( groupedRules ).reduce(\n\t\t( acc: string[], subSelector: string ) => {\n\t\t\tacc.push(\n\t\t\t\t`${ subSelector } { ${ groupedRules[ subSelector ]\n\t\t\t\t\t.map(\n\t\t\t\t\t\t( rule: GeneratedCSSRule ) =>\n\t\t\t\t\t\t\t`${ kebabCase( rule.key ) }: ${ rule.value };`\n\t\t\t\t\t)\n\t\t\t\t\t.join( ' ' ) } }`\n\t\t\t);\n\t\t\treturn acc;\n\t\t},\n\t\t[]\n\t);\n\n\treturn selectorRules.join( '\\n' );\n}\n\n/**\n * Returns a JSON representation of the generated CSS rules.\n *\n * @since 6.1.0 Introduced in WordPress core.\n *\n * @param style Style object, for example, the value of a block's attributes.style object or the top level styles in theme.json\n * @param options Options object with settings to adjust how the styles are generated.\n *\n * @return A collection of objects containing the selector, if any, the CSS property key (camelcase) and parsed CSS value.\n */\nexport function getCSSRules(\n\tstyle: Style,\n\toptions: StyleOptions = {}\n): GeneratedCSSRule[] {\n\tconst rules: GeneratedCSSRule[] = [];\n\tstyleDefinitions.forEach( ( definition: StyleDefinition ) => {\n\t\tif ( typeof definition.generate === 'function' ) {\n\t\t\trules.push( ...definition.generate( style, options ) );\n\t\t}\n\t} );\n\n\treturn rules;\n}\n\n// Export style utils.\nexport { getCSSValueFromRawStyle } from './styles/utils';\n"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,aAAa,iBAAiB;AAWvC,SAAS,wBAAwB;
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport { paramCase as kebabCase } from 'change-case';\n\n/**\n * Internal dependencies\n */\nimport type {\n\tStyle,\n\tStyleOptions,\n\tGeneratedCSSRule,\n\tStyleDefinition,\n} from './types';\nimport { styleDefinitions } from './styles';\n\n/**\n * A block or theme style object accepted by `compileCSS` and `getCSSRules`.\n */\nexport type { Style } from './types';\n\n/**\n * Options for `compileCSS` and `getCSSRules`.\n */\nexport type { StyleOptions } from './types';\n\n/**\n * A single CSS rule produced by `getCSSRules`.\n */\nexport type { GeneratedCSSRule } from './types';\n\n/**\n * Generates a stylesheet for a given style object and selector.\n *\n * @since 6.1.0 Introduced in WordPress core.\n *\n * @param style Style object, for example, the value of a block's attributes.style object or the top level styles in theme.json\n * @param options Options object with settings to adjust how the styles are generated.\n *\n * @example\n * ```js\n * import { compileCSS } from '@wordpress/style-engine';\n *\n * // With a selector, a full stylesheet string is returned.\n * compileCSS(\n * \t{ spacing: { padding: '10px', margin: '12px' } },\n * \t{ selector: '.my-block' }\n * );\n * // '.my-block { margin: 12px; padding: 10px; }'\n *\n * // Without a selector, inline declarations are returned.\n * compileCSS( { spacing: { padding: '10px', margin: '12px' } } );\n * // 'margin: 12px; padding: 10px;'\n * ```\n *\n * @return A generated stylesheet or inline style declarations.\n */\nexport function compileCSS( style: Style, options: StyleOptions = {} ): string {\n\tconst rules = getCSSRules( style, options );\n\n\t// If no selector is provided, treat generated rules as inline styles to be returned as a single string.\n\tif ( ! options?.selector ) {\n\t\tconst inlineRules: string[] = [];\n\t\trules.forEach( ( rule ) => {\n\t\t\tinlineRules.push( `${ kebabCase( rule.key ) }: ${ rule.value };` );\n\t\t} );\n\t\treturn inlineRules.join( ' ' );\n\t}\n\n\tconst groupedRules = rules.reduce(\n\t\t( acc: Record< string, GeneratedCSSRule[] >, rule ) => {\n\t\t\tconst { selector } = rule;\n\t\t\tif ( ! selector ) {\n\t\t\t\treturn acc;\n\t\t\t}\n\t\t\tif ( ! acc[ selector ] ) {\n\t\t\t\tacc[ selector ] = [];\n\t\t\t}\n\t\t\tacc[ selector ].push( rule );\n\t\t\treturn acc;\n\t\t},\n\t\t{}\n\t);\n\tconst selectorRules = Object.keys( groupedRules ).reduce(\n\t\t( acc: string[], subSelector: string ) => {\n\t\t\tacc.push(\n\t\t\t\t`${ subSelector } { ${ groupedRules[ subSelector ]\n\t\t\t\t\t.map(\n\t\t\t\t\t\t( rule: GeneratedCSSRule ) =>\n\t\t\t\t\t\t\t`${ kebabCase( rule.key ) }: ${ rule.value };`\n\t\t\t\t\t)\n\t\t\t\t\t.join( ' ' ) } }`\n\t\t\t);\n\t\t\treturn acc;\n\t\t},\n\t\t[]\n\t);\n\n\treturn selectorRules.join( '\\n' );\n}\n\n/**\n * Returns a JSON representation of the generated CSS rules.\n *\n * @since 6.1.0 Introduced in WordPress core.\n *\n * @param style Style object, for example, the value of a block's attributes.style object or the top level styles in theme.json\n * @param options Options object with settings to adjust how the styles are generated.\n *\n * @example\n * ```js\n * import { getCSSRules } from '@wordpress/style-engine';\n *\n * getCSSRules(\n * \t{ spacing: { padding: '10px', margin: '12px' } },\n * \t{ selector: '.my-block' }\n * );\n * // [\n * // { selector: '.my-block', key: 'margin', value: '12px' },\n * // { selector: '.my-block', key: 'padding', value: '10px' },\n * // ]\n * ```\n *\n * @return A collection of objects containing the selector, if any, the CSS property key (camelcase) and parsed CSS value.\n */\nexport function getCSSRules(\n\tstyle: Style,\n\toptions: StyleOptions = {}\n): GeneratedCSSRule[] {\n\tconst rules: GeneratedCSSRule[] = [];\n\tstyleDefinitions.forEach( ( definition: StyleDefinition ) => {\n\t\tif ( typeof definition.generate === 'function' ) {\n\t\t\trules.push( ...definition.generate( style, options ) );\n\t\t}\n\t} );\n\n\treturn rules;\n}\n\n// Export style utils.\nexport { getCSSValueFromRawStyle } from './styles/utils';\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,aAAa,iBAAiB;AAWvC,SAAS,wBAAwB;AA8HjC,SAAS,+BAA+B;AAnFjC,SAAS,WAAY,OAAc,UAAwB,CAAC,GAAY;AAC9E,QAAM,QAAQ,YAAa,OAAO,OAAQ;AAG1C,MAAK,CAAE,SAAS,UAAW;AAC1B,UAAM,cAAwB,CAAC;AAC/B,UAAM,QAAS,CAAE,SAAU;AAC1B,kBAAY,KAAM,GAAI,UAAW,KAAK,GAAI,CAAE,KAAM,KAAK,KAAM,GAAI;AAAA,IAClE,CAAE;AACF,WAAO,YAAY,KAAM,GAAI;AAAA,EAC9B;AAEA,QAAM,eAAe,MAAM;AAAA,IAC1B,CAAE,KAA2C,SAAU;AACtD,YAAM,EAAE,SAAS,IAAI;AACrB,UAAK,CAAE,UAAW;AACjB,eAAO;AAAA,MACR;AACA,UAAK,CAAE,IAAK,QAAS,GAAI;AACxB,YAAK,QAAS,IAAI,CAAC;AAAA,MACpB;AACA,UAAK,QAAS,EAAE,KAAM,IAAK;AAC3B,aAAO;AAAA,IACR;AAAA,IACA,CAAC;AAAA,EACF;AACA,QAAM,gBAAgB,OAAO,KAAM,YAAa,EAAE;AAAA,IACjD,CAAE,KAAe,gBAAyB;AACzC,UAAI;AAAA,QACH,GAAI,WAAY,MAAO,aAAc,WAAY,EAC/C;AAAA,UACA,CAAE,SACD,GAAI,UAAW,KAAK,GAAI,CAAE,KAAM,KAAK,KAAM;AAAA,QAC7C,EACC,KAAM,GAAI,CAAE;AAAA,MACf;AACA,aAAO;AAAA,IACR;AAAA,IACA,CAAC;AAAA,EACF;AAEA,SAAO,cAAc,KAAM,IAAK;AACjC;AA0BO,SAAS,YACf,OACA,UAAwB,CAAC,GACJ;AACrB,QAAM,QAA4B,CAAC;AACnC,mBAAiB,QAAS,CAAE,eAAiC;AAC5D,QAAK,OAAO,WAAW,aAAa,YAAa;AAChD,YAAM,KAAM,GAAG,WAAW,SAAU,OAAO,OAAQ,CAAE;AAAA,IACtD;AAAA,EACD,CAAE;AAEF,SAAO;AACR;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -55,7 +55,18 @@ var width = {
|
|
|
55
55
|
);
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
|
-
var
|
|
58
|
+
var objectFit = {
|
|
59
|
+
name: "objectFit",
|
|
60
|
+
generate: (style, options) => {
|
|
61
|
+
return generateRule(
|
|
62
|
+
style,
|
|
63
|
+
options,
|
|
64
|
+
["dimensions", "objectFit"],
|
|
65
|
+
"objectFit"
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
var dimensions_default = [height, minHeight, minWidth, aspectRatio, width, objectFit];
|
|
59
70
|
export {
|
|
60
71
|
dimensions_default as default
|
|
61
72
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/styles/dimensions/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { Style, StyleOptions } from '../../types';\nimport { generateRule } from '../utils';\n\nconst height = {\n\tname: 'height',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'dimensions', 'height' ],\n\t\t\t'height'\n\t\t);\n\t},\n};\n\nconst minHeight = {\n\tname: 'minHeight',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'dimensions', 'minHeight' ],\n\t\t\t'minHeight'\n\t\t);\n\t},\n};\n\nconst minWidth = {\n\tname: 'minWidth',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'dimensions', 'minWidth' ],\n\t\t\t'minWidth'\n\t\t);\n\t},\n};\n\nconst aspectRatio = {\n\tname: 'aspectRatio',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'dimensions', 'aspectRatio' ],\n\t\t\t'aspectRatio'\n\t\t);\n\t},\n};\n\nconst width = {\n\tname: 'width',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'dimensions', 'width' ],\n\t\t\t'width'\n\t\t);\n\t},\n};\n\nexport default [ height, minHeight, minWidth, aspectRatio, width ];\n"],
|
|
5
|
-
"mappings": ";AAIA,SAAS,oBAAoB;AAE7B,IAAM,SAAS;AAAA,EACd,MAAM;AAAA,EACN,UAAU,CAAE,OAAc,YAA2B;AACpD,WAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA,CAAE,cAAc,QAAS;AAAA,MACzB;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,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,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,IAAM,QAAQ;AAAA,EACb,MAAM;AAAA,EACN,UAAU,CAAE,OAAc,YAA2B;AACpD,WAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA,CAAE,cAAc,OAAQ;AAAA,MACxB;AAAA,IACD;AAAA,EACD;AACD;AAEA,IAAO,qBAAQ,CAAE,QAAQ,WAAW,UAAU,aAAa,
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { Style, StyleOptions } from '../../types';\nimport { generateRule } from '../utils';\n\nconst height = {\n\tname: 'height',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'dimensions', 'height' ],\n\t\t\t'height'\n\t\t);\n\t},\n};\n\nconst minHeight = {\n\tname: 'minHeight',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'dimensions', 'minHeight' ],\n\t\t\t'minHeight'\n\t\t);\n\t},\n};\n\nconst minWidth = {\n\tname: 'minWidth',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'dimensions', 'minWidth' ],\n\t\t\t'minWidth'\n\t\t);\n\t},\n};\n\nconst aspectRatio = {\n\tname: 'aspectRatio',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'dimensions', 'aspectRatio' ],\n\t\t\t'aspectRatio'\n\t\t);\n\t},\n};\n\nconst width = {\n\tname: 'width',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'dimensions', 'width' ],\n\t\t\t'width'\n\t\t);\n\t},\n};\n\nconst objectFit = {\n\tname: 'objectFit',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'dimensions', 'objectFit' ],\n\t\t\t'objectFit'\n\t\t);\n\t},\n};\n\nexport default [ height, minHeight, minWidth, aspectRatio, width, objectFit ];\n"],
|
|
5
|
+
"mappings": ";AAIA,SAAS,oBAAoB;AAE7B,IAAM,SAAS;AAAA,EACd,MAAM;AAAA,EACN,UAAU,CAAE,OAAc,YAA2B;AACpD,WAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA,CAAE,cAAc,QAAS;AAAA,MACzB;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,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,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,IAAM,QAAQ;AAAA,EACb,MAAM;AAAA,EACN,UAAU,CAAE,OAAc,YAA2B;AACpD,WAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA,CAAE,cAAc,OAAQ;AAAA,MACxB;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,IAAO,qBAAQ,CAAE,QAAQ,WAAW,UAAU,aAAa,OAAO,SAAU;",
|
|
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,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;A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A,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;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,cAAc;AAAA,EACnB,MAAM;AAAA,EACN,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 +2,18 @@
|
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
4
|
import type { Style, StyleOptions, GeneratedCSSRule } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* A block or theme style object accepted by `compileCSS` and `getCSSRules`.
|
|
7
|
+
*/
|
|
8
|
+
export type { Style } from './types';
|
|
9
|
+
/**
|
|
10
|
+
* Options for `compileCSS` and `getCSSRules`.
|
|
11
|
+
*/
|
|
12
|
+
export type { StyleOptions } from './types';
|
|
13
|
+
/**
|
|
14
|
+
* A single CSS rule produced by `getCSSRules`.
|
|
15
|
+
*/
|
|
16
|
+
export type { GeneratedCSSRule } from './types';
|
|
5
17
|
/**
|
|
6
18
|
* Generates a stylesheet for a given style object and selector.
|
|
7
19
|
*
|
|
@@ -10,6 +22,22 @@ import type { Style, StyleOptions, GeneratedCSSRule } from './types';
|
|
|
10
22
|
* @param style Style object, for example, the value of a block's attributes.style object or the top level styles in theme.json
|
|
11
23
|
* @param options Options object with settings to adjust how the styles are generated.
|
|
12
24
|
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```js
|
|
27
|
+
* import { compileCSS } from '@wordpress/style-engine';
|
|
28
|
+
*
|
|
29
|
+
* // With a selector, a full stylesheet string is returned.
|
|
30
|
+
* compileCSS(
|
|
31
|
+
* { spacing: { padding: '10px', margin: '12px' } },
|
|
32
|
+
* { selector: '.my-block' }
|
|
33
|
+
* );
|
|
34
|
+
* // '.my-block { margin: 12px; padding: 10px; }'
|
|
35
|
+
*
|
|
36
|
+
* // Without a selector, inline declarations are returned.
|
|
37
|
+
* compileCSS( { spacing: { padding: '10px', margin: '12px' } } );
|
|
38
|
+
* // 'margin: 12px; padding: 10px;'
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
13
41
|
* @return A generated stylesheet or inline style declarations.
|
|
14
42
|
*/
|
|
15
43
|
export declare function compileCSS(style: Style, options?: StyleOptions): string;
|
|
@@ -21,6 +49,20 @@ export declare function compileCSS(style: Style, options?: StyleOptions): string
|
|
|
21
49
|
* @param style Style object, for example, the value of a block's attributes.style object or the top level styles in theme.json
|
|
22
50
|
* @param options Options object with settings to adjust how the styles are generated.
|
|
23
51
|
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```js
|
|
54
|
+
* import { getCSSRules } from '@wordpress/style-engine';
|
|
55
|
+
*
|
|
56
|
+
* getCSSRules(
|
|
57
|
+
* { spacing: { padding: '10px', margin: '12px' } },
|
|
58
|
+
* { selector: '.my-block' }
|
|
59
|
+
* );
|
|
60
|
+
* // [
|
|
61
|
+
* // { selector: '.my-block', key: 'margin', value: '12px' },
|
|
62
|
+
* // { selector: '.my-block', key: 'padding', value: '10px' },
|
|
63
|
+
* // ]
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
24
66
|
* @return A collection of objects containing the selector, if any, the CSS property key (camelcase) and parsed CSS value.
|
|
25
67
|
*/
|
|
26
68
|
export declare function getCSSRules(style: Style, options?: StyleOptions): GeneratedCSSRule[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EACX,KAAK,EACL,YAAY,EACZ,gBAAgB,EAEhB,MAAM,SAAS,CAAC;AAGjB
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EACX,KAAK,EACL,YAAY,EACZ,gBAAgB,EAEhB,MAAM,SAAS,CAAC;AAGjB;;GAEG;AACH,YAAY,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAErC;;GAEG;AACH,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C;;GAEG;AACH,YAAY,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,UAAU,CAAE,KAAK,EAAE,KAAK,EAAE,OAAO,GAAE,YAAiB,GAAI,MAAM,CA0C7E;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,WAAW,CAC1B,KAAK,EAAE,KAAK,EACZ,OAAO,GAAE,YAAiB,GACxB,gBAAgB,EAAE,CASpB;AAGD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import type { Style, StyleOptions } from '../../types';
|
|
5
5
|
declare const _default: {
|
|
6
6
|
name: string;
|
|
7
|
-
generate: (style: Style, options: StyleOptions) => import("
|
|
7
|
+
generate: (style: Style, options: StyleOptions) => import("../..").GeneratedCSSRule[];
|
|
8
8
|
}[];
|
|
9
9
|
export default _default;
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import type { Style, StyleOptions } from '../../types';
|
|
5
5
|
declare const background: {
|
|
6
6
|
name: string;
|
|
7
|
-
generate: (style: Style, options: StyleOptions) => import("
|
|
7
|
+
generate: (style: Style, options: StyleOptions) => import("../..").GeneratedCSSRule[];
|
|
8
8
|
};
|
|
9
9
|
export default background;
|
|
10
10
|
//# sourceMappingURL=background.d.ts.map
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import type { Style, StyleOptions } from '../../types';
|
|
5
5
|
declare const gradient: {
|
|
6
6
|
name: string;
|
|
7
|
-
generate: (style: Style, options: StyleOptions) => import("
|
|
7
|
+
generate: (style: Style, options: StyleOptions) => import("../..").GeneratedCSSRule[];
|
|
8
8
|
};
|
|
9
9
|
export default gradient;
|
|
10
10
|
//# sourceMappingURL=gradient.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
2
|
name: string;
|
|
3
|
-
generate: (style: import("
|
|
3
|
+
generate: (style: import("../..").Style, options: import("../..").StyleOptions) => import("../..").GeneratedCSSRule[];
|
|
4
4
|
}[];
|
|
5
5
|
export default _default;
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import type { Style, StyleOptions } from '../../types';
|
|
5
5
|
declare const text: {
|
|
6
6
|
name: string;
|
|
7
|
-
generate: (style: Style, options: StyleOptions) => import("
|
|
7
|
+
generate: (style: Style, options: StyleOptions) => import("../..").GeneratedCSSRule[];
|
|
8
8
|
};
|
|
9
9
|
export default text;
|
|
10
10
|
//# sourceMappingURL=text.d.ts.map
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import type { Style, StyleOptions } from '../../types';
|
|
5
5
|
declare const _default: {
|
|
6
6
|
name: string;
|
|
7
|
-
generate: (style: Style, options: StyleOptions) => import("
|
|
7
|
+
generate: (style: Style, options: StyleOptions) => import("../..").GeneratedCSSRule[];
|
|
8
8
|
}[];
|
|
9
9
|
export default _default;
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const styleDefinitions: (import("../types").StyleDefinition | {
|
|
2
2
|
name: string;
|
|
3
|
-
generate: (style: import("
|
|
3
|
+
generate: (style: import("..").Style, options: import("..").StyleOptions, path?: string[], ruleKey?: string) => import("..").GeneratedCSSRule[];
|
|
4
4
|
})[];
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import type { Style, StyleOptions } from '../../types';
|
|
5
5
|
declare const _default: {
|
|
6
6
|
name: string;
|
|
7
|
-
generate: (style: Style, options: StyleOptions) => import("
|
|
7
|
+
generate: (style: Style, options: StyleOptions) => import("../..").GeneratedCSSRule[];
|
|
8
8
|
}[];
|
|
9
9
|
export default _default;
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
2
|
name: string;
|
|
3
|
-
generate: (style: import("
|
|
3
|
+
generate: (style: import("../..").Style, options: import("../..").StyleOptions) => import("../..").GeneratedCSSRule[];
|
|
4
4
|
}[];
|
|
5
5
|
export default _default;
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import type { Style, StyleOptions } from '../../types';
|
|
5
5
|
declare const margin: {
|
|
6
6
|
name: string;
|
|
7
|
-
generate: (style: Style, options: StyleOptions) => import("
|
|
7
|
+
generate: (style: Style, options: StyleOptions) => import("../..").GeneratedCSSRule[];
|
|
8
8
|
};
|
|
9
9
|
export default margin;
|
|
10
10
|
//# sourceMappingURL=margin.d.ts.map
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import type { Style, StyleOptions } from '../../types';
|
|
5
5
|
declare const padding: {
|
|
6
6
|
name: string;
|
|
7
|
-
generate: (style: Style, options: StyleOptions) => import("
|
|
7
|
+
generate: (style: Style, options: StyleOptions) => import("../..").GeneratedCSSRule[];
|
|
8
8
|
};
|
|
9
9
|
export default padding;
|
|
10
10
|
//# sourceMappingURL=padding.d.ts.map
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import type { Style, StyleOptions } from '../../types';
|
|
5
5
|
declare const _default: {
|
|
6
6
|
name: string;
|
|
7
|
-
generate: (style: Style, options: StyleOptions) => import("
|
|
7
|
+
generate: (style: Style, options: StyleOptions) => import("../..").GeneratedCSSRule[];
|
|
8
8
|
}[];
|
|
9
9
|
export default _default;
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
package/build-types/types.d.ts
CHANGED
|
@@ -15,6 +15,12 @@ export interface BorderIndividualStyles<T extends BoxEdge> {
|
|
|
15
15
|
style?: CSSProperties[`border${Capitalize<T>}Style`];
|
|
16
16
|
width?: CSSProperties[`border${Capitalize<T>}Width`];
|
|
17
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* A style object — for example a block's `attributes.style` or the top-level
|
|
20
|
+
* styles in `theme.json`. Groups visual style properties such as color,
|
|
21
|
+
* typography, spacing, dimensions, borders, backgrounds and element styles,
|
|
22
|
+
* and is the input `compileCSS` and `getCSSRules` turn into CSS.
|
|
23
|
+
*/
|
|
18
24
|
export interface Style {
|
|
19
25
|
background?: {
|
|
20
26
|
backgroundImage?: {
|
|
@@ -46,6 +52,7 @@ export interface Style {
|
|
|
46
52
|
height?: CSSProperties['height'];
|
|
47
53
|
minHeight?: CSSProperties['minHeight'];
|
|
48
54
|
minWidth?: CSSProperties['minWidth'];
|
|
55
|
+
objectFit?: CSSProperties['objectFit'];
|
|
49
56
|
width?: CSSProperties['width'];
|
|
50
57
|
};
|
|
51
58
|
spacing?: {
|
|
@@ -61,6 +68,7 @@ export interface Style {
|
|
|
61
68
|
lineHeight?: CSSProperties['lineHeight'];
|
|
62
69
|
textColumns?: CSSProperties['columnCount'];
|
|
63
70
|
textDecoration?: CSSProperties['textDecoration'];
|
|
71
|
+
textShadow?: CSSProperties['textShadow'];
|
|
64
72
|
textTransform?: CSSProperties['textTransform'];
|
|
65
73
|
writingMode?: CSSProperties['writingMode'];
|
|
66
74
|
};
|
|
@@ -81,12 +89,21 @@ export interface CssRulesKeys {
|
|
|
81
89
|
default: string;
|
|
82
90
|
individual: string;
|
|
83
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* Options that adjust how styles are generated — notably the CSS `selector` to
|
|
94
|
+
* scope the output to. With no selector, declarations are returned inline.
|
|
95
|
+
*/
|
|
84
96
|
export interface StyleOptions {
|
|
85
97
|
/**
|
|
86
98
|
* CSS selector for the generated style.
|
|
87
99
|
*/
|
|
88
100
|
selector?: string;
|
|
89
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* A single generated CSS rule: an optional `selector`, the `value`, and the
|
|
104
|
+
* `key` in React/JS style-attribute format (e.g. `paddingTop` rather than
|
|
105
|
+
* `padding-top`).
|
|
106
|
+
*/
|
|
90
107
|
export interface GeneratedCSSRule {
|
|
91
108
|
selector?: string;
|
|
92
109
|
value: string | unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/style-engine",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.49.0",
|
|
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",
|
|
@@ -64,11 +64,18 @@
|
|
|
64
64
|
"types": "build-types",
|
|
65
65
|
"sideEffects": false,
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@types/react": "^18.3.27",
|
|
68
67
|
"change-case": "^4.1.2"
|
|
69
68
|
},
|
|
69
|
+
"peerDependencies": {
|
|
70
|
+
"@types/react": "^18.3.27"
|
|
71
|
+
},
|
|
72
|
+
"peerDependenciesMeta": {
|
|
73
|
+
"@types/react": {
|
|
74
|
+
"optional": true
|
|
75
|
+
}
|
|
76
|
+
},
|
|
70
77
|
"publishConfig": {
|
|
71
78
|
"access": "public"
|
|
72
79
|
},
|
|
73
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "0e7112a4f4fde4ea15bd9060489b8f6fe11eb6ca"
|
|
74
81
|
}
|
|
@@ -237,6 +237,12 @@ if ( ! class_exists( 'WP_Style_Engine' ) ) {
|
|
|
237
237
|
'dimension' => '--wp--preset--dimension--$slug',
|
|
238
238
|
),
|
|
239
239
|
),
|
|
240
|
+
'objectFit' => array(
|
|
241
|
+
'property_keys' => array(
|
|
242
|
+
'default' => 'object-fit',
|
|
243
|
+
),
|
|
244
|
+
'path' => array( 'dimensions', 'objectFit' ),
|
|
245
|
+
),
|
|
240
246
|
'width' => array(
|
|
241
247
|
'property_keys' => array(
|
|
242
248
|
'default' => 'width',
|
|
@@ -330,6 +336,12 @@ if ( ! class_exists( 'WP_Style_Engine' ) ) {
|
|
|
330
336
|
),
|
|
331
337
|
'path' => array( 'typography', 'textIndent' ),
|
|
332
338
|
),
|
|
339
|
+
'textShadow' => array(
|
|
340
|
+
'property_keys' => array(
|
|
341
|
+
'default' => 'text-shadow',
|
|
342
|
+
),
|
|
343
|
+
'path' => array( 'typography', 'textShadow' ),
|
|
344
|
+
),
|
|
333
345
|
'textTransform' => array(
|
|
334
346
|
'property_keys' => array(
|
|
335
347
|
'default' => 'text-transform',
|
package/src/index.ts
CHANGED
|
@@ -14,6 +14,21 @@ import type {
|
|
|
14
14
|
} from './types';
|
|
15
15
|
import { styleDefinitions } from './styles';
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* A block or theme style object accepted by `compileCSS` and `getCSSRules`.
|
|
19
|
+
*/
|
|
20
|
+
export type { Style } from './types';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Options for `compileCSS` and `getCSSRules`.
|
|
24
|
+
*/
|
|
25
|
+
export type { StyleOptions } from './types';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* A single CSS rule produced by `getCSSRules`.
|
|
29
|
+
*/
|
|
30
|
+
export type { GeneratedCSSRule } from './types';
|
|
31
|
+
|
|
17
32
|
/**
|
|
18
33
|
* Generates a stylesheet for a given style object and selector.
|
|
19
34
|
*
|
|
@@ -22,6 +37,22 @@ import { styleDefinitions } from './styles';
|
|
|
22
37
|
* @param style Style object, for example, the value of a block's attributes.style object or the top level styles in theme.json
|
|
23
38
|
* @param options Options object with settings to adjust how the styles are generated.
|
|
24
39
|
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```js
|
|
42
|
+
* import { compileCSS } from '@wordpress/style-engine';
|
|
43
|
+
*
|
|
44
|
+
* // With a selector, a full stylesheet string is returned.
|
|
45
|
+
* compileCSS(
|
|
46
|
+
* { spacing: { padding: '10px', margin: '12px' } },
|
|
47
|
+
* { selector: '.my-block' }
|
|
48
|
+
* );
|
|
49
|
+
* // '.my-block { margin: 12px; padding: 10px; }'
|
|
50
|
+
*
|
|
51
|
+
* // Without a selector, inline declarations are returned.
|
|
52
|
+
* compileCSS( { spacing: { padding: '10px', margin: '12px' } } );
|
|
53
|
+
* // 'margin: 12px; padding: 10px;'
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
25
56
|
* @return A generated stylesheet or inline style declarations.
|
|
26
57
|
*/
|
|
27
58
|
export function compileCSS( style: Style, options: StyleOptions = {} ): string {
|
|
@@ -76,6 +107,20 @@ export function compileCSS( style: Style, options: StyleOptions = {} ): string {
|
|
|
76
107
|
* @param style Style object, for example, the value of a block's attributes.style object or the top level styles in theme.json
|
|
77
108
|
* @param options Options object with settings to adjust how the styles are generated.
|
|
78
109
|
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```js
|
|
112
|
+
* import { getCSSRules } from '@wordpress/style-engine';
|
|
113
|
+
*
|
|
114
|
+
* getCSSRules(
|
|
115
|
+
* { spacing: { padding: '10px', margin: '12px' } },
|
|
116
|
+
* { selector: '.my-block' }
|
|
117
|
+
* );
|
|
118
|
+
* // [
|
|
119
|
+
* // { selector: '.my-block', key: 'margin', value: '12px' },
|
|
120
|
+
* // { selector: '.my-block', key: 'padding', value: '10px' },
|
|
121
|
+
* // ]
|
|
122
|
+
* ```
|
|
123
|
+
*
|
|
79
124
|
* @return A collection of objects containing the selector, if any, the CSS property key (camelcase) and parsed CSS value.
|
|
80
125
|
*/
|
|
81
126
|
export function getCSSRules(
|
|
@@ -64,4 +64,16 @@ const width = {
|
|
|
64
64
|
},
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
const objectFit = {
|
|
68
|
+
name: 'objectFit',
|
|
69
|
+
generate: ( style: Style, options: StyleOptions ) => {
|
|
70
|
+
return generateRule(
|
|
71
|
+
style,
|
|
72
|
+
options,
|
|
73
|
+
[ 'dimensions', 'objectFit' ],
|
|
74
|
+
'objectFit'
|
|
75
|
+
);
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export default [ height, minHeight, minWidth, aspectRatio, width, objectFit ];
|
|
@@ -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
|
@@ -57,6 +57,7 @@ describe( 'generate', () => {
|
|
|
57
57
|
dimensions: {
|
|
58
58
|
minHeight: '50vh',
|
|
59
59
|
minWidth: '25vw',
|
|
60
|
+
objectFit: 'cover',
|
|
60
61
|
},
|
|
61
62
|
spacing: {
|
|
62
63
|
padding: { top: '10px', bottom: '5px' },
|
|
@@ -75,6 +76,7 @@ describe( 'generate', () => {
|
|
|
75
76
|
lineHeight: '3.3',
|
|
76
77
|
textColumns: '2',
|
|
77
78
|
textDecoration: 'line-through',
|
|
79
|
+
textShadow: '1px 1px 2px red',
|
|
78
80
|
letterSpacing: '12px',
|
|
79
81
|
textTransform: 'uppercase',
|
|
80
82
|
},
|
|
@@ -90,7 +92,7 @@ describe( 'generate', () => {
|
|
|
90
92
|
}
|
|
91
93
|
)
|
|
92
94
|
).toEqual(
|
|
93
|
-
".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; 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; }"
|
|
94
96
|
);
|
|
95
97
|
} );
|
|
96
98
|
|
|
@@ -256,6 +258,7 @@ describe( 'getCSSRules', () => {
|
|
|
256
258
|
lineHeight: '3.3',
|
|
257
259
|
textColumns: '2',
|
|
258
260
|
textDecoration: 'line-through',
|
|
261
|
+
textShadow: '1px 1px 2px red',
|
|
259
262
|
letterSpacing: '12px',
|
|
260
263
|
textTransform: 'uppercase',
|
|
261
264
|
},
|
|
@@ -377,6 +380,11 @@ describe( 'getCSSRules', () => {
|
|
|
377
380
|
key: 'textDecoration',
|
|
378
381
|
value: 'line-through',
|
|
379
382
|
},
|
|
383
|
+
{
|
|
384
|
+
selector: '.some-selector',
|
|
385
|
+
key: 'textShadow',
|
|
386
|
+
value: '1px 1px 2px red',
|
|
387
|
+
},
|
|
380
388
|
{
|
|
381
389
|
selector: '.some-selector',
|
|
382
390
|
key: 'textTransform',
|
package/src/types.ts
CHANGED
|
@@ -20,6 +20,12 @@ export interface BorderIndividualStyles< T extends BoxEdge > {
|
|
|
20
20
|
width?: CSSProperties[ `border${ Capitalize< T > }Width` ];
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* A style object — for example a block's `attributes.style` or the top-level
|
|
25
|
+
* styles in `theme.json`. Groups visual style properties such as color,
|
|
26
|
+
* typography, spacing, dimensions, borders, backgrounds and element styles,
|
|
27
|
+
* and is the input `compileCSS` and `getCSSRules` turn into CSS.
|
|
28
|
+
*/
|
|
23
29
|
export interface Style {
|
|
24
30
|
background?: {
|
|
25
31
|
backgroundImage?:
|
|
@@ -52,6 +58,7 @@ export interface Style {
|
|
|
52
58
|
height?: CSSProperties[ 'height' ];
|
|
53
59
|
minHeight?: CSSProperties[ 'minHeight' ];
|
|
54
60
|
minWidth?: CSSProperties[ 'minWidth' ];
|
|
61
|
+
objectFit?: CSSProperties[ 'objectFit' ];
|
|
55
62
|
width?: CSSProperties[ 'width' ];
|
|
56
63
|
};
|
|
57
64
|
spacing?: {
|
|
@@ -67,6 +74,7 @@ export interface Style {
|
|
|
67
74
|
lineHeight?: CSSProperties[ 'lineHeight' ];
|
|
68
75
|
textColumns?: CSSProperties[ 'columnCount' ];
|
|
69
76
|
textDecoration?: CSSProperties[ 'textDecoration' ];
|
|
77
|
+
textShadow?: CSSProperties[ 'textShadow' ];
|
|
70
78
|
textTransform?: CSSProperties[ 'textTransform' ];
|
|
71
79
|
writingMode?: CSSProperties[ 'writingMode' ];
|
|
72
80
|
};
|
|
@@ -89,6 +97,10 @@ export interface CssRulesKeys {
|
|
|
89
97
|
individual: string;
|
|
90
98
|
}
|
|
91
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Options that adjust how styles are generated — notably the CSS `selector` to
|
|
102
|
+
* scope the output to. With no selector, declarations are returned inline.
|
|
103
|
+
*/
|
|
92
104
|
export interface StyleOptions {
|
|
93
105
|
/**
|
|
94
106
|
* CSS selector for the generated style.
|
|
@@ -96,6 +108,11 @@ export interface StyleOptions {
|
|
|
96
108
|
selector?: string;
|
|
97
109
|
}
|
|
98
110
|
|
|
111
|
+
/**
|
|
112
|
+
* A single generated CSS rule: an optional `selector`, the `value`, and the
|
|
113
|
+
* `key` in React/JS style-attribute format (e.g. `paddingTop` rather than
|
|
114
|
+
* `padding-top`).
|
|
115
|
+
*/
|
|
99
116
|
export interface GeneratedCSSRule {
|
|
100
117
|
selector?: string;
|
|
101
118
|
value: string | unknown;
|