@v-c/image 1.0.1 → 1.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/Image.js +1 -1
- package/dist/Preview/index.js +1 -1
- package/dist/portal/dist/Portal.js +3 -2
- package/dist/util/dist/Dom/findDOMNode.js +20 -0
- package/dist/util/dist/getScrollBarSize.js +42 -44
- package/package.json +12 -12
- package/LICENSE +0 -21
- 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/useControlledState.cjs +0 -1
- 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 -8
- 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,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;
|