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.
Files changed (220) hide show
  1. package/LICENSE +17 -0
  2. package/dist/bin/doclific.js +36 -8
  3. package/package.json +10 -3
  4. package/readme.md +77 -0
  5. package/.gitattributes +0 -2
  6. package/.prettierignore +0 -5
  7. package/.prettierrc +0 -9
  8. package/.vscode/settings.json +0 -13
  9. package/frontend/components.json +0 -24
  10. package/frontend/eslint.config.js +0 -23
  11. package/frontend/index.html +0 -25
  12. package/frontend/package-lock.json +0 -15754
  13. package/frontend/public/logo.svg +0 -1
  14. package/frontend/src/App.tsx +0 -21
  15. package/frontend/src/components/app-sidebar.tsx +0 -393
  16. package/frontend/src/components/editor/editor-base-kit.tsx +0 -43
  17. package/frontend/src/components/editor/editor-kit.tsx +0 -93
  18. package/frontend/src/components/editor/plugins/align-base-kit.tsx +0 -16
  19. package/frontend/src/components/editor/plugins/align-kit.tsx +0 -18
  20. package/frontend/src/components/editor/plugins/autoformat-kit.tsx +0 -236
  21. package/frontend/src/components/editor/plugins/basic-blocks-base-kit.tsx +0 -35
  22. package/frontend/src/components/editor/plugins/basic-blocks-kit.tsx +0 -88
  23. package/frontend/src/components/editor/plugins/basic-marks-base-kit.tsx +0 -27
  24. package/frontend/src/components/editor/plugins/basic-marks-kit.tsx +0 -41
  25. package/frontend/src/components/editor/plugins/basic-nodes-kit.tsx +0 -6
  26. package/frontend/src/components/editor/plugins/block-menu-kit.tsx +0 -14
  27. package/frontend/src/components/editor/plugins/block-placeholder-kit.tsx +0 -17
  28. package/frontend/src/components/editor/plugins/block-selection-kit.tsx +0 -32
  29. package/frontend/src/components/editor/plugins/callout-base-kit.tsx +0 -7
  30. package/frontend/src/components/editor/plugins/callout-kit.tsx +0 -7
  31. package/frontend/src/components/editor/plugins/code-block-base-kit.tsx +0 -23
  32. package/frontend/src/components/editor/plugins/code-block-kit.tsx +0 -26
  33. package/frontend/src/components/editor/plugins/codebase-kit.tsx +0 -23
  34. package/frontend/src/components/editor/plugins/column-base-kit.tsx +0 -11
  35. package/frontend/src/components/editor/plugins/column-kit.tsx +0 -10
  36. package/frontend/src/components/editor/plugins/comment-base-kit.tsx +0 -7
  37. package/frontend/src/components/editor/plugins/comment-kit.tsx +0 -97
  38. package/frontend/src/components/editor/plugins/cursor-overlay-kit.tsx +0 -13
  39. package/frontend/src/components/editor/plugins/date-base-kit.tsx +0 -5
  40. package/frontend/src/components/editor/plugins/date-kit.tsx +0 -7
  41. package/frontend/src/components/editor/plugins/discussion-kit.tsx +0 -148
  42. package/frontend/src/components/editor/plugins/dnd-kit.tsx +0 -28
  43. package/frontend/src/components/editor/plugins/docx-kit.tsx +0 -6
  44. package/frontend/src/components/editor/plugins/emoji-kit.tsx +0 -13
  45. package/frontend/src/components/editor/plugins/excalidraw-kit.tsx +0 -9
  46. package/frontend/src/components/editor/plugins/exit-break-kit.tsx +0 -12
  47. package/frontend/src/components/editor/plugins/floating-toolbar-kit.tsx +0 -19
  48. package/frontend/src/components/editor/plugins/font-base-kit.tsx +0 -20
  49. package/frontend/src/components/editor/plugins/font-kit.tsx +0 -29
  50. package/frontend/src/components/editor/plugins/indent-base-kit.tsx +0 -19
  51. package/frontend/src/components/editor/plugins/indent-kit.tsx +0 -22
  52. package/frontend/src/components/editor/plugins/line-height-base-kit.tsx +0 -14
  53. package/frontend/src/components/editor/plugins/line-height-kit.tsx +0 -16
  54. package/frontend/src/components/editor/plugins/link-base-kit.tsx +0 -5
  55. package/frontend/src/components/editor/plugins/link-kit.tsx +0 -15
  56. package/frontend/src/components/editor/plugins/list-base-kit.tsx +0 -23
  57. package/frontend/src/components/editor/plugins/list-kit.tsx +0 -26
  58. package/frontend/src/components/editor/plugins/markdown-kit.tsx +0 -46
  59. package/frontend/src/components/editor/plugins/math-base-kit.tsx +0 -11
  60. package/frontend/src/components/editor/plugins/math-kit.tsx +0 -13
  61. package/frontend/src/components/editor/plugins/media-base-kit.tsx +0 -31
  62. package/frontend/src/components/editor/plugins/media-kit.tsx +0 -43
  63. package/frontend/src/components/editor/plugins/mention-base-kit.tsx +0 -7
  64. package/frontend/src/components/editor/plugins/mention-kit.tsx +0 -15
  65. package/frontend/src/components/editor/plugins/slash-kit.tsx +0 -18
  66. package/frontend/src/components/editor/plugins/suggestion-base-kit.tsx +0 -7
  67. package/frontend/src/components/editor/plugins/suggestion-kit.tsx +0 -90
  68. package/frontend/src/components/editor/plugins/table-base-kit.tsx +0 -20
  69. package/frontend/src/components/editor/plugins/table-kit.tsx +0 -22
  70. package/frontend/src/components/editor/plugins/toc-base-kit.tsx +0 -5
  71. package/frontend/src/components/editor/plugins/toc-kit.tsx +0 -14
  72. package/frontend/src/components/editor/plugins/toggle-base-kit.tsx +0 -7
  73. package/frontend/src/components/editor/plugins/toggle-kit.tsx +0 -11
  74. package/frontend/src/components/editor/transforms.ts +0 -194
  75. package/frontend/src/components/markdown-to-slate-demo.tsx +0 -50
  76. package/frontend/src/components/mode-toggle.tsx +0 -15
  77. package/frontend/src/components/theme-provider.tsx +0 -73
  78. package/frontend/src/components/ui/alert-dialog.tsx +0 -155
  79. package/frontend/src/components/ui/align-toolbar-button.tsx +0 -84
  80. package/frontend/src/components/ui/avatar.tsx +0 -51
  81. package/frontend/src/components/ui/block-context-menu.tsx +0 -199
  82. package/frontend/src/components/ui/block-discussion.tsx +0 -365
  83. package/frontend/src/components/ui/block-draggable.tsx +0 -512
  84. package/frontend/src/components/ui/block-list-static.tsx +0 -80
  85. package/frontend/src/components/ui/block-list.tsx +0 -87
  86. package/frontend/src/components/ui/block-selection.tsx +0 -42
  87. package/frontend/src/components/ui/block-suggestion.tsx +0 -473
  88. package/frontend/src/components/ui/blockquote-node-static.tsx +0 -11
  89. package/frontend/src/components/ui/blockquote-node.tsx +0 -13
  90. package/frontend/src/components/ui/button.tsx +0 -62
  91. package/frontend/src/components/ui/calendar.tsx +0 -218
  92. package/frontend/src/components/ui/callout-node-static.tsx +0 -36
  93. package/frontend/src/components/ui/callout-node.tsx +0 -63
  94. package/frontend/src/components/ui/caption.tsx +0 -63
  95. package/frontend/src/components/ui/checkbox.tsx +0 -30
  96. package/frontend/src/components/ui/code-block-node-static.tsx +0 -35
  97. package/frontend/src/components/ui/code-block-node.tsx +0 -287
  98. package/frontend/src/components/ui/code-node-static.tsx +0 -15
  99. package/frontend/src/components/ui/code-node.tsx +0 -17
  100. package/frontend/src/components/ui/codebase-snippet-node.tsx +0 -237
  101. package/frontend/src/components/ui/column-node-static.tsx +0 -29
  102. package/frontend/src/components/ui/column-node.tsx +0 -317
  103. package/frontend/src/components/ui/command.tsx +0 -182
  104. package/frontend/src/components/ui/comment-node-static.tsx +0 -15
  105. package/frontend/src/components/ui/comment-node.tsx +0 -45
  106. package/frontend/src/components/ui/comment-toolbar-button.tsx +0 -24
  107. package/frontend/src/components/ui/comment.tsx +0 -618
  108. package/frontend/src/components/ui/context-menu.tsx +0 -250
  109. package/frontend/src/components/ui/cursor-overlay.tsx +0 -66
  110. package/frontend/src/components/ui/date-node-static.tsx +0 -45
  111. package/frontend/src/components/ui/date-node.tsx +0 -93
  112. package/frontend/src/components/ui/dialog.tsx +0 -143
  113. package/frontend/src/components/ui/dropdown-menu.tsx +0 -255
  114. package/frontend/src/components/ui/dynamic-icon.tsx +0 -12
  115. package/frontend/src/components/ui/editor-static.tsx +0 -53
  116. package/frontend/src/components/ui/editor.tsx +0 -130
  117. package/frontend/src/components/ui/emoji-node.tsx +0 -69
  118. package/frontend/src/components/ui/emoji-toolbar-button.tsx +0 -628
  119. package/frontend/src/components/ui/equation-node-static.tsx +0 -98
  120. package/frontend/src/components/ui/equation-node.tsx +0 -235
  121. package/frontend/src/components/ui/equation-toolbar-button.tsx +0 -25
  122. package/frontend/src/components/ui/excalidraw-node.tsx +0 -36
  123. package/frontend/src/components/ui/export-toolbar-button.tsx +0 -174
  124. package/frontend/src/components/ui/file-selector.tsx +0 -339
  125. package/frontend/src/components/ui/floating-toolbar-buttons.tsx +0 -73
  126. package/frontend/src/components/ui/floating-toolbar.tsx +0 -85
  127. package/frontend/src/components/ui/font-color-toolbar-button.tsx +0 -831
  128. package/frontend/src/components/ui/font-size-toolbar-button.tsx +0 -152
  129. package/frontend/src/components/ui/heading-node-static.tsx +0 -68
  130. package/frontend/src/components/ui/heading-node.tsx +0 -58
  131. package/frontend/src/components/ui/highlight-node-static.tsx +0 -11
  132. package/frontend/src/components/ui/highlight-node.tsx +0 -13
  133. package/frontend/src/components/ui/history-toolbar-button.tsx +0 -50
  134. package/frontend/src/components/ui/hr-node-static.tsx +0 -20
  135. package/frontend/src/components/ui/hr-node.tsx +0 -33
  136. package/frontend/src/components/ui/import-toolbar-button.tsx +0 -97
  137. package/frontend/src/components/ui/indent-toolbar-button.tsx +0 -30
  138. package/frontend/src/components/ui/inline-combobox.tsx +0 -414
  139. package/frontend/src/components/ui/input.tsx +0 -21
  140. package/frontend/src/components/ui/insert-toolbar-button.tsx +0 -254
  141. package/frontend/src/components/ui/kbd-node-static.tsx +0 -15
  142. package/frontend/src/components/ui/kbd-node.tsx +0 -17
  143. package/frontend/src/components/ui/layout-header.tsx +0 -35
  144. package/frontend/src/components/ui/line-height-toolbar-button.tsx +0 -68
  145. package/frontend/src/components/ui/link-node-static.tsx +0 -21
  146. package/frontend/src/components/ui/link-node.tsx +0 -39
  147. package/frontend/src/components/ui/link-toolbar-button.tsx +0 -22
  148. package/frontend/src/components/ui/link-toolbar.tsx +0 -206
  149. package/frontend/src/components/ui/list-toolbar-button.tsx +0 -204
  150. package/frontend/src/components/ui/mark-toolbar-button.tsx +0 -19
  151. package/frontend/src/components/ui/media-audio-node-static.tsx +0 -17
  152. package/frontend/src/components/ui/media-audio-node.tsx +0 -39
  153. package/frontend/src/components/ui/media-embed-node.tsx +0 -136
  154. package/frontend/src/components/ui/media-file-node-static.tsx +0 -29
  155. package/frontend/src/components/ui/media-file-node.tsx +0 -47
  156. package/frontend/src/components/ui/media-image-node-static.tsx +0 -39
  157. package/frontend/src/components/ui/media-image-node.tsx +0 -80
  158. package/frontend/src/components/ui/media-placeholder-node.tsx +0 -249
  159. package/frontend/src/components/ui/media-preview-dialog.tsx +0 -152
  160. package/frontend/src/components/ui/media-toolbar-button.tsx +0 -225
  161. package/frontend/src/components/ui/media-toolbar.tsx +0 -115
  162. package/frontend/src/components/ui/media-upload-toast.tsx +0 -66
  163. package/frontend/src/components/ui/media-video-node-static.tsx +0 -30
  164. package/frontend/src/components/ui/media-video-node.tsx +0 -121
  165. package/frontend/src/components/ui/mention-node-static.tsx +0 -36
  166. package/frontend/src/components/ui/mention-node.tsx +0 -194
  167. package/frontend/src/components/ui/mode-toolbar-button.tsx +0 -123
  168. package/frontend/src/components/ui/more-toolbar-button.tsx +0 -80
  169. package/frontend/src/components/ui/paragraph-node-static.tsx +0 -13
  170. package/frontend/src/components/ui/paragraph-node.tsx +0 -15
  171. package/frontend/src/components/ui/popover.tsx +0 -46
  172. package/frontend/src/components/ui/resize-handle.tsx +0 -87
  173. package/frontend/src/components/ui/separator.tsx +0 -28
  174. package/frontend/src/components/ui/sheet.tsx +0 -139
  175. package/frontend/src/components/ui/sidebar.tsx +0 -726
  176. package/frontend/src/components/ui/skeleton.tsx +0 -13
  177. package/frontend/src/components/ui/slash-node.tsx +0 -233
  178. package/frontend/src/components/ui/sonner.tsx +0 -38
  179. package/frontend/src/components/ui/suggestion-node-static.tsx +0 -35
  180. package/frontend/src/components/ui/suggestion-node.tsx +0 -162
  181. package/frontend/src/components/ui/suggestion-toolbar-button.tsx +0 -25
  182. package/frontend/src/components/ui/table-icons.tsx +0 -862
  183. package/frontend/src/components/ui/table-node-static.tsx +0 -98
  184. package/frontend/src/components/ui/table-node.tsx +0 -656
  185. package/frontend/src/components/ui/table-toolbar-button.tsx +0 -264
  186. package/frontend/src/components/ui/toc-node-static.tsx +0 -92
  187. package/frontend/src/components/ui/toc-node.tsx +0 -55
  188. package/frontend/src/components/ui/toggle-node-static.tsx +0 -18
  189. package/frontend/src/components/ui/toggle-node.tsx +0 -36
  190. package/frontend/src/components/ui/toggle-toolbar-button.tsx +0 -22
  191. package/frontend/src/components/ui/toolbar.tsx +0 -387
  192. package/frontend/src/components/ui/tooltip.tsx +0 -59
  193. package/frontend/src/components/ui/turn-into-toolbar-button.tsx +0 -188
  194. package/frontend/src/hooks/use-debounce.ts +0 -18
  195. package/frontend/src/hooks/use-is-touch-device.ts +0 -24
  196. package/frontend/src/hooks/use-mobile.ts +0 -19
  197. package/frontend/src/hooks/use-mounted.ts +0 -11
  198. package/frontend/src/hooks/use-upload-file.ts +0 -128
  199. package/frontend/src/index.css +0 -128
  200. package/frontend/src/layout.tsx +0 -42
  201. package/frontend/src/lib/markdown-joiner-transform.ts +0 -239
  202. package/frontend/src/lib/orpc.ts +0 -13
  203. package/frontend/src/lib/uploadthing.ts +0 -19
  204. package/frontend/src/lib/utils.ts +0 -6
  205. package/frontend/src/main.tsx +0 -13
  206. package/frontend/src/pages/editor.tsx +0 -44
  207. package/frontend/src/types/docs.d.ts +0 -6
  208. package/frontend/src/types/global.d.ts +0 -9
  209. package/frontend/src/types/router.d.ts +0 -4
  210. package/frontend/tsconfig.app.json +0 -33
  211. package/frontend/tsconfig.json +0 -10
  212. package/frontend/tsconfig.node.json +0 -26
  213. package/frontend/vite.config.ts +0 -14
  214. package/src/bin/doclific.ts +0 -47
  215. package/src/core/codebase.ts +0 -39
  216. package/src/core/docs.ts +0 -90
  217. package/src/core/git.ts +0 -48
  218. package/src/server/index.ts +0 -55
  219. package/src/server/router.ts +0 -65
  220. package/tsconfig.json +0 -15
