@quicktvui/ai 1.0.5 → 1.0.6

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": "@quicktvui/ai",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "QuickTVUI AI 开发规范与脚手架注入工具",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/rules/.clinerules CHANGED
@@ -6,7 +6,10 @@
6
6
 
7
7
  **AI MUST refer to the official documentation and source code below BEFORE generating any code. NEVER hallucinate component names, attribute names, or APIs. These are the ONLY authorities.**
8
8
 
9
- 1. **Local Documentation (PRIMARY)**: The `node_modules/@quicktvui/ai/rules/.docs/` folder. Contains detailed MD documentation for all components, CSS, and native modules. **AI MUST use `grep_search` or `read_file` to retrieve relevant content from the `node_modules/@quicktvui/ai/rules/.docs/` directory before generating code.**
9
+ 1. **Local Docs & Examples (PRIMARY)**: `node_modules/@quicktvui/ai/rules/.docs/` directory.
10
+ * **Component Docs**: Detailed definitions of components, APIs, and CSS.
11
+ * **Example Code**: Vue files under `node_modules/@quicktvui/ai/rules/.docs/examples/` are verified best practices. **AI MUST refer to these examples before generating any logic.**
12
+
10
13
  2. **Official Docs**: https://quicktvui.com
11
14
  3. **Core Library Samples**: https://github.com/quicktvui/quicktvui.git
12
15
  4. **Cross-platform Framework Samples**: https://github.com/quicktvui/es-vue3.git
@@ -50,6 +53,11 @@ AI assistants frequently fail by applying traditional Web paradigms to QuickTVUI
50
53
  * CSS shorthand is **BANNED** (e.g., `margin: 10px` will crash. Use `margin-top: 10px; margin-left: 10px;`).
51
54
  * `auto` and `%` sizing are **BANNED**. Every element must have explicit `px` width/height.
52
55
 
56
+ ### 4. Pagination & Load More Rules (CRITICAL)
57
+ * **`qt-tabs` (Tabs Waterfall)**: MUST use **`@onTabPageLoadData="onTabPageLoadData"`**. For page 1 use `setPageData`, for subsequent pages use `addPageData` or push to the array.
58
+ * **`qt-waterfall` (Single Waterfall)**: NO native `loadMore` event. Triggered via **`@onItemBind`** on the last section or by listening to **`@onScrollToBottom`** (if supported).
59
+ * **`qt-list-view` / `qt-grid-view`**: Support native `@loadMore="loadMoreFn"` with `(pageNo: number) => void`.
60
+
53
61
  ## Overview
54
62
 
55
63
  QuickTVUI is a Vue 3 UI framework for Android TV / large-screen devices. Runs on Hippy-based quick app runtime, rendering Vue components as native Android views. Design resolution: 1920x1080 (auto-scaled).
