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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/dist/prosekit-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
@@ -0,0 +1,201 @@
1
+ /**
2
+ * This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
3
+ */
4
+
5
+ import { registerTableHandleColumnPositionerElement, type TableHandleColumnPositionerElement, type TableHandleColumnPositionerProps as TableHandleColumnPositionerElementProps } from '@prosekit/web/table-handle';
6
+ import { createElement, type HTMLAttributes, type Ref } from 'preact';
7
+ import { forwardRef, type ForwardRefExoticComponent, type RefAttributes } from 'preact/compat';
8
+ import { useCallback, useRef, useLayoutEffect } from 'preact/hooks';
9
+
10
+ import { useEditorContext } from '../../contexts/editor-context.ts';
11
+
12
+ /**
13
+ * Props for the {@link TableHandleColumnPositioner} Preact component.
14
+ *
15
+ * @public
16
+ */
17
+ export interface TableHandleColumnPositionerProps extends HTMLAttributes<TableHandleColumnPositionerElement> {
18
+ /**
19
+ * The placement of the popover, relative to the hovered table cell.
20
+ *
21
+ * @default "top"
22
+ */
23
+ placement?: TableHandleColumnPositionerElementProps['placement'];
24
+ /**
25
+ * The strategy to use for positioning
26
+ *
27
+ * @default "absolute"
28
+ */
29
+ strategy?: TableHandleColumnPositionerElementProps['strategy'];
30
+ /**
31
+ * Options to activate auto-update listeners
32
+ *
33
+ * @see https://floating-ui.com/docs/autoUpdate
34
+ *
35
+ * @default true
36
+ */
37
+ autoUpdate?: TableHandleColumnPositionerElementProps['autoUpdate'];
38
+ /**
39
+ * Whether to use the browser [Popover API](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API)
40
+ * to place the floating element on top of other page content.
41
+ *
42
+ * @default false
43
+ */
44
+ hoist?: TableHandleColumnPositionerElementProps['hoist'];
45
+ /**
46
+ * @default 0
47
+ * @hidden
48
+ */
49
+ offset?: TableHandleColumnPositionerElementProps['offset'];
50
+ /**
51
+ * @default false
52
+ * @hidden
53
+ */
54
+ flip?: TableHandleColumnPositionerElementProps['flip'];
55
+ /**
56
+ * @default false
57
+ * @hidden
58
+ */
59
+ shift?: TableHandleColumnPositionerElementProps['shift'];
60
+ /**
61
+ * Whether the floating element can overlap the reference element to keep it
62
+ * in view.
63
+ *
64
+ * @default false
65
+ */
66
+ overlap?: TableHandleColumnPositionerElementProps['overlap'];
67
+ /**
68
+ * Whether to constrain the floating element's width and height to not exceed
69
+ * the viewport.
70
+ *
71
+ * @default false
72
+ */
73
+ fitViewport?: TableHandleColumnPositionerElementProps['fitViewport'];
74
+ /**
75
+ * Whether to constrain the floating element's width so that it matches the
76
+ * reference element.
77
+ *
78
+ * @default false
79
+ */
80
+ sameWidth?: TableHandleColumnPositionerElementProps['sameWidth'];
81
+ /**
82
+ * Whether to constrain the floating element's height so that it matches the
83
+ * reference element.
84
+ *
85
+ * @default false
86
+ */
87
+ sameHeight?: TableHandleColumnPositionerElementProps['sameHeight'];
88
+ /**
89
+ * Whether to improve positioning for inline reference elements that span over
90
+ * multiple lines.
91
+ *
92
+ * @default false
93
+ */
94
+ inline?: TableHandleColumnPositionerElementProps['inline'];
95
+ /**
96
+ * @default true
97
+ * @hidden
98
+ */
99
+ hide?: TableHandleColumnPositionerElementProps['hide'];
100
+ /**
101
+ * Describes the clipping element(s) or area that overflow will be checked relative to.
102
+ * Please see https://floating-ui.com/docs/detectoverflow#boundary for more information.
103
+ *
104
+ * @default 'clippingAncestors'
105
+ */
106
+ boundary?: TableHandleColumnPositionerElementProps['boundary'];
107
+ /**
108
+ * Describes the root boundary that the element will be checked for overflow relative to.
109
+ * Please see https://floating-ui.com/docs/detectoverflow#rootboundary for more information.
110
+ *
111
+ * @default 'viewport'
112
+ */
113
+ rootBoundary?: TableHandleColumnPositionerElementProps['rootBoundary'];
114
+ /**
115
+ * Describes the virtual padding around the boundary to check for overflow.
116
+ * Please see https://floating-ui.com/docs/detectoverflow#padding for more information.
117
+ *
118
+ * @default 4
119
+ */
120
+ overflowPadding?: TableHandleColumnPositionerElementProps['overflowPadding'];
121
+ /**
122
+ * The element that will be used to check for overflow. Please see
123
+ * https://floating-ui.com/docs/detectoverflow#elementcontext for more
124
+ * information.
125
+ *
126
+ * @default 'floating'
127
+ */
128
+ elementContext?: TableHandleColumnPositionerElementProps['elementContext'];
129
+ /**
130
+ * Whether to check the alternate elementContext's boundary. Please see
131
+ * https://floating-ui.com/docs/detectoverflow#altboundary for more
132
+ * information.
133
+ *
134
+ * @default false
135
+ */
136
+ altBoundary?: TableHandleColumnPositionerElementProps['altBoundary'];
137
+ /**
138
+ * The ProseKit editor instance.
139
+ *
140
+ * @default null
141
+ * @hidden
142
+ */
143
+ editor?: TableHandleColumnPositionerElementProps['editor'];
144
+ }
145
+
146
+ function TableHandleColumnPositionerComponent(props: TableHandleColumnPositionerProps, forwardedRef: Ref<TableHandleColumnPositionerElement>) {
147
+ registerTableHandleColumnPositionerElement();
148
+
149
+ const elementRef = useRef<TableHandleColumnPositionerElement>(null);
150
+
151
+ const p3Fallback = useEditorContext();
152
+
153
+ const { altBoundary: p0, autoUpdate: p1, boundary: p2, editor: p3, elementContext: p4, fitViewport: p5, flip: p6, hide: p7, hoist: p8, inline: p9, offset: p10, overflowPadding: p11, overlap: p12, placement: p13, rootBoundary: p14, sameHeight: p15, sameWidth: p16, shift: p17, strategy: p18, ...restProps } = props;
154
+
155
+ useLayoutEffect(() => {
156
+ const element = elementRef.current as Record<string, unknown> | null;
157
+ if (!element) return;
158
+ Object.assign(element, {
159
+ altBoundary: p0,
160
+ autoUpdate: p1,
161
+ boundary: p2,
162
+ editor: p3 ?? p3Fallback,
163
+ elementContext: p4,
164
+ fitViewport: p5,
165
+ flip: p6,
166
+ hide: p7,
167
+ hoist: p8,
168
+ inline: p9,
169
+ offset: p10,
170
+ overflowPadding: p11,
171
+ overlap: p12,
172
+ placement: p13,
173
+ rootBoundary: p14,
174
+ sameHeight: p15,
175
+ sameWidth: p16,
176
+ shift: p17,
177
+ strategy: p18,
178
+ });
179
+ });
180
+
181
+ const mergedRef = useCallback(
182
+ (element: TableHandleColumnPositionerElement | null) => {
183
+ elementRef.current = element;
184
+ if (typeof forwardedRef === 'function') {
185
+ forwardedRef(element);
186
+ } else if (forwardedRef) {
187
+ forwardedRef.current = element;
188
+ }
189
+ },
190
+ [forwardedRef],
191
+ );
192
+
193
+ return createElement('prosekit-table-handle-column-positioner', { ...restProps, ref: mergedRef, suppressHydrationWarning: true });
194
+ }
195
+
196
+ /**
197
+ * A Preact component that renders an `prosekit-table-handle-column-positioner` custom element.
198
+ *
199
+ * @public
200
+ */
201
+ export const TableHandleColumnPositioner: ForwardRefExoticComponent<TableHandleColumnPositionerProps & RefAttributes<TableHandleColumnPositionerElement>> = /* @__PURE__ */ forwardRef(TableHandleColumnPositionerComponent);
@@ -1,34 +1,60 @@
1
- import {
2
- type TableHandleDragPreviewElement,
3
- type TableHandleDragPreviewProps as Props,
4
- type TableHandleDragPreviewEvents as Events,
5
- tableHandleDragPreviewProps,
6
- tableHandleDragPreviewEvents,
7
- } from '@prosekit/web/table-handle'
8
- import type {
9
- ForwardRefExoticComponent,
10
- HTMLAttributes,
11
- RefAttributes,
12
- } from 'preact/compat'
13
-
14
- import { createComponent } from '../create-component.ts'
15
- import type { CreateProps } from '../create-props.ts'
1
+ /**
2
+ * This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
3
+ */
4
+
5
+ import { registerTableHandleDragPreviewElement, type TableHandleDragPreviewElement, type TableHandleDragPreviewProps as TableHandleDragPreviewElementProps } from '@prosekit/web/table-handle';
6
+ import { createElement, type HTMLAttributes, type Ref } from 'preact';
7
+ import { forwardRef, type ForwardRefExoticComponent, type RefAttributes } from 'preact/compat';
8
+ import { useCallback, useRef, useLayoutEffect } from 'preact/hooks';
9
+
10
+ import { useEditorContext } from '../../contexts/editor-context.ts';
11
+
12
+ /**
13
+ * Props for the {@link TableHandleDragPreview} Preact component.
14
+ *
15
+ * @public
16
+ */
17
+ export interface TableHandleDragPreviewProps extends HTMLAttributes<TableHandleDragPreviewElement> {
18
+ /**
19
+ * @default null
20
+ * @hidden
21
+ */
22
+ editor?: TableHandleDragPreviewElementProps['editor'];
23
+ }
24
+
25
+ function TableHandleDragPreviewComponent(props: TableHandleDragPreviewProps, forwardedRef: Ref<TableHandleDragPreviewElement>) {
26
+ registerTableHandleDragPreviewElement();
27
+
28
+ const elementRef = useRef<TableHandleDragPreviewElement>(null);
29
+
30
+ const p0Fallback = useEditorContext();
31
+
32
+ const { editor: p0, ...restProps } = props;
33
+
34
+ useLayoutEffect(() => {
35
+ const element = elementRef.current as Record<string, unknown> | null;
36
+ if (!element) return;
37
+ Object.assign(element, { editor: p0 ?? p0Fallback });
38
+ });
39
+
40
+ const mergedRef = useCallback(
41
+ (element: TableHandleDragPreviewElement | null) => {
42
+ elementRef.current = element;
43
+ if (typeof forwardedRef === 'function') {
44
+ forwardedRef(element);
45
+ } else if (forwardedRef) {
46
+ forwardedRef.current = element;
47
+ }
48
+ },
49
+ [forwardedRef],
50
+ );
51
+
52
+ return createElement('prosekit-table-handle-drag-preview', { ...restProps, ref: mergedRef, suppressHydrationWarning: true });
53
+ }
16
54
 
