@v-c/image 1.0.6 → 1.0.7

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 CHANGED
@@ -1,14 +1,13 @@
1
- import { getAttrStyleAndClass, getStylePxValue } from "./util/dist/props-util/index.js";
2
- import { clsx } from "./util/dist/classnames.js";
3
1
  import { useMergedState } from "./util/dist/hooks/useMergedState.js";
4
- import "./util/dist/index.js";
5
2
  import { pickAttrs } from "./util/dist/pickAttrs.js";
3
+ import { getAttrStyleAndClass, getStylePxValue } from "./util/dist/props-util/index.js";
6
4
  import { COMMON_PROPS } from "./common.js";
7
5
  import { usePreviewGroupContext } from "./context.js";
8
6
  import useRegisterImage from "./hooks/useRegisterImage.js";
9
7
  import useStatus from "./hooks/useStatus.js";
10
8
  import Preview_default from "./Preview/index.js";
11
9
  import { Fragment, computed, createVNode, defineComponent, mergeDefaults, mergeProps, shallowRef } from "vue";
10
+ import { clsx } from "@v-c/util";
12
11
  var Image_default = /* @__PURE__ */ defineComponent((props, { attrs, slots }) => {
13
12
  const groupContext = usePreviewGroupContext();
14
13
  const prefixCls = computed(() => props.prefixCls ?? "vc-image");
@@ -1,6 +1,5 @@
1
- import { clsx } from "../util/dist/classnames.js";
2
- import "../util/dist/index.js";
3
1
  import { createVNode, defineComponent } from "vue";
2
+ import { clsx } from "@v-c/util";
4
3
  var Footer_default = /* @__PURE__ */ defineComponent((props) => {
5
4
  const renderOperation = ({ type, disabled, onClick, icon }) => {
6
5
  const actionCls = `${props.prefixCls}-actions-action`;
@@ -1,6 +1,5 @@
1
- import { clsx } from "../util/dist/classnames.js";
2
- import "../util/dist/index.js";
3
1
  import { Fragment, createVNode, defineComponent } from "vue";
2
+ import { clsx } from "@v-c/util";
4
3
  var PrevNext_default = /* @__PURE__ */ defineComponent((props) => {
5
4
  return () => {
6
5
  const { prefixCls, onActive, current, count, icons } = props;
@@ -1,10 +1,7 @@
1
- import { KeyCodeStr } from "../util/dist/KeyCode.js";
2
- import { clsx } from "../util/dist/classnames.js";
3
- import "../util/dist/index.js";
4
1
  import { usePreviewGroupContext } from "../context.js";
5
2
  import useStatus from "../hooks/useStatus.js";
6
3
  import { canUseDom } from "../util/dist/Dom/canUseDom.js";
7
- import { src_default } from "../portal/dist/index.js";
4
+ import { KeyCodeStr } from "../util/dist/KeyCode.js";
8
5
  import { getTransitionProps } from "../util/dist/utils/transition.js";
9
6
  import useImageTransform from "../hooks/useImageTransform.js";
10
7
  import { BASE_SCALE_RATIO } from "../previewConfig.js";
@@ -14,6 +11,8 @@ import CloseBtn_default from "./CloseBtn.js";
14
11
  import Footer_default from "./Footer.js";
15
12
  import PrevNext_default from "./PrevNext.js";
16
13
  import { Transition, computed, createVNode, defineComponent, mergeDefaults, mergeProps, nextTick, shallowRef, watch, watchEffect } from "vue";
14
+ import { clsx } from "@v-c/util";
15
+ import Portal from "@v-c/portal";
17
16
  var Preview_default = /* @__PURE__ */ defineComponent((props, { attrs, slots }) => {
18
17
  const imgEl = shallowRef();
19
18
  const groupContext = usePreviewGroupContext();
@@ -152,7 +151,7 @@ var Preview_default = /* @__PURE__ */ defineComponent((props, { attrs, slots })
152
151
  if (zIndex) mergedRootStyle.zIndex = zIndex;
153
152
  const mergedRootCls = clsx(prefixCls, rootClassName, classNames.root, { [`${prefixCls}-moving`]: isMoving.value });
154
153
  const transitionProps = getTransitionProps(motionName);
155
- return createVNode(src_default, {
154
+ return createVNode(Portal, {
156
155
  "open": open || animatedVisible.value || portalRender.value,
157
156
  "getContainer": getContainer,
158
157
  "autoLock": open || animatedVisible.value
@@ -1,6 +1,6 @@
1
- import { raf_default } from "../util/dist/raf.js";
2
1
  import { getClientSize } from "../util.js";
3
2
  import { isEqual_default } from "../util/dist/isEqual.js";
3
+ import { raf_default } from "../util/dist/raf.js";
4
4
  import { ref, shallowRef } from "vue";
5
5
  var initialTransform = {
6
6
  x: 0,
@@ -1,9 +1,8 @@
1
- import { warning_default } from "../util/dist/warning.js";
2
- import "../util/dist/index.js";
3
1
  import { canUseDom } from "../util/dist/Dom/canUseDom.js";
4
2
  import getFixScaleEleTransPosition from "../getFixScaleEleTransPosition.js";
5
3
  import { BASE_SCALE_RATIO, WHEEL_MAX_SCALE_RATIO } from "../previewConfig.js";
6
4
  import { shallowRef, watch } from "vue";
5
+ import { warning } from "@v-c/util";
7
6
  function useMouseEvent(imgRef, movable, open, scaleStep, transform, updateTransform, dispatchZoomChange) {
8
7
  const isMoving = shallowRef(false);
9
8
  const startPositionInfo = shallowRef({
@@ -69,7 +68,7 @@ function useMouseEvent(imgRef, movable, open, scaleStep, transform, updateTransf
69
68
  window?.top?.addEventListener("mousemove", onMouseMove, false);
70
69
  }
71
70
  } catch (e) {
72
- warning_default(false, `[vc-image] ${e}`);
71
+ warning(false, `[vc-image] ${e}`);
73
72
  }
74
73
  onCleanup(() => {
75
74
  window.removeEventListener("mouseup", onMouseUp);
@@ -1,18 +1,5 @@
1
1
  import { omit } from "../omit.js";
2
- import { Comment, Fragment, Text, isVNode, toRef } from "vue";
3
- function isEmptyElement(c) {
4
- return c && (c.type === Comment || c.type === Fragment && c.children.length === 0 || c.type === 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 === Fragment) res.push(...filterEmpty(child.children));
12
- else res.push(child);
13
- });
14
- return res.filter((c) => !isEmptyElement(c));
15
- }
2
+ import { Fragment, toRef } from "vue";
16
3
  var defaultOptions = {
17
4
  class: true,
18
5
  style: true
@@ -42,4 +29,4 @@ function getStylePxValue(value) {
42
29
  }
43
30
  return value;
44
31
  }
45
- export { filterEmpty, getAttrStyleAndClass, getStylePxValue };
32
+ export { getAttrStyleAndClass, getStylePxValue };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@v-c/image",
3
3
  "type": "module",
4
- "version": "1.0.6",
4
+ "version": "1.0.7",
5
5
  "description": "image component",
6
6
  "author": "",
7
7
  "license": "MIT",
@@ -32,8 +32,8 @@
32
32
  "vue": "^3.0.0"
33
33
  },
34
34
  "dependencies": {
35
- "@v-c/portal": "^1.0.8",
36
- "@v-c/util": "^1.0.18"
35
+ "@v-c/util": "^1.0.19",
36
+ "@v-c/portal": "^1.0.8"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@ant-design/icons-vue": "^7.0.1"
@@ -1,11 +0,0 @@
1
- import { inject, provide } from "vue";
2
- var QueueContextKey = Symbol("QueueContextKey");
3
- function useContextProvider(appendFunc) {
4
- const queueCreate = appendFunc;
5
- provide(QueueContextKey, queueCreate);
6
- return queueCreate;
7
- }
8
- function useContextState() {
9
- return inject(QueueContextKey, void 0);
10
- }
11
- export { useContextProvider, useContextState };
@@ -1,101 +0,0 @@
1
- import { filterEmpty } from "../../util/dist/props-util/index.js";
2
- import { warning_default } from "../../util/dist/warning.js";
3
- import "../../util/dist/index.js";
4
- import { useContextProvider } from "./Context.js";
5
- import { canUseDom } from "../../util/dist/Dom/canUseDom.js";
6
- import { useDom } from "./useDom.js";
7
- import { useEscKeyDown } from "./useEscKeyDown.js";
8
- import { useScrollLocker } from "./useScrollLocker.js";
9
- import { getDOM } from "../../util/dist/Dom/findDOMNode.js";
10
- import { Teleport, computed, createVNode, defineComponent, isVNode, mergeDefaults, onMounted, shallowRef, watch } from "vue";
11
- function _isSlot(s) {
12
- return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
13
- }
14
- function getPortalContainer(getContainer) {
15
- if (getContainer === false) return false;
16
- if (!canUseDom() || !getContainer) return null;
17
- if (typeof getContainer === "string") return document.querySelector(getContainer);
18
- if (typeof getContainer === "function") return getDOM(getContainer());
19
- return typeof getContainer === "object" ? getDOM(getContainer) : getContainer;
20
- }
21
- var Portal_default = /* @__PURE__ */ defineComponent((props, { slots, expose }) => {
22
- const shouldRender = shallowRef(props.open);
23
- const mergedRender = computed(() => shouldRender.value || props.open);
24
- if (process.env.NODE_ENV !== "production") warning_default(canUseDom() || !props.open, `Portal only work in client side. Please call 'useEffect' to show Portal instead default render in SSR.`);
25
- watch([() => props.open, () => props.autoDestroy], () => {
26
- if (props.autoDestroy || props.open) shouldRender.value = props.open;
27
- });
28
- const innerContainer = shallowRef(getPortalContainer(props.getContainer));
29
- onMounted(() => {
30
- innerContainer.value = getPortalContainer(props.getContainer) ?? null;
31
- });
32
- watch(() => props.getContainer, () => {
33
- innerContainer.value = getPortalContainer(props.getContainer) ?? null;
34
- });
35
- const [defaultContainer, queueCreate] = useDom(computed(() => !!(mergedRender.value && !innerContainer.value)), props.debug);
36
- useContextProvider(queueCreate);
37
- const mergedContainer = computed(() => innerContainer.value ?? defaultContainer);
38
- useScrollLocker(computed(() => !!(props.autoLock && props.open && canUseDom() && (mergedContainer.value === defaultContainer || mergedContainer.value === document.body))));
39
- useEscKeyDown(computed(() => !!props.open), (...args) => {
40
- props.onEsc?.(...args);
41
- });
42
- const elementEl = shallowRef();
43
- const setRef = (el) => {
44
- elementEl.value = el;
45
- };
46
- expose({ elementEl });
47
- return () => {
48
- if (!mergedRender.value || !canUseDom() || innerContainer.value === void 0) return null;
49
- const renderInline = mergedContainer.value === false;
50
- const reffedChildren = filterEmpty(slots.default?.() ?? []);
51
- if (renderInline) return reffedChildren;
52
- else {
53
- const child = reffedChildren.length === 1 ? isVNode(reffedChildren[0]) ? createVNode(reffedChildren[0], { ref: setRef }) : reffedChildren[0] : reffedChildren;
54
- return createVNode(Teleport, { "to": mergedContainer.value }, _isSlot(child) ? child : { default: () => [child] });
55
- }
56
- };
57
- }, {
58
- props: /* @__PURE__ */ mergeDefaults({
59
- getContainer: {
60
- type: [
61
- String,
62
- Function,
63
- Boolean
64
- ],
65
- required: false,
66
- skipCheck: true,
67
- default: void 0
68
- },
69
- open: {
70
- type: Boolean,
71
- required: false,
72
- default: void 0
73
- },
74
- autoDestroy: {
75
- type: Boolean,
76
- required: false,
77
- default: void 0
78
- },
79
- autoLock: {
80
- type: Boolean,
81
- required: false,
82
- default: void 0
83
- },
84
- onEsc: {
85
- type: Function,
86
- required: false,
87
- default: void 0
88
- },
89
- debug: {
90
- type: String,
91
- required: false,
92
- default: void 0
93
- }
94
- }, {
95
- autoDestroy: true,
96
- getContainer: void 0
97
- }),
98
- name: "Portal",
99
- inheritAttrs: false
100
- });
101
- export { Portal_default };
@@ -1,3 +0,0 @@
1
- import { Portal_default } from "./Portal.js";
2
- var src_default = Portal_default;
3
- export { src_default };
@@ -1,52 +0,0 @@
1
- import { useContextState } from "./Context.js";
2
- import { canUseDom } from "../../util/dist/Dom/canUseDom.js";
3
- import { computed, nextTick, onUnmounted, shallowRef, watch } from "vue";
4
- var EMPTY_LIST = [];
5
- function useDom(render, debug) {
6
- const eleFun = () => {
7
- if (!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 = shallowRef(false);
14
- const queueCreate = useContextState();
15
- const queue = shallowRef([]);
16
- const mergedQueueCreate = computed(() => queueCreate?.value || (appendedRef.value ? void 0 : (appendFn) => {
17
- queue.value = [appendFn, ...queue.value];
18
- }));
19
- function append() {
20
- if (!ele || !canUseDom()) return;
21
- if (!ele?.parentElement) document.body.appendChild(ele);
22
- appendedRef.value = true;
23
- }
24
- function cleanup() {
25
- if (!ele || !canUseDom()) {
26
- appendedRef.value = false;
27
- return;
28
- }
29
- if (ele?.parentElement) ele?.parentElement?.removeChild(ele);
30
- else if (appendedRef.value) document.body?.removeChild?.(ele);
31
- appendedRef.value = false;
32
- }
33
- watch(render, () => {
34
- if (render.value) if (queueCreate?.value) queueCreate.value(append);
35
- else append();
36
- else nextTick(() => {
37
- cleanup();
38
- });
39
- }, { immediate: true });
40
- onUnmounted(cleanup);
41
- watch(queue, () => {
42
- if (queue.value.length) {
43
- queue.value.forEach((fn) => fn());
44
- queue.value = [...EMPTY_LIST];
45
- }
46
- }, {
47
- flush: "post",
48
- immediate: true
49
- });
50
- return [ele, mergedQueueCreate];
51
- }
52
- export { useDom };
@@ -1,54 +0,0 @@
1
- import { canUseDom } from "../../util/dist/Dom/canUseDom.js";
2
- import { useId, watch } from "vue";
3
- var stack = [];
4
- var IME_LOCK_DURATION = 200;
5
- var lastCompositionEndTime = 0;
6
- process.env.NODE_ENV;
7
- function onGlobalKeyDown(event) {
8
- if (event.key === "Escape" && !event.isComposing) {
9
- if (Date.now() - lastCompositionEndTime < IME_LOCK_DURATION) return;
10
- const len = stack.length;
11
- for (let i = len - 1; i >= 0; i -= 1) stack?.[i]?.onEsc?.({
12
- top: i === len - 1,
13
- event
14
- });
15
- }
16
- }
17
- function onGlobalCompositionEnd() {
18
- lastCompositionEndTime = Date.now();
19
- }
20
- function attachGlobalEventListeners() {
21
- if (!canUseDom()) return;
22
- window.addEventListener("keydown", onGlobalKeyDown);
23
- window.addEventListener("compositionend", onGlobalCompositionEnd);
24
- }
25
- function detachGlobalEventListeners() {
26
- if (!canUseDom() || stack.length !== 0) return;
27
- window.removeEventListener("keydown", onGlobalKeyDown);
28
- window.removeEventListener("compositionend", onGlobalCompositionEnd);
29
- }
30
- function useEscKeyDown(open, onEsc = () => {}) {
31
- const id = useId();
32
- const onEventEsc = onEsc;
33
- const ensure = () => {
34
- if (!stack.find((item) => item.id === id)) stack.push({
35
- id,
36
- onEsc: onEventEsc
37
- });
38
- };
39
- const clear = () => {
40
- stack = stack.filter((item) => item.id !== id);
41
- };
42
- watch(open, (_, _o, onCleanup) => {
43
- if (!canUseDom()) return;
44
- if (open.value) {
45
- ensure();
46
- attachGlobalEventListeners();
47
- onCleanup(() => {
48
- clear();
49
- detachGlobalEventListeners();
50
- });
51
- } else if (!open.value) clear();
52
- }, { immediate: true });
53
- }
54
- export { useEscKeyDown };
@@ -1,28 +0,0 @@
1
- import { isBodyOverflowing } from "./util.js";
2
- import { removeCSS, updateCSS } from "../../util/dist/Dom/dynamicCSS.js";
3
- import { getTargetScrollBarSize } from "../../util/dist/getScrollBarSize.js";
4
- import { computed, shallowRef, unref, watch } from "vue";
5
- var UNIQUE_ID = `vc-util-locker-${Date.now()}`;
6
- var uuid = 0;
7
- function useScrollLocker(lock) {
8
- const mergedLock = computed(() => unref(lock));
9
- uuid += 1;
10
- const id = shallowRef(`${UNIQUE_ID}_${uuid}`);
11
- watch([id, mergedLock], async (_, _o, onCleanup) => {
12
- if (mergedLock.value) {
13
- const scrollbarSize = getTargetScrollBarSize(document.body).width;
14
- updateCSS(`
15
- html body {
16
- overflow-y: hidden;
17
- ${isBodyOverflowing() ? `width: calc(100% - ${scrollbarSize}px);` : ""}
18
- }`, id.value);
19
- onCleanup(() => {
20
- removeCSS(id.value);
21
- });
22
- } else removeCSS(id.value);
23
- }, {
24
- flush: "post",
25
- immediate: true
26
- });
27
- }
28
- export { 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
- export { isBodyOverflowing };
@@ -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
- export { contains };
@@ -1,79 +0,0 @@
1
- import { canUseDom } from "./canUseDom.js";
2
- import { contains } from "./contains.js";
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 (!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 (!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 || !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 (!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
- export { removeCSS, updateCSS };
@@ -1,20 +0,0 @@
1
- import { canUseDom } from "./canUseDom.js";
2
- import { unref } from "vue";
3
- function isDOM(node) {
4
- return node instanceof HTMLElement || node instanceof SVGElement;
5
- }
6
- function getDOM(elementRef) {
7
- const unrefElementRef = unref(elementRef);
8
- if (!canUseDom()) return unrefElementRef;
9
- const dom = findDOMNode(unrefElementRef) || (unrefElementRef && typeof unrefElementRef === "object" ? findDOMNode(unrefElementRef.nativeElement) : null);
10
- if (dom && (dom.nodeType === 3 || dom.nodeType === 8) && dom.nextElementSibling) return dom.nextElementSibling;
11
- return dom;
12
- }
13
- function findDOMNode(_node) {
14
- const node = unref(_node);
15
- if (!canUseDom()) return node;
16
- if (isDOM(node)) return node;
17
- else if (node && "$el" in node) return node.$el;
18
- return null;
19
- }
20
- export { getDOM };
@@ -1,29 +0,0 @@
1
- import { filterEmpty } from "./props-util/index.js";
2
- import { createVNode, defineComponent, isVNode } from "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
- 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 filterEmpty(_render).map((v) => {
13
- if (isVNode(v)) return createVNode(v, { ...attrs });
14
- else return v;
15
- });
16
- return _render;
17
- } else if (Array.isArray(render$1)) return filterEmpty(render$1).map((v) => {
18
- if (isVNode(v)) return createVNode(v, { ...attrs });
19
- return v;
20
- });
21
- else if (checkIsBaseType(render$1)) return render$1;
22
- if (isVNode(render$1)) return createVNode(render$1, { ...attrs });
23
- return render$1;
24
- };
25
- }, {
26
- inheritAttrs: false,
27
- name: "RenderComponent",
28
- props: ["render"]
29
- });
@@ -1,35 +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
- export { classNames, 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
- export { getTargetScrollBarSize };
@@ -1 +0,0 @@
1
- import { nextTick, shallowRef, watch } from "vue";
@@ -1,5 +0,0 @@
1
- import { useId } from "vue";
2
- function getUseId() {
3
- return useId;
4
- }
5
- getUseId();
@@ -1,8 +0,0 @@
1
- import { raf_default } from "./raf.js";
2
- import { omit } from "./omit.js";
3
- import "./RenderComponent.js";
4
- import { classNames, clsx } from "./classnames.js";
5
- import "./hooks/useControlledState.js";
6
- import "./hooks/useId.js";
7
- import { useMergedState } from "./hooks/useMergedState.js";
8
- import { warning_default } from "./warning.js";