@mintlify/components 1.0.0 → 1.0.2
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/components/accordion/accordion-cover.d.ts +12 -0
- package/dist/components/accordion/accordion-cover.d.ts.map +1 -0
- package/dist/components/accordion/accordion-cover.js +28 -28
- package/dist/components/accordion/accordion-group.d.ts +9 -0
- package/dist/components/accordion/accordion-group.d.ts.map +1 -0
- package/dist/components/accordion/accordion-group.js +1 -1
- package/dist/components/accordion/accordion-url-utils.d.ts +5 -0
- package/dist/components/accordion/accordion-url-utils.d.ts.map +1 -0
- package/dist/components/accordion/accordion.d.ts +35 -0
- package/dist/components/accordion/accordion.d.ts.map +1 -0
- package/dist/components/accordion/accordion.js +72 -65
- package/dist/components/accordion/index.d.ts +7 -0
- package/dist/components/accordion/index.d.ts.map +1 -0
- package/dist/components/badge/badge.d.ts +29 -0
- package/dist/components/badge/badge.d.ts.map +1 -0
- package/dist/components/badge/badge.js +18 -18
- package/dist/components/badge/index.d.ts +3 -0
- package/dist/components/badge/index.d.ts.map +1 -0
- package/dist/components/callout/callout.d.ts +24 -0
- package/dist/components/callout/callout.d.ts.map +1 -0
- package/dist/components/callout/callout.js +46 -46
- package/dist/components/callout/index.d.ts +3 -0
- package/dist/components/callout/index.d.ts.map +1 -0
- package/dist/components/card/card.d.ts +34 -0
- package/dist/components/card/card.d.ts.map +1 -0
- package/dist/components/card/card.js +59 -59
- package/dist/components/card/index.d.ts +3 -0
- package/dist/components/card/index.d.ts.map +1 -0
- package/dist/components/code-block/base-code-block.d.ts +9 -0
- package/dist/components/code-block/base-code-block.d.ts.map +1 -0
- package/dist/components/code-block/code-block.d.ts +74 -0
- package/dist/components/code-block/code-block.d.ts.map +1 -0
- package/dist/components/code-block/code-block.js +34 -34
- package/dist/components/code-block/code-footer.d.ts +8 -0
- package/dist/components/code-block/code-footer.d.ts.map +1 -0
- package/dist/components/code-block/code-footer.js +9 -9
- package/dist/components/code-block/code-header.d.ts +11 -0
- package/dist/components/code-block/code-header.d.ts.map +1 -0
- package/dist/components/code-block/code-header.js +20 -20
- package/dist/components/code-block/copy-button.d.ts +16 -0
- package/dist/components/code-block/copy-button.d.ts.map +1 -0
- package/dist/components/code-block/index.d.ts +5 -0
- package/dist/components/code-block/index.d.ts.map +1 -0
- package/dist/components/code-block/story-utils.d.ts +13 -0
- package/dist/components/code-block/story-utils.d.ts.map +1 -0
- package/dist/components/code-group/code-group.d.ts +23 -0
- package/dist/components/code-group/code-group.d.ts.map +1 -0
- package/dist/components/code-group/code-group.js +72 -72
- package/dist/components/code-group/code-select-dropdown.d.ts +10 -0
- package/dist/components/code-group/code-select-dropdown.d.ts.map +1 -0
- package/dist/components/code-group/code-snippet.d.ts +13 -0
- package/dist/components/code-group/code-snippet.d.ts.map +1 -0
- package/dist/components/code-group/dropdown.d.ts +34 -0
- package/dist/components/code-group/dropdown.d.ts.map +1 -0
- package/dist/components/code-group/dropdown.js +47 -47
- package/dist/components/code-group/index.d.ts +3 -0
- package/dist/components/code-group/index.d.ts.map +1 -0
- package/dist/components/code-group/language-dropdown.d.ts +10 -0
- package/dist/components/code-group/language-dropdown.d.ts.map +1 -0
- package/dist/components/code-group/language-dropdown.js +39 -39
- package/dist/components/code-group/language-icon.d.ts +7 -0
- package/dist/components/code-group/language-icon.d.ts.map +1 -0
- package/dist/components/color/color.d.ts +28 -0
- package/dist/components/color/color.d.ts.map +1 -0
- package/dist/components/color/color.js +37 -37
- package/dist/components/color/constants.d.ts +5 -0
- package/dist/components/color/constants.d.ts.map +1 -0
- package/dist/components/color/index.d.ts +4 -0
- package/dist/components/color/index.d.ts.map +1 -0
- package/dist/components/columns/columns.d.ts +11 -0
- package/dist/components/columns/columns.d.ts.map +1 -0
- package/dist/components/columns/constants.d.ts +5 -0
- package/dist/components/columns/constants.d.ts.map +1 -0
- package/dist/components/columns/index.d.ts +3 -0
- package/dist/components/columns/index.d.ts.map +1 -0
- package/dist/components/expandable/expandable.d.ts +21 -0
- package/dist/components/expandable/expandable.d.ts.map +1 -0
- package/dist/components/expandable/expandable.js +46 -46
- package/dist/components/expandable/index.d.ts +3 -0
- package/dist/components/expandable/index.d.ts.map +1 -0
- package/dist/components/frame/frame.d.ts +14 -0
- package/dist/components/frame/frame.d.ts.map +1 -0
- package/dist/components/frame/frame.js +21 -21
- package/dist/components/frame/index.d.ts +3 -0
- package/dist/components/frame/index.d.ts.map +1 -0
- package/dist/components/icon/icon.d.ts +19 -0
- package/dist/components/icon/icon.d.ts.map +1 -0
- package/dist/components/icon/icon.js +24 -24
- package/dist/components/icon/index.d.ts +3 -0
- package/dist/components/icon/index.d.ts.map +1 -0
- package/dist/components/index.d.ts +22 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/mermaid/index.d.ts +7 -0
- package/dist/components/mermaid/index.d.ts.map +1 -0
- package/dist/components/mermaid/mermaid.d.ts +12 -0
- package/dist/components/mermaid/mermaid.d.ts.map +1 -0
- package/dist/components/mermaid/mermaid.js +38 -31
- package/dist/components/mermaid/use-pan-zoom.d.ts +13 -0
- package/dist/components/mermaid/use-pan-zoom.d.ts.map +1 -0
- package/dist/components/mermaid/zoom-controls.d.ts +13 -0
- package/dist/components/mermaid/zoom-controls.d.ts.map +1 -0
- package/dist/components/mermaid/zoom-controls.js +32 -32
- package/dist/components/panel/index.d.ts +3 -0
- package/dist/components/panel/index.d.ts.map +1 -0
- package/dist/components/panel/panel.d.ts +6 -0
- package/dist/components/panel/panel.d.ts.map +1 -0
- package/dist/components/property/index.d.ts +3 -0
- package/dist/components/property/index.d.ts.map +1 -0
- package/dist/components/property/param-head.d.ts +5 -0
- package/dist/components/property/param-head.d.ts.map +1 -0
- package/dist/components/property/param-head.js +40 -40
- package/dist/components/property/pills.d.ts +15 -0
- package/dist/components/property/pills.d.ts.map +1 -0
- package/dist/components/property/pills.js +13 -13
- package/dist/components/property/property.d.ts +24 -0
- package/dist/components/property/property.d.ts.map +1 -0
- package/dist/components/property/property.js +33 -33
- package/dist/components/steps/constants.d.ts +5 -0
- package/dist/components/steps/constants.d.ts.map +1 -0
- package/dist/components/steps/index.d.ts +5 -0
- package/dist/components/steps/index.d.ts.map +1 -0
- package/dist/components/steps/steps.d.ts +35 -0
- package/dist/components/steps/steps.d.ts.map +1 -0
- package/dist/components/steps/steps.js +157 -59
- package/dist/components/tabs/index.d.ts +3 -0
- package/dist/components/tabs/index.d.ts.map +1 -0
- package/dist/components/tabs/tabs.d.ts +36 -0
- package/dist/components/tabs/tabs.d.ts.map +1 -0
- package/dist/components/tabs/tabs.js +84 -78
- package/dist/components/tile/index.d.ts +3 -0
- package/dist/components/tile/index.d.ts.map +1 -0
- package/dist/components/tile/tile.d.ts +11 -0
- package/dist/components/tile/tile.d.ts.map +1 -0
- package/dist/components/tile/tile.js +27 -27
- package/dist/components/tooltip/index.d.ts +3 -0
- package/dist/components/tooltip/index.d.ts.map +1 -0
- package/dist/components/tooltip/tooltip.d.ts +14 -0
- package/dist/components/tooltip/tooltip.d.ts.map +1 -0
- package/dist/components/tooltip/tooltip.js +95 -84
- package/dist/components/tree/context.d.ts +9 -0
- package/dist/components/tree/context.d.ts.map +1 -0
- package/dist/components/tree/file.d.ts +7 -0
- package/dist/components/tree/file.d.ts.map +1 -0
- package/dist/components/tree/file.js +9 -9
- package/dist/components/tree/folder.d.ts +11 -0
- package/dist/components/tree/folder.d.ts.map +1 -0
- package/dist/components/tree/folder.js +21 -21
- package/dist/components/tree/index.d.ts +9 -0
- package/dist/components/tree/index.d.ts.map +1 -0
- package/dist/components/tree/root.d.ts +9 -0
- package/dist/components/tree/root.d.ts.map +1 -0
- package/dist/components/tree/tree-level-context.d.ts +8 -0
- package/dist/components/tree/tree-level-context.d.ts.map +1 -0
- package/dist/components/tree/use-tree-level.d.ts +3 -0
- package/dist/components/tree/use-tree-level.d.ts.map +1 -0
- package/dist/components/tree/utils.d.ts +9 -0
- package/dist/components/tree/utils.d.ts.map +1 -0
- package/dist/components/update/index.d.ts +3 -0
- package/dist/components/update/index.d.ts.map +1 -0
- package/dist/components/update/update.d.ts +22 -0
- package/dist/components/update/update.d.ts.map +1 -0
- package/dist/components/update/update.js +21 -21
- package/dist/components/view/index.d.ts +3 -0
- package/dist/components/view/index.d.ts.map +1 -0
- package/dist/components/view/view.d.ts +12 -0
- package/dist/components/view/view.d.ts.map +1 -0
- package/dist/components/view/view.js +29 -23
- package/dist/constants/brands.d.ts +3 -0
- package/dist/constants/brands.d.ts.map +1 -0
- package/dist/constants/index.d.ts +7 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/selectors.d.ts +126 -0
- package/dist/constants/selectors.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/use-expandable-memory.d.ts +8 -0
- package/dist/hooks/use-expandable-memory.d.ts.map +1 -0
- package/dist/hooks/use-expandable.d.ts +13 -0
- package/dist/hooks/use-expandable.d.ts.map +1 -0
- package/dist/hooks/use-get-shiki-highlighted-html.d.ts +4 -0
- package/dist/hooks/use-get-shiki-highlighted-html.d.ts.map +1 -0
- package/dist/hooks/use-has-hover.d.ts +3 -0
- package/dist/hooks/use-has-hover.d.ts.map +1 -0
- package/dist/hooks/use-is-dark-theme.d.ts +5 -0
- package/dist/hooks/use-is-dark-theme.d.ts.map +1 -0
- package/dist/hooks/use-isomorphic-layout-effect.d.ts +4 -0
- package/dist/hooks/use-isomorphic-layout-effect.d.ts.map +1 -0
- package/dist/icons/index.d.ts +21 -0
- package/dist/icons/index.d.ts.map +1 -0
- package/dist/icons/index.js +2 -2
- package/dist/index.d.ts +3 -565
- package/dist/index.d.ts.map +1 -0
- package/dist/plugins/bg-grid.d.ts +3 -0
- package/dist/plugins/bg-grid.d.ts.map +1 -0
- package/dist/plugins/scrollbar.d.ts +3 -0
- package/dist/plugins/scrollbar.d.ts.map +1 -0
- package/dist/styles.css +2 -0
- package/dist/utils/cn.d.ts +4 -0
- package/dist/utils/cn.d.ts.map +1 -0
- package/dist/utils/copy-to-clipboard.d.ts +5 -0
- package/dist/utils/copy-to-clipboard.d.ts.map +1 -0
- package/dist/utils/enhance-video-props.d.ts +4 -0
- package/dist/utils/enhance-video-props.d.ts.map +1 -0
- package/dist/utils/get-node-text.d.ts +3 -0
- package/dist/utils/get-node-text.d.ts.map +1 -0
- package/dist/utils/icon-utils.d.ts +19 -0
- package/dist/utils/icon-utils.d.ts.map +1 -0
- package/dist/utils/is-absolute-url.d.ts +5 -0
- package/dist/utils/is-absolute-url.d.ts.map +1 -0
- package/dist/utils/is-remote-url.d.ts +3 -0
- package/dist/utils/is-remote-url.d.ts.map +1 -0
- package/dist/utils/make-marker-ids-unique.d.ts +3 -0
- package/dist/utils/make-marker-ids-unique.d.ts.map +1 -0
- package/dist/utils/make-marker-ids-unique.js +42 -0
- package/dist/utils/render-as-child.d.ts +4 -0
- package/dist/utils/render-as-child.d.ts.map +1 -0
- package/dist/utils/shiki/code-styling.d.ts +12 -0
- package/dist/utils/shiki/code-styling.d.ts.map +1 -0
- package/dist/utils/shiki/constants.d.ts +23 -0
- package/dist/utils/shiki/constants.d.ts.map +1 -0
- package/dist/utils/shiki/get-code-styling.d.ts +10 -0
- package/dist/utils/shiki/get-code-styling.d.ts.map +1 -0
- package/dist/utils/shiki/get-shiki-background-colors.d.ts +21 -0
- package/dist/utils/shiki/get-shiki-background-colors.d.ts.map +1 -0
- package/dist/utils/shiki/index.d.ts +31 -0
- package/dist/utils/shiki/index.d.ts.map +1 -0
- package/dist/utils/shiki/lib.d.ts +6 -0
- package/dist/utils/shiki/lib.d.ts.map +1 -0
- package/dist/utils/shiki/shiki-themes.d.ts +3 -0
- package/dist/utils/shiki/shiki-themes.d.ts.map +1 -0
- package/dist/utils/shiki/snippet-presets.d.ts +28 -0
- package/dist/utils/shiki/snippet-presets.d.ts.map +1 -0
- package/dist/utils/shiki/worker-client.d.ts +10 -0
- package/dist/utils/shiki/worker-client.d.ts.map +1 -0
- package/dist/utils/slugify.d.ts +3 -0
- package/dist/utils/slugify.d.ts.map +1 -0
- package/package.json +4 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as t, jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { Classes as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { getNodeText as
|
|
5
|
-
import { BaseCodeBlock as
|
|
2
|
+
import { Classes as B } from "../../constants/selectors.js";
|
|
3
|
+
import { cn as x } from "../../utils/cn.js";
|
|
4
|
+
import { getNodeText as C } from "../../utils/get-node-text.js";
|
|
5
|
+
import { BaseCodeBlock as y } from "./base-code-block.js";
|
|
6
6
|
import { CodeHeader as w } from "./code-header.js";
|
|
7
7
|
import { CopyToClipboardButton as k } from "./copy-button.js";
|
|
8
8
|
const H = function(d) {
|
|
@@ -10,27 +10,27 @@ const H = function(d) {
|
|
|
10
10
|
filename: n,
|
|
11
11
|
children: m,
|
|
12
12
|
className: p,
|
|
13
|
-
icon:
|
|
14
|
-
isSmallText:
|
|
15
|
-
hideAskAiButton:
|
|
16
|
-
feedbackModalOpen:
|
|
13
|
+
icon: s,
|
|
14
|
+
isSmallText: b,
|
|
15
|
+
hideAskAiButton: h,
|
|
16
|
+
feedbackModalOpen: g,
|
|
17
17
|
anchorRef: f,
|
|
18
|
-
codeBlockTheme:
|
|
19
|
-
codeBlockThemeObject:
|
|
20
|
-
askAiButton:
|
|
21
|
-
feedbackButton:
|
|
22
|
-
copyButtonProps:
|
|
23
|
-
} = d, c =
|
|
18
|
+
codeBlockTheme: o = "system",
|
|
19
|
+
codeBlockThemeObject: u,
|
|
20
|
+
askAiButton: e,
|
|
21
|
+
feedbackButton: r,
|
|
22
|
+
copyButtonProps: i
|
|
23
|
+
} = d, c = C(m), l = !!n || !!s;
|
|
24
24
|
return /* @__PURE__ */ t(
|
|
25
25
|
"div",
|
|
26
26
|
{
|
|
27
|
-
className:
|
|
28
|
-
|
|
27
|
+
className: x(
|
|
28
|
+
B.CodeBlock,
|
|
29
29
|
"not-prose group relative mt-5 mb-8 rounded-2xl",
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
o === "system" && "codeblock-light dark:twoslash-dark border border-stone-950/10 bg-stone-50 text-stone-950 dark:border-white/10 dark:bg-white/5 dark:text-stone-50",
|
|
31
|
+
o === "dark" && "codeblock-dark twoslash-dark dark:twoslash-dark bg-codeblock text-stone-50 ring-1 ring-transparent dark:bg-white/5 dark:ring-white/[0.14]",
|
|
32
32
|
l ? "p-0.5" : "bg-transparent dark:bg-transparent",
|
|
33
|
-
|
|
33
|
+
g && "border border-primary dark:border-primary-light",
|
|
34
34
|
p
|
|
35
35
|
),
|
|
36
36
|
ref: f,
|
|
@@ -38,20 +38,20 @@ const H = function(d) {
|
|
|
38
38
|
l ? /* @__PURE__ */ t(
|
|
39
39
|
w,
|
|
40
40
|
{
|
|
41
|
-
codeBlockTheme:
|
|
41
|
+
codeBlockTheme: o,
|
|
42
42
|
filename: n,
|
|
43
|
-
icon:
|
|
43
|
+
icon: s,
|
|
44
44
|
children: [
|
|
45
|
-
|
|
45
|
+
r && r,
|
|
46
46
|
/* @__PURE__ */ a(
|
|
47
47
|
k,
|
|
48
48
|
{
|
|
49
|
-
codeBlockTheme:
|
|
49
|
+
codeBlockTheme: o,
|
|
50
50
|
textToCopy: c,
|
|
51
|
-
...
|
|
51
|
+
...i
|
|
52
52
|
}
|
|
53
53
|
),
|
|
54
|
-
|
|
54
|
+
e && e
|
|
55
55
|
]
|
|
56
56
|
}
|
|
57
57
|
) : /* @__PURE__ */ t(
|
|
@@ -60,26 +60,26 @@ const H = function(d) {
|
|
|
60
60
|
className: "absolute top-3 right-4 flex items-center gap-1.5",
|
|
61
61
|
"data-floating-buttons": !0,
|
|
62
62
|
children: [
|
|
63
|
-
|
|
63
|
+
r && r,
|
|
64
64
|
/* @__PURE__ */ a(
|
|
65
65
|
k,
|
|
66
66
|
{
|
|
67
|
-
codeBlockTheme:
|
|
67
|
+
codeBlockTheme: o,
|
|
68
68
|
textToCopy: c,
|
|
69
|
-
...
|
|
69
|
+
...i
|
|
70
70
|
}
|
|
71
71
|
),
|
|
72
|
-
|
|
72
|
+
e && e
|
|
73
73
|
]
|
|
74
74
|
}
|
|
75
75
|
),
|
|
76
76
|
/* @__PURE__ */ a(
|
|
77
|
-
|
|
77
|
+
y,
|
|
78
78
|
{
|
|
79
|
-
codeBlockTheme:
|
|
80
|
-
codeBlockThemeObject:
|
|
81
|
-
hideAskAiButton:
|
|
82
|
-
isSmallText:
|
|
79
|
+
codeBlockTheme: o,
|
|
80
|
+
codeBlockThemeObject: u,
|
|
81
|
+
hideAskAiButton: h,
|
|
82
|
+
isSmallText: b,
|
|
83
83
|
...d
|
|
84
84
|
}
|
|
85
85
|
)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type CodeFooterProps = {
|
|
2
|
+
numberOfLines: number | undefined;
|
|
3
|
+
isExpanded: boolean;
|
|
4
|
+
toggleExpanded: () => void;
|
|
5
|
+
};
|
|
6
|
+
declare const CodeFooter: ({ numberOfLines, isExpanded, toggleExpanded, }: CodeFooterProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
export { type CodeFooterProps, CodeFooter };
|
|
8
|
+
//# sourceMappingURL=code-footer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-footer.d.ts","sourceRoot":"","sources":["../../../src/components/code-block/code-footer.tsx"],"names":[],"mappings":"AAEA,KAAK,eAAe,GAAG;IACrB,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,MAAM,IAAI,CAAC;CAC5B,CAAC;AAEF,QAAA,MAAM,UAAU,GAAI,gDAIjB,eAAe,mDAuBjB,CAAC;AAEF,OAAO,EAAE,KAAK,eAAe,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import
|
|
3
|
-
const
|
|
1
|
+
import { jsx as e, jsxs as r } from "react/jsx-runtime";
|
|
2
|
+
import n from "../../node_modules/.pnpm/lucide-react@0.453.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/ellipsis.js";
|
|
3
|
+
const c = ({
|
|
4
4
|
numberOfLines: t,
|
|
5
5
|
isExpanded: o,
|
|
6
|
-
toggleExpanded:
|
|
6
|
+
toggleExpanded: s
|
|
7
7
|
}) => t ? /* @__PURE__ */ e(
|
|
8
8
|
"div",
|
|
9
9
|
{
|
|
10
|
-
className: "flex items-center px-3 py-1 font-medium text-
|
|
10
|
+
className: "flex items-center px-3 py-1 font-medium text-stone-500 text-xs hover:text-stone-600 dark:text-stone-400 dark:hover:text-stone-300",
|
|
11
11
|
"data-component-part": "code-block-footer",
|
|
12
|
-
children: /* @__PURE__ */
|
|
12
|
+
children: /* @__PURE__ */ r(
|
|
13
13
|
"button",
|
|
14
14
|
{
|
|
15
15
|
className: "flex flex-1 items-center gap-1.5 py-1.5",
|
|
16
16
|
"data-component-part": "code-block-footer-button",
|
|
17
|
-
onClick:
|
|
17
|
+
onClick: s,
|
|
18
18
|
type: "button",
|
|
19
19
|
children: [
|
|
20
|
-
/* @__PURE__ */ e(
|
|
20
|
+
/* @__PURE__ */ e(n, { className: "size-3.5 shrink-0 text-stone-500 dark:text-stone-400" }),
|
|
21
21
|
o ? "Collapse" : `See all ${t} line${t === 1 ? "" : "s"}`
|
|
22
22
|
]
|
|
23
23
|
}
|
|
@@ -25,5 +25,5 @@ const n = ({
|
|
|
25
25
|
}
|
|
26
26
|
) : null;
|
|
27
27
|
export {
|
|
28
|
-
|
|
28
|
+
c as CodeFooter
|
|
29
29
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { CodeBlockTheme } from '../../utils/shiki/code-styling';
|
|
3
|
+
type CodeHeaderProps = {
|
|
4
|
+
filename?: string;
|
|
5
|
+
icon?: string;
|
|
6
|
+
codeBlockTheme?: CodeBlockTheme;
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
};
|
|
9
|
+
declare const CodeHeader: ({ filename, icon, codeBlockTheme, children, }: CodeHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export { type CodeHeaderProps, CodeHeader };
|
|
11
|
+
//# sourceMappingURL=code-header.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-header.d.ts","sourceRoot":"","sources":["../../../src/components/code-block/code-header.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE,KAAK,eAAe,GAAG;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,QAAA,MAAM,UAAU,GAAI,+CAKjB,eAAe,4CAiCjB,CAAC;AAEF,OAAO,EAAE,KAAK,eAAe,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Classes as
|
|
3
|
-
import { cn as
|
|
1
|
+
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Classes as d } from "../../constants/selectors.js";
|
|
3
|
+
import { cn as s } from "../../utils/cn.js";
|
|
4
4
|
import { Icon as m } from "../icon/icon.js";
|
|
5
5
|
const x = ({
|
|
6
|
-
filename:
|
|
7
|
-
icon:
|
|
8
|
-
codeBlockTheme:
|
|
9
|
-
children:
|
|
10
|
-
}) => /* @__PURE__ */
|
|
6
|
+
filename: t,
|
|
7
|
+
icon: r,
|
|
8
|
+
codeBlockTheme: a = "system",
|
|
9
|
+
children: n
|
|
10
|
+
}) => /* @__PURE__ */ o(
|
|
11
11
|
"div",
|
|
12
12
|
{
|
|
13
|
-
className: "flex rounded-t-[14px] py-1 pr-2.5 pl-4 font-medium text-
|
|
13
|
+
className: "flex rounded-t-[14px] py-1 pr-2.5 pl-4 font-medium text-stone-400 text-xs leading-6",
|
|
14
14
|
"data-component-part": "code-block-header",
|
|
15
15
|
children: [
|
|
16
|
-
/* @__PURE__ */
|
|
16
|
+
/* @__PURE__ */ o(
|
|
17
17
|
"div",
|
|
18
18
|
{
|
|
19
|
-
className:
|
|
20
|
-
"flex
|
|
21
|
-
|
|
19
|
+
className: s(
|
|
20
|
+
"flex min-w-0 grow-0 items-center gap-1.5 text-stone-700 dark:text-stone-300",
|
|
21
|
+
a === "dark" && "text-stone-300"
|
|
22
22
|
),
|
|
23
23
|
"data-component-part": "code-block-header-filename",
|
|
24
24
|
children: [
|
|
25
|
-
|
|
25
|
+
r && /* @__PURE__ */ e(
|
|
26
26
|
m,
|
|
27
27
|
{
|
|
28
|
-
className:
|
|
29
|
-
"size-3.5 bg-
|
|
30
|
-
|
|
28
|
+
className: s(
|
|
29
|
+
"size-3.5 shrink-0 bg-stone-500 dark:bg-stone-400",
|
|
30
|
+
d.CodeBlockIcon
|
|
31
31
|
),
|
|
32
|
-
icon:
|
|
32
|
+
icon: r,
|
|
33
33
|
iconType: "regular",
|
|
34
34
|
overrideColor: !0
|
|
35
35
|
}
|
|
36
36
|
),
|
|
37
|
-
|
|
37
|
+
!!t && /* @__PURE__ */ e("span", { className: "mr-2 min-w-0 truncate", children: t })
|
|
38
38
|
]
|
|
39
39
|
}
|
|
40
40
|
),
|
|
41
|
-
/* @__PURE__ */
|
|
41
|
+
/* @__PURE__ */ e("div", { className: "flex flex-1 items-center justify-end gap-1.5", children: n })
|
|
42
42
|
]
|
|
43
43
|
}
|
|
44
44
|
);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import { CopyToClipboardResult } from '../../utils/copy-to-clipboard';
|
|
3
|
+
import { CodeBlockTheme } from '../../utils/shiki/code-styling';
|
|
4
|
+
type CopyToClipboardButtonProps = {
|
|
5
|
+
textToCopy: string;
|
|
6
|
+
onCopied?: (result: CopyToClipboardResult, textToCopy?: string) => void;
|
|
7
|
+
className?: string;
|
|
8
|
+
showTooltip?: boolean;
|
|
9
|
+
codeBlockTheme?: CodeBlockTheme;
|
|
10
|
+
copyButtonAriaLabel?: string;
|
|
11
|
+
tooltipCopyText?: string;
|
|
12
|
+
tooltipCopiedText?: string;
|
|
13
|
+
};
|
|
14
|
+
declare const CopyToClipboardButton: ({ textToCopy, onCopied, className, showTooltip, codeBlockTheme, copyButtonAriaLabel, tooltipCopyText, tooltipCopiedText, ...buttonProps }: CopyToClipboardButtonProps & ComponentPropsWithoutRef<"button">) => import("react/jsx-runtime").JSX.Element | null;
|
|
15
|
+
export { type CopyToClipboardButtonProps, CopyToClipboardButton };
|
|
16
|
+
//# sourceMappingURL=copy-button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy-button.d.ts","sourceRoot":"","sources":["../../../src/components/code-block/copy-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,wBAAwB,EAAuB,MAAM,OAAO,CAAC;AAG3E,OAAO,EACL,KAAK,qBAAqB,EAE3B,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAMjE,KAAK,0BAA0B,GAAG;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,UAAU,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACxE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,QAAA,MAAM,qBAAqB,GAAI,2IAU5B,0BAA0B,GAAG,wBAAwB,CAAC,QAAQ,CAAC,mDA+DjE,CAAC;AAEF,OAAO,EAAE,KAAK,0BAA0B,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/code-block/index.tsx"],"names":[],"mappings":"AAAA,YAAY,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare const mediumCode = "class HelloWorld {\n private String message;\n \n public HelloWorld(String message) {\n this.message = message;\n }\n \n public void greet() {\n System.out.println(\"Hello, World!\");\n System.out.println(this.message);\n }\n \n public static void main(String[] args) {\n HelloWorld hw = new HelloWorld(\"Welcome to Java!\");\n hw.greet();\n }\n}";
|
|
2
|
+
declare const longExpandableCode = "from datetime import datetime, timedelta\nfrom typing import Dict, List, Optional\nfrom dataclasses import dataclass\n\n@dataclass\nclass Book:\n title: str\n author: str\n isbn: str\n checked_out: bool = False\n due_date: Optional[datetime] = None\n\nclass Library:\n def __init__(self):\n self.books: Dict[str, Book] = {}\n self.checkouts: Dict[str, List[str]] = {} # patron -> list of ISBNs\n\n def add_book(self, book: Book) -> None:\n if book.isbn in self.books:\n raise ValueError(f\"Book with ISBN {book.isbn} already exists\")\n self.books[book.isbn] = book\n\n def checkout_book(self, isbn: str, patron: str, days: int = 14) -> None:\n if patron not in self.checkouts:\n self.checkouts[patron] = []\n\n book = self.books.get(isbn)\n if not book:\n raise ValueError(\"Book not found\")\n\n if book.checked_out:\n raise ValueError(\"Book is already checked out\")\n\n if len(self.checkouts[patron]) >= 3:\n raise ValueError(\"Patron has reached checkout limit\")\n\n book.checked_out = True\n book.due_date = datetime.now() + timedelta(days=days)\n self.checkouts[patron].append(isbn)\n\n def return_book(self, isbn: str) -> float:\n book = self.books.get(isbn)\n if not book or not book.checked_out:\n raise ValueError(\"Book not found or not checked out\")\n\n late_fee = 0.0\n if datetime.now() > book.due_date:\n days_late = (datetime.now() - book.due_date).days\n late_fee = days_late * 0.50\n\n book.checked_out = False\n book.due_date = None\n\n # Remove from patron's checkouts\n for patron, books in self.checkouts.items():\n if isbn in books:\n books.remove(isbn)\n break\n\n return late_fee";
|
|
3
|
+
declare const longSingleLineCode = "To denote a `word` or `phrase` as code, enclose it in backticks (`). The backtick ` is a typographical mark used mainly in computing. It is also known as backquote, grave, or grave accent. This line is intentionally very long to test wrapping behavior and horizontal scrolling.";
|
|
4
|
+
declare const singleLineCode = "To denote a `word` or `phrase` as code, enclose it in backticks (`)";
|
|
5
|
+
declare const diffCodeWithRemove = "function calculateTotal(items) {\n let total = 0;\n for (let i = 0; i < items.length; i++) { // [!code --]\n total += items[i].price; // [!code --]\n for (const item of items) { // [!code ++]\n total += item.price; // [!code ++]\n total += item.tax; // [!code ++]\n }\n return total;\n}\n\nfunction processOrder(order) {\n const total = calculateTotal(order.items);\n const discount = calculateDiscount(order); // [!code ++]\n order.total = total - discount; // [!code ++]\n order.total = total; // [!code --]\n return order;\n}";
|
|
6
|
+
declare const simpleDiffCode = "console.log(\"Hello World\");\nconsole.log(\"Old message\"); // [!code --]\nconsole.log(\"New message\"); // [!code ++]\nconsole.log(\"End\");";
|
|
7
|
+
declare const complexDiffCode = "import React from 'react';\nimport { useState } from 'react'; // [!code --]\nimport { useState, useEffect } from 'react'; // [!code ++]\n\nfunction MyComponent() {\n const [count, setCount] = useState(0);\n const [isLoading, setIsLoading] = useState(false); // [!code ++]\n\n useEffect(() => { // [!code ++]\n setIsLoading(true); // [!code ++]\n // Simulate async operation // [!code ++]\n setTimeout(() => setIsLoading(false), 1000); // [!code ++]\n }, []); // [!code ++]\n\n return (\n <div>\n <h1>Count: {count}</h1> // [!code --]\n <h1>{isLoading ? 'Loading...' : `Count: ${count}`}</h1> // [!code ++]\n <button onClick={() => setCount(count + 1)}>\n Increment\n </button>\n </div>\n );\n}";
|
|
8
|
+
declare const getString: (tabIndex?: number, language?: string) => string;
|
|
9
|
+
declare const shortMultiLineCode = "function greet(name) {\n console.log(\"Hello, \" + name + \"!\");\n return true;\n}";
|
|
10
|
+
declare const shortMultiLineCodeTS = "function greet(name: string): boolean {\n console.log(`Hello, ${name}!`);\n return true;\n}";
|
|
11
|
+
declare const shortCode = "def greet(name):\n print(f\"Hello, {name}!\")\n return True";
|
|
12
|
+
export { mediumCode, longExpandableCode, longSingleLineCode, singleLineCode, diffCodeWithRemove, simpleDiffCode, complexDiffCode, getString, shortMultiLineCode, shortCode, shortMultiLineCodeTS, };
|
|
13
|
+
//# sourceMappingURL=story-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"story-utils.d.ts","sourceRoot":"","sources":["../../../src/components/code-block/story-utils.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,UAAU,gaAgBd,CAAC;AAEH,QAAA,MAAM,kBAAkB,63DA2DA,CAAC;AAEzB,QAAA,MAAM,kBAAkB,0RACiQ,CAAC;AAE1R,QAAA,MAAM,cAAc,wEACmD,CAAC;AAExE,QAAA,MAAM,kBAAkB,wiBAiBtB,CAAC;AAEH,QAAA,MAAM,cAAc,mJAGA,CAAC;AAErB,QAAA,MAAM,eAAe,0uBAuBnB,CAAC;AAEH,QAAA,MAAM,SAAS,GAAI,iBAAY,EAAE,WAAW,MAAM,WAmBjD,CAAC;AAEF,QAAA,MAAM,kBAAkB,0FAGtB,CAAC;AAEH,QAAA,MAAM,oBAAoB,kGAEuE,CAAC;AAElG,QAAA,MAAM,SAAS,sEAAoE,CAAC;AAEpF,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,SAAS,EACT,kBAAkB,EAClB,SAAS,EACT,oBAAoB,GACrB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ReactElement, ReactNode, RefObject } from 'react';
|
|
2
|
+
import { CodeBlockProps } from '../code-block/code-block';
|
|
3
|
+
import { CopyToClipboardButtonProps } from '../code-block/copy-button';
|
|
4
|
+
import { CodeBlockTheme, CodeStyling } from '../../utils/shiki/code-styling';
|
|
5
|
+
type CodeGroupProps = {
|
|
6
|
+
dropdown?: boolean;
|
|
7
|
+
isSmallText?: boolean;
|
|
8
|
+
children?: ReactElement<CodeBlockProps>[] | ReactElement<CodeBlockProps>;
|
|
9
|
+
noMargins?: boolean;
|
|
10
|
+
feedbackModalOpen?: boolean;
|
|
11
|
+
anchorRef?: RefObject<HTMLDivElement>;
|
|
12
|
+
codeBlockTheme?: CodeBlockTheme;
|
|
13
|
+
codeBlockThemeObject?: CodeStyling;
|
|
14
|
+
initialSelectedTab?: number;
|
|
15
|
+
onSelectedTabChange?: (index: number) => void;
|
|
16
|
+
askAiButton?: ReactNode;
|
|
17
|
+
feedbackButton?: ReactNode;
|
|
18
|
+
className?: string;
|
|
19
|
+
copyButtonProps?: CopyToClipboardButtonProps;
|
|
20
|
+
};
|
|
21
|
+
declare const CodeGroup: ({ children, isSmallText, className, noMargins, dropdown, feedbackModalOpen, anchorRef, codeBlockTheme, codeBlockThemeObject, initialSelectedTab, onSelectedTabChange, askAiButton, feedbackButton, copyButtonProps, }: CodeGroupProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
22
|
+
export { CodeGroup, type CodeGroupProps };
|
|
23
|
+
//# sourceMappingURL=code-group.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-group.d.ts","sourceRoot":"","sources":["../../../src/components/code-group/code-group.tsx"],"names":[],"mappings":"AACA,OAAc,EAEZ,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,SAAS,EAIf,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAEL,KAAK,0BAA0B,EAChC,MAAM,qCAAqC,CAAC;AAK7C,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAI9E,KAAK,cAAc,GAAG;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,YAAY,CAAC,cAAc,CAAC,EAAE,GAAG,YAAY,CAAC,cAAc,CAAC,CAAC;IACzE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,SAAS,CAAC,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC;IACtC,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,oBAAoB,CAAC,EAAE,WAAW,CAAC;IACnC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,0BAA0B,CAAC;CAC9C,CAAC;AAOF,QAAA,MAAM,SAAS,GAAI,uNAehB,cAAc,mDA+LhB,CAAC;AAqDF,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as m, jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import P, { useState as V, useRef as D, useCallback as E, forwardRef as H } from "react";
|
|
3
3
|
import { BaseCodeBlock as J } from "../code-block/base-code-block.js";
|
|
4
4
|
import { CopyToClipboardButton as K } from "../code-block/copy-button.js";
|
|
5
|
-
import { Classes as
|
|
6
|
-
import { cn as
|
|
5
|
+
import { Classes as h } from "../../constants/selectors.js";
|
|
6
|
+
import { cn as i } from "../../utils/cn.js";
|
|
7
7
|
import { getNodeText as Q } from "../../utils/get-node-text.js";
|
|
8
8
|
import { LanguageDropdown as U } from "./language-dropdown.js";
|
|
9
9
|
import { Icon as $ } from "../icon/icon.js";
|
|
@@ -11,122 +11,122 @@ import { TabsRoot as W } from "../../node_modules/.pnpm/@base-ui_react@1.1.0_@ty
|
|
|
11
11
|
import { TabsList as X } from "../../node_modules/.pnpm/@base-ui_react@1.1.0_@types_react@18.3.27_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/tabs/list/TabsList.js";
|
|
12
12
|
import { TabsPanel as Y } from "../../node_modules/.pnpm/@base-ui_react@1.1.0_@types_react@18.3.27_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/tabs/panel/TabsPanel.js";
|
|
13
13
|
import { TabsTab as Z } from "../../node_modules/.pnpm/@base-ui_react@1.1.0_@types_react@18.3.27_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@base-ui/react/esm/tabs/tab/TabsTab.js";
|
|
14
|
-
const
|
|
15
|
-
children:
|
|
14
|
+
const ur = ({
|
|
15
|
+
children: g,
|
|
16
16
|
isSmallText: f,
|
|
17
17
|
className: c,
|
|
18
18
|
noMargins: l,
|
|
19
19
|
dropdown: p,
|
|
20
|
-
feedbackModalOpen:
|
|
21
|
-
anchorRef:
|
|
22
|
-
codeBlockTheme:
|
|
20
|
+
feedbackModalOpen: n,
|
|
21
|
+
anchorRef: b,
|
|
22
|
+
codeBlockTheme: o = "system",
|
|
23
23
|
codeBlockThemeObject: F,
|
|
24
24
|
initialSelectedTab: _ = 0,
|
|
25
|
-
onSelectedTabChange:
|
|
26
|
-
askAiButton:
|
|
25
|
+
onSelectedTabChange: u,
|
|
26
|
+
askAiButton: y,
|
|
27
27
|
feedbackButton: v,
|
|
28
28
|
copyButtonProps: q
|
|
29
29
|
}) => {
|
|
30
30
|
var N, C, I, j, R, A, G;
|
|
31
|
-
const t = P.Children.toArray(
|
|
31
|
+
const t = P.Children.toArray(g), z = Math.min(
|
|
32
32
|
Math.max(0, _),
|
|
33
33
|
Math.max(0, t.length - 1)
|
|
34
|
-
), [w, O] = V(z),
|
|
34
|
+
), [w, O] = V(z), x = D(/* @__PURE__ */ new Map()), k = E(
|
|
35
35
|
(e) => {
|
|
36
36
|
var L;
|
|
37
|
-
const r = Number(e),
|
|
37
|
+
const r = Number(e), d = typeof document < "u" && ((L = document.activeElement) == null ? void 0 : L.getAttribute("role")) === "tab";
|
|
38
38
|
typeof window < "u" && window.location.hash && window.history.replaceState(
|
|
39
39
|
null,
|
|
40
40
|
"",
|
|
41
41
|
window.location.pathname + window.location.search
|
|
42
|
-
), O(r),
|
|
43
|
-
const M =
|
|
42
|
+
), O(r), u == null || u(r), d && typeof requestAnimationFrame < "u" && requestAnimationFrame(() => {
|
|
43
|
+
const M = x.current.get(r);
|
|
44
44
|
M && M.focus();
|
|
45
45
|
});
|
|
46
46
|
},
|
|
47
|
-
[
|
|
47
|
+
[u]
|
|
48
48
|
);
|
|
49
|
-
if (!
|
|
49
|
+
if (!g)
|
|
50
50
|
return null;
|
|
51
51
|
if (t.length === 0)
|
|
52
52
|
return console.warn(
|
|
53
53
|
"CodeGroup has no children, expected at least one CodeBlock child."
|
|
54
54
|
), null;
|
|
55
55
|
const s = Number(w);
|
|
56
|
-
return /* @__PURE__ */
|
|
56
|
+
return /* @__PURE__ */ m(
|
|
57
57
|
W,
|
|
58
58
|
{
|
|
59
|
-
className:
|
|
60
|
-
|
|
61
|
-
"not-prose relative mt-5 mb-8 flex flex-col overflow-hidden rounded-2xl border border-
|
|
59
|
+
className: i(
|
|
60
|
+
h.CodeGroup,
|
|
61
|
+
"not-prose relative mt-5 mb-8 flex flex-col overflow-hidden rounded-2xl border border-stone-950/10 p-0.5 dark:border-white/10",
|
|
62
62
|
l && "my-0",
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
o === "system" && "dark:codeblock-dark codeblock-light bg-stone-50 text-stone-950 dark:bg-white/5 dark:text-stone-50",
|
|
64
|
+
o === "dark" && "codeblock-dark border-transparent bg-codeblock text-stone-50 dark:bg-white/5",
|
|
65
|
+
n && "border border-primary dark:border-primary-light",
|
|
66
66
|
c
|
|
67
67
|
),
|
|
68
68
|
onValueChange: (e) => k(String(e)),
|
|
69
|
-
ref:
|
|
69
|
+
ref: b,
|
|
70
70
|
value: w,
|
|
71
71
|
children: [
|
|
72
|
-
/* @__PURE__ */
|
|
72
|
+
/* @__PURE__ */ m(
|
|
73
73
|
"div",
|
|
74
74
|
{
|
|
75
|
-
className:
|
|
75
|
+
className: i(
|
|
76
76
|
"relative flex items-center justify-between gap-2",
|
|
77
77
|
p ? "px-2.5" : "pr-2.5"
|
|
78
78
|
),
|
|
79
79
|
"data-component-part": "code-group-tab-bar",
|
|
80
80
|
children: [
|
|
81
|
-
p ? /* @__PURE__ */
|
|
82
|
-
((N = t[s]) == null ? void 0 : N.props.icon) && typeof ((C = t[s]) == null ? void 0 : C.props.icon) == "string" && /* @__PURE__ */
|
|
81
|
+
p ? /* @__PURE__ */ m("div", { className: "flex min-w-0 items-center gap-1.5 font-medium text-xs", children: [
|
|
82
|
+
((N = t[s]) == null ? void 0 : N.props.icon) && typeof ((C = t[s]) == null ? void 0 : C.props.icon) == "string" && /* @__PURE__ */ a(
|
|
83
83
|
$,
|
|
84
84
|
{
|
|
85
|
-
className:
|
|
86
|
-
"size-3.5 bg-
|
|
87
|
-
|
|
85
|
+
className: i(
|
|
86
|
+
"size-3.5 bg-stone-500 dark:bg-stone-400",
|
|
87
|
+
h.CodeBlockIcon
|
|
88
88
|
),
|
|
89
89
|
icon: (I = t[s]) == null ? void 0 : I.props.icon,
|
|
90
90
|
iconType: "regular",
|
|
91
91
|
overrideColor: !0
|
|
92
92
|
}
|
|
93
93
|
),
|
|
94
|
-
/* @__PURE__ */
|
|
94
|
+
/* @__PURE__ */ a(
|
|
95
95
|
"span",
|
|
96
96
|
{
|
|
97
|
-
className:
|
|
97
|
+
className: i(
|
|
98
98
|
"truncate",
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
o === "system" && "text-stone-950 dark:text-stone-50",
|
|
100
|
+
o === "dark" && "text-stone-50"
|
|
101
101
|
),
|
|
102
102
|
children: (j = t[s]) == null ? void 0 : j.props.filename
|
|
103
103
|
}
|
|
104
104
|
)
|
|
105
|
-
] }) : /* @__PURE__ */
|
|
105
|
+
] }) : /* @__PURE__ */ a(
|
|
106
106
|
X,
|
|
107
107
|
{
|
|
108
|
-
className:
|
|
108
|
+
className: i(
|
|
109
109
|
"flex w-0 flex-1 gap-1 overflow-x-auto overflow-y-hidden rounded-tl-xl text-xs leading-6",
|
|
110
|
-
|
|
110
|
+
o === "system" ? "scrollbar-code-system" : "scrollbar-code-dark"
|
|
111
111
|
),
|
|
112
|
-
children: t.map((e, r) => /* @__PURE__ */
|
|
112
|
+
children: t.map((e, r) => /* @__PURE__ */ m(
|
|
113
113
|
S,
|
|
114
114
|
{
|
|
115
|
-
codeBlockTheme:
|
|
115
|
+
codeBlockTheme: o,
|
|
116
116
|
isSelected: s === r,
|
|
117
|
-
ref: (
|
|
118
|
-
|
|
117
|
+
ref: (d) => {
|
|
118
|
+
d ? x.current.set(r, d) : x.current.delete(r);
|
|
119
119
|
},
|
|
120
120
|
tabsLength: t.length,
|
|
121
121
|
value: r,
|
|
122
122
|
children: [
|
|
123
|
-
e.props.icon && typeof e.props.icon == "string" && /* @__PURE__ */
|
|
123
|
+
e.props.icon && typeof e.props.icon == "string" && /* @__PURE__ */ a(
|
|
124
124
|
$,
|
|
125
125
|
{
|
|
126
|
-
className:
|
|
127
|
-
"h-3.5 w-3.5 bg-
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
className: i(
|
|
127
|
+
"h-3.5 w-3.5 bg-stone-500 dark:bg-stone-400",
|
|
128
|
+
o === "system" ? "group-hover:bg-primary dark:group-hover:bg-primary-light" : "group-hover:bg-stone-700/70 group-hover:text-primary-light",
|
|
129
|
+
h.CodeBlockIcon
|
|
130
130
|
),
|
|
131
131
|
color: s === r ? "currentColor" : void 0,
|
|
132
132
|
icon: e.props.icon,
|
|
@@ -141,11 +141,11 @@ const mr = ({
|
|
|
141
141
|
))
|
|
142
142
|
}
|
|
143
143
|
),
|
|
144
|
-
/* @__PURE__ */
|
|
145
|
-
p && /* @__PURE__ */
|
|
144
|
+
/* @__PURE__ */ m("div", { className: "flex shrink-0 items-center justify-end gap-1.5", children: [
|
|
145
|
+
p && /* @__PURE__ */ a(
|
|
146
146
|
U,
|
|
147
147
|
{
|
|
148
|
-
codeBlockTheme:
|
|
148
|
+
codeBlockTheme: o,
|
|
149
149
|
languages: t.map((e) => e.props.language || ""),
|
|
150
150
|
selectedLanguage: ((R = t[s]) == null ? void 0 : R.props.language) || "",
|
|
151
151
|
setSelectedLanguage: (e, r) => {
|
|
@@ -154,31 +154,31 @@ const mr = ({
|
|
|
154
154
|
}
|
|
155
155
|
),
|
|
156
156
|
v && v,
|
|
157
|
-
/* @__PURE__ */
|
|
157
|
+
/* @__PURE__ */ a(
|
|
158
158
|
K,
|
|
159
159
|
{
|
|
160
|
-
codeBlockTheme:
|
|
160
|
+
codeBlockTheme: o,
|
|
161
161
|
textToCopy: Q((G = (A = t[s]) == null ? void 0 : A.props) == null ? void 0 : G.children),
|
|
162
162
|
...q
|
|
163
163
|
}
|
|
164
164
|
),
|
|
165
|
-
|
|
165
|
+
y && y
|
|
166
166
|
] })
|
|
167
167
|
]
|
|
168
168
|
}
|
|
169
169
|
),
|
|
170
|
-
/* @__PURE__ */
|
|
170
|
+
/* @__PURE__ */ a("div", { className: "flex flex-1 overflow-hidden", children: t.map((e, r) => /* @__PURE__ */ a(
|
|
171
171
|
Y,
|
|
172
172
|
{
|
|
173
173
|
className: "relative h-full max-h-full w-full min-w-full max-w-full",
|
|
174
174
|
tabIndex: -1,
|
|
175
175
|
value: r,
|
|
176
|
-
children: /* @__PURE__ */
|
|
176
|
+
children: /* @__PURE__ */ a(
|
|
177
177
|
J,
|
|
178
178
|
{
|
|
179
179
|
...e.props,
|
|
180
|
-
codeBlockTheme:
|
|
181
|
-
codeBlockThemeObject: F ??
|
|
180
|
+
codeBlockTheme: o,
|
|
181
|
+
codeBlockThemeObject: F ?? o,
|
|
182
182
|
expandable: e.props.expandable && r === s,
|
|
183
183
|
isParentCodeGroup: !0,
|
|
184
184
|
isSmallText: f,
|
|
@@ -192,37 +192,37 @@ const mr = ({
|
|
|
192
192
|
}
|
|
193
193
|
);
|
|
194
194
|
}, S = H(
|
|
195
|
-
function({ children: f, value: c, isSelected: l, tabsLength: p, codeBlockTheme:
|
|
196
|
-
return /* @__PURE__ */
|
|
195
|
+
function({ children: f, value: c, isSelected: l, tabsLength: p, codeBlockTheme: n }, b) {
|
|
196
|
+
return /* @__PURE__ */ m(
|
|
197
197
|
Z,
|
|
198
198
|
{
|
|
199
|
-
className:
|
|
199
|
+
className: i(
|
|
200
200
|
"group relative my-1 mb-1.5 ml-0! flex items-center gap-1.5 whitespace-nowrap font-medium outline-0 first:ml-2.5! focus-visible:outline-2",
|
|
201
|
-
l &&
|
|
202
|
-
l &&
|
|
203
|
-
!l &&
|
|
204
|
-
!l &&
|
|
201
|
+
l && n === "system" && "text-primary dark:text-primary-light",
|
|
202
|
+
l && n === "dark" && "text-primary-light",
|
|
203
|
+
!l && n === "system" && "text-stone-500 dark:text-stone-400",
|
|
204
|
+
!l && n === "dark" && "text-stone-400"
|
|
205
205
|
),
|
|
206
|
-
ref:
|
|
206
|
+
ref: b,
|
|
207
207
|
value: c,
|
|
208
208
|
children: [
|
|
209
|
-
/* @__PURE__ */
|
|
209
|
+
/* @__PURE__ */ a(
|
|
210
210
|
"div",
|
|
211
211
|
{
|
|
212
|
-
className:
|
|
212
|
+
className: i(
|
|
213
213
|
"z-10 flex items-center gap-1.5 rounded-lg px-1.5 focus:outline-none",
|
|
214
|
-
p > 1 &&
|
|
215
|
-
p > 1 &&
|
|
214
|
+
p > 1 && n === "system" && "group-hover:bg-stone-200/50 group-hover:text-primary dark:group-hover:bg-stone-700/70 dark:group-hover:text-primary-light",
|
|
215
|
+
p > 1 && n === "dark" && "group-hover:bg-stone-700/70 group-hover:text-primary-light"
|
|
216
216
|
),
|
|
217
217
|
children: f
|
|
218
218
|
}
|
|
219
219
|
),
|
|
220
|
-
l && /* @__PURE__ */
|
|
220
|
+
l && /* @__PURE__ */ a("div", { className: "absolute right-0 -bottom-1.5 left-0 h-0.5 rounded-full bg-primary dark:bg-primary-light" })
|
|
221
221
|
]
|
|
222
222
|
}
|
|
223
223
|
);
|
|
224
224
|
}
|
|
225
225
|
);
|
|
226
226
|
export {
|
|
227
|
-
|
|
227
|
+
ur as CodeGroup
|
|
228
228
|
};
|