@@ -389,3 +397,9 @@ export default defineComponent({
389
397
  .detail-back-btn { width: 240px; height: 70px; background-color: #333; focus-background-color: #0066FF; border-radius: 35px; }
390
398
  .detail-back-text { width: 240px; height: 70px; font-size: 26px; color: #ffffff; }
391
399
  </style>
400
+
401
+
402
+ 5. **Pagination & Load More Rules (CRITICAL)**:
403
+ * **`qt-tabs` (Tabs Waterfall)**: **MUST** use **`@onTabPageLoadData="onTabPageLoadData"`**. Append data via `addPageData`.
404
+ * **`qt-waterfall` (Single Waterfall)**: **NO native `loadMore` event**. Usually triggered via **`@onItemBind`** on the last section (e.g., a Loading Section) or by listening to **`@onScrollToBottom`** (if supported by parent).
405
+ * **`qt-list-view` / `qt-grid-view`**: Support native `@loadMore="loadMoreFn"` with `pageNo` parameter.
@@ -6,7 +6,10 @@
6
6
 
7
7
  **AI MUST refer to the official documentation and source code below BEFORE generating any code. NEVER hallucinate component names, attribute names, or APIs. These are the ONLY authorities.**
8
8
 
9
- 1. **Local Documentation (PRIMARY)**: The `node_modules/@quicktvui/ai/rules/.docs/` folder. Contains detailed MD documentation for all components, CSS, and native modules. **AI MUST use `grep_search` or `read_file` to retrieve relevant content from the `node_modules/@quicktvui/ai/rules/.docs/` directory before generating code.**
9
+ 1. **Local Docs & Examples (PRIMARY)**: `node_modules/@quicktvui/ai/rules/.docs/` directory.
10
+ * **Component Docs**: Detailed definitions of components, APIs, and CSS.
11
+ * **Example Code**: Vue files under `node_modules/@quicktvui/ai/rules/.docs/examples/` are verified best practices. **AI MUST refer to these examples before generating any logic.**
12
+
10
13
  2. **Official Docs**: https://quicktvui.com
11
14
  3. **Core Library Samples**: https://github.com/quicktvui/quicktvui.git
12
15
  4. **Cross-platform Framework Samples**: https://github.com/quicktvui/es-vue3.git
@@ -51,6 +54,11 @@ AI assistants frequently fail by applying traditional Web paradigms to QuickTVUI
51
54
  * CSS shorthand is **BANNED** (e.g., `margin: 10px` will crash. Use `margin-top: 10px; margin-left: 10px;`).
52
55
  * `auto` and `%` sizing are **BANNED**. Every element must have explicit `px` width/height.
53
56
 
57
+ ### 4. Pagination & Load More Rules (CRITICAL)
58
+ * **`qt-tabs` (Tabs Waterfall)**: MUST use **`@onTabPageLoadData="onTabPageLoadData"`**. For page 1 use `setPageData`, for subsequent pages use `addPageData` or push to the array.
59
+ * **`qt-waterfall` (Single Waterfall)**: NO native `loadMore` event. Triggered via **`@onItemBind`** on the last section or by listening to **`@onScrollToBottom`** (if supported).
60
+ * **`qt-list-view` / `qt-grid-view`**: Support native `@loadMore="loadMoreFn"` with `(pageNo: number) => void`.
61
+
54
62
  ## Overview
55
63
 
56
64
  QuickTVUI is a Vue 3 UI framework for Android TV / large-screen devices. Runs on Hippy-based quick app runtime, rendering Vue components as native Android views. Design resolution: 1920x1080 (auto-scaled).
@@ -390,3 +398,9 @@ export default defineComponent({
390
398
  .detail-back-btn { width: 240px; height: 70px; background-color: #333; focus-background-color: #0066FF; border-radius: 35px; }
391
399
  .detail-back-text { width: 240px; height: 70px; font-size: 26px; color: #ffffff; }
392
400
  </style>
401
+
402
+
403
+ 5. **Pagination & Load More Rules (CRITICAL)**:
404
+ * **`qt-tabs` (Tabs Waterfall)**: **MUST** use **`@onTabPageLoadData="onTabPageLoadData"`**. Append data via `addPageData`.
405
+ * **`qt-waterfall` (Single Waterfall)**: **NO native `loadMore` event**. Usually triggered via **`@onItemBind`** on the last section (e.g., a Loading Section) or by listening to **`@onScrollToBottom`** (if supported by parent).
406
+ * **`qt-list-view` / `qt-grid-view`**: Support native `@loadMore="loadMoreFn"` with `pageNo` parameter.
@@ -6,7 +6,10 @@
6
6
 
7
7
  **AI MUST refer to the official documentation and source code below BEFORE generating any code. NEVER hallucinate component names, attribute names, or APIs. These are the ONLY authorities.**
8
8
 
9
- 1. **Local Documentation (PRIMARY)**: The `node_modules/@quicktvui/ai/rules/.docs/` folder. Contains detailed MD documentation for all components, CSS, and native modules. **AI MUST use `grep_search` or `read_file` to retrieve relevant content from the `node_modules/@quicktvui/ai/rules/.docs/` directory before generating code.**
9
+ 1. **Local Docs & Examples (PRIMARY)**: `node_modules/@quicktvui/ai/rules/.docs/` directory.
10
+ * **Component Docs**: Detailed definitions of components, APIs, and CSS.
11
+ * **Example Code**: Vue files under `node_modules/@quicktvui/ai/rules/.docs/examples/` are verified best practices. **AI MUST refer to these examples before generating any logic.**
12
+
10
13
  2. **Official Docs**: https://quicktvui.com
11
14
  3. **Core Library Samples**: https://github.com/quicktvui/quicktvui.git
12
15
  4. **Cross-platform Framework Samples**: https://github.com/quicktvui/es-vue3.git
@@ -50,6 +53,11 @@ AI assistants frequently fail by applying traditional Web paradigms to QuickTVUI
50
53
  * CSS shorthand is **BANNED** (e.g., `margin: 10px` will crash. Use `margin-top: 10px; margin-left: 10px;`).
51
54
  * `auto` and `%` sizing are **BANNED**. Every element must have explicit `px` width/height.
52
55
 
56
+ ### 4. Pagination & Load More Rules (CRITICAL)
57
+ * **`qt-tabs` (Tabs Waterfall)**: MUST use **`@onTabPageLoadData="onTabPageLoadData"`**. For page 1 use `setPageData`, for subsequent pages use `addPageData` or push to the array.
58
+ * **`qt-waterfall` (Single Waterfall)**: NO native `loadMore` event. Triggered via **`@onItemBind`** on the last section or by listening to **`@onScrollToBottom`** (if supported).
59
+ * **`qt-list-view` / `qt-grid-view`**: Support native `@loadMore="loadMoreFn"` with `(pageNo: number) => void`.
60
+
53
61
  ## Overview
54
62
 
55
63
  QuickTVUI is a Vue 3 UI framework for Android TV / large-screen devices. Runs on Hippy-based quick app runtime, rendering Vue components as native Android views. Design resolution: 1920x1080 (auto-scaled).
@@ -458,3 +466,9 @@ export default defineComponent({
458
466
  }
459
467
  </style>
460
468
  ```
469
+
470
+
471
+ 5. **Pagination & Load More Rules (CRITICAL)**:
472
+ * **`qt-tabs` (Tabs Waterfall)**: **MUST** use **`@onTabPageLoadData="onTabPageLoadData"`**. Append data via `addPageData`.
473
+ * **`qt-waterfall` (Single Waterfall)**: **NO native `loadMore` event**. Usually triggered via **`@onItemBind`** on the last section (e.g., a Loading Section) or by listening to **`@onScrollToBottom`** (if supported by parent).
474
+ * **`qt-list-view` / `qt-grid-view`**: Support native `@loadMore="loadMoreFn"` with `pageNo` parameter.
@@ -6,7 +6,10 @@
6
6
 
7
7
  **AI MUST refer to the official documentation and source code below BEFORE generating any code. NEVER hallucinate component names, attribute names, or APIs. These are the ONLY authorities.**
8
8
 
9
- 1. **Local Documentation (PRIMARY)**: The `node_modules/@quicktvui/ai/rules/.docs/` folder. Contains detailed MD documentation for all components, CSS, and native modules. **AI MUST use `grep_search` or `read_file` to retrieve relevant content from the `node_modules/@quicktvui/ai/rules/.docs/` directory before generating code.**
9
+ 1. **Local Docs & Examples (PRIMARY)**: `node_modules/@quicktvui/ai/rules/.docs/` directory.
10
+ * **Component Docs**: Detailed definitions of components, APIs, and CSS.
11
+ * **Example Code**: Vue files under `node_modules/@quicktvui/ai/rules/.docs/examples/` are verified best practices. **AI MUST refer to these examples before generating any logic.**
12
+
10
13
  2. **Official Docs**: https://quicktvui.com
11
14
  3. **Core Library Samples**: https://github.com/quicktvui/quicktvui.git
12
15
  4. **Cross-platform Framework Samples**: https://github.com/quicktvui/es-vue3.git
@@ -50,6 +53,11 @@ AI assistants frequently fail by applying traditional Web paradigms to QuickTVUI
50
53
  * CSS shorthand is **BANNED** (e.g., `margin: 10px` will crash. Use `margin-top: 10px; margin-left: 10px;`).
51
54
  * `auto` and `%` sizing are **BANNED**. Every element must have explicit `px` width/height.
52
55
 
56
+ ### 4. Pagination & Load More Rules (CRITICAL)
57
+ * **`qt-tabs` (Tabs Waterfall)**: MUST use **`@onTabPageLoadData="onTabPageLoadData"`**. For page 1 use `setPageData`, for subsequent pages use `addPageData` or push to the array.
58
+ * **`qt-waterfall` (Single Waterfall)**: NO native `loadMore` event. Triggered via **`@onItemBind`** on the last section or by listening to **`@onScrollToBottom`** (if supported).
59
+ * **`qt-list-view` / `qt-grid-view`**: Support native `@loadMore="loadMoreFn"` with `(pageNo: number) => void`.
60
+
53
61
  ## Overview
54
62
 
55
63
  QuickTVUI is a Vue 3 UI framework for Android TV / large-screen devices. Runs on Hippy-based quick app runtime, rendering Vue components as native Android views. Design resolution: 1920x1080 (auto-scaled).
@@ -389,3 +397,9 @@ export default defineComponent({
389
397
  .detail-back-btn { width: 240px; height: 70px; background-color: #333; focus-background-color: #0066FF; border-radius: 35px; }
390
398
  .detail-back-text { width: 240px; height: 70px; font-size: 26px; color: #ffffff; }
391
399
  </style>
400
+
401
+
402
+ 5. **Pagination & Load More Rules (CRITICAL)**:
403
+ * **`qt-tabs` (Tabs Waterfall)**: **MUST** use **`@onTabPageLoadData="onTabPageLoadData"`**. Append data via `addPageData`.
404
+ * **`qt-waterfall` (Single Waterfall)**: **NO native `loadMore` event**. Usually triggered via **`@onItemBind`** on the last section (e.g., a Loading Section) or by listening to **`@onScrollToBottom`** (if supported by parent).
405
+ * **`qt-list-view` / `qt-grid-view`**: Support native `@loadMore="loadMoreFn"` with `pageNo` parameter.
package/rules/AGENTS.md CHANGED
@@ -6,7 +6,10 @@
6
6
 
7
7
  **AI MUST refer to the official documentation and source code below BEFORE generating any code. NEVER hallucinate component names, attribute names, or APIs. These are the ONLY authorities.**
8
8
 
9
- 1. **Local Documentation (PRIMARY)**: The `node_modules/@quicktvui/ai/rules/.docs/` folder. Contains detailed MD documentation for all components, CSS, and native modules. **AI MUST use `grep_search` or `read_file` to retrieve relevant content from the `node_modules/@quicktvui/ai/rules/.docs/` directory before generating code.**
9
+ 1. **Local Docs & Examples (PRIMARY)**: `node_modules/@quicktvui/ai/rules/.docs/` directory.
10
+ * **Component Docs**: Detailed definitions of components, APIs, and CSS.
11
+ * **Example Code**: Vue files under `node_modules/@quicktvui/ai/rules/.docs/examples/` are verified best practices. **AI MUST refer to these examples before generating any logic.**
12
+
10
13
  2. **Official Docs**: https://quicktvui.com (390+ docs)
11
14
  3. **Core Library Samples**: https://github.com/quicktvui/quicktvui.git (Core library + samples)
12
15
  4. **Cross-platform Framework Samples**: https://github.com/quicktvui/es-vue3.git (Cross-platform framework + samples)
@@ -50,6 +53,11 @@ AI assistants frequently fail by applying traditional Web paradigms to QuickTVUI
50
53
  * CSS shorthand is **BANNED** (e.g., `margin: 10px` will crash. Use `margin-top: 10px; margin-left: 10px;`).
51
54
  * `auto` and `%` sizing are **BANNED**. Every element must have explicit `px` width/height.
52
55
 
56
+ ### 4. Pagination & Load More Rules (CRITICAL)
57
+ * **`qt-tabs` (Tabs Waterfall)**: MUST use **`@onTabPageLoadData="onTabPageLoadData"`**. For page 1 use `setPageData`, for subsequent pages use `addPageData` or push to the array.
58
+ * **`qt-waterfall` (Single Waterfall)**: NO native `loadMore` event. Triggered via **`@onItemBind`** on the last section or by listening to **`@onScrollToBottom`** (if supported).
59
+ * **`qt-list-view` / `qt-grid-view`**: Support native `@loadMore="loadMoreFn"` with `(pageNo: number) => void`.
60
+
53
61
  ## Overview
54
62
 
55
63
  QuickTVUI is a Vue 3 UI framework for Android TV / large-screen devices. Runs on Hippy-based quick app runtime, rendering Vue components as native Android views. Design resolution: 1920x1080 (auto-scaled).
@@ -478,3 +486,9 @@ export default defineComponent({
478
486
  }
479
487
  </style>
480
488
  ```
489
+
490
+
491
+ 5. **Pagination & Load More Rules (CRITICAL)**:
492
+ * **`qt-tabs` (Tabs Waterfall)**: **MUST** use **`@onTabPageLoadData="onTabPageLoadData"`**. Append data via `addPageData`.
493
+ * **`qt-waterfall` (Single Waterfall)**: **NO native `loadMore` event**. Usually triggered via **`@onItemBind`** on the last section (e.g., a Loading Section) or by listening to **`@onScrollToBottom`** (if supported by parent).
494
+ * **`qt-list-view` / `qt-grid-view`**: Support native `@loadMore="loadMoreFn"` with `pageNo` parameter.
package/rules/CLAUDE.md CHANGED
@@ -6,7 +6,10 @@
6
6
 
7
7
  **AI 在生成代码前,必须严格参考以下权威来源,严禁凭空想象任何组件名、属性名或 API。这是所有代码的唯一依据。**
8
8
 
9
- 1. **本地文档 (PRIMARY)**:`node_modules/@quicktvui/ai/rules/.docs/` 目录。包含所有组件、CSS、原生模块的详细 MD 文档。**AI 必须在生成代码前使用 `grep_search` 或 `read_file` 检索 `node_modules/@quicktvui/ai/rules/.docs/` 目录中的相关内容。**
9
+ 1. **本地文档与示例 (PRIMARY)**:`node_modules/@quicktvui/ai/rules/.docs/` 目录。
10
+ * **组件文档**:提供组件、API 及 CSS 的详细定义。
11
+ * **示例代码**:`node_modules/@quicktvui/ai/rules/.docs/examples/` 下的 Vue 文件是经过验证的最佳实践,**AI 在生成逻辑前必须优先参考这些示例。**
12
+
10
13
  2. **官方文档**:https://quicktvui.com (官网 390+ 篇详细文档)
11
14
  3. **核心库示例**:https://github.com/quicktvui/quicktvui.git (Core library + samples)
12
15
  4. **跨平台框架示例**:https://github.com/quicktvui/es-vue3.git (Cross-platform framework + samples)
@@ -50,6 +53,11 @@ AI 在编写业务逻辑时,极易带入传统 Web 开发习惯导致严重报
50
53
  * 不支持任何 CSS 简写(例如 `margin: 10px` 必崩,必须写 `margin-top: 10px; margin-left: 10px;`)。
51
54
  * 不支持 `auto`,不支持 `%`。所有组件**必须显式定义宽高**(`width` / `height` 赋明确的 px 值)。
52
55
 
56
+ ### 4. 分页加载硬约束 (Pagination Rules)
57
+ * **`qt-tabs` (Tabs Waterfall)**:必须使用 **`@onTabPageLoadData="onTabPageLoadData"`** 回调。加载数据后,第一页使用 `setPageData`,后续页使用 `addPageData` 追加(或直接 push 到绑定数组)。
58
+ * **`qt-waterfall` (单瀑布流)**:原生没有 `loadMore` 事件。通常在最后一个板块的 **`@onItemBind`** 中触发下一页请求,或监听 **`@onScrollToBottom`** (若外层容器支持)。
59
+ * **`qt-list-view` / `qt-grid-view`**:原生支持 `@loadMore="loadMoreFn"`,方法签名:`(pageNo: number) => void`。
60
+
53
61
  ## 框架概述
54
62
 
55
63
  QuickTVUI 是基于 Vue 3 的 Android TV/大屏端 UI 框架。运行在快应用运行环境(Hippy-based)上,Vue 语法开发,渲染为 Android 原生视图。
package/rules/GEMINI.md CHANGED
@@ -1,4 +1,4 @@
1
- # GEMINI.md - QuickTVUI AI Development Guide
1
+ # GEMINI.md - QuickTVUI AI 开发指南
2
2
 
3
3
  > 放入任何 QuickTVUI 项目根目录,Gemini CLI / Gemini Code Assist 自动加载。
4
4
 
@@ -6,482 +6,65 @@
6
6
 
7
7
  **AI 在生成代码前,必须严格参考以下权威来源,严禁凭空想象任何组件名、属性名或 API。这是所有代码的唯一依据。**
8
8
 
9
- 1. **本地文档 (PRIMARY)**:`node_modules/@quicktvui/ai/rules/.docs/` 目录。包含所有组件、CSS、原生模块的详细 MD 文档。**AI 必须在生成代码前使用 `grep_search` 或 `read_file` 检索 `node_modules/@quicktvui/ai/rules/.docs/` 目录中的相关内容。**
10
- 2. **官方文档**:https://quicktvui.com (官网 390+ 篇详细文档)
11
- 3. **核心库示例**:https://github.com/quicktvui/quicktvui.git (Core library + samples)
12
- 4. **跨平台框架示例**:https://github.com/quicktvui/es-vue3.git (Cross-platform framework + samples)
13
- 5. **最佳实践应用**:https://github.com/quicktvui/hellotv.git (Complete video app)
14
-
15
- **要求:**
16
- - **检索与能力验证优先**:在实现任何功能(如“视频播放”)前,必须先在 `node_modules/@quicktvui/ai/rules/.docs/` 目录中检索相关文档,验证组件是否支持该功能。切勿想当然!**例如:`qt-web-view` 绝对不支持视频播放,视频播放必须使用框架提供的专用视频组件和管理器(如 `es-video-player` 和 `es-player-manager`)。**
17
- - **非浏览器与无 HTML 环境**:**本框架绝对不支持标准 HTML 标签(如 `p`, `img`, `a`, `ul`, `li`, `h1` 等),严禁在模板中使用!绝对不支持 `window`、`document` (DOM) 对象或任何 DOM 操作 API。必须使用框架专属标签(如 `qt-text`, `qt-image`) and Vue `ref`。**
18
- - **严禁自造标签**:如 `qt-web` 是错的,官方示例中是 `qt-web-view`。
19
- - **严禁自造 API**:如 `onBack` 是错的,必须是 `onBackPressed`。
20
- - **参考优先**:遇到不确定的组件用法,必须先在上述仓库或 `node_modules/@quicktvui/ai/rules/.docs/` 中搜索同名组件的实际用法。
9
+ 1. **本地文档与示例 (PRIMARY)**:`node_modules/@quicktvui/ai/rules/.docs/` 目录。
10
+ * **组件文档**:提供组件、API CSS 的详细定义。
11
+ * **示例代码**:`node_modules/@quicktvui/ai/rules/.docs/examples/` 下的 Vue 文件是经过验证的最佳实践,**AI 在生成逻辑前必须优先参考这些示例。**
21
12
 
22
- ## 快速创建项目 (Scaffolding)
13
+ 2. **官方文档**:https://quicktvui.com (官网 390+ 篇详细文档)
14
+ 3. **核心库示例**:https://github.com/quicktvui/quicktvui.git
15
+ 4. **最佳实践应用**:https://github.com/quicktvui/hellotv.git
23
16
 
24
- 当用户要求创建全新的 QuickTVUI 快应用项目时,AI **必须**严格遵循以下流程(切勿凭空生成目录和文件):
25
- 1. **获取模板**:`git clone https://github.com/quicktvui/quicktvui-template.git <项目名>`
26
- 2. **清理 Git**:`cd <项目名> && rm -rf .git`
27
- 3. **更新配置**:读取 `package.json`,修改 `name` 为目标项目名称,重置 `version` 为 `1.0.0`。
28
- 4. **安装依赖**:`yarn install`(推荐)。
29
- 5. **初始化提示**:提醒用户启动服务前,需确认是否已安装全局 CLI `npm install -g @quicktvui/cli@latest` 并执行了 `qui setup` 配置环境(详见 https://quicktvui.com/zh-CN/guide/basic/quick-start.html)。
17
+ ---
30
18
 
31
19
  ## 🔥 核心架构避坑指南 (ARCHITECTURAL GOTCHAS)
32
20
 
33
- AI 在编写业务逻辑时,极易带入传统 Web 开发习惯导致严重报错,**必须牢记以下框架特性**:
34
-
35
- 1. **视频/音频播放架构**:
36
- * **绝对禁止**使用 HTML5 `<video>`、`<audio>` 或 `qt-web-view` 播放媒体。
37
- * **最佳实践**:必须优先使用 **`es-player-manager`**(播放管理器)配合 `es-video-player` 或 `es-audio-player`。`es-player-manager` 负责处理窗口切换(全屏/小窗)、播放列表、焦点逻辑和生命周期,单用底层 player 会导致大量底层逻辑缺失。
38
- 2. **长列表组件 (`qt-list-view`, `qt-grid-view`, `qt-waterfall`)**:
39
- * 必须设置 `listenBoundEvent="true"` 并监听 `@item-bind`。
40
- * 列表的加载更多模版 `type` **必须**是 `1002`,底线提示 `type` **必须**是 `1003`。
41
- * **Waterfall 瀑布流硬约束**:
42
- * 自定义 Item 根节点 **必须** 包含 `layout="${layout}"` 和 `flexStyle="${style}"`,否则条目会堆叠重合。
43
- * 瀑布流数据中的本地图片路径 **必须** 补充 `file://` 协议头(如 ``file://${icon}``)。
44
- * 详细布局逻辑参考:`node_modules/@quicktvui/ai/rules/.docs/zh-CN/component/waterfall_structure.md`。
45
- 3. **零 HTML 与 零 DOM 环境**:
46
- * **这不是浏览器!** 底层是 Hippy 渲染的 Android Native View。
47
- * **禁用标签**:`<p>`, `<img>`, `<ul>`, `<li>`, `<a>`, `<h1>`, `<button>` 等标准 HTML 标签**全部禁用**。只允许使用 `div`, `span` 或 `qt-` 开头的专属标签。
48
- * **禁用 API**:没有 `window`, `document`, `e.preventDefault()`, `alert()`。本地存储必须用 `useESLocalStorage()`,提示必须用 `useESToast()`。
49
- 4. **CSS 严格子集**:
50
- * 不支持任何 CSS 简写(例如 `margin: 10px` 必崩,必须写 `margin-top: 10px; margin-left: 10px;`)。
51
- * 不支持 `auto`,不支持 `%`。所有组件**必须显式定义宽高**(`width` / `height` 赋明确的 px 值)。
52
-
53
- ## Overview
54
-
55
- QuickTVUI is a Vue 3 UI framework for Android TV / large-screen devices. Runs on Hippy-based quick app runtime, rendering Vue components as native Android views. Design resolution: 1920x1080 (auto-scaled).
56
-
57
- ## Example Repositories
58
-
59
- - https://github.com/quicktvui/quicktvui.git — Core library + samples
60
- - https://github.com/quicktvui/es-vue3.git — Cross-platform framework + samples
61
- - https://github.com/quicktvui/hellotv.git — Complete video app (best practice)
62
- - Online docs: https://quicktvui.com
63
-
64
- ## CRITICAL RULES (Read First — Violations Will Cause Runtime Failures)
65
-
66
- ### Function Naming (Framework matches by exact name — wrong name = never called)
67
-
68
- - Back key handler MUST be named `onBackPressed` — NOT `onBack`, `goBack`, `handleBack`
69
- - Key events MUST be named `onKeyDown` / `onKeyUp` — NOT `handleKeyDown`, `onKeyPress`
70
- - Lifecycle MUST be named `onESCreate` / `onESResume` / `onESDestroy` etc. — exact names only
71
- - ALL these functions MUST be defined in `setup()` AND returned in `return { }`
72
-
73
- ### Every Page MUST Include (Checklist)
74
-
75
- - `onESCreate(params)` — page lifecycle entry, MUST define and return
76
- - `onBackPressed()` — back key handler, MUST define and return (usually calls `router.back()`)
77
- - At least one element with `:autofocus="true"` — otherwise no focus on page open, remote control won't work
78
- - Root element size: `width: 1920px; height: 1080px`
79
-
80
- ### Component Names (Must be exact — no HTML tag substitutes)
81
-
82
- - Image component is `qt-image` — NOT `qt-img`, NOT `<img>`
83
- - Text MUST use `<qt-text>` or `<span>` — NOT `<p>`, `<h1>`~`<h6>`, `<label>`
84
- - Containers: `<div>`, `<qt-view>`, `<qt-row>`, `<qt-column>` — NOT `<section>`, `<main>`, `<article>`
85
- - Buttons: `<qt-button>` or focusable `<div>` — NOT `<button>`
86
-
87
- ### STRICT COMPONENT NAMING (CRITICAL)
88
-
89
- **Do NOT hallucinate or use standard web tags. The following mapping is MANDATORY:**
90
-
91
- | Mandatory Tag | Forbidden (Do NOT use) |
92
- | ------------- | ---------------------------------- |
93
- | `<qt-image>` | `<qt-img>`, `<img>` |
94
- | `<qt-text>` | `<p>`, `<h1>`~`<h6>`, `<label>` |
95
- | `<qt-button>` | `<button>` |
96
- | `<div>` | `<section>`, `<main>`, `<article>` |
97
- | `<span>` | `<p>`, `<label>` |
98
-
99
- ### CSS Rules (This is NOT standard Web CSS)
21
+ AI 在编写业务逻辑时,必须牢记以下框架特性,防止套用 Web 开发习惯:
100
22
 
101
- - **CRITICAL: NO `auto` sizing**. All elements MUST have explicit `px` values.
102
- - **CRITICAL: NO `alert()`**. Use `useESToast().showToast()` instead.
103
- - **CRITICAL: NO `e.preventDefault()`** or `e.stopPropagation()`. These do not exist in the native event system.
104
- - **CRITICAL: NO `window` or `document` (DOM) objects**. The runtime is not a browser.
105
- - **CRITICAL: Static styles MUST be in `<style>` (kebab-case), Dynamic styles MUST be in `:style` attributes.**
106
- - **CRITICAL: NO `-webkit-font-smoothing: antialiased;`**. This is not supported.
107
- - **CRITICAL: ONLY use `div` and `span` for standard tags.** Do NOT use `p`, `h1-h6`, `section`, etc.
108
- - **`<style>` = kebab-case, `<template>` tag attributes = camelCase.** Do NOT mix them up.
23
+ ### 1. 视频/音频播放架构
24
+ * **绝对禁止**使用 HTML5 `<video>`、`<audio>` `qt-web-view` 播放媒体。
25
+ * **必须使用 `es-player-manager`**。它负责处理窗口切换(全屏/小窗)、播放列表、焦点逻辑和生命周期,单用底层 player 会导致大量逻辑缺失。
109
26
 
110
- WRONG DO NOT write camelCase in `<style>`:
27
+ ### 2. 长列表组件 (`qt-list-view`, `qt-grid-view`, `qt-waterfall`)
28
+ * 必须设置 `listenBoundEvent="true"` 并监听 `@item-bind`。
29
+ * 列表加载更多模版 `type` 必须是 `1002`,底线提示 `type` 必须是 `1003`。
111
30
 
112
- ```css
113
- /* WRONG! camelCase in <style> will NOT work */
114
- .item {
115
- backgroundcolor: #333;
116
- fontsize: 28px;
117
- focusbackgroundcolor: #0066ff;
118
- borderradius: 10px;
119
- }
120
- ```
31
+ ### 3. Waterfall 瀑布流硬约束 (CRITICAL)
32
+ * **布局属性**:自定义 Item 根节点 **必须** 包含 `layout="${layout}"` `flexStyle="${style}"`,否则条目会堆叠重合。
33
+ * **本地图片**:瀑布流数据中的本地图片路径 **必须** 补充 `file://` 协议头(如 ``file://${icon}``)。
34
+ * **结构细节**:详细布局逻辑参考 `node_modules/@quicktvui/ai/rules/.docs/zh-CN/component/waterfall_structure.md`。
121
35
 
122
- CORRECT `<style>` must use kebab-case for ALL properties:
36
+ ### 4. 分页加载硬约束 (Pagination Rules)
37
+ * **`qt-tabs` (Tabs Waterfall)**:必须使用 **`@onTabPageLoadData="onTabPageLoadData"`** 回调。加载数据后,第一页使用 `setPageData`,后续页使用 `addPageData` 追加(或直接 push 到绑定数组)。
38
+ * **`qt-waterfall` (单瀑布流)**:原生没有 `loadMore` 事件。可通过监听 **`@onScrollToBottom`** (若外层容器支持) 或在最后一个板块的 **`@onItemBind`** 中触发下一页请求。
39
+ * **`qt-list-view` / `qt-grid-view`**:原生支持 `@loadMore="loadMoreFn"`,方法签名:`(pageNo: number) => void`。
123
40
 
124
- ```css
125
- /* CORRECT kebab-case in <style>, including framework extensions */
126
- .item {
127
- background-color: #333;
128
- font-size: 28px;
129
- focus-background-color: #0066ff;
130
- border-radius: 10px;
131
- }
132
- ```
41
+ ### 5. 零 HTML 与 零 DOM 环境
42
+ * **禁用标签**:`<p>`, `<img>`, `<ul>`, `<li>`, `<a>`, `<h1>`, `<button>` 全部禁用。只允许使用 `div`, `span` 或 `qt-` 开头的专属标签。
43
+ * **禁用 API**:没有 `window`, `document`, `e.preventDefault()`, `alert()`。本地存储用 `useESLocalStorage()`,提示用 `useESToast()`。
133
44
 
134
- CORRECT `<template>` tag attributes use camelCase:
45
+ ### 6. CSS 严格子集
46
+ * **强制 Flex**:每个有样式的元素必须显式写 `display: flex;`。默认方向为 `flex-direction: column;`。
47
+ * **禁止简写**:不支持 `margin: 10px`,必须写 `margin-top: 10px;` 等。
48
+ * **禁止相对单位**:只允许 `px`,不支持 `%`, `auto`, `vh/vw`, `rem`。
135
49
 
136
- ```vue
137
- <!-- CORRECT — camelCase on tag attributes -->
138
- <div :focusable="true" :focusScale="1.1" :enableFocusBorder="true">
139
- ```
140
-
141
- Other CSS rules:
142
-
143
- - **CRITICAL: MANDATORY `display: flex;`**. QuickTVUI exclusively supports Flexbox layout. Every styled element MUST explicitly include `display: flex;`. The default orientation is `flex-direction: column;`.
144
- - Only use properties listed in "Supported Style Properties" section below
145
- - `display: flex` and `flex-direction: column` are supported and MANDATORY for all layouts.
146
- - Do NOT use `<style scoped>` (unreliable in native rendering, use `<style>` only)
147
- - Only `px` units (no %, auto, vh, vw, rem, em)
148
- - No CSS shorthand like `margin: 5px 10px` — must split: `margin-top: 5px; margin-right: 10px`
149
-
150
- ### clipChildren / clipPadding (MANDATORY for TV — without these, focusScale gets clipped)
151
-
152
- Android clips child views outside parent bounds by default. When using `focusScale`, the enlarged item gets cut off.
153
-
154
- **Rules:**
155
- - Any container with `focusScale` children MUST set `:clipChildren="false"`
156
- - List components (`qt-list-view`, `qt-waterfall`, `qt-grid-view`) MUST set both `:clipChildren="false"` and `:clipPadding="false"`
157
- - Written as camelCase attributes in `<template>`
158
-
159
- ```vue
160
- <div :clipChildren="false">
161
- <div :focusable="true" :focusScale="1.1">...</div>
162
- </div>
163
- <qt-list-view :clipChildren="false" :clipPadding="false" />
164
- ```
50
+ ---
165
51
 
166
52
  ## 🛡️ AI Sentinel: 框架问题上报机制 (Bug Reporting)
167
53
 
168
- 当用户通过以下方式表达困惑时:
169
- - **关键词触发**:用户提到“问题上报”、“碰到问题”、“反馈”、“Bug 反馈”、“还是没改好”、“运行报错”、“API 报错”等。
170
- - **自动检测触发**:同一段代码逻辑在 3 次修复后仍然报错,或 AI 确认生成的代码符合 `node_modules/@quicktvui/ai/rules/.docs/` 规范但无法在用户端运行。
171
-
172
- **AI 执行协议:**
173
- 1. **脱敏诊断 (Sanitized Diagnosis)**:
174
- - 提取报错日志(去除绝对路径和私密 Token)。
175
- - 整理环境信息(Node 版本、package.json 中的框架版本)。
176
- - 编写最小可复现 Demo 代码(Minimum Reproducible Example)。
177
- 2. **寻求授权 (Request Consent)**:
178
- - AI 必须询问:“检测到该问题可能属于 QuickTVUI 框架缺陷,我已为您准备好一份脱敏后的诊断报告,是否允许我协助您将其上报到 GitHub 官方仓库以寻求官方支持?”
179
- 3. **提交方式 (Submission)**:
180
- - 授权后,**自动打开浏览器**:AI 应尝试根据操作系统执行系统命令以自动打开 Issue 链接:
181
- - macOS: `open "URL"`
182
- - Linux: `xdg-open "URL"`
183
- - Windows: `start "URL"`
184
- - 如果自动打开失败,则展示 Issue 预填充链接引导用户点击。
185
-
186
- ### Import Sources
187
-
188
- - `defineComponent` from `vue` (correct) — NOT from `@vue/runtime-core`
189
- - Router: `useESRouter` from `@extscreen/es3-router`
190
- - Native modules from `@extscreen/es3-core`
54
+ 当 AI 修复同一问题超过 3 次未果,或确认代码符合规范但仍报错时,必须启动:
55
+ 1. **脱敏诊断**:提取报错日志(去除私密信息),编写最小可复现 Demo。
56
+ 2. **寻求授权**:询问用户是否允许将诊断报告上报到 GitHub 官方仓库。
57
+ 3. **自动化上报**:获得授权后,尝试使用系统命令(如 macOS `open`)自动打开 GitHub Issue 预填充页面。
191
58
 
192
59
  ---
193
60
 
194
- ## Supported Style Properties (Complete List)
195
-
196
- Only properties listed below are supported. Default layout: flexbox, flex-direction: column.
197
-
198
- Rules: px units only (no %, auto, vh/vw/rem/em). No CSS shorthand. No CSS variables. MANDATORY `display: flex;` for all elements. All elements MUST have explicit width/height.
199
-
200
- ### Layout & Size
201
-
202
- `width`, `height`, `left`, `top`, `overflow`, `direction`, `z-index`, `visibility`, `opacity`, `transform`
203
-
204
- ### Background
205
-
206
- `background-color`, `background-image`, `background-position-x`, `background-position-y`, `background-size`, `linear-gradient`
207
-
208
- ### Border
209
-
210
- `border-color`, `border-style`, `border-width`, `border-radius`, `border-top-color/style/width`, `border-bottom-color/style/width`, `border-left-color/style/width`, `border-right-color/style/width`, `border-top-left-radius`, `border-top-right-radius`, `border-bottom-left-radius`, `border-bottom-right-radius`
211
-
212
- ### Shadow
213
-
214
- `shadow-color`, `shadow-offset`, `shadow-offset-x`, `shadow-offset-y`, `shadow-opacity`, `shadow-radius`
61
+ ## 🚀 快速创建项目 (Scaffolding)
62
+ AI 在创建新项目时,必须遵循:`git clone` 官方模板 -> 清理 `.git` -> 修改 `package.json` -> `yarn install`。
215
63
 
216
- ### Text
217
-
218
- `color`, `text`, `text-align`, `text-align-vertical`, `font-size`, `font-family`, `font-style`, `font-weight`, `fake-bold`, `letter-spacing`, `line-height`, `line-spacing-extra`, `line-spacing-multiplier`, `number-of-lines`, `ellipsize-mode`, `enable-scale`, `break-strategy`, `text-decoration-color/line/style`, `text-shadow-color/offset/radius`, `vertical-align`
219
-
220
- ### Image
221
-
222
- `src`, `resize-mode`, `tint-color`, `tint-color-blend-mode`, `cap-insets`, `default-source`
223
-
224
- ### Focus State
225
-
226
- `focus-background-color`, `focus-color`, `select-color`, `select-background-color`, `enable-focus-border`, `focus-border`, `focus-border-width`, `focus-border-color`, `focus-border-color-string`, `focus-border-style`, `focus-border-radius`, `focus-border-top-left-radius`, `focus-border-top-right-radius`, `focus-border-bottom-right-radius`, `focus-border-bottom-left-radius`, `focus-border-type`, `enable-black-border`
227
-
228
- ### Input & Other
229
-
230
- `caret-color`, `placeholderTextColor`, `blur`
231
-
232
- ## Focus System (Core)
233
-
234
- TV has no mouse/touch. Users navigate with remote control directional keys.
235
-
236
- ```vue
237
- <div :focusable="true" :focusScale="1.1" :enableFocusBorder="true">
238
- <qt-text text="Button" :duplicateParentState="true" />
239
- </div>
240
- <div :autofocus="true" :focusable="true"></div>
241
- <qt-list-view :autofocusPosition="5"></qt-list-view>
242
- ```
243
-
244
- Focus CSS extensions:
245
-
246
- ```css
247
- .item {
248
- focus-background-color: black;
249
- focus-color: white;
250
- focus-border-radius: 5px;
251
- focus-border-width: 3px;
252
- focus-border-color: red;
253
- enable-focus-border: true;
254
- enable-black-border: true;
255
- select-background-color: blue;
256
- select-color: yellow;
257
- }
258
- ```
259
-
260
- Focus direction: `:nextFocusName="{down:'listC', right:'listB'}"`, `:blockFocusDirections="['left','right']"`, `:descendantFocusability="2"` (disable subtree focus)
261
-
262
- ## Router & Lifecycle
263
-
264
- ```typescript
265
- // routes.ts
266
- const routes = [
267
- { path: "/index", name: "index", component: index },
268
- { path: "/detail", name: "detail", component: detail },
269
- ];
270
-
271
- // main.ts
272
- import { createESRouter } from "@extscreen/es3-router";
273
- const router = createESRouter({
274
- main: "index",
275
- error: "error",
276
- limit: 10,
277
- routes,
278
- });
279
-
280
- // Navigation
281
- const router = useESRouter();
282
- router.push({ name: "detail", params: { id: "123" } });
283
- router.back();
284
- ```
285
-
286
- Page lifecycle (only route-declared components, NO async):
287
-
288
- ```
289
- onESCreate(params) → onESStart() → onESResume() → onESPause() → onESStop() → onESDestroy()
290
- ```
291
-
292
- ## Key Events
293
-
294
- ```typescript
295
- // In setup(), must return these functions
296
- function onKeyDown(keyEvent) {
297
- /* keyEvent.keyCode, keyEvent.action */
298
- }
299
- function onBackPressed() {
300
- router.back();
301
- }
302
- return { onKeyDown, onBackPressed };
303
- ```
304
-
305
- Key codes: DPAD_UP(19), DPAD_DOWN(20), DPAD_LEFT(21), DPAD_RIGHT(22), DPAD_CENTER(23), ENTER(66), BACK(4), MENU(82)
306
-
307
- ## Common Components
308
-
309
- | Component | Purpose | Key Props |
310
- | -------------- | ---------------- | --------------------------------------------------------------------------- |
311
- | qt-button | Button | text, size, focusable, focusScale, disabled, round |
312
- | qt-text | Text | text, fontSize, textColor, focusColor, gravity, lines, duplicateParentState |
313
- | qt-image | Image | src, focusable, enableFade, resizeMode |
314
- | qt-input | Input | hintText, textColor, textSize, strokeWidth, strokeColor |
315
- | qt-waterfall | Waterfall list | enablePlaceholder, blockFocusDirections, autofocusPosition |
316
- | qt-list-view | List | autofocusPosition, blockFocusDirections |
317
- | qt-grid-view | Grid | autofocusPosition |
318
- | qt-tabs | Tabs | defaultIndex, itemList |
319
- | qt-card | Card | load(), reload(), requestCardFocus() |
320
- | qt-seek-bar | Seek bar | progress, range, seekBarMode |
321
- | qt-dialog | Dialog | Global or route-based |
322
- | qt-row | Horizontal flex | flex-direction: row |
323
- | qt-column | Vertical flex | flex-direction: column |
324
- | qt-scroll-view | Scroll container | - |
325
- | qt-animation | Animation | alpha/rotation/scale/translation |
326
-
327
- ## Native Modules
328
-
329
- All from `@extscreen/es3-core`:
330
-
331
- ```typescript
332
- // Storage
333
- const storage = useESLocalStorage();
334
- await storage.putString("key", "value");
335
- await storage.getString("key", "default");
336
-
337
- // Toast
338
- const toast = useESToast();
339
- toast.showToast("message");
340
-
341
- // Device
342
- const device = useESDevice();
343
- device.getScreenWidth() / device.getScreenHeight();
344
-
345
- // Network
346
- const network = useESNetwork();
347
- network.isNetworkConnected();
348
-
349
- // Audio
350
- const audio = useESAudio();
351
- audio.getStreamMusicVolume();
352
-
353
- // Event Bus
354
- const bus = useESEventBus();
355
- bus.on("event", callback);
356
- bus.emit("event", data);
357
- ```
358
-
359
- ## Minimal Page Template
360
-
361
- ```vue
362
- <template>
363
- <div class="page">
364
- <div
365
- class="item"
366
- :focusable="true"
367
- :focusScale="1.1"
368
- :enableFocusBorder="true"
369
- :autofocus="true"
370
- @click="onClick"
371
- >
372
- <qt-text text="Hello TV" :duplicateParentState="true" class="text" />
373
- </div>
374
- </div>
375
- </template>
376
-
377
- <script lang="ts">
378
- import { defineComponent } from "vue";
379
- import { useESRouter } from "@extscreen/es3-router";
380
- export default defineComponent({
381
- setup() {
382
- const router = useESRouter();
383
- function onESCreate(params) {}
384
- function onClick() {}
385
- function onBackPressed() {
386
- router.back();
387
- }
388
- return { onESCreate, onClick, onBackPressed };
389
- },
390
- });
391
- </script>
392
-
393
- <style>
394
- .page {
395
- width: 1920px;
396
- height: 1080px;
397
- background-color: #000000;
398
- }
399
- .item {
400
- width: 300px;
401
- height: 100px;
402
- background-color: #333;
403
- focus-background-color: #0066ff;
404
- }
405
- .text {
406
- width: 300px;
407
- height: 100px;
408
- font-size: 28px;
409
- color: #fff;
410
- }
411
- </style>
412
- ```
413
-
414
- ## Detail Page Template (with params + back key)
415
-
416
- ```vue
417
- <template>
418
- <div class="detail-page">
419
- <qt-text class="detail-title" :text="title" gravity="center" />
420
- <div
421
- class="detail-back-btn"
422
- :focusable="true"
423
- :focusScale="1.1"
424
- :enableFocusBorder="true"
425
- :autofocus="true"
426
- @click="onBackPressed"
427
- >
428
- <qt-text
429
- text="Back"
430
- :duplicateParentState="true"
431
- class="detail-back-text"
432
- gravity="center"
433
- />
434
- </div>
435
- </div>
436
- </template>
437
-
438
- <script lang="ts">
439
- import { defineComponent, ref } from "vue";
440
- import { useESRouter } from "@extscreen/es3-router";
441
- export default defineComponent({
442
- setup() {
443
- const router = useESRouter();
444
- const title = ref("Detail");
445
- function onESCreate(params) {
446
- if (params && params.title) title.value = params.title;
447
- }
448
- function onBackPressed() {
449
- router.back();
450
- }
451
- return { title, onESCreate, onBackPressed };
452
- },
453
- });
454
- </script>
64
+ ---
455
65
 
456
- <style>
457
- .detail-page {
458
- width: 1920px;
459
- height: 1080px;
460
- background-color: #1a1a1a;
461
- align-items: center;
462
- justify-content: center;
463
- }
464
- .detail-title {
465
- width: 600px;
466
- height: 80px;
467
- font-size: 48px;
468
- color: #ffffff;
469
- margin-bottom: 40px;
470
- }
471
- .detail-back-btn {
472
- width: 240px;
473
- height: 70px;
474
- background-color: #333;
475
- focus-background-color: #0066ff;
476
- border-radius: 35px;
477
- align-items: center;
478
- justify-content: center;
479
- }
480
- .detail-back-text {
481
- width: 240px;
482
- height: 70px;
483
- font-size: 26px;
484
- color: #ffffff;
485
- }
486
- </style>
487
- ```
66
+ ## 📚 常用组件与 API (速查)
67
+ * **Back 键**:必须命名为 `onBackPressed`。
68
+ * **生命周期**:必须命名为 `onESCreate`, `onESResume`, `onESDestroy` 等。
69
+ * **焦点**:页面必须有元素设置 `:autofocus="true"`,且容器需设置 `:clipChildren="false"`。
70
+ * **路由**:使用 `useESRouter()`。