@prosekit/react 0.7.0-beta.0 → 0.7.0-beta.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 (117) hide show
  1. package/dist/prosekit-react-autocomplete.d.ts +224 -17
  2. package/dist/prosekit-react-autocomplete.d.ts.map +1 -1
  3. package/dist/prosekit-react-autocomplete.js +216 -9
  4. package/dist/prosekit-react-autocomplete.js.map +1 -1
  5. package/dist/prosekit-react-block-handle.d.ts +208 -13
  6. package/dist/prosekit-react-block-handle.d.ts.map +1 -1
  7. package/dist/prosekit-react-block-handle.js +182 -7
  8. package/dist/prosekit-react-block-handle.js.map +1 -1
  9. package/dist/prosekit-react-drop-indicator.d.ts +25 -5
  10. package/dist/prosekit-react-drop-indicator.d.ts.map +1 -1
  11. package/dist/prosekit-react-drop-indicator.js +36 -3
  12. package/dist/prosekit-react-drop-indicator.js.map +1 -1
  13. package/dist/prosekit-react-inline-popover.d.ts +202 -7
  14. package/dist/prosekit-react-inline-popover.d.ts.map +1 -1
  15. package/dist/prosekit-react-inline-popover.js +128 -5
  16. package/dist/prosekit-react-inline-popover.js.map +1 -1
  17. package/dist/prosekit-react-menu.d.ts +287 -0
  18. package/dist/prosekit-react-menu.d.ts.map +1 -0
  19. package/dist/prosekit-react-menu.js +272 -0
  20. package/dist/prosekit-react-menu.js.map +1 -0
  21. package/dist/prosekit-react-popover.d.ts +225 -13
  22. package/dist/prosekit-react-popover.d.ts.map +1 -1
  23. package/dist/prosekit-react-popover.js +168 -7
  24. package/dist/prosekit-react-popover.js.map +1 -1
  25. package/dist/prosekit-react-resizable.d.ts +54 -11
  26. package/dist/prosekit-react-resizable.d.ts.map +1 -1
  27. package/dist/prosekit-react-resizable.js +78 -7
  28. package/dist/prosekit-react-resizable.js.map +1 -1
  29. package/dist/prosekit-react-table-handle.d.ts +445 -37
  30. package/dist/prosekit-react-table-handle.d.ts.map +1 -1
  31. package/dist/prosekit-react-table-handle.js +379 -19
  32. package/dist/prosekit-react-table-handle.js.map +1 -1
  33. package/dist/prosekit-react-tooltip.d.ts +209 -13
  34. package/dist/prosekit-react-tooltip.d.ts.map +1 -1
  35. package/dist/prosekit-react-tooltip.js +155 -7
  36. package/dist/prosekit-react-tooltip.js.map +1 -1
  37. package/package.json +28 -17
  38. package/src/components/autocomplete/autocomplete-empty.gen.ts +39 -31
  39. package/src/components/autocomplete/autocomplete-item.gen.ts +82 -31
  40. package/src/components/autocomplete/autocomplete-popup.gen.ts +78 -0
  41. package/src/components/autocomplete/autocomplete-positioner.gen.ts +151 -0
  42. package/src/components/autocomplete/autocomplete-root.gen.ts +107 -0
  43. package/src/components/autocomplete/index.gen.ts +12 -4
  44. package/src/components/autocomplete/index.ts +27 -0
  45. package/src/components/block-handle/block-handle-add.gen.ts +57 -31
  46. package/src/components/block-handle/block-handle-draggable.gen.ts +57 -31
  47. package/src/components/block-handle/block-handle-popup.gen.ts +42 -0
  48. package/src/components/block-handle/block-handle-positioner.gen.ts +169 -0
  49. package/src/components/block-handle/block-handle-root.gen.ts +82 -0
  50. package/src/components/block-handle/index.gen.ts +13 -3
  51. package/src/components/block-handle/index.ts +27 -0
  52. package/src/components/drop-indicator/drop-indicator.gen.ts +63 -31
  53. package/src/components/drop-indicator/index.gen.ts +5 -1
  54. package/src/components/drop-indicator/index.ts +14 -0
  55. package/src/components/inline-popover/index.gen.ts +11 -1
  56. package/src/components/inline-popover/index.ts +22 -0
  57. package/src/components/inline-popover/inline-popover-popup.gen.ts +42 -0
  58. package/src/components/inline-popover/inline-popover-positioner.gen.ts +175 -0
  59. package/src/components/inline-popover/inline-popover-root.gen.ts +106 -0
  60. package/src/components/menu/index.gen.ts +19 -0
  61. package/src/components/menu/index.ts +37 -0
  62. package/src/components/menu/menu-item.gen.ts +89 -0
  63. package/src/components/menu/menu-popup.gen.ts +56 -0
  64. package/src/components/menu/menu-positioner.gen.ts +176 -0
  65. package/src/components/menu/menu-root.gen.ts +86 -0
  66. package/src/components/menu/menu-submenu-root.gen.ts +42 -0
  67. package/src/components/menu/menu-submenu-trigger.gen.ts +42 -0
  68. package/src/components/menu/menu-trigger.gen.ts +77 -0
  69. package/src/components/popover/index.gen.ts +11 -3
  70. package/src/components/popover/index.ts +24 -0
  71. package/src/components/popover/popover-popup.gen.ts +42 -0
  72. package/src/components/popover/popover-positioner.gen.ts +176 -0
  73. package/src/components/popover/popover-root.gen.ts +90 -31
  74. package/src/components/popover/popover-trigger.gen.ts +90 -31
  75. package/src/components/resizable/index.gen.ts +8 -2
  76. package/src/components/resizable/index.ts +20 -0
  77. package/src/components/resizable/resizable-handle.gen.ts +52 -31
  78. package/src/components/resizable/resizable-root.gen.ts +88 -31
  79. package/src/components/table-handle/index.gen.ts +17 -9
  80. package/src/components/table-handle/index.ts +58 -0
  81. package/src/components/table-handle/table-handle-column-menu-root.gen.ts +64 -0
  82. package/src/components/table-handle/table-handle-column-menu-trigger.gen.ts +58 -0
  83. package/src/components/table-handle/table-handle-column-popup.gen.ts +42 -0
  84. package/src/components/table-handle/table-handle-column-positioner.gen.ts +199 -0
  85. package/src/components/table-handle/table-handle-drag-preview.gen.ts +55 -31
  86. package/src/components/table-handle/table-handle-drop-indicator.gen.ts +55 -31
  87. package/src/components/table-handle/table-handle-root.gen.ts +57 -31
  88. package/src/components/table-handle/table-handle-row-menu-root.gen.ts +64 -0
  89. package/src/components/table-handle/table-handle-row-menu-trigger.gen.ts +58 -0
  90. package/src/components/table-handle/table-handle-row-popup.gen.ts +42 -0
  91. package/src/components/table-handle/table-handle-row-positioner.gen.ts +199 -0
  92. package/src/components/tooltip/index.gen.ts +11 -3
  93. package/src/components/tooltip/index.ts +24 -0
  94. package/src/components/tooltip/tooltip-popup.gen.ts +42 -0
  95. package/src/components/tooltip/tooltip-positioner.gen.ts +176 -0
  96. package/src/components/tooltip/tooltip-root.gen.ts +83 -31
  97. package/src/components/tooltip/tooltip-trigger.gen.ts +61 -31
  98. package/src/extensions/react-node-view.spec.ts +150 -0
  99. package/dist/create-component.js +0 -94
  100. package/dist/create-component.js.map +0 -1
  101. package/dist/create-props.d.ts +0 -6
  102. package/dist/create-props.d.ts.map +0 -1
  103. package/src/components/autocomplete/autocomplete-list.gen.ts +0 -34
  104. package/src/components/autocomplete/autocomplete-popover.gen.ts +0 -34
  105. package/src/components/block-handle/block-handle-popover.gen.ts +0 -34
  106. package/src/components/create-component.ts +0 -137
  107. package/src/components/create-props.ts +0 -13
  108. package/src/components/inline-popover/inline-popover.gen.ts +0 -34
  109. package/src/components/merge-refs.ts +0 -35
  110. package/src/components/popover/popover-content.gen.ts +0 -34
  111. package/src/components/table-handle/table-handle-column-root.gen.ts +0 -34
  112. package/src/components/table-handle/table-handle-column-trigger.gen.ts +0 -34
  113. package/src/components/table-handle/table-handle-popover-content.gen.ts +0 -34
  114. package/src/components/table-handle/table-handle-popover-item.gen.ts +0 -34
  115. package/src/components/table-handle/table-handle-row-root.gen.ts +0 -34
  116. package/src/components/table-handle/table-handle-row-trigger.gen.ts +0 -34
  117. package/src/components/tooltip/tooltip-content.gen.ts +0 -34
