@fast-china/utils 1.0.33 → 1.0.34

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/es/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import{arrayUtil as m}from"./array/index.mjs";import{base64Util as o}from"./base64/index.mjs";import{clickUtil as r}from"./click/index.mjs";import{colorUtil as i}from"./color/index.mjs";import{consoleDebug as e,consoleError as t,consoleLog as s,consoleWarn as p,throwError as j,useConsole as f}from"./console/index.mjs";import{cryptoUtil as n}from"./crypto/index.mjs";import{dateUtil as d}from"./date/index.mjs";import"./dom/index.mjs";import{envUtil as x}from"./env/index.mjs";import{FastError as u}from"./error/index.mjs";import{useIdentity as v}from"./identity/index.mjs";import{objectUtil as c}from"./object/index.mjs";import{CACHE_EXPIRE_SUFFIX as l,CACHE_PREFIX as a,Local as y,Session as b,useStorage as g}from"./storage/index.mjs";import{stringUtil as h}from"./string/index.mjs";import"./vue/index.mjs";import{addUnit as k,styleToString as w}from"./dom/style.mjs";import{useExpose as R}from"./vue/expose.mjs";import{execFunction as q}from"./vue/func.mjs";import{withInstall as z,withInstallDirective as A,withNoopInstall as B}from"./vue/install.mjs";import{definePropType as C,useProps as D}from"./vue/props.mjs";import{makeSlots as E}from"./vue/slots.mjs";import{useRender as F}from"./vue/useRender.mjs";import{withDefineType as G}from"./vue/with.mjs";export{l as CACHE_EXPIRE_SUFFIX,a as CACHE_PREFIX,u as FastError,y as Local,b as Session,k as addUnit,m as arrayUtil,o as base64Util,r as clickUtil,i as colorUtil,e as consoleDebug,t as consoleError,s as consoleLog,p as consoleWarn,n as cryptoUtil,d as dateUtil,C as definePropType,x as envUtil,q as execFunction,E as makeSlots,c as objectUtil,h as stringUtil,w as styleToString,j as throwError,f as useConsole,R as useExpose,v as useIdentity,D as useProps,F as useRender,g as useStorage,G as withDefineType,z as withInstall,A as withInstallDirective,B as withNoopInstall};
1
+ import{arrayUtil as m}from"./array/index.mjs";import{base64Util as o}from"./base64/index.mjs";import{clickUtil as r}from"./click/index.mjs";import{colorUtil as i}from"./color/index.mjs";import{consoleDebug as e,consoleError as t,consoleLog as s,consoleWarn as p,throwError as j,useConsole as f}from"./console/index.mjs";import{cryptoUtil as n}from"./crypto/index.mjs";import{dateUtil as d}from"./date/index.mjs";import"./dom/index.mjs";import{envUtil as x}from"./env/index.mjs";import{FastError as u}from"./error/index.mjs";import{useIdentity as v}from"./identity/index.mjs";import{objectUtil as c}from"./object/index.mjs";import{CACHE_EXPIRE_SUFFIX as l,CACHE_PREFIX as a,Local as y,Session as b,useStorage as g}from"./storage/index.mjs";import{stringUtil as h}from"./string/index.mjs";import"./vue/index.mjs";import{addUnit as k,styleToString as w}from"./dom/style.mjs";import{useEmits as R}from"./vue/emits.mjs";import{useExpose as q}from"./vue/expose.mjs";import{execFunction as z}from"./vue/func.mjs";import{withInstall as A,withInstallDirective as B,withNoopInstall as C}from"./vue/install.mjs";import{definePropType as D,useProps as E}from"./vue/props.mjs";import{makeSlots as F}from"./vue/slots.mjs";import{useRender as G}from"./vue/useRender.mjs";import{withDefineType as H}from"./vue/with.mjs";export{l as CACHE_EXPIRE_SUFFIX,a as CACHE_PREFIX,u as FastError,y as Local,b as Session,k as addUnit,m as arrayUtil,o as base64Util,r as clickUtil,i as colorUtil,e as consoleDebug,t as consoleError,s as consoleLog,p as consoleWarn,n as cryptoUtil,d as dateUtil,D as definePropType,x as envUtil,z as execFunction,F as makeSlots,c as objectUtil,h as stringUtil,w as styleToString,j as throwError,f as useConsole,R as useEmits,q as useExpose,v as useIdentity,E as useProps,G as useRender,g as useStorage,H as withDefineType,A as withInstall,B as withInstallDirective,C as withNoopInstall};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,8 @@
1
+ import { ComputedRef, EmitFn } from 'vue';
2
+ /**
3
+ * 构建 emits
4
+ * @param emits emits 配置
5
+ * @param emit emit 函数
6
+ * @param ignoreRawEmits 忽略 原生 emits 的 key
7
+ */
8
+ export declare const useEmits: <T extends Record<string, (...args: any[]) => void>>(emits: T, emit?: EmitFn<T>, ignoreRawEmits?: (keyof T)[]) => ComputedRef<Record<string, (...args: any[]) => void>>;
@@ -0,0 +1,2 @@
1
+ import{computed as e}from"vue";import{omit as o}from"lodash-unified";const r=(r,t,i)=>e(r?()=>{const e=r?o(r,i??[]):{};return Object.keys(e).reduce((e,o)=>(e[`on${o.split("-").map((e,o)=>e.charAt(0).toUpperCase()+e.slice(1)).join("")}`]=(...e)=>t(o,...e),e),{})}:()=>({}));export{r as useEmits};
2
+ //# sourceMappingURL=emits.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emits.mjs","sources":["../../../../src/vue/emits.ts"],"sourcesContent":["import { computed } from \"vue\";\nimport { omit } from \"lodash-unified\";\nimport type { ComputedRef, EmitFn } from \"vue\";\n\n/**\n * 构建 emits\n * @param emits emits 配置\n * @param emit emit 函数\n * @param ignoreRawEmits 忽略 原生 emits 的 key\n */\nexport const useEmits = <T extends Record<string, (...args: any[]) => void>>(\n\temits: T,\n\temit?: EmitFn<T>,\n\tignoreRawEmits?: (keyof T)[]\n): ComputedRef<Record<string, (...args: any[]) => void>> => {\n\tif (!emits) return computed(() => ({}));\n\n\treturn computed<Record<string, (...args: any[]) => void>>(() => {\n\t\tconst omittedRawEmits = emits ? omit(emits, ignoreRawEmits ?? []) : {};\n\t\t// 提取对应的事件处理器\n\t\treturn Object.keys(omittedRawEmits).reduce((handlers, eventName) => {\n\t\t\t// 将 emit 名称转换为事件处理器名称: 'update:modelValue' -> 'onUpdate:modelValue'\n\t\t\tconst handlerName = `on${eventName\n\t\t\t\t.split(\"-\")\n\t\t\t\t.map((part, index) => (index === 0 ? part.charAt(0).toUpperCase() + part.slice(1) : part.charAt(0).toUpperCase() + part.slice(1)))\n\t\t\t\t.join(\"\")}`;\n\n\t\t\thandlers[handlerName] = (...args: any[]): void => emit(eventName, ...args);\n\t\t\treturn handlers;\n\t\t}, {});\n\t});\n};\n"],"names":["useEmits","emits","emit","ignoreRawEmits","computed","omittedRawEmits","omit","Object","keys","reduce","handlers","eventName","split","map","part","index","charAt","toUpperCase","slice","join","args"],"mappings":"qEAUO,MAAMA,EAAW,CACvBC,EACAC,EACAC,IAIOC,EAFFH,EAEqD,KACzD,MAAMI,EAAkBJ,EAAQK,EAAKL,EAAOE,GAAkB,IAAM,CAAA,EAEpE,OAAOI,OAAOC,KAAKH,GAAiBI,OAAO,CAACC,EAAUC,KAOrDD,EALoB,KAAKC,EACvBC,MAAM,KACNC,IAAI,CAACC,EAAMC,IAAyBD,EAAKE,OAAO,GAAGC,cAAgBH,EAAKI,MAAM,IAC9EC,KAAK,OAEiB,IAAIC,IAAsBlB,EAAKS,KAAcS,GAC9DV,GACL,CAAA,IAdwB,KAAA,CAAO"}
package/es/vue/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './emits';
1
2
  export * from './expose';
