Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

9.1 KB
Raw Blame
/*
 * App-wide base rules, injected once by the SPA's AppTheme. Colours come from the
 * `--lobe-*` theme variables, which carry the same values `useTheme()` returned
 * when this was a runtime `createGlobalStyle`.
 */

/* fix ios input keyboard
   overflow: hidden;
   ref: https://zhuanlan.zhihu.com/p/113855026 */
html,
body,
#__next {
  position: relative;

  overscroll-behavior: none;

  height: 100%;
  min-height: 100dvh;
  max-height: 100dvh;
}

@media (device-width >= 576px) {
  html,
  body,
  #__next {
    overflow: hidden;

    /* The root cannot scroll here, and a root 'none' also suppresses the
       elastic overscroll of inner scrollers in Chromium on macOS. */
    overscroll-behavior: auto;
  }
}

body {
  /* Own stacking context, otherwise render black edges will appear. Must NOT
     be a transform-based hack: a transform on body rebases every position:
     fixed descendant onto body, and a drawer panel mid slide-in then overflows
     body horizontally — focusing it scrolls the whole page sideways. */
  will-change: opacity;
  isolation: isolate;
}

* {
  scrollbar-color: var(--lobe-color-fill) transparent;
  scrollbar-width: thin;
}

* ::-webkit-scrollbar {
  width: 0.75em;
  height: 0.75em;
}

* ::-webkit-scrollbar-thumb {
  border-radius: 10px;
}

* :hover::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  background-color: var(--lobe-color-text);
  background-clip: content-box;
}

* ::-webkit-scrollbar-track {
  background-color: transparent;
}

/* antd resets re-apply antialiased on each component root, so body alone is not enough */
html[data-font-antialiasing='off'] * {
  -webkit-font-smoothing: subpixel-antialiased;
  -moz-osx-font-smoothing: auto;
}

html.desktop[data-theme='dark'] body {
  background-color: color-mix(in srgb, var(--lobe-color-bg-layout) 50%, transparent);
}

html.desktop[data-theme='light'] body {
  background-color: color-mix(in srgb, var(--lobe-color-bg-layout) 70%, transparent);
}

/* @-mention blue-violet (src/styles/mention.stylex.ts). The geekblue/purple scale vars keep one
   value across themes, so dark mode lifts the text toward colorText and deepens the tint. */
html {
  --lobe-mention-base: color-mix(in srgb, var(--lobe-geekblue) 50%, var(--lobe-purple));
  --lobe-mention-color: var(--lobe-mention-base);
  --lobe-mention-bg: color-mix(in srgb, var(--lobe-mention-base) 14%, transparent);
  --lobe-mention-bg-hover: color-mix(in srgb, var(--lobe-mention-base) 22%, transparent);
}

html[data-theme='dark'] {
  --lobe-mention-color: color-mix(in srgb, var(--lobe-mention-base) 55%, var(--lobe-color-text));
  --lobe-mention-bg: color-mix(in srgb, var(--lobe-mention-base) 26%, transparent);
  --lobe-mention-bg-hover: color-mix(in srgb, var(--lobe-mention-base) 36%, transparent);
}

/* MAC_WINDOW_FULLSCREEN_SELECTOR / MAC_PANEL_BG_VAR from
   @/features/Electron/system/macWindowFullscreen */
html.desktop[data-window-fullscreen] {
  --mac-panel-bg: var(--lobe-color-bg-layout);
}

html.desktop[data-window-fullscreen] body {
  background-color: var(--lobe-color-bg-layout);
}

/* Drag-region hook class from @/styles/electron. Buttons opt out of the drag region only
   inside one: Chromium applies every app-region box's unclipped border box in layout
   order, later rect winning, so a page-wide button opt-out punched holes in the titlebar
   from buttons in the content below that had scrolled up under it. */
.lobe-drag-region button {
  -webkit-app-region: no-drag;
}

/* CLASSNAMES.ContextTrigger / CLASSNAMES.DropdownMenuTrigger from @lobehub/ui */
.lobe-context-trigger[data-popup-open]:not([data-no-highlight]),
.lobe-dropdown-menu-trigger[data-popup-open]:not([data-no-highlight]) {
  background: var(--lobe-color-fill-tertiary);
}

.accordion-action:has(.lobe-dropdown-menu-trigger[data-popup-open]:not([data-no-highlight])) {
  opacity: 1;
}

/* CONVERSATION_PRINT_ROOT_CLASS from @/features/Conversation/ChatList/constants */
@media screen {
  .conversation-print-root {
    display: none;
  }
}

@media print {
  html:has(> body > .conversation-print-root),
  body:has(> .conversation-print-root) {
    overflow: visible;

    height: auto;
    min-height: 0;
    max-height: none;

    color-scheme: light !important;
    background: none !important;
  }

  body:has(> .conversation-print-root) > :not(.conversation-print-root) {
    display: none !important;
  }
}

@layer lobe-base, lobe-popup, lobe-ui, lobe-density;

