@v-c/image 1.0.0 → 1.0.2
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/Preview/index.js +1 -1
- package/package.json +4 -4
- package/dist/Image.cjs +0 -231
- package/dist/Preview/CloseBtn.cjs +0 -44
- package/dist/Preview/Footer.cjs +0 -234
- package/dist/Preview/PrevNext.cjs +0 -59
- package/dist/Preview/index.cjs +0 -404
- package/dist/PreviewGroup.cjs +0 -138
- package/dist/common.cjs +0 -13
- package/dist/context.cjs +0 -11
- package/dist/getFixScaleEleTransPosition.cjs +0 -28
- package/dist/hooks/useImageTransform.cjs +0 -99
- package/dist/hooks/useMouseEvent.cjs +0 -96
- package/dist/hooks/usePreviewItems.cjs +0 -48
- package/dist/hooks/useRegisterImage.cjs +0 -28
- package/dist/hooks/useStatus.cjs +0 -49
- package/dist/hooks/useTouchEvent.cjs +0 -125
- package/dist/index.cjs +0 -11
- package/dist/interface.cjs +0 -1
- package/dist/portal/dist/Context.cjs +0 -12
- package/dist/portal/dist/Portal.cjs +0 -100
- package/dist/portal/dist/index.cjs +0 -3
- package/dist/portal/dist/useDom.cjs +0 -47
- package/dist/portal/dist/useEscKeyDown.cjs +0 -57
- package/dist/portal/dist/useScrollLocker.cjs +0 -28
- package/dist/portal/dist/util.cjs +0 -4
- package/dist/previewConfig.cjs +0 -5
- package/dist/util/dist/Dom/canUseDom.cjs +0 -4
- package/dist/util/dist/Dom/contains.cjs +0 -11
- package/dist/util/dist/Dom/dynamicCSS.cjs +0 -80
- package/dist/util/dist/KeyCode.cjs +0 -81
- package/dist/util/dist/RenderComponent.cjs +0 -29
- package/dist/util/dist/classnames.cjs +0 -36
- package/dist/util/dist/getScrollBarSize.cjs +0 -53
- package/dist/util/dist/hooks/useId.cjs +0 -5
- package/dist/util/dist/hooks/useMergedState.cjs +0 -24
- package/dist/util/dist/index.cjs +0 -7
- package/dist/util/dist/isEqual.cjs +0 -27
- package/dist/util/dist/omit.cjs +0 -8
- package/dist/util/dist/pickAttrs.cjs +0 -39
- package/dist/util/dist/props-util/index.cjs +0 -47
- package/dist/util/dist/raf.cjs +0 -36
- package/dist/util/dist/type.cjs +0 -2
- package/dist/util/dist/utils/transition.cjs +0 -21
- package/dist/util/dist/warning.cjs +0 -37
- package/dist/util.cjs +0 -27
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
const require_canUseDom = require("./canUseDom.cjs");
|
|
2
|
-
const require_contains = require("./contains.cjs");
|
|
3
|
-
var APPEND_ORDER = "data-vc-order";
|
|
4
|
-
var APPEND_PRIORITY = "data-vc-priority";
|
|
5
|
-
var MARK_KEY = `vc-util-key`;
|
|
6
|
-
var containerCache = /* @__PURE__ */ new Map();
|
|
7
|
-
function getMark({ mark } = {}) {
|
|
8
|
-
if (mark) return mark.startsWith("data-") ? mark : `data-${mark}`;
|
|
9
|
-
return MARK_KEY;
|
|
10
|
-
}
|
|
11
|
-
function getContainer(option) {
|
|
12
|
-
if (option.attachTo) return option.attachTo;
|
|
13
|
-
return document.querySelector("head") || document.body;
|
|
14
|
-
}
|
|
15
|
-
function getOrder(prepend) {
|
|
16
|
-
if (prepend === "queue") return "prependQueue";
|
|
17
|
-
return prepend ? "prepend" : "append";
|
|
18
|
-
}
|
|
19
|
-
function findStyles(container) {
|
|
20
|
-
return Array.from((containerCache.get(container) || container).children).filter((node) => node.tagName === "STYLE");
|
|
21
|
-
}
|
|
22
|
-
function injectCSS(css, option = {}) {
|
|
23
|
-
if (!require_canUseDom.canUseDom()) return null;
|
|
24
|
-
const { csp, prepend, priority = 0 } = option;
|
|
25
|
-
const mergedOrder = getOrder(prepend);
|
|
26
|
-
const isPrependQueue = mergedOrder === "prependQueue";
|
|
27
|
-
const styleNode = document.createElement("style");
|
|
28
|
-
styleNode.setAttribute(APPEND_ORDER, mergedOrder);
|
|
29
|
-
if (isPrependQueue && priority) styleNode.setAttribute(APPEND_PRIORITY, `${priority}`);
|
|
30
|
-
if (csp?.nonce) styleNode.nonce = csp?.nonce;
|
|
31
|
-
styleNode.innerHTML = css;
|
|
32
|
-
const container = getContainer(option);
|
|
33
|
-
const { firstChild } = container;
|
|
34
|
-
if (prepend) {
|
|
35
|
-
if (isPrependQueue) {
|
|
36
|
-
const existStyle = findStyles(container).filter((node) => {
|
|
37
|
-
if (!["prepend", "prependQueue"].includes(node.getAttribute(APPEND_ORDER))) return false;
|
|
38
|
-
return priority >= Number(node.getAttribute(APPEND_PRIORITY) || 0);
|
|
39
|
-
});
|
|
40
|
-
if (existStyle.length) {
|
|
41
|
-
container.insertBefore(styleNode, existStyle[existStyle.length - 1].nextSibling);
|
|
42
|
-
return styleNode;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
container.insertBefore(styleNode, firstChild);
|
|
46
|
-
} else container.appendChild(styleNode);
|
|
47
|
-
return styleNode;
|
|
48
|
-
}
|
|
49
|
-
function findExistNode(key, option = {}) {
|
|
50
|
-
return findStyles(getContainer(option)).find((node) => node.getAttribute(getMark(option)) === key);
|
|
51
|
-
}
|
|
52
|
-
function removeCSS(key, option = {}) {
|
|
53
|
-
if (!require_canUseDom.canUseDom()) return null;
|
|
54
|
-
const existNode = findExistNode(key, option);
|
|
55
|
-
if (existNode) getContainer(option).removeChild(existNode);
|
|
56
|
-
}
|
|
57
|
-
function syncRealContainer(container, option) {
|
|
58
|
-
const cachedRealContainer = containerCache.get(container);
|
|
59
|
-
if (!cachedRealContainer || !require_contains.contains(document, cachedRealContainer)) {
|
|
60
|
-
const placeholderStyle = injectCSS("", option);
|
|
61
|
-
const { parentNode } = placeholderStyle;
|
|
62
|
-
containerCache.set(container, parentNode);
|
|
63
|
-
container.removeChild(placeholderStyle);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
function updateCSS(css, key, option = {}) {
|
|
67
|
-
if (!require_canUseDom.canUseDom()) return null;
|
|
68
|
-
syncRealContainer(getContainer(option), option);
|
|
69
|
-
const existNode = findExistNode(key, option);
|
|
70
|
-
if (existNode) {
|
|
71
|
-
if (option.csp?.nonce && existNode.nonce !== option.csp?.nonce) existNode.nonce = option.csp?.nonce;
|
|
72
|
-
if (existNode.innerHTML !== css) existNode.innerHTML = css;
|
|
73
|
-
return existNode;
|
|
74
|
-
}
|
|
75
|
-
const newNode = injectCSS(css, option);
|
|
76
|
-
newNode.setAttribute(getMark(option), key);
|
|
77
|
-
return newNode;
|
|
78
|
-
}
|
|
79
|
-
exports.removeCSS = removeCSS;
|
|
80
|
-
exports.updateCSS = updateCSS;
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
var KeyCodeStr = {
|
|
2
|
-
Enter: "Enter",
|
|
3
|
-
Backspace: "Backspace",
|
|
4
|
-
Tab: "Tab",
|
|
5
|
-
Space: " ",
|
|
6
|
-
Escape: "Escape",
|
|
7
|
-
Shift: "Shift",
|
|
8
|
-
Control: "Control",
|
|
9
|
-
Alt: "Alt",
|
|
10
|
-
Meta: "Meta",
|
|
11
|
-
ArrowLeft: "ArrowLeft",
|
|
12
|
-
ArrowUp: "ArrowUp",
|
|
13
|
-
ArrowRight: "ArrowRight",
|
|
14
|
-
ArrowDown: "ArrowDown",
|
|
15
|
-
Home: "Home",
|
|
16
|
-
End: "End",
|
|
17
|
-
PageUp: "PageUp",
|
|
18
|
-
PageDown: "PageDown",
|
|
19
|
-
Insert: "Insert",
|
|
20
|
-
Delete: "Delete",
|
|
21
|
-
F1: "F1",
|
|
22
|
-
F2: "F2",
|
|
23
|
-
F3: "F3",
|
|
24
|
-
F4: "F4",
|
|
25
|
-
F5: "F5",
|
|
26
|
-
F6: "F6",
|
|
27
|
-
F7: "F7",
|
|
28
|
-
F8: "F8",
|
|
29
|
-
F9: "F9",
|
|
30
|
-
F10: "F10",
|
|
31
|
-
F11: "F11",
|
|
32
|
-
F12: "F12",
|
|
33
|
-
Digit0: "0",
|
|
34
|
-
Digit1: "1",
|
|
35
|
-
Digit2: "2",
|
|
36
|
-
Digit3: "3",
|
|
37
|
-
Digit4: "4",
|
|
38
|
-
Digit5: "5",
|
|
39
|
-
Digit6: "6",
|
|
40
|
-
Digit7: "7",
|
|
41
|
-
Digit8: "8",
|
|
42
|
-
Digit9: "9",
|
|
43
|
-
KeyA: "a",
|
|
44
|
-
KeyB: "b",
|
|
45
|
-
KeyC: "c",
|
|
46
|
-
KeyD: "d",
|
|
47
|
-
KeyE: "e",
|
|
48
|
-
KeyF: "f",
|
|
49
|
-
KeyG: "g",
|
|
50
|
-
KeyH: "h",
|
|
51
|
-
KeyI: "i",
|
|
52
|
-
KeyJ: "j",
|
|
53
|
-
KeyK: "k",
|
|
54
|
-
KeyL: "l",
|
|
55
|
-
KeyM: "m",
|
|
56
|
-
KeyN: "n",
|
|
57
|
-
KeyO: "o",
|
|
58
|
-
KeyP: "p",
|
|
59
|
-
KeyQ: "q",
|
|
60
|
-
KeyR: "r",
|
|
61
|
-
KeyS: "s",
|
|
62
|
-
KeyT: "t",
|
|
63
|
-
KeyU: "u",
|
|
64
|
-
KeyV: "v",
|
|
65
|
-
KeyW: "w",
|
|
66
|
-
KeyX: "x",
|
|
67
|
-
KeyY: "y",
|
|
68
|
-
KeyZ: "z",
|
|
69
|
-
Semicolon: ";",
|
|
70
|
-
Equal: "=",
|
|
71
|
-
Comma: ",",
|
|
72
|
-
Minus: "-",
|
|
73
|
-
Period: ".",
|
|
74
|
-
Slash: "/",
|
|
75
|
-
Backquote: "`",
|
|
76
|
-
BracketLeft: "[",
|
|
77
|
-
Backslash: "\\",
|
|
78
|
-
BracketRight: "]",
|
|
79
|
-
Quote: "'"
|
|
80
|
-
};
|
|
81
|
-
exports.KeyCodeStr = KeyCodeStr;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
const require_index = require("./props-util/index.cjs");
|
|
2
|
-
let vue = require("vue");
|
|
3
|
-
function checkIsBaseType(value) {
|
|
4
|
-
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") return true;
|
|
5
|
-
return typeof value === "undefined" || value === null;
|
|
6
|
-
}
|
|
7
|
-
var RenderComponent_default = (0, vue.defineComponent)((props, { attrs }) => {
|
|
8
|
-
return () => {
|
|
9
|
-
const render$1 = props.render;
|
|
10
|
-
if (render$1 && typeof render$1 === "function") {
|
|
11
|
-
const _render = render$1?.();
|
|
12
|
-
if (Array.isArray(_render)) return require_index.filterEmpty(_render).map((v) => {
|
|
13
|
-
if ((0, vue.isVNode)(v)) return (0, vue.createVNode)(v, { ...attrs });
|
|
14
|
-
else return v;
|
|
15
|
-
});
|
|
16
|
-
return _render;
|
|
17
|
-
} else if (Array.isArray(render$1)) return require_index.filterEmpty(render$1).map((v) => {
|
|
18
|
-
if ((0, vue.isVNode)(v)) return (0, vue.createVNode)(v, { ...attrs });
|
|
19
|
-
return v;
|
|
20
|
-
});
|
|
21
|
-
else if (checkIsBaseType(render$1)) return render$1;
|
|
22
|
-
if ((0, vue.isVNode)(render$1)) return (0, vue.createVNode)(render$1, { ...attrs });
|
|
23
|
-
return render$1;
|
|
24
|
-
};
|
|
25
|
-
}, {
|
|
26
|
-
inheritAttrs: false,
|
|
27
|
-
name: "RenderComponent",
|
|
28
|
-
props: ["render"]
|
|
29
|
-
});
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
function toVal(mix) {
|
|
2
|
-
let str = "";
|
|
3
|
-
if (typeof mix === "string" || typeof mix === "number") str += mix;
|
|
4
|
-
else if (typeof mix === "object") {
|
|
5
|
-
if (Array.isArray(mix)) {
|
|
6
|
-
for (let k = 0; k < mix.length; k++) if (mix[k]) {
|
|
7
|
-
const y = toVal(mix[k]);
|
|
8
|
-
if (y) {
|
|
9
|
-
str && (str += " ");
|
|
10
|
-
str += y;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
} else for (const k in mix) if (mix[k]) {
|
|
14
|
-
str && (str += " ");
|
|
15
|
-
str += k;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
return str;
|
|
19
|
-
}
|
|
20
|
-
function classNames(...args) {
|
|
21
|
-
let str = "";
|
|
22
|
-
for (let i = 0; i < args.length; i++) {
|
|
23
|
-
const tmp = args[i];
|
|
24
|
-
if (tmp) {
|
|
25
|
-
const x = toVal(tmp);
|
|
26
|
-
if (x) {
|
|
27
|
-
str && (str += " ");
|
|
28
|
-
str += x;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return str;
|
|
33
|
-
}
|
|
34
|
-
var clsx = classNames;
|
|
35
|
-
exports.classNames = classNames;
|
|
36
|
-
exports.clsx = clsx;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
var cached;
|
|
2
|
-
function getScrollBarSize(fresh) {
|
|
3
|
-
if (typeof document === "undefined") return 0;
|
|
4
|
-
if (fresh || cached === void 0) {
|
|
5
|
-
const inner = document.createElement("div");
|
|
6
|
-
inner.style.width = "100%";
|
|
7
|
-
inner.style.height = "200px";
|
|
8
|
-
const outer = document.createElement("div");
|
|
9
|
-
const outerStyle = outer.style;
|
|
10
|
-
outerStyle.position = "absolute";
|
|
11
|
-
outerStyle.top = "0";
|
|
12
|
-
outerStyle.left = "0";
|
|
13
|
-
outerStyle.pointerEvents = "none";
|
|
14
|
-
outerStyle.visibility = "hidden";
|
|
15
|
-
outerStyle.width = "200px";
|
|
16
|
-
outerStyle.height = "150px";
|
|
17
|
-
outerStyle.overflow = "hidden";
|
|
18
|
-
outer.appendChild(inner);
|
|
19
|
-
document.body.appendChild(outer);
|
|
20
|
-
const widthContained = inner.offsetWidth;
|
|
21
|
-
outer.style.overflow = "scroll";
|
|
22
|
-
let widthScroll = inner.offsetWidth;
|
|
23
|
-
if (widthContained === widthScroll) widthScroll = outer.clientWidth;
|
|
24
|
-
document.body.removeChild(outer);
|
|
25
|
-
cached = widthContained - widthScroll;
|
|
26
|
-
}
|
|
27
|
-
return cached;
|
|
28
|
-
}
|
|
29
|
-
function ensureSize(str) {
|
|
30
|
-
const match = str.match(/^(.*)px$/);
|
|
31
|
-
const value = Number(match?.[1]);
|
|
32
|
-
return Number.isNaN(value) ? getScrollBarSize() : value;
|
|
33
|
-
}
|
|
34
|
-
function getTargetScrollBarSize(target) {
|
|
35
|
-
if (typeof document === "undefined" || !target || !(target instanceof Element)) return {
|
|
36
|
-
width: 0,
|
|
37
|
-
height: 0
|
|
38
|
-
};
|
|
39
|
-
if (typeof navigator !== "undefined" && /jsdom/i.test(navigator.userAgent)) return {
|
|
40
|
-
width: 0,
|
|
41
|
-
height: 0
|
|
42
|
-
};
|
|
43
|
-
let width = "0px";
|
|
44
|
-
let height = "0px";
|
|
45
|
-
try {
|
|
46
|
-
({width, height} = getComputedStyle(target, "::-webkit-scrollbar"));
|
|
47
|
-
} catch {}
|
|
48
|
-
return {
|
|
49
|
-
width: ensureSize(width),
|
|
50
|
-
height: ensureSize(height)
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
exports.getTargetScrollBarSize = getTargetScrollBarSize;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
let vue = require("vue");
|
|
2
|
-
function useMergedState(defaultStateValue, option) {
|
|
3
|
-
const { defaultValue, value = (0, vue.ref)() } = option || {};
|
|
4
|
-
let initValue = typeof defaultStateValue === "function" ? defaultStateValue() : defaultStateValue;
|
|
5
|
-
if (value.value !== void 0) initValue = (0, vue.unref)(value);
|
|
6
|
-
if (defaultValue !== void 0) initValue = typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
|
7
|
-
const innerValue = (0, vue.ref)(initValue);
|
|
8
|
-
const mergedValue = (0, vue.ref)(initValue);
|
|
9
|
-
(0, vue.watchEffect)(() => {
|
|
10
|
-
let val = value.value !== void 0 ? value.value : innerValue.value;
|
|
11
|
-
if (option?.postState) val = option.postState(val);
|
|
12
|
-
mergedValue.value = val;
|
|
13
|
-
});
|
|
14
|
-
function triggerChange(newValue) {
|
|
15
|
-
const preVal = mergedValue.value;
|
|
16
|
-
innerValue.value = newValue;
|
|
17
|
-
if ((0, vue.toRaw)(mergedValue.value) !== newValue && option?.onChange) option.onChange(newValue, preVal);
|
|
18
|
-
}
|
|
19
|
-
(0, vue.watch)(value, () => {
|
|
20
|
-
innerValue.value = value.value;
|
|
21
|
-
});
|
|
22
|
-
return [mergedValue, triggerChange];
|
|
23
|
-
}
|
|
24
|
-
exports.useMergedState = useMergedState;
|
package/dist/util/dist/index.cjs
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
const require_raf = require("./raf.cjs");
|
|
2
|
-
const require_omit = require("./omit.cjs");
|
|
3
|
-
require("./RenderComponent.cjs");
|
|
4
|
-
const require_classnames = require("./classnames.cjs");
|
|
5
|
-
require("./hooks/useId.cjs");
|
|
6
|
-
const require_useMergedState = require("./hooks/useMergedState.cjs");
|
|
7
|
-
const require_warning = require("./warning.cjs");
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
const require_warning = require("./warning.cjs");
|
|
2
|
-
function isEqual(obj1, obj2, shallow = false) {
|
|
3
|
-
const refSet = /* @__PURE__ */ new Set();
|
|
4
|
-
function deepEqual(a, b, level = 1) {
|
|
5
|
-
const circular = refSet.has(a);
|
|
6
|
-
require_warning.warning_default(!circular, "Warning: There may be circular references");
|
|
7
|
-
if (circular) return false;
|
|
8
|
-
if (a === b) return true;
|
|
9
|
-
if (shallow && level > 1) return false;
|
|
10
|
-
refSet.add(a);
|
|
11
|
-
const newLevel = level + 1;
|
|
12
|
-
if (Array.isArray(a)) {
|
|
13
|
-
if (!Array.isArray(b) || a.length !== b.length) return false;
|
|
14
|
-
for (let i = 0; i < a.length; i++) if (!deepEqual(a[i], b[i], newLevel)) return false;
|
|
15
|
-
return true;
|
|
16
|
-
}
|
|
17
|
-
if (a && b && typeof a === "object" && typeof b === "object") {
|
|
18
|
-
const keys = Object.keys(a);
|
|
19
|
-
if (keys.length !== Object.keys(b).length) return false;
|
|
20
|
-
return keys.every((key) => deepEqual(a[key], b[key], newLevel));
|
|
21
|
-
}
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
return deepEqual(obj1, obj2);
|
|
25
|
-
}
|
|
26
|
-
var isEqual_default = isEqual;
|
|
27
|
-
exports.isEqual_default = isEqual_default;
|
package/dist/util/dist/omit.cjs
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
var propList = `accept acceptCharset accessKey action allowFullScreen allowTransparency
|
|
2
|
-
alt async autoComplete autoFocus autoPlay capture cellPadding cellSpacing challenge
|
|
3
|
-
charSet checked classID className colSpan cols content contentEditable contextMenu
|
|
4
|
-
controls coords crossOrigin data dateTime default defer dir disabled download draggable
|
|
5
|
-
encType form formAction formEncType formMethod formNoValidate formTarget frameBorder
|
|
6
|
-
headers height hidden high href hrefLang htmlFor httpEquiv icon id inputMode integrity
|
|
7
|
-
is keyParams keyType kind label lang list loop low manifest marginHeight marginWidth max maxLength media
|
|
8
|
-
mediaGroup method min minLength multiple muted name noValidate nonce open
|
|
9
|
-
optimum pattern placeholder poster preload radioGroup readOnly rel required
|
|
10
|
-
reversed role rowSpan rows sandbox scope scoped scrolling seamless selected
|
|
11
|
-
shape size sizes span spellCheck src srcDoc srcLang srcSet start step style
|
|
12
|
-
summary tabIndex target title type useMap value width wmode wrap onCopy onCut onPaste onCompositionEnd onCompositionStart onCompositionUpdate onKeyDown
|
|
13
|
-
onKeyPress onKeyUp onFocus onBlur onChange onInput onSubmit onClick onContextMenu onDoubleClick
|
|
14
|
-
onDrag onDragEnd onDragEnter onDragExit onDragLeave onDragOver onDragStart onDrop onMouseDown
|
|
15
|
-
onMouseEnter onMouseLeave onMouseMove onMouseOut onMouseOver onMouseUp onSelect onTouchCancel
|
|
16
|
-
onTouchEnd onTouchMove onTouchStart onScroll onWheel onAbort onCanPlay onCanPlayThrough
|
|
17
|
-
onDurationChange onEmptied onEncrypted onEnded onError onLoadedData onLoadedMetadata
|
|
18
|
-
onLoadStart onPause onPlay onPlaying onProgress onRateChange onSeeked onSeeking onStalled onSuspend onTimeUpdate onVolumeChange onWaiting onLoad onError`.split(/\s+/);
|
|
19
|
-
var ariaPrefix = "aria-";
|
|
20
|
-
var dataPrefix = "data-";
|
|
21
|
-
function match(key, prefix) {
|
|
22
|
-
return key.indexOf(prefix) === 0;
|
|
23
|
-
}
|
|
24
|
-
function pickAttrs(props, ariaOnly = false) {
|
|
25
|
-
let mergedConfig;
|
|
26
|
-
if (ariaOnly === false) mergedConfig = {
|
|
27
|
-
aria: true,
|
|
28
|
-
data: true,
|
|
29
|
-
attr: true
|
|
30
|
-
};
|
|
31
|
-
else if (ariaOnly === true) mergedConfig = { aria: true };
|
|
32
|
-
else mergedConfig = { ...ariaOnly };
|
|
33
|
-
const attrs = {};
|
|
34
|
-
Object.keys(props).forEach((key) => {
|
|
35
|
-
if (mergedConfig.aria && (key === "role" || match(key, ariaPrefix)) || mergedConfig.data && match(key, dataPrefix) || mergedConfig.attr && propList.includes(key)) attrs[key] = props[key];
|
|
36
|
-
});
|
|
37
|
-
return attrs;
|
|
38
|
-
}
|
|
39
|
-
exports.pickAttrs = pickAttrs;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
const require_omit = require("../omit.cjs");
|
|
2
|
-
let vue = require("vue");
|
|
3
|
-
function isEmptyElement(c) {
|
|
4
|
-
return c && (c.type === vue.Comment || c.type === vue.Fragment && c.children.length === 0 || c.type === vue.Text && c.children.trim() === "");
|
|
5
|
-
}
|
|
6
|
-
function filterEmpty(children = []) {
|
|
7
|
-
if (!Array.isArray(children)) children = [children];
|
|
8
|
-
const res = [];
|
|
9
|
-
children.forEach((child) => {
|
|
10
|
-
if (Array.isArray(child)) res.push(...child);
|
|
11
|
-
else if (child?.type === vue.Fragment) res.push(...filterEmpty(child.children));
|
|
12
|
-
else res.push(child);
|
|
13
|
-
});
|
|
14
|
-
return res.filter((c) => !isEmptyElement(c));
|
|
15
|
-
}
|
|
16
|
-
var defaultOptions = {
|
|
17
|
-
class: true,
|
|
18
|
-
style: true
|
|
19
|
-
};
|
|
20
|
-
function pureAttrs(attrs, options = defaultOptions) {
|
|
21
|
-
const enableClass = options.class ?? defaultOptions.class;
|
|
22
|
-
const enableStyle = options.style ?? defaultOptions.style;
|
|
23
|
-
const newAttrs = { ...attrs };
|
|
24
|
-
if (enableClass) delete newAttrs.class;
|
|
25
|
-
if (enableStyle) delete newAttrs.style;
|
|
26
|
-
if (options.omits && options.omits.length > 0) return require_omit.omit(newAttrs, options.omits);
|
|
27
|
-
return newAttrs;
|
|
28
|
-
}
|
|
29
|
-
function getAttrStyleAndClass(attrs, options) {
|
|
30
|
-
return {
|
|
31
|
-
className: attrs.class,
|
|
32
|
-
style: attrs.style,
|
|
33
|
-
restAttrs: pureAttrs(attrs, options)
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
function getStylePxValue(value) {
|
|
37
|
-
if (typeof value === "number") return `${value}px`;
|
|
38
|
-
else if (typeof value === "string") {
|
|
39
|
-
const trimed = value.trim();
|
|
40
|
-
if (Number.isNaN(Number(trimed))) return trimed;
|
|
41
|
-
else return `${Number(trimed)}px`;
|
|
42
|
-
}
|
|
43
|
-
return value;
|
|
44
|
-
}
|
|
45
|
-
exports.filterEmpty = filterEmpty;
|
|
46
|
-
exports.getAttrStyleAndClass = getAttrStyleAndClass;
|
|
47
|
-
exports.getStylePxValue = getStylePxValue;
|
package/dist/util/dist/raf.cjs
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
var raf = (callback) => +setTimeout(callback, 16);
|
|
2
|
-
var caf = (num) => clearTimeout(num);
|
|
3
|
-
if (typeof window !== "undefined" && "requestAnimationFrame" in window) {
|
|
4
|
-
raf = (callback) => window.requestAnimationFrame(callback);
|
|
5
|
-
caf = (handle) => window.cancelAnimationFrame(handle);
|
|
6
|
-
}
|
|
7
|
-
var rafUUID = 0;
|
|
8
|
-
var rafIds = /* @__PURE__ */ new Map();
|
|
9
|
-
function cleanup(id) {
|
|
10
|
-
rafIds.delete(id);
|
|
11
|
-
}
|
|
12
|
-
function wrapperRaf(callback, times = 1) {
|
|
13
|
-
rafUUID += 1;
|
|
14
|
-
const id = rafUUID;
|
|
15
|
-
function callRef(leftTimes) {
|
|
16
|
-
if (leftTimes === 0) {
|
|
17
|
-
cleanup(id);
|
|
18
|
-
callback();
|
|
19
|
-
} else {
|
|
20
|
-
const realId = raf(() => {
|
|
21
|
-
callRef(leftTimes - 1);
|
|
22
|
-
});
|
|
23
|
-
rafIds.set(id, realId);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
callRef(times);
|
|
27
|
-
return id;
|
|
28
|
-
}
|
|
29
|
-
wrapperRaf.cancel = (id) => {
|
|
30
|
-
const realId = rafIds.get(id);
|
|
31
|
-
cleanup(id);
|
|
32
|
-
return caf(realId);
|
|
33
|
-
};
|
|
34
|
-
if (process.env.NODE_ENV !== "production") wrapperRaf.ids = () => rafIds;
|
|
35
|
-
var raf_default = wrapperRaf;
|
|
36
|
-
exports.raf_default = raf_default;
|
package/dist/util/dist/type.cjs
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const require_type = require("../type.cjs");
|
|
2
|
-
let vue = require("vue");
|
|
3
|
-
require_type.tuple("bottomLeft", "bottomRight", "topLeft", "topRight");
|
|
4
|
-
function getTransitionProps(transitionName, opt = {}) {
|
|
5
|
-
if (!transitionName) return {};
|
|
6
|
-
return transitionName ? {
|
|
7
|
-
name: transitionName,
|
|
8
|
-
appear: true,
|
|
9
|
-
enterFromClass: `${transitionName} ${transitionName}-enter ${transitionName}-appear ${transitionName}-appear-prepare ${transitionName}-enter-prepare ${transitionName}-enter-start`,
|
|
10
|
-
enterActiveClass: `${transitionName} ${transitionName}-enter ${transitionName}-appear ${transitionName}-appear-prepare ${transitionName}-enter-prepare `,
|
|
11
|
-
enterToClass: `${transitionName} ${transitionName}-enter ${transitionName}-appear ${transitionName}-appear-active ${transitionName}-enter-active`,
|
|
12
|
-
leaveFromClass: `${transitionName} ${transitionName}-leave`,
|
|
13
|
-
leaveActiveClass: `${transitionName} ${transitionName}-leave ${transitionName}-leave-active`,
|
|
14
|
-
leaveToClass: `${transitionName} ${transitionName}-leave ${transitionName}-leave-active`,
|
|
15
|
-
...opt
|
|
16
|
-
} : {
|
|
17
|
-
css: false,
|
|
18
|
-
...opt
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
exports.getTransitionProps = getTransitionProps;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
var warned = {};
|
|
2
|
-
var preWarningFns = [];
|
|
3
|
-
function preMessage(fn) {
|
|
4
|
-
preWarningFns.push(fn);
|
|
5
|
-
}
|
|
6
|
-
function warning(valid, message) {
|
|
7
|
-
if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
|
|
8
|
-
const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "warning"), message);
|
|
9
|
-
if (finalMessage) console.error(`Warning: ${finalMessage}`);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
function note(valid, message) {
|
|
13
|
-
if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
|
|
14
|
-
const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "note"), message);
|
|
15
|
-
if (finalMessage) console.warn(`Note: ${finalMessage}`);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
function resetWarned() {
|
|
19
|
-
warned = {};
|
|
20
|
-
}
|
|
21
|
-
function call(method, valid, message) {
|
|
22
|
-
if (!valid && !warned[message]) {
|
|
23
|
-
method(false, message);
|
|
24
|
-
warned[message] = true;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
function warningOnce(valid, message) {
|
|
28
|
-
call(warning, valid, message);
|
|
29
|
-
}
|
|
30
|
-
function noteOnce(valid, message) {
|
|
31
|
-
call(note, valid, message);
|
|
32
|
-
}
|
|
33
|
-
warningOnce.preMessage = preMessage;
|
|
34
|
-
warningOnce.resetWarned = resetWarned;
|
|
35
|
-
warningOnce.noteOnce = noteOnce;
|
|
36
|
-
var warning_default = warningOnce;
|
|
37
|
-
exports.warning_default = warning_default;
|
package/dist/util.cjs
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
function isImageValid(src) {
|
|
3
|
-
return new Promise((resolve) => {
|
|
4
|
-
if (!src) {
|
|
5
|
-
resolve(false);
|
|
6
|
-
return;
|
|
7
|
-
}
|
|
8
|
-
const isTestEnv = typeof process !== "undefined" && process.env.NODE_ENV === "test";
|
|
9
|
-
const isJSDomUA = typeof navigator !== "undefined" && /jsdom/i.test(navigator.userAgent);
|
|
10
|
-
if (isTestEnv || isJSDomUA) {
|
|
11
|
-
resolve(/^(https?:)?\/\//.test(src) || /^(data|blob):/.test(src) || src.startsWith("/") || src.startsWith("./") || src.startsWith("../"));
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
const img = document.createElement("img");
|
|
15
|
-
img.onerror = () => resolve(false);
|
|
16
|
-
img.onload = () => resolve(true);
|
|
17
|
-
img.src = src;
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
function getClientSize() {
|
|
21
|
-
return {
|
|
22
|
-
width: document.documentElement.clientWidth,
|
|
23
|
-
height: window.innerHeight || document.documentElement.clientHeight
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
exports.getClientSize = getClientSize;
|
|
27
|
-
exports.isImageValid = isImageValid;
|