-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
1475 lines (1287 loc) · 62.5 KB
/
Copy pathindex.html
File metadata and controls
1475 lines (1287 loc) · 62.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<script type="text/javascript">
var gk_isXlsx = false;
var gk_xlsxFileLookup = {};
var gk_fileData = {};
function filledCell(cell) {
return cell !== '' && cell != null;
}
function loadFileData(filename) {
if (gk_isXlsx && gk_xlsxFileLookup[filename]) {
try {
var workbook = XLSX.read(gk_fileData[filename], { type: 'base64' });
var firstSheetName = workbook.SheetNames[0];
var worksheet = workbook.Sheets[firstSheetName];
// Convert sheet to JSON to filter blank rows
var jsonData = XLSX.utils.sheet_to_json(worksheet, { header: 1, blankrows: false, defval: '' });
// Filter out blank rows (rows where all cells are empty, null, or undefined)
var filteredData = jsonData.filter(row => row.some(filledCell));
// Heuristic to find the header row by ignoring rows with fewer filled cells than the next row
var headerRowIndex = filteredData.findIndex((row, index) =>
row.filter(filledCell).length >= filteredData[index + 1]?.filter(filledCell).length
);
// Fallback
if (headerRowIndex === -1 || headerRowIndex > 25) {
headerRowIndex = 0;
}
// Convert filtered JSON back to CSV
var csv = XLSX.utils.aoa_to_sheet(filteredData.slice(headerRowIndex)); // Create a new sheet from filtered array of arrays
csv = XLSX.utils.sheet_to_csv(csv, { header: 1 });
return csv;
} catch (e) {
console.error(e);
return "";
}
}
return gk_fileData[filename] || "";
}
</script><!DOCTYPE html>
<html>
<head>
<title>Design System Watcher</title>
<style>
/* Design tokens */
:root {
--font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
--font-size-body: 12px; /* Figma UI base size */
--font-size-title: 16px; /* Panel title */
--radius: 6px;
--space-1: 4px;
--space-2: 8px;
--space-3: 12px;
--space-4: 16px;
--border: 1px solid rgba(0,0,0,0.1);
/* Light theme (Figma-like) */
--bg: #ffffff;
--bg-subtle: #f5f5f5;
--text: #111115;
--text-subtle: #6b6b70;
--primary: #007be5; /* Share button */
--primary-hover: #0a6fd1;
--primary-text: #ffffff;
--stroke: rgba(0,0,0,0.08);
--focus: #18a0fb;
}
/* Dark theme */
:root[data-theme="dark"] {
--bg: #1e1f22;
--bg-subtle: #2a2b2f;
--text: #ececf1;
--text-subtle: #a9a9b2;
--primary: #0a84ff;
--primary-hover: #0873da;
--primary-text: #ffffff;
--stroke: rgba(255,255,255,0.12);
--focus: #0a84ff;
}
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font-family); font-size: var(--font-size-body); }
#root { padding: var(--space-4); }
/* Eklenti içi sabit ölçüler: üst padding (16) + topbar (+h1 margin) ~ 48, alt padding (16) + footer (40) = 56, toplam 104. Küçük pay ile 108 kullan */
h1 { font-size: var(--font-size-title); margin: 0 0 var(--space-3); font-weight: 600; }
/* Alert */
.alert { display: none; align-items: center; gap: var(--space-2); padding: 10px 12px; border-radius: 10px; border: 1px solid var(--stroke); background: var(--bg-subtle); margin-bottom: var(--space-3); }
.alert-error { border-color: #ff3b30; background: rgba(255,59,48,0.08); }
.alert .icon { width: 16px; height: 16px; border-radius: 999px; background: #ff3b30; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 12px; }
.alert .msg { color: #111; font-size: 12px; display: flex; flex-direction: column; gap: 6px; }
.alert .msg .error-settings-link { color: var(--primary); font-weight: 600; text-decoration: none; }
.alert .msg .error-settings-link:hover { text-decoration: underline; }
:root[data-theme="dark"] .alert .msg { color: var(--text); }
/* Tabs */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-3); }
.brand { display: flex; align-items: center; gap: var(--space-2); }
.logo { width: 32px; height: 32px; border-radius: 999px; display: grid; place-items: center; background: var(--bg-subtle); border: 1px solid var(--stroke); }
.arrow { color: var(--text-subtle); font-weight: 600; }
.tabs { display: flex; gap: var(--space-2); }
.tab { padding: var(--space-2) var(--space-3); border-radius: var(--radius); color: var(--text-subtle); background: transparent; border: none; cursor: pointer; }
.tab.active { background: var(--bg-subtle); color: var(--text); font-weight: 500; }
/* Buttons */
.btn {
appearance: none;
border: none;
border-radius: 8px;
padding: 10px 14px;
font-weight: 600;
cursor: pointer;
font-family: inherit;
font-size: 12px;
transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
position: relative;
overflow: hidden;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary {
background: var(--primary);
color: var(--primary-text);
box-shadow: inset 0 -1px 0 rgba(0,0,0,0.15);
}
.btn-primary::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
transition: left 0.5s ease;
z-index: 1;
}
.btn-primary:hover:not(:disabled)::before {
left: 100%;
}
.btn-primary:hover:not(:disabled) {
background: var(--primary-hover);
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}
.btn-secondary {
background: var(--bg);
color: var(--text);
border: 1px solid var(--stroke);
}
.btn-secondary::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(90deg, transparent, rgba(0,0,0,0.05), transparent);
transition: left 0.5s ease;
z-index: 1;
}
.btn-secondary:hover:not(:disabled)::before {
left: 100%;
}
.btn-secondary:hover:not(:disabled) {
background: var(--bg-subtle);
transform: translateY(-1px);
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
/* Loading bar */
.loading { height: 8px; width: 100%; background: var(--bg-subtle); border: 1px solid var(--stroke); border-radius: 999px; overflow: hidden; }
.loading > span { display: block; height: 100%; width: 40%; background: var(--focus); border-radius: 999px; animation: load 1s infinite ease-in-out; }
@keyframes load { 0%{ transform: translateX(-50%);} 50%{ transform: translateX(150%);} 100%{ transform: translateX(350%);} }
/* Inputs */
.field { display: flex; flex-direction: column; gap: var(--space-1); margin-bottom: var(--space-3); }
.settings-section .field:last-child { margin-bottom: 0; }
.label { color: var(--text-subtle); font-size: 11px; cursor: pointer; }
.input, .textarea, .select { width: 100%; border: 1px solid var(--stroke); background: var(--bg); color: var(--text); border-radius: var(--radius); padding: 8px 10px; font-family: inherit; font-size: 12px; outline: none; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--focus); box-shadow: 0 0 0 2px rgba(24,160,251,0.2); }
.textarea { min-height: 64px; resize: vertical; }
/* Checks */
.checks { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: var(--space-2); margin-bottom: 0; }
.check { display: flex; align-items: center; gap: var(--space-2); font-size: 12px; }
.check input[type="checkbox"] {
appearance: none;
width: 16px;
height: 16px;
border: 1px solid var(--stroke);
border-radius: 3px;
background: var(--bg);
cursor: pointer;
position: relative;
transition: all 0.2s ease;
}
.check input[type="checkbox"]:checked {
background: #007be5;
border-color: #007be5;
}
.check input[type="checkbox"]:checked::after {
content: '';
position: absolute;
left: 50%;
top: 50%;
width: 3px;
height: 6px;
border: solid white;
border-width: 0 2px 2px 0;
transform: translate(-50%, -60%) rotate(45deg);
}
.check input[type="checkbox"]:hover {
border-color: var(--focus);
}
/* Radios: native görünüm, yuvarlak ve tema rengine uyumlu */
.check input[type="radio"] {
appearance: auto; /* varsayılan dairesel görünüm */
width: 14px;
height: 14px;
accent-color: var(--focus);
cursor: pointer;
}
/* Panel */
.panel { background: var(--bg); padding: 0; }
.panel + .panel { margin-top: var(--space-3); }
#console-output { background: var(--bg-subtle); border-radius: 12px; }
/* Footer */
.footer {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background: var(--bg);
padding: var(--space-2) var(--space-3);
border-top: 1px solid var(--stroke);
text-align: center;
z-index: 1000;
height: 40px;
box-sizing: border-box;
}
.footer-text { font-size: 11px; color: var(--text-subtle); }
.footer-link { color: var(--text-subtle); text-decoration: none; cursor: pointer; }
.footer-link:hover { color: var(--focus); }
/* Add bottom padding to body to prevent content overlap */
body { padding-bottom: 40px; }
/* Console output separator */
#console-output {
border-top: 1px solid var(--stroke);
margin-top: var(--space-3);
padding: 12px;
font-family: var(--font-family);
line-height: 1.5;
}
/* Markdown styling for console output */
#console-output strong {
font-weight: 600;
color: var(--text);
}
#console-output em {
font-style: italic;
color: var(--text-subtle);
}
#console-output code {
background: var(--bg-subtle);
padding: 2px 4px;
border-radius: 3px;
font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
font-size: 11px;
}
/* Variable changes table */
.variable-table {
width: 100%;
border-collapse: collapse;
margin: var(--space-2) 0;
}
.variable-table th,
.variable-table td {
padding: var(--space-2);
text-align: left;
border-bottom: 1px solid var(--stroke);
}
.variable-table th {
font-weight: 600;
color: var(--text);
background: var(--bg-subtle);
}
.variable-table td {
font-size: 11px;
color: var(--text-subtle);
}
.variable-table td:first-child {
font-weight: 500;
color: var(--text);
}
.variable-table td:last-child {
font-weight: 600;
color: var(--text);
}
/* Chips for template variables */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border: 1px solid var(--stroke); background: var(--bg); color: var(--text); border-radius: 999px; font-size: 11px; cursor: grab; user-select: none; }
.chip:hover { background: var(--bg-subtle); }
.chip .token { color: var(--text-subtle); font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace; }
.textarea.droppable { outline: 2px dashed var(--focus); outline-offset: 2px; }
/* Settings panel scroll */
#settings-panel {
height: calc(100vh - 135px);
overflow-y: auto;
padding-bottom: var(--space-4);
}
/* Settings panel için custom scrollbar (global gizlemeyi geçersiz kılar) */
#settings-panel { scrollbar-width: thin; scrollbar-color: rgba(127,127,127,0.5) transparent; }
#settings-panel::-webkit-scrollbar { width: 8px; height: 8px; display: block !important; }
#settings-panel::-webkit-scrollbar-track { background: transparent; }
:root[data-theme="light"] #settings-panel::-webkit-scrollbar-thumb { background-color: rgba(0,0,0,0.25); border-radius: 8px; }
:root[data-theme="dark"] #settings-panel::-webkit-scrollbar-thumb { background-color: rgba(255,255,255,0.25); border-radius: 8px; }
#settings-panel::-webkit-scrollbar-thumb:hover { background-color: rgba(100,100,100,0.35); }
/* Settings panel içeriği için padding ayarla */
#settings-panel .panel {
padding-bottom: var(--space-4); /* Theme'in tam görünmesi için */
}
/* Password toggle */
.input-wrapper { position: relative; }
/* Icon container: input içinde konumlandırılır */
.icon-container { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }
/* Icon button: ortalı, paddingli ve arka planlı */
.icon-btn { display: grid; place-items: center; padding: 4px; background: var(--bg); border: 1px solid var(--stroke); border-radius: 6px; color: var(--text-subtle); cursor: pointer; transition: background-color .2s ease, color .2s ease; }
.icon-btn:hover { color: var(--text); }
:root[data-theme="light"] .icon-btn:hover { background: #e7e9ec; }
:root[data-theme="dark"] .icon-btn:hover { background: #33363b; }
.password-toggle, .current-page-btn { border: none; } /* buton reset, stiller icon-btn'den gelir */
/* Custom scrollbar - completely hidden everywhere */
* {
scrollbar-width: none; /* Firefox */
-ms-overflow-style: none; /* IE and Edge */
}
*::-webkit-scrollbar {
display: none; /* Chrome, Safari, Opera */
}
/* Settings hover effects */
.settings-section {
border-radius: 8px;
transition: background-color 0.3s ease, transform 0.2s ease;
cursor: default;
margin-bottom: 8px; /* Section'lar arası 8px boşluk */
padding: var(--space-4); /* İçerik için padding */
position: relative;
overflow: hidden;
background: var(--bg-subtle); /* Varsayılan bg hover rengine eşit */
}
.settings-section::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
transition: left 0.5s ease;
z-index: 1;
}
.settings-section:hover::before {
left: 100%;
}
.settings-section:hover {
/* Hover'da bg değişmez, sadece parlama efekti çalışır */
}
/* How to use page */
.help-page-link { color: var(--primary); font-weight: 600; text-decoration: none; font-size: 12px; }
.help-page-link:hover { text-decoration: underline; }
.help-panel { max-height: 520px; overflow-y: auto; padding-right: 4px; }
.help-content { font-size: 11px; line-height: 1.45; color: var(--text); }
.help-content h2 { font-size: 14px; margin: 0 0 8px; font-weight: 600; }
.help-content h3 { font-size: 12px; margin: 14px 0 6px; font-weight: 600; }
.help-content p { margin: 0 0 8px; }
.help-content ul, .help-content ol { margin: 4px 0 10px; padding-left: 18px; }
.help-content li { margin-bottom: 4px; }
.help-content code { background: var(--bg-subtle); padding: 1px 4px; border-radius: 4px; font-size: 10px; }
.help-content a { color: var(--primary); text-decoration: none; }
.help-content a:hover { text-decoration: underline; }
.help-footer { margin-top: 12px; font-size: 10px; color: var(--text-subtle); }
</style>
</head>
<body>
<div id="root">
<div id="error-banner" class="alert alert-error">
<div class="icon">!</div>
<div class="msg">
<span id="error-text">Error message</span>
<a href="#" id="error-open-settings" class="error-settings-link">Open Settings</a>
</div>
</div>
<div class="topbar">
<div class="brand">
<div class="logo" aria-label="Figma">
<!-- Official Figma logo -->
<svg width="16" height="16" viewBox="0 0 200 300" xmlns="http://www.w3.org/2000/svg">
<path d="M50 300c27.6 0 50-22.4 50-50v-50H50c-27.6 0-50 22.4-50 50s22.4 50 50 50z" fill="#0ACF83"/>
<path d="M0 150c0-27.6 22.4-50 50-50h50v100H50c-27.6 0-50-22.4-50-50z" fill="#A259FF"/>
<path d="M0 50C0 22.4 22.4 0 50 0h50v100H50c-27.6 0-50-22.4-50-50z" fill="#F24E1E"/>
<path d="M100 0h50c27.6 0 50 22.4 50 50s-22.4 50-50 50h-50V0z" fill="#FF7262"/>
<path d="M200 150c0 27.6-22.4 50-50 50s-50-22.4-50-50 22.4-50 50-50 50 22.4 50 50z" fill="#1ABCFE"/>
</svg>
</div>
<span class="arrow">→</span>
<div class="logo" aria-label="Slack">
<!-- Official Slack logo PNG -->
<img src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPgo8c3ZnIHdpZHRoPSI4MDBweCIgaGVpZ2h0PSI4MDBweCIgdmlld0JveD0iLTIuNDUgMCAyNDUyLjUgMjQ1Mi41IiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCAyNDQ3LjYgMjQ1Mi41IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgoNPGcgY2xpcC1ydWxlPSJldmVub2RkIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgoNPHBhdGggZD0ibTg5Ny40IDBjLTEzNS4zLjEtMjQ0LjggMTA5LjktMjQ0LjcgMjQ1LjItLjEgMTM1LjMgMTA5LjUgMjQ1LjEgMjQ0LjggMjQ1LjJoMjQ0Ljh2LTI0NS4xYy4xLTEzNS4zLTEwOS41LTI0NS4xLTI0NC45LTI0NS4zLjEgMCAuMSAwIDAgMG0wIDY1NGgtNjUyLjZjLTEzNS4zLjEtMjQ0LjkgMTA5LjktMjQ0LjggMjQ1LjItLjIgMTM1LjMgMTA5LjQgMjQ1LjEgMjQ0LjcgMjQ1LjNoNjUyLjdjMTM1LjMtLjEgMjQ0LjktMTA5LjkgMjQ0LjgtMjQ1LjIuMS0xMzUuNC0xMDkuNS0yNDUuMi0yNDQuOC0yNDUuM3oiIGZpbGw9IiMzNmM1ZjAiLz4KDTxwYXRoIGQ9Im0yNDQ3LjYgODk5LjJjLjEtMTM1LjMtMTA5LjUtMjQ1LjEtMjQ0LjgtMjQ1LjItMTM1LjMuMS0yNDQuOSAxMDkuOS0yNDQuOCAyNDUuMnYyNDUuM2gyNDQuOGMxMzUuMy0uMSAyNDQuOS0xMDkuOSAyNDQuOC0yNDUuM3ptLTY1Mi43IDB2LTY1NGMuMS0xMzUuMi0xMDkuNC0yNDUtMjQ0LjctMjQ1LjItMTM1LjMuMS0yNDQuOSAxMDkuOS0yNDQuOCAyNDUuMnY2NTRjLS4yIDEzNS4zIDEwOS40IDI0NS4xIDI0NC43IDI0NS4zIDEzNS4zLS4xIDI0NC45LTEwOS45IDI0NC44LTI0NS40eiIgZmlsbD0iIzJlYjY3ZCIvPgoNPHBhdGggZD0ibTE1NTAuMSAyNDUyLjVjMTM1LjMtLjEgMjQ0LjktMTA5LjkgMjQ0LjgtMjQ1LjIuMS0xMzUuMy0xMDkuNS0yNDUuMS0yNDQuOC0yNDUuMmgtMjQ0Ljh2MjQ1LjJjLS4xIDEzNS4yIDEwOS41IDI0NSAyNDQuOCAyNDUuMnptMC02NTQuMWg2NTIuN2MxMzUuMy0uMSAyNDQuOS0xMDkuOSAyNDQuOC0yNDUuMi4yLTEzNS4zLTEwOS40LTI0NS4xLTI0NC43LTI0NS4zaC02NTIuN2MtMTM1LjMuMS0yNDQuOSAxMDkuOS0yNDQuOCAyNDUuMi0uMSAxMzUuNCAxMDkuNCAyNDUuMiAyNDQuNyAyNDUuM3oiIGZpbGw9IiNlY2IyMmUiLz4KDTxwYXRoIGQ9Im0wIDE1NTMuMmMtLjEgMTM1LjMgMTA5LjUgMjQ1LjEgMjQ0LjggMjQ1LjIgMTM1LjMtLjEgMjQ0LjktMTA5LjkgMjQ0LjgtMjQ1LjJ2LTI0NS4yaC0yNDQuOGMtMTM1LjMuMS0yNDQuOSAxMDkuOS0yNDQuOCAyNDUuMnptNjUyLjcgMHY2NTRjLS4yIDEzNS4zIDEwOS40IDI0NS4xIDI0NC43IDI0NS4zIDEzNS4zLS4xIDI0NC45LTEwOS45IDI0NC44LTI0NS40di02NTMuOWMuMi0xMzUuMy0xMDkuNC0yNDUuMS0yNDQuNy0yNDUuMy0xMzUuNCAwLTI0NC45IDEwOS44LTI0NC44IDI0NS4xIDAgMCAwIC4xIDAgMCIgZmlsbD0iI2UwMWU1YSIvPgoNPC9nPgoNPC9zdmc+" width="16" height="16" alt="Slack" />
</div>
</div>
<div class="tabs">
<button class="tab active" type="button" id="plugin-tab">Plugin</button>
<button class="tab" type="button" id="settings-tab">Settings</button>
</div>
</div>
<div id="plugin-panel" class="panel">
<h1>Design System Watcher</h1>
<p id="status">Click "Check Updates" to scan for changes...</p>
<div style="display:flex; gap: var(--space-2); margin: var(--space-3) 0;">
<button id="test-btn" class="btn btn-primary" type="button">Check Updates</button>
</div>
</div>
<div id="settings-panel" class="panel" style="display:none;">
<div id="settings-form-wrap">
<!-- Settings heading kaldırıldı -->
<div class="field settings-section">
<label class="caption">Configuration</label>
<div class="field" style="margin-top: 8px;">
<label class="label" for="slack-webhook-url">Slack Webhook URL</label>
<input id="slack-webhook-url" class="input" type="url" placeholder="https://hooks.slack.com/triggers/..." />
</div>
<div class="field">
<label class="label" for="figma-api-token">Figma API Token</label>
<div class="input-wrapper">
<input id="figma-api-token" class="input" type="password" placeholder="figd_..." />
<div class="icon-container">
<button type="button" class="icon-btn password-toggle" onclick="togglePasswordVisibility()">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/>
<circle cx="12" cy="12" r="3"/>
</svg>
</button>
</div>
</div>
</div>
<div class="field">
<label class="label" for="figma-file-url">Figma File URL</label>
<div class="input-wrapper">
<input id="figma-file-url" class="input" type="url" placeholder="Please use Figma's Share > Copy link and paste it here." />
<div class="icon-container">
<button type="button" class="icon-btn current-page-btn" onclick="fillCurrentPageUrl()" title="Use current page URL">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
<polyline points="14,2 14,8 20,8"></polyline>
<line x1="16" y1="13" x2="8" y2="13"></line>
<line x1="16" y1="17" x2="8" y2="17"></line>
<polyline points="10,9 9,9 8,9"></polyline>
</svg>
</button>
</div>
</div>
</div>
<div class="field" style="margin-top: var(--space-2);">
<a href="#" id="how-to-use-link" class="help-page-link">How to use this plugin?</a>
</div>
</div>
<div class="field settings-section">
<label class="caption">Message Template</label>
<div class="field" style="margin-top: 8px;">
<label class="label" for="slack-message-template">Slack Message</label>
<textarea id="slack-message-template" class="textarea" placeholder="Customize your Slack message..." rows="6">🎨 **Design System Watcher**
📁 **File**: {fileName}
📅 **Date**: {date}
🔗 **Link**: {fileLink}
{changes}
📊 **Summary**:
• Components: {totalComponents}
• Styles: {totalStyles}
• Variables: {totalVariables}</textarea>
<div id="template-chips" class="chip-row"></div>
</div>
</div>
<div class="field settings-section">
<label class="caption">Scope</label>
<div class="checks" style="margin-top: 8px; display: flex; flex-direction: column; gap: 8px;">
<label class="check"><input type="checkbox" name="scope" value="variables" checked /> Variables</label>
<label class="check"><input type="checkbox" name="scope" value="color-styles" checked /> Color Styles</label>
<label class="check"><input type="checkbox" name="scope" value="type-styles" checked /> Type Styles</label>
<label class="check"><input type="checkbox" name="scope" value="components" checked /> Components</label>
</div>
</div>
<div class="field settings-section">
<label class="caption">Slack Delivery</label>
<div class="checks" style="margin-top: 8px; display: flex; flex-direction: column; gap: 8px;">
<label class="check"><input type="checkbox" id="send-to-slack-enabled" checked /> Send messages to Slack</label>
<span class="label" style="margin-left: 24px; color: var(--text-subtle);">When disabled, results only appear in Plugin tab.</span>
</div>
</div>
<div class="field settings-section">
<label class="caption">Theme</label>
<div class="checks" style="margin-top: 8px;">
<label class="check"><input type="radio" name="theme" value="system" checked /> System</label>
<label class="check"><input type="radio" name="theme" value="light" /> Light</label>
<label class="check"><input type="radio" name="theme" value="dark" /> Dark</label>
</div>
</div>
<!-- Save Changes Button -->
<div class="field" style="margin-top: var(--space-4);">
<button id="save-changes-btn" class="btn btn-primary" style="width: 100%;">
Save Changes
</button>
</div>
</div>
<div id="help-panel" class="panel help-panel" style="display:none;">
<a href="#" id="back-to-settings-link" class="help-page-link" style="display:inline-block; margin-bottom: 8px;">← Back to Settings</a>
<div class="help-content">
<h2>Design System Watcher — Usage Guide</h2>
<p>Design System Watcher tracks <strong>design system</strong> changes in your Figma file (variables, color/text/effect/grid styles, components and variants) and optionally sends a summary message to <strong>Slack</strong>.</p>
<h3>1. Running the Plugin in Figma</h3>
<ol>
<li>Open a file in Figma (the file that contains your design system).</li>
<li>From the menu, go to <strong>Plugins</strong> → <strong>Development</strong> → <strong>Import plugin from manifest…</strong>.</li>
<li>Navigate to this project’s folder and select the <strong>manifest.json</strong> file (or the whole folder).</li>
<li>The plugin is added to your list. Run it via <strong>Plugins</strong> → <strong>Development</strong> → <strong>Design System Watcher</strong>.</li>
</ol>
<p>On first run you need to configure settings; otherwise you’ll see “Please fill Slack Webhook URL and Figma API Token in Settings”. Use <strong>Open Settings</strong> in the error box to go straight to the Settings tab.</p>
<h3>2. Initial Setup (Settings)</h3>
<p>In the <strong>Settings</strong> tab, fill in the fields below and save with <strong>Save Changes</strong>.</p>
<p><strong>Required:</strong> Slack Webhook URL, Figma API Token.</p>
<p><strong>How to get a Slack Webhook URL:</strong> Slack recommends using an <strong>App</strong>. Go to <a href="https://api.slack.com/apps" target="_blank" rel="noopener">api.slack.com/apps</a> → Create New App → From scratch → enable <strong>Incoming Webhooks</strong> → Add New Webhook to Workspace → copy the Webhook URL → paste it into the plugin’s <strong>Slack Webhook URL</strong> field.</p>
<p><strong>Figma API Token:</strong> Figma → profile (top left) → Help and account → Account settings → Security tab → Personal access tokens → Generate new token (name it, set longest expiration, select all scopes; webhook optional). Paste the value into <strong>Figma API Token</strong> in the plugin.</p>
<p><strong>Optional:</strong> Figma File URL (for the link in Slack messages). Use the page icon next to the field to fill the current file link.</p>
<h3>3. Message Template</h3>
<p>Edit the text sent to Slack. Placeholders: <code>{fileName}</code>, <code>{date}</code>, <code>{fileLink}</code>, <code>{changes}</code>, <code>{totalComponents}</code>, <code>{totalStyles}</code>, <code>{totalVariables}</code>. Drag the chips into the text area to insert tokens.</p>
<h3>4. Scope</h3>
<p>Choose what to track: <strong>Variables</strong>, <strong>Color Styles</strong>, <strong>Type Styles</strong>, <strong>Components</strong>. Only selected items appear in results and in Slack.</p>
<h3>5. Slack Delivery</h3>
<p>If <strong>Send messages to Slack</strong> is checked, the summary is sent to Slack after Check Updates. If unchecked, results only show in the Plugin tab.</p>
<h3>6. Theme</h3>
<p><strong>System</strong>, <strong>Light</strong>, or <strong>Dark</strong>. Affects only the plugin UI.</p>
<h3>7. Daily Use</h3>
<ol>
<li>Open the plugin → <strong>Plugin</strong> tab → click <strong>Check Updates</strong>.</li>
<li>The plugin scans the file and compares with the previous run.</li>
<li>Results show in the window (and in Slack if enabled). On first run you see a summary; later only <strong>changed</strong> items.</li>
</ol>
<h3>8. Common Issues</h3>
<ul>
<li><strong>“Please fill Slack Webhook URL and Figma API Token”</strong> — Fill both in Settings and click Save Changes.</li>
<li><strong>Window too small</strong> — It should auto-resize; if not, close and reopen the plugin.</li>
<li><strong>Messages not reaching Slack</strong> — Check webhook URL and “Send messages to Slack” is on.</li>
<li><strong>“Locate missing manifest”</strong> — Import the project folder that contains manifest.json.</li>
</ul>
<h3>9. Summary</h3>
<p><strong>What it does:</strong> Detects design system changes; shows results in the plugin and optionally sends them to Slack.</p>
<p><strong>Required:</strong> Slack Webhook URL + Figma API Token (in Settings).</p>
<p><strong>How to use:</strong> Plugin tab → Check Updates.</p>
<p><strong>Data:</strong> Stored in Figma plugin storage; Slack is only what you configure.</p>
<p class="help-footer">Design System Watcher v2.0.0 — Creator: halil nuroğlu</p>
</div>
</div>
</div>
<div id="console-output" class="panel" style="display:none; font-family: monospace; max-height: 220px; overflow-y: auto; white-space: pre-wrap;"></div>
<div class="footer">
<div class="footer-text">
v2.0.0 • Creator: <a href="https://x.com/haibnu" target="_blank" class="footer-link">halil nuroğlu</a> • <a href="https://buymeacoffee.com/FeSQMyY" target="_blank" class="footer-link">Buy me a coffee</a>
</div>
</div>
</div>
<script>
// Scope ayarlarını al
function getScopeSettings() {
const scopeCheckboxes = document.querySelectorAll('input[name="scope"]:checked');
return Array.from(scopeCheckboxes).map(cb => cb.value);
}
// Scope'a göre değişiklikleri filtrele
function filterChangesByScope(changes, scopeSettings) {
const filteredChanges = [];
changes.forEach(change => {
const changeText = change.toLowerCase();
// Variables kontrolü - "New Variables", "Updated Variables", "Removed Variables"
if ((changeText.includes('variables') || changeText.includes('variable')) && !scopeSettings.includes('variables')) {
return; // Variables scope kapalıysa atla
}
// Color Styles kontrolü
if (changeText.includes('color styles') && !scopeSettings.includes('color-styles')) {
return; // Color styles scope kapalıysa atla
}
// Text Styles kontrolü
if (changeText.includes('text styles') && !scopeSettings.includes('type-styles')) {
return; // Type styles scope kapalıysa atla
}
// Effect Styles kontrolü (color-styles'a dahil)
if (changeText.includes('effect styles') && !scopeSettings.includes('color-styles')) {
return; // Color styles scope kapalıysa atla
}
// Grid Styles kontrolü (type-styles'a dahil)
if (changeText.includes('grid styles') && !scopeSettings.includes('type-styles')) {
return; // Type styles scope kapalıysa atla
}
// Components kontrolü
if ((changeText.includes('components') || changeText.includes('component')) && !scopeSettings.includes('components')) {
return; // Components scope kapalıysa atla
}
// "No changes detected" mesajı her zaman gösterilsin
if (changeText.includes('no changes detected')) {
filteredChanges.push(change);
return;
}
// "First run" mesajı her zaman gösterilsin
if (changeText.includes('first run')) {
filteredChanges.push(change);
return;
}
filteredChanges.push(change);
});
return filteredChanges;
}
// Configuration functions
function getSlackWebhookUrl() {
return document.getElementById('slack-webhook-url').value || "";
}
function getFigmaApiToken() {
return document.getElementById('figma-api-token').value || "";
}
function getFigmaFileUrl() {
return document.getElementById('figma-file-url').value || "";
}
// Current page URL'yi doldur
function fillCurrentPageUrl() {
// Figma'dan fileKey'i al
parent.postMessage({
pluginMessage: {
type: 'get-current-file-url'
}
}, '*');
}
function getSlackMessageTemplate() {
return document.getElementById('slack-message-template').value || `🎨 **Design System Watcher**
📁 **File**: {fileName}
📅 **Date**: {date}
🔗 **Link**: {fileLink}
{changes}
📊 **Summary**:
• Components: {totalComponents}
• Styles: {totalStyles}
• Variables: {totalVariables}`;
}
function formatSlackMessage(template, data) {
return template
.replace(/{fileName}/g, data.fileName || 'Unknown')
.replace(/{date}/g, data.date || new Date().toLocaleDateString('tr-TR'))
.replace(/{fileLink}/g, data.fileLink || 'https://figma.com')
.replace(/{changes}/g, data.changes ? data.changes.join('\n') : 'No changes detected')
.replace(/{totalComponents}/g, data.totalComponents || 0)
.replace(/{totalStyles}/g, data.totalStyles || 0)
.replace(/{totalVariables}/g, data.totalVariables || 0);
}
function parseMarkdown(text) {
return text
.replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>') // **bold**
.replace(/\*(.*?)\*/g, '<em>$1</em>') // *italic*
.replace(/`(.*?)`/g, '<code>$1</code>') // `code`
.replace(/\n/g, '<br>'); // line breaks
}
function formatVariableValue(value) {
if (typeof value === 'object' && value !== null) {
// Eğer value bir obje ise, içindeki değerleri al
if (value.r !== undefined && value.g !== undefined && value.b !== undefined) {
// RGB değeri ise hex'e çevir
const r = Math.round(value.r * 255);
const g = Math.round(value.g * 255);
const b = Math.round(value.b * 255);
return `#${r.toString(16).padStart(2, '0')}${g.toString(16).padStart(2, '0')}${b.toString(16).padStart(2, '0')}`.toUpperCase();
} else if (value.value !== undefined) {
// Nested value ise recursive olarak parse et
return formatVariableValue(value.value);
} else {
// Diğer objeler için string'e çevir
return JSON.stringify(value);
}
}
return String(value);
}
// Mode ID'lerini gerçek mode isimlerine çevir
function getModeName(modeId) {
// Figma'nın standart mode isimleri
const modeNames = {
'7392:0': 'Light',
'7392:1': 'Dark',
'7392:2': 'Dark',
'7392:3': 'System'
};
// Eğer bilinen bir mode ID'si ise döndür, değilse ID'yi kullan
return modeNames[modeId] || modeId;
}
// Style değişiklikleri için tablo oluştur
function createStyleTable(changedStyles, currentStyles, previousStyles) {
if (changedStyles.length === 0) return '';
let tableHTML = '<table class="variable-table"><thead><tr><th>Style</th><th>Old Value</th><th>New Value</th></tr></thead><tbody>';
changedStyles.slice(0, 5).forEach(id => {
const current = currentStyles[id];
const previous = previousStyles[id];
// Name değişikliği
if (current.name !== previous.name) {
tableHTML += `<tr><td>Style Name</td><td>${previous.name}</td><td><strong>${current.name}</strong></td></tr>`;
}
// Type değişikliği
if (current.type !== previous.type) {
tableHTML += `<tr><td>Style Type</td><td>${previous.type}</td><td><strong>${current.type}</strong></td></tr>`;
}
});
tableHTML += '</tbody></table>';
return tableHTML;
}
function createVariableTable(changedVariables, currentVars, previousVars) {
if (changedVariables.length === 0) return '';
let tableHTML = '<table class="variable-table"><thead><tr><th>Variable</th><th>Old Value</th><th>New Value</th></tr></thead><tbody>';
changedVariables.slice(0, 5).forEach(id => {
const current = currentVars[id];
const previous = previousVars[id];
if (JSON.stringify(current.value) !== JSON.stringify(previous.value)) {
const oldValues = Object.keys(previous.value).map(modeId => {
const value = previous.value[modeId];
const formattedValue = formatVariableValue(value);
const modeName = getModeName(modeId);
return `${modeName}: ${formattedValue}`;
}).join('<br>');
const newValues = Object.keys(current.value).map(modeId => {
const value = current.value[modeId];
const formattedValue = formatVariableValue(value);
const modeName = getModeName(modeId);
return `${modeName}: ${formattedValue}`;
}).join('<br>');
tableHTML += `<tr><td>${current.name}</td><td>${oldValues}</td><td><strong>${newValues}</strong></td></tr>`;
}
});
tableHTML += '</tbody></table>';
return tableHTML;
}
function togglePasswordVisibility() {
const input = document.getElementById('figma-api-token');
const button = document.querySelector('.password-toggle svg');
if (input.type === 'password') {
input.type = 'text';
button.innerHTML = `
<path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"/>
<line x1="1" y1="1" x2="23" y2="23"/>
`;
} else {
input.type = 'password';
button.innerHTML = `
<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/>
<circle cx="12" cy="12" r="3"/>
`;
}
}
// Theme handling
const root = document.documentElement;
let currentTheme = 'system';
function applyTheme(theme) {
if (theme === 'system') {
const prefersDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
root.setAttribute('data-theme', prefersDark ? 'dark' : 'light');
} else {
root.setAttribute('data-theme', theme);
}
}
function initThemeControls() {
const radios = Array.from(document.querySelectorAll('input[name="theme"]'));
const initial = currentTheme;
const selected = radios.find(r => r.value === initial) || radios[2];
if (selected) selected.checked = true;
applyTheme(initial);
radios.forEach(r => r.addEventListener('change', () => {
currentTheme = r.value;
applyTheme(currentTheme);
}));
// React to system changes when in system mode
if (window.matchMedia) {
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
if (currentTheme === 'system') applyTheme('system');
});
}
}
// Pencere boyutunu içeriğe göre ayarla
function resizeToContent() {
const pluginPanel = document.getElementById('plugin-panel');
const settingsPanel = document.getElementById('settings-panel');
const helpPanel = document.getElementById('help-panel');
const settingsFormWrap = document.getElementById('settings-form-wrap');
const consoleOutput = document.getElementById('console-output');
let targetHeight = 300;
if (settingsPanel.style.display !== 'none' && helpPanel && helpPanel.style.display !== 'none') {
const headerHeight = 80;
const contentHeight = helpPanel.scrollHeight || 400;
targetHeight = Math.min(Math.max(contentHeight + headerHeight, 350), 600);
} else if (settingsPanel.style.display !== 'none' && (!settingsFormWrap || settingsFormWrap.style.display !== 'none')) {
// Settings tab aktif, form görünür - içeriğe göre dinamik yükseklik
const settingsContent = settingsFormWrap || settingsPanel;
if (settingsContent) {
const contentHeight = settingsContent.scrollHeight;
// Header (tabs) + padding için 80px ekle
const headerHeight = 80;
const totalContentHeight = contentHeight + headerHeight;
// Maximum 700px, minimum 400px
targetHeight = Math.min(Math.max(totalContentHeight, 400), 700);
} else {
// Fallback: sabit yükseklik
targetHeight = 700;
}
} else if (pluginPanel.style.display !== 'none') {
// Plugin tab aktif - içeriğe göre ayarla
const pluginContent = pluginPanel.querySelector('.panel');
const hasResults = consoleOutput.style.display !== 'none';
const errorBanner = document.getElementById('error-banner');
const errorVisible = errorBanner && errorBanner.style.display === 'flex';
if (hasResults) {
targetHeight = 500;
} else {
targetHeight = 300;
}
// Hata banner görünürse ekstra yükseklik ekle (mesaj + Open Settings link sığsın)
if (errorVisible) {
const bannerHeight = errorBanner.offsetHeight || 0;
targetHeight = Math.max(targetHeight, 300 + bannerHeight);
}
}
parent.postMessage({ pluginMessage: { type: 'resize', width: 320, height: targetHeight } }, '*');
}
// Tabs toggle (Plugin / Settings)
function initTabs() {
const tabs = Array.from(document.querySelectorAll('.tab'));
const pluginPanel = document.getElementById('plugin-panel');
const settingsPanel = document.getElementById('settings-panel');
tabs.forEach(tab => tab.addEventListener('click', () => {
tabs.forEach(t => t.classList.remove('active'));
tab.classList.add('active');
const isSettings = /Settings/i.test(tab.textContent || '');
settingsPanel.style.display = isSettings ? '' : 'none';
pluginPanel.style.display = isSettings ? 'none' : '';
if (isSettings) {
const errorBanner = document.getElementById('error-banner');
if (errorBanner) errorBanner.style.display = 'none';
var formWrap = document.getElementById('settings-form-wrap');
var helpPanelEl = document.getElementById('help-panel');
if (formWrap) formWrap.style.display = '';
if (helpPanelEl) helpPanelEl.style.display = 'none';
}
const consoleOutput = document.getElementById('console-output');
if (isSettings) {
consoleOutput.style.display = 'none';
} else {
const hasContent = consoleOutput.textContent && consoleOutput.textContent.trim() !== '';
consoleOutput.style.display = hasContent ? '' : 'none';
}
setTimeout(() => {
try {
resizeToContent();
} catch (error) {
console.log('Resize error:', error);
}
}, 50);
}));
}
// Template chips
function renderTemplateChips() {
const variables = [
{ label: 'Title', token: '{fileName}' },
{ label: 'Date', token: '{date}' },
{ label: 'Link', token: '{fileLink}' },
{ label: 'Changes', token: '{changes}' },
{ label: 'Components', token: '{totalComponents}' },
{ label: 'Styles', token: '{totalStyles}' },
{ label: 'Variables', token: '{totalVariables}' }
];
const row = document.getElementById('template-chips');
if (!row) return;
row.innerHTML = '';
variables.forEach(v => {
const chip = document.createElement('div');
chip.className = 'chip';
chip.draggable = true;
chip.setAttribute('data-token', v.token);
chip.innerHTML = `<span>${v.label}</span><span class="token">${v.token}</span>`;
chip.addEventListener('dragstart', e => {
e.dataTransfer.setData('text/plain', v.token);
});
row.appendChild(chip);
});