@prosekit/preact 0.7.0-beta.0 → 0.7.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/dist/prosekit-preact-autocomplete.d.ts +226 -18
  2. package/dist/prosekit-preact-autocomplete.d.ts.map +1 -1
  3. package/dist/prosekit-preact-autocomplete.js +218 -9
  4. package/dist/prosekit-preact-autocomplete.js.map +1 -1
  5. package/dist/prosekit-preact-block-handle.d.ts +210 -14
  6. package/dist/prosekit-preact-block-handle.d.ts.map +1 -1
  7. package/dist/prosekit-preact-block-handle.js +184 -7
  8. package/dist/prosekit-preact-block-handle.js.map +1 -1
  9. package/dist/prosekit-preact-drop-indicator.d.ts +27 -6
  10. package/dist/prosekit-preact-drop-indicator.d.ts.map +1 -1
  11. package/dist/prosekit-preact-drop-indicator.js +38 -3
  12. package/dist/prosekit-preact-drop-indicator.js.map +1 -1
  13. package/dist/prosekit-preact-inline-popover.d.ts +204 -8
  14. package/dist/prosekit-preact-inline-popover.d.ts.map +1 -1
  15. package/dist/prosekit-preact-inline-popover.js +130 -5
  16. package/dist/prosekit-preact-inline-popover.js.map +1 -1
  17. package/dist/prosekit-preact-menu.d.ts +288 -0
  18. package/dist/prosekit-preact-menu.d.ts.map +1 -0
  19. package/dist/prosekit-preact-menu.js +274 -0
  20. package/dist/prosekit-preact-menu.js.map +1 -0
  21. package/dist/prosekit-preact-popover.d.ts +227 -14
  22. package/dist/prosekit-preact-popover.d.ts.map +1 -1
  23. package/dist/prosekit-preact-popover.js +170 -7
  24. package/dist/prosekit-preact-popover.js.map +1 -1
  25. package/dist/prosekit-preact-resizable.d.ts +56 -12
  26. package/dist/prosekit-preact-resizable.d.ts.map +1 -1
  27. package/dist/prosekit-preact-resizable.js +80 -7
  28. package/dist/prosekit-preact-resizable.js.map +1 -1
  29. package/dist/prosekit-preact-table-handle.d.ts +447 -38
  30. package/dist/prosekit-preact-table-handle.d.ts.map +1 -1
  31. package/dist/prosekit-preact-table-handle.js +381 -19
  32. package/dist/prosekit-preact-table-handle.js.map +1 -1
  33. package/dist/prosekit-preact-tooltip.d.ts +211 -14
  34. package/dist/prosekit-preact-tooltip.d.ts.map +1 -1
  35. package/dist/prosekit-preact-tooltip.js +157 -7
  36. package/dist/prosekit-preact-tooltip.js.map +1 -1
  37. package/package.json +27 -16
  38. package/src/components/autocomplete/autocomplete-empty.gen.ts +41 -31
  39. package/src/components/autocomplete/autocomplete-item.gen.ts +84 -31
  40. package/src/components/autocomplete/autocomplete-popup.gen.ts +80 -0
  41. package/src/components/autocomplete/autocomplete-positioner.gen.ts +153 -0
  42. package/src/components/autocomplete/autocomplete-root.gen.ts +109 -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 +59 -31
  46. package/src/components/block-handle/block-handle-draggable.gen.ts +59 -31
  47. package/src/components/block-handle/block-handle-popup.gen.ts +44 -0
  48. package/src/components/block-handle/block-handle-positioner.gen.ts +171 -0
  49. package/src/components/block-handle/block-handle-root.gen.ts +84 -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 +65 -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 +44 -0
  58. package/src/components/inline-popover/inline-popover-positioner.gen.ts +177 -0
  59. package/src/components/inline-popover/inline-popover-root.gen.ts +108 -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 +91 -0
  63. package/src/components/menu/menu-popup.gen.ts +58 -0
  64. package/src/components/menu/menu-positioner.gen.ts +178 -0
  65. package/src/components/menu/menu-root.gen.ts +88 -0
  66. package/src/components/menu/menu-submenu-root.gen.ts +44 -0
  67. package/src/components/menu/menu-submenu-trigger.gen.ts +44 -0
  68. package/src/components/menu/menu-trigger.gen.ts +79 -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 +44 -0
  72. package/src/components/popover/popover-positioner.gen.ts +178 -0
  73. package/src/components/popover/popover-root.gen.ts +92 -31
  74. package/src/components/popover/popover-trigger.gen.ts +92 -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 +54 -31
  78. package/src/components/resizable/resizable-root.gen.ts +90 -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 +66 -0
  82. package/src/components/table-handle/table-handle-column-menu-trigger.gen.ts +60 -0
  83. package/src/components/table-handle/table-handle-column-popup.gen.ts +44 -0
  84. package/src/components/table-handle/table-handle-column-positioner.gen.ts +201 -0
  85. package/src/components/table-handle/table-handle-drag-preview.gen.ts +57 -31
  86. package/src/components/table-handle/table-handle-drop-indicator.gen.ts +57 -31
  87. package/src/components/table-handle/table-handle-root.gen.ts +59 -31
  88. package/src/components/table-handle/table-handle-row-menu-root.gen.ts +66 -0
  89. package/src/components/table-handle/table-handle-row-menu-trigger.gen.ts +60 -0
  90. package/src/components/table-handle/table-handle-row-popup.gen.ts +44 -0
  91. package/src/components/table-handle/table-handle-row-positioner.gen.ts +201 -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 +44 -0
  95. package/src/components/tooltip/tooltip-positioner.gen.ts +178 -0
  96. package/src/components/tooltip/tooltip-root.gen.ts +85 -31
  97. package/src/components/tooltip/tooltip-trigger.gen.ts +63 -31
  98. package/src/extensions/preact-node-view.spec.ts +151 -0
  99. package/dist/create-component.js +0 -95
  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 -123
  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,27 +1,223 @@
1
- import { t as CreateProps } from "./create-props.js";
2
- import { ForwardRefExoticComponent, HTMLAttributes, RefAttributes } from "preact/compat";
3
- import { BlockHandleAddElement, BlockHandleAddEvents, BlockHandleAddProps as BlockHandleAddProps$1, BlockHandleDraggableElement, BlockHandleDraggableEvents, BlockHandleDraggableProps as BlockHandleDraggableProps$1, BlockHandlePopoverElement, BlockHandlePopoverEvents, BlockHandlePopoverProps as BlockHandlePopoverProps$1 } from "@prosekit/web/block-handle";
1
+ import { HTMLAttributes } from "preact";
2
+ import { ForwardRefExoticComponent, RefAttributes } from "preact/compat";
3
+ import { BlockHandleAddElement, BlockHandleAddProps as BlockHandleAddProps$1, BlockHandleDraggableElement, BlockHandleDraggableProps as BlockHandleDraggableProps$1, BlockHandlePopupElement, BlockHandlePositionerElement, BlockHandlePositionerProps as BlockHandlePositionerProps$1, BlockHandleRootElement, BlockHandleRootEvents, BlockHandleRootProps as BlockHandleRootProps$1, BlockHandleStateChangeEvent } from "@prosekit/web/block-handle";
4
4
 