@@ -1,34 +1,241 @@
1
- import { t as CreateProps } from "./create-props.js";
2
1
  import { ForwardRefExoticComponent, HTMLAttributes, RefAttributes } from "react";
3
- import { AutocompleteEmptyElement, AutocompleteEmptyEvents, AutocompleteEmptyProps as AutocompleteEmptyProps$1, AutocompleteItemElement, AutocompleteItemEvents, AutocompleteItemProps as AutocompleteItemProps$1, AutocompleteListElement, AutocompleteListEvents, AutocompleteListProps as AutocompleteListProps$1, AutocompletePopoverElement, AutocompletePopoverEvents, AutocompletePopoverProps as AutocompletePopoverProps$1 } from "@prosekit/web/autocomplete";
2
+ import { AutocompleteEmptyElement, AutocompleteItemElement, AutocompleteItemEvents, AutocompleteItemProps as AutocompleteItemProps$1, AutocompletePopupElement, AutocompletePopupEvents, AutocompletePositionerElement, AutocompletePositionerProps as AutocompletePositionerProps$1, AutocompleteRootElement, AutocompleteRootEvents, AutocompleteRootProps as AutocompleteRootProps$1, OpenChangeEvent, QueryChangeEvent, SelectEvent, ValueChangeEvent, ValuesChangeEvent } from "@prosekit/web/autocomplete";
4
3
 
5
4
  //#region src/components/autocomplete/autocomplete-empty.gen.d.ts
6
5
  /**
7
- * Props for the {@link AutocompleteEmpty} component.
6
+ * Props for the {@link AutocompleteEmpty} React component.
7
+ *
8
+ * @public
8
9
  */
9
- interface AutocompleteEmptyProps extends Partial<CreateProps<AutocompleteEmptyProps$1, AutocompleteEmptyEvents>> {}
10
- declare const AutocompleteEmpty: ForwardRefExoticComponent<AutocompleteEmptyProps & RefAttributes<AutocompleteEmptyElement> & HTMLAttributes<AutocompleteEmptyElement>>;
10
+ interface AutocompleteEmptyProps extends HTMLAttributes<AutocompleteEmptyElement> {}
11
+ /**
12
+ * A React component that renders an `prosekit-autocomplete-empty` custom element.
13
+ *
14
+ * @public
15
+ */
16
+ declare const AutocompleteEmpty: ForwardRefExoticComponent<AutocompleteEmptyProps & RefAttributes<AutocompleteEmptyElement>>;
11
17
  //#endregion
12
18
  //#region src/components/autocomplete/autocomplete-item.gen.d.ts
13
19
  /**
14
- * Props for the {@link AutocompleteItem} component.
20
+ * Props for the {@link AutocompleteItem} React component.
21
+ *
22
+ * @public
23
+ */
24
+ interface AutocompleteItemProps extends Omit<HTMLAttributes<AutocompleteItemElement>, 'onSelect'> {
25
+ /**
26
+ * The value of the item, which will be matched against the query.
27
+ *
28
+ * If not provided, the value is the item's text content.
29
+ *
30
+ * @default ""
31
+ */
32
+ value?: AutocompleteItemProps$1['value'];
33
+ /**
34
+ * Whether this option is disabled.
35
+ *
36
+ * @default false
37
+ */
38
+ disabled?: AutocompleteItemProps$1['disabled'];
39
+ /** Emitted when the the item is selected. */
40
+ onSelect?: (event: AutocompleteItemEvents['select']) => void;
41
+ }
42
+ /**
43
+ * A React component that renders an `prosekit-autocomplete-item` custom element.
44
+ *
45
+ * @public
15
46
  */
16
- interface AutocompleteItemProps extends Partial<CreateProps<AutocompleteItemProps$1, AutocompleteItemEvents>> {}
17
- declare const AutocompleteItem: ForwardRefExoticComponent<AutocompleteItemProps & RefAttributes<AutocompleteItemElement> & HTMLAttributes<AutocompleteItemElement>>;
47
+ declare const AutocompleteItem: ForwardRefExoticComponent<AutocompleteItemProps & RefAttributes<AutocompleteItemElement>>;
18
48
  //#endregion
19
- //#region src/components/autocomplete/autocomplete-list.gen.d.ts
49
+ //#region src/components/autocomplete/autocomplete-popup.gen.d.ts
20
50
  /**
21
- * Props for the {@link AutocompleteList} component.
51
+ * Props for the {@link AutocompletePopup} React component.
52
+ *
53
+ * @public
22
54
  */
23
- interface AutocompleteListProps extends Partial<CreateProps<AutocompleteListProps$1, AutocompleteListEvents>> {}
24
- declare const AutocompleteList: ForwardRefExoticComponent<AutocompleteListProps & RefAttributes<AutocompleteListElement> & HTMLAttributes<AutocompleteListElement>>;
55
+ interface AutocompletePopupProps extends HTMLAttributes<AutocompletePopupElement> {
56
+ /**
57
+ * Emitted when the selected value changes. Only available when multiple is
58
+ * false.
59
+ */
60
+ onValueChange?: (event: AutocompletePopupEvents['valueChange']) => void;
61
+ /**
62
+ * Emitted when the selected values change. Only available when multiple is
63
+ * true.
64
+ */
65
+ onValuesChange?: (event: AutocompletePopupEvents['valuesChange']) => void;
66
+ }
67
+ /**
68
+ * A React component that renders an `prosekit-autocomplete-popup` custom element.
69
+ *
70
+ * @public
71
+ */
72
+ declare const AutocompletePopup: ForwardRefExoticComponent<AutocompletePopupProps & RefAttributes<AutocompletePopupElement>>;
25
73
  //#endregion
