asiriagent commited on
Commit
455f785
·
verified ·
1 Parent(s): 51f2c9a

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. index.html +788 -459
index.html CHANGED
@@ -1,500 +1,829 @@
1
  <!DOCTYPE html>
2
  <html lang="fa" dir="rtl">
 
3
  <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>بساز | UI Builder</title>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
- <!-- Google Fonts: Vazirmatn for Persian support -->
9
- <link href="https://fonts.googleapis.com/css2?family=Vazirmatn:wght@100..900&display=swap" rel="stylesheet">
10
- <!-- FontAwesome for Icons -->
11
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
12
-
13
- <style>
14
- :root {
15
- /* App Theme Colors */
16
- --bg-color: #0f172a;
17
- --panel-bg: #1e293b;
18
- --text-color: #f8fafc;
19
- --accent-color: #38bdf8;
20
- --border-color: #334155;
21
-
22
- /* Dynamic Builder Variables (Defaults) */
23
- --card-bg: rgba(255, 255, 255, 0.1);
24
- --card-border: rgba(255, 255, 255, 0.2);
25
- --card-blur: 10px;
26
- --card-radius: 20px;
27
- --card-padding: 24px;
28
- --text-color-card: #ffffff;
29
- --btn-bg: #38bdf8;
30
- --btn-text: #0f172a;
31
- }
32
-
33
- * {
34
- box-sizing: border-box;
35
- margin: 0;
36
- padding: 0;
37
- outline: none;
38
- }
39
-
40
- body {
41
- font-family: 'Vazirmatn', sans-serif;
42
- background-color: var(--bg-color);
43
- color: var(--text-color);
44
- height: 100vh;
45
- overflow: hidden;
46
- display: flex;
47
- flex-direction: column;
48
- }
49
-
50
- /* Animated Background */
51
- .background-animation {
52
- position: absolute;
53
- top: 0;
54
- left: 0;
55
- width: 100%;
56
- height: 100%;
57
- z-index: -1;
58
- background: linear-gradient(-45deg, #0f172a, #1e1b4b, #312e81, #0f172a);
59
- background-size: 400% 400%;
60
- animation: gradientBG 15s ease infinite;
61
- }
62
-
63
- @keyframes gradientBG {
64
- 0% { background-position: 0% 50%; }
65
- 50% { background-position: 100% 50%; }
66
- 100% { background-position: 0% 50%; }
67
- }
68
-
69
- /* Header */
70
- header {
71
- height: 70px;
72
- border-bottom: 1px solid var(--border-color);
73
- display: flex;
74
- align-items: center;
75
- justify-content: space-between;
76
- padding: 0 30px;
77
- background: rgba(15, 23, 42, 0.8);
78
- backdrop-filter: blur(10px);
79
- z-index: 10;
80
- }
81
-
82
- .logo {
83
- font-size: 1.5rem;
84
- font-weight: 900;
85
- background: linear-gradient(to right, #38bdf8, #818cf8);
86
- -webkit-background-clip: text;
87
- -webkit-text-fill-color: transparent;
88
- }
89
-
90
- .anycoder-link {
91
- font-size: 0.9rem;
92
- text-decoration: none;
93
- color: var(--text-color);
94
- opacity: 0.7;
95
- transition: 0.3s;
96
- display: flex;
97
- align-items: center;
98
- gap: 8px;
99
- }
100
-
101
- .anycoder-link:hover {
102
- opacity: 1;
103
- color: var(--accent-color);
104
- }
105
-
106
- /* Main Layout */
107
- main {
108
- display: flex;
109
- height: calc(100vh - 70px);
110
- }
111
-
112
- /* Sidebar (Controls) */
113
- aside {
114
- width: 350px;
115
- background: var(--panel-bg);
116
- border-left: 1px solid var(--border-color);
117
- padding: 20px;
118
- overflow-y: auto;
119
- display: flex;
120
- flex-direction: column;
121
- gap: 25px;
122
- box-shadow: -5px 0 15px rgba(0,0,0,0.3);
123
- }
124
-
125
- h2 {
126
- font-size: 1.1rem;
127
- margin-bottom: 15px;
128
- color: var(--accent-color);
129
- border-bottom: 2px solid var(--border-color);
130
- padding-bottom: 10px;
131
- }
132
-
133
- .control-group {
134
- display: flex;
135
- flex-direction: column;
136
- gap: 10px;
137
- }
138
-
139
- label {
140
- font-size: 0.9rem;
141
- font-weight: 500;
142
- }
143
-
144
- /* Styled Inputs */
145
- input[type="text"], textarea, select {
146
- background: var(--bg-color);
147
- border: 1px solid var(--border-color);
148
- color: white;
149
- padding: 10px;
150
- border-radius: 8px;
151
- font-family: inherit;
152
- width: 100%;
153
- transition: 0.3s;
154
- }
155
-
156
- input[type="text"]:focus, textarea:focus {
157
- border-color: var(--accent-color);
158
- }
159
-
160
- input[type="color"] {
161
- width: 100%;
162
- height: 40px;
163
- border: none;
164
- background: transparent;
165
- cursor: pointer;
166
- }
167
-
168
- input[type="range"] {
169
- width: 100%;
170
- accent-color: var(--accent-color);
171
- cursor: pointer;
172
- }
173
-
174
- /* Preview Area */
175
- .preview-container {
176
- flex: 1;
177
- display: flex;
178
- align-items: center;
179
- justify-content: center;
180
- position: relative;
181
- background-image: radial-gradient(circle at 50% 50%, rgba(56, 189, 248, 0.1) 0%, transparent 50%);
182
- }
183
-
184
- /* The Generated Card (Live Preview) */
185
- #live-card {
186
- background: var(--card-bg);
187
- backdrop-filter: blur(var(--card-blur));
188
- -webkit-backdrop-filter: blur(var(--card-blur));
189
- border: 1px solid var(--card-border);
190
- border-radius: var(--card-radius);
191
- padding: var(--card-padding);
192
- width: 320px;
193
- text-align: center;
194
- color: var(--text-color-card);
195
- box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
196
- transition: all 0.3s ease;
197
- display: flex;
198
- flex-direction: column;
199
- align-items: center;
200
- gap: 15px;
201
- }
202
-
203
- #live-card img {
204
- width: 100px;
205
- height: 100px;
206
- border-radius: 50%;
207
- object-fit: cover;
208
- border: 3px solid var(--card-border);
209
- margin-bottom: 10px;
210
- }
211
-
212
- #live-card h3 {
213
- margin: 0;
214
- font-size: 1.5rem;
215
- }
216
-
217
- #live-card p {
218
- font-size: 0.9rem;
219
- line-height: 1.6;
220
- opacity: 0.9;
221
- margin: 0;
222
- }
223
-
224
- #live-card button {
225
- margin-top: 15px;
226
- padding: 10px 25px;
227
- background: var(--btn-bg);
228
- color: var(--btn-text);
229
- border: none;
230
- border-radius: 50px;
231
- font-weight: bold;
232
- cursor: pointer;
233
- font-family: inherit;
234
- transition: transform 0.2s;
235
- }
236
-
237
- #live-card button:hover {
238
- transform: scale(1.05);
239
- }
240
-
241
- /* Code Output Section */
242
- .code-section {
243
- margin-top: auto;
244
- border-top: 1px solid var(--border-color);
245
- padding-top: 20px;
246
- }
247
-
248
- textarea.code-output {
249
- height: 150px;
250
- font-family: monospace;
251
- font-size: 0.8rem;
252
- resize: none;
253
- background: #0f172a;
254
- color: #a5b4fc;
255
- }
256
-
257
- .btn-action {
258
- width: 100%;
259
- padding: 12px;
260
- background: var(--accent-color);
261
- color: #0f172a;
262
- border: none;
263
- border-radius: 8px;
264
- font-weight: bold;
265
- cursor: pointer;
266
- margin-top: 10px;
267
- transition: 0.3s;
268
- }
269
-
270
- .btn-action:hover {
271
- filter: brightness(1.1);
272
- }
273
-
274
- /* Responsive */
275
- @media (max-width: 768px) {
276
- body {
277
- overflow: auto;
278
- height: auto;
279
- }
280
- main {
281
- flex-direction: column;
282
- height: auto;
283
- }
284
- aside {
285
- width: 100%;
286
- border-left: none;
287
- border-bottom: 1px solid var(--border-color);
288
- }
289
- .preview-container {
290
- padding: 50px 20px;
291
- min-height: 400px;
292
- }
293
- }
294
- </style>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
295
  </head>
