create-nexwire 4.3.0 → 4.4.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 (326) hide show
  1. package/README.md +10 -5
  2. package/express/src/framework/facade.ts +1 -0
  3. package/express/src/framework/http/logger.ts +13 -4
  4. package/express/src/framework/maker-cli/runtime/core.mjs +1 -2
  5. package/express/src/framework/notification/channels/mail.ts +8 -6
  6. package/express/src/middlewares/auth-middleware.ts +1 -2
  7. package/express/src/middlewares/role-middleware.ts +3 -13
  8. package/express/src/modules/auth/routes/index.ts +1 -2
  9. package/express/src/providers/notification.ts +2 -2
  10. package/express/src/resources/src/components/Switch.vue +60 -65
  11. package/express/src/resources/src/pages/auth/forgetPassword.vue +23 -30
  12. package/express/src/resources/src/pages/auth/login.vue +25 -28
  13. package/express/src/resources/src/pages/auth/register.vue +35 -39
  14. package/express/src/resources/src/pages/auth/resetPassword.vue +29 -37
  15. package/express/src/resources/src/pages/auth/verifyEmail.vue +15 -19
  16. package/express/src/resources/src/plugins/gum.ts +519 -203
  17. package/express/src/resources/src/stores/auth.ts +9 -6
  18. package/express/src/storage/database/nexwire.sqlite +0 -0
  19. package/fastify/.dockerignore +14 -0
  20. package/fastify/.env +44 -0
  21. package/fastify/.env.example +42 -0
  22. package/fastify/.vscode/extensions.json +6 -0
  23. package/fastify/.vscode/settings.json +37 -0
  24. package/fastify/LICENSE +21 -0
  25. package/fastify/README.md +232 -0
  26. package/fastify/biome.json +99 -0
  27. package/fastify/drizzle.config.ts +25 -0
  28. package/fastify/gitignore-stub +31 -0
  29. package/fastify/package.json +130 -0
  30. package/fastify/public/.gitkeep +0 -0
  31. package/fastify/src/config/app.ts +41 -0
  32. package/fastify/src/config/auth.ts +12 -0
  33. package/fastify/src/config/cache.ts +16 -0
  34. package/fastify/src/config/cookie.ts +15 -0
  35. package/fastify/src/config/cors.ts +12 -0
  36. package/fastify/src/config/database.ts +48 -0
  37. package/fastify/src/config/index.ts +83 -0
  38. package/fastify/src/config/jwt.ts +19 -0
  39. package/fastify/src/config/logging.ts +13 -0
  40. package/fastify/src/config/mail.ts +24 -0
  41. package/fastify/src/config/openapi.ts +36 -0
  42. package/fastify/src/config/queue.ts +30 -0
  43. package/fastify/src/config/rateLimit.ts +17 -0
  44. package/fastify/src/config/realtime.ts +15 -0
  45. package/fastify/src/config/redis.ts +18 -0
  46. package/fastify/src/config/security.ts +44 -0
  47. package/fastify/src/config/session.ts +17 -0
  48. package/fastify/src/config/storage.ts +22 -0
  49. package/fastify/src/config/validate.ts +50 -0
  50. package/fastify/src/database/migrations/sqlite/0000_init.sql +48 -0
  51. package/fastify/src/database/migrations/sqlite/meta/0000_snapshot.json +324 -0
  52. package/fastify/src/database/migrations/sqlite/meta/_journal.json +13 -0
  53. package/fastify/src/database/schema.ts +2 -0
  54. package/fastify/src/env.ts +76 -0
  55. package/fastify/src/framework/cache/cache.ts +114 -0
  56. package/fastify/src/framework/circuit-breaker/cb.ts +88 -0
  57. package/fastify/src/framework/database/app-schema.ts +37 -0
  58. package/fastify/src/framework/database/connection.ts +223 -0
  59. package/fastify/src/framework/database/migrate-hooks.ts +87 -0
  60. package/fastify/src/framework/database/paginate.ts +226 -0
  61. package/fastify/src/framework/database/schema.ts +20 -0
  62. package/fastify/src/framework/database/seed.ts +152 -0
  63. package/fastify/src/framework/events/dispatcher.ts +61 -0
  64. package/fastify/src/framework/facade.ts +96 -0
  65. package/fastify/src/framework/http/app.ts +176 -0
  66. package/fastify/src/framework/http/cors.ts +13 -0
  67. package/fastify/src/framework/http/fastify.d.ts +13 -0
  68. package/fastify/src/framework/http/logger.ts +110 -0
  69. package/fastify/src/framework/http/metrics.ts +22 -0
  70. package/fastify/src/framework/http/openapi.ts +48 -0
  71. package/fastify/src/framework/http/ratelimiter.ts +47 -0
  72. package/fastify/src/framework/http/security.ts +25 -0
  73. package/fastify/src/framework/http/static.ts +83 -0
  74. package/fastify/src/framework/http/validation.ts +49 -0
  75. package/fastify/src/framework/kernel.ts +43 -0
  76. package/fastify/src/framework/maker-cli/db/core.mjs +291 -0
  77. package/fastify/src/framework/maker-cli/db/index.mjs +204 -0
  78. package/fastify/src/framework/maker-cli/deploy/core.mjs +1046 -0
  79. package/fastify/src/framework/maker-cli/deploy/index.mjs +91 -0
  80. package/fastify/src/framework/maker-cli/index.mjs +65 -0
  81. package/fastify/src/framework/maker-cli/middleware/core.mjs +41 -0
  82. package/fastify/src/framework/maker-cli/middleware/index.mjs +17 -0
  83. package/fastify/src/framework/maker-cli/module/core.mjs +1066 -0
  84. package/fastify/src/framework/maker-cli/module/index.mjs +211 -0
  85. package/fastify/src/framework/maker-cli/provider/core.mjs +49 -0
  86. package/fastify/src/framework/maker-cli/provider/index.mjs +12 -0
  87. package/fastify/src/framework/maker-cli/runtime/build-ui.mjs +16 -0
  88. package/fastify/src/framework/maker-cli/runtime/core.mjs +560 -0
  89. package/fastify/src/framework/maker-cli/runtime/index.mjs +120 -0
  90. package/fastify/src/framework/maker-cli/runtime/redis-commander-patch.cjs +20 -0
  91. package/fastify/src/framework/maker-cli/stubs/controller/openapi.ts.stub +74 -0
  92. package/fastify/src/framework/maker-cli/stubs/controller/plain.ts.stub +77 -0
  93. package/fastify/src/framework/maker-cli/stubs/controller/standalone.ts.stub +51 -0
  94. package/fastify/src/framework/maker-cli/stubs/deploy/Dockerfile.bun.stub +52 -0
  95. package/fastify/src/framework/maker-cli/stubs/deploy/Dockerfile.pnpm.stub +55 -0
  96. package/fastify/src/framework/maker-cli/stubs/deploy/Dockerfile.stub +51 -0
  97. package/fastify/src/framework/maker-cli/stubs/deploy/Dockerfile.yarn.stub +55 -0
  98. package/fastify/src/framework/maker-cli/stubs/deploy/README.stub +59 -0
  99. package/fastify/src/framework/maker-cli/stubs/deploy/compose/mysql.server.stub +45 -0
  100. package/fastify/src/framework/maker-cli/stubs/deploy/compose/postgres.server.stub +45 -0
  101. package/fastify/src/framework/maker-cli/stubs/deploy/compose/sqlite.stub +45 -0
  102. package/fastify/src/framework/maker-cli/stubs/deploy/env/mysql.server.stub +68 -0
  103. package/fastify/src/framework/maker-cli/stubs/deploy/env/postgres.server.stub +68 -0
  104. package/fastify/src/framework/maker-cli/stubs/deploy/env/sqlite.stub +67 -0
  105. package/fastify/src/framework/maker-cli/stubs/deploy/scripts/auto-migrate.sh.stub +41 -0
  106. package/fastify/src/framework/maker-cli/stubs/deploy/server/README.stub +78 -0
  107. package/fastify/src/framework/maker-cli/stubs/deploy/server/compose/noredis.stub +120 -0
  108. package/fastify/src/framework/maker-cli/stubs/deploy/server/compose/redis.dev.stub +133 -0
  109. package/fastify/src/framework/maker-cli/stubs/deploy/server/compose/redis.stub +131 -0
  110. package/fastify/src/framework/maker-cli/stubs/deploy/server/env/local.example.stub +11 -0
  111. package/fastify/src/framework/maker-cli/stubs/deploy/server/env/noredis.stub +25 -0
  112. package/fastify/src/framework/maker-cli/stubs/deploy/server/env/redis.stub +25 -0
  113. package/fastify/src/framework/maker-cli/stubs/deploy/server/nginx-vhost/README.stub +16 -0
  114. package/fastify/src/framework/maker-cli/stubs/deploy/server/nginx-vhost/app.example.com.stub +13 -0
  115. package/fastify/src/framework/maker-cli/stubs/deploy/server/pgadmin/servers.stub +14 -0
  116. package/fastify/src/framework/maker-cli/stubs/deploy/server/redis/redis.conf.stub +7 -0
  117. package/fastify/src/framework/maker-cli/stubs/deploy/supervisor/noredis.stub +54 -0
  118. package/fastify/src/framework/maker-cli/stubs/deploy/supervisor/redis.stub +70 -0
  119. package/fastify/src/framework/maker-cli/stubs/deploy/workflow/local.json.stub +25 -0
  120. package/fastify/src/framework/maker-cli/stubs/deploy/workflow/remote.json.stub +24 -0
  121. package/fastify/src/framework/maker-cli/stubs/facade/name.ts.stub +12 -0
  122. package/fastify/src/framework/maker-cli/stubs/helper/name.ts.stub +14 -0
  123. package/fastify/src/framework/maker-cli/stubs/job/name.ts.stub +25 -0
  124. package/fastify/src/framework/maker-cli/stubs/middleware/name.local.ts.stub +15 -0
  125. package/fastify/src/framework/maker-cli/stubs/middleware/name.ts.stub +15 -0
  126. package/fastify/src/framework/maker-cli/stubs/model/name.mysql.ts.stub +10 -0
  127. package/fastify/src/framework/maker-cli/stubs/model/name.postgresql.ts.stub +10 -0
  128. package/fastify/src/framework/maker-cli/stubs/model/name.sqlite.ts.stub +10 -0
  129. package/fastify/src/framework/maker-cli/stubs/notification/controller.ts.stub +79 -0
  130. package/fastify/src/framework/maker-cli/stubs/notification/job.ts.stub +11 -0
  131. package/fastify/src/framework/maker-cli/stubs/notification/model.ts.stub +29 -0
  132. package/fastify/src/framework/maker-cli/stubs/notification/provider.ts.stub +174 -0
  133. package/fastify/src/framework/maker-cli/stubs/notification/route.api.ts.stub +71 -0
  134. package/fastify/src/framework/maker-cli/stubs/notification/route.plain.ts.stub +15 -0
  135. package/fastify/src/framework/maker-cli/stubs/notification/schema.plain.ts.stub +26 -0
  136. package/fastify/src/framework/maker-cli/stubs/notification/schema.ts.stub +26 -0
  137. package/fastify/src/framework/maker-cli/stubs/provider/module-barrel.ts.stub +19 -0
  138. package/fastify/src/framework/maker-cli/stubs/provider/module.ts.stub +21 -0
  139. package/fastify/src/framework/maker-cli/stubs/provider/name.ts.stub +21 -0
  140. package/fastify/src/framework/maker-cli/stubs/route/api.ts.stub +101 -0
  141. package/fastify/src/framework/maker-cli/stubs/route/plain.ts.stub +23 -0
  142. package/fastify/src/framework/maker-cli/stubs/route/standalone.api.ts.stub +120 -0
  143. package/fastify/src/framework/maker-cli/stubs/route/standalone.plain.ts.stub +50 -0
  144. package/fastify/src/framework/maker-cli/stubs/schedule/name.ts.stub +36 -0
  145. package/fastify/src/framework/maker-cli/stubs/schema/name.plain.ts.stub +14 -0
  146. package/fastify/src/framework/maker-cli/stubs/schema/name.ts.stub +33 -0
  147. package/fastify/src/framework/maker-cli/stubs/seeder/name.ts.stub +18 -0
  148. package/fastify/src/framework/maker-cli/stubs/seeder/standalone.ts.stub +22 -0
  149. package/fastify/src/framework/maker-cli/stubs/service/name.plain.ts.stub +67 -0
  150. package/fastify/src/framework/maker-cli/stubs/service/name.ts.stub +65 -0
  151. package/fastify/src/framework/maker-cli/stubs/test/unit.ts.stub +22 -0
  152. package/fastify/src/framework/maker-cli/stubs/type/name.ts.stub +22 -0
  153. package/fastify/src/framework/maker-cli/utils/env-config.mjs +44 -0
  154. package/fastify/src/framework/maker-cli/utils/env-db.mjs +61 -0
  155. package/fastify/src/framework/maker-cli/utils/file-ops.mjs +30 -0
  156. package/fastify/src/framework/maker-cli/utils/flags.mjs +14 -0
  157. package/fastify/src/framework/maker-cli/utils/help.mjs +379 -0
  158. package/fastify/src/framework/maker-cli/utils/naming.mjs +119 -0
  159. package/fastify/src/framework/maker-cli/utils/process.mjs +52 -0
  160. package/fastify/src/framework/maker-cli/utils/project-commands.mjs +201 -0
  161. package/fastify/src/framework/modules/discover.ts +57 -0
  162. package/fastify/src/framework/modules/routes.ts +31 -0
  163. package/fastify/src/framework/notification/channels/broadcast.ts +15 -0
  164. package/fastify/src/framework/notification/channels/mail.ts +42 -0
  165. package/fastify/src/framework/notification/contracts.ts +29 -0
  166. package/fastify/src/framework/notification/index.ts +59 -0
  167. package/fastify/src/framework/notification/registry.ts +15 -0
  168. package/fastify/src/framework/providers/adapter.ts +149 -0
  169. package/fastify/src/framework/providers/contracts.ts +126 -0
  170. package/fastify/src/framework/providers/loader.ts +105 -0
  171. package/fastify/src/framework/providers/registry.ts +88 -0
  172. package/fastify/src/framework/queue/clear.ts +22 -0
  173. package/fastify/src/framework/queue/queue.ts +401 -0
  174. package/fastify/src/framework/queue/ui.ts +194 -0
  175. package/fastify/src/framework/queue/worker.ts +61 -0
  176. package/fastify/src/framework/realtime/broadcast.ts +70 -0
  177. package/fastify/src/framework/realtime/index.ts +2 -0
  178. package/fastify/src/framework/realtime/socket-cookie.ts +72 -0
  179. package/fastify/src/framework/realtime/socket.ts +149 -0
  180. package/fastify/src/framework/realtime/types.ts +6 -0
  181. package/fastify/src/framework/realtime/ui.ts +16 -0
  182. package/fastify/src/framework/redis/client.ts +148 -0
  183. package/fastify/src/framework/runtime/runtime.ts +23 -0
  184. package/fastify/src/framework/runtime/server-adapter.ts +33 -0
  185. package/fastify/src/framework/scheduler/lock.ts +128 -0
  186. package/fastify/src/framework/scheduler/run.ts +48 -0
  187. package/fastify/src/framework/scheduler/scheduler.ts +155 -0
  188. package/fastify/src/framework/server.ts +162 -0
  189. package/fastify/src/framework/session/session.ts +160 -0
  190. package/fastify/src/framework/storage/storage.ts +744 -0
  191. package/fastify/src/framework/support/cookie.ts +71 -0
  192. package/fastify/src/framework/support/jwt.ts +33 -0
  193. package/fastify/src/framework/support/lifecycle.ts +35 -0
  194. package/fastify/src/framework/support/logger.ts +148 -0
  195. package/fastify/src/framework/support/mail.ts +56 -0
  196. package/fastify/src/framework/support/password.ts +23 -0
  197. package/fastify/src/framework/support/status-codes.ts +75 -0
  198. package/fastify/src/framework/support/upload.ts +181 -0
  199. package/fastify/src/framework/support/url.ts +41 -0
  200. package/fastify/src/middlewares/auth-middleware.ts +134 -0
  201. package/fastify/src/middlewares/role-middleware.ts +19 -0
  202. package/fastify/src/modules/auth/__tests__/forgetpass.test.ts +200 -0
  203. package/fastify/src/modules/auth/__tests__/login.test.ts +171 -0
  204. package/fastify/src/modules/auth/__tests__/logout.test.ts +60 -0
  205. package/fastify/src/modules/auth/__tests__/logoutalldevices.test.ts +49 -0
  206. package/fastify/src/modules/auth/__tests__/me.test.ts +91 -0
  207. package/fastify/src/modules/auth/__tests__/refreshtoken.test.ts +305 -0
  208. package/fastify/src/modules/auth/__tests__/register.test.ts +291 -0
  209. package/fastify/src/modules/auth/__tests__/resetpass.test.ts +206 -0
  210. package/fastify/src/modules/auth/__tests__/verifyemail.test.ts +183 -0
  211. package/fastify/src/modules/auth/controllers/auth.ts +252 -0
  212. package/fastify/src/modules/auth/controllers/role.ts +35 -0
  213. package/fastify/src/modules/auth/database/models/role.ts +14 -0
  214. package/fastify/src/modules/auth/database/models/user.ts +46 -0
  215. package/fastify/src/modules/auth/database/seeders/role.ts +18 -0
  216. package/fastify/src/modules/auth/database/seeders/user.ts +35 -0
  217. package/fastify/src/modules/auth/facade.ts +12 -0
  218. package/fastify/src/modules/auth/helpers/auth.ts +115 -0
  219. package/fastify/src/modules/auth/jobs/forgetpass.ts +20 -0
  220. package/fastify/src/modules/auth/jobs/registeruser.ts +23 -0
  221. package/fastify/src/modules/auth/jobs/verifyemail.ts +18 -0
  222. package/fastify/src/modules/auth/routes/index.ts +185 -0
  223. package/fastify/src/modules/auth/routes/role.ts +56 -0
  224. package/fastify/src/modules/auth/schemas/auth.ts +116 -0
  225. package/fastify/src/modules/auth/services/forgetpassword.ts +66 -0
  226. package/fastify/src/modules/auth/services/login.ts +63 -0
  227. package/fastify/src/modules/auth/services/logout.ts +25 -0
  228. package/fastify/src/modules/auth/services/logoutalldevices.ts +19 -0
  229. package/fastify/src/modules/auth/services/me.ts +31 -0
  230. package/fastify/src/modules/auth/services/refreshtoken.ts +110 -0
  231. package/fastify/src/modules/auth/services/register.ts +141 -0
  232. package/fastify/src/modules/auth/services/resetpassword.ts +69 -0
  233. package/fastify/src/modules/auth/services/verifyemail.ts +77 -0
  234. package/fastify/src/modules/auth/types/auth.ts +31 -0
  235. package/fastify/src/providers/README.md +107 -0
  236. package/fastify/src/providers/notification.ts +4 -0
  237. package/fastify/src/resources/index.html +17 -0
  238. package/fastify/src/resources/src/App.vue +5 -0
  239. package/fastify/src/resources/src/assets/css/styles.css +14761 -0
  240. package/fastify/src/resources/src/assets/css/styles.css.map +1 -0
  241. package/fastify/src/resources/src/assets/fonts/public-sans/public-sans-latin-ext.woff2 +0 -0
  242. package/fastify/src/resources/src/assets/fonts/public-sans/public-sans-latin.woff2 +0 -0
  243. package/fastify/src/resources/src/assets/images/favicon/favicon.ico +0 -0
  244. package/fastify/src/resources/src/assets/images/logo.png +0 -0
  245. package/fastify/src/resources/src/assets/scss/custom.css +217 -0
  246. package/fastify/src/resources/src/assets/scss/custom.css.map +1 -0
  247. package/fastify/src/resources/src/assets/scss/custom.scss +1346 -0
  248. package/fastify/src/resources/src/components/Button.vue +32 -0
  249. package/fastify/src/resources/src/components/Checkbox.vue +32 -0
  250. package/fastify/src/resources/src/components/Datepicker.vue +106 -0
  251. package/fastify/src/resources/src/components/FeatureButton.vue +53 -0
  252. package/fastify/src/resources/src/components/FloatButton.vue +33 -0
  253. package/fastify/src/resources/src/components/Href.vue +32 -0
  254. package/fastify/src/resources/src/components/Input.vue +243 -0
  255. package/fastify/src/resources/src/components/InputGroup.vue +147 -0
  256. package/fastify/src/resources/src/components/InputPasswordToggle.vue +229 -0
  257. package/fastify/src/resources/src/components/Modal.vue +71 -0
  258. package/fastify/src/resources/src/components/Pagebar.vue +26 -0
  259. package/fastify/src/resources/src/components/Refresh.vue +19 -0
  260. package/fastify/src/resources/src/components/Select.vue +384 -0
  261. package/fastify/src/resources/src/components/Spinner.vue +42 -0
  262. package/fastify/src/resources/src/components/Switch.vue +60 -0
  263. package/fastify/src/resources/src/components/TextArea.vue +117 -0
  264. package/fastify/src/resources/src/components/Toast.vue +56 -0
  265. package/fastify/src/resources/src/components/datatable/DataTableSkeleton.vue +98 -0
  266. package/fastify/src/resources/src/components/datatable/Pagination.vue +147 -0
  267. package/fastify/src/resources/src/components/datatable/SelectOpption.vue +64 -0
  268. package/fastify/src/resources/src/components/datatable/index.vue +199 -0
  269. package/fastify/src/resources/src/composables/useAuth.ts +52 -0
  270. package/fastify/src/resources/src/helpers/assets.ts +51 -0
  271. package/fastify/src/resources/src/helpers/nformatter.ts +10 -0
  272. package/fastify/src/resources/src/helpers/utils.ts +75 -0
  273. package/fastify/src/resources/src/layouts/AuthLayout.vue +20 -0
  274. package/fastify/src/resources/src/layouts/Layout/Footer.vue +23 -0
  275. package/fastify/src/resources/src/layouts/Layout/Header.vue +124 -0
  276. package/fastify/src/resources/src/layouts/Layout/Sidebar.vue +137 -0
  277. package/fastify/src/resources/src/layouts/Layout/index.vue +87 -0
  278. package/fastify/src/resources/src/main.ts +28 -0
  279. package/fastify/src/resources/src/pages/auth/forgetPassword.vue +76 -0
  280. package/fastify/src/resources/src/pages/auth/login.vue +96 -0
  281. package/fastify/src/resources/src/pages/auth/register.vue +129 -0
  282. package/fastify/src/resources/src/pages/auth/resetPassword.vue +110 -0
  283. package/fastify/src/resources/src/pages/auth/verifyEmail.vue +64 -0
  284. package/fastify/src/resources/src/pages/dashboard/index.vue +66 -0
  285. package/fastify/src/resources/src/plugins/axios.ts +31 -0
  286. package/fastify/src/resources/src/plugins/browserDetect.ts +55 -0
  287. package/fastify/src/resources/src/plugins/dialog.ts +216 -0
  288. package/fastify/src/resources/src/plugins/gum.ts +683 -0
  289. package/fastify/src/resources/src/plugins/pulse.ts +157 -0
  290. package/fastify/src/resources/src/plugins/routeProgress.ts +87 -0
  291. package/fastify/src/resources/src/router/index.ts +85 -0
  292. package/fastify/src/resources/src/stores/admin-ui.ts +148 -0
  293. package/fastify/src/resources/src/stores/auth.ts +187 -0
  294. package/fastify/src/resources/tsconfig.json +19 -0
  295. package/fastify/src/resources/vite.config.ts +64 -0
  296. package/fastify/src/storage/app/private/.gitkeep +0 -0
  297. package/fastify/src/storage/app/public/.gitkeep +0 -0
  298. package/fastify/src/storage/app/tmp/generated/.gitkeep +0 -0
  299. package/fastify/src/storage/database/nexwire.sqlite +0 -0
  300. package/fastify/src/storage/logs/.gitkeep +0 -0
  301. package/fastify/src/storage/logs/app.log +0 -0
  302. package/fastify/src/storage/logs/fatal.log +0 -0
  303. package/fastify/src/storage/tmp/.gitkeep +0 -0
  304. package/fastify/src/storage/trash/modules/.gitkeep +0 -0
  305. package/fastify/src/types/global.d.ts +32 -0
  306. package/fastify/tsconfig.json +19 -0
  307. package/fastify/vitest.config.ts +38 -0
  308. package/hono/src/framework/facade.ts +1 -0
  309. package/hono/src/framework/http/logger.ts +86 -81
  310. package/hono/src/framework/maker-cli/runtime/core.mjs +1 -2
  311. package/hono/src/framework/notification/channels/mail.ts +8 -6
  312. package/hono/src/middlewares/auth-middleware.ts +1 -2
  313. package/hono/src/middlewares/role-middleware.ts +3 -13
  314. package/hono/src/modules/auth/routes/index.ts +1 -2
  315. package/hono/src/providers/notification.ts +2 -2
  316. package/hono/src/resources/src/components/Switch.vue +60 -65
  317. package/hono/src/resources/src/pages/auth/forgetPassword.vue +23 -29
  318. package/hono/src/resources/src/pages/auth/login.vue +26 -29
  319. package/hono/src/resources/src/pages/auth/register.vue +36 -40
  320. package/hono/src/resources/src/pages/auth/resetPassword.vue +29 -37
  321. package/hono/src/resources/src/pages/auth/verifyEmail.vue +15 -19
  322. package/hono/src/resources/src/plugins/gum.ts +519 -203
  323. package/hono/src/resources/src/stores/auth.ts +9 -6
  324. package/hono/src/storage/database/nexwire.sqlite +0 -0
  325. package/package.json +3 -2
  326. package/src/index.js +11 -8
