@prosekit/react 0.6.0 → 0.6.1

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 (94) hide show
  1. package/dist/create-component-CBvs05W1.js +2 -1
  2. package/dist/create-component-CBvs05W1.js.map +1 -0
  3. package/dist/{create-props-CkTwd_m_.d.ts → create-props-EGV61dJR.d.ts} +3 -2
  4. package/dist/create-props-EGV61dJR.d.ts.map +1 -0
  5. package/dist/editor-context-Cci4uqN_.js +2 -1
  6. package/dist/editor-context-Cci4uqN_.js.map +1 -0
  7. package/dist/prosekit-react-autocomplete.d.ts +11 -10
  8. package/dist/prosekit-react-autocomplete.d.ts.map +1 -0
  9. package/dist/prosekit-react-autocomplete.js +2 -1
  10. package/dist/prosekit-react-autocomplete.js.map +1 -0
  11. package/dist/prosekit-react-block-handle.d.ts +9 -8
  12. package/dist/prosekit-react-block-handle.d.ts.map +1 -0
  13. package/dist/prosekit-react-block-handle.js +2 -1
  14. package/dist/prosekit-react-block-handle.js.map +1 -0
  15. package/dist/prosekit-react-drop-indicator.d.ts +5 -4
  16. package/dist/prosekit-react-drop-indicator.d.ts.map +1 -0
  17. package/dist/prosekit-react-drop-indicator.js +2 -1
  18. package/dist/prosekit-react-drop-indicator.js.map +1 -0
  19. package/dist/prosekit-react-inline-popover.d.ts +5 -4
  20. package/dist/prosekit-react-inline-popover.d.ts.map +1 -0
  21. package/dist/prosekit-react-inline-popover.js +2 -1
  22. package/dist/prosekit-react-inline-popover.js.map +1 -0
  23. package/dist/prosekit-react-popover.d.ts +9 -8
  24. package/dist/prosekit-react-popover.d.ts.map +1 -0
  25. package/dist/prosekit-react-popover.js +2 -1
  26. package/dist/prosekit-react-popover.js.map +1 -0
  27. package/dist/prosekit-react-resizable.d.ts +7 -6
  28. package/dist/prosekit-react-resizable.d.ts.map +1 -0
  29. package/dist/prosekit-react-resizable.js +2 -1
  30. package/dist/prosekit-react-resizable.js.map +1 -0
  31. package/dist/prosekit-react-table-handle.d.ts +21 -20
  32. package/dist/prosekit-react-table-handle.d.ts.map +1 -0
  33. package/dist/prosekit-react-table-handle.js +2 -1
  34. package/dist/prosekit-react-table-handle.js.map +1 -0
  35. package/dist/prosekit-react-tooltip.d.ts +9 -8
  36. package/dist/prosekit-react-tooltip.d.ts.map +1 -0
  37. package/dist/prosekit-react-tooltip.js +2 -1
  38. package/dist/prosekit-react-tooltip.js.map +1 -0
  39. package/dist/prosekit-react.d.ts +96 -81
  40. package/dist/prosekit-react.d.ts.map +1 -0
  41. package/dist/prosekit-react.js +2 -1
  42. package/dist/prosekit-react.js.map +1 -0
  43. package/package.json +19 -19
  44. package/src/components/autocomplete/autocomplete-empty.gen.ts +34 -0
  45. package/src/components/autocomplete/autocomplete-item.gen.ts +34 -0
  46. package/src/components/autocomplete/autocomplete-list.gen.ts +34 -0
  47. package/src/components/autocomplete/autocomplete-popover.gen.ts +34 -0
  48. package/src/components/autocomplete/index.gen.ts +7 -0
  49. package/src/components/block-handle/block-handle-add.gen.ts +34 -0
  50. package/src/components/block-handle/block-handle-draggable.gen.ts +34 -0
  51. package/src/components/block-handle/block-handle-popover.gen.ts +34 -0
  52. package/src/components/block-handle/index.gen.ts +5 -0
  53. package/src/components/create-component.ts +133 -0
  54. package/src/components/create-props.ts +13 -0
  55. package/src/components/drop-indicator/drop-indicator.gen.ts +34 -0
  56. package/src/components/drop-indicator/index.gen.ts +1 -0
  57. package/src/components/inline-popover/index.gen.ts +1 -0
  58. package/src/components/inline-popover/inline-popover.gen.ts +34 -0
  59. package/src/components/merge-refs.ts +35 -0
  60. package/src/components/popover/index.gen.ts +5 -0
  61. package/src/components/popover/popover-content.gen.ts +34 -0
  62. package/src/components/popover/popover-root.gen.ts +34 -0
  63. package/src/components/popover/popover-trigger.gen.ts +34 -0
  64. package/src/components/prosekit.ts +37 -0
  65. package/src/components/resizable/index.gen.ts +3 -0
  66. package/src/components/resizable/resizable-handle.gen.ts +34 -0
  67. package/src/components/resizable/resizable-root.gen.ts +34 -0
  68. package/src/components/table-handle/index.gen.ts +17 -0
  69. package/src/components/table-handle/table-handle-column-root.gen.ts +34 -0
  70. package/src/components/table-handle/table-handle-column-trigger.gen.ts +34 -0
  71. package/src/components/table-handle/table-handle-drag-preview.gen.ts +34 -0
  72. package/src/components/table-handle/table-handle-drop-indicator.gen.ts +34 -0
  73. package/src/components/table-handle/table-handle-popover-content.gen.ts +34 -0
  74. package/src/components/table-handle/table-handle-popover-item.gen.ts +34 -0
  75. package/src/components/table-handle/table-handle-root.gen.ts +34 -0
  76. package/src/components/table-handle/table-handle-row-root.gen.ts +34 -0
  77. package/src/components/table-handle/table-handle-row-trigger.gen.ts +34 -0
  78. package/src/components/tooltip/index.gen.ts +5 -0
  79. package/src/components/tooltip/tooltip-content.gen.ts +34 -0
  80. package/src/components/tooltip/tooltip-root.gen.ts +34 -0
  81. package/src/components/tooltip/tooltip-trigger.gen.ts +34 -0
  82. package/src/contexts/editor-context.ts +23 -0
  83. package/src/extensions/react-mark-view.ts +93 -0
  84. package/src/extensions/react-node-view.ts +93 -0
  85. package/src/hooks/use-doc-change.ts +24 -0
  86. package/src/hooks/use-editor-derived-value.ts +83 -0
  87. package/src/hooks/use-editor-extension.ts +24 -0
  88. package/src/hooks/use-editor.ts +62 -0
  89. package/src/hooks/use-extension.ts +41 -0
  90. package/src/hooks/use-keymap.ts +15 -0
  91. package/src/hooks/use-priority-extension.ts +18 -0
  92. package/src/hooks/use-state-update.ts +24 -0
  93. package/src/index.ts +29 -0
  94. package/src/types.ts +6 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prosekit-react-tooltip.js","names":["TooltipContent: ForwardRefExoticComponent<\n TooltipContentProps &\n RefAttributes<TooltipContentElement> &\n HTMLAttributes<TooltipContentElement>\n>","TooltipRoot: ForwardRefExoticComponent<\n TooltipRootProps &\n RefAttributes<TooltipRootElement> &\n HTMLAttributes<TooltipRootElement>\n>","TooltipTrigger: ForwardRefExoticComponent<\n TooltipTriggerProps &\n RefAttributes<TooltipTriggerElement> &\n HTMLAttributes<TooltipTriggerElement>\n>"],"sources":["../src/components/tooltip/tooltip-content.gen.ts","../src/components/tooltip/tooltip-root.gen.ts","../src/components/tooltip/tooltip-trigger.gen.ts"],"sourcesContent":["import {\n type TooltipContentElement,\n type TooltipContentProps as Props,\n type TooltipContentEvents as Events,\n tooltipContentProps,\n tooltipContentEvents,\n} from '@prosekit/web/tooltip'\nimport type {\n ForwardRefExoticComponent,\n HTMLAttributes,\n RefAttributes,\n} from 'react'\n\nimport { createComponent } from '../create-component'\nimport type { CreateProps } from '../create-props'\n\n/**\n * Props for the {@link TooltipContent} component.\n */\nexport interface TooltipContentProps extends Partial<CreateProps<Props, Events>> {}\n \nexport const TooltipContent: ForwardRefExoticComponent<\n TooltipContentProps &\n RefAttributes<TooltipContentElement> &\n HTMLAttributes<TooltipContentElement>\n> = createComponent<\n TooltipContentProps, \n TooltipContentElement\n>(\n 'prosekit-tooltip-content',\n 'TooltipContent',\n Object.keys(tooltipContentProps),\n Object.keys(tooltipContentEvents),\n)\n","import {\n type TooltipRootElement,\n type TooltipRootProps as Props,\n type TooltipRootEvents as Events,\n tooltipRootProps,\n tooltipRootEvents,\n} from '@prosekit/web/tooltip'\nimport type {\n ForwardRefExoticComponent,\n HTMLAttributes,\n RefAttributes,\n} from 'react'\n\nimport { createComponent } from '../create-component'\nimport type { CreateProps } from '../create-props'\n\n/**\n * Props for the {@link TooltipRoot} component.\n */\nexport interface TooltipRootProps extends Partial<CreateProps<Props, Events>> {}\n \nexport const TooltipRoot: ForwardRefExoticComponent<\n TooltipRootProps &\n RefAttributes<TooltipRootElement> &\n HTMLAttributes<TooltipRootElement>\n> = createComponent<\n TooltipRootProps, \n TooltipRootElement\n>(\n 'prosekit-tooltip-root',\n 'TooltipRoot',\n Object.keys(tooltipRootProps),\n Object.keys(tooltipRootEvents),\n)\n","import {\n type TooltipTriggerElement,\n type TooltipTriggerProps as Props,\n type TooltipTriggerEvents as Events,\n tooltipTriggerProps,\n tooltipTriggerEvents,\n} from '@prosekit/web/tooltip'\nimport type {\n ForwardRefExoticComponent,\n HTMLAttributes,\n RefAttributes,\n} from 'react'\n\nimport { createComponent } from '../create-component'\nimport type { CreateProps } from '../create-props'\n\n/**\n * Props for the {@link TooltipTrigger} component.\n */\nexport interface TooltipTriggerProps extends Partial<CreateProps<Props, Events>> {}\n \nexport const TooltipTrigger: ForwardRefExoticComponent<\n TooltipTriggerProps &\n RefAttributes<TooltipTriggerElement> &\n HTMLAttributes<TooltipTriggerElement>\n> = createComponent<\n TooltipTriggerProps, \n TooltipTriggerElement\n>(\n 'prosekit-tooltip-trigger',\n 'TooltipTrigger',\n Object.keys(tooltipTriggerProps),\n Object.keys(tooltipTriggerEvents),\n)\n"],"mappings":";;;;;AAqBA,MAAaA,iBAIT,gBAIF,4BACA,kBACA,OAAO,KAAK,oBAAoB,EAChC,OAAO,KAAK,qBAAqB,CAClC;;;;ACZD,MAAaC,cAIT,gBAIF,yBACA,eACA,OAAO,KAAK,iBAAiB,EAC7B,OAAO,KAAK,kBAAkB,CAC/B;;;;ACZD,MAAaC,iBAIT,gBAIF,4BACA,kBACA,OAAO,KAAK,oBAAoB,EAChC,OAAO,KAAK,qBAAqB,CAClC"}
