@v-c/util 0.0.2 → 0.0.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/Children/isFragment.d.ts +0 -1
- package/dist/Children/toArray.d.ts +0 -1
- package/dist/Dom/addEventListener.cjs +1 -1
- package/dist/Dom/addEventListener.d.ts +2 -2
- package/dist/Dom/addEventListener.js +5 -6
- package/dist/Dom/dynamicCSS.cjs +1 -1
- package/dist/Dom/dynamicCSS.d.ts +1 -1
- package/dist/Dom/dynamicCSS.js +33 -34
- package/dist/Dom/findDOMNode.d.ts +0 -1
- package/dist/Dom/scrollLocker.cjs +1 -1
- package/dist/Dom/scrollLocker.js +59 -76
- package/dist/Dom/shadow.cjs +1 -1
- package/dist/Dom/shadow.js +8 -9
- package/dist/Portal.cjs +1 -1
- package/dist/Portal.js +14 -21
- package/dist/PortalWrapper.cjs +1 -1
- package/dist/PortalWrapper.d.ts +2 -3
- package/dist/PortalWrapper.js +39 -42
- package/dist/composeProps.cjs +1 -1
- package/dist/composeProps.js +8 -11
- package/dist/createRef.d.ts +0 -1
- package/dist/debug/diff.d.ts +1 -1
- package/dist/getScrollBarSize.cjs +1 -1
- package/dist/getScrollBarSize.js +14 -14
- package/dist/hooks/useEvent.cjs +1 -0
- package/dist/hooks/useEvent.d.ts +1 -0
- package/dist/hooks/useEvent.js +6 -0
- package/dist/hooks/useId.cjs +1 -1
- package/dist/hooks/useId.d.ts +1 -5
- package/dist/hooks/useId.js +8 -13
- package/dist/hooks/useLayoutEffect.cjs +1 -0
- package/dist/hooks/useLayoutEffect.d.ts +3 -0
- package/dist/hooks/useLayoutEffect.js +28 -0
- package/dist/hooks/useMemo.d.ts +0 -1
- package/dist/hooks/useMergedState.cjs +1 -1
- package/dist/hooks/useMergedState.d.ts +0 -1
- package/dist/hooks/useMergedState.js +16 -16
- package/dist/hooks/useMobile.cjs +1 -0
- package/dist/hooks/useMobile.d.ts +2 -0
- package/dist/hooks/useMobile.js +14 -0
- package/dist/hooks/useState.d.ts +0 -1
- package/dist/isMobile.cjs +1 -1
- package/dist/isMobile.js +4 -4
- package/dist/isValid.cjs +1 -0
- package/dist/isValid.d.ts +2 -0
- package/dist/isValid.js +6 -0
- package/dist/pickAttrs.cjs +1 -1
- package/dist/pickAttrs.js +1 -1
- package/dist/props-util/index.cjs +1 -1
- package/dist/props-util/index.d.ts +6 -1
- package/dist/props-util/index.js +21 -9
- package/dist/props-util/initDefaultProps.cjs +1 -0
- package/dist/props-util/initDefaultProps.d.ts +8 -0
- package/dist/props-util/initDefaultProps.js +13 -0
- package/dist/setStyle.d.ts +0 -1
- package/dist/type.d.ts +2 -3
- package/dist/utils/checkSlotProp.cjs +1 -1
- package/dist/utils/checkSlotProp.js +3 -4
- package/dist/utils/omit.cjs +1 -0
- package/dist/utils/omit.d.ts +1 -0
- package/dist/utils/omit.js +9 -0
- package/dist/utils/set.cjs +1 -1
- package/dist/utils/set.d.ts +1 -0
- package/dist/utils/set.js +1 -0
- package/dist/utils/transition.cjs +1 -0
- package/dist/utils/transition.d.ts +18 -0
- package/dist/utils/transition.js +79 -0
- package/dist/vnode.cjs +1 -1
- package/dist/vnode.d.ts +1 -2
- package/dist/vnode.js +14 -15
- package/dist/vueuse/unref-element.cjs +1 -0
- package/dist/vueuse/unref-element.d.ts +8 -0
- package/dist/vueuse/unref-element.js +8 -0
- package/package.json +1 -1
- package/src/Children/tests/isFragment.test.tsx +1 -1
- package/src/Children/tests/toArray.test.tsx +3 -3
- package/src/Dom/addEventListener.ts +2 -2
- package/src/Dom/focus.ts +1 -1
- package/src/Dom/scrollLocker.ts +5 -4
- package/src/KeyCode.ts +2 -1
- package/src/Portal.tsx +1 -1
- package/src/PortalWrapper.tsx +9 -6
- package/src/createRef.ts +0 -1
- package/src/hooks/useEvent.ts +3 -0
- package/src/hooks/useId.ts +13 -24
- package/src/hooks/useLayoutEffect.ts +61 -0
- package/src/hooks/useMobile.ts +16 -0
- package/src/isMobile.ts +1 -1
- package/src/isValid.ts +4 -0
- package/src/pickAttrs.ts +3 -2
- package/src/props-util/index.ts +57 -22
- package/src/props-util/initDefaultProps.ts +34 -0
- package/src/test/domHook.ts +1 -2
- package/src/type.ts +2 -2
- package/src/utils/omit.ts +9 -0
- package/src/utils/set.ts +1 -1
- package/src/utils/transition.ts +128 -0
- package/src/vnode.ts +2 -2
- package/src/vueuse/unref-element.ts +13 -0
- package/tsconfig.json +3 -2
- package/vite.config.ts +1 -1
- package/vitest.config.ts +11 -0
- package/tests/{Portal.test.tsx → Portal.spec.tsx} +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function d(...i){const[e,t,n,r]=i;return e?.addEventListener&&e.addEventListener(t,n,r),{remove(){e?.removeEventListener?.(t,n,r)}}}exports.addEventListener=d;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export type WindowEventName = keyof WindowEventMap;
|
|
2
2
|
export type DocumentEventName = keyof DocumentEventMap;
|
|
3
3
|
export declare function addEventListener<E extends WindowEventName = WindowEventName>(target: Window, eventType: E, cb: WindowEventMap[E], option?: AddEventListenerOptions): {
|
|
4
|
-
remove()
|
|
4
|
+
remove: () => void;
|
|
5
5
|
};
|
|
6
6
|
export declare function addEventListener<E extends DocumentEventName = DocumentEventName>(target: Document, eventType: E, cb: DocumentEventMap[E], option?: AddEventListenerOptions): {
|
|
7
|
-
remove()
|
|
7
|
+
remove: () => void;
|
|
8
8
|
};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
function
|
|
2
|
-
const [e,
|
|
3
|
-
return e
|
|
1
|
+
function o(...i) {
|
|
2
|
+
const [e, t, n, r] = i;
|
|
3
|
+
return e?.addEventListener && e.addEventListener(t, n, r), {
|
|
4
4
|
remove() {
|
|
5
|
-
|
|
6
|
-
(v = e == null ? void 0 : e.removeEventListener) == null || v.call(e, n, i, o);
|
|
5
|
+
e?.removeEventListener?.(t, n, r);
|
|
7
6
|
}
|
|
8
7
|
};
|
|
9
8
|
}
|
|
10
9
|
export {
|
|
11
|
-
|
|
10
|
+
o as addEventListener
|
|
12
11
|
};
|
package/dist/Dom/dynamicCSS.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("./canUseDom.cjs"),N=require("./contains.cjs"),h="data-vc-order",C="data-vc-priority",v="vc-util-key",
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("./canUseDom.cjs"),N=require("./contains.cjs"),h="data-vc-order",C="data-vc-priority",v="vc-util-key",a=new Map;function p({mark:e}={}){return e?e.startsWith("data-")?e:`data-${e}`:v}function s(e){return e.attachTo?e.attachTo:document.querySelector("head")||document.body}function P(e){return e==="queue"?"prependQueue":e?"prepend":"append"}function g(e){return Array.from((a.get(e)||e).children).filter(n=>n.tagName==="STYLE")}function f(e,n={}){if(!A.default())return null;const{csp:t,prepend:c,priority:r=0}=n,o=P(c),l=o==="prependQueue",i=document.createElement("style");i.setAttribute(h,o),l&&r&&i.setAttribute(C,`${r}`),t?.nonce&&(i.nonce=t?.nonce),i.innerHTML=e;const u=s(n),{firstChild:m}=u;if(c){if(l){const d=g(u).filter(S=>{if(!["prepend","prependQueue"].includes(S.getAttribute(h)))return!1;const b=Number(S.getAttribute(C)||0);return r>=b});if(d.length)return u.insertBefore(i,d[d.length-1].nextSibling),i}u.insertBefore(i,m)}else u.appendChild(i);return i}function y(e,n={}){const t=s(n);return g(t).find(c=>c.getAttribute(p(n))===e)}function T(e,n={}){const t=y(e,n);t&&s(n).removeChild(t)}function E(e,n){const t=a.get(e);if(!t||!N.default(document,t)){const c=f("",n),{parentNode:r}=c;a.set(e,r),e.removeChild(c)}}function M(){a.clear()}function R(e,n,t={}){const c=s(t);E(c,t);const r=y(n,t);if(r)return t.csp?.nonce&&r.nonce!==t.csp?.nonce&&(r.nonce=t.csp?.nonce),r.innerHTML!==e&&(r.innerHTML=e),r;const o=f(e,t);return o.setAttribute(p(t),n),o}exports.clearContainerCache=M;exports.injectCSS=f;exports.removeCSS=T;exports.updateCSS=R;
|
package/dist/Dom/dynamicCSS.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ interface Options {
|
|
|
14
14
|
priority?: number;
|
|
15
15
|
mark?: string;
|
|
16
16
|
}
|
|
17
|
-
export declare function injectCSS(css: string, option?: Options): HTMLStyleElement
|
|
17
|
+
export declare function injectCSS(css: string, option?: Options): HTMLStyleElement;
|
|
18
18
|
export declare function removeCSS(key: string, option?: Options): void;
|
|
19
19
|
/**
|
|
20
20
|
* manually clear container cache to avoid global cache in unit testes
|
package/dist/Dom/dynamicCSS.js
CHANGED
|
@@ -1,74 +1,73 @@
|
|
|
1
1
|
import N from "./canUseDom.js";
|
|
2
2
|
import b from "./contains.js";
|
|
3
|
-
const h = "data-vc-order",
|
|
4
|
-
function
|
|
3
|
+
const h = "data-vc-order", p = "data-vc-priority", E = "vc-util-key", s = /* @__PURE__ */ new Map();
|
|
4
|
+
function m({ mark: e } = {}) {
|
|
5
5
|
return e ? e.startsWith("data-") ? e : `data-${e}` : E;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function d(e) {
|
|
8
8
|
return e.attachTo ? e.attachTo : document.querySelector("head") || document.body;
|
|
9
9
|
}
|
|
10
10
|
function P(e) {
|
|
11
11
|
return e === "queue" ? "prependQueue" : e ? "prepend" : "append";
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function g(e) {
|
|
14
14
|
return Array.from(
|
|
15
|
-
(
|
|
15
|
+
(s.get(e) || e).children
|
|
16
16
|
).filter((n) => n.tagName === "STYLE");
|
|
17
17
|
}
|
|
18
18
|
function C(e, n = {}) {
|
|
19
19
|
if (!N())
|
|
20
20
|
return null;
|
|
21
|
-
const { csp: t, prepend:
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
if (
|
|
25
|
-
if (
|
|
26
|
-
const
|
|
21
|
+
const { csp: t, prepend: c, priority: r = 0 } = n, o = P(c), f = o === "prependQueue", i = document.createElement("style");
|
|
22
|
+
i.setAttribute(h, o), f && r && i.setAttribute(p, `${r}`), t?.nonce && (i.nonce = t?.nonce), i.innerHTML = e;
|
|
23
|
+
const u = d(n), { firstChild: S } = u;
|
|
24
|
+
if (c) {
|
|
25
|
+
if (f) {
|
|
26
|
+
const a = g(u).filter((l) => {
|
|
27
27
|
if (!["prepend", "prependQueue"].includes(l.getAttribute(h)))
|
|
28
28
|
return !1;
|
|
29
|
-
const A = Number(l.getAttribute(
|
|
29
|
+
const A = Number(l.getAttribute(p) || 0);
|
|
30
30
|
return r >= A;
|
|
31
31
|
});
|
|
32
|
-
if (
|
|
33
|
-
return
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
),
|
|
32
|
+
if (a.length)
|
|
33
|
+
return u.insertBefore(
|
|
34
|
+
i,
|
|
35
|
+
a[a.length - 1].nextSibling
|
|
36
|
+
), i;
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
u.insertBefore(i, S);
|
|
39
39
|
} else
|
|
40
|
-
|
|
41
|
-
return
|
|
40
|
+
u.appendChild(i);
|
|
41
|
+
return i;
|
|
42
42
|
}
|
|
43
43
|
function y(e, n = {}) {
|
|
44
|
-
const t =
|
|
45
|
-
return
|
|
46
|
-
(
|
|
44
|
+
const t = d(n);
|
|
45
|
+
return g(t).find(
|
|
46
|
+
(c) => c.getAttribute(m(n)) === e
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
49
|
function x(e, n = {}) {
|
|
50
50
|
const t = y(e, n);
|
|
51
|
-
t &&
|
|
51
|
+
t && d(n).removeChild(t);
|
|
52
52
|
}
|
|
53
53
|
function R(e, n) {
|
|
54
|
-
const t =
|
|
54
|
+
const t = s.get(e);
|
|
55
55
|
if (!t || !b(document, t)) {
|
|
56
|
-
const
|
|
57
|
-
|
|
56
|
+
const c = C("", n), { parentNode: r } = c;
|
|
57
|
+
s.set(e, r), e.removeChild(c);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
function M() {
|
|
61
|
-
|
|
61
|
+
s.clear();
|
|
62
62
|
}
|
|
63
63
|
function D(e, n, t = {}) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
R(i, t);
|
|
64
|
+
const c = d(t);
|
|
65
|
+
R(c, t);
|
|
67
66
|
const r = y(n, t);
|
|
68
67
|
if (r)
|
|
69
|
-
return
|
|
70
|
-
const
|
|
71
|
-
return
|
|
68
|
+
return t.csp?.nonce && r.nonce !== t.csp?.nonce && (r.nonce = t.csp?.nonce), r.innerHTML !== e && (r.innerHTML = e), r;
|
|
69
|
+
const o = C(e, t);
|
|
70
|
+
return o.setAttribute(m(t), n), o;
|
|
72
71
|
}
|
|
73
72
|
export {
|
|
74
73
|
M as clearContainerCache,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("../getScrollBarSize.cjs"),l=require("../setStyle.cjs");let d=0,o=[];const r="ant-scrolling-effect",s=new RegExp(`${r}`,"g"),c=new Map;class f{lockTarget;options;constructor(n){this.lockTarget=d++,this.options=n}getContainer=()=>this.options?.container;reLock=n=>{const t=o.find(({target:i})=>i===this.lockTarget);t&&this.unLock(),this.options=n,t&&(t.options=n,this.lock())};lock=()=>{if(o.some(({target:e})=>e===this.lockTarget))return;if(o.some(({options:e})=>e?.container===this.options?.container)){o=[...o,{target:this.lockTarget,options:this.options}];return}let n=0;const t=this.options?.container||document.body;(t===document.body&&window.innerWidth-document.documentElement.clientWidth>0||t.scrollHeight>t.clientHeight)&&getComputedStyle(t).overflow!=="hidden"&&(n=a.default());const i=t.className;if(o.filter(({options:e})=>e?.container===this.options?.container).length===0&&c.set(t,l.default({width:n!==0?`calc(100% - ${n}px)`:void 0,overflow:"hidden",overflowX:"hidden",overflowY:"hidden"},{element:t})),!s.test(i)){const e=`${i} ${r}`;t.className=e.trim()}o=[...o,{target:this.lockTarget,options:this.options}]};unLock=()=>{const n=o.find(({target:e})=>e===this.lockTarget);if(o=o.filter(({target:e})=>e!==this.lockTarget),!n||o.some(({options:e})=>e?.container===n.options?.container))return;const t=this.options?.container||document.body,i=t.className;s.test(i)&&(l.default(c.get(t),{element:t}),c.delete(t),t.className=t.className.replace(s,"").trim())}}exports.default=f;
|
package/dist/Dom/scrollLocker.js
CHANGED
|
@@ -1,81 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
let u = 0, n = [];
|
|
7
|
-
const h = "ant-scrolling-effect", a = new RegExp(
|
|
8
|
-
`${h}`,
|
|
1
|
+
import a from "../getScrollBarSize.js";
|
|
2
|
+
import r from "../setStyle.js";
|
|
3
|
+
let d = 0, o = [];
|
|
4
|
+
const l = "ant-scrolling-effect", s = new RegExp(
|
|
5
|
+
`${l}`,
|
|
9
6
|
"g"
|
|
10
|
-
),
|
|
11
|
-
class
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var e;
|
|
17
|
-
return (e = this.options) == null ? void 0 : e.container;
|
|
18
|
-
});
|
|
19
|
-
// if options change...
|
|
20
|
-
c(this, "reLock", (e) => {
|
|
21
|
-
const t = n.find(({ target: r }) => r === this.lockTarget);
|
|
22
|
-
t && this.unLock(), this.options = e, t && (t.options = e, this.lock());
|
|
23
|
-
});
|
|
24
|
-
c(this, "lock", () => {
|
|
25
|
-
var l;
|
|
26
|
-
if (n.some(({ target: o }) => o === this.lockTarget))
|
|
27
|
-
return;
|
|
28
|
-
if (n.some(
|
|
29
|
-
({ options: o }) => {
|
|
30
|
-
var i;
|
|
31
|
-
return (o == null ? void 0 : o.container) === ((i = this.options) == null ? void 0 : i.container);
|
|
32
|
-
}
|
|
33
|
-
)) {
|
|
34
|
-
n = [...n, { target: this.lockTarget, options: this.options }];
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
let e = 0;
|
|
38
|
-
const t = ((l = this.options) == null ? void 0 : l.container) || document.body;
|
|
39
|
-
(t === document.body && window.innerWidth - document.documentElement.clientWidth > 0 || t.scrollHeight > t.clientHeight) && getComputedStyle(t).overflow !== "hidden" && (e = k());
|
|
40
|
-
const r = t.className;
|
|
41
|
-
if (n.filter(
|
|
42
|
-
({ options: o }) => {
|
|
43
|
-
var i;
|
|
44
|
-
return (o == null ? void 0 : o.container) === ((i = this.options) == null ? void 0 : i.container);
|
|
45
|
-
}
|
|
46
|
-
).length === 0 && d.set(
|
|
47
|
-
t,
|
|
48
|
-
f(
|
|
49
|
-
{
|
|
50
|
-
width: e !== 0 ? `calc(100% - ${e}px)` : void 0,
|
|
51
|
-
overflow: "hidden",
|
|
52
|
-
overflowX: "hidden",
|
|
53
|
-
overflowY: "hidden"
|
|
54
|
-
},
|
|
55
|
-
{ element: t }
|
|
56
|
-
)
|
|
57
|
-
), !a.test(r)) {
|
|
58
|
-
const o = `${r} ${h}`;
|
|
59
|
-
t.className = o.trim();
|
|
60
|
-
}
|
|
61
|
-
n = [...n, { target: this.lockTarget, options: this.options }];
|
|
62
|
-
});
|
|
63
|
-
c(this, "unLock", () => {
|
|
64
|
-
var l;
|
|
65
|
-
const e = n.find(({ target: o }) => o === this.lockTarget);
|
|
66
|
-
if (n = n.filter(({ target: o }) => o !== this.lockTarget), !e || n.some(
|
|
67
|
-
({ options: o }) => {
|
|
68
|
-
var i;
|
|
69
|
-
return (o == null ? void 0 : o.container) === ((i = e.options) == null ? void 0 : i.container);
|
|
70
|
-
}
|
|
71
|
-
))
|
|
72
|
-
return;
|
|
73
|
-
const t = ((l = this.options) == null ? void 0 : l.container) || document.body, r = t.className;
|
|
74
|
-
a.test(r) && (f(d.get(t), { element: t }), d.delete(t), t.className = t.className.replace(a, "").trim());
|
|
75
|
-
});
|
|
76
|
-
this.lockTarget = u++, this.options = e;
|
|
7
|
+
), c = /* @__PURE__ */ new Map();
|
|
8
|
+
class g {
|
|
9
|
+
lockTarget;
|
|
10
|
+
options;
|
|
11
|
+
constructor(n) {
|
|
12
|
+
this.lockTarget = d++, this.options = n;
|
|
77
13
|
}
|
|
14
|
+
getContainer = () => this.options?.container;
|
|
15
|
+
// if options change...
|
|
16
|
+
reLock = (n) => {
|
|
17
|
+
const t = o.find(({ target: i }) => i === this.lockTarget);
|
|
18
|
+
t && this.unLock(), this.options = n, t && (t.options = n, this.lock());
|
|
19
|
+
};
|
|
20
|
+
lock = () => {
|
|
21
|
+
if (o.some(({ target: e }) => e === this.lockTarget))
|
|
22
|
+
return;
|
|
23
|
+
if (o.some(
|
|
24
|
+
({ options: e }) => e?.container === this.options?.container
|
|
25
|
+
)) {
|
|
26
|
+
o = [...o, { target: this.lockTarget, options: this.options }];
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
let n = 0;
|
|
30
|
+
const t = this.options?.container || document.body;
|
|
31
|
+
(t === document.body && window.innerWidth - document.documentElement.clientWidth > 0 || t.scrollHeight > t.clientHeight) && getComputedStyle(t).overflow !== "hidden" && (n = a());
|
|
32
|
+
const i = t.className;
|
|
33
|
+
if (o.filter(
|
|
34
|
+
({ options: e }) => e?.container === this.options?.container
|
|
35
|
+
).length === 0 && c.set(
|
|
36
|
+
t,
|
|
37
|
+
r(
|
|
38
|
+
{
|
|
39
|
+
width: n !== 0 ? `calc(100% - ${n}px)` : void 0,
|
|
40
|
+
overflow: "hidden",
|
|
41
|
+
overflowX: "hidden",
|
|
42
|
+
overflowY: "hidden"
|
|
43
|
+
},
|
|
44
|
+
{ element: t }
|
|
45
|
+
)
|
|
46
|
+
), !s.test(i)) {
|
|
47
|
+
const e = `${i} ${l}`;
|
|
48
|
+
t.className = e.trim();
|
|
49
|
+
}
|
|
50
|
+
o = [...o, { target: this.lockTarget, options: this.options }];
|
|
51
|
+
};
|
|
52
|
+
unLock = () => {
|
|
53
|
+
const n = o.find(({ target: e }) => e === this.lockTarget);
|
|
54
|
+
if (o = o.filter(({ target: e }) => e !== this.lockTarget), !n || o.some(
|
|
55
|
+
({ options: e }) => e?.container === n.options?.container
|
|
56
|
+
))
|
|
57
|
+
return;
|
|
58
|
+
const t = this.options?.container || document.body, i = t.className;
|
|
59
|
+
s.test(i) && (r(c.get(t), { element: t }), c.delete(t), t.className = t.className.replace(s, "").trim());
|
|
60
|
+
};
|
|
78
61
|
}
|
|
79
62
|
export {
|
|
80
|
-
|
|
63
|
+
g as default
|
|
81
64
|
};
|
package/dist/Dom/shadow.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function t(o){return o?.getRootNode?.()}function n(o){return t(o)instanceof ShadowRoot}function e(o){return n(o)?t(o):null}exports.getShadowRoot=e;exports.inShadow=n;
|
package/dist/Dom/shadow.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
return (t = o == null ? void 0 : o.getRootNode) == null ? void 0 : t.call(o);
|
|
1
|
+
function t(o) {
|
|
2
|
+
return o?.getRootNode?.();
|
|
4
3
|
}
|
|
5
|
-
function
|
|
6
|
-
return
|
|
4
|
+
function n(o) {
|
|
5
|
+
return t(o) instanceof ShadowRoot;
|
|
7
6
|
}
|
|
8
|
-
function
|
|
9
|
-
return
|
|
7
|
+
function e(o) {
|
|
8
|
+
return n(o) ? t(o) : null;
|
|
10
9
|
}
|
|
11
10
|
export {
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
e as getShadowRoot,
|
|
12
|
+
n as inShadow
|
|
14
13
|
};
|
package/dist/Portal.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),o=require("./Dom/canUseDom.cjs"),r=e.defineComponent((n,a)=>{const l=e.shallowRef(),t=e.shallowRef(),u=e.shallowRef(!1);return!u.value&&o.default()&&(t.value=n.getContainer(),l.value=t.value?.parentNode,u.value=!0),e.onMounted(()=>{t.value?.parentNode===null&&l.value!==null&&l.value.appendChild(t.value)}),e.onBeforeUnmount(()=>{n.didUpdate?.(n)}),e.onUnmounted(()=>{t.value?.parentNode?.removeChild?.(t.value)}),()=>t.value?e.createVNode(e.Teleport,{to:t.value},{default:()=>[a.slots.default?.()]}):null},{props:{didUpdate:{type:Function,required:!1},getContainer:{type:Function,required:!0}},inheritAttrs:!1});exports.default=r;
|
package/dist/Portal.js
CHANGED
|
@@ -1,24 +1,17 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}),
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var e, n, d;
|
|
14
|
-
(d = (n = (e = t.value) == null ? void 0 : e.parentNode) == null ? void 0 : n.removeChild) == null || d.call(n, t.value);
|
|
15
|
-
}), () => t.value ? s(p, {
|
|
16
|
-
to: t.value
|
|
1
|
+
import { defineComponent as u, shallowRef as a, onMounted as r, onBeforeUnmount as d, onUnmounted as i, createVNode as f, Teleport as v } from "vue";
|
|
2
|
+
import p from "./Dom/canUseDom.js";
|
|
3
|
+
const m = /* @__PURE__ */ u((t, l) => {
|
|
4
|
+
const n = a(), e = a(), o = a(!1);
|
|
5
|
+
return !o.value && p() && (e.value = t.getContainer(), n.value = e.value?.parentNode, o.value = !0), r(() => {
|
|
6
|
+
e.value?.parentNode === null && n.value !== null && n.value.appendChild(e.value);
|
|
7
|
+
}), d(() => {
|
|
8
|
+
t.didUpdate?.(t);
|
|
9
|
+
}), i(() => {
|
|
10
|
+
e.value?.parentNode?.removeChild?.(e.value);
|
|
11
|
+
}), () => e.value ? f(v, {
|
|
12
|
+
to: e.value
|
|
17
13
|
}, {
|
|
18
|
-
default: () =>
|
|
19
|
-
var e, n;
|
|
20
|
-
return [(n = (e = i.slots).default) == null ? void 0 : n.call(e)];
|
|
21
|
-
}
|
|
14
|
+
default: () => [l.slots.default?.()]
|
|
22
15
|
}) : null;
|
|
23
16
|
}, {
|
|
24
17
|
props: {
|
|
@@ -34,5 +27,5 @@ const N = /* @__PURE__ */ f((a, i) => {
|
|
|
34
27
|
inheritAttrs: !1
|
|
35
28
|
});
|
|
36
29
|
export {
|
|
37
|
-
|
|
30
|
+
m as default
|
|
38
31
|
};
|
package/dist/PortalWrapper.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("vue"),O=require("./Dom/canUseDom.cjs"),R=require("./Dom/scrollLocker.cjs"),k=require("./Portal.cjs"),b=require("./raf.cjs"),q=require("./setStyle.cjs");let l=0;const f=O.default();function N(){return process.env.NODE_ENV==="test"?l:0}let c={};function s(e){if(!f)return null;if(e){if(typeof e=="string")return document.querySelectorAll(e)[0];if(typeof e=="function")return e();if(typeof e=="object"&&e instanceof window.HTMLElement)return e}return document.body}const E=r.defineComponent((e,S)=>{const n=r.shallowRef(),m=r.shallowRef(),C=r.shallowRef(),y=r.shallowRef(),g=()=>{n.value?.parentNode?.removeChild(n.value)},d=t=>{const{visible:o,getContainer:u}=t||{},{visible:a,getContainer:i}=e;a!==o&&f&&s(i)===document.body&&(a&&!o?l+=1:t&&(l-=1)),(typeof i=="function"&&typeof u=="function"?i.toString()!==u.toString():i!==u)&&g()},v=(t=!1)=>{if(t||n.value&&!n.value.parentNode){const o=s(e.getContainer);return o?(o.appendChild(n.value),!0):!1}return!0},h=()=>{const{wrapperClassName:t}=e;n.value&&t&&t!==n.value.className&&(n.value.className=t)},w=()=>f?(n.value||(n.value=document.createElement("div"),v(!0)),h(),n.value):null;r.onMounted(()=>{y.value=new R.default({container:s(e.getContainer)}),d(),v()||(C.value=b.default(()=>{}))}),r.onUpdated(()=>{d(e),d(e),h(),v()}),r.onBeforeUnmount(()=>{const{visible:t,getContainer:o}=e;f&&s(o)===document.body&&(l=t&&l?l-1:l),g(),b.default.cancel(C.value)});const p=()=>{l===1&&!Object.keys(c).length?(p(),c=q.default({overflow:"hidden",overflowX:"hidden",overflowY:"hidden"})):l||(q.default(c),c={},p())};return()=>{const{forceRender:t,visible:o}=e;let u=null;const a={getOpenCount:N,getContainer:w,switchScrollingEffect:p,scrollLocker:y.value};return(t||o||m.value)&&(u=r.createVNode(k.default,{getContainer:w,ref:m},{default:()=>[S?.slots?.default(a)]})),u}},{props:{visible:{type:Boolean,required:!1},getContainer:{type:[String,Function],required:!1,skipCheck:!0},wrapperClassName:{type:String,required:!1},forceRender:{type:Boolean,required:!1}}});exports.default=E;exports.getOpenCount=N;
|
package/dist/PortalWrapper.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { SlotsType } from 'vue';
|
|
2
2
|
import { default as ScrollLocker } from './Dom/scrollLocker';
|
|
3
|
-
|
|
4
3
|
/**
|
|
5
4
|
* @private
|
|
6
5
|
*/
|
|
@@ -21,8 +20,8 @@ export interface PortalWrapperProps {
|
|
|
21
20
|
forceRender?: boolean;
|
|
22
21
|
}
|
|
23
22
|
declare const PortalWrapper: import('vue').DefineSetupFnComponent<PortalWrapperProps, any, DefaultSlotInfo, PortalWrapperProps & ({} | {
|
|
24
|
-
[x: `on${Capitalize<any>}`]: (
|
|
23
|
+
[x: `on${Capitalize<any>}`]: (...args: any[]) => any;
|
|
25
24
|
} | {
|
|
26
|
-
[x: `on${Capitalize<string>}`]: (
|
|
25
|
+
[x: `on${Capitalize<string>}`]: (...args: any[] | unknown[]) => any;
|
|
27
26
|
}), import('vue').PublicProps>;
|
|
28
27
|
export default PortalWrapper;
|
package/dist/PortalWrapper.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { defineComponent as k, shallowRef as u, onMounted as q, onUpdated as E, onBeforeUnmount as O, createVNode as R } from "vue";
|
|
2
|
-
import N from "./raf.js";
|
|
3
2
|
import L from "./Dom/canUseDom.js";
|
|
4
3
|
import P from "./Dom/scrollLocker.js";
|
|
5
|
-
import S from "./setStyle.js";
|
|
6
4
|
import B from "./Portal.js";
|
|
5
|
+
import b from "./raf.js";
|
|
6
|
+
import N from "./setStyle.js";
|
|
7
7
|
let r = 0;
|
|
8
8
|
const s = L();
|
|
9
9
|
function D() {
|
|
@@ -15,77 +15,74 @@ function f(e) {
|
|
|
15
15
|
if (e) {
|
|
16
16
|
if (typeof e == "string") return document.querySelectorAll(e)[0];
|
|
17
17
|
if (typeof e == "function") return e();
|
|
18
|
-
if (typeof e == "object" && e instanceof window.HTMLElement)
|
|
18
|
+
if (typeof e == "object" && e instanceof window.HTMLElement)
|
|
19
|
+
return e;
|
|
19
20
|
}
|
|
20
21
|
return document.body;
|
|
21
22
|
}
|
|
22
|
-
const W = /* @__PURE__ */ k((e,
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}, p = (t) => {
|
|
23
|
+
const W = /* @__PURE__ */ k((e, S) => {
|
|
24
|
+
const n = u(), v = u(), C = u(), y = u(), g = () => {
|
|
25
|
+
n.value?.parentNode?.removeChild(n.value);
|
|
26
|
+
}, d = (t) => {
|
|
27
27
|
const {
|
|
28
|
-
visible:
|
|
29
|
-
getContainer: a
|
|
30
|
-
} = t || {}, {
|
|
31
|
-
visible: i,
|
|
28
|
+
visible: o,
|
|
32
29
|
getContainer: l
|
|
30
|
+
} = t || {}, {
|
|
31
|
+
visible: a,
|
|
32
|
+
getContainer: i
|
|
33
33
|
} = e;
|
|
34
|
-
|
|
35
|
-
},
|
|
36
|
-
if (t ||
|
|
37
|
-
const
|
|
38
|
-
return
|
|
34
|
+
a !== o && s && f(i) === document.body && (a && !o ? r += 1 : t && (r -= 1)), (typeof i == "function" && typeof l == "function" ? i.toString() !== l.toString() : i !== l) && g();
|
|
35
|
+
}, p = (t = !1) => {
|
|
36
|
+
if (t || n.value && !n.value.parentNode) {
|
|
37
|
+
const o = f(e.getContainer);
|
|
38
|
+
return o ? (o.appendChild(n.value), !0) : !1;
|
|
39
39
|
}
|
|
40
40
|
return !0;
|
|
41
|
-
},
|
|
41
|
+
}, h = () => {
|
|
42
42
|
const {
|
|
43
43
|
wrapperClassName: t
|
|
44
44
|
} = e;
|
|
45
|
-
|
|
46
|
-
},
|
|
45
|
+
n.value && t && t !== n.value.className && (n.value.className = t);
|
|
46
|
+
}, w = () => s ? (n.value || (n.value = document.createElement("div"), p(!0)), h(), n.value) : null;
|
|
47
47
|
q(() => {
|
|
48
|
-
|
|
48
|
+
y.value = new P({
|
|
49
49
|
container: f(e.getContainer)
|
|
50
|
-
}),
|
|
50
|
+
}), d(), p() || (C.value = b(() => {
|
|
51
51
|
}));
|
|
52
52
|
}), E(() => {
|
|
53
|
-
|
|
53
|
+
d(e), d(e), h(), p();
|
|
54
54
|
}), O(() => {
|
|
55
55
|
const {
|
|
56
56
|
visible: t,
|
|
57
|
-
getContainer:
|
|
57
|
+
getContainer: o
|
|
58
58
|
} = e;
|
|
59
|
-
s && f(
|
|
59
|
+
s && f(o) === document.body && (r = t && r ? r - 1 : r), g(), b.cancel(C.value);
|
|
60
60
|
});
|
|
61
|
-
const
|
|
62
|
-
r === 1 && !Object.keys(c).length ? (
|
|
61
|
+
const m = () => {
|
|
62
|
+
r === 1 && !Object.keys(c).length ? (m(), c = N({
|
|
63
63
|
overflow: "hidden",
|
|
64
64
|
overflowX: "hidden",
|
|
65
65
|
overflowY: "hidden"
|
|
66
|
-
})) : r || (
|
|
66
|
+
})) : r || (N(c), c = {}, m());
|
|
67
67
|
};
|
|
68
68
|
return () => {
|
|
69
69
|
const {
|
|
70
70
|
forceRender: t,
|
|
71
|
-
visible:
|
|
71
|
+
visible: o
|
|
72
72
|
} = e;
|
|
73
|
-
let
|
|
74
|
-
const
|
|
73
|
+
let l = null;
|
|
74
|
+
const a = {
|
|
75
75
|
getOpenCount: D,
|
|
76
|
-
getContainer:
|
|
77
|
-
switchScrollingEffect:
|
|
78
|
-
scrollLocker:
|
|
76
|
+
getContainer: w,
|
|
77
|
+
switchScrollingEffect: m,
|
|
78
|
+
scrollLocker: y.value
|
|
79
79
|
};
|
|
80
|
-
return (t ||
|
|
81
|
-
getContainer:
|
|
82
|
-
ref:
|
|
80
|
+
return (t || o || v.value) && (l = R(B, {
|
|
81
|
+
getContainer: w,
|
|
82
|
+
ref: v
|
|
83
83
|
}, {
|
|
84
|
-
default: () =>
|
|
85
|
-
|
|
86
|
-
return [(l = d == null ? void 0 : d.slots) == null ? void 0 : l.default(i)];
|
|
87
|
-
}
|
|
88
|
-
})), a;
|
|
84
|
+
default: () => [S?.slots?.default(a)]
|
|
85
|
+
})), l;
|
|
89
86
|
};
|
|
90
87
|
}, {
|
|
91
88
|
props: {
|
package/dist/composeProps.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function o
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function r(o,e,f){const u={...o,...f?e:{}};return Object.keys(e).forEach(t=>{const n=e[t];typeof n=="function"&&(u[t]=(...c)=>(n(...c),o[t]?.(...c)))}),u}exports.default=r;
|
package/dist/composeProps.js
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
function
|
|
2
|
-
const
|
|
1
|
+
function s(t, o, u) {
|
|
2
|
+
const c = {
|
|
3
3
|
...t,
|
|
4
|
-
...
|
|
4
|
+
...u ? o : {}
|
|
5
5
|
};
|
|
6
|
-
return Object.keys(
|
|
7
|
-
const
|
|
8
|
-
typeof
|
|
9
|
-
|
|
10
|
-
return u(...n), (d = t[e]) == null ? void 0 : d.call(t, ...n);
|
|
11
|
-
});
|
|
12
|
-
}), f;
|
|
6
|
+
return Object.keys(o).forEach((n) => {
|
|
7
|
+
const e = o[n];
|
|
8
|
+
typeof e == "function" && (c[n] = (...f) => (e(...f), t[n]?.(...f)));
|
|
9
|
+
}), c;
|
|
13
10
|
}
|
|
14
11
|
export {
|
|
15
|
-
|
|
12
|
+
s as default
|
|
16
13
|
};
|
package/dist/createRef.d.ts
CHANGED
package/dist/debug/diff.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function diff(obj1: any, obj2: any, depth?: number, path?:
|
|
1
|
+
export default function diff(obj1: any, obj2: any, depth?: number, path?: any[], diffList?: any[]): any[];
|