@qxs-bns/utils 0.0.21 → 0.0.23

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.
@@ -1,2 +1,2 @@
1
- import{isPlainObject as e}from"./types.mjs";var s=Object.defineProperty,t=(e,t,r)=>((e,t,r)=>t in e?s(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);const r=class s{constructor(e,r){var o=this;if(this.apiInstance=e,this.isWholeResponse=r,t(this,"useApi",(async function(e,s){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:o.isWholeResponse,r=null,i=null;try{const i={...e,...s&&e.method?["GET"].includes(e.method.toUpperCase())?{params:s}:{data:s}:{}};i.url=(i.proxyPrefix||"")+e.url,delete i.proxyPrefix;const n=await o.apiInstance(i);r=t?n.data:n.data.data}catch(e){"AxiosError"!==e.name?o.isAxiosResponse(e)?i=e.data:o.isErrorResponse(e)&&(i=e):console.error(e)}return{res:r,error:i}})),s.instance)return s.instance;s.instance=this,this.isWholeResponse=r}isBusinessError(s){return e(s)&&"string"==typeof s.message&&"number"==typeof s.code&&0!==s.code}isAxiosResponse(s){return e(s)&&void 0!==s.data&&this.isBusinessError(s.data)&&void 0!==s.status&&void 0!==s.statusText&&void 0!==s.headers&&void 0!==s.config&&void 0!==s.request}isErrorResponse(e){return"code"in e&&"data"in e&&"message"in e&&0!==e.code}};t(r,"instance");let o=r;export{o as ApiService};
1
+ import{isPlainObject as e}from"./types.mjs";var s=Object.defineProperty,t=(e,t,r)=>((e,t,r)=>t in e?s(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);const r=class s{constructor(e,r){var o=this;if(this.apiInstance=e,this.isWholeResponse=r,t(this,"useApi",(async function(e,s){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:o.isWholeResponse,r=null,i=null;try{const i={...e,...s?e.method&&["GET"].includes(e.method.toUpperCase())?{params:s}:{data:s}:{}};i.url=(i.proxyPrefix||"")+e.url,delete i.proxyPrefix;const n=await o.apiInstance(i);r=t?n.data:n.data.data}catch(e){"AxiosError"!==e.name?o.isAxiosResponse(e)?i=e.data:o.isErrorResponse(e)&&(i=e):console.error(e)}return{res:r,error:i}})),s.instance)return s.instance;s.instance=this,this.isWholeResponse=r}isBusinessError(s){return e(s)&&"string"==typeof s.message&&"number"==typeof s.code&&0!==s.code}isAxiosResponse(s){return e(s)&&void 0!==s.data&&this.isBusinessError(s.data)&&void 0!==s.status&&void 0!==s.statusText&&void 0!==s.headers&&void 0!==s.config&&void 0!==s.request}isErrorResponse(e){return"code"in e&&"data"in e&&"message"in e&&0!==e.code}};t(r,"instance");let o=r;export{o as ApiService};
2
2
  //# sourceMappingURL=use-api.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-api.mjs","sources":["../../../../packages/utils/src/use-api.ts"],"sourcesContent":["import type { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios'\nimport { isPlainObject } from './types'\n\n/**\n * 成功响应的数据结构\n * @template T - 响应数据的类型\n */\nexport interface SuccessResponse<T> {\n code: number\n count: number\n data: T\n message: string\n}\n\n/**\n * 错误响应的数据结构\n */\nexport interface ErrorResponse {\n code: number\n data: null\n message: string\n}\n\n/**\n * API 响应的统一封装\n * @template W - 是否返回完整响应,true 返回完整响应,false 只返回 data\n * @template T - 响应数据的类型\n */\nexport interface UseApiResponse<W extends boolean = false, T = unknown> {\n res: W extends true ? SuccessResponse<T> : T\n error: ErrorResponse | null\n}\n\n/**\n * API URL 配置对象类型\n */\nexport interface UrlObjectType {\n url: string\n method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'\n proxyPrefix?: string\n}\n\n/**\n * API 类型映射,用于定义每个接口的请求和响应类型\n * @template U - URL 配置对象类型\n */\nexport type ApiTypeMap<U extends UrlObjectType> = {\n [K in U['url']]: {\n request: any\n response: any\n }\n}\n\n// 辅助类型,用于提取请求数据类型\ntype RequestPayload<T> = T extends { data: any } ? T['data'] : T\ntype RequestParams<T> = T extends { params: any } ? T['params'] : T\n\n/**\n * API 服务类,提供统一的请求处理和错误处理\n * @template T - API 类型映射\n * @template U - URL 配置对象类型\n *\n * @example\n * ```typescript\n * // 定义 API 类型映射\n * interface UserApi extends ApiTypeMap<UserUrlObject> {\n * '/user/list': {\n * request: { page: number; size: number }\n * response: User[]\n * }\n * }\n *\n * // 创建 API 服务实例\n * const api = new ApiService<UserApi, UserUrlObject>(axios.create(), false)\n *\n * // 发起请求\n * const { res, error } = await api.useApi({\n * url: '/user/list',\n * method: 'GET',\n * params: { page: 1, size: 10 }\n * })\n * ```\n */\nexport class ApiService<\n T extends ApiTypeMap<U>,\n U extends UrlObjectType,\n> {\n private static instance: ApiService<any, any>\n\n /**\n * 构造函数,实现单例模式\n * @param apiInstance - Axios 实例\n * @param isWholeResponse - 是否返回完整响应\n */\n constructor(\n private apiInstance: AxiosInstance,\n private isWholeResponse: boolean,\n ) {\n if (ApiService.instance) {\n return ApiService.instance as ApiService<T, U>\n }\n ApiService.instance = this\n this.isWholeResponse = isWholeResponse\n }\n\n /**\n * 判断是否为业务错误\n * @param obj - 待判断的对象\n */\n private isBusinessError(obj: ErrorResponse): boolean {\n return isPlainObject(obj)\n && typeof obj.message === 'string'\n && typeof obj.code === 'number'\n && obj.code !== 0\n }\n\n /**\n * 判断是否为 Axios 响应对象\n * @param value - 待判断的值\n */\n private isAxiosResponse(value: any): value is AxiosResponse {\n return isPlainObject(value)\n && value.data !== undefined\n && this.isBusinessError(value.data)\n && value.status !== undefined\n && value.statusText !== undefined\n && value.headers !== undefined\n && value.config !== undefined\n && value.request !== undefined\n }\n\n /**\n * 判断是否为错误响应\n * @param value - 待判断的值\n */\n private isErrorResponse(value: any): value is ErrorResponse {\n return 'code' in value && 'data' in value && 'message' in value && value.code !== 0\n }\n\n /**\n * 发起 API 请求\n * @template K - URL 配置对象类型\n * @template W - 是否返回完整响应\n * @param axiosConfig - Axios 请求配置\n * @param params - 请求参数\n * @param isWholeResponse - 是否返回完整响应,默认使用实例配置\n * @returns Promise<UseApiResponse> - 统一的响应格式\n */\n public useApi = async <\n K extends U,\n W extends boolean = false,\n >(\n axiosConfig: Omit<AxiosRequestConfig<RequestPayload<T[K['url']]['request']>>, 'params'> & K & {\n params?: RequestParams<T[K['url']]['request']>\n },\n params?: RequestParams<T[K['url']]['request']>,\n isWholeResponse: W = this.isWholeResponse as W,\n ): Promise<UseApiResponse<W, T[K['url']]['response']>> => {\n let res: UseApiResponse<W, T[K['url']]['response']>['res'] | null = null\n let error: UseApiResponse['error'] = null\n\n try {\n // 处理请求配置\n const config = {\n ...axiosConfig,\n ...(!!params && axiosConfig.method ? (['GET'].includes(axiosConfig.method.toUpperCase()) ? { params } : { data: params }) : {}),\n }\n\n // 处理代理前缀\n config.url = (config.proxyPrefix || '') + axiosConfig.url\n delete config.proxyPrefix\n\n // 发起请求\n const response = await this.apiInstance<SuccessResponse<T[K['url']]['response']>>(config)\n res = isWholeResponse\n ? response.data\n : response.data.data\n }\n catch (err: any) {\n // 错误处理\n if (err.name !== 'AxiosError') {\n if (this.isAxiosResponse(err)) {\n error = err.data\n }\n else if (this.isErrorResponse(err)) {\n error = err\n }\n }\n else {\n console.error(err)\n }\n }\n\n return { res: res!, error }\n }\n}\n"],"names":["_ApiService","constructor","apiInstance","isWholeResponse","_this","this","__publicField","async","axiosConfig","params","arguments","length","undefined","res","error","config","method","includes","toUpperCase","data","url","proxyPrefix","response","err","name","isAxiosResponse","isErrorResponse","console","instance","isBusinessError","obj","isPlainObject","message","code","value","status","statusText","headers","request","ApiService"],"mappings":"sMAmFO,MAAMA,EAAN,MAAMA,EAWXC,WAAAA,CACUC,EACAC,GACR,IAAAC,EAAAC,KACA,GAHQA,KAAAH,YAAAA,EACAG,KAAAF,gBAAAA,EAoDVG,EAAAD,KAAO,UAASE,eAIdC,EAGAC,GAEwD,IADxDN,EAAAO,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAqBN,GAAAA,EAAKD,gBAEtBU,EAAgE,KAChEC,EAAiC,KAEjC,IAEF,MAAMC,EAAS,IACVP,KACGC,GAAUD,EAAYQ,OAAU,CAAC,OAAOC,SAAST,EAAYQ,OAAOE,eAAiB,CAAET,UAAW,CAAEU,KAAMV,GAAY,CAAC,GAI/HM,EAAOK,KAAOL,EAAOM,aAAe,IAAMb,EAAYY,WAC/CL,EAAOM,YAGd,MAAMC,QAAiBlB,EAAKF,YAAsDa,GAClFF,EAAMV,EACFmB,EAASH,KACTG,EAASH,KAAKA,WAEbI,GAEY,eAAbA,EAAIC,KACFpB,EAAKqB,gBAAgBF,GACvBT,EAAQS,EAAIJ,KAELf,EAAKsB,gBAAgBH,KACpBT,EAAAS,GAIVI,QAAQb,MAAMS,EAElB,CAEO,MAAA,CAAEV,MAAWC,QACtB,IAhGMd,EAAW4B,SACb,OAAO5B,EAAW4B,SAEpB5B,EAAW4B,SAAWvB,KACtBA,KAAKF,gBAAkBA,CACzB,CAMQ0B,eAAAA,CAAgBC,GACtB,OAAOC,EAAcD,IACO,iBAAhBA,EAAIE,SACS,iBAAbF,EAAIG,MACE,IAAbH,EAAIG,IACX,CAMQR,eAAAA,CAAgBS,GACf,OAAAH,EAAcG,SACD,IAAfA,EAAMf,MACNd,KAAKwB,gBAAgBK,EAAMf,YACV,IAAjBe,EAAMC,aACe,IAArBD,EAAME,iBACY,IAAlBF,EAAMG,cACW,IAAjBH,EAAMnB,aACY,IAAlBmB,EAAMI,OACb,CAMQZ,eAAAA,CAAgBQ,GACtB,MAAO,SAAUA,GAAS,SAAUA,GAAS,YAAaA,GAAwB,IAAfA,EAAMD,IAC3E,GAlDA3B,EAJWN,EAII,YAJV,IAAMuC,EAANvC"}
1
+ {"version":3,"file":"use-api.mjs","sources":["../../../../packages/utils/src/use-api.ts"],"sourcesContent":["import type { AxiosInstance, AxiosRequestConfig, AxiosResponse, Method } from 'axios'\nimport { isPlainObject } from './types'\n\n/**\n * 成功响应的数据结构\n * @template T - 响应数据的类型\n */\nexport interface SuccessResponse<T> {\n code: number\n count: number\n data: T\n message: string\n}\n\n/**\n * 错误响应的数据结构\n */\nexport interface ErrorResponse {\n code: number\n data: null\n message: string\n}\n\n/**\n * API 响应的统一封装\n * @template W - 是否返回完整响应,true 返回完整响应,false 只返回 data\n * @template T - 响应数据的类型\n */\nexport interface UseApiResponse<W extends boolean = false, T = unknown> {\n res: W extends true ? SuccessResponse<T> : T\n error: ErrorResponse | null\n}\n\n/**\n * API URL 配置对象类型\n */\nexport interface UrlObjectType {\n url: string\n method: Method\n proxyPrefix?: string\n}\n\n/**\n * API 类型映射,用于定义每个接口的请求和响应类型\n * @template U - URL 配置对象类型\n */\nexport type ApiTypeMap<U extends UrlObjectType> = {\n [K in U['url']]: {\n request: any\n response: any\n }\n}\n\n// 辅助类型,用于提取请求数据类型\ntype RequestPayload<T> = T extends { data: any } ? T['data'] : T\ntype RequestParams<T> = T extends { params: any } ? T['params'] : T\n\n/**\n * API 服务类,提供统一的请求处理和错误处理\n * @template T - API 类型映射\n * @template U - URL 配置对象类型\n *\n * @example\n * ```typescript\n * // 定义 API 类型映射\n * interface UserApi extends ApiTypeMap<UserUrlObject> {\n * '/user/list': {\n * request: { page: number; size: number }\n * response: User[]\n * }\n * }\n *\n * // 创建 API 服务实例\n * const api = new ApiService<UserApi, UserUrlObject>(axios.create(), false)\n *\n * // 发起请求\n * const { res, error } = await api.useApi({\n * url: '/user/list',\n * method: 'GET',\n * params: { page: 1, size: 10 }\n * })\n * ```\n */\nexport class ApiService<\n T extends ApiTypeMap<U>,\n U extends UrlObjectType,\n> {\n private static instance: ApiService<any, any>\n\n /**\n * 构造函数,实现单例模式\n * @param apiInstance - Axios 实例\n * @param isWholeResponse - 是否返回完整响应\n */\n constructor(\n private apiInstance: AxiosInstance,\n private isWholeResponse: boolean,\n ) {\n if (ApiService.instance) {\n return ApiService.instance as ApiService<T, U>\n }\n ApiService.instance = this\n this.isWholeResponse = isWholeResponse\n }\n\n /**\n * 判断是否为业务错误\n * @param obj - 待判断的对象\n */\n private isBusinessError(obj: ErrorResponse): boolean {\n return isPlainObject(obj)\n && typeof obj.message === 'string'\n && typeof obj.code === 'number'\n && obj.code !== 0\n }\n\n /**\n * 判断是否为 Axios 响应对象\n * @param value - 待判断的值\n */\n private isAxiosResponse(value: any): value is AxiosResponse {\n return isPlainObject(value)\n && value.data !== undefined\n && this.isBusinessError(value.data)\n && value.status !== undefined\n && value.statusText !== undefined\n && value.headers !== undefined\n && value.config !== undefined\n && value.request !== undefined\n }\n\n /**\n * 判断是否为错误响应\n * @param value - 待判断的值\n */\n private isErrorResponse(value: any): value is ErrorResponse {\n return 'code' in value && 'data' in value && 'message' in value && value.code !== 0\n }\n\n /**\n * 发起 API 请求\n * @template K - URL 配置对象类型\n * @template W - 是否返回完整响应\n * @param axiosConfig - Axios 请求配置\n * @param params - 请求参数\n * @param isWholeResponse - 是否返回完整响应,默认使用实例配置\n * @returns Promise<UseApiResponse> - 统一的响应格式\n */\n public useApi = async <\n K extends U,\n W extends boolean = false,\n >(\n axiosConfig: Omit<AxiosRequestConfig<RequestPayload<T[K['url']]['request']>>, 'params'> & K & {\n params?: RequestParams<T[K['url']]['request']>\n },\n params?: RequestParams<T[K['url']]['request']>,\n isWholeResponse: W = this.isWholeResponse as W,\n ): Promise<UseApiResponse<W, T[K['url']]['response']>> => {\n let res: UseApiResponse<W, T[K['url']]['response']>['res'] | null = null\n let error: UseApiResponse['error'] = null\n\n try {\n // 处理请求配置\n const config = {\n ...axiosConfig,\n ...(params ? (axiosConfig.method && ['GET'].includes(axiosConfig.method.toUpperCase()) ? { params } : { data: params }) : {}),\n }\n\n // 处理代理前缀\n config.url = (config.proxyPrefix || '') + axiosConfig.url\n delete config.proxyPrefix\n\n // 发起请求\n const response = await this.apiInstance<SuccessResponse<T[K['url']]['response']>>(config)\n res = isWholeResponse\n ? response.data\n : response.data.data\n }\n catch (err: any) {\n // 错误处理\n if (err.name !== 'AxiosError') {\n if (this.isAxiosResponse(err)) {\n error = err.data\n }\n else if (this.isErrorResponse(err)) {\n error = err\n }\n }\n else {\n console.error(err)\n }\n }\n\n return { res: res!, error }\n }\n}\n"],"names":["_ApiService","constructor","apiInstance","isWholeResponse","_this","this","__publicField","async","axiosConfig","params","arguments","length","undefined","res","error","config","method","includes","toUpperCase","data","url","proxyPrefix","response","err","name","isAxiosResponse","isErrorResponse","console","instance","isBusinessError","obj","isPlainObject","message","code","value","status","statusText","headers","request","ApiService"],"mappings":"sMAmFO,MAAMA,EAAN,MAAMA,EAWXC,WAAAA,CACUC,EACAC,GACR,IAAAC,EAAAC,KACA,GAHQA,KAAAH,YAAAA,EACAG,KAAAF,gBAAAA,EAoDVG,EAAAD,KAAO,UAASE,eAIdC,EAGAC,GAEwD,IADxDN,EAAAO,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAqBN,GAAAA,EAAKD,gBAEtBU,EAAgE,KAChEC,EAAiC,KAEjC,IAEF,MAAMC,EAAS,IACVP,KACCC,EAAUD,EAAYQ,QAAU,CAAC,OAAOC,SAAST,EAAYQ,OAAOE,eAAiB,CAAET,UAAW,CAAEU,KAAMV,GAAY,CAAC,GAI7HM,EAAOK,KAAOL,EAAOM,aAAe,IAAMb,EAAYY,WAC/CL,EAAOM,YAGd,MAAMC,QAAiBlB,EAAKF,YAAsDa,GAClFF,EAAMV,EACFmB,EAASH,KACTG,EAASH,KAAKA,WAEbI,GAEY,eAAbA,EAAIC,KACFpB,EAAKqB,gBAAgBF,GACvBT,EAAQS,EAAIJ,KAELf,EAAKsB,gBAAgBH,KACpBT,EAAAS,GAIVI,QAAQb,MAAMS,EAElB,CAEO,MAAA,CAAEV,MAAWC,QACtB,IAhGMd,EAAW4B,SACb,OAAO5B,EAAW4B,SAEpB5B,EAAW4B,SAAWvB,KACtBA,KAAKF,gBAAkBA,CACzB,CAMQ0B,eAAAA,CAAgBC,GACtB,OAAOC,EAAcD,IACO,iBAAhBA,EAAIE,SACS,iBAAbF,EAAIG,MACE,IAAbH,EAAIG,IACX,CAMQR,eAAAA,CAAgBS,GACf,OAAAH,EAAcG,SACD,IAAfA,EAAMf,MACNd,KAAKwB,gBAAgBK,EAAMf,YACV,IAAjBe,EAAMC,aACe,IAArBD,EAAME,iBACY,IAAlBF,EAAMG,cACW,IAAjBH,EAAMnB,aACY,IAAlBmB,EAAMI,OACb,CAMQZ,eAAAA,CAAgBQ,GACtB,MAAO,SAAUA,GAAS,SAAUA,GAAS,YAAaA,GAAwB,IAAfA,EAAMD,IAC3E,GAlDA3B,EAJWN,EAII,YAJV,IAAMuC,EAANvC"}
@@ -1,2 +1,2 @@
1
- const t={id:"wm_div_id",prefix:"mask_div_id",text:"测试水印",x:0,y:0,rows:0,cols:0,width:0,height:0,x_space:100,y_space:40,font:"微软雅黑",color:"black",fontsize:"18px",alpha:.15,angle:15,parent_width:0,parent_height:0,parent_node:null,monitor:!0};function e(){const e={...t};let n=!1;const i=new MutationObserver((function(t){if(n)return void(n=!1);if(!document.getElementById(e.id))return void s(e);t.some((t=>"childList"===t.type||("attributes"===t.type||"characterData"===t.type)))&&s(e)})),o=new ResizeObserver((()=>{n||s(e)}));function c(t,n,i){const o=document.createElement("div");return o.textContent=e.text,o.id=`${e.prefix}${i}`,o.style.cssText=`\n transform: rotate(-${e.angle}deg);\n position: absolute;\n left: ${t}px;\n top: ${n}px;\n overflow: hidden;\n z-index: 9999999;\n opacity: ${e.alpha};\n font-size: ${e.fontsize};\n font-family: ${e.font};\n color: ${e.color};\n text-align: center;\n width: ${e.width}px;\n height: ${e.height}px;\n line-height: ${e.height}px;\n display: flex;\n align-items: center;\n justify-content: center;\n user-select: none;\n visibility: visible;\n `.replace(/\s+/g," ").trim(),o}function s(t){if(a(),Object.assign(e,t),0===e.width&&0===e.height||0===e.width||0===e.height){const t=function(t,e,n){const i=document.createElement("canvas").getContext("2d");if(!i)return{width:100,height:100};i.font=`${n} ${e}`;const o=i.measureText(t.trim()),c=Number.parseFloat(n),s=void 0!==o.actualBoundingBoxAscent&&void 0!==o.actualBoundingBoxDescent?o.actualBoundingBoxAscent+o.actualBoundingBoxDescent:c;return{width:Math.ceil(o.width),height:Math.ceil(s)}}(e.text,e.font,e.fontsize),n=10;0===e.width&&(e.width=t.width+n),0===e.height&&(e.height=t.height+n)}const n=e.parent_node||document.body,s=Math.max(n.scrollWidth,n.clientWidth),d=Math.max(n.scrollHeight,n.clientHeight),r=document.createElement("div");r.id=e.id,n.closest("body")&&"static"===getComputedStyle(n).position&&(n.style.position="relative"),r.style.cssText="\n pointer-events: none;\n display: block;\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 9999999;\n overflow: hidden;\n ".replace(/\s+/g," ").trim();const h=r.attachShadow?r.attachShadow({mode:"open"}):r;n.appendChild(r);const{cols:l,rows:p,x_space:u,y_space:g}=function(t,n){const i=t-e.x,o=n-e.y,c=e.x_space||20,s=e.y_space||20;return{cols:Math.ceil(i/(e.width+c)),rows:Math.ceil(o/(e.height+s)),x_space:c,y_space:s}}(s,d);e.cols=l,e.rows=p,e.x_space=u,e.y_space=g;const x=document.createDocumentFragment();for(let t=0;t<p;t++){const n=e.y+(e.height+g)*t;for(let i=0;i<l;i++){const o=e.x+(e.width+u)*i;x.appendChild(c(o,n,t*l+i))}}if(h.appendChild(x),e.monitor){o.observe(n);const t={attributes:!0,childList:!0,subtree:!0,characterData:!0};i.observe(r,t),h!==r&&i.observe(h,t)}}function a(){const t=document.getElementById(e.id);i.disconnect(),t&&t.parentNode?.removeChild(t)}return{addMark:s,removeMark:()=>{n=!0,a()}}}export{e as watermark};
1
+ const t={id:"wm_div_id",prefix:"mask_div_id",text:"测试水印",x:0,y:0,rows:0,cols:0,width:0,height:0,x_space:100,y_space:40,font:"微软雅黑",color:"black",fontsize:"18px",alpha:.15,zIndex:9999999,angle:15,parent_width:0,parent_height:0,parent_node:null,monitor:!0};function e(){const e={...t};let n=!1;const i=new MutationObserver((function(t){if(n)return void(n=!1);if(!document.getElementById(e.id))return void s(e);t.some((t=>"childList"===t.type||("attributes"===t.type||"characterData"===t.type)))&&s(e)})),o=new ResizeObserver((()=>{n||s(e)}));function c(t,n,i){const o=document.createElement("div");return o.textContent=e.text,o.id=`${e.prefix}${i}`,o.style.cssText=`\n transform: rotate(-${e.angle}deg);\n position: absolute;\n left: ${t}px;\n top: ${n}px;\n overflow: hidden;\n z-index: ${e.zIndex};\n opacity: ${e.alpha};\n font-size: ${e.fontsize};\n font-family: ${e.font};\n color: ${e.color};\n text-align: center;\n width: ${e.width}px;\n height: ${e.height}px;\n line-height: ${e.height}px;\n display: flex;\n align-items: center;\n justify-content: center;\n user-select: none;\n visibility: visible;\n `.replace(/\s+/g," ").trim(),o}function s(t){if(a(),Object.assign(e,t),0===e.width&&0===e.height||0===e.width||0===e.height){const t=function(t,e,n){const i=document.createElement("canvas").getContext("2d");if(!i)return{width:100,height:100};i.font=`${n} ${e}`;const o=i.measureText(t.trim()),c=Number.parseFloat(n),s=void 0!==o.actualBoundingBoxAscent&&void 0!==o.actualBoundingBoxDescent?o.actualBoundingBoxAscent+o.actualBoundingBoxDescent:c;return{width:Math.ceil(o.width),height:Math.ceil(s)}}(e.text,e.font,e.fontsize),n=10;0===e.width&&(e.width=t.width+n),0===e.height&&(e.height=t.height+n)}const n=e.parent_node||document.body,s=Math.max(n.scrollWidth,n.clientWidth),d=Math.max(n.scrollHeight,n.clientHeight),r=document.createElement("div");r.id=e.id,n.closest("body")&&"static"===getComputedStyle(n).position&&(n.style.position="relative"),r.style.cssText="\n pointer-events: none;\n display: block;\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 9999999;\n overflow: hidden;\n ".replace(/\s+/g," ").trim();const h=r.attachShadow?r.attachShadow({mode:"open"}):r;n.appendChild(r);const{cols:l,rows:p,x_space:u,y_space:x}=function(t,n){const i=t-e.x,o=n-e.y,c=e.x_space||20,s=e.y_space||20;return{cols:Math.ceil(i/(e.width+c)),rows:Math.ceil(o/(e.height+s)),x_space:c,y_space:s}}(s,d);e.cols=l,e.rows=p,e.x_space=u,e.y_space=x;const g=document.createDocumentFragment();for(let t=0;t<p;t++){const n=e.y+(e.height+x)*t;for(let i=0;i<l;i++){const o=e.x+(e.width+u)*i;g.appendChild(c(o,n,t*l+i))}}if(h.appendChild(g),e.monitor){o.observe(n);const t={attributes:!0,childList:!0,subtree:!0,characterData:!0};i.observe(r,t),h!==r&&i.observe(h,t)}}function a(){const t=document.getElementById(e.id);i.disconnect(),t&&t.parentNode?.removeChild(t)}return{addMark:s,removeMark:()=>{n=!0,a()}}}export{e as watermark};
2
2
  //# sourceMappingURL=watermark.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"watermark.mjs","sources":["../../../../packages/utils/src/watermark.ts"],"sourcesContent":["interface SettingsType {\n /** 水印总体的id */\n id?: string\n /** 小水印的id前缀 */\n prefix?: string\n /** 水印文案 */\n text?: string\n /** 水印起始位置x轴坐标 */\n x?: number\n /** 水印起始位置Y轴坐标 */\n y?: number\n /** 水印行数 */\n rows?: number\n /** 水印列数 */\n cols?: number\n /** 水印x轴间隔 */\n x_space?: number\n /** 水印y轴间隔 */\n y_space?: number\n /** 水印字体 */\n font?: string\n /** 水印字体颜色 */\n color?: string\n /** 水印字体大小 */\n fontsize?: string\n /** 水印透明度,要求设置在大于等于0.005 */\n alpha?: number\n /** 水印宽度 */\n width?: number\n /** 水印长度 */\n height?: number\n /** 水印倾斜度数 */\n angle?: number\n /** 水印的总体宽度(默认值:body的scrollWidth和clientWidth的较大值) */\n parent_width?: number\n /** 水印的总体高度(默认值:body的scrollHeight和clientHeight的较大值) */\n parent_height?: number\n /** 水印插件挂载的父元素element,不输入则默认挂在body */\n parent_node?: HTMLElement | null\n /** 是否监控,true: 不可删除水印; false: 可删水印 */\n monitor?: boolean\n}\n\n// 默认配置\nconst initialSettings: Required<SettingsType> = {\n id: 'wm_div_id',\n prefix: 'mask_div_id',\n text: '测试水印',\n x: 0,\n y: 0,\n rows: 0,\n cols: 0,\n width: 0,\n height: 0,\n x_space: 100,\n y_space: 40,\n font: '微软雅黑',\n color: 'black',\n fontsize: '18px',\n alpha: 0.15,\n angle: 15,\n parent_width: 0,\n parent_height: 0,\n parent_node: null,\n monitor: true,\n}\n\nfunction calculateTextDimensions(text: string, font: string, fontSize: string): { width: number, height: number } {\n const canvas = document.createElement('canvas')\n const context = canvas.getContext('2d')\n if (!context) {\n return { width: 100, height: 100 }\n }\n\n context.font = `${fontSize} ${font}`\n const metrics = context.measureText(text.trim())\n const fontSizeNum = Number.parseFloat(fontSize)\n\n // 移除 DPI 缩放,直接使用原始值\n const height = (metrics.actualBoundingBoxAscent !== undefined && metrics.actualBoundingBoxDescent !== undefined)\n ? (metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent)\n : fontSizeNum\n\n return {\n width: Math.ceil(metrics.width),\n height: Math.ceil(height),\n }\n}\n\nexport function watermark() {\n const globalSetting: Required<SettingsType> = { ...initialSettings }\n let forceRemove = false\n const watermarkDom = new MutationObserver(domChangeCallback)\n const resizeObserver = new ResizeObserver(() => {\n if (!forceRemove) {\n loadMark(globalSetting)\n }\n })\n\n // 计算水印布局\n function calculateWatermarkLayout(pageWidth: number, pageHeight: number) {\n const availableWidth = pageWidth - globalSetting.x\n const availableHeight = pageHeight - globalSetting.y\n\n // 使用固定间距\n const x_space = globalSetting.x_space || 20 // 如果未设置则使用默认值\n const y_space = globalSetting.y_space || 20 // 如果未设置则使用默认值\n\n // 计算能容纳的行数和列数\n const cols = Math.ceil(availableWidth / (globalSetting.width + x_space))\n const rows = Math.ceil(availableHeight / (globalSetting.height + y_space))\n\n return {\n cols,\n rows,\n x_space,\n y_space,\n }\n }\n\n // 创建水印元素\n function createWatermarkElement(x: number, y: number, index: number): HTMLElement {\n const maskDiv = document.createElement('div')\n maskDiv.textContent = globalSetting.text\n maskDiv.id = `${globalSetting.prefix}${index}`\n\n maskDiv.style.cssText = `\n transform: rotate(-${globalSetting.angle}deg);\n position: absolute;\n left: ${x}px;\n top: ${y}px;\n overflow: hidden;\n z-index: 9999999;\n opacity: ${globalSetting.alpha};\n font-size: ${globalSetting.fontsize};\n font-family: ${globalSetting.font};\n color: ${globalSetting.color};\n text-align: center;\n width: ${globalSetting.width}px;\n height: ${globalSetting.height}px;\n line-height: ${globalSetting.height}px;\n display: flex;\n align-items: center;\n justify-content: center;\n user-select: none;\n visibility: visible;\n `.replace(/\\s+/g, ' ').trim()\n\n return maskDiv\n }\n\n // 加载水印\n function loadMark(settings: Partial<SettingsType>) {\n removeMark()\n Object.assign(globalSetting, settings)\n\n if ((globalSetting.width === 0 && globalSetting.height === 0) || globalSetting.width === 0 || globalSetting.height === 0) {\n // 计算文本尺寸\n const textDimensions = calculateTextDimensions(\n globalSetting.text,\n globalSetting.font,\n globalSetting.fontsize,\n )\n const padding = 10\n if (globalSetting.width === 0) {\n globalSetting.width = textDimensions.width + padding\n }\n if (globalSetting.height === 0) {\n globalSetting.height = textDimensions.height + padding\n }\n }\n\n const parentElement = globalSetting.parent_node || document.body\n const pageWidth = Math.max(parentElement.scrollWidth, parentElement.clientWidth)\n const pageHeight = Math.max(parentElement.scrollHeight, parentElement.clientHeight)\n\n const watermarkContainer = document.createElement('div')\n watermarkContainer.id = globalSetting.id\n\n // 处理父元素定位\n if (parentElement.closest('body') && getComputedStyle(parentElement).position === 'static') {\n parentElement.style.position = 'relative'\n }\n\n watermarkContainer.style.cssText = `\n pointer-events: none;\n display: block;\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 9999999;\n overflow: hidden;\n `.replace(/\\s+/g, ' ').trim()\n\n const shadowRoot = watermarkContainer.attachShadow ? watermarkContainer.attachShadow({ mode: 'open' }) : watermarkContainer\n\n parentElement.appendChild(watermarkContainer)\n\n const { cols, rows, x_space, y_space } = calculateWatermarkLayout(pageWidth, pageHeight)\n globalSetting.cols = cols\n globalSetting.rows = rows\n globalSetting.x_space = x_space\n globalSetting.y_space = y_space\n\n const fragment = document.createDocumentFragment()\n for (let i = 0; i < rows; i++) {\n const y = globalSetting.y + (globalSetting.height + y_space) * i\n for (let j = 0; j < cols; j++) {\n const x = globalSetting.x + (globalSetting.width + x_space) * j\n fragment.appendChild(createWatermarkElement(x, y, i * cols + j))\n }\n }\n shadowRoot.appendChild(fragment)\n\n if (globalSetting.monitor) {\n // 监听父元素大小变化\n resizeObserver.observe(parentElement)\n\n // 监听水印容器及其子元素\n const config: MutationObserverInit = {\n attributes: true, // 监听属性变化\n childList: true, // 监听子元素变化\n subtree: true, // 监听子树变化\n characterData: true, // 监听文本内容变化\n }\n\n // 监听水印容器\n watermarkDom.observe(watermarkContainer, config)\n\n // 如果使用了 Shadow DOM,还需要监听 shadowRoot 内的元素\n if (shadowRoot !== watermarkContainer) {\n watermarkDom.observe(shadowRoot, config)\n }\n }\n }\n\n // 移除水印\n function removeMark() {\n const watermarkElement = document.getElementById(globalSetting.id)\n watermarkDom.disconnect()\n if (watermarkElement) {\n watermarkElement.parentNode?.removeChild(watermarkElement)\n }\n }\n\n // 监听DOM变化\n function domChangeCallback(records: MutationRecord[]) {\n if (forceRemove) {\n forceRemove = false\n return\n }\n\n const watermarkElement = document.getElementById(globalSetting.id)\n if (!watermarkElement) {\n // 如果水印容器被删除,重新创建\n loadMark(globalSetting)\n return\n }\n\n // 检查是否有任何修改\n const hasChanges = records.some((record) => {\n // 检查元素是否被删除或添加\n if (record.type === 'childList') {\n return true\n }\n\n // 检查属性是否被修改\n if (record.type === 'attributes') {\n return true\n }\n\n // 检查文本内容是否被修改\n if (record.type === 'characterData') {\n return true\n }\n\n return false\n })\n\n if (hasChanges) {\n loadMark(globalSetting)\n }\n }\n\n return {\n addMark: loadMark,\n removeMark: () => {\n forceRemove = true\n // 删除这行,不重置全局配置\n // Object.assign(globalSetting, initialSettings)\n removeMark()\n },\n }\n}\n"],"names":["initialSettings","id","prefix","text","x","y","rows","cols","width","height","x_space","y_space","font","color","fontsize","alpha","angle","parent_width","parent_height","parent_node","monitor","watermark","globalSetting","forceRemove","watermarkDom","MutationObserver","records","document","getElementById","loadMark","some","record","type","resizeObserver","ResizeObserver","createWatermarkElement","index","maskDiv","createElement","textContent","style","cssText","replace","trim","settings","removeMark","Object","assign","textDimensions","fontSize","context","getContext","metrics","measureText","fontSizeNum","Number","parseFloat","actualBoundingBoxAscent","actualBoundingBoxDescent","Math","ceil","calculateTextDimensions","padding","parentElement","body","pageWidth","max","scrollWidth","clientWidth","pageHeight","scrollHeight","clientHeight","watermarkContainer","closest","getComputedStyle","position","shadowRoot","attachShadow","mode","appendChild","availableWidth","availableHeight","calculateWatermarkLayout","fragment","createDocumentFragment","i","j","observe","config","attributes","childList","subtree","characterData","watermarkElement","disconnect","parentNode","removeChild","addMark"],"mappings":"AA4CA,MAAMA,EAA0C,CAC9CC,GAAI,YACJC,OAAQ,cACRC,KAAM,OACNC,EAAG,EACHC,EAAG,EACHC,KAAM,EACNC,KAAM,EACNC,MAAO,EACPC,OAAQ,EACRC,QAAS,IACTC,QAAS,GACTC,KAAM,OACNC,MAAO,QACPC,SAAU,OACVC,MAAO,IACPC,MAAO,GACPC,aAAc,EACdC,cAAe,EACfC,YAAa,KACbC,SAAS,GAyBJ,SAASC,IACR,MAAAC,EAAwC,IAAKtB,GACnD,IAAIuB,GAAc,EACZ,MAAAC,EAAe,IAAIC,kBA4JzB,SAA2BC,GACzB,GAAIH,EAEF,YADcA,GAAA,GAKhB,IADyBI,SAASC,eAAeN,EAAcrB,IAI7D,YADA4B,EAASP,GAKQI,EAAQI,MAAMC,GAEX,cAAhBA,EAAOC,OAKS,eAAhBD,EAAOC,MAKS,kBAAhBD,EAAOC,SAQXH,EAASP,EAEb,IA/LMW,EAAiB,IAAIC,gBAAe,KACnCX,GACHM,EAASP,EACX,IAyBO,SAAAa,EAAuB/B,EAAWC,EAAW+B,GAC9C,MAAAC,EAAUV,SAASW,cAAc,OA0BhC,OAzBPD,EAAQE,YAAcjB,EAAcnB,KAC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ZC,WAAW,EACXC,SAAS,EACTC,eAAe,GAIJpE,EAAA+D,QAAQf,EAAoBgB,GAGrCZ,IAAeJ,GACJhD,EAAA+D,QAAQX,EAAYY,EAErC,CACF,CAGA,SAAS3C,IACP,MAAMgD,EAAmBlE,SAASC,eAAeN,EAAcrB,IAC/DuB,EAAasE,aACTD,GACeA,EAAAE,YAAYC,YAAYH,EAE7C,CAyCO,MAAA,CACLI,QAASpE,EACTgB,WAAYA,KACItB,GAAA,EAGHsB,GAAA,EAGjB"}
1
+ {"version":3,"file":"watermark.mjs","sources":["../../../../packages/utils/src/watermark.ts"],"sourcesContent":["interface SettingsType {\n /** 水印总体的id */\n id?: string\n /** 小水印的id前缀 */\n prefix?: string\n /** 水印文案 */\n text?: string\n /** 水印起始位置x轴坐标 */\n x?: number\n /** 水印起始位置Y轴坐标 */\n y?: number\n /** 水印行数 */\n rows?: number\n /** 水印层级 */\n zIndex?: number\n /** 水印列数 */\n cols?: number\n /** 水印x轴间隔 */\n x_space?: number\n /** 水印y轴间隔 */\n y_space?: number\n /** 水印字体 */\n font?: string\n /** 水印字体颜色 */\n color?: string\n /** 水印字体大小 */\n fontsize?: string\n /** 水印透明度,要求设置在大于等于0.005 */\n alpha?: number\n /** 水印宽度 */\n width?: number\n /** 水印长度 */\n height?: number\n /** 水印倾斜度数 */\n angle?: number\n /** 水印的总体宽度(默认值:body的scrollWidth和clientWidth的较大值) */\n parent_width?: number\n /** 水印的总体高度(默认值:body的scrollHeight和clientHeight的较大值) */\n parent_height?: number\n /** 水印插件挂载的父元素element,不输入则默认挂在body */\n parent_node?: HTMLElement | null\n /** 是否监控,true: 不可删除水印; false: 可删水印 */\n monitor?: boolean\n}\n\n// 默认配置\nconst initialSettings: Required<SettingsType> = {\n id: 'wm_div_id',\n prefix: 'mask_div_id',\n text: '测试水印',\n x: 0,\n y: 0,\n rows: 0,\n cols: 0,\n width: 0,\n height: 0,\n x_space: 100,\n y_space: 40,\n font: '微软雅黑',\n color: 'black',\n fontsize: '18px',\n alpha: 0.15,\n zIndex: 9999999,\n angle: 15,\n parent_width: 0,\n parent_height: 0,\n parent_node: null,\n monitor: true,\n}\n\nfunction calculateTextDimensions(text: string, font: string, fontSize: string): { width: number, height: number } {\n const canvas = document.createElement('canvas')\n const context = canvas.getContext('2d')\n if (!context) {\n return { width: 100, height: 100 }\n }\n\n context.font = `${fontSize} ${font}`\n const metrics = context.measureText(text.trim())\n const fontSizeNum = Number.parseFloat(fontSize)\n\n // 移除 DPI 缩放,直接使用原始值\n const height = (metrics.actualBoundingBoxAscent !== undefined && metrics.actualBoundingBoxDescent !== undefined)\n ? (metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent)\n : fontSizeNum\n\n return {\n width: Math.ceil(metrics.width),\n height: Math.ceil(height),\n }\n}\n\nexport function watermark() {\n const globalSetting: Required<SettingsType> = { ...initialSettings }\n let forceRemove = false\n const watermarkDom = new MutationObserver(domChangeCallback)\n const resizeObserver = new ResizeObserver(() => {\n if (!forceRemove) {\n loadMark(globalSetting)\n }\n })\n\n // 计算水印布局\n function calculateWatermarkLayout(pageWidth: number, pageHeight: number) {\n const availableWidth = pageWidth - globalSetting.x\n const availableHeight = pageHeight - globalSetting.y\n\n // 使用固定间距\n const x_space = globalSetting.x_space || 20 // 如果未设置则使用默认值\n const y_space = globalSetting.y_space || 20 // 如果未设置则使用默认值\n\n // 计算能容纳的行数和列数\n const cols = Math.ceil(availableWidth / (globalSetting.width + x_space))\n const rows = Math.ceil(availableHeight / (globalSetting.height + y_space))\n\n return {\n cols,\n rows,\n x_space,\n y_space,\n }\n }\n\n // 创建水印元素\n function createWatermarkElement(x: number, y: number, index: number): HTMLElement {\n const maskDiv = document.createElement('div')\n maskDiv.textContent = globalSetting.text\n maskDiv.id = `${globalSetting.prefix}${index}`\n\n maskDiv.style.cssText = `\n transform: rotate(-${globalSetting.angle}deg);\n position: absolute;\n left: ${x}px;\n top: ${y}px;\n overflow: hidden;\n z-index: ${globalSetting.zIndex};\n opacity: ${globalSetting.alpha};\n font-size: ${globalSetting.fontsize};\n font-family: ${globalSetting.font};\n color: ${globalSetting.color};\n text-align: center;\n width: ${globalSetting.width}px;\n height: ${globalSetting.height}px;\n line-height: ${globalSetting.height}px;\n display: flex;\n align-items: center;\n justify-content: center;\n user-select: none;\n visibility: visible;\n `.replace(/\\s+/g, ' ').trim()\n\n return maskDiv\n }\n\n // 加载水印\n function loadMark(settings: Partial<SettingsType>) {\n removeMark()\n Object.assign(globalSetting, settings)\n\n if ((globalSetting.width === 0 && globalSetting.height === 0) || globalSetting.width === 0 || globalSetting.height === 0) {\n // 计算文本尺寸\n const textDimensions = calculateTextDimensions(\n globalSetting.text,\n globalSetting.font,\n globalSetting.fontsize,\n )\n const padding = 10\n if (globalSetting.width === 0) {\n globalSetting.width = textDimensions.width + padding\n }\n if (globalSetting.height === 0) {\n globalSetting.height = textDimensions.height + padding\n }\n }\n\n const parentElement = globalSetting.parent_node || document.body\n const pageWidth = Math.max(parentElement.scrollWidth, parentElement.clientWidth)\n const pageHeight = Math.max(parentElement.scrollHeight, parentElement.clientHeight)\n\n const watermarkContainer = document.createElement('div')\n watermarkContainer.id = globalSetting.id\n\n // 处理父元素定位\n if (parentElement.closest('body') && getComputedStyle(parentElement).position === 'static') {\n parentElement.style.position = 'relative'\n }\n\n watermarkContainer.style.cssText = `\n pointer-events: none;\n display: block;\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 9999999;\n overflow: hidden;\n `.replace(/\\s+/g, ' ').trim()\n\n const shadowRoot = watermarkContainer.attachShadow ? watermarkContainer.attachShadow({ mode: 'open' }) : watermarkContainer\n\n parentElement.appendChild(watermarkContainer)\n\n const { cols, rows, x_space, y_space } = calculateWatermarkLayout(pageWidth, pageHeight)\n globalSetting.cols = cols\n globalSetting.rows = rows\n globalSetting.x_space = x_space\n globalSetting.y_space = y_space\n\n const fragment = document.createDocumentFragment()\n for (let i = 0; i < rows; i++) {\n const y = globalSetting.y + (globalSetting.height + y_space) * i\n for (let j = 0; j < cols; j++) {\n const x = globalSetting.x + (globalSetting.width + x_space) * j\n fragment.appendChild(createWatermarkElement(x, y, i * cols + j))\n }\n }\n shadowRoot.appendChild(fragment)\n\n if (globalSetting.monitor) {\n // 监听父元素大小变化\n resizeObserver.observe(parentElement)\n\n // 监听水印容器及其子元素\n const config: MutationObserverInit = {\n attributes: true, // 监听属性变化\n childList: true, // 监听子元素变化\n subtree: true, // 监听子树变化\n characterData: true, // 监听文本内容变化\n }\n\n // 监听水印容器\n watermarkDom.observe(watermarkContainer, config)\n\n // 如果使用了 Shadow DOM,还需要监听 shadowRoot 内的元素\n if (shadowRoot !== watermarkContainer) {\n watermarkDom.observe(shadowRoot, config)\n }\n }\n }\n\n // 移除水印\n function removeMark() {\n const watermarkElement = document.getElementById(globalSetting.id)\n watermarkDom.disconnect()\n if (watermarkElement) {\n watermarkElement.parentNode?.removeChild(watermarkElement)\n }\n }\n\n // 监听DOM变化\n function domChangeCallback(records: MutationRecord[]) {\n if (forceRemove) {\n forceRemove = false\n return\n }\n\n const watermarkElement = document.getElementById(globalSetting.id)\n if (!watermarkElement) {\n // 如果水印容器被删除,重新创建\n loadMark(globalSetting)\n return\n }\n\n // 检查是否有任何修改\n const hasChanges = records.some((record) => {\n // 检查元素是否被删除或添加\n if (record.type === 'childList') {\n return true\n }\n\n // 检查属性是否被修改\n if (record.type === 'attributes') {\n return true\n }\n\n // 检查文本内容是否被修改\n if (record.type === 'characterData') {\n return true\n }\n\n return false\n })\n\n if (hasChanges) {\n loadMark(globalSetting)\n }\n }\n\n return {\n addMark: loadMark,\n removeMark: () => {\n forceRemove = true\n // 删除这行,不重置全局配置\n // Object.assign(globalSetting, initialSettings)\n removeMark()\n },\n }\n}\n"],"names":["initialSettings","id","prefix","text","x","y","rows","cols","width","height","x_space","y_space","font","color","fontsize","alpha","zIndex","angle","parent_width","parent_height","parent_node","monitor","watermark","globalSetting","forceRemove","watermarkDom","MutationObserver","records","document","getElementById","loadMark","some","record","type","resizeObserver","ResizeObserver","createWatermarkElement","index","maskDiv","createElement","textContent","style","cssText","replace","trim","settings","removeMark","Object","assign","textDimensions","fontSize","context","getContext","metrics","measureText","fontSizeNum","Number","parseFloat","actualBoundingBoxAscent","actualBoundingBoxDescent","Math","ceil","calculateTextDimensions","padding","parentElement","body","pageWidth","max","scrollWidth","clientWidth","pageHeight","scrollHeight","clientHeight","watermarkContainer","closest","getComputedStyle","position","shadowRoot","attachShadow","mode","appendChild","availableWidth","availableHeight","calculateWatermarkLayout","fragment","createDocumentFragment","i","j","observe","config","attributes","childList","subtree","characterData","watermarkElement","disconnect","parentNode","removeChild","addMark"],"mappings":"AA8CA,MAAMA,EAA0C,CAC9CC,GAAI,YACJC,OAAQ,cACRC,KAAM,OACNC,EAAG,EACHC,EAAG,EACHC,KAAM,EACNC,KAAM,EACNC,MAAO,EACPC,OAAQ,EACRC,QAAS,IACTC,QAAS,GACTC,KAAM,OACNC,MAAO,QACPC,SAAU,OACVC,MAAO,IACPC,OAAQ,QACRC,MAAO,GACPC,aAAc,EACdC,cAAe,EACfC,YAAa,KACbC,SAAS,GAyBJ,SAASC,IACR,MAAAC,EAAwC,IAAKvB,GACnD,IAAIwB,GAAc,EACZ,MAAAC,EAAe,IAAIC,kBA4JzB,SAA2BC,GACzB,GAAIH,EAEF,YADcA,GAAA,GAKhB,IADyBI,SAASC,eAAeN,EAActB,IAI7D,YADA6B,EAASP,GAKQI,EAAQI,MAAMC,GAEX,cAAhBA,EAAOC,OAKS,eAAhBD,EAAOC,MAKS,kBAAhBD,EAAOC,SAQXH,EAASP,EAEb,IA/LMW,EAAiB,IAAIC,gBAAe,KACnCX,GACHM,EAASP,EACX,IAyBO,SAAAa,EAAuBhC,EAAWC,EAAWgC,GAC9C,MAAAC,EAAUV,SAASW,cAAc,OA0BhC,OAzBPD,EAAQE,YAAcjB,EAAcpB,KACpCmC,EAAQrC,GAAK,GAAGsB,EAAcrB,SAASmC,IAEvCC,EAAQG,MAA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AAQf,EAAoBgB,GAGrCZ,IAAeJ,GACJhD,EAAA+D,QAAQX,EAAYY,EAErC,CACF,CAGA,SAAS3C,IACP,MAAMgD,EAAmBlE,SAASC,eAAeN,EAActB,IAC/DwB,EAAasE,aACTD,GACeA,EAAAE,YAAYC,YAAYH,EAE7C,CAyCO,MAAA,CACLI,QAASpE,EACTgB,WAAYA,KACItB,GAAA,EAGHsB,GAAA,EAGjB"}
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("./types.cjs"),s=Object.defineProperty,t=(e,t,r)=>((e,t,r)=>t in e?s(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);const r=class s{constructor(e,r){var i=this;if(this.apiInstance=e,this.isWholeResponse=r,t(this,"useApi",(async function(e,s){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i.isWholeResponse,r=null,o=null;try{const o={...e,...s&&e.method?["GET"].includes(e.method.toUpperCase())?{params:s}:{data:s}:{}};o.url=(o.proxyPrefix||"")+e.url,delete o.proxyPrefix;const n=await i.apiInstance(o);r=t?n.data:n.data.data}catch(e){"AxiosError"!==e.name?i.isAxiosResponse(e)?o=e.data:i.isErrorResponse(e)&&(o=e):console.error(e)}return{res:r,error:o}})),s.instance)return s.instance;s.instance=this,this.isWholeResponse=r}isBusinessError(s){return e.isPlainObject(s)&&"string"==typeof s.message&&"number"==typeof s.code&&0!==s.code}isAxiosResponse(s){return e.isPlainObject(s)&&void 0!==s.data&&this.isBusinessError(s.data)&&void 0!==s.status&&void 0!==s.statusText&&void 0!==s.headers&&void 0!==s.config&&void 0!==s.request}isErrorResponse(e){return"code"in e&&"data"in e&&"message"in e&&0!==e.code}};t(r,"instance");let i=r;exports.ApiService=i;
1
+ "use strict";var e=require("./types.cjs"),s=Object.defineProperty,t=(e,t,r)=>((e,t,r)=>t in e?s(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);const r=class s{constructor(e,r){var i=this;if(this.apiInstance=e,this.isWholeResponse=r,t(this,"useApi",(async function(e,s){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i.isWholeResponse,r=null,o=null;try{const o={...e,...s?e.method&&["GET"].includes(e.method.toUpperCase())?{params:s}:{data:s}:{}};o.url=(o.proxyPrefix||"")+e.url,delete o.proxyPrefix;const n=await i.apiInstance(o);r=t?n.data:n.data.data}catch(e){"AxiosError"!==e.name?i.isAxiosResponse(e)?o=e.data:i.isErrorResponse(e)&&(o=e):console.error(e)}return{res:r,error:o}})),s.instance)return s.instance;s.instance=this,this.isWholeResponse=r}isBusinessError(s){return e.isPlainObject(s)&&"string"==typeof s.message&&"number"==typeof s.code&&0!==s.code}isAxiosResponse(s){return e.isPlainObject(s)&&void 0!==s.data&&this.isBusinessError(s.data)&&void 0!==s.status&&void 0!==s.statusText&&void 0!==s.headers&&void 0!==s.config&&void 0!==s.request}isErrorResponse(e){return"code"in e&&"data"in e&&"message"in e&&0!==e.code}};t(r,"instance");let i=r;exports.ApiService=i;
2
2
  //# sourceMappingURL=use-api.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-api.cjs","sources":["../../../../packages/utils/src/use-api.ts"],"sourcesContent":["import type { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios'\nimport { isPlainObject } from './types'\n\n/**\n * 成功响应的数据结构\n * @template T - 响应数据的类型\n */\nexport interface SuccessResponse<T> {\n code: number\n count: number\n data: T\n message: string\n}\n\n/**\n * 错误响应的数据结构\n */\nexport interface ErrorResponse {\n code: number\n data: null\n message: string\n}\n\n/**\n * API 响应的统一封装\n * @template W - 是否返回完整响应,true 返回完整响应,false 只返回 data\n * @template T - 响应数据的类型\n */\nexport interface UseApiResponse<W extends boolean = false, T = unknown> {\n res: W extends true ? SuccessResponse<T> : T\n error: ErrorResponse | null\n}\n\n/**\n * API URL 配置对象类型\n */\nexport interface UrlObjectType {\n url: string\n method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'\n proxyPrefix?: string\n}\n\n/**\n * API 类型映射,用于定义每个接口的请求和响应类型\n * @template U - URL 配置对象类型\n */\nexport type ApiTypeMap<U extends UrlObjectType> = {\n [K in U['url']]: {\n request: any\n response: any\n }\n}\n\n// 辅助类型,用于提取请求数据类型\ntype RequestPayload<T> = T extends { data: any } ? T['data'] : T\ntype RequestParams<T> = T extends { params: any } ? T['params'] : T\n\n/**\n * API 服务类,提供统一的请求处理和错误处理\n * @template T - API 类型映射\n * @template U - URL 配置对象类型\n *\n * @example\n * ```typescript\n * // 定义 API 类型映射\n * interface UserApi extends ApiTypeMap<UserUrlObject> {\n * '/user/list': {\n * request: { page: number; size: number }\n * response: User[]\n * }\n * }\n *\n * // 创建 API 服务实例\n * const api = new ApiService<UserApi, UserUrlObject>(axios.create(), false)\n *\n * // 发起请求\n * const { res, error } = await api.useApi({\n * url: '/user/list',\n * method: 'GET',\n * params: { page: 1, size: 10 }\n * })\n * ```\n */\nexport class ApiService<\n T extends ApiTypeMap<U>,\n U extends UrlObjectType,\n> {\n private static instance: ApiService<any, any>\n\n /**\n * 构造函数,实现单例模式\n * @param apiInstance - Axios 实例\n * @param isWholeResponse - 是否返回完整响应\n */\n constructor(\n private apiInstance: AxiosInstance,\n private isWholeResponse: boolean,\n ) {\n if (ApiService.instance) {\n return ApiService.instance as ApiService<T, U>\n }\n ApiService.instance = this\n this.isWholeResponse = isWholeResponse\n }\n\n /**\n * 判断是否为业务错误\n * @param obj - 待判断的对象\n */\n private isBusinessError(obj: ErrorResponse): boolean {\n return isPlainObject(obj)\n && typeof obj.message === 'string'\n && typeof obj.code === 'number'\n && obj.code !== 0\n }\n\n /**\n * 判断是否为 Axios 响应对象\n * @param value - 待判断的值\n */\n private isAxiosResponse(value: any): value is AxiosResponse {\n return isPlainObject(value)\n && value.data !== undefined\n && this.isBusinessError(value.data)\n && value.status !== undefined\n && value.statusText !== undefined\n && value.headers !== undefined\n && value.config !== undefined\n && value.request !== undefined\n }\n\n /**\n * 判断是否为错误响应\n * @param value - 待判断的值\n */\n private isErrorResponse(value: any): value is ErrorResponse {\n return 'code' in value && 'data' in value && 'message' in value && value.code !== 0\n }\n\n /**\n * 发起 API 请求\n * @template K - URL 配置对象类型\n * @template W - 是否返回完整响应\n * @param axiosConfig - Axios 请求配置\n * @param params - 请求参数\n * @param isWholeResponse - 是否返回完整响应,默认使用实例配置\n * @returns Promise<UseApiResponse> - 统一的响应格式\n */\n public useApi = async <\n K extends U,\n W extends boolean = false,\n >(\n axiosConfig: Omit<AxiosRequestConfig<RequestPayload<T[K['url']]['request']>>, 'params'> & K & {\n params?: RequestParams<T[K['url']]['request']>\n },\n params?: RequestParams<T[K['url']]['request']>,\n isWholeResponse: W = this.isWholeResponse as W,\n ): Promise<UseApiResponse<W, T[K['url']]['response']>> => {\n let res: UseApiResponse<W, T[K['url']]['response']>['res'] | null = null\n let error: UseApiResponse['error'] = null\n\n try {\n // 处理请求配置\n const config = {\n ...axiosConfig,\n ...(!!params && axiosConfig.method ? (['GET'].includes(axiosConfig.method.toUpperCase()) ? { params } : { data: params }) : {}),\n }\n\n // 处理代理前缀\n config.url = (config.proxyPrefix || '') + axiosConfig.url\n delete config.proxyPrefix\n\n // 发起请求\n const response = await this.apiInstance<SuccessResponse<T[K['url']]['response']>>(config)\n res = isWholeResponse\n ? response.data\n : response.data.data\n }\n catch (err: any) {\n // 错误处理\n if (err.name !== 'AxiosError') {\n if (this.isAxiosResponse(err)) {\n error = err.data\n }\n else if (this.isErrorResponse(err)) {\n error = err\n }\n }\n else {\n console.error(err)\n }\n }\n\n return { res: res!, error }\n }\n}\n"],"names":["_ApiService","constructor","apiInstance","isWholeResponse","_this","this","__publicField","async","axiosConfig","params","arguments","length","undefined","res","error","config","method","includes","toUpperCase","data","url","proxyPrefix","response","err","name","isAxiosResponse","isErrorResponse","console","instance","isBusinessError","obj","isPlainObject","message","code","value","status","statusText","headers","request","ApiService"],"mappings":"gMAmFO,MAAMA,EAAN,MA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MD,IAC3E,GAlDA3B,EAJWN,EAII,YAJV,IAAMuC,EAANvC"}
1
+ {"version":3,"file":"use-api.cjs","sources":["../../../../packages/utils/src/use-api.ts"],"sourcesContent":["import type { AxiosInstance, AxiosRequestConfig, AxiosResponse, Method } from 'axios'\nimport { isPlainObject } from './types'\n\n/**\n * 成功响应的数据结构\n * @template T - 响应数据的类型\n */\nexport interface SuccessResponse<T> {\n code: number\n count: number\n data: T\n message: string\n}\n\n/**\n * 错误响应的数据结构\n */\nexport interface ErrorResponse {\n code: number\n data: null\n message: string\n}\n\n/**\n * API 响应的统一封装\n * @template W - 是否返回完整响应,true 返回完整响应,false 只返回 data\n * @template T - 响应数据的类型\n */\nexport interface UseApiResponse<W extends boolean = false, T = unknown> {\n res: W extends true ? SuccessResponse<T> : T\n error: ErrorResponse | null\n}\n\n/**\n * API URL 配置对象类型\n */\nexport interface UrlObjectType {\n url: string\n method: Method\n proxyPrefix?: string\n}\n\n/**\n * API 类型映射,用于定义每个接口的请求和响应类型\n * @template U - URL 配置对象类型\n */\nexport type ApiTypeMap<U extends UrlObjectType> = {\n [K in U['url']]: {\n request: any\n response: any\n }\n}\n\n// 辅助类型,用于提取请求数据类型\ntype RequestPayload<T> = T extends { data: any } ? T['data'] : T\ntype RequestParams<T> = T extends { params: any } ? T['params'] : T\n\n/**\n * API 服务类,提供统一的请求处理和错误处理\n * @template T - API 类型映射\n * @template U - URL 配置对象类型\n *\n * @example\n * ```typescript\n * // 定义 API 类型映射\n * interface UserApi extends ApiTypeMap<UserUrlObject> {\n * '/user/list': {\n * request: { page: number; size: number }\n * response: User[]\n * }\n * }\n *\n * // 创建 API 服务实例\n * const api = new ApiService<UserApi, UserUrlObject>(axios.create(), false)\n *\n * // 发起请求\n * const { res, error } = await api.useApi({\n * url: '/user/list',\n * method: 'GET',\n * params: { page: 1, size: 10 }\n * })\n * ```\n */\nexport class ApiService<\n T extends ApiTypeMap<U>,\n U extends UrlObjectType,\n> {\n private static instance: ApiService<any, any>\n\n /**\n * 构造函数,实现单例模式\n * @param apiInstance - Axios 实例\n * @param isWholeResponse - 是否返回完整响应\n */\n constructor(\n private apiInstance: AxiosInstance,\n private isWholeResponse: boolean,\n ) {\n if (ApiService.instance) {\n return ApiService.instance as ApiService<T, U>\n }\n ApiService.instance = this\n this.isWholeResponse = isWholeResponse\n }\n\n /**\n * 判断是否为业务错误\n * @param obj - 待判断的对象\n */\n private isBusinessError(obj: ErrorResponse): boolean {\n return isPlainObject(obj)\n && typeof obj.message === 'string'\n && typeof obj.code === 'number'\n && obj.code !== 0\n }\n\n /**\n * 判断是否为 Axios 响应对象\n * @param value - 待判断的值\n */\n private isAxiosResponse(value: any): value is AxiosResponse {\n return isPlainObject(value)\n && value.data !== undefined\n && this.isBusinessError(value.data)\n && value.status !== undefined\n && value.statusText !== undefined\n && value.headers !== undefined\n && value.config !== undefined\n && value.request !== undefined\n }\n\n /**\n * 判断是否为错误响应\n * @param value - 待判断的值\n */\n private isErrorResponse(value: any): value is ErrorResponse {\n return 'code' in value && 'data' in value && 'message' in value && value.code !== 0\n }\n\n /**\n * 发起 API 请求\n * @template K - URL 配置对象类型\n * @template W - 是否返回完整响应\n * @param axiosConfig - Axios 请求配置\n * @param params - 请求参数\n * @param isWholeResponse - 是否返回完整响应,默认使用实例配置\n * @returns Promise<UseApiResponse> - 统一的响应格式\n */\n public useApi = async <\n K extends U,\n W extends boolean = false,\n >(\n axiosConfig: Omit<AxiosRequestConfig<RequestPayload<T[K['url']]['request']>>, 'params'> & K & {\n params?: RequestParams<T[K['url']]['request']>\n },\n params?: RequestParams<T[K['url']]['request']>,\n isWholeResponse: W = this.isWholeResponse as W,\n ): Promise<UseApiResponse<W, T[K['url']]['response']>> => {\n let res: UseApiResponse<W, T[K['url']]['response']>['res'] | null = null\n let error: UseApiResponse['error'] = null\n\n try {\n // 处理请求配置\n const config = {\n ...axiosConfig,\n ...(params ? (axiosConfig.method && ['GET'].includes(axiosConfig.method.toUpperCase()) ? { params } : { data: params }) : {}),\n }\n\n // 处理代理前缀\n config.url = (config.proxyPrefix || '') + axiosConfig.url\n delete config.proxyPrefix\n\n // 发起请求\n const response = await this.apiInstance<SuccessResponse<T[K['url']]['response']>>(config)\n res = isWholeResponse\n ? response.data\n : response.data.data\n }\n catch (err: any) {\n // 错误处理\n if (err.name !== 'AxiosError') {\n if (this.isAxiosResponse(err)) {\n error = err.data\n }\n else if (this.isErrorResponse(err)) {\n error = err\n }\n }\n else {\n console.error(err)\n }\n }\n\n return { res: res!, error }\n }\n}\n"],"names":["_ApiService","constructor","apiInstance","isWholeResponse","_this","this","__publicField","async","axiosConfig","params","arguments","length","undefined","res","error","config","method","includes","toUpperCase","data","url","proxyPrefix","response","err","name","isAxiosResponse","isErrorResponse","console","instance","isBusinessError","obj","isPlainObject","message","code","value","status","statusText","headers","request","ApiService"],"mappings":"gMAmFO,MAAMA,EAAN,MAAMA,EAWXC,WAAAA,CACUC,EACAC,GACR,IAAAC,EAAAC,KACA,GAHQA,KAAAH,YAAAA,EACAG,KAAAF,gBAAAA,EAoDVG,EAAAD,KAAO,UAASE,eAIdC,EAGAC,GAEwD,IADxDN,EAAAO,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAqBN,GAAAA,EAAKD,gBAEtBU,EAAgE,KAChEC,EAAiC,KAEjC,IAEF,MAAMC,EAAS,IACVP,KACCC,EAAUD,EAAYQ,QAAU,CAAC,OAAOC,SAAST,EAAYQ,OAAOE,eAAiB,CAAET,UAAW,CAAEU,KAAMV,GAAY,CAAC,GAI7HM,EAAOK,KAAOL,EAAOM,aAAe,IAAMb,EAAYY,WAC/CL,EAAOM,YAGd,MAAMC,QAAiBlB,EAAKF,YAAsDa,GAClFF,EAAMV,EACFmB,EAASH,KACTG,EAASH,KAAKA,WAEbI,GAEY,eAAbA,EAAIC,KACFpB,EAAKqB,gBAAgBF,GACvBT,EAAQS,EAAIJ,KAELf,EAAKsB,gBAAgBH,KACpBT,EAAAS,GAIVI,QAAQb,MAAMS,EAElB,CAEO,MAAA,CAAEV,MAAWC,QACtB,IAhGMd,EAAW4B,SACb,OAAO5B,EAAW4B,SAEpB5B,EAAW4B,SAAWvB,KACtBA,KAAKF,gBAAkBA,CACzB,CAMQ0B,eAAAA,CAAgBC,GACtB,OAAOC,EAAcA,cAAAD,IACO,iBAAhBA,EAAIE,SACS,iBAAbF,EAAIG,MACE,IAAbH,EAAIG,IACX,CAMQR,eAAAA,CAAgBS,GACf,OAAAH,gBAAcG,SACD,IAAfA,EAAMf,MACNd,KAAKwB,gBAAgBK,EAAMf,YACV,IAAjBe,EAAMC,aACe,IAArBD,EAAME,iBACY,IAAlBF,EAAMG,cACW,IAAjBH,EAAMnB,aACY,IAAlBmB,EAAMI,OACb,CAMQZ,eAAAA,CAAgBQ,GACtB,MAAO,SAAUA,GAAS,SAAUA,GAAS,YAAaA,GAAwB,IAAfA,EAAMD,IAC3E,GAlDA3B,EAJWN,EAII,YAJV,IAAMuC,EAANvC"}
@@ -1,2 +1,2 @@
1
- "use strict";const t={id:"wm_div_id",prefix:"mask_div_id",text:"测试水印",x:0,y:0,rows:0,cols:0,width:0,height:0,x_space:100,y_space:40,font:"微软雅黑",color:"black",fontsize:"18px",alpha:.15,angle:15,parent_width:0,parent_height:0,parent_node:null,monitor:!0};exports.watermark=function(){const e={...t};let n=!1;const i=new MutationObserver((function(t){if(n)return void(n=!1);if(!document.getElementById(e.id))return void s(e);t.some((t=>"childList"===t.type||("attributes"===t.type||"characterData"===t.type)))&&s(e)})),o=new ResizeObserver((()=>{n||s(e)}));function c(t,n,i){const o=document.createElement("div");return o.textContent=e.text,o.id=`${e.prefix}${i}`,o.style.cssText=`\n transform: rotate(-${e.angle}deg);\n position: absolute;\n left: ${t}px;\n top: ${n}px;\n overflow: hidden;\n z-index: 9999999;\n opacity: ${e.alpha};\n font-size: ${e.fontsize};\n font-family: ${e.font};\n color: ${e.color};\n text-align: center;\n width: ${e.width}px;\n height: ${e.height}px;\n line-height: ${e.height}px;\n display: flex;\n align-items: center;\n justify-content: center;\n user-select: none;\n visibility: visible;\n `.replace(/\s+/g," ").trim(),o}function s(t){if(a(),Object.assign(e,t),0===e.width&&0===e.height||0===e.width||0===e.height){const t=function(t,e,n){const i=document.createElement("canvas").getContext("2d");if(!i)return{width:100,height:100};i.font=`${n} ${e}`;const o=i.measureText(t.trim()),c=Number.parseFloat(n),s=void 0!==o.actualBoundingBoxAscent&&void 0!==o.actualBoundingBoxDescent?o.actualBoundingBoxAscent+o.actualBoundingBoxDescent:c;return{width:Math.ceil(o.width),height:Math.ceil(s)}}(e.text,e.font,e.fontsize),n=10;0===e.width&&(e.width=t.width+n),0===e.height&&(e.height=t.height+n)}const n=e.parent_node||document.body,s=Math.max(n.scrollWidth,n.clientWidth),r=Math.max(n.scrollHeight,n.clientHeight),d=document.createElement("div");d.id=e.id,n.closest("body")&&"static"===getComputedStyle(n).position&&(n.style.position="relative"),d.style.cssText="\n pointer-events: none;\n display: block;\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 9999999;\n overflow: hidden;\n ".replace(/\s+/g," ").trim();const h=d.attachShadow?d.attachShadow({mode:"open"}):d;n.appendChild(d);const{cols:l,rows:p,x_space:u,y_space:g}=function(t,n){const i=t-e.x,o=n-e.y,c=e.x_space||20,s=e.y_space||20;return{cols:Math.ceil(i/(e.width+c)),rows:Math.ceil(o/(e.height+s)),x_space:c,y_space:s}}(s,r);e.cols=l,e.rows=p,e.x_space=u,e.y_space=g;const x=document.createDocumentFragment();for(let t=0;t<p;t++){const n=e.y+(e.height+g)*t;for(let i=0;i<l;i++){const o=e.x+(e.width+u)*i;x.appendChild(c(o,n,t*l+i))}}if(h.appendChild(x),e.monitor){o.observe(n);const t={attributes:!0,childList:!0,subtree:!0,characterData:!0};i.observe(d,t),h!==d&&i.observe(h,t)}}function a(){const t=document.getElementById(e.id);i.disconnect(),t&&t.parentNode?.removeChild(t)}return{addMark:s,removeMark:()=>{n=!0,a()}}};
1
+ "use strict";const t={id:"wm_div_id",prefix:"mask_div_id",text:"测试水印",x:0,y:0,rows:0,cols:0,width:0,height:0,x_space:100,y_space:40,font:"微软雅黑",color:"black",fontsize:"18px",alpha:.15,zIndex:9999999,angle:15,parent_width:0,parent_height:0,parent_node:null,monitor:!0};exports.watermark=function(){const e={...t};let n=!1;const i=new MutationObserver((function(t){if(n)return void(n=!1);if(!document.getElementById(e.id))return void s(e);t.some((t=>"childList"===t.type||("attributes"===t.type||"characterData"===t.type)))&&s(e)})),o=new ResizeObserver((()=>{n||s(e)}));function c(t,n,i){const o=document.createElement("div");return o.textContent=e.text,o.id=`${e.prefix}${i}`,o.style.cssText=`\n transform: rotate(-${e.angle}deg);\n position: absolute;\n left: ${t}px;\n top: ${n}px;\n overflow: hidden;\n z-index: ${e.zIndex};\n opacity: ${e.alpha};\n font-size: ${e.fontsize};\n font-family: ${e.font};\n color: ${e.color};\n text-align: center;\n width: ${e.width}px;\n height: ${e.height}px;\n line-height: ${e.height}px;\n display: flex;\n align-items: center;\n justify-content: center;\n user-select: none;\n visibility: visible;\n `.replace(/\s+/g," ").trim(),o}function s(t){if(a(),Object.assign(e,t),0===e.width&&0===e.height||0===e.width||0===e.height){const t=function(t,e,n){const i=document.createElement("canvas").getContext("2d");if(!i)return{width:100,height:100};i.font=`${n} ${e}`;const o=i.measureText(t.trim()),c=Number.parseFloat(n),s=void 0!==o.actualBoundingBoxAscent&&void 0!==o.actualBoundingBoxDescent?o.actualBoundingBoxAscent+o.actualBoundingBoxDescent:c;return{width:Math.ceil(o.width),height:Math.ceil(s)}}(e.text,e.font,e.fontsize),n=10;0===e.width&&(e.width=t.width+n),0===e.height&&(e.height=t.height+n)}const n=e.parent_node||document.body,s=Math.max(n.scrollWidth,n.clientWidth),r=Math.max(n.scrollHeight,n.clientHeight),d=document.createElement("div");d.id=e.id,n.closest("body")&&"static"===getComputedStyle(n).position&&(n.style.position="relative"),d.style.cssText="\n pointer-events: none;\n display: block;\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 9999999;\n overflow: hidden;\n ".replace(/\s+/g," ").trim();const h=d.attachShadow?d.attachShadow({mode:"open"}):d;n.appendChild(d);const{cols:l,rows:p,x_space:u,y_space:x}=function(t,n){const i=t-e.x,o=n-e.y,c=e.x_space||20,s=e.y_space||20;return{cols:Math.ceil(i/(e.width+c)),rows:Math.ceil(o/(e.height+s)),x_space:c,y_space:s}}(s,r);e.cols=l,e.rows=p,e.x_space=u,e.y_space=x;const g=document.createDocumentFragment();for(let t=0;t<p;t++){const n=e.y+(e.height+x)*t;for(let i=0;i<l;i++){const o=e.x+(e.width+u)*i;g.appendChild(c(o,n,t*l+i))}}if(h.appendChild(g),e.monitor){o.observe(n);const t={attributes:!0,childList:!0,subtree:!0,characterData:!0};i.observe(d,t),h!==d&&i.observe(h,t)}}function a(){const t=document.getElementById(e.id);i.disconnect(),t&&t.parentNode?.removeChild(t)}return{addMark:s,removeMark:()=>{n=!0,a()}}};
2
2
  //# sourceMappingURL=watermark.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"watermark.cjs","sources":["../../../../packages/utils/src/watermark.ts"],"sourcesContent":["interface SettingsType {\n /** 水印总体的id */\n id?: string\n /** 小水印的id前缀 */\n prefix?: string\n /** 水印文案 */\n text?: string\n /** 水印起始位置x轴坐标 */\n x?: number\n /** 水印起始位置Y轴坐标 */\n y?: number\n /** 水印行数 */\n rows?: number\n /** 水印列数 */\n cols?: number\n /** 水印x轴间隔 */\n x_space?: number\n /** 水印y轴间隔 */\n y_space?: number\n /** 水印字体 */\n font?: string\n /** 水印字体颜色 */\n color?: string\n /** 水印字体大小 */\n fontsize?: string\n /** 水印透明度,要求设置在大于等于0.005 */\n alpha?: number\n /** 水印宽度 */\n width?: number\n /** 水印长度 */\n height?: number\n /** 水印倾斜度数 */\n angle?: number\n /** 水印的总体宽度(默认值:body的scrollWidth和clientWidth的较大值) */\n parent_width?: number\n /** 水印的总体高度(默认值:body的scrollHeight和clientHeight的较大值) */\n parent_height?: number\n /** 水印插件挂载的父元素element,不输入则默认挂在body */\n parent_node?: HTMLElement | null\n /** 是否监控,true: 不可删除水印; false: 可删水印 */\n monitor?: boolean\n}\n\n// 默认配置\nconst initialSettings: Required<SettingsType> = {\n id: 'wm_div_id',\n prefix: 'mask_div_id',\n text: '测试水印',\n x: 0,\n y: 0,\n rows: 0,\n cols: 0,\n width: 0,\n height: 0,\n x_space: 100,\n y_space: 40,\n font: '微软雅黑',\n color: 'black',\n fontsize: '18px',\n alpha: 0.15,\n angle: 15,\n parent_width: 0,\n parent_height: 0,\n parent_node: null,\n monitor: true,\n}\n\nfunction calculateTextDimensions(text: string, font: string, fontSize: string): { width: number, height: number } {\n const canvas = document.createElement('canvas')\n const context = canvas.getContext('2d')\n if (!context) {\n return { width: 100, height: 100 }\n }\n\n context.font = `${fontSize} ${font}`\n const metrics = context.measureText(text.trim())\n const fontSizeNum = Number.parseFloat(fontSize)\n\n // 移除 DPI 缩放,直接使用原始值\n const height = (metrics.actualBoundingBoxAscent !== undefined && metrics.actualBoundingBoxDescent !== undefined)\n ? (metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent)\n : fontSizeNum\n\n return {\n width: Math.ceil(metrics.width),\n height: Math.ceil(height),\n }\n}\n\nexport function watermark() {\n const globalSetting: Required<SettingsType> = { ...initialSettings }\n let forceRemove = false\n const watermarkDom = new MutationObserver(domChangeCallback)\n const resizeObserver = new ResizeObserver(() => {\n if (!forceRemove) {\n loadMark(globalSetting)\n }\n })\n\n // 计算水印布局\n function calculateWatermarkLayout(pageWidth: number, pageHeight: number) {\n const availableWidth = pageWidth - globalSetting.x\n const availableHeight = pageHeight - globalSetting.y\n\n // 使用固定间距\n const x_space = globalSetting.x_space || 20 // 如果未设置则使用默认值\n const y_space = globalSetting.y_space || 20 // 如果未设置则使用默认值\n\n // 计算能容纳的行数和列数\n const cols = Math.ceil(availableWidth / (globalSetting.width + x_space))\n const rows = Math.ceil(availableHeight / (globalSetting.height + y_space))\n\n return {\n cols,\n rows,\n x_space,\n y_space,\n }\n }\n\n // 创建水印元素\n function createWatermarkElement(x: number, y: number, index: number): HTMLElement {\n const maskDiv = document.createElement('div')\n maskDiv.textContent = globalSetting.text\n maskDiv.id = `${globalSetting.prefix}${index}`\n\n maskDiv.style.cssText = `\n transform: rotate(-${globalSetting.angle}deg);\n position: absolute;\n left: ${x}px;\n top: ${y}px;\n overflow: hidden;\n z-index: 9999999;\n opacity: ${globalSetting.alpha};\n font-size: ${globalSetting.fontsize};\n font-family: ${globalSetting.font};\n color: ${globalSetting.color};\n text-align: center;\n width: ${globalSetting.width}px;\n height: ${globalSetting.height}px;\n line-height: ${globalSetting.height}px;\n display: flex;\n align-items: center;\n justify-content: center;\n user-select: none;\n visibility: visible;\n `.replace(/\\s+/g, ' ').trim()\n\n return maskDiv\n }\n\n // 加载水印\n function loadMark(settings: Partial<SettingsType>) {\n removeMark()\n Object.assign(globalSetting, settings)\n\n if ((globalSetting.width === 0 && globalSetting.height === 0) || globalSetting.width === 0 || globalSetting.height === 0) {\n // 计算文本尺寸\n const textDimensions = calculateTextDimensions(\n globalSetting.text,\n globalSetting.font,\n globalSetting.fontsize,\n )\n const padding = 10\n if (globalSetting.width === 0) {\n globalSetting.width = textDimensions.width + padding\n }\n if (globalSetting.height === 0) {\n globalSetting.height = textDimensions.height + padding\n }\n }\n\n const parentElement = globalSetting.parent_node || document.body\n const pageWidth = Math.max(parentElement.scrollWidth, parentElement.clientWidth)\n const pageHeight = Math.max(parentElement.scrollHeight, parentElement.clientHeight)\n\n const watermarkContainer = document.createElement('div')\n watermarkContainer.id = globalSetting.id\n\n // 处理父元素定位\n if (parentElement.closest('body') && getComputedStyle(parentElement).position === 'static') {\n parentElement.style.position = 'relative'\n }\n\n watermarkContainer.style.cssText = `\n pointer-events: none;\n display: block;\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 9999999;\n overflow: hidden;\n `.replace(/\\s+/g, ' ').trim()\n\n const shadowRoot = watermarkContainer.attachShadow ? watermarkContainer.attachShadow({ mode: 'open' }) : watermarkContainer\n\n parentElement.appendChild(watermarkContainer)\n\n const { cols, rows, x_space, y_space } = calculateWatermarkLayout(pageWidth, pageHeight)\n globalSetting.cols = cols\n globalSetting.rows = rows\n globalSetting.x_space = x_space\n globalSetting.y_space = y_space\n\n const fragment = document.createDocumentFragment()\n for (let i = 0; i < rows; i++) {\n const y = globalSetting.y + (globalSetting.height + y_space) * i\n for (let j = 0; j < cols; j++) {\n const x = globalSetting.x + (globalSetting.width + x_space) * j\n fragment.appendChild(createWatermarkElement(x, y, i * cols + j))\n }\n }\n shadowRoot.appendChild(fragment)\n\n if (globalSetting.monitor) {\n // 监听父元素大小变化\n resizeObserver.observe(parentElement)\n\n // 监听水印容器及其子元素\n const config: MutationObserverInit = {\n attributes: true, // 监听属性变化\n childList: true, // 监听子元素变化\n subtree: true, // 监听子树变化\n characterData: true, // 监听文本内容变化\n }\n\n // 监听水印容器\n watermarkDom.observe(watermarkContainer, config)\n\n // 如果使用了 Shadow DOM,还需要监听 shadowRoot 内的元素\n if (shadowRoot !== watermarkContainer) {\n watermarkDom.observe(shadowRoot, config)\n }\n }\n }\n\n // 移除水印\n function removeMark() {\n const watermarkElement = document.getElementById(globalSetting.id)\n watermarkDom.disconnect()\n if (watermarkElement) {\n watermarkElement.parentNode?.removeChild(watermarkElement)\n }\n }\n\n // 监听DOM变化\n function domChangeCallback(records: MutationRecord[]) {\n if (forceRemove) {\n forceRemove = false\n return\n }\n\n const watermarkElement = document.getElementById(globalSetting.id)\n if (!watermarkElement) {\n // 如果水印容器被删除,重新创建\n loadMark(globalSetting)\n return\n }\n\n // 检查是否有任何修改\n const hasChanges = records.some((record) => {\n // 检查元素是否被删除或添加\n if (record.type === 'childList') {\n return true\n }\n\n // 检查属性是否被修改\n if (record.type === 'attributes') {\n return true\n }\n\n // 检查文本内容是否被修改\n if (record.type === 'characterData') {\n return true\n }\n\n return false\n })\n\n if (hasChanges) {\n loadMark(globalSetting)\n }\n }\n\n return {\n addMark: loadMark,\n removeMark: () => {\n forceRemove = true\n // 删除这行,不重置全局配置\n // Object.assign(globalSetting, initialSettings)\n removeMark()\n },\n }\n}\n"],"names":["initialSettings","id","prefix","text","x","y","rows","cols","width","height","x_space","y_space","font","color","fontsize","alpha","angle","parent_width","parent_height","parent_node","monitor","globalSetting","forceRemove","watermarkDom","MutationObserver","records","document","getElementById","loadMark","some","record","type","resizeObserver","ResizeObserver","createWatermarkElement","index","maskDiv","createElement","textContent","style","cssText","replace","trim","settings","removeMark","Object","assign","textDimensions","fontSize","context","getContext","metrics","measureText","fontSizeNum","Number","parseFloat","actualBoundingBoxAscent","actualBoundingBoxDescent","Math","ceil","calculateTextDimensions","padding","parentElement","body","pageWidth","max","scrollWidth","clientWidth","pageHeight","scrollHeight","clientHeight","watermarkContainer","closest","getComputedStyle","position","shadowRoot","attachShadow","mode","appendChild","availableWidth","availableHeight","calculateWatermarkLayout","fragment","createDocumentFragment","i","j","observe","config","attributes","childList","subtree","characterData","watermarkElement","disconnect","parentNode","removeChild","addMark"],"mappings":"aA4CA,MAAMA,EAA0C,CAC9CC,GAAI,YACJC,OAAQ,cACRC,KAAM,OACNC,EAAG,EACHC,EAAG,EACHC,KAAM,EACNC,KAAM,EACNC,MAAO,EACPC,OAAQ,EACRC,QAAS,IACTC,QAAS,GACTC,KAAM,OACNC,MAAO,QACPC,SAAU,OACVC,MAAO,IACPC,MAAO,GACPC,aAAc,EACdC,cAAe,EACfC,YAAa,KACbC,SAAS,qBAyBJ,WACC,MAAAC,EAAwC,IAAKrB,GACnD,IAAIsB,GAAc,EACZ,MAAAC,EAAe,IAAIC,kBA4JzB,SAA2BC,GACzB,GAAIH,EAEF,YADcA,GAAA,GAKhB,IADyBI,SAASC,eAAeN,EAAcpB,IAI7D,YADA2B,EAASP,GAKQI,EAAQI,MAAMC,GAEX,cAAhBA,EAAOC,OAKS,eAAhBD,EAAOC,MAKS,kBAAhBD,E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AW2E,EAC9DH,EAASJ,YAAY5C,EAAuB9B,EAAGC,EAAG+E,EAAI7E,EAAO8E,GAC/D,CACF,CAGA,GAFAV,EAAWG,YAAYI,GAEnB7D,EAAcD,QAAS,CAEzBY,EAAesD,QAAQxB,GAGvB,MAAMyB,EAA+B,CACnCC,YAAY,EACZC,WAAW,EACXC,SAAS,EACTC,eAAe,GAIJpE,EAAA+D,QAAQf,EAAoBgB,GAGrCZ,IAAeJ,GACJhD,EAAA+D,QAAQX,EAAYY,EAErC,CACF,CAGA,SAAS3C,IACP,MAAMgD,EAAmBlE,SAASC,eAAeN,EAAcpB,IAC/DsB,EAAasE,aACTD,GACeA,EAAAE,YAAYC,YAAYH,EAE7C,CAyCO,MAAA,CACLI,QAASpE,EACTgB,WAAYA,KACItB,GAAA,EAGHsB,GAAA,EAGjB"}
1
+ {"version":3,"file":"watermark.cjs","sources":["../../../../packages/utils/src/watermark.ts"],"sourcesContent":["interface SettingsType {\n /** 水印总体的id */\n id?: string\n /** 小水印的id前缀 */\n prefix?: string\n /** 水印文案 */\n text?: string\n /** 水印起始位置x轴坐标 */\n x?: number\n /** 水印起始位置Y轴坐标 */\n y?: number\n /** 水印行数 */\n rows?: number\n /** 水印层级 */\n zIndex?: number\n /** 水印列数 */\n cols?: number\n /** 水印x轴间隔 */\n x_space?: number\n /** 水印y轴间隔 */\n y_space?: number\n /** 水印字体 */\n font?: string\n /** 水印字体颜色 */\n color?: string\n /** 水印字体大小 */\n fontsize?: string\n /** 水印透明度,要求设置在大于等于0.005 */\n alpha?: number\n /** 水印宽度 */\n width?: number\n /** 水印长度 */\n height?: number\n /** 水印倾斜度数 */\n angle?: number\n /** 水印的总体宽度(默认值:body的scrollWidth和clientWidth的较大值) */\n parent_width?: number\n /** 水印的总体高度(默认值:body的scrollHeight和clientHeight的较大值) */\n parent_height?: number\n /** 水印插件挂载的父元素element,不输入则默认挂在body */\n parent_node?: HTMLElement | null\n /** 是否监控,true: 不可删除水印; false: 可删水印 */\n monitor?: boolean\n}\n\n// 默认配置\nconst initialSettings: Required<SettingsType> = {\n id: 'wm_div_id',\n prefix: 'mask_div_id',\n text: '测试水印',\n x: 0,\n y: 0,\n rows: 0,\n cols: 0,\n width: 0,\n height: 0,\n x_space: 100,\n y_space: 40,\n font: '微软雅黑',\n color: 'black',\n fontsize: '18px',\n alpha: 0.15,\n zIndex: 9999999,\n angle: 15,\n parent_width: 0,\n parent_height: 0,\n parent_node: null,\n monitor: true,\n}\n\nfunction calculateTextDimensions(text: string, font: string, fontSize: string): { width: number, height: number } {\n const canvas = document.createElement('canvas')\n const context = canvas.getContext('2d')\n if (!context) {\n return { width: 100, height: 100 }\n }\n\n context.font = `${fontSize} ${font}`\n const metrics = context.measureText(text.trim())\n const fontSizeNum = Number.parseFloat(fontSize)\n\n // 移除 DPI 缩放,直接使用原始值\n const height = (metrics.actualBoundingBoxAscent !== undefined && metrics.actualBoundingBoxDescent !== undefined)\n ? (metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent)\n : fontSizeNum\n\n return {\n width: Math.ceil(metrics.width),\n height: Math.ceil(height),\n }\n}\n\nexport function watermark() {\n const globalSetting: Required<SettingsType> = { ...initialSettings }\n let forceRemove = false\n const watermarkDom = new MutationObserver(domChangeCallback)\n const resizeObserver = new ResizeObserver(() => {\n if (!forceRemove) {\n loadMark(globalSetting)\n }\n })\n\n // 计算水印布局\n function calculateWatermarkLayout(pageWidth: number, pageHeight: number) {\n const availableWidth = pageWidth - globalSetting.x\n const availableHeight = pageHeight - globalSetting.y\n\n // 使用固定间距\n const x_space = globalSetting.x_space || 20 // 如果未设置则使用默认值\n const y_space = globalSetting.y_space || 20 // 如果未设置则使用默认值\n\n // 计算能容纳的行数和列数\n const cols = Math.ceil(availableWidth / (globalSetting.width + x_space))\n const rows = Math.ceil(availableHeight / (globalSetting.height + y_space))\n\n return {\n cols,\n rows,\n x_space,\n y_space,\n }\n }\n\n // 创建水印元素\n function createWatermarkElement(x: number, y: number, index: number): HTMLElement {\n const maskDiv = document.createElement('div')\n maskDiv.textContent = globalSetting.text\n maskDiv.id = `${globalSetting.prefix}${index}`\n\n maskDiv.style.cssText = `\n transform: rotate(-${globalSetting.angle}deg);\n position: absolute;\n left: ${x}px;\n top: ${y}px;\n overflow: hidden;\n z-index: ${globalSetting.zIndex};\n opacity: ${globalSetting.alpha};\n font-size: ${globalSetting.fontsize};\n font-family: ${globalSetting.font};\n color: ${globalSetting.color};\n text-align: center;\n width: ${globalSetting.width}px;\n height: ${globalSetting.height}px;\n line-height: ${globalSetting.height}px;\n display: flex;\n align-items: center;\n justify-content: center;\n user-select: none;\n visibility: visible;\n `.replace(/\\s+/g, ' ').trim()\n\n return maskDiv\n }\n\n // 加载水印\n function loadMark(settings: Partial<SettingsType>) {\n removeMark()\n Object.assign(globalSetting, settings)\n\n if ((globalSetting.width === 0 && globalSetting.height === 0) || globalSetting.width === 0 || globalSetting.height === 0) {\n // 计算文本尺寸\n const textDimensions = calculateTextDimensions(\n globalSetting.text,\n globalSetting.font,\n globalSetting.fontsize,\n )\n const padding = 10\n if (globalSetting.width === 0) {\n globalSetting.width = textDimensions.width + padding\n }\n if (globalSetting.height === 0) {\n globalSetting.height = textDimensions.height + padding\n }\n }\n\n const parentElement = globalSetting.parent_node || document.body\n const pageWidth = Math.max(parentElement.scrollWidth, parentElement.clientWidth)\n const pageHeight = Math.max(parentElement.scrollHeight, parentElement.clientHeight)\n\n const watermarkContainer = document.createElement('div')\n watermarkContainer.id = globalSetting.id\n\n // 处理父元素定位\n if (parentElement.closest('body') && getComputedStyle(parentElement).position === 'static') {\n parentElement.style.position = 'relative'\n }\n\n watermarkContainer.style.cssText = `\n pointer-events: none;\n display: block;\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 9999999;\n overflow: hidden;\n `.replace(/\\s+/g, ' ').trim()\n\n const shadowRoot = watermarkContainer.attachShadow ? watermarkContainer.attachShadow({ mode: 'open' }) : watermarkContainer\n\n parentElement.appendChild(watermarkContainer)\n\n const { cols, rows, x_space, y_space } = calculateWatermarkLayout(pageWidth, pageHeight)\n globalSetting.cols = cols\n globalSetting.rows = rows\n globalSetting.x_space = x_space\n globalSetting.y_space = y_space\n\n const fragment = document.createDocumentFragment()\n for (let i = 0; i < rows; i++) {\n const y = globalSetting.y + (globalSetting.height + y_space) * i\n for (let j = 0; j < cols; j++) {\n const x = globalSetting.x + (globalSetting.width + x_space) * j\n fragment.appendChild(createWatermarkElement(x, y, i * cols + j))\n }\n }\n shadowRoot.appendChild(fragment)\n\n if (globalSetting.monitor) {\n // 监听父元素大小变化\n resizeObserver.observe(parentElement)\n\n // 监听水印容器及其子元素\n const config: MutationObserverInit = {\n attributes: true, // 监听属性变化\n childList: true, // 监听子元素变化\n subtree: true, // 监听子树变化\n characterData: true, // 监听文本内容变化\n }\n\n // 监听水印容器\n watermarkDom.observe(watermarkContainer, config)\n\n // 如果使用了 Shadow DOM,还需要监听 shadowRoot 内的元素\n if (shadowRoot !== watermarkContainer) {\n watermarkDom.observe(shadowRoot, config)\n }\n }\n }\n\n // 移除水印\n function removeMark() {\n const watermarkElement = document.getElementById(globalSetting.id)\n watermarkDom.disconnect()\n if (watermarkElement) {\n watermarkElement.parentNode?.removeChild(watermarkElement)\n }\n }\n\n // 监听DOM变化\n function domChangeCallback(records: MutationRecord[]) {\n if (forceRemove) {\n forceRemove = false\n return\n }\n\n const watermarkElement = document.getElementById(globalSetting.id)\n if (!watermarkElement) {\n // 如果水印容器被删除,重新创建\n loadMark(globalSetting)\n return\n }\n\n // 检查是否有任何修改\n const hasChanges = records.some((record) => {\n // 检查元素是否被删除或添加\n if (record.type === 'childList') {\n return true\n }\n\n // 检查属性是否被修改\n if (record.type === 'attributes') {\n return true\n }\n\n // 检查文本内容是否被修改\n if (record.type === 'characterData') {\n return true\n }\n\n return false\n })\n\n if (hasChanges) {\n loadMark(globalSetting)\n }\n }\n\n return {\n addMark: loadMark,\n removeMark: () => {\n forceRemove = true\n // 删除这行,不重置全局配置\n // Object.assign(globalSetting, initialSettings)\n removeMark()\n },\n }\n}\n"],"names":["initialSettings","id","prefix","text","x","y","rows","cols","width","height","x_space","y_space","font","color","fontsize","alpha","zIndex","angle","parent_width","parent_height","parent_node","monitor","globalSetting","forceRemove","watermarkDom","MutationObserver","records","document","getElementById","loadMark","some","record","type","resizeObserver","ResizeObserver","createWatermarkElement","index","maskDiv","createElement","textContent","style","cssText","replace","trim","settings","removeMark","Object","assign","textDimensions","fontSize","context","getContext","metrics","measureText","fontSizeNum","Number","parseFloat","actualBoundingBoxAscent","actualBoundingBoxDescent","Math","ceil","calculateTextDimensions","padding","parentElement","body","pageWidth","max","scrollWidth","clientWidth","pageHeight","scrollHeight","clientHeight","watermarkContainer","closest","getComputedStyle","position","shadowRoot","attachShadow","mode","appendChild","availableWidth","availableHeight","calculateWatermarkLayout","fragment","createDocumentFragment","i","j","observe","config","attributes","childList","subtree","characterData","watermarkElement","disconnect","parentNode","removeChild","addMark"],"mappings":"aA8CA,MAAMA,EAA0C,CAC9CC,GAAI,YACJC,OAAQ,cACRC,KAAM,OACNC,EAAG,EACHC,EAAG,EACHC,KAAM,EACNC,KAAM,EACNC,MAAO,EACPC,OAAQ,EACRC,QAAS,IACTC,QAAS,GACTC,KAAM,OACNC,MAAO,QACPC,SAAU,OACVC,MAAO,IACPC,OAAQ,QACRC,MAAO,GACPC,aAAc,EACdC,cAAe,EACfC,YAAa,KACbC,SAAS,qBAyBJ,WACC,MAAAC,EAAwC,IAAKtB,GACnD,IAAIuB,GAAc,EACZ,MAAAC,EAAe,IAAIC,kBA4JzB,SAA2BC,GACzB,GAAIH,EAEF,YADcA,GAAA,GAKhB,IADyBI,SAASC,eAAeN,EAAcrB,IAI7D,YADA4B,EAASP,GAKQI,EAAQI,MAAMC,GAEX,cAAhBA,EAAOC,OAKS,eAAhBD,EAAOC,MAKS,kBAAhBD,EAAOC,SAQXH,EAASP,EAEb,IA/LMW,EAAiB,IAAIC,gBAAe,KACnCX,GACHM,E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AI9E,EAAO+E,GAC/D,CACF,CAGA,GAFAV,EAAWG,YAAYI,GAEnB7D,EAAcD,QAAS,CAEzBY,EAAesD,QAAQxB,GAGvB,MAAMyB,EAA+B,CACnCC,YAAY,EACZC,WAAW,EACXC,SAAS,EACTC,eAAe,GAIJpE,EAAA+D,QAAQf,EAAoBgB,GAGrCZ,IAAeJ,GACJhD,EAAA+D,QAAQX,EAAYY,EAErC,CACF,CAGA,SAAS3C,IACP,MAAMgD,EAAmBlE,SAASC,eAAeN,EAAcrB,IAC/DuB,EAAasE,aACTD,GACeA,EAAAE,YAAYC,YAAYH,EAE7C,CAyCO,MAAA,CACLI,QAASpE,EACTgB,WAAYA,KACItB,GAAA,EAGHsB,GAAA,EAGjB"}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@qxs-bns/utils",
3
3
  "type": "module",
4
- "version": "0.0.21",
4
+ "version": "0.0.23",
5
5
  "private": false,
6
6
  "license": "MIT",
7
7
  "sideEffects": false,
8
- "main": "./es/index.mjs",
8
+ "main": "./lib/index.cjs",
9
9
  "peerDependencies": {
10
10
  "axios": "^1.7.9"
11
11
  },
@@ -1,4 +1,4 @@
1
- import type { AxiosInstance, AxiosRequestConfig } from 'axios';
1
+ import type { AxiosInstance, AxiosRequestConfig, Method } from 'axios';
2
2
  /**
3
3
  * 成功响应的数据结构
4
4
  * @template T - 响应数据的类型
@@ -31,7 +31,7 @@ export interface UseApiResponse<W extends boolean = false, T = unknown> {
31
31
  */
32
32
  export interface UrlObjectType {
33
33
  url: string;
34
- method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
34
+ method: Method;
35
35
  proxyPrefix?: string;
36
36
  }
37
37
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"use-api.d.ts","sourceRoot":"","sources":["../../../../packages/utils/src/use-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAiB,MAAM,OAAO,CAAA;AAG7E;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CAAsB;IAE7C;;;;OAIG;gBAEO,WAAW,EAAE,aAAa,EAC1B,eAAe,EAAE,OAAO;IASlC;;;OAGG;IACH,OAAO,CAAC,eAAe;IAOvB;;;OAGG;IACH,OAAO,CAAC,eAAe;IAWvB;;;OAGG;IACH,OAAO,CAAC,eAAe;IAIvB;;;;;;;;OAQG;IACI,MAAM,GACX,CAAC,SAAS,CAAC,EACX,CAAC,SAAS,OAAO,GAAG,KAAK,EAEzB,aAAa,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG;QAC5F,MAAM,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAA;KAC/C,EACD,SAAS,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,EAC9C,kBAAiB,CAA6B,KAC7C,OAAO,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAqCrD;CACF"}
@@ -11,6 +11,8 @@ interface SettingsType {
11
11
  y?: number;
12
12
  /** 水印行数 */
13
13
  rows?: number;
14
+ /** 水印层级 */
15
+ zIndex?: number;
14
16
  /** 水印列数 */
15
17
  cols?: number;
16
18
  /** 水印x轴间隔 */
@@ -1 +1 @@
1
- {"version":3,"file":"watermark.d.ts","sourceRoot":"","sources":["../../../../packages/utils/src/watermark.ts"],"names":[],"mappings":"AAAA,UAAU,YAAY;IACpB,cAAc;IACd,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,eAAe;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW;IACX,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,iBAAiB;IACjB,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,iBAAiB;IACjB,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,WAAW;IACX,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW;IACX,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,aAAa;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,aAAa;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW;IACX,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,aAAa;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,aAAa;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW;IACX,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW;IACX,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,aAAa;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,oDAAoD;IACpD,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,sDAAsD;IACtD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,qCAAqC;IACrC,WAAW,CAAC,EAAE,WAAW,GAAG,IAAI,CAAA;IAChC,qCAAqC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAgDD,wBAAgB,SAAS;wBA+DK,OAAO,CAAC,YAAY,CAAC;;EA+IlD"}
1
+ {"version":3,"file":"watermark.d.ts","sourceRoot":"","sources":["../../../../packages/utils/src/watermark.ts"],"names":[],"mappings":"AAAA,UAAU,YAAY;IACpB,cAAc;IACd,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,eAAe;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW;IACX,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,iBAAiB;IACjB,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,iBAAiB;IACjB,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,WAAW;IACX,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW;IACX,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW;IACX,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,aAAa;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,aAAa;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW;IACX,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,aAAa;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,aAAa;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW;IACX,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW;IACX,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,aAAa;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,oDAAoD;IACpD,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,sDAAsD;IACtD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,qCAAqC;IACrC,WAAW,CAAC,EAAE,WAAW,GAAG,IAAI,CAAA;IAChC,qCAAqC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAiDD,wBAAgB,SAAS;wBA+DK,OAAO,CAAC,YAAY,CAAC;;EA+IlD"}
@@ -1 +1 @@
1
- {"fileNames":["../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../node_modules/.pnpm/@vue+shared@3.5.13/node_modules/@vue/shared/dist/shared.d.ts","../../../node_modules/.pnpm/@vue+reactivity@3.5.13/node_modules/@vue/reactivity/dist/reactivity.d.ts","../../../node_modules/.pnpm/@vue+runtime-core@3.5.13/node_modules/@vue/runtime-core/dist/runtime-core.d.ts","../../../node_modules/.pnpm/csstype@3.1.3/node_modules/csstype/index.d.ts","../../../node_modules/.pnpm/@vue+runtime-dom@3.5.13/node_modules/@vue/runtime-dom/dist/runtime-dom.d.ts","../../../node_modules/.pnpm/vue@3.5.13_typescript@5.8.2/node_modules/vue/jsx-runtime/index.d.ts","../../../packages/utils/src/argo-log.ts","../../../packages/utils/src/date-transfer.ts","../../../packages/utils/src/device.ts","../../../packages/utils/src/file-operations.ts","../../../node_modules/.pnpm/xlsx@0.18.5/node_modules/xlsx/types/index.d.ts","../../../packages/utils/src/json.ts","../../../node_modules/.pnpm/@types+ali-oss@6.16.11/node_modules/@types/ali-oss/index.d.ts","../../../packages/utils/src/oss-uploader.ts","../../../packages/utils/src/set-guid.ts","../../../packages/utils/src/storage.ts","../../../packages/utils/src/types.ts","../../../node_modules/.pnpm/axios@1.8.4/node_modules/axios/index.d.ts","../../../packages/utils/src/use-api.ts","../../../packages/utils/src/watermark.ts","../../../packages/utils/index.ts","../../../packages/utils/shims.d.ts"],"fileIdsList":[[48],[48,49,50,52],[49,50,51,52],[52],[53,54,55,56,57,59,61,62,63,64,66,67],[53,69],[53],[53,58],[53,60],[53,64,65]],"fileInfos":[{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763","affectsGlobalScope":true,"impliedFormat":1},{"version":"07f073f19d67f74d732b1adea08e1dc66b1b58d77cb5b43931dee3d798a2fd53","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"a7e9e5bb507146e1c06aae94b548c9227d41f2c773da5fbb152388558710bae2","impliedFormat":1},{"version":"ae4b6f723332eb8a17ae180b46c94779969a8f4851607601137c2cc511799d1c","impliedFormat":1},{"version":"6d19d47905686f2c495288607a50d5167db44eb23bb71fbeffeba48aead5531b","affectsGlobalScope":true,"impliedFormat":1},{"version":"8a8eb4ebffd85e589a1cc7c178e291626c359543403d58c9cd22b81fab5b1fb9","impliedFormat":1},{"version":"a9b8b44f5fc33c3590dbd01e3523cc150e53fb4785e5523707c82fd745000cdb","impliedFormat":1},{"version":"9c077ba346f2891d1725d6cbf1ff8bc7ca075ccff10d1ea38eda571245df0eeb","impliedFormat":1},{"version":"9efe271422d844c9a36e0ea606704268e4c8ee34bd2a194e954a31381475ea55","signature":"a8f6c54b02a016b0a4c0cbe6a878df7f2656f9a3f43986ad257d45665e612e94"},{"version":"72af2f99ff91a9a6767e9374d5bcfdfa734f056e0ca4f99acfbdc0b6910cbe6a","signature":"642691020b5d2610d98d8dfa25df7e7c58a2e885d24bdec278f98842b02892f6"},{"version":"de9652b1bdad8aa2fa302b263a6a72265b276fec040394aa3b6c1adcff419ebc","signature":"6364be1269de7f1efc40324fb2cadc9a17d9bd2742d5bc1b95e309d848ca50f6"},{"version":"8f2a5590837d3f29a8d141931432d8b61e019382d1bdcb5d9990f2525242942b","signature":"4f8d8bcaa7127e5ed2d649cd5fc16b4e46b6d6960d82982ede8429d8066f9b96","affectsGlobalScope":true},{"version":"593654eebe902db28ca173f021f74ea9f77e8b344aebb0a80fa4d10f29bb3a9d","impliedFormat":1},{"version":"19f50a093aa873de6321cd996913aa89e0ec5308a8ae49bf05f071cd9614d0c6","signature":"10ee1d72a1aeb7992ec2517f444db7d425261969e0476b94a1bef6e47fd5c4b6"},{"version":"07e3a9a4ac19e4b39c9403908e87cd24166f9392851d566e0e32b2271dedb4e8","impliedFormat":1},{"version":"42b4030b8dfde5376043f3dd2ce1296697d0e6905f21f2c93463b1d22c4862a0","signature":"28568c2a38ace4ec018e86ea1bdb429d563b3765af5d386b15c6b5a7055e348b"},{"version":"b661af9a80f1690400c4e230fc012525de39b87e9ed2d44b9501581eaf6f8102","signature":"3452b2a4e467983a2cebf29bed5e4810866b8b191972cb9ed23f8c3907dfb56e"},{"version":"7484cd645652e5de0e944021ff47e2794cd64e91ccba9e2ddfe2e5c4c7e62b89","signature":"b5ff6435fa9c6d61900a8764225558104fce909c6005109cb4ec42a6772052bd"},{"version":"7ad9aed3f5dc3de5049e8ba6912319dace213430b8babffad59e9b3cb8835760","signature":"a7b65e5fbd85d753c99c13a242176ec0f4f024108de502acbd52f82108f9386d"},{"version":"331594cfe112a28054912754e428aeb2090200e06bb3477720c62eb9c4676242","impliedFormat":99},{"version":"6f7320fb0cf8adbbc4014d5fe54a88d101bd77e70bc46a39d714d2873724a9e5","signature":"4c4a1d9afc8c2be98e5c10f4d2ef56861e7b0e00d9a51b10cdcc0e5262020e01"},{"version":"808c2f0eb7b2f0649c958a8ec904dd0d536d25005206181724bfd8a81770cfca","signature":"d5558453f558b2d33d9ad6ca2de541eac57fadc92e45cf8872d934956a937152"},{"version":"c03fbd1cf61ca9df4c98bf961f830ab1c969125d52d08fcb735832f7ba5eab38","signature":"11ed0f688306271bcf71f6e820151ae9fa88709a6512ead1790970439ee8dd7d"},{"version":"a911a3d8df881033bf7dddc7c2e68233d6121c2114826324eae73232d0d30b97","affectsGlobalScope":true}],"root":[[54,57],59,[61,64],[66,69]],"options":{"allowImportingTsExtensions":true,"allowJs":true,"composite":true,"declaration":true,"declarationDir":"./","declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":true,"jsx":1,"jsxImportSource":"vue","module":99,"noFallthroughCasesInSwitch":true,"noImplicitThis":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./","rootDir":"../../../packages/utils","skipLibCheck":true,"strict":true,"target":99,"useDefineForClassFields":true,"verbatimModuleSyntax":true},"referencedMap":[[49,1],[50,2],[52,3],[53,4],[68,5],[54,6],[55,7],[56,7],[57,7],[59,8],[61,9],[62,7],[63,7],[64,7],[66,10],[67,7]],"latestChangedDtsFile":"./index.d.ts","version":"5.8.2"}
1
+ {"fileNames":["../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/.pnpm/typescript@5.8.2/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../node_modules/.pnpm/@vue+shared@3.5.13/node_modules/@vue/shared/dist/shared.d.ts","../../../node_modules/.pnpm/@vue+reactivity@3.5.13/node_modules/@vue/reactivity/dist/reactivity.d.ts","../../../node_modules/.pnpm/@vue+runtime-core@3.5.13/node_modules/@vue/runtime-core/dist/runtime-core.d.ts","../../../node_modules/.pnpm/csstype@3.1.3/node_modules/csstype/index.d.ts","../../../node_modules/.pnpm/@vue+runtime-dom@3.5.13/node_modules/@vue/runtime-dom/dist/runtime-dom.d.ts","../../../node_modules/.pnpm/vue@3.5.13_typescript@5.8.2/node_modules/vue/jsx-runtime/index.d.ts","../../../packages/utils/src/argo-log.ts","../../../packages/utils/src/date-transfer.ts","../../../packages/utils/src/device.ts","../../../packages/utils/src/file-operations.ts","../../../node_modules/.pnpm/xlsx@0.18.5/node_modules/xlsx/types/index.d.ts","../../../packages/utils/src/json.ts","../../../node_modules/.pnpm/@types+ali-oss@6.16.11/node_modules/@types/ali-oss/index.d.ts","../../../packages/utils/src/oss-uploader.ts","../../../packages/utils/src/set-guid.ts","../../../packages/utils/src/storage.ts","../../../packages/utils/src/types.ts","../../../node_modules/.pnpm/axios@1.8.4/node_modules/axios/index.d.ts","../../../packages/utils/src/use-api.ts","../../../packages/utils/src/watermark.ts","../../../packages/utils/index.ts","../../../packages/utils/shims.d.ts"],"fileIdsList":[[48],[48,49,50,52],[49,50,51,52],[52],[53,54,55,56,57,59,61,62,63,64,66,67],[53,69],[53],[53,58],[53,60],[53,64,65]],"fileInfos":[{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763","affectsGlobalScope":true,"impliedFormat":1},{"version":"07f073f19d67f74d732b1adea08e1dc66b1b58d77cb5b43931dee3d798a2fd53","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"a7e9e5bb507146e1c06aae94b548c9227d41f2c773da5fbb152388558710bae2","impliedFormat":1},{"version":"ae4b6f723332eb8a17ae180b46c94779969a8f4851607601137c2cc511799d1c","impliedFormat":1},{"version":"6d19d47905686f2c495288607a50d5167db44eb23bb71fbeffeba48aead5531b","affectsGlobalScope":true,"impliedFormat":1},{"version":"8a8eb4ebffd85e589a1cc7c178e291626c359543403d58c9cd22b81fab5b1fb9","impliedFormat":1},{"version":"a9b8b44f5fc33c3590dbd01e3523cc150e53fb4785e5523707c82fd745000cdb","impliedFormat":1},{"version":"9c077ba346f2891d1725d6cbf1ff8bc7ca075ccff10d1ea38eda571245df0eeb","impliedFormat":1},{"version":"9efe271422d844c9a36e0ea606704268e4c8ee34bd2a194e954a31381475ea55","signature":"a8f6c54b02a016b0a4c0cbe6a878df7f2656f9a3f43986ad257d45665e612e94"},{"version":"72af2f99ff91a9a6767e9374d5bcfdfa734f056e0ca4f99acfbdc0b6910cbe6a","signature":"642691020b5d2610d98d8dfa25df7e7c58a2e885d24bdec278f98842b02892f6"},{"version":"de9652b1bdad8aa2fa302b263a6a72265b276fec040394aa3b6c1adcff419ebc","signature":"6364be1269de7f1efc40324fb2cadc9a17d9bd2742d5bc1b95e309d848ca50f6"},{"version":"8f2a5590837d3f29a8d141931432d8b61e019382d1bdcb5d9990f2525242942b","signature":"4f8d8bcaa7127e5ed2d649cd5fc16b4e46b6d6960d82982ede8429d8066f9b96","affectsGlobalScope":true},{"version":"593654eebe902db28ca173f021f74ea9f77e8b344aebb0a80fa4d10f29bb3a9d","impliedFormat":1},{"version":"19f50a093aa873de6321cd996913aa89e0ec5308a8ae49bf05f071cd9614d0c6","signature":"10ee1d72a1aeb7992ec2517f444db7d425261969e0476b94a1bef6e47fd5c4b6"},{"version":"07e3a9a4ac19e4b39c9403908e87cd24166f9392851d566e0e32b2271dedb4e8","impliedFormat":1},{"version":"42b4030b8dfde5376043f3dd2ce1296697d0e6905f21f2c93463b1d22c4862a0","signature":"28568c2a38ace4ec018e86ea1bdb429d563b3765af5d386b15c6b5a7055e348b"},{"version":"b661af9a80f1690400c4e230fc012525de39b87e9ed2d44b9501581eaf6f8102","signature":"3452b2a4e467983a2cebf29bed5e4810866b8b191972cb9ed23f8c3907dfb56e"},{"version":"7484cd645652e5de0e944021ff47e2794cd64e91ccba9e2ddfe2e5c4c7e62b89","signature":"b5ff6435fa9c6d61900a8764225558104fce909c6005109cb4ec42a6772052bd"},{"version":"7ad9aed3f5dc3de5049e8ba6912319dace213430b8babffad59e9b3cb8835760","signature":"a7b65e5fbd85d753c99c13a242176ec0f4f024108de502acbd52f82108f9386d"},{"version":"331594cfe112a28054912754e428aeb2090200e06bb3477720c62eb9c4676242","impliedFormat":99},{"version":"31f1259bb30b02597a38d77c491fe61423d1975215e107ec3e36ea8bd0fb12d0","signature":"66ceedc5e5a382a94068ead84919517096023171d157fcf382867a58a747a0a2"},{"version":"1a1bcdfb22986096afb784a52ebf88bf6217ac4e8ab7ddb6eeb8e8ecd7c595ec","signature":"57b68e7019ec085b6644c3ce5572dfcf262183369e4e617b1fba51099a851100"},{"version":"c03fbd1cf61ca9df4c98bf961f830ab1c969125d52d08fcb735832f7ba5eab38","signature":"11ed0f688306271bcf71f6e820151ae9fa88709a6512ead1790970439ee8dd7d"},{"version":"a911a3d8df881033bf7dddc7c2e68233d6121c2114826324eae73232d0d30b97","affectsGlobalScope":true}],"root":[[54,57],59,[61,64],[66,69]],"options":{"allowImportingTsExtensions":true,"allowJs":true,"composite":true,"declaration":true,"declarationDir":"./","declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":true,"jsx":1,"jsxImportSource":"vue","module":99,"noFallthroughCasesInSwitch":true,"noImplicitThis":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./","rootDir":"../../../packages/utils","skipLibCheck":true,"strict":true,"target":99,"useDefineForClassFields":true,"verbatimModuleSyntax":true},"referencedMap":[[49,1],[50,2],[52,3],[53,4],[68,5],[54,6],[55,7],[56,7],[57,7],[59,8],[61,9],[62,7],[63,7],[64,7],[66,10],[67,7]],"latestChangedDtsFile":"./index.d.ts","version":"5.8.2"}