radiant-docs 0.1.38 → 0.1.40
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 +38 -7
- package/template/package-lock.json +19 -7
- package/template/package.json +1 -1
- package/template/scripts/generate-robots-txt.mjs +29 -1
- package/template/scripts/stamp-image-versions.mjs +59 -33
- package/template/src/components/Footer.astro +2 -1
- package/template/src/components/Header.astro +8 -6
- package/template/src/components/LogoLink.astro +2 -1
- package/template/src/components/MdxPage.astro +15 -4
- package/template/src/components/PagePagination.astro +61 -0
- package/template/src/components/SidebarDropdown.astro +12 -8
- package/template/src/components/SidebarGroup.astro +1 -1
- package/template/src/components/SidebarMenu.astro +1 -1
- package/template/src/components/SidebarSegmented.astro +6 -5
- package/template/src/components/TableOfContents.astro +4 -13
- package/template/src/components/chat/AskAiWidget.tsx +274 -39
- package/template/src/components/endpoint/PlaygroundForm.astro +2 -1
- package/template/src/components/user/CodeBlock.astro +8 -5
- package/template/src/components/user/CodeGroup.astro +262 -14
- package/template/src/components/user/ComponentPreviewBlock.astro +4 -3
- package/template/src/components/user/Image.astro +43 -53
- package/template/src/components/user/Tabs.astro +128 -23
- package/template/src/layouts/Layout.astro +217 -7
- package/template/src/lib/base-path.ts +98 -0
- package/template/src/lib/component-error.ts +49 -10
- package/template/src/lib/mdx/remark-resolve-internal-links.ts +128 -18
- package/template/src/lib/pagefind.ts +62 -14
- package/template/src/lib/routes.ts +49 -1
- package/template/src/lib/static-asset-url.ts +3 -1
- package/template/src/lib/utils.ts +12 -4
- package/template/src/lib/validation.ts +376 -36
- package/template/src/pages/404.astro +2 -1
- package/template/src/pages/[...slug].astro +68 -6
- package/template/src/styles/global.css +85 -1
|
@@ -3,6 +3,7 @@ import Icon from "./ui/Icon.astro";
|
|
|
3
3
|
import { getConfig, type NavMenu } from "../lib/validation";
|
|
4
4
|
import SidebarMenu from "./SidebarMenu.astro";
|
|
5
5
|
import { slugify } from "../lib/utils";
|
|
6
|
+
import { prependBasePath, stripBasePath } from "../lib/base-path";
|
|
6
7
|
import { getAllRoutes } from "../lib/routes";
|
|
7
8
|
|
|
8
9
|
interface Props {
|
|
@@ -12,9 +13,9 @@ interface Props {
|
|
|
12
13
|
|
|
13
14
|
const { menu, parentSlug = "" } = Astro.props;
|
|
14
15
|
|
|
15
|
-
const pathname = Astro.url.pathname;
|
|
16
|
+
const pathname = stripBasePath(Astro.url.pathname);
|
|
16
17
|
const config = await getConfig();
|
|
17
|
-
const routes = await getAllRoutes();
|
|
18
|
+
const routes = (await getAllRoutes()).filter((route) => !route.hidden);
|
|
18
19
|
|
|
19
20
|
let currentMenuIndex = menu.items.findIndex(
|
|
20
21
|
(i) => slugify(i.label) === pathname.split("/")[1],
|
|
@@ -52,8 +53,8 @@ for (const route of routes) {
|
|
|
52
53
|
seen.add(topLevel);
|
|
53
54
|
const href =
|
|
54
55
|
route.type === "mdx" && config.home && route.filePath === config.home
|
|
55
|
-
? "/"
|
|
56
|
-
: `/${slug}
|
|
56
|
+
? prependBasePath("/")
|
|
57
|
+
: prependBasePath(`/${slug}`);
|
|
57
58
|
firstHrefOfMenuItems.push(href);
|
|
58
59
|
}
|
|
59
60
|
}
|
|
@@ -82,7 +83,7 @@ const currentPrefix = parentSlug
|
|
|
82
83
|
? "bg-white dark:bg-neutral-700/30 border-neutral-200/70 dark:border-neutral-700/40 dark:border-b shadow-sm shadow-neutral-200/80 dark:shadow-neutral-950/20 text-neutral-900 dark:text-white"
|
|
83
84
|
: "text-neutral-600 dark:text-neutral-300 border-transparent hover:text-primary dark:hover:text-primary",
|
|
84
85
|
]}
|
|
85
|
-
href={firstHrefOfMenuItems[index] ?? "/"}
|
|
86
|
+
href={firstHrefOfMenuItems[index] ?? prependBasePath("/")}
|
|
86
87
|
>
|
|
87
88
|
{item.icon && <Icon class="mr-2 size-4" name={item.icon} />}
|
|
88
89
|
{item.label}
|
|
@@ -50,7 +50,8 @@ for (const heading of headings) {
|
|
|
50
50
|
d=""
|
|
51
51
|
stroke-width="1.4"
|
|
52
52
|
vector-effect="non-scaling-stroke"
|
|
53
|
-
class="
|
|
53
|
+
class="transition-[stroke-dasharray] duration-200"
|
|
54
|
+
style="stroke: var(--color-theme);"
|
|
54
55
|
fill="none"
|
|
55
56
|
stroke-linecap="round"
|
|
56
57
|
stroke-linejoin="round"></path>
|
|
@@ -329,20 +330,10 @@ for (const heading of headings) {
|
|
|
329
330
|
circles?.forEach((circle) => {
|
|
330
331
|
const slug = (circle as SVGCircleElement).dataset.slug;
|
|
331
332
|
if (slug && visibleSlugs.has(slug)) {
|
|
332
|
-
circle.
|
|
333
|
-
circle.classList.add(
|
|
334
|
-
"fill-neutral-700",
|
|
335
|
-
"dark:fill-neutral-200",
|
|
336
|
-
"delay-100"
|
|
337
|
-
);
|
|
333
|
+
(circle as SVGCircleElement).style.fill = "var(--color-theme)";
|
|
338
334
|
circle.setAttribute("r", "2.75");
|
|
339
335
|
} else {
|
|
340
|
-
circle.
|
|
341
|
-
"fill-neutral-700",
|
|
342
|
-
"dark:fill-neutral-200",
|
|
343
|
-
"delay-100"
|
|
344
|
-
);
|
|
345
|
-
circle.classList.add("fill-neutral-300", "dark:fill-neutral-600");
|
|
336
|
+
(circle as SVGCircleElement).style.fill = "";
|
|
346
337
|
circle.setAttribute("r", "2.25");
|
|
347
338
|
}
|
|
348
339
|
});
|
|
@@ -82,7 +82,7 @@ type PersistedWidgetState = {
|
|
|
82
82
|
const STORAGE_KEY = "radiant-docs:ask-ai-widget:v1";
|
|
83
83
|
const DESKTOP_MIN_WIDTH_PX = 320;
|
|
84
84
|
const DESKTOP_MAX_WIDTH_PX = 768 + 12 + 12;
|
|
85
|
-
const DESKTOP_DEFAULT_WIDTH_PX =
|
|
85
|
+
const DESKTOP_DEFAULT_WIDTH_PX = 448;
|
|
86
86
|
const DESKTOP_MIN_HEIGHT_PX = 320;
|
|
87
87
|
const DESKTOP_DEFAULT_HEIGHT_PX = 448;
|
|
88
88
|
const DESKTOP_MAX_HEIGHT_OFFSET_PX = 20 + 4 + 8;
|
|
@@ -148,7 +148,7 @@ function getDefaultPersistedState(): PersistedWidgetState {
|
|
|
148
148
|
messages: [],
|
|
149
149
|
input: "",
|
|
150
150
|
desktopWidth: DESKTOP_DEFAULT_WIDTH_PX,
|
|
151
|
-
desktopHeight:
|
|
151
|
+
desktopHeight: getDesktopMaxHeightPx(),
|
|
152
152
|
threadScrollTop: 0,
|
|
153
153
|
};
|
|
154
154
|
}
|
|
@@ -201,7 +201,7 @@ function readPersistedState(): PersistedWidgetState {
|
|
|
201
201
|
typeof parsed.desktopHeight === "number" &&
|
|
202
202
|
Number.isFinite(parsed.desktopHeight)
|
|
203
203
|
? parsed.desktopHeight
|
|
204
|
-
:
|
|
204
|
+
: getDesktopMaxHeightPx(),
|
|
205
205
|
threadScrollTop:
|
|
206
206
|
typeof parsed.threadScrollTop === "number" &&
|
|
207
207
|
Number.isFinite(parsed.threadScrollTop) &&
|
|
@@ -1045,11 +1045,16 @@ export default function AskAiWidget({
|
|
|
1045
1045
|
const codeBlockPre = eventTargetElement?.closest(
|
|
1046
1046
|
".ask-ai-markdown pre",
|
|
1047
1047
|
) as HTMLPreElement | null;
|
|
1048
|
+
const codeBlockScroller =
|
|
1049
|
+
(eventTargetElement?.closest(
|
|
1050
|
+
".ask-ai-markdown pre > code",
|
|
1051
|
+
) as HTMLElement | null) ??
|
|
1052
|
+
(codeBlockPre?.querySelector(":scope > code") as HTMLElement | null);
|
|
1048
1053
|
|
|
1049
|
-
if (
|
|
1054
|
+
if (codeBlockScroller) {
|
|
1050
1055
|
const maxScrollLeft = Math.max(
|
|
1051
1056
|
0,
|
|
1052
|
-
|
|
1057
|
+
codeBlockScroller.scrollWidth - codeBlockScroller.clientWidth,
|
|
1053
1058
|
);
|
|
1054
1059
|
const horizontalIntentDelta =
|
|
1055
1060
|
Math.abs(event.deltaX) > 0.01
|
|
@@ -1062,8 +1067,8 @@ export default function AskAiWidget({
|
|
|
1062
1067
|
event.preventDefault();
|
|
1063
1068
|
|
|
1064
1069
|
if (maxScrollLeft > 0) {
|
|
1065
|
-
|
|
1066
|
-
|
|
1070
|
+
codeBlockScroller.scrollLeft = clamp(
|
|
1071
|
+
codeBlockScroller.scrollLeft + horizontalIntentDelta,
|
|
1067
1072
|
0,
|
|
1068
1073
|
maxScrollLeft,
|
|
1069
1074
|
);
|
|
@@ -1422,7 +1427,7 @@ export default function AskAiWidget({
|
|
|
1422
1427
|
>
|
|
1423
1428
|
<div
|
|
1424
1429
|
className={[
|
|
1425
|
-
"ask-ai-markdown prose-rules max-w-full min-w-0 wrap-break-word prose-
|
|
1430
|
+
"ask-ai-markdown prose-rules max-w-full min-w-0 wrap-break-word prose-code:text-neutral-700 dark:prose-code:text-neutral-200 prose-pre:shadow-xs prose-pre:text-neutral-700! dark:prose-pre:text-neutral-100! prose-pre:border prose-pre:border-neutral-200 dark:prose-pre:border-neutral-800 prose-pre:rounded-xl!",
|
|
1426
1431
|
isUser
|
|
1427
1432
|
? "inline-block px-3 py-2 rounded-3xl rounded-br-sm bg-neutral-100 text-neutral-700 dark:bg-neutral-800 dark:text-neutral-100 *:text-left"
|
|
1428
1433
|
: "block w-full bg-transparent text-neutral-900 dark:text-neutral-100",
|
|
@@ -1466,7 +1471,7 @@ export default function AskAiWidget({
|
|
|
1466
1471
|
void handleSubmit(event);
|
|
1467
1472
|
}}
|
|
1468
1473
|
>
|
|
1469
|
-
<div className="bg-white flex gap-2 border border-border rounded-[24px]">
|
|
1474
|
+
<div className="bg-white dark:bg-(--rd-code-surface) flex gap-2 border border-neutral-200 dark:border-neutral-800 rounded-[24px] shadow-xs">
|
|
1470
1475
|
<textarea
|
|
1471
1476
|
ref={chatInputTextareaRef}
|
|
1472
1477
|
value={input}
|
|
@@ -1482,12 +1487,12 @@ export default function AskAiWidget({
|
|
|
1482
1487
|
<div class="p-1 pl-0 mt-auto">
|
|
1483
1488
|
<button
|
|
1484
1489
|
type="submit"
|
|
1485
|
-
className="flex items-center justify-center rounded-full bg-
|
|
1490
|
+
className="flex items-center justify-center rounded-full size-10 bg-linear-to-b from-[var(--color-theme-top)] to-[var(--color-theme-bottom)] text-white disabled:opacity-90 hover:opacity-95 cursor-pointer"
|
|
1486
1491
|
disabled={isBusy || input.trim().length === 0}
|
|
1487
1492
|
>
|
|
1488
1493
|
<Icon
|
|
1489
1494
|
icon="lucide:arrow-up"
|
|
1490
|
-
className="size-5
|
|
1495
|
+
className="size-5 text-white"
|
|
1491
1496
|
aria-hidden="true"
|
|
1492
1497
|
/>
|
|
1493
1498
|
</button>
|
|
@@ -1543,12 +1548,15 @@ export default function AskAiWidget({
|
|
|
1543
1548
|
min-width: 0;
|
|
1544
1549
|
box-sizing: border-box;
|
|
1545
1550
|
padding-top: 2.25rem;
|
|
1546
|
-
|
|
1551
|
+
background: var(--color-neutral-50) !important;
|
|
1552
|
+
overflow-x: hidden;
|
|
1547
1553
|
overflow-y: hidden;
|
|
1548
1554
|
white-space: pre;
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1555
|
+
}
|
|
1556
|
+
|
|
1557
|
+
.dark .ask-ai-markdown pre {
|
|
1558
|
+
background: var(--rd-code-surface) !important;
|
|
1559
|
+
border-color: var(--color-neutral-800) !important;
|
|
1552
1560
|
}
|
|
1553
1561
|
|
|
1554
1562
|
.ask-ai-markdown pre[data-language]::before {
|
|
@@ -1571,6 +1579,10 @@ export default function AskAiWidget({
|
|
|
1571
1579
|
user-select: none;
|
|
1572
1580
|
}
|
|
1573
1581
|
|
|
1582
|
+
.dark .ask-ai-markdown pre[data-language]::before {
|
|
1583
|
+
background-color: var(--color-neutral-400);
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1574
1586
|
.ask-ai-markdown pre[data-language]::after {
|
|
1575
1587
|
content: attr(data-language);
|
|
1576
1588
|
position: absolute;
|
|
@@ -1585,20 +1597,26 @@ export default function AskAiWidget({
|
|
|
1585
1597
|
user-select: none;
|
|
1586
1598
|
}
|
|
1587
1599
|
|
|
1600
|
+
.dark .ask-ai-markdown pre[data-language]::after {
|
|
1601
|
+
color: var(--color-neutral-400);
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1588
1604
|
.ask-ai-markdown .ask-ai-copy-code-button {
|
|
1589
1605
|
position: absolute;
|
|
1590
1606
|
top: 0.3rem;
|
|
1591
1607
|
right: 0.46rem;
|
|
1592
1608
|
z-index: 2;
|
|
1609
|
+
appearance: none;
|
|
1593
1610
|
display: inline-flex;
|
|
1594
1611
|
align-items: center;
|
|
1595
1612
|
justify-content: center;
|
|
1596
1613
|
width: 1.75rem;
|
|
1597
1614
|
height: 1.75rem;
|
|
1598
|
-
border:
|
|
1615
|
+
border: 1px solid
|
|
1616
|
+
color-mix(in oklab, var(--color-neutral-200) 80%, transparent);
|
|
1599
1617
|
background: color-mix(
|
|
1600
1618
|
in oklab,
|
|
1601
|
-
|
|
1619
|
+
#fff 80%,
|
|
1602
1620
|
transparent
|
|
1603
1621
|
);
|
|
1604
1622
|
backdrop-filter: blur(4px);
|
|
@@ -1607,15 +1625,32 @@ export default function AskAiWidget({
|
|
|
1607
1625
|
var(--color-neutral-500) 80%,
|
|
1608
1626
|
transparent
|
|
1609
1627
|
);
|
|
1610
|
-
border-radius:
|
|
1628
|
+
border-radius: 0.375rem;
|
|
1629
|
+
outline: none;
|
|
1630
|
+
box-shadow: none;
|
|
1611
1631
|
cursor: pointer;
|
|
1612
|
-
transition: background-color
|
|
1613
|
-
transform 120ms ease;
|
|
1632
|
+
transition: background-color 150ms ease, color 150ms ease,
|
|
1633
|
+
border-color 150ms ease, transform 120ms ease;
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
.dark .ask-ai-markdown .ask-ai-copy-code-button {
|
|
1637
|
+
border-color: color-mix(
|
|
1638
|
+
in oklab,
|
|
1639
|
+
var(--color-neutral-700) 50%,
|
|
1640
|
+
transparent
|
|
1641
|
+
);
|
|
1642
|
+
background: var(--rd-code-surface);
|
|
1643
|
+
color: var(--color-neutral-400);
|
|
1614
1644
|
}
|
|
1615
1645
|
|
|
1616
1646
|
.ask-ai-markdown .ask-ai-copy-code-button:hover {
|
|
1617
|
-
background: var(--color-neutral-
|
|
1618
|
-
color: var(--color-neutral-
|
|
1647
|
+
background: var(--color-neutral-50);
|
|
1648
|
+
color: var(--color-neutral-600);
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
.dark .ask-ai-markdown .ask-ai-copy-code-button:hover {
|
|
1652
|
+
background: var(--color-neutral-800);
|
|
1653
|
+
color: var(--color-neutral-200);
|
|
1619
1654
|
}
|
|
1620
1655
|
|
|
1621
1656
|
.ask-ai-markdown .ask-ai-copy-code-button:active {
|
|
@@ -1623,8 +1658,13 @@ export default function AskAiWidget({
|
|
|
1623
1658
|
}
|
|
1624
1659
|
|
|
1625
1660
|
.ask-ai-markdown .ask-ai-copy-code-button:focus-visible {
|
|
1626
|
-
outline:
|
|
1627
|
-
|
|
1661
|
+
outline: none;
|
|
1662
|
+
box-shadow: none;
|
|
1663
|
+
}
|
|
1664
|
+
|
|
1665
|
+
.dark .ask-ai-markdown .ask-ai-copy-code-button:focus-visible {
|
|
1666
|
+
outline: none;
|
|
1667
|
+
box-shadow: none;
|
|
1628
1668
|
}
|
|
1629
1669
|
|
|
1630
1670
|
.ask-ai-markdown .ask-ai-copy-icon,
|
|
@@ -1669,6 +1709,14 @@ export default function AskAiWidget({
|
|
|
1669
1709
|
mask-size: contain;
|
|
1670
1710
|
}
|
|
1671
1711
|
|
|
1712
|
+
.dark .ask-ai-markdown .ask-ai-copy-check-icon {
|
|
1713
|
+
background-color: color-mix(
|
|
1714
|
+
in oklab,
|
|
1715
|
+
var(--color-green-400) 90%,
|
|
1716
|
+
transparent
|
|
1717
|
+
);
|
|
1718
|
+
}
|
|
1719
|
+
|
|
1672
1720
|
.ask-ai-markdown .ask-ai-copy-code-button[data-copied="true"] .ask-ai-copy-icon {
|
|
1673
1721
|
opacity: 0;
|
|
1674
1722
|
transform: scale(0.5) rotate(-6deg);
|
|
@@ -1681,36 +1729,222 @@ export default function AskAiWidget({
|
|
|
1681
1729
|
|
|
1682
1730
|
.ask-ai-markdown pre > code {
|
|
1683
1731
|
display: block;
|
|
1684
|
-
|
|
1732
|
+
width: 100%;
|
|
1733
|
+
min-width: 100%;
|
|
1734
|
+
background: transparent !important;
|
|
1685
1735
|
white-space: inherit;
|
|
1686
1736
|
word-break: normal;
|
|
1687
1737
|
overflow-wrap: normal;
|
|
1738
|
+
overflow-x: auto;
|
|
1739
|
+
overflow-y: hidden;
|
|
1740
|
+
-webkit-overflow-scrolling: touch;
|
|
1741
|
+
scrollbar-width: none;
|
|
1742
|
+
-ms-overflow-style: none;
|
|
1688
1743
|
}
|
|
1689
1744
|
|
|
1690
|
-
.ask-ai-markdown pre
|
|
1691
|
-
|
|
1745
|
+
.dark .ask-ai-markdown pre > code {
|
|
1746
|
+
scrollbar-width: none;
|
|
1692
1747
|
}
|
|
1693
1748
|
|
|
1694
|
-
.ask-ai-markdown pre
|
|
1749
|
+
.ask-ai-markdown pre[class*="language-"] {
|
|
1750
|
+
background: var(--color-neutral-50) !important;
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1753
|
+
.ask-ai-markdown pre[class*="language-"] > code[class*="language-"] {
|
|
1754
|
+
background: transparent !important;
|
|
1755
|
+
}
|
|
1756
|
+
|
|
1757
|
+
.ask-ai-markdown :not(pre) > code[class*="language-"] {
|
|
1695
1758
|
background: var(--color-neutral-100);
|
|
1696
|
-
border-radius: 999px;
|
|
1697
1759
|
}
|
|
1698
1760
|
|
|
1699
|
-
.ask-ai-markdown pre
|
|
1700
|
-
background: var(--
|
|
1701
|
-
border-
|
|
1702
|
-
|
|
1761
|
+
.dark .ask-ai-markdown pre[class*="language-"] {
|
|
1762
|
+
background: var(--rd-code-surface) !important;
|
|
1763
|
+
border-color: var(--color-neutral-800) !important;
|
|
1764
|
+
}
|
|
1765
|
+
|
|
1766
|
+
.dark .ask-ai-markdown pre[class*="language-"] > code[class*="language-"] {
|
|
1767
|
+
background: transparent !important;
|
|
1768
|
+
}
|
|
1769
|
+
|
|
1770
|
+
.dark .ask-ai-markdown pre[class*="language-"],
|
|
1771
|
+
.dark .ask-ai-markdown code[class*="language-"] {
|
|
1772
|
+
color: var(--color-neutral-100);
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1775
|
+
.dark .ask-ai-markdown :not(pre) > code[class*="language-"] {
|
|
1776
|
+
background: var(--color-neutral-800);
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1779
|
+
.dark .ask-ai-markdown .token.comment,
|
|
1780
|
+
.dark .ask-ai-markdown .token.prolog,
|
|
1781
|
+
.dark .ask-ai-markdown .token.doctype,
|
|
1782
|
+
.dark .ask-ai-markdown .token.cdata {
|
|
1783
|
+
color: #7f848e;
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1786
|
+
.dark .ask-ai-markdown .token.punctuation {
|
|
1787
|
+
color: #abb2bf;
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1790
|
+
.dark .ask-ai-markdown .token.property,
|
|
1791
|
+
.dark .ask-ai-markdown .token.tag,
|
|
1792
|
+
.dark .ask-ai-markdown .token.boolean,
|
|
1793
|
+
.dark .ask-ai-markdown .token.number,
|
|
1794
|
+
.dark .ask-ai-markdown .token.constant,
|
|
1795
|
+
.dark .ask-ai-markdown .token.symbol,
|
|
1796
|
+
.dark .ask-ai-markdown .token.deleted {
|
|
1797
|
+
color: #d19a66;
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1800
|
+
.dark .ask-ai-markdown .token.selector,
|
|
1801
|
+
.dark .ask-ai-markdown .token.attr-name,
|
|
1802
|
+
.dark .ask-ai-markdown .token.string,
|
|
1803
|
+
.dark .ask-ai-markdown .token.char,
|
|
1804
|
+
.dark .ask-ai-markdown .token.builtin,
|
|
1805
|
+
.dark .ask-ai-markdown .token.inserted {
|
|
1806
|
+
color: #98c379;
|
|
1807
|
+
}
|
|
1808
|
+
|
|
1809
|
+
.dark .ask-ai-markdown .token.operator,
|
|
1810
|
+
.dark .ask-ai-markdown .token.entity,
|
|
1811
|
+
.dark .ask-ai-markdown .token.url,
|
|
1812
|
+
.dark .ask-ai-markdown .language-css .token.string,
|
|
1813
|
+
.dark .ask-ai-markdown .style .token.string {
|
|
1814
|
+
color: #56b6c2;
|
|
1815
|
+
}
|
|
1816
|
+
|
|
1817
|
+
.dark .ask-ai-markdown .token.atrule,
|
|
1818
|
+
.dark .ask-ai-markdown .token.attr-value,
|
|
1819
|
+
.dark .ask-ai-markdown .token.keyword {
|
|
1820
|
+
color: #c678dd;
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1823
|
+
.dark .ask-ai-markdown .token.function,
|
|
1824
|
+
.dark .ask-ai-markdown .token.class-name {
|
|
1825
|
+
color: #e5c07b;
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1828
|
+
.dark .ask-ai-markdown .token.regex,
|
|
1829
|
+
.dark .ask-ai-markdown .token.important,
|
|
1830
|
+
.dark .ask-ai-markdown .token.variable {
|
|
1831
|
+
color: #e06c75;
|
|
1832
|
+
}
|
|
1833
|
+
|
|
1834
|
+
.dark .ask-ai-markdown .token.attr-value > .token.punctuation.attr-equals,
|
|
1835
|
+
.dark
|
|
1836
|
+
.ask-ai-markdown
|
|
1837
|
+
.token.special-attr
|
|
1838
|
+
> .token.attr-value
|
|
1839
|
+
> .token.value.css {
|
|
1840
|
+
color: #abb2bf;
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1843
|
+
.dark .ask-ai-markdown .language-css .token.selector {
|
|
1844
|
+
color: #d19a66;
|
|
1845
|
+
}
|
|
1846
|
+
|
|
1847
|
+
.dark .ask-ai-markdown .language-css .token.property {
|
|
1848
|
+
color: #abb2bf;
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1851
|
+
.dark .ask-ai-markdown .language-css .token.function,
|
|
1852
|
+
.dark .ask-ai-markdown .language-css .token.url > .token.function {
|
|
1853
|
+
color: #56b6c2;
|
|
1854
|
+
}
|
|
1855
|
+
|
|
1856
|
+
.dark .ask-ai-markdown .language-css .token.url > .token.string.url {
|
|
1857
|
+
color: #98c379;
|
|
1858
|
+
}
|
|
1859
|
+
|
|
1860
|
+
.dark .ask-ai-markdown .language-css .token.important,
|
|
1861
|
+
.dark .ask-ai-markdown .language-css .token.atrule .token.rule {
|
|
1862
|
+
color: #c678dd;
|
|
1863
|
+
}
|
|
1864
|
+
|
|
1865
|
+
.dark .ask-ai-markdown .language-javascript .token.operator {
|
|
1866
|
+
color: #c678dd;
|
|
1867
|
+
}
|
|
1868
|
+
|
|
1869
|
+
.dark
|
|
1870
|
+
.ask-ai-markdown
|
|
1871
|
+
.language-javascript
|
|
1872
|
+
.token.template-string
|
|
1873
|
+
> .token.interpolation
|
|
1874
|
+
> .token.interpolation-punctuation.punctuation {
|
|
1875
|
+
color: #e06c75;
|
|
1876
|
+
}
|
|
1877
|
+
|
|
1878
|
+
.dark .ask-ai-markdown .language-json .token.operator {
|
|
1879
|
+
color: #abb2bf;
|
|
1880
|
+
}
|
|
1881
|
+
|
|
1882
|
+
.dark .ask-ai-markdown .language-json .token.null.keyword {
|
|
1883
|
+
color: #d19a66;
|
|
1884
|
+
}
|
|
1885
|
+
|
|
1886
|
+
.dark .ask-ai-markdown .language-markdown .token.url,
|
|
1887
|
+
.dark .ask-ai-markdown .language-markdown .token.url > .token.operator,
|
|
1888
|
+
.dark
|
|
1889
|
+
.ask-ai-markdown
|
|
1890
|
+
.language-markdown
|
|
1891
|
+
.token.url-reference.url
|
|
1892
|
+
> .token.string {
|
|
1893
|
+
color: #abb2bf;
|
|
1894
|
+
}
|
|
1895
|
+
|
|
1896
|
+
.dark .ask-ai-markdown .language-markdown .token.url > .token.content {
|
|
1897
|
+
color: #56b6c2;
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1900
|
+
.dark .ask-ai-markdown .language-markdown .token.url > .token.url,
|
|
1901
|
+
.dark .ask-ai-markdown .language-markdown .token.url-reference.url {
|
|
1902
|
+
color: #98c379;
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
.dark .ask-ai-markdown .language-markdown .token.blockquote.punctuation,
|
|
1906
|
+
.dark .ask-ai-markdown .language-markdown .token.hr.punctuation {
|
|
1907
|
+
color: #7f848e;
|
|
1908
|
+
}
|
|
1909
|
+
|
|
1910
|
+
.dark .ask-ai-markdown .language-markdown .token.code-snippet {
|
|
1911
|
+
color: #98c379;
|
|
1912
|
+
}
|
|
1913
|
+
|
|
1914
|
+
.dark .ask-ai-markdown .language-markdown .token.bold .token.content {
|
|
1915
|
+
color: #e5c07b;
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1918
|
+
.dark .ask-ai-markdown .language-markdown .token.italic .token.content {
|
|
1919
|
+
color: #c678dd;
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1922
|
+
.dark .ask-ai-markdown .language-markdown .token.strike .token.content,
|
|
1923
|
+
.dark
|
|
1924
|
+
.ask-ai-markdown
|
|
1925
|
+
.language-markdown
|
|
1926
|
+
.token.strike
|
|
1927
|
+
.token.punctuation,
|
|
1928
|
+
.dark .ask-ai-markdown .language-markdown .token.list.punctuation,
|
|
1929
|
+
.dark
|
|
1930
|
+
.ask-ai-markdown
|
|
1931
|
+
.language-markdown
|
|
1932
|
+
.token.title.important
|
|
1933
|
+
> .token.punctuation {
|
|
1934
|
+
color: #e06c75;
|
|
1703
1935
|
}
|
|
1704
1936
|
|
|
1705
|
-
.ask-ai-markdown pre::-webkit-scrollbar
|
|
1706
|
-
|
|
1937
|
+
.ask-ai-markdown pre > code::-webkit-scrollbar {
|
|
1938
|
+
width: 0;
|
|
1939
|
+
height: 0;
|
|
1940
|
+
display: none;
|
|
1707
1941
|
}
|
|
1708
1942
|
`}</style>
|
|
1709
1943
|
{!isOpen ? (
|
|
1710
1944
|
<div className="fixed bottom-5 right-5 size-12 z-40 bg-background rounded-full hover:scale-105 transition duration-300 ease-in-out">
|
|
1711
1945
|
<button
|
|
1712
1946
|
type="button"
|
|
1713
|
-
className="w-full h-full inline-flex items-center justify-center gap-2 rounded-full bg-linear-to-b from-
|
|
1947
|
+
className="w-full h-full inline-flex items-center justify-center gap-2 rounded-full bg-linear-to-b from-[var(--color-theme-top)] to-[var(--color-theme-bottom)] text-[var(--color-theme-foreground)] shadow-xl dark:shadow-white/5 hover:opacity-95 cursor-pointer"
|
|
1714
1948
|
onClick={() => handleOpenChange(true)}
|
|
1715
1949
|
data-pagefind-ignore
|
|
1716
1950
|
>
|
|
@@ -1718,7 +1952,8 @@ export default function AskAiWidget({
|
|
|
1718
1952
|
src={sparkleIcon}
|
|
1719
1953
|
alt=""
|
|
1720
1954
|
aria-hidden="true"
|
|
1721
|
-
className="size-4
|
|
1955
|
+
className="size-4"
|
|
1956
|
+
style={{ filter: "var(--color-theme-icon-filter)" }}
|
|
1722
1957
|
/>
|
|
1723
1958
|
</button>
|
|
1724
1959
|
</div>
|
|
@@ -1744,12 +1979,12 @@ export default function AskAiWidget({
|
|
|
1744
1979
|
</Drawer.Root>
|
|
1745
1980
|
) : isOpen ? (
|
|
1746
1981
|
<div
|
|
1747
|
-
className="fixed bottom-4 right-4 z-50"
|
|
1982
|
+
className="fixed bottom-4 right-4 z-50 dark:bg-neutral-800 rounded-2xl"
|
|
1748
1983
|
data-pagefind-ignore
|
|
1749
1984
|
onWheelCapture={handleDesktopWheelCapture}
|
|
1750
1985
|
>
|
|
1751
1986
|
<div
|
|
1752
|
-
className="relative flex flex-col overflow-hidden rounded-2xl border border-border bg-background shadow-[0_6px_20px_rgba(0,0,0,0.2)] shadow-neutral-300. shadow-black/15"
|
|
1987
|
+
className="relative flex flex-col overflow-hidden rounded-2xl border border-border bg-background dark:bg-neutral-900/80 shadow-[0_6px_20px_rgba(0,0,0,0.2)] shadow-neutral-300. shadow-black/15"
|
|
1753
1988
|
style={{
|
|
1754
1989
|
width: `${desktopPanelWidth}px`,
|
|
1755
1990
|
height: `${desktopPanelHeight}px`,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
import { Icon } from "astro-icon/components";
|
|
3
|
+
import { withBasePath } from "../../lib/base-path";
|
|
3
4
|
import type { OpenApiRoute } from "../../lib/routes";
|
|
4
5
|
import { getConfig } from "../../lib/validation";
|
|
5
6
|
import { renderMarkdown } from "../../lib/utils";
|
|
@@ -37,7 +38,7 @@ const configuredProxyUrl =
|
|
|
37
38
|
typeof import.meta.env.PUBLIC_PROXY_URL === "string"
|
|
38
39
|
? import.meta.env.PUBLIC_PROXY_URL.trim()
|
|
39
40
|
: "";
|
|
40
|
-
const proxyUrl = configuredProxyUrl || "/_platform/proxy";
|
|
41
|
+
const proxyUrl = configuredProxyUrl || withBasePath("/_platform/proxy");
|
|
41
42
|
const proxyEnabled = config.playground?.proxy !== false && proxyUrl.length > 0;
|
|
42
43
|
const formattedBodyDescription = bodyDescription
|
|
43
44
|
? await renderMarkdown(bodyDescription)
|
|
@@ -256,8 +256,8 @@ const renderedCodeLinesHtml = normalizedTokenLines
|
|
|
256
256
|
|
|
257
257
|
<div
|
|
258
258
|
class:list={[
|
|
259
|
-
"group/prose-code not-prose relative w-full max-w-full min-w-0",
|
|
260
|
-
parsedInCodeGroup ? "my-0" : "my-6",
|
|
259
|
+
"group/prose-code not-prose relative w-full max-w-full min-w-0 rounded-xl",
|
|
260
|
+
parsedInCodeGroup ? "my-0" : "my-6 shadow-xs",
|
|
261
261
|
]}
|
|
262
262
|
data-rd-code-block-root="true"
|
|
263
263
|
data-rd-collapsed-lines={collapsedLinesValue}
|
|
@@ -271,7 +271,7 @@ const renderedCodeLinesHtml = normalizedTokenLines
|
|
|
271
271
|
>
|
|
272
272
|
<div
|
|
273
273
|
class:list={[
|
|
274
|
-
"w-full max-w-full min-w-0 overflow-hidden border border-neutral-200 bg-white
|
|
274
|
+
"w-full max-w-full min-w-0 overflow-hidden border border-neutral-200 bg-white dark:border-neutral-800 dark:bg-(--rd-code-surface)",
|
|
275
275
|
parsedInCodeGroup ? "rounded-t-none rounded-b-xl" : "rounded-xl",
|
|
276
276
|
]}
|
|
277
277
|
>
|
|
@@ -322,7 +322,10 @@ const renderedCodeLinesHtml = normalizedTokenLines
|
|
|
322
322
|
) : null
|
|
323
323
|
}
|
|
324
324
|
|
|
325
|
-
<div
|
|
325
|
+
<div
|
|
326
|
+
class="relative min-w-0"
|
|
327
|
+
data-rd-code-group-panel={parsedInCodeGroup ? "true" : undefined}
|
|
328
|
+
>
|
|
326
329
|
{
|
|
327
330
|
!parsedInCodeGroup && !parsedShowFilename ? (
|
|
328
331
|
<div class="pointer-events-none absolute right-2 top-2 z-20">
|
|
@@ -373,7 +376,7 @@ const renderedCodeLinesHtml = normalizedTokenLines
|
|
|
373
376
|
</div>
|
|
374
377
|
</div>
|
|
375
378
|
</div>
|
|
376
|
-
<script is:inline>
|
|
379
|
+
<script is:inline data-astro-rerun>
|
|
377
380
|
(() => {
|
|
378
381
|
const script = document.currentScript;
|
|
379
382
|
if (!(script instanceof HTMLScriptElement)) return;
|