UNPKG

@wfrog/vc

Version:

`自用` 的基于 `element-plus` 二次封装的 `vue3` 组件库。追求在业务场景中,尽可能使用更少的代码量来实现需求。 因此在组件封装上,以 `方便` 为主,打包仅 `esm` 模式。

257 lines (251 loc) 7.71 kB
var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default")); // node_modules/@vueuse/shared/node_modules/vue-demi/lib/index.mjs var lib_exports = {}; __export(lib_exports, { Vue: () => Vue, Vue2: () => Vue2, del: () => del, install: () => install, isVue2: () => isVue2, isVue3: () => isVue3, set: () => set }); __reExport(lib_exports, vue_star); import * as Vue from "vue"; import * as vue_star from "vue"; var isVue2 = false; var isVue3 = true; var Vue2 = void 0; function install() { } function set(target, key, val) { if (Array.isArray(target)) { target.length = Math.max(target.length, key); target.splice(key, 1, val); return val; } target[key] = val; return val; } function del(target, key) { if (Array.isArray(target)) { target.splice(key, 1); return; } delete target[key]; } // node_modules/@vueuse/shared/index.mjs var _a; var isClient = typeof window !== "undefined"; var isString = (val) => typeof val === "string"; var noop = () => { }; var isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent); function resolveUnref(r) { return typeof r === "function" ? r() : (0, lib_exports.unref)(r); } function identity(arg) { return arg; } function tryOnScopeDispose(fn) { if ((0, lib_exports.getCurrentScope)()) { (0, lib_exports.onScopeDispose)(fn); return true; } return false; } function tryOnMounted(fn, sync = true) { if ((0, lib_exports.getCurrentInstance)()) (0, lib_exports.onMounted)(fn); else if (sync) fn(); else (0, lib_exports.nextTick)(fn); } // node_modules/@vueuse/core/node_modules/vue-demi/lib/index.mjs var lib_exports2 = {}; __export(lib_exports2, { Vue: () => Vue3, Vue2: () => Vue22, del: () => del2, install: () => install2, isVue2: () => isVue22, isVue3: () => isVue32, set: () => set2 }); __reExport(lib_exports2, vue_star2); import * as Vue3 from "vue"; import * as vue_star2 from "vue"; var isVue22 = false; var isVue32 = true; var Vue22 = void 0; function install2() { } function set2(target, key, val) { if (Array.isArray(target)) { target.length = Math.max(target.length, key); target.splice(key, 1, val); return val; } target[key] = val; return val; } function del2(target, key) { if (Array.isArray(target)) { target.splice(key, 1); return; } delete target[key]; } // node_modules/@vueuse/core/index.mjs function unrefElement(elRef) { var _a2; const plain = resolveUnref(elRef); return (_a2 = plain == null ? void 0 : plain.$el) != null ? _a2 : plain; } var defaultWindow = isClient ? window : void 0; var defaultDocument = isClient ? window.document : void 0; var defaultNavigator = isClient ? window.navigator : void 0; var defaultLocation = isClient ? window.location : void 0; function useEventListener(...args) { let target; let event; let listener; let options; if (isString(args[0])) { [event, listener, options] = args; target = defaultWindow; } else { [target, event, listener, options] = args; } if (!target) return noop; let cleanup = noop; const stopWatch = (0, lib_exports2.watch)(() => unrefElement(target), (el) => { cleanup(); if (!el) return; el.addEventListener(event, listener, options); cleanup = () => { el.removeEventListener(event, listener, options); cleanup = noop; }; }, { immediate: true, flush: "post" }); const stop = () => { stopWatch(); cleanup(); }; tryOnScopeDispose(stop); return stop; } var _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {}; var globalKey = "__vueuse_ssr_handlers__"; _global[globalKey] = _global[globalKey] || {}; var handlers = _global[globalKey]; var SwipeDirection; (function(SwipeDirection2) { SwipeDirection2["UP"] = "UP"; SwipeDirection2["RIGHT"] = "RIGHT"; SwipeDirection2["DOWN"] = "DOWN"; SwipeDirection2["LEFT"] = "LEFT"; SwipeDirection2["NONE"] = "NONE"; })(SwipeDirection || (SwipeDirection = {})); var __defProp2 = Object.defineProperty; var __getOwnPropSymbols = Object.getOwnPropertySymbols; var __hasOwnProp2 = Object.prototype.hasOwnProperty; var __propIsEnum = Object.prototype.propertyIsEnumerable; var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp2.call(b, prop)) __defNormalProp(a, prop, b[prop]); if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) { if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]); } return a; }; var _TransitionPresets = { easeInSine: [0.12, 0, 0.39, 0], easeOutSine: [0.61, 1, 0.88, 1], easeInOutSine: [0.37, 0, 0.63, 1], easeInQuad: [0.11, 0, 0.5, 0], easeOutQuad: [0.5, 1, 0.89, 1], easeInOutQuad: [0.45, 0, 0.55, 1], easeInCubic: [0.32, 0, 0.67, 0], easeOutCubic: [0.33, 1, 0.68, 1], easeInOutCubic: [0.65, 0, 0.35, 1], easeInQuart: [0.5, 0, 0.75, 0], easeOutQuart: [0.25, 1, 0.5, 1], easeInOutQuart: [0.76, 0, 0.24, 1], easeInQuint: [0.64, 0, 0.78, 0], easeOutQuint: [0.22, 1, 0.36, 1], easeInOutQuint: [0.83, 0, 0.17, 1], easeInExpo: [0.7, 0, 0.84, 0], easeOutExpo: [0.16, 1, 0.3, 1], easeInOutExpo: [0.87, 0, 0.13, 1], easeInCirc: [0.55, 0, 1, 0.45], easeOutCirc: [0, 0.55, 0.45, 1], easeInOutCirc: [0.85, 0, 0.15, 1], easeInBack: [0.36, 0, 0.66, -0.56], easeOutBack: [0.34, 1.56, 0.64, 1], easeInOutBack: [0.68, -0.6, 0.32, 1.6] }; var TransitionPresets = __spreadValues({ linear: identity }, _TransitionPresets); function useWindowSize(options = {}) { const { window: window2 = defaultWindow, initialWidth = Infinity, initialHeight = Infinity, listenOrientation = true, includeScrollbar = true } = options; const width = (0, lib_exports2.ref)(initialWidth); const height = (0, lib_exports2.ref)(initialHeight); const update = () => { if (window2) { if (includeScrollbar) { width.value = window2.innerWidth; height.value = window2.innerHeight; } else { width.value = window2.document.documentElement.clientWidth; height.value = window2.document.documentElement.clientHeight; } } }; update(); tryOnMounted(update); useEventListener("resize", update, { passive: true }); if (listenOrientation) useEventListener("orientationchange", update, { passive: true }); return { width, height }; } // src/use/useSmallScreen.ts var useSmallScreen_default = () => { const { width } = useWindowSize(); return { isSmallScreen: width.value <= 768 }; }; export { useSmallScreen_default as default };