perfect-gui 2.5.0 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,11 +6,157 @@
6
6
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
7
7
  <title></title>
8
8
  <meta name="viewport" content="width=device-width, initial-scale=1">
9
- <link href="main.css?d7f562ff55b98ca24d03" rel="stylesheet"></head>
9
+ <script defer src="./bundle.js?0ae3a19d7ad6f108b28a"></script><link href="main.css?0ae3a19d7ad6f108b28a" rel="stylesheet"></head>
10
10
 
11
11
  <body>
12
- <div id="element"></div>
13
- <p id="note"></p>
14
- <script type="text/javascript" src="./bundle.js?d7f562ff55b98ca24d03"></script></body>
12
+ <div class="wrapper">
13
+ <h1>Perfect GUI API</h1>
14
+
15
+ <h2>Basics</h2>
16
+
17
+ <div id="container-1" class="container">
18
+ <div class="element"></div>
19
+ <p class="note"></p>
20
+ </div>
21
+
22
+ <!-- HTML generated using hilite.me --><div style="background: #272822; overflow:auto;width:auto;;"><pre style="margin: 0; line-height: 125%"><span style="color: #66d9ef">const</span> <span style="color: #a6e22e">gui_1</span> <span style="color: #f92672">=</span> <span style="color: #66d9ef">new</span> <span style="color: #a6e22e">perfectGUI</span><span style="color: #f8f8f2">({</span>
23
+ <span style="color: #a6e22e">name</span><span style="color: #f92672">:</span> <span style="color: #e6db74">&#39;Basics&#39;</span><span style="color: #f8f8f2">,</span>
24
+ <span style="color: #f8f8f2">});</span>
25
+
26
+ <span style="color: #a6e22e">gui_1</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">addButton</span><span style="color: #f8f8f2">(</span><span style="color: #e6db74">&#39;Button&#39;</span><span style="color: #f8f8f2">,</span> <span style="color: #f8f8f2">()</span> <span style="color: #f92672">=&gt;</span> <span style="color: #f8f8f2">{</span>
27
+ <span style="color: #a6e22e">element</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">style</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">backgroundColor</span> <span style="color: #f92672">=</span> <span style="color: #a6e22e">getRandomColor</span><span style="color: #f8f8f2">();</span>
28
+ <span style="color: #a6e22e">element</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">style</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">backgroundImage</span> <span style="color: #f92672">=</span> <span style="color: #e6db74">&#39;none&#39;</span><span style="color: #f8f8f2">;</span>
29
+ <span style="color: #f8f8f2">});</span>
30
+
31
+ <span style="color: #a6e22e">gui_1</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">addSlider</span><span style="color: #f8f8f2">(</span><span style="color: #e6db74">&#39;Slider&#39;</span><span style="color: #f8f8f2">,</span>
32
+ <span style="color: #f8f8f2">{</span> <span style="color: #a6e22e">min</span><span style="color: #f92672">:</span> <span style="color: #ae81ff">0</span><span style="color: #f8f8f2">,</span> <span style="color: #a6e22e">max</span><span style="color: #f92672">:</span> <span style="color: #ae81ff">2</span><span style="color: #f8f8f2">,</span> <span style="color: #a6e22e">value</span><span style="color: #f92672">:</span> <span style="color: #ae81ff">1</span><span style="color: #f8f8f2">,</span> <span style="color: #a6e22e">step</span><span style="color: #f92672">:</span> <span style="color: #f8f8f2">.</span><span style="color: #ae81ff">01</span> <span style="color: #f8f8f2">},</span>
33
+ <span style="color: #a6e22e">value</span> <span style="color: #f92672">=&gt;</span> <span style="color: #a6e22e">element</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">style</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">transform</span> <span style="color: #f92672">=</span> <span style="color: #960050; background-color: #1e0010">`</span><span style="color: #a6e22e">scale</span><span style="color: #f8f8f2">(</span><span style="color: #a6e22e">$</span><span style="color: #f8f8f2">{</span> <span style="color: #a6e22e">value</span> <span style="color: #f8f8f2">})</span><span style="color: #960050; background-color: #1e0010">`</span>
34
+ <span style="color: #f8f8f2">);</span>
35
+
36
+ <span style="color: #a6e22e">gui_1</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">addSwitch</span><span style="color: #f8f8f2">(</span><span style="color: #e6db74">&#39;Switch&#39;</span><span style="color: #f8f8f2">,</span> <span style="color: #66d9ef">true</span><span style="color: #f8f8f2">,</span> <span style="color: #a6e22e">state</span> <span style="color: #f92672">=&gt;</span> <span style="color: #f8f8f2">{</span>
37
+ <span style="color: #66d9ef">if</span> <span style="color: #f8f8f2">(</span> <span style="color: #a6e22e">state</span> <span style="color: #f8f8f2">)</span> <span style="color: #a6e22e">element</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">classList</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">remove</span><span style="color: #f8f8f2">(</span><span style="color: #e6db74">&#39;round&#39;</span><span style="color: #f8f8f2">);</span>
38
+ <span style="color: #66d9ef">else</span> <span style="color: #a6e22e">element</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">classList</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">add</span><span style="color: #f8f8f2">(</span><span style="color: #e6db74">&#39;round&#39;</span><span style="color: #f8f8f2">);</span>
39
+ <span style="color: #f8f8f2">});</span>
40
+
41
+ <span style="color: #a6e22e">gui_1</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">addList</span><span style="color: #f8f8f2">(</span><span style="color: #e6db74">&#39;List&#39;</span><span style="color: #f8f8f2">,</span> <span style="color: #f8f8f2">[</span><span style="color: #e6db74">&#39;red&#39;</span><span style="color: #f8f8f2">,</span> <span style="color: #e6db74">&#39;pink&#39;</span><span style="color: #f8f8f2">,</span> <span style="color: #e6db74">&#39;yellow&#39;</span><span style="color: #f8f8f2">,</span> <span style="color: #e6db74">&#39;blue&#39;</span><span style="color: #f8f8f2">],</span> <span style="color: #a6e22e">item</span> <span style="color: #f92672">=&gt;</span> <span style="color: #f8f8f2">{</span>
42
+ <span style="color: #a6e22e">element</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">style</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">backgroundColor</span> <span style="color: #f92672">=</span> <span style="color: #a6e22e">item</span><span style="color: #f8f8f2">;</span>
43
+ <span style="color: #a6e22e">element</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">style</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">backgroundImage</span> <span style="color: #f92672">=</span> <span style="color: #e6db74">&#39;none&#39;</span><span style="color: #f8f8f2">;</span>
44
+ <span style="color: #f8f8f2">});</span>
45
+
46
+ <span style="color: #a6e22e">gui_1</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">addImage</span><span style="color: #f8f8f2">(</span><span style="color: #e6db74">&#39;Image 1&#39;</span><span style="color: #f8f8f2">,</span> <span style="color: #e6db74">&#39;path/to/image-1.jpg&#39;</span><span style="color: #f8f8f2">,</span>
47
+ <span style="color: #a6e22e">path</span> <span style="color: #f92672">=&gt;</span> <span style="color: #f8f8f2">{</span>
48
+ <span style="color: #a6e22e">element</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">style</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">backgroundImage</span> <span style="color: #f92672">=</span> <span style="color: #960050; background-color: #1e0010">`</span><span style="color: #a6e22e">url</span><span style="color: #f8f8f2">(</span><span style="color: #a6e22e">$</span><span style="color: #f8f8f2">{</span><span style="color: #a6e22e">path</span><span style="color: #f8f8f2">})</span><span style="color: #960050; background-color: #1e0010">`</span><span style="color: #f8f8f2">;</span>
49
+ <span style="color: #f8f8f2">document.</span><span style="color: #a6e22e">querySelector</span><span style="color: #f8f8f2">(</span><span style="color: #e6db74">&#39;#container-1 .note&#39;</span><span style="color: #f8f8f2">).</span><span style="color: #a6e22e">textContent</span> <span style="color: #f92672">=</span> <span style="color: #e6db74">&quot;Photo by Joel Filipe on Unsplash&quot;</span><span style="color: #f8f8f2">;</span>
50
+ <span style="color: #f8f8f2">}</span>
51
+ <span style="color: #f8f8f2">);</span>
52
+
53
+ <span style="color: #a6e22e">gui_1</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">addImage</span><span style="color: #f8f8f2">(</span><span style="color: #e6db74">&#39;Image 2&#39;</span><span style="color: #f8f8f2">,</span> <span style="color: #e6db74">&#39;path/to/image-2.jpg&#39;</span><span style="color: #f8f8f2">,</span>
54
+ <span style="color: #a6e22e">path</span> <span style="color: #f92672">=&gt;</span> <span style="color: #f8f8f2">{</span>
55
+ <span style="color: #a6e22e">element</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">style</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">backgroundImage</span> <span style="color: #f92672">=</span> <span style="color: #960050; background-color: #1e0010">`</span><span style="color: #a6e22e">url</span><span style="color: #f8f8f2">(</span><span style="color: #a6e22e">$</span><span style="color: #f8f8f2">{</span><span style="color: #a6e22e">path</span><span style="color: #f8f8f2">})</span><span style="color: #960050; background-color: #1e0010">`</span><span style="color: #f8f8f2">;</span>
56
+ <span style="color: #f8f8f2">document.</span><span style="color: #a6e22e">querySelector</span><span style="color: #f8f8f2">(</span><span style="color: #e6db74">&#39;#container-1 .note&#39;</span><span style="color: #f8f8f2">).</span><span style="color: #a6e22e">textContent</span> <span style="color: #f92672">=</span> <span style="color: #e6db74">&quot;Photo by Milad Fakurian on Unsplash&quot;</span><span style="color: #f8f8f2">;</span>
57
+ <span style="color: #f8f8f2">}</span>
58
+ <span style="color: #f8f8f2">);</span>
59
+ </pre></div>
60
+
61
+ <h2>Positioning</h2>
62
+ <p>GUI instances can be positioned in any corner of the screen / container.</p>
63
+ <p>When multiple instances share the same position (like GUI 1 and GUI 2 in the example below), they are stacked next to each other.</p>
64
+ <div id="container-2" class="container">
65
+ <div class="element"></div>
66
+ </div>
67
+
68
+ <!-- HTML generated using hilite.me --><div style="background: #272822; overflow:auto;width:auto;;"><pre style="margin: 0; line-height: 125%"><span style="color: #66d9ef">const</span> <span style="color: #a6e22e">gui_1</span> <span style="color: #f92672">=</span> <span style="color: #66d9ef">new</span> <span style="color: #a6e22e">perfectGUI</span><span style="color: #f8f8f2">({</span>
69
+ <span style="color: #a6e22e">name</span><span style="color: #f92672">:</span> <span style="color: #e6db74">&#39;GUI 1&#39;</span><span style="color: #f8f8f2">,</span>
70
+ <span style="color: #a6e22e">width</span><span style="color: #f92672">:</span> <span style="color: #ae81ff">200</span>
71
+ <span style="color: #f8f8f2">});</span>
72
+
73
+ <span style="color: #a6e22e">gui_1</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">addButton</span><span style="color: #f8f8f2">(</span><span style="color: #e6db74">&#39;Buttons can handle multiple lines of text.&#39;</span><span style="color: #f8f8f2">,</span> <span style="color: #f8f8f2">()</span> <span style="color: #f92672">=&gt;</span> <span style="color: #f8f8f2">{</span>
74
+ <span style="color: #a6e22e">element</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">style</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">backgroundColor</span> <span style="color: #f92672">=</span> <span style="color: #a6e22e">getRandomColor</span><span style="color: #f8f8f2">();</span>
75
+ <span style="color: #f8f8f2">});</span>
76
+
77
+ <span style="color: #66d9ef">const</span> <span style="color: #a6e22e">gui_2</span> <span style="color: #f92672">=</span> <span style="color: #66d9ef">new</span> <span style="color: #a6e22e">perfectGUI</span><span style="color: #f8f8f2">({</span>
78
+ <span style="color: #a6e22e">name</span><span style="color: #f92672">:</span> <span style="color: #e6db74">&#39;GUI 2&#39;</span><span style="color: #f8f8f2">,</span>
79
+ <span style="color: #a6e22e">width</span><span style="color: #f92672">:</span> <span style="color: #ae81ff">200</span>
80
+ <span style="color: #f8f8f2">});</span>
81
+
82
+ <span style="color: #a6e22e">gui_2</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">addButton</span><span style="color: #f8f8f2">(</span><span style="color: #e6db74">&#39;Button&#39;</span><span style="color: #f8f8f2">,</span> <span style="color: #f8f8f2">()</span> <span style="color: #f92672">=&gt;</span> <span style="color: #a6e22e">element</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">style</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">backgroundColor</span> <span style="color: #f92672">=</span> <span style="color: #a6e22e">getRandomColor</span><span style="color: #f8f8f2">()</span> <span style="color: #f8f8f2">);</span>
83
+
84
+ <span style="color: #66d9ef">const</span> <span style="color: #a6e22e">gui_3</span> <span style="color: #f92672">=</span> <span style="color: #66d9ef">new</span> <span style="color: #a6e22e">perfectGUI</span><span style="color: #f8f8f2">({</span>
85
+ <span style="color: #a6e22e">name</span><span style="color: #f92672">:</span> <span style="color: #e6db74">&#39;GUI 3&#39;</span><span style="color: #f8f8f2">,</span>
86
+ <span style="color: #a6e22e">position</span><span style="color: #f92672">:</span> <span style="color: #e6db74">&#39;top right&#39;</span>
87
+ <span style="color: #f8f8f2">});</span>
88
+
89
+ <span style="color: #a6e22e">gui_3</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">addButton</span><span style="color: #f8f8f2">(</span><span style="color: #e6db74">&#39;Button&#39;</span><span style="color: #f8f8f2">,</span> <span style="color: #f8f8f2">()</span> <span style="color: #f92672">=&gt;</span> <span style="color: #a6e22e">element</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">style</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">backgroundColor</span> <span style="color: #f92672">=</span> <span style="color: #a6e22e">getRandomColor</span><span style="color: #f8f8f2">()</span> <span style="color: #f8f8f2">);</span>
90
+
91
+ <span style="color: #66d9ef">const</span> <span style="color: #a6e22e">gui_4</span> <span style="color: #f92672">=</span> <span style="color: #66d9ef">new</span> <span style="color: #a6e22e">perfectGUI</span><span style="color: #f8f8f2">({</span>
92
+ <span style="color: #a6e22e">name</span><span style="color: #f92672">:</span> <span style="color: #e6db74">&#39;GUI 4&#39;</span><span style="color: #f8f8f2">,</span>
93
+ <span style="color: #a6e22e">position</span><span style="color: #f92672">:</span> <span style="color: #e6db74">&#39;right bottom&#39;</span>
94
+ <span style="color: #f8f8f2">});</span>
95
+
96
+ <span style="color: #a6e22e">gui_4</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">addButton</span><span style="color: #f8f8f2">(</span><span style="color: #e6db74">&#39;Button&#39;</span><span style="color: #f8f8f2">,</span> <span style="color: #f8f8f2">()</span> <span style="color: #f92672">=&gt;</span> <span style="color: #a6e22e">element</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">style</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">backgroundColor</span> <span style="color: #f92672">=</span> <span style="color: #a6e22e">getRandomColor</span><span style="color: #f8f8f2">()</span> <span style="color: #f8f8f2">);</span>
97
+ </pre></div>
98
+
99
+
100
+ <h2>Folders</h2>
101
+ Folders can be closed by default by setting the <i>open</i> parameter to <span class="code">false</span>.
102
+ <div id="container-3" class="container">
103
+ <div class="element"></div>
104
+ </div>
105
+
106
+ <!-- HTML generated using hilite.me --><div style="background: #272822; overflow:auto;width:auto;;"><pre style="margin: 0; line-height: 125%"><span style="color: #66d9ef">const</span> <span style="color: #a6e22e">gui</span> <span style="color: #f92672">=</span> <span style="color: #66d9ef">new</span> <span style="color: #a6e22e">perfectGUI</span><span style="color: #f8f8f2">({</span>
107
+ <span style="color: #a6e22e">name</span><span style="color: #f92672">:</span> <span style="color: #e6db74">&#39;Folders&#39;</span>
108
+ <span style="color: #f8f8f2">});</span>
109
+
110
+ <span style="color: #66d9ef">let</span> <span style="color: #a6e22e">folder_1</span> <span style="color: #f92672">=</span> <span style="color: #a6e22e">gui</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">addFolder</span><span style="color: #f8f8f2">(</span><span style="color: #e6db74">&#39;Folder 1&#39;</span><span style="color: #f8f8f2">);</span>
111
+
112
+ <span style="color: #a6e22e">folder_1</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">addButton</span><span style="color: #f8f8f2">(</span><span style="color: #e6db74">&quot;Random color&quot;</span><span style="color: #f8f8f2">,</span> <span style="color: #f8f8f2">()</span> <span style="color: #f92672">=&gt;</span> <span style="color: #f8f8f2">{</span>
113
+ <span style="color: #a6e22e">element</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">style</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">backgroundColor</span> <span style="color: #f92672">=</span> <span style="color: #a6e22e">getRandomColor</span><span style="color: #f8f8f2">();</span>
114
+ <span style="color: #f8f8f2">});</span>
115
+
116
+ <span style="color: #66d9ef">let</span> <span style="color: #a6e22e">folder_2</span> <span style="color: #f92672">=</span> <span style="color: #a6e22e">gui</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">addFolder</span><span style="color: #f8f8f2">(</span><span style="color: #e6db74">&#39;Folder 2&#39;</span><span style="color: #f8f8f2">,</span> <span style="color: #66d9ef">false</span><span style="color: #f8f8f2">);</span>
117
+
118
+ <span style="color: #a6e22e">folder_2</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">addButton</span><span style="color: #f8f8f2">(</span><span style="color: #e6db74">&quot;Random color&quot;</span><span style="color: #f8f8f2">,</span> <span style="color: #f8f8f2">()</span> <span style="color: #f92672">=&gt;</span> <span style="color: #f8f8f2">{</span>
119
+ <span style="color: #a6e22e">element</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">style</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">backgroundColor</span> <span style="color: #f92672">=</span> <span style="color: #a6e22e">getRandomColor</span><span style="color: #f8f8f2">();</span>
120
+ <span style="color: #f8f8f2">});</span>
121
+ </pre></div>
122
+
123
+ <h2>Other options</h2>
124
+ <p>GUI panels can be dragged around with the <span class="code">draggable</span> option.</p>
125
+ <p>They can also have a custom width, by using the <span class="code">width</span> option.</p>
126
+ <p>The <span class="code">toggleClose()</span> method can be used to open / close a GUI panel.</p>
127
+ <p>Just like folders, GUI panels can be closed by default by setting the <span class="code">close</span> option to <span class="code">true</span>.</p>
128
+ <div id="container-4" class="container">
129
+ </div>
130
+
131
+ <!-- HTML generated using hilite.me --><div style="background: #272822; overflow:auto;width:auto;;"><pre style="margin: 0; line-height: 125%"><span style="color: #66d9ef">const</span> <span style="color: #a6e22e">gui_1</span> <span style="color: #f92672">=</span> <span style="color: #66d9ef">new</span> <span style="color: #a6e22e">perfectGUI</span><span style="color: #f8f8f2">({</span>
132
+ <span style="color: #a6e22e">name</span><span style="color: #f92672">:</span> <span style="color: #e6db74">&#39;GUI 1 (drag me!)&#39;</span><span style="color: #f8f8f2">,</span>
133
+ <span style="color: #a6e22e">width</span><span style="color: #f92672">:</span> <span style="color: #ae81ff">500</span><span style="color: #f8f8f2">,</span>
134
+ <span style="color: #a6e22e">draggable</span><span style="color: #f92672">:</span> <span style="color: #66d9ef">true</span>
135
+ <span style="color: #f8f8f2">});</span>
136
+ <span style="color: #a6e22e">gui_1</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">addButton</span><span style="color: #f8f8f2">(</span><span style="color: #e6db74">&#39;Custom width using the `width` option&#39;</span><span style="color: #f8f8f2">,</span> <span style="color: #f8f8f2">()</span> <span style="color: #f92672">=&gt;</span> <span style="color: #f8f8f2">{});</span>
137
+
138
+ <span style="color: #66d9ef">const</span> <span style="color: #a6e22e">gui_2</span> <span style="color: #f92672">=</span> <span style="color: #66d9ef">new</span> <span style="color: #a6e22e">perfectGUI</span><span style="color: #f8f8f2">({</span>
139
+ <span style="color: #a6e22e">name</span><span style="color: #f92672">:</span> <span style="color: #e6db74">&#39;GUI 2 (drag me!)&#39;</span><span style="color: #f8f8f2">,</span>
140
+ <span style="color: #a6e22e">close</span><span style="color: #f92672">:</span> <span style="color: #66d9ef">true</span><span style="color: #f8f8f2">,</span>
141
+ <span style="color: #a6e22e">draggable</span><span style="color: #f92672">:</span> <span style="color: #66d9ef">true</span><span style="color: #f8f8f2">,</span>
142
+ <span style="color: #a6e22e">position</span><span style="color: #f92672">:</span> <span style="color: #e6db74">&#39;bottom left&#39;</span>
143
+ <span style="color: #f8f8f2">});</span>
144
+
145
+ <span style="color: #a6e22e">gui_2</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">addButton</span><span style="color: #f8f8f2">(</span><span style="color: #e6db74">&#39;gui_1.toggleClose();&#39;</span><span style="color: #f8f8f2">,</span> <span style="color: #f8f8f2">()</span> <span style="color: #f92672">=&gt;</span> <span style="color: #f8f8f2">{</span>
146
+ <span style="color: #a6e22e">gui_1</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">toggleClose</span><span style="color: #f8f8f2">();</span>
147
+ <span style="color: #f8f8f2">});</span>
148
+
149
+ <span style="color: #66d9ef">const</span> <span style="color: #a6e22e">gui_3</span> <span style="color: #f92672">=</span> <span style="color: #66d9ef">new</span> <span style="color: #a6e22e">perfectGUI</span><span style="color: #f8f8f2">({</span>
150
+ <span style="color: #a6e22e">name</span><span style="color: #f92672">:</span> <span style="color: #e6db74">&#39;GUI 3 (closed)&#39;</span><span style="color: #f8f8f2">,</span>
151
+ <span style="color: #a6e22e">closed</span><span style="color: #f92672">:</span> <span style="color: #66d9ef">true</span><span style="color: #f8f8f2">,</span>
152
+ <span style="color: #f8f8f2">});</span>
153
+
154
+ <span style="color: #a6e22e">gui_3</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">addButton</span><span style="color: #f8f8f2">(</span><span style="color: #e6db74">&#39;gui_2.toggleClose();&#39;</span><span style="color: #f8f8f2">,</span> <span style="color: #f8f8f2">()</span> <span style="color: #f92672">=&gt;</span> <span style="color: #f8f8f2">{</span>
155
+ <span style="color: #a6e22e">gui_2</span><span style="color: #f8f8f2">.</span><span style="color: #a6e22e">toggleClose</span><span style="color: #f8f8f2">();</span>
156
+ <span style="color: #f8f8f2">});</span>
157
+ </pre></div>
158
+
159
+ </div>
160
+ </body>
15
161
 