26
- //#region src/components/autocomplete/autocomplete-popover.gen.d.ts
74
+ //#region src/components/autocomplete/autocomplete-positioner.gen.d.ts
75
+ /**
76
+ * Props for the {@link AutocompletePositioner} React component.
77
+ *
78
+ * @public
79
+ */
80
+ interface AutocompletePositionerProps extends HTMLAttributes<AutocompletePositionerElement> {
81
+ /**
82
+ * The placement of the popover, relative to the text cursor.
83
+ *
84
+ * @default "bottom-start"
85
+ */
86
+ placement?: AutocompletePositionerProps$1['placement'];
87
+ /**
88
+ * The distance between the popover and the hovered block.
89
+ *
90
+ * @default 4
91
+ */
92
+ offset?: AutocompletePositionerProps$1['offset'];
93
+ /** @default true */
94
+ inline?: AutocompletePositionerProps$1['inline'];
95
+ /** @default true */
96
+ hoist?: AutocompletePositionerProps$1['hoist'];
97
+ /** @default true */
98
+ fitViewport?: AutocompletePositionerProps$1['fitViewport'];
99
+ /** @default "The body element" */
100
+ boundary?: AutocompletePositionerProps$1['boundary'];
101
+ /** @default 8 */
102
+ overflowPadding?: AutocompletePositionerProps$1['overflowPadding'];
103
+ /**
104
+ * The strategy to use for positioning
105
+ *
106
+ * @default "absolute"
107
+ */
108
+ strategy?: AutocompletePositionerProps$1['strategy'];
109
+ /**
110
+ * Options to activate auto-update listeners
111
+ *
112
+ * @see https://floating-ui.com/docs/autoUpdate
113
+ *
114
+ * @default true
115
+ */
116
+ autoUpdate?: AutocompletePositionerProps$1['autoUpdate'];
117
+ /**
118
+ * Whether to flip the `placement` in order to keep it in view when the
119
+ * preferred placement(s) will overflow the clipping boundary. You can also
120
+ * provide an array of placements to try sequentially if the preferred
121
+ * `placement` does not fit.
122
+ *
123
+ * @default true
124
+ */
125
+ flip?: AutocompletePositionerProps$1['flip'];
126
+ /**
127
+ * Whether the floating element should shift to keep it in view.
128
+ *
129
+ * @default true
130
+ */
131
+ shift?: AutocompletePositionerProps$1['shift'];
132
+ /**
133
+ * Whether the floating element can overlap the reference element to keep it
134
+ * in view.
135
+ *
136
+ * @default false
137
+ */
138
+ overlap?: AutocompletePositionerProps$1['overlap'];
139
+ /**
140
+ * Whether to constrain the floating element's width so that it matches the
141
+ * reference element.
142
+ *
143
+ * @default false
144
+ */
145
+ sameWidth?: AutocompletePositionerProps$1['sameWidth'];
146
+ /**
147
+ * Whether to constrain the floating element's height so that it matches the
148
+ * reference element.
149
+ *
150
+ * @default false
151
+ */
152
+ sameHeight?: AutocompletePositionerProps$1['sameHeight'];
153
+ /**
154
+ * Whether to hide the floating element when the reference element or the
155
+ * floating element is fully clipped.
156
+ *
157
+ * @default false
158
+ */
159
+ hide?: AutocompletePositionerProps$1['hide'];
160
+ /**
161
+ * Describes the root boundary that the element will be checked for overflow relative to.
162
+ * Please see https://floating-ui.com/docs/detectoverflow#rootboundary for more information.
163
+ *
164
+ * @default 'viewport'
165
+ */
166
+ rootBoundary?: AutocompletePositionerProps$1['rootBoundary'];
167
+ /**
168
+ * The element that will be used to check for overflow. Please see
169
+ * https://floating-ui.com/docs/detectoverflow#elementcontext for more
170
+ * information.
171
+ *
172
+ * @default 'floating'
173
+ */
174
+ elementContext?: AutocompletePositionerProps$1['elementContext'];
175
+ /**
176
+ * Whether to check the alternate elementContext's boundary. Please see
177
+ * https://floating-ui.com/docs/detectoverflow#altboundary for more
178
+ * information.
179
+ *
180
+ * @default false
181
+ */
182
+ altBoundary?: AutocompletePositionerProps$1['altBoundary'];
183
+ }
184
+ /**
185
+ * A React component that renders an `prosekit-autocomplete-positioner` custom element.
186
+ *
187
+ * @public
188
+ */
189
+ declare const AutocompletePositioner: ForwardRefExoticComponent<AutocompletePositionerProps & RefAttributes<AutocompletePositionerElement>>;
190
+ //#endregion
191
+ //#region src/components/autocomplete/autocomplete-root.gen.d.ts
192
+ /**
193
+ * Props for the {@link AutocompleteRoot} React component.
194
+ *
195
+ * @public
196
+ */
197
+ interface AutocompleteRootProps extends HTMLAttributes<AutocompleteRootElement> {
198
+ /**
199
+ * The ProseKit editor instance.
200
+ *
201
+ * @default null
202
+ * @hidden
203
+ */
204
+ editor?: AutocompleteRootProps$1['editor'];
205
+ /**
206
+ * The regular expression to match the query text to autocomplete.
207
+ *
208
+ * @default null
209
+ */
210
+ regex?: AutocompleteRootProps$1['regex'];
211
+ /**
212
+ * The filter function to determine if an item should be shown in the
213
+ * listbox.
214
+ *
215
+ * @default defaultItemFilter
216
+ */
217
+ filter?: AutocompleteRootProps$1['filter'];
218
+ /** Fired when the open state changes. */
219
+ onOpenChange?: (event: AutocompleteRootEvents['openChange']) => void;
220
+ /** Fired when the query changes. */
221
+ onQueryChange?: (event: AutocompleteRootEvents['queryChange']) => void;
222
+ /**
223
+ * Emitted when the selected value changes. Only available when multiple is
224
+ * false.
225
+ */
226
+ onValueChange?: (event: AutocompleteRootEvents['valueChange']) => void;
227
+ /**
228
+ * Emitted when the selected values change. Only available when multiple is
229
+ * true.
230
+ */
231
+ onValuesChange?: (event: AutocompleteRootEvents['valuesChange']) => void;
232
+ }
27
233
  /**
28
- * Props for the {@link AutocompletePopover} component.
234
+ * A React component that renders an `prosekit-autocomplete-root` custom element.
235
+ *
236
+ * @public
29
237
  */
30
- interface AutocompletePopoverProps extends Partial<CreateProps<AutocompletePopoverProps$1, AutocompletePopoverEvents>> {}
31
- declare const AutocompletePopover: ForwardRefExoticComponent<AutocompletePopoverProps & RefAttributes<AutocompletePopoverElement> & HTMLAttributes<AutocompletePopoverElement>>;
238
+ declare const AutocompleteRoot: ForwardRefExoticComponent<AutocompleteRootProps & RefAttributes<AutocompleteRootElement>>;
32
239
  //#endregion
33
- export { AutocompleteEmpty, type AutocompleteEmptyProps, AutocompleteItem, type AutocompleteItemProps, AutocompleteList, type AutocompleteListProps, AutocompletePopover, type AutocompletePopoverProps };
240
+ export { AutocompleteEmpty, type AutocompleteEmptyProps, AutocompleteItem, type AutocompleteItemEvents, type AutocompleteItemProps, AutocompletePopup, type AutocompletePopupEvents, type AutocompletePopupProps, AutocompletePositioner, type AutocompletePositionerProps, AutocompleteRoot, type AutocompleteRootEvents, type AutocompleteRootProps, OpenChangeEvent, QueryChangeEvent, SelectEvent, ValueChangeEvent, ValuesChangeEvent };
34
241
  //# sourceMappingURL=prosekit-react-autocomplete.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-react-autocomplete.d.ts","names":[],"sources":["../src/components/autocomplete/autocomplete-empty.gen.ts","../src/components/autocomplete/autocomplete-item.gen.ts","../src/components/autocomplete/autocomplete-list.gen.ts","../src/components/autocomplete/autocomplete-popover.gen.ts"],"mappings":";;;;;;;AAmBA;UAAiB,sBAAA,SAA+B,OAAA,CAAQ,WAAA,CAAY,wBAAA,EAAO,uBAAA;AAAA,cAE9D,iBAAA,EAAmB,yBAAA,CAC9B,sBAAA,GACA,aAAA,CAAc,wBAAA,IACd,cAAA,CAAe,wBAAA;;;;;AALjB;UCAiB,qBAAA,SAA8B,OAAA,CAAQ,WAAA,CAAY,uBAAA,EAAO,sBAAA;AAAA,cAE7D,gBAAA,EAAkB,yBAAA,CAC7B,qBAAA,GACA,aAAA,CAAc,uBAAA,IACd,cAAA,CAAe,uBAAA;;;;;ADLjB;UEAiB,qBAAA,SAA8B,OAAA,CAAQ,WAAA,CAAY,uBAAA,EAAO,sBAAA;AAAA,cAE7D,gBAAA,EAAkB,yBAAA,CAC7B,qBAAA,GACA,aAAA,CAAc,uBAAA,IACd,cAAA,CAAe,uBAAA;;;;;AFLjB;UGAiB,wBAAA,SAAiC,OAAA,CAAQ,WAAA,CAAY,0BAAA,EAAO,yBAAA;AAAA,cAEhE,mBAAA,EAAqB,yBAAA,CAChC,wBAAA,GACA,aAAA,CAAc,0BAAA,IACd,cAAA,CAAe,0BAAA"}
