@deveco-test/deveco-code 1.0.3 → 1.0.5

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 (62) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/package.json +6 -5
  3. package/resources/deveco/skills/customize-deveco/.deveco-builtin +1 -0
  4. package/resources/deveco/skills/customize-deveco/SKILL.md +469 -0
  5. package/resources/deveco/skills/deveco-cli/.deveco-builtin +1 -0
  6. package/resources/deveco/skills/deveco-cli/SKILL.md +240 -0
  7. package/resources/deveco/skills/hmos-arkui-develop-skill/.deveco-builtin +1 -0
  8. package/resources/deveco/skills/hmos-arkui-develop-skill/SKILL.md +83 -0
  9. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-apis/01-layout.md +629 -0
  10. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-apis/02-basic-components.md +645 -0
  11. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-apis/03-data-display.md +81 -0
  12. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-apis/04-selectors.md +76 -0
  13. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-apis/05-media.md +60 -0
  14. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-apis/06-advanced.md +32 -0
  15. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-apis/07-security.md +30 -0
  16. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-apis/08-state-decorators.md +79 -0
  17. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-apis/09-animation.md +111 -0
  18. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-apis/10-gesture.md +59 -0
  19. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-apis/11-dialog-menu.md +92 -0
  20. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-apis/12-navigation.md +81 -0
  21. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-apis/13-rendering.md +22 -0
  22. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-apis/14-extension.md +22 -0
  23. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-apis/15-theme-style.md +10 -0
  24. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-apis/16-enums.md +87 -0
  25. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-apis/17-resources.md +1379 -0
  26. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-apis/18-error-code.md +24 -0
  27. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-apis/_index.md +75 -0
  28. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-rules/00-arkts-syntax.md +229 -0
  29. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-rules/01-import.md +116 -0
  30. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-rules/02-uicontext.md +56 -0
  31. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-rules/03-component.md +105 -0
  32. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-rules/04-build.md +41 -0
  33. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-rules/05-state.md +300 -0
  34. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-rules/06-rendering.md +67 -0
  35. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-rules/07-attribute-params.md +219 -0
  36. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-rules/08-navigation.md +102 -0
  37. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-rules/09-dialog.md +72 -0
  38. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-rules/10-style.md +90 -0
  39. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-rules/11-extension.md +54 -0
  40. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-rules/12-layout.md +69 -0
  41. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-rules/13-performance.md +27 -0
  42. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-rules/14-deprecated.md +28 -0
  43. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-rules/_index.md +79 -0
  44. package/resources/deveco/skills/hmos-runtime-fix-skill/.deveco-builtin +1 -0
  45. package/resources/deveco/skills/hmos-runtime-fix-skill/SKILL.md +187 -0
  46. package/resources/deveco/skills/hmos-runtime-fix-skill/SKILL_CN.md +160 -0
  47. package/resources/deveco/skills/hmos-runtime-fix-skill/evals/evals.json +17 -0
  48. package/resources/deveco/skills/hmos-runtime-fix-skill/reference/businesserror_patterns.md +17 -0
  49. package/resources/deveco/skills/hmos-runtime-fix-skill/reference/error_patterns.md +31 -0
  50. package/resources/deveco/skills/hmos-runtime-fix-skill/reference/fault-mode-library.md +57 -0
  51. package/resources/deveco/skills/hmos-runtime-fix-skill/reference/outofmemoryerror_patterns.md +19 -0
  52. package/resources/deveco/skills/hmos-runtime-fix-skill/reference/rangeerror_patterns.md +15 -0
  53. package/resources/deveco/skills/hmos-runtime-fix-skill/reference/referenceerror_patterns.md +23 -0
  54. package/resources/deveco/skills/hmos-runtime-fix-skill/reference/syntaxerror_patterns.md +14 -0
  55. package/resources/deveco/skills/hmos-runtime-fix-skill/reference/typeerror_patterns.md +19 -0
  56. package/resources/deveco/skills/hmos-runtime-fix-skill/reference/urierror_patterns.md +17 -0
  57. package/resources/deveco/skills/hmos-runtime-fix-skill/scripts/collect-hilog.mjs +120 -0
  58. package/resources/deveco/skills/hmos-runtime-fix-skill/scripts/jscrash-report.mjs +138 -0
  59. package/resources/deveco/skills/hmos-runtime-fix-skill/scripts/parse-jscrash-log.mjs +126 -0
  60. package/resources/deveco/skills/hmos-runtime-fix-skill/scripts/shared/deveco-cli.mjs +79 -0
  61. package/resources/deveco/skills/hmos-runtime-fix-skill/scripts/shared/jscrash-parse.mjs +389 -0
  62. package/resources/deveco/skills/hmos-runtime-fix-skill/scripts/shared/utils.mjs +27 -0