296
- <body>
297
 
298
- <div class="background-animation"></div>
299
-
300
- <header>
301
- <div class="logo">بساز <i class="fa-solid fa-hammer"></i></div>
302
- <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" class="anycoder-link">
303
- Built with Anycoder <i class="fa-solid fa-code"></i>
304
- </a>
305
- </header>
306
-
307
- <main>
308
- <!-- Sidebar Controls -->
309
- <aside>
310
- <h2><i class="fa-solid fa-sliders"></i> تنظیمات کارت</h2>
311
-
312
- <!-- Text Content -->
313
- <div class="control-group">
314
- <label>عنوان</label>
315
- <input type="text" id="input-title" value="عنوان دلخواه">
316
- </div>
317
-
318
- <div class="control-group">
319
- <label>توضیحات</label>
320
- <textarea id="input-desc" rows="3">این یک متن نمونه برای کارت زیبای شماست. می‌توانید این متن را تغییر دهید.</textarea>
321
- </div>
322
-
323
- <!-- Styling -->
324
- <div class="control-group">
325
- <label>رنگ پس‌زمینه کارت</label>
326
- <input type="color" id="input-bg" value="#ffffff" data-opacity="0.1">
327
- </div>
328
 
329
- <div class="control-group">
330
- <label>رنگ حاشیه کارت</label>
331
- <input type="color" id="input-border" value="#ffffff" data-opacity="0.2">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
332
  </div>
 
 
333
 
334
- <div class="control-group">
335
- <label>رنگ متن</label>
336
- <input type="color" id="input-text-color" value="#ffffff">
 
337
  </div>
 
 
338
 
339
- <div class="control-group">
340
- <label>شعاع حاشیه (Border Radius)</label>
341
- <input type="range" id="input-radius" min="0" max="50" value="20">
 
342
  </div>
343
-
344
- <div class="control-group">
345
- <label>میزان بلور (Glass Effect)</label>
346
- <input type="range" id="input-blur" min="0" max="50" value="10">
 
 
 
 
 
 
 
 
347
  </div>
 
 
348
 
349
- <div class="control-group">
350
- <label>رنگ دکمه</label>
351
- <input type="color" id="input-btn-color" value="#38bdf8">
 
352
  </div>
353
-
354
- <!-- Code Output -->
355
- <div class="code-section">
356
- <h2><i class="fa-solid fa-code"></i> کد خروجی</h2>
357
- <textarea id="code-output" class="code-output" readonly></textarea>
358
- <button class="btn-action" onclick="copyCode()">کپی کد <i class="fa-regular fa-copy"></i></button>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
359
  </div>