@@ -11,156 +11,171 @@ interface ProseKitProps {
11
11
  children?: ReactNode;
12
12
  }
13
13
  /**
14
- * The root component for a ProseKit editor.
15
- *
16
- * @public
17
- */
14
+ * The root component for a ProseKit editor.
15
+ *
16
+ * @public
17
+ */
18
18
  declare const ProseKit: ComponentType<ProseKitProps>;
19
19
  //#endregion
20
20
  //#region src/extensions/react-mark-view.d.ts
21
21
  /**
22
- * @public
23
- */
22
+ * @public
23
+ */
24
24
  interface ReactMarkViewProps extends MarkViewContext {}
25
25
  /**
26
- * @public
27
- */
26
+ * @public
27
+ */
28
28
  type ReactMarkViewComponent = ComponentType<ReactMarkViewProps>;
29
29
  /**
30
- * Options for {@link defineReactMarkView}.
31
- *
32
- * @public
33
- */
30
+ * Options for {@link defineReactMarkView}.
31
+ *
32
+ * @public
33
+ */
34
34
  interface ReactMarkViewOptions extends CoreMarkViewUserOptions<ReactMarkViewComponent> {
35
35
  /**
36
- * The name of the mark type.
37
- */
36
+ * The name of the mark type.
37
+ */
38
38
  name: string;
39
39
  }
40
40
  /**
41
- * @internal
42
- */
41
+ * @internal
42
+ */
43
43
 
44
44
  /**
45
- * Defines a mark view using a React component.
46
- *
47
- * @public
48
- */
45
+ * Defines a mark view using a React component.
46
+ *
47
+ * @public
48
+ */
49
49
  declare function defineReactMarkView(options: ReactMarkViewOptions): Extension;