2
3
  export * from './func';
3
4
  export * from './install';
package/es/vue/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import{useExpose as m}from"./expose.mjs";import{execFunction as o}from"./func.mjs";import{withInstall as r,withInstallDirective as s,withNoopInstall as p}from"./install.mjs";import{definePropType as t,useProps as i}from"./props.mjs";import{makeSlots as f}from"./slots.mjs";import{useRender as j}from"./useRender.mjs";import{withDefineType as e}from"./with.mjs";export{t as definePropType,o as execFunction,f as makeSlots,m as useExpose,i as useProps,j as useRender,e as withDefineType,r as withInstall,s as withInstallDirective,p as withNoopInstall};
1
+ import{useEmits as m}from"./emits.mjs";import{useExpose as o}from"./expose.mjs";import{execFunction as r}from"./func.mjs";import{withInstall as s,withInstallDirective as t,withNoopInstall as p}from"./install.mjs";import{definePropType as i,useProps as f}from"./props.mjs";import{makeSlots as j}from"./slots.mjs";import{useRender as e}from"./useRender.mjs";import{withDefineType as l}from"./with.mjs";export{i as definePropType,r as execFunction,j as makeSlots,m as useEmits,o as useExpose,f as useProps,e as useRender,l as withDefineType,s as withInstall,t as withInstallDirective,p as withNoopInstall};
2
2
  //# sourceMappingURL=index.mjs.map
