Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

7.5 KB
Raw Blame
:root::selection {
  background-color: var(--b3-theme-primary-lighter);
}

html {
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  height: 100%;
  box-sizing: border-box;
}

// 声明当前配色方案,用于修正 iOS 深色模式下输入法候选词高亮项背景丢失等问题 https://github.com/siyuan-note/siyuan/issues/17894
:root {
  --b3-legacy-light-color: initial;
  --b3-legacy-dark-color: ;
}

:root[data-theme-mode="dark"] {
  color-scheme: dark;
  --b3-legacy-light-color: ;
  --b3-legacy-dark-color: initial;
}

:root[data-theme-mode="light"] {
  color-scheme: light;
  --b3-legacy-light-color: initial;
  --b3-legacy-dark-color: ;
}

[inert] {
  pointer-events: none;
}

// iOS 使用固定蓝色光标,改善系统与应用明暗模式不同组合下的输入法候选字对比度。
// https://github.com/siyuan-note/siyuan/issues/20005
body.body--ios {
  caret-color: #3575f0;
}

// 语言包或主题不可用时,仍使用系统配色显示启动错误。
.language-load-error {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  box-sizing: border-box;
  margin: 0;
  padding: 24px;
  overflow: auto;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  color: CanvasText;
  background-color: Canvas;
}

body {
  text-rendering: optimizeLegibility;
  margin: 0;
  font-family: var(--b3-font-family);
  color: var(--b3-theme-on-background);
  background-color: var(--b3-body-background);
  -webkit-overflow-scrolling: touch;
  -webkit-tap-highlight-color: var(--b3-list-hover);
  height: 100%;
  box-sizing: border-box;
  max-height: 100%;
  overflow: hidden;

  // body 使用字号导致显示不全 https://github.com/siyuan-note/siyuan/issues/11670#issuecomment-2282329358
  & > .fn__flex-1 {
    font-size: 14px;
  }

  &.body--blur {
    --b3-body-background-hl-opacity: 0.12;

    .layout {
      &__wnd--active .layout-tab-bar .item--focus {
        background-color: var(--b3-theme-surface-light);
        box-shadow: 0 0 0 1px var(--b3-border-color) inset;

        & > .item__text {
          color: var(--b3-theme-on-surface);
        }
      }

      &__tab--active {
        .b3-list--background .b3-list-item--focus {
          background-color: var(--b3-list-hover);
        }
      }
    }

    .dock__item--activefocus {
      color: var(--b3-theme-on-surface-light) !important;
      background-color: var(--b3-theme-background-light) !important;
    }
  }

  // 非 macOS 平台不预留 macOS 窗口按钮空间,浏览器端工具栏的标题栏避让由 .toolbar--browser 处理
  &.body--windows,
  &.body--linux {
    --b3-toolbar-left-mac: 8px;
    --b3-fullscreen-controls-width: 128.5px;

    &.body--toolbar-hide {
      --b3-fullscreen-controls-width: calc(46.5px + 6 * var(--b3-ui-window-control-padding, 13.25px));
    }

    .toolbar:not(.toolbar--browser) {
      padding: 0 0 0 5px;
    }

    // 前端形态条件不增加优先级,独立窗口继续使用自身的窗口控件占位。
    :where(html[data-frontend="desktop"]) &,
    :where(html[data-frontend="desktop-window"]) & {
      .fullscreen {
        & > .protyle-breadcrumb,
        & > .block__icons {
          padding-right: calc(var(--b3-fullscreen-controls-width) + 8px);
        }

        & > .block__icons > .search__label {
          right: 108px;
        }
      }
    }
  }

  &.body--window {
    .fullscreen {
      & > .protyle-breadcrumb,
      & > .block__icons {
        padding-right: 42px;
      }
    }

    &:not(.body--mac) .fullscreen {
      & > .protyle-breadcrumb,
      & > .block__icons {
        padding-right: 168px;
      }
    }

    .layout__center {
      border-radius: 0;
    }
  }

  &.body--fullscreen {
    --b3-toolbar-left-mac: 5px;
  }

  &.body--maximize,
  &.body--fullscreen {
    #maxWindow {
      display: none;
    }

    #restoreWindow {
      display: flex;
    }
  }

  &:not(.body--toolbar-hide):not(.body--window) {
    .fullscreen > .protyle-breadcrumb,
    .fullscreen > .block__icons {
      min-height: var(--b3-ui-toolbar-height, 32px);
    }
  }

  &.body--toolbar-hide {

    #dockLeft, #dockRight {
      margin-top: var(--b3-ui-panel-height, 42px);

      &:not(.dock--float) {
        height: calc(100% - var(--b3-ui-panel-height, 42px));
      }
    }

    .toolbar {
      height: var(--b3-ui-panel-height, 42px);
      position: absolute;
      width: 100%;

      & > :not(#drag) {
        position: relative;
        z-index: 7;
      }
    }

    .layout__dockl:not(.layout--float),
    .layout__dockr:not(.layout--float) {
      margin-top: var(--b3-ui-panel-height, 42px);
    }

    .layout__wnd--left .layout-tab-container {
      border-top-left-radius: var(--b3-border-radius-b);
    }

    .layout__wnd--right .layout-tab-container {
      border-top-right-radius: var(--b3-border-radius-b);
    }

    .layout__wnd--center .layout-tab-bar .item {
      margin: var(--b3-ui-tab-margin, 6px 4px);
    }

    .toolbar #drag {
      -webkit-app-region: none;
      color: transparent;
      height: var(--b3-ui-panel-height, 42px);
      position: relative;

      .toolbar__title-icon {
        display: none;
      }

      &::before,
      &::after {
        content: "";
        width: var(--b3-toolbar-drag-left);
        height: var(--b3-ui-panel-height, 42px);
        position: absolute;
        left: 0;
        top: 0;
        -webkit-app-region: drag;
      }

      &::after {
        left: auto;
        right: 0;
        width: var(--b3-toolbar-drag-right);
      }

      &[data-topbar-reordering="true"]::before,
      &[data-topbar-reordering="true"]::after {
        -webkit-app-region: no-drag;
      }
    }

    .fullscreen > .protyle-breadcrumb,
    .fullscreen > .block__icons {
      padding-left: var(--b3-toolbar-left-mac);
    }

    .toolbar__item--win,
    .toolbar__item--close {
      padding: var(--b3-ui-window-control-padding, 13.25px);
      height: var(--b3-ui-panel-height, 42px);
    }
  }


  #maxWindow {
    display: flex;
  }

  #restoreWindow {
    display: none;
  }
}

