Skip to content

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

13.0 KB
Raw Blame
.history {
  &__associations {
    padding: 8px 16px;
    flex-shrink: 0;

    summary {
      cursor: pointer;
    }
  }

  &__association-list {
    max-height: 30vh;
    overflow: auto;
  }

  &__association {
    padding: 8px 0;
  }

  &__association-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 4px 12px;
  }

  &__association-link {
    max-width: 100%;
    min-width: 0;
  }

  &__association-memo {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  &__snapshot-detail,
  &__snapshot-detail-content {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  &__snapshot-detail-status {
    padding: 12px 16px;
    overflow-wrap: anywhere;
  }

  &__snapshot-detail-meta {
    padding: 12px 16px;
    max-height: 25vh;
    overflow: auto;
    overflow-wrap: anywhere;
    flex-shrink: 0;
  }

  &__snapshot-detail-panels {
    display: flex;
    min-height: 0;
    flex: 1;
  }

  &__snapshot-detail-files {
    width: 35%;
    min-width: 0;
    overflow: auto;
  }

  &__snapshot-detail-preview {
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;

    > div {
      flex: 1;
      min-height: 0;
    }
  }

  @media (max-width: 600px) {
    &__snapshot-detail-panels {
      flex-direction: column;
    }

    &__snapshot-detail-files {
      width: auto;
      max-height: 25vh;
      flex-shrink: 0;
    }
  }

  &__snapshots {
    min-width: 0;
    min-height: 0;

    &.fn__block {
      display: flex;
    }

    &--managing {
      [data-type="repoitem"] .b3-list-item__action,
      [data-type="compare"],
      .history__snapshot-footer,
      .history__snapshot-pane > .history__action {
        display: none;
      }
    }

    &--narrow {
      .history__snapshot-toolbar {
        padding: 4px;
        gap: 4px;
      }

      .history__snapshot-heading {
        min-height: 37px;
      }

      .history__snapshot-sources {
        display: flex;
      }

      .history__snapshot-label {
        display: none;
      }

      &[data-source="local"] [data-repo-source="cloud"],
      &[data-source="cloud"] [data-repo-source="local"] {
        display: none;
      }

      [data-role="selection"] {
        flex-basis: 100%;
      }
    }

    &--search:not(&--narrow) [data-repo-source="cloud"] {
      display: none;
    }

    &:not(&--mobile) .history__snapshot-mobile-control {
      display: none;
    }

    &--mobile {
      .history__snapshot-mobile-control {
        display: inline-flex;
      }

      .history__snapshot-date-controls {
        flex-basis: 100%;
      }

      &:not(.history__snapshots--filters) .history__snapshot-date-controls,
      [data-action="purge"],
      .history__snapshot-menu-action {
        display: none;
      }
    }
  }

  &__snapshot {
    &-date-controls {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 8px;
    }

    &-loading {
      position: relative;
      height: 100%;
      list-style: none;
    }

    &-diff-dialog {
      border-radius: 0;

      .history__snapshot-diff {
        min-height: 0;
        flex-direction: column;

        > .history__side {
          flex: 1;
          width: auto;
          min-height: 0;
        }

        > .history__resize,
        > [data-type="editors"],
        > .history__snapshot-diff-nav {
          display: none;
        }

        &--preview {
          > .history__side {
            display: none;
          }

          > [data-type="editors"],
          > .history__snapshot-diff-nav {
            display: flex;
          }
        }

        &[data-side="left"] > [data-type="editors"] > :last-child,
        &[data-side="right"] > [data-type="editors"] > :first-child {
          display: none;
        }

        > [data-type="editors"] {
          min-height: 0;
          min-width: 0;

          > div {
            min-height: 0;
            min-width: 0;
          }

          .protyle-title__input {
            margin: 0;
            padding: 4px 8px;
            font-size: 14px;
            line-height: 20px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
          }
        }
      }
    }

    &-diff-nav {
      flex-shrink: 0;
      align-items: center;
      flex-wrap: wrap;
      gap: 4px;
      padding: 4px;
      border-bottom: 1px solid var(--b3-border-color);

      [aria-pressed="true"] {
        background-color: var(--b3-theme-primary-lightest);
        color: var(--b3-theme-primary);
      }
    }

    &-toolbar,
    &-sources {
      display: flex;
      flex-shrink: 0;
      align-items: center;
      flex-wrap: wrap;
      gap: 8px;
      padding: 8px;
      border-bottom: 1px solid var(--b3-border-color);

      [aria-pressed="true"] {
        background-color: var(--b3-theme-primary-lightest);
        color: var(--b3-theme-primary);
      }
    }

    &-range {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    &-sources {
      display: none;
      padding: 0;
      gap: 4px;
      border: 0;
    }

    &-footer {
      justify-content: center;
      border-bottom: 0;
      border-top: 1px solid var(--b3-border-color);

      .history__repo-pagination {
        justify-content: center;
        flex-wrap: wrap;
      }
    }

    &-heading,
    &-message {
      background-color: var(--b3-theme-surface);
    }

    &-heading {
      min-height: 45px;
      box-sizing: border-box;
    }

    &-message {
      padding: 8px;
      flex-shrink: 0;
      overflow-wrap: anywhere;
    }

    &-columns {
      display: flex;
      flex: 1;
      min-height: 0;
      min-width: 0;
    }

    &-pane {
      flex: 1;
      min-width: 0;
      min-height: 0;

      & + & {
        border-left: 1px solid var(--b3-border-color);
      }

      .history__panel {
        min-height: 0;
        min-width: 0;
      }

      > .history__action .block__icons {
        flex-wrap: wrap;
      }

      [data-type="repoList"] {
        overflow: auto;
        min-width: 0;
      }

      li[data-type="repoitem"] {
        flex-wrap: wrap;

        > .fn__flex-1 {
          min-width: 0;
          white-space: normal;
          overflow-wrap: anywhere;
        }

        .b3-list-item__meta {
          white-space: normal;
          overflow-wrap: anywhere;
        }

        &.history__snapshot--selected,
        &.history__snapshot--selected:hover {
          background-color: var(--b3-theme-primary-lightest);
        }
      }
    }

    &-check {
      flex-shrink: 0;
      margin-right: 8px;
      accent-color: var(--b3-theme-primary);
      width: 16px;
      height: 16px;
    }
  }

  &__action {
    overflow: auto;
    border-bottom: 1px solid var(--b3-border-color);
  }

  &__text {
    background-color: var(--b3-theme-background);
    padding: 16px;
    box-sizing: border-box;
    border: 0;
    border-radius: 0 0 var(--b3-border-radius-b) 0;
    resize: none;
    color: var(--b3-theme-on-background);
  }

  &__repo {
    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
    border-radius: 0 0 var(--b3-border-radius-b) var(--b3-border-radius-b);

    &.history__snapshot-pane {
      border-radius: 0;
    }
  }

  &__repo-actions {
    flex-wrap: wrap;
    gap: 4px;
  }

  &__repo-pagination {
    display: flex;
    align-items: center;
  }

  &__repo-search {
    flex: 1 1 200px;
    min-width: 0;

    .b3-text-field {
      width: 100%;
    }
  }

  &__date {
    text-align: center;
    line-height: 20px;
    color: var(--b3-theme-on-surface);
    background: var(--b3-theme-background);
  }

  &__current-version {
    position: sticky;
    z-index: 1;
    top: 0;
    background: var(--b3-theme-background);
    border-bottom: 1px solid var(--b3-border-color);
  }

  &__side {
    width: 256px;
    padding: 8px 0;
    overflow: auto;
    user-select: none;

    .b3-list-item--hide-action > [data-type="selectVersion"][aria-pressed="true"] {
      display: flex;
    }

    &--diff {
      display: flex;
      flex-direction: column;
      padding: 0;
      overflow: hidden;
    }
  }

  &__diff {
    &-filters {
      flex-shrink: 0;
      padding: 4px;
      overflow-x: auto;
      border-bottom: 1px solid var(--b3-border-color);
    }

    &-filter-row {
      display: flex;
      align-items: center;
      min-width: max-content;

      .b3-chip {
        margin: 4px;
        border: 0;
        font-family: inherit;
      }

      &--kind {
        padding-left: 8px;
      }
    }

    &-list {
      min-height: 0;
      padding: 8px 0;
      overflow: auto;
    }

    &-item {
      min-height: 48px;
      height: auto;
      padding: 4px 8px 4px 40px;
    }

    &-file {
      display: flex;
      flex: 1;
      flex-direction: column;
      min-width: 0;
      line-height: 20px;
    }

    &-title,
    &-path {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    &-title {
      color: var(--b3-theme-on-background);
    }

    &-path {
      color: var(--b3-theme-on-surface);
      font-size: 12px;
    }
  }

  &__resize {
    cursor: col-resize;
    box-shadow: 2px 0 0 0 var(--b3-theme-background) inset, 3px 0 0 0 var(--b3-border-color) inset;
    width: 5px;
    margin-left: -2px;
  }

  &__panel {
    .protyle-title__input {
      margin-top: 8px;
    }
  }

  &__doc-compare {
    height: 100%;
    min-height: 0;
  }

  &__compare {
    &-legend {
      display: flex;
      align-items: center;
      min-width: max-content;
      margin-left: 8px;

      .b3-chip {
        display: flex;
        align-items: center;
        gap: 4px;
        margin: 4px;
        border: 0;
        font-family: inherit;
      }
    }

    &-filter {
      > span {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background-color: var(--b3-theme-on-surface);
      }

      &--added > span {
        background-color: var(--b3-theme-success);
      }

      &--removed > span {
        background-color: var(--b3-theme-error);
      }

      &--modified > span {
        background-color: var(--b3-theme-primary);
      }
    }

    &-message {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      padding: 8px 16px;
      color: var(--b3-theme-on-surface);
      background-color: var(--b3-theme-surface);
      border-bottom: 1px solid var(--b3-border-color);
    }

    &-scroll {
      min-height: 0;
      overflow-x: auto;
      overflow-y: hidden;
    }

    &-editors {
      height: 100%;
      min-width: 720px;
    }

    &-panel {
      width: 50%;
      min-width: 360px;
      min-height: 0;
      background: var(--b3-theme-background);

      & + & {
        border-left: 1px solid var(--b3-border-color);
      }

      &:first-child {
        [data-history-diff~="only"],
        [data-history-diff="inline"] {
          background-color: var(--b3-card-error-background);
          background-color: color-mix(in srgb, var(--b3-theme-error) 18%, transparent);
        }

        [data-type="NodeAttributeView"][data-history-diff~="only"] {
          border-radius: 0 !important;
          background-color: transparent;
          box-shadow: 3px 0 0 var(--b3-theme-error) inset;
        }
      }

      &:last-child {
        [data-history-diff~="only"],
        [data-history-diff="inline"] {
          background-color: var(--b3-card-success-background);
          background-color: color-mix(in srgb, var(--b3-theme-success) 18%, transparent);
        }

        [data-type="NodeAttributeView"][data-history-diff~="only"] {
          border-radius: 0 !important;
          background-color: transparent;
          box-shadow: 3px 0 0 var(--b3-theme-success) inset;
        }
      }

      [data-history-diff~="modified"] {
        border-radius: 0 !important;
        box-shadow: 3px 0 0 var(--b3-theme-primary) inset;
      }

      [data-history-diff~="moved"] {
        outline: 1px dashed var(--b3-theme-on-surface);
        outline-offset: -1px;
      }

      .history__diff--filtered {
        background-color: transparent !important;
        box-shadow: none !important;
        outline: 0 !important;

        [data-history-diff="inline"] {
          background-color: transparent !important;
        }
      }
    }

    &-label {
      flex-shrink: 0;
      padding: 4px 8px;
      text-align: center;
      border-bottom: 1px solid var(--b3-border-color);
    }

    &-content {
      min-height: 0;

      > .protyle {
        height: 100%;
      }

      > textarea {
        height: 100%;
      }

      > .fn__loading {
        height: 100%;
      }
    }
  }

  &__diff-count {
    min-width: 48px;
    padding: 0 4px;
    text-align: center;
  }

  &__diff--focus {
    animation: history-diff-focus 1.2s ease-out;
  }
}

@media (hover: none) {
  .history__side .b3-list-item--hide-action > .b3-list-item__action {
    display: flex;
  }
}

@keyframes history-diff-focus {
  0%,
  40% {
    outline: 2px solid var(--b3-theme-primary);
    outline-offset: -2px;
  }

  100% {
    outline-color: transparent;
  }
}