@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.
Files changed (52) hide show
  1. package/dist/Image.js +1 -1
  2. package/dist/Preview/index.js +1 -1
  3. package/dist/portal/dist/Portal.js +3 -2
  4. package/dist/util/dist/Dom/findDOMNode.js +20 -0
  5. package/dist/util/dist/getScrollBarSize.js +42 -44
  6. package/package.json +12 -12
  7. package/LICENSE +0 -21
  8. package/dist/Image.cjs +0 -231
  9. package/dist/Preview/CloseBtn.cjs +0 -44
  10. package/dist/Preview/Footer.cjs +0 -234
  11. package/dist/Preview/PrevNext.cjs +0 -59
  12. package/dist/Preview/index.cjs +0 -404
  13. package/dist/PreviewGroup.cjs +0 -138
  14. package/dist/common.cjs +0 -13
  15. package/dist/context.cjs +0 -11
  16. package/dist/getFixScaleEleTransPosition.cjs +0 -28
  17. package/dist/hooks/useImageTransform.cjs +0 -99
  18. package/dist/hooks/useMouseEvent.cjs +0 -96
  19. package/dist/hooks/usePreviewItems.cjs +0 -48
  20. package/dist/hooks/useRegisterImage.cjs +0 -28
  21. package/dist/hooks/useStatus.cjs +0 -49
  22. package/dist/hooks/useTouchEvent.cjs +0 -125
  23. package/dist/index.cjs +0 -11
  24. package/dist/interface.cjs +0 -1
  25. package/dist/portal/dist/Context.cjs +0 -12
  26. package/dist/portal/dist/Portal.cjs +0 -100
  27. package/dist/portal/dist/index.cjs +0 -3
  28. package/dist/portal/dist/useDom.cjs +0 -47
  29. package/dist/portal/dist/useEscKeyDown.cjs +0 -57
  30. package/dist/portal/dist/useScrollLocker.cjs +0 -28
  31. package/dist/portal/dist/util.cjs +0 -4
  32. package/dist/previewConfig.cjs +0 -5
  33. package/dist/util/dist/Dom/canUseDom.cjs +0 -4
  34. package/dist/util/dist/Dom/contains.cjs +0 -11
  35. package/dist/util/dist/Dom/dynamicCSS.cjs +0 -80
  36. package/dist/util/dist/KeyCode.cjs +0 -81
  37. package/dist/util/dist/RenderComponent.cjs +0 -29
  38. package/dist/util/dist/classnames.cjs +0 -36
  39. package/dist/util/dist/getScrollBarSize.cjs +0 -53
  40. package/dist/util/dist/hooks/useControlledState.cjs +0 -1
  41. package/dist/util/dist/hooks/useId.cjs +0 -5
  42. package/dist/util/dist/hooks/useMergedState.cjs +0 -24
  43. package/dist/util/dist/index.cjs +0 -8
  44. package/dist/util/dist/isEqual.cjs +0 -27
  45. package/dist/util/dist/omit.cjs +0 -8
  46. package/dist/util/dist/pickAttrs.cjs +0 -39
  47. package/dist/util/dist/props-util/index.cjs +0 -47
  48. package/dist/util/dist/raf.cjs +0 -36
  49. package/dist/util/dist/type.cjs +0 -2
  50. package/dist/util/dist/utils/transition.cjs +0 -21
  51. package/dist/util/dist/warning.cjs +0 -37
  52. package/dist/util.cjs +0 -27