@@ -0,0 +1,81 @@
1
+ ## 12. 导航与路由
2
+
3
+
4
+ > **组件索引**:`Navigation`、`NavPathStack 操作`、`NavDestination`、`Router`
5
+
6
+ ### Navigation
7
+
8
+ **构造:** `Navigation()`
9
+
10
+ **属性方法:**
11
+
12
+ | 方法 | 签名 | 默认值 | 说明 |
13
+ |------|------|--------|------|
14
+ | .navDestination | `.navDestination(builder: (name: string, param: unknown) => void)` | — | 路由目标映射 |
15
+ | .title | `.title(value: ResourceStr \| CustomBuilder \| NavigationCommonTitle \| NavigationCustomTitle, options?: NavigationTitleOptions)` | — | 标题 |
16
+ | .subTitle | `.subTitle(value: string)` | — | 副标题(API 8,已废弃,用 .title 替代) |
17
+ | .mode | `.mode(NavigationMode)` | Auto | Stack/Split/Auto |
18
+ | .hideNavBar | `.hideNavBar(value: boolean)` | false | 隐藏导航页(标题栏+内容区+工具栏)。栈中有 NavDestination 则显示栈顶页面,反之显示空白;API 11+ 单栏/双栏/自适应模式均生效,会失去自适应分栏能力;全屏需求改用 NavDestination 的 `.fullScreenOverlay(true)`,只藏标题用 `.hideTitleBar(true)` |
19
+ | .hideTitleBar | `.hideTitleBar(value: boolean)` | false | 隐藏标题栏 |
20
+ | .hideToolBar | `.hideToolBar(value: boolean)` | false | 隐藏工具栏 |
21
+ | .toolBar | `.toolBar(value: object \| CustomBuilder)` | — | 工具栏(旧接口) |
22
+ | .toolbarConfiguration | `.toolbarConfiguration(value: Array\<ToolbarItem\> \| CustomBuilder, options?)` | — | 工具栏(API 10+) |
23
+ | .navBarWidth | `.navBarWidth(value: Length)` | 240vp | 导航栏宽度(仅 Split 模式) |
24
+ | .navBarPosition | `.navBarPosition(value: NavBarPosition)` | Start | 导航栏位置 |
25
+
26
+ ### NavPathStack 操作
27
+
28
+ | 方法 | 签名 | 说明 |
29
+ |------|------|------|
30
+ | pushPath | `pushPath(info: NavPathInfo, animated?: boolean)` | 压入页面(无错误码返回) |
31
+ | pushPathByName | `pushPathByName(name: string, param: unknown, animated?: boolean)` | 按名称压入(无错误码返回) |
32
+ | pushDestination | `pushDestination(info: NavPathInfo, options?: NavigationOptions): Promise<void>` | 压入页面,错误经 Promise reject 错误码返回(**推荐**) |
33
+ | pushDestinationByName | `pushDestinationByName(name: string, param: unknown, options?: NavigationOptions): Promise<void>` | 按名称压入,错误经 reject 返回(**推荐**) |
34
+ | pop | `pop(animated?: boolean): NavPathInfo \| undefined` | 弹出,返回 NavPathInfo |
35
+ | pop | `pop(result: Object, animated?: boolean): NavPathInfo \| undefined` | 弹出并回传结果 |
36
+ | replacePath | `replacePath(info: NavPathInfo, animated?: boolean)` | 替换 |
37
+ | clear | `clear(animated?: boolean)` | 清空 |
38
+ | size | `size(): number` | 栈大小(方法,非属性) |
39
+ | getParent | `getParent(): NavPathStack \| null` | 获取父栈,无父返回 null |
40
+
41
+ ### NavDestination
42
+
43
+ **构造:** `NavDestination()`
44
+
45
+ **属性方法:**
46
+
47
+ | 方法 | 签名 | 默认值 | 说明 |
48
+ |------|------|--------|------|
49
+ | .title | `.title(value: string \| CustomBuilder \| NavDestinationCommonTitle \| NavDestinationCustomTitle \| Resource, options?)` | — | 标题 |
50
+ | .hideTitleBar | `.hideTitleBar(boolean)` | false | 隐藏标题栏 |
51
+ | .hideBackButton | `.hideBackButton(boolean)` | false | 隐藏返回键 |
52
+ | .backgroundColor | `.backgroundColor(ResourceColor)` | — | 背景色 |
53
+
54
+ **事件:** `.onReady((context: NavDestinationContext) => void)` `.onWillShow()` `.onShown()` `.onHidden()` `.onWillHide()` `.onBackPressed()`
55
+
56
+ ### Router
57
+
58
+ | 方法 | 签名 | 说明 |
59
+ |------|------|------|
60
+ | pushUrl | `router.pushUrl({url, params?})` | 压入页面 |
61
+ | replaceUrl | `router.replaceUrl({url, params?})` | 替换当前页 |
62
+ | back | `router.back(url?)` | 返回 |
63
+ | clear | `router.clear()` | 清空栈 |
64
+ | getLength | `router.getLength(): number` | 栈大小 |
65
+ | getState | `router.getState(): RouterState` | 当前状态 |
66
+
67
+ ---
68
+ ### 典型用法
69
+
70
+ #### 获取导航栈 NavPathStack 的方式
71
+
72
+ | 方式 | 写法 | 说明 |
73
+ |------|------|------|
74
+ | `queryNavigationInfo`(12+,推荐) | `let info = this.queryNavigationInfo(); if (info !== undefined) { this.pathStack = info.pathStack }` | 自定义组件方法,任意时机可取、不依赖 NavDestination 生命周期 |
75
+ | `onReady`(推荐) | `NavDestination().onReady((ctx: NavDestinationContext) => { this.navPathStack = ctx.pathStack; const p = ctx.pathInfo.param as DetailParams })` | NavDestination 生命周期回调,取栈同时可取本页参数 |
76
+ | AppStorage 全局共享 | 宿主 `AppStorage.setOrCreate` / 页面 `AppStorage.get` | 不推荐 |
77
+ | `@Provide`/`@Consume` | 跨层级传递 | 不推荐 |
78
+
79
+ #### 全局路由状态监听
80
+
81
+ `uiObserver.on('navDestinationUpdate', (info: NavDestinationInfo) => ...)` 监听 NavDestination 显示/隐藏状态变化(经 `this.getUIContext().getUIObserver()` 获取 observer,见 @ohos.arkui.observer)。
@@ -0,0 +1,22 @@
1
+ ## 13. 渲染控制
2
+
3
+ | 语法 | 签名 | 说明 |
4
+ |------|------|------|
5
+ | **if/else** | `if (condition) {} else if {} else {}` | 条件渲染 |
6
+ | **ForEach** | `ForEach(arr, (item, index?) => void, keyGen?)` | 迭代渲染 |
7
+ | **LazyForEach** | `LazyForEach(dataSource, (item, index?) => void, keyGen?)` | 懒加载迭代 |
8
+ | **Repeat** | `Repeat\<T\>(arr)` | API 12+ V2 版渲染控制 |
9
+
10
+ **Repeat 方法链:**
11
+
12
+ | 方法 | 签名 | 说明 |
13
+ |------|------|------|
14
+ | .each | `.each((ri: RepeatItem\<T\>) => void)` | 渲染每项 |
15
+ | .key | `.key((item, index) => string)` | 生成 key |
16
+ | .virtualScroll | `.virtualScroll(options?)` | 虚拟滚动 |
17
+ | .template | `.template(name, itemGen, options?)` | 模板化 |
18
+ | .cachedCount | `.cachedCount(value: number)` | 缓存数 |
19
+ | .totalCount | `.totalCount(value: number)` | 总数 |
20
+ | .onRequestItem | `.onRequestItem((index, key) => void)` | 请求数据 |
21
+
22
+ ---
@@ -0,0 +1,22 @@
1
+ ## 14. 自定义扩展
2
+
3
+ ### Modifier 系列
4
+
5
+ | Modifier | 签名 | 说明 |
6
+ |----------|------|------|
7
+ | **AttributeModifier** | `class M implements AttributeModifier { applyNormalAttribute(instance) }` | 动态属性修改 |
8
+ | **AttributeUpdater** | `class M extends AttributeUpdater { ... }` | 高性能属性更新 |
9
+ | **DrawModifier** | `class M implements DrawModifier { drawBehind?() drawContentBelow?() drawAbove?() }` | 自定义绘制 |
10
+ | **GestureModifier** | `class M implements GestureModifier { applyGestureType() setGestureEnabled() }` | 动态手势 |
11
+ | **ContentModifier** | `class M implements ContentModifier { applyContent(column) }` | 自定义内容 |
12
+
13
+ ### 自定义节点
14
+
15
+ | 节点 | 签名 | 说明 |
16
+ |------|------|------|
17
+ | **FrameNode** | `FrameNode(uiContext)` | 帧节点 |
18
+ | **RenderNode** | `new RenderNode()` | `.draw()` `.setBackgroundColor()` `.setOpacity()` `.setPosition()` `.setSize()` `.appendChild()` `.removeChild()` |
19
+ | **BuilderNode** | `new BuilderNode(uiContext, options?)` | `.build(builder, args?)` |
20
+ | **NodeController** | `class M extends NodeController { makeNode(uiContext) }` | 与 NodeContainer 配合 |
21
+
22
+ ---
@@ -0,0 +1,10 @@
1
+ ## 15. 主题与样式
2
+
3
+ | API | 签名 | 说明 |
4
+ |-----|------|------|
5
+ | **WithTheme** | `WithTheme({theme}) { ... }` | 为子树绑定主题 |
6
+ | **@Styles** | `@Styles function name() { .width(100).height(100) }` | 通用样式提取 |
7
+ | **@Extend** | `@Extend(Component) function name(params) { ... }` | 组件扩展方法 |
8
+ | **@StateStyles** | `@StateStyles({ normal:{}, pressed:{}, disabled:{}, focused:{}, selected:{} })` | 多态样式 |
9
+
10
+ ---
@@ -0,0 +1,87 @@
1
+ ## 16. 枚举类型速查
2
+
3
+
4
+ > **组件索引**:`布局`、`组件`、`手势`、`动画`、`效果`
5
+
6
+ ### 布局
7
+
8
+ | 枚举 | 值 | API |
9
+ |------|----|----|
10
+ | Alignment | TopStart(0), Top(1), TopEnd(2), Start(3), Center(4), End(5), BottomStart(6), Bottom(7), BottomEnd(8) | 7 |
11
+ | FlexAlign | Start, Center, End, SpaceBetween, SpaceAround, SpaceEvenly | 7 |
12
+ | FlexDirection | Row, RowReverse, Column, ColumnReverse | 7 |
13
+ | FlexWrap | NoWrap, Wrap, WrapReverse | 7 |
14
+ | ItemAlign | Auto, Start, Center, End, Stretch, Baseline | 7 |
15
+ | VerticalAlign | Top, Center, Bottom | 7 |
16
+ | HorizontalAlign | Start, Center, End | 7 |
17
+ | Axis | Vertical(0), Horizontal(1) | 7 |
18
+ | Direction | Ltr(0), Rtl(1), Auto(2) | 7 |
19
+ | ScrollDirection | Vertical(0), Horizontal(1), None(3), FREE(4) | 7 |
20
+ | EdgeEffect | Spring(0), Fade(1), None(2) | 7 |
21
+ | BarState | Off(0), Auto(1), On(2) | 7 |
22
+
23
+ ### 组件
24
+
25
+ | 枚举 | 值 | API |
26
+ |------|----|----|
27
+ | ButtonType | Capsule, Circle, Normal, ROUNDED_RECTANGLE(3) | 7/15 |
28
+ | ImageFit | Contain(0), Cover(1), Auto(2), Fill(3), ScaleDown(4), None(5) | 7 |
29
+ | **ImageRenderMode** | **Original, Template** | 7 |
30
+ | InputType | Normal, Number, PhoneNumber, Email, Password, NUMBER_PASSWORD(8), USER_NAME(10), NEW_PASSWORD(11), NUMBER_DECIMAL(12), URL(13) | 7 |
31
+ | SliderStyle | OutSet(0), InSet(1) | 7 |
32
+ | ToggleType | Checkbox(0), Switch(1), Button(2) | 7 |
33
+ | ProgressType | Linear(0), Ring(1), Eclipse(2), ScaleRing(3), Capsule(4) | 7 |
34
+ | **DataPanelType** | **Circle(0), Line(1)** | 7 |
35
+ | TextAlign | Start(0), Center(1), End(2), Justify(3) | 7 |
36
+ | TextOverflow | None(0), Clip(1), Ellipsis(2), Marquee(3) | 7 |
37
+ | FontWeight | Lighter(0), Normal(1), Regular(2), Medium(3), Bold(4), Bolder(5) | 7 |
38
+ | FontStyle | Normal(0), Italic(1) | 7 |
39
+ | TextDecorationType | None(0), Underline(1), Overline(2), LineThrough(3) | 7 |
40
+ | LineCapStyle | Butt(0), Round(1), Square(2) | 7 |
41
+ | Visibility | Visible(0), Hidden(1), None(2) | 7 |
42
+ | CopyOptions | None(0), InApp(1), LocalDevice(2), CrossDevice(3) | 9 |
43
+ | EnterKeyType | Go(2), Search(3), Send(4), Next(5), Done(6), PREVIOUS(7), NEW_LINE(8) | 7 |
44
+ | PanelType | Minibar(0), Foldable(1), Temporary(2) | 7 |
45
+ | BarMode | Scrollable(0), Fixed(1) | 7 |
46
+ | BarPosition | Start(0), End(1) | 7 |
47
+ | NavigationMode | Stack(0), Split(1), Auto(2) | 9 |
48
+ | EllipsisMode | HEAD(0), CENTER(1), TAIL(2) | 11 |
49
+ | WordBreak | NORMAL(0), BREAK_ALL(1), BREAK_WORD(2) | 11 |
50
+
51
+ > **枚举名易错提示:**
52
+ > - 属性名是 `.renderMode()`,枚举是 `ImageRenderMode`(不是 ImageRenderingMode)
53
+ > - DataPanelType 是 `Circle/Line`(不是 Close/Ring)
54
+ > - `Sticky.Normal`(不是 StickyStyle.Normal,StickyStyle 枚举不存在)
55
+ > - `TextInputStyle` 无 `Normal` 值,不要使用 `.style(TextInputStyle.Normal)`
56
+ > - `GradientDirection` 无 `BottomRight`,可用:Top, Bottom, Left, Right, TopLeft, TopRight, BottomLeft
57
+
58
+ ### 手势
59
+
60
+ | 枚举 | 值 | API |
61
+ |------|----|----|
62
+ | GestureMode | Sequence, Parallel, Exclusive | 7 |
63
+ | PanDirection | All(15), Horizontal(3), Vertical(12), Left(1), Right(2), Up(4), Down(8) | 7 |
64
+ | SwipeDirection | All(15), Horizontal(3), Vertical(12) | 7 |
65
+ | TouchType | Down(0), Up(1), Move(2), Cancel(3) | 7 |
66
+
67
+ ### 动画
68
+
69
+ | 枚举 | 值 | API |
70
+ |------|----|----|
71
+ | AnimationStatus | Initial(0), Running(1), Paused(2), Stopped(3) | 7 |
72
+ | PlayMode | Normal(0), Reverse(1), Alternate(2), AlternateReverse(3) | 7 |
73
+ | FillMode | None(0), Forwards(1), Backwards(2), Both(3) | 7 |
74
+ | Curve | Linear, Ease, EaseIn, EaseOut, EaseInOut, FastOutSlowIn, LinearOutSlowIn, FastOutLinearIn, ExtremeDeceleration, Sharp, Rhythm, Smooth, Friction | 7 |
75
+
76
+ ### 效果
77
+
78
+ | 枚举 | 值 | API |
79
+ |------|----|----|
80
+ | BlurStyle | Thin, Regular, Thick, BackgroundThin, BackgroundRegular, BackgroundThick | 9 |
81
+ | ImageRepeat | NoRepeat(0), X(1), Y(2), XY(3) | 7 |
82
+ | HoverEffect | Auto, Scale, Highlight, None | 8 |
83
+ | HitTestMode | Default(0), Block(1), Transparent(2), None(3) | 9 |
84
+ | RenderFit | TOP_LEFT, TOP, TOP_RIGHT, LEFT, CENTER, RIGHT, BOTTOM_LEFT, BOTTOM, BOTTOM_RIGHT | 10 |
85
+ | BorderStyle | Dotted(0), Dashed(1), Solid(2) | 7 |
86
+ | SafeAreaType | SYSTEM, CUTOUT, KEYBOARD | 10 |
87
+ | KeyboardAvoidMode | OFFSET, RESIZE, RESIZE_ONLY | 11 |