Skip to content

Commit c118bbf

Browse files
committed
refactor(visual-editor): Extract to standalone package for future separation
Move visual editor from integrated module to separate package at packages/inspirecms-visual-editor for potential repository separation. - Move all source files with updated namespace (SolutionForest\InspireCmsVisualEditor) - Create standalone config/visual-editor.php - Create package composer.json with proper dependencies - Update view namespace from inspirecms:: to visual-editor:: - Remove visual editor registration from core InspireCmsServiceProvider - Add path repository reference in core composer.json
1 parent 212cb5a commit c118bbf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+394
-280
lines changed

composer.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"phiki/phiki": "^1.1",
3131
"solution-forest/filament-field-group": "^2.0",
3232
"solution-forest/inspirecms-support": "self.version",
33+
"solution-forest/inspirecms-visual-editor": "self.version",
3334
"spatie/laravel-package-tools": "^1.15.0",
3435
"spatie/laravel-permission": "^6.0"
3536
},
@@ -106,6 +107,15 @@
106107
"solution-forest/inspirecms-support": "dev-main"
107108
}
108109
}
110+
},
111+
{
112+
"type": "path",
113+
"url": "packages/inspirecms-visual-editor",
114+
"options": {
115+
"versions": {
116+
"solution-forest/inspirecms-visual-editor": "dev-main"
117+
}
118+
}
109119
}
110120
]
111121
}

config/inspirecms.php

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -475,68 +475,4 @@
475475
'available_locales' => ['en', 'fr', 'zh_CN', 'zh_TW', 'es', 'ja', 'de'],
476476
'user_preferred_locales' => ['en', 'zh_CN', 'zh_TW'],
477477
],
478-
479-
/*
480-
|--------------------------------------------------------------------------
481-
| Visual Editor Configuration
482-
|--------------------------------------------------------------------------
483-
|
484-
| Settings for the visual page builder with AI-powered layout generation.
485-
|
486-
*/
487-
'visual_editor' => [
488-
489-
/**
490-
* Whether the visual editor feature is enabled
491-
*/
492-
'enabled' => true,
493-
494-
/**
495-
* AI Provider Configuration
496-
*
497-
* Configure AI providers for layout generation.
498-
* Supported providers: 'openai', 'anthropic'
499-
*/
500-
'ai' => [
501-
'provider' => env('INSPIRECMS_AI_PROVIDER', 'anthropic'),
502-
503-
'openai' => [
504-
'api_key' => env('OPENAI_API_KEY'),
505-
'base_url' => env('OPENAI_BASE_URL', 'https://api.openai.com/v1'),
506-
'model' => env('OPENAI_MODEL', 'gpt-4-turbo-preview'),
507-
],
508-
509-
'anthropic' => [
510-
'api_key' => env('ANTHROPIC_API_KEY'),
511-
'base_url' => env('ANTHROPIC_BASE_URL', 'https://api.anthropic.com/v1'),
512-
'model' => env('ANTHROPIC_MODEL', 'claude-3-sonnet-20240229'),
513-
],
514-
],
515-
516-
/**
517-
* Additional custom block types to register
518-
*
519-
* Add your custom block classes here.
520-
* Each class must implement BlockInterface.
521-
*/
522-
'blocks' => [
523-
// \App\VisualEditor\Blocks\CustomBlock::class,
524-
],
525-
526-
/**
527-
* Block templates storage
528-
*/
529-
'block_templates' => [
530-
'disk' => 'public',
531-
'directory' => 'visual-editor/templates',
532-
],
533-
534-
/**
535-
* Media storage for visual editor
536-
*/
537-
'media' => [
538-
'disk' => 'public',
539-
'directory' => 'visual-editor',
540-
],
541-
],
542478
];
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
"name": "solution-forest/inspirecms-visual-editor",
3+
"description": "Visual page builder with AI-powered layout generation for InspireCMS. Build beautiful pages with drag-and-drop blocks, similar to Elementor, Builder.io, and Webflow.",
4+
"keywords": [
5+
"solution-forest",
6+
"laravel",
7+
"filament",
8+
"inspirecms",
9+
"visual-editor",
10+
"page-builder",
11+
"drag-drop",
12+
"ai",
13+
"layout-generator"
14+
],
15+
"homepage": "https://github.com/solutionforest/inspirecms-visual-editor",
16+
"support": {
17+
"issues": "https://github.com/solutionforest/inspirecms-visual-editor/issues",
18+
"source": "https://github.com/solutionforest/inspirecms-visual-editor"
19+
},
20+
"license": "MIT",
21+
"authors": [
22+
{
23+
"name": "Solution Forest",
24+
"email": "info@solutionforest.net"
25+
}
26+
],
27+
"require": {
28+
"php": ">=8.2",
29+
"filament/filament": "^3.3",
30+
"laravel/framework": "^11.0|^12.0",
31+
"livewire/livewire": "^3.0",
32+
"spatie/laravel-package-tools": "^1.15.0"
33+
},
34+
"require-dev": {
35+
"orchestra/testbench": "^9.0|^10.0",
36+
"pestphp/pest": "^3.0"
37+
},
38+
"autoload": {
39+
"psr-4": {
40+
"SolutionForest\\InspireCmsVisualEditor\\": "src/"
41+
}
42+
},
43+
"autoload-dev": {
44+
"psr-4": {
45+
"SolutionForest\\InspireCmsVisualEditor\\Tests\\": "tests/"
46+
}
47+
},
48+
"scripts": {
49+
"test": "pest"
50+
},
51+
"config": {
52+
"sort-packages": true,
53+
"allow-plugins": {
54+
"pestphp/pest-plugin": true
55+
}
56+
},
57+
"extra": {
58+
"laravel": {
59+
"providers": [
60+
"SolutionForest\\InspireCmsVisualEditor\\VisualEditorServiceProvider"
61+
]
62+
}
63+
},
64+
"minimum-stability": "stable",
65+
"prefer-stable": true
66+
}
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
<?php
2+
3+
return [
4+
5+
/*
6+
|--------------------------------------------------------------------------
7+
| Visual Editor Configuration
8+
|--------------------------------------------------------------------------
9+
|
10+
| Settings for the visual page builder with AI-powered layout generation.
11+
|
12+
*/
13+
14+
/**
15+
* Whether the visual editor feature is enabled
16+
*/
17+
'enabled' => true,
18+
19+
/**
20+
* AI Provider Configuration
21+
*
22+
* Configure AI providers for layout generation.
23+
* Supported providers: 'openai', 'anthropic'
24+
*/
25+
'ai' => [
26+
'provider' => env('INSPIRECMS_AI_PROVIDER', 'anthropic'),
27+
28+
'openai' => [
29+
'api_key' => env('OPENAI_API_KEY'),
30+
'base_url' => env('OPENAI_BASE_URL', 'https://api.openai.com/v1'),
31+
'model' => env('OPENAI_MODEL', 'gpt-4-turbo-preview'),
32+
],
33+
34+
'anthropic' => [
35+
'api_key' => env('ANTHROPIC_API_KEY'),
36+
'base_url' => env('ANTHROPIC_BASE_URL', 'https://api.anthropic.com/v1'),
37+
'model' => env('ANTHROPIC_MODEL', 'claude-3-sonnet-20240229'),
38+
],
39+
],
40+
41+
/**
42+
* Database table prefix
43+
*
44+
* Prefix for all visual editor database tables.
45+
* Set to null to use no prefix.
46+
*/
47+
'table_prefix' => 'cms_',
48+
49+
/**
50+
* Additional custom block types to register
51+
*
52+
* Add your custom block classes here.
53+
* Each class must implement BlockInterface.
54+
*/
55+
'blocks' => [
56+
// \App\VisualEditor\Blocks\CustomBlock::class,
57+
],
58+
59+
/**
60+
* Block templates storage
61+
*/
62+
'block_templates' => [
63+
'disk' => 'public',
64+
'directory' => 'visual-editor/templates',
65+
],
66+
67+
/**
68+
* Media storage for visual editor
69+
*/
70+
'media' => [
71+
'disk' => 'public',
72+
'directory' => 'visual-editor',
73+
],
74+
75+
/**
76+
* History settings
77+
*/
78+
'history' => [
79+
'max_undo_steps' => 50,
80+
'auto_save_interval' => 30, // seconds
81+
],
82+
83+
/**
84+
* Preview settings
85+
*/
86+
'preview' => [
87+
'breakpoints' => [
88+
'desktop' => 1200,
89+
'tablet' => 768,
90+
'mobile' => 375,
91+
],
92+
],
93+
94+
];