1
+ {"version":3,"file":"prosekit-react-autocomplete.d.ts","names":[],"sources":["../src/components/autocomplete/autocomplete-empty.gen.ts","../src/components/autocomplete/autocomplete-item.gen.ts","../src/components/autocomplete/autocomplete-popup.gen.ts","../src/components/autocomplete/autocomplete-positioner.gen.ts","../src/components/autocomplete/autocomplete-root.gen.ts"],"mappings":";;;;;;;;AAyCA;UA7BiB,sBAAA,SAA+B,cAAA,CAAe,wBAAA;;;;;;cA6BlD,iBAAA,EAAmB,yBAAA,CAA0B,sBAAA,GAAyB,aAAA,CAAc,wBAAA;;;;;;;AAAjG;UC7BiB,qBAAA,SAA8B,IAAA,CAAK,cAAA,CAAe,uBAAA;;;;;;;;EAQjE,KAAA,GAAQ,uBAAA;EDqBgD;;;;;ECfxD,QAAA,GAAW,uBAAA;;EAEX,QAAA,IAAY,KAAA,EAAO,sBAAA;A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AA,GAAS,uBAAA;EJoBqB;;;;;EId9B,KAAA,GAAQ,uBAAA;;;;AHfV;;;EGsBE,MAAA,GAAS,uBAAA;EHtByC;EGwBlD,YAAA,IAAgB,KAAA,EAAO,sBAAA;EHVZ;EGYX,aAAA,IAAiB,KAAA,EAAO,sBAAA;EH1BqB;;;;EG+B7C,aAAA,IAAiB,KAAA,EAAO,sBAAA;EH/ByC;;;;EGoCjE,cAAA,IAAkB,KAAA,EAAO,sBAAA;AAAA;;;;;AHkC3B;cGsBa,gBAAA,EAAkB,yBAAA,CAA0B,qBAAA,GAAwB,aAAA,CAAc,uBAAA"}
@@ -1,17 +1,224 @@
1
- import { t as createComponent } from "./create-component.js";
2
- import { autocompleteEmptyEvents, autocompleteEmptyProps, autocompleteItemEvents, autocompleteItemProps, autocompleteListEvents, autocompleteListProps, autocompletePopoverEvents, autocompletePopoverProps } from "@prosekit/web/autocomplete";
1
+ import { n as useEditorContext } from "./editor-context.js";
2
+ import { createElement, forwardRef, useCallback, useLayoutEffect, useRef } from "react";
3
+ import { OpenChangeEvent, QueryChangeEvent, SelectEvent, ValueChangeEvent, ValuesChangeEvent, registerAutocompleteEmptyElement, registerAutocompleteItemElement, registerAutocompletePopupElement, registerAutocompletePositionerElement, registerAutocompleteRootElement } from "@prosekit/web/autocomplete";
3
4
  //#region src/components/autocomplete/autocomplete-empty.gen.ts
4
- const AutocompleteEmpty = createComponent("prosekit-autocomplete-empty", "AutocompleteEmpty", Object.keys(autocompleteEmptyProps), Object.keys(autocompleteEmptyEvents));
5
+ /**
6
+ * This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
7
+ */
8
+ function AutocompleteEmptyComponent(props, forwardedRef) {
9
+ registerAutocompleteEmptyElement();
10
+ const elementRef = useRef(null);
11
+ const { ...restProps } = props;
12
+ const mergedRef = useCallback((element) => {
13
+ elementRef.current = element;
14
+ if (typeof forwardedRef === "function") forwardedRef(element);
15
+ else if (forwardedRef) forwardedRef.current = element;
16
+ }, [forwardedRef]);
17
+ return createElement("prosekit-autocomplete-empty", {
18
+ ...restProps,
19
+ ref: mergedRef,
20
+ suppressHydrationWarning: true
21
+ });
22
+ }
23
+ /**
24
+ * A React component that renders an `prosekit-autocomplete-empty` custom element.
25
+ *
26
+ * @public
27
+ */
28
+ const AutocompleteEmpty = /* @__PURE__ */ forwardRef(AutocompleteEmptyComponent);
5
29
  //#endregion
6
30
  //#region src/components/autocomplete/autocomplete-item.gen.ts
7
- const AutocompleteItem = createComponent("prosekit-autocomplete-item", "AutocompleteItem", Object.keys(autocompleteItemProps), Object.keys(autocompleteItemEvents));
31
+ /**
32
+ * This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
33
+ */
34
+ function AutocompleteItemComponent(props, forwardedRef) {
35
+ registerAutocompleteItemElement();
36
+ const elementRef = useRef(null);
37
+ const handlersRef = useRef([]);
38
+ const { disabled: p0, value: p1, onSelect: e0, ...restProps } = props;
39
+ useLayoutEffect(() => {
40
+ const element = elementRef.current;
41
+ if (!element) return;
42
+ Object.assign(element, {
43
+ disabled: p0,
44
+ value: p1
45
+ });
46
+ handlersRef.current = [e0];
47
+ });
48
+ useLayoutEffect(() => {
49
+ const element = elementRef.current;
50
+ if (!element) return;
51
+ const ac = new AbortController();
52
+ for (const [index, eventName] of ["select"].entries()) element.addEventListener(eventName, (event) => {
53
+ handlersRef.current[index]?.(event);
54
+ }, { signal: ac.signal });
55
+ return () => ac.abort();
56
+ }, []);
57
+ const mergedRef = useCallback((element) => {
58
+ elementRef.current = element;
59
+ if (typeof forwardedRef === "function") forwardedRef(element);
60
+ else if (forwardedRef) forwardedRef.current = element;
61
+ }, [forwardedRef]);
62
+ return createElement("prosekit-autocomplete-item", {
63
+ ...restProps,
64
+ ref: mergedRef,
65
+ suppressHydrationWarning: true
66
+ });
67
+ }
68
+ /**
69
+ * A React component that renders an `prosekit-autocomplete-item` custom element.
70
+ *
71
+ * @public
72
+ */
73
+ const AutocompleteItem = /* @__PURE__ */ forwardRef(AutocompleteItemComponent);
8
74
  //#endregion
9
- //#region src/components/autocomplete/autocomplete-list.gen.ts
10
- const AutocompleteList = createComponent("prosekit-autocomplete-list", "AutocompleteList", Object.keys(autocompleteListProps), Object.keys(autocompleteListEvents));
75
+ //#region src/components/autocomplete/autocomplete-popup.gen.ts
76
+ /**
77
+ * This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
78
+ */
79
+ function AutocompletePopupComponent(props, forwardedRef) {
80
+ registerAutocompletePopupElement();
81
+ const elementRef = useRef(null);
82
+ const handlersRef = useRef([]);
83
+ const { onValueChange: e0, onValuesChange: e1, ...restProps } = props;
84
+ useLayoutEffect(() => {
85
+ if (!elementRef.current) return;
86
+ handlersRef.current = [e0, e1];
87
+ });
88
+ useLayoutEffect(() => {
89
+ const element = elementRef.current;
90
+ if (!element) return;
91
+ const ac = new AbortController();
92
+ for (const [index, eventName] of ["valueChange", "valuesChange"].entries()) element.addEventListener(eventName, (event) => {
93
+ handlersRef.current[index]?.(event);
94
+ }, { signal: ac.signal });
95
+ return () => ac.abort();
96
+ }, []);
97
+ const mergedRef = useCallback((element) => {
98
+ elementRef.current = element;
99
+ if (typeof forwardedRef === "function") forwardedRef(element);
100
+ else if (forwardedRef) forwardedRef.current = element;
101
+ }, [forwardedRef]);
102
+ return createElement("prosekit-autocomplete-popup", {
103
+ ...restProps,
104
+ ref: mergedRef,
105
+ suppressHydrationWarning: true
106
+ });
107
+ }
108
+ /**
109
+ * A React component that renders an `prosekit-autocomplete-popup` custom element.
110
+ *
111
+ * @public
112
+ */
113
+ const AutocompletePopup = /* @__PURE__ */ forwardRef(AutocompletePopupComponent);
11
114
  //#endregion
