diff --git a/_builder/README.md b/_builder/README.md deleted file mode 100644 index 0e06f0867..000000000 --- a/_builder/README.md +++ /dev/null @@ -1,92 +0,0 @@ -

- TallUI Logo -

- - TallUI Textlogo - -


-

- - PEST Tests - - - Laravel PINT PHP Code Style - - - PHPStan Level 5 - -

-

- - TailwindCSS 3 - - - AlpineJS 3 - - - Laravel 10 - - - Laravel Livewire 2 - -

-

- - Codacy Code Quality - - - Codacy Coverage - - - Code Climate Maintainability - - - Snyk Security - -

-

- - Renovate - - - Translation status - - - License - - - Slack - -
-
-

- -# TallUI Builder - -Use - -- [TallUI Package Builder](./tallui-package-builder/README.md) to create a new Package or Set of Components -- [TallUI Icons Builder](./tallui-icons-builder/README.md) to create a new Iconset - -## Add a new package to the Monorepo - -This is how to add a new package to develop within the TallUI Monorepo: - -- Create a new package from TallUI Package Builder or Icons Builder template -- You may create it as public repository in the Usetall Organization -- Don't forget the repo's settings like linking to https://tallui.io and the `[read-only]-notice` -- Copy contents into `_custom` folder and require it from there, if you need time to develop it - -After the initial development is finished or when a package (e.g. icons) is made in a nutshell: - -- Copy contents into the appropriate `_subfolder` of the monorepo -- Add the package to the appropriate monorepo-split-action -- Add the package to composer.json, compose and test the package -- Except Builders, leave the package in composer.json so everyone can use it -- Add the package to Weblate, if it has translations - -And finally, when the package is tested and ready for production: - -- Add the package to the README.md so that others can find it -- Add the package to Packagist if the package is stable, except Builders -- Require the package to `_app/*/composer.json` as see fit diff --git a/_others/moox-skeleton/.gitignore b/_others/moox-skeleton/.gitignore new file mode 100644 index 000000000..6a81cbb00 --- /dev/null +++ b/_others/moox-skeleton/.gitignore @@ -0,0 +1,49 @@ +# Environment +.env +.env.backup + +# Composer +/vendor +composer.lock +auth.json + +# NPM / Node +/node_modules +npm-debug.log +package-lock.json + +# Laravel +/public/hot +/public/storage +/storage/*.key + +# PHPUnit +.phpunit.result.cache +phpunit.xml + +# Yarn +yarn-error.log + +# PHPStan +/build +phpstan.neon + +# Testbench +testbench.yaml + +# PHP CS Fixer +.php-cs-fixer.cache + +# Homestead +Homestead.json +Homestead.yaml + +# IDEs +/.idea +/.vscode + +# MacOS +.DS_Store + +# Windows +Thumbs.db diff --git a/_others/moox-skeleton/CHANGELOG.md b/_others/moox-skeleton/CHANGELOG.md new file mode 100644 index 000000000..825c32f0d --- /dev/null +++ b/_others/moox-skeleton/CHANGELOG.md @@ -0,0 +1 @@ +# Changelog diff --git a/_others/moox-skeleton/LICENSE.md b/_others/moox-skeleton/LICENSE.md new file mode 100644 index 000000000..7dfc5ad0b --- /dev/null +++ b/_others/moox-skeleton/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Moox + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/_others/moox-skeleton/README.md b/_others/moox-skeleton/README.md new file mode 100644 index 000000000..7db38f720 --- /dev/null +++ b/_others/moox-skeleton/README.md @@ -0,0 +1,42 @@ +# Moox Skeleton + +This template is used for generating all Moox packages. + +If you install it, it will completely work without beeing useful. Guaranteed! + +## Installation + +You can install the package via composer: + +```bash +composer require moox/skeleton +``` + +You can publish and run the migrations with: + +```bash +php artisan vendor:publish --tag="skeleton-migrations" +php artisan migrate +``` + +You can publish the config file with: + +```bash +php artisan vendor:publish --tag="skeleton-config" +``` + +## Changelog + +Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. + +## Security Vulnerabilities + +Please review [our security policy](https://github.com/mooxphp/moox/security/policy) on how to report security vulnerabilities. + +## Credits + +- [All Contributors](../../contributors) + +## License + +The MIT License (MIT). Please see [License File](LICENSE.md) for more information. diff --git a/_others/moox-skeleton/SECURITY.md b/_others/moox-skeleton/SECURITY.md new file mode 100644 index 000000000..b55c294bb --- /dev/null +++ b/_others/moox-skeleton/SECURITY.md @@ -0,0 +1,13 @@ +# Security Policy + +## Supported Versions + +We maintain the current version of `Moox Skeleton` actively. + +Do not expect security fixes for older versions. + +## Reporting a Vulnerability + +If you find any security-related bug, please report it to security@moox.org. + +Please do not use Github issues, to give us enough time to review and fix the issue, before others can use it, to do stupid things. diff --git a/_others/moox-skeleton/composer.json b/_others/moox-skeleton/composer.json new file mode 100644 index 000000000..2663df6b1 --- /dev/null +++ b/_others/moox-skeleton/composer.json @@ -0,0 +1,37 @@ +{ + "name": "moox/skeleton", + "description": "This template is used for generating all Moox packages.", + "keywords": [ + "Laravel", + "Filament", + "Filament plugin", + "Laravel package" + ], + "homepage": "https://github.com/mooxphp/", + "license": "MIT", + "authors": [ + { + "name": "Alf Drollinger", + "email": "alf@moox.org", + "role": "Developer" + } + ], + "require": { + "spatie/laravel-package-tools": "^1.13.0", + "filament/filament": "^3.0" + }, + "autoload": { + "psr-4": { + "Moox\\Skeleton\\": "src" + } + }, + "extra": { + "laravel": { + "providers": [ + "Moox\\Skeleton\\SkeletonServiceProvider" + ] + } + }, + "minimum-stability": "dev", + "prefer-stable": true +} diff --git a/_others/moox-skeleton/config/skeleton.php b/_others/moox-skeleton/config/skeleton.php new file mode 100644 index 000000000..0b71c3140 --- /dev/null +++ b/_others/moox-skeleton/config/skeleton.php @@ -0,0 +1,20 @@ + [ + 'skeleton' => [ + 'enabled' => true, + 'label' => 'Skeleton', + 'plural_label' => 'Skeletons', + 'navigation_group' => 'Skeleton Group', + 'navigation_icon' => 'heroicon-o-play', + 'navigation_sort' => 1, + 'navigation_count_badge' => true, + 'resource' => Moox\Skeleton\Resources\SkeletonResource::class, + ], + ], + 'pruning' => [ + 'enabled' => true, + 'retention_days' => 7, + ], +]; diff --git a/_others/moox-skeleton/database/migrations/create_skeleton_table.php.stub b/_others/moox-skeleton/database/migrations/create_skeleton_table.php.stub new file mode 100644 index 000000000..6e16de325 --- /dev/null +++ b/_others/moox-skeleton/database/migrations/create_skeleton_table.php.stub @@ -0,0 +1,31 @@ +string('id')->index(); + $table->string('name')->nullable(); + $table->timestamp('started_at')->nullable()->index(); + $table->timestamp('finished_at')->nullable(); + $table->boolean('failed')->default(false)->index(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('skeleton'); + } +}; diff --git a/_others/moox-skeleton/resources/lang/en/translations.php b/_others/moox-skeleton/resources/lang/en/translations.php new file mode 100644 index 000000000..e31945ca7 --- /dev/null +++ b/_others/moox-skeleton/resources/lang/en/translations.php @@ -0,0 +1,14 @@ + 'Skeleton', + 'title' => 'Skeleton', + 'navigation_label' => 'Skeleton', + 'navigation_group' => 'Skeleton Group', + 'totalone' => 'Skeleton One', + 'totaltwo' => 'Skeleton Two', + 'totalthree' => 'Skeleton Three', + 'name' => 'Name', + 'started_at' => 'Started at', + 'failed' => 'failed', +]; diff --git a/_others/moox-skeleton/src/Models/Skeleton.php b/_others/moox-skeleton/src/Models/Skeleton.php new file mode 100644 index 000000000..6806d65cb --- /dev/null +++ b/_others/moox-skeleton/src/Models/Skeleton.php @@ -0,0 +1,23 @@ + 'bool', + 'started_at' => 'datetime', + 'finished_at' => 'datetime', + ]; +} diff --git a/_others/moox-skeleton/src/Resources/SkeletonResource.php b/_others/moox-skeleton/src/Resources/SkeletonResource.php new file mode 100644 index 000000000..f2dad619f --- /dev/null +++ b/_others/moox-skeleton/src/Resources/SkeletonResource.php @@ -0,0 +1,126 @@ +schema([ + TextInput::make('name') + ->maxLength(255), + DateTimePicker::make('started_at'), + DateTimePicker::make('finished_at'), + Toggle::make('failed') + ->required(), + ]); + } + + public static function table(Table $table): Table + { + return $table + ->columns([ + TextColumn::make('name') + ->label(__('skeleton::translations.name')) + ->sortable(), + TextColumn::make('started_at') + ->label(__('skeleton::translations.started_at')) + ->since() + ->sortable(), + TextColumn::make('failed') + ->label(__('skeleton::translations.failed')) + ->sortable(), + ]) + ->defaultSort('name', 'desc') + ->actions([ + EditAction::make(), + ]) + ->bulkActions([ + DeleteBulkAction::make(), + ]); + } + + public static function getRelations(): array + { + return [ + // + ]; + } + + public static function getPages(): array + { + return [ + 'index' => ListPage::route('/'), + ]; + } + + public static function getWidgets(): array + { + return [ + SkeletonWidgets::class, + ]; + } + + public static function getNavigationBadge(): ?string + { + return SkeletonPlugin::get()->getNavigationCountBadge() ? number_format(static::getModel()::count()) : null; + } + + public static function getModelLabel(): string + { + return SkeletonPlugin::get()->getLabel(); + } + + public static function getPluralModelLabel(): string + { + return SkeletonPlugin::get()->getPluralLabel(); + } + + public static function getNavigationLabel(): string + { + return Str::title(static::getPluralModelLabel()) ?? Str::title(static::getModelLabel()); + } + + public static function getNavigationGroup(): ?string + { + return SkeletonPlugin::get()->getNavigationGroup(); + } + + public static function getNavigationSort(): ?int + { + return SkeletonPlugin::get()->getNavigationSort(); + } + + public static function getBreadcrumb(): string + { + return SkeletonPlugin::get()->getBreadcrumb(); + } + + public static function shouldRegisterNavigation(): bool + { + return SkeletonPlugin::get()->shouldRegisterNavigation(); + } + + public static function getNavigationIcon(): string + { + return SkeletonPlugin::get()->getNavigationIcon(); + } +} diff --git a/_others/moox-skeleton/src/Resources/SkeletonResource/Pages/ListPage.php b/_others/moox-skeleton/src/Resources/SkeletonResource/Pages/ListPage.php new file mode 100644 index 000000000..8c948adfa --- /dev/null +++ b/_others/moox-skeleton/src/Resources/SkeletonResource/Pages/ListPage.php @@ -0,0 +1,41 @@ +using(function (array $data, string $model): Skeleton { + return $model::create($data); + }), + ]; + } +} diff --git a/_others/moox-skeleton/src/Resources/SkeletonResource/Widgets/SkeletonWidgets.php b/_others/moox-skeleton/src/Resources/SkeletonResource/Widgets/SkeletonWidgets.php new file mode 100644 index 000000000..5af63391e --- /dev/null +++ b/_others/moox-skeleton/src/Resources/SkeletonResource/Widgets/SkeletonWidgets.php @@ -0,0 +1,30 @@ +select($aggregationColumns) + ->first(); + + return [ + Stat::make(__('skeleton::translations.totalone'), $aggregatedInfo->count ?? 0), + Stat::make(__('skeleton::translations.totaltwo'), $aggregatedInfo->count ?? 0), + Stat::make(__('skeleton::translations.totalthree'), $aggregatedInfo->count ?? 0), + ]; + } +} diff --git a/_others/moox-skeleton/src/SkeletonPlugin.php b/_others/moox-skeleton/src/SkeletonPlugin.php new file mode 100644 index 000000000..273549975 --- /dev/null +++ b/_others/moox-skeleton/src/SkeletonPlugin.php @@ -0,0 +1,257 @@ +resources([ + $this->getResource(), + ]); + } + + /** + * Boot the plugin. + */ + public function boot(Panel $panel): void + { + // + } + + /** + * Make a new instance of the plugin. + */ + public static function make(): static + { + return app(static::class); + } + + /** + * Get the plugin instance. + */ + public static function get(): static + { + return filament(app(static::class)->getId()); + } + + /** + * Get the resource class. + */ + public function getResource(): string + { + return $this->resource ?? config('skeleton.resources.skeleton.resource'); + } + + /** + * Set the resource class. + */ + public function resource(string $resource): static + { + $this->resource = $resource; + + return $this; + } + + /** + * Get the resource label. + */ + public function getLabel(): ?string + { + return $this->evaluate($this->label) ?? config('skeleton.resources.skeleton.label'); + } + + /** + * Set the resource label. + */ + public function label(string $label): static + { + $this->label = $label; + + return $this; + } + + /** + * Get the plural resource label. + */ + public function getPluralLabel(): ?string + { + return $this->evaluate($this->pluralLabel) ?? config('skeleton.resources.skeleton.plural_label'); + } + + /** + * Set the plural resource label. + */ + public function pluralLabel(string $pluralLabel): static + { + $this->pluralLabel = $pluralLabel; + + return $this; + } + + /** + * Get the resource navigation group. + */ + public function getNavigationGroup(): ?string + { + return $this->navigationGroup ?? config('skeleton.resources.skeleton.navigation_group'); + } + + /** + * Set the resource navigation group. + */ + public function navigationGroup(string $navigationGroup): static + { + $this->navigationGroup = $navigationGroup; + + return $this; + } + + /** + * Get the resource icon. + */ + public function getNavigationIcon(): ?string + { + return $this->navigationIcon ?? config('skeleton.resources.skeleton.navigation_icon'); + } + + /** + * Set the resource icon. + */ + public function navigationIcon(string $navigationIcon): static + { + $this->navigationIcon = $navigationIcon; + + return $this; + } + + /** + * Get the resource sort. + */ + public function getNavigationSort(): ?int + { + return $this->navigationSort ?? config('skeleton.resources.skeleton.navigation_sort'); + } + + /** + * Set the resource sort. + */ + public function navigationSort(int $navigationSort): static + { + $this->navigationSort = $navigationSort; + + return $this; + } + + /** + * Get the resource navigation count badge status. + */ + public function getNavigationCountBadge(): ?bool + { + return $this->navigationCountBadge ?? config('skeleton.resources.skeleton.navigation_count_badge'); + } + + /** + * Set the resource navigation count badge status. + */ + public function navigationCountBadge(bool $navigationCountBadge = true): static + { + $this->navigationCountBadge = $navigationCountBadge; + + return $this; + } + + /** + * Determine whether the resource navigation is enabled. + */ + public function shouldRegisterNavigation(): bool + { + return $this->navigation ?? config('skeleton.resources.skeleton.enabled'); + } + + /** + * Enable the resource navigation. + */ + public function enableNavigation(bool $status = true): static + { + $this->navigation = $status; + + return $this; + } + + /** + * Get the resource breadcrumb. + */ + public function getBreadcrumb(): string + { + return __('skeleton::translations.breadcrumb'); + } +} diff --git a/_others/moox-skeleton/src/SkeletonServiceProvider.php b/_others/moox-skeleton/src/SkeletonServiceProvider.php new file mode 100644 index 000000000..3da838d78 --- /dev/null +++ b/_others/moox-skeleton/src/SkeletonServiceProvider.php @@ -0,0 +1,21 @@ +name('skeleton') + ->hasConfigFile() + ->hasViews() + ->hasTranslations() + ->hasMigration('create_skeleton_table'); + } +}