ctucx.git: mqtt-webui

webui for mqtt, can be used to control/display data in mqtt-topics

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 @media screen {
	:root {
		color-scheme:                      normal;
		--body-background-color:           #f8f9fa;
		--background-color:                #f8f9fa;
		--nav-background-color:            rgba(248, 249, 250, 0.3);
		--nav-scroll-border-color:         rgba(0, 0, 0, 0.125);
		--section-header-background-color: #f8f9fa;
		--section-background-color:        #fff;
		--section-border-color:            rgba(0, 0, 0, 0.125);
		--text-color:                      #212529;
		--secondary-text-color:            #212529;
		--icon-color:                      #212529;
		--switch-background-color:         #ccc;
		--switch-knob-color:               #6c757d;
		--switch-knob-active-color:        #693;
		--slider-background-color:         #ccc;
		--slider-knob-color:               #6c757d;
		--button-background-color:         #ccc;
		--button-active-background-color:  #693;
	}
}

@media screen and (prefers-color-scheme: dark) {
	:root {
		color-scheme:                      dark;
		--body-background-color:           #2c2c2eff;
		--background-color:                #1c1c1eff;
		--nav-background-color:            #2c2c2e4b;
		--nav-scroll-border-color:         #ebebf52e;
		--section-header-background-color: #2c2c2e4b;
		--section-background-color:        #1c1c1e4b;
		--section-border-color:            #ebebf52e;
		--text-color:                      #fff;
		--secondary-text-color:            #ebebf599;
		--icon-color:                      #fff;
		--switch-background-color:         #ebebf52e;
		--switch-knob-color:               #9b9aa3;
		--switch-knob-active-color:        #693;
		--slider-background-color:         #ebebf52e;
		--slider-knob-color:               #9b9aa3;
		--button-background-color:         #ebebf52e;
		--button-active-background-color:  #693;
	}

	section img {
		filter: invert(.8);
	}
}

*, ::before, ::after {
	box-sizing: border-box;
}

body {
	margin: 0;
	font-family: system-ui;
	font-size: 1rem;
	font-weight: 400;
	line-height: 1.5;
	color: var(--text-color);
	text-align: left;
	background-color: var(--body-background-color) !important;
	padding-top: 5em;
}

a {
	color: var(--text-color);
	text-decoration: none;
}

a:hover {
	color: unset;
}

img {
	vertical-align: middle;
}

nav {
	background-color: var(--nav-background-color);
	-webkit-backdrop-filter: blur(3rem);
	backdrop-filter: blur(3rem);
	position: fixed;
	z-index: 1;
	top: 0;
	left: 0;
	right: 0;
	padding: .5rem 1rem;
}

header {
	margin-left: auto;
	margin-right: auto;
	max-width: 50em;
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
}

.scroll {
	border-bottom: .1em solid var(--nav-scroll-border-color);
}

nav span {
	padding-top: .3125rem;
	padding-bottom: .3125rem;
	font-size: 1.25rem;
	white-space: nowrap;
}

button {
	background-color: transparent;
	border: none;
	padding: 0;
}

button:not(:disabled) {
	cursor: pointer;
}

button .icon {
	height: 31px;
	border: 0;
	padding: 0 .3rem;
}

.icon {
	height: 31px;
	width: 31px;
	margin: .25em;
}

.icon svg {
	color: var(--icon-color);
	height: 31px;
	width: 31px;
}

.page {
	margin-left: auto;
	margin-right: auto;
	max-width: 50em;
}

section {
	border-radius: .25em;
	border: .1em solid var(--section-border-color);
	margin-bottom: .6em;
}

section > div {
	background-color: var(--section-background-color);
	border-bottom: .1em solid var(--section-border-color);
	padding: .25em;
	color: var(--secondary-text-color);
	display: flex;
	align-items: center;
}

section > div[data-type="html"] {
	display: block;
}