12
- //#region src/components/autocomplete/autocomplete-popover.gen.ts
13
- const AutocompletePopover = createComponent("prosekit-autocomplete-popover", "AutocompletePopover", Object.keys(autocompletePopoverProps), Object.keys(autocompletePopoverEvents));
115
+ //#region src/components/autocomplete/autocomplete-positioner.gen.ts
116
+ /**
117
+ * This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
118
+ */
119
+ function AutocompletePositionerComponent(props, forwardedRef) {
120
+ registerAutocompletePositionerElement();
121
+ const elementRef = useRef(null);
122
+ const { altBoundary: p0, autoUpdate: p1, boundary: p2, elementContext: p3, fitViewport: p4, flip: p5, hide: p6, hoist: p7, inline: p8, offset: p9, overflowPadding: p10, overlap: p11, placement: p12, rootBoundary: p13, sameHeight: p14, sameWidth: p15, shift: p16, strategy: p17, ...restProps } = props;
123
+ useLayoutEffect(() => {
124
+ const element = elementRef.current;
125
+ if (!element) return;
126
+ Object.assign(element, {
127
+ altBoundary: p0,
128
+ autoUpdate: p1,
129
+ boundary: p2,
130
+ elementContext: p3,
131
+ fitViewport: p4,
132
+ flip: p5,
133
+ hide: p6,
134
+ hoist: p7,
135
+ inline: p8,
136
+ offset: p9,
137
+ overflowPadding: p10,
138
+ overlap: p11,
139
+ placement: p12,
140
+ rootBoundary: p13,
141
+ sameHeight: p14,
142
+ sameWidth: p15,
143
+ shift: p16,
144
+ strategy: p17
145
+ });
146
+ });
147
+ const mergedRef = useCallback((element) => {
148
+ elementRef.current = element;
149
+ if (typeof forwardedRef === "function") forwardedRef(element);
150
+ else if (forwardedRef) forwardedRef.current = element;
151
+ }, [forwardedRef]);
152
+ return createElement("prosekit-autocomplete-positioner", {
153
+ ...restProps,
154
+ ref: mergedRef,
155
+ suppressHydrationWarning: true
156
+ });
157
+ }
158
+ /**
159
+ * A React component that renders an `prosekit-autocomplete-positioner` custom element.
160
+ *
161
+ * @public
162
+ */
163
+ const AutocompletePositioner = /* @__PURE__ */ forwardRef(AutocompletePositionerComponent);
14
164
  //#endregion
15
- export { AutocompleteEmpty, AutocompleteItem, AutocompleteList, AutocompletePopover };
165
+ //#region src/components/autocomplete/autocomplete-root.gen.ts
166
+ /**
167
+ * This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
168
+ */
169
+ function AutocompleteRootComponent(props, forwardedRef) {
170
+ registerAutocompleteRootElement();
171
+ const elementRef = useRef(null);
172
+ const handlersRef = useRef([]);
173
+ const p0Fallback = useEditorContext();
174
+ const { editor: p0, filter: p1, regex: p2, onOpenChange: e0, onQueryChange: e1, onValueChange: e2, onValuesChange: e3, ...restProps } = props;
175
+ useLayoutEffect(() => {
176
+ const element = elementRef.current;
177
+ if (!element) return;
178
+ Object.assign(element, {
179
+ editor: p0 ?? p0Fallback,
180
+ filter: p1,
181
+ regex: p2
182
+ });
183
+ handlersRef.current = [
184
+ e0,
185
+ e1,
186
+ e2,
187
+ e3
188
+ ];
189
+ });
190
+ useLayoutEffect(() => {
191
+ const element = elementRef.current;
192
+ if (!element) return;
193
+ const ac = new AbortController();
194
+ for (const [index, eventName] of [
195
+ "openChange",
196
+ "queryChange",
197
+ "valueChange",
198
+ "valuesChange"
199
+ ].entries()) element.addEventListener(eventName, (event) => {
200
+ handlersRef.current[index]?.(event);
201
+ }, { signal: ac.signal });
202
+ return () => ac.abort();
203
+ }, []);
204
+ const mergedRef = useCallback((element) => {
205
+ elementRef.current = element;
206
+ if (typeof forwardedRef === "function") forwardedRef(element);
207
+ else if (forwardedRef) forwardedRef.current = element;
208
+ }, [forwardedRef]);
209
+ return createElement("prosekit-autocomplete-root", {
210
+ ...restProps,
211
+ ref: mergedRef,
212
+ suppressHydrationWarning: true
213
+ });
214
+ }
215
+ /**
216
+ * A React component that renders an `prosekit-autocomplete-root` custom element.
217
+ *
218
+ * @public
219
+ */
220
+ const AutocompleteRoot = /* @__PURE__ */ forwardRef(AutocompleteRootComponent);
221
+ //#endregion
222
+ export { AutocompleteEmpty, AutocompleteItem, AutocompletePopup, AutocompletePositioner, AutocompleteRoot, OpenChangeEvent, QueryChangeEvent, SelectEvent, ValueChangeEvent, ValuesChangeEvent };
16
223
 
