neuphlo-editor 2.5.1 → 2.6.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 (128) hide show
  1. package/dist/Markdown-BAW0cb-U.d.cts +153 -0
  2. package/dist/Markdown-BAW0cb-U.d.ts +153 -0
  3. package/dist/chunk-ABL4D65Z.js +1454 -0
  4. package/dist/chunk-ABL4D65Z.js.map +1 -0
  5. package/dist/chunk-Z2DR2FK3.js +1582 -0
  6. package/dist/chunk-Z2DR2FK3.js.map +1 -0
  7. package/dist/headless/components/editor-bubble-item.d.ts +9 -0
  8. package/dist/headless/components/editor-bubble-item.js +29 -0
  9. package/dist/headless/components/editor-bubble.d.ts +9 -0
  10. package/dist/headless/components/editor-bubble.js +9 -0
  11. package/dist/headless/components/editor-command-item.d.ts +3 -0
  12. package/dist/headless/components/editor-command-item.js +27 -0
  13. package/dist/headless/components/editor-command.d.ts +3 -0
  14. package/dist/headless/components/editor-command.js +136 -0
  15. package/dist/headless/components/editor.d.ts +24 -0
  16. package/dist/headless/components/editor.js +13 -0
  17. package/dist/headless/extensions/AISuggestion/AISuggestion.d.ts +82 -0
  18. package/dist/headless/extensions/AISuggestion/AISuggestion.js +244 -0
  19. package/dist/headless/extensions/AISuggestion/index.d.ts +2 -0
  20. package/dist/headless/extensions/AISuggestion/index.js +1 -0
  21. package/dist/headless/extensions/CodeBlock/CodeBlock.d.ts +1 -0
  22. package/dist/headless/extensions/CodeBlock/CodeBlock.js +6 -0
  23. package/dist/headless/extensions/CodeBlock/index.d.ts +1 -0
  24. package/dist/headless/extensions/CodeBlock/index.js +1 -0
  25. package/dist/headless/extensions/DragHandle/DragHandle.d.ts +9 -0
  26. package/dist/headless/extensions/DragHandle/DragHandle.js +47 -0
  27. package/dist/headless/extensions/DragHandle/index.d.ts +2 -0
  28. package/dist/headless/extensions/DragHandle/index.js +1 -0
  29. package/dist/headless/extensions/Image/Image.d.ts +6 -0
  30. package/dist/headless/extensions/Image/Image.js +197 -0
  31. package/dist/headless/extensions/ImageBlock/ImageBlock.d.ts +23 -0
  32. package/dist/headless/extensions/ImageBlock/ImageBlock.js +242 -0
  33. package/dist/headless/extensions/ImageBlock/index.d.ts +2 -0
  34. package/dist/headless/extensions/ImageBlock/index.js +1 -0
  35. package/dist/headless/extensions/Link/Link.d.ts +2 -0
  36. package/dist/headless/extensions/Link/Link.js +44 -0
  37. package/dist/headless/extensions/Link/index.d.ts +1 -0
  38. package/dist/headless/extensions/Link/index.js +1 -0
  39. package/dist/headless/extensions/Markdown.d.ts +9 -0
  40. package/dist/headless/extensions/Markdown.js +138 -0
  41. package/dist/headless/extensions/MarkdownPaste.d.ts +3 -0
  42. package/dist/headless/extensions/MarkdownPaste.js +168 -0
  43. package/dist/headless/extensions/Mention/index.d.ts +4 -0
  44. package/dist/headless/extensions/Mention/index.js +3 -0
  45. package/dist/headless/extensions/Mention/mention-command.d.ts +8 -0
  46. package/dist/headless/extensions/Mention/mention-command.js +165 -0
  47. package/dist/headless/extensions/Mention/mention-list.d.ts +8 -0
  48. package/dist/headless/extensions/Mention/mention-list.js +150 -0
  49. package/dist/headless/extensions/Mention/mention-node-view.d.ts +2 -0
  50. package/dist/headless/extensions/Mention/mention-node-view.js +92 -0
  51. package/dist/headless/extensions/Mention/mention.d.ts +46 -0
  52. package/dist/headless/extensions/Mention/mention.js +218 -0
  53. package/dist/headless/extensions/Table/index.d.ts +2 -0
  54. package/dist/headless/extensions/Table/index.js +2 -0
  55. package/dist/headless/extensions/VideoBlock/VideoBlock.d.ts +17 -0
  56. package/dist/headless/extensions/VideoBlock/VideoBlock.js +73 -0
  57. package/dist/headless/extensions/VideoBlock/index.d.ts +2 -0
  58. package/dist/headless/extensions/VideoBlock/index.js +1 -0
  59. package/dist/headless/extensions/extension-kit.d.ts +29 -0
  60. package/dist/headless/extensions/extension-kit.js +132 -0
  61. package/dist/headless/extensions/index.d.ts +16 -0
  62. package/dist/headless/extensions/index.js +12 -0
  63. package/dist/headless/extensions/slash-command.d.ts +24 -0
  64. package/dist/headless/extensions/slash-command.js +99 -0
  65. package/dist/headless/index.cjs +143 -2
  66. package/dist/headless/index.cjs.map +1 -1
  67. package/dist/headless/index.d.cts +3 -2
  68. package/dist/headless/index.d.ts +3 -2
  69. package/dist/headless/index.js +5 -1
  70. package/dist/headless/utils/atoms.d.ts +13 -0
  71. package/dist/headless/utils/atoms.js +5 -0
  72. package/dist/headless/utils/store.d.ts +2 -0
  73. package/dist/headless/utils/store.js +4 -0
  74. package/dist/highlight.css +0 -6
  75. package/dist/react/Editor.d.ts +43 -0
  76. package/dist/react/Editor.js +119 -0
  77. package/dist/react/TableOfContents.d.ts +7 -0
  78. package/dist/react/TableOfContents.js +96 -0
  79. package/dist/react/index.cjs +156 -9
  80. package/dist/react/index.cjs.map +1 -1
  81. package/dist/react/index.d.cts +5 -2
  82. package/dist/react/index.d.ts +5 -2
  83. package/dist/react/index.js +14 -4
  84. package/dist/react/index.js.map +1 -1
  85. package/dist/react/menus/DragHandle/BlockActionMenu.d.ts +7 -0
  86. package/dist/react/menus/DragHandle/BlockActionMenu.js +111 -0
  87. package/dist/react/menus/DragHandle/DragHandleMenu.d.ts +7 -0
  88. package/dist/react/menus/DragHandle/DragHandleMenu.js +97 -0
  89. package/dist/react/menus/ImageBlock/ImageBlockLoading.d.ts +2 -0
  90. package/dist/react/menus/ImageBlock/ImageBlockLoading.js +6 -0
  91. package/dist/react/menus/ImageBlock/ImageBlockMenu.d.ts +8 -0
  92. package/dist/react/menus/ImageBlock/ImageBlockMenu.js +75 -0
  93. package/dist/react/menus/ImageBlock/ImageBlockView.d.ts +10 -0
  94. package/dist/react/menus/ImageBlock/ImageBlockView.js +60 -0
  95. package/dist/react/menus/ImageBlock/ImageBlockWidth.d.ts +6 -0
  96. package/dist/react/menus/ImageBlock/ImageBlockWidth.js +29 -0
  97. package/dist/react/menus/ImageBlock/ImageResizeHandle.d.ts +8 -0
  98. package/dist/react/menus/ImageBlock/ImageResizeHandle.js +37 -0
  99. package/dist/react/menus/ImageBlock/ImageUploader.d.ts +7 -0
  100. package/dist/react/menus/ImageBlock/ImageUploader.js +73 -0
  101. package/dist/react/menus/ImageBlock/index.d.ts +4 -0
  102. package/dist/react/menus/ImageBlock/index.js +4 -0
  103. package/dist/react/menus/ImageMenu.d.ts +10 -0
  104. package/dist/react/menus/ImageMenu.js +77 -0
  105. package/dist/react/menus/ImagePopover.d.ts +8 -0
  106. package/dist/react/menus/ImagePopover.js +146 -0
  107. package/dist/react/menus/LinkMenu.d.ts +2 -0
  108. package/dist/react/menus/LinkMenu.js +69 -0
  109. package/dist/react/menus/MenuList.d.ts +10 -0
  110. package/dist/react/menus/MenuList.js +94 -0
  111. package/dist/react/menus/SlashMenu.d.ts +5 -0
  112. package/dist/react/menus/SlashMenu.js +156 -0
  113. package/dist/react/menus/TableMenu.d.ts +5 -0
  114. package/dist/react/menus/TableMenu.js +462 -0
  115. package/dist/react/menus/TaskItem/TaskItemView.d.ts +12 -0
  116. package/dist/react/menus/TaskItem/TaskItemView.js +11 -0
  117. package/dist/react/menus/TextMenu.d.ts +10 -0
  118. package/dist/react/menus/TextMenu.js +139 -0
  119. package/dist/react/menus/VideoBlock/VideoBlockMenu.d.ts +7 -0
  120. package/dist/react/menus/VideoBlock/VideoBlockMenu.js +72 -0
  121. package/dist/react/menus/VideoBlock/VideoBlockView.d.ts +10 -0
  122. package/dist/react/menus/VideoBlock/VideoBlockView.js +87 -0
  123. package/dist/react/menus/VideoBlock/index.d.ts +2 -0
  124. package/dist/react/menus/VideoBlock/index.js +2 -0
  125. package/dist/react/menus/index.d.ts +15 -0
  126. package/dist/react/menus/index.js +9 -0
  127. package/package.json +13 -9
  128. package/LICENSE +0 -21
