@fui-org/fui-cli 1.3.2 → 2.1.0

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 (115) hide show
  1. package/README.md +21 -3
  2. package/dist/fui-cx180e19.js +379 -0
  3. package/dist/fui.js +1 -1
  4. package/package.json +3 -6
  5. package/skills/fui/SKILL.md +9 -41
  6. package/skills/fui-skill/SKILL.md +95 -225
  7. package/skills/fui-skill/assets/projectdefaultstyle-3.0.css +555 -0
  8. package/skills/fui-skill/assets/projectdefaultstyle.css +207 -235
  9. package/skills/fui-skill/references/INDEX.md +105 -137
  10. package/skills/fui-skill/references/advanced-techniques.md +76 -68
  11. package/skills/fui-skill/references/coding-standards.md +56 -56
  12. package/skills/fui-skill/references/component-design.md +166 -173
  13. package/skills/fui-skill/references/component-quickref.md +61 -60
  14. package/skills/fui-skill/references/component-table.md +128 -117
  15. package/skills/fui-skill/references/components-dialog.md +55 -56
  16. package/skills/fui-skill/references/components-display.md +24 -30
  17. package/skills/fui-skill/references/components-echart.md +186 -261
  18. package/skills/fui-skill/references/components-input.md +72 -96
  19. package/skills/fui-skill/references/controls-patterns.md +196 -342
  20. package/skills/fui-skill/references/controls-styling-vocabulary.md +130 -97
  21. package/skills/fui-skill/references/db-table-design.md +24 -28
  22. package/skills/fui-skill/references/db-workflow.md +191 -390
  23. package/skills/fui-skill/references/default-function.md +169 -128
  24. package/skills/fui-skill/references/design-modes.md +35 -63
  25. package/skills/fui-skill/references/echart-templates.md +204 -196
  26. package/skills/fui-skill/references/fastproject.md +62 -60
  27. package/skills/fui-skill/references/fsheet.md +109 -124
  28. package/skills/fui-skill/references/fullstack-workflow.md +90 -128
  29. package/skills/fui-skill/references/module-data-patterns.md +31 -40
  30. package/skills/fui-skill/references/module-json-anatomy.md +47 -52
  31. package/skills/fui-skill/references/module-structure.md +80 -196
  32. package/skills/fui-skill/references/new-session.md +49 -51
  33. package/skills/fui-skill/references/pdfmake.md +17 -17
  34. package/skills/fui-skill/references/permission-system.md +89 -108
  35. package/skills/fui-skill/references/platform-architecture.md +128 -153
  36. package/skills/fui-skill/references/project-config.md +102 -134
  37. package/skills/fui-skill/references/project-provisioning.md +139 -244
  38. package/skills/fui-skill/references/script-map.md +208 -242
  39. package/skills/fui-skill/references/sql-clr-functions.md +98 -97
  40. package/skills/fui-skill/references/system-design.md +63 -88
  41. package/skills/fui-skill/references/tapi-file-api.md +46 -52
  42. package/skills/fui-skill/references/tapi-permission-patterns.md +51 -53
  43. package/skills/fui-skill/references/tapi-reference.md +132 -207
  44. package/skills/fui-skill/references/tools-registry.md +84 -460
  45. package/skills/fui-skill/references/ui-crosswindow-patterns.md +79 -75
  46. package/skills/fui-skill/references/ui-dialog-patterns.md +98 -72
  47. package/skills/fui-skill/references/ui-layout-patterns.md +26 -26
  48. package/skills/fui-skill/references/ui-patterns.md +71 -83
  49. package/skills/fui-skill/references/ui-screenshot-review.md +63 -62
  50. package/skills/fui-skill/references/ui-table-cell-patterns.md +61 -59
  51. package/skills/fui-skill/references/ui-templates.md +16 -23
  52. package/skills/fui-skill/references/verification.md +236 -246
  53. package/skills/fui-skill/references/watcher-patterns.md +30 -63
  54. package/skills/fui-skill/references/websocket-realtime.md +83 -66
  55. package/skills/fui-skill/scripts/component-3.0.js +298 -131
  56. package/skills/fui-skill/scripts/component.js +277 -271
  57. package/skills/fui-skill/scripts/componentTable-3.0.js +182 -53
  58. package/skills/fui-skill/scripts/componentTable.js +171 -49
  59. package/skills/fui-skill/scripts/defaultfunction-3.0.js +88 -3
  60. package/skills/fui-skill/scripts/defaultfunction.js +88 -3
  61. package/skills/fui-skill/scripts/fsheet.js +38 -0
  62. package/skills/fui-target/.claude-plugin/plugin.json +6 -0
  63. package/skills/fui-target/hooks/hooks.json +1 -0
  64. package/skills/fui-target/hooks/register.tsx +71 -0
  65. package/skills/fui-target/types/index.d.ts +7 -0
  66. package/dist/fui-y8an39cn.js +0 -420
  67. package/skills/fui-skill/README.md +0 -112
  68. package/skills/fui-skill/metadata.json +0 -75
  69. package/skills/fui-skill-cli/SKILL.md +0 -139
  70. package/skills/fui-skill-cli/references/INDEX.md +0 -110
  71. package/skills/fui-skill-cli/references/advanced-techniques.md +0 -168
  72. package/skills/fui-skill-cli/references/coding-standards.md +0 -112
  73. package/skills/fui-skill-cli/references/component-design.md +0 -448
  74. package/skills/fui-skill-cli/references/component-quickref.md +0 -78
  75. package/skills/fui-skill-cli/references/component-table.md +0 -248
  76. package/skills/fui-skill-cli/references/components-dialog.md +0 -191
  77. package/skills/fui-skill-cli/references/components-display.md +0 -141
  78. package/skills/fui-skill-cli/references/components-echart.md +0 -316
  79. package/skills/fui-skill-cli/references/components-input.md +0 -335
  80. package/skills/fui-skill-cli/references/controls-patterns.md +0 -701
  81. package/skills/fui-skill-cli/references/controls-styling-vocabulary.md +0 -137
  82. package/skills/fui-skill-cli/references/db-table-design.md +0 -73
  83. package/skills/fui-skill-cli/references/db-workflow.md +0 -288
  84. package/skills/fui-skill-cli/references/default-function.md +0 -425
  85. package/skills/fui-skill-cli/references/design-modes.md +0 -57
  86. package/skills/fui-skill-cli/references/echart-templates.md +0 -489
  87. package/skills/fui-skill-cli/references/fastproject.md +0 -99
  88. package/skills/fui-skill-cli/references/fsheet.md +0 -203
  89. package/skills/fui-skill-cli/references/fullstack-workflow.md +0 -313
  90. package/skills/fui-skill-cli/references/module-data-patterns.md +0 -117
  91. package/skills/fui-skill-cli/references/module-json-anatomy.md +0 -132
  92. package/skills/fui-skill-cli/references/module-structure.md +0 -141
  93. package/skills/fui-skill-cli/references/new-session.md +0 -85
  94. package/skills/fui-skill-cli/references/pdfmake.md +0 -60
  95. package/skills/fui-skill-cli/references/permission-system.md +0 -150
  96. package/skills/fui-skill-cli/references/platform-architecture.md +0 -269
  97. package/skills/fui-skill-cli/references/project-config.md +0 -303
  98. package/skills/fui-skill-cli/references/project-provisioning.md +0 -278
  99. package/skills/fui-skill-cli/references/script-map.md +0 -262
  100. package/skills/fui-skill-cli/references/sql-clr-functions.md +0 -225
  101. package/skills/fui-skill-cli/references/system-design.md +0 -89
  102. package/skills/fui-skill-cli/references/tapi-file-api.md +0 -185
  103. package/skills/fui-skill-cli/references/tapi-permission-patterns.md +0 -156
  104. package/skills/fui-skill-cli/references/tapi-reference.md +0 -474
  105. package/skills/fui-skill-cli/references/tools-registry.md +0 -84
  106. package/skills/fui-skill-cli/references/ui-crosswindow-patterns.md +0 -321
  107. package/skills/fui-skill-cli/references/ui-dialog-patterns.md +0 -255
  108. package/skills/fui-skill-cli/references/ui-layout-patterns.md +0 -176
  109. package/skills/fui-skill-cli/references/ui-patterns.md +0 -303
  110. package/skills/fui-skill-cli/references/ui-screenshot-review.md +0 -95
  111. package/skills/fui-skill-cli/references/ui-table-cell-patterns.md +0 -318
  112. package/skills/fui-skill-cli/references/ui-templates.md +0 -22
  113. package/skills/fui-skill-cli/references/verification.md +0 -236
  114. package/skills/fui-skill-cli/references/watcher-patterns.md +0 -163
  115. package/skills/fui-skill-cli/references/websocket-realtime.md +0 -271
