@onu-ui/utils
Advanced tools
Comparing version 1.0.13 to 1.0.14-beta.0
import * as vue from 'vue'; | ||
import { Plugin, AppContext, Ref, ComponentPublicInstance, VNode, VNodeTypes, Component, App } from 'vue'; | ||
import { Plugin, AppContext, Ref, ComponentPublicInstance, VNode, VNodeTypes, Component, CSSProperties, App } from 'vue'; | ||
@@ -85,2 +85,7 @@ type SFCWithInstall<T> = T & Plugin; | ||
declare const isScroll: (el: HTMLElement, isVertical?: boolean) => boolean; | ||
declare const getScrollContainer: (el: HTMLElement, isVertical?: boolean) => Window | HTMLElement | undefined; | ||
declare const getStyle: (element: HTMLElement, styleName: keyof CSSProperties) => string; | ||
declare const _default$2: { | ||
@@ -157,2 +162,2 @@ name: string; | ||
export { InstallOptions, OnuLocaleContext, OnuTranslator, OnuTranslatorOption, TranslatePair, buildLocaleContext, buildTranslator, configProviderContextKey, deepGet, _default$2 as en, generateId, getChildrenArray, getElement, getFirstElementFromChildren, getFirstElementFromVNode, hash, isArray, isArrayChildren, isBoolean, isComponent, isComponentInstance, isDate, isDef, isElement, isEmptyChildren, isFunction, isMap, isNumber, isObject, isPlainObject, isPromise, isRegExp, 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 { 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 }; |
@@ -1,1 +0,1 @@ | ||
"use strict";var g=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var D=Object.prototype.hasOwnProperty;var W=(e,t)=>{for(var o in t)g(e,o,{get:t[o],enumerable:!0})},K=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of _(t))!D.call(e,r)&&r!==o&&g(e,r,{get:()=>t[r],enumerable:!(n=P(t,r))||n.enumerable});return e};var G=e=>K(g({},"__esModule",{value:!0}),e);var me={};W(me,{buildLocaleContext:()=>k,buildTranslator:()=>j,configProviderContextKey:()=>a,deepGet:()=>b,en:()=>m,generateId:()=>z,getChildrenArray:()=>O,getElement:()=>pe,getFirstElementFromChildren:()=>S,getFirstElementFromVNode:()=>v,hash:()=>U,isArray:()=>h,isArrayChildren:()=>C,isBoolean:()=>X,isComponent:()=>f,isComponentInstance:()=>se,isDate:()=>ee,isDef:()=>q,isElement:()=>u,isEmptyChildren:()=>ae,isFunction:()=>p,isMap:()=>Q,isNumber:()=>Y,isObject:()=>N,isPlainObject:()=>J,isPromise:()=>oe,isRegExp:()=>te,isServerRendering:()=>d,isSet:()=>Z,isSlotsChildren:()=>le,isString:()=>E,isSymbol:()=>ne,isText:()=>ie,isValue:()=>re,mergeFirstChild:()=>F,mergeObjects:()=>T,off:()=>fe,on:()=>ce,provideGlobalConfig:()=>ue,pt:()=>V,querySelector:()=>w,toTypeString:()=>c,translate:()=>H,useGlobalConfig:()=>y,useLocale:()=>de,withInstall:()=>B,withInstallFunction:()=>$,zhCn:()=>A});module.exports=G(me);var B=(e,t)=>{if(e.install=o=>{for(let n of[e,...Object.values(t??{})])o.component(n.name,n)},t)for(let[o,n]of Object.entries(t))e[o]=n;return e},$=(e,t)=>(e.install=o=>{e._context=o._context,o.config.globalProperties[t]=e},e);function U(e){let t,o,n=2166136261;for(t=0,o=e.length;t<o;t++)n^=e.charCodeAt(t),n+=(n<<1)+(n<<4)+(n<<7)+(n<<8)+(n<<24);return`00000${(n>>>0).toString(36)}`.slice(-6)}var z=()=>Math.floor(Math.random()*1e4);function T(e,t){let o=[...new Set([...Object.keys(e),...Object.keys(t)])],n={};return o.forEach(r=>{n[r]=t[r]??e[r]}),n}function b(e,t,o){if(!Array.isArray(t)&&typeof t!="string")throw new TypeError("path must be string or array");if(e===null)return o;let n=t;typeof t=="string"&&(t=t.replace(/\[(\w*)\]/g,".$1"),t=t.startsWith(".")?t.slice(1):t,n=t.split("."));let r=0,l;for(;e!==null&&r<n.length;)l=n[r++],e=e[l];return r===n.length?e:o}var c=e=>Object.prototype.toString.call(e),q=e=>typeof e<"u",X=e=>typeof e=="boolean",p=e=>typeof e=="function",Y=e=>typeof e=="number",E=e=>typeof e=="string",N=e=>e!==null&&typeof e=="object",J=e=>c(e)==="[object Object]",h=Array.isArray,Q=e=>c(e)==="[object Map]",Z=e=>c(e)==="[object Set]",ee=e=>e instanceof Date,te=e=>e instanceof RegExp,ne=e=>typeof e=="symbol",oe=e=>N(e)&&p(e.then)&&p(e.catch),re=e=>e!=null,se=e=>e?.$!==void 0,f=(e,t)=>!!(e&&e.shapeFlag&6),u=e=>!!(e&&e.shapeFlag&1),ie=(e,t)=>!!(e&&e.shapeFlag&8),le=(e,t)=>!!(e&&e.shapeFlag&32),C=(e,t)=>!!(e&&e.shapeFlag&16);var I=require("vue");var O=e=>{if(C(e,e.children))return e.children;if(h(e))return e},S=e=>{if(e&&e.length>0)for(let t of e){let o=v(t);if(o)return o}},v=e=>{if(u(e))return e.el;if(f(e)){if(e.el.nodeType===1)return e.el;if(e.component?.subTree){let t=v(e.component.subTree);if(t)return t}}else{let t=O(e);return S(t)}},F=(e,t)=>{if(e&&e.length>0)for(let o=0;o<e.length;o++){let n=e[o];if(u(n)||f(n)){let l=p(t)?t(n):t;return e[o]=(0,I.cloneVNode)(n,l,!0),!0}let r=O(n);if(r&&r.length>0&&F(r,t))return!0}return!1},ae=e=>{if(!e)return!0;for(let t of e)if(t.children)return!1;return!0};var d=(()=>{try{return!(typeof window<"u"&&document!==void 0)}catch{return!0}})(),R=()=>{},w=(e,t)=>d?R():(t??document).querySelector(e)??void 0,pe=(e,t)=>{if(E(e)){let o=e[0]==="#"?`[id='${e.slice(1)}']`:e;return w(o,t)}return e},ce=(()=>d?R:(e,t,o,n=!1)=>{e.addEventListener(t,o,n)})(),fe=(()=>d?R:(e,t,o,n=!1)=>{e.removeEventListener(t,o,n)})();var m={name:"en",locales:{empty:{emptyText:"No data"}}};var V={name:"pt",locales:{empty:{emptyText:"Sem dados"}}};var A={name:"zh-cn",locales:{empty:{emptyText:"\u6682\u65E0\u6570\u636E"}}};var a="__onu_config_provider";var s=require("vue");var M=(0,s.ref)();function y(e,t=void 0){let o=(0,s.getCurrentInstance)(),n=(0,s.inject)(a);return(0,s.unref)(n)||(n=(0,s.ref)(o?o.appContext.provides[a]:M.value),(0,s.provide)(a,n)),e?(0,s.computed)(()=>n.value?.[e]??t):n}function ue(e,t,o=!1){let n=!!(0,s.getCurrentInstance)(),r=n?y():void 0,l=t?.provide??(n?s.provide:void 0);if(!l)return;let x=(0,s.computed)(()=>{let L=(0,s.unref)(e);return r?.value?T(r.value,L):L});return l(a,x),(o||!M.value)&&(M.value=x.value),x}var i=require("vue");var H=(e,t,o)=>b(o,e,e).replace(/\{(\w+)\}/g,(n,r)=>`${t?.[r]??`{${r}}`}`),j=e=>(t,o)=>H(t,o,(0,i.unref)(e)),k=e=>{let t=(0,i.computed)(()=>(0,i.unref)(e).name);return{locale:(0,i.isRef)(e)?e:(0,i.ref)(e),lang:t,t:j(e)}};function de(){let e=y("locale");return k((0,i.computed)(()=>e.value||m))}0&&(module.exports={buildLocaleContext,buildTranslator,configProviderContextKey,deepGet,en,generateId,getChildrenArray,getElement,getFirstElementFromChildren,getFirstElementFromVNode,hash,isArray,isArrayChildren,isBoolean,isComponent,isComponentInstance,isDate,isDef,isElement,isEmptyChildren,isFunction,isMap,isNumber,isObject,isPlainObject,isPromise,isRegExp,isServerRendering,isSet,isSlotsChildren,isString,isSymbol,isText,isValue,mergeFirstChild,mergeObjects,off,on,provideGlobalConfig,pt,querySelector,toTypeString,translate,useGlobalConfig,useLocale,withInstall,withInstallFunction,zhCn}); | ||
"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}); |
{ | ||
"name": "@onu-ui/utils", | ||
"version": "1.0.13", | ||
"version": "1.0.14-beta.0", | ||
"description": "Onu-UI utils library", | ||
"author": "chris-zhu <https://github.com/chris-zhu>", | ||
"author": "Chris <https://github.com/zyyv>", | ||
"license": "MIT", | ||
@@ -7,0 +7,0 @@ "homepage": "https://github.com/onu-ui/onu-ui/blob/main/packages/utils/README.md", |
@@ -7,3 +7,3 @@ # @onu-ui/utils | ||
```bash | ||
npm i @onu-ui/utils | ||
pnpm i @onu-ui/utils | ||
``` | ||
@@ -13,2 +13,2 @@ | ||
[MIT](../../LICENSE) License © 2022 [chris-zhu](https://github.com/chris-zhu) | ||
[MIT](../../LICENSE) License © 2022 [Chris](https://github.com/zyyv) |
Sorry, the diff of this file is not supported yet
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
21957
195
2