android2harmony 0.1.2 → 0.1.4

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.
Files changed (47) hide show
  1. package/agents/self-tester.md +376 -0
  2. package/dist/index.js +152 -7
  3. package/dist/index.js.map +4 -4
  4. package/package.json +32 -29
  5. package/skills/hmos-incremental-ui-align/README.md +251 -0
  6. package/skills/hmos-incremental-ui-align/SKILL.md +365 -0
  7. package/skills/hmos-incremental-ui-align/diff_analysis.md +53 -0
  8. package/skills/hmos-incremental-ui-align/page_align.md +62 -0
  9. package/skills/hmos-incremental-ui-align/references/Comparison_Template.md +38 -0
  10. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Link/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/217/214/345/220/221/345/220/214/346/255/245.md +648 -0
  11. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Observed/350/243/205/351/245/260/345/231/250/345/222/214@ObjectLink/350/243/205/351/245/260/345/231/250/357/274/232/345/265/214/345/245/227/347/261/273/345/257/271/350/261/241/345/261/236/346/200/247/345/217/230/345/214/226.md +2089 -0
  12. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Prop/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/215/225/345/220/221/345/220/214/346/255/245.md +1033 -0
  13. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Provide/350/243/205/351/245/260/345/231/250/345/222/214@Consume/350/243/205/351/245/260/345/231/250/357/274/232/344/270/216/345/220/216/344/273/243/347/273/204/344/273/266/345/217/214/345/220/221/345/220/214/346/255/245.md +1183 -0
  14. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@State/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/206/205/347/212/266/346/200/201.md +576 -0
  15. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Track/350/243/205/351/245/260/345/231/250/357/274/232class/345/257/271/350/261/241/345/261/236/346/200/247/347/272/247/346/233/264/346/226/260.md +297 -0
  16. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Watch/350/243/205/351/245/260/345/231/250/357/274/232/347/212/266/346/200/201/345/217/230/351/207/217/346/233/264/346/224/271/351/200/232/347/237/245.md +395 -0
  17. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/AppStorage/357/274/232/345/272/224/347/224/250/345/205/250/345/261/200/347/232/204UI/347/212/266/346/200/201/345/255/230/345/202/250.md +903 -0
  18. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/Environment/357/274/232/350/256/276/345/244/207/347/216/257/345/242/203/346/237/245/350/257/242.md +106 -0
  19. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/LocalStorage/357/274/232/351/241/265/351/235/242/347/272/247UI/347/212/266/346/200/201/345/255/230/345/202/250.md +1178 -0
  20. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/MVVM/346/250/241/345/274/217V1.md +911 -0
  21. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/PersistentStorage/357/274/232/346/214/201/344/271/205/345/214/226/345/255/230/345/202/250UI/347/212/266/346/200/201.md +355 -0
  22. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243//347/256/241/347/220/206/345/272/224/347/224/250/346/213/245/346/234/211/347/232/204/347/212/266/346/200/201/346/246/202/350/277/260.md +11 -0
  23. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/!!/350/257/255/346/263/225/357/274/232/345/217/214/345/220/221/347/273/221/345/256/232.md +206 -0
  24. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Computed/350/243/205/351/245/260/345/231/250/357/274/232/350/256/241/347/256/227/345/261/236/346/200/247.md +373 -0
  25. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Event/350/243/205/351/245/260/345/231/250/357/274/232/350/247/204/350/214/203/347/273/204/344/273/266/350/276/223/345/207/272.md +158 -0
  26. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Local/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/206/205/351/203/250/347/212/266/346/200/201.md +750 -0
  27. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Monitor/350/243/205/351/245/260/345/231/250/357/274/232/347/212/266/346/200/201/345/217/230/351/207/217/344/277/256/346/224/271/345/274/202/346/255/245/347/233/221/345/220/254.md +1704 -0
  28. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@ObservedV2/350/243/205/351/245/260/345/231/250/345/222/214@Trace/350/243/205/351/245/260/345/231/250/357/274/232/347/261/273/345/261/236/346/200/247/345/217/230/345/214/226/350/247/202/346/265/213.md +1012 -0
  29. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Once/350/243/205/351/245/260/345/231/250/357/274/232/345/210/235/345/247/213/345/214/226/345/220/214/346/255/245/344/270/200/346/254/241.md +164 -0
  30. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Param/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/244/226/351/203/250/350/276/223/345/205/245.md +840 -0
  31. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Provider/350/243/205/351/245/260/345/231/250/345/222/214@Consumer/350/243/205/351/245/260/345/231/250/357/274/232/350/267/250/347/273/204/344/273/266/345/261/202/347/272/247/345/217/214/345/220/221/345/220/214/346/255/245.md +856 -0
  32. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Type/350/243/205/351/245/260/345/231/250/357/274/232/346/240/207/350/256/260/347/261/273/345/261/236/346/200/247/347/232/204/347/261/273/345/236/213.md +83 -0
  33. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/AppStorageV2/357/274/232/345/272/224/347/224/250/345/205/250/345/261/200UI/347/212/266/346/200/201/345/255/230/345/202/250.md +294 -0
  34. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/MVVM/346/250/241/345/274/217/357/274/210V2/357/274/211.md +1407 -0
  35. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/PersistenceV2/357/274/232/346/214/201/344/271/205/345/214/226/345/255/230/345/202/250UI/347/212/266/346/200/201.md +1220 -0
  36. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/_/350/214/203/345/274/217/351/200/211/346/213/251/350/257/264/346/230/216.md +47 -0
  37. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2//347/212/266/346/200/201/347/256/241/347/220/206V1/345/220/221V2/350/277/201/347/247/273/344/270/216/346/267/267/347/224/250/346/214/207/345/257/274.md +840 -0
  38. package/skills/hmos-incremental-ui-align/references/State_Model_Template.md +74 -0
  39. package/skills/hmos-incremental-ui-align/references/UI_Analysis_Template.md +34 -0
  40. package/skills/hmos-incremental-ui-align/references/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +2533 -0
  41. package/skills/hmos-incremental-ui-align/references/android-to-harmonyOS-ui-interaction-mapping-reference.md +555 -0
  42. package/skills/hmos-incremental-ui-align/references/android-to-harmonyOS-ui-layout-mapping-reference.md +117 -0
  43. package/skills/hmos-incremental-ui-align/scripts/app_feature_verify.ts +999 -0
  44. package/skills/hmos-incremental-ui-align/scripts/extract_checklist.ts +343 -0
  45. package/skills/hmos-incremental-ui-align/scripts/navigation-capure.md +76 -0
  46. package/skills/hmos-incremental-ui-align/scripts/page_capture.ts +977 -0
  47. package/skills/hmos-incremental-ui-align/scripts/page_capture_burst.ts +188 -0