360
- </aside>
361
-
362
- <!-- Live Preview -->
363
- <section class="preview-container">
364
- <div id="live-card">
365
- <img src="https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?auto=format&fit=crop&w=500&q=80" alt="Profile">
366
- <h3 id="card-title">عنوان دلخواه</h3>
367
- <p id="card-desc">این یک متن نمونه برای کارت زیبای شماست. می‌توانید این متن را تغییر دهید.</p>
368
- <button>دکمه اکشن</button>
369
- </div>
370
- </section>
371
- </main>
372
-
373
- <script>
374
- // Select DOM Elements
375
- const inputs = {
376
- title: document.getElementById('input-title'),
377
- desc: document.getElementById('input-desc'),
378
- bg: document.getElementById('input-bg'),
379
- border: document.getElementById('input-border'),
380
- textColor: document.getElementById('input-text-color'),
381
- radius: document.getElementById('input-radius'),
382
- blur: document.getElementById('input-blur'),
383
- btnColor: document.getElementById('input-btn-color')
384
- };
385
-
386
- const card = {
387
- container: document.getElementById('live-card'),
388
- title: document.getElementById('card-title'),
389
- desc: document.getElementById('card-desc'),
390
- btn: document.querySelector('#live-card button')
391
- };
392
-
393
- const codeOutput = document.getElementById('code-output');
394
-
395
- // Helper to convert hex to rgba
396
- function hexToRgba(hex, opacity) {
397
- let r = 0, g = 0, b = 0;
398
- if (hex.length == 4) {
399
- r = "0x" + hex[1] + hex[1];
400
- g = "0x" + hex[2] + hex[2];
401
- b = "0x" + hex[3] + hex[3];
402
- } else if (hex.length == 7) {
403
- r = "0x" + hex[1] + hex[2];
404
- g = "0x" + hex[3] + hex[4];
405
- b = "0x" + hex[5] + hex[6];
406
- }
407
- return "rgba(" + +r + "," + +g + "," + +b + "," + opacity + ")";
408
- }
409
-
410
- // Update CSS Variables and Content
411
- function updateUI() {
412
- // Update Text
413
- card.title.textContent = inputs.title.value;
414
- card.desc.textContent = inputs.desc.value;
415
-
416
- // Update CSS Variables
417
- const bgColor = hexToRgba(inputs.bg.value, inputs.bg.getAttribute('data-opacity'));
418
- const borderColor = hexToRgba(inputs.border.value, inputs.border.getAttribute('data-opacity'));
419
-
420
- card.container.style.setProperty('--card-bg', bgColor);
421
- card.container.style.setProperty('--card-border', borderColor);
422
- card.container.style.setProperty('--card-radius', inputs.radius.value + 'px');
423
- card.container.style.setProperty('--card-blur', inputs.blur.value + 'px');
424
- card.container.style.setProperty('--text-color-card', inputs.textColor.value);
425
- card.btn.style.setProperty('background', inputs.btnColor.value);
426
-
427
- generateCode();
428
- }
429
-
430
- // Generate HTML/CSS Code
431
- function generateCode() {
432
- const bgColor = hexToRgba(inputs.bg.value, inputs.bg.getAttribute('data-opacity'));
433
- const borderColor = hexToRgba(inputs.border.value, inputs.border.getAttribute('data-opacity'));
434
-
435
- const code = `
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
436
  <!-- Glassmorphism Card -->
437
  <style>
438
  .glass-card {
439
- background: ${bgColor};
 
 
 
 
 
 
 
440
  backdrop-filter: blur(${inputs.blur.value}px);
441
  -webkit-backdrop-filter: blur(${inputs.blur.value}px);
442
- border: 1px solid ${borderColor};
443
- border-radius: ${inputs.radius.value}px;
444
- padding: 24px;
445
- width: 320px;
446
- text-align: center;
447
- color: ${inputs.textColor.value};
448
- font-family: sans-serif;
449
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
 
 
 
 
 
 
 
 
 
 
 
450
  }
 
451
  .glass-card img {
452
  width: 100px;
453
  height: 100px;
454
  border-radius: 50%;
455
  object-fit: cover;
456
- margin-bottom: 15px;
457
  }
 
458
  .glass-card button {
459
- margin-top: 15px;
460
- padding: 10px 25px;
461
- background: ${inputs.btnColor.value};
462
- color: #fff; /* Assuming white text on button, or adjust */
463
  border: none;
464
- border-radius: 50px;
 
465
  cursor: pointer;
 
 
 
 
 
466
  }
467
  </style>
468
 
469
  <div class="glass-card">
470
- <img src="image-url.jpg" alt="Profile">
471
  <h3>${inputs.title.value}</h3>
472
  <p>${inputs.desc.value}</p>
473
- <button>دکمه اکشن</button>
474
  </div>
475
- `;
476
- codeOutput.value = code.trim();
477
- }
478
-
479
- // Copy to Clipboard
480
- function copyCode() {
481
- codeOutput.select();
482
- document.execCommand('copy');
483
- const originalText = document.querySelector('.btn-action').innerHTML;
484
- document.querySelector('.btn-action').innerHTML = 'کپی شد! <i class="fa-solid fa-check"></i>';
485
- setTimeout(() => {
486
- document.querySelector('.btn-action').innerHTML = originalText;
487
- }, 2000);
488
- }
489
-
490
- // Event Listeners
491
- Object.values(inputs).forEach(input => {
492
- input.addEventListener('input', updateUI);
493
- });
494
-
495
- // Initialize
496
- updateUI();
497
-
498
- </script>
 
499
  </body>
 
500
  </html>
 
1
  <!DOCTYPE html>
2
  <html lang="fa" dir="rtl">
3
+
4
  <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>بساز | UI Builder حرفه‌ای</title>