database/migrations/create_visual_editor_tables.php.stub renamed to packages/inspirecms-visual-editor/database/migrations/create_visual_editor_tables.php.stub

File renamed without changes.

resources/lang/en/visual-editor.php renamed to packages/inspirecms-visual-editor/resources/lang/en/visual-editor.php

File renamed without changes.

resources/views/visual-editor/components/layer-node.blade.php renamed to packages/inspirecms-visual-editor/resources/views/components/layer-node.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class="p-1 text-gray-400 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-90
7676
@if($node['isContainer'] && !empty($node['children']))
7777
<div x-show="isExpanded('{{ $node['id'] }}')" x-collapse>
7878
@foreach($node['children'] as $child)
79-
@include('inspirecms::visual-editor.components.layer-node', ['node' => $child, 'depth' => $depth + 1])
79+
@include('visual-editor::components.layer-node', ['node' => $child, 'depth' => $depth + 1])
8080
@endforeach
8181
</div>
8282
@endif

resources/views/visual-editor/filament/visual-editor-field.blade.php renamed to packages/inspirecms-visual-editor/resources/views/filament/visual-editor-field.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class="absolute top-4 right-4 z-10 p-2 bg-gray-100 dark:bg-gray-800 rounded-lg h
102102

103103
{{-- Embedded Editor --}}
104104
<div class="h-full">
105-
<livewire:inspirecms-visual-editor
105+
<livewire:visual-editor
106106
:initial-data="$getInitialData()"
107107
:layout-id="$getLayoutId()"
108108
wire:key="visual-editor-{{ $getStatePath() }}"

resources/views/visual-editor/livewire/ai-assistant.blade.php renamed to packages/inspirecms-visual-editor/resources/views/livewire/ai-assistant.blade.php

File renamed without changes.

resources/views/visual-editor/livewire/block-panel.blade.php renamed to packages/inspirecms-visual-editor/resources/views/livewire/block-panel.blade.php

File renamed without changes.

0 commit comments

Comments
 (0)