16
162
  </html>
@@ -1,338 +1,91 @@
1
- /*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
2
- /* Document
3
- ========================================================================== */
4
- /**
5
- * 1. Correct the line height in all browsers.
6
- * 2. Prevent adjustments of font size after orientation changes in iOS.
7
- */
8
- html {
9
- line-height: 1.15;
10
- /* 1 */
11
- -webkit-text-size-adjust: 100%;
12
- /* 2 */ }
1
+ @import url(https://fonts.googleapis.com/css2?family=Montserrat&display=swap);
2
+ html, body {
3
+ height: 100%;
4
+ }
13
5
 
14
- /* Sections
15
- ========================================================================== */
16
- /**
17
- * Remove the margin in all browsers.
18
- */
19
6
  body {
20
- margin: 0; }
21
-
22
- /**
23
- * Render the `main` element consistently in IE.
24
- */
25
- main {
26
- display: block; }
7
+ margin: 0;
8
+ background-color: white;
9
+ color: black;
10
+ font-family: Arial, sans-serif;
11
+ }
12
+
13
+ .wrapper {
14
+ width: 800px;
15
+ margin: 0 auto;
16
+ padding-bottom: 100px;
17
+ }
18
+
19
+ h1, h2 {
20
+ font-family: 'Montserrat', sans-serif;
21
+ }
27
22
 
