@prosekit/preact 0.6.8 → 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-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,13 +1,209 @@
1
- import { t as CreateProps } from "./create-props.js";
2
- import { ForwardRefExoticComponent, HTMLAttributes, RefAttributes } from "preact/compat";
3
- import { InlinePopoverElement, InlinePopoverEvents, InlinePopoverProps as InlinePopoverProps$1 } from "@prosekit/web/inline-popover";
1
+ import { HTMLAttributes } from "preact";
2
+ import { ForwardRefExoticComponent, RefAttributes } from "preact/compat";
3
+ import { InlinePopoverPopupElement, InlinePopoverPositionerElement, InlinePopoverPositionerProps as InlinePopoverPositionerProps$1, InlinePopoverRootElement, InlinePopoverRootEvents, InlinePopoverRootProps as InlinePopoverRootProps$1, OpenChangeEvent } from "@prosekit/web/inline-popover";
4
4
 
5
- //#region src/components/inline-popover/inline-popover.gen.d.ts
5
+ //#region src/components/inline-popover/inline-popover-popup.gen.d.ts
6
6
  /**
7
- * Props for the {@link InlinePopover} component.
7
+ * Props for the {@link InlinePopoverPopup} Preact component.
8
+ *
9
+ * @public
8
10
  */
9
- interface InlinePopoverProps extends Partial<CreateProps<InlinePopoverProps$1, InlinePopoverEvents>> {}
10
- declare const InlinePopover: ForwardRefExoticComponent<Partial<InlinePopoverProps> & RefAttributes<InlinePopoverElement> & HTMLAttributes<InlinePopoverElement>>;
11
+ interface InlinePopoverPopupProps extends HTMLAttributes<InlinePopoverPopupElement> {}
12
+ /**
13
+ * A Preact component that renders an `prosekit-inline-popover-popup` custom element.
14
+ *
15
+ * @public
16
+ */
17
+ declare const InlinePopoverPopup: ForwardRefExoticComponent<InlinePopoverPopupProps & RefAttributes<InlinePopoverPopupElement>>;
18
+ //#endregion
19
+ //#region src/components/inline-popover/inline-popover-positioner.gen.d.ts
20
+ /**
21
+ * Props for the {@link InlinePopoverPositioner} Preact component.
22
+ *
23
+ * @public
24
+ */
25
+ interface InlinePopoverPositionerProps extends HTMLAttributes<InlinePopoverPositionerElement> {
26
+ /**
27
+ * The initial placement of the floating element
28
+ *
29
+ * @default "top"
30
+ */
31
+ placement?: InlinePopoverPositionerProps$1['placement'];
32
+ /**
33
+ * The distance between the reference and floating element.
34
+ *
35
+ * @default 12
36
+ */
37
+ offset?: InlinePopoverPositionerProps$1['offset'];
38
+ /**
39
+ * Whether to hide the floating element when the reference element or the
40
+ * floating element is fully clipped.
41
+ *
42
+ * @default true
43
+ */
44
+ hide?: InlinePopoverPositionerProps$1['hide'];
45
+ /**
46
+ * Whether the floating element can overlap the reference element to keep it
47
+ * in view.
48
+ *
49
+ * @default true
50
+ */
51
+ overlap?: InlinePopoverPositionerProps$1['overlap'];
52
+ /**
53
+ * Whether to improve positioning for inline reference elements that span over
54
+ * multiple lines.
55
+ *
56
+ * @default true
57
+ */
58
+ inline?: InlinePopoverPositionerProps$1['inline'];
59
+ /**
60
+ * Describes the virtual padding around the boundary to check for overflow.
61
+ *
62
+ * @default 8
63
+ */
64
+ overflowPadding?: InlinePopoverPositionerProps$1['overflowPadding'];
65
+ /**
66
+ * The strategy to use for positioning
67
+ *
68
+ * @default "absolute"
69
+ */
70
+ strategy?: InlinePopoverPositionerProps$1['strategy'];
71
+ /**
72
+ * Options to activate auto-update listeners
73
+ *
74
+ * @see https://floating-ui.com/docs/autoUpdate
75
+ *
76
+ * @default true
77
+ */
78
+ autoUpdate?: InlinePopoverPositionerProps$1['autoUpdate'];
79
+ /**
80
+ * Whether to use the browser Popover API to place the floating element on
81
+ * top of other page content.
82
+ *
83
+ * @default true
84
+ */
85
+ hoist?: InlinePopoverPositionerProps$1['hoist'];
86
+ /**
87
+ * Whether to flip the `placement` in order to keep it in view when the
88
+ * preferred placement(s) will overflow the clipping boundary. You can also
89
+ * provide an array of placements to try sequentially if the preferred
90
+ * `placement` does not fit.
91
+ *
92
+ * @default true
93
+ */
94
+ flip?: InlinePopoverPositionerProps$1['flip'];
95
+ /**
96
+ * Whether the floating element should shift to keep it in view.
97
+ *
98
+ * @default true
99
+ */
100
+ shift?: InlinePopoverPositionerProps$1['shift'];
101
+ /**
102
+ * Whether to constrain the floating element's width and height to not exceed
103
+ * the viewport.
104
+ *
105
+ * @default false
106
+ */
107
+ fitViewport?: InlinePopoverPositionerProps$1['fitViewport'];
108
+ /**
109
+ * Whether to constrain the floating element's width so that it matches the
110
+ * reference element.
111
+ *
112
+ * @default false
113
+ */
114
+ sameWidth?: InlinePopoverPositionerProps$1['sameWidth'];
115
+ /**
116
+ * Whether to constrain the floating element's height so that it matches the
117
+ * reference element.
118
+ *
119
+ * @default false
120
+ */
121
+ sameHeight?: InlinePopoverPositionerProps$1['sameHeight'];
122
+ /**
123
+ * Describes the clipping element(s) or area that overflow will be checked relative to.
124
+ * Please see https://floating-ui.com/docs/detectoverflow#boundary for more information.
125
+ *
126
+ * @default 'clippingAncestors'
127
+ */
128
+ boundary?: InlinePopoverPositionerProps$1['boundary'];
129
+ /**
130
+ * Describes the root boundary that the element will be checked for overflow relative to.
131
+ * Please see https://floating-ui.com/docs/detectoverflow#rootboundary for more information.
132
+ *
133
+ * @default 'viewport'
134
+ */
135
+ rootBoundary?: InlinePopoverPositionerProps$1['rootBoundary'];
136
+ /**
137
+ * The element that will be used to check for overflow. Please see
138
+ * https://floating-ui.com/docs/detectoverflow#elementcontext for more
139
+ * information.
140
+ *
141
+ * @default 'floating'
142
+ */
143
+ elementContext?: InlinePopoverPositionerProps$1['elementContext'];
144
+ /**
145
+ * Whether to check the alternate elementContext's boundary. Please see
146
+ * https://floating-ui.com/docs/detectoverflow#altboundary for more
147
+ * information.
148
+ *
149
+ * @default false
150
+ */
151
+ altBoundary?: InlinePopoverPositionerProps$1['altBoundary'];
152
+ }
153
+ /**
154
+ * A Preact component that renders an `prosekit-inline-popover-positioner` custom element.
155
+ *
156
+ * @public
157
+ */
158
+ declare const InlinePopoverPositioner: ForwardRefExoticComponent<InlinePopoverPositionerProps & RefAttributes<InlinePopoverPositionerElement>>;
159
+ //#endregion
160
+ //#region src/components/inline-popover/inline-popover-root.gen.d.ts
161
+ /**
162
+ * Props for the {@link InlinePopoverRoot} Preact component.
163
+ *
164
+ * @public
165
+ */
166
+ interface InlinePopoverRootProps extends HTMLAttributes<InlinePopoverRootElement> {
167
+ /**
168
+ * The ProseKit editor instance.
169
+ *
170
+ * @default null
171
+ * @hidden
172
+ */
173
+ editor?: InlinePopoverRootProps$1['editor'];
174
+ /**
175
+ * Whether the popover is open by default when some inline content is
176
+ * selected.
177
+ *
178
+ * @default true
179
+ */
180
+ defaultOpen?: InlinePopoverRootProps$1['defaultOpen'];
181
+ /**
182
+ * Whether the inline popover should be dismissed when the editor receives an
183
+ * Escape key press.
184
+ *
185
+ * @default true
186
+ */
187
+ dismissOnEscape?: InlinePopoverRootProps$1['dismissOnEscape'];
188
+ /**
189
+ * Whether the overlay is currently open.
190
+ * @default null
191
+ */
192
+ open?: InlinePopoverRootProps$1['open'];
193
+ /**
194
+ * Whether the component should ignore user interaction.
195
+ * @default false
196
+ */
197
+ disabled?: InlinePopoverRootProps$1['disabled'];
198
+ /** */
199
+ onOpenChange?: (event: InlinePopoverRootEvents['openChange']) => void;
200
+ }
201
+ /**
202
+ * A Preact component that renders an `prosekit-inline-popover-root` custom element.
203
+ *
204
+ * @public
205
+ */
206
+ declare const InlinePopoverRoot: ForwardRefExoticComponent<InlinePopoverRootProps & RefAttributes<InlinePopoverRootElement>>;
11
207
  //#endregion
