doclific 0.1.0

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 (231) hide show
  1. package/.gitattributes +2 -0
  2. package/.prettierignore +5 -0
  3. package/.prettierrc +9 -0
  4. package/.vscode/settings.json +13 -0
  5. package/dist/bin/doclific.d.ts +3 -0
  6. package/dist/bin/doclific.d.ts.map +1 -0
  7. package/dist/bin/doclific.js +11 -0
  8. package/dist/core/codebase.js +31 -0
  9. package/dist/core/docs.js +75 -0
  10. package/dist/core/git.js +47 -0
  11. package/dist/server/index.d.ts +2 -0
  12. package/dist/server/index.d.ts.map +1 -0
  13. package/dist/server/index.js +46 -0
  14. package/dist/server/router.d.ts +9 -0
  15. package/dist/server/router.d.ts.map +1 -0
  16. package/dist/server/router.js +55 -0
  17. package/frontend/README.md +73 -0
  18. package/frontend/components.json +24 -0
  19. package/frontend/eslint.config.js +23 -0
  20. package/frontend/index.html +25 -0
  21. package/frontend/package-lock.json +15754 -0
  22. package/frontend/package.json +122 -0
  23. package/frontend/public/logo.svg +1 -0
  24. package/frontend/src/App.tsx +21 -0
  25. package/frontend/src/components/app-sidebar.tsx +393 -0
  26. package/frontend/src/components/editor/editor-base-kit.tsx +43 -0
  27. package/frontend/src/components/editor/editor-kit.tsx +93 -0
  28. package/frontend/src/components/editor/plugins/align-base-kit.tsx +16 -0
  29. package/frontend/src/components/editor/plugins/align-kit.tsx +18 -0
  30. package/frontend/src/components/editor/plugins/autoformat-kit.tsx +236 -0
  31. package/frontend/src/components/editor/plugins/basic-blocks-base-kit.tsx +35 -0
  32. package/frontend/src/components/editor/plugins/basic-blocks-kit.tsx +88 -0
  33. package/frontend/src/components/editor/plugins/basic-marks-base-kit.tsx +27 -0
  34. package/frontend/src/components/editor/plugins/basic-marks-kit.tsx +41 -0
  35. package/frontend/src/components/editor/plugins/basic-nodes-kit.tsx +6 -0
  36. package/frontend/src/components/editor/plugins/block-menu-kit.tsx +14 -0
  37. package/frontend/src/components/editor/plugins/block-placeholder-kit.tsx +17 -0
  38. package/frontend/src/components/editor/plugins/block-selection-kit.tsx +32 -0
  39. package/frontend/src/components/editor/plugins/callout-base-kit.tsx +7 -0
  40. package/frontend/src/components/editor/plugins/callout-kit.tsx +7 -0
  41. package/frontend/src/components/editor/plugins/code-block-base-kit.tsx +23 -0
  42. package/frontend/src/components/editor/plugins/code-block-kit.tsx +26 -0
  43. package/frontend/src/components/editor/plugins/codebase-kit.tsx +23 -0
  44. package/frontend/src/components/editor/plugins/column-base-kit.tsx +11 -0
  45. package/frontend/src/components/editor/plugins/column-kit.tsx +10 -0
  46. package/frontend/src/components/editor/plugins/comment-base-kit.tsx +7 -0
  47. package/frontend/src/components/editor/plugins/comment-kit.tsx +97 -0
  48. package/frontend/src/components/editor/plugins/cursor-overlay-kit.tsx +13 -0
  49. package/frontend/src/components/editor/plugins/date-base-kit.tsx +5 -0
  50. package/frontend/src/components/editor/plugins/date-kit.tsx +7 -0
  51. package/frontend/src/components/editor/plugins/discussion-kit.tsx +148 -0
  52. package/frontend/src/components/editor/plugins/dnd-kit.tsx +28 -0
  53. package/frontend/src/components/editor/plugins/docx-kit.tsx +6 -0
  54. package/frontend/src/components/editor/plugins/emoji-kit.tsx +13 -0
  55. package/frontend/src/components/editor/plugins/excalidraw-kit.tsx +9 -0
  56. package/frontend/src/components/editor/plugins/exit-break-kit.tsx +12 -0
  57. package/frontend/src/components/editor/plugins/floating-toolbar-kit.tsx +19 -0
  58. package/frontend/src/components/editor/plugins/font-base-kit.tsx +20 -0
  59. package/frontend/src/components/editor/plugins/font-kit.tsx +29 -0
  60. package/frontend/src/components/editor/plugins/indent-base-kit.tsx +19 -0
  61. package/frontend/src/components/editor/plugins/indent-kit.tsx +22 -0
  62. package/frontend/src/components/editor/plugins/line-height-base-kit.tsx +14 -0
  63. package/frontend/src/components/editor/plugins/line-height-kit.tsx +16 -0
  64. package/frontend/src/components/editor/plugins/link-base-kit.tsx +5 -0
  65. package/frontend/src/components/editor/plugins/link-kit.tsx +15 -0
  66. package/frontend/src/components/editor/plugins/list-base-kit.tsx +23 -0
  67. package/frontend/src/components/editor/plugins/list-kit.tsx +26 -0
  68. package/frontend/src/components/editor/plugins/markdown-kit.tsx +46 -0
  69. package/frontend/src/components/editor/plugins/math-base-kit.tsx +11 -0
  70. package/frontend/src/components/editor/plugins/math-kit.tsx +13 -0
  71. package/frontend/src/components/editor/plugins/media-base-kit.tsx +31 -0
  72. package/frontend/src/components/editor/plugins/media-kit.tsx +43 -0
  73. package/frontend/src/components/editor/plugins/mention-base-kit.tsx +7 -0
  74. package/frontend/src/components/editor/plugins/mention-kit.tsx +15 -0
  75. package/frontend/src/components/editor/plugins/slash-kit.tsx +18 -0
  76. package/frontend/src/components/editor/plugins/suggestion-base-kit.tsx +7 -0
  77. package/frontend/src/components/editor/plugins/suggestion-kit.tsx +90 -0
  78. package/frontend/src/components/editor/plugins/table-base-kit.tsx +20 -0
  79. package/frontend/src/components/editor/plugins/table-kit.tsx +22 -0
  80. package/frontend/src/components/editor/plugins/toc-base-kit.tsx +5 -0
  81. package/frontend/src/components/editor/plugins/toc-kit.tsx +14 -0
  82. package/frontend/src/components/editor/plugins/toggle-base-kit.tsx +7 -0
  83. package/frontend/src/components/editor/plugins/toggle-kit.tsx +11 -0
  84. package/frontend/src/components/editor/transforms.ts +194 -0
  85. package/frontend/src/components/markdown-to-slate-demo.tsx +50 -0
  86. package/frontend/src/components/mode-toggle.tsx +15 -0
  87. package/frontend/src/components/theme-provider.tsx +73 -0
  88. package/frontend/src/components/ui/alert-dialog.tsx +155 -0
  89. package/frontend/src/components/ui/align-toolbar-button.tsx +84 -0
  90. package/frontend/src/components/ui/avatar.tsx +51 -0
  91. package/frontend/src/components/ui/block-context-menu.tsx +199 -0
  92. package/frontend/src/components/ui/block-discussion.tsx +365 -0
  93. package/frontend/src/components/ui/block-draggable.tsx +512 -0
  94. package/frontend/src/components/ui/block-list-static.tsx +80 -0
  95. package/frontend/src/components/ui/block-list.tsx +87 -0
  96. package/frontend/src/components/ui/block-selection.tsx +42 -0
  97. package/frontend/src/components/ui/block-suggestion.tsx +473 -0
  98. package/frontend/src/components/ui/blockquote-node-static.tsx +11 -0
  99. package/frontend/src/components/ui/blockquote-node.tsx +13 -0
  100. package/frontend/src/components/ui/button.tsx +62 -0
  101. package/frontend/src/components/ui/calendar.tsx +218 -0
  102. package/frontend/src/components/ui/callout-node-static.tsx +36 -0
  103. package/frontend/src/components/ui/callout-node.tsx +63 -0
  104. package/frontend/src/components/ui/caption.tsx +63 -0
  105. package/frontend/src/components/ui/checkbox.tsx +30 -0
  106. package/frontend/src/components/ui/code-block-node-static.tsx +35 -0
  107. package/frontend/src/components/ui/code-block-node.tsx +287 -0
  108. package/frontend/src/components/ui/code-node-static.tsx +15 -0
  109. package/frontend/src/components/ui/code-node.tsx +17 -0
  110. package/frontend/src/components/ui/codebase-snippet-node.tsx +237 -0
  111. package/frontend/src/components/ui/column-node-static.tsx +29 -0
  112. package/frontend/src/components/ui/column-node.tsx +317 -0
  113. package/frontend/src/components/ui/command.tsx +182 -0
  114. package/frontend/src/components/ui/comment-node-static.tsx +15 -0
  115. package/frontend/src/components/ui/comment-node.tsx +45 -0
  116. package/frontend/src/components/ui/comment-toolbar-button.tsx +24 -0
  117. package/frontend/src/components/ui/comment.tsx +618 -0
  118. package/frontend/src/components/ui/context-menu.tsx +250 -0
  119. package/frontend/src/components/ui/cursor-overlay.tsx +66 -0
  120. package/frontend/src/components/ui/date-node-static.tsx +45 -0
  121. package/frontend/src/components/ui/date-node.tsx +93 -0
  122. package/frontend/src/components/ui/dialog.tsx +143 -0
  123. package/frontend/src/components/ui/dropdown-menu.tsx +255 -0
  124. package/frontend/src/components/ui/dynamic-icon.tsx +12 -0
  125. package/frontend/src/components/ui/editor-static.tsx +53 -0
  126. package/frontend/src/components/ui/editor.tsx +130 -0
  127. package/frontend/src/components/ui/emoji-node.tsx +69 -0
  128. package/frontend/src/components/ui/emoji-toolbar-button.tsx +628 -0
  129. package/frontend/src/components/ui/equation-node-static.tsx +98 -0
  130. package/frontend/src/components/ui/equation-node.tsx +235 -0
  131. package/frontend/src/components/ui/equation-toolbar-button.tsx +25 -0
  132. package/frontend/src/components/ui/excalidraw-node.tsx +36 -0
  133. package/frontend/src/components/ui/export-toolbar-button.tsx +174 -0
  134. package/frontend/src/components/ui/file-selector.tsx +339 -0
  135. package/frontend/src/components/ui/floating-toolbar-buttons.tsx +73 -0
  136. package/frontend/src/components/ui/floating-toolbar.tsx +85 -0
  137. package/frontend/src/components/ui/font-color-toolbar-button.tsx +831 -0
  138. package/frontend/src/components/ui/font-size-toolbar-button.tsx +152 -0
  139. package/frontend/src/components/ui/heading-node-static.tsx +68 -0
  140. package/frontend/src/components/ui/heading-node.tsx +58 -0
  141. package/frontend/src/components/ui/highlight-node-static.tsx +11 -0
  142. package/frontend/src/components/ui/highlight-node.tsx +13 -0
  143. package/frontend/src/components/ui/history-toolbar-button.tsx +50 -0
  144. package/frontend/src/components/ui/hr-node-static.tsx +20 -0
  145. package/frontend/src/components/ui/hr-node.tsx +33 -0
  146. package/frontend/src/components/ui/import-toolbar-button.tsx +97 -0
  147. package/frontend/src/components/ui/indent-toolbar-button.tsx +30 -0
  148. package/frontend/src/components/ui/inline-combobox.tsx +414 -0
  149. package/frontend/src/components/ui/input.tsx +21 -0
  150. package/frontend/src/components/ui/insert-toolbar-button.tsx +254 -0
  151. package/frontend/src/components/ui/kbd-node-static.tsx +15 -0
  152. package/frontend/src/components/ui/kbd-node.tsx +17 -0
  153. package/frontend/src/components/ui/layout-header.tsx +35 -0
  154. package/frontend/src/components/ui/line-height-toolbar-button.tsx +68 -0
  155. package/frontend/src/components/ui/link-node-static.tsx +21 -0
  156. package/frontend/src/components/ui/link-node.tsx +39 -0
  157. package/frontend/src/components/ui/link-toolbar-button.tsx +22 -0
  158. package/frontend/src/components/ui/link-toolbar.tsx +206 -0
  159. package/frontend/src/components/ui/list-toolbar-button.tsx +204 -0
  160. package/frontend/src/components/ui/mark-toolbar-button.tsx +19 -0
  161. package/frontend/src/components/ui/media-audio-node-static.tsx +17 -0
  162. package/frontend/src/components/ui/media-audio-node.tsx +39 -0
  163. package/frontend/src/components/ui/media-embed-node.tsx +136 -0
  164. package/frontend/src/components/ui/media-file-node-static.tsx +29 -0
  165. package/frontend/src/components/ui/media-file-node.tsx +47 -0
  166. package/frontend/src/components/ui/media-image-node-static.tsx +39 -0
  167. package/frontend/src/components/ui/media-image-node.tsx +80 -0
  168. package/frontend/src/components/ui/media-placeholder-node.tsx +249 -0
  169. package/frontend/src/components/ui/media-preview-dialog.tsx +152 -0
  170. package/frontend/src/components/ui/media-toolbar-button.tsx +225 -0
  171. package/frontend/src/components/ui/media-toolbar.tsx +115 -0
  172. package/frontend/src/components/ui/media-upload-toast.tsx +66 -0
  173. package/frontend/src/components/ui/media-video-node-static.tsx +30 -0
  174. package/frontend/src/components/ui/media-video-node.tsx +121 -0
  175. package/frontend/src/components/ui/mention-node-static.tsx +36 -0
  176. package/frontend/src/components/ui/mention-node.tsx +194 -0
  177. package/frontend/src/components/ui/mode-toolbar-button.tsx +123 -0
  178. package/frontend/src/components/ui/more-toolbar-button.tsx +80 -0
  179. package/frontend/src/components/ui/paragraph-node-static.tsx +13 -0
  180. package/frontend/src/components/ui/paragraph-node.tsx +15 -0
  181. package/frontend/src/components/ui/popover.tsx +46 -0
  182. package/frontend/src/components/ui/resize-handle.tsx +87 -0
  183. package/frontend/src/components/ui/separator.tsx +28 -0
  184. package/frontend/src/components/ui/sheet.tsx +139 -0
  185. package/frontend/src/components/ui/sidebar.tsx +726 -0
  186. package/frontend/src/components/ui/skeleton.tsx +13 -0
  187. package/frontend/src/components/ui/slash-node.tsx +233 -0
  188. package/frontend/src/components/ui/sonner.tsx +38 -0
  189. package/frontend/src/components/ui/suggestion-node-static.tsx +35 -0
  190. package/frontend/src/components/ui/suggestion-node.tsx +162 -0
  191. package/frontend/src/components/ui/suggestion-toolbar-button.tsx +25 -0
  192. package/frontend/src/components/ui/table-icons.tsx +862 -0
  193. package/frontend/src/components/ui/table-node-static.tsx +98 -0
  194. package/frontend/src/components/ui/table-node.tsx +656 -0
  195. package/frontend/src/components/ui/table-toolbar-button.tsx +264 -0
  196. package/frontend/src/components/ui/toc-node-static.tsx +92 -0
  197. package/frontend/src/components/ui/toc-node.tsx +55 -0
  198. package/frontend/src/components/ui/toggle-node-static.tsx +18 -0
  199. package/frontend/src/components/ui/toggle-node.tsx +36 -0
  200. package/frontend/src/components/ui/toggle-toolbar-button.tsx +22 -0
  201. package/frontend/src/components/ui/toolbar.tsx +387 -0
  202. package/frontend/src/components/ui/tooltip.tsx +59 -0
  203. package/frontend/src/components/ui/turn-into-toolbar-button.tsx +188 -0
  204. package/frontend/src/hooks/use-debounce.ts +18 -0
  205. package/frontend/src/hooks/use-is-touch-device.ts +24 -0
  206. package/frontend/src/hooks/use-mobile.ts +19 -0
  207. package/frontend/src/hooks/use-mounted.ts +11 -0
  208. package/frontend/src/hooks/use-upload-file.ts +128 -0
  209. package/frontend/src/index.css +128 -0
  210. package/frontend/src/layout.tsx +42 -0
  211. package/frontend/src/lib/markdown-joiner-transform.ts +239 -0
  212. package/frontend/src/lib/orpc.ts +13 -0
  213. package/frontend/src/lib/uploadthing.ts +19 -0
  214. package/frontend/src/lib/utils.ts +6 -0
  215. package/frontend/src/main.tsx +13 -0
  216. package/frontend/src/pages/editor.tsx +44 -0
  217. package/frontend/src/types/docs.d.ts +6 -0
  218. package/frontend/src/types/global.d.ts +9 -0
  219. package/frontend/src/types/router.d.ts +4 -0
  220. package/frontend/tsconfig.app.json +33 -0
  221. package/frontend/tsconfig.json +10 -0
  222. package/frontend/tsconfig.node.json +26 -0
  223. package/frontend/vite.config.ts +14 -0
  224. package/package.json +30 -0
  225. package/src/bin/doclific.ts +17 -0
  226. package/src/core/codebase.ts +39 -0
  227. package/src/core/docs.ts +90 -0
  228. package/src/core/git.ts +48 -0
  229. package/src/server/index.ts +55 -0
  230. package/src/server/router.ts +65 -0
  231. package/tsconfig.json +15 -0
