| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635 |
- export class Style {
- static init() {
- if ( document.getElementById( 'profiler-styles' ) ) return;
- const css = `
- :root {
- --profiler-bg: #1e1e24;
- --profiler-header: #2a2a33;
- --profiler-border: #4a4a5a;
- --text-primary: #e0e0e0;
- --text-secondary: #9a9aab;
- --accent-color: #00aaff;
- --color-green: #4caf50;
- --color-yellow: #ffc107;
- --color-red: #f44336;
- --font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
- --font-mono: 'Fira Code', 'Courier New', Courier, monospace;
- }
- @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600&family=Fira+Code&display=swap');
- #profiler-panel * {
- text-transform: initial;
- line-height: normal;
- }
- #profiler-toggle {
- position: fixed;
- top: 15px;
- right: 15px;
- background-color: rgba(30, 30, 36, 0.85);
- border: 1px solid #4a4a5a54;
- border-radius: 6px 12px 12px 6px;
- color: var(--text-primary);
- cursor: pointer;
- z-index: 1001;
- transition: all 0.2s ease-in-out;
- font-size: 14px;
- backdrop-filter: blur(8px);
- box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
- display: flex;
- align-items: stretch;
- padding: 0;
- overflow: hidden;
- font-family: var(--font-family);
- }
- #profiler-toggle:hover {
- border-color: var(--accent-color);
- }
- #profiler-toggle.hidden {
- opacity: 0;
- pointer-events: none;
- }
- #toggle-icon {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 40px;
- font-size: 20px;
- transition: background-color 0.2s;
- }
- #profiler-toggle:hover #toggle-icon {
- background-color: rgba(255, 255, 255, 0.05);
- }
- .toggle-separator {
- width: 1px;
- background-color: var(--profiler-border);
- }
- #toggle-text {
- display: flex;
- align-items: baseline;
- padding: 8px 14px;
- min-width: 80px;
- justify-content: right;
- }
- #toggle-text .fps-label {
- font-size: 0.7em;
- margin-left: 10px;
- color: #999;
- }
- #profiler-panel {
- position: fixed;
- z-index: 1001 !important;
- bottom: 0;
- left: 0;
- right: 0;
- height: 350px;
- background-color: var(--profiler-bg);
- border-top: 2px solid var(--profiler-border);
- color: var(--text-primary);
- display: flex;
- flex-direction: column;
- z-index: 1000;
- /*box-shadow: 0 -5px 25px rgba(0, 0, 0, 0.5);*/
- transform: translateY(100%);
- transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94), height 0.3s ease-out;
- font-family: var(--font-mono);
- }
- #profiler-panel.resizing {
- transition: none;
- }
- #profiler-panel.visible {
- transform: translateY(0);
- }
- #profiler-panel.maximized {
- height: 100vh;
- }
- .panel-resizer {
- position: absolute;
- top: -2px;
- left: 0;
- width: 100%;
- height: 5px;
- cursor: ns-resize;
- z-index: 1001;
- }
- .profiler-header {
- display: flex;
- background-color: var(--profiler-header);
- border-bottom: 1px solid var(--profiler-border);
- flex-shrink: 0;
- justify-content: space-between;
- align-items: stretch;
- }
- .profiler-tabs {
- display: flex;
- }
- .tab-btn {
- background: transparent;
- border: none;
- /*border-right: 1px solid var(--profiler-border);*/
- color: var(--text-secondary);
- padding: 8px 18px;
- cursor: pointer;
- display: flex;
- align-items: center;
- font-family: var(--font-family);
- font-weight: 600;
- font-size: 14px;
- }
- .tab-btn.active {
- border-bottom: 2px solid var(--accent-color);
- color: white;
- }
- #maximize-btn,
- #hide-panel-btn {
- background: transparent;
- border: none;
- border-left: 1px solid var(--profiler-border);
- color: var(--text-secondary);
- width: 45px;
- cursor: pointer;
- transition: all 0.2s;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- #maximize-btn:hover,
- #hide-panel-btn:hover {
- background-color: rgba(255, 255, 255, 0.1);
- color: var(--text-primary);
- }
- .profiler-content-wrapper {
- flex-grow: 1;
- overflow: hidden;
- position: relative;
- }
- .profiler-content {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- overflow-y: auto;
- font-size: 13px;
- visibility: hidden;
- opacity: 0;
- transition: opacity 0.2s, visibility 0.2s;
- box-sizing: border-box;
- display: flex;
- flex-direction: column;
- }
- .profiler-content.active {
- visibility: visible;
- opacity: 1;
- }
- .profiler-content {
- overflow: auto; /* make sure scrollbars can appear */
- }
- .profiler-content::-webkit-scrollbar {
- width: 8px;
- height: 8px;
- }
- .profiler-content::-webkit-scrollbar-track {
- background: transparent;
- }
- .profiler-content::-webkit-scrollbar-thumb {
- background-color: rgba(0, 0, 0, 0.25);
- border-radius: 10px;
- transition: background 0.3s ease;
- }
- .profiler-content::-webkit-scrollbar-thumb:hover {
- background-color: rgba(0, 0, 0, 0.4);
- }
- .profiler-content::-webkit-scrollbar-corner {
- background: transparent;
- }
- .profiler-content {
- scrollbar-width: thin; /* "auto" | "thin" */
- scrollbar-color: rgba(0, 0, 0, 0.25) transparent;
- }
- .list-item-row {
- display: grid;
- align-items: center;
- padding: 4px 8px;
- border-radius: 3px;
- transition: background-color 0.2s;
- gap: 10px;
- border-bottom: none;
- }
- .list-item-wrapper {
- margin-top: 2px;
- margin-bottom: 2px;
- }
- .list-item-wrapper:first-child {
- /*margin-top: 0;*/
- }
- .list-item-wrapper:not(.header-wrapper):nth-child(odd) > .list-item-row {
- background-color: rgba(0,0,0,0.1);
- }
- .list-item-wrapper.header-wrapper>.list-item-row {
- color: var(--accent-color);
- background-color: rgba(0, 170, 255, 0.1);
- }
- .list-item-wrapper.header-wrapper>.list-item-row>.list-item-cell:first-child {
- font-weight: 600;
- }
- .list-item-row.collapsible,
- .list-item-row.actionable {
- cursor: pointer;
- }
- .list-item-row.collapsible {
- background-color: rgba(0, 170, 255, 0.15) !important;
- }
- .list-item-row.collapsible.alert,
- .list-item-row.alert {
- background-color: rgba(244, 67, 54, 0.1) !important;
- }
- @media (hover: hover) {
- .list-item-row:hover:not(.collapsible):not(.no-hover),
- .list-item-row:hover:not(.no-hover),
- .list-item-row.actionable:hover,
- .list-item-row.collapsible.actionable:hover {
- background-color: rgba(255, 255, 255, 0.05) !important;
- }
- .list-item-row.collapsible:hover {
- background-color: rgba(0, 170, 255, 0.25) !important;
- }
- }
- .list-item-cell {
- white-space: pre;
- display: flex;
- align-items: center;
- }
- .list-item-cell:not(:first-child) {
- justify-content: flex-end;
- font-weight: 600;
- }
- .list-header {
- display: grid;
- align-items: center;
- padding: 4px 8px;
- font-weight: 600;
- color: var(--text-secondary);
- padding-bottom: 6px;
- border-bottom: 1px solid var(--profiler-border);
- margin-bottom: 5px;
- gap: 10px;
- }
- .list-item-wrapper.section-start {
- margin-top: 5px;
- margin-bottom: 5px;
- }
- .list-header .list-header-cell:not(:first-child) {
- text-align: right;
- }
- .list-children-container {
- padding-left: 1.5em;
- overflow: hidden;
- max-height: 1000px;
- transition: max-height 0.1s ease-out;
- margin-top: 2px;
- }
- .list-children-container.closed {
- max-height: 0;
- }
- .item-toggler {
- display: inline-block;
- margin-right: 0.8em;
- text-align: left;
- }
- .list-item-row.open .item-toggler::before {
- content: '-';
- }
- .list-item-row:not(.open) .item-toggler::before {
- content: '+';
- }
- .list-item-cell .value.good {
- color: var(--color-green);
- }
- .list-item-cell .value.warn {
- color: var(--color-yellow);
- }
- .list-item-cell .value.bad {
- color: var(--color-red);
- }
- .list-scroll-wrapper {
- overflow-x: auto;
- width: 100%;
- }
- .list-container.parameters .list-item-row:not(.collapsible) {
- height: 31px;
- }
- .graph-container {
- width: 100%;
- box-sizing: border-box;
- padding: 8px 0;
- position: relative;
- }
- .graph-svg {
- width: 100%;
- height: 80px;
- background-color: #2a2a33;
- border: 1px solid var(--profiler-border);
- border-radius: 4px;
- }
- .graph-path {
- stroke-width: 2;
- fill-opacity: 0.4;
- }
- .console-header {
- padding: 10px;
- border-bottom: 1px solid var(--profiler-border);
- display: flex;
- gap: 20px;
- flex-shrink: 0;
- align-items: center;
- justify-content: space-between;
- }
- .console-filters-group {
- display: flex;
- gap: 20px;
- }
- .console-filter-input {
- background-color: var(--profiler-bg);
- border: 1px solid var(--profiler-border);
- color: var(--text-primary);
- border-radius: 4px;
- padding: 4px 8px;
- font-family: var(--font-mono);
- flex-grow: 1;
- max-width: 300px;
- border-radius: 15px;
- }
- #console-log {
- display: flex;
- flex-direction: column;
- gap: 4px;
- padding: 10px;
- overflow-y: auto;
- flex-grow: 1;
- }
- .log-message {
- padding: 2px 5px;
- white-space: pre-wrap;
- word-break: break-all;
- border-radius: 3px;
- line-height: 1.5 !important;
- }
- .log-message.hidden {
- display: none;
- }
- .log-message.info {
- color: var(--text-primary);
- }
- .log-message.warn {
- color: var(--color-yellow);
- }
- .log-message.error {
- color: #f9dedc;
- background-color: rgba(244, 67, 54, 0.1);
- }
- .log-prefix {
- color: var(--text-secondary);
- margin-right: 8px;
- }
- .log-code {
- background-color: rgba(255, 255, 255, 0.1);
- border-radius: 3px;
- padding: 1px 4px;
- }
- .thumbnail-container {
- display: flex;
- align-items: center;
- }
- .thumbnail-svg {
- width: 40px;
- height: 22.5px;
- flex-shrink: 0;
- margin-right: 8px;
- }
- .param-control {
- display: flex;
- align-items: center;
- justify-content: flex-end;
- gap: 10px;
- width: 100%;
- }
- .param-control input,
- .param-control select,
- .param-control button {
- background-color: var(--profiler-bg);
- border: 1px solid var(--profiler-border);
- color: var(--text-primary);
- border-radius: 4px;
- padding: 4px 6px;
- padding-bottom: 2px;
- font-family: var(--font-mono);
- width: 100%;
- box-sizing: border-box;
- }
- .param-control select {
- padding-top: 3px;
- padding-bottom: 1px;
- }
- .param-control input[type="number"] {
- cursor: ns-resize;
- }
- .param-control input[type="color"] {
- padding: 2px;
- }
- .param-control button {
- cursor: pointer;
- transition: background-color 0.2s;
- }
- .param-control button:hover {
- background-color: var(--profiler-header);
- }
- .param-control-vector {
- display: flex;
- gap: 5px;
- }
- .custom-checkbox {
- display: inline-flex;
- align-items: center;
- cursor: pointer;
- gap: 8px;
- }
- .custom-checkbox input {
- display: none;
- }
- .custom-checkbox .checkmark {
- width: 14px;
- height: 14px;
- border: 1px solid var(--profiler-border);
- border-radius: 3px;
- display: inline-flex;
- justify-content: center;
- align-items: center;
- transition: background-color 0.2s, border-color 0.2s;
- }
- .custom-checkbox .checkmark::after {
- content: '';
- width: 8px;
- height: 8px;
- background-color: var(--accent-color);
- border-radius: 1px;
- display: block;
- transform: scale(0);
- transition: transform 0.2s;
- }
- .custom-checkbox input:checked+.checkmark {
- border-color: var(--accent-color);
- }
- .custom-checkbox input:checked+.checkmark::after {
- transform: scale(1);
- }
- .param-control input[type="range"] {
- -webkit-appearance: none;
- appearance: none;
- width: 100%;
- height: 16px;
- background: var(--profiler-header);
- border-radius: 5px;
- border: 1px solid var(--profiler-border);
- outline: none;
- padding: 0px;
- padding-top: 8px;
- }
- .param-control input[type="range"]::-webkit-slider-thumb {
- -webkit-appearance: none;
- appearance: none;
- width: 18px;
- height: 18px;
- background: var(--profiler-bg);
- border: 1px solid var(--accent-color);
- border-radius: 3px;
- cursor: pointer;
- margin-top: -8px;
- }
- .param-control input[type="range"]::-moz-range-thumb {
- width: 18px;
- height: 18px;
- background: var(--profiler-bg);
- border: 2px solid var(--accent-color);
- border-radius: 3px;
- cursor: pointer;
- }
- .param-control input[type="range"]::-moz-range-track {
- width: 100%;
- height: 16px;
- background: var(--profiler-header);
- border-radius: 5px;
- border: 1px solid var(--profiler-border);
- }
- @media screen and (max-width: 768px) and (orientation: portrait) {
- .console-filter-input {
- max-width: 100px;
- }
- }
- `;
- const styleElement = document.createElement( 'style' );
- styleElement.id = 'profiler-styles';
- styleElement.textContent = css;
- document.head.appendChild( styleElement );
- }
- }
|