@toife/vue 2.2.0 → 3.0.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 (324) hide show
  1. package/README.md +171 -0
  2. package/package.json +41 -9
  3. package/src/components/action/action.composable.ts +32 -0
  4. package/src/components/action/action.html +25 -0
  5. package/src/components/action/action.scss +106 -0
  6. package/src/components/action/action.type.ts +35 -0
  7. package/src/components/action/action.vue +82 -0
  8. package/src/components/action/index.ts +9 -0
  9. package/src/components/app/app.constants.ts +1 -0
  10. package/src/components/app/app.html +24 -0
  11. package/src/components/app/app.scss +27 -0
  12. package/src/components/app/app.type.ts +21 -0
  13. package/src/components/app/app.vue +45 -0
  14. package/src/components/app/index.ts +3 -0
  15. package/src/components/avatar/avatar.html +3 -0
  16. package/src/components/avatar/avatar.scss +35 -0
  17. package/src/components/avatar/avatar.type.ts +6 -0
  18. package/src/components/avatar/avatar.vue +45 -0
  19. package/src/components/avatar/index.ts +2 -0
  20. package/src/components/button/button.html +6 -0
  21. package/src/components/button/button.scss +113 -0
  22. package/src/components/button/button.type.ts +14 -0
  23. package/src/components/button/button.vue +66 -0
  24. package/src/components/button/index.ts +2 -0
  25. package/src/components/cable/cable.constants.ts +1 -0
  26. package/src/components/cable/cable.html +3 -0
  27. package/src/components/cable/cable.scss +37 -0
  28. package/src/components/cable/cable.type.ts +11 -0
  29. package/src/components/cable/cable.vue +33 -0
  30. package/src/components/cable/index.ts +3 -0
  31. package/src/components/card/card/card.constants.ts +1 -0
  32. package/src/components/card/card/card.html +3 -0
  33. package/src/components/card/card/card.scss +34 -0
  34. package/src/components/card/card/card.type.ts +14 -0
  35. package/src/components/card/card/card.vue +62 -0
  36. package/src/components/card/card/index.ts +3 -0
  37. package/src/components/card/card-body/card-body.html +3 -0
  38. package/src/components/card/card-body/card-body.scss +23 -0
  39. package/src/components/card/card-body/card-body.vue +14 -0
  40. package/src/components/card/card-body/index.ts +1 -0
  41. package/src/components/card/card-footer/card-footer.html +3 -0
  42. package/src/components/card/card-footer/card-footer.scss +31 -0
  43. package/src/components/card/card-footer/card-footer.vue +28 -0
  44. package/src/components/card/card-footer/index.ts +1 -0
  45. package/src/components/card/card-header/card-header.html +3 -0
  46. package/src/components/card/card-header/card-header.scss +31 -0
  47. package/src/components/card/card-header/card-header.vue +28 -0
  48. package/src/components/card/card-header/index.ts +1 -0
  49. package/src/components/card/index.ts +4 -0
  50. package/src/components/checkbox/checkbox.html +13 -0
  51. package/src/components/checkbox/checkbox.scss +138 -0
  52. package/src/components/checkbox/checkbox.type.ts +17 -0
  53. package/src/components/checkbox/checkbox.vue +91 -0
  54. package/src/components/checkbox/index.ts +2 -0
  55. package/src/components/collapse/collapse.html +16 -0
  56. package/src/components/collapse/collapse.scss +59 -0
  57. package/src/components/collapse/collapse.type.ts +11 -0
  58. package/src/components/collapse/collapse.vue +131 -0
  59. package/src/components/collapse/index.ts +2 -0
  60. package/src/components/container/container.html +1 -0
  61. package/src/components/container/container.scss +10 -0
  62. package/src/components/container/container.vue +14 -0
  63. package/src/components/container/index.ts +1 -0
  64. package/src/components/decision-modal/decision-modal.composable.ts +32 -0
  65. package/src/components/decision-modal/decision-modal.html +29 -0
  66. package/src/components/decision-modal/decision-modal.scss +136 -0
  67. package/src/components/decision-modal/decision-modal.type.ts +35 -0
  68. package/src/components/decision-modal/decision-modal.vue +98 -0
  69. package/src/components/decision-modal/index.ts +9 -0
  70. package/src/components/divider/divider.html +1 -0
  71. package/src/components/divider/divider.scss +29 -0
  72. package/src/components/divider/divider.type.ts +6 -0
  73. package/src/components/divider/divider.vue +34 -0
  74. package/src/components/divider/index.ts +2 -0
  75. package/src/components/field/field.html +1 -0
  76. package/src/components/field/field.type.ts +43 -0
  77. package/src/components/field/field.vue +85 -0
  78. package/src/components/field/index.ts +2 -0
  79. package/src/components/field/outline/index.ts +1 -0
  80. package/src/components/field/outline/outline.html +32 -0
  81. package/src/components/field/outline/outline.scss +224 -0
  82. package/src/components/field/outline/outline.vue +243 -0
  83. package/src/components/form-group/form-group.html +3 -0
  84. package/src/components/form-group/form-group.scss +91 -0
  85. package/src/components/form-group/form-group.type.ts +5 -0
  86. package/src/components/form-group/form-group.vue +21 -0
  87. package/src/components/form-group/index.ts +2 -0
  88. package/src/components/gesture-indicator/gesture-indicator.html +1 -0
  89. package/src/components/gesture-indicator/gesture-indicator.scss +45 -0
  90. package/{dist/components/gesture-indicator/gesture-indicator.type.d.ts → src/components/gesture-indicator/gesture-indicator.type.ts} +2 -1
  91. package/src/components/gesture-indicator/gesture-indicator.vue +32 -0
  92. package/src/components/gesture-indicator/index.ts +1 -0
  93. package/src/components/image/image.html +1 -0
  94. package/src/components/image/image.scss +1 -0
  95. package/src/components/image/image.type.ts +5 -0
  96. package/src/components/image/image.vue +25 -0
  97. package/src/components/image/index.ts +2 -0
  98. package/src/components/index.ts +27 -0
  99. package/src/components/modal/index.ts +2 -0
  100. package/src/components/modal/modal.html +20 -0
  101. package/src/components/modal/modal.scss +78 -0
  102. package/src/components/modal/modal.type.ts +21 -0
  103. package/src/components/modal/modal.vue +186 -0
  104. package/src/components/page/index.ts +1 -0
  105. package/src/components/page/page.html +3 -0
  106. package/src/components/page/page.scss +17 -0
  107. package/src/components/page/page.vue +14 -0
  108. package/src/components/present/index.ts +3 -0
  109. package/src/components/present/present.composable.ts +21 -0
  110. package/src/components/present/present.html +9 -0
  111. package/src/components/present/present.scss +81 -0
  112. package/src/components/present/present.type.ts +26 -0
  113. package/src/components/present/present.vue +198 -0
  114. package/src/components/radio/index.ts +2 -0
  115. package/src/components/radio/radio/index.ts +2 -0
  116. package/src/components/radio/radio/radio.html +11 -0
  117. package/src/components/radio/radio/radio.scss +125 -0
  118. package/src/components/radio/radio/radio.type.ts +11 -0
  119. package/src/components/radio/radio/radio.vue +103 -0
  120. package/src/components/radio/radio-group/index.ts +7 -0
  121. package/src/components/radio/radio-group/radio-group.constants.ts +1 -0
  122. package/src/components/radio/radio-group/radio-group.html +3 -0
  123. package/src/components/radio/radio-group/radio-group.scss +16 -0
  124. package/src/components/radio/radio-group/radio-group.type.ts +28 -0
  125. package/src/components/radio/radio-group/radio-group.vue +62 -0
  126. package/src/components/refresher/index.ts +2 -0
  127. package/src/components/refresher/refresher.html +6 -0
  128. package/src/components/refresher/refresher.scss +36 -0
  129. package/src/components/refresher/refresher.type.ts +16 -0
  130. package/src/components/refresher/refresher.vue +137 -0
  131. package/src/components/route/index.ts +5 -0
  132. package/src/components/route/route-navigator/index.ts +2 -0
  133. package/src/components/route/route-navigator/route-navigator.html +19 -0
  134. package/src/components/route/route-navigator/route-navigator.scss +127 -0
  135. package/src/components/route/route-navigator/route-navigator.type.ts +12 -0
  136. package/src/components/route/route-navigator/route-navigator.vue +250 -0
  137. package/src/components/route/route-outlet/index.ts +1 -0
  138. package/src/components/route/route-outlet/route-outlet.html +1 -0
  139. package/src/components/route/route-outlet/route-outlet.vue +30 -0
  140. package/src/components/route/route-provider/index.ts +3 -0
  141. package/src/components/route/route-provider/route-provider.constant.ts +1 -0
  142. package/src/components/route/route-provider/route-provider.html +1 -0
  143. package/src/components/route/route-provider/route-provider.type.ts +10 -0
  144. package/src/components/route/route-provider/route-provider.vue +20 -0
  145. package/src/components/route/route-wrapper/index.ts +3 -0
  146. package/src/components/route/route-wrapper/route-wrapper.composable.ts +43 -0
  147. package/src/components/route/route-wrapper/route-wrapper.html +3 -0
  148. package/src/components/route/route-wrapper/route-wrapper.type.ts +3 -0
  149. package/src/components/route/route-wrapper/route-wrapper.vue +43 -0
  150. package/src/components/route/route.type.ts +7 -0
  151. package/src/components/route/route.util.ts +8 -0
  152. package/src/components/segmented-field/index.ts +7 -0
  153. package/src/components/segmented-field/segmented-field.html +17 -0
  154. package/src/components/segmented-field/segmented-field.scss +52 -0
  155. package/src/components/segmented-field/segmented-field.type.ts +29 -0
  156. package/src/components/segmented-field/segmented-field.vue +151 -0
  157. package/src/components/skeleton/index.ts +2 -0
  158. package/src/components/skeleton/skeleton.html +1 -0
  159. package/src/components/skeleton/skeleton.scss +45 -0
  160. package/src/components/skeleton/skeleton.type.ts +7 -0
  161. package/src/components/skeleton/skeleton.vue +38 -0
  162. package/src/components/switch/index.ts +2 -0
  163. package/src/components/switch/switch.html +15 -0
  164. package/src/components/switch/switch.scss +134 -0
  165. package/src/components/switch/switch.type.ts +13 -0
  166. package/src/components/switch/switch.vue +92 -0
  167. package/src/components/tabs/index.ts +2 -0
  168. package/src/components/tabs/tab/index.ts +2 -0
  169. package/src/components/tabs/tab/tab.html +5 -0
  170. package/src/components/tabs/tab/tab.type.ts +5 -0
  171. package/src/components/tabs/tab/tab.vue +38 -0
  172. package/src/components/tabs/tabs/index.ts +9 -0
  173. package/src/components/tabs/tabs/tabs.constants.ts +1 -0
  174. package/src/components/tabs/tabs/tabs.html +3 -0
  175. package/src/components/tabs/tabs/tabs.scss +272 -0
  176. package/src/components/tabs/tabs/tabs.type.ts +36 -0
  177. package/src/components/tabs/tabs/tabs.vue +159 -0
  178. package/src/components/toast/index.ts +4 -0
  179. package/src/components/toast/toast/index.ts +1 -0
  180. package/src/components/toast/toast/toast.html +9 -0
  181. package/src/components/toast/toast/toast.scss +61 -0
  182. package/src/components/toast/toast/toast.vue +34 -0
  183. package/src/components/toast/toast-content/index.ts +1 -0
  184. package/src/components/toast/toast-content/toast-content.html +1 -0
  185. package/src/components/toast/toast-content/toast-content.scss +41 -0
  186. package/src/components/toast/toast-content/toast-content.vue +59 -0
  187. package/src/components/toast/toast.composable.ts +22 -0
  188. package/src/components/toast/toast.type.ts +25 -0
  189. package/src/components/toolbar/index.ts +2 -0
  190. package/src/components/toolbar/toolbar.html +5 -0
  191. package/src/components/toolbar/toolbar.scss +79 -0
  192. package/src/components/toolbar/toolbar.type.ts +7 -0
  193. package/src/components/toolbar/toolbar.vue +47 -0
  194. package/src/env.d.ts +7 -0
  195. package/src/factory.ts +81 -0
  196. package/src/index.ts +4 -0
  197. package/{dist/type.d.ts → src/type.ts} +1 -1
  198. package/src/utils/element.ts +16 -0
  199. package/src/utils/events.ts +12 -0
  200. package/src/utils/index.ts +3 -0
  201. package/src/utils/style/index.ts +42 -0
  202. package/dist/components/action/action.type.d.ts +0 -17
  203. package/dist/components/action/action.vue.d.ts +0 -14
  204. package/dist/components/action/factory.d.ts +0 -3
  205. package/dist/components/action/index.d.ts +0 -2
  206. package/dist/components/alert/alert.type.d.ts +0 -16
  207. package/dist/components/alert/alert.vue.d.ts +0 -14
  208. package/dist/components/alert/factory.d.ts +0 -3
  209. package/dist/components/alert/index.d.ts +0 -2
  210. package/dist/components/app/app.type.d.ts +0 -1
  211. package/dist/components/app/app.vue.d.ts +0 -3
  212. package/dist/components/app/index.d.ts +0 -1
  213. package/dist/components/avatar/avatar.type.d.ts +0 -4
  214. package/dist/components/avatar/avatar.vue.d.ts +0 -6
  215. package/dist/components/avatar/index.d.ts +0 -1
  216. package/dist/components/back-button/back-button.type.d.ts +0 -4
  217. package/dist/components/back-button/back-button.vue.d.ts +0 -3
  218. package/dist/components/back-button/index.d.ts +0 -1
  219. package/dist/components/button/button.type.d.ts +0 -10
  220. package/dist/components/button/button.vue.d.ts +0 -12
  221. package/dist/components/button/index.d.ts +0 -1
  222. package/dist/components/cable/cable.type.d.ts +0 -4
  223. package/dist/components/cable/cable.vue.d.ts +0 -6
  224. package/dist/components/cable/index.d.ts +0 -1
  225. package/dist/components/card/card.type.d.ts +0 -3
  226. package/dist/components/card/card.vue.d.ts +0 -5
  227. package/dist/components/card/index.d.ts +0 -1
  228. package/dist/components/checkbox/checkbox.type.d.ts +0 -12
  229. package/dist/components/checkbox/checkbox.vue.d.ts +0 -14
  230. package/dist/components/checkbox/index.d.ts +0 -1
  231. package/dist/components/collapse/collapse.type.d.ts +0 -6
  232. package/dist/components/collapse/collapse.vue.d.ts +0 -7
  233. package/dist/components/collapse/index.d.ts +0 -1
  234. package/dist/components/content/content.type.d.ts +0 -1
  235. package/dist/components/content/content.vue.d.ts +0 -3
  236. package/dist/components/content/index.d.ts +0 -1
  237. package/dist/components/divider/divider.type.d.ts +0 -3
  238. package/dist/components/divider/divider.vue.d.ts +0 -5
  239. package/dist/components/divider/index.d.ts +0 -1
  240. package/dist/components/flex/flex.type.d.ts +0 -4
  241. package/dist/components/flex/flex.vue.d.ts +0 -6
  242. package/dist/components/flex/index.d.ts +0 -1
  243. package/dist/components/gesture-indicator/gesture-indicator.vue.d.ts +0 -5
  244. package/dist/components/gesture-indicator/index.d.ts +0 -1
  245. package/dist/components/grid/grid.type.d.ts +0 -4
  246. package/dist/components/grid/grid.vue.d.ts +0 -6
  247. package/dist/components/grid/index.d.ts +0 -1
  248. package/dist/components/icon-spinner/icon-spinner.type.d.ts +0 -4
  249. package/dist/components/icon-spinner/icon-spinner.vue.d.ts +0 -6
  250. package/dist/components/icon-spinner/index.d.ts +0 -1
  251. package/dist/components/image/image.type.d.ts +0 -4
  252. package/dist/components/image/image.vue.d.ts +0 -3
  253. package/dist/components/image/index.d.ts +0 -1
  254. package/dist/components/index.d.ts +0 -36
  255. package/dist/components/input/index.d.ts +0 -1
  256. package/dist/components/input/input.type.d.ts +0 -15
  257. package/dist/components/input/input.vue.d.ts +0 -16
  258. package/dist/components/keyboard-space/factory.d.ts +0 -3
  259. package/dist/components/keyboard-space/index.d.ts +0 -2
  260. package/dist/components/keyboard-space/keyboard-space.type.d.ts +0 -1
  261. package/dist/components/keyboard-space/keyboard-space.vue.d.ts +0 -3
  262. package/dist/components/loading/factory.d.ts +0 -4
  263. package/dist/components/loading/index.d.ts +0 -2
  264. package/dist/components/loading/loading.type.d.ts +0 -6
  265. package/dist/components/loading/loading.vue.d.ts +0 -12
  266. package/dist/components/present/factory.d.ts +0 -1
  267. package/dist/components/present/index.d.ts +0 -2
  268. package/dist/components/present/present.type.d.ts +0 -13
  269. package/dist/components/present/present.vue.d.ts +0 -17
  270. package/dist/components/refresher/index.d.ts +0 -1
  271. package/dist/components/refresher/refresher.type.d.ts +0 -11
  272. package/dist/components/refresher/refresher.vue.d.ts +0 -17
  273. package/dist/components/richtext/index.d.ts +0 -1
  274. package/dist/components/richtext/richtext.type.d.ts +0 -1
  275. package/dist/components/richtext/richtext.vue.d.ts +0 -3
  276. package/dist/components/ripple/index.d.ts +0 -1
  277. package/dist/components/ripple/ripple.type.d.ts +0 -3
  278. package/dist/components/ripple/ripple.vue.d.ts +0 -5
  279. package/dist/components/screen/index.d.ts +0 -1
  280. package/dist/components/screen/screen.type.d.ts +0 -1
  281. package/dist/components/screen/screen.vue.d.ts +0 -3
  282. package/dist/components/screen-router/factory.d.ts +0 -19
  283. package/dist/components/screen-router/index.d.ts +0 -2
  284. package/dist/components/screen-router/screen-router.type.d.ts +0 -8
  285. package/dist/components/screen-router/screen-router.vue.d.ts +0 -9
  286. package/dist/components/sheet/index.d.ts +0 -1
  287. package/dist/components/sheet/sheet.type.d.ts +0 -18
  288. package/dist/components/sheet/sheet.vue.d.ts +0 -18
  289. package/dist/components/skeleton/index.d.ts +0 -1
  290. package/dist/components/skeleton/skeleton.type.d.ts +0 -6
  291. package/dist/components/skeleton/skeleton.vue.d.ts +0 -8
  292. package/dist/components/switch/index.d.ts +0 -1
  293. package/dist/components/switch/switch.type.d.ts +0 -7
  294. package/dist/components/switch/switch.vue.d.ts +0 -9
  295. package/dist/components/tab/index.d.ts +0 -1
  296. package/dist/components/tab/tab.type.d.ts +0 -4
  297. package/dist/components/tab/tab.vue.d.ts +0 -5
  298. package/dist/components/tabs/index.d.ts +0 -1
  299. package/dist/components/tabs/tabs.type.d.ts +0 -13
  300. package/dist/components/tabs/tabs.vue.d.ts +0 -15
  301. package/dist/components/text/index.d.ts +0 -1
  302. package/dist/components/text/text.type.d.ts +0 -4
  303. package/dist/components/text/text.vue.d.ts +0 -6
  304. package/dist/components/textarea/index.d.ts +0 -1
  305. package/dist/components/textarea/textarea.type.d.ts +0 -1
  306. package/dist/components/textarea/textarea.vue.d.ts +0 -3
  307. package/dist/components/toast/factory.d.ts +0 -3
  308. package/dist/components/toast/index.d.ts +0 -2
  309. package/dist/components/toast/toast.type.d.ts +0 -11
  310. package/dist/components/toast/toast.vue.d.ts +0 -16
  311. package/dist/components/toggle-password/index.d.ts +0 -1
  312. package/dist/components/toggle-password/toggle-password.type.d.ts +0 -6
  313. package/dist/components/toggle-password/toggle-password.vue.d.ts +0 -9
  314. package/dist/components/toolbar/index.d.ts +0 -1
  315. package/dist/components/toolbar/toolbar.type.d.ts +0 -5
  316. package/dist/components/toolbar/toolbar.vue.d.ts +0 -7
  317. package/dist/factory.d.ts +0 -4
  318. package/dist/index.css +0 -1
  319. package/dist/index.d.ts +0 -4
  320. package/dist/index.es.js +0 -1836
  321. package/dist/index.umd.js +0 -1
  322. package/dist/utils/element.d.ts +0 -2
  323. package/dist/utils/events.d.ts +0 -1
  324. package/dist/utils/index.d.ts +0 -2