@@ -0,0 +1,153 @@
1
+ import * as _tiptap_core from '@tiptap/core';
2
+ import { Range, Extension } from '@tiptap/core';
3
+ import * as react from 'react';
4
+ import { FC, ReactNode } from 'react';
5
+ import { EditorProviderProps } from '@tiptap/react';
6
+ import * as _tiptap_extension_mention from '@tiptap/extension-mention';
7
+ import { MarkdownSerializer } from '@tiptap/pm/markdown';
8
+
9
+ interface EditorRootProps {
10
+ readonly children: ReactNode;
11
+ }
12
+ declare const EditorRoot: FC<EditorRootProps>;
13
+ type EditorContentProps = EditorProviderProps & {
14
+ readonly children?: ReactNode;
15
+ readonly className?: string;
16
+ readonly initialContent?: any;
17
+ };
18
+ declare const EditorContent: react.ForwardRefExoticComponent<{
19
+ children?: ReactNode;
20
+ slotBefore?: ReactNode;
21
+ slotAfter?: ReactNode;
22
+ editorContainerProps?: react.HTMLAttributes<HTMLDivElement>;
23
+ } & Partial<_tiptap_core.EditorOptions> & {
24
+ immediatelyRender?: boolean;
25
+ shouldRerenderOnTransaction?: boolean;
26
+ } & {
27
+ readonly children?: ReactNode;
28
+ readonly className?: string;
29
+ readonly initialContent?: any;
30
+ } & react.RefAttributes<HTMLDivElement>>;
31
+
32
+ declare module "@tiptap/core" {
33
+ interface Commands<ReturnType> {
34
+ imageBlock: {
35
+ setImageBlock: (attributes: {
36
+ src: string;
37
+ }) => ReturnType;
38
+ setImageBlockAt: (attributes: {
39
+ src: string;
40
+ pos: number | Range;
41
+ }) => ReturnType;
42
+ setImageBlockAlign: (align: "left" | "center" | "right") => ReturnType;
43
+ setImageBlockWidth: (width: number) => ReturnType;
44
+ };
45
+ }
46
+ }
47
+
48
+ /**
49
+ * TipTap AI Suggestion Extension
50
+ *
51
+ * This extension provides inline AI-powered text completions that appear
52
+ * as ghost text at the cursor position.
53
+ *
54
+ * Usage:
55
+ * ```ts
56
+ * import { AISuggestion } from 'neuphlo-editor'
57
+ *
58
+ * const editor = new Editor({
59
+ * extensions: [
60
+ * AISuggestion.configure({
61
+ * onFetchSuggestion: async (context) => {
62
+ * // Call your AI API here
63
+ * const response = await fetch('/api/complete', {
64
+ * method: 'POST',
65
+ * body: JSON.stringify({ text: context }),
66
+ * })
67
+ * const data = await response.json()
68
+ * return data.completion
69
+ * },
70
+ * debounceMs: 2000,
71
+ * }),
72
+ * ],
73
+ * })
74
+ * ```
75
+ */
76
+
77
+ declare module "@tiptap/core" {
78
+ interface Commands<ReturnType> {
79
+ aiSuggestion: {
80
+ /**
81
+ * Accept the current AI suggestion
82
+ */
83
+ acceptAISuggestion: () => ReturnType;
84
+ /**
85
+ * Dismiss the current AI suggestion
86
+ */
87
+ dismissAISuggestion: () => ReturnType;
88
+ /**
89
+ * Manually trigger a suggestion fetch
90
+ */
91
+ triggerAISuggestion: () => ReturnType;
92
+ /**
93
+ * Set a suggestion programmatically
94
+ */
95
+ setAISuggestion: (text: string) => ReturnType;
96
+ };
97
+ }
98
+ }
99
+
100
+ interface MentionItem {
101
+ id: string;
102
+ label: string;
103
+ avatar?: string;
104
+ email?: string;
105
+ type?: "node" | "article";
106
+ nodeId?: string;
107
+ slug?: string;
108
+ }
109
+ interface MentionOptions {
110
+ /**
111
+ * Function to fetch/filter mentionable items based on query
112
+ */
113
+ items?: (query: string) => MentionItem[] | Promise<MentionItem[]>;
114
+ /**
115
+ * Custom render function for mention nodes
116
+ */
117
+ renderLabel?: (props: {
118
+ node: any;
119
+ options: any;
120
+ }) => string;
121
+ /**
122
+ * Character that triggers the mention autocomplete (default: @)
123
+ */
124
+ char?: string;
125
+ /**
126
+ * Custom name for the extension (to avoid duplicates)
127
+ */
128
+ name?: string;
129
+ }
130
+ /**
131
+ * Create the mention extension with custom suggestion rendering
132
+ */
133
+ declare const createMentionExtension: (options?: MentionOptions) => _tiptap_core.Node<_tiptap_extension_mention.MentionOptions<any, _tiptap_extension_mention.MentionNodeAttrs>, any>;
134
+ /**
135
+ * Render function for mention suggestions (autocomplete dropdown)
136
+ */
137
+ declare const renderMentionSuggestion: () => {
138
+ onStart: (props: any) => void;
139
+ onUpdate: (props: any) => void;
140
+ onKeyDown: ({ event }: {
141
+ event: KeyboardEvent;
142
+ }) => any;
143
+ onExit: () => void;
144
+ };
145
+
146
+ declare function markdownToHtml(input: string | null | undefined): string;
147
+ interface MarkdownStorage {
148
+ serializer: MarkdownSerializer | null;
149
+ getMarkdown: () => string;
150
+ }
151
+ declare const Markdown: Extension<any, MarkdownStorage>;
152
+
153
+ export { EditorRoot as E, type MentionItem as M, EditorContent as a, type EditorContentProps as b, Markdown as c, type MarkdownStorage as d, createMentionExtension as e, type MentionOptions as f, markdownToHtml as m, renderMentionSuggestion as r };
@@ -0,0 +1,153 @@
1
+ import * as _tiptap_core from '@tiptap/core';
2
+ import { Range, Extension } from '@tiptap/core';
3
+ import * as react from 'react';
4
+ import { FC, ReactNode } from 'react';
5
+ import { EditorProviderProps } from '@tiptap/react';
6
+ import * as _tiptap_extension_mention from '@tiptap/extension-mention';
7
+ import { MarkdownSerializer } from '@tiptap/pm/markdown';
8
+
9
+ interface EditorRootProps {
10
+ readonly children: ReactNode;
11
+ }
12
+ declare const EditorRoot: FC<EditorRootProps>;
13
+ type EditorContentProps = EditorProviderProps & {
14
+ readonly children?: ReactNode;
15
+ readonly className?: string;
16
+ readonly initialContent?: any;
17
+ };
18
+ declare const EditorContent: react.ForwardRefExoticComponent<{
19
+ children?: ReactNode;
20
+ slotBefore?: ReactNode;
21
+ slotAfter?: ReactNode;
22
+ editorContainerProps?: react.HTMLAttributes<HTMLDivElement>;
23
+ } & Partial<_tiptap_core.EditorOptions> & {
24
+ immediatelyRender?: boolean;
25
+ shouldRerenderOnTransaction?: boolean;
26
+ } & {
27
+ readonly children?: ReactNode;
28
+ readonly className?: string;
29
+ readonly initialContent?: any;
30
+ } & react.RefAttributes<HTMLDivElement>>;
31
+
32
+ declare module "@tiptap/core" {
33
+ interface Commands<ReturnType> {
34
+ imageBlock: {
35
+ setImageBlock: (attributes: {
36
+ src: string;
37
+ }) => ReturnType;
38
+ setImageBlockAt: (attributes: {
39
+ src: string;
40
+ pos: number | Range;
41
+ }) => ReturnType;
42
+ setImageBlockAlign: (align: "left" | "center" | "right") => ReturnType;
43
+ setImageBlockWidth: (width: number) => ReturnType;
44
+ };
45
+ }
46
+ }
47
+
48
+ /**
49
+ * TipTap AI Suggestion Extension
50
+ *
51
+ * This extension provides inline AI-powered text completions that appear
52
+ * as ghost text at the cursor position.
53
+ *
54
+ * Usage:
55
+ * ```ts
56
+ * import { AISuggestion } from 'neuphlo-editor'
57
+ *
58
+ * const editor = new Editor({
59
+ * extensions: [
60
+ * AISuggestion.configure({
61
+ * onFetchSuggestion: async (context) => {
62
+ * // Call your AI API here
63
+ * const response = await fetch('/api/complete', {
64
+ * method: 'POST',
65
+ * body: JSON.stringify({ text: context }),
66
+ * })
67
+ * const data = await response.json()
68
+ * return data.completion
69
+ * },
70
+ * debounceMs: 2000,
71
+ * }),
72
+ * ],
73
+ * })
74
+ * ```
75
+ */
76
+
77
+ declare module "@tiptap/core" {
78
+ interface Commands<ReturnType> {
79
+ aiSuggestion: {
80
+ /**
81
+ * Accept the current AI suggestion
82
+ */
83
+ acceptAISuggestion: () => ReturnType;
84
+ /**
85
+ * Dismiss the current AI suggestion
86
+ */
87
+ dismissAISuggestion: () => ReturnType;
88
+ /**
89
+ * Manually trigger a suggestion fetch
90
+ */
91
+ triggerAISuggestion: () => ReturnType;
92
+ /**
93
+ * Set a suggestion programmatically
94
+ */
95
+ setAISuggestion: (text: string) => ReturnType;
96
+ };
97
+ }
98
+ }
99
+
100
+ interface MentionItem {
101
+ id: string;
102
+ label: string;
103
+ avatar?: string;
104
+ email?: string;
105
+ type?: "node" | "article";
106
+ nodeId?: string;
107
+ slug?: string;
108
+ }
109
+ interface MentionOptions {
110
+ /**
111
+ * Function to fetch/filter mentionable items based on query
112
+ */
113
+ items?: (query: string) => MentionItem[] | Promise<MentionItem[]>;
114
+ /**
115
+ * Custom render function for mention nodes
116
+ */
117
+ renderLabel?: (props: {
118
+ node: any;
119
+ options: any;
120
+ }) => string;
121
+ /**
122
+ * Character that triggers the mention autocomplete (default: @)
123
+ */
124
+ char?: string;
125
+ /**
126
+ * Custom name for the extension (to avoid duplicates)
127
+ */
128
+ name?: string;
129
+ }
130
+ /**
131
+ * Create the mention extension with custom suggestion rendering
132
+ */
133
+ declare const createMentionExtension: (options?: MentionOptions) => _tiptap_core.Node<_tiptap_extension_mention.MentionOptions<any, _tiptap_extension_mention.MentionNodeAttrs>, any>;
134
+ /**
135
+ * Render function for mention suggestions (autocomplete dropdown)
136
+ */
137
+ declare const renderMentionSuggestion: () => {
138
+ onStart: (props: any) => void;
139
+ onUpdate: (props: any) => void;
140
+ onKeyDown: ({ event }: {
141
+ event: KeyboardEvent;
142
+ }) => any;
143
+ onExit: () => void;
144
+ };
145
+
146
+ declare function markdownToHtml(input: string | null | undefined): string;
147
+ interface MarkdownStorage {
148
+ serializer: MarkdownSerializer | null;
149
+ getMarkdown: () => string;
150
+ }
151
+ declare const Markdown: Extension<any, MarkdownStorage>;
152
+
153
+ export { EditorRoot as E, type MentionItem as M, EditorContent as a, type EditorContentProps as b, Markdown as c, type MarkdownStorage as d, createMentionExtension as e, type MentionOptions as f, markdownToHtml as m, renderMentionSuggestion as r };