17
55
  /**
18
- * Props for the {@link TableHandleDragPreview} component.
56
+ * A Preact component that renders an `prosekit-table-handle-drag-preview` custom element.
57
+ *
58
+ * @public
19
59
  */
20
- export interface TableHandleDragPreviewProps extends Partial<CreateProps<Props, Events>> {}
21
-
22
- export const TableHandleDragPreview: ForwardRefExoticComponent<
23
- Partial<TableHandleDragPreviewProps> &
24
- RefAttributes<TableHandleDragPreviewElement> &
25
- HTMLAttributes<TableHandleDragPreviewElement>
26
- > = createComponent<
27
- TableHandleDragPreviewProps,
28
- TableHandleDragPreviewElement
29
- >(
30
- 'prosekit-table-handle-drag-preview',
31
- 'TableHandleDragPreview',
32
- Object.keys(tableHandleDragPreviewProps),
33
- Object.keys(tableHandleDragPreviewEvents),
34
- )
60
+ export const TableHandleDragPreview: ForwardRefExoticComponent<TableHandleDragPreviewProps & RefAttributes<TableHandleDragPreviewElement>> = /* @__PURE__ */ forwardRef(TableHandleDragPreviewComponent);
@@ -1,34 +1,60 @@
1
- import {
2
- type TableHandleDropIndicatorElement,
3
- type TableHandleDropIndicatorProps as Props,
4
- type TableHandleDropIndicatorEvents as Events,
5
- tableHandleDropIndicatorProps,
6
- tableHandleDropIndicatorEvents,
7
- } from '@prosekit/web/table-handle'
8
- import type {
9
- ForwardRefExoticComponent,
10
- HTMLAttributes,
11
- RefAttributes,
12
- } from 'preact/compat'
13
-
14
- import { createComponent } from '../create-component.ts'
15
- import type { CreateProps } from '../create-props.ts'
1
+ /**
2
+ * This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
3
+ */
4
+
5
+ import { registerTableHandleDropIndicatorElement, type TableHandleDropIndicatorElement, type TableHandleDropIndicatorProps as TableHandleDropIndicatorElementProps } from '@prosekit/web/table-handle';
6
+ import { createElement, type HTMLAttributes, type Ref } from 'preact';
7
+ import { forwardRef, type ForwardRefExoticComponent, type RefAttributes } from 'preact/compat';
8
+ import { useCallback, useRef, useLayoutEffect } from 'preact/hooks';
9
+
10
+ import { useEditorContext } from '../../contexts/editor-context.ts';
11
+
12
+ /**
13
+ * Props for the {@link TableHandleDropIndicator} Preact component.
14
+ *
15
+ * @public
16
+ */
17
+ export interface TableHandleDropIndicatorProps extends HTMLAttributes<TableHandleDropIndicatorElement> {
18
+ /**
19
+ * @default null
20
+ * @hidden
21
+ */
22
+ editor?: TableHandleDropIndicatorElementProps['editor'];
23
+ }
24
+
25
+ function TableHandleDropIndicatorComponent(props: TableHandleDropIndicatorProps, forwardedRef: Ref<TableHandleDropIndicatorElement>) {
26
+ registerTableHandleDropIndicatorElement();
27
+
28
+ const elementRef = useRef<TableHandleDropIndicatorElement>(null);
29
+
30
+ const p0Fallback = useEditorContext();
31
+
32
+ const { editor: p0, ...restProps } = props;
33
+
34
+ useLayoutEffect(() => {
35
+ const element = elementRef.current as Record<string, unknown> | null;
36
+ if (!element) return;
37
+ Object.assign(element, { editor: p0 ?? p0Fallback });
38
+ });
39
+
40
+ const mergedRef = useCallback(
41
+ (element: TableHandleDropIndicatorElement | null) => {
42
+ elementRef.current = element;
43
+ if (typeof forwardedRef === 'function') {
44
+ forwardedRef(element);
45
+ } else if (forwardedRef) {
46
+ forwardedRef.current = element;
47
+ }
48
+ },
49
+ [forwardedRef],
50
+ );
51
+
52
+ return createElement('prosekit-table-handle-drop-indicator', { ...restProps, ref: mergedRef, suppressHydrationWarning: true });
53
+ }
16
54
 