ul,
ol {
  margin: 0;
  padding: 0;
}

h1,
h2,
h3,
h4,
h5,
h6,
dl,
dd,
p {
  margin: 0;
}

article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
nav,
section {
  display: block;
}

audio,
canvas,
video {
  display: inline-block;
}

audio:not([controls]) {
  display: none;
}

a {
  outline: 0;
  text-decoration: underline;
  color: var(--b3-theme-primary);
}

sub,
sup {
  position: relative;
  font-size: 75%;
  line-height: 0;
  vertical-align: baseline;
}

sup {
  top: -.5em;
}

sub {
  bottom: -.25em;
}

img {
  max-width: 100%;
  vertical-align: middle;
  border: 0;
  height: auto;
  -ms-interpolation-mode: bicubic;
  overflow: hidden;

  &:not(.emoji):not(.callout-img) {
    font-size: 12px;
  }
}

button,
input,
select,
textarea {
  margin: 0;
  font-size: 100%;
  vertical-align: middle;
  font-family: var(--b3-font-family);
  outline: none;
}

button,
input {
  line-height: normal;
}

button::-moz-focus-inner,
input::-moz-focus-inner {
  padding: 0;
  border: 0;
}

textarea::placeholder,
button::placeholder,
input::placeholder {
  color: var(--b3-empty-color);
}

button,
input[type="button"],
input[type="reset"],
input[type="submit"] {
  cursor: pointer;
  -webkit-appearance: button;
}

input[type="search"] {
  box-sizing: content-box;
  -webkit-appearance: textfield;
}

input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

textarea {
  overflow: auto;
}

svg {
  fill: currentColor;
  display: inline-block;
}

line, circle {
  transition: fill .15s ease-in-out;
}

blockquote {
  margin: 0;
}