API / Minn\Theme / SpacingScale

SpacingScale final class

Minn\Theme\SpacingScale · public/minn/src/Minn/Theme/SpacingScale.php · 48 lines

The spacing sizes a theme.json spacing scale makes (probe theme-json-css): Medium (slug 50) at the medium step; below it, half the other steps rounded down, each divided by (or less) the increment, named Small, X-Small, 2X-Small; above it the rest, multiplied by (or plus) it, named Large, X-Large, 2X-Large; slugs ten apart, values rounded to two places. An invalid scale makes none.

Public

staticsizes(array $scale): array#

The sizes the scale makes, smallest first.

$scalearray<string, mixed>operator, increment, steps, mediumStep, unit
@return list<array{name: string, slug: string, size: string}>

Internals 2

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

privatename(int $distance, string $side): string#

Small, X-Small, 2X-Small, and so on (Large likewise).

privateformat(float $value, string $unit): string#