@wordpress/style-engine 2.48.0 → 2.49.1-next.v.202606191442.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,7 +2,19 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
- ## 2.48.0 (2026-06-04)
5
+ ## 2.49.0-next.0 (2026-06-19)
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
+
11
+ ## 2.48.1 (2026-06-16)
12
+
13
+ ## 2.48.0 (2026-06-10)
14
+
15
+ ### Code Quality
16
+
17
+ - Add missing `@types/react` dependency. [#78882](https://github.com/WordPress/gutenberg/pull/78882).
6
18
 
7
19
  ## 2.47.0 (2026-05-27)
8
20
 
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
@@ -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;AA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/**\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": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,yBAAuC;AAWvC,oBA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names": ["kebabCase"]
7
7
  }
@@ -79,5 +79,16 @@ var width = {
79
79
  );
80
80
  }
81
81
  };
82
- var dimensions_default = [height, minHeight, minWidth, aspectRatio, width];
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,KAAM;",
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
  }
@@ -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\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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;AAAA,IACtD;AAAA,EACD,CAAE;AAEF,SAAO;AACR;",
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,iBAAi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
6
6
  "names": []
7
7
  }
@@ -55,7 +55,18 @@ var width = {
55
55
  );
56
56
  }
57
57
  };
58
- var dimensions_default = [height, minHeight, minWidth, aspectRatio, width];
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,KAAM;",
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
  }
@@ -2,6 +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;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAE,KAAK,EAAE,KAAK,EAAE,OAAO,GAAE,YAAiB,GAAI,MAAM,CA0C7E;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAC1B,KAAK,EAAE,KAAK,EACZ,OAAO,GAAE,YAAiB,GACxB,gBAAgB,EAAE,CASpB;AAGD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC"}
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("../../types").GeneratedCSSRule[];
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("../../types").GeneratedCSSRule[];
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("../../types").GeneratedCSSRule[];
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("../../types").Style, options: import("../../types").StyleOptions) => import("../../types").GeneratedCSSRule[];
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("../../types").GeneratedCSSRule[];
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("../../types").GeneratedCSSRule[];
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("../types").Style, options: import("../types").StyleOptions, path?: string[], ruleKey?: string) => import("../types").GeneratedCSSRule[];
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("../../types").GeneratedCSSRule[];
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("../../types").Style, options: import("../../types").StyleOptions) => import("../../types").GeneratedCSSRule[];
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("../../types").GeneratedCSSRule[];
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("../../types").GeneratedCSSRule[];
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("../../types").GeneratedCSSRule[];
7
+ generate: (style: Style, options: StyleOptions) => import("../..").GeneratedCSSRule[];
8
8
  }[];
9
9
  export default _default;
10
10
  //# sourceMappingURL=index.d.ts.map
@@ -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?: {
@@ -81,12 +88,21 @@ export interface CssRulesKeys {
81
88
  default: string;
82
89
  individual: string;
83
90
  }
91
+ /**
92
+ * Options that adjust how styles are generated — notably the CSS `selector` to
93
+ * scope the output to. With no selector, declarations are returned inline.
94
+ */
84
95
  export interface StyleOptions {
85
96
  /**
86
97
  * CSS selector for the generated style.
87
98
  */
88
99
  selector?: string;
89
100
  }
101
+ /**
102
+ * A single generated CSS rule: an optional `selector`, the `value`, and the
103
+ * `key` in React/JS style-attribute format (e.g. `paddingTop` rather than
104
+ * `padding-top`).
105
+ */
90
106
  export interface GeneratedCSSRule {
91
107
  selector?: string;
92
108
  value: string | unknown;
@@ -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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WAAW,CAAC,EAAE,aAAa,CAAE,aAAa,CAAE,CAAC;KAC7C,CAAC;IACF,KAAK,CAAC,EAAE;QACP,IAAI,CAAC,EAAE,aAAa,CAAE,OAAO,CAAE,CAAC;QAChC,UAAU,CAAC,EAAE,aAAa,CAAE,iBAAiB,CAAE,CAAC;QAChD,QAAQ,CAAC,EAAE,aAAa,CAAE,YAAY,CAAE,CAAC;KACzC,CAAC;IACF,QAAQ,CAAC,EAAE;QACV,IAAI,CAAC,EAAE;YACN,KAAK,CAAC,EAAE;gBACP,IAAI,CAAC,EAAE,aAAa,CAAE,OAAO,CAAE,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.48.0",
3
+ "version": "2.49.1-next.v.202606191442.0+17fe7db8a",
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",
@@ -41,7 +41,6 @@
41
41
  },
42
42
  "./package.json": "./package.json"
43
43
  },
44
- "react-native": "src/index",
45
44
  "wpScript": true,
46
45
  "wpCopyFiles": {
47
46
  "files": [
@@ -67,8 +66,16 @@
67
66
  "dependencies": {
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": "e7856693aeb4e2522d13608cd32c994e4a97cb9c"
80
+ "gitHead": "1b6a19222df5a88f161880b5789efb3171d8f425"
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',
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
- export default [ height, minHeight, minWidth, aspectRatio, width ];
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 ];
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' },
@@ -90,7 +91,7 @@ describe( 'generate', () => {
90
91
  }
91
92
  )
92
93
  ).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; }"
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; }"
94
95
  );
95
96
  } );
96
97
 
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?: {
@@ -89,6 +96,10 @@ export interface CssRulesKeys {
89
96
  individual: string;
90
97
  }
91
98
 
99
+ /**
100
+ * Options that adjust how styles are generated — notably the CSS `selector` to
101
+ * scope the output to. With no selector, declarations are returned inline.
102
+ */
92
103
  export interface StyleOptions {
93
104
  /**
94
105
  * CSS selector for the generated style.
@@ -96,6 +107,11 @@ export interface StyleOptions {
96
107
  selector?: string;
97
108
  }
98
109
 
110
+ /**
111
+ * A single generated CSS rule: an optional `selector`, the `value`, and the
112
+ * `key` in React/JS style-attribute format (e.g. `paddingTop` rather than
113
+ * `padding-top`).
114
+ */
99
115
  export interface GeneratedCSSRule {
100
116
  selector?: string;
101
117
  value: string | unknown;