radiant-docs 0.1.40 → 0.1.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/template/astro.config.mjs +42 -40
- package/template/package-lock.json +7 -0
- package/template/package.json +3 -2
- package/template/public/favicon.svg +16 -8
- package/template/scripts/remove-assistant-for-non-pro.mjs +28 -0
- package/template/src/components/Header.astro +151 -17
- package/template/src/components/MdxPage.astro +76 -22
- package/template/src/components/PagePagination.astro +44 -8
- package/template/src/components/Sidebar.astro +10 -1
- package/template/src/components/TableOfContents.astro +159 -53
- package/template/src/components/chat/AssistantDocsWidget.astro +16 -0
- package/template/src/components/chat/AssistantDocsWidget.tsx +615 -0
- package/template/src/components/chat/AssistantEmbedPanel.tsx +2679 -0
- package/template/src/components/chat/AssistantEmbedPanelPage.astro +95 -0
- package/template/src/components/user/Accordion.astro +2 -2
- package/template/src/components/user/AccordionGroup.astro +1 -1
- package/template/src/components/user/Callout.astro +10 -4
- package/template/src/components/user/Card.astro +488 -0
- package/template/src/components/user/CardGradient.astro +964 -0
- package/template/src/components/user/CodeBlock.astro +1 -1
- package/template/src/components/user/CodeGroup.astro +1 -1
- package/template/src/components/user/Column.astro +25 -0
- package/template/src/components/user/Columns.astro +200 -0
- package/template/src/components/user/ComponentPreviewBlock.astro +1 -1
- package/template/src/components/user/Image.astro +1 -1
- package/template/src/components/user/Step.astro +1 -1
- package/template/src/components/user/Steps.astro +1 -1
- package/template/src/components/user/Tab.astro +1 -3
- package/template/src/components/user/Tabs.astro +2 -2
- package/template/src/layouts/Layout.astro +13 -156
- package/template/src/lib/assistant-chrome-defaults.ts +86 -0
- package/template/src/lib/assistant-chrome.ts +39 -0
- package/template/src/lib/assistant-embed-script.ts +1088 -0
- package/template/src/lib/assistant-panel-config.ts +80 -0
- package/template/src/lib/favicon.ts +31 -0
- package/template/src/lib/theme-css.ts +176 -0
- package/template/src/lib/validation.ts +668 -41
- package/template/src/pages/-/assistant/embed.js.ts +15 -0
- package/template/src/pages/-/assistant/panel.astro +5 -0
- package/template/src/pages/404.astro +4 -4
- package/template/src/styles/global.css +81 -4
- package/template/src/components/chat/AskAiWidget.tsx +0 -2011
|
@@ -0,0 +1,615 @@
|
|
|
1
|
+
import type { JSX } from "preact";
|
|
2
|
+
import { navigate } from "astro:transitions/client";
|
|
3
|
+
import { useEffect, useRef, useState } from "preact/hooks";
|
|
4
|
+
import AssistantEmbedPanel, {
|
|
5
|
+
ASSISTANT_PANEL_STORAGE_KEY,
|
|
6
|
+
AssistantPanelIcon,
|
|
7
|
+
type AssistantPanelSize,
|
|
8
|
+
} from "./AssistantEmbedPanel";
|
|
9
|
+
import {
|
|
10
|
+
DEFAULT_ASSISTANT_CHROME_CONFIG,
|
|
11
|
+
type AssistantChromeConfig,
|
|
12
|
+
} from "../../lib/assistant-chrome-defaults";
|
|
13
|
+
|
|
14
|
+
type AssistantDocsWidgetProps = {
|
|
15
|
+
apiPath: string;
|
|
16
|
+
docsTitle: string;
|
|
17
|
+
isChatAvailable: boolean;
|
|
18
|
+
canSendChatRequest: boolean;
|
|
19
|
+
launcherThemeColor?: string;
|
|
20
|
+
launcherThemeColors?: {
|
|
21
|
+
light: string;
|
|
22
|
+
dark: string;
|
|
23
|
+
};
|
|
24
|
+
launcherIconColor?: string;
|
|
25
|
+
launcherIconColors?: {
|
|
26
|
+
light: string;
|
|
27
|
+
dark: string;
|
|
28
|
+
};
|
|
29
|
+
launcherIconImageSrc?: string;
|
|
30
|
+
emptyStateHeading?: string;
|
|
31
|
+
emptyStateQuestions?: string[];
|
|
32
|
+
devProxyToken?: string;
|
|
33
|
+
chrome?: AssistantChromeConfig;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
type AssistantOpenRequestWindow = Window & {
|
|
37
|
+
__assistantOpenRequested?: boolean;
|
|
38
|
+
__assistantToggleRequested?: boolean;
|
|
39
|
+
__assistantDocsLauncherEntered?: boolean;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
function normalizePanelSize(value: unknown): AssistantPanelSize {
|
|
43
|
+
return value === "expanded" ? "expanded" : "default";
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function readPersistedPanelSize(): AssistantPanelSize {
|
|
47
|
+
if (typeof window === "undefined") {
|
|
48
|
+
return "default";
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
try {
|
|
52
|
+
const rawState = window.localStorage.getItem(ASSISTANT_PANEL_STORAGE_KEY);
|
|
53
|
+
if (!rawState) {
|
|
54
|
+
return "default";
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const parsed = JSON.parse(rawState) as { panelSize?: unknown };
|
|
58
|
+
return normalizePanelSize(parsed.panelSize);
|
|
59
|
+
} catch {
|
|
60
|
+
return "default";
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export default function AssistantDocsWidget({
|
|
65
|
+
apiPath,
|
|
66
|
+
docsTitle,
|
|
67
|
+
isChatAvailable,
|
|
68
|
+
canSendChatRequest,
|
|
69
|
+
launcherThemeColor,
|
|
70
|
+
launcherThemeColors,
|
|
71
|
+
launcherIconColor,
|
|
72
|
+
launcherIconColors,
|
|
73
|
+
launcherIconImageSrc,
|
|
74
|
+
emptyStateHeading,
|
|
75
|
+
emptyStateQuestions,
|
|
76
|
+
devProxyToken,
|
|
77
|
+
chrome,
|
|
78
|
+
}: AssistantDocsWidgetProps) {
|
|
79
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
80
|
+
const [panelSize, setPanelSize] = useState<AssistantPanelSize>(() =>
|
|
81
|
+
readPersistedPanelSize(),
|
|
82
|
+
);
|
|
83
|
+
const [panelSizeTransition, setPanelSizeTransition] = useState<
|
|
84
|
+
"expand" | "collapse" | ""
|
|
85
|
+
>("");
|
|
86
|
+
const [openSignal, setOpenSignal] = useState(0);
|
|
87
|
+
const [isNavigationTransitionSuppressed, setIsNavigationTransitionSuppressed] =
|
|
88
|
+
useState(false);
|
|
89
|
+
const [hasLauncherEntered, setHasLauncherEntered] = useState(() => {
|
|
90
|
+
if (typeof window === "undefined") {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return Boolean(
|
|
95
|
+
(window as AssistantOpenRequestWindow).__assistantDocsLauncherEntered,
|
|
96
|
+
);
|
|
97
|
+
});
|
|
98
|
+
const widgetRef = useRef<HTMLDivElement | null>(null);
|
|
99
|
+
const navigationTransitionCleanupRef = useRef<(() => void) | null>(null);
|
|
100
|
+
const navigationTransitionTimeoutRef = useRef<number | null>(null);
|
|
101
|
+
const panelSizeTransitionTimeoutRef = useRef<number | null>(null);
|
|
102
|
+
const chromeConfig = chrome ?? DEFAULT_ASSISTANT_CHROME_CONFIG;
|
|
103
|
+
const numericZIndex =
|
|
104
|
+
Number.parseInt(chromeConfig.zIndex, 10) ||
|
|
105
|
+
Number.parseInt(DEFAULT_ASSISTANT_CHROME_CONFIG.zIndex, 10);
|
|
106
|
+
const launcherThemeColorLight =
|
|
107
|
+
launcherThemeColors?.light ?? launcherThemeColor ?? "#171717";
|
|
108
|
+
const launcherThemeColorDark =
|
|
109
|
+
launcherThemeColors?.dark ?? launcherThemeColor ?? "#171717";
|
|
110
|
+
const launcherIconColorLight =
|
|
111
|
+
launcherIconColors?.light ?? launcherIconColor ?? "#ffffff";
|
|
112
|
+
const launcherIconColorDark =
|
|
113
|
+
launcherIconColors?.dark ?? launcherIconColor ?? "#ffffff";
|
|
114
|
+
const rootStyle = {
|
|
115
|
+
"--assistant-docs-theme-light": launcherThemeColorLight,
|
|
116
|
+
"--assistant-docs-theme-dark": launcherThemeColorDark,
|
|
117
|
+
"--assistant-docs-icon-color-light": launcherIconColorLight,
|
|
118
|
+
"--assistant-docs-icon-color-dark": launcherIconColorDark,
|
|
119
|
+
"--assistant-docs-z-index": String(numericZIndex),
|
|
120
|
+
"--assistant-docs-launcher-z-index": String(numericZIndex + 1),
|
|
121
|
+
"--assistant-docs-mobile-panel-z-index": String(numericZIndex + 2),
|
|
122
|
+
"--assistant-docs-offset-x": chromeConfig.offsetX,
|
|
123
|
+
"--assistant-docs-offset-y": chromeConfig.offsetY,
|
|
124
|
+
"--assistant-docs-mobile-offset-x": chromeConfig.mobileOffsetX,
|
|
125
|
+
"--assistant-docs-mobile-offset-y": chromeConfig.mobileOffsetY,
|
|
126
|
+
"--assistant-docs-launcher-size": chromeConfig.launcherSize,
|
|
127
|
+
"--assistant-docs-launcher-icon-size": chromeConfig.launcherIconSize,
|
|
128
|
+
"--assistant-docs-launcher-shadow": chromeConfig.launcherShadow,
|
|
129
|
+
"--assistant-docs-panel-width": chromeConfig.panelWidth,
|
|
130
|
+
"--assistant-docs-panel-height": chromeConfig.panelHeight,
|
|
131
|
+
"--assistant-docs-panel-expanded-width": chromeConfig.panelExpandedWidth,
|
|
132
|
+
"--assistant-docs-panel-expanded-height": chromeConfig.panelExpandedHeight,
|
|
133
|
+
"--assistant-docs-panel-viewport-margin": chromeConfig.panelViewportMargin,
|
|
134
|
+
"--assistant-docs-panel-gap": chromeConfig.panelGap,
|
|
135
|
+
"--assistant-docs-panel-radius": chromeConfig.panelRadius,
|
|
136
|
+
"--assistant-docs-panel-border": chromeConfig.panelBorder,
|
|
137
|
+
"--assistant-docs-panel-background": chromeConfig.panelBackground,
|
|
138
|
+
"--assistant-docs-panel-dark-border": chromeConfig.panelDarkBorder,
|
|
139
|
+
"--assistant-docs-panel-dark-background": chromeConfig.panelDarkBackground,
|
|
140
|
+
"--assistant-docs-panel-backdrop-blur": chromeConfig.panelBackdropBlur,
|
|
141
|
+
"--assistant-docs-panel-shadow": chromeConfig.panelShadow,
|
|
142
|
+
"--assistant-docs-panel-dark-shadow": chromeConfig.panelDarkShadow,
|
|
143
|
+
"--assistant-docs-panel-open-scale": chromeConfig.panelOpenScale,
|
|
144
|
+
"--assistant-docs-panel-open-duration": chromeConfig.panelOpenDuration,
|
|
145
|
+
"--assistant-docs-panel-open-timing": chromeConfig.panelOpenTiming,
|
|
146
|
+
"--assistant-docs-panel-size-duration": chromeConfig.panelSizeDuration,
|
|
147
|
+
"--assistant-docs-panel-size-timing": chromeConfig.panelSizeTiming,
|
|
148
|
+
"--assistant-docs-panel-close-duration": chromeConfig.panelCloseDuration,
|
|
149
|
+
"--assistant-docs-panel-close-timing": chromeConfig.panelCloseTiming,
|
|
150
|
+
} as JSX.CSSProperties;
|
|
151
|
+
|
|
152
|
+
const openPanel = () => {
|
|
153
|
+
setIsOpen((wasOpen) => {
|
|
154
|
+
if (!wasOpen) {
|
|
155
|
+
setOpenSignal((previous) => previous + 1);
|
|
156
|
+
}
|
|
157
|
+
return true;
|
|
158
|
+
});
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const closePanel = () => {
|
|
162
|
+
setIsOpen(false);
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
const togglePanel = () => {
|
|
166
|
+
setIsOpen((wasOpen) => {
|
|
167
|
+
if (!wasOpen) {
|
|
168
|
+
setOpenSignal((previous) => previous + 1);
|
|
169
|
+
}
|
|
170
|
+
return !wasOpen;
|
|
171
|
+
});
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
const handlePanelSizeChange = (nextPanelSize: AssistantPanelSize) => {
|
|
175
|
+
setPanelSize((previousSize) => {
|
|
176
|
+
if (previousSize === nextPanelSize) {
|
|
177
|
+
return previousSize;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (panelSizeTransitionTimeoutRef.current !== null) {
|
|
181
|
+
window.clearTimeout(panelSizeTransitionTimeoutRef.current);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
setPanelSizeTransition(
|
|
185
|
+
nextPanelSize === "expanded" ? "expand" : "collapse",
|
|
186
|
+
);
|
|
187
|
+
panelSizeTransitionTimeoutRef.current = window.setTimeout(() => {
|
|
188
|
+
panelSizeTransitionTimeoutRef.current = null;
|
|
189
|
+
setPanelSizeTransition("");
|
|
190
|
+
}, 480);
|
|
191
|
+
|
|
192
|
+
return nextPanelSize;
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
const setPanelTransitionSuppressed = (isSuppressed: boolean) => {
|
|
197
|
+
setIsNavigationTransitionSuppressed(isSuppressed);
|
|
198
|
+
if (widgetRef.current) {
|
|
199
|
+
widgetRef.current.dataset.suppressTransition = String(isSuppressed);
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
const handleCurrentLinkNavigate = (href: string, sourceElement?: Element) => {
|
|
204
|
+
if (typeof window === "undefined") {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
navigationTransitionCleanupRef.current?.();
|
|
209
|
+
setPanelTransitionSuppressed(true);
|
|
210
|
+
|
|
211
|
+
const finishTransitionSuppression = () => {
|
|
212
|
+
document.removeEventListener(
|
|
213
|
+
"astro:after-swap",
|
|
214
|
+
finishTransitionSuppression,
|
|
215
|
+
);
|
|
216
|
+
if (navigationTransitionTimeoutRef.current !== null) {
|
|
217
|
+
window.clearTimeout(navigationTransitionTimeoutRef.current);
|
|
218
|
+
navigationTransitionTimeoutRef.current = null;
|
|
219
|
+
}
|
|
220
|
+
navigationTransitionCleanupRef.current = null;
|
|
221
|
+
|
|
222
|
+
window.requestAnimationFrame(() => {
|
|
223
|
+
setPanelTransitionSuppressed(false);
|
|
224
|
+
});
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
document.addEventListener("astro:after-swap", finishTransitionSuppression, {
|
|
228
|
+
once: true,
|
|
229
|
+
});
|
|
230
|
+
navigationTransitionTimeoutRef.current = window.setTimeout(
|
|
231
|
+
finishTransitionSuppression,
|
|
232
|
+
1200,
|
|
233
|
+
);
|
|
234
|
+
navigationTransitionCleanupRef.current = finishTransitionSuppression;
|
|
235
|
+
|
|
236
|
+
void navigate(
|
|
237
|
+
href,
|
|
238
|
+
sourceElement ? { sourceElement } : undefined,
|
|
239
|
+
).catch(() => {
|
|
240
|
+
finishTransitionSuppression();
|
|
241
|
+
window.location.assign(href);
|
|
242
|
+
});
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
useEffect(() => {
|
|
246
|
+
const handleOpen = () => {
|
|
247
|
+
(window as AssistantOpenRequestWindow).__assistantOpenRequested = false;
|
|
248
|
+
openPanel();
|
|
249
|
+
};
|
|
250
|
+
const handleToggle = () => {
|
|
251
|
+
(window as AssistantOpenRequestWindow).__assistantToggleRequested = false;
|
|
252
|
+
togglePanel();
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
window.addEventListener("ask-ai:open", handleOpen);
|
|
256
|
+
window.addEventListener("ask-ai:toggle", handleToggle);
|
|
257
|
+
if ((window as AssistantOpenRequestWindow).__assistantOpenRequested) {
|
|
258
|
+
handleOpen();
|
|
259
|
+
}
|
|
260
|
+
if ((window as AssistantOpenRequestWindow).__assistantToggleRequested) {
|
|
261
|
+
handleToggle();
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
return () => {
|
|
265
|
+
window.removeEventListener("ask-ai:open", handleOpen);
|
|
266
|
+
window.removeEventListener("ask-ai:toggle", handleToggle);
|
|
267
|
+
};
|
|
268
|
+
}, []);
|
|
269
|
+
|
|
270
|
+
useEffect(() => {
|
|
271
|
+
return () => {
|
|
272
|
+
navigationTransitionCleanupRef.current?.();
|
|
273
|
+
if (panelSizeTransitionTimeoutRef.current !== null) {
|
|
274
|
+
window.clearTimeout(panelSizeTransitionTimeoutRef.current);
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
}, []);
|
|
278
|
+
|
|
279
|
+
useEffect(() => {
|
|
280
|
+
if (typeof window === "undefined" || hasLauncherEntered) {
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
(window as AssistantOpenRequestWindow).__assistantDocsLauncherEntered = true;
|
|
285
|
+
const launcherEntranceTimeout = window.setTimeout(() => {
|
|
286
|
+
setHasLauncherEntered(true);
|
|
287
|
+
}, 520);
|
|
288
|
+
|
|
289
|
+
return () => {
|
|
290
|
+
window.clearTimeout(launcherEntranceTimeout);
|
|
291
|
+
};
|
|
292
|
+
}, [hasLauncherEntered]);
|
|
293
|
+
|
|
294
|
+
return (
|
|
295
|
+
<div
|
|
296
|
+
ref={widgetRef}
|
|
297
|
+
data-pagefind-ignore
|
|
298
|
+
className="assistant-docs-widget"
|
|
299
|
+
data-side={chromeConfig.side}
|
|
300
|
+
data-launcher-entered={String(hasLauncherEntered)}
|
|
301
|
+
data-suppress-transition={String(isNavigationTransitionSuppressed)}
|
|
302
|
+
style={rootStyle}
|
|
303
|
+
>
|
|
304
|
+
<div
|
|
305
|
+
className="assistant-docs-panel-shell"
|
|
306
|
+
data-state={isOpen ? "open" : "closed"}
|
|
307
|
+
data-size={panelSize}
|
|
308
|
+
data-size-transition={panelSizeTransition}
|
|
309
|
+
>
|
|
310
|
+
<AssistantEmbedPanel
|
|
311
|
+
apiPath={apiPath}
|
|
312
|
+
docsTitle={docsTitle}
|
|
313
|
+
isChatAvailable={isChatAvailable}
|
|
314
|
+
canSendChatRequest={canSendChatRequest}
|
|
315
|
+
launcherThemeColor={launcherThemeColor}
|
|
316
|
+
launcherThemeColors={launcherThemeColors}
|
|
317
|
+
launcherIconColor={launcherIconColor}
|
|
318
|
+
launcherIconColors={launcherIconColors}
|
|
319
|
+
launcherIconImageSrc={launcherIconImageSrc}
|
|
320
|
+
emptyStateHeading={emptyStateHeading}
|
|
321
|
+
emptyStateQuestions={emptyStateQuestions}
|
|
322
|
+
devProxyToken={devProxyToken}
|
|
323
|
+
panelSurface="inline"
|
|
324
|
+
linkTarget="current"
|
|
325
|
+
allowApiPathQueryOverride={false}
|
|
326
|
+
openSignal={openSignal}
|
|
327
|
+
onRequestOpen={openPanel}
|
|
328
|
+
onRequestClose={closePanel}
|
|
329
|
+
onRequestPanelSizeToggle={handlePanelSizeChange}
|
|
330
|
+
onCurrentLinkNavigate={handleCurrentLinkNavigate}
|
|
331
|
+
/>
|
|
332
|
+
</div>
|
|
333
|
+
|
|
334
|
+
<button
|
|
335
|
+
type="button"
|
|
336
|
+
className="assistant-docs-launcher"
|
|
337
|
+
data-open={String(isOpen)}
|
|
338
|
+
onClick={() => {
|
|
339
|
+
if (isOpen) {
|
|
340
|
+
closePanel();
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
openPanel();
|
|
344
|
+
}}
|
|
345
|
+
aria-label={isOpen ? "Close chat" : "Open chat"}
|
|
346
|
+
title={isOpen ? "Close chat" : "Open chat"}
|
|
347
|
+
>
|
|
348
|
+
<AssistantPanelIcon
|
|
349
|
+
color={launcherIconColor}
|
|
350
|
+
imageSrc={launcherIconImageSrc}
|
|
351
|
+
className="assistant-docs-launcher-icon assistant-docs-launcher-mark"
|
|
352
|
+
/>
|
|
353
|
+
<svg
|
|
354
|
+
className="assistant-docs-launcher-icon assistant-docs-launcher-chevron"
|
|
355
|
+
viewBox="0 0 24 24"
|
|
356
|
+
fill="none"
|
|
357
|
+
stroke="currentColor"
|
|
358
|
+
strokeWidth="2.4"
|
|
359
|
+
strokeLinecap="round"
|
|
360
|
+
strokeLinejoin="round"
|
|
361
|
+
aria-hidden="true"
|
|
362
|
+
>
|
|
363
|
+
<path d="m6 9 6 6 6-6" />
|
|
364
|
+
</svg>
|
|
365
|
+
</button>
|
|
366
|
+
|
|
367
|
+
<style>{`
|
|
368
|
+
@keyframes assistant-docs-launcher-enter {
|
|
369
|
+
0% {
|
|
370
|
+
opacity: 0;
|
|
371
|
+
transform: translateY(3px) scale(.96);
|
|
372
|
+
}
|
|
373
|
+
46% {
|
|
374
|
+
opacity: 1;
|
|
375
|
+
transform: translateY(0) scale(1.012);
|
|
376
|
+
}
|
|
377
|
+
72% {
|
|
378
|
+
opacity: 1;
|
|
379
|
+
transform: translateY(0) scale(.998);
|
|
380
|
+
}
|
|
381
|
+
100% {
|
|
382
|
+
opacity: 1;
|
|
383
|
+
transform: translateY(0) scale(1);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.assistant-docs-launcher {
|
|
388
|
+
--assistant-docs-theme: var(--assistant-docs-theme-light);
|
|
389
|
+
--assistant-docs-icon-color: var(--assistant-docs-icon-color-light);
|
|
390
|
+
position: fixed;
|
|
391
|
+
bottom: var(--assistant-docs-offset-y);
|
|
392
|
+
z-index: var(--assistant-docs-launcher-z-index);
|
|
393
|
+
display: inline-flex;
|
|
394
|
+
width: var(--assistant-docs-launcher-size);
|
|
395
|
+
height: var(--assistant-docs-launcher-size);
|
|
396
|
+
align-items: center;
|
|
397
|
+
justify-content: center;
|
|
398
|
+
padding: 0;
|
|
399
|
+
border: 0;
|
|
400
|
+
border-radius: 999px;
|
|
401
|
+
color: var(--assistant-docs-icon-color);
|
|
402
|
+
background: linear-gradient(
|
|
403
|
+
to bottom,
|
|
404
|
+
color-mix(in oklab, var(--assistant-docs-theme) 88%, white),
|
|
405
|
+
color-mix(in oklab, var(--assistant-docs-theme) 90%, black)
|
|
406
|
+
);
|
|
407
|
+
box-shadow: var(--assistant-docs-launcher-shadow);
|
|
408
|
+
cursor: pointer;
|
|
409
|
+
transition: transform 180ms ease, opacity 160ms ease;
|
|
410
|
+
transform-origin: center center;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
.assistant-docs-widget[data-launcher-entered="false"] .assistant-docs-launcher {
|
|
414
|
+
animation: assistant-docs-launcher-enter 460ms linear backwards;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
html.dark .assistant-docs-launcher,
|
|
418
|
+
html[data-theme="dark"] .assistant-docs-launcher {
|
|
419
|
+
--assistant-docs-theme: var(--assistant-docs-theme-dark);
|
|
420
|
+
--assistant-docs-icon-color: var(--assistant-docs-icon-color-dark);
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
.assistant-docs-widget[data-side="right"] .assistant-docs-launcher {
|
|
424
|
+
right: var(--assistant-docs-offset-x);
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
.assistant-docs-widget[data-side="left"] .assistant-docs-launcher {
|
|
428
|
+
left: var(--assistant-docs-offset-x);
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
.assistant-docs-launcher:hover {
|
|
432
|
+
opacity: .96;
|
|
433
|
+
transform: translateY(-1px) scale(1.03);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
.assistant-docs-launcher:active {
|
|
437
|
+
transform: translateY(0) scale(.96);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
.assistant-docs-launcher-icon {
|
|
441
|
+
position: absolute;
|
|
442
|
+
width: var(--assistant-docs-launcher-icon-size);
|
|
443
|
+
height: var(--assistant-docs-launcher-icon-size);
|
|
444
|
+
pointer-events: none;
|
|
445
|
+
transform-origin: center;
|
|
446
|
+
transition: opacity 150ms ease,
|
|
447
|
+
transform 180ms cubic-bezier(.2, .8, .2, 1);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
.assistant-docs-launcher-icon img,
|
|
451
|
+
.assistant-docs-launcher-icon svg {
|
|
452
|
+
display: block;
|
|
453
|
+
width: 100%;
|
|
454
|
+
height: 100%;
|
|
455
|
+
object-fit: contain;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
.assistant-docs-launcher-mark {
|
|
459
|
+
opacity: 1;
|
|
460
|
+
transform: scale(1);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
.assistant-docs-launcher-chevron {
|
|
464
|
+
opacity: 0;
|
|
465
|
+
transform: scale(.55);
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
.assistant-docs-launcher[data-open="true"] .assistant-docs-launcher-mark {
|
|
469
|
+
opacity: 0;
|
|
470
|
+
transform: scale(.55);
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
.assistant-docs-launcher[data-open="true"] .assistant-docs-launcher-chevron {
|
|
474
|
+
opacity: 1;
|
|
475
|
+
transform: scale(1);
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
.assistant-docs-panel-shell {
|
|
479
|
+
--assistant-docs-panel-available-height: calc(
|
|
480
|
+
100dvh -
|
|
481
|
+
var(--assistant-docs-offset-y) -
|
|
482
|
+
var(--assistant-docs-launcher-size) -
|
|
483
|
+
var(--assistant-docs-panel-gap) -
|
|
484
|
+
var(--assistant-docs-panel-viewport-margin)
|
|
485
|
+
);
|
|
486
|
+
position: fixed;
|
|
487
|
+
bottom: calc(
|
|
488
|
+
var(--assistant-docs-offset-y) +
|
|
489
|
+
var(--assistant-docs-launcher-size) +
|
|
490
|
+
var(--assistant-docs-panel-gap)
|
|
491
|
+
);
|
|
492
|
+
z-index: var(--assistant-docs-z-index);
|
|
493
|
+
box-sizing: border-box;
|
|
494
|
+
width: min(var(--assistant-docs-panel-width), calc(100vw - 32px));
|
|
495
|
+
height: min(
|
|
496
|
+
var(--assistant-docs-panel-height),
|
|
497
|
+
var(--assistant-docs-panel-available-height)
|
|
498
|
+
);
|
|
499
|
+
overflow: hidden;
|
|
500
|
+
border: var(--assistant-docs-panel-border);
|
|
501
|
+
border-radius: var(--assistant-docs-panel-radius);
|
|
502
|
+
background: var(--assistant-docs-panel-background);
|
|
503
|
+
box-shadow: var(--assistant-docs-panel-shadow);
|
|
504
|
+
-webkit-backdrop-filter: blur(var(--assistant-docs-panel-backdrop-blur));
|
|
505
|
+
backdrop-filter: blur(var(--assistant-docs-panel-backdrop-blur));
|
|
506
|
+
opacity: 1;
|
|
507
|
+
pointer-events: auto;
|
|
508
|
+
transform: scale(1);
|
|
509
|
+
transform-origin: bottom right;
|
|
510
|
+
transition-property: width, height, transform, opacity, display;
|
|
511
|
+
transition-duration:
|
|
512
|
+
var(--assistant-docs-panel-size-duration),
|
|
513
|
+
var(--assistant-docs-panel-size-duration),
|
|
514
|
+
var(--assistant-docs-panel-open-duration),
|
|
515
|
+
var(--assistant-docs-panel-open-duration),
|
|
516
|
+
var(--assistant-docs-panel-open-duration);
|
|
517
|
+
transition-timing-function:
|
|
518
|
+
var(--assistant-docs-panel-size-timing),
|
|
519
|
+
var(--assistant-docs-panel-size-timing),
|
|
520
|
+
var(--assistant-docs-panel-open-timing),
|
|
521
|
+
var(--assistant-docs-panel-open-timing),
|
|
522
|
+
var(--assistant-docs-panel-open-timing);
|
|
523
|
+
transition-behavior: allow-discrete;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
.assistant-docs-panel-shell[data-size="expanded"] {
|
|
527
|
+
width: min(var(--assistant-docs-panel-expanded-width), calc(100vw - 32px));
|
|
528
|
+
height: min(
|
|
529
|
+
var(--assistant-docs-panel-expanded-height),
|
|
530
|
+
var(--assistant-docs-panel-available-height)
|
|
531
|
+
);
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
.dark .assistant-docs-panel-shell {
|
|
535
|
+
border: var(--assistant-docs-panel-dark-border);
|
|
536
|
+
background: var(--assistant-docs-panel-dark-background);
|
|
537
|
+
box-shadow: var(--assistant-docs-panel-dark-shadow);
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
.assistant-docs-widget[data-side="right"] .assistant-docs-panel-shell {
|
|
541
|
+
right: var(--assistant-docs-offset-x);
|
|
542
|
+
transform-origin: bottom right;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
.assistant-docs-widget[data-side="left"] .assistant-docs-panel-shell {
|
|
546
|
+
left: var(--assistant-docs-offset-x);
|
|
547
|
+
transform-origin: bottom left;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
@starting-style {
|
|
551
|
+
.assistant-docs-panel-shell[data-state="open"] {
|
|
552
|
+
opacity: 0;
|
|
553
|
+
transform: scale(var(--assistant-docs-panel-open-scale));
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
.assistant-docs-panel-shell[data-state="closed"] {
|
|
558
|
+
display: none;
|
|
559
|
+
opacity: 0;
|
|
560
|
+
pointer-events: none;
|
|
561
|
+
transform: scale(var(--assistant-docs-panel-open-scale));
|
|
562
|
+
transition-property: transform, opacity, display;
|
|
563
|
+
transition-duration: var(--assistant-docs-panel-close-duration);
|
|
564
|
+
transition-timing-function: var(--assistant-docs-panel-close-timing);
|
|
565
|
+
transition-behavior: allow-discrete;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
.assistant-docs-widget[data-suppress-transition="true"] .assistant-docs-panel-shell {
|
|
569
|
+
transition: none !important;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
@media (max-width: ${chromeConfig.mobileBreakpoint}), (max-height: ${chromeConfig.panelFullscreenHeightBreakpoint}) {
|
|
573
|
+
.assistant-docs-panel-shell {
|
|
574
|
+
inset: 0 !important;
|
|
575
|
+
z-index: var(--assistant-docs-mobile-panel-z-index) !important;
|
|
576
|
+
width: 100vw !important;
|
|
577
|
+
height: 100dvh !important;
|
|
578
|
+
border: 0 !important;
|
|
579
|
+
border-radius: 0 !important;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
.assistant-docs-panel-shell > div {
|
|
583
|
+
border-radius: 0;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
@media (max-width: ${chromeConfig.mobileBreakpoint}) {
|
|
588
|
+
.assistant-docs-launcher {
|
|
589
|
+
bottom: var(--assistant-docs-mobile-offset-y) !important;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
.assistant-docs-widget[data-side="right"] .assistant-docs-launcher {
|
|
593
|
+
right: var(--assistant-docs-mobile-offset-x) !important;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
.assistant-docs-widget[data-side="left"] .assistant-docs-launcher {
|
|
597
|
+
left: var(--assistant-docs-mobile-offset-x) !important;
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
@media (prefers-reduced-motion: reduce) {
|
|
602
|
+
.assistant-docs-launcher {
|
|
603
|
+
animation: none !important;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
.assistant-docs-launcher,
|
|
607
|
+
.assistant-docs-launcher-icon,
|
|
608
|
+
.assistant-docs-panel-shell {
|
|
609
|
+
transition: none !important;
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
`}</style>
|
|
613
|
+
</div>
|
|
614
|
+
);
|
|
615
|
+
}
|