@sunyard-szyy-ui/utils 0.3.4 → 0.4.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.
package/dist/index.cjs CHANGED
@@ -57,8 +57,8 @@ function SunyardSzyyUIResolver(options = {}) {
57
57
  actualDirResolver = (name) => {
58
58
  const styleFile = importStyle === "scss" ? "index.ts" : "css.ts";
59
59
  return {
60
- componentPath: fileURLToPath(new URL(`../packages/components/src/${name}/index.ts`, importMetaUrl)),
61
- stylePath: fileURLToPath(new URL(`../packages/components/src/${name}/style/${styleFile}`, importMetaUrl))
60
+ componentPath: fileURLToPath(new URL(`../packages/core/components/src/${name}/index.ts`, importMetaUrl)),
61
+ stylePath: fileURLToPath(new URL(`../packages/core/components/src/${name}/style/${styleFile}`, importMetaUrl))
62
62
  };
63
63
  };
64
64
  }
package/dist/index.d.cts CHANGED
@@ -4,101 +4,101 @@ import * as vue from 'vue';
4
4
  * 组件解析器类型(兼容 unplugin-vue-components)
5
5
  */
6
6
  interface ComponentResolver {
7
- type: 'component' | 'directive';
8
- resolve: (name: string) => ComponentResolveResult | void | null | undefined;
7
+ type: 'component' | 'directive';
8
+ resolve: (name: string) => ComponentResolveResult | void | null | undefined;
9
9
  }
10
10
  /**
11
11
  * 组件解析结果
12
12
  */
13
13
  interface ComponentResolveResult {
14
- name?: string;
15
- from: string;
16
- sideEffects?: string | string[];
17
- [key: string]: any;
14
+ name?: string;
15
+ from: string;
16
+ sideEffects?: string | string[];
17
+ [key: string]: any;
18
18
  }
19
19
  /**
20
20
  * Resolver 配置选项
21
21
  */
