@quicktvui/ai 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.
- package/README.md +99 -19
- package/USAGE.md +74 -0
- package/package.json +1 -1
- package/postinstall.js +10 -2
- package/rules/.clinerules +7 -3
- package/rules/.cursorrules +9 -4
- package/rules/.docs/examples/css/pseudo-classes/v-pseudo.vue +57 -0
- package/rules/.docs/examples/guide/slot/lifecycle-hooks.vue +108 -0
- package/rules/.docs/examples/module/key/component-event.vue +36 -0
- package/rules/.docs/examples/module/key/es-back-hooks.vue +30 -0
- package/rules/.docs/examples/module/key/es-dispatch-hooks.vue +36 -0
- package/rules/.docs/examples/module/key/es-event-hooks.vue +31 -0
- package/rules/.docs/examples/module/page/es-app-lifecycle-hooks.vue +85 -0
- package/rules/.docs/examples/module/page/es-page-lifecycle-hooks.vue +78 -0
- package/rules/.docs/examples/module/page/es-page-state-hooks.vue +35 -0
- package/rules/.docs/zh-CN/component/button.md +3 -3
- package/rules/.docs/zh-CN/component/column.md +3 -0
- package/rules/.docs/zh-CN/component/html/installation.md +8 -2
- package/rules/.docs/zh-CN/component/html/video.md +1 -0
- package/rules/.docs/zh-CN/component/media-series.md +3 -3
- package/rules/.docs/zh-CN/component/overview.md +1 -3
- package/rules/.docs/zh-CN/component/poster.md +1 -1
- package/rules/.docs/zh-CN/component/row.md +2 -0
- package/rules/.docs/zh-CN/component/text.md +1 -1
- package/rules/.docs/zh-CN/component/waterfall_structure.md +266 -0
- package/rules/.docs/zh-CN/css/animation-transition/overview.md +23 -0
- package/rules/.docs/zh-CN/css/auto/overview.md +18 -0
- package/rules/.docs/zh-CN/css/cheat-sheet.md +19 -0
- package/rules/.docs/zh-CN/css/color/overview.md +20 -0
- package/rules/.docs/zh-CN/css/function/overview.md +27 -0
- package/rules/.docs/zh-CN/css/installation.md +53 -0
- package/rules/.docs/zh-CN/css/introduction.md +33 -0
- package/rules/.docs/zh-CN/css/layout/background.md +21 -0
- package/rules/.docs/zh-CN/css/layout/display.md +1 -2
- package/rules/.docs/zh-CN/css/layout-model/overview.md +21 -0
- package/rules/.docs/zh-CN/css/media/overview.md +27 -0
- package/rules/.docs/zh-CN/css/pseudo-classes/overview.md +79 -0
- package/rules/.docs/zh-CN/css/selector/overview.md +90 -0
- package/rules/.docs/zh-CN/css/size/overview.md +28 -0
- package/rules/.docs/zh-CN/css/specificity-inheritance/overview.md +21 -0
- package/rules/.docs/zh-CN/css/style/font-family.md +13 -4
- package/rules/.docs/zh-CN/css/transform/overview.md +23 -0
- package/rules/.docs/zh-CN/css/variable/overview.md +21 -0
- package/rules/.docs/zh-CN/guide/ai/ai-assistant.md +74 -0
- package/rules/.docs/zh-CN/guide/faq/layout-style-faq.md +3 -3
- package/rules/.docs/zh-CN/guide/key/back.md +31 -0
- package/rules/.docs/zh-CN/guide/key/dispatch-key-event.md +34 -1
- package/rules/.docs/zh-CN/guide/key/key-event.md +54 -6
- package/rules/.docs/zh-CN/guide/layout/adapter.md +0 -2
- package/rules/.docs/zh-CN/guide/layout/layout.md +2 -9
- package/rules/.docs/zh-CN/guide/layout/style.md +6 -33
- package/rules/.docs/zh-CN/guide/layout/theming.md +24 -139
- package/rules/.docs/zh-CN/guide/page/application-lifecycle.md +28 -4
- package/rules/.docs/zh-CN/guide/page/page-lifecycle.md +37 -9
- package/rules/.docs/zh-CN/guide/page/page-state.md +24 -1
- package/rules/.docs/zh-CN/guide/slot/lifecycle.md +27 -1
- package/rules/.github/copilot-instructions.md +6 -2
- package/rules/.windsurfrules +7 -3
- package/rules/AGENTS.md +7 -3
- package/rules/AI_HANDOFF.md +6 -6
- package/rules/CLAUDE.md +8 -4
- package/rules/GEMINI.md +9 -5
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div id="root">
|
|
3
|
+
<es-router-view />
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script lang="ts">
|
|
8
|
+
import { defineComponent } from "@vue/runtime-core";
|
|
9
|
+
import { ESLogLevel, useESLog } from "@extscreen/es3-core";
|
|
10
|
+
import {
|
|
11
|
+
onESCreate,
|
|
12
|
+
onESCreated,
|
|
13
|
+
onESDestroy,
|
|
14
|
+
onESNewIntent,
|
|
15
|
+
onESPause,
|
|
16
|
+
onESRestart,
|
|
17
|
+
onESRestoreInstanceState,
|
|
18
|
+
onESResume,
|
|
19
|
+
onESSaveInstanceState,
|
|
20
|
+
onESStart,
|
|
21
|
+
onESStop,
|
|
22
|
+
} from "@extscreen/es3-vue";
|
|
23
|
+
|
|
24
|
+
const TAG = "Application";
|
|
25
|
+
|
|
26
|
+
export default defineComponent({
|
|
27
|
+
name: "App",
|
|
28
|
+
emits: [],
|
|
29
|
+
setup() {
|
|
30
|
+
const log = useESLog();
|
|
31
|
+
|
|
32
|
+
onESCreate((app, params) => {
|
|
33
|
+
if (log.isLoggable(ESLogLevel.DEBUG)) {
|
|
34
|
+
log.d(TAG, "-------onESCreate------->>>>", app, params);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
onESCreated((success) => {
|
|
39
|
+
if (log.isLoggable(ESLogLevel.DEBUG)) {
|
|
40
|
+
log.d(TAG, "-------onESCreated------->>>>", success);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
onESStart(() => {
|
|
45
|
+
//
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
onESNewIntent((intent) => {
|
|
49
|
+
if (log.isLoggable(ESLogLevel.DEBUG)) {
|
|
50
|
+
log.d(TAG, "-------onESNewIntent------->>>>", intent);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
onESRestart(() => {
|
|
55
|
+
//
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
onESResume(() => {
|
|
59
|
+
//
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
onESPause(() => {
|
|
63
|
+
//
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
onESStop(() => {
|
|
67
|
+
//
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
onESDestroy(() => {
|
|
71
|
+
//
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
</script>
|
|
76
|
+
|
|
77
|
+
<style scoped>
|
|
78
|
+
#root {
|
|
79
|
+
width: 1920px;
|
|
80
|
+
height: 1080px;
|
|
81
|
+
flex: 1;
|
|
82
|
+
display: flex;
|
|
83
|
+
flex-direction: column;
|
|
84
|
+
}
|
|
85
|
+
</style>
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="es-sdk-root-css">
|
|
3
|
+
<s-title-view class="es-sdk-content-title-css" :text="$options.name" />
|
|
4
|
+
<div class="es-sdk-content-divider-css" />
|
|
5
|
+
<div class="es-sdk-content-row-css">
|
|
6
|
+
<s-text-view :text="textRef" />
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
<script>
|
|
11
|
+
import { defineComponent, ref } from "@vue/runtime-core";
|
|
12
|
+
import {
|
|
13
|
+
onESCreate,
|
|
14
|
+
onESDestroy,
|
|
15
|
+
onESNewIntent,
|
|
16
|
+
onESPause,
|
|
17
|
+
onESRestart,
|
|
18
|
+
onESRestoreInstanceState,
|
|
19
|
+
onESResume,
|
|
20
|
+
onESSaveInstanceState,
|
|
21
|
+
onESStart,
|
|
22
|
+
onESStop,
|
|
23
|
+
} from "@extscreen/es3-vue";
|
|
24
|
+
|
|
25
|
+
export default defineComponent({
|
|
26
|
+
name: "使用初探",
|
|
27
|
+
setup() {
|
|
28
|
+
const textRef = ref("");
|
|
29
|
+
|
|
30
|
+
onESCreate((params) => {
|
|
31
|
+
textRef.value =
|
|
32
|
+
`${textRef.value} --> ` + `onESCreate${JSON.stringify(params)}`;
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
onESStart(() => {
|
|
36
|
+
textRef.value = `${textRef.value} --> ` + `onESStart`;
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
onESNewIntent((intent) => {
|
|
40
|
+
textRef.value =
|
|
41
|
+
`${textRef.value} --> ` + `onESNewIntent${JSON.stringify(params)}`;
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
onESRestart(() => {
|
|
45
|
+
textRef.value = `${textRef.value} --> ` + `onESRestart`;
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
onESRestoreInstanceState((savedInstanceState) => {
|
|
49
|
+
textRef.value =
|
|
50
|
+
`${textRef.value} --> ` +
|
|
51
|
+
`onESRestoreInstanceState${JSON.stringify(params)}`;
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
onESResume(() => {
|
|
55
|
+
textRef.value = `${textRef.value} --> ` + `onESResume`;
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
onESPause(() => {
|
|
59
|
+
textRef.value = `${textRef.value} --> ` + `onESPause`;
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
onESStop(() => {
|
|
63
|
+
textRef.value = `${textRef.value} --> ` + `onESStop`;
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
onESSaveInstanceState((savedInstanceState) => {
|
|
67
|
+
textRef.value =
|
|
68
|
+
`${textRef.value} --> ` +
|
|
69
|
+
`onESSaveInstanceState${JSON.stringify(params)}`;
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
onESDestroy(() => {
|
|
73
|
+
textRef.value = `${textRef.value} --> ` + `onESDestroy`;
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
</script>
|
|
78
|
+
<style></style>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { defineComponent } from "@vue/runtime-core";
|
|
3
|
+
import { ESLogLevel, useESLog } from "@extscreen/es3-core";
|
|
4
|
+
import {
|
|
5
|
+
onESRestoreInstanceState,
|
|
6
|
+
onESSaveInstanceState,
|
|
7
|
+
} from "@extscreen/es3-vue";
|
|
8
|
+
|
|
9
|
+
export default defineComponent({
|
|
10
|
+
name: "Page状态管理",
|
|
11
|
+
setup() {
|
|
12
|
+
const log = useESLog();
|
|
13
|
+
|
|
14
|
+
onESRestoreInstanceState((savedInstanceState) => {
|
|
15
|
+
if (log.isLoggable(ESLogLevel.DEBUG)) {
|
|
16
|
+
log.d(
|
|
17
|
+
TAG,
|
|
18
|
+
"-------onESRestoreInstanceState------->>>>",
|
|
19
|
+
savedInstanceState,
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
onESSaveInstanceState((savedInstanceState) => {
|
|
25
|
+
if (log.isLoggable(ESLogLevel.DEBUG)) {
|
|
26
|
+
log.d(
|
|
27
|
+
TAG,
|
|
28
|
+
"-------onESSaveInstanceState------->>>>",
|
|
29
|
+
savedInstanceState,
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
</script>
|
|
@@ -100,9 +100,9 @@ component/button/custom-icon-style
|
|
|
100
100
|
| icon | 标准状态图标 | ^[string] | - |
|
|
101
101
|
| focusIcon | 焦点状态图标 | ^[string] | - |
|
|
102
102
|
| text | 按钮的文本 | ^[string] | - |
|
|
103
|
-
| gradientFocusBackground | 焦点状态背景颜色 |
|
|
104
|
-
| gradientSelectedBackground | 选中状态背景颜色 |
|
|
105
|
-
| gradientBackground | 标准背景颜色 |
|
|
103
|
+
| gradientFocusBackground | 焦点状态背景颜色 | [`QTGradient`](/zh-CN/css/color/gradient) | - |
|
|
104
|
+
| gradientSelectedBackground | 选中状态背景颜色 | [`QTGradient`](/zh-CN/css/color/gradient) | - |
|
|
105
|
+
| gradientBackground | 标准背景颜色 | [`QTGradient`](/zh-CN/css/color/gradient) | - |
|
|
106
106
|
| disabled | 是否显示可用样式 | ^[boolean] | false |
|
|
107
107
|
| round | 是否显示圆角样式 | ^[boolean] | false | | - |
|
|
108
108
|
|
|
@@ -18,18 +18,21 @@ lang: zh-CN
|
|
|
18
18
|
在`main.ts`中集成
|
|
19
19
|
|
|
20
20
|
```ts
|
|
21
|
+
|
|
21
22
|
//1.集成 ESPlayer
|
|
22
23
|
import { createESPlayer } from "@extscreen/es3-player";
|
|
23
24
|
|
|
24
25
|
//2.集成 ESVideoPlayer
|
|
25
26
|
import { createESVideoPlayer } from '@extscreen/es3-video-player'
|
|
26
|
-
|
|
27
27
|
//3.集成 ESSoundPoolPlayer
|
|
28
28
|
import { createESSoundPoolPlayer } from '@extscreen/es3-soundpool-player'
|
|
29
|
-
|
|
30
29
|
//4.集成 ESAudioPlayer
|
|
31
30
|
import { createESAudioPlayer } from '@extscreen/es3-audio-player'
|
|
32
31
|
|
|
32
|
+
//5.集成 QuickTVHtml
|
|
33
|
+
import QuickTVHtml from '@quicktvui/html-core'
|
|
34
|
+
import '@quicktvui/html-core/dist/index.css'
|
|
35
|
+
|
|
33
36
|
const player = createESPlayer();
|
|
34
37
|
app.use(player);
|
|
35
38
|
|
|
@@ -41,6 +44,9 @@ app.use(soundPlayer)
|
|
|
41
44
|
|
|
42
45
|
const audioPlayer = createESAudioPlayer()
|
|
43
46
|
app.use(audioPlayer)
|
|
47
|
+
|
|
48
|
+
app.use(QuickTVHtml)
|
|
49
|
+
|
|
44
50
|
```
|
|
45
51
|
|
|
46
52
|
### 第三步、初始化
|
|
@@ -35,5 +35,6 @@ component/html/video
|
|
|
35
35
|
|------------------------------|--------------------------------|-------------------------------------------------------------------------------|
|
|
36
36
|
| play | 播放 | ^[Function]`() => void` |
|
|
37
37
|
| pause | 暂停 | ^[Function]`() => void` |
|
|
38
|
+
| start | 暂停后开始播放 | ^[Function]`() => void` |
|
|
38
39
|
| load | 加载 | ^[Function]`() => void` |
|
|
39
40
|
| stop | 停止 | ^[Function]`() => void` |
|
|
@@ -11,9 +11,9 @@ lang: zh-CN
|
|
|
11
11
|
|
|
12
12
|
| Name | Description | Type | Default |
|
|
13
13
|
| ----------------------- | ----------------- | --------------------- | -------------------- |
|
|
14
|
-
| gradientBackground | 背景颜色 |
|
|
15
|
-
| gradientFocusBackground | 焦点状态背景颜色 |
|
|
16
|
-
| iconGradientBackground | 图标背景颜色 |
|
|
14
|
+
| gradientBackground | 背景颜色 | [`QTGradient`](/zh-CN/css/color/gradient) | `{colors:['#1AFFFFFF','#1AFFFFFF'],orientation:6,cornerRadius:8}`|
|
|
15
|
+
| gradientFocusBackground | 焦点状态背景颜色 | [`QTGradient`](/zh-CN/css/color/gradient) | `{colors:['#FFFFFF','#FFFFFF'],orientation:6,cornerRadius:8}` |
|
|
16
|
+
| iconGradientBackground | 图标背景颜色 | [`QTGradient`](/zh-CN/css/color/gradient) | `{colors:['#FFB67827','#FFDBAF5C'],cornerRadius:4,orientation:6}`|
|
|
17
17
|
| markColor | 角标颜色 | ^[string] | #FF4E46 |
|
|
18
18
|
| markVipColor | VIP角标颜色 | ^[string] | #FFD97C |
|
|
19
19
|
| textColors | 文字颜色 | ^[QTStateListColor] | `{color:'rgba(255, 255, 255, .5)',focusColor:'rgba(0, 0, 0, 1)',selectColor:'rgba(255, 255, 255, .5)'}`|
|
|
@@ -96,7 +96,7 @@ component/poster/ripple
|
|
|
96
96
|
| type | 类型 | ^[number] | 10001 |
|
|
97
97
|
| borderRadius | 圆角 | ^[number] | 8 |
|
|
98
98
|
| rippleColor | 水波纹颜色 | ^[string] | - |
|
|
99
|
-
| focusBgColor | 焦点背景色 |
|
|
99
|
+
| focusBgColor | 焦点背景色 | [`QTGradient`](/zh-CN/css/color/gradient) | - |
|
|
100
100
|
| focusTitleColor | 标题焦点色 | ^[string] | - |
|
|
101
101
|
| focusSubTitleColor | 副标题焦点色 | ^[string] | - |
|
|
102
102
|
| floatTitleBgColor | 浮动标题背景色 | ^[object]`string[]` | - |
|
|
@@ -88,7 +88,7 @@ component/text/ellipsize-mode
|
|
|
88
88
|
| autoHeight ^(virtual dom组件中使用) | 高度自适应 | ^[boolean] | false |
|
|
89
89
|
| focusable | 是否可以获得焦点 | ^[boolean] | false |
|
|
90
90
|
| duplicateParentState | 继承父类的状态 | ^[boolean] | false |
|
|
91
|
-
| gradientBackground | 渐变背景色 |
|
|
91
|
+
| gradientBackground | 渐变背景色 | [`QTGradient`](/zh-CN/css/color/gradient) | false |
|
|
92
92
|
| showOnState | 在指定状态显示 | ^[enum]`'normal' \| 'selected' \| 'focused'` | normal |
|
|
93
93
|
| nextFocusDownSID ^(2.7) | 向下时指定下一个焦点sid | ^[string] | - |
|
|
94
94
|
| nextFocusUpSID ^(2.7) | 向上时指定下一个焦点sid | ^[string] | - |
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Waterfall Structure (AI)
|
|
3
|
+
lang: zh-CN
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Waterfall 结构(AI可读版)
|
|
7
|
+
|
|
8
|
+
本文将 `waterfall_structure.jpg` 转为文本结构,方便 AI 理解层级、字段和布局规则。
|
|
9
|
+
|
|
10
|
+
## 1. 层级关系
|
|
11
|
+
|
|
12
|
+
```text
|
|
13
|
+
Waterfall
|
|
14
|
+
└── Section[]
|
|
15
|
+
├── SectionTitle
|
|
16
|
+
└── SectionContent
|
|
17
|
+
└── Item[]
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
说明:
|
|
21
|
+
- `Waterfall` 是根容器。
|
|
22
|
+
- 每个 `Section` 至少包含 `style`、`itemList`,可选 `title`、`titleStyle`、`decoration`。
|
|
23
|
+
- `SectionContent` 中放置多个 `Item`。
|
|
24
|
+
|
|
25
|
+
## 2. 图中视觉层与语义映射
|
|
26
|
+
|
|
27
|
+
图中从外到内可理解为:
|
|
28
|
+
|
|
29
|
+
```text
|
|
30
|
+
Section Decoration (红色虚线)
|
|
31
|
+
-> Item Decoration (黑色点虚线)
|
|
32
|
+
-> Item Margin (紫色虚线)
|
|
33
|
+
-> Item Padding (蓝色点线)
|
|
34
|
+
-> Item Content (灰色块)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
方向统一为四边:`top / right / bottom / left`。
|
|
38
|
+
|
|
39
|
+
## 3. 字段映射(与代码一致)
|
|
40
|
+
|
|
41
|
+
| 图中概念 | 代码字段 | 备注 |
|
|
42
|
+
| --- | --- | --- |
|
|
43
|
+
| Waterfall | `QTWaterfall` | `width`, `height`, `visibleType` |
|
|
44
|
+
| Section | `QTWaterfallSection` | `type`, `style`, `itemList`, `title`, `titleStyle`, `decoration` |
|
|
45
|
+
| Item | `QTWaterfallItem` | `type`, `style`, `decoration` |
|
|
46
|
+
| Section Decoration | `section.decoration.{left,top,right,bottom}` | 四边装饰间距 |
|
|
47
|
+
| Item Decoration | `item.decoration.{left,top,right,bottom}` | 四边装饰间距(参与布局计算) |
|
|
48
|
+
| Item Margin | `item.style.margin*` | `margin`, `marginTop` 等 |
|
|
49
|
+
| Item Padding | `item.style.padding*` | `padding`, `paddingTop` 等 |
|
|
50
|
+
| Section 间距 | `section.style.spacing` | 行内/条目间距(layout 计算使用) |
|
|
51
|
+
|
|
52
|
+
相关类型定义来源:
|
|
53
|
+
- `packages/components/waterfall/src/waterfall-types.ts`
|
|
54
|
+
- `packages/components/flex/src/flex-types.ts`
|
|
55
|
+
|
|
56
|
+
## 4. 布局规则(Flex Section)
|
|
57
|
+
|
|
58
|
+
`QT_WATERFALL_SECTION_TYPE_FLEX` 的核心布局逻辑在:
|
|
59
|
+
- `packages/components/waterfall/src/QTWaterfallDataAdapter.ts`
|
|
60
|
+
|
|
61
|
+
可简化为:
|
|
62
|
+
|
|
63
|
+
```text
|
|
64
|
+
for each item in section.itemList:
|
|
65
|
+
width = item.style.width
|
|
66
|
+
height = item.style.height
|
|
67
|
+
|
|
68
|
+
if item.style.x and item.style.y are defined:
|
|
69
|
+
item.layout = [x, y, width, height]
|
|
70
|
+
else:
|
|
71
|
+
deco = item.decoration (left/top/right/bottom)
|
|
72
|
+
|
|
73
|
+
if rightMost + width + deco.right > sectionWidth:
|
|
74
|
+
wrap to next line
|
|
75
|
+
downMost += lineHeight + section.style.spacing
|
|
76
|
+
rightMost = 0
|
|
77
|
+
lineHeight = 0
|
|
78
|
+
|
|
79
|
+
item.layout.x = rightMost + deco.left
|
|
80
|
+
item.layout.y = downMost + deco.top
|
|
81
|
+
|
|
82
|
+
lineHeight = max(lineHeight, height + deco.top + deco.bottom)
|
|
83
|
+
sectionHeight = max(sectionHeight, item.layout.y + height + deco.bottom)
|
|
84
|
+
rightMost += width + section.style.spacing + deco.left + deco.right
|
|
85
|
+
|
|
86
|
+
final section height =
|
|
87
|
+
sectionHeight
|
|
88
|
+
+ titleStyle.height
|
|
89
|
+
+ titleStyle.marginTop + titleStyle.marginBottom
|
|
90
|
+
+ titleStyle.paddingTop + titleStyle.paddingBottom
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
注意:
|
|
94
|
+
- 当前 `layoutItem` 中,`section.decoration` 相关计算是注释状态;`item.decoration` 会参与布局。
|
|
95
|
+
- 若 `item.style.x/y` 存在,则该条目走绝对布局坐标,不参与自动排布。
|
|
96
|
+
|
|
97
|
+
## 5. 关键约束(AI 必须遵守)
|
|
98
|
+
|
|
99
|
+
这是最容易被忽略、但会直接导致 UI 错误的规则。
|
|
100
|
+
|
|
101
|
+
### 5.1 默认语境
|
|
102
|
+
|
|
103
|
+
- `qt-waterfall` 的 `#item` 插槽是在 `flex-section` 内渲染的。
|
|
104
|
+
- 因此自定义 `item` 默认要按 `QT_WATERFALL_SECTION_TYPE_FLEX` 的布局规则处理。
|
|
105
|
+
|
|
106
|
+
### 5.2 自定义 Item 根节点硬约束
|
|
107
|
+
|
|
108
|
+
自定义 `item` 根节点必须透传这两个属性:
|
|
109
|
+
|
|
110
|
+
```vue
|
|
111
|
+
layout="${layout}"
|
|
112
|
+
flexStyle="${style}"
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
推荐最小写法:
|
|
116
|
+
|
|
117
|
+
```vue
|
|
118
|
+
<template>
|
|
119
|
+
<div
|
|
120
|
+
layout="${layout}"
|
|
121
|
+
flexStyle="${style}"
|
|
122
|
+
:focusable="true"
|
|
123
|
+
eventClick
|
|
124
|
+
eventFocus
|
|
125
|
+
>
|
|
126
|
+
<!-- 内容 -->
|
|
127
|
+
</div>
|
|
128
|
+
</template>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### 5.3 不写会发生什么(根因)
|
|
132
|
+
|
|
133
|
+
- 缺少 `layout="${layout}"`:
|
|
134
|
+
`x/y/width/height` 不能按 Waterfall 计算结果落到 item 上,多个 item 往往出现在相同起点(常见为左上角),表现为“堆叠到一块”。
|
|
135
|
+
- 缺少 `flexStyle="${style}"`:
|
|
136
|
+
item 的动态样式上下文无法完整透传,样式与数据可能脱节(尺寸、间距、焦点态等),在复杂场景下同样会放大重叠/错位问题。
|
|
137
|
+
|
|
138
|
+
### 5.4 AI 生成代码检查清单
|
|
139
|
+
|
|
140
|
+
AI 生成自定义 `item` 代码时,必须逐条检查:
|
|
141
|
+
|
|
142
|
+
- 根节点是否包含 `layout="${layout}"`。
|
|
143
|
+
- 根节点是否包含 `flexStyle="${style}"`。
|
|
144
|
+
- 根节点是否可聚焦(按业务需要设置 `:focusable`、`eventFocus`、`eventClick`)。
|
|
145
|
+
- `section.type` 是否为 `QT_WATERFALL_SECTION_TYPE_FLEX`(或与插槽语义一致)。
|
|
146
|
+
- 未用纯 CSS 定位替代 `layout` 绑定。
|
|
147
|
+
|
|
148
|
+
### 5.5 本地图片必须加 `file://`(Waterfall / Tabs-Waterfall)
|
|
149
|
+
|
|
150
|
+
当图片来源是本地资源(例如 `import icon from '...png'`)且该值进入 Waterfall/Tabs-Waterfall 的数据对象时,必须补协议头:
|
|
151
|
+
|
|
152
|
+
```ts
|
|
153
|
+
const localIcon = `file://${icon}`
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
错误写法(容易在瀑布流条目里不显示或显示异常):
|
|
157
|
+
|
|
158
|
+
```ts
|
|
159
|
+
icon
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
正确写法:
|
|
163
|
+
|
|
164
|
+
```ts
|
|
165
|
+
`file://${icon}`
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
推荐应用位置:
|
|
169
|
+
- `item.image.normal / focused`
|
|
170
|
+
- `item.corner`
|
|
171
|
+
- `item.icon / iconFocus`
|
|
172
|
+
- 其他最终喂给 `src` 的数据字段(通过 `${...}` 绑定到 `img` / `qt-image`)
|
|
173
|
+
|
|
174
|
+
## 6. AI可解析数据结构(YAML)
|
|
175
|
+
|
|
176
|
+
```yaml
|
|
177
|
+
waterfall:
|
|
178
|
+
width: number
|
|
179
|
+
height: number
|
|
180
|
+
visibleType: none|normal|center
|
|
181
|
+
sectionList:
|
|
182
|
+
- _id: string
|
|
183
|
+
type: number
|
|
184
|
+
title: string
|
|
185
|
+
style:
|
|
186
|
+
width: number
|
|
187
|
+
height: number
|
|
188
|
+
spacing: number
|
|
189
|
+
left: number
|
|
190
|
+
top: number
|
|
191
|
+
right: number
|
|
192
|
+
bottom: number
|
|
193
|
+
decoration:
|
|
194
|
+
left: number
|
|
195
|
+
top: number
|
|
196
|
+
right: number
|
|
197
|
+
bottom: number
|
|
198
|
+
itemList:
|
|
199
|
+
- _id: string
|
|
200
|
+
type: number
|
|
201
|
+
style:
|
|
202
|
+
width: number
|
|
203
|
+
height: number
|
|
204
|
+
x: number
|
|
205
|
+
y: number
|
|
206
|
+
margin: number
|
|
207
|
+
marginTop: number
|
|
208
|
+
marginRight: number
|
|
209
|
+
marginBottom: number
|
|
210
|
+
marginLeft: number
|
|
211
|
+
padding: number
|
|
212
|
+
paddingTop: number
|
|
213
|
+
paddingRight: number
|
|
214
|
+
paddingBottom: number
|
|
215
|
+
paddingLeft: number
|
|
216
|
+
decoration:
|
|
217
|
+
left: number
|
|
218
|
+
top: number
|
|
219
|
+
right: number
|
|
220
|
+
bottom: number
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## 7. 最小示例(JSON)
|
|
224
|
+
|
|
225
|
+
```json
|
|
226
|
+
{
|
|
227
|
+
"width": 1920,
|
|
228
|
+
"height": 1080,
|
|
229
|
+
"sectionList": [
|
|
230
|
+
{
|
|
231
|
+
"_id": "sec-1",
|
|
232
|
+
"type": 1002,
|
|
233
|
+
"title": "SectionTitle",
|
|
234
|
+
"style": {
|
|
235
|
+
"width": 1800,
|
|
236
|
+
"height": 0,
|
|
237
|
+
"spacing": 20
|
|
238
|
+
},
|
|
239
|
+
"decoration": {
|
|
240
|
+
"left": 24,
|
|
241
|
+
"top": 16,
|
|
242
|
+
"right": 24,
|
|
243
|
+
"bottom": 16
|
|
244
|
+
},
|
|
245
|
+
"itemList": [
|
|
246
|
+
{
|
|
247
|
+
"_id": "item-1",
|
|
248
|
+
"type": 10001,
|
|
249
|
+
"style": {
|
|
250
|
+
"width": 280,
|
|
251
|
+
"height": 360,
|
|
252
|
+
"padding": 8,
|
|
253
|
+
"margin": 6
|
|
254
|
+
},
|
|
255
|
+
"decoration": {
|
|
256
|
+
"left": 8,
|
|
257
|
+
"top": 8,
|
|
258
|
+
"right": 8,
|
|
259
|
+
"bottom": 8
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
]
|
|
263
|
+
}
|
|
264
|
+
]
|
|
265
|
+
}
|
|
266
|
+
```
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: AnimationTransition
|
|
3
|
+
lang: zh-CN
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 动画与过渡
|
|
7
|
+
|
|
8
|
+
## CSS 动画与过渡速查表
|
|
9
|
+
|
|
10
|
+
| 属性 | 说明 | 示例 | 是否支持 |
|
|
11
|
+
|----------------|--------------------------------------|------------------------------|----------|
|
|
12
|
+
| animation-name | 指定动画名称 | `animation-name: slideIn;` | ❌ |
|
|
13
|
+
| animation-duration | 动画持续时间 | `animation-duration: 2s;` | ❌ |
|
|
14
|
+
| animation-timing-function | 动画速度曲线 | `animation-timing-function: ease-in-out;` | ❌ |
|
|
15
|
+
| animation-delay | 动画延迟开始时间 | `animation-delay: 1s;` | ❌ |
|
|
16
|
+
| animation-iteration-count | 动画重复次数 | `animation-iteration-count: infinite;` | ❌ |
|
|
17
|
+
| animation-direction | 动画播放方向 | `animation-direction: alternate;` | ❌ |
|
|
18
|
+
| animation-fill-mode | 动画结束后的状态 | `animation-fill-mode: forwards;` | ❌ |
|
|
19
|
+
| animation-play-state | 动画播放状态 | `animation-play-state: paused;` | ❌ |
|
|
20
|
+
| transition-property | 指定过渡动画影响的属性 | `transition-property: opacity;` | ❌ |
|
|
21
|
+
| transition-duration | 过渡动画持续时间 | `transition-duration: 0.3s;` | ❌ |
|
|
22
|
+
| transition-timing-function | 过渡动画速度曲线 | `transition-timing-function: ease;` | ❌ |
|
|
23
|
+
| transition-delay | 过渡动画延迟 | `transition-delay: 0.5s;` | ❌ |
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Auto
|
|
3
|
+
lang: zh-CN
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# auto
|
|
7
|
+
|
|
8
|
+
## CSS auto 速查表
|
|
9
|
+
|
|
10
|
+
| 用途领域 | 属性 | 含义说明 | 是否支持 |
|
|
11
|
+
|-----------------|-----------------------|-----------------------------------------------|-----------|
|
|
12
|
+
| 布局宽高 | `width`, `height` | 由浏览器根据内容或父元素自动计算尺寸 | ✅ |
|
|
13
|
+
| 外边距 | `margin` | `margin: auto` 通常用于水平居中 | ✅ |
|
|
14
|
+
| 定位 | `top`, `left`, `right`, `bottom` | 该方向上的值由浏览器自动决定(不强制定位) | ✅ |
|
|
15
|
+
| Flexbox 布局 | `flex-basis` | 由内容大小决定初始尺寸 | ❌ |
|
|
16
|
+
| Grid 布局 | `grid-template-columns` 等 | 轨道尺寸根据内容自动生成 | ❌ |
|
|
17
|
+
| 内容溢出控制 | `overflow` | `overflow: auto` 表示内容溢出时显示滚动条 | ❌ |
|
|
18
|
+
| 堆叠顺序 | `z-index` | `auto` 表示由文档流决定层级 | ❌ |
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: CheatSheet
|
|
3
|
+
lang: zh-CN
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# CSS 速查表
|
|
7
|
+
|
|
8
|
+
* [尺寸单位速查表](/zh-CN/css/size/overview)
|
|
9
|
+
* [伪类速查表](/zh-CN/css/pseudo-classes/overview)
|
|
10
|
+
* [选择器速查表](/zh-CN/css/selector/overview)
|
|
11
|
+
* [变量速查表](/zh-CN/css/variable/overview)
|
|
12
|
+
* [auto速查表](/zh-CN/css/auto/overview)
|
|
13
|
+
* [布局模型速查表](/zh-CN/css/layout-model/overview)
|
|
14
|
+
* [媒体速查表](/zh-CN/css/media/overview)
|
|
15
|
+
* [优先级和继承速查表](/zh-CN/css/specificity-inheritance/overview)
|
|
16
|
+
* [动画与过渡速查表](/zh-CN/css/animation-transition/overview)
|
|
17
|
+
* [颜色速查表](/zh-CN/css/color/overview)
|
|
18
|
+
* [函数速查表](/zh-CN/css/function/overview)
|
|
19
|
+
* [变换速查表](/zh-CN/css/transform/overview)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Color
|
|
3
|
+
lang: zh-CN
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 颜色
|
|
7
|
+
|
|
8
|
+
## CSS 颜色速查表
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
| 颜色类型 | 说明 | 示例 | 是否支持 |
|
|
12
|
+
|-------------------|---------------------------------|--------------------------------|----------|
|
|
13
|
+
| 关键字颜色 | CSS 预定义颜色关键字 | `red`, `blue`, `transparent` | ✅ |
|
|
14
|
+
| 十六进制颜色 | 以 # 开头的六位或三位十六进制值 | `#FF0000`, `#0F0` | ✅ |
|
|
15
|
+
| RGB | 使用 rgb() 函数定义颜色 | `rgb(255, 0, 0)` | ✅ |
|
|
16
|
+
| RGBA | 带透明度的 rgb() 函数 | `rgba(255, 0, 0, 0.5)` | ✅ |
|
|
17
|
+
| HSL | 使用 hsl() 定义色相、饱和度、亮度 | `hsl(120, 100%, 50%)` | ✅ |
|
|
18
|
+
| HSLA | 带透明度的 hsl() 函数 | `hsla(120, 100%, 50%, 0.3)` | ✅ |
|
|
19
|
+
| 透明色 | 透明关键字 | `transparent` | ✅ |
|
|
20
|
+
| 当前颜色关键字 | 使用当前文本颜色(inherit) | `currentColor` | ❌ |
|