5
5
  //#region src/components/block-handle/block-handle-add.gen.d.ts
6
6
  /**
7
- * Props for the {@link BlockHandleAdd} component.
7
+ * Props for the {@link BlockHandleAdd} Preact component.
8
+ *
9
+ * @public
8
10
  */
9
- interface BlockHandleAddProps extends Partial<CreateProps<BlockHandleAddProps$1, BlockHandleAddEvents>> {}
10
- declare const BlockHandleAdd: ForwardRefExoticComponent<Partial<BlockHandleAddProps> & RefAttributes<BlockHandleAddElement> & HTMLAttributes<BlockHandleAddElement>>;
11
+ interface BlockHandleAddProps extends HTMLAttributes<BlockHandleAddElement> {
12
+ /**
13
+ * The ProseKit editor instance.
14
+ *
15
+ * @default null
16
+ * @hidden
17
+ */
18
+ editor?: BlockHandleAddProps$1['editor'];
19
+ }
20
+ /**
21
+ * A Preact component that renders an `prosekit-block-handle-add` custom element.
22
+ *
23
+ * @public
24
+ */
25
+ declare const BlockHandleAdd: ForwardRefExoticComponent<BlockHandleAddProps & RefAttributes<BlockHandleAddElement>>;
11
26
  //#endregion
12
27
  //#region src/components/block-handle/block-handle-draggable.gen.d.ts
13
28
  /**
14
- * Props for the {@link BlockHandleDraggable} component.
29
+ * Props for the {@link BlockHandleDraggable} Preact component.
30
+ *
31
+ * @public
32
+ */
33
+ interface BlockHandleDraggableProps extends HTMLAttributes<BlockHandleDraggableElement> {
34
+ /**
35
+ * The ProseKit editor instance.
36
+ *
37
+ * @default null
38
+ * @hidden
39
+ */
40
+ editor?: BlockHandleDraggableProps$1['editor'];
41
+ }
42
+ /**
43
+ * A Preact component that renders an `prosekit-block-handle-draggable` custom element.
44
+ *
45
+ * @public
46
+ */
47
+ declare const BlockHandleDraggable: ForwardRefExoticComponent<BlockHandleDraggableProps & RefAttributes<BlockHandleDraggableElement>>;
48
+ //#endregion
49
+ //#region src/components/block-handle/block-handle-popup.gen.d.ts
50
+ /**
51
+ * Props for the {@link BlockHandlePopup} Preact component.
52
+ *
53
+ * @public
54
+ */
55
+ interface BlockHandlePopupProps extends HTMLAttributes<BlockHandlePopupElement> {}
56
+ /**
57
+ * A Preact component that renders an `prosekit-block-handle-popup` custom element.
58
+ *
59
+ * @public
60
+ */
61
+ declare const BlockHandlePopup: ForwardRefExoticComponent<BlockHandlePopupProps & RefAttributes<BlockHandlePopupElement>>;
62
+ //#endregion
63
+ //#region src/components/block-handle/block-handle-positioner.gen.d.ts
64
+ /**
65
+ * Props for the {@link BlockHandlePositioner} Preact component.
66
+ *
67
+ * @public
15
68
  */
16
- interface BlockHandleDraggableProps extends Partial<CreateProps<BlockHandleDraggableProps$1, BlockHandleDraggableEvents>> {}
17
- declare const BlockHandleDraggable: ForwardRefExoticComponent<Partial<BlockHandleDraggableProps> & RefAttributes<BlockHandleDraggableElement> & HTMLAttributes<BlockHandleDraggableElement>>;
69
+ interface BlockHandlePositionerProps extends HTMLAttributes<BlockHandlePositionerElement> {
70
+ /**
71
+ * The placement of the popover, relative to the hovered block.
72
+ *
73
+ * @default "left"
74
+ */
75
+ placement?: BlockHandlePositionerProps$1['placement'];
76
+ /**
77
+ * Whether to use the browser [Popover API](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API)
78
+ * to place the floating element on top of other page content.
79
+ *
80
+ * @default false
81
+ */
82
+ hoist?: BlockHandlePositionerProps$1['hoist'];
83
+ /**
84
+ * @default false
85
+ * @hidden
86
+ */
87
+ flip?: BlockHandlePositionerProps$1['flip'];
88
+ /**
89
+ * @default false
90
+ * @hidden
91
+ */
92
+ shift?: BlockHandlePositionerProps$1['shift'];
93
+ /**
94
+ * @default true
95
+ * @hidden
96
+ */
97
+ hide?: BlockHandlePositionerProps$1['hide'];
98
+ /**
99
+ * The strategy to use for positioning
100
+ *
101
+ * @default "absolute"
102
+ */
103
+ strategy?: BlockHandlePositionerProps$1['strategy'];
104
+ /**
105
+ * Options to activate auto-update listeners
106
+ *
107
+ * @see https://floating-ui.com/docs/autoUpdate
108
+ *
109
+ * @default true
110
+ */
111
+ autoUpdate?: BlockHandlePositionerProps$1['autoUpdate'];
112
+ /**
113
+ * The distance between the reference and floating element.
114
+ *
115
+ * @default 6
116
+ */
117
+ offset?: BlockHandlePositionerProps$1['offset'];
118
+ /**
119
+ * Whether the floating element can overlap the reference element to keep it
120
+ * in view.
121
+ *
122
+ * @default false
123
+ */
124
+ overlap?: BlockHandlePositionerProps$1['overlap'];
125
+ /**
126
+ * Whether to constrain the floating element's width and height to not exceed
127
+ * the viewport.
128
+ *
129
+ * @default false
130
+ */
131
+ fitViewport?: BlockHandlePositionerProps$1['fitViewport'];
132
+ /**
133
+ * Whether to constrain the floating element's width so that it matches the
134
+ * reference element.
135
+ *
136
+ * @default false
137
+ */
138
+ sameWidth?: BlockHandlePositionerProps$1['sameWidth'];
139
+ /**
140
+ * Whether to constrain the floating element's height so that it matches the
141
+ * reference element.
142
+ *
143
+ * @default false
144
+ */
145
+ sameHeight?: BlockHandlePositionerProps$1['sameHeight'];
146
+ /**
147
+ * Whether to improve positioning for inline reference elements that span over
148
+ * multiple lines.
149
+ *
150
+ * @default false
151
+ */
152
+ inline?: BlockHandlePositionerProps$1['inline'];
153
+ /**
154
+ * Describes the clipping element(s) or area that overflow will be checked relative to.
155
+ * Please see https://floating-ui.com/docs/detectoverflow#boundary for more information.
156
+ *
157
+ * @default 'clippingAncestors'
158
+ */
159
+ boundary?: BlockHandlePositionerProps$1['boundary'];
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?: BlockHandlePositionerProps$1['rootBoundary'];
167
+ /**
168
+ * Describes the virtual padding around the boundary to check for overflow.
169
+ * Please see https://floating-ui.com/docs/detectoverflow#padding for more information.
170
+ *
171
+ * @default 4
172
+ */
173
+ overflowPadding?: BlockHandlePositionerProps$1['overflowPadding'];
174
+ /**
175
+ * The element that will be used to check for overflow. Please see
176
+ * https://floating-ui.com/docs/detectoverflow#elementcontext for more
177
+ * information.
178
+ *
179
+ * @default 'floating'
180
+ */
181
+ elementContext?: BlockHandlePositionerProps$1['elementContext'];
182
+ /**
183
+ * Whether to check the alternate elementContext's boundary. Please see
184
+ * https://floating-ui.com/docs/detectoverflow#altboundary for more
185
+ * information.
186
+ *
187
+ * @default false
188
+ */
189
+ altBoundary?: BlockHandlePositionerProps$1['altBoundary'];
190
+ }
191
+ /**
192
+ * A Preact component that renders an `prosekit-block-handle-positioner` custom element.
193
+ *
194
+ * @public
195
+ */
196
+ declare const BlockHandlePositioner: ForwardRefExoticComponent<BlockHandlePositionerProps & RefAttributes<BlockHandlePositionerElement>>;
18
197
  //#endregion