@@ -1,35 +1,31 @@
1
- # module.json Anatomy — 4 thành phần: data · watch · controls · set
1
+ # module.json Anatomy — data · watch · controls · set
2
2
 
3
- > File này sở hữu: **4 thành phần `module.json` (data/watch/controls/set) — vai trò và cách chúng tương tác, checklist cấu trúc**. Cú pháp action/control chi tiết xem [controls-patterns.md](controls-patterns.md).
3
+ > Owns: **the 4 `module.json` blocks (data/watch/controls/set) — roles, interaction, structure checklist**. Action/control syntax: [controls-patterns.md](controls-patterns.md).
4
4
 
5
- `module.json` mô tả một trang FUI. Nó có đúng **4 khối cấp 1**. File này giải thích *vai trò, cách cấu hình, tác động* và *tương tác* giữa chúng, rồi trỏ tới file chuyên sâu cho từng loại pattern.
6
-
7
- > Cơ chế nền tảng (runtime đọc module.json thế nào): [platform-architecture.md](platform-architecture.md). Pattern UI thực tế (ưu tiên cao, đã tinh chỉnh qua thực chiến): [ui-patterns.md](ui-patterns.md).
5
+ `module.json` describes one FUI page with exactly **4 top-level blocks**. Runtime internals: [platform-architecture.md](platform-architecture.md). Battle-tested UI patterns (high priority): [ui-patterns.md](ui-patterns.md).
8
6
 
9
7
  ```json
10
8
  {
11
- "data": [ /* state + action */ ],
12
- "watch": { /* observer → action */ },
13
- "controls": [ /* layout UI: container > rows > cols */ ],
14
- "set": { /* override config trang (tùy chọn) */ }
9
+ "data": [/* state + action */],
10
+ "watch": {/* observer → action */},
11
+ "controls": [/* layout UI: container > rows > cols */],
12
+ "set": {/* override config trang (tùy chọn) */}
15
13
  }
16
14
  ```
17
15
 
18
- Runtime chạy: `runAction(data)` → `buildModuleUI(controls)` → gắn `watch` → merge `set` vào config trang. Tất cả state sống trong `vueData`.
16
+ Runtime order: `runAction(data)` → `buildModuleUI(controls)` → attach `watch` → merge `set` into page config. All state lives in `vueData`.
19
17
 
20
18
  ---
21
19
 
22
- ## 1. `data` — Mảng khởi tạo state + định nghĩa Action
23
-
24
- **Là gì:** một **mảng**. FUI xử lý tuần tự từ trên xuống khi trang load.
20
+ ## 1. `data` — state init + action definitions
25
21
 
26
- **Ba loại phần tử trong `data[]`:**
22
+ An **array**, processed top to bottom on page load. Three element kinds:
27
23
 
28
- | Loại object | Nhận biết | Tác động |
29
- |---|---|---|
30
- | Khởi tạo state | Không có key action (`API`/`CALL`/`IF`...) | Tạo biến reactive trong `vueData` |
31
- | Named action | Key là tên hàm, value là object action | Định nghĩa action tái sử dụng (gọi qua `CALL`) |
32
- | Auto-startup | `{ "API": ... }` hoặc `{ "CALL": ... }` đứng riêng | **Tự chạy** ngay khi load |
24
+ | Object kind | Recognized by | Effect |
25
+ | ------------ | ------------------------------------------------ | ----------------------------------- |
26
+ | State init | No action key (`API`/`CALL`/`IF`...) | Creates reactive var in `vueData` |
27
+ | Named action | Key = function name, value = action object | Reusable action (invoke via `CALL`) |
28
+ | Auto-startup | Standalone `{ "API": ... }` or `{ "CALL": ... }` | **Runs immediately** on load |
33
29
 