17
224
  //# sourceMappingURL=prosekit-react-autocomplete.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-react-autocomplete.js","names":[],"sources":["../src/components/autocomplete/autocomplete-empty.gen.ts","../src/components/autocomplete/autocomplete-item.gen.ts","../src/components/autocomplete/autocomplete-list.gen.ts","../src/components/autocomplete/autocomplete-popover.gen.ts"],"sourcesContent":["import {\n type AutocompleteEmptyElement,\n type AutocompleteEmptyProps as Props,\n type AutocompleteEmptyEvents as Events,\n autocompleteEmptyProps,\n autocompleteEmptyEvents,\n} from '@prosekit/web/autocomplete'\nimport type {\n ForwardRefExoticComponent,\n HTMLAttributes,\n RefAttributes,\n} from 'react'\n\nimport { createComponent } from '../create-component.ts'\nimport type { CreateProps } from '../create-props.ts'\n\n/**\n * Props for the {@link AutocompleteEmpty} component.\n */\nexport interface AutocompleteEmptyProps extends Partial<CreateProps<Props, Events>> {}\n\nexport const AutocompleteEmpty: ForwardRefExoticComponent<\n AutocompleteEmptyProps &\n RefAttributes<AutocompleteEmptyElement> &\n HTMLAttributes<AutocompleteEmptyElement>\n> = createComponent<\n AutocompleteEmptyProps,\n AutocompleteEmptyElement\n>(\n 'prosekit-autocomplete-empty',\n 'AutocompleteEmpty',\n Object.keys(autocompleteEmptyProps),\n Object.keys(autocompleteEmptyEvents),\n)\n","import {\n type AutocompleteItemElement,\n type AutocompleteItemProps as Props,\n type AutocompleteItemEvents as Events,\n autocompleteItemProps,\n autocompleteItemEvents,\n} from '@prosekit/web/autocomplete'\nimport type {\n ForwardRefExoticComponent,\n HTMLAttributes,\n RefAttributes,\n} from 'react'\n\nimport { createComponent } from '../create-component.ts'\nimport type { CreateProps } from '../create-props.ts'\n\n/**\n * Props for the {@link AutocompleteItem} component.\n */\nexport interface AutocompleteItemProps extends Partial<CreateProps<Props, Events>> {}\n\nexport const AutocompleteItem: ForwardRefExoticComponent<\n AutocompleteItemProps &\n RefAttributes<AutocompleteItemElement> &\n HTMLAttributes<AutocompleteItemElement>\n> = createComponent<\n AutocompleteItemProps,\n AutocompleteItemElement\n>(\n 'prosekit-autocomplete-item',\n 'AutocompleteItem',\n Object.keys(autocompleteItemProps),\n Object.keys(autocompleteItemEvents),\n)\n","import {\n type AutocompleteListElement,\n type AutocompleteListProps as Props,\n type AutocompleteListEvents as Events,\n autocompleteListProps,\n autocompleteListEvents,\n} from '@prosekit/web/autocomplete'\nimport type {\n ForwardRefExoticComponent,\n HTMLAttributes,\n RefAttributes,\n} from 'react'\n\nimport { createComponent } from '../create-component.ts'\nimport type { CreateProps } from '../create-props.ts'\n\n/**\n * Props for the {@link AutocompleteList} component.\n */\nexport interface AutocompleteListProps extends Partial<CreateProps<Props, Events>> {}\n\nexport const AutocompleteList: ForwardRefExoticComponent<\n AutocompleteListProps &\n RefAttributes<AutocompleteListElement> &\n HTMLAttributes<AutocompleteListElement>\n> = createComponent<\n AutocompleteListProps,\n AutocompleteListElement\n>(\n 'prosekit-autocomplete-list',\n 'AutocompleteList',\n Object.keys(autocompleteListProps),\n Object.keys(autocompleteListEvents),\n)\n","import {\n type AutocompletePopoverElement,\n type AutocompletePopoverProps as Props,\n type AutocompletePopoverEvents as Events,\n autocompletePopoverProps,\n autocompletePopoverEvents,\n} from '@prosekit/web/autocomplete'\nimport type {\n ForwardRefExoticComponent,\n HTMLAttributes,\n RefAttributes,\n} from 'react'\n\nimport { createComponent } from '../create-component.ts'\nimport type { CreateProps } from '../create-props.ts'\n\n/**\n * Props for the {@link AutocompletePopover} component.\n */\nexport interface AutocompletePopoverProps extends Partial<CreateProps<Props, Events>> {}\n\nexport const AutocompletePopover: ForwardRefExoticComponent<\n AutocompletePopoverProps &\n RefAttributes<AutocompletePopoverElement> &\n HTMLAttributes<AutocompletePopoverElement>\n> = createComponent<\n AutocompletePopoverProps,\n AutocompletePopoverElement\n>(\n 'prosekit-autocomplete-popover',\n 'AutocompletePopover',\n Object.keys(autocompletePopoverProps),\n Object.keys(autocompletePopoverEvents),\n)\n"],"mappings":";;;AAqBA,MAAa,oBAIT,gBAIF,+BACA,qBACA,OAAO,KAAK,uBAAuB,EACnC,OAAO,KAAK,wBAAwB,CACrC;;;ACZD,MAAa,mBAIT,gBAIF,8BACA,oBACA,OAAO,KAAK,sBAAsB,EAClC,OAAO,KAAK,uBAAuB,CACpC;;;ACZD,MAAa,mBAIT,gBAIF,8BACA,oBACA,OAAO,KAAK,sBAAsB,EAClC,OAAO,KAAK,uBAAuB,CACpC;;;ACZD,MAAa,sBAIT,gBAIF,iCACA,uBACA,OAAO,KAAK,yBAAyB,EACrC,OAAO,KAAK,0BAA0B,CACvC"}