19
- //#region src/components/block-handle/block-handle-popover.gen.d.ts
198
+ //#region src/components/block-handle/block-handle-root.gen.d.ts
199
+ /**
200
+ * Props for the {@link BlockHandleRoot} Preact component.
201
+ *
202
+ * @public
203
+ */
204
+ interface BlockHandleRootProps extends HTMLAttributes<BlockHandleRootElement> {
205
+ /**
206
+ * The ProseKit editor instance.
207
+ *
208
+ * @default null
209
+ * @hidden
210
+ */
211
+ editor?: BlockHandleRootProps$1['editor'];
212
+ /** Fired when the hovered block changes. */
213
+ onStateChange?: (event: BlockHandleRootEvents['stateChange']) => void;
214
+ }
20
215
  /**
21
- * Props for the {@link BlockHandlePopover} component.
216
+ * A Preact component that renders an `prosekit-block-handle-root` custom element.
217
+ *
218
+ * @public
22
219
  */
23
- interface BlockHandlePopoverProps extends Partial<CreateProps<BlockHandlePopoverProps$1, BlockHandlePopoverEvents>> {}
24
- declare const BlockHandlePopover: ForwardRefExoticComponent<Partial<BlockHandlePopoverProps> & RefAttributes<BlockHandlePopoverElement> & HTMLAttributes<BlockHandlePopoverElement>>;
220
+ declare const BlockHandleRoot: ForwardRefExoticComponent<BlockHandleRootProps & RefAttributes<BlockHandleRootElement>>;
25
221
  //#endregion
26
- export { BlockHandleAdd, type BlockHandleAddProps, BlockHandleDraggable, type BlockHandleDraggableProps, BlockHandlePopover, type BlockHandlePopoverProps };
222
+ export { BlockHandleAdd, type BlockHandleAddProps, BlockHandleDraggable, type BlockHandleDraggableProps, BlockHandlePopup, type BlockHandlePopupProps, BlockHandlePositioner, type BlockHandlePositionerProps, BlockHandleRoot, type BlockHandleRootEvents, type BlockHandleRootProps, BlockHandleStateChangeEvent };
27
223
  //# sourceMappingURL=prosekit-preact-block-handle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-preact-block-handle.d.ts","names":[],"sources":["../src/components/block-handle/block-handle-add.gen.ts","../src/components/block-handle/block-handle-draggable.gen.ts","../src/components/block-handle/block-handle-popover.gen.ts"],"mappings":";;;;;;;AAmBA;UAAiB,mBAAA,SAA4B,OAAA,CAAQ,WAAA,CAAY,qBAAA,EAAO,oBAAA;AAAA,cAE3D,cAAA,EAAgB,yBAAA,CAC3B,OAAA,CAAQ,mBAAA,IACR,aAAA,CAAc,qBAAA,IACd,cAAA,CAAe,qBAAA;;;;;AALjB;UCAiB,yBAAA,SAAkC,OAAA,CAAQ,WAAA,CAAY,2BAAA,EAAO,0BAAA;AAAA,cAEjE,oBAAA,EAAsB,yBAAA,CACjC,OAAA,CAAQ,yBAAA,IACR,aAAA,CAAc,2BAAA,IACd,cAAA,CAAe,2BAAA;;;;;ADLjB;UEAiB,uBAAA,SAAgC,OAAA,CAAQ,WAAA,CAAY,yBAAA,EAAO,wBAAA;AAAA,cAE/D,kBAAA,EAAoB,yBAAA,CAC/B,OAAA,CAAQ,uBAAA,IACR,aAAA,CAAc,yBAAA,IACd,cAAA,CAAe,yBAAA"}