package/lib/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./array/index.js"),r=require("./base64/index.js"),s=require("./click/index.js"),t=require("./color/index.js"),o=require("./console/index.js"),i=require("./crypto/index.js"),n=require("./date/index.js");require("./dom/index.js");const l=require("./env/index.js"),x=require("./error/index.js"),p=require("./identity/index.js"),u=require("./object/index.js"),c=require("./storage/index.js"),a=require("./string/index.js");require("./vue/index.js");const d=require("./dom/style.js"),j=require("./vue/expose.js"),q=require("./vue/func.js"),U=require("./vue/install.js"),y=require("./vue/props.js"),E=require("./vue/slots.js"),g=require("./vue/useRender.js"),v=require("./vue/with.js");exports.arrayUtil=e.arrayUtil,exports.base64Util=r.base64Util,exports.clickUtil=s.clickUtil,exports.colorUtil=t.colorUtil,exports.consoleDebug=o.consoleDebug,exports.consoleError=o.consoleError,exports.consoleLog=o.consoleLog,exports.consoleWarn=o.consoleWarn,exports.throwError=o.throwError,exports.useConsole=o.useConsole,exports.cryptoUtil=i.cryptoUtil,exports.dateUtil=n.dateUtil,exports.envUtil=l.envUtil,exports.FastError=x.FastError,exports.useIdentity=p.useIdentity,exports.objectUtil=u.objectUtil,exports.CACHE_EXPIRE_SUFFIX=c.CACHE_EXPIRE_SUFFIX,exports.CACHE_PREFIX=c.CACHE_PREFIX,exports.Local=c.Local,exports.Session=c.Session,exports.useStorage=c.useStorage,exports.stringUtil=a.stringUtil,exports.addUnit=d.addUnit,exports.styleToString=d.styleToString,exports.useExpose=j.useExpose,exports.execFunction=q.execFunction,exports.withInstall=U.withInstall,exports.withInstallDirective=U.withInstallDirective,exports.withNoopInstall=U.withNoopInstall,exports.definePropType=y.definePropType,exports.useProps=y.useProps,exports.makeSlots=E.makeSlots,exports.useRender=g.useRender,exports.withDefineType=v.withDefineType;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./array/index.js"),r=require("./base64/index.js"),s=require("./click/index.js"),t=require("./color/index.js"),o=require("./console/index.js"),i=require("./crypto/index.js"),n=require("./date/index.js");require("./dom/index.js");const l=require("./env/index.js"),u=require("./error/index.js"),x=require("./identity/index.js"),p=require("./object/index.js"),c=require("./storage/index.js"),a=require("./string/index.js");require("./vue/index.js");const d=require("./dom/style.js"),j=require("./vue/emits.js"),q=require("./vue/expose.js"),U=require("./vue/func.js"),E=require("./vue/install.js"),y=require("./vue/props.js"),v=require("./vue/slots.js"),g=require("./vue/useRender.js"),I=require("./vue/with.js");exports.arrayUtil=e.arrayUtil,exports.base64Util=r.base64Util,exports.clickUtil=s.clickUtil,exports.colorUtil=t.colorUtil,exports.consoleDebug=o.consoleDebug,exports.consoleError=o.consoleError,exports.consoleLog=o.consoleLog,exports.consoleWarn=o.consoleWarn,exports.throwError=o.throwError,exports.useConsole=o.useConsole,exports.cryptoUtil=i.cryptoUtil,exports.dateUtil=n.dateUtil,exports.envUtil=l.envUtil,exports.FastError=u.FastError,exports.useIdentity=x.useIdentity,exports.objectUtil=p.objectUtil,exports.CACHE_EXPIRE_SUFFIX=c.CACHE_EXPIRE_SUFFIX,exports.CACHE_PREFIX=c.CACHE_PREFIX,exports.Local=c.Local,exports.Session=c.Session,exports.useStorage=c.useStorage,exports.stringUtil=a.stringUtil,exports.addUnit=d.addUnit,exports.styleToString=d.styleToString,exports.useEmits=j.useEmits,exports.useExpose=q.useExpose,exports.execFunction=U.execFunction,exports.withInstall=E.withInstall,exports.withInstallDirective=E.withInstallDirective,exports.withNoopInstall=E.withNoopInstall,exports.definePropType=y.definePropType,exports.useProps=y.useProps,exports.makeSlots=v.makeSlots,exports.useRender=g.useRender,exports.withDefineType=I.withDefineType;
2
2
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,8 @@
1
+ import { ComputedRef, EmitFn } from 'vue';
2
+ /**
3
+ * 构建 emits
4
+ * @param emits emits 配置
5
+ * @param emit emit 函数
6
+ * @param ignoreRawEmits 忽略 原生 emits 的 key
7
+ */
8
+ export declare const useEmits: <T extends Record<string, (...args: any[]) => void>>(emits: T, emit?: EmitFn<T>, ignoreRawEmits?: (keyof T)[]) => ComputedRef<Record<string, (...args: any[]) => void>>;
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),t=require("lodash-unified");exports.useEmits=(o,r,s)=>o?e.computed(()=>{const e=o?t.omit(o,s??[]):{};return Object.keys(e).reduce((e,t)=>(e[`on${t.split("-").map((e,t)=>e.charAt(0).toUpperCase()+e.slice(1)).join("")}`]=(...e)=>r(t,...e),e),{})}):e.computed(()=>({}));
2
+ //# sourceMappingURL=emits.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emits.js","sources":["../../../../src/vue/emits.ts"],"sourcesContent":["import { computed } from \"vue\";\nimport { omit } from \"lodash-unified\";\nimport type { ComputedRef, EmitFn } from \"vue\";\n\n/**\n * 构建 emits\n * @param emits emits 配置\n * @param emit emit 函数\n * @param ignoreRawEmits 忽略 原生 emits 的 key\n */\nexport const useEmits = <T extends Record<string, (...args: any[]) => void>>(\n\temits: T,\n\temit?: EmitFn<T>,\n\tignoreRawEmits?: (keyof T)[]\n): ComputedRef<Record<string, (...args: any[]) => void>> => {\n\tif (!emits) return computed(() => ({}));\n\n\treturn computed<Record<string, (...args: any[]) => void>>(() => {\n\t\tconst omittedRawEmits = emits ? omit(emits, ignoreRawEmits ?? []) : {};\n\t\t// 提取对应的事件处理器\n\t\treturn Object.keys(omittedRawEmits).reduce((handlers, eventName) => {\n\t\t\t// 将 emit 名称转换为事件处理器名称: 'update:modelValue' -> 'onUpdate:modelValue'\n\t\t\tconst handlerName = `on${eventName\n\t\t\t\t.split(\"-\")\n\t\t\t\t.map((part, index) => (index === 0 ? part.charAt(0).toUpperCase() + part.slice(1) : part.charAt(0).toUpperCase() + part.slice(1)))\n\t\t\t\t.join(\"\")}`;\n\n\t\t\thandlers[handlerName] = (...args: any[]): void => emit(eventName, ...args);\n\t\t\treturn handlers;\n\t\t}, {});\n\t});\n};\n"],"names":["emits","emit","ignoreRawEmits","computed","omittedRawEmits","omit","Object","keys","reduce","handlers","eventName","split","map","part","index","charAt","toUpperCase","slice","join","args"],"mappings":"oJAUwB,CACvBA,EACAC,EACAC,IAEKF,EAEEG,EAAAA,SAAmD,KACzD,MAAMC,EAAkBJ,EAAQK,EAAAA,KAAKL,EAAOE,GAAkB,IAAM,CAAA,EAEpE,OAAOI,OAAOC,KAAKH,GAAiBI,OAAO,CAACC,EAAUC,KAOrDD,EALoB,KAAKC,EACvBC,MAAM,KACNC,IAAI,CAACC,EAAMC,IAAyBD,EAAKE,OAAO,GAAGC,cAAgBH,EAAKI,MAAM,IAC9EC,KAAK,OAEiB,IAAIC,IAAsBlB,EAAKS,KAAcS,GAC9DV,GACL,CAAA,KAdeN,WAAS,KAAA,CAAO"}
@@ -1,3 +1,4 @@
1
+ export * from './emits';
1
2
  export * from './expose';
