-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcustom-elements.json
More file actions
1397 lines (1397 loc) · 46.1 KB
/
custom-elements.json
File metadata and controls
1397 lines (1397 loc) · 46.1 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
{
"schemaVersion": "1.0.0",
"readme": "",
"modules": [
{
"kind": "javascript-module",
"path": "src/terminal-window.js",
"declarations": [
{
"kind": "class",
"description": "A vanilla JavaScript web component that simulates a terminal console with\ncustomizable commands, themes, cursor styles, and typing effects.",
"name": "TerminalWindow",
"cssProperties": [
{
"description": "Primary background color",
"name": "--bg-primary",
"default": "#1a1a2e"
},
{
"description": "Secondary background color",
"name": "--bg-secondary",
"default": "#16213e"
},
{
"description": "Header background color",
"name": "--bg-header",
"default": "#0f0f23"
},
{
"description": "Border color",
"name": "--border-color",
"default": "#2a2a4a"
},
{
"description": "Primary text color",
"name": "--text-primary",
"default": "#e0e0e0"
},
{
"description": "Secondary text color",
"name": "--text-secondary",
"default": "#888"
},
{
"description": "Prompt color",
"name": "--prompt-color",
"default": "#50fa7b"
},
{
"description": "Cursor color",
"name": "--cursor-color",
"default": "#50fa7b"
},
{
"description": "Command text color",
"name": "--command-color",
"default": "#f8f8f2"
},
{
"description": "Output text color",
"name": "--output-color",
"default": "#e0e0e0"
},
{
"description": "Error text color",
"name": "--error-color",
"default": "#ff5555"
},
{
"description": "Info text color",
"name": "--info-color",
"default": "#8be9fd"
},
{
"description": "Success text color",
"name": "--success-color",
"default": "#50fa7b"
},
{
"description": "Cursor width",
"name": "--cursor-width",
"default": "8px"
},
{
"description": "Cursor height",
"name": "--cursor-height",
"default": "1.2em"
},
{
"description": "Cursor blink animation speed",
"name": "--cursor-blink-speed",
"default": "1s"
},
{
"description": "Button background color",
"name": "--btn-bg",
"default": "#2a2a4a"
},
{
"description": "Button hover background color",
"name": "--btn-hover",
"default": "#3a3a5a"
},
{
"description": "Button text color",
"name": "--btn-text",
"default": "#e0e0e0"
},
{
"description": "Close button color",
"name": "--control-close",
"default": "#ff5f56"
},
{
"description": "Minimize button color",
"name": "--control-minimize",
"default": "#ffbd2e"
},
{
"description": "Maximize button color",
"name": "--control-maximize",
"default": "#27c93f"
}
],
"cssParts": [
{
"description": "Main terminal container",
"name": "terminal"
},
{
"description": "Terminal header bar",
"name": "header"
},
{
"description": "Window controls container (close, minimize, maximize)",
"name": "controls"
},
{
"description": "Close button",
"name": "control-close"
},
{
"description": "Minimize button",
"name": "control-minimize"
},
{
"description": "Maximize button",
"name": "control-maximize"
},
{
"description": "Terminal title text",
"name": "title"
},
{
"description": "Actions container (theme toggle, copy)",
"name": "actions"
},
{
"description": "Theme toggle button",
"name": "theme-button"
},
{
"description": "Copy button",
"name": "copy-button"
},
{
"description": "Copy dropdown menu",
"name": "copy-menu"
},
{
"description": "Copy menu items",
"name": "copy-menu-item"
},
{
"description": "Terminal body (scrollable area)",
"name": "body"
},
{
"description": "Output container",
"name": "output"
},
{
"description": "Input line container",
"name": "input-line"
},
{
"description": "Command prompt text",
"name": "prompt"
},
{
"description": "User input text",
"name": "input-text"
},
{
"description": "Cursor element",
"name": "cursor"
}
],
"slots": [
{
"description": "Custom content for the terminal title in the header",
"name": "title"
},
{
"description": "Custom buttons/actions before the theme and copy buttons",
"name": "actions"
},
{
"description": "Content inserted before the output area in the terminal body",
"name": "before-output"
}
],
"members": [
{
"kind": "method",
"name": "_applyAttributes",
"description": "Apply initial attributes"
},
{
"kind": "method",
"name": "_updateStyles",
"description": "Update dynamic styles"
},
{
"kind": "method",
"name": "_updateHeaderVisibility",
"description": "Update header visibility"
},
{
"kind": "method",
"name": "_updateTitle",
"description": "Update title"
},
{
"kind": "method",
"name": "_updateControlsVisibility",
"description": "Update window controls visibility"
},
{
"kind": "method",
"name": "_updateCopyVisibility",
"description": "Update copy button visibility"
},
{
"kind": "method",
"name": "_updateThemeToggleVisibility",
"description": "Update theme toggle visibility"
},
{
"kind": "method",
"name": "_updateReadonlyState",
"description": "Update readonly state"
},
{
"kind": "method",
"name": "_registerVfsCommands",
"description": "Register VFS commands"
},
{
"kind": "method",
"name": "_registerBuiltInCommands",
"description": "Register built-in commands"
},
{
"kind": "method",
"name": "registerCommand",
"parameters": [
{
"name": "name",
"description": "Command name (case-insensitive)",
"type": {
"text": "string"
}
},
{
"name": "handler",
"description": "Function that receives (args: string[], terminal: TerminalWindow) and returns string|null|Promise",
"type": {
"text": "Function"
}
}
],
"description": "Register a custom command handler.\nThe handler receives an array of arguments and the terminal instance,\nand can return a string to print, null to suppress output, or a Promise for async commands."
},
{
"kind": "method",
"name": "unregisterCommand",
"parameters": [
{
"name": "name",
"description": "Command name to remove",
"type": {
"text": "string"
}
}
],
"description": "Remove a registered command."
},
{
"kind": "method",
"name": "registerAlias",
"parameters": [
{
"name": "alias",
"description": "Alias name",
"type": {
"text": "string"
}
},
{
"name": "command",
"description": "Full command string to execute when alias is used",
"type": {
"text": "string"
}
}
],
"description": "Create an alias for a command."
},
{
"kind": "method",
"name": "executeCommand",
"parameters": [
{
"name": "input",
"description": "Full command string",
"type": {
"text": "string"
}
},
{
"name": "addToHistory",
"default": "true",
"description": "Whether to add to command history",
"optional": true,
"type": {
"text": "boolean"
}
}
],
"description": "Execute a command string programmatically.",
"return": {
"type": {
"text": "Promise<void>"
}
}
},
{
"kind": "method",
"name": "executeSequence",
"parameters": [
{
"name": "commands",
"description": "Array of command strings or objects with command and optional delay",
"type": {
"text": "Array<string|{command: string, delay?: number}>"
}
},
{
"name": "defaultDelay",
"default": "1000",
"description": "Default delay between commands in milliseconds",
"optional": true,
"type": {
"text": "number"
}
}
],
"description": "Execute multiple commands with delays between them.\nUseful for demos, presentations, or scripted terminal sequences.",
"return": {
"type": {
"text": "Promise<void>"
}
}
},
{
"kind": "method",
"name": "_printCommandLine",
"parameters": [
{
"name": "input"
}
],
"description": "Print command line to output"
},
{
"kind": "method",
"name": "print",
"parameters": [
{
"name": "text",
"description": "Text to print (can contain newlines)",
"type": {
"text": "string"
}
},
{
"name": "type",
"default": "'output'",
"description": "Line type for styling: \"output\" (default), \"error\" (red), \"info\" (cyan), \"success\" (green)",
"optional": true,
"type": {
"text": "string"
}
}
],
"description": "Print text to the terminal.\nSupports multiple lines (splits on \\n) and ANSI color codes.",
"return": {
"type": {
"text": "Promise<void>"
}
}
},
{
"kind": "method",
"name": "_prefersReducedMotion",
"description": "Check if user prefers reduced motion\nCan be overridden with forceAnimations config for testing"
},
{
"kind": "method",
"name": "_processTypingQueue",
"description": "Process queued typing effect prints"
},
{
"kind": "method",
"name": "_trimOutputIfNeeded",
"description": "Trim output lines if exceeding max"
},
{
"kind": "method",
"name": "_renderWithTypingEffect",
"parameters": [
{
"name": "lines"
},
{
"name": "type"
}
],
"description": "Render output with typing effect"
},
{
"kind": "method",
"name": "skipTypingEffect",
"description": "Skip the current typing animation and show all remaining output immediately.\nThis is also triggered when the user presses Ctrl+C or clicks the terminal during a typing effect."
},
{
"kind": "method",
"name": "_delay",
"parameters": [
{
"name": "ms"
}
],
"description": "Delay helper for typing effect",
"privacy": "private"
},
{
"kind": "method",
"name": "clear",
"description": "Clear all terminal output."
},
{
"kind": "method",
"name": "_parseAnsi",
"parameters": [
{
"name": "text",
"description": "Text with ANSI codes",
"type": {
"text": "string"
}
}
],
"description": "Parse ANSI escape codes and convert to HTML",
"return": {
"type": {
"text": "string"
}
}
},
{
"kind": "method",
"name": "_appendLineToDom",
"parameters": [
{
"name": "line"
}
],
"description": "Append a single line to the DOM"
},
{
"kind": "method",
"name": "_renderOutput",
"description": "Render the output area"
},
{
"kind": "method",
"name": "_isNearBottom",
"description": "Check if terminal is scrolled near the bottom"
},
{
"kind": "method",
"name": "_handleScroll",
"description": "Handle scroll events for smart auto-scroll"
},
{
"kind": "method",
"name": "_scrollToBottom",
"description": "Scroll to bottom of terminal (respects auto-scroll setting)"
},
{
"kind": "method",
"name": "scrollToBottom",
"description": "Force scroll to the bottom of the terminal.\nThe terminal uses smart auto-scroll: it automatically scrolls when new output appears,\nbut stops if the user scrolls up to read previous content. This method forces a scroll\nand re-enables auto-scroll."
},
{
"kind": "method",
"name": "_escapeHtml",
"parameters": [
{
"name": "text"
}
],
"description": "Escape HTML for safe display"
},
{
"kind": "method",
"name": "_announce",
"parameters": [
{
"name": "message"
}
],
"description": "Announce message to screen readers"
},
{
"kind": "method",
"name": "_setupEventListeners",
"description": "Setup event listeners"
},
{
"kind": "method",
"name": "_navigateHistory",
"parameters": [
{
"name": "direction"
}
],
"description": "Navigate command history"
},
{
"kind": "method",
"name": "_autocomplete",
"description": "Autocomplete command"
},
{
"kind": "method",
"name": "_updateInputDisplay",
"description": "Update the visible input display"
},
{
"kind": "method",
"name": "_focusInput",
"description": "Focus the hidden input"
},
{
"kind": "method",
"name": "setInputMask",
"parameters": [
{
"name": "masked",
"description": "Whether to mask input",
"type": {
"text": "boolean"
}
}
],
"description": "Enable or disable input masking for password prompts.\nWhen masked, input is displayed as asterisks (***) instead of the actual characters."
},
{
"kind": "method",
"name": "copyContent",
"parameters": [
{
"name": "mode",
"default": "'all'",
"description": "Copy mode: \"all\" (everything with prompts), \"commands\" (only commands entered), \"output\" (only output, no commands), \"selection\" (current text selection)",
"optional": true,
"type": {
"text": "string"
}
}
],
"description": "Copy terminal content to clipboard.",
"return": {
"type": {
"text": "Promise<void>"
}
}
},
{
"kind": "method",
"name": "_copyToClipboard",
"parameters": [
{
"name": "text"
},
{
"name": "mode",
"default": "'all'"
}
],
"description": "Internal method to copy text to clipboard"
},
{
"kind": "method",
"name": "_toggleCopyMenu",
"description": "Toggle copy menu visibility"
},
{
"kind": "method",
"name": "_openCopyMenu",
"description": "Open the copy menu with keyboard support"
},
{
"kind": "method",
"name": "_closeCopyMenu",
"description": "Close the copy menu and return focus"
},
{
"kind": "method",
"name": "_handleCopyMenuKeydown",
"parameters": [
{
"name": "e"
}
],
"description": "Handle keyboard navigation in copy menu"
},
{
"kind": "method",
"name": "_showCopyFeedback",
"parameters": [
{
"name": "message"
}
],
"description": "Show copy feedback"
},
{
"kind": "method",
"name": "toggleMode",
"description": "Toggle the resolved color mode (dark ↔ light). Writes to the `mode` attribute, so explicit toggling overrides page and OS detection.",
"return": {
"type": {
"text": "void"
}
}
},
{
"kind": "method",
"name": "toggleTheme",
"description": "Toggle between light and dark theme.\nAnnounces the theme change to screen readers and fires no events (use attribute observation for reactivity).",
"return": {
"type": {
"text": "void"
}
}
},
{
"kind": "method",
"name": "close",
"description": "Close the terminal by hiding it.\nSets `display: none` on the element and dispatches a `close` event.\nThe terminal can be shown again by setting `display: block` or removing the style.",
"return": {
"type": {
"text": "void"
}
}
},
{
"kind": "method",
"name": "minimize",
"description": "Toggle the minimized state of the terminal.\nWhen minimized, only the header is visible. Dispatches a `minimize` event with the new state.",
"return": {
"type": {
"text": "void"
}
}
},
{
"kind": "method",
"name": "toggleFullscreen",
"description": "Toggle fullscreen mode (maximize).\nWhen fullscreen, the terminal fills the entire viewport. Press Escape to exit.\nDispatches a `fullscreen` event with the new state.",
"return": {
"type": {
"text": "void"
}
}
},
{
"kind": "method",
"name": "setTheme",
"parameters": [
{
"name": "theme",
"description": "The theme to apply",
"type": {
"text": "('dark'|'light')"
}
}
],
"description": "Set the color theme programmatically.",
"return": {
"type": {
"text": "void"
}
}
},
{
"kind": "method",
"name": "setPrompt",
"parameters": [
{
"name": "prompt",
"description": "The prompt text to display (e.g., \"$ \", \"> \", \"user@host:~$ \")",
"type": {
"text": "string"
}
}
],
"description": "Set the command prompt text programmatically.",
"return": {
"type": {
"text": "void"
}
}
},
{
"kind": "method",
"name": "setCursorStyle",
"parameters": [
{
"name": "style",
"description": "The cursor style to apply",
"type": {
"text": "('block'|'underline'|'bar')"
}
}
],
"description": "Set the cursor style programmatically.",
"return": {
"type": {
"text": "void"
}
}
},
{
"kind": "method",
"name": "setCursorBlink",
"parameters": [
{
"name": "blink",
"description": "Whether the cursor should blink",
"type": {
"text": "boolean"
}
}
],
"description": "Enable or disable cursor blinking programmatically.",
"return": {
"type": {
"text": "void"
}
}
},
{
"kind": "method",
"name": "setTypingEffect",
"parameters": [
{
"name": "enabled",
"description": "Whether to enable the typing effect",
"type": {
"text": "boolean"
}
},
{
"name": "speed",
"default": "30",
"description": "Milliseconds per character (lower = faster)",
"optional": true,
"type": {
"text": "number"
}
}
],
"description": "Enable or disable the typing effect for output.\nWhen enabled, printed text appears character by character like a typewriter.\nRespects `prefers-reduced-motion` unless `force-animations` is set.",
"return": {
"type": {
"text": "void"
}
}
},
{
"kind": "method",
"name": "setReadonly",
"parameters": [
{
"name": "readonly",
"description": "Whether to enable readonly mode",
"type": {
"text": "boolean"
}
}
],
"description": "Enable or disable readonly mode.\nWhen readonly, the input line is hidden and users cannot type commands.\nUseful for presentation or demonstration purposes.",
"return": {
"type": {
"text": "void"
}
}
},
{
"kind": "method",
"name": "setForceAnimations",
"parameters": [
{
"name": "force",
"description": "If true, animations will run regardless of system preference",
"type": {
"text": "boolean"
}
}
],
"description": "Override the user's `prefers-reduced-motion` system preference.\nWhen forced, typing animations will run even if the user has reduced motion enabled.\nUse sparingly and only for testing or when the animation is essential to the experience.",
"return": {
"type": {
"text": "void"
}
}
},
{
"kind": "method",
"name": "hasReducedMotion",
"description": "Check if the user has enabled `prefers-reduced-motion` in their system settings.\nWhen true, the terminal will skip typing animations unless `force-animations` is set.",
"return": {
"type": {
"text": "boolean"
}
}
},
{
"kind": "method",
"name": "setI18n",
"parameters": [
{
"name": "strings",
"description": "Object containing string keys to override",
"type": {
"text": "@param {string} [strings.copy] - \"Copy\" button text\n * @param {string} [strings.close] - \"Close\" button tooltip\n * @param {string} [strings.minimize] - \"Minimize\" button tooltip\n * @param {string} [strings.maximize] - \"Maximize\" button tooltip\n * @param {string} [strings.toggleTheme] - \"Toggle theme\" button tooltip\n * @param {string} [strings.copyAll] - \"Copy All\" menu item\n * @param {string} [strings.copyCommandsOnly] - \"Copy Commands Only\" menu item\n * @param {string} [strings.copyOutputOnly] - \"Copy Output Only\" menu item\n * @param {string} [strings.copied] - \"Copied!\" feedback message\n * @param {string} [strings.commandNotFound] - \"Command not found\" error message\n * "
}
}
],
"description": "Set internationalization (i18n) strings for localization.\nMerges the provided strings with the existing defaults.\nTriggers a re-render to apply the new strings.",
"return": {
"type": {
"text": "void"
}
}
},
{
"kind": "method",
"name": "getI18n",
"description": "Get a copy of the current i18n strings configuration.",
"return": {
"type": {
"text": "Object"
}
}
},
{
"kind": "method",
"name": "_t",
"parameters": [
{
"name": "key",
"description": "The i18n key",
"type": {
"text": "string"
}
}
],
"description": "Get a localized string",
"return": {
"type": {
"text": "string"
}
}
},
{
"kind": "method",
"name": "getHistory",
"description": "Get the command history array.\nReturns a copy of the history, not a reference to the internal array.",
"return": {
"type": {
"text": "string[]"
}
}
},
{
"kind": "method",
"name": "setHistory",
"parameters": [
{
"name": "history",
"description": "Array of commands to set as history",
"type": {
"text": "string[]"
}
}
],
"description": "Replace the command history with a new array.\nUseful for restoring history from storage or initializing with predefined commands.",
"return": {
"type": {
"text": "void"
}
}
},
{
"kind": "method",
"name": "clearHistory",
"description": "Clear all command history.\nIf `persist-history` is enabled, also clears the localStorage entry.",
"return": {
"type": {
"text": "void"
}
}
},
{
"kind": "method",
"name": "getContent",
"description": "Get all terminal output as plain text.\nIncludes both commands (with prompts) and output lines.",
"return": {
"type": {
"text": "string"
}
}
},
{
"kind": "method",
"name": "focus",
"description": "Focus the terminal's input field.\nUseful after programmatically interacting with the terminal.",
"return": {
"type": {
"text": "void"
}
}
},
{
"kind": "method",
"name": "render",
"description": "Render the component"
},
{
"kind": "field",
"name": "adoptedStyleSheets",
"type": {
"text": "array"
},
"default": "[sheet]"
},
{
"kind": "field",
"name": "ansiParser",
"default": "new AnsiParser()"
},
{
"kind": "field",
"name": "commandRegistry",
"default": "new CommandRegistry()"
},
{
"kind": "field",
"name": "historyManager",
"default": "new HistoryManager()"
},
{
"kind": "field",
"name": "fileSystem",
"default": "new VirtualFileSystem()"
},
{
"kind": "field",
"name": "outputLines",
"type": {
"text": "array"
},
"default": "[]"
},