8
+
9
+ <!-- Fonts & Icons -->
10
+ <link href="https://fonts.googleapis.com/css2?family=Vazirmatn:wght@100..900&display=swap" rel="stylesheet">
11
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
12
+
13
+ <style>
14
+ /*
15
+ ---------------------------------------------------------
16
+ Core Variables & Reset
17
+ ---------------------------------------------------------
18
+ */
19
+ :root {
20
+ /* App Theme Colors */
21
+ --app-bg: #0f172a;
22
+ --panel-bg: #1e293b;
23
+ --panel-border: #334155;
24
+ --text-main: #f8fafc;
25
+ --text-muted: #94a3b8;
26
+ --accent: #38bdf8;
27
+ --accent-hover: #0ea5e9;
28
+ --danger: #ef4444;
29
+
30
+ /* Card Defaults */
31
+ --card-bg: rgba(255, 255, 255, 0.05);
32
+ --card-border: rgba(255, 255, 255, 0.1);
33
+ --card-blur: 12px;
34
+ --card-radius: 24px;
35
+ --card-padding: 32px;
36
+ --card-width: 340px;
37
+ --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
38
+ --card-text: #ffffff;
39
+ --card-img-radius: 50%;
40
+
41
+ /* Button Defaults */
42
+ --btn-bg: #38bdf8;
43
+ --btn-text: #0f172a;
44
+ --btn-radius: 50px;
45
+ --btn-padding: 12px 24px;
46
+
47
+ /* Font */
48
+ --font-main: 'Vazirmatn', sans-serif;
49
+ }
50
+
51
+ * {
52
+ box-sizing: border-box;
53
+ margin: 0;
54
+ padding: 0;
55
+ }
56
+
57
+ body {
58
+ font-family: var(--font-main);
59
+ background-color: var(--app-bg);
60
+ color: var(--text-main);
61
+ height: 100vh;
62
+ overflow: hidden;
63
+ display: flex;
64
+ flex-direction: column;
65
+ }
66
+
67
+ /*
68
+ ---------------------------------------------------------
69
+ Background & Effects
70
+ ---------------------------------------------------------
71
+ */
72
+ .bg-mesh {
73
+ position: absolute;
74
+ top: 0;
75
+ left: 0;
76
+ width: 100%;
77
+ height: 100%;
78
+ z-index: -1;
79
+ overflow: hidden;
80
+ background: radial-gradient(circle at 15% 50%, rgba(56, 189, 248, 0.15), transparent 25%),
81
+ radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.15), transparent 25%);
82
+ }
83
+
84
+ .orb {
85
+ position: absolute;
86
+ border-radius: 50%;
87
+ filter: blur(80px);
88
+ opacity: 0.4;
89
+ animation: float 10s infinite ease-in-out alternate;
90
+ }
91
+
92
+ .orb-1 { width: 300px; height: 300px; background: #38bdf8; top: -50px; left: -50px; }
93
+ .orb-2 { width: 400px; height: 400px; background: #818cf8; bottom: -100px; right: -100px; animation-delay: -5s; }
94
+
95
+ @keyframes float {
96
+ 0% { transform: translate(0, 0); }
97
+ 100% { transform: translate(30px, 50px); }
98
+ }
99
+
100
+ /*
101
+ ---------------------------------------------------------
102
+ Header
103
+ ---------------------------------------------------------
104
+ */
105
+ header {
106
+ height: 70px;
107
+ border-bottom: 1px solid var(--panel-border);
108
+ display: flex;
109
+ align-items: center;
110
+ justify-content: space-between;
111
+ padding: 0 30px;
112
+ background: rgba(15, 23, 42, 0.7);
113
+ backdrop-filter: blur(12px);
114
+ z-index: 100;
115
+ }
116
+
117
+ .brand {
118
+ display: flex;
119
+ align-items: center;
120
+ gap: 12px;
121
+ font-size: 1.6rem;
122
+ font-weight: 900;
123
+ background: linear-gradient(135deg, #fff, #94a3b8);
124
+ -webkit-background-clip: text;
125
+ -webkit-text-fill-color: transparent;
126
+ }
127
 
128
+ .brand i { -webkit-text-fill-color: var(--accent); }
129
+
130
+ .header-actions {
131
+ display: flex;
132
+ gap: 15px;
133
+ }
134
+
135
+ .anycoder-link {
136
+ text-decoration: none;
137
+ color: var(--text-muted);
138
+ font-size: 0.9rem;
139
+ display: flex;
140
+ align-items: center;
141
+ gap: 8px;
142
+ transition: 0.3s;
143
+ padding: 8px 16px;
144
+ border-radius: 12px;
145
+ background: rgba(255,255,255,0.05);
146
+ }
147
+
148
+ .anycoder-link:hover {
149
+ color: var(--accent);
150
+ background: rgba(255,255,255,0.1);
151
+ }
152
+
153
+ /*
154
+ ---------------------------------------------------------
155
+ Main Layout
156
+ ---------------------------------------------------------
157
+ */
158
+ main {
159
+ display: flex;
160
+ flex: 1;
161
+ height: calc(100vh - 70px);
162
+ overflow: hidden;
163
+ }
164
+
165
+ /*
166
+ ---------------------------------------------------------
167
+ Sidebar (Controls)
168
+ ---------------------------------------------------------
169
+ */
170
+ aside {
171
+ width: 380px;
172
+ background: var(--panel-bg);
173
+ border-left: 1px solid var(--panel-border);
174
+ display: flex;
175
+ flex-direction: column;
176
+ overflow: hidden;
177
+ box-shadow: -10px 0 30px rgba(0,0,0,0.2);
178
+ z-index: 10;
179
+ }
180
+
181
+ .sidebar-header {
182
+ padding: 20px;
183
+ border-bottom: 1px solid var(--panel-border);
184
+ font-weight: bold;
185
+ color: var(--accent);
186
+ display: flex;
187
+ justify-content: space-between;
188
+ align-items: center;
189
+ }
190
+
191
+ .scroll-area {
192
+ flex: 1;
193
+ overflow-y: auto;
194
+ padding: 20px;
195
+ display: flex;
196
+ flex-direction: column;
197
+ gap: 25px;
198
+ }
199
+
200
+ /* Custom Scrollbar */
201
+ .scroll-area::-webkit-scrollbar { width: 6px; }
202
+ .scroll-area::-webkit-scrollbar-track { background: transparent; }
203
+ .scroll-area::-webkit-scrollbar-thumb { background: var(--panel-border); border-radius: 10px; }
204
+ .scroll-area::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
205
+
206
+ .control-section h3 {
207
+ font-size: 0.85rem;
208
+ text-transform: uppercase;
209
+ letter-spacing: 1px;
210
+ color: var(--text-muted);
211
+ margin-bottom: 15px;
212
+ display: flex;
213
+ align-items: center;
214
+ gap: 8px;
215
+ }
216
+
217
+ .input-group {
218
+ margin-bottom: 18px;
219
+ }
220
+
221
+ .input-row {
222
+ display: flex;
223
+ align-items: center;
224
+ justify-content: space-between;
225
+ margin-bottom: 8px;
226
+ }
227
+
228
+ label {
229
+ font-size: 0.9rem;
230
+ color: var(--text-main);
231
+ }
232
+
233
+ .value-display {
234
+ font-size: 0.8rem;
235
+ color: var(--text-muted);
236
+ font-family: monospace;
237
+ background: rgba(0,0,0,0.2);
238
+ padding: 2px 6px;
239
+ border-radius: 4px;
240
+ }
241
+
242
+ /* Modern Inputs */
243
+ input[type="text"],
244
+ textarea,
245
+ input[type="url"] {
246
+ width: 100%;
247
+ background: rgba(15, 23, 42, 0.6);
248
+ border: 1px solid var(--panel-border);
249
+ color: white;
250
+ padding: 10px 12px;
251
+ border-radius: 8px;
252
+ font-family: inherit;
253
+ font-size: 0.95rem;
254
+ transition: 0.2s;
255
+ }
256
+
257
+ input[type="text"]:focus,
258
+ textarea:focus,
259
+ input[type="url"]:focus {
260
+ border-color: var(--accent);
261
+ box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
262
+ }
263
+
264
+ textarea { resize: vertical; min-height: 80px; }
265
+
266
+ input[type="color"] {
267
+ -webkit-appearance: none;
268
+ border: none;
269
+ width: 32px;
270
+ height: 32px;
271
+ border-radius: 8px;
272
+ cursor: pointer;
273
+ background: none;
274
+ padding: 0;
275
+ }
276
+ input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
277
+ input[type="color"]::-webkit-color-swatch { border: 1px solid var(--panel-border); border-radius: 8px; }
278
+
279
+ input[type="range"] {
280
+ width: 100%;
281
+ height: 6px;
282
+ background: rgba(255,255,255,0.1);
283
+ border-radius: 5px;
284
+ outline: none;
285
+ -webkit-appearance: none;
286
+ }
287
+
288
+ input[type="range"]::-webkit-slider-thumb {
289
+ -webkit-appearance: none;
290
+ width: 18px;
291
+ height: 18px;
292
+ border-radius: 50%;
293
+ background: var(--accent);
294
+ cursor: pointer;
295
+ transition: 0.2s;
296
+ }
297
+ input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }
298
+
299
+ /*
300
+ ---------------------------------------------------------
301
+ Preview Area
302
+ ---------------------------------------------------------
303
+ */
304
+ .preview-stage {
305
+ flex: 1;
306
+ display: flex;
307
+ align-items: center;
308
+ justify-content: center;
309
+ position: relative;
310
+ perspective: 1000px;
311
+ overflow: hidden;
312
+ /* Optional: Checkerboard for transparency check */
313
+ background-image:
314
+ linear-gradient(45deg, rgba(255,255,255,0.03) 25%, transparent 25%),
315
+ linear-gradient(-45deg, rgba(255,255,255,0.03) 25%, transparent 25%),
316
+ linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.03) 75%),
317
+ linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.03) 75%);
318
+ background-size: 20px 20px;
319
+ }
320
+
321
+ /* Floating Elements for Depth */
322
+ .floating-shape {
323
+ position: absolute;
324
+ border-radius: 50%;
325
+ background: rgba(255,255,255,0.1);
326
+ z-index: 0;
327
+ }
328
+ .shape-1 { width: 200px; height: 200px; top: 20%; left: 20%; background: rgba(56, 189, 248, 0.2); filter: blur(40px); animation: float 8s infinite ease-in-out; }
329
+ .shape-2 { width: 150px; height: 150px; bottom: 30%; right: 20%; background: rgba(139, 92, 246, 0.2); filter: blur(40px); animation: float 12s infinite ease-in-out reverse; }
330
+
331
+ /* The Card */
332
+ #glass-card {
333
+ background: var(--card-bg);
334
+ backdrop-filter: blur(var(--card-blur));
335
+ -webkit-backdrop-filter: blur(var(--card-blur));
336
+ border: 1px solid var(--card-border);
337
+ border-radius: var(--card-radius);
338
+ padding: var(--card-padding);
339
+ width: var(--card-width);
340
+ max-width: 90%;
341
+ color: var(--card-text);
342
+ box-shadow: var(--card-shadow);
343
+ display: flex;
344
+ flex-direction: column;
345
+ align-items: center;
346
+ text-align: center;
347
+ gap: 16px;
348
+ position: relative;
349
+ z-index: 1;
350
+ transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
351
+ }
352
+
353
+ #glass-card img {
354
+ width: 100px;
355
+ height: 100px;
356
+ border-radius: var(--card-img-radius);
357
+ object-fit: cover;
358
+ border: 2px solid rgba(255,255,255,0.2);
359
+ transition: 0.3s;
360
+ }
361
+
362
+ #glass-card h3 { font-size: 1.5rem; margin: 0; font-weight: 700; }
363
+ #glass-card p { font-size: 0.95rem; line-height: 1.6; opacity: 0.9; margin: 0; }
364
+ #glass-card button {
365
+ margin-top: 10px;
366
+ background: var(--btn-bg);
367
+ color: var(--btn-text);
368
+ border: none;
369
+ padding: var(--btn-padding);
370
+ border-radius: var(--btn-radius);
371
+ font-weight: bold;
372
+ font-family: inherit;
373
+ cursor: pointer;
374
+ transition: 0.2s;
375
+ box-shadow: 0 4px 15px rgba(0,0,0,0.2);
376
+ }
377
+ #glass-card button:hover {
378
+ transform: translateY(-2px);
379
+ filter: brightness(1.1);
380
+ box-shadow: 0 6px 20px rgba(0,0,0,0.3);
381
+ }
382
+
383
+ /*
384
+ ---------------------------------------------------------
385
+ Code Panel (Bottom of Sidebar)
386
+ ---------------------------------------------------------
387
+ */
388
+ .code-panel {
389
+ background: #0f172a;
390
+ border-top: 1px solid var(--panel-border);
391
+ padding: 15px;
392
+ display: flex;
393
+ flex-direction: column;
394
+ gap: 10px;
395
+ }
396
+
397
+ .code-header {
398
+ display: flex;
399
+ justify-content: space-between;
400
+ align-items: center;
401
+ }
402
+
403
+ .code-output {
404
+ width: 100%;
405
+ height: 120px;
406
+ background: rgba(0,0,0,0.3);
407
+ border: 1px solid var(--panel-border);
408
+ border-radius: 8px;
409
+ color: #a5b4fc;
410
+ font-family: monospace;
411
+ font-size: 0.8rem;
412
+ padding: 10px;
413
+ resize: none;
414
+ }
415
+
416
+ .btn-copy {
417
+ width: 100%;
418
+ padding: 12px;
419
+ background: var(--accent);
420
+ color: #0f172a;
421
+ border: none;
422
+ border-radius: 8px;
423
+ font-weight: bold;
424
+ cursor: pointer;
425
+ display: flex;
426
+ align-items: center;
427
+ justify-content: center;
428
+ gap: 8px;
429
+ transition: 0.2s;
430
+ }
431
+
432
+ .btn-copy:hover { background: var(--accent-hover); }
433
+
434
+ .toast {
435
+ position: fixed;
436
+ bottom: 20px;
437
+ left: 50%;
438
+ transform: translateX(-50%) translateY(100px);
439
+ background: var(--accent);
440
+ color: #0f172a;
441
+ padding: 10px 20px;
442
+ border-radius: 30px;
443
+ font-weight: bold;
444
+ box-shadow: 0 10px 30px rgba(0,0,0,0.5);
445
+ transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
446
+ z-index: 1000;
447
+ display: flex;
448
+ align-items: center;
449
+ gap: 8px;
450
+ }
451
+
452
+ .toast.show { transform: translateX(-50%) translateY(0); }
453
+
454
+ /*
455
+ ---------------------------------------------------------
456
+ Responsive Design
457
+ ---------------------------------------------------------
458
+ */
459
+ @media (max-width: 900px) {
460
+ body { overflow: auto; height: auto; }
461
+ main { flex-direction: column; height: auto; }
462
+
463
+ aside {
464
+ width: 100%;
465
+ height: auto;
466
+ border-left: none;
467
+ border-bottom: 1px solid var(--panel-border);
468
+ }
469
+
470
+ .preview-stage {
471
+ min-height: 500px;
472
+ padding: 40px 20px;
473
+ }
474
+
475
+ .scroll-area {
476
+ max-height: 400px; /* Limit height on mobile sidebar */
477
+ }
478
+ }
479
+ </style>
480
  </head>
 
