@destyler/interact-outside 0.0.7-beta.9 → 0.2.0-beta.5

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.
@@ -77,17 +77,15 @@ function isEventWithinScrollbar(event, ancestor) {
77
77
  const onScrollbarY = isScrollableY && event.clientX > ancestor.offsetLeft + ancestor.clientWidth;
78
78
  const isScrollableX = ancestor.scrollWidth > ancestor.clientWidth;
79
79
  const onScrollbarX = isScrollableX && event.clientY > ancestor.offsetTop + ancestor.clientHeight;
80
- const rect = {
80
+ if (!isPointInRect({
81
81
  x: ancestor.offsetLeft,
82
82
  y: ancestor.offsetTop,
83
83
  width: ancestor.clientWidth + (isScrollableY ? 16 : 0),
84
84
  height: ancestor.clientHeight + (isScrollableX ? 16 : 0)
85
- };
86
- const point = {
85
+ }, {
87
86
  x: event.clientX,
88
87
  y: event.clientY
89
- };
90
- if (!isPointInRect(rect, point)) return false;
88
+ })) return false;
91
89
  return onScrollbarY || onScrollbarX;
92
90
  }
93
91
  function trackInteractOutsideImpl(node, options) {
@@ -105,11 +103,9 @@ function trackInteractOutsideImpl(node, options) {
105
103
  if (isEventPointWithin(node, event)) return false;
106
104
  const triggerEl = doc.querySelector(`[aria-controls="${node.id}"]`);
107
105
  if (triggerEl) {
108
- const triggerAncestor = getNearestOverflowAncestor(triggerEl);
109
- if (isEventWithinScrollbar(event, triggerAncestor)) return false;
106
+ if (isEventWithinScrollbar(event, getNearestOverflowAncestor(triggerEl))) return false;
110
107
  }
111
- const nodeAncestor = getNearestOverflowAncestor(node);
112
- if (isEventWithinScrollbar(event, nodeAncestor)) return false;
108
+ if (isEventWithinScrollbar(event, getNearestOverflowAncestor(node))) return false;
113
109
  return !exclude?.(target);
114
110
  }
115
111
  const pointerdownCleanups = /* @__PURE__ */ new Set();
@@ -148,8 +144,7 @@ function trackInteractOutsideImpl(node, options) {
148
144
  cleanups.add(frames.addEventListener("pointerdown", onPointerDown, true));
149
145
  }, 0);
150
146
  function onFocusin(event) {
151
- const func = defer ? raf : (v) => v();
152
- func(() => {
147
+ (defer ? raf : (v) => v())(() => {
153
148
  if (!node || !isEventOutside(event)) return;
154
149
  if (onFocusOutside || onInteractOutside) {
155
150
  const handler = callAll(onFocusOutside, onInteractOutside);
@@ -188,8 +183,7 @@ function trackInteractOutside(nodeOrFn, options) {
188
183
  };
189
184
  }
190
185
  function fireCustomEvent(el, type, init) {
191
- const win = el.ownerDocument.defaultView || window;
192
- const event = new win.CustomEvent(type, init);
186
+ const event = new (el.ownerDocument.defaultView || window).CustomEvent(type, init);
193
187
  return el.dispatchEvent(event);
194
188
  }
195
189
 
package/package.json CHANGED
@@ -1,23 +1,32 @@
1
1
  {
2
2
  "name": "@destyler/interact-outside",
3
3
  "type": "module",
4
- "version": "0.0.7-beta.9",
4
+ "version": "0.2.0-beta.5",
5
5
  "description": "",
6
6
  "author": "Elone Hoo <elonehoo@gmail.com>",
7
7
  "license": "MIT",
8
+ "homepage": "https://github.com/destyler/destyler",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/destyler/destyler.git",
12
+ "directory": "packages/shareds/interact-outside"
13
+ },
8
14
  "exports": {
9
- ".": "./dist/index.js"
15
+ ".": "./dist/index.mjs"
10
16
  },
11
- "main": "dist/index.js",
12
- "module": "dist/index.js",
13
- "types": "dist/index.d.ts",
17
+ "main": "dist/index.mjs",
18
+ "module": "dist/index.mjs",
19
+ "types": "dist/index.d.mts",
14
20
  "files": [
15
21
  "*.d.ts",
16
22
  "dist"
17
23
  ],
18
24
  "dependencies": {
19
- "@destyler/dom": "0.0.7-beta.9",
20
- "@destyler/utils": "0.0.7-beta.9"
25
+ "@destyler/dom": "0.2.0-beta.5",
26
+ "@destyler/utils": "0.2.0-beta.5"
27
+ },
28
+ "publishConfig": {
29
+ "access": "public"
21
30
  },
22
31
  "scripts": {
23
32
  "clear": "rimraf ./dist",
File without changes