Initial commit
This commit is contained in:
48 files changed
+1508
No files matched your search
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace VendorName\Skeleton\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class SkeletonCommand extends Command
|
||||
{
|
||||
public $signature = 'skeleton';
|
||||
|
||||
public $description = 'My command';
|
||||
|
||||
public function handle(): int
|
||||
{
|
||||
$this->comment('All done');
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace VendorName\Skeleton\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
/**
|
||||
* @see \VendorName\Skeleton\Skeleton
|
||||
*/
|
||||
class Skeleton extends Facade
|
||||
{
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return \VendorName\Skeleton\Skeleton::class;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace VendorName\Skeleton;
|
||||
|
||||
class Skeleton {}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace VendorName\Skeleton;
|
||||
|
||||
use Filament\Contracts\Plugin;
|
||||
use Filament\Panel;
|
||||
|
||||
class SkeletonPlugin implements Plugin
|
||||
{
|
||||
public function getId(): string
|
||||
{
|
||||
return 'skeleton';
|
||||
}
|
||||
|
||||
public function register(Panel $panel): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function boot(Panel $panel): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public static function make(): static
|
||||
{
|
||||
return app(static::class);
|
||||
}
|
||||
|
||||
public static function get(): static
|
||||
{
|
||||
/** @var static $plugin */
|
||||
$plugin = filament(app(static::class)->getId());
|
||||
|
||||
return $plugin;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
<?php
|
||||
|
||||
namespace VendorName\Skeleton;
|
||||
|
||||
use Filament\Support\Assets\AlpineComponent;
|
||||
use Filament\Support\Assets\Asset;
|
||||
use Filament\Support\Assets\Css;
|
||||
use Filament\Support\Assets\Js;
|
||||
use Filament\Support\Facades\FilamentAsset;
|
||||
use Filament\Support\Facades\FilamentIcon;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Livewire\Features\SupportTesting\Testable;
|
||||
use Spatie\LaravelPackageTools\Commands\InstallCommand;
|
||||
use Spatie\LaravelPackageTools\Package;
|
||||
use Spatie\LaravelPackageTools\PackageServiceProvider;
|
||||
use VendorName\Skeleton\Commands\SkeletonCommand;
|
||||
use VendorName\Skeleton\Testing\TestsSkeleton;
|
||||
|
||||
class SkeletonServiceProvider extends PackageServiceProvider
|
||||
{
|
||||
public static string $name = 'skeleton';
|
||||
|
||||
public static string $viewNamespace = 'skeleton';
|
||||
|
||||
public function configurePackage(Package $package): void
|
||||
{
|
||||
/*
|
||||
* This class is a Package Service Provider
|
||||
*
|
||||
* More info: https://github.com/spatie/laravel-package-tools
|
||||
*/
|
||||
$package->name(static::$name)
|
||||
->hasCommands($this->getCommands())
|
||||
->hasInstallCommand(function (InstallCommand $command) {
|
||||
$command
|
||||
->publishConfigFile()
|
||||
->publishMigrations()
|
||||
->askToRunMigrations()
|
||||
->askToStarRepoOnGitHub(':vendor_slug/:package_slug');
|
||||
});
|
||||
|
||||
$configFileName = $package->shortName();
|
||||
|
||||
if (file_exists($package->basePath("/../config/{$configFileName}.php"))) {
|
||||
$package->hasConfigFile();
|
||||
}
|
||||
|
||||
if (file_exists($package->basePath('/../database/migrations'))) {
|
||||
$package->hasMigrations($this->getMigrations());
|
||||
}
|
||||
|
||||
if (file_exists($package->basePath('/../resources/lang'))) {
|
||||
$package->hasTranslations();
|
||||
}
|
||||
|
||||
if (file_exists($package->basePath('/../resources/views'))) {
|
||||
$package->hasViews(static::$viewNamespace);
|
||||
}
|
||||
}
|
||||
|
||||
public function packageRegistered(): void {}
|
||||
|
||||
public function packageBooted(): void
|
||||
{
|
||||
// Asset Registration
|
||||
FilamentAsset::register(
|
||||
$this->getAssets(),
|
||||
$this->getAssetPackageName()
|
||||
);
|
||||
|
||||
FilamentAsset::registerScriptData(
|
||||
$this->getScriptData(),
|
||||
$this->getAssetPackageName()
|
||||
);
|
||||
|
||||
// Icon Registration
|
||||
FilamentIcon::register($this->getIcons());
|
||||
|
||||
// Handle Stubs
|
||||
if (app()->runningInConsole()) {
|
||||
foreach (app(Filesystem::class)->files(__DIR__ . '/../stubs/') as $file) {
|
||||
$this->publishes([
|
||||
$file->getRealPath() => base_path("stubs/skeleton/{$file->getFilename()}"),
|
||||
], 'skeleton-stubs');
|
||||
}
|
||||
}
|
||||
|
||||
// Testing
|
||||
Testable::mixin(new TestsSkeleton);
|
||||
}
|
||||
|
||||
protected function getAssetPackageName(): ?string
|
||||
{
|
||||
return ':vendor_slug/:package_slug';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<Asset>
|
||||
*/
|
||||
protected function getAssets(): array
|
||||
{
|
||||
return [
|
||||
// AlpineComponent::make('skeleton', __DIR__ . '/../resources/dist/components/skeleton.js'),
|
||||
Css::make('skeleton-styles', __DIR__ . '/../resources/dist/skeleton.css'),
|
||||
Js::make('skeleton-scripts', __DIR__ . '/../resources/dist/skeleton.js'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<class-string>
|
||||
*/
|
||||
protected function getCommands(): array
|
||||
{
|
||||
return [
|
||||
SkeletonCommand::class,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string>
|
||||
*/
|
||||
protected function getIcons(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string>
|
||||
*/
|
||||
protected function getRoutes(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
protected function getScriptData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string>
|
||||
*/
|
||||
protected function getMigrations(): array
|
||||
{
|
||||
return [
|
||||
'create_skeleton_table',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace VendorName\Skeleton;
|
||||
|
||||
use Filament\Contracts\Plugin;
|
||||
use Filament\Panel;
|
||||
use Filament\Support\Assets\Theme;
|
||||
use Filament\Support\Color;
|
||||
use Filament\Support\Facades\FilamentAsset;
|
||||
|
||||
class Skeleton implements Plugin
|
||||
{
|
||||
public function getId(): string
|
||||
{
|
||||
return 'skeleton';
|
||||
}
|
||||
|
||||
public function register(Panel $panel): void
|
||||
{
|
||||
FilamentAsset::register([
|
||||
Theme::make('skeleton', __DIR__ . '/../resources/dist/skeleton.css'),
|
||||
]);
|
||||
|
||||
$panel
|
||||
->font('DM Sans')
|
||||
->primaryColor(Color::Amber)
|
||||
->secondaryColor(Color::Gray)
|
||||
->warningColor(Color::Amber)
|
||||
->dangerColor(Color::Rose)
|
||||
->successColor(Color::Green)
|
||||
->grayColor(Color::Gray)
|
||||
->theme('skeleton');
|
||||
}
|
||||
|
||||
public function boot(Panel $panel): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace VendorName\Skeleton\Testing;
|
||||
|
||||
use Livewire\Features\SupportTesting\Testable;
|
||||
|
||||
/**
|
||||
* @mixin Testable
|
||||
*/
|
||||
class TestsSkeleton
|
||||
{
|
||||
//
|
||||
}
|
||||
Reference in new issue
Block a user