481
 
482
+ <body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
483
 
484
+ <!-- Background Animation -->
485
+ <div class="bg-mesh">
486
+ <div class="orb orb-1"></div>
487
+ <div class="orb orb-2"></div>
488
+ </div>
489
+
490
+ <header>
491
+ <div class="brand">
492
+ <i class="fa-solid fa-layer-group"></i>
493
+ بساز
494
+ </div>
495
+ <div class="header-actions">
496
+ <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" class="anycoder-link">
497
+ <span>Built with Anycoder</span>
498
+ <i class="fa-solid fa-code"></i>
499
+ </a>
500
+ </div>
501
+ </header>
502
+
503
+ <main>
504
+ <!-- Sidebar Controls -->
505
+ <aside>
506
+ <div class="sidebar-header">
507
+ <span>تنظیمات ظاهری</span>
508
+ <i class="fa-solid fa-sliders"></i>
509
+ </div>
510
+
511
+ <div class="scroll-area">
512
+
513
+ <!-- Section 1: Content -->
514
+ <div class="control-section">
515
+ <h3><i class="fa-solid fa-pen-to-square"></i> محتوا</h3>
516
+
517
+ <div class="input-group">
518
+ <label>تصویر پروفایل (URL)</label>
519
+ <input type="url" id="inp-img" value="https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?auto=format&fit=crop&w=500&q=80" placeholder="لینک عکس...">
520
+ </div>
521
+
522
+ <div class="input-group">
523
+ <label>عنوان</label>
524
+ <input type="text" id="inp-title" value="عنوان دلخواه شما">
525
+ </div>
526
+
527
+ <div class="input-group">
528
+ <label>توضیحات</label>
529
+ <textarea id="inp-desc">این یک متن نمونه برای کارت گلس‌مورفیسم است. می‌توانید این متن را به راحتی ویرایش کنید.</textarea>
530
+ </div>
531
+
532
+ <div class="input-group">
533
+ <label>متن دکمه</label>
534
+ <input type="text" id="inp-btn-text" value="شروع کنید">
535
+ </div>
536
+ </div>
537
+
538
+ <!-- Section 2: Glass Effect -->
539
+ <div class="control-section">
540
+ <h3><i class="fa-solid fa-wand-magic-sparkles"></i> افکت شیشه‌ای</h3>
541
+
542
+ <div class="input-group">
543
+ <div class="input-row">
544
+ <label>رنگ پس‌زمینه</label>
545
+ <input type="color" id="inp-color-bg" value="#ffffff">
546
  </div>
