-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathindex.html
More file actions
905 lines (861 loc) · 41.9 KB
/
Copy pathindex.html
File metadata and controls
905 lines (861 loc) · 41.9 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>DisplayKit - TFT_eSPI + U8g2 UI Builder</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="app-shell dk-grid">
<!-- Left rail: Assets + Layers -->
<div class="sidebar dk-left">
<div class="sidebar-header">
<div style="flex: 1;">
<h2>DisplayKit</h2>
<div class="brand-subtitle">by CiferTech</div>
</div>
</div>
<div class="sidebar-card tools-card">
<div class="sidebar-card-title">Tools</div>
<a class="link-chip" href="tools/pixelforge/index.html" data-open-tool="pixelforge" rel="noreferrer">
<span class="icon">🧩</span> PixelForge (Image Converter)
</a>
<a class="link-chip" href="tools/bitcanvas-studio/index.html" data-open-tool="bitcanvas" rel="noreferrer">
<span class="icon">🎞️</span> BitCanvas Studio (Animation)
</a>
<a class="link-chip" href="tools/tft-gif-converter/index.html" data-open-tool="tftgif" rel="noreferrer">
<span class="icon">🖼️</span> TFT GIF Converter (Points)
</a>
</div>
<div class="sidebar-card section-card" id="uiExamplesCard">
<div class="sidebar-card-title">UI Examples</div>
<div class="mini-hint">Add a ready-made screen layout (non-destructive).</div>
<div class="ui-examples-tabs" role="tablist" aria-label="UI example presets">
<button class="ui-tab-btn" type="button" id="uiExamplesTabTft" role="tab" aria-selected="true" data-ui-examples-tab="tft">
TFT
</button>
<button class="ui-tab-btn" type="button" id="uiExamplesTabOled" role="tab" aria-selected="false" data-ui-examples-tab="oled">
OLED
</button>
</div>
<div class="example-list" id="uiExamplesList"></div>
<div class="ui-examples-pager" aria-label="UI examples pagination">
<button class="btn small secondary" type="button" id="uiExamplesPrevBtn">Prev</button>
<span class="pill outline small" id="uiExamplesPagePill">Page 1 / 1</span>
<button class="btn small secondary" type="button" id="uiExamplesNextBtn">Next</button>
</div>
</div>
<div class="sidebar-card section-card" id="iconListCard">
<div class="sidebar-card-title">Icon List</div>
<div class="icon-search-row">
<input type="text" id="iconSearch" placeholder="Search icons (wifi, gear, play...)" />
<button class="btn small secondary" type="button" id="clearIconSearch" title="Clear search">Clear</button>
</div>
<div class="icon-toolbar">
<div class="icon-toolbar-left">
<label for="iconSizeFilter" class="sr-only">Icon size</label>
<select id="iconSizeFilter" title="Filter by icon size">
<option value="all">All sizes</option>
<option value="16x16">16x16</option>
<option value="32x32">32x32</option>
</select>
<span class="pill outline small" id="iconCountPill">0 icons</span>
</div>
<button class="btn small secondary" type="button" id="refreshIconsBtn" title="Reload icon manifest">Refresh</button>
</div>
<div class="icon-actions-row">
<button class="btn small secondary" type="button" id="exportIconsTftBtn" title="Export all icons as RGB565 PROGMEM arrays (TFT_eSPI)">
Export TFT (RGB565)
</button>
<button class="btn small secondary" type="button" id="exportIconsU8g2Btn" title="Export all icons as XBM PROGMEM arrays (U8g2)">
Export U8g2 (XBM)
</button>
</div>
<div class="icon-grid" id="iconGrid" aria-label="Icon list"></div>
<div class="icon-pager" aria-label="Icon list pagination">
<button class="btn small secondary" type="button" id="iconPrevBtn">Prev</button>
<span class="pill outline small" id="iconPagePill">Page 1 / 1</span>
<button class="btn small secondary" type="button" id="iconNextBtn">Next</button>
</div>
<div class="mini-hint" id="iconHint">Click an icon to add it as an element. Shift+Click also copies its path.</div>
</div>
<!-- Assets Manager (project-local) -->
<div class="sidebar-card section-card" id="assetsCard">
<div class="sidebar-card-title">Assets</div>
<div class="mini-hint">Import PNGs to reuse across screens (images/icons).</div>
<div class="icon-search-row">
<input type="text" id="assetsSearch" placeholder="Search assets..." />
<button class="btn small secondary" type="button" id="assetsClearSearchBtn" title="Clear search">Clear</button>
</div>
<div class="assets-toolbar">
<div class="assets-toolbar-left">
<label class="toggle-row" title="Store the PNG inside exported JSON (bigger, portable).">
<input type="checkbox" id="assetsEmbedToggle" />
<span>Embed in JSON</span>
</label>
</div>
<div class="assets-toolbar-right">
<button class="btn small secondary" type="button" id="assetsImportBtn" title="Import PNGs">Import</button>
<button class="btn small secondary" type="button" id="assetsRemoveUnusedBtn" title="Remove unused assets">Clean</button>
</div>
</div>
<div class="assets-list" id="assetsList" aria-label="Assets"></div>
<input type="file" id="assetsImportInput" accept="image/png" multiple hidden />
</div>
<div class="sidebar-card note section-card">
<div class="sidebar-card-title">Workflow tips</div>
<ul>
<li>Use Snap-to-grid for pixel-perfect layouts.</li>
<li>Duplicate elements to iterate fast.</li>
<li>Export JSON often for versioning.</li>
</ul>
</div>
<div class="sidebar-card section-card">
<div class="sidebar-card-title">Basic Shapes</div>
<div class="btn-group">
<button class="btn small chip-btn" data-add="triangle" title="Triangle">
<span class="icon-box shape">
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M12 6.3l7.2 12.4H4.8L12 6.3Z" />
</svg>
</span>
<span class="chip-label">Triangle</span>
</button>
<button class="btn small chip-btn" data-add="polygon" title="Polygon">
<span class="icon-box shape">
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M12 5.2l7 5-2.8 8.8H7.8L5 10.2l7-5Z" />
</svg>
</span>
<span class="chip-label">Polygon</span>
</button>
<button class="btn small chip-btn" data-add="arc" title="Arc">
<span class="icon-box shape">
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M6.2 16.8a7 7 0 0 1 15.6 0" />
</svg>
</span>
<span class="chip-label">Arc</span>
</button>
<button class="btn small chip-btn" data-add="gauge" title="Gauge">
<span class="icon-box shape">
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M6.2 16.8a7 7 0 0 1 15.6 0" />
<path d="M12 13.2l4.6-2.3" />
<circle cx="12" cy="16.8" r="1.2" fill="currentColor" stroke="none" />
</svg>
</span>
<span class="chip-label">Gauge</span>
</button>
<button class="btn small chip-btn" data-add="rect" title="Rect">
<span class="icon-box shape">
<svg viewBox="0 0 24 24" aria-hidden="true">
<rect x="5" y="7" width="14" height="10" rx="2.5" ry="2.5" stroke="currentColor" stroke-width="2" fill="none" />
</svg>
</span>
<span class="chip-label">Rect</span>
</button>
<button class="btn small chip-btn" data-add="roundrect" title="Round Rect">
<span class="icon-box shape">
<svg viewBox="0 0 24 24" aria-hidden="true">
<rect x="5" y="7" width="14" height="10" rx="5.5" ry="5.5" stroke="currentColor" stroke-width="2" fill="none" />
</svg>
</span>
<span class="chip-label">Round</span>
</button>
<button class="btn small chip-btn" data-add="circle" title="Circle">
<span class="icon-box shape">
<svg viewBox="0 0 24 24" aria-hidden="true">
<circle cx="12" cy="12" r="6.5" stroke="currentColor" stroke-width="2" fill="none" />
</svg>
</span>
<span class="chip-label">Circle</span>
</button>
<button class="btn small chip-btn" data-add="line" title="Line">
<span class="icon-box shape">
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M6 18L18 6" stroke="currentColor" stroke-width="2" fill="none" />
<path d="M7.2 16.8l1.2 1.2" stroke="currentColor" stroke-width="2" fill="none" opacity="0.75" />
</svg>
</span>
<span class="chip-label">Line</span>
</button>
<button class="btn small chip-btn" data-add="divider" title="Divider">
<span class="icon-box shape">
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M5.5 12h13" />
<circle cx="8" cy="12" r="1" fill="currentColor" stroke="none" opacity="0.9" />
<circle cx="12" cy="12" r="1" fill="currentColor" stroke="none" opacity="0.9" />
<circle cx="16" cy="12" r="1" fill="currentColor" stroke="none" opacity="0.9" />
</svg>
</span>
<span class="chip-label">Divider</span>
</button>
</div>
</div>
<div class="sidebar-card section-card">
<div class="sidebar-card-title">UI Elements</div>
<div class="btn-group">
<button class="btn small chip-btn" data-add="text" title="Text">
<span class="icon-box ui">
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M7 7h10" stroke="currentColor" stroke-width="2" fill="none" />
<path d="M12 7v12" stroke="currentColor" stroke-width="2" fill="none" />
<path d="M9 19h6" stroke="currentColor" stroke-width="2" fill="none" opacity="0.75" />
</svg>
</span>
<span class="chip-label">Text</span>
</button>
<button class="btn small chip-btn" data-add="label" title="Label">
<span class="icon-box ui">
<svg viewBox="0 0 24 24" aria-hidden="true">
<rect x="5" y="7" width="14" height="10" rx="3.5" ry="3.5" />
<path d="M8 11h8.8" />
<path d="M8 14h5.6" opacity="0.75" />
</svg>
</span>
<span class="chip-label">Label</span>
</button>
<button class="btn small chip-btn" data-add="button" title="Button">
<span class="icon-box ui">
<svg viewBox="0 0 24 24" aria-hidden="true">
<rect x="6" y="9" width="12" height="7" rx="3.5" ry="3.5" stroke="currentColor" stroke-width="2" fill="none" />
<path d="M9.2 12.5h5.6" stroke="currentColor" stroke-width="2" fill="none" opacity="0.8" />
</svg>
</span>
<span class="chip-label">Button</span>
</button>
<button class="btn small chip-btn" data-add="progress" title="Progress">
<span class="icon-box ui">
<svg viewBox="0 0 24 24" aria-hidden="true">
<rect x="5" y="10" width="14" height="4.5" rx="2.25" ry="2.25" />
<path d="M6.6 12.25h6.4" stroke-width="2.8" />
</svg>
</span>
<span class="chip-label">Progress</span>
</button>
<button class="btn small chip-btn" data-add="slider" title="Slider">
<span class="icon-box ui">
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M6 12h12" stroke="currentColor" stroke-width="2" fill="none" />
<circle cx="10.5" cy="12" r="3.1" stroke="currentColor" stroke-width="2" fill="none" />
<path d="M10.5 10.7v2.6" stroke="currentColor" stroke-width="2" fill="none" opacity="0.8" />
</svg>
</span>
<span class="chip-label">Slider</span>
</button>
<button class="btn small chip-btn" data-add="toggle" title="Toggle">
<span class="icon-box ui">
<svg viewBox="0 0 24 24" aria-hidden="true">
<rect x="5" y="9" width="14" height="6.5" rx="3.25" ry="3.25" stroke="currentColor" stroke-width="2" fill="none" />
<circle cx="15.3" cy="12.25" r="2.65" stroke="currentColor" stroke-width="2" fill="none" />
<path d="M15.3 11.2v2.1" stroke="currentColor" stroke-width="2" fill="none" opacity="0.8" />
</svg>
</span>
<span class="chip-label">Toggle</span>
</button>
<button class="btn small chip-btn" data-add="card" title="Card">
<span class="icon-box ui">
<svg viewBox="0 0 24 24" aria-hidden="true">
<rect x="5" y="7" width="14" height="10.5" rx="2.5" ry="2.5" />
<path d="M7.5 11h9.5" />
<path d="M7.5 14h7" opacity="0.75" />
</svg>
</span>
<span class="chip-label">Card</span>
</button>
<button class="btn small chip-btn" data-add="header" title="Header">
<span class="icon-box ui">
<svg viewBox="0 0 24 24" aria-hidden="true">
<rect x="5" y="7" width="14" height="4.5" rx="2.25" ry="2.25" />
<path d="M7.5 9.25h7" opacity="0.75" />
</svg>
</span>
<span class="chip-label">Header</span>
</button>
<button class="btn small chip-btn" id="addImageBtn" title="Image">
<span class="icon-box ui">
<svg viewBox="0 0 24 24" aria-hidden="true">
<rect x="4" y="6" width="16" height="12.5" rx="2.5" ry="2.5" />
<circle cx="10" cy="11" r="1.6" />
<path d="M7 16l4-4 5 4" />
</svg>
</span>
<span class="chip-label">Image</span>
</button>
</div>
</div>
<!-- Figma-like Layers panel (per screen) -->
<div class="sidebar-card section-card" id="layersCard">
<div class="sidebar-card-title">Layers</div>
<div class="mini-hint">Order = draw order (top is front). Drag to reorder.</div>
<div class="layers-toolbar">
<button class="btn small secondary" type="button" id="layersSelectAllBtn" title="Select all on current screen">Select all</button>
<button class="btn small secondary" type="button" id="layersClearSelectionBtn" title="Clear selection">Clear</button>
</div>
<div class="layers-list" id="layersList" aria-label="Layers"></div>
</div>
</div>
<!-- Top toolbar -->
<div class="top-bar dk-top" role="toolbar" aria-label="Editor toolbar">
<div class="top-left">
<div class="top-left-primary">
<span id="displayInfo">TFT_eSPI · 240x320 px</span>
<span class="pill">Multi-screen · Drag to position · Click to edit</span>
</div>
<div class="status-chips">
<span class="pill soft">Space+Drag to pan</span>
<span class="pill soft">Ctrl/Cmd+Wheel to zoom</span>
<span class="pill soft">Ctrl/Cmd+drag: no snap</span>
</div>
</div>
<div class="top-right">
<div class="tool-toggle">
<button class="btn small secondary" id="toolSelectBtn" type="button" aria-pressed="true" title="Select (V)">Select</button>
<button class="btn small secondary" id="toolHandBtn" type="button" aria-pressed="false" title="Hand / Pan (Space)">Hand</button>
</div>
<a class="btn small github" href="https://github.com/cifertech/DisplayKit" target="_blank" rel="noreferrer">GitHub</a>
<a class="btn small patreon" href="https://www.patreon.com/cifertech" target="_blank" rel="noreferrer">Patreon</a>
<button class="btn small secondary" id="themeToggle" title="Toggle theme"><span id="themeIcon">🌙</span></button>
<button class="btn small secondary" id="undoBtn">Undo</button>
<button class="btn small secondary" id="redoBtn">Redo</button>
<button class="btn small secondary" id="duplicateBtn">Duplicate</button>
<div class="slider-inline">
<span>Zoom</span>
<input type="range" id="zoomSlider" min="50" max="200" value="75" />
</div>
<div class="zoom-inline">
<input type="number" id="zoomInput" min="50" max="300" step="1" value="75" title="Zoom %" />
<span class="pill outline small">%</span>
<button class="btn small secondary" id="zoomResetBtn" type="button" title="Reset zoom">Reset</button>
<button class="btn small secondary" id="zoomFitBtn" type="button" title="Fit to screen">Fit</button>
<button class="btn small secondary" id="zoomSelectionBtn" type="button" title="Zoom to selection">Selection</button>
</div>
<button class="btn small secondary" id="exportJsonBtn">Export JSON</button>
<button class="btn small secondary" id="importJsonBtn">Import JSON</button>
</div>
</div>
<!-- Center: canvas -->
<div class="workspace dk-center">
<div class="preview-wrapper">
<div class="preview-frame">
<div class="preview-viewport" id="previewViewport">
<div id="preview"></div>
</div>
</div>
</div>
</div>
<!-- Right: inspector -->
<div class="properties dk-right">
<div class="inspector-tabs" role="tablist" aria-label="Inspector tabs">
<button class="inspector-tab" type="button" id="inspectorTabBtn_project" role="tab" aria-selected="true" data-inspector-tab="project">Project</button>
<button class="inspector-tab" type="button" id="inspectorTabBtn_selection" role="tab" aria-selected="false" data-inspector-tab="selection">Selection</button>
<button class="inspector-tab" type="button" id="inspectorTabBtn_code" role="tab" aria-selected="false" data-inspector-tab="code">Code</button>
</div>
<div class="inspector-body">
<div class="props-section inspector-tab-panel" id="inspectorTab_project" role="tabpanel" aria-labelledby="inspectorTabBtn_project">
<div class="settings-block" id="settingsProjectBlock">
<div class="section-title" id="settingsProjectTitle">Project</div>
<div class="mini-hint">Project settings live here (screens, display, scene, grid).</div>
</div>
<div class="settings-block" id="settingsDisplayBlock">
<div class="section-title" id="settingsDisplayTitle">Display</div>
<div class="prop-group">
<div class="prop-row">
<div>
<label for="dispWidth">Width</label>
<input type="number" id="dispWidth" value="240" min="1" />
</div>
<div>
<label for="dispHeight">Height</label>
<input type="number" id="dispHeight" value="320" min="1" />
</div>
</div>
<div class="prop-row">
<div>
<label for="displayDriver">Driver</label>
<select id="displayDriver">
<option value="tft">TFT_eSPI</option>
<option value="u8g2">U8g2 OLED</option>
</select>
</div>
</div>
<button class="btn small secondary icon-btn-ghost" id="applyRes" title="Apply resolution">
<span>Apply</span>
</button>
</div>
</div>
<!-- TFT Display Settings -->
<div id="tftSettings" class="display-settings settings-block">
<div class="section-title" id="settingsTftTitle">TFT Display Settings</div>
<div class="prop-group">
<div class="prop-row">
<div>
<label for="tftRotation">Rotation</label>
<select id="tftRotation">
<option value="0">0° (Portrait)</option>
<option value="1">90° (Landscape)</option>
<option value="2">180° (Portrait)</option>
<option value="3">270° (Landscape)</option>
</select>
</div>
<div>
<label for="tftColorDepth">Color Depth</label>
<select id="tftColorDepth">
<option value="16">16-bit RGB565</option>
<option value="18">18-bit RGB666</option>
<option value="24">24-bit RGB888</option>
</select>
</div>
</div>
<div class="prop-row">
<div>
<label for="tftBacklight">Backlight Control</label>
<select id="tftBacklight">
<option value="none">None</option>
<option value="pwm">PWM Pin</option>
<option value="manual">Manual</option>
</select>
</div>
<div>
<label for="tftTouch">Touch Support</label>
<select id="tftTouch">
<option value="none">No Touch</option>
<option value="resistive">Resistive</option>
<option value="capacitive">Capacitive</option>
</select>
</div>
</div>
</div>
</div>
<!-- OLED Display Settings -->
<div id="oledSettings" class="display-settings settings-block">
<div class="section-title" id="settingsOledTitle">OLED Display Settings</div>
<div class="prop-group">
<div class="prop-row">
<div>
<label for="u8g2Preset">U8g2 Display Model</label>
<select id="u8g2Preset"></select>
</div>
<div>
<label for="oledRotation">Rotation</label>
<select id="oledRotation">
<option value="0">0° (Normal)</option>
<option value="1">90° (Clockwise)</option>
<option value="2">180° (Upside Down)</option>
<option value="3">270° (Counter-clockwise)</option>
</select>
</div>
</div>
<div class="prop-row">
<div>
<label for="oledContrast">Contrast (0-255)</label>
<input type="range" id="oledContrast" min="0" max="255" value="127" />
<span id="oledContrastValue">127</span>
</div>
<div>
<label for="oledFlipMode">Flip Mode</label>
<select id="oledFlipMode">
<option value="none">Normal</option>
<option value="horizontal">Horizontal Flip</option>
<option value="vertical">Vertical Flip</option>
<option value="both">Both</option>
</select>
</div>
</div>
<div class="prop-row">
<div>
<label for="oledFontMode">Font Rendering</label>
<select id="oledFontMode">
<option value="transparent">Transparent Background</option>
<option value="solid">Solid Background</option>
<option value="inverse">Inverse Colors</option>
</select>
</div>
<div>
<label for="oledPowerSave">Power Save Mode</label>
<select id="oledPowerSave">
<option value="off">Always On</option>
<option value="auto">Auto Sleep</option>
<option value="manual">Manual Control</option>
</select>
</div>
</div>
</div>
</div>
<div class="settings-block" id="settingsScreensBlock">
<div class="section-title" id="settingsScreensTitle">Screens</div>
<div class="prop-group">
<label for="screenSelect">Current screen</label>
<div class="prop-row">
<div>
<select id="screenSelect"></select>
</div>
<button class="btn small secondary icon-btn-ghost" id="addScreenBtn" title="Add screen">
<svg viewBox="0 0 24 24" aria-hidden="true">
<line x1="12" y1="6" x2="12" y2="18" stroke="currentColor" stroke-width="2" stroke-linecap="round" />
<line x1="6" y1="12" x2="18" y2="12" stroke="currentColor" stroke-width="2" stroke-linecap="round" />
</svg>
</button>
</div>
</div>
<div class="prop-group">
<label for="screenFnName">Function name</label>
<div class="prop-row fn-row">
<div>
<input type="text" id="screenFnName" placeholder="drawHomeScreen" />
</div>
<button class="btn small secondary icon-btn-ghost" id="deleteScreenBtn" title="Delete screen">
<svg viewBox="0 0 24 24" aria-hidden="true">
<polyline points="9,6 10,4 14,4 15,6" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round" />
<rect x="7" y="6" width="10" height="12" rx="2" ry="2" stroke="currentColor" stroke-width="2" fill="none" />
<line x1="10" y1="10" x2="10" y2="14" stroke="currentColor" stroke-width="2" stroke-linecap="round" />
<line x1="14" y1="10" x2="14" y2="14" stroke="currentColor" stroke-width="2" stroke-linecap="round" />
</svg>
</button>
</div>
</div>
</div>
<div class="settings-block" id="settingsSceneBlock">
<div class="section-title" id="settingsSceneTitle">Scene</div>
<div class="prop-group">
<label>Background</label>
<div class="bg-color-row">
<div class="bg-presets">
<button class="bg-chip" data-bg-color="#000000">
<span class="bg-chip-swatch" style="background:#000000"></span>
<span>Black</span>
</button>
<button class="bg-chip" data-bg-color="#ffffff">
<span class="bg-chip-swatch" style="background:#ffffff"></span>
<span>White</span>
</button>
<button class="bg-chip" data-bg-color="#111827">
<span class="bg-chip-swatch" style="background:#111827"></span>
<span>Dark gray</span>
</button>
<button class="bg-chip" data-bg-color="#e5e7eb">
<span class="bg-chip-swatch" style="background:#e5e7eb"></span>
<span>Light gray</span>
</button>
<button class="bg-chip bg-chip-custom" id="bgColorCustom">
<span class="bg-chip-swatch" style="background:conic-gradient(red, orange, yellow, green, cyan, blue, magenta, red)"></span>
<span>Custom</span>
</button>
</div>
</div>
<input type="color" id="bgColor" value="#000000" style="display:none" />
</div>
</div>
<div class="settings-block" id="settingsGridBlock">
<div class="section-title" id="settingsGridTitle">Grid & Snap</div>
<div class="prop-group">
<label class="toggle-label">
<input type="checkbox" id="snapCheckbox" class="toggle-input" />
Snap to grid
</label>
<div class="prop-row">
<div>
<label for="gridSize">Grid size (px)</label>
<input type="number" id="gridSize" value="4" min="1" />
</div>
</div>
</div>
<div class="prop-group">
<label class="toggle-label">
<input type="checkbox" id="useSpriteCheckbox" class="toggle-input" />
Use sprite (TFT_eSprite) for screens
</label>
</div>
<div class="prop-group">
<button class="btn secondary small" id="clearAll">Clear all (screen)</button>
</div>
</div>
</div>
</div>
<div class="props-section inspector-tab-panel" id="inspectorTab_selection" role="tabpanel" aria-labelledby="inspectorTabBtn_selection" hidden>
<div class="section-title" id="selectedElementTitle">Selected Element</div>
<div id="noSelection">No element selected</div>
<div id="propsPanel" style="display: none">
<div class="prop-group">
<label id="propTypeLabel">Type</label>
<div class="pill" id="elementTypePill"></div>
</div>
<div class="prop-group">
<div class="prop-row">
<div>
<label for="propX" class="scrub-label">X</label>
<input type="number" id="propX" />
</div>
<div>
<label for="propY" class="scrub-label">Y</label>
<input type="number" id="propY" />
</div>
</div>
<div class="prop-row">
<div>
<label for="propW" class="scrub-label">W</label>
<input type="number" id="propW" />
</div>
<div>
<label for="propH" class="scrub-label">H</label>
<input type="number" id="propH" />
</div>
</div>
<div class="prop-row">
<div>
<label for="propRotate" class="scrub-label">Rotate °</label>
<input type="number" id="propRotate" step="1" title="Rotation (Shift on handle: 15° steps)" />
</div>
</div>
</div>
<div class="prop-group" id="textGroup">
<label for="propText">Text</label>
<input type="text" id="propText" />
<div class="prop-row">
<div>
<label for="propTextSize">Text size (TFT)</label>
<input type="number" id="propTextSize" min="1" max="10" />
</div>
</div>
<div class="prop-row">
<div>
<label for="propLineHeight">Line height</label>
<input type="number" id="propLineHeight" min="6" max="64" />
</div>
<div class="prop-inline">
<label class="toggle-label" title="Auto-size text box to fit content">
<input type="checkbox" id="propTextAutoSize" class="toggle-input" />
Auto-size
</label>
</div>
</div>
<div class="prop-group">
<div class="mini-hint">Alignment</div>
<div class="btn-group">
<button class="btn small secondary" type="button" id="textAlignLeftBtn" title="Align left">Left</button>
<button class="btn small secondary" type="button" id="textAlignCenterBtn" title="Align center">Center</button>
<button class="btn small secondary" type="button" id="textAlignRightBtn" title="Align right">Right</button>
</div>
<div class="btn-group" style="margin-top:6px;">
<button class="btn small secondary" type="button" id="vAlignTopBtn" title="Top">Top</button>
<button class="btn small secondary" type="button" id="vAlignMiddleBtn" title="Middle">Middle</button>
<button class="btn small secondary" type="button" id="vAlignBottomBtn" title="Bottom">Bottom</button>
</div>
</div>
</div>
<div class="prop-group" id="fontGroup">
<label for="propFont" id="propFontLabel">Font</label>
<select id="propFont"></select>
</div>
<div class="prop-group" id="valueGroup" style="display: none">
<label for="propValue">Value / Level (0–100)</label>
<input type="number" id="propValue" min="0" max="100" />
</div>
<div class="prop-group">
<label>Colors</label>
<div class="prop-row color-row">
<div class="pill">
<input type="color" id="propFillColor" />
<span>Fill</span>
</div>
<div class="pill">
<input type="color" id="propStrokeColor" />
<span>Stroke</span>
</div>
<div class="pill">
<input type="color" id="propTextColor" />
<span>Text</span>
</div>
</div>
<div class="prop-row" id="fillTransparencyRow">
<div>
<label for="propFillAlpha">Fill Transparency</label>
<input type="range" id="propFillAlpha" min="0" max="255" value="255" />
<span id="fillAlphaValue">100%</span>
</div>
</div>
<div class="prop-row" id="oledFillRow" style="display: none;">
<div class="fill-control">
<input type="checkbox" id="propOLEDFill" checked />
<label for="propOLEDFill" class="fill-label">
<span class="fill-indicator"></span>
Filled
</label>
</div>
</div>
</div>
<div class="prop-group" id="actionGroup" style="display:none;">
<label for="propAction">On click</label>
<select id="propAction">
<option value="">None</option>
<option value="goto">Go to screen…</option>
</select>
<div class="prop-row">
<div>
<label for="propActionTarget">Target screen</label>
<select id="propActionTarget"></select>
</div>
</div>
</div>
<div class="prop-group" id="iconTintGroup" style="display:none;">
<div class="fn-label-row">
<label>Icon tint</label>
<label class="toggle-label" title="Tint recolors PNG icons using their transparency (best for monochrome icons)">
<input type="checkbox" id="propIconTintEnabled" class="toggle-input" />
Enable
</label>
</div>
<div class="prop-row color-row">
<div class="pill">
<input type="color" id="propIconTintColor" value="#ffffff" />
<span>Tint</span>
</div>
</div>
<div class="mini-hint">Tip: in OLED mode, tint helps icons match the cyan display style.</div>
</div>
<div class="prop-group">
<label>Align to screen</label>
<div class="btn-group">
<button class="btn small secondary" id="alignLeftBtn">Left</button>
<button class="btn small secondary" id="alignHCenterBtn">H-Center</button>
<button class="btn small secondary" id="alignRightBtn">Right</button>
<button class="btn small secondary" id="alignTopBtn">Top</button>
<button class="btn small secondary" id="alignVCenterBtn">V-Center</button>
<button class="btn small secondary" id="alignBottomBtn">Bottom</button>
</div>
</div>
<div class="prop-group">
<label>Distribute</label>
<div class="btn-group">
<button class="btn small secondary" id="distributeHBtn" title="Distribute horizontally (multi-select)">Horizontal</button>
<button class="btn small secondary" id="distributeVBtn" title="Distribute vertically (multi-select)">Vertical</button>
</div>
</div>
<div class="prop-group" id="constraintsGroup">
<label>Constraints (on resize)</label>
<div class="prop-row">
<label class="toggle-label" title="Keep distance to left edge">
<input type="checkbox" id="constraintLeft" class="toggle-input" />
Left
</label>
<label class="toggle-label" title="Keep distance to right edge">
<input type="checkbox" id="constraintRight" class="toggle-input" />
Right
</label>
</div>
<div class="prop-row">
<label class="toggle-label" title="Keep distance to top edge">
<input type="checkbox" id="constraintTop" class="toggle-input" />
Top
</label>
<label class="toggle-label" title="Keep distance to bottom edge">
<input type="checkbox" id="constraintBottom" class="toggle-input" />
Bottom
</label>
</div>
<div class="mini-hint">Tip: set both Left+Right to stretch horizontally; Top+Bottom to stretch vertically.</div>
</div>
<div class="prop-group" style="display: flex; justify-content: flex-end;">
<button class="btn danger small" id="deleteElement" title="Delete element">
<svg viewBox="0 0 24 24" aria-hidden="true">
<polyline points="9,6 10,4 14,4 15,6" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round" />
<rect x="7" y="6" width="10" height="12" rx="2" ry="2" stroke="currentColor" stroke-width="2" fill="none" />
<line x1="10" y1="10" x2="10" y2="14" stroke="currentColor" stroke-width="2" stroke-linecap="round" />
<line x1="14" y1="10" x2="14" y2="14" stroke="currentColor" stroke-width="2" stroke-linecap="round" />
</svg>
<span>Delete</span>
</button>
</div>
</div>
</div>
<div class="props-section inspector-tab-panel" id="inspectorTab_code" role="tabpanel" aria-labelledby="inspectorTabBtn_code" hidden>
<div class="code-panel">
<div style="display: flex; justify-content: space-between; align-items: center">
<div class="section-title">Generated Code (TFT_eSPI / U8g2)</div>
<div>
<button class="btn small secondary" id="copyCode">
<svg viewBox="0 0 24 24" aria-hidden="true" style="width:14px;height:14px;margin-right:4px">
<rect x="9" y="9" width="11" height="11" rx="2" ry="2" stroke="currentColor" stroke-width="2" fill="none" />
<rect x="4" y="4" width="11" height="11" rx="2" ry="2" stroke="currentColor" stroke-width="2" fill="none" />
</svg>
<span>Copy</span>
</button>
</div>
</div>
<textarea id="codeOutput" spellcheck="false"></textarea>
</div>
</div>
</div>
</div>
</div>
<input type="file" id="imageInput" accept="image/*" style="display: none" />
<input type="file" id="importJsonInput" accept="application/json" style="display:none" />
<!-- Context menu (Figma-like) -->
<div class="context-menu" id="contextMenu" aria-hidden="true">
<button type="button" class="context-item" data-action="duplicate">Duplicate</button>
<button type="button" class="context-item" data-action="delete">Delete</button>
<div class="context-sep"></div>
<button type="button" class="context-item" data-action="group">Group</button>
<button type="button" class="context-item" data-action="ungroup">Ungroup</button>
<div class="context-sep"></div>
<button type="button" class="context-item" data-action="front">Bring to front</button>
<button type="button" class="context-item" data-action="back">Send to back</button>
<div class="context-sep"></div>
<button type="button" class="context-item" data-action="lock">Lock/Unlock</button>
<button type="button" class="context-item" data-action="hide">Hide/Show</button>
</div>
<!-- In-app tools overlay (PixelForge / BitCanvas Studio) -->
<div class="tool-overlay" id="toolOverlay" aria-hidden="true">
<div class="tool-overlay-inner" role="dialog" aria-modal="true" aria-label="Tools">
<div class="tool-overlay-bar">
<div class="tool-overlay-title">
<span class="pill outline" id="toolOverlayPill">Tools</span>
<div class="tool-switcher" role="tablist" aria-label="Tools switcher">
<button class="tool-switch-btn" type="button" data-switch-tool="pixelforge" role="tab" aria-selected="false">
🧩 PixelForge
</button>
<button class="tool-switch-btn" type="button" data-switch-tool="bitcanvas" role="tab" aria-selected="false">
🎞️ BitCanvas
</button>
<button class="tool-switch-btn" type="button" data-switch-tool="tftgif" role="tab" aria-selected="false">
🖼️ TFT GIF
</button>
</div>
</div>
<div class="tool-overlay-actions">
<button class="btn small success" id="toolOverlayAction" type="button" style="display:none">Action</button>
<a class="btn small secondary" id="toolOverlayOpenNewTab" href="#" target="_blank" rel="noreferrer">Open in new tab</a>
<button class="btn small" id="toolOverlayClose" type="button">Back to DisplayKit</button>
</div>
</div>
<div class="tool-overlay-frames">
<iframe
id="toolFrame_pixelforge"
class="tool-overlay-frame"
title="PixelForge"
src="about:blank"
allow="clipboard-read; clipboard-write"
></iframe>
<iframe
id="toolFrame_bitcanvas"
class="tool-overlay-frame"
title="BitCanvas Studio"
src="about:blank"
allow="clipboard-read; clipboard-write"
></iframe>
<iframe
id="toolFrame_tftgif"
class="tool-overlay-frame"
title="TFT GIF Converter"
src="about:blank"
allow="clipboard-read; clipboard-write"
></iframe>
</div>
</div>
</div>
<!-- Icon manifest: supports file:// usage (no fetch required) -->
<script src="icons/manifest.js"></script>
<script src="app.js"></script>
</body>
</html>