@@ -0,0 +1,164 @@
1
+ 想要实现仅从外部初始化一次且不接受后续同步变化的能力,可以使用@Once装饰器搭配@Param装饰器。
2
+
3
+ 阅读本文档前,请先阅读[@Param](../@Param:组件外部输入/arkts-new-param.md)。
4
+
5
+ 说明
6
+
7
+ 从API version 12开始,在@ComponentV2装饰的自定义组件中支持使用@Once装饰器。
8
+
9
+ 从API version 12开始,该装饰器支持在元服务中使用。
10
+
11
+ 从API version 23开始,该装饰器支持在ArkTS卡片中使用。
12
+
13
+ ## 概述
14
+
15
+ @Once装饰器在变量初始化时接受外部传入值进行初始化,后续数据源更改不会同步给子组件:
16
+
17
+ * @Once必须搭配@Param使用,单独使用或搭配其他装饰器使用都是不允许的。
18
+ * @Once不影响@Param的观测能力,仅针对数据源的变化做拦截。
19
+ * @Once与@Param装饰变量的先后顺序不影响使用功能。
20
+ * @Once与@Param搭配使用时,可以在本地修改@Param变量的值。
21
+
22
+ ## 装饰器使用规则说明
23
+
24
+ @Once装饰器作为辅助装饰器,本身没有装饰类型要求和变量观察能力。
25
+
26
+ | @Once变量装饰器 | 说明 |
27
+ | --- | --- |
28
+ | 装饰器参数 | 无。 |
29
+ | 使用条件 | 无法单独使用,必须配合@Param装饰器使用。 |
30
+
31
+ ## 限制条件
32
+
33
+ * @Once仅在[@ComponentV2](../../../../学习UI范式基本语法/自定义组件/创建自定义组件/arkts-create-custom-components.md#componentv2)装饰的自定义组件中与@Param搭配使用。
34
+
35
+ ```
36
+ 1. @ComponentV2
37
+ 2. struct MyComponent {
38
+ 3. @Param @Once onceParam: string = 'onceParam'; // 正确用法
39
+ 4. @Once onceStr: string = 'Once'; // 错误用法,@Once无法单独使用
40
+ 5. @Local @Once onceLocal: string = 'onceLocal'; // 错误用法,@Once不能与@Local一起使用
41
+ 6. // ···
42
+ 7. }
43
+ 8. @Component
44
+ 9. struct Index {
45
+ 10. @Once @Param onceParam: string = 'onceParam'; // 错误用法
46
+ 11. }
47
+ ```
48
+
49
+ [MyComponent.ets](https://gitcode.com/HarmonyOS_Samples/guide-snippets/blob/HarmonyOS-feature-20260402/ArkUISample/ArktsNewOnce/entry/src/main/ets/pages/MyComponent.ets#L29-L57)
50
+ * @Once与@Param的先后顺序无关,可以写成@Param @Once也可以写成@Once @Param。
51
+
52
+ ```
53
+ 1. @ComponentV2
54
+ 2. struct MyComponent {
55
+ 3. // ···
56
+ 4. @Param @Once param1: number = 0;
57
+ 5. @Once @Param param2: number = 0;
58
+ 6. // ···
59
+ 7. }
60
+ ```
61
+
62
+ [MyComponent.ets](https://gitcode.com/HarmonyOS_Samples/guide-snippets/blob/HarmonyOS-feature-20260402/ArkUISample/ArktsNewOnce/entry/src/main/ets/pages/MyComponent.ets#L30-L58)
63
+
64
+ ## 使用场景
65
+
66
+ ### 变量仅初始化同步一次
67
+
68
+ @Once用于期望变量仅初始化同步数据源一次,之后不再继续同步变化的场景。
69
+
70
+ ```
71
+ 1. @ComponentV2
72
+ 2. struct ChildComponent {
73
+ 3. // @Once装饰的onceParam仅初始化同步一次
74
+ 4. @Param @Once onceParam: string = '';
75
+
76
+ 6. build() {
77
+ 7. Column() {
78
+ 8. Text(`onceParam: ${this.onceParam}`)
79
+ 9. }
80
+ 10. }
81
+ 11. }
82
+
83
+ 13. @Entry
84
+ 14. @ComponentV2
85
+ 15. struct MyComponent {
86
+ 16. // ...
87
+ 17. @Local message: string = 'Hello World';
88
+
89
+ 19. build() {
90
+ 20. Column() {
91
+ 21. Text(`Parent message: ${this.message}`)
92
+ 22. Button('change message')
93
+ 23. .onClick(() => {
94
+ 24. this.message = 'Hello Tomorrow';
95
+ 25. })
96
+ 26. ChildComponent({ onceParam: this.message })
97
+ 27. }
98
+ 28. }
99
+ 29. }
100
+ ```
101
+
102
+ [MyComponent.ets](https://gitcode.com/HarmonyOS_Samples/guide-snippets/blob/HarmonyOS-feature-20260402/ArkUISample/ArktsNewOnce/entry/src/main/ets/pages/MyComponent.ets#L16-L59)
103
+
104
+ ### 本地修改@Param变量
105
+
106
+ 当@Once与@Param结合使用时,可以解除@Param无法在本地修改的限制,并能够触发UI刷新。此时,使用@Param和@Once的效果类似于[@Local](../@Local装饰器:组件内部状态/arkts-new-local.md),但@Param和@Once还能接收外部传入的初始值。
107
+
108
+ ```
109
+ 1. @ObservedV2
110
+ 2. class Info {
111
+ 3. @Trace name: string;
112
+ 4. constructor(name: string) {
113
+ 5. this.name = name;
114
+ 6. }
115
+ 7. }
116
+ 8. @ComponentV2
117
+ 9. struct Child {
118
+ 10. // @Once与@Param结合使用时,可以在本地修改,并能够触发UI刷新
119
+ 11. @Param @Once onceParamNum: number = 0;
120
+ 12. @Param @Once @Require onceParamInfo: Info;
121
+
122
+ 14. build() {
123
+ 15. Column() {
124
+ 16. Text(`Child onceParamNum: ${this.onceParamNum}`)
125
+ 17. Text(`Child onceParamInfo: ${this.onceParamInfo.name}`)
126
+ 18. Button('changeOnceParamNum')
127
+ 19. .onClick(() => {
128
+ 20. this.onceParamNum++;
129
+ 21. })
130
+ 22. Button('changeParamInfo')
131
+ 23. .onClick(() => {
132
+ 24. this.onceParamInfo = new Info('Cindy');
133
+ 25. })
134
+ 26. }
135
+ 27. }
136
+ 28. }
137
+ 29. @Entry
138
+ 30. @ComponentV2
139
+ 31. struct Index {
140
+ 32. @Local localNum: number = 10;
141
+ 33. @Local localInfo: Info = new Info('Tom');
142
+
143
+ 35. build() {
144
+ 36. Column() {
145
+ 37. Text(`Parent localNum: ${this.localNum}`)
146
+ 38. Text(`Parent localInfo: ${this.localInfo.name}`)
147
+ 39. Button('changeLocalNum')
148
+ 40. .onClick(() => {
149
+ 41. this.localNum++;
150
+ 42. })
151
+ 43. Button('changeLocalInfo')
152
+ 44. .onClick(() => {
153
+ 45. this.localInfo = new Info('Cindy');
154
+ 46. })
155
+ 47. Child({
156
+ 48. onceParamNum: this.localNum,
157
+ 49. onceParamInfo: this.localInfo
158
+ 50. })
159
+ 51. }
160
+ 52. }
161
+ 53. }
162
+ ```
163
+
164
+ [Index.ets](https://gitcode.com/HarmonyOS_Samples/guide-snippets/blob/HarmonyOS-feature-20260402/ArkUISample/ArktsNewOnce/entry/src/main/ets/pages/Index.ets#L16-L69)