12
- export { InlinePopover, type InlinePopoverProps };
208
+ export { InlinePopoverPopup, type InlinePopoverPopupProps, InlinePopoverPositioner, type InlinePopoverPositionerProps, InlinePopoverRoot, type InlinePopoverRootEvents, type InlinePopoverRootProps, OpenChangeEvent };
13
209
  //# sourceMappingURL=prosekit-preact-inline-popover.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-preact-inline-popover.d.ts","names":[],"sources":["../src/components/inline-popover/inline-popover.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-inline-popover.d.ts","names":[],"sources":["../src/components/inline-popover/inline-popover-popup.gen.ts","../src/components/inline-popover/inline-popover-positioner.gen.ts","../src/components/inline-popover/inline-popover-root.gen.ts"],"mappings":";;;;;;;;;AA2CA;UA7BiB,uBAAA,SAAgC,cAAA,CAAe,yBAAA;;;;;;cA6BnD,kBAAA,EAAoB,yBAAA,CAA0B,uBAAA,GAA0B,aAAA,CAAc,yBAAA;;;;;;;AAAnG;UC7BiB,4BAAA,SAAqC,cAAA,CAAe,8BAAA;;;;;;EAMnE,SAAA,GAAY,8BAAA;EDuB4C;;;;;ECjBxD,MAAA,GAAS,8BAAA;EDiBiH;;;;AC7B5H;;EAmBE,IAAA,GAAO,8BAAA;EAnB4D;;;;;;EA0BnE,OAAA,GAAU,8BAAA;EAmBC;;;;;;EAZX,MAAA,GAAS,8BAAA;EA+DI;;;;;EAzDb,eAAA,GAAkB,8BAAA;EAvCgD;;;;;EA6ClE,QAAA,GAAW,8BAAA;EAjCX;;;;;;;EAyCA,UAAA,GAAa,8BAAA;EAdb;;;;;;EAqBA,KAAA,GAAQ,8BAAA;EAAA;;;;;;;;EASR,IAAA,GAAO,8BAAA;EA2BP;;;;;EArBA,KAAA,GAAQ,8BAAA;EA2CR;;;;;;EApCA,WAAA,GAAc,8BAAA;EAgF4L;;;;;;EAzE1M,SAAA,GAAY,8BAAA;EAyEiD;;;;;;EAlE7D,UAAA,GAAa,8BAAA;;;;AC9Ff;;;EDqGE,QAAA,GAAW,8BAAA;EC9FF;;;;;;EDqGT,YAAA,GAAe,8BAAA;EC5G6C;;;;;;;EDoH5D,cAAA,GAAiB,8BAAA;EC/FjB;;;;;;;EDuGA,WAAA,GAAc,8BAAA;AAAA;;;ACnChB;;;cDuEa,uBAAA,EAAyB,yBAAA,CAA0B,4BAAA,GAA+B,aAAA,CAAc,8BAAA;;;;;;;ADrI7G;UE3BiB,sBAAA,SAA+B,cAAA,CAAe,wBAAA;;;;;;;EAO7D,MAAA,GAAS,wBAAA;EFoBsB;;;;;;EEb/B,WAAA,GAAc,wBAAA;;;ADhBhB;;;;ECuBE,eAAA,GAAkB,wBAAA;EDXT;;;;ECgBT,IAAA,GAAO,wBAAA;EDiBI;;;;ECZX,QAAA,GAAW,wBAAA;EDiDG;EC/Cd,YAAA,IAAgB,KAAA,EAAO,uBAAA;AAAA;;;;;;cAwDZ,iBAAA,EAAmB,yBAAA,CAA0B,sBAAA,GAAyB,aAAA,CAAc,wBAAA"}
