@openpkg-ts/ui 0.3.1 → 0.4.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/badge/index.d.ts +2 -10
- package/dist/docskit/index.d.ts +31 -62
- package/dist/docskit/index.js +232 -286
- package/package.json +1 -1
- package/src/styles/docskit.css +12 -11
package/dist/docskit/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// src/docskit/api/api-code-panel.tsx
|
|
3
3
|
import { highlight, Pre } from "codehike/code";
|
|
4
4
|
import { Check, Copy, ExternalLink } from "lucide-react";
|
|
5
|
-
import { useEffect as useEffect2, useState as
|
|
5
|
+
import { useEffect as useEffect2, useState as useState3 } from "react";
|
|
6
6
|
|
|
7
7
|
// src/lib/utils.ts
|
|
8
8
|
import { clsx } from "clsx";
|
|
@@ -11,22 +11,6 @@ function cn(...inputs) {
|
|
|
11
11
|
return twMerge(clsx(inputs));
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
// src/hooks/use-copy-to-clipboard.ts
|
|
15
|
-
import { useCallback, useRef, useState } from "react";
|
|
16
|
-
var COPY_FEEDBACK_MS = 1200;
|
|
17
|
-
function useCopyToClipboard(timeout = COPY_FEEDBACK_MS) {
|
|
18
|
-
const [copied, setCopied] = useState(false);
|
|
19
|
-
const timerRef = useRef();
|
|
20
|
-
const copy = useCallback((text) => {
|
|
21
|
-
navigator.clipboard.writeText(text).then(() => {
|
|
22
|
-
setCopied(true);
|
|
23
|
-
clearTimeout(timerRef.current);
|
|
24
|
-
timerRef.current = setTimeout(() => setCopied(false), timeout);
|
|
25
|
-
});
|
|
26
|
-
}, [timeout]);
|
|
27
|
-
return [copied, copy];
|
|
28
|
-
}
|
|
29
|
-
|
|
30
14
|
// src/docskit/code.config.ts
|
|
31
15
|
var theme = "github-from-css";
|
|
32
16
|
function flagsToOptions(flags = "") {
|
|
@@ -115,14 +99,14 @@ var callout = {
|
|
|
115
99
|
marginLeft: `${indentation}ch`,
|
|
116
100
|
border: "1px solid var(--ch-23)"
|
|
117
101
|
},
|
|
118
|
-
className: "w-fit bg-
|
|
102
|
+
className: "w-fit bg-openpkg-code-header rounded px-0 relative my-1 whitespace-break-spaces select-none",
|
|
119
103
|
children: [
|
|
120
104
|
/* @__PURE__ */ jsx3("div", {
|
|
121
105
|
style: {
|
|
122
106
|
left: `${column - indentation - 1}ch`,
|
|
123
107
|
borderColor: "var(--ch-23)"
|
|
124
108
|
},
|
|
125
|
-
className: "absolute border-l border-t w-2 h-2 rotate-45 -translate-y-1/2 -top-[1px] bg-
|
|
109
|
+
className: "absolute border-l border-t w-2 h-2 rotate-45 -translate-y-1/2 -top-[1px] bg-openpkg-code-header"
|
|
126
110
|
}),
|
|
127
111
|
/* @__PURE__ */ jsx3(CalloutClient, {
|
|
128
112
|
name: annotation.query
|
|
@@ -142,8 +126,8 @@ var line = {
|
|
|
142
126
|
Line: ({ annotation, ...props }) => {
|
|
143
127
|
return /* @__PURE__ */ jsx4("div", {
|
|
144
128
|
style: {
|
|
145
|
-
borderLeftColor: "var(--
|
|
146
|
-
backgroundColor: "var(--
|
|
129
|
+
borderLeftColor: "var(--openpkg-line-border, transparent)",
|
|
130
|
+
backgroundColor: "var(--openpkg-line-bg, transparent)"
|
|
147
131
|
},
|
|
148
132
|
className: "flex border-l-2 border-l-transparent background-color 0.3s ease",
|
|
149
133
|
children: /* @__PURE__ */ jsx4(InnerLine2, {
|
|
@@ -262,8 +246,8 @@ var diff = {
|
|
|
262
246
|
const color = annotation.query === "-" ? "#f85149" : "#3fb950";
|
|
263
247
|
return /* @__PURE__ */ jsx7("div", {
|
|
264
248
|
style: {
|
|
265
|
-
["--
|
|
266
|
-
["--
|
|
249
|
+
["--openpkg-line-bg"]: `rgb(from ${color} r g b / 0.13)`,
|
|
250
|
+
["--openpkg-line-border"]: color
|
|
267
251
|
},
|
|
268
252
|
children
|
|
269
253
|
});
|
|
@@ -292,7 +276,7 @@ var expandable = {
|
|
|
292
276
|
return /* @__PURE__ */ jsxs4(Collapsible, {
|
|
293
277
|
children: [
|
|
294
278
|
/* @__PURE__ */ jsx8(CollapsibleTrigger2, {
|
|
295
|
-
className: "h-24 w-full translate-y-[-75%] absolute bg-gradient-to-b from-
|
|
279
|
+
className: "h-24 w-full translate-y-[-75%] absolute bg-gradient-to-b from-openpkg-code-bg/0 via-openpkg-code-bg/80 to-openpkg-code-bg data-[state=open]:invisible",
|
|
296
280
|
children: /* @__PURE__ */ jsx8("div", {
|
|
297
281
|
className: "pt-6",
|
|
298
282
|
children: "Expand"
|
|
@@ -310,7 +294,7 @@ var expandable = {
|
|
|
310
294
|
import {
|
|
311
295
|
InnerLine as InnerLine5
|
|
312
296
|
} from "codehike/code";
|
|
313
|
-
import { createContext, useContext, useState
|
|
297
|
+
import { createContext, useContext, useState } from "react";
|
|
314
298
|
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
315
299
|
|
|
316
300
|
var HoverContext = createContext({
|
|
@@ -319,7 +303,7 @@ var HoverContext = createContext({
|
|
|
319
303
|
removeHoveredName: () => {}
|
|
320
304
|
});
|
|
321
305
|
function HoverProvider({ children }) {
|
|
322
|
-
const [hoveredNames, setHoveredNames] =
|
|
306
|
+
const [hoveredNames, setHoveredNames] = useState([]);
|
|
323
307
|
const addHoveredName = (name) => {
|
|
324
308
|
setHoveredNames((prev) => [...prev, name]);
|
|
325
309
|
};
|
|
@@ -353,8 +337,8 @@ var HoverBlock = ({ annotation, children }) => {
|
|
|
353
337
|
const name = annotation?.query;
|
|
354
338
|
const isHovered = name && hoveredNames[hoveredNames.length - 1] === name;
|
|
355
339
|
const style = isHovered && !annotation.data?.inline ? {
|
|
356
|
-
["--
|
|
357
|
-
["--
|
|
340
|
+
["--openpkg-line-bg"]: `rgb(from ${color} r g b / 0.13)`,
|
|
341
|
+
["--openpkg-line-border"]: color
|
|
358
342
|
} : undefined;
|
|
359
343
|
return /* @__PURE__ */ jsx9("div", {
|
|
360
344
|
style,
|
|
@@ -438,7 +422,7 @@ var lineNumbers = {
|
|
|
438
422
|
children: [
|
|
439
423
|
/* @__PURE__ */ jsx11("span", {
|
|
440
424
|
style: { minWidth: `${width}ch` },
|
|
441
|
-
className: "text-right text-
|
|
425
|
+
className: "text-right text-openpkg-code-line-number select-none mr-1",
|
|
442
426
|
children: props.lineNumber
|
|
443
427
|
}),
|
|
444
428
|
/* @__PURE__ */ jsx11(InnerLine6, {
|
|
@@ -471,8 +455,8 @@ var mark = {
|
|
|
471
455
|
const color2 = getColor(annotation);
|
|
472
456
|
return /* @__PURE__ */ jsx13("div", {
|
|
473
457
|
style: {
|
|
474
|
-
["--
|
|
475
|
-
["--
|
|
458
|
+
["--openpkg-line-bg"]: `rgb(from ${color2} r g b / 0.13)`,
|
|
459
|
+
["--openpkg-line-border"]: color2
|
|
476
460
|
},
|
|
477
461
|
children
|
|
478
462
|
});
|
|
@@ -650,7 +634,7 @@ import { jsx as jsx18, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
|
650
634
|
|
|
651
635
|
function SkeletonLine({ width = "75%" }) {
|
|
652
636
|
return /* @__PURE__ */ jsx18("div", {
|
|
653
|
-
className: "h-4 bg-
|
|
637
|
+
className: "h-4 bg-openpkg-code-border/20 rounded animate-pulse",
|
|
654
638
|
style: { width }
|
|
655
639
|
});
|
|
656
640
|
}
|
|
@@ -664,24 +648,24 @@ function CodeBlockSkeleton({
|
|
|
664
648
|
return widths[i % widths.length];
|
|
665
649
|
});
|
|
666
650
|
return /* @__PURE__ */ jsxs8("div", {
|
|
667
|
-
className: "rounded overflow-hidden border border-
|
|
651
|
+
className: "rounded overflow-hidden border border-openpkg-code-border my-4 not-prose",
|
|
668
652
|
children: [
|
|
669
653
|
hasTitle && /* @__PURE__ */ jsx18("div", {
|
|
670
|
-
className: cn("border-b border-
|
|
654
|
+
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"),
|
|
671
655
|
children: /* @__PURE__ */ jsxs8("div", {
|
|
672
656
|
className: "flex items-center h-5 gap-2",
|
|
673
657
|
children: [
|
|
674
658
|
/* @__PURE__ */ jsx18("div", {
|
|
675
|
-
className: "size-4 bg-
|
|
659
|
+
className: "size-4 bg-openpkg-code-border/30 rounded animate-pulse"
|
|
676
660
|
}),
|
|
677
661
|
/* @__PURE__ */ jsx18("div", {
|
|
678
|
-
className: "h-4 w-20 bg-
|
|
662
|
+
className: "h-4 w-20 bg-openpkg-code-border/30 rounded animate-pulse"
|
|
679
663
|
})
|
|
680
664
|
]
|
|
681
665
|
})
|
|
682
666
|
}),
|
|
683
667
|
/* @__PURE__ */ jsx18("div", {
|
|
684
|
-
className: "bg-
|
|
668
|
+
className: "bg-openpkg-code-bg px-4 py-3 space-y-2",
|
|
685
669
|
children: lineWidths.map((width, i) => /* @__PURE__ */ jsx18(SkeletonLine, {
|
|
686
670
|
width
|
|
687
671
|
}, `${id}-line-${i}`))
|
|
@@ -696,27 +680,27 @@ function TerminalSkeleton({ lines = 3 }) {
|
|
|
696
680
|
return widths[i % widths.length];
|
|
697
681
|
});
|
|
698
682
|
return /* @__PURE__ */ jsxs8("div", {
|
|
699
|
-
className: "rounded overflow-hidden border border-
|
|
683
|
+
className: "rounded overflow-hidden border border-openpkg-code-border my-4 not-prose",
|
|
700
684
|
children: [
|
|
701
685
|
/* @__PURE__ */ jsx18("div", {
|
|
702
|
-
className: cn("border-b border-
|
|
686
|
+
className: cn("border-b border-openpkg-code-border bg-openpkg-code-header", "w-full h-9 flex items-center justify-center shrink-0", "relative"),
|
|
703
687
|
children: /* @__PURE__ */ jsxs8("div", {
|
|
704
688
|
className: "absolute left-3 flex items-center gap-2",
|
|
705
689
|
children: [
|
|
706
690
|
/* @__PURE__ */ jsx18("div", {
|
|
707
|
-
className: "size-3 rounded-full bg-
|
|
691
|
+
className: "size-3 rounded-full bg-openpkg-code-text-inactive/30"
|
|
708
692
|
}),
|
|
709
693
|
/* @__PURE__ */ jsx18("div", {
|
|
710
|
-
className: "size-3 rounded-full bg-
|
|
694
|
+
className: "size-3 rounded-full bg-openpkg-code-text-inactive/30"
|
|
711
695
|
}),
|
|
712
696
|
/* @__PURE__ */ jsx18("div", {
|
|
713
|
-
className: "size-3 rounded-full bg-
|
|
697
|
+
className: "size-3 rounded-full bg-openpkg-code-text-inactive/30"
|
|
714
698
|
})
|
|
715
699
|
]
|
|
716
700
|
})
|
|
717
701
|
}),
|
|
718
702
|
/* @__PURE__ */ jsx18("div", {
|
|
719
|
-
className: "bg-
|
|
703
|
+
className: "bg-openpkg-code-bg px-4 py-3 space-y-2",
|
|
720
704
|
children: lineWidths.map((width, i) => /* @__PURE__ */ jsx18(SkeletonLine, {
|
|
721
705
|
width
|
|
722
706
|
}, `${id}-line-${i}`))
|
|
@@ -726,37 +710,34 @@ function TerminalSkeleton({ lines = 3 }) {
|
|
|
726
710
|
}
|
|
727
711
|
function InlineCodeSkeleton() {
|
|
728
712
|
return /* @__PURE__ */ jsx18("span", {
|
|
729
|
-
className: "inline-block h-5 w-16 bg-
|
|
713
|
+
className: "inline-block h-5 w-16 bg-openpkg-code-border/20 rounded border border-openpkg-code-border animate-pulse align-middle"
|
|
730
714
|
});
|
|
731
715
|
}
|
|
732
|
-
function CodeTabsSkeleton({
|
|
733
|
-
tabs = 2,
|
|
734
|
-
lines = 6
|
|
735
|
-
}) {
|
|
716
|
+
function CodeTabsSkeleton({ tabs = 2, lines = 6 }) {
|
|
736
717
|
const id = useId();
|
|
737
718
|
const lineWidths = Array.from({ length: lines }, (_, i) => {
|
|
738
719
|
const widths = ["40%", "65%", "55%", "80%", "45%", "70%"];
|
|
739
720
|
return widths[i % widths.length];
|
|
740
721
|
});
|
|
741
722
|
return /* @__PURE__ */ jsxs8("div", {
|
|
742
|
-
className: "rounded overflow-hidden border border-
|
|
723
|
+
className: "rounded overflow-hidden border border-openpkg-code-border my-4 not-prose",
|
|
743
724
|
children: [
|
|
744
725
|
/* @__PURE__ */ jsx18("div", {
|
|
745
|
-
className: cn("border-b border-
|
|
726
|
+
className: cn("border-b border-openpkg-code-border bg-openpkg-code-header px-2 py-0", "w-full h-9 flex items-center shrink-0 gap-1"),
|
|
746
727
|
children: Array.from({ length: tabs }).map((_, i) => /* @__PURE__ */ jsxs8("div", {
|
|
747
728
|
className: "flex items-center gap-1.5 px-3 h-full",
|
|
748
729
|
children: [
|
|
749
730
|
/* @__PURE__ */ jsx18("div", {
|
|
750
|
-
className: "size-4 bg-
|
|
731
|
+
className: "size-4 bg-openpkg-code-border/30 rounded animate-pulse"
|
|
751
732
|
}),
|
|
752
733
|
/* @__PURE__ */ jsx18("div", {
|
|
753
|
-
className: "h-4 w-16 bg-
|
|
734
|
+
className: "h-4 w-16 bg-openpkg-code-border/30 rounded animate-pulse"
|
|
754
735
|
})
|
|
755
736
|
]
|
|
756
737
|
}, `${id}-tab-${i}`))
|
|
757
738
|
}),
|
|
758
739
|
/* @__PURE__ */ jsx18("div", {
|
|
759
|
-
className: "bg-
|
|
740
|
+
className: "bg-openpkg-code-bg px-4 py-3 space-y-2",
|
|
760
741
|
children: lineWidths.map((width, i) => /* @__PURE__ */ jsx18(SkeletonLine, {
|
|
761
742
|
width
|
|
762
743
|
}, `${id}-line-${i}`))
|
|
@@ -795,7 +776,7 @@ function LanguageSelector({
|
|
|
795
776
|
/* @__PURE__ */ jsxs9("button", {
|
|
796
777
|
type: "button",
|
|
797
778
|
onClick: () => setOpen(!open),
|
|
798
|
-
className: cn("flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-sm font-medium", "bg-
|
|
779
|
+
className: cn("flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-sm font-medium", "bg-muted/50 hover:bg-muted text-foreground transition-colors cursor-pointer"),
|
|
799
780
|
children: [
|
|
800
781
|
selectedLanguage?.label ?? value,
|
|
801
782
|
/* @__PURE__ */ jsx19(ChevronDown, {
|
|
@@ -805,14 +786,14 @@ function LanguageSelector({
|
|
|
805
786
|
]
|
|
806
787
|
}),
|
|
807
788
|
open && /* @__PURE__ */ jsx19("div", {
|
|
808
|
-
className: cn("absolute top-full left-0 mt-1 z-50 min-w-[120px]", "bg-
|
|
789
|
+
className: cn("absolute top-full left-0 mt-1 z-50 min-w-[120px]", "bg-popover border border-border rounded-md shadow-lg overflow-hidden"),
|
|
809
790
|
children: languages.map((lang) => /* @__PURE__ */ jsx19("button", {
|
|
810
791
|
type: "button",
|
|
811
792
|
onClick: () => {
|
|
812
793
|
onChange(lang.id);
|
|
813
794
|
setOpen(false);
|
|
814
795
|
},
|
|
815
|
-
className: cn("w-full px-3 py-2 text-sm text-left transition-colors cursor-pointer", lang.id === value ? "bg-
|
|
796
|
+
className: cn("w-full px-3 py-2 text-sm text-left transition-colors cursor-pointer", lang.id === value ? "bg-primary/10 text-primary" : "text-foreground hover:bg-muted"),
|
|
816
797
|
children: lang.label
|
|
817
798
|
}, lang.id))
|
|
818
799
|
})
|
|
@@ -830,9 +811,9 @@ function APICodePanel({
|
|
|
830
811
|
title,
|
|
831
812
|
className
|
|
832
813
|
}) {
|
|
833
|
-
const [selectedLang, setSelectedLang] =
|
|
834
|
-
const [copied,
|
|
835
|
-
const [highlighted, setHighlighted] =
|
|
814
|
+
const [selectedLang, setSelectedLang] = useState3(examples[0]?.languageId ?? languages[0]?.id);
|
|
815
|
+
const [copied, setCopied] = useState3(false);
|
|
816
|
+
const [highlighted, setHighlighted] = useState3(null);
|
|
836
817
|
const currentExample = examples.find((e) => e.languageId === selectedLang);
|
|
837
818
|
const code = currentExample?.code ?? "";
|
|
838
819
|
const lang = currentExample?.highlightLang ?? currentExample?.languageId ?? "txt";
|
|
@@ -852,14 +833,16 @@ function APICodePanel({
|
|
|
852
833
|
};
|
|
853
834
|
}, [code, lang]);
|
|
854
835
|
const handleCopy = () => {
|
|
855
|
-
|
|
836
|
+
navigator.clipboard.writeText(code);
|
|
837
|
+
setCopied(true);
|
|
838
|
+
setTimeout(() => setCopied(false), 1200);
|
|
856
839
|
};
|
|
857
840
|
const handlers = getHandlers({ copyButton: false });
|
|
858
841
|
return /* @__PURE__ */ jsxs10("div", {
|
|
859
|
-
className: cn("rounded-lg overflow-hidden border border-
|
|
842
|
+
className: cn("rounded-lg overflow-hidden border border-openpkg-code-border", "bg-openpkg-code-bg text-gray-100", "sticky top-20", className),
|
|
860
843
|
children: [
|
|
861
844
|
/* @__PURE__ */ jsxs10("div", {
|
|
862
|
-
className: "flex items-center justify-between px-4 py-3 border-b border-
|
|
845
|
+
className: "flex items-center justify-between px-4 py-3 border-b border-openpkg-code-border bg-openpkg-code-header",
|
|
863
846
|
children: [
|
|
864
847
|
/* @__PURE__ */ jsxs10("div", {
|
|
865
848
|
className: "flex items-center gap-3",
|
|
@@ -871,7 +854,7 @@ function APICodePanel({
|
|
|
871
854
|
className: "[&_button]:bg-white/5 [&_button]:hover:bg-white/10 [&_button]:text-gray-200"
|
|
872
855
|
}),
|
|
873
856
|
title && /* @__PURE__ */ jsx20("span", {
|
|
874
|
-
className: "text-sm text-
|
|
857
|
+
className: "text-sm text-openpkg-code-text-inactive",
|
|
875
858
|
children: title
|
|
876
859
|
})
|
|
877
860
|
]
|
|
@@ -882,7 +865,7 @@ function APICodePanel({
|
|
|
882
865
|
/* @__PURE__ */ jsx20("button", {
|
|
883
866
|
type: "button",
|
|
884
867
|
onClick: handleCopy,
|
|
885
|
-
className: "p-1.5 rounded text-
|
|
868
|
+
className: "p-1.5 rounded text-openpkg-code-text-inactive hover:text-gray-200 transition-colors cursor-pointer",
|
|
886
869
|
"aria-label": "Copy code",
|
|
887
870
|
children: copied ? /* @__PURE__ */ jsx20(Check, {
|
|
888
871
|
size: 16
|
|
@@ -894,7 +877,7 @@ function APICodePanel({
|
|
|
894
877
|
href: externalLink,
|
|
895
878
|
target: "_blank",
|
|
896
879
|
rel: "noopener noreferrer",
|
|
897
|
-
className: "p-1.5 rounded text-
|
|
880
|
+
className: "p-1.5 rounded text-openpkg-code-text-inactive hover:text-gray-200 transition-colors",
|
|
898
881
|
"aria-label": "Open in playground",
|
|
899
882
|
children: /* @__PURE__ */ jsx20(ExternalLink, {
|
|
900
883
|
size: 16
|
|
@@ -908,7 +891,7 @@ function APICodePanel({
|
|
|
908
891
|
className: "overflow-auto max-h-[60vh] lg:max-h-none",
|
|
909
892
|
children: highlighted ? /* @__PURE__ */ jsx20(Pre, {
|
|
910
893
|
code: highlighted,
|
|
911
|
-
className: "overflow-auto px-4 py-3 m-0 rounded-none !bg-
|
|
894
|
+
className: "overflow-auto px-4 py-3 m-0 rounded-none !bg-openpkg-code-bg selection:bg-openpkg-code-selection selection:text-current text-sm",
|
|
912
895
|
style: highlighted.style,
|
|
913
896
|
handlers
|
|
914
897
|
}) : /* @__PURE__ */ jsx20(CodeBlockSkeleton, {
|
|
@@ -932,14 +915,14 @@ function APIReferencePage({
|
|
|
932
915
|
className: cn("max-w-7xl mx-auto px-4 sm:px-6 lg:px-8", className),
|
|
933
916
|
children: [
|
|
934
917
|
/* @__PURE__ */ jsxs11("header", {
|
|
935
|
-
className: "py-8 border-b border-
|
|
918
|
+
className: "py-8 border-b border-border",
|
|
936
919
|
children: [
|
|
937
920
|
/* @__PURE__ */ jsx21("h1", {
|
|
938
|
-
className: "text-3xl font-bold text-
|
|
921
|
+
className: "text-3xl font-bold text-foreground",
|
|
939
922
|
children: title
|
|
940
923
|
}),
|
|
941
924
|
description && /* @__PURE__ */ jsx21("div", {
|
|
942
|
-
className: "mt-4 text-lg text-
|
|
925
|
+
className: "mt-4 text-lg text-muted-foreground prose prose-lg dark:prose-invert max-w-none",
|
|
943
926
|
children: description
|
|
944
927
|
})
|
|
945
928
|
]
|
|
@@ -966,7 +949,7 @@ function APISection({
|
|
|
966
949
|
}) {
|
|
967
950
|
return /* @__PURE__ */ jsx22("section", {
|
|
968
951
|
id,
|
|
969
|
-
className: cn("py-8 border-b border-
|
|
952
|
+
className: cn("py-8 border-b border-border last:border-b-0", className),
|
|
970
953
|
children: /* @__PURE__ */ jsxs12("div", {
|
|
971
954
|
className: "grid grid-cols-1 lg:grid-cols-2 gap-8 lg:gap-12",
|
|
972
955
|
children: [
|
|
@@ -976,11 +959,11 @@ function APISection({
|
|
|
976
959
|
/* @__PURE__ */ jsxs12("div", {
|
|
977
960
|
children: [
|
|
978
961
|
/* @__PURE__ */ jsx22("h2", {
|
|
979
|
-
className: "text-2xl font-semibold text-
|
|
962
|
+
className: "text-2xl font-semibold text-foreground",
|
|
980
963
|
children: title
|
|
981
964
|
}),
|
|
982
965
|
description && /* @__PURE__ */ jsx22("div", {
|
|
983
|
-
className: "mt-3 text-
|
|
966
|
+
className: "mt-3 text-muted-foreground prose prose-sm dark:prose-invert",
|
|
984
967
|
children: description
|
|
985
968
|
})
|
|
986
969
|
]
|
|
@@ -1037,29 +1020,32 @@ EndpointBadge.displayName = "EndpointBadge";
|
|
|
1037
1020
|
// src/docskit/api/endpoint-header.tsx
|
|
1038
1021
|
import { Check as Check2, Copy as Copy2 } from "lucide-react";
|
|
1039
1022
|
import * as React4 from "react";
|
|
1023
|
+
import { useState as useState4 } from "react";
|
|
1040
1024
|
import { jsx as jsx24, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1041
1025
|
|
|
1042
1026
|
var EndpointHeader = React4.forwardRef(({ className, method, path, copyable = true, ...props }, ref) => {
|
|
1043
|
-
const [copied,
|
|
1027
|
+
const [copied, setCopied] = useState4(false);
|
|
1044
1028
|
const handleCopy = () => {
|
|
1045
|
-
|
|
1029
|
+
navigator.clipboard.writeText(path);
|
|
1030
|
+
setCopied(true);
|
|
1031
|
+
setTimeout(() => setCopied(false), 1200);
|
|
1046
1032
|
};
|
|
1047
1033
|
return /* @__PURE__ */ jsxs13("div", {
|
|
1048
1034
|
ref,
|
|
1049
|
-
className: cn("group flex items-center gap-3 py-2 px-3 rounded-lg bg-
|
|
1035
|
+
className: cn("group flex items-center gap-3 py-2 px-3 rounded-lg bg-muted/50 border border-border", className),
|
|
1050
1036
|
...props,
|
|
1051
1037
|
children: [
|
|
1052
1038
|
/* @__PURE__ */ jsx24(EndpointBadge, {
|
|
1053
1039
|
method
|
|
1054
1040
|
}),
|
|
1055
1041
|
/* @__PURE__ */ jsx24("code", {
|
|
1056
|
-
className: "font-mono text-sm text-
|
|
1042
|
+
className: "font-mono text-sm text-foreground flex-1",
|
|
1057
1043
|
children: path
|
|
1058
1044
|
}),
|
|
1059
1045
|
copyable && /* @__PURE__ */ jsx24("button", {
|
|
1060
1046
|
type: "button",
|
|
1061
1047
|
onClick: handleCopy,
|
|
1062
|
-
className: cn("p-1.5 rounded text-
|
|
1048
|
+
className: cn("p-1.5 rounded text-muted-foreground hover:text-foreground", "opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer"),
|
|
1063
1049
|
"aria-label": "Copy path",
|
|
1064
1050
|
children: copied ? /* @__PURE__ */ jsx24(Check2, {
|
|
1065
1051
|
size: 14
|
|
@@ -1083,12 +1069,17 @@ function NestedProperty({
|
|
|
1083
1069
|
depth = 0
|
|
1084
1070
|
}) {
|
|
1085
1071
|
const [expanded, setExpanded] = useState5(false);
|
|
1086
|
-
const [copied,
|
|
1072
|
+
const [copied, setCopied] = useState5(false);
|
|
1087
1073
|
const type = schema.typeString ?? schema.type ?? "unknown";
|
|
1088
1074
|
const hasNested = schema.properties && Object.keys(schema.properties).length > 0;
|
|
1089
|
-
const _nestedCount = hasNested
|
|
1075
|
+
const _nestedCount = hasNested ? Object.keys(schema.properties).length : 0;
|
|
1076
|
+
const handleCopy = () => {
|
|
1077
|
+
navigator.clipboard.writeText(name);
|
|
1078
|
+
setCopied(true);
|
|
1079
|
+
setTimeout(() => setCopied(false), 1200);
|
|
1080
|
+
};
|
|
1090
1081
|
return /* @__PURE__ */ jsxs14("div", {
|
|
1091
|
-
className: cn("border-t border-
|
|
1082
|
+
className: cn("border-t border-border first:border-t-0", depth > 0 && "ml-4"),
|
|
1092
1083
|
children: [
|
|
1093
1084
|
/* @__PURE__ */ jsx25("div", {
|
|
1094
1085
|
className: "group py-4",
|
|
@@ -1098,7 +1089,7 @@ function NestedProperty({
|
|
|
1098
1089
|
hasNested ? /* @__PURE__ */ jsx25("button", {
|
|
1099
1090
|
type: "button",
|
|
1100
1091
|
onClick: () => setExpanded(!expanded),
|
|
1101
|
-
className: "mt-0.5 p-0.5 text-
|
|
1092
|
+
className: "mt-0.5 p-0.5 text-muted-foreground hover:text-foreground transition-colors cursor-pointer",
|
|
1102
1093
|
"aria-label": expanded ? "Collapse" : "Expand",
|
|
1103
1094
|
children: /* @__PURE__ */ jsx25(ChevronRight, {
|
|
1104
1095
|
size: 14,
|
|
@@ -1114,29 +1105,29 @@ function NestedProperty({
|
|
|
1114
1105
|
className: "flex items-center gap-2 flex-wrap",
|
|
1115
1106
|
children: [
|
|
1116
1107
|
/* @__PURE__ */ jsxs14("span", {
|
|
1117
|
-
className: "font-mono text-sm font-medium text-
|
|
1108
|
+
className: "font-mono text-sm font-medium text-foreground",
|
|
1118
1109
|
children: [
|
|
1119
1110
|
name,
|
|
1120
1111
|
!required && /* @__PURE__ */ jsx25("span", {
|
|
1121
|
-
className: "text-
|
|
1112
|
+
className: "text-muted-foreground",
|
|
1122
1113
|
children: "?"
|
|
1123
1114
|
})
|
|
1124
1115
|
]
|
|
1125
1116
|
}),
|
|
1126
1117
|
/* @__PURE__ */ jsx25("span", {
|
|
1127
|
-
className: "font-mono text-xs text-
|
|
1118
|
+
className: "font-mono text-xs text-muted-foreground",
|
|
1128
1119
|
children: type
|
|
1129
1120
|
}),
|
|
1130
1121
|
hasNested && /* @__PURE__ */ jsx25("button", {
|
|
1131
1122
|
type: "button",
|
|
1132
1123
|
onClick: () => setExpanded(!expanded),
|
|
1133
|
-
className: "text-xs text-
|
|
1124
|
+
className: "text-xs text-primary hover:underline cursor-pointer",
|
|
1134
1125
|
children: "Show child parameters"
|
|
1135
1126
|
}),
|
|
1136
1127
|
/* @__PURE__ */ jsx25("button", {
|
|
1137
1128
|
type: "button",
|
|
1138
|
-
onClick:
|
|
1139
|
-
className: "p-1 rounded text-
|
|
1129
|
+
onClick: handleCopy,
|
|
1130
|
+
className: "p-1 rounded text-muted-foreground hover:text-foreground opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",
|
|
1140
1131
|
"aria-label": "Copy name",
|
|
1141
1132
|
children: copied ? /* @__PURE__ */ jsx25(Check3, {
|
|
1142
1133
|
size: 12
|
|
@@ -1147,7 +1138,7 @@ function NestedProperty({
|
|
|
1147
1138
|
]
|
|
1148
1139
|
}),
|
|
1149
1140
|
schema.description && /* @__PURE__ */ jsx25("p", {
|
|
1150
|
-
className: "text-sm text-
|
|
1141
|
+
className: "text-sm text-muted-foreground mt-1",
|
|
1151
1142
|
children: schema.description
|
|
1152
1143
|
})
|
|
1153
1144
|
]
|
|
@@ -1156,7 +1147,7 @@ function NestedProperty({
|
|
|
1156
1147
|
})
|
|
1157
1148
|
}),
|
|
1158
1149
|
hasNested && expanded && schema.properties && /* @__PURE__ */ jsx25("div", {
|
|
1159
|
-
className: "border-l border-
|
|
1150
|
+
className: "border-l border-border ml-2 mb-3",
|
|
1160
1151
|
children: Object.entries(schema.properties).map(([propName, propSchema]) => /* @__PURE__ */ jsx25(NestedProperty, {
|
|
1161
1152
|
name: propName,
|
|
1162
1153
|
schema: propSchema,
|
|
@@ -1177,11 +1168,16 @@ function APIParameterItem({
|
|
|
1177
1168
|
className
|
|
1178
1169
|
}) {
|
|
1179
1170
|
const [expanded, setExpanded] = useState5(false);
|
|
1180
|
-
const [copied,
|
|
1171
|
+
const [copied, setCopied] = useState5(false);
|
|
1181
1172
|
const hasNested = children?.properties && Object.keys(children.properties).length > 0;
|
|
1182
|
-
const _nestedCount = hasNested
|
|
1173
|
+
const _nestedCount = hasNested ? Object.keys(children.properties).length : 0;
|
|
1174
|
+
const handleCopy = () => {
|
|
1175
|
+
navigator.clipboard.writeText(name);
|
|
1176
|
+
setCopied(true);
|
|
1177
|
+
setTimeout(() => setCopied(false), 1200);
|
|
1178
|
+
};
|
|
1183
1179
|
return /* @__PURE__ */ jsxs14("div", {
|
|
1184
|
-
className: cn("border-b border-
|
|
1180
|
+
className: cn("border-b border-border last:border-b-0", className),
|
|
1185
1181
|
children: [
|
|
1186
1182
|
/* @__PURE__ */ jsx25("div", {
|
|
1187
1183
|
className: "group py-4",
|
|
@@ -1191,7 +1187,7 @@ function APIParameterItem({
|
|
|
1191
1187
|
hasNested ? /* @__PURE__ */ jsx25("button", {
|
|
1192
1188
|
type: "button",
|
|
1193
1189
|
onClick: () => setExpanded(!expanded),
|
|
1194
|
-
className: "mt-0.5 p-0.5 text-
|
|
1190
|
+
className: "mt-0.5 p-0.5 text-muted-foreground hover:text-foreground transition-colors cursor-pointer",
|
|
1195
1191
|
"aria-label": expanded ? "Collapse" : "Expand",
|
|
1196
1192
|
children: /* @__PURE__ */ jsx25(ChevronRight, {
|
|
1197
1193
|
size: 14,
|
|
@@ -1207,27 +1203,27 @@ function APIParameterItem({
|
|
|
1207
1203
|
className: "flex items-center gap-2 flex-wrap",
|
|
1208
1204
|
children: [
|
|
1209
1205
|
/* @__PURE__ */ jsx25("span", {
|
|
1210
|
-
className: "font-mono text-sm font-medium text-
|
|
1206
|
+
className: "font-mono text-sm font-medium text-foreground",
|
|
1211
1207
|
children: name
|
|
1212
1208
|
}),
|
|
1213
1209
|
required && /* @__PURE__ */ jsx25("span", {
|
|
1214
|
-
className: "text-[10px] font-semibold px-1.5 py-0.5 rounded border border-
|
|
1210
|
+
className: "text-[10px] font-semibold px-1.5 py-0.5 rounded border border-border bg-muted text-muted-foreground uppercase tracking-wide",
|
|
1215
1211
|
children: "Required"
|
|
1216
1212
|
}),
|
|
1217
1213
|
/* @__PURE__ */ jsx25("span", {
|
|
1218
|
-
className: "font-mono text-xs text-
|
|
1214
|
+
className: "font-mono text-xs text-muted-foreground",
|
|
1219
1215
|
children: type
|
|
1220
1216
|
}),
|
|
1221
1217
|
hasNested && /* @__PURE__ */ jsx25("button", {
|
|
1222
1218
|
type: "button",
|
|
1223
1219
|
onClick: () => setExpanded(!expanded),
|
|
1224
|
-
className: "text-xs text-
|
|
1220
|
+
className: "text-xs text-primary hover:underline cursor-pointer",
|
|
1225
1221
|
children: "Show child parameters"
|
|
1226
1222
|
}),
|
|
1227
1223
|
/* @__PURE__ */ jsx25("button", {
|
|
1228
1224
|
type: "button",
|
|
1229
|
-
onClick:
|
|
1230
|
-
className: "p-1 rounded text-
|
|
1225
|
+
onClick: handleCopy,
|
|
1226
|
+
className: "p-1 rounded text-muted-foreground hover:text-foreground opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",
|
|
1231
1227
|
"aria-label": "Copy name",
|
|
1232
1228
|
children: copied ? /* @__PURE__ */ jsx25(Check3, {
|
|
1233
1229
|
size: 12
|
|
@@ -1238,7 +1234,7 @@ function APIParameterItem({
|
|
|
1238
1234
|
]
|
|
1239
1235
|
}),
|
|
1240
1236
|
description && /* @__PURE__ */ jsx25("p", {
|
|
1241
|
-
className: "text-sm text-
|
|
1237
|
+
className: "text-sm text-muted-foreground mt-1",
|
|
1242
1238
|
children: description
|
|
1243
1239
|
})
|
|
1244
1240
|
]
|
|
@@ -1247,7 +1243,7 @@ function APIParameterItem({
|
|
|
1247
1243
|
})
|
|
1248
1244
|
}),
|
|
1249
1245
|
hasNested && expanded && children?.properties && /* @__PURE__ */ jsx25("div", {
|
|
1250
|
-
className: "border-l border-
|
|
1246
|
+
className: "border-l border-border ml-2 mb-3",
|
|
1251
1247
|
children: Object.entries(children.properties).map(([propName, propSchema]) => /* @__PURE__ */ jsx25(NestedProperty, {
|
|
1252
1248
|
name: propName,
|
|
1253
1249
|
schema: propSchema,
|
|
@@ -1279,17 +1275,17 @@ function ParameterList({
|
|
|
1279
1275
|
className: cn("", className),
|
|
1280
1276
|
children: [
|
|
1281
1277
|
title && /* @__PURE__ */ jsx26("h3", {
|
|
1282
|
-
className: "text-sm font-medium text-
|
|
1278
|
+
className: "text-sm font-medium text-foreground mb-3 uppercase tracking-wide",
|
|
1283
1279
|
children: title
|
|
1284
1280
|
}),
|
|
1285
1281
|
/* @__PURE__ */ jsx26("div", {
|
|
1286
|
-
className: "divide-y divide-
|
|
1282
|
+
className: "divide-y divide-border border-t border-b border-border",
|
|
1287
1283
|
children: visibleChildren
|
|
1288
1284
|
}),
|
|
1289
1285
|
shouldCollapse && !expanded && /* @__PURE__ */ jsxs15("button", {
|
|
1290
1286
|
type: "button",
|
|
1291
1287
|
onClick: () => setExpanded(true),
|
|
1292
|
-
className: "flex items-center gap-1 mt-3 text-sm text-
|
|
1288
|
+
className: "flex items-center gap-1 mt-3 text-sm text-primary hover:underline cursor-pointer",
|
|
1293
1289
|
children: [
|
|
1294
1290
|
/* @__PURE__ */ jsx26(ChevronDown2, {
|
|
1295
1291
|
size: 14
|
|
@@ -1306,28 +1302,31 @@ function ParameterList({
|
|
|
1306
1302
|
// src/docskit/api/response-block.tsx
|
|
1307
1303
|
import { Check as Check4, Copy as Copy4 } from "lucide-react";
|
|
1308
1304
|
import * as React6 from "react";
|
|
1305
|
+
import { useState as useState7 } from "react";
|
|
1309
1306
|
import { jsx as jsx27, jsxs as jsxs16, Fragment as Fragment4 } from "react/jsx-runtime";
|
|
1310
1307
|
|
|
1311
1308
|
function ResponseBlock({ data, title, className }) {
|
|
1312
|
-
const [copied,
|
|
1309
|
+
const [copied, setCopied] = useState7(false);
|
|
1313
1310
|
const jsonString = JSON.stringify(data, null, 2);
|
|
1314
1311
|
const handleCopy = () => {
|
|
1315
|
-
|
|
1312
|
+
navigator.clipboard.writeText(jsonString);
|
|
1313
|
+
setCopied(true);
|
|
1314
|
+
setTimeout(() => setCopied(false), 1200);
|
|
1316
1315
|
};
|
|
1317
1316
|
return /* @__PURE__ */ jsxs16("div", {
|
|
1318
|
-
className: cn("group rounded-lg border border-
|
|
1317
|
+
className: cn("group rounded-lg border border-border overflow-hidden bg-muted/30", className),
|
|
1319
1318
|
children: [
|
|
1320
1319
|
title && /* @__PURE__ */ jsxs16("div", {
|
|
1321
|
-
className: "flex items-center justify-between px-4 py-2 border-b border-
|
|
1320
|
+
className: "flex items-center justify-between px-4 py-2 border-b border-border bg-muted/50",
|
|
1322
1321
|
children: [
|
|
1323
1322
|
/* @__PURE__ */ jsx27("span", {
|
|
1324
|
-
className: "text-xs font-medium text-
|
|
1323
|
+
className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
|
|
1325
1324
|
children: title
|
|
1326
1325
|
}),
|
|
1327
1326
|
/* @__PURE__ */ jsx27("button", {
|
|
1328
1327
|
type: "button",
|
|
1329
1328
|
onClick: handleCopy,
|
|
1330
|
-
className: "p-1 rounded text-
|
|
1329
|
+
className: "p-1 rounded text-muted-foreground hover:text-foreground opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",
|
|
1331
1330
|
"aria-label": "Copy response",
|
|
1332
1331
|
children: copied ? /* @__PURE__ */ jsx27(Check4, {
|
|
1333
1332
|
size: 14
|
|
@@ -1351,7 +1350,7 @@ function ResponseBlock({ data, title, className }) {
|
|
|
1351
1350
|
!title && /* @__PURE__ */ jsx27("button", {
|
|
1352
1351
|
type: "button",
|
|
1353
1352
|
onClick: handleCopy,
|
|
1354
|
-
className: "absolute top-3 right-3 p-1.5 rounded text-
|
|
1353
|
+
className: "absolute top-3 right-3 p-1.5 rounded text-muted-foreground hover:text-foreground opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",
|
|
1355
1354
|
"aria-label": "Copy response",
|
|
1356
1355
|
children: copied ? /* @__PURE__ */ jsx27(Check4, {
|
|
1357
1356
|
size: 14
|
|
@@ -1369,25 +1368,25 @@ function JsonHighlight({ json, depth = 0 }) {
|
|
|
1369
1368
|
const nextIndent = " ".repeat(depth + 1);
|
|
1370
1369
|
if (json === null) {
|
|
1371
1370
|
return /* @__PURE__ */ jsx27("span", {
|
|
1372
|
-
className: "text-
|
|
1371
|
+
className: "text-orange-400",
|
|
1373
1372
|
children: "null"
|
|
1374
1373
|
});
|
|
1375
1374
|
}
|
|
1376
1375
|
if (typeof json === "boolean") {
|
|
1377
1376
|
return /* @__PURE__ */ jsx27("span", {
|
|
1378
|
-
className: "text-
|
|
1377
|
+
className: "text-orange-400",
|
|
1379
1378
|
children: json ? "true" : "false"
|
|
1380
1379
|
});
|
|
1381
1380
|
}
|
|
1382
1381
|
if (typeof json === "number") {
|
|
1383
1382
|
return /* @__PURE__ */ jsx27("span", {
|
|
1384
|
-
className: "text-
|
|
1383
|
+
className: "text-cyan-400",
|
|
1385
1384
|
children: json
|
|
1386
1385
|
});
|
|
1387
1386
|
}
|
|
1388
1387
|
if (typeof json === "string") {
|
|
1389
1388
|
return /* @__PURE__ */ jsxs16("span", {
|
|
1390
|
-
className: "text-
|
|
1389
|
+
className: "text-emerald-400",
|
|
1391
1390
|
children: [
|
|
1392
1391
|
'"',
|
|
1393
1392
|
json,
|
|
@@ -1398,14 +1397,14 @@ function JsonHighlight({ json, depth = 0 }) {
|
|
|
1398
1397
|
if (Array.isArray(json)) {
|
|
1399
1398
|
if (json.length === 0) {
|
|
1400
1399
|
return /* @__PURE__ */ jsx27("span", {
|
|
1401
|
-
className: "text-
|
|
1400
|
+
className: "text-foreground",
|
|
1402
1401
|
children: "[]"
|
|
1403
1402
|
});
|
|
1404
1403
|
}
|
|
1405
1404
|
return /* @__PURE__ */ jsxs16(Fragment4, {
|
|
1406
1405
|
children: [
|
|
1407
1406
|
/* @__PURE__ */ jsx27("span", {
|
|
1408
|
-
className: "text-
|
|
1407
|
+
className: "text-foreground",
|
|
1409
1408
|
children: "["
|
|
1410
1409
|
}),
|
|
1411
1410
|
`
|
|
@@ -1418,7 +1417,7 @@ function JsonHighlight({ json, depth = 0 }) {
|
|
|
1418
1417
|
depth: depth + 1
|
|
1419
1418
|
}),
|
|
1420
1419
|
i < json.length - 1 && /* @__PURE__ */ jsx27("span", {
|
|
1421
|
-
className: "text-
|
|
1420
|
+
className: "text-foreground",
|
|
1422
1421
|
children: ","
|
|
1423
1422
|
}),
|
|
1424
1423
|
`
|
|
@@ -1427,7 +1426,7 @@ function JsonHighlight({ json, depth = 0 }) {
|
|
|
1427
1426
|
}, i)),
|
|
1428
1427
|
indent,
|
|
1429
1428
|
/* @__PURE__ */ jsx27("span", {
|
|
1430
|
-
className: "text-
|
|
1429
|
+
className: "text-foreground",
|
|
1431
1430
|
children: "]"
|
|
1432
1431
|
})
|
|
1433
1432
|
]
|
|
@@ -1437,14 +1436,14 @@ function JsonHighlight({ json, depth = 0 }) {
|
|
|
1437
1436
|
const entries = Object.entries(json);
|
|
1438
1437
|
if (entries.length === 0) {
|
|
1439
1438
|
return /* @__PURE__ */ jsx27("span", {
|
|
1440
|
-
className: "text-
|
|
1439
|
+
className: "text-foreground",
|
|
1441
1440
|
children: "{}"
|
|
1442
1441
|
});
|
|
1443
1442
|
}
|
|
1444
1443
|
return /* @__PURE__ */ jsxs16(Fragment4, {
|
|
1445
1444
|
children: [
|
|
1446
1445
|
/* @__PURE__ */ jsx27("span", {
|
|
1447
|
-
className: "text-
|
|
1446
|
+
className: "text-foreground",
|
|
1448
1447
|
children: "{"
|
|
1449
1448
|
}),
|
|
1450
1449
|
`
|
|
@@ -1453,7 +1452,7 @@ function JsonHighlight({ json, depth = 0 }) {
|
|
|
1453
1452
|
children: [
|
|
1454
1453
|
nextIndent,
|
|
1455
1454
|
/* @__PURE__ */ jsxs16("span", {
|
|
1456
|
-
className: "text-
|
|
1455
|
+
className: "text-blue-400",
|
|
1457
1456
|
children: [
|
|
1458
1457
|
'"',
|
|
1459
1458
|
key,
|
|
@@ -1461,7 +1460,7 @@ function JsonHighlight({ json, depth = 0 }) {
|
|
|
1461
1460
|
]
|
|
1462
1461
|
}),
|
|
1463
1462
|
/* @__PURE__ */ jsx27("span", {
|
|
1464
|
-
className: "text-
|
|
1463
|
+
className: "text-foreground",
|
|
1465
1464
|
children: ": "
|
|
1466
1465
|
}),
|
|
1467
1466
|
/* @__PURE__ */ jsx27(JsonHighlight, {
|
|
@@ -1469,7 +1468,7 @@ function JsonHighlight({ json, depth = 0 }) {
|
|
|
1469
1468
|
depth: depth + 1
|
|
1470
1469
|
}),
|
|
1471
1470
|
i < entries.length - 1 && /* @__PURE__ */ jsx27("span", {
|
|
1472
|
-
className: "text-
|
|
1471
|
+
className: "text-foreground",
|
|
1473
1472
|
children: ","
|
|
1474
1473
|
}),
|
|
1475
1474
|
`
|
|
@@ -1478,14 +1477,14 @@ function JsonHighlight({ json, depth = 0 }) {
|
|
|
1478
1477
|
}, key)),
|
|
1479
1478
|
indent,
|
|
1480
1479
|
/* @__PURE__ */ jsx27("span", {
|
|
1481
|
-
className: "text-
|
|
1480
|
+
className: "text-foreground",
|
|
1482
1481
|
children: "}"
|
|
1483
1482
|
})
|
|
1484
1483
|
]
|
|
1485
1484
|
});
|
|
1486
1485
|
}
|
|
1487
1486
|
return /* @__PURE__ */ jsx27("span", {
|
|
1488
|
-
className: "text-
|
|
1487
|
+
className: "text-foreground",
|
|
1489
1488
|
children: String(json)
|
|
1490
1489
|
});
|
|
1491
1490
|
}
|
|
@@ -1494,6 +1493,7 @@ import { highlight as highlight2, Pre as Pre2 } from "codehike/code";
|
|
|
1494
1493
|
|
|
1495
1494
|
// src/docskit/code.copy.tsx
|
|
1496
1495
|
import { Check as Check5, Copy as Copy5 } from "lucide-react";
|
|
1496
|
+
import { useState as useState8 } from "react";
|
|
1497
1497
|
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
1498
1498
|
|
|
1499
1499
|
function CopyButton({
|
|
@@ -1501,15 +1501,19 @@ function CopyButton({
|
|
|
1501
1501
|
className,
|
|
1502
1502
|
variant = "floating"
|
|
1503
1503
|
}) {
|
|
1504
|
-
const [copied,
|
|
1504
|
+
const [copied, setCopied] = useState8(false);
|
|
1505
1505
|
return /* @__PURE__ */ jsx28("button", {
|
|
1506
1506
|
type: "button",
|
|
1507
1507
|
className: cn("cursor-pointer transition-opacity duration-200", variant === "floating" && [
|
|
1508
1508
|
"size-8 flex items-center justify-center",
|
|
1509
|
-
"rounded border border-
|
|
1509
|
+
"rounded border border-openpkg-code-border bg-openpkg-code-bg",
|
|
1510
1510
|
"opacity-0 group-hover:opacity-100"
|
|
1511
1511
|
], variant === "inline" && "rounded", className),
|
|
1512
|
-
onClick: () =>
|
|
1512
|
+
onClick: () => {
|
|
1513
|
+
navigator.clipboard.writeText(text);
|
|
1514
|
+
setCopied(true);
|
|
1515
|
+
setTimeout(() => setCopied(false), 1200);
|
|
1516
|
+
},
|
|
1513
1517
|
"aria-label": "Copy to clipboard",
|
|
1514
1518
|
children: copied ? /* @__PURE__ */ jsx28(Check5, {
|
|
1515
1519
|
size: 16,
|
|
@@ -1577,10 +1581,10 @@ async function SingleCode(props) {
|
|
|
1577
1581
|
const { pre, title, code, icon: icon2, options } = props.group.tabs[0];
|
|
1578
1582
|
const showCopy = options?.copyButton;
|
|
1579
1583
|
return /* @__PURE__ */ jsxs17("div", {
|
|
1580
|
-
className: cn("group rounded overflow-hidden relative border-
|
|
1584
|
+
className: cn("group rounded overflow-hidden relative border-openpkg-code-border flex flex-col border my-4 not-prose", props.className),
|
|
1581
1585
|
children: [
|
|
1582
1586
|
title ? /* @__PURE__ */ jsx30("div", {
|
|
1583
|
-
className: cn("border-b-[1px] border-
|
|
1587
|
+
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"),
|
|
1584
1588
|
children: /* @__PURE__ */ jsxs17("div", {
|
|
1585
1589
|
className: "flex items-center h-5 gap-2",
|
|
1586
1590
|
children: [
|
|
@@ -1602,7 +1606,7 @@ async function SingleCode(props) {
|
|
|
1602
1606
|
showCopy && /* @__PURE__ */ jsx30(CopyButton, {
|
|
1603
1607
|
text: code,
|
|
1604
1608
|
variant: "floating",
|
|
1605
|
-
className: cn("absolute right-3 z-10 text-
|
|
1609
|
+
className: cn("absolute right-3 z-10 text-openpkg-code-text-inactive", title ? "top-3" : "top-1/2 -translate-y-1/2")
|
|
1606
1610
|
})
|
|
1607
1611
|
]
|
|
1608
1612
|
})
|
|
@@ -1634,7 +1638,7 @@ async function toCodeGroup(props) {
|
|
|
1634
1638
|
lang: tab.lang,
|
|
1635
1639
|
pre: /* @__PURE__ */ jsx30(Pre2, {
|
|
1636
1640
|
code: highlighted,
|
|
1637
|
-
className: "overflow-auto px-0 py-3 m-0 rounded-none !bg-
|
|
1641
|
+
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",
|
|
1638
1642
|
style: highlightedStyle,
|
|
1639
1643
|
handlers
|
|
1640
1644
|
})
|
|
@@ -1685,40 +1689,28 @@ function useStateOrLocalStorage(key, initialState) {
|
|
|
1685
1689
|
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
1686
1690
|
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
1687
1691
|
|
|
1688
|
-
function Tabs({
|
|
1689
|
-
className,
|
|
1690
|
-
...props
|
|
1691
|
-
}) {
|
|
1692
|
+
function Tabs({ className, ...props }) {
|
|
1692
1693
|
return /* @__PURE__ */ jsx31(TabsPrimitive.Root, {
|
|
1693
1694
|
"data-slot": "tabs",
|
|
1694
1695
|
className: cn("flex flex-col gap-2", className),
|
|
1695
1696
|
...props
|
|
1696
1697
|
});
|
|
1697
1698
|
}
|
|
1698
|
-
function TabsList({
|
|
1699
|
-
className,
|
|
1700
|
-
...props
|
|
1701
|
-
}) {
|
|
1699
|
+
function TabsList({ className, ...props }) {
|
|
1702
1700
|
return /* @__PURE__ */ jsx31(TabsPrimitive.List, {
|
|
1703
1701
|
"data-slot": "tabs-list",
|
|
1704
|
-
className: cn("bg-
|
|
1702
|
+
className: cn("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]", className),
|
|
1705
1703
|
...props
|
|
1706
1704
|
});
|
|
1707
1705
|
}
|
|
1708
|
-
function TabsTrigger({
|
|
1709
|
-
className,
|
|
1710
|
-
...props
|
|
1711
|
-
}) {
|
|
1706
|
+
function TabsTrigger({ className, ...props }) {
|
|
1712
1707
|
return /* @__PURE__ */ jsx31(TabsPrimitive.Trigger, {
|
|
1713
1708
|
"data-slot": "tabs-trigger",
|
|
1714
|
-
className: cn("data-[state=active]:text-
|
|
1709
|
+
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),
|
|
1715
1710
|
...props
|
|
1716
1711
|
});
|
|
1717
1712
|
}
|
|
1718
|
-
function TabsContent({
|
|
1719
|
-
className,
|
|
1720
|
-
...props
|
|
1721
|
-
}) {
|
|
1713
|
+
function TabsContent({ className, ...props }) {
|
|
1722
1714
|
return /* @__PURE__ */ jsx31(TabsPrimitive.Content, {
|
|
1723
1715
|
"data-slot": "tabs-content",
|
|
1724
1716
|
className: cn("flex-1 outline-none", className),
|
|
@@ -1729,10 +1721,7 @@ function TabsContent({
|
|
|
1729
1721
|
// src/docskit/code.client.tsx
|
|
1730
1722
|
import { jsx as jsx32, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1731
1723
|
|
|
1732
|
-
function MultiCode({
|
|
1733
|
-
group,
|
|
1734
|
-
className
|
|
1735
|
-
}) {
|
|
1724
|
+
function MultiCode({ group, className }) {
|
|
1736
1725
|
const [storedTitle, setCurrentTitle] = useStateOrLocalStorage(group.storage, group.tabs[0].title);
|
|
1737
1726
|
const current = group.tabs.find((tab) => tab.title === storedTitle) || group.tabs[0];
|
|
1738
1727
|
const { code } = current;
|
|
@@ -1740,13 +1729,13 @@ function MultiCode({
|
|
|
1740
1729
|
return /* @__PURE__ */ jsxs18(Tabs, {
|
|
1741
1730
|
value: currentTitle,
|
|
1742
1731
|
onValueChange: setCurrentTitle,
|
|
1743
|
-
className: cn("group border rounded selection:bg-
|
|
1732
|
+
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),
|
|
1744
1733
|
children: [
|
|
1745
1734
|
/* @__PURE__ */ jsx32(TabsList, {
|
|
1746
|
-
className: cn("border-b border-
|
|
1735
|
+
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"),
|
|
1747
1736
|
children: group.tabs.map(({ icon: icon2, title }, _index) => /* @__PURE__ */ jsxs18(TabsTrigger, {
|
|
1748
1737
|
value: title,
|
|
1749
|
-
className: cn("rounded-none transition-colors duration-200 gap-1.5 px-3 font-mono justify-start grow-0", "border-r border-
|
|
1738
|
+
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"),
|
|
1750
1739
|
children: [
|
|
1751
1740
|
/* @__PURE__ */ jsx32("div", {
|
|
1752
1741
|
children: icon2
|
|
@@ -1766,7 +1755,7 @@ function MultiCode({
|
|
|
1766
1755
|
group.options.copyButton && /* @__PURE__ */ jsx32(CopyButton, {
|
|
1767
1756
|
text: code,
|
|
1768
1757
|
variant: "floating",
|
|
1769
|
-
className: "absolute right-3 top-3 z-10 text-
|
|
1758
|
+
className: "absolute right-3 top-3 z-10 text-openpkg-code-text-inactive"
|
|
1770
1759
|
})
|
|
1771
1760
|
]
|
|
1772
1761
|
})
|
|
@@ -1779,12 +1768,12 @@ import {
|
|
|
1779
1768
|
Inline,
|
|
1780
1769
|
Pre as Pre3
|
|
1781
1770
|
} from "codehike/code";
|
|
1782
|
-
import { useEffect as useEffect3, useState as
|
|
1771
|
+
import { useEffect as useEffect3, useState as useState9 } from "react";
|
|
1783
1772
|
import { jsx as jsx33, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1784
1773
|
|
|
1785
1774
|
function ClientDocsKitCode(props) {
|
|
1786
1775
|
const { codeblock, handlers: extraHandlers, className: wrapperClassName } = props;
|
|
1787
|
-
const [highlighted, setHighlighted] =
|
|
1776
|
+
const [highlighted, setHighlighted] = useState9(null);
|
|
1788
1777
|
const { title, flags } = extractFlags2(codeblock);
|
|
1789
1778
|
const options = flagsToOptions(flags);
|
|
1790
1779
|
useEffect3(() => {
|
|
@@ -1796,7 +1785,7 @@ function ClientDocsKitCode(props) {
|
|
|
1796
1785
|
return () => {
|
|
1797
1786
|
cancelled = true;
|
|
1798
1787
|
};
|
|
1799
|
-
}, [codeblock.value, codeblock.lang, codeblock.meta
|
|
1788
|
+
}, [codeblock.value, codeblock.lang, codeblock.meta]);
|
|
1800
1789
|
if (!highlighted) {
|
|
1801
1790
|
return /* @__PURE__ */ jsx33(CodeBlockSkeleton, {
|
|
1802
1791
|
hasTitle: !!title
|
|
@@ -1814,10 +1803,10 @@ function ClientDocsKitCode(props) {
|
|
|
1814
1803
|
className: "opacity-60"
|
|
1815
1804
|
});
|
|
1816
1805
|
return /* @__PURE__ */ jsxs19("div", {
|
|
1817
|
-
className: cn("group rounded overflow-hidden relative border-
|
|
1806
|
+
className: cn("group rounded overflow-hidden relative border-openpkg-code-border flex flex-col border my-4 not-prose", wrapperClassName),
|
|
1818
1807
|
children: [
|
|
1819
1808
|
title ? /* @__PURE__ */ jsx33("div", {
|
|
1820
|
-
className: cn("border-b-[1px] border-
|
|
1809
|
+
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"),
|
|
1821
1810
|
children: /* @__PURE__ */ jsxs19("div", {
|
|
1822
1811
|
className: "flex items-center h-5 gap-2",
|
|
1823
1812
|
children: [
|
|
@@ -1837,14 +1826,14 @@ function ClientDocsKitCode(props) {
|
|
|
1837
1826
|
children: [
|
|
1838
1827
|
/* @__PURE__ */ jsx33(Pre3, {
|
|
1839
1828
|
code: highlighted,
|
|
1840
|
-
className: "overflow-auto px-0 py-3 m-0 rounded-none !bg-
|
|
1829
|
+
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",
|
|
1841
1830
|
style: highlightedStyle,
|
|
1842
1831
|
handlers
|
|
1843
1832
|
}),
|
|
1844
1833
|
showCopy && /* @__PURE__ */ jsx33(CopyButton, {
|
|
1845
1834
|
text: highlighted.code,
|
|
1846
1835
|
variant: "floating",
|
|
1847
|
-
className: cn("absolute right-3 z-10 text-
|
|
1836
|
+
className: cn("absolute right-3 z-10 text-openpkg-code-text-inactive", title ? "top-3" : "top-1/2 -translate-y-1/2")
|
|
1848
1837
|
})
|
|
1849
1838
|
]
|
|
1850
1839
|
})
|
|
@@ -1853,7 +1842,7 @@ function ClientDocsKitCode(props) {
|
|
|
1853
1842
|
}
|
|
1854
1843
|
function ClientTerminal(props) {
|
|
1855
1844
|
const { codeblock, handlers: extraHandlers } = props;
|
|
1856
|
-
const [highlighted, setHighlighted] =
|
|
1845
|
+
const [highlighted, setHighlighted] = useState9(null);
|
|
1857
1846
|
const { flags } = extractFlagsSimple(codeblock);
|
|
1858
1847
|
const options = flagsToOptions(flags);
|
|
1859
1848
|
useEffect3(() => {
|
|
@@ -1865,7 +1854,7 @@ function ClientTerminal(props) {
|
|
|
1865
1854
|
return () => {
|
|
1866
1855
|
cancelled = true;
|
|
1867
1856
|
};
|
|
1868
|
-
}, [codeblock.value, codeblock.lang, codeblock.meta
|
|
1857
|
+
}, [codeblock.value, codeblock.lang, codeblock.meta]);
|
|
1869
1858
|
if (!highlighted) {
|
|
1870
1859
|
return /* @__PURE__ */ jsx33(TerminalSkeleton, {});
|
|
1871
1860
|
}
|
|
@@ -1878,22 +1867,22 @@ function ClientTerminal(props) {
|
|
|
1878
1867
|
const isMultiLine = highlighted.code.includes(`
|
|
1879
1868
|
`);
|
|
1880
1869
|
return /* @__PURE__ */ jsxs19("div", {
|
|
1881
|
-
className: "group rounded overflow-hidden relative border-
|
|
1870
|
+
className: "group rounded overflow-hidden relative border-openpkg-code-border flex flex-col border my-4 not-prose",
|
|
1882
1871
|
children: [
|
|
1883
1872
|
/* @__PURE__ */ jsxs19("div", {
|
|
1884
|
-
className: cn("border-b border-
|
|
1873
|
+
className: cn("border-b border-openpkg-code-border bg-openpkg-code-header", "w-full h-9 flex items-center justify-center shrink-0", "relative"),
|
|
1885
1874
|
children: [
|
|
1886
1875
|
/* @__PURE__ */ jsxs19("div", {
|
|
1887
1876
|
className: "absolute left-3 flex items-center gap-2",
|
|
1888
1877
|
children: [
|
|
1889
1878
|
/* @__PURE__ */ jsx33("div", {
|
|
1890
|
-
className: "size-3 rounded-full bg-
|
|
1879
|
+
className: "size-3 rounded-full bg-openpkg-code-text-inactive/30"
|
|
1891
1880
|
}),
|
|
1892
1881
|
/* @__PURE__ */ jsx33("div", {
|
|
1893
|
-
className: "size-3 rounded-full bg-
|
|
1882
|
+
className: "size-3 rounded-full bg-openpkg-code-text-inactive/30"
|
|
1894
1883
|
}),
|
|
1895
1884
|
/* @__PURE__ */ jsx33("div", {
|
|
1896
|
-
className: "size-3 rounded-full bg-
|
|
1885
|
+
className: "size-3 rounded-full bg-openpkg-code-text-inactive/30"
|
|
1897
1886
|
})
|
|
1898
1887
|
]
|
|
1899
1888
|
}),
|
|
@@ -1908,14 +1897,14 @@ function ClientTerminal(props) {
|
|
|
1908
1897
|
children: [
|
|
1909
1898
|
/* @__PURE__ */ jsx33(Pre3, {
|
|
1910
1899
|
code: highlighted,
|
|
1911
|
-
className: "overflow-auto px-0 py-3 m-0 rounded-none !bg-
|
|
1900
|
+
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",
|
|
1912
1901
|
style: highlightedStyle,
|
|
1913
1902
|
handlers
|
|
1914
1903
|
}),
|
|
1915
1904
|
showCopy && /* @__PURE__ */ jsx33(CopyButton, {
|
|
1916
1905
|
text: highlighted.code,
|
|
1917
1906
|
variant: "floating",
|
|
1918
|
-
className: cn("absolute right-3 z-10 text-
|
|
1907
|
+
className: cn("absolute right-3 z-10 text-openpkg-code-text-inactive", isMultiLine ? "top-3" : "top-1/2 -translate-y-1/2")
|
|
1919
1908
|
})
|
|
1920
1909
|
]
|
|
1921
1910
|
})
|
|
@@ -1923,7 +1912,7 @@ function ClientTerminal(props) {
|
|
|
1923
1912
|
});
|
|
1924
1913
|
}
|
|
1925
1914
|
function ClientInlineCode({ codeblock }) {
|
|
1926
|
-
const [highlighted, setHighlighted] =
|
|
1915
|
+
const [highlighted, setHighlighted] = useState9(null);
|
|
1927
1916
|
useEffect3(() => {
|
|
1928
1917
|
let cancelled = false;
|
|
1929
1918
|
highlight3(codeblock, theme).then((result) => {
|
|
@@ -1933,13 +1922,13 @@ function ClientInlineCode({ codeblock }) {
|
|
|
1933
1922
|
return () => {
|
|
1934
1923
|
cancelled = true;
|
|
1935
1924
|
};
|
|
1936
|
-
}, [codeblock.value, codeblock.lang, codeblock.meta
|
|
1925
|
+
}, [codeblock.value, codeblock.lang, codeblock.meta]);
|
|
1937
1926
|
if (!highlighted) {
|
|
1938
1927
|
return /* @__PURE__ */ jsx33(InlineCodeSkeleton, {});
|
|
1939
1928
|
}
|
|
1940
1929
|
return /* @__PURE__ */ jsx33(Inline, {
|
|
1941
1930
|
code: highlighted,
|
|
1942
|
-
className: "selection:bg-
|
|
1931
|
+
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",
|
|
1943
1932
|
style: highlighted.style
|
|
1944
1933
|
});
|
|
1945
1934
|
}
|
|
@@ -1958,7 +1947,7 @@ function extractFlagsSimple(codeblock) {
|
|
|
1958
1947
|
}
|
|
1959
1948
|
function ClientCode(props) {
|
|
1960
1949
|
const { codeblocks, flags: groupFlags, storage } = props;
|
|
1961
|
-
const [highlighted, setHighlighted] =
|
|
1950
|
+
const [highlighted, setHighlighted] = useState9(null);
|
|
1962
1951
|
const groupOptions = flagsToOptions(groupFlags?.startsWith("-") ? groupFlags.slice(1) : groupFlags);
|
|
1963
1952
|
const _codeBlocksKey = codeblocks.map((b) => `${b.value}|${b.lang}|${b.meta}`).join("::");
|
|
1964
1953
|
useEffect3(() => {
|
|
@@ -1989,7 +1978,7 @@ function ClientCode(props) {
|
|
|
1989
1978
|
return () => {
|
|
1990
1979
|
cancelled = true;
|
|
1991
1980
|
};
|
|
1992
|
-
}, [
|
|
1981
|
+
}, [_codeBlocksKey]);
|
|
1993
1982
|
if (!highlighted) {
|
|
1994
1983
|
return /* @__PURE__ */ jsx33(CodeTabsSkeleton, {
|
|
1995
1984
|
tabs: codeblocks.length
|
|
@@ -1997,15 +1986,13 @@ function ClientCode(props) {
|
|
|
1997
1986
|
}
|
|
1998
1987
|
if (codeblocks.length === 1) {
|
|
1999
1988
|
const tab = highlighted.get(0);
|
|
2000
|
-
if (!tab)
|
|
2001
|
-
return null;
|
|
2002
1989
|
const handlers = getHandlers(tab.options);
|
|
2003
1990
|
const { background: _background, ...highlightedStyle } = tab.highlighted.style;
|
|
2004
1991
|
return /* @__PURE__ */ jsxs19("div", {
|
|
2005
|
-
className: "group rounded overflow-hidden relative border-
|
|
1992
|
+
className: "group rounded overflow-hidden relative border-openpkg-code-border flex flex-col border my-4 not-prose",
|
|
2006
1993
|
children: [
|
|
2007
1994
|
tab.title ? /* @__PURE__ */ jsx33("div", {
|
|
2008
|
-
className: cn("border-b-[1px] border-
|
|
1995
|
+
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"),
|
|
2009
1996
|
children: /* @__PURE__ */ jsxs19("div", {
|
|
2010
1997
|
className: "flex items-center h-5 gap-2",
|
|
2011
1998
|
children: [
|
|
@@ -2025,14 +2012,14 @@ function ClientCode(props) {
|
|
|
2025
2012
|
children: [
|
|
2026
2013
|
/* @__PURE__ */ jsx33(Pre3, {
|
|
2027
2014
|
code: tab.highlighted,
|
|
2028
|
-
className: "overflow-auto px-0 py-3 m-0 rounded-none !bg-
|
|
2015
|
+
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",
|
|
2029
2016
|
style: highlightedStyle,
|
|
2030
2017
|
handlers
|
|
2031
2018
|
}),
|
|
2032
2019
|
tab.options.copyButton && /* @__PURE__ */ jsx33(CopyButton, {
|
|
2033
2020
|
text: tab.highlighted.code,
|
|
2034
2021
|
variant: "floating",
|
|
2035
|
-
className: "absolute right-3 top-3 z-10 text-
|
|
2022
|
+
className: "absolute right-3 top-3 z-10 text-openpkg-code-text-inactive"
|
|
2036
2023
|
})
|
|
2037
2024
|
]
|
|
2038
2025
|
})
|
|
@@ -2058,13 +2045,13 @@ function ClientMultiCode({
|
|
|
2058
2045
|
return /* @__PURE__ */ jsxs19(Tabs, {
|
|
2059
2046
|
value: current.title,
|
|
2060
2047
|
onValueChange: setCurrentTitle,
|
|
2061
|
-
className: cn("group border rounded selection:bg-
|
|
2048
|
+
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"),
|
|
2062
2049
|
children: [
|
|
2063
2050
|
/* @__PURE__ */ jsx33(TabsList, {
|
|
2064
|
-
className: cn("border-b border-
|
|
2051
|
+
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"),
|
|
2065
2052
|
children: tabs.map(({ icon: icon2, title }) => /* @__PURE__ */ jsxs19(TabsTrigger, {
|
|
2066
2053
|
value: title,
|
|
2067
|
-
className: cn("rounded-none transition-colors duration-200 gap-1.5 px-3 font-mono justify-start grow-0", "border-r border-
|
|
2054
|
+
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"),
|
|
2068
2055
|
children: [
|
|
2069
2056
|
/* @__PURE__ */ jsx33("div", {
|
|
2070
2057
|
children: icon2
|
|
@@ -2082,14 +2069,14 @@ function ClientMultiCode({
|
|
|
2082
2069
|
children: [
|
|
2083
2070
|
/* @__PURE__ */ jsx33(Pre3, {
|
|
2084
2071
|
code: current.highlighted,
|
|
2085
|
-
className: "overflow-auto px-0 py-3 m-0 rounded-none !bg-
|
|
2072
|
+
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",
|
|
2086
2073
|
style: highlightedStyle,
|
|
2087
2074
|
handlers
|
|
2088
2075
|
}),
|
|
2089
2076
|
groupOptions.copyButton && /* @__PURE__ */ jsx33(CopyButton, {
|
|
2090
2077
|
text: current.highlighted.code,
|
|
2091
2078
|
variant: "floating",
|
|
2092
|
-
className: "absolute right-3 top-3 z-10 text-
|
|
2079
|
+
className: "absolute right-3 top-3 z-10 text-openpkg-code-text-inactive"
|
|
2093
2080
|
})
|
|
2094
2081
|
]
|
|
2095
2082
|
})
|
|
@@ -2102,7 +2089,7 @@ import {
|
|
|
2102
2089
|
Pre as Pre4
|
|
2103
2090
|
} from "codehike/code";
|
|
2104
2091
|
import { ChevronDown as ChevronDown3, ChevronUp } from "lucide-react";
|
|
2105
|
-
import { useEffect as useEffect4, useState as
|
|
2092
|
+
import { useEffect as useEffect4, useState as useState10 } from "react";
|
|
2106
2093
|
import { jsx as jsx34, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2107
2094
|
|
|
2108
2095
|
function StackedChevrons({ isOpen, className }) {
|
|
@@ -2110,10 +2097,10 @@ function StackedChevrons({ isOpen, className }) {
|
|
|
2110
2097
|
className: cn("flex flex-col items-center -space-y-1 transition-opacity", className),
|
|
2111
2098
|
children: [
|
|
2112
2099
|
/* @__PURE__ */ jsx34(ChevronUp, {
|
|
2113
|
-
className: cn("size-3 transition-colors", isOpen ? "text-
|
|
2100
|
+
className: cn("size-3 transition-colors", isOpen ? "text-openpkg-code-text-active" : "text-openpkg-code-text-inactive")
|
|
2114
2101
|
}),
|
|
2115
2102
|
/* @__PURE__ */ jsx34(ChevronDown3, {
|
|
2116
|
-
className: cn("size-3 transition-colors", isOpen ? "text-
|
|
2103
|
+
className: cn("size-3 transition-colors", isOpen ? "text-openpkg-code-text-active" : "text-openpkg-code-text-inactive")
|
|
2117
2104
|
})
|
|
2118
2105
|
]
|
|
2119
2106
|
});
|
|
@@ -2128,8 +2115,8 @@ function ClientDiffCode(props) {
|
|
|
2128
2115
|
className: wrapperClassName,
|
|
2129
2116
|
defaultOpen = true
|
|
2130
2117
|
} = props;
|
|
2131
|
-
const [highlighted, setHighlighted] =
|
|
2132
|
-
const [isOpen, setIsOpen] =
|
|
2118
|
+
const [highlighted, setHighlighted] = useState10(null);
|
|
2119
|
+
const [isOpen, setIsOpen] = useState10(defaultOpen);
|
|
2133
2120
|
const { title, flags } = extractFlags3(codeblock);
|
|
2134
2121
|
const options = flagsToOptions(flags);
|
|
2135
2122
|
const filename = filenameProp || title || "file";
|
|
@@ -2165,13 +2152,13 @@ function ClientDiffCode(props) {
|
|
|
2165
2152
|
open: isOpen,
|
|
2166
2153
|
onOpenChange: setIsOpen,
|
|
2167
2154
|
children: /* @__PURE__ */ jsxs20("div", {
|
|
2168
|
-
className: cn("group rounded overflow-hidden relative border-
|
|
2155
|
+
className: cn("group rounded overflow-hidden relative border-openpkg-code-border flex flex-col border my-4 not-prose", wrapperClassName),
|
|
2169
2156
|
children: [
|
|
2170
2157
|
/* @__PURE__ */ jsx34(CollapsibleTrigger2, {
|
|
2171
2158
|
asChild: true,
|
|
2172
2159
|
children: /* @__PURE__ */ jsxs20("button", {
|
|
2173
2160
|
type: "button",
|
|
2174
|
-
className: cn("border-b border-
|
|
2161
|
+
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"),
|
|
2175
2162
|
children: [
|
|
2176
2163
|
/* @__PURE__ */ jsxs20("div", {
|
|
2177
2164
|
className: "flex items-center h-5 gap-2 flex-1 min-w-0",
|
|
@@ -2181,11 +2168,11 @@ function ClientDiffCode(props) {
|
|
|
2181
2168
|
children: icon2
|
|
2182
2169
|
}),
|
|
2183
2170
|
path && /* @__PURE__ */ jsx34("span", {
|
|
2184
|
-
className: "text-
|
|
2171
|
+
className: "text-openpkg-code-text-inactive truncate",
|
|
2185
2172
|
children: path
|
|
2186
2173
|
}),
|
|
2187
2174
|
/* @__PURE__ */ jsx34("span", {
|
|
2188
|
-
className: "text-
|
|
2175
|
+
className: "text-openpkg-code-text-active font-medium truncate",
|
|
2189
2176
|
children: filename
|
|
2190
2177
|
})
|
|
2191
2178
|
]
|
|
@@ -2222,14 +2209,14 @@ function ClientDiffCode(props) {
|
|
|
2222
2209
|
children: [
|
|
2223
2210
|
/* @__PURE__ */ jsx34(Pre4, {
|
|
2224
2211
|
code: highlighted,
|
|
2225
|
-
className: "overflow-auto px-0 py-3 m-0 rounded-none !bg-
|
|
2212
|
+
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",
|
|
2226
2213
|
style: highlightedStyle,
|
|
2227
2214
|
handlers
|
|
2228
2215
|
}),
|
|
2229
2216
|
showCopy && /* @__PURE__ */ jsx34(CopyButton, {
|
|
2230
2217
|
text: highlighted.code,
|
|
2231
2218
|
variant: "floating",
|
|
2232
|
-
className: "absolute right-3 top-3 z-10 text-
|
|
2219
|
+
className: "absolute right-3 top-3 z-10 text-openpkg-code-text-inactive"
|
|
2233
2220
|
})
|
|
2234
2221
|
]
|
|
2235
2222
|
})
|
|
@@ -2248,18 +2235,16 @@ function extractFlags3(codeblock) {
|
|
|
2248
2235
|
// src/docskit/code.inline.tsx
|
|
2249
2236
|
import { highlight as highlight5, Inline as Inline2 } from "codehike/code";
|
|
2250
2237
|
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
2251
|
-
async function DocsKitInlineCode({
|
|
2252
|
-
codeblock
|
|
2253
|
-
}) {
|
|
2238
|
+
async function DocsKitInlineCode({ codeblock }) {
|
|
2254
2239
|
const highlighted = await highlight5(codeblock, theme);
|
|
2255
2240
|
return /* @__PURE__ */ jsx35(Inline2, {
|
|
2256
2241
|
code: highlighted,
|
|
2257
|
-
className: "selection:bg-
|
|
2242
|
+
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",
|
|
2258
2243
|
style: highlighted.style
|
|
2259
2244
|
});
|
|
2260
2245
|
}
|
|
2261
2246
|
// src/docskit/code.package-install.tsx
|
|
2262
|
-
import { useState as
|
|
2247
|
+
import { useState as useState11 } from "react";
|
|
2263
2248
|
import { jsx as jsx36, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2264
2249
|
|
|
2265
2250
|
var managerLabels = {
|
|
@@ -2312,25 +2297,25 @@ function PackageInstall({
|
|
|
2312
2297
|
managers = ["npm", "bun", "pnpm", "yarn"],
|
|
2313
2298
|
copyButton = true
|
|
2314
2299
|
}) {
|
|
2315
|
-
const [activeManager, setActiveManager] =
|
|
2300
|
+
const [activeManager, setActiveManager] = useState11(managers[0]);
|
|
2316
2301
|
const command = getInstallCommand(activeManager, pkg, { dev, global: isGlobal });
|
|
2317
2302
|
return /* @__PURE__ */ jsxs21("div", {
|
|
2318
|
-
className: "group rounded overflow-hidden border border-
|
|
2303
|
+
className: "group rounded overflow-hidden border border-openpkg-code-border flex flex-col my-4 not-prose",
|
|
2319
2304
|
children: [
|
|
2320
2305
|
/* @__PURE__ */ jsxs21("div", {
|
|
2321
|
-
className: cn("border-b border-
|
|
2306
|
+
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"),
|
|
2322
2307
|
children: [
|
|
2323
2308
|
/* @__PURE__ */ jsxs21("div", {
|
|
2324
2309
|
className: "flex items-center gap-2",
|
|
2325
2310
|
children: [
|
|
2326
2311
|
/* @__PURE__ */ jsx36("div", {
|
|
2327
|
-
className: "size-3 rounded-full bg-
|
|
2312
|
+
className: "size-3 rounded-full bg-openpkg-code-text-inactive/30"
|
|
2328
2313
|
}),
|
|
2329
2314
|
/* @__PURE__ */ jsx36("div", {
|
|
2330
|
-
className: "size-3 rounded-full bg-
|
|
2315
|
+
className: "size-3 rounded-full bg-openpkg-code-text-inactive/30"
|
|
2331
2316
|
}),
|
|
2332
2317
|
/* @__PURE__ */ jsx36("div", {
|
|
2333
|
-
className: "size-3 rounded-full bg-
|
|
2318
|
+
className: "size-3 rounded-full bg-openpkg-code-text-inactive/30"
|
|
2334
2319
|
})
|
|
2335
2320
|
]
|
|
2336
2321
|
}),
|
|
@@ -2339,7 +2324,7 @@ function PackageInstall({
|
|
|
2339
2324
|
children: managers.map((manager) => /* @__PURE__ */ jsx36("button", {
|
|
2340
2325
|
type: "button",
|
|
2341
2326
|
onClick: () => setActiveManager(manager),
|
|
2342
|
-
className: cn("px-2 py-0.5 text-sm font-medium rounded-md transition-colors duration-200", "border h-6", activeManager === manager ? "bg-
|
|
2327
|
+
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"),
|
|
2343
2328
|
children: managerLabels[manager]
|
|
2344
2329
|
}, manager))
|
|
2345
2330
|
}),
|
|
@@ -2350,7 +2335,7 @@ function PackageInstall({
|
|
|
2350
2335
|
]
|
|
2351
2336
|
}),
|
|
2352
2337
|
/* @__PURE__ */ jsxs21("div", {
|
|
2353
|
-
className: "relative flex items-start bg-
|
|
2338
|
+
className: "relative flex items-start bg-openpkg-code-bg",
|
|
2354
2339
|
children: [
|
|
2355
2340
|
/* @__PURE__ */ jsx36("pre", {
|
|
2356
2341
|
className: "overflow-auto px-3 py-3 m-0 font-mono text-sm flex-1",
|
|
@@ -2373,7 +2358,7 @@ function PackageInstall({
|
|
|
2373
2358
|
copyButton && /* @__PURE__ */ jsx36(CopyButton, {
|
|
2374
2359
|
text: command,
|
|
2375
2360
|
variant: "floating",
|
|
2376
|
-
className: "absolute right-3 top-1/2 -translate-y-1/2 z-10 text-
|
|
2361
|
+
className: "absolute right-3 top-1/2 -translate-y-1/2 z-10 text-openpkg-code-text-inactive"
|
|
2377
2362
|
})
|
|
2378
2363
|
]
|
|
2379
2364
|
})
|
|
@@ -2433,22 +2418,22 @@ async function Terminal(props) {
|
|
|
2433
2418
|
const isMultiLine = highlighted.code.includes(`
|
|
2434
2419
|
`);
|
|
2435
2420
|
return /* @__PURE__ */ jsxs22("div", {
|
|
2436
|
-
className: "group rounded overflow-hidden relative border-
|
|
2421
|
+
className: "group rounded overflow-hidden relative border-openpkg-code-border flex flex-col border my-4 not-prose",
|
|
2437
2422
|
children: [
|
|
2438
2423
|
/* @__PURE__ */ jsxs22("div", {
|
|
2439
|
-
className: cn("border-b border-
|
|
2424
|
+
className: cn("border-b border-openpkg-code-border bg-openpkg-code-header", "w-full h-9 flex items-center justify-center shrink-0", "relative"),
|
|
2440
2425
|
children: [
|
|
2441
2426
|
/* @__PURE__ */ jsxs22("div", {
|
|
2442
2427
|
className: "absolute left-3 flex items-center gap-2",
|
|
2443
2428
|
children: [
|
|
2444
2429
|
/* @__PURE__ */ jsx38("div", {
|
|
2445
|
-
className: "size-3 rounded-full bg-
|
|
2430
|
+
className: "size-3 rounded-full bg-openpkg-code-text-inactive/30"
|
|
2446
2431
|
}),
|
|
2447
2432
|
/* @__PURE__ */ jsx38("div", {
|
|
2448
|
-
className: "size-3 rounded-full bg-
|
|
2433
|
+
className: "size-3 rounded-full bg-openpkg-code-text-inactive/30"
|
|
2449
2434
|
}),
|
|
2450
2435
|
/* @__PURE__ */ jsx38("div", {
|
|
2451
|
-
className: "size-3 rounded-full bg-
|
|
2436
|
+
className: "size-3 rounded-full bg-openpkg-code-text-inactive/30"
|
|
2452
2437
|
})
|
|
2453
2438
|
]
|
|
2454
2439
|
}),
|
|
@@ -2463,14 +2448,14 @@ async function Terminal(props) {
|
|
|
2463
2448
|
children: [
|
|
2464
2449
|
/* @__PURE__ */ jsx38(Pre5, {
|
|
2465
2450
|
code: highlighted,
|
|
2466
|
-
className: "overflow-auto px-0 py-3 m-0 rounded-none !bg-
|
|
2451
|
+
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",
|
|
2467
2452
|
style: highlightedStyle,
|
|
2468
2453
|
handlers
|
|
2469
2454
|
}),
|
|
2470
2455
|
showCopy && /* @__PURE__ */ jsx38(CopyButton, {
|
|
2471
2456
|
text: highlighted.code,
|
|
2472
2457
|
variant: "floating",
|
|
2473
|
-
className: cn("absolute right-3 z-10 text-
|
|
2458
|
+
className: cn("absolute right-3 z-10 text-openpkg-code-text-inactive", isMultiLine ? "top-3" : "top-1/2 -translate-y-1/2")
|
|
2474
2459
|
})
|
|
2475
2460
|
]
|
|
2476
2461
|
})
|
|
@@ -2532,86 +2517,48 @@ function WithNotes({ children, ...rest }) {
|
|
|
2532
2517
|
children
|
|
2533
2518
|
});
|
|
2534
2519
|
}
|
|
2535
|
-
// src/docskit/
|
|
2520
|
+
// src/docskit/import-section.tsx
|
|
2536
2521
|
import { Check as Check6, Copy as Copy6 } from "lucide-react";
|
|
2537
|
-
import { useState as useState10 } from "react";
|
|
2538
|
-
import { jsx as jsx40, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
2539
2522
|
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
const
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
if (!tabs.length)
|
|
2555
|
-
return null;
|
|
2556
|
-
return /* @__PURE__ */ jsxs23("div", {
|
|
2557
|
-
className: cn("group rounded-lg border border-dk-border bg-dk-background overflow-hidden", "selection:bg-dk-selection selection:text-current", className),
|
|
2558
|
-
children: [
|
|
2559
|
-
/* @__PURE__ */ jsxs23("div", {
|
|
2560
|
-
className: cn("flex items-center border-b border-dk-border bg-dk-tabs-background", sticky && "sticky top-0 z-10"),
|
|
2561
|
-
children: [
|
|
2562
|
-
/* @__PURE__ */ jsx40("div", {
|
|
2563
|
-
className: "flex-1 flex items-stretch",
|
|
2564
|
-
children: tabs.map((tab, index) => /* @__PURE__ */ jsx40("button", {
|
|
2565
|
-
type: "button",
|
|
2566
|
-
onClick: () => setActiveIndex(index),
|
|
2567
|
-
className: cn("px-4 py-2 text-sm font-mono transition-colors duration-200", "border-r border-dk-border last:border-r-0", index === activeIndex ? "text-dk-tab-active-foreground bg-dk-background/50" : "text-dk-tab-inactive-foreground hover:text-dk-tab-active-foreground"),
|
|
2568
|
-
children: tab.label
|
|
2569
|
-
}, tab.label))
|
|
2570
|
-
}),
|
|
2571
|
-
/* @__PURE__ */ jsx40("button", {
|
|
2572
|
-
type: "button",
|
|
2573
|
-
onClick: handleCopy,
|
|
2574
|
-
className: cn("p-2 mx-2", "text-dk-tab-inactive-foreground hover:text-dk-tab-active-foreground", "opacity-0 group-hover:opacity-100 transition-opacity", "cursor-pointer"),
|
|
2575
|
-
"aria-label": "Copy code",
|
|
2576
|
-
children: copied ? /* @__PURE__ */ jsx40(Check6, {
|
|
2577
|
-
size: 16
|
|
2578
|
-
}) : /* @__PURE__ */ jsx40(Copy6, {
|
|
2579
|
-
size: 16
|
|
2580
|
-
})
|
|
2581
|
-
})
|
|
2582
|
-
]
|
|
2583
|
-
}),
|
|
2584
|
-
/* @__PURE__ */ jsx40("div", {
|
|
2585
|
-
className: "bg-dk-background",
|
|
2586
|
-
children: activeTab?.content
|
|
2587
|
-
})
|
|
2588
|
-
]
|
|
2589
|
-
});
|
|
2523
|
+
// src/hooks/use-copy-to-clipboard.ts
|
|
2524
|
+
import { useCallback, useRef as useRef2, useState as useState12 } from "react";
|
|
2525
|
+
var COPY_FEEDBACK_MS = 1200;
|
|
2526
|
+
function useCopyToClipboard(timeout = COPY_FEEDBACK_MS) {
|
|
2527
|
+
const [copied, setCopied] = useState12(false);
|
|
2528
|
+
const timerRef = useRef2(undefined);
|
|
2529
|
+
const copy = useCallback((text) => {
|
|
2530
|
+
navigator.clipboard.writeText(text).then(() => {
|
|
2531
|
+
setCopied(true);
|
|
2532
|
+
clearTimeout(timerRef.current);
|
|
2533
|
+
timerRef.current = setTimeout(() => setCopied(false), timeout);
|
|
2534
|
+
});
|
|
2535
|
+
}, [timeout]);
|
|
2536
|
+
return [copied, copy];
|
|
2590
2537
|
}
|
|
2538
|
+
|
|
2591
2539
|
// src/docskit/import-section.tsx
|
|
2592
|
-
import {
|
|
2593
|
-
import { jsx as jsx41, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
2540
|
+
import { jsx as jsx40, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
2594
2541
|
|
|
2595
2542
|
function ImportSection({ importStatement, className }) {
|
|
2596
2543
|
const [copied, copy] = useCopyToClipboard();
|
|
2597
2544
|
const handleCopy = () => {
|
|
2598
2545
|
copy(importStatement);
|
|
2599
2546
|
};
|
|
2600
|
-
return /* @__PURE__ */
|
|
2547
|
+
return /* @__PURE__ */ jsxs23("div", {
|
|
2601
2548
|
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),
|
|
2602
2549
|
children: [
|
|
2603
|
-
/* @__PURE__ */
|
|
2550
|
+
/* @__PURE__ */ jsx40("code", {
|
|
2604
2551
|
className: "font-mono text-sm text-[var(--openpkg-text-primary)] overflow-x-auto",
|
|
2605
2552
|
children: importStatement
|
|
2606
2553
|
}),
|
|
2607
|
-
/* @__PURE__ */
|
|
2554
|
+
/* @__PURE__ */ jsx40("button", {
|
|
2608
2555
|
type: "button",
|
|
2609
2556
|
onClick: handleCopy,
|
|
2610
2557
|
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"),
|
|
2611
2558
|
"aria-label": "Copy import statement",
|
|
2612
|
-
children: copied ? /* @__PURE__ */
|
|
2559
|
+
children: copied ? /* @__PURE__ */ jsx40(Check6, {
|
|
2613
2560
|
size: 16
|
|
2614
|
-
}) : /* @__PURE__ */
|
|
2561
|
+
}) : /* @__PURE__ */ jsx40(Copy6, {
|
|
2615
2562
|
size: 16
|
|
2616
2563
|
})
|
|
2617
2564
|
})
|
|
@@ -2621,7 +2568,7 @@ function ImportSection({ importStatement, className }) {
|
|
|
2621
2568
|
// src/docskit/type-badge.tsx
|
|
2622
2569
|
import { cva as cva2 } from "class-variance-authority";
|
|
2623
2570
|
import * as React9 from "react";
|
|
2624
|
-
import { jsx as
|
|
2571
|
+
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
2625
2572
|
var typeBadgeVariants = cva2("font-mono text-sm", {
|
|
2626
2573
|
variants: {
|
|
2627
2574
|
typeColor: {
|
|
@@ -2678,7 +2625,7 @@ function detectTypeColor(type) {
|
|
|
2678
2625
|
}
|
|
2679
2626
|
var TypeBadge = React9.forwardRef(({ className, type, typeColor, ...props }, ref) => {
|
|
2680
2627
|
const color2 = typeColor ?? detectTypeColor(type);
|
|
2681
|
-
return /* @__PURE__ */
|
|
2628
|
+
return /* @__PURE__ */ jsx41("span", {
|
|
2682
2629
|
ref,
|
|
2683
2630
|
className: cn(typeBadgeVariants({ typeColor: color2 }), className),
|
|
2684
2631
|
...props,
|
|
@@ -2728,7 +2675,6 @@ export {
|
|
|
2728
2675
|
DocsKitCode,
|
|
2729
2676
|
CopyButton,
|
|
2730
2677
|
CodeTabsSkeleton,
|
|
2731
|
-
CodeTabs,
|
|
2732
2678
|
CodeIcon,
|
|
2733
2679
|
CodeGroup,
|
|
2734
2680
|
CodeBlockSkeleton,
|