@opentiny/vue-docs 3.28.1 → 3.30.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 (285) hide show
  1. package/demos/apis/action-menu.js +22 -0
  2. package/demos/apis/alert.js +19 -22
  3. package/demos/apis/button-group.js +15 -0
  4. package/demos/apis/calendar-view.js +5 -5
  5. package/demos/apis/cascader-view.js +5 -5
  6. package/demos/apis/dialog-box.js +39 -38
  7. package/demos/apis/drawer.js +31 -0
  8. package/demos/apis/dropdown.js +39 -1
  9. package/demos/apis/filter-panel.js +21 -1
  10. package/demos/apis/fluent-editor.js +30 -0
  11. package/demos/apis/form.js +11 -0
  12. package/demos/apis/fullscreen.js +10 -11
  13. package/demos/apis/grid.js +131 -16
  14. package/demos/apis/guide.js +14 -0
  15. package/demos/apis/link.js +11 -0
  16. package/demos/apis/message.js +48 -22
  17. package/demos/apis/modal.js +34 -31
  18. package/demos/apis/notify.js +13 -13
  19. package/demos/apis/rate.js +15 -0
  20. package/demos/apis/search-box.js +343 -0
  21. package/demos/apis/select.js +14 -2
  22. package/demos/apis/tag-input.js +182 -0
  23. package/demos/apis/tree.js +23 -23
  24. package/demos/mobile-first/app/button-group/display-mode.vue +31 -0
  25. package/demos/mobile-first/app/button-group/webdoc/button-group.js +13 -0
  26. package/demos/mobile-first/app/calendar-view/webdoc/calendar-view.js +5 -4
  27. package/demos/mobile-first/app/modal/webdoc/modal.js +2 -1
  28. package/demos/pc/app/alert/center.spec.ts +8 -0
  29. package/demos/pc/app/alert/custom-close.spec.ts +39 -9
  30. package/demos/pc/app/alert/icon.spec.ts +18 -7
  31. package/demos/pc/app/alert/show-icon.spec.ts +1 -1
  32. package/demos/pc/app/anchor/webdoc/anchor.js +1 -0
  33. package/demos/pc/app/base-select/copy-multi.spec.ts +1 -1
  34. package/demos/pc/app/button-group/display-mode-composition-api.vue +23 -0
  35. package/demos/pc/app/button-group/display-mode.spec.ts +0 -0
  36. package/demos/pc/app/button-group/display-mode.vue +31 -0
  37. package/demos/pc/app/button-group/sup-composition-api.vue +1 -0
  38. package/demos/pc/app/button-group/sup.vue +1 -0
  39. package/demos/pc/app/button-group/webdoc/button-group.js +14 -0
  40. package/demos/pc/app/calendar-view/calendar-event.spec.ts +1 -1
  41. package/demos/pc/app/calendar-view/custom-day-bg-color.vue +10 -0
  42. package/demos/pc/app/calendar-view/webdoc/calendar-view.js +4 -4
  43. package/demos/pc/app/cascader/filter-mode-composition-api.vue +2 -3
  44. package/demos/pc/app/checkbox/checked-composition-api.vue +3 -3
  45. package/demos/pc/app/checkbox/checked.vue +3 -3
  46. package/demos/pc/app/date-picker/align.spec.ts +10 -13
  47. package/demos/pc/app/date-picker/clear.spec.ts +3 -3
  48. package/demos/pc/app/date-picker/default-value.spec.ts +4 -4
  49. package/demos/pc/app/date-picker/events.spec.ts +2 -2
  50. package/demos/pc/app/date-picker/format.spec.ts +3 -3
  51. package/demos/pc/app/date-picker/now.spec.ts +4 -4
  52. package/demos/pc/app/date-picker/shortcuts.spec.ts +1 -1
  53. package/demos/pc/app/date-picker/slot.spec.ts +5 -5
  54. package/demos/pc/app/dialog-box/basic-usage.spec.ts +5 -5
  55. package/demos/pc/app/dialog-box/form-in-dialog.spec.ts +1 -2
  56. package/demos/pc/app/drawer/basic-usage.spec.ts +4 -3
  57. package/demos/pc/app/drawer/close-on-press-escape.spec.ts +4 -2
  58. package/demos/pc/app/drawer/placement.spec.ts +4 -4
  59. package/demos/pc/app/drawer/show-header.spec.ts +3 -2
  60. package/demos/pc/app/drawer/webdoc/drawer.js +3 -2
  61. package/demos/pc/app/dropdown/show-icon-composition-api.vue +1 -1
  62. package/demos/pc/app/dropdown/show-icon.vue +1 -1
  63. package/demos/pc/app/dropdown/tip-composition-api.vue +5 -2
  64. package/demos/pc/app/dropdown/tip.vue +5 -2
  65. package/demos/pc/app/dropdown/webdoc/dropdown.js +2 -2
  66. package/demos/pc/app/filter-panel/size-composition-api.vue +58 -0
  67. package/demos/pc/app/filter-panel/size.spec.ts +23 -0
  68. package/demos/pc/app/filter-panel/size.vue +68 -0
  69. package/demos/pc/app/filter-panel/webdoc/filter-panel.js +13 -0
  70. package/demos/pc/app/flowchart/basic-usage-composition-api.vue +10 -260
  71. package/demos/pc/app/flowchart/basic-usage.spec.ts +2 -1
  72. package/demos/pc/app/flowchart/basic-usage.vue +4 -249
  73. package/demos/pc/app/flowchart/slots-composition-api.vue +182 -0
  74. package/demos/pc/app/flowchart/slots.spec.ts +24 -0
  75. package/demos/pc/app/flowchart/slots.vue +193 -0
  76. package/demos/pc/app/flowchart/webdoc/flowchart.js +14 -2
  77. package/demos/pc/app/form/basic-usage.spec.ts +6 -4
  78. package/demos/pc/app/form/custom-validation-string-length-composition-api.vue +38 -0
  79. package/demos/pc/app/form/custom-validation-string-length.spec.ts +18 -0
  80. package/demos/pc/app/form/custom-validation-string-length.vue +28 -13
  81. package/demos/pc/app/form/group-form-composition-api.vue +2 -2
  82. package/demos/pc/app/form/group-form.vue +2 -2
  83. package/demos/pc/app/grid/filter/advanced-filter-composition-api.vue +1 -1
  84. package/demos/pc/app/grid/filter/advanced-filter.spec.js +1 -0
  85. package/demos/pc/app/grid/filter/advanced-filter.vue +1 -1
  86. package/demos/pc/app/grid/filter/custom-filter-composition-api.vue +46 -23
  87. package/demos/pc/app/grid/filter/custom-filter.spec.js +1 -1
  88. package/demos/pc/app/grid/filter/custom-filter.vue +47 -24
  89. package/demos/pc/app/grid/filter/default-filter-composition-api.vue +5 -1
  90. package/demos/pc/app/grid/filter/default-filter.spec.ts +1 -0
  91. package/demos/pc/app/grid/filter/default-filter.vue +4 -1
  92. package/demos/pc/app/grid/filter/filter-label-value-composition-api.vue +71 -0
  93. package/demos/pc/app/grid/filter/filter-label-value.spec.ts +27 -0
  94. package/demos/pc/app/grid/filter/filter-label-value.vue +78 -0
  95. package/demos/pc/app/grid/filter/input-filter-custom-component-composition-api.vue +116 -0
  96. package/demos/pc/app/grid/filter/input-filter-custom-component.spec.ts +20 -0
  97. package/demos/pc/app/grid/filter/input-filter-custom-component.vue +126 -0
  98. package/demos/pc/app/grid/filter/layout-order-filter-composition-api.vue +114 -0
  99. package/demos/pc/app/grid/filter/layout-order-filter.spec.ts +31 -0
  100. package/demos/pc/app/grid/filter/layout-order-filter.vue +123 -0
  101. package/demos/pc/app/grid/toolbar/custom-toolbar.spec.js +1 -1
  102. package/demos/pc/app/grid/webdoc/grid-filter.js +89 -40
  103. package/demos/pc/app/guide/show-close-composition-api.vue +77 -0
  104. package/demos/pc/app/guide/show-close.spec.ts +37 -0
  105. package/demos/pc/app/guide/show-close.vue +84 -0
  106. package/demos/pc/app/guide/webdoc/guide.js +12 -0
  107. package/demos/pc/app/icon/advance-icons.js +108 -2
  108. package/demos/pc/app/icon/advance-usage-composition-api.vue +26 -1
  109. package/demos/pc/app/icon/advance-usage.vue +27 -1
  110. package/demos/pc/app/icon/webdoc/icon.js +5 -3
  111. package/demos/pc/app/input/resize.spec.ts +2 -2
  112. package/demos/pc/app/link/custom-icon-composition-api.vue +1 -1
  113. package/demos/pc/app/link/custom-icon.vue +1 -1
  114. package/demos/pc/app/link/target-composition-api.vue +24 -0
  115. package/demos/pc/app/link/target.spec.ts +41 -0
  116. package/demos/pc/app/link/target.vue +30 -0
  117. package/demos/pc/app/link/webdoc/link.js +14 -0
  118. package/demos/pc/app/message/basic-usage-composition-api.vue +48 -0
  119. package/demos/pc/app/message/basic-usage.spec.ts +27 -0
  120. package/demos/pc/app/message/basic-usage.vue +50 -0
  121. package/demos/pc/app/message/message-close-composition-api.vue +25 -0
  122. package/demos/pc/app/message/message-close.spec.ts +9 -0
  123. package/demos/pc/app/message/message-close.vue +32 -0
  124. package/demos/pc/app/message/message-duration-composition-api.vue +25 -0
  125. package/demos/pc/app/message/message-duration.spec.ts +9 -0
  126. package/demos/pc/app/message/message-duration.vue +32 -0
  127. package/demos/pc/app/message/prevent-duplicate-composition-api.vue +25 -0
  128. package/demos/pc/app/message/prevent-duplicate.spec.ts +9 -0
  129. package/demos/pc/app/message/prevent-duplicate.vue +32 -0
  130. package/demos/pc/app/message/webdoc/message.cn.md +7 -0
  131. package/demos/pc/app/message/webdoc/message.en.md +7 -0
  132. package/demos/pc/app/message/webdoc/message.js +56 -0
  133. package/demos/pc/app/modal/basic-usage.spec.ts +3 -3
  134. package/demos/pc/app/modal/modal-footer-composition-api.vue +3 -3
  135. package/demos/pc/app/modal/modal-footer.spec.ts +9 -4
  136. package/demos/pc/app/modal/modal-footer.vue +3 -3
  137. package/demos/pc/app/modal/modal-header.spec.ts +2 -2
  138. package/demos/pc/app/modal/modal-size.spec.ts +2 -2
  139. package/demos/pc/app/modal/status.spec.ts +22 -15
  140. package/demos/pc/app/nav-menu/overflow.spec.ts +1 -1
  141. package/demos/pc/app/popconfirm/custom-class.spec.ts +0 -1
  142. package/demos/pc/app/popconfirm/slot-message.spec.ts +10 -2
  143. package/demos/pc/app/popconfirm/trigger.spec.ts +16 -12
  144. package/demos/pc/app/popover/basic-usage.spec.js +3 -8
  145. package/demos/pc/app/popover/custom-popper.spec.js +2 -2
  146. package/demos/pc/app/popover/delay.spec.js +2 -2
  147. package/demos/pc/app/popover/disabled.spec.js +2 -2
  148. package/demos/pc/app/popover/events.spec.js +1 -1
  149. package/demos/pc/app/popover/ignore-boundaries.spec.js +2 -3
  150. package/demos/pc/app/popover/offset.spec.js +17 -31
  151. package/demos/pc/app/radio/dynamic-disable-composition-api.vue +3 -3
  152. package/demos/pc/app/radio/dynamic-disable.vue +2 -2
  153. package/demos/pc/app/rate/clearable-composition-api.vue +20 -0
  154. package/demos/pc/app/rate/clearable.spec.js +74 -0
  155. package/demos/pc/app/rate/clearable.vue +28 -0
  156. package/demos/pc/app/rate/webdoc/rate.js +12 -0
  157. package/demos/pc/app/search/events.spec.ts +1 -1
  158. package/demos/pc/app/search-box/append-to-body-composition-api.vue +300 -0
  159. package/demos/pc/app/search-box/append-to-body.vue +308 -0
  160. package/demos/pc/app/search-box/auto-match-composition-api.vue +162 -0
  161. package/demos/pc/app/search-box/auto-match.vue +170 -0
  162. package/demos/pc/app/search-box/basic-usage-composition-api.vue +269 -0
  163. package/demos/pc/app/search-box/basic-usage.vue +277 -0
  164. package/demos/pc/app/search-box/custom-panel-composition-api.vue +63 -0
  165. package/demos/pc/app/search-box/custom-panel.vue +72 -0
  166. package/demos/pc/app/search-box/default-field-composition-api.vue +163 -0
  167. package/demos/pc/app/search-box/default-field.vue +171 -0
  168. package/demos/pc/app/search-box/editable-composition-api.vue +311 -0
  169. package/demos/pc/app/search-box/editable.vue +320 -0
  170. package/demos/pc/app/search-box/empty-placeholder-composition-api.vue +162 -0
  171. package/demos/pc/app/search-box/empty-placeholder.vue +170 -0
  172. package/demos/pc/app/search-box/events-composition-api.vue +169 -0
  173. package/demos/pc/app/search-box/events.vue +173 -0
  174. package/demos/pc/app/search-box/group-key-composition-api.vue +257 -0
  175. package/demos/pc/app/search-box/group-key.vue +266 -0
  176. package/demos/pc/app/search-box/help-composition-api.vue +166 -0
  177. package/demos/pc/app/search-box/help.vue +175 -0
  178. package/demos/pc/app/search-box/id-map-key-composition-api.vue +131 -0
  179. package/demos/pc/app/search-box/id-map-key.vue +140 -0
  180. package/demos/pc/app/search-box/item-placeholder-composition-api.vue +119 -0
  181. package/demos/pc/app/search-box/item-placeholder.vue +127 -0
  182. package/demos/pc/app/search-box/max-length-composition-api.vue +29 -0
  183. package/demos/pc/app/search-box/max-length.vue +38 -0
  184. package/demos/pc/app/search-box/max-time-length-composition-api.vue +53 -0
  185. package/demos/pc/app/search-box/max-time-length.vue +62 -0
  186. package/demos/pc/app/search-box/merge-tag-composition-api.vue +59 -0
  187. package/demos/pc/app/search-box/merge-tag.vue +68 -0
  188. package/demos/pc/app/search-box/panel-max-height-composition-api.vue +162 -0
  189. package/demos/pc/app/search-box/panel-max-height.vue +170 -0
  190. package/demos/pc/app/search-box/potential-match-composition-api.vue +193 -0
  191. package/demos/pc/app/search-box/potential-match.vue +201 -0
  192. package/demos/pc/app/search-box/settings-composition-api.vue +163 -0
  193. package/demos/pc/app/search-box/settings.vue +171 -0
  194. package/demos/pc/app/search-box/size-composition-api.vue +162 -0
  195. package/demos/pc/app/search-box/size.vue +170 -0
  196. package/demos/pc/app/search-box/split-input-value-composition-api.vue +162 -0
  197. package/demos/pc/app/search-box/split-input-value.vue +170 -0
  198. package/demos/pc/app/search-box/suffix-icon-composition-api.vue +209 -0
  199. package/demos/pc/app/search-box/suffix-icon.vue +219 -0
  200. package/demos/pc/app/search-box/v-model-composition-api.vue +174 -0
  201. package/demos/pc/app/search-box/v-model.vue +182 -0
  202. package/demos/pc/app/search-box/webdoc/search-box.cn.md +7 -0
  203. package/demos/pc/app/search-box/webdoc/search-box.en.md +7 -0
  204. package/demos/pc/app/search-box/webdoc/search-box.js +257 -0
  205. package/demos/pc/app/select/copy-multi.spec.ts +1 -1
  206. package/demos/pc/app/select-wrapper/copy-multi.spec.ts +2 -1
  207. package/demos/pc/app/tabs/basic-usage.spec.ts +2 -2
  208. package/demos/pc/app/tabs/more-show-all.spec.ts +2 -1
  209. package/demos/pc/app/tabs/tabs-events-close-composition-api.vue +8 -2
  210. package/demos/pc/app/tabs/tabs-events-close.vue +8 -2
  211. package/demos/pc/app/tag/basic-usage.spec.ts +1 -1
  212. package/demos/pc/app/tag/color-border.spec.ts +2 -2
  213. package/demos/pc/app/tag/max-width.spec.ts +1 -1
  214. package/demos/pc/app/tag/size.spec.ts +3 -3
  215. package/demos/pc/app/tag/slot-default.spec.ts +3 -3
  216. package/demos/pc/app/tag-group/basic-usage.spec.js +5 -5
  217. package/demos/pc/app/tag-group/tag-group-effect.spec.js +10 -10
  218. package/demos/pc/app/tag-group/tag-group-event.spec.js +1 -1
  219. package/demos/pc/app/tag-input/basic-usage-composition-api.vue +29 -0
  220. package/demos/pc/app/tag-input/basic-usage.spec.ts +0 -0
  221. package/demos/pc/app/tag-input/basic-usage.vue +38 -0
  222. package/demos/pc/app/tag-input/clearable-tag-composition-api.vue +20 -0
  223. package/demos/pc/app/tag-input/clearable-tag.vue +27 -0
  224. package/demos/pc/app/tag-input/collapsed-tag-composition-api.vue +20 -0
  225. package/demos/pc/app/tag-input/collapsed-tag.vue +28 -0
  226. package/demos/pc/app/tag-input/disabled-readonly-composition-api.vue +20 -0
  227. package/demos/pc/app/tag-input/disabled-readonly.vue +29 -0
  228. package/demos/pc/app/tag-input/draggable-tag-composition-api.vue +12 -0
  229. package/demos/pc/app/tag-input/draggable-tag.spec.ts +0 -0
  230. package/demos/pc/app/tag-input/draggable-tag.vue +20 -0
  231. package/demos/pc/app/tag-input/max-composition-api.vue +20 -0
  232. package/demos/pc/app/tag-input/max.vue +28 -0
  233. package/demos/pc/app/tag-input/prefix-suffix-composition-api.vue +26 -0
  234. package/demos/pc/app/tag-input/prefix-suffix.vue +34 -0
  235. package/demos/pc/app/tag-input/separator-tag-composition-api.vue +20 -0
  236. package/demos/pc/app/tag-input/separator-tag.vue +28 -0
  237. package/demos/pc/app/tag-input/webdoc/tag-input.cn.md +7 -0
  238. package/demos/pc/app/tag-input/webdoc/tag-input.en.md +7 -0
  239. package/demos/pc/app/tag-input/webdoc/tag-input.js +107 -0
  240. package/demos/pc/app/time-picker/basic-usage.spec.ts +5 -4
  241. package/demos/pc/app/time-picker/clearable.spec.ts +5 -4
  242. package/demos/pc/app/time-picker/default-value.spec.ts +2 -2
  243. package/demos/pc/app/time-picker/disabled.spec.ts +4 -3
  244. package/demos/pc/app/time-picker/format.spec.ts +8 -11
  245. package/demos/pc/app/time-picker/is-range.spec.ts +4 -3
  246. package/demos/pc/app/time-picker/name.spec.ts +1 -1
  247. package/demos/pc/app/time-picker/placeholder.spec.ts +3 -3
  248. package/demos/pc/app/time-picker/popper-class.spec.ts +1 -1
  249. package/demos/pc/app/time-picker/size.spec.ts +2 -1
  250. package/demos/pc/app/time-select/basic-usage.spec.ts +1 -1
  251. package/demos/pc/app/time-select/clear-icon.spec.ts +1 -2
  252. package/demos/pc/app/time-select/focus.spec.ts +1 -1
  253. package/demos/pc/app/time-select/picker-options.spec.ts +2 -1
  254. package/demos/pc/app/time-select/range-placeholder.spec.ts +2 -2
  255. package/demos/pc/app/time-select/size-medium.spec.ts +3 -3
  256. package/demos/pc/app/tooltip/delay.spec.js +7 -9
  257. package/demos/pc/app/tooltip/offset.spec.js +0 -2
  258. package/demos/pc/app/tooltip/popper-options.spec.js +2 -1
  259. package/demos/pc/menus.js +6 -4
  260. package/demos/pc/webdoc/changelog-en.md +209 -86
  261. package/demos/pc/webdoc/changelog.md +176 -257
  262. package/demos/pc/webdoc/develop-demo-en.md +13 -13
  263. package/demos/pc/webdoc/import-components.md +1 -1
  264. package/demos/pc/webdoc/introduce.md +2 -0
  265. package/demos/pc/webdoc/skills-en.md +107 -0
  266. package/demos/pc/webdoc/skills.md +107 -0
  267. package/demos/pc/webdoc/theme-en.md +82 -79
  268. package/demos/pc/webdoc/v3.28.0-release-article.md +943 -0
  269. package/demos/saas/menus.js +1 -0
  270. package/package.json +21 -20
  271. package/playground/App.vue +6 -4
  272. package/playground/shims/vue-search-box.mjs +154 -0
  273. package/public/static/css/mobile-dark-theme.css +1 -0
  274. package/src/i18n/index.js +1 -2
  275. package/src/main.js +8 -5
  276. package/src/style.css +5 -0
  277. package/src/views/components-doc/common.vue +0 -25
  278. package/src/views/components-doc/mobile.vue +49 -2
  279. package/vite.config.ts +3 -2
  280. package/vite.extend.ts +65 -0
  281. package/demos/pc/app/grid/webdoc/grid-ai-agent.js +0 -23
  282. package/demos/pc/webdoc/mcp-en.md +0 -101
  283. package/demos/pc/webdoc/mcp.md +0 -101
  284. package/src/components/mcp-docs.vue +0 -33
  285. package/src/composable/useTinyRemoter.ts +0 -176
