$tokens colour tokens, exposed as CSS variables -- * @param array{css?: string, js?: string} $assets Vite entry points relative to the project root */ public function __construct( public string $key, public string $name, public string $version, public ?string $parent, public string $description, public array $tokens, public array $assets, public string $path, ) {} public static function fromFile(string $file): self { $data = json_decode((string) file_get_contents($file), true, flags: JSON_THROW_ON_ERROR); if (! is_array($data) || blank($data['key'] ?? null) || blank($data['name'] ?? null)) { throw new InvalidArgumentException("Invalid theme manifest [{$file}]: key and name are required."); } return new self( key: $data['key'], name: $data['name'], version: $data['version'] ?? '0.0.0', parent: $data['parent'] ?? null, description: $data['description'] ?? '', tokens: $data['tokens'] ?? [], assets: $data['assets'] ?? [], path: dirname($file), ); } public function viewsPath(): string { return $this->path.DIRECTORY_SEPARATOR.'views'; } }