1
+ {"version":3,"file":"prosekit-react-autocomplete.js","names":[],"sources":["../src/components/autocomplete/autocomplete-empty.gen.ts","../src/components/autocomplete/autocomplete-item.gen.ts","../src/components/autocomplete/autocomplete-popup.gen.ts","../src/components/autocomplete/autocomplete-positioner.gen.ts","../src/components/autocomplete/autocomplete-root.gen.ts"],"sourcesContent":["/**\n * This file is auto-generated by the \"@aria-ui/cli\" tool. Do not edit this file directly.\n */\n\nimport { registerAutocompleteEmptyElement, type AutocompleteEmptyElement } from '@prosekit/web/autocomplete';\nimport { createElement, forwardRef, useCallback, useRef, type ForwardedRef, type ForwardRefExoticComponent, type HTMLAttributes, type RefAttributes } from 'react';\n\n/**\n * Props for the {@link AutocompleteEmpty} React component.\n *\n * @public\n */\nexport interface AutocompleteEmptyProps extends HTMLAttributes<AutocompleteEmptyElement> {}\n\nfunction AutocompleteEmptyComponent(props: AutocompleteEmptyProps, forwardedRef: ForwardedRef<AutocompleteEmptyElement>) {\n registerAutocompleteEmptyElement();\n\n const elementRef = useRef<AutocompleteEmptyElement>(null);\n\n const { ...restProps } = props;\n\n const mergedRef = useCallback(\n (element: AutocompleteEmptyElement | null) => {\n elementRef.current = element;\n if (typeof forwardedRef === 'function') {\n forwardedRef(element);\n } else if (forwardedRef) {\n forwardedRef.current = element;\n }\n },\n [forwardedRef],\n );\n\n return createElement('prosekit-autocomplete-empty', { ...restProps, ref: mergedRef, suppressHydrationWarning: true });\n}\n\n/**\n * A React component that renders an `prosekit-autocomplete-empty` custom element.\n *\n * @public\n */\nexport const AutocompleteEmpty: ForwardRefExoticComponent<AutocompleteEmptyProps & RefAttributes<AutocompleteEmptyElement>> = /* @__PURE__ */ forwardRef(AutocompleteEmptyComponent);\n","/**\n * This file is auto-generated by the \"@aria-ui/cli\" tool. Do not edit this file directly.\n */\n\nimport { registerAutocompleteItemElement, type AutocompleteItemElement, type AutocompleteItemProps as AutocompleteItemElementProps, type AutocompleteItemEvents } from '@prosekit/web/autocomplete';\nimport { createElement, forwardRef, useCallback, useRef, type ForwardedRef, type ForwardRefExoticComponent, type HTMLAttributes, type RefAttributes, useLayoutEffect } from 'react';\n\n/**\n * Props for the {@link AutocompleteItem} React component.\n *\n * @public\n */\nexport interface AutocompleteItemProps extends Omit<HTMLAttributes<AutocompleteItemElement>, 'onSelect'> {\n /**\n * The value of the item, which will be matched against the query.\n *\n * If not provided, the value is the item's text content.\n *\n * @default \"\"\n */\n value?: AutocompleteItemElementProps['value'];\n /**\n * Whether this option is disabled.\n *\n * @default false\n */\n disabled?: AutocompleteItemElementProps['disabled'];\n /** Emitted when the the item is selected. */\n onSelect?: (event: AutocompleteItemEvents['select']) => void;\n}\n\nfunction AutocompleteItemComponent(props: AutocompleteItemProps, forwardedRef: ForwardedRef<AutocompleteItemElement>) {\n registerAutocompleteItemElement();\n\n const elementRef = useRef<AutocompleteItemElement>(null);\n const handlersRef = useRef<Array<((event: Event) => void) | undefined>>([]);\n\n const { disabled: p0, value: p1, onSelect: e0, ...restProps } = props;\n\n useLayoutEffect(() => {\n const element = elementRef.current as Record<string, unknown> | null;\n if (!element) return;\n Object.assign(element, { disabled: p0, value: p1 });\n handlersRef.current = [e0] as Array<((event: Event) => void) | undefined>;\n });\n\n useLayoutEffect(() => {\n const element = elementRef.current;\n if (!element) return;\n const ac = new AbortController();\n for (const [index, eventName] of ['select'].entries()) {\n element.addEventListener(\n eventName,\n (event: Event) => {\n handlersRef.current[index]?.(event);\n },\n { signal: ac.signal },\n );\n }\n return () => ac.abort();\n }, []);\n\n const mergedRef = useCallback(\n (element: AutocompleteItemElement | null) => {\n elementRef.current = element;\n if (typeof forwardedRef === 'function') {\n forwardedRef(element);\n } else if (forwardedRef) {\n forwardedRef.current = element;\n }\n },\n [forwardedRef],\n );\n\n return createElement('prosekit-autocomplete-item', { ...restProps, ref: mergedRef, suppressHydrationWarning: true });\n}\n\n/**\n * A React component that renders an `prosekit-autocomplete-item` custom element.\n *\n * @public\n */\nexport const AutocompleteItem: ForwardRefExoticComponent<AutocompleteItemProps & RefAttributes<AutocompleteItemElement>> = /* @__PURE__ */ forwardRef(AutocompleteItemComponent);\n\nexport type { AutocompleteItemEvents };\n","/**\n * This file is auto-generated by the \"@aria-ui/cli\" tool. Do not edit this file directly.\n */\n\nimport { registerAutocompletePopupElement, type AutocompletePopupElement, type AutocompletePopupEvents } from '@prosekit/web/autocomplete';\nimport { createElement, forwardRef, useCallback, useRef, type ForwardedRef, type ForwardRefExoticComponent, type HTMLAttributes, type RefAttributes, useLayoutEffect } from 'react';\n\n/**\n * Props for the {@link AutocompletePopup} React component.\n *\n * @public\n */\nexport interface AutocompletePopupProps extends HTMLAttributes<AutocompletePopupElement> {\n /**\n * Emitted when the selected value changes. Only available when multiple is\n * false.\n */\n onValueChange?: (event: AutocompletePopupEvents['valueChange']) => void;\n /**\n * Emitted when the selected values change. Only available when multiple is\n * true.\n */\n onValuesChange?: (event: AutocompletePopupEvents['valuesChange']) => void;\n}\n\nfunction AutocompletePopupComponent(props: AutocompletePopupProps, forwardedRef: ForwardedRef<AutocompletePopupElement>) {\n registerAutocompletePopupElement();\n\n const elementRef = useRef<AutocompletePopupElement>(null);\n const handlersRef = useRef<Array<((event: Event) => void) | undefined>>([]);\n\n const { onValueChange: e0, onValuesChange: e1, ...restProps } = props;\n\n useLayoutEffect(() => {\n const element = elementRef.current as Record<string, unknown> | null;\n if (!element) return;\n handlersRef.current = [e0, e1] as Array<((event: Event) => void) | undefined>;\n });\n\n useLayoutEffect(() => {\n const element = elementRef.current;\n if (!element) return;\n const ac = new AbortController();\n for (const [index, eventName] of ['valueChange', 'valuesChange'].entries()) {\n element.addEventListener(\n eventName,\n (event: Event) => {\n handlersRef.current[index]?.(event);\n },\n { signal: ac.signal },\n );\n }\n return () => ac.abort();\n }, []);\n\n const mergedRef = useCallback(\n (element: AutocompletePopupElement | null) => {\n elementRef.current = element;\n if (typeof forwardedRef === 'function') {\n forwardedRef(element);\n } else if (forwardedRef) {\n forwardedRef.current = element;\n }\n },\n [forwardedRef],\n );\n\n return createElement('prosekit-autocomplete-popup', { ...restProps, ref: mergedRef, suppressHydrationWarning: true });\n}\n\n/**\n * A React component that renders an `prosekit-autocomplete-popup` custom element.\n *\n * @public\n */\nexport const AutocompletePopup: ForwardRefExoticComponent<AutocompletePopupProps & RefAttributes<AutocompletePopupElement>> = /* @__PURE__ */ forwardRef(AutocompletePopupComponent);\n\nexport type { AutocompletePopupEvents };\n","/**\n * This file is auto-generated by the \"@aria-ui/cli\" tool. Do not edit this file directly.\n */\n\nimport { registerAutocompletePositionerElement, type AutocompletePositionerElement, type AutocompletePositionerProps as AutocompletePositionerElementProps } from '@prosekit/web/autocomplete';\nimport { createElement, forwardRef, useCallback, useRef, type ForwardedRef, type ForwardRefExoticComponent, type HTMLAttributes, type RefAttributes, useLayoutEffect } from 'react';\n\n/**\n * Props for the {@link AutocompletePositioner} React component.\n *\n * @public\n */\nexport interface AutocompletePositionerProps extends HTMLAttributes<AutocompletePositionerElement> {\n /**\n * The placement of the popover, relative to the text cursor.\n *\n * @default \"bottom-start\"\n */\n placement?: AutocompletePositionerElementProps['placement'];\n /**\n * The distance between the popover and the hovered block.\n *\n * @default 4\n */\n offset?: AutocompletePositionerElementProps['offset'];\n /** @default true */\n inline?: AutocompletePositionerElementProps['inline'];\n /** @default true */\n hoist?: AutocompletePositionerElementProps['hoist'];\n /** @default true */\n fitViewport?: AutocompletePositionerElementProps['fitViewport'];\n /** @default \"The body element\" */\n boundary?: AutocompletePositionerElementProps['boundary'];\n /** @default 8 */\n overflowPadding?: AutocompletePositionerElementProps['overflowPadding'];\n /**\n * The strategy to use for positioning\n *\n * @default \"absolute\"\n */\n strategy?: AutocompletePositionerElementProps['strategy'];\n /**\n * Options to activate auto-update listeners\n *\n * @see https://floating-ui.com/docs/autoUpdate\n *\n * @default true\n */\n autoUpdate?: AutocompletePositionerElementProps['autoUpdate'];\n /**\n * Whether to flip the `placement` in order to keep it in view when the\n * preferred placement(s) will overflow the clipping boundary. You can also\n * provide an array of placements to try sequentially if the preferred\n * `placement` does not fit.\n *\n * @default true\n */\n flip?: AutocompletePositionerElementProps['flip'];\n /**\n * Whether the floating element should shift to keep it in view.\n *\n * @default true\n */\n shift?: AutocompletePositionerElementProps['shift'];\n /**\n * Whether the floating element can overlap the reference element to keep it\n * in view.\n *\n * @default false\n */\n overlap?: AutocompletePositionerElementProps['overlap'];\n /**\n * Whether to constrain the floating element's width so that it matches the\n * reference element.\n *\n * @default false\n */\n sameWidth?: AutocompletePositionerElementProps['sameWidth'];\n /**\n * Whether to constrain the floating element's height so that it matches the\n * reference element.\n *\n * @default false\n */\n sameHeight?: AutocompletePositionerElementProps['sameHeight'];\n /**\n * Whether to hide the floating element when the reference element or the\n * floating element is fully clipped.\n *\n * @default false\n */\n hide?: AutocompletePositionerElementProps['hide'];\n /**\n * Describes the root boundary that the element will be checked for overflow relative to.\n * Please see https://floating-ui.com/docs/detectoverflow#rootboundary for more information.\n *\n * @default 'viewport'\n */\n rootBoundary?: AutocompletePositionerElementProps['rootBoundary'];\n /**\n * The element that will be used to check for overflow. Please see\n * https://floating-ui.com/docs/detectoverflow#elementcontext for more\n * information.\n *\n * @default 'floating'\n */\n elementContext?: AutocompletePositionerElementProps['elementContext'];\n /**\n * Whether to check the alternate elementContext's boundary. Please see\n * https://floating-ui.com/docs/detectoverflow#altboundary for more\n * information.\n *\n * @default false\n */\n altBoundary?: AutocompletePositionerElementProps['altBoundary'];\n}\n\nfunction AutocompletePositionerComponent(props: AutocompletePositionerProps, forwardedRef: ForwardedRef<AutocompletePositionerElement>) {\n registerAutocompletePositionerElement();\n\n const elementRef = useRef<AutocompletePositionerElement>(null);\n\n const { altBoundary: p0, autoUpdate: p1, boundary: p2, elementContext: p3, fitViewport: p4, flip: p5, hide: p6, hoist: p7, inline: p8, offset: p9, overflowPadding: p10, overlap: p11, placement: p12, rootBoundary: p13, sameHeight: p14, sameWidth: p15, shift: p16, strategy: p17, ...restProps } = props;\n\n useLayoutEffect(() => {\n const element = elementRef.current as Record<string, unknown> | null;\n if (!element) return;\n Object.assign(element, { altBoundary: p0, autoUpdate: p1, boundary: p2, elementContext: p3, fitViewport: p4, flip: p5, hide: p6, hoist: p7, inline: p8, offset: p9, overflowPadding: p10, overlap: p11, placement: p12, rootBoundary: p13, sameHeight: p14, sameWidth: p15, shift: p16, strategy: p17 });\n });\n\n const mergedRef = useCallback(\n (element: AutocompletePositionerElement | null) => {\n elementRef.current = element;\n if (typeof forwardedRef === 'function') {\n forwardedRef(element);\n } else if (forwardedRef) {\n forwardedRef.current = element;\n }\n },\n [forwardedRef],\n );\n\n return createElement('prosekit-autocomplete-positioner', { ...restProps, ref: mergedRef, suppressHydrationWarning: true });\n}\n\n/**\n * A React component that renders an `prosekit-autocomplete-positioner` custom element.\n *\n * @public\n */\nexport const AutocompletePositioner: ForwardRefExoticComponent<AutocompletePositionerProps & RefAttributes<AutocompletePositionerElement>> = /* @__PURE__ */ forwardRef(AutocompletePositionerComponent);\n","/**\n * This file is auto-generated by the \"@aria-ui/cli\" tool. Do not edit this file directly.\n */\n\nimport { registerAutocompleteRootElement, type AutocompleteRootElement, type AutocompleteRootProps as AutocompleteRootElementProps, type AutocompleteRootEvents } from '@prosekit/web/autocomplete';\nimport { createElement, forwardRef, useCallback, useRef, type ForwardedRef, type ForwardRefExoticComponent, type HTMLAttributes, type RefAttributes, useLayoutEffect } from 'react';\n\nimport { useEditorContext } from '../../contexts/editor-context.ts';\n\n/**\n * Props for the {@link AutocompleteRoot} React component.\n *\n * @public\n */\nexport interface AutocompleteRootProps extends HTMLAttributes<AutocompleteRootElement> {\n /**\n * The ProseKit editor instance.\n *\n * @default null\n * @hidden\n */\n editor?: AutocompleteRootElementProps['editor'];\n /**\n * The regular expression to match the query text to autocomplete.\n *\n * @default null\n */\n regex?: AutocompleteRootElementProps['regex'];\n /**\n * The filter function to determine if an item should be shown in the\n * listbox.\n *\n * @default defaultItemFilter\n */\n filter?: AutocompleteRootElementProps['filter'];\n /** Fired when the open state changes. */\n onOpenChange?: (event: AutocompleteRootEvents['openChange']) => void;\n /** Fired when the query changes. */\n onQueryChange?: (event: AutocompleteRootEvents['queryChange']) => void;\n /**\n * Emitted when the selected value changes. Only available when multiple is\n * false.\n */\n onValueChange?: (event: AutocompleteRootEvents['valueChange']) => void;\n /**\n * Emitted when the selected values change. Only available when multiple is\n * true.\n */\n onValuesChange?: (event: AutocompleteRootEvents['valuesChange']) => void;\n}\n\nfunction AutocompleteRootComponent(props: AutocompleteRootProps, forwardedRef: ForwardedRef<AutocompleteRootElement>) {\n registerAutocompleteRootElement();\n\n const elementRef = useRef<AutocompleteRootElement>(null);\n const handlersRef = useRef<Array<((event: Event) => void) | undefined>>([]);\n\n const p0Fallback = useEditorContext();\n\n const { editor: p0, filter: p1, regex: p2, onOpenChange: e0, onQueryChange: e1, onValueChange: e2, onValuesChange: e3, ...restProps } = props;\n\n useLayoutEffect(() => {\n const element = elementRef.current as Record<string, unknown> | null;\n if (!element) return;\n Object.assign(element, { editor: p0 ?? p0Fallback, filter: p1, regex: p2 });\n handlersRef.current = [e0, e1, e2, e3] as Array<((event: Event) => void) | undefined>;\n });\n\n useLayoutEffect(() => {\n const element = elementRef.current;\n if (!element) return;\n const ac = new AbortController();\n for (const [index, eventName] of ['openChange', 'queryChange', 'valueChange', 'valuesChange'].entries()) {\n element.addEventListener(\n eventName,\n (event: Event) => {\n handlersRef.current[index]?.(event);\n },\n { signal: ac.signal },\n );\n }\n return () => ac.abort();\n }, []);\n\n const mergedRef = useCallback(\n (element: AutocompleteRootElement | null) => {\n elementRef.current = element;\n if (typeof forwardedRef === 'function') {\n forwardedRef(element);\n } else if (forwardedRef) {\n forwardedRef.current = element;\n }\n },\n [forwardedRef],\n );\n\n return createElement('prosekit-autocomplete-root', { ...restProps, ref: mergedRef, suppressHydrationWarning: true });\n}\n\n/**\n * A React component that renders an `prosekit-autocomplete-root` custom element.\n *\n * @public\n */\nexport const AutocompleteRoot: ForwardRefExoticComponent<AutocompleteRootProps & RefAttributes<AutocompleteRootElement>> = /* @__PURE__ */ forwardRef(AutocompleteRootComponent);\n\nexport type { AutocompleteRootEvents };\n"],"mappings":";;;;;;;AAcA,SAAS,2BAA2B,OAA+B,cAAsD;AACvH,mCAAkC;CAElC,MAAM,aAAa,OAAiC,KAAK;CAEzD,MAAM,EAAE,GAAG,cAAc;CAEzB,MAAM,YAAY,aACf,YAA6C;AAC5C,aAAW,UAAU;AACrB,MAAI,OAAO,iBAAiB,WAC1B,cAAa,QAAQ;WACZ,aACT,cAAa,UAAU;IAG3B,CAAC,aAAa,CACf;AAED,QAAO,cAAc,+BAA+B;EAAE,GAAG;EAAW,KAAK;EAAW,0BAA0B;EAAM,CAAC;;;;;;;AAQvH,MAAa,oBAAiI,2BAAW,2BAA2B;;;;;;ACVpL,SAAS,0BAA0B,OAA8B,cAAqD;AACpH,kCAAiC;CAEjC,MAAM,aAAa,OAAgC,KAAK;CACxD,MAAM,cAAc,OAAoD,EAAE,CAAC;CAE3E,MAAM,EAAE,UAAU,IAAI,OAAO,IAAI,UAAU,IAAI,GAAG,cAAc;AAEhE,uBAAsB;EACpB,MAAM,UAAU,WAAW;AAC3B,MAAI,CAAC,QAAS;AACd,SAAO,OAAO,SAAS;GAAE,UAAU;GAAI,OAAO;GAAI,CAAC;AACnD,cAAY,UAAU,CAAC,GAAG;GAC1B;AAEF,uBAAsB;EACpB,MAAM,UAAU,WAAW;AAC3B,MAAI,CAAC,QAAS;EACd,MAAM,KAAK,IAAI,iBAAiB;AAChC,OAAK,MAAM,CAAC,OAAO,cAAc,CAAC,SAAS,CAAC,SAAS,CACnD,SAAQ,iBACN,YACC,UAAiB;AAChB,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