@prosekit/lit 0.1.8 → 0.1.9

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.
@@ -478,8 +478,8 @@ export declare class InlinePopoverController implements ReactiveController {
478
478
  private editor?;
479
479
  private cleanupExtension?;
480
480
  private cleanupEventListener?;
481
- private mouseHovering;
482
- constructor(host: ReactiveControllerHost);
481
+ private interacting;
482
+ constructor(host: LitElement);
483
483
  setEditor(editor: Editor): void;
484
484
  hostConnected(): void;
485
485
  hostDisconnected(): void;
@@ -787,6 +787,10 @@ declare class Resizable extends LightElement implements Partial<ResizableProps>
787
787
  reflect: true;
788
788
  };
789
789
  };
790
+ /**
791
+ * @hidden
792
+ */
793
+ constructor();
790
794
  width?: number | string;
791
795
  height?: number | string;
792
796
  aspectRatio?: number;
@@ -806,7 +810,6 @@ declare class Resizable extends LightElement implements Partial<ResizableProps>
806
810
  width: number;
807
811
  height: number;
808
812
  }) => void;
809
- private context;
810
813
  private startWidth;
811
814
  private startHeight;
812
815
  private handleResizeStart;
@@ -10,7 +10,7 @@ import "@prosekit/core";
10
10
 
11
11
  // src/components/inline-popover/controller.ts
12
12
  import { defineUpdateHandler } from "@prosekit/core";
13
- import "lit";
13
+ import { trackDismissableElement } from "@zag-js/dismissable";
14
14
 
15
15
  // src/components/inline-popover/helpers.ts
16
16
  import { isNodeSelection, isTextSelection } from "@prosekit/core";
@@ -47,7 +47,7 @@ function getDomRange() {
47
47
  var InlinePopoverController = class {
48
48
  constructor(host) {
49
49
  this.host = host;
50
- this.mouseHovering = false;
50
+ this.interacting = false;
51
51
  this.host.addController(this);
52
52
  }
53
53
  setEditor(editor) {
@@ -59,19 +59,21 @@ var InlinePopoverController = class {
59
59
  }
60
60
  hostConnected() {
61
61
  var _a;
62
- const handleMouseDown = () => {
63
- this.mouseHovering = true;
62
+ const handlePointerDown = () => {
63
+ this.interacting = true;
64
64
  };
65
- const handleMouseUp = () => {
66
- this.mouseHovering = false;
67
- this.update();
68
- };
69
- document.addEventListener("mousedown", handleMouseDown);
70
- document.addEventListener("mouseup", handleMouseUp);
65
+ this.host.addEventListener("pointerdown", handlePointerDown);
66
+ const cleanupDismissable = trackDismissableElement(this.host, {
67
+ defer: true,
68
+ pointerBlocking: false,
69
+ onDismiss: () => {
70
+ this.interacting = false;
71
+ }
72
+ });
71
73
  (_a = this.cleanupEventListener) == null ? void 0 : _a.call(this);
72
74
  this.cleanupEventListener = () => {
73
- document.removeEventListener("mousedown", handleMouseDown);
74
- document.removeEventListener("mouseup", handleMouseUp);
75
+ this.host.removeEventListener("pointerdown", handlePointerDown);
76
+ cleanupDismissable();
75
77
  };
76
78
  }
77
79
  hostDisconnected() {
@@ -83,7 +85,7 @@ var InlinePopoverController = class {
83
85
  }
84
86
  update() {
85
87
  const editor = this.editor;
86
- if (!editor || this.mouseHovering) {
88
+ if (!editor || this.interacting) {
87
89
  return;
88
90
  }
89
91
  const reference = getVirtualSelectionElement(editor.view);
@@ -17,9 +17,14 @@ var propNames = [
17
17
  "onSizeChangeEnd"
18
18
  ];
19
19
  var Resizable = class extends LightElement {
20
+ /**
21
+ * @hidden
22
+ */
20
23
  constructor() {
21
- super(...arguments);
22
- this.context = new ContextProvider(this, {
24
+ super();
25
+ this.startWidth = 0;
26
+ this.startHeight = 0;
27
+ new ContextProvider(this, {
23
28
  context: resizableContext,
24
29
  initialValue: {
25
30
  onResizeStart: () => this.handleResizeStart(),
@@ -27,8 +32,6 @@ var Resizable = class extends LightElement {
27
32
  onResizeEnd: () => this.handleResizeEnd()
28
33
  }
29
34
  });
30
- this.startWidth = 0;
31
- this.startHeight = 0;
32
35
  }
33
36
  handleResizeStart() {
34
37
  var _a, _b;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prosekit/lit",
3
3
  "type": "module",
4
- "version": "0.1.8",
4
+ "version": "0.1.9",
5
5
  "private": false,
6
6
  "author": {
7
7
  "name": "ocavue",
@@ -97,11 +97,12 @@
97
97
  "dependencies": {
98
98
  "@floating-ui/dom": "^1.5.4",
99
99
  "@lit/context": "^1.1.0",
100
- "@prosekit/core": "^0.2.2",
101
- "@prosekit/extensions": "^0.2.2",
100
+ "@prosekit/core": "^0.2.4",
101
+ "@prosekit/extensions": "^0.2.3",
102
102
  "@prosekit/pm": "^0.1.1",
103
103
  "@superhuman/command-score": "^0.5.0",
104
- "lit": "^3.1.0"
104
+ "@zag-js/dismissable": "^0.32.0",
105
+ "lit": "^3.1.1"
105
106
  },
106
107
  "devDependencies": {
107
108
  "@prosekit/dev": "*",