HasPresets
trait HasPresets
Trait HasPresets.
The core logic for Beartropy's design system resolution. Calculates sizes, colors, variants, and other props based on configuration tables.
Methods
array{0: array, 1: array, 2: bool, 3: array}
getComponentPresets(string|null $componentName = null, ComponentAttributeBag|null $attributes = null)
compute component presets based on context.
array
loadPresets(string $componentName)
No description
array
loadComponentDefaults(string $componentName)
No description
bool
detectHasVariants(array $colors)
No description
array
computeSupports(array $sizes, array $colorsArray, array $defaults, array $magicProps)
No description
array
resolveSize(array $supports, array $sizes, array $defaults, array $magicProps)
No description
array
resolveVariant(array $supports, array $colorsArray, array $componentPresets, array $defaults, array $magicProps, bool $hasVariants)
No description
array
resolveColor(array $supports, array $colorsArray, array $componentPresets, array $defaults, array $magicProps, string|null $variant, bool $hasVariants)
No description
array
resolveFill(array $supports, array $attributes, array $defaults)
No description
string
buildCacheKey(string $component, array $supports, string|null $size, string|null $variant, string|null $color, bool $shouldFill)
No description
void
syncInstanceProps(array $supports, string|null $size, string|null $variant, string|null $color)
No description
array
buildPresetNames(array $supports, string|null $size, string|null $variant, string|null $color, bool $shouldFill, string $sizeOrigin, string $variantOrigin, string $colorOrigin, string $fillOrigin)
No description
void
debugWarnings(array $supports, array $sizePreset, array $colorPreset, string $componentName, string|null $variant, string|null $color)
No description
Details
at line 22
array{0: array, 1: array, 2: bool, 3: array}
getComponentPresets(string|null $componentName = null, ComponentAttributeBag|null $attributes = null)
compute component presets based on context.
at line 64
protected array
loadPresets(string $componentName)
No description
at line 75
protected array
loadComponentDefaults(string $componentName)
No description
at line 88
protected bool
detectHasVariants(array $colors)
No description
at line 100
protected array
computeSupports(array $sizes, array $colorsArray, array $defaults, array $magicProps)
No description
at line 118
protected array
resolveSize(array $supports, array $sizes, array $defaults, array $magicProps)
No description
at line 149
protected array
resolveVariant(array $supports, array $colorsArray, array $componentPresets, array $defaults, array $magicProps, bool $hasVariants)
No description
at line 193
protected array
resolveColor(array $supports, array $colorsArray, array $componentPresets, array $defaults, array $magicProps, string|null $variant, bool $hasVariants)
No description
at line 258
protected array
resolveFill(array $supports, array $attributes, array $defaults)
No description
at line 303
protected string
buildCacheKey(string $component, array $supports, string|null $size, string|null $variant, string|null $color, bool $shouldFill)
No description
at line 313
protected void
syncInstanceProps(array $supports, string|null $size, string|null $variant, string|null $color)
No description
at line 326
protected array
buildPresetNames(array $supports, string|null $size, string|null $variant, string|null $color, bool $shouldFill, string $sizeOrigin, string $variantOrigin, string $colorOrigin, string $fillOrigin)
No description
at line 344
protected void
debugWarnings(array $supports, array $sizePreset, array $colorPreset, string $componentName, string|null $variant, string|null $color)
No description