@onu-ui/utils
Advanced tools
Comparing version 1.0.14-beta.2 to 1.1.2
import * as vue from 'vue'; | ||
import { Plugin, AppContext, Ref, ComponentPublicInstance, VNode, VNodeTypes, Component, CSSProperties, App } from 'vue'; | ||
import { Plugin, AppContext, Ref, InjectionKey, App, ComponentPublicInstance, VNode, VNodeTypes, Component, Slots, CSSProperties } from 'vue'; | ||
@@ -9,5 +9,6 @@ type SFCWithInstall<T> = T & Plugin; | ||
type MaybeRef<T> = T | Ref<T>; | ||
type ProvideFn = (<T>(key: string | InjectionKey<T>, value: T) => App<any>) | (<T>(key: string | number | InjectionKey<T>, value: T) => void) | undefined; | ||
declare const withInstall: <T, E extends Record<string, any>>(main: T, extra?: E | undefined) => SFCWithInstall<T> & E; | ||
declare const withInstallFunction: <T>(fn: T, name: string) => SFCInstallWithContext<T>; | ||
declare function withInstall<T, E extends Record<string, any>>(main: T, extra?: E): SFCWithInstall<T> & E; | ||
declare function withInstallFunction<T>(fn: T, name: string): SFCInstallWithContext<T>; | ||
@@ -25,14 +26,18 @@ declare function hash(str: string): string; | ||
declare function deepGet(target: any, path: string | string[], defaultValue: any): any; | ||
type DeepPartial<T> = { | ||
[P in keyof T]?: DeepPartial<T[P]>; | ||
}; | ||
declare function deepMerge<T>(original: T, patch: DeepPartial<T>): T; | ||
declare const toTypeString: (v: any) => string; | ||
declare const isDef: <T = any>(val?: T | undefined) => val is T; | ||
declare const isBoolean: (val: any) => val is boolean; | ||
declare const isFunction: <T extends Function>(val: any) => val is T; | ||
declare const isNumber: (val: any) => val is number; | ||
declare const isDef: <T = any>(val?: T) => val is T; | ||
declare const isBoolean: (val: unknown) => val is boolean; | ||
declare const isFunction: <T extends () => void>(val: any) => val is T; | ||
declare const isNumber: (val: unknown) => val is number; | ||
declare const isString: (val: unknown) => val is string; | ||
declare const isObject: (val: unknown) => val is Record<any, any>; | ||
declare const isPlainObject: (val: unknown) => val is object; | ||
declare function isObject(val: unknown): val is Record<any, any>; | ||
declare function isPlainObject(val: unknown): val is object; | ||
declare const isArray: (arg: any) => arg is any[]; | ||
declare const isMap: (val: unknown) => val is Map<any, any>; | ||
declare const isSet: (val: unknown) => val is Set<any>; | ||
declare function isMap(val: unknown): val is Map<any, any>; | ||
declare function isSet(val: unknown): val is Set<any>; | ||
declare const isDate: (val: unknown) => val is Date; | ||
@@ -43,14 +48,10 @@ declare const isRegExp: (val: unknown) => val is RegExp; | ||
declare const isValue: (val: any) => val is boolean; | ||
declare const isComponentInstance: (val: any) => val is ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}>; | ||
declare const isComponent: (vn: VNode, type?: VNodeTypes) => type is Component<any, any, any, vue.ComputedOptions, vue.MethodOptions>; | ||
declare const isComponentInstance: (val: any) => val is ComponentPublicInstance; | ||
declare const isComponent: (vn: VNode, type?: VNodeTypes) => type is Component; | ||
declare const isElement: (vn: VNode) => boolean; | ||
declare const isText: (vn: VNode, children: VNode['children']) => children is string; | ||
declare const isSlotsChildren: (vn: VNode, children: VNode['children']) => children is Readonly<{ | ||
[name: string]: vue.Slot | undefined; | ||
}>; | ||
declare const isArrayChildren: (vn: VNode, children: VNode['children']) => children is VNode<vue.RendererNode, vue.RendererElement, { | ||
[key: string]: any; | ||
}>[]; | ||
declare const isText: (vn: VNode, children: VNode["children"]) => children is string; | ||
declare const isSlotsChildren: (vn: VNode, children: VNode["children"]) => children is Slots; | ||
declare const isArrayChildren: (vn: VNode, children: VNode["children"]) => children is VNode[]; | ||
declare const getChildrenArray: (vn: VNode) => VNode<vue.RendererNode, vue.RendererElement, { | ||
declare function getChildrenArray(vn: VNode): VNode<vue.RendererNode, vue.RendererElement, { | ||
[key: string]: any; | ||
@@ -64,9 +65,10 @@ }>[] | (VNode<vue.RendererNode, vue.RendererElement, { | ||
*/ | ||
declare const getFirstElementFromChildren: (children: VNode[] | undefined) => HTMLElement | undefined; | ||
declare function getFirstElementFromChildren(children: VNode[] | undefined): HTMLElement | undefined; | ||
/** | ||
* Determine the VNode type and return the corresponding element | ||
* | ||
* @param vnode | ||
* @returns | ||
* @returns HTMLElement | ||
*/ | ||
declare const getFirstElementFromVNode: (vnode: VNode) => HTMLElement | undefined; | ||
declare function getFirstElementFromVNode(vnode: VNode): HTMLElement | undefined; | ||
/** | ||
@@ -76,11 +78,11 @@ * merge extraProps for child | ||
* @param extraProps | ||
* @returns | ||
* @returns {boolean} whether merge success | ||
*/ | ||
declare const mergeFirstChild: (children: VNode[] | undefined, extraProps: Record<string, any> | ((vn: VNode) => Record<string, any>)) => boolean; | ||
declare function mergeFirstChild(children: VNode[] | undefined, extraProps: Record<string, any> | ((vn: VNode) => Record<string, any>)): boolean; | ||
/** whether VNode[] is empty */ | ||
declare const isEmptyChildren: (children?: VNode[]) => boolean; | ||
declare function isEmptyChildren(children?: VNode[]): boolean; | ||
declare const isServerRendering: boolean; | ||
declare const querySelector: (selectors: string, container?: Document | HTMLElement) => HTMLElement | undefined; | ||
declare const getElement: (target: string | HTMLElement | undefined, container?: Document | HTMLElement) => HTMLElement | undefined; | ||
declare function querySelector(selectors: string, container?: Document | HTMLElement): HTMLElement | undefined; | ||
declare function getElement(target: string | HTMLElement | undefined, container?: Document | HTMLElement): HTMLElement | undefined; | ||
/** for element eventListener */ | ||
@@ -90,6 +92,6 @@ declare const on: <K extends keyof HTMLElementEventMap>(element: HTMLElement | Window, event: K, handler: (ev: HTMLElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions) => void; | ||
declare const isScroll: (el: HTMLElement, isVertical?: boolean) => boolean; | ||
declare const getScrollContainer: (el: HTMLElement, isVertical?: boolean) => Window | HTMLElement | undefined; | ||
declare function isScroll(el: HTMLElement, isVertical?: boolean): boolean; | ||
declare function getScrollContainer(el: HTMLElement, isVertical?: boolean): Window | HTMLElement | undefined; | ||
declare const getStyle: (element: HTMLElement, styleName: keyof CSSProperties) => string; | ||
declare function getStyle(element: HTMLElement, styleName: keyof CSSProperties): string; | ||
@@ -153,3 +155,3 @@ declare const _default$2: { | ||
*/ | ||
declare function provideGlobalConfig(config: MaybeRef<InstallOptions>, app?: App, global?: boolean): vue.ComputedRef<Record<string, any>> | undefined; | ||
declare function provideGlobalConfig(config: MaybeRef<InstallOptions>, app?: App, global?: boolean): vue.ComputedRef<Record<string, any> | InstallOptions> | undefined; | ||
@@ -163,7 +165,7 @@ type OnuTranslatorOption = Record<string, string | number>; | ||
} | ||
declare const translate: (path: string, option: OnuTranslatorOption | undefined, locale: language) => string; | ||
declare function translate(path: string, option: OnuTranslatorOption | undefined, locale: language): string; | ||
declare const buildTranslator: (locale: MaybeRef<language>) => OnuTranslator; | ||
declare const buildLocaleContext: (locale: MaybeRef<language>) => OnuLocaleContext; | ||
declare function buildLocaleContext(locale: MaybeRef<language>): OnuLocaleContext; | ||
declare function useLocale(): OnuLocaleContext; | ||
export { InstallOptions, OnuLocaleContext, OnuTranslator, OnuTranslatorOption, TranslatePair, buildLocaleContext, buildTranslator, configProviderContextKey, deepGet, _default$2 as en, generateId, getChildrenArray, getElement, getFirstElementFromChildren, getFirstElementFromVNode, getScrollContainer, getStyle, hash, isArray, isArrayChildren, isBoolean, isComponent, isComponentInstance, isDate, isDef, isElement, isEmptyChildren, isFunction, isMap, isNumber, isObject, isPlainObject, isPromise, isRegExp, isScroll, isServerRendering, isSet, isSlotsChildren, isString, isSymbol, isText, isValue, language, mergeFirstChild, mergeObjects, off, on, provideGlobalConfig, _default$1 as pt, querySelector, toTypeString, translate, useGlobalConfig, useLocale, withInstall, withInstallFunction, _default as zhCn }; | ||
export { type DeepPartial, type InstallOptions, type MaybeRef, type OnuLocaleContext, type OnuTranslator, type OnuTranslatorOption, type ProvideFn, type SFCInstallWithContext, type SFCWithInstall, type TranslatePair, buildLocaleContext, buildTranslator, configProviderContextKey, deepGet, deepMerge, _default$2 as en, generateId, getChildrenArray, getElement, getFirstElementFromChildren, getFirstElementFromVNode, getScrollContainer, getStyle, hash, isArray, isArrayChildren, isBoolean, isComponent, isComponentInstance, isDate, isDef, isElement, isEmptyChildren, isFunction, isMap, isNumber, isObject, isPlainObject, isPromise, isRegExp, isScroll, isServerRendering, isSet, isSlotsChildren, isString, isSymbol, isText, isValue, type language, mergeFirstChild, mergeObjects, off, on, provideGlobalConfig, _default$1 as pt, querySelector, toTypeString, translate, useGlobalConfig, useLocale, withInstall, withInstallFunction, _default as zhCn }; |
@@ -1,1 +0,1 @@ | ||
"use strict";var X=Object.create;var m=Object.defineProperty;var Z=Object.getOwnPropertyDescriptor;var J=Object.getOwnPropertyNames;var Q=Object.getPrototypeOf,ee=Object.prototype.hasOwnProperty;var I=(e,t)=>{for(var n in t)m(e,n,{get:t[n],enumerable:!0})},d=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of J(t))!ee.call(e,i)&&i!==n&&m(e,i,{get:()=>t[i],enumerable:!(r=Z(t,i))||r.enumerable});return e},l=(e,t,n)=>(d(e,t,"default"),n&&d(n,t,"default")),te=(e,t,n)=>(n=e!=null?X(Q(e)):{},d(t||!e||!e.__esModule?m(n,"default",{value:e,enumerable:!0}):n,e)),ne=e=>d(m({},"__esModule",{value:!0}),e);var je={};I(je,{buildLocaleContext:()=>q,buildTranslator:()=>z,configProviderContextKey:()=>f,deepGet:()=>P,en:()=>O,generateId:()=>ae,getChildrenArray:()=>$,getElement:()=>be,getFirstElementFromChildren:()=>R,getFirstElementFromVNode:()=>E,getScrollContainer:()=>Me,getStyle:()=>C,hash:()=>ie,isArray:()=>S,isArrayChildren:()=>T,isBoolean:()=>le,isComponent:()=>y,isComponentInstance:()=>_e,isDate:()=>de,isDef:()=>se,isElement:()=>g,isEmptyChildren:()=>we,isFunction:()=>p,isMap:()=>fe,isNumber:()=>ue,isObject:()=>D,isPlainObject:()=>ce,isPromise:()=>ye,isRegExp:()=>me,isScroll:()=>B,isServerRendering:()=>_,isSet:()=>pe,isSlotsChildren:()=>he,isString:()=>x,isSymbol:()=>ve,isText:()=>Oe,isValue:()=>ge,mergeFirstChild:()=>L,mergeObjects:()=>b,off:()=>xe,on:()=>Pe,provideGlobalConfig:()=>Ce,pt:()=>G,querySelector:()=>N,toTypeString:()=>v,translate:()=>K,useGlobalConfig:()=>h,useLocale:()=>Ae,withInstall:()=>re,withInstallFunction:()=>oe,zhCn:()=>Y});module.exports=ne(je);var re=(e,t)=>{if(e.install=n=>{for(let r of[e,...Object.values(t??{})])n.component(r.name,r)},t)for(let[n,r]of Object.entries(t))e[n]=r;return e},oe=(e,t)=>(e.install=n=>{e._context=n._context,n.config.globalProperties[t]=e},e);function ie(e){let t,n,r=2166136261;for(t=0,n=e.length;t<n;t++)r^=e.charCodeAt(t),r+=(r<<1)+(r<<4)+(r<<7)+(r<<8)+(r<<24);return`00000${(r>>>0).toString(36)}`.slice(-6)}var ae=()=>Math.floor(Math.random()*1e4);function b(e,t){let n=[...new Set([...Object.keys(e),...Object.keys(t)])],r={};return n.forEach(i=>{r[i]=t[i]??e[i]}),r}function P(e,t,n){if(!Array.isArray(t)&&typeof t!="string")throw new TypeError("path must be string or array");if(e===null)return n;let r=t;typeof t=="string"&&(t=t.replace(/\[(\w*)\]/g,".$1"),t=t.startsWith(".")?t.slice(1):t,r=t.split("."));let i=0,u;for(;e!==null&&i<r.length;)u=r[i++],e=e[u];return i===r.length?e:n}var v=e=>Object.prototype.toString.call(e),se=e=>typeof e<"u",le=e=>typeof e=="boolean",p=e=>typeof e=="function",ue=e=>typeof e=="number",x=e=>typeof e=="string",D=e=>e!==null&&typeof e=="object",ce=e=>v(e)==="[object Object]",S=Array.isArray,fe=e=>v(e)==="[object Map]",pe=e=>v(e)==="[object Set]",de=e=>e instanceof Date,me=e=>e instanceof RegExp,ve=e=>typeof e=="symbol",ye=e=>D(e)&&p(e.then)&&p(e.catch),ge=e=>e!=null,_e=e=>e?.$!==void 0,y=(e,t)=>!!(e&&e.shapeFlag&6),g=e=>!!(e&&e.shapeFlag&1),Oe=(e,t)=>!!(e&&e.shapeFlag&8),he=(e,t)=>!!(e&&e.shapeFlag&32),T=(e,t)=>!!(e&&e.shapeFlag&16);var F=require("vue");var $=e=>{if(T(e,e.children))return e.children;if(S(e))return e},R=e=>{if(e&&e.length>0)for(let t of e){let n=E(t);if(n)return n}},E=e=>{if(g(e))return e.el;if(y(e)){if(e.el.nodeType===1)return e.el;if(e.component?.subTree){let t=E(e.component.subTree);if(t)return t}}else{let t=$(e);return R(t)}},L=(e,t)=>{if(e&&e.length>0)for(let n=0;n<e.length;n++){let r=e[n];if(g(r)||y(r)){let u=p(t)?t(r):t;return e[n]=(0,F.cloneVNode)(r,u,!0),!0}let i=$(r);if(i&&i.length>0&&L(i,t))return!0}return!1},we=e=>{if(!e)return!0;for(let t of e)if(t.children)return!1;return!0};var _=(()=>{try{return!(typeof window<"u"&&document!==void 0)}catch{return!0}})(),M=()=>{},N=(e,t)=>_?M():(t??document).querySelector(e)??void 0,be=(e,t)=>{if(x(e)){let n=e[0]==="#"?`[id='${e.slice(1)}']`:e;return N(n,t)}return e},Pe=(()=>_?M:(e,t,n,r=!1)=>{e.addEventListener(t,n,r)})(),xe=(()=>_?M:(e,t,n,r=!1)=>{e.removeEventListener(t,n,r)})();var o={};I(o,{Vue:()=>Se,Vue2:()=>Te,del:()=>Ee,install:()=>$e,isVue2:()=>V,isVue3:()=>H,set:()=>W});var Se=te(require("vue"),1);l(o,require("vue"));var V=!1,H=!0,Te=void 0;function $e(){}function W(e,t,n){return Array.isArray(e)?(e.length=Math.max(e.length,t),e.splice(t,1,n),n):(e[t]=n,n)}function Ee(e,t){if(Array.isArray(e)){e.splice(t,1);return}delete e[t]}var U,c=typeof window<"u";var ke=c&&((U=window?.navigator)==null?void 0:U.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);var k=require("vue"),C=(e,t)=>{if(!c||!e||!t)return"";let n=(0,k.camelize)(t);n==="float"&&(n="cssFloat");try{let r=e.style[n];if(r)return r;let i=document.defaultView?.getComputedStyle(e,"");return i?i[n]:""}catch{return e.style[n]}};var B=(e,t)=>{if(!c)return!1;let n={undefined:"overflow",true:"overflow-y",false:"overflow-x"}[String(t)],r=C(e,n);return["scroll","auto","overlay"].some(i=>r.includes(i))},Me=(e,t)=>{if(!c)return;let n=e;for(;n;){if([window,document,document.documentElement].includes(n))return window;if(B(n,t))return n;n=n.parentNode}return n};var O={name:"en",locales:{empty:{emptyText:"No data"}}};var G={name:"pt",locales:{empty:{emptyText:"Sem dados"}}};var Y={name:"zh-cn",locales:{empty:{emptyText:"\u6682\u65E0\u6570\u636E"}}};var f="__onu_config_provider";var a=require("vue");var A=(0,a.ref)();function h(e,t=void 0){let n=(0,a.getCurrentInstance)(),r=(0,a.inject)(f);return(0,a.unref)(r)||(r=(0,a.ref)(n?n.appContext.provides[f]:A.value),(0,a.provide)(f,r)),e?(0,a.computed)(()=>r.value?.[e]??t):r}function Ce(e,t,n=!1){let r=!!(0,a.getCurrentInstance)(),i=r?h():void 0,u=t?.provide??(r?a.provide:void 0);if(!u)return;let w=(0,a.computed)(()=>{let j=(0,a.unref)(e);return i?.value?b(i.value,j):j});return u(f,w),(n||!A.value)&&(A.value=w.value),w}var s=require("vue");var K=(e,t,n)=>P(n,e,e).replace(/\{(\w+)\}/g,(r,i)=>`${t?.[i]??`{${i}}`}`),z=e=>(t,n)=>K(t,n,(0,s.unref)(e)),q=e=>{let t=(0,s.computed)(()=>(0,s.unref)(e).name);return{locale:(0,s.isRef)(e)?e:(0,s.ref)(e),lang:t,t:z(e)}};function Ae(){let e=h("locale");return q((0,s.computed)(()=>e.value||O))}0&&(module.exports={buildLocaleContext,buildTranslator,configProviderContextKey,deepGet,en,generateId,getChildrenArray,getElement,getFirstElementFromChildren,getFirstElementFromVNode,getScrollContainer,getStyle,hash,isArray,isArrayChildren,isBoolean,isComponent,isComponentInstance,isDate,isDef,isElement,isEmptyChildren,isFunction,isMap,isNumber,isObject,isPlainObject,isPromise,isRegExp,isScroll,isServerRendering,isSet,isSlotsChildren,isString,isSymbol,isText,isValue,mergeFirstChild,mergeObjects,off,on,provideGlobalConfig,pt,querySelector,toTypeString,translate,useGlobalConfig,useLocale,withInstall,withInstallFunction,zhCn}); | ||
var S=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var Y=Object.prototype.hasOwnProperty;var z=(e,t)=>{for(var n in t)S(e,n,{get:t[n],enumerable:!0})},O=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of G(t))!Y.call(e,o)&&o!==n&&S(e,o,{get:()=>t[o],enumerable:!(r=B(t,o))||r.enumerable});return e},s=(e,t,n)=>(O(e,t,"default"),n&&O(n,t,"default"));function ve(e,t){if(e.install=n=>{for(let r of[e,...Object.values(t!=null?t:{})])n.component(r.name,r)},t)for(let[n,r]of Object.entries(t))e[n]=r;return e}function he(e,t){return e.install=n=>{e._context=n._context,n.config.globalProperties[t]=e},e}var m=e=>Object.prototype.toString.call(e),xe=e=>typeof e!="undefined",be=e=>typeof e=="boolean",d=e=>typeof e=="function",we=e=>typeof e=="number",E=e=>typeof e=="string";function a(e){return e!==null&&typeof e=="object"}function Te(e){return m(e)==="[object Object]"}var l=Array.isArray;function Oe(e){return m(e)==="[object Map]"}function Se(e){return m(e)==="[object Set]"}var Ee=e=>e instanceof Date,Me=e=>e instanceof RegExp,Ae=e=>typeof e=="symbol",Ce=e=>a(e)&&d(e.then)&&d(e.catch),Pe=e=>e!=null,Le=e=>(e==null?void 0:e.$)!==void 0,y=(e,t)=>!!(e&&e.shapeFlag&6),v=e=>!!(e&&e.shapeFlag&1),Ie=(e,t)=>!!(e&&e.shapeFlag&8),Fe=(e,t)=>!!(e&&e.shapeFlag&32),M=(e,t)=>!!(e&&e.shapeFlag&16);function De(e){let t,n,r=2166136261;for(t=0,n=e.length;t<n;t++)r^=e.charCodeAt(t),r+=(r<<1)+(r<<4)+(r<<7)+(r<<8)+(r<<24);return`00000${(r>>>0).toString(36)}`.slice(-6)}var _e=()=>Math.floor(Math.random()*1e4);function A(e,t){let n=[...new Set([...Object.keys(e),...Object.keys(t)])],r={};return n.forEach(o=>{var u;r[o]=(u=t[o])!=null?u:e[o]}),r}function C(e,t,n){if(!Array.isArray(t)&&typeof t!="string")throw new TypeError("path must be string or array");if(e===null)return n;let r=t;typeof t=="string"&&(t=t.replace(/\[(\w*)\]/g,".$1"),t=t.startsWith(".")?t.slice(1):t,r=t.split("."));let o=0,u;for(;e!==null&&o<r.length;)u=r[o++],e=e[u];return o===r.length?e:n}function K(e,t){let n=e,r=t;if(l(n)&&l(r))return[...n,...r];if(l(n))return[...n];let o={...n};return a(n)&&a(r)&&Object.keys(r).forEach(u=>{a(r[u])?u in n?o[u]=K(n[u],r[u]):Object.assign(o,{[u]:r[u]}):Object.assign(o,{[u]:r[u]})}),o}import{cloneVNode as q}from"vue";function P(e){if(M(e,e.children))return e.children;if(l(e))return e}function Z(e){if(e&&e.length>0)for(let t of e){let n=L(t);if(n)return n}}function L(e){var t;if(v(e))return e.el;if(y(e)){if(e.el.nodeType===1)return e.el;if((t=e.component)!=null&&t.subTree){let n=L(e.component.subTree);if(n)return n}}else{let n=P(e);return Z(n)}}function X(e,t){if(e&&e.length>0)for(let n=0;n<e.length;n++){let r=e[n];if(v(r)||y(r)){let u=d(t)?t(r):t;return e[n]=q(r,u,!0),!0}let o=P(r);if(o&&o.length>0&&X(o,t))return!0}return!1}function He(e){if(!e)return!0;for(let t of e)if(t.children)return!1;return!0}var h=(()=>{try{return!(typeof window!="undefined"&&document!==void 0)}catch(e){return!0}})();function I(){}function J(e,t){var n;return h?void 0:(n=(t!=null?t:document).querySelector(e))!=null?n:void 0}function Ue(e,t){if(E(e)){let n=e[0]==="#"?`[id='${e.slice(1)}']`:e;return J(n,t)}return e}var Be=h?I:(e,t,n,r=!1)=>{e.addEventListener(t,n,r)},Ge=h?I:(e,t,n,r=!1)=>{e.removeEventListener(t,n,r)};var i={};z(i,{Vue:()=>Q,Vue2:()=>ee,del:()=>ne,install:()=>te,isVue2:()=>F,isVue3:()=>R,set:()=>N});s(i,ze);import*as Q from"vue";import*as ze from"vue";var F=!1,R=!0,ee=void 0;function te(){}function N(e,t,n){return Array.isArray(e)?(e.length=Math.max(e.length,t),e.splice(t,1,n),n):(e[t]=n,n)}function ne(e,t){if(Array.isArray(e)){e.splice(t,1);return}delete e[t]}var c=typeof window!="undefined"&&typeof document!="undefined",qe=typeof WorkerGlobalScope!="undefined"&&globalThis instanceof WorkerGlobalScope;function D(e){let t=Object.create(null);return n=>t[n]||(t[n]=e(n))}var re=/\B([A-Z])/g,Ze=D(e=>e.replace(re,"-$1").toLowerCase()),oe=/-(\w)/g,Xe=D(e=>e.replace(oe,(t,n)=>n?n.toUpperCase():""));import{camelize as ie}from"vue";function _(e,t){var r;if(!c||!e||!t)return"";let n=ie(t);n==="float"&&(n="cssFloat");try{let o=e.style[n];if(o)return o;let u=(r=document.defaultView)==null?void 0:r.getComputedStyle(e,"");return u?u[n]:""}catch(o){return e.style[n]}}function ue(e,t){if(!c)return!1;let n={undefined:"overflow",true:"overflow-y",false:"overflow-x"}[String(t)],r=_(e,n);return["scroll","auto","overlay"].some(o=>r.includes(o))}function ot(e,t){if(!c)return;let n=e;for(;n;){if([window,document,document.documentElement].includes(n))return window;if(ue(n,t))return n;n=n.parentNode}return n}var g={name:"en",locales:{empty:{emptyText:"No data"}}};var se={name:"pt",locales:{empty:{emptyText:"Sem dados"}}};var le={name:"zh-cn",locales:{empty:{emptyText:"\u6682\u65E0\u6570\u636E"}}};var f="__onu_config_provider";import{computed as k,getCurrentInstance as V,inject as ae,provide as j,ref as H,unref as W}from"vue";var x=H();function b(e,t=void 0){let n=V(),r=ae(f);return W(r)||(r=H(n?n.appContext.provides[f]:x.value),j(f,r)),e?k(()=>{var o,u;return(u=(o=r.value)==null?void 0:o[e])!=null?u:t}):r}function ht(e,t,n=!1){var w;let r=!!V(),o=r?b():void 0,u=(w=t==null?void 0:t.provide)!=null?w:r?j:void 0;if(!u)return;let p=k(()=>{let T=W(e);return o!=null&&o.value?A(o.value,T):T});return u(f,p),(n||!x.value)&&(x.value=p.value),p}import{computed as $,isRef as ce,ref as fe,unref as U}from"vue";function de(e,t,n){return C(n,e,e).replace(/\{(\w+)\}/g,(r,o)=>{var u;return`${(u=t==null?void 0:t[o])!=null?u:`{${o}}`}`})}var pe=e=>(t,n)=>de(t,n,U(e));function me(e){let t=$(()=>U(e).name);return{locale:ce(e)?e:fe(e),lang:t,t:pe(e)}}function Ot(){let e=b("locale");return me($(()=>e.value||g))}export{me as buildLocaleContext,pe as buildTranslator,f as configProviderContextKey,C as deepGet,K as deepMerge,g as en,_e as generateId,P as getChildrenArray,Ue as getElement,Z as getFirstElementFromChildren,L as getFirstElementFromVNode,ot as getScrollContainer,_ as getStyle,De as hash,l as isArray,M as isArrayChildren,be as isBoolean,y as isComponent,Le as isComponentInstance,Ee as isDate,xe as isDef,v as isElement,He as isEmptyChildren,d as isFunction,Oe as isMap,we as isNumber,a as isObject,Te as isPlainObject,Ce as isPromise,Me as isRegExp,ue as isScroll,h as isServerRendering,Se as isSet,Fe as isSlotsChildren,E as isString,Ae as isSymbol,Ie as isText,Pe as isValue,X as mergeFirstChild,A as mergeObjects,Ge as off,Be as on,ht as provideGlobalConfig,se as pt,J as querySelector,m as toTypeString,de as translate,b as useGlobalConfig,Ot as useLocale,ve as withInstall,he as withInstallFunction,le as zhCn}; |
{ | ||
"name": "@onu-ui/utils", | ||
"version": "1.0.14-beta.2", | ||
"type": "module", | ||
"version": "1.1.2", | ||
"description": "Onu-UI utils library", | ||
@@ -25,9 +26,8 @@ "author": "Chris <https://github.com/zyyv>", | ||
"types": "./dist/index.d.ts", | ||
"require": "./dist/index.js", | ||
"import": "./dist/index.mjs" | ||
"import": "./dist/index.js" | ||
} | ||
}, | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"types": "dist/index.d.ts", | ||
"main": "./dist/index.js", | ||
"module": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"files": [ | ||
@@ -37,3 +37,3 @@ "dist" | ||
"peerDependencies": { | ||
"vue": "^3.2.0" | ||
"vue": "^3.3.0" | ||
}, | ||
@@ -45,4 +45,4 @@ "publishConfig": { | ||
"build": "tsup", | ||
"stub": "tsup --watch" | ||
"dev": "tsup --watch" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
Yes
16243
5
175
1