-
Notifications
You must be signed in to change notification settings - Fork 5
/
FilamentAsset.php
61 lines (55 loc) · 2.08 KB
/
FilamentAsset.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
namespace Filament\Support\Facades;
use Filament\Support\Assets\Asset;
use Filament\Support\Assets\AssetManager;
use Filament\Support\Assets\Theme;
use Illuminate\Support\Facades\Facade;
/**
* @method static array getAlpineComponents(array | null $packages = null)
* @method static string getAlpineComponentSrc(string $id, string $package = 'app')
* @method static array getScriptData(array | null $packages = null)
* @method static string getScriptSrc(string $id, string $package = 'app')
* @method static array getScripts(array | null $packages = null, bool $withCore = true)
* @method static string getStyleHref(string $id, string $package = 'app')
* @method static array getStyles(array | null $packages = null)
* @method static Theme | null getTheme(string $id)
* @method static array getThemes()
* @method static string renderScripts(array | null $packages = null, bool $withCore = true)
* @method static string renderStyles(array | null $packages = null)
*
* @see AssetManager
*/
class FilamentAsset extends Facade
{
protected static function getFacadeAccessor(): string
{
return AssetManager::class;
}
/**
* @param array<Asset> $assets
*/
public static function register(array $assets, string $package = 'app'): void
{
static::resolved(function (AssetManager $assetManager) use ($assets, $package) {
$assetManager->register($assets, $package);
});
}
/**
* @param array<string, mixed> $variables
*/
public static function registerCssVariables(array $variables, ?string $package = null): void
{
static::resolved(function (AssetManager $assetManager) use ($variables, $package) {
$assetManager->registerCssVariables($variables, $package);
});
}
/**
* @param array<string, mixed> $data
*/
public static function registerScriptData(array $data, ?string $package = null): void
{
static::resolved(function (AssetManager $assetManager) use ($data, $package) {
$assetManager->registerScriptData($data, $package);
});
}
}