section > div:first-child {
	border-top-left-radius: inherit;
	border-top-right-radius: inherit;
}

section > div:last-child {
	border-bottom-right-radius: inherit;
	border-bottom-left-radius: inherit;
	border-bottom: 0;
}

section > .title {
	color: var(--text-color);
	padding-left: 1em;
	background-color: var(--section-header-background-color);
}

section > div .title{
	padding: .5em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

section > div .right {
	margin-left: auto;
	margin-right: .25em;
}


/* Switch Styling*/
.switch {
	background-color: var(--switch-background-color);
	display: inline-block;
	border-radius: 1.2em;
	padding: 0.2em 2em 0.2em 0.2em;
	cursor: pointer;
	display: inline-block;
	position: relative;
	vertical-align: top;
}

.switch input {
	display: none;
}

.switch span {
	position: relative;
	transition: transform 0.1s;
	cursor: pointer;
	background-color: var(--switch-knob-color);
	color: #fff;
	display: inline-block;
	padding: 0.25em 1em;
	border-radius: 1em;
}

.switch input:checked ~ .switch-handle {
	background-color: var(--switch-knob-active-color);
	color: #fff;
	transform: translateX(1.8em);
}


/* Slider Styling*/
.slider {
	width: 100%;
	-webkit-appearance: none;
	height: 10px;
	border-radius: 5px;   
	background: var(--slider-background-color);
	outline: none;
}

.slider::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	border: 0;
	background: var(--slider-knob-color);
	cursor: pointer;
	box-shadow: var(--c,0) 0 0 #ccc;
}

.slider::-moz-range-thumb {
	width: 20px;
	height: 20px;
	border-radius: 50%;
	border: 0;
	background: var(--slider-knob-color);
	cursor: pointer;
	box-shadow: var(--c,0) 0 0 #ccc;
}


/* Button Styling*/
.buttons > button:first-child {
	border-top-left-radius: .5em;
	border-bottom-left-radius: .5em;
}

.buttons > button:last-child {
	border-top-right-radius: .5em;
	border-bottom-right-radius: .5em;
}

.buttons > button {
	background-color: var(--button-background-color);
	color: var(--secondary-text-color);
	padding: .5em .7em;
	margin: 0;
}

.buttons > .active {
	background-color: var(--button-active-background-color);
}


/* Select Styling */
select {
	padding: .3em .4em;
}


/* Number Styling*/
.number {
	display: flex;
}
.number > button:first-child {
	border-top-left-radius: .5em;
	border-bottom-left-radius: .5em;
}

.number > button:last-child {
	border-top-right-radius: .5em;
	border-bottom-right-radius: .5em;
}

.number > button {
	background-color: var(--button-background-color);
	color: var(--secondary-text-color);
	padding: .5em .7em;
	margin: 0;
}

.number > input {
	width: 0;
	border-radius: 0;
	border: 0;
	margin: 0;
	padding: .5em .4em;
}

.loader {
	border: 4px solid #ccc;
	border-top: 4px solid #6c757d;
	border-radius: 50%;
	width: 32px;
	height: 32px;
	animation: spin 1.5s linear infinite;
}


.working {
	animation-name: color;
	animation-duration: 1.5s;
	animation-iteration-count: infinite;
}

@keyframes spin {
	0% {   transform: rotate(0deg);   }
	100% { transform: rotate(360deg); }
}

@keyframes color {
	0% {   filter: brightness(85%); }
	50% {  filter: brightness(50%); }
	100% { filter: brightness(85%); }
}

@media screen and (max-width: 50em) {
	body {
		padding-top: 4em;
	}

	section > div:last-child {
		border-bottom: .1em solid var(--section-border-color);
	}

	section {
		border-radius: 0;
		border-width:  0;
		margin-bottom: 0;
	}
}

@media all and (display-mode: standalone) {
	body {
		user-select: none;
		-webkit-user-select: none;
		padding-bottom: 1em;
	}
}