MarcRyan commited on
Commit
7b894c1
·
verified ·
1 Parent(s): 4a2d87a

Add 2 files

Browse files
Files changed (2) hide show
  1. index.html +840 -945
  2. prompts.txt +3 -1
index.html CHANGED
@@ -3,7 +3,7 @@
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>DeepSeek Visual Builder with APWB Integration</title>
7
  <script src="https://cdn.tailwindcss.com"></script>
8
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
  <style>
@@ -225,6 +225,47 @@
225
  @apply mt-4 p-3 bg-gray-50 rounded-md text-sm whitespace-pre-wrap;
226
  }
227
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
228
  .model-selector {
229
  @apply flex items-center space-x-2 bg-gray-100 rounded-md px-3 py-1.5;
230
  }
@@ -254,6 +295,133 @@
254
  .tab-content.active {
255
  @apply block;
256
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
257
  </style>
258
  </head>
259
  <body class="h-screen flex flex-col overflow-hidden">
@@ -264,13 +432,21 @@
264
  <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
265
  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" />
266
  </svg>
267
- <h1 class="text-xl font-bold">DeepSeek + APWB Builder</h1>
268
  </div>
269
  <div class="flex items-center space-x-3">
270
  <button id="aiPromptBtn" class="flex items-center space-x-1 bg-white/10 hover:bg-white/20 px-3 py-1.5 rounded-md text-sm font-medium transition-colors">
271
  <i class="fas fa-robot"></i>
272
  <span>AI Builder</span>
273
  </button>
 
 
 
 
 
 
 
 
274
  <button id="saveBtn" class="flex items-center space-x-1 bg-white/10 hover:bg-white/20 px-3 py-1.5 rounded-md text-sm font-medium transition-colors">
275
  <i class="fas fa-save"></i>
276
  <span>Save</span>
@@ -299,12 +475,16 @@
299
  <select id="modelSelector">
300
  <option value="apwb">APWB</option>
301
  <option value="deepseek">DeepSeek</option>
 
 
302
  </select>
303
  </div>
304
  </div>
305
  <div class="mt-2 flex space-x-1">
306
  <button class="tab-btn active" data-tab="components">Components</button>
307
  <button class="tab-btn" data-tab="apwb">APWB</button>
 
 
308
  </div>
309
  </div>
310
 
@@ -387,6 +567,17 @@
387
  </div>
388
  </div>
389
  </div>
 
 
 
 
 
 
 
 
 
 
 
390
  </div>
391
 
392
  <!-- APWB Tab -->
@@ -409,6 +600,75 @@
409
  </div>
410
  </div>
411
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
412
  </div>
413
 
414
  <!-- Divider -->
@@ -529,6 +789,418 @@
529
  </div>
530
  </div>
531
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
532
  <script>
533
  document.addEventListener('DOMContentLoaded', function() {
534
  // Global variables
@@ -540,6 +1212,9 @@
540
  let startX, startY, startWidth, startHeight;
541
  let isDraggingDivider = false;
542
  let activeModel = 'apwb'; // Default to APWB model
 
 
 
543
 
544
  // DOM elements
545
  const canvas = document.getElementById('canvas');
@@ -581,6 +1256,88 @@
581
  const apwbResponse = document.getElementById('apwbResponse');
582
  const apwbLoading = document.getElementById('apwbLoading');
583
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
584
  // Split view elements
585
  const splitContainer = document.querySelector('.split-container');
586
  const leftPanel = document.querySelector('.split-panel:first-child');
@@ -593,6 +1350,10 @@
593
  initEventListeners();
594
  initAIEventListeners();
595
  initAPWBEventListeners();
 
 
 
 
596
  initSplitView();
597
  loadFromLocalStorage();
598
  }
@@ -624,7 +1385,7 @@
624
  exportBtn.addEventListener('click', showExportModal);
625
  closeExport.addEventListener('click', hideExportModal);
626
  copyCodeBtn.addEventListener('click', copyExportCode);
627
- downloadBtn.addEventListener('click', downloadHTML);
628
 
629
  // Device selector
630
  deviceSelector.addEventListener('change', updatePreviewDevice);
@@ -644,7 +1405,7 @@
644
  // Model selector
645
  modelSelector.addEventListener('change', (e) => {
646
  activeModel = e.target.value;
647
- showToast(`Switched to ${activeModel === 'apwb' ? 'APWB' : 'DeepSeek'} model`);
648
  });
649
  }
650
 
@@ -672,967 +1433,101 @@
672
  });
673
  }
674
 
