@v-c/util 0.0.7 → 0.0.10
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/Portal.cjs +1 -1
- package/dist/Portal.js +8 -6
- package/dist/PortalWrapper.cjs +1 -1
- package/dist/PortalWrapper.d.ts +5 -4
- package/dist/PortalWrapper.js +16 -12
- package/dist/classnames.cjs +1 -1
- package/dist/classnames.d.ts +1 -0
- package/dist/classnames.js +2 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -8
- package/dist/props-util/index.cjs +1 -1
- package/dist/props-util/index.d.ts +3 -1
- package/dist/props-util/index.js +32 -17
- package/dist/raf.cjs +1 -1
- package/dist/raf.d.ts +1 -0
- package/dist/raf.js +28 -21
- package/dist/utils/transition.cjs +1 -1
- package/dist/utils/transition.js +22 -22
- package/dist/utils/watchState.cjs +1 -0
- package/dist/utils/watchState.d.ts +2 -0
- package/dist/utils/watchState.js +15 -0
- package/package.json +5 -5
package/dist/Portal.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
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
|
|
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 u=e.shallowRef(),t=e.shallowRef(),l=e.shallowRef(!1);return!l.value&&o.default()&&(t.value=n.getContainer(),u.value=t.value?.parentNode,l.value=!0),e.onMounted(()=>{t.value?.parentNode===null&&u.value!==null&&u.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,default:void 0},getContainer:{type:Function,required:!0,default:void 0}},inheritAttrs:!1});exports.default=r;
|
package/dist/Portal.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as o, shallowRef as a, onMounted as r, onBeforeUnmount as d, onUnmounted as i, createVNode as f, Teleport as v } from "vue";
|
|
2
2
|
import p from "./Dom/canUseDom.js";
|
|
3
|
-
const m = /* @__PURE__ */
|
|
4
|
-
const n = a(), e = a(),
|
|
5
|
-
return !
|
|
3
|
+
const m = /* @__PURE__ */ o((t, l) => {
|
|
4
|
+
const n = a(), e = a(), u = a(!1);
|
|
5
|
+
return !u.value && p() && (e.value = t.getContainer(), n.value = e.value?.parentNode, u.value = !0), r(() => {
|
|
6
6
|
e.value?.parentNode === null && n.value !== null && n.value.appendChild(e.value);
|
|
7
7
|
}), d(() => {
|
|
8
8
|
t.didUpdate?.(t);
|
|
@@ -17,11 +17,13 @@ const m = /* @__PURE__ */ u((t, l) => {
|
|
|
17
17
|
props: {
|
|
18
18
|
didUpdate: {
|
|
19
19
|
type: Function,
|
|
20
|
-
required: !1
|
|
20
|
+
required: !1,
|
|
21
|
+
default: void 0
|
|
21
22
|
},
|
|
22
23
|
getContainer: {
|
|
23
24
|
type: Function,
|
|
24
|
-
required: !0
|
|
25
|
+
required: !0,
|
|
26
|
+
default: void 0
|
|
25
27
|
}
|
|
26
28
|
},
|
|
27
29
|
inheritAttrs: !1
|
package/dist/PortalWrapper.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
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
|
|
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 s=O.default();function N(){return process.env.NODE_ENV==="test"?l:0}let f={};function c(e){if(!s)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&&s&&c(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=c(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=()=>s?(n.value||(n.value=document.createElement("div"),v(!0)),h(),n.value):null;r.onMounted(()=>{y.value=new R.default({container:c(e.getContainer)}),d(),v()||(C.value=b.default(()=>{}))}),r.onUpdated(()=>{d(e),d(e),h(),v()}),r.onBeforeUnmount(()=>{const{visible:t,getContainer:o}=e;s&&c(o)===document.body&&(l=t&&l?l-1:l),g(),b.default.cancel(C.value)});const p=()=>{l===1&&!Object.keys(f).length?(p(),f=q.default({overflow:"hidden",overflowX:"hidden",overflowY:"hidden"})):l||(q.default(f),f={},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,default:void 0},getContainer:{type:[String,Function],required:!1,skipCheck:!0,default:void 0},wrapperClassName:{type:String,required:!1,default:void 0},forceRender:{type:Boolean,required:!1,default:void 0}}});exports.default=E;exports.getOpenCount=N;
|
package/dist/PortalWrapper.d.ts
CHANGED
|
@@ -19,9 +19,10 @@ export interface PortalWrapperProps {
|
|
|
19
19
|
wrapperClassName?: string;
|
|
20
20
|
forceRender?: boolean;
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
[
|
|
24
|
-
}
|
|
22
|
+
interface PortalWrapperEmits {
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
}
|
|
25
|
+
declare const PortalWrapper: import('vue').DefineSetupFnComponent<PortalWrapperProps, PortalWrapperEmits, DefaultSlotInfo, PortalWrapperProps & {
|
|
25
26
|
[x: `on${Capitalize<string>}`]: (...args: any[] | unknown[]) => any;
|
|
26
|
-
}
|
|
27
|
+
}, import('vue').PublicProps>;
|
|
27
28
|
export default PortalWrapper;
|
package/dist/PortalWrapper.js
CHANGED
|
@@ -9,8 +9,8 @@ const s = L();
|
|
|
9
9
|
function D() {
|
|
10
10
|
return process.env.NODE_ENV === "test" ? r : 0;
|
|
11
11
|
}
|
|
12
|
-
let
|
|
13
|
-
function
|
|
12
|
+
let f = {};
|
|
13
|
+
function c(e) {
|
|
14
14
|
if (!s) return null;
|
|
15
15
|
if (e) {
|
|
16
16
|
if (typeof e == "string") return document.querySelectorAll(e)[0];
|
|
@@ -31,10 +31,10 @@ const W = /* @__PURE__ */ k((e, S) => {
|
|
|
31
31
|
visible: a,
|
|
32
32
|
getContainer: i
|
|
33
33
|
} = e;
|
|
34
|
-
a !== o && s &&
|
|
34
|
+
a !== o && s && c(i) === document.body && (a && !o ? r += 1 : t && (r -= 1)), (typeof i == "function" && typeof l == "function" ? i.toString() !== l.toString() : i !== l) && g();
|
|
35
35
|
}, p = (t = !1) => {
|
|
36
36
|
if (t || n.value && !n.value.parentNode) {
|
|
37
|
-
const o =
|
|
37
|
+
const o = c(e.getContainer);
|
|
38
38
|
return o ? (o.appendChild(n.value), !0) : !1;
|
|
39
39
|
}
|
|
40
40
|
return !0;
|
|
@@ -46,7 +46,7 @@ const W = /* @__PURE__ */ k((e, S) => {
|
|
|
46
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
|
-
container:
|
|
49
|
+
container: c(e.getContainer)
|
|
50
50
|
}), d(), p() || (C.value = b(() => {
|
|
51
51
|
}));
|
|
52
52
|
}), E(() => {
|
|
@@ -56,14 +56,14 @@ const W = /* @__PURE__ */ k((e, S) => {
|
|
|
56
56
|
visible: t,
|
|
57
57
|
getContainer: o
|
|
58
58
|
} = e;
|
|
59
|
-
s &&
|
|
59
|
+
s && c(o) === document.body && (r = t && r ? r - 1 : r), g(), b.cancel(C.value);
|
|
60
60
|
});
|
|
61
61
|
const m = () => {
|
|
62
|
-
r === 1 && !Object.keys(
|
|
62
|
+
r === 1 && !Object.keys(f).length ? (m(), f = N({
|
|
63
63
|
overflow: "hidden",
|
|
64
64
|
overflowX: "hidden",
|
|
65
65
|
overflowY: "hidden"
|
|
66
|
-
})) : r || (N(
|
|
66
|
+
})) : r || (N(f), f = {}, m());
|
|
67
67
|
};
|
|
68
68
|
return () => {
|
|
69
69
|
const {
|
|
@@ -88,20 +88,24 @@ const W = /* @__PURE__ */ k((e, S) => {
|
|
|
88
88
|
props: {
|
|
89
89
|
visible: {
|
|
90
90
|
type: Boolean,
|
|
91
|
-
required: !1
|
|
91
|
+
required: !1,
|
|
92
|
+
default: void 0
|
|
92
93
|
},
|
|
93
94
|
getContainer: {
|
|
94
95
|
type: [String, Function],
|
|
95
96
|
required: !1,
|
|
96
|
-
skipCheck: !0
|
|
97
|
+
skipCheck: !0,
|
|
98
|
+
default: void 0
|
|
97
99
|
},
|
|
98
100
|
wrapperClassName: {
|
|
99
101
|
type: String,
|
|
100
|
-
required: !1
|
|
102
|
+
required: !1,
|
|
103
|
+
default: void 0
|
|
101
104
|
},
|
|
102
105
|
forceRender: {
|
|
103
106
|
type: Boolean,
|
|
104
|
-
required: !1
|
|
107
|
+
required: !1,
|
|
108
|
+
default: void 0
|
|
105
109
|
}
|
|
106
110
|
}
|
|
107
111
|
});
|
package/dist/classnames.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function f(t){let e="";if(typeof t=="string"||typeof t=="number")e+=t;else if(typeof t=="object")if(Array.isArray(t)){for(let o=0;o<t.length;o++)if(t[o]){const r=f(t[o]);r&&(e&&(e+=" "),e+=r)}}else for(const o in t)t[o]&&(e&&(e+=" "),e+=o);return e}function l(...t){let e="";for(let o=0;o<t.length;o++){const r=t[o];if(r){const s=f(r);s&&(e&&(e+=" "),e+=s)}}return e}const n=l;exports.clsx=n;exports.default=l;
|
package/dist/classnames.d.ts
CHANGED
package/dist/classnames.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./classnames.cjs"),t=require("./utils/get.cjs"),s=require("./utils/set.cjs"),r=require("./warning.cjs");exports.classNames=e.default;exports.clsx=e.clsx;exports.get=t.default;exports.set=s.default;exports.warning=r.warningOnce;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { default as r } from "./
|
|
2
|
-
import { default as o } from "./utils/
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { default as r, clsx as s } from "./classnames.js";
|
|
2
|
+
import { default as o } from "./utils/get.js";
|
|
3
|
+
import { default as l } from "./utils/set.js";
|
|
4
|
+
import { warningOnce as n } from "./warning.js";
|
|
5
5
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
o as
|
|
9
|
-
|
|
6
|
+
r as classNames,
|
|
7
|
+
s as clsx,
|
|
8
|
+
o as get,
|
|
9
|
+
l as set,
|
|
10
|
+
n as warning
|
|
10
11
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),i=require("../isValid.cjs");function u(e){return e&&(e.type===o.Comment||e.type===o.Fragment&&e.children.length===0||e.type===o.Text&&e.children.trim()==="")}function a(e=[]){const t=[];return e.forEach(r=>{Array.isArray(r)?t.push(...r):r?.type===o.Fragment?t.push(...a(r.children)):t.push(r)}),t.filter(r=>!u(r))}const p=Symbol("skipFlatten");function f(e,t=!0){const r=Array.isArray(e)?e:[e],s=[];return r.forEach(n=>{Array.isArray(n)?s.push(...f(n,t)):i.default(n)?s.push(n):n&&typeof n=="object"&&n.type===o.Fragment?n.key===p?s.push(n):s.push(...f(n.children,t)):n&&o.isVNode(n)&&(t&&!u(n)?s.push(n):t||s.push(n))}),t?a(s):s}function y(e,...t){const r={};return t.forEach(s=>{r[s]=o.toRef(e,s)}),r}function m(e){const t={};return Object.keys(e).forEach(r=>{const s=e[r];s!==void 0&&(t[r]=s)}),t}exports.filterEmpty=a;exports.flattenChildren=f;exports.isEmptyElement=u;exports.removeUndefined=m;exports.skipFlattenKey=p;exports.toPropsRefs=y;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { VNode, VNodeNormalizedChildren } from 'vue';
|
|
1
|
+
import { Ref, VNode, VNodeNormalizedChildren } from 'vue';
|
|
2
2
|
export declare function isEmptyElement(c: any): boolean;
|
|
3
3
|
export declare function filterEmpty(children?: any[]): any[];
|
|
4
4
|
export declare const skipFlattenKey: unique symbol;
|
|
5
5
|
declare function flattenChildren(children?: VNode | VNodeNormalizedChildren, isFilterEmpty?: boolean): any[];
|
|
6
6
|
export { flattenChildren };
|
|
7
|
+
export declare function toPropsRefs<T extends Record<string, any>, K extends keyof T>(obj: T, ...args: K[]): { [key in K]-?: Ref<T[key]>; };
|
|
8
|
+
export declare function removeUndefined<T extends Record<string, any>>(obj: T): Partial<T>;
|
package/dist/props-util/index.js
CHANGED
|
@@ -1,24 +1,39 @@
|
|
|
1
|
-
import { Comment as a, Fragment as
|
|
1
|
+
import { Comment as a, Fragment as o, Text as y, isVNode as m, toRef as i } from "vue";
|
|
2
2
|
import A from "../isValid.js";
|
|
3
|
-
function
|
|
4
|
-
return
|
|
3
|
+
function u(e) {
|
|
4
|
+
return e && (e.type === a || e.type === o && e.children.length === 0 || e.type === y && e.children.trim() === "");
|
|
5
5
|
}
|
|
6
|
-
function
|
|
7
|
-
const
|
|
6
|
+
function p(e = []) {
|
|
7
|
+
const r = [];
|
|
8
|
+
return e.forEach((t) => {
|
|
9
|
+
Array.isArray(t) ? r.push(...t) : t?.type === o ? r.push(...p(t.children)) : r.push(t);
|
|
10
|
+
}), r.filter((t) => !u(t));
|
|
11
|
+
}
|
|
12
|
+
const v = Symbol("skipFlatten");
|
|
13
|
+
function f(e, r = !0) {
|
|
14
|
+
const t = Array.isArray(e) ? e : [e], s = [];
|
|
15
|
+
return t.forEach((n) => {
|
|
16
|
+
Array.isArray(n) ? s.push(...f(n, r)) : A(n) ? s.push(n) : n && typeof n == "object" && n.type === o ? n.key === v ? s.push(n) : s.push(...f(n.children, r)) : n && m(n) && (r && !u(n) ? s.push(n) : r || s.push(n));
|
|
17
|
+
}), r ? p(s) : s;
|
|
18
|
+
}
|
|
19
|
+
function g(e, ...r) {
|
|
20
|
+
const t = {};
|
|
8
21
|
return r.forEach((s) => {
|
|
9
|
-
|
|
10
|
-
}), t
|
|
22
|
+
t[s] = i(e, s);
|
|
23
|
+
}), t;
|
|
11
24
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}),
|
|
25
|
+
function k(e) {
|
|
26
|
+
const r = {};
|
|
27
|
+
return Object.keys(e).forEach((t) => {
|
|
28
|
+
const s = e[t];
|
|
29
|
+
s !== void 0 && (r[t] = s);
|
|
30
|
+
}), r;
|
|
18
31
|
}
|
|
19
32
|
export {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
33
|
+
p as filterEmpty,
|
|
34
|
+
f as flattenChildren,
|
|
35
|
+
u as isEmptyElement,
|
|
36
|
+
k as removeUndefined,
|
|
37
|
+
v as skipFlattenKey,
|
|
38
|
+
g as toPropsRefs
|
|
24
39
|
};
|
package/dist/raf.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});let
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});let c=e=>+setTimeout(e,16),l=e=>clearTimeout(e);typeof window<"u"&&"requestAnimationFrame"in window&&(c=e=>window.requestAnimationFrame(e),l=e=>window.cancelAnimationFrame(e));let u=0;const i=new Map;function f(e){i.delete(e)}function t(e,n=1){u+=1;const o=u;function r(a){if(a===0)f(o),e();else{const d=c(()=>{r(a-1)});i.set(o,d)}}return r(n),o}t.cancel=e=>{const n=i.get(e);return f(e),l(n)};process.env.NODE_ENV!=="production"&&(t.ids=()=>i);function s(e){let n=null;return()=>{n!==null&&t.cancel(n),n=t(e)}}exports.default=t;exports.rafDebounce=s;
|
package/dist/raf.d.ts
CHANGED
package/dist/raf.js
CHANGED
|
@@ -1,30 +1,37 @@
|
|
|
1
|
-
let
|
|
2
|
-
typeof window < "u" && "requestAnimationFrame" in window && (
|
|
3
|
-
let
|
|
4
|
-
const
|
|
5
|
-
function
|
|
6
|
-
|
|
1
|
+
let l = (e) => +setTimeout(e, 16), u = (e) => clearTimeout(e);
|
|
2
|
+
typeof window < "u" && "requestAnimationFrame" in window && (l = (e) => window.requestAnimationFrame(e), u = (e) => window.cancelAnimationFrame(e));
|
|
3
|
+
let c = 0;
|
|
4
|
+
const a = /* @__PURE__ */ new Map();
|
|
5
|
+
function f(e) {
|
|
6
|
+
a.delete(e);
|
|
7
7
|
}
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
function
|
|
12
|
-
if (
|
|
13
|
-
|
|
8
|
+
function t(e, n = 1) {
|
|
9
|
+
c += 1;
|
|
10
|
+
const i = c;
|
|
11
|
+
function o(r) {
|
|
12
|
+
if (r === 0)
|
|
13
|
+
f(i), e();
|
|
14
14
|
else {
|
|
15
|
-
const
|
|
16
|
-
|
|
15
|
+
const d = l(() => {
|
|
16
|
+
o(r - 1);
|
|
17
17
|
});
|
|
18
|
-
|
|
18
|
+
a.set(i, d);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
return
|
|
21
|
+
return o(n), i;
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
return
|
|
23
|
+
t.cancel = (e) => {
|
|
24
|
+
const n = a.get(e);
|
|
25
|
+
return f(e), u(n);
|
|
26
26
|
};
|
|
27
|
-
process.env.NODE_ENV !== "production" && (
|
|
27
|
+
process.env.NODE_ENV !== "production" && (t.ids = () => a);
|
|
28
|
+
function s(e) {
|
|
29
|
+
let n = null;
|
|
30
|
+
return () => {
|
|
31
|
+
n !== null && t.cancel(n), n = t(e);
|
|
32
|
+
};
|
|
33
|
+
}
|
|
28
34
|
export {
|
|
29
|
-
|
|
35
|
+
t as default,
|
|
36
|
+
s as rafDebounce
|
|
30
37
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue");function u(e){return e!==void 0&&(e==="topLeft"||e==="topRight")?"slide-down":"slide-up"}function $(e,r={}){return e?e?{name:e,appear:!0,enterFromClass:`${e} ${e}-enter ${e}-enter-prepare ${e}-enter-start`,enterActiveClass:`${e} ${e}-enter ${e}-enter-prepare`,enterToClass:`${e} ${e}-enter ${e}-enter-active`,leaveFromClass:`${e} ${e}-leave`,leaveActiveClass:`${e} ${e}-leave ${e}-leave-active`,leaveToClass:`${e} ${e}-leave ${e}-leave-active`,...r}:{css:!1,...r}:{}}function t(e,r={}){return e?{name:e,appear:!0,appearActiveClass:`${e}`,appearToClass:`${e}-appear ${e}-appear-active`,enterFromClass:`${e}-appear ${e}-enter ${e}-appear-prepare ${e}-enter-prepare`,enterActiveClass:`${e}`,enterToClass:`${e}-enter ${e}-appear ${e}-appear-active ${e}-enter-active`,leaveActiveClass:`${e} ${e}-leave`,leaveToClass:`${e}-leave-active`,...r}:{css:!1,...r}}const v=()=>({height:0,opacity:0}),c=e=>({height:`${e.scrollHeight}px`,opacity:1}),s=e=>({height:`${e.offsetHeight}px`});function g(e="ant-motion-collapse",r,p){return{name:e,appear:!0,css:!0,onBeforeEnter:l=>{p.value=e,r.value=v()},onEnter:l=>{o.nextTick(()=>{r.value=c(l)})},onAfterEnter:()=>{p.value="",r.value={}},onBeforeLeave:l=>{p.value=e,r.value=s(l)},onLeave:l=>{setTimeout(()=>{r.value=v()})},onAfterLeave:()=>{p.value="",r.value={}}}}function f(e,r,p){return p!==void 0?p:`${e}-${r}`}exports.collapseMotion=g;exports.getTransitionDirection=u;exports.getTransitionGroupProps=t;exports.getTransitionName=f;exports.getTransitionProps=$;
|
package/dist/utils/transition.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { nextTick as
|
|
2
|
-
function
|
|
1
|
+
import { nextTick as $ } from "vue";
|
|
2
|
+
function t(e) {
|
|
3
3
|
return e !== void 0 && (e === "topLeft" || e === "topRight") ? "slide-down" : "slide-up";
|
|
4
4
|
}
|
|
5
|
-
function
|
|
5
|
+
function f(e, r = {}) {
|
|
6
6
|
return e ? e ? {
|
|
7
7
|
name: e,
|
|
8
8
|
appear: !0,
|
|
@@ -10,16 +10,16 @@ function a(e, r = {}) {
|
|
|
10
10
|
// appearFromClass: `${transitionName}-appear ${transitionName}-appear-prepare`,
|
|
11
11
|
// appearActiveClass: `antdv-base-transtion`,
|
|
12
12
|
// appearToClass: `${transitionName}-appear ${transitionName}-appear-active`,
|
|
13
|
-
enterFromClass: `${e}-enter ${e}-enter-prepare ${e}-enter-start`,
|
|
14
|
-
enterActiveClass: `${e}-enter ${e}-enter-prepare`,
|
|
15
|
-
enterToClass: `${e}-enter ${e}-enter-active`,
|
|
16
|
-
leaveFromClass:
|
|
17
|
-
leaveActiveClass: `${e}-leave ${e}-leave-active`,
|
|
18
|
-
leaveToClass: `${e}-leave ${e}-leave-active`,
|
|
13
|
+
enterFromClass: `${e} ${e}-enter ${e}-enter-prepare ${e}-enter-start`,
|
|
14
|
+
enterActiveClass: `${e} ${e}-enter ${e}-enter-prepare`,
|
|
15
|
+
enterToClass: `${e} ${e}-enter ${e}-enter-active`,
|
|
16
|
+
leaveFromClass: `${e} ${e}-leave`,
|
|
17
|
+
leaveActiveClass: `${e} ${e}-leave ${e}-leave-active`,
|
|
18
|
+
leaveToClass: `${e} ${e}-leave ${e}-leave-active`,
|
|
19
19
|
...r
|
|
20
20
|
} : { css: !1, ...r } : {};
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function g(e, r = {}) {
|
|
23
23
|
return e ? {
|
|
24
24
|
name: e,
|
|
25
25
|
appear: !0,
|
|
@@ -34,11 +34,11 @@ function s(e, r = {}) {
|
|
|
34
34
|
...r
|
|
35
35
|
} : { css: !1, ...r };
|
|
36
36
|
}
|
|
37
|
-
const l = () => ({ height: 0, opacity: 0 }),
|
|
37
|
+
const l = () => ({ height: 0, opacity: 0 }), u = (e) => ({
|
|
38
38
|
height: `${e.scrollHeight}px`,
|
|
39
39
|
opacity: 1
|
|
40
|
-
}),
|
|
41
|
-
function
|
|
40
|
+
}), c = (e) => ({ height: `${e.offsetHeight}px` });
|
|
41
|
+
function C(e = "ant-motion-collapse", r, p) {
|
|
42
42
|
return {
|
|
43
43
|
name: e,
|
|
44
44
|
appear: !0,
|
|
@@ -47,15 +47,15 @@ function f(e = "ant-motion-collapse", r, p) {
|
|
|
47
47
|
p.value = e, r.value = l();
|
|
48
48
|
},
|
|
49
49
|
onEnter: (v) => {
|
|
50
|
-
|
|
51
|
-
r.value =
|
|
50
|
+
$(() => {
|
|
51
|
+
r.value = u(v);
|
|
52
52
|
});
|
|
53
53
|
},
|
|
54
54
|
onAfterEnter: () => {
|
|
55
55
|
p.value = "", r.value = {};
|
|
56
56
|
},
|
|
57
57
|
onBeforeLeave: (v) => {
|
|
58
|
-
p.value = e, r.value =
|
|
58
|
+
p.value = e, r.value = c(v);
|
|
59
59
|
},
|
|
60
60
|
onLeave: (v) => {
|
|
61
61
|
setTimeout(() => {
|
|
@@ -67,13 +67,13 @@ function f(e = "ant-motion-collapse", r, p) {
|
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
|
-
function
|
|
70
|
+
function s(e, r, p) {
|
|
71
71
|
return p !== void 0 ? p : `${e}-${r}`;
|
|
72
72
|
}
|
|
73
73
|
export {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
74
|
+
C as collapseMotion,
|
|
75
|
+
t as getTransitionDirection,
|
|
76
|
+
g as getTransitionGroupProps,
|
|
77
|
+
s as getTransitionName,
|
|
78
|
+
f as getTransitionProps
|
|
79
79
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function i(){let t=[];return(r,e)=>(t=JSON.stringify(e),r(e,t))}function n(){let t=!1;return(r,e)=>{if(!t)return t=!0,r(e)}}exports.renderFirstTrigger=n;exports.watchState=i;
|
package/package.json
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v-c/util",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.10",
|
|
5
5
|
"description": "Vue3 components utils",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
9
|
-
"files": [
|
|
10
|
-
"dist",
|
|
11
|
-
"package.json"
|
|
12
|
-
],
|
|
13
9
|
"author": {
|
|
14
10
|
"name": "aibayanyu20",
|
|
15
11
|
"email": "aibayanyu@qq.com",
|
|
@@ -17,6 +13,10 @@
|
|
|
17
13
|
},
|
|
18
14
|
"main": "dist/index.js",
|
|
19
15
|
"types": "dist/index.d.ts",
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"package.json"
|
|
19
|
+
],
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"vue": "^3.0.0"
|
|
22
22
|
},
|