mirror of
https://github.com/filamentphp/filament.git
synced 2026-09-24 15:42:09 +08:00
Load Alpine and plugins from packages
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
||||
const esbuild = require('esbuild')
|
||||
const shouldWatch = process.argv.includes('--watch')
|
||||
|
||||
const packages = ['app', 'forms', 'notifications', 'support']
|
||||
const packages = ['app', 'forms', 'notifications', 'support', 'tables']
|
||||
|
||||
packages.forEach((package) => {
|
||||
esbuild
|
||||
|
||||
Generated
+22
-22
@@ -2119,13 +2119,13 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/express": {
|
||||
"version": "4.17.14",
|
||||
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.14.tgz",
|
||||
"integrity": "sha512-TEbt+vaPFQ+xpxFLFssxUDXj5cWCxZJjIcB7Yg0k0GMHGtgtQgpvx/MUQUeAkNbA9AAGrwkAsoeItdTgS7FMyg==",
|
||||
"version": "4.17.15",
|
||||
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.15.tgz",
|
||||
"integrity": "sha512-Yv0k4bXGOH+8a+7bELd2PqHQsuiANB+A8a4gnQrkRWzrkKlb6KHaVvyXhqs04sVW/OWlbPyYxRgYlIXLfrufMQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/body-parser": "*",
|
||||
"@types/express-serve-static-core": "^4.17.18",
|
||||
"@types/express-serve-static-core": "^4.17.31",
|
||||
"@types/qs": "*",
|
||||
"@types/serve-static": "*"
|
||||
}
|
||||
@@ -2225,9 +2225,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "18.11.14",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.14.tgz",
|
||||
"integrity": "sha512-0KXV57tENYmmJMl+FekeW9V3O/rlcqGQQJ/hNh9r8pKIj304pskWuEd8fCyNT86g/TpO0gcOTiLzsHLEURFMIQ==",
|
||||
"version": "18.11.15",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.15.tgz",
|
||||
"integrity": "sha512-VkhBbVo2+2oozlkdHXLrb3zjsRkpdnaU2bXmX8Wgle3PUi569eLRaHGlgETQHR7lLL1w7GiG3h9SnePhxNDecw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/parse-json": {
|
||||
@@ -5730,12 +5730,12 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/internal-slot": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz",
|
||||
"integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==",
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.4.tgz",
|
||||
"integrity": "sha512-tA8URYccNzMo94s5MQZgH8NB/XTa6HsOo0MLfXTKKEnHVVdegzaQoFZ7Jp44bdvLvY2waT5dc+j5ICEswhi7UQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"get-intrinsic": "^1.1.0",
|
||||
"get-intrinsic": "^1.1.3",
|
||||
"has": "^1.0.3",
|
||||
"side-channel": "^1.0.4"
|
||||
},
|
||||
@@ -11959,13 +11959,13 @@
|
||||
"dev": true
|
||||
},
|
||||
"@types/express": {
|
||||
"version": "4.17.14",
|
||||
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.14.tgz",
|
||||
"integrity": "sha512-TEbt+vaPFQ+xpxFLFssxUDXj5cWCxZJjIcB7Yg0k0GMHGtgtQgpvx/MUQUeAkNbA9AAGrwkAsoeItdTgS7FMyg==",
|
||||
"version": "4.17.15",
|
||||
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.15.tgz",
|
||||
"integrity": "sha512-Yv0k4bXGOH+8a+7bELd2PqHQsuiANB+A8a4gnQrkRWzrkKlb6KHaVvyXhqs04sVW/OWlbPyYxRgYlIXLfrufMQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/body-parser": "*",
|
||||
"@types/express-serve-static-core": "^4.17.18",
|
||||
"@types/express-serve-static-core": "^4.17.31",
|
||||
"@types/qs": "*",
|
||||
"@types/serve-static": "*"
|
||||
}
|
||||
@@ -12065,9 +12065,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "18.11.14",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.14.tgz",
|
||||
"integrity": "sha512-0KXV57tENYmmJMl+FekeW9V3O/rlcqGQQJ/hNh9r8pKIj304pskWuEd8fCyNT86g/TpO0gcOTiLzsHLEURFMIQ==",
|
||||
"version": "18.11.15",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.15.tgz",
|
||||
"integrity": "sha512-VkhBbVo2+2oozlkdHXLrb3zjsRkpdnaU2bXmX8Wgle3PUi569eLRaHGlgETQHR7lLL1w7GiG3h9SnePhxNDecw==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/parse-json": {
|
||||
@@ -14829,12 +14829,12 @@
|
||||
"dev": true
|
||||
},
|
||||
"internal-slot": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz",
|
||||
"integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==",
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.4.tgz",
|
||||
"integrity": "sha512-tA8URYccNzMo94s5MQZgH8NB/XTa6HsOo0MLfXTKKEnHVVdegzaQoFZ7Jp44bdvLvY2waT5dc+j5ICEswhi7UQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"get-intrinsic": "^1.1.0",
|
||||
"get-intrinsic": "^1.1.3",
|
||||
"has": "^1.0.3",
|
||||
"side-channel": "^1.0.4"
|
||||
}
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+3
-11
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -1,12 +1,8 @@
|
||||
import Collapse from '@alpinejs/collapse'
|
||||
import Focus from '@alpinejs/focus'
|
||||
import Mousetrap from '@danharrin/alpine-mousetrap'
|
||||
import Persist from '@alpinejs/persist'
|
||||
import Tooltip from '@ryangjchandler/alpine-tooltip'
|
||||
|
||||
document.addEventListener('alpine:init', () => {
|
||||
window.Alpine.plugin(Collapse)
|
||||
window.Alpine.plugin(Focus)
|
||||
window.Alpine.plugin(Mousetrap)
|
||||
window.Alpine.plugin(Persist)
|
||||
window.Alpine.plugin(Tooltip)
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
@@ -43,7 +43,7 @@ ${originalNode.outerHTML}${markupSVG}
|
||||
* Please visit https://pqina.nl/filepond/ for details.
|
||||
*/
|
||||
/*!
|
||||
* FilePondPluginFileValidateSize 2.2.7
|
||||
* FilePondPluginFileValidateSize 2.2.8
|
||||
* Licensed under MIT, https://opensource.org/licenses/MIT/
|
||||
* Please visit https://pqina.nl/filepond/ for details.
|
||||
*/
|
||||
|
||||
+8
-9
File diff suppressed because one or more lines are too long
+2
-2
File diff suppressed because one or more lines are too long
@@ -15,6 +15,8 @@ class FormsServiceProvider extends PluginServiceProvider
|
||||
|
||||
public function packageBooted(): void
|
||||
{
|
||||
parent::packageBooted();
|
||||
|
||||
if ($this->app->runningInConsole()) {
|
||||
foreach (app(Filesystem::class)->files(__DIR__ . '/../stubs/') as $file) {
|
||||
$this->publishes([
|
||||
|
||||
Vendored
+13
-1
File diff suppressed because one or more lines are too long
@@ -1,5 +1,19 @@
|
||||
import SortableAlpinePlugin from './sortable'
|
||||
import Alpine from 'alpinejs'
|
||||
import AlpineFloatingUI from '@awcodes/alpine-floating-ui'
|
||||
import AsyncAlpine from 'async-alpine'
|
||||
import Focus from '@alpinejs/focus'
|
||||
import Sortable from './sortable'
|
||||
|
||||
document.addEventListener('alpine:init', () => {
|
||||
window.Alpine.plugin(Focus)
|
||||
window.Alpine.plugin(Sortable)
|
||||
window.Alpine.plugin(AlpineFloatingUI)
|
||||
})
|
||||
|
||||
AsyncAlpine.init(Alpine)
|
||||
AsyncAlpine.start()
|
||||
window.Alpine = Alpine
|
||||
Alpine.start()
|
||||
|
||||
// https://github.com/laravel/framework/blob/5299c22321c0f1ea8ff770b84a6c6469c4d6edec/src/Illuminate/Translation/MessageSelector.php#L15
|
||||
const pluralize = function (text, number, variables) {
|
||||
@@ -91,8 +105,3 @@ const pluralize = function (text, number, variables) {
|
||||
}
|
||||
|
||||
window.pluralize = pluralize
|
||||
|
||||
document.addEventListener('alpine:init', () => {
|
||||
window.Alpine.plugin(SortableAlpinePlugin)
|
||||
window.Alpine.plugin(AlpineFloatingUI)
|
||||
})
|
||||
|
||||
@@ -115,7 +115,6 @@ class SupportServiceProvider extends PluginServiceProvider
|
||||
{
|
||||
return [
|
||||
Js::make('support', __DIR__ . '/../dist/index.js'),
|
||||
Js::make('async-alpine', 'https://cdn.jsdelivr.net/npm/async-alpine@0.5.x/dist/async-alpine.script.js'),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
(()=>{function src_default(Alpine){Alpine.directive("collapse",collapse),collapse.inline=(el,{modifiers})=>{!modifiers.includes("min")||(el._x_doShow=()=>{},el._x_doHide=()=>{})};function collapse(el,{modifiers}){let duration=modifierValue(modifiers,"duration",250)/1e3,floor=modifierValue(modifiers,"min",0),fullyHide=!modifiers.includes("min");el._x_isShown||(el.style.height=`${floor}px`),!el._x_isShown&&fullyHide&&(el.hidden=!0),el._x_isShown||(el.style.overflow="hidden");let setFunction=(el2,styles)=>{let revertFunction=Alpine.setStyles(el2,styles);return styles.height?()=>{}:revertFunction},transitionStyles={transitionProperty:"height",transitionDuration:`${duration}s`,transitionTimingFunction:"cubic-bezier(0.4, 0.0, 0.2, 1)"};el._x_transition={in(before=()=>{},after=()=>{}){fullyHide&&(el.hidden=!1),fullyHide&&(el.style.display=null);let current=el.getBoundingClientRect().height;el.style.height="auto";let full=el.getBoundingClientRect().height;current===full&&(current=floor),Alpine.transition(el,Alpine.setStyles,{during:transitionStyles,start:{height:current+"px"},end:{height:full+"px"}},()=>el._x_isShown=!0,()=>{el.style.height==`${full}px`&&(el.style.overflow=null)})},out(before=()=>{},after=()=>{}){let full=el.getBoundingClientRect().height;Alpine.transition(el,setFunction,{during:transitionStyles,start:{height:full+"px"},end:{height:floor+"px"}},()=>el.style.overflow="hidden",()=>{el._x_isShown=!1,el.style.height==`${floor}px`&&fullyHide&&(el.style.display="none",el.hidden=!0)})}}}}function modifierValue(modifiers,key,fallback){if(modifiers.indexOf(key)===-1)return fallback;let rawValue=modifiers[modifiers.indexOf(key)+1];if(!rawValue)return fallback;if(key==="duration"){let match=rawValue.match(/([0-9]+)ms/);if(match)return match[1]}if(key==="min"){let match=rawValue.match(/([0-9]+)px/);if(match)return match[1]}return rawValue}var module_default=src_default;document.addEventListener("alpine:init",()=>{window.Alpine.plugin(module_default)});})();
|
||||
@@ -0,0 +1,5 @@
|
||||
import Collapse from '@alpinejs/collapse'
|
||||
|
||||
document.addEventListener('alpine:init', () => {
|
||||
window.Alpine.plugin(Collapse)
|
||||
})
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace Filament\Tables;
|
||||
|
||||
use Filament\Support\Assets\Js;
|
||||
use Filament\Support\PluginServiceProvider;
|
||||
use Filament\Tables\Testing\TestsActions;
|
||||
use Filament\Tables\Testing\TestsBulkActions;
|
||||
use Filament\Tables\Testing\TestsColumns;
|
||||
@@ -10,19 +12,29 @@ use Filament\Tables\Testing\TestsRecords;
|
||||
use Filament\Tables\Testing\TestsSummaries;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Livewire\Testing\TestableLivewire;
|
||||
use Spatie\LaravelPackageTools\Package;
|
||||
use Spatie\LaravelPackageTools\PackageServiceProvider;
|
||||
|
||||
class TablesServiceProvider extends PackageServiceProvider
|
||||
class TablesServiceProvider extends PluginServiceProvider
|
||||
{
|
||||
public function configurePackage(Package $package): void
|
||||
public static string $name = 'filament-tables';
|
||||
|
||||
public function packageBooted(): void
|
||||
{
|
||||
$package
|
||||
->name('filament-tables')
|
||||
->hasCommands($this->getCommands())
|
||||
->hasConfigFile()
|
||||
->hasTranslations()
|
||||
->hasViews();
|
||||
parent::packageBooted();
|
||||
|
||||
if ($this->app->runningInConsole()) {
|
||||
foreach (app(Filesystem::class)->files(__DIR__ . '/../stubs/') as $file) {
|
||||
$this->publishes([
|
||||
$file->getRealPath() => base_path("stubs/filament/{$file->getFilename()}"),
|
||||
], 'tables-stubs');
|
||||
}
|
||||
}
|
||||
|
||||
TestableLivewire::mixin(new TestsActions());
|
||||
TestableLivewire::mixin(new TestsBulkActions());
|
||||
TestableLivewire::mixin(new TestsColumns());
|
||||
TestableLivewire::mixin(new TestsFilters());
|
||||
TestableLivewire::mixin(new TestsRecords());
|
||||
TestableLivewire::mixin(new TestsSummaries());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,21 +62,18 @@ class TablesServiceProvider extends PackageServiceProvider
|
||||
return array_merge($commands, $aliases);
|
||||
}
|
||||
|
||||
public function packageBooted(): void
|
||||
protected function getAssetPackage(): ?string
|
||||
{
|
||||
if ($this->app->runningInConsole()) {
|
||||
foreach (app(Filesystem::class)->files(__DIR__ . '/../stubs/') as $file) {
|
||||
$this->publishes([
|
||||
$file->getRealPath() => base_path("stubs/filament/{$file->getFilename()}"),
|
||||
], 'tables-stubs');
|
||||
}
|
||||
}
|
||||
return 'tables';
|
||||
}
|
||||
|
||||
TestableLivewire::mixin(new TestsActions());
|
||||
TestableLivewire::mixin(new TestsBulkActions());
|
||||
TestableLivewire::mixin(new TestsColumns());
|
||||
TestableLivewire::mixin(new TestsFilters());
|
||||
TestableLivewire::mixin(new TestsRecords());
|
||||
TestableLivewire::mixin(new TestsSummaries());
|
||||
/**
|
||||
* @return array<Asset>
|
||||
*/
|
||||
protected function getAssets(): array
|
||||
{
|
||||
return [
|
||||
Js::make('tables', __DIR__ . '/../dist/index.js'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user