doclific 0.2.1 → 0.2.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/LICENSE +17 -0
- package/dist/bin/doclific.js +36 -8
- package/package.json +10 -3
- package/readme.md +77 -0
- package/.gitattributes +0 -2
- package/.prettierignore +0 -5
- package/.prettierrc +0 -9
- package/.vscode/settings.json +0 -13
- package/frontend/components.json +0 -24
- package/frontend/eslint.config.js +0 -23
- package/frontend/index.html +0 -25
- package/frontend/package-lock.json +0 -15754
- package/frontend/public/logo.svg +0 -1
- package/frontend/src/App.tsx +0 -21
- package/frontend/src/components/app-sidebar.tsx +0 -393
- package/frontend/src/components/editor/editor-base-kit.tsx +0 -43
- package/frontend/src/components/editor/editor-kit.tsx +0 -93
- package/frontend/src/components/editor/plugins/align-base-kit.tsx +0 -16
- package/frontend/src/components/editor/plugins/align-kit.tsx +0 -18
- package/frontend/src/components/editor/plugins/autoformat-kit.tsx +0 -236
- package/frontend/src/components/editor/plugins/basic-blocks-base-kit.tsx +0 -35
- package/frontend/src/components/editor/plugins/basic-blocks-kit.tsx +0 -88
- package/frontend/src/components/editor/plugins/basic-marks-base-kit.tsx +0 -27
- package/frontend/src/components/editor/plugins/basic-marks-kit.tsx +0 -41
- package/frontend/src/components/editor/plugins/basic-nodes-kit.tsx +0 -6
- package/frontend/src/components/editor/plugins/block-menu-kit.tsx +0 -14
- package/frontend/src/components/editor/plugins/block-placeholder-kit.tsx +0 -17
- package/frontend/src/components/editor/plugins/block-selection-kit.tsx +0 -32
- package/frontend/src/components/editor/plugins/callout-base-kit.tsx +0 -7
- package/frontend/src/components/editor/plugins/callout-kit.tsx +0 -7
- package/frontend/src/components/editor/plugins/code-block-base-kit.tsx +0 -23
- package/frontend/src/components/editor/plugins/code-block-kit.tsx +0 -26
- package/frontend/src/components/editor/plugins/codebase-kit.tsx +0 -23
- package/frontend/src/components/editor/plugins/column-base-kit.tsx +0 -11
- package/frontend/src/components/editor/plugins/column-kit.tsx +0 -10
- package/frontend/src/components/editor/plugins/comment-base-kit.tsx +0 -7
- package/frontend/src/components/editor/plugins/comment-kit.tsx +0 -97
- package/frontend/src/components/editor/plugins/cursor-overlay-kit.tsx +0 -13
- package/frontend/src/components/editor/plugins/date-base-kit.tsx +0 -5
- package/frontend/src/components/editor/plugins/date-kit.tsx +0 -7
- package/frontend/src/components/editor/plugins/discussion-kit.tsx +0 -148
- package/frontend/src/components/editor/plugins/dnd-kit.tsx +0 -28
- package/frontend/src/components/editor/plugins/docx-kit.tsx +0 -6
- package/frontend/src/components/editor/plugins/emoji-kit.tsx +0 -13
- package/frontend/src/components/editor/plugins/excalidraw-kit.tsx +0 -9
- package/frontend/src/components/editor/plugins/exit-break-kit.tsx +0 -12
- package/frontend/src/components/editor/plugins/floating-toolbar-kit.tsx +0 -19
- package/frontend/src/components/editor/plugins/font-base-kit.tsx +0 -20
- package/frontend/src/components/editor/plugins/font-kit.tsx +0 -29
- package/frontend/src/components/editor/plugins/indent-base-kit.tsx +0 -19
- package/frontend/src/components/editor/plugins/indent-kit.tsx +0 -22
- package/frontend/src/components/editor/plugins/line-height-base-kit.tsx +0 -14
- package/frontend/src/components/editor/plugins/line-height-kit.tsx +0 -16
- package/frontend/src/components/editor/plugins/link-base-kit.tsx +0 -5
- package/frontend/src/components/editor/plugins/link-kit.tsx +0 -15
- package/frontend/src/components/editor/plugins/list-base-kit.tsx +0 -23
- package/frontend/src/components/editor/plugins/list-kit.tsx +0 -26
- package/frontend/src/components/editor/plugins/markdown-kit.tsx +0 -46
- package/frontend/src/components/editor/plugins/math-base-kit.tsx +0 -11
- package/frontend/src/components/editor/plugins/math-kit.tsx +0 -13
- package/frontend/src/components/editor/plugins/media-base-kit.tsx +0 -31
- package/frontend/src/components/editor/plugins/media-kit.tsx +0 -43
- package/frontend/src/components/editor/plugins/mention-base-kit.tsx +0 -7
- package/frontend/src/components/editor/plugins/mention-kit.tsx +0 -15
- package/frontend/src/components/editor/plugins/slash-kit.tsx +0 -18
- package/frontend/src/components/editor/plugins/suggestion-base-kit.tsx +0 -7
- package/frontend/src/components/editor/plugins/suggestion-kit.tsx +0 -90
- package/frontend/src/components/editor/plugins/table-base-kit.tsx +0 -20
- package/frontend/src/components/editor/plugins/table-kit.tsx +0 -22
- package/frontend/src/components/editor/plugins/toc-base-kit.tsx +0 -5
- package/frontend/src/components/editor/plugins/toc-kit.tsx +0 -14
- package/frontend/src/components/editor/plugins/toggle-base-kit.tsx +0 -7
- package/frontend/src/components/editor/plugins/toggle-kit.tsx +0 -11
- package/frontend/src/components/editor/transforms.ts +0 -194
- package/frontend/src/components/markdown-to-slate-demo.tsx +0 -50
- package/frontend/src/components/mode-toggle.tsx +0 -15
- package/frontend/src/components/theme-provider.tsx +0 -73
- package/frontend/src/components/ui/alert-dialog.tsx +0 -155
- package/frontend/src/components/ui/align-toolbar-button.tsx +0 -84
- package/frontend/src/components/ui/avatar.tsx +0 -51
- package/frontend/src/components/ui/block-context-menu.tsx +0 -199
- package/frontend/src/components/ui/block-discussion.tsx +0 -365
- package/frontend/src/components/ui/block-draggable.tsx +0 -512
- package/frontend/src/components/ui/block-list-static.tsx +0 -80
- package/frontend/src/components/ui/block-list.tsx +0 -87
- package/frontend/src/components/ui/block-selection.tsx +0 -42
- package/frontend/src/components/ui/block-suggestion.tsx +0 -473
- package/frontend/src/components/ui/blockquote-node-static.tsx +0 -11
- package/frontend/src/components/ui/blockquote-node.tsx +0 -13
- package/frontend/src/components/ui/button.tsx +0 -62
- package/frontend/src/components/ui/calendar.tsx +0 -218
- package/frontend/src/components/ui/callout-node-static.tsx +0 -36
- package/frontend/src/components/ui/callout-node.tsx +0 -63
- package/frontend/src/components/ui/caption.tsx +0 -63
- package/frontend/src/components/ui/checkbox.tsx +0 -30
- package/frontend/src/components/ui/code-block-node-static.tsx +0 -35
- package/frontend/src/components/ui/code-block-node.tsx +0 -287
- package/frontend/src/components/ui/code-node-static.tsx +0 -15
- package/frontend/src/components/ui/code-node.tsx +0 -17
- package/frontend/src/components/ui/codebase-snippet-node.tsx +0 -237
- package/frontend/src/components/ui/column-node-static.tsx +0 -29
- package/frontend/src/components/ui/column-node.tsx +0 -317
- package/frontend/src/components/ui/command.tsx +0 -182
- package/frontend/src/components/ui/comment-node-static.tsx +0 -15
- package/frontend/src/components/ui/comment-node.tsx +0 -45
- package/frontend/src/components/ui/comment-toolbar-button.tsx +0 -24
- package/frontend/src/components/ui/comment.tsx +0 -618
- package/frontend/src/components/ui/context-menu.tsx +0 -250
- package/frontend/src/components/ui/cursor-overlay.tsx +0 -66
- package/frontend/src/components/ui/date-node-static.tsx +0 -45
- package/frontend/src/components/ui/date-node.tsx +0 -93
- package/frontend/src/components/ui/dialog.tsx +0 -143
- package/frontend/src/components/ui/dropdown-menu.tsx +0 -255
- package/frontend/src/components/ui/dynamic-icon.tsx +0 -12
- package/frontend/src/components/ui/editor-static.tsx +0 -53
- package/frontend/src/components/ui/editor.tsx +0 -130
- package/frontend/src/components/ui/emoji-node.tsx +0 -69
- package/frontend/src/components/ui/emoji-toolbar-button.tsx +0 -628
- package/frontend/src/components/ui/equation-node-static.tsx +0 -98
- package/frontend/src/components/ui/equation-node.tsx +0 -235
- package/frontend/src/components/ui/equation-toolbar-button.tsx +0 -25
- package/frontend/src/components/ui/excalidraw-node.tsx +0 -36
- package/frontend/src/components/ui/export-toolbar-button.tsx +0 -174
- package/frontend/src/components/ui/file-selector.tsx +0 -339
- package/frontend/src/components/ui/floating-toolbar-buttons.tsx +0 -73
- package/frontend/src/components/ui/floating-toolbar.tsx +0 -85
- package/frontend/src/components/ui/font-color-toolbar-button.tsx +0 -831
- package/frontend/src/components/ui/font-size-toolbar-button.tsx +0 -152
- package/frontend/src/components/ui/heading-node-static.tsx +0 -68
- package/frontend/src/components/ui/heading-node.tsx +0 -58
- package/frontend/src/components/ui/highlight-node-static.tsx +0 -11
- package/frontend/src/components/ui/highlight-node.tsx +0 -13
- package/frontend/src/components/ui/history-toolbar-button.tsx +0 -50
- package/frontend/src/components/ui/hr-node-static.tsx +0 -20
- package/frontend/src/components/ui/hr-node.tsx +0 -33
- package/frontend/src/components/ui/import-toolbar-button.tsx +0 -97
- package/frontend/src/components/ui/indent-toolbar-button.tsx +0 -30
- package/frontend/src/components/ui/inline-combobox.tsx +0 -414
- package/frontend/src/components/ui/input.tsx +0 -21
- package/frontend/src/components/ui/insert-toolbar-button.tsx +0 -254
- package/frontend/src/components/ui/kbd-node-static.tsx +0 -15
- package/frontend/src/components/ui/kbd-node.tsx +0 -17
- package/frontend/src/components/ui/layout-header.tsx +0 -35
- package/frontend/src/components/ui/line-height-toolbar-button.tsx +0 -68
- package/frontend/src/components/ui/link-node-static.tsx +0 -21
- package/frontend/src/components/ui/link-node.tsx +0 -39
- package/frontend/src/components/ui/link-toolbar-button.tsx +0 -22
- package/frontend/src/components/ui/link-toolbar.tsx +0 -206
- package/frontend/src/components/ui/list-toolbar-button.tsx +0 -204
- package/frontend/src/components/ui/mark-toolbar-button.tsx +0 -19
- package/frontend/src/components/ui/media-audio-node-static.tsx +0 -17
- package/frontend/src/components/ui/media-audio-node.tsx +0 -39
- package/frontend/src/components/ui/media-embed-node.tsx +0 -136
- package/frontend/src/components/ui/media-file-node-static.tsx +0 -29
- package/frontend/src/components/ui/media-file-node.tsx +0 -47
- package/frontend/src/components/ui/media-image-node-static.tsx +0 -39
- package/frontend/src/components/ui/media-image-node.tsx +0 -80
- package/frontend/src/components/ui/media-placeholder-node.tsx +0 -249
- package/frontend/src/components/ui/media-preview-dialog.tsx +0 -152
- package/frontend/src/components/ui/media-toolbar-button.tsx +0 -225
- package/frontend/src/components/ui/media-toolbar.tsx +0 -115
- package/frontend/src/components/ui/media-upload-toast.tsx +0 -66
- package/frontend/src/components/ui/media-video-node-static.tsx +0 -30
- package/frontend/src/components/ui/media-video-node.tsx +0 -121
- package/frontend/src/components/ui/mention-node-static.tsx +0 -36
- package/frontend/src/components/ui/mention-node.tsx +0 -194
- package/frontend/src/components/ui/mode-toolbar-button.tsx +0 -123
- package/frontend/src/components/ui/more-toolbar-button.tsx +0 -80
- package/frontend/src/components/ui/paragraph-node-static.tsx +0 -13
- package/frontend/src/components/ui/paragraph-node.tsx +0 -15
- package/frontend/src/components/ui/popover.tsx +0 -46
- package/frontend/src/components/ui/resize-handle.tsx +0 -87
- package/frontend/src/components/ui/separator.tsx +0 -28
- package/frontend/src/components/ui/sheet.tsx +0 -139
- package/frontend/src/components/ui/sidebar.tsx +0 -726
- package/frontend/src/components/ui/skeleton.tsx +0 -13
- package/frontend/src/components/ui/slash-node.tsx +0 -233
- package/frontend/src/components/ui/sonner.tsx +0 -38
- package/frontend/src/components/ui/suggestion-node-static.tsx +0 -35
- package/frontend/src/components/ui/suggestion-node.tsx +0 -162
- package/frontend/src/components/ui/suggestion-toolbar-button.tsx +0 -25
- package/frontend/src/components/ui/table-icons.tsx +0 -862
- package/frontend/src/components/ui/table-node-static.tsx +0 -98
- package/frontend/src/components/ui/table-node.tsx +0 -656
- package/frontend/src/components/ui/table-toolbar-button.tsx +0 -264
- package/frontend/src/components/ui/toc-node-static.tsx +0 -92
- package/frontend/src/components/ui/toc-node.tsx +0 -55
- package/frontend/src/components/ui/toggle-node-static.tsx +0 -18
- package/frontend/src/components/ui/toggle-node.tsx +0 -36
- package/frontend/src/components/ui/toggle-toolbar-button.tsx +0 -22
- package/frontend/src/components/ui/toolbar.tsx +0 -387
- package/frontend/src/components/ui/tooltip.tsx +0 -59
- package/frontend/src/components/ui/turn-into-toolbar-button.tsx +0 -188
- package/frontend/src/hooks/use-debounce.ts +0 -18
- package/frontend/src/hooks/use-is-touch-device.ts +0 -24
- package/frontend/src/hooks/use-mobile.ts +0 -19
- package/frontend/src/hooks/use-mounted.ts +0 -11
- package/frontend/src/hooks/use-upload-file.ts +0 -128
- package/frontend/src/index.css +0 -128
- package/frontend/src/layout.tsx +0 -42
- package/frontend/src/lib/markdown-joiner-transform.ts +0 -239
- package/frontend/src/lib/orpc.ts +0 -13
- package/frontend/src/lib/uploadthing.ts +0 -19
- package/frontend/src/lib/utils.ts +0 -6
- package/frontend/src/main.tsx +0 -13
- package/frontend/src/pages/editor.tsx +0 -44
- package/frontend/src/types/docs.d.ts +0 -6
- package/frontend/src/types/global.d.ts +0 -9
- package/frontend/src/types/router.d.ts +0 -4
- package/frontend/tsconfig.app.json +0 -33
- package/frontend/tsconfig.json +0 -10
- package/frontend/tsconfig.node.json +0 -26
- package/frontend/vite.config.ts +0 -14
- package/src/bin/doclific.ts +0 -47
- package/src/core/codebase.ts +0 -39
- package/src/core/docs.ts +0 -90
- package/src/core/git.ts +0 -48
- package/src/server/index.ts +0 -55
- package/src/server/router.ts +0 -65
- package/tsconfig.json +0 -15
|
@@ -1,255 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"
|
|
3
|
-
import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react"
|
|
4
|
-
|
|
5
|
-
import { cn } from "@/lib/utils"
|
|
6
|
-
|
|
7
|
-
function DropdownMenu({
|
|
8
|
-
...props
|
|
9
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {
|
|
10
|
-
return <DropdownMenuPrimitive.Root data-slot="dropdown-menu" {...props} />
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function DropdownMenuPortal({
|
|
14
|
-
...props
|
|
15
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) {
|
|
16
|
-
return (
|
|
17
|
-
<DropdownMenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />
|
|
18
|
-
)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function DropdownMenuTrigger({
|
|
22
|
-
...props
|
|
23
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {
|
|
24
|
-
return (
|
|
25
|
-
<DropdownMenuPrimitive.Trigger
|
|
26
|
-
data-slot="dropdown-menu-trigger"
|
|
27
|
-
{...props}
|
|
28
|
-
/>
|
|
29
|
-
)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function DropdownMenuContent({
|
|
33
|
-
className,
|
|
34
|
-
sideOffset = 4,
|
|
35
|
-
...props
|
|
36
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) {
|
|
37
|
-
return (
|
|
38
|
-
<DropdownMenuPrimitive.Portal>
|
|
39
|
-
<DropdownMenuPrimitive.Content
|
|
40
|
-
data-slot="dropdown-menu-content"
|
|
41
|
-
sideOffset={sideOffset}
|
|
42
|
-
className={cn(
|
|
43
|
-
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
|
|
44
|
-
className
|
|
45
|
-
)}
|
|
46
|
-
{...props}
|
|
47
|
-
/>
|
|
48
|
-
</DropdownMenuPrimitive.Portal>
|
|
49
|
-
)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function DropdownMenuGroup({
|
|
53
|
-
...props
|
|
54
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Group>) {
|
|
55
|
-
return (
|
|
56
|
-
<DropdownMenuPrimitive.Group data-slot="dropdown-menu-group" {...props} />
|
|
57
|
-
)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function DropdownMenuItem({
|
|
61
|
-
className,
|
|
62
|
-
inset,
|
|
63
|
-
variant = "default",
|
|
64
|
-
...props
|
|
65
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
|
|
66
|
-
inset?: boolean
|
|
67
|
-
variant?: "default" | "destructive"
|
|
68
|
-
}) {
|
|
69
|
-
return (
|
|
70
|
-
<DropdownMenuPrimitive.Item
|
|
71
|
-
data-slot="dropdown-menu-item"
|
|
72
|
-
data-inset={inset}
|
|
73
|
-
data-variant={variant}
|
|
74
|
-
className={cn(
|
|
75
|
-
"focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
76
|
-
className
|
|
77
|
-
)}
|
|
78
|
-
{...props}
|
|
79
|
-
/>
|
|
80
|
-
)
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function DropdownMenuCheckboxItem({
|
|
84
|
-
className,
|
|
85
|
-
children,
|
|
86
|
-
checked,
|
|
87
|
-
...props
|
|
88
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) {
|
|
89
|
-
return (
|
|
90
|
-
<DropdownMenuPrimitive.CheckboxItem
|
|
91
|
-
data-slot="dropdown-menu-checkbox-item"
|
|
92
|
-
className={cn(
|
|
93
|
-
"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
94
|
-
className
|
|
95
|
-
)}
|
|
96
|
-
checked={checked}
|
|
97
|
-
{...props}
|
|
98
|
-
>
|
|
99
|
-
<span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
|
|
100
|
-
<DropdownMenuPrimitive.ItemIndicator>
|
|
101
|
-
<CheckIcon className="size-4" />
|
|
102
|
-
</DropdownMenuPrimitive.ItemIndicator>
|
|
103
|
-
</span>
|
|
104
|
-
{children}
|
|
105
|
-
</DropdownMenuPrimitive.CheckboxItem>
|
|
106
|
-
)
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
function DropdownMenuRadioGroup({
|
|
110
|
-
...props
|
|
111
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {
|
|
112
|
-
return (
|
|
113
|
-
<DropdownMenuPrimitive.RadioGroup
|
|
114
|
-
data-slot="dropdown-menu-radio-group"
|
|
115
|
-
{...props}
|
|
116
|
-
/>
|
|
117
|
-
)
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function DropdownMenuRadioItem({
|
|
121
|
-
className,
|
|
122
|
-
children,
|
|
123
|
-
...props
|
|
124
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) {
|
|
125
|
-
return (
|
|
126
|
-
<DropdownMenuPrimitive.RadioItem
|
|
127
|
-
data-slot="dropdown-menu-radio-item"
|
|
128
|
-
className={cn(
|
|
129
|
-
"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
130
|
-
className
|
|
131
|
-
)}
|
|
132
|
-
{...props}
|
|
133
|
-
>
|
|
134
|
-
<span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
|
|
135
|
-
<DropdownMenuPrimitive.ItemIndicator>
|
|
136
|
-
<CircleIcon className="size-2 fill-current" />
|
|
137
|
-
</DropdownMenuPrimitive.ItemIndicator>
|
|
138
|
-
</span>
|
|
139
|
-
{children}
|
|
140
|
-
</DropdownMenuPrimitive.RadioItem>
|
|
141
|
-
)
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
function DropdownMenuLabel({
|
|
145
|
-
className,
|
|
146
|
-
inset,
|
|
147
|
-
...props
|
|
148
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
|
|
149
|
-
inset?: boolean
|
|
150
|
-
}) {
|
|
151
|
-
return (
|
|
152
|
-
<DropdownMenuPrimitive.Label
|
|
153
|
-
data-slot="dropdown-menu-label"
|
|
154
|
-
data-inset={inset}
|
|
155
|
-
className={cn(
|
|
156
|
-
"px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",
|
|
157
|
-
className
|
|
158
|
-
)}
|
|
159
|
-
{...props}
|
|
160
|
-
/>
|
|
161
|
-
)
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
function DropdownMenuSeparator({
|
|
165
|
-
className,
|
|
166
|
-
...props
|
|
167
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {
|
|
168
|
-
return (
|
|
169
|
-
<DropdownMenuPrimitive.Separator
|
|
170
|
-
data-slot="dropdown-menu-separator"
|
|
171
|
-
className={cn("bg-border -mx-1 my-1 h-px", className)}
|
|
172
|
-
{...props}
|
|
173
|
-
/>
|
|
174
|
-
)
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
function DropdownMenuShortcut({
|
|
178
|
-
className,
|
|
179
|
-
...props
|
|
180
|
-
}: React.ComponentProps<"span">) {
|
|
181
|
-
return (
|
|
182
|
-
<span
|
|
183
|
-
data-slot="dropdown-menu-shortcut"
|
|
184
|
-
className={cn(
|
|
185
|
-
"text-muted-foreground ml-auto text-xs tracking-widest",
|
|
186
|
-
className
|
|
187
|
-
)}
|
|
188
|
-
{...props}
|
|
189
|
-
/>
|
|
190
|
-
)
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
function DropdownMenuSub({
|
|
194
|
-
...props
|
|
195
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) {
|
|
196
|
-
return <DropdownMenuPrimitive.Sub data-slot="dropdown-menu-sub" {...props} />
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
function DropdownMenuSubTrigger({
|
|
200
|
-
className,
|
|
201
|
-
inset,
|
|
202
|
-
children,
|
|
203
|
-
...props
|
|
204
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
205
|
-
inset?: boolean
|
|
206
|
-
}) {
|
|
207
|
-
return (
|
|
208
|
-
<DropdownMenuPrimitive.SubTrigger
|
|
209
|
-
data-slot="dropdown-menu-sub-trigger"
|
|
210
|
-
data-inset={inset}
|
|
211
|
-
className={cn(
|
|
212
|
-
"focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
213
|
-
className
|
|
214
|
-
)}
|
|
215
|
-
{...props}
|
|
216
|
-
>
|
|
217
|
-
{children}
|
|
218
|
-
<ChevronRightIcon className="ml-auto size-4" />
|
|
219
|
-
</DropdownMenuPrimitive.SubTrigger>
|
|
220
|
-
)
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
function DropdownMenuSubContent({
|
|
224
|
-
className,
|
|
225
|
-
...props
|
|
226
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {
|
|
227
|
-
return (
|
|
228
|
-
<DropdownMenuPrimitive.SubContent
|
|
229
|
-
data-slot="dropdown-menu-sub-content"
|
|
230
|
-
className={cn(
|
|
231
|
-
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",
|
|
232
|
-
className
|
|
233
|
-
)}
|
|
234
|
-
{...props}
|
|
235
|
-
/>
|
|
236
|
-
)
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
export {
|
|
240
|
-
DropdownMenu,
|
|
241
|
-
DropdownMenuPortal,
|
|
242
|
-
DropdownMenuTrigger,
|
|
243
|
-
DropdownMenuContent,
|
|
244
|
-
DropdownMenuGroup,
|
|
245
|
-
DropdownMenuLabel,
|
|
246
|
-
DropdownMenuItem,
|
|
247
|
-
DropdownMenuCheckboxItem,
|
|
248
|
-
DropdownMenuRadioGroup,
|
|
249
|
-
DropdownMenuRadioItem,
|
|
250
|
-
DropdownMenuSeparator,
|
|
251
|
-
DropdownMenuShortcut,
|
|
252
|
-
DropdownMenuSub,
|
|
253
|
-
DropdownMenuSubTrigger,
|
|
254
|
-
DropdownMenuSubContent,
|
|
255
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as Icons from 'lucide-react';
|
|
2
|
-
import type { LucideProps } from 'lucide-react';
|
|
3
|
-
|
|
4
|
-
export type LucideIconName = keyof typeof Icons;
|
|
5
|
-
|
|
6
|
-
export function DynamicIcon({
|
|
7
|
-
name,
|
|
8
|
-
...props
|
|
9
|
-
}: { name: LucideIconName } & LucideProps) {
|
|
10
|
-
const Icon = (Icons[name] as React.ComponentType<LucideProps>) || Icons.FileIcon;
|
|
11
|
-
return <Icon {...props} />;
|
|
12
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import type { VariantProps } from 'class-variance-authority';
|
|
2
|
-
|
|
3
|
-
import { cva } from 'class-variance-authority';
|
|
4
|
-
import { type PlateStaticProps, PlateStatic } from 'platejs/static';
|
|
5
|
-
|
|
6
|
-
import { cn } from '@/lib/utils';
|
|
7
|
-
|
|
8
|
-
export const editorVariants = cva(
|
|
9
|
-
cn(
|
|
10
|
-
'group/editor',
|
|
11
|
-
'relative w-full cursor-text select-text overflow-x-hidden whitespace-pre-wrap break-words',
|
|
12
|
-
'rounded-md ring-offset-background focus-visible:outline-none',
|
|
13
|
-
'placeholder:text-muted-foreground/80 **:data-slate-placeholder:top-[auto_!important] **:data-slate-placeholder:text-muted-foreground/80 **:data-slate-placeholder:opacity-100!',
|
|
14
|
-
'[&_strong]:font-bold'
|
|
15
|
-
),
|
|
16
|
-
{
|
|
17
|
-
defaultVariants: {
|
|
18
|
-
variant: 'none',
|
|
19
|
-
},
|
|
20
|
-
variants: {
|
|
21
|
-
disabled: {
|
|
22
|
-
true: 'cursor-not-allowed opacity-50',
|
|
23
|
-
},
|
|
24
|
-
focused: {
|
|
25
|
-
true: 'ring-2 ring-ring ring-offset-2',
|
|
26
|
-
},
|
|
27
|
-
variant: {
|
|
28
|
-
ai: 'w-full px-0 text-base md:text-sm',
|
|
29
|
-
aiChat:
|
|
30
|
-
'max-h-[min(70vh,320px)] w-full max-w-[700px] overflow-y-auto px-5 py-3 text-base md:text-sm',
|
|
31
|
-
default:
|
|
32
|
-
'size-full px-16 pt-4 pb-72 text-base sm:px-[max(64px,calc(50%-350px))]',
|
|
33
|
-
demo: 'size-full px-16 pt-4 pb-72 text-base sm:px-[max(64px,calc(50%-350px))]',
|
|
34
|
-
fullWidth: 'size-full px-16 pt-4 pb-72 text-base sm:px-24',
|
|
35
|
-
none: '',
|
|
36
|
-
select: 'px-3 py-2 text-base data-readonly:w-fit',
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
}
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
export function EditorStatic({
|
|
43
|
-
className,
|
|
44
|
-
variant,
|
|
45
|
-
...props
|
|
46
|
-
}: PlateStaticProps & VariantProps<typeof editorVariants>) {
|
|
47
|
-
return (
|
|
48
|
-
<PlateStatic
|
|
49
|
-
className={cn(editorVariants({ variant }), className)}
|
|
50
|
-
{...props}
|
|
51
|
-
/>
|
|
52
|
-
);
|
|
53
|
-
}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import type { VariantProps } from 'class-variance-authority';
|
|
4
|
-
import type { PlateContentProps, PlateViewProps } from 'platejs/react';
|
|
5
|
-
|
|
6
|
-
import { cva } from 'class-variance-authority';
|
|
7
|
-
import { PlateContainer, PlateContent, PlateView } from 'platejs/react';
|
|
8
|
-
|
|
9
|
-
import { cn } from '@/lib/utils';
|
|
10
|
-
|
|
11
|
-
const editorContainerVariants = cva(
|
|
12
|
-
'relative w-full cursor-text select-text overflow-y-auto caret-primary selection:bg-brand/25 focus-visible:outline-none [&_.slate-selection-area]:z-50 [&_.slate-selection-area]:border [&_.slate-selection-area]:border-brand/25 [&_.slate-selection-area]:bg-brand/15',
|
|
13
|
-
{
|
|
14
|
-
defaultVariants: {
|
|
15
|
-
variant: 'default',
|
|
16
|
-
},
|
|
17
|
-
variants: {
|
|
18
|
-
variant: {
|
|
19
|
-
comment: cn(
|
|
20
|
-
'flex flex-wrap justify-between gap-1 px-2 py-0.5 text-sm',
|
|
21
|
-
'rounded-md border-[1.5px] border-transparent bg-transparent',
|
|
22
|
-
'has-[[data-slate-editor]:focus]:border-brand/50 has-[[data-slate-editor]:focus]:ring-2 has-[[data-slate-editor]:focus]:ring-brand/30',
|
|
23
|
-
'has-aria-disabled:border-input has-aria-disabled:bg-muted'
|
|
24
|
-
),
|
|
25
|
-
default: 'h-full',
|
|
26
|
-
demo: 'h-[650px]',
|
|
27
|
-
select: cn(
|
|
28
|
-
'group rounded-md border border-input ring-offset-background focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2',
|
|
29
|
-
'has-data-readonly:w-fit has-data-readonly:cursor-default has-data-readonly:border-transparent has-data-readonly:focus-within:[box-shadow:none]'
|
|
30
|
-
),
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
}
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
export function EditorContainer({
|
|
37
|
-
className,
|
|
38
|
-
variant,
|
|
39
|
-
...props
|
|
40
|
-
}: React.ComponentProps<'div'> & VariantProps<typeof editorContainerVariants>) {
|
|
41
|
-
return (
|
|
42
|
-
<PlateContainer
|
|
43
|
-
className={cn(
|
|
44
|
-
'ignore-click-outside/toolbar',
|
|
45
|
-
editorContainerVariants({ variant }),
|
|
46
|
-
className
|
|
47
|
-
)}
|
|
48
|
-
{...props}
|
|
49
|
-
/>
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const editorVariants = cva(
|
|
54
|
-
cn(
|
|
55
|
-
'group/editor',
|
|
56
|
-
'relative w-full cursor-text select-text overflow-x-hidden whitespace-pre-wrap break-words',
|
|
57
|
-
'rounded-md ring-offset-background focus-visible:outline-none',
|
|
58
|
-
'**:data-slate-placeholder:!top-1/2 **:data-slate-placeholder:-translate-y-1/2 placeholder:text-muted-foreground/80 **:data-slate-placeholder:text-muted-foreground/80 **:data-slate-placeholder:opacity-100!',
|
|
59
|
-
'[&_strong]:font-bold'
|
|
60
|
-
),
|
|
61
|
-
{
|
|
62
|
-
defaultVariants: {
|
|
63
|
-
variant: 'default',
|
|
64
|
-
},
|
|
65
|
-
variants: {
|
|
66
|
-
disabled: {
|
|
67
|
-
true: 'cursor-not-allowed opacity-50',
|
|
68
|
-
},
|
|
69
|
-
focused: {
|
|
70
|
-
true: 'ring-2 ring-ring ring-offset-2',
|
|
71
|
-
},
|
|
72
|
-
variant: {
|
|
73
|
-
ai: 'w-full px-0 text-base md:text-sm',
|
|
74
|
-
aiChat:
|
|
75
|
-
'max-h-[min(70vh,320px)] w-full max-w-[700px] overflow-y-auto px-3 py-2 text-base md:text-sm',
|
|
76
|
-
comment: cn('rounded-none border-none bg-transparent text-sm'),
|
|
77
|
-
default:
|
|
78
|
-
'size-full px-16 pt-4 pb-72 text-base sm:px-[max(64px,calc(50%-350px))]',
|
|
79
|
-
demo: 'size-full px-16 pt-4 pb-72 text-base sm:px-[max(64px,calc(50%-350px))]',
|
|
80
|
-
fullWidth: 'size-full px-16 pt-4 pb-72 text-base sm:px-24',
|
|
81
|
-
none: '',
|
|
82
|
-
select: 'px-3 py-2 text-base data-readonly:w-fit',
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
}
|
|
86
|
-
);
|
|
87
|
-
|
|
88
|
-
export type EditorProps = PlateContentProps &
|
|
89
|
-
VariantProps<typeof editorVariants>;
|
|
90
|
-
|
|
91
|
-
export const Editor = ({
|
|
92
|
-
className,
|
|
93
|
-
disabled,
|
|
94
|
-
focused,
|
|
95
|
-
variant,
|
|
96
|
-
ref,
|
|
97
|
-
...props
|
|
98
|
-
}: EditorProps & { ref?: React.RefObject<HTMLDivElement | null> }) => (
|
|
99
|
-
<PlateContent
|
|
100
|
-
ref={ref}
|
|
101
|
-
className={cn(
|
|
102
|
-
editorVariants({
|
|
103
|
-
disabled,
|
|
104
|
-
focused,
|
|
105
|
-
variant,
|
|
106
|
-
}),
|
|
107
|
-
className
|
|
108
|
-
)}
|
|
109
|
-
disabled={disabled}
|
|
110
|
-
disableDefaultStyles
|
|
111
|
-
{...props}
|
|
112
|
-
/>
|
|
113
|
-
);
|
|
114
|
-
|
|
115
|
-
Editor.displayName = 'Editor';
|
|
116
|
-
|
|
117
|
-
export function EditorView({
|
|
118
|
-
className,
|
|
119
|
-
variant,
|
|
120
|
-
...props
|
|
121
|
-
}: PlateViewProps & VariantProps<typeof editorVariants>) {
|
|
122
|
-
return (
|
|
123
|
-
<PlateView
|
|
124
|
-
{...props}
|
|
125
|
-
className={cn(editorVariants({ variant }), className)}
|
|
126
|
-
/>
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
EditorView.displayName = 'EditorView';
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import type { PlateElementProps } from 'platejs/react';
|
|
4
|
-
|
|
5
|
-
import { EmojiInlineIndexSearch, insertEmoji } from '@platejs/emoji';
|
|
6
|
-
import { EmojiPlugin } from '@platejs/emoji/react';
|
|
7
|
-
import { PlateElement, usePluginOption } from 'platejs/react';
|
|
8
|
-
|
|
9
|
-
import { useDebounce } from '@/hooks/use-debounce';
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
InlineCombobox,
|
|
13
|
-
InlineComboboxContent,
|
|
14
|
-
InlineComboboxEmpty,
|
|
15
|
-
InlineComboboxGroup,
|
|
16
|
-
InlineComboboxInput,
|
|
17
|
-
InlineComboboxItem,
|
|
18
|
-
} from './inline-combobox';
|
|
19
|
-
|
|
20
|
-
const TRAILING_COLON_REGEX = /:$/;
|
|
21
|
-
|
|
22
|
-
export function EmojiInputElement(props: PlateElementProps) {
|
|
23
|
-
const { children, editor, element } = props;
|
|
24
|
-
const data = usePluginOption(EmojiPlugin, 'data')!;
|
|
25
|
-
const [value, setValue] = React.useState('');
|
|
26
|
-
const debouncedValue = useDebounce(value, 100);
|
|
27
|
-
const isPending = value !== debouncedValue;
|
|
28
|
-
|
|
29
|
-
const filteredEmojis = React.useMemo(() => {
|
|
30
|
-
if (debouncedValue.trim().length === 0) return [];
|
|
31
|
-
|
|
32
|
-
return EmojiInlineIndexSearch.getInstance(data)
|
|
33
|
-
.search(debouncedValue.replace(TRAILING_COLON_REGEX, ''))
|
|
34
|
-
.get();
|
|
35
|
-
}, [data, debouncedValue]);
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<PlateElement as="span" {...props}>
|
|
39
|
-
<InlineCombobox
|
|
40
|
-
value={value}
|
|
41
|
-
element={element}
|
|
42
|
-
filter={false}
|
|
43
|
-
setValue={setValue}
|
|
44
|
-
trigger=":"
|
|
45
|
-
hideWhenNoValue
|
|
46
|
-
>
|
|
47
|
-
<InlineComboboxInput />
|
|
48
|
-
|
|
49
|
-
<InlineComboboxContent>
|
|
50
|
-
{!isPending && <InlineComboboxEmpty>No results</InlineComboboxEmpty>}
|
|
51
|
-
|
|
52
|
-
<InlineComboboxGroup>
|
|
53
|
-
{filteredEmojis.map((emoji) => (
|
|
54
|
-
<InlineComboboxItem
|
|
55
|
-
key={emoji.id}
|
|
56
|
-
value={emoji.name}
|
|
57
|
-
onClick={() => insertEmoji(editor, emoji)}
|
|
58
|
-
>
|
|
59
|
-
{emoji.skins[0].native} {emoji.name}
|
|
60
|
-
</InlineComboboxItem>
|
|
61
|
-
))}
|
|
62
|
-
</InlineComboboxGroup>
|
|
63
|
-
</InlineComboboxContent>
|
|
64
|
-
</InlineCombobox>
|
|
65
|
-
|
|
66
|
-
{children}
|
|
67
|
-
</PlateElement>
|
|
68
|
-
);
|
|
69
|
-
}
|