Add 3 files
Browse files- README.md +7 -5
- index.html +1532 -19
- prompts.txt +2 -0
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: webtool
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: red
|
| 5 |
+
colorTo: green
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,1532 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>DeepSeek Visual Builder</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>
|
| 10 |
+
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
|
| 11 |
+
|
| 12 |
+
:root {
|
| 13 |
+
--primary: #6366f1;
|
| 14 |
+
--primary-dark: #4f46e5;
|
| 15 |
+
--secondary: #f43f5e;
|
| 16 |
+
--dark: #1e293b;
|
| 17 |
+
--light: #f8fafc;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
body {
|
| 21 |
+
font-family: 'Inter', sans-serif;
|
| 22 |
+
@apply bg-gray-50 text-gray-800;
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
.component {
|
| 26 |
+
transition: all 0.2s ease;
|
| 27 |
+
cursor: grab;
|
| 28 |
+
@apply hover:shadow-md hover:border-primary/50;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
.component:active {
|
| 32 |
+
cursor: grabbing;
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
.droppable {
|
| 36 |
+
min-height: calc(100vh - 180px);
|
| 37 |
+
transition: background-color 0.3s;
|
| 38 |
+
background-image:
|
| 39 |
+
linear-gradient(45deg, #f1f5f9 25%, transparent 25%),
|
| 40 |
+
linear-gradient(-45deg, #f1f5f9 25%, transparent 25%),
|
| 41 |
+
linear-gradient(45deg, transparent 75%, #f1f5f9 75%),
|
| 42 |
+
linear-gradient(-45deg, transparent 75%, #f1f5f9 75%);
|
| 43 |
+
background-size: 20px 20px;
|
| 44 |
+
background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
.droppable.highlight {
|
| 48 |
+
@apply bg-primary/5 border-2 border-dashed border-primary;
|
| 49 |
+
animation: pulse 1.5s infinite;
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
.canvas-component {
|
| 53 |
+
@apply relative rounded-lg mb-4 overflow-hidden group transition-all duration-200;
|
| 54 |
+
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
.canvas-component:hover {
|
| 58 |
+
@apply shadow-lg;
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
.canvas-component.selected {
|
| 62 |
+
@apply ring-2 ring-primary ring-offset-2;
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
.component-toolbar {
|
| 66 |
+
@apply absolute top-0 left-0 right-0 bg-gray-800 flex items-center justify-between px-2 h-8 opacity-0 group-hover:opacity-100 transition-opacity duration-200;
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
.component-handle {
|
| 70 |
+
@apply text-white/80 hover:text-white cursor-move flex items-center;
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
.component-actions {
|
| 74 |
+
@apply flex items-center space-x-2;
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
.component-action-btn {
|
| 78 |
+
@apply text-white/60 hover:text-white p-1;
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
.properties-panel {
|
| 82 |
+
scrollbar-width: thin;
|
| 83 |
+
scrollbar-color: var(--primary) transparent;
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
.properties-panel::-webkit-scrollbar {
|
| 87 |
+
width: 6px;
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
.properties-panel::-webkit-scrollbar-thumb {
|
| 91 |
+
@apply bg-primary/30 rounded-full;
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
.properties-panel::-webkit-scrollbar-thumb:hover {
|
| 95 |
+
@apply bg-primary/50;
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
@keyframes pulse {
|
| 99 |
+
0%, 100% { background-color: rgba(99, 102, 241, 0.05); }
|
| 100 |
+
50% { background-color: rgba(99, 102, 241, 0.1); }
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
.color-option {
|
| 104 |
+
@apply w-6 h-6 rounded-full cursor-pointer border border-gray-200;
|
| 105 |
+
transition: transform 0.2s;
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
.color-option:hover {
|
| 109 |
+
transform: scale(1.1);
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
.color-option.selected {
|
| 113 |
+
@apply ring-2 ring-offset-2 ring-gray-400;
|
| 114 |
+
transform: scale(1.1);
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
.tab-btn {
|
| 118 |
+
@apply px-4 py-2 font-medium text-sm rounded-md transition-colors;
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
.tab-btn.active {
|
| 122 |
+
@apply bg-primary text-white;
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
.tab-btn:not(.active) {
|
| 126 |
+
@apply text-gray-500 hover:text-gray-700 hover:bg-gray-100;
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
.preview-frame-container {
|
| 130 |
+
background-image:
|
| 131 |
+
linear-gradient(45deg, #e2e8f0 25%, transparent 25%),
|
| 132 |
+
linear-gradient(-45deg, #e2e8f0 25%, transparent 25%),
|
| 133 |
+
linear-gradient(45deg, transparent 75%, #e2e8f0 75%),
|
| 134 |
+
linear-gradient(-45deg, transparent 75%, #e2e8f0 75%);
|
| 135 |
+
background-size: 20px 20px;
|
| 136 |
+
background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
.toast {
|
| 140 |
+
@apply fixed bottom-4 right-4 px-4 py-2 rounded-md shadow-lg text-white font-medium flex items-center;
|
| 141 |
+
background-color: var(--primary);
|
| 142 |
+
animation: slideIn 0.3s, fadeOut 0.5s 2.5s forwards;
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
@keyframes slideIn {
|
| 146 |
+
from { transform: translateY(20px); opacity: 0; }
|
| 147 |
+
to { transform: translateY(0); opacity: 1; }
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
@keyframes fadeOut {
|
| 151 |
+
to { opacity: 0; }
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
.resize-handle {
|
| 155 |
+
@apply absolute right-0 bottom-0 w-3 h-3 bg-primary rounded-tl-md cursor-nwse-resize opacity-0 group-hover:opacity-100 transition-opacity;
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
.resize-handle:hover {
|
| 159 |
+
@apply bg-primary-dark;
|
| 160 |
+
}
|
| 161 |
+
</style>
|
| 162 |
+
</head>
|
| 163 |
+
<body class="h-screen flex flex-col overflow-hidden">
|
| 164 |
+
<!-- Header -->
|
| 165 |
+
<header class="bg-gradient-to-r from-primary to-primary-dark text-white shadow-md">
|
| 166 |
+
<div class="container mx-auto flex justify-between items-center px-4 py-3">
|
| 167 |
+
<div class="flex items-center space-x-2">
|
| 168 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 169 |
+
<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" />
|
| 170 |
+
</svg>
|
| 171 |
+
<h1 class="text-xl font-bold">DeepSeek Visual Builder</h1>
|
| 172 |
+
</div>
|
| 173 |
+
<div class="flex items-center space-x-3">
|
| 174 |
+
<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">
|
| 175 |
+
<i class="fas fa-save"></i>
|
| 176 |
+
<span>Save</span>
|
| 177 |
+
</button>
|
| 178 |
+
<button id="previewBtn" 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">
|
| 179 |
+
<i class="fas fa-eye"></i>
|
| 180 |
+
<span>Preview</span>
|
| 181 |
+
</button>
|
| 182 |
+
<button id="exportBtn" 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">
|
| 183 |
+
<i class="fas fa-file-export"></i>
|
| 184 |
+
<span>Export</span>
|
| 185 |
+
</button>
|
| 186 |
+
</div>
|
| 187 |
+
</div>
|
| 188 |
+
</header>
|
| 189 |
+
|
| 190 |
+
<!-- Main Content -->
|
| 191 |
+
<div class="flex flex-1 overflow-hidden">
|
| 192 |
+
<!-- Components Panel -->
|
| 193 |
+
<div class="w-64 bg-white border-r border-gray-200 flex flex-col">
|
| 194 |
+
<div class="p-3 border-b border-gray-200">
|
| 195 |
+
<h2 class="text-lg font-semibold text-gray-800">Components</h2>
|
| 196 |
+
<div class="mt-2 flex space-x-1">
|
| 197 |
+
<button class="tab-btn active" data-tab="basic">Basic</button>
|
| 198 |
+
<button class="tab-btn" data-tab="advanced">Advanced</button>
|
| 199 |
+
</div>
|
| 200 |
+
</div>
|
| 201 |
+
<div class="flex-1 overflow-y-auto p-3 space-y-3" id="componentsTabContent">
|
| 202 |
+
<div class="component bg-white p-3 rounded-lg border border-gray-200 shadow-sm" draggable="true" data-type="header">
|
| 203 |
+
<div class="flex items-center space-x-3">
|
| 204 |
+
<div class="bg-primary/10 text-primary p-2 rounded-lg">
|
| 205 |
+
<i class="fas fa-header"></i>
|
| 206 |
+
</div>
|
| 207 |
+
<div>
|
| 208 |
+
<h3 class="font-medium text-sm">Header</h3>
|
| 209 |
+
<p class="text-xs text-gray-500">Navigation with logo</p>
|
| 210 |
+
</div>
|
| 211 |
+
</div>
|
| 212 |
+
</div>
|
| 213 |
+
<div class="component bg-white p-3 rounded-lg border border-gray-200 shadow-sm" draggable="true" data-type="hero">
|
| 214 |
+
<div class="flex items-center space-x-3">
|
| 215 |
+
<div class="bg-blue-100 text-blue-500 p-2 rounded-lg">
|
| 216 |
+
<i class="fas fa-star"></i>
|
| 217 |
+
</div>
|
| 218 |
+
<div>
|
| 219 |
+
<h3 class="font-medium text-sm">Hero Section</h3>
|
| 220 |
+
<p class="text-xs text-gray-500">Banner with CTA</p>
|
| 221 |
+
</div>
|
| 222 |
+
</div>
|
| 223 |
+
</div>
|
| 224 |
+
<div class="component bg-white p-3 rounded-lg border border-gray-200 shadow-sm" draggable="true" data-type="features">
|
| 225 |
+
<div class="flex items-center space-x-3">
|
| 226 |
+
<div class="bg-green-100 text-green-500 p-2 rounded-lg">
|
| 227 |
+
<i class="fas fa-th-large"></i>
|
| 228 |
+
</div>
|
| 229 |
+
<div>
|
| 230 |
+
<h3 class="font-medium text-sm">Features</h3>
|
| 231 |
+
<p class="text-xs text-gray-500">Card grid layout</p>
|
| 232 |
+
</div>
|
| 233 |
+
</div>
|
| 234 |
+
</div>
|
| 235 |
+
<div class="component bg-white p-3 rounded-lg border border-gray-200 shadow-sm" draggable="true" data-type="text">
|
| 236 |
+
<div class="flex items-center space-x-3">
|
| 237 |
+
<div class="bg-purple-100 text-purple-500 p-2 rounded-lg">
|
| 238 |
+
<i class="fas fa-align-left"></i>
|
| 239 |
+
</div>
|
| 240 |
+
<div>
|
| 241 |
+
<h3 class="font-medium text-sm">Text Block</h3>
|
| 242 |
+
<p class="text-xs text-gray-500">Rich text content</p>
|
| 243 |
+
</div>
|
| 244 |
+
</div>
|
| 245 |
+
</div>
|
| 246 |
+
<div class="component bg-white p-3 rounded-lg border border-gray-200 shadow-sm" draggable="true" data-type="image">
|
| 247 |
+
<div class="flex items-center space-x-3">
|
| 248 |
+
<div class="bg-yellow-100 text-yellow-500 p-2 rounded-lg">
|
| 249 |
+
<i class="fas fa-image"></i>
|
| 250 |
+
</div>
|
| 251 |
+
<div>
|
| 252 |
+
<h3 class="font-medium text-sm">Image</h3>
|
| 253 |
+
<p class="text-xs text-gray-500">Single image</p>
|
| 254 |
+
</div>
|
| 255 |
+
</div>
|
| 256 |
+
</div>
|
| 257 |
+
<div class="component bg-white p-3 rounded-lg border border-gray-200 shadow-sm" draggable="true" data-type="cta">
|
| 258 |
+
<div class="flex items-center space-x-3">
|
| 259 |
+
<div class="bg-red-100 text-red-500 p-2 rounded-lg">
|
| 260 |
+
<i class="fas fa-bullhorn"></i>
|
| 261 |
+
</div>
|
| 262 |
+
<div>
|
| 263 |
+
<h3 class="font-medium text-sm">Call to Action</h3>
|
| 264 |
+
<p class="text-xs text-gray-500">Button with text</p>
|
| 265 |
+
</div>
|
| 266 |
+
</div>
|
| 267 |
+
</div>
|
| 268 |
+
<div class="component bg-white p-3 rounded-lg border border-gray-200 shadow-sm" draggable="true" data-type="footer">
|
| 269 |
+
<div class="flex items-center space-x-3">
|
| 270 |
+
<div class="bg-gray-100 text-gray-500 p-2 rounded-lg">
|
| 271 |
+
<i class="fas fa-window-minimize"></i>
|
| 272 |
+
</div>
|
| 273 |
+
<div>
|
| 274 |
+
<h3 class="font-medium text-sm">Footer</h3>
|
| 275 |
+
<p class="text-xs text-gray-500">Page footer</p>
|
| 276 |
+
</div>
|
| 277 |
+
</div>
|
| 278 |
+
</div>
|
| 279 |
+
</div>
|
| 280 |
+
</div>
|
| 281 |
+
|
| 282 |
+
<!-- Canvas Area -->
|
| 283 |
+
<div class="flex-1 bg-gray-100 overflow-auto p-6">
|
| 284 |
+
<div id="canvas" class="droppable bg-white mx-auto w-full max-w-4xl min-h-full rounded-lg shadow-sm relative">
|
| 285 |
+
<div class="absolute inset-0 flex items-center justify-center" id="emptyState">
|
| 286 |
+
<div class="text-center p-6 max-w-md">
|
| 287 |
+
<div class="bg-gray-100 w-16 h-16 rounded-full flex items-center justify-center mx-auto mb-4">
|
| 288 |
+
<i class="fas fa-plus text-gray-400 text-2xl"></i>
|
| 289 |
+
</div>
|
| 290 |
+
<h3 class="text-lg font-medium text-gray-700 mb-1">Drag components here</h3>
|
| 291 |
+
<p class="text-gray-500 text-sm">Start building your page by dragging components from the left panel</p>
|
| 292 |
+
</div>
|
| 293 |
+
</div>
|
| 294 |
+
</div>
|
| 295 |
+
</div>
|
| 296 |
+
|
| 297 |
+
<!-- Properties Panel -->
|
| 298 |
+
<div class="w-72 bg-white border-l border-gray-200 flex flex-col">
|
| 299 |
+
<div class="p-3 border-b border-gray-200">
|
| 300 |
+
<h2 class="text-lg font-semibold text-gray-800">Properties</h2>
|
| 301 |
+
</div>
|
| 302 |
+
<div id="propertiesPanel" class="flex-1 overflow-y-auto properties-panel p-4">
|
| 303 |
+
<div class="text-center text-gray-500 py-10">
|
| 304 |
+
<i class="fas fa-mouse-pointer text-3xl mb-3 text-gray-300"></i>
|
| 305 |
+
<p>Select a component to edit its properties</p>
|
| 306 |
+
</div>
|
| 307 |
+
</div>
|
| 308 |
+
</div>
|
| 309 |
+
</div>
|
| 310 |
+
|
| 311 |
+
<!-- Preview Modal -->
|
| 312 |
+
<div id="previewModal" class="fixed inset-0 bg-black/50 hidden items-center justify-center z-50 p-4">
|
| 313 |
+
<div class="bg-white rounded-lg w-full max-w-6xl h-[90vh] flex flex-col overflow-hidden shadow-xl">
|
| 314 |
+
<div class="p-4 border-b flex justify-between items-center bg-gray-50">
|
| 315 |
+
<h3 class="text-lg font-semibold">Live Preview</h3>
|
| 316 |
+
<div class="flex items-center space-x-3">
|
| 317 |
+
<div class="flex items-center space-x-1 text-sm bg-gray-100 rounded-md px-2 py-1">
|
| 318 |
+
<span>Device:</span>
|
| 319 |
+
<select id="deviceSelector" class="bg-transparent border-none focus:ring-0 text-sm">
|
| 320 |
+
<option value="desktop">Desktop</option>
|
| 321 |
+
<option value="tablet">Tablet</option>
|
| 322 |
+
<option value="mobile">Mobile</option>
|
| 323 |
+
</select>
|
| 324 |
+
</div>
|
| 325 |
+
<button id="closePreview" class="text-gray-500 hover:text-gray-700">
|
| 326 |
+
<i class="fas fa-times"></i>
|
| 327 |
+
</button>
|
| 328 |
+
</div>
|
| 329 |
+
</div>
|
| 330 |
+
<div class="flex-1 overflow-hidden p-4 bg-gray-100 flex items-center justify-center">
|
| 331 |
+
<div id="previewContainer" class="w-full h-full preview-frame-container rounded overflow-hidden">
|
| 332 |
+
<iframe id="previewFrame" class="w-full h-full bg-white border-none"></iframe>
|
| 333 |
+
</div>
|
| 334 |
+
</div>
|
| 335 |
+
</div>
|
| 336 |
+
</div>
|
| 337 |
+
|
| 338 |
+
<!-- Export Modal -->
|
| 339 |
+
<div id="exportModal" class="fixed inset-0 bg-black/50 hidden items-center justify-center z-50 p-4">
|
| 340 |
+
<div class="bg-white rounded-lg w-full max-w-2xl flex flex-col overflow-hidden shadow-xl">
|
| 341 |
+
<div class="p-4 border-b flex justify-between items-center bg-gray-50">
|
| 342 |
+
<h3 class="text-lg font-semibold">Export HTML</h3>
|
| 343 |
+
<button id="closeExport" class="text-gray-500 hover:text-gray-700">
|
| 344 |
+
<i class="fas fa-times"></i>
|
| 345 |
+
</button>
|
| 346 |
+
</div>
|
| 347 |
+
<div class="p-4 flex-1 overflow-auto">
|
| 348 |
+
<div class="flex space-x-2 mb-4">
|
| 349 |
+
<button id="copyCodeBtn" class="bg-primary hover:bg-primary-dark text-white px-3 py-1.5 rounded-md text-sm font-medium">
|
| 350 |
+
<i class="fas fa-copy mr-1"></i> Copy Code
|
| 351 |
+
</button>
|
| 352 |
+
<button id="downloadBtn" class="bg-gray-200 hover:bg-gray-300 text-gray-700 px-3 py-1.5 rounded-md text-sm font-medium">
|
| 353 |
+
<i class="fas fa-download mr-1"></i> Download
|
| 354 |
+
</button>
|
| 355 |
+
</div>
|
| 356 |
+
<pre id="exportCode" class="bg-gray-100 p-3 rounded-md text-sm overflow-x-auto max-h-[60vh]"></pre>
|
| 357 |
+
</div>
|
| 358 |
+
</div>
|
| 359 |
+
</div>
|
| 360 |
+
|
| 361 |
+
<script>
|
| 362 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 363 |
+
// Global variables
|
| 364 |
+
let draggedItem = null;
|
| 365 |
+
let selectedComponent = null;
|
| 366 |
+
let components = [];
|
| 367 |
+
let componentCounter = 0;
|
| 368 |
+
let isResizing = false;
|
| 369 |
+
let startX, startY, startWidth, startHeight;
|
| 370 |
+
|
| 371 |
+
// DOM elements
|
| 372 |
+
const canvas = document.getElementById('canvas');
|
| 373 |
+
const emptyState = document.getElementById('emptyState');
|
| 374 |
+
const propertiesPanel = document.getElementById('propertiesPanel');
|
| 375 |
+
const previewModal = document.getElementById('previewModal');
|
| 376 |
+
const previewFrame = document.getElementById('previewFrame');
|
| 377 |
+
const previewContainer = document.getElementById('previewContainer');
|
| 378 |
+
const deviceSelector = document.getElementById('deviceSelector');
|
| 379 |
+
const previewBtn = document.getElementById('previewBtn');
|
| 380 |
+
const closePreview = document.getElementById('closePreview');
|
| 381 |
+
const saveBtn = document.getElementById('saveBtn');
|
| 382 |
+
const exportBtn = document.getElementById('exportBtn');
|
| 383 |
+
const exportModal = document.getElementById('exportModal');
|
| 384 |
+
const exportCode = document.getElementById('exportCode');
|
| 385 |
+
const copyCodeBtn = document.getElementById('copyCodeBtn');
|
| 386 |
+
const downloadBtn = document.getElementById('downloadBtn');
|
| 387 |
+
const closeExport = document.getElementById('closeExport');
|
| 388 |
+
const tabBtns = document.querySelectorAll('[data-tab]');
|
| 389 |
+
|
| 390 |
+
// Initialize the builder
|
| 391 |
+
function initBuilder() {
|
| 392 |
+
initDragAndDrop();
|
| 393 |
+
initEventListeners();
|
| 394 |
+
loadFromLocalStorage();
|
| 395 |
+
}
|
| 396 |
+
|
| 397 |
+
// Initialize drag and drop
|
| 398 |
+
function initDragAndDrop() {
|
| 399 |
+
// Add event listeners to all components
|
| 400 |
+
document.querySelectorAll('.component').forEach(item => {
|
| 401 |
+
item.addEventListener('dragstart', handleDragStart);
|
| 402 |
+
item.addEventListener('dragend', handleDragEnd);
|
| 403 |
+
});
|
| 404 |
+
|
| 405 |
+
// Canvas drop events
|
| 406 |
+
canvas.addEventListener('dragover', handleDragOver);
|
| 407 |
+
canvas.addEventListener('dragleave', handleDragLeave);
|
| 408 |
+
canvas.addEventListener('drop', handleDrop);
|
| 409 |
+
}
|
| 410 |
+
|
| 411 |
+
// Initialize event listeners
|
| 412 |
+
function initEventListeners() {
|
| 413 |
+
// Preview button
|
| 414 |
+
previewBtn.addEventListener('click', showPreview);
|
| 415 |
+
closePreview.addEventListener('click', hidePreview);
|
| 416 |
+
|
| 417 |
+
// Save button
|
| 418 |
+
saveBtn.addEventListener('click', saveToLocalStorage);
|
| 419 |
+
|
| 420 |
+
// Export button
|
| 421 |
+
exportBtn.addEventListener('click', showExportModal);
|
| 422 |
+
closeExport.addEventListener('click', hideExportModal);
|
| 423 |
+
copyCodeBtn.addEventListener('click', copyExportCode);
|
| 424 |
+
downloadBtn.addEventListener('click', downloadHTML);
|
| 425 |
+
|
| 426 |
+
// Device selector
|
| 427 |
+
deviceSelector.addEventListener('change', updatePreviewDevice);
|
| 428 |
+
|
| 429 |
+
// Tab buttons
|
| 430 |
+
tabBtns.forEach(btn => {
|
| 431 |
+
btn.addEventListener('click', () => {
|
| 432 |
+
tabBtns.forEach(b => b.classList.remove('active'));
|
| 433 |
+
btn.classList.add('active');
|
| 434 |
+
// In a real app, you would switch tab content here
|
| 435 |
+
});
|
| 436 |
+
});
|
| 437 |
+
}
|
| 438 |
+
|
| 439 |
+
// Load from localStorage
|
| 440 |
+
function loadFromLocalStorage() {
|
| 441 |
+
const savedData = localStorage.getItem('deepseek-builder');
|
| 442 |
+
if (savedData) {
|
| 443 |
+
try {
|
| 444 |
+
const data = JSON.parse(savedData);
|
| 445 |
+
components = data.components || [];
|
| 446 |
+
componentCounter = data.componentCounter || 0;
|
| 447 |
+
|
| 448 |
+
// Recreate components on canvas
|
| 449 |
+
components.forEach(comp => {
|
| 450 |
+
recreateComponent(comp);
|
| 451 |
+
});
|
| 452 |
+
|
| 453 |
+
if (components.length > 0) {
|
| 454 |
+
emptyState.style.display = 'none';
|
| 455 |
+
}
|
| 456 |
+
|
| 457 |
+
showToast('Previous work loaded');
|
| 458 |
+
} catch (e) {
|
| 459 |
+
console.error('Failed to load saved data:', e);
|
| 460 |
+
}
|
| 461 |
+
}
|
| 462 |
+
}
|
| 463 |
+
|
| 464 |
+
// Save to localStorage
|
| 465 |
+
function saveToLocalStorage() {
|
| 466 |
+
const data = {
|
| 467 |
+
components: components,
|
| 468 |
+
componentCounter: componentCounter
|
| 469 |
+
};
|
| 470 |
+
|
| 471 |
+
localStorage.setItem('deepseek-builder', JSON.stringify(data));
|
| 472 |
+
showToast('Progress saved successfully');
|
| 473 |
+
}
|
| 474 |
+
|
| 475 |
+
// Recreate component from saved data
|
| 476 |
+
function recreateComponent(componentData) {
|
| 477 |
+
const componentWrapper = document.createElement('div');
|
| 478 |
+
componentWrapper.className = 'canvas-component bg-white';
|
| 479 |
+
componentWrapper.id = componentData.id;
|
| 480 |
+
componentWrapper.style.position = 'absolute';
|
| 481 |
+
componentWrapper.style.left = `${componentData.position.x}px`;
|
| 482 |
+
componentWrapper.style.top = `${componentData.position.y}px`;
|
| 483 |
+
componentWrapper.style.width = componentData.size?.width || '100%';
|
| 484 |
+
componentWrapper.style.height = componentData.size?.height || 'auto';
|
| 485 |
+
|
| 486 |
+
componentWrapper.innerHTML = `
|
| 487 |
+
<div class="component-toolbar">
|
| 488 |
+
<div class="component-handle" draggable="true">
|
| 489 |
+
<i class="fas fa-grip-vertical mr-1"></i>
|
| 490 |
+
<span class="text-xs">${componentData.type}</span>
|
| 491 |
+
</div>
|
| 492 |
+
<div class="component-actions">
|
| 493 |
+
<button class="component-action-btn edit-btn" title="Edit">
|
| 494 |
+
<i class="fas fa-pen"></i>
|
| 495 |
+
</button>
|
| 496 |
+
<button class="component-action-btn delete-btn" title="Delete">
|
| 497 |
+
<i class="fas fa-trash"></i>
|
| 498 |
+
</button>
|
| 499 |
+
</div>
|
| 500 |
+
</div>
|
| 501 |
+
<div class="component-content"></div>
|
| 502 |
+
<div class="resize-handle"></div>
|
| 503 |
+
`;
|
| 504 |
+
|
| 505 |
+
canvas.appendChild(componentWrapper);
|
| 506 |
+
renderComponent(componentData.id);
|
| 507 |
+
|
| 508 |
+
// Make draggable
|
| 509 |
+
makeDraggable(componentWrapper, componentData.id);
|
| 510 |
+
|
| 511 |
+
// Add event listeners to controls
|
| 512 |
+
componentWrapper.querySelector('.edit-btn').addEventListener('click', () => {
|
| 513 |
+
selectComponent(componentData.id);
|
| 514 |
+
});
|
| 515 |
+
|
| 516 |
+
componentWrapper.querySelector('.delete-btn').addEventListener('click', () => {
|
| 517 |
+
deleteComponent(componentData.id);
|
| 518 |
+
});
|
| 519 |
+
|
| 520 |
+
// Add resize handle
|
| 521 |
+
const resizeHandle = componentWrapper.querySelector('.resize-handle');
|
| 522 |
+
resizeHandle.addEventListener('mousedown', initResize);
|
| 523 |
+
}
|
| 524 |
+
|
| 525 |
+
// Drag start handler
|
| 526 |
+
function handleDragStart(e) {
|
| 527 |
+
draggedItem = e.target;
|
| 528 |
+
e.dataTransfer.setData('text/plain', e.target.dataset.type);
|
| 529 |
+
e.target.classList.add('opacity-50', 'scale-95');
|
| 530 |
+
|
| 531 |
+
// Hide empty state if it's the first component
|
| 532 |
+
emptyState.style.display = 'none';
|
| 533 |
+
}
|
| 534 |
+
|
| 535 |
+
// Drag end handler
|
| 536 |
+
function handleDragEnd(e) {
|
| 537 |
+
e.target.classList.remove('opacity-50', 'scale-95');
|
| 538 |
+
}
|
| 539 |
+
|
| 540 |
+
// Drag over handler
|
| 541 |
+
function handleDragOver(e) {
|
| 542 |
+
e.preventDefault();
|
| 543 |
+
canvas.classList.add('highlight');
|
| 544 |
+
}
|
| 545 |
+
|
| 546 |
+
// Drag leave handler
|
| 547 |
+
function handleDragLeave(e) {
|
| 548 |
+
e.preventDefault();
|
| 549 |
+
canvas.classList.remove('highlight');
|
| 550 |
+
}
|
| 551 |
+
|
| 552 |
+
// Drop handler
|
| 553 |
+
function handleDrop(e) {
|
| 554 |
+
e.preventDefault();
|
| 555 |
+
canvas.classList.remove('highlight');
|
| 556 |
+
|
| 557 |
+
const componentType = e.dataTransfer.getData('text/plain');
|
| 558 |
+
createComponent(componentType, e.clientX, e.clientY);
|
| 559 |
+
|
| 560 |
+
if (draggedItem) {
|
| 561 |
+
draggedItem.classList.remove('opacity-50', 'scale-95');
|
| 562 |
+
draggedItem = null;
|
| 563 |
+
}
|
| 564 |
+
}
|
| 565 |
+
|
| 566 |
+
// Create a new component on the canvas
|
| 567 |
+
function createComponent(type, x, y) {
|
| 568 |
+
const rect = canvas.getBoundingClientRect();
|
| 569 |
+
const relativeX = x - rect.left;
|
| 570 |
+
const relativeY = y - rect.top;
|
| 571 |
+
|
| 572 |
+
const componentId = `component-${componentCounter++}`;
|
| 573 |
+
let defaultProps = {};
|
| 574 |
+
|
| 575 |
+
switch(type) {
|
| 576 |
+
case 'header':
|
| 577 |
+
defaultProps = {
|
| 578 |
+
bgColor: 'primary',
|
| 579 |
+
textColor: 'white',
|
| 580 |
+
logoText: 'Your Logo',
|
| 581 |
+
links: ['Home', 'About', 'Contact']
|
| 582 |
+
};
|
| 583 |
+
break;
|
| 584 |
+
|
| 585 |
+
case 'hero':
|
| 586 |
+
defaultProps = {
|
| 587 |
+
bgColor: 'primary',
|
| 588 |
+
textColor: 'white',
|
| 589 |
+
title: 'Welcome to Our Site',
|
| 590 |
+
subtitle: 'This is a hero section that grabs attention',
|
| 591 |
+
buttonText: 'Get Started',
|
| 592 |
+
buttonColor: 'white',
|
| 593 |
+
buttonTextColor: 'primary'
|
| 594 |
+
};
|
| 595 |
+
break;
|
| 596 |
+
|
| 597 |
+
case 'features':
|
| 598 |
+
defaultProps = {
|
| 599 |
+
bgColor: 'gray-50',
|
| 600 |
+
title: 'Our Features',
|
| 601 |
+
features: [
|
| 602 |
+
{ title: 'Feature One', description: 'Description of feature one goes here', icon: 'fa-rocket' },
|
| 603 |
+
{ title: 'Feature Two', description: 'Description of feature two goes here', icon: 'fa-bolt' },
|
| 604 |
+
{ title: 'Feature Three', description: 'Description of feature three goes here', icon: 'fa-cog' }
|
| 605 |
+
]
|
| 606 |
+
};
|
| 607 |
+
break;
|
| 608 |
+
|
| 609 |
+
case 'text':
|
| 610 |
+
defaultProps = {
|
| 611 |
+
title: 'Section Title',
|
| 612 |
+
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.',
|
| 613 |
+
textAlign: 'left'
|
| 614 |
+
};
|
| 615 |
+
break;
|
| 616 |
+
|
| 617 |
+
case 'image':
|
| 618 |
+
defaultProps = {
|
| 619 |
+
src: 'https://via.placeholder.com/800x400?text=Your+Image',
|
| 620 |
+
alt: 'Placeholder image',
|
| 621 |
+
rounded: 'lg',
|
| 622 |
+
padding: '4'
|
| 623 |
+
};
|
| 624 |
+
break;
|
| 625 |
+
|
| 626 |
+
case 'cta':
|
| 627 |
+
defaultProps = {
|
| 628 |
+
bgColor: 'primary/10',
|
| 629 |
+
title: 'Ready to get started?',
|
| 630 |
+
subtitle: 'Sign up today and get 30 days free trial',
|
| 631 |
+
buttonText: 'Sign Up Now',
|
| 632 |
+
buttonColor: 'primary',
|
| 633 |
+
buttonTextColor: 'white'
|
| 634 |
+
};
|
| 635 |
+
break;
|
| 636 |
+
|
| 637 |
+
case 'footer':
|
| 638 |
+
defaultProps = {
|
| 639 |
+
bgColor: 'gray-800',
|
| 640 |
+
textColor: 'white',
|
| 641 |
+
columns: [
|
| 642 |
+
{ title: 'Company', links: ['About Us', 'Careers', 'Contact'] },
|
| 643 |
+
{ title: 'Products', links: ['Features', 'Pricing', 'API'] },
|
| 644 |
+
{ title: 'Resources', links: ['Documentation', 'Guides', 'Blog'] },
|
| 645 |
+
{ title: 'Legal', links: ['Privacy', 'Terms', 'Cookie Policy'] }
|
| 646 |
+
],
|
| 647 |
+
copyright: '© 2023 Your Company. All rights reserved.'
|
| 648 |
+
};
|
| 649 |
+
break;
|
| 650 |
+
}
|
| 651 |
+
|
| 652 |
+
// Create component wrapper
|
| 653 |
+
const componentWrapper = document.createElement('div');
|
| 654 |
+
componentWrapper.className = 'canvas-component bg-white';
|
| 655 |
+
componentWrapper.id = componentId;
|
| 656 |
+
componentWrapper.style.position = 'absolute';
|
| 657 |
+
componentWrapper.style.left = `${relativeX}px`;
|
| 658 |
+
componentWrapper.style.top = `${relativeY}px`;
|
| 659 |
+
componentWrapper.style.width = '100%';
|
| 660 |
+
|
| 661 |
+
componentWrapper.innerHTML = `
|
| 662 |
+
<div class="component-toolbar">
|
| 663 |
+
<div class="component-handle" draggable="true">
|
| 664 |
+
<i class="fas fa-grip-vertical mr-1"></i>
|
| 665 |
+
<span class="text-xs">${type}</span>
|
| 666 |
+
</div>
|
| 667 |
+
<div class="component-actions">
|
| 668 |
+
<button class="component-action-btn edit-btn" title="Edit">
|
| 669 |
+
<i class="fas fa-pen"></i>
|
| 670 |
+
</button>
|
| 671 |
+
<button class="component-action-btn delete-btn" title="Delete">
|
| 672 |
+
<i class="fas fa-trash"></i>
|
| 673 |
+
</button>
|
| 674 |
+
</div>
|
| 675 |
+
</div>
|
| 676 |
+
<div class="component-content"></div>
|
| 677 |
+
<div class="resize-handle"></div>
|
| 678 |
+
`;
|
| 679 |
+
|
| 680 |
+
// Add to canvas
|
| 681 |
+
canvas.appendChild(componentWrapper);
|
| 682 |
+
|
| 683 |
+
// Store component data
|
| 684 |
+
const componentData = {
|
| 685 |
+
id: componentId,
|
| 686 |
+
type: type,
|
| 687 |
+
props: defaultProps,
|
| 688 |
+
position: { x: relativeX, y: relativeY },
|
| 689 |
+
size: { width: '100%', height: 'auto' }
|
| 690 |
+
};
|
| 691 |
+
|
| 692 |
+
components.push(componentData);
|
| 693 |
+
|
| 694 |
+
// Render the component content
|
| 695 |
+
renderComponent(componentId);
|
| 696 |
+
|
| 697 |
+
// Make draggable
|
| 698 |
+
makeDraggable(componentWrapper, componentId);
|
| 699 |
+
|
| 700 |
+
// Add event listeners to controls
|
| 701 |
+
componentWrapper.querySelector('.edit-btn').addEventListener('click', () => {
|
| 702 |
+
selectComponent(componentId);
|
| 703 |
+
});
|
| 704 |
+
|
| 705 |
+
componentWrapper.querySelector('.delete-btn').addEventListener('click', () => {
|
| 706 |
+
deleteComponent(componentId);
|
| 707 |
+
});
|
| 708 |
+
|
| 709 |
+
// Add resize handle
|
| 710 |
+
const resizeHandle = componentWrapper.querySelector('.resize-handle');
|
| 711 |
+
resizeHandle.addEventListener('mousedown', initResize);
|
| 712 |
+
|
| 713 |
+
// Select the new component
|
| 714 |
+
selectComponent(componentId);
|
| 715 |
+
}
|
| 716 |
+
|
| 717 |
+
// Make component draggable
|
| 718 |
+
function makeDraggable(element, componentId) {
|
| 719 |
+
const handle = element.querySelector('.component-handle');
|
| 720 |
+
|
| 721 |
+
handle.addEventListener('mousedown', function(e) {
|
| 722 |
+
e.preventDefault();
|
| 723 |
+
|
| 724 |
+
const rect = canvas.getBoundingClientRect();
|
| 725 |
+
let posX = e.clientX - rect.left;
|
| 726 |
+
let posY = e.clientY - rect.top;
|
| 727 |
+
|
| 728 |
+
function moveElement(e) {
|
| 729 |
+
const newX = e.clientX - rect.left - posX + parseInt(element.style.left);
|
| 730 |
+
const newY = e.clientY - rect.top - posY + parseInt(element.style.top);
|
| 731 |
+
|
| 732 |
+
// Constrain to canvas bounds
|
| 733 |
+
const constrainedX = Math.max(0, Math.min(newX, rect.width - element.offsetWidth));
|
| 734 |
+
const constrainedY = Math.max(0, Math.min(newY, rect.height - element.offsetHeight));
|
| 735 |
+
|
| 736 |
+
element.style.left = `${constrainedX}px`;
|
| 737 |
+
element.style.top = `${constrainedY}px`;
|
| 738 |
+
|
| 739 |
+
// Update component data
|
| 740 |
+
const component = components.find(c => c.id === componentId);
|
| 741 |
+
if (component) {
|
| 742 |
+
component.position = { x: constrainedX, y: constrainedY };
|
| 743 |
+
}
|
| 744 |
+
}
|
| 745 |
+
|
| 746 |
+
function stopMoving() {
|
| 747 |
+
document.removeEventListener('mousemove', moveElement);
|
| 748 |
+
document.removeEventListener('mouseup', stopMoving);
|
| 749 |
+
}
|
| 750 |
+
|
| 751 |
+
document.addEventListener('mousemove', moveElement);
|
| 752 |
+
document.addEventListener('mouseup', stopMoving);
|
| 753 |
+
});
|
| 754 |
+
}
|
| 755 |
+
|
| 756 |
+
// Initialize resize
|
| 757 |
+
function initResize(e) {
|
| 758 |
+
e.preventDefault();
|
| 759 |
+
e.stopPropagation();
|
| 760 |
+
|
| 761 |
+
isResizing = true;
|
| 762 |
+
const element = e.target.parentElement;
|
| 763 |
+
|
| 764 |
+
startX = e.clientX;
|
| 765 |
+
startY = e.clientY;
|
| 766 |
+
startWidth = parseInt(element.style.width, 10) || element.offsetWidth;
|
| 767 |
+
startHeight = parseInt(element.style.height, 10) || element.offsetHeight;
|
| 768 |
+
|
| 769 |
+
document.addEventListener('mousemove', resizeElement);
|
| 770 |
+
document.addEventListener('mouseup', stopResize);
|
| 771 |
+
}
|
| 772 |
+
|
| 773 |
+
// Resize element
|
| 774 |
+
function resizeElement(e) {
|
| 775 |
+
if (!isResizing) return;
|
| 776 |
+
|
| 777 |
+
const element = document.getElementById(selectedComponent);
|
| 778 |
+
if (!element) return;
|
| 779 |
+
|
| 780 |
+
const width = startWidth + (e.clientX - startX);
|
| 781 |
+
const height = startHeight + (e.clientY - startY);
|
| 782 |
+
|
| 783 |
+
// Minimum size constraints
|
| 784 |
+
const minWidth = 100;
|
| 785 |
+
const minHeight = 50;
|
| 786 |
+
|
| 787 |
+
element.style.width = `${Math.max(minWidth, width)}px`;
|
| 788 |
+
element.style.height = `${Math.max(minHeight, height)}px`;
|
| 789 |
+
|
| 790 |
+
// Update component data
|
| 791 |
+
const component = components.find(c => c.id === selectedComponent);
|
| 792 |
+
if (component) {
|
| 793 |
+
component.size = {
|
| 794 |
+
width: `${Math.max(minWidth, width)}px`,
|
| 795 |
+
height: `${Math.max(minHeight, height)}px`
|
| 796 |
+
};
|
| 797 |
+
}
|
| 798 |
+
}
|
| 799 |
+
|
| 800 |
+
// Stop resize
|
| 801 |
+
function stopResize() {
|
| 802 |
+
isResizing = false;
|
| 803 |
+
document.removeEventListener('mousemove', resizeElement);
|
| 804 |
+
document.removeEventListener('mouseup', stopResize);
|
| 805 |
+
}
|
| 806 |
+
|
| 807 |
+
// Select a component to edit its properties
|
| 808 |
+
function selectComponent(componentId) {
|
| 809 |
+
// Deselect previous component
|
| 810 |
+
if (selectedComponent) {
|
| 811 |
+
const prevElement = document.getElementById(selectedComponent);
|
| 812 |
+
if (prevElement) {
|
| 813 |
+
prevElement.classList.remove('selected');
|
| 814 |
+
}
|
| 815 |
+
}
|
| 816 |
+
|
| 817 |
+
// Select new component
|
| 818 |
+
selectedComponent = componentId;
|
| 819 |
+
const element = document.getElementById(componentId);
|
| 820 |
+
if (element) {
|
| 821 |
+
element.classList.add('selected');
|
| 822 |
+
element.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
| 823 |
+
}
|
| 824 |
+
|
| 825 |
+
// Find component data
|
| 826 |
+
const component = components.find(c => c.id === componentId);
|
| 827 |
+
if (!component) return;
|
| 828 |
+
|
| 829 |
+
// Update properties panel based on component type
|
| 830 |
+
updatePropertiesPanel(component);
|
| 831 |
+
}
|
| 832 |
+
|
| 833 |
+
// Update properties panel with component-specific controls
|
| 834 |
+
function updatePropertiesPanel(component) {
|
| 835 |
+
let propertiesHtml = '';
|
| 836 |
+
|
| 837 |
+
switch(component.type) {
|
| 838 |
+
case 'header':
|
| 839 |
+
propertiesHtml = `
|
| 840 |
+
<div class="space-y-4">
|
| 841 |
+
<h3 class="font-medium text-gray-800">Header Settings</h3>
|
| 842 |
+
<div>
|
| 843 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Logo Text</label>
|
| 844 |
+
<input type="text" class="w-full p-2 border rounded-md text-sm" value="${component.props.logoText}" data-prop="logoText">
|
| 845 |
+
</div>
|
| 846 |
+
<div>
|
| 847 |
+
<label class="block text-sm font-medium text-gray-700 mb-2">Background Color</label>
|
| 848 |
+
<div class="flex flex-wrap gap-2">
|
| 849 |
+
<div class="color-option bg-primary ${component.props.bgColor === 'primary' ? 'selected' : ''}" data-color="primary" data-prop="bgColor"></div>
|
| 850 |
+
<div class="color-option bg-gray-800 ${component.props.bgColor === 'gray-800' ? 'selected' : ''}" data-color="gray-800" data-prop="bgColor"></div>
|
| 851 |
+
<div class="color-option bg-indigo-600 ${component.props.bgColor === 'indigo-600' ? 'selected' : ''}" data-color="indigo-600" data-prop="bgColor"></div>
|
| 852 |
+
<div class="color-option bg-blue-600 ${component.props.bgColor === 'blue-600' ? 'selected' : ''}" data-color="blue-600" data-prop="bgColor"></div>
|
| 853 |
+
<div class="color-option bg-green-600 ${component.props.bgColor === 'green-600' ? 'selected' : ''}" data-color="green-600" data-prop="bgColor"></div>
|
| 854 |
+
</div>
|
| 855 |
+
</div>
|
| 856 |
+
<div>
|
| 857 |
+
<label class="block text-sm font-medium text-gray-700 mb-2">Text Color</label>
|
| 858 |
+
<div class="flex flex-wrap gap-2">
|
| 859 |
+
<div class="color-option bg-white border ${component.props.textColor === 'white' ? 'selected' : ''}" data-color="white" data-prop="textColor"></div>
|
| 860 |
+
<div class="color-option bg-gray-100 ${component.props.textColor === 'gray-100' ? 'selected' : ''}" data-color="gray-100" data-prop="textColor"></div>
|
| 861 |
+
<div class="color-option bg-gray-200 ${component.props.textColor === 'gray-200' ? 'selected' : ''}" data-color="gray-200" data-prop="textColor"></div>
|
| 862 |
+
</div>
|
| 863 |
+
</div>
|
| 864 |
+
<div>
|
| 865 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Navigation Links</label>
|
| 866 |
+
<div class="links-container space-y-2">
|
| 867 |
+
${component.props.links.map((link, index) => `
|
| 868 |
+
<div class="flex items-center space-x-2">
|
| 869 |
+
<input type="text" class="flex-1 p-2 border rounded-md text-sm" value="${link}" data-link-index="${index}">
|
| 870 |
+
<button class="remove-link-btn p-2 text-red-500" data-link-index="${index}">
|
| 871 |
+
<i class="fas fa-times"></i>
|
| 872 |
+
</button>
|
| 873 |
+
</div>
|
| 874 |
+
`).join('')}
|
| 875 |
+
</div>
|
| 876 |
+
<button class="add-link-btn mt-2 text-sm text-primary hover:text-primary-dark flex items-center">
|
| 877 |
+
<i class="fas fa-plus mr-1"></i> Add Link
|
| 878 |
+
</button>
|
| 879 |
+
</div>
|
| 880 |
+
</div>
|
| 881 |
+
`;
|
| 882 |
+
break;
|
| 883 |
+
|
| 884 |
+
case 'hero':
|
| 885 |
+
propertiesHtml = `
|
| 886 |
+
<div class="space-y-4">
|
| 887 |
+
<h3 class="font-medium text-gray-800">Hero Settings</h3>
|
| 888 |
+
<div>
|
| 889 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Title</label>
|
| 890 |
+
<input type="text" class="w-full p-2 border rounded-md text-sm" value="${component.props.title}" data-prop="title">
|
| 891 |
+
</div>
|
| 892 |
+
<div>
|
| 893 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Subtitle</label>
|
| 894 |
+
<textarea class="w-full p-2 border rounded-md text-sm" rows="2" data-prop="subtitle">${component.props.subtitle}</textarea>
|
| 895 |
+
</div>
|
| 896 |
+
<div>
|
| 897 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Button Text</label>
|
| 898 |
+
<input type="text" class="w-full p-2 border rounded-md text-sm" value="${component.props.buttonText}" data-prop="buttonText">
|
| 899 |
+
</div>
|
| 900 |
+
<div>
|
| 901 |
+
<label class="block text-sm font-medium text-gray-700 mb-2">Background Color</label>
|
| 902 |
+
<div class="flex flex-wrap gap-2">
|
| 903 |
+
<div class="color-option bg-primary ${component.props.bgColor === 'primary' ? 'selected' : ''}" data-color="primary" data-prop="bgColor"></div>
|
| 904 |
+
<div class="color-option bg-blue-500 ${component.props.bgColor === 'blue-500' ? 'selected' : ''}" data-color="blue-500" data-prop="bgColor"></div>
|
| 905 |
+
<div class="color-option bg-indigo-600 ${component.props.bgColor === 'indigo-600' ? 'selected' : ''}" data-color="indigo-600" data-prop="bgColor"></div>
|
| 906 |
+
<div class="color-option bg-purple-600 ${component.props.bgColor === 'purple-600' ? 'selected' : ''}" data-color="purple-600" data-prop="bgColor"></div>
|
| 907 |
+
<div class="color-option bg-gray-800 ${component.props.bgColor === 'gray-800' ? 'selected' : ''}" data-color="gray-800" data-prop="bgColor"></div>
|
| 908 |
+
</div>
|
| 909 |
+
</div>
|
| 910 |
+
<div class="grid grid-cols-2 gap-4">
|
| 911 |
+
<div>
|
| 912 |
+
<label class="block text-sm font-medium text-gray-700 mb-2">Button Color</label>
|
| 913 |
+
<div class="flex flex-wrap gap-2">
|
| 914 |
+
<div class="color-option bg-white border ${component.props.buttonColor === 'white' ? 'selected' : ''}" data-color="white" data-prop="buttonColor"></div>
|
| 915 |
+
<div class="color-option bg-primary ${component.props.buttonColor === 'primary' ? 'selected' : ''}" data-color="primary" data-prop="buttonColor"></div>
|
| 916 |
+
<div class="color-option bg-green-500 ${component.props.buttonColor === 'green-500' ? 'selected' : ''}" data-color="green-500" data-prop="buttonColor"></div>
|
| 917 |
+
<div class="color-option bg-yellow-400 ${component.props.buttonColor === 'yellow-400' ? 'selected' : ''}" data-color="yellow-400" data-prop="buttonColor"></div>
|
| 918 |
+
</div>
|
| 919 |
+
</div>
|
| 920 |
+
<div>
|
| 921 |
+
<label class="block text-sm font-medium text-gray-700 mb-2">Button Text Color</label>
|
| 922 |
+
<div class="flex flex-wrap gap-2">
|
| 923 |
+
<div class="color-option bg-white border ${component.props.buttonTextColor === 'white' ? 'selected' : ''}" data-color="white" data-prop="buttonTextColor"></div>
|
| 924 |
+
<div class="color-option bg-primary ${component.props.buttonTextColor === 'primary' ? 'selected' : ''}" data-color="primary" data-prop="buttonTextColor"></div>
|
| 925 |
+
<div class="color-option bg-gray-800 ${component.props.buttonTextColor === 'gray-800' ? 'selected' : ''}" data-color="gray-800" data-prop="buttonTextColor"></div>
|
| 926 |
+
</div>
|
| 927 |
+
</div>
|
| 928 |
+
</div>
|
| 929 |
+
</div>
|
| 930 |
+
`;
|
| 931 |
+
break;
|
| 932 |
+
|
| 933 |
+
case 'features':
|
| 934 |
+
propertiesHtml = `
|
| 935 |
+
<div class="space-y-4">
|
| 936 |
+
<h3 class="font-medium text-gray-800">Features Settings</h3>
|
| 937 |
+
<div>
|
| 938 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Title</label>
|
| 939 |
+
<input type="text" class="w-full p-2 border rounded-md text-sm" value="${component.props.title}" data-prop="title">
|
| 940 |
+
</div>
|
| 941 |
+
<div>
|
| 942 |
+
<label class="block text-sm font-medium text-gray-700 mb-2">Background Color</label>
|
| 943 |
+
<div class="flex flex-wrap gap-2">
|
| 944 |
+
<div class="color-option bg-gray-50 ${component.props.bgColor === 'gray-50' ? 'selected' : ''}" data-color="gray-50" data-prop="bgColor"></div>
|
| 945 |
+
<div class="color-option bg-white ${component.props.bgColor === 'white' ? 'selected' : ''}" data-color="white" data-prop="bgColor"></div>
|
| 946 |
+
<div class="color-option bg-blue-50 ${component.props.bgColor === 'blue-50' ? 'selected' : ''}" data-color="blue-50" data-prop="bgColor"></div>
|
| 947 |
+
<div class="color-option bg-indigo-50 ${component.props.bgColor === 'indigo-50' ? 'selected' : ''}" data-color="indigo-50" data-prop="bgColor"></div>
|
| 948 |
+
</div>
|
| 949 |
+
</div>
|
| 950 |
+
<div>
|
| 951 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Number of Features</label>
|
| 952 |
+
<select class="w-full p-2 border rounded-md text-sm" data-prop="featureCount">
|
| 953 |
+
<option value="2" ${component.props.features.length === 2 ? 'selected' : ''}>2 Features</option>
|
| 954 |
+
<option value="3" ${component.props.features.length === 3 ? 'selected' : ''}>3 Features</option>
|
| 955 |
+
<option value="4" ${component.props.features.length === 4 ? 'selected' : ''}>4 Features</option>
|
| 956 |
+
</select>
|
| 957 |
+
</div>
|
| 958 |
+
<div>
|
| 959 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Features</label>
|
| 960 |
+
<div class="features-container space-y-4">
|
| 961 |
+
${component.props.features.map((feature, index) => `
|
| 962 |
+
<div class="border p-3 rounded-md">
|
| 963 |
+
<div class="flex justify-between items-center mb-2">
|
| 964 |
+
<h4 class="font-medium text-sm">Feature ${index + 1}</h4>
|
| 965 |
+
<button class="remove-feature-btn text-red-500" data-feature-index="${index}">
|
| 966 |
+
<i class="fas fa-times"></i>
|
| 967 |
+
</button>
|
| 968 |
+
</div>
|
| 969 |
+
<div class="space-y-2">
|
| 970 |
+
<div>
|
| 971 |
+
<label class="block text-xs text-gray-500 mb-1">Title</label>
|
| 972 |
+
<input type="text" class="w-full p-2 border rounded-md text-sm" value="${feature.title}" data-feature-index="${index}" data-prop="title">
|
| 973 |
+
</div>
|
| 974 |
+
<div>
|
| 975 |
+
<label class="block text-xs text-gray-500 mb-1">Description</label>
|
| 976 |
+
<textarea class="w-full p-2 border rounded-md text-sm" rows="2" data-feature-index="${index}" data-prop="description">${feature.description}</textarea>
|
| 977 |
+
</div>
|
| 978 |
+
<div>
|
| 979 |
+
<label class="block text-xs text-gray-500 mb-1">Icon</label>
|
| 980 |
+
<select class="w-full p-2 border rounded-md text-sm" data-feature-index="${index}" data-prop="icon">
|
| 981 |
+
<option value="fa-rocket" ${feature.icon === 'fa-rocket' ? 'selected' : ''}>Rocket</option>
|
| 982 |
+
<option value="fa-bolt" ${feature.icon === 'fa-bolt' ? 'selected' : ''}>Bolt</option>
|
| 983 |
+
<option value="fa-cog" ${feature.icon === 'fa-cog' ? 'selected' : ''}>Cog</option>
|
| 984 |
+
<option value="fa-star" ${feature.icon === 'fa-star' ? 'selected' : ''}>Star</option>
|
| 985 |
+
<option value="fa-heart" ${feature.icon === 'fa-heart' ? 'selected' : ''}>Heart</option>
|
| 986 |
+
</select>
|
| 987 |
+
</div>
|
| 988 |
+
</div>
|
| 989 |
+
</div>
|
| 990 |
+
`).join('')}
|
| 991 |
+
</div>
|
| 992 |
+
<button class="add-feature-btn mt-2 text-sm text-primary hover:text-primary-dark flex items-center">
|
| 993 |
+
<i class="fas fa-plus mr-1"></i> Add Feature
|
| 994 |
+
</button>
|
| 995 |
+
</div>
|
| 996 |
+
</div>
|
| 997 |
+
`;
|
| 998 |
+
break;
|
| 999 |
+
|
| 1000 |
+
case 'text':
|
| 1001 |
+
propertiesHtml = `
|
| 1002 |
+
<div class="space-y-4">
|
| 1003 |
+
<h3 class="font-medium text-gray-800">Text Settings</h3>
|
| 1004 |
+
<div>
|
| 1005 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Title</label>
|
| 1006 |
+
<input type="text" class="w-full p-2 border rounded-md text-sm" value="${component.props.title}" data-prop="title">
|
| 1007 |
+
</div>
|
| 1008 |
+
<div>
|
| 1009 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Content</label>
|
| 1010 |
+
<textarea class="w-full p-2 border rounded-md text-sm" rows="6" data-prop="content">${component.props.content}</textarea>
|
| 1011 |
+
</div>
|
| 1012 |
+
<div>
|
| 1013 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Text Alignment</label>
|
| 1014 |
+
<select class="w-full p-2 border rounded-md text-sm" data-prop="textAlign">
|
| 1015 |
+
<option value="left" ${component.props.textAlign === 'left' ? 'selected' : ''}>Left</option>
|
| 1016 |
+
<option value="center" ${component.props.textAlign === 'center' ? 'selected' : ''}>Center</option>
|
| 1017 |
+
<option value="right" ${component.props.textAlign === 'right' ? 'selected' : ''}>Right</option>
|
| 1018 |
+
</select>
|
| 1019 |
+
</div>
|
| 1020 |
+
</div>
|
| 1021 |
+
`;
|
| 1022 |
+
break;
|
| 1023 |
+
|
| 1024 |
+
case 'image':
|
| 1025 |
+
propertiesHtml = `
|
| 1026 |
+
<div class="space-y-4">
|
| 1027 |
+
<h3 class="font-medium text-gray-800">Image Settings</h3>
|
| 1028 |
+
<div>
|
| 1029 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Image URL</label>
|
| 1030 |
+
<input type="text" class="w-full p-2 border rounded-md text-sm" value="${component.props.src}" data-prop="src">
|
| 1031 |
+
</div>
|
| 1032 |
+
<div>
|
| 1033 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Alt Text</label>
|
| 1034 |
+
<input type="text" class="w-full p-2 border rounded-md text-sm" value="${component.props.alt}" data-prop="alt">
|
| 1035 |
+
</div>
|
| 1036 |
+
<div>
|
| 1037 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Rounded Corners</label>
|
| 1038 |
+
<select class="w-full p-2 border rounded-md text-sm" data-prop="rounded">
|
| 1039 |
+
<option value="none" ${component.props.rounded === 'none' ? 'selected' : ''}>None</option>
|
| 1040 |
+
<option value="sm" ${component.props.rounded === 'sm' ? 'selected' : ''}>Small</option>
|
| 1041 |
+
<option value="md" ${component.props.rounded === 'md' ? 'selected' : ''}>Medium</option>
|
| 1042 |
+
<option value="lg" ${component.props.rounded === 'lg' ? 'selected' : ''}>Large</option>
|
| 1043 |
+
<option value="full" ${component.props.rounded === 'full' ? 'selected' : ''}>Full (Circle)</option>
|
| 1044 |
+
</select>
|
| 1045 |
+
</div>
|
| 1046 |
+
<div>
|
| 1047 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Padding</label>
|
| 1048 |
+
<select class="w-full p-2 border rounded-md text-sm" data-prop="padding">
|
| 1049 |
+
<option value="0" ${component.props.padding === '0' ? 'selected' : ''}>None</option>
|
| 1050 |
+
<option value="2" ${component.props.padding === '2' ? 'selected' : ''}>Small</option>
|
| 1051 |
+
<option value="4" ${component.props.padding === '4' ? 'selected' : ''}>Medium</option>
|
| 1052 |
+
<option value="6" ${component.props.padding === '6' ? 'selected' : ''}>Large</option>
|
| 1053 |
+
<option value="8" ${component.props.padding === '8' ? 'selected' : ''}>Extra Large</option>
|
| 1054 |
+
</select>
|
| 1055 |
+
</div>
|
| 1056 |
+
</div>
|
| 1057 |
+
`;
|
| 1058 |
+
break;
|
| 1059 |
+
|
| 1060 |
+
case 'cta':
|
| 1061 |
+
propertiesHtml = `
|
| 1062 |
+
<div class="space-y-4">
|
| 1063 |
+
<h3 class="font-medium text-gray-800">CTA Settings</h3>
|
| 1064 |
+
<div>
|
| 1065 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Title</label>
|
| 1066 |
+
<input type="text" class="w-full p-2 border rounded-md text-sm" value="${component.props.title}" data-prop="title">
|
| 1067 |
+
</div>
|
| 1068 |
+
<div>
|
| 1069 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Subtitle</label>
|
| 1070 |
+
<textarea class="w-full p-2 border rounded-md text-sm" rows="2" data-prop="subtitle">${component.props.subtitle}</textarea>
|
| 1071 |
+
</div>
|
| 1072 |
+
<div>
|
| 1073 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Button Text</label>
|
| 1074 |
+
<input type="text" class="w-full p-2 border rounded-md text-sm" value="${component.props.buttonText}" data-prop="buttonText">
|
| 1075 |
+
</div>
|
| 1076 |
+
<div>
|
| 1077 |
+
<label class="block text-sm font-medium text-gray-700 mb-2">Background Color</label>
|
| 1078 |
+
<div class="flex flex-wrap gap-2">
|
| 1079 |
+
<div class="color-option bg-primary/10 ${component.props.bgColor === 'primary/10' ? 'selected' : ''}" data-color="primary/10" data-prop="bgColor"></div>
|
| 1080 |
+
<div class="color-option bg-blue-50 ${component.props.bgColor === 'blue-50' ? 'selected' : ''}" data-color="blue-50" data-prop="bgColor"></div>
|
| 1081 |
+
<div class="color-option bg-green-50 ${component.props.bgColor === 'green-50' ? 'selected' : ''}" data-color="green-50" data-prop="bgColor"></div>
|
| 1082 |
+
<div class="color-option bg-yellow-50 ${component.props.bgColor === 'yellow-50' ? 'selected' : ''}" data-color="yellow-50" data-prop="bgColor"></div>
|
| 1083 |
+
<div class="color-option bg-gray-100 ${component.props.bgColor === 'gray-100' ? 'selected' : ''}" data-color="gray-100" data-prop="bgColor"></div>
|
| 1084 |
+
</div>
|
| 1085 |
+
</div>
|
| 1086 |
+
<div class="grid grid-cols-2 gap-4">
|
| 1087 |
+
<div>
|
| 1088 |
+
<label class="block text-sm font-medium text-gray-700 mb-2">Button Color</label>
|
| 1089 |
+
<div class="flex flex-wrap gap-2">
|
| 1090 |
+
<div class="color-option bg-primary ${component.props.buttonColor === 'primary' ? 'selected' : ''}" data-color="primary" data-prop="buttonColor"></div>
|
| 1091 |
+
<div class="color-option bg-blue-600 ${component.props.buttonColor === 'blue-600' ? 'selected' : ''}" data-color="blue-600" data-prop="buttonColor"></div>
|
| 1092 |
+
<div class="color-option bg-green-600 ${component.props.buttonColor === 'green-600' ? 'selected' : ''}" data-color="green-600" data-prop="buttonColor"></div>
|
| 1093 |
+
<div class="color-option bg-red-600 ${component.props.buttonColor === 'red-600' ? 'selected' : ''}" data-color="red-600" data-prop="buttonColor"></div>
|
| 1094 |
+
<div class="color-option bg-yellow-500 ${component.props.buttonColor === 'yellow-500' ? 'selected' : ''}" data-color="yellow-500" data-prop="buttonColor"></div>
|
| 1095 |
+
<div class="color-option bg-white border ${component.props.buttonColor === 'white' ? 'selected' : ''}" data-color="white" data-prop="buttonColor"></div>
|
| 1096 |
+
</div>
|
| 1097 |
+
</div>
|
| 1098 |
+
<div>
|
| 1099 |
+
<label class="block text-sm font-medium text-gray-700 mb-2">Button Text Color</label>
|
| 1100 |
+
<div class="flex flex-wrap gap-2">
|
| 1101 |
+
<div class="color-option bg-white border ${component.props.buttonTextColor === 'white' ? 'selected' : ''}" data-color="white" data-prop="buttonTextColor"></div>
|
| 1102 |
+
<div class="color-option bg-gray-800 ${component.props.buttonTextColor === 'gray-800' ? 'selected' : ''}" data-color="gray-800" data-prop="buttonTextColor"></div>
|
| 1103 |
+
<div class="color-option bg-primary ${component.props.buttonTextColor === 'primary' ? 'selected' : ''}" data-color="primary" data-prop="buttonTextColor"></div>
|
| 1104 |
+
</div>
|
| 1105 |
+
</div>
|
| 1106 |
+
</div>
|
| 1107 |
+
</div>
|
| 1108 |
+
`;
|
| 1109 |
+
break;
|
| 1110 |
+
|
| 1111 |
+
case 'footer':
|
| 1112 |
+
propertiesHtml = `
|
| 1113 |
+
<div class="space-y-4">
|
| 1114 |
+
<h3 class="font-medium text-gray-800">Footer Settings</h3>
|
| 1115 |
+
<div>
|
| 1116 |
+
<label class="block text-sm font-medium text-gray-700 mb-2">Background Color</label>
|
| 1117 |
+
<div class="flex flex-wrap gap-2">
|
| 1118 |
+
<div class="color-option bg-gray-800 ${component.props.bgColor === 'gray-800' ? 'selected' : ''}" data-color="gray-800" data-prop="bgColor"></div>
|
| 1119 |
+
<div class="color-option bg-indigo-900 ${component.props.bgColor === 'indigo-900' ? 'selected' : ''}" data-color="indigo-900" data-prop="bgColor"></div>
|
| 1120 |
+
<div class="color-option bg-blue-900 ${component.props.bgColor === 'blue-900' ? 'selected' : ''}" data-color="blue-900" data-prop="bgColor"></div>
|
| 1121 |
+
<div class="color-option bg-black ${component.props.bgColor === 'black' ? 'selected' : ''}" data-color="black" data-prop="bgColor"></div>
|
| 1122 |
+
</div>
|
| 1123 |
+
</div>
|
| 1124 |
+
<div>
|
| 1125 |
+
<label class="block text-sm font-medium text-gray-700 mb-2">Text Color</label>
|
| 1126 |
+
<div class="flex flex-wrap gap-2">
|
| 1127 |
+
<div class="color-option bg-white border ${component.props.textColor === 'white' ? 'selected' : ''}" data-color="white" data-prop="textColor"></div>
|
| 1128 |
+
<div class="color-option bg-gray-300 ${component.props.textColor === 'gray-300' ? 'selected' : ''}" data-color="gray-300" data-prop="textColor"></div>
|
| 1129 |
+
<div class="color-option bg-blue-200 ${component.props.textColor === 'blue-200' ? 'selected' : ''}" data-color="blue-200" data-prop="textColor"></div>
|
| 1130 |
+
</div>
|
| 1131 |
+
</div>
|
| 1132 |
+
<div>
|
| 1133 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Copyright Text</label>
|
| 1134 |
+
<input type="text" class="w-full p-2 border rounded-md text-sm" value="${component.props.copyright}" data-prop="copyright">
|
| 1135 |
+
</div>
|
| 1136 |
+
<div>
|
| 1137 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Columns</label>
|
| 1138 |
+
<div class="columns-container space-y-4">
|
| 1139 |
+
${component.props.columns.map((column, index) => `
|
| 1140 |
+
<div class="border p-3 rounded-md">
|
| 1141 |
+
<div class="flex justify-between items-center mb-2">
|
| 1142 |
+
<h4 class="font-medium text-sm">Column ${index + 1}</h4>
|
| 1143 |
+
<button class="remove-column-btn text-red-500" data-column-index="${index}">
|
| 1144 |
+
<i class="fas fa-times"></i>
|
| 1145 |
+
</button>
|
| 1146 |
+
</div>
|
| 1147 |
+
<div class="space-y-2">
|
| 1148 |
+
<div>
|
| 1149 |
+
<label class="block text-xs text-gray-500 mb-1">Title</label>
|
| 1150 |
+
<input type="text" class="w-full p-2 border rounded-md text-sm" value="${column.title}" data-column-index="${index}" data-prop="title">
|
| 1151 |
+
</div>
|
| 1152 |
+
<div>
|
| 1153 |
+
<label class="block text-xs text-gray-500 mb-1">Links</label>
|
| 1154 |
+
<div class="links-container space-y-2">
|
| 1155 |
+
${column.links.map((link, linkIndex) => `
|
| 1156 |
+
<div class="flex items-center space-x-2">
|
| 1157 |
+
<input type="text" class="flex-1 p-2 border rounded-md text-sm" value="${link}" data-column-index="${index}" data-link-index="${linkIndex}">
|
| 1158 |
+
<button class="remove-link-btn p-2 text-red-500" data-column-index="${index}" data-link-index="${linkIndex}">
|
| 1159 |
+
<i class="fas fa-times"></i>
|
| 1160 |
+
</button>
|
| 1161 |
+
</div>
|
| 1162 |
+
`).join('')}
|
| 1163 |
+
</div>
|
| 1164 |
+
<button class="add-column-link-btn mt-2 text-sm text-primary hover:text-primary-dark flex items-center" data-column-index="${index}">
|
| 1165 |
+
<i class="fas fa-plus mr-1"></i> Add Link
|
| 1166 |
+
</button>
|
| 1167 |
+
</div>
|
| 1168 |
+
</div>
|
| 1169 |
+
</div>
|
| 1170 |
+
`).join('')}
|
| 1171 |
+
</div>
|
| 1172 |
+
<button class="add-column-btn mt-2 text-sm text-primary hover:text-primary-dark flex items-center">
|
| 1173 |
+
<i class="fas fa-plus mr-1"></i> Add Column
|
| 1174 |
+
</button>
|
| 1175 |
+
</div>
|
| 1176 |
+
</div>
|
| 1177 |
+
`;
|
| 1178 |
+
break;
|
| 1179 |
+
}
|
| 1180 |
+
|
| 1181 |
+
propertiesPanel.innerHTML = propertiesHtml;
|
| 1182 |
+
|
| 1183 |
+
// Add event listeners to property controls
|
| 1184 |
+
addPropertyEventListeners(component);
|
| 1185 |
+
}
|
| 1186 |
+
|
| 1187 |
+
// Add event listeners to property controls
|
| 1188 |
+
function addPropertyEventListeners(component) {
|
| 1189 |
+
// General input/select change handlers
|
| 1190 |
+
propertiesPanel.querySelectorAll('input, select, textarea').forEach(input => {
|
| 1191 |
+
const propName = input.dataset.prop;
|
| 1192 |
+
if (propName) {
|
| 1193 |
+
input.addEventListener('input', function() {
|
| 1194 |
+
updateComponentProperty(component.id, propName, this.value);
|
| 1195 |
+
});
|
| 1196 |
+
}
|
| 1197 |
+
});
|
| 1198 |
+
|
| 1199 |
+
// Color options
|
| 1200 |
+
propertiesPanel.querySelectorAll('.color-option').forEach(option => {
|
| 1201 |
+
option.addEventListener('click', function() {
|
| 1202 |
+
const propName = this.dataset.prop;
|
| 1203 |
+
const colorValue = this.dataset.color;
|
| 1204 |
+
|
| 1205 |
+
// Remove selected class from siblings
|
| 1206 |
+
this.parentElement.querySelectorAll('.color-option').forEach(opt => {
|
| 1207 |
+
opt.classList.remove('selected');
|
| 1208 |
+
});
|
| 1209 |
+
|
| 1210 |
+
// Add selected class to clicked option
|
| 1211 |
+
this.classList.add('selected');
|
| 1212 |
+
|
| 1213 |
+
updateComponentProperty(component.id, propName, colorValue);
|
| 1214 |
+
});
|
| 1215 |
+
});
|
| 1216 |
+
|
| 1217 |
+
// Component-specific event listeners
|
| 1218 |
+
switch(component.type) {
|
| 1219 |
+
case 'header':
|
| 1220 |
+
// Add link button
|
| 1221 |
+
propertiesPanel.querySelector('.add-link-btn')?.addEventListener('click', function() {
|
| 1222 |
+
addHeaderLink(component.id);
|
| 1223 |
+
});
|
| 1224 |
+
|
| 1225 |
+
// Remove link buttons
|
| 1226 |
+
propertiesPanel.querySelectorAll('.remove-link-btn').forEach(btn => {
|
| 1227 |
+
btn.addEventListener('click', function() {
|
| 1228 |
+
const index = parseInt(this.dataset.linkIndex);
|
| 1229 |
+
removeHeaderLink(component.id, index);
|
| 1230 |
+
});
|
| 1231 |
+
});
|
| 1232 |
+
break;
|
| 1233 |
+
|
| 1234 |
+
case 'features':
|
| 1235 |
+
// Add feature button
|
| 1236 |
+
propertiesPanel.querySelector('.add-feature-btn')?.addEventListener('click', function() {
|
| 1237 |
+
addFeature(component.id);
|
| 1238 |
+
});
|
| 1239 |
+
|
| 1240 |
+
// Remove feature buttons
|
| 1241 |
+
propertiesPanel.querySelectorAll('.remove-feature-btn').forEach(btn => {
|
| 1242 |
+
btn.addEventListener('click', function() {
|
| 1243 |
+
const index = parseInt(this.dataset.featureIndex);
|
| 1244 |
+
removeFeature(component.id, index);
|
| 1245 |
+
});
|
| 1246 |
+
});
|
| 1247 |
+
|
| 1248 |
+
// Feature property inputs
|
| 1249 |
+
propertiesPanel.querySelectorAll('[data-feature-index]').forEach(input => {
|
| 1250 |
+
const propName = input.dataset.prop;
|
| 1251 |
+
const featureIndex = parseInt(input.dataset.featureIndex);
|
| 1252 |
+
|
| 1253 |
+
input.addEventListener('input', function() {
|
| 1254 |
+
updateFeatureProperty(component.id, featureIndex, propName, this.value);
|
| 1255 |
+
});
|
| 1256 |
+
});
|
| 1257 |
+
|
| 1258 |
+
// Feature count selector
|
| 1259 |
+
propertiesPanel.querySelector('[data-prop="featureCount"]')?.addEventListener('change', function() {
|
| 1260 |
+
updateFeatureCount(component.id, parseInt(this.value));
|
| 1261 |
+
});
|
| 1262 |
+
break;
|
| 1263 |
+
|
| 1264 |
+
case 'footer':
|
| 1265 |
+
// Add column button
|
| 1266 |
+
propertiesPanel.querySelector('.add-column-btn')?.addEventListener('click', function() {
|
| 1267 |
+
addFooterColumn(component.id);
|
| 1268 |
+
});
|
| 1269 |
+
|
| 1270 |
+
// Remove column buttons
|
| 1271 |
+
propertiesPanel.querySelectorAll('.remove-column-btn').forEach(btn => {
|
| 1272 |
+
btn.addEventListener('click', function() {
|
| 1273 |
+
const index = parseInt(this.dataset.columnIndex);
|
| 1274 |
+
removeFooterColumn(component.id, index);
|
| 1275 |
+
});
|
| 1276 |
+
});
|
| 1277 |
+
|
| 1278 |
+
// Add column link buttons
|
| 1279 |
+
propertiesPanel.querySelectorAll('.add-column-link-btn').forEach(btn => {
|
| 1280 |
+
btn.addEventListener('click', function() {
|
| 1281 |
+
const columnIndex = parseInt(this.dataset.columnIndex);
|
| 1282 |
+
addFooterColumnLink(component.id, columnIndex);
|
| 1283 |
+
});
|
| 1284 |
+
});
|
| 1285 |
+
|
| 1286 |
+
// Remove column link buttons
|
| 1287 |
+
propertiesPanel.querySelectorAll('.remove-link-btn').forEach(btn => {
|
| 1288 |
+
btn.addEventListener('click', function() {
|
| 1289 |
+
const columnIndex = parseInt(this.dataset.columnIndex);
|
| 1290 |
+
const linkIndex = parseInt(this.dataset.linkIndex);
|
| 1291 |
+
removeFooterColumnLink(component.id, columnIndex, linkIndex);
|
| 1292 |
+
});
|
| 1293 |
+
});
|
| 1294 |
+
|
| 1295 |
+
// Column property inputs
|
| 1296 |
+
propertiesPanel.querySelectorAll('[data-column-index]').forEach(input => {
|
| 1297 |
+
if (!input.dataset.prop) return;
|
| 1298 |
+
|
| 1299 |
+
const propName = input.dataset.prop;
|
| 1300 |
+
const columnIndex = parseInt(input.dataset.columnIndex);
|
| 1301 |
+
|
| 1302 |
+
input.addEventListener('input', function() {
|
| 1303 |
+
updateFooterColumnProperty(component.id, columnIndex, propName, this.value);
|
| 1304 |
+
});
|
| 1305 |
+
});
|
| 1306 |
+
break;
|
| 1307 |
+
}
|
| 1308 |
+
}
|
| 1309 |
+
|
| 1310 |
+
// Update component property
|
| 1311 |
+
function updateComponentProperty(componentId, propName, value) {
|
| 1312 |
+
const component = components.find(c => c.id === componentId);
|
| 1313 |
+
if (!component) return;
|
| 1314 |
+
|
| 1315 |
+
component.props[propName] = value;
|
| 1316 |
+
renderComponent(componentId);
|
| 1317 |
+
}
|
| 1318 |
+
|
| 1319 |
+
// Add header link
|
| 1320 |
+
function addHeaderLink(componentId) {
|
| 1321 |
+
const component = components.find(c => c.id === componentId);
|
| 1322 |
+
if (!component || component.type !== 'header') return;
|
| 1323 |
+
|
| 1324 |
+
component.props.links.push('New Link');
|
| 1325 |
+
renderComponent(componentId);
|
| 1326 |
+
updatePropertiesPanel(component);
|
| 1327 |
+
}
|
| 1328 |
+
|
| 1329 |
+
// Remove header link
|
| 1330 |
+
function removeHeaderLink(componentId, index) {
|
| 1331 |
+
const component = components.find(c => c.id === componentId);
|
| 1332 |
+
if (!component || component.type !== 'header') return;
|
| 1333 |
+
|
| 1334 |
+
component.props.links.splice(index, 1);
|
| 1335 |
+
renderComponent(componentId);
|
| 1336 |
+
updatePropertiesPanel(component);
|
| 1337 |
+
}
|
| 1338 |
+
|
| 1339 |
+
// Add feature
|
| 1340 |
+
function addFeature(componentId) {
|
| 1341 |
+
const component = components.find(c => c.id === componentId);
|
| 1342 |
+
if (!component || component.type !== 'features') return;
|
| 1343 |
+
|
| 1344 |
+
component.props.features.push({
|
| 1345 |
+
title: `Feature ${component.props.features.length + 1}`,
|
| 1346 |
+
description: 'Description goes here',
|
| 1347 |
+
icon: 'fa-rocket'
|
| 1348 |
+
});
|
| 1349 |
+
|
| 1350 |
+
renderComponent(componentId);
|
| 1351 |
+
updatePropertiesPanel(component);
|
| 1352 |
+
}
|
| 1353 |
+
|
| 1354 |
+
// Remove feature
|
| 1355 |
+
function removeFeature(componentId, index) {
|
| 1356 |
+
const component = components.find(c => c.id === componentId);
|
| 1357 |
+
if (!component || component.type !== 'features') return;
|
| 1358 |
+
|
| 1359 |
+
component.props.features.splice(index, 1);
|
| 1360 |
+
renderComponent(componentId);
|
| 1361 |
+
updatePropertiesPanel(component);
|
| 1362 |
+
}
|
| 1363 |
+
|
| 1364 |
+
// Update feature property
|
| 1365 |
+
function updateFeatureProperty(componentId, featureIndex, propName, value) {
|
| 1366 |
+
const component = components.find(c => c.id === componentId);
|
| 1367 |
+
if (!component || component.type !== 'features') return;
|
| 1368 |
+
|
| 1369 |
+
if (component.props.features[featureIndex]) {
|
| 1370 |
+
component.props.features[featureIndex][propName] = value;
|
| 1371 |
+
renderComponent(componentId);
|
| 1372 |
+
}
|
| 1373 |
+
}
|
| 1374 |
+
|
| 1375 |
+
// Update feature count
|
| 1376 |
+
function updateFeatureCount(componentId, count) {
|
| 1377 |
+
const component = components.find(c => c.id === componentId);
|
| 1378 |
+
if (!component || component.type !== 'features') return;
|
| 1379 |
+
|
| 1380 |
+
const currentCount = component.props.features.length;
|
| 1381 |
+
|
| 1382 |
+
if (count > currentCount) {
|
| 1383 |
+
// Add features
|
| 1384 |
+
for (let i = currentCount; i < count; i++) {
|
| 1385 |
+
component.props.features.push({
|
| 1386 |
+
title: `Feature ${i + 1}`,
|
| 1387 |
+
description: 'Description goes here',
|
| 1388 |
+
icon: 'fa-rocket'
|
| 1389 |
+
});
|
| 1390 |
+
}
|
| 1391 |
+
} else if (count < currentCount) {
|
| 1392 |
+
// Remove features
|
| 1393 |
+
component.props.features = component.props.features.slice(0, count);
|
| 1394 |
+
}
|
| 1395 |
+
|
| 1396 |
+
renderComponent(componentId);
|
| 1397 |
+
updatePropertiesPanel(component);
|
| 1398 |
+
}
|
| 1399 |
+
|
| 1400 |
+
// Add footer column
|
| 1401 |
+
function addFooterColumn(componentId) {
|
| 1402 |
+
const component = components.find(c => c.id === componentId);
|
| 1403 |
+
if (!component || component.type !== 'footer') return;
|
| 1404 |
+
|
| 1405 |
+
component.props.columns.push({
|
| 1406 |
+
title: `Column ${component.props.columns.length + 1}`,
|
| 1407 |
+
links: ['Link 1', 'Link 2']
|
| 1408 |
+
});
|
| 1409 |
+
|
| 1410 |
+
renderComponent(componentId);
|
| 1411 |
+
updatePropertiesPanel(component);
|
| 1412 |
+
}
|
| 1413 |
+
|
| 1414 |
+
// Remove footer column
|
| 1415 |
+
function removeFooterColumn(componentId, index) {
|
| 1416 |
+
const component = components.find(c => c.id === componentId);
|
| 1417 |
+
if (!component || component.type !== 'footer') return;
|
| 1418 |
+
|
| 1419 |
+
component.props.columns.splice(index, 1);
|
| 1420 |
+
renderComponent(componentId);
|
| 1421 |
+
updatePropertiesPanel(component);
|
| 1422 |
+
}
|
| 1423 |
+
|
| 1424 |
+
// Add footer column link
|
| 1425 |
+
function addFooterColumnLink(componentId, columnIndex) {
|
| 1426 |
+
const component = components.find(c => c.id === componentId);
|
| 1427 |
+
if (!component || component.type !== 'footer') return;
|
| 1428 |
+
|
| 1429 |
+
if (component.props.columns[columnIndex]) {
|
| 1430 |
+
component.props.columns[columnIndex].links.push(`New Link`);
|
| 1431 |
+
renderComponent(componentId);
|
| 1432 |
+
updatePropertiesPanel(component);
|
| 1433 |
+
}
|
| 1434 |
+
}
|
| 1435 |
+
|
| 1436 |
+
// Remove footer column link
|
| 1437 |
+
function removeFooterColumnLink(componentId, columnIndex, linkIndex) {
|
| 1438 |
+
const component = components.find(c => c.id === componentId);
|
| 1439 |
+
if (!component || component.type !== 'footer') return;
|
| 1440 |
+
|
| 1441 |
+
if (component.props.columns[columnIndex] && component.props.columns[columnIndex].links[linkIndex]) {
|
| 1442 |
+
component.props.columns[columnIndex].links.splice(linkIndex, 1);
|
| 1443 |
+
renderComponent(componentId);
|
| 1444 |
+
updatePropertiesPanel(component);
|
| 1445 |
+
}
|
| 1446 |
+
}
|
| 1447 |
+
|
| 1448 |
+
// Update footer column property
|
| 1449 |
+
function updateFooterColumnProperty(componentId, columnIndex, propName, value) {
|
| 1450 |
+
const component = components.find(c => c.id === componentId);
|
| 1451 |
+
if (!component || component.type !== 'footer') return;
|
| 1452 |
+
|
| 1453 |
+
if (component.props.columns[columnIndex]) {
|
| 1454 |
+
component.props.columns[columnIndex][propName] = value;
|
| 1455 |
+
renderComponent(componentId);
|
| 1456 |
+
}
|
| 1457 |
+
}
|
| 1458 |
+
|
| 1459 |
+
// Render component with updated properties
|
| 1460 |
+
function renderComponent(componentId) {
|
| 1461 |
+
const component = components.find(c => c.id === componentId);
|
| 1462 |
+
if (!component) return;
|
| 1463 |
+
|
| 1464 |
+
const element = document.getElementById(componentId);
|
| 1465 |
+
if (!element) return;
|
| 1466 |
+
|
| 1467 |
+
let componentHtml = '';
|
| 1468 |
+
|
| 1469 |
+
switch(component.type) {
|
| 1470 |
+
case 'header':
|
| 1471 |
+
componentHtml = `
|
| 1472 |
+
<div class="bg-${component.props.bgColor} text-${component.props.textColor} p-4">
|
| 1473 |
+
<div class="container mx-auto flex justify-between items-center">
|
| 1474 |
+
<div class="text-xl font-bold">${component.props.logoText}</div>
|
| 1475 |
+
<nav class="flex space-x-4">
|
| 1476 |
+
${component.props.links.map(link => `<a href="#" class="hover:underline">${link}</a>`).join('')}
|
| 1477 |
+
</nav>
|
| 1478 |
+
</div>
|
| 1479 |
+
</div>
|
| 1480 |
+
`;
|
| 1481 |
+
break;
|
| 1482 |
+
|
| 1483 |
+
case 'hero':
|
| 1484 |
+
componentHtml = `
|
| 1485 |
+
<div class="bg-${component.props.bgColor} text-${component.props.textColor} py-12 px-4 md:px-0 text-center">
|
| 1486 |
+
<div class="container mx-auto">
|
| 1487 |
+
<h1 class="text-4xl font-bold mb-4">${component.props.title}</h1>
|
| 1488 |
+
<p class="text-xl mb-8 max-w-2xl mx-auto">${component.props.subtitle}</p>
|
| 1489 |
+
<button class="bg-${component.props.buttonColor} text-${component.props.buttonTextColor} px-6 py-2 rounded-md font-medium hover:bg-opacity-90">${component.props.buttonText}</button>
|
| 1490 |
+
</div>
|
| 1491 |
+
</div>
|
| 1492 |
+
`;
|
| 1493 |
+
break;
|
| 1494 |
+
|
| 1495 |
+
case 'features':
|
| 1496 |
+
componentHtml = `
|
| 1497 |
+
<div class="py-8 px-4 md:px-0 bg-${component.props.bgColor}">
|
| 1498 |
+
<div class="container mx-auto">
|
| 1499 |
+
<h2 class="text-2xl font-bold text-center mb-8">${component.props.title}</h2>
|
| 1500 |
+
<div class="grid grid-cols-1 md:grid-cols-${component.props.features.length} gap-6">
|
| 1501 |
+
${component.props.features.map(feature => `
|
| 1502 |
+
<div class="bg-white p-6 rounded-lg shadow-sm">
|
| 1503 |
+
<div class="text-primary text-3xl mb-3">
|
| 1504 |
+
<i class="fas ${feature.icon}"></i>
|
| 1505 |
+
</div>
|
| 1506 |
+
<h3 class="font-semibold mb-2">${feature.title}</h3>
|
| 1507 |
+
<p class="text-gray-600">${feature.description}</p>
|
| 1508 |
+
</div>
|
| 1509 |
+
`).join('')}
|
| 1510 |
+
</div>
|
| 1511 |
+
</div>
|
| 1512 |
+
</div>
|
| 1513 |
+
`;
|
| 1514 |
+
break;
|
| 1515 |
+
|
| 1516 |
+
case 'text':
|
| 1517 |
+
componentHtml = `
|
| 1518 |
+
<div class="py-8 px-4 md:px-0">
|
| 1519 |
+
<div class="container mx-auto max-w-4xl text-${component.props.textAlign}">
|
| 1520 |
+
<h2 class="text-2xl font-bold mb-4">${component.props.title}</h2>
|
| 1521 |
+
${component.props.content.split('\n\n').map(para => `<p class="text-gray-700 mb-4">${para}</p>`).join('')}
|
| 1522 |
+
</div>
|
| 1523 |
+
</div>
|
| 1524 |
+
`;
|
| 1525 |
+
break;
|
| 1526 |
+
|
| 1527 |
+
case 'image':
|
| 1528 |
+
componentHtml = `
|
| 1529 |
+
<div class="py-${component.props.padding} px-4 md:px-0">
|
| 1530 |
+
<div class="container mx-auto">
|
| 1531 |
+
<img src="${component.props.src}" alt="${component.props.alt}" class="w-full h
|
| 1532 |
+
</html>
|
prompts.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
make this work as a website page builder
|
| 2 |
+
mkae this look and feel like a fully function masterpiece
|