22
22
  interface SunyardSzyyUIResolverOptions {
23
+ /**
24
+ * 组件前缀
25
+ * @default 'Sy'
26
+ */
27
+ prefix?: string;
28
+ /**
29
+ * 是否导入样式
30
+ * @default true
31
+ */
32
+ importStyle?: boolean | 'css' | 'scss';
33
+ /**
34
+ * 组件库名称
35
+ * @default 'sunyard-szyy-ui'
36
+ */
37
+ libraryName?: string;
38
+ /**
39
+ * 样式包名称
40
+ * @default 'sunyard-szyy-ui/theme-chalk'
41
+ */
42
+ styleLibraryName?: string;
43
+ /**
44
+ * 组件目录名称
45
+ * @default '@sunyard-szyy-ui/components'
46
+ */
47
+ componentsLibraryName?: string;
48
+ /**
49
+ * 是否为源码开发模式(monorepo 内部开发)
50
+ *
51
+ * 启用后会自动使用 monorepo 源码路径,无需手动配置 dirResolver
52
+ *
53
+ * @default false
54
+ *
55
+ * @example
56
+ * // 在 monorepo 开发环境中使用
57
+ * import { fileURLToPath } from 'node:url';
58
+ *
59
+ * SunyardSzyyUIResolver({
60
+ * devMode: true,
61
+ * importMetaUrl: import.meta.url,
62
+ * fileURLToPath: fileURLToPath
63
+ * })
64
+ */
65
+ devMode?: boolean;
66
+ /**
67
+ * import.meta.url(devMode 启用时必须提供)
68
+ *
69
+ * 用于解析 monorepo 源码的绝对路径
70
+ *
71
+ * @example
72
+ * import.meta.url
73
+ */
74
+ importMetaUrl?: string;
75
+ /**
76
+ * fileURLToPath 函数(devMode 启用时必须提供)
77
+ *
78
+ * 用于将 URL 转换为文件系统路径
79
+ *
80
+ * @example
81
+ * import { fileURLToPath } from 'node:url';
82
+ * // 然后传入: fileURLToPath: fileURLToPath
83
+ */
84
+ fileURLToPath?: (url: string | URL) => string;
85
+ /**
86
+ * 自定义目录解析器(高级用法,一般不需要)
87
+ *
88
+ * 如果提供了此选项,会覆盖 devMode 的默认行为
89
+ *
90
+ * @deprecated 推荐使用 devMode + importMetaUrl 替代
91
+ */
92
+ dirResolver?: (name: string) => {
23
93
  /**
24
- * 组件前缀
25
- * @default 'Sy'
26
- */
27
- prefix?: string;
28
- /**
29
- * 是否导入样式
30
- * @default true
31
- */
32
- importStyle?: boolean | 'css' | 'scss';
33
- /**
34
- * 组件库名称
35
- * @default 'sunyard-szyy-ui'
36
- */
37
- libraryName?: string;
38
- /**
39
- * 样式包名称
40
- * @default 'sunyard-szyy-ui/theme-chalk'
41
- */
42
- styleLibraryName?: string;
43
- /**
44
- * 组件目录名称
45
- * @default '@sunyard-szyy-ui/components'
46
- */
47
- componentsLibraryName?: string;
48
- /**
49
- * 是否为源码开发模式(monorepo 内部开发)
50
- *
51
- * 启用后会自动使用 monorepo 源码路径,无需手动配置 dirResolver
52
- *
53
- * @default false
54
- *
55
- * @example
56
- * // 在 monorepo 开发环境中使用
57
- * import { fileURLToPath } from 'node:url';
58
- *
59
- * SunyardSzyyUIResolver({
60
- * devMode: true,
61
- * importMetaUrl: import.meta.url,
62
- * fileURLToPath: fileURLToPath
63
- * })
64
- */
65
- devMode?: boolean;
66
- /**
67
- * import.meta.url(devMode 启用时必须提供)
68
- *
69
- * 用于解析 monorepo 源码的绝对路径
70
- *
71
- * @example
72
- * import.meta.url
73
- */
74
- importMetaUrl?: string;
75
- /**
76
- * fileURLToPath 函数(devMode 启用时必须提供)
77
- *
78
- * 用于将 URL 转换为文件系统路径
79
- *
80
- * @example
81
- * import { fileURLToPath } from 'node:url';
82
- * // 然后传入: fileURLToPath: fileURLToPath
94
+ * 组件源码路径(开发模式使用)
83
95
  */
84
- fileURLToPath?: (url: string | URL) => string;
96
+ componentPath?: string;
85
97
  /**
86
- * 自定义目录解析器(高级用法,一般不需要)
87
- *
88
- * 如果提供了此选项,会覆盖 devMode 的默认行为
89
- *
90
- * @deprecated 推荐使用 devMode + importMetaUrl 替代
98
+ * 样式源码路径(开发模式使用)
91
99
  */
92
- dirResolver?: (name: string) => {
93
- /**
94
- * 组件源码路径(开发模式使用)
95
- */
96
- componentPath?: string;
97
- /**
98
- * 样式源码路径(开发模式使用)
99
- */
100
- stylePath?: string;
101
- };
100
+ stylePath?: string;
101
+ };
102
102
  }
103
103
  /**
104
104
  * sunyard-szyy-ui 组件自动导入 resolver
@@ -151,11 +151,13 @@ interface SunyardSzyyUIResolverOptions {
151
151
  declare function SunyardSzyyUIResolver(options?: SunyardSzyyUIResolverOptions): ComponentResolver;
152
152
 
153
153
  type SFCWithInstall<T> = T & {
154
- install(app: vue.App): void;
154
+ install(app: vue.App): void;
155
155
  };
156
- declare function withInstall<T>(component: T & {
156
+ declare function withInstall<T>(
157
+ component: T & {
157
158
  name?: string;
158
- }): SFCWithInstall<T>;
159
+ }
160
+ ): SFCWithInstall<T>;
159
161
 
160
162
  /**
161
163
  * 防抖函数
package/dist/index.d.ts CHANGED
@@ -4,101 +4,101 @@ import * as vue from 'vue';
4
4
  * 组件解析器类型(兼容 unplugin-vue-components)
5
5
  */