2
3
  export * from './func';
3
4
  export * from './install';
package/lib/vue/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./expose.js"),s=require("./func.js"),t=require("./install.js"),r=require("./props.js"),o=require("./slots.js"),i=require("./useRender.js"),p=require("./with.js");exports.useExpose=e.useExpose,exports.execFunction=s.execFunction,exports.withInstall=t.withInstall,exports.withInstallDirective=t.withInstallDirective,exports.withNoopInstall=t.withNoopInstall,exports.definePropType=r.definePropType,exports.useProps=r.useProps,exports.makeSlots=o.makeSlots,exports.useRender=i.useRender,exports.withDefineType=p.withDefineType;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./emits.js"),s=require("./expose.js"),t=require("./func.js"),r=require("./install.js"),i=require("./props.js"),o=require("./slots.js"),p=require("./useRender.js"),u=require("./with.js");exports.useEmits=e.useEmits,exports.useExpose=s.useExpose,exports.execFunction=t.execFunction,exports.withInstall=r.withInstall,exports.withInstallDirective=r.withInstallDirective,exports.withNoopInstall=r.withNoopInstall,exports.definePropType=i.definePropType,exports.useProps=i.useProps,exports.makeSlots=o.makeSlots,exports.useRender=p.useRender,exports.withDefineType=u.withDefineType;
2
2
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fast-china/utils",
3
- "version": "1.0.33",
3
+ "version": "1.0.34",
4
4
  "description": "Fast 工具库.",
5
5
  "type": "module",
6
6
  "keywords": [