@@ -0,0 +1,32 @@
1
+ <template>
2
+ <button class="shadow-none" :type="props.type" v-bind="$attrs">
3
+ <slot v-if="hasDefaultSlot"></slot>
4
+ <template v-else>
5
+ <span v-if="props.label" class="text-capitalize" :class="{ 'me-1': props.icon }">
6
+ {{ props.label }}
7
+ </span>
8
+ <span v-if="props.icon"><i :class="props.icon"></i></span>
9
+ </template>
10
+ </button>
11
+ </template>
12
+
13
+ <script setup lang="ts">
14
+ import { computed, useSlots } from "vue";
15
+
16
+ interface ButtonProps {
17
+ label?: string;
18
+ icon?: string;
19
+ type?: "button" | "submit" | "reset";
20
+ }
21
+
22
+ defineOptions({ name: "Button", inheritAttrs: false });
23
+
24
+ const slots = useSlots();
25
+ const props = withDefaults(defineProps<ButtonProps>(), {
26
+ type: "button"
27
+ });
28
+
29
+ const hasDefaultSlot = computed(() => Boolean(slots.default?.().length));
30
+ </script>
31
+
32
+ <style lang="scss" scoped></style>
@@ -0,0 +1,32 @@
1
+ <template>
2
+ <div class="form-check mb-0" :class="props.topclass">
3
+ <input
4
+ :id="String(props.id)"
5
+ v-model="model"
6
+ class="form-check-input shadow-none"
7
+ type="checkbox"
8
+ v-bind="$attrs"
9
+ />
10
+ <label v-if="props.label" class="form-check-label" :for="String(props.id)">{{
11
+ props.label
12
+ }}</label>
13
+ </div>
14
+ </template>
15
+
16
+ <script setup lang="ts">
17
+ defineOptions({ name: "Checkbox", inheritAttrs: false });
18
+
19
+ interface CheckboxProps {
20
+ id?: string | number;
21
+ label?: string;
22
+ topclass?: string;
23
+ }
24
+
25
+ const props = defineProps<CheckboxProps>();
26
+
27
+ type CheckboxModel = boolean | Array<string | number>;
28
+
29
+ const model = defineModel<CheckboxModel>({ default: false });
30
+ </script>
31
+
32
+ <style lang="scss" scoped></style>
@@ -0,0 +1,106 @@
1
+ <template>
2
+ <div :class="parentClass">
3
+ <label class="text-capitalize d-flex align-items-center mb-1" :class="{ 'd-none': !inputLabel }">
4
+ <div class="position-relative">
5
+ <span class="text-capitalize" v-html="inputLabel"></span>
6
+ <span class="position-absolute text-danger rounded-circle bg-danger must" :class="{ 'd-none': !props.must }"></span>
7
+ </div>
8
+ <div class="text-uppercase w-100 text-end text-primary fw-semibold" :class="{ 'd-none': !props.hood }" style="font-size: 12px; margin-top: 0.15rem" v-html="hoodHtml"></div>
9
+ </label>
10
+ <VueDatePicker
11
+ v-if="usePicker"
12
+ v-model="model"
13
+ :month-picker="props.mode === 'month'"
14
+ :year-picker="props.mode === 'year'"
15
+ :time-picker="props.mode === 'datetime'"
16
+ :time-config="timeConfig"
17
+ :formats="formats"
18
+ text-input
19
+ v-bind="$attrs"></VueDatePicker>
20
+ <input
21
+ v-else
22
+ type="month"
23
+ class="form-control"
24
+ :value="nativeValue"
25
+ :disabled="Boolean($attrs.disabled)"
26
+ :readonly="Boolean($attrs.readonly)"
27
+ @input="onNativeInput" />
28
+ <div class="form-text text-danger" :class="{ 'd-none': !props.err }" style="font-size: 0.8rem">
29
+ {{ props.err }}
30
+ </div>
31
+ </div>
32
+ </template>
33
+
34
+ <script setup lang="ts">
35
+ import { VueDatePicker } from "@vuepic/vue-datepicker";
36
+ import { computed, useAttrs } from "vue";
37
+ import "@vuepic/vue-datepicker/dist/main.css";
38
+ import { browserDetect } from "@/plugins/browserDetect";
39
+
40
+ defineOptions({ name: "Datepicker", inheritAttrs: false });
41
+
42
+ type DateMode = "date" | "datetime" | "month" | "year";
43
+ type DateValue = string | number | Date | null;
44
+
45
+ interface DateProps {
46
+ must?: boolean;
47
+ err?: string | boolean;
48
+ hood?: string | boolean;
49
+ mode?: DateMode;
50
+ }
51
+
52
+ const $attrs = useAttrs();
53
+ const props = withDefaults(defineProps<DateProps>(), {
54
+ err: false,
55
+ mode: "date"
56
+ });
57
+
58
+ const model = defineModel<DateValue>();
59
+
60
+ const usePicker = computed(() => browserDetect.isFirefox.value || props.mode !== "month");
61
+
62
+ const nativeValue = computed(() => {
63
+ const value = model.value;
64
+ if (typeof value === "string") return value;
65
+ if (value instanceof Date && !Number.isNaN(value.getTime())) {
66
+ const year = value.getFullYear();
67
+ const month = String(value.getMonth() + 1).padStart(2, "0");
68
+ return `${year}-${month}`;
69
+ }
70
+ return "";
71
+ });
72
+
73
+ const onNativeInput = (e: Event) => {
74
+ model.value = (e.target as HTMLInputElement).value || null;
75
+ };
76
+
77
+ const parentClass = computed(() => ($attrs.parentclass as string | undefined) || "mb-2");
78
+ const inputLabel = computed(() => ($attrs.label as string | undefined) || "");
79
+
80
+ const hoodHtml = computed(() => (props.hood === false || props.hood == null ? "" : String(props.hood)));
81
+
82
+ const timeConfig = computed(() => (props.mode === "datetime" ? { is24: false } : undefined));
83
+
84
+ const formats = computed(() => {
85
+ switch (props.mode) {
86
+ case "year":
87
+ return { input: "yyyy" };
88
+ case "month":
89
+ return { input: "MM/yyyy" };
90
+ case "datetime":
91
+ return { input: "dd/MM/yyyy hh:mm a" };
92
+ default:
93
+ return { input: "dd/MM/yyyy" };
94
+ }
95
+ });
96
+ </script>
97
+
98
+ <style lang="scss" scoped>
99
+ .must {
100
+ width: 4px;
101
+ height: 4px;
102
+ top: 0;
103
+ margin-top: 5px;
104
+ margin-left: 2px;
105
+ }
106
+ </style>
@@ -0,0 +1,53 @@
1
+ <template></template>
2
+
3
+ <script setup lang="ts">
4
+ import { inject, onBeforeUnmount, onMounted, useAttrs, useSlots } from "vue";
5
+
6
+ defineOptions({ name: "FeatureButton", inheritAttrs: false });
7
+
8
+ const props = defineProps<{
9
+ icon?: string;
10
+ label?: string;
11
+ title?: string;
12
+ buttonClass?: any;
13
+ }>();
14
+
15
+ const emit = defineEmits<(e: "click") => void>();
16
+
17
+ interface ButtonEntry {
18
+ id: symbol;
19
+ icon?: string;
20
+ label: string;
21
+ title: string;
22
+ attrs?: Record<string, string>;
23
+ class?: any;
24
+ onClick: () => void;
25
+ render?: () => any[];
26
+ }
27
+
28
+ const featureButtons = inject<ButtonEntry[]>("featureButtons")!;
29
+ const slots = useSlots();
30
+ const fallthroughAttrs = useAttrs();
31
+
32
+ const id = Symbol();
33
+
34
+ onMounted(() => {
35
+ featureButtons.push({
36
+ id,
37
+ icon: props.icon,
38
+ label: props.label ?? "",
39
+ title: props.title ?? props.label ?? "",
40
+ attrs: fallthroughAttrs as any,
41
+ class: props.buttonClass,
42
+ onClick: () => emit("click"),
43
+ render: slots.default || undefined
44
+ });
45
+ });
46
+
47
+ onBeforeUnmount(() => {
48
+ const index = featureButtons.findIndex((b) => b.id === id);
49
+ if (index !== -1) featureButtons.splice(index, 1);
50
+ });
51
+ </script>
52
+
53
+ <style lang="scss" scoped></style>
@@ -0,0 +1,33 @@
1
+ <template>
2
+ <div class="float-button position-fixed text-center removeprintarea" :style="floatStyle" v-bind="$attrs">
3
+ <slot></slot>
4
+ </div>
5
+ </template>
6
+
7
+ <script setup lang="ts">
8
+ import { computed } from "vue";
9
+
10
+ interface FloatButtonProps {
11
+ top?: string;
12
+ right?: string;
13
+ zIndex?: number;
14
+ }
15
+
16
+ const props = withDefaults(defineProps<FloatButtonProps>(), {
17
+ top: "200px",
18
+ right: "0",
19
+ zIndex: 100
20
+ });
21
+
22
+ const floatStyle = computed(() => ({
23
+ top: props.top,
24
+ right: props.right,
25
+ zIndex: props.zIndex
26
+ }));
27
+ </script>
28
+
29
+ <style lang="scss" scoped>
30
+ .float-button {
31
+ border-radius: 0 5px 5px 5px;
32
+ }
33
+ </style>
@@ -0,0 +1,32 @@
1
+ <template>
2
+ <a :href="String(props.to)" class="d-flex align-items-center" v-bind="$attrs">
3
+ <slot v-if="hasDefaultSlot"></slot>
4
+ <template v-else>
5
+ <span v-if="props.label" class="text-capitalize" :class="{ 'me-1': props.icon }">{{
6
+ props.label
7
+ }}</span>
8
+ <span v-if="props.icon"><i :class="props.icon"></i></span>
9
+ </template>
10
+ </a>
11
+ </template>
12
+
13
+ <script setup lang="ts">
14
+ import { computed, useSlots } from "vue";
15
+
16
+ interface HrefProps {
17
+ label?: string;
18
+ icon?: string;
19
+ to?: string | number;
20
+ }
21
+
22
+ defineOptions({ name: "Href", inheritAttrs: false });
23
+
24
+ const slots = useSlots();
25
+ const props = withDefaults(defineProps<HrefProps>(), {
26
+ to: "#"
27
+ });
28
+
29
+ const hasDefaultSlot = computed(() => Boolean(slots.default?.().length));
30
+ </script>
31
+
32
+ <style lang="scss" scoped></style>
@@ -0,0 +1,243 @@
1
+ <template>
2
+ <div :class="topclass">
3
+ <div class="position-relative">
4
+ <label
5
+ :for="inputId"
6
+ class="d-flex align-items-center mb-1"
7
+ :class="{ 'd-none': !inputLabel }"
8
+ >
9
+ <div class="position-relative">
10
+ <span class="text-capitalize" v-html="inputLabel"></span>
11
+ <span
12
+ class="position-absolute text-danger rounded-circle bg-danger must"
13
+ :class="{ 'd-none': !props.must }"
14
+ ></span>
15
+ </div>
16
+ <div
17
+ class="text-end ms-auto text-primary fw-semibold"
18
+ :class="{ 'd-none': !props.hood }"
19
+ style="font-size: 12px; margin-top: 0.15rem"
20
+ v-html="hoodHtml"
21
+ ></div>
22
+ </label>
23
+ <input
24
+ ref="inputRef"
25
+ class="form-control shadow-none"
26
+ :value="props.modelValue"
27
+ :maxlength="maxLengthAttr"
28
+ :readonly="props.readonly"
29
+ v-bind="$attrs"
30
+ :autocomplete="inputAutocomplete"
31
+ @input="updateModel"
32
+ />
33
+ <div
34
+ class="position-absolute bottom-0 end-0 pe-1 text-secondary max"
35
+ :class="{ 'd-none': !max }"
36
+ >
37
+ {{ maxCounter }}
38
+ </div>
39
+ </div>
40
+ <div
41
+ :id="`${inputId}Help`"
42
+ class="form-text mt-1 text-danger"
43
+ :class="{ 'd-none': !props.err }"
44
+ >
45
+ {{ props.err }}
46
+ </div>
47
+ </div>
48
+ </template>
49
+
50
+ <script setup lang="ts">
51
+ import { computed, nextTick, onMounted, ref, useAttrs } from "vue";
52
+ import { browserDetect } from "@/plugins/browserDetect";
53
+
54
+ defineOptions({ name: "Input", inheritAttrs: false });
55
+
56
+ const { isFirefox } = browserDetect;
57
+
58
+ const $attrs = useAttrs();
59
+ const inputRef = ref<HTMLInputElement | null>(null);
60
+ type InputCategory =
61
+ | "number"
62
+ | "decimal"
63
+ | "+decimal-"
64
+ | "mobile"
65
+ | "tax-period"
66
+ | "bin"
67
+ | "challan-number"
68
+ | string;
69
+
70
+ interface InputProps {
71
+ focus?: boolean;
72
+ must?: boolean;
73
+ err?: string | boolean;
74
+ modelValue?: string | number;
75
+ category?: InputCategory;
76
+ hood?: string | boolean | number;
77
+ readonly?: boolean;
78
+ }
79
+
80
+ const props = withDefaults(defineProps<InputProps>(), {
81
+ err: false,
82
+ modelValue: "",
83
+ });
84
+
85
+ const topclass = computed(() => ($attrs.topclass as string | undefined) || "mb-2");
86
+ const inputId = computed(() => ($attrs.id as string | undefined) || "");
87
+ const inputLabel = computed(() => ($attrs.label as string | undefined) || "");
88
+ const inputType = computed(() => ($attrs.type as string | undefined) || "text");
89
+
90
+ const max = computed<number | null>(() => {
91
+ const raw = $attrs.maxlength as string | number | undefined;
92
+ return raw != null ? Number(raw) : null;
93
+ });
94
+
95
+ const inputAutocomplete = computed(() => {
96
+ const attrAutocomplete = $attrs.autocomplete as string | undefined;
97
+ if (attrAutocomplete) {
98
+ return attrAutocomplete;
99
+ }
100
+ return ["number", "decimal"].includes(props.category ?? "") ? "off" : "on";
101
+ });
102
+
103
+ const maxLengthAttr = computed<number | undefined>(() => max.value ?? undefined);
104
+
105
+ const hoodHtml = computed(() =>
106
+ props.hood === false || props.hood == null ? "" : String(props.hood),
107
+ );
108
+
109
+ const maxCounter = computed(() => {
110
+ if (max.value == null) {
111
+ return "";
112
+ }
113
+
114
+ if (!isFirefox && inputType.value === "month") {
115
+ return "";
116
+ }
117
+
118
+ return max.value - String(props.modelValue).length;
119
+ });
120
+
121
+ const emit = defineEmits<(event: "update:modelValue", value: string | number) => void>();
122
+ const updateModel = (e: Event) => {
123
+ const target = e.target as HTMLInputElement;
124
+
125
+ if (props.category === "number") {
126
+ emit("update:modelValue", (target.value = target.value.replace(/[^\d]/gi, "")));
127
+ } else if (props.category === "decimal") {
128
+ let val = target.value;
129
+
130
+ // Remove everything except digits, decimal point, and minus sign
131
+ val = val.replace(/[^0-9.]/g, "");
132
+
133
+ // Allow only one decimal point
134
+ const parts = val.split(".");
135
+ if (parts.length > 2) {
136
+ val = `${parts[0]}.${parts.slice(1).join("")}`;
137
+ }
138
+
139
+ emit("update:modelValue", (target.value = val));
140
+ } else if (props.category === "+decimal-") {
141
+ let val = target.value;
142
+
143
+ // Remove everything except digits, decimal point, and minus sign
144
+ val = val.replace(/[^0-9.-]/g, ""); // if need minus sign
145
+
146
+ // Move minus sign to the front if it exists anywhere
147
+ const isNegative = val.includes("-");
148
+ val = val.replace(/-/g, ""); // remove all minus signs
149
+ if (isNegative) {
150
+ val = `-${val}`;
151
+ }
152
+
153
+ // Allow only one decimal point
154
+ const parts = val.split(".");
155
+ if (parts.length > 2) {
156
+ val = `${parts[0]}.${parts.slice(1).join("")}`;
157
+ }
158
+
159
+ emit("update:modelValue", (target.value = val));
160
+ } else if (props.category === "mobile") {
161
+ let digits = target.value.replace(/[^\d]/g, ""); // only digits
162
+ let val = digits;
163
+ if (target.value.includes("+")) {
164
+ val = `+${digits}`;
165
+ }
166
+ emit("update:modelValue", (target.value = val));
167
+ } else if (props.category === "tax-period") {
168
+ let val = target.value.replace(/[^\d-]/g, ""); // Only numbers and hyphen
169
+ val = val.replace(/-/g, ""); // Remove all hyphens
170
+ val = val.slice(0, 6); // Only 6 digits (YYYYMM)
171
+
172
+ if (val.length > 4) {
173
+ let year = val.slice(0, 4);
174
+ let month = val.slice(4, 6);
175
+
176
+ // Only correct if both month digits entered
177
+ if (month.length === 2) {
178
+ let m = parseInt(month, 10);
179
+ // Clamp month between 1 and 12
180
+ if (m < 1) m = 1;
181
+ if (m > 12) m = 12;
182
+ // Always pad to 2 digits
183
+ month = m.toString().padStart(2, "0");
184
+ }
185
+
186
+ val = `${year}-${month}`;
187
+ }
188
+
189
+ emit("update:modelValue", (target.value = val));
190
+ } else if (props.category === "bin") {
191
+ let digits = target.value.replace(/[^\d]/g, "");
192
+ digits = digits.slice(0, 14);
193
+ let formatted = digits;
194
+ if (digits.length > 9) {
195
+ formatted = `${digits.slice(0, 9)}-${digits.slice(9, 14)}`;
196
+ }
197
+ emit("update:modelValue", (target.value = formatted));
198
+ } else if (props.category === "echallan-number") {
199
+ // Format: V + 9 digits (V000517226)
200
+ let raw = (target.value || "").toUpperCase();
201
+
202
+ // keep only digits, but allow V (we’ll force V at start)
203
+ let digits = raw.replace(/[^\d]/g, "").slice(0, 9);
204
+
205
+ // always prefix V
206
+ let formatted = `V${digits}`;
207
+
208
+ emit("update:modelValue", (target.value = formatted));
209
+ } else if (props.category === "challan-number") {
210
+ let digits = target.value.replace(/[^\d]/g, "");
211
+ digits = digits.slice(0, 16);
212
+ let formatted = digits;
213
+ if (digits.length > 4) {
214
+ formatted = `${digits.slice(0, 4)}-${digits.slice(4, 16)}`;
215
+ }
216
+ emit("update:modelValue", (target.value = formatted));
217
+ } else {
218
+ emit("update:modelValue", target.value);
219
+ }
220
+ };
221
+
222
+ onMounted(async () => {
223
+ const shouldFocus = props.focus !== false && props.focus !== undefined;
224
+ if (!shouldFocus) return;
225
+
226
+ await nextTick();
227
+ // preventScroll: focusing inside a modal must not scroll the modal/page
228
+ inputRef.value?.focus({ preventScroll: true });
229
+ });
230
+ </script>
231
+
232
+ <style lang="scss" scoped>
233
+ .must {
234
+ width: 4px;
235
+ height: 4px;
236
+ margin-left: 2px;
237
+ margin-top: 5px;
238
+ }
239
+
240
+ .max {
241
+ font-size: 0.6rem;
242
+ }
243
+ </style>
@@ -0,0 +1,147 @@
1
+ <template>
2
+ <div :class="topclass">
3
+ <div class="position-relative">
4
+ <label
5
+ :for="inputId"
6
+ class="text-capitalize d-flex align-items-center mb-1"
7
+ :class="{ 'd-none': !inputLabel }">
8
+ <div class="position-relative">
9
+ <span class="text-capitalize" v-html="inputLabel"></span>
10
+ <span
11
+ class="position-absolute text-danger rounded-circle bg-danger must"
12
+ :class="{ 'd-none': !props.must }"></span>
13
+ </div>
14
+ <div
15
+ :class="hoodClass"
16
+ style="font-size: 12px; margin-top: 0.15rem"
17
+ v-html="hoodHtml"></div>
18
+ </label>
19
+ <div class="input-group">
20
+ <div class="position-relative" :style="props.half ? 'width: 50%;' : 'width: 35%;'">
21
+ <input
22
+ ref="inputRef"
23
+ :id="inputId"
24
+ type="text"
25
+ class="form-control flex-grow-0 px-1 text-center rounded-0 rounded-start"
26
+ :maxlength="maxLengthAttr"
27
+ :value="props.modelValue"
28
+ v-bind="$attrs"
29
+ @input="updateModel" />
30
+ <div
31
+ class="position-absolute bottom-0 end-0 pe-1 text-secondary max"
32
+ :class="{ 'd-none': !max }">
33
+ {{ maxCounter }}
34
+ </div>
35
+ </div>
36
+ <input
37
+ type="text"
38
+ class="form-control text-center border-start second-input"
39
+ :style="props.half ? 'width: 50%;' : 'width: 62%;'"
40
+ :placeholder="placeholder1"
41
+ :value="props.calcdata"
42
+ readonly />
43
+ </div>
44
+ </div>
45
+ <div :id="`${inputId}Help`" class="form-text text-danger" :class="{ 'd-none': !props.err }">
46
+ {{ props.err }}
47
+ </div>
48
+ </div>
49
+ </template>
50
+
51
+ <script setup lang="ts">
52
+ import { computed, nextTick, onMounted, ref, useAttrs } from "vue";
53
+
54
+ defineOptions({ name: "InputGroup", inheritAttrs: false });
55
+
56
+ type InputGroupCategory = "number" | "decimal" | "mobile" | string;
57
+
58
+ interface InputGroupProps {
59
+ focus?: boolean;
60
+ must?: boolean;
61
+ half?: boolean;
62
+ err?: string | boolean;
63
+ modelValue?: string | number;
64
+ category?: InputGroupCategory;
65
+ calcdata?: string | number;
66
+ hood?: string | number | boolean;
67
+ }
68
+
69
+ const $attrs = useAttrs();
70
+ const inputRef = ref<HTMLInputElement | null>(null);
71
+ const props = withDefaults(defineProps<InputGroupProps>(), {
72
+ err: false,
73
+ modelValue: "",
74
+ calcdata: ""
75
+ });
76
+
77
+ const topclass = computed(() => ($attrs.topclass as string | undefined) || "mb-3");
78
+ const inputId = computed(() => ($attrs.id as string | undefined) || "");
79
+ const inputLabel = computed(() => ($attrs.label as string | undefined) || "");
80
+ const placeholder1 = computed(() => ($attrs.placeholder1 as string | undefined) || "");
81
+
82
+ const max = computed<number | null>(() => {
83
+ const raw = $attrs.maxlength as string | number | undefined;
84
+ return raw != null ? Number(raw) : null;
85
+ });
86
+
87
+ const maxLengthAttr = computed<number | undefined>(() => max.value ?? undefined);
88
+ const maxCounter = computed(() => (max.value == null ? "" : max.value - String(props.modelValue).length));
89
+
90
+ const hoodHtml = computed(() => (props.hood === false || props.hood == null ? "" : String(props.hood)));
91
+ const hoodClass = computed(() => [
92
+ "text-uppercase w-50 text-end text-primary fw-semibold",
93
+ props.half ? "w-50" : "w-100",
94
+ !props.hood && "d-none"
95
+ ]);
96
+
97
+ const emit = defineEmits<(event: "update:modelValue", value: string | number) => void>();
98
+
99
+ const updateModel = (e: Event) => {
100
+ const target = e.target as HTMLInputElement;
101
+
102
+ if (props.category === "number") {
103
+ emit("update:modelValue", (target.value = target.value.replace(/[^\d]/gi, "")));
104
+ } else if (props.category === "decimal") {
105
+ let val = target.value;
106
+ val = val.replace(/[^0-9.]/g, "");
107
+
108
+ const parts = val.split(".");
109
+ if (parts.length > 2) {
110
+ val = `${parts[0]}.${parts.slice(1).join("")}`;
111
+ }
112
+
113
+ emit("update:modelValue", (target.value = val));
114
+ } else if (props.category === "mobile") {
115
+ const digits = target.value.replace(/[^\d]/g, "");
116
+ let val = digits;
117
+ if (target.value.includes("+")) {
118
+ val = `+${digits}`;
119
+ }
120
+ emit("update:modelValue", (target.value = val));
121
+ } else {
122
+ emit("update:modelValue", target.value);
123
+ }
124
+ };
125
+
126
+ onMounted(async () => {
127
+ const shouldFocus = props.focus !== false && props.focus !== undefined;
128
+ if (!shouldFocus) return;
129
+
130
+ await nextTick();
131
+ // preventScroll: focusing inside a modal must not scroll the modal/page
132
+ inputRef.value?.focus({ preventScroll: true });
133
+ });
134
+ </script>
135
+
136
+ <style lang="scss" scoped>
137
+ .must {
138
+ width: 4px;
139
+ height: 4px;
140
+ margin-left: 2px;
141
+ margin-top: 5px;
142
+ }
143
+
144
+ .max {
145
+ font-size: 0.6rem;
146
+ }
147
+ </style>