675
- // Initialize split view functionality
676
- function initSplitView() {
677
- dividers.forEach(divider => {
678
- divider.addEventListener('mousedown', (e) => {
679
- isDraggingDivider = true;
680
- document.body.style.cursor = 'col-resize';
681
- document.addEventListener('mousemove', handleDividerDrag);
682
- document.addEventListener('mouseup', () => {
683
- isDraggingDivider = false;
684
- document.body.style.cursor = '';
685
- document.removeEventListener('mousemove', handleDividerDrag);
 
 
 
 
686
  });
 
 
687
  });
688
  });
689
- }
690
-
691
- // Handle divider dragging
692
- function handleDividerDrag(e) {
693
- if (!isDraggingDivider) return;
694
-
695
- const containerRect = splitContainer.getBoundingClientRect();
696
- const divider = dividers[0]; // First divider for left panel
697
- const dividerRect = divider.getBoundingClientRect();
698
-
699
- // Calculate new width for left panel
700
- const newLeftWidth = e.clientX - containerRect.left;
701
-
702
- // Apply minimum and maximum widths
703
- const minWidth = 200;
704
- const maxWidth = containerRect.width * 0.5;
705
-
706
- if (newLeftWidth >= minWidth && newLeftWidth <= maxWidth) {
707
- leftPanel.style.width = `${newLeftWidth}px`;
708
- }
709
- }
710
-
711
- // Show AI Modal
712
- function showAIModal() {
713
- aiModal.classList.remove('hidden');
714
- aiPrompt.focus();
715
- }
716
-
717
- // Hide AI Modal
718
- function hideAIModal() {
719
- aiModal.classList.add('hidden');
720
- aiResponse.classList.add('hidden');
721
- aiLoading.classList.add('hidden');
722
- aiGeneratedComponents.classList.add('hidden');
723
- aiResponse.textContent = '';
724
- aiPrompt.value = '';
725
- aiComponentsList.innerHTML = '';
726
- }
727
-
728
- // Generate with APWB model
729
- function generateWithAPWB() {
730
- const prompt = apwbPrompt.value.trim();
731
- if (!prompt) {
732
- showToast('Please enter a description for the APWB model');
733
- return;
734
- }
735
-
736
- apwbResponse.classList.add('hidden');
737
- apwbLoading.classList.remove('hidden');
738
 
739
- // Simulate API call to APWB model
740
- setTimeout(() => {
741
- const response = simulateAPWBResponse(prompt);
742
- displayAPWBResponse(response);
743
- }, 1500);
744
- }
745
-
746
- // Simulate APWB response (in a real app, this would be an API call)
747
- function simulateAPWBResponse(prompt) {
748
- // This is a simulation - in a real app, you would call the APWB API
749
- const responses = [
750
- `Here's a hero section based on your description:\n\n` +
751
- `{\n "type": "hero",\n "props": {\n "bgColor": "primary",\n "textColor": "white",\n "title": "Welcome to Our Platform",\n "subtitle": "Build amazing websites with our tools",\n "buttonText": "Get Started",\n "buttonColor": "white",\n "buttonTextColor": "primary"\n }\n}`,
752
-
753
- `I've created a feature section for you:\n\n` +
754
- `{\n "type": "features",\n "props": {\n "bgColor": "gray-50",\n "title": "Key Features",\n "features": [\n {\n "title": "Easy to Use",\n "description": "Intuitive drag and drop interface",\n "icon": "fa-rocket"\n },\n {\n "title": "Responsive",\n "description": "Works on all devices",\n "icon": "fa-mobile"\n },\n {\n "title": "Customizable",\n "description": "Tailor every aspect to your needs",\n "icon": "fa-cog"\n }\n ]\n }\n}`,
755
-
756
- `Based on your request, here's a call to action section:\n\n` +
757
- `{\n "type": "cta",\n "props": {\n "bgColor": "primary/10",\n "title": "Ready to get started?",\n "subtitle": "Sign up today and get 30 days free trial",\n "buttonText": "Sign Up Now",\n "buttonColor": "primary",\n "buttonTextColor": "white"\n }\n}`
758
- ];
759
 
760
- // Return a random response for simulation
761
- return responses[Math.floor(Math.random() * responses.length)];
762
- }
763
-
764
- // Display APWB response
765
- function displayAPWBResponse(response) {
766
- apwbLoading.classList.add('hidden');
767
- apwbResponse.classList.remove('hidden');
768
- apwbResponse.textContent = response;
769
 
770
- // Try to parse the JSON part of the response
771
- try {
772
- const jsonStart = response.indexOf('{');
773
- const jsonEnd = response.lastIndexOf('}') + 1;
774
- const jsonString = response.substring(jsonStart, jsonEnd);
775
- const componentData = JSON.parse(jsonString);
776
-
777
- // Add a button to add this component to canvas
778
- const addButton = document.createElement('button');
779
- addButton.className = 'mt-3 bg-primary text-white px-3 py-1.5 rounded-md text-sm font-medium';
780
- addButton.innerHTML = '<i class="fas fa-plus mr-1"></i> Add to Canvas';
781
- addButton.addEventListener('click', () => {
782
- addAIComponentToCanvas(componentData);
783
- apwbResponse.classList.add('hidden');
784
- });
785
-
786
- apwbResponse.appendChild(addButton);
787
- } catch (e) {
788
- console.error('Could not parse component from APWB response:', e);
789
- }
790
- }
791
-
792
- // Generate AI components based on prompt
793
- function generateAIComponents() {
794
- const prompt = aiPrompt.value.trim();
795
- if (!prompt) {
796
- showToast('Please enter a description for the AI to generate components');
797
- return;
798
- }
799
-
800
- aiResponse.classList.add('hidden');
801
- aiLoading.classList.remove('hidden');
802
- aiGeneratedComponents.classList.add('hidden');
803
- aiComponentsList.innerHTML = '';
804
-
805
- // Simulate AI processing (in a real app, this would call an API)
806
- setTimeout(() => {
807
- const generatedComponents = processAIPrompt(prompt);
808
- displayAIResults(generatedComponents);
809
- }, 1500);
810
- }
811
-
812
- // Process AI prompt and generate components
813
- function processAIPrompt(prompt) {
814
- // This is a simulation - in a real app, you would call an AI API
815
- const components = [];
816
-
817
- // Check for common component types in the prompt
818
- if (prompt.toLowerCase().includes('hero')) {
819
- components.push({
820
- type: 'hero',
821
- props: {
822
- bgColor: prompt.toLowerCase().includes('dark') ? 'gray-800' : 'primary',
823
- textColor: 'white',
824
- title: 'Your Awesome Headline',
825
- subtitle: 'A compelling subheadline that explains your value proposition',
826
- buttonText: 'Get Started',
827
- buttonColor: 'white',
828
- buttonTextColor: 'primary'
829
- }
830
- });
831
- }
832
-
833
- if (prompt.toLowerCase().includes('feature') || prompt.toLowerCase().includes('benefit')) {
834
- components.push({
835
- type: 'features',
836
- props: {
837
- bgColor: 'gray-50',
838
- title: 'Our Features',
839
- features: [
840
- { title: 'Feature One', description: 'Description of feature one goes here', icon: 'fa-rocket' },
841
- { title: 'Feature Two', description: 'Description of feature two goes here', icon: 'fa-bolt' },
842
- { title: 'Feature Three', description: 'Description of feature three goes here', icon: 'fa-cog' }
843
- ]
844
- }
845
- });
846
- }
847
-
848
- if (prompt.toLowerCase().includes('header') || prompt.toLowerCase().includes('navigation')) {
849
- components.push({
850
- type: 'header',
851
- props: {
852
- bgColor: 'primary',
853
- textColor: 'white',
854
- logoText: 'Your Logo',
855
- links: ['Home', 'About', 'Contact']
856
- }
857
- });
858
- }
859
-
860
- if (prompt.toLowerCase().includes('footer')) {
861
- components.push({
862
- type: 'footer',
863
- props: {
864
- bgColor: 'gray-800',
865
- textColor: 'white',
866
- columns: [
867
- { title: 'Company', links: ['About Us', 'Careers', 'Contact'] },
868
- { title: 'Products', links: ['Features', 'Pricing', 'API'] },
869
- { title: 'Resources', links: ['Documentation', 'Guides', 'Blog'] },
870
- { title: 'Legal', links: ['Privacy', 'Terms', 'Cookie Policy'] }
871
- ],
872
- copyright: '© 2023 Your Company. All rights reserved.'
873
- }
874
- });
875
- }
876
-
877
- if (prompt.toLowerCase().includes('text') || prompt.toLowerCase().includes('paragraph')) {
878
- components.push({
879
- type: 'text',
880
- props: {
881
- title: 'About Us',
882
- content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam in dui mauris. Vivamus hendrerit arcu sed erat molestie vehicula. Sed auctor neque eu tellus rhoncus ut eleifend nibh porttitor.\n\nUt in nulla enim. Phasellus molestie magna non est bibendum non venenatis nisl tempor. Suspendisse dictum feugiat nisl ut dapibus.',
883
- textAlign: 'left'
884
- }
885
- });
886
- }
887
-
888
- if (prompt.toLowerCase().includes('image') || prompt.toLowerCase().includes('photo')) {
889
- components.push({
890
- type: 'image',
891
- props: {
892
- src: 'https://via.placeholder.com/800x400?text=Your+Image',
893
- alt: 'Placeholder image',
894
- rounded: 'lg',
895
- padding: '4'
896
- }
897
- });
898
- }
899
-
900
- if (prompt.toLowerCase().includes('cta') || prompt.toLowerCase().includes('call to action')) {
901
- components.push({
902
- type: 'cta',
903
- props: {
904
- bgColor: 'primary/10',
905
- title: 'Ready to get started?',
906
- subtitle: 'Sign up today and get 30 days free trial',
907
- buttonText: 'Sign Up Now',
908
- buttonColor: 'primary',
909
- buttonTextColor: 'white'
910
- }
911
- });
912
- }
913
-
914
- // If no specific components detected, create a default hero section
915
- if (components.length === 0) {
916
- components.push({
917
- type: 'hero',
918
- props: {
919
- bgColor: 'primary',
920
- textColor: 'white',
921
- title: 'Welcome to Our Site',
922
- subtitle: 'This is a hero section that grabs attention',
923
- buttonText: 'Get Started',
924
- buttonColor: 'white',
925
- buttonTextColor: 'primary'
926
- }
927
- });
928
- }
929
-
930
- return components;
931
- }
932
-
933
- // Display AI generated results
934
- function displayAIResults(generatedComponents) {
935
- aiLoading.classList.add('hidden');
936
- aiGeneratedComponents.classList.remove('hidden');
937
-
938
- // Show AI response
939
- aiResponse.classList.remove('hidden');
940
- aiResponse.textContent = `I've generated ${generatedComponents.length} components based on your description. You can add them to your canvas below.`;
941
-
942
- // List generated components
943
- aiComponentsList.innerHTML = '';
944
-
945
- generatedComponents.forEach((component, index) => {
946
- const componentDiv = document.createElement('div');
947
- componentDiv.className = 'ai-generated-component';
948
-
949
- const componentTitle = document.createElement('h5');
950
- componentTitle.className = 'font-medium';
951
- componentTitle.textContent = `${index + 1}. ${component.type.charAt(0).toUpperCase() + component.type.slice(1)}`;
952
-
953
- const componentPreview = document.createElement('div');
954
- componentPreview.className = 'text-xs text-gray-500 mb-2';
955
- componentPreview.textContent = JSON.stringify(component.props, null, 2);
956
-
957
- const addButton = document.createElement('button');
958
- addButton.className = 'text-xs bg-primary text-white px-2 py-1 rounded hover:bg-primary-dark';
959
- addButton.textContent = 'Add to Canvas';
960
- addButton.addEventListener('click', () => {
961
- addAIComponentToCanvas(component);
962
- hideAIModal();
963
- });
964
-
965
- componentDiv.appendChild(componentTitle);
966
- componentDiv.appendChild(componentPreview);
967
- componentDiv.appendChild(addButton);
968
-
969
- aiComponentsList.appendChild(componentDiv);
970
  });
971
- }
972
-
973
- // Add AI generated component to canvas
974
- function addAIComponentToCanvas(componentData) {
975
- // Create a unique ID for the component
976
- const componentId = `component-${componentCounter++}`;
977
-
978
- // Calculate position (centered on canvas)
979
- const canvasRect = canvas.getBoundingClientRect();
980
- const relativeX = canvasRect.width / 2 - 100;
981
- const relativeY = components.length * 20; // Offset slightly for multiple components
982
-
983
- // Create component wrapper
984
- const componentWrapper = document.createElement('div');
985
- componentWrapper.className = 'canvas-component bg-white';
986
- componentWrapper.id = componentId;
987
- componentWrapper.style.position = 'absolute';
988
- componentWrapper.style.left = `${relativeX}px`;
989
- componentWrapper.style.top = `${relativeY}px`;
990
- componentWrapper.style.width = '100%';
991
-
992
- componentWrapper.innerHTML = `
993
- <div class="component-toolbar">
994
- <div class="component-handle" draggable="true">
995
- <i class="fas fa-grip-vertical mr-1"></i>
996
- <span class="text-xs">${componentData.type}</span>
997
- </div>
998
- <div class="component-actions">
999
- <button class="component-action-btn edit-btn" title="Edit">
1000
- <i class="fas fa-pen"></i>
1001
- </button>
1002
- <button class="component-action-btn delete-btn" title="Delete">
1003
- <i class="fas fa-trash"></i>
1004
- </button>
1005
- </div>
1006
- </div>
1007
- <div class="component-content"></div>
1008
- <div class="resize-handle"></div>
1009
- `;
1010
-
1011
- // Add to canvas
1012
- canvas.appendChild(componentWrapper);
1013
-
1014
- // Store component data
1015
- const component = {
1016
- id: componentId,
1017
- type: componentData.type,
1018
- props: componentData.props,
1019
- position: { x: relativeX, y: relativeY },
1020
- size: { width: '100%', height: 'auto' }
1021
- };
1022
-
1023
- components.push(component);
1024
 
1025
- // Render the component content
1026
- renderComponent(componentId);
1027
 
1028
- // Make draggable
1029
- makeDraggable(componentWrapper, componentId);
1030
-
1031
- // Add event listeners to controls
1032
- componentWrapper.querySelector('.edit-btn').addEventListener('click', () => {
1033
- selectComponent(componentId);
1034
- });
1035
-
1036
- componentWrapper.querySelector('.delete-btn').addEventListener('click', () => {
1037
- deleteComponent(componentId);
1038
  });
1039
-
1040
- // Add resize handle
1041
- const resizeHandle = componentWrapper.querySelector('.resize-handle');
1042
- resizeHandle.addEventListener('mousedown', initResize);
1043
-
1044
- // Select the new component
1045
- selectComponent(componentId);
1046
-
1047
- // Hide empty state if it's visible
1048
- emptyState.style.display = 'none';
1049
-
1050
- showToast('Component added to canvas');
1051
  }