34
30
  ```json
35
31
  "data": [
@@ -41,15 +37,15 @@ Runtime chạy: `runAction(data)` → `buildModuleUI(controls)` → gắn `watch
41
37
  ]
42
38
  ```
43
39
 
44
- **Tác động:** mọi biến khai báo ở đây thành reactive state; action đặt tên ở đây gọi được từ `watch`, `controls`, hay action khác. Auto-startup ở cuối = dữ liệu ban đầu của trang.
40
+ Named actions are callable from `watch`, `controls` or other actions; trailing auto-startup = initial page data.
45
41
 
46
- **Chi tiết:** khai báo `data[]` + value resolution (chuỗi/biến/backtick/`{{ }}`/deep key, action tự chạy, named action, `v_old`) → **[module-data-patterns.md](module-data-patterns.md)**; engine action → [controls-patterns.md](controls-patterns.md); tổ chức data thực tế → [ui-patterns.md](ui-patterns.md) §1–2.
42
+ Details: `data[]` declaration + value resolution (string/var/backtick/`{{ }}`/deep key, auto-run, named action, `v_old`) → **[module-data-patterns.md](module-data-patterns.md)**; action engine → [controls-patterns.md](controls-patterns.md); real-world data layout → [ui-patterns.md](ui-patterns.md) §1–2.
47
43
 
48
44
  ---
49
45
 
50
- ## 2. `watch` — Observer: state đổi → chạy action
46
+ ## 2. `watch` — state change → run action
51
47
 
52
- **Là gì:** một **object** `{ "tênBiến": action }`. Khi biến đổi giá trị, action chạy.
48
+ An **object** `{ "varName": action }`; action runs when the var changes.
53
49
 
54
50
  ```json
55
51
  "watch": {
@@ -59,18 +55,17 @@ Runtime chạy: `runAction(data)` → `buildModuleUI(controls)` → gắn `watch
59
55
  }
60
56
  ```
61
57
 
62
- **Tác động & mẫu dùng:**
63
- - **Cascading filter**: mỗi dropdown lọc có một watch → tự reload bảng khi đổi.
64
- - Nhiều action cho một biến → dùng **mảng**.
65
- - **`deep-watch`**: theo dõi thay đổi sâu bên trong object/array (runtime hỗ trợ key `deep-watch`).
58
+ - **Cascading filter**: one watch per filter dropdown → table reloads on change.
59
+ - Multiple actions for one var → use an **array**.
60
+ - **`deep-watch`**: tracks nested changes inside object/array (runtime supports the `deep-watch` key).
66
61
 
67
- **Chi tiết:** [watcher-patterns.md](watcher-patterns.md) (v_old, deep-watch, cascading), [ui-patterns.md](ui-patterns.md) §3.
62
+ Details: [watcher-patterns.md](watcher-patterns.md) (v_old, deep-watch, cascading), [ui-patterns.md](ui-patterns.md) §3.
68
63
 
69
64
  ---
70
65
 
71
- ## 3. `controls` — Layout UI (bắt buộc grid container > rows > cols)
66
+ ## 3. `controls` — UI layout (mandatory grid container > rows > cols)
72
67
 
73
- **Là gì:** một **mảng** container. Runtime dựng: `container (v-container)` → `rows (v-layout)` → `cols` → mỗi phần tử là một **Control Object**.
68
+ An **array** of containers. Runtime builds `container (v-container)` → `rows (v-layout)` → `cols` → each item is a **Control Object**.
74
69
 
75
70
  ```json
76
71
  "controls": [
@@ -83,25 +78,25 @@ Runtime chạy: `runAction(data)` → `buildModuleUI(controls)` → gắn `watch
83
78
  ]
84
79
  ```
85
80
 
86
- **Control Object** — các key chính:
81
+ Control Object keys:
87
82
 
88
- | Key | Vai trò |
89
- |---|---|
90
- | `el` | Tag/component: `div`, `v-*` (Vuetify), `f-*`/`t-*` (FUI), `uc-*` (custom) |
91
- | `attr` | Thuộc tính/directive (`class`, `style`, `v-model`, `v-on:click`) — **dùng `v-on:click`, KHÔNG `@click`** |
92
- | `w` | Bề rộng cột: `1–12` (grid) hoặc `>= 25` (px, **bắt buộc kèm `col: { "class": "shrink" }`**). Không dùng 13–24. Bắt buộc cho item trong `cols` |
93
- | `col` | Cấu hình cột grid bao ngoài (`class`, `style`, `v-if`) |
94
- | `innerHTML` | Nội dung: string (hỗ trợ `{{ }}`) hoặc mảng Control Object lồng nhau |
83
+ | Key | Role |
84
+ | ----------- | -------------------------------------------------------------------------------------------------------------------------------------- |
85
+ | `el` | Tag/component: `div`, `v-*` (Vuetify), `f-*`/`t-*` (FUI), `uc-*` (custom) |
86
+ | `attr` | Attributes/directives (`class`, `style`, `v-model`, `v-on:click`) — **use `v-on:click`, NOT `@click`** |
87
+ | `w` | Column width: `1–12` (grid) or `>= 25` (px, **requires `col: { "class": "shrink" }`**). Never 13–24. Required for every item in `cols` |
88
+ | `col` | Wrapping grid column config (`class`, `style`, `v-if`) |
89
+ | `innerHTML` | Content: string (supports `{{ }}`) or array of nested Control Objects |
95
90
 
96
- **Tác động:** đây là toàn bộ giao diện trang. Quy tắc bắt buộc: luôn bắt đầu bằng grid wrapper; dùng `innerHTML` (mảng) để lồng, không dùng `children`; dialog đặt trong container `prop: "hidden-container"`.
91
+ Mandatory: always start with the grid wrapper; nest via `innerHTML` (array), never `children`; put dialogs in a container with `prop: "hidden-container"`.
97
92
 
98
- **Chi tiết:** cấu trúc & grid → [controls-patterns.md](controls-patterns.md) §6; **class/prop/style được dùng (đừng tự thêm style)** → [controls-styling-vocabulary.md](controls-styling-vocabulary.md); chọn component → [component-quickref.md](component-quickref.md); pattern layout/table/dialog → [ui-patterns.md](ui-patterns.md), [ui-table-cell-patterns.md](ui-table-cell-patterns.md), [ui-dialog-patterns.md](ui-dialog-patterns.md), [ui-layout-patterns.md](ui-layout-patterns.md).
93
+ Details: structure & grid → [controls-patterns.md](controls-patterns.md) §6; **allowed class/prop/style (don't invent styles)** → [controls-styling-vocabulary.md](controls-styling-vocabulary.md); picking components → [component-quickref.md](component-quickref.md); layout/table/dialog patterns → [ui-patterns.md](ui-patterns.md), [ui-table-cell-patterns.md](ui-table-cell-patterns.md), [ui-dialog-patterns.md](ui-dialog-patterns.md), [ui-layout-patterns.md](ui-layout-patterns.md).
99
94
 
100
95
  ---
101
96
 
102
- ## 4. `set` — Override config cho riêng trang (tùy chọn)
97
+ ## 4. `set` — per-page config override (optional)
103
98
 
104
- **Là gì:** một **object** override config cấp project cho trang này. Runtime trộn `project.json` rồi `set` (module thắng) — xem [platform-architecture.md](platform-architecture.md) §2.1.
99
+ An **object** overriding project config for this page. Runtime merges `project.json` then `set` (module wins) — see [platform-architecture.md](platform-architecture.md) §2.1.
105
100
 
106
101
  ```json
