doclific 0.2.0 → 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 +11 -4
  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,128 +0,0 @@
1
- import * as React from 'react';
2
-
3
- import type { OurFileRouter } from '@/lib/uploadthing';
4
- import type {
5
- ClientUploadedFileData,
6
- UploadFilesOptions,
7
- } from 'uploadthing/types';
8
-
9
- import { generateReactHelpers } from '@uploadthing/react';
10
- import { toast } from 'sonner';
11
- import { z } from 'zod';
12
-
13
- export type UploadedFile<T = unknown> = ClientUploadedFileData<T>;
14
-
15
- interface UseUploadFileProps
16
- extends Pick<
17
- UploadFilesOptions<OurFileRouter['editorUploader']>,
18
- 'headers' | 'onUploadBegin' | 'onUploadProgress' | 'skipPolling'
19
- > {
20
- onUploadComplete?: (file: UploadedFile) => void;
21
- onUploadError?: (error: unknown) => void;
22
- }
23
-
24
- export function useUploadFile({
25
- onUploadComplete,
26
- onUploadError,
27
- ...props
28
- }: UseUploadFileProps = {}) {
29
- const [uploadedFile, setUploadedFile] = React.useState<UploadedFile>();
30
- const [uploadingFile, setUploadingFile] = React.useState<File>();
31
- const [progress, setProgress] = React.useState<number>(0);
32
- const [isUploading, setIsUploading] = React.useState(false);
33
-
34
- async function uploadThing(file: File) {
35
- setIsUploading(true);
36
- setUploadingFile(file);
37
-
38
- try {
39
- const res = await uploadFiles('editorUploader', {
40
- ...props,
41
- files: [file],
42
- onUploadProgress: ({ progress }) => {
43
- setProgress(Math.min(progress, 100));
44
- },
45
- });
46
-
47
- setUploadedFile(res[0]);
48
-
49
- onUploadComplete?.(res[0]);
50
-
51
- return uploadedFile;
52
- } catch (error) {
53
- const errorMessage = getErrorMessage(error);
54
-
55
- const message =
56
- errorMessage.length > 0
57
- ? errorMessage
58
- : 'Something went wrong, please try again later.';
59
-
60
- toast.error(message);
61
-
62
- onUploadError?.(error);
63
-
64
- // Mock upload for unauthenticated users
65
- // toast.info('User not logged in. Mocking upload process.');
66
- const mockUploadedFile = {
67
- key: 'mock-key-0',
68
- appUrl: `https://mock-app-url.com/${file.name}`,
69
- name: file.name,
70
- size: file.size,
71
- type: file.type,
72
- url: URL.createObjectURL(file),
73
- } as UploadedFile;
74
-
75
- // Simulate upload progress
76
- let progress = 0;
77
-
78
- const simulateProgress = async () => {
79
- while (progress < 100) {
80
- await new Promise((resolve) => setTimeout(resolve, 50));
81
- progress += 2;
82
- setProgress(Math.min(progress, 100));
83
- }
84
- };
85
-
86
- await simulateProgress();
87
-
88
- setUploadedFile(mockUploadedFile);
89
-
90
- return mockUploadedFile;
91
- } finally {
92
- setProgress(0);
93
- setIsUploading(false);
94
- setUploadingFile(undefined);
95
- }
96
- }
97
-
98
- return {
99
- isUploading,
100
- progress,
101
- uploadedFile,
102
- uploadFile: uploadThing,
103
- uploadingFile,
104
- };
105
- }
106
-
107
- export const { uploadFiles, useUploadThing } =
108
- generateReactHelpers<OurFileRouter>();
109
-
110
- export function getErrorMessage(err: unknown) {
111
- const unknownError = 'Something went wrong, please try again later.';
112
-
113
- if (err instanceof z.ZodError) {
114
- const errors = err.issues.map((issue) => issue.message);
115
-
116
- return errors.join('\n');
117
- }
118
- if (err instanceof Error) {
119
- return err.message;
120
- }
121
- return unknownError;
122
- }
123
-
124
- export function showErrorToast(err: unknown) {
125
- const errorMessage = getErrorMessage(err);
126
-
127
- return toast.error(errorMessage);
128
- }
@@ -1,128 +0,0 @@
1
- @import 'tailwindcss';
2
-
3
- @plugin 'tailwind-scrollbar-hide';
4
- @import "tw-animate-css";
5
-
6
- @custom-variant dark (&:is(.dark *));
7
-
8
- @theme inline {
9
- --radius-sm: calc(var(--radius) - 4px);
10
- --radius-md: calc(var(--radius) - 2px);
11
- --radius-lg: var(--radius);
12
- --radius-xl: calc(var(--radius) + 4px);
13
- --color-background: var(--background);
14
- --color-foreground: var(--foreground);
15
- --color-card: var(--card);
16
- --color-card-foreground: var(--card-foreground);
17
- --color-popover: var(--popover);
18
- --color-popover-foreground: var(--popover-foreground);
19
- --color-primary: var(--primary);
20
- --color-primary-foreground: var(--primary-foreground);
21
- --color-secondary: var(--secondary);
22
- --color-secondary-foreground: var(--secondary-foreground);
23
- --color-muted: var(--muted);
24
- --color-muted-foreground: var(--muted-foreground);
25
- --color-accent: var(--accent);
26
- --color-accent-foreground: var(--accent-foreground);
27
- --color-destructive: var(--destructive);
28
- --color-border: var(--border);
29
- --color-input: var(--input);
30
- --color-ring: var(--ring);
31
- --color-chart-1: var(--chart-1);
32
- --color-chart-2: var(--chart-2);
33
- --color-chart-3: var(--chart-3);
34
- --color-chart-4: var(--chart-4);
35
- --color-chart-5: var(--chart-5);
36
- --color-sidebar: var(--sidebar);
37
- --color-sidebar-foreground: var(--sidebar-foreground);
38
- --color-sidebar-primary: var(--sidebar-primary);
39
- --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
40
- --color-sidebar-accent: var(--sidebar-accent);
41
- --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
42
- --color-sidebar-border: var(--sidebar-border);
43
- --color-sidebar-ring: var(--sidebar-ring);
44
- --color-brand: var(--brand);
45
- --color-highlight: var(--highlight);
46
- }
47
-
48
- :root {
49
- --radius: 0.625rem;
50
- --background: oklch(1 0 0);
51
- --foreground: oklch(0.141 0.005 285.823);
52
- --card: oklch(1 0 0);
53
- --card-foreground: oklch(0.141 0.005 285.823);
54
- --popover: oklch(1 0 0);
55
- --popover-foreground: oklch(0.141 0.005 285.823);
56
- --primary: oklch(0.21 0.006 285.885);
57
- --primary-foreground: oklch(0.985 0 0);
58
- --secondary: oklch(0.967 0.001 286.375);
59
- --secondary-foreground: oklch(0.21 0.006 285.885);
60
- --muted: oklch(0.967 0.001 286.375);
61
- --muted-foreground: oklch(0.552 0.016 285.938);
62
- --accent: oklch(0.967 0.001 286.375);
63
- --accent-foreground: oklch(0.21 0.006 285.885);
64
- --destructive: oklch(0.577 0.245 27.325);
65
- --border: oklch(0.92 0.004 286.32);
66
- --input: oklch(0.92 0.004 286.32);
67
- --ring: oklch(0.705 0.015 286.067);
68
- --chart-1: oklch(0.646 0.222 41.116);
69
- --chart-2: oklch(0.6 0.118 184.704);
70
- --chart-3: oklch(0.398 0.07 227.392);
71
- --chart-4: oklch(0.828 0.189 84.429);
72
- --chart-5: oklch(0.769 0.188 70.08);
73
- --sidebar: oklch(0.985 0 0);
74
- --sidebar-foreground: oklch(0.141 0.005 285.823);
75
- --sidebar-primary: oklch(0.21 0.006 285.885);
76
- --sidebar-primary-foreground: oklch(0.985 0 0);
77
- --sidebar-accent: oklch(0.967 0.001 286.375);
78
- --sidebar-accent-foreground: oklch(0.21 0.006 285.885);
79
- --sidebar-border: oklch(0.92 0.004 286.32);
80
- --sidebar-ring: oklch(0.705 0.015 286.067);
81
- --brand: oklch(0.623 0.214 259.815);
82
- --highlight: oklch(0.852 0.199 91.936);
83
- }
84
-
85
- .dark {
86
- --background: oklch(0.141 0.005 285.823);
87
- --foreground: oklch(0.985 0 0);
88
- --card: oklch(0.21 0.006 285.885);
89
- --card-foreground: oklch(0.985 0 0);
90
- --popover: oklch(0.21 0.006 285.885);
91
- --popover-foreground: oklch(0.985 0 0);
92
- --primary: oklch(0.92 0.004 286.32);
93
- --primary-foreground: oklch(0.21 0.006 285.885);
94
- --secondary: oklch(0.274 0.006 286.033);
95
- --secondary-foreground: oklch(0.985 0 0);
96
- --muted: oklch(0.274 0.006 286.033);
97
- --muted-foreground: oklch(0.705 0.015 286.067);
98
- --accent: oklch(0.274 0.006 286.033);
99
- --accent-foreground: oklch(0.985 0 0);
100
- --destructive: oklch(0.704 0.191 22.216);
101
- --border: oklch(1 0 0 / 10%);
102
- --input: oklch(1 0 0 / 15%);
103
- --ring: oklch(0.552 0.016 285.938);
104
- --chart-1: oklch(0.488 0.243 264.376);
105
- --chart-2: oklch(0.696 0.17 162.48);
106
- --chart-3: oklch(0.769 0.188 70.08);
107
- --chart-4: oklch(0.627 0.265 303.9);
108
- --chart-5: oklch(0.645 0.246 16.439);
109
- --sidebar: oklch(0.21 0.006 285.885);
110
- --sidebar-foreground: oklch(0.985 0 0);
111
- --sidebar-primary: oklch(0.488 0.243 264.376);
112
- --sidebar-primary-foreground: oklch(0.985 0 0);
113
- --sidebar-accent: oklch(0.274 0.006 286.033);
114
- --sidebar-accent-foreground: oklch(0.985 0 0);
115
- --sidebar-border: oklch(1 0 0 / 10%);
116
- --sidebar-ring: oklch(0.552 0.016 285.938);
117
- --brand: oklch(0.707 0.165 254.624);
118
- --highlight: oklch(0.852 0.199 91.936);
119
- }
120
-
121
- @layer base {
122
- * {
123
- @apply border-border outline-ring/50;
124
- }
125
- body {
126
- @apply bg-background text-foreground;
127
- }
128
- }
@@ -1,42 +0,0 @@
1
- import { SidebarInset, SidebarProvider, SidebarTrigger } from "@/components/ui/sidebar"
2
- import { AppSidebar } from "@/components/app-sidebar"
3
- import { Separator } from "@radix-ui/react-separator"
4
- import { QueryClient, QueryClientProvider } from "@tanstack/react-query"
5
- import { ModeToggle } from "./components/mode-toggle"
6
- import { LayoutHeader } from "./components/ui/layout-header"
7
-
8
- const queryClient = new QueryClient()
9
-
10
-
11
- export default function Layout({ children }: { children: React.ReactNode }) {
12
-
13
- return (
14
- <QueryClientProvider client={queryClient}>
15
- <SidebarProvider style={
16
- {
17
- "--sidebar-width": "calc(var(--spacing) * 72)",
18
- "--header-height": "calc(var(--spacing) * 12)",
19
- } as React.CSSProperties
20
- }>
21
- <AppSidebar />
22
- <SidebarInset className="overflow-hidden">
23
- <header className="flex h-(--header-height) shrink-0 items-center gap-2 border-b transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-(--header-height)">
24
- <div className="flex w-full items-center justify-between gap-1 px-4 lg:gap-2 lg:px-6">
25
- <div className="flex items-center gap-1 lg:gap-2">
26
- <SidebarTrigger className="-ml-1" />
27
- <Separator
28
- orientation="vertical"
29
- className="mx-2 data-[orientation=vertical]:h-4"
30
- />
31
- <LayoutHeader />
32
- </div>
33
-
34
- <ModeToggle />
35
- </div>
36
- </header>
37
- {children}
38
- </SidebarInset>
39
- </SidebarProvider>
40
- </QueryClientProvider>
41
- )
42
- }
@@ -1,239 +0,0 @@
1
- import type { TextStreamPart, ToolSet } from 'ai';
2
-
3
- /**
4
- * Transform chunks like [**,bold,**] to [**bold**] make the md deserializer
5
- * happy.
6
- *
7
- * @experimental
8
- */
9
- export const markdownJoinerTransform =
10
- <TOOLS extends ToolSet>() =>
11
- () => {
12
- const joiner = new MarkdownJoiner();
13
- let lastTextDeltaId: string | undefined;
14
- let textStreamEnded = false;
15
-
16
- return new TransformStream<TextStreamPart<TOOLS>, TextStreamPart<TOOLS>>({
17
- async flush(controller) {
18
- // Only flush if we haven't seen text-end yet
19
- if (!textStreamEnded) {
20
- const remaining = joiner.flush();
21
- if (remaining && lastTextDeltaId) {
22
- controller.enqueue({
23
- id: lastTextDeltaId,
24
- text: remaining,
25
- type: 'text-delta',
26
- } as TextStreamPart<TOOLS>);
27
- }
28
- }
29
- },
30
- async transform(chunk, controller) {
31
- if (chunk.type === 'text-delta') {
32
- lastTextDeltaId = chunk.id;
33
- const processedText = joiner.processText(chunk.text);
34
- if (processedText) {
35
- controller.enqueue({
36
- ...chunk,
37
- text: processedText,
38
- });
39
- await delay(joiner.delayInMs);
40
- }
41
- } else if (chunk.type === 'text-end') {
42
- // Flush any remaining buffer before text-end
43
- const remaining = joiner.flush();
44
- if (remaining && lastTextDeltaId) {
45
- controller.enqueue({
46
- id: lastTextDeltaId,
47
- text: remaining,
48
- type: 'text-delta',
49
- } as TextStreamPart<TOOLS>);
50
- }
51
- textStreamEnded = true;
52
- controller.enqueue(chunk);
53
- } else {
54
- controller.enqueue(chunk);
55
- }
56
- },
57
- });
58
- };
59
-
60
- const DEFAULT_DELAY_IN_MS = 10;
61
- const NEST_BLOCK_DELAY_IN_MS = 100;
62
-
63
- const BOLD_PATTERN = /\*\*.*?\*\*/;
64
- const CODE_LINE_PATTERN = /```[^\s]+/;
65
- const LINK_PATTERN = /^\[.*?\]\(.*?\)$/;
66
- const UNORDERED_LIST_PATTERN = /^[*-]\s+.+/;
67
- const TODO_LIST_PATTERN = /^[*-]\s+\[[ xX]\]\s+.+/;
68
- const ORDERED_LIST_PATTERN = /^\d+\.\s+.+/;
69
- const MDX_TAG_PATTERN = /<([A-Za-z][A-Za-z0-9\-_]*)>/;
70
- const DIGIT_PATTERN = /^[0-9]$/;
71
-
72
- export class MarkdownJoiner {
73
- delayInMs = DEFAULT_DELAY_IN_MS;
74
-
75
- private buffer = '';
76
- private documentCharacterCount = 0;
77
- private isBuffering = false;
78
- private streamingCodeBlock = false;
79
- private streamingLargeDocument = false;
80
- private streamingTable = false;
81
-
82
- private clearBuffer(): void {
83
- this.buffer = '';
84
- this.isBuffering = false;
85
- }
86
- private isCompleteBold(): boolean {
87
- return BOLD_PATTERN.test(this.buffer);
88
- }
89
-
90
- private isCompleteCodeBlockEnd(): boolean {
91
- return this.buffer.trimEnd() === '```';
92
- }
93
-
94
- private isCompleteCodeBlockStart(): boolean {
95
- return CODE_LINE_PATTERN.test(this.buffer);
96
- }
97
-
98
- private isCompleteLink(): boolean {
99
- return LINK_PATTERN.test(this.buffer);
100
- }
101
-
102
- private isCompleteList(): boolean {
103
- if (UNORDERED_LIST_PATTERN.test(this.buffer) && this.buffer.includes('['))
104
- return TODO_LIST_PATTERN.test(this.buffer);
105
-
106
- return (
107
- UNORDERED_LIST_PATTERN.test(this.buffer) ||
108
- ORDERED_LIST_PATTERN.test(this.buffer) ||
109
- TODO_LIST_PATTERN.test(this.buffer)
110
- );
111
- }
112
-
113
- private isCompleteMdxTag(): boolean {
114
- return MDX_TAG_PATTERN.test(this.buffer);
115
- }
116
-
117
- private isCompleteTableStart(): boolean {
118
- return this.buffer.startsWith('|') && this.buffer.endsWith('|');
119
- }
120
-
121
- private isFalsePositive(char: string): boolean {
122
- // when link is not complete, even if ths buffer is more than 30 characters, it is not a false positive
123
- if (this.buffer.startsWith('[') && this.buffer.includes('http')) {
124
- return false;
125
- }
126
-
127
- return char === '\n' || this.buffer.length > 30;
128
- }
129
-
130
- private isLargeDocumentStart(): boolean {
131
- return this.documentCharacterCount > 2500;
132
- }
133
-
134
- private isListStartChar(char: string): boolean {
135
- return char === '-' || char === '*' || DIGIT_PATTERN.test(char);
136
- }
137
-
138
- private isTableExisted(): boolean {
139
- return this.buffer.length > 10 && !this.buffer.includes('|');
140
- }
141
-
142
- flush(): string {
143
- const remaining = this.buffer;
144
- this.clearBuffer();
145
- return remaining;
146
- }
147
-
148
- processText(text: string): string {
149
- let output = '';
150
-
151
- for (const char of text) {
152
- if (
153
- this.streamingCodeBlock ||
154
- this.streamingTable ||
155
- this.streamingLargeDocument
156
- ) {
157
- this.buffer += char;
158
-
159
- if (char === '\n') {
160
- output += this.buffer;
161
- this.clearBuffer();
162
- }
163
-
164
- if (this.isCompleteCodeBlockEnd() && this.streamingCodeBlock) {
165
- this.streamingCodeBlock = false;
166
- this.delayInMs = DEFAULT_DELAY_IN_MS;
167
-
168
- output += this.buffer;
169
- this.clearBuffer();
170
- }
171
-
172
- if (this.isTableExisted() && this.streamingTable) {
173
- this.streamingTable = false;
174
- this.delayInMs = DEFAULT_DELAY_IN_MS;
175
-
176
- output += this.buffer;
177
- this.clearBuffer();
178
- }
179
- } else if (this.isBuffering) {
180
- this.buffer += char;
181
-
182
- if (this.isCompleteCodeBlockStart()) {
183
- this.delayInMs = NEST_BLOCK_DELAY_IN_MS;
184
- this.streamingCodeBlock = true;
185
- continue;
186
- }
187
-
188
- if (this.isCompleteTableStart()) {
189
- this.delayInMs = NEST_BLOCK_DELAY_IN_MS;
190
- this.streamingTable = true;
191
- continue;
192
- }
193
-
194
- if (this.isLargeDocumentStart()) {
195
- this.delayInMs = NEST_BLOCK_DELAY_IN_MS;
196
- this.streamingLargeDocument = true;
197
- continue;
198
- }
199
-
200
- if (
201
- this.isCompleteBold() ||
202
- this.isCompleteMdxTag() ||
203
- this.isCompleteList() ||
204
- this.isCompleteLink()
205
- ) {
206
- output += this.buffer;
207
- this.clearBuffer();
208
- } else if (this.isFalsePositive(char)) {
209
- // False positive - flush buffer as raw text
210
- output += this.buffer;
211
- this.clearBuffer();
212
- }
213
- // Check if we should start buffering
214
- } else if (
215
- char === '*' ||
216
- char === '<' ||
217
- char === '`' ||
218
- char === '|' ||
219
- char === '[' ||
220
- this.isListStartChar(char)
221
- ) {
222
- this.buffer = char;
223
- this.isBuffering = true;
224
- } else {
225
- // Pass through character directly
226
- output += char;
227
- }
228
- }
229
-
230
- this.documentCharacterCount += text.length;
231
- return output;
232
- }
233
- }
234
-
235
- async function delay(delayInMs?: number | null): Promise<void> {
236
- return delayInMs == null
237
- ? Promise.resolve()
238
- : new Promise((resolve) => setTimeout(resolve, delayInMs));
239
- }
@@ -1,13 +0,0 @@
1
- import type { RouterClient } from '@orpc/server';
2
- import { createORPCClient } from '@orpc/client';
3
- import { RPCLink } from '@orpc/client/fetch';
4
- import type { Router } from '../../../src/server/router';
5
- import { createTanstackQueryUtils } from '@orpc/tanstack-query';
6
-
7
- const link = new RPCLink({
8
- url: `http://localhost:${window.env.PORT ?? 6767}/rpc`,
9
- headers: { Authorization: window.localStorage.getItem('token') || '' },
10
- });
11
-
12
- export const orpc: RouterClient<Router> = createORPCClient(link);
13
- export const orpcTs = createTanstackQueryUtils(orpc);
@@ -1,19 +0,0 @@
1
- import type { FileRouter } from 'uploadthing/next';
2
-
3
- import { createUploadthing } from 'uploadthing/next';
4
-
5
- const f = createUploadthing();
6
-
7
- export const ourFileRouter = {
8
- editorUploader: f(['image', 'text', 'blob', 'pdf', 'video', 'audio'])
9
- .middleware(() => ({}))
10
- .onUploadComplete(({ file }) => ({
11
- key: file.key,
12
- name: file.name,
13
- size: file.size,
14
- type: file.type,
15
- url: file.ufsUrl,
16
- })),
17
- } satisfies FileRouter;
18
-
19
- export type OurFileRouter = typeof ourFileRouter;
@@ -1,6 +0,0 @@
1
- import { clsx, type ClassValue } from "clsx"
2
- import { twMerge } from "tailwind-merge"
3
-
4
- export function cn(...inputs: ClassValue[]) {
5
- return twMerge(clsx(inputs))
6
- }
@@ -1,13 +0,0 @@
1
- import { StrictMode } from 'react'
2
- import { createRoot } from 'react-dom/client'
3
- import './index.css'
4
- import App from './App.tsx'
5
- import { BrowserRouter } from 'react-router'
6
-
7
- createRoot(document.getElementById('root')!).render(
8
- <StrictMode>
9
- <BrowserRouter>
10
- <App />
11
- </BrowserRouter>
12
- </StrictMode>,
13
- )
@@ -1,44 +0,0 @@
1
- import { orpcTs } from "@/lib/orpc"
2
- import { useMutation, useQuery } from "@tanstack/react-query"
3
- import { useLocation } from "react-router"
4
- import MarkdownDemo from "@/components/markdown-to-slate-demo";
5
-
6
- export default function RTE() {
7
-
8
- const { pathname } = useLocation()
9
- const filePath = pathname.slice(1)
10
- const docQuery = useQuery({
11
- ...orpcTs.docs.getDoc.queryOptions({
12
- input: {
13
- filePath,
14
- },
15
- }),
16
- enabled: true,
17
- })
18
-
19
- const updateDoc = useMutation({
20
- ...orpcTs.docs.updateDoc.mutationOptions(),
21
- })
22
-
23
- const onUpdate = (content: string) => {
24
- updateDoc.mutate({
25
- filePath,
26
- content,
27
- })
28
- }
29
-
30
- return (
31
- <div className="flex-1 relative">
32
- <div className="absolute inset-0 overflow-y-auto">
33
- <div className="max-w-4xl mx-auto w-full relative p-4">
34
- {docQuery.data && (
35
- <MarkdownDemo
36
- initialMarkdown={docQuery.data}
37
- onUpdate={onUpdate}
38
- />
39
- )}
40
- </div>
41
- </div>
42
- </div>
43
- )
44
- }
@@ -1,6 +0,0 @@
1
- export type FolderStructure = {
2
- name: string;
3
- title: string;
4
- icon?: string;
5
- children: FolderStructure[];
6
- };
@@ -1,9 +0,0 @@
1
- declare global {
2
- interface Window {
3
- env: {
4
- PORT: number | string;
5
- };
6
- }
7
- }
8
-
9
- export {};
@@ -1,4 +0,0 @@
1
- // Type-only import to avoid pulling in backend implementation
2
- import type { Router } from '../../../src/server/router';
3
-
4
- export type { Router };
@@ -1,33 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
4
- "target": "ES2022",
5
- "useDefineForClassFields": true,
6
- "lib": ["ES2022", "DOM", "DOM.Iterable"],
7
- "module": "ESNext",
8
- "types": ["vite/client", "node"],
9
- "skipLibCheck": true,
10
-
11
- /* Bundler mode */
12
- "moduleResolution": "bundler",
13
- "allowImportingTsExtensions": true,
14
- "verbatimModuleSyntax": true,
15
- "moduleDetection": "force",
16
- "noEmit": true,
17
- "jsx": "react-jsx",
18
-
19
- /* Linting */
20
- "strict": true,
21
- "noUnusedLocals": true,
22
- "noUnusedParameters": true,
23
- "erasableSyntaxOnly": true,
24
- "noFallthroughCasesInSwitch": true,
25
- "noUncheckedSideEffectImports": true,
26
- "baseUrl": ".",
27
- "paths": {
28
- "@/*": ["./src/*"]
29
- }
30
- },
31
- "include": ["src"],
32
- "exclude": ["../src", "node_modules"]
33
- }