@toife/vue 2.2.0 → 3.0.1

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 (364) hide show
  1. package/README.md +224 -0
  2. package/package.json +39 -10
  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.md +115 -0
  6. package/src/components/action/action.scss +105 -0
  7. package/src/components/action/action.type.ts +35 -0
  8. package/src/components/action/action.vue +70 -0
  9. package/src/components/action/index.ts +9 -0
  10. package/src/components/app/app.constants.ts +1 -0
  11. package/src/components/app/app.html +24 -0
  12. package/src/components/app/app.md +77 -0
  13. package/src/components/app/app.scss +27 -0
  14. package/src/components/app/app.type.ts +21 -0
  15. package/src/components/app/app.vue +45 -0
  16. package/src/components/app/index.ts +3 -0
  17. package/src/components/avatar/avatar.html +3 -0
  18. package/src/components/avatar/avatar.md +64 -0
  19. package/src/components/avatar/avatar.scss +35 -0
  20. package/src/components/avatar/avatar.type.ts +6 -0
  21. package/src/components/avatar/avatar.vue +45 -0
  22. package/src/components/avatar/index.ts +2 -0
  23. package/src/components/button/button.html +6 -0
  24. package/src/components/button/button.md +66 -0
  25. package/src/components/button/button.scss +113 -0
  26. package/src/components/button/button.type.ts +14 -0
  27. package/src/components/button/button.vue +61 -0
  28. package/src/components/button/index.ts +2 -0
  29. package/src/components/cable/cable.constants.ts +1 -0
  30. package/src/components/cable/cable.html +3 -0
  31. package/src/components/cable/cable.md +57 -0
  32. package/src/components/cable/cable.scss +37 -0
  33. package/src/components/cable/cable.type.ts +11 -0
  34. package/src/components/cable/cable.vue +33 -0
  35. package/src/components/cable/index.ts +3 -0
  36. package/src/components/card/card/card.constants.ts +1 -0
  37. package/src/components/card/card/card.html +3 -0
  38. package/src/components/card/card/card.md +57 -0
  39. package/src/components/card/card/card.scss +34 -0
  40. package/src/components/card/card/card.type.ts +14 -0
  41. package/src/components/card/card/card.vue +62 -0
  42. package/src/components/card/card/index.ts +3 -0
  43. package/src/components/card/card-body/card-body.html +3 -0
  44. package/src/components/card/card-body/card-body.md +34 -0
  45. package/src/components/card/card-body/card-body.scss +23 -0
  46. package/src/components/card/card-body/card-body.vue +9 -0
  47. package/src/components/card/card-body/index.ts +1 -0
  48. package/src/components/card/card-footer/card-footer.html +3 -0
  49. package/src/components/card/card-footer/card-footer.md +42 -0
  50. package/src/components/card/card-footer/card-footer.scss +31 -0
  51. package/src/components/card/card-footer/card-footer.vue +25 -0
  52. package/src/components/card/card-footer/index.ts +1 -0
  53. package/src/components/card/card-header/card-header.html +3 -0
  54. package/src/components/card/card-header/card-header.md +44 -0
  55. package/src/components/card/card-header/card-header.scss +31 -0
  56. package/src/components/card/card-header/card-header.vue +25 -0
  57. package/src/components/card/card-header/index.ts +1 -0
  58. package/src/components/card/index.ts +4 -0
  59. package/src/components/checkbox/checkbox.html +13 -0
  60. package/src/components/checkbox/checkbox.md +60 -0
  61. package/src/components/checkbox/checkbox.scss +138 -0
  62. package/src/components/checkbox/checkbox.type.ts +17 -0
  63. package/src/components/checkbox/checkbox.vue +78 -0
  64. package/src/components/checkbox/index.ts +2 -0
  65. package/src/components/collapse/collapse.html +16 -0
  66. package/src/components/collapse/collapse.md +59 -0
  67. package/src/components/collapse/collapse.scss +59 -0
  68. package/src/components/collapse/collapse.type.ts +11 -0
  69. package/src/components/collapse/collapse.vue +131 -0
  70. package/src/components/collapse/index.ts +2 -0
  71. package/src/components/container/container.html +1 -0
  72. package/src/components/container/container.md +38 -0
  73. package/src/components/container/container.scss +10 -0
  74. package/src/components/container/container.vue +9 -0
  75. package/src/components/container/index.ts +1 -0
  76. package/src/components/decision-modal/decision-modal.composable.ts +32 -0
  77. package/src/components/decision-modal/decision-modal.html +29 -0
  78. package/src/components/decision-modal/decision-modal.md +79 -0
  79. package/src/components/decision-modal/decision-modal.scss +136 -0
  80. package/src/components/decision-modal/decision-modal.type.ts +35 -0
  81. package/src/components/decision-modal/decision-modal.vue +98 -0
  82. package/src/components/decision-modal/index.ts +9 -0
  83. package/src/components/divider/divider.html +1 -0
  84. package/src/components/divider/divider.md +42 -0
  85. package/src/components/divider/divider.scss +29 -0
  86. package/src/components/divider/divider.type.ts +6 -0
  87. package/src/components/divider/divider.vue +31 -0
  88. package/src/components/divider/index.ts +2 -0
  89. package/src/components/field/field.html +1 -0
  90. package/src/components/field/field.md +68 -0
  91. package/src/components/field/field.type.ts +43 -0
  92. package/src/components/field/field.vue +85 -0
  93. package/src/components/field/index.ts +2 -0
  94. package/src/components/field/outline/index.ts +1 -0
  95. package/src/components/field/outline/outline-field.md +44 -0
  96. package/src/components/field/outline/outline.html +32 -0
  97. package/src/components/field/outline/outline.scss +224 -0
  98. package/src/components/field/outline/outline.vue +243 -0
  99. package/src/components/form-group/form-group.html +3 -0
  100. package/src/components/form-group/form-group.md +41 -0
  101. package/src/components/form-group/form-group.scss +91 -0
  102. package/src/components/form-group/form-group.type.ts +5 -0
  103. package/src/components/form-group/form-group.vue +21 -0
  104. package/src/components/form-group/index.ts +2 -0
  105. package/src/components/gesture-indicator/gesture-indicator.html +1 -0
  106. package/src/components/gesture-indicator/gesture-indicator.md +42 -0
  107. package/src/components/gesture-indicator/gesture-indicator.scss +45 -0
  108. package/{dist/components/gesture-indicator/gesture-indicator.type.d.ts → src/components/gesture-indicator/gesture-indicator.type.ts} +2 -1
  109. package/src/components/gesture-indicator/gesture-indicator.vue +29 -0
  110. package/src/components/gesture-indicator/index.ts +1 -0
  111. package/src/components/image/image.html +1 -0
  112. package/src/components/image/image.md +41 -0
  113. package/src/components/image/image.scss +1 -0
  114. package/src/components/image/image.type.ts +5 -0
  115. package/src/components/image/image.vue +25 -0
  116. package/src/components/image/index.ts +2 -0
  117. package/src/components/index.ts +27 -0
  118. package/src/components/modal/index.ts +2 -0
  119. package/src/components/modal/modal.html +20 -0
  120. package/src/components/modal/modal.md +65 -0
  121. package/src/components/modal/modal.scss +78 -0
  122. package/src/components/modal/modal.type.ts +21 -0
  123. package/src/components/modal/modal.vue +186 -0
  124. package/src/components/page/index.ts +1 -0
  125. package/src/components/page/page.html +3 -0
  126. package/src/components/page/page.md +39 -0
  127. package/src/components/page/page.scss +17 -0
  128. package/src/components/page/page.vue +9 -0
  129. package/src/components/present/index.ts +3 -0
  130. package/src/components/present/present.composable.ts +21 -0
  131. package/src/components/present/present.html +9 -0
  132. package/src/components/present/present.md +60 -0
  133. package/src/components/present/present.scss +81 -0
  134. package/src/components/present/present.type.ts +26 -0
  135. package/src/components/present/present.vue +198 -0
  136. package/src/components/radio/index.ts +2 -0
  137. package/src/components/radio/radio/index.ts +2 -0
  138. package/src/components/radio/radio/radio.html +11 -0
  139. package/src/components/radio/radio/radio.md +53 -0
  140. package/src/components/radio/radio/radio.scss +125 -0
  141. package/src/components/radio/radio/radio.type.ts +11 -0
  142. package/src/components/radio/radio/radio.vue +99 -0
  143. package/src/components/radio/radio-group/index.ts +7 -0
  144. package/src/components/radio/radio-group/radio-group.constants.ts +1 -0
  145. package/src/components/radio/radio-group/radio-group.html +3 -0
  146. package/src/components/radio/radio-group/radio-group.md +62 -0
  147. package/src/components/radio/radio-group/radio-group.scss +16 -0
  148. package/src/components/radio/radio-group/radio-group.type.ts +28 -0
  149. package/src/components/radio/radio-group/radio-group.vue +57 -0
  150. package/src/components/refresher/index.ts +2 -0
  151. package/src/components/refresher/refresher.html +6 -0
  152. package/src/components/refresher/refresher.md +53 -0
  153. package/src/components/refresher/refresher.scss +36 -0
  154. package/src/components/refresher/refresher.type.ts +16 -0
  155. package/src/components/refresher/refresher.vue +137 -0
  156. package/src/components/route/index.ts +5 -0
  157. package/src/components/route/route-navigator/index.ts +2 -0
  158. package/src/components/route/route-navigator/route-navigator.html +19 -0
  159. package/src/components/route/route-navigator/route-navigator.md +50 -0
  160. package/src/components/route/route-navigator/route-navigator.scss +127 -0
  161. package/src/components/route/route-navigator/route-navigator.type.ts +12 -0
  162. package/src/components/route/route-navigator/route-navigator.vue +255 -0
  163. package/src/components/route/route-outlet/index.ts +1 -0
  164. package/src/components/route/route-outlet/route-outlet.html +1 -0
  165. package/src/components/route/route-outlet/route-outlet.md +30 -0
  166. package/src/components/route/route-outlet/route-outlet.vue +30 -0
  167. package/src/components/route/route-provider/index.ts +3 -0
  168. package/src/components/route/route-provider/route-provider.constant.ts +1 -0
  169. package/src/components/route/route-provider/route-provider.html +1 -0
  170. package/src/components/route/route-provider/route-provider.md +46 -0
  171. package/src/components/route/route-provider/route-provider.type.ts +10 -0
  172. package/src/components/route/route-provider/route-provider.vue +20 -0
  173. package/src/components/route/route-wrapper/index.ts +3 -0
  174. package/src/components/route/route-wrapper/route-wrapper.composable.ts +58 -0
  175. package/src/components/route/route-wrapper/route-wrapper.html +3 -0
  176. package/src/components/route/route-wrapper/route-wrapper.md +45 -0
  177. package/src/components/route/route-wrapper/route-wrapper.type.ts +7 -0
  178. package/src/components/route/route-wrapper/route-wrapper.vue +51 -0
  179. package/src/components/route/route.type.ts +8 -0
  180. package/src/components/route/route.util.ts +8 -0
  181. package/src/components/segmented-field/index.ts +7 -0
  182. package/src/components/segmented-field/segmented-field.html +17 -0
  183. package/src/components/segmented-field/segmented-field.md +58 -0
  184. package/src/components/segmented-field/segmented-field.scss +52 -0
  185. package/src/components/segmented-field/segmented-field.type.ts +29 -0
  186. package/src/components/segmented-field/segmented-field.vue +145 -0
  187. package/src/components/skeleton/index.ts +2 -0
  188. package/src/components/skeleton/skeleton.html +1 -0
  189. package/src/components/skeleton/skeleton.md +47 -0
  190. package/src/components/skeleton/skeleton.scss +45 -0
  191. package/src/components/skeleton/skeleton.type.ts +7 -0
  192. package/src/components/skeleton/skeleton.vue +38 -0
  193. package/src/components/switch/index.ts +2 -0
  194. package/src/components/switch/switch.html +15 -0
  195. package/src/components/switch/switch.md +57 -0
  196. package/src/components/switch/switch.scss +134 -0
  197. package/src/components/switch/switch.type.ts +13 -0
  198. package/src/components/switch/switch.vue +81 -0
  199. package/src/components/tabs/index.ts +2 -0
  200. package/src/components/tabs/tab/index.ts +2 -0
  201. package/src/components/tabs/tab/tab.html +5 -0
  202. package/src/components/tabs/tab/tab.md +52 -0
  203. package/src/components/tabs/tab/tab.type.ts +5 -0
  204. package/src/components/tabs/tab/tab.vue +38 -0
  205. package/src/components/tabs/tabs/index.ts +9 -0
  206. package/src/components/tabs/tabs/tabs.constants.ts +1 -0
  207. package/src/components/tabs/tabs/tabs.html +3 -0
  208. package/src/components/tabs/tabs/tabs.md +59 -0
  209. package/src/components/tabs/tabs/tabs.scss +270 -0
  210. package/src/components/tabs/tabs/tabs.type.ts +36 -0
  211. package/src/components/tabs/tabs/tabs.vue +157 -0
  212. package/src/components/toast/index.ts +4 -0
  213. package/src/components/toast/toast/index.ts +1 -0
  214. package/src/components/toast/toast/toast.html +9 -0
  215. package/src/components/toast/toast/toast.md +56 -0
  216. package/src/components/toast/toast/toast.scss +61 -0
  217. package/src/components/toast/toast/toast.vue +34 -0
  218. package/src/components/toast/toast-content/index.ts +1 -0
  219. package/src/components/toast/toast-content/toast-content.html +1 -0
  220. package/src/components/toast/toast-content/toast-content.md +41 -0
  221. package/src/components/toast/toast-content/toast-content.scss +41 -0
  222. package/src/components/toast/toast-content/toast-content.vue +53 -0
  223. package/src/components/toast/toast.composable.ts +22 -0
  224. package/src/components/toast/toast.type.ts +25 -0
  225. package/src/components/toolbar/index.ts +2 -0
  226. package/src/components/toolbar/toolbar.html +5 -0
  227. package/src/components/toolbar/toolbar.md +57 -0
  228. package/src/components/toolbar/toolbar.scss +79 -0
  229. package/src/components/toolbar/toolbar.type.ts +7 -0
  230. package/src/components/toolbar/toolbar.vue +41 -0
  231. package/src/env.d.ts +7 -0
  232. package/src/factory.ts +83 -0
  233. package/src/index.ts +4 -0
  234. package/{dist/type.d.ts → src/type.ts} +1 -1
  235. package/src/utils/element.md +33 -0
  236. package/src/utils/element.ts +16 -0
  237. package/src/utils/events.md +29 -0
  238. package/src/utils/events.ts +12 -0
  239. package/src/utils/index.ts +3 -0
  240. package/src/utils/style/index.ts +42 -0
  241. package/src/utils/style.md +49 -0
  242. package/dist/components/action/action.type.d.ts +0 -17
  243. package/dist/components/action/action.vue.d.ts +0 -14
  244. package/dist/components/action/factory.d.ts +0 -3
  245. package/dist/components/action/index.d.ts +0 -2
  246. package/dist/components/alert/alert.type.d.ts +0 -16
  247. package/dist/components/alert/alert.vue.d.ts +0 -14
  248. package/dist/components/alert/factory.d.ts +0 -3
  249. package/dist/components/alert/index.d.ts +0 -2
  250. package/dist/components/app/app.type.d.ts +0 -1
  251. package/dist/components/app/app.vue.d.ts +0 -3
  252. package/dist/components/app/index.d.ts +0 -1
  253. package/dist/components/avatar/avatar.type.d.ts +0 -4
  254. package/dist/components/avatar/avatar.vue.d.ts +0 -6
  255. package/dist/components/avatar/index.d.ts +0 -1
  256. package/dist/components/back-button/back-button.type.d.ts +0 -4
  257. package/dist/components/back-button/back-button.vue.d.ts +0 -3
  258. package/dist/components/back-button/index.d.ts +0 -1
  259. package/dist/components/button/button.type.d.ts +0 -10
  260. package/dist/components/button/button.vue.d.ts +0 -12
  261. package/dist/components/button/index.d.ts +0 -1
  262. package/dist/components/cable/cable.type.d.ts +0 -4
  263. package/dist/components/cable/cable.vue.d.ts +0 -6
  264. package/dist/components/cable/index.d.ts +0 -1
  265. package/dist/components/card/card.type.d.ts +0 -3
  266. package/dist/components/card/card.vue.d.ts +0 -5
  267. package/dist/components/card/index.d.ts +0 -1
  268. package/dist/components/checkbox/checkbox.type.d.ts +0 -12
  269. package/dist/components/checkbox/checkbox.vue.d.ts +0 -14
  270. package/dist/components/checkbox/index.d.ts +0 -1
  271. package/dist/components/collapse/collapse.type.d.ts +0 -6
  272. package/dist/components/collapse/collapse.vue.d.ts +0 -7
  273. package/dist/components/collapse/index.d.ts +0 -1
  274. package/dist/components/content/content.type.d.ts +0 -1
  275. package/dist/components/content/content.vue.d.ts +0 -3
  276. package/dist/components/content/index.d.ts +0 -1
  277. package/dist/components/divider/divider.type.d.ts +0 -3
  278. package/dist/components/divider/divider.vue.d.ts +0 -5
  279. package/dist/components/divider/index.d.ts +0 -1
  280. package/dist/components/flex/flex.type.d.ts +0 -4
  281. package/dist/components/flex/flex.vue.d.ts +0 -6
  282. package/dist/components/flex/index.d.ts +0 -1
  283. package/dist/components/gesture-indicator/gesture-indicator.vue.d.ts +0 -5
  284. package/dist/components/gesture-indicator/index.d.ts +0 -1
  285. package/dist/components/grid/grid.type.d.ts +0 -4
  286. package/dist/components/grid/grid.vue.d.ts +0 -6
  287. package/dist/components/grid/index.d.ts +0 -1
  288. package/dist/components/icon-spinner/icon-spinner.type.d.ts +0 -4
  289. package/dist/components/icon-spinner/icon-spinner.vue.d.ts +0 -6
  290. package/dist/components/icon-spinner/index.d.ts +0 -1
  291. package/dist/components/image/image.type.d.ts +0 -4
  292. package/dist/components/image/image.vue.d.ts +0 -3
  293. package/dist/components/image/index.d.ts +0 -1
  294. package/dist/components/index.d.ts +0 -36
  295. package/dist/components/input/index.d.ts +0 -1
  296. package/dist/components/input/input.type.d.ts +0 -15
  297. package/dist/components/input/input.vue.d.ts +0 -16
  298. package/dist/components/keyboard-space/factory.d.ts +0 -3
  299. package/dist/components/keyboard-space/index.d.ts +0 -2
  300. package/dist/components/keyboard-space/keyboard-space.type.d.ts +0 -1
  301. package/dist/components/keyboard-space/keyboard-space.vue.d.ts +0 -3
  302. package/dist/components/loading/factory.d.ts +0 -4
  303. package/dist/components/loading/index.d.ts +0 -2
  304. package/dist/components/loading/loading.type.d.ts +0 -6
  305. package/dist/components/loading/loading.vue.d.ts +0 -12
  306. package/dist/components/present/factory.d.ts +0 -1
  307. package/dist/components/present/index.d.ts +0 -2
  308. package/dist/components/present/present.type.d.ts +0 -13
  309. package/dist/components/present/present.vue.d.ts +0 -17
  310. package/dist/components/refresher/index.d.ts +0 -1
  311. package/dist/components/refresher/refresher.type.d.ts +0 -11
  312. package/dist/components/refresher/refresher.vue.d.ts +0 -17
  313. package/dist/components/richtext/index.d.ts +0 -1
  314. package/dist/components/richtext/richtext.type.d.ts +0 -1
  315. package/dist/components/richtext/richtext.vue.d.ts +0 -3
  316. package/dist/components/ripple/index.d.ts +0 -1
  317. package/dist/components/ripple/ripple.type.d.ts +0 -3
  318. package/dist/components/ripple/ripple.vue.d.ts +0 -5
  319. package/dist/components/screen/index.d.ts +0 -1
  320. package/dist/components/screen/screen.type.d.ts +0 -1
  321. package/dist/components/screen/screen.vue.d.ts +0 -3
  322. package/dist/components/screen-router/factory.d.ts +0 -19
  323. package/dist/components/screen-router/index.d.ts +0 -2
  324. package/dist/components/screen-router/screen-router.type.d.ts +0 -8
  325. package/dist/components/screen-router/screen-router.vue.d.ts +0 -9
  326. package/dist/components/sheet/index.d.ts +0 -1
  327. package/dist/components/sheet/sheet.type.d.ts +0 -18
  328. package/dist/components/sheet/sheet.vue.d.ts +0 -18
  329. package/dist/components/skeleton/index.d.ts +0 -1
  330. package/dist/components/skeleton/skeleton.type.d.ts +0 -6
  331. package/dist/components/skeleton/skeleton.vue.d.ts +0 -8
  332. package/dist/components/switch/index.d.ts +0 -1
  333. package/dist/components/switch/switch.type.d.ts +0 -7
  334. package/dist/components/switch/switch.vue.d.ts +0 -9
  335. package/dist/components/tab/index.d.ts +0 -1
  336. package/dist/components/tab/tab.type.d.ts +0 -4
  337. package/dist/components/tab/tab.vue.d.ts +0 -5
  338. package/dist/components/tabs/index.d.ts +0 -1
  339. package/dist/components/tabs/tabs.type.d.ts +0 -13
  340. package/dist/components/tabs/tabs.vue.d.ts +0 -15
  341. package/dist/components/text/index.d.ts +0 -1
  342. package/dist/components/text/text.type.d.ts +0 -4
  343. package/dist/components/text/text.vue.d.ts +0 -6
  344. package/dist/components/textarea/index.d.ts +0 -1
  345. package/dist/components/textarea/textarea.type.d.ts +0 -1
  346. package/dist/components/textarea/textarea.vue.d.ts +0 -3
  347. package/dist/components/toast/factory.d.ts +0 -3
  348. package/dist/components/toast/index.d.ts +0 -2
  349. package/dist/components/toast/toast.type.d.ts +0 -11
  350. package/dist/components/toast/toast.vue.d.ts +0 -16
  351. package/dist/components/toggle-password/index.d.ts +0 -1
  352. package/dist/components/toggle-password/toggle-password.type.d.ts +0 -6
  353. package/dist/components/toggle-password/toggle-password.vue.d.ts +0 -9
  354. package/dist/components/toolbar/index.d.ts +0 -1
  355. package/dist/components/toolbar/toolbar.type.d.ts +0 -5
  356. package/dist/components/toolbar/toolbar.vue.d.ts +0 -7
  357. package/dist/factory.d.ts +0 -4
  358. package/dist/index.css +0 -1
  359. package/dist/index.d.ts +0 -4
  360. package/dist/index.es.js +0 -1836
  361. package/dist/index.umd.js +0 -1
  362. package/dist/utils/element.d.ts +0 -2
  363. package/dist/utils/events.d.ts +0 -1
  364. package/dist/utils/index.d.ts +0 -2
