@airoom/nextmin-react 1.4.0 → 1.4.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 (42) hide show
  1. package/dist/components/SchemaForm.js +17 -2
  2. package/dist/components/SchemaSuggestionList.d.ts +7 -0
  3. package/dist/components/SchemaSuggestionList.js +43 -0
  4. package/dist/components/editor/TiptapEditor.d.ts +11 -0
  5. package/dist/components/editor/TiptapEditor.js +330 -0
  6. package/dist/components/editor/Toolbar.d.ts +7 -0
  7. package/dist/components/editor/Toolbar.js +99 -0
  8. package/dist/components/editor/components/CommandList.d.ts +7 -0
  9. package/dist/components/editor/components/CommandList.js +47 -0
  10. package/dist/components/editor/components/DistrictGridModal.d.ts +12 -0
  11. package/dist/components/editor/components/DistrictGridModal.js +67 -0
  12. package/dist/components/editor/components/ImageBubbleMenu.d.ts +6 -0
  13. package/dist/components/editor/components/ImageBubbleMenu.js +15 -0
  14. package/dist/components/editor/components/ImageComponent.d.ts +3 -0
  15. package/dist/components/editor/components/ImageComponent.js +45 -0
  16. package/dist/components/editor/components/SchemaInsertionModal.d.ts +15 -0
  17. package/dist/components/editor/components/SchemaInsertionModal.js +91 -0
  18. package/dist/components/editor/components/TableBubbleMenu.d.ts +6 -0
  19. package/dist/components/editor/components/TableBubbleMenu.js +8 -0
  20. package/dist/components/editor/extensions/Container.d.ts +2 -0
  21. package/dist/components/editor/extensions/Container.js +51 -0
  22. package/dist/components/editor/extensions/Grid.d.ts +3 -0
  23. package/dist/components/editor/extensions/Grid.js +89 -0
  24. package/dist/components/editor/extensions/Layout.d.ts +3 -0
  25. package/dist/components/editor/extensions/Layout.js +116 -0
  26. package/dist/components/editor/extensions/ResizableImage.d.ts +1 -0
  27. package/dist/components/editor/extensions/ResizableImage.js +52 -0
  28. package/dist/components/editor/extensions/SlashCommand.d.ts +15 -0
  29. package/dist/components/editor/extensions/SlashCommand.js +161 -0
  30. package/dist/components/editor/utils/upload.d.ts +1 -0
  31. package/dist/components/editor/utils/upload.js +49 -0
  32. package/dist/editor.css +460 -0
  33. package/dist/lib/upload.d.ts +1 -0
  34. package/dist/lib/upload.js +53 -0
  35. package/dist/lib/utils.d.ts +2 -0
  36. package/dist/lib/utils.js +5 -0
  37. package/dist/nextmin.css +1 -1
  38. package/dist/router/NextMinRouter.d.ts +1 -0
  39. package/dist/router/NextMinRouter.js +1 -0
  40. package/dist/views/list/useListData.js +4 -0
  41. package/package.json +34 -8
  42. package/tsconfig.json +8 -3
@@ -0,0 +1,53 @@
1
+ const getAuthHeaders = () => {
2
+ if (typeof window === 'undefined')
3
+ return {};
4
+ let token;
5
+ let apiKey;
6
+ try {
7
+ const raw = localStorage.getItem('nextmin.user');
8
+ if (raw) {
9
+ const u = JSON.parse(raw);
10
+ token = u?.token ?? u?.data?.token;
11
+ }
12
+ }
13
+ catch { }
14
+ token = token ?? localStorage.getItem('nextmin.token') ?? undefined;
15
+ apiKey =
16
+ localStorage.getItem('nextmin.apiKey') ??
17
+ process.env.NEXT_PUBLIC_NEXTMIN_API_KEY;
18
+ const h = {};
19
+ if (token)
20
+ h.Authorization = `Bearer ${token}`;
21
+ if (apiKey)
22
+ h['x-api-key'] = apiKey;
23
+ return h;
24
+ };
25
+ // Basic upload helper for Tiptap editor
26
+ // This mimics the logic in FileUploader but simplified for single file upload
27
+ export async function uploadFile(file) {
28
+ const DEFAULT_ENDPOINT = ((process.env.NEXT_PUBLIC_NEXTMIN_API_URL || '') + '/files').replace(/\/+$/, '') || '/files';
29
+ const endpoint = DEFAULT_ENDPOINT;
30
+ const formData = new FormData();
31
+ formData.append('file', file);
32
+ try {
33
+ const headers = getAuthHeaders();
34
+ const response = await fetch(endpoint, {
35
+ method: 'POST',
36
+ body: formData,
37
+ headers
38
+ });
39
+ if (!response.ok) {
40
+ console.error('Upload failed');
41
+ return null;
42
+ }
43
+ const json = await response.json();
44
+ if (json.success && Array.isArray(json.data) && json.data.length > 0) {
45
+ return json.data[0].url;
46
+ }
47
+ return json.url || null; // Fallback
48
+ }
49
+ catch (error) {
50
+ console.error('Error uploading file:', error);
51
+ return null;
52
+ }
53
+ }
@@ -0,0 +1,2 @@
1
+ import { type ClassValue } from 'clsx';
2
+ export declare function cn(...inputs: ClassValue[]): string;
@@ -0,0 +1,5 @@
1
+ import { clsx } from 'clsx';
2
+ import { twMerge } from 'tailwind-merge';
3
+ export function cn(...inputs) {
4
+ return twMerge(clsx(inputs));
5
+ }