@hobui/viui-cli 0.0.6 → 0.0.7

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 (240) hide show
  1. package/README.md +138 -139
  2. package/dist/adapters/adapter-registry.d.ts +12 -0
  3. package/dist/adapters/adapter-registry.d.ts.map +1 -0
  4. package/dist/adapters/adapter-registry.js +49 -0
  5. package/dist/adapters/adapter-types.d.ts +20 -0
  6. package/dist/adapters/adapter-types.d.ts.map +1 -0
  7. package/dist/adapters/adapter-types.js +1 -0
  8. package/dist/adapters/aider-adapter.d.ts +3 -0
  9. package/dist/adapters/aider-adapter.d.ts.map +1 -0
  10. package/dist/adapters/aider-adapter.js +8 -0
  11. package/dist/adapters/claude-adapter.d.ts +3 -0
  12. package/dist/adapters/claude-adapter.d.ts.map +1 -0
  13. package/dist/adapters/claude-adapter.js +15 -0
  14. package/dist/adapters/cline-adapter.d.ts +3 -0
  15. package/dist/adapters/cline-adapter.d.ts.map +1 -0
  16. package/dist/adapters/cline-adapter.js +8 -0
  17. package/dist/adapters/copilot-adapter.d.ts +5 -0
  18. package/dist/adapters/copilot-adapter.d.ts.map +1 -0
  19. package/dist/adapters/copilot-adapter.js +20 -0
  20. package/dist/adapters/cursor-adapter.d.ts +3 -0
  21. package/dist/adapters/cursor-adapter.d.ts.map +1 -0
  22. package/dist/adapters/cursor-adapter.js +18 -0
  23. package/dist/adapters/external/bolt-adapter.d.ts +3 -0
  24. package/dist/adapters/external/bolt-adapter.d.ts.map +1 -0
  25. package/dist/adapters/external/bolt-adapter.js +15 -0
  26. package/dist/adapters/external/chatgpt-adapter.d.ts +3 -0
  27. package/dist/adapters/external/chatgpt-adapter.d.ts.map +1 -0
  28. package/dist/adapters/external/chatgpt-adapter.js +14 -0
  29. package/dist/adapters/external/external-adapter-base.d.ts +15 -0
  30. package/dist/adapters/external/external-adapter-base.d.ts.map +1 -0
  31. package/dist/adapters/external/external-adapter-base.js +92 -0
  32. package/dist/adapters/external/gemini-adapter.d.ts +3 -0
  33. package/dist/adapters/external/gemini-adapter.d.ts.map +1 -0
  34. package/dist/adapters/external/gemini-adapter.js +14 -0
  35. package/dist/adapters/external/lovable-adapter.d.ts +3 -0
  36. package/dist/adapters/external/lovable-adapter.d.ts.map +1 -0
  37. package/dist/adapters/external/lovable-adapter.js +14 -0
  38. package/dist/adapters/external/v0-adapter.d.ts +3 -0
  39. package/dist/adapters/external/v0-adapter.d.ts.map +1 -0
  40. package/dist/adapters/external/v0-adapter.js +15 -0
  41. package/dist/adapters/windsurf-adapter.d.ts +3 -0
  42. package/dist/adapters/windsurf-adapter.d.ts.map +1 -0
  43. package/dist/adapters/windsurf-adapter.js +23 -0
  44. package/dist/assets/plugins/viui-conf/apply-theme-body.ts +23 -4
  45. package/dist/assets/plugins/viui-conf/defaults/README.md +2 -0
  46. package/dist/assets/plugins/viui-conf/defaults/app-bar.ts +1 -1
  47. package/dist/assets/plugins/viui-conf/defaults/buttons.ts +1 -1
  48. package/dist/assets/plugins/viui-conf/defaults/by-theme/minimalist-2.ts +1 -1
  49. package/dist/assets/plugins/viui-conf/defaults/cards.ts +1 -1
  50. package/dist/assets/plugins/viui-conf/defaults/expansion-panels.ts +16 -0
  51. package/dist/assets/plugins/viui-conf/defaults/index.ts +3 -0
  52. package/dist/assets/plugins/viui-conf/defaults/inputs.ts +11 -1
  53. package/dist/assets/plugins/viui-conf/design-tokens.ts +135 -0
  54. package/dist/assets/plugins/viui-conf/theme-base.ts +1 -1
  55. package/dist/assets/plugins/viui-conf/v-dark.ts +3 -5
  56. package/dist/assets/plugins/viui-conf/v-light.ts +3 -5
  57. package/dist/assets/plugins/vuetify.ts +36 -0
  58. package/dist/assets/prompt-data/components.json +106 -0
  59. package/dist/assets/prompt-data/tokens.json +83 -0
  60. package/dist/assets/themes/_bento-grid.scss +8 -0
  61. package/dist/assets/themes/_glassmorphism.scss +8 -0
  62. package/dist/assets/themes/_material.scss +8 -0
  63. package/dist/assets/themes/_minimalist-2.scss +375 -0
  64. package/dist/assets/themes/_minimalist.scss +9 -0
  65. package/dist/assets/themes/_neo-brutalism.scss +199 -0
  66. package/dist/assets/themes/bento-grid.scss +4 -0
  67. package/dist/assets/themes/glassmorphism.scss +4 -0
  68. package/dist/assets/themes/index.scss +11 -0
  69. package/dist/assets/themes/material.scss +4 -0
  70. package/dist/assets/themes/minimalist-2.scss +5 -0
  71. package/dist/assets/themes/minimalist.scss +4 -0
  72. package/dist/assets/themes/neo-brutalism.scss +5 -0
  73. package/dist/assets/viui-themes/_neo-brutalism.scss +70 -152
  74. package/dist/cli-paths.d.ts +7 -0
  75. package/dist/cli-paths.d.ts.map +1 -0
  76. package/dist/cli-paths.js +19 -0
  77. package/dist/cli.js +28 -578
  78. package/dist/cli.legacy.d.ts +3 -0
  79. package/dist/cli.legacy.d.ts.map +1 -0
  80. package/dist/cli.legacy.js +597 -0
  81. package/dist/commands/audit.d.ts +3 -0
  82. package/dist/commands/audit.d.ts.map +1 -0
  83. package/dist/commands/audit.js +152 -0
  84. package/dist/commands/config/config-export.d.ts +6 -0
  85. package/dist/commands/config/config-export.d.ts.map +1 -0
  86. package/dist/commands/config/config-export.js +23 -0
  87. package/dist/commands/config/config-health.d.ts +6 -0
  88. package/dist/commands/config/config-health.d.ts.map +1 -0
  89. package/dist/commands/config/config-health.js +42 -0
  90. package/dist/commands/config/config-import.d.ts +6 -0
  91. package/dist/commands/config/config-import.d.ts.map +1 -0
  92. package/dist/commands/config/config-import.js +63 -0
  93. package/dist/commands/config/config-rollback.d.ts +6 -0
  94. package/dist/commands/config/config-rollback.d.ts.map +1 -0
  95. package/dist/commands/config/config-rollback.js +47 -0
  96. package/dist/commands/config/config-setup.d.ts +6 -0
  97. package/dist/commands/config/config-setup.d.ts.map +1 -0
  98. package/dist/commands/config/config-setup.js +103 -0
  99. package/dist/commands/config/config-status.d.ts +6 -0
  100. package/dist/commands/config/config-status.d.ts.map +1 -0
  101. package/dist/commands/config/config-status.js +42 -0
  102. package/dist/commands/config/config-uninstall.d.ts +6 -0
  103. package/dist/commands/config/config-uninstall.d.ts.map +1 -0
  104. package/dist/commands/config/config-uninstall.js +74 -0
  105. package/dist/commands/config.d.ts +6 -0
  106. package/dist/commands/config.d.ts.map +1 -0
  107. package/dist/commands/config.js +19 -0
  108. package/dist/commands/docs.d.ts +3 -0
  109. package/dist/commands/docs.d.ts.map +1 -0
  110. package/dist/commands/docs.js +17 -0
  111. package/dist/commands/doctor.d.ts +3 -0
  112. package/dist/commands/doctor.d.ts.map +1 -0
  113. package/dist/commands/doctor.js +93 -0
  114. package/dist/commands/init.d.ts +3 -0
  115. package/dist/commands/init.d.ts.map +1 -0
  116. package/dist/commands/init.js +183 -0
  117. package/dist/commands/sync.d.ts +3 -0
  118. package/dist/commands/sync.d.ts.map +1 -0
  119. package/dist/commands/sync.js +73 -0
  120. package/dist/commands/theme.d.ts +3 -0
  121. package/dist/commands/theme.d.ts.map +1 -0
  122. package/dist/commands/theme.js +86 -0
  123. package/dist/commands/update.d.ts +3 -0
  124. package/dist/commands/update.d.ts.map +1 -0
  125. package/dist/commands/update.js +97 -0
  126. package/dist/prompts/prompt-builder.d.ts +4 -0
  127. package/dist/prompts/prompt-builder.d.ts.map +1 -0
  128. package/dist/prompts/prompt-builder.js +18 -0
  129. package/dist/prompts/prompt-data-loader.d.ts +11 -0
  130. package/dist/prompts/prompt-data-loader.d.ts.map +1 -0
  131. package/dist/prompts/prompt-data-loader.js +15 -0
  132. package/dist/prompts/prompt-sections/section-code-examples.d.ts +2 -0
  133. package/dist/prompts/prompt-sections/section-code-examples.d.ts.map +1 -0
  134. package/dist/prompts/prompt-sections/section-code-examples.js +36 -0
  135. package/dist/prompts/prompt-sections/section-color-tokens.d.ts +2 -0
  136. package/dist/prompts/prompt-sections/section-color-tokens.d.ts.map +1 -0
  137. package/dist/prompts/prompt-sections/section-color-tokens.js +19 -0
  138. package/dist/prompts/prompt-sections/section-component-map.d.ts +3 -0
  139. package/dist/prompts/prompt-sections/section-component-map.d.ts.map +1 -0
  140. package/dist/prompts/prompt-sections/section-component-map.js +12 -0
  141. package/dist/prompts/prompt-sections/section-typography-spacing.d.ts +2 -0
  142. package/dist/prompts/prompt-sections/section-typography-spacing.d.ts.map +1 -0
  143. package/dist/prompts/prompt-sections/section-typography-spacing.js +29 -0
  144. package/dist/services/backup-service.d.ts +7 -0
  145. package/dist/services/backup-service.d.ts.map +1 -0
  146. package/dist/services/backup-service.js +54 -0
  147. package/dist/services/config-service.d.ts +17 -0
  148. package/dist/services/config-service.d.ts.map +1 -0
  149. package/dist/services/config-service.js +64 -0
  150. package/dist/services/diff-engine.d.ts +13 -0
  151. package/dist/services/diff-engine.d.ts.map +1 -0
  152. package/dist/services/diff-engine.js +59 -0
  153. package/dist/services/ide-detector.d.ts +9 -0
  154. package/dist/services/ide-detector.d.ts.map +1 -0
  155. package/dist/services/ide-detector.js +113 -0
  156. package/dist/services/ide-detector.spec.d.ts +2 -0
  157. package/dist/services/ide-detector.spec.d.ts.map +1 -0
  158. package/dist/services/ide-detector.spec.js +108 -0
  159. package/dist/services/lock-file-service.d.ts +15 -0
  160. package/dist/services/lock-file-service.d.ts.map +1 -0
  161. package/dist/services/lock-file-service.js +74 -0
  162. package/dist/services/mcp-config-reader.d.ts +11 -0
  163. package/dist/services/mcp-config-reader.d.ts.map +1 -0
  164. package/dist/services/mcp-config-reader.js +40 -0
  165. package/dist/services/mcp-config-reader.spec.d.ts +2 -0
  166. package/dist/services/mcp-config-reader.spec.d.ts.map +1 -0
  167. package/dist/services/mcp-config-reader.spec.js +125 -0
  168. package/dist/services/mcp-config-writer.d.ts +11 -0
  169. package/dist/services/mcp-config-writer.d.ts.map +1 -0
  170. package/dist/services/mcp-config-writer.js +98 -0
  171. package/dist/services/mcp-config-writer.spec.d.ts +2 -0
  172. package/dist/services/mcp-config-writer.spec.d.ts.map +1 -0
  173. package/dist/services/mcp-config-writer.spec.js +162 -0
  174. package/dist/services/merge-engine.d.ts +12 -0
  175. package/dist/services/merge-engine.d.ts.map +1 -0
  176. package/dist/services/merge-engine.js +54 -0
  177. package/dist/services/vuetify-scaffold-service.d.ts +5 -0
  178. package/dist/services/vuetify-scaffold-service.d.ts.map +1 -0
  179. package/dist/services/vuetify-scaffold-service.js +67 -0
  180. package/dist/templates/vuetify-plugin.d.ts +90 -0
  181. package/dist/templates/vuetify-plugin.d.ts.map +1 -0
  182. package/dist/templates/vuetify-plugin.js +33 -0
  183. package/dist/types/command-types.d.ts +15 -0
  184. package/dist/types/command-types.d.ts.map +1 -0
  185. package/dist/types/command-types.js +2 -0
  186. package/dist/types/config-types.d.ts +29 -0
  187. package/dist/types/config-types.d.ts.map +1 -0
  188. package/dist/types/config-types.js +10 -0
  189. package/dist/types/ide-types.d.ts +29 -0
  190. package/dist/types/ide-types.d.ts.map +1 -0
  191. package/dist/types/ide-types.js +4 -0
  192. package/dist/types/lock-file-types.d.ts +27 -0
  193. package/dist/types/lock-file-types.d.ts.map +1 -0
  194. package/dist/types/lock-file-types.js +2 -0
  195. package/dist/utils/diff-display.d.ts +18 -0
  196. package/dist/utils/diff-display.d.ts.map +1 -0
  197. package/dist/utils/diff-display.js +61 -0
  198. package/dist/utils/fs-safe.d.ts +9 -0
  199. package/dist/utils/fs-safe.d.ts.map +1 -0
  200. package/dist/utils/fs-safe.js +44 -0
  201. package/dist/utils/logger.d.ts +14 -0
  202. package/dist/utils/logger.d.ts.map +1 -0
  203. package/dist/utils/logger.js +28 -0
  204. package/dist/utils/open-browser.d.ts +3 -0
  205. package/dist/utils/open-browser.d.ts.map +1 -0
  206. package/dist/utils/open-browser.js +13 -0
  207. package/package.json +11 -6
  208. package/dist/assets/cursor/.design-system-version +0 -1
  209. package/dist/assets/cursor/commands/audit-accessibility.md +0 -25
  210. package/dist/assets/cursor/commands/audit-ui.md +0 -35
  211. package/dist/assets/cursor/commands/component.md +0 -18
  212. package/dist/assets/cursor/commands/fix-storybook.md +0 -24
  213. package/dist/assets/cursor/commands/generate-component-from-figma.md +0 -26
  214. package/dist/assets/cursor/commands/generate-page-from-figma.md +0 -26
  215. package/dist/assets/cursor/plans/DESIGN_SYSTEM_PLAN.md +0 -177
  216. package/dist/assets/cursor/plans/PLANS_INDEX.md +0 -35
  217. package/dist/assets/cursor/rules/accessibility-contrast.mdc +0 -38
  218. package/dist/assets/cursor/rules/bem-class-style.mdc +0 -107
  219. package/dist/assets/cursor/rules/component-naming.mdc +0 -57
  220. package/dist/assets/cursor/rules/design-system-component-library.mdc +0 -59
  221. package/dist/assets/cursor/rules/design-system-workflow.mdc +0 -48
  222. package/dist/assets/cursor/rules/figma-mapping.mdc +0 -37
  223. package/dist/assets/cursor/rules/icons.mdc +0 -42
  224. package/dist/assets/cursor/rules/project-structure.mdc +0 -137
  225. package/dist/assets/cursor/rules/storybook-component-template.mdc +0 -103
  226. package/dist/assets/cursor/rules/storybook.mdc +0 -68
  227. package/dist/assets/cursor/rules/tokens.mdc +0 -32
  228. package/dist/assets/cursor/rules/viui-themes.mdc +0 -53
  229. package/dist/assets/cursor/rules/vuetify-layout.mdc +0 -52
  230. package/dist/assets/cursor/skills/accessibility.md +0 -75
  231. package/dist/assets/cursor/skills/design-system-thinking.md +0 -40
  232. package/dist/assets/cursor/skills/figma-interpretation.md +0 -38
  233. package/dist/assets/cursor/skills/vue-vuetify-design-system-architect.md +0 -60
  234. package/dist/assets/cursor/sync-manifest.json +0 -6
  235. package/dist/assets/viui-themes/bento-grid-global.scss +0 -5
  236. package/dist/assets/viui-themes/glassmorphism-global.scss +0 -5
  237. package/dist/assets/viui-themes/material-global.scss +0 -5
  238. package/dist/assets/viui-themes/minimalist-2-global.scss +0 -5
  239. package/dist/assets/viui-themes/minimalist-global.scss +0 -5
  240. package/dist/assets/viui-themes/neo-brutalism-global.scss +0 -5