50
50
  //#endregion
51
51
  //#region src/extensions/react-node-view.d.ts
52
52
  /**
53
- * @public
54
- */
53
+ * @public
54
+ */
55
55
  interface ReactNodeViewProps extends NodeViewContext {}
56
56
  /**
57
- * @public
58
- */
57
+ * @public
58
+ */
59
59
  type ReactNodeViewComponent = ComponentType<ReactNodeViewProps>;
60
60
  /**
61
- * Options for {@link defineReactNodeView}.
62
- *
63
- * @public
64
- */
61
+ * Options for {@link defineReactNodeView}.
62
+ *
63
+ * @public
64
+ */
65
65
  interface ReactNodeViewOptions extends CoreNodeViewUserOptions<ReactNodeViewComponent> {
66
66
  /**
67
- * The name of the node type.
68
- */
67
+ * The name of the node type.
68
+ */
69
69
  name: string;
70
70
  }
71
71
  /**
72
- * @internal
73
- */
72
+ * @internal
73
+ */
74
74
 
75
75
  /**
76
- * Defines a node view using a React component.
77
- *
78
- * @public
79
- */
76
+ * Defines a node view using a React component.
77
+ *
78
+ * @public
79
+ */
80
80
  declare function defineReactNodeView(options: ReactNodeViewOptions): Extension;
81
81
  //#endregion
82
82
  //#region src/hooks/use-extension.d.ts
83
83
  interface UseExtensionOptions {
84
84
  /**
85
- * The editor to add the extension to. If not provided, it will use the
86
- * editor from the nearest `ProseKit` component.
87
- */
85
+ * The editor to add the extension to. If not provided, it will use the
86
+ * editor from the nearest `ProseKit` component.
87
+ */
88
88
  editor?: Editor;
89
89
  /**
90
- * Optional priority to add the extension with.
91
- */
90
+ * Optional priority to add the extension with.
91
+ */
92
92
  priority?: Priority;
93
93
  }
94
94
  /**
95
- * Add an extension to the editor.
96
- */
97
- declare function useExtension(extension: Extension | null, options?: UseExtensionOptions): void;
95
+ * Add an extension to the editor.
96
+ */
97
+ declare function useExtension(
98
+ /**
99
+ * The extension to add to the editor. If it changes, the previous
100
+ * extension will be removed and the new one (if not null) will be added.
101
+ */
102
+ extension: Extension | null, options?: UseExtensionOptions): void;
98
103
  //#endregion
99
104
  //#region src/hooks/use-doc-change.d.ts
100
105
  /**
101
- * Calls the given handler whenever the editor document changes.
102
- *
103
- * @public
104
- */
106
+ * Calls the given handler whenever the editor document changes.
107
+ *
108
+ * @public
109
+ */
105
110
  declare function useDocChange(handler: (doc: ProseMirrorNode) => void, options?: UseExtensionOptions): void;
106
111
  //#endregion
107
112
  //#region src/hooks/use-editor.d.ts
108
113
  /**
109
- * Retrieves the editor instance from the nearest ProseKit component.
110
- *
111
- * @public
112
- */
114
+ * Retrieves the editor instance from the nearest ProseKit component.
115
+ *
116
+ * @public
117
+ */
113
118
  declare function useEditor<E extends Extension = any>(options?: {
114
119
  /**
115
- * Whether to update the component when the editor is mounted or editor state
116
- * is updated.
117
- *
118
- * Note this this option doesn't work with [React
119
- * compiler](https://react.dev/learn/react-compiler) because the returned
120
- * editor will be the same instance after state updates. If you're using React
121
- * compiler, you should use {@link useEditorDerivedValue} instead.
122
- *
123
- * @default false
124
- */
120
+ * Whether to update the component when the editor is mounted or editor state
121
+ * is updated.
122
+ *
123
+ * Note this this option doesn't work with [React
124
+ * compiler](https://react.dev/learn/react-compiler) because the returned
125
+ * editor will be the same instance after state updates. If you're using React
126
+ * compiler, you should use {@link useEditorDerivedValue} instead.
127
+ *
128
+ * @default false
129
+ */
125
130
  update?: boolean;
126
131
  }): Editor<E>;
127
132
  //#endregion
128
133
  //#region src/hooks/use-editor-derived-value.d.ts
129
134
  interface UseEditorDerivedOptions<E extends Extension = any> {
130
135
  /**
131
- * The editor to add the extension to. If not provided, it will use the
132
- * editor from the nearest `ProseKit` component.
133
- */
136
+ * The editor to add the extension to. If not provided, it will use the
137
+ * editor from the nearest `ProseKit` component.
138
+ */
134
139
  editor?: Editor<E>;
135
140
  }
136
141
  /**
137
- * A hook that runs a function to derive a value from the editor instance after
138
- * editor state changes.
139
- *
140
- * This is useful when you need to render something based on the editor state,
141
- * for example, whether the selected text is wrapped in an italic mark.
142
- *
143
- * @public
144
- */
145
- declare function useEditorDerivedValue<E extends Extension, Derived>(derive: (editor: Editor<E>) => Derived, options?: UseEditorDerivedOptions<E>): Derived;
142
+ * A hook that runs a function to derive a value from the editor instance after
143
+ * editor state changes.
144
+ *
145
+ * This is useful when you need to render something based on the editor state,
146
+ * for example, whether the selected text is wrapped in an italic mark.
147
+ *
148
+ * @public
149
+ */
150
+ declare function useEditorDerivedValue<E extends Extension, Derived>(
151
+ /**
152
+ * A function that receives the editor instance and returns a derived value.
153
+ *
154
+ * It will be called whenever the editor's document state changes, or when it
155
+ * mounts.
156
+ *
157
+ * This function should be memoized.
158
+ */
159
+ derive: (editor: Editor<E>) => Derived, options?: UseEditorDerivedOptions<E>): Derived;
146
160
  //#endregion
147
161
  //#region src/hooks/use-keymap.d.ts
148
162
  declare function useKeymap(keymap: Keymap, options?: UseExtensionOptions): void;
149
163
  //#endregion
150
164
  //#region src/hooks/use-state-update.d.ts
151
165
  /**
152
- * Calls the given handler whenever the editor state changes.
153
- *
154
- * @public
155
- */
166
+ * Calls the given handler whenever the editor state changes.
167
+ *
168
+ * @public
169
+ */
156
170
  declare function useStateUpdate(handler: (state: EditorState) => void, options?: UseExtensionOptions): void;
157
171
  //#endregion
158
172
  //#region src/types.d.ts
