Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ Installation
composer require nuxtifyts/dash-stack-theme
```

> For Filament 3:
> If you're still using Filament v3: run this command instead
> `composer require nuxtifyts/dash-stack-theme:"^1.3"

#### Step 2: Run install command:

Running this command will install required npm packages (If they're not already installed), and it will publish its assets as well.
Expand All @@ -60,8 +64,8 @@ Add DashStack theme to your `vite.config.js`:

```javascript
input: [
// ...
'vendor/nuxtifyts/dash-stack-theme/resources/css/theme.css',
// ...
'vendor/nuxtifyts/dash-stack-theme/resources/css/theme.css',
],
```

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"type": "library",
"require": {
"php": "^8.2",
"filament/filament": "^3.0",
"filament/filament": "^4.0",
"illuminate/contracts": "^11.0|^12.0",
"spatie/laravel-package-tools": "^1.19"
},
Expand Down
2,490 changes: 1,612 additions & 878 deletions composer.lock

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion resources/css/login.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/* Login Page Start */
.fi-simple-layout {
> .fi-simple-main-ctn {
@apply bg-[#4880FF] dark:bg-[var(--ds-dark-bg-primary-color)];
@apply bg-[url(/vendor/nuxtifyts/dash-stack-theme/dash-stack-shape.svg)];
@apply bg-[url(/_filament-dash-stack-theme/assets/dash-stack-shape.svg)];
@apply bg-no-repeat bg-cover;

> .fi-simple-main {
Expand All @@ -13,3 +14,4 @@
}
}
}
/* Login Page End */
15 changes: 0 additions & 15 deletions resources/css/tailwind.config.js

This file was deleted.

55 changes: 27 additions & 28 deletions resources/css/theme.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
@import '/vendor/filament/filament/resources/css/theme.css';
@import 'login.css';

@config 'tailwind.config.js';
@import '../../../../../vendor/filament/filament/resources/css/theme.css';
@import "./login.css";

:root {
--ds-dark-bg-primary-color: #1B2431;
Expand Down Expand Up @@ -144,37 +142,37 @@
@apply bg-white dark:bg-[var(--ds-dark-bg-secondary-color)];
@apply border-r-[0.9px] border-r-[#E0E0E0] dark:border-none;
@apply py-4 px-0;

> .fi-sidebar-nav-groups {
@apply gap-y-4 -mr-4;

> .fi-sidebar-group {
> .fi-sidebar-group-button {
@apply pl-14 pr-6 mt-2 rtl:pl-6 rtl:pr-14;

> .fi-icon-btn, > .fi-sidebar-group-label {
@apply text-gray-600 dark:text-gray-300;
}
}

> .fi-sidebar-group-items {
> .fi-sidebar-item {
@apply relative px-10 rtl:pr-14 rtl:pl-6;

> .fi-sidebar-item-button {
@apply bg-white dark:bg-[var(--ds-dark-bg-secondary-color)];
@apply px-4 py-3 gap-x-6;

> .fi-sidebar-item-icon, > .fi-sidebar-item-label {
@apply text-gray-800 dark:text-white font-semibold;
}
}
}

> .fi-sidebar-item.fi-sidebar-item-active {
> .fi-sidebar-item-button {
@apply bg-primary-600;

> .fi-sidebar-item-icon, > .fi-sidebar-item-label {
@apply text-white;
}
Expand All @@ -184,18 +182,18 @@
}
}
}

> .fi-sidebar-item::after {
content: '';
@apply absolute left-0 rtl:right-4 top-0 w-4 h-full rounded-lg;
}

> .fi-sidebar-item.fi-sidebar-item-active::after {
@apply bg-primary-600;
}
}
}

> .fi-sidebar-group:not(:first-child) {
@apply border-t-[0.6px] border-t-[#E0E0E0] dark:border-white/10;
}
Expand All @@ -219,46 +217,46 @@
@apply bg-white dark:bg-[var(--ds-dark-bg-secondary-color)];
@apply border-r-[0.9px] border-r-[#E0E0E0] dark:border-none;
@apply py-4 px-0;

> .fi-sidebar-nav-groups {
@apply gap-y-4 -mr-4;

> .fi-sidebar-group {
> .fi-sidebar-group-button {
@apply pl-14 pr-6 mt-2 rtl:pl-6 rtl:pr-14;

> .fi-icon-btn, > .fi-sidebar-group-label {
@apply text-gray-600 dark:text-gray-300;
}
}

> .fi-sidebar-group-items {
> .fi-sidebar-item {
@apply relative rtl:pr-8;

> .fi-sidebar-item-button {
@apply bg-white dark:bg-[var(--ds-dark-bg-secondary-color)];
@apply px-4 py-3 gap-x-6;

> .fi-sidebar-item-icon, > .fi-sidebar-item-label {
@apply text-gray-800 dark:text-white font-semibold;
}
}
}

> .fi-sidebar-item.fi-sidebar-item-active {
> .fi-sidebar-item-button {
> .fi-sidebar-item-icon, > .fi-sidebar-item-label {
@apply text-primary-600;
}
}
}

> .fi-sidebar-item::after {
content: '';
@apply absolute left-0 rtl:right-4 top-0 w-4 h-full rounded-lg;
}

> .fi-sidebar-item.fi-sidebar-item-active::after {
@apply bg-primary-600;
}
Expand Down Expand Up @@ -304,7 +302,7 @@
.fi-header {
@apply pb-6;
}

/* Table Component Start */
.fi-ta-content {
> .fi-ta-table {
Expand Down Expand Up @@ -347,7 +345,7 @@
.fi-ta-table {
thead {
> tr {
.fi-ta-actions-header-cell,
.fi-ta-actions-header-cell,
.fi-ta-header-cell,
.fi-ta-cell {
@apply bg-primary-100/10 dark:bg-[var(--ds-dark-bg-tertiary-color)];
Expand Down Expand Up @@ -431,7 +429,7 @@
}
}
}

/* Table Component 2.1 Start */
> div {
&:first-child {
Expand All @@ -457,7 +455,7 @@

.fi-ta-record {
@apply rounded-3xl ring-0 shadow-sm bg-gray-50 dark:bg-[var(--ds-dark-bg-tertiary-color)];
@apply bg-[url(/vendor/nuxtifyts/dash-stack-theme/card-bg-pattern.svg)];
@apply bg-[url(/_filament-dash-stack-theme/assets/card-bg-pattern.svg)];
}
}
/* Table Component 2.1.2 End */
Expand Down Expand Up @@ -485,6 +483,7 @@
@apply rounded-md sm:rounded-lg;
@apply py-1 px-3 sm:py-2 sm:px-4;
@apply text-sm sm:text-base;
@apply text-white;

.fi-btn-label {
@apply text-sm sm:text-base;
Expand Down Expand Up @@ -596,4 +595,4 @@
@apply ring-offset-0 ring-0 dark:ring-1 dark:ring-offset-0 dark:ring-white/10;
@apply dark:bg-[var(--ds-dark-bg-secondary-color)];
}
/* Tabs Component End */
/* Tabs Component End */
21 changes: 1 addition & 20 deletions src/Commands/FilamentDashStackThemeInstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
namespace Nuxtifyts\DashStackTheme\Commands;

use Illuminate\Console\Command;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Process;
use Nuxtifyts\DashStackTheme\DashStackThemeServiceProvider;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand('filament-dash-stack-theme:install')]
Expand Down Expand Up @@ -46,33 +44,16 @@ public function handle(): int

$this->info("Using NPM version {$npmVersionResult->output()} to installed dependencies.");

$npmInstallResult = Process::run('npm install tailwindcss @tailwindcss/forms @tailwindcss/typography postcss autoprefixer --save-dev');
$npmInstallResult = Process::run('npm install tailwindcss @tailwindcss/vite @tailwindcss/forms @tailwindcss/typography --save-dev');

$this->info($npmInstallResult->output());

$postcssConfigPath = base_path('postcss.config.js');

if (! File::exists($postcssConfigPath)) {
$this->info('No postcss.config.js file found. Creating one for you...');

File::copy(__DIR__.'/../../stubs/postcss.config.js', $postcssConfigPath);

$this->info('postcss.config.js file created.');
}

$this->info('Running NPM build...');

$npmBuildResult = Process::run('npm install && npm run build');

$this->info($npmBuildResult->output());

$this->info('Publishing assets...');

$this->call('vendor:publish', [
'--tag' => DashStackThemeServiceProvider::PACKAGE_NAME.'-assets',
'--force' => true,
]);

return static::SUCCESS;
}
}
18 changes: 11 additions & 7 deletions src/DashStackThemeServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,14 @@ public function configurePackage(Package $package): void
->name(self::PACKAGE_NAME)
->hasConfigFile(self::CONFIG_FILE_NAME)
->hasViews()
->hasAssets()
->hasCommands(...self::commandsClassStrings());
}

/**
* @return $this
*/
public function boot()
public function bootingPackage(): void
{
return parent::boot()
->bootDefaultFont();
$this
->bootDefaultFont()
->bootAssetsManager();
}

protected function bootDefaultFont(): static
Expand All @@ -48,6 +45,13 @@ protected function bootDefaultFont(): static
return $this;
}

protected function bootAssetsManager(): static
{
app(Support\Assets\Manager::class)->boot();

return $this;
}

/**
* @return list<class-string<Command>>
*/
Expand Down
32 changes: 32 additions & 0 deletions src/Http/Controllers/AssetsController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

namespace Nuxtifyts\DashStackTheme\Http\Controllers;

use Illuminate\Http\Response;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Throwable;

readonly class AssetsController
{
protected const CACHE_CONTROL = 'public, max-age=31536000';

protected const NONCE_SECRET = 'qe0u8t9n3r4a5n6d7o8m9s0t1r2i3n4g5';

protected const EXPIRES = '+1 year';

public function __invoke(string $fileName): BinaryFileResponse
{
try {
$filePath = __DIR__."/../../../resources/assets/{$fileName}";

return response()
->file($filePath, headers: [
'Expires' => sprintf('%s GMT', gmdate('D, d M Y H:i:s', strtotime(static::EXPIRES))),
'Cache-Control' => static::CACHE_CONTROL,
'Last-Modified' => sprintf('%s GMT', gmdate('D, d M Y H:i:s', filemtime($filePath))),
]);
} catch (Throwable) {
abort(Response::HTTP_NOT_FOUND);
}
}
}
22 changes: 22 additions & 0 deletions src/Support/Assets/Manager.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace Nuxtifyts\DashStackTheme\Support\Assets;

use Illuminate\Support\Facades\Route;
use Nuxtifyts\DashStackTheme\Http\Controllers\AssetsController;

readonly class Manager
{
public function boot(): void
{
$this->registerRoutes();
}

protected function registerRoutes(): void
{
Route::prefix('_filament-dash-stack-theme')->group(static function (): void {
Route::get('assets/{fileName}', AssetsController::class)
->name('filament-dash-stack-theme.assets');
});
}
}
6 changes: 0 additions & 6 deletions stubs/postcss.config.js

This file was deleted.

Loading