@@ -1,35 +0,0 @@
1
- ---
2
- name: audit UI
3
- description: Audit tổng thể UI — a11y (contrast, ARIA, keyboard), tokens (không hard-code), và tùy chọn drift so với Figma. Gọi audit-accessibility cho phần a11y.
4
- ---
5
-
6
- Bạn là chuyên gia audit giao diện cho design system.
7
-
8
- **Nhiệm vụ:** Kiểm tra (audit) **tổng thể** component, story hoặc trang theo: (1) **Accessibility**, (2) **Tokens** (không hard-code màu/spacing/typography), (3) **Figma drift** (tùy chọn — so với design nếu có).
9
-
10
- ## Các bước
11
-
12
- 1. **Xác định phạm vi** — Một story, một component, một trang, hay một nhóm. User có thể chỉ rõ; nếu không, ưu tiên file đang mở hoặc vừa sửa.
13
-
14
- 2. **Audit Accessibility** — Áp dụng cùng quy trình command **audit-accessibility**:
15
- - Addon a11y / axe: color-contrast, ARIA, role, label, focus, keyboard.
16
- - Ưu tiên color-contrast (WCAG 2.1 AA) theo `.cursor/rules/accessibility-contrast.mdc`; sau đó ARIA, keyboard, focus.
17
- - Tham chiếu: `.cursor/commands/audit-accessibility.md`, `.cursor/skills/accessibility.md`.
18
-
19
- 3. **Audit Tokens** — Kiểm tra code không hard-code giá trị thiết kế:
20
- - Màu: dùng `colorTokens`, `inetDesignTokens`, hoặc theme Vuetify từ tokens; không hex/rgba trực tiếp cho quyết định thiết kế.
21
- - Spacing/typography: dùng `spacingTokens`, `typographyTokens` hoặc theme; không px/rem cố định cho layout/type.
22
- - Tham chiếu: `.cursor/rules/tokens.mdc`, `src/tokens/design-tokens.ts`.
23
-
24
- 4. **Audit Figma drift (tùy chọn)** — Nếu user cung cấp Figma URL hoặc bản thiết kế: so sánh layout, màu, spacing với code; liệt kê chênh lệch; đề xuất chỉnh code hoặc cập nhật token/Figma. Tham chiếu `.cursor/rules/figma-mapping.mdc`.
25
-
26
- 5. **Tổng hợp** — Đầu ra: danh sách lỗi/theo từng mục (a11y, tokens, drift) + mức độ + hướng sửa (file, dòng, token hoặc attribute). Với a11y, có thể trỏ trực tiếp tới command **audit-accessibility** để xử lý chi tiết.
27
-
28
- ## Tham chiếu
29
-
30
- - **A11y (chi tiết):** `.cursor/commands/audit-accessibility.md`, `.cursor/rules/accessibility-contrast.mdc`, `.cursor/skills/accessibility.md`
31
- - **Tokens:** `.cursor/rules/tokens.mdc`
32
- - **Figma:** `.cursor/rules/figma-mapping.mdc`, `.cursor/skills/figma-interpretation.md`
33
- - **AGENTS.md:** mục Color contrast và rules bắt buộc
34
-
35
- Đầu ra: báo cáo audit (a11y + tokens [+ drift nếu có]) + danh sách lỗi và hướng sửa.
@@ -1,18 +0,0 @@
1
- ---
2
- name: component
3
- description: Tạo component Vue mới hoặc gợi ý reuse từ design system hiện có, theo Vuetify primitives.
4
- ---
5
-
6
- Bạn là chuyên gia Vue 3 + Vuetify cho design system.
7
-
8
- Luôn ưu tiên:
9
- 1. Reuse component hiện có từ src/components/ui/ hoặc Vuetify built-ins (VBtn, VCard, VInput, v.v.).
10
- 2. Nếu tạo mới: dùng Composition API, props với defineProps, emits với defineEmits.
11
- 3. Áp dụng theme từ Vuetify: useTheme() hook, colors từ $vuetify.theme.current.colors.primary, v.v.
12
- 4. Đảm bảo accessibility: aria-label, role, v-bind cho states (disabled, loading).
13
- 5. Naming: PascalCase cho component (MyButton.vue), kebab-case cho props/events.
14
- 6. Output:
15
- - Code full component (.vue file)
16
- - Folder gợi ý: src/components/atoms/buttons/Button.vue
17
- - Props default + types (PropType nếu cần)
18
- - Example usage: <Button variant="primary">Label</Button>
@@ -1,24 +0,0 @@
1
- ---
2
- name: fix storybook
3
- description: Sửa lỗi story (title, CSF3, controls, a11y); đảm bảo đúng cấu trúc sidebar và rule storybook.mdc.
4
- ---
5
-
6
- Bạn là chuyên gia Storybook cho design system Vue 3 + Vuetify.
7
-
8
- **Nhiệm vụ:** Sửa lỗi hoặc cải thiện story hiện tại (file `*.stories.ts` hoặc cấu hình `.storybook/`).
9
-
10
- ## Cần kiểm tra và sửa
11
-
12
- 1. **Cấu trúc sidebar** — Story title đúng hierarchy: `Foundations/Colors`, `vi-ui/Button`, `Brands/Logo`, `Errors/ErrorPage`, v.v. Thứ tự nhóm theo `.storybook/preview.ts` (Introduction → Foundations → vi-ui → Brands → Errors → Icons).
13
- 2. **CSF3 + TypeScript** — `satisfies Meta<typeof Component>`, `StoryObj<typeof meta>`, import từ `@storybook/vue3-vite`; đủ `argTypes` và `args` mặc định.
14
- 3. **Controls & docs** — Prop quan trọng có `control` và `description`; `tags: ["autodocs"]` khi cần; events dùng `fn()`.
15
- 4. **Vuetify & tokens** — Story dùng theme/tokens từ design system; không override CSS tùy tiện.
16
- 5. **Accessibility** — Chạy addon a11y nếu có; sửa lỗi color-contrast theo `.cursor/rules/accessibility-contrast.mdc`.
17
-
18
- ## Tham chiếu
19
-
20
- - Rule: `.cursor/rules/storybook.mdc`
21
- - Config: `.storybook/main.ts`, `preview.ts`
22
- - Mẫu: `src/design-system/vi-ui/vi-button/ViButton.stories.ts`
23
-
24
- Đầu ra: chỉnh sửa cụ thể (file, đoạn code) để story đúng cấu trúc và không lỗi.
@@ -1,26 +0,0 @@
1
- ---
2
- name: generate component from Figma
3
- description: Nhận Figma URL/node, sinh hoặc cập nhật component Vue + story theo design; bám tokens, component-naming.mdc và storybook.mdc.
4
- ---
5
-
6
- Bạn là chuyên gia chuyển component Figma sang code Vue 3 + Vuetify cho design system.
7
-
8
- **Nhiệm vụ:** Từ Figma URL (và node-id nếu có), lấy design rồi sinh hoặc cập nhật **component** Vue và story tương ứng, đúng naming và tokens.
9
-
10
- ## Các bước
11
-
12
- 1. **Lấy design** — User cung cấp Figma URL. Trích `fileKey`, `nodeId`. Nếu có MCP: gọi `get_design_context(fileKey, nodeId?)`. Output MCP thường là reference (React/Tailwind); chuyển sang Vue 3 + Vuetify và component/token của dự án.
13
- 2. **Map tokens** — Màu → `colorTokens.*` / `inetDesignTokens.colors.*`; spacing → `spacingTokens`; radius → `shapeTokens`; typography → `typographyTokens`. Không thêm giá trị mới ngoài token trừ khi đã cập nhật `design-tokens.ts`. Tham chiếu `.cursor/rules/figma-mapping.mdc`.
14
- 3. **Chọn hoặc tạo component** — Nếu đã có Vi* hoặc component trong `src/components/` khớp design → đề xuất dùng lại hoặc mở rộng. Nếu tạo mới: đặt đúng NHÓM và vị trí theo `.cursor/rules/component-naming.mdc` và `.cursor/rules/design-system-workflow.mdc` (vi-ui → `src/design-system/vi-ui/vi-<tên>/ViName.vue`; Brands/Errors/Icons → `src/components/<nhóm>/`).
15
- 4. **Sinh component + story** — Component: `<script setup>`, `defineProps`, `defineEmits`; dùng Vuetify và tokens. Story: `ComponentName.stories.ts` cùng thư mục; `title` = `{Nhóm}/{Tên}` theo `.cursor/rules/storybook.mdc`; CSF3, argTypes, args mặc định.
16
- 5. **Kiểm tra** — Story chạy đúng; contrast và a11y đạt; không hard-code màu/spacing; export qua `src/design-system/vi-ui/index.ts` nếu là Vi*.
17
-
18
- ## Tham chiếu
19
-
20
- - Rule Figma: `.cursor/rules/figma-mapping.mdc`
21
- - Skill Figma: `.cursor/skills/figma-interpretation.md`
22
- - Naming: `.cursor/rules/component-naming.mdc`, `.cursor/rules/design-system-component-library.mdc`
23
- - Storybook: `.cursor/rules/storybook.mdc`
24
- - Tokens: `.cursor/rules/tokens.mdc`, `src/tokens/design-tokens.ts`
25
-
26
- Đầu ra: component Vue (.vue) + story (.stories.ts) hoặc patch; đúng thư mục và naming.
@@ -1,26 +0,0 @@
1
- ---
2
- name: generate page from Figma
3
- description: Nhận Figma URL/node, dùng MCP get_design_context (và get_screenshot nếu có), sinh hoặc cập nhật page/story/route theo design; bám tokens và rules (figma-mapping.mdc, storybook.mdc).
4
- ---
5
-
6
- Bạn là chuyên gia chuyển design Figma sang code cho design system Vue 3 + Vuetify.
7
-
8
- **Nhiệm vụ:** Từ Figma URL (và node-id nếu có), lấy design context rồi sinh hoặc cập nhật **page** (story, route, hoặc trang foundation) theo đúng tokens và cấu trúc dự án.
9
-
10
- ## Các bước
11
-
12
- 1. **Lấy thông tin Figma** — User cung cấp URL (vd `figma.com/design/<fileKey>/...?node-id=...`). Trích `fileKey` và `nodeId` (đổi `-` thành `:` trong node-id nếu cần). Nếu có MCP Figma: gọi `get_design_context(fileKey, nodeId?)` để lấy code/screenshot/hints.
13
- 2. **Phân tích design** — Xác định sections, layout, components dùng, màu/spacing/typography. Map giá trị Figma sang token: màu → `colorTokens.*` / `inetDesignTokens.colors.*`; spacing → `spacingTokens`; typography → `typographyTokens`. Không hard-code; tham chiếu `.cursor/rules/tokens.mdc` và `.cursor/rules/figma-mapping.mdc`.
14
- 3. **Chọn đầu ra** — Page có thể là: (a) story trong `src/storybook/Foundations/` (vd page Colors, Typography), (b) story cho nhóm vi-ui/Brands/Errors, hoặc (c) route/view nếu dự án có router. Đặt đúng thư mục và `title` theo `.cursor/rules/storybook.mdc` (`{Nhóm}/{Tên}`).
15
- 4. **Sinh/cập nhật code** — Vue 3 + Vuetify, Composition API; dùng component và tokens có sẵn. Thêm hoặc sửa file story/route; đảm bảo không có `[object Object]` hay chuỗi render lỗi.
16
- 5. **Kiểm tra** — Story chạy đúng; color contrast và a11y đạt WCAG AA (`.cursor/rules/accessibility-contrast.mdc`).
17
-
18
- ## Tham chiếu
19
-
20
- - Rule Figma: `.cursor/rules/figma-mapping.mdc`
21
- - Skill Figma: `.cursor/skills/figma-interpretation.md`
22
- - Tokens: `.cursor/rules/tokens.mdc`, `src/tokens/design-tokens.ts`
23
- - Storybook: `.cursor/rules/storybook.mdc`
24
- - Contrast: `.cursor/rules/accessibility-contrast.mdc`
25
-
26
- Đầu ra: file mới hoặc patch (story, route, hoặc page) bám design và tokens; gợi ý chỉnh nếu Figma lệch token.
@@ -1,177 +0,0 @@
1
- ---
2
- name: Design System Plan (tập trung)
3
- overview: Một file plan duy nhất cho iNET Design System — Workflow lớn (thêm mới, tìm kiếm, tổng kết), NHÓM, phase, foundation, Figma, tích hợp, SaaS/vi-ui, locale, chất lượng, roadmap. Quản lý tập trung, dễ tìm kiếm.
4
- todos: []
5
- isProject: false
6
- ---
7
-
8
- # iNET Design System — Plan tập trung
9
-
10
- **Rule workflow:** `.cursor/rules/design-system-workflow.mdc`
11
- **Mục tiêu chi tiết:** [docs/design-system-plan.md](docs/design-system-plan.md)
12
-
13
- ---
14
-
15
- ## Mục lục (tìm nhanh)
16
-
17
- 1. [I. Workflow lớn](#i-workflow-lớn) — NHÓM, thêm mới, tìm kiếm, tổng kết
18
- 2. [II. Tổng quan phase](#ii-tổng-quan-phase) — Phase hiện tại, thiếu sót
19
- 3. [III. Foundation](#iii-foundation) — Design principles, token system, Storybook structure
20
- 4. [IV. Figma → page/component](#iv-figma--pagecomponent) — Quy trình, checklist
21
- 5. [V. Tích hợp nền tảng](#v-tích-hợp-nền-tảng) — Figma, v0, bolt, Vercel, Lovable
22
- 6. [VI. SaaS / vi-ui](#vi-saas--vi-ui) — Folder, token 8pt, Vi*, ESLint
23
- 7. [VII. Locale & song ngữ Storybook](#vii-locale--song-ngữ-storybook) — Toolbar locale, i18n
24
- 8. [VIII. Chất lượng](#viii-chất-lượng) — No hardcode màu, audit
25
- 9. [IX. Roadmap & ưu tiên](#ix-roadmap--ưu-tiên) — Thứ tự thực hiện, bắt đầu từ đâu
26
- 10. [X. Mở rộng](#x-mở-rộng) — Quy ước thêm plan, NHÓM, rule, command, skill
27
-
28
- ---
29
-
30
- ## I. Workflow lớn
31
-
32
- Workflow = **thêm mới**, **tìm kiếm**, **tổng kết**. Mọi item (component, token, doc) thuộc đúng **NHÓM**.
33
-
34
- ### 1. NHÓM (7 nhóm)
35
-
36
- | NHÓM | Vị trí code | Items ví dụ |
37
- |------|-------------|-------------|
38
- | **vi-ui** | `src/design-system/vi-ui/vi-<tên>/` | ViButton, ViInput, ViCard, ViAlert, ViDialog, … |
39
- | **Brands** | `src/components/brands/` | BrandLogo, StyleGuide |
40
- | **Errors** | `src/components/errors/` | ErrorPage, OvvErrorPage, … |
41
- | **Icons** | `src/components/icons/` | ArrowLeftRight, … |
42
- | **Tokens** | `src/tokens/` | design-tokens.ts, inet-design-tokens.ts |
43
- | **Docs** | `src/docs/`, `docs/` | design-system.md, integration-guide.md |
44
- | **Storybook foundations** | `src/storybook/Foundations/` | Colors, Typography, SpacingLayout, Configure.mdx |
45
-
46
- Không tạo item “lạc” ngoài các NHÓM trên.
47
-
48
- ### 2. Thêm mới — Bước chuẩn
49
-
50
- 1. **Chọn NHÓM** — vi-ui, Brands, Errors, Icons, Tokens, Docs, hoặc Storybook foundations.
51
- 2. **Tạo đúng vị trí** — Theo `.cursor/rules/project-structure.mdc`, `.cursor/rules/component-naming.mdc`. Ví dụ: Vi* → `src/design-system/vi-ui/vi-<tên>/ViName.vue` + `ViName.stories.ts`.
52
- 3. **Cập nhật index/re-export** — Ví dụ `src/design-system/vi-ui/index.ts` nếu thêm Vi*.
53
- 4. **Story/docs** — Component mới có story; token/docs cập nhật nếu cần.
54
-
55
- **Command theo ngữ cảnh:** Từ Figma → `generate-page-from-figma`, `generate-component-from-figma`. Tạo component thuần → `component`. Sửa story → `fix-storybook`.
56
-
57
- ### 3. Tìm kiếm
58
-
59
- - **Theo tên** — Search codebase, Storybook sidebar, docs.
60
- - **Theo NHÓM** — Mở thư mục (vd `src/design-system/vi-ui/`, `src/tokens/`).
61
-
62
- ### 4. Tổng kết
63
-
64
- - **Số NHÓM:** 7. **Số items:** đếm theo nhóm.
65
- - **Trạng thái:** documented, có story, dùng token — dùng cho review/QA.
66
- - **Command:** `audit-accessibility`, `audit-ui` (a11y + tokens + drift).
67
-
68
- ---
69
-
70
- ## II. Tổng quan phase
71
-
72
- **Phase 1 (Foundation):** Project structure Done; Design tokens Done; Vuetify theme Done; Design principles 1 trang Done; Storybook token preview Done. Còn rà soát: manager.ts dùng design-tokens; 8pt spacing; doc TS↔SCSS trong tokens.mdc.
73
-
74
- **Phase 2 (vi-ui):** ViButton, ViInput, ViSelect, ViCheckbox, ViCard, ViAlert, ViDialog, ViDataTable, ViPagination, ViAvatar, ViMenu — Done. Thiếu: Badge, Dropdown, Tooltip, Tabs, Accordion, Navigation, Breadcrumb.
75
-
76
- **Phase 3–5:** Composite (ViDropdown, ViTooltip, ViTabs…); Data & Navigation; Forms & Templates; Docs & Polish (Getting Started, CHANGELOG, npm package tùy chọn).
77
-
78
- **Thiếu sót chung:** manager.ts từ design-tokens; 8pt document; stylelint no raw color; ViSkeleton/ViEmptyState; CHANGELOG/semver; migration app → Vi*; Design Principles “Atoms” → “vi-ui”.
79
-
80
- ---
81
-
82
- ## III. Foundation
83
-
84
- **Mục tiêu:** (1) Design principles 1 trang, (2) Token system một nguồn, (3) Storybook structure cố định.
85
-
86
- **Design principles:** Một file (vd `src/docs/foundations/design-principles.md`) — Simple – Secure – Stable + 4 trụ cột (Human-Centered, Clarity & Consistency, Motion & Meaning, Adaptivity). Link từ design-system.md; tùy chọn MDX Introduction trong Storybook.
87
-
88
- **Token system:** design-tokens.ts = single source of truth. Cập nhật `.storybook/manager.ts` import color từ design-tokens. Document quy ước TS↔SCSS trong tokens.mdc/design-system.md. Legacy inet-design-tokens: deprecate hoặc ghi rõ “tương thích”.
89
-
90
- **Storybook structure:** Sidebar order trong `.storybook/preview.ts`: Introduction → Foundations → vi-ui → Brands → Errors → Icons. Title thống nhất: `Foundations/Colors`, `Brands/Logo`, `Errors/ErrorPage`. Document trong storybook.mdc.
91
-
92
- ---
93
-
94
- ## IV. Figma → page/component
95
-
96
- **Quy trình:** (1) Input Figma URL + node-id; (2) MCP `get_design_context(fileKey, nodeId?)`; (3) Map tokens (màu, spacing, radius, typography); (4) Chọn đầu ra: page (Foundations/route) hoặc component (vi-* hoặc components/); (5) Sinh/cập nhật Vue + Vuetify, không hard-code; (6) Kiểm tra contrast và a11y.
97
-
98
- **Command:** `.cursor/commands/generate-page-from-figma.md`, `.cursor/commands/generate-component-from-figma.md`. **Rule:** `.cursor/rules/figma-mapping.mdc`. **Skill:** `.cursor/skills/figma-interpretation.md`.
99
-
100
- **Checklist:** Figma URL rõ; MCP đã gọi; tokens không hard-code; đúng vị trí và naming; story title `{Nhóm}/{Tên}`; a11y đạt.
101
-
102
- ---
103
-
104
- ## V. Tích hợp nền tảng
105
-
106
- **Mục tiêu:** Một bộ quy tắc UI (tokens, 8pt, Vi*) khi dùng Figma, v0, bolt.new, Vercel, Lovable, Framer AI, designcode.io.
107
-
108
- **Nguồn chung:** design-tokens.ts, inet-tokens.scss; docs/AI-prompt-rules.md; vi-ui index. **Deliverable:** [docs/integration-guide.md](docs/integration-guide.md) — từng nền tảng: chỗ paste prompt, link Storybook, quy trình sync (nếu có).
109
-
110
- **Figma:** Variables trùng tên token; Dev Mode lấy giá trị từ tokens. **v0/Lovable/Framer:** Paste Universal/Minimal; output = reference; port sang Vue + Vi* khi production. **bolt.new:** Paste Developer + Universal; project Vue dùng Vi* + tokens. **Vercel:** Deploy Storybook, output `storybook-static`; URL trong integration-guide.
111
-
112
- ---
113
-
114
- ## VI. SaaS / vi-ui
115
-
116
- **Folder:** Vi* trong `src/design-system/vi-ui/vi-<tên>/`; export từ `vi-ui/index.ts`. App chỉ import Vi*.
117
-
118
- **Token:** 8pt spacing (space.1=8px, 2=16px, …); semantic color only; single source design-tokens.ts; Vi* không raw #hex/rgba/8px.
119
-
120
- **Theme:** Vuetify theme từ tokens; Vi* dùng `color="primary"` xuống v-btn, không style background trực tiếp. **Design style themes** (minimalist-2, neo-brutalism): mỗi theme tương ứng bộ default variants; cấu hình theo [themes.plan.md](themes.plan.md) — viui-conf by-theme, getDefaults(themeId), VITE_VIUI_THEME.
121
-
122
- **ESLint:** no-restricted-imports — cấm import Vuetify components ngoài vi-ui và plugins. (Tùy chọn) no raw color ngoài tokens/styles.
123
-
124
- **Vi*:** Một wrapper một Vuetify component; props semantic; forward attrs + slots; token-only styling.
125
-
126
- ---
127
-
128
- ## VII. Locale & song ngữ Storybook
129
-
130
- **Locale integration:** Toolbar locale (preview.ts) đổi được vi/en. Mục tiêu: description/intro theo locale (ít nhất Docs tab). Decorator cấp story (không global); helper `createLocaleIntroDecorator(viBlock, enBlock)`. Foundations: description theo locale ở Docs.
131
-
132
- **Bilingual academic:** Song ngữ (vi/en) + thuật ngữ học thuật (common + semantic) cho Docs. File locale: `src/locales/vi.json`, `src/locales/en.json`; namespace introduction, foundations, viUi, brands, errors. Có thể dùng vue-i18n trong preview; stories import JSON hoặc `t()`.
133
-
134
- ---
135
-
136
- ## VIII. Chất lượng
137
-
138
- **No hardcode màu:** Colors.stories, Typography.stories, SpacingLayout.stories, Configure.mdx — chỉ dùng `colorTokens`/`inetDesignTokens` hoặc `var(--color-*)`. Thay hex/rgba trong UI story bằng token. Viết `src/docs/foundations/color.md` ghi quy ước no hardcode. Grep kiểm tra không còn literal màu trong .vue/.ts/.mdx (trừ tokens và SCSS).
139
-
140
- **Audit:** Command `audit-accessibility` — a11y (contrast, ARIA, keyboard). Command `audit-ui` — a11y + tokens (no hardcode) + tùy chọn Figma drift.
141
-
142
- ---
143
-
144
- ## IX. Roadmap & ưu tiên
145
-
146
- **Thứ tự gợi ý:**
147
-
148
- 1. **Rà soát foundation** — manager.ts từ design-tokens; 8pt và TS↔SCSS trong tokens.mdc; Design Principles “Atoms” → “vi-ui”.
149
- 2. **No hardcode** — Colors/Typography/SpacingLayout stories + docs chỉ tokens.
150
- 3. **Component** — Chọn 2–3 ưu tiên (ViTooltip, ViTabs, Navigation) theo sản phẩm.
151
- 4. **Figma → page/component** — Dùng quy trình mục IV và commands.
152
- 5. **Docs & locale** — Getting Started, migration guide; song ngữ Storybook nếu cần.
153
- 6. **Tùy chọn** — Vercel URL, CLI idesign rules, Figma token sync, npm package.
154
-
155
- **Bắt đầu từ đâu:** (1) Cần thêm item → chọn NHÓM → bước chuẩn mục I.2; từ Figma → mục IV. (2) Cần tìm → mục I.3. (3) Cần tổng kết/ưu tiên → mục II + IX.
156
-
157
- ---
158
-
159
- ## X. Mở rộng
160
-
161
- **Plan:** Mở rộng = thêm section (X, XI, …) trong file này. Không tách file plan mới trừ khi có nhu cầu đặc biệt. Giữ một file `.md` trong `plans/` (quy ước: chỉ `.md`, không `.plan.md`).
162
-
163
- **NHÓM mới:** Khi thêm NHÓM → cập nhật mục I (bảng NHÓM), `.cursor/rules/design-system-workflow.mdc`, và `docs/design-system-plan.md`.
164
-
165
- **Rule / Command / Skill:** Thêm file mới trong đúng thư mục (rules/ chỉ .mdc; commands/ và skills/ .md). Cập nhật `.cursor/INDEX.md` để liệt kê mục mới.
166
-
167
- ---
168
-
169
- ## Tham chiếu nhanh
170
-
171
- - **Chỉ mục .cursor:** [.cursor/INDEX.md](.cursor/INDEX.md) — bảng rules, commands, skills, plans
172
- - **Workflow rule:** `.cursor/rules/design-system-workflow.mdc`
173
- - **Mục tiêu:** [docs/design-system-plan.md](docs/design-system-plan.md), [AGENTS.md](AGENTS.md)
174
- - **Tokens:** [src/tokens/design-tokens.ts](src/tokens/design-tokens.ts), [.cursor/rules/tokens.mdc](.cursor/rules/tokens.mdc)
175
- - **Storybook:** [.cursor/rules/storybook.mdc](.cursor/rules/storybook.mdc)
176
- - **Commands:** `.cursor/commands/` (generate-page-from-figma, generate-component-from-figma, audit-accessibility, audit-ui, fix-storybook, component)
177
- - **Integration:** [docs/integration-guide.md](docs/integration-guide.md), [docs/AI-prompt-rules.md](docs/AI-prompt-rules.md)
@@ -1,35 +0,0 @@
1
- # .cursor/plans — Chỉ mục (plan tập trung)
2
-
3
- **Entry point:** **[DESIGN_SYSTEM_PLAN.md](DESIGN_SYSTEM_PLAN.md)** — Một file plan duy nhất: Workflow lớn (thêm mới, tìm kiếm, tổng kết), NHÓM, phase, foundation, Figma, tích hợp, SaaS/vi-ui, locale, chất lượng, roadmap.
4
-
5
- **KPI — Component mẫu & template:** **[KPI_COMPONENT_TEMPLATE.md](KPI_COMPONENT_TEMPLATE.md)** — Checklist: Button variants/sizes/states, Storybook template chuẩn, kiểm tra Cursor generate story đúng format. *(Nếu file không có trong .cursor/plans/ sau sync, xem bản gốc tại repo i-design-system.)*
6
-
7
- **Themes — Design style & default variants:** **[themes.plan.md](themes.plan.md)** — Hài hòa Themes (minimalist-2, neo-brutalism) với Vuetify variants; viui-conf by-theme, getDefaults(themeId), cấu hình vuetify.ts theo VITE_VIUI_THEME; triển khai từng bước.
8
-
9
- ---
10
-
11
- ## Cấu trúc trong DESIGN_SYSTEM_PLAN.md (tìm nhanh)
12
-
13
- | Phần | Nội dung |
14
- |------|----------|
15
- | **KPI — Component mẫu** | [KPI_COMPONENT_TEMPLATE.md](KPI_COMPONENT_TEMPLATE.md) — Checklist Button + template Storybook + kiểm tra Cursor |
16
- | **I. Workflow lớn** | NHÓM (7), thêm mới (bước chuẩn + command), tìm kiếm, tổng kết |
17
- | **II. Tổng quan phase** | Phase 1–5, thiếu sót so với design-system-plan |
18
- | **III. Foundation** | Design principles, token system, Storybook structure |
19
- | **IV. Figma → page/component** | Quy trình MCP, mapping token, checklist; commands generate-page/component-from-figma |
20
- | **V. Tích hợp nền tảng** | Figma, v0, bolt, Vercel, Lovable; integration-guide |
21
- | **VI. SaaS / vi-ui** | Folder, token 8pt, Vi*, ESLint |
22
- | **VII. Locale & song ngữ Storybook** | Toolbar locale, i18n vi/en |
23
- | **VIII. Chất lượng** | No hardcode màu, audit-accessibility, audit-ui |
24
- | **IX. Roadmap & ưu tiên** | Thứ tự thực hiện, bắt đầu từ đâu |
25
- | **X. Mở rộng** | Quy ước thêm plan, NHÓM, rule, command, skill |
26
- | **Themes (plan riêng)** | [themes.plan.md](themes.plan.md) — Theme id ↔ default variants, viui-conf by-theme, getDefaults, VITE_VIUI_THEME |
27
-
28
- ---
29
-
30
- ## Tóm tắt
31
-
32
- - **Bắt đầu:** Mở [DESIGN_SYSTEM_PLAN.md](DESIGN_SYSTEM_PLAN.md) — đủ workflow, NHÓM, phase, và từng chủ đề trong một file.
33
- - **KPI component mẫu:** Mở [KPI_COMPONENT_TEMPLATE.md](KPI_COMPONENT_TEMPLATE.md) — checklist từng bước; tick `[x]` khi hoàn thành.
34
- - **Tìm nhanh:** Dùng mục lục (TOC) trong file plan hoặc bảng trên.
35
- - **Rule workflow:** `.cursor/rules/design-system-workflow.mdc`. **Mục tiêu:** `docs/design-system-plan.md`.
@@ -1,38 +0,0 @@
1
- ---
2
- description: Accessibility & WCAG AA color contrast — chữ/nền ≥ 4.5:1; semantic .text trên nền màu; #000/#fff trên swatch. Skill a11y: .cursor/skills/accessibility.md
3
- globs: src/**/*.{vue,ts,tsx,jsx}, src/storybook/**/*
4
- alwaysApply: false
5
- ---
6
-
7
- # Accessibility (Color contrast WCAG AA)
8
-
9
- Mọi chữ và nền phải đạt **WCAG 2.1 AA**: chữ thường ≥ 4.5:1, chữ lớn (18pt+ hoặc 14pt đậm) ≥ 3:1. Tham chiếu: [Deque color-contrast](https://dequeuniversity.com/rules/axe/4.11/color-contrast?application=axeAPI).
10
-
11
- ## Quy tắc bắt buộc
12
-
13
- 1. **Không dùng `colorTokens.text.disabled` cho nội dung đọc được**
14
- Chỉ dùng cho trạng thái disabled thật (control bị tắt). Body text, label, caption dùng `text.primary` hoặc `text.secondary` trên nền có tương phản đủ.
15
-
16
- 2. **Chữ trên nền có màu (success, warning, error, info)**
17
- Luôn dùng **semantic .text** tương ứng (vd: `colors.success.light.text` trên `colors.success.light.surface`). Không thay bằng neutral 400/500/600 cho mô tả.
18
-
19
- 3. **Chữ trên swatch / ô màu**
20
- Dùng màu đặc theo luminance: `#000` khi nền sáng (lum > 0.5), `#fff` khi nền tối (lum ≤ 0.5). Tránh rgba với opacity thấp.
21
-
22
- 4. **Tag / pill / chip trên swatch hoặc nền đặc biệt**
23
- Chọn màu chữ và nền pill theo luminance nền bên dưới để cặp đạt ≥ 4.5:1.
24
-
25
- 5. **Token secondary / subtle**
26
- Chỉ dùng khi cặp với nền đã kiểm tra. Nếu nghi ngờ, dùng bậc đậm hơn (neutral 600/700 thay cho 400/500).
27
-
28
- ## Ví dụ trong dự án
29
-
30
- - **Colors.stories.ts:** SectionBrand, SectionNeutral, SectionSuccess, SectionWarning dùng ColorCard (hex #000/#fff, tag theo luminance), ScaleBar (#000/#fff), AlertChip (descColor = semantic .text), TokenBlock và panelStyles không dùng text.disabled cho nội dung.
31
-
32
- ## Khi thêm component hoặc story mới
33
-
34
- - Ưu tiên token (`colorTokens`, `inetDesignTokens`); tránh hardcode hex/rgba cho chữ.
35
- - Chạy axe (hoặc addon a11y) trên story; sửa mọi lỗi color-contrast trước khi merge.
36
- - Theme Vuetify: `on-success` / `on-warning` lấy từ `inet-design-tokens` (đã map trong `v-light.ts` / `v-dark.ts`).
37
-
38
- Khi chỉnh sửa file khớp glob, áp dụng các quy tắc trên để tránh lặp lỗi contrast. Skill tổng thể (ARIA, keyboard, focus, contrast): `.cursor/skills/accessibility.md`.
@@ -1,107 +0,0 @@
1
- ---
2
- description: BEM class naming và style theo class — dễ tìm DOM, cập nhật quy mô lớn, tránh phình file do inline style
3
- globs: src/design-system/**/*, src/components/**/*, src/storybook/**/*, **/*.stories.ts, **/*.vue, src/assets/styles/**/*
4
- alwaysApply: false
5
- ---
6
-
7
- # BEM Class & Style theo class (Rule bắt buộc khi tạo/cập nhật design-system, components, stories)
8
-
9
- Khi tạo mới hoặc cập nhật component, foundation story hoặc bất kỳ file thuộc design system, **luôn dùng cấu hình class theo BEM** và **ưu tiên style qua class (CSS/SCSS)** thay vì attribute `style` inline. Rule này bổ sung `component-naming.mdc` và `storybook.mdc`.
10
-
11
- ## Mục đích
12
-
13
- | Mục tiêu | Cách đạt |
14
- |----------|----------|
15
- | **Dễ tìm kiếm theo DOM** | Root và section có class BEM cố định; querySelector / test / DevTools tìm theo class. |
16
- | **Dễ cập nhật, chỉnh sửa style quy mô lớn** | Một class nhiều chỗ dùng; sửa một định nghĩa trong CSS/SCSS là đủ. |
17
- | **Không bị scale dung lượng file vì attribute style** | Tránh object `style: { ... }` lặp lại hàng chục/dòng; đưa vào class trong CSS/SCSS. |
18
-
19
- ## Quy ước BEM
20
-
21
- - **Block**: thành phần độc lập; tên **kebab-case**, một từ hoặc cụm (vd: `spacing-layout-stories`, `vi-button`, `colors-stories`).
22
- - **Element**: phần con thuộc block; nối bằng `__` (hai gạch dưới): `block__element` (vd: `spacing-layout-stories__overview`, `spacing-layout-stories__card`).
23
- - **Modifier**: biến thể của block hoặc element; nối bằng `--`: `block--modifier` hoặc `block__element--modifier` (vd: `vi-button--primary`, `spacing-layout-stories__card--highlight`).
24
-
25
- Tên class: **chỉ lowercase, số và dấu gạch nối**; không dùng camelCase hay PascalCase trong class.
26
-
27
- ## Áp dụng theo loại file
28
-
29
- ### 1. Foundation stories (`src/storybook/Foundations/*.stories.ts`)
30
-
31
- - **Root element** (div/vue wrapper của toàn bộ story): luôn có **một block class** tương ứng tên story, ví dụ:
32
- - `SpacingLayout.stories.ts` → `class: 'spacing-layout-stories'`
33
- - `Colors.stories.ts` → `class: 'colors-stories'`
34
- - `Typography.stories.ts` → `class: 'typography-stories'`
35
- - **Section / nhóm nội dung**: dùng element class, ví dụ `spacing-layout-stories__overview`, `spacing-layout-stories__grid`, `spacing-layout-stories__card`.
36
- - **Style**: Ưu tiên đưa vào file SCSS/CSS (cùng thư mục hoặc `src/assets/styles/`) và gắn class; **inline `style`** chỉ dùng khi giá trị **động** (theme CSS variable, token runtime, prop). Ví dụ nền/ chữ theo theme có thể giữ `style` với `var(--v-theme-*)` hoặc chuyển sang class + CSS variable trong SCSS.
37
-
38
- ### 2. Component Vue (`*.vue` trong `src/design-system/`, `src/components/`)
39
-
40
- - **Root element** của component: có **block class** trùng với tên component dạng kebab-case (vd: `vi-button` → class `vi-button`, `BaseAlert` → `base-alert`).
41
- - **Phần con**: dùng `__element` (vd: `vi-button__icon`, `base-alert__title`). Biến thể dùng `--modifier` (vd: `vi-button--primary`).
42
- - **Style**: Trong `<style scoped>` hoặc file `.css`/`.scss` cùng thư mục; tránh style inline trừ khi dynamic.
43
-
44
- ### 3. Stories của component (`*.stories.ts` cạnh component)
45
-
46
- - **Root wrapper** (nếu có) hoặc **canvas container**: nên có block class, ví dụ `vi-button-stories` hoặc dùng trực tiếp component (component đã có block class).
47
- - **Style** cho layout story: dùng class + CSS/SCSS thay vì inline.
48
-
49
- ## Vị trí đặt CSS/SCSS — Tổng thể dự án
50
-
51
- Toàn bộ SCSS/CSS dùng chung (BEM, layout, foundations, component blocks) nằm dưới **một điểm vào**: `src/assets/styles/`. Không tách riêng SCSS chỉ cho Storybook Foundations; mọi phần (foundations, design-system, components, app) đều tham chiếu hoặc import từ đây.
52
-
53
- ### Cấu trúc gợi ý `src/assets/styles/`
54
-
55
- | File / thư mục | Mục đích | Ai dùng |
56
- |----------------|----------|---------|
57
- | `main.scss` | Entry: import tokens + các partial; được load bởi app/Storybook. | Toàn app, Storybook (qua plugin Vite/Vuetify). |
58
- | `inet-tokens.scss` | Biến CSS từ design tokens (đã có). | Mọi SCSS khác qua `@use`. |
59
- | `_variables.scss` | Biến/mixin dùng chung (nếu cần). | Các partial. |
60
- | `foundations/` | Partial theo từng foundation story (BEM block). | Story import hoặc `main.scss` import. |
61
- | `foundations/_spacing-layout-stories.scss` | Class `.spacing-layout-stories`, `.spacing-layout-stories__*`. | `SpacingLayout.stories.ts` (import trong story hoặc qua main). |
62
- | `foundations/_colors-stories.scss` | Class `.colors-stories`, `.colors-stories__*`. | `Colors.stories.ts`. |
63
- | `foundations/_typography-stories.scss` | Class `.typography-stories`, `.typography-stories__*`. | `Typography.stories.ts`. |
64
- | `foundations/_index.scss` | `@forward` các partial foundations. | `main.scss` import một lần. |
65
- | `components/` hoặc `design-system/` | Partial cho Vi* / brands / errors (block BEM component). | Component Vue import file rời hoặc dùng `<style scoped>`; có thể forward từ đây nếu cần dùng chung. |
66
-
67
- - **Foundation stories**: Style theo class BEM đặt trong `src/assets/styles/foundations/`; story file có thể import trực tiếp `@/assets/styles/foundations/spacing-layout-stories.scss` hoặc dùng chung qua `main.scss` (đã load toàn app).
68
- - **Component Vue (vi-ui, brands, errors)**: Có thể (1) `<style scoped>` trong `.vue`, hoặc (2) file SCSS cùng thư mục component và import trong component, hoặc (3) partial trong `src/assets/styles/components/` và import từ `main.scss` nếu style dùng nhiều nơi.
69
- - **Chung toàn app**: Reset, layout, utility — trong `main.scss` hoặc partial `_base.scss` / `_utilities.scss` trong `src/assets/styles/`.
70
-
71
- ### Nguyên tắc
72
-
73
- - **Một nguồn sự thật**: Tokens → `inet-tokens.scss`; class BEM cho story/component → partial trong `src/assets/styles/` (foundations, components), không rải file SCSS riêng lẻ ngoài cấu trúc này (trừ `<style scoped>` trong Vue).
74
- - **Foundations** là một phần của tổng thể: không tạo thư mục SCSS riêng cho `src/storybook/Foundations/`; dùng `src/assets/styles/foundations/` và import từ entry chung hoặc từ story.
75
-
76
- ## Ví dụ (theo SpacingLayout.stories.ts)
77
-
78
- - Root:
79
- ```ts
80
- h('div', { class: 'spacing-layout-stories', style: { padding: '24px', ... } }, [...])
81
- ```
82
- Chuẩn hóa: root giữ `class: 'spacing-layout-stories'`; các thuộc tính tĩnh (padding, borderRadius, minHeight) nên chuyển vào `.spacing-layout-stories { ... }` trong file SCSS; chỉ giữ inline khi dùng biến theme (vd `backgroundColor: themeColors.surfaceBackground` hoặc `var(--v-theme-background)`).
83
-
84
- - Section/ card:
85
- ```ts
86
- h('div', { class: 'spacing-layout-stories__card', ... }, [...])
87
- ```
88
-
89
- ## Ngoại lệ (inline style chấp nhận được)
90
-
91
- - Giá trị **phụ thuộc runtime**: theme (CSS variable), token đọc từ composable, prop (vd width/height từ args).
92
- - **Một lần**, ít lặp: một vài thuộc tính đơn lẻ không đáng kể dung lượng.
93
-
94
- ## Checklist khi tạo/cập nhật
95
-
96
- - [ ] Root element có **block class** BEM (kebab-case) chưa?
97
- - [ ] Section/ element con có **element class** (`block__element`) hoặc modifier khi cần?
98
- - [ ] Style **tĩnh** đã đưa vào class (CSS/SCSS) chưa, tránh lặp object `style` lớn?
99
- - [ ] Có thể **tìm nhanh trong DOM** bằng class (DevTools, test, script) không?
100
-
101
- ## Tham chiếu
102
-
103
- - Naming component/file: `component-naming.mdc`
104
- - Cấu trúc Storybook: `storybook.mdc`
105
- - Design system & tokens: `design-system-component-library.mdc`, `tokens.mdc`
106
-
107
- Khi được kích hoạt (file khớp glob), **chủ động gợi ý hoặc áp dụng** class BEM và chuyển style sang class/CSS để đạt ba mục đích trên.
@@ -1,57 +0,0 @@
1
- ---
2
- description: Component naming (bắt buộc) — quy ước tên component, file, props, thư mục
3
- globs: src/design-system/**/*, src/components/**/*, src/storybook/**/*, **/*.stories.ts
4
- alwaysApply: false
5
- ---
6
-
7
- # Component Naming (Rule bắt buộc)
8
-
9
- Khi tạo hoặc đổi tên component, story, thư mục trong design system, tuân theo quy ước dưới đây. Chi tiết vị trí file: `project-structure.mdc`; workflow NHÓM: `design-system-workflow.mdc`.
10
-
11
- ## Quy tắc đặt tên tổng quát (dự án)
12
-
13
- | Đối tượng | Quy ước | Ví dụ |
14
- |-----------|---------|--------|
15
- | Tên Component (.vue) | PascalCase | `ProductCard.vue` |
16
- | Thư mục chứa Component | PascalCase | `src/components/ProductCard/` |
17
- | Interfaces / Types | PascalCase | `ProductInfo` |
18
- | Composables (.ts) | camelCase | `useAuth.ts`, `useLocalStorage.ts` |
19
- | Biến (props, refs) | camelCase | `const isLoading = ref(false)` |
20
- | Sự kiện (emit) | kebab-case | `emit('close-modal')` |
21
-
22
- **Ngoại lệ:** Trong `src/design-system/vi-ui/` thư mục component dùng **kebab-case** `vi-<tên>` (vd. `vi-button/`, `vi-input/`) theo quy ước vi-ui; tên file và component vẫn PascalCase (`ViButton.vue`).
23
-
24
- **src/storybook:** Thư mục con PascalCase (`Introduction/`, `Foundations/`, `Themes/`); file `.vue`, `.stories.ts`, `.mdx` PascalCase (vd. `NeoBrutalism.vue`, `Colors.stories.ts`). Chi tiết: `storybook.mdc`.
25
-
26
- ## Quy ước chính (chi tiết)
27
-
28
- | Loại | Quy ước | Ví dụ |
29
- |------|---------|--------|
30
- | **Component Vue** | PascalCase; BaseX nếu là base/primitive | `Button.vue`, `BaseAlert.vue`, `ErrorPage.vue`, `ViButton.vue` |
31
- | **Component vi-ui** | Tiền tố `Vi` + PascalCase; thư mục `vi-<tên>` | `ViButton.vue` trong `vi-button/`, `ViInput.vue` trong `vi-input/` |
32
- | **Stories** | `ComponentName.stories.ts`, cùng thư mục với component | `ViButton.stories.ts`, `BaseAlert.stories.ts` |
33
- | **Props / events** | kebab-case trong template; camelCase trong script; emit: kebab-case | `variant="primary"`, `defineProps<{ variant: string }>()`, `emit('close-modal')` |
34
- | **Thư mục component** | PascalCase (xem bảng trên); vi-ui: kebab `vi-<tên>` | `ProductCard/`, `vi-button/`, `brands/` (nhóm) |
35
- | **Composables** | camelCase, tiền tố `use` | `useAuth.ts`, `useLocalStorage.ts` |
36
- | **Token / types** | Token file: lowercase hoặc camelCase; types: PascalCase, file `*-types.ts` hoặc `*.d.ts` | `inet-design-tokens.ts`, `inet-tokens-types.ts` |
37
- | **CSS/SCSS** | lowercase, gạch nối nếu cần | `main.scss`, `_error-page.css` |
38
- | **Class (BEM)** | block__element--modifier; kebab-case | `spacing-layout-stories`, `spacing-layout-stories__card` — chi tiết: `bem-class-style.mdc` |
39
-
40
- ## Vi-ui (design-system)
41
-
42
- - **Tên component:** `Vi` + tên (PascalCase), vd: `ViButton`, `ViCard`, `ViAlert`.
43
- - **Thư mục:** `vi-<tên>` (kebab-case), vd: `src/design-system/vi-ui/vi-button/`.
44
- - **File:** `ViName.vue` và `ViName.stories.ts` trong cùng thư mục.
45
- - **Export:** Re-export qua `src/design-system/vi-ui/index.ts` nếu có.
46
- - **Story Vue (khi component có slot):** Nếu component dùng nhiều slot (activator + default, list + items) và story dùng `render()` dễ khiến preview trống, tạo thêm `ViNameStory.vue` chứa template đầy đủ + dữ liệu demo; trong `ViName.stories.ts` dùng `component: ViNameStory` và chỉ truyền `args`. Chi tiết: `storybook.mdc` § "Vi-ui: Component có slot → dùng Story Vue".
47
-
48
- ## Components (brands, errors, icons)
49
-
50
- - **Tên component:** PascalCase, không bắt buộc tiền tố Vi (vd: `BrandLogo`, `ErrorPage`, `ArrowLeftRight`).
51
- - **Thư mục:** Một thư mục per component, tên lowercase (vd: `src/components/brands/`, `src/components/errors/`).
52
-
53
- ## Story title (sidebar)
54
-
55
- - Theo cấu trúc trong `storybook.mdc`: `{Nhóm}/{Tên}`, vd: `vi-ui/Button`, `Brands/Logo`, `Errors/ErrorPage`, `Foundations/Colors`.
56
-
57
- Khi được kích hoạt (file khớp glob), áp dụng quy ước naming trên và gợi ý chỉnh nếu lệch.
@@ -1,59 +0,0 @@
1
- ---
2
- description: Design system & component architecture — Vue 3 + Vuetify, tokens, API, NHÓM; naming PascalCase, vi-*, *.stories.ts. Cùng dùng: component-naming.mdc, design-system-workflow.mdc. Skill: .cursor/skills/vue-vuetify-design-system-architect.md
3
- globs: src/components/**/*, src/design-system/**/*, src/tokens/**/*, src/storybook/**/*, src/assets/styles/**/*, docs/**/*
4
- alwaysApply: false
5
- ---
6
-
7
- # Design System & Component Library (Subagent)
8
-
9
- **Bạn là design system và component library trong dự án này.**
10
-
11
- ## Vai trò
12
-
13
- - **Nguồn chân lý** cho tokens, components và quy ước giao diện của dự án.
14
- - **Hướng dẫn** khi tạo/sửa component, tokens, stories hoặc tài liệu design system.
15
- - **Đảm bảo** mọi output dùng Vue 3 + Vuetify và design tokens từ `src/tokens/`.
16
-
17
- ## Nguyên tắc khi áp dụng rule này
18
-
19
- 1. **Tokens trước** — Màu, spacing, typography lấy từ design system; không hard-code giá trị theme/layout.
20
- 2. **Vue 3 + Vuetify** — Composition API, `<script lang="ts" setup>`, component/theme Vuetify 3; theme bắt nguồn từ tokens.
21
- 3. **Accessibility** — ARIA, bàn phím, focus, HTML ngữ nghĩa; kiểm tra tương phản và vùng chạm.
22
- 4. **API rõ ràng** — Props, slots, events nhất quán; tùy biến qua props/theme thay vì override từng chỗ.
23
- 5. **Tuân AGENTS.md** — Không tự chạy lệnh shell khi chưa có đồng ý; giải thích rủi ro với thao tác hạ tầng.
24
- 6. **Class BEM & style theo class** — Root component/story có block class BEM; style qua CSS/SCSS, tránh inline style trừ giá trị động. Chi tiết: `bem-class-style.mdc`.
25
- 7. **Vi-ui & Icons khi gen code** — Khi tạo/sửa UI, story hoặc demo: dùng component **Vi\*** từ vi-ui (không gọi trực tiếp `v-btn`, `v-text-field`, `v-card`, `v-menu` khi đã có ViButton, ViInput, ViCard, ViMenu); **không dùng raw `<button>`** cho action (copy, submit, link-style) — dùng **ViButton** (variant text/outlined/… tùy ngữ cảnh); icon mặc định **Tabler Icons** (`@tabler/icons-vue`). Chi tiết: `icons.mdc`, `storybook.mdc`. Áp dụng cho toàn dự án và repo consumer dùng @viui/cli (AI codegen).
26
-
27
- ## Naming (tóm tắt)
28
-
29
- | Loại | Quy ước | Ví dụ |
30
- |------|---------|--------|
31
- | **Component vi-ui** | Tiền tố `Vi` + PascalCase; thư mục `vi-<tên>` | `ViButton.vue` trong `vi-button/` |
32
- | **Component khác** | PascalCase | `ErrorPage.vue`, `BrandLogo.vue` |
33
- | **Stories** | `ComponentName.stories.ts`, cùng thư mục | `ViButton.stories.ts` |
34
- | **Props / events** | kebab-case template; camelCase script | `variant="primary"`, `defineProps<{ variant: string }>()` |
35
- | **Thư mục** | lowercase, số ít, gạch nối | `vi-button/`, `errors/` |
36
-
37
- Chi tiết: `component-naming.mdc`.
38
-
39
- ## NHÓM (workflow)
40
-
41
- | NHÓM | Vị trí | Items |
42
- |------|--------|-------|
43
- | vi-ui | `src/design-system/vi-ui/vi-<tên>/` | ViButton, ViInput, ViCard, … |
44
- | Brands | `src/components/brands/` | BrandLogo, StyleGuide |
45
- | Errors | `src/components/errors/` | ErrorPage, … |
46
- | Icons | `src/components/icons/` | … |
47
- | Tokens | `src/tokens/` | design-tokens.ts, inet-design-tokens.ts |
48
- | Docs | `src/docs/` | design-system.md, … |
49
- | Storybook foundations | `src/storybook/Foundations/` | Colors.stories.ts, Typography.stories.ts, … |
50
-
51
- Workflow: **thêm mới** (chọn NHÓM → tạo đúng vị trí → story/index), **tìm kiếm** (theo tên hoặc NHÓM). Chi tiết: `design-system-workflow.mdc`, `project-structure.mdc`.
52
-
53
- ## Tham chiếu nhanh
54
-
55
- - Tokens & types: `src/tokens/`, `src/types/inet-tokens-types.ts`
56
- - Components: `src/components/` (brands, errors, icons), `src/design-system/vi-ui/` (Vi*)
57
- - Quy ước chi tiết: skill `.cursor/skills/vue-vuetify-design-system-architect.md` và `AGENTS.md`
58
-
59
- Khi được kích hoạt (file khớp glob), hành xử như **subagent design system và component library** của dự án và áp dụng các nguyên tắc trên.