159
173
  /**
160
- * @internal
161
- */
174
+ * @internal
175
+ */
162
176
  type PropsWithClassName<P = unknown> = P & {
163
177
  className?: string | undefined;
164
178
  };
165
179
  //#endregion
166
- export { type PropsWithClassName, ProseKit, type ProseKitProps, type ReactMarkViewComponent, type ReactMarkViewOptions, type ReactMarkViewProps, type ReactNodeViewComponent, type ReactNodeViewOptions, type ReactNodeViewProps, type UseEditorDerivedOptions, type UseExtensionOptions, defineReactMarkView, defineReactNodeView, useDocChange, useEditor, useEditorDerivedValue, useExtension, useKeymap, useStateUpdate };
180
+ export { type PropsWithClassName, ProseKit, type ProseKitProps, type ReactMarkViewComponent, type ReactMarkViewOptions, type ReactMarkViewProps, type ReactNodeViewComponent, type ReactNodeViewOptions, type ReactNodeViewProps, type UseEditorDerivedOptions, type UseExtensionOptions, defineReactMarkView, defineReactNodeView, useDocChange, useEditor, useEditorDerivedValue, useExtension, useKeymap, useStateUpdate };
181
+ //# sourceMappingURL=prosekit-react.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prosekit-react.d.ts","names":[],"sources":["../src/components/prosekit.ts","../src/extensions/react-mark-view.ts","../src/extensions/react-node-view.ts","../src/hooks/use-extension.ts","../src/hooks/use-doc-change.ts","../src/hooks/use-editor.ts","../src/hooks/use-editor-derived-value.ts","../src/hooks/use-keymap.ts","../src/hooks/use-state-update.ts","../src/types.ts"],"sourcesContent":[],"mappings":";;;;;;;;UAYiB,aAAA;UACP;aACG;;;;AAFb;;;AAEa,cAQA,QARA,EAQU,aARV,CAQwB,aARxB,CAAA;;;;;;UCWI,kBAAA,SAA2B,iBDb5C;;;;AAEsB,KCgBV,sBAAA,GAAyB,aDhBf,CCgB6B,kBDhB7B,CAAA;AAQtB;;;;;UCeiB,oBAAA,SAA6B,wBAAwB;;;AAZtE;EAKY,IAAA,EAAA,MAAA;;;;;;;;;;AAwCZ;AAAmC,iBAAnB,mBAAA,CAAmB,OAAA,EAAU,oBAAV,CAAA,EAAiC,SAAjC;;;;;;UC7ClB,kBAAA,SAA2B,iBFb5C;;;;AAEsB,KEgBV,sBAAA,GAAyB,aFhBf,CEgB6B,kBFhB7B,CAAA;AAQtB;;;;;UEeiB,oBAAA,SAA6B,wBAAwB;;;ADZtE;EAKY,IAAA,EAAA,MAAA;;;;;;;;;;AAwCZ;AAAmC,iBCAnB,mBAAA,CDAmB,OAAA,ECAU,oBDAV,CAAA,ECAiC,SDAjC;;;UE3DlB,mBAAA;;;;;WAKN;;AHJX;;UACU,CAAA,EGQG,QHRH;;;AASV;;AAAqC,iBGKrB,YAAA;;;;;WAKH,4BACD;;;;;;;;iBCnBI,YAAA,gBACC,oCACL;;;;;;;;iBCII,oBAAoB;;ALRpC;;;;;AAUA;;;;;;IKWI,OAAO;;;UClBM,kCAAkC;;;;;WAKxC,OAAO;;ANRlB;;;;;AAUA;;;;AAAoC,iBMUpB,qBNVoB,CAAA,UMUY,SNVZ,EAAA,OAAA,CAAA;;;;ACGpC;AAKA;;;;MAAkD,EAAA,CAAA,MAAA,EKW/B,MLX+B,CKWxB,CLXwB,CAAA,EAAA,GKWjB,OLXiB,EAAA,OAAA,CAAA,EKYtC,uBLZsC,CKYd,CLZc,CAAA,CAAA,EKa/C,OLb+C;;;iBMnBlC,SAAA,SAAkB,kBAAkB;;;;;;;;iBCGpC,cAAA,kBACG,gCACP;;;;;;KCbA,kCAAkC"}
@@ -231,4 +231,5 @@ function useStateUpdate(handler, options) {
231
231
  }
232
232
 
233
233
  //#endregion
