@zag-js/popper 0.2.2 → 0.2.3
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.
- package/dist/auto-update.js +8 -9
- package/dist/auto-update.mjs +1 -1
- package/dist/{chunk-MDQJEIPL.mjs → chunk-A2YMJLJJ.mjs} +8 -9
- package/dist/{chunk-7DJY6BDG.mjs → chunk-L7FW633C.mjs} +3 -4
- package/dist/get-placement.js +10 -12
- package/dist/get-placement.mjs +2 -2
- package/dist/index.js +10 -12
- package/dist/index.mjs +2 -2
- package/package.json +3 -3
package/dist/auto-update.js
CHANGED
|
@@ -28,11 +28,11 @@ var import_dom = require("@floating-ui/dom");
|
|
|
28
28
|
// ../core/src/functions.ts
|
|
29
29
|
var runIfFn = (v, ...a) => {
|
|
30
30
|
const res = typeof v === "function" ? v(...a) : v;
|
|
31
|
-
return res
|
|
31
|
+
return res ?? void 0;
|
|
32
32
|
};
|
|
33
33
|
var callAll = (...fns) => (...a) => {
|
|
34
34
|
fns.forEach(function(fn) {
|
|
35
|
-
fn
|
|
35
|
+
fn?.(...a);
|
|
36
36
|
});
|
|
37
37
|
};
|
|
38
38
|
|
|
@@ -42,16 +42,16 @@ var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
|
|
|
42
42
|
|
|
43
43
|
// ../dom/src/query.ts
|
|
44
44
|
function isHTMLElement(v) {
|
|
45
|
-
return typeof v === "object" &&
|
|
45
|
+
return typeof v === "object" && v?.nodeType === Node.ELEMENT_NODE && typeof v?.nodeName === "string";
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
// ../dom/src/listener.ts
|
|
49
49
|
var isRef = (v) => hasProp(v, "current");
|
|
50
50
|
function addDomEvent(target, eventName, handler, options) {
|
|
51
51
|
const node = isRef(target) ? target.current : runIfFn(target);
|
|
52
|
-
node
|
|
52
|
+
node?.addEventListener(eventName, handler, options);
|
|
53
53
|
return () => {
|
|
54
|
-
node
|
|
54
|
+
node?.removeEventListener(eventName, handler, options);
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
|
|
@@ -111,12 +111,11 @@ function isEqual(rect1, rect2) {
|
|
|
111
111
|
|
|
112
112
|
// src/auto-update.ts
|
|
113
113
|
function resolveOptions(option) {
|
|
114
|
-
var _a, _b, _c;
|
|
115
114
|
const bool = isBoolean(option);
|
|
116
115
|
return {
|
|
117
|
-
ancestorResize: bool ? option :
|
|
118
|
-
ancestorScroll: bool ? option :
|
|
119
|
-
referenceResize: bool ? option :
|
|
116
|
+
ancestorResize: bool ? option : option.ancestorResize ?? true,
|
|
117
|
+
ancestorScroll: bool ? option : option.ancestorScroll ?? true,
|
|
118
|
+
referenceResize: bool ? option : option.referenceResize ?? true
|
|
120
119
|
};
|
|
121
120
|
}
|
|
122
121
|
function autoUpdate(reference, floating, update, options = false) {
|
package/dist/auto-update.mjs
CHANGED
|
@@ -4,11 +4,11 @@ import { getOverflowAncestors } from "@floating-ui/dom";
|
|
|
4
4
|
// ../core/src/functions.ts
|
|
5
5
|
var runIfFn = (v, ...a) => {
|
|
6
6
|
const res = typeof v === "function" ? v(...a) : v;
|
|
7
|
-
return res
|
|
7
|
+
return res ?? void 0;
|
|
8
8
|
};
|
|
9
9
|
var callAll = (...fns) => (...a) => {
|
|
10
10
|
fns.forEach(function(fn) {
|
|
11
|
-
fn
|
|
11
|
+
fn?.(...a);
|
|
12
12
|
});
|
|
13
13
|
};
|
|
14
14
|
|
|
@@ -18,16 +18,16 @@ var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
|
|
|
18
18
|
|
|
19
19
|
// ../dom/src/query.ts
|
|
20
20
|
function isHTMLElement(v) {
|
|
21
|
-
return typeof v === "object" &&
|
|
21
|
+
return typeof v === "object" && v?.nodeType === Node.ELEMENT_NODE && typeof v?.nodeName === "string";
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
// ../dom/src/listener.ts
|
|
25
25
|
var isRef = (v) => hasProp(v, "current");
|
|
26
26
|
function addDomEvent(target, eventName, handler, options) {
|
|
27
27
|
const node = isRef(target) ? target.current : runIfFn(target);
|
|
28
|
-
node
|
|
28
|
+
node?.addEventListener(eventName, handler, options);
|
|
29
29
|
return () => {
|
|
30
|
-
node
|
|
30
|
+
node?.removeEventListener(eventName, handler, options);
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -87,12 +87,11 @@ function isEqual(rect1, rect2) {
|
|
|
87
87
|
|
|
88
88
|
// src/auto-update.ts
|
|
89
89
|
function resolveOptions(option) {
|
|
90
|
-
var _a, _b, _c;
|
|
91
90
|
const bool = isBoolean(option);
|
|
92
91
|
return {
|
|
93
|
-
ancestorResize: bool ? option :
|
|
94
|
-
ancestorScroll: bool ? option :
|
|
95
|
-
referenceResize: bool ? option :
|
|
92
|
+
ancestorResize: bool ? option : option.ancestorResize ?? true,
|
|
93
|
+
ancestorScroll: bool ? option : option.ancestorScroll ?? true,
|
|
94
|
+
referenceResize: bool ? option : option.referenceResize ?? true
|
|
96
95
|
};
|
|
97
96
|
}
|
|
98
97
|
function autoUpdate(reference, floating, update, options = false) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
autoUpdate,
|
|
3
3
|
callAll
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-A2YMJLJJ.mjs";
|
|
5
5
|
import {
|
|
6
6
|
shiftArrow,
|
|
7
7
|
transformOrigin
|
|
@@ -36,7 +36,7 @@ function getPlacement(reference, floating, opts = {}) {
|
|
|
36
36
|
if (options.gutter || options.offset) {
|
|
37
37
|
const arrowOffset = arrowEl ? arrowEl.offsetHeight / 2 : 0;
|
|
38
38
|
const data = options.gutter ? { mainAxis: options.gutter } : options.offset;
|
|
39
|
-
if (
|
|
39
|
+
if (data?.mainAxis != null)
|
|
40
40
|
data.mainAxis += arrowOffset;
|
|
41
41
|
middleware.push(offset(data));
|
|
42
42
|
}
|
|
@@ -87,7 +87,6 @@ function getPlacement(reference, floating, opts = {}) {
|
|
|
87
87
|
strategy,
|
|
88
88
|
...config
|
|
89
89
|
}).then((data) => {
|
|
90
|
-
var _a;
|
|
91
90
|
const x = Math.round(data.x);
|
|
92
91
|
const y = Math.round(data.y);
|
|
93
92
|
Object.assign(floating.style, {
|
|
@@ -96,7 +95,7 @@ function getPlacement(reference, floating, opts = {}) {
|
|
|
96
95
|
left: "0",
|
|
97
96
|
transform: `translate3d(${x}px, ${y}px, 0)`
|
|
98
97
|
});
|
|
99
|
-
|
|
98
|
+
options.onComplete?.({ ...data, compute });
|
|
100
99
|
});
|
|
101
100
|
}
|
|
102
101
|
compute();
|
package/dist/get-placement.js
CHANGED
|
@@ -29,11 +29,11 @@ var import_dom2 = require("@floating-ui/dom");
|
|
|
29
29
|
// ../core/src/functions.ts
|
|
30
30
|
var runIfFn = (v, ...a) => {
|
|
31
31
|
const res = typeof v === "function" ? v(...a) : v;
|
|
32
|
-
return res
|
|
32
|
+
return res ?? void 0;
|
|
33
33
|
};
|
|
34
34
|
var callAll = (...fns) => (...a) => {
|
|
35
35
|
fns.forEach(function(fn) {
|
|
36
|
-
fn
|
|
36
|
+
fn?.(...a);
|
|
37
37
|
});
|
|
38
38
|
};
|
|
39
39
|
|
|
@@ -46,16 +46,16 @@ var import_dom = require("@floating-ui/dom");
|
|
|
46
46
|
|
|
47
47
|
// ../dom/src/query.ts
|
|
48
48
|
function isHTMLElement(v) {
|
|
49
|
-
return typeof v === "object" &&
|
|
49
|
+
return typeof v === "object" && v?.nodeType === Node.ELEMENT_NODE && typeof v?.nodeName === "string";
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
// ../dom/src/listener.ts
|
|
53
53
|
var isRef = (v) => hasProp(v, "current");
|
|
54
54
|
function addDomEvent(target, eventName, handler, options) {
|
|
55
55
|
const node = isRef(target) ? target.current : runIfFn(target);
|
|
56
|
-
node
|
|
56
|
+
node?.addEventListener(eventName, handler, options);
|
|
57
57
|
return () => {
|
|
58
|
-
node
|
|
58
|
+
node?.removeEventListener(eventName, handler, options);
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
61
|
|
|
@@ -115,12 +115,11 @@ function isEqual(rect1, rect2) {
|
|
|
115
115
|
|
|
116
116
|
// src/auto-update.ts
|
|
117
117
|
function resolveOptions(option) {
|
|
118
|
-
var _a, _b, _c;
|
|
119
118
|
const bool = isBoolean(option);
|
|
120
119
|
return {
|
|
121
|
-
ancestorResize: bool ? option :
|
|
122
|
-
ancestorScroll: bool ? option :
|
|
123
|
-
referenceResize: bool ? option :
|
|
120
|
+
ancestorResize: bool ? option : option.ancestorResize ?? true,
|
|
121
|
+
ancestorScroll: bool ? option : option.ancestorScroll ?? true,
|
|
122
|
+
referenceResize: bool ? option : option.referenceResize ?? true
|
|
124
123
|
};
|
|
125
124
|
}
|
|
126
125
|
function autoUpdate(reference, floating, update, options = false) {
|
|
@@ -224,7 +223,7 @@ function getPlacement(reference, floating, opts = {}) {
|
|
|
224
223
|
if (options.gutter || options.offset) {
|
|
225
224
|
const arrowOffset = arrowEl ? arrowEl.offsetHeight / 2 : 0;
|
|
226
225
|
const data = options.gutter ? { mainAxis: options.gutter } : options.offset;
|
|
227
|
-
if (
|
|
226
|
+
if (data?.mainAxis != null)
|
|
228
227
|
data.mainAxis += arrowOffset;
|
|
229
228
|
middleware.push((0, import_dom2.offset)(data));
|
|
230
229
|
}
|
|
@@ -275,7 +274,6 @@ function getPlacement(reference, floating, opts = {}) {
|
|
|
275
274
|
strategy,
|
|
276
275
|
...config
|
|
277
276
|
}).then((data) => {
|
|
278
|
-
var _a;
|
|
279
277
|
const x = Math.round(data.x);
|
|
280
278
|
const y = Math.round(data.y);
|
|
281
279
|
Object.assign(floating.style, {
|
|
@@ -284,7 +282,7 @@ function getPlacement(reference, floating, opts = {}) {
|
|
|
284
282
|
left: "0",
|
|
285
283
|
transform: `translate3d(${x}px, ${y}px, 0)`
|
|
286
284
|
});
|
|
287
|
-
|
|
285
|
+
options.onComplete?.({ ...data, compute });
|
|
288
286
|
});
|
|
289
287
|
}
|
|
290
288
|
compute();
|
package/dist/get-placement.mjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -32,11 +32,11 @@ var import_dom2 = require("@floating-ui/dom");
|
|
|
32
32
|
// ../core/src/functions.ts
|
|
33
33
|
var runIfFn = (v, ...a) => {
|
|
34
34
|
const res = typeof v === "function" ? v(...a) : v;
|
|
35
|
-
return res
|
|
35
|
+
return res ?? void 0;
|
|
36
36
|
};
|
|
37
37
|
var callAll = (...fns) => (...a) => {
|
|
38
38
|
fns.forEach(function(fn) {
|
|
39
|
-
fn
|
|
39
|
+
fn?.(...a);
|
|
40
40
|
});
|
|
41
41
|
};
|
|
42
42
|
|
|
@@ -49,16 +49,16 @@ var import_dom = require("@floating-ui/dom");
|
|
|
49
49
|
|
|
50
50
|
// ../dom/src/query.ts
|
|
51
51
|
function isHTMLElement(v) {
|
|
52
|
-
return typeof v === "object" &&
|
|
52
|
+
return typeof v === "object" && v?.nodeType === Node.ELEMENT_NODE && typeof v?.nodeName === "string";
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
// ../dom/src/listener.ts
|
|
56
56
|
var isRef = (v) => hasProp(v, "current");
|
|
57
57
|
function addDomEvent(target, eventName, handler, options) {
|
|
58
58
|
const node = isRef(target) ? target.current : runIfFn(target);
|
|
59
|
-
node
|
|
59
|
+
node?.addEventListener(eventName, handler, options);
|
|
60
60
|
return () => {
|
|
61
|
-
node
|
|
61
|
+
node?.removeEventListener(eventName, handler, options);
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
|
|
@@ -118,12 +118,11 @@ function isEqual(rect1, rect2) {
|
|
|
118
118
|
|
|
119
119
|
// src/auto-update.ts
|
|
120
120
|
function resolveOptions(option) {
|
|
121
|
-
var _a, _b, _c;
|
|
122
121
|
const bool = isBoolean(option);
|
|
123
122
|
return {
|
|
124
|
-
ancestorResize: bool ? option :
|
|
125
|
-
ancestorScroll: bool ? option :
|
|
126
|
-
referenceResize: bool ? option :
|
|
123
|
+
ancestorResize: bool ? option : option.ancestorResize ?? true,
|
|
124
|
+
ancestorScroll: bool ? option : option.ancestorScroll ?? true,
|
|
125
|
+
referenceResize: bool ? option : option.referenceResize ?? true
|
|
127
126
|
};
|
|
128
127
|
}
|
|
129
128
|
function autoUpdate(reference, floating, update, options = false) {
|
|
@@ -227,7 +226,7 @@ function getPlacement(reference, floating, opts = {}) {
|
|
|
227
226
|
if (options.gutter || options.offset) {
|
|
228
227
|
const arrowOffset = arrowEl ? arrowEl.offsetHeight / 2 : 0;
|
|
229
228
|
const data = options.gutter ? { mainAxis: options.gutter } : options.offset;
|
|
230
|
-
if (
|
|
229
|
+
if (data?.mainAxis != null)
|
|
231
230
|
data.mainAxis += arrowOffset;
|
|
232
231
|
middleware.push((0, import_dom2.offset)(data));
|
|
233
232
|
}
|
|
@@ -278,7 +277,6 @@ function getPlacement(reference, floating, opts = {}) {
|
|
|
278
277
|
strategy,
|
|
279
278
|
...config
|
|
280
279
|
}).then((data) => {
|
|
281
|
-
var _a;
|
|
282
280
|
const x = Math.round(data.x);
|
|
283
281
|
const y = Math.round(data.y);
|
|
284
282
|
Object.assign(floating.style, {
|
|
@@ -287,7 +285,7 @@ function getPlacement(reference, floating, opts = {}) {
|
|
|
287
285
|
left: "0",
|
|
288
286
|
transform: `translate3d(${x}px, ${y}px, 0)`
|
|
289
287
|
});
|
|
290
|
-
|
|
288
|
+
options.onComplete?.({ ...data, compute });
|
|
291
289
|
});
|
|
292
290
|
}
|
|
293
291
|
compute();
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/popper",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Dynamic positioning logic for ui machines",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"clean-package": "2.2.0",
|
|
29
|
-
"@zag-js/dom-utils": "0.2.
|
|
30
|
-
"@zag-js/utils": "0.3.
|
|
29
|
+
"@zag-js/dom-utils": "0.2.4",
|
|
30
|
+
"@zag-js/utils": "0.3.3"
|
|
31
31
|
},
|
|
32
32
|
"clean-package": "../../../clean-package.config.json",
|
|
33
33
|
"main": "dist/index.js",
|