@applica-software-guru/persona-sdk 0.1.79 → 0.1.82
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/components.json +5 -2
- package/dist/bundle.cjs.js +23 -19
- package/dist/bundle.cjs.js.map +1 -1
- package/dist/bundle.es.js +7132 -3178
- package/dist/bundle.es.js.map +1 -1
- package/dist/bundle.iife.js +23 -19
- package/dist/bundle.iife.js.map +1 -1
- package/dist/bundle.umd.js +23 -19
- package/dist/bundle.umd.js.map +1 -1
- package/dist/messages.d.ts.map +1 -1
- package/package.json +8 -9
- package/playground/src/components/assistant-ui/attachment.tsx +72 -89
- package/playground/src/components/assistant-ui/markdown-text.tsx +139 -34
- package/playground/src/components/assistant-ui/thread.tsx +238 -235
- package/playground/src/components/assistant-ui/tool-fallback.tsx +79 -19
- package/playground/src/components/assistant-ui/tooltip-icon-button.tsx +35 -31
- package/playground/src/components/ui/avatar.tsx +46 -30
- package/playground/src/components/ui/button.tsx +45 -28
- package/playground/src/components/ui/dialog.tsx +13 -5
- package/playground/src/components/ui/tooltip.tsx +54 -25
- package/src/messages.ts +13 -5
package/dist/messages.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAmB,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAEzE,iBAAS,mBAAmB,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,cAAc,EAAE,CAOzE;AACD,iBAAS,aAAa,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAmB,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAEzE,iBAAS,mBAAmB,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,cAAc,EAAE,CAOzE;AACD,iBAAS,aAAa,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,cAAc,EAAE,CAmDnE;AAED,iBAAS,cAAc,CAAC,OAAO,EAAE,cAAc,GAAG,iBAAiB,CAkClE;AAED,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,mBAAmB,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applica-software-guru/persona-sdk",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.82",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vite",
|
|
@@ -12,10 +12,9 @@
|
|
|
12
12
|
"format": "prettier --write ."
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@assistant-ui/react": "^0.
|
|
16
|
-
"@
|
|
17
|
-
"@radix-ui/react-
|
|
18
|
-
"@radix-ui/react-tooltip": "^1.2.4",
|
|
15
|
+
"@assistant-ui/react-markdown": "^0.11.6",
|
|
16
|
+
"@radix-ui/react-avatar": "^1.1.11",
|
|
17
|
+
"@radix-ui/react-tooltip": "^1.2.8",
|
|
19
18
|
"@tailwindcss/vite": "^4.0.17",
|
|
20
19
|
"@types/inflection": "^1.13.2",
|
|
21
20
|
"@types/lodash": "^4.17.15",
|
|
@@ -58,7 +57,6 @@
|
|
|
58
57
|
"vitest": "^1.6.0"
|
|
59
58
|
},
|
|
60
59
|
"peerDependencies": {
|
|
61
|
-
"@assistant-ui/react": "^0.8.17",
|
|
62
60
|
"react": "^18 || ^19 || ^19.0.0-rc"
|
|
63
61
|
},
|
|
64
62
|
"keywords": [
|
|
@@ -69,9 +67,10 @@
|
|
|
69
67
|
"types": "dist/index.d.ts",
|
|
70
68
|
"typings": "dist/index.d.ts",
|
|
71
69
|
"dependencies": {
|
|
72
|
-
"@
|
|
73
|
-
"@radix-ui/react-
|
|
70
|
+
"@assistant-ui/react": "^0.11.47",
|
|
71
|
+
"@radix-ui/react-dialog": "^1.1.15",
|
|
72
|
+
"@radix-ui/react-slot": "^1.2.4",
|
|
74
73
|
"rehype-raw": "^7.0.0",
|
|
75
|
-
"zustand": "^5.0.
|
|
74
|
+
"zustand": "^5.0.9"
|
|
76
75
|
}
|
|
77
76
|
}
|
|
@@ -1,29 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { PropsWithChildren, useEffect, useState, type FC } from
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} from
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
Tooltip,
|
|
14
|
-
TooltipContent,
|
|
15
|
-
TooltipTrigger,
|
|
16
|
-
} from "@/components/ui/tooltip";
|
|
17
|
-
import {
|
|
18
|
-
Dialog,
|
|
19
|
-
DialogTitle,
|
|
20
|
-
DialogTrigger,
|
|
21
|
-
DialogOverlay,
|
|
22
|
-
DialogPortal,
|
|
23
|
-
} from "@/components/ui/dialog";
|
|
24
|
-
import { Avatar, AvatarImage, AvatarFallback } from "@/components/ui/avatar";
|
|
25
|
-
import { TooltipIconButton } from "@/components/assistant-ui/tooltip-icon-button";
|
|
26
|
-
import { DialogContent as DialogPrimitiveContent } from "@radix-ui/react-dialog";
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { PropsWithChildren, useEffect, useState, type FC } from 'react';
|
|
4
|
+
import { XIcon, PlusIcon, FileText } from 'lucide-react';
|
|
5
|
+
import { AttachmentPrimitive, ComposerPrimitive, MessagePrimitive, useAssistantState, useAssistantApi } from '@assistant-ui/react';
|
|
6
|
+
import { useShallow } from 'zustand/shallow';
|
|
7
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
|
|
8
|
+
import { Dialog, DialogTitle, DialogContent, DialogTrigger } from '@/components/ui/dialog';
|
|
9
|
+
import { Avatar, AvatarImage, AvatarFallback } from '@/components/ui/avatar';
|
|
10
|
+
import { TooltipIconButton } from '@/components/assistant-ui/tooltip-icon-button';
|
|
11
|
+
import { cn } from '@/lib/utils';
|
|
27
12
|
|
|
28
13
|
const useFileSrc = (file: File | undefined) => {
|
|
29
14
|
const [src, setSrc] = useState<string | undefined>(undefined);
|
|
@@ -46,11 +31,11 @@ const useFileSrc = (file: File | undefined) => {
|
|
|
46
31
|
};
|
|
47
32
|
|
|
48
33
|
const useAttachmentSrc = () => {
|
|
49
|
-
const { file, src } =
|
|
50
|
-
useShallow((
|
|
51
|
-
if (
|
|
52
|
-
if (
|
|
53
|
-
const src =
|
|
34
|
+
const { file, src } = useAssistantState(
|
|
35
|
+
useShallow(({ attachment }): { file?: File; src?: string } => {
|
|
36
|
+
if (attachment.type !== 'image') return {};
|
|
37
|
+
if (attachment.file) return { file: attachment.file };
|
|
38
|
+
const src = attachment.content?.filter((c) => c.type === 'image')[0]?.image;
|
|
54
39
|
if (!src) return {};
|
|
55
40
|
return { src };
|
|
56
41
|
}),
|
|
@@ -65,21 +50,18 @@ type AttachmentPreviewProps = {
|
|
|
65
50
|
|
|
66
51
|
const AttachmentPreview: FC<AttachmentPreviewProps> = ({ src }) => {
|
|
67
52
|
const [isLoaded, setIsLoaded] = useState(false);
|
|
68
|
-
|
|
69
53
|
return (
|
|
70
|
-
// eslint-disable-next-line @next/next/no-img-element
|
|
71
54
|
<img
|
|
72
55
|
src={src}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
56
|
+
alt="Image Preview"
|
|
57
|
+
width={1}
|
|
58
|
+
height={1}
|
|
59
|
+
className={
|
|
60
|
+
isLoaded
|
|
61
|
+
? 'aui-attachment-preview-image-loaded block h-auto max-h-[80vh] w-auto max-w-full object-contain'
|
|
62
|
+
: 'aui-attachment-preview-image-loading hidden'
|
|
63
|
+
}
|
|
81
64
|
onLoad={() => setIsLoaded(true)}
|
|
82
|
-
alt="Preview"
|
|
83
65
|
/>
|
|
84
66
|
);
|
|
85
67
|
};
|
|
@@ -91,65 +73,74 @@ const AttachmentPreviewDialog: FC<PropsWithChildren> = ({ children }) => {
|
|
|
91
73
|
|
|
92
74
|
return (
|
|
93
75
|
<Dialog>
|
|
94
|
-
<DialogTrigger className="
|
|
76
|
+
<DialogTrigger className="aui-attachment-preview-trigger cursor-pointer transition-colors hover:bg-accent/50" asChild>
|
|
95
77
|
{children}
|
|
96
78
|
</DialogTrigger>
|
|
97
|
-
<
|
|
98
|
-
<DialogTitle className="aui-sr-only">
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
</
|
|
79
|
+
<DialogContent className="aui-attachment-preview-dialog-content p-2 sm:max-w-3xl [&>button]:rounded-full [&>button]:bg-foreground/60 [&>button]:p-1 [&>button]:opacity-100 [&>button]:ring-0! [&_svg]:text-background [&>button]:hover:[&_svg]:text-destructive">
|
|
80
|
+
<DialogTitle className="aui-sr-only sr-only">Image Attachment Preview</DialogTitle>
|
|
81
|
+
<div className="aui-attachment-preview relative mx-auto flex max-h-[80dvh] w-full items-center justify-center overflow-hidden bg-background">
|
|
82
|
+
<AttachmentPreview src={src} />
|
|
83
|
+
</div>
|
|
84
|
+
</DialogContent>
|
|
103
85
|
</Dialog>
|
|
104
86
|
);
|
|
105
87
|
};
|
|
106
88
|
|
|
107
89
|
const AttachmentThumb: FC = () => {
|
|
108
|
-
const isImage =
|
|
90
|
+
const isImage = useAssistantState(({ attachment }) => attachment.type === 'image');
|
|
109
91
|
const src = useAttachmentSrc();
|
|
92
|
+
|
|
110
93
|
return (
|
|
111
|
-
<Avatar className="
|
|
94
|
+
<Avatar className="aui-attachment-tile-avatar h-full w-full rounded-none">
|
|
95
|
+
<AvatarImage src={src} alt="Attachment preview" className="aui-attachment-tile-image object-cover" />
|
|
112
96
|
<AvatarFallback delayMs={isImage ? 200 : 0}>
|
|
113
|
-
<
|
|
97
|
+
<FileText className="aui-attachment-tile-fallback-icon size-8 text-muted-foreground" />
|
|
114
98
|
</AvatarFallback>
|
|
115
|
-
<AvatarImage src={src} />
|
|
116
99
|
</Avatar>
|
|
117
100
|
);
|
|
118
101
|
};
|
|
119
102
|
|
|
120
103
|
const AttachmentUI: FC = () => {
|
|
121
|
-
const
|
|
122
|
-
const
|
|
123
|
-
|
|
104
|
+
const api = useAssistantApi();
|
|
105
|
+
const isComposer = api.attachment.source === 'composer';
|
|
106
|
+
|
|
107
|
+
const isImage = useAssistantState(({ attachment }) => attachment.type === 'image');
|
|
108
|
+
const typeLabel = useAssistantState(({ attachment }) => {
|
|
109
|
+
const type = attachment.type;
|
|
124
110
|
switch (type) {
|
|
125
|
-
case
|
|
126
|
-
return
|
|
127
|
-
case
|
|
128
|
-
return
|
|
129
|
-
case
|
|
130
|
-
return
|
|
111
|
+
case 'image':
|
|
112
|
+
return 'Image';
|
|
113
|
+
case 'document':
|
|
114
|
+
return 'Document';
|
|
115
|
+
case 'file':
|
|
116
|
+
return 'File';
|
|
131
117
|
default:
|
|
132
118
|
const _exhaustiveCheck: never = type;
|
|
133
119
|
throw new Error(`Unknown attachment type: ${_exhaustiveCheck}`);
|
|
134
120
|
}
|
|
135
121
|
});
|
|
122
|
+
|
|
136
123
|
return (
|
|
137
124
|
<Tooltip>
|
|
138
|
-
<AttachmentPrimitive.Root
|
|
125
|
+
<AttachmentPrimitive.Root
|
|
126
|
+
className={cn('aui-attachment-root relative', isImage && 'aui-attachment-root-composer only:[&>#attachment-tile]:size-24')}
|
|
127
|
+
>
|
|
139
128
|
<AttachmentPreviewDialog>
|
|
140
129
|
<TooltipTrigger asChild>
|
|
141
|
-
<div
|
|
130
|
+
<div
|
|
131
|
+
className={cn(
|
|
132
|
+
'aui-attachment-tile size-14 cursor-pointer overflow-hidden rounded-[14px] border bg-muted transition-opacity hover:opacity-75',
|
|
133
|
+
isComposer && 'aui-attachment-tile-composer border-foreground/20',
|
|
134
|
+
)}
|
|
135
|
+
role="button"
|
|
136
|
+
id="attachment-tile"
|
|
137
|
+
aria-label={`${typeLabel} attachment`}
|
|
138
|
+
>
|
|
142
139
|
<AttachmentThumb />
|
|
143
|
-
<div className="flex-grow basis-0">
|
|
144
|
-
<p className="text-muted-foreground line-clamp-1 text-ellipsis break-all text-xs font-bold">
|
|
145
|
-
<AttachmentPrimitive.Name />
|
|
146
|
-
</p>
|
|
147
|
-
<p className="text-muted-foreground text-xs">{typeLabel}</p>
|
|
148
|
-
</div>
|
|
149
140
|
</div>
|
|
150
141
|
</TooltipTrigger>
|
|
151
142
|
</AttachmentPreviewDialog>
|
|
152
|
-
{
|
|
143
|
+
{isComposer && <AttachmentRemove />}
|
|
153
144
|
</AttachmentPrimitive.Root>
|
|
154
145
|
<TooltipContent side="top">
|
|
155
146
|
<AttachmentPrimitive.Name />
|
|
@@ -163,10 +154,10 @@ const AttachmentRemove: FC = () => {
|
|
|
163
154
|
<AttachmentPrimitive.Remove asChild>
|
|
164
155
|
<TooltipIconButton
|
|
165
156
|
tooltip="Remove file"
|
|
166
|
-
className="
|
|
157
|
+
className="aui-attachment-tile-remove absolute top-1.5 right-1.5 size-3.5 rounded-full bg-white text-muted-foreground opacity-100 shadow-sm hover:bg-white! [&_svg]:text-black hover:[&_svg]:text-destructive"
|
|
167
158
|
side="top"
|
|
168
159
|
>
|
|
169
|
-
<
|
|
160
|
+
<XIcon className="aui-attachment-remove-icon size-3 dark:stroke-[2.5px]" />
|
|
170
161
|
</TooltipIconButton>
|
|
171
162
|
</AttachmentPrimitive.Remove>
|
|
172
163
|
);
|
|
@@ -174,7 +165,7 @@ const AttachmentRemove: FC = () => {
|
|
|
174
165
|
|
|
175
166
|
export const UserMessageAttachments: FC = () => {
|
|
176
167
|
return (
|
|
177
|
-
<div className="
|
|
168
|
+
<div className="aui-user-message-attachments-end col-span-full col-start-1 row-start-1 flex w-full flex-row justify-end gap-2">
|
|
178
169
|
<MessagePrimitive.Attachments components={{ Attachment: AttachmentUI }} />
|
|
179
170
|
</div>
|
|
180
171
|
);
|
|
@@ -182,10 +173,8 @@ export const UserMessageAttachments: FC = () => {
|
|
|
182
173
|
|
|
183
174
|
export const ComposerAttachments: FC = () => {
|
|
184
175
|
return (
|
|
185
|
-
<div className="flex w-full flex-row gap-
|
|
186
|
-
<ComposerPrimitive.Attachments
|
|
187
|
-
components={{ Attachment: AttachmentUI }}
|
|
188
|
-
/>
|
|
176
|
+
<div className="aui-composer-attachments mb-2 flex w-full flex-row items-center gap-2 overflow-x-auto px-1.5 pt-0.5 pb-1 empty:hidden">
|
|
177
|
+
<ComposerPrimitive.Attachments components={{ Attachment: AttachmentUI }} />
|
|
189
178
|
</div>
|
|
190
179
|
);
|
|
191
180
|
};
|
|
@@ -194,21 +183,15 @@ export const ComposerAddAttachment: FC = () => {
|
|
|
194
183
|
return (
|
|
195
184
|
<ComposerPrimitive.AddAttachment asChild>
|
|
196
185
|
<TooltipIconButton
|
|
197
|
-
className="my-2.5 size-8 p-2 transition-opacity ease-in"
|
|
198
186
|
tooltip="Add Attachment"
|
|
187
|
+
side="bottom"
|
|
199
188
|
variant="ghost"
|
|
189
|
+
size="icon"
|
|
190
|
+
className="aui-composer-add-attachment size-[34px] rounded-full p-1 font-semibold text-xs hover:bg-muted-foreground/15 dark:border-muted-foreground/15 dark:hover:bg-muted-foreground/30"
|
|
191
|
+
aria-label="Add Attachment"
|
|
200
192
|
>
|
|
201
|
-
<
|
|
193
|
+
<PlusIcon className="aui-attachment-add-icon size-5 stroke-[1.5px]" />
|
|
202
194
|
</TooltipIconButton>
|
|
203
195
|
</ComposerPrimitive.AddAttachment>
|
|
204
196
|
);
|
|
205
197
|
};
|
|
206
|
-
|
|
207
|
-
const AttachmentDialogContent: FC<PropsWithChildren> = ({ children }) => (
|
|
208
|
-
<DialogPortal>
|
|
209
|
-
<DialogOverlay />
|
|
210
|
-
<DialogPrimitiveContent className="aui-dialog-content">
|
|
211
|
-
{children}
|
|
212
|
-
</DialogPrimitiveContent>
|
|
213
|
-
</DialogPortal>
|
|
214
|
-
);
|
|
@@ -1,25 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import "@assistant-ui/react-markdown/styles/dot.css";
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
|
-
CodeHeaderProps,
|
|
6
|
+
type CodeHeaderProps,
|
|
7
7
|
MarkdownTextPrimitive,
|
|
8
8
|
unstable_memoizeMarkdownComponents as memoizeMarkdownComponents,
|
|
9
9
|
useIsMarkdownCodeBlock,
|
|
10
|
-
} from
|
|
11
|
-
import remarkGfm from
|
|
12
|
-
import { FC, memo, useState } from
|
|
13
|
-
import { CheckIcon, CopyIcon } from
|
|
10
|
+
} from "@assistant-ui/react-markdown";
|
|
11
|
+
import remarkGfm from "remark-gfm";
|
|
12
|
+
import { type FC, memo, useState } from "react";
|
|
13
|
+
import { CheckIcon, CopyIcon } from "lucide-react";
|
|
14
14
|
|
|
15
|
-
import { TooltipIconButton } from
|
|
16
|
-
import { cn } from
|
|
15
|
+
import { TooltipIconButton } from "@/components/assistant-ui/tooltip-icon-button";
|
|
16
|
+
import { cn } from "@/lib/utils";
|
|
17
17
|
|
|
18
18
|
const MarkdownTextImpl = () => {
|
|
19
19
|
return (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
<MarkdownTextPrimitive
|
|
21
|
+
remarkPlugins={[remarkGfm]}
|
|
22
|
+
className="aui-md"
|
|
23
|
+
components={defaultComponents}
|
|
24
|
+
/>
|
|
23
25
|
);
|
|
24
26
|
};
|
|
25
27
|
|
|
@@ -33,8 +35,10 @@ const CodeHeader: FC<CodeHeaderProps> = ({ language, code }) => {
|
|
|
33
35
|
};
|
|
34
36
|
|
|
35
37
|
return (
|
|
36
|
-
<div className="flex items-center justify-between gap-4 rounded-t-lg bg-
|
|
37
|
-
<span className="lowercase [&>span]:text-xs">
|
|
38
|
+
<div className="aui-code-header-root mt-4 flex items-center justify-between gap-4 rounded-t-lg bg-muted-foreground/15 px-4 py-2 font-semibold text-foreground text-sm dark:bg-muted-foreground/20">
|
|
39
|
+
<span className="aui-code-header-language lowercase [&>span]:text-xs">
|
|
40
|
+
{language}
|
|
41
|
+
</span>
|
|
38
42
|
<TooltipIconButton tooltip="Copy" onClick={onCopy}>
|
|
39
43
|
{!isCopied && <CopyIcon />}
|
|
40
44
|
{isCopied && <CheckIcon />}
|
|
@@ -64,32 +68,111 @@ const useCopyToClipboard = ({
|
|
|
64
68
|
|
|
65
69
|
const defaultComponents = memoizeMarkdownComponents({
|
|
66
70
|
h1: ({ className, ...props }) => (
|
|
67
|
-
<h1
|
|
71
|
+
<h1
|
|
72
|
+
className={cn(
|
|
73
|
+
"aui-md-h1 mb-8 scroll-m-20 font-extrabold text-4xl tracking-tight last:mb-0",
|
|
74
|
+
className,
|
|
75
|
+
)}
|
|
76
|
+
{...props}
|
|
77
|
+
/>
|
|
68
78
|
),
|
|
69
79
|
h2: ({ className, ...props }) => (
|
|
70
|
-
<h2
|
|
80
|
+
<h2
|
|
81
|
+
className={cn(
|
|
82
|
+
"aui-md-h2 mt-8 mb-4 scroll-m-20 font-semibold text-3xl tracking-tight first:mt-0 last:mb-0",
|
|
83
|
+
className,
|
|
84
|
+
)}
|
|
85
|
+
{...props}
|
|
86
|
+
/>
|
|
71
87
|
),
|
|
72
88
|
h3: ({ className, ...props }) => (
|
|
73
|
-
<h3
|
|
89
|
+
<h3
|
|
90
|
+
className={cn(
|
|
91
|
+
"aui-md-h3 mt-6 mb-4 scroll-m-20 font-semibold text-2xl tracking-tight first:mt-0 last:mb-0",
|
|
92
|
+
className,
|
|
93
|
+
)}
|
|
94
|
+
{...props}
|
|
95
|
+
/>
|
|
74
96
|
),
|
|
75
97
|
h4: ({ className, ...props }) => (
|
|
76
|
-
<h4
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
98
|
+
<h4
|
|
99
|
+
className={cn(
|
|
100
|
+
"aui-md-h4 mt-6 mb-4 scroll-m-20 font-semibold text-xl tracking-tight first:mt-0 last:mb-0",
|
|
101
|
+
className,
|
|
102
|
+
)}
|
|
103
|
+
{...props}
|
|
104
|
+
/>
|
|
105
|
+
),
|
|
106
|
+
h5: ({ className, ...props }) => (
|
|
107
|
+
<h5
|
|
108
|
+
className={cn(
|
|
109
|
+
"aui-md-h5 my-4 font-semibold text-lg first:mt-0 last:mb-0",
|
|
110
|
+
className,
|
|
111
|
+
)}
|
|
112
|
+
{...props}
|
|
113
|
+
/>
|
|
114
|
+
),
|
|
115
|
+
h6: ({ className, ...props }) => (
|
|
116
|
+
<h6
|
|
117
|
+
className={cn(
|
|
118
|
+
"aui-md-h6 my-4 font-semibold first:mt-0 last:mb-0",
|
|
119
|
+
className,
|
|
120
|
+
)}
|
|
121
|
+
{...props}
|
|
122
|
+
/>
|
|
123
|
+
),
|
|
124
|
+
p: ({ className, ...props }) => (
|
|
125
|
+
<p
|
|
126
|
+
className={cn(
|
|
127
|
+
"aui-md-p mt-5 mb-5 leading-7 first:mt-0 last:mb-0",
|
|
128
|
+
className,
|
|
129
|
+
)}
|
|
130
|
+
{...props}
|
|
131
|
+
/>
|
|
132
|
+
),
|
|
133
|
+
a: ({ className, ...props }) => (
|
|
134
|
+
<a
|
|
135
|
+
className={cn(
|
|
136
|
+
"aui-md-a font-medium text-primary underline underline-offset-4",
|
|
137
|
+
className,
|
|
138
|
+
)}
|
|
139
|
+
{...props}
|
|
140
|
+
/>
|
|
141
|
+
),
|
|
142
|
+
blockquote: ({ className, ...props }) => (
|
|
143
|
+
<blockquote
|
|
144
|
+
className={cn("aui-md-blockquote border-l-2 pl-6 italic", className)}
|
|
145
|
+
{...props}
|
|
146
|
+
/>
|
|
147
|
+
),
|
|
148
|
+
ul: ({ className, ...props }) => (
|
|
149
|
+
<ul
|
|
150
|
+
className={cn("aui-md-ul my-5 ml-6 list-disc [&>li]:mt-2", className)}
|
|
151
|
+
{...props}
|
|
152
|
+
/>
|
|
153
|
+
),
|
|
154
|
+
ol: ({ className, ...props }) => (
|
|
155
|
+
<ol
|
|
156
|
+
className={cn("aui-md-ol my-5 ml-6 list-decimal [&>li]:mt-2", className)}
|
|
157
|
+
{...props}
|
|
158
|
+
/>
|
|
159
|
+
),
|
|
160
|
+
hr: ({ className, ...props }) => (
|
|
161
|
+
<hr className={cn("aui-md-hr my-5 border-b", className)} {...props} />
|
|
162
|
+
),
|
|
86
163
|
table: ({ className, ...props }) => (
|
|
87
|
-
<table
|
|
164
|
+
<table
|
|
165
|
+
className={cn(
|
|
166
|
+
"aui-md-table my-5 w-full border-separate border-spacing-0 overflow-y-auto",
|
|
167
|
+
className,
|
|
168
|
+
)}
|
|
169
|
+
{...props}
|
|
170
|
+
/>
|
|
88
171
|
),
|
|
89
172
|
th: ({ className, ...props }) => (
|
|
90
173
|
<th
|
|
91
174
|
className={cn(
|
|
92
|
-
|
|
175
|
+
"aui-md-th bg-muted px-4 py-2 text-left font-bold first:rounded-tl-lg last:rounded-tr-lg [[align=center]]:text-center [[align=right]]:text-right",
|
|
93
176
|
className,
|
|
94
177
|
)}
|
|
95
178
|
{...props}
|
|
@@ -98,7 +181,7 @@ const defaultComponents = memoizeMarkdownComponents({
|
|
|
98
181
|
td: ({ className, ...props }) => (
|
|
99
182
|
<td
|
|
100
183
|
className={cn(
|
|
101
|
-
|
|
184
|
+
"aui-md-td border-b border-l px-4 py-2 text-left last:border-r [[align=center]]:text-center [[align=right]]:text-right",
|
|
102
185
|
className,
|
|
103
186
|
)}
|
|
104
187
|
{...props}
|
|
@@ -107,17 +190,39 @@ const defaultComponents = memoizeMarkdownComponents({
|
|
|
107
190
|
tr: ({ className, ...props }) => (
|
|
108
191
|
<tr
|
|
109
192
|
className={cn(
|
|
110
|
-
|
|
193
|
+
"aui-md-tr m-0 border-b p-0 first:border-t [&:last-child>td:first-child]:rounded-bl-lg [&:last-child>td:last-child]:rounded-br-lg",
|
|
194
|
+
className,
|
|
195
|
+
)}
|
|
196
|
+
{...props}
|
|
197
|
+
/>
|
|
198
|
+
),
|
|
199
|
+
sup: ({ className, ...props }) => (
|
|
200
|
+
<sup
|
|
201
|
+
className={cn("aui-md-sup [&>a]:text-xs [&>a]:no-underline", className)}
|
|
202
|
+
{...props}
|
|
203
|
+
/>
|
|
204
|
+
),
|
|
205
|
+
pre: ({ className, ...props }) => (
|
|
206
|
+
<pre
|
|
207
|
+
className={cn(
|
|
208
|
+
"aui-md-pre overflow-x-auto rounded-t-none! rounded-b-lg bg-black p-4 text-white",
|
|
111
209
|
className,
|
|
112
210
|
)}
|
|
113
211
|
{...props}
|
|
114
212
|
/>
|
|
115
213
|
),
|
|
116
|
-
sup: ({ className, ...props }) => <sup className={cn('[&>a]:text-xs [&>a]:no-underline', className)} {...props} />,
|
|
117
|
-
pre: ({ className, ...props }) => <pre className={cn('overflow-x-auto rounded-b-lg bg-black p-4 text-white', className)} {...props} />,
|
|
118
214
|
code: function Code({ className, ...props }) {
|
|
119
215
|
const isCodeBlock = useIsMarkdownCodeBlock();
|
|
120
|
-
return
|
|
216
|
+
return (
|
|
217
|
+
<code
|
|
218
|
+
className={cn(
|
|
219
|
+
!isCodeBlock &&
|
|
220
|
+
"aui-md-inline-code rounded border bg-muted font-semibold",
|
|
221
|
+
className,
|
|
222
|
+
)}
|
|
223
|
+
{...props}
|
|
224
|
+
/>
|
|
225
|
+
);
|
|
121
226
|
},
|
|
122
227
|
CodeHeader,
|
|
123
228
|
});
|