234
- export { ProseKit, defineReactMarkView, defineReactNodeView, useDocChange, useEditor, useEditorDerivedValue, useExtension, useKeymap, useStateUpdate };
234
+ export { ProseKit, defineReactMarkView, defineReactNodeView, useDocChange, useEditor, useEditorDerivedValue, useExtension, useKeymap, useStateUpdate };
235
+ //# sourceMappingURL=prosekit-react.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prosekit-react.js","names":["props: ReactMarkViewProps","ReactMarkViewConsumer: FC","args: ReactMarkViewUserOptions","props: ReactNodeViewProps","ReactNodeViewConsumer: FC","args: ReactNodeViewUserOptions","ProseKit: ComponentType<ProseKitProps>","derived: Derived"],"sources":["../src/hooks/use-editor-extension.ts","../src/hooks/use-priority-extension.ts","../src/hooks/use-extension.ts","../src/extensions/react-mark-view.ts","../src/extensions/react-node-view.ts","../src/components/prosekit.ts","../src/hooks/use-doc-change.ts","../src/hooks/use-editor.ts","../src/hooks/use-editor-derived-value.ts","../src/hooks/use-keymap.ts","../src/hooks/use-state-update.ts"],"sourcesContent":["import {\n EditorNotFoundError,\n type Editor,\n type Extension,\n} from '@prosekit/core'\nimport { useEffect } from 'react'\n\n/**\n * @internal\n */\nexport function useEditorExtension(\n editor: Editor | null | undefined,\n extension: Extension | null,\n): void {\n if (!editor) {\n throw new EditorNotFoundError()\n }\n\n useEffect(() => {\n if (extension) {\n return editor.use(extension)\n }\n }, [editor, extension])\n}\n","import {\n withPriority,\n type Extension,\n type Priority,\n} from '@prosekit/core'\nimport { useMemo } from 'react'\n\n/**\n * @internal\n */\nexport function usePriorityExtension<T extends Extension = Extension>(\n extension: T | null,\n priority?: Priority | null,\n): T | null {\n return useMemo(() => {\n return extension && priority ? withPriority(extension, priority) : extension\n }, [extension, priority])\n}\n","import type {\n Editor,\n Extension,\n Priority,\n} from '@prosekit/core'\n\nimport { useEditorContext } from '../contexts/editor-context'\n\nimport { useEditorExtension } from './use-editor-extension'\nimport { usePriorityExtension } from './use-priority-extension'\n\nexport interface UseExtensionOptions {\n /**\n * The editor to add the extension to. If not provided, it will use the\n * editor from the nearest `ProseKit` component.\n */\n editor?: Editor\n\n /**\n * Optional priority to add the extension with.\n */\n priority?: Priority\n}\n\n/**\n * Add an extension to the editor.\n */\nexport function useExtension(\n /**\n * The extension to add to the editor. If it changes, the previous\n * extension will be removed and the new one (if not null) will be added.\n */\n extension: Extension | null,\n options?: UseExtensionOptions,\n): void {\n const editorContext = useEditorContext()\n useEditorExtension(\n options?.editor || editorContext,\n usePriorityExtension(extension, options?.priority),\n )\n}\n","import {\n defineMarkViewComponent,\n defineMarkViewFactory,\n type Extension,\n} from '@prosekit/core'\nimport type { MarkViewConstructor } from '@prosekit/pm/view'\nimport type { CoreMarkViewUserOptions } from '@prosemirror-adapter/core'\nimport {\n useMarkViewContext,\n useMarkViewFactory,\n type MarkViewContext,\n type ReactMarkViewUserOptions,\n} from '@prosemirror-adapter/react'\nimport {\n createElement,\n useMemo,\n type ComponentType,\n type FC,\n} from 'react'\n\nimport { useExtension } from '../hooks/use-extension'\n\n/**\n * @public\n */\nexport interface ReactMarkViewProps extends MarkViewContext {}\n\n/**\n * @public\n */\nexport type ReactMarkViewComponent = ComponentType<ReactMarkViewProps>\n\n/**\n * Options for {@link defineReactMarkView}.\n *\n * @public\n */\nexport interface ReactMarkViewOptions extends CoreMarkViewUserOptions<ReactMarkViewComponent> {\n /**\n * The name of the mark type.\n */\n name: string\n}\n\nfunction withMarkViewProps(component: ReactMarkViewComponent) {\n return function MarkViewPropsWrapper() {\n const props: ReactMarkViewProps = useMarkViewContext()\n return createElement(component, props)\n }\n}\n\n/**\n * @internal\n */\nexport const ReactMarkViewConsumer: FC = () => {\n const markViewFactory = useMarkViewFactory()\n const extension = useMemo(\n () => defineReactMarkViewFactory(markViewFactory),\n [markViewFactory],\n )\n useExtension(extension)\n\n return null\n}\n\n/**\n * Defines a mark view using a React component.\n *\n * @public\n */\nexport function defineReactMarkView(options: ReactMarkViewOptions): Extension {\n const { name, component, ...userOptions } = options\n\n const args: ReactMarkViewUserOptions = {\n ...userOptions,\n component: withMarkViewProps(component),\n }\n\n return defineMarkViewComponent<ReactMarkViewUserOptions>({\n group: 'react',\n name,\n args,\n })\n}\n\nfunction defineReactMarkViewFactory(\n factory: (options: ReactMarkViewUserOptions) => MarkViewConstructor,\n) {\n return defineMarkViewFactory<ReactMarkViewUserOptions>({\n group: 'react',\n factory,\n })\n}\n","import {\n defineNodeViewComponent,\n defineNodeViewFactory,\n type Extension,\n} from '@prosekit/core'\nimport type { NodeViewConstructor } from '@prosekit/pm/view'\nimport type { CoreNodeViewUserOptions } from '@prosemirror-adapter/core'\nimport {\n useNodeViewContext,\n useNodeViewFactory,\n type NodeViewContext,\n type ReactNodeViewUserOptions,\n} from '@prosemirror-adapter/react'\nimport {\n createElement,\n useMemo,\n type ComponentType,\n type FC,\n} from 'react'\n\nimport { useExtension } from '../hooks/use-extension'\n\n/**\n * @public\n */\nexport interface ReactNodeViewProps extends NodeViewContext {}\n\n/**\n * @public\n */\nexport type ReactNodeViewComponent = ComponentType<ReactNodeViewProps>\n\n/**\n * Options for {@link defineReactNodeView}.\n *\n * @public\n */\nexport interface ReactNodeViewOptions extends CoreNodeViewUserOptions<ReactNodeViewComponent> {\n /**\n * The name of the node type.\n */\n name: string\n}\n\nfunction withNodeViewProps(component: ReactNodeViewComponent) {\n return function NodeViewPropsWrapper() {\n const props: ReactNodeViewProps = useNodeViewContext()\n return createElement(component, props)\n }\n}\n\n/**\n * @internal\n */\nexport const ReactNodeViewConsumer: FC = () => {\n const nodeViewFactory = useNodeViewFactory()\n const extension = useMemo(\n () => defineReactNodeViewFactory(nodeViewFactory),\n [nodeViewFactory],\n )\n useExtension(extension)\n\n return null\n}\n\n/**\n * Defines a node view using a React component.\n *\n * @public\n */\nexport function defineReactNodeView(options: ReactNodeViewOptions): Extension {\n const { name, component, ...userOptions } = options\n\n const args: ReactNodeViewUserOptions = {\n ...userOptions,\n component: withNodeViewProps(component),\n }\n\n return defineNodeViewComponent<ReactNodeViewUserOptions>({\n group: 'react',\n name,\n args,\n })\n}\n\nfunction defineReactNodeViewFactory(\n factory: (options: ReactNodeViewUserOptions) => NodeViewConstructor,\n) {\n return defineNodeViewFactory<ReactNodeViewUserOptions>({\n group: 'react',\n factory,\n })\n}\n","import type { Editor } from '@prosekit/core'\nimport { ProsemirrorAdapterProvider } from '@prosemirror-adapter/react'\nimport {\n createElement,\n type ComponentType,\n type ReactNode,\n} from 'react'\n\nimport { EditorContextProvider } from '../contexts/editor-context'\nimport { ReactMarkViewConsumer } from '../extensions/react-mark-view'\nimport { ReactNodeViewConsumer } from '../extensions/react-node-view'\n\nexport interface ProseKitProps {\n editor: Editor\n children?: ReactNode\n}\n\n/**\n * The root component for a ProseKit editor.\n *\n * @public\n */\nexport const ProseKit: ComponentType<ProseKitProps> = (props) => {\n const { editor, children } = props\n\n return createElement(\n ProsemirrorAdapterProvider,\n null,\n createElement(\n EditorContextProvider,\n { value: editor },\n createElement(ReactNodeViewConsumer),\n createElement(ReactMarkViewConsumer),\n children,\n ),\n )\n}\n","import { defineDocChangeHandler } from '@prosekit/core'\nimport type { ProseMirrorNode } from '@prosekit/pm/model'\nimport { useMemo } from 'react'\n\nimport {\n useExtension,\n type UseExtensionOptions,\n} from './use-extension'\n\n/**\n * Calls the given handler whenever the editor document changes.\n *\n * @public\n */\nexport function useDocChange(\n handler: (doc: ProseMirrorNode) => void,\n options?: UseExtensionOptions,\n): void {\n const extension = useMemo(\n () => defineDocChangeHandler((view) => handler(view.state.doc)),\n [handler],\n )\n useExtension(extension, options)\n}\n","import {\n defineMountHandler,\n defineUpdateHandler,\n ProseKitError,\n union,\n type Editor,\n type Extension,\n} from '@prosekit/core'\nimport {\n useEffect,\n useReducer,\n} from 'react'\n\nimport { useEditorContext } from '../contexts/editor-context'\n\n/**\n * Retrieves the editor instance from the nearest ProseKit component.\n *\n * @public\n */\nexport function useEditor<E extends Extension = any>(options?: {\n /**\n * Whether to update the component when the editor is mounted or editor state\n * is updated.\n *\n * Note this this option doesn't work with [React\n * compiler](https://react.dev/learn/react-compiler) because the returned\n * editor will be the same instance after state updates. If you're using React\n * compiler, you should use {@link useEditorDerivedValue} instead.\n *\n * @default false\n */\n update?: boolean\n}): Editor<E> {\n const update = options?.update ?? false\n\n const editor = useEditorContext<E>()\n if (!editor) {\n throw new ProseKitError(\n 'useEditor must be used within the ProseKit component',\n )\n }\n\n const forceUpdate = useForceUpdate()\n\n useEffect(() => {\n if (update) {\n const extension = union(\n defineMountHandler(forceUpdate),\n defineUpdateHandler(forceUpdate),\n )\n return editor.use(extension)\n }\n }, [editor, update, forceUpdate])\n\n return editor\n}\n\nfunction useForceUpdate() {\n const [, dispatch] = useReducer((x: number) => x + 1, 0)\n return dispatch\n}\n","import {\n defineMountHandler,\n defineUpdateHandler,\n EditorNotFoundError,\n union,\n type Editor,\n type Extension,\n} from '@prosekit/core'\nimport {\n useMemo,\n useSyncExternalStore,\n} from 'react'\n\nimport { useEditorContext } from '../contexts/editor-context'\n\nexport interface UseEditorDerivedOptions<E extends Extension = any> {\n /**\n * The editor to add the extension to. If not provided, it will use the\n * editor from the nearest `ProseKit` component.\n */\n editor?: Editor<E>\n}\n\n/**\n * A hook that runs a function to derive a value from the editor instance after\n * editor state changes.\n *\n * This is useful when you need to render something based on the editor state,\n * for example, whether the selected text is wrapped in an italic mark.\n *\n * @public\n */\nexport function useEditorDerivedValue<E extends Extension, Derived>(\n /**\n * A function that receives the editor instance and returns a derived value.\n *\n * It will be called whenever the editor's document state changes, or when it\n * mounts.\n *\n * This function should be memoized.\n */\n derive: (editor: Editor<E>) => Derived,\n options?: UseEditorDerivedOptions<E>,\n): Derived {\n const editorContext = useEditorContext<E>()\n const editor = options?.editor ?? editorContext\n if (!editor) {\n throw new EditorNotFoundError()\n }\n\n const [subscribe, getSnapshot] = useMemo(() => {\n return createEditorStore(editor, derive)\n }, [editor, derive])\n\n return useSyncExternalStore(subscribe, getSnapshot)\n}\n\nfunction createEditorStore<Derived, E extends Extension = any>(editor: Editor<E>, derive: (editor: Editor<E>) => Derived) {\n let dirty = true\n let derived: Derived\n\n const subscribe = (onChange: VoidFunction): VoidFunction => {\n const handleChange = () => {\n dirty = true\n onChange()\n }\n const extension = union(\n defineUpdateHandler(handleChange),\n defineMountHandler(handleChange),\n )\n return editor.use(extension)\n }\n\n const getSnapshot = () => {\n if (dirty) {\n dirty = false\n derived = derive(editor)\n }\n return derived\n }\n\n return [subscribe, getSnapshot] as const\n}\n","import {\n defineKeymap,\n type Keymap,\n} from '@prosekit/core'\nimport { useMemo } from 'react'\n\nimport {\n useExtension,\n type UseExtensionOptions,\n} from './use-extension'\n\nexport function useKeymap(keymap: Keymap, options?: UseExtensionOptions): void {\n const extension = useMemo(() => defineKeymap(keymap), [keymap])\n useExtension(extension, options)\n}\n","import { defineUpdateHandler } from '@prosekit/core'\nimport type { EditorState } from '@prosekit/pm/state'\nimport { useMemo } from 'react'\n\nimport {\n useExtension,\n type UseExtensionOptions,\n} from './use-extension'\n\n/**\n * Calls the given handler whenever the editor state changes.\n *\n * @public\n */\nexport function useStateUpdate(\n handler: (state: EditorState) => void,\n options?: UseExtensionOptions,\n): void {\n const extension = useMemo(\n () => defineUpdateHandler((view) => handler(view.state)),\n [handler],\n )\n useExtension(extension, options)\n}\n"],"mappings":"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"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prosekit/react",
3
3
  "type": "module",
