@openpkg-ts/ui 0.6.2 → 0.7.0
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/dist/docskit/index.d.ts +144 -93
- package/dist/docskit/index.js +614 -452
- package/package.json +3 -3
- package/src/styles/docskit.css +8 -2
- package/src/styles/tokens.css +38 -10
package/dist/docskit/index.js
CHANGED
|
@@ -304,7 +304,11 @@ var collapseContent = {
|
|
|
304
304
|
name: "CollapseContent",
|
|
305
305
|
Block: CollapsibleContent2
|
|
306
306
|
};
|
|
307
|
-
var collapse = [
|
|
307
|
+
var collapse = [
|
|
308
|
+
collapseRoot,
|
|
309
|
+
collapseTrigger,
|
|
310
|
+
collapseContent
|
|
311
|
+
];
|
|
308
312
|
|
|
309
313
|
// src/docskit/diff.tsx
|
|
310
314
|
import { InnerLine as InnerLine4 } from "codehike/code";
|
|
@@ -825,7 +829,10 @@ function InlineCodeSkeleton() {
|
|
|
825
829
|
className: "inline-block h-5 w-16 bg-openpkg-code-border/20 rounded border border-openpkg-code-border animate-pulse align-middle"
|
|
826
830
|
});
|
|
827
831
|
}
|
|
828
|
-
function CodeTabsSkeleton({
|
|
832
|
+
function CodeTabsSkeleton({
|
|
833
|
+
tabs = 2,
|
|
834
|
+
lines = 6
|
|
835
|
+
}) {
|
|
829
836
|
const id = useId();
|
|
830
837
|
const lineWidths = Array.from({ length: lines }, (_, i) => {
|
|
831
838
|
const widths = ["40%", "65%", "55%", "80%", "45%", "70%"];
|
|
@@ -862,28 +869,40 @@ function CodeTabsSkeleton({ tabs = 2, lines = 6 }) {
|
|
|
862
869
|
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
863
870
|
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
864
871
|
|
|
865
|
-
function Tabs({
|
|
872
|
+
function Tabs({
|
|
873
|
+
className,
|
|
874
|
+
...props
|
|
875
|
+
}) {
|
|
866
876
|
return /* @__PURE__ */ jsx21(TabsPrimitive.Root, {
|
|
867
877
|
"data-slot": "tabs",
|
|
868
878
|
className: cn("flex flex-col gap-2", className),
|
|
869
879
|
...props
|
|
870
880
|
});
|
|
871
881
|
}
|
|
872
|
-
function TabsList({
|
|
882
|
+
function TabsList({
|
|
883
|
+
className,
|
|
884
|
+
...props
|
|
885
|
+
}) {
|
|
873
886
|
return /* @__PURE__ */ jsx21(TabsPrimitive.List, {
|
|
874
887
|
"data-slot": "tabs-list",
|
|
875
888
|
className: cn("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]", className),
|
|
876
889
|
...props
|
|
877
890
|
});
|
|
878
891
|
}
|
|
879
|
-
function TabsTrigger({
|
|
892
|
+
function TabsTrigger({
|
|
893
|
+
className,
|
|
894
|
+
...props
|
|
895
|
+
}) {
|
|
880
896
|
return /* @__PURE__ */ jsx21(TabsPrimitive.Trigger, {
|
|
881
897
|
"data-slot": "tabs-trigger",
|
|
882
898
|
className: cn("dark:data-[state=active]:text-foreground focus-visible:ring-ring/50 focus-visible:outline-ring dark:text-muted-foreground inline-flex h-full flex-1 items-center justify-center gap-1.5 px-2 py-1 text-sm font-normal whitespace-nowrap transition-colors focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
883
899
|
...props
|
|
884
900
|
});
|
|
885
901
|
}
|
|
886
|
-
function TabsContent({
|
|
902
|
+
function TabsContent({
|
|
903
|
+
className,
|
|
904
|
+
...props
|
|
905
|
+
}) {
|
|
887
906
|
return /* @__PURE__ */ jsx21(TabsPrimitive.Content, {
|
|
888
907
|
"data-slot": "tabs-content",
|
|
889
908
|
className: cn("flex-1 outline-none", className),
|
|
@@ -908,7 +927,7 @@ function ClientDocsKitCode(props) {
|
|
|
908
927
|
return () => {
|
|
909
928
|
cancelled = true;
|
|
910
929
|
};
|
|
911
|
-
}, [codeblock.value, codeblock.lang, codeblock.meta]);
|
|
930
|
+
}, [codeblock.value, codeblock.lang, codeblock.meta, codeblock]);
|
|
912
931
|
if (!highlighted) {
|
|
913
932
|
return /* @__PURE__ */ jsx22(CodeBlockSkeleton, {
|
|
914
933
|
hasTitle: !!title
|
|
@@ -977,7 +996,7 @@ function ClientTerminal(props) {
|
|
|
977
996
|
return () => {
|
|
978
997
|
cancelled = true;
|
|
979
998
|
};
|
|
980
|
-
}, [codeblock.value, codeblock.lang, codeblock.meta]);
|
|
999
|
+
}, [codeblock.value, codeblock.lang, codeblock.meta, codeblock]);
|
|
981
1000
|
if (!highlighted) {
|
|
982
1001
|
return /* @__PURE__ */ jsx22(TerminalSkeleton, {});
|
|
983
1002
|
}
|
|
@@ -1045,7 +1064,7 @@ function ClientInlineCode({ codeblock }) {
|
|
|
1045
1064
|
return () => {
|
|
1046
1065
|
cancelled = true;
|
|
1047
1066
|
};
|
|
1048
|
-
}, [codeblock.value, codeblock.lang, codeblock.meta]);
|
|
1067
|
+
}, [codeblock.value, codeblock.lang, codeblock.meta, codeblock]);
|
|
1049
1068
|
if (!highlighted) {
|
|
1050
1069
|
return /* @__PURE__ */ jsx22(InlineCodeSkeleton, {});
|
|
1051
1070
|
}
|
|
@@ -1101,7 +1120,7 @@ function ClientCode(props) {
|
|
|
1101
1120
|
return () => {
|
|
1102
1121
|
cancelled = true;
|
|
1103
1122
|
};
|
|
1104
|
-
}, [
|
|
1123
|
+
}, [codeblocks.map, groupOptions]);
|
|
1105
1124
|
if (!highlighted) {
|
|
1106
1125
|
return /* @__PURE__ */ jsx22(CodeTabsSkeleton, {
|
|
1107
1126
|
tabs: codeblocks.length
|
|
@@ -1109,6 +1128,10 @@ function ClientCode(props) {
|
|
|
1109
1128
|
}
|
|
1110
1129
|
if (codeblocks.length === 1) {
|
|
1111
1130
|
const tab = highlighted.get(0);
|
|
1131
|
+
if (!tab)
|
|
1132
|
+
return /* @__PURE__ */ jsx22(CodeTabsSkeleton, {
|
|
1133
|
+
tabs: 1
|
|
1134
|
+
});
|
|
1112
1135
|
const handlers = getHandlers(tab.options);
|
|
1113
1136
|
const { background: _background, ...highlightedStyle } = tab.highlighted.style;
|
|
1114
1137
|
return /* @__PURE__ */ jsxs9("div", {
|
|
@@ -1268,7 +1291,7 @@ import { jsx as jsx24, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
|
1268
1291
|
function APICodePanel({
|
|
1269
1292
|
languages,
|
|
1270
1293
|
examples,
|
|
1271
|
-
externalLink,
|
|
1294
|
+
externalLink: _externalLink,
|
|
1272
1295
|
title,
|
|
1273
1296
|
className
|
|
1274
1297
|
}) {
|
|
@@ -1338,11 +1361,13 @@ import { jsx as jsx26, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
|
1338
1361
|
function APIReferencePage({
|
|
1339
1362
|
title,
|
|
1340
1363
|
description,
|
|
1364
|
+
theme: theme2 = "default",
|
|
1341
1365
|
children,
|
|
1342
1366
|
className
|
|
1343
1367
|
}) {
|
|
1368
|
+
const containerClass = theme2 === "single" ? "max-w-[780px]" : "max-w-7xl";
|
|
1344
1369
|
return /* @__PURE__ */ jsxs13("div", {
|
|
1345
|
-
className: cn("
|
|
1370
|
+
className: cn(containerClass, "mx-auto px-4 sm:px-6 lg:px-8", className),
|
|
1346
1371
|
children: [
|
|
1347
1372
|
/* @__PURE__ */ jsxs13("header", {
|
|
1348
1373
|
className: "py-8 border-b border-border",
|
|
@@ -1415,8 +1440,240 @@ function APISection({
|
|
|
1415
1440
|
})
|
|
1416
1441
|
});
|
|
1417
1442
|
}
|
|
1443
|
+
// src/docskit/code.package-install.tsx
|
|
1444
|
+
import { useState as useState6 } from "react";
|
|
1445
|
+
import { jsx as jsx28, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1446
|
+
|
|
1447
|
+
var managerLabels = {
|
|
1448
|
+
npm: "npm",
|
|
1449
|
+
bun: "bun",
|
|
1450
|
+
pnpm: "pnpm",
|
|
1451
|
+
yarn: "yarn"
|
|
1452
|
+
};
|
|
1453
|
+
function getInstallCommand(manager, pkg, options) {
|
|
1454
|
+
const { dev, global: isGlobal } = options;
|
|
1455
|
+
if (isGlobal) {
|
|
1456
|
+
switch (manager) {
|
|
1457
|
+
case "npm":
|
|
1458
|
+
return `npm install -g ${pkg}`;
|
|
1459
|
+
case "bun":
|
|
1460
|
+
return `bun install -g ${pkg}`;
|
|
1461
|
+
case "pnpm":
|
|
1462
|
+
return `pnpm install -g ${pkg}`;
|
|
1463
|
+
case "yarn":
|
|
1464
|
+
return `yarn global add ${pkg}`;
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
if (dev) {
|
|
1468
|
+
switch (manager) {
|
|
1469
|
+
case "npm":
|
|
1470
|
+
return `npm install -D ${pkg}`;
|
|
1471
|
+
case "bun":
|
|
1472
|
+
return `bun add -d ${pkg}`;
|
|
1473
|
+
case "pnpm":
|
|
1474
|
+
return `pnpm add -D ${pkg}`;
|
|
1475
|
+
case "yarn":
|
|
1476
|
+
return `yarn add -D ${pkg}`;
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
switch (manager) {
|
|
1480
|
+
case "npm":
|
|
1481
|
+
return `npm install ${pkg}`;
|
|
1482
|
+
case "bun":
|
|
1483
|
+
return `bun add ${pkg}`;
|
|
1484
|
+
case "pnpm":
|
|
1485
|
+
return `pnpm add ${pkg}`;
|
|
1486
|
+
case "yarn":
|
|
1487
|
+
return `yarn add ${pkg}`;
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
function PackageInstall({
|
|
1491
|
+
package: pkg,
|
|
1492
|
+
dev = false,
|
|
1493
|
+
global: isGlobal = false,
|
|
1494
|
+
managers = ["npm", "bun", "pnpm", "yarn"],
|
|
1495
|
+
copyButton = true
|
|
1496
|
+
}) {
|
|
1497
|
+
const [activeManager, setActiveManager] = useState6(managers[0]);
|
|
1498
|
+
const command = getInstallCommand(activeManager, pkg, { dev, global: isGlobal });
|
|
1499
|
+
return /* @__PURE__ */ jsxs15("div", {
|
|
1500
|
+
className: "group rounded overflow-hidden border border-openpkg-code-border flex flex-col my-4 not-prose",
|
|
1501
|
+
children: [
|
|
1502
|
+
/* @__PURE__ */ jsxs15("div", {
|
|
1503
|
+
className: cn("border-b border-openpkg-code-border bg-openpkg-code-header", "w-full h-9 flex items-center px-3 gap-2 shrink-0"),
|
|
1504
|
+
children: [
|
|
1505
|
+
/* @__PURE__ */ jsxs15("div", {
|
|
1506
|
+
className: "flex items-center gap-2",
|
|
1507
|
+
children: [
|
|
1508
|
+
/* @__PURE__ */ jsx28("div", {
|
|
1509
|
+
className: "size-3 rounded-full bg-openpkg-code-text-inactive/30"
|
|
1510
|
+
}),
|
|
1511
|
+
/* @__PURE__ */ jsx28("div", {
|
|
1512
|
+
className: "size-3 rounded-full bg-openpkg-code-text-inactive/30"
|
|
1513
|
+
}),
|
|
1514
|
+
/* @__PURE__ */ jsx28("div", {
|
|
1515
|
+
className: "size-3 rounded-full bg-openpkg-code-text-inactive/30"
|
|
1516
|
+
})
|
|
1517
|
+
]
|
|
1518
|
+
}),
|
|
1519
|
+
/* @__PURE__ */ jsx28("div", {
|
|
1520
|
+
className: "flex items-center gap-0.5 ml-1",
|
|
1521
|
+
children: managers.map((manager) => /* @__PURE__ */ jsx28("button", {
|
|
1522
|
+
type: "button",
|
|
1523
|
+
onClick: () => setActiveManager(manager),
|
|
1524
|
+
className: cn("px-2 py-0.5 text-sm font-medium rounded-md transition-colors duration-200", "border h-6", activeManager === manager ? "bg-openpkg-code-bg border-openpkg-code-border text-openpkg-code-text-active" : "border-transparent text-openpkg-code-text-inactive hover:text-openpkg-code-text-active"),
|
|
1525
|
+
children: managerLabels[manager]
|
|
1526
|
+
}, manager))
|
|
1527
|
+
}),
|
|
1528
|
+
/* @__PURE__ */ jsx28("span", {
|
|
1529
|
+
className: "sr-only",
|
|
1530
|
+
children: "Terminal window"
|
|
1531
|
+
})
|
|
1532
|
+
]
|
|
1533
|
+
}),
|
|
1534
|
+
/* @__PURE__ */ jsx28(ClientDocsKitCode, {
|
|
1535
|
+
codeblock: {
|
|
1536
|
+
value: command,
|
|
1537
|
+
lang: "bash",
|
|
1538
|
+
meta: copyButton ? "-c" : ""
|
|
1539
|
+
},
|
|
1540
|
+
className: "!my-0 !border-0 !rounded-none"
|
|
1541
|
+
})
|
|
1542
|
+
]
|
|
1543
|
+
});
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
// src/docskit/api/section-accordion.tsx
|
|
1547
|
+
import { ChevronDown as ChevronDown2 } from "lucide-react";
|
|
1548
|
+
import { useId as useId2, useState as useState7 } from "react";
|
|
1549
|
+
import { jsx as jsx29, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1550
|
+
|
|
1551
|
+
function SectionAccordion({
|
|
1552
|
+
title,
|
|
1553
|
+
children,
|
|
1554
|
+
defaultExpanded = true,
|
|
1555
|
+
className
|
|
1556
|
+
}) {
|
|
1557
|
+
const [expanded, setExpanded] = useState7(defaultExpanded);
|
|
1558
|
+
const contentId = useId2();
|
|
1559
|
+
return /* @__PURE__ */ jsxs16("div", {
|
|
1560
|
+
className: cn("openpkg-section-accordion", className),
|
|
1561
|
+
children: [
|
|
1562
|
+
/* @__PURE__ */ jsxs16("button", {
|
|
1563
|
+
type: "button",
|
|
1564
|
+
onClick: () => setExpanded(!expanded),
|
|
1565
|
+
"aria-expanded": expanded,
|
|
1566
|
+
"aria-controls": contentId,
|
|
1567
|
+
className: cn("flex items-center gap-2 w-full", "py-3", "cursor-pointer", "transition-colors duration-150", "hover:opacity-80"),
|
|
1568
|
+
children: [
|
|
1569
|
+
/* @__PURE__ */ jsx29(ChevronDown2, {
|
|
1570
|
+
size: 16,
|
|
1571
|
+
className: cn("text-muted-foreground", "transition-transform duration-200", !expanded && "-rotate-90")
|
|
1572
|
+
}),
|
|
1573
|
+
/* @__PURE__ */ jsx29("span", {
|
|
1574
|
+
className: "text-xs font-medium tracking-wider text-muted-foreground uppercase font-mono",
|
|
1575
|
+
children: title
|
|
1576
|
+
})
|
|
1577
|
+
]
|
|
1578
|
+
}),
|
|
1579
|
+
/* @__PURE__ */ jsx29("div", {
|
|
1580
|
+
id: contentId,
|
|
1581
|
+
role: "region",
|
|
1582
|
+
className: cn("grid transition-[grid-template-rows,opacity] duration-200 ease-out", expanded ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0"),
|
|
1583
|
+
children: /* @__PURE__ */ jsx29("div", {
|
|
1584
|
+
className: "min-h-0 overflow-hidden",
|
|
1585
|
+
children
|
|
1586
|
+
})
|
|
1587
|
+
})
|
|
1588
|
+
]
|
|
1589
|
+
});
|
|
1590
|
+
}
|
|
1591
|
+
|
|
1592
|
+
// src/docskit/api/api-section-single.tsx
|
|
1593
|
+
import { jsx as jsx30, jsxs as jsxs17, Fragment as Fragment3 } from "react/jsx-runtime";
|
|
1594
|
+
|
|
1595
|
+
function APISectionSingle({
|
|
1596
|
+
title,
|
|
1597
|
+
id,
|
|
1598
|
+
description,
|
|
1599
|
+
example,
|
|
1600
|
+
packageName,
|
|
1601
|
+
parameters,
|
|
1602
|
+
returns,
|
|
1603
|
+
className
|
|
1604
|
+
}) {
|
|
1605
|
+
return /* @__PURE__ */ jsxs17("section", {
|
|
1606
|
+
id,
|
|
1607
|
+
className: cn("max-w-[780px] mx-auto py-12 px-6", className),
|
|
1608
|
+
children: [
|
|
1609
|
+
/* @__PURE__ */ jsxs17("header", {
|
|
1610
|
+
children: [
|
|
1611
|
+
/* @__PURE__ */ jsx30("h1", {
|
|
1612
|
+
className: "font-mono text-2xl font-semibold text-foreground",
|
|
1613
|
+
children: title
|
|
1614
|
+
}),
|
|
1615
|
+
description && /* @__PURE__ */ jsx30("div", {
|
|
1616
|
+
className: "mt-3 text-muted-foreground prose prose-sm dark:prose-invert",
|
|
1617
|
+
children: description
|
|
1618
|
+
})
|
|
1619
|
+
]
|
|
1620
|
+
}),
|
|
1621
|
+
/* @__PURE__ */ jsx30("div", {
|
|
1622
|
+
className: "mt-8",
|
|
1623
|
+
children: /* @__PURE__ */ jsx30(ClientDocsKitCode, {
|
|
1624
|
+
codeblock: { value: example.code, lang: example.lang || "typescript", meta: "-c" }
|
|
1625
|
+
})
|
|
1626
|
+
}),
|
|
1627
|
+
/* @__PURE__ */ jsx30("hr", {
|
|
1628
|
+
className: "border-border my-8"
|
|
1629
|
+
}),
|
|
1630
|
+
/* @__PURE__ */ jsx30(PackageInstall, {
|
|
1631
|
+
package: packageName
|
|
1632
|
+
}),
|
|
1633
|
+
parameters && /* @__PURE__ */ jsxs17(Fragment3, {
|
|
1634
|
+
children: [
|
|
1635
|
+
/* @__PURE__ */ jsx30("hr", {
|
|
1636
|
+
className: "border-border my-8"
|
|
1637
|
+
}),
|
|
1638
|
+
/* @__PURE__ */ jsx30(SectionAccordion, {
|
|
1639
|
+
title: "Parameters",
|
|
1640
|
+
defaultExpanded: true,
|
|
1641
|
+
children: /* @__PURE__ */ jsx30("div", {
|
|
1642
|
+
className: "space-y-4 pt-2",
|
|
1643
|
+
children: parameters
|
|
1644
|
+
})
|
|
1645
|
+
})
|
|
1646
|
+
]
|
|
1647
|
+
}),
|
|
1648
|
+
returns && /* @__PURE__ */ jsxs17(Fragment3, {
|
|
1649
|
+
children: [
|
|
1650
|
+
/* @__PURE__ */ jsx30("hr", {
|
|
1651
|
+
className: "border-border my-8"
|
|
1652
|
+
}),
|
|
1653
|
+
/* @__PURE__ */ jsxs17("div", {
|
|
1654
|
+
className: "returns-section",
|
|
1655
|
+
children: [
|
|
1656
|
+
/* @__PURE__ */ jsx30("h3", {
|
|
1657
|
+
className: "text-xs font-medium tracking-wider text-muted-foreground uppercase font-mono mb-4",
|
|
1658
|
+
children: "Returns"
|
|
1659
|
+
}),
|
|
1660
|
+
/* @__PURE__ */ jsx30("code", {
|
|
1661
|
+
className: "text-sm font-mono text-foreground bg-muted px-2 py-1 rounded",
|
|
1662
|
+
children: returns.type
|
|
1663
|
+
}),
|
|
1664
|
+
returns.description && /* @__PURE__ */ jsx30("div", {
|
|
1665
|
+
className: "mt-2 text-sm text-muted-foreground",
|
|
1666
|
+
children: returns.description
|
|
1667
|
+
})
|
|
1668
|
+
]
|
|
1669
|
+
})
|
|
1670
|
+
]
|
|
1671
|
+
})
|
|
1672
|
+
]
|
|
1673
|
+
});
|
|
1674
|
+
}
|
|
1418
1675
|
// src/docskit/api/code-block.tsx
|
|
1419
|
-
import { jsx as
|
|
1676
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
1420
1677
|
|
|
1421
1678
|
function CodeBlock({
|
|
1422
1679
|
code,
|
|
@@ -1425,7 +1682,7 @@ function CodeBlock({
|
|
|
1425
1682
|
className
|
|
1426
1683
|
}) {
|
|
1427
1684
|
const flags = `-c${showLineNumbers ? "n" : ""}`;
|
|
1428
|
-
return /* @__PURE__ */
|
|
1685
|
+
return /* @__PURE__ */ jsx31(ClientDocsKitCode, {
|
|
1429
1686
|
codeblock: {
|
|
1430
1687
|
value: code,
|
|
1431
1688
|
lang: language,
|
|
@@ -1436,8 +1693,8 @@ function CodeBlock({
|
|
|
1436
1693
|
}
|
|
1437
1694
|
// src/docskit/api/collapsible-panel.tsx
|
|
1438
1695
|
import { ChevronRight } from "lucide-react";
|
|
1439
|
-
import { useId as
|
|
1440
|
-
import { jsx as
|
|
1696
|
+
import { useId as useId3, useState as useState8 } from "react";
|
|
1697
|
+
import { jsx as jsx32, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1441
1698
|
|
|
1442
1699
|
function CollapsiblePanel({
|
|
1443
1700
|
title,
|
|
@@ -1447,10 +1704,10 @@ function CollapsiblePanel({
|
|
|
1447
1704
|
onExpandedChange,
|
|
1448
1705
|
className
|
|
1449
1706
|
}) {
|
|
1450
|
-
const [internalExpanded, setInternalExpanded] =
|
|
1707
|
+
const [internalExpanded, setInternalExpanded] = useState8(defaultExpanded);
|
|
1451
1708
|
const isControlled = controlledExpanded !== undefined;
|
|
1452
1709
|
const expanded = isControlled ? controlledExpanded : internalExpanded;
|
|
1453
|
-
const contentId =
|
|
1710
|
+
const contentId = useId3();
|
|
1454
1711
|
const toggle = () => {
|
|
1455
1712
|
const next = !expanded;
|
|
1456
1713
|
if (isControlled) {
|
|
@@ -1459,31 +1716,31 @@ function CollapsiblePanel({
|
|
|
1459
1716
|
setInternalExpanded(next);
|
|
1460
1717
|
}
|
|
1461
1718
|
};
|
|
1462
|
-
return /* @__PURE__ */
|
|
1719
|
+
return /* @__PURE__ */ jsxs18("div", {
|
|
1463
1720
|
className: cn("openpkg-collapsible-panel", className),
|
|
1464
1721
|
children: [
|
|
1465
|
-
/* @__PURE__ */
|
|
1722
|
+
/* @__PURE__ */ jsxs18("button", {
|
|
1466
1723
|
type: "button",
|
|
1467
1724
|
onClick: toggle,
|
|
1468
1725
|
"aria-expanded": expanded,
|
|
1469
1726
|
"aria-controls": contentId,
|
|
1470
1727
|
className: cn("openpkg-collapsible-trigger", "flex items-center gap-2.5 w-full", "px-4 py-3", "bg-[var(--openpkg-bg-collapsible)]", "border border-[var(--openpkg-border-subtle)]", "rounded-md", "cursor-pointer", "transition-all duration-150", "hover:bg-[var(--openpkg-bg-tertiary)]", expanded && "rounded-b-none border-b-transparent mb-0", !expanded && "mb-2"),
|
|
1471
1728
|
children: [
|
|
1472
|
-
/* @__PURE__ */
|
|
1729
|
+
/* @__PURE__ */ jsx32(ChevronRight, {
|
|
1473
1730
|
size: 14,
|
|
1474
1731
|
className: cn("text-[var(--openpkg-text-muted)]", "transition-transform duration-200", expanded && "rotate-90")
|
|
1475
1732
|
}),
|
|
1476
|
-
/* @__PURE__ */
|
|
1733
|
+
/* @__PURE__ */ jsx32("span", {
|
|
1477
1734
|
className: "text-[13px] font-medium text-[var(--openpkg-text-secondary)]",
|
|
1478
1735
|
children: title
|
|
1479
1736
|
})
|
|
1480
1737
|
]
|
|
1481
1738
|
}),
|
|
1482
|
-
/* @__PURE__ */
|
|
1739
|
+
/* @__PURE__ */ jsx32("div", {
|
|
1483
1740
|
id: contentId,
|
|
1484
1741
|
role: "region",
|
|
1485
1742
|
className: cn("openpkg-collapsible-content", "grid transition-[grid-template-rows,opacity] duration-200 ease-out", expanded ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0"),
|
|
1486
|
-
children: /* @__PURE__ */
|
|
1743
|
+
children: /* @__PURE__ */ jsx32("div", {
|
|
1487
1744
|
className: cn("min-h-0 overflow-hidden", "bg-[var(--openpkg-bg-code)]", "border border-[var(--openpkg-border-subtle)]", "border-t-0", "rounded-b-md", "mb-2"),
|
|
1488
1745
|
children
|
|
1489
1746
|
})
|
|
@@ -1494,7 +1751,7 @@ function CollapsiblePanel({
|
|
|
1494
1751
|
// src/docskit/api/endpoint-badge.tsx
|
|
1495
1752
|
import { cva } from "class-variance-authority";
|
|
1496
1753
|
import * as React4 from "react";
|
|
1497
|
-
import { jsx as
|
|
1754
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
1498
1755
|
var endpointBadgeVariants = cva("inline-flex items-center justify-center font-mono font-bold uppercase tracking-wide rounded shrink-0", {
|
|
1499
1756
|
variants: {
|
|
1500
1757
|
method: {
|
|
@@ -1515,7 +1772,7 @@ var endpointBadgeVariants = cva("inline-flex items-center justify-center font-mo
|
|
|
1515
1772
|
}
|
|
1516
1773
|
});
|
|
1517
1774
|
var EndpointBadge = React4.forwardRef(({ className, method, size, ...props }, ref) => {
|
|
1518
|
-
return /* @__PURE__ */
|
|
1775
|
+
return /* @__PURE__ */ jsx33("span", {
|
|
1519
1776
|
ref,
|
|
1520
1777
|
className: cn(endpointBadgeVariants({ method, size, className })),
|
|
1521
1778
|
...props,
|
|
@@ -1526,36 +1783,36 @@ EndpointBadge.displayName = "EndpointBadge";
|
|
|
1526
1783
|
// src/docskit/api/endpoint-header.tsx
|
|
1527
1784
|
import { Check as Check2, Copy as Copy2 } from "lucide-react";
|
|
1528
1785
|
import * as React5 from "react";
|
|
1529
|
-
import { useState as
|
|
1530
|
-
import { jsx as
|
|
1786
|
+
import { useState as useState9 } from "react";
|
|
1787
|
+
import { jsx as jsx34, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1531
1788
|
|
|
1532
1789
|
var EndpointHeader = React5.forwardRef(({ className, method, path, copyable = true, ...props }, ref) => {
|
|
1533
|
-
const [copied, setCopied] =
|
|
1790
|
+
const [copied, setCopied] = useState9(false);
|
|
1534
1791
|
const handleCopy = () => {
|
|
1535
1792
|
navigator.clipboard.writeText(path);
|
|
1536
1793
|
setCopied(true);
|
|
1537
1794
|
setTimeout(() => setCopied(false), 1200);
|
|
1538
1795
|
};
|
|
1539
|
-
return /* @__PURE__ */
|
|
1796
|
+
return /* @__PURE__ */ jsxs19("div", {
|
|
1540
1797
|
ref,
|
|
1541
1798
|
className: cn("group flex items-center gap-3 py-2 px-3 rounded-lg bg-muted/50 border border-border", className),
|
|
1542
1799
|
...props,
|
|
1543
1800
|
children: [
|
|
1544
|
-
/* @__PURE__ */
|
|
1801
|
+
/* @__PURE__ */ jsx34(EndpointBadge, {
|
|
1545
1802
|
method
|
|
1546
1803
|
}),
|
|
1547
|
-
/* @__PURE__ */
|
|
1804
|
+
/* @__PURE__ */ jsx34("code", {
|
|
1548
1805
|
className: "font-mono text-sm text-foreground flex-1",
|
|
1549
1806
|
children: path
|
|
1550
1807
|
}),
|
|
1551
|
-
copyable && /* @__PURE__ */
|
|
1808
|
+
copyable && /* @__PURE__ */ jsx34("button", {
|
|
1552
1809
|
type: "button",
|
|
1553
1810
|
onClick: handleCopy,
|
|
1554
1811
|
className: cn("p-1.5 rounded text-muted-foreground hover:text-foreground", "opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer"),
|
|
1555
1812
|
"aria-label": "Copy path",
|
|
1556
|
-
children: copied ? /* @__PURE__ */
|
|
1813
|
+
children: copied ? /* @__PURE__ */ jsx34(Check2, {
|
|
1557
1814
|
size: 14
|
|
1558
|
-
}) : /* @__PURE__ */
|
|
1815
|
+
}) : /* @__PURE__ */ jsx34(Copy2, {
|
|
1559
1816
|
size: 14
|
|
1560
1817
|
})
|
|
1561
1818
|
})
|
|
@@ -1564,7 +1821,7 @@ var EndpointHeader = React5.forwardRef(({ className, method, path, copyable = tr
|
|
|
1564
1821
|
});
|
|
1565
1822
|
EndpointHeader.displayName = "EndpointHeader";
|
|
1566
1823
|
// src/docskit/api/enum-values-section.tsx
|
|
1567
|
-
import { jsx as
|
|
1824
|
+
import { jsx as jsx35, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1568
1825
|
|
|
1569
1826
|
function EnumValuesSection({
|
|
1570
1827
|
values,
|
|
@@ -1573,23 +1830,23 @@ function EnumValuesSection({
|
|
|
1573
1830
|
}) {
|
|
1574
1831
|
if (values.length === 0)
|
|
1575
1832
|
return null;
|
|
1576
|
-
return /* @__PURE__ */
|
|
1833
|
+
return /* @__PURE__ */ jsxs20("div", {
|
|
1577
1834
|
className: cn("openpkg-enum-section", "mt-3", className),
|
|
1578
1835
|
children: [
|
|
1579
|
-
/* @__PURE__ */
|
|
1836
|
+
/* @__PURE__ */ jsx35("div", {
|
|
1580
1837
|
className: cn("openpkg-enum-header", "text-[11px] font-medium", "text-[var(--openpkg-text-muted)]", "mb-2.5 pb-2", "border-b border-[var(--openpkg-border-subtle)]"),
|
|
1581
1838
|
children: header
|
|
1582
1839
|
}),
|
|
1583
|
-
/* @__PURE__ */
|
|
1840
|
+
/* @__PURE__ */ jsx35("div", {
|
|
1584
1841
|
className: "openpkg-enum-values flex flex-col gap-0.5",
|
|
1585
|
-
children: values.map((item) => /* @__PURE__ */
|
|
1842
|
+
children: values.map((item) => /* @__PURE__ */ jsxs20("div", {
|
|
1586
1843
|
className: cn("openpkg-enum-value", "py-2.5 px-3", "bg-[var(--openpkg-bg-secondary)]", "rounded"),
|
|
1587
1844
|
children: [
|
|
1588
|
-
/* @__PURE__ */
|
|
1845
|
+
/* @__PURE__ */ jsx35("span", {
|
|
1589
1846
|
className: cn("openpkg-enum-value-name", "font-mono text-xs font-medium", "text-[var(--openpkg-syn-string)]", "bg-[var(--openpkg-bg-badge)]", "px-1.5 py-0.5 rounded", "inline-block mb-1"),
|
|
1590
1847
|
children: item.value
|
|
1591
1848
|
}),
|
|
1592
|
-
item.description && /* @__PURE__ */
|
|
1849
|
+
item.description && /* @__PURE__ */ jsx35("p", {
|
|
1593
1850
|
className: cn("openpkg-enum-value-description", "text-xs text-[var(--openpkg-text-secondary)]", "leading-relaxed", "[&_code]:font-mono [&_code]:text-[11px] [&_code]:bg-[var(--openpkg-bg-badge)] [&_code]:px-1 [&_code]:py-0.5 [&_code]:rounded"),
|
|
1594
1851
|
children: item.description
|
|
1595
1852
|
})
|
|
@@ -1600,7 +1857,7 @@ function EnumValuesSection({
|
|
|
1600
1857
|
});
|
|
1601
1858
|
}
|
|
1602
1859
|
// src/docskit/api/example-chips.tsx
|
|
1603
|
-
import { jsx as
|
|
1860
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
1604
1861
|
|
|
1605
1862
|
function ExampleChips({
|
|
1606
1863
|
examples,
|
|
@@ -1608,11 +1865,11 @@ function ExampleChips({
|
|
|
1608
1865
|
onSelect,
|
|
1609
1866
|
className
|
|
1610
1867
|
}) {
|
|
1611
|
-
return /* @__PURE__ */
|
|
1868
|
+
return /* @__PURE__ */ jsx36("div", {
|
|
1612
1869
|
className: cn("openpkg-example-chips", "flex flex-wrap gap-2 mb-5", className),
|
|
1613
1870
|
children: examples.map((example) => {
|
|
1614
1871
|
const isActive = example.id === activeId;
|
|
1615
|
-
return /* @__PURE__ */
|
|
1872
|
+
return /* @__PURE__ */ jsx36("button", {
|
|
1616
1873
|
type: "button",
|
|
1617
1874
|
onClick: () => onSelect(example.id),
|
|
1618
1875
|
className: cn("openpkg-example-chip", "text-xs font-medium", "px-3 py-1.5", "border rounded-md", "cursor-pointer", "transition-all duration-150", isActive ? [
|
|
@@ -1633,7 +1890,7 @@ function ExampleChips({
|
|
|
1633
1890
|
});
|
|
1634
1891
|
}
|
|
1635
1892
|
// src/docskit/api/example-section.tsx
|
|
1636
|
-
import { useEffect as useEffect4, useRef as useRef3, useState as
|
|
1893
|
+
import { useEffect as useEffect4, useRef as useRef3, useState as useState11 } from "react";
|
|
1637
1894
|
|
|
1638
1895
|
// src/docskit/hooks/use-sync-scroll.tsx
|
|
1639
1896
|
import {
|
|
@@ -1643,9 +1900,9 @@ import {
|
|
|
1643
1900
|
useEffect as useEffect3,
|
|
1644
1901
|
useMemo,
|
|
1645
1902
|
useRef as useRef2,
|
|
1646
|
-
useState as
|
|
1903
|
+
useState as useState10
|
|
1647
1904
|
} from "react";
|
|
1648
|
-
import { jsx as
|
|
1905
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
1649
1906
|
|
|
1650
1907
|
var SyncScrollContext = createContext2(null);
|
|
1651
1908
|
function SyncScrollProvider({
|
|
@@ -1653,7 +1910,7 @@ function SyncScrollProvider({
|
|
|
1653
1910
|
rootMargin = "-20% 0px -60% 0px",
|
|
1654
1911
|
scrollBehavior = "smooth"
|
|
1655
1912
|
}) {
|
|
1656
|
-
const [activeSection, setActiveSection] =
|
|
1913
|
+
const [activeSection, setActiveSection] = useState10(null);
|
|
1657
1914
|
const sectionsRef = useRef2(new Map);
|
|
1658
1915
|
const rightColumnRef = useRef2(null);
|
|
1659
1916
|
const isScrollingRef = useRef2(false);
|
|
@@ -1713,7 +1970,7 @@ function SyncScrollProvider({
|
|
|
1713
1970
|
scrollToSection,
|
|
1714
1971
|
registerRightColumn
|
|
1715
1972
|
}), [activeSection, registerSection, unregisterSection, scrollToSection, registerRightColumn]);
|
|
1716
|
-
return /* @__PURE__ */
|
|
1973
|
+
return /* @__PURE__ */ jsx37(SyncScrollContext.Provider, {
|
|
1717
1974
|
value,
|
|
1718
1975
|
children
|
|
1719
1976
|
});
|
|
@@ -1736,7 +1993,7 @@ function useSyncSection(id) {
|
|
|
1736
1993
|
}
|
|
1737
1994
|
|
|
1738
1995
|
// src/docskit/api/example-section.tsx
|
|
1739
|
-
import { jsx as
|
|
1996
|
+
import { jsx as jsx38, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
1740
1997
|
|
|
1741
1998
|
function ExampleSection({
|
|
1742
1999
|
id,
|
|
@@ -1746,7 +2003,7 @@ function ExampleSection({
|
|
|
1746
2003
|
notes,
|
|
1747
2004
|
className
|
|
1748
2005
|
}) {
|
|
1749
|
-
const [activeExampleId, setActiveExampleId] =
|
|
2006
|
+
const [activeExampleId, setActiveExampleId] = useState11(examples[0]?.id ?? "");
|
|
1750
2007
|
const ref = useRef3(null);
|
|
1751
2008
|
const syncScroll = useSyncScrollSafe();
|
|
1752
2009
|
const activeExample = examples.find((e) => e.id === activeExampleId) ?? examples[0];
|
|
@@ -1756,46 +2013,46 @@ function ExampleSection({
|
|
|
1756
2013
|
ref.current.setAttribute("data-section", id);
|
|
1757
2014
|
}
|
|
1758
2015
|
}, [id]);
|
|
1759
|
-
return /* @__PURE__ */
|
|
2016
|
+
return /* @__PURE__ */ jsxs21("div", {
|
|
1760
2017
|
ref,
|
|
1761
2018
|
"data-section": id,
|
|
1762
2019
|
className: cn("openpkg-example-section", "mb-12 last:mb-0", "transition-opacity duration-300", isActive ? "opacity-100" : "opacity-40", className),
|
|
1763
2020
|
children: [
|
|
1764
|
-
examples.length > 1 && /* @__PURE__ */
|
|
2021
|
+
examples.length > 1 && /* @__PURE__ */ jsx38(ExampleChips, {
|
|
1765
2022
|
examples: examples.map((e) => ({ id: e.id, label: e.label })),
|
|
1766
2023
|
activeId: activeExampleId,
|
|
1767
2024
|
onSelect: setActiveExampleId
|
|
1768
2025
|
}),
|
|
1769
|
-
activeExample && /* @__PURE__ */
|
|
2026
|
+
activeExample && /* @__PURE__ */ jsx38(CodeBlock, {
|
|
1770
2027
|
code: activeExample.code,
|
|
1771
2028
|
language: activeExample.language ?? "typescript",
|
|
1772
2029
|
showLineNumbers: true
|
|
1773
2030
|
}),
|
|
1774
|
-
dataSource && /* @__PURE__ */
|
|
2031
|
+
dataSource && /* @__PURE__ */ jsx38(CollapsiblePanel, {
|
|
1775
2032
|
title: "Data source",
|
|
1776
|
-
children: /* @__PURE__ */
|
|
2033
|
+
children: /* @__PURE__ */ jsx38("div", {
|
|
1777
2034
|
className: "p-4",
|
|
1778
|
-
children: /* @__PURE__ */
|
|
2035
|
+
children: /* @__PURE__ */ jsx38(CodeBlock, {
|
|
1779
2036
|
code: dataSource,
|
|
1780
2037
|
language: "sql"
|
|
1781
2038
|
})
|
|
1782
2039
|
})
|
|
1783
2040
|
}),
|
|
1784
|
-
response && /* @__PURE__ */
|
|
2041
|
+
response && /* @__PURE__ */ jsx38(CollapsiblePanel, {
|
|
1785
2042
|
title: "Response",
|
|
1786
|
-
children: /* @__PURE__ */
|
|
2043
|
+
children: /* @__PURE__ */ jsx38("div", {
|
|
1787
2044
|
className: "p-4",
|
|
1788
|
-
children: /* @__PURE__ */
|
|
2045
|
+
children: /* @__PURE__ */ jsx38(CodeBlock, {
|
|
1789
2046
|
code: response,
|
|
1790
2047
|
language: "json"
|
|
1791
2048
|
})
|
|
1792
2049
|
})
|
|
1793
2050
|
}),
|
|
1794
|
-
notes && /* @__PURE__ */
|
|
2051
|
+
notes && /* @__PURE__ */ jsx38(CollapsiblePanel, {
|
|
1795
2052
|
title: "Notes",
|
|
1796
|
-
children: /* @__PURE__ */
|
|
2053
|
+
children: /* @__PURE__ */ jsx38("div", {
|
|
1797
2054
|
className: cn("openpkg-panel-note", "p-4", "text-[13px] text-[var(--openpkg-text-secondary)]", "leading-relaxed", "[&_code]:font-mono [&_code]:text-xs [&_code]:bg-[var(--openpkg-bg-badge)] [&_code]:px-1.5 [&_code]:py-0.5 [&_code]:rounded"),
|
|
1798
|
-
children: typeof notes === "string" ? /* @__PURE__ */
|
|
2055
|
+
children: typeof notes === "string" ? /* @__PURE__ */ jsx38("p", {
|
|
1799
2056
|
children: notes
|
|
1800
2057
|
}) : notes
|
|
1801
2058
|
})
|
|
@@ -1812,10 +2069,53 @@ function useSyncScrollSafe() {
|
|
|
1812
2069
|
}
|
|
1813
2070
|
// src/docskit/api/expandable-parameter.tsx
|
|
1814
2071
|
import { formatSchema } from "@openpkg-ts/sdk/browser";
|
|
1815
|
-
import { useState as
|
|
2072
|
+
import { useState as useState12 } from "react";
|
|
2073
|
+
|
|
2074
|
+
// src/docskit/api/nested-parameter-container.tsx
|
|
2075
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
2076
|
+
|
|
2077
|
+
function NestedParameterContainer({
|
|
2078
|
+
children,
|
|
2079
|
+
level = 0,
|
|
2080
|
+
className
|
|
2081
|
+
}) {
|
|
2082
|
+
return /* @__PURE__ */ jsx39("div", {
|
|
2083
|
+
className: cn("openpkg-nested-container", "border border-t-0 border-[var(--openpkg-border-medium)]", "rounded-b-lg", "px-5", "[&>.openpkg-expandable-param]:py-4", "[&>.openpkg-expandable-param]:border-b", "[&>.openpkg-expandable-param]:border-[var(--openpkg-border-subtle)]", "[&>.openpkg-expandable-param:last-child]:border-b-0", "[&>.openpkg-expandable-param:last-child]:pb-4", "[&>.openpkg-expandable-param_.openpkg-param]:py-0", "[&>.openpkg-expandable-param_.openpkg-param]:border-b-0", className),
|
|
2084
|
+
"data-level": level,
|
|
2085
|
+
children
|
|
2086
|
+
});
|
|
2087
|
+
}
|
|
2088
|
+
|
|
2089
|
+
// src/docskit/api/nested-parameter-toggle.tsx
|
|
2090
|
+
import { jsx as jsx40, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
2091
|
+
|
|
2092
|
+
function NestedParameterToggle({
|
|
2093
|
+
expanded,
|
|
2094
|
+
onToggle,
|
|
2095
|
+
className
|
|
2096
|
+
}) {
|
|
2097
|
+
return /* @__PURE__ */ jsxs22("button", {
|
|
2098
|
+
type: "button",
|
|
2099
|
+
onClick: onToggle,
|
|
2100
|
+
className: cn("openpkg-nested-toggle", "flex items-center gap-2", "font-sans text-[13px] font-medium", "text-[var(--openpkg-text-secondary)]", "bg-transparent", "border border-[var(--openpkg-border-medium)]", "px-2 py-1.5", "cursor-pointer", "transition-[width,border-radius,border-color,color] duration-200 ease-out", "hover:text-[var(--openpkg-text-primary)]", expanded ? "w-full rounded-t-md rounded-b-none border-b-[var(--openpkg-border-subtle)]" : "w-fit rounded-md", className),
|
|
2101
|
+
"aria-expanded": expanded,
|
|
2102
|
+
children: [
|
|
2103
|
+
/* @__PURE__ */ jsx40("span", {
|
|
2104
|
+
className: "text-[13px]",
|
|
2105
|
+
children: expanded ? "×" : "+"
|
|
2106
|
+
}),
|
|
2107
|
+
/* @__PURE__ */ jsxs22("span", {
|
|
2108
|
+
children: [
|
|
2109
|
+
expanded ? "Hide" : "Show",
|
|
2110
|
+
" Child Attributes"
|
|
2111
|
+
]
|
|
2112
|
+
})
|
|
2113
|
+
]
|
|
2114
|
+
});
|
|
2115
|
+
}
|
|
1816
2116
|
|
|
1817
2117
|
// src/docskit/api/parameter-item.tsx
|
|
1818
|
-
import { jsx as
|
|
2118
|
+
import { jsx as jsx41, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
1819
2119
|
|
|
1820
2120
|
function APIParameterItem({
|
|
1821
2121
|
name,
|
|
@@ -1828,41 +2128,41 @@ function APIParameterItem({
|
|
|
1828
2128
|
anchorId,
|
|
1829
2129
|
className
|
|
1830
2130
|
}) {
|
|
1831
|
-
return /* @__PURE__ */
|
|
2131
|
+
return /* @__PURE__ */ jsxs23("div", {
|
|
1832
2132
|
id: anchorId,
|
|
1833
2133
|
className: cn("openpkg-param", "py-5 border-b border-[var(--openpkg-border-subtle)]", "last:border-b-0", className),
|
|
1834
2134
|
children: [
|
|
1835
|
-
/* @__PURE__ */
|
|
2135
|
+
/* @__PURE__ */ jsxs23("div", {
|
|
1836
2136
|
className: "openpkg-param-header flex items-baseline gap-2 mb-1 flex-wrap",
|
|
1837
2137
|
children: [
|
|
1838
|
-
/* @__PURE__ */
|
|
2138
|
+
/* @__PURE__ */ jsxs23("span", {
|
|
1839
2139
|
className: "openpkg-param-name font-mono text-sm font-semibold",
|
|
1840
2140
|
children: [
|
|
1841
|
-
parentPath && /* @__PURE__ */
|
|
2141
|
+
parentPath && /* @__PURE__ */ jsx41("span", {
|
|
1842
2142
|
className: "text-[var(--openpkg-text-muted)]",
|
|
1843
2143
|
children: parentPath
|
|
1844
2144
|
}),
|
|
1845
|
-
/* @__PURE__ */
|
|
2145
|
+
/* @__PURE__ */ jsx41("span", {
|
|
1846
2146
|
className: "text-[var(--openpkg-text-primary)]",
|
|
1847
2147
|
children: name
|
|
1848
2148
|
})
|
|
1849
2149
|
]
|
|
1850
2150
|
}),
|
|
1851
|
-
/* @__PURE__ */
|
|
2151
|
+
/* @__PURE__ */ jsx41("span", {
|
|
1852
2152
|
className: "openpkg-param-type text-[13px] text-[var(--openpkg-text-muted)]",
|
|
1853
2153
|
children: type
|
|
1854
2154
|
}),
|
|
1855
|
-
required && /* @__PURE__ */
|
|
2155
|
+
required && /* @__PURE__ */ jsx41("span", {
|
|
1856
2156
|
className: "openpkg-param-badge text-[13px] font-medium text-[var(--openpkg-accent-orange,#d4a553)]",
|
|
1857
2157
|
children: "required"
|
|
1858
2158
|
}),
|
|
1859
|
-
optional && /* @__PURE__ */
|
|
2159
|
+
optional && /* @__PURE__ */ jsx41("span", {
|
|
1860
2160
|
className: "openpkg-param-badge text-[13px] text-[var(--openpkg-text-muted)]",
|
|
1861
2161
|
children: "optional"
|
|
1862
2162
|
})
|
|
1863
2163
|
]
|
|
1864
2164
|
}),
|
|
1865
|
-
description && /* @__PURE__ */
|
|
2165
|
+
description && /* @__PURE__ */ jsx41("p", {
|
|
1866
2166
|
className: cn("openpkg-param-description", "text-sm text-[var(--openpkg-text-secondary)]", "leading-relaxed", "[&_code]:font-mono [&_code]:text-[13px] [&_code]:bg-[var(--openpkg-bg-badge)] [&_code]:px-1.5 [&_code]:py-0.5 [&_code]:rounded"),
|
|
1867
2167
|
children: description
|
|
1868
2168
|
}),
|
|
@@ -1871,63 +2171,20 @@ function APIParameterItem({
|
|
|
1871
2171
|
});
|
|
1872
2172
|
}
|
|
1873
2173
|
|
|
1874
|
-
// src/docskit/api/
|
|
1875
|
-
import { jsx as
|
|
2174
|
+
// src/docskit/api/expandable-parameter.tsx
|
|
2175
|
+
import { jsx as jsx42, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
1876
2176
|
|
|
1877
|
-
function
|
|
1878
|
-
|
|
2177
|
+
function ExpandableParameter({
|
|
2178
|
+
parameter,
|
|
2179
|
+
parentPath,
|
|
2180
|
+
defaultExpanded = false,
|
|
2181
|
+
expanded: controlledExpanded,
|
|
2182
|
+
onExpandedChange,
|
|
1879
2183
|
level = 0,
|
|
1880
|
-
className
|
|
2184
|
+
className,
|
|
2185
|
+
resolveRef
|
|
1881
2186
|
}) {
|
|
1882
|
-
|
|
1883
|
-
className: cn("openpkg-nested-container", "border border-t-0 border-[var(--openpkg-border-medium)]", "rounded-b-lg", "px-5", "[&>.openpkg-expandable-param]:py-4", "[&>.openpkg-expandable-param]:border-b", "[&>.openpkg-expandable-param]:border-[var(--openpkg-border-subtle)]", "[&>.openpkg-expandable-param:last-child]:border-b-0", "[&>.openpkg-expandable-param:last-child]:pb-4", "[&>.openpkg-expandable-param_.openpkg-param]:py-0", "[&>.openpkg-expandable-param_.openpkg-param]:border-b-0", className),
|
|
1884
|
-
"data-level": level,
|
|
1885
|
-
children
|
|
1886
|
-
});
|
|
1887
|
-
}
|
|
1888
|
-
|
|
1889
|
-
// src/docskit/api/nested-parameter-toggle.tsx
|
|
1890
|
-
import { jsx as jsx38, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1891
|
-
|
|
1892
|
-
function NestedParameterToggle({
|
|
1893
|
-
expanded,
|
|
1894
|
-
onToggle,
|
|
1895
|
-
className
|
|
1896
|
-
}) {
|
|
1897
|
-
return /* @__PURE__ */ jsxs20("button", {
|
|
1898
|
-
type: "button",
|
|
1899
|
-
onClick: onToggle,
|
|
1900
|
-
className: cn("openpkg-nested-toggle", "flex items-center gap-2", "font-sans text-[13px] font-medium", "text-[var(--openpkg-text-secondary)]", "bg-transparent", "border border-[var(--openpkg-border-medium)]", "px-2 py-1.5", "cursor-pointer", "transition-[width,border-radius,border-color,color] duration-200 ease-out", "hover:text-[var(--openpkg-text-primary)]", expanded ? "w-full rounded-t-md rounded-b-none border-b-[var(--openpkg-border-subtle)]" : "w-fit rounded-md", className),
|
|
1901
|
-
"aria-expanded": expanded,
|
|
1902
|
-
children: [
|
|
1903
|
-
/* @__PURE__ */ jsx38("span", {
|
|
1904
|
-
className: "text-[13px]",
|
|
1905
|
-
children: expanded ? "×" : "+"
|
|
1906
|
-
}),
|
|
1907
|
-
/* @__PURE__ */ jsxs20("span", {
|
|
1908
|
-
children: [
|
|
1909
|
-
expanded ? "Hide" : "Show",
|
|
1910
|
-
" Child Attributes"
|
|
1911
|
-
]
|
|
1912
|
-
})
|
|
1913
|
-
]
|
|
1914
|
-
});
|
|
1915
|
-
}
|
|
1916
|
-
|
|
1917
|
-
// src/docskit/api/expandable-parameter.tsx
|
|
1918
|
-
import { jsx as jsx39, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
1919
|
-
|
|
1920
|
-
function ExpandableParameter({
|
|
1921
|
-
parameter,
|
|
1922
|
-
parentPath,
|
|
1923
|
-
defaultExpanded = false,
|
|
1924
|
-
expanded: controlledExpanded,
|
|
1925
|
-
onExpandedChange,
|
|
1926
|
-
level = 0,
|
|
1927
|
-
className,
|
|
1928
|
-
resolveRef
|
|
1929
|
-
}) {
|
|
1930
|
-
const [internalExpanded, setInternalExpanded] = useState10(defaultExpanded);
|
|
2187
|
+
const [internalExpanded, setInternalExpanded] = useState12(defaultExpanded);
|
|
1931
2188
|
const isControlled = controlledExpanded !== undefined;
|
|
1932
2189
|
const expanded = isControlled ? controlledExpanded : internalExpanded;
|
|
1933
2190
|
const handleToggle = () => {
|
|
@@ -1941,9 +2198,9 @@ function ExpandableParameter({
|
|
|
1941
2198
|
const { nestedParams, enumValues, hasChildren } = extractSchemaInfo(parameter.schema, resolveRef);
|
|
1942
2199
|
const type = formatSchema(parameter.schema);
|
|
1943
2200
|
const isRequired = parameter.required !== false;
|
|
1944
|
-
return /* @__PURE__ */
|
|
2201
|
+
return /* @__PURE__ */ jsx42("div", {
|
|
1945
2202
|
className: cn("openpkg-expandable-param", className),
|
|
1946
|
-
children: /* @__PURE__ */
|
|
2203
|
+
children: /* @__PURE__ */ jsxs24(APIParameterItem, {
|
|
1947
2204
|
name: parameter.name,
|
|
1948
2205
|
parentPath,
|
|
1949
2206
|
type: hasChildren ? "object" : type,
|
|
@@ -1951,19 +2208,19 @@ function ExpandableParameter({
|
|
|
1951
2208
|
description: parameter.description,
|
|
1952
2209
|
anchorId: parentPath ? `${parentPath}${parameter.name}` : parameter.name,
|
|
1953
2210
|
children: [
|
|
1954
|
-
enumValues.length > 0 && !nestedParams.length && /* @__PURE__ */
|
|
2211
|
+
enumValues.length > 0 && !nestedParams.length && /* @__PURE__ */ jsx42(EnumValuesSection, {
|
|
1955
2212
|
values: enumValues
|
|
1956
2213
|
}),
|
|
1957
|
-
nestedParams.length > 0 && /* @__PURE__ */
|
|
2214
|
+
nestedParams.length > 0 && /* @__PURE__ */ jsxs24("div", {
|
|
1958
2215
|
className: "mt-3 mb-1",
|
|
1959
2216
|
children: [
|
|
1960
|
-
/* @__PURE__ */
|
|
2217
|
+
/* @__PURE__ */ jsx42(NestedParameterToggle, {
|
|
1961
2218
|
expanded,
|
|
1962
2219
|
onToggle: handleToggle
|
|
1963
2220
|
}),
|
|
1964
|
-
expanded && /* @__PURE__ */
|
|
2221
|
+
expanded && /* @__PURE__ */ jsx42(NestedParameterContainer, {
|
|
1965
2222
|
level,
|
|
1966
|
-
children: nestedParams.map((nested) => /* @__PURE__ */
|
|
2223
|
+
children: nestedParams.map((nested) => /* @__PURE__ */ jsx42(ExpandableParameter, {
|
|
1967
2224
|
parameter: nested,
|
|
1968
2225
|
parentPath: `${parameter.name}.`,
|
|
1969
2226
|
level: level + 1,
|
|
@@ -2014,7 +2271,7 @@ function extractSchemaInfo(schema, resolveRef) {
|
|
|
2014
2271
|
}
|
|
2015
2272
|
// src/docskit/api/method-section.tsx
|
|
2016
2273
|
import { useEffect as useEffect5, useRef as useRef4 } from "react";
|
|
2017
|
-
import { jsx as
|
|
2274
|
+
import { jsx as jsx43, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
2018
2275
|
|
|
2019
2276
|
function MethodSection({
|
|
2020
2277
|
id,
|
|
@@ -2033,36 +2290,36 @@ function MethodSection({
|
|
|
2033
2290
|
return () => syncScroll.unregisterSection(id);
|
|
2034
2291
|
}
|
|
2035
2292
|
}, [id, syncScroll]);
|
|
2036
|
-
return /* @__PURE__ */
|
|
2293
|
+
return /* @__PURE__ */ jsxs25("section", {
|
|
2037
2294
|
ref,
|
|
2038
2295
|
id,
|
|
2039
2296
|
"data-section": id,
|
|
2040
2297
|
className: cn("openpkg-method-section", "mb-20 last:mb-0", className),
|
|
2041
2298
|
children: [
|
|
2042
|
-
/* @__PURE__ */
|
|
2299
|
+
/* @__PURE__ */ jsx43("h2", {
|
|
2043
2300
|
className: cn("text-2xl font-semibold tracking-tight", "text-[var(--openpkg-text-primary)]", "mb-4"),
|
|
2044
2301
|
children: title
|
|
2045
2302
|
}),
|
|
2046
|
-
signature && /* @__PURE__ */
|
|
2303
|
+
signature && /* @__PURE__ */ jsx43("code", {
|
|
2047
2304
|
className: cn("block font-mono text-sm", "text-[var(--openpkg-text-muted)]", "mb-6"),
|
|
2048
2305
|
children: signature
|
|
2049
2306
|
}),
|
|
2050
|
-
description && /* @__PURE__ */
|
|
2307
|
+
description && /* @__PURE__ */ jsx43("div", {
|
|
2051
2308
|
className: cn("openpkg-method-description", "text-[15px] leading-relaxed", "text-[var(--openpkg-text-secondary)]", "mb-6", "[&_a]:text-[var(--openpkg-accent-link)] [&_a]:no-underline [&_a]:font-medium hover:[&_a]:underline", "[&_code]:bg-[var(--openpkg-bg-badge)] [&_code]:px-1.5 [&_code]:py-0.5 [&_code]:rounded [&_code]:font-mono [&_code]:text-[13px]"),
|
|
2052
|
-
children: typeof description === "string" ? /* @__PURE__ */
|
|
2309
|
+
children: typeof description === "string" ? /* @__PURE__ */ jsx43("p", {
|
|
2053
2310
|
children: description
|
|
2054
2311
|
}) : description
|
|
2055
2312
|
}),
|
|
2056
|
-
notes && notes.length > 0 && /* @__PURE__ */
|
|
2313
|
+
notes && notes.length > 0 && /* @__PURE__ */ jsx43("ul", {
|
|
2057
2314
|
className: cn("openpkg-method-notes", "list-disc list-inside", "text-[15px] leading-relaxed", "text-[var(--openpkg-text-secondary)]", "mb-8 space-y-2"),
|
|
2058
|
-
children: notes.map((note, i) => /* @__PURE__ */
|
|
2315
|
+
children: notes.map((note, i) => /* @__PURE__ */ jsx43("li", {
|
|
2059
2316
|
children: note
|
|
2060
2317
|
}, i))
|
|
2061
2318
|
}),
|
|
2062
|
-
children && /* @__PURE__ */
|
|
2319
|
+
children && /* @__PURE__ */ jsxs25("div", {
|
|
2063
2320
|
className: "openpkg-method-params",
|
|
2064
2321
|
children: [
|
|
2065
|
-
/* @__PURE__ */
|
|
2322
|
+
/* @__PURE__ */ jsx43("h3", {
|
|
2066
2323
|
className: cn("text-xs font-semibold uppercase tracking-wider", "text-[var(--openpkg-text-muted)]", "mb-4 pb-2", "border-b border-[var(--openpkg-border-subtle)]"),
|
|
2067
2324
|
children: "Parameters"
|
|
2068
2325
|
}),
|
|
@@ -2080,10 +2337,10 @@ function useSyncScrollSafe2() {
|
|
|
2080
2337
|
}
|
|
2081
2338
|
}
|
|
2082
2339
|
// src/docskit/api/parameter-list.tsx
|
|
2083
|
-
import { ChevronDown as
|
|
2340
|
+
import { ChevronDown as ChevronDown3 } from "lucide-react";
|
|
2084
2341
|
import * as React6 from "react";
|
|
2085
|
-
import { useState as
|
|
2086
|
-
import { jsx as
|
|
2342
|
+
import { useState as useState13 } from "react";
|
|
2343
|
+
import { jsx as jsx44, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
2087
2344
|
|
|
2088
2345
|
function ParameterList({
|
|
2089
2346
|
title,
|
|
@@ -2091,28 +2348,28 @@ function ParameterList({
|
|
|
2091
2348
|
children,
|
|
2092
2349
|
className
|
|
2093
2350
|
}) {
|
|
2094
|
-
const [expanded, setExpanded] =
|
|
2351
|
+
const [expanded, setExpanded] = useState13(false);
|
|
2095
2352
|
const childArray = React6.Children.toArray(children);
|
|
2096
2353
|
const shouldCollapse = collapseAfter !== undefined && childArray.length > collapseAfter;
|
|
2097
2354
|
const visibleChildren = shouldCollapse && !expanded ? childArray.slice(0, collapseAfter) : childArray;
|
|
2098
2355
|
const hiddenCount = shouldCollapse ? childArray.length - collapseAfter : 0;
|
|
2099
|
-
return /* @__PURE__ */
|
|
2356
|
+
return /* @__PURE__ */ jsxs26("div", {
|
|
2100
2357
|
className: cn("", className),
|
|
2101
2358
|
children: [
|
|
2102
|
-
title && /* @__PURE__ */
|
|
2359
|
+
title && /* @__PURE__ */ jsx44("h3", {
|
|
2103
2360
|
className: "text-sm font-medium text-foreground mb-3 uppercase tracking-wide",
|
|
2104
2361
|
children: title
|
|
2105
2362
|
}),
|
|
2106
|
-
/* @__PURE__ */
|
|
2363
|
+
/* @__PURE__ */ jsx44("div", {
|
|
2107
2364
|
className: "divide-y divide-border border-t border-b border-border",
|
|
2108
2365
|
children: visibleChildren
|
|
2109
2366
|
}),
|
|
2110
|
-
shouldCollapse && !expanded && /* @__PURE__ */
|
|
2367
|
+
shouldCollapse && !expanded && /* @__PURE__ */ jsxs26("button", {
|
|
2111
2368
|
type: "button",
|
|
2112
2369
|
onClick: () => setExpanded(true),
|
|
2113
2370
|
className: "flex items-center gap-1 mt-3 text-sm text-primary hover:underline cursor-pointer",
|
|
2114
2371
|
children: [
|
|
2115
|
-
/* @__PURE__ */
|
|
2372
|
+
/* @__PURE__ */ jsx44(ChevronDown3, {
|
|
2116
2373
|
size: 14
|
|
2117
2374
|
}),
|
|
2118
2375
|
"Show ",
|
|
@@ -2126,41 +2383,41 @@ function ParameterList({
|
|
|
2126
2383
|
}
|
|
2127
2384
|
// src/docskit/api/response-block.tsx
|
|
2128
2385
|
import { Check as Check3, Copy as Copy3 } from "lucide-react";
|
|
2129
|
-
import { useState as
|
|
2130
|
-
import { jsx as
|
|
2386
|
+
import { useState as useState14 } from "react";
|
|
2387
|
+
import { jsx as jsx45, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
2131
2388
|
|
|
2132
2389
|
function ResponseBlock({ data, title, className }) {
|
|
2133
|
-
const [copied, setCopied] =
|
|
2390
|
+
const [copied, setCopied] = useState14(false);
|
|
2134
2391
|
const jsonString = JSON.stringify(data, null, 2);
|
|
2135
2392
|
const handleCopy = () => {
|
|
2136
2393
|
navigator.clipboard.writeText(jsonString);
|
|
2137
2394
|
setCopied(true);
|
|
2138
2395
|
setTimeout(() => setCopied(false), 1200);
|
|
2139
2396
|
};
|
|
2140
|
-
return /* @__PURE__ */
|
|
2397
|
+
return /* @__PURE__ */ jsxs27("div", {
|
|
2141
2398
|
className: cn("group rounded-lg border border-border overflow-hidden bg-muted/30", className),
|
|
2142
2399
|
children: [
|
|
2143
|
-
title && /* @__PURE__ */
|
|
2400
|
+
title && /* @__PURE__ */ jsxs27("div", {
|
|
2144
2401
|
className: "flex items-center justify-between px-4 py-2 border-b border-border bg-muted/50",
|
|
2145
2402
|
children: [
|
|
2146
|
-
/* @__PURE__ */
|
|
2403
|
+
/* @__PURE__ */ jsx45("span", {
|
|
2147
2404
|
className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
|
|
2148
2405
|
children: title
|
|
2149
2406
|
}),
|
|
2150
|
-
/* @__PURE__ */
|
|
2407
|
+
/* @__PURE__ */ jsx45("button", {
|
|
2151
2408
|
type: "button",
|
|
2152
2409
|
onClick: handleCopy,
|
|
2153
2410
|
className: "p-1 rounded text-muted-foreground hover:text-foreground opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",
|
|
2154
2411
|
"aria-label": "Copy response",
|
|
2155
|
-
children: copied ? /* @__PURE__ */
|
|
2412
|
+
children: copied ? /* @__PURE__ */ jsx45(Check3, {
|
|
2156
2413
|
size: 14
|
|
2157
|
-
}) : /* @__PURE__ */
|
|
2414
|
+
}) : /* @__PURE__ */ jsx45(Copy3, {
|
|
2158
2415
|
size: 14
|
|
2159
2416
|
})
|
|
2160
2417
|
})
|
|
2161
2418
|
]
|
|
2162
2419
|
}),
|
|
2163
|
-
/* @__PURE__ */
|
|
2420
|
+
/* @__PURE__ */ jsx45(ClientDocsKitCode, {
|
|
2164
2421
|
codeblock: {
|
|
2165
2422
|
value: jsonString,
|
|
2166
2423
|
lang: "json",
|
|
@@ -2173,11 +2430,11 @@ function ResponseBlock({ data, title, className }) {
|
|
|
2173
2430
|
}
|
|
2174
2431
|
// src/docskit/code.tsx
|
|
2175
2432
|
import { highlight as highlight2, Pre as Pre2 } from "codehike/code";
|
|
2176
|
-
import { jsx as
|
|
2433
|
+
import { jsx as jsx46, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
2177
2434
|
async function DocsKitCode(props) {
|
|
2178
2435
|
const { codeblock, className, ...rest } = props;
|
|
2179
2436
|
const group = await toCodeGroup({ codeblocks: [codeblock], ...rest });
|
|
2180
|
-
return /* @__PURE__ */
|
|
2437
|
+
return /* @__PURE__ */ jsx46(SingleCode, {
|
|
2181
2438
|
group,
|
|
2182
2439
|
className
|
|
2183
2440
|
});
|
|
@@ -2185,30 +2442,30 @@ async function DocsKitCode(props) {
|
|
|
2185
2442
|
async function SingleCode(props) {
|
|
2186
2443
|
const { pre, title, code, icon: icon2, options } = props.group.tabs[0];
|
|
2187
2444
|
const showCopy = options?.copyButton;
|
|
2188
|
-
return /* @__PURE__ */
|
|
2445
|
+
return /* @__PURE__ */ jsxs28("div", {
|
|
2189
2446
|
className: cn("group rounded overflow-hidden relative border-openpkg-code-border flex flex-col border my-4 not-prose", props.className),
|
|
2190
2447
|
children: [
|
|
2191
|
-
title ? /* @__PURE__ */
|
|
2448
|
+
title ? /* @__PURE__ */ jsx46("div", {
|
|
2192
2449
|
className: cn("border-b-[1px] border-openpkg-code-border bg-openpkg-code-header px-3 py-0", "w-full h-9 flex items-center shrink-0", "text-openpkg-code-text-inactive text-sm font-mono"),
|
|
2193
|
-
children: /* @__PURE__ */
|
|
2450
|
+
children: /* @__PURE__ */ jsxs28("div", {
|
|
2194
2451
|
className: "flex items-center h-5 gap-2",
|
|
2195
2452
|
children: [
|
|
2196
|
-
/* @__PURE__ */
|
|
2453
|
+
/* @__PURE__ */ jsx46("div", {
|
|
2197
2454
|
className: "size-4",
|
|
2198
2455
|
children: icon2
|
|
2199
2456
|
}),
|
|
2200
|
-
/* @__PURE__ */
|
|
2457
|
+
/* @__PURE__ */ jsx46("span", {
|
|
2201
2458
|
className: "leading-none",
|
|
2202
2459
|
children: title
|
|
2203
2460
|
})
|
|
2204
2461
|
]
|
|
2205
2462
|
})
|
|
2206
2463
|
}) : null,
|
|
2207
|
-
/* @__PURE__ */
|
|
2464
|
+
/* @__PURE__ */ jsxs28("div", {
|
|
2208
2465
|
className: "relative flex items-start",
|
|
2209
2466
|
children: [
|
|
2210
2467
|
pre,
|
|
2211
|
-
showCopy && /* @__PURE__ */
|
|
2468
|
+
showCopy && /* @__PURE__ */ jsx46(CopyButton, {
|
|
2212
2469
|
text: code,
|
|
2213
2470
|
variant: "floating",
|
|
2214
2471
|
className: cn("absolute right-3 z-10 text-openpkg-code-text-inactive", "top-3")
|
|
@@ -2235,13 +2492,13 @@ async function toCodeGroup(props) {
|
|
|
2235
2492
|
options,
|
|
2236
2493
|
title,
|
|
2237
2494
|
code: highlighted.code,
|
|
2238
|
-
icon: /* @__PURE__ */
|
|
2495
|
+
icon: /* @__PURE__ */ jsx46(CodeIcon, {
|
|
2239
2496
|
title,
|
|
2240
2497
|
lang: tab.lang,
|
|
2241
2498
|
className: "opacity-60"
|
|
2242
2499
|
}),
|
|
2243
2500
|
lang: tab.lang,
|
|
2244
|
-
pre: /* @__PURE__ */
|
|
2501
|
+
pre: /* @__PURE__ */ jsx46(Pre2, {
|
|
2245
2502
|
code: highlighted,
|
|
2246
2503
|
className: "overflow-auto px-0 py-3 m-0 rounded-none !bg-openpkg-code-bg selection:bg-openpkg-code-selection selection:text-current max-h-full flex-1",
|
|
2247
2504
|
style: highlightedStyle,
|
|
@@ -2262,40 +2519,43 @@ function extractFlags2(codeblock) {
|
|
|
2262
2519
|
return { title, flags: flags.slice(1) };
|
|
2263
2520
|
}
|
|
2264
2521
|
// src/docskit/code.client.tsx
|
|
2265
|
-
import { jsx as
|
|
2522
|
+
import { jsx as jsx47, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
2266
2523
|
|
|
2267
|
-
function MultiCode({
|
|
2524
|
+
function MultiCode({
|
|
2525
|
+
group,
|
|
2526
|
+
className
|
|
2527
|
+
}) {
|
|
2268
2528
|
const [storedTitle, setCurrentTitle] = useStateOrLocalStorage(group.storage, group.tabs[0].title);
|
|
2269
2529
|
const current = group.tabs.find((tab) => tab.title === storedTitle) || group.tabs[0];
|
|
2270
2530
|
const { code } = current;
|
|
2271
2531
|
const currentTitle = current?.title;
|
|
2272
|
-
return /* @__PURE__ */
|
|
2532
|
+
return /* @__PURE__ */ jsxs29(Tabs, {
|
|
2273
2533
|
value: currentTitle,
|
|
2274
2534
|
onValueChange: setCurrentTitle,
|
|
2275
2535
|
className: cn("group border rounded selection:bg-openpkg-code-selection selection:text-current border-openpkg-code-border overflow-hidden relative flex flex-col max-h-full min-h-0 my-4 gap-0 not-prose", className),
|
|
2276
2536
|
children: [
|
|
2277
|
-
/* @__PURE__ */
|
|
2537
|
+
/* @__PURE__ */ jsx47(TabsList, {
|
|
2278
2538
|
className: cn("border-b border-openpkg-code-border bg-openpkg-code-header w-full h-9 min-h-9 shrink-0", "rounded-none p-0 m-0 justify-start items-stretch"),
|
|
2279
|
-
children: group.tabs.map(({ icon: icon2, title }, _index) => /* @__PURE__ */
|
|
2539
|
+
children: group.tabs.map(({ icon: icon2, title }, _index) => /* @__PURE__ */ jsxs29(TabsTrigger, {
|
|
2280
2540
|
value: title,
|
|
2281
2541
|
className: cn("rounded-none transition-colors duration-200 gap-1.5 px-3 font-mono justify-start grow-0", "border-r border-openpkg-code-border", "text-openpkg-code-text-inactive data-[state=active]:text-openpkg-code-text-active hover:text-openpkg-code-text-active", "data-[state=active]:bg-openpkg-code-bg/50"),
|
|
2282
2542
|
children: [
|
|
2283
|
-
/* @__PURE__ */
|
|
2543
|
+
/* @__PURE__ */ jsx47("div", {
|
|
2284
2544
|
children: icon2
|
|
2285
2545
|
}),
|
|
2286
|
-
/* @__PURE__ */
|
|
2546
|
+
/* @__PURE__ */ jsx47("span", {
|
|
2287
2547
|
className: "leading-none",
|
|
2288
2548
|
children: title
|
|
2289
2549
|
})
|
|
2290
2550
|
]
|
|
2291
2551
|
}, title))
|
|
2292
2552
|
}),
|
|
2293
|
-
/* @__PURE__ */
|
|
2553
|
+
/* @__PURE__ */ jsxs29(TabsContent, {
|
|
2294
2554
|
value: current.title,
|
|
2295
2555
|
className: "relative min-h-0 mt-0 flex flex-col",
|
|
2296
2556
|
children: [
|
|
2297
2557
|
current.pre,
|
|
2298
|
-
group.options.copyButton && /* @__PURE__ */
|
|
2558
|
+
group.options.copyButton && /* @__PURE__ */ jsx47(CopyButton, {
|
|
2299
2559
|
text: code,
|
|
2300
2560
|
variant: "floating",
|
|
2301
2561
|
className: "absolute right-3 top-3 z-10 text-openpkg-code-text-inactive"
|
|
@@ -2310,18 +2570,18 @@ import {
|
|
|
2310
2570
|
highlight as highlight3,
|
|
2311
2571
|
Pre as Pre3
|
|
2312
2572
|
} from "codehike/code";
|
|
2313
|
-
import { ChevronDown as
|
|
2314
|
-
import { useEffect as useEffect6, useState as
|
|
2315
|
-
import { jsx as
|
|
2573
|
+
import { ChevronDown as ChevronDown4, ChevronUp } from "lucide-react";
|
|
2574
|
+
import { useEffect as useEffect6, useState as useState15 } from "react";
|
|
2575
|
+
import { jsx as jsx48, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
2316
2576
|
|
|
2317
2577
|
function StackedChevrons({ isOpen, className }) {
|
|
2318
|
-
return /* @__PURE__ */
|
|
2578
|
+
return /* @__PURE__ */ jsxs30("div", {
|
|
2319
2579
|
className: cn("flex flex-col items-center -space-y-1 transition-opacity", className),
|
|
2320
2580
|
children: [
|
|
2321
|
-
/* @__PURE__ */
|
|
2581
|
+
/* @__PURE__ */ jsx48(ChevronUp, {
|
|
2322
2582
|
className: cn("size-3 transition-colors", isOpen ? "text-openpkg-code-text-active" : "text-openpkg-code-text-inactive")
|
|
2323
2583
|
}),
|
|
2324
|
-
/* @__PURE__ */
|
|
2584
|
+
/* @__PURE__ */ jsx48(ChevronDown4, {
|
|
2325
2585
|
className: cn("size-3 transition-colors", isOpen ? "text-openpkg-code-text-active" : "text-openpkg-code-text-inactive")
|
|
2326
2586
|
})
|
|
2327
2587
|
]
|
|
@@ -2337,8 +2597,8 @@ function ClientDiffCode(props) {
|
|
|
2337
2597
|
className: wrapperClassName,
|
|
2338
2598
|
defaultOpen = true
|
|
2339
2599
|
} = props;
|
|
2340
|
-
const [highlighted, setHighlighted] =
|
|
2341
|
-
const [isOpen, setIsOpen] =
|
|
2600
|
+
const [highlighted, setHighlighted] = useState15(null);
|
|
2601
|
+
const [isOpen, setIsOpen] = useState15(defaultOpen);
|
|
2342
2602
|
const { title, flags } = extractFlags3(codeblock);
|
|
2343
2603
|
const options = flagsToOptions(flags);
|
|
2344
2604
|
const filename = filenameProp || title || "file";
|
|
@@ -2353,7 +2613,7 @@ function ClientDiffCode(props) {
|
|
|
2353
2613
|
};
|
|
2354
2614
|
}, [codeblock.value, codeblock.lang, codeblock.meta, codeblock]);
|
|
2355
2615
|
if (!highlighted) {
|
|
2356
|
-
return /* @__PURE__ */
|
|
2616
|
+
return /* @__PURE__ */ jsx48(CodeBlockSkeleton, {
|
|
2357
2617
|
hasTitle: true
|
|
2358
2618
|
});
|
|
2359
2619
|
}
|
|
@@ -2363,53 +2623,53 @@ function ClientDiffCode(props) {
|
|
|
2363
2623
|
}
|
|
2364
2624
|
const { background: _background, ...highlightedStyle } = highlighted.style;
|
|
2365
2625
|
const showCopy = options?.copyButton;
|
|
2366
|
-
const icon2 = /* @__PURE__ */
|
|
2626
|
+
const icon2 = /* @__PURE__ */ jsx48(CodeIcon, {
|
|
2367
2627
|
title: filename,
|
|
2368
2628
|
lang: codeblock.lang,
|
|
2369
2629
|
className: "opacity-60"
|
|
2370
2630
|
});
|
|
2371
2631
|
const hasAdditions = diff2?.additions !== undefined && diff2.additions > 0;
|
|
2372
2632
|
const hasDeletions = diff2?.deletions !== undefined && diff2.deletions > 0;
|
|
2373
|
-
return /* @__PURE__ */
|
|
2633
|
+
return /* @__PURE__ */ jsx48(Collapsible, {
|
|
2374
2634
|
open: isOpen,
|
|
2375
2635
|
onOpenChange: setIsOpen,
|
|
2376
|
-
children: /* @__PURE__ */
|
|
2636
|
+
children: /* @__PURE__ */ jsxs30("div", {
|
|
2377
2637
|
className: cn("group rounded overflow-hidden relative border-openpkg-code-border flex flex-col border my-4 not-prose", wrapperClassName),
|
|
2378
2638
|
children: [
|
|
2379
|
-
/* @__PURE__ */
|
|
2639
|
+
/* @__PURE__ */ jsx48(CollapsibleTrigger2, {
|
|
2380
2640
|
asChild: true,
|
|
2381
|
-
children: /* @__PURE__ */
|
|
2641
|
+
children: /* @__PURE__ */ jsxs30("button", {
|
|
2382
2642
|
type: "button",
|
|
2383
2643
|
className: cn("border-b border-openpkg-code-border bg-openpkg-code-header px-3 py-0", "w-full h-9 flex items-center shrink-0 cursor-pointer", "text-openpkg-code-text-inactive text-sm font-mono", "hover:bg-openpkg-code-bg/50 transition-colors"),
|
|
2384
2644
|
children: [
|
|
2385
|
-
/* @__PURE__ */
|
|
2645
|
+
/* @__PURE__ */ jsxs30("div", {
|
|
2386
2646
|
className: "flex items-center h-5 gap-2 flex-1 min-w-0",
|
|
2387
2647
|
children: [
|
|
2388
|
-
/* @__PURE__ */
|
|
2648
|
+
/* @__PURE__ */ jsx48("div", {
|
|
2389
2649
|
className: "size-4 shrink-0",
|
|
2390
2650
|
children: icon2
|
|
2391
2651
|
}),
|
|
2392
|
-
path && /* @__PURE__ */
|
|
2652
|
+
path && /* @__PURE__ */ jsx48("span", {
|
|
2393
2653
|
className: "text-openpkg-code-text-inactive truncate",
|
|
2394
2654
|
children: path
|
|
2395
2655
|
}),
|
|
2396
|
-
/* @__PURE__ */
|
|
2656
|
+
/* @__PURE__ */ jsx48("span", {
|
|
2397
2657
|
className: "text-openpkg-code-text-active font-medium truncate",
|
|
2398
2658
|
children: filename
|
|
2399
2659
|
})
|
|
2400
2660
|
]
|
|
2401
2661
|
}),
|
|
2402
|
-
/* @__PURE__ */
|
|
2662
|
+
/* @__PURE__ */ jsxs30("div", {
|
|
2403
2663
|
className: "flex items-center gap-2 text-sm shrink-0 ml-2",
|
|
2404
2664
|
children: [
|
|
2405
|
-
hasAdditions && /* @__PURE__ */
|
|
2665
|
+
hasAdditions && /* @__PURE__ */ jsxs30("span", {
|
|
2406
2666
|
className: "text-green-500 font-medium",
|
|
2407
2667
|
children: [
|
|
2408
2668
|
"+",
|
|
2409
2669
|
diff2.additions
|
|
2410
2670
|
]
|
|
2411
2671
|
}),
|
|
2412
|
-
hasDeletions && /* @__PURE__ */
|
|
2672
|
+
hasDeletions && /* @__PURE__ */ jsxs30("span", {
|
|
2413
2673
|
className: "text-red-500 font-medium",
|
|
2414
2674
|
children: [
|
|
2415
2675
|
"-",
|
|
@@ -2418,24 +2678,24 @@ function ClientDiffCode(props) {
|
|
|
2418
2678
|
})
|
|
2419
2679
|
]
|
|
2420
2680
|
}),
|
|
2421
|
-
/* @__PURE__ */
|
|
2681
|
+
/* @__PURE__ */ jsx48(StackedChevrons, {
|
|
2422
2682
|
isOpen,
|
|
2423
2683
|
className: "ml-2"
|
|
2424
2684
|
})
|
|
2425
2685
|
]
|
|
2426
2686
|
})
|
|
2427
2687
|
}),
|
|
2428
|
-
/* @__PURE__ */
|
|
2429
|
-
children: /* @__PURE__ */
|
|
2688
|
+
/* @__PURE__ */ jsx48(CollapsibleContent2, {
|
|
2689
|
+
children: /* @__PURE__ */ jsxs30("div", {
|
|
2430
2690
|
className: "relative flex items-start",
|
|
2431
2691
|
children: [
|
|
2432
|
-
/* @__PURE__ */
|
|
2692
|
+
/* @__PURE__ */ jsx48(Pre3, {
|
|
2433
2693
|
code: highlighted,
|
|
2434
2694
|
className: "overflow-auto px-0 py-3 m-0 rounded-none !bg-openpkg-code-bg selection:bg-openpkg-code-selection selection:text-current max-h-full flex-1",
|
|
2435
2695
|
style: highlightedStyle,
|
|
2436
2696
|
handlers
|
|
2437
2697
|
}),
|
|
2438
|
-
showCopy && /* @__PURE__ */
|
|
2698
|
+
showCopy && /* @__PURE__ */ jsx48(CopyButton, {
|
|
2439
2699
|
text: highlighted.code,
|
|
2440
2700
|
variant: "floating",
|
|
2441
2701
|
className: "absolute right-3 top-3 z-10 text-openpkg-code-text-inactive"
|
|
@@ -2456,121 +2716,21 @@ function extractFlags3(codeblock) {
|
|
|
2456
2716
|
}
|
|
2457
2717
|
// src/docskit/code.inline.tsx
|
|
2458
2718
|
import { highlight as highlight4, Inline as Inline2 } from "codehike/code";
|
|
2459
|
-
import { jsx as
|
|
2460
|
-
async function DocsKitInlineCode({
|
|
2719
|
+
import { jsx as jsx49 } from "react/jsx-runtime";
|
|
2720
|
+
async function DocsKitInlineCode({
|
|
2721
|
+
codeblock
|
|
2722
|
+
}) {
|
|
2461
2723
|
const highlighted = await highlight4(codeblock, theme);
|
|
2462
|
-
return /* @__PURE__ */
|
|
2724
|
+
return /* @__PURE__ */ jsx49(Inline2, {
|
|
2463
2725
|
code: highlighted,
|
|
2464
2726
|
className: "selection:bg-openpkg-code-selection selection:text-current rounded border border-openpkg-code-border px-1 py-0.5 whitespace-nowrap !bg-openpkg-code-bg",
|
|
2465
2727
|
style: highlighted.style
|
|
2466
2728
|
});
|
|
2467
2729
|
}
|
|
2468
|
-
// src/docskit/code.package-install.tsx
|
|
2469
|
-
import { useState as useState14 } from "react";
|
|
2470
|
-
import { jsx as jsx47, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
2471
|
-
|
|
2472
|
-
var managerLabels = {
|
|
2473
|
-
npm: "npm",
|
|
2474
|
-
bun: "bun",
|
|
2475
|
-
pnpm: "pnpm",
|
|
2476
|
-
yarn: "yarn"
|
|
2477
|
-
};
|
|
2478
|
-
function getInstallCommand(manager, pkg, options) {
|
|
2479
|
-
const { dev, global: isGlobal } = options;
|
|
2480
|
-
if (isGlobal) {
|
|
2481
|
-
switch (manager) {
|
|
2482
|
-
case "npm":
|
|
2483
|
-
return `npm install -g ${pkg}`;
|
|
2484
|
-
case "bun":
|
|
2485
|
-
return `bun install -g ${pkg}`;
|
|
2486
|
-
case "pnpm":
|
|
2487
|
-
return `pnpm install -g ${pkg}`;
|
|
2488
|
-
case "yarn":
|
|
2489
|
-
return `yarn global add ${pkg}`;
|
|
2490
|
-
}
|
|
2491
|
-
}
|
|
2492
|
-
if (dev) {
|
|
2493
|
-
switch (manager) {
|
|
2494
|
-
case "npm":
|
|
2495
|
-
return `npm install -D ${pkg}`;
|
|
2496
|
-
case "bun":
|
|
2497
|
-
return `bun add -d ${pkg}`;
|
|
2498
|
-
case "pnpm":
|
|
2499
|
-
return `pnpm add -D ${pkg}`;
|
|
2500
|
-
case "yarn":
|
|
2501
|
-
return `yarn add -D ${pkg}`;
|
|
2502
|
-
}
|
|
2503
|
-
}
|
|
2504
|
-
switch (manager) {
|
|
2505
|
-
case "npm":
|
|
2506
|
-
return `npm install ${pkg}`;
|
|
2507
|
-
case "bun":
|
|
2508
|
-
return `bun add ${pkg}`;
|
|
2509
|
-
case "pnpm":
|
|
2510
|
-
return `pnpm add ${pkg}`;
|
|
2511
|
-
case "yarn":
|
|
2512
|
-
return `yarn add ${pkg}`;
|
|
2513
|
-
}
|
|
2514
|
-
}
|
|
2515
|
-
function PackageInstall({
|
|
2516
|
-
package: pkg,
|
|
2517
|
-
dev = false,
|
|
2518
|
-
global: isGlobal = false,
|
|
2519
|
-
managers = ["npm", "bun", "pnpm", "yarn"],
|
|
2520
|
-
copyButton = true
|
|
2521
|
-
}) {
|
|
2522
|
-
const [activeManager, setActiveManager] = useState14(managers[0]);
|
|
2523
|
-
const command = getInstallCommand(activeManager, pkg, { dev, global: isGlobal });
|
|
2524
|
-
return /* @__PURE__ */ jsxs28("div", {
|
|
2525
|
-
className: "group rounded overflow-hidden border border-openpkg-code-border flex flex-col my-4 not-prose",
|
|
2526
|
-
children: [
|
|
2527
|
-
/* @__PURE__ */ jsxs28("div", {
|
|
2528
|
-
className: cn("border-b border-openpkg-code-border bg-openpkg-code-header", "w-full h-9 flex items-center px-3 gap-2 shrink-0"),
|
|
2529
|
-
children: [
|
|
2530
|
-
/* @__PURE__ */ jsxs28("div", {
|
|
2531
|
-
className: "flex items-center gap-2",
|
|
2532
|
-
children: [
|
|
2533
|
-
/* @__PURE__ */ jsx47("div", {
|
|
2534
|
-
className: "size-3 rounded-full bg-openpkg-code-text-inactive/30"
|
|
2535
|
-
}),
|
|
2536
|
-
/* @__PURE__ */ jsx47("div", {
|
|
2537
|
-
className: "size-3 rounded-full bg-openpkg-code-text-inactive/30"
|
|
2538
|
-
}),
|
|
2539
|
-
/* @__PURE__ */ jsx47("div", {
|
|
2540
|
-
className: "size-3 rounded-full bg-openpkg-code-text-inactive/30"
|
|
2541
|
-
})
|
|
2542
|
-
]
|
|
2543
|
-
}),
|
|
2544
|
-
/* @__PURE__ */ jsx47("div", {
|
|
2545
|
-
className: "flex items-center gap-0.5 ml-1",
|
|
2546
|
-
children: managers.map((manager) => /* @__PURE__ */ jsx47("button", {
|
|
2547
|
-
type: "button",
|
|
2548
|
-
onClick: () => setActiveManager(manager),
|
|
2549
|
-
className: cn("px-2 py-0.5 text-sm font-medium rounded-md transition-colors duration-200", "border h-6", activeManager === manager ? "bg-openpkg-code-bg border-openpkg-code-border text-openpkg-code-text-active" : "border-transparent text-openpkg-code-text-inactive hover:text-openpkg-code-text-active"),
|
|
2550
|
-
children: managerLabels[manager]
|
|
2551
|
-
}, manager))
|
|
2552
|
-
}),
|
|
2553
|
-
/* @__PURE__ */ jsx47("span", {
|
|
2554
|
-
className: "sr-only",
|
|
2555
|
-
children: "Terminal window"
|
|
2556
|
-
})
|
|
2557
|
-
]
|
|
2558
|
-
}),
|
|
2559
|
-
/* @__PURE__ */ jsx47(ClientDocsKitCode, {
|
|
2560
|
-
codeblock: {
|
|
2561
|
-
value: command,
|
|
2562
|
-
lang: "bash",
|
|
2563
|
-
meta: copyButton ? "-c" : ""
|
|
2564
|
-
},
|
|
2565
|
-
className: "!my-0 !border-0 !rounded-none"
|
|
2566
|
-
})
|
|
2567
|
-
]
|
|
2568
|
-
});
|
|
2569
|
-
}
|
|
2570
2730
|
// src/docskit/code.tabs.tsx
|
|
2571
2731
|
import { Block, CodeBlock as CodeBlock2 } from "codehike/blocks";
|
|
2572
2732
|
import { z } from "zod";
|
|
2573
|
-
import { jsx as
|
|
2733
|
+
import { jsx as jsx50 } from "react/jsx-runtime";
|
|
2574
2734
|
async function CodeGroup(props) {
|
|
2575
2735
|
const result = Block.extend({
|
|
2576
2736
|
code: z.array(CodeBlock2),
|
|
@@ -2582,16 +2742,16 @@ async function CodeGroup(props) {
|
|
|
2582
2742
|
throw betterError(result.error, "CodeGroup");
|
|
2583
2743
|
}
|
|
2584
2744
|
const { code, ...rest } = result.data;
|
|
2585
|
-
return /* @__PURE__ */
|
|
2745
|
+
return /* @__PURE__ */ jsx50(Code, {
|
|
2586
2746
|
codeblocks: code,
|
|
2587
2747
|
...rest
|
|
2588
2748
|
});
|
|
2589
2749
|
}
|
|
2590
2750
|
async function Code(props) {
|
|
2591
2751
|
const group = await toCodeGroup(props);
|
|
2592
|
-
return group.tabs.length === 1 ? /* @__PURE__ */
|
|
2752
|
+
return group.tabs.length === 1 ? /* @__PURE__ */ jsx50(SingleCode, {
|
|
2593
2753
|
group
|
|
2594
|
-
}) : /* @__PURE__ */
|
|
2754
|
+
}) : /* @__PURE__ */ jsx50(MultiCode, {
|
|
2595
2755
|
group
|
|
2596
2756
|
}, group.storage);
|
|
2597
2757
|
}
|
|
@@ -2605,7 +2765,7 @@ function betterError(error, componentName) {
|
|
|
2605
2765
|
}
|
|
2606
2766
|
// src/docskit/code.terminal.tsx
|
|
2607
2767
|
import { highlight as highlight5, Pre as Pre4 } from "codehike/code";
|
|
2608
|
-
import { jsx as
|
|
2768
|
+
import { jsx as jsx51, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
2609
2769
|
async function Terminal(props) {
|
|
2610
2770
|
const { codeblock, handlers: extraHandlers } = props;
|
|
2611
2771
|
const { flags } = extractFlags4(codeblock);
|
|
@@ -2619,42 +2779,42 @@ async function Terminal(props) {
|
|
|
2619
2779
|
const showCopy = options?.copyButton;
|
|
2620
2780
|
const isMultiLine = highlighted.code.includes(`
|
|
2621
2781
|
`);
|
|
2622
|
-
return /* @__PURE__ */
|
|
2782
|
+
return /* @__PURE__ */ jsxs31("div", {
|
|
2623
2783
|
className: "group rounded overflow-hidden relative border-openpkg-code-border flex flex-col border my-4 not-prose",
|
|
2624
2784
|
children: [
|
|
2625
|
-
/* @__PURE__ */
|
|
2785
|
+
/* @__PURE__ */ jsxs31("div", {
|
|
2626
2786
|
className: cn("border-b border-openpkg-code-border bg-openpkg-code-header", "w-full h-9 flex items-center justify-center shrink-0", "relative"),
|
|
2627
2787
|
children: [
|
|
2628
|
-
/* @__PURE__ */
|
|
2788
|
+
/* @__PURE__ */ jsxs31("div", {
|
|
2629
2789
|
className: "absolute left-3 flex items-center gap-2",
|
|
2630
2790
|
children: [
|
|
2631
|
-
/* @__PURE__ */
|
|
2791
|
+
/* @__PURE__ */ jsx51("div", {
|
|
2632
2792
|
className: "size-3 rounded-full bg-openpkg-code-text-inactive/30"
|
|
2633
2793
|
}),
|
|
2634
|
-
/* @__PURE__ */
|
|
2794
|
+
/* @__PURE__ */ jsx51("div", {
|
|
2635
2795
|
className: "size-3 rounded-full bg-openpkg-code-text-inactive/30"
|
|
2636
2796
|
}),
|
|
2637
|
-
/* @__PURE__ */
|
|
2797
|
+
/* @__PURE__ */ jsx51("div", {
|
|
2638
2798
|
className: "size-3 rounded-full bg-openpkg-code-text-inactive/30"
|
|
2639
2799
|
})
|
|
2640
2800
|
]
|
|
2641
2801
|
}),
|
|
2642
|
-
/* @__PURE__ */
|
|
2802
|
+
/* @__PURE__ */ jsx51("span", {
|
|
2643
2803
|
className: "sr-only",
|
|
2644
2804
|
children: "Terminal window"
|
|
2645
2805
|
})
|
|
2646
2806
|
]
|
|
2647
2807
|
}),
|
|
2648
|
-
/* @__PURE__ */
|
|
2808
|
+
/* @__PURE__ */ jsxs31("div", {
|
|
2649
2809
|
className: "relative flex items-start",
|
|
2650
2810
|
children: [
|
|
2651
|
-
/* @__PURE__ */
|
|
2811
|
+
/* @__PURE__ */ jsx51(Pre4, {
|
|
2652
2812
|
code: highlighted,
|
|
2653
2813
|
className: "overflow-auto px-0 py-3 m-0 rounded-none !bg-openpkg-code-bg selection:bg-openpkg-code-selection selection:text-current max-h-full flex-1",
|
|
2654
2814
|
style: highlightedStyle,
|
|
2655
2815
|
handlers
|
|
2656
2816
|
}),
|
|
2657
|
-
showCopy && /* @__PURE__ */
|
|
2817
|
+
showCopy && /* @__PURE__ */ jsx51(CopyButton, {
|
|
2658
2818
|
text: highlighted.code,
|
|
2659
2819
|
variant: "floating",
|
|
2660
2820
|
className: cn("absolute right-3 z-10 text-openpkg-code-text-inactive", isMultiLine ? "top-3" : "top-1/2 -translate-y-1/2")
|
|
@@ -2682,8 +2842,56 @@ function addDocsKit(components) {
|
|
|
2682
2842
|
}
|
|
2683
2843
|
};
|
|
2684
2844
|
}
|
|
2845
|
+
// src/docskit/import-section.tsx
|
|
2846
|
+
import { Check as Check4, Copy as Copy4 } from "lucide-react";
|
|
2847
|
+
|
|
2848
|
+
// src/hooks/use-copy-to-clipboard.ts
|
|
2849
|
+
import { useCallback as useCallback2, useRef as useRef5, useState as useState16 } from "react";
|
|
2850
|
+
var COPY_FEEDBACK_MS = 1200;
|
|
2851
|
+
function useCopyToClipboard(timeout = COPY_FEEDBACK_MS) {
|
|
2852
|
+
const [copied, setCopied] = useState16(false);
|
|
2853
|
+
const timerRef = useRef5(undefined);
|
|
2854
|
+
const copy = useCallback2((text) => {
|
|
2855
|
+
navigator.clipboard.writeText(text).then(() => {
|
|
2856
|
+
setCopied(true);
|
|
2857
|
+
clearTimeout(timerRef.current);
|
|
2858
|
+
timerRef.current = setTimeout(() => setCopied(false), timeout);
|
|
2859
|
+
});
|
|
2860
|
+
}, [timeout]);
|
|
2861
|
+
return [copied, copy];
|
|
2862
|
+
}
|
|
2863
|
+
|
|
2864
|
+
// src/docskit/import-section.tsx
|
|
2865
|
+
import { jsx as jsx52, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
2866
|
+
|
|
2867
|
+
function ImportSection({ importStatement, className }) {
|
|
2868
|
+
const [copied, copy] = useCopyToClipboard();
|
|
2869
|
+
const handleCopy = () => {
|
|
2870
|
+
copy(importStatement);
|
|
2871
|
+
};
|
|
2872
|
+
return /* @__PURE__ */ jsxs32("div", {
|
|
2873
|
+
className: cn("group flex items-center justify-between gap-3", "rounded-lg border border-[var(--openpkg-border-subtle)] bg-[var(--openpkg-bg-secondary)] px-4 py-3", className),
|
|
2874
|
+
children: [
|
|
2875
|
+
/* @__PURE__ */ jsx52("code", {
|
|
2876
|
+
className: "font-mono text-sm text-[var(--openpkg-text-primary)] overflow-x-auto",
|
|
2877
|
+
children: importStatement
|
|
2878
|
+
}),
|
|
2879
|
+
/* @__PURE__ */ jsx52("button", {
|
|
2880
|
+
type: "button",
|
|
2881
|
+
onClick: handleCopy,
|
|
2882
|
+
className: cn("shrink-0 p-1.5 rounded", "text-[var(--openpkg-text-muted)] hover:text-[var(--openpkg-text-primary)]", "opacity-0 group-hover:opacity-100 transition-opacity duration-200", "cursor-pointer"),
|
|
2883
|
+
"aria-label": "Copy import statement",
|
|
2884
|
+
children: copied ? /* @__PURE__ */ jsx52(Check4, {
|
|
2885
|
+
size: 16
|
|
2886
|
+
}) : /* @__PURE__ */ jsx52(Copy4, {
|
|
2887
|
+
size: 16
|
|
2888
|
+
})
|
|
2889
|
+
})
|
|
2890
|
+
]
|
|
2891
|
+
});
|
|
2892
|
+
}
|
|
2685
2893
|
// src/docskit/notes.tsx
|
|
2686
|
-
import { jsx as
|
|
2894
|
+
import { jsx as jsx53 } from "react/jsx-runtime";
|
|
2687
2895
|
function WithNotes({ children, ...rest }) {
|
|
2688
2896
|
const notes = Object.entries(rest).filter(([name]) => name !== "title" && name !== "_data").map(([name, value]) => {
|
|
2689
2897
|
const block = value;
|
|
@@ -2697,7 +2905,7 @@ function WithNotes({ children, ...rest }) {
|
|
|
2697
2905
|
return {
|
|
2698
2906
|
name,
|
|
2699
2907
|
type: "code",
|
|
2700
|
-
children: /* @__PURE__ */
|
|
2908
|
+
children: /* @__PURE__ */ jsx53(Code, {
|
|
2701
2909
|
codeblocks: [block]
|
|
2702
2910
|
})
|
|
2703
2911
|
};
|
|
@@ -2705,7 +2913,7 @@ function WithNotes({ children, ...rest }) {
|
|
|
2705
2913
|
return {
|
|
2706
2914
|
name,
|
|
2707
2915
|
type: "image",
|
|
2708
|
-
children: /* @__PURE__ */
|
|
2916
|
+
children: /* @__PURE__ */ jsx53("img", {
|
|
2709
2917
|
src: block.url,
|
|
2710
2918
|
alt: block.alt
|
|
2711
2919
|
})
|
|
@@ -2714,54 +2922,82 @@ function WithNotes({ children, ...rest }) {
|
|
|
2714
2922
|
throw new Error("Invalid block inside <WithNotes />");
|
|
2715
2923
|
}
|
|
2716
2924
|
});
|
|
2717
|
-
return /* @__PURE__ */
|
|
2925
|
+
return /* @__PURE__ */ jsx53(WithClientNotes, {
|
|
2718
2926
|
notes,
|
|
2719
2927
|
children
|
|
2720
2928
|
});
|
|
2721
2929
|
}
|
|
2722
|
-
// src/docskit/
|
|
2723
|
-
import {
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
import { useCallback as useCallback2, useRef as useRef5, useState as useState15 } from "react";
|
|
2727
|
-
var COPY_FEEDBACK_MS = 1200;
|
|
2728
|
-
function useCopyToClipboard(timeout = COPY_FEEDBACK_MS) {
|
|
2729
|
-
const [copied, setCopied] = useState15(false);
|
|
2730
|
-
const timerRef = useRef5(undefined);
|
|
2731
|
-
const copy = useCallback2((text) => {
|
|
2732
|
-
navigator.clipboard.writeText(text).then(() => {
|
|
2733
|
-
setCopied(true);
|
|
2734
|
-
clearTimeout(timerRef.current);
|
|
2735
|
-
timerRef.current = setTimeout(() => setCopied(false), timeout);
|
|
2736
|
-
});
|
|
2737
|
-
}, [timeout]);
|
|
2738
|
-
return [copied, copy];
|
|
2739
|
-
}
|
|
2740
|
-
|
|
2741
|
-
// src/docskit/import-section.tsx
|
|
2742
|
-
import { jsx as jsx51, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
2930
|
+
// src/docskit/runnable-snippet.tsx
|
|
2931
|
+
import { Loader2, Play } from "lucide-react";
|
|
2932
|
+
import { useState as useState17 } from "react";
|
|
2933
|
+
import { jsx as jsx54, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
2743
2934
|
|
|
2744
|
-
function
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2935
|
+
function RunnableSnippet({
|
|
2936
|
+
code,
|
|
2937
|
+
language = "typescript",
|
|
2938
|
+
title,
|
|
2939
|
+
mockState = "idle",
|
|
2940
|
+
mockOutput,
|
|
2941
|
+
className
|
|
2942
|
+
}) {
|
|
2943
|
+
const [state, setState] = useState17(mockState);
|
|
2944
|
+
const [output, setOutput] = useState17(mockOutput ?? null);
|
|
2945
|
+
const [duration, setDuration] = useState17(0);
|
|
2946
|
+
const handleRun = () => {
|
|
2947
|
+
setState("running");
|
|
2948
|
+
setOutput(null);
|
|
2949
|
+
const startTime = Date.now();
|
|
2950
|
+
setTimeout(() => {
|
|
2951
|
+
const elapsed = Date.now() - startTime;
|
|
2952
|
+
setDuration(elapsed);
|
|
2953
|
+
if (mockState === "error") {
|
|
2954
|
+
setState("error");
|
|
2955
|
+
setOutput(mockOutput ?? "Error: Execution failed");
|
|
2956
|
+
} else {
|
|
2957
|
+
setState("success");
|
|
2958
|
+
setOutput(mockOutput ?? JSON.stringify({ result: "success", timestamp: new Date().toISOString() }, null, 2));
|
|
2959
|
+
}
|
|
2960
|
+
}, 1200);
|
|
2748
2961
|
};
|
|
2749
|
-
|
|
2750
|
-
|
|
2962
|
+
const codeblock = {
|
|
2963
|
+
value: code,
|
|
2964
|
+
lang: language,
|
|
2965
|
+
meta: title
|
|
2966
|
+
};
|
|
2967
|
+
return /* @__PURE__ */ jsxs33("div", {
|
|
2968
|
+
className: cn("relative", className),
|
|
2751
2969
|
children: [
|
|
2752
|
-
/* @__PURE__ */
|
|
2753
|
-
className: "
|
|
2754
|
-
children:
|
|
2970
|
+
/* @__PURE__ */ jsxs33("div", {
|
|
2971
|
+
className: "relative group",
|
|
2972
|
+
children: [
|
|
2973
|
+
/* @__PURE__ */ jsx54(ClientDocsKitCode, {
|
|
2974
|
+
codeblock
|
|
2975
|
+
}),
|
|
2976
|
+
/* @__PURE__ */ jsx54("button", {
|
|
2977
|
+
type: "button",
|
|
2978
|
+
onClick: handleRun,
|
|
2979
|
+
disabled: state === "running",
|
|
2980
|
+
className: cn("absolute right-3 top-3 z-10", "size-8 flex items-center justify-center", "rounded border border-openpkg-code-border bg-openpkg-code-bg", "text-openpkg-code-text-inactive", "cursor-pointer transition-opacity duration-200", "opacity-0 group-hover:opacity-100", state === "running" && "cursor-not-allowed opacity-100"),
|
|
2981
|
+
"aria-label": "Run code",
|
|
2982
|
+
children: state === "running" ? /* @__PURE__ */ jsx54(Loader2, {
|
|
2983
|
+
size: 16,
|
|
2984
|
+
className: "animate-spin"
|
|
2985
|
+
}) : /* @__PURE__ */ jsx54(Play, {
|
|
2986
|
+
size: 16,
|
|
2987
|
+
className: "fill-current"
|
|
2988
|
+
})
|
|
2989
|
+
})
|
|
2990
|
+
]
|
|
2755
2991
|
}),
|
|
2756
|
-
/* @__PURE__ */
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2992
|
+
output && /* @__PURE__ */ jsx54("div", {
|
|
2993
|
+
className: "-mt-4",
|
|
2994
|
+
children: /* @__PURE__ */ jsx54(CollapsiblePanel, {
|
|
2995
|
+
title: `${state === "success" ? "✓ Success" : "✕ Error"} | ${duration}ms`,
|
|
2996
|
+
defaultExpanded: true,
|
|
2997
|
+
children: /* @__PURE__ */ jsx54("pre", {
|
|
2998
|
+
className: "p-4 m-0 text-xs font-mono overflow-auto max-h-[400px]",
|
|
2999
|
+
children: output
|
|
3000
|
+
})
|
|
2765
3001
|
})
|
|
2766
3002
|
})
|
|
2767
3003
|
]
|
|
@@ -2770,7 +3006,7 @@ function ImportSection({ importStatement, className }) {
|
|
|
2770
3006
|
// src/docskit/type-badge.tsx
|
|
2771
3007
|
import { cva as cva2 } from "class-variance-authority";
|
|
2772
3008
|
import * as React8 from "react";
|
|
2773
|
-
import { jsx as
|
|
3009
|
+
import { jsx as jsx55 } from "react/jsx-runtime";
|
|
2774
3010
|
var typeBadgeVariants = cva2("font-mono text-sm", {
|
|
2775
3011
|
variants: {
|
|
2776
3012
|
typeColor: {
|
|
@@ -2827,7 +3063,7 @@ function detectTypeColor(type) {
|
|
|
2827
3063
|
}
|
|
2828
3064
|
var TypeBadge = React8.forwardRef(({ className, type, typeColor, ...props }, ref) => {
|
|
2829
3065
|
const color2 = typeColor ?? detectTypeColor(type);
|
|
2830
|
-
return /* @__PURE__ */
|
|
3066
|
+
return /* @__PURE__ */ jsx55("span", {
|
|
2831
3067
|
ref,
|
|
2832
3068
|
className: cn(typeBadgeVariants({ typeColor: color2 }), className),
|
|
2833
3069
|
...props,
|
|
@@ -2835,82 +3071,6 @@ var TypeBadge = React8.forwardRef(({ className, type, typeColor, ...props }, ref
|
|
|
2835
3071
|
});
|
|
2836
3072
|
});
|
|
2837
3073
|
TypeBadge.displayName = "TypeBadge";
|
|
2838
|
-
// src/docskit/runnable-snippet.tsx
|
|
2839
|
-
import { Loader2, Play } from "lucide-react";
|
|
2840
|
-
import { useState as useState16 } from "react";
|
|
2841
|
-
import { jsx as jsx53, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
2842
|
-
|
|
2843
|
-
function RunnableSnippet({
|
|
2844
|
-
code,
|
|
2845
|
-
language = "typescript",
|
|
2846
|
-
title,
|
|
2847
|
-
mockState = "idle",
|
|
2848
|
-
mockOutput,
|
|
2849
|
-
className
|
|
2850
|
-
}) {
|
|
2851
|
-
const [state, setState] = useState16(mockState);
|
|
2852
|
-
const [output, setOutput] = useState16(mockOutput ?? null);
|
|
2853
|
-
const [duration, setDuration] = useState16(0);
|
|
2854
|
-
const handleRun = () => {
|
|
2855
|
-
setState("running");
|
|
2856
|
-
setOutput(null);
|
|
2857
|
-
const startTime = Date.now();
|
|
2858
|
-
setTimeout(() => {
|
|
2859
|
-
const elapsed = Date.now() - startTime;
|
|
2860
|
-
setDuration(elapsed);
|
|
2861
|
-
if (mockState === "error") {
|
|
2862
|
-
setState("error");
|
|
2863
|
-
setOutput(mockOutput ?? "Error: Execution failed");
|
|
2864
|
-
} else {
|
|
2865
|
-
setState("success");
|
|
2866
|
-
setOutput(mockOutput ?? JSON.stringify({ result: "success", timestamp: new Date().toISOString() }, null, 2));
|
|
2867
|
-
}
|
|
2868
|
-
}, 1200);
|
|
2869
|
-
};
|
|
2870
|
-
const codeblock = {
|
|
2871
|
-
value: code,
|
|
2872
|
-
lang: language,
|
|
2873
|
-
meta: title
|
|
2874
|
-
};
|
|
2875
|
-
return /* @__PURE__ */ jsxs31("div", {
|
|
2876
|
-
className: cn("relative", className),
|
|
2877
|
-
children: [
|
|
2878
|
-
/* @__PURE__ */ jsxs31("div", {
|
|
2879
|
-
className: "relative group",
|
|
2880
|
-
children: [
|
|
2881
|
-
/* @__PURE__ */ jsx53(ClientDocsKitCode, {
|
|
2882
|
-
codeblock
|
|
2883
|
-
}),
|
|
2884
|
-
/* @__PURE__ */ jsx53("button", {
|
|
2885
|
-
type: "button",
|
|
2886
|
-
onClick: handleRun,
|
|
2887
|
-
disabled: state === "running",
|
|
2888
|
-
className: cn("absolute right-3 top-3 z-10", "size-8 flex items-center justify-center", "rounded border border-openpkg-code-border bg-openpkg-code-bg", "text-openpkg-code-text-inactive", "cursor-pointer transition-opacity duration-200", "opacity-0 group-hover:opacity-100", state === "running" && "cursor-not-allowed opacity-100"),
|
|
2889
|
-
"aria-label": "Run code",
|
|
2890
|
-
children: state === "running" ? /* @__PURE__ */ jsx53(Loader2, {
|
|
2891
|
-
size: 16,
|
|
2892
|
-
className: "animate-spin"
|
|
2893
|
-
}) : /* @__PURE__ */ jsx53(Play, {
|
|
2894
|
-
size: 16,
|
|
2895
|
-
className: "fill-current"
|
|
2896
|
-
})
|
|
2897
|
-
})
|
|
2898
|
-
]
|
|
2899
|
-
}),
|
|
2900
|
-
output && /* @__PURE__ */ jsx53("div", {
|
|
2901
|
-
className: "-mt-4",
|
|
2902
|
-
children: /* @__PURE__ */ jsx53(CollapsiblePanel, {
|
|
2903
|
-
title: `${state === "success" ? "✓ Success" : "✕ Error"} | ${duration}ms`,
|
|
2904
|
-
defaultExpanded: true,
|
|
2905
|
-
children: /* @__PURE__ */ jsx53("pre", {
|
|
2906
|
-
className: "p-4 m-0 text-xs font-mono overflow-auto max-h-[400px]",
|
|
2907
|
-
children: output
|
|
2908
|
-
})
|
|
2909
|
-
})
|
|
2910
|
-
})
|
|
2911
|
-
]
|
|
2912
|
-
});
|
|
2913
|
-
}
|
|
2914
3074
|
export {
|
|
2915
3075
|
wordWrap,
|
|
2916
3076
|
useSyncSection,
|
|
@@ -2942,6 +3102,7 @@ export {
|
|
|
2942
3102
|
Tabs,
|
|
2943
3103
|
SyncScrollProvider,
|
|
2944
3104
|
SingleCode,
|
|
3105
|
+
SectionAccordion,
|
|
2945
3106
|
RunnableSnippet,
|
|
2946
3107
|
ResponseBlock,
|
|
2947
3108
|
ParameterList,
|
|
@@ -2975,6 +3136,7 @@ export {
|
|
|
2975
3136
|
ClientDocsKitCode,
|
|
2976
3137
|
ClientDiffCode,
|
|
2977
3138
|
ClientCode,
|
|
3139
|
+
APISectionSingle,
|
|
2978
3140
|
APISection,
|
|
2979
3141
|
APIReferencePage,
|
|
2980
3142
|
APIReferenceLayout,
|