[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/style-engine/ -> class-wp-style-engine.php (summary)

Style Engine: WP_Style_Engine class

File Size: 744 lines (28 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 12 functions

  get_slug_from_preset_value()
  get_css_var_value()
  is_valid_style_value()
  store_css_rule()
  get_store()
  parse_block_styles()
  get_classnames()
  get_css_declarations()
  get_individual_property_css_declarations()
  get_url_or_value_css_declaration()
  compile_css()
  compile_stylesheet_from_css_rules()

Functions
Functions that are not part of a class:

get_slug_from_preset_value( $style_value, $property_key )   X-Ref
Util: Extracts the slug in kebab case from a preset string,
e.g. `heavenly-blue` from `var:preset|color|heavenlyBlue`.

return: string The slug, or empty string if not found.
param: string $style_value  A single CSS preset value.
param: string $property_key The CSS property that is the second element of the preset string.

get_css_var_value( $style_value, $css_vars )   X-Ref
Util: Generates a CSS var string, e.g. `var(--wp--preset--color--background)`
from a preset string such as `var:preset|space|50`.

return: string The CSS var, or an empty string if no match for slug found.
param: string   $style_value  A single CSS preset value.
param: string[] $css_vars     An associate array of CSS var patterns

is_valid_style_value( $style_value )   X-Ref
Util: Checks whether an incoming block style value is valid.

return: bool
param: string $style_value A single CSS preset value.

store_css_rule( $store_name, $css_selector, $css_declarations, $rules_group = '' )   X-Ref
Stores a CSS rule using the provided CSS selector and CSS declarations.

param: string   $store_name       A valid store key.
param: string   $css_selector     When a selector is passed, the function will return
param: string[] $css_declarations An associative array of CSS definitions,
param: string $rules_group        Optional. A parent CSS selector in the case of nested CSS, or a CSS nested @rule,

get_store( $store_name )   X-Ref
Returns a store by store key.

return: WP_Style_Engine_CSS_Rules_Store|null
param: string $store_name A store key.

parse_block_styles( $block_styles, $options )   X-Ref
Returns classnames and CSS based on the values in a styles object.

Return values are parsed based on the instructions in BLOCK_STYLE_DEFINITIONS_METADATA.

return: array {
param: array $block_styles The style object.
param: array $options      {

get_classnames( $style_value, $style_definition )   X-Ref
Returns classnames, and generates classname(s) from a CSS preset property pattern,
e.g. `var:preset|<PRESET_TYPE>|<PRESET_SLUG>`.

return: string[] An array of CSS classnames, or empty array if there are none.
param: string $style_value      A single raw style value or CSS preset property
param: array  $style_definition A single style definition from BLOCK_STYLE_DEFINITIONS_METADATA.

get_css_declarations( $style_value, $style_definition, $options = array()   X-Ref
Returns an array of CSS declarations based on valid block style values.

return: string[] An associative array of CSS definitions, e.g. `array( "$property" => "$value", "$property" => "$value" )`.
param: mixed $style_value      A single raw style value from $block_styles array.
param: array $style_definition A single style definition from BLOCK_STYLE_DEFINITIONS_METADATA.
param: array $options          {

get_individual_property_css_declarations( $style_value, $individual_property_definition, $options = array()   X-Ref
Style value parser that returns a CSS definition array comprising style properties
that have keys representing individual style properties, otherwise known as longhand CSS properties.

Example:

"$style_property-$individual_feature: $value;"

Which could represent the following:

"border-{top|right|bottom|left}-{color|width|style}: {value};"

or:

"border-image-{outset|source|width|repeat|slice}: {value};"

return: string[] An associative array of CSS definitions, e.g. `array( "$property" => "$value", "$property" => "$value" )`.
param: array $style_value                    A single raw style value from `$block_styles` array.
param: array $individual_property_definition A single style definition from BLOCK_STYLE_DEFINITIONS_METADATA
param: array $options                        {

get_url_or_value_css_declaration( $style_value, $style_definition )   X-Ref
Style value parser that constructs a CSS definition array comprising a single CSS property and value.
If the provided value is an array containing a `url` property, the function will return a CSS definition array
with a single property and value, with `url` escaped and injected into a CSS `url()` function,
e.g., array( 'background-image' => "url( '...' )" ).

return: string[] An associative array of CSS definitions, e.g., array( "$property" => "$value", "$property" => "$value" ).
param: array $style_value      A single raw style value from $block_styles array.
param: array $style_definition A single style definition from BLOCK_STYLE_DEFINITIONS_METADATA.

compile_css( $css_declarations, $css_selector )   X-Ref
Returns compiled CSS from CSS declarations.

return: string A compiled CSS string.
param: string[] $css_declarations An associative array of CSS definitions,
param: string   $css_selector     When a selector is passed, the function will return

compile_stylesheet_from_css_rules( $css_rules, $options = array()   X-Ref
Returns a compiled stylesheet from stored CSS rules.

return: string A compiled stylesheet from stored CSS rules.
param: WP_Style_Engine_CSS_Rule[] $css_rules An array of WP_Style_Engine_CSS_Rule objects
param: array                      $options   {



Generated : Sat Dec 21 08:20:01 2024 Cross-referenced by PHPXref