@@ -1,8 +1,133 @@
1
- import { t as createComponent } from "./create-component.js";
2
- import { inlinePopoverEvents, inlinePopoverProps } from "@prosekit/web/inline-popover";
3
- //#region src/components/inline-popover/inline-popover.gen.ts
4
- const InlinePopover = createComponent("prosekit-inline-popover", "InlinePopover", Object.keys(inlinePopoverProps), Object.keys(inlinePopoverEvents));
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 { OpenChangeEvent, registerInlinePopoverPopupElement, registerInlinePopoverPositionerElement, registerInlinePopoverRootElement } from "@prosekit/web/inline-popover";
6
+ //#region src/components/inline-popover/inline-popover-popup.gen.ts
7
+ /**
8
+ * This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
9
+ */
10
+ function InlinePopoverPopupComponent(props, forwardedRef) {
11
+ registerInlinePopoverPopupElement();
12
+ const elementRef = useRef(null);
13
+ const { ...restProps } = props;
14
+ const mergedRef = useCallback((element) => {
15
+ elementRef.current = element;
16
+ if (typeof forwardedRef === "function") forwardedRef(element);
17
+ else if (forwardedRef) forwardedRef.current = element;
18
+ }, [forwardedRef]);
19
+ return createElement("prosekit-inline-popover-popup", {
20
+ ...restProps,
21
+ ref: mergedRef,
22
+ suppressHydrationWarning: true
23
+ });
24
+ }
25
+ /**
26
+ * A Preact component that renders an `prosekit-inline-popover-popup` custom element.
27
+ *
28
+ * @public
29
+ */
30
+ const InlinePopoverPopup = /* @__PURE__ */ forwardRef(InlinePopoverPopupComponent);
5
31
  //#endregion
