@vezham/icons-vscode 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscodeignore +3 -0
- package/CHANGELOG.md +19 -0
- package/LICENSE +21 -0
- package/README.md +101 -0
- package/extension.js +122 -0
- package/package.json +89 -0
- package/resources/icon.png +0 -0
- package/scripts/build.cjs +93 -0
- package/src/ui.html +1112 -0
package/src/ui.html
ADDED
|
@@ -0,0 +1,1112 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'unsafe-inline' https://fonts.googleapis.com; font-src https://fonts.gstatic.com; img-src data:; script-src 'unsafe-inline';">
|
|
7
|
+
<title>Reicon Icons</title>
|
|
8
|
+
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap" rel="stylesheet">
|
|
9
|
+
|
|
10
|
+
<style>
|
|
11
|
+
/* ── Design System Variables ── */
|
|
12
|
+
:root {
|
|
13
|
+
--bg-primary: #09090b;
|
|
14
|
+
--bg-secondary: #0e0e10;
|
|
15
|
+
--text-primary: #ffffff;
|
|
16
|
+
--text-secondary: rgba(255, 255, 255, 0.6);
|
|
17
|
+
--text-tertiary: rgba(255, 255, 255, 0.35);
|
|
18
|
+
--accent-primary: #6C5CE7;
|
|
19
|
+
--accent-hover: #5a4bd1;
|
|
20
|
+
--border-subtle: rgba(255, 255, 255, 0.06);
|
|
21
|
+
--border-medium: rgba(255, 255, 255, 0.12);
|
|
22
|
+
--overlay-light: rgba(255, 255, 255, 0.04);
|
|
23
|
+
--overlay-medium: rgba(255, 255, 255, 0.08);
|
|
24
|
+
--radius-sm: 8px;
|
|
25
|
+
--radius-md: 12px;
|
|
26
|
+
--radius-lg: 14px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
* {
|
|
30
|
+
box-sizing: border-box;
|
|
31
|
+
margin: 0;
|
|
32
|
+
padding: 0;
|
|
33
|
+
font-family: 'DM Sans', sans-serif;
|
|
34
|
+
scrollbar-width: none;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
*::-webkit-scrollbar {
|
|
38
|
+
display: none;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
body {
|
|
42
|
+
background-color: var(--bg-primary);
|
|
43
|
+
color: var(--text-primary);
|
|
44
|
+
width: 100%;
|
|
45
|
+
height: 100vh;
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-direction: column;
|
|
48
|
+
overflow: hidden;
|
|
49
|
+
font-size: 13px;
|
|
50
|
+
position: relative;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* ── Top Brand Row ── */
|
|
54
|
+
.top-brand-row {
|
|
55
|
+
display: flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
justify-content: space-between;
|
|
58
|
+
padding: 12px 12px 6px 12px;
|
|
59
|
+
z-index: 10;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.brand-container {
|
|
63
|
+
display: flex;
|
|
64
|
+
align-items: center;
|
|
65
|
+
gap: 8px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.brand-logo {
|
|
69
|
+
width: 22px;
|
|
70
|
+
height: 22px;
|
|
71
|
+
object-fit: contain;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.brand-name {
|
|
75
|
+
font-size: 15px;
|
|
76
|
+
font-weight: 700;
|
|
77
|
+
color: #ffffff;
|
|
78
|
+
letter-spacing: -0.2px;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.header-actions {
|
|
82
|
+
display: flex;
|
|
83
|
+
align-items: center;
|
|
84
|
+
gap: 12px;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.menu-toggle-btn {
|
|
88
|
+
background: none;
|
|
89
|
+
border: none;
|
|
90
|
+
color: var(--text-secondary);
|
|
91
|
+
cursor: pointer;
|
|
92
|
+
display: flex;
|
|
93
|
+
align-items: center;
|
|
94
|
+
justify-content: center;
|
|
95
|
+
width: 28px;
|
|
96
|
+
height: 28px;
|
|
97
|
+
border-radius: 8px;
|
|
98
|
+
transition: background 0.2s;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.menu-toggle-btn:hover {
|
|
102
|
+
background: var(--overlay-light);
|
|
103
|
+
color: var(--text-primary);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/* ── Main Container ── */
|
|
107
|
+
.app-container {
|
|
108
|
+
display: flex;
|
|
109
|
+
flex-direction: column;
|
|
110
|
+
flex: 1;
|
|
111
|
+
overflow: hidden;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/* ── Search & Configuration Controls Bar ── */
|
|
115
|
+
.search-control-bar {
|
|
116
|
+
padding: 6px 12px;
|
|
117
|
+
display: flex;
|
|
118
|
+
flex-direction: column;
|
|
119
|
+
gap: 8px;
|
|
120
|
+
flex-shrink: 0;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.search-wrapper {
|
|
124
|
+
position: relative;
|
|
125
|
+
display: flex;
|
|
126
|
+
align-items: center;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.search-input {
|
|
130
|
+
width: 100%;
|
|
131
|
+
height: 36px;
|
|
132
|
+
background-color: rgba(255, 255, 255, 0.05);
|
|
133
|
+
border: 1px solid rgba(255, 255, 255, 0.06);
|
|
134
|
+
border-radius: 99px;
|
|
135
|
+
color: var(--text-primary);
|
|
136
|
+
padding: 0 12px 0 32px;
|
|
137
|
+
font-size: 12px;
|
|
138
|
+
outline: none;
|
|
139
|
+
transition: all 0.2s ease;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.search-input:focus {
|
|
143
|
+
border-color: rgba(255, 255, 255, 0.25);
|
|
144
|
+
background-color: rgba(255, 255, 255, 0.08);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.search-icon {
|
|
148
|
+
position: absolute;
|
|
149
|
+
left: 12px;
|
|
150
|
+
top: 50%;
|
|
151
|
+
transform: translateY(-50%);
|
|
152
|
+
width: 12px;
|
|
153
|
+
height: 12px;
|
|
154
|
+
color: rgba(255, 255, 255, 0.3);
|
|
155
|
+
pointer-events: none;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/* Inline Controls (Weight + Format) */
|
|
159
|
+
.inline-controls-row {
|
|
160
|
+
display: flex;
|
|
161
|
+
gap: 6px;
|
|
162
|
+
width: 100%;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/* Segmented Control Pill */
|
|
166
|
+
.segmented-control {
|
|
167
|
+
display: flex;
|
|
168
|
+
background-color: rgba(255, 255, 255, 0.04);
|
|
169
|
+
border: 1px solid rgba(255, 255, 255, 0.06);
|
|
170
|
+
border-radius: 99px;
|
|
171
|
+
padding: 2px;
|
|
172
|
+
flex: 1;
|
|
173
|
+
min-width: 0;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.segment-button {
|
|
177
|
+
background: none;
|
|
178
|
+
border: none;
|
|
179
|
+
color: var(--text-secondary);
|
|
180
|
+
padding: 5px 0;
|
|
181
|
+
font-size: 11px;
|
|
182
|
+
font-weight: 500;
|
|
183
|
+
border-radius: 99px;
|
|
184
|
+
cursor: pointer;
|
|
185
|
+
transition: all 0.2s;
|
|
186
|
+
flex: 1;
|
|
187
|
+
text-align: center;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.segment-button.active {
|
|
191
|
+
background-color: rgba(255, 255, 255, 0.08);
|
|
192
|
+
color: var(--text-primary);
|
|
193
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/* Format dropdown */
|
|
197
|
+
.format-selector {
|
|
198
|
+
background-color: rgba(255, 255, 255, 0.04);
|
|
199
|
+
border: 1px solid rgba(255, 255, 255, 0.06);
|
|
200
|
+
border-radius: 99px;
|
|
201
|
+
color: var(--text-primary);
|
|
202
|
+
padding: 0 12px;
|
|
203
|
+
font-size: 11px;
|
|
204
|
+
font-weight: 500;
|
|
205
|
+
outline: none;
|
|
206
|
+
cursor: pointer;
|
|
207
|
+
width: 80px;
|
|
208
|
+
height: 26px;
|
|
209
|
+
text-align: center;
|
|
210
|
+
transition: all 0.2s;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.format-selector:focus {
|
|
214
|
+
border-color: rgba(255, 255, 255, 0.25);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.format-selector option {
|
|
218
|
+
background-color: var(--bg-secondary);
|
|
219
|
+
color: var(--text-primary);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/* Customizer properties (Color and Size) */
|
|
223
|
+
.customizer-row {
|
|
224
|
+
display: flex;
|
|
225
|
+
align-items: center;
|
|
226
|
+
justify-content: space-between;
|
|
227
|
+
gap: 12px;
|
|
228
|
+
padding: 2px 4px;
|
|
229
|
+
width: 100%;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.customizer-item {
|
|
233
|
+
display: flex;
|
|
234
|
+
align-items: center;
|
|
235
|
+
gap: 6px;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.customizer-label {
|
|
239
|
+
color: var(--text-tertiary);
|
|
240
|
+
font-size: 10px;
|
|
241
|
+
font-weight: 600;
|
|
242
|
+
text-transform: uppercase;
|
|
243
|
+
letter-spacing: 0.5px;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.color-swatches {
|
|
247
|
+
display: flex;
|
|
248
|
+
align-items: center;
|
|
249
|
+
gap: 4px;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.color-swatch {
|
|
253
|
+
width: 14px;
|
|
254
|
+
height: 14px;
|
|
255
|
+
border-radius: 50%;
|
|
256
|
+
cursor: pointer;
|
|
257
|
+
border: 1px solid rgba(255,255,255,0.1);
|
|
258
|
+
transition: transform 0.15s ease, border-color 0.15s ease;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.color-swatch:hover, .color-swatch.active {
|
|
262
|
+
transform: scale(1.15);
|
|
263
|
+
border-color: var(--text-primary);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.custom-color-input {
|
|
267
|
+
width: 58px;
|
|
268
|
+
height: 22px;
|
|
269
|
+
background-color: var(--bg-secondary);
|
|
270
|
+
border: 1px solid var(--border-subtle);
|
|
271
|
+
border-radius: 5px;
|
|
272
|
+
color: var(--text-primary);
|
|
273
|
+
padding: 0 4px;
|
|
274
|
+
font-size: 10px;
|
|
275
|
+
outline: none;
|
|
276
|
+
text-align: center;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.custom-size-input {
|
|
280
|
+
width: 34px;
|
|
281
|
+
height: 22px;
|
|
282
|
+
background-color: var(--bg-secondary);
|
|
283
|
+
border: 1px solid var(--border-subtle);
|
|
284
|
+
border-radius: 5px;
|
|
285
|
+
color: var(--text-primary);
|
|
286
|
+
padding: 0 4px;
|
|
287
|
+
font-size: 10px;
|
|
288
|
+
outline: none;
|
|
289
|
+
text-align: center;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/* ── Horizontal Scrolling Categories ── */
|
|
293
|
+
.category-scroller {
|
|
294
|
+
display: flex;
|
|
295
|
+
align-items: center;
|
|
296
|
+
gap: 6px;
|
|
297
|
+
padding: 4px 12px 8px 12px;
|
|
298
|
+
overflow-x: auto;
|
|
299
|
+
flex-shrink: 0;
|
|
300
|
+
border-bottom: 1px solid var(--border-subtle);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.category-pill {
|
|
304
|
+
padding: 4px 10px;
|
|
305
|
+
background: rgba(255, 255, 255, 0.03);
|
|
306
|
+
border: 1px solid rgba(255, 255, 255, 0.06);
|
|
307
|
+
border-radius: 99px;
|
|
308
|
+
font-size: 11px;
|
|
309
|
+
font-weight: 500;
|
|
310
|
+
color: var(--text-secondary);
|
|
311
|
+
white-space: nowrap;
|
|
312
|
+
cursor: pointer;
|
|
313
|
+
transition: all 0.2s;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
.category-pill:hover {
|
|
317
|
+
background: rgba(255, 255, 255, 0.06);
|
|
318
|
+
color: var(--text-primary);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.category-pill.active {
|
|
322
|
+
background: rgba(108, 92, 231, 0.1);
|
|
323
|
+
border-color: var(--accent-primary);
|
|
324
|
+
color: #ffffff;
|
|
325
|
+
box-shadow: 0 0 10px rgba(108, 92, 231, 0.15);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/* ── Dense Icon Grid ── */
|
|
329
|
+
.grid-container {
|
|
330
|
+
flex: 1;
|
|
331
|
+
overflow-y: auto;
|
|
332
|
+
padding: 12px;
|
|
333
|
+
display: grid;
|
|
334
|
+
grid-template-columns: repeat(auto-fill, minmax(calc(var(--grid-icon-size, 24px) + 16px), 1fr));
|
|
335
|
+
gap: 6px;
|
|
336
|
+
align-content: start;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/* Circle Highlights on Hover */
|
|
340
|
+
.icon-card {
|
|
341
|
+
aspect-ratio: 1;
|
|
342
|
+
display: flex;
|
|
343
|
+
align-items: center;
|
|
344
|
+
justify-content: center;
|
|
345
|
+
cursor: pointer;
|
|
346
|
+
position: relative;
|
|
347
|
+
border-radius: 50%;
|
|
348
|
+
transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
.icon-card:hover {
|
|
352
|
+
background-color: rgba(255, 255, 255, 0.06);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
.icon-card.selected {
|
|
356
|
+
background-color: rgba(108, 92, 231, 0.15);
|
|
357
|
+
box-shadow: inset 0 0 0 1.5px var(--accent-primary);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
.icon-card-svg {
|
|
361
|
+
width: var(--grid-icon-size, 24px);
|
|
362
|
+
height: var(--grid-icon-size, 24px);
|
|
363
|
+
display: flex;
|
|
364
|
+
align-items: center;
|
|
365
|
+
justify-content: center;
|
|
366
|
+
transition: color 0.15s ease;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
.icon-card-svg svg {
|
|
370
|
+
width: 100%;
|
|
371
|
+
height: 100%;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/* ── Dropdown Menu Styling ── */
|
|
375
|
+
.dropdown-menu {
|
|
376
|
+
position: absolute;
|
|
377
|
+
top: 40px;
|
|
378
|
+
right: 12px;
|
|
379
|
+
background-color: var(--bg-secondary);
|
|
380
|
+
border: 1px solid var(--border-medium);
|
|
381
|
+
border-radius: var(--radius-md);
|
|
382
|
+
box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
|
|
383
|
+
width: 180px;
|
|
384
|
+
display: none;
|
|
385
|
+
flex-direction: column;
|
|
386
|
+
z-index: 1000;
|
|
387
|
+
overflow: hidden;
|
|
388
|
+
animation: dropdown-fade-in 0.15s ease-out;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
.dropdown-menu.show {
|
|
392
|
+
display: flex;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
.dropdown-item {
|
|
396
|
+
display: flex;
|
|
397
|
+
align-items: center;
|
|
398
|
+
justify-content: space-between;
|
|
399
|
+
padding: 9px 12px;
|
|
400
|
+
color: rgba(255, 255, 255, 0.7);
|
|
401
|
+
cursor: pointer;
|
|
402
|
+
font-size: 11px;
|
|
403
|
+
font-weight: 500;
|
|
404
|
+
transition: all 0.15s ease;
|
|
405
|
+
user-select: none;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
.dropdown-item:hover {
|
|
409
|
+
background-color: rgba(255, 255, 255, 0.04);
|
|
410
|
+
color: #ffffff;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
.dropdown-item svg {
|
|
414
|
+
opacity: 0.6;
|
|
415
|
+
flex-shrink: 0;
|
|
416
|
+
transition: opacity 0.15s ease;
|
|
417
|
+
color: var(--text-secondary);
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
.dropdown-item:hover svg {
|
|
421
|
+
opacity: 1;
|
|
422
|
+
color: #ffffff;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
.dropdown-divider {
|
|
426
|
+
height: 1px;
|
|
427
|
+
background-color: rgba(255, 255, 255, 0.06);
|
|
428
|
+
margin: 4px 0;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
@keyframes dropdown-fade-in {
|
|
432
|
+
from { opacity: 0; transform: translateY(-4px); }
|
|
433
|
+
to { opacity: 1; transform: translateY(0); }
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
/* Empty State */
|
|
439
|
+
.empty-state {
|
|
440
|
+
grid-column: 1 / -1;
|
|
441
|
+
display: flex;
|
|
442
|
+
flex-direction: column;
|
|
443
|
+
align-items: center;
|
|
444
|
+
justify-content: center;
|
|
445
|
+
padding: 60px 20px;
|
|
446
|
+
text-align: center;
|
|
447
|
+
color: var(--text-tertiary);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
.empty-state svg {
|
|
451
|
+
width: 28px;
|
|
452
|
+
height: 28px;
|
|
453
|
+
opacity: 0.2;
|
|
454
|
+
margin-bottom: 8px;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/* ── Floating Toast ── */
|
|
458
|
+
.toast-notification {
|
|
459
|
+
position: absolute;
|
|
460
|
+
bottom: 50px;
|
|
461
|
+
left: 50%;
|
|
462
|
+
transform: translateX(-50%) translateY(20px);
|
|
463
|
+
background-color: #1e1e20;
|
|
464
|
+
border: 1px solid rgba(255, 255, 255, 0.08);
|
|
465
|
+
border-radius: 99px;
|
|
466
|
+
display: flex;
|
|
467
|
+
align-items: center;
|
|
468
|
+
padding: 4px 10px 4px 4px;
|
|
469
|
+
gap: 8px;
|
|
470
|
+
z-index: 10000;
|
|
471
|
+
opacity: 0;
|
|
472
|
+
pointer-events: none;
|
|
473
|
+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
|
|
474
|
+
transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.1), opacity 0.2s ease;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
.toast-notification.show {
|
|
478
|
+
opacity: 1;
|
|
479
|
+
pointer-events: auto;
|
|
480
|
+
transform: translateX(-50%) translateY(0);
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
.toast-icon-wrapper {
|
|
484
|
+
width: 22px;
|
|
485
|
+
height: 22px;
|
|
486
|
+
border-radius: 50%;
|
|
487
|
+
background-color: rgba(108, 92, 231, 0.15);
|
|
488
|
+
display: flex;
|
|
489
|
+
align-items: center;
|
|
490
|
+
justify-content: center;
|
|
491
|
+
flex-shrink: 0;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
.toast-brand-logo {
|
|
495
|
+
width: 12px;
|
|
496
|
+
height: 12px;
|
|
497
|
+
object-fit: contain;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
.toast-message {
|
|
501
|
+
font-size: 11px;
|
|
502
|
+
font-weight: 500;
|
|
503
|
+
color: #ffffff;
|
|
504
|
+
white-space: nowrap;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
.toast-divider {
|
|
508
|
+
width: 1px;
|
|
509
|
+
height: 14px;
|
|
510
|
+
background-color: rgba(255, 255, 255, 0.12);
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
.toast-close-btn {
|
|
514
|
+
background: none;
|
|
515
|
+
border: none;
|
|
516
|
+
color: rgba(255, 255, 255, 0.5);
|
|
517
|
+
cursor: pointer;
|
|
518
|
+
display: flex;
|
|
519
|
+
align-items: center;
|
|
520
|
+
justify-content: center;
|
|
521
|
+
width: 16px;
|
|
522
|
+
height: 16px;
|
|
523
|
+
border-radius: 50%;
|
|
524
|
+
transition: color 0.15s, background-color 0.15s;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
.toast-close-btn:hover {
|
|
528
|
+
color: #ffffff;
|
|
529
|
+
background-color: rgba(255, 255, 255, 0.08);
|
|
530
|
+
}
|
|
531
|
+
</style>
|
|
532
|
+
|
|
533
|
+
<!-- ── Injected Icons Database ── -->
|
|
534
|
+
<!-- INJECT_ICONS_DATA -->
|
|
535
|
+
</head>
|
|
536
|
+
<body>
|
|
537
|
+
|
|
538
|
+
<!-- Top Brand Row (Clean, minimal branding like Hugeicons) -->
|
|
539
|
+
<div class="top-brand-row">
|
|
540
|
+
<div class="brand-container">
|
|
541
|
+
<img class="brand-logo" src="__REICON_LOGO_BASE64__" alt="Reicon logo">
|
|
542
|
+
<span class="brand-name">Reicon</span>
|
|
543
|
+
</div>
|
|
544
|
+
<div class="header-actions">
|
|
545
|
+
<button class="menu-toggle-btn" id="menu-toggle-btn" title="Menu" onclick="toggleMenu(event)">
|
|
546
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" height="16" width="16">
|
|
547
|
+
<path d="m4 8 16 0" stroke-width="2"></path>
|
|
548
|
+
<path d="m4 16 16 0" stroke-width="2"></path>
|
|
549
|
+
</svg>
|
|
550
|
+
</button>
|
|
551
|
+
|
|
552
|
+
<!-- Dropdown Menu -->
|
|
553
|
+
<div class="dropdown-menu" id="dropdown-menu">
|
|
554
|
+
<div class="dropdown-item" onclick="changePreviewSize(-2)">
|
|
555
|
+
<span>Decrease preview size</span>
|
|
556
|
+
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line><line x1="8" y1="11" x2="14" y2="11"></line></svg>
|
|
557
|
+
</div>
|
|
558
|
+
<div class="dropdown-item" onclick="changePreviewSize(2)">
|
|
559
|
+
<span>Increase preview size</span>
|
|
560
|
+
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line><line x1="11" y1="8" x2="11" y2="14"></line><line x1="8" y1="11" x2="14" y2="11"></line></svg>
|
|
561
|
+
</div>
|
|
562
|
+
|
|
563
|
+
<div class="dropdown-divider"></div>
|
|
564
|
+
|
|
565
|
+
<div class="dropdown-item" onclick="openExternalUrl('https://reicon.dev')">
|
|
566
|
+
<span>Visit Reicon.dev</span>
|
|
567
|
+
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path><polyline points="15 3 21 3 21 9"></polyline><line x1="10" y1="14" x2="21" y2="3"></line></svg>
|
|
568
|
+
</div>
|
|
569
|
+
<div class="dropdown-item" onclick="openExternalUrl('https://github.com/dqev/reicon')">
|
|
570
|
+
<span>Star on GitHub</span>
|
|
571
|
+
<svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2A10 10 0 0 0 2 12c0 4.42 2.87 8.17 6.84 9.5.5.08.66-.23.66-.5v-1.69c-2.77.6-3.36-1.34-3.36-1.34-.46-1.16-1.11-1.47-1.11-1.47-.9-.62.07-.6.07-.6 1 .07 1.53 1.03 1.53 1.03.9 1.52 2.34 1.07 2.91.83.09-.65.35-1.09.63-1.34-2.22-.25-4.55-1.11-4.55-4.92 0-1.11.38-2 1.03-2.71-.1-.25-.45-1.29.1-2.64 0 0 .84-.27 2.75 1.02.79-.22 1.65-.33 2.5-.33.85 0 1.71.11 2.5.33 1.91-1.29 2.75-1.02 2.75-1.02.55 1.35.2 2.39.1 2.64.65.71 1.03 1.6 1.03 2.71 0 3.82-2.34 4.66-4.57 4.91.36.31.69.92.69 1.85V21c0 .27.16.59.67.5C19.14 20.16 22 16.42 22 12A10 10 0 0 0 12 2z"/></svg>
|
|
572
|
+
</div>
|
|
573
|
+
</div>
|
|
574
|
+
</div>
|
|
575
|
+
</div>
|
|
576
|
+
|
|
577
|
+
<!-- App Layout -->
|
|
578
|
+
<div class="app-container">
|
|
579
|
+
|
|
580
|
+
<!-- Search & Weight Control Row -->
|
|
581
|
+
<section class="search-control-bar">
|
|
582
|
+
<div class="search-wrapper">
|
|
583
|
+
<svg class="search-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
584
|
+
<circle cx="11" cy="11" r="8"></circle>
|
|
585
|
+
<line x1="21" y1="21" x2="16.65" y2="16.65"></line>
|
|
586
|
+
</svg>
|
|
587
|
+
<input type="text" class="search-input" id="search-input" placeholder="Search icons... (⌘F to focus)">
|
|
588
|
+
</div>
|
|
589
|
+
|
|
590
|
+
<!-- Weight and Format control row -->
|
|
591
|
+
<div class="inline-controls-row">
|
|
592
|
+
<!-- Weight Segmented Toggle -->
|
|
593
|
+
<div class="segmented-control">
|
|
594
|
+
<button class="segment-button active" id="weight-outline" onclick="selectStyle('Outline', this)">Outline</button>
|
|
595
|
+
<button class="segment-button" id="weight-filled" onclick="selectStyle('Filled', this)">Filled</button>
|
|
596
|
+
</div>
|
|
597
|
+
|
|
598
|
+
<!-- Format selector -->
|
|
599
|
+
<select class="format-selector" id="format-select" onchange="selectFormat(this.value)">
|
|
600
|
+
<option value="react">React</option>
|
|
601
|
+
<option value="vue">Vue</option>
|
|
602
|
+
<option value="svelte">Svelte</option>
|
|
603
|
+
<option value="svg">SVG</option>
|
|
604
|
+
</select>
|
|
605
|
+
</div>
|
|
606
|
+
|
|
607
|
+
<!-- Sizing and Colors -->
|
|
608
|
+
<div class="customizer-row">
|
|
609
|
+
<!-- Size selector -->
|
|
610
|
+
<div class="customizer-item">
|
|
611
|
+
<span class="customizer-label">Size</span>
|
|
612
|
+
<input type="text" class="custom-size-input" id="custom-size" value="24" oninput="customSizeInput(this.value)">
|
|
613
|
+
</div>
|
|
614
|
+
|
|
615
|
+
<!-- Color swatches and input -->
|
|
616
|
+
<div class="customizer-item">
|
|
617
|
+
<span class="customizer-label">Color</span>
|
|
618
|
+
<div class="color-swatches">
|
|
619
|
+
<div class="color-swatch active" style="background-color: currentColor; border: 1px dashed rgba(255,255,255,0.4);" onclick="selectColorSwatch('currentColor', this)" title="Theme Default"></div>
|
|
620
|
+
<div class="color-swatch" style="background-color: #9CA3AF;" onclick="selectColorSwatch('#9CA3AF', this)" title="Gray"></div>
|
|
621
|
+
<div class="color-swatch" style="background-color: #6C5CE7;" onclick="selectColorSwatch('#6C5CE7', this)" title="Purple"></div>
|
|
622
|
+
</div>
|
|
623
|
+
<input type="text" class="custom-color-input" id="custom-color" value="currentColor" oninput="customColorInput(this.value)">
|
|
624
|
+
</div>
|
|
625
|
+
</div>
|
|
626
|
+
</section>
|
|
627
|
+
|
|
628
|
+
<!-- Horizontal Category scroller -->
|
|
629
|
+
<div class="category-scroller" id="category-scroller-bar">
|
|
630
|
+
<div class="category-pill active" id="cat-all-pill" onclick="selectCategory('all', this)">All</div>
|
|
631
|
+
<!-- Dynamically filled categories -->
|
|
632
|
+
</div>
|
|
633
|
+
|
|
634
|
+
<!-- Icons Grid -->
|
|
635
|
+
<section class="grid-container" id="icons-grid">
|
|
636
|
+
<!-- Dynamically rendered icon cards -->
|
|
637
|
+
</section>
|
|
638
|
+
|
|
639
|
+
</div>
|
|
640
|
+
|
|
641
|
+
|
|
642
|
+
|
|
643
|
+
<!-- Floating Toast Notification -->
|
|
644
|
+
<div class="toast-notification" id="toast-notification">
|
|
645
|
+
<div class="toast-icon-wrapper">
|
|
646
|
+
<img class="toast-brand-logo" src="__REICON_LOGO_BASE64__" alt="Reicon logo">
|
|
647
|
+
</div>
|
|
648
|
+
<span class="toast-message" id="toast-message">Inserted "home"</span>
|
|
649
|
+
<div class="toast-divider"></div>
|
|
650
|
+
<button class="toast-close-btn" onclick="dismissToast(event)">
|
|
651
|
+
<svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>
|
|
652
|
+
</button>
|
|
653
|
+
</div>
|
|
654
|
+
|
|
655
|
+
<script>
|
|
656
|
+
// VS Code API
|
|
657
|
+
let vscode;
|
|
658
|
+
try {
|
|
659
|
+
vscode = acquireVsCodeApi();
|
|
660
|
+
} catch (e) {
|
|
661
|
+
console.warn("VS Code API not found, running in web browser fallback.");
|
|
662
|
+
vscode = {
|
|
663
|
+
postMessage: (msg) => console.log("PostMessage:", msg),
|
|
664
|
+
getState: () => null,
|
|
665
|
+
setState: (st) => {}
|
|
666
|
+
};
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
// State management
|
|
670
|
+
let activeCategory = 'all';
|
|
671
|
+
let activeStyle = 'Outline';
|
|
672
|
+
let activeFormat = 'react';
|
|
673
|
+
let activeSize = '24';
|
|
674
|
+
let selectedColor = 'currentColor';
|
|
675
|
+
let selectedIconName = '';
|
|
676
|
+
|
|
677
|
+
let searchQuery = '';
|
|
678
|
+
let filteredIcons = [];
|
|
679
|
+
let displayedCount = 0;
|
|
680
|
+
const BATCH_SIZE = 160;
|
|
681
|
+
|
|
682
|
+
// DOM Elements
|
|
683
|
+
const searchInput = document.getElementById('search-input');
|
|
684
|
+
const iconsGrid = document.getElementById('icons-grid');
|
|
685
|
+
const scrollerBarEl = document.getElementById('category-scroller-bar');
|
|
686
|
+
|
|
687
|
+
|
|
688
|
+
const customSizeInputEl = document.getElementById('custom-size');
|
|
689
|
+
const customColorInputEl = document.getElementById('custom-color');
|
|
690
|
+
const formatSelectEl = document.getElementById('format-select');
|
|
691
|
+
|
|
692
|
+
// Helper functions
|
|
693
|
+
function toPascalCase(str) {
|
|
694
|
+
return str
|
|
695
|
+
.split('-')
|
|
696
|
+
.map(s => s.charAt(0).toUpperCase() + s.slice(1))
|
|
697
|
+
.join('');
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
function getSnippet(name, weight, rawCode, format, size, color) {
|
|
701
|
+
const pascalName = toPascalCase(name);
|
|
702
|
+
const isFilled = weight === 'Filled';
|
|
703
|
+
|
|
704
|
+
switch (format) {
|
|
705
|
+
case 'react': {
|
|
706
|
+
const weightProp = isFilled ? ' weight="Filled"' : '';
|
|
707
|
+
const sizeProp = size !== 24 ? ` size={${size}}` : '';
|
|
708
|
+
const colorProp = color && color !== 'currentColor' ? ` color="${color}"` : '';
|
|
709
|
+
return `<${pascalName}${weightProp}${sizeProp}${colorProp} />`;
|
|
710
|
+
}
|
|
711
|
+
case 'vue': {
|
|
712
|
+
const weightProp = isFilled ? ' weight="Filled"' : '';
|
|
713
|
+
const sizeProp = size !== 24 ? ` :size="${size}"` : '';
|
|
714
|
+
const colorProp = color && color !== 'currentColor' ? ` color="${color}"` : '';
|
|
715
|
+
return `<${pascalName}${weightProp}${sizeProp}${colorProp} />`;
|
|
716
|
+
}
|
|
717
|
+
case 'svelte': {
|
|
718
|
+
const weightProp = isFilled ? ' weight="Filled"' : '';
|
|
719
|
+
const sizeProp = size !== 24 ? ` size={${size}}` : '';
|
|
720
|
+
const colorProp = color && color !== 'currentColor' ? ` color="${color}"` : '';
|
|
721
|
+
return `<${pascalName}${weightProp}${sizeProp}${colorProp} />`;
|
|
722
|
+
}
|
|
723
|
+
case 'svg': {
|
|
724
|
+
// Colorize the path content
|
|
725
|
+
const colorized = rawCode.replace(/currentColor/g, color);
|
|
726
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none">${colorized}</svg>`;
|
|
727
|
+
}
|
|
728
|
+
default:
|
|
729
|
+
return rawCode;
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
// Initialize state from stored VS Code state
|
|
734
|
+
function loadSavedState() {
|
|
735
|
+
const saved = vscode.getState();
|
|
736
|
+
if (saved) {
|
|
737
|
+
if (saved.format) {
|
|
738
|
+
activeFormat = saved.format;
|
|
739
|
+
formatSelectEl.value = activeFormat;
|
|
740
|
+
}
|
|
741
|
+
if (saved.size) {
|
|
742
|
+
activeSize = saved.size;
|
|
743
|
+
customSizeInputEl.value = activeSize;
|
|
744
|
+
}
|
|
745
|
+
if (saved.color) {
|
|
746
|
+
selectedColor = saved.color;
|
|
747
|
+
customColorInputEl.value = selectedColor;
|
|
748
|
+
|
|
749
|
+
// Set active swatch color
|
|
750
|
+
document.querySelectorAll('.color-swatch').forEach(el => {
|
|
751
|
+
const bg = el.style.backgroundColor;
|
|
752
|
+
const match = bg && (selectedColor.toLowerCase() === bg.toLowerCase() ||
|
|
753
|
+
(selectedColor === 'currentColor' && (bg.includes('currentcolor') || bg === '')) ||
|
|
754
|
+
(selectedColor === '#6c5ce7' && bg.includes('108, 92, 231')) ||
|
|
755
|
+
(selectedColor === '#9ca3af' && bg.includes('156, 163, 175')));
|
|
756
|
+
el.classList.toggle('active', !!match);
|
|
757
|
+
});
|
|
758
|
+
}
|
|
759
|
+
if (saved.style) {
|
|
760
|
+
activeStyle = saved.style;
|
|
761
|
+
document.getElementById('weight-outline').classList.toggle('active', activeStyle === 'Outline');
|
|
762
|
+
document.getElementById('weight-filled').classList.toggle('active', activeStyle === 'Filled');
|
|
763
|
+
}
|
|
764
|
+
if (saved.category) {
|
|
765
|
+
activeCategory = saved.category;
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
function saveState() {
|
|
771
|
+
vscode.setState({
|
|
772
|
+
format: activeFormat,
|
|
773
|
+
size: activeSize,
|
|
774
|
+
color: selectedColor,
|
|
775
|
+
style: activeStyle,
|
|
776
|
+
category: activeCategory
|
|
777
|
+
});
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
// Initialize Panel
|
|
781
|
+
function init() {
|
|
782
|
+
if (!window.REICON_DATA || !window.REICON_CATEGORIES) {
|
|
783
|
+
iconsGrid.innerHTML = `
|
|
784
|
+
<div class="empty-state">
|
|
785
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="12"></line><line x1="12" y1="16" x2="12.01" y2="16"></line></svg>
|
|
786
|
+
<p>Database failed to load.</p>
|
|
787
|
+
</div>`;
|
|
788
|
+
return;
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
loadSavedState();
|
|
792
|
+
|
|
793
|
+
// 1. Generate category pills in horizontal scroller
|
|
794
|
+
window.REICON_CATEGORIES.sort((a,b) => a.name.localeCompare(b.name)).forEach(cat => {
|
|
795
|
+
const pill = document.createElement('div');
|
|
796
|
+
pill.className = 'category-pill' + (activeCategory === cat.id ? ' active' : '');
|
|
797
|
+
pill.dataset.category = cat.id;
|
|
798
|
+
pill.textContent = cat.name;
|
|
799
|
+
pill.onclick = () => selectCategory(cat.id, pill);
|
|
800
|
+
scrollerBarEl.appendChild(pill);
|
|
801
|
+
});
|
|
802
|
+
|
|
803
|
+
if (activeCategory === 'all') {
|
|
804
|
+
document.getElementById('cat-all-pill').classList.add('active');
|
|
805
|
+
} else {
|
|
806
|
+
document.getElementById('cat-all-pill').classList.remove('active');
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
// 2. Search input handler
|
|
810
|
+
searchInput.oninput = () => {
|
|
811
|
+
searchQuery = searchInput.value;
|
|
812
|
+
applyFilters();
|
|
813
|
+
};
|
|
814
|
+
|
|
815
|
+
// Focus shortcut
|
|
816
|
+
window.onkeydown = (e) => {
|
|
817
|
+
if ((e.metaKey || e.ctrlKey) && (e.key === 'f' || e.key === 'p')) {
|
|
818
|
+
e.preventDefault();
|
|
819
|
+
searchInput.focus();
|
|
820
|
+
}
|
|
821
|
+
};
|
|
822
|
+
|
|
823
|
+
// 3. Scroll listener for progressive lazy rendering
|
|
824
|
+
iconsGrid.onscroll = () => {
|
|
825
|
+
if (iconsGrid.scrollHeight - iconsGrid.scrollTop <= iconsGrid.clientHeight + 80) {
|
|
826
|
+
loadMoreIcons();
|
|
827
|
+
}
|
|
828
|
+
};
|
|
829
|
+
|
|
830
|
+
// 4. Initial filters application
|
|
831
|
+
applyFilters();
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
// Filter Logic
|
|
835
|
+
function applyFilters() {
|
|
836
|
+
const query = searchQuery.toLowerCase().trim();
|
|
837
|
+
const allKeys = Object.keys(window.REICON_DATA);
|
|
838
|
+
|
|
839
|
+
filteredIcons = [];
|
|
840
|
+
|
|
841
|
+
allKeys.forEach(name => {
|
|
842
|
+
const item = window.REICON_DATA[name];
|
|
843
|
+
|
|
844
|
+
// 1. Category filter
|
|
845
|
+
if (activeCategory !== 'all' && item.category !== activeCategory) {
|
|
846
|
+
return;
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
// 2. Weight match check
|
|
850
|
+
if (!item.weights[activeStyle]) return;
|
|
851
|
+
|
|
852
|
+
// 3. Search text match
|
|
853
|
+
if (query) {
|
|
854
|
+
const matchName = name.toLowerCase().includes(query);
|
|
855
|
+
const matchCat = item.category.toLowerCase().includes(query);
|
|
856
|
+
const matchTags = item.description.some(tag => tag.toLowerCase().includes(query));
|
|
857
|
+
if (!matchName && !matchCat && !matchTags) return;
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
filteredIcons.push({ name: name, weight: activeStyle, data: item.weights[activeStyle] });
|
|
861
|
+
});
|
|
862
|
+
|
|
863
|
+
|
|
864
|
+
|
|
865
|
+
// Reset grid scroll
|
|
866
|
+
iconsGrid.scrollTop = 0;
|
|
867
|
+
displayedCount = 0;
|
|
868
|
+
iconsGrid.innerHTML = '';
|
|
869
|
+
|
|
870
|
+
if (filteredIcons.length === 0) {
|
|
871
|
+
iconsGrid.innerHTML = `
|
|
872
|
+
<div class="empty-state">
|
|
873
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
874
|
+
<circle cx="11" cy="11" r="8"></circle>
|
|
875
|
+
<line x1="21" y1="21" x2="16.65" y2="16.65"></line>
|
|
876
|
+
</svg>
|
|
877
|
+
<p>No icons found</p>
|
|
878
|
+
</div>
|
|
879
|
+
`;
|
|
880
|
+
return;
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
loadMoreIcons();
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
// Lazy load icons
|
|
887
|
+
function loadMoreIcons() {
|
|
888
|
+
if (displayedCount >= filteredIcons.length) return;
|
|
889
|
+
|
|
890
|
+
const end = Math.min(displayedCount + BATCH_SIZE, filteredIcons.length);
|
|
891
|
+
const frag = document.createDocumentFragment();
|
|
892
|
+
|
|
893
|
+
for (let i = displayedCount; i < end; i++) {
|
|
894
|
+
const item = filteredIcons[i];
|
|
895
|
+
const cardId = `${item.name}-${item.weight}`;
|
|
896
|
+
|
|
897
|
+
const card = document.createElement('div');
|
|
898
|
+
card.className = `icon-card ${selectedIconName === cardId ? 'selected' : ''}`;
|
|
899
|
+
card.dataset.cardId = cardId;
|
|
900
|
+
card.dataset.name = item.name;
|
|
901
|
+
card.dataset.weight = item.weight;
|
|
902
|
+
|
|
903
|
+
card.onclick = () => selectIcon(cardId, item.name, item.weight);
|
|
904
|
+
|
|
905
|
+
card.innerHTML = `
|
|
906
|
+
<div class="icon-card-svg" style="color: ${selectedColor};">
|
|
907
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none">${item.data}</svg>
|
|
908
|
+
</div>
|
|
909
|
+
`;
|
|
910
|
+
|
|
911
|
+
frag.appendChild(card);
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
iconsGrid.appendChild(frag);
|
|
915
|
+
displayedCount = end;
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
// Sidebar Category Swapping
|
|
919
|
+
function selectCategory(catId, element) {
|
|
920
|
+
document.querySelectorAll('.category-pill').forEach(el => el.classList.remove('active'));
|
|
921
|
+
document.getElementById('cat-all-pill').classList.remove('active');
|
|
922
|
+
|
|
923
|
+
element.classList.add('active');
|
|
924
|
+
activeCategory = catId;
|
|
925
|
+
|
|
926
|
+
saveState();
|
|
927
|
+
applyFilters();
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
// Style Swapping (Outline / Filled)
|
|
931
|
+
function selectStyle(styleName, element) {
|
|
932
|
+
document.querySelectorAll('.segment-button').forEach(el => el.classList.remove('active'));
|
|
933
|
+
element.classList.add('active');
|
|
934
|
+
activeStyle = styleName;
|
|
935
|
+
|
|
936
|
+
if (selectedIconName) {
|
|
937
|
+
const lastHyphen = selectedIconName.lastIndexOf('-');
|
|
938
|
+
const name = selectedIconName.substring(0, lastHyphen);
|
|
939
|
+
const w = selectedIconName.substring(lastHyphen + 1);
|
|
940
|
+
if (activeStyle !== w) {
|
|
941
|
+
clearSelection();
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
saveState();
|
|
946
|
+
applyFilters();
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
// Format selection
|
|
950
|
+
function selectFormat(format) {
|
|
951
|
+
activeFormat = format;
|
|
952
|
+
saveState();
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
function customSizeInput(val) {
|
|
956
|
+
const num = parseInt(val);
|
|
957
|
+
if (num > 0) {
|
|
958
|
+
activeSize = num.toString();
|
|
959
|
+
saveState();
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
// Color swatches selection
|
|
964
|
+
function selectColorSwatch(colorHex, element) {
|
|
965
|
+
document.querySelectorAll('.color-swatch').forEach(el => el.classList.remove('active'));
|
|
966
|
+
if (element) element.classList.add('active');
|
|
967
|
+
|
|
968
|
+
selectedColor = colorHex;
|
|
969
|
+
customColorInputEl.value = colorHex;
|
|
970
|
+
|
|
971
|
+
// Colorize paths inside current grid items instantly
|
|
972
|
+
document.querySelectorAll('.icon-card-svg').forEach(svgWrapper => {
|
|
973
|
+
svgWrapper.style.color = selectedColor;
|
|
974
|
+
});
|
|
975
|
+
|
|
976
|
+
saveState();
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
function customColorInput(val) {
|
|
980
|
+
if (/^#[0-9A-F]{6}$/i.test(val) || val === 'currentColor') {
|
|
981
|
+
let foundSwatch = false;
|
|
982
|
+
document.querySelectorAll('.color-swatch').forEach(el => {
|
|
983
|
+
const swatchBg = el.style.backgroundColor;
|
|
984
|
+
if (val.toLowerCase() === swatchBg.toLowerCase() || (val === 'currentColor' && el.style.backgroundColor === 'currentColor')) {
|
|
985
|
+
el.classList.add('active');
|
|
986
|
+
foundSwatch = true;
|
|
987
|
+
} else {
|
|
988
|
+
el.classList.remove('active');
|
|
989
|
+
}
|
|
990
|
+
});
|
|
991
|
+
selectColorSwatch(val, null);
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
// Icon Selection & Direct Insertion
|
|
996
|
+
function selectIcon(cardId, name, weight) {
|
|
997
|
+
selectedIconName = cardId;
|
|
998
|
+
|
|
999
|
+
document.querySelectorAll('.icon-card').forEach(el => {
|
|
1000
|
+
el.classList.toggle('selected', el.dataset.cardId === cardId);
|
|
1001
|
+
});
|
|
1002
|
+
|
|
1003
|
+
insertIcon(name, weight);
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
function clearSelection() {
|
|
1007
|
+
selectedIconName = '';
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
function insertIcon(name, weight) {
|
|
1011
|
+
const item = window.REICON_DATA[name];
|
|
1012
|
+
const rawCode = item.weights[weight];
|
|
1013
|
+
const format = activeFormat;
|
|
1014
|
+
const sizeNum = parseInt(activeSize) || 24;
|
|
1015
|
+
|
|
1016
|
+
const snippet = getSnippet(name, weight, rawCode, format, sizeNum, selectedColor);
|
|
1017
|
+
|
|
1018
|
+
vscode.postMessage({
|
|
1019
|
+
type: 'insert-icon',
|
|
1020
|
+
snippet: snippet,
|
|
1021
|
+
name: `${toPascalCase(name)} (${weight})`
|
|
1022
|
+
});
|
|
1023
|
+
|
|
1024
|
+
showToast(`Inserted "${toPascalCase(name)}"`);
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
// Dropdown Menu & Preview Sizing Logic
|
|
1028
|
+
const dropdownMenu = document.getElementById('dropdown-menu');
|
|
1029
|
+
let currentPreviewSize = 24;
|
|
1030
|
+
|
|
1031
|
+
function toggleMenu(event) {
|
|
1032
|
+
event.stopPropagation();
|
|
1033
|
+
const isOpen = dropdownMenu.classList.toggle('show');
|
|
1034
|
+
updateMenuButton(isOpen);
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
window.addEventListener('click', (e) => {
|
|
1038
|
+
const toggleBtn = document.getElementById('menu-toggle-btn');
|
|
1039
|
+
if (dropdownMenu.classList.contains('show') && !dropdownMenu.contains(e.target) && e.target !== toggleBtn && !toggleBtn.contains(e.target)) {
|
|
1040
|
+
dropdownMenu.classList.remove('show');
|
|
1041
|
+
updateMenuButton(false);
|
|
1042
|
+
}
|
|
1043
|
+
});
|
|
1044
|
+
|
|
1045
|
+
function changePreviewSize(diff) {
|
|
1046
|
+
const nextSize = Math.max(16, Math.min(64, currentPreviewSize + diff));
|
|
1047
|
+
if (nextSize !== currentPreviewSize) {
|
|
1048
|
+
currentPreviewSize = nextSize;
|
|
1049
|
+
iconsGrid.style.setProperty('--grid-icon-size', currentPreviewSize + 'px');
|
|
1050
|
+
|
|
1051
|
+
customSizeInputEl.value = currentPreviewSize;
|
|
1052
|
+
activeSize = currentPreviewSize.toString();
|
|
1053
|
+
saveState();
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
function openExternalUrl(url) {
|
|
1058
|
+
vscode.postMessage({
|
|
1059
|
+
type: 'open-url',
|
|
1060
|
+
url: url
|
|
1061
|
+
});
|
|
1062
|
+
dropdownMenu.classList.remove('show');
|
|
1063
|
+
updateMenuButton(false);
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
function updateMenuButton(isOpen) {
|
|
1067
|
+
const toggleBtn = document.getElementById('menu-toggle-btn');
|
|
1068
|
+
if (isOpen) {
|
|
1069
|
+
toggleBtn.innerHTML = `
|
|
1070
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" height="16" width="16">
|
|
1071
|
+
<line x1="18" y1="6" x2="6" y2="18"></line>
|
|
1072
|
+
<line x1="6" y1="6" x2="18" y2="18"></line>
|
|
1073
|
+
</svg>
|
|
1074
|
+
`;
|
|
1075
|
+
} else {
|
|
1076
|
+
toggleBtn.innerHTML = `
|
|
1077
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" height="16" width="16">
|
|
1078
|
+
<path d="m4 8 16 0" stroke-width="2"></path>
|
|
1079
|
+
<path d="m4 16 16 0" stroke-width="2"></path>
|
|
1080
|
+
</svg>
|
|
1081
|
+
`;
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
// Toast Notification
|
|
1086
|
+
let toastTimeout;
|
|
1087
|
+
|
|
1088
|
+
function showToast(messageText) {
|
|
1089
|
+
const toastEl = document.getElementById('toast-notification');
|
|
1090
|
+
const toastMsgEl = document.getElementById('toast-message');
|
|
1091
|
+
|
|
1092
|
+
toastMsgEl.textContent = messageText;
|
|
1093
|
+
toastEl.classList.add('show');
|
|
1094
|
+
|
|
1095
|
+
clearTimeout(toastTimeout);
|
|
1096
|
+
toastTimeout = setTimeout(() => {
|
|
1097
|
+
toastEl.classList.remove('show');
|
|
1098
|
+
}, 2500);
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
function dismissToast(event) {
|
|
1102
|
+
if (event) event.stopPropagation();
|
|
1103
|
+
const toastEl = document.getElementById('toast-notification');
|
|
1104
|
+
toastEl.classList.remove('show');
|
|
1105
|
+
clearTimeout(toastTimeout);
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
// Run init
|
|
1109
|
+
window.onload = init;
|
|
1110
|
+
</script>
|
|
1111
|
+
</body>
|
|
1112
|
+
</html>
|