547
+ <input type="range" id="inp-opacity" min="0" max="1" step="0.05" value="0.1">
548
+ </div>
549
 
550
+ <div class="input-group">
551
+ <div class="input-row">
552
+ <label>رنگ حاشیه</label>
553
+ <input type="color" id="inp-color-border" value="#ffffff">
554
  </div>
555
+ <input type="range" id="inp-border-opacity" min="0" max="1" step="0.05" value="0.2">
556
+ </div>
557
 
558
+ <div class="input-group">
559
+ <div class="input-row">
560
+ <label>تاری پس‌زمینه (Blur)</label>
561
+ <span class="value-display" id="val-blur">12px</span>
562
  </div>
563
+ <input type="range" id="inp-blur" min="0" max="50" value="12">
564
+ </div>
565
+ </div>
566
+
567
+ <!-- Section 3: Shape & Layout -->
568
+ <div class="control-section">
569
+ <h3><i class="fa-solid fa-border-all"></i> ابعاد و شکل</h3>
570
+
571
+ <div class="input-group">
572
+ <div class="input-row">
573
+ <label>شعاع گوشه‌ها</label>
574
+ <span class="value-display" id="val-radius">24px</span>
575
  </div>
576
+ <input type="range" id="inp-radius" min="0" max="60" value="24">
577
+ </div>
578
 