6
- export { InlinePopover };
32
+ //#region src/components/inline-popover/inline-popover-positioner.gen.ts
33
+ /**
34
+ * This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
35
+ */
36
+ function InlinePopoverPositionerComponent(props, forwardedRef) {
37
+ registerInlinePopoverPositionerElement();
38
+ const elementRef = useRef(null);
39
+ 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;
40
+ useLayoutEffect(() => {
41
+ const element = elementRef.current;
42
+ if (!element) return;
43
+ Object.assign(element, {
44
+ altBoundary: p0,
45
+ autoUpdate: p1,
46
+ boundary: p2,
47
+ elementContext: p3,
48
+ fitViewport: p4,
49
+ flip: p5,
50
+ hide: p6,
51
+ hoist: p7,
52
+ inline: p8,
53
+ offset: p9,
54
+ overflowPadding: p10,
55
+ overlap: p11,
56
+ placement: p12,
57
+ rootBoundary: p13,
58
+ sameHeight: p14,
59
+ sameWidth: p15,
60
+ shift: p16,
61
+ strategy: p17
62
+ });
63
+ });
64
+ const mergedRef = useCallback((element) => {
65
+ elementRef.current = element;
66
+ if (typeof forwardedRef === "function") forwardedRef(element);
67
+ else if (forwardedRef) forwardedRef.current = element;
68
+ }, [forwardedRef]);
69
+ return createElement("prosekit-inline-popover-positioner", {
70
+ ...restProps,
71
+ ref: mergedRef,
72
+ suppressHydrationWarning: true
73
+ });
74
+ }
75
+ /**
76
+ * A Preact component that renders an `prosekit-inline-popover-positioner` custom element.
77
+ *
78
+ * @public
79
+ */
80
+ const InlinePopoverPositioner = /* @__PURE__ */ forwardRef(InlinePopoverPositionerComponent);
81
+ //#endregion
82
+ //#region src/components/inline-popover/inline-popover-root.gen.ts
83
+ /**
84
+ * This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
85
+ */
86
+ function InlinePopoverRootComponent(props, forwardedRef) {
87
+ registerInlinePopoverRootElement();
88
+ const elementRef = useRef(null);
89
+ const handlersRef = useRef([]);
90
+ const p3Fallback = useEditorContext();
91
+ const { defaultOpen: p0, disabled: p1, dismissOnEscape: p2, editor: p3, open: p4, onOpenChange: e0, ...restProps } = props;
92
+ useLayoutEffect(() => {
93
+ const element = elementRef.current;
94
+ if (!element) return;
95
+ Object.assign(element, {
96
+ defaultOpen: p0,
97
+ disabled: p1,
98
+ dismissOnEscape: p2,
99
+ editor: p3 ?? p3Fallback,
100
+ open: p4
101
+ });
102
+ handlersRef.current = [e0];
103
+ });
104
+ useLayoutEffect(() => {
105
+ const element = elementRef.current;
106
+ if (!element) return;
107
+ const ac = new AbortController();
108
+ for (const [index, eventName] of ["openChange"].entries()) element.addEventListener(eventName, (event) => {
109
+ handlersRef.current[index]?.(event);
110
+ }, { signal: ac.signal });
111
+ return () => ac.abort();
112
+ }, []);
113
+ const mergedRef = useCallback((element) => {
114
+ elementRef.current = element;
115
+ if (typeof forwardedRef === "function") forwardedRef(element);
116
+ else if (forwardedRef) forwardedRef.current = element;
117
+ }, [forwardedRef]);
118
+ return createElement("prosekit-inline-popover-root", {
119
+ ...restProps,
120
+ ref: mergedRef,
121
+ suppressHydrationWarning: true
122
+ });
123
+ }
124
+ /**
125
+ * A Preact component that renders an `prosekit-inline-popover-root` custom element.
126
+ *
127
+ * @public
128
+ */
129
+ const InlinePopoverRoot = /* @__PURE__ */ forwardRef(InlinePopoverRootComponent);
130
+ //#endregion
131
+ export { InlinePopoverPopup, InlinePopoverPositioner, InlinePopoverRoot, OpenChangeEvent };
7
132
 