4
- "version": "0.6.0",
4
+ "version": "0.6.1",
5
5
  "private": false,
6
6
  "description": "React components and utilities for ProseKit",
7
7
  "author": {
@@ -10,14 +10,14 @@
10
10
  },
11
11
  "license": "MIT",
12
12
  "funding": "https://github.com/sponsors/ocavue",
13
- "homepage": "https://github.com/ocavue/prosekit#readme",
13
+ "homepage": "https://github.com/prosekit/prosekit#readme",
14
14
  "repository": {
15
15
  "type": "git",
16
- "url": "git+https://github.com/ocavue/prosekit.git",
16
+ "url": "git+https://github.com/prosekit/prosekit.git",
17
17
  "directory": "packages/react"
18
18
  },
19
19
  "bugs": {
20
- "url": "https://github.com/ocavue/prosekit/issues"
20
+ "url": "https://github.com/prosekit/prosekit/issues"
21
21
  },
22
22
  "keywords": [
23
23
  "ProseMirror"
@@ -64,14 +64,15 @@
64
64
  }
65
65
  },
66
66
  "files": [
67
- "dist"
67
+ "dist",
68
+ "src"
68
69
  ],
69
70
  "dependencies": {
70
- "@prosemirror-adapter/core": "^0.4.0",
71
- "@prosemirror-adapter/react": "^0.4.1",
72
- "@prosekit/core": "^0.8.3",
73
- "@prosekit/web": "^0.7.0",
74
- "@prosekit/pm": "^0.1.11"
71
+ "@prosemirror-adapter/core": "^0.4.2",
72
+ "@prosemirror-adapter/react": "^0.4.4",
73
+ "@prosekit/web": "^0.7.4",
74
+ "@prosekit/pm": "^0.1.12",
75
+ "@prosekit/core": "^0.8.4"
75
76
  },