@@ -2,11 +2,11 @@
2
2
 
3
3
  # Development Example
4
4
 
5
- This article is based on[Vite](https://cn.vitejs.dev/) Project example to show how to use`TinyVue`components.
5
+ This article is based on [Vite](https://cn.vitejs.dev/) Project example to show how to use `TinyVue` components.
6
6
 
7
7
  ## Building the Vite project
8
8
 
9
- Create a`Vite`Works:
9
+ Create a `Vite` project:
10
10
 
11
11
  ```bash
12
12
  yarn create vite
@@ -14,7 +14,7 @@ yarn create vite
14
14
  npm init vite@latest
15
15
  ```
16
16
 
17
- Created`Vite`Go to the project directory and run the following commands to download and start the project:
17
+ After creating the `Vite` project, go to the project directory and run the following commands to download and start the project:
18
18
 
19
19
  ```bash
20
20
  yarn
@@ -26,13 +26,13 @@ yarn dev
26
26
  npm run dev
27
27
  ```
28
28
 
29
- After the browser is started, if the following interface is displayed, it indicates that`Vite`The project is started successfully.
29
+ After the browser is started, if the following interface is displayed, it indicates that the `Vite` project is started successfully.
30
30
 
31
31
  <img src="@demos/resource/vite-vue.png" class="image" style="box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.14)" ><br><br>
32
32
 
33
- ## Install and use`TinyVue`Components
33
+ ## Install and use `TinyVue` Components
34
34
 
35
- Run the following command to install the`Vue 3.0`version of`TinyVue`Component library:
35
+ Run the following command to install the `Vue 3.0` version of `TinyVue` component library:
36
36
 
37
37
  ```bash
38
38
  yarn add @opentiny/vue@3
@@ -40,7 +40,7 @@ yarn add @opentiny/vue@3
40
40
  npm install @opentiny/vue@3
41
41
  ```
42
42
 
43
- Then modify the`vite.config.js`, add the following code highlighted section:
43
+ Then modify the `vite.config.js`, and add the following code:
44
44
 
45
45
  ```js {8-10}
46
46
  //vite.config.js
@@ -56,9 +56,9 @@ export default defineConfig({
56
56
  })
57
57
  ```
58
58
 
59
- When the installation is complete, press`Ctrl + C`Interrupt the current service, and then perform`yarn dev #npm run dev`Restart the service.
59
+ When the installation is complete, press `Ctrl + C` to interrupt the current service, and then run `yarn dev` or `npm run dev` to restart the service.
60
60
 
61
- Next, modify the`App.vue`file, add the section highlighted by the following code (in the`Button`Component as an example):
61
+ Next, modify the `App.vue` file, and add the following code (using the `Button` component as an example):
62
62
 
63
63
  ```js {5,11}
64
64
  <script setup>
@@ -86,9 +86,9 @@ import { Button as TinyButton } from '@opentiny/vue'
86
86
  </style>
87
87
  ```
88
88
 
89
- in the above writing`<script setup>`is in the single file component`SFC`Combinations used in the medium`API`Compiler syntax. For details, see.[Vue official website](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) .
89
+ In the above code, `<script setup>` is a compiler syntax sugar used in single file components `SFC` with Composition `API`. For details, see [Vue official website](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup).
90
90
 
91
- If you are not familiar with the above syntax, you can also use the standard`SFC`Format:
91
+ If you are not familiar with the above syntax, you can also use the standard `SFC` format:
92
92
 
93
93
  ```js
94
94
  <template>
@@ -106,7 +106,7 @@ export default {
106
106
  </script>
107
107
  ```
108
108
 
109
- Alternatively, a single component can be used.`TinyVue`Components:
109
+ Alternatively, you can use single component import for `TinyVue` components:
110
110
 
111
111
  ```js
112
112
  <template>
@@ -124,6 +124,6 @@ export default {
124
124
  </script>
125
125
  ```
126
126
 
127
- The green button shown below should appear on the browser interface, indicating that`TinyVue`The component has been introduced and takes effect.
127
+ The green button shown below should appear on the browser interface, indicating that the `TinyVue` component has been introduced and takes effect.
128
128
 
129
129
  <img src="@demos/resource/tiny-vue.png" class="image" style="box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.14)" ><br><br>
@@ -118,7 +118,7 @@ public-hoist-pattern[]=@opentiny/*
118
118
 
119
119
  ## `vite` 工程多组件引入按需加载和打包配置方法
120
120
 
121
- 通过配置 `@opentiny/vue-vite-import` 插件可以按需只打包 pc 或者移动的组件,减少组件库打包后的体积。
121
+ 通过配置 `@opentiny/vue-vite-import` 插件可以按需打包 pc 或者移动的组件,减少组件库打包后的体积。
122
122
 
123
123
  执行以下命令安装 `TinyVue` 按需加载和打包的 `vite` 插件
124
124
 
@@ -12,6 +12,8 @@ TinyVue 是一个跨端、跨框架的企业级 UI 组件库,基于 OpenTiny D
12
12
  - 📊 组件内部支持配置式开发,可支持低代码平台可视化组件配置
13
13
  - 💡 采用模板、样式、逻辑分离的跨端、跨框架架构,保障灵活性和可移植性
14
14
 
15
+ 组件 API / Demo 文档:[https://opentiny.design/tiny-vue](https://opentiny.design/tiny-vue)
16
+
15
17
  ## 🛠️ 核心亮点
16
18
 
17
19
  ### 1、一套代码同时支持 Vue 2 / Vue 3
@@ -0,0 +1,107 @@
1
+ # TinyVue Agent Skills Usage Guide
2
+
3
+ TinyVue Agent Skills is a comprehensive toolkit designed for AI coding assistants. It enables these assistants to gain deep understanding of TinyVue component library usage, APIs, and best practices, thereby helping developers build applications more efficiently with TinyVue.
4
+
5
+ ## What is TinyVue Skills?
6
+
7
+ The `tiny-vue-skill` is an official Agent Skill developed by OpenTiny that contains comprehensive TinyVue component documentation, practical examples, and detailed usage specifications. Once installed, your AI coding assistant (including Cursor, GitHub Copilot, Claude Code, and others) will be capable of:
8
+
9
+ - Accurately understand the APIs and properties of each TinyVue component
10
+ - Provide code examples that conform to TinyVue standards
11
+ - Intelligently recommend appropriate components for your business needs
12
+ - Help quickly build pages and features based on TinyVue
13
+
14
+ ## Installation Methods
15
+
16
+ ### Method 1: Install via Claude Code Plugin Marketplace (Recommended for Claude Code Users)
17
+
18
+ This method is ideal for Claude Code users and provides convenient one-click update functionality:
19
+
20
+ ```bash
21
+ # Add marketplace and install plugin after launching Claude Code
22
+ /plugin marketplace add https://github.com/opentiny/agent-skills
23
+ /plugin install tiny-vue-skill@opentiny-skills
24
+ ```
25
+
26
+ Or run the following commands before launching:
27
+
28
+ ```bash
29
+ claude plugin marketplace add https://github.com/opentiny/agent-skills
30
+ claude plugin install tiny-vue-skill@opentiny-skills
31
+ ```
32
+
33
+ > **Marketplace Advantage**: Skills can be easily updated using the `claude plugin update` command.
34
+
35
+ ### Method 2: Install via the `skills` Tool (Most Versatile Approach)
36
+
37
+ This method works with various AI coding tools and leverages npm for automated installation:
38
+
39
+ ```bash
40
+ # List all available skills
41
+ npx skills add opentiny/agent-skills --list
42
+
43
+ # Install tiny-vue-skill globally (for Cursor)
44
+ npx skills add opentiny/agent-skills -g --skill tiny-vue-skill --agent cursor
45
+
46
+ # Install tiny-vue-skill at project level (for Cursor)
47
+ npx skills add opentiny/agent-skills --skill tiny-vue-skill --agent cursor
48
+ ```
49
+
50
+ **`--agent` Parameter Mapping for Different AI Tools:**
51
+
52
+ | AI Tool | `--agent` Parameter |
53
+ | -------------- | ------------------- |
54
+ | Cursor | `cursor` |
55
+ | Claude Code | `claude-code` |
56
+ | GitHub Copilot | `github-copilot` |
57
+ | Windsurf | `windsurf` |
58
+ | Gemini CLI | `gemini-cli` |
59
+
60
+ ### Method 3: Manual Installation via Git Clone
61
+
62
+ **Step 1:** Clone the repository to your local machine:
63
+
64
+ ```bash
65
+ git clone https://github.com/opentiny/agent-skills.git
66
+ ```
67
+
68
+ **Step 2:** Copy the `skills/tiny-vue-skill` folder to your tool's Skills directory:
69
+
70
+ | AI Tool | Project-level Path | Global Path |
71
+ | -------------- | ------------------- | ----------------------------- |
72
+ | Cursor | `.cursor/skills/` | `~/.cursor/skills/` |
73
+ | Claude Code | `.claude/skills/` | `~/.claude/skills/` |
74
+ | GitHub Copilot | `.github/skills/` | `~/.copilot/skills/` |
75
+ | Windsurf | `.windsurf/skills/` | `~/.codeium/windsurf/skills/` |
76
+
77
+ ## Enabling Skills in Cursor IDE
78
+
79
+ To enable Skills in Cursor IDE, press `Ctrl + ,` to open Settings, search for `useagentskills`, locate the experimental feature labeled **Use Agent Skills**, and enable it by checking the corresponding box.
80
+
81
+ ## Usage Examples
82
+
83
+ Once you've installed and enabled the Skills, you can simply describe your requirements to the AI assistant. It will automatically reference TinyVue documentation to generate standardized code implementations:
84
+
85
+ **Example 1: Building a Data Grid Component**
86
+
87
+ > "Create a new Vue project and implement TinyVue's Grid component to build a Chinese provincial information query table. Include columns for serial number, province name, population, area, and GDP. Enable sorting functionality, freeze the province name column on the left side, and add a filter input field at the top of the table."
88
+
89
+ **Example 2: Implementing Dark Mode Support**
90
+
91
+ > "Add dark mode switching capability to the current TinyVue project, allowing users to toggle between light and dark themes seamlessly."
92
+
93
+ **Example 3: Creating a Registration Form**
94
+
95
+ > "Implement a user registration form using TinyVue's Form component with name, email, and password fields. Include comprehensive form validation to ensure data integrity and improve user experience."
96
+
97
+ ## Keeping Skills Up to Date
98
+
99
+ Since the TinyVue component library is continuously evolving, we strongly recommend regular Skills updates to ensure you have access to the latest component documentation and features:
100
+
101
+ - **Claude Code Users**: Execute the `claude plugin update` command
102
+ - **Skills Tool Users**: Re-execute the installation command to overwrite and update existing installations
103
+ - **Manual Installation Users**: Pull the latest changes from the repository and copy the updated `tiny-vue-skill` folder
104
+
105
+ ## Related Resources
106
+
107
+ - **GitHub Repository**: [opentiny/agent-skills](https://github.com/opentiny/agent-skills)
@@ -0,0 +1,107 @@
1
+ # TinyVue Agent Skills 使用指南
2
+
3
+ TinyVue Agent Skills 是一套面向 AI 编码助手的技能工具集,让 AI 助手深度理解 TinyVue 组件库的用法、API 和最佳实践,从而帮助您更高效地使用 TinyVue 开发应用。
4
+
5
+ ## 什么是 TinyVue Skills?
6
+
7
+ `tiny-vue-skill` 是 OpenTiny 官方提供的 Agent Skill,包含了 TinyVue 组件的文档、示例和使用规范。安装后,您所使用的 AI 编码助手(如 Cursor、GitHub Copilot、Claude Code 等)将能够:
8
+
9
+ - 精准理解 TinyVue 各组件的 API 和属性
10
+ - 提供符合 TinyVue 规范的代码示例
11
+ - 智能推荐合适的组件解决业务需求
12
+ - 帮助快速搭建基于 TinyVue 的页面和功能
13
+
14
+ ## 安装方式
15
+
16
+ ### 方式一:通过 Claude Code 插件市场安装(Claude Code用户推荐)
17
+
18
+ 适用于使用 Claude Code 的用户,支持后续一键更新:
19
+
20
+ ```bash
21
+ # 启动 Claude Code 后添加市场及插件
22
+ /plugin marketplace add https://github.com/opentiny/agent-skills
23
+ /plugin install tiny-vue-skill@opentiny-skills
24
+ ```
25
+
26
+ 或在未启动状态下执行:
27
+
28
+ ```bash
29
+ claude plugin marketplace add https://github.com/opentiny/agent-skills
30
+ claude plugin install tiny-vue-skill@opentiny-skills
31
+ ```
32
+
33
+ > 通过市场安装的优势:可使用 `claude plugin update` 命令轻松更新技能。
34
+
35
+ ### 方式二:通过 `skills` 工具安装(推荐)
36
+
37
+ 适用于多种 AI 编码工具,使用 npm 工具自动安装:
38
+
39
+ ```bash
40
+ # 列出所有可用技能
41
+ npx skills add opentiny/agent-skills --list
42
+
43
+ # 全局安装 tiny-vue-skill(适用于 Cursor)
44
+ npx skills add opentiny/agent-skills -g --skill tiny-vue-skill --agent cursor
45
+
46
+ # 项目级安装 tiny-vue-skill(适用于 Cursor)
47
+ npx skills add opentiny/agent-skills --skill tiny-vue-skill --agent cursor
48
+ ```
49
+
50
+ 其他 AI 工具对应的 `--agent` 参数:
51
+
52
+ | AI 工具 | `--agent` 参数 |
53
+ | -------------- | ---------------- |
54
+ | Cursor | `cursor` |
55
+ | Claude Code | `claude-code` |
56
+ | GitHub Copilot | `github-copilot` |
57
+ | Windsurf | `windsurf` |
58
+ | Gemini CLI | `gemini-cli` |
59
+
60
+ ### 方式三:手动克隆复制安装
61
+
62
+ 1. 克隆仓库到本地:
63
+
64
+ ```bash
65
+ git clone https://github.com/opentiny/agent-skills.git
66
+ ```
67
+
68
+ 2. 将 `skills/tiny-vue-skill` 文件夹复制到对应工具的 Skills 目录:
69
+
70
+ | AI 工具 | 项目内路径 | 全局路径 |
71
+ | -------------- | ------------------- | ----------------------------- |
72
+ | Cursor | `.cursor/skills/` | `~/.cursor/skills/` |
73
+ | Claude Code | `.claude/skills/` | `~/.claude/skills/` |
74
+ | GitHub Copilot | `.github/skills/` | `~/.copilot/skills/` |
75
+ | Windsurf | `.windsurf/skills/` | `~/.codeium/windsurf/skills/` |
76
+
77
+ ## 在 Cursor 中启用 Skills
78
+
79
+ 按快捷键 `Ctrl + ,` 打开设置界面,搜索 `useagentskills`,找到实验性功能 **Use Agent Skills**,勾选启用即可。
80
+
81
+ ## 使用示例
82
+
83
+ 安装并启用 Skills 后,您可以直接向 AI 助手描述需求,AI 将自动参考 TinyVue 文档生成标准的代码实现:
84
+
85
+ **示例 1:创建数据表格**
86
+
87
+ > 新建一个 Vue 工程,使用 TinyVue 的 Grid 组件开发一个中国省级信息查询表格,包含序号、省名、人口、面积、GDP 等列,支持排序,省名列固定在最左边,表格顶部有按省名过滤的功能。
88
+
89
+ **示例 2:开启深色模式**
90
+
91
+ > 为当前 TinyVue 工程增加深色模式切换能力。
92
+
93
+ **示例 3:使用表单组件**
94
+
95
+ > 使用 TinyVue 的 Form 组件创建一个用户注册表单,包含姓名、邮箱、密码字段,并添加表单校验。
96
+
97
+ ## 保持 Skills 更新
98
+
99
+ TinyVue 组件库持续迭代,建议定期更新 Skills 以获取最新的组件文档:
100
+
101
+ - **Claude Code 用户**:执行 `claude plugin update` 命令
102
+ - **`skills` 工具用户**:重新执行安装命令覆盖更新
103
+ - **手动安装用户**:重新拉取仓库并复制最新的 `tiny-vue-skill` 文件夹
104
+
105
+ ## 相关资源
106
+
107
+ - [opentiny/agent-skills GitHub 仓库](https://github.com/opentiny/agent-skills)
@@ -6,20 +6,19 @@
6
6
  </div>
7
7
  </div>
8
8
 
9
- 537/5000
10
- A set of global CSS variables is defined in the TinyVue component library to unify theme styles, such as fonts, colors, spacing, and rounding values, and component-level CSS variables are also defined within each component. Starting with the <code> @opentiny/vue@3.19.0 </code> version, the overall style of the component library is changed to a new 'Opentiny Design' style, which is more suitable for enterprise-class and background management applications. If you want to use the OLD theme style, you can choose to continue using the historical version, or refer to the current document's <a href='#OLD theme configuration '>OLD theme configuration </a>.
9
+ A comprehensive set of global CSS variables is defined in the TinyVue component library to unify theme styles, including fonts, colors, spacing, and rounding values. Additionally, component-level CSS variables are defined within each individual component. Starting from version <code>@opentiny/vue@3.19.0</code>, the component library's overall style has been updated to the new 'Opentiny Design' style, which is specifically tailored for enterprise-class applications and backend management systems. If you prefer to use the legacy theme style, you can continue using the historical version or refer to the <a href='#old-theme-configuration'>OLD Theme Configuration</a> section in this document.
11
10
 
12
- - The global 'CSS variable' is located in the 'base' directory of the theme package: [base/vars.less](https://github.com/opentiny/tiny-vue/blob/dev/packages/theme/src/base/vars.less)
11
+ - Global CSS variables are located in the 'base' directory of the theme package: [base/vars.less](https://github.com/opentiny/tiny-vue/blob/dev/packages/theme/src/base/vars.less)
13
12
 
14
- - Component-level 'CSS variables' in the theme root of each component, Such as [the button/vars. Less] (<https://github.com/opentiny/tiny-vue/blob/dev/packages/theme/src/button/vars.less>)
13
+ - Component-level CSS variables are defined in the theme root directory of each component, such as [button/vars.less](https://github.com/opentiny/tiny-vue/blob/dev/packages/theme/src/button/vars.less)
15
14
 
16
- By reading the above source code, you can see which styles of component libraries can be customized.
15
+ By examining the source code above, you can identify which component library styles can be customized.
17
16
 
18
- ## Custom theme
17
+ ## Custom Theme
19
18
 
20
- In a user's project, if you need to customize the theme style, or override the style of some components, you can configure the theme of the user project using the 'TinyThemeTool' class provided by the component library. We will also provide more topics for you to choose from in the future.
19
+ In your project, if you need to customize the theme style or override specific component styles, you can configure the project theme using the 'TinyThemeTool' class provided by the component library. We will continue to provide additional theme options for you to choose from in the future.
21
20
 
22
- 'ThemeData' is a custom theme data format that allows users to pass in overwritten global CSS variables via the 'data' property and valid css rule blocks via the 'CSS' property.
21
+ 'ThemeData' is a custom theme data format that allows users to pass overridden global CSS variables through the 'data' property and valid CSS rule blocks through the 'css' property.
23
22
 
24
23
  ```ts
25
24
  interface ThemeData {
@@ -79,9 +78,9 @@ themeTool.changeTheme({
79
78
  </div>
80
79
  </div>
81
80
 
82
- ## Micro Frontends scene
81
+ ## Micro Frontends Scenario
83
82
 
84
- By default, the 'themeTool.changeTheme' method will mount a custom style to the current 'document'. However, in microfront end frameworks, there is often a mechanism for style isolation, such as an unbounded microfront that encloses a 'Web Component' to mount child applications. If you customize the theme in this scenario, you must mount the style to the 'ShadowRoot' of the subapplication.
83
+ By default, the 'themeTool.changeTheme' method mounts custom styles to the current 'document'. However, in micro frontend frameworks, there is typically a style isolation mechanism in place. For instance, an unbounded micro frontend may encapsulate child applications within a 'Web Component'. When customizing themes in such scenarios, you must mount the styles to the 'ShadowRoot' of the sub-application.
85
84
 
86
85
  ```ts
87
86
  import TinyThemeTool from '@opentiny/vue-theme/theme-tool'
@@ -103,60 +102,60 @@ themeTool.changeTheme(
103
102
  )
104
103
  ```
105
104
 
106
- ## OLD 主题配置
105
+ ## OLD Theme Configuration
107
106
 
108
- We do not recommend that users continue to use the old theme, but for historical projects, we provide a set of 'CSS variables' of the old theme that users need to adapt in the project.
107
+ We do not recommend that users continue using the old theme. However, for legacy projects, we provide a set of old theme 'CSS variables' that users need to adapt in their projects.
109
108
 
110
109
  ```ts
111
110
  import TinyThemeTool, { OldTheme } from '@opentiny/vue-theme/theme-tool'
112
111
 
113
112
  const themeTool = new TinyThemeTool(OldTheme)
114
113
 
115
- // themeTool.changeTheme(OldTheme) // 效果同上
114
+ // themeTool.changeTheme(OldTheme) // Same effect as above
116
115
  ```
117
116
 
118
117
  <div class="warning custom-block">
119
- 旧主题不能 100% 还原历史版本的所有细节,如果用户升级后有较大的影响,可以跟我们反馈。也可以回退使用<code> @opentiny/vue@3.18.0 </code> 版本,我们将继续维护一段时间。
118
+ The old theme cannot 100% replicate all details of historical versions. If users experience significant impacts after upgrading, they can provide feedback to us. Alternatively, you can roll back to version <code>@opentiny/vue@3.18.0</code>, which we will continue to maintain for some time.
120
119
  </div>
121
120
 
122
- ## Historical version of the theme configuration
121
+ ## Historical Version Theme Configuration
123
122
 
124
123
  <div class="danger custom-block">
125
- 本节文档仅支持 <code> @opentiny/vue@3.18.0 </code> 版本之前的主题定制
124
+ This section of the documentation only supports theme customization for versions prior to <code>@opentiny/vue@3.18.0</code>
126
125
  </div>
127
126
 
128
- The `TinyVue` multi-topic uses `css` variables and defines a series of global/component style variables that you can adjust according to your requirements.
127
+ The `TinyVue` component library utilizes `css` variables and defines a series of global/component style variables that you can adjust according to your specific requirements.
129
128
 
130
- Variables involved in the topic. To view the variables, perform the following steps:
129
+ To view the theme-related variables, follow these steps:
131
130
 
132
131
  Source code: [basic-var.less](https://github.com/opentiny/tiny-vue-theme/blob/main/src/base/basic-var.less)
133
132
 
134
- Design website: [Administrative side specification design variable] (<https://rnd-think.huawei.com/think-home/designAnnotation>)
133
+ Design documentation: [Administrative interface specification design variables](https://rnd-think.huawei.com/think-home/designAnnotation)
135
134
 
136
- Basic style variable `npm` Repository path: `@opentiny/vue-theme/theme`
135
+ Basic style variable `npm` repository path: `@opentiny/vue-theme/theme`
137
136
 
138
- ### Using predefined themes and dynamically switching themes
137
+ ### Using Predefined Themes and Dynamic Theme Switching
139
138
 
140
- Currently, the official offers 4 sets of themes:
139
+ The official distribution currently offers 4 theme sets:
141
140
 
142
- -Default Theme
143
- -Infinity Theme `tinyInfinityTheme`
144
- -Aurora Theme `tinyAuroraTheme`
145
- -XDesign Theme `tinySmbTheme`
141
+ - Default Theme
142
+ - Infinity Theme `tinyInfinityTheme`
143
+ - Aurora Theme `tinyAuroraTheme`
144
+ - XDesign Theme `tinySmbTheme`
146
145
 
147
- #### Using predefined themes through alias [Currently only supported: Eurora theme and XDesign theme]
146
+ #### Using Predefined Themes Through Alias [Currently supporting: Aurora theme and XDesign theme]
148
147
 
149
- vue.config.js define
148
+ **vue.config.js configuration:**
150
149
 
151
150
  ```js
152
151
  chainWebpack: (config) => {
153
152
  // XDesign Theme
154
153
  config.resolve.alias.set('@opentiny/vue-theme', '@opentiny/vue-theme/smb-theme')
155
- // Aurora Theme : The aurora theme is to replace all the 'smb' characters in the above SMB themes with 'aurora'
154
+ // Aurora Theme: Replace all 'smb' characters in the above SMB theme with 'aurora'
156
155
  }
157
156
  ```
158
157
 
159
- vite.config.js define
158
+ **vite.config.js configuration:**
160
159
 
161
160
  ```js
162
161
  resolve: {
@@ -170,33 +169,34 @@ resolve: {
170
169
  }
171
170
  ```
172
171
 
173
- #### The specific usage of theme initialization and dynamic theme switching is shown below, and the following code is added to the main.ts file
172
+ #### Theme Initialization and Dynamic Switching Implementation
173
+
174
+ Add the following code to your main.ts file:
174
175
 
175
176
  ```js
176
- import TinyThemeTool from ' @opentiny/vue-theme/theme-tool.js'
177
+ import TinyThemeTool from '@opentiny/vue-theme/theme-tool'
177
178
 
178
- // Infinite theme
179
+ // Import Infinity theme
179
180
  import { tinyInfinityTheme } from '@opentiny/vue-theme/theme'
180
181
 
181
- // Initialize the infinite theme.
182
+ // Initialize the infinity theme
182
183
  const theme = new TinyThemeTool(tinyInfinityTheme, 'tinyStyleSheetId')
183
184
 
184
- // Customize the theme data format.
185
+ // Custom theme data format
185
186
  const tinyTestTheme = {
186
- id: 'tiny-test-theme', // Unique ID of a topic. Each topic must be unique.
187
- name: 'testTheme', // English name of the theme
188
- cnName: 'Test Topic', // Chinese name of the topic
189
- data: { 'ti-base-color': '#f2f2f3' } // Subject data
187
+ id: 'tiny-test-theme', // Unique theme identifier - each theme must have a unique ID
188
+ name: 'testTheme', // English theme name
189
+ cnName: 'Test Theme', // Chinese theme name
190
+ data: { 'ti-base-color': '#f2f2f3' } // Theme data
190
191
  }
191
192
 
192
193
  // Dynamic theme switching
193
-
194
194
  theme.changeTheme(tinyTestTheme)
195
195
  ```
196
196
 
197
- ### Advanced Usage of Theme Customization
197
+ ### Advanced Theme Customization Techniques
198
198
 
199
- Add a custom `css` variable under the global scope.
199
+ Define custom CSS variables at the global scope:
200
200
 
201
201
  ```css
202
202
  :root {
@@ -204,7 +204,7 @@ Add a custom `css` variable under the global scope.
204
204
  }
205
205
  ```
206
206
 
207
- For performance reasons, it is more recommended that you add custom `css` variables under the class name rather than under the global :root.
207
+ For better performance, it's recommended to define custom CSS variables under specific class names rather than at the global :root level:
208
208
 
209
209
  ```css
210
210
  .tiny-test-class {
@@ -212,83 +212,86 @@ For performance reasons, it is more recommended that you add custom `css` variab
212
212
  }
213
213
  ```
214
214
 
215
- If you only want to customize a specific component, simply add inline styles for certain components separately.
215
+ To customize a specific component, you can apply inline styles directly:
216
216
 
217
- ```js
217
+ ```html
218
218
  <tiny-button style="--ti-base-color-white: #fefefe">Button</tiny-button>
219
219
  ```
220
220
 
221
- If you want to control the `css` variable through `js`, you can do this:
221
+ To control CSS variables through JavaScript:
222
222
 
223
223
  ```js
224
224
  const el = document.documentElement
225
225
 
226
- // Obtain the CSS variable.
226
+ // Retrieve CSS variable value
227
227
  getComputedStyle(el).getPropertyValue('--ti-base-color-white')
228
228
 
229
- // Set the CSS variable.
229
+ // Set CSS variable value
230
230
  el.style.setProperty('--ti-base-color-white', '#fefefe')
231
231
  ```
232
232
 
233
- ### Theme variables are standardized and replaced with old and new variable names
234
-
235
- Background: Because the `tiny-vue` needs to connect to the theme-based configuration system, the `tiny-vue` component library is later than the `3.5. 0` version, and the name of the customized variable is changed.
233
+ ### Standardizing Theme Variables: Old vs New Variable Names
236
234
 
237
- For example, `--ti-base-color-selected-font-color` has been changed to `--ti-base-color-selected-text-color` . `--ti-alert-radius` has been changed to `--ti-alert-border-radius`.
235
+ **Background**: As `tiny-vue` integrates with theme-based configuration systems, component library versions later than `3.5.0` have undergone variable name changes to standardize the naming convention.
238
236
 
239
- If the old `css` variable is used to adjust the style in a project, the upgrade to the new version `tiny-vue` may not take effect. Therefore, the following method of replacing variable names in batches is provided to solve the problem of replacing old and new variables. The procedure is as follows:
237
+ For example:
240
238
 
241
- Replace all the old variable names in the `src` directory in the project as an example: Replace the old and new variable names.
239
+ - `--ti-base-color-selected-font-color` has been renamed to `--ti-base-color-selected-text-color`
240
+ - `--ti-alert-radius` has been renamed to `--ti-alert-border-radius`
242
241
 
243
- Step 1: Click to download the mapping table `newVars.json` and the replacement script `replaceVar.js`.
242
+ When upgrading projects that use old CSS variables for styling, the new `tiny-vue` version may not recognize these variables. To address this, we provide a batch variable name replacement method. The process is as follows:
244
243
 
245
- <script setup>
246
- import { pubUrl } from '@/tools'
247
- </script>
244
+ **Step 1**: Download the mapping table `newVars.json` and replacement script `replaceVar.js`.
248
245
 
249
- <a :href="pubUrl('@demos/resource/newVars.json')" target="_blank" download="newVars.json">newVars.json files</a> and <a :href="pubUrl('@demos/resource/replaceVar.js')" target="_blank" download="replaceVar.js">replaceVar.js files</a>
246
+ [Download newVars.json](newVars.json) and [Download replaceVar.js](replaceVar.js)
250
247
 
251
- Step 2: Place `newVars.json` and `replaceVar.js` in the root directory of the project, which is at the same level as the src directory.
248
+ **Step 2**: Place both `newVars.json` and `replaceVar.js` in your project's root directory (at the same level as the src directory).
252
249
 
253
- <img :src="pubUrl('@demos/resource/theme-demo.png')" class="image" style="box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.14); width: 30vw" ><br><br>
250
+ **Step 3**: Execute the following command in your project's root directory:
254
251
 
255
- Step 3: Run the following command in the root directory of the project:
252
+ ```bash
253
+ node replaceVar.js
254
+ ```
256
255
 
257
- `node replaceVar.js`
256
+ **Handling Special Cases**: Manual replacement may be required for certain variables.
258
257
 
259
- Special cases: If manual replacement is required, how to check which variables need to be manually replaced?
258
+ **Manual Replacement Background**: In the `newVars.json` mapping table, each `key` represents an old variable name and its corresponding `value` represents the new variable name. Some old variables like `--ti-button-padding` are classified as "special variables" because they are split into two or more new variables, making their `value` an array. In such cases, the script cannot perform automatic replacement, requiring manual intervention.
260
259
 
261
- Background of manual replacement: In the mapping table `newVars.json`, `key` is the old variable and `value` is the new variable. If an old variable similar to `--ti-button-padding` is used, it is called `special variable`. Because the variable is split into two or more new variables, the corresponding `value` is an array. In this case, the script cannot automatically replace the variable. You need to manually replace the variable. How to replace the variable?
260
+ **Manual Replacement Process**:
262
261
 
263
- Step 1 Uncomment line 20 in the replaceVar.js file and repeat step 3. You can know where variables need to be manually replaced (the special variable table is attached at the end).
262
+ 1. Uncomment line 20 in the replaceVar.js file and re-run step 3. This will identify which variables require manual replacement (refer to the special variables table at the end of this document).
264
263
 
265
264
  ```js
266
- // console.log ('The file path to be manually replaced is',statPath,'The variable to be manually replaced is',key)
265
+ console.log('Files requiring manual replacement:', statPath, 'Variables to replace:', key)
267
266
  ```
268
267
 
269
- Step 2: Find and modify the variables based on the printed file path and variables. The following are examples to cover all cases that need to be manually replaced:
268
+ 2. Based on the output file paths and variables, locate and modify the variables accordingly. The following examples cover all scenarios requiring manual replacement:
270
269
 
271
- `General case`:
270
+ **General Cases**:
272
271
 
273
- Example 1: The special variable table shows that the old variable similar to `--ti-button-padding` is split into `2` new variables, `--ti-button-padding-vertical`and`--ti-button-padding-horizontal`, literally. Padding for `vertical` and `horizontal`, respectively
272
+ **Example 1**: The special variables table shows that the old variable `--ti-button-padding` is split into 2 new variables: `--ti-button-padding-vertical` and `--ti-button-padding-horizontal`, representing vertical and horizontal padding respectively.
274
273
 
275
- If the original project style is `padding: var(--ti-button-padding);`, manually replace it with `padding: var(--ti-button-padding-vertical) var(--ti-button-padding-horizontal);`.
274
+ Original style: `padding: var(--ti-button-padding);`
275
+ Manual replacement: `padding: var(--ti-button-padding-vertical) var(--ti-button-padding-horizontal);`
276
276
 
277
- Example 2: The old variable similar to `--ti-pager-primary-color` is split into `3`new variables, `--ti-pager-primary-bg-color`, `--ti-pager-primary-text-color`, and `--ti-pager-primary-border-color`. Literally `Background Color`, `Text Color`, and `Border Color`
277
+ **Example 2**: The old variable `--ti-pager-primary-color` is split into 3 new variables: `--ti-pager-primary-bg-color`, `--ti-pager-primary-text-color`, and `--ti-pager-primary-border-color`, representing background color, text color, and border color respectively.
278
278
 
279
- If the original format is `--ti-pager-primary-color:red;`, manually replace it with `--ti-pager-primary-bg-color: red; --ti-pager-primary-text-color: red; --ti-pager-primary-border-color: red;`.
279
+ Original format: `--ti-pager-primary-color: red;`
280
+ Manual replacement: `--ti-pager-primary-bg-color: red; --ti-pager-primary-text-color: red; --ti-pager-primary-border-color: red;`
280
281
 
281
- `Special circumstances`:
282
+ **Special Circumstances**:
282
283
 
283
- Example 3: Query the special variable table. It is similar to a variable that contains the `border` field. If the new variable to be split contains `border-weight (border thickness), border-style (border style), and border-color (border color)`, For example, `--tv-Tabs-item-active-border`is split into`--tv-Tabs-item-active-border-weight,--tv-Tabs-item-active-border-style, --tv-Tabs-item-active-border-color`;
284
+ **Example 3**: Variables containing the `border` field require special handling. When split, they contain `border-weight` (border thickness), `border-style` (border style), and `border-color` (border color). For instance, `--tv-Tabs-item-active-border` splits into `--tv-Tabs-item-active-border-weight`, `--tv-Tabs-item-active-border-style`, and `--tv-Tabs-item-active-border-color`.
284
285
 
285
- If the original style is `--tv-Tabs-item-active-border: 1px solid red;`, manually replace it with `--tv-Tabs-item-active-border-weight: 1px; --tv-Tabs-item-active-border-style: solid; --tv-Tabs-item-active-border-color: red;`.
286
+ Original style: `--tv-Tabs-item-active-border: 1px solid red;`
287
+ Manual replacement: `--tv-Tabs-item-active-border-weight: 1px; --tv-Tabs-item-active-border-style: solid; --tv-Tabs-item-active-border-color: red;`
286
288
 
287
- Example 4: If the variable split from `--ti-radio-button-checked-hover-color` contains the `box-shadow` field, you need to write the `box-shadow` style separately.
289
+ **Example 4**: When a variable split from `--ti-radio-button-checked-hover-color` contains the `box-shadow` field, the `box-shadow` style must be written separately.
288
290
 
289
- If the original format is `--ti-radio-button-checked-hover-color: red`, manually replace it with `--ti-radio-button-checked-hover-bg-color: red; --ti-radio-button-checked-hover-border-color: red; --ti-radio-button-checked-hover-box-shadow: -1px 0 0 0 red` . (The value of box-shadow is the same as that of normal writing and can be customized.)
291
+ Original format: `--ti-radio-button-checked-hover-color: red`
292
+ Manual replacement: `--ti-radio-button-checked-hover-bg-color: red; --ti-radio-button-checked-hover-border-color: red; --ti-radio-button-checked-hover-box-shadow: -1px 0 0 0 red;` (The box-shadow value follows standard CSS syntax and can be customized.)
290
293
 
291
- The mapping table of special variables is attached. There are 48 special variables in the newVars.json file, as shown in the following figure.
294
+ The complete mapping table of special variables is provided below. The newVars.json file contains 48 special variables as shown in the following structure.
292
295
 
293
296
  ```json
294
297
  {