├── .editorconfig ├── .gitignore ├── .prettierrc ├── README.md ├── assets ├── caret.svg ├── caret_closed.svg ├── check.png ├── check.svg ├── elg_calendar.svg ├── elg_calendar_inv.svg ├── rcheck.svg └── tick.svg ├── css ├── README.md └── sdpi.css ├── js ├── action.js ├── api.js ├── constants.js ├── dynamic-styles.js ├── events.js ├── property-inspector.js ├── prototypes.js ├── stream-deck.js ├── timers.js └── utils.js └── package.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: https://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # Unix-style newlines with a newline ending every file 7 | [*] 8 | end_of_line = lf 9 | insert_final_newline = true 10 | charset = utf-8 11 | indent_style = space 12 | indent_size = 4 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .history -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "useTabs": true, 3 | "singleQuote": true, 4 | "printWidth": 100 5 | } 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | > [!IMPORTANT] 2 | > The new [Stream Deck SDK](https://github.com/elgatosf/streamdeck) is now available! 3 | > 4 | > This repository has been marked as deprecated, and will soon be deleted. If you have any questions, please contact us via [maker@elgato.com](maker@elgato.com), or join our [Makertplace Makers](https://discord.gg/GehBUcu627) Discord community. 5 | -------------------------------------------------------------------------------- /assets/caret.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /assets/caret_closed.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /assets/check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elgatosf/streamdeck-javascript-sdk/66a512348c17455d5040b22d01e7885e8fcdb2db/assets/check.png -------------------------------------------------------------------------------- /assets/check.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /assets/elg_calendar.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /assets/elg_calendar_inv.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /assets/rcheck.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /assets/tick.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /css/README.md: -------------------------------------------------------------------------------- 1 | > [!IMPORTANT] 2 | > The new [Stream Deck SDK](https://github.com/elgatosf/streamdeck) is now available! 3 | > 4 | > This repository has been marked as deprecated, and will soon be deleted. If you have any questions, please contact us via [maker@elgato.com](maker@elgato.com), or join our [Makertplace Makers](https://discord.gg/GehBUcu627) Discord community. 5 | 6 | # Property Inspector 7 | 8 | You can find the legacy documenation for this deprecated version of the property inspector [here](https://github.com/elgatosf/streamdeck-javascript-sdk/blob/docs/README.md). 9 | -------------------------------------------------------------------------------- /css/sdpi.css: -------------------------------------------------------------------------------- 1 | html { 2 | --sdpi-bgcolor: #2D2D2D; 3 | --sdpi-background: #3D3D3D; 4 | --sdpi-color: #d8d8d8; 5 | --sdpi-bordercolor: #3a3a3a; 6 | --sdpi-buttonbordercolor: #969696; 7 | --sdpi-borderradius: 0px; 8 | --sdpi-width: 224px; 9 | --sdpi-fontweight: 600; 10 | --sdpi-letterspacing: -0.25pt; 11 | --sdpi-tab-color: #969696; 12 | --sdpi-tab-left-margin: 1px; 13 | --sdpi-tab-top-offset: 1px; 14 | --sdpi-tab-selected-color: #333333; 15 | --sdpi-tab-selected-top-offset: 0px; 16 | --sdpi-tab-font-size: 9pt; 17 | --sdpi-tab-container-left-offset: 5px; 18 | --sdpi-tab-padding-horizontal: 12px; 19 | --sdpi-tab-padding-vertical: 5px; 20 | --sdpi-linecolor: #454545; 21 | height: 100%; 22 | width: 100%; 23 | overflow: hidden; 24 | touch-action: none; 25 | } 26 | 27 | html, 28 | body { 29 | font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; 30 | font-size: 9pt; 31 | background-color: var(--sdpi-bgcolor); 32 | color: #9a9a9a; 33 | } 34 | 35 | body { 36 | height: 100%; 37 | padding: 0; 38 | overflow-x: hidden; 39 | overflow-y: auto; 40 | margin: 0; 41 | -webkit-overflow-scrolling: touch; 42 | -webkit-text-size-adjust: 100%; 43 | -webkit-font-smoothing: antialiased; 44 | } 45 | 46 | mark { 47 | background-color: var(--sdpi-bgcolor); 48 | color: var(--sdpi-color); 49 | } 50 | 51 | hr, 52 | hr2 { 53 | -webkit-margin-before: 1em; 54 | -webkit-margin-after: 1em; 55 | border-style: none; 56 | background: var(--sdpi-background); 57 | height: 1px; 58 | } 59 | 60 | hr2, 61 | .sdpi-heading { 62 | display: flex; 63 | flex-basis: 100%; 64 | align-items: center; 65 | color: inherit; 66 | font-size: 9pt; 67 | margin: 8px 0px; 68 | } 69 | 70 | 71 | h1 { 72 | font-size: 1.3em; 73 | font-weight: 500; 74 | text-align: center; 75 | margin-bottom: 12px; 76 | } 77 | 78 | .sdpi-heading::before, 79 | .sdpi-heading::after { 80 | content: ""; 81 | flex-grow: 1; 82 | background: var(--sdpi-background); 83 | height: 1px; 84 | font-size: 0px; 85 | line-height: 0px; 86 | margin: 0px 16px; 87 | } 88 | 89 | hr2 { 90 | height: 2px; 91 | } 92 | 93 | hr, 94 | hr2 { 95 | margin-left: 16px; 96 | margin-right: 16px; 97 | } 98 | 99 | .sdpi-item-value, 100 | option, 101 | input, 102 | select, 103 | button { 104 | font-size: 10pt; 105 | font-weight: var(--sdpi-fontweight); 106 | letter-spacing: var(--sdpi-letterspacing); 107 | } 108 | 109 | .sdpi-item-value> :last-of-type, 110 | .sdpi-item-value:last-child { 111 | margin-bottom: 4px; 112 | } 113 | 114 | .win .sdpi-item-value, 115 | .win option, 116 | .win input, 117 | .win select, 118 | .win button { 119 | font-size: 11px; 120 | font-style: normal; 121 | letter-spacing: inherit; 122 | font-weight: 100; 123 | } 124 | 125 | .win button { 126 | font-size: 12px; 127 | } 128 | 129 | ::-webkit-progress-value, 130 | meter::-webkit-meter-optimum-value { 131 | border-radius: 2px; 132 | /* background: linear-gradient(#ccf, #99f 20%, #77f 45%, #77f 55%, #cdf); */ 133 | } 134 | 135 | ::-webkit-progress-bar, 136 | meter::-webkit-meter-bar { 137 | border-radius: 3px; 138 | background: var(--sdpi-background); 139 | } 140 | 141 | ::-webkit-progress-bar:active, 142 | meter::-webkit-meter-bar:active { 143 | border-radius: 3px; 144 | background: #222222; 145 | } 146 | 147 | ::-webkit-progress-value:active, 148 | meter::-webkit-meter-optimum-value:active { 149 | background: #99f; 150 | } 151 | 152 | progress, 153 | progress.sdpi-item-value { 154 | min-height: 5px !important; 155 | height: 5px; 156 | background-color: #303030; 157 | } 158 | 159 | progress { 160 | margin-top: 8px !important; 161 | margin-bottom: 8px !important; 162 | } 163 | 164 | .full progress, 165 | progress.full { 166 | margin-top: 3px !important; 167 | } 168 | 169 | ::-webkit-progress-inner-element { 170 | background-color: transparent; 171 | } 172 | 173 | 174 | .sdpi-item[type="progress"] { 175 | margin-top: 4px !important; 176 | margin-bottom: 12px; 177 | min-height: 15px; 178 | } 179 | 180 | .sdpi-item-child.full:last-child { 181 | margin-bottom: 4px; 182 | } 183 | 184 | 185 | /* TABS */ 186 | 187 | .tabs { 188 | /** 189 | * Setting display to flex makes this container lay 190 | * out its children using flexbox, the exact same 191 | * as in the above "Stepper input" example. 192 | */ 193 | display: flex; 194 | border-bottom: 1px solid rgba(255, 255, 255, 0.0); 195 | flex-wrap: nowrap; 196 | white-space: nowrap; 197 | overflow-x: auto; 198 | text-transform: capitalize; 199 | background-color: transparent; 200 | margin-left: var(--sdpi-tab-container-left-offset); 201 | } 202 | 203 | .tabs::-webkit-scrollbar { 204 | height: 4px; 205 | display: none; 206 | } 207 | 208 | .tabs::-webkit-scrollbar-track { 209 | -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3); 210 | box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3); 211 | border-radius: 8px; 212 | } 213 | 214 | .tabs::-webkit-scrollbar-thumb { 215 | background-color: #444; 216 | outline: 1px solid #444; 217 | border-radius: 8px; 218 | } 219 | 220 | .tab-separator { 221 | margin-left: 100px; 222 | max-width: 234px; 223 | margin-bottom: 20px; 224 | margin-top: -4px; 225 | } 226 | 227 | .tab { 228 | cursor: pointer; 229 | padding: var(--sdpi-tab-padding-vertical) var(--sdpi-tab-padding-horizontal); 230 | color: var(--sdpi-tab-color); 231 | font-size: var(--sdpi-tab-font-size); 232 | font-weight: var(--title-font-weight); 233 | background-color: rgba(0, 0, 0, 0.1); 234 | margin: 0px; 235 | margin-top: var(--sdpi-tab-top-offset); 236 | margin-left: var(--sdpi-tab-left-margin); 237 | border-top-left-radius: 5px; 238 | border-top-right-radius: 5px; 239 | border: 1px solid rgba(255, 255, 255, 0.1); 240 | border-bottom: 1px solid var(--sdpi-linecolor); 241 | -webkit-user-select: none; 242 | user-select: none; 243 | } 244 | 245 | .tab:first-child { 246 | margin-left: 0px; 247 | } 248 | 249 | .tab-container { 250 | margin-top: -14px; 251 | } 252 | 253 | .tab-container>hr { 254 | margin-left: 100px; 255 | max-width: 234px; 256 | } 257 | 258 | .tabs+hr { 259 | margin-left: 0px; 260 | max-width: 234px; 261 | margin-top: -6px; 262 | } 263 | 264 | .tab.selected { 265 | color: white; 266 | background-color: var(--sdpi-tab-selected-color); 267 | border-bottom: 2px solid var(--sdpi-tab-selected-color); 268 | margin-top: var(--sdpi-tab-selected-top-offset); 269 | } 270 | 271 | .sdpi-item.tabgroup { 272 | margin-top: 0px; 273 | } 274 | 275 | .istab { 276 | background-color: rgba(0, 0, 0, 0.2); 277 | margin-bottom: 20px; 278 | padding: 4px; 279 | } 280 | 281 | select { 282 | -webkit-appearance: none; 283 | -moz-appearance: none; 284 | -o-appearance: none; 285 | appearance: none; 286 | background: url(../assets/caret.svg) no-repeat 97% center; 287 | } 288 | 289 | label.sdpi-file-label, 290 | input[type="button"], 291 | input[type="submit"], 292 | input[type="reset"], 293 | input[type="file"], 294 | input[type=file]::-webkit-file-upload-button, 295 | button, 296 | select { 297 | color: var(--sdpi-color); 298 | border: 1pt solid #303030; 299 | font-size: 8pt; 300 | background-color: var(--sdpi-background); 301 | border-radius: var(--sdpi-borderradius); 302 | } 303 | 304 | label.sdpi-file-label, 305 | input[type="button"], 306 | input[type="submit"], 307 | input[type="reset"], 308 | input[type="file"], 309 | input[type=file]::-webkit-file-upload-button, 310 | button { 311 | border: 1pt solid var(--sdpi-buttonbordercolor); 312 | border-radius: var(--sdpi-borderradius); 313 | border-color: var(--sdpi-buttonbordercolor); 314 | min-height: 23px !important; 315 | height: 23px !important; 316 | margin-right: 8px; 317 | } 318 | 319 | input[type=number]::-webkit-inner-spin-button, 320 | input[type=number]::-webkit-outer-spin-button { 321 | -webkit-appearance: none; 322 | margin: 0; 323 | } 324 | 325 | input[type="file"] { 326 | border-radius: var(--sdpi-borderradius); 327 | max-width: 220px; 328 | } 329 | 330 | option { 331 | height: 1.5em; 332 | padding: 4px; 333 | } 334 | 335 | /* SDPI */ 336 | 337 | .sdpi-wrapper { 338 | overflow-x: hidden; 339 | height: 100%; 340 | margin-right: 1px; /* ensure scroller thumb is not clipped */ 341 | } 342 | 343 | .sdpi-item { 344 | display: flex; 345 | flex-direction: row; 346 | min-height: 30px; 347 | align-items: first baseline; 348 | margin-top: 2px; 349 | max-width: 344px; 350 | -webkit-user-drag: none; 351 | } 352 | 353 | .sdpi-item[type="textarea"], 354 | .sdpi-item[type="color"], 355 | .sdpi-item[type="canvas"], 356 | .sdpi-item .aligncenter { 357 | align-items: center; 358 | } 359 | 360 | .sdpi-item[type="color"]>.sdpi-item-label { 361 | line-height: 22px; 362 | } 363 | 364 | .sdpi-item:first-child { 365 | margin-top: -1px; 366 | } 367 | 368 | .sdpi-item:first-of-type { 369 | margin-top: 2px; 370 | } 371 | 372 | .sdpi-item[type="radio"]:first-of-type, 373 | .sdpi-item[type="checkbox"]:first-of-type { 374 | margin-top: -4px; 375 | } 376 | 377 | .sdpi-item:last-child { 378 | margin-bottom: 0px; 379 | } 380 | 381 | .sdpi-item>*:not(.sdpi-item-label):not(meter):not(details):not(canvas) { 382 | min-height: 26px; 383 | } 384 | 385 | .sdpi-item>*:not(.sdpi-item-label.empty):not(meter) { 386 | min-height: 26px; 387 | } 388 | 389 | .sdpi-item>input { 390 | padding: 0px 4px; 391 | } 392 | 393 | .sdpi-item-group { 394 | padding: 0 !important; 395 | } 396 | 397 | meter.sdpi-item-value { 398 | margin-left: 6px; 399 | } 400 | 401 | .sdpi-item[type="group"] { 402 | display: block; 403 | margin-top: 12px; 404 | margin-bottom: 12px; 405 | /* border: 1px solid white; */ 406 | flex-direction: unset; 407 | text-align: left; 408 | } 409 | 410 | .sdpi-item[type="group"]>.sdpi-item-label, 411 | .sdpi-item[type="group"].sdpi-item-label { 412 | width: 96%; 413 | text-align: left; 414 | font-weight: 700; 415 | margin-bottom: 4px; 416 | padding-left: 4px; 417 | } 418 | 419 | dl, 420 | ul, 421 | ol { 422 | -webkit-margin-before: 0px; 423 | -webkit-margin-after: 4px; 424 | -webkit-padding-start: 1em; 425 | max-height: 90px; 426 | overflow-y: scroll; 427 | cursor: pointer; 428 | user-select: none; 429 | } 430 | 431 | table.sdpi-item-value, 432 | dl.sdpi-item-value, 433 | ul.sdpi-item-value, 434 | ol.sdpi-item-value { 435 | -webkit-margin-before: 4px; 436 | -webkit-margin-after: 8px; 437 | -webkit-padding-start: 1em; 438 | width: var(--sdpi-width); 439 | text-align: center; 440 | } 441 | 442 | table>caption { 443 | margin: 2px; 444 | } 445 | 446 | .list, 447 | .sdpi-item[type="list"] { 448 | align-items: baseline; 449 | } 450 | 451 | .sdpi-item-label { 452 | text-align: right; 453 | flex: none; 454 | width: 94px; 455 | padding-right: 5px; 456 | font-weight: 600; 457 | -webkit-user-select: none; 458 | line-height: normal; 459 | margin-left: -1px; 460 | } 461 | 462 | .win .sdpi-item-label, 463 | .sdpi-item-label>small { 464 | font-weight: normal; 465 | } 466 | 467 | .sdpi-item-label:after { 468 | content: ": "; 469 | } 470 | 471 | .sdpi-item-label.empty:after { 472 | content: ""; 473 | } 474 | 475 | .sdpi-test, 476 | .sdpi-item-value { 477 | flex: 1 0 0; 478 | /* flex-grow: 1; 479 | flex-shrink: 0; */ 480 | margin-right: 14px; 481 | margin-left: 4px; 482 | justify-content: space-evenly; 483 | } 484 | 485 | canvas.sdpi-item-value { 486 | max-width: 144px; 487 | max-height: 144px; 488 | width: 144px; 489 | height: 144px; 490 | margin: 0 auto; 491 | cursor: pointer; 492 | } 493 | 494 | input.sdpi-item-value { 495 | margin-left: 5px; 496 | } 497 | 498 | .sdpi-item-value button, 499 | button.sdpi-item-value { 500 | margin-left: 6px; 501 | margin-right: 14px; 502 | } 503 | 504 | .sdpi-item-value.range { 505 | margin-left: 0px; 506 | } 507 | 508 | table, 509 | dl.sdpi-item-value, 510 | ul.sdpi-item-value, 511 | ol.sdpi-item-value, 512 | .sdpi-item-value>dl, 513 | .sdpi-item-value>ul, 514 | .sdpi-item-value>ol { 515 | list-style-type: none; 516 | list-style-position: outside; 517 | margin-left: -4px; 518 | margin-right: -4px; 519 | padding: 4px; 520 | border: 1px solid var(--sdpi-bordercolor); 521 | } 522 | 523 | dl.sdpi-item-value, 524 | ul.sdpi-item-value, 525 | ol.sdpi-item-value, 526 | .sdpi-item-value>ol { 527 | list-style-type: none; 528 | list-style-position: inside; 529 | margin-left: 5px; 530 | margin-right: 12px; 531 | padding: 4px !important; 532 | /* display: flex; 533 | flex-direction: column; */ 534 | } 535 | 536 | .two-items li { 537 | display: flex; 538 | } 539 | 540 | .two-items li>*:first-child { 541 | flex: 0 0 50%; 542 | text-align: left; 543 | } 544 | 545 | .two-items.thirtyseventy li>*:first-child { 546 | flex: 0 0 30%; 547 | } 548 | 549 | ol.sdpi-item-value, 550 | .sdpi-item-value>ol[listtype="none"] { 551 | list-style-type: none; 552 | } 553 | 554 | ol.sdpi-item-value[type="decimal"], 555 | .sdpi-item-value>ol[type="decimal"] { 556 | list-style-type: decimal; 557 | } 558 | 559 | ol.sdpi-item-value[type="decimal-leading-zero"], 560 | .sdpi-item-value>ol[type="decimal-leading-zero"] { 561 | list-style-type: decimal-leading-zero; 562 | } 563 | 564 | ol.sdpi-item-value[type="lower-alpha"], 565 | .sdpi-item-value>ol[type="lower-alpha"] { 566 | list-style-type: lower-alpha; 567 | } 568 | 569 | ol.sdpi-item-value[type="upper-alpha"], 570 | .sdpi-item-value>ol[type="upper-alpha"] { 571 | list-style-type: upper-alpha; 572 | } 573 | 574 | ol.sdpi-item-value[type="upper-roman"], 575 | .sdpi-item-value>ol[type="upper-roman"] { 576 | list-style-type: upper-roman; 577 | } 578 | 579 | ol.sdpi-item-value[type="lower-roman"], 580 | .sdpi-item-value>ol[type="lower-roman"] { 581 | list-style-type: upper-roman; 582 | } 583 | 584 | tr:nth-child(even), 585 | .sdpi-item-value>ul>li:nth-child(even), 586 | .sdpi-item-value>ol>li:nth-child(even), 587 | li:nth-child(even) { 588 | background-color: rgba(0, 0, 0, .2) 589 | } 590 | 591 | td:hover, 592 | .sdpi-item-value>ul>li:hover:nth-child(even), 593 | .sdpi-item-value>ol>li:hover:nth-child(even), 594 | li:hover:nth-child(even), 595 | li:hover { 596 | background-color: rgba(255, 255, 255, .1); 597 | } 598 | 599 | td.selected, 600 | td.selected:hover, 601 | li.selected:hover, 602 | li.selected { 603 | color: white; 604 | background-color: #77f; 605 | } 606 | 607 | tr { 608 | border: 1px solid var(--sdpi-bordercolor); 609 | } 610 | 611 | td { 612 | border-right: 1px solid var(--sdpi-bordercolor); 613 | -webkit-user-select: none; 614 | } 615 | 616 | tr:last-child, 617 | td:last-child { 618 | border: none; 619 | } 620 | 621 | .sdpi-item-value.select, 622 | .sdpi-item-value>select { 623 | margin-right: 13px; 624 | margin-left: 4px; 625 | padding: 0px 4px; 626 | } 627 | 628 | .sdpi-item-child, 629 | .sdpi-item-group>.sdpi-item>input[type="color"] { 630 | margin-top: 0.4em; 631 | margin-right: 4px; 632 | margin-left: 4px; 633 | } 634 | 635 | .full, 636 | .full *, 637 | .sdpi-item-value.full, 638 | .sdpi-item-child>full>*, 639 | .sdpi-item-child.full, 640 | .sdpi-item-child.full>*, 641 | .full>.sdpi-item-child, 642 | .full>.sdpi-item-child>* { 643 | display: flex; 644 | flex: 1 1 0; 645 | margin-bottom: 4px; 646 | margin-left: 0px; 647 | width: 100%; 648 | justify-content: space-evenly; 649 | } 650 | 651 | .sdpi-item-group>.sdpi-item>input[type="color"] { 652 | margin-top: 0px; 653 | } 654 | 655 | ::-webkit-calendar-picker-indicator:focus, 656 | input[type=file]::-webkit-file-upload-button:focus, 657 | button:focus, 658 | textarea:focus, 659 | input:focus, 660 | select:focus, 661 | option:focus, 662 | details:focus, 663 | summary:focus, 664 | .custom-select select { 665 | outline: none; 666 | } 667 | 668 | summary { 669 | cursor: default; 670 | -webkit-user-select: none; 671 | } 672 | 673 | .pointer, 674 | summary .pointer { 675 | cursor: pointer; 676 | } 677 | 678 | .sdpi-item.details { 679 | align-items: first baseline; 680 | } 681 | 682 | /* needs Chromium update 2023 683 | .sdpi-item:has(>details) { 684 | align-items: first baseline; 685 | } 686 | */ 687 | 688 | details * { 689 | font-size: 12px; 690 | font-weight: normal; 691 | } 692 | 693 | details.message { 694 | padding: 4px 18px 4px 12px; 695 | } 696 | 697 | details.message summary { 698 | font-size: 10pt; 699 | font-weight: 600; 700 | min-height: 18px; 701 | } 702 | 703 | details.message:first-child { 704 | margin-top: 4px; 705 | margin-left: 0; 706 | padding-left: 102px !important; 707 | } 708 | 709 | details.message>summary:first-of-type { 710 | line-height: 20px; 711 | } 712 | 713 | details.message h1 { 714 | text-align: left; 715 | } 716 | 717 | /* details:not(.pointer)>summary { 718 | list-style: none; 719 | } 720 | 721 | details > summary::-webkit-details-marker, 722 | .message > summary::-webkit-details-marker { 723 | display: none; 724 | } */ 725 | 726 | .info20, 727 | .question, 728 | .caution, 729 | .info { 730 | background-repeat: no-repeat; 731 | background-position: 72px center; 732 | } 733 | 734 | .info20 { 735 | background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cpath fill='%23999' d='M10,20 C4.4771525,20 0,15.5228475 0,10 C0,4.4771525 4.4771525,0 10,0 C15.5228475,0 20,4.4771525 20,10 C20,15.5228475 15.5228475,20 10,20 Z M10,8 C8.8954305,8 8,8.84275812 8,9.88235294 L8,16.1176471 C8,17.1572419 8.8954305,18 10,18 C11.1045695,18 12,17.1572419 12,16.1176471 L12,9.88235294 C12,8.84275812 11.1045695,8 10,8 Z M10,3 C8.8954305,3 8,3.88165465 8,4.96923077 L8,5.03076923 C8,6.11834535 8.8954305,7 10,7 C11.1045695,7 12,6.11834535 12,5.03076923 L12,4.96923077 C12,3.88165465 11.1045695,3 10,3 Z'/%3E%3C/svg%3E%0A"); 736 | } 737 | 738 | .info { 739 | background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cpath fill='%23999' d='M10,18 C5.581722,18 2,14.418278 2,10 C2,5.581722 5.581722,2 10,2 C14.418278,2 18,5.581722 18,10 C18,14.418278 14.418278,18 10,18 Z M10,8 C9.44771525,8 9,8.42137906 9,8.94117647 L9,14.0588235 C9,14.5786209 9.44771525,15 10,15 C10.5522847,15 11,14.5786209 11,14.0588235 L11,8.94117647 C11,8.42137906 10.5522847,8 10,8 Z M10,5 C9.44771525,5 9,5.44082732 9,5.98461538 L9,6.01538462 C9,6.55917268 9.44771525,7 10,7 C10.5522847,7 11,6.55917268 11,6.01538462 L11,5.98461538 C11,5.44082732 10.5522847,5 10,5 Z'/%3E%3C/svg%3E%0A"); 740 | } 741 | 742 | .info2 { 743 | background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 15 15'%3E%3Cpath fill='%23999' d='M7.5,15 C3.35786438,15 0,11.6421356 0,7.5 C0,3.35786438 3.35786438,0 7.5,0 C11.6421356,0 15,3.35786438 15,7.5 C15,11.6421356 11.6421356,15 7.5,15 Z M7.5,2 C6.67157287,2 6,2.66124098 6,3.47692307 L6,3.52307693 C6,4.33875902 6.67157287,5 7.5,5 C8.32842705,5 9,4.33875902 9,3.52307693 L9,3.47692307 C9,2.66124098 8.32842705,2 7.5,2 Z M5,6 L5,7.02155172 L6,7 L6,12 L5,12.0076778 L5,13 L10,13 L10,12 L9,12.0076778 L9,6 L5,6 Z'/%3E%3C/svg%3E%0A"); 744 | } 745 | 746 | .sdpi-more-info { 747 | background-image: linear-gradient(to right, #00000000 0%, #00000040 80%), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpolygon fill='%23999' points='4 7 8 7 8 5 12 8 8 11 8 9 4 9'/%3E%3C/svg%3E%0A"); 748 | } 749 | 750 | .caution { 751 | background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cpath fill='%23999' fill-rule='evenodd' d='M9.03952676,0.746646542 C9.57068894,-0.245797319 10.4285735,-0.25196227 10.9630352,0.746646542 L19.7705903,17.2030214 C20.3017525,18.1954653 19.8777595,19 18.8371387,19 L1.16542323,19 C0.118729947,19 -0.302490098,18.2016302 0.231971607,17.2030214 L9.03952676,0.746646542 Z M10,2.25584053 L1.9601405,17.3478261 L18.04099,17.3478261 L10,2.25584053 Z M10,5.9375 C10.531043,5.9375 10.9615385,6.37373537 10.9615385,6.91185897 L10.9615385,11.6923077 C10.9615385,12.2304313 10.531043,12.6666667 10,12.6666667 C9.46895697,12.6666667 9.03846154,12.2304313 9.03846154,11.6923077 L9.03846154,6.91185897 C9.03846154,6.37373537 9.46895697,5.9375 10,5.9375 Z M10,13.4583333 C10.6372516,13.4583333 11.1538462,13.9818158 11.1538462,14.6275641 L11.1538462,14.6641026 C11.1538462,15.3098509 10.6372516,15.8333333 10,15.8333333 C9.36274837,15.8333333 8.84615385,15.3098509 8.84615385,14.6641026 L8.84615385,14.6275641 C8.84615385,13.9818158 9.36274837,13.4583333 10,13.4583333 Z'/%3E%3C/svg%3E%0A"); 752 | } 753 | 754 | .question { 755 | background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cpath fill='%23999' d='M10,18 C5.581722,18 2,14.418278 2,10 C2,5.581722 5.581722,2 10,2 C14.418278,2 18,5.581722 18,10 C18,14.418278 14.418278,18 10,18 Z M6.77783203,7.65332031 C6.77783203,7.84798274 6.85929281,8.02888914 7.0222168,8.19604492 C7.18514079,8.36320071 7.38508996,8.44677734 7.62207031,8.44677734 C8.02409055,8.44677734 8.29703704,8.20768468 8.44091797,7.72949219 C8.59326248,7.27245865 8.77945854,6.92651485 8.99951172,6.69165039 C9.2195649,6.45678594 9.56233491,6.33935547 10.027832,6.33935547 C10.4256205,6.33935547 10.7006836,6.37695313 11.0021973,6.68847656 C11.652832,7.53271484 10.942627,8.472229 10.3750916,9.1321106 C9.80755615,9.79199219 8.29492188,11.9897461 10.027832,12.1347656 C10.4498423,12.1700818 10.7027991,11.9147157 10.7832031,11.4746094 C11.0021973,9.59857178 13.1254883,8.82415771 13.1254883,7.53271484 C13.1254883,7.07568131 12.9974785,6.65250846 12.7414551,6.26318359 C12.4854317,5.87385873 12.1225609,5.56600048 11.652832,5.33959961 C11.1831031,5.11319874 10.6414419,5 10.027832,5 C9.36767248,5 8.79004154,5.13541531 8.29492187,5.40625 C7.79980221,5.67708469 7.42317837,6.01879677 7.16503906,6.43139648 C6.90689975,6.8439962 6.77783203,7.25130007 6.77783203,7.65332031 Z M10.0099668,15 C10.2713191,15 10.5016601,14.9108147 10.7009967,14.7324415 C10.9003332,14.5540682 11,14.3088087 11,13.9966555 C11,13.7157177 10.9047629,13.4793767 10.7142857,13.2876254 C10.5238086,13.0958742 10.2890379,13 10.0099668,13 C9.72646591,13 9.48726565,13.0958742 9.2923588,13.2876254 C9.09745196,13.4793767 9,13.7157177 9,13.9966555 C9,14.313268 9.10077419,14.5596424 9.30232558,14.735786 C9.50387698,14.9119295 9.73975502,15 10.0099668,15 Z'/%3E%3C/svg%3E%0A"); 756 | } 757 | 758 | .sdpi-more-info { 759 | position: fixed; 760 | left: 0px; 761 | right: 0px; 762 | bottom: 0px; 763 | min-height: 16px; 764 | padding-right: 16px; 765 | text-align: right; 766 | -webkit-touch-callout: none; 767 | cursor: pointer; 768 | user-select: none; 769 | background-position: right center; 770 | background-repeat: no-repeat; 771 | border-radius: var(--sdpi-borderradius); 772 | text-decoration: none; 773 | color: var(--sdpi-color); 774 | } 775 | 776 | .sdpi-more-info-button { 777 | display: flex; 778 | align-self: right; 779 | margin-left: auto; 780 | position: fixed; 781 | right: 17px; 782 | bottom: 0px; 783 | user-select: none; 784 | } 785 | 786 | .sdpi-bottom-bar { 787 | display: flex; 788 | align-self: right; 789 | margin-left: auto; 790 | position: fixed; 791 | right: 17px; 792 | bottom: 0px; 793 | user-select: none; 794 | } 795 | 796 | .sdpi-bottom-bar.right { 797 | right: 0px; 798 | } 799 | 800 | .sdpi-bottom-bar button { 801 | min-height: 20px !important; 802 | height: 20px !important; 803 | } 804 | 805 | details a { 806 | background-position: right !important; 807 | min-height: 24px; 808 | display: inline-block; 809 | line-height: 24px; 810 | padding-right: 28px; 811 | } 812 | 813 | input:not([type="range"]), 814 | textarea { 815 | -webkit-appearance: none; 816 | background: var(--sdpi-background); 817 | color: var(--sdpi-color); 818 | font-weight: normal; 819 | font-size: 9pt; 820 | border: none; 821 | margin-top: 2px; 822 | margin-bottom: 2px; 823 | min-width: 219px; 824 | } 825 | 826 | textarea+label { 827 | display: flex; 828 | justify-content: flex-end 829 | } 830 | 831 | input[type="radio"], 832 | input[type="checkbox"] { 833 | display: none; 834 | } 835 | 836 | input[type="radio"]+label, 837 | input[type="checkbox"]+label { 838 | font-size: 9pt; 839 | color: var(--sdpi-color); 840 | font-weight: normal; 841 | margin-right: 8px; 842 | -webkit-user-select: none; 843 | } 844 | 845 | input[type="radio"]+label:after, 846 | input[type="checkbox"]+label:after { 847 | content: " " !important; 848 | } 849 | 850 | .sdpi-item[type="radio"]>.sdpi-item-value, 851 | .sdpi-item[type="checkbox"]>.sdpi-item-value { 852 | padding-top: 2px; 853 | } 854 | 855 | .sdpi-item[type="checkbox"]>.sdpi-item-value>* { 856 | margin-top: 4px; 857 | } 858 | 859 | .sdpi-item[type="checkbox"] .sdpi-item-child, 860 | .sdpi-item[type="radio"] .sdpi-item-child { 861 | display: inline-block; 862 | } 863 | 864 | .sdpi-item[type="range"] .sdpi-item-value, 865 | .sdpi-item[type="meter"] .sdpi-item-child, 866 | .sdpi-item[type="progress"] .sdpi-item-child { 867 | display: flex; 868 | } 869 | 870 | .sdpi-item[type="range"] .sdpi-item-value { 871 | min-height: 26px; 872 | } 873 | 874 | .sdpi-item[type="range"] .sdpi-item-value span, 875 | .sdpi-item[type="meter"] .sdpi-item-child span, 876 | .sdpi-item[type="progress"] .sdpi-item-child span { 877 | margin-top: -2px; 878 | min-width: 8px; 879 | text-align: right; 880 | cursor: pointer; 881 | -webkit-user-select: none; 882 | user-select: none; 883 | } 884 | 885 | .sdpi-item[type="range"] .sdpi-item-value span { 886 | margin-top: 7px; 887 | text-align: right; 888 | } 889 | 890 | span+input[type="range"] { 891 | display: flex; 892 | } 893 | 894 | span+.range-container>input[type="range"], 895 | span+input[type="range"] { 896 | max-width: 168px; 897 | } 898 | 899 | .sdpi-item[type="range"] .sdpi-item-value span:first-child, 900 | .sdpi-item[type="meter"] .sdpi-item-child span:first-child, 901 | .sdpi-item[type="progress"] .sdpi-item-child span:first-child { 902 | margin-right: 4px; 903 | } 904 | 905 | .sdpi-item[type="range"] .sdpi-item-value span:last-child, 906 | .sdpi-item[type="meter"] .sdpi-item-child span:last-child, 907 | .sdpi-item[type="progress"] .sdpi-item-child span:last-child { 908 | margin-left: 4px; 909 | } 910 | 911 | .reverse { 912 | transform: rotate(180deg); 913 | } 914 | 915 | .sdpi-item[type="meter"] .sdpi-item-child meter+span:last-child { 916 | margin-left: -10px; 917 | } 918 | 919 | .sdpi-item[type="progress"] .sdpi-item-child meter+span:last-child { 920 | margin-left: -14px; 921 | } 922 | 923 | .sdpi-item[type="radio"]>.sdpi-item-value>* { 924 | margin-top: 2px; 925 | } 926 | 927 | details { 928 | padding: 8px 18px 8px 12px; 929 | min-width: 86px; 930 | } 931 | 932 | details>h4 { 933 | border-bottom: 1px solid var(--sdpi-bordercolor); 934 | } 935 | 936 | legend { 937 | display: none; 938 | } 939 | 940 | .sdpi-item-value>textarea { 941 | padding: 0px; 942 | width: 219px; 943 | margin-left: 1px; 944 | margin-top: 3px; 945 | padding: 4px; 946 | } 947 | 948 | input[type="radio"]+label span, 949 | input[type="checkbox"]+label span { 950 | display: inline-block; 951 | width: 16px; 952 | height: 16px; 953 | margin: 2px 4px 2px 0; 954 | border-radius: 3px; 955 | vertical-align: middle; 956 | background: var(--sdpi-background); 957 | cursor: pointer; 958 | border: 1px solid rgb(0, 0, 0, .2); 959 | } 960 | 961 | input[type="radio"]+label span { 962 | border-radius: 100%; 963 | } 964 | 965 | input[type="radio"]:checked+label span, 966 | input[type="checkbox"]:checked+label span { 967 | background-color: #77f; 968 | background-image: url(../assets/check.svg); 969 | background-repeat: no-repeat; 970 | background-position: center center; 971 | border: 1px solid rgb(0, 0, 0, .4); 972 | } 973 | 974 | input[type="radio"]:active:checked+label span, 975 | input[type="radio"]:active+label span, 976 | input[type="checkbox"]:active:checked+label span, 977 | input[type="checkbox"]:active+label span { 978 | background-color: #303030; 979 | } 980 | 981 | input[type="radio"]:checked+label span { 982 | background-image: url(../assets/rcheck.svg); 983 | } 984 | 985 | input[type="range"] { 986 | width: var(--sdpi-width); 987 | height: 30px; 988 | overflow: hidden; 989 | cursor: pointer; 990 | background: transparent !important; 991 | } 992 | 993 | .sdpi-item>input[type="range"] { 994 | margin-left: 2px; 995 | max-width: var(--sdpi-width); 996 | width: var(--sdpi-width); 997 | padding: 0px; 998 | margin-top: 2px; 999 | } 1000 | 1001 | /* 1002 | input[type="range"], 1003 | input[type="range"]::-webkit-slider-runnable-track, 1004 | input[type="range"]::-webkit-slider-thumb { 1005 | -webkit-appearance: none; 1006 | } 1007 | */ 1008 | 1009 | input[type="range"]::-webkit-slider-runnable-track { 1010 | height: 5px; 1011 | background: #979797; 1012 | border-radius: 3px; 1013 | padding: 0px !important; 1014 | border: 1px solid var(--sdpi-background); 1015 | } 1016 | 1017 | input[type="range"]::-webkit-slider-thumb { 1018 | position: relative; 1019 | -webkit-appearance: none; 1020 | background-color: var(--sdpi-color); 1021 | width: 12px; 1022 | height: 12px; 1023 | border-radius: 20px; 1024 | margin-top: -5px; 1025 | border: none; 1026 | } 1027 | 1028 | input[type="range" i] { 1029 | margin: 0; 1030 | } 1031 | 1032 | input[type="range"]::-webkit-slider-thumb::before { 1033 | position: absolute; 1034 | content: ""; 1035 | height: 5px; /* equal to height of runnable track or 1 less */ 1036 | width: 500px; /* make this bigger than the widest range input element */ 1037 | left: -502px; /* this should be -2px - width */ 1038 | top: 8px; /* don't change this */ 1039 | background: #77f; 1040 | } 1041 | 1042 | input[type="color"] { 1043 | min-width: 32px; 1044 | min-height: 32px; 1045 | width: 32px; 1046 | height: 32px; 1047 | padding: 0; 1048 | background-color: var(--sdpi-bgcolor); 1049 | flex: none; 1050 | } 1051 | 1052 | ::-webkit-color-swatch { 1053 | min-width: 24px; 1054 | } 1055 | 1056 | textarea { 1057 | height: 3em; 1058 | word-break: break-word; 1059 | line-height: 1.5em; 1060 | } 1061 | 1062 | .textarea { 1063 | padding: 0px !important; 1064 | } 1065 | 1066 | textarea { 1067 | width: 219px; /*98%;*/ 1068 | height: 96%; 1069 | min-height: 6em; 1070 | resize: none; 1071 | border-radius: var(--sdpi-borderradius); 1072 | } 1073 | 1074 | /* CAROUSEL */ 1075 | 1076 | .sdpi-item[type="carousel"] {} 1077 | 1078 | .sdpi-item.card-carousel-wrapper, 1079 | .sdpi-item>.card-carousel-wrapper { 1080 | padding: 0; 1081 | } 1082 | 1083 | .card-carousel-wrapper { 1084 | display: flex; 1085 | align-items: center; 1086 | justify-content: center; 1087 | margin: 12px auto; 1088 | color: #666a73; 1089 | } 1090 | 1091 | .card-carousel { 1092 | display: flex; 1093 | justify-content: center; 1094 | width: 278px; 1095 | } 1096 | 1097 | .card-carousel--overflow-container { 1098 | overflow: hidden; 1099 | } 1100 | 1101 | .card-carousel--nav__left, 1102 | .card-carousel--nav__right { 1103 | /* display: inline-block; */ 1104 | width: 12px; 1105 | height: 12px; 1106 | border-top: 2px solid #42b883; 1107 | border-right: 2px solid #42b883; 1108 | cursor: pointer; 1109 | margin: 0 4px; 1110 | transition: transform 150ms linear; 1111 | } 1112 | 1113 | .card-carousel--nav__left[disabled], 1114 | .card-carousel--nav__right[disabled] { 1115 | opacity: 0.2; 1116 | border-color: black; 1117 | } 1118 | 1119 | .card-carousel--nav__left { 1120 | transform: rotate(-135deg); 1121 | } 1122 | 1123 | .card-carousel--nav__left:active { 1124 | transform: rotate(-135deg) scale(0.85); 1125 | } 1126 | 1127 | .card-carousel--nav__right { 1128 | transform: rotate(45deg); 1129 | } 1130 | 1131 | .card-carousel--nav__right:active { 1132 | transform: rotate(45deg) scale(0.85); 1133 | } 1134 | 1135 | .card-carousel-cards { 1136 | display: flex; 1137 | transition: transform 150ms ease-out; 1138 | transform: translatex(0px); 1139 | } 1140 | 1141 | .card-carousel-cards .card-carousel--card { 1142 | margin: 0 5px; 1143 | cursor: pointer; 1144 | /* box-shadow: 0 4px 15px 0 rgba(40, 44, 53, 0.06), 0 2px 2px 0 rgba(40, 44, 53, 0.08); */ 1145 | /* background-color: #fff; */ 1146 | text-align: center; 1147 | border-radius: 4px; 1148 | z-index: 3; 1149 | } 1150 | 1151 | .xxcard-carousel-cards .card-carousel--card:first-child { 1152 | margin-left: 0; 1153 | } 1154 | 1155 | .xxcard-carousel-cards .card-carousel--card:last-child { 1156 | margin-right: 0; 1157 | } 1158 | 1159 | .card-carousel-cards .card-carousel--card img { 1160 | vertical-align: bottom; 1161 | border-top-left-radius: 4px; 1162 | border-top-right-radius: 4px; 1163 | transition: opacity 150ms linear; 1164 | width: 60px; 1165 | } 1166 | 1167 | .card-carousel-cards .card-carousel--card img:hover { 1168 | opacity: 0.5; 1169 | background-color: rgba(255, 255, 255, .1); 1170 | } 1171 | 1172 | .card-carousel-cards .card-carousel--card--footer { 1173 | border-top: 0; 1174 | max-width: 80px; 1175 | overflow: hidden; 1176 | display: flex; 1177 | height: 100%; 1178 | flex-direction: column; 1179 | } 1180 | 1181 | .card-carousel-cards .card-carousel--card--footer p { 1182 | padding: 3px 0; 1183 | margin: 0; 1184 | margin-bottom: 2px; 1185 | font-size: 15px; 1186 | font-weight: 500; 1187 | color: #2c3e50; 1188 | } 1189 | 1190 | .card-carousel-cards .card-carousel--card--footer p:nth-of-type(2) { 1191 | font-size: 12px; 1192 | font-weight: 300; 1193 | padding: 6px; 1194 | color: #666a73; 1195 | } 1196 | 1197 | ::-webkit-calendar-picker-indicator { 1198 | background: url(../assets/elg_calendar_inv.svg) no-repeat center; 1199 | font-size: 17px; 1200 | } 1201 | 1202 | ::-webkit-calendar-picker-indicator:focus { 1203 | background-color: rgba(0, 0, 0, 0.2); 1204 | } 1205 | 1206 | input[type="text"]::-webkit-calendar-picker-indicator { 1207 | background: transparent; 1208 | font-size: 12px; 1209 | } 1210 | 1211 | input[type="date"] { 1212 | -webkit-align-items: center; 1213 | align-items: center; 1214 | display: -webkit-inline-flex; 1215 | overflow: hidden; 1216 | -webkit-padding-start: 1px; 1217 | } 1218 | 1219 | input::-webkit-datetime-edit { 1220 | flex: 1; 1221 | -webkit-user-modify: read-only !important; 1222 | user-modify: read-only !important; 1223 | display: inline-block; 1224 | min-width: 0; 1225 | overflow: hidden; 1226 | padding: 4px; 1227 | font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; 1228 | 1229 | } 1230 | 1231 | input[type="file"] { 1232 | opacity: 0; 1233 | display: none; 1234 | } 1235 | 1236 | .sdpi-item>input[type="file"] { 1237 | opacity: 1; 1238 | display: flex; 1239 | } 1240 | 1241 | input[type="file"]+span { 1242 | display: flex; 1243 | flex: 0 1 auto; 1244 | background-color: #0000ff50; 1245 | } 1246 | 1247 | label.sdpi-file-label { 1248 | cursor: pointer; 1249 | user-select: none; 1250 | display: inline-block; 1251 | min-height: 21px !important; 1252 | height: 21px !important; 1253 | line-height: 20px; 1254 | padding: 0px 4px; 1255 | margin: auto; 1256 | margin-right: 0px; 1257 | float: right; 1258 | } 1259 | 1260 | .sdpi-file-label>label:active, 1261 | .sdpi-file-label.file:active, 1262 | label.sdpi-file-label:active, 1263 | label.sdpi-file-info:active, 1264 | input[type="file"]::-webkit-file-upload-button:active, 1265 | button:active { 1266 | background-color: var(--sdpi-color); 1267 | color: #303030; 1268 | } 1269 | 1270 | input:required:invalid, 1271 | input:focus:invalid { 1272 | background: var(--sdpi-background) url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI5IiBoZWlnaHQ9IjkiIHZpZXdCb3g9IjAgMCA5IDkiPgogICAgPHBhdGggZmlsbD0iI0Q4RDhEOCIgZD0iTTQuNSwwIEM2Ljk4NTI4MTM3LC00LjU2NTM4NzgyZS0xNiA5LDIuMDE0NzE4NjMgOSw0LjUgQzksNi45ODUyODEzNyA2Ljk4NTI4MTM3LDkgNC41LDkgQzIuMDE0NzE4NjMsOSAzLjA0MzU5MTg4ZS0xNiw2Ljk4NTI4MTM3IDAsNC41IEMtMy4wNDM1OTE4OGUtMTYsMi4wMTQ3MTg2MyAyLjAxNDcxODYzLDQuNTY1Mzg3ODJlLTE2IDQuNSwwIFogTTQsMSBMNCw2IEw1LDYgTDUsMSBMNCwxIFogTTQuNSw4IEM0Ljc3NjE0MjM3LDggNSw3Ljc3NjE0MjM3IDUsNy41IEM1LDcuMjIzODU3NjMgNC43NzYxNDIzNyw3IDQuNSw3IEM0LjIyMzg1NzYzLDcgNCw3LjIyMzg1NzYzIDQsNy41IEM0LDcuNzc2MTQyMzcgNC4yMjM4NTc2Myw4IDQuNSw4IFoiLz4KICA8L3N2Zz4) no-repeat 98% center; 1273 | } 1274 | 1275 | input:required:valid { 1276 | background: var(--sdpi-background) url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI5IiBoZWlnaHQ9IjkiIHZpZXdCb3g9IjAgMCA5IDkiPjxwb2x5Z29uIGZpbGw9IiNEOEQ4RDgiIHBvaW50cz0iNS4yIDEgNi4yIDEgNi4yIDcgMy4yIDcgMy4yIDYgNS4yIDYiIHRyYW5zZm9ybT0icm90YXRlKDQwIDQuNjc3IDQpIi8+PC9zdmc+) no-repeat 98% center; 1277 | } 1278 | 1279 | .tooltip, 1280 | :tooltip, 1281 | :title { 1282 | color: yellow; 1283 | } 1284 | 1285 | .sdpi-item-group.file { 1286 | width: 232px; 1287 | display: flex; 1288 | align-items: center; 1289 | } 1290 | 1291 | .sdpi-file-info { 1292 | overflow-wrap: break-word; 1293 | word-wrap: break-word; 1294 | hyphens: auto; 1295 | min-width: 132px; 1296 | max-width: 144px; 1297 | max-height: 32px; 1298 | margin-top: 0px; 1299 | margin-left: 5px; 1300 | display: inline-block; 1301 | overflow: hidden; 1302 | padding: 6px 4px; 1303 | background-color: var(--sdpi-background); 1304 | } 1305 | 1306 | ::-webkit-scrollbar { 1307 | width: 8px; 1308 | } 1309 | 1310 | ::-webkit-scrollbar-track { 1311 | -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3); 1312 | box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3); 1313 | margin: 4px; 1314 | border-radius: 8px; 1315 | } 1316 | 1317 | ::-webkit-scrollbar-thumb { 1318 | background-color: #999999; 1319 | outline: 1px solid slategrey; 1320 | border-radius: 8px; 1321 | } 1322 | 1323 | a { 1324 | color: #7397d2; 1325 | } 1326 | 1327 | input[type="week"] { 1328 | -webkit-appearance: auto !important; 1329 | appearance: auto !important; 1330 | } 1331 | 1332 | input[type="month"]+datalist, 1333 | input[type="day"]+datalist, 1334 | input[type="week"]+datalist, 1335 | input[type=text]+datalist { 1336 | display: none !important; 1337 | } 1338 | 1339 | input[type="range"] { 1340 | -webkit-appearance: auto; 1341 | appearance: auto; 1342 | height: 6px; 1343 | margin-top: 12px; 1344 | z-index: 0; 1345 | overflow: visible; 1346 | } 1347 | 1348 | input[type="range"]::-webkit-slider-runnable-track { 1349 | border: 0px solid transparent; 1350 | } 1351 | 1352 | .sdpi-item[type="range"] .sdpi-item-value.datalist { 1353 | flex-direction: column; 1354 | } 1355 | 1356 | datalist { 1357 | --sdpi-datalist-margin: 7px; 1358 | display: flex; 1359 | justify-content: space-between; 1360 | margin-top: 0px; 1361 | padding-top: 0px; 1362 | font-size: 12px; 1363 | margin-left: var(--sdpi-datalist-margin); 1364 | width: calc(100% - calc(var(--sdpi-datalist-margin) * 2.5)); 1365 | } 1366 | 1367 | datalist>option { 1368 | display: flex; 1369 | justify-content: center; 1370 | align-items: end; 1371 | /* background-image: url(../assets/tick.svg); */ 1372 | background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1' height='8' viewBox='0 0 1 8'%3E%3Crect width='1' height='6' x='0' y='1' fill='%23555'/%3E%3C/svg%3E%0A"); 1373 | padding: 0; 1374 | font-weight: 400; 1375 | font-size: 12px; 1376 | color: #9A9A99; 1377 | width: 1px; 1378 | height: 30px; 1379 | z-index: 1; 1380 | margin-top: -6px; 1381 | background-position: top 6px right 5px; 1382 | background-repeat: repeat no-repeat; /* fallback */ 1383 | background-repeat-y: no-repeat; 1384 | user-select: none; 1385 | -webkit-user-select: none; 1386 | } 1387 | 1388 | [role="spinbutton"] { 1389 | -webkit-appearance: auto; 1390 | appearance: auto; 1391 | } 1392 | 1393 | /* 1394 | input[type="range"]::-webkit-slider-thumb { 1395 | -webkit-appearance: none; 1396 | background-color: var(--sdpi-color); 1397 | width: 12px; 1398 | height: 12px; 1399 | border-radius: 20px; 1400 | margin-top: -6px; 1401 | border: none; 1402 | } */ 1403 | 1404 | :-webkit-slider-thumb { 1405 | -webkit-appearance: none; 1406 | background-color: var(--sdpi-color); 1407 | width: 16px; 1408 | height: 16px; 1409 | border-radius: 20px; 1410 | margin-top: -6px; 1411 | border: 1px solid #999999; 1412 | } 1413 | 1414 | .sdpi-item[type="range"] .sdpi-item-group { 1415 | display: flex; 1416 | flex-direction: column; 1417 | } 1418 | 1419 | .xxsdpi-item[type="range"] .sdpi-item-group input { 1420 | max-width: 204px; 1421 | } 1422 | 1423 | .sdpi-item[type="range"] .sdpi-item-group span { 1424 | margin-left: 0px !important; 1425 | } 1426 | 1427 | .sdpi-item[type="range"] .sdpi-item-group>.sdpi-item-child { 1428 | display: flex; 1429 | flex-direction: row; 1430 | } 1431 | 1432 | .rangeLabel { 1433 | position: absolute; 1434 | font-weight: normal; 1435 | margin-top: 24px; 1436 | } 1437 | 1438 | :disabled { 1439 | color: #993333; 1440 | } 1441 | 1442 | select, 1443 | select option { 1444 | color: var(--sdpi-color); 1445 | } 1446 | 1447 | select.disabled, 1448 | select option:disabled { 1449 | color: #fd9494; 1450 | font-style: italic; 1451 | } 1452 | 1453 | .runningAppsContainer { 1454 | display: none; 1455 | } 1456 | 1457 | .one-line { 1458 | min-height: 1.5em; 1459 | } 1460 | 1461 | .two-lines { 1462 | min-height: 3em; 1463 | } 1464 | 1465 | .three-lines { 1466 | min-height: 4.5em; 1467 | } 1468 | 1469 | .four-lines { 1470 | min-height: 6em; 1471 | } 1472 | 1473 | .min80>.sdpi-item-child { 1474 | min-width: 80px; 1475 | } 1476 | 1477 | .min100>.sdpi-item-child { 1478 | min-width: 100px; 1479 | } 1480 | 1481 | .min120>.sdpi-item-child { 1482 | min-width: 120px; 1483 | } 1484 | 1485 | .min140>.sdpi-item-child { 1486 | min-width: 140px; 1487 | } 1488 | 1489 | .min160>.sdpi-item-child { 1490 | min-width: 160px; 1491 | } 1492 | 1493 | .min200>.sdpi-item-child { 1494 | min-width: 200px; 1495 | } 1496 | 1497 | .max40 { 1498 | flex-basis: 40%; 1499 | flex-grow: 0; 1500 | } 1501 | 1502 | .max30 { 1503 | flex-basis: 30%; 1504 | flex-grow: 0; 1505 | } 1506 | 1507 | .max20 { 1508 | flex-basis: 20%; 1509 | flex-grow: 0; 1510 | } 1511 | 1512 | .up20 { 1513 | margin-top: -20px; 1514 | } 1515 | 1516 | .alignCenter { 1517 | align-items: center; 1518 | } 1519 | 1520 | .alignTop { 1521 | align-items: flex-start; 1522 | } 1523 | 1524 | .alignBaseline { 1525 | align-items: baseline; 1526 | } 1527 | 1528 | .noMargins, 1529 | .noMargins *, 1530 | .noInnerMargins * { 1531 | margin: 0; 1532 | padding: 0; 1533 | } 1534 | 1535 | .hidden { 1536 | display: none !important; 1537 | } 1538 | 1539 | .icon-help, 1540 | .icon-help-line, 1541 | .icon-help-fill, 1542 | .icon-help-inv, 1543 | .icon-brighter, 1544 | .icon-darker, 1545 | .icon-warmer, 1546 | .icon-cooler { 1547 | min-width: 20px; 1548 | width: 20px; 1549 | background-repeat: no-repeat; 1550 | opacity: 1; 1551 | } 1552 | 1553 | .icon-help:active, 1554 | .icon-help-line:active, 1555 | .icon-help-fill:active, 1556 | .icon-help-inv:active, 1557 | .icon-brighter:active, 1558 | .icon-darker:active, 1559 | .icon-warmer:active, 1560 | .icon-cooler:active { 1561 | opacity: 0.5; 1562 | } 1563 | 1564 | .icon-brighter, 1565 | .icon-darker, 1566 | .icon-warmer, 1567 | .icon-cooler { 1568 | margin-top: 5px !important; 1569 | } 1570 | 1571 | .icon-help, 1572 | .icon-help-line, 1573 | .icon-help-fill, 1574 | .icon-help-inv { 1575 | cursor: pointer; 1576 | margin: 0px; 1577 | margin-left: 4px; 1578 | } 1579 | 1580 | .icon-brighter { 1581 | background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cg fill='%23999' fill-rule='evenodd'%3E%3Ccircle cx='10' cy='10' r='4'/%3E%3Cpath d='M14.8532861,7.77530426 C14.7173255,7.4682615 14.5540843,7.17599221 14.3666368,6.90157083 L16.6782032,5.5669873 L17.1782032,6.4330127 L14.8532861,7.77530426 Z M10.5,4.5414007 C10.2777625,4.51407201 10.051423,4.5 9.82179677,4.5 C9.71377555,4.5 9.60648167,4.50311409 9.5,4.50925739 L9.5,2 L10.5,2 L10.5,4.5414007 Z M5.38028092,6.75545367 C5.18389364,7.02383457 5.01124349,7.31068015 4.86542112,7.61289977 L2.82179677,6.4330127 L3.32179677,5.5669873 L5.38028092,6.75545367 Z M4.86542112,12.3871002 C5.01124349,12.6893198 5.18389364,12.9761654 5.38028092,13.2445463 L3.32179677,14.4330127 L2.82179677,13.5669873 L4.86542112,12.3871002 Z M9.5,15.4907426 C9.60648167,15.4968859 9.71377555,15.5 9.82179677,15.5 C10.051423,15.5 10.2777625,15.485928 10.5,15.4585993 L10.5,18 L9.5,18 L9.5,15.4907426 Z M14.3666368,13.0984292 C14.5540843,12.8240078 14.7173255,12.5317385 14.8532861,12.2246957 L17.1782032,13.5669873 L16.6782032,14.4330127 L14.3666368,13.0984292 Z'/%3E%3C/g%3E%3C/svg%3E"); 1582 | } 1583 | 1584 | .icon-darker { 1585 | background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cg fill='%23999' fill-rule='evenodd'%3E%3Cpath d='M10 14C7.790861 14 6 12.209139 6 10 6 7.790861 7.790861 6 10 6 12.209139 6 14 7.790861 14 10 14 12.209139 12.209139 14 10 14zM10 13C11.6568542 13 13 11.6568542 13 10 13 8.34314575 11.6568542 7 10 7 8.34314575 7 7 8.34314575 7 10 7 11.6568542 8.34314575 13 10 13zM14.8532861 7.77530426C14.7173255 7.4682615 14.5540843 7.17599221 14.3666368 6.90157083L16.6782032 5.5669873 17.1782032 6.4330127 14.8532861 7.77530426zM10.5 4.5414007C10.2777625 4.51407201 10.051423 4.5 9.82179677 4.5 9.71377555 4.5 9.60648167 4.50311409 9.5 4.50925739L9.5 2 10.5 2 10.5 4.5414007zM5.38028092 6.75545367C5.18389364 7.02383457 5.01124349 7.31068015 4.86542112 7.61289977L2.82179677 6.4330127 3.32179677 5.5669873 5.38028092 6.75545367zM4.86542112 12.3871002C5.01124349 12.6893198 5.18389364 12.9761654 5.38028092 13.2445463L3.32179677 14.4330127 2.82179677 13.5669873 4.86542112 12.3871002zM9.5 15.4907426C9.60648167 15.4968859 9.71377555 15.5 9.82179677 15.5 10.051423 15.5 10.2777625 15.485928 10.5 15.4585993L10.5 18 9.5 18 9.5 15.4907426zM14.3666368 13.0984292C14.5540843 12.8240078 14.7173255 12.5317385 14.8532861 12.2246957L17.1782032 13.5669873 16.6782032 14.4330127 14.3666368 13.0984292z'/%3E%3C/g%3E%3C/svg%3E"); 1586 | } 1587 | 1588 | .icon-warmer { 1589 | background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cg fill='%23999' fill-rule='evenodd'%3E%3Cpath d='M12.3247275 11.4890349C12.0406216 11.0007637 11.6761954 10.5649925 11.2495475 10.1998198 11.0890394 9.83238991 11 9.42659309 11 9 11 7.34314575 12.3431458 6 14 6 15.6568542 6 17 7.34314575 17 9 17 10.6568542 15.6568542 12 14 12 13.3795687 12 12.8031265 11.8116603 12.3247275 11.4890349zM17.6232392 11.6692284C17.8205899 11.4017892 17.9890383 11.1117186 18.123974 10.8036272L20.3121778 12.0669873 19.8121778 12.9330127 17.6232392 11.6692284zM18.123974 7.19637279C17.9890383 6.88828142 17.8205899 6.5982108 17.6232392 6.33077158L19.8121778 5.0669873 20.3121778 5.9330127 18.123974 7.19637279zM14.5 4.52746439C14.3358331 4.50931666 14.1690045 4.5 14 4.5 13.8309955 4.5 13.6641669 4.50931666 13.5 4.52746439L13.5 2 14.5 2 14.5 4.52746439zM13.5 13.4725356C13.6641669 13.4906833 13.8309955 13.5 14 13.5 14.1690045 13.5 14.3358331 13.4906833 14.5 13.4725356L14.5 16 13.5 16 13.5 13.4725356zM14 11C15.1045695 11 16 10.1045695 16 9 16 7.8954305 15.1045695 7 14 7 12.8954305 7 12 7.8954305 12 9 12 10.1045695 12.8954305 11 14 11zM9.5 11C10.6651924 11.4118364 11.5 12.5 11.5 14 11.5 16 10 17.5 8 17.5 6 17.5 4.5 16 4.5 14 4.5 12.6937812 5 11.5 6.5 11L6.5 7 9.5 7 9.5 11z'/%3E%3Cpath d='M12,14 C12,16.209139 10.209139,18 8,18 C5.790861,18 4,16.209139 4,14 C4,12.5194353 4.80439726,11.2267476 6,10.5351288 L6,4 C6,2.8954305 6.8954305,2 8,2 C9.1045695,2 10,2.8954305 10,4 L10,10.5351288 C11.1956027,11.2267476 12,12.5194353 12,14 Z M11,14 C11,12.6937812 10.1651924,11.5825421 9,11.1707057 L9,4 C9,3.44771525 8.55228475,3 8,3 C7.44771525,3 7,3.44771525 7,4 L7,11.1707057 C5.83480763,11.5825421 5,12.6937812 5,14 C5,15.6568542 6.34314575,17 8,17 C9.65685425,17 11,15.6568542 11,14 Z'/%3E%3C/g%3E%3C/svg%3E"); 1590 | } 1591 | 1592 | .icon-cooler { 1593 | background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cg fill='%23999' fill-rule='evenodd'%3E%3Cpath d='M10.4004569 11.6239517C10.0554735 10.9863849 9.57597206 10.4322632 9 9.99963381L9 9.7450467 9.53471338 9.7450467 10.8155381 8.46422201C10.7766941 8.39376637 10.7419749 8.32071759 10.7117062 8.2454012L9 8.2454012 9 6.96057868 10.6417702 6.96057868C10.6677696 6.86753378 10.7003289 6.77722682 10.7389179 6.69018783L9.44918707 5.40045694 9 5.40045694 9 4.34532219 9.32816127 4.34532219 9.34532219 2.91912025 10.4004569 2.91912025 10.4004569 4.53471338 11.6098599 5.74411634C11.7208059 5.68343597 11.8381332 5.63296451 11.9605787 5.59396526L11.9605787 3.8884898 10.8181818 2.74609294 11.5642748 2 12.5727518 3.00847706 13.5812289 2 14.3273218 2.74609294 13.2454012 3.82801356 13.2454012 5.61756719C13.3449693 5.65339299 13.4408747 5.69689391 13.5324038 5.74735625L14.7450467 4.53471338 14.7450467 2.91912025 15.8001815 2.91912025 15.8001815 4.34532219 17.2263834 4.34532219 17.2263834 5.40045694 15.6963166 5.40045694 14.4002441 6.69652946C14.437611 6.78161093 14.4692249 6.86979146 14.4945934 6.96057868L16.2570138 6.96057868 17.3994107 5.81818182 18.1455036 6.56427476 17.1370266 7.57275182 18.1455036 8.58122888 17.3994107 9.32732182 16.3174901 8.2454012 14.4246574 8.2454012C14.3952328 8.31861737 14.3616024 8.38969062 14.3240655 8.45832192L15.6107903 9.7450467 17.2263834 9.7450467 17.2263834 10.8001815 15.8001815 10.8001815 15.8001815 12.2263834 14.7450467 12.2263834 14.7450467 10.6963166 13.377994 9.32926387C13.3345872 9.34850842 13.2903677 9.36625331 13.2454012 9.38243281L13.2454012 11.3174901 14.3273218 12.3994107 13.5812289 13.1455036 12.5848864 12.1491612 11.5642748 13.1455036 10.8181818 12.3994107 11.9605787 11.2570138 11.9605787 9.40603474C11.8936938 9.38473169 11.828336 9.36000556 11.7647113 9.33206224L10.4004569 10.6963166 10.4004569 11.6239517zM12.75 8.5C13.3022847 8.5 13.75 8.05228475 13.75 7.5 13.75 6.94771525 13.3022847 6.5 12.75 6.5 12.1977153 6.5 11.75 6.94771525 11.75 7.5 11.75 8.05228475 12.1977153 8.5 12.75 8.5zM9.5 14C8.5 16.3333333 7.33333333 17.5 6 17.5 4.66666667 17.5 3.5 16.3333333 2.5 14L9.5 14z'/%3E%3Cpath d='M10,14 C10,16.209139 8.209139,18 6,18 C3.790861,18 2,16.209139 2,14 C2,12.5194353 2.80439726,11.2267476 4,10.5351288 L4,4 C4,2.8954305 4.8954305,2 6,2 C7.1045695,2 8,2.8954305 8,4 L8,10.5351288 C9.19560274,11.2267476 10,12.5194353 10,14 Z M9,14 C9,12.6937812 8.16519237,11.5825421 7,11.1707057 L7,4 C7,3.44771525 6.55228475,3 6,3 C5.44771525,3 5,3.44771525 5,4 L5,11.1707057 C3.83480763,11.5825421 3,12.6937812 3,14 C3,15.6568542 4.34314575,17 6,17 C7.65685425,17 9,15.6568542 9,14 Z'/%3E%3C/g%3E%3C/svg%3E"); 1594 | } 1595 | 1596 | .icon-help { 1597 | background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20'%3E%3Cpath fill='%23999' d='M11.292 12.516l.022 1.782H9.07v-1.804c0-1.98 1.276-2.574 2.662-3.278h-.022c.814-.44 1.65-.88 1.694-2.2.044-1.386-1.122-2.728-3.234-2.728-1.518 0-2.662.902-3.366 2.354L5 5.608C5.946 3.584 7.662 2 10.17 2c3.564 0 5.632 2.442 5.588 5.06-.066 2.618-1.716 3.41-3.102 4.158-.704.374-1.364.682-1.364 1.298zm-1.122 2.442c.858 0 1.452.594 1.452 1.452 0 .682-.594 1.408-1.452 1.408-.77 0-1.386-.726-1.386-1.408 0-.858.616-1.452 1.386-1.452z'/%3E%3C/svg%3E"); 1598 | } 1599 | 1600 | .icon-help-line { 1601 | background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23999' fill-rule='evenodd'%3E%3Cpath d='M10 20C4.477 20 0 15.523 0 10S4.477 0 10 0s10 4.477 10 10-4.477 10-10 10zm0-1a9 9 0 1 0 0-18 9 9 0 0 0 0 18z'/%3E%3Cpath d='M10.848 12.307l.02 1.578H8.784v-1.597c0-1.753 1.186-2.278 2.474-2.901h-.02c.756-.39 1.533-.78 1.574-1.948.041-1.226-1.043-2.414-3.006-2.414-1.41 0-2.474.798-3.128 2.083L5 6.193C5.88 4.402 7.474 3 9.805 3 13.118 3 15.04 5.161 15 7.478c-.061 2.318-1.595 3.019-2.883 3.68-.654.332-1.268.604-1.268 1.15zM9.805 14.47c.798 0 1.35.525 1.35 1.285 0 .603-.552 1.246-1.35 1.246-.715 0-1.288-.643-1.288-1.246 0-.76.573-1.285 1.288-1.285z' fill-rule='nonzero'/%3E%3C/g%3E%3C/svg%3E"); 1602 | } 1603 | 1604 | .icon-help-fill { 1605 | background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Ccircle cx='10' cy='10' r='10' fill='%23999'/%3E%3Cpath fill='%23FFF' fill-rule='nonzero' d='M8.368 7.189H5C5 3.5 7.668 2 10.292 2 13.966 2 16 4.076 16 7.012c0 3.754-3.849 3.136-3.849 5.211v1.656H8.455v-1.832c0-2.164 1.4-2.893 2.778-3.6.437-.242 1.006-.574 1.006-1.236 0-2.208-3.871-2.142-3.871-.022zM10.25 18a1.75 1.75 0 1 1 0-3.5 1.75 1.75 0 0 1 0 3.5z'/%3E%3C/g%3E%3C/svg%3E"); 1606 | } 1607 | 1608 | .icon-help-inv { 1609 | background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20'%3E%3Cpath fill='%23999' fill-rule='evenodd' d='M10 20C4.477 20 0 15.523 0 10S4.477 0 10 0s10 4.477 10 10-4.477 10-10 10zM8.368 7.189c0-2.12 3.87-2.186 3.87.022 0 .662-.568.994-1.005 1.236-1.378.707-2.778 1.436-2.778 3.6v1.832h3.696v-1.656c0-2.075 3.849-1.457 3.849-5.21C16 4.075 13.966 2 10.292 2 7.668 2 5 3.501 5 7.189h3.368zM10.25 18a1.75 1.75 0 1 0 0-3.5 1.75 1.75 0 0 0 0 3.5z'/%3E%3C/svg%3E"); 1610 | } 1611 | 1612 | .kelvin::after { 1613 | content: "K"; 1614 | } 1615 | 1616 | .mired::after { 1617 | content: " Mired"; 1618 | } 1619 | 1620 | .percent::after { 1621 | content: "%"; 1622 | } 1623 | 1624 | .sdpi-item-value+.icon-cooler, 1625 | .sdpi-item-value+.icon-warmer { 1626 | margin-left: 0px !important; 1627 | margin-top: 15px !important; 1628 | } 1629 | 1630 | /** 1631 | CONTROL-CENTER STYLES 1632 | */ 1633 | input[type="range"].colorbrightness::-webkit-slider-runnable-track, 1634 | input[type="range"].colortemperature::-webkit-slider-runnable-track { 1635 | height: 8px; 1636 | background: #979797; 1637 | border-radius: 4px; 1638 | background-image: linear-gradient(to right, #94d0ec, #ffb165); 1639 | } 1640 | 1641 | input[type="range"].colorbrightness.greyscale::-webkit-slider-runnable-track, 1642 | input[type="range"].colorbrightness.grayscale::-webkit-slider-runnable-track { 1643 | background-color: #efefef; 1644 | background-image: linear-gradient(to right, black, rgba(0, 0, 0, 0)); 1645 | } 1646 | 1647 | 1648 | input[type="range"].colorbrightness::-webkit-slider-thumb, 1649 | input[type="range"].colortemperature::-webkit-slider-thumb { 1650 | width: 16px; 1651 | height: 16px; 1652 | border-radius: 20px; 1653 | margin-top: -5px; 1654 | background-color: #86c6e8; 1655 | box-shadow: 0px 0px 1px #000000; 1656 | border: 1px solid #d8d8d8; 1657 | } 1658 | 1659 | .sdpi-info-label { 1660 | display: inline-block; 1661 | user-select: none; 1662 | position: absolute; 1663 | height: 15px; 1664 | width: auto; 1665 | text-align: center; 1666 | border-radius: 4px; 1667 | min-width: 44px; 1668 | max-width: 80px; 1669 | background: white; 1670 | font-size: 11px; 1671 | color: black; 1672 | z-index: 1000; 1673 | box-shadow: 0px 0px 12px rgba(0, 0, 0, .8); 1674 | padding: 2px; 1675 | 1676 | } 1677 | 1678 | .sdpi-info-label.hidden { 1679 | opacity: 0; 1680 | transition: opacity 0.25s linear; 1681 | } 1682 | 1683 | .sdpi-info-label.shown { 1684 | position: absolute; 1685 | opacity: 1; 1686 | transition: opacity 0.25s ease-out; 1687 | } 1688 | 1689 | /* adding some styles here that override sdpi things so we can use this as notes for sdpi updates*/ 1690 | select { 1691 | min-width: 0px; 1692 | 1693 | /* this is a clunky fix for using background image as select arrow with long text options */ 1694 | /* -webkit-appearance: media-slider; */ 1695 | text-overflow: ellipsis; 1696 | } 1697 | 1698 | /*--------- context menu ----------*/ 1699 | 1700 | .context-menu { 1701 | display: none; 1702 | position: absolute; 1703 | z-index: 10; 1704 | padding: 12px 0; 1705 | width: 120px; 1706 | background-color: #3D3D3D; 1707 | border: solid 1px #dfdfdf; 1708 | box-shadow: 1px 1px 2px #cfcfcf; 1709 | } 1710 | 1711 | .context-menu--active { 1712 | display: block; 1713 | } 1714 | 1715 | .context-menu__items { 1716 | list-style: none; 1717 | margin: 0; 1718 | padding: 0; 1719 | overflow-y: auto; 1720 | } 1721 | 1722 | .context-menu__item { 1723 | display: block; 1724 | margin-bottom: 4px; 1725 | background-color: #3D3D3D !important; 1726 | } 1727 | 1728 | .context-menu__item:last-child { 1729 | margin-bottom: 0; 1730 | } 1731 | 1732 | .context-menu__link { 1733 | display: block; 1734 | padding: 4px 12px; 1735 | color: #ffff; 1736 | text-decoration: none; 1737 | white-space: nowrap; 1738 | } 1739 | 1740 | .context-menu__link:hover { 1741 | color: #fff; 1742 | background-color: #0066aa; 1743 | } 1744 | 1745 | .context-menu_message { 1746 | cursor: default; 1747 | } 1748 | -------------------------------------------------------------------------------- /js/action.js: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | /** 4 | * @class Action 5 | * A Stream Deck plugin action, where you can register callback functions for different events 6 | */ 7 | class ELGSDAction { 8 | UUID; 9 | on = EventEmitter.on; 10 | emit = EventEmitter.emit; 11 | 12 | constructor(UUID) { 13 | if (!UUID) { 14 | console.error( 15 | 'An action UUID matching the action UUID in your manifest is required when creating Actions.' 16 | ); 17 | } 18 | 19 | this.UUID = UUID; 20 | } 21 | 22 | /** 23 | * Registers a callback function for the didReceiveSettings event, which fires when calling getSettings 24 | * @param {function} fn 25 | */ 26 | onDidReceiveSettings(fn) { 27 | if (!fn) { 28 | console.error( 29 | 'A callback function for the didReceiveSettings event is required for onDidReceiveSettings.' 30 | ); 31 | } 32 | 33 | this.on(`${this.UUID}.${Events.didReceiveSettings}`, (jsn) => fn(jsn)); 34 | return this; 35 | } 36 | 37 | /** 38 | * Registers a callback function for the keyDown event, which fires when pressing a key down 39 | * @param {function} fn 40 | */ 41 | onKeyDown(fn) { 42 | if (!fn) { 43 | console.error('A callback function for the keyDown event is required for onKeyDown.'); 44 | } 45 | 46 | this.on(`${this.UUID}.${Events.keyDown}`, (jsn) => fn(jsn)); 47 | return this; 48 | } 49 | 50 | /** 51 | * Registers a callback function for the keyUp event, which fires when releasing a key 52 | * @param {function} fn 53 | */ 54 | onKeyUp(fn) { 55 | if (!fn) { 56 | console.error('A callback function for the keyUp event is required for onKeyUp.'); 57 | } 58 | 59 | this.on(`${this.UUID}.${Events.keyUp}`, (jsn) => fn(jsn)); 60 | return this; 61 | } 62 | 63 | /** 64 | * Registers a callback function for the willAppear event, which fires when an action appears on the canvas 65 | * @param {function} fn 66 | */ 67 | onWillAppear(fn) { 68 | if (!fn) { 69 | console.error('A callback function for the willAppear event is required for onWillAppear.'); 70 | } 71 | 72 | this.on(`${this.UUID}.${Events.willAppear}`, (jsn) => fn(jsn)); 73 | return this; 74 | } 75 | 76 | /** 77 | * Registers a callback function for the willAppear event, which fires when an action disappears on the canvas 78 | * @param {function} fn 79 | */ 80 | onWillDisappear(fn) { 81 | if (!fn) { 82 | console.error( 83 | 'A callback function for the willDisappear event is required for onWillDisappear.' 84 | ); 85 | } 86 | 87 | this.on(`${this.UUID}.${Events.willDisappear}`, (jsn) => fn(jsn)); 88 | return this; 89 | } 90 | 91 | /** 92 | * Registers a callback function for the titleParametersDidChange event, which fires when a user changes the key title 93 | * @param {function} fn 94 | */ 95 | onTitleParametersDidChange(fn) { 96 | if (!fn) { 97 | console.error( 98 | 'A callback function for the titleParametersDidChange event is required for onTitleParametersDidChange.' 99 | ); 100 | } 101 | 102 | this.on(`${this.UUID}.${Events.titleParametersDidChange}`, (jsn) => fn(jsn)); 103 | return this; 104 | } 105 | 106 | /** 107 | * Registers a callback function for the propertyInspectorDidAppear event, which fires when the property inspector is displayed 108 | * @param {function} fn 109 | */ 110 | onPropertyInspectorDidAppear(fn) { 111 | if (!fn) { 112 | console.error( 113 | 'A callback function for the propertyInspectorDidAppear event is required for onPropertyInspectorDidAppear.' 114 | ); 115 | } 116 | 117 | this.on(`${this.UUID}.${Events.propertyInspectorDidAppear}`, (jsn) => fn(jsn)); 118 | return this; 119 | } 120 | 121 | /** 122 | * Registers a callback function for the propertyInspectorDidDisappear event, which fires when the property inspector is closed 123 | * @param {function} fn 124 | */ 125 | onPropertyInspectorDidDisappear(fn) { 126 | if (!fn) { 127 | console.error( 128 | 'A callback function for the propertyInspectorDidDisappear event is required for onPropertyInspectorDidDisappear.' 129 | ); 130 | } 131 | 132 | this.on(`${this.UUID}.${Events.propertyInspectorDidDisappear}`, (jsn) => fn(jsn)); 133 | return this; 134 | } 135 | 136 | /** 137 | * Registers a callback function for the sendToPlugin event, which fires when the property inspector uses the sendToPlugin api 138 | * @param {function} fn 139 | */ 140 | onSendToPlugin(fn) { 141 | if (!fn) { 142 | console.error( 143 | 'A callback function for the sendToPlugin event is required for onSendToPlugin.' 144 | ); 145 | } 146 | 147 | this.on(`${this.UUID}.${Events.sendToPlugin}`, (jsn) => fn(jsn)); 148 | return this; 149 | } 150 | 151 | /** 152 | * Registers a callback function for the onDialRotate event, which fires when a SD+ dial was rotated 153 | * @param {function} fn 154 | */ 155 | onDialRotate(fn) { 156 | if (!fn) { 157 | console.error('A callback function for the onDialRotate event is required for onDialRotate.'); 158 | } 159 | this.on(`${this.UUID}.${Events.dialRotate}`, (jsn) => fn(jsn)); 160 | return this; 161 | } 162 | 163 | /** 164 | * Registers a callback function for the dialPress event, which fires when a SD+ dial was pressed or released 165 | * @deprecated Use onDialUp and onDialDown instead 166 | */ 167 | onDialPress(fn) { 168 | if (!fn) { 169 | console.error('A callback function for the dialPress event is required for onDialPress.'); 170 | } 171 | this.on(`${this.UUID}.${Events.dialPress}`, (jsn) => fn(jsn)); 172 | return this; 173 | } 174 | 175 | /** 176 | * Registers a callback function for the dialDown event, which fires when a SD+ dial was pressed 177 | * @param {function} fn 178 | */ 179 | onDialDown(fn) { 180 | if (!fn) { 181 | console.error('A callback function for the dialDown event is required for onDialDown.'); 182 | } 183 | this.on(`${this.UUID}.${Events.dialDown}`, (jsn) => fn(jsn)); 184 | return this; 185 | } 186 | 187 | /** 188 | * Registers a callback function for the dialUp event, which fires when a pressed SD+ dial was released 189 | * @param {function} fn 190 | */ 191 | onDialUp(fn) { 192 | if (!fn) { 193 | console.error('A callback function for the dialUp event is required for onDialUp.'); 194 | } 195 | this.on(`${this.UUID}.${Events.dialUp}`, (jsn) => fn(jsn)); 196 | return this; 197 | } 198 | 199 | /** 200 | * Registers a callback function for the touchTap event, which fires when a SD+ touch panel was touched quickly 201 | * @param {function} fn 202 | */ 203 | onTouchTap(fn) { 204 | if (!fn) { 205 | console.error( 206 | 'A callback function for the onTouchTap event is required for onTouchTap.' 207 | ); 208 | } 209 | this.on(`${this.UUID}.${Events.touchTap}`, (jsn) => fn(jsn)); 210 | return this; 211 | } 212 | } 213 | 214 | const Action = ELGSDAction; 215 | -------------------------------------------------------------------------------- /js/api.js: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | class ELGSDPlugin { 4 | #data = {}; 5 | #language = 'en'; 6 | #localization; 7 | test = new Set(); 8 | on = EventEmitter.on; 9 | emit = EventEmitter.emit; 10 | 11 | localizationLoaded = false; 12 | constructor () { 13 | // super(); 14 | if(ELGSDPlugin.__instance) { 15 | return ELGSDPlugin.__instance; 16 | } 17 | 18 | ELGSDPlugin.__instance = this; 19 | const pathArr = location.pathname.split("/"); 20 | const idx = pathArr.findIndex(f => f.endsWith('sdPlugin')); 21 | this.#data.__filename = pathArr[pathArr.length - 1]; 22 | this.#data.__dirname = pathArr[pathArr.length - 2]; 23 | this.#data.__folderpath = `${pathArr.slice(0, idx + 1).join("/")}/`; 24 | this.#data.__folderroot = `${pathArr.slice(0, idx).join("/")}/`; 25 | this.#data.__parentdir = `${pathArr.slice(0, idx-1).join("/")}/`; 26 | } 27 | 28 | set language(value) { 29 | this.#language = value; 30 | this.loadLocalization(this.#data.__folderpath) 31 | .then(l => { 32 | this.emit('languageChanged', value); 33 | }) 34 | .catch(() => console.warn(`Localization for '${this.#language}' couldn't be loaded`)) 35 | } 36 | 37 | get language() { 38 | return this.#language; 39 | } 40 | 41 | set localization(value) { 42 | this.#localization = value; 43 | this.localizeUI(); 44 | this.emit('localizationChanged', value); 45 | } 46 | 47 | get localization() { 48 | return this.#localization; 49 | } 50 | 51 | get __filename() { 52 | return this.#data.__filename; 53 | } 54 | 55 | get __dirname() { 56 | return this.#data.__dirname; 57 | } 58 | 59 | get __folderpath() { 60 | return this.#data.__folderpath; 61 | } 62 | get __folderroot() { 63 | return this.#data.__folderroot; 64 | } 65 | get data() { 66 | return this.#data; 67 | } 68 | 69 | /** 70 | * Finds the original key of the string value 71 | * Note: This is used by the localization UI to find the original key (not used here) 72 | * @param {string} str 73 | * @returns {string} 74 | */ 75 | 76 | localizedString(str) { 77 | return Object.keys(this.localization).find(e => e == str); 78 | } 79 | 80 | /** 81 | * Returns the localized string or the original string if not found 82 | * @param {string} str 83 | * @returns {string} 84 | */ 85 | 86 | localize(s) { 87 | if(typeof s === 'undefined') return ''; 88 | let str = String(s); 89 | try { 90 | str = this.localization[str] || str; 91 | } catch(b) {} 92 | return str; 93 | }; 94 | 95 | /** 96 | * Searches the document tree to find elements with data-localize attributes 97 | * and replaces their values with the localized string 98 | * @returns {} 99 | */ 100 | 101 | localizeUI = () => { 102 | const el = document.querySelector('.sdpi-wrapper'); 103 | if(!el) return console.warn("No element found to localize"); 104 | const selectorsList = '[data-localize]'; 105 | // see if we have any data-localize attributes 106 | // that means we can skip the rest of the DOM 107 | el.querySelectorAll(selectorsList).forEach(e => { 108 | const s = e.innerText.trim(); 109 | e.innerHTML = e.innerHTML.replace(s, this.localize(s)); 110 | if(e.placeholder && e.placeholder.length) { 111 | e.placeholder = this.localize(e.placeholder); 112 | } 113 | if(e.title && e.title.length) { 114 | e.title = this.localize(e.title); 115 | } 116 | }); 117 | }; 118 | /** 119 | * Fetches the specified language json file 120 | * @param {string} pathPrefix 121 | * @returns {Promise} 122 | */ 123 | async loadLocalization(pathPrefix) { 124 | if(!pathPrefix) { 125 | pathPrefix = this.#data.__folderpath; 126 | } 127 | // here we save the promise to the JSON-reader result, 128 | // which we can later re-use to see, if the strings are already loaded 129 | this.localizationLoaded = this.readJson(`${pathPrefix}${this.language}.json`); 130 | const manifest = await this.localizationLoaded; 131 | this.localization = manifest['Localization'] ?? null; 132 | window.$localizedStrings = this.localization; 133 | this.emit('localizationLoaded', this.localization); 134 | 135 | return this.localization; 136 | } 137 | 138 | /** 139 | * 140 | * @param {string} path 141 | * @returns {Promise} json 142 | */ 143 | async readJson(path) { 144 | if(!path) { 145 | console.error('A path is required to readJson.'); 146 | } 147 | 148 | return new Promise((resolve, reject) => { 149 | const req = new XMLHttpRequest(); 150 | req.onerror = reject; 151 | req.overrideMimeType('application/json'); 152 | req.open('GET', path, true); 153 | req.onreadystatechange = (response) => { 154 | if(req.readyState === 4) { 155 | const jsonString = response?.target?.response; 156 | if(jsonString) { 157 | resolve(JSON.parse(response?.target?.response)); 158 | } else { 159 | reject(); 160 | } 161 | } 162 | }; 163 | 164 | req.send(); 165 | }); 166 | } 167 | } 168 | 169 | class ELGSDApi extends ELGSDPlugin { 170 | port; 171 | uuid; 172 | messageType; 173 | actionInfo; 174 | websocket; 175 | appInfo; 176 | #data = {}; 177 | 178 | /** 179 | * Connect to Stream Deck 180 | * @param {string} port 181 | * @param {string} uuid 182 | * @param {string} messageType 183 | * @param {string} appInfoString 184 | * @param {string} actionString 185 | */ 186 | connect(port, uuid, messageType, appInfoString, actionString) { 187 | this.port = port; 188 | this.uuid = uuid; 189 | this.messageType = messageType; 190 | this.actionInfo = actionString ? JSON.parse(actionString) : null; 191 | this.appInfo = JSON.parse(appInfoString); 192 | this.language = this.appInfo?.application?.language ?? null; 193 | 194 | if(this.websocket) { 195 | this.websocket.close(); 196 | this.websocket = null; 197 | } 198 | 199 | this.websocket = new WebSocket('ws://127.0.0.1:' + this.port); 200 | 201 | this.websocket.onopen = () => { 202 | const json = { 203 | event: this.messageType, 204 | uuid: this.uuid, 205 | }; 206 | 207 | this.websocket.send(JSON.stringify(json)); 208 | 209 | this.emit(Events.connected, { 210 | connection: this.websocket, 211 | port: this.port, 212 | uuid: this.uuid, 213 | actionInfo: this.actionInfo, 214 | appInfo: this.appInfo, 215 | messageType: this.messageType, 216 | }); 217 | }; 218 | 219 | this.websocket.onerror = (evt) => { 220 | const error = `WEBSOCKET ERROR: ${evt}, ${evt.data}, ${SocketErrors[evt?.code]}`; 221 | console.warn(error); 222 | this.logMessage(error); 223 | }; 224 | 225 | this.websocket.onclose = (evt) => { 226 | console.warn('WEBSOCKET CLOSED:', SocketErrors[evt?.code]); 227 | }; 228 | 229 | this.websocket.onmessage = (evt) => { 230 | const data = evt?.data ? JSON.parse(evt.data) : null; 231 | 232 | const {action, event} = data; 233 | const message = action ? `${action}.${event}` : event; 234 | if(message && message !== '') this.emit(message, data); 235 | }; 236 | } 237 | 238 | /** 239 | * Write to log file 240 | * @param {string} message 241 | */ 242 | logMessage(message) { 243 | if(!message) { 244 | console.error('A message is required for logMessage.'); 245 | } 246 | 247 | try { 248 | if(this.websocket) { 249 | const json = { 250 | event: Events.logMessage, 251 | payload: { 252 | message: message, 253 | }, 254 | }; 255 | this.websocket.send(JSON.stringify(json)); 256 | } else { 257 | console.error('Websocket not defined'); 258 | } 259 | } catch(e) { 260 | console.error('Websocket not defined'); 261 | } 262 | } 263 | 264 | /** 265 | * Send JSON payload to StreamDeck 266 | * @param {string} context 267 | * @param {string} event 268 | * @param {object} [payload] 269 | */ 270 | send(context, event, payload = {}) { 271 | this.websocket && this.websocket.send(JSON.stringify({context, event, ...payload})); 272 | } 273 | 274 | /** 275 | * Save the plugin's persistent data 276 | * @param {object} payload 277 | */ 278 | setGlobalSettings(payload) { 279 | this.send(this.uuid, Events.setGlobalSettings, { 280 | payload: payload, 281 | }); 282 | } 283 | 284 | /** 285 | * Request the plugin's persistent data. StreamDeck does not return the data, but trigger the plugin/property inspectors didReceiveGlobalSettings event 286 | */ 287 | getGlobalSettings() { 288 | this.send(this.uuid, Events.getGlobalSettings); 289 | } 290 | 291 | /** 292 | * Opens a URL in the default web browser 293 | * @param {string} url 294 | */ 295 | openUrl(url) { 296 | if(!url) { 297 | console.error('A url is required for openUrl.'); 298 | } 299 | 300 | this.send(this.uuid, Events.openUrl, { 301 | payload: { 302 | url, 303 | }, 304 | }); 305 | } 306 | 307 | /** 308 | * Registers a callback function for when Stream Deck is connected 309 | * @param {function} fn 310 | * @returns ELGSDStreamDeck 311 | */ 312 | onConnected(fn) { 313 | if(!fn) { 314 | console.error('A callback function for the connected event is required for onConnected.'); 315 | } 316 | 317 | this.on(Events.connected, (jsn) => fn(jsn)); 318 | return this; 319 | } 320 | 321 | /** 322 | * Registers a callback function for the didReceiveGlobalSettings event, which fires when calling getGlobalSettings 323 | * @param {function} fn 324 | */ 325 | onDidReceiveGlobalSettings(fn) { 326 | if(!fn) { 327 | console.error( 328 | 'A callback function for the didReceiveGlobalSettings event is required for onDidReceiveGlobalSettings.' 329 | ); 330 | } 331 | 332 | this.on(Events.didReceiveGlobalSettings, (jsn) => fn(jsn)); 333 | return this; 334 | } 335 | 336 | /** 337 | * Registers a callback function for the didReceiveSettings event, which fires when calling getSettings 338 | * @param {string} action 339 | * @param {function} fn 340 | */ 341 | onDidReceiveSettings(action, fn) { 342 | if(!fn) { 343 | console.error( 344 | 'A callback function for the didReceiveSettings event is required for onDidReceiveSettings.' 345 | ); 346 | } 347 | 348 | this.on(`${action}.${Events.didReceiveSettings}`, (jsn) => fn(jsn)); 349 | return this; 350 | } 351 | } 352 | -------------------------------------------------------------------------------- /js/constants.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Errors received from WebSocket 3 | */ 4 | const SocketErrors = { 5 | 0: 'The connection has not yet been established', 6 | 1: 'The connection is established and communication is possible', 7 | 2: 'The connection is going through the closing handshake', 8 | 3: 'The connection has been closed or could not be opened', 9 | 1000: 'Normal Closure. The purpose for which the connection was established has been fulfilled.', 10 | 1001: 'Going Away. An endpoint is "going away", such as a server going down or a browser having navigated away from a page.', 11 | 1002: 'Protocol error. An endpoint is terminating the connection due to a protocol error', 12 | 1003: "Unsupported Data. An endpoint received a type of data it doesn't support.", 13 | 1004: '--Reserved--. The specific meaning might be defined in the future.', 14 | 1005: 'No Status. No status code was actually present.', 15 | 1006: 'Abnormal Closure. The connection was closed abnormally, e.g., without sending or receiving a Close control frame', 16 | 1007: 'Invalid frame payload data. The connection was closed, because the received data was not consistent with the type of the message (e.g., non-UTF-8 [http://tools.ietf.org/html/rfc3629]).', 17 | 1008: 'Policy Violation. The connection was closed, because current message data "violates its policy". This reason is given either if there is no other suitable reason, or if there is a need to hide specific details about the policy.', 18 | 1009: 'Message Too Big. Connection closed because the message is too big for it to process.', 19 | 1010: "Mandatory Extension. Connection is terminated the connection because the server didn't negotiate one or more extensions in the WebSocket handshake.", 20 | 1011: 'Internl Server Error. Connection closed because it encountered an unexpected condition that prevented it from fulfilling the request.', 21 | 1015: "TLS Handshake. The connection was closed due to a failure to perform a TLS handshake (e.g., the server certificate can't be verified).", 22 | }; 23 | 24 | /** 25 | * Events used for communicating with Stream Deck 26 | */ 27 | const Events = { 28 | didReceiveSettings: 'didReceiveSettings', 29 | didReceiveGlobalSettings: 'didReceiveGlobalSettings', 30 | keyDown: 'keyDown', 31 | keyUp: 'keyUp', 32 | willAppear: 'willAppear', 33 | willDisappear: 'willDisappear', 34 | titleParametersDidChange: 'titleParametersDidChange', 35 | deviceDidConnect: 'deviceDidConnect', 36 | deviceDidDisconnect: 'deviceDidDisconnect', 37 | applicationDidLaunch: 'applicationDidLaunch', 38 | applicationDidTerminate: 'applicationDidTerminate', 39 | systemDidWakeUp: 'systemDidWakeUp', 40 | propertyInspectorDidAppear: 'propertyInspectorDidAppear', 41 | propertyInspectorDidDisappear: 'propertyInspectorDidDisappear', 42 | sendToPlugin: 'sendToPlugin', 43 | sendToPropertyInspector: 'sendToPropertyInspector', 44 | connected: 'connected', 45 | setImage: 'setImage', 46 | setXYWHImage: 'setXYWHImage', 47 | setTitle: 'setTitle', 48 | setState: 'setState', 49 | showOk: 'showOk', 50 | showAlert: 'showAlert', 51 | openUrl: 'openUrl', 52 | setGlobalSettings: 'setGlobalSettings', 53 | getGlobalSettings: 'getGlobalSettings', 54 | setSettings: 'setSettings', 55 | getSettings: 'getSettings', 56 | registerPropertyInspector: 'registerPropertyInspector', 57 | registerPlugin: 'registerPlugin', 58 | logMessage: 'logMessage', 59 | switchToProfile: 'switchToProfile', 60 | dialRotate: 'dialRotate', 61 | dialPress: 'dialPress', 62 | dialDown: 'dialDown', 63 | dialUp: 'dialUp', 64 | touchTap: 'touchTap', 65 | setFeedback: 'setFeedback', 66 | setFeedbackLayout: 'setFeedbackLayout', 67 | }; 68 | 69 | /** 70 | * Constants used for Stream Deck 71 | */ 72 | const Constants = { 73 | dataLocalize: '[data-localize]', 74 | hardwareAndSoftware: 0, 75 | hardwareOnly: 1, 76 | softwareOnly: 2, 77 | }; 78 | 79 | const DestinationEnum = { 80 | HARDWARE_AND_SOFTWARE: 0, 81 | HARDWARE_ONLY: 1, 82 | SOFTWARE_ONLY: 2, 83 | }; 84 | -------------------------------------------------------------------------------- /js/dynamic-styles.js: -------------------------------------------------------------------------------- 1 | const fadeColor = function (col, amt) { 2 | const min = Math.min, 3 | max = Math.max; 4 | const num = parseInt(col.replace(/#/g, ''), 16); 5 | const r = min(255, max((num >> 16) + amt, 0)); 6 | const g = min(255, max((num & 0x0000ff) + amt, 0)); 7 | const b = min(255, max(((num >> 8) & 0x00ff) + amt, 0)); 8 | return '#' + (g | (b << 8) | (r << 16)).toString(16).padStart(6, 0); 9 | }; 10 | 11 | $PI.onConnected(({appInfo}) => { 12 | if (!appInfo?.colors) return; 13 | const clrs = appInfo.colors; 14 | const node = document.getElementById('#sdpi-dynamic-styles') || document.createElement('style'); 15 | if (!clrs.mouseDownColor) clrs.mouseDownColor = fadeColor(clrs.highlightColor, -100); 16 | const clr = clrs.highlightColor.slice(0, 7); 17 | const clr1 = fadeColor(clr, 100); 18 | const clr2 = fadeColor(clr, 60); 19 | const metersActiveColor = fadeColor(clr, -60); 20 | 21 | node.setAttribute('id', 'sdpi-dynamic-styles'); 22 | node.innerHTML = ` 23 | 24 | input[type="radio"]:checked + label span, 25 | input[type="checkbox"]:checked + label span { 26 | background-color: ${clrs.highlightColor}; 27 | } 28 | 29 | input[type="radio"]:active:checked + label span, 30 | input[type="checkbox"]:active:checked + label span { 31 | background-color: ${clrs.mouseDownColor}; 32 | } 33 | 34 | input[type="radio"]:active + label span, 35 | input[type="checkbox"]:active + label span { 36 | background-color: ${clrs.buttonPressedBorderColor}; 37 | } 38 | 39 | td.selected, 40 | td.selected:hover, 41 | li.selected:hover, 42 | li.selected { 43 | color: white; 44 | background-color: ${clrs.highlightColor}; 45 | } 46 | 47 | .sdpi-file-label > label:active, 48 | .sdpi-file-label.file:active, 49 | label.sdpi-file-label:active, 50 | label.sdpi-file-info:active, 51 | input[type="file"]::-webkit-file-upload-button:active, 52 | button:active { 53 | border: 1pt solid ${clrs.buttonPressedBorderColor}; 54 | background-color: ${clrs.buttonPressedBackgroundColor}; 55 | color: ${clrs.buttonPressedTextColor}; 56 | border-color: ${clrs.buttonPressedBorderColor}; 57 | } 58 | 59 | ::-webkit-progress-value, 60 | meter::-webkit-meter-optimum-value { 61 | background: linear-gradient(${clr2}, ${clr1} 20%, ${clr} 45%, ${clr} 55%, ${clr2}) 62 | } 63 | 64 | ::-webkit-progress-value:active, 65 | meter::-webkit-meter-optimum-value:active { 66 | background: linear-gradient(${clr}, ${clr2} 20%, ${metersActiveColor} 45%, ${metersActiveColor} 55%, ${clr}) 67 | } 68 | `; 69 | document.body.appendChild(node); 70 | }); 71 | -------------------------------------------------------------------------------- /js/events.js: -------------------------------------------------------------------------------- 1 | /** ELGEvents 2 | * Publish/Subscribe pattern to quickly signal events to 3 | * the plugin, property inspector and data. 4 | */ 5 | 6 | const ELGEvents = { 7 | eventEmitter: function (name, fn) { 8 | const eventList = new Map(); 9 | 10 | const on = (name, fn) => { 11 | if (!eventList.has(name)) eventList.set(name, ELGEvents.pubSub()); 12 | 13 | return eventList.get(name).sub(fn); 14 | }; 15 | 16 | const has = name => eventList.has(name); 17 | 18 | const emit = (name, data) => eventList.has(name) && eventList.get(name).pub(data); 19 | 20 | return Object.freeze({on, has, emit, eventList}); 21 | }, 22 | 23 | pubSub: function pubSub() { 24 | const subscribers = new Set(); 25 | 26 | const sub = fn => { 27 | subscribers.add(fn); 28 | return () => { 29 | subscribers.delete(fn); 30 | }; 31 | }; 32 | 33 | const pub = data => subscribers.forEach(fn => fn(data)); 34 | return Object.freeze({pub, sub}); 35 | } 36 | }; 37 | 38 | const EventEmitter = ELGEvents.eventEmitter(); -------------------------------------------------------------------------------- /js/property-inspector.js: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | class ELGSDPropertyInspector extends ELGSDApi { 5 | constructor() { 6 | super(); 7 | if (ELGSDPropertyInspector.__instance) { 8 | return ELGSDPropertyInspector.__instance; 9 | } 10 | 11 | ELGSDPropertyInspector.__instance = this; 12 | } 13 | 14 | /** 15 | * Registers a callback function for when Stream Deck sends data to the property inspector 16 | * @param {string} actionUUID 17 | * @param {function} fn 18 | * @returns ELGSDStreamDeck 19 | */ 20 | onSendToPropertyInspector(actionUUID, fn) { 21 | if (typeof actionUUID != 'string') { 22 | console.error('An action UUID string is required for onSendToPropertyInspector.'); 23 | } 24 | 25 | if (!fn) { 26 | console.error( 27 | 'A callback function for the sendToPropertyInspector event is required for onSendToPropertyInspector.' 28 | ); 29 | } 30 | 31 | this.on(`${actionUUID}.${Events.sendToPropertyInspector}`, (jsn) => fn(jsn)); 32 | return this; 33 | } 34 | 35 | /** 36 | * Send payload from the property inspector to the plugin 37 | * @param {object} payload 38 | */ 39 | sendToPlugin(payload) { 40 | this.send(this.uuid, Events.sendToPlugin, { 41 | action: this?.actionInfo?.action, 42 | payload: payload || null, 43 | }); 44 | } 45 | 46 | /** 47 | * Save the actions's persistent data. 48 | * @param {object} payload 49 | */ 50 | setSettings(payload) { 51 | this.send(this.uuid, Events.setSettings, { 52 | action: this?.actionInfo?.action, 53 | payload: payload || null, 54 | }); 55 | } 56 | 57 | /** 58 | * Request the actions's persistent data. StreamDeck does not return the data, but trigger the actions's didReceiveSettings event 59 | */ 60 | getSettings() { 61 | this.send(this.uuid, Events.getSettings); 62 | } 63 | } 64 | 65 | const $PI = new ELGSDPropertyInspector(); 66 | 67 | /** 68 | * connectElgatoStreamDeckSocket 69 | * This is the first function StreamDeck Software calls, when 70 | * establishing the connection to the plugin or the Property Inspector 71 | * @param {string} port - The socket's port to communicate with StreamDeck software. 72 | * @param {string} uuid - A unique identifier, which StreamDeck uses to communicate with the plugin 73 | * @param {string} messageType - Identifies, if the event is meant for the property inspector or the plugin. 74 | * @param {string} appInfoString - Information about the host (StreamDeck) application 75 | * @param {string} actionInfo - Context is an internal identifier used to communicate to the host application. 76 | */ 77 | function connectElgatoStreamDeckSocket(port, uuid, messageType, appInfoString, actionInfo) { 78 | const delay = window?.initialConnectionDelay || 0; 79 | setTimeout(() => { 80 | $PI.connect(port, uuid, messageType, appInfoString, actionInfo); 81 | }, delay); 82 | } 83 | -------------------------------------------------------------------------------- /js/prototypes.js: -------------------------------------------------------------------------------- 1 | /** reaches out for a magical global localization object, hopefully loaded by $SD and swaps the string **/ 2 | String.prototype.lox = function () { 3 | var a = String(this); 4 | try { 5 | a = $localizedStrings[a] || a; 6 | } catch (b) { 7 | } 8 | return a; 9 | }; 10 | 11 | String.prototype.sprintf = function (inArr) { 12 | let i = 0; 13 | const args = inArr && Array.isArray(inArr) ? inArr : arguments; 14 | return this.replace(/%s/g, function () { 15 | return args[i++]; 16 | }); 17 | }; 18 | 19 | WebSocket.prototype.sendJSON = function (jsn, log) { 20 | if (log) { 21 | console.log('SendJSON', this, jsn); 22 | } 23 | // if (this.readyState) { 24 | this.send(JSON.stringify(jsn)); 25 | // } 26 | }; 27 | -------------------------------------------------------------------------------- /js/stream-deck.js: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | var $localizedStrings = $localizedStrings || {}; 5 | 6 | /** 7 | * @class StreamDeck 8 | * StreamDeck object containing all required code to establish 9 | * communication with SD-Software and the Property Inspector 10 | */ 11 | class ELGSDStreamDeck extends ELGSDApi { 12 | constructor() { 13 | super(); 14 | if (ELGSDStreamDeck.__instance) { 15 | return ELGSDStreamDeck.__instance; 16 | } 17 | 18 | ELGSDStreamDeck.__instance = this; 19 | } 20 | 21 | /** 22 | * Display alert triangle on actions key 23 | * @param {string} context 24 | */ 25 | showAlert(context) { 26 | if (!context) { 27 | console.error('A context is required to showAlert on the key.'); 28 | } 29 | 30 | this.send(context, Events.showAlert); 31 | } 32 | 33 | /** 34 | * Display ok check mark on actions key 35 | * @param {string} context 36 | */ 37 | showOk(context) { 38 | if (!context) { 39 | console.error('A context is required to showOk on the key.'); 40 | } 41 | 42 | this.send(context, Events.showOk); 43 | } 44 | 45 | /** 46 | * Save the actions's persistent data. 47 | * @param context 48 | * @param {object} payload 49 | */ 50 | setSettings(context, payload) { 51 | this.send(context, Events.setSettings, { 52 | action: this?.actionInfo?.action, 53 | payload: payload || null, 54 | targetContext: context, 55 | }); 56 | } 57 | 58 | /** 59 | * Request the actions's persistent data. StreamDeck does not return the data, but trigger the actions's didReceiveSettings event 60 | * @param {string} [context] 61 | */ 62 | getSettings(context) { 63 | this.send(context, Events.getSettings); 64 | } 65 | 66 | /** 67 | * Set the state of the actions 68 | * @param {string} context 69 | * @param {number} [state] 70 | */ 71 | setState(context, state) { 72 | if (!context) { 73 | console.error('A context is required when using setState.'); 74 | } 75 | 76 | this.send(context, Events.setState, { 77 | payload: { 78 | state: Number(state), 79 | }, 80 | }); 81 | } 82 | 83 | /** 84 | * Set the title of the action's key 85 | * @param {string} context 86 | * @param {string} title 87 | * @param [target] 88 | */ 89 | setTitle(context, title = '', target = Constants.hardwareAndSoftware) { 90 | if (!context) { 91 | console.error('A key context is required for setTitle.'); 92 | } 93 | 94 | this.send(context, Events.setTitle, { 95 | payload: { 96 | title: title ? `${title}` : '', 97 | target, 98 | }, 99 | }); 100 | } 101 | 102 | /** 103 | * 104 | * @param {string} context 105 | * @param {number} [target] 106 | */ 107 | clearTitle(context, target) { 108 | if (!context) { 109 | console.error('A key context is required to clearTitle.'); 110 | } 111 | 112 | this.setTitle(context, null, target); 113 | } 114 | 115 | /** 116 | * Send payload to property inspector 117 | * @param {string} context 118 | * @param {object} payload 119 | * @param {string} [action] 120 | */ 121 | sendToPropertyInspector(context, payload = null, action = null) { 122 | if (typeof context != 'string') { 123 | console.error('A key context is required to sendToPropertyInspector.'); 124 | } 125 | 126 | this.send(context, Events.sendToPropertyInspector, { 127 | action, 128 | payload, 129 | }); 130 | } 131 | 132 | /** 133 | * Set the actions key image 134 | * @param {string} context 135 | * @param {string} [image] 136 | * @param {number} [state] 137 | * @param {number} [target] 138 | */ 139 | setImage(context, image, state, target = Constants.hardwareAndSoftware) { 140 | if (!context) { 141 | console.error('A key context is required for setImage.'); 142 | } 143 | 144 | this.send(context, Events.setImage, { 145 | payload: { 146 | image, 147 | target, 148 | state, 149 | }, 150 | }); 151 | } 152 | 153 | /** 154 | * Set the properties of the layout on the Stream Deck + touch display 155 | * @param {*} context 156 | * @param {*} payload 157 | */ 158 | setFeedback(context, payload) { 159 | if (!context) { 160 | console.error('A context is required for setFeedback.'); 161 | } 162 | 163 | this.send(context, Events.setFeedback, { 164 | payload, 165 | }); 166 | } 167 | 168 | /** 169 | * Set the active layout by ID or path for the Stream Deck + touch display 170 | * @param {*} context 171 | * @param {*} layout 172 | */ 173 | setFeedbackLayout(context, layout) { 174 | if (!context) { 175 | console.error('A context is required for setFeedbackLayout.'); 176 | } 177 | 178 | this.send(context, Events.setFeedbackLayout, { 179 | payload: { layout }, 180 | }); 181 | } 182 | 183 | /** 184 | * Registers a callback function for the deviceDidConnect event, which fires when a device is plugged in 185 | * @param {function} fn 186 | * @returns ELGSDStreamDeck 187 | */ 188 | onDeviceDidConnect(fn) { 189 | if (!fn) { 190 | console.error( 191 | 'A callback function for the deviceDidConnect event is required for onDeviceDidConnect.' 192 | ); 193 | } 194 | 195 | this.on(Events.deviceDidConnect, (jsn) => fn(jsn)); 196 | return this; 197 | } 198 | 199 | /** 200 | * Registers a callback function for the deviceDidDisconnect event, which fires when a device is unplugged 201 | * @param {function} fn 202 | * @returns ELGSDStreamDeck 203 | */ 204 | onDeviceDidDisconnect(fn) { 205 | if (!fn) { 206 | console.error( 207 | 'A callback function for the deviceDidDisconnect event is required for onDeviceDidDisconnect.' 208 | ); 209 | } 210 | 211 | this.on(Events.deviceDidDisconnect, (jsn) => fn(jsn)); 212 | return this; 213 | } 214 | 215 | /** 216 | * Registers a callback function for the applicationDidLaunch event, which fires when the application starts 217 | * @param {function} fn 218 | * @returns ELGSDStreamDeck 219 | */ 220 | onApplicationDidLaunch(fn) { 221 | if (!fn) { 222 | console.error( 223 | 'A callback function for the applicationDidLaunch event is required for onApplicationDidLaunch.' 224 | ); 225 | } 226 | 227 | this.on(Events.applicationDidLaunch, (jsn) => fn(jsn)); 228 | return this; 229 | } 230 | 231 | /** 232 | * Registers a callback function for the applicationDidTerminate event, which fires when the application exits 233 | * @param {function} fn 234 | * @returns ELGSDStreamDeck 235 | */ 236 | onApplicationDidTerminate(fn) { 237 | if (!fn) { 238 | console.error( 239 | 'A callback function for the applicationDidTerminate event is required for onApplicationDidTerminate.' 240 | ); 241 | } 242 | 243 | this.on(Events.applicationDidTerminate, (jsn) => fn(jsn)); 244 | return this; 245 | } 246 | 247 | /** 248 | * Registers a callback function for the systemDidWakeUp event, which fires when the computer wakes 249 | * @param {function} fn 250 | * @returns ELGSDStreamDeck 251 | */ 252 | onSystemDidWakeUp(fn) { 253 | if (!fn) { 254 | console.error( 255 | 'A callback function for the systemDidWakeUp event is required for onSystemDidWakeUp.' 256 | ); 257 | } 258 | 259 | this.on(Events.systemDidWakeUp, (jsn) => fn(jsn)); 260 | return this; 261 | } 262 | 263 | /** 264 | * Switches to a readonly profile or returns to previous profile 265 | * @param {string} device 266 | * @param {string} [profile] 267 | */ 268 | switchToProfile(device, profile) { 269 | if (!device) { 270 | console.error('A device id is required for switchToProfile.'); 271 | } 272 | 273 | this.send(this.uuid, Events.switchToProfile, { device, payload: { profile } }); 274 | } 275 | } 276 | 277 | const $SD = new ELGSDStreamDeck(); 278 | 279 | /** 280 | * connectElgatoStreamDeckSocket 281 | * This is the first function StreamDeck Software calls, when 282 | * establishing the connection to the plugin or the Property Inspector 283 | * @param {string} port - The socket's port to communicate with StreamDeck software. 284 | * @param {string} uuid - A unique identifier, which StreamDeck uses to communicate with the plugin 285 | * @param {string} messageType - Identifies, if the event is meant for the property inspector or the plugin. 286 | * @param {string} appInfoString - Information about the host (StreamDeck) application 287 | * @param {string} actionInfo - Context is an internal identifier used to communicate to the host application. 288 | */ 289 | function connectElgatoStreamDeckSocket(port, uuid, messageType, appInfoString, actionInfo) { 290 | const delay = window?.initialConnectionDelay || 0; 291 | 292 | setTimeout(() => { 293 | $SD.connect(port, uuid, messageType, appInfoString, actionInfo); 294 | }, delay); 295 | } 296 | -------------------------------------------------------------------------------- /js/timers.js: -------------------------------------------------------------------------------- 1 | /* global ESDTimerWorker */ 2 | /*eslint no-unused-vars: "off"*/ 3 | /*eslint-env es6*/ 4 | 5 | let ESDTimerWorker = new Worker(URL.createObjectURL( 6 | new Blob([timerFn.toString().replace(/^[^{]*{\s*/, '').replace(/\s*}[^}]*$/, '')], {type: 'text/javascript'}) 7 | )); 8 | ESDTimerWorker.timerId = 1; 9 | ESDTimerWorker.timers = {}; 10 | const ESDDefaultTimeouts = { 11 | timeout: 0, 12 | interval: 10 13 | }; 14 | 15 | Object.freeze(ESDDefaultTimeouts); 16 | 17 | function _setTimer(callback, delay, type, params) { 18 | const id = ESDTimerWorker.timerId++; 19 | ESDTimerWorker.timers[id] = {callback, params}; 20 | ESDTimerWorker.onmessage = (e) => { 21 | if (ESDTimerWorker.timers[e.data.id]) { 22 | if (e.data.type === 'clearTimer') { 23 | delete ESDTimerWorker.timers[e.data.id]; 24 | } else { 25 | const cb = ESDTimerWorker.timers[e.data.id].callback; 26 | if (cb && typeof cb === 'function') cb(...ESDTimerWorker.timers[e.data.id].params); 27 | } 28 | } 29 | }; 30 | ESDTimerWorker.postMessage({type, id, delay}); 31 | return id; 32 | } 33 | 34 | function _setTimeoutESD(...args) { 35 | let [callback, delay = 0, ...params] = [...args]; 36 | return _setTimer(callback, delay, 'setTimeout', params); 37 | } 38 | 39 | function _setIntervalESD(...args) { 40 | let [callback, delay = 0, ...params] = [...args]; 41 | return _setTimer(callback, delay, 'setInterval', params); 42 | } 43 | 44 | function _clearTimeoutESD(id) { 45 | ESDTimerWorker.postMessage({type: 'clearTimeout', id}); // ESDTimerWorker.postMessage({type: 'clearInterval', id}); = same thing 46 | delete ESDTimerWorker.timers[id]; 47 | } 48 | 49 | window.setTimeout = _setTimeoutESD; 50 | window.setInterval = _setIntervalESD; 51 | window.clearTimeout = _clearTimeoutESD; //timeout and interval share the same timer-pool 52 | window.clearInterval = _clearTimeoutESD; 53 | 54 | /** This is our worker-code 55 | * It is executed in it's own (global) scope 56 | * which is wrapped above @ `let ESDTimerWorker` 57 | */ 58 | 59 | function timerFn() { 60 | /*eslint indent: ["error", 4, { "SwitchCase": 1 }]*/ 61 | 62 | let timers = {}; 63 | let debug = false; 64 | let supportedCommands = ['setTimeout', 'setInterval', 'clearTimeout', 'clearInterval']; 65 | 66 | function log(e) { 67 | console.log('Worker-Info::Timers', timers); 68 | } 69 | 70 | function clearTimerAndRemove(id) { 71 | if (timers[id]) { 72 | if (debug) console.log('clearTimerAndRemove', id, timers[id], timers); 73 | clearTimeout(timers[id]); 74 | delete timers[id]; 75 | postMessage({type: 'clearTimer', id: id}); 76 | if (debug) log(); 77 | } 78 | } 79 | 80 | onmessage = function (e) { 81 | // first see, if we have a timer with this id and remove it 82 | // this automatically fulfils clearTimeout and clearInterval 83 | supportedCommands.includes(e.data.type) && timers[e.data.id] && clearTimerAndRemove(e.data.id); 84 | if (e.data.type === 'setTimeout') { 85 | timers[e.data.id] = setTimeout(() => { 86 | postMessage({id: e.data.id}); 87 | clearTimerAndRemove(e.data.id); //cleaning up 88 | }, Math.max(e.data.delay || 0)); 89 | } else if (e.data.type === 'setInterval') { 90 | timers[e.data.id] = setInterval(() => { 91 | postMessage({id: e.data.id}); 92 | }, Math.max(e.data.delay || ESDDefaultTimeouts.interval)); 93 | } 94 | }; 95 | } 96 | -------------------------------------------------------------------------------- /js/utils.js: -------------------------------------------------------------------------------- 1 | class Utils { 2 | /** 3 | * Returns the value from a form using the form controls name property 4 | * @param {Element | string} form 5 | * @returns 6 | */ 7 | static getFormValue(form) { 8 | if (typeof form === 'string') { 9 | form = document.querySelector(form); 10 | } 11 | 12 | const elements = form?.elements; 13 | 14 | if (!elements) { 15 | console.error('Could not find form!'); 16 | } 17 | 18 | const formData = new FormData(form); 19 | let formValue = {}; 20 | 21 | formData.forEach((value, key) => { 22 | if (!Reflect.has(formValue, key)) { 23 | formValue[key] = value; 24 | return; 25 | } 26 | if (!Array.isArray(formValue[key])) { 27 | formValue[key] = [formValue[key]]; 28 | } 29 | formValue[key].push(value); 30 | }); 31 | 32 | return formValue; 33 | } 34 | 35 | /** 36 | * Sets the value of form controls using their name attribute and the jsn object key 37 | * @param {*} jsn 38 | * @param {Element | string} form 39 | */ 40 | static setFormValue(jsn, form) { 41 | if (!jsn) { 42 | return; 43 | } 44 | 45 | if (typeof form === 'string') { 46 | form = document.querySelector(form); 47 | } 48 | 49 | const elements = form?.elements; 50 | 51 | if (!elements) { 52 | console.error('Could not find form!'); 53 | } 54 | 55 | Array.from(elements) 56 | .filter((element) => element?.name) 57 | .forEach((element) => { 58 | const { name, type } = element; 59 | const value = name in jsn ? jsn[name] : null; 60 | const isCheckOrRadio = type === 'checkbox' || type === 'radio'; 61 | 62 | if (value === null) return; 63 | 64 | if (isCheckOrRadio) { 65 | const isSingle = value === element.value; 66 | if (isSingle || (Array.isArray(value) && value.includes(element.value))) { 67 | element.checked = true; 68 | } 69 | } else { 70 | element.value = value ?? ''; 71 | } 72 | }); 73 | } 74 | 75 | /** 76 | * This provides a slight delay before processing rapid events 77 | * @param {number} wait - delay before processing function (recommended time 150ms) 78 | * @param {function} fn 79 | * @returns 80 | */ 81 | static debounce(wait, fn) { 82 | let timeoutId = null; 83 | return (...args) => { 84 | window.clearTimeout(timeoutId); 85 | timeoutId = window.setTimeout(() => { 86 | fn.apply(null, args); 87 | }, wait); 88 | }; 89 | } 90 | 91 | static delay(wait) { 92 | return new Promise((fn) => setTimeout(fn, wait)); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "streamdeck-sdk", 3 | "version": "1.0.0", 4 | "description": "An API for connecting to Stream Deck WebSockets.", 5 | "repository": { 6 | "type": "git", 7 | "url": "git+https://github.com/elgatosf/streamdeck-javascript-sdk.git" 8 | }, 9 | "author": "Elgato", 10 | "bugs": { 11 | "url": "https://github.com/elgatosf/streamdeck-javascript-sdk/issues" 12 | }, 13 | "homepage": "https://github.com/elgatosf/streamdeck-javascript-sdk#readme" 14 | } 15 | --------------------------------------------------------------------------------