@chatsdk-dev/elements 0.0.1
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/README.md +43 -0
- package/dist/chunk-2LHKM7RD.js +14 -0
- package/dist/chunk-5UMYP6MD.js +10 -0
- package/dist/chunk-AP4MG32M.js +36 -0
- package/dist/chunk-CFM57HOS.js +358 -0
- package/dist/chunk-EGIUE7H2.js +37 -0
- package/dist/chunk-M5OONVIO.js +90 -0
- package/dist/chunk-MXTBCHYC.js +31 -0
- package/dist/chunk-NIC3MOMY.js +55 -0
- package/dist/chunk-QTRMNIG3.js +83 -0
- package/dist/chunk-R7G3RQLU.js +36 -0
- package/dist/chunk-RJG5D2TM.js +113 -0
- package/dist/chunk-SLJNKQ2G.js +125 -0
- package/dist/chunk-TDEFIW2L.js +9 -0
- package/dist/chunk-TDP6D7U7.js +551 -0
- package/dist/chunk-V2ITXC65.js +24 -0
- package/dist/chunk-VS55HRUS.js +16 -0
- package/dist/chunk-VYDYCGJL.js +25 -0
- package/dist/chunk-X5YUF2YM.js +113 -0
- package/dist/chunk-YX46JVQN.js +78 -0
- package/dist/chunk-YXAMLTTT.js +16 -0
- package/dist/chunk-YXFVHSY4.js +51 -0
- package/dist/chunk-ZCSZX3OI.js +4 -0
- package/dist/common/use-copy-to-clipboard.d.ts +3 -0
- package/dist/common/use-copy-to-clipboard.js +33 -0
- package/dist/common/utilts.d.ts +8 -0
- package/dist/common/utilts.js +28 -0
- package/dist/components/ai-elements/actions.d.ts +13 -0
- package/dist/components/ai-elements/actions.js +42 -0
- package/dist/components/ai-elements/agent.d.ts +31 -0
- package/dist/components/ai-elements/agent.js +77 -0
- package/dist/components/ai-elements/artifact.d.ts +27 -0
- package/dist/components/ai-elements/artifact.js +108 -0
- package/dist/components/ai-elements/attachments.d.ts +57 -0
- package/dist/components/ai-elements/attachments.js +258 -0
- package/dist/components/ai-elements/audio-player.d.ts +33 -0
- package/dist/components/ai-elements/audio-player.js +199 -0
- package/dist/components/ai-elements/canvas.d.ts +10 -0
- package/dist/components/ai-elements/canvas.js +24 -0
- package/dist/components/ai-elements/chain-of-thought.d.ts +34 -0
- package/dist/components/ai-elements/chain-of-thought.js +159 -0
- package/dist/components/ai-elements/checkpoint.d.ts +16 -0
- package/dist/components/ai-elements/checkpoint.js +47 -0
- package/dist/components/ai-elements/code-block.d.ts +48 -0
- package/dist/components/ai-elements/code-block.js +1 -0
- package/dist/components/ai-elements/commit.d.ts +68 -0
- package/dist/components/ai-elements/commit.js +314 -0
- package/dist/components/ai-elements/confirmation.d.ts +52 -0
- package/dist/components/ai-elements/confirmation.js +76 -0
- package/dist/components/ai-elements/connection.d.ts +5 -0
- package/dist/components/ai-elements/connection.js +34 -0
- package/dist/components/ai-elements/context.d.ts +36 -0
- package/dist/components/ai-elements/context.js +320 -0
- package/dist/components/ai-elements/controls.d.ts +8 -0
- package/dist/components/ai-elements/controls.js +17 -0
- package/dist/components/ai-elements/conversation.d.ts +27 -0
- package/dist/components/ai-elements/conversation.js +119 -0
- package/dist/components/ai-elements/edge.d.ts +9 -0
- package/dist/components/ai-elements/edge.js +111 -0
- package/dist/components/ai-elements/environment-variables.d.ts +42 -0
- package/dist/components/ai-elements/environment-variables.js +208 -0
- package/dist/components/ai-elements/file-tree.d.ts +30 -0
- package/dist/components/ai-elements/file-tree.js +212 -0
- package/dist/components/ai-elements/image.d.ts +10 -0
- package/dist/components/ai-elements/image.js +23 -0
- package/dist/components/ai-elements/inline-citation.d.ts +42 -0
- package/dist/components/ai-elements/inline-citation.js +203 -0
- package/dist/components/ai-elements/jsx-preview.d.ts +33 -0
- package/dist/components/ai-elements/jsx-preview.js +206 -0
- package/dist/components/ai-elements/loader.d.ts +9 -0
- package/dist/components/ai-elements/loader.js +115 -0
- package/dist/components/ai-elements/message.d.ts +42 -0
- package/dist/components/ai-elements/message.js +259 -0
- package/dist/components/ai-elements/mic-selector.d.ts +49 -0
- package/dist/components/ai-elements/mic-selector.js +252 -0
- package/dist/components/ai-elements/model-selector.d.ts +39 -0
- package/dist/components/ai-elements/model-selector.js +73 -0
- package/dist/components/ai-elements/node.d.ts +25 -0
- package/dist/components/ai-elements/node.js +41 -0
- package/dist/components/ai-elements/open-in-chat.d.ts +32 -0
- package/dist/components/ai-elements/open-in-chat.js +366 -0
- package/dist/components/ai-elements/package-info.d.ts +32 -0
- package/dist/components/ai-elements/package-info.js +162 -0
- package/dist/components/ai-elements/panel.d.ts +8 -0
- package/dist/components/ai-elements/panel.js +17 -0
- package/dist/components/ai-elements/persona.d.ts +50 -0
- package/dist/components/ai-elements/persona.js +209 -0
- package/dist/components/ai-elements/plan.d.ts +29 -0
- package/dist/components/ai-elements/plan.js +95 -0
- package/dist/components/ai-elements/prompt-input.d.ts +153 -0
- package/dist/components/ai-elements/prompt-input.js +939 -0
- package/dist/components/ai-elements/queue.d.ts +65 -0
- package/dist/components/ai-elements/queue.js +179 -0
- package/dist/components/ai-elements/reasoning.d.ts +30 -0
- package/dist/components/ai-elements/reasoning.js +161 -0
- package/dist/components/ai-elements/response.d.ts +9 -0
- package/dist/components/ai-elements/response.js +33 -0
- package/dist/components/ai-elements/sandbox.d.ts +28 -0
- package/dist/components/ai-elements/sandbox.js +98 -0
- package/dist/components/ai-elements/schema-display.d.ts +58 -0
- package/dist/components/ai-elements/schema-display.js +313 -0
- package/dist/components/ai-elements/shimmer.d.ts +14 -0
- package/dist/components/ai-elements/shimmer.js +1 -0
- package/dist/components/ai-elements/snippet.d.ts +22 -0
- package/dist/components/ai-elements/snippet.js +90 -0
- package/dist/components/ai-elements/sources.d.ts +16 -0
- package/dist/components/ai-elements/sources.js +62 -0
- package/dist/components/ai-elements/speech-input.d.ts +57 -0
- package/dist/components/ai-elements/speech-input.js +206 -0
- package/dist/components/ai-elements/stack-trace.d.ts +42 -0
- package/dist/components/ai-elements/stack-trace.js +377 -0
- package/dist/components/ai-elements/suggestion.d.ts +14 -0
- package/dist/components/ai-elements/suggestion.js +41 -0
- package/dist/components/ai-elements/task.d.ts +18 -0
- package/dist/components/ai-elements/task.js +60 -0
- package/dist/components/ai-elements/terminal.d.ts +31 -0
- package/dist/components/ai-elements/terminal.js +203 -0
- package/dist/components/ai-elements/test-results.d.ts +61 -0
- package/dist/components/ai-elements/test-results.js +349 -0
- package/dist/components/ai-elements/tool.d.ts +35 -0
- package/dist/components/ai-elements/tool.js +2 -0
- package/dist/components/ai-elements/toolbar.d.ts +8 -0
- package/dist/components/ai-elements/toolbar.js +18 -0
- package/dist/components/ai-elements/transcription.d.ts +19 -0
- package/dist/components/ai-elements/transcription.js +90 -0
- package/dist/components/ai-elements/voice-selector.d.ts +66 -0
- package/dist/components/ai-elements/voice-selector.js +332 -0
- package/dist/components/ai-elements/web-preview.d.ts +38 -0
- package/dist/components/ai-elements/web-preview.js +214 -0
- package/dist/components/info-card.d.ts +14 -0
- package/dist/components/info-card.js +1 -0
- package/dist/components/responsive-alert-dialog.d.ts +19 -0
- package/dist/components/responsive-alert-dialog.js +1 -0
- package/dist/components/responsive-dialog.d.ts +14 -0
- package/dist/components/responsive-dialog.js +1 -0
- package/dist/config-IcWUmjwj.d.ts +239 -0
- package/dist/features/chat/chat-card.d.ts +5 -0
- package/dist/features/chat/chat-card.js +14 -0
- package/dist/features/chat/chat-element/chat-element.d.ts +8 -0
- package/dist/features/chat/chat-element/chat-element.js +14 -0
- package/dist/features/chat/chat-element/use-chat.d.ts +21 -0
- package/dist/features/chat/chat-element/use-chat.js +14 -0
- package/dist/features/chat/chat-element/use-initial-messages.d.ts +20 -0
- package/dist/features/chat/chat-element/use-initial-messages.js +14 -0
- package/dist/features/chat/chat-header/chat-header.d.ts +8 -0
- package/dist/features/chat/chat-header/chat-header.js +14 -0
- package/dist/features/chat/chat-header/chat-menu.d.ts +5 -0
- package/dist/features/chat/chat-header/chat-menu.js +2 -0
- package/dist/features/chat/chat-history/chat-history-empty.d.ts +5 -0
- package/dist/features/chat/chat-history/chat-history-empty.js +1 -0
- package/dist/features/chat/chat-history/chat-history.d.ts +5 -0
- package/dist/features/chat/chat-history/chat-history.js +14 -0
- package/dist/features/chat/chat-message.d.ts +10 -0
- package/dist/features/chat/chat-message.js +1 -0
- package/dist/features/chat/chat-molecule.d.ts +35 -0
- package/dist/features/chat/chat-molecule.js +14 -0
- package/dist/features/chat/chat-prompt-input.d.ts +16 -0
- package/dist/features/chat/chat-prompt-input.js +14 -0
- package/dist/features/chat/chat.context.d.ts +26 -0
- package/dist/features/chat/chat.context.js +13 -0
- package/dist/features/chat/index.d.ts +14 -0
- package/dist/features/chat/index.js +14 -0
- package/dist/features/chat/queries/query-keys.d.ts +8 -0
- package/dist/features/chat/queries/query-keys.js +1 -0
- package/dist/features/chat/queries/use-create-conversation-mutation.d.ts +29 -0
- package/dist/features/chat/queries/use-create-conversation-mutation.js +38 -0
- package/dist/features/chat/queries/use-get-chat-query.d.ts +9 -0
- package/dist/features/chat/queries/use-get-chat-query.js +14 -0
- package/dist/features/chat/queries/use-get-conversation-query.d.ts +62 -0
- package/dist/features/chat/queries/use-get-conversation-query.js +14 -0
- package/dist/features/chat/queries/use-list-conversations-query.d.ts +29 -0
- package/dist/features/chat/queries/use-list-conversations-query.js +14 -0
- package/dist/features/chat/store.d.ts +13 -0
- package/dist/features/chat/store.js +1 -0
- package/dist/features/chat/utils.d.ts +5 -0
- package/dist/features/chat/utils.js +1 -0
- package/dist/features/data-fetching/use-api-client.d.ts +5 -0
- package/dist/features/data-fetching/use-api-client.js +14 -0
- package/dist/features/logger/logger.d.ts +9 -0
- package/dist/features/logger/logger.js +1 -0
- package/dist/features/molecule/chatsdk-provider.d.ts +19 -0
- package/dist/features/molecule/chatsdk-provider.js +26 -0
- package/dist/features/molecule/constants.d.ts +3 -0
- package/dist/features/molecule/constants.js +1 -0
- package/dist/features/molecule/molecule-provider.d.ts +39 -0
- package/dist/features/molecule/molecule-provider.js +1 -0
- package/dist/features/molecule/store.d.ts +53 -0
- package/dist/features/molecule/store.js +3 -0
- package/dist/features/molecule/types/api.d.ts +8 -0
- package/dist/features/molecule/types/api.js +1 -0
- package/dist/features/molecule/types/callbacks.d.ts +22 -0
- package/dist/features/molecule/types/callbacks.js +1 -0
- package/dist/features/molecule/types/config.d.ts +10 -0
- package/dist/features/molecule/types/config.js +1 -0
- package/dist/features/molecule/types/context.d.ts +11 -0
- package/dist/features/molecule/types/context.js +1 -0
- package/dist/features/molecule/types/locale.d.ts +9 -0
- package/dist/features/molecule/types/locale.js +1 -0
- package/dist/features/molecule/types/theme.d.ts +38 -0
- package/dist/features/molecule/types/theme.js +1 -0
- package/dist/features/molecule/types/translations.d.ts +10 -0
- package/dist/features/molecule/types/translations.js +1 -0
- package/dist/features/molecule/use-merge-global-config.d.ts +22 -0
- package/dist/features/molecule/use-merge-global-config.js +5 -0
- package/dist/features/molecule/use-molecule-config.d.ts +41 -0
- package/dist/features/molecule/use-molecule-config.js +6 -0
- package/dist/features/molecule/utils.d.ts +10 -0
- package/dist/features/molecule/utils.js +1 -0
- package/dist/i18n/config.d.ts +61 -0
- package/dist/i18n/config.js +1 -0
- package/dist/i18n/i18next.d.ts +11 -0
- package/dist/i18n/i18next.js +2 -0
- package/dist/i18n/utils.d.ts +11 -0
- package/dist/i18n/utils.js +6 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +20 -0
- package/dist/styles.css +6811 -0
- package/package.json +123 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
|
2
|
+
import { Badge } from '@chatsdk-dev/ui/components/badge';
|
|
3
|
+
import { Collapsible, CollapsibleTrigger, CollapsibleContent } from '@chatsdk-dev/ui/components/collapsible';
|
|
4
|
+
import { cn } from '@chatsdk-dev/ui/lib/utils';
|
|
5
|
+
import { BrainIcon, ChevronDownIcon, DotIcon } from 'lucide-react';
|
|
6
|
+
import { createContext, memo, useMemo, useContext } from 'react';
|
|
7
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
8
|
+
|
|
9
|
+
var ChainOfThoughtContext = createContext(
|
|
10
|
+
null
|
|
11
|
+
);
|
|
12
|
+
var useChainOfThought = () => {
|
|
13
|
+
const context = useContext(ChainOfThoughtContext);
|
|
14
|
+
if (!context) {
|
|
15
|
+
throw new Error(
|
|
16
|
+
"ChainOfThought components must be used within ChainOfThought"
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
return context;
|
|
20
|
+
};
|
|
21
|
+
var ChainOfThought = memo(
|
|
22
|
+
({
|
|
23
|
+
className,
|
|
24
|
+
open,
|
|
25
|
+
defaultOpen = false,
|
|
26
|
+
onOpenChange,
|
|
27
|
+
children,
|
|
28
|
+
...props
|
|
29
|
+
}) => {
|
|
30
|
+
const [isOpen, setIsOpen] = useControllableState({
|
|
31
|
+
defaultProp: defaultOpen,
|
|
32
|
+
onChange: onOpenChange,
|
|
33
|
+
prop: open
|
|
34
|
+
});
|
|
35
|
+
const chainOfThoughtContext = useMemo(
|
|
36
|
+
() => ({ isOpen, setIsOpen }),
|
|
37
|
+
[isOpen, setIsOpen]
|
|
38
|
+
);
|
|
39
|
+
return /* @__PURE__ */ jsx(ChainOfThoughtContext.Provider, { value: chainOfThoughtContext, children: /* @__PURE__ */ jsx("div", { className: cn("not-prose w-full space-y-4", className), ...props, children }) });
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
var ChainOfThoughtHeader = memo(
|
|
43
|
+
({ className, children, ...props }) => {
|
|
44
|
+
const { isOpen, setIsOpen } = useChainOfThought();
|
|
45
|
+
return /* @__PURE__ */ jsx(Collapsible, { onOpenChange: setIsOpen, open: isOpen, children: /* @__PURE__ */ jsxs(
|
|
46
|
+
CollapsibleTrigger,
|
|
47
|
+
{
|
|
48
|
+
className: cn(
|
|
49
|
+
"flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",
|
|
50
|
+
className
|
|
51
|
+
),
|
|
52
|
+
...props,
|
|
53
|
+
children: [
|
|
54
|
+
/* @__PURE__ */ jsx(BrainIcon, { className: "size-4" }),
|
|
55
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1 text-left", children: children ?? "Chain of Thought" }),
|
|
56
|
+
/* @__PURE__ */ jsx(
|
|
57
|
+
ChevronDownIcon,
|
|
58
|
+
{
|
|
59
|
+
className: cn(
|
|
60
|
+
"size-4 transition-transform",
|
|
61
|
+
isOpen ? "rotate-180" : "rotate-0"
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
)
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
) });
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
var stepStatusStyles = {
|
|
71
|
+
active: "text-foreground",
|
|
72
|
+
complete: "text-muted-foreground",
|
|
73
|
+
pending: "text-muted-foreground/50"
|
|
74
|
+
};
|
|
75
|
+
var ChainOfThoughtStep = memo(
|
|
76
|
+
({
|
|
77
|
+
className,
|
|
78
|
+
icon: Icon = DotIcon,
|
|
79
|
+
label,
|
|
80
|
+
description,
|
|
81
|
+
status = "complete",
|
|
82
|
+
children,
|
|
83
|
+
...props
|
|
84
|
+
}) => /* @__PURE__ */ jsxs(
|
|
85
|
+
"div",
|
|
86
|
+
{
|
|
87
|
+
className: cn(
|
|
88
|
+
"flex gap-2 text-sm",
|
|
89
|
+
stepStatusStyles[status],
|
|
90
|
+
"fade-in-0 slide-in-from-top-2 animate-in",
|
|
91
|
+
className
|
|
92
|
+
),
|
|
93
|
+
...props,
|
|
94
|
+
children: [
|
|
95
|
+
/* @__PURE__ */ jsxs("div", { className: "relative mt-0.5", children: [
|
|
96
|
+
/* @__PURE__ */ jsx(Icon, { className: "size-4" }),
|
|
97
|
+
/* @__PURE__ */ jsx("div", { className: "absolute top-7 bottom-0 left-1/2 -mx-px w-px bg-border" })
|
|
98
|
+
] }),
|
|
99
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-2 overflow-hidden", children: [
|
|
100
|
+
/* @__PURE__ */ jsx("div", { children: label }),
|
|
101
|
+
description && /* @__PURE__ */ jsx("div", { className: "text-muted-foreground text-xs", children: description }),
|
|
102
|
+
children
|
|
103
|
+
] })
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
);
|
|
108
|
+
var ChainOfThoughtSearchResults = memo(
|
|
109
|
+
({ className, ...props }) => /* @__PURE__ */ jsx(
|
|
110
|
+
"div",
|
|
111
|
+
{
|
|
112
|
+
className: cn("flex flex-wrap items-center gap-2", className),
|
|
113
|
+
...props
|
|
114
|
+
}
|
|
115
|
+
)
|
|
116
|
+
);
|
|
117
|
+
var ChainOfThoughtSearchResult = memo(
|
|
118
|
+
({ className, children, ...props }) => /* @__PURE__ */ jsx(
|
|
119
|
+
Badge,
|
|
120
|
+
{
|
|
121
|
+
className: cn("gap-1 px-2 py-0.5 font-normal text-xs", className),
|
|
122
|
+
variant: "secondary",
|
|
123
|
+
...props,
|
|
124
|
+
children
|
|
125
|
+
}
|
|
126
|
+
)
|
|
127
|
+
);
|
|
128
|
+
var ChainOfThoughtContent = memo(
|
|
129
|
+
({ className, children, ...props }) => {
|
|
130
|
+
const { isOpen } = useChainOfThought();
|
|
131
|
+
return /* @__PURE__ */ jsx(Collapsible, { open: isOpen, children: /* @__PURE__ */ jsx(
|
|
132
|
+
CollapsibleContent,
|
|
133
|
+
{
|
|
134
|
+
className: cn(
|
|
135
|
+
"mt-2 space-y-3",
|
|
136
|
+
"data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",
|
|
137
|
+
className
|
|
138
|
+
),
|
|
139
|
+
...props,
|
|
140
|
+
children
|
|
141
|
+
}
|
|
142
|
+
) });
|
|
143
|
+
}
|
|
144
|
+
);
|
|
145
|
+
var ChainOfThoughtImage = memo(
|
|
146
|
+
({ className, children, caption, ...props }) => /* @__PURE__ */ jsxs("div", { className: cn("mt-2 space-y-2", className), ...props, children: [
|
|
147
|
+
/* @__PURE__ */ jsx("div", { className: "relative flex max-h-[22rem] items-center justify-center overflow-hidden rounded-lg bg-muted p-3", children }),
|
|
148
|
+
caption && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-xs", children: caption })
|
|
149
|
+
] })
|
|
150
|
+
);
|
|
151
|
+
ChainOfThought.displayName = "ChainOfThought";
|
|
152
|
+
ChainOfThoughtHeader.displayName = "ChainOfThoughtHeader";
|
|
153
|
+
ChainOfThoughtStep.displayName = "ChainOfThoughtStep";
|
|
154
|
+
ChainOfThoughtSearchResults.displayName = "ChainOfThoughtSearchResults";
|
|
155
|
+
ChainOfThoughtSearchResult.displayName = "ChainOfThoughtSearchResult";
|
|
156
|
+
ChainOfThoughtContent.displayName = "ChainOfThoughtContent";
|
|
157
|
+
ChainOfThoughtImage.displayName = "ChainOfThoughtImage";
|
|
158
|
+
|
|
159
|
+
export { ChainOfThought, ChainOfThoughtContent, ChainOfThoughtHeader, ChainOfThoughtImage, ChainOfThoughtSearchResult, ChainOfThoughtSearchResults, ChainOfThoughtStep };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, ComponentProps } from 'react';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import { Button } from '@chatsdk-dev/ui/components/button';
|
|
5
|
+
import { LucideProps } from 'lucide-react';
|
|
6
|
+
|
|
7
|
+
type CheckpointProps = HTMLAttributes<HTMLDivElement>;
|
|
8
|
+
declare const Checkpoint: ({ className, children, ...props }: CheckpointProps) => react_jsx_runtime.JSX.Element;
|
|
9
|
+
type CheckpointIconProps = LucideProps;
|
|
10
|
+
declare const CheckpointIcon: ({ className, children, ...props }: CheckpointIconProps) => string | number | bigint | boolean | react_jsx_runtime.JSX.Element | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined>;
|
|
11
|
+
type CheckpointTriggerProps = ComponentProps<typeof Button> & {
|
|
12
|
+
tooltip?: string;
|
|
13
|
+
};
|
|
14
|
+
declare const CheckpointTrigger: ({ children, variant, size, tooltip, ...props }: CheckpointTriggerProps) => react_jsx_runtime.JSX.Element;
|
|
15
|
+
|
|
16
|
+
export { Checkpoint, CheckpointIcon, type CheckpointIconProps, type CheckpointProps, CheckpointTrigger, type CheckpointTriggerProps };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Button } from '@chatsdk-dev/ui/components/button';
|
|
2
|
+
import { Separator } from '@chatsdk-dev/ui/components/separator';
|
|
3
|
+
import { Tooltip, TooltipTrigger, TooltipContent } from '@chatsdk-dev/ui/components/tooltip';
|
|
4
|
+
import { cn } from '@chatsdk-dev/ui/lib/utils';
|
|
5
|
+
import { BookmarkIcon } from 'lucide-react';
|
|
6
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
var Checkpoint = ({
|
|
9
|
+
className,
|
|
10
|
+
children,
|
|
11
|
+
...props
|
|
12
|
+
}) => /* @__PURE__ */ jsxs(
|
|
13
|
+
"div",
|
|
14
|
+
{
|
|
15
|
+
className: cn(
|
|
16
|
+
"flex items-center gap-0.5 overflow-hidden text-muted-foreground",
|
|
17
|
+
className
|
|
18
|
+
),
|
|
19
|
+
...props,
|
|
20
|
+
children: [
|
|
21
|
+
children,
|
|
22
|
+
/* @__PURE__ */ jsx(Separator, {})
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
var CheckpointIcon = ({
|
|
27
|
+
className,
|
|
28
|
+
children,
|
|
29
|
+
...props
|
|
30
|
+
}) => children ?? /* @__PURE__ */ jsx(BookmarkIcon, { className: cn("size-4 shrink-0", className), ...props });
|
|
31
|
+
var CheckpointTrigger = ({
|
|
32
|
+
children,
|
|
33
|
+
variant = "ghost",
|
|
34
|
+
size = "sm",
|
|
35
|
+
tooltip,
|
|
36
|
+
...props
|
|
37
|
+
}) => tooltip ? /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
38
|
+
/* @__PURE__ */ jsx(
|
|
39
|
+
TooltipTrigger,
|
|
40
|
+
{
|
|
41
|
+
render: () => /* @__PURE__ */ jsx(Button, { size, type: "button", variant, ...props, children })
|
|
42
|
+
}
|
|
43
|
+
),
|
|
44
|
+
/* @__PURE__ */ jsx(TooltipContent, { align: "start", side: "bottom", children: tooltip })
|
|
45
|
+
] }) : /* @__PURE__ */ jsx(Button, { size, type: "button", variant, ...props, children });
|
|
46
|
+
|
|
47
|
+
export { Checkpoint, CheckpointIcon, CheckpointTrigger };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { Button } from '@chatsdk-dev/ui/components/button';
|
|
3
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@chatsdk-dev/ui/components/select';
|
|
4
|
+
import { HTMLAttributes, ComponentProps } from 'react';
|
|
5
|
+
import { BundledLanguage, ThemedToken } from 'shiki';
|
|
6
|
+
|
|
7
|
+
type CodeBlockProps = HTMLAttributes<HTMLDivElement> & {
|
|
8
|
+
code: string;
|
|
9
|
+
language: BundledLanguage;
|
|
10
|
+
showLineNumbers?: boolean;
|
|
11
|
+
};
|
|
12
|
+
interface TokenizedCode {
|
|
13
|
+
tokens: ThemedToken[][];
|
|
14
|
+
fg: string;
|
|
15
|
+
bg: string;
|
|
16
|
+
}
|
|
17
|
+
declare const highlightCode: (code: string, language: BundledLanguage, callback?: (result: TokenizedCode) => void) => TokenizedCode | null;
|
|
18
|
+
declare const CodeBlockContainer: ({ className, language, style, ...props }: HTMLAttributes<HTMLDivElement> & {
|
|
19
|
+
language: string;
|
|
20
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
21
|
+
declare const CodeBlockHeader: ({ children, className, ...props }: HTMLAttributes<HTMLDivElement>) => react_jsx_runtime.JSX.Element;
|
|
22
|
+
declare const CodeBlockTitle: ({ children, className, ...props }: HTMLAttributes<HTMLDivElement>) => react_jsx_runtime.JSX.Element;
|
|
23
|
+
declare const CodeBlockFilename: ({ children, className, ...props }: HTMLAttributes<HTMLSpanElement>) => react_jsx_runtime.JSX.Element;
|
|
24
|
+
declare const CodeBlockActions: ({ children, className, ...props }: HTMLAttributes<HTMLDivElement>) => react_jsx_runtime.JSX.Element;
|
|
25
|
+
declare const CodeBlockContent: ({ code, language, showLineNumbers, }: {
|
|
26
|
+
code: string;
|
|
27
|
+
language: BundledLanguage;
|
|
28
|
+
showLineNumbers?: boolean;
|
|
29
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
30
|
+
declare const CodeBlock: ({ code, language, showLineNumbers, className, children, ...props }: CodeBlockProps) => react_jsx_runtime.JSX.Element;
|
|
31
|
+
type CodeBlockCopyButtonProps = ComponentProps<typeof Button> & {
|
|
32
|
+
onCopy?: () => void;
|
|
33
|
+
onError?: (error: Error) => void;
|
|
34
|
+
timeout?: number;
|
|
35
|
+
};
|
|
36
|
+
declare const CodeBlockCopyButton: ({ onCopy, onError, timeout, children, className, ...props }: CodeBlockCopyButtonProps) => react_jsx_runtime.JSX.Element;
|
|
37
|
+
type CodeBlockLanguageSelectorProps = ComponentProps<typeof Select>;
|
|
38
|
+
declare const CodeBlockLanguageSelector: (props: CodeBlockLanguageSelectorProps) => react_jsx_runtime.JSX.Element;
|
|
39
|
+
type CodeBlockLanguageSelectorTriggerProps = ComponentProps<typeof SelectTrigger>;
|
|
40
|
+
declare const CodeBlockLanguageSelectorTrigger: ({ className, ...props }: CodeBlockLanguageSelectorTriggerProps) => react_jsx_runtime.JSX.Element;
|
|
41
|
+
type CodeBlockLanguageSelectorValueProps = ComponentProps<typeof SelectValue>;
|
|
42
|
+
declare const CodeBlockLanguageSelectorValue: (props: CodeBlockLanguageSelectorValueProps) => react_jsx_runtime.JSX.Element;
|
|
43
|
+
type CodeBlockLanguageSelectorContentProps = ComponentProps<typeof SelectContent>;
|
|
44
|
+
declare const CodeBlockLanguageSelectorContent: ({ align, ...props }: CodeBlockLanguageSelectorContentProps) => react_jsx_runtime.JSX.Element;
|
|
45
|
+
type CodeBlockLanguageSelectorItemProps = ComponentProps<typeof SelectItem>;
|
|
46
|
+
declare const CodeBlockLanguageSelectorItem: (props: CodeBlockLanguageSelectorItemProps) => react_jsx_runtime.JSX.Element;
|
|
47
|
+
|
|
48
|
+
export { CodeBlock, CodeBlockActions, CodeBlockContainer, CodeBlockContent, CodeBlockCopyButton, type CodeBlockCopyButtonProps, CodeBlockFilename, CodeBlockHeader, CodeBlockLanguageSelector, CodeBlockLanguageSelectorContent, type CodeBlockLanguageSelectorContentProps, CodeBlockLanguageSelectorItem, type CodeBlockLanguageSelectorItemProps, type CodeBlockLanguageSelectorProps, CodeBlockLanguageSelectorTrigger, type CodeBlockLanguageSelectorTriggerProps, CodeBlockLanguageSelectorValue, type CodeBlockLanguageSelectorValueProps, CodeBlockTitle, highlightCode };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CodeBlock, CodeBlockActions, CodeBlockContainer, CodeBlockContent, CodeBlockCopyButton, CodeBlockFilename, CodeBlockHeader, CodeBlockLanguageSelector, CodeBlockLanguageSelectorContent, CodeBlockLanguageSelectorItem, CodeBlockLanguageSelectorTrigger, CodeBlockLanguageSelectorValue, CodeBlockTitle, highlightCode } from '../../chunk-CFM57HOS.js';
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { Avatar } from '@chatsdk-dev/ui/components/avatar';
|
|
3
|
+
import { Button } from '@chatsdk-dev/ui/components/button';
|
|
4
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@chatsdk-dev/ui/components/collapsible';
|
|
5
|
+
import { FileIcon } from 'lucide-react';
|
|
6
|
+
import { ComponentProps, HTMLAttributes } from 'react';
|
|
7
|
+
|
|
8
|
+
type CommitProps = ComponentProps<typeof Collapsible>;
|
|
9
|
+
declare const Commit: ({ className, children, ...props }: CommitProps) => react_jsx_runtime.JSX.Element;
|
|
10
|
+
type CommitHeaderProps = ComponentProps<typeof CollapsibleTrigger>;
|
|
11
|
+
declare const CommitHeader: ({ className, children, ...props }: CommitHeaderProps) => react_jsx_runtime.JSX.Element;
|
|
12
|
+
type CommitHashProps = HTMLAttributes<HTMLSpanElement>;
|
|
13
|
+
declare const CommitHash: ({ className, children, ...props }: CommitHashProps) => react_jsx_runtime.JSX.Element;
|
|
14
|
+
type CommitMessageProps = HTMLAttributes<HTMLSpanElement>;
|
|
15
|
+
declare const CommitMessage: ({ className, children, ...props }: CommitMessageProps) => react_jsx_runtime.JSX.Element;
|
|
16
|
+
type CommitMetadataProps = HTMLAttributes<HTMLDivElement>;
|
|
17
|
+
declare const CommitMetadata: ({ className, children, ...props }: CommitMetadataProps) => react_jsx_runtime.JSX.Element;
|
|
18
|
+
type CommitSeparatorProps = HTMLAttributes<HTMLSpanElement>;
|
|
19
|
+
declare const CommitSeparator: ({ className, children, ...props }: CommitSeparatorProps) => react_jsx_runtime.JSX.Element;
|
|
20
|
+
type CommitInfoProps = HTMLAttributes<HTMLDivElement>;
|
|
21
|
+
declare const CommitInfo: ({ className, children, ...props }: CommitInfoProps) => react_jsx_runtime.JSX.Element;
|
|
22
|
+
type CommitAuthorProps = HTMLAttributes<HTMLDivElement>;
|
|
23
|
+
declare const CommitAuthor: ({ className, children, ...props }: CommitAuthorProps) => react_jsx_runtime.JSX.Element;
|
|
24
|
+
type CommitAuthorAvatarProps = ComponentProps<typeof Avatar> & {
|
|
25
|
+
initials: string;
|
|
26
|
+
};
|
|
27
|
+
declare const CommitAuthorAvatar: ({ initials, className, ...props }: CommitAuthorAvatarProps) => react_jsx_runtime.JSX.Element;
|
|
28
|
+
type CommitTimestampProps = HTMLAttributes<HTMLTimeElement> & {
|
|
29
|
+
date: Date;
|
|
30
|
+
};
|
|
31
|
+
declare const CommitTimestamp: ({ date, className, children, ...props }: CommitTimestampProps) => react_jsx_runtime.JSX.Element;
|
|
32
|
+
type CommitActionsProps = HTMLAttributes<HTMLDivElement>;
|
|
33
|
+
declare const CommitActions: ({ className, children, ...props }: CommitActionsProps) => react_jsx_runtime.JSX.Element;
|
|
34
|
+
type CommitCopyButtonProps = ComponentProps<typeof Button> & {
|
|
35
|
+
hash: string;
|
|
36
|
+
onCopy?: () => void;
|
|
37
|
+
onError?: (error: Error) => void;
|
|
38
|
+
timeout?: number;
|
|
39
|
+
};
|
|
40
|
+
declare const CommitCopyButton: ({ hash, onCopy, onError, timeout, children, className, ...props }: CommitCopyButtonProps) => react_jsx_runtime.JSX.Element;
|
|
41
|
+
type CommitContentProps = ComponentProps<typeof CollapsibleContent>;
|
|
42
|
+
declare const CommitContent: ({ className, children, ...props }: CommitContentProps) => react_jsx_runtime.JSX.Element;
|
|
43
|
+
type CommitFilesProps = HTMLAttributes<HTMLDivElement>;
|
|
44
|
+
declare const CommitFiles: ({ className, children, ...props }: CommitFilesProps) => react_jsx_runtime.JSX.Element;
|
|
45
|
+
type CommitFileProps = HTMLAttributes<HTMLDivElement>;
|
|
46
|
+
declare const CommitFile: ({ className, children, ...props }: CommitFileProps) => react_jsx_runtime.JSX.Element;
|
|
47
|
+
type CommitFileInfoProps = HTMLAttributes<HTMLDivElement>;
|
|
48
|
+
declare const CommitFileInfo: ({ className, children, ...props }: CommitFileInfoProps) => react_jsx_runtime.JSX.Element;
|
|
49
|
+
type CommitFileStatusProps = HTMLAttributes<HTMLSpanElement> & {
|
|
50
|
+
status: "added" | "modified" | "deleted" | "renamed";
|
|
51
|
+
};
|
|
52
|
+
declare const CommitFileStatus: ({ status, className, children, ...props }: CommitFileStatusProps) => react_jsx_runtime.JSX.Element;
|
|
53
|
+
type CommitFileIconProps = ComponentProps<typeof FileIcon>;
|
|
54
|
+
declare const CommitFileIcon: ({ className, ...props }: CommitFileIconProps) => react_jsx_runtime.JSX.Element;
|
|
55
|
+
type CommitFilePathProps = HTMLAttributes<HTMLSpanElement>;
|
|
56
|
+
declare const CommitFilePath: ({ className, children, ...props }: CommitFilePathProps) => react_jsx_runtime.JSX.Element;
|
|
57
|
+
type CommitFileChangesProps = HTMLAttributes<HTMLDivElement>;
|
|
58
|
+
declare const CommitFileChanges: ({ className, children, ...props }: CommitFileChangesProps) => react_jsx_runtime.JSX.Element;
|
|
59
|
+
type CommitFileAdditionsProps = HTMLAttributes<HTMLSpanElement> & {
|
|
60
|
+
count: number;
|
|
61
|
+
};
|
|
62
|
+
declare const CommitFileAdditions: ({ count, className, children, ...props }: CommitFileAdditionsProps) => react_jsx_runtime.JSX.Element | null;
|
|
63
|
+
type CommitFileDeletionsProps = HTMLAttributes<HTMLSpanElement> & {
|
|
64
|
+
count: number;
|
|
65
|
+
};
|
|
66
|
+
declare const CommitFileDeletions: ({ count, className, children, ...props }: CommitFileDeletionsProps) => react_jsx_runtime.JSX.Element | null;
|
|
67
|
+
|
|
68
|
+
export { Commit, CommitActions, type CommitActionsProps, CommitAuthor, CommitAuthorAvatar, type CommitAuthorAvatarProps, type CommitAuthorProps, CommitContent, type CommitContentProps, CommitCopyButton, type CommitCopyButtonProps, CommitFile, CommitFileAdditions, type CommitFileAdditionsProps, CommitFileChanges, type CommitFileChangesProps, CommitFileDeletions, type CommitFileDeletionsProps, CommitFileIcon, type CommitFileIconProps, CommitFileInfo, type CommitFileInfoProps, CommitFilePath, type CommitFilePathProps, type CommitFileProps, CommitFileStatus, type CommitFileStatusProps, CommitFiles, type CommitFilesProps, CommitHash, type CommitHashProps, CommitHeader, type CommitHeaderProps, CommitInfo, type CommitInfoProps, CommitMessage, type CommitMessageProps, CommitMetadata, type CommitMetadataProps, type CommitProps, CommitSeparator, type CommitSeparatorProps, CommitTimestamp, type CommitTimestampProps };
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import { Avatar, AvatarFallback } from '@chatsdk-dev/ui/components/avatar';
|
|
2
|
+
import { Button } from '@chatsdk-dev/ui/components/button';
|
|
3
|
+
import { Collapsible, CollapsibleTrigger, CollapsibleContent } from '@chatsdk-dev/ui/components/collapsible';
|
|
4
|
+
import { cn } from '@chatsdk-dev/ui/lib/utils';
|
|
5
|
+
import { GitCommitIcon, CheckIcon, CopyIcon, FileIcon, PlusIcon, MinusIcon } from 'lucide-react';
|
|
6
|
+
import { useState, useCallback, useEffect, useRef } from 'react';
|
|
7
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
|
+
|
|
9
|
+
var Commit = ({ className, children, ...props }) => /* @__PURE__ */ jsx(
|
|
10
|
+
Collapsible,
|
|
11
|
+
{
|
|
12
|
+
className: cn("rounded-lg border bg-background", className),
|
|
13
|
+
...props,
|
|
14
|
+
children
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
var CommitHeader = ({
|
|
18
|
+
className,
|
|
19
|
+
children,
|
|
20
|
+
...props
|
|
21
|
+
}) => /* @__PURE__ */ jsx(
|
|
22
|
+
CollapsibleTrigger,
|
|
23
|
+
{
|
|
24
|
+
render: () => /* @__PURE__ */ jsx(
|
|
25
|
+
"div",
|
|
26
|
+
{
|
|
27
|
+
className: cn(
|
|
28
|
+
"group flex cursor-pointer items-center justify-between gap-4 p-3 text-left transition-colors hover:opacity-80",
|
|
29
|
+
className
|
|
30
|
+
),
|
|
31
|
+
children
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
var CommitHash = ({
|
|
37
|
+
className,
|
|
38
|
+
children,
|
|
39
|
+
...props
|
|
40
|
+
}) => /* @__PURE__ */ jsxs("span", { className: cn("font-mono text-xs", className), ...props, children: [
|
|
41
|
+
/* @__PURE__ */ jsx(GitCommitIcon, { className: "mr-1 inline-block size-3" }),
|
|
42
|
+
children
|
|
43
|
+
] });
|
|
44
|
+
var CommitMessage = ({
|
|
45
|
+
className,
|
|
46
|
+
children,
|
|
47
|
+
...props
|
|
48
|
+
}) => /* @__PURE__ */ jsx("span", { className: cn("font-medium text-sm", className), ...props, children });
|
|
49
|
+
var CommitMetadata = ({
|
|
50
|
+
className,
|
|
51
|
+
children,
|
|
52
|
+
...props
|
|
53
|
+
}) => /* @__PURE__ */ jsx(
|
|
54
|
+
"div",
|
|
55
|
+
{
|
|
56
|
+
className: cn(
|
|
57
|
+
"flex items-center gap-2 text-muted-foreground text-xs",
|
|
58
|
+
className
|
|
59
|
+
),
|
|
60
|
+
...props,
|
|
61
|
+
children
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
var CommitSeparator = ({
|
|
65
|
+
className,
|
|
66
|
+
children,
|
|
67
|
+
...props
|
|
68
|
+
}) => /* @__PURE__ */ jsx("span", { className, ...props, children: children ?? "\u2022" });
|
|
69
|
+
var CommitInfo = ({
|
|
70
|
+
className,
|
|
71
|
+
children,
|
|
72
|
+
...props
|
|
73
|
+
}) => /* @__PURE__ */ jsx("div", { className: cn("flex flex-1 flex-col", className), ...props, children });
|
|
74
|
+
var CommitAuthor = ({
|
|
75
|
+
className,
|
|
76
|
+
children,
|
|
77
|
+
...props
|
|
78
|
+
}) => /* @__PURE__ */ jsx("div", { className: cn("flex items-center", className), ...props, children });
|
|
79
|
+
var CommitAuthorAvatar = ({
|
|
80
|
+
initials,
|
|
81
|
+
className,
|
|
82
|
+
...props
|
|
83
|
+
}) => /* @__PURE__ */ jsx(Avatar, { className: cn("size-8", className), ...props, children: /* @__PURE__ */ jsx(AvatarFallback, { className: "text-xs", children: initials }) });
|
|
84
|
+
var relativeTimeFormat = new Intl.RelativeTimeFormat("en", {
|
|
85
|
+
numeric: "auto"
|
|
86
|
+
});
|
|
87
|
+
var formatRelativeDate = (date) => {
|
|
88
|
+
const days = Math.round(
|
|
89
|
+
(date.getTime() - Date.now()) / (1e3 * 60 * 60 * 24)
|
|
90
|
+
);
|
|
91
|
+
return relativeTimeFormat.format(days, "day");
|
|
92
|
+
};
|
|
93
|
+
var CommitTimestamp = ({
|
|
94
|
+
date,
|
|
95
|
+
className,
|
|
96
|
+
children,
|
|
97
|
+
...props
|
|
98
|
+
}) => {
|
|
99
|
+
const [formatted, setFormatted] = useState("");
|
|
100
|
+
const updateFormatted = useCallback(() => {
|
|
101
|
+
setFormatted(formatRelativeDate(date));
|
|
102
|
+
}, [date]);
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
updateFormatted();
|
|
105
|
+
}, [updateFormatted]);
|
|
106
|
+
return /* @__PURE__ */ jsx(
|
|
107
|
+
"time",
|
|
108
|
+
{
|
|
109
|
+
className: cn("text-xs", className),
|
|
110
|
+
dateTime: date.toISOString(),
|
|
111
|
+
...props,
|
|
112
|
+
children: children ?? formatted
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
};
|
|
116
|
+
var handleActionsClick = (e) => e.stopPropagation();
|
|
117
|
+
var handleActionsKeyDown = (e) => e.stopPropagation();
|
|
118
|
+
var CommitActions = ({
|
|
119
|
+
className,
|
|
120
|
+
children,
|
|
121
|
+
...props
|
|
122
|
+
}) => /* @__PURE__ */ jsx(
|
|
123
|
+
"div",
|
|
124
|
+
{
|
|
125
|
+
className: cn("flex items-center gap-1", className),
|
|
126
|
+
onClick: handleActionsClick,
|
|
127
|
+
onKeyDown: handleActionsKeyDown,
|
|
128
|
+
role: "group",
|
|
129
|
+
...props,
|
|
130
|
+
children
|
|
131
|
+
}
|
|
132
|
+
);
|
|
133
|
+
var CommitCopyButton = ({
|
|
134
|
+
hash,
|
|
135
|
+
onCopy,
|
|
136
|
+
onError,
|
|
137
|
+
timeout = 2e3,
|
|
138
|
+
children,
|
|
139
|
+
className,
|
|
140
|
+
...props
|
|
141
|
+
}) => {
|
|
142
|
+
const [isCopied, setIsCopied] = useState(false);
|
|
143
|
+
const timeoutRef = useRef(0);
|
|
144
|
+
const copyToClipboard = useCallback(async () => {
|
|
145
|
+
if (typeof window === "undefined" || !navigator?.clipboard?.writeText) {
|
|
146
|
+
onError?.(new Error("Clipboard API not available"));
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
try {
|
|
150
|
+
if (!isCopied) {
|
|
151
|
+
await navigator.clipboard.writeText(hash);
|
|
152
|
+
setIsCopied(true);
|
|
153
|
+
onCopy?.();
|
|
154
|
+
timeoutRef.current = window.setTimeout(
|
|
155
|
+
() => setIsCopied(false),
|
|
156
|
+
timeout
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
} catch (error) {
|
|
160
|
+
onError?.(error);
|
|
161
|
+
}
|
|
162
|
+
}, [hash, onCopy, onError, timeout, isCopied]);
|
|
163
|
+
useEffect(
|
|
164
|
+
() => () => {
|
|
165
|
+
window.clearTimeout(timeoutRef.current);
|
|
166
|
+
},
|
|
167
|
+
[]
|
|
168
|
+
);
|
|
169
|
+
const Icon = isCopied ? CheckIcon : CopyIcon;
|
|
170
|
+
return /* @__PURE__ */ jsx(
|
|
171
|
+
Button,
|
|
172
|
+
{
|
|
173
|
+
className: cn("size-7 shrink-0", className),
|
|
174
|
+
onClick: copyToClipboard,
|
|
175
|
+
size: "icon",
|
|
176
|
+
variant: "ghost",
|
|
177
|
+
...props,
|
|
178
|
+
children: children ?? /* @__PURE__ */ jsx(Icon, { size: 14 })
|
|
179
|
+
}
|
|
180
|
+
);
|
|
181
|
+
};
|
|
182
|
+
var CommitContent = ({
|
|
183
|
+
className,
|
|
184
|
+
children,
|
|
185
|
+
...props
|
|
186
|
+
}) => /* @__PURE__ */ jsx(CollapsibleContent, { className: cn("border-t p-3", className), ...props, children });
|
|
187
|
+
var CommitFiles = ({
|
|
188
|
+
className,
|
|
189
|
+
children,
|
|
190
|
+
...props
|
|
191
|
+
}) => /* @__PURE__ */ jsx("div", { className: cn("space-y-1", className), ...props, children });
|
|
192
|
+
var CommitFile = ({
|
|
193
|
+
className,
|
|
194
|
+
children,
|
|
195
|
+
...props
|
|
196
|
+
}) => /* @__PURE__ */ jsx(
|
|
197
|
+
"div",
|
|
198
|
+
{
|
|
199
|
+
className: cn(
|
|
200
|
+
"flex items-center justify-between gap-2 rounded px-2 py-1 text-sm hover:bg-muted/50",
|
|
201
|
+
className
|
|
202
|
+
),
|
|
203
|
+
...props,
|
|
204
|
+
children
|
|
205
|
+
}
|
|
206
|
+
);
|
|
207
|
+
var CommitFileInfo = ({
|
|
208
|
+
className,
|
|
209
|
+
children,
|
|
210
|
+
...props
|
|
211
|
+
}) => /* @__PURE__ */ jsx("div", { className: cn("flex min-w-0 items-center gap-2", className), ...props, children });
|
|
212
|
+
var fileStatusStyles = {
|
|
213
|
+
added: "text-green-600 dark:text-green-400",
|
|
214
|
+
deleted: "text-red-600 dark:text-red-400",
|
|
215
|
+
modified: "text-yellow-600 dark:text-yellow-400",
|
|
216
|
+
renamed: "text-blue-600 dark:text-blue-400"
|
|
217
|
+
};
|
|
218
|
+
var fileStatusLabels = {
|
|
219
|
+
added: "A",
|
|
220
|
+
deleted: "D",
|
|
221
|
+
modified: "M",
|
|
222
|
+
renamed: "R"
|
|
223
|
+
};
|
|
224
|
+
var CommitFileStatus = ({
|
|
225
|
+
status,
|
|
226
|
+
className,
|
|
227
|
+
children,
|
|
228
|
+
...props
|
|
229
|
+
}) => /* @__PURE__ */ jsx(
|
|
230
|
+
"span",
|
|
231
|
+
{
|
|
232
|
+
className: cn(
|
|
233
|
+
"font-medium font-mono text-xs",
|
|
234
|
+
fileStatusStyles[status],
|
|
235
|
+
className
|
|
236
|
+
),
|
|
237
|
+
...props,
|
|
238
|
+
children: children ?? fileStatusLabels[status]
|
|
239
|
+
}
|
|
240
|
+
);
|
|
241
|
+
var CommitFileIcon = ({
|
|
242
|
+
className,
|
|
243
|
+
...props
|
|
244
|
+
}) => /* @__PURE__ */ jsx(
|
|
245
|
+
FileIcon,
|
|
246
|
+
{
|
|
247
|
+
className: cn("size-3.5 shrink-0 text-muted-foreground", className),
|
|
248
|
+
...props
|
|
249
|
+
}
|
|
250
|
+
);
|
|
251
|
+
var CommitFilePath = ({
|
|
252
|
+
className,
|
|
253
|
+
children,
|
|
254
|
+
...props
|
|
255
|
+
}) => /* @__PURE__ */ jsx("span", { className: cn("truncate font-mono text-xs", className), ...props, children });
|
|
256
|
+
var CommitFileChanges = ({
|
|
257
|
+
className,
|
|
258
|
+
children,
|
|
259
|
+
...props
|
|
260
|
+
}) => /* @__PURE__ */ jsx(
|
|
261
|
+
"div",
|
|
262
|
+
{
|
|
263
|
+
className: cn(
|
|
264
|
+
"flex shrink-0 items-center gap-1 font-mono text-xs",
|
|
265
|
+
className
|
|
266
|
+
),
|
|
267
|
+
...props,
|
|
268
|
+
children
|
|
269
|
+
}
|
|
270
|
+
);
|
|
271
|
+
var CommitFileAdditions = ({
|
|
272
|
+
count,
|
|
273
|
+
className,
|
|
274
|
+
children,
|
|
275
|
+
...props
|
|
276
|
+
}) => {
|
|
277
|
+
if (count <= 0) {
|
|
278
|
+
return null;
|
|
279
|
+
}
|
|
280
|
+
return /* @__PURE__ */ jsx(
|
|
281
|
+
"span",
|
|
282
|
+
{
|
|
283
|
+
className: cn("text-green-600 dark:text-green-400", className),
|
|
284
|
+
...props,
|
|
285
|
+
children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
286
|
+
/* @__PURE__ */ jsx(PlusIcon, { className: "inline-block size-3" }),
|
|
287
|
+
count
|
|
288
|
+
] })
|
|
289
|
+
}
|
|
290
|
+
);
|
|
291
|
+
};
|
|
292
|
+
var CommitFileDeletions = ({
|
|
293
|
+
count,
|
|
294
|
+
className,
|
|
295
|
+
children,
|
|
296
|
+
...props
|
|
297
|
+
}) => {
|
|
298
|
+
if (count <= 0) {
|
|
299
|
+
return null;
|
|
300
|
+
}
|
|
301
|
+
return /* @__PURE__ */ jsx(
|
|
302
|
+
"span",
|
|
303
|
+
{
|
|
304
|
+
className: cn("text-red-600 dark:text-red-400", className),
|
|
305
|
+
...props,
|
|
306
|
+
children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
307
|
+
/* @__PURE__ */ jsx(MinusIcon, { className: "inline-block size-3" }),
|
|
308
|
+
count
|
|
309
|
+
] })
|
|
310
|
+
}
|
|
311
|
+
);
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
export { Commit, CommitActions, CommitAuthor, CommitAuthorAvatar, CommitContent, CommitCopyButton, CommitFile, CommitFileAdditions, CommitFileChanges, CommitFileDeletions, CommitFileIcon, CommitFileInfo, CommitFilePath, CommitFileStatus, CommitFiles, CommitHash, CommitHeader, CommitInfo, CommitMessage, CommitMetadata, CommitSeparator, CommitTimestamp };
|