76
77
  "peerDependencies": {
77
78
  "react": ">= 18.2.0",
@@ -86,15 +87,14 @@
86
87
  }
87
88
  },
88
89
  "devDependencies": {
89
- "@types/react": "^19.1.9",
90
- "@types/react-dom": "^19.1.7",
90
+ "@types/react": "^19.1.12",
91
+ "@types/react-dom": "^19.1.9",
91
92
  "react": "^19.1.1",
92
93
  "react-dom": "^19.1.1",
93
- "tsdown": "^0.13.1",
94
- "typescript": "~5.8.3",
95
- "vitest": "^3.2.4",
96
- "@prosekit/config-vitest": "0.0.0",
97
- "@prosekit/config-tsdown": "0.0.0"
94
+ "tsdown": "^0.14.2",
95
+ "typescript": "~5.9.2",
96
+ "@prosekit/config-tsdown": "0.0.0",
97
+ "@prosekit/config-vitest": "0.0.0"
98
98
  },
99
99
  "publishConfig": {
100
100
  "dev": {}
@@ -104,12 +104,12 @@
104
104
  "prosekit-react": "./src/index.ts",
105
105
  "prosekit-react-autocomplete": "./src/components/autocomplete/index.gen.ts",
106
106
  "prosekit-react-block-handle": "./src/components/block-handle/index.gen.ts",
107
+ "prosekit-react-drop-indicator": "./src/components/drop-indicator/index.gen.ts",
107
108
  "prosekit-react-inline-popover": "./src/components/inline-popover/index.gen.ts",
108
109
  "prosekit-react-popover": "./src/components/popover/index.gen.ts",
109
110
  "prosekit-react-resizable": "./src/components/resizable/index.gen.ts",
110
111
  "prosekit-react-table-handle": "./src/components/table-handle/index.gen.ts",
111
- "prosekit-react-tooltip": "./src/components/tooltip/index.gen.ts",
112
- "prosekit-react-drop-indicator": "./src/components/drop-indicator/index.gen.ts"
112
+ "prosekit-react-tooltip": "./src/components/tooltip/index.gen.ts"
113
113
  }
114
114
  },
