API / Minn\Blocks / Styles

Styles final class

Minn\Blocks\Styles · public/minn/src/Minn/Blocks/Styles.php · 155 lines

The inline style and class names a block's "style" and preset attributes produce at render time, for the dynamic blocks that build their own wrapper (static blocks already carry them in stored markup).

Constants and properties

privateSIDES = array ( 0 => 'top', 1 => 'right', 2 => 'bottom', 3 => 'left', )

Public

staticvalue(string $value): string#

var:preset|spacing|40 becomes var(--wp--preset--spacing--40). A value that could close a declaration or a style element, or carry code, is dropped: these values come from stored block attributes.

staticslug(string $value): string#

A class-name token from an attribute: letters, digits, dashes, underscores; nothing that ends an attribute.

staticinline(array $style): string#

The style attribute's declarations. The reference emits the style groups in a fixed order (border, colour, typography, spacing, dimensions) and most properties in a fixed order within a group, but a spacing box's sides come out as the block stored them.

staticclasses(array $attrs): array#

The preset classes (font size, text alignment, custom class names) a block's attributes declare.

staticalign(array $attrs): ?string#

The align class an "align" attribute declares.

Internals 5

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privateborderDeclarations(array $border, array $declarations): void#
$declarationslist<string>
privatecolorDeclarations(array $color, array $declarations): void#
$declarationslist<string>
privatespacingDeclarations(array $spacing, array $declarations): void#
$declarationslist<string>
privatetypographyDeclarations(array $typography, array $declarations): void#
$declarationslist<string>
privatedimensionDeclarations(array $dimensions, array $declarations): void#
$declarationslist<string>