17
55
  /**
18
- * Props for the {@link TableHandleDropIndicator} component.
56
+ * A Preact component that renders an `prosekit-table-handle-drop-indicator` custom element.
57
+ *
58
+ * @public
19
59
  */
20
- export interface TableHandleDropIndicatorProps extends Partial<CreateProps<Props, Events>> {}
21
-
22
- export const TableHandleDropIndicator: ForwardRefExoticComponent<
23
- Partial<TableHandleDropIndicatorProps> &
24
- RefAttributes<TableHandleDropIndicatorElement> &
25
- HTMLAttributes<TableHandleDropIndicatorElement>
26
- > = createComponent<
27
- TableHandleDropIndicatorProps,
28
- TableHandleDropIndicatorElement
29
- >(
30
- 'prosekit-table-handle-drop-indicator',
31
- 'TableHandleDropIndicator',
32
- Object.keys(tableHandleDropIndicatorProps),
33
- Object.keys(tableHandleDropIndicatorEvents),
34
- )
60
+ export const TableHandleDropIndicator: ForwardRefExoticComponent<TableHandleDropIndicatorProps & RefAttributes<TableHandleDropIndicatorElement>> = /* @__PURE__ */ forwardRef(TableHandleDropIndicatorComponent);
@@ -1,34 +1,62 @@
1
- import {
2
- type TableHandleRootElement,
3
- type TableHandleRootProps as Props,
4
- type TableHandleRootEvents as Events,
5
- tableHandleRootProps,
6
- tableHandleRootEvents,
7
- } from '@prosekit/web/table-handle'
8
- import type {
9
- ForwardRefExoticComponent,
10
- HTMLAttributes,
11
- RefAttributes,
12
- } from 'preact/compat'
13
-
14
- import { createComponent } from '../create-component.ts'
15
- import type { CreateProps } from '../create-props.ts'
1
+ /**
2
+ * This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
3
+ */
4
+
5
+ import { registerTableHandleRootElement, type TableHandleRootElement, type TableHandleRootProps as TableHandleRootElementProps } from '@prosekit/web/table-handle';
6
+ import { createElement, type HTMLAttributes, type Ref } from 'preact';
7
+ import { forwardRef, type ForwardRefExoticComponent, type RefAttributes } from 'preact/compat';
8
+ import { useCallback, useRef, useLayoutEffect } from 'preact/hooks';
9
+
10
+ import { useEditorContext } from '../../contexts/editor-context.ts';
11
+
12
+ /**
13
+ * Props for the {@link TableHandleRoot} Preact component.
14
+ *
15
+ * @public
16
+ */
17
+ export interface TableHandleRootProps extends HTMLAttributes<TableHandleRootElement> {
18
+ /**
19
+ * The ProseKit editor instance.
20
+ *
21
+ * @default null
22
+ * @hidden
23
+ */
24
+ editor?: TableHandleRootElementProps['editor'];
25
+ }
26
+
27
+ function TableHandleRootComponent(props: TableHandleRootProps, forwardedRef: Ref<TableHandleRootElement>) {
28
+ registerTableHandleRootElement();
29
+
30
+ const elementRef = useRef<TableHandleRootElement>(null);
31
+
32
+ const p0Fallback = useEditorContext();
33
+
34
+ const { editor: p0, ...restProps } = props;
35
+
36
+ useLayoutEffect(() => {
37
+ const element = elementRef.current as Record<string, unknown> | null;
38
+ if (!element) return;
39
+ Object.assign(element, { editor: p0 ?? p0Fallback });
40
+ });
41
+
42
+ const mergedRef = useCallback(
43
+ (element: TableHandleRootElement | null) => {
44
+ elementRef.current = element;
45
+ if (typeof forwardedRef === 'function') {
46
+ forwardedRef(element);
47
+ } else if (forwardedRef) {
48
+ forwardedRef.current = element;
49
+ }
50
+ },
51
+ [forwardedRef],
52
+ );
53
+
54
+ return createElement('prosekit-table-handle-root', { ...restProps, ref: mergedRef, suppressHydrationWarning: true });
55
+ }
16
56
 