115
115
  "scripts": {
@@ -0,0 +1,34 @@
1
+ import {
2
+ type AutocompleteEmptyElement,
3
+ type AutocompleteEmptyProps as Props,
4
+ type AutocompleteEmptyEvents as Events,
5
+ autocompleteEmptyProps,
6
+ autocompleteEmptyEvents,
7
+ } from '@prosekit/web/autocomplete'
8
+ import type {
9
+ ForwardRefExoticComponent,
10
+ HTMLAttributes,
11
+ RefAttributes,
12
+ } from 'react'
13
+
14
+ import { createComponent } from '../create-component'
15
+ import type { CreateProps } from '../create-props'
16
+
17
+ /**
18
+ * Props for the {@link AutocompleteEmpty} component.
19
+ */
20
+ export interface AutocompleteEmptyProps extends Partial<CreateProps<Props, Events>> {}
21
+
22
+ export const AutocompleteEmpty: ForwardRefExoticComponent<
23
+ AutocompleteEmptyProps &
24
+ RefAttributes<AutocompleteEmptyElement> &
25
+ HTMLAttributes<AutocompleteEmptyElement>
26
+ > = createComponent<
27
+ AutocompleteEmptyProps,
28
+ AutocompleteEmptyElement
29
+ >(
30
+ 'prosekit-autocomplete-empty',
31
+ 'AutocompleteEmpty',
32
+ Object.keys(autocompleteEmptyProps),
33
+ Object.keys(autocompleteEmptyEvents),
34
+ )
@@ -0,0 +1,34 @@
1
+ import {
2
+ type AutocompleteItemElement,
3
+ type AutocompleteItemProps as Props,
4
+ type AutocompleteItemEvents as Events,
5
+ autocompleteItemProps,
6
+ autocompleteItemEvents,
7
+ } from '@prosekit/web/autocomplete'
8
+ import type {
9
+ ForwardRefExoticComponent,
10
+ HTMLAttributes,
11
+ RefAttributes,
12
+ } from 'react'
13
+
14
+ import { createComponent } from '../create-component'
15
+ import type { CreateProps } from '../create-props'
16
+
17
+ /**
18
+ * Props for the {@link AutocompleteItem} component.
19
+ */
20
+ export interface AutocompleteItemProps extends Partial<CreateProps<Props, Events>> {}
21
+
22
+ export const AutocompleteItem: ForwardRefExoticComponent<
23
+ AutocompleteItemProps &
24
+ RefAttributes<AutocompleteItemElement> &
25
+ HTMLAttributes<AutocompleteItemElement>
26
+ > = createComponent<
27
+ AutocompleteItemProps,
28
+ AutocompleteItemElement
29
+ >(
30
+ 'prosekit-autocomplete-item',
31
+ 'AutocompleteItem',
32
+ Object.keys(autocompleteItemProps),
33
+ Object.keys(autocompleteItemEvents),
34
+ )
@@ -0,0 +1,34 @@
1
+ import {
2
+ type AutocompleteListElement,
3
+ type AutocompleteListProps as Props,
4
+ type AutocompleteListEvents as Events,
5
+ autocompleteListProps,
6
+ autocompleteListEvents,
7
+ } from '@prosekit/web/autocomplete'
8
+ import type {
9
+ ForwardRefExoticComponent,
10
+ HTMLAttributes,
11
+ RefAttributes,
12
+ } from 'react'
13
+
14
+ import { createComponent } from '../create-component'
15
+ import type { CreateProps } from '../create-props'
16
+
17
+ /**
18
+ * Props for the {@link AutocompleteList} component.
19
+ */
20
+ export interface AutocompleteListProps extends Partial<CreateProps<Props, Events>> {}
21
+
22
+ export const AutocompleteList: ForwardRefExoticComponent<
23
+ AutocompleteListProps &
24
+ RefAttributes<AutocompleteListElement> &
25
+ HTMLAttributes<AutocompleteListElement>
26
+ > = createComponent<
27
+ AutocompleteListProps,
28
+ AutocompleteListElement
29
+ >(
30
+ 'prosekit-autocomplete-list',
31
+ 'AutocompleteList',
32
+ Object.keys(autocompleteListProps),
33
+ Object.keys(autocompleteListEvents),
34
+ )
@@ -0,0 +1,34 @@
1
+ import {
2
+ type AutocompletePopoverElement,
3
+ type AutocompletePopoverProps as Props,
4
+ type AutocompletePopoverEvents as Events,
5
+ autocompletePopoverProps,
6
+ autocompletePopoverEvents,
7
+ } from '@prosekit/web/autocomplete'
8
+ import type {
9
+ ForwardRefExoticComponent,
10
+ HTMLAttributes,
11
+ RefAttributes,
12
+ } from 'react'
13
+
14
+ import { createComponent } from '../create-component'
15
+ import type { CreateProps } from '../create-props'
16
+
17
+ /**
18
+ * Props for the {@link AutocompletePopover} component.
19
+ */
20
+ export interface AutocompletePopoverProps extends Partial<CreateProps<Props, Events>> {}
21
+
22
+ export const AutocompletePopover: ForwardRefExoticComponent<
23
+ AutocompletePopoverProps &
24
+ RefAttributes<AutocompletePopoverElement> &
25
+ HTMLAttributes<AutocompletePopoverElement>
26
+ > = createComponent<
27
+ AutocompletePopoverProps,
28
+ AutocompletePopoverElement
29
+ >(
30
+ 'prosekit-autocomplete-popover',
31
+ 'AutocompletePopover',
32
+ Object.keys(autocompletePopoverProps),
33
+ Object.keys(autocompletePopoverEvents),
34
+ )
@@ -0,0 +1,7 @@
1
+ export { AutocompleteEmpty, type AutocompleteEmptyProps } from './autocomplete-empty.gen'
2
+
3
+ export { AutocompleteItem, type AutocompleteItemProps } from './autocomplete-item.gen'
4
+
5
+ export { AutocompleteList, type AutocompleteListProps } from './autocomplete-list.gen'
6
+
7
+ export { AutocompletePopover, type AutocompletePopoverProps } from './autocomplete-popover.gen'
@@ -0,0 +1,34 @@
1
+ import {
2
+ type BlockHandleAddElement,
3
+ type BlockHandleAddProps as Props,
4
+ type BlockHandleAddEvents as Events,
5
+ blockHandleAddProps,
6
+ blockHandleAddEvents,
7
+ } from '@prosekit/web/block-handle'
8
+ import type {
9
+ ForwardRefExoticComponent,
10
+ HTMLAttributes,
11
+ RefAttributes,
12
+ } from 'react'
13
+
14
+ import { createComponent } from '../create-component'
15
+ import type { CreateProps } from '../create-props'
16
+
17
+ /**
18
+ * Props for the {@link BlockHandleAdd} component.
19
+ */
20
+ export interface BlockHandleAddProps extends Partial<CreateProps<Props, Events>> {}
21
+
22
+ export const BlockHandleAdd: ForwardRefExoticComponent<
23
+ BlockHandleAddProps &
24
+ RefAttributes<BlockHandleAddElement> &
25
+ HTMLAttributes<BlockHandleAddElement>
26
+ > = createComponent<
27
+ BlockHandleAddProps,
28
+ BlockHandleAddElement
29
+ >(
30
+ 'prosekit-block-handle-add',
31
+ 'BlockHandleAdd',
32
+ Object.keys(blockHandleAddProps),
33
+ Object.keys(blockHandleAddEvents),
34
+ )
@@ -0,0 +1,34 @@
1
+ import {
2
+ type BlockHandleDraggableElement,
3
+ type BlockHandleDraggableProps as Props,
4
+ type BlockHandleDraggableEvents as Events,
5
+ blockHandleDraggableProps,
6
+ blockHandleDraggableEvents,
7
+ } from '@prosekit/web/block-handle'
8
+ import type {
9
+ ForwardRefExoticComponent,
10
+ HTMLAttributes,
11
+ RefAttributes,
12
+ } from 'react'
13
+
14
+ import { createComponent } from '../create-component'
15
+ import type { CreateProps } from '../create-props'
16
+
17
+ /**
18
+ * Props for the {@link BlockHandleDraggable} component.
19
+ */
20
+ export interface BlockHandleDraggableProps extends Partial<CreateProps<Props, Events>> {}
21
+
22
+ export const BlockHandleDraggable: ForwardRefExoticComponent<
23
+ BlockHandleDraggableProps &
24
+ RefAttributes<BlockHandleDraggableElement> &
25
+ HTMLAttributes<BlockHandleDraggableElement>
26
+ > = createComponent<
27
+ BlockHandleDraggableProps,
28
+ BlockHandleDraggableElement
29
+ >(
30
+ 'prosekit-block-handle-draggable',
31
+ 'BlockHandleDraggable',
32
+ Object.keys(blockHandleDraggableProps),
33
+ Object.keys(blockHandleDraggableEvents),
34
+ )
@@ -0,0 +1,34 @@
1
+ import {
2
+ type BlockHandlePopoverElement,
3
+ type BlockHandlePopoverProps as Props,
4
+ type BlockHandlePopoverEvents as Events,
5
+ blockHandlePopoverProps,
6
+ blockHandlePopoverEvents,
7
+ } from '@prosekit/web/block-handle'
8
+ import type {
9
+ ForwardRefExoticComponent,
10
+ HTMLAttributes,
11
+ RefAttributes,
12
+ } from 'react'
13
+
14
+ import { createComponent } from '../create-component'
15
+ import type { CreateProps } from '../create-props'
16
+
17
+ /**
18
+ * Props for the {@link BlockHandlePopover} component.
19
+ */
20
+ export interface BlockHandlePopoverProps extends Partial<CreateProps<Props, Events>> {}
21
+
22
+ export const BlockHandlePopover: ForwardRefExoticComponent<
23
+ BlockHandlePopoverProps &
24
+ RefAttributes<BlockHandlePopoverElement> &
25
+ HTMLAttributes<BlockHandlePopoverElement>
26
+ > = createComponent<
27
+ BlockHandlePopoverProps,
28
+ BlockHandlePopoverElement
29
+ >(
30
+ 'prosekit-block-handle-popover',
31
+ 'BlockHandlePopover',
32
+ Object.keys(blockHandlePopoverProps),
33
+ Object.keys(blockHandlePopoverEvents),
34
+ )