uniky 1.0.23 → 1.0.25

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uniky",
3
- "version": "1.0.23",
3
+ "version": "1.0.25",
4
4
  "description": "uni-app 开发工具库,包含 hooks、http 请求和 vite 插件",
5
5
  "type": "module",
6
6
  "main": "./src/lib/index.ts",
@@ -36,6 +36,30 @@ function findProjectRoot() {
36
36
  return process.cwd();
37
37
  }
38
38
 
39
+ function copyDirectorySkipExisting(source, target) {
40
+ if (!existsSync(target)) {
41
+ mkdirSync(target, { recursive: true });
42
+ }
43
+
44
+ const files = readdirSync(source);
45
+ let count = 0;
46
+
47
+ files.forEach(file => {
48
+ const sourcePath = join(source, file);
49
+ const targetPath = join(target, file);
50
+ const stat = statSync(sourcePath);
51
+
52
+ if (stat.isDirectory()) {
53
+ count += copyDirectorySkipExisting(sourcePath, targetPath);
54
+ } else if (!existsSync(targetPath)) {
55
+ copyFileSync(sourcePath, targetPath);
56
+ count++;
57
+ }
58
+ });
59
+
60
+ return count;
61
+ }
62
+
39
63
  function copyDirectoryRecursive(source, target) {
40
64
  if (!existsSync(target)) {
41
65
  mkdirSync(target, { recursive: true });
@@ -96,6 +120,17 @@ export * from './plugin/index.js';
96
120
  console.log(`[uniky] 创建索引文件: ${join(unikyDir, 'index.ts')}`);
97
121
 
98
122
  console.log(`[uniky] ✅ 插件文件已成功安装到 ${unikyDir} (${copiedCount} 个文件)`);
123
+
124
+ const skillsSourceDir = join(__dirname, '..', 'src', 'plugin', '.skills');
125
+ const skillsTargetDir = join(projectRoot, '.skills');
126
+ if (existsSync(skillsSourceDir)) {
127
+ const skillsCopied = copyDirectorySkipExisting(skillsSourceDir, skillsTargetDir);
128
+ if (skillsCopied > 0) {
129
+ console.log(`[uniky] ✅ .skills 拷贝了 ${skillsCopied} 个新文件到 ${skillsTargetDir}`);
130
+ } else {
131
+ console.log(`[uniky] .skills 文件已存在,跳过拷贝`);
132
+ }
133
+ }
99
134
  } catch (error) {
100
135
  console.error('[uniky] ❌ 插件文件安装失败:', error);
101
136
  console.error('[uniky] 错误堆栈:', error.stack);
@@ -0,0 +1,54 @@
1
+ ---
2
+ name: create-page
3
+ description: 根据给出路径去创建一个uni-app 的页面
4
+ ---
5
+
6
+ # 创建页面流程逻辑说明
7
+
8
+ ## 项目基础
9
+ 该项目是uni-app的项目
10
+
11
+ ## 什么时候创建页面
12
+ 当给出页面路径时使用改路径去创建页面的vue文件,同时在src/pages.json文件中添加页面路由配置
13
+ 例如给我给出 pages/demo/index 时
14
+ (1)为我在 src/pages/demo 路径下创建 index.vue 作为页面文件
15
+ (2)在src/pages.json 中添加页面信息,
16
+
17
+ ```jsonc
18
+ {
19
+ "pages":[
20
+ {
21
+ "path": "pages/demo/index",
22
+ "style": "style": {
23
+ "navigationBarTitleText": "示例首页",
24
+ "navigationStyle": "default",
25
+ "backgroundColor": "#f8f8f8",
26
+ "navigationBarBackgroundColor": "#f8f8f8"
27
+ }
28
+ }
29
+ ]
30
+ }
31
+ ```
32
+
33
+ 如果路径以`pages-`开头 例如pages-order/list/query则作为子报添加到 subPackages 子模块中
34
+
35
+ ```jsonc
36
+ {
37
+ "subPackages":[
38
+ {
39
+ "root": "pages-order",
40
+ "pages": [
41
+ {
42
+ "path": "list/query",
43
+ "style": {
44
+ "navigationBarTitleText": "订单查询",
45
+ "navigationStyle": "default",
46
+ "backgroundColor": "#FFFFFF"
47
+ }
48
+ }
49
+ ]
50
+ }
51
+ ],
52
+ ]
53
+ }
54
+ ```
@@ -0,0 +1,116 @@
1
+ ---
2
+ name: icon-update
3
+ description: 根据给出iconfont下载文件夹去更新我的icon信息
4
+ ---
5
+
6
+ # 更新逻辑说明
7
+
8
+ ## iconfont 下载文件夹结构
9
+ /
10
+ ├── demo_index.html # 演示页面 (24K)
11
+ ├── demo.css # 演示样式 (8.2K)
12
+ ├── iconfont.css # 字体样式文件 (1.4K)
13
+ ├── iconfont.js # JavaScript 版本 (23K)
14
+ ├── iconfont.json # 图标配置信息 (3.5K)
15
+ ├── iconfont.ttf # TrueType 字体 (5.6K)
16
+ ├── iconfont.woff # Web 字体格式 (3.3K)
17
+ └── iconfont.woff2 # Web 字体格式2 (2.7K)
18
+
19
+ ### 关键文件 iconfont.json
20
+ ```json
21
+ {
22
+ "id": "5127762",
23
+ "name": "noted",
24
+ "font_family": "iconfont",
25
+ "css_prefix_text": "icon-",
26
+ "description": "",
27
+ "glyphs": [
28
+ {
29
+ "icon_id": "46919908",
30
+ "name": "delete",
31
+ "font_class": "delete",
32
+ "unicode": "#xe604",
33
+ "unicode_decimal": 59062
34
+ }
35
+ ...
36
+ ]
37
+ }
38
+
39
+ ```
40
+
41
+ ## 通过iconfont下载文件夹结构信息 创建或更新icon.vue文件;同时更新static/iconfont.woff2 文件
42
+
43
+ src/component/icon.vue 基础示例如下
44
+ ```vue
45
+ <template>
46
+ <text class="me-font">{{ icon }}</text>
47
+ </template>
48
+
49
+ <script lang="ts" setup>
50
+ import { ref, watch } from "vue";
51
+
52
+ let IconMap = {
53
+ delete: "&#xe604;",
54
+ addFill: "&#xe606;",
55
+ };
56
+
57
+ type IconName = keyof typeof IconMap;
58
+
59
+ const props = defineProps<{
60
+ name: IconName;
61
+ }>();
62
+
63
+ let value = IconMap[props.name] || "&#xe604;";
64
+ value = value.replace("&#x", "%u").replace(";", "");
65
+ value = unescape(value);
66
+ const icon = ref(value);
67
+
68
+ watch(
69
+ () => props.name,
70
+ (val) => {
71
+ let iconStr = IconMap[val];
72
+ iconStr = iconStr.replace("&#x", "%u").replace(";", "");
73
+ iconStr = iconStr.replace("&#x", "%u").replace(";", "");
74
+ iconStr = unescape(iconStr);
75
+ icon.value = iconStr;
76
+ },
77
+ );
78
+ </script>
79
+
80
+ <style lang="scss">
81
+ @font-face {
82
+ font-family: "iconfont";
83
+ /* #ifdef H5 */
84
+ src: url("/h5/static/iconfont.woff2") format("woff2");
85
+ /* #endif */
86
+ /* #ifdef MP-WEIXIN */
87
+ //src: url('//at.alicdn.com/t/c/font_2942740_av9lw25yela.woff2?t=1707276070685') format('woff2');
88
+ src: url("/static/iconfont.woff2") format("woff2");
89
+
90
+ /* #endif */
91
+ /* #ifdef APP-PLUS */
92
+ src: url("/static/iconfont.woff2") format("woff2");
93
+ /* #endif */
94
+ }
95
+
96
+ /*!* 在线链接服务仅供平台体验和调试使用,平台不承诺服务的稳定性,企业客户需下载字体包自行发布使用并做好备份。 *!*/
97
+ /*@font-face {*/
98
+ /* font-family: 'iconfont'; !* Project id 2942740 *!*/
99
+ /* src: url('//at.alicdn.com/t/c/font_2942740_oa0mdid0yx.woff2?t=1694135753186') format('woff2');*/
100
+ /*}*/
101
+
102
+ .me-font {
103
+ font-family: iconfont;
104
+ text-align: center;
105
+ line-height: 1;
106
+ display: flex;
107
+ flex-direction: row;
108
+ justify-content: center;
109
+ align-items: center;
110
+ }
111
+ </style>
112
+ ```
113
+
114
+ (1)创建更新src/component/icon.vue 文件,文件中 IconMap 来自于iconfont.json中 glyphs 下的name,unicode 项;注意按照基础示例中IconMap 的值前面须添加'&'前置字符
115
+
116
+ (2)更新的后同时将iconfont.woff2文件拷贝跟新到src/static/ 文件夹下
File without changes
@@ -0,0 +1,67 @@
1
+ <template>
2
+ <text class="me-font">{{ icon }}</text>
3
+ </template>
4
+
5
+ <script lang="ts" setup>
6
+ import { ref, watch } from "vue";
7
+
8
+ let IconMap = {
9
+ delete: "&#xe604;",
10
+ addFill: "&#xe606;",
11
+ };
12
+
13
+ type IconName = keyof typeof IconMap;
14
+
15
+ const props = defineProps<{
16
+ name: IconName;
17
+ }>();
18
+
19
+ let value = IconMap[props.name] || "&#xe604;";
20
+ value = value.replace("&#x", "%u").replace(";", "");
21
+ value = unescape(value);
22
+ const icon = ref(value);
23
+
24
+ watch(
25
+ () => props.name,
26
+ (val) => {
27
+ let iconStr = IconMap[val];
28
+ iconStr = iconStr.replace("&#x", "%u").replace(";", "");
29
+ iconStr = iconStr.replace("&#x", "%u").replace(";", "");
30
+ iconStr = unescape(iconStr);
31
+ icon.value = iconStr;
32
+ },
33
+ );
34
+ </script>
35
+
36
+ <style lang="scss">
37
+ @font-face {
38
+ font-family: "iconfont";
39
+ /* #ifdef H5 */
40
+ src: url("/h5/static/iconfont.woff2") format("woff2");
41
+ /* #endif */
42
+ /* #ifdef MP-WEIXIN */
43
+ //src: url('//at.alicdn.com/t/c/font_2942740_av9lw25yela.woff2?t=1707276070685') format('woff2');
44
+ src: url("/static/iconfont.woff2") format("woff2");
45
+
46
+ /* #endif */
47
+ /* #ifdef APP-PLUS */
48
+ src: url("/static/iconfont.woff2") format("woff2");
49
+ /* #endif */
50
+ }
51
+
52
+ /*!* 在线链接服务仅供平台体验和调试使用,平台不承诺服务的稳定性,企业客户需下载字体包自行发布使用并做好备份。 *!*/
53
+ /*@font-face {*/
54
+ /* font-family: 'iconfont'; !* Project id 2942740 *!*/
55
+ /* src: url('//at.alicdn.com/t/c/font_2942740_oa0mdid0yx.woff2?t=1694135753186') format('woff2');*/
56
+ /*}*/
57
+
58
+ .me-font {
59
+ font-family: iconfont;
60
+ text-align: center;
61
+ line-height: 1;
62
+ display: flex;
63
+ flex-direction: row;
64
+ justify-content: center;
65
+ align-items: center;
66
+ }
67
+ </style>
Binary file