579
+ <div class="input-group">
580
+ <div class="input-row">
581
+ <label>عرض کارت</label>
582
+ <span class="value-display" id="val-width">340px</span>
583
  </div>
584
+ <input type="range" id="inp-width" min="200" max="600" value="340">
585
+ </div>
586
+
587
+ <div class="input-group">
588
+ <label>رنگ متن</label>
589
+ <input type="color" id="inp-text-color" value="#ffffff">
590
+ </div>
591
+ </div>
592
+
593
+ <!-- Section 4: Button -->
594
+ <div class="control-section">
595
+ <h3><i class="fa-solid fa-hand-pointer"></i> استایل دکمه</h3>
596
+
597
+ <div class="input-group">
598
+ <label>رنگ دکمه</label>
599
+ <input type="color" id="inp-btn-bg" value="#38bdf8">
600
+ </div>
601
+
602
+ <div class="input-group">
603
+ <div class="input-row">
604
+ <label>شعاع دکمه</label>
605
+ <span class="value-display" id="val-btn-radius">50px</span>
606
  </div>
607
+ <input type="range" id="inp-btn-radius" min="0" max="50" value="50">
608
+ </div>
609
+ </div>
610
+
611
+ </div>
612
+
613
+ <!-- Code Output -->
614
+ <div class="code-panel">
615
+ <div class="code-header">
616
+ <label>کد خروجی HTML & CSS</label>
617
+ <i class="fa-solid fa-code" style="color: var(--text-muted)"></i>
618
+ </div>
619
+ <textarea id="code-output" class="code-output" readonly></textarea>
620
+ <button class="btn-copy" onclick="copyCode()">
621
+ <i class="fa-regular fa-copy"></i> کپی کد
622
+ </button>
623
+ </div>
624
+ </aside>
625
+
626
+ <!-- Live Preview -->
627
+ <section class="preview-stage">
628
+ <!-- Decorative Background Shapes -->
629
+ <div class="floating-shape shape-1"></div>
630
+ <div class="floating-shape shape-2"></div>
631
+
632
+ <!-- The Card -->
633
+ <div id="glass-card">
634
+ <img src="https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?auto=format&fit=crop&w=500&q=80" id="card-img" alt="Profile">
635
+ <h3 id="card-title">عنوان دلخواه شما</h3>
636
+ <p id="card-desc">این یک متن نمونه برای کارت گلس‌مورفیسم است. می‌توانید این متن را به راحتی ویرایش کنید.</p>
637
+ <button id="card-btn">شروع کنید</button>
638
+ </div>
639
+ </section>
640
+ </main>
641
+
642
+ <!-- Toast Notification -->
643
+ <div id="toast" class="toast">
644
+ <i class="fa-solid fa-check-circle"></i>
645
+ کد با موفقیت کپی شد!
646
+ </div>
647
+
648
+ <script>
649
+ // --- Configuration & Selectors ---
650
+ const inputs = {
651
+ title: document.getElementById('inp-title'),
652
+ desc: document.getElementById('inp-desc'),
653
+ img: document.getElementById('inp-img'),
654
+ btnText: document.getElementById('inp-btn-text'),
655
+
656
+ // Colors
657
+ bgColor: document.getElementById('inp-color-bg'),
658
+ bgOpacity: document.getElementById('inp-opacity'),
659
+ borderColor: document.getElementById('inp-color-border'),
660
+ borderOpacity: document.getElementById('inp-border-opacity'),
661
+ textColor: document.getElementById('inp-text-color'),
662
+ btnBg: document.getElementById('inp-btn-bg'),
663
+
664
+ // Sliders
665
+ blur: document.getElementById('inp-blur'),
666
+ radius: document.getElementById('inp-radius'),
667
+ width: document.getElementById('inp-width'),
668
+ btnRadius: document.getElementById('inp-btn-radius'),
669
+ };
670
+
671
+ const card = {
672
+ root: document.getElementById('glass-card'),
673
+ img: document.getElementById('card-img'),
674
+ title: document.getElementById('card-title'),
675
+ desc: document.getElementById('card-desc'),
676
+ btn: document.getElementById('card-btn')
677
+ };
678
+
679
+ const displays = {
680
+ blur: document.getElementById('val-blur'),
681
+ radius: document.getElementById('val-radius'),
682
+ width: document.getElementById('val-width'),
683
+ btnRadius: document.getElementById('val-btn-radius'),
684
+ };
685
+
686
+ const codeOutput = document.getElementById('code-output');
687
+ const toast = document.getElementById('toast');
688
+
689
+ // --- Helper Functions ---
690
+
691
+ // Convert Hex to RGBA
692
+ function hexToRgba(hex, opacity) {
693
+ let r = 0, g = 0, b = 0;
694
+ // 3 digits
695
+ if (hex.length === 4) {
696
+ r = "0x" + hex[1] + hex[1];
697
+ g = "0x" + hex[2] + hex[2];
698
+ b = "0x" + hex[3] + hex[3];
699
+ } else if (hex.length === 7) {
700
+ // 6 digits
701
+ r = "0x" + hex[1] + hex[2];
702
+ g = "0x" + hex[3] + hex[4];
703
+ b = "0x" + hex[5] + hex[6];
704
+ }
705
+ return `rgba(${+r}, ${+g}, ${+b}, ${opacity})`;
706
+ }
707
+
708
+ // --- Core Logic ---
709
+
710
+ function updateUI() {
711
+ // 1. Content
712
+ card.title.textContent = inputs.title.value;
713
+ card.desc.textContent = inputs.desc.value;
714
+ card.btn.textContent = inputs.btnText.value;
715
+ card.img.src = inputs.img.value;
716
+
717
+ // 2. Calculate Colors
718
+ const bgStyle = hexToRgba(inputs.bgColor.value, inputs.bgOpacity.value);
719
+ const borderStyle = hexToRgba(inputs.borderColor.value, inputs.borderOpacity.value);
720
+
721
+ // 3. Apply Styles to Card
722
+ card.root.style.setProperty('--card-bg', bgStyle);
723
+ card.root.style.setProperty('--card-border', borderStyle);
724
+ card.root.style.setProperty('--card-blur', `${inputs.blur.value}px`);
725
+ card.root.style.setProperty('--card-radius', `${inputs.radius.value}px`);
726
+ card.root.style.setProperty('--card-width', `${inputs.width.value}px`);
727
+ card.root.style.setProperty('--card-text', inputs.textColor.value);
728
+ card.root.style.setProperty('--btn-bg', inputs.btnBg.value);
729
+ card.root.style.setProperty('--btn-radius', `${inputs.btnRadius.value}px`);
730
+
731
+ // 4. Update Text Displays
732
+ displays.blur.textContent = `${inputs.blur.value}px`;
733
+ displays.radius.textContent = `${inputs.radius.value}px`;
734
+ displays.width.textContent = `${inputs.width.value}px`;
735
+ displays.btnRadius.textContent = `${inputs.btnRadius.value}px`;
736
+
737
+ // 5. Generate Code
738
+ generateCode(bgStyle, borderStyle);
739
+ }
740
+
741
+ function generateCode(bgStyle, borderStyle) {
742
+ const code = `
743
  <!-- Glassmorphism Card -->
744
  <style>
745
  .glass-card {
746
+ /* Dimensions */
747
+ width: ${inputs.width.value}px;
748
+ max-width: 100%;
749
+ padding: 32px;
750
+ border-radius: ${inputs.radius.value}px;
751
+
752
+ /* Glass Effect */
753
+ background: ${bgStyle};
754
  backdrop-filter: blur(${inputs.blur.value}px);
755
  -webkit-backdrop-filter: blur(${inputs.blur.value}px);
756
+ border: 1px solid ${borderStyle};
 
 
 
 
 
 
757
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
758
+
759
+ /* Text */
760
+ color: ${inputs.textColor.value};
761
+ font-family: 'Tahoma', sans-serif; /* Or Vazirmatn */
762
+ text-align: center;
763
+
764
+ /* Layout */
765
+ display: flex;
766
+ flex-direction: column;
767
+ align-items: center;
768
+ gap: 16px;
769
  }
770
+
771
  .glass-card img {
772
  width: 100px;
773
  height: 100px;
774
  border-radius: 50%;
775
  object-fit: cover;
776
+ border: 2px solid rgba(255,255,255,0.2);
777
  }
778
+
779
  .glass-card button {
780
+ margin-top: 10px;
781
+ padding: 12px 24px;
782
+ background: ${inputs.btnBg.value};
783
+ color: #fff; /* Assuming white text for button, use contrast checker for prod */
784
  border: none;
785
+ border-radius: ${inputs.btnRadius.value}px;
786
+ font-weight: bold;
787
  cursor: pointer;
788
+ transition: transform 0.2s;
789
+ }
790
+
791
+ .glass-card button:hover {
792
+ transform: scale(1.05);
793
  }
794
  </style>
795
 
796
  <div class="glass-card">
797
+ <img src="${inputs.img.value}" alt="Profile">
798
  <h3>${inputs.title.value}</h3>
799
  <p>${inputs.desc.value}</p>
800
+ <button>${inputs.btnText.value}</button>
801
  </div>
802
+ `;
803
+ codeOutput.value = code.trim();
804
+ }
805
+
806
+ function copyCode() {
807
+ codeOutput.select();
808
+ document.execCommand('copy');
809
+
810
+ // Show Toast
811
+ toast.classList.add('show');
812
+ setTimeout(() => {
813
+ toast.classList.remove('show');
814
+ }, 2500);
815
+ }
816
+
817
+ // --- Event Listeners ---
818
+ // Attach listener to all inputs
819
+ Object.values(inputs).forEach(input => {
820
+ input.addEventListener('input', updateUI);
821
+ });
822
+
823
+ // Initial Load
824
+ updateUI();
825
+
826
+ </script>
827
  </body>
828
+
829
  </html>