Files

661 lines
13 KiB
SCSS

.docs-ai-launcher {
position: fixed;
right: 24px;
bottom: 24px;
z-index: 40;
display: inline-flex;
gap: 8px;
align-items: center;
min-height: 44px;
padding: 0 18px;
color: #fff;
font: inherit;
font-weight: 700;
cursor: pointer;
background: #2f55d4;
border: 0;
border-radius: 999px;
box-shadow: 0 12px 30px rgb(49 94 251 / 28%);
svg {
width: 19px;
height: 19px;
fill: none;
stroke: currentcolor;
stroke-linecap: round;
stroke-linejoin: round;
stroke-width: 1.8;
}
}
html.docs-ai-workspace-open {
--docs-ai-panel-width: clamp(400px, 28vw, 520px);
}
html.docs-ai-workspace-open #__rspress_root {
width: calc(100% - var(--docs-ai-panel-width));
transition: width 180ms ease;
}
.docs-ai-launcher:hover,
.docs-ai-launcher:focus-visible {
background: #2443b8;
outline: 3px solid var(--rp-c-brand-tint);
outline-offset: 2px;
}
.docs-ai-panel {
--docs-ai-muted: var(--rp-c-text-2);
--docs-ai-accent: var(--rp-c-brand);
--docs-ai-paper: var(--rp-c-bg-soft);
--docs-ai-surface: var(--rp-c-bg-soft);
--docs-ai-rule: var(--rp-c-divider);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
letter-spacing: normal;
position: fixed;
top: 0;
right: 0;
bottom: 0;
z-index: 1000;
display: grid;
grid-template-rows: auto minmax(0, 1fr) auto;
width: min(var(--docs-ai-panel-width), 100vw);
height: 100%;
overflow: hidden;
color: var(--rp-c-text-1);
background: var(--rp-c-bg);
border-left: 1px solid var(--rp-c-divider);
border-radius: 0;
box-shadow: none;
transition: width 180ms ease;
}
html:not(.rp-dark) .docs-ai-panel {
--docs-ai-muted: #667085;
--docs-ai-accent: #345be3;
--docs-ai-paper: #f8f9fb;
--docs-ai-surface: #f1f3f5;
--docs-ai-rule: #dce0e5;
color: #171c26;
}
.docs-ai-header {
display: flex;
align-items: center;
justify-content: space-between;
min-height: 65px;
padding: 0 16px;
border-bottom: 1px solid var(--docs-ai-rule);
}
.docs-ai-heading {
display: flex;
gap: 10px;
align-items: center;
> svg {
width: 21px;
height: 21px;
color: var(--docs-ai-accent);
fill: none;
stroke: currentcolor;
stroke-linecap: round;
stroke-linejoin: round;
stroke-width: 1.8;
}
h2 {
margin: 0;
font-size: 15px;
font-weight: 600;
line-height: 22px;
}
}
.docs-ai-header-actions {
display: flex;
gap: 4px;
align-items: center;
}
.docs-ai-icon-button {
display: grid;
width: 32px;
height: 32px;
padding: 0;
color: var(--rp-c-text-2);
cursor: pointer;
background: transparent;
border: 0;
border-radius: 10px;
place-items: center;
svg {
width: 21px;
height: 21px;
fill: none;
stroke: currentcolor;
stroke-linecap: round;
stroke-linejoin: round;
stroke-width: 2;
}
}
.docs-ai-icon-button:hover,
.docs-ai-icon-button:focus-visible {
color: var(--rp-c-brand);
background: var(--rp-c-brand-tint);
outline: 2px solid transparent;
}
.docs-ai-body {
min-height: 0;
padding: 24px;
scroll-padding-block-start: 24px;
overscroll-behavior: contain;
overflow-y: auto;
scrollbar-color: var(--rp-c-text-3) transparent;
scrollbar-width: thin;
}
.docs-ai-turn + .docs-ai-turn {
margin-top: 28px;
}
// Leave enough room to align the latest question even when its answer is short.
.docs-ai-turn:last-child {
min-height: 100%;
}
.docs-ai-submitted-question {
width: fit-content;
max-width: 90%;
padding: 10px 14px;
margin-inline-start: auto;
margin-bottom: 28px;
overflow-wrap: anywhere;
background: var(--docs-ai-surface);
border-radius: 12px;
p {
margin: 0;
font-size: 14px;
line-height: 1.55;
}
}
.docs-ai-panel .docs-retrieval { --retrieval-rule: var(--docs-ai-rule); --retrieval-muted: var(--docs-ai-muted); }
.docs-retrieval {
box-sizing: border-box;
width: 100%;
padding: 12px;
border: 1px solid var(--retrieval-rule);
border-radius: 8px;
font-size: 13px;
line-height: 1.55;
}
.docs-retrieval summary {
display: flex;
align-items: center;
gap: 8px;
min-height: 24px;
cursor: pointer;
list-style: none;
}
.docs-retrieval summary::-webkit-details-marker { display: none; }
.docs-retrieval summary::after {
content: '';
width: 6px;
height: 6px;
flex: none;
margin-inline-end: 3px;
border-right: 1.5px solid var(--retrieval-muted);
border-bottom: 1.5px solid var(--retrieval-muted);
transform: rotate(45deg);
}
.docs-retrieval[open] summary::after { transform: rotate(225deg); }
.docs-retrieval summary:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.docs-retrieval-count { margin-inline-start: auto; color: var(--retrieval-muted); }
.docs-retrieval-row { display: flex; align-items: baseline; gap: 9px; margin-top: 5px; overflow-wrap: anywhere; }
.docs-retrieval-row::before {
content: '';
flex: none;
align-self: flex-start;
width: 12px;
height: 12px;
margin-top: 4px;
box-sizing: border-box;
}
.docs-retrieval-source::before {
width: 11px;
height: 6px;
margin-top: 6px;
border-left: 1.5px solid var(--retrieval-muted);
border-bottom: 1.5px solid var(--retrieval-muted);
transform: rotate(-45deg);
}
.docs-retrieval-active::before {
border: 1.5px solid var(--retrieval-rule);
border-right-color: var(--retrieval-muted);
border-radius: 50%;
animation: docs-retrieval-spin .8s linear infinite;
}
@keyframes docs-retrieval-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
.docs-retrieval-active::before { animation: none; }
}
.docs-ai-error {
padding: 12px 14px;
color: #b42318;
background: #fef3f2;
border-radius: 10px;
small {
display: block;
margin-top: 6px;
color: #7a271a;
font-size: 12px;
word-break: break-all;
}
}
.docs-ai-answer-text {
overflow-wrap: anywhere;
font-size: 14px;
line-height: 1.8;
> :first-child {
margin-top: 0;
}
> :last-child {
margin-bottom: 0;
}
h1,
h2,
h3,
h4 {
margin: 20px 0 8px;
color: inherit;
font-weight: 650;
line-height: 1.4;
}
h1,
h2 {
font-size: 16px;
}
h3,
h4 {
font-size: 15px;
}
p {
margin: 0 0 12px;
}
ol,
ul {
margin: 0 0 12px;
padding-inline-start: 20px;
}
ol { list-style-type: decimal; }
ul { list-style-type: disc; }
li::marker { color: var(--rp-c-text-2); }
li > p { margin-bottom: 4px; }
li + li {
margin-top: 6px;
}
blockquote {
padding: 2px 0 2px 14px;
margin: 14px 0;
color: var(--rp-c-text-2);
border-left: 3px solid var(--rp-c-brand);
}
code {
padding: 2px 5px;
font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
background: var(--docs-ai-surface);
border-radius: 5px;
}
pre {
margin: 0;
padding: 12px;
line-height: 1.55;
white-space: pre;
overflow-x: auto;
background: var(--docs-ai-surface);
border-radius: 0;
code {
padding: 0;
background: transparent;
}
}
a {
color: var(--rp-c-brand);
font-weight: 600;
text-decoration: none;
}
a:hover,
a:focus-visible {
text-decoration: underline;
text-underline-offset: 3px;
}
}
.docs-ai-answer > ol,
.docs-ai-applies ul {
padding-inline-start: 20px;
font-size: 14px;
line-height: 1.8;
}
.docs-ai-answer > ol { list-style-type: decimal; }
.docs-ai-applies ul { list-style-type: disc; }
.docs-ai-code {
margin: 12px 0;
max-width: 100%;
overflow: hidden;
border: 1px solid var(--docs-ai-rule);
border-radius: 8px;
}
.docs-ai-code-tools {
display: flex;
align-items: center;
justify-content: space-between;
padding: 4px 10px;
color: var(--rp-c-text-2);
font-size: 12px;
background: var(--docs-ai-surface);
border-bottom: 1px solid var(--docs-ai-rule);
button {
padding: 4px 6px;
background: transparent;
border: 0;
font: inherit;
color: var(--rp-c-brand);
cursor: pointer;
}
}
.docs-ai-table {
margin-block: 14px;
overflow-x: auto;
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 12px; text-align: start; vertical-align: top; border: 1px solid var(--docs-ai-rule); }
th { background: var(--docs-ai-surface); }
}
.docs-ai-applies {
padding: 14px;
margin-top: 18px;
background: var(--rp-c-bg-soft);
border-radius: 12px;
}
.docs-ai-source-tail {
white-space: nowrap;
}
.docs-ai-answer-text .docs-ai-inline-source {
display: inline-block;
box-sizing: border-box;
width: 1.4em;
height: 1.4em;
margin-inline-start: .15em;
vertical-align: -.31em;
border: 1px solid var(--rp-c-divider);
border-radius: 5px;
background: white url('./nocobase-mark.png') center / 1em 1em no-repeat;
}
.docs-ai-answer-text .docs-ai-inline-source:hover,
.docs-ai-answer-text .docs-ai-inline-source:focus-visible {
outline: 2px solid var(--rp-c-brand);
outline-offset: 1px;
}
.docs-ai-sources {
padding-top: 12px;
font-size: 13px;
margin-top: 20px;
border-top: 1px solid var(--rp-c-divider);
summary {
width: fit-content;
color: var(--rp-c-text-2);
font-weight: 500;
cursor: pointer;
}
&[open] summary { margin-bottom: 12px; }
ul {
padding-left: 20px;
margin: 0;
}
li {
padding-left: 2px;
margin-bottom: 6px;
}
a {
color: var(--rp-c-brand);
font-weight: 500;
}
}
.docs-ai-footer {
padding: 12px 20px 16px;
background: var(--rp-c-bg);
}
.docs-ai-welcome {
padding: 36px 0 24px;
h3 {
margin: 0 0 24px;
font-size: 22px;
font-weight: 500;
line-height: 1.5;
letter-spacing: -.02em;
}
}
.docs-ai-welcome-mark {
display: grid;
width: 44px;
height: 44px;
margin-bottom: 20px;
place-items: center;
color: var(--docs-ai-accent);
background: var(--docs-ai-paper);
border: 1px solid var(--docs-ai-rule);
border-radius: 12px;
svg {
width: 22px;
height: 22px;
fill: none;
stroke: currentColor;
stroke-width: 1.8;
stroke-linecap: round;
stroke-linejoin: round;
}
}
.docs-ai-suggestions {
display: grid;
gap: 8px;
button {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
padding: 12px;
color: inherit;
font: inherit;
font-size: 13px;
line-height: 1.6;
text-align: start;
cursor: pointer;
background: transparent;
border: 1px solid var(--docs-ai-rule);
border-radius: 8px;
&:hover { background: var(--docs-ai-surface); }
&:focus-visible { outline: 2px solid var(--docs-ai-accent); }
svg {
width: 15px;
height: 15px;
flex: none;
fill: none;
stroke: var(--rp-c-text-2);
stroke-width: 1.8;
stroke-linecap: round;
stroke-linejoin: round;
}
}
}
.docs-ai-hint {
margin: 0 0 10px;
color: var(--docs-ai-muted);
font-size: 12px;
line-height: 1.6;
}
.docs-ai-form {
position: relative;
padding: 12px 14px 54px;
background: var(--rp-c-bg);
border: 1px solid var(--rp-c-divider);
border-radius: 12px;
box-shadow: 0 2px 8px rgb(15 23 42 / 8%);
transition:
border-color 150ms ease,
box-shadow 150ms ease;
&:focus-within { border-color: var(--rp-c-text-3); }
textarea {
box-sizing: border-box;
width: 100%;
display: block;
min-height: 52px;
padding: 0;
color: var(--rp-c-text-1);
font: inherit;
font-size: 14px;
line-height: 1.5;
resize: none;
background: transparent;
border: 0;
outline: 0;
}
textarea::placeholder {
color: var(--docs-ai-muted);
}
> button {
position: absolute;
right: 12px;
bottom: 12px;
display: grid;
width: 36px;
height: 36px;
padding: 0;
color: #fff;
cursor: pointer;
background: var(--docs-ai-accent);
border: 0;
border-radius: 8px;
place-items: center;
svg {
width: 21px;
height: 21px;
fill: none;
stroke: currentcolor;
stroke-linecap: round;
stroke-linejoin: round;
stroke-width: 2;
}
&:hover:not(:disabled),
&:focus-visible:not(:disabled) {
filter: brightness(0.92);
outline: 3px solid var(--rp-c-brand-tint);
outline-offset: 2px;
}
&:disabled {
color: var(--rp-c-text-3);
cursor: not-allowed;
background: var(--rp-c-bg-mute);
}
}
}
@media (max-width: 640px) {
.docs-ai-welcome { padding-top: 24px; }
.docs-ai-form textarea { font-size: 16px; }
.docs-ai-launcher {
right: 16px;
bottom: 16px;
}
.docs-ai-panel {
width: 100%;
border-radius: 0;
}
html.docs-ai-workspace-open #__rspress_root {
width: 100%;
}
.docs-ai-header {
padding: 0 20px;
}
.docs-ai-body {
padding-right: 20px;
padding-left: 20px;
}
.docs-ai-footer {
padding-right: 16px;
padding-bottom: 16px;
padding-left: 16px;
}
}
@media (prefers-reduced-motion: reduce) {
.docs-ai-panel,
html.docs-ai-workspace-open #__rspress_root {
transition: none;
}
}