@@ -1,100 +0,0 @@
1
- const require_index = require("../../util/dist/props-util/index.cjs");
2
- const require_warning = require("../../util/dist/warning.cjs");
3
- require("../../util/dist/index.cjs");
4
- const require_Context = require("./Context.cjs");
5
- const require_canUseDom = require("../../util/dist/Dom/canUseDom.cjs");
6
- const require_useDom = require("./useDom.cjs");
7
- const require_useEscKeyDown = require("./useEscKeyDown.cjs");
8
- const require_useScrollLocker = require("./useScrollLocker.cjs");
9
- let vue = require("vue");
10
- function _isSlot(s) {
11
- return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, vue.isVNode)(s);
12
- }
13
- function getPortalContainer(getContainer) {
14
- if (getContainer === false) return false;
15
- if (!require_canUseDom.canUseDom() || !getContainer) return null;
16
- if (typeof getContainer === "string") return document.querySelector(getContainer);
17
- if (typeof getContainer === "function") return getContainer();
18
- return getContainer;
19
- }
20
- var Portal_default = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, expose }) => {
21
- const shouldRender = (0, vue.shallowRef)(props.open);
22
- const mergedRender = (0, vue.computed)(() => shouldRender.value || props.open);
23
- if (process.env.NODE_ENV !== "production") require_warning.warning_default(require_canUseDom.canUseDom() || !props.open, `Portal only work in client side. Please call 'useEffect' to show Portal instead default render in SSR.`);
24
- (0, vue.watch)([() => props.open, () => props.autoDestroy], () => {
25
- if (props.autoDestroy || props.open) shouldRender.value = props.open;
26
- });
27
- const innerContainer = (0, vue.shallowRef)(getPortalContainer(props.getContainer));
28
- (0, vue.onMounted)(() => {
29
- innerContainer.value = getPortalContainer(props.getContainer) ?? null;
30
- });
31
- (0, vue.watch)(() => props.getContainer, () => {
32
- innerContainer.value = getPortalContainer(props.getContainer) ?? null;
33
- });
34
- const [defaultContainer, queueCreate] = require_useDom.useDom((0, vue.computed)(() => !!(mergedRender.value && !innerContainer.value)), props.debug);
35
- require_Context.useContextProvider(queueCreate);
36
- const mergedContainer = (0, vue.computed)(() => innerContainer.value ?? defaultContainer);
37
- require_useScrollLocker.useScrollLocker((0, vue.computed)(() => !!(props.autoLock && props.open && require_canUseDom.canUseDom() && (mergedContainer.value === defaultContainer || mergedContainer.value === document.body))));
38
- require_useEscKeyDown.useEscKeyDown((0, vue.computed)(() => !!props.open), (...args) => {
39
- props.onEsc?.(...args);
40
- });
41
- const elementEl = (0, vue.shallowRef)();
42
- const setRef = (el) => {
43
- elementEl.value = el;
44
- };
45
- expose({ elementEl });
46
- return () => {
47
- if (!mergedRender.value || !require_canUseDom.canUseDom() || innerContainer.value === void 0) return null;
48
- const renderInline = mergedContainer.value === false;
49
- const reffedChildren = require_index.filterEmpty(slots.default?.() ?? []);
50
- if (renderInline) return reffedChildren;
51
- else {
52
- const child = reffedChildren.length === 1 ? (0, vue.isVNode)(reffedChildren[0]) ? (0, vue.createVNode)(reffedChildren[0], { ref: setRef }) : reffedChildren[0] : reffedChildren;
53
- return (0, vue.createVNode)(vue.Teleport, { "to": mergedContainer.value }, _isSlot(child) ? child : { default: () => [child] });
54
- }
55
- };
56
- }, {
57
- props: /* @__PURE__ */ (0, vue.mergeDefaults)({
58
- getContainer: {
59
- type: [
60
- String,
61
- Function,
62
- Boolean
63
- ],
64
- required: false,
65
- skipCheck: true,
66
- default: void 0
67
- },
68
- open: {
69
- type: Boolean,
70
- required: false,
71
- default: void 0
72
- },
73
- autoDestroy: {
74
- type: Boolean,
75
- required: false,
76
- default: void 0
77
- },
78
- autoLock: {
79
- type: Boolean,
80
- required: false,
81
- default: void 0
82
- },
83
- onEsc: {
84
- type: Function,
85
- required: false,
86
- default: void 0
87
- },
88
- debug: {
89
- type: String,
90
- required: false,
91
- default: void 0
92
- }
93
- }, {
94
- autoDestroy: true,
95
- getContainer: void 0
96
- }),
97
- name: "Portal",
98
- inheritAttrs: false
99
- });
100
- exports.Portal_default = Portal_default;
@@ -1,3 +0,0 @@
1
- const require_Portal = require("./Portal.cjs");
2
- var src_default = require_Portal.Portal_default;
3
- exports.src_default = src_default;
@@ -1,47 +0,0 @@
1
- const require_Context = require("./Context.cjs");
2
- const require_canUseDom = require("../../util/dist/Dom/canUseDom.cjs");
3
- let vue = require("vue");
4
- var EMPTY_LIST = [];
5
- function useDom(render, debug) {
6
- const eleFun = () => {
7
- if (!require_canUseDom.canUseDom()) return null;
8
- const defaultEle = document.createElement("div");
9
- if (process.env.NODE_ENV !== "production" && debug) defaultEle.setAttribute("data-debug", debug);
10
- return defaultEle;
11
- };
12
- const ele = eleFun();
13
- const appendedRef = (0, vue.shallowRef)(false);
14
- const queueCreate = require_Context.useContextState();
15
- const queue = (0, vue.shallowRef)([]);
16
- const mergedQueueCreate = (0, vue.computed)(() => queueCreate?.value || (appendedRef.value ? void 0 : (appendFn) => {
17
- queue.value = [appendFn, ...queue.value];
18
- }));
19
- function append() {
20
- if (!ele?.parentElement) document.body.appendChild(ele);
21
- appendedRef.value = true;
22
- }
23
- function cleanup() {
24
- if (ele?.parentElement) ele?.parentElement?.removeChild(ele);
25
- else if (ele && appendedRef.value) document.body?.removeChild?.(ele);
26
- appendedRef.value = false;
27
- }
28
- (0, vue.watch)(render, () => {
29
- if (render.value) if (queueCreate?.value) queueCreate.value(append);
30
- else append();
31
- else (0, vue.nextTick)(() => {
32
- cleanup();
33
- });
34
- }, { immediate: true });
35
- (0, vue.onUnmounted)(cleanup);
36
- (0, vue.watch)(queue, () => {
37
- if (queue.value.length) {
38
- queue.value.forEach((fn) => fn());
39
- queue.value = [...EMPTY_LIST];
40
- }
41
- }, {
42
- flush: "post",
43
- immediate: true
44
- });
45
- return [ele, mergedQueueCreate];
46
- }
47
- exports.useDom = useDom;
@@ -1,57 +0,0 @@
1
- let vue = require("vue");
2
- var stack = [];
3
- var IME_LOCK_DURATION = 200;
4
- var lastCompositionEndTime = 0;
5
- var _test = process.env.NODE_ENV === "test" ? () => ({
6
- stack,
7
- reset: () => {
8
- lastCompositionEndTime = 0;
9
- }
10
- }) : null;
11
- function onGlobalKeyDown(event) {
12
- if (event.key === "Escape" && !event.isComposing) {
13
- if (Date.now() - lastCompositionEndTime < IME_LOCK_DURATION) return;
14
- const len = stack.length;
15
- for (let i = len - 1; i >= 0; i -= 1) stack?.[i]?.onEsc?.({
16
- top: i === len - 1,
17
- event
18
- });
19
- }
20
- }
21
- function onGlobalCompositionEnd() {
22
- lastCompositionEndTime = Date.now();
23
- }
24
- function attachGlobalEventListeners() {
25
- window.addEventListener("keydown", onGlobalKeyDown);
26
- window.addEventListener("compositionend", onGlobalCompositionEnd);
27
- }
28
- function detachGlobalEventListeners() {
29
- if (stack.length === 0) {
30
- window.removeEventListener("keydown", onGlobalKeyDown);
31
- window.removeEventListener("compositionend", onGlobalCompositionEnd);
32
- }
33
- }
34
- function useEscKeyDown(open, onEsc = () => {}) {
35
- const id = (0, vue.useId)();
36
- const onEventEsc = onEsc;
37
- const ensure = () => {
38
- if (!stack.find((item) => item.id === id)) stack.push({
39
- id,
40
- onEsc: onEventEsc
41
- });
42
- };
43
- const clear = () => {
44
- stack = stack.filter((item) => item.id !== id);
45
- };
46
- (0, vue.watch)(open, (_, _o, onCleanup) => {
47
- if (open.value) {
48
- ensure();
49
- attachGlobalEventListeners();
50
- onCleanup(() => {
51
- clear();
52
- detachGlobalEventListeners();
53
- });
54
- } else if (!open.value) clear();
55
- }, { immediate: true });
56
- }
57
- exports.useEscKeyDown = useEscKeyDown;
@@ -1,28 +0,0 @@
1
- const require_util = require("./util.cjs");
2
- const require_dynamicCSS = require("../../util/dist/Dom/dynamicCSS.cjs");
3
- const require_getScrollBarSize = require("../../util/dist/getScrollBarSize.cjs");
4
- let vue = require("vue");
5
- var UNIQUE_ID = `vc-util-locker-${Date.now()}`;
6
- var uuid = 0;
7
- function useScrollLocker(lock) {
8
- const mergedLock = (0, vue.computed)(() => (0, vue.unref)(lock));
9
- uuid += 1;
10
- const id = (0, vue.shallowRef)(`${UNIQUE_ID}_${uuid}`);
11
- (0, vue.watch)([id, mergedLock], async (_, _o, onCleanup) => {
12
- if (mergedLock.value) {
13
- const scrollbarSize = require_getScrollBarSize.getTargetScrollBarSize(document.body).width;
14
- require_dynamicCSS.updateCSS(`
15
- html body {
16
- overflow-y: hidden;
17
- ${require_util.isBodyOverflowing() ? `width: calc(100% - ${scrollbarSize}px);` : ""}
18
- }`, id.value);
19
- onCleanup(() => {
20
- require_dynamicCSS.removeCSS(id.value);
21
- });
22
- } else require_dynamicCSS.removeCSS(id.value);
23
- }, {
24
- flush: "post",
25
- immediate: true
26
- });
27
- }
28
- exports.useScrollLocker = useScrollLocker;
@@ -1,4 +0,0 @@
1
- function isBodyOverflowing() {
2
- return document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight) && window.innerWidth > document.body.offsetWidth;
3
- }
4
- exports.isBodyOverflowing = isBodyOverflowing;
@@ -1,5 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const BASE_SCALE_RATIO = 1;
3
- const WHEEL_MAX_SCALE_RATIO = 1;
4
- exports.BASE_SCALE_RATIO = BASE_SCALE_RATIO;
5
- exports.WHEEL_MAX_SCALE_RATIO = WHEEL_MAX_SCALE_RATIO;
@@ -1,4 +0,0 @@
1
- function canUseDom() {
2
- return !!(typeof window !== "undefined" && window.document && window.document.createElement);
3
- }
4
- exports.canUseDom = canUseDom;
@@ -1,11 +0,0 @@
1
- function contains(root, n) {
2
- if (!root) return false;
3
- if (root.contains) return root.contains(n);
4
- let node = n;
5
- while (node) {
6
- if (node === root) return true;
7
- node = node.parentNode;
8
- }
9
- return false;
10
- }
11
- exports.contains = contains;
@@ -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 +0,0 @@
1
- let vue = require("vue");
@@ -1,5 +0,0 @@
1
- let vue = require("vue");
2
- function getUseId() {
3
- return vue.useId;
4
- }
5
- var useOriginalId = getUseId();
@@ -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;
@@ -1,8 +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/useControlledState.cjs");
6
- require("./hooks/useId.cjs");
7
- const require_useMergedState = require("./hooks/useMergedState.cjs");
8
- 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;
@@ -1,8 +0,0 @@
1
- function omit(obj, fields) {
2
- const clone = { ...obj };
3
- if (Array.isArray(fields)) fields.forEach((key) => {
4
- delete clone[key];
5
- });
6
- return clone;
7
- }
8
- exports.omit = omit;
@@ -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;