1052
-
1053
- // Load from localStorage
1054
- function loadFromLocalStorage() {
1055
- const savedData = localStorage.getItem('deepseek-builder');
1056
- if (savedData) {
1057
- try {
1058
- const data = JSON.parse(savedData);
1059
- components = data.components || [];
1060
- componentCounter = data.componentCounter || 0;
1061
-
1062
- // Recreate components on canvas
1063
- components.forEach(comp => {
1064
- recreateComponent(comp);
 
 
 
 
 
1065
  });
1066
-
1067
- if (components.length > 0) {
1068
- emptyState.style.display = 'none';
1069
- }
1070
-
1071
- showToast('Previous work loaded');
1072
- } catch (e) {
1073
- console.error('Failed to load saved data:', e);
1074
  }
1075
- }
1076
- }
1077
-
1078
- // Save to localStorage
1079
- function saveToLocalStorage() {
1080
- const data = {
1081
- components: components,
1082
- componentCounter: componentCounter
1083
- };
1084
-
1085
- localStorage.setItem('deepseek-builder', JSON.stringify(data));
1086
- showToast('Progress saved successfully');
1087
- }
1088
-
1089
- // Recreate component from saved data
1090
- function recreateComponent(componentData) {
1091
- const componentWrapper = document.createElement('div');
1092
- componentWrapper.className = 'canvas-component bg-white';
1093
- componentWrapper.id = componentData.id;
1094
- componentWrapper.style.position = 'absolute';
1095
- componentWrapper.style.left = `${componentData.position.x}px`;
1096
- componentWrapper.style.top = `${componentData.position.y}px`;
1097
- componentWrapper.style.width = componentData.size?.width || '100%';
1098
- componentWrapper.style.height = componentData.size?.height || 'auto';
1099
-
1100
- componentWrapper.innerHTML = `
1101
- <div class="component-toolbar">
1102
- <div class="component-handle" draggable="true">
1103
- <i class="fas fa-grip-vertical mr-1"></i>
1104
- <span class="text-xs">${componentData.type}</span>
1105
- </div>
1106
- <div class="component-actions">
1107
- <button class="component-action-btn edit-btn" title="Edit">
1108
- <i class="fas fa-pen"></i>
1109
- </button>
1110
- <button class="component-action-btn delete-btn" title="Delete">
1111
- <i class="fas fa-trash"></i>
1112
- </button>
1113
- </div>
1114
- </div>
1115
- <div class="component-content"></div>
1116
- <div class="resize-handle"></div>
1117
- `;
1118
-
1119
- canvas.appendChild(componentWrapper);
1120
- renderComponent(componentData.id);
1121
-
1122
- // Make draggable
1123
- makeDraggable(componentWrapper, componentData.id);
1124
-
1125
- // Add event listeners to controls
1126
- componentWrapper.querySelector('.edit-btn').addEventListener('click', () => {
1127
- selectComponent(componentData.id);
1128
- });
1129
-
1130
- componentWrapper.querySelector('.delete-btn').addEventListener('click', () => {
1131
- deleteComponent(componentData.id);
1132
- });
1133
-
1134
- // Add resize handle
1135
- const resizeHandle = componentWrapper.querySelector('.resize-handle');
1136
- resizeHandle.addEventListener('mousedown', initResize);
1137
- }
1138
-
1139
- // Drag start handler
1140
- function handleDragStart(e) {
1141
- draggedItem = e.target;
1142
- e.dataTransfer.setData('text/plain', e.target.dataset.type);
1143
- e.target.classList.add('opacity-50', 'scale-95');
1144
-
1145
- // Hide empty state if it's the first component
1146
- emptyState.style.display = 'none';
1147
- }
1148
-
1149
- // Drag end handler
1150
- function handleDragEnd(e) {
1151
- e.target.classList.remove('opacity-50', 'scale-95');
1152
- }
1153
-
1154
- // Drag over handler
1155
- function handleDragOver(e) {
1156
- e.preventDefault();
1157
- canvas.classList.add('highlight');
1158
- }
1159
-
1160
- // Drag leave handler
1161
- function handleDragLeave(e) {
1162
- e.preventDefault();
1163
- canvas.classList.remove('highlight');
1164
- }
1165
-
1166
- // Drop handler
1167
- function handleDrop(e) {
1168
- e.preventDefault();
1169
- canvas.classList.remove('highlight');
1170
-
1171
- const componentType = e.dataTransfer.getData('text/plain');
1172
- createComponent(componentType, e.clientX, e.clientY);
1173
-
1174
- if (draggedItem) {
1175
- draggedItem.classList.remove('opacity-50', 'scale-95');
1176
- draggedItem = null;
1177
- }
1178
- }
1179
-
1180
- // Create a new component on the canvas
1181
- function createComponent(type, x, y) {
1182
- const rect = canvas.getBoundingClientRect();
1183
- const relativeX = x - rect.left;
1184
- const relativeY = y - rect.top;
1185
-
1186
- const componentId = `component-${componentCounter++}`;
1187
- let defaultProps = {};
1188
-
1189
- switch(type) {
1190
- case 'header':
1191
- defaultProps = {
1192
- bgColor: 'primary',
1193
- textColor: 'white',
1194
- logoText: 'Your Logo',
1195
- links: ['Home', 'About', 'Contact']
1196
- };
1197
- break;
1198
-
1199
- case 'hero':
1200
- defaultProps = {
1201
- bgColor: 'primary',
1202
- textColor: 'white',
1203
- title: 'Welcome to Our Site',
1204
- subtitle: 'This is a hero section that grabs attention',
1205
- buttonText: 'Get Started',
1206
- buttonColor: 'white',
1207
- buttonTextColor: 'primary'
1208
- };
1209
- break;
1210
-
1211
- case 'features':
1212
- defaultProps = {
1213
- bgColor: 'gray-50',
1214
- title: 'Our Features',
1215
- features: [
1216
- { title: 'Feature One', description: 'Description of feature one goes here', icon: 'fa-rocket' },
1217
- { title: 'Feature Two', description: 'Description of feature two goes here', icon: 'fa-bolt' },
1218
- { title: 'Feature Three', description: 'Description of feature three goes here', icon: 'fa-cog' }
1219
- ]
1220
- };
1221
- break;
1222
-
1223
- case 'text':
1224
- defaultProps = {
1225
- title: 'Section Title',
1226
- content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam in dui mauris. Vivamus hendrerit arcu sed erat molestie vehicula. Sed auctor neque eu tellus rhoncus ut eleifend nibh porttitor.\n\nUt in nulla enim. Phasellus molestie magna non est bibendum non venenatis nisl tempor. Suspendisse dictum feugiat nisl ut dapibus.',
1227
- textAlign: 'left'
1228
- };
1229
- break;
1230
-
1231
- case 'image':
1232
- defaultProps = {
1233
- src: 'https://via.placeholder.com/800x400?text=Your+Image',
1234
- alt: 'Placeholder image',
1235
- rounded: 'lg',
1236
- padding: '4'
1237
- };
1238
- break;
1239
-
1240
- case 'cta':
1241
- defaultProps = {
1242
- bgColor: 'primary/10',
1243
- title: 'Ready to get started?',
1244
- subtitle: 'Sign up today and get 30 days free trial',
1245
- buttonText: 'Sign Up Now',
1246
- buttonColor: 'primary',
1247
- buttonTextColor: 'white'
1248
- };
1249
- break;
1250
-
1251
- case 'footer':
1252
- defaultProps = {
1253
- bgColor: 'gray-800',
1254
- textColor: 'white',
1255
- columns: [
1256
- { title: 'Company', links: ['About Us', 'Careers', 'Contact'] },
1257
- { title: 'Products', links: ['Features', 'Pricing', 'API'] },
1258
- { title: 'Resources', links: ['Documentation', 'Guides', 'Blog'] },
1259
- { title: 'Legal', links: ['Privacy', 'Terms', 'Cookie Policy'] }
1260
- ],
1261
- copyright: '© 2023 Your Company. All rights reserved.'
1262
- };
1263
- break;
1264
- }
1265
-
1266
- // Create component wrapper
1267
- const componentWrapper = document.createElement('div');
1268
- componentWrapper.className = 'canvas-component bg-white';
1269
- componentWrapper.id = componentId;
1270
- componentWrapper.style.position = 'absolute';
1271
- componentWrapper.style.left = `${relativeX}px`;
1272
- componentWrapper.style.top = `${relativeY}px`;
1273
- componentWrapper.style.width = '100%';
1274
-
1275
- componentWrapper.innerHTML = `
1276
- <div class="component-toolbar">
1277
- <div class="component-handle" draggable="true">
1278
- <i class="fas fa-grip-vertical mr-1"></i>
1279
- <span class="text-xs">${type}</span>
1280
- </div>
1281
- <div class="component-actions">
1282
- <button class="component-action-btn edit-btn" title="Edit">
1283
- <i class="fas fa-pen"></i>
1284
- </button>
1285
- <button class="component-action-btn delete-btn" title="Delete">
1286
- <i class="fas fa-trash"></i>
1287
- </button>
1288
- </div>
1289
- </div>
1290
- <div class="component-content"></div>
1291
- <div class="resize-handle"></div>
1292
- `;
1293
-
1294
- // Add to canvas
1295
- canvas.appendChild(componentWrapper);
1296
-
1297
- // Store component data
1298
- const componentData = {
1299
- id: componentId,
1300
- type: type,
1301
- props: defaultProps,
1302
- position: { x: relativeX, y: relativeY },
1303
- size: { width: '100%', height: 'auto' }
1304
- };
1305
-
1306
- components.push(componentData);
1307
-
1308
- // Render the component content
1309
- renderComponent(componentId);
1310
-
1311
- // Make draggable
1312
- makeDraggable(componentWrapper, componentId);
1313
-
1314
- // Add event listeners to controls
1315
- componentWrapper.querySelector('.edit-btn').addEventListener('click', () => {
1316
- selectComponent(componentId);
1317
  });
1318
 
1319
- componentWrapper.querySelector('.delete-btn').addEventListener('click', () => {
1320
- deleteComponent(componentId);
 
 
 
 
 
 
 
1321
  });
1322
 
1323
- // Add resize handle
1324
- const resizeHandle = componentWrapper.querySelector('.resize-handle');
1325
- resizeHandle.addEventListener('mousedown', initResize);
1326
-
1327
- // Select the new component
1328
- selectComponent(componentId);
1329
- }
1330
-
1331
- // Make component draggable
1332
- function makeDraggable(element, componentId) {
1333
- const handle = element.querySelector('.component-handle');
1334
-
1335
- handle.addEventListener('mousedown', function(e) {
1336
- e.preventDefault();
1337
-
1338
- const rect = canvas.getBoundingClientRect();
1339
- let posX = e.clientX - rect.left;
1340
- let posY = e.clientY - rect.top;
1341
-
1342
- function moveElement(e) {
1343
- const newX = e.clientX - rect.left - posX + parseInt(element.style.left);
1344
- const newY = e.clientY - rect.top - posY + parseInt(element.style.top);
1345
-
1346
- // Constrain to canvas bounds
1347
- const constrainedX = Math.max(0, Math.min(newX, rect.width - element.offsetWidth));
1348
- const constrainedY = Math.max(0, Math.min(newY, rect.height - element.offsetHeight));
1349
-
1350
- element.style.left = `${constrainedX}px`;
1351
- element.style.top = `${constrainedY}px`;
1352
-
1353
- // Update component data
1354
- const component = components.find(c => c.id === componentId);
1355
- if (component) {
1356
- component.position = { x: constrainedX, y: constrainedY };
1357
- }
1358
- }
1359
-
1360
- function stopMoving() {
1361
- document.removeEventListener('mousemove', moveElement);
1362
- document.removeEventListener('mouseup', stopMoving);
1363
  }
1364
-
1365
- document.addEventListener('mousemove', moveElement);
1366
- document.addEventListener('mouseup', stopMoving);
1367
  });
1368
- }
1369
-
1370
- // Initialize resize
1371
- function initResize(e) {
1372
- e.preventDefault();
1373
- e.stopPropagation();
1374
-
1375
- isResizing = true;
1376
- const element = e.target.parentElement;
1377
 
1378
- startX = e.clientX;
1379
- startY = e.clientY;
1380
- startWidth = parseInt(element.style.width, 10) || element.offsetWidth;
1381
- startHeight = parseInt(element.style.height, 10) || element.offsetHeight;
1382
-
1383
- document.addEventListener('mousemove', resizeElement);
1384
- document.addEventListener('mouseup', stopResize);
1385
- }
1386
-
1387
- // Resize element
1388
- function resizeElement(e) {
1389
- if (!isResizing) return;
1390
-
1391
- const element = document.getElementById(selectedComponent);
1392
- if (!element) return;
1393
-
1394
- const width = startWidth + (e.clientX - startX);
1395
- const height = startHeight + (e.clientY - startY);
1396
-
1397
- // Minimum size constraints
1398
- const minWidth = 100;
1399
- const minHeight = 50;
1400
-
1401
- element.style.width = `${Math.max(minWidth, width)}px`;
1402
- element.style.height = `${Math.max(minHeight, height)}px`;
1403
-
1404
- // Update component data
1405
- const component = components.find(c => c.id === selectedComponent);
1406
- if (component) {
1407
- component.size = {
1408
- width: `${Math.max(minWidth, width)}px`,
1409
- height: `${Math.max(minHeight, height)}px`
1410
- };
1411
- }
1412
- }
1413
-
1414
- // Stop resize
1415
- function stopResize() {
1416
- isResizing = false;
1417
- document.removeEventListener('mousemove', resizeElement);
1418
- document.removeEventListener('mouseup', stopResize);
1419
- }
1420
-
1421
- // Select a component to edit its properties
1422
- function selectComponent(componentId) {
1423
- // Deselect previous component
1424
- if (selectedComponent) {
1425
- const prevElement = document.getElementById(selectedComponent);
1426
- if (prevElement) {
1427
- prevElement.classList.remove('selected');
1428
  }
1429
- }
1430
-
1431
- // Select new component
1432
- selectedComponent = componentId;
1433
- const element = document.getElementById(componentId);
1434
- if (element) {
1435
- element.classList.add('selected');
1436
- element.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
1437
- }
1438
-
1439
- // Find component data
1440
- const component = components.find(c => c.id === componentId);
1441
- if (!component) return;
1442
-
1443
- // Update properties panel based on component type
1444
- updatePropertiesPanel(component);
1445
- }
1446
-
1447
- // Update properties panel with component-specific controls
1448
- function updatePropertiesPanel(component) {
1449
- let propertiesHtml = '';
1450
 
1451
- switch(component.type) {
1452
- case 'header':
1453
- propertiesHtml = `
1454
- <div class="space-y-4">
1455
- <h3 class="font-medium text-gray-800">Header Settings</h3>
1456
- <div>
1457
- <label class="block text-sm font-medium text-gray-700 mb-1">Logo Text</label>
1458
- <input type="text" class="w-full p-2 border rounded-md text-sm" value="${component.props.logoText}" data-prop="logoText">
1459
- </div>
1460
- <div>
1461
- <label class="block text-sm font-medium text-gray-700 mb-2">Background Color</label>
1462
- <div class="flex flex-wrap gap-2">
1463
- <div class="color-option bg-primary ${component.props.bgColor === 'primary' ? 'selected' : ''}" data-color="primary" data-prop="bgColor"></div>
1464
- <div class="color-option bg-gray-800 ${component.props.bgColor === 'gray-800' ? 'selected' : ''}" data-color="gray-800" data-prop="bgColor"></div>
1465
- <div class="color-option bg-indigo-600 ${component.props.bgColor === 'indigo-600' ? 'selected' : ''}" data-color="indigo-600" data-prop="bgColor"></div>
1466
- <div class="color-option bg-blue-600 ${component.props.bgColor === 'blue-600' ? 'selected' : ''}" data-color="blue-600" data-prop="bgColor"></div>
1467
- <div class="color-option bg-green-600 ${component.props.bgColor === 'green-600' ? 'selected' : ''}" data-color="green-600" data-prop="bgColor"></div>
1468
- </div>
1469
- </div>
1470
- <div>
1471
- <label class="block text-sm font-medium text-gray-700 mb-2">Text Color</label>
1472
- <div class="flex flex-wrap gap-2">
1473
- <div class="color-option bg-white border ${component.props.textColor === 'white' ? 'selected' : ''}" data-color="white" data-prop="textColor"></div>
1474
- <div class="color-option bg-gray-100 ${component.props.textColor === 'gray-100' ? 'selected' : ''}" data-color="gray-100" data-prop="textColor"></div>
1475
- <div class="color-option bg-gray-200 ${component.props.textColor === 'gray-200' ? 'selected' : ''}" data-color="gray-200" data-prop="textColor"></div>
1476
- </div>
1477
- </div>
1478
- <div>
1479
- <label class="block text-sm font-medium text-gray-700 mb-1">Navigation Links</label>
1480
- <div class="links-container space-y-2">
1481
- ${component.props.links.map((link, index) => `
1482
- <div class="flex items-center space-x-2">
1483
- <input type="text" class="flex-1 p-2 border rounded-md text-sm" value="${link}" data-link-index="${index}">
1484
- <button class="remove-link-btn p-2 text-red-500" data-link-index="${index}">
1485
- <i class="fas fa-times"></i>
1486
- </button>
1487
- </div>
1488
- `).join('')}
1489
- </div>
1490
- <button class="add-link-btn mt-2 text-sm text-primary hover:text-primary-dark flex items-center">
1491
- <i class="fas fa-plus mr-1"></i> Add Link
1492
- </button>
1493
- </div>
1494
- </div>
1495
- `;
1496
- break;
1497
-
1498
- case 'hero':
1499
- propertiesHtml = `
1500
- <div class="space-y-4">
1501
- <h3 class="font-medium text-gray-800">Hero Settings</h3>
1502
- <div>
1503
- <label class="block text-sm font-medium text-gray-700 mb-1">Title</label>
1504
- <input type="text" class="w-full p-2 border rounded-md text-sm" value="${component.props.title}" data-prop="title">
1505
- </div>
1506
- <div>
1507
- <label class="block text-sm font-medium text-gray-700 mb-1">Subtitle</label>
1508
- <textarea class="w-full p-2 border rounded-md text-sm" rows="2" data-prop="subtitle">${component.props.subtitle}</textarea>
1509
- </div>
1510
- <div>
1511
- <label class="block text-sm font-medium text-gray-700 mb-1">Button Text</label>
1512
- <input type="text" class="w-full p-2 border rounded-md text-sm" value="${component.props.buttonText}" data-prop="buttonText">
1513
- </div>
1514
- <div>
1515
- <label class="block text-sm font-medium text-gray-700 mb-2">Background Color</label>
1516
- <div class="flex flex-wrap gap-2">
1517
- <div class="color-option bg-primary ${component.props.bgColor === 'primary' ? 'selected' : ''}" data-color="primary" data-prop="bgColor"></div>
1518
- <div class="color-option bg-blue-500 ${component.props.bgColor === 'blue-500' ? 'selected' : ''}" data-color="blue-500" data-prop="bgColor"></div>
1519
- <div class="color-option bg-indigo-600 ${component.props.bgColor === 'indigo-600' ? 'selected' : ''}" data-color="indigo-600" data-prop="bgColor"></div>
1520
- <div class="color-option bg-purple-600 ${component.props.bgColor === 'purple-600' ? 'selected' : ''}" data-color="purple-600" data-prop="bgColor"></div>
1521
- <div class="color-option bg-gray-800 ${component.props.bgColor === 'gray-800' ? 'selected' : ''}" data-color="gray-800" data-prop="bgColor"></div>
1522
- </div>
1523
- </div>
1524
- <div>
1525
- <label class="block text-sm font-medium text-gray-700 mb-2">Text Color</label>
1526
- <div class="flex flex-wrap gap-2">
1527
- <div class="color-option bg-white border ${component.props.textColor === 'white' ? 'selected' : ''}" data-color="white" data-prop="textColor"></div>
1528
- <div class="color-option bg-gray-100 ${component.props.textColor === 'gray-100' ? 'selected' : ''}" data-color="gray-100" data-prop="textColor"></div>
1529
- <div class="color-option bg-gray-200 ${component.props.textColor === 'gray-200' ? 'selected' : ''}" data-color="gray-200" data-prop="textColor"></div>
1530
- </div>
1531
- </div>
1532
- <div>
1533
- <label class="block text-sm font-medium text-gray-700 mb-2">Button Color</label>
1534
- <div class="flex flex-wrap gap-2">
1535
- <div class="color-option bg-white border ${component.props.buttonColor === 'white' ? 'selected' : ''}" data-color="white" data-prop="buttonColor"></div>
1536
- <div class="color-option bg-primary ${component.props.buttonColor === 'primary' ? 'selected' : ''}" data-color="primary" data-prop="buttonColor"></div>
1537
- <div class="color-option bg-gray-800 ${component.props.buttonColor === 'gray-800' ? 'selected' : ''}" data-color="gray-800" data-prop="buttonColor"></div>
1538
- </div>
1539
- </div>
1540
- <div>
1541
- <label class="block text-sm font-medium text-gray-700 mb-2">Button Text Color</label>
1542
- <div class="flex flex-wrap gap-2">
1543
- <div class="color-option bg-primary ${component.props.buttonTextColor === 'primary' ? 'selected' : ''}" data-color="primary" data-prop="buttonTextColor"></div>
1544
- <div class="color-option bg-white border ${component.props.buttonTextColor === 'white' ? 'selected' : ''}" data-color="white" data-prop="buttonTextColor"></div>
1545
- <div class="color-option bg-gray-800 ${component.props.buttonTextColor === 'gray-800' ? 'selected' : ''}" data-color="gray-800" data-prop="buttonTextColor"></div>
1546
- </div>
1547
- </div>
1548
- </div>
1549
- `;
1550
- break;
1551
-
1552
- case 'features':
1553
- propertiesHtml = `
1554
- <div class="space-y-4">
1555
- <h3 class="font-medium text-gray-800">Features Settings</h3>
1556
- <div>
1557
- <label class="block text-sm font-medium text-gray-700 mb-1">Title</label>
1558
- <input type="text" class="w-full p-2 border rounded-md text-sm" value="${component.props.title}" data-prop="title">
1559
- </div>
1560
- <div>
1561
- <label class="block text-sm font-medium text-gray-700 mb-2">Background Color</label>
1562
- <div class="flex flex-wrap gap-2">
1563
- <div class="color-option bg-gray-50 ${component.props.bgColor === 'gray-50' ? 'selected' : ''}" data-color="gray-50" data-prop="bgColor"></div>
1564
- <div class="color-option bg-white ${component.props.bgColor === 'white' ? 'selected' : ''}" data-color="white" data-prop="bgColor"></div>
1565
- <div class="color-option bg-primary/10 ${component.props.bgColor === 'primary/10' ? 'selected' : ''}" data-color="primary/10" data-prop="bgColor"></div>
1566
- </div>
1567
- </div>
1568
- <div>
1569
- <label class="block text-sm font-medium text-gray-700 mb-1">Features</label>
1570
- <div class="features-container space-y-4">
1571
- ${component.props.features.map((feature, index) => `
1572
- <div class="feature-item border rounded-md p-3" data-feature-index="${index}">
1573
- <div class="flex justify-between items-center mb-2">
1574
- <h4 class="text-sm font-medium">Feature ${index + 1}</h4>
1575
- <button class="remove-feature-btn text-red-500 text-sm">
1576
- <i class="fas fa-trash"></i>
1577
- </button>
1578
- </div>
1579
- <div class="mb-2">
1580
- <label class="block text-xs text-gray-500 mb-1">Title</label>
1581
- <input type="text" class="w-full p-2 border rounded-md text-sm" value="${feature.title}" data-prop="features.${index}.title">
1582
- </div>
1583
- <div class="mb-2">
1584
- <label class="block text-xs text-gray-500 mb-1">Description</label>
1585
- <textarea class="w-full p-2 border rounded-md text-sm" rows="2" data-prop="features.${index}.description">${feature.description}</textarea>
1586
- </div>
1587
- <div>
1588
- <label class="block text-xs text-gray-500 mb-1">Icon</label>
1589
- <select class="w-full p-2 border rounded-md text-sm" data-prop="features.${index}.icon">
1590
- <option value="fa-rocket" ${feature.icon === 'fa-rocket' ? 'selected' : ''}>Rocket</option>
1591
- <option value="fa-bolt" ${feature.icon === 'fa-bolt' ? 'selected' : ''}>Bolt</option>
1592
- <option value="fa-cog" ${feature.icon === 'fa-cog' ? 'selected' : ''}>Cog</option>
1593
- <option value="fa-star" ${feature.icon === 'fa-star' ? 'selected' : ''}>Star</option>
1594
- <option value="fa-heart" ${feature.icon === 'fa-heart' ? 'selected' : ''}>Heart</option>
1595
- </select>
1596
- </div>
1597
- </div>
1598
- `).join('')}
1599
- </div>
1600
- <button class="add-feature-btn mt-3 text-sm text-primary hover:text-primary-dark flex items-center">
1601
- <i class="fas fa-plus mr-1"></i> Add Feature
1602
- </button>
1603
- </div>
1604
- </div>
1605
- `;
1606
- break;
1607
-
1608
- case 'text':
1609
- propertiesHtml = `
1610
- <div class="space-y-4">
1611
- <h3 class="font-medium text-gray-800">Text Settings</h3>
1612
- <div>
1613
- <label class="block text-sm font-medium text-gray-700 mb-1">Title</label>
1614
- <input type="text" class="w-full p-2 border rounded-md text-sm" value="${component.props.title}" data-prop="title">
1615
- </div>
1616
- <div>
1617
- <label class="block text-sm font-medium text-gray-700 mb-1">Content</label>
1618
- <textarea class="w-full p-2 border rounded-md text-sm" rows="4" data-prop="content">${component.props.content}</textarea>
1619
- </div>
1620
- <div>
1621
- <label class="block text-sm font-medium text-gray-700 mb-1">Text Alignment</label>
1622
- <select class="w-full p-2 border rounded-md text-sm" data-prop="textAlign">
1623
- <option value="left" ${component.props.textAlign === 'left' ? 'selected' : ''}>Left</option>
1624
- <option value="center" ${component.props.textAlign === 'center' ? 'selected' : ''}>Center</option>
1625
- <option value="right" ${component.props.textAlign === 'right' ? 'selected' : ''}>Right</option>
1626
- </select>
1627
- </div>
1628
- </div>
1629
- `;
1630
- break;
1631
-
1632
- case 'image':
1633
- propertiesHtml = `
1634
- <div class="space-y-4">
1635
- <h3 class="font-medium text-gray-800">Image Settings</h3>
1636
- <div>
1637
- <
1638
  </html>
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>DeepSeek Visual Builder with APWB & DeepCoder Integration</title>
7
  <script src="https://cdn.tailwindcss.com"></script>
8
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
  <style>
 
225
  @apply mt-4 p-3 bg-gray-50 rounded-md text-sm whitespace-pre-wrap;
226
  }
227
 
228
+ /* DeepCoder AI Assistant Styles */
229
+ .deepcoder-container {
230
+ @apply border rounded-lg overflow-hidden;
231
+ }
232
+
233
+ .deepcoder-header {
234
+ @apply bg-gray-100 p-3 border-b flex justify-between items-center;
235
+ }
236
+
237
+ .deepcoder-body {
238
+ @apply p-4;
239
+ }
240
+
241
+ .deepcoder-input {
242
+ @apply w-full p-2 border rounded-md text-sm mb-2;
243
+ }
244
+
245
+ .deepcoder-button {
246
+ @apply bg-purple-600 hover:bg-purple-700 text-white px-3 py-1.5 rounded-md text-sm font-medium;
247
+ }
248
+
249
+ .deepcoder-response {
250
+ @apply mt-4 p-3 bg-gray-50 rounded-md text-sm whitespace-pre-wrap;
251
+ }
252
+
253
+ .deepcoder-tabs {
254
+ @apply flex border-b;
255
+ }
256
+
257
+ .deepcoder-tab {
258
+ @apply px-4 py-2 text-sm font-medium cursor-pointer;
259
+ }
260
+
261
+ .deepcoder-tab.active {
262
+ @apply border-b-2 border-purple-600 text-purple-600;
263
+ }
264
+
265
+ .deepcoder-code {
266
+ @apply w-full h-64 p-2 border rounded-md text-sm font-mono;
267
+ }
268
+
269
  .model-selector {
270
  @apply flex items-center space-x-2 bg-gray-100 rounded-md px-3 py-1.5;
271
  }
 
295
  .tab-content.active {
296
  @apply block;
297
  }
298
+
299
+ /* Code editor styles */
300
+ .code-editor {
301
+ @apply border rounded-md overflow-hidden;
302
+ }
303
+
304
+ .code-toolbar {
305
+ @apply bg-gray-100 p-2 flex justify-between items-center;
306
+ }
307
+
308
+ .code-area {
309
+ @apply w-full h-64 p-3 font-mono text-sm bg-gray-900 text-gray-100;
310
+ }
311
+
312
+ /* Terminal styles */
313
+ .terminal {
314
+ @apply bg-gray-900 text-gray-100 font-mono text-sm p-3 rounded-b-md;
315
+ height: 200px;
316
+ overflow-y: auto;
317
+ }
318
+
319
+ .terminal-line {
320
+ @apply mb-1;
321
+ }
322
+
323
+ .terminal-prompt {
324
+ @apply text-green-400;
325
+ }
326
+
327
+ .terminal-command {
328
+ @apply text-white;
329
+ }
330
+
331
+ .terminal-output {
332
+ @apply text-gray-300;
333
+ }
334
+
335
+ /* Rosebud AI Styles */
336
+ .rosebud-container {
337
+ @apply border rounded-lg overflow-hidden;
338
+ }
339
+
340
+ .rosebud-header {
341
+ @apply bg-gray-100 p-3 border-b flex justify-between items-center;
342
+ }
343
+
344
+ .rosebud-body {
345
+ @apply p-4;
346
+ }
347
+
348
+ .rosebud-input {
349
+ @apply w-full p-2 border rounded-md text-sm mb-2;
350
+ }
351
+
352
+ .rosebud-button {
353
+ @apply bg-pink-600 hover:bg-pink-700 text-white px-3 py-1.5 rounded-md text-sm font-medium;
354
+ }
355
+
356
+ .rosebud-response {
357
+ @apply mt-4 p-3 bg-gray-50 rounded-md text-sm whitespace-pre-wrap;
358
+ }
359
+
360
+ .rosebud-image-container {
361
+ @apply grid grid-cols-2 gap-4 mt-4;
362
+ }
363
+
364
+ .rosebud-image {
365
+ @apply rounded-lg border border-gray-200 cursor-pointer transition-all hover:shadow-md;
366
+ }
367
+
368
+ .rosebud-image.selected {
369
+ @apply ring-2 ring-pink-500;
370
+ }
371
+
372
+ .rosebud-controls {
373
+ @apply flex items-center space-x-2 mt-4;
374
+ }
375
+
376
+ .rosebud-control-btn {
377
+ @apply bg-gray-200 hover:bg-gray-300 text-gray-700 px-3 py-1 rounded text-sm;
378
+ }
379
+
380
+ .rosebud-slider {
381
+ @apply w-full;
382
+ }
383
+
384
+ .rosebud-edit-tools {
385
+ @apply grid grid-cols-4 gap-2 mt-4;
386
+ }
387
+
388
+ .rosebud-tool-btn {
389
+ @apply p-2 border rounded-md text-center cursor-pointer hover:bg-gray-100;
390
+ }
391
+
392
+ .rosebud-tool-btn.active {
393
+ @apply bg-pink-100 border-pink-500;
394
+ }
395
+
396
+ /* Image Editor Styles */
397
+ .image-editor-container {
398
+ @apply relative overflow-hidden;
399
+ }
400
+
401
+ .image-editor-tools {
402
+ @apply absolute top-0 left-0 right-0 bg-gray-800 text-white p-2 flex space-x-2;
403
+ }
404
+
405
+ .image-editor-tool {
406
+ @apply p-1 rounded cursor-pointer hover:bg-gray-700;
407
+ }
408
+
409
+ .image-editor-canvas {
410
+ @apply w-full h-full;
411
+ }
412
+
413
+ /* Style Transfer Styles */
414
+ .style-transfer-container {
415
+ @apply grid grid-cols-2 gap-4 mt-4;
416
+ }
417
+
418
+ .style-transfer-image {
419
+ @apply rounded-lg border border-gray-200 cursor-pointer;
420
+ }
421
+
422
+ .style-transfer-btn {
423
+ @apply bg-purple-600 hover:bg-purple-700 text-white px-3 py-1.5 rounded-md text-sm font-medium w-full mt-2;
424
+ }
425
  </style>
426
  </head>
427
  <body class="h-screen flex flex-col overflow-hidden">
 
432
  <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
433
  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" />
434
  </svg>
435
+ <h1 class="text-xl font-bold">DeepSeek + APWB + DeepCoder + Rosebud</h1>
436
  </div>
437
  <div class="flex items-center space-x-3">
438
  <button id="aiPromptBtn" class="flex items-center space-x-1 bg-white/10 hover:bg-white/20 px-3 py-1.5 rounded-md text-sm font-medium transition-colors">
439
  <i class="fas fa-robot"></i>
440
  <span>AI Builder</span>
441
  </button>
442
+ <button id="deepcoderBtn" class="flex items-center space-x-1 bg-white/10 hover:bg-white/20 px-3 py-1.5 rounded-md text-sm font-medium transition-colors">
443
+ <i class="fas fa-code"></i>
444
+ <span>DeepCoder</span>
445
+ </button>
446
+ <button id="rosebudBtn" class="flex items-center space-x-1 bg-white/10 hover:bg-white/20 px-3 py-1.5 rounded-md text-sm font-medium transition-colors">
447
+ <i class="fas fa-magic"></i>
448
+ <span>Rosebud AI</span>
449
+ </button>
450
  <button id="saveBtn" class="flex items-center space-x-1 bg-white/10 hover:bg-white/20 px-3 py-1.5 rounded-md text-sm font-medium transition-colors">
451
  <i class="fas fa-save"></i>
452
  <span>Save</span>
 
475
  <select id="modelSelector">
476
  <option value="apwb">APWB</option>
477
  <option value="deepseek">DeepSeek</option>
478
+ <option value="deepcoder">DeepCoder</option>
479
+ <option value="rosebud">Rosebud</option>
480
  </select>
481
  </div>
482
  </div>
483
  <div class="mt-2 flex space-x-1">
484
  <button class="tab-btn active" data-tab="components">Components</button>
485
  <button class="tab-btn" data-tab="apwb">APWB</button>
486
+ <button class="tab-btn" data-tab="deepcoder">DeepCoder</button>
487
+ <button class="tab-btn" data-tab="rosebud">Rosebud</button>
488
  </div>
489
  </div>
490
 
 
567
  </div>
568
  </div>
569
  </div>
570
+ <div class="component bg-white p-3 rounded-lg border border-gray-200 shadow-sm" draggable="true" data-type="ai-image">
571
+ <div class="flex items-center space-x-3">
572
+ <div class="bg-pink-100 text-pink-500 p-2 rounded-lg">
573
+ <i class="fas fa-magic"></i>
574
+ </div>
575
+ <div>
576
+ <h3 class="font-medium text-sm">AI Image</h3>
577
+ <p class="text-xs text-gray-500">Generated with Rosebud</p>
578
+ </div>
579
+ </div>
580
+ </div>
581
  </div>
582
 
583
  <!-- APWB Tab -->
 
600
  </div>
601
  </div>
602
  </div>
603
+
604
+ <!-- DeepCoder Tab -->
605
+ <div id="deepcoderTab" class="tab-content flex-1 overflow-y-auto p-3">
606
+ <div class="deepcoder-container">
607
+ <div class="deepcoder-header">
608
+ <h3 class="text-sm font-medium">DeepCoder AI Assistant</h3>
609
+ <i class="fas fa-info-circle text-gray-500"></i>
610
+ </div>
611
+ <div class="deepcoder-body">
612
+ <textarea id="deepcoderPrompt" class="deepcoder-input" placeholder="Describe the code you want to generate..."></textarea>
613
+ <button id="deepcoderSubmit" class="deepcoder-button w-full">
614
+ <i class="fas fa-code mr-1"></i> Generate Code
615
+ </button>
616
+ <div id="deepcoderResponse" class="deepcoder-response hidden"></div>
617
+ <div id="deepcoderLoading" class="ai-loading hidden">
618
+ <i class="ai-loading-spinner fas fa-spinner"></i>
619
+ <span class="ml-2">Generating with DeepCoder...</span>
620
+ </div>
621
+ </div>
622
+ </div>
623
+ </div>
624
+
625
+ <!-- Rosebud Tab -->
626
+ <div id="rosebudTab" class="tab-content flex-1 overflow-y-auto p-3">
627
+ <div class="rosebud-container">
628
+ <div class="rosebud-header">
629
+ <h3 class="text-sm font-medium">Rosebud AI</h3>
630
+ <i class="fas fa-info-circle text-gray-500"></i>
631
+ </div>
632
+ <div class="rosebud-body">
633
+ <textarea id="rosebudPrompt" class="rosebud-input" placeholder="Describe the image you want to generate..."></textarea>
634
+ <div class="flex items-center space-x-2">
635
+ <select id="rosebudStyle" class="rosebud-input flex-1">
636
+ <option value="realistic">Realistic</option>
637
+ <option value="cartoon">Cartoon</option>
638
+ <option value="anime">Anime</option>
639
+ <option value="fantasy">Fantasy</option>
640
+ <option value="watercolor">Watercolor</option>
641
+ </select>
642
+ <select id="rosebudRatio" class="rosebud-input flex-1">
643
+ <option value="1:1">Square (1:1)</option>
644
+ <option value="4:3">Standard (4:3)</option>
645
+ <option value="16:9">Widescreen (16:9)</option>
646
+ <option value="9:16">Portrait (9:16)</option>
647
+ </select>
648
+ </div>
649
+ <button id="rosebudSubmit" class="rosebud-button w-full mt-2">
650
+ <i class="fas fa-magic mr-1"></i> Generate Image
651
+ </button>
652
+ <div id="rosebudResponse" class="rosebud-response hidden"></div>
653
+ <div id="rosebudLoading" class="ai-loading hidden">
654
+ <i class="ai-loading-spinner fas fa-spinner"></i>
655
+ <span class="ml-2">Generating with Rosebud...</span>
656
+ </div>
657
+ <div id="rosebudImages" class="rosebud-image-container hidden"></div>
658
+ <div id="rosebudEditControls" class="rosebud-controls hidden">
659
+ <button id="rosebudEditBtn" class="rosebud-control-btn">
660
+ <i class="fas fa-edit mr-1"></i> Edit
661
+ </button>
662
+ <button id="rosebudDownloadBtn" class="rosebud-control-btn">
663
+ <i class="fas fa-download mr-1"></i> Download
664
+ </button>
665
+ <button id="rosebudAddToCanvasBtn" class="rosebud-control-btn">
666
+ <i class="fas fa-plus mr-1"></i> Add to Canvas
667
+ </button>
668
+ </div>
669
+ </div>
670
+ </div>
671
+ </div>
672
  </div>
673
 
674
  <!-- Divider -->
 
789
  </div>
790
  </div>
791
 
792
+ <!-- DeepCoder Modal -->
793
+ <div id="deepcoderModal" class="fixed inset-0 bg-black/50 hidden items-center justify-center z-50 p-4">
794
+ <div class="bg-white rounded-lg w-full max-w-4xl h-[80vh] flex flex-col overflow-hidden shadow-xl">
795
+ <div class="p-4 border-b flex justify-between items-center bg-gray-50">
796
+ <h3 class="text-lg font-semibold">DeepCoder AI Assistant</h3>
797
+ <button id="closeDeepcoderModal" class="text-gray-500 hover:text-gray-700">
798
+ <i class="fas fa-times"></i>
799
+ </button>
800
+ </div>
801
+ <div class="flex-1 overflow-hidden flex flex-col">
802
+ <div class="deepcoder-tabs">
803
+ <div class="deepcoder-tab active" data-tab="code">Code Editor</div>
804
+ <div class="deepcoder-tab" data-tab="terminal">Terminal</div>
805
+ </div>
806
+ <div class="flex-1 overflow-auto">
807
+ <div id="deepcoderCodeTab" class="tab-content active h-full">
808
+ <div class="code-editor h-full flex flex-col">
809
+ <div class="code-toolbar">
810
+ <div class="flex space-x-2">
811
+ <button id="runCodeBtn" class="bg-green-600 hover:bg-green-700 text-white px-3 py-1 rounded text-sm">
812
+ <i class="fas fa-play mr-1"></i> Run
813
+ </button>
814
+ <button id="clearCodeBtn" class="bg-gray-200 hover:bg-gray-300 text-gray-700 px-3 py-1 rounded text-sm">
815
+ <i class="fas fa-trash-alt mr-1"></i> Clear
816
+ </button>
817
+ </div>
818
+ </div>
819
+ <textarea id="deepcoderCode" class="code-area flex-1" placeholder="Write your code here or generate it with AI..."></textarea>
820
+ </div>
821
+ </div>
822
+ <div id="deepcoderTerminalTab" class="tab-content h-full">
823
+ <div class="terminal">
824
+ <div id="terminalContent">
825
+ <div class="terminal-line">
826
+ <span class="terminal-prompt">$</span>
827
+ <span class="terminal-command">Welcome to DeepCoder Terminal</span>
828
+ </div>
829
+ <div class="terminal-line">
830
+ <span class="terminal-prompt">$</span>
831
+ <span class="terminal-command">Type 'help' for available commands</span>
832
+ </div>
833
+ </div>
834
+ <div class="terminal-input flex items-center mt-2">
835
+ <span class="terminal-prompt mr-2">$</span>
836
+ <input type="text" id="terminalCommand" class="bg-transparent border-none text-white flex-1 focus:ring-0" placeholder="Enter command...">
837
+ </div>
838
+ </div>
839
+ </div>
840
+ </div>
841
+ </div>
842
+ <div class="p-4 border-t">
843
+ <div class="flex items-center space-x-3">
844
+ <textarea id="deepcoderAIPrompt" class="flex-1 p-2 border rounded-md text-sm" placeholder="Ask DeepCoder to generate or modify code..."></textarea>
845
+ <button id="deepcoderAISubmit" class="bg-purple-600 hover:bg-purple-700 text-white px-4 py-2 rounded-md text-sm">
846
+ <i class="fas fa-code mr-1"></i> Ask AI
847
+ </button>
848
+ </div>
849
+ <div id="deepcoderAIResponse" class="deepcoder-response hidden mt-2"></div>
850
+ <div id="deepcoderAILoading" class="ai-loading hidden">
851
+ <i class="ai-loading-spinner fas fa-spinner"></i>
852
+ <span class="ml-2">DeepCoder is thinking...</span>
853
+ </div>
854
+ </div>
855
+ </div>
856
+ </div>
857
+
858
+ <!-- Rosebud AI Modal -->
859
+ <div id="rosebudModal" class="fixed inset-0 bg-black/50 hidden items-center justify-center z-50 p-4">
860
+ <div class="bg-white rounded-lg w-full max-w-4xl h-[90vh] flex flex-col overflow-hidden shadow-xl">
861
+ <div class="p-4 border-b flex justify-between items-center bg-gray-50">
862
+ <h3 class="text-lg font-semibold">Rosebud AI - Advanced Image Generation</h3>
863
+ <button id="closeRosebudModal" class="text-gray-500 hover:text-gray-700">
864
+ <i class="fas fa-times"></i>
865
+ </button>
866
+ </div>
867
+ <div class="flex-1 overflow-hidden flex">
868
+ <!-- Left Panel - Generation Controls -->
869
+ <div class="w-1/3 border-r p-4 overflow-y-auto">
870
+ <div class="mb-4">
871
+ <label class="block text-sm font-medium text-gray-700 mb-1">Prompt</label>
872
+ <textarea id="rosebudAdvancedPrompt" class="rosebud-input h-24" placeholder="Describe the image you want to generate..."></textarea>
873
+ </div>
874
+
875
+ <div class="grid grid-cols-2 gap-4 mb-4">
876
+ <div>
877
+ <label class="block text-sm font-medium text-gray-700 mb-1">Style</label>
878
+ <select id="rosebudAdvancedStyle" class="rosebud-input w-full">
879
+ <option value="realistic">Realistic</option>
880
+ <option value="cartoon">Cartoon</option>
881
+ <option value="anime">Anime</option>
882
+ <option value="fantasy">Fantasy</option>
883
+ <option value="watercolor">Watercolor</option>
884
+ <option value="oil-painting">Oil Painting</option>
885
+ <option value="pixel-art">Pixel Art</option>
886
+ <option value="cyberpunk">Cyberpunk</option>
887
+ </select>
888
+ </div>
889
+
890
+ <div>
891
+ <label class="block text-sm font-medium text-gray-700 mb-1">Aspect Ratio</label>
892
+ <select id="rosebudAdvancedRatio" class="rosebud-input w-full">
893
+ <option value="1:1">Square (1:1)</option>
894
+ <option value="4:3">Standard (4:3)</option>
895
+ <option value="16:9">Widescreen (16:9)</option>
896
+ <option value="9:16">Portrait (9:16)</option>
897
+ <option value="2:3">Portrait (2:3)</option>
898
+ <option value="3:2">Landscape (3:2)</option>
899
+ </select>
900
+ </div>
901
+ </div>
902
+
903
+ <div class="mb-4">
904
+ <label class="block text-sm font-medium text-gray-700 mb-1">Quality</label>
905
+ <input type="range" id="rosebudQuality" class="rosebud-slider" min="1" max="10" value="7">
906
+ <div class="flex justify-between text-xs text-gray-500 mt-1">
907
+ <span>Fast</span>
908
+ <span>Balanced</span>
909
+ <span>High Quality</span>
910
+ </div>
911
+ </div>
912
+
913
+ <div class="mb-4">
914
+ <label class="block text-sm font-medium text-gray-700 mb-1">Creativity</label>
915
+ <input type="range" id="rosebudCreativity" class="rosebud-slider" min="1" max="10" value="5">
916
+ <div class="flex justify-between text-xs text-gray-500 mt-1">
917
+ <span>Precise</span>
918
+ <span>Balanced</span>
919
+ <span>Creative</span>
920
+ </div>
921
+ </div>
922
+
923
+ <div class="mb-4">
924
+ <label class="block text-sm font-medium text-gray-700 mb-1">Negative Prompt</label>
925
+ <textarea id="rosebudNegativePrompt" class="rosebud-input h-16" placeholder="What you don't want in the image..."></textarea>
926
+ </div>
927
+
928
+ <button id="rosebudAdvancedSubmit" class="rosebud-button w-full">
929
+ <i class="fas fa-magic mr-1"></i> Generate Image
930
+ </button>
931
+
932
+ <div id="rosebudAdvancedResponse" class="rosebud-response hidden mt-4"></div>
933
+ <div id="rosebudAdvancedLoading" class="ai-loading hidden">
934
+ <i class="ai-loading-spinner fas fa-spinner"></i>
935
+ <span class="ml-2">Generating with Rosebud...</span>
936
+ </div>
937
+ </div>
938
+
939
+ <!-- Right Panel - Image Display & Editing -->
940
+ <div class="w-2/3 flex flex-col">
941
+ <div class="border-b p-4">
942
+ <div class="flex justify-between items-center">
943
+ <h4 class="text-sm font-medium">Generated Images</h4>
944
+ <div class="flex space-x-2">
945
+ <button id="rosebudUpscaleBtn" class="rosebud-control-btn">
946
+ <i class="fas fa-expand mr-1"></i> Upscale
947
+ </button>
948
+ <button id="rosebudVariationsBtn" class="rosebud-control-btn">
949
+ <i class="fas fa-copy mr-1"></i> Variations
950
+ </button>
951
+ </div>
952
+ </div>
953
+ </div>
954
+
955
+ <div id="rosebudAdvancedImages" class="rosebud-image-container p-4 grid grid-cols-2 gap-4 overflow-y-auto flex-1">
956
+ <!-- Images will be inserted here -->
957
+ </div>
958
+
959
+ <div class="border-t p-4">
960
+ <h4 class="text-sm font-medium mb-2">Image Editing Tools</h4>
961
+ <div class="rosebud-edit-tools">
962
+ <button class="rosebud-tool-btn" data-tool="crop">
963
+ <i class="fas fa-crop"></i>
964
+ <div class="text-xs mt-1">Crop</div>
965
+ </button>
966
+ <button class="rosebud-tool-btn" data-tool="adjust">
967
+ <i class="fas fa-sliders-h"></i>
968
+ <div class="text-xs mt-1">Adjust</div>
969
+ </button>
970
+ <button class="rosebud-tool-btn" data-tool="filter">
971
+ <i class="fas fa-filter"></i>
972
+ <div class="text-xs mt-1">Filter</div>
973
+ </button>
974
+ <button class="rosebud-tool-btn" data-tool="text">
975
+ <i class="fas fa-font"></i>
976
+ <div class="text-xs mt-1">Text</div>
977
+ </button>
978
+ <button class="rosebud-tool-btn" data-tool="draw">
979
+ <i class="fas fa-pencil-alt"></i>
980
+ <div class="text-xs mt-1">Draw</div>
981
+ </button>
982
+ <button class="rosebud-tool-btn" data-tool="erase">
983
+ <i class="fas fa-eraser"></i>
984
+ <div class="text-xs mt-1">Erase</div>
985
+ </button>
986
+ <button class="rosebud-tool-btn" data-tool="style">
987
+ <i class="fas fa-paint-brush"></i>
988
+ <div class="text-xs mt-1">Style</div>
989
+ </button>
990
+ <button class="rosebud-tool-btn" data-tool="enhance">
991
+ <i class="fas fa-sparkles"></i>
992
+ <div class="text-xs mt-1">Enhance</div>
993
+ </button>
994
+ </div>
995
+
996
+ <div id="rosebudToolOptions" class="hidden mt-4 p-3 bg-gray-50 rounded-md">
997
+ <!-- Tool options will be inserted here -->
998
+ </div>
999
+
1000
+ <div class="flex justify-end space-x-2 mt-4">
1001
+ <button id="rosebudAdvancedDownloadBtn" class="rosebud-control-btn">
1002
+ <i class="fas fa-download mr-1"></i> Download
1003
+ </button>
1004
+ <button id="rosebudAdvancedAddToCanvasBtn" class="rosebud-control-btn bg-pink-600 hover:bg-pink-700 text-white">
1005
+ <i class="fas fa-plus mr-1"></i> Add to Canvas
1006
+ </button>
1007
+ </div>
1008
+ </div>
1009
+ </div>
1010
+ </div>
1011
+ </div>
1012
+ </div>
1013
+
1014
+ <!-- Image Editor Modal -->
1015
+ <div id="imageEditorModal" class="fixed inset-0 bg-black/50 hidden items-center justify-center z-50 p-4">
1016
+ <div class="bg-white rounded-lg w-full max-w-6xl h-[90vh] flex flex-col overflow-hidden shadow-xl">
1017
+ <div class="p-4 border-b flex justify-between items-center bg-gray-50">
1018
+ <h3 class="text-lg font-semibold">Image Editor</h3>
1019
+ <div class="flex items-center space-x-3">
1020
+ <button id="imageEditorUndoBtn" class="text-gray-500 hover:text-gray-700">
1021
+ <i class="fas fa-undo"></i>
1022
+ </button>
1023
+ <button id="imageEditorRedoBtn" class="text-gray-500 hover:text-gray-700">
1024
+ <i class="fas fa-redo"></i>
1025
+ </button>
1026
+ <button id="closeImageEditor" class="text-gray-500 hover:text-gray-700">
1027
+ <i class="fas fa-times"></i>
1028
+ </button>
1029
+ </div>
1030
+ </div>
1031
+ <div class="flex-1 overflow-hidden flex">
1032
+ <!-- Left Panel - Tools -->
1033
+ <div class="w-16 border-r bg-gray-100 flex flex-col items-center py-4 space-y-4">
1034
+ <button class="image-editor-tool active" data-tool="select" title="Select">
1035
+ <i class="fas fa-mouse-pointer"></i>
1036
+ </button>
1037
+ <button class="image-editor-tool" data-tool="crop" title="Crop">
1038
+ <i class="fas fa-crop"></i>
1039
+ </button>
1040
+ <button class="image-editor-tool" data-tool="adjust" title="Adjust">
1041
+ <i class="fas fa-sliders-h"></i>
1042
+ </button>
1043
+ <button class="image-editor-tool" data-tool="filter" title="Filter">
1044
+ <i class="fas fa-filter"></i>
1045
+ </button>
1046
+ <button class="image-editor-tool" data-tool="text" title="Text">
1047
+ <i class="fas fa-font"></i>
1048
+ </button>
1049
+ <button class="image-editor-tool" data-tool="draw" title="Draw">
1050
+ <i class="fas fa-pencil-alt"></i>
1051
+ </button>
1052
+ <button class="image-editor-tool" data-tool="erase" title="Erase">
1053
+ <i class="fas fa-eraser"></i>
1054
+ </button>
1055
+ <button class="image-editor-tool" data-tool="shapes" title="Shapes">
1056
+ <i class="fas fa-shapes"></i>
1057
+ </button>
1058
+ </div>
1059
+
1060
+ <!-- Center Panel - Canvas -->
1061
+ <div class="flex-1 relative">
1062
+ <div class="image-editor-tools">
1063
+ <div class="flex space-x-2">
1064
+ <button id="imageEditorZoomIn" class="image-editor-tool">
1065
+ <i class="fas fa-search-plus"></i>
1066
+ </button>
1067
+ <button id="imageEditorZoomOut" class="image-editor-tool">
1068
+ <i class="fas fa-search-minus"></i>
1069
+ </button>
1070
+ <button id="imageEditorResetZoom" class="image-editor-tool">
1071
+ <i class="fas fa-expand-arrows-alt"></i>
1072
+ </button>
1073
+ </div>
1074
+ </div>
1075
+ <canvas id="imageEditorCanvas" class="image-editor-canvas"></canvas>
1076
+ </div>
1077
+
1078
+ <!-- Right Panel - Properties -->
1079
+ <div class="w-64 border-l p-4 overflow-y-auto">
1080
+ <div id="imageEditorProperties">
1081
+ <h4 class="text-sm font-medium mb-2">Tool Properties</h4>
1082
+ <div class="space-y-4">
1083
+ <div>
1084
+ <label class="block text-xs text-gray-500 mb-1">Brush Size</label>
1085
+ <input type="range" class="w-full" min="1" max="50" value="5">
1086
+ </div>
1087
+ <div>
1088
+ <label class="block text-xs text-gray-500 mb-1">Opacity</label>
1089
+ <input type="range" class="w-full" min="0" max="100" value="100">
1090
+ </div>
1091
+ <div>
1092
+ <label class="block text-xs text-gray-500 mb-1">Color</label>
1093
+ <input type="color" class="w-full h-8" value="#000000">
1094
+ </div>
1095
+ </div>
1096
+
1097
+ <div class="mt-6">
1098
+ <h4 class="text-sm font-medium mb-2">Filters</h4>
1099
+ <div class="grid grid-cols-3 gap-2">
1100
+ <button class="p-2 border rounded text-xs hover:bg-gray-100">Brightness</button>
1101
+ <button class="p-2 border rounded text-xs hover:bg-gray-100">Contrast</button>
1102
+ <button class="p-2 border rounded text-xs hover:bg-gray-100">Saturation</button>
1103
+ <button class="p-2 border rounded text-xs hover:bg-gray-100">Blur</button>
1104
+ <button class="p-2 border rounded text-xs hover:bg-gray-100">Sharpen</button>
1105
+ <button class="p-2 border rounded text-xs hover:bg-gray-100">Grayscale</button>
1106
+ <button class="p-2 border rounded text-xs hover:bg-gray-100">Sepia</button>
1107
+ <button class="p-2 border rounded text-xs hover:bg-gray-100">Invert</button>
1108
+ <button class="p-2 border rounded text-xs hover:bg-gray-100">Vintage</button>
1109
+ </div>
1110
+ </div>
1111
+ </div>
1112
+ </div>
1113
+ </div>
1114
+ <div class="p-4 border-t flex justify-end space-x-3">
1115
+ <button id="imageEditorCancelBtn" class="px-4 py-2 text-sm font-medium text-gray-700 bg-gray-200 rounded-md hover:bg-gray-300">
1116
+ Cancel
1117
+ </button>
1118
+ <button id="imageEditorSaveBtn" class="px-4 py-2 text-sm font-medium text-white bg-primary rounded-md hover:bg-primary-dark">
1119
+ Save Changes
1120
+ </button>
1121
+ </div>
1122
+ </div>
1123
+ </div>
1124
+
1125
+ <!-- Style Transfer Modal -->
1126
+ <div id="styleTransferModal" class="fixed inset-0 bg-black/50 hidden items-center justify-center z-50 p-4">
1127
+ <div class="bg-white rounded-lg w-full max-w-4xl flex flex-col overflow-hidden shadow-xl">
1128
+ <div class="p-4 border-b flex justify-between items-center bg-gray-50">
1129
+ <h3 class="text-lg font-semibold">Style Transfer</h3>
1130
+ <button id="closeStyleTransferModal" class="text-gray-500 hover:text-gray-700">
1131
+ <i class="fas fa-times"></i>
1132
+ </button>
1133
+ </div>
1134
+ <div class="p-4">
1135
+ <p class="text-sm text-gray-600 mb-4">Upload a content image and select a style to apply.</p>
1136
+
1137
+ <div class="style-transfer-container">
1138
+ <div>
1139
+ <label class="block text-sm font-medium text-gray-700 mb-1">Content Image</label>
1140
+ <div class="border-2 border-dashed border-gray-300 rounded-lg p-4 flex items-center justify-center">
1141
+ <div id="styleTransferContentPreview" class="hidden"></div>
1142
+ <div id="styleTransferContentUpload" class="text-center">
1143
+ <i class="fas fa-image text-4xl text-gray-400 mb-2"></i>
1144
+ <p class="text-sm text-gray-500">Drag & drop or click to upload</p>
1145
+ <input type="file" id="styleTransferContentInput" class="hidden" accept="image/*">
1146
+ <button id="styleTransferContentBtn" class="mt-2 bg-gray-200 hover:bg-gray-300 text-gray-700 px-3 py-1 rounded text-sm">
1147
+ Select Image
1148
+ </button>
1149
+ </div>
1150
+ </div>
1151
+ </div>
1152
+
1153
+ <div>
1154
+ <label class="block text-sm font-medium text-gray-700 mb-1">Style Image</label>
1155
+ <div class="border-2 border-dashed border-gray-300 rounded-lg p-4 flex items-center justify-center">
1156
+ <div id="styleTransferStylePreview" class="hidden"></div>
1157
+ <div id="styleTransferStyleUpload" class="text-center">
1158
+ <i class="fas fa-paint-brush text-4xl text-gray-400 mb-2"></i>
1159
+ <p class="text-sm text-gray-500">Drag & drop or click to upload</p>
1160
+ <input type="file" id="styleTransferStyleInput" class="hidden" accept="image/*">
1161
+ <button id="styleTransferStyleBtn" class="mt-2 bg-gray-200 hover:bg-gray-300 text-gray-700 px-3 py-1 rounded text-sm">
1162
+ Select Style
1163
+ </button>
1164
+ </div>
1165
+ </div>
1166
+ </div>
1167
+ </div>
1168
+
1169
+ <div class="mt-4">
1170
+ <label class="block text-sm font-medium text-gray-700 mb-1">Style Strength</label>
1171
+ <input type="range" id="styleTransferStrength" class="w-full" min="0" max="100" value="50">
1172
+ <div class="flex justify-between text-xs text-gray-500 mt-1">
1173
+ <span>Subtle</span>
1174
+ <span>Balanced</span>
1175
+ <span>Strong</span>
1176
+ </div>
1177
+ </div>
1178
+
1179
+ <button id="styleTransferSubmit" class="style-transfer-btn mt-4">
1180
+ <i class="fas fa-magic mr-1"></i> Apply Style Transfer
1181
+ </button>
1182
+
1183
+ <div id="styleTransferResult" class="hidden mt-6">
1184
+ <label class="block text-sm font-medium text-gray-700 mb-2">Result</label>
1185
+ <div id="styleTransferResultImage" class="border rounded-lg overflow-hidden"></div>
1186
+ <div class="flex justify-end space-x-2 mt-4">
1187
+ <button id="styleTransferDownloadBtn" class="rosebud-control-btn">
1188
+ <i class="fas fa-download mr-1"></i> Download
1189
+ </button>
1190
+ <button id="styleTransferAddToCanvasBtn" class="rosebud-control-btn bg-purple-600 hover:bg-purple-700 text-white">
1191
+ <i class="fas fa-plus mr-1"></i> Add to Canvas
1192
+ </button>
1193
+ </div>
1194
+ </div>
1195
+
1196
+ <div id="styleTransferLoading" class="ai-loading hidden">
1197
+ <i class="ai-loading-spinner fas fa-spinner"></i>
1198
+ <span class="ml-2">Applying style transfer...</span>
1199
+ </div>
1200
+ </div>
1201
+ </div>
1202
+ </div>
1203
+
1204
  <script>
1205
  document.addEventListener('DOMContentLoaded', function() {
1206
  // Global variables
 
1212
  let startX, startY, startWidth, startHeight;
1213
  let isDraggingDivider = false;
1214
  let activeModel = 'apwb'; // Default to APWB model
1215
+ let selectedRosebudImage = null;
1216
+ let selectedStyleTransferImage = null;
1217
+ let imageEditor = null;
1218
 
1219
  // DOM elements
1220
  const canvas = document.getElementById('canvas');
 
1256
  const apwbResponse = document.getElementById('apwbResponse');
1257
  const apwbLoading = document.getElementById('apwbLoading');
1258
 
1259
+ // DeepCoder elements
1260
+ const deepcoderBtn = document.getElementById('deepcoderBtn');
1261
+ const deepcoderModal = document.getElementById('deepcoderModal');
1262
+ const closeDeepcoderModal = document.getElementById('closeDeepcoderModal');
1263
+ const deepcoderTabs = document.querySelectorAll('.deepcoder-tab');
1264
+ const deepcoderCodeTab = document.getElementById('deepcoderCodeTab');
1265
+ const deepcoderTerminalTab = document.getElementById('deepcoderTerminalTab');
1266
+ const deepcoderCode = document.getElementById('deepcoderCode');
1267
+ const runCodeBtn = document.getElementById('runCodeBtn');
1268
+ const clearCodeBtn = document.getElementById('clearCodeBtn');
1269
+ const terminalContent = document.getElementById('terminalContent');
1270
+ const terminalCommand = document.getElementById('terminalCommand');
1271
+ const deepcoderAIPrompt = document.getElementById('deepcoderAIPrompt');
1272
+ const deepcoderAISubmit = document.getElementById('deepcoderAISubmit');
1273
+ const deepcoderAIResponse = document.getElementById('deepcoderAIResponse');
1274
+ const deepcoderAILoading = document.getElementById('deepcoderAILoading');
1275
+
1276
+ // Rosebud elements
1277
+ const rosebudBtn = document.getElementById('rosebudBtn');
1278
+ const rosebudModal = document.getElementById('rosebudModal');
1279
+ const closeRosebudModal = document.getElementById('closeRosebudModal');
1280
+ const rosebudPrompt = document.getElementById('rosebudPrompt');
1281
+ const rosebudStyle = document.getElementById('rosebudStyle');
1282
+ const rosebudRatio = document.getElementById('rosebudRatio');
1283
+ const rosebudSubmit = document.getElementById('rosebudSubmit');
1284
+ const rosebudResponse = document.getElementById('rosebudResponse');
1285
+ const rosebudLoading = document.getElementById('rosebudLoading');
1286
+ const rosebudImages = document.getElementById('rosebudImages');
1287
+ const rosebudEditBtn = document.getElementById('rosebudEditBtn');
1288
+ const rosebudDownloadBtn = document.getElementById('rosebudDownloadBtn');
1289
+ const rosebudAddToCanvasBtn = document.getElementById('rosebudAddToCanvasBtn');
1290
+ const rosebudEditControls = document.getElementById('rosebudEditControls');
1291
+
1292
+ // Rosebud Advanced elements
1293
+ const rosebudAdvancedPrompt = document.getElementById('rosebudAdvancedPrompt');
1294
+ const rosebudAdvancedStyle = document.getElementById('rosebudAdvancedStyle');
1295
+ const rosebudAdvancedRatio = document.getElementById('rosebudAdvancedRatio');
1296
+ const rosebudQuality = document.getElementById('rosebudQuality');
1297
+ const rosebudCreativity = document.getElementById('rosebudCreativity');
1298
+ const rosebudNegativePrompt = document.getElementById('rosebudNegativePrompt');
1299
+ const rosebudAdvancedSubmit = document.getElementById('rosebudAdvancedSubmit');
1300
+ const rosebudAdvancedResponse = document.getElementById('rosebudAdvancedResponse');
1301
+ const rosebudAdvancedLoading = document.getElementById('rosebudAdvancedLoading');
1302
+ const rosebudAdvancedImages = document.getElementById('rosebudAdvancedImages');
1303
+ const rosebudUpscaleBtn = document.getElementById('rosebudUpscaleBtn');
1304
+ const rosebudVariationsBtn = document.getElementById('rosebudVariationsBtn');
1305
+ const rosebudAdvancedDownloadBtn = document.getElementById('rosebudAdvancedDownloadBtn');
1306
+ const rosebudAdvancedAddToCanvasBtn = document.getElementById('rosebudAdvancedAddToCanvasBtn');
1307
+ const rosebudToolOptions = document.getElementById('rosebudToolOptions');
1308
+
1309
+ // Image Editor elements
1310
+ const imageEditorModal = document.getElementById('imageEditorModal');
1311
+ const imageEditorCanvas = document.getElementById('imageEditorCanvas');
1312
+ const imageEditorUndoBtn = document.getElementById('imageEditorUndoBtn');
1313
+ const imageEditorRedoBtn = document.getElementById('imageEditorRedoBtn');
1314
+ const closeImageEditor = document.getElementById('closeImageEditor');
1315
+ const imageEditorZoomIn = document.getElementById('imageEditorZoomIn');
1316
+ const imageEditorZoomOut = document.getElementById('imageEditorZoomOut');
1317
+ const imageEditorResetZoom = document.getElementById('imageEditorResetZoom');
1318
+ const imageEditorProperties = document.getElementById('imageEditorProperties');
1319
+ const imageEditorCancelBtn = document.getElementById('imageEditorCancelBtn');
1320
+ const imageEditorSaveBtn = document.getElementById('imageEditorSaveBtn');
1321
+
1322
+ // Style Transfer elements
1323
+ const styleTransferModal = document.getElementById('styleTransferModal');
1324
+ const closeStyleTransferModal = document.getElementById('closeStyleTransferModal');
1325
+ const styleTransferContentPreview = document.getElementById('styleTransferContentPreview');
1326
+ const styleTransferContentUpload = document.getElementById('styleTransferContentUpload');
1327
+ const styleTransferContentInput = document.getElementById('styleTransferContentInput');
1328
+ const styleTransferContentBtn = document.getElementById('styleTransferContentBtn');
1329
+ const styleTransferStylePreview = document.getElementById('styleTransferStylePreview');
1330
+ const styleTransferStyleUpload = document.getElementById('styleTransferStyleUpload');
1331
+ const styleTransferStyleInput = document.getElementById('styleTransferStyleInput');
1332
+ const styleTransferStyleBtn = document.getElementById('styleTransferStyleBtn');
1333
+ const styleTransferStrength = document.getElementById('styleTransferStrength');
1334
+ const styleTransferSubmit = document.getElementById('styleTransferSubmit');
1335
+ const styleTransferResult = document.getElementById('styleTransferResult');
1336
+ const styleTransferResultImage = document.getElementById('styleTransferResultImage');
1337
+ const styleTransferDownloadBtn = document.getElementById('styleTransferDownloadBtn');
1338
+ const styleTransferAddToCanvasBtn = document.getElementById('styleTransferAddToCanvasBtn');
1339
+ const styleTransferLoading = document.getElementById('styleTransferLoading');
1340
+
1341
  // Split view elements
1342
  const splitContainer = document.querySelector('.split-container');
1343
  const leftPanel = document.querySelector('.split-panel:first-child');
 
1350
  initEventListeners();
1351
  initAIEventListeners();
1352
  initAPWBEventListeners();
1353
+ initDeepCoderEventListeners();
1354
+ initRosebudEventListeners();
1355
+ initImageEditor();
1356
+ initStyleTransfer();
1357
  initSplitView();
1358
  loadFromLocalStorage();
1359
  }
 
1385
  exportBtn.addEventListener('click', showExportModal);
1386
  closeExport.addEventListener('click', hideExportModal);
1387
  copyCodeBtn.addEventListener('click', copyExportCode);
1388
+ downloadBtn.addEventListener('click', downloadHTML;
1389
 
1390
  // Device selector
1391
  deviceSelector.addEventListener('change', updatePreviewDevice);
 
1405
  // Model selector
1406
  modelSelector.addEventListener('change', (e) => {
1407
  activeModel = e.target.value;
1408
+ showToast(`Switched to ${activeModel === 'apwb' ? 'APWB' : activeModel === 'deepcoder' ? 'DeepCoder' : activeModel === 'rosebud' ? 'Rosebud' : 'DeepSeek'} model`);
1409
  });
1410
  }
1411
 
 
1433
  });
1434
  }
1435
 
1436
+ // Initialize DeepCoder event listeners
1437
+ function initDeepCoderEventListeners() {
1438
+ // DeepCoder button
1439
+ deepcoderBtn.addEventListener('click', showDeepcoderModal);
1440
+ closeDeepcoderModal.addEventListener('click', hideDeepcoderModal);
1441
+
1442
+ // DeepCoder tabs
1443
+ deepcoderTabs.forEach(tab => {
1444
+ tab.addEventListener('click', () => {
1445
+ const tabId = tab.dataset.tab;
1446
+ deepcoderTabs.forEach(t => t.classList.remove('active'));
1447
+ tab.classList.add('active');
1448
+
1449
+ document.querySelectorAll('.tab-content').forEach(content => {
1450
+ content.classList.remove('active');
1451
  });
1452
+
1453
+ document.getElementById(`deepcoder${tabId.charAt(0).toUpperCase() + tabId.slice(1)}Tab`).classList.add('active');
1454
  });
1455
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1456
 
1457
+ // Run code button
1458
+ runCodeBtn.addEventListener('click', runCode);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1459
 
1460
+ // Clear code button
1461
+ clearCodeBtn.addEventListener('click', clearCode);
 
 
 
 
 
 
 
1462
 
1463
+ // Terminal command input
1464
+ terminalCommand.addEventListener('keydown', (e) => {
1465
+ if (e.key === 'Enter') {
1466
+ executeTerminalCommand();
1467
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1468
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1469
 
1470
+ // DeepCoder AI submit
1471
+ deepcoderAISubmit.addEventListener('click', generateWithDeepCoder);
1472
 
1473
+ // Allow pressing Enter in the DeepCoder prompt
1474
+ deepcoderAIPrompt.addEventListener('keydown', (e) => {
1475
+ if (e.key === 'Enter' && !e.shiftKey) {
1476
+ e.preventDefault();
1477
+ generateWithDeepCoder();
1478
+ }
 
 
 
 
1479
  });
 
 
 
 
 
 
 
 
 
 
 
 
1480
  }
1481
+
1482
+ // Initialize Rosebud event listeners
1483
+ function initRosebudEventListeners() {
1484
+ // Rosebud button
1485
+ rosebudBtn.addEventListener('click', showRosebudModal);
1486
+ closeRosebudModal.addEventListener('click', hideRosebudModal);
1487
+
1488
+ // Rosebud submit
1489
+ rosebudSubmit.addEventListener('click', generateWithRosebud);
1490
+
1491
+ // Rosebud advanced submit
1492
+ rosebudAdvancedSubmit.addEventListener('click', generateWithRosebudAdvanced);
1493
+
1494
+ // Rosebud image selection
1495
+ rosebudImages.addEventListener('click', (e) => {
1496
+ if (e.target.classList.contains('rosebud-image')) {
1497
+ document.querySelectorAll('.rosebud-image').forEach(img => {
1498
+ img.classList.remove('selected');
1499
  });
1500
+ e.target.classList.add('selected');
1501
+ selectedRosebudImage = e.target.src;
1502
+ rosebudEditControls.classList.remove('hidden');
 
 
 
 
 
1503
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1504
  });
1505
 
1506
+ // Rosebud advanced image selection
1507
+ rosebudAdvancedImages.addEventListener('click', (e) => {
1508
+ if (e.target.classList.contains('rosebud-image')) {
1509
+ document.querySelectorAll('.rosebud-image').forEach(img => {
1510
+ img.classList.remove('selected');
1511
+ });
1512
+ e.target.classList.add('selected');
1513
+ selectedRosebudImage = e.target.src;
1514
+ }
1515
  });
1516
 
1517
+ // Rosebud edit button
1518
+ rosebudEditBtn.addEventListener('click', () => {
1519
+ if (selectedRosebudImage) {
1520
+ openImageEditor(selectedRosebudImage);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1521
  }
 
 
 
1522
  });
 
 
 
 
 
 
 
 
 
1523
 
1524
+ // Rosebud download button
1525
+ rosebudDownloadBtn.addEventListener('click', () => {
1526
+ if (selectedRosebudImage) {
1527
+ downloadImage(selectedRosebudImage, 'rosebud-image.png');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1528
  }
1529
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1530
 
1531
+ // Rosebud add to canvas button
1532
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1533
  </html>
prompts.txt CHANGED
@@ -1,2 +1,4 @@
1
  use this code to operate the AI agent and prompt window add so that deepseek builds the html page and the gui can redisgn the created elements
2
- add this to this website - huggingface.co/MarcRyan/apwb
 
 
 
1
  use this code to operate the AI agent and prompt window add so that deepseek builds the html page and the gui can redisgn the created elements
2
+ add this to this website - huggingface.co/MarcRyan/apwb
3
+ install and use this ollama run deepcoder:14b-preview-q8_0 to edit the website just like https://enzostvs-deepsite.hf.space/ but in additon to what is already built
4
+ give this website the functionality of rosebud.ai