6
6
  interface ComponentResolver {
7
- type: 'component' | 'directive';
8
- resolve: (name: string) => ComponentResolveResult | void | null | undefined;
7
+ type: 'component' | 'directive';
8
+ resolve: (name: string) => ComponentResolveResult | void | null | undefined;
9
9
  }
10
10
  /**
11
11
  * 组件解析结果
12
12
  */
13
13
  interface ComponentResolveResult {
14
- name?: string;
15
- from: string;
16
- sideEffects?: string | string[];
17
- [key: string]: any;
14
+ name?: string;
15
+ from: string;
16
+ sideEffects?: string | string[];
17
+ [key: string]: any;
18
18
  }
19
19
  /**
20
20
  * Resolver 配置选项
21
21
  */
22
22
  interface SunyardSzyyUIResolverOptions {
23
+ /**
24
+ * 组件前缀
25
+ * @default 'Sy'
26
+ */
27
+ prefix?: string;
28
+ /**
29
+ * 是否导入样式
30
+ * @default true
31
+ */
32
+ importStyle?: boolean | 'css' | 'scss';
33
+ /**
34
+ * 组件库名称
35
+ * @default 'sunyard-szyy-ui'
36
+ */
37
+ libraryName?: string;
38
+ /**
39
+ * 样式包名称
40
+ * @default 'sunyard-szyy-ui/theme-chalk'
41
+ */
42
+ styleLibraryName?: string;
43
+ /**
44
+ * 组件目录名称
45
+ * @default '@sunyard-szyy-ui/components'
46
+ */
47
+ componentsLibraryName?: string;
48
+ /**
49
+ * 是否为源码开发模式(monorepo 内部开发)
50
+ *
51
+ * 启用后会自动使用 monorepo 源码路径,无需手动配置 dirResolver
52
+ *
53
+ * @default false
54
+ *
55
+ * @example
56
+ * // 在 monorepo 开发环境中使用
57
+ * import { fileURLToPath } from 'node:url';
58
+ *
59
+ * SunyardSzyyUIResolver({
60
+ * devMode: true,
61
+ * importMetaUrl: import.meta.url,
62
+ * fileURLToPath: fileURLToPath
63
+ * })
64
+ */
65
+ devMode?: boolean;
66
+ /**
67
+ * import.meta.url(devMode 启用时必须提供)
68
+ *
69
+ * 用于解析 monorepo 源码的绝对路径
70
+ *
71
+ * @example
72
+ * import.meta.url
73
+ */
74
+ importMetaUrl?: string;
75
+ /**
76
+ * fileURLToPath 函数(devMode 启用时必须提供)
77
+ *
78
+ * 用于将 URL 转换为文件系统路径
79
+ *
80
+ * @example
81
+ * import { fileURLToPath } from 'node:url';
82
+ * // 然后传入: fileURLToPath: fileURLToPath
83
+ */
84
+ fileURLToPath?: (url: string | URL) => string;
85
+ /**
86
+ * 自定义目录解析器(高级用法,一般不需要)
87
+ *
88
+ * 如果提供了此选项,会覆盖 devMode 的默认行为
89
+ *
90
+ * @deprecated 推荐使用 devMode + importMetaUrl 替代
91
+ */
92
+ dirResolver?: (name: string) => {
23
93
  /**
24
- * 组件前缀
25
- * @default 'Sy'
26
- */
27
- prefix?: string;
28
- /**
29
- * 是否导入样式
30
- * @default true
31
- */
32
- importStyle?: boolean | 'css' | 'scss';
33
- /**
34
- * 组件库名称
35
- * @default 'sunyard-szyy-ui'
36
- */
37
- libraryName?: string;
38
- /**
39
- * 样式包名称
40
- * @default 'sunyard-szyy-ui/theme-chalk'
41
- */
42
- styleLibraryName?: string;
43
- /**
44
- * 组件目录名称
45
- * @default '@sunyard-szyy-ui/components'
46
- */
47
- componentsLibraryName?: string;
48
- /**
49
- * 是否为源码开发模式(monorepo 内部开发)
50
- *
51
- * 启用后会自动使用 monorepo 源码路径,无需手动配置 dirResolver
52
- *
53
- * @default false
54
- *
55
- * @example
56
- * // 在 monorepo 开发环境中使用
57
- * import { fileURLToPath } from 'node:url';
58
- *
59
- * SunyardSzyyUIResolver({
60
- * devMode: true,
61
- * importMetaUrl: import.meta.url,
62
- * fileURLToPath: fileURLToPath
63
- * })
64
- */
65
- devMode?: boolean;
66
- /**
67
- * import.meta.url(devMode 启用时必须提供)
68
- *
69
- * 用于解析 monorepo 源码的绝对路径
70
- *
71
- * @example
72
- * import.meta.url
73
- */
74
- importMetaUrl?: string;
75
- /**
76
- * fileURLToPath 函数(devMode 启用时必须提供)
77
- *
78
- * 用于将 URL 转换为文件系统路径
79
- *
80
- * @example
81
- * import { fileURLToPath } from 'node:url';
82
- * // 然后传入: fileURLToPath: fileURLToPath
94
+ * 组件源码路径(开发模式使用)
83
95
  */
84
- fileURLToPath?: (url: string | URL) => string;
96
+ componentPath?: string;
85
97
  /**
86
- * 自定义目录解析器(高级用法,一般不需要)
87
- *
88
- * 如果提供了此选项,会覆盖 devMode 的默认行为
89
- *
90
- * @deprecated 推荐使用 devMode + importMetaUrl 替代
98
+ * 样式源码路径(开发模式使用)
91
99
  */
92
- dirResolver?: (name: string) => {
93
- /**
94
- * 组件源码路径(开发模式使用)
95
- */
96
- componentPath?: string;
97
- /**
98
- * 样式源码路径(开发模式使用)
99
- */
100
- stylePath?: string;
101
- };
100
+ stylePath?: string;
101
+ };
102
102
  }
