@saasui/utils 1.0.0

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.
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @description: 复制指定文本内容
3
+ * @param {string} text
4
+ * @author: 张泽锋
5
+ * @Date: 2025-06-03
6
+ */
7
+ export declare function CopyText(text: string): Promise<boolean>;
8
+ /**
9
+ * @description: 计算文本的字符数量
10
+ * @param {string} str
11
+ * @param {number} strNum
12
+ * @return {*}
13
+ * @author: 张泽锋
14
+ * @Date: 2025-06-06
15
+ */
16
+ export declare const ExtractSpecifiedString: (str: string, strNum: number) => string;
17
+ /**
18
+ * @description: 依据字符长度截取规定的字符串
19
+ * @param {String} str
20
+ * @return {*}
21
+ * @author: 张泽锋
22
+ * @Date: 2025-06-06
23
+ */
24
+ export declare const CalcStrLen: (str: String) => number;
25
+ /**
26
+ * @description: 计算字符串在浏览器中的像素宽度
27
+ * @param {string} str 需要计算的字符串
28
+ * @param {string} [font='14px Arial'] 可选,字体样式,默认14px Arial
29
+ * @return {number} 返回字符串的像素宽度
30
+ * @author: 张泽锋
31
+ * @Date: 2025-06-06
32
+ */
33
+ export declare const getTextWidth: (str: string, size?: string) => number;
34
+ /**
35
+ * 判断字符串在指定宽度和字体下是否会超出两行显示
36
+ * @param str 需要判断的字符串
37
+ * @param font 字体,默认 '14px Microsoft YaHei'
38
+ * @param maxWidth 单行最大宽度,默认 50px
39
+ * @param maxLines 最大行数,默认 2
40
+ * @returns 是否超出两行
41
+ */
42
+ export declare function isTextOverTwoLines(str: string, font?: string, maxWidth?: number, maxLines?: number): boolean;
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "@saasui/utils",
3
+ "version": "1.0.0",
4
+ "description": "SaaS UI utility functions",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/types/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/index.js",
12
+ "require": "./dist/index.cjs",
13
+ "types": "./dist/types/index.d.ts"
14
+ },
15
+ "./auth": {
16
+ "import": "./dist/es/auth.js",
17
+ "types": "./dist/types/auth.d.ts"
18
+ },
19
+ "./base": {
20
+ "import": "./dist/es/base.js",
21
+ "types": "./dist/types/base.d.ts"
22
+ },
23
+ "./form": {
24
+ "import": "./dist/es/form.js",
25
+ "types": "./dist/types/form.d.ts"
26
+ },
27
+ "./function": {
28
+ "import": "./dist/es/function.js",
29
+ "types": "./dist/types/function.d.ts"
30
+ },
31
+ "./logger": {
32
+ "import": "./dist/es/logger.js",
33
+ "types": "./dist/types/logger.d.ts"
34
+ },
35
+ "./math": {
36
+ "import": "./dist/es/math.js",
37
+ "types": "./dist/types/math.d.ts"
38
+ },
39
+ "./storage": {
40
+ "import": "./dist/es/storage.js",
41
+ "types": "./dist/types/storage.d.ts"
42
+ },
43
+ "./text": {
44
+ "import": "./dist/es/text.js",
45
+ "types": "./dist/types/text.d.ts"
46
+ }
47
+ },
48
+ "files": [
49
+ "dist"
50
+ ],
51
+ "scripts": {
52
+ "build": "vue-tsc --noEmit && vite build"
53
+ },
54
+ "dependencies": {
55
+ "js-cookie": "^3.0.5"
56
+ },
57
+ "devDependencies": {
58
+ "@types/js-cookie": "^3.0.6",
59
+ "typescript": "~5.8.3",
60
+ "vite": "^8.0.0",
61
+ "vite-plugin-dts": "^4.0.0",
62
+ "vue-tsc": "^2.2.8"
63
+ },
64
+ "license": "MIT"
65
+ }