1
+ {"version":3,"file":"prosekit-preact-block-handle.d.ts","names":[],"sources":["../src/components/block-handle/block-handle-add.gen.ts","../src/components/block-handle/block-handle-draggable.gen.ts","../src/components/block-handle/block-handle-popup.gen.ts","../src/components/block-handle/block-handle-positioner.gen.ts","../src/components/block-handle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AA,GAAiB,4BAAA;EA9FV;;;;;;;EAsGP,WAAA,GAAc,4BAAA;AAAA;;;;;;cAoCH,qBAAA,EAAuB,yBAAA,CAA0B,0BAAA,GAA6B,aAAA,CAAc,4BAAA;;;;;;;;UC1JxF,oBAAA,SAA6B,cAAA,CAAe,sBAAA;EJAF;;;;;;EIOzD,MAAA,GAAS,sBAAA;EJsCE;EIpCX,aAAA,IAAiB,KAAA,EAAO,qBAAA;AAAA;;;;;;cAwDb,eAAA,EAAiB,yBAAA,CAA0B,oBAAA,GAAuB,aAAA,CAAc,sBAAA"}
@@ -1,14 +1,191 @@
1
- import { t as createComponent } from "./create-component.js";
2
- import { blockHandleAddEvents, blockHandleAddProps, blockHandleDraggableEvents, blockHandleDraggableProps, blockHandlePopoverEvents, blockHandlePopoverProps } from "@prosekit/web/block-handle";
1
+ import { n as useEditorContext } from "./editor-context.js";
2
+ import { createElement } from "preact";
3
+ import { useCallback, useLayoutEffect, useRef } from "preact/hooks";
4
+ import { forwardRef } from "preact/compat";
5
+ import { BlockHandleStateChangeEvent, registerBlockHandleAddElement, registerBlockHandleDraggableElement, registerBlockHandlePopupElement, registerBlockHandlePositionerElement, registerBlockHandleRootElement } from "@prosekit/web/block-handle";
3
6
  //#region src/components/block-handle/block-handle-add.gen.ts
4
- const BlockHandleAdd = createComponent("prosekit-block-handle-add", "BlockHandleAdd", Object.keys(blockHandleAddProps), Object.keys(blockHandleAddEvents));
7
+ /**
8
+ * This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
9
+ */
10
+ function BlockHandleAddComponent(props, forwardedRef) {
11
+ registerBlockHandleAddElement();
12
+ const elementRef = useRef(null);
13
+ const p0Fallback = useEditorContext();
14
+ const { editor: p0, ...restProps } = props;
15
+ useLayoutEffect(() => {
16
+ const element = elementRef.current;
17
+ if (!element) return;
18
+ Object.assign(element, { editor: p0 ?? p0Fallback });
19
+ });
20
+ const mergedRef = useCallback((element) => {
21
+ elementRef.current = element;
22
+ if (typeof forwardedRef === "function") forwardedRef(element);
23
+ else if (forwardedRef) forwardedRef.current = element;
24
+ }, [forwardedRef]);
25
+ return createElement("prosekit-block-handle-add", {
26
+ ...restProps,
27
+ ref: mergedRef,
28
+ suppressHydrationWarning: true
29
+ });
30
+ }
31
+ /**
32
+ * A Preact component that renders an `prosekit-block-handle-add` custom element.
33
+ *
34
+ * @public
35
+ */
36
+ const BlockHandleAdd = /* @__PURE__ */ forwardRef(BlockHandleAddComponent);
5
37
  //#endregion
6
38
  //#region src/components/block-handle/block-handle-draggable.gen.ts
7
- const BlockHandleDraggable = createComponent("prosekit-block-handle-draggable", "BlockHandleDraggable", Object.keys(blockHandleDraggableProps), Object.keys(blockHandleDraggableEvents));
39
+ /**
40
+ * This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
41
+ */
42
+ function BlockHandleDraggableComponent(props, forwardedRef) {
43
+ registerBlockHandleDraggableElement();
44
+ const elementRef = useRef(null);
45
+ const p0Fallback = useEditorContext();
46
+ const { editor: p0, ...restProps } = props;
47
+ useLayoutEffect(() => {
48
+ const element = elementRef.current;
49
+ if (!element) return;
50
+ Object.assign(element, { editor: p0 ?? p0Fallback });
51
+ });
52
+ const mergedRef = useCallback((element) => {
53
+ elementRef.current = element;
54
+ if (typeof forwardedRef === "function") forwardedRef(element);
55
+ else if (forwardedRef) forwardedRef.current = element;
56
+ }, [forwardedRef]);
57
+ return createElement("prosekit-block-handle-draggable", {
58
+ ...restProps,
59
+ ref: mergedRef,
60
+ suppressHydrationWarning: true
61
+ });
62
+ }
63
+ /**
64
+ * A Preact component that renders an `prosekit-block-handle-draggable` custom element.
65
+ *
66
+ * @public
67
+ */
68
+ const BlockHandleDraggable = /* @__PURE__ */ forwardRef(BlockHandleDraggableComponent);
8
69
  //#endregion
9
- //#region src/components/block-handle/block-handle-popover.gen.ts
10
- const BlockHandlePopover = createComponent("prosekit-block-handle-popover", "BlockHandlePopover", Object.keys(blockHandlePopoverProps), Object.keys(blockHandlePopoverEvents));
70
+ //#region src/components/block-handle/block-handle-popup.gen.ts
71
+ /**
72
+ * This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
73
+ */
74
+ function BlockHandlePopupComponent(props, forwardedRef) {
75
+ registerBlockHandlePopupElement();
76
+ const elementRef = useRef(null);
77
+ const { ...restProps } = props;
78
+ const mergedRef = useCallback((element) => {
79
+ elementRef.current = element;
80
+ if (typeof forwardedRef === "function") forwardedRef(element);
81
+ else if (forwardedRef) forwardedRef.current = element;
82
+ }, [forwardedRef]);
83
+ return createElement("prosekit-block-handle-popup", {
84
+ ...restProps,
85
+ ref: mergedRef,
86
+ suppressHydrationWarning: true
87
+ });
88
+ }
89
+ /**
90
+ * A Preact component that renders an `prosekit-block-handle-popup` custom element.
91
+ *
92
+ * @public
93
+ */
94
+ const BlockHandlePopup = /* @__PURE__ */ forwardRef(BlockHandlePopupComponent);
11
95
  //#endregion
12
- export { BlockHandleAdd, BlockHandleDraggable, BlockHandlePopover };
96
+ //#region src/components/block-handle/block-handle-positioner.gen.ts
97
+ /**
98
+ * This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
99
+ */
100
+ function BlockHandlePositionerComponent(props, forwardedRef) {
101
+ registerBlockHandlePositionerElement();
102
+ const elementRef = useRef(null);
103
+ 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;
104
+ useLayoutEffect(() => {
105
+ const element = elementRef.current;
106
+ if (!element) return;
107
+ Object.assign(element, {
108
+ altBoundary: p0,
109
+ autoUpdate: p1,
110
+ boundary: p2,
111
+ elementContext: p3,
112
+ fitViewport: p4,
113
+ flip: p5,
114
+ hide: p6,
115
+ hoist: p7,
116
+ inline: p8,
117
+ offset: p9,
118
+ overflowPadding: p10,
119
+ overlap: p11,
120
+ placement: p12,
121
+ rootBoundary: p13,
122
+ sameHeight: p14,
123
+ sameWidth: p15,
124
+ shift: p16,
125
+ strategy: p17
126
+ });
127
+ });
128
+ const mergedRef = useCallback((element) => {
129
+ elementRef.current = element;
130
+ if (typeof forwardedRef === "function") forwardedRef(element);
131
+ else if (forwardedRef) forwardedRef.current = element;
132
+ }, [forwardedRef]);
133
+ return createElement("prosekit-block-handle-positioner", {
134
+ ...restProps,
135
+ ref: mergedRef,
136
+ suppressHydrationWarning: true
137
+ });
138
+ }
139
+ /**
140
+ * A Preact component that renders an `prosekit-block-handle-positioner` custom element.
141
+ *
142
+ * @public
143
+ */
144
+ const BlockHandlePositioner = /* @__PURE__ */ forwardRef(BlockHandlePositionerComponent);
145
+ //#endregion
146
+ //#region src/components/block-handle/block-handle-root.gen.ts
147
+ /**
148
+ * This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
149
+ */
150
+ function BlockHandleRootComponent(props, forwardedRef) {
151
+ registerBlockHandleRootElement();
152
+ const elementRef = useRef(null);
153
+ const handlersRef = useRef([]);
154
+ const p0Fallback = useEditorContext();
155
+ const { editor: p0, onStateChange: e0, ...restProps } = props;
156
+ useLayoutEffect(() => {
157
+ const element = elementRef.current;
158
+ if (!element) return;
159
+ Object.assign(element, { editor: p0 ?? p0Fallback });
160
+ handlersRef.current = [e0];
161
+ });
162
+ useLayoutEffect(() => {
163
+ const element = elementRef.current;
164
+ if (!element) return;
165
+ const ac = new AbortController();
166
+ for (const [index, eventName] of ["stateChange"].entries()) element.addEventListener(eventName, (event) => {
167
+ handlersRef.current[index]?.(event);
168
+ }, { signal: ac.signal });
169
+ return () => ac.abort();
170
+ }, []);
171
+ const mergedRef = useCallback((element) => {
172
+ elementRef.current = element;
173
+ if (typeof forwardedRef === "function") forwardedRef(element);
174
+ else if (forwardedRef) forwardedRef.current = element;
175
+ }, [forwardedRef]);
176
+ return createElement("prosekit-block-handle-root", {
177
+ ...restProps,
178
+ ref: mergedRef,
179
+ suppressHydrationWarning: true
180
+ });
181
+ }
182
+ /**
183
+ * A Preact component that renders an `prosekit-block-handle-root` custom element.
184
+ *
185
+ * @public
186
+ */
187
+ const BlockHandleRoot = /* @__PURE__ */ forwardRef(BlockHandleRootComponent);
188
+ //#endregion
189
+ export { BlockHandleAdd, BlockHandleDraggable, BlockHandlePopup, BlockHandlePositioner, BlockHandleRoot, BlockHandleStateChangeEvent };
13
190
 
14
191
  //# sourceMappingURL=prosekit-preact-block-handle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-preact-block-handle.js","names":[],"sources":["../src/components/block-handle/block-handle-add.gen.ts","../src/components/block-handle/block-handle-draggable.gen.ts","../src/components/block-handle/block-handle-popover.gen.ts"],"sourcesContent":["import {\n type BlockHandleAddElement,\n type BlockHandleAddProps as Props,\n type BlockHandleAddEvents as Events,\n blockHandleAddProps,\n blockHandleAddEvents,\n} from '@prosekit/web/block-handle'\nimport type {\n ForwardRefExoticComponent,\n HTMLAttributes,\n RefAttributes,\n} from 'preact/compat'\n\nimport { createComponent } from '../create-component.ts'\nimport type { CreateProps } from '../create-props.ts'\n\n/**\n * Props for the {@link BlockHandleAdd} component.\n */\nexport interface BlockHandleAddProps extends Partial<CreateProps<Props, Events>> {}\n\nexport const BlockHandleAdd: ForwardRefExoticComponent<\n Partial<BlockHandleAddProps> &\n RefAttributes<BlockHandleAddElement> &\n HTMLAttributes<BlockHandleAddElement>\n> = createComponent<\n BlockHandleAddProps,\n BlockHandleAddElement\n>(\n 'prosekit-block-handle-add',\n 'BlockHandleAdd',\n Object.keys(blockHandleAddProps),\n Object.keys(blockHandleAddEvents),\n)\n","import {\n type BlockHandleDraggableElement,\n type BlockHandleDraggableProps as Props,\n type BlockHandleDraggableEvents as Events,\n blockHandleDraggableProps,\n blockHandleDraggableEvents,\n} from '@prosekit/web/block-handle'\nimport type {\n ForwardRefExoticComponent,\n HTMLAttributes,\n RefAttributes,\n} from 'preact/compat'\n\nimport { createComponent } from '../create-component.ts'\nimport type { CreateProps } from '../create-props.ts'\n\n/**\n * Props for the {@link BlockHandleDraggable} component.\n */\nexport interface BlockHandleDraggableProps extends Partial<CreateProps<Props, Events>> {}\n\nexport const BlockHandleDraggable: ForwardRefExoticComponent<\n Partial<BlockHandleDraggableProps> &\n RefAttributes<BlockHandleDraggableElement> &\n HTMLAttributes<BlockHandleDraggableElement>\n> = createComponent<\n BlockHandleDraggableProps,\n BlockHandleDraggableElement\n>(\n 'prosekit-block-handle-draggable',\n 'BlockHandleDraggable',\n Object.keys(blockHandleDraggableProps),\n Object.keys(blockHandleDraggableEvents),\n)\n","import {\n type BlockHandlePopoverElement,\n type BlockHandlePopoverProps as Props,\n type BlockHandlePopoverEvents as Events,\n blockHandlePopoverProps,\n blockHandlePopoverEvents,\n} from '@prosekit/web/block-handle'\nimport type {\n ForwardRefExoticComponent,\n HTMLAttributes,\n RefAttributes,\n} from 'preact/compat'\n\nimport { createComponent } from '../create-component.ts'\nimport type { CreateProps } from '../create-props.ts'\n\n/**\n * Props for the {@link BlockHandlePopover} component.\n */\nexport interface BlockHandlePopoverProps extends Partial<CreateProps<Props, Events>> {}\n\nexport const BlockHandlePopover: ForwardRefExoticComponent<\n Partial<BlockHandlePopoverProps> &\n RefAttributes<BlockHandlePopoverElement> &\n HTMLAttributes<BlockHandlePopoverElement>\n> = createComponent<\n BlockHandlePopoverProps,\n BlockHandlePopoverElement\n>(\n 'prosekit-block-handle-popover',\n 'BlockHandlePopover',\n Object.keys(blockHandlePopoverProps),\n Object.keys(blockHandlePopoverEvents),\n)\n"],"mappings":";;;AAqBA,MAAa,iBAIT,gBAIF,6BACA,kBACA,OAAO,KAAK,oBAAoB,EAChC,OAAO,KAAK,qBAAqB,CAClC;;;ACZD,MAAa,uBAIT,gBAIF,mCACA,wBACA,OAAO,KAAK,0BAA0B,EACtC,OAAO,KAAK,2BAA2B,CACxC;;;ACZD,MAAa,qBAIT,gBAIF,iCACA,sBACA,OAAO,KAAK,wBAAwB,EACpC,OAAO,KAAK,yBAAyB,CACtC"}
1
+ {"version":3,"file":"prosekit-preact-block-handle.js","names":[],"sources":["../src/components/block-handle/block-handle-add.gen.ts","../src/components/block-handle/block-handle-draggable.gen.ts","../src/components/block-handle/block-handle-popup.gen.ts","../src/components/block-handle/block-handle-positioner.gen.ts","../src/components/block-handle/block-handle-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 { registerBlockHandleAddElement, type BlockHandleAddElement, type BlockHandleAddProps as BlockHandleAddElementProps } from '@prosekit/web/block-handle';\nimport { createElement, type HTMLAttributes, type Ref } from 'preact';\nimport { forwardRef, type ForwardRefExoticComponent, type RefAttributes } from 'preact/compat';\nimport { useCallback, useRef, useLayoutEffect } from 'preact/hooks';\n\nimport { useEditorContext } from '../../contexts/editor-context.ts';\n\n/**\n * Props for the {@link BlockHandleAdd} Preact component.\n *\n * @public\n */\nexport interface BlockHandleAddProps extends HTMLAttributes<BlockHandleAddElement> {\n /**\n * The ProseKit editor instance.\n *\n * @default null\n * @hidden\n */\n editor?: BlockHandleAddElementProps['editor'];\n}\n\nfunction BlockHandleAddComponent(props: BlockHandleAddProps, forwardedRef: Ref<BlockHandleAddElement>) {\n registerBlockHandleAddElement();\n\n const elementRef = useRef<BlockHandleAddElement>(null);\n\n const p0Fallback = useEditorContext();\n\n const { editor: p0, ...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 });\n });\n\n const mergedRef = useCallback(\n (element: BlockHandleAddElement | 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-block-handle-add', { ...restProps, ref: mergedRef, suppressHydrationWarning: true });\n}\n\n/**\n * A Preact component that renders an `prosekit-block-handle-add` custom element.\n *\n * @public\n */\nexport const BlockHandleAdd: ForwardRefExoticComponent<BlockHandleAddProps & RefAttributes<BlockHandleAddElement>> = /* @__PURE__ */ forwardRef(BlockHandleAddComponent);\n","/**\n * This file is auto-generated by the \"@aria-ui/cli\" tool. Do not edit this file directly.\n */\n\nimport { registerBlockHandleDraggableElement, type BlockHandleDraggableElement, type BlockHandleDraggableProps as BlockHandleDraggableElementProps } from '@prosekit/web/block-handle';\nimport { createElement, type HTMLAttributes, type Ref } from 'preact';\nimport { forwardRef, type ForwardRefExoticComponent, type RefAttributes } from 'preact/compat';\nimport { useCallback, useRef, useLayoutEffect } from 'preact/hooks';\n\nimport { useEditorContext } from '../../contexts/editor-context.ts';\n\n/**\n * Props for the {@link BlockHandleDraggable} Preact component.\n *\n * @public\n */\nexport interface BlockHandleDraggableProps extends HTMLAttributes<BlockHandleDraggableElement> {\n /**\n * The ProseKit editor instance.\n *\n * @default null\n * @hidden\n */\n editor?: BlockHandleDraggableElementProps['editor'];\n}\n\nfunction BlockHandleDraggableComponent(props: BlockHandleDraggableProps, forwardedRef: Ref<BlockHandleDraggableElement>) {\n registerBlockHandleDraggableElement();\n\n const elementRef = useRef<BlockHandleDraggableElement>(null);\n\n const p0Fallback = useEditorContext();\n\n const { editor: p0, ...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 });\n });\n\n const mergedRef = useCallback(\n (element: BlockHandleDraggableElement | 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-block-handle-draggable', { ...restProps, ref: mergedRef, suppressHydrationWarning: true });\n}\n\n/**\n * A Preact component that renders an `prosekit-block-handle-draggable` custom element.\n *\n * @public\n */\nexport const BlockHandleDraggable: ForwardRefExoticComponent<BlockHandleDraggableProps & RefAttributes<BlockHandleDraggableElement>> = /* @__PURE__ */ forwardRef(BlockHandleDraggableComponent);\n","/**\n * This file is auto-generated by the \"@aria-ui/cli\" tool. Do not edit this file directly.\n */\n\nimport { registerBlockHandlePopupElement, type BlockHandlePopupElement } from '@prosekit/web/block-handle';\nimport { createElement, type HTMLAttributes, type Ref } from 'preact';\nimport { forwardRef, type ForwardRefExoticComponent, type RefAttributes } from 'preact/compat';\nimport { useCallback, useRef } from 'preact/hooks';\n\n/**\n * Props for the {@link BlockHandlePopup} Preact component.\n *\n * @public\n */\nexport interface BlockHandlePopupProps extends HTMLAttributes<BlockHandlePopupElement> {}\n\nfunction BlockHandlePopupComponent(props: BlockHandlePopupProps, forwardedRef: Ref<BlockHandlePopupElement>) {\n registerBlockHandlePopupElement();\n\n const elementRef = useRef<BlockHandlePopupElement>(null);\n\n const { ...restProps } = props;\n\n const mergedRef = useCallback(\n (element: BlockHandlePopupElement | 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-block-handle-popup', { ...restProps, ref: mergedRef, suppressHydrationWarning: true });\n}\n\n/**\n * A Preact component that renders an `prosekit-block-handle-popup` custom element.\n *\n * @public\n */\nexport const BlockHandlePopup: ForwardRefExoticComponent<BlockHandlePopupProps & RefAttributes<BlockHandlePopupElement>> = /* @__PURE__ */ forwardRef(BlockHandlePopupComponent);\n","/**\n * This file is auto-generated by the \"@aria-ui/cli\" tool. Do not edit this file directly.\n */\n\nimport { registerBlockHandlePositionerElement, type BlockHandlePositionerElement, type BlockHandlePositionerProps as BlockHandlePositionerElementProps } from '@prosekit/web/block-handle';\nimport { createElement, type HTMLAttributes, type Ref } from 'preact';\nimport { forwardRef, type ForwardRefExoticComponent, type RefAttributes } from 'preact/compat';\nimport { useCallback, useRef, useLayoutEffect } from 'preact/hooks';\n\n/**\n * Props for the {@link BlockHandlePositioner} Preact component.\n *\n * @public\n */\nexport interface BlockHandlePositionerProps extends HTMLAttributes<BlockHandlePositionerElement> {\n /**\n * The placement of the popover, relative to the hovered block.\n *\n * @default \"left\"\n */\n placement?: BlockHandlePositionerElementProps['placement'];\n /**\n * Whether to use the browser [Popover API](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API)\n * to place the floating element on top of other page content.\n *\n * @default false\n */\n hoist?: BlockHandlePositionerElementProps['hoist'];\n /**\n * @default false\n * @hidden\n */\n flip?: BlockHandlePositionerElementProps['flip'];\n /**\n * @default false\n * @hidden\n */\n shift?: BlockHandlePositionerElementProps['shift'];\n /**\n * @default true\n * @hidden\n */\n hide?: BlockHandlePositionerElementProps['hide'];\n /**\n * The strategy to use for positioning\n *\n * @default \"absolute\"\n */\n strategy?: BlockHandlePositionerElementProps['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?: BlockHandlePositionerElementProps['autoUpdate'];\n /**\n * The distance between the reference and floating element.\n *\n * @default 6\n */\n offset?: BlockHandlePositionerElementProps['offset'];\n /**\n * Whether the floating element can overlap the reference element to keep it\n * in view.\n *\n * @default false\n */\n overlap?: BlockHandlePositionerElementProps['overlap'];\n /**\n * Whether to constrain the floating element's width and height to not exceed\n * the viewport.\n *\n * @default false\n */\n fitViewport?: BlockHandlePositionerElementProps['fitViewport'];\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?: BlockHandlePositionerElementProps['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?: BlockHandlePositionerElementProps['sameHeight'];\n /**\n * Whether to improve positioning for inline reference elements that span over\n * multiple lines.\n *\n * @default false\n */\n inline?: BlockHandlePositionerElementProps['inline'];\n /**\n * Describes the clipping element(s) or area that overflow will be checked relative to.\n * Please see https://floating-ui.com/docs/detectoverflow#boundary for more information.\n *\n * @default 'clippingAncestors'\n */\n boundary?: BlockHandlePositionerElementProps['boundary'];\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?: BlockHandlePositionerElementProps['rootBoundary'];\n /**\n * Describes the virtual padding around the boundary to check for overflow.\n * Please see https://floating-ui.com/docs/detectoverflow#padding for more information.\n *\n * @default 4\n */\n overflowPadding?: BlockHandlePositionerElementProps['overflowPadding'];\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?: BlockHandlePositionerElementProps['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?: BlockHandlePositionerElementProps['altBoundary'];\n}\n\nfunction BlockHandlePositionerComponent(props: BlockHandlePositionerProps, forwardedRef: Ref<BlockHandlePositionerElement>) {\n registerBlockHandlePositionerElement();\n\n const elementRef = useRef<BlockHandlePositionerElement>(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: BlockHandlePositionerElement | 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-block-handle-positioner', { ...restProps, ref: mergedRef, suppressHydrationWarning: true });\n}\n\n/**\n * A Preact component that renders an `prosekit-block-handle-positioner` custom element.\n *\n * @public\n */\nexport const BlockHandlePositioner: ForwardRefExoticComponent<BlockHandlePositionerProps & RefAttributes<BlockHandlePositionerElement>> = /* @__PURE__ */ forwardRef(BlockHandlePositionerComponent);\n","/**\n * This file is auto-generated by the \"@aria-ui/cli\" tool. Do not edit this file directly.\n */\n\nimport { registerBlockHandleRootElement, type BlockHandleRootElement, type BlockHandleRootProps as BlockHandleRootElementProps, type BlockHandleRootEvents } from '@prosekit/web/block-handle';\nimport { createElement, type HTMLAttributes, type Ref } from 'preact';\nimport { forwardRef, type ForwardRefExoticComponent, type RefAttributes } from 'preact/compat';\nimport { useCallback, useRef, useLayoutEffect } from 'preact/hooks';\n\nimport { useEditorContext } from '../../contexts/editor-context.ts';\n\n/**\n * Props for the {@link BlockHandleRoot} Preact component.\n *\n * @public\n */\nexport interface BlockHandleRootProps extends HTMLAttributes<BlockHandleRootElement> {\n /**\n * The ProseKit editor instance.\n *\n * @default null\n * @hidden\n */\n editor?: BlockHandleRootElementProps['editor'];\n /** Fired when the hovered block changes. */\n onStateChange?: (event: BlockHandleRootEvents['stateChange']) => void;\n}\n\nfunction BlockHandleRootComponent(props: BlockHandleRootProps, forwardedRef: Ref<BlockHandleRootElement>) {\n registerBlockHandleRootElement();\n\n const elementRef = useRef<BlockHandleRootElement>(null);\n const handlersRef = useRef<Array<((event: Event) => void) | undefined>>([]);\n\n const p0Fallback = useEditorContext();\n\n const { editor: p0, onStateChange: e0, ...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 });\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 ['stateChange'].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: BlockHandleRootElement | 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-block-handle-root', { ...restProps, ref: mergedRef, suppressHydrationWarning: true });\n}\n\n/**\n * A Preact component that renders an `prosekit-block-handle-root` custom element.\n *\n * @public\n */\nexport const BlockHandleRoot: ForwardRefExoticComponent<BlockHandleRootProps & RefAttributes<BlockHandleRootElement>> = /* @__PURE__ */ forwardRef(BlockHandleRootComponent);\n\nexport type { BlockHandleRootEvents };\n"],"mappings":";;;;;;;;;AA0BA,SAAS,wBAAwB,OAA4B,cAA0C;AACrG,gCAA+B;CAE/B,MAAM,aAAa,OAA8B,KAAK;CAEtD,MAAM,aAAa,kBAAkB;CAErC,MAAM,EAAE,QAAQ,IAAI,GAAG,cAAc;AAErC,uBAAsB;EACpB,MAAM,UAAU,WAAW;AAC3B,MAAI,CAAC,QAAS;AACd,SAAO,OAAO,SAAS,EAAE,QAAQ,MAAM,YAAY,CAAC;GACpD;CAEF,MAAM,YAAY,aACf,YAA0C;AACzC,aAAW,UAAU;AACrB,MAAI,OAAO,iBAAiB,WAC1B,cAAa,QAAQ;WACZ,aACT,cAAa,UAAU;IAG3B,CAAC,aAAa,CACf;AAED,QAAO,cAAc,6BAA6B;EAAE,GAAG;EAAW,KAAK;EAAW,0BAA0B;EAAM,CAAC;;;;;;;AAQrH,MAAa,iBAAwH,2BAAW,wBAAwB;;;;;;ACnCxK,SAAS,8BAA8B,OAAkC,cAAgD;AACvH,sCAAqC;CAErC,MAAM,aAAa,OAAoC,KAAK;CAE5D,MAAM,aAAa,kBAAkB;CAErC,MAAM,EAAE,QAAQ,IAAI,GAAG,cAAc;AAErC,uBAA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WACZ,aACT,cAAa,UAAU;IAG3B,CAAC,aAAa,CACf;AAED,QAAO,cAAc,8BAA8B;EAAE,GAAG;EAAW,KAAK;EAAW,0BAA0B;EAAM,CAAC;;;;;;;AAQtH,MAAa,kBAA2H,2BAAW,yBAAyB"}
@@ -1,13 +1,34 @@
1
- import { t as CreateProps } from "./create-props.js";
2
- import { ForwardRefExoticComponent, HTMLAttributes, RefAttributes } from "preact/compat";
3
- import { DropIndicatorElement, DropIndicatorEvents, DropIndicatorProps as DropIndicatorProps$1 } from "@prosekit/web/drop-indicator";
1
+ import { HTMLAttributes } from "preact";
2
+ import { ForwardRefExoticComponent, RefAttributes } from "preact/compat";
3
+ import { DropIndicatorElement, DropIndicatorProps as DropIndicatorProps$1 } from "@prosekit/web/drop-indicator";
4
4
 
5
5
  //#region src/components/drop-indicator/drop-indicator.gen.d.ts
6
6
  /**
7
- * Props for the {@link DropIndicator} component.
7
+ * Props for the {@link DropIndicator} Preact component.
8
+ *
9
+ * @public
8
10
  */
9
- interface DropIndicatorProps extends Partial<CreateProps<DropIndicatorProps$1, DropIndicatorEvents>> {}
10
- declare const DropIndicator: ForwardRefExoticComponent<Partial<DropIndicatorProps> & RefAttributes<DropIndicatorElement> & HTMLAttributes<DropIndicatorElement>>;
11
+ interface DropIndicatorProps extends HTMLAttributes<DropIndicatorElement> {
12
+ /**
13
+ * The ProseKit editor instance.
14
+ *
15
+ * @default null
16
+ * @hidden
17
+ */
18
+ editor?: DropIndicatorProps$1['editor'];
19
+ /**
20
+ * The line width in pixels.
21
+ *
22
+ * @default 2
23
+ */
24
+ width?: DropIndicatorProps$1['width'];
25
+ }
26
+ /**
27
+ * A Preact component that renders an `prosekit-drop-indicator` custom element.
28
+ *
29
+ * @public
30
+ */
31
+ declare const DropIndicator: ForwardRefExoticComponent<DropIndicatorProps & RefAttributes<DropIndicatorElement>>;
11
32
  //#endregion
12
33
  export { DropIndicator, type DropIndicatorProps };
13
34
  //# sourceMappingURL=prosekit-preact-drop-indicator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-preact-drop-indicator.d.ts","names":[],"sources":["../src/components/drop-indicator/drop-indicator.gen.ts"],"mappings":";;;;;;;AAmBA;UAAiB,kBAAA,SAA2B,OAAA,CAAQ,WAAA,CAAY,oBAAA,EAAO,mBAAA;AAAA,cAE1D,aAAA,EAAe,yBAAA,CAC1B,OAAA,CAAQ,kBAAA,IACR,aAAA,CAAc,oBAAA,IACd,cAAA,CAAe,oBAAA"}
1
+ {"version":3,"file":"prosekit-preact-drop-indicator.d.ts","names":[],"sources":["../src/components/drop-indicator/drop-indicator.gen.ts"],"mappings":";;;;;;;;;;UAgBiB,kBAAA,SAA2B,cAAA,CAAe,oBAAA;EAAD;;;;;;EAOxD,MAAA,GAAS,oBAAA;EAMD;;;AAsCV;;EAtCE,KAAA,GAAQ,oBAAA;AAAA;;;;;;cAsCG,aAAA,EAAe,yBAAA,CAA0B,kBAAA,GAAqB,aAAA,CAAc,oBAAA"}
@@ -1,7 +1,42 @@
1
- import { t as createComponent } from "./create-component.js";
2
- import { dropIndicatorEvents, dropIndicatorProps } from "@prosekit/web/drop-indicator";
1
+ import { n as useEditorContext } from "./editor-context.js";
2
+ import { createElement } from "preact";
3
+ import { useCallback, useLayoutEffect, useRef } from "preact/hooks";
4
+ import { forwardRef } from "preact/compat";
5
+ import { registerDropIndicatorElement } from "@prosekit/web/drop-indicator";
3
6
  //#region src/components/drop-indicator/drop-indicator.gen.ts
4
- const DropIndicator = createComponent("prosekit-drop-indicator", "DropIndicator", Object.keys(dropIndicatorProps), Object.keys(dropIndicatorEvents));
7
+ /**
8
+ * This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
9
+ */
10
+ function DropIndicatorComponent(props, forwardedRef) {
11
+ registerDropIndicatorElement();
12
+ const elementRef = useRef(null);
13
+ const p0Fallback = useEditorContext();
14
+ const { editor: p0, width: p1, ...restProps } = props;
15
+ useLayoutEffect(() => {
16
+ const element = elementRef.current;
17
+ if (!element) return;
18
+ Object.assign(element, {
19
+ editor: p0 ?? p0Fallback,
20
+ width: p1
21
+ });
22
+ });
23
+ const mergedRef = useCallback((element) => {
24
+ elementRef.current = element;
25
+ if (typeof forwardedRef === "function") forwardedRef(element);
26
+ else if (forwardedRef) forwardedRef.current = element;
27
+ }, [forwardedRef]);
28
+ return createElement("prosekit-drop-indicator", {
29
+ ...restProps,
30
+ ref: mergedRef,
31
+ suppressHydrationWarning: true
32
+ });
33
+ }
34
+ /**
35
+ * A Preact component that renders an `prosekit-drop-indicator` custom element.
36
+ *
37
+ * @public
38
+ */
39
+ const DropIndicator = /* @__PURE__ */ forwardRef(DropIndicatorComponent);
5
40
  //#endregion
6
41
  export { DropIndicator };
7
42
 
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-preact-drop-indicator.js","names":[],"sources":["../src/components/drop-indicator/drop-indicator.gen.ts"],"sourcesContent":["import {\n type DropIndicatorElement,\n type DropIndicatorProps as Props,\n type DropIndicatorEvents as Events,\n dropIndicatorProps,\n dropIndicatorEvents,\n} from '@prosekit/web/drop-indicator'\nimport type {\n ForwardRefExoticComponent,\n HTMLAttributes,\n RefAttributes,\n} from 'preact/compat'\n\nimport { createComponent } from '../create-component.ts'\nimport type { CreateProps } from '../create-props.ts'\n\n/**\n * Props for the {@link DropIndicator} component.\n */\nexport interface DropIndicatorProps extends Partial<CreateProps<Props, Events>> {}\n\nexport const DropIndicator: ForwardRefExoticComponent<\n Partial<DropIndicatorProps> &\n RefAttributes<DropIndicatorElement> &\n HTMLAttributes<DropIndicatorElement>\n> = createComponent<\n DropIndicatorProps,\n DropIndicatorElement\n>(\n 'prosekit-drop-indicator',\n 'DropIndicator',\n Object.keys(dropIndicatorProps),\n Object.keys(dropIndicatorEvents),\n)\n"],"mappings":";;;AAqBA,MAAa,gBAIT,gBAIF,2BACA,iBACA,OAAO,KAAK,mBAAmB,EAC/B,OAAO,KAAK,oBAAoB,CACjC"}
1
+ {"version":3,"file":"prosekit-preact-drop-indicator.js","names":[],"sources":["../src/components/drop-indicator/drop-indicator.gen.ts"],"sourcesContent":["/**\n * This file is auto-generated by the \"@aria-ui/cli\" tool. Do not edit this file directly.\n */\n\nimport { registerDropIndicatorElement, type DropIndicatorElement, type DropIndicatorProps as DropIndicatorElementProps } from '@prosekit/web/drop-indicator';\nimport { createElement, type HTMLAttributes, type Ref } from 'preact';\nimport { forwardRef, type ForwardRefExoticComponent, type RefAttributes } from 'preact/compat';\nimport { useCallback, useRef, useLayoutEffect } from 'preact/hooks';\n\nimport { useEditorContext } from '../../contexts/editor-context.ts';\n\n/**\n * Props for the {@link DropIndicator} Preact component.\n *\n * @public\n */\nexport interface DropIndicatorProps extends HTMLAttributes<DropIndicatorElement> {\n /**\n * The ProseKit editor instance.\n *\n * @default null\n * @hidden\n */\n editor?: DropIndicatorElementProps['editor'];\n /**\n * The line width in pixels.\n *\n * @default 2\n */\n width?: DropIndicatorElementProps['width'];\n}\n\nfunction DropIndicatorComponent(props: DropIndicatorProps, forwardedRef: Ref<DropIndicatorElement>) {\n registerDropIndicatorElement();\n\n const elementRef = useRef<DropIndicatorElement>(null);\n\n const p0Fallback = useEditorContext();\n\n const { editor: p0, width: p1, ...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, width: p1 });\n });\n\n const mergedRef = useCallback(\n (element: DropIndicatorElement | 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-drop-indicator', { ...restProps, ref: mergedRef, suppressHydrationWarning: true });\n}\n\n/**\n * A Preact component that renders an `prosekit-drop-indicator` custom element.\n *\n * @public\n */\nexport const DropIndicator: ForwardRefExoticComponent<DropIndicatorProps & RefAttributes<DropIndicatorElement>> = /* @__PURE__ */ forwardRef(DropIndicatorComponent);\n"],"mappings":";;;;;;;;;AAgCA,SAAS,uBAAuB,OAA2B,cAAyC;AAClG,+BAA8B;CAE9B,MAAM,aAAa,OAA6B,KAAK;CAErD,MAAM,aAAa,kBAAkB;CAErC,MAAM,EAAE,QAAQ,IAAI,OAAO,IAAI,GAAG,cAAc;AAEhD,uBAAsB;EACpB,MAAM,UAAU,WAAW;AAC3B,MAAI,CAAC,QAAS;AACd,SAAO,OAAO,SAAS;GAAE,QAAQ,MAAM;GAAY,OAAO;GAAI,CAAC;GAC/D;CAEF,MAAM,YAAY,aACf,YAAyC;AACxC,aAAW,UAAU;AACrB,MAAI,OAAO,iBAAiB,WAC1B,cAAa,QAAQ;WACZ,aACT,cAAa,UAAU;IAG3B,CAAC,aAAa,CACf;AAED,QAAO,cAAc,2BAA2B;EAAE,GAAG;EAAW,KAAK;EAAW,0BAA0B;EAAM,CAAC;;;;;;;AAQnH,MAAa,gBAAqH,2BAAW,uBAAuB"}