107
102
  "set": {
@@ -110,13 +105,13 @@ Runtime chạy: `runAction(data)` → `buildModuleUI(controls)` → gắn `watch
110
105
  }
111
106
  ```
112
107
 
113
- **Tác động:** chỉ khai báo field khác với project. Thường dùng: `title` (tiêu đề trang), `menu: false` (ẩn header — sub-window/landing), `menuLeft` (sidebar riêng), `apiDomain` (đổi backend trang đó). Trang bình thường **không cần `set`** (kế thừa hết project).
108
+ Declare only fields differing from the project. Common: `title`, `menu: false` (hide header — sub-window/landing), `menuLeft` (own sidebar), `apiDomain` (different backend for this page). Normal pages **need no `set`**.
114
109
 
115
- **Chi tiết & danh mục thuộc tính đầy đủ:** [project-config.md](project-config.md).
110
+ Full property list: [project-config.md](project-config.md).
116
111
 
117
112
  ---
118
113
 
119
- ## Tương tác giữa 4 thành phần
114
+ ## How the 4 blocks interact
120
115
 
121
116
  ```
122
117
  URL ?param ──► vueData[param] (inject trước khi data chạy)
@@ -126,12 +121,12 @@ watch ──► state đổi → chạy action → cập nhật state kh
126
121
  set ──► quyết định khung trang (title/menu/apiDomain) bao quanh controls
127
122
  ```
128
123
 
129
- Vòng lặp điển hình: user thao tác trên `controls` → đổi state → `watch` bắt → gọi `API` action trong `data` → `OUT` cập nhật state → `controls` render lại.
124
+ Typical loop: user acts on `controls` → state changes → `watch` fires → `API` action in `data` → `OUT` updates state → `controls` re-render.
130
125
 
131
- ## Checklist khi viết module.json
126
+ ## Checklist
132
127
 
133
- 1. `data[]`: state trước → named action → `{ "CALL": ... }` auto-startup cuối
134
- 2. `watch`: mọi filter/dropdown đều có watch → reload
135
- 3. `controls`: bắt đầu bằng grid wrapper; `w` cho mọi item; dialog trong `hidden-container`; `v-on:click` không `@click`
136
- 4. `set`: chỉ khai báo khi trang khác project default
137
- 5. Tham chiếu state bằng `vueData.` trong controls/attr; JSON hợp lệ (không trailing comma)
128
+ 1. `data[]`: state first → named actions → `{ "CALL": ... }` auto-startup last
129
+ 2. `watch`: every filter/dropdown has a watch → reload
130
+ 3. `controls`: start with grid wrapper; `w` on every item; dialogs in `hidden-container`; `v-on:click` not `@click`
131
+ 4. `set`: only when the page differs from project defaults
132
+ 5. Reference state as `vueData.` in controls/attr; valid JSON (no trailing commas)
@@ -1,17 +1,12 @@
1
- # Module Structure (Canonical for Workspace and Chat)
1
+ # Module Structure
2
2
 
3
- > File này sở hữu: **cây thư mục project/module, trách nhiệm từng file, `_moduleInfo.json`/`mTitle`, chế độ `HTMLOnly`, meta tag mặc định**. Quy tắc viết `uc-*.vue` xem [component-design.md](component-design.md); nội dung bên trong `module.json` xem [controls-patterns.md](controls-patterns.md). *(Tier A — luôn nạp cùng `skill_get`.)*
3
+ > Owns: project/module tree, per-file duties, `_moduleInfo.json`/`mTitle`, `HTMLOnly`, default meta tags. `uc-*.vue` rules: [component-design.md](component-design.md); `module.json` content: [controls-patterns.md](controls-patterns.md). _(Tier A — loaded with `fui skill get`.)_
4
4
 
5
- Use this structure when creating, refactoring, or reviewing a FUI module.
5
+ Use when creating, refactoring or reviewing a module. With workspace access it is the real folder layout; in chat, use it to organize the response without assuming files exist.
6
6
 
7
- - In editor or extension contexts with workspace access, apply it as the real local folder structure.
8
- - In chat or agent-chat contexts, use it to virtualize the same module structure and organize the response, without assuming the files already exist on disk.
7
+ ## Local Structure
9
8
 
10
- ## Canonical Local Structure
11
-
12
- The workspace is organized at two levels: **project** and **module**.
13
-
14
- ### Project-level (root of a checked-out project)
9
+ ### Project-level
15
10
 
16
11
  ```text
17
12
  {projectId}/
@@ -22,20 +17,23 @@ The workspace is organized at two levels: **project** and **module**.
22
17
  |-- components/ # Project-scope Vue components
23
18
  | |-- _components.json # Component registry
24
19
  | `-- uc-*.vue # Project-level custom components
20
+ |-- _db/ # Local DB workspace (see db-workflow.md)
21
+ | |-- _connections.json # v2 registry; key = friendly connectionName/folder
22
+ | `-- {connectionName}/ # schema.json + stored-procedure .sql files
25
23
  |-- modules/ # All modules in this project
26
24
  | |-- _modules.json # Module list metadata
27
25
  | `-- {moduleId}/ # One folder per module (see module-level below)
28
26
  `-- skills/ # FUI skill files (auto-copied on checkout)
29
27
  ```
30
28
 
31
- ### Module-level (inside `modules/{moduleId}/`)
29
+ ### Module-level (`modules/{moduleId}/`)
32
30
 
33
31
  ```text
34
32
  {moduleId}/
35
33
  |-- _moduleInfo.json # Required: module metadata + mTitle (page title) + HTMLOnly
36
34
  |-- module.json # Required: data/watch/controls/set (unused when HTMLOnly=true)
37
35
  |-- script.js # Recommended: helper logic for FUN/EXE/chart/transform
38
- |-- style.css # Optional: module-wide CSS (published via module_publish_css)
36
+ |-- style.css # Optional: module-wide CSS (published via fui module publish css)
39
37
  |-- header.html # Full <head> content: <link>, <style>, <script> tags
40
38
  |-- body.html # HTMLOnly=false: supplementary body HTML
41
39
  | # HTMLOnly=true: entire page content (custom HTML/Vue app)
@@ -46,215 +44,101 @@ The workspace is organized at two levels: **project** and **module**.
46
44
  `-- uc-*.vue # Custom components (prefix uc-)
47
45
  ```
48
46
 
49
- ## Chat-Safe Usage
50
-
51
- When working without local workspace access:
52
-
53
- 1. Present this tree as the canonical module layout, not as a claimed filesystem state.
54
- 2. Return file contents in separate code blocks or clearly labeled sections.
55
- 3. Ask the user to paste `_moduleInfo.json`, `module.json`, `script.js`, or component files when a review or patch depends on existing code.
56
- 4. Scope recommendations to the files actually provided instead of inventing unseen surrounding files.
57
-
58
- ## Required vs Optional
59
-
60
- 1. Required (module-level):
61
- - `_moduleInfo.json`
62
- - `module.json`
63
-
64
- 2. Recommended:
65
- - `script.js`
66
- - `imports/_imports.json`
67
-
68
- 3. Optional by use-case:
69
- - `header.html`
70
- - `body.html`
71
- - `style.css`
72
- - `components/` (with `_components.json` and `uc-*.vue`)
73
-
74
- ## File Responsibilities
75
-
76
- ### module.json (core)
77
- - Keep all runtime config in `data`, `watch`, `controls`, `set`.
78
- - Keep `controls` under FUI grid wrapper (`container > rows > cols`).
79
- - Keep business actions in `data` and trigger with `CALL`.
80
- - **When `HTMLOnly=true`: leave this file empty (`data:[], watch:{}, controls:[], set:{}`). The FUI runtime does not use it.**
81
- - **JSON content patterns** (data[], watch, controls, actions, dialogs, navigation): see [`examples/module-patterns.json`](../examples/module-patterns.json)
82
- - **f-table props and header types**: see [`examples/f-table-patterns.json`](../examples/f-table-patterns.json)
83
-
84
- ### script.js (helper logic)
85
- - Move complex transforms, chart builders, debounce helpers, parsing logic here.
86
- - Expose functions for `FUN` actions or template helpers.
87
- - Avoid large inline `EXE` blocks in `module.json` when reusable function is possible.
88
-
89
- ### style.css (module-wide CSS)
90
- - CSS not tied to a single component — shared/global rules for the module.
91
- - Published via `module_publish_css` (mirrors `script.js`/`module_publish_script`); does not auto-clear on `module_publish_html` if left empty.
92
- - Component-local CSS belongs in the component's own `<style scoped>` (see [component-design.md](component-design.md)), not here.
93
-
94
- ### _moduleInfo.json (metadata)
95
- - Keep `ProjectID`, `ModuleID`, `ModuleName`, `Framework` accurate.
96
- - Contains `mTitle` (page title). To update the module's page title, edit the `mTitle` field in `_moduleInfo.json`. This value is sent to the server as `title` when publishing via `module_publish_html`.
97
- - Contains `HTMLOnly` (boolean). **Read this first before deciding how to structure the module.**
98
-
99
- ### header.html (head content)
100
- - Contains everything that goes **inside** the `<head>` tag — do NOT include the `<head>` wrapper itself.
101
- - Can contain: `<link>` CSS imports, `<style>` blocks, `<script>` imports, `<meta>` tags.
102
- - Do NOT put a `<title>` tag here — page title is managed via `mTitle` in `_moduleInfo.json`.
103
- - **Default meta tags — already present on every FUI page, do NOT repeat them in header.html:**
104
- ```html
105
- <meta charset="UTF-8"/>
106
- <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover"/>
107
- ```
108
- These defaults affect UI design decisions: `user-scalable=no, maximum-scale=1` means users **cannot pinch-zoom** — fonts/buttons must be readable and tappable at natural size on mobile; `width=device-width, initial-scale=1` makes Vuetify breakpoints behave per real device CSS pixels; `viewport-fit=cover` lets the page extend into the iOS notch/home-indicator area — fullscreen/`HTMLOnly` layouts touching top/bottom edges need `env(safe-area-inset-*)` padding.
109
- - For `HTMLOnly=false`: typically only CSS (`<link>` and `<style>`). Framework and project-level scripts are injected automatically by the server.
110
- - For `HTMLOnly=true`: **you must bring your own runtime** — see [HTMLOnly=true: KHÔNG có thư viện nào được nhúng sẵn](#htmlonlytrue-không-có-thư-viện-nào-được-nhúng-sẵn) below before writing a single tag.
111
-
112
- ### body.html (body content)
113
- - Contains everything that goes **inside** the `<body>` tag — do NOT include the `<body>` wrapper itself.
114
- - **When `HTMLOnly=false`**: supplementary HTML rendered alongside the FUI Vue runtime. Usually empty or minimal.
115
- - **When `HTMLOnly=true`**: the **entire page content**. Can be plain HTML or a fully custom Vue app (own `<div id="app">`, own `<v-app>`, etc.). The FUI default Vue mount point is hidden in this mode.
116
- - Both `header.html` and `body.html` store only the **inner content** (no wrapper tags). The server strips wrappers automatically on save, and the publish tool does the same preprocessing.
117
-
118
- ### imports/_imports.json (module imports)
119
- - Declares module-scope JS/CSS import files.
120
- - Each entry: `{ name, type, contentType, fileID, scope, sort }`.
121
- - `sort` — thứ tự load. **Khi thêm import mới: đặt `sort` từ 40 trở lên** (40, 50, 60...). Giá trị nhỏ (1–39) dành cho import hệ thống/framework được load trước — không dùng để tránh xung đột.
122
- - Only module-scope imports are stored here (project-scope imports are at `{projectId}/imports/_imports.json`).
123
-
124
- ### components/_components.json
125
- - Register `uc-*` components.
126
- - Follow upsert rule:
127
- - Before publish: may only have `comName`.
128
- - After publish/sync: `comID` is server-managed.
129
- - Do not handcraft random `comID`.
130
-
131
- ### components/uc-*.vue
132
- - Use `uc-` prefix for custom components.
133
- - Keep component-specific UI complexity here instead of bloating `module.json`.
134
- - Prefer reusable component contracts: props for input, emits for output, slots for extensibility.
135
- - Avoid baking page-specific API calls or route logic into the component unless that coupling is intentional and unavoidable.
136
- - `<style scoped>` blocks are allowed, but `scoped` has no real scoping effect — every selector must be manually prefixed with a unique class matching the component name. See [component-design.md](component-design.md) for the full rule and example.
137
- - Never use backtick template strings inside the component `<template>`.
138
-
139
- ### _projectInfo.json (project metadata)
140
- - Saved at project root on checkout (`{projectId}/_projectInfo.json`).
141
- - Contains `ProjectID`, `ProjectName`, `GroupName`, `Framework`, `pDomain`, `fetchedAt`.
142
- - Read-only for module editing — do not modify.
143
-
144
- ### project.json (project config)
145
- - Contains a single `data` object — project-level defaults for all modules: `apiDomain`, `login`, `userInfo`, `menu`, `menuLeft`, `menuStyle`, `menuComponent`, `domainSetting`, etc.
146
- - **Relationship with `module.json` `set`**: runtime merges `project.json data` + `module.json set`, with module values taking priority. A module only needs to declare fields that differ from the project default.
147
- - See [project-config.md](project-config.md) for full field reference, menu item structure, and `right` permission rules.
148
-
149
- ## Naming and Prefix Rules
150
-
151
- 1. Module folder name:
152
- - Use the same module ID naming used by project conventions.
153
-
154
- 2. Custom component file:
155
- - Use `uc-*.vue` kebab-case.
156
-
157
- 3. Component usage in `module.json`:
158
- - Use `el: "uc-..."` for custom components.
159
- - Keep prop binding in `attr` with kebab-case prop names.
47
+ Required: `_moduleInfo.json`, `module.json`. Recommended: `script.js`, `imports/_imports.json`. Optional: `header.html`, `body.html`, `style.css`, `components/`.
160
48
 
161
- ## HTMLOnly Mode
49
+ ## Chat Without Workspace
162
50
 
163
- `HTMLOnly` is a boolean flag in `_moduleInfo.json`. **Always check this first** before editing a module.
51
+ - Present the tree as canonical layout, not actual disk state; return each file in its own labeled code block.
52
+ - Ask the user to paste `_moduleInfo.json`, `module.json`, `script.js` or components when a review/patch depends on them. Scope advice to provided files; never invent unseen ones.
164
53
 
165
- ### HTMLOnly=false (default — FUI Vue module)
54
+ ## File Duties
166
55
 
167
- - `module.json` is the core: FUI runtime reads `data`, `watch`, `controls`, `set` and bootstraps a Vue app.
168
- - `body.html` is supplementary HTML rendered in the body alongside the Vue controls (often empty).
169
- - `header.html` typically contains CSS only (`<link>`, `<style>`). Framework and project-level scripts are auto-injected by the server.
170
- - Vue components (`uc-*.vue`) are fully supported.
171
- - `script.js` exposes helper functions used by `FUN`/`EXE` actions.
56
+ **module.json** — all runtime config in `data`, `watch`, `controls`, `set`; `controls` inside grid wrapper (`container > rows > cols`); business actions in `data`, triggered by `CALL`. Patterns: [`examples/module-patterns.json`](../examples/module-patterns.json); f-table props/header types: [`examples/f-table-patterns.json`](../examples/f-table-patterns.json).
172
57
 
173
- ### HTMLOnly=true (custom HTML/Vue page)
58
+ **script.js** — complex transforms, chart builders, debounce, parsing; expose functions for `FUN`/`EXE` and template helpers. Prefer a reusable function over large inline `EXE`.
174
59
 
175
- - `module.json` is **ignored** at runtime — keep it empty (`data:[], watch:{}, controls:[], set:{}`).
176
- - `body.html` is the **entire page content**. The developer has full control — can write plain HTML or a completely custom Vue app (own `<div id="app">`, own `<v-app>`, own Vue instance).
177
- - Do NOT attempt to use FUI's `controls`/`data`/`watch` JSON system — it has no effect.
178
- - Use this mode for: standalone tools, custom editors, pages that need their own runtime or layout that doesn't fit the FUI grid system.
179
- - **Full-height layout**: nếu trang có `menu` hiển thị (không phải `set.menu: false`), thanh menu chiếm 48px cố định — mọi CSS `height: 100vh` hay `calc(100vh - Npx)` trên container gốc phải cộng thêm 48px vào phần trừ. Xem [project-config.md](project-config.md) §menu.
60
+ **style.css** — module-wide CSS not tied to one component. Publish with `fui module publish css`; an empty file is not auto-cleared by `fui module publish html`. Component-local CSS goes in the component's `<style scoped>`.
180
61
 
181
- #### HTMLOnly=true: KHÔNG có thư viện nào được nhúng sẵn
62
+ **\_moduleInfo.json** — keep `ProjectID`, `ModuleID`, `ModuleName`, `Framework` accurate. `mTitle` is the page title (edit it here; sent as `title` by `fui module publish html`). Read `HTMLOnly` before structuring anything.
63
+
64
+ **header.html** — inner `<head>` content only (`<link>`, `<style>`, `<script>`, `<meta>`); no wrapper, no `<title>` (use `mTitle`). `HTMLOnly=false`: usually CSS only; server injects framework and project scripts. `HTMLOnly=true`: bring your own runtime — read [HTMLOnly=true: no library is embedded](#htmlonlytrue-no-library-is-embedded) first. These meta tags are on every page — never repeat them:
65
+
66
+ ```html
67
+ <meta charset="UTF-8" />
68
+ <meta
69
+ name="viewport"
70
+ content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover"
71
+ />
72
+ ```
182
73
 
183
- Đây là điều hay bị hiểu sai nhất về chế độ này, và hiểu sai thì **không có lỗi nào nổi lên lúc
184
- viết** — chỉ là trang trắng sau khi deploy.
74
+ - No pinch-zoom → fonts/buttons must be readable and tappable at natural size on mobile.
75
+ - Vuetify breakpoints follow real device CSS pixels.
76
+ - `viewport-fit=cover` → fullscreen/`HTMLOnly` layouts touching top/bottom need `env(safe-area-inset-*)` padding (iOS notch/home indicator).
185
77
 
186
- Với `HTMLOnly=true`, server chỉ phát ra **ba** thứ:
78
+ **body.html** — inner `<body>` content only. `HTMLOnly=false`: supplementary HTML beside the Vue runtime, usually empty. `HTMLOnly=true`: the whole page (plain HTML or own Vue app with own `<div id="app">`/`<v-app>`); FUI's default mount point is hidden. Server and publish command strip `<head>`/`<body>` wrappers.
187
79
 
188
- 1. import **của chính module này** (`{moduleId}/imports/_imports.json`),
189
- 2. StyleCSS **cấp module** (`style.css` + `<style>` của `uc-*.vue` cấp module),
190
- 3. bundle `moduledata` (`$moduleUI` + `script.js` + component cấp module).
80
+ **imports/\_imports.json** — module-scope JS/CSS imports; entry `{ name, type, contentType, fileID, scope, sort }`. `sort` = load order: new imports use **>= 40** (40, 50, 60…); 1–39 is reserved for system/framework. Project-scope imports live in `{projectId}/imports/_imports.json`.
191
81
 
192
- Tất cả những thứ sau **KHÔNG** được nhúng — kể cả khi project đang khai chúng:
82
+ **components/\_components.json** — registers `uc-*`. Before publish an entry may hold only `comName`; `comID` is server-managed after publish/sync. Never invent `comID`.
193
83
 
194
- | Không có | Hệ quả nếu bạn cứ giả định là có |
195
- |---|---|
196
- | Framework V2/V3 — `vue.global.min.js`, `vuetify*.js/css`, `fastproject*.js`, `component*.js`, `defaultfunction*.js` | `Vue is not defined`, `<v-btn>` không render, `f-*`/`t-*` không tồn tại |
197
- | jQuery, lodash (`_`), `moment`/`dayjs`, `numeral`, `jquery-confirm` | `$ is not defined`, `_ is not defined` |
198
- | Roboto, Material Design Icons (`mdi-*`) | chữ sai font, icon thành ô vuông trống |
199
- | `projectdata` bundle — `$projectData`, `$projectGroupSetting`, component cấp **project** | `apiDomain`/`menu`/`login` đều undefined; `uc-*` cấp project là unknown element |
200
- | StyleCSS cấp **project**, `projectdefaultstyle.css` | mất toàn bộ class dùng chung của project (kể cả `.shrink`) |
201
- | `<div id="fastProjectAPP">` | không có mount point sẵn — bạn phải tự dựng gốc trong `body.html` |
84
+ **components/uc-\*.vue** — `uc-` prefix, kebab-case. Hold component UI complexity here, not in `module.json`. Contract: props in, emits out, slots to extend. No page-specific API/route logic unless the coupling is intentional and unavoidable. `scoped` does not really scope: prefix every selector with a unique class matching the component name ([component-design.md](component-design.md)). No backtick template strings in `<template>`.
202
85
 
203
- **Quy tắc:** cần thư viện nào thì tự khai thư viện đó, **cho từng module HTMLOnly một** — khai ở
204
- cấp project không giúp gì cả. Hai cách, dùng cách nào cũng được:
86
+ **\_projectInfo.json** — written on checkout (`ProjectID`, `ProjectName`, `GroupName`, `Framework`, `pDomain`, `fetchedAt`). Read-only.
87
+
88
+ **project.json** — one `data` object of project defaults (`apiDomain`, `login`, `userInfo`, `menu`, `menuLeft`, `menuStyle`, `menuComponent`, `domainSetting`, …). Runtime merges it with `module.json` `set`; module wins, so declare only differences. Fields, menu items, `right` rules: [project-config.md](project-config.md).
89
+
90
+ ## Naming
91
+
92
+ - Module folder: project's module ID convention.
93
+ - Use a component in `module.json` via `el: "uc-..."`, props in `attr` with kebab-case names.
94
+
95
+ ## HTMLOnly Mode
205
96
 
206
- - khai vào `imports/_imports.json` của module (`file_import_new`, `sort >= 40`) — nên dùng, vì
207
- nó hiện ra trong `file_import_list` và trong báo cáo `module_simulate({renderUI:true})`;
208
- - hoặc viết thẳng `<link>`/`<script>` vào `header.html` — tự do hơn, nhưng không tool nào liệt kê
209
- được cho bạn.
97
+ Boolean in `_moduleInfo.json`. **Check it first.**
210
98
 
211
- Hệ quả bị bỏ sót thường xuyên: **[script-map.md](script-map.md) không áp dụng ở chế độ này.** File
212
- đó liệt kê thư viện "đã bundle sẵn, cấm thêm CDN trùng" — điều đó chỉ đúng với `HTMLOnly=false`.
213
- Ở HTMLOnly, thêm CDN không phải là trùng lặp, mà là **điều kiện để trang chạy**.
99
+ - **false (default)**: runtime reads `module.json` and bootstraps Vue; `uc-*.vue` and `script.js` helpers fully supported.
100
+ - **true**: `module.json` ignored — keep it `data:[], watch:{}, controls:[], set:{}`; FUI `controls`/`data`/`watch` have no effect. `body.html` is the entire page. Use for standalone tools, custom editors, pages needing their own runtime or a non-grid layout.
101
+ - **Full-height**: if the menu shows (not `set.menu: false`) it takes a fixed 48px — subtract 48px more from any root `height: 100vh` / `calc(100vh - Npx)`. See [project-config.md](project-config.md) §menu.
214
102
 
215
- `module_simulate({ renderUI: true })` dựng trang **đúng như production** cho module HTMLOnly (bỏ
216
- framework, bỏ projectdata, bỏ `#fastProjectAPP`) và in một dòng cảnh báo nói rõ điều đó — nên nếu
217
- bạn quên khai một thư viện, ảnh render sẽ hỏng y hệt trang thật thay vì đẹp giả tạo.
103
+ #### HTMLOnly=true: no library is embedded
218
104
 
219
- ## Practical Patterns
105
+ Most common mistake; it shows **no error while writing**, only a blank page after deploy. The server emits just three things:
220
106
 
221
- ### Pattern A: Simple module (no custom component)
107
+ 1. this module's imports (`{moduleId}/imports/_imports.json`),
108
+ 2. module-level StyleCSS (`style.css` + `<style>` of module-level `uc-*.vue`),
109
+ 3. the `moduledata` bundle (`$moduleUI` + `script.js` + module-level components).
222
110
 
223
- Use:
224
- - `_moduleInfo.json`
225
- - `module.json`
226
- - `script.js`
227
- - `imports/_imports.json`
111
+ Not embedded, even if the project declares them:
228
112
 
229
- Skip `components/` unless needed.
113
+ | Missing | Symptom |
114
+ | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
115
+ | Framework V2/V3 — `vue.global.min.js`, `vuetify*.js/css`, `fastproject*.js`, `component*.js`, `defaultfunction*.js` | `Vue is not defined`, `<v-btn>` not rendered, no `f-*`/`t-*` |
116
+ | jQuery, lodash (`_`), `moment`/`dayjs`, `numeral`, `jquery-confirm` | `$ is not defined`, `_ is not defined` |
117
+ | Roboto, Material Design Icons (`mdi-*`) | wrong font, icons as empty boxes |
118
+ | `projectdata` bundle — `$projectData`, `$projectGroupSetting`, project-level components | `apiDomain`/`menu`/`login` undefined; project `uc-*` unknown |
119
+ | Project-level StyleCSS, `projectdefaultstyle.css` | shared project classes gone (incl. `.shrink`) |
120
+ | `<div id="fastProjectAPP">` | no mount point — build your own root in `body.html` |
230
121
 
231
- ### Pattern B: Dashboard/report module (recommended split)
122
+ **Declare every needed library in each HTMLOnly module**; project-level declarations do not help. Either:
232
123
 
233
- Use:
234
- - `module.json` for filters + action orchestration
235
- - `script.js` for conversion/chart utilities
236
- - `components/uc-*.vue` for chart/table dashboard presentation
237
- - `header.html` for module-scoped and component-scoped CSS
124
+ - `fui import new` into the module's `imports/_imports.json` with `--sort` >= 40 (see `fui import new --help`) — preferred: visible in `fui import list` and the `fui module simulate --render` report; or
125
+ - raw `<link>`/`<script>` in `header.html` — flexible, but no command lists them.
238
126
 
239
- This pattern matches large report modules and keeps `module.json` maintainable.
127
+ **[script-map.md](script-map.md) does not apply here**: its "already bundled, no duplicate CDN" list is for `HTMLOnly=false` only. In HTMLOnly the CDN is required, not a duplicate.
240
128
 
241
- ### Pattern C: HTMLOnly custom page
129
+ `fui module simulate --render` renders HTMLOnly modules exactly like production (no framework, projectdata or `#fastProjectAPP`) and warns so; a missing library breaks the screenshot like the real page.
242
130
 
243
- Use:
244
- - `_moduleInfo.json` (with `HTMLOnly: true`)
245
- - `module.json` (empty skeleton only)
246
- - `header.html` for all CSS + JS library imports
247
- - `body.html` for the entire page — plain HTML or a self-contained Vue app
131
+ ## Patterns
248
132
 
249
- Skip `components/` and `script.js` unless the custom app needs them.
133
+ - **A — simple**: `_moduleInfo.json`, `module.json`, `script.js`, `imports/_imports.json`; no `components/` unless needed.
134
+ - **B — dashboard/report (recommended)**: `module.json` filters + action orchestration; `script.js` conversion/chart utils; `components/uc-*.vue` chart/table presentation; `header.html` module/component CSS. Keeps large `module.json` maintainable.
135
+ - **C — HTMLOnly page**: `_moduleInfo.json` (`HTMLOnly: true`), empty `module.json` skeleton, `header.html` all CSS + JS libraries, `body.html` whole page (plain HTML or self-contained Vue app); `components/`/`script.js` only if needed.
250
136
 
251
- ## Review Checklist (Structure)
137
+ ## Review Checklist
252
138
 
253
- 1. Check `HTMLOnly` in `_moduleInfo.json` first — it determines which files matter.
254
- 2. If `HTMLOnly=false`: does `module.json` have valid `data/watch/controls/set`?
255
- 3. If `HTMLOnly=true`: is `module.json` empty? Is all content in `body.html`?
256
- 4. Is heavy logic moved to `script.js` instead of oversized `EXE`?
257
- 5. If custom UI exists, is it moved to `components/uc-*.vue`?
258
- 6. If `components/` exists, does `_components.json` register them correctly?
259
- 7. Are imports declared in `imports/_imports.json`?
260
- 8. Do `header.html` and `body.html` contain only inner content (no `<head>`/`<body>` wrapper tags)?
139
+ 1. `HTMLOnly` checked first (decides which files matter).
140
+ 2. false: valid `data/watch/controls/set`? true: `module.json` empty, all content in `body.html`?
141
+ 3. Heavy logic in `script.js`, not oversized `EXE`?
142
+ 4. Custom UI in `components/uc-*.vue`, registered in `_components.json`?
143
+ 5. Imports in `imports/_imports.json`?
144
+ 6. `header.html`/`body.html` inner content only (no `<head>`/`<body>`)?