@v-c/trigger 0.0.14 → 0.0.16
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/index.cjs +4 -18
- package/dist/index.js +2 -16
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -15,9 +15,9 @@ __v_c_portal = require_rolldown_runtime.__toESM(__v_c_portal);
|
|
|
15
15
|
let __v_c_resize_observer = require("@v-c/resize-observer");
|
|
16
16
|
__v_c_resize_observer = require_rolldown_runtime.__toESM(__v_c_resize_observer);
|
|
17
17
|
let __v_c_util = require("@v-c/util");
|
|
18
|
-
let __v_c_util_dist_Dom_findDOMNode = require("@v-c/util/dist/Dom/findDOMNode");
|
|
19
18
|
let __v_c_util_dist_Dom_shadow = require("@v-c/util/dist/Dom/shadow");
|
|
20
19
|
let __v_c_util_dist_props_util = require("@v-c/util/dist/props-util");
|
|
20
|
+
let __v_c_util_dist_vnode = require("@v-c/util/dist/vnode");
|
|
21
21
|
function _isSlot(s) {
|
|
22
22
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, vue.isVNode)(s);
|
|
23
23
|
}
|
|
@@ -48,23 +48,8 @@ function generateTrigger(PortalComponent = __v_c_portal.default) {
|
|
|
48
48
|
const id = (0, vue.useId)();
|
|
49
49
|
const popupEle = (0, vue.shallowRef)(null);
|
|
50
50
|
const externalPopupRef = (0, vue.shallowRef)(null);
|
|
51
|
-
const resolveToElement = (node) => {
|
|
52
|
-
if (!node) return null;
|
|
53
|
-
if ((0, __v_c_util_dist_Dom_findDOMNode.isDOM)(node?.__$el)) return node.__$el;
|
|
54
|
-
if ((0, __v_c_util_dist_Dom_findDOMNode.isDOM)(node)) return node;
|
|
55
|
-
const exposed = node;
|
|
56
|
-
if ((0, __v_c_util_dist_Dom_findDOMNode.isDOM)(exposed?.$el)) return exposed.$el;
|
|
57
|
-
const nativeEl = exposed?.nativeElement;
|
|
58
|
-
if ((0, __v_c_util_dist_Dom_findDOMNode.isDOM)(nativeEl?.value)) return nativeEl.value;
|
|
59
|
-
if ((0, __v_c_util_dist_Dom_findDOMNode.isDOM)(nativeEl)) return nativeEl;
|
|
60
|
-
if (typeof exposed?.getElement === "function") {
|
|
61
|
-
const el = exposed.getElement();
|
|
62
|
-
if ((0, __v_c_util_dist_Dom_findDOMNode.isDOM)(el)) return el;
|
|
63
|
-
}
|
|
64
|
-
return null;
|
|
65
|
-
};
|
|
66
51
|
const setPopupRef = (node) => {
|
|
67
|
-
const element = resolveToElement(node);
|
|
52
|
+
const element = (0, __v_c_util_dist_vnode.resolveToElement)(node);
|
|
68
53
|
externalPopupRef.value = element;
|
|
69
54
|
if (popupEle.value !== element) popupEle.value = element;
|
|
70
55
|
parentContext?.value?.registerSubPopup(id, element ?? null);
|
|
@@ -72,7 +57,7 @@ function generateTrigger(PortalComponent = __v_c_portal.default) {
|
|
|
72
57
|
const targetEle = (0, vue.shallowRef)(null);
|
|
73
58
|
const externalForwardRef = (0, vue.shallowRef)(null);
|
|
74
59
|
const setTargetRef = (node) => {
|
|
75
|
-
const element = resolveToElement(node);
|
|
60
|
+
const element = (0, __v_c_util_dist_vnode.resolveToElement)(node);
|
|
76
61
|
if (element && targetEle.value !== element) {
|
|
77
62
|
targetEle.value = element;
|
|
78
63
|
externalForwardRef.value = element;
|
|
@@ -524,6 +509,7 @@ function generateTrigger(PortalComponent = __v_c_portal.default) {
|
|
|
524
509
|
String,
|
|
525
510
|
Number,
|
|
526
511
|
null,
|
|
512
|
+
Boolean,
|
|
527
513
|
Array,
|
|
528
514
|
Function
|
|
529
515
|
],
|
package/dist/index.js
CHANGED
|
@@ -11,9 +11,9 @@ import { Fragment, computed, createVNode, defineComponent, isVNode, mergeDefault
|
|
|
11
11
|
import Portal from "@v-c/portal";
|
|
12
12
|
import ResizeObserver from "@v-c/resize-observer";
|
|
13
13
|
import { classNames } from "@v-c/util";
|
|
14
|
-
import { isDOM } from "@v-c/util/dist/Dom/findDOMNode";
|
|
15
14
|
import { getShadowRoot } from "@v-c/util/dist/Dom/shadow";
|
|
16
15
|
import { filterEmpty } from "@v-c/util/dist/props-util";
|
|
16
|
+
import { resolveToElement } from "@v-c/util/dist/vnode";
|
|
17
17
|
function _isSlot(s) {
|
|
18
18
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
19
19
|
}
|
|
@@ -44,21 +44,6 @@ function generateTrigger(PortalComponent = Portal) {
|
|
|
44
44
|
const id = useId();
|
|
45
45
|
const popupEle = shallowRef(null);
|
|
46
46
|
const externalPopupRef = shallowRef(null);
|
|
47
|
-
const resolveToElement = (node) => {
|
|
48
|
-
if (!node) return null;
|
|
49
|
-
if (isDOM(node?.__$el)) return node.__$el;
|
|
50
|
-
if (isDOM(node)) return node;
|
|
51
|
-
const exposed = node;
|
|
52
|
-
if (isDOM(exposed?.$el)) return exposed.$el;
|
|
53
|
-
const nativeEl = exposed?.nativeElement;
|
|
54
|
-
if (isDOM(nativeEl?.value)) return nativeEl.value;
|
|
55
|
-
if (isDOM(nativeEl)) return nativeEl;
|
|
56
|
-
if (typeof exposed?.getElement === "function") {
|
|
57
|
-
const el = exposed.getElement();
|
|
58
|
-
if (isDOM(el)) return el;
|
|
59
|
-
}
|
|
60
|
-
return null;
|
|
61
|
-
};
|
|
62
47
|
const setPopupRef = (node) => {
|
|
63
48
|
const element = resolveToElement(node);
|
|
64
49
|
externalPopupRef.value = element;
|
|
@@ -520,6 +505,7 @@ function generateTrigger(PortalComponent = Portal) {
|
|
|
520
505
|
String,
|
|
521
506
|
Number,
|
|
522
507
|
null,
|
|
508
|
+
Boolean,
|
|
523
509
|
Array,
|
|
524
510
|
Function
|
|
525
511
|
],
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v-c/trigger",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.16",
|
|
5
5
|
"description": "",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"vue": "^3.0.0"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@v-c/
|
|
33
|
-
"@v-c/
|
|
34
|
-
"@v-c/util": "0.0.
|
|
32
|
+
"@v-c/portal": "0.0.6",
|
|
33
|
+
"@v-c/resize-observer": "0.0.4",
|
|
34
|
+
"@v-c/util": "0.0.15"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "vite build",
|