package/README.md ADDED
@@ -0,0 +1,171 @@
1
+ # @toife/vue
2
+
3
+ Vue 3 component library for Toife. The package ships **source** (`src/`): your app bundles it and compiles Sass with your own configuration.
4
+
5
+ ## Requirements
6
+
7
+ | Package | Notes |
8
+ |---------|--------|
9
+ | `vue` ^3.5 | Required |
10
+ | `vue-router` ^4 | Required when using route-related components |
11
+ | `@toife/gesture` | Gestures |
12
+ | `@toife/sass-layer-generator` | Component SCSS uses `@use`; install in the app and configure Sass (e.g. Vite `css.preprocessorOptions`) |
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ npm install @toife/vue
18
+ # or
19
+ yarn add @toife/vue
20
+ ```
21
+
22
+ Install any missing peer dependencies if npm/yarn reports them.
23
+
24
+ ## Global registration (plugin)
25
+
26
+ `createToife()` registers most components as **kebab-case** tags with the default prefix `t-`.
27
+
28
+ ```ts
29
+ // main.ts
30
+ import { createApp } from "vue";
31
+ import { createToife } from "@toife/vue";
32
+ import App from "./App.vue";
33
+
34
+ const app = createApp(App);
35
+ app.use(createToife());
36
+ // or change the prefix:
37
+ // app.use(createToife({ prefix: "toife-" })); // → <toife-app>, <toife-button>, ...
38
+ app.mount("#app");
39
+ ```
40
+
41
+ ```vue
42
+ <!-- Example: default prefix "t-" -->
43
+ <template>
44
+ <t-app>
45
+ <t-page>
46
+ <t-toolbar />
47
+ <t-container>
48
+ <t-button>OK</t-button>
49
+ </t-container>
50
+ </t-page>
51
+ </t-app>
52
+ </template>
53
+ ```
54
+
55
+ ### `createToife` options
56
+
57
+ | Property | Type | Default | Description |
58
+ |----------|------|---------|-------------|
59
+ | `prefix` | `string` | `"t-"` | Tag name prefix (e.g. `my-` → `<my-button>`) |
60
+
61
+ ## Tags after `app.use(createToife())`
62
+
63
+ The default prefix is `t-`. The **Tag** column is `prefix` + name (e.g. `t-button`).
64
+
65
+ | Tag (prefix `t-`) | Component |
66
+ |-------------------|-----------|
67
+ | `t-app` | App |
68
+ | `t-action` | Action |
69
+ | `t-avatar` | Avatar |
70
+ | `t-button` | Button |
71
+ | `t-cable` | Cable |
72
+ | `t-card` | Card |
73
+ | `t-card-body` | CardBody |
74
+ | `t-card-header` | CardHeader |
75
+ | `t-card-footer` | CardFooter |
76
+ | `t-checkbox` | Checkbox |
77
+ | `t-radio` | Radio |
78
+ | `t-radio-group` | RadioGroup |
79
+ | `t-collapse` | Collapse |
80
+ | `t-container` | Container |
81
+ | `t-decision-modal` | DecisionModal |
82
+ | `t-divider` | Divider |
83
+ | `t-field` | Field |
84
+ | `t-form-group` | FormGroup |
85
+ | `t-gesture-indicator` | GestureIndicator |
86
+ | `t-image` | Image |
87
+ | `t-modal` | Modal |
88
+ | `t-page` | Page |
89
+ | `t-present` | Present |
90
+ | `t-refresher` | Refresher |
91
+ | `t-route-navigator` | RouteNavigator |
92
+ | `t-route-wrapper` | RouteWrapper |
93
+ | `t-route-provider` | RouteProvider |
94
+ | `t-route-outlet` | RouteOutlet |
95
+ | `t-segmented-field` | SegmentedField |
96
+ | `t-skeleton` | Skeleton |
97
+ | `t-switch` | Switch |
98
+ | `t-tabs` | Tabs |
99
+ | `t-toast` | Toast |
100
+ | `t-toast-content` | ToastContent |
101
+ | `t-toolbar` | Toolbar |
102
+
103
+ ### Components not registered by the plugin
104
+
105
+ These are **still exported** from `@toife/vue` but are **not** included in `createToife().install` — import them directly and call `app.component(...)` yourself if you need globals:
106
+
107
+ - `Tab` — used inside `Tabs`; `import { Tab, Tabs } from "@toife/vue"`.
108
+ - `OutlineField` — `import { OutlineField } from "@toife/vue"`.
109
+
110
+ ```ts
111
+ import { Tab, OutlineField } from "@toife/vue";
112
+
113
+ app.component("t-tab", Tab);
114
+ app.component("t-outline-field", OutlineField);
115
+ ```
116
+
117
+ Or use them only in SFCs: `import { Tab } from "@toife/vue"` and register locally / use in a parent template.
118
+
119
+ ## Named imports (without the plugin)
120
+
121
+ You can always import components and register them manually or use them locally:
122
+
123
+ ```vue
124
+ <script setup lang="ts">
125
+ import { Button, App, RouteNavigator, RouteWrapper } from "@toife/vue";
126
+ </script>
127
+
128
+ <template>
129
+ <App>
130
+ <RouteWrapper>
131
+ <RouteNavigator variant="swipe" />
132
+ </RouteWrapper>
133
+ </App>
134
+ </template>
135
+ ```
136
+
137
+ Public exports are defined in `src/index.ts` (factory, re-exported `./components`, and `utils`).
138
+
139
+ ## Vue Router
140
+
141
+ `RouteNavigator`, `RouteWrapper`, `RouteProvider`, and `RouteOutlet` expect `vue-router` to be installed and configured in your app.
142
+
143
+ ## TypeScript
144
+
145
+ The package includes `*.vue` declarations via the entry; if your IDE still complains about `.vue` modules, add this to your project (Vite):
146
+
147
+ ```ts
148
+ // env.d.ts
149
+ declare module "*.vue" {
150
+ import type { DefineComponent } from "vue";
151
+ const component: DefineComponent<{}, {}, any>;
152
+ export default component;
153
+ }
154
+ ```
155
+
156
+ ## Utilities
157
+
158
+ ```ts
159
+ import { utils } from "@toife/vue";
160
+ // utils.* — see exports under src/utils
161
+ ```
162
+
163
+ See `src/utils` in the repo for concrete APIs.
164
+
165
+ ## Sass / theming
166
+
167
+ Component styles use `@use "@toife/sass-layer-generator"` and SCSS under `src`. Configure **sass-embedded** / **sass** and any aliases in **your** app so tokens, layers, and variables resolve when you build.
168
+
169
+ ## License
170
+
171
+ MIT
package/package.json CHANGED
@@ -1,13 +1,18 @@
1
1
  {
2
2
  "name": "@toife/vue",
3
- "version": "2.2.0",
3
+ "version": "3.0.0",
4
4
  "description": "A Frontend framework for Vue",
5
5
  "type": "module",
6
- "main": "dist/index.umd.js",
7
- "module": "dist/index.es.js",
8
- "types": "dist/index.d.ts",
6
+ "sideEffects": false,
7
+ "exports": {
8
+ ".": {
9
+ "types": "./src/index.ts",
10
+ "import": "./src/index.ts",
11
+ "default": "./src/index.ts"
12
+ }
13
+ },
9
14
  "files": [
10
- "dist"
15
+ "src"
11
16
  ],
12
17
  "keywords": [
13
18
  "vue",
@@ -17,19 +22,46 @@
17
22
  ],
18
23
  "author": "Toikit",
19
24
  "license": "MIT",
25
+ "publishConfig": {
26
+ "access": "public",
27
+ "registry": "https://registry.npmjs.org/"
28
+ },
20
29
  "peerDependencies": {
21
30
  "@toife/gesture": "^1.1.4",
22
- "vue": "^3.5.19",
23
- "vue-router": "^4.5.1"
31
+ "@toife/sass-layer-generator": "^1.0.9",
32
+ "vue": "^3.5.0",
33
+ "vue-router": "^4.0.0"
24
34
  },
25
35
  "scripts": {
26
- "build": "vite build"
36
+ "dev": "vite",
37
+ "typecheck": "tsc --noEmit",
38
+ "build": "vite build",
39
+ "format": "prettier . --write",
40
+ "prepare": "husky",
41
+ "test:dev": "vite --config test/vite.config.ts",
42
+ "test:build": "vite build --config test/vite.config.ts"
43
+ },
44
+ "lint-staged": {
45
+ "*.{js,ts,vue,json,css,scss,sass,md,html}": "prettier --write"
27
46
  },
28
47
  "devDependencies": {
48
+ "@commitlint/cli": "^20.4.4",
49
+ "@commitlint/config-conventional": "^20.4.4",
50
+ "@toife/sass-layer-generator": "^1.0.9",
51
+ "@types/node": "^25.0.3",
29
52
  "@vitejs/plugin-vue": "^6.0.1",
53
+ "husky": "^9.1.7",
54
+ "lint-staged": "^16.4.0",
55
+ "prettier": "3.7.4",
30
56
  "sass": "^1.90.0",
31
57
  "typescript": "^5.9.2",
32
58
  "vite": "^7.0.6",
33
- "vite-plugin-dts": "^4.5.4"
59
+ "vite-plugin-dts": "^4.5.4",
60
+ "vue": "^3.5.0",
61
+ "vue-router": "^4.0.0"
62
+ },
63
+ "packageManager": "yarn@4.12.0",
64
+ "dependencies": {
65
+ "@toife/gesture": "^1.1.4"
34
66
  }
35
67
  }
@@ -0,0 +1,32 @@
1
+ import { ref } from "vue";
2
+ import type { ActionButton, ActionComposableProps } from "./action.type";
3
+
4
+ const data = ref<ActionComposableProps | null>(null);
5
+ const visible = ref(false);
6
+
7
+ export const useAction = () => {
8
+ const open = (props: ActionComposableProps) => {
9
+ data.value = props;
10
+ setTimeout(() => {
11
+ visible.value = true;
12
+ }, 50);
13
+ };
14
+
15
+ const close = (type?: string) => {
16
+ data.value?.onClose?.(type);
17
+ visible.value = false;
18
+ };
19
+
20
+ const choose = (btn: ActionButton) => {
21
+ data.value?.onChoose?.(btn);
22
+ visible.value = false;
23
+ };
24
+
25
+ return {
26
+ open,
27
+ close,
28
+ choose,
29
+ visible,
30
+ data,
31
+ };
32
+ };
@@ -0,0 +1,25 @@
1
+ <Present
2
+ :placement="placement"
3
+ backdrop="display"
4
+ :keepalive="false"
5
+ :visible="visible"
6
+ @close="onClose"
7
+ >
8
+ <div v-bind="actionAttrs">
9
+ <slot name="body">
10
+ <FormGroup orientation="vertical" v-for="(buttons, groupIndex) in actions" :key="groupIndex">
11
+ <CustomButton
12
+ v-for="(btn, btnIndex) in buttons"
13
+ :key="`${groupIndex}-${btnIndex}`"
14
+ :role="btn.role"
15
+ :variant="btn.variant"
16
+ @click="onChoose(btn)"
17
+ :shape="shape"
18
+ :shadow="btn.shadow !== undefined ? btn.shadow : shadow"
19
+ block
20
+ >{{ btn.text }}</CustomButton
21
+ >
22
+ </FormGroup>
23
+ </slot>
24
+ </div>
25
+ </Present>
@@ -0,0 +1,106 @@
1
+ @use "@toife/sass-layer-generator" as sass;
2
+
3
+ // Class name
4
+ $action: sass.fn-naming-prefix("action");
5
+ $button: sass.fn-naming-prefix("button");
6
+
7
+ // Property name
8
+ $margin-y: sass.fn-naming-var("spacing", "y");
9
+ $margin-x: sass.fn-naming-var("spacing", "x");
10
+ $width: sass.fn-naming-var("viewport", "width");
11
+ $max-width: sass.fn-naming-var("overlay", "max-width");
12
+ $height: sass.fn-naming-var("viewport", "height");
13
+ $max-height: sass.fn-naming-var("overlay", "max-height");
14
+ $background-color: sass.fn-naming-var("surface", "background-color");
15
+ $transition-duration: sass.fn-naming-var("motion", "duration");
16
+ $safe-area-bottom: sass.fn-naming-var("safe-area", "bottom");
17
+ $safe-area-top: sass.fn-naming-var("safe-area", "top");
18
+ $safe-area-left: sass.fn-naming-var("safe-area", "left");
19
+ $safe-area-right: sass.fn-naming-var("safe-area", "right");
20
+ $border-width: sass.fn-naming-var("stroke", "width");
21
+ $border-color: sass.fn-naming-var("item", "border-color");
22
+
23
+ .#{$action} {
24
+ // Styles
25
+ display: flex;
26
+ flex-direction: column;
27
+ justify-content: center;
28
+ align-items: center;
29
+ column-gap: calc(#{$margin-y} * 2);
30
+ row-gap: calc(#{$margin-x} * 2);
31
+ border-width: #{$border-width};
32
+
33
+ &.top,
34
+ &.bottom {
35
+ width: #{$width};
36
+
37
+ > div {
38
+ width: 100%;
39
+ max-width: #{$max-width};
40
+ }
41
+ }
42
+
43
+ &.bottom {
44
+ margin-bottom: calc(#{$margin-y} * 4 + #{$safe-area-bottom});
45
+ }
46
+
47
+ &.top {
48
+ margin-top: calc(#{$margin-y} * 4 + #{$safe-area-top});
49
+ }
50
+
51
+ &.left,
52
+ &.right {
53
+ > div {
54
+ width: 100%;
55
+ max-width: #{$max-width};
56
+ }
57
+ }
58
+
59
+ &.left {
60
+ margin-left: calc(#{$margin-x} * 4 + #{$safe-area-left});
61
+ }
62
+
63
+ &.right {
64
+ margin-right: calc(#{$margin-x} * 4 + #{$safe-area-right});
65
+ }
66
+
67
+ &.pop {
68
+ animation: pop #{$transition-duration} ease-in-out;
69
+ }
70
+
71
+ &.divider {
72
+ :deep(.#{$button}) {
73
+ border-color: transparent;
74
+ border-bottom-color: rgb(#{$border-color});
75
+ }
76
+ }
77
+
78
+ &:not(.divider) {
79
+ :deep(.#{$button}) {
80
+ border-color: transparent;
81
+ }
82
+ }
83
+ }
84
+
85
+ // Effect when click outside action modal
86
+ @keyframes pop {
87
+ 0% {
88
+ transform: scale(1);
89
+ }
90
+
91
+ 50% {
92
+ transform: scale(1.1);
93
+ }
94
+
95
+ 70% {
96
+ transform: scale(1);
97
+ }
98
+
99
+ 80% {
100
+ transform: scale(1.1);
101
+ }
102
+
103
+ 100% {
104
+ transform: scale(1);
105
+ }
106
+ }
@@ -0,0 +1,35 @@
1
+ import { ButtonVariant } from "../button/button.type";
2
+ import { PresentPlacement } from "../present";
3
+
4
+ export type ActionPlacement = PresentPlacement;
5
+
6
+ // Define
7
+ export type ActionButton = {
8
+ text?: string;
9
+ role?: string;
10
+ variant?: ButtonVariant;
11
+ shadow?: boolean;
12
+ handler?: () => void;
13
+ data?: unknown;
14
+ };
15
+
16
+ export type ActionProps = {
17
+ visible?: boolean;
18
+ dismiss?: string[];
19
+ actions: Array<ActionButton[]>;
20
+ role?: string;
21
+ shape?: string;
22
+ divider?: boolean;
23
+ shadow?: boolean;
24
+ placement?: ActionPlacement;
25
+ };
26
+
27
+ export type ActionComposableProps = ActionProps & {
28
+ onClose?: (type?: string) => void;
29
+ onChoose?: (btn?: ActionButton) => void;
30
+ };
31
+
32
+ export type ActionEmit = {
33
+ (e: "close", type?: string): void;
34
+ (e: "choose", btn: ActionButton): void;
35
+ };
@@ -0,0 +1,82 @@
1
+ <style lang="scss" src="./action.scss" scoped></style>
2
+ <template src="./action.html"></template>
3
+ <script lang="ts" setup>
4
+ import { computed, inject, ref } from "vue";
5
+ import { Present } from "../present";
6
+ import { Button as CustomButton } from "../button";
7
+ import { FormGroup } from "../form-group";
8
+ import { type ActionEmit, type ActionButton, type ActionProps } from "./action.type";
9
+ import { withPrefix } from "../../utils";
10
+ import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../app";
11
+
12
+ /// Define
13
+ /// ------------------------------------------------------------
14
+ const appState = inject<AppProviderState>(APP_PROVIDER_STATE_KEY);
15
+ const emit = defineEmits<ActionEmit>();
16
+ const props = withDefaults(defineProps<ActionProps>(), {
17
+ visible: false,
18
+ shape: undefined,
19
+ role: undefined,
20
+ placement: "bottom",
21
+ divider: undefined,
22
+ shadow: undefined,
23
+ });
24
+
25
+ /// State
26
+ /// ------------------------------------------------------------
27
+ const pop = ref(false);
28
+
29
+ /// Computed
30
+ /// ------------------------------------------------------------
31
+ const divider = computed(() => {
32
+ return (props?.divider !== undefined ? props.divider : appState?.divider.value) ?? false;
33
+ });
34
+
35
+ const shadow = computed(() => {
36
+ return (props?.shadow !== undefined ? props.shadow : appState?.shadow.value) ?? false;
37
+ });
38
+
39
+ const shape = computed(() => {
40
+ return props.shape ?? appState?.shape.value ?? "";
41
+ });
42
+
43
+ const role = computed(() => {
44
+ return props.role ?? appState?.role.value ?? "";
45
+ });
46
+
47
+ const actionAttrs = computed(() => {
48
+ return {
49
+ class: [
50
+ withPrefix("action"),
51
+ withPrefix(["layer", "surface"]),
52
+ withPrefix(["role", role.value]),
53
+ withPrefix(["shape", shape.value]),
54
+ props.placement,
55
+ {
56
+ pop: pop.value,
57
+ divider: divider.value,
58
+ shadow: shadow.value,
59
+ },
60
+ ],
61
+ };
62
+ });
63
+
64
+ /// Methods
65
+ /// ------------------------------------------------------------
66
+ const onClose = (val: string) => {
67
+ if (props.dismiss && props.dismiss.includes(val)) {
68
+ emit("close", val);
69
+ } else if (val === "backdrop") {
70
+ pop.value = true;
71
+ setTimeout(() => {
72
+ pop.value = false;
73
+ }, 300);
74
+ }
75
+ };
76
+
77
+ const onChoose = (btn: ActionButton) => {
78
+ emit("close");
79
+ btn.handler?.();
80
+ emit("choose", btn);
81
+ };
82
+ </script>
@@ -0,0 +1,9 @@
1
+ export { default as Action } from "./action.vue";
2
+ export type {
3
+ ActionProps,
4
+ ActionEmit,
5
+ ActionButton,
6
+ ActionPlacement,
7
+ ActionComposableProps,
8
+ } from "./action.type";
9
+ export { useAction } from "./action.composable";
@@ -0,0 +1 @@
1
+ export const APP_PROVIDER_STATE_KEY = "app-state";
@@ -0,0 +1,24 @@
1
+ <div v-bind="appAttrs">
2
+ <slot />
3
+ <slot name="global"></slot>
4
+ <Toast placement="top-start" />
5
+ <Toast placement="bottom-start" />
6
+ <Toast placement="bottom-center" />
7
+ <Toast placement="bottom-end" />
8
+ <Toast placement="top-center" />
9
+ <Toast placement="top-end" />
10
+ <Action
11
+ v-if="action.data.value"
12
+ :visible="action.visible.value"
13
+ v-bind="action.data.value"
14
+ @close="action.close"
15
+ @choose="action.choose"
16
+ />
17
+ <DecisionModal
18
+ v-if="decisionModal.data.value"
19
+ :visible="decisionModal.visible.value"
20
+ v-bind="decisionModal.data.value"
21
+ @close="decisionModal.close"
22
+ @choose="decisionModal.choose"
23
+ />
24
+ </div>
@@ -0,0 +1,27 @@
1
+ @use "@toife/sass-layer-generator" as sass;
2
+
3
+ // Class name
4
+ $app: sass.fn-naming-prefix("app");
5
+
6
+ // Property name - layer: base
7
+ $background-color: sass.fn-naming-var("base", "background-color");
8
+ $color: sass.fn-naming-var("base", "color");
9
+ $transition-duration: sass.fn-naming-var("motion", "duration");
10
+
11
+ .#{$app} {
12
+ width: #{sass.fn-naming-var("viewport", "width")};
13
+ max-width: #{sass.fn-naming-var("viewport", "max-width")};
14
+ height: #{sass.fn-naming-var("viewport", "height")};
15
+ max-height: #{sass.fn-naming-var("viewport", "max-height")};
16
+ background-color: rgb(#{$background-color});
17
+ color: rgb(#{$color});
18
+ transition:
19
+ background-color #{$transition-duration} ease,
20
+ color #{$transition-duration} ease,
21
+ border-color #{$transition-duration} ease;
22
+ position: absolute;
23
+ top: 0;
24
+ left: 0;
25
+ right: 0;
26
+ bottom: 0;
27
+ }
@@ -0,0 +1,21 @@
1
+ import type { Ref } from "vue";
2
+
3
+ export type AppDirection = "left" | "right";
4
+
5
+ export type AppProps = {
6
+ shape?: string;
7
+ divider?: boolean;
8
+ role?: string;
9
+ shadow?: boolean;
10
+ triple?: boolean;
11
+ direction?: AppDirection;
12
+ };
13
+
14
+ export type AppProviderState = {
15
+ shape: Ref<string>;
16
+ divider: Ref<boolean>;
17
+ role: Ref<string>;
18
+ shadow: Ref<boolean>;
19
+ triple: Ref<boolean>;
20
+ direction: Ref<AppDirection>;
21
+ };
@@ -0,0 +1,45 @@
1
+ <style lang="scss" src="./app.scss" scoped></style>
2
+ <template src="./app.html"></template>
3
+ <script lang="ts" setup>
4
+ import { withPrefix } from "../../utils";
5
+ import { computed, provide, toRefs } from "vue";
6
+ import { Toast } from "../toast";
7
+ import { Action, useAction } from "../action";
8
+ import { DecisionModal, useDecisionModal } from "../decision-modal";
9
+ import { type AppProviderState, type AppProps } from "./app.type";
10
+ import { APP_PROVIDER_STATE_KEY } from "./app.constants";
11
+
12
+ /// Define
13
+ /// ------------------------------------------------------------
14
+ const props = withDefaults(defineProps<AppProps>(), {
15
+ shape: "pill",
16
+ divider: false,
17
+ role: "mode",
18
+ shadow: false,
19
+ triple: false,
20
+ direction: "left",
21
+ });
22
+ const { shape, divider, role, shadow, triple, direction } = toRefs(props);
23
+ const decisionModal = useDecisionModal();
24
+ const action = useAction();
25
+
26
+ /// Computed
27
+ /// ------------------------------------------------------------
28
+ // Present attributes
29
+ const appAttrs = computed(() => {
30
+ return {
31
+ class: [withPrefix(["layer", "base"]), withPrefix(["shape", shape.value]), withPrefix("app")],
32
+ };
33
+ });
34
+
35
+ // Export, Expose
36
+ /// ------------------------------------------------------------
37
+ provide<AppProviderState>(APP_PROVIDER_STATE_KEY, {
38
+ shape,
39
+ divider,
40
+ role,
41
+ shadow,
42
+ triple,
43
+ direction,
44
+ });
45
+ </script>
@@ -0,0 +1,3 @@
1
+ export { default as App } from "./app.vue";
2
+ export * from "./app.type";
3
+ export { APP_PROVIDER_STATE_KEY } from "./app.constants";
@@ -0,0 +1,3 @@
1
+ <div v-bind="avatarAttrs">
2
+ <slot />
3
+ </div>