28
- /**
29
- * Correct the font size and margin on `h1` elements within `section` and
30
- * `article` contexts in Chrome, Firefox, and Safari.
31
- */
32
23
  h1 {
33
- font-size: 2em;
34
- margin: 0.67em 0; }
35
-
36
- /* Grouping content
37
- ========================================================================== */
38
- /**
39
- * 1. Add the correct box sizing in Firefox.
40
- * 2. Show the overflow in Edge and IE.
41
- */
42
- hr {
43
- box-sizing: content-box;
44
- /* 1 */
45
- height: 0;
46
- /* 1 */
47
- overflow: visible;
48
- /* 2 */ }
49
-
50
- /**
51
- * 1. Correct the inheritance and scaling of font size in all browsers.
52
- * 2. Correct the odd `em` font sizing in all browsers.
53
- */
54
- pre {
55
- font-family: monospace, monospace;
56
- /* 1 */
57
- font-size: 1em;
58
- /* 2 */ }
59
-
60
- /* Text-level semantics
61
- ========================================================================== */
62
- /**
63
- * Remove the gray background on active links in IE 10.
64
- */
65
- a {
66
- background-color: transparent; }
67
-
68
- /**
69
- * 1. Remove the bottom border in Chrome 57-
70
- * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
71
- */
72
- abbr[title] {
73
- border-bottom: none;
74
- /* 1 */
75
- text-decoration: underline;
76
- /* 2 */
77
- text-decoration: underline dotted;
78
- /* 2 */ }
79
-
80
- /**
81
- * Add the correct font weight in Chrome, Edge, and Safari.
82
- */
83
- b,
84
- strong {
85
- font-weight: bolder; }
86
-
87
- /**
88
- * 1. Correct the inheritance and scaling of font size in all browsers.
89
- * 2. Correct the odd `em` font sizing in all browsers.
90
- */
91
- code,
92
- kbd,
93
- samp {
94
- font-family: monospace, monospace;
95
- /* 1 */
96
- font-size: 1em;
97
- /* 2 */ }
98
-
99
- /**
100
- * Add the correct font size in all browsers.
101
- */
102
- small {
103
- font-size: 80%; }
104
-
105
- /**
106
- * Prevent `sub` and `sup` elements from affecting the line height in
107
- * all browsers.
108
- */
109
- sub,
110
- sup {
111
- font-size: 75%;
112
- line-height: 0;
113
- position: relative;
114
- vertical-align: baseline; }
115
-
116
- sub {
117
- bottom: -0.25em; }
118
-
119
- sup {
120
- top: -0.5em; }
121
-
122
- /* Embedded content
123
- ========================================================================== */
124
- /**
125
- * Remove the border on images inside links in IE 10.
126
- */
127
- img {
128
- border-style: none; }
129
-
130
- /* Forms
131
- ========================================================================== */
132
- /**
133
- * 1. Change the font styles in all browsers.
134
- * 2. Remove the margin in Firefox and Safari.
135
- */
136
- button,
137
- input,
138
- optgroup,
139
- select,
140
- textarea {
141
- font-family: inherit;
142
- /* 1 */
143
- font-size: 100%;
144
- /* 1 */
145
- line-height: 1.15;
146
- /* 1 */
147
- margin: 0;
148
- /* 2 */ }
149
-
150
- /**
151
- * Show the overflow in IE.
152
- * 1. Show the overflow in Edge.
153
- */
154
- button,
155
- input {
156
- /* 1 */
157
- overflow: visible; }
158
-
159
- /**
160
- * Remove the inheritance of text transform in Edge, Firefox, and IE.
161
- * 1. Remove the inheritance of text transform in Firefox.
162
- */
163
- button,
164
- select {
165
- /* 1 */
166
- text-transform: none; }
167
-
168
- /**
169
- * Correct the inability to style clickable types in iOS and Safari.
170
- */
171
- button,
172
- [type="button"],
173
- [type="reset"],
174
- [type="submit"] {
175
- -webkit-appearance: button; }
176
-
177
- /**
178
- * Remove the inner border and padding in Firefox.
179
- */
180
- button::-moz-focus-inner,
181
- [type="button"]::-moz-focus-inner,
182
- [type="reset"]::-moz-focus-inner,
183
- [type="submit"]::-moz-focus-inner {
184
- border-style: none;
185
- padding: 0; }
24
+ margin: 80px 0;
25
+ }
186
26
 