/* lobe-ui ships its rules inside @layer lobe-ui; placing density overrides in @layer lobe-density
   beats @layer lobe-ui defaults without !important while letting unlayered app StyleX / static styles win. */
@layer lobe-density {
  html[data-density='compact'] {
    --lobe-form-item-padding-block: 10px;
  }

  html[data-density='compact'] .lobe-menu-popup,
  html[data-density='compact'] .lobe-select__popup {
    font-size: var(--lobe-density-font-size);
  }

  html[data-density='compact'] .lobe-dropdown-menu__item,
  html[data-density='compact'] .lobe-context-menu__item,
  html[data-density='compact'] .lobe-select__option,
  html[data-density='compact'] .lobe-auto-complete__item {
    min-height: var(--lobe-density-control-height);
    padding-block: calc((var(--lobe-density-control-height) - 20px) / 2);
    padding-inline: 8px;

    font-size: var(--lobe-density-font-size);
    line-height: 20px;
  }

  html[data-density='compact'] .lobe-dropdown-menu__group-label,
  html[data-density='compact'] .lobe-context-menu__group-label,
  html[data-density='compact'] .lobe-select__group-label,
  html[data-density='compact'] .lobe-dropdown-menu__header,
  html[data-density='compact'] .lobe-dropdown-menu__footer,
  html[data-density='compact'] .lobe-context-menu__header,
  html[data-density='compact'] .lobe-context-menu__footer,
  html[data-density='compact'] .lobe-select__empty {
    padding-inline: 8px;
  }

  html[data-density='compact'] .lobe-dropdown-menu__header,
  html[data-density='compact'] .lobe-dropdown-menu__footer,
  html[data-density='compact'] .lobe-context-menu__header,
  html[data-density='compact'] .lobe-context-menu__footer {
    padding-block: 6px;
  }

  html[data-density='compact'] .lobe-select__search {
    min-height: var(--lobe-density-row-height);
    padding-block: 6px;
    padding-inline: 8px;
  }

  html[data-density='compact'] .lobe-select__search input,
  html[data-density='compact'] .lobe-select__empty {
    font-size: var(--lobe-density-font-size);
  }

  html[data-density='compact'] .lobe-menu-icon {
    margin-inline-end: 8px;
  }

  /* Keep min-height (not fixed height) so multiple / tags Select wraps cleanly without clipping. */
  html[data-density='compact'] .lobe-select[data-size='middle'] {
    min-height: var(--lobe-density-control-height);
    padding-block: 2px;
    font-size: var(--lobe-density-font-size);
  }

  html[data-density='compact']
    .lobe-tabs[data-size='middle'][data-variant='rounded']
    .lobe-tabs__tab {
    height: var(--lobe-density-control-height);
    min-height: var(--lobe-density-control-height);
    font-size: var(--lobe-density-font-size);
  }

  html[data-density='compact']
    .lobe-tabs[data-size='middle'][data-variant='square']
    .lobe-tabs__tab {
    padding-block: 6px;
    font-size: var(--lobe-density-font-size);
  }

  html[data-density='compact'] .lobe-segmented[data-size='small'] .lobe-segmented__item {
    height: calc(var(--lobe-density-control-height) - 8px);
    min-height: 0;
  }

  html[data-density='compact'] .lobe-segmented[data-size='middle'] .lobe-segmented__item {
    height: calc(var(--lobe-density-control-height) - 4px);
    min-height: 0;
    padding-inline: 10px;
    font-size: var(--lobe-density-font-size);
  }

  /* Unify middle controls on the 28px baseline in compact mode. ActionIcon also carries .lobe-button,
     so exclude it here and size it with its own rule below. */
  html[data-density='compact'] .lobe-button[data-size='middle']:not(.lobe-action-icon) {
    height: var(--lobe-density-control-height);
    font-size: var(--lobe-density-font-size);
  }

  html[data-density='compact'] .lobe-action-icon[data-size='middle'] {
    width: var(--lobe-density-control-height);
    height: var(--lobe-density-control-height);
  }

  html[data-density='compact'] .lobe-input[data-size='middle'],
  html[data-density='compact'] .lobe-input-number[data-size='middle'],
  html[data-density='compact'] .lobe-auto-complete[data-size='middle'] {
    min-height: var(--lobe-density-control-height);
    font-size: var(--lobe-density-font-size);
  }

  html[data-density='compact'] .lobe-list__item {
    min-height: var(--lobe-density-control-height);
    padding-block: 4px;
    padding-inline: 8px;
    font-size: var(--lobe-density-font-size);
  }

  html[data-density='compact'] .lobe-table-medium {
    --lobe-table-padding-block: 8px;
    --lobe-table-padding-inline: 12px;

    font-size: var(--lobe-density-font-size);
  }

  html[data-density='compact'] .lobe-modal__header,
  html[data-density='compact'] .lobe-drawer__header {
    min-height: var(--lobe-density-header-height);
    padding-block: 6px;
  }

  html[data-density='compact'] .lobe-modal__title,
  html[data-density='compact'] .lobe-drawer__title {
    font-size: var(--lobe-density-page-title-font-size);
  }
}