17
57
  /**
18
- * Props for the {@link TableHandleRoot} component.
58
+ * A Preact component that renders an `prosekit-table-handle-root` custom element.
59
+ *
60
+ * @public
19
61
  */
20
- export interface TableHandleRootProps extends Partial<CreateProps<Props, Events>> {}
21
-
22
- export const TableHandleRoot: ForwardRefExoticComponent<
23
- Partial<TableHandleRootProps> &
24
- RefAttributes<TableHandleRootElement> &
25
- HTMLAttributes<TableHandleRootElement>
26
- > = createComponent<
27
- TableHandleRootProps,
28
- TableHandleRootElement
29
- >(
30
- 'prosekit-table-handle-root',
31
- 'TableHandleRoot',
32
- Object.keys(tableHandleRootProps),
33
- Object.keys(tableHandleRootEvents),
34
- )
62
+ export const TableHandleRoot: ForwardRefExoticComponent<TableHandleRootProps & RefAttributes<TableHandleRootElement>> = /* @__PURE__ */ forwardRef(TableHandleRootComponent);
@@ -0,0 +1,66 @@
1
+ /**
2
+ * This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
3
+ */
4
+
5
+ import { registerTableHandleRowMenuRootElement, type TableHandleRowMenuRootElement, type TableHandleRowMenuRootProps as TableHandleRowMenuRootElementProps } from '@prosekit/web/table-handle';
6
+ import { createElement, type HTMLAttributes, type Ref } from 'preact';
7
+ import { forwardRef, type ForwardRefExoticComponent, type RefAttributes } from 'preact/compat';
8
+ import { useCallback, useRef, useLayoutEffect } from 'preact/hooks';
9
+
10
+ /**
11
+ * Props for the {@link TableHandleRowMenuRoot} Preact component.
12
+ *
13
+ * @public
14
+ */
15
+ export interface TableHandleRowMenuRootProps extends HTMLAttributes<TableHandleRowMenuRootElement> {
16
+ /**
17
+ * Whether the overlay is initially open.
18
+ * @default false
19
+ */
20
+ defaultOpen?: TableHandleRowMenuRootElementProps['defaultOpen'];
21
+ /**
22
+ * Whether the overlay is currently open.
23
+ * @default null
24
+ */
25
+ open?: TableHandleRowMenuRootElementProps['open'];
26
+ /**
27
+ * Whether the component should ignore user interaction.
28
+ * @default false
29
+ */
30
+ disabled?: TableHandleRowMenuRootElementProps['disabled'];
31
+ }
32
+
33
+ function TableHandleRowMenuRootComponent(props: TableHandleRowMenuRootProps, forwardedRef: Ref<TableHandleRowMenuRootElement>) {
34
+ registerTableHandleRowMenuRootElement();
35
+
36
+ const elementRef = useRef<TableHandleRowMenuRootElement>(null);
37
+
38
+ const { defaultOpen: p0, disabled: p1, open: p2, ...restProps } = props;
39
+
40
+ useLayoutEffect(() => {
41
+ const element = elementRef.current as Record<string, unknown> | null;
42
+ if (!element) return;
43
+ Object.assign(element, { defaultOpen: p0, disabled: p1, open: p2 });
44
+ });
45
+
46
+ const mergedRef = useCallback(
47
+ (element: TableHandleRowMenuRootElement | null) => {
48
+ elementRef.current = element;
49
+ if (typeof forwardedRef === 'function') {
50
+ forwardedRef(element);
51
+ } else if (forwardedRef) {
52
+ forwardedRef.current = element;
53
+ }
54
+ },
55
+ [forwardedRef],
56
+ );
57
+
58
+ return createElement('prosekit-table-handle-row-menu-root', { ...restProps, ref: mergedRef, suppressHydrationWarning: true });
59
+ }
60
+
61
+ /**
62
+ * A Preact component that renders an `prosekit-table-handle-row-menu-root` custom element.
63
+ *
64
+ * @public
65
+ */
66
+ export const TableHandleRowMenuRoot: ForwardRefExoticComponent<TableHandleRowMenuRootProps & RefAttributes<TableHandleRowMenuRootElement>> = /* @__PURE__ */ forwardRef(TableHandleRowMenuRootComponent);
@@ -0,0 +1,60 @@
1
+ /**
2
+ * This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
3
+ */
4
+
5
+ import { registerTableHandleRowMenuTriggerElement, type TableHandleRowMenuTriggerElement, type TableHandleRowMenuTriggerProps as TableHandleRowMenuTriggerElementProps } from '@prosekit/web/table-handle';
6
+ import { createElement, type HTMLAttributes, type Ref } from 'preact';
7
+ import { forwardRef, type ForwardRefExoticComponent, type RefAttributes } from 'preact/compat';
8
+ import { useCallback, useRef, useLayoutEffect } from 'preact/hooks';
9
+
10
+ import { useEditorContext } from '../../contexts/editor-context.ts';
11
+
12
+ /**
13
+ * Props for the {@link TableHandleRowMenuTrigger} Preact component.
14
+ *
15
+ * @public
16
+ */
17
+ export interface TableHandleRowMenuTriggerProps extends HTMLAttributes<TableHandleRowMenuTriggerElement> {
18
+ /**
19
+ * @default null
20
+ * @hidden
21
+ */
22
+ editor?: TableHandleRowMenuTriggerElementProps['editor'];
23
+ }
24
+
25
+ function TableHandleRowMenuTriggerComponent(props: TableHandleRowMenuTriggerProps, forwardedRef: Ref<TableHandleRowMenuTriggerElement>) {
26
+ registerTableHandleRowMenuTriggerElement();
27
+
28
+ const elementRef = useRef<TableHandleRowMenuTriggerElement>(null);
29
+
30
+ const p0Fallback = useEditorContext();
31
+
32
+ const { editor: p0, ...restProps } = props;
33
+
34
+ useLayoutEffect(() => {
35
+ const element = elementRef.current as Record<string, unknown> | null;
36
+ if (!element) return;
37
+ Object.assign(element, { editor: p0 ?? p0Fallback });
38
+ });
39
+
40
+ const mergedRef = useCallback(
41
+ (element: TableHandleRowMenuTriggerElement | null) => {
42
+ elementRef.current = element;
43
+ if (typeof forwardedRef === 'function') {
44
+ forwardedRef(element);
45
+ } else if (forwardedRef) {
46
+ forwardedRef.current = element;
47
+ }
48
+ },
49
+ [forwardedRef],
50
+ );
51
+
52
+ return createElement('prosekit-table-handle-row-menu-trigger', { ...restProps, ref: mergedRef, suppressHydrationWarning: true });
53
+ }
54
+
55
+ /**
56
+ * A Preact component that renders an `prosekit-table-handle-row-menu-trigger` custom element.
57
+ *
58
+ * @public
59
+ */
60
+ export const TableHandleRowMenuTrigger: ForwardRefExoticComponent<TableHandleRowMenuTriggerProps & RefAttributes<TableHandleRowMenuTriggerElement>> = /* @__PURE__ */ forwardRef(TableHandleRowMenuTriggerComponent);
@@ -0,0 +1,44 @@
1
+ /**
2
+ * This file is auto-generated by the "@aria-ui/cli" tool. Do not edit this file directly.
3
+ */
4
+
5
+ import { registerTableHandleRowPopupElement, type TableHandleRowPopupElement } from '@prosekit/web/table-handle';
6
+ import { createElement, type HTMLAttributes, type Ref } from 'preact';
7
+ import { forwardRef, type ForwardRefExoticComponent, type RefAttributes } from 'preact/compat';
8
+ import { useCallback, useRef } from 'preact/hooks';
9
+
10
+ /**
11
+ * Props for the {@link TableHandleRowPopup} Preact component.
12
+ *
13
+ * @public
14
+ */
15
+ export interface TableHandleRowPopupProps extends HTMLAttributes<TableHandleRowPopupElement> {}
16
+
17
+ function TableHandleRowPopupComponent(props: TableHandleRowPopupProps, forwardedRef: Ref<TableHandleRowPopupElement>) {
18
+ registerTableHandleRowPopupElement();
19
+
20
+ const elementRef = useRef<TableHandleRowPopupElement>(null);
21
+
22
+ const { ...restProps } = props;
23
+
24
+ const mergedRef = useCallback(
25
+ (element: TableHandleRowPopupElement | null) => {
26
+ elementRef.current = element;
27
+ if (typeof forwardedRef === 'function') {
28
+ forwardedRef(element);
29
+ } else if (forwardedRef) {
30
+ forwardedRef.current = element;
31
+ }
32
+ },
33
+ [forwardedRef],
34
+ );
35
+
36
+ return createElement('prosekit-table-handle-row-popup', { ...restProps, ref: mergedRef, suppressHydrationWarning: true });
37
+ }
38
+
39
+ /**
40
+ * A Preact component that renders an `prosekit-table-handle-row-popup` custom element.
41
+ *
42
+ * @public
43
+ */
44
+ export const TableHandleRowPopup: ForwardRefExoticComponent<TableHandleRowPopupProps & RefAttributes<TableHandleRowPopupElement>> = /* @__PURE__ */ forwardRef(TableHandleRowPopupComponent);