diff options
Diffstat (limited to 'static')
| -rw-r--r-- | static/app.js | 22 | ||||
| -rw-r--r-- | static/deck.css | 4 | ||||
| -rw-r--r-- | static/logos/obs.svg | 1 |
3 files changed, 21 insertions, 6 deletions
diff --git a/static/app.js b/static/app.js index a15c2de..c91876b 100644 --- a/static/app.js +++ b/static/app.js @@ -26,9 +26,11 @@ const refreshers = []; const TAB_KEY = "deckit.tab"; const tabs = {}; -// Tab icons, Font Awesome glyphs in the Nerd Font the server serves; a tab -// not listed shows its name. The name also shows next to the active one. -const TAB_ICONS = { Dashboard: "\uf0e4", Windows: "\uf2d2", OBS: "\uf03d", Assistant: "\uf086", K1C: "\uf02f" }; +// Tab icons, glyphs in the Nerd Font the server serves, or a brand logo from +// static/logos; a tab with neither shows its name. The name also shows next +// to the active one. +const TAB_ICONS = { Dashboard: "\uf0e4", Windows: "\uf2d2", Assistant: "\uf086", K1C: "\u{f0e5b}" }; +const TAB_LOGOS = { OBS: "obs" }; function ensureTab(name) { if (tabs[name]) return tabs[name]; @@ -36,10 +38,10 @@ function ensureTab(name) { button.dataset.tab = name; button.setAttribute("aria-label", name); button.title = name; - button.innerHTML = `<i class="nf"></i><span></span>`; + button.innerHTML = TAB_LOGOS[name] ? `<i class="brand ${TAB_LOGOS[name]}"></i><span></span>` : `<i class="nf"></i><span></span>`; button.firstElementChild.textContent = TAB_ICONS[name] ?? ""; button.lastElementChild.textContent = name; - if (!TAB_ICONS[name]) button.classList.add("named"); + if (!TAB_ICONS[name] && !TAB_LOGOS[name]) button.classList.add("named"); button.onclick = () => showTab(name); tabBar.append(button); const section = document.createElement("section"); @@ -64,8 +66,18 @@ function sortTabs() { } } +// The new tab slides in from the side it sits on in the bar. +const slide = matchMedia("(prefers-reduced-motion: reduce)"); function showTab(name) { keep(); + const order = [...tabBar.children].map((b) => b.dataset.tab); + const from = order.findIndex((n) => !tabs[n]?.section.hidden); + const to = order.indexOf(name); + if (from !== -1 && from !== to && !slide.matches) { + const dx = to > from ? "40px" : "-40px"; + tabs[name].section.animate([{ transform: `translateX(${dx})`, opacity: 0 }, { transform: "none", opacity: 1 }], + { duration: 220, easing: "cubic-bezier(.2, .8, .2, 1)" }); + } for (const [n, tab] of Object.entries(tabs)) { tab.section.hidden = n !== name; tab.button.classList.toggle("active", n === name); diff --git a/static/deck.css b/static/deck.css index 35c6335..594bd80 100644 --- a/static/deck.css +++ b/static/deck.css @@ -77,8 +77,9 @@ body { .tabs button { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 18px; } .tabs button .nf { font-size: 1.5rem; line-height: 1; margin-right: 6px; } /* the glyphs draw past their advance */ .tabs button:not(.active):not(.named) span { display: none; } +.tabs button .brand { width: 1.5rem; height: 1.5rem; background: currentColor; } -#tab-body { flex: 1; min-height: 0; overflow: auto; touch-action: pan-y; } /* sideways moves stay ours: the swipe */ +#tab-body { flex: 1; min-height: 0; overflow: hidden auto; touch-action: pan-y; } /* sideways moves stay ours: the swipe */ .tab-panel { padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); @@ -275,6 +276,7 @@ select { mask-size: contain; } .brand.claude { -webkit-mask-image: url(/logos/claude.svg); mask-image: url(/logos/claude.svg); } +.brand.obs { -webkit-mask-image: url(/logos/obs.svg); mask-image: url(/logos/obs.svg); } .brand.opencode { -webkit-mask-image: url(/logos/opencode.svg); mask-image: url(/logos/opencode.svg); } .gbar { height: 6px; background: var(--udt-surface2); border-radius: 3px; overflow: hidden; } .gbar > i { display: block; height: 100%; background: var(--udt-accent); } diff --git a/static/logos/obs.svg b/static/logos/obs.svg new file mode 100644 index 0000000..9f4c85d --- /dev/null +++ b/static/logos/obs.svg @@ -0,0 +1 @@ +<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>OBS Studio</title><path d="M12,24C5.383,24,0,18.617,0,12S5.383,0,12,0s12,5.383,12,12S18.617,24,12,24z M12,1.109 C5.995,1.109,1.11,5.995,1.11,12C1.11,18.005,5.995,22.89,12,22.89S22.89,18.005,22.89,12C22.89,5.995,18.005,1.109,12,1.109z M6.182,5.99c0.352-1.698,1.503-3.229,3.05-3.996c-0.269,0.273-0.595,0.483-0.844,0.78c-1.02,1.1-1.48,2.692-1.199,4.156 c0.355,2.235,2.455,4.06,4.732,4.028c1.765,0.079,3.485-0.937,4.348-2.468c1.848,0.063,3.645,1.017,4.7,2.548 c0.54,0.799,0.962,1.736,0.991,2.711c-0.342-1.295-1.202-2.446-2.375-3.095c-1.135-0.639-2.529-0.802-3.772-0.425 c-1.56,0.448-2.849,1.723-3.293,3.293c-0.377,1.25-0.216,2.628,0.377,3.772c-0.825,1.429-2.315,2.449-3.932,2.756 c-1.244,0.261-2.551,0.059-3.709-0.464c1.036,0.302,2.161,0.355,3.191-0.011c1.381-0.457,2.522-1.567,3.024-2.935 c0.556-1.49,0.345-3.261-0.591-4.54c-0.7-1.007-1.803-1.717-3.002-1.969c-0.38-0.068-0.764-0.098-1.148-0.134 c-0.611-1.231-0.834-2.66-0.528-3.996L6.182,5.99z"/></svg>
\ No newline at end of file |