@@ -0,0 +1,218 @@
1
+ import * as React from "react"
2
+ import {
3
+ ChevronDownIcon,
4
+ ChevronLeftIcon,
5
+ ChevronRightIcon,
6
+ } from "lucide-react"
7
+ import {
8
+ DayPicker,
9
+ getDefaultClassNames,
10
+ type DayButton,
11
+ } from "react-day-picker"
12
+
13
+ import { cn } from "@/lib/utils"
14
+ import { Button, buttonVariants } from "@/components/ui/button"
15
+
16
+ function Calendar({
17
+ className,
18
+ classNames,
19
+ showOutsideDays = true,
20
+ captionLayout = "label",
21
+ buttonVariant = "ghost",
22
+ formatters,
23
+ components,
24
+ ...props
25
+ }: React.ComponentProps<typeof DayPicker> & {
26
+ buttonVariant?: React.ComponentProps<typeof Button>["variant"]
27
+ }) {
28
+ const defaultClassNames = getDefaultClassNames()
29
+
30
+ return (
31
+ <DayPicker
32
+ showOutsideDays={showOutsideDays}
33
+ className={cn(
34
+ "bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
35
+ String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
36
+ String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
37
+ className
38
+ )}
39
+ captionLayout={captionLayout}
40
+ formatters={{
41
+ formatMonthDropdown: (date) =>
42
+ date.toLocaleString("default", { month: "short" }),
43
+ ...formatters,
44
+ }}
45
+ classNames={{
46
+ root: cn("w-fit", defaultClassNames.root),
47
+ months: cn(
48
+ "flex gap-4 flex-col md:flex-row relative",
49
+ defaultClassNames.months
50
+ ),
51
+ month: cn("flex flex-col w-full gap-4", defaultClassNames.month),
52
+ nav: cn(
53
+ "flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",
54
+ defaultClassNames.nav
55
+ ),
56
+ button_previous: cn(
57
+ buttonVariants({ variant: buttonVariant }),
58
+ "size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",
59
+ defaultClassNames.button_previous
60
+ ),
61
+ button_next: cn(
62
+ buttonVariants({ variant: buttonVariant }),
63
+ "size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",
64
+ defaultClassNames.button_next
65
+ ),
66
+ month_caption: cn(
67
+ "flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",
68
+ defaultClassNames.month_caption
69
+ ),
70
+ dropdowns: cn(
71
+ "w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",
72
+ defaultClassNames.dropdowns
73
+ ),
74
+ dropdown_root: cn(
75
+ "relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",
76
+ defaultClassNames.dropdown_root
77
+ ),
78
+ dropdown: cn(
79
+ "absolute bg-popover inset-0 opacity-0",
80
+ defaultClassNames.dropdown
81
+ ),
82
+ caption_label: cn(
83
+ "select-none font-medium",
84
+ captionLayout === "label"
85
+ ? "text-sm"
86
+ : "rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5",
87
+ defaultClassNames.caption_label
88
+ ),
89
+ table: "w-full border-collapse",
90
+ weekdays: cn("flex", defaultClassNames.weekdays),
91
+ weekday: cn(
92
+ "text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",
93
+ defaultClassNames.weekday
94
+ ),
95
+ week: cn("flex w-full mt-2", defaultClassNames.week),
96
+ week_number_header: cn(
97
+ "select-none w-(--cell-size)",
98
+ defaultClassNames.week_number_header
99
+ ),
100
+ week_number: cn(
101
+ "text-[0.8rem] select-none text-muted-foreground",
102
+ defaultClassNames.week_number
103
+ ),
104
+ day: cn(
105
+ "relative w-full h-full p-0 text-center [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none",
106
+ props.showWeekNumber
107
+ ? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-md"
108
+ : "[&:first-child[data-selected=true]_button]:rounded-l-md",
109
+ defaultClassNames.day
110
+ ),
111
+ range_start: cn(
112
+ "rounded-l-md bg-accent",
113
+ defaultClassNames.range_start
114
+ ),
115
+ range_middle: cn("rounded-none", defaultClassNames.range_middle),
116
+ range_end: cn("rounded-r-md bg-accent", defaultClassNames.range_end),
117
+ today: cn(
118
+ "bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",
119
+ defaultClassNames.today
120
+ ),
121
+ outside: cn(
122
+ "text-muted-foreground aria-selected:text-muted-foreground",
123
+ defaultClassNames.outside
124
+ ),
125
+ disabled: cn(
126
+ "text-muted-foreground opacity-50",
127
+ defaultClassNames.disabled
128
+ ),
129
+ hidden: cn("invisible", defaultClassNames.hidden),
130
+ ...classNames,
131
+ }}
132
+ components={{
133
+ Root: ({ className, rootRef, ...props }) => {
134
+ return (
135
+ <div
136
+ data-slot="calendar"
137
+ ref={rootRef}
138
+ className={cn(className)}
139
+ {...props}
140
+ />
141
+ )
142
+ },
143
+ Chevron: ({ className, orientation, ...props }) => {
144
+ if (orientation === "left") {
145
+ return (
146
+ <ChevronLeftIcon className={cn("size-4", className)} {...props} />
147
+ )
148
+ }
149
+
150
+ if (orientation === "right") {
151
+ return (
152
+ <ChevronRightIcon
153
+ className={cn("size-4", className)}
154
+ {...props}
155
+ />
156
+ )
157
+ }
158
+
159
+ return (
160
+ <ChevronDownIcon className={cn("size-4", className)} {...props} />
161
+ )
162
+ },
163
+ DayButton: CalendarDayButton,
164
+ WeekNumber: ({ children, ...props }) => {
165
+ return (
166
+ <td {...props}>
167
+ <div className="flex size-(--cell-size) items-center justify-center text-center">
168
+ {children}
169
+ </div>
170
+ </td>
171
+ )
172
+ },
173
+ ...components,
174
+ }}
175
+ {...props}
176
+ />
177
+ )
178
+ }
179
+
180
+ function CalendarDayButton({
181
+ className,
182
+ day,
183
+ modifiers,
184
+ ...props
185
+ }: React.ComponentProps<typeof DayButton>) {
186
+ const defaultClassNames = getDefaultClassNames()
187
+
188
+ const ref = React.useRef<HTMLButtonElement>(null)
189
+ React.useEffect(() => {
190
+ if (modifiers.focused) ref.current?.focus()
191
+ }, [modifiers.focused])
192
+
193
+ return (
194
+ <Button
195
+ ref={ref}
196
+ variant="ghost"
197
+ size="icon"
198
+ data-day={day.date.toLocaleDateString()}
199
+ data-selected-single={
200
+ modifiers.selected &&
201
+ !modifiers.range_start &&
202
+ !modifiers.range_end &&
203
+ !modifiers.range_middle
204
+ }
205
+ data-range-start={modifiers.range_start}
206
+ data-range-end={modifiers.range_end}
207
+ data-range-middle={modifiers.range_middle}
208
+ className={cn(
209
+ "data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70",
210
+ defaultClassNames.day,
211
+ className
212
+ )}
213
+ {...props}
214
+ />
215
+ )
216
+ }
217
+
218
+ export { Calendar, CalendarDayButton }
@@ -0,0 +1,36 @@
1
+ import type { SlateElementProps } from 'platejs/static';
2
+
3
+ import { SlateElement } from 'platejs/static';
4
+
5
+ import { cn } from '@/lib/utils';
6
+
7
+ export function CalloutElementStatic({
8
+ children,
9
+ className,
10
+ ...props
11
+ }: SlateElementProps) {
12
+ return (
13
+ <SlateElement
14
+ className={cn('my-1 flex rounded-sm bg-muted p-4 pl-3', className)}
15
+ style={{
16
+ backgroundColor: props.element.backgroundColor as any,
17
+ }}
18
+ {...props}
19
+ >
20
+ <div className="flex w-full gap-2 rounded-md">
21
+ <div
22
+ className="size-6 select-none text-[18px]"
23
+ style={{
24
+ fontFamily:
25
+ '"Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Noto Color Emoji", "Segoe UI Symbol", "Android Emoji", EmojiSymbols',
26
+ }}
27
+ >
28
+ <span data-plate-prevent-deserialization>
29
+ {(props.element.icon as any) || '💡'}
30
+ </span>
31
+ </div>
32
+ <div className="w-full">{children}</div>
33
+ </div>
34
+ </SlateElement>
35
+ );
36
+ }
@@ -0,0 +1,63 @@
1
+
2
+
3
+ import { useCalloutEmojiPicker } from '@platejs/callout/react';
4
+ import { useEmojiDropdownMenuState } from '@platejs/emoji/react';
5
+ import { PlateElement } from 'platejs/react';
6
+
7
+ import { Button } from '@/components/ui/button';
8
+ import { cn } from '@/lib/utils';
9
+
10
+ import { EmojiPicker, EmojiPopover } from './emoji-toolbar-button';
11
+
12
+ export function CalloutElement({
13
+ attributes,
14
+ children,
15
+ className,
16
+ ...props
17
+ }: React.ComponentProps<typeof PlateElement>) {
18
+ const { emojiPickerState, isOpen, setIsOpen } = useEmojiDropdownMenuState({
19
+ closeOnSelect: true,
20
+ });
21
+
22
+ const { emojiToolbarDropdownProps, props: calloutProps } =
23
+ useCalloutEmojiPicker({
24
+ isOpen,
25
+ setIsOpen,
26
+ });
27
+
28
+ return (
29
+ <PlateElement
30
+ className={cn('my-1 flex rounded-sm bg-muted p-4 pl-3', className)}
31
+ style={{
32
+ backgroundColor: props.element.backgroundColor as any,
33
+ }}
34
+ attributes={{
35
+ ...attributes,
36
+ 'data-plate-open-context-menu': true,
37
+ }}
38
+ {...props}
39
+ >
40
+ <div className="flex w-full gap-2 rounded-md">
41
+ <EmojiPopover
42
+ {...emojiToolbarDropdownProps}
43
+ control={
44
+ <Button
45
+ variant="ghost"
46
+ className="size-6 select-none p-1 text-[18px] hover:bg-muted-foreground/15"
47
+ style={{
48
+ fontFamily:
49
+ '"Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Noto Color Emoji", "Segoe UI Symbol", "Android Emoji", EmojiSymbols',
50
+ }}
51
+ contentEditable={false}
52
+ >
53
+ {(props.element.icon as any) || '💡'}
54
+ </Button>
55
+ }
56
+ >
57
+ <EmojiPicker {...emojiPickerState} {...calloutProps} />
58
+ </EmojiPopover>
59
+ <div className="w-full">{children}</div>
60
+ </div>
61
+ </PlateElement>
62
+ );
63
+ }
@@ -0,0 +1,63 @@
1
+
2
+
3
+ import type { VariantProps } from 'class-variance-authority';
4
+
5
+ import {
6
+ Caption as CaptionPrimitive,
7
+ CaptionTextarea as CaptionTextareaPrimitive,
8
+ useCaptionButton,
9
+ useCaptionButtonState,
10
+ } from '@platejs/caption/react';
11
+ import { createPrimitiveComponent } from '@udecode/cn';
12
+ import { cva } from 'class-variance-authority';
13
+
14
+ import { Button } from '@/components/ui/button';
15
+ import { cn } from '@/lib/utils';
16
+
17
+ const captionVariants = cva('max-w-full', {
18
+ defaultVariants: {
19
+ align: 'center',
20
+ },
21
+ variants: {
22
+ align: {
23
+ center: 'mx-auto',
24
+ left: 'mr-auto',
25
+ right: 'ml-auto',
26
+ },
27
+ },
28
+ });
29
+
30
+ export function Caption({
31
+ align,
32
+ className,
33
+ ...props
34
+ }: React.ComponentProps<typeof CaptionPrimitive> &
35
+ VariantProps<typeof captionVariants>) {
36
+ return (
37
+ <CaptionPrimitive
38
+ {...props}
39
+ className={cn(captionVariants({ align }), className)}
40
+ />
41
+ );
42
+ }
43
+
44
+ export function CaptionTextarea(
45
+ props: React.ComponentProps<typeof CaptionTextareaPrimitive>
46
+ ) {
47
+ return (
48
+ <CaptionTextareaPrimitive
49
+ {...props}
50
+ className={cn(
51
+ 'mt-2 w-full resize-none border-none bg-inherit p-0 font-[inherit] text-inherit',
52
+ 'focus:outline-none focus:[&::placeholder]:opacity-0',
53
+ 'text-center print:placeholder:text-transparent',
54
+ props.className
55
+ )}
56
+ />
57
+ );
58
+ }
59
+
60
+ export const CaptionButton = createPrimitiveComponent(Button)({
61
+ propsHook: useCaptionButton,
62
+ stateHook: useCaptionButtonState,
63
+ });
@@ -0,0 +1,30 @@
1
+ import * as React from "react"
2
+ import * as CheckboxPrimitive from "@radix-ui/react-checkbox"
3
+ import { CheckIcon } from "lucide-react"
4
+
5
+ import { cn } from "@/lib/utils"
6
+
7
+ function Checkbox({
8
+ className,
9
+ ...props
10
+ }: React.ComponentProps<typeof CheckboxPrimitive.Root>) {
11
+ return (
12
+ <CheckboxPrimitive.Root
13
+ data-slot="checkbox"
14
+ className={cn(
15
+ "peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
16
+ className
17
+ )}
18
+ {...props}
19
+ >
20
+ <CheckboxPrimitive.Indicator
21
+ data-slot="checkbox-indicator"
22
+ className="grid place-content-center text-current transition-none"
23
+ >
24
+ <CheckIcon className="size-3.5" />
25
+ </CheckboxPrimitive.Indicator>
26
+ </CheckboxPrimitive.Root>
27
+ )
28
+ }
29
+
30
+ export { Checkbox }
@@ -0,0 +1,35 @@
1
+ import type { TCodeBlockElement } from 'platejs';
2
+
3
+ import {
4
+ type SlateElementProps,
5
+ type SlateLeafProps,
6
+ SlateElement,
7
+ SlateLeaf,
8
+ } from 'platejs/static';
9
+
10
+ export function CodeBlockElementStatic(
11
+ props: SlateElementProps<TCodeBlockElement>
12
+ ) {
13
+ return (
14
+ <SlateElement
15
+ className="py-1 **:[.hljs-addition]:bg-[#f0fff4] **:[.hljs-addition]:text-[#22863a] dark:**:[.hljs-addition]:bg-[#3c5743] dark:**:[.hljs-addition]:text-[#ceead5] **:[.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable]:text-[#005cc5] dark:**:[.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable]:text-[#6596cf] **:[.hljs-built\\\\_in,.hljs-symbol]:text-[#e36209] dark:**:[.hljs-built\\\\_in,.hljs-symbol]:text-[#c3854e] **:[.hljs-bullet]:text-[#735c0f] **:[.hljs-comment,.hljs-code,.hljs-formula]:text-[#6a737d] dark:**:[.hljs-comment,.hljs-code,.hljs-formula]:text-[#6a737d] **:[.hljs-deletion]:bg-[#ffeef0] **:[.hljs-deletion]:text-[#b31d28] dark:**:[.hljs-deletion]:bg-[#473235] dark:**:[.hljs-deletion]:text-[#e7c7cb] **:[.hljs-emphasis]:italic **:[.hljs-keyword,.hljs-doctag,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language\\\\_]:text-[#d73a49] dark:**:[.hljs-keyword,.hljs-doctag,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language\\\\_]:text-[#ee6960] **:[.hljs-name,.hljs-quote,.hljs-selector-tag,.hljs-selector-pseudo]:text-[#22863a] dark:**:[.hljs-name,.hljs-quote,.hljs-selector-tag,.hljs-selector-pseudo]:text-[#36a84f] **:[.hljs-regexp,.hljs-string,.hljs-meta_.hljs-string]:text-[#032f62] dark:**:[.hljs-regexp,.hljs-string,.hljs-meta_.hljs-string]:text-[#3593ff] **:[.hljs-section]:font-bold **:[.hljs-section]:text-[#005cc5] dark:**:[.hljs-section]:text-[#61a5f2] **:[.hljs-strong]:font-bold **:[.hljs-title,.hljs-title.class\\\\_,.hljs-title.class\\\\_.inherited\\\\_\\\\_,.hljs-title.function\\\\_]:text-[#6f42c1] dark:**:[.hljs-title,.hljs-title.class\\\\_,.hljs-title.class\\\\_.inherited\\\\_\\\\_,.hljs-title.function\\\\_]:text-[#a77bfa]"
16
+ {...props}
17
+ >
18
+ <div className="relative rounded-md bg-muted/50">
19
+ <pre className="overflow-x-auto p-8 pr-4 font-mono text-sm leading-[normal] [tab-size:2] print:break-inside-avoid">
20
+ <code>{props.children}</code>
21
+ </pre>
22
+ </div>
23
+ </SlateElement>
24
+ );
25
+ }
26
+
27
+ export function CodeLineElementStatic(props: SlateElementProps) {
28
+ return <SlateElement {...props} />;
29
+ }
30
+
31
+ export function CodeSyntaxLeafStatic(props: SlateLeafProps) {
32
+ const tokenClassName = props.leaf.className as string;
33
+
34
+ return <SlateLeaf className={tokenClassName} {...props} />;
35
+ }