@@ -0,0 +1,186 @@
1
+ <style lang="scss" src="./modal.scss" scoped></style>
2
+ <template src="./modal.html"></template>
3
+ <script lang="ts" setup>
4
+ import { computed, inject, onUnmounted, ref, watch } from "vue";
5
+ import { gesture as toifeGesture } from "@toife/gesture";
6
+ import { Present } from "../present";
7
+ import { GestureIndicator } from "../gesture-indicator";
8
+ import { type ModalProps, type ModalEmit } from "./modal.type";
9
+ import { withPrefix } from "../../utils";
10
+ import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../app";
11
+
12
+ /// Define
13
+ /// ------------------------------------------------------------
14
+ const props = withDefaults(defineProps<ModalProps>(), {
15
+ backdrop: "display",
16
+ keepalive: true,
17
+ visible: false,
18
+ gesture: true,
19
+ fullscreen: false,
20
+ placement: "bottom",
21
+ indicator: true,
22
+ duration: 200,
23
+ bounce: 0,
24
+ });
25
+ const emit = defineEmits<ModalEmit>();
26
+ const appState = inject<AppProviderState>(APP_PROVIDER_STATE_KEY);
27
+
28
+ /// State
29
+ /// ------------------------------------------------------------
30
+ const modal = ref();
31
+ const present = ref();
32
+ const isBusy = ref(false);
33
+ const ges = ref<unknown>(null);
34
+
35
+ /// Computed
36
+ /// ------------------------------------------------------------
37
+ const gestureDir = computed(() => {
38
+ if (props.placement == "bottom") return "down";
39
+ if (props.placement == "top") return "up";
40
+ if (props.placement == "left") return "left";
41
+ if (props.placement == "right") return "right";
42
+ });
43
+
44
+ const modalAttrs = computed(() => {
45
+ const shape = props?.shape || appState?.shape.value || "";
46
+ const role = props.role || appState?.role.value || "";
47
+
48
+ return {
49
+ class: [
50
+ withPrefix(["layer", "modal"]),
51
+ withPrefix(["role", role]),
52
+ withPrefix(["shape", shape]),
53
+ withPrefix("modal"),
54
+ {
55
+ fullscreen: props.fullscreen,
56
+ [props.placement]: true,
57
+ },
58
+ props.class,
59
+ ],
60
+ style: props.style,
61
+ };
62
+ });
63
+
64
+ /// Methods
65
+ /// ------------------------------------------------------------
66
+ const close = (e: string) => {
67
+ emit("close", e);
68
+ };
69
+
70
+ const busy = () => {
71
+ isBusy.value = true;
72
+ setTimeout(() => {
73
+ isBusy.value = false;
74
+ }, 300);
75
+ };
76
+
77
+ // Lifecycle
78
+ /// ------------------------------------------------------------
79
+ watch(
80
+ () => modal.value,
81
+ (val) => {
82
+ if (val) {
83
+ ges.value = toifeGesture(modal.value, {
84
+ isMoving: false,
85
+
86
+ options: {
87
+ minDist: 30,
88
+ },
89
+
90
+ beforeEvent(e: unknown) {
91
+ if (isBusy.value || !props.gesture || props.placement == "center") {
92
+ return false;
93
+ }
94
+
95
+ return true;
96
+ },
97
+
98
+ down() {
99
+ this.isMoving = false;
100
+ },
101
+
102
+ fast({ initialDirection }: unknown) {
103
+ busy();
104
+ if (initialDirection == gestureDir.value) {
105
+ emit("close", "gesture");
106
+ } else {
107
+ present.value.open();
108
+ }
109
+ },
110
+
111
+ move({ deltaY, deltaX, initialDirection }: unknown) {
112
+ if (initialDirection != gestureDir.value) return;
113
+ let tv = 0;
114
+ if (props.placement == "bottom" || props.placement == "top") tv = deltaY;
115
+ else tv = deltaX;
116
+
117
+ if (props.placement == "bottom") {
118
+ tv = deltaY > 0 ? deltaY : 0;
119
+ }
120
+
121
+ if (props.placement == "top") {
122
+ tv = deltaY < 0 ? deltaY : 0;
123
+ }
124
+
125
+ if (props.placement == "left") {
126
+ tv = deltaX < 0 ? deltaX : 0;
127
+ }
128
+
129
+ if (props.placement == "right") {
130
+ tv = deltaX > 0 ? deltaX : 0;
131
+ }
132
+
133
+ if (
134
+ (props.placement == "bottom" && (tv >= 10 || this.isMoving)) ||
135
+ (props.placement == "top" && (tv <= -10 || this.isMoving)) ||
136
+ (props.placement == "left" && (tv <= -10 || this.isMoving)) ||
137
+ (props.placement == "right" && (tv >= 10 || this.isMoving))
138
+ ) {
139
+ this.isMoving = true;
140
+ present.value.render({
141
+ presentTranslate: tv + "px",
142
+ presentTransitionDuration: "0s",
143
+ });
144
+ }
145
+ },
146
+
147
+ up({ deltaY, deltaX, initialDirection }: unknown) {
148
+ this.isMoving = false;
149
+ busy();
150
+ if (initialDirection != gestureDir.value) {
151
+ present.value.open();
152
+ return;
153
+ }
154
+
155
+ let size, diff, val;
156
+ if (props.placement == "bottom" || props.placement == "top") {
157
+ size = modal.value.offsetHeight;
158
+ val = deltaY;
159
+ } else {
160
+ size = modal.value.offsetWidth;
161
+ val = deltaX;
162
+ }
163
+
164
+ diff = (val / size) * 100;
165
+
166
+ if (diff > 50) {
167
+ emit("close", "gesture");
168
+ } else {
169
+ present.value.open();
170
+ }
171
+ },
172
+
173
+ cancel() {
174
+ this.isMoving = false;
175
+ busy();
176
+ present.value.open();
177
+ },
178
+ });
179
+ }
180
+ }
181
+ );
182
+
183
+ onUnmounted(() => {
184
+ if (ges.value) (ges.value as { destroy: () => void }).destroy();
185
+ });
186
+ </script>
@@ -0,0 +1 @@
1
+ export { default as Page } from "./page.vue";
@@ -0,0 +1,3 @@
1
+ <div v-bind="pageAttrs">
2
+ <slot />
3
+ </div>
@@ -0,0 +1,39 @@
1
+ # `<t-page>`
2
+
3
+ > Default prefix is `t-` — change via `createToife({ prefix: "..." })`.
4
+
5
+ ## Description
6
+
7
+ Simple page wrapper with the themed `page` class.
8
+
9
+ ## Requirements / dependencies
10
+
11
+ | Item | Notes |
12
+ | ----- | ----- |
13
+ | Vue | ^3.5 |
14
+ | Other | None. |
15
+
16
+ ## Basic usage
17
+
18
+ ```vue
19
+ <t-app>
20
+ <t-page>
21
+ <t-toolbar />
22
+ <t-container>Content</t-container>
23
+ </t-page>
24
+ </t-app>
25
+ ```
26
+
27
+ ## Props
28
+
29
+ _None._
30
+
31
+ ## Slots
32
+
33
+ | Slot | Description |
34
+ | --------- | --------------- |
35
+ | `default` | Page structure. |
36
+
37
+ ## See also
38
+
39
+ - Source: `src/components/page`
@@ -0,0 +1,17 @@
1
+ @use "@toife/sass-layer-generator" as sass;
2
+
3
+ // Class name
4
+ $page: sass.fn-naming-prefix("page");
5
+
6
+ .#{$page} {
7
+ width: 100%;
8
+ height: 100%;
9
+ max-width: 100%;
10
+ max-height: 100%;
11
+ position: absolute;
12
+ top: 0;
13
+ left: 0;
14
+ right: 0;
15
+ bottom: 0;
16
+ overflow: auto;
17
+ }
@@ -0,0 +1,9 @@
1
+ <template src="./page.html"></template>
2
+ <style lang="scss" src="./page.scss" scoped></style>
3
+ <script lang="ts" setup>
4
+ import { withPrefix } from "@/utils";
5
+
6
+ const pageAttrs = {
7
+ class: [withPrefix("page")],
8
+ } as const;
9
+ </script>
@@ -0,0 +1,3 @@
1
+ export { default as Present } from "./present.vue";
2
+ export * from "./present.composable";
3
+ export * from "./present.type";
@@ -0,0 +1,21 @@
1
+ import { ref } from "vue";
2
+
3
+ const index = ref(1000);
4
+
5
+ export const usePresent = () => {
6
+ const newIndex = () => {
7
+ index.value += 2;
8
+ return index.value;
9
+ };
10
+
11
+ const resetIndex = () => {
12
+ index.value = 1000;
13
+ return index.value;
14
+ };
15
+
16
+ return {
17
+ newIndex,
18
+ resetIndex,
19
+ index,
20
+ };
21
+ };
@@ -0,0 +1,9 @@
1
+ <div
2
+ v-bind="backdropAttrs"
3
+ @click="onClickBackdrop"
4
+ v-if="isRender && backdrop !== 'none'"
5
+ v-show="isShow"
6
+ ></div>
7
+ <div v-bind="presentAttrs" v-if="isRender" v-show="isShow">
8
+ <slot />
9
+ </div>
@@ -0,0 +1,60 @@
1
+ # `Present` _(named export; not in default `createToife`)_
2
+
3
+ > **Not** registered by `createToife()` — import: `import { Present } from "@toife/vue"` and register globally yourself if needed.
4
+
5
+ ## Description
6
+
7
+ Overlay layer: backdrop + animated panel, stacking z-index via `usePresent`. Used internally by `Modal`, `Action`, `DecisionModal`.
8
+
9
+ ## Requirements / dependencies
10
+
11
+ | Item | Notes |
12
+ | ----- | ----- |
13
+ | Vue | ^3.5 |
14
+ | Other | None. |
15
+
16
+ ## Basic usage
17
+
18
+ ```vue
19
+ <Present :visible="show" placement="bottom" backdrop="display" @close="onClose">
20
+ <div>Content</div>
21
+ </Present>
22
+ ```
23
+
24
+ ## Props
25
+
26
+ | Prop | Type | Default | Description |
27
+ | ----------------- | -------------------------------------- | ----------- | ----------------------------------- |
28
+ | `visible` | `boolean` | `false` | Open/close (with `duration` delay). |
29
+ | `backdrop` | `"display" \| "none" \| "transparent"` | `"display"` | Backdrop. |
30
+ | `placement` | `PresentPlacement` | `"bottom"` | Animation direction. |
31
+ | `keepalive` | `boolean` | `false` | Keep DOM when closed. |
32
+ | `duration` | `number` | `200` | ms. |
33
+ | `bounce` | `number \| string \| boolean` | `false` | Open bounce. |
34
+ | `class` / `style` | `unknown` | — | Panel. |
35
+
36
+ **Type source:** `src/components/present/present.type.ts`
37
+
38
+ ## Events (emits)
39
+
40
+ | Event | Payload | Description |
41
+ | ------- | --------------- | ------------------------------------------- |
42
+ | `close` | `type?: string` | e.g. `'backdrop'` when backdrop is clicked. |
43
+
44
+ ## Slots
45
+
46
+ | Slot | Description |
47
+ | --------- | -------------- |
48
+ | `default` | Panel content. |
49
+
50
+ ## Expose (template ref)
51
+
52
+ | API | Description |
53
+ | -------------------------------- | ------------------------------------------------- |
54
+ | `render(options: RenderOptions)` | Update transition styles (translate, opacity, …). |
55
+ | `open()` / `close()` | Manual animation control. |
56
+
57
+ ## See also
58
+
59
+ - Source: `src/components/present`
60
+ - `present.composable.ts` — `usePresent` (z-index stack)
@@ -0,0 +1,81 @@
1
+ @use "@toife/sass-layer-generator" as sass;
2
+
3
+ // Class name
4
+ $present: sass.fn-naming-prefix("present");
5
+ $backdrop: sass.fn-naming-prefix("present-backdrop");
6
+
7
+ // Property name
8
+ $transition-duration: sass.fn-naming-dvar(
9
+ ("transition", "duration"),
10
+ sass.fn-naming-var("motion", "duration")
11
+ );
12
+ // layer: backdrop
13
+ $backdrop-bg: sass.fn-naming-var("backdrop", "background-color");
14
+ $backdrop-opacity: sass.fn-naming-var("backdrop", "opacity");
15
+
16
+ $present-translate-plus: sass.fn-naming-dvar(("translate"), "100%");
17
+ $present-translate-minus: sass.fn-naming-dvar(("translate"), "-100%");
18
+ $present-opacity: sass.fn-naming-dvar(("present", "opacity"), 1);
19
+
20
+ .#{$backdrop} {
21
+ position: absolute;
22
+ width: 100%;
23
+ height: 100%;
24
+ top: 0;
25
+ left: 0;
26
+ transition:
27
+ box-shadow #{$transition-duration} ease,
28
+ border-color #{$transition-duration} ease,
29
+ background-color #{$transition-duration} ease,
30
+ color #{$transition-duration} ease,
31
+ border-radius #{$transition-duration} ease,
32
+ opacity #{$transition-duration} ease;
33
+ background-color: rgb(#{$backdrop-bg});
34
+ opacity: #{$backdrop-opacity};
35
+ }
36
+
37
+ .#{$present} {
38
+ display: flex;
39
+ justify-content: center;
40
+ align-items: center;
41
+ position: absolute;
42
+ width: fit-content;
43
+ height: fit-content;
44
+ transition: transform #{$transition-duration} ease;
45
+
46
+ &.bottom {
47
+ bottom: 0;
48
+ left: 0;
49
+ transform: translateY(#{$present-translate-plus});
50
+ width: 100%;
51
+ }
52
+
53
+ &.top {
54
+ top: 0;
55
+ left: 0;
56
+ transform: translateY(#{$present-translate-minus});
57
+ width: 100%;
58
+ }
59
+
60
+ &.right {
61
+ top: 0;
62
+ right: 0;
63
+ transform: translateX(#{$present-translate-plus});
64
+ height: 100%;
65
+ }
66
+
67
+ &.left {
68
+ top: 0;
69
+ left: 0;
70
+ transform: translateX(#{$present-translate-minus});
71
+ height: 100%;
72
+ }
73
+
74
+ &.center {
75
+ transform: translate(-50%, -50%);
76
+ top: 50%;
77
+ left: 50%;
78
+ opacity: #{$present-opacity};
79
+ transition: opacity #{$transition-duration} ease;
80
+ }
81
+ }
@@ -0,0 +1,26 @@
1
+ export type PresentPlacement = "top" | "left" | "right" | "center" | "bottom";
2
+
3
+ // Present props
4
+ export type PresentProps = {
5
+ keepalive?: boolean;
6
+ visible?: boolean;
7
+ backdrop?: "display" | "none" | "transparent";
8
+ placement?: PresentPlacement;
9
+ style?: unknown;
10
+ class?: unknown;
11
+ bounce?: number | string | boolean;
12
+ duration?: number;
13
+ };
14
+
15
+ // Present emit
16
+ export type PresentEmit = { (e: "close", type?: string): void };
17
+
18
+ // Render options
19
+ // Parameters for render function
20
+ export type RenderOptions = {
21
+ backdropTransitionDuration?: string;
22
+ backdropOpacity?: number;
23
+ presentTransitionDuration?: string;
24
+ presentTranslate?: string;
25
+ presentOpacity?: number;
26
+ };
@@ -0,0 +1,198 @@
1
+ <style lang="scss" src="./present.scss" scoped></style>
2
+ <template src="./present.html"></template>
3
+ <script lang="ts" setup>
4
+ import type { PresentEmit, PresentProps, RenderOptions } from "./present.type";
5
+ import { computed, onMounted, reactive, ref, watch } from "vue";
6
+ import { withPrefix, property } from "../../utils";
7
+ import { usePresent } from "./present.composable";
8
+
9
+ /// Define
10
+ /// ------------------------------------------------------------
11
+ const presentIndex = usePresent();
12
+ const emit = defineEmits(["close"]) as unknown as PresentEmit;
13
+ defineOptions({ inheritAttrs: false });
14
+
15
+ const props = withDefaults(defineProps<PresentProps>(), {
16
+ keepalive: false,
17
+ visible: false,
18
+ backdrop: "display",
19
+ duration: 200,
20
+ placement: "bottom",
21
+ bounce: false,
22
+ });
23
+
24
+ /// State
25
+ /// ------------------------------------------------------------
26
+ const isBounced = ref(false);
27
+ const zIndex = ref(0);
28
+ const isShow = ref(false);
29
+ const styles = reactive({
30
+ backdropTransitionDuration: "0.2s",
31
+ backdropOpacity: 0.4,
32
+ presentTransitionDuration: "0.2s",
33
+ presentTranslate: "0px",
34
+ presentOpacity: 1,
35
+ });
36
+
37
+ /// Computed
38
+ /// ------------------------------------------------------------
39
+ const backdropAttrs = computed(() => {
40
+ return {
41
+ class: [withPrefix(["layer", "backdrop"]), withPrefix("present-backdrop")],
42
+ style: {
43
+ zIndex: zIndex.value - 1,
44
+ [property("transition-duration")]: styles.backdropTransitionDuration,
45
+ [property(["backdrop", "opacity"])]:
46
+ props.backdrop === "transparent" ? 0 : styles.backdropOpacity,
47
+ },
48
+ };
49
+ });
50
+
51
+ // Present attributes
52
+ const presentAttrs = computed(() => {
53
+ return {
54
+ class: [withPrefix("present"), props.class, props.placement],
55
+ style: [
56
+ {
57
+ zIndex: zIndex.value,
58
+ [property("transition-duration")]: styles.presentTransitionDuration,
59
+ [property("translate")]: styles.presentTranslate,
60
+ [property(["present", "opacity"])]: styles.presentOpacity,
61
+ },
62
+ props.style,
63
+ ],
64
+ };
65
+ });
66
+
67
+ const isRender = computed(() => {
68
+ return isShow.value || props.keepalive;
69
+ });
70
+
71
+ const time = computed(() => {
72
+ return props.duration / 1000 + "s";
73
+ });
74
+
75
+ // Methods
76
+ /// ------------------------------------------------------------
77
+ const createIndex = () => {
78
+ if (zIndex.value === 0 || !props.keepalive) {
79
+ zIndex.value = presentIndex.newIndex();
80
+ }
81
+ };
82
+
83
+ const render = (data: RenderOptions) => {
84
+ if (data.backdropTransitionDuration !== undefined) {
85
+ styles.backdropTransitionDuration = data.backdropTransitionDuration;
86
+ }
87
+ if (data.presentTransitionDuration !== undefined) {
88
+ styles.presentTransitionDuration = data.presentTransitionDuration;
89
+ }
90
+ if (data.backdropOpacity !== undefined) {
91
+ styles.backdropOpacity = data.backdropOpacity;
92
+ }
93
+ if (data.presentTranslate !== undefined) {
94
+ styles.presentTranslate = data.presentTranslate;
95
+ }
96
+ if (data.presentOpacity !== undefined) {
97
+ styles.presentOpacity = data.presentOpacity;
98
+ }
99
+ };
100
+
101
+ // On click backdrop
102
+ const onClickBackdrop = (e: unknown) => {
103
+ (e as Event).preventDefault();
104
+ emit("close", "backdrop");
105
+ };
106
+
107
+ const open = () => {
108
+ if (props.bounce && !isBounced.value) {
109
+ isBounced.value = true;
110
+ let presentTranslate = props.bounce;
111
+
112
+ if (props.placement == "bottom" || props.placement == "right") {
113
+ presentTranslate = `calc(${props.bounce} * -1)`;
114
+ }
115
+
116
+ render({
117
+ backdropTransitionDuration: time.value,
118
+ backdropOpacity: 0.4,
119
+ presentTranslate: String(presentTranslate),
120
+ presentTransitionDuration: time.value,
121
+ presentOpacity: 1,
122
+ });
123
+
124
+ setTimeout(() => {
125
+ render({
126
+ presentTranslate: "0px",
127
+ });
128
+ }, props.duration);
129
+ } else {
130
+ render({
131
+ backdropOpacity: 0.4,
132
+ backdropTransitionDuration: time.value,
133
+ presentTranslate: "0px",
134
+ presentTransitionDuration: time.value,
135
+ presentOpacity: 1,
136
+ });
137
+ }
138
+ };
139
+
140
+ const close = () => {
141
+ isBounced.value = false;
142
+ let presentTranslate = "0px";
143
+ let presentOpacity = 1;
144
+
145
+ if (props.placement == "bottom" || props.placement == "right") {
146
+ presentTranslate = "100%";
147
+ } else if (props.placement == "top" || props.placement == "left") {
148
+ presentTranslate = "-100%";
149
+ } else if (props.placement == "center") {
150
+ presentTranslate = "0px";
151
+ presentOpacity = 0;
152
+ }
153
+
154
+ render({
155
+ backdropOpacity: 0,
156
+ backdropTransitionDuration: time.value,
157
+ presentTranslate,
158
+ presentTransitionDuration: time.value,
159
+ presentOpacity,
160
+ });
161
+ };
162
+
163
+ // Lifecycle
164
+ /// ------------------------------------------------------------
165
+ onMounted(() => {
166
+ if (props.visible) open();
167
+ else close();
168
+ });
169
+
170
+ // Trigger visible
171
+ watch(
172
+ () => props.visible,
173
+ () => {
174
+ if (props.visible) {
175
+ createIndex();
176
+ isShow.value = true;
177
+
178
+ setTimeout(() => {
179
+ open();
180
+ }, 50);
181
+ } else {
182
+ close();
183
+
184
+ setTimeout(() => {
185
+ isShow.value = false;
186
+ }, props.duration);
187
+ }
188
+ }
189
+ );
190
+
191
+ // Export, Expose
192
+ /// ------------------------------------------------------------
193
+ defineExpose({
194
+ render,
195
+ open,
196
+ close,
197
+ });
198
+ </script>
@@ -0,0 +1,2 @@
1
+ export * from "./radio";
2
+ export * from "./radio-group";
@@ -0,0 +1,2 @@
1
+ export { default as Radio } from "./radio.vue";
2
+ export type { RadioProps } from "./radio.type";
@@ -0,0 +1,11 @@
1
+ <div
2
+ v-bind="radioAttrs"
3
+ @click="onRadio"
4
+ :tabindex="disabled ? -1 : 0"
5
+ @focus="onFocus"
6
+ @blur="onBlur"
7
+ @keydown="onKeydown"
8
+ >
9
+ <div v-bind="radioIconAttrs"></div>
10
+ <slot></slot>
11
+ </div>