@cloudcome/utils-browser 1.2.16 → 1.2.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/base64.cjs +21 -8
- package/dist/base64.cjs.map +1 -1
- package/dist/base64.mjs +22 -11
- package/dist/base64.mjs.map +1 -1
- package/dist/cache.cjs +91 -79
- package/dist/cache.cjs.map +1 -1
- package/dist/cache.d.ts +1 -1
- package/dist/cache.mjs +91 -82
- package/dist/cache.mjs.map +1 -1
- package/dist/canvas.cjs +64 -48
- package/dist/canvas.cjs.map +1 -1
- package/dist/canvas.mjs +64 -51
- package/dist/canvas.mjs.map +1 -1
- package/dist/clipboard.cjs +34 -15
- package/dist/clipboard.cjs.map +1 -1
- package/dist/clipboard.mjs +35 -17
- package/dist/clipboard.mjs.map +1 -1
- package/dist/cookie.cjs +42 -41
- package/dist/cookie.cjs.map +1 -1
- package/dist/cookie.mjs +42 -44
- package/dist/cookie.mjs.map +1 -1
- package/dist/dom.cjs +30 -11
- package/dist/dom.cjs.map +1 -1
- package/dist/dom.mjs +30 -13
- package/dist/dom.mjs.map +1 -1
- package/dist/download.cjs +24 -12
- package/dist/download.cjs.map +1 -1
- package/dist/download.mjs +25 -15
- package/dist/download.mjs.map +1 -1
- package/dist/image.cjs +44 -34
- package/dist/image.cjs.map +1 -1
- package/dist/image.mjs +44 -35
- package/dist/image.mjs.map +1 -1
- package/dist/index.cjs +8 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +9 -5
- package/dist/index.mjs.map +1 -1
- package/dist/timer.cjs +40 -37
- package/dist/timer.cjs.map +1 -1
- package/dist/timer.mjs +40 -38
- package/dist/timer.mjs.map +1 -1
- package/dist/video.cjs +24 -14
- package/dist/video.cjs.map +1 -1
- package/dist/video.mjs +25 -16
- package/dist/video.mjs.map +1 -1
- package/package.json +46 -47
package/dist/cookie.mjs
CHANGED
|
@@ -1,51 +1,49 @@
|
|
|
1
1
|
import { dateParse } from "@cloudcome/utils-core/date";
|
|
2
|
+
//#region src/cookie.ts
|
|
3
|
+
/**
|
|
4
|
+
* 获取指定名称的 Cookie 值。
|
|
5
|
+
* @param {string} name - Cookie 的名称。
|
|
6
|
+
* @returns {string} - 返回对应的 Cookie 值,如果不存在则返回空字符串。
|
|
7
|
+
*/
|
|
2
8
|
function cookieGet(name) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
return "";
|
|
9
|
+
const cookies = document.cookie.split(";");
|
|
10
|
+
for (let i = 0; i < cookies.length; i++) {
|
|
11
|
+
const cookie = cookies[i].trim();
|
|
12
|
+
if (cookie.startsWith(`${name}=`)) try {
|
|
13
|
+
return decodeURIComponent(cookie.slice(name.length + 1));
|
|
14
|
+
} catch {
|
|
15
|
+
return cookie.slice(name.length + 1);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return "";
|
|
15
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* 设置 Cookie。
|
|
22
|
+
* @param {string} name - Cookie 的名称。
|
|
23
|
+
* @param {string} value - Cookie 的值。
|
|
24
|
+
* @param {CookieOptions} [options] - 可选的 Cookie 配置项。
|
|
25
|
+
*/
|
|
16
26
|
function cookieSet(name, value, options) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
metas.push(["domain", domain]);
|
|
29
|
-
}
|
|
30
|
-
if (sameSite) {
|
|
31
|
-
metas.push(["sameSite", sameSite]);
|
|
32
|
-
}
|
|
33
|
-
if (secure) {
|
|
34
|
-
metas.push(["secure", "true"]);
|
|
35
|
-
}
|
|
36
|
-
for (const [key, value2] of metas) {
|
|
37
|
-
cookie += `; ${key}=${value2}`;
|
|
38
|
-
}
|
|
39
|
-
document.cookie = cookie;
|
|
27
|
+
const { expires, maxAge, path, domain, sameSite, secure } = options || {};
|
|
28
|
+
let cookie = `${name}=${encodeURIComponent(value)}`;
|
|
29
|
+
const expiresAt = expires ? dateParse(expires) : maxAge ? dateParse(Date.now() + maxAge * 1e3) : null;
|
|
30
|
+
const metas = [];
|
|
31
|
+
if (expiresAt) metas.push(["expires", expiresAt.toISOString()]);
|
|
32
|
+
if (path) metas.push(["path", path]);
|
|
33
|
+
if (domain) metas.push(["domain", domain]);
|
|
34
|
+
if (sameSite) metas.push(["sameSite", sameSite]);
|
|
35
|
+
if (secure) metas.push(["secure", "true"]);
|
|
36
|
+
for (const [key, value] of metas) cookie += `; ${key}=${value}`;
|
|
37
|
+
document.cookie = cookie;
|
|
40
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* 删除指定名称的 Cookie。
|
|
41
|
+
* @param {string} name - 要删除的 Cookie 名称。
|
|
42
|
+
*/
|
|
41
43
|
function cookieDel(name) {
|
|
42
|
-
|
|
43
|
-
expires: 0
|
|
44
|
-
});
|
|
44
|
+
cookieSet(name, "", { expires: 0 });
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
};
|
|
51
|
-
//# sourceMappingURL=cookie.mjs.map
|
|
46
|
+
//#endregion
|
|
47
|
+
export { cookieDel, cookieGet, cookieSet };
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=cookie.mjs.map
|
package/dist/cookie.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cookie.mjs","sources":["../src/cookie.ts"],"sourcesContent":["import type { DateValue } from '@cloudcome/utils-core/date';\nimport { dateParse } from '@cloudcome/utils-core/date';\n\n/**\n * 获取指定名称的 Cookie 值。\n * @param {string} name - Cookie 的名称。\n * @returns {string} - 返回对应的 Cookie 值,如果不存在则返回空字符串。\n */\nexport function cookieGet(name: string) {\n const cookies = document.cookie.split(';');\n\n for (let i = 0; i < cookies.length; i++) {\n const cookie = cookies[i].trim();\n\n if (cookie.startsWith(`${name}=`)) {\n try {\n return decodeURIComponent(cookie.slice(name.length + 1));\n } catch {\n return cookie.slice(name.length + 1);\n }\n }\n }\n\n return '';\n}\n\n/**\n * 设置 Cookie。\n * @param {string} name - Cookie 的名称。\n * @param {string} value - Cookie 的值。\n * @param {CookieOptions} [options] - 可选的 Cookie 配置项。\n */\nexport type CookieOptions = {\n /**\n * Cookie 的过期时间,可以是日期字符串、时间戳或 `Date` 对象。\n */\n expires?: DateValue;\n\n /**\n * Cookie 的路径,默认为当前路径。\n */\n path?: string;\n\n /**\n * Cookie 的域名,默认为当前域名。\n */\n domain?: string;\n\n /**\n * 是否启用安全传输(HTTPS)。\n */\n secure?: boolean;\n\n /**\n * SameSite 属性,可选值为 `'strict'`、`'lax'` 或 `'none'`。\n */\n sameSite?: 'strict' | 'lax' | 'none';\n\n /**\n * Cookie 的最大存活时间(秒)。\n */\n maxAge?: number;\n};\n\n/**\n * 设置 Cookie。\n * @param {string} name - Cookie 的名称。\n * @param {string} value - Cookie 的值。\n * @param {CookieOptions} [options] - 可选的 Cookie 配置项。\n */\nexport function cookieSet(name: string
|
|
1
|
+
{"version":3,"file":"cookie.mjs","names":[],"sources":["../src/cookie.ts"],"sourcesContent":["import type { DateValue } from '@cloudcome/utils-core/date';\nimport { dateParse } from '@cloudcome/utils-core/date';\n\n/**\n * 获取指定名称的 Cookie 值。\n * @param {string} name - Cookie 的名称。\n * @returns {string} - 返回对应的 Cookie 值,如果不存在则返回空字符串。\n */\nexport function cookieGet(name: string) {\n const cookies = document.cookie.split(';');\n\n for (let i = 0; i < cookies.length; i++) {\n const cookie = cookies[i].trim();\n\n if (cookie.startsWith(`${name}=`)) {\n try {\n return decodeURIComponent(cookie.slice(name.length + 1));\n } catch {\n return cookie.slice(name.length + 1);\n }\n }\n }\n\n return '';\n}\n\n/**\n * 设置 Cookie。\n * @param {string} name - Cookie 的名称。\n * @param {string} value - Cookie 的值。\n * @param {CookieOptions} [options] - 可选的 Cookie 配置项。\n */\nexport type CookieOptions = {\n /**\n * Cookie 的过期时间,可以是日期字符串、时间戳或 `Date` 对象。\n */\n expires?: DateValue;\n\n /**\n * Cookie 的路径,默认为当前路径。\n */\n path?: string;\n\n /**\n * Cookie 的域名,默认为当前域名。\n */\n domain?: string;\n\n /**\n * 是否启用安全传输(HTTPS)。\n */\n secure?: boolean;\n\n /**\n * SameSite 属性,可选值为 `'strict'`、`'lax'` 或 `'none'`。\n */\n sameSite?: 'strict' | 'lax' | 'none';\n\n /**\n * Cookie 的最大存活时间(秒)。\n */\n maxAge?: number;\n};\n\n/**\n * 设置 Cookie。\n * @param {string} name - Cookie 的名称。\n * @param {string} value - Cookie 的值。\n * @param {CookieOptions} [options] - 可选的 Cookie 配置项。\n */\nexport function cookieSet(\n name: string,\n value: string,\n options?: CookieOptions,\n) {\n const { expires, maxAge, path, domain, sameSite, secure } = options || {};\n let cookie = `${name}=${encodeURIComponent(value)}`;\n\n const expiresAt = expires\n ? dateParse(expires)\n : maxAge\n ? dateParse(Date.now() + maxAge * 1000)\n : null;\n const metas: [string, string][] = [];\n\n if (expiresAt) {\n metas.push(['expires', expiresAt.toISOString()]);\n }\n\n if (path) {\n metas.push(['path', path]);\n }\n\n if (domain) {\n metas.push(['domain', domain]);\n }\n\n if (sameSite) {\n metas.push(['sameSite', sameSite]);\n }\n\n if (secure) {\n metas.push(['secure', 'true']);\n }\n\n for (const [key, value] of metas) {\n cookie += `; ${key}=${value}`;\n }\n\n // biome-ignore lint/suspicious/noDocumentCookie: 暂时方案\n document.cookie = cookie;\n}\n\n/**\n * 删除指定名称的 Cookie。\n * @param {string} name - 要删除的 Cookie 名称。\n */\nexport function cookieDel(name: string) {\n cookieSet(name, '', {\n expires: 0,\n });\n}\n"],"mappings":";;;;;;;AAQA,SAAgB,UAAU,MAAc;CACtC,MAAM,UAAU,SAAS,OAAO,MAAM,IAAI;CAE1C,KAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;EACvC,MAAM,SAAS,QAAQ,GAAG,MAAM;EAEhC,IAAI,OAAO,WAAW,GAAG,KAAK,GAAG,EAC/B,IAAI;GACF,OAAO,mBAAmB,OAAO,MAAM,KAAK,SAAS,EAAE,CAAC;UAClD;GACN,OAAO,OAAO,MAAM,KAAK,SAAS,EAAE;;;CAK1C,OAAO;;;;;;;;AA+CT,SAAgB,UACd,MACA,OACA,SACA;CACA,MAAM,EAAE,SAAS,QAAQ,MAAM,QAAQ,UAAU,WAAW,WAAW,EAAE;CACzE,IAAI,SAAS,GAAG,KAAK,GAAG,mBAAmB,MAAM;CAEjD,MAAM,YAAY,UACd,UAAU,QAAQ,GAClB,SACE,UAAU,KAAK,KAAK,GAAG,SAAS,IAAK,GACrC;CACN,MAAM,QAA4B,EAAE;CAEpC,IAAI,WACF,MAAM,KAAK,CAAC,WAAW,UAAU,aAAa,CAAC,CAAC;CAGlD,IAAI,MACF,MAAM,KAAK,CAAC,QAAQ,KAAK,CAAC;CAG5B,IAAI,QACF,MAAM,KAAK,CAAC,UAAU,OAAO,CAAC;CAGhC,IAAI,UACF,MAAM,KAAK,CAAC,YAAY,SAAS,CAAC;CAGpC,IAAI,QACF,MAAM,KAAK,CAAC,UAAU,OAAO,CAAC;CAGhC,KAAK,MAAM,CAAC,KAAK,UAAU,OACzB,UAAU,KAAK,IAAI,GAAG;CAIxB,SAAS,SAAS;;;;;;AAOpB,SAAgB,UAAU,MAAc;CACtC,UAAU,MAAM,IAAI,EAClB,SAAS,GACV,CAAC"}
|
package/dist/dom.cjs
CHANGED
|
@@ -1,18 +1,37 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
|
|
2
|
+
let _cloudcome_utils_core_object = require("@cloudcome/utils-core/object");
|
|
3
|
+
//#region src/dom.ts
|
|
4
|
+
/**
|
|
5
|
+
* 设置元素的样式
|
|
6
|
+
* @param {HTMLElement} el - 需要设置样式的 HTML 元素
|
|
7
|
+
* @param {string | Partial<Style> | Record<string, string>} style - 样式字符串或样式对象
|
|
8
|
+
* @example
|
|
9
|
+
* // 设置 body 元素的颜色为红色,并设置一个自定义变量
|
|
10
|
+
* setStyle(document.body, { color: 'red', '--var': 'value' });
|
|
11
|
+
* @example
|
|
12
|
+
* // 使用字符串设置样式
|
|
13
|
+
* setStyle(document.body, 'color: red; --var: value;');
|
|
14
|
+
*/
|
|
4
15
|
function setStyle(el, style) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
el.style.setProperty(key, value);
|
|
10
|
-
});
|
|
11
|
-
}
|
|
16
|
+
if (typeof style === "string") el.style.cssText = style;
|
|
17
|
+
else (0, _cloudcome_utils_core_object.objectEach)(style, (value, key) => {
|
|
18
|
+
el.style.setProperty(key, value);
|
|
19
|
+
});
|
|
12
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* 获取元素的指定样式值
|
|
23
|
+
* @param {HTMLElement} el - 需要获取样式的 HTML 元素
|
|
24
|
+
* @param {keyof Style} style - 需要获取的样式属性
|
|
25
|
+
* @returns {string} 返回指定样式的值
|
|
26
|
+
* @example
|
|
27
|
+
* // 获取 body 元素的颜色
|
|
28
|
+
* const color = getStyle(document.body, 'color');
|
|
29
|
+
*/
|
|
13
30
|
function getStyle(el, style) {
|
|
14
|
-
|
|
31
|
+
return window.getComputedStyle(el).getPropertyValue(style);
|
|
15
32
|
}
|
|
33
|
+
//#endregion
|
|
16
34
|
exports.getStyle = getStyle;
|
|
17
35
|
exports.setStyle = setStyle;
|
|
18
|
-
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=dom.cjs.map
|
package/dist/dom.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom.cjs","sources":["../src/dom.ts"],"sourcesContent":["import { objectEach } from '@cloudcome/utils-core/object';\n\n/**\n * 表示 CSS 样式声明的类型,仅包含可用的字符串或数字类型的属性\n * @typedef {Object} Style\n * @property {string | number} [K] - CSS 样式属性,K 为 CSSStyleDeclaration 的键名,且值为字符串或数字类型\n */\nexport type Style = {\n [K in keyof CSSStyleDeclaration as K extends number\n ? never\n : CSSStyleDeclaration[K] extends string | number\n ? K\n : never]: CSSStyleDeclaration[K];\n};\n\n/**\n * 设置元素的样式\n * @param {HTMLElement} el - 需要设置样式的 HTML 元素\n * @param {string | Partial<Style> | Record<string, string>} style - 样式字符串或样式对象\n * @example\n * // 设置 body 元素的颜色为红色,并设置一个自定义变量\n * setStyle(document.body, { color: 'red', '--var': 'value' });\n * @example\n * // 使用字符串设置样式\n * setStyle(document.body, 'color: red; --var: value;');\n */\nexport function setStyle(el: HTMLElement
|
|
1
|
+
{"version":3,"file":"dom.cjs","names":[],"sources":["../src/dom.ts"],"sourcesContent":["import { objectEach } from '@cloudcome/utils-core/object';\n\n/**\n * 表示 CSS 样式声明的类型,仅包含可用的字符串或数字类型的属性\n * @typedef {Object} Style\n * @property {string | number} [K] - CSS 样式属性,K 为 CSSStyleDeclaration 的键名,且值为字符串或数字类型\n */\nexport type Style = {\n [K in keyof CSSStyleDeclaration as K extends number\n ? never\n : CSSStyleDeclaration[K] extends string | number\n ? K\n : never]: CSSStyleDeclaration[K];\n};\n\n/**\n * 设置元素的样式\n * @param {HTMLElement} el - 需要设置样式的 HTML 元素\n * @param {string | Partial<Style> | Record<string, string>} style - 样式字符串或样式对象\n * @example\n * // 设置 body 元素的颜色为红色,并设置一个自定义变量\n * setStyle(document.body, { color: 'red', '--var': 'value' });\n * @example\n * // 使用字符串设置样式\n * setStyle(document.body, 'color: red; --var: value;');\n */\nexport function setStyle(\n el: HTMLElement,\n style: string | Partial<Style> | Record<string, string>,\n) {\n if (typeof style === 'string') {\n el.style.cssText = style;\n } else {\n objectEach(style, (value, key) => {\n el.style.setProperty(key as string, value as string | null);\n });\n }\n}\n\n/**\n * 获取元素的指定样式值\n * @param {HTMLElement} el - 需要获取样式的 HTML 元素\n * @param {keyof Style} style - 需要获取的样式属性\n * @returns {string} 返回指定样式的值\n * @example\n * // 获取 body 元素的颜色\n * const color = getStyle(document.body, 'color');\n */\nexport function getStyle(el: HTMLElement, style: keyof Style) {\n return window.getComputedStyle(el).getPropertyValue(style);\n}\n"],"mappings":";;;;;;;;;;;;;;AA0BA,SAAgB,SACd,IACA,OACA;CACA,IAAI,OAAO,UAAU,UACnB,GAAG,MAAM,UAAU;MAEnB,CAAA,GAAA,6BAAA,YAAW,QAAQ,OAAO,QAAQ;EAChC,GAAG,MAAM,YAAY,KAAe,MAAuB;GAC3D;;;;;;;;;;;AAaN,SAAgB,SAAS,IAAiB,OAAoB;CAC5D,OAAO,OAAO,iBAAiB,GAAG,CAAC,iBAAiB,MAAM"}
|
package/dist/dom.mjs
CHANGED
|
@@ -1,18 +1,35 @@
|
|
|
1
1
|
import { objectEach } from "@cloudcome/utils-core/object";
|
|
2
|
+
//#region src/dom.ts
|
|
3
|
+
/**
|
|
4
|
+
* 设置元素的样式
|
|
5
|
+
* @param {HTMLElement} el - 需要设置样式的 HTML 元素
|
|
6
|
+
* @param {string | Partial<Style> | Record<string, string>} style - 样式字符串或样式对象
|
|
7
|
+
* @example
|
|
8
|
+
* // 设置 body 元素的颜色为红色,并设置一个自定义变量
|
|
9
|
+
* setStyle(document.body, { color: 'red', '--var': 'value' });
|
|
10
|
+
* @example
|
|
11
|
+
* // 使用字符串设置样式
|
|
12
|
+
* setStyle(document.body, 'color: red; --var: value;');
|
|
13
|
+
*/
|
|
2
14
|
function setStyle(el, style) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
el.style.setProperty(key, value);
|
|
8
|
-
});
|
|
9
|
-
}
|
|
15
|
+
if (typeof style === "string") el.style.cssText = style;
|
|
16
|
+
else objectEach(style, (value, key) => {
|
|
17
|
+
el.style.setProperty(key, value);
|
|
18
|
+
});
|
|
10
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* 获取元素的指定样式值
|
|
22
|
+
* @param {HTMLElement} el - 需要获取样式的 HTML 元素
|
|
23
|
+
* @param {keyof Style} style - 需要获取的样式属性
|
|
24
|
+
* @returns {string} 返回指定样式的值
|
|
25
|
+
* @example
|
|
26
|
+
* // 获取 body 元素的颜色
|
|
27
|
+
* const color = getStyle(document.body, 'color');
|
|
28
|
+
*/
|
|
11
29
|
function getStyle(el, style) {
|
|
12
|
-
|
|
30
|
+
return window.getComputedStyle(el).getPropertyValue(style);
|
|
13
31
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
//# sourceMappingURL=dom.mjs.map
|
|
32
|
+
//#endregion
|
|
33
|
+
export { getStyle, setStyle };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=dom.mjs.map
|
package/dist/dom.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom.mjs","sources":["../src/dom.ts"],"sourcesContent":["import { objectEach } from '@cloudcome/utils-core/object';\n\n/**\n * 表示 CSS 样式声明的类型,仅包含可用的字符串或数字类型的属性\n * @typedef {Object} Style\n * @property {string | number} [K] - CSS 样式属性,K 为 CSSStyleDeclaration 的键名,且值为字符串或数字类型\n */\nexport type Style = {\n [K in keyof CSSStyleDeclaration as K extends number\n ? never\n : CSSStyleDeclaration[K] extends string | number\n ? K\n : never]: CSSStyleDeclaration[K];\n};\n\n/**\n * 设置元素的样式\n * @param {HTMLElement} el - 需要设置样式的 HTML 元素\n * @param {string | Partial<Style> | Record<string, string>} style - 样式字符串或样式对象\n * @example\n * // 设置 body 元素的颜色为红色,并设置一个自定义变量\n * setStyle(document.body, { color: 'red', '--var': 'value' });\n * @example\n * // 使用字符串设置样式\n * setStyle(document.body, 'color: red; --var: value;');\n */\nexport function setStyle(el: HTMLElement
|
|
1
|
+
{"version":3,"file":"dom.mjs","names":[],"sources":["../src/dom.ts"],"sourcesContent":["import { objectEach } from '@cloudcome/utils-core/object';\n\n/**\n * 表示 CSS 样式声明的类型,仅包含可用的字符串或数字类型的属性\n * @typedef {Object} Style\n * @property {string | number} [K] - CSS 样式属性,K 为 CSSStyleDeclaration 的键名,且值为字符串或数字类型\n */\nexport type Style = {\n [K in keyof CSSStyleDeclaration as K extends number\n ? never\n : CSSStyleDeclaration[K] extends string | number\n ? K\n : never]: CSSStyleDeclaration[K];\n};\n\n/**\n * 设置元素的样式\n * @param {HTMLElement} el - 需要设置样式的 HTML 元素\n * @param {string | Partial<Style> | Record<string, string>} style - 样式字符串或样式对象\n * @example\n * // 设置 body 元素的颜色为红色,并设置一个自定义变量\n * setStyle(document.body, { color: 'red', '--var': 'value' });\n * @example\n * // 使用字符串设置样式\n * setStyle(document.body, 'color: red; --var: value;');\n */\nexport function setStyle(\n el: HTMLElement,\n style: string | Partial<Style> | Record<string, string>,\n) {\n if (typeof style === 'string') {\n el.style.cssText = style;\n } else {\n objectEach(style, (value, key) => {\n el.style.setProperty(key as string, value as string | null);\n });\n }\n}\n\n/**\n * 获取元素的指定样式值\n * @param {HTMLElement} el - 需要获取样式的 HTML 元素\n * @param {keyof Style} style - 需要获取的样式属性\n * @returns {string} 返回指定样式的值\n * @example\n * // 获取 body 元素的颜色\n * const color = getStyle(document.body, 'color');\n */\nexport function getStyle(el: HTMLElement, style: keyof Style) {\n return window.getComputedStyle(el).getPropertyValue(style);\n}\n"],"mappings":";;;;;;;;;;;;;AA0BA,SAAgB,SACd,IACA,OACA;CACA,IAAI,OAAO,UAAU,UACnB,GAAG,MAAM,UAAU;MAEnB,WAAW,QAAQ,OAAO,QAAQ;EAChC,GAAG,MAAM,YAAY,KAAe,MAAuB;GAC3D;;;;;;;;;;;AAaN,SAAgB,SAAS,IAAiB,OAAoB;CAC5D,OAAO,OAAO,iBAAiB,GAAG,CAAC,iBAAiB,MAAM"}
|
package/dist/download.cjs
CHANGED
|
@@ -1,19 +1,31 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/download.ts
|
|
3
|
+
/**
|
|
4
|
+
* 下载 URL
|
|
5
|
+
* @param {string} url
|
|
6
|
+
* @param {string} filename
|
|
7
|
+
*/
|
|
3
8
|
function downloadURL(url, filename) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
const a = document.createElement("a");
|
|
10
|
+
a.href = url;
|
|
11
|
+
a.download = filename || "";
|
|
12
|
+
a.click();
|
|
8
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* 下载 Blob 对象
|
|
16
|
+
* @param blob Blob 对象
|
|
17
|
+
* @param filename 文件名
|
|
18
|
+
*/
|
|
9
19
|
function downloadBlob(blob, filename) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
20
|
+
const url = URL.createObjectURL(blob);
|
|
21
|
+
try {
|
|
22
|
+
downloadURL(url, filename);
|
|
23
|
+
} finally {
|
|
24
|
+
URL.revokeObjectURL(url);
|
|
25
|
+
}
|
|
16
26
|
}
|
|
27
|
+
//#endregion
|
|
17
28
|
exports.downloadBlob = downloadBlob;
|
|
18
29
|
exports.downloadURL = downloadURL;
|
|
19
|
-
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=download.cjs.map
|
package/dist/download.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"download.cjs","sources":["../src/download.ts"],"sourcesContent":["/**\n * 下载 URL\n * @param {string} url\n * @param {string} filename\n */\nexport function downloadURL(url: string, filename?: string) {\n const a = document.createElement('a');\n a.href = url;\n a.download = filename || '';\n a.click();\n}\n\n/**\n * 下载 Blob 对象\n * @param blob Blob 对象\n * @param filename 文件名\n */\nexport function downloadBlob(blob: Blob, filename?: string) {\n const url = URL.createObjectURL(blob);\n try {\n downloadURL(url, filename);\n } finally {\n URL.revokeObjectURL(url);\n }\n}\n"],"
|
|
1
|
+
{"version":3,"file":"download.cjs","names":[],"sources":["../src/download.ts"],"sourcesContent":["/**\n * 下载 URL\n * @param {string} url\n * @param {string} filename\n */\nexport function downloadURL(url: string, filename?: string) {\n const a = document.createElement('a');\n a.href = url;\n a.download = filename || '';\n a.click();\n}\n\n/**\n * 下载 Blob 对象\n * @param blob Blob 对象\n * @param filename 文件名\n */\nexport function downloadBlob(blob: Blob, filename?: string) {\n const url = URL.createObjectURL(blob);\n try {\n downloadURL(url, filename);\n } finally {\n URL.revokeObjectURL(url);\n }\n}\n"],"mappings":";;;;;;;AAKA,SAAgB,YAAY,KAAa,UAAmB;CAC1D,MAAM,IAAI,SAAS,cAAc,IAAI;CACrC,EAAE,OAAO;CACT,EAAE,WAAW,YAAY;CACzB,EAAE,OAAO;;;;;;;AAQX,SAAgB,aAAa,MAAY,UAAmB;CAC1D,MAAM,MAAM,IAAI,gBAAgB,KAAK;CACrC,IAAI;EACF,YAAY,KAAK,SAAS;WAClB;EACR,IAAI,gBAAgB,IAAI"}
|
package/dist/download.mjs
CHANGED
|
@@ -1,19 +1,29 @@
|
|
|
1
|
+
//#region src/download.ts
|
|
2
|
+
/**
|
|
3
|
+
* 下载 URL
|
|
4
|
+
* @param {string} url
|
|
5
|
+
* @param {string} filename
|
|
6
|
+
*/
|
|
1
7
|
function downloadURL(url, filename) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
8
|
+
const a = document.createElement("a");
|
|
9
|
+
a.href = url;
|
|
10
|
+
a.download = filename || "";
|
|
11
|
+
a.click();
|
|
6
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* 下载 Blob 对象
|
|
15
|
+
* @param blob Blob 对象
|
|
16
|
+
* @param filename 文件名
|
|
17
|
+
*/
|
|
7
18
|
function downloadBlob(blob, filename) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
19
|
+
const url = URL.createObjectURL(blob);
|
|
20
|
+
try {
|
|
21
|
+
downloadURL(url, filename);
|
|
22
|
+
} finally {
|
|
23
|
+
URL.revokeObjectURL(url);
|
|
24
|
+
}
|
|
14
25
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
//# sourceMappingURL=download.mjs.map
|
|
26
|
+
//#endregion
|
|
27
|
+
export { downloadBlob, downloadURL };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=download.mjs.map
|
package/dist/download.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"download.mjs","sources":["../src/download.ts"],"sourcesContent":["/**\n * 下载 URL\n * @param {string} url\n * @param {string} filename\n */\nexport function downloadURL(url: string, filename?: string) {\n const a = document.createElement('a');\n a.href = url;\n a.download = filename || '';\n a.click();\n}\n\n/**\n * 下载 Blob 对象\n * @param blob Blob 对象\n * @param filename 文件名\n */\nexport function downloadBlob(blob: Blob, filename?: string) {\n const url = URL.createObjectURL(blob);\n try {\n downloadURL(url, filename);\n } finally {\n URL.revokeObjectURL(url);\n }\n}\n"],"
|
|
1
|
+
{"version":3,"file":"download.mjs","names":[],"sources":["../src/download.ts"],"sourcesContent":["/**\n * 下载 URL\n * @param {string} url\n * @param {string} filename\n */\nexport function downloadURL(url: string, filename?: string) {\n const a = document.createElement('a');\n a.href = url;\n a.download = filename || '';\n a.click();\n}\n\n/**\n * 下载 Blob 对象\n * @param blob Blob 对象\n * @param filename 文件名\n */\nexport function downloadBlob(blob: Blob, filename?: string) {\n const url = URL.createObjectURL(blob);\n try {\n downloadURL(url, filename);\n } finally {\n URL.revokeObjectURL(url);\n }\n}\n"],"mappings":";;;;;;AAKA,SAAgB,YAAY,KAAa,UAAmB;CAC1D,MAAM,IAAI,SAAS,cAAc,IAAI;CACrC,EAAE,OAAO;CACT,EAAE,WAAW,YAAY;CACzB,EAAE,OAAO;;;;;;;AAQX,SAAgB,aAAa,MAAY,UAAmB;CAC1D,MAAM,MAAM,IAAI,gBAAgB,KAAK;CACrC,IAAI;EACF,YAAY,KAAK,SAAS;WAClB;EACR,IAAI,gBAAgB,IAAI"}
|
package/dist/image.cjs
CHANGED
|
@@ -1,38 +1,48 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
2
|
+
const require_dom = require("./dom.cjs");
|
|
3
|
+
//#region src/image.ts
|
|
4
|
+
/**
|
|
5
|
+
* 加载图片并返回一个包含 HTMLImageElement 的 Promise
|
|
6
|
+
* @param {string} url - 图片的 URL 地址
|
|
7
|
+
* @returns {Promise<HTMLImageElement>} 返回一个包含 HTMLImageElement 的 Promise
|
|
8
|
+
* @example
|
|
9
|
+
* const img = await imageLoad('https://example.com/image.png');
|
|
10
|
+
* @throws {Error} 如果图片加载失败,抛出错误
|
|
11
|
+
*/
|
|
4
12
|
async function imageLoad(url) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
13
|
+
return new Promise((resolve, reject) => {
|
|
14
|
+
const image = new Image();
|
|
15
|
+
let finished = false;
|
|
16
|
+
const onFinish = (isError) => {
|
|
17
|
+
if (finished) return;
|
|
18
|
+
finished = true;
|
|
19
|
+
image.onload = image.onerror = null;
|
|
20
|
+
document.body.removeChild(image);
|
|
21
|
+
isError ? reject(/* @__PURE__ */ new Error("图片加载失败")) : resolve(image);
|
|
22
|
+
};
|
|
23
|
+
image.onload = () => onFinish();
|
|
24
|
+
image.onerror = () => onFinish(true);
|
|
25
|
+
image.crossOrigin = "anonymous";
|
|
26
|
+
image.src = url;
|
|
27
|
+
require_dom.setStyle(image, {
|
|
28
|
+
visibility: "hidden",
|
|
29
|
+
position: "absolute",
|
|
30
|
+
top: "-99999%",
|
|
31
|
+
left: "-99999%",
|
|
32
|
+
maxWidth: "none",
|
|
33
|
+
maxHeight: "none",
|
|
34
|
+
border: "0",
|
|
35
|
+
width: "auto",
|
|
36
|
+
height: "auto",
|
|
37
|
+
margin: "0",
|
|
38
|
+
padding: "0",
|
|
39
|
+
transform: ""
|
|
40
|
+
});
|
|
41
|
+
document.body.appendChild(image);
|
|
42
|
+
if (image.complete && image.width > 0) onFinish();
|
|
43
|
+
});
|
|
36
44
|
}
|
|
45
|
+
//#endregion
|
|
37
46
|
exports.imageLoad = imageLoad;
|
|
38
|
-
|
|
47
|
+
|
|
48
|
+
//# sourceMappingURL=image.cjs.map
|
package/dist/image.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.cjs","sources":["../src/image.ts"],"sourcesContent":["import { setStyle } from './dom';\n\n/**\n * 加载图片并返回一个包含 HTMLImageElement 的 Promise\n * @param {string} url - 图片的 URL 地址\n * @returns {Promise<HTMLImageElement>} 返回一个包含 HTMLImageElement 的 Promise\n * @example\n * const img = await imageLoad('https://example.com/image.png');\n * @throws {Error} 如果图片加载失败,抛出错误\n */\nexport async function imageLoad(url: string) {\n return new Promise<HTMLImageElement>((resolve, reject) => {\n const image = new Image();\n let finished = false;\n const onFinish = (isError?: boolean) => {\n if (finished) return;\n finished = true;\n image.onload = image.onerror = null;\n document.body.removeChild(image);\n isError ? reject(new Error('图片加载失败')) : resolve(image);\n };\n image.onload = () => onFinish();\n image.onerror = () => onFinish(true);\n image.crossOrigin = 'anonymous';\n image.src = url;\n\n // ios 拍照产生的图片,如果没有插入的 DOM 中获取到的图片尺寸是相反的\n setStyle(image, {\n visibility: 'hidden',\n position: 'absolute',\n top: '-99999%',\n left: '-99999%',\n maxWidth: 'none',\n maxHeight: 'none',\n border: '0',\n width: 'auto',\n height: 'auto',\n margin: '0',\n padding: '0',\n transform: '',\n });\n document.body.appendChild(image);\n\n if (image.complete && image.width > 0) onFinish();\n });\n}\n\n// 图片缩放函数\n"],"
|
|
1
|
+
{"version":3,"file":"image.cjs","names":[],"sources":["../src/image.ts"],"sourcesContent":["import { setStyle } from './dom';\n\n/**\n * 加载图片并返回一个包含 HTMLImageElement 的 Promise\n * @param {string} url - 图片的 URL 地址\n * @returns {Promise<HTMLImageElement>} 返回一个包含 HTMLImageElement 的 Promise\n * @example\n * const img = await imageLoad('https://example.com/image.png');\n * @throws {Error} 如果图片加载失败,抛出错误\n */\nexport async function imageLoad(url: string) {\n return new Promise<HTMLImageElement>((resolve, reject) => {\n const image = new Image();\n let finished = false;\n const onFinish = (isError?: boolean) => {\n if (finished) return;\n finished = true;\n image.onload = image.onerror = null;\n document.body.removeChild(image);\n isError ? reject(new Error('图片加载失败')) : resolve(image);\n };\n image.onload = () => onFinish();\n image.onerror = () => onFinish(true);\n image.crossOrigin = 'anonymous';\n image.src = url;\n\n // ios 拍照产生的图片,如果没有插入的 DOM 中获取到的图片尺寸是相反的\n setStyle(image, {\n visibility: 'hidden',\n position: 'absolute',\n top: '-99999%',\n left: '-99999%',\n maxWidth: 'none',\n maxHeight: 'none',\n border: '0',\n width: 'auto',\n height: 'auto',\n margin: '0',\n padding: '0',\n transform: '',\n });\n document.body.appendChild(image);\n\n if (image.complete && image.width > 0) onFinish();\n });\n}\n\n// 图片缩放函数\n"],"mappings":";;;;;;;;;;;AAUA,eAAsB,UAAU,KAAa;CAC3C,OAAO,IAAI,SAA2B,SAAS,WAAW;EACxD,MAAM,QAAQ,IAAI,OAAO;EACzB,IAAI,WAAW;EACf,MAAM,YAAY,YAAsB;GACtC,IAAI,UAAU;GACd,WAAW;GACX,MAAM,SAAS,MAAM,UAAU;GAC/B,SAAS,KAAK,YAAY,MAAM;GAChC,UAAU,uBAAO,IAAI,MAAM,SAAS,CAAC,GAAG,QAAQ,MAAM;;EAExD,MAAM,eAAe,UAAU;EAC/B,MAAM,gBAAgB,SAAS,KAAK;EACpC,MAAM,cAAc;EACpB,MAAM,MAAM;EAGZ,YAAA,SAAS,OAAO;GACd,YAAY;GACZ,UAAU;GACV,KAAK;GACL,MAAM;GACN,UAAU;GACV,WAAW;GACX,QAAQ;GACR,OAAO;GACP,QAAQ;GACR,QAAQ;GACR,SAAS;GACT,WAAW;GACZ,CAAC;EACF,SAAS,KAAK,YAAY,MAAM;EAEhC,IAAI,MAAM,YAAY,MAAM,QAAQ,GAAG,UAAU;GACjD"}
|
package/dist/image.mjs
CHANGED
|
@@ -1,38 +1,47 @@
|
|
|
1
1
|
import { setStyle } from "./dom.mjs";
|
|
2
|
+
//#region src/image.ts
|
|
3
|
+
/**
|
|
4
|
+
* 加载图片并返回一个包含 HTMLImageElement 的 Promise
|
|
5
|
+
* @param {string} url - 图片的 URL 地址
|
|
6
|
+
* @returns {Promise<HTMLImageElement>} 返回一个包含 HTMLImageElement 的 Promise
|
|
7
|
+
* @example
|
|
8
|
+
* const img = await imageLoad('https://example.com/image.png');
|
|
9
|
+
* @throws {Error} 如果图片加载失败,抛出错误
|
|
10
|
+
*/
|
|
2
11
|
async function imageLoad(url) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
12
|
+
return new Promise((resolve, reject) => {
|
|
13
|
+
const image = new Image();
|
|
14
|
+
let finished = false;
|
|
15
|
+
const onFinish = (isError) => {
|
|
16
|
+
if (finished) return;
|
|
17
|
+
finished = true;
|
|
18
|
+
image.onload = image.onerror = null;
|
|
19
|
+
document.body.removeChild(image);
|
|
20
|
+
isError ? reject(/* @__PURE__ */ new Error("图片加载失败")) : resolve(image);
|
|
21
|
+
};
|
|
22
|
+
image.onload = () => onFinish();
|
|
23
|
+
image.onerror = () => onFinish(true);
|
|
24
|
+
image.crossOrigin = "anonymous";
|
|
25
|
+
image.src = url;
|
|
26
|
+
setStyle(image, {
|
|
27
|
+
visibility: "hidden",
|
|
28
|
+
position: "absolute",
|
|
29
|
+
top: "-99999%",
|
|
30
|
+
left: "-99999%",
|
|
31
|
+
maxWidth: "none",
|
|
32
|
+
maxHeight: "none",
|
|
33
|
+
border: "0",
|
|
34
|
+
width: "auto",
|
|
35
|
+
height: "auto",
|
|
36
|
+
margin: "0",
|
|
37
|
+
padding: "0",
|
|
38
|
+
transform: ""
|
|
39
|
+
});
|
|
40
|
+
document.body.appendChild(image);
|
|
41
|
+
if (image.complete && image.width > 0) onFinish();
|
|
42
|
+
});
|
|
34
43
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
//# sourceMappingURL=image.mjs.map
|
|
44
|
+
//#endregion
|
|
45
|
+
export { imageLoad };
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=image.mjs.map
|
package/dist/image.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.mjs","sources":["../src/image.ts"],"sourcesContent":["import { setStyle } from './dom';\n\n/**\n * 加载图片并返回一个包含 HTMLImageElement 的 Promise\n * @param {string} url - 图片的 URL 地址\n * @returns {Promise<HTMLImageElement>} 返回一个包含 HTMLImageElement 的 Promise\n * @example\n * const img = await imageLoad('https://example.com/image.png');\n * @throws {Error} 如果图片加载失败,抛出错误\n */\nexport async function imageLoad(url: string) {\n return new Promise<HTMLImageElement>((resolve, reject) => {\n const image = new Image();\n let finished = false;\n const onFinish = (isError?: boolean) => {\n if (finished) return;\n finished = true;\n image.onload = image.onerror = null;\n document.body.removeChild(image);\n isError ? reject(new Error('图片加载失败')) : resolve(image);\n };\n image.onload = () => onFinish();\n image.onerror = () => onFinish(true);\n image.crossOrigin = 'anonymous';\n image.src = url;\n\n // ios 拍照产生的图片,如果没有插入的 DOM 中获取到的图片尺寸是相反的\n setStyle(image, {\n visibility: 'hidden',\n position: 'absolute',\n top: '-99999%',\n left: '-99999%',\n maxWidth: 'none',\n maxHeight: 'none',\n border: '0',\n width: 'auto',\n height: 'auto',\n margin: '0',\n padding: '0',\n transform: '',\n });\n document.body.appendChild(image);\n\n if (image.complete && image.width > 0) onFinish();\n });\n}\n\n// 图片缩放函数\n"],"
|
|
1
|
+
{"version":3,"file":"image.mjs","names":[],"sources":["../src/image.ts"],"sourcesContent":["import { setStyle } from './dom';\n\n/**\n * 加载图片并返回一个包含 HTMLImageElement 的 Promise\n * @param {string} url - 图片的 URL 地址\n * @returns {Promise<HTMLImageElement>} 返回一个包含 HTMLImageElement 的 Promise\n * @example\n * const img = await imageLoad('https://example.com/image.png');\n * @throws {Error} 如果图片加载失败,抛出错误\n */\nexport async function imageLoad(url: string) {\n return new Promise<HTMLImageElement>((resolve, reject) => {\n const image = new Image();\n let finished = false;\n const onFinish = (isError?: boolean) => {\n if (finished) return;\n finished = true;\n image.onload = image.onerror = null;\n document.body.removeChild(image);\n isError ? reject(new Error('图片加载失败')) : resolve(image);\n };\n image.onload = () => onFinish();\n image.onerror = () => onFinish(true);\n image.crossOrigin = 'anonymous';\n image.src = url;\n\n // ios 拍照产生的图片,如果没有插入的 DOM 中获取到的图片尺寸是相反的\n setStyle(image, {\n visibility: 'hidden',\n position: 'absolute',\n top: '-99999%',\n left: '-99999%',\n maxWidth: 'none',\n maxHeight: 'none',\n border: '0',\n width: 'auto',\n height: 'auto',\n margin: '0',\n padding: '0',\n transform: '',\n });\n document.body.appendChild(image);\n\n if (image.complete && image.width > 0) onFinish();\n });\n}\n\n// 图片缩放函数\n"],"mappings":";;;;;;;;;;AAUA,eAAsB,UAAU,KAAa;CAC3C,OAAO,IAAI,SAA2B,SAAS,WAAW;EACxD,MAAM,QAAQ,IAAI,OAAO;EACzB,IAAI,WAAW;EACf,MAAM,YAAY,YAAsB;GACtC,IAAI,UAAU;GACd,WAAW;GACX,MAAM,SAAS,MAAM,UAAU;GAC/B,SAAS,KAAK,YAAY,MAAM;GAChC,UAAU,uBAAO,IAAI,MAAM,SAAS,CAAC,GAAG,QAAQ,MAAM;;EAExD,MAAM,eAAe,UAAU;EAC/B,MAAM,gBAAgB,SAAS,KAAK;EACpC,MAAM,cAAc;EACpB,MAAM,MAAM;EAGZ,SAAS,OAAO;GACd,YAAY;GACZ,UAAU;GACV,KAAK;GACL,MAAM;GACN,UAAU;GACV,WAAW;GACX,QAAQ;GACR,OAAO;GACP,QAAQ;GACR,QAAQ;GACR,SAAS;GACT,WAAW;GACZ,CAAC;EACF,SAAS,KAAK,YAAY,MAAM;EAEhC,IAAI,MAAM,YAAY,MAAM,QAAQ,GAAG,UAAU;GACjD"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
|
|
2
|
+
//#region src/index.ts
|
|
3
|
+
/**
|
|
4
|
+
* `@cloudcome/utils-browser` 版本号
|
|
5
|
+
*/
|
|
6
|
+
var VERSION = "1.2.17";
|
|
7
|
+
//#endregion
|
|
4
8
|
exports.VERSION = VERSION;
|
|
5
|
-
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":["/**\n * `@cloudcome/utils-browser` 版本号\n */\nexport const VERSION = PKG_VERSION;\n"],"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * `@cloudcome/utils-browser` 版本号\n */\nexport const VERSION = PKG_VERSION;\n"],"mappings":";;;;;AAGA,IAAa,UAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
//#region src/index.ts
|
|
2
|
+
/**
|
|
3
|
+
* `@cloudcome/utils-browser` 版本号
|
|
4
|
+
*/
|
|
5
|
+
var VERSION = "1.2.17";
|
|
6
|
+
//#endregion
|
|
7
|
+
export { VERSION };
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":["/**\n * `@cloudcome/utils-browser` 版本号\n */\nexport const VERSION = PKG_VERSION;\n"],"
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * `@cloudcome/utils-browser` 版本号\n */\nexport const VERSION = PKG_VERSION;\n"],"mappings":";;;;AAGA,IAAa,UAAA"}
|