187
- /**
188
- * Restore the focus styles unset by the previous rule.
189
- */
190
- button:-moz-focusring,
191
- [type="button"]:-moz-focusring,
192
- [type="reset"]:-moz-focusring,
193
- [type="submit"]:-moz-focusring {
194
- outline: 1px dotted ButtonText; }
27
+ h2 {
28
+ margin-top: 80px;
29
+ }
195
30
 
196
- /**
197
- * Correct the padding in Firefox.
198
- */
199
- fieldset {
200
- padding: 0.35em 0.75em 0.625em; }
31
+ .code {
32
+ font-family: monospace;
33
+ background-color: black;
34
+ color: #a6e22e;
35
+ padding: 3px 6px;
36
+ border-radius: 3px;
37
+ }
201
38
 
202
- /**
203
- * 1. Correct the text wrapping in Edge and IE.
204
- * 2. Correct the color inheritance from `fieldset` elements in IE.
205
- * 3. Remove the padding so developers are not caught out when they zero out
206
- * `fieldset` elements in all browsers.
207
- */
208
- legend {
209
- box-sizing: border-box;
210
- /* 1 */
211
- color: inherit;
212
- /* 2 */
213
- display: table;
214
- /* 1 */
215
- max-width: 100%;
216
- /* 1 */
217
- padding: 0;
218
- /* 3 */
219
- white-space: normal;
220
- /* 1 */ }
221
-
222
- /**
223
- * Add the correct vertical alignment in Chrome, Firefox, and Opera.
224
- */
225
- progress {
226
- vertical-align: baseline; }
227
-
228
- /**
229
- * Remove the default vertical scrollbar in IE 10+.
230
- */
231
- textarea {
232
- overflow: auto; }
233
-
234
- /**
235
- * 1. Add the correct box sizing in IE 10.
236
- * 2. Remove the padding in IE 10.
237
- */
238
- [type="checkbox"],
239
- [type="radio"] {
240
- box-sizing: border-box;
241
- /* 1 */
242
- padding: 0;
243
- /* 2 */ }
244
-
245
- /**
246
- * Correct the cursor style of increment and decrement buttons in Chrome.
247
- */
248
- [type="number"]::-webkit-inner-spin-button,
249
- [type="number"]::-webkit-outer-spin-button {
250
- height: auto; }
251
-
252
- /**
253
- * 1. Correct the odd appearance in Chrome and Safari.
254
- * 2. Correct the outline style in Safari.
255
- */
256
- [type="search"] {
257
- -webkit-appearance: textfield;
258
- /* 1 */
259
- outline-offset: -2px;
260
- /* 2 */ }
261
-
262
- /**
263
- * Remove the inner padding in Chrome and Safari on macOS.
264
- */
265
- [type="search"]::-webkit-search-decoration {
266
- -webkit-appearance: none; }
267
-
268
- /**
269
- * 1. Correct the inability to style clickable types in iOS and Safari.
270
- * 2. Change font properties to `inherit` in Safari.
271
- */
272
- ::-webkit-file-upload-button {
273
- -webkit-appearance: button;
274
- /* 1 */
275
- font: inherit;
276
- /* 2 */ }
277
-
278
- /* Interactive
279
- ========================================================================== */
280
- /*
281
- * Add the correct display in Edge, IE 10+, and Firefox.
282
- */
283
- details {
284
- display: block; }
285
-
286
- /*
287
- * Add the correct display in all browsers.
288
- */
289
- summary {
290
- display: list-item; }
291
-
292
- /* Misc
293
- ========================================================================== */
294
- /**
295
- * Add the correct display in IE 10+.
296
- */
297
- template {
298
- display: none; }
299
-
300
- /**
301
- * Add the correct display in IE 10.
302
- */
303
- [hidden] {
304
- display: none; }
305
-
306
- html, body {
307
- height: 100%; }
308
-
309
- body {
310
- overflow: hidden;
311
- margin: 0;
312
- background-color: black;
313
- transition: .3s all ease;
314
- background-position: center;
315
- background-size: cover; }
316
-
317
- #element {
318
- width: 100px;
319
- height: 100px;
320
- position: absolute;
321
- top: 0;
322
- left: 0;
323
- right: 0;
324
- bottom: 0;
325
- margin: auto;
326
- background-color: red;
327
- border: 1px solid black;
328
- transition: .1s transform ease, .3s border-radius ease, .3s background-color linear; }
329
-
330
- #note {
331
- position: absolute;
332
- bottom: 50px;
333
- left: 20px;
334
- text-shadow: 0 0 1px black, 0 0 1px black;
335
- font-family: arial;
336
- color: white;
337
- font-size: 10px; }
39
+ div:has(pre) {
40
+ border-radius: 5px;
41
+ }
338
42
 