8
133
  //# sourceMappingURL=prosekit-preact-inline-popover.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-preact-inline-popover.js","names":[],"sources":["../src/components/inline-popover/inline-popover.gen.ts"],"sourcesContent":["import {\n type InlinePopoverElement,\n type InlinePopoverProps as Props,\n type InlinePopoverEvents as Events,\n inlinePopoverProps,\n inlinePopoverEvents,\n} from '@prosekit/web/inline-popover'\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 InlinePopover} component.\n */\nexport interface InlinePopoverProps extends Partial<CreateProps<Props, Events>> {}\n\nexport const InlinePopover: ForwardRefExoticComponent<\n Partial<InlinePopoverProps> &\n RefAttributes<InlinePopoverElement> &\n HTMLAttributes<InlinePopoverElement>\n> = createComponent<\n InlinePopoverProps,\n InlinePopoverElement\n>(\n 'prosekit-inline-popover',\n 'InlinePopover',\n Object.keys(inlinePopoverProps),\n Object.keys(inlinePopoverEvents),\n)\n"],"mappings":";;;AAqBA,MAAa,gBAIT,gBAIF,2BACA,iBACA,OAAO,KAAK,mBAAmB,EAC/B,OAAO,KAAK,oBAAoB,CACjC"}
1
+ {"version":3,"file":"prosekit-preact-inline-popover.js","names":[],"sources":["../src/components/inline-popover/inline-popover-popup.gen.ts","../src/components/inline-popover/inline-popover-positioner.gen.ts","../src/components/inline-popover/inline-popover-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 { registerInlinePopoverPopupElement, type InlinePopoverPopupElement } from '@prosekit/web/inline-popover';\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 InlinePopoverPopup} Preact component.\n *\n * @public\n */\nexport interface InlinePopoverPopupProps extends HTMLAttributes<InlinePopoverPopupElement> {}\n\nfunction InlinePopoverPopupComponent(props: InlinePopoverPopupProps, forwardedRef: Ref<InlinePopoverPopupElement>) {\n registerInlinePopoverPopupElement();\n\n const elementRef = useRef<InlinePopoverPopupElement>(null);\n\n const { ...restProps } = props;\n\n const mergedRef = useCallback(\n (element: InlinePopoverPopupElement | 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-inline-popover-popup', { ...restProps, ref: mergedRef, suppressHydrationWarning: true });\n}\n\n/**\n * A Preact component that renders an `prosekit-inline-popover-popup` custom element.\n *\n * @public\n */\nexport const InlinePopoverPopup: ForwardRefExoticComponent<InlinePopoverPopupProps & RefAttributes<InlinePopoverPopupElement>> = /* @__PURE__ */ forwardRef(InlinePopoverPopupComponent);\n","/**\n * This file is auto-generated by the \"@aria-ui/cli\" tool. Do not edit this file directly.\n */\n\nimport { registerInlinePopoverPositionerElement, type InlinePopoverPositionerElement, type InlinePopoverPositionerProps as InlinePopoverPositionerElementProps } from '@prosekit/web/inline-popover';\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 InlinePopoverPositioner} Preact component.\n *\n * @public\n */\nexport interface InlinePopoverPositionerProps extends HTMLAttributes<InlinePopoverPositionerElement> {\n /**\n * The initial placement of the floating element\n *\n * @default \"top\"\n */\n placement?: InlinePopoverPositionerElementProps['placement'];\n /**\n * The distance between the reference and floating element.\n *\n * @default 12\n */\n offset?: InlinePopoverPositionerElementProps['offset'];\n /**\n * Whether to hide the floating element when the reference element or the\n * floating element is fully clipped.\n *\n * @default true\n */\n hide?: InlinePopoverPositionerElementProps['hide'];\n /**\n * Whether the floating element can overlap the reference element to keep it\n * in view.\n *\n * @default true\n */\n overlap?: InlinePopoverPositionerElementProps['overlap'];\n /**\n * Whether to improve positioning for inline reference elements that span over\n * multiple lines.\n *\n * @default true\n */\n inline?: InlinePopoverPositionerElementProps['inline'];\n /**\n * Describes the virtual padding around the boundary to check for overflow.\n *\n * @default 8\n */\n overflowPadding?: InlinePopoverPositionerElementProps['overflowPadding'];\n /**\n * The strategy to use for positioning\n *\n * @default \"absolute\"\n */\n strategy?: InlinePopoverPositionerElementProps['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?: InlinePopoverPositionerElementProps['autoUpdate'];\n /**\n * Whether to use the browser Popover API to place the floating element on\n * top of other page content.\n *\n * @default true\n */\n hoist?: InlinePopoverPositionerElementProps['hoist'];\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?: InlinePopoverPositionerElementProps['flip'];\n /**\n * Whether the floating element should shift to keep it in view.\n *\n * @default true\n */\n shift?: InlinePopoverPositionerElementProps['shift'];\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?: InlinePopoverPositionerElementProps['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?: InlinePopoverPositionerElementProps['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?: InlinePopoverPositionerElementProps['sameHeight'];\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?: InlinePopoverPositionerElementProps['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?: InlinePopoverPositionerElementProps['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?: InlinePopoverPositionerElementProps['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?: InlinePopoverPositionerElementProps['altBoundary'];\n}\n\nfunction InlinePopoverPositionerComponent(props: InlinePopoverPositionerProps, forwardedRef: Ref<InlinePopoverPositionerElement>) {\n registerInlinePopoverPositionerElement();\n\n const elementRef = useRef<InlinePopoverPositionerElement>(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: InlinePopoverPositionerElement | 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-inline-popover-positioner', { ...restProps, ref: mergedRef, suppressHydrationWarning: true });\n}\n\n/**\n * A Preact component that renders an `prosekit-inline-popover-positioner` custom element.\n *\n * @public\n */\nexport const InlinePopoverPositioner: ForwardRefExoticComponent<InlinePopoverPositionerProps & RefAttributes<InlinePopoverPositionerElement>> = /* @__PURE__ */ forwardRef(InlinePopoverPositionerComponent);\n","/**\n * This file is auto-generated by the \"@aria-ui/cli\" tool. Do not edit this file directly.\n */\n\nimport { registerInlinePopoverRootElement, type InlinePopoverRootElement, type InlinePopoverRootProps as InlinePopoverRootElementProps, type InlinePopoverRootEvents } from '@prosekit/web/inline-popover';\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 InlinePopoverRoot} Preact component.\n *\n * @public\n */\nexport interface InlinePopoverRootProps extends HTMLAttributes<InlinePopoverRootElement> {\n /**\n * The ProseKit editor instance.\n *\n * @default null\n * @hidden\n */\n editor?: InlinePopoverRootElementProps['editor'];\n /**\n * Whether the popover is open by default when some inline content is\n * selected.\n *\n * @default true\n */\n defaultOpen?: InlinePopoverRootElementProps['defaultOpen'];\n /**\n * Whether the inline popover should be dismissed when the editor receives an\n * Escape key press.\n *\n * @default true\n */\n dismissOnEscape?: InlinePopoverRootElementProps['dismissOnEscape'];\n /**\n * Whether the overlay is currently open.\n * @default null\n */\n open?: InlinePopoverRootElementProps['open'];\n /**\n * Whether the component should ignore user interaction.\n * @default false\n */\n disabled?: InlinePopoverRootElementProps['disabled'];\n /** */\n onOpenChange?: (event: InlinePopoverRootEvents['openChange']) => void;\n}\n\nfunction InlinePopoverRootComponent(props: InlinePopoverRootProps, forwardedRef: Ref<InlinePopoverRootElement>) {\n registerInlinePopoverRootElement();\n\n const elementRef = useRef<InlinePopoverRootElement>(null);\n const handlersRef = useRef<Array<((event: Event) => void) | undefined>>([]);\n\n const p3Fallback = useEditorContext();\n\n const { defaultOpen: p0, disabled: p1, dismissOnEscape: p2, editor: p3, open: p4, onOpenChange: e0, ...restProps } = props;\n\n useLayoutEffect(() => {\n const element = elementRef.current as Record<string, unknown> | null;\n if (!element) return;\n Object.assign(element, { defaultOpen: p0, disabled: p1, dismissOnEscape: p2, editor: p3 ?? p3Fallback, open: p4 });\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 ['openChange'].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: InlinePopoverRootElement | 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-inline-popover-root', { ...restProps, ref: mergedRef, suppressHydrationWarning: true });\n}\n\n/**\n * A Preact component that renders an `prosekit-inline-popover-root` custom element.\n *\n * @public\n */\nexport const InlinePopoverRoot: ForwardRefExoticComponent<InlinePopoverRootProps & RefAttributes<InlinePopoverR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