/
githubmirror
/
tldraw
Обзор
Документация
Войти
/
githubmirror
/
tldraw
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
apps/examples/src/styles.css
848 строк
16 KB
Andromeda
feat: add clear search buttons to the dotcom and examples sidebars (#9565)
05 авг 2026, 11:01
Не верифицирован
05 авг 2026, 11:01
057c277
Код
Авторство
О чём код?
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap'); :root { --background: white; --text: hsl(0, 0%, 11%); --gray-light: #f5f5f5; --gray-dark: #e8e8e8; --black-transparent-lighter: rgba(0, 0, 0, 0.07); --black-transparent-light: rgba(0, 0, 0, 0.3); --black-transparent-dark: rgba(0, 0, 0, 0.5); --black-transparent-darker: rgba(0, 0, 0, 0.7); --focus: hsl(214, 84%, 56%); --whiteboard: hsl(210, 20%, 98%); --example-sidebar-width: 260px; --example-sidebar-bg: hsl(0, 0%, 99%); --example-sidebar-border: hsl(204, 16%, 94%); --example-sidebar-divider: hsl(0, 0%, 91%); --example-sidebar-text: hsl(0, 0%, 11%); --example-sidebar-text-muted: hsl(204, 4%, 45%); --example-sidebar-hover: hsl(0, 0%, 0%, 2%); --example-sidebar-active: hsl(0, 0%, 0%, 4.3%); --example-sidebar-primary: hsl(214, 84%, 56%); --example-content-bg: #ffffff; color-scheme: light; } html, body { padding: 0; margin: 0; font-family: 'Inter', sans-serif; min-height: 100vh; /* mobile viewport bug fix */ min-height: -webkit-fill-available; height: 100%; /* prevent two-finger swipe to go back */ overscroll-behavior: none; background-color: var(--background); color: var(--text); } @media screen and (max-width: 600px) { html, body { font-size: 14px; } } html, * { box-sizing: border-box; } /* NB: If we did position: fixed, Safari on iOS 18 and MacOS 15 would * have several rendering issues. This must stay position: absolute. */ .tldraw__editor { position: absolute; inset: 0px; overflow: hidden; overscroll-behavior: none; touch-action: none; } .example { position: absolute; inset: 0; display: flex; align-items: stretch; background: var(--example-content-bg); } .example__content { position: relative; height: 100%; width: 100%; min-width: 0; overflow: auto; } @media screen and (max-width: 700px) { .example { display: flex; } .example__sidebar { display: none; } .example__content { height: 100%; } } /* --------------------- Sidebar -------------------- */ .example__sidebar { width: var(--example-sidebar-width); min-width: var(--example-sidebar-width); display: flex; flex-direction: column; flex: 0 0 auto; padding: 0 0 4px 0; background: var(--example-sidebar-bg); border-right: 1px solid var(--example-sidebar-border); overflow: hidden; color: var(--example-sidebar-text); font-size: 12px; font-weight: 500; line-height: 1.3; max-height: 100vh; } .example__sidebar a { text-decoration: none; color: inherit; } /* Header */ .example__sidebar__top { flex: 0 0 auto; } .example__sidebar__header { display: flex; height: 44px; align-items: center; padding: 0px 8px 3px 4px; gap: 12px; } .example__sidebar__header__logo { all: unset; cursor: pointer; flex: none; display: flex; align-items: center; justify-content: flex-start; overflow: hidden; height: 40px; flex-grow: 2; padding-right: 6px; padding-left: 12px; padding-bottom: 1px; } .examples__tldraw__logo { flex-shrink: 0; display: block; width: auto; height: 19px; object-fit: contain; object-position: left center; pointer-events: none; user-select: none; } .example__sidebar__header-title { display: none; } .example__sidebar__section { display: flex; flex-direction: column; flex: 0 0 auto; justify-content: center; padding: 6px 12px; } .example__sidebar__divider { height: 8px; margin: 0 12px; display: flex; align-items: center; flex: 0 0 auto; } .example__sidebar__divider::after { content: ''; width: 100%; height: 1px; background-color: var(--example-sidebar-divider); } .example__sidebar__search { position: relative; display: flex; align-items: center; gap: 6px; height: 36px; width: 100%; padding: 0 4px 0 8px; color: var(--example-sidebar-text); } .example__sidebar__search::before { content: ''; position: absolute; inset: 2px 0; border-radius: 4px; border: 1px solid transparent; pointer-events: none; } .example__sidebar__search:focus-within { outline: none; } .example__sidebar__search:focus-within::before { border-color: var(--example-sidebar-primary); } .example__sidebar__search > svg { position: relative; z-index: 1; flex: 0 0 auto; width: 15px; height: 15px; color: var(--example-sidebar-text); } .example__sidebar__filter { all: unset; flex: 1 1 auto; min-width: 0; height: 100%; color: var(--example-sidebar-text); font-size: 12px; font-weight: 500; line-height: 1.3; position: relative; z-index: 1; } .example__sidebar__filter::placeholder { color: var(--example-sidebar-text); opacity: 1; } /* Mirrors the dotcom sidebar's .sidebarSearchClear: pulled in only as far as the row's edge so the button and its focus ring stay inside the search box border instead of escaping it on the right. */ .example__sidebar__search__clear { padding: 0; background: none; border: none; position: relative; outline: none; margin-inline-end: -6px; width: 36px; height: 36px; min-width: 0; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; z-index: 3; cursor: pointer; color: var(--example-sidebar-text); } .example__sidebar__search__clear > svg { width: 12px; height: 12px; } .example__sidebar__search__clear:focus-visible { border-radius: 8px; outline: 2px solid var(--example-sidebar-primary); outline-offset: -4px; } .example__sidebar__action-row, .example__sidebar__footer-link { position: relative; display: flex; flex-direction: row; align-items: center; gap: 6px; height: 36px; flex: 0 0 auto; background: none; border: none; cursor: pointer; color: var(--example-sidebar-text); padding: 0 8px; text-align: left; text-decoration: none; border-radius: 0; white-space: nowrap; /* Buttons don't inherit the page font like anchors do; this is the equivalent of the tla-text_ui__regular class on the dotcom buttons. */ font: inherit; } .example__sidebar__action-row > svg, .example__sidebar__footer-link > svg { flex: 0 0 auto; color: var(--example-sidebar-text); } .example__sidebar__action-row > span, .example__sidebar__footer-link > span { position: relative; z-index: 1; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; } .example__sidebar__action-row:focus-visible, .example__sidebar__footer-link:focus-visible, .examples__sidebar__item__link:focus-visible, .example__sidebar__item__button:focus-visible, .example__sidebar__header__logo:focus-visible { outline: 2px solid var(--example-sidebar-primary); outline-offset: -2px; } /* Categories */ ul.example__sidebar__categories { list-style: none; padding: 0 12px 40px 12px; margin: 0; overflow-y: scroll; overflow-x: visible; flex: 1 1 auto; min-height: 0; -ms-overflow-style: none; /* IE and Edge */ scrollbar-width: none; /* Firefox */ } ul.example__sidebar__categories::-webkit-scrollbar { display: none; } .example__sidebar__category__header { position: relative; width: 100%; height: 36px; display: flex; flex-direction: row; align-items: center; padding: 0 8px; margin: 0; color: var(--example-sidebar-text-muted); font-size: 12px; font-weight: 500; line-height: 1.3; } /* Category */ li.example__sidebar__category { display: none; position: relative; padding: 0; margin-top: 8px; margin-bottom: 28px; } .example__sidebar__category:has(> ul > li) { display: block; } ul.example__sidebar__category__items { list-style: none; padding: 0; margin: 0; } /* Mirrors the dotcom sidebar's .sidebarSearchEmpty. */ li.example__sidebar__search-empty { padding: 8px; color: var(--example-sidebar-text-muted); } /* The categories list's own padding already provides the 12px inset, so the "Clear search" section keeps only the vertical rhythm. */ ul.example__sidebar__categories .example__sidebar__section { padding-left: 0; padding-right: 0; } /* Halve the 28px category gap above "Clear search"; the full inter-category gap reads as too detached for a related control. */ .example__sidebar__category + .example__sidebar__section { margin-top: -14px; } li.examples__sidebar__item { position: relative; margin: 0; width: 100%; height: 36px; color: var(--example-sidebar-text); display: flex; flex-direction: row; align-items: center; padding: 0 4px 0 8px; } .examples__sidebar__item__content { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: row; align-items: center; justify-content: flex-start; position: relative; pointer-events: none; z-index: 2; } .examples__sidebar__item__title { position: relative; z-index: 1; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .examples__sidebar__item[data-active='true'] .examples__sidebar__item__title { font-weight: 600; } .examples__sidebar__item__title__match { font-weight: 700; color: var(--example-sidebar-text); } .examples__sidebar__item__link { font-weight: 500; margin: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; position: absolute; z-index: 2; top: 0; left: 3px; width: calc(100% - 6px); height: 100%; padding: 0; border-radius: 4px; cursor: pointer; pointer-events: all; } .examples__sidebar__item[data-active='true'] .examples__sidebar__item__link { width: calc(100% - 78px); } .examples__sidebar__item::after { content: ''; position: absolute; top: 2px; left: 0; right: 0; bottom: 2px; z-index: 1; border-radius: 4px; background-color: var(--example-sidebar-hover); visibility: hidden; pointer-events: none; } .examples__sidebar__item__details { width: 100%; margin: 8px 0 0 0; } .examples__sidebar__item[data-active='true']::after { background-color: var(--example-sidebar-active); visibility: visible; } @media (hover: hover) { .examples__sidebar__item[data-active='false']:hover::after { visibility: visible; } } /* -------------------- List Item ------------------- */ .example__sidebar__item__buttons { display: flex; flex-direction: row; height: 36px; margin-inline-end: -6px; color: var(--example-sidebar-text); position: relative; z-index: 3; flex-shrink: 0; } .example__sidebar__item__button { all: unset; cursor: pointer; position: relative; height: 100%; width: 36px; min-width: 0; z-index: 10; color: var(--example-sidebar-text-muted); display: flex; align-items: center; justify-content: center; } .example__sidebar__item__button:hover { z-index: 20; color: var(--example-sidebar-text); } /* ----------------- Header/Footer Buttons ----------------- */ .example__sidebar__footer-links { display: flex; flex-direction: column; position: relative; flex: 0 0 auto; padding: 6px 12px 0 12px; } .example__sidebar__footer-links::before { content: ''; position: absolute; top: 0; left: 12px; right: 12px; height: 1px; background: var(--example-sidebar-divider); } /* --------------------- Scroll --------------------- */ .scroll-light { scrollbar-width: thin; } .scroll-light::-webkit-scrollbar { display: block; width: 8px; height: 8px; position: absolute; top: 0; left: 0; background-color: inherit; } .scroll-light::-webkit-scrollbar-button { display: none; width: 0; height: 10px; } .scroll-light::-webkit-scrollbar-thumb { background-clip: padding-box; width: 0; min-height: 36px; border: 2px solid transparent; border-radius: 6px; background-color: var(--black-transparent-light); } .scroll-light::-webkit-scrollbar-thumb:hover { background-color: var(--black-transparent-light); } /* ---------------------- Hover --------------------- */ .hoverable::after { display: block; content: ''; position: absolute; top: 2px; left: 0; right: 0; bottom: 2px; visibility: hidden; z-index: 0; background-color: var(--example-sidebar-hover); border-radius: 4px; pointer-events: none; } .hoverable > svg { position: relative; z-index: 1; } @media (hover: hover) { .hoverable:hover::after { visibility: visible; } } .hoverable__small::after { inset: 4px; border-radius: 4px; } /* --------------------- Dialog --------------------- */ .example__dialog__overlay { position: fixed; inset: 0; z-index: 9999999998; background-color: hsl(0, 0%, 0%, 20%); } .example__dialog__content { cursor: default; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 9999999999; display: flex; flex-direction: column; width: 420px; min-width: 300px; max-width: calc(100vw - 48px); max-height: 80vh; overflow: hidden; border-radius: 9px; box-shadow: 0px 1px 2px hsl(0, 0%, 0%, 28%), 0px 2px 6px hsl(0, 0%, 0%, 14%), inset 0px 0px 0px 1px hsl(0, 0%, 100%); padding: 0; background-color: hsl(0, 0%, 99%); color: hsl(0, 0%, 18%); font-size: 12px; } .example__dialog__header { position: relative; display: flex; align-items: center; flex: 0 0 auto; min-height: 40px; padding: 0 0 0 12px; color: hsl(0, 0%, 18%); } .example__dialog__title { flex: 1 1 auto; margin: 0; font-size: 12px; font-weight: 500; line-height: inherit; color: hsl(0, 0%, 18%); } .example__dialog__header__close { all: unset; position: relative; cursor: pointer; width: 40px; height: 40px; display: flex; flex: 0 0 auto; align-items: center; justify-content: center; color: hsl(0, 0%, 18%); } .example__dialog__header__close::after { content: ''; position: absolute; inset: 4px; border-radius: 4px; background: hsl(0, 0%, 0%, 4.3%); opacity: 0; pointer-events: none; } .example__dialog__header__close > * { position: relative; z-index: 1; } @media (hover: hover) { .example__dialog__header__close:hover::after { opacity: 1; } } .example__dialog__body { flex: 0 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; max-width: 100%; padding: 12px; color: hsl(0, 0%, 18%); user-select: text; -webkit-user-select: text; } .example__dialog__markdown { font-size: 12px; line-height: 1.6; } .example__dialog__markdown p { margin: 0 0 12px 0; } .example__dialog__markdown p:last-child { margin-bottom: 0; } .example__dialog__markdown a { color: hsl(214, 84%, 56%); text-decoration: none; } .example__dialog__markdown a:hover { text-decoration: underline; } .example__dialog__actions { display: flex; align-items: center; justify-content: space-between; min-height: 12px; padding: 0 0px 0px 0px; flex-shrink: 0; gap: 0; } .example__dialog__actions a, .example__dialog__actions button { position: relative; cursor: pointer; min-width: 40px; height: 40px; padding: 0 12px; border-radius: 0; display: flex; align-items: center; justify-content: center; text-decoration: none; gap: 6px; background: transparent; color: hsl(0, 0%, 18%); border: 0; font: inherit; line-height: inherit; } .example__dialog__actions a::after, .example__dialog__actions button::after { content: ''; position: absolute; inset: 4px; border-radius: 4px; background: hsl(0, 0%, 0%, 4.3%); opacity: 0; pointer-events: none; } @media (hover: hover) { .example__dialog__actions a:hover::after, .example__dialog__actions button:hover::after { opacity: 1; } } .example__dialog__actions a > *, .example__dialog__actions button > * { position: relative; z-index: 1; } .example__dialog__content p > code { font-size: 12px; font-family: monospace; padding: 1px 3px; margin: 0px -2px; background-color: var(--black-transparent-lighter); border-radius: 4px; } .example__dialog__close { all: unset; } :root:has(.tl-theme__dark) .MultiplayerExampleWrapper { --background: black; --text: hsl(0, 9%, 94%); --gray-light: #333; --gray-dark: #444; --black-transparent-lighter: rgba(255, 255, 255, 0.15); --black-transparent-light: rgba(255, 255, 255, 0.4); --black-transparent-dark: rgba(255, 255, 255, 0.6); --black-transparent-darker: rgba(255, 255, 255, 0.7); --focus: hsl(217, 89%, 61%); --whiteboard: hsl(240, 5%, 6.5%); color-scheme: dark; } .MultiplayerExampleWrapper { display: flex; flex-direction: column; /* container: example / size; */ position: absolute; inset: 0px; } .MultiplayerExampleWrapper-picker { display: flex; flex-direction: row; justify-content: flex-start; align-items: center; padding: 8px 16px; gap: 16px; background: var(--background); border-bottom: 1px solid var(--gray-dark); color: var(--text); font-size: 14px; } .MultiplayerExampleWrapper-copy { background: var(--black-transparent-lighter); border: 1px solid var(--gray-dark); border-radius: 4px; padding: 4px 12px; height: 24px; cursor: pointer; position: relative; text-align: center; } .MultiplayerExampleWrapper-copy:has(.MultiplayerExampleWrapper-copied) { color: transparent; } .MultiplayerExampleWrapper-copied { color: var(--text); position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; } .MultiplayerExampleWrapper-copy:hover { border: 1px solid var(--black-transparent-lighter); } .MultiplayerExampleWrapper-example { position: relative; flex: 1; }