43
+ pre {
44
+ padding: 20px;
45
+ border-radius: 5px;
46
+ font-size: 1.2em;
47
+ }
48
+
49
+ .container {
50
+ background-color: #111;
51
+ transition: .3s all ease;
52
+ background-position: center;
53
+ background-size: cover;
54
+ overflow: hidden;
55
+ position: relative;
56
+ height: 400px;
57
+ width: 100%;
58
+ margin: 20px auto 20px auto;
59
+ border-radius: 5px;
60
+ }
61
+
62
+ .element {
63
+ width: 100px;
64
+ height: 100px;
65
+ position: absolute;
66
+ top: 0;
67
+ left: 0;
68
+ right: 0;
69
+ bottom: 0;
70
+ margin: auto;
71
+ background-color: red;
72
+ background-size: cover;
73
+ background-position: center;
74
+ background-repeat: no-repeat;
75
+ border: 1px solid black;
76
+ transition: .1s transform ease, .3s border-radius ease, .3s background-color linear;
77
+ }
78
+
79
+ .element.round {
80
+ border-radius: 50%;
81
+ }
82
+
83
+ .note {
84
+ position: absolute;
85
+ bottom: 10px;
86
+ left: 20px;
87
+ text-shadow: 0 0 1px black, 0 0 1px black;
88
+ font-family: arial;
89
+ color: white;
90
+ font-size: 10px;
91
+ }