Some checks failed
Deploy Application / deploy (push) Has been cancelled
37 lines
956 B
PHP
37 lines
956 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Framework\View\ValueObjects;
|
|
|
|
/**
|
|
* Interface for all data-* attribute enums
|
|
*
|
|
* Ensures consistent structure across all data attribute enums.
|
|
* All enums implementing this interface provide:
|
|
* - The attribute name (e.g., "data-live-component")
|
|
* - CSS selector conversion (e.g., "[data-live-component]")
|
|
* - JavaScript dataset key conversion (e.g., "liveComponent")
|
|
*/
|
|
interface DataAttributeInterface
|
|
{
|
|
/**
|
|
* Get the attribute name (e.g., "data-live-component")
|
|
*/
|
|
public function value(): string;
|
|
|
|
/**
|
|
* Convert to CSS selector (e.g., "[data-live-component]")
|
|
*/
|
|
public function toSelector(): string;
|
|
|
|
/**
|
|
* Convert to JavaScript dataset key (e.g., "liveComponent")
|
|
*
|
|
* Converts kebab-case to camelCase and removes "data-" prefix.
|
|
* Example: "data-live-component" -> "liveComponent"
|
|
*/
|
|
public function toDatasetKey(): string;
|
|
}
|
|
|