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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
<!DOCTYPE html>
|
| 3 |
+
<html lang="en">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="UTF-8">
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
+
<title>Advanced Component Builder</title>
|
| 8 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 9 |
+
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
| 10 |
+
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&family=Open+Sans:wght@400;700&family=Lato:wght@400;700&family=Montserrat:wght@400;700&family=Poppins:wght@400;500;600;700&display=swap" rel="stylesheet">
|
| 11 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
|
| 12 |
+
<link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.min.css" />
|
| 13 |
+
|
| 14 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
|
| 15 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2.0.0/FileSaver.min.js"></script>
|
| 16 |
+
<style>
|
| 17 |
+
:root {
|
| 18 |
+
--primary-color: #3b82f6;
|
| 19 |
+
--primary-hover-color: #2563eb;
|
| 20 |
+
--secondary-color: #10b981;
|
| 21 |
+
--secondary-hover-color: #059669;
|
| 22 |
+
--text-color: #374151;
|
| 23 |
+
--heading-color: #111827;
|
| 24 |
+
--font-family: 'Inter', sans-serif;
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
body {
|
| 28 |
+
font-family: var(--font-family);
|
| 29 |
+
color: var(--text-color);
|
| 30 |
+
background-color: var(--background-color);
|
| 31 |
+
}
|
| 32 |
+
h1, h2, h3, h4, h5, h6 {
|
| 33 |
+
color: var(--heading-color);
|
| 34 |
+
}
|
| 35 |
+
/* Custom scrollbar for webkit browsers */
|
| 36 |
+
::-webkit-scrollbar {
|
| 37 |
+
width: 8px;
|
| 38 |
+
height: 8px;
|
| 39 |
+
}
|
| 40 |
+
::-webkit-scrollbar-track {
|
| 41 |
+
background: #f1f1f1;
|
| 42 |
+
}
|
| 43 |
+
::-webkit-scrollbar-thumb {
|
| 44 |
+
background: #888;
|
| 45 |
+
border-radius: 10px;
|
| 46 |
+
}
|
| 47 |
+
::-webkit-scrollbar-thumb:hover {
|
| 48 |
+
background: #555;
|
| 49 |
+
}
|
| 50 |
+
.preview-iframe {
|
| 51 |
+
width: 100%;
|
| 52 |
+
height: 100%;
|
| 53 |
+
border: 0;
|
| 54 |
+
transition: all 0.3s ease-in-out;
|
| 55 |
+
}
|
| 56 |
+
#preview-container.preview-desktop .preview-iframe { width: 100%; }
|
| 57 |
+
#preview-container.preview-tablet .preview-iframe { width: 768px; margin: 0 auto; }
|
| 58 |
+
#preview-container.preview-mobile .preview-iframe { width: 375px; margin: 0 auto; }
|
| 59 |
+
|
| 60 |
+
.toast {
|
| 61 |
+
visibility: hidden;
|
| 62 |
+
min-width: 250px;
|
| 63 |
+
background-color: #333;
|
| 64 |
+
color: #fff;
|
| 65 |
+
text-align: center;
|
| 66 |
+
border-radius: 8px;
|
| 67 |
+
padding: 16px;
|
| 68 |
+
position: fixed;
|
| 69 |
+
z-index: 100;
|
| 70 |
+
left: 50%;
|
| 71 |
+
bottom: 30px;
|
| 72 |
+
transform: translateX(-50%);
|
| 73 |
+
opacity: 0;
|
| 74 |
+
transition: opacity 0.3s, visibility 0.3s;
|
| 75 |
+
}
|
| 76 |
+
.toast.show {
|
| 77 |
+
visibility: visible;
|
| 78 |
+
opacity: 1;
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
/* Professional Controls UI Styles */
|
| 82 |
+
#controls-layout {
|
| 83 |
+
display: flex;
|
| 84 |
+
height: 100%;
|
| 85 |
+
}
|
| 86 |
+
#controls-nav {
|
| 87 |
+
width: 180px;
|
| 88 |
+
flex-shrink: 0;
|
| 89 |
+
background-color: #f8fafc;
|
| 90 |
+
border-right: 1px solid #e5e7eb;
|
| 91 |
+
padding: 0.5rem;
|
| 92 |
+
overflow-y: auto;
|
| 93 |
+
}
|
| 94 |
+
.control-nav-button {
|
| 95 |
+
display: flex;
|
| 96 |
+
align-items: center;
|
| 97 |
+
width: 100%;
|
| 98 |
+
padding: 0.75rem;
|
| 99 |
+
border-radius: 0.375rem;
|
| 100 |
+
font-weight: 500;
|
| 101 |
+
color: var(--text-color);
|
| 102 |
+
transition: background-color 0.2s, color 0.2s;
|
| 103 |
+
text-align: left;
|
| 104 |
+
}
|
| 105 |
+
.control-nav-button:hover {
|
| 106 |
+
background-color: #e5e7eb;
|
| 107 |
+
}
|
| 108 |
+
.control-nav-button.active {
|
| 109 |
+
background-color: var(--primary-color);
|
| 110 |
+
color: white;
|
| 111 |
+
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
|
| 112 |
+
}
|
| 113 |
+
.control-nav-button i {
|
| 114 |
+
margin-right: 0.75rem;
|
| 115 |
+
width: 20px;
|
| 116 |
+
text-align: center;
|
| 117 |
+
}
|
| 118 |
+
#controls-panels {
|
| 119 |
+
flex-grow: 1;
|
| 120 |
+
padding: 1.5rem;
|
| 121 |
+
overflow-y: auto;
|
| 122 |
+
}
|
| 123 |
+
.control-panel {
|
| 124 |
+
display: none;
|
| 125 |
+
}
|
| 126 |
+
.control-panel.active {
|
| 127 |
+
display: block;
|
| 128 |
+
}
|
| 129 |
+
.control-panel h3 {
|
| 130 |
+
font-size: 1.25rem;
|
| 131 |
+
font-weight: 600;
|
| 132 |
+
margin-bottom: 1.5rem;
|
| 133 |
+
border-bottom: 1px solid #e5e7eb;
|
| 134 |
+
padding-bottom: 0.75rem;
|
| 135 |
+
}
|
| 136 |
+
.control-panel h4 {
|
| 137 |
+
font-size: 1rem;
|
| 138 |
+
font-weight: 600;
|
| 139 |
+
margin-top: 1.5rem;
|
| 140 |
+
margin-bottom: 1rem;
|
| 141 |
+
color: var(--heading-color);
|
| 142 |
+
}
|
| 143 |
+
.nested-builder {
|
| 144 |
+
margin-left: 1rem;
|
| 145 |
+
padding-left: 1rem;
|
| 146 |
+
border-left: 2px solid #e5e7eb;
|
| 147 |
+
margin-top: 1rem;
|
| 148 |
+
padding-top: 1rem;
|
| 149 |
+
}
|
| 150 |
+
.item-toolbar {
|
| 151 |
+
display: flex;
|
| 152 |
+
justify-content: flex-end;
|
| 153 |
+
gap: 0.25rem;
|
| 154 |
+
margin-bottom: 0.5rem;
|
| 155 |
+
}
|
| 156 |
+
.item-toolbar button {
|
| 157 |
+
line-height: 1;
|
| 158 |
+
}
|
| 159 |
+
.layout-item {
|
| 160 |
+
cursor: move;
|
| 161 |
+
}
|
| 162 |
+
.code-modal-pre {
|
| 163 |
+
background-color: #2d3748;
|
| 164 |
+
color: #e2e8f0;
|
| 165 |
+
padding: 1rem;
|
| 166 |
+
border-radius: 0.375rem;
|
| 167 |
+
max-height: 200px;
|
| 168 |
+
overflow-y: auto;
|
| 169 |
+
position: relative;
|
| 170 |
+
}
|
| 171 |
+
/* Feature: Hide/Show Sidebar */
|
| 172 |
+
#controls-sidebar {
|
| 173 |
+
flex-shrink: 0;
|
| 174 |
+
}
|
| 175 |
+
#main-container.sidebar-collapsed #controls-sidebar {
|
| 176 |
+
width: 0;
|
| 177 |
+
padding: 0;
|
| 178 |
+
overflow: hidden;
|
| 179 |
+
}
|
| 180 |
+
#main-container.sidebar-collapsed #preview-main {
|
| 181 |
+
width: 100%;
|
| 182 |
+
}
|
| 183 |
+
/* Component Control Specific Styles */
|
| 184 |
+
.component-item-controls {
|
| 185 |
+
background-color: #f9fafb;
|
| 186 |
+
border: 1px solid #e5e7eb;
|
| 187 |
+
padding: 0.75rem;
|
| 188 |
+
border-radius: 0.375rem;
|
| 189 |
+
margin-bottom: 0.5rem;
|
| 190 |
+
}
|
| 191 |
+
</style>
|
| 192 |
+
</head>
|
| 193 |
+
<body class="text-gray-800">
|
| 194 |
+
|
| 195 |
+
<div id="app" class="flex flex-col h-screen">
|
| 196 |
+
|
| 197 |
+
<header class="bg-white shadow-md p-4 flex justify-between items-center z-20">
|
| 198 |
+
<div class="flex items-center space-x-3">
|
| 199 |
+
<h1 class="text-xl font-bold text-gray-700">Component Builder</h1>
|
| 200 |
+
<button id="toggle-sidebar-btn" class="p-2 rounded-md hover:bg-gray-200 text-gray-600" title="Hide Controls">
|
| 201 |
+
<i class="fas fa-chevron-left"></i>
|
| 202 |
+
</button>
|
| 203 |
+
</div>
|
| 204 |
+
<div class="flex items-center space-x-4">
|
| 205 |
+
|
| 206 |
+
<button id="import-btn" class="flex items-center space-x-2 bg-blue-600 text-white font-bold py-2 px-4 rounded-md hover:bg-blue-700 transition">
|
| 207 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
| 208 |
+
<path d="M10 2a1 1 0 00-1 1v5.586l-1.293-1.293a1 1 0 00-1.414 1.414l3 3a1 1 0 001.414 0l3-3a1 1 0 00-1.414-1.414L11 8.586V3a1 1 0 00-1-1z"></path>
|
| 209 |
+
<path d="M4 14a1 1 0 011 1v1a1 1 0 001 1h8a1 1 0 001-1v-1a1 1 0 112 0v1a3 3 0 01-3 3H6a3 3 0 01-3-3v-1a1 1 0 011-1z"></path>
|
| 210 |
+
</svg>
|
| 211 |
+
<span>Import</span>
|
| 212 |
+
</button>
|
| 213 |
+
<input type="file" id="import-file-input" class="hidden" accept=".html">
|
| 214 |
+
|
| 215 |
+
<div id="export-menu-container" class="relative">
|
| 216 |
+
<button id="export-menu-btn" class="flex items-center space-x-2 bg-green-600 text-white font-bold py-2 px-4 rounded-md hover:bg-green-700 transition">
|
| 217 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M3 17a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM6.293 6.707a1 1 0 010-1.414l3-3a1 1 0 011.414 0l3 3a1 1 0 01-1.414 1.414L11 5.414V13a1 1 0 11-2 0V5.414L7.707 6.707a1 1 0 01-1.414 0z" clip-rule="evenodd"></path></svg>
|
| 218 |
+
<span>Export Page</span>
|
| 219 |
+
</button>
|
| 220 |
+
<div id="export-dropdown" class="hidden absolute right-0 mt-2 w-64 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 z-30">
|
| 221 |
+
<div class="py-1" role="menu" aria-orientation="vertical" aria-labelledby="export-menu-btn">
|
| 222 |
+
<a href="#" id="copy-combined-code" class="flex items-center px-4 py-2 text-sm text-gray-700 hover:bg-gray-100" role="menuitem">
|
| 223 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-3 text-gray-500" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"></path></svg>
|
| 224 |
+
<span>Copy Combined Code</span>
|
| 225 |
+
</a>
|
| 226 |
+
<a href="#" id="copy-html" class="flex items-center px-4 py-2 text-sm text-gray-700 hover:bg-gray-100" role="menuitem">
|
| 227 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-3 text-gray-500" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path d="M5 5a2 2 0 012-2h10a2 2 0 012 2v1h-14V5zM3 8h18v10a2 2 0 01-2 2H5a2 2 0 01-2-2V8z"></path></svg>
|
| 228 |
+
<span>Copy Page HTML</span>
|
| 229 |
+
</a>
|
| 230 |
+
<a href="#" id="copy-css" class="flex items-center px-4 py-2 text-sm text-gray-700 hover:bg-gray-100" role="menuitem">
|
| 231 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-3 text-gray-500" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21a4 4 0 01-4-4V5a2 2 0 012-2h4a2 2 0 012 2v12a4 4 0 01-4 4zm0 0h12a2 2 0 002-2v-4a2 2 0 00-2-2h-2.343M11 7.343l1.657-1.657a2 2 0 012.828 0l2.829 2.829a2 2 0 010 2.828l-8.486 8.485M7 17h.01"></path></svg>
|
| 232 |
+
<span>Copy Page CSS</span>
|
| 233 |
+
</a>
|
| 234 |
+
<a href="#" id="copy-js" class="flex items-center px-4 py-2 text-sm text-gray-700 hover:bg-gray-100" role="menuitem">
|
| 235 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-3 text-gray-500" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M10 2a1 1 0 011 1v1h1a1 1 0 010 2h-1v1a1 1 0 01-2 0V6H8a1 1 0 010-2h1V3a1 1 0 011-1zM5 5a3 3 0 013-3h4a3 3 0 013 3v1h-1V5a2 2 0 00-2-2H8a2 2 0 00-2 2v1H5V5zm2 5a1 1 0 011-1h4a1 1 0 110 2H8a1 1 0 01-1-1zm-1 4a1 1 0 100 2h8a1 1 0 100-2H6z" clip-rule="evenodd" /></svg>
|
| 236 |
+
<span>Copy Page JS</span>
|
| 237 |
+
</a>
|
| 238 |
+
<div class="border-t border-gray-100"></div>
|
| 239 |
+
<a href="#" id="download-zip-btn" class="flex items-center px-4 py-2 text-sm text-gray-700 hover:bg-gray-100" role="menuitem">
|
| 240 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-3 text-gray-500" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M4 2a2 2 0 00-2 2v12a2 2 0 002 2h12a2 2 0 002-2V4a2 2 0 00-2-2H4zm1 3a1 1 0 000 2h10a1 1 0 100-2H5zM5 13a1 1 0 100 2h10a1 1 0 100-2H5z" clip-rule="evenodd"></path></svg>
|
| 241 |
+
<span>Download Page .zip</span>
|
| 242 |
+
</a>
|
| 243 |
+
</div>
|
| 244 |
+
</div>
|
| 245 |
+
</div>
|
| 246 |
+
|
| 247 |
+
<div class="flex items-center space-x-2">
|
| 248 |
+
<span class="text-sm font-medium text-gray-500">Preview:</span>
|
| 249 |
+
<button id="desktop-btn" class="p-2 rounded-md bg-blue-500 text-white shadow" title="Desktop View">
|
| 250 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M10 2a2 2 0 00-2 2v1H6a2 2 0 00-2 2v7a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2V4a2 2 0 00-2-2zm-1 3V4a1 1 0 112 0v1h-2zM6 7v7h8V7H6z" clip-rule="evenodd"></path></svg>
|
| 251 |
+
</button>
|
| 252 |
+
<button id="tablet-btn" class="p-2 rounded-md bg-gray-200 text-gray-700" title="Tablet View">
|
| 253 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M4 2a2 2 0 00-2 2v12a2 2 0 002 2h12a2 2 0 002-2V4a2 2 0 00-2-2H4zm1 2a1 1 0 00-1 1v10a1 1 0 001 1h10a1 1 0 001-1V5a1 1 0 00-1-1H5z" clip-rule="evenodd"></path></svg>
|
| 254 |
+
</button>
|
| 255 |
+
<button id="mobile-btn" class="p-2 rounded-md bg-gray-200 text-gray-700" title="Mobile View">
|
| 256 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"><path d="M5 2a2 2 0 00-2 2v12a2 2 0 002 2h6a2 2 0 002-2V4a2 2 0 00-2-2H5z"></path></svg>
|
| 257 |
+
</button>
|
| 258 |
+
</div>
|
| 259 |
+
</div>
|
| 260 |
+
</header>
|
| 261 |
+
|
| 262 |
+
<div class="flex flex-1 overflow-hidden" id="main-container">
|
| 263 |
+
<aside id="controls-sidebar" class="w-1/3 bg-white shadow-lg overflow-hidden transition-all duration-300 ease-in-out">
|
| 264 |
+
<div id="controls-layout">
|
| 265 |
+
<nav id="controls-nav" class="space-y-2">
|
| 266 |
+
<button class="control-nav-button" data-target="#panel-global-settings"><i class="fas fa-cog"></i>Global</button>
|
| 267 |
+
<button class="control-nav-button" data-target="#panel-layout"><i class="fas fa-layer-group"></i>Layout</button>
|
| 268 |
+
<button class="control-nav-button" data-target="#panel-image-slider"><i class="fas fa-images"></i>Image Slider</button>
|
| 269 |
+
<button class="control-nav-button" data-target="#panel-accordion"><i class="fas fa-align-justify"></i>Accordion/FAQ</button>
|
| 270 |
+
<button class="control-nav-button" data-target="#panel-custom-html"><i class="fas fa-code"></i>Custom HTML</button>
|
| 271 |
+
</nav>
|
| 272 |
+
|
| 273 |
+
<div id="controls-panels">
|
| 274 |
+
<div id="panel-global-settings" class="control-panel">
|
| 275 |
+
<h3>⚙️ Global Settings</h3>
|
| 276 |
+
<div class="space-y-4">
|
| 277 |
+
<div class="space-y-2 border-b pb-4">
|
| 278 |
+
<label class="font-medium text-sm">Color Palette</label>
|
| 279 |
+
<div class="grid grid-cols-2 gap-2 text-xs">
|
| 280 |
+
<div>
|
| 281 |
+
<label for="global-color-primary">Primary</label>
|
| 282 |
+
<input type="color" id="global-color-primary" class="w-full p-0 h-8 border-none rounded-md">
|
| 283 |
+
</div>
|
| 284 |
+
<div>
|
| 285 |
+
<label for="global-color-secondary">Secondary</label>
|
| 286 |
+
<input type="color" id="global-color-secondary" class="w-full p-0 h-8 border-none rounded-md">
|
| 287 |
+
</div>
|
| 288 |
+
<div>
|
| 289 |
+
<label for="global-color-text">Text</label>
|
| 290 |
+
<input type="color" id="global-color-text" class="w-full p-0 h-8 border-none rounded-md">
|
| 291 |
+
</div>
|
| 292 |
+
<div>
|
| 293 |
+
<label for="global-color-heading">Heading</label>
|
| 294 |
+
<input type="color" id="global-color-heading" class="w-full p-0 h-8 border-none rounded-md">
|
| 295 |
+
</div>
|
| 296 |
+
</div>
|
| 297 |
+
</div>
|
| 298 |
+
<div class="space-y-2 border-b pb-4">
|
| 299 |
+
<label class="font-medium text-sm">Typography</label>
|
| 300 |
+
<div>
|
| 301 |
+
<label for="global-font-family" class="text-xs">Font Family</label>
|
| 302 |
+
<select id="global-font-family" class="w-full p-1 border rounded-md text-sm">
|
| 303 |
+
<option value="'Inter', sans-serif">Inter</option>
|
| 304 |
+
<option value="'Roboto', sans-serif">Roboto</option>
|
| 305 |
+
<option value="'Open Sans', sans-serif">Open Sans</option>
|
| 306 |
+
<option value="'Lato', sans-serif">Lato</option>
|
| 307 |
+
<option value="'Montserrat', sans-serif">Montserrat</option>
|
| 308 |
+
<option value="'Poppins', sans-serif">Poppins</option>
|
| 309 |
+
</select>
|
| 310 |
+
</div>
|
| 311 |
+
</div>
|
| 312 |
+
<button id="apply-global-settings" class="w-full bg-blue-600 text-white font-bold py-2 px-4 rounded-md hover:bg-blue-700 transition">Apply Global Styles</button>
|
| 313 |
+
</div>
|
| 314 |
+
</div>
|
| 315 |
+
|
| 316 |
+
<div id="panel-layout" class="control-panel">
|
| 317 |
+
<h3>↕️ Component Layout</h3>
|
| 318 |
+
<p class="text-xs text-gray-500 mb-4">Drag and drop to change the vertical order of the components on your page.</p>
|
| 319 |
+
<div id="layout-builder-container" class="space-y-2"></div>
|
| 320 |
+
</div>
|
| 321 |
+
|
| 322 |
+
<div id="panel-image-slider" class="control-panel">
|
| 323 |
+
<div class="flex justify-between items-center mb-6">
|
| 324 |
+
<h3 class="mb-0 pb-0 border-b-0">🖼️ Image Slider</h3>
|
| 325 |
+
<button class="get-component-code-btn text-sm bg-indigo-500 text-white py-1 px-3 rounded-md hover:bg-indigo-600" data-component-key="imageSlider">
|
| 326 |
+
<i class="fas fa-code mr-1"></i> Get Code
|
| 327 |
+
</button>
|
| 328 |
+
</div>
|
| 329 |
+
|
| 330 |
+
<div class="space-y-4">
|
| 331 |
+
<div class="flex items-center space-x-2 border-b pb-4">
|
| 332 |
+
<input type="checkbox" id="image-slider-toggle" class="h-4 w-4 rounded">
|
| 333 |
+
<label for="image-slider-toggle" class="font-medium">Enable Image Slider</label>
|
| 334 |
+
</div>
|
| 335 |
+
|
| 336 |
+
<div id="image-slider-builder" class="space-y-4">
|
| 337 |
+
<h4>Slides</h4>
|
| 338 |
+
<div id="slider-slides-container" class="space-y-2"></div>
|
| 339 |
+
<button id="add-slider-slide-btn" class="text-sm bg-blue-500 text-white py-2 px-4 rounded-md hover:bg-blue-600 w-full"><i class="fas fa-plus mr-2"></i>Add Slide</button>
|
| 340 |
+
|
| 341 |
+
<h4>Behavior & Timing</h4>
|
| 342 |
+
<div class="grid grid-cols-2 gap-4 text-sm">
|
| 343 |
+
<div class="flex items-center space-x-2"><input type="checkbox" id="slider-autoplay-toggle" class="h-4 w-4 rounded"><label for="slider-autoplay-toggle">Autoplay</label></div>
|
| 344 |
+
<div class="flex items-center space-x-2"><input type="checkbox" id="slider-loop-toggle" class="h-4 w-4 rounded"><label for="slider-loop-toggle">Loop</label></div>
|
| 345 |
+
<div class="flex items-center space-x-2"><input type="checkbox" id="slider-pause-on-hover-toggle" class="h-4 w-4 rounded"><label for="slider-pause-on-hover-toggle">Pause on Hover</label></div>
|
| 346 |
+
</div>
|
| 347 |
+
<div class="grid grid-cols-2 gap-4 text-sm">
|
| 348 |
+
<div><label for="slider-speed" class="block text-xs">Transition Speed (ms)</label><input type="number" id="slider-speed" class="w-full p-1 border rounded-md" step="100"></div>
|
| 349 |
+
<div><label for="slider-autoplay-delay" class="block text-xs">Autoplay Delay (ms)</label><input type="number" id="slider-autoplay-delay" class="w-full p-1 border rounded-md" step="500"></div>
|
| 350 |
+
</div>
|
| 351 |
+
|
| 352 |
+
<h4>Navigation & Interaction</h4>
|
| 353 |
+
<div class="grid grid-cols-2 gap-4 text-sm">
|
| 354 |
+
<div class="flex items-center space-x-2"><input type="checkbox" id="slider-arrows-toggle" class="h-4 w-4 rounded"><label for="slider-arrows-toggle">Arrows</label></div>
|
| 355 |
+
<div class="flex items-center space-x-2"><input type="checkbox" id="slider-pagination-toggle" class="h-4 w-4 rounded"><label for="slider-pagination-toggle">Dots</label></div>
|
| 356 |
+
<div class="flex items-center space-x-2"><input type="checkbox" id="slider-progressbar-toggle" class="h-4 w-4 rounded"><label for="slider-progressbar-toggle">Progress Bar</label></div>
|
| 357 |
+
<div class="flex items-center space-x-2"><input type="checkbox" id="slider-scrollbar-toggle" class="h-4 w-4 rounded"><label for="slider-scrollbar-toggle">Scrollbar</label></div>
|
| 358 |
+
<div class="flex items-center space-x-2"><input type="checkbox" id="slider-thumbnails-toggle" class="h-4 w-4 rounded"><label for="slider-thumbnails-toggle">Thumbnails</label></div>
|
| 359 |
+
<div class="flex items-center space-x-2"><input type="checkbox" id="slider-keyboard-toggle" class="h-4 w-4 rounded"><label for="slider-keyboard-toggle">Keyboard</label></div>
|
| 360 |
+
</div>
|
| 361 |
+
|
| 362 |
+
<h4>Effects & Layout</h4>
|
| 363 |
+
<div class="grid grid-cols-2 gap-4 text-sm">
|
| 364 |
+
<div>
|
| 365 |
+
<label for="slider-effect" class="block text-xs">Transition Effect</label>
|
| 366 |
+
<select id="slider-effect" class="w-full p-1 border rounded-md text-sm">
|
| 367 |
+
<option value="slide">Slide</option><option value="fade">Fade</option><option value="cube">Cube</option><option value="coverflow">Coverflow</option><option value="flip">Flip</option>
|
| 368 |
+
</select>
|
| 369 |
+
</div>
|
| 370 |
+
<div>
|
| 371 |
+
<label for="slider-slides-per-view" class="block text-xs">Slides Per View</label>
|
| 372 |
+
<input type="number" id="slider-slides-per-view" class="w-full p-1 border rounded-md" min="1" max="10" step="1">
|
| 373 |
+
</div>
|
| 374 |
+
</div>
|
| 375 |
+
<div class="grid grid-cols-2 gap-4 text-sm">
|
| 376 |
+
<div class="flex items-center space-x-2"><input type="checkbox" id="slider-centered-slides-toggle" class="h-4 w-4 rounded"><label for="slider-centered-slides-toggle">Center Slides</label></div>
|
| 377 |
+
<div class="flex items-center space-x-2"><input type="checkbox" id="slider-full-width-toggle" class="h-4 w-4 rounded"><label for="slider-full-width-toggle">Full Width</label></div>
|
| 378 |
+
</div>
|
| 379 |
+
|
| 380 |
+
<h4>Performance & Accessibility</h4>
|
| 381 |
+
<div class="grid grid-cols-2 gap-4 text-sm">
|
| 382 |
+
<div class="flex items-center space-x-2"><input type="checkbox" id="slider-lazyload-toggle" class="h-4 w-4 rounded"><label for="slider-lazyload-toggle">Lazy Loading</label></div>
|
| 383 |
+
<div class="flex items-center space-x-2"><input type="checkbox" id="slider-a11y-toggle" class="h-4 w-4 rounded"><label for="slider-a11y-toggle">Accessibility</label></div>
|
| 384 |
+
</div>
|
| 385 |
+
</div>
|
| 386 |
+
</div>
|
| 387 |
+
</div>
|
| 388 |
+
|
| 389 |
+
<div id="panel-accordion" class="control-panel">
|
| 390 |
+
<div class="flex justify-between items-center mb-6">
|
| 391 |
+
<h3 class="mb-0 pb-0 border-b-0"><i class="fas fa-align-justify mr-2"></i>Accordion/FAQ</h3>
|
| 392 |
+
<button class="get-component-code-btn text-sm bg-indigo-500 text-white py-1 px-3 rounded-md hover:bg-indigo-600" data-component-key="accordion">
|
| 393 |
+
<i class="fas fa-code mr-1"></i> Get Code
|
| 394 |
+
</button>
|
| 395 |
+
</div>
|
| 396 |
+
<div class="space-y-4">
|
| 397 |
+
<div class="flex items-center space-x-2 border-b pb-4">
|
| 398 |
+
<input type="checkbox" id="accordion-toggle" class="h-4 w-4 rounded">
|
| 399 |
+
<label for="accordion-toggle" class="font-medium">Enable Accordion/FAQ Section</label>
|
| 400 |
+
</div>
|
| 401 |
+
<div id="accordion-builder" class="space-y-4">
|
| 402 |
+
<h4>Items</h4>
|
| 403 |
+
<div id="accordion-items-container" class="space-y-2"></div>
|
| 404 |
+
<button id="add-accordion-item-btn" class="text-sm bg-blue-500 text-white py-2 px-4 rounded-md hover:bg-blue-600 w-full"><i class="fas fa-plus mr-2"></i>Add Item</button>
|
| 405 |
+
|
| 406 |
+
<h4>Settings</h4>
|
| 407 |
+
<div class="flex items-center space-x-2 text-sm">
|
| 408 |
+
<input type="checkbox" id="accordion-multiple-open-toggle" class="h-4 w-4 rounded">
|
| 409 |
+
<label for="accordion-multiple-open-toggle">Allow multiple items to be open</label>
|
| 410 |
+
</div>
|
| 411 |
+
<div class="text-sm">
|
| 412 |
+
<label for="accordion-icon-style" class="block text-xs">Icon Style</label>
|
| 413 |
+
<select id="accordion-icon-style" class="w-full p-1 border rounded-md text-sm">
|
| 414 |
+
<option value="plus-minus">Plus / Minus</option>
|
| 415 |
+
<option value="chevron">Chevron</option>
|
| 416 |
+
<option value="caret">Caret</option>
|
| 417 |
+
</select>
|
| 418 |
+
</div>
|
| 419 |
+
</div>
|
| 420 |
+
</div>
|
| 421 |
+
</div>
|
| 422 |
+
|
| 423 |
+
<div id="panel-custom-html" class="control-panel">
|
| 424 |
+
<div class="flex justify-between items-center mb-6">
|
| 425 |
+
<h3 class="mb-0 pb-0 border-b-0"> </> Custom HTML</h3>
|
| 426 |
+
<button class="get-component-code-btn text-sm bg-indigo-500 text-white py-1 px-3 rounded-md hover:bg-indigo-600" data-component-key="customHtml">
|
| 427 |
+
<i class="fas fa-code mr-1"></i> Get Code
|
| 428 |
+
</button>
|
| 429 |
+
</div>
|
| 430 |
+
<div class="space-y-4">
|
| 431 |
+
<div class="flex items-center space-x-2 border-b pb-4">
|
| 432 |
+
<input type="checkbox" id="custom-html-toggle" class="h-4 w-4 rounded">
|
| 433 |
+
<label for="custom-html-toggle" class="font-medium">Enable Custom HTML Section</label>
|
| 434 |
+
</div>
|
| 435 |
+
<div id="custom-html-builder">
|
| 436 |
+
<label for="custom-html-content" class="text-sm font-medium">HTML Content</label>
|
| 437 |
+
<p class="text-xs text-gray-500 mb-2">Paste any valid HTML. Be cautious, as invalid code can break the page layout.</p>
|
| 438 |
+
<textarea id="custom-html-content" rows="10" class="w-full p-2 border rounded-md font-mono text-sm"></textarea>
|
| 439 |
+
</div>
|
| 440 |
+
</div>
|
| 441 |
+
</div>
|
| 442 |
+
|
| 443 |
+
</div>
|
| 444 |
+
</div>
|
| 445 |
+
</aside>
|
| 446 |
+
|
| 447 |
+
|
| 448 |
+
<main id="preview-main" class="w-2/3 bg-gray-200 p-4 flex flex-col items-center justify-center overflow-hidden transition-all duration-300 ease-in-out">
|
| 449 |
+
<div id="preview-container" class="bg-white shadow-lg rounded-lg w-full h-full overflow-hidden">
|
| 450 |
+
<iframe id="preview-iframe" class="preview-iframe"></iframe>
|
| 451 |
+
</div>
|
| 452 |
+
</main>
|
| 453 |
+
|
| 454 |
+
</div>
|
| 455 |
+
</div>
|
| 456 |
+
<div id="toast-notification" class="toast"></div>
|
| 457 |
+
|
| 458 |
+
<div id="code-modal" class="hidden fixed inset-0 bg-gray-600 bg-opacity-75 overflow-y-auto h-full w-full z-50">
|
| 459 |
+
<div class="relative top-10 mx-auto p-5 border w-11/12 md:w-2/3 shadow-lg rounded-md bg-white">
|
| 460 |
+
<div class="flex justify-between items-center border-b pb-3">
|
| 461 |
+
<h3 id="code-modal-title" class="text-lg leading-6 font-medium text-gray-900">Component Code</h3>
|
| 462 |
+
<button id="close-code-modal-btn" class="text-gray-400 hover:text-gray-600">×</button>
|
| 463 |
+
</div>
|
| 464 |
+
<div class="mt-4 space-y-4">
|
| 465 |
+
<div>
|
| 466 |
+
<label class="font-semibold text-gray-700">HTML</label>
|
| 467 |
+
<pre id="code-modal-html" class="code-modal-pre"><code></code></pre>
|
| 468 |
+
</div>
|
| 469 |
+
<div>
|
| 470 |
+
<label class="font-semibold text-gray-700">CSS</label>
|
| 471 |
+
<pre id="code-modal-css" class="code-modal-pre"><code></code></pre>
|
| 472 |
+
</div>
|
| 473 |
+
<div>
|
| 474 |
+
<label class="font-semibold text-gray-700">JavaScript</label>
|
| 475 |
+
<pre id="code-modal-js" class="code-modal-pre"><code></code></pre>
|
| 476 |
+
</div>
|
| 477 |
+
</div>
|
| 478 |
+
<div class="items-center px-4 py-3 mt-4 text-right bg-gray-50 -mx-5 -mb-5 rounded-b-md">
|
| 479 |
+
<button id="download-component-zip-btn" class="px-4 py-2 bg-green-600 text-white text-base font-medium rounded-md shadow-sm hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-green-300">
|
| 480 |
+
Download .zip
|
| 481 |
+
</button>
|
| 482 |
+
<button id="close-code-modal-btn-2" class="px-4 py-2 bg-gray-200 text-gray-800 text-base font-medium rounded-md shadow-sm hover:bg-gray-300 focus:outline-none focus:ring-2 focus:ring-gray-300 ml-2">
|
| 483 |
+
Close
|
| 484 |
+
</button>
|
| 485 |
+
</div>
|
| 486 |
+
</div>
|
| 487 |
+
</div>
|
| 488 |
+
|
| 489 |
+
<script src="https://unpkg.com/swiper/swiper-bundle.min.js"></script>
|
| 490 |
+
<script>
|
| 491 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 492 |
+
// State object to hold all configurations
|
| 493 |
+
const config = {
|
| 494 |
+
globalSettings: {
|
| 495 |
+
colors: {
|
| 496 |
+
primary: '#3b82f6',
|
| 497 |
+
secondary: '#10b981',
|
| 498 |
+
text: '#374151',
|
| 499 |
+
heading: '#111827',
|
| 500 |
+
},
|
| 501 |
+
typography: {
|
| 502 |
+
fontFamily: "'Inter', sans-serif",
|
| 503 |
+
}
|
| 504 |
+
},
|
| 505 |
+
componentOrder: [
|
| 506 |
+
'imageSlider',
|
| 507 |
+
'accordion',
|
| 508 |
+
'customHtml'
|
| 509 |
+
],
|
| 510 |
+
imageSlider: {
|
| 511 |
+
enabled: true,
|
| 512 |
+
slides: [
|
| 513 |
+
{ id: Date.now(), type: 'image', imageUrl: 'https://images.unsplash.com/photo-1549880338-65ddcdfd017b?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80', videoUrl: '', posterUrl: '', title: 'Explore the Mountains', caption: 'Breathtaking views and serene landscapes await.', link: '#' },
|
| 514 |
+
{ id: Date.now() + 1, type: 'video', imageUrl: '', videoUrl: 'https://cdn.coverr.co/videos/coverr-a-man-running-on-a-road-in-the-countryside-7546/1080p.mp4', posterUrl: 'https://images.unsplash.com/photo-1551632811-561732d1e306?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80', title: 'Active Lifestyle', caption: 'Push your limits every day.', link: '#' },
|
| 515 |
+
{ id: Date.now() + 5, type: 'image', imageUrl: 'https://images.unsplash.com/photo-1554425396-5b404e7a4e?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80', videoUrl: '', posterUrl: '', title: 'City Skylines', caption: 'Experience the vibrant life of the city.', link: '#' }
|
| 516 |
+
],
|
| 517 |
+
settings: {
|
| 518 |
+
autoplay: true, loop: true, pauseOnHover: true, speed: 800, delay: 4000,
|
| 519 |
+
showArrows: true, showPagination: true, showProgressBar: false, showScrollbar: false,
|
| 520 |
+
showThumbnails: true, keyboardControl: true, lazyLoad: true, accessibility: true,
|
| 521 |
+
effect: 'slide', slidesPerView: 1, centeredSlides: true, fullWidth: true,
|
| 522 |
+
}
|
| 523 |
+
},
|
| 524 |
+
accordion: {
|
| 525 |
+
enabled: true,
|
| 526 |
+
allowMultipleOpen: false,
|
| 527 |
+
iconStyle: 'plus-minus', // 'plus-minus', 'chevron', 'caret'
|
| 528 |
+
items: [
|
| 529 |
+
{ id: Date.now() + 2, title: 'What is this component builder?', content: 'This is an interactive tool that allows you to visually construct and customize web page components, then export the ready-to-use HTML, CSS, and JavaScript code.'},
|
| 530 |
+
{ id: Date.now() + 3, title: 'How do I add a new item?', content: 'Simply click the "Add Item" button in the control panel. A new accordion item will appear here, and you can edit its title and content in the controls on the left.'},
|
| 531 |
+
{ id: Date.now() + 4, title: 'Can I have multiple items open at once?', content: 'Yes, you can! Just check the "Allow multiple items to be open" box in the settings within the control panel. Try it now!'}
|
| 532 |
+
]
|
| 533 |
+
},
|
| 534 |
+
customHtml: {
|
| 535 |
+
enabled: false,
|
| 536 |
+
content: ''
|
| 537 |
+
}
|
| 538 |
+
};
|
| 539 |
+
|
| 540 |
+
const componentNames = {
|
| 541 |
+
customHtml: 'Custom HTML',
|
| 542 |
+
imageSlider: 'Image Slider',
|
| 543 |
+
accordion: 'Accordion/FAQ'
|
| 544 |
+
};
|
| 545 |
+
|
| 546 |
+
// UI Element References
|
| 547 |
+
const ui = {
|
| 548 |
+
previewIframe: document.getElementById('preview-iframe'),
|
| 549 |
+
mainContainer: document.getElementById('main-container'),
|
| 550 |
+
toggleSidebarBtn: document.getElementById('toggle-sidebar-btn'),
|
| 551 |
+
controls: {
|
| 552 |
+
nav: document.getElementById('controls-nav'),
|
| 553 |
+
panels: document.getElementById('controls-panels'),
|
| 554 |
+
},
|
| 555 |
+
globalSettings: {
|
| 556 |
+
primaryColor: document.getElementById('global-color-primary'),
|
| 557 |
+
secondaryColor: document.getElementById('global-color-secondary'),
|
| 558 |
+
textColor: document.getElementById('global-color-text'),
|
| 559 |
+
headingColor: document.getElementById('global-color-heading'),
|
| 560 |
+
fontFamily: document.getElementById('global-font-family'),
|
| 561 |
+
applyBtn: document.getElementById('apply-global-settings'),
|
| 562 |
+
},
|
| 563 |
+
layout: {
|
| 564 |
+
container: document.getElementById('layout-builder-container'),
|
| 565 |
+
panel: document.getElementById('panel-layout')
|
| 566 |
+
},
|
| 567 |
+
imageSlider: {
|
| 568 |
+
toggle: document.getElementById('image-slider-toggle'),
|
| 569 |
+
builder: document.getElementById('image-slider-builder'),
|
| 570 |
+
slidesContainer: document.getElementById('slider-slides-container'),
|
| 571 |
+
addSlideBtn: document.getElementById('add-slider-slide-btn'),
|
| 572 |
+
autoplay: document.getElementById('slider-autoplay-toggle'),
|
| 573 |
+
loop: document.getElementById('slider-loop-toggle'),
|
| 574 |
+
pauseOnHover: document.getElementById('slider-pause-on-hover-toggle'),
|
| 575 |
+
speed: document.getElementById('slider-speed'),
|
| 576 |
+
delay: document.getElementById('slider-autoplay-delay'),
|
| 577 |
+
arrows: document.getElementById('slider-arrows-toggle'),
|
| 578 |
+
pagination: document.getElementById('slider-pagination-toggle'),
|
| 579 |
+
progressbar: document.getElementById('slider-progressbar-toggle'),
|
| 580 |
+
scrollbar: document.getElementById('slider-scrollbar-toggle'),
|
| 581 |
+
thumbnails: document.getElementById('slider-thumbnails-toggle'),
|
| 582 |
+
keyboard: document.getElementById('slider-keyboard-toggle'),
|
| 583 |
+
lazyload: document.getElementById('slider-lazyload-toggle'),
|
| 584 |
+
a11y: document.getElementById('slider-a11y-toggle'),
|
| 585 |
+
effect: document.getElementById('slider-effect'),
|
| 586 |
+
slidesPerView: document.getElementById('slider-slides-per-view'),
|
| 587 |
+
centeredSlides: document.getElementById('slider-centered-slides-toggle'),
|
| 588 |
+
fullWidth: document.getElementById('slider-full-width-toggle'),
|
| 589 |
+
},
|
| 590 |
+
accordion: {
|
| 591 |
+
toggle: document.getElementById('accordion-toggle'),
|
| 592 |
+
builder: document.getElementById('accordion-builder'),
|
| 593 |
+
itemsContainer: document.getElementById('accordion-items-container'),
|
| 594 |
+
addItemBtn: document.getElementById('add-accordion-item-btn'),
|
| 595 |
+
multipleOpen: document.getElementById('accordion-multiple-open-toggle'),
|
| 596 |
+
iconStyle: document.getElementById('accordion-icon-style'),
|
| 597 |
+
},
|
| 598 |
+
customHtml: {
|
| 599 |
+
toggle: document.getElementById('custom-html-toggle'),
|
| 600 |
+
content: document.getElementById('custom-html-content'),
|
| 601 |
+
},
|
| 602 |
+
buttons: {
|
| 603 |
+
desktop: document.getElementById('desktop-btn'),
|
| 604 |
+
tablet: document.getElementById('tablet-btn'),
|
| 605 |
+
mobile: document.getElementById('mobile-btn'),
|
| 606 |
+
import: document.getElementById('import-btn'),
|
| 607 |
+
importFile: document.getElementById('import-file-input'),
|
| 608 |
+
},
|
| 609 |
+
exportMenu: {
|
| 610 |
+
container: document.getElementById('export-menu-container'),
|
| 611 |
+
button: document.getElementById('export-menu-btn'),
|
| 612 |
+
dropdown: document.getElementById('export-dropdown'),
|
| 613 |
+
copyCombined: document.getElementById('copy-combined-code'),
|
| 614 |
+
copyHtml: document.getElementById('copy-html'),
|
| 615 |
+
copyCss: document.getElementById('copy-css'),
|
| 616 |
+
copyJs: document.getElementById('copy-js'),
|
| 617 |
+
downloadZip: document.getElementById('download-zip-btn'),
|
| 618 |
+
},
|
| 619 |
+
codeModal: {
|
| 620 |
+
modal: document.getElementById('code-modal'),
|
| 621 |
+
title: document.getElementById('code-modal-title'),
|
| 622 |
+
htmlContainer: document.getElementById('code-modal-html'),
|
| 623 |
+
cssContainer: document.getElementById('code-modal-css'),
|
| 624 |
+
jsContainer: document.getElementById('code-modal-js'),
|
| 625 |
+
htmlCode: document.querySelector('#code-modal-html code'),
|
| 626 |
+
cssCode: document.querySelector('#code-modal-css code'),
|
| 627 |
+
jsCode: document.querySelector('#code-modal-js code'),
|
| 628 |
+
downloadBtn: document.getElementById('download-component-zip-btn'),
|
| 629 |
+
closeBtns: [document.getElementById('close-code-modal-btn'), document.getElementById('close-code-modal-btn-2')],
|
| 630 |
+
},
|
| 631 |
+
previewContainer: document.getElementById('preview-container'),
|
| 632 |
+
};
|
| 633 |
+
|
| 634 |
+
// --- Event Listeners ---
|
| 635 |
+
function setupEventListeners() {
|
| 636 |
+
ui.controls.nav.addEventListener('click', (e) => {
|
| 637 |
+
const button = e.target.closest('.control-nav-button');
|
| 638 |
+
if (!button) return;
|
| 639 |
+
const targetPanelId = button.dataset.target;
|
| 640 |
+
ui.controls.nav.querySelectorAll('.control-nav-button').forEach(btn => btn.classList.remove('active'));
|
| 641 |
+
button.classList.add('active');
|
| 642 |
+
ui.controls.panels.querySelectorAll('.control-panel').forEach(panel => {
|
| 643 |
+
panel.classList.toggle('active', `#${panel.id}` === targetPanelId);
|
| 644 |
+
});
|
| 645 |
+
});
|
| 646 |
+
|
| 647 |
+
ui.globalSettings.applyBtn.addEventListener('click', () => { renderAll(); showToast('Global styles applied!'); });
|
| 648 |
+
|
| 649 |
+
// Layout Controls
|
| 650 |
+
ui.layout.panel.addEventListener('click', handleLayoutControlsClick);
|
| 651 |
+
setupDragAndDrop();
|
| 652 |
+
|
| 653 |
+
// Component Listeners
|
| 654 |
+
ui.imageSlider.toggle.addEventListener('change', e => { config.imageSlider.enabled = e.target.checked; renderAll(); });
|
| 655 |
+
setupImageSliderEventListeners();
|
| 656 |
+
|
| 657 |
+
ui.accordion.toggle.addEventListener('change', e => { config.accordion.enabled = e.target.checked; renderAll(); });
|
| 658 |
+
setupAccordionEventListeners();
|
| 659 |
+
|
| 660 |
+
ui.customHtml.toggle.addEventListener('change', e => { config.customHtml.enabled = e.target.checked; renderAll(); });
|
| 661 |
+
ui.customHtml.content.addEventListener('input', e => { config.customHtml.content = e.target.value; renderAll(); });
|
| 662 |
+
|
| 663 |
+
// Preview & Export
|
| 664 |
+
ui.buttons.desktop.addEventListener('click', () => setPreviewMode('desktop'));
|
| 665 |
+
ui.buttons.tablet.addEventListener('click', () => setPreviewMode('tablet'));
|
| 666 |
+
ui.buttons.mobile.addEventListener('click', () => setPreviewMode('mobile'));
|
| 667 |
+
ui.exportMenu.button.addEventListener('click', (e) => { e.stopPropagation(); ui.exportMenu.dropdown.classList.toggle('hidden'); });
|
| 668 |
+
window.addEventListener('click', (e) => { if (!ui.exportMenu.container.contains(e.target)) { ui.exportMenu.dropdown.classList.add('hidden'); } });
|
| 669 |
+
|
| 670 |
+
const copyAction = (e, dataGetter, message) => {
|
| 671 |
+
e.preventDefault();
|
| 672 |
+
navigator.clipboard.writeText(dataGetter()).then(() => showToast(message));
|
| 673 |
+
ui.exportMenu.dropdown.classList.add('hidden');
|
| 674 |
+
};
|
| 675 |
+
|
| 676 |
+
ui.exportMenu.copyCombined.addEventListener('click', (e) => copyAction(e, getCombinedCode, 'Combined code copied!'));
|
| 677 |
+
ui.exportMenu.copyHtml.addEventListener('click', (e) => copyAction(e, getAllHtml, 'All HTML copied!'));
|
| 678 |
+
ui.exportMenu.copyCss.addEventListener('click', (e) => copyAction(e, getFullCSS, 'All CSS copied!'));
|
| 679 |
+
ui.exportMenu.copyJs.addEventListener('click', (e) => copyAction(e, getFullJS, 'All JS copied!'));
|
| 680 |
+
ui.exportMenu.downloadZip.addEventListener('click', (e) => { e.preventDefault(); generatePageZip(); ui.exportMenu.dropdown.classList.add('hidden'); });
|
| 681 |
+
|
| 682 |
+
// Other Listeners
|
| 683 |
+
ui.controls.panels.addEventListener('click', handleGetCodeClick);
|
| 684 |
+
ui.codeModal.closeBtns.forEach(btn => btn.addEventListener('click', () => ui.codeModal.modal.classList.add('hidden')));
|
| 685 |
+
ui.toggleSidebarBtn.addEventListener('click', () => {
|
| 686 |
+
ui.mainContainer.classList.toggle('sidebar-collapsed');
|
| 687 |
+
const isCollapsed = ui.mainContainer.classList.contains('sidebar-collapsed');
|
| 688 |
+
const icon = ui.toggleSidebarBtn.querySelector('i');
|
| 689 |
+
icon.classList.toggle('fa-chevron-left', !isCollapsed);
|
| 690 |
+
icon.classList.toggle('fa-chevron-right', isCollapsed);
|
| 691 |
+
ui.toggleSidebarBtn.title = isCollapsed ? 'Show Controls' : 'Hide Controls';
|
| 692 |
+
});
|
| 693 |
+
}
|
| 694 |
+
|
| 695 |
+
// --- LAYOUT CONTROLS ---
|
| 696 |
+
function renderLayoutControls() {
|
| 697 |
+
ui.layout.container.innerHTML = config.componentOrder.map((key, index) => {
|
| 698 |
+
const total = config.componentOrder.length;
|
| 699 |
+
return `
|
| 700 |
+
<div class="layout-item p-3 border rounded-md bg-white flex items-center justify-between" draggable="true" data-key="${key}">
|
| 701 |
+
<span class="font-medium text-sm"><i class="fas fa-grip-vertical mr-3 text-gray-400"></i> ${componentNames[key]}</span>
|
| 702 |
+
<div class="item-toolbar mb-0">
|
| 703 |
+
<button class="reorder-layout-up-btn text-xs bg-gray-200 text-gray-700 p-1 rounded-md hover:bg-gray-300" data-index="${index}" ${index === 0 ? 'disabled' : ''}><i class="fas fa-arrow-up fa-fw"></i></button>
|
| 704 |
+
<button class="reorder-layout-down-btn text-xs bg-gray-200 text-gray-700 p-1 rounded-md hover:bg-gray-300" data-index="${index}" ${index === total - 1 ? 'disabled' : ''}><i class="fas fa-arrow-down fa-fw"></i></button>
|
| 705 |
+
</div>
|
| 706 |
+
</div>`;
|
| 707 |
+
}).join('');
|
| 708 |
+
}
|
| 709 |
+
|
| 710 |
+
function handleLayoutControlsClick(e) {
|
| 711 |
+
const button = e.target.closest('button');
|
| 712 |
+
if (!button) return;
|
| 713 |
+
const index = parseInt(button.dataset.index, 10);
|
| 714 |
+
const order = config.componentOrder;
|
| 715 |
+
let changed = false;
|
| 716 |
+
if (button.classList.contains('reorder-layout-up-btn') && index > 0) {
|
| 717 |
+
[order[index], order[index - 1]] = [order[index - 1], order[index]];
|
| 718 |
+
changed = true;
|
| 719 |
+
} else if (button.classList.contains('reorder-layout-down-btn') && index < order.length - 1) {
|
| 720 |
+
[order[index], order[index + 1]] = [order[index + 1], order[index]];
|
| 721 |
+
changed = true;
|
| 722 |
+
}
|
| 723 |
+
if(changed) { renderLayoutControls(); renderAll(); }
|
| 724 |
+
}
|
| 725 |
+
|
| 726 |
+
function setupDragAndDrop() {
|
| 727 |
+
let draggedItem = null;
|
| 728 |
+
ui.layout.container.addEventListener('dragstart', e => {
|
| 729 |
+
draggedItem = e.target;
|
| 730 |
+
setTimeout(() => e.target.style.display = 'none', 0);
|
| 731 |
+
});
|
| 732 |
+
ui.layout.container.addEventListener('dragend', () => setTimeout(() => { if(draggedItem) { draggedItem.style.display = 'flex'; } draggedItem = null; }, 0));
|
| 733 |
+
ui.layout.container.addEventListener('dragover', e => {
|
| 734 |
+
e.preventDefault();
|
| 735 |
+
const afterElement = getDragAfterElement(ui.layout.container, e.clientY);
|
| 736 |
+
if (afterElement == null) { ui.layout.container.appendChild(draggedItem); }
|
| 737 |
+
else { ui.layout.container.insertBefore(draggedItem, afterElement); }
|
| 738 |
+
});
|
| 739 |
+
ui.layout.container.addEventListener('drop', e => {
|
| 740 |
+
e.preventDefault();
|
| 741 |
+
if (!draggedItem) return;
|
| 742 |
+
config.componentOrder = [...ui.layout.container.querySelectorAll('.layout-item')].map(item => item.dataset.key);
|
| 743 |
+
renderLayoutControls();
|
| 744 |
+
renderAll();
|
| 745 |
+
});
|
| 746 |
+
}
|
| 747 |
+
|
| 748 |
+
function getDragAfterElement(container, y) {
|
| 749 |
+
const draggableElements = [...container.querySelectorAll('.layout-item:not([style*="display: none"])')];
|
| 750 |
+
return draggableElements.reduce((closest, child) => {
|
| 751 |
+
const box = child.getBoundingClientRect();
|
| 752 |
+
const offset = y - box.top - box.height / 2;
|
| 753 |
+
if (offset < 0 && offset > closest.offset) { return { offset: offset, element: child }; }
|
| 754 |
+
else { return closest; }
|
| 755 |
+
}, { offset: Number.NEGATIVE_INFINITY }).element;
|
| 756 |
+
}
|
| 757 |
+
|
| 758 |
+
|
| 759 |
+
// --- HTML Generation Logic ---
|
| 760 |
+
const componentGenerators = {
|
| 761 |
+
imageSlider: generateImageSliderHTML,
|
| 762 |
+
accordion: generateAccordionHTML,
|
| 763 |
+
customHtml: generateCustomHtmlHTML
|
| 764 |
+
};
|
| 765 |
+
|
| 766 |
+
function getAllHtml() { return config.componentOrder.map(key => componentGenerators[key] ? componentGenerators[key]() : '').filter(Boolean).join('\n\n'); }
|
| 767 |
+
|
| 768 |
+
function generateImageSliderHTML() {
|
| 769 |
+
if (!config.imageSlider.enabled) return '';
|
| 770 |
+
const { slides, settings } = config.imageSlider;
|
| 771 |
+
|
| 772 |
+
const mainSlidesHtml = slides.map(slide => {
|
| 773 |
+
const lazyHtml = settings.lazyLoad ? `data-src="${slide.type === 'image' ? slide.imageUrl : slide.videoUrl}" class="swiper-lazy"` : `src="${slide.type === 'image' ? slide.imageUrl : slide.videoUrl}"`;
|
| 774 |
+
const mediaHtml = slide.type === 'image'
|
| 775 |
+
? `<img ${lazyHtml} alt="${slide.title}" />`
|
| 776 |
+
: `<video ${lazyHtml} loop muted playsinline poster="${slide.posterUrl}"></video>`;
|
| 777 |
+
const preloader = settings.lazyLoad ? '<div class="swiper-lazy-preloader swiper-lazy-preloader-white"></div>' : '';
|
| 778 |
+
|
| 779 |
+
return `
|
| 780 |
+
<div class="swiper-slide">
|
| 781 |
+
<a href="${slide.link || '#'}" class="slide-link">
|
| 782 |
+
${mediaHtml}
|
| 783 |
+
<div class="slide-caption"><h3>${slide.title}</h3><p>${slide.caption}</p></div>
|
| 784 |
+
${preloader}
|
| 785 |
+
</a>
|
| 786 |
+
</div>`;
|
| 787 |
+
}).join('');
|
| 788 |
+
|
| 789 |
+
const thumbsSlidesHtml = settings.showThumbnails ? slides.map(slide => {
|
| 790 |
+
const thumbSrc = slide.type === 'image' ? slide.imageUrl : slide.posterUrl;
|
| 791 |
+
return `<div class="swiper-slide"><img src="${thumbSrc}" /></div>`;
|
| 792 |
+
}).join('') : '';
|
| 793 |
+
|
| 794 |
+
return `
|
| 795 |
+
<div class="image-slider-section ${settings.fullWidth ? 'w-full' : 'max-w-7xl mx-auto py-8'}">
|
| 796 |
+
<div class="swiper-container gallery-main">
|
| 797 |
+
<div class="swiper-wrapper">${mainSlidesHtml}</div>
|
| 798 |
+
${settings.showArrows ? '<div class="swiper-button-next"></div><div class="swiper-button-prev"></div>' : ''}
|
| 799 |
+
${settings.showPagination ? '<div class="swiper-pagination" id="swiper-pagination-dots"></div>' : ''}
|
| 800 |
+
${settings.showProgressBar ? '<div class="swiper-pagination" id="swiper-pagination-progressbar"></div>' : ''}
|
| 801 |
+
${settings.showScrollbar ? '<div class="swiper-scrollbar"></div>' : ''}
|
| 802 |
+
</div>
|
| 803 |
+
${settings.showThumbnails ? `<div class="swiper-container gallery-thumbs"><div class="swiper-wrapper">${thumbsSlidesHtml}</div></div>` : ''}
|
| 804 |
+
</div>`;
|
| 805 |
+
}
|
| 806 |
+
|
| 807 |
+
function generateAccordionHTML() {
|
| 808 |
+
if (!config.accordion.enabled) return '';
|
| 809 |
+
const { items, iconStyle } = config.accordion;
|
| 810 |
+
const itemsHtml = items.map(item => `
|
| 811 |
+
<div class="accordion-item">
|
| 812 |
+
<button class="accordion-header" aria-expanded="false">
|
| 813 |
+
<span class="accordion-title">${item.title}</span>
|
| 814 |
+
<span class="accordion-icon" data-icon-style="${iconStyle}"></span>
|
| 815 |
+
</button>
|
| 816 |
+
<div class="accordion-content"><div class="accordion-content-inner">${item.content}</div></div>
|
| 817 |
+
</div>`).join('');
|
| 818 |
+
return `
|
| 819 |
+
<div class="accordion-section">
|
| 820 |
+
<div class="max-w-3xl mx-auto py-8 px-4">
|
| 821 |
+
<h2 class="section-title">Frequently Asked Questions</h2>
|
| 822 |
+
<div class="accordion-container">${itemsHtml}</div>
|
| 823 |
+
</div>
|
| 824 |
+
</div>`;
|
| 825 |
+
}
|
| 826 |
+
|
| 827 |
+
function generateCustomHtmlHTML() { return config.customHtml.enabled ? `<div class="custom-html-section">${config.customHtml.content}</div>` : ''; }
|
| 828 |
+
|
| 829 |
+
function generateComponentCSS(targetKey = null) {
|
| 830 |
+
const { colors } = config.globalSettings;
|
| 831 |
+
const css = {};
|
| 832 |
+
css.global = `:root { --primary-color: ${colors.primary}; } /* ... */`;
|
| 833 |
+
|
| 834 |
+
if(config.imageSlider.enabled) css.imageSlider = `
|
| 835 |
+
.gallery-main { height: 80%; width: 100%; }
|
| 836 |
+
.gallery-thumbs { height: 20%; box-sizing: border-box; padding: 10px 0; }
|
| 837 |
+
.gallery-thumbs .swiper-slide { width: 25%; height: 100%; opacity: 0.4; cursor: pointer; }
|
| 838 |
+
.gallery-thumbs .swiper-slide-thumb-active { opacity: 1; border: 2px solid var(--primary-color); }
|
| 839 |
+
.swiper-slide img, .swiper-slide video { display: block; width: 100%; height: 100%; object-fit: cover; }
|
| 840 |
+
.slide-caption { position: absolute; bottom: 0; left: 0; right: 0; padding: 40px 20px; background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 100%); color: white; }
|
| 841 |
+
.slide-caption h3 { color: white; }
|
| 842 |
+
.swiper-button-next, .swiper-button-prev { color: var(--primary-color); }
|
| 843 |
+
.swiper-pagination-bullet-active { background-color: var(--primary-color); }
|
| 844 |
+
.swiper-pagination-progressbar .swiper-pagination-progressbar-fill { background: var(--primary-color); }`;
|
| 845 |
+
|
| 846 |
+
if(config.accordion.enabled) css.accordion = `
|
| 847 |
+
.accordion-header { width: 100%; text-align: left; padding: 1rem 1.5rem; background-color: #fff; border: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
|
| 848 |
+
.accordion-header:hover { background-color: #f9fafb; }
|
| 849 |
+
.accordion-content { max-height: 0; overflow: hidden; transition: max-height 0.3s ease-in-out; }
|
| 850 |
+
.accordion-content-inner { padding: 1.5rem; }
|
| 851 |
+
.accordion-header[aria-expanded="true"] + .accordion-content { max-height: 500px; }
|
| 852 |
+
.accordion-icon { transition: transform 0.3s ease; }
|
| 853 |
+
.accordion-header[aria-expanded="true"] .accordion-icon[data-icon-style="plus-minus"] { transform: rotate(45deg); }
|
| 854 |
+
.accordion-icon[data-icon-style$="plus-minus"]::before, .accordion-icon[data-icon-style$="plus-minus"]::after { content: ''; position: absolute; width: 12px; height: 2px; background-color: currentColor; }
|
| 855 |
+
.accordion-icon[data-icon-style$="plus-minus"]::after { transform: rotate(90deg); }
|
| 856 |
+
.accordion-header[aria-expanded="true"] .accordion-icon[data-icon-style="plus-minus"]::after { display: none; }
|
| 857 |
+
/* ... other icon styles ... */`;
|
| 858 |
+
|
| 859 |
+
if (targetKey) { return { global: css.global, component: css[targetKey] || '' } }
|
| 860 |
+
return css;
|
| 861 |
+
}
|
| 862 |
+
|
| 863 |
+
function getFullCSS() {
|
| 864 |
+
const cssObject = generateComponentCSS();
|
| 865 |
+
return [cssObject.global, ...Object.values(cssObject).filter(c => c !== cssObject.global)].join('\n');
|
| 866 |
+
}
|
| 867 |
+
|
| 868 |
+
function generateComponentJavaScript(targetKey = null) {
|
| 869 |
+
const js = {};
|
| 870 |
+
if (config.imageSlider.enabled) { js.imageSlider = generateImageSliderJS(); }
|
| 871 |
+
if (config.accordion.enabled) { js.accordion = generateAccordionJS(); }
|
| 872 |
+
if (targetKey) { return js[targetKey] || ''; }
|
| 873 |
+
return js;
|
| 874 |
+
}
|
| 875 |
+
|
| 876 |
+
function getFullJS() { return config.componentOrder.map(key => (generateComponentJavaScript(key) || '')).filter(Boolean).join('\n\n'); }
|
| 877 |
+
|
| 878 |
+
function generateImageSliderJS() {
|
| 879 |
+
if (!config.imageSlider.enabled) return '';
|
| 880 |
+
const { settings } = config.imageSlider;
|
| 881 |
+
let thumbsSwiperJs = '';
|
| 882 |
+
let mainSwiperOptions = {};
|
| 883 |
+
|
| 884 |
+
if (settings.showThumbnails) {
|
| 885 |
+
thumbsSwiperJs = `
|
| 886 |
+
const thumbsSwiper = new Swiper('.gallery-thumbs', {
|
| 887 |
+
spaceBetween: 10,
|
| 888 |
+
slidesPerView: 4,
|
| 889 |
+
freeMode: true,
|
| 890 |
+
watchSlidesProgress: true,
|
| 891 |
+
});`;
|
| 892 |
+
mainSwiperOptions.thumbs = { swiper: 'thumbsSwiper' }; // Placeholder
|
| 893 |
+
}
|
| 894 |
+
|
| 895 |
+
mainSwiperOptions = {
|
| 896 |
+
...mainSwiperOptions,
|
| 897 |
+
spaceBetween: 10,
|
| 898 |
+
speed: settings.speed, loop: settings.loop, effect: settings.effect,
|
| 899 |
+
slidesPerView: settings.slidesPerView, centeredSlides: settings.centeredSlides,
|
| 900 |
+
};
|
| 901 |
+
|
| 902 |
+
if (settings.autoplay) { mainSwiperOptions.autoplay = { delay: settings.delay, disableOnInteraction: !settings.pauseOnHover, pauseOnMouseEnter: settings.pauseOnHover, }; }
|
| 903 |
+
if (settings.showPagination) { mainSwiperOptions.pagination = { el: '#swiper-pagination-dots', clickable: true }; }
|
| 904 |
+
if (settings.showProgressBar) { mainSwiperOptions.pagination = { ...mainSwiperOptions.pagination, el: '#swiper-pagination-progressbar', type: 'progressbar' }; }
|
| 905 |
+
if (settings.showArrows) { mainSwiperOptions.navigation = { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev' }; }
|
| 906 |
+
if (settings.showScrollbar) { mainSwiperOptions.scrollbar = { el: '.swiper-scrollbar', hide: true }; }
|
| 907 |
+
if (settings.keyboardControl) { mainSwiperOptions.keyboard = { enabled: true }; }
|
| 908 |
+
if (settings.lazyLoad) { mainSwiperOptions.lazy = { loadPrevNext: true }; }
|
| 909 |
+
if (settings.accessibility) { mainSwiperOptions.a11y = { prevSlideMessage: 'Previous slide', nextSlideMessage: 'Next slide' }; }
|
| 910 |
+
|
| 911 |
+
let mainSwiperJs = `const mainSwiper = new Swiper('.gallery-main', ${JSON.stringify(mainSwiperOptions).replace('"thumbsSwiper"', 'thumbsSwiper')});`;
|
| 912 |
+
|
| 913 |
+
return thumbsSwiperJs + '\n' + mainSwiperJs;
|
| 914 |
+
}
|
| 915 |
+
|
| 916 |
+
function generateAccordionJS() {
|
| 917 |
+
if (!config.accordion.enabled) return '';
|
| 918 |
+
return `
|
| 919 |
+
const accordionItems = document.querySelectorAll('.accordion-header');
|
| 920 |
+
accordionItems.forEach(item => {
|
| 921 |
+
item.addEventListener('click', () => {
|
| 922 |
+
const currentlyExpanded = item.getAttribute('aria-expanded') === 'true';
|
| 923 |
+
if (!${config.accordion.allowMultipleOpen}) {
|
| 924 |
+
accordionItems.forEach(otherItem => {
|
| 925 |
+
if (otherItem !== item) otherItem.setAttribute('aria-expanded', 'false');
|
| 926 |
+
});
|
| 927 |
+
}
|
| 928 |
+
item.setAttribute('aria-expanded', String(!currentlyExpanded));
|
| 929 |
+
});
|
| 930 |
+
});`;
|
| 931 |
+
}
|
| 932 |
+
|
| 933 |
+
function getCombinedCode() { /* Unchanged but works with new code */ return `<!DOCTYPE html>...`; }
|
| 934 |
+
function renderAll() {
|
| 935 |
+
const fullJs = getFullJS();
|
| 936 |
+
const previewContent = `<!DOCTYPE html><html><head><title>Preview</title><script src="https://cdn.tailwindcss.com"><\/script><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css"><link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.min.css" /><style>${getFullCSS()}</style></head><body><div class="site-wrapper">${getAllHtml()}</div><script src="https://unpkg.com/swiper/swiper-bundle.min.js"><\/script><script>document.addEventListener('DOMContentLoaded', () => { \n${fullJs} \n});<\/script></body></html>`;
|
| 937 |
+
ui.previewIframe.srcdoc = previewContent;
|
| 938 |
+
}
|
| 939 |
+
|
| 940 |
+
// --- Component Specific Functions ---
|
| 941 |
+
function setupImageSliderEventListeners() {
|
| 942 |
+
const s = ui.imageSlider;
|
| 943 |
+
const settings = config.imageSlider.settings;
|
| 944 |
+
// Simplified example for one checkbox
|
| 945 |
+
s.autoplay.addEventListener('change', e => { settings.autoplay = e.target.checked; renderAll(); });
|
| 946 |
+
s.thumbnails.addEventListener('change', e => { settings.showThumbnails = e.target.checked; renderAll(); });
|
| 947 |
+
s.lazyload.addEventListener('change', e => { settings.lazyLoad = e.target.checked; renderAll(); });
|
| 948 |
+
s.progressbar.addEventListener('change', e => { settings.showProgressBar = e.target.checked; renderAll(); });
|
| 949 |
+
s.keyboard.addEventListener('change', e => { settings.keyboardControl = e.target.checked; renderAll(); });
|
| 950 |
+
s.a11y.addEventListener('change', e => { settings.accessibility = e.target.checked; renderAll(); });
|
| 951 |
+
|
| 952 |
+
s.addSlideBtn.addEventListener('click', () => {
|
| 953 |
+
config.imageSlider.slides.push({ id: Date.now(), type: 'image', imageUrl: 'https://via.placeholder.com/1280x720', videoUrl: '', posterUrl: '', title: 'New Slide', caption: 'Edit this.', link: '#' });
|
| 954 |
+
renderSliderSlideControls(); renderAll();
|
| 955 |
+
});
|
| 956 |
+
s.slidesContainer.addEventListener('click', e => {
|
| 957 |
+
const button = e.target.closest('button.remove-slide-btn');
|
| 958 |
+
if (!button) return;
|
| 959 |
+
config.imageSlider.slides = config.imageSlider.slides.filter(slide => slide.id !== parseInt(button.closest('.component-item-controls').dataset.id));
|
| 960 |
+
renderSliderSlideControls(); renderAll();
|
| 961 |
+
});
|
| 962 |
+
s.slidesContainer.addEventListener('input, change', e => {
|
| 963 |
+
const input = e.target;
|
| 964 |
+
const slide = config.imageSlider.slides.find(s => s.id === parseInt(input.closest('.component-item-controls').dataset.id));
|
| 965 |
+
if (slide) {
|
| 966 |
+
slide[input.dataset.key] = input.value;
|
| 967 |
+
if (input.dataset.key === 'type') {
|
| 968 |
+
renderSliderSlideControls(); // Re-render to show/hide fields
|
| 969 |
+
}
|
| 970 |
+
renderAll();
|
| 971 |
+
}
|
| 972 |
+
});
|
| 973 |
+
}
|
| 974 |
+
function renderSliderSlideControls() {
|
| 975 |
+
ui.imageSlider.slidesContainer.innerHTML = config.imageSlider.slides.map(slide => {
|
| 976 |
+
const isImage = slide.type === 'image';
|
| 977 |
+
return `
|
| 978 |
+
<div class="component-item-controls space-y-2 text-xs" data-id="${slide.id}">
|
| 979 |
+
<div class="flex items-center justify-between">
|
| 980 |
+
<select class="p-1 border rounded-md" data-key="type">
|
| 981 |
+
<option value="image" ${isImage ? 'selected' : ''}>Image</option>
|
| 982 |
+
<option value="video" ${!isImage ? 'selected' : ''}>Video</option>
|
| 983 |
+
</select>
|
| 984 |
+
<button class="remove-slide-btn text-red-500 p-1"><i class="fas fa-trash-alt"></i></button>
|
| 985 |
+
</div>
|
| 986 |
+
<div class="space-y-2 image-fields" style="display: ${isImage ? 'block' : 'none'};">
|
| 987 |
+
<div><label>Image URL</label><input type="text" class="w-full p-1 border" data-key="imageUrl" value="${slide.imageUrl}"></div>
|
| 988 |
+
</div>
|
| 989 |
+
<div class="space-y-2 video-fields" style="display: ${!isImage ? 'block' : 'none'};">
|
| 990 |
+
<div><label>Video URL (.mp4)</label><input type="text" class="w-full p-1 border" data-key="videoUrl" value="${slide.videoUrl}"></div>
|
| 991 |
+
<div><label>Poster Image URL</label><input type="text" class="w-full p-1 border" data-key="posterUrl" value="${slide.posterUrl}"></div>
|
| 992 |
+
</div>
|
| 993 |
+
<div><label>Title</label><input type="text" class="w-full p-1 border" data-key="title" value="${slide.title}"></div>
|
| 994 |
+
<div><label>Caption</label><input type="text" class="w-full p-1 border" data-key="caption" value="${slide.caption}"></div>
|
| 995 |
+
</div>`
|
| 996 |
+
}).join('');
|
| 997 |
+
}
|
| 998 |
+
|
| 999 |
+
function setupAccordionEventListeners() { /* Unchanged */ }
|
| 1000 |
+
function renderAccordionItemControls() { /* Unchanged */ }
|
| 1001 |
+
|
| 1002 |
+
// Initial Load
|
| 1003 |
+
function init() {
|
| 1004 |
+
// Init Global Settings
|
| 1005 |
+
|
| 1006 |
+
// Init Image Slider
|
| 1007 |
+
const s = ui.imageSlider;
|
| 1008 |
+
const settings = config.imageSlider.settings;
|
| 1009 |
+
s.toggle.checked = config.imageSlider.enabled;
|
| 1010 |
+
s.autoplay.checked = settings.autoplay;
|
| 1011 |
+
s.thumbnails.checked = settings.showThumbnails;
|
| 1012 |
+
s.lazyload.checked = settings.lazyLoad;
|
| 1013 |
+
s.progressbar.checked = settings.showProgressBar;
|
| 1014 |
+
s.keyboard.checked = settings.keyboardControl;
|
| 1015 |
+
s.a11y.checked = settings.accessibility;
|
| 1016 |
+
renderSliderSlideControls();
|
| 1017 |
+
|
| 1018 |
+
// Init Accordion
|
| 1019 |
+
renderAccordionItemControls();
|
| 1020 |
+
|
| 1021 |
+
setupEventListeners();
|
| 1022 |
+
renderLayoutControls();
|
| 1023 |
+
renderAll();
|
| 1024 |
+
if(!document.querySelector('.control-nav-button.active')){
|
| 1025 |
+
ui.controls.nav.querySelector('.control-nav-button').click();
|
| 1026 |
+
}
|
| 1027 |
+
}
|
| 1028 |
+
|
| 1029 |
+
init();
|
| 1030 |
+
});
|
| 1031 |
+
</script>
|
| 1032 |
+
</body>
|
| 1033 |
+
</html>
|