@prosekit/web 0.1.3 → 0.1.4

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.
@@ -27,35 +27,37 @@ import { TooltipRootProps } from '@aria-ui/tooltip';
27
27
  import { UpdateHandler } from '@prosekit/core';
28
28
  import { usePopoverContent } from '@aria-ui/popover';
29
29
  import { usePopoverRoot } from '@aria-ui/popover';
30
+ import { usePopoverTrigger } from '@aria-ui/popover';
30
31
  import { useTooltipContent } from '@aria-ui/tooltip';
31
32
  import { useTooltipRoot } from '@aria-ui/tooltip';
33
+ import { useTooltipTrigger } from '@aria-ui/tooltip';
32
34
  import type { VirtualElement } from '@floating-ui/dom';
33
35
 
34
- declare class AutocompleteEmptyElement extends BaseElement implements AutocompleteEmptyProps {
35
- readonly _s: SignalState<AutocompleteEmptyProps>;
36
- constructor();
37
- }
38
-
39
- declare interface AutocompleteEmptyElement extends AutocompleteEmptyProps {
36
+ declare class AutocompleteEmptyElement extends AutocompleteEmptyElement_base {
40
37
  }
41
38
  export { AutocompleteEmptyElement }
42
39
  export { AutocompleteEmptyElement as AutocompleteEmptyElement_alias_1 }
43
40
 
41
+ declare const AutocompleteEmptyElement_base: {
42
+ new (): BaseElement & AutocompleteEmptyProps;
43
+ prototype: HTMLElement;
44
+ };
45
+
44
46
  declare interface AutocompleteEmptyProps {
45
47
  }
46
48
  export { AutocompleteEmptyProps }
47
49
  export { AutocompleteEmptyProps as AutocompleteEmptyProps_alias_1 }
48
50
 
49
- declare class AutocompleteItemElement extends BaseElement implements AutocompleteItemProps {
50
- readonly _s: SignalState<AutocompleteItemProps>;
51
- constructor();
52
- }
53
-
54
- declare interface AutocompleteItemElement extends AutocompleteItemProps {
51
+ declare class AutocompleteItemElement extends AutocompleteItemElement_base {
55
52
  }
56
53
  export { AutocompleteItemElement }
57
54
  export { AutocompleteItemElement as AutocompleteItemElement_alias_1 }
58
55
 
56
+ declare const AutocompleteItemElement_base: {
57
+ new (): BaseElement & AutocompleteItemProps;
58
+ prototype: HTMLElement;
59
+ };
60
+
59
61
  declare interface AutocompleteItemProps {
60
62
  /**
61
63
  * The value of the item, which will be matched against the query.
@@ -75,32 +77,32 @@ declare interface AutocompleteItemProps {
75
77
  export { AutocompleteItemProps }
76
78
  export { AutocompleteItemProps as AutocompleteItemProps_alias_1 }
77
79
 
78
- declare class AutocompleteListElement extends BaseElement implements AutocompleteListProps {
79
- readonly _s: SignalState<AutocompleteListProps>;
80
- constructor();
81
- }
82
-
83
- declare interface AutocompleteListElement extends AutocompleteListProps {
80
+ declare class AutocompleteListElement extends AutocompleteListElement_base {
84
81
  }
85
82
  export { AutocompleteListElement }
86
83
  export { AutocompleteListElement as AutocompleteListElement_alias_1 }
87
84
 
85
+ declare const AutocompleteListElement_base: {
86
+ new (): BaseElement & AutocompleteListProps;
87
+ prototype: HTMLElement;
88
+ };
89
+
88
90
  declare interface AutocompleteListProps extends Pick<ListboxProps, 'filter'> {
89
91
  editor: Editor | null;
90
92
  }
91
93
  export { AutocompleteListProps }
92
94
  export { AutocompleteListProps as AutocompleteListProps_alias_1 }
93
95
 
94
- declare class AutocompletePopoverElement extends BaseElement implements AutocompletePopoverProps {
95
- readonly _s: SignalState<AutocompletePopoverProps>;
96
- constructor();
97
- }
98
-
99
- declare interface AutocompletePopoverElement extends AutocompletePopoverProps {
96
+ declare class AutocompletePopoverElement extends AutocompletePopoverElement_base {
100
97
  }
101
98
  export { AutocompletePopoverElement }
102
99
  export { AutocompletePopoverElement as AutocompletePopoverElement_alias_1 }
103
100
 
101
+ declare const AutocompletePopoverElement_base: {
102
+ new (): BaseElement & AutocompletePopoverProps;
103
+ prototype: HTMLElement;
104
+ };
105
+
104
106
  declare interface AutocompletePopoverProps extends OverlayPositionerProps {
105
107
  /**
106
108
  * The ProseKit editor instance.
@@ -158,16 +160,16 @@ declare interface AutocompletePopoverProps extends OverlayPositionerProps {
158
160
  export { AutocompletePopoverProps }
159
161
  export { AutocompletePopoverProps as AutocompletePopoverProps_alias_1 }
160
162
 
161
- declare class BlockDragHandleElement extends BaseElement implements BlockDragHandleProps {
162
- readonly _s: SignalState<BlockDragHandleProps>;
163
- constructor();
164
- }
165
-
166
- declare interface BlockDragHandleElement extends BlockDragHandleProps {
163
+ declare class BlockDragHandleElement extends BlockDragHandleElement_base {
167
164
  }
168
165
  export { BlockDragHandleElement }
169
166
  export { BlockDragHandleElement as BlockDragHandleElement_alias_1 }
170
167
 
168
+ declare const BlockDragHandleElement_base: {
169
+ new (): BaseElement & BlockDragHandleProps;
170
+ prototype: HTMLElement;
171
+ };
172
+
171
173
  declare interface BlockDragHandleProps {
172
174
  /**
173
175
  * The ProseKit editor instance.
@@ -193,16 +195,16 @@ export declare interface BlockPopoverContext {
193
195
  */
194
196
  export declare const blockPopoverContext: Context<BlockPopoverContext>;
195
197
 
196
- declare class BlockPopoverElement extends BaseElement implements BlockPopoverProps {
197
- readonly _s: SignalState<BlockPopoverProps>;
198
- constructor();
199
- }
200
-
201
- declare interface BlockPopoverElement extends BlockPopoverProps {
198
+ declare class BlockPopoverElement extends BlockPopoverElement_base {
202
199
  }
203
200
  export { BlockPopoverElement }
204
201
  export { BlockPopoverElement as BlockPopoverElement_alias_1 }
205
202
 
203
+ declare const BlockPopoverElement_base: {
204
+ new (): BaseElement & BlockPopoverProps;
205
+ prototype: HTMLElement;
206
+ };
207
+
206
208
  declare interface BlockPopoverProps extends Omit<OverlayPositionerProps, 'placement' | 'offset'> {
207
209
  /**
208
210
  * The ProseKit editor instance.
@@ -385,24 +387,20 @@ export declare function defineCustomElement(name: string, constructor: CustomEle
385
387
 
386
388
  export declare function defineElementHoverHandler(handler: ElementHoverHandler): Extension< {}>;
387
389
 
388
- export declare function defineProperties(ElementConstructor: new () => {
389
- _s: SignalState<any>;
390
- }, defaultProps: Record<string, any>): void;
391
-
392
390
  export declare type ElementHoverHandler = (reference: VirtualElement | null, element: HTMLElement | null, node: ProseMirrorNode | null, pos: number | null) => void;
393
391
 
394
392
  export declare function getVirtualSelectionElement(view: EditorView): ReferenceElement | null;
395
393
 
396
- declare class InlinePopoverElement extends BaseElement implements InlinePopoverProps {
397
- readonly _s: SignalState<InlinePopoverProps>;
398
- constructor();
399
- }
400
-
401
- declare interface InlinePopoverElement extends InlinePopoverProps {
394
+ declare class InlinePopoverElement extends InlinePopoverElement_base {
402
395
  }
403
396
  export { InlinePopoverElement }
404
397
  export { InlinePopoverElement as InlinePopoverElement_alias_1 }
405
398
 
399
+ declare const InlinePopoverElement_base: {
400
+ new (): BaseElement & InlinePopoverProps;
401
+ prototype: HTMLElement;
402
+ };
403
+
406
404
  declare interface InlinePopoverProps extends Omit<OverlayPositionerProps, 'placement' | 'offset'> {
407
405
  /**
408
406
  * The ProseKit editor instance.
@@ -496,57 +494,57 @@ export declare const onSubmitContext: Context<VoidFunction | null>;
496
494
 
497
495
  export declare const openContext: Context<boolean>;
498
496
 
499
- declare class PopoverContentElement extends BaseElement implements PopoverContentProps {
500
- readonly _s: SignalState<PopoverContentProps>;
501
- constructor();
502
- }
503
-
504
- declare interface PopoverContentElement extends PopoverContentProps {
497
+ declare class PopoverContentElement extends PopoverContentElement_base {
505
498
  }
506
499
  export { PopoverContentElement }
507
500
  export { PopoverContentElement as PopoverContentElement_alias_1 }
508
501
 
502
+ declare const PopoverContentElement_base: {
503
+ new (): BaseElement & PopoverContentProps;
504
+ prototype: HTMLElement;
505
+ };
506
+
509
507
  export { PopoverContentProps }
510
508
  export { PopoverContentProps as PopoverContentProps_alias_1 }
511
509
 
512
- declare class PopoverRootElement extends BaseElement implements PopoverRootProps {
513
- readonly _s: SignalState<PopoverRootProps>;
514
- constructor();
515
- }
516
-
517
- declare interface PopoverRootElement extends PopoverRootProps {
510
+ declare class PopoverRootElement extends PopoverRootElement_base {
518
511
  }
519
512
  export { PopoverRootElement }
520
513
  export { PopoverRootElement as PopoverRootElement_alias_1 }
521
514
 
515
+ declare const PopoverRootElement_base: {
516
+ new (): BaseElement & PopoverRootProps;
517
+ prototype: HTMLElement;
518
+ };
519
+
522
520
  export { PopoverRootProps }
523
521
  export { PopoverRootProps as PopoverRootProps_alias_1 }
524
522
 
525
- declare class PopoverTriggerElement extends BaseElement implements PopoverTriggerProps {
526
- readonly _s: SignalState<PopoverTriggerProps>;
527
- constructor();
528
- }
529
-
530
- declare interface PopoverTriggerElement extends PopoverTriggerProps {
523
+ declare class PopoverTriggerElement extends PopoverTriggerElement_base {
531
524
  }
532
525
  export { PopoverTriggerElement }
533
526
  export { PopoverTriggerElement as PopoverTriggerElement_alias_1 }
534
527
 
528
+ declare const PopoverTriggerElement_base: {
529
+ new (): BaseElement & PopoverTriggerProps;
530
+ prototype: HTMLElement;
531
+ };
532
+
535
533
  export { PopoverTriggerProps }
536
534
  export { PopoverTriggerProps as PopoverTriggerProps_alias_1 }
537
535
 
538
536
  export declare const queryContext: Context<string>;
539
537
 
540
- declare class ResizableHandleElement extends BaseElement implements ResizableHandleProps {
541
- readonly _s: SignalState<ResizableHandleProps>;
542
- constructor();
543
- }
544
-
545
- declare interface ResizableHandleElement extends ResizableHandleProps {
538
+ declare class ResizableHandleElement extends ResizableHandleElement_base {
546
539
  }
547
540
  export { ResizableHandleElement }
548
541
  export { ResizableHandleElement as ResizableHandleElement_alias_1 }
549
542
 
543
+ declare const ResizableHandleElement_base: {
544
+ new (): BaseElement & ResizableHandleProps;
545
+ prototype: HTMLElement;
546
+ };
547
+
550
548
  declare interface ResizableHandleProps {
551
549
  /**
552
550
  * The position of the handle.
@@ -558,16 +556,16 @@ declare interface ResizableHandleProps {
558
556
  export { ResizableHandleProps }
559
557
  export { ResizableHandleProps as ResizableHandleProps_alias_1 }
560
558
 
561
- declare class ResizableRootElement extends BaseElement implements ResizableRootProps {
562
- readonly _s: SignalState<ResizableRootProps>;
563
- constructor();
564
- }
565
-
566
- declare interface ResizableRootElement extends ResizableRootProps {
559
+ declare class ResizableRootElement extends ResizableRootElement_base {
567
560
  }
568
561
  export { ResizableRootElement }
569
562
  export { ResizableRootElement as ResizableRootElement_alias_1 }
570
563
 
564
+ declare const ResizableRootElement_base: {
565
+ new (): BaseElement & ResizableRootProps;
566
+ prototype: HTMLElement;
567
+ };
568
+
571
569
  declare interface ResizableRootProps {
572
570
  width: number | null;
573
571
  height: number | null;
@@ -593,42 +591,42 @@ export { ResizableRootProps as ResizableRootProps_alias_1 }
593
591
  */
594
592
  export declare function throttle<Args extends any[]>(callback: (...args: Args) => void, wait: number): (...args: Args) => void;
595
593
 
596
- declare class TooltipContentElement extends BaseElement implements TooltipContentProps {
597
- readonly _s: SignalState<TooltipContentProps>;
598
- constructor();
599
- }
600
-
601
- declare interface TooltipContentElement extends TooltipContentProps {
594
+ declare class TooltipContentElement extends TooltipContentElement_base {
602
595
  }
603
596
  export { TooltipContentElement }
604
597
  export { TooltipContentElement as TooltipContentElement_alias_1 }
605
598
 
599
+ declare const TooltipContentElement_base: {
600
+ new (): BaseElement & TooltipContentProps;
601
+ prototype: HTMLElement;
602
+ };
603
+
606
604
  export { TooltipContentProps }
607
605
  export { TooltipContentProps as TooltipContentProps_alias_1 }
608
606
 
609
- declare class TooltipRootElement extends BaseElement implements TooltipRootProps {
610
- readonly _s: SignalState<TooltipRootProps>;
611
- constructor();
612
- }
613
-
614
- declare interface TooltipRootElement extends TooltipRootProps {
607
+ declare class TooltipRootElement extends TooltipRootElement_base {
615
608
  }
616
609
  export { TooltipRootElement }
617
610
  export { TooltipRootElement as TooltipRootElement_alias_1 }
618
611
 
612
+ declare const TooltipRootElement_base: {
613
+ new (): BaseElement & TooltipRootProps;
614
+ prototype: HTMLElement;
615
+ };
616
+
619
617
  export { TooltipRootProps }
620
618
  export { TooltipRootProps as TooltipRootProps_alias_1 }
621
619
 
622
- declare class TooltipTriggerElement extends BaseElement implements TooltipTriggerProps {
623
- readonly _s: SignalState<TooltipTriggerProps>;
624
- constructor();
625
- }
626
-
627
- declare interface TooltipTriggerElement extends TooltipTriggerProps {
620
+ declare class TooltipTriggerElement extends TooltipTriggerElement_base {
628
621
  }
629
622
  export { TooltipTriggerElement }
630
623
  export { TooltipTriggerElement as TooltipTriggerElement_alias_1 }
631
624
 
625
+ declare const TooltipTriggerElement_base: {
626
+ new (): BaseElement & TooltipTriggerProps;
627
+ prototype: HTMLElement;
628
+ };
629
+
632
630
  declare interface TooltipTriggerProps {
633
631
  }
634
632
  export { TooltipTriggerProps }
@@ -666,7 +664,7 @@ export { usePopoverContent }
666
664
 
667
665
  export { usePopoverRoot }
668
666
 
669
- export declare function usePopoverTrigger(host: ConnectableElement): {};
667
+ export { usePopoverTrigger }
670
668
 
671
669
  export declare function useResizableHandle(host: ConnectableElement, props?: Partial<ResizableHandleProps>): SignalState<Readonly<ResizableHandleProps>>;
672
670
 
@@ -676,6 +674,6 @@ export { useTooltipContent }
676
674
 
677
675
  export { useTooltipRoot }
678
676
 
679
- export declare function useTooltipTrigger(host: ConnectableElement): {};
677
+ export { useTooltipTrigger }
680
678
 
681
679
  export { }
@@ -0,0 +1,11 @@
1
+ // src/utils/define-custom-element.ts
2
+ function defineCustomElement(name, constructor, options) {
3
+ if (typeof customElements === "undefined") {
4
+ return;
5
+ }
6
+ customElements.define(name, constructor, options);
7
+ }
8
+
9
+ export {
10
+ defineCustomElement
11
+ };
@@ -1,10 +1,9 @@
1
1
  import {
2
- defineCustomElement,
3
- defineProperties
4
- } from "./chunk-LJ7LCZM7.js";
2
+ defineCustomElement
3
+ } from "./chunk-LCDA7GFP.js";
5
4
 
6
5
  // src/components/autocomplete/autocomplete-empty/element.gen.ts
7
- import { BaseElement } from "@aria-ui/core";
6
+ import { ElementMixin } from "@aria-ui/core";
8
7
 
9
8
  // src/components/autocomplete/autocomplete-empty/props.ts
10
9
  var defaultAutocompleteEmptyProps = {};
@@ -17,17 +16,12 @@ function useAutocompleteEmpty(element, _props) {
17
16
  }
18
17
 
19
18
  // src/components/autocomplete/autocomplete-empty/element.gen.ts
20
- var AutocompleteEmptyElement = class extends BaseElement {
21
- constructor() {
22
- super();
23
- this._s = useAutocompleteEmpty(this);
24
- }
19
+ var AutocompleteEmptyElement = class extends ElementMixin(useAutocompleteEmpty, defaultAutocompleteEmptyProps) {
25
20
  };
26
- defineProperties(AutocompleteEmptyElement, defaultAutocompleteEmptyProps);
27
21
  defineCustomElement("prosekit-autocomplete-empty", AutocompleteEmptyElement);
28
22
 
29
23
  // src/components/autocomplete/autocomplete-item/element.gen.ts
30
- import { BaseElement as BaseElement2 } from "@aria-ui/core";
24
+ import { ElementMixin as ElementMixin2 } from "@aria-ui/core";
31
25
 
32
26
  // src/components/autocomplete/autocomplete-item/props.ts
33
27
  var defaultAutocompleteItemProps = {
@@ -70,17 +64,12 @@ function useAutocompleteItem(element, props) {
70
64
  }
71
65
 
72
66
  // src/components/autocomplete/autocomplete-item/element.gen.ts
73
- var AutocompleteItemElement = class extends BaseElement2 {
74
- constructor() {
75
- super();
76
- this._s = useAutocompleteItem(this);
77
- }
67
+ var AutocompleteItemElement = class extends ElementMixin2(useAutocompleteItem, defaultAutocompleteItemProps) {
78
68
  };
79
- defineProperties(AutocompleteItemElement, defaultAutocompleteItemProps);
80
69
  defineCustomElement("prosekit-autocomplete-item", AutocompleteItemElement);
81
70
 
82
71
  // src/components/autocomplete/autocomplete-list/element.gen.ts
83
- import { BaseElement as BaseElement3 } from "@aria-ui/core";
72
+ import { ElementMixin as ElementMixin3 } from "@aria-ui/core";
84
73
 
85
74
  // src/components/autocomplete/autocomplete-list/props.ts
86
75
  import { defaultListboxProps } from "@aria-ui/listbox";
@@ -193,17 +182,12 @@ function useKeyboardHandler(element, open, editor) {
193
182
  }
194
183
 
195
184
  // src/components/autocomplete/autocomplete-list/element.gen.ts
196
- var AutocompleteListElement = class extends BaseElement3 {
197
- constructor() {
198
- super();
199
- this._s = useAutocompleteList(this);
200
- }
185
+ var AutocompleteListElement = class extends ElementMixin3(useAutocompleteList, defaultAutocompleteListProps) {
201
186
  };
202
- defineProperties(AutocompleteListElement, defaultAutocompleteListProps);
203
187
  defineCustomElement("prosekit-autocomplete-list", AutocompleteListElement);
204
188
 
205
189
  // src/components/autocomplete/autocomplete-popover/element.gen.ts
206
- import { BaseElement as BaseElement4 } from "@aria-ui/core";
190
+ import { ElementMixin as ElementMixin4 } from "@aria-ui/core";
207
191
 
208
192
  // src/components/autocomplete/autocomplete-popover/props.ts
209
193
  import { defaultOverlayPositionerProps } from "@aria-ui/overlay";
@@ -370,13 +354,8 @@ function useEscapeKeydown(host, handler) {
370
354
  }
371
355
 
372
356
  // src/components/autocomplete/autocomplete-popover/element.gen.ts
373
- var AutocompletePopoverElement = class extends BaseElement4 {
374
- constructor() {
375
- super();
376
- this._s = useAutocompletePopover(this);
377
- }
357
+ var AutocompletePopoverElement = class extends ElementMixin4(useAutocompletePopover, defaultAutocompletePopoverProps) {
378
358
  };
379
- defineProperties(AutocompletePopoverElement, defaultAutocompletePopoverProps);
380
359
  defineCustomElement("prosekit-autocomplete-popover", AutocompletePopoverElement);
381
360
  export {
382
361
  AutocompleteEmptyElement,
@@ -2,12 +2,11 @@ import {
2
2
  useEditorExtension
3
3
  } from "./chunk-VJEVDINM.js";
4
4
  import {
5
- defineCustomElement,
6
- defineProperties
7
- } from "./chunk-LJ7LCZM7.js";
5
+ defineCustomElement
6
+ } from "./chunk-LCDA7GFP.js";
8
7
 
9
8
  // src/components/block-handle/block-drag-handle/element.gen.ts
10
- import { BaseElement } from "@aria-ui/core";
9
+ import { ElementMixin } from "@aria-ui/core";
11
10
 
12
11
  // src/components/block-handle/block-drag-handle/props.ts
13
12
  var defaultBlockDragHandleProps = Object.freeze({
@@ -76,17 +75,12 @@ function useBlockDragHandle(host, props) {
76
75
  }
77
76
 
78
77
  // src/components/block-handle/block-drag-handle/element.gen.ts
79
- var BlockDragHandleElement = class extends BaseElement {
80
- constructor() {
81
- super();
82
- this._s = useBlockDragHandle(this);
83
- }
78
+ var BlockDragHandleElement = class extends ElementMixin(useBlockDragHandle, defaultBlockDragHandleProps) {
84
79
  };
85
- defineProperties(BlockDragHandleElement, defaultBlockDragHandleProps);
86
80
  defineCustomElement("prosekit-block-drag-handle", BlockDragHandleElement);
87
81
 
88
82
  // src/components/block-handle/block-popover/element.gen.ts
89
- import { BaseElement as BaseElement2 } from "@aria-ui/core";
83
+ import { ElementMixin as ElementMixin2 } from "@aria-ui/core";
90
84
 
91
85
  // src/components/block-handle/block-popover/props.ts
92
86
  import { defaultOverlayPositionerProps } from "@aria-ui/overlay";
@@ -226,13 +220,8 @@ function useHoverExtension(host, editor, handler) {
226
220
  }
227
221
 
228
222
  // src/components/block-handle/block-popover/element.gen.ts
229
- var BlockPopoverElement = class extends BaseElement2 {
230
- constructor() {
231
- super();
232
- this._s = useBlockPopover(this);
233
- }
223
+ var BlockPopoverElement = class extends ElementMixin2(useBlockPopover, defaultBlockPopoverProps) {
234
224
  };
235
- defineProperties(BlockPopoverElement, defaultBlockPopoverProps);
236
225
  defineCustomElement("prosekit-block-popover", BlockPopoverElement);
237
226
  export {
238
227
  BlockDragHandleElement,
@@ -2,12 +2,11 @@ import {
2
2
  useEditorExtension
3
3
  } from "./chunk-VJEVDINM.js";
4
4
  import {
5
- defineCustomElement,
6
- defineProperties
7
- } from "./chunk-LJ7LCZM7.js";
5
+ defineCustomElement
6
+ } from "./chunk-LCDA7GFP.js";
8
7
 
9
8
  // src/components/inline-popover/inline-popover/element.gen.ts
10
- import { BaseElement } from "@aria-ui/core";
9
+ import { ElementMixin } from "@aria-ui/core";
11
10
 
12
11
  // src/components/inline-popover/inline-popover/props.ts
13
12
  import { defaultOverlayPositionerProps } from "@aria-ui/overlay";
@@ -54,7 +53,7 @@ function useEditorUpdateEvent(host, editor, handler) {
54
53
  }
55
54
 
56
55
  // src/components/inline-popover/inline-popover/virtual-selection-element.ts
57
- import { isNodeSelection, isTextSelection } from "@prosekit/core";
56
+ import { isTextSelection } from "@prosekit/core";
58
57
 
59
58
  // src/utils/is-in-code-block.ts
60
59
  function isInCodeBlock(selection) {
@@ -68,7 +67,7 @@ function getVirtualSelectionElement(view) {
68
67
  return null;
69
68
  }
70
69
  const selection = view.state.selection;
71
- if (!selection.empty && !isInCodeBlock(selection) && (isTextSelection(selection) || isNodeSelection(selection))) {
70
+ if (!selection.empty && !isInCodeBlock(selection) && isTextSelection(selection)) {
72
71
  const decoration = getInlineDecoration(view);
73
72
  if (decoration) {
74
73
  return decoration;
@@ -147,13 +146,8 @@ function useInlinePopoverReference(host, editor) {
147
146
  }
148
147
 
149
148
  // src/components/inline-popover/inline-popover/element.gen.ts
150
- var InlinePopoverElement = class extends BaseElement {
151
- constructor() {
152
- super();
153
- this._s = useInlinePopover(this);
154
- }
149
+ var InlinePopoverElement = class extends ElementMixin(useInlinePopover, defaultInlinePopoverProps) {
155
150
  };
156
- defineProperties(InlinePopoverElement, defaultInlinePopoverProps);
157
151
  defineCustomElement("prosekit-inline-popover", InlinePopoverElement);
158
152
  export {
159
153
  InlinePopoverElement,
@@ -1,10 +1,9 @@
1
1
  import {
2
- defineCustomElement,
3
- defineProperties
4
- } from "./chunk-LJ7LCZM7.js";
2
+ defineCustomElement
3
+ } from "./chunk-LCDA7GFP.js";
5
4
 
6
5
  // src/components/popover/popover-content/element.gen.ts
7
- import { BaseElement } from "@aria-ui/core";
6
+ import { ElementMixin } from "@aria-ui/core";
8
7
 
9
8
  // src/components/popover/popover-content/props.ts
10
9
  import {
@@ -15,17 +14,12 @@ import {
15
14
  import { usePopoverContent } from "@aria-ui/popover";
16
15
 
17
16
  // src/components/popover/popover-content/element.gen.ts
18
- var PopoverContentElement = class extends BaseElement {
19
- constructor() {
20
- super();
21
- this._s = usePopoverContent(this);
22
- }
17
+ var PopoverContentElement = class extends ElementMixin(usePopoverContent, defaultPopoverContentProps) {
23
18
  };
24
- defineProperties(PopoverContentElement, defaultPopoverContentProps);
25
19
  defineCustomElement("prosekit-popover-content", PopoverContentElement);
26
20
 
27
21
  // src/components/popover/popover-root/element.gen.ts
28
- import { BaseElement as BaseElement2 } from "@aria-ui/core";
22
+ import { ElementMixin as ElementMixin2 } from "@aria-ui/core";
29
23
 
30
24
  // src/components/popover/popover-root/props.ts
31
25
  import {
@@ -36,17 +30,12 @@ import {
36
30
  import { usePopoverRoot } from "@aria-ui/popover";
37
31
 
38
32
  // src/components/popover/popover-root/element.gen.ts
39
- var PopoverRootElement = class extends BaseElement2 {
40
- constructor() {
41
- super();
42
- this._s = usePopoverRoot(this);
43
- }
33
+ var PopoverRootElement = class extends ElementMixin2(usePopoverRoot, defaultPopoverRootProps) {
44
34
  };
45
- defineProperties(PopoverRootElement, defaultPopoverRootProps);
46
35
  defineCustomElement("prosekit-popover-root", PopoverRootElement);
47
36
 
48
37
  // src/components/popover/popover-trigger/element.gen.ts
49
- import { BaseElement as BaseElement3 } from "@aria-ui/core";
38
+ import { ElementMixin as ElementMixin3 } from "@aria-ui/core";
50
39
 
51
40
  // src/components/popover/popover-trigger/props.ts
52
41
  import {
@@ -54,20 +43,11 @@ import {
54
43
  } from "@aria-ui/popover";
55
44
 
56
45
  // src/components/popover/popover-trigger/state.ts
57
- import { usePopoverTrigger as _usePopoverTrigger } from "@aria-ui/popover";
58
- function usePopoverTrigger(host) {
59
- _usePopoverTrigger(host);
60
- return {};
61
- }
46
+ import { usePopoverTrigger } from "@aria-ui/popover";
62
47
 
63
48
  // src/components/popover/popover-trigger/element.gen.ts
64
- var PopoverTriggerElement = class extends BaseElement3 {
65
- constructor() {
66
- super();
67
- this._s = usePopoverTrigger(this);
68
- }
49
+ var PopoverTriggerElement = class extends ElementMixin3(usePopoverTrigger, defaultPopoverTriggerProps) {
69
50
  };
70
- defineProperties(PopoverTriggerElement, defaultPopoverTriggerProps);
71
51
  defineCustomElement("prosekit-popover-trigger", PopoverTriggerElement);
72
52
  export {
73
53
  PopoverContentElement,
@@ -1,10 +1,9 @@
1
1
  import {
2
- defineCustomElement,
3
- defineProperties
4
- } from "./chunk-LJ7LCZM7.js";
2
+ defineCustomElement
3
+ } from "./chunk-LCDA7GFP.js";
5
4
 
6
5
  // src/components/resizable/resizable-handle/element.gen.ts
7
- import { BaseElement } from "@aria-ui/core";
6
+ import { ElementMixin } from "@aria-ui/core";
8
7
 
9
8
  // src/components/resizable/resizable-handle/props.ts
10
9
  var defaultResizableHandleProps = {
@@ -188,17 +187,12 @@ function useResizableHandleState(host, state, context) {
188
187
  }
189
188
 
190
189
  // src/components/resizable/resizable-handle/element.gen.ts
191
- var ResizableHandleElement = class extends BaseElement {
192
- constructor() {
193
- super();
194
- this._s = useResizableHandle(this);
195
- }
190
+ var ResizableHandleElement = class extends ElementMixin(useResizableHandle, defaultResizableHandleProps) {
196
191
  };
197
- defineProperties(ResizableHandleElement, defaultResizableHandleProps);
198
192
  defineCustomElement("prosekit-resizable-handle", ResizableHandleElement);
199
193
 
200
194
  // src/components/resizable/resizable-root/element.gen.ts
201
- import { BaseElement as BaseElement2 } from "@aria-ui/core";
195
+ import { ElementMixin as ElementMixin2 } from "@aria-ui/core";
202
196
 
203
197
  // src/components/resizable/resizable-root/props.ts
204
198
  var defaultResizableRootProps = {
@@ -270,13 +264,8 @@ function updateResizableRootStyles(host, width, height, aspectRatio) {
270
264
  }
271
265
 
272
266
  // src/components/resizable/resizable-root/element.gen.ts
273
- var ResizableRootElement = class extends BaseElement2 {
274
- constructor() {
275
- super();
276
- this._s = useResizableRoot(this);
277
- }
267
+ var ResizableRootElement = class extends ElementMixin2(useResizableRoot, defaultResizableRootProps) {
278
268
  };
279
- defineProperties(ResizableRootElement, defaultResizableRootProps);
280
269
  defineCustomElement("prosekit-resizable-root", ResizableRootElement);
281
270
  export {
282
271
  ResizableHandleElement,
@@ -1,10 +1,9 @@
1
1
  import {
2
- defineCustomElement,
3
- defineProperties
4
- } from "./chunk-LJ7LCZM7.js";
2
+ defineCustomElement
3
+ } from "./chunk-LCDA7GFP.js";
5
4
 
6
5
  // src/components/tooltip/tooltip-content/element.gen.ts
7
- import { BaseElement } from "@aria-ui/core";
6
+ import { ElementMixin } from "@aria-ui/core";
8
7
 
9
8
  // src/components/tooltip/tooltip-content/props.ts
10
9
  import { defaultTooltipContentProps } from "@aria-ui/tooltip";
@@ -13,17 +12,12 @@ import { defaultTooltipContentProps } from "@aria-ui/tooltip";
13
12
  import { useTooltipContent } from "@aria-ui/tooltip";
14
13
 
15
14
  // src/components/tooltip/tooltip-content/element.gen.ts
16
- var TooltipContentElement = class extends BaseElement {
17
- constructor() {
18
- super();
19
- this._s = useTooltipContent(this);
20
- }
15
+ var TooltipContentElement = class extends ElementMixin(useTooltipContent, defaultTooltipContentProps) {
21
16
  };
22
- defineProperties(TooltipContentElement, defaultTooltipContentProps);
23
17
  defineCustomElement("prosekit-tooltip-content", TooltipContentElement);
24
18
 
25
19
  // src/components/tooltip/tooltip-root/element.gen.ts
26
- import { BaseElement as BaseElement2 } from "@aria-ui/core";
20
+ import { ElementMixin as ElementMixin2 } from "@aria-ui/core";
27
21
 
28
22
  // src/components/tooltip/tooltip-root/props.ts
29
23
  import { defaultTooltipRootProps } from "@aria-ui/tooltip";
@@ -32,36 +26,22 @@ import { defaultTooltipRootProps } from "@aria-ui/tooltip";
32
26
  import { useTooltipRoot } from "@aria-ui/tooltip";
33
27
 
34
28
  // src/components/tooltip/tooltip-root/element.gen.ts
35
- var TooltipRootElement = class extends BaseElement2 {
36
- constructor() {
37
- super();
38
- this._s = useTooltipRoot(this);
39
- }
29
+ var TooltipRootElement = class extends ElementMixin2(useTooltipRoot, defaultTooltipRootProps) {
40
30
  };
41
- defineProperties(TooltipRootElement, defaultTooltipRootProps);
42
31
  defineCustomElement("prosekit-tooltip-root", TooltipRootElement);
43
32
 
44
33
  // src/components/tooltip/tooltip-trigger/element.gen.ts
45
- import { BaseElement as BaseElement3 } from "@aria-ui/core";
34
+ import { ElementMixin as ElementMixin3 } from "@aria-ui/core";
46
35
 
47
36
  // src/components/tooltip/tooltip-trigger/props.ts
48
37
  var defaultTooltipTriggerProps = {};
49
38
 
50
39
  // src/components/tooltip/tooltip-trigger/state.ts
51
- import { useTooltipTrigger as _useTooltipTrigger } from "@aria-ui/tooltip";
52
- function useTooltipTrigger(host) {
53
- _useTooltipTrigger(host);
54
- return {};
55
- }
40
+ import { useTooltipTrigger } from "@aria-ui/tooltip";
56
41
 
57
42
  // src/components/tooltip/tooltip-trigger/element.gen.ts
58
- var TooltipTriggerElement = class extends BaseElement3 {
59
- constructor() {
60
- super();
61
- this._s = useTooltipTrigger(this);
62
- }
43
+ var TooltipTriggerElement = class extends ElementMixin3(useTooltipTrigger, defaultTooltipTriggerProps) {
63
44
  };
64
- defineProperties(TooltipTriggerElement, defaultTooltipTriggerProps);
65
45
  defineCustomElement("prosekit-tooltip-trigger", TooltipTriggerElement);
66
46
  export {
67
47
  TooltipContentElement,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prosekit/web",
3
3
  "type": "module",
4
- "version": "0.1.3",
4
+ "version": "0.1.4",
5
5
  "private": false,
6
6
  "author": {
7
7
  "name": "ocavue",
@@ -66,23 +66,23 @@
66
66
  ],
67
67
  "dependencies": {
68
68
  "@aria-ui/collection": "^0.0.3",
69
- "@aria-ui/core": "^0.0.12",
70
- "@aria-ui/listbox": "^0.0.11",
71
- "@aria-ui/overlay": "^0.0.12",
72
- "@aria-ui/popover": "^0.0.11",
73
- "@aria-ui/presence": "^0.0.7",
74
- "@aria-ui/tooltip": "^0.0.13",
75
- "@floating-ui/dom": "^1.6.3",
76
- "@prosekit/core": "^0.4.0",
77
- "@prosekit/extensions": "^0.4.6",
78
- "@prosekit/pm": "^0.1.2",
79
- "@zag-js/dom-query": "^0.48.0"
69
+ "@aria-ui/core": "^0.0.13",
70
+ "@aria-ui/listbox": "^0.0.12",
71
+ "@aria-ui/overlay": "^0.0.13",
72
+ "@aria-ui/popover": "^0.0.12",
73
+ "@aria-ui/presence": "^0.0.8",
74
+ "@aria-ui/tooltip": "^0.0.14",
75
+ "@floating-ui/dom": "^1.6.4",
76
+ "@prosekit/core": "^0.4.2",
77
+ "@prosekit/extensions": "^0.4.7",
78
+ "@prosekit/pm": "^0.1.3",
79
+ "@zag-js/dom-query": "^0.49.0"
80
80
  },
81
81
  "devDependencies": {
82
82
  "@prosekit/dev": "*",
83
83
  "tsup": "^8.0.2",
84
84
  "typescript": "^5.4.5",
85
- "vitest": "^1.5.2"
85
+ "vitest": "^1.6.0"
86
86
  },
87
87
  "scripts": {
88
88
  "build:tsup": "tsup",
@@ -1,26 +0,0 @@
1
- // src/utils/define-custom-element.ts
2
- function defineCustomElement(name, constructor, options) {
3
- if (typeof customElements === "undefined") {
4
- return;
5
- }
6
- customElements.define(name, constructor, options);
7
- }
8
-
9
- // src/utils/define-properties.ts
10
- function defineProperties(ElementConstructor, defaultProps) {
11
- for (const prop of Object.keys(defaultProps)) {
12
- Object.defineProperty(ElementConstructor.prototype, prop, {
13
- get() {
14
- return this._s[prop].value;
15
- },
16
- set(v) {
17
- this._s[prop].value = v;
18
- }
19
- });
20
- }
21
- }
22
-
23
- export {
24
- defineCustomElement,
25
- defineProperties
26
- };