@@ -1,250 +0,0 @@
1
- import * as React from "react"
2
- import * as ContextMenuPrimitive from "@radix-ui/react-context-menu"
3
- import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react"
4
-
5
- import { cn } from "@/lib/utils"
6
-
7
- function ContextMenu({
8
- ...props
9
- }: React.ComponentProps<typeof ContextMenuPrimitive.Root>) {
10
- return <ContextMenuPrimitive.Root data-slot="context-menu" {...props} />
11
- }
12
-
13
- function ContextMenuTrigger({
14
- ...props
15
- }: React.ComponentProps<typeof ContextMenuPrimitive.Trigger>) {
16
- return (
17
- <ContextMenuPrimitive.Trigger data-slot="context-menu-trigger" {...props} />
18
- )
19
- }
20
-
21
- function ContextMenuGroup({
22
- ...props
23
- }: React.ComponentProps<typeof ContextMenuPrimitive.Group>) {
24
- return (
25
- <ContextMenuPrimitive.Group data-slot="context-menu-group" {...props} />
26
- )
27
- }
28
-
29
- function ContextMenuPortal({
30
- ...props
31
- }: React.ComponentProps<typeof ContextMenuPrimitive.Portal>) {
32
- return (
33
- <ContextMenuPrimitive.Portal data-slot="context-menu-portal" {...props} />
34
- )
35
- }
36
-
37
- function ContextMenuSub({
38
- ...props
39
- }: React.ComponentProps<typeof ContextMenuPrimitive.Sub>) {
40
- return <ContextMenuPrimitive.Sub data-slot="context-menu-sub" {...props} />
41
- }
42
-
43
- function ContextMenuRadioGroup({
44
- ...props
45
- }: React.ComponentProps<typeof ContextMenuPrimitive.RadioGroup>) {
46
- return (
47
- <ContextMenuPrimitive.RadioGroup
48
- data-slot="context-menu-radio-group"
49
- {...props}
50
- />
51
- )
52
- }
53
-
54
- function ContextMenuSubTrigger({
55
- className,
56
- inset,
57
- children,
58
- ...props
59
- }: React.ComponentProps<typeof ContextMenuPrimitive.SubTrigger> & {
60
- inset?: boolean
61
- }) {
62
- return (
63
- <ContextMenuPrimitive.SubTrigger
64
- data-slot="context-menu-sub-trigger"
65
- data-inset={inset}
66
- className={cn(
67
- "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 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",
68
- className
69
- )}
70
- {...props}
71
- >
72
- {children}
73
- <ChevronRightIcon className="ml-auto" />
74
- </ContextMenuPrimitive.SubTrigger>
75
- )
76
- }
77
-
78
- function ContextMenuSubContent({
79
- className,
80
- ...props
81
- }: React.ComponentProps<typeof ContextMenuPrimitive.SubContent>) {
82
- return (
83
- <ContextMenuPrimitive.SubContent
84
- data-slot="context-menu-sub-content"
85
- className={cn(
86
- "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-context-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",
87
- className
88
- )}
89
- {...props}
90
- />
91
- )
92
- }
93
-
94
- function ContextMenuContent({
95
- className,
96
- ...props
97
- }: React.ComponentProps<typeof ContextMenuPrimitive.Content>) {
98
- return (
99
- <ContextMenuPrimitive.Portal>
100
- <ContextMenuPrimitive.Content
101
- data-slot="context-menu-content"
102
- className={cn(
103
- "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-context-menu-content-available-height) min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
104
- className
105
- )}
106
- {...props}
107
- />
108
- </ContextMenuPrimitive.Portal>
109
- )
110
- }
111
-
112
- function ContextMenuItem({
113
- className,
114
- inset,
115
- variant = "default",
116
- ...props
117
- }: React.ComponentProps<typeof ContextMenuPrimitive.Item> & {
118
- inset?: boolean
119
- variant?: "default" | "destructive"
120
- }) {
121
- return (
122
- <ContextMenuPrimitive.Item
123
- data-slot="context-menu-item"
124
- data-inset={inset}
125
- data-variant={variant}
126
- className={cn(
127
- "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",
128
- className
129
- )}
130
- {...props}
131
- />
132
- )
133
- }
134
-
135
- function ContextMenuCheckboxItem({
136
- className,
137
- children,
138
- checked,
139
- ...props
140
- }: React.ComponentProps<typeof ContextMenuPrimitive.CheckboxItem>) {
141
- return (
142
- <ContextMenuPrimitive.CheckboxItem
143
- data-slot="context-menu-checkbox-item"
144
- className={cn(
145
- "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",
146
- className
147
- )}
148
- checked={checked}
149
- {...props}
150
- >
151
- <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
152
- <ContextMenuPrimitive.ItemIndicator>
153
- <CheckIcon className="size-4" />
154
- </ContextMenuPrimitive.ItemIndicator>
155
- </span>
156
- {children}
157
- </ContextMenuPrimitive.CheckboxItem>
158
- )
159
- }
160
-
161
- function ContextMenuRadioItem({
162
- className,
163
- children,
164
- ...props
165
- }: React.ComponentProps<typeof ContextMenuPrimitive.RadioItem>) {
166
- return (
167
- <ContextMenuPrimitive.RadioItem
168
- data-slot="context-menu-radio-item"
169
- className={cn(
170
- "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",
171
- className
172
- )}
173
- {...props}
174
- >
175
- <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
176
- <ContextMenuPrimitive.ItemIndicator>
177
- <CircleIcon className="size-2 fill-current" />
178
- </ContextMenuPrimitive.ItemIndicator>
179
- </span>
180
- {children}
181
- </ContextMenuPrimitive.RadioItem>
182
- )
183
- }
184
-
185
- function ContextMenuLabel({
186
- className,
187
- inset,
188
- ...props
189
- }: React.ComponentProps<typeof ContextMenuPrimitive.Label> & {
190
- inset?: boolean
191
- }) {
192
- return (
193
- <ContextMenuPrimitive.Label
194
- data-slot="context-menu-label"
195
- data-inset={inset}
196
- className={cn(
197
- "text-foreground px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",
198
- className
199
- )}
200
- {...props}
201
- />
202
- )
203
- }
204
-
205
- function ContextMenuSeparator({
206
- className,
207
- ...props
208
- }: React.ComponentProps<typeof ContextMenuPrimitive.Separator>) {
209
- return (
210
- <ContextMenuPrimitive.Separator
211
- data-slot="context-menu-separator"
212
- className={cn("bg-border -mx-1 my-1 h-px", className)}
213
- {...props}
214
- />
215
- )
216
- }
217
-
218
- function ContextMenuShortcut({
219
- className,
220
- ...props
221
- }: React.ComponentProps<"span">) {
222
- return (
223
- <span
224
- data-slot="context-menu-shortcut"
225
- className={cn(
226
- "text-muted-foreground ml-auto text-xs tracking-widest",
227
- className
228
- )}
229
- {...props}
230
- />
231
- )
232
- }
233
-
234
- export {
235
- ContextMenu,
236
- ContextMenuTrigger,
237
- ContextMenuContent,
238
- ContextMenuItem,
239
- ContextMenuCheckboxItem,
240
- ContextMenuRadioItem,
241
- ContextMenuLabel,
242
- ContextMenuSeparator,
243
- ContextMenuShortcut,
244
- ContextMenuGroup,
245
- ContextMenuPortal,
246
- ContextMenuSub,
247
- ContextMenuSubContent,
248
- ContextMenuSubTrigger,
249
- ContextMenuRadioGroup,
250
- }
@@ -1,66 +0,0 @@
1
-
2
-
3
- import { AIChatPlugin } from '@platejs/ai/react';
4
- import {
5
- type CursorData,
6
- type CursorOverlayState,
7
- useCursorOverlay,
8
- } from '@platejs/selection/react';
9
- import { RangeApi } from 'platejs';
10
- import { usePluginOption } from 'platejs/react';
11
-
12
- import { cn } from '@/lib/utils';
13
-
14
- export function CursorOverlay() {
15
- const { cursors } = useCursorOverlay();
16
-
17
- return (
18
- <>
19
- {cursors.map((cursor) => (
20
- <Cursor key={cursor.id} {...cursor} />
21
- ))}
22
- </>
23
- );
24
- }
25
-
26
- function Cursor({
27
- id,
28
- caretPosition,
29
- data,
30
- selection,
31
- selectionRects,
32
- }: CursorOverlayState<CursorData>) {
33
- const streaming = usePluginOption(AIChatPlugin, 'streaming');
34
- const { style, selectionStyle = style } = data ?? ({} as CursorData);
35
- const isCursor = RangeApi.isCollapsed(selection);
36
-
37
- if (streaming) return null;
38
-
39
- return (
40
- <>
41
- {selectionRects.map((position, i) => (
42
- <div
43
- key={i}
44
- className={cn(
45
- 'pointer-events-none absolute z-10',
46
- id === 'selection' && 'bg-brand/25',
47
- id === 'selection' && isCursor && 'bg-primary'
48
- )}
49
- style={{
50
- ...selectionStyle,
51
- ...position,
52
- }}
53
- />
54
- ))}
55
- {caretPosition && (
56
- <div
57
- className={cn(
58
- 'pointer-events-none absolute z-10 w-0.5',
59
- id === 'drag' && 'w-px bg-brand'
60
- )}
61
- style={{ ...caretPosition, ...style }}
62
- />
63
- )}
64
- </>
65
- );
66
- }
@@ -1,45 +0,0 @@
1
- import type { TDateElement } from 'platejs';
2
- import type { SlateElementProps } from 'platejs/static';
3
-
4
- import { SlateElement } from 'platejs/static';
5
-
6
- export function DateElementStatic(props: SlateElementProps<TDateElement>) {
7
- const { element } = props;
8
-
9
- return (
10
- <SlateElement className="inline-block" {...props}>
11
- <span className="w-fit rounded-sm bg-muted px-1 text-muted-foreground">
12
- {element.date ? (
13
- (() => {
14
- const today = new Date();
15
- const elementDate = new Date(element.date);
16
- const isToday =
17
- elementDate.getDate() === today.getDate() &&
18
- elementDate.getMonth() === today.getMonth() &&
19
- elementDate.getFullYear() === today.getFullYear();
20
-
21
- const isYesterday =
22
- new Date(today.setDate(today.getDate() - 1)).toDateString() ===
23
- elementDate.toDateString();
24
- const isTomorrow =
25
- new Date(today.setDate(today.getDate() + 2)).toDateString() ===
26
- elementDate.toDateString();
27
-
28
- if (isToday) return 'Today';
29
- if (isYesterday) return 'Yesterday';
30
- if (isTomorrow) return 'Tomorrow';
31
-
32
- return elementDate.toLocaleDateString(undefined, {
33
- day: 'numeric',
34
- month: 'long',
35
- year: 'numeric',
36
- });
37
- })()
38
- ) : (
39
- <span>Pick a date</span>
40
- )}
41
- </span>
42
- {props.children}
43
- </SlateElement>
44
- );
45
- }
@@ -1,93 +0,0 @@
1
- import type { TDateElement } from 'platejs';
2
- import type { PlateElementProps } from 'platejs/react';
3
-
4
- import { PlateElement, useReadOnly } from 'platejs/react';
5
-
6
- import { Calendar } from '@/components/ui/calendar';
7
- import {
8
- Popover,
9
- PopoverContent,
10
- PopoverTrigger,
11
- } from '@/components/ui/popover';
12
- import { cn } from '@/lib/utils';
13
-
14
- export function DateElement(props: PlateElementProps<TDateElement>) {
15
- const { editor, element } = props;
16
-
17
- const readOnly = useReadOnly();
18
-
19
- const trigger = (
20
- <span
21
- className={cn(
22
- 'w-fit cursor-pointer rounded-sm bg-muted px-1 text-muted-foreground'
23
- )}
24
- contentEditable={false}
25
- draggable
26
- >
27
- {element.date ? (
28
- (() => {
29
- const today = new Date();
30
- const elementDate = new Date(element.date);
31
- const isToday =
32
- elementDate.getDate() === today.getDate() &&
33
- elementDate.getMonth() === today.getMonth() &&
34
- elementDate.getFullYear() === today.getFullYear();
35
-
36
- const isYesterday =
37
- new Date(today.setDate(today.getDate() - 1)).toDateString() ===
38
- elementDate.toDateString();
39
- const isTomorrow =
40
- new Date(today.setDate(today.getDate() + 2)).toDateString() ===
41
- elementDate.toDateString();
42
-
43
- if (isToday) return 'Today';
44
- if (isYesterday) return 'Yesterday';
45
- if (isTomorrow) return 'Tomorrow';
46
-
47
- return elementDate.toLocaleDateString(undefined, {
48
- day: 'numeric',
49
- month: 'long',
50
- year: 'numeric',
51
- });
52
- })()
53
- ) : (
54
- <span>Pick a date</span>
55
- )}
56
- </span>
57
- );
58
-
59
- if (readOnly) {
60
- return trigger;
61
- }
62
-
63
- return (
64
- <PlateElement
65
- {...props}
66
- className="inline-block"
67
- attributes={{
68
- ...props.attributes,
69
- contentEditable: false,
70
- }}
71
- >
72
- <Popover>
73
- <PopoverTrigger asChild>{trigger}</PopoverTrigger>
74
- <PopoverContent className="w-auto p-0">
75
- <Calendar
76
- selected={new Date(element.date as string)}
77
- onSelect={(date) => {
78
- if (!date) return;
79
-
80
- editor.tf.setNodes(
81
- { date: date.toDateString() },
82
- { at: element }
83
- );
84
- }}
85
- mode="single"
86
- initialFocus
87
- />
88
- </PopoverContent>
89
- </Popover>
90
- {props.children}
91
- </PlateElement>
92
- );
93
- }
@@ -1,143 +0,0 @@
1
- "use client"
2
-
3
- import * as React from "react"
4
- import * as DialogPrimitive from "@radix-ui/react-dialog"
5
- import { XIcon } from "lucide-react"
6
-
7
- import { cn } from "@/lib/utils"
8
-
9
- function Dialog({
10
- ...props
11
- }: React.ComponentProps<typeof DialogPrimitive.Root>) {
12
- return <DialogPrimitive.Root data-slot="dialog" {...props} />
13
- }
14
-
15
- function DialogTrigger({
16
- ...props
17
- }: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
18
- return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />
19
- }
20
-
21
- function DialogPortal({
22
- ...props
23
- }: React.ComponentProps<typeof DialogPrimitive.Portal>) {
24
- return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />
25
- }
26
-
27
- function DialogClose({
28
- ...props
29
- }: React.ComponentProps<typeof DialogPrimitive.Close>) {
30
- return <DialogPrimitive.Close data-slot="dialog-close" {...props} />
31
- }
32
-
33
- function DialogOverlay({
34
- className,
35
- ...props
36
- }: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
37
- return (
38
- <DialogPrimitive.Overlay
39
- data-slot="dialog-overlay"
40
- className={cn(
41
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
42
- className
43
- )}
44
- {...props}
45
- />
46
- )
47
- }
48
-
49
- function DialogContent({
50
- className,
51
- children,
52
- showCloseButton = true,
53
- ...props
54
- }: React.ComponentProps<typeof DialogPrimitive.Content> & {
55
- showCloseButton?: boolean
56
- }) {
57
- return (
58
- <DialogPortal data-slot="dialog-portal">
59
- <DialogOverlay />
60
- <DialogPrimitive.Content
61
- data-slot="dialog-content"
62
- className={cn(
63
- "bg-background 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 outline-none sm:max-w-lg",
64
- className
65
- )}
66
- {...props}
67
- >
68
- {children}
69
- {showCloseButton && (
70
- <DialogPrimitive.Close
71
- data-slot="dialog-close"
72
- className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
73
- >
74
- <XIcon />
75
- <span className="sr-only">Close</span>
76
- </DialogPrimitive.Close>
77
- )}
78
- </DialogPrimitive.Content>
79
- </DialogPortal>
80
- )
81
- }
82
-
83
- function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
84
- return (
85
- <div
86
- data-slot="dialog-header"
87
- className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
88
- {...props}
89
- />
90
- )
91
- }
92
-
93
- function DialogFooter({ className, ...props }: React.ComponentProps<"div">) {
94
- return (
95
- <div
96
- data-slot="dialog-footer"
97
- className={cn(
98
- "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
99
- className
100
- )}
101
- {...props}
102
- />
103
- )
104
- }
105
-
106
- function DialogTitle({
107
- className,
108
- ...props
109
- }: React.ComponentProps<typeof DialogPrimitive.Title>) {
110
- return (
111
- <DialogPrimitive.Title
112
- data-slot="dialog-title"
113
- className={cn("text-lg leading-none font-semibold", className)}
114
- {...props}
115
- />
116
- )
117
- }
118
-
119
- function DialogDescription({
120
- className,
121
- ...props
122
- }: React.ComponentProps<typeof DialogPrimitive.Description>) {
123
- return (
124
- <DialogPrimitive.Description
125
- data-slot="dialog-description"
126
- className={cn("text-muted-foreground text-sm", className)}
127
- {...props}
128
- />
129
- )
130
- }
131
-
132
- export {
133
- Dialog,
134
- DialogClose,
135
- DialogContent,
136
- DialogDescription,
137
- DialogFooter,
138
- DialogHeader,
139
- DialogOverlay,
140
- DialogPortal,
141
- DialogTitle,
142
- DialogTrigger,
143
- }