103
103
  /**
104
104
  * sunyard-szyy-ui 组件自动导入 resolver
@@ -151,11 +151,13 @@ interface SunyardSzyyUIResolverOptions {
151
151
  declare function SunyardSzyyUIResolver(options?: SunyardSzyyUIResolverOptions): ComponentResolver;
152
152
 
153
153
  type SFCWithInstall<T> = T & {
154
- install(app: vue.App): void;
154
+ install(app: vue.App): void;
155
155
  };
156
- declare function withInstall<T>(component: T & {
156
+ declare function withInstall<T>(
157
+ component: T & {
157
158
  name?: string;
158
- }): SFCWithInstall<T>;
159
+ }
160
+ ): SFCWithInstall<T>;
159
161
 
160
162
  /**
161
163
  * 防抖函数
package/dist/index.js CHANGED
@@ -26,8 +26,8 @@ function SunyardSzyyUIResolver(options = {}) {
26
26
  actualDirResolver = (name) => {
27
27
  const styleFile = importStyle === "scss" ? "index.ts" : "css.ts";
28
28
  return {
29
- componentPath: fileURLToPath(new URL(`../packages/components/src/${name}/index.ts`, importMetaUrl)),
30
- stylePath: fileURLToPath(new URL(`../packages/components/src/${name}/style/${styleFile}`, importMetaUrl))
29
+ componentPath: fileURLToPath(new URL(`../packages/core/components/src/${name}/index.ts`, importMetaUrl)),
30
+ stylePath: fileURLToPath(new URL(`../packages/core/components/src/${name}/style/${styleFile}`, importMetaUrl))
31
31
  };
32
32
  };
33
33
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sunyard-szyy-ui/utils",
3
- "version": "0.3.4",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",