-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 8413253
Showing
31 changed files
with
785 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.DS_Store | ||
.idea | ||
.phpunit.result.cache | ||
.vscode | ||
build | ||
composer.lock | ||
coverage | ||
docs | ||
node_modules | ||
phpunit.xml | ||
phpstan.neon | ||
testbench.yaml | ||
vendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Changelog | ||
|
||
All notable changes to `filament-grapesjs-v3` will be documented in this file. | ||
|
||
## 1.0.0 - 202X-XX-XX | ||
|
||
- initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) dotswan <tech@dotswan.com> | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# Filament Grapesjs V3 | ||
|
||
[![Latest Version on Packagist][ico-version]][link-packagist] | ||
[![Total Downloads][ico-downloads]][link-downloads] | ||
[![Software License][ico-license]][link-license] | ||
|
||
|
||
![image](https://github.com/dotswan/filament-grapesjs/assets/20874565/f53caf37-d229-412a-8cb7-ab851590640c) | ||
|
||
## Introduction | ||
|
||
This package extends Filament to include a field type called Grapesjs, leveraging the Grapesjs library to enable visual editing of HTML codes within the Filament components. It allows users to interactively design and incorporate HTML elements via drag-and-drop functionality. | ||
|
||
|
||
* Features include: | ||
* Integration of the Grapesjs library into Filament components. | ||
* Drag-and-drop functionality for visually designing HTML elements. | ||
* Simplified HTML code editing within Filament. | ||
* Latest versions of PHP and Filament | ||
* Best practices applied: | ||
* [`README.md`][link-readme] (badges included) | ||
* [`LICENSE`][link-license] | ||
* [`composer.json`][link-composer-json] | ||
* [`.gitignore`][link-gitignore] | ||
* [`pint.json`][link-pint] | ||
|
||
## Installation | ||
|
||
You can easily install the package via Composer: | ||
|
||
```bash | ||
composer require dotswan/filament-grapesjs-v3 | ||
``` | ||
|
||
## Basic Usage | ||
|
||
Resource file: | ||
|
||
```php | ||
<?php | ||
namespace App\Filament\Resources; | ||
use Filament\Resources\Resource; | ||
use Filament\Resources\Forms\Form; | ||
use Dotswan\FilamentGrapesjs\Fields\GrapesJs; | ||
... | ||
|
||
class FilamentResource extends Resource | ||
{ | ||
... | ||
public static function form(Form $form) | ||
{ | ||
return $form->schema([ | ||
GrapesJs::make('page_layout') | ||
->id('page_layout'), | ||
]); | ||
} | ||
... | ||
} | ||
``` | ||
|
||
## License | ||
|
||
[MIT License](LICENSE.md) © Dotswan | ||
|
||
## Security | ||
|
||
We take security seriously. If you discover any bugs or security issues, please help us maintain a secure project by reporting them through our [`GitHub issue tracker`][link-github-issue]. You can also contact us directly at [tech@dotswan.com](mailto:tech@dotswan.com). | ||
|
||
## Contribution | ||
|
||
We welcome contributions! contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated. | ||
|
||
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again! | ||
|
||
1. Fork the Project | ||
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`) | ||
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`) | ||
4. Push to the Branch (`git push origin feature/AmazingFeature`) | ||
5. Open a Pull Request | ||
|
||
|
||
[ico-version]: https://img.shields.io/packagist/v/dotswan/filament-grapesjs-v3.svg?style=flat-square | ||
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square | ||
[ico-downloads]: https://img.shields.io/packagist/dt/dotswan/filament-grapesjs-v3.svg?style=flat-square | ||
|
||
[link-packagist]: https://packagist.org/packages/dotswan/filament-grapesjs-v3 | ||
[link-license]: https://github.com/dotswan/filament-grapesjs-v3/blob/master/LICENSE.md | ||
[link-downloads]: https://packagist.org/packages/dotswan/filament-grapesjs-v3 | ||
[link-readme]: https://github.com/dotswan/filament-grapesjs-v3/blob/master/README.md | ||
[link-github-issue]: https://github.com/dotswan/filament-grapesjs-v3/issues | ||
[link-composer-json]: https://github.com/dotswan/filament-grapesjs-v3/blob/master/composer.json | ||
[link-gitignore]: https://github.com/dotswan/filament-grapesjs-v3/blob/master/.gitignore | ||
[link-pint]: https://github.com/dotswan/filament-grapesjs-v3/blob/master/pint.json | ||
[link-author]: https://github.com/dotswan |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import esbuild from 'esbuild' | ||
|
||
const isDev = process.argv.includes('--dev') | ||
|
||
async function compile(options) { | ||
const context = await esbuild.context(options) | ||
|
||
if (isDev) { | ||
await context.watch() | ||
} else { | ||
await context.rebuild() | ||
await context.dispose() | ||
} | ||
} | ||
|
||
const defaultOptions = { | ||
define: { | ||
'process.env.NODE_ENV': isDev ? `'development'` : `'production'`, | ||
}, | ||
bundle: true, | ||
mainFields: ['module', 'main'], | ||
platform: 'neutral', | ||
sourcemap: isDev ? 'inline' : false, | ||
sourcesContent: isDev, | ||
treeShaking: true, | ||
target: ['es2020'], | ||
minify: !isDev, | ||
plugins: [{ | ||
name: 'watchPlugin', | ||
setup: function (build) { | ||
build.onStart(() => { | ||
console.log(`Build started at ${new Date(Date.now()).toLocaleTimeString()}: ${build.initialOptions.outfile}`) | ||
}) | ||
|
||
build.onEnd((result) => { | ||
if (result.errors.length > 0) { | ||
console.log(`Build failed at ${new Date(Date.now()).toLocaleTimeString()}: ${build.initialOptions.outfile}`, result.errors) | ||
} else { | ||
console.log(`Build finished at ${new Date(Date.now()).toLocaleTimeString()}: ${build.initialOptions.outfile}`) | ||
} | ||
}) | ||
} | ||
}], | ||
} | ||
|
||
compile({ | ||
...defaultOptions, | ||
entryPoints: ['./resources/js/index.js'], | ||
outfile: './resources/dist/js/filament-grapesjs.js', | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
{ | ||
"name": "dotswan/filament-grapesjs-v3", | ||
"description": "", | ||
"keywords": [ | ||
"dotswan", | ||
"laravel", | ||
"filament-grapesjs-v3" | ||
], | ||
"homepage": "https://github.com/dotswan/filament-grapesjs-v3", | ||
"support": { | ||
"issues": "https://github.com/dotswan/filament-grapesjs-v3/issues", | ||
"source": "https://github.com/dotswan/filament-grapesjs-v3" | ||
}, | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Dotswan", | ||
"email": "tech@dotswan.com", | ||
"role": "Developer" | ||
} | ||
], | ||
"require": { | ||
"php": "^8.1", | ||
"filament/filament": "^3.0", | ||
"spatie/laravel-package-tools": "^1.15.0", | ||
"illuminate/contracts": "^10.0" | ||
}, | ||
"require-dev": { | ||
"laravel/pint": "^1.0", | ||
"nunomaduro/collision": "^7.9", | ||
"nunomaduro/larastan": "^2.0.1", | ||
"orchestra/testbench": "^8.0", | ||
"pestphp/pest": "^2.0", | ||
"pestphp/pest-plugin-arch": "^2.0", | ||
"pestphp/pest-plugin-laravel": "^2.0", | ||
"phpstan/extension-installer": "^1.1", | ||
"phpstan/phpstan-deprecation-rules": "^1.0", | ||
"phpstan/phpstan-phpunit": "^1.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Dotswan\\FilamentGrapesjs\\": "src/", | ||
"Dotswan\\FilamentGrapesjs\\Database\\Factories\\": "database/factories/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Dotswan\\FilamentGrapesjs\\Tests\\": "tests/" | ||
} | ||
}, | ||
"scripts": { | ||
"post-autoload-dump": "@php ./vendor/bin/testbench package:discover --ansi", | ||
"analyse": "vendor/bin/phpstan analyse", | ||
"test": "vendor/bin/pest", | ||
"test-coverage": "vendor/bin/pest --coverage", | ||
"format": "vendor/bin/pint" | ||
}, | ||
"config": { | ||
"sort-packages": true, | ||
"allow-plugins": { | ||
"pestphp/pest-plugin": true, | ||
"phpstan/extension-installer": true | ||
} | ||
}, | ||
"extra": { | ||
"laravel": { | ||
"providers": [ | ||
"Dotswan\\FilamentGrapesjs\\FilamentGrapesjsServiceProvider" | ||
], | ||
"aliases": { | ||
"FilamentGrapesjs": "Dotswan\\FilamentGrapesjs\\Facades\\FilamentGrapesjs" | ||
} | ||
} | ||
}, | ||
"minimum-stability": "dev", | ||
"prefer-stable": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
// config for Dotswan/FilamentGrapesjs | ||
return [ | ||
|
||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"private": true, | ||
"type": "module", | ||
"scripts": { | ||
"dev:styles": "npx tailwindcss -i resources/css/index.css -o resources/dist/filament-grapesjs.css --postcss --watch", | ||
"dev:scripts": "node bin/build.js --dev", | ||
"build:styles": "npx tailwindcss -i resources/css/index.css -o resources/dist/css/filament-grapesjs.css --postcss --minify", | ||
"build:scripts": "node bin/build.js", | ||
"purge": "filament-purge -i resources/dist/filament-grapesjs.css -o resources/dist/filament-grapesjs.css -v 3.x", | ||
"dev": "npm-run-all --parallel dev:*", | ||
"build": "npm-run-all build:*" | ||
}, | ||
"devDependencies": { | ||
"@awcodes/filament-plugin-purge": "^1.1.1", | ||
"@tailwindcss/forms": "^0.5.4", | ||
"@tailwindcss/typography": "^0.5.9", | ||
"autoprefixer": "^10.4.14", | ||
"esbuild": "^0.19.2", | ||
"npm-run-all": "^4.1.5", | ||
"postcss": "^8.4.26", | ||
"postcss-assets": "^6.0.0", | ||
"postcss-import": "^15.1.0", | ||
"postcss-url": "^10.1.3", | ||
"prettier": "^2.7.1", | ||
"prettier-plugin-tailwindcss": "^0.1.13", | ||
"tailwindcss": "^3.3.3" | ||
}, | ||
"dependencies": { | ||
"grapesjs": "^0.21.7", | ||
"grapesjs-tailwind": "^1.0.10" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
includes: | ||
- phpstan-baseline.neon | ||
|
||
parameters: | ||
level: 4 | ||
paths: | ||
- src | ||
- config | ||
- database | ||
tmpDir: build/phpstan | ||
checkOctaneCompatibility: true | ||
checkModelProperties: true | ||
checkMissingIterableValueType: false | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd" | ||
backupGlobals="false" | ||
bootstrap="vendor/autoload.php" | ||
colors="true" | ||
processIsolation="false" | ||
stopOnFailure="false" | ||
executionOrder="random" | ||
failOnWarning="true" | ||
failOnRisky="true" | ||
failOnEmptyTestSuite="true" | ||
beStrictAboutOutputDuringTests="true" | ||
cacheDirectory=".phpunit.cache" | ||
backupStaticProperties="false" | ||
> | ||
<testsuites> | ||
<testsuite name="Dotswan Test Suite"> | ||
<directory>tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
<coverage> | ||
<report> | ||
<html outputDirectory="build/coverage"/> | ||
<text outputFile="build/coverage.txt"/> | ||
<clover outputFile="build/logs/clover.xml"/> | ||
</report> | ||
</coverage> | ||
<logging> | ||
<junit outputFile="build/report.junit.xml"/> | ||
</logging> | ||
<source> | ||
<include> | ||
<directory suffix=".php">./src</directory> | ||
</include> | ||
</source> | ||
</phpunit> |
Oops, something went wrong.