@onu-ui/utils
Advanced tools
Comparing version 1.0.12 to 1.0.13-alpha
import * as vue from 'vue'; | ||
import { Plugin, AppContext, Ref, ComponentPublicInstance, VNode, VNodeTypes, Component, App } from 'vue'; | ||
declare type SFCWithInstall<T> = T & Plugin; | ||
declare type SFCInstallWithContext<T> = SFCWithInstall<T> & { | ||
type SFCWithInstall<T> = T & Plugin; | ||
type SFCInstallWithContext<T> = SFCWithInstall<T> & { | ||
_context: AppContext | null; | ||
}; | ||
declare type MaybeRef<T> = T | Ref<T>; | ||
type MaybeRef<T> = T | Ref<T>; | ||
@@ -85,2 +85,11 @@ declare const withInstall: <T, E extends Record<string, any>>(main: T, extra?: E | undefined) => SFCWithInstall<T> & E; | ||
declare const _default$2: { | ||
name: string; | ||
locales: { | ||
empty: { | ||
emptyText: string; | ||
}; | ||
}; | ||
}; | ||
declare const _default$1: { | ||
@@ -136,4 +145,4 @@ name: string; | ||
declare type OnuTranslatorOption = Record<string, string | number>; | ||
declare type OnuTranslator = (path: string, option?: OnuTranslatorOption) => string; | ||
type OnuTranslatorOption = Record<string, string | number>; | ||
type OnuTranslator = (path: string, option?: OnuTranslatorOption) => string; | ||
interface OnuLocaleContext { | ||
@@ -149,2 +158,2 @@ locale: Ref<language>; | ||
export { InstallOptions, OnuLocaleContext, OnuTranslator, OnuTranslatorOption, TranslatePair, buildLocaleContext, buildTranslator, configProviderContextKey, deepGet, _default$1 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, 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, 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 }; |
@@ -1,1 +0,1 @@ | ||
"use strict";var x=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var D=(e,t)=>{for(var o in t)x(e,o,{get:t[o],enumerable:!0})},W=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of P(t))!_.call(e,r)&&r!==o&&x(e,r,{get:()=>t[r],enumerable:!(n=k(t,r))||n.enumerable});return e};var K=e=>W(x({},"__esModule",{value:!0}),e);var de={};D(de,{buildLocaleContext:()=>j,buildTranslator:()=>H,configProviderContextKey:()=>a,deepGet:()=>b,en:()=>m,generateId:()=>U,getChildrenArray:()=>O,getElement:()=>ae,getFirstElementFromChildren:()=>S,getFirstElementFromVNode:()=>v,hash:()=>$,isArray:()=>h,isArrayChildren:()=>C,isBoolean:()=>q,isComponent:()=>f,isComponentInstance:()=>re,isDate:()=>Z,isDef:()=>z,isElement:()=>u,isEmptyChildren:()=>le,isFunction:()=>p,isMap:()=>J,isNumber:()=>X,isObject:()=>N,isPlainObject:()=>Y,isPromise:()=>ne,isRegExp:()=>ee,isServerRendering:()=>d,isSet:()=>Q,isSlotsChildren:()=>ie,isString:()=>E,isSymbol:()=>te,isText:()=>se,isValue:()=>oe,mergeFirstChild:()=>F,mergeObjects:()=>T,off:()=>ce,on:()=>pe,provideGlobalConfig:()=>fe,querySelector:()=>w,toTypeString:()=>c,translate:()=>A,useGlobalConfig:()=>y,useLocale:()=>ue,withInstall:()=>G,withInstallFunction:()=>B,zhCn:()=>V});module.exports=K(de);var G=(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},B=(e,t)=>(e.install=o=>{e._context=o._context,o.config.globalProperties[t]=e},e);function $(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 U=()=>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),z=e=>typeof e<"u",q=e=>typeof e=="boolean",p=e=>typeof e=="function",X=e=>typeof e=="number",E=e=>typeof e=="string",N=e=>e!==null&&typeof e=="object",Y=e=>c(e)==="[object Object]",h=Array.isArray,J=e=>c(e)==="[object Map]",Q=e=>c(e)==="[object Set]",Z=e=>e instanceof Date,ee=e=>e instanceof RegExp,te=e=>typeof e=="symbol",ne=e=>N(e)&&p(e.then)&&p(e.catch),oe=e=>e!=null,re=e=>e?.$!==void 0,f=(e,t)=>Boolean(e&&e.shapeFlag&6),u=e=>Boolean(e&&e.shapeFlag&1),se=(e,t)=>Boolean(e&&e.shapeFlag&8),ie=(e,t)=>Boolean(e&&e.shapeFlag&32),C=(e,t)=>Boolean(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},le=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,ae=(e,t)=>{if(E(e)){let o=e[0]==="#"?`[id='${e.slice(1)}']`:e;return w(o,t)}return e},pe=(()=>d?R:(e,t,o,n=!1)=>{e.addEventListener(t,o,n)})(),ce=(()=>d?R:(e,t,o,n=!1)=>{e.removeEventListener(t,o,n)})();var m={name:"en",locales:{empty:{emptyText:"No data"}}};var V={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 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 fe(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 g=(0,s.computed)(()=>{let L=unref(e);return r?.value?T(r.value,L):L});return l(a,g),(o||!M.value)&&(M.value=g.value),g}var i=require("vue");var A=(e,t,o)=>b(o,e,e).replace(/\{(\w+)\}/g,(n,r)=>`${t?.[r]??`{${r}}`}`),H=e=>(t,o)=>A(t,o,(0,i.unref)(e)),j=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:H(e)}};function ue(){let e=y("locale");return j((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,querySelector,toTypeString,translate,useGlobalConfig,useLocale,withInstall,withInstallFunction,zhCn}); | ||
"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}); |
{ | ||
"name": "@onu-ui/utils", | ||
"version": "1.0.13-alpha", | ||
"description": "Onu-UI utils library", | ||
"version": "1.0.12", | ||
"keywords": [ | ||
"onu-ui", | ||
"utils", | ||
"@onu-ui/utils" | ||
], | ||
"author": "chris-zhu <https://github.com/chris-zhu>", | ||
"license": "MIT", | ||
"author": "chris-zhu <https://github.com/chris-zhu>", | ||
"homepage": "https://github.com/onu-ui/onu-ui/blob/main/packages/utils/README.md", | ||
"repository": { | ||
@@ -20,17 +16,21 @@ "type": "git", | ||
}, | ||
"homepage": "https://github.com/onu-ui/onu-ui/blob/main/packages/utils/README.md", | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"types": "dist/index.d.ts", | ||
"keywords": [ | ||
"onu-ui", | ||
"utils", | ||
"@onu-ui/utils" | ||
], | ||
"sideEffects": false, | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"require": "./dist/index.js", | ||
"import": "./dist/index.mjs", | ||
"types": "./dist/index.d.ts" | ||
"import": "./dist/index.mjs" | ||
} | ||
}, | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"types": "dist/index.d.ts", | ||
"files": [ | ||
"dist" | ||
], | ||
"sideEffects": false, | ||
"peerDependencies": { | ||
@@ -37,0 +37,0 @@ "vue": "^3.2.0" |
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
18698
181
2