@ramathibodi/nuxt-commons 0.1.73 → 4.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 (260) hide show
  1. package/README.md +81 -55
  2. package/dist/module.json +4 -4
  3. package/dist/module.mjs +5 -4
  4. package/dist/runtime/bridges/authentication.d.ts +21 -0
  5. package/dist/runtime/bridges/authentication.js +20 -0
  6. package/dist/runtime/bridges/graphql.d.ts +17 -0
  7. package/dist/runtime/bridges/graphql.js +45 -0
  8. package/dist/runtime/components/Alert.d.vue.ts +3 -0
  9. package/dist/runtime/components/Alert.vue +17 -22
  10. package/dist/runtime/components/Alert.vue.d.ts +3 -0
  11. package/dist/runtime/components/BarcodeReader.d.vue.ts +9 -0
  12. package/dist/runtime/components/BarcodeReader.vue +56 -73
  13. package/dist/runtime/components/BarcodeReader.vue.d.ts +9 -0
  14. package/dist/runtime/components/ExportCSV.d.vue.ts +55 -0
  15. package/dist/runtime/components/ExportCSV.vue +39 -68
  16. package/dist/runtime/components/ExportCSV.vue.d.ts +55 -0
  17. package/dist/runtime/components/FileBtn.d.vue.ts +53 -0
  18. package/dist/runtime/components/FileBtn.vue +23 -38
  19. package/dist/runtime/components/FileBtn.vue.d.ts +53 -0
  20. package/dist/runtime/components/ImportCSV.d.vue.ts +52 -0
  21. package/dist/runtime/components/ImportCSV.vue +60 -99
  22. package/dist/runtime/components/ImportCSV.vue.d.ts +52 -0
  23. package/dist/runtime/components/MrzReader.d.vue.ts +19 -0
  24. package/dist/runtime/components/MrzReader.vue +128 -0
  25. package/dist/runtime/components/MrzReader.vue.d.ts +19 -0
  26. package/dist/runtime/components/SplitterPanel.d.vue.ts +15 -0
  27. package/dist/runtime/components/SplitterPanel.vue +18 -27
  28. package/dist/runtime/components/SplitterPanel.vue.d.ts +15 -0
  29. package/dist/runtime/components/TabsGroup.d.vue.ts +19 -0
  30. package/dist/runtime/components/TabsGroup.vue +8 -12
  31. package/dist/runtime/components/TabsGroup.vue.d.ts +19 -0
  32. package/dist/runtime/components/TextBarcode.d.vue.ts +12 -0
  33. package/dist/runtime/components/TextBarcode.vue +22 -33
  34. package/dist/runtime/components/TextBarcode.vue.d.ts +12 -0
  35. package/dist/runtime/components/device/IdCardButton.d.vue.ts +57 -0
  36. package/dist/runtime/components/device/IdCardButton.vue +30 -55
  37. package/dist/runtime/components/device/IdCardButton.vue.d.ts +57 -0
  38. package/dist/runtime/components/device/IdCardWebSocket.d.vue.ts +55 -0
  39. package/dist/runtime/components/device/IdCardWebSocket.vue +104 -153
  40. package/dist/runtime/components/device/IdCardWebSocket.vue.d.ts +55 -0
  41. package/dist/runtime/components/device/Scanner.d.vue.ts +66 -0
  42. package/dist/runtime/components/device/Scanner.vue +97 -166
  43. package/dist/runtime/components/device/Scanner.vue.d.ts +66 -0
  44. package/dist/runtime/components/dialog/Confirm.d.vue.ts +37 -0
  45. package/dist/runtime/components/dialog/Confirm.vue +30 -47
  46. package/dist/runtime/components/dialog/Confirm.vue.d.ts +37 -0
  47. package/dist/runtime/components/dialog/Host.d.vue.ts +9 -0
  48. package/dist/runtime/components/dialog/Host.vue +34 -53
  49. package/dist/runtime/components/dialog/Host.vue.d.ts +9 -0
  50. package/dist/runtime/components/dialog/Index.d.vue.ts +24 -0
  51. package/dist/runtime/components/dialog/Index.vue +20 -28
  52. package/dist/runtime/components/dialog/Index.vue.d.ts +24 -0
  53. package/dist/runtime/components/dialog/Loading.d.vue.ts +21 -0
  54. package/dist/runtime/components/dialog/Loading.vue +12 -17
  55. package/dist/runtime/components/dialog/Loading.vue.d.ts +21 -0
  56. package/dist/runtime/components/dialog/default/Confirm.d.vue.ts +40 -0
  57. package/dist/runtime/components/dialog/default/Confirm.vue +29 -50
  58. package/dist/runtime/components/dialog/default/Confirm.vue.d.ts +40 -0
  59. package/dist/runtime/components/dialog/default/Loading.d.vue.ts +23 -0
  60. package/dist/runtime/components/dialog/default/Loading.vue +12 -17
  61. package/dist/runtime/components/dialog/default/Loading.vue.d.ts +23 -0
  62. package/dist/runtime/components/dialog/default/Notify.d.vue.ts +23 -0
  63. package/dist/runtime/components/dialog/default/Notify.vue +19 -36
  64. package/dist/runtime/components/dialog/default/Notify.vue.d.ts +23 -0
  65. package/dist/runtime/components/dialog/default/Printing.d.vue.ts +21 -0
  66. package/dist/runtime/components/dialog/default/Printing.vue +13 -17
  67. package/dist/runtime/components/dialog/default/Printing.vue.d.ts +21 -0
  68. package/dist/runtime/components/dialog/default/VerifyUser.d.vue.ts +29 -0
  69. package/dist/runtime/components/dialog/default/VerifyUser.vue +44 -70
  70. package/dist/runtime/components/dialog/default/VerifyUser.vue.d.ts +29 -0
  71. package/dist/runtime/components/document/Form.d.vue.ts +9 -0
  72. package/dist/runtime/components/document/Form.vue +27 -34
  73. package/dist/runtime/components/document/Form.vue.d.ts +9 -0
  74. package/dist/runtime/components/document/TemplateBuilder.d.vue.ts +24 -0
  75. package/dist/runtime/components/document/TemplateBuilder.vue +154 -182
  76. package/dist/runtime/components/document/TemplateBuilder.vue.d.ts +24 -0
  77. package/dist/runtime/components/form/ActionPad.d.vue.ts +114 -0
  78. package/dist/runtime/components/form/ActionPad.vue +48 -73
  79. package/dist/runtime/components/form/ActionPad.vue.d.ts +114 -0
  80. package/dist/runtime/components/form/Birthdate.d.vue.ts +38 -0
  81. package/dist/runtime/components/form/Birthdate.vue +44 -64
  82. package/dist/runtime/components/form/Birthdate.vue.d.ts +38 -0
  83. package/dist/runtime/components/form/CheckboxGroup.d.vue.ts +41 -0
  84. package/dist/runtime/components/form/CheckboxGroup.vue +34 -52
  85. package/dist/runtime/components/form/CheckboxGroup.vue.d.ts +41 -0
  86. package/dist/runtime/components/form/CodeEditor.d.vue.ts +25 -0
  87. package/dist/runtime/components/form/CodeEditor.vue +18 -28
  88. package/dist/runtime/components/form/CodeEditor.vue.d.ts +25 -0
  89. package/dist/runtime/components/form/Date.d.vue.ts +86 -0
  90. package/dist/runtime/components/form/Date.vue +109 -150
  91. package/dist/runtime/components/form/Date.vue.d.ts +86 -0
  92. package/dist/runtime/components/form/DateTime.d.vue.ts +36 -0
  93. package/dist/runtime/components/form/DateTime.vue +94 -131
  94. package/dist/runtime/components/form/DateTime.vue.d.ts +36 -0
  95. package/dist/runtime/components/form/Dialog.d.vue.ts +69 -0
  96. package/dist/runtime/components/form/Dialog.vue +60 -84
  97. package/dist/runtime/components/form/Dialog.vue.d.ts +69 -0
  98. package/dist/runtime/components/form/EditPad.d.vue.ts +113 -0
  99. package/dist/runtime/components/form/EditPad.vue +49 -73
  100. package/dist/runtime/components/form/EditPad.vue.d.ts +113 -0
  101. package/dist/runtime/components/form/File.d.vue.ts +65 -0
  102. package/dist/runtime/components/form/File.vue +112 -174
  103. package/dist/runtime/components/form/File.vue.d.ts +65 -0
  104. package/dist/runtime/components/form/Hidden.d.vue.ts +12 -0
  105. package/dist/runtime/components/form/Hidden.vue +17 -22
  106. package/dist/runtime/components/form/Hidden.vue.d.ts +12 -0
  107. package/dist/runtime/components/form/Iterator.d.vue.ts +279 -0
  108. package/dist/runtime/components/form/Iterator.vue +162 -240
  109. package/dist/runtime/components/form/Iterator.vue.d.ts +279 -0
  110. package/dist/runtime/components/form/Login.d.vue.ts +32 -0
  111. package/dist/runtime/components/form/Login.vue +23 -43
  112. package/dist/runtime/components/form/Login.vue.d.ts +32 -0
  113. package/dist/runtime/components/form/Pad.d.vue.ts +674 -0
  114. package/dist/runtime/components/form/Pad.vue +166 -253
  115. package/dist/runtime/components/form/Pad.vue.d.ts +674 -0
  116. package/dist/runtime/components/form/SignPad.d.vue.ts +62 -0
  117. package/dist/runtime/components/form/SignPad.vue +80 -118
  118. package/dist/runtime/components/form/SignPad.vue.d.ts +62 -0
  119. package/dist/runtime/components/form/System.d.vue.ts +34 -0
  120. package/dist/runtime/components/form/System.vue +18 -24
  121. package/dist/runtime/components/form/System.vue.d.ts +34 -0
  122. package/dist/runtime/components/form/Table.d.vue.ts +221 -0
  123. package/dist/runtime/components/form/Table.vue +123 -170
  124. package/dist/runtime/components/form/Table.vue.d.ts +221 -0
  125. package/dist/runtime/components/form/TableData.d.vue.ts +102 -0
  126. package/dist/runtime/components/form/TableData.vue +109 -127
  127. package/dist/runtime/components/form/TableData.vue.d.ts +102 -0
  128. package/dist/runtime/components/form/Time.d.vue.ts +49 -0
  129. package/dist/runtime/components/form/Time.vue +64 -87
  130. package/dist/runtime/components/form/Time.vue.d.ts +49 -0
  131. package/dist/runtime/components/form/images/Capture.d.vue.ts +96 -0
  132. package/dist/runtime/components/form/images/Capture.vue +104 -139
  133. package/dist/runtime/components/form/images/Capture.vue.d.ts +96 -0
  134. package/dist/runtime/components/form/images/Edit.d.vue.ts +29 -0
  135. package/dist/runtime/components/form/images/Edit.vue +57 -69
  136. package/dist/runtime/components/form/images/Edit.vue.d.ts +29 -0
  137. package/dist/runtime/components/form/images/Field.d.vue.ts +27 -0
  138. package/dist/runtime/components/form/images/Field.vue +136 -194
  139. package/dist/runtime/components/form/images/Field.vue.d.ts +27 -0
  140. package/dist/runtime/components/form/images/Pad.d.vue.ts +13 -0
  141. package/dist/runtime/components/form/images/Pad.vue +23 -28
  142. package/dist/runtime/components/form/images/Pad.vue.d.ts +13 -0
  143. package/dist/runtime/components/label/Date.d.vue.ts +13 -0
  144. package/dist/runtime/components/label/Date.vue +13 -21
  145. package/dist/runtime/components/label/Date.vue.d.ts +13 -0
  146. package/dist/runtime/components/label/DateAgo.d.vue.ts +20 -0
  147. package/dist/runtime/components/label/DateAgo.vue +43 -67
  148. package/dist/runtime/components/label/DateAgo.vue.d.ts +20 -0
  149. package/dist/runtime/components/label/DateCount.d.vue.ts +22 -0
  150. package/dist/runtime/components/label/DateCount.vue +58 -97
  151. package/dist/runtime/components/label/DateCount.vue.d.ts +22 -0
  152. package/dist/runtime/components/label/Field.d.vue.ts +38 -0
  153. package/dist/runtime/components/label/Field.vue +18 -32
  154. package/dist/runtime/components/label/Field.vue.d.ts +38 -0
  155. package/dist/runtime/components/label/FormatMoney.d.vue.ts +12 -0
  156. package/dist/runtime/components/label/FormatMoney.vue +12 -20
  157. package/dist/runtime/components/label/FormatMoney.vue.d.ts +12 -0
  158. package/dist/runtime/components/label/Mask.d.vue.ts +10 -0
  159. package/dist/runtime/components/label/Mask.vue +21 -30
  160. package/dist/runtime/components/label/Mask.vue.d.ts +10 -0
  161. package/dist/runtime/components/label/Object.d.vue.ts +8 -0
  162. package/dist/runtime/components/label/Object.vue +10 -12
  163. package/dist/runtime/components/label/Object.vue.d.ts +8 -0
  164. package/dist/runtime/components/master/Autocomplete.d.vue.ts +70 -0
  165. package/dist/runtime/components/master/Autocomplete.vue +25 -26
  166. package/dist/runtime/components/master/Autocomplete.vue.d.ts +70 -0
  167. package/dist/runtime/components/master/Combobox.d.vue.ts +70 -0
  168. package/dist/runtime/components/master/Combobox.vue +26 -27
  169. package/dist/runtime/components/master/Combobox.vue.d.ts +70 -0
  170. package/dist/runtime/components/master/RadioGroup.d.vue.ts +51 -0
  171. package/dist/runtime/components/master/RadioGroup.vue +44 -47
  172. package/dist/runtime/components/master/RadioGroup.vue.d.ts +51 -0
  173. package/dist/runtime/components/master/Select.d.vue.ts +68 -0
  174. package/dist/runtime/components/master/Select.vue +25 -26
  175. package/dist/runtime/components/master/Select.vue.d.ts +68 -0
  176. package/dist/runtime/components/master/label.d.vue.ts +24 -0
  177. package/dist/runtime/components/master/label.vue +22 -34
  178. package/dist/runtime/components/master/label.vue.d.ts +24 -0
  179. package/dist/runtime/components/model/Autocomplete.d.vue.ts +82 -0
  180. package/dist/runtime/components/model/Autocomplete.vue +50 -37
  181. package/dist/runtime/components/model/Autocomplete.vue.d.ts +82 -0
  182. package/dist/runtime/components/model/Combobox.d.vue.ts +82 -0
  183. package/dist/runtime/components/model/Combobox.vue +51 -37
  184. package/dist/runtime/components/model/Combobox.vue.d.ts +82 -0
  185. package/dist/runtime/components/model/Pad.d.vue.ts +72 -0
  186. package/dist/runtime/components/model/Pad.vue +50 -53
  187. package/dist/runtime/components/model/Pad.vue.d.ts +72 -0
  188. package/dist/runtime/components/model/Select.d.vue.ts +72 -0
  189. package/dist/runtime/components/model/Select.vue +42 -32
  190. package/dist/runtime/components/model/Select.vue.d.ts +72 -0
  191. package/dist/runtime/components/model/Table.d.vue.ts +272 -0
  192. package/dist/runtime/components/model/Table.vue +121 -133
  193. package/dist/runtime/components/model/Table.vue.d.ts +272 -0
  194. package/dist/runtime/components/model/iterator.d.vue.ts +321 -0
  195. package/dist/runtime/components/model/iterator.vue +148 -175
  196. package/dist/runtime/components/model/iterator.vue.d.ts +321 -0
  197. package/dist/runtime/components/model/label.d.vue.ts +26 -0
  198. package/dist/runtime/components/model/label.vue +25 -35
  199. package/dist/runtime/components/model/label.vue.d.ts +26 -0
  200. package/dist/runtime/components/pdf/Print.d.vue.ts +17 -0
  201. package/dist/runtime/components/pdf/Print.vue +27 -38
  202. package/dist/runtime/components/pdf/Print.vue.d.ts +17 -0
  203. package/dist/runtime/components/pdf/View.d.vue.ts +52 -0
  204. package/dist/runtime/components/pdf/View.vue +58 -83
  205. package/dist/runtime/components/pdf/View.vue.d.ts +52 -0
  206. package/dist/runtime/composables/alert.d.ts +4 -0
  207. package/dist/runtime/composables/api.d.ts +4 -0
  208. package/dist/runtime/composables/api.js +4 -2
  209. package/dist/runtime/composables/assetFile.js +4 -2
  210. package/dist/runtime/composables/dialog.d.ts +1 -1
  211. package/dist/runtime/composables/document/template.js +3 -3
  212. package/dist/runtime/composables/document/templateFormHidden.d.ts +4 -0
  213. package/dist/runtime/composables/document/templateFormTable.js +1 -0
  214. package/dist/runtime/composables/graphql.d.ts +2 -2
  215. package/dist/runtime/composables/graphql.js +5 -5
  216. package/dist/runtime/composables/graphqlModel.d.ts +6 -6
  217. package/dist/runtime/composables/graphqlModelItem.d.ts +4 -4
  218. package/dist/runtime/composables/graphqlModelOperation.d.ts +6 -6
  219. package/dist/runtime/composables/graphqlModelOperation.js +2 -1
  220. package/dist/runtime/composables/graphqlOperation.js +5 -1
  221. package/dist/runtime/composables/hostAgentWs.d.ts +1 -1
  222. package/dist/runtime/composables/localStorageModel.d.ts +4 -0
  223. package/dist/runtime/composables/lookupList.d.ts +4 -0
  224. package/dist/runtime/composables/lookupListMaster.js +3 -3
  225. package/dist/runtime/composables/menu.d.ts +4 -0
  226. package/dist/runtime/composables/menu.js +2 -2
  227. package/dist/runtime/composables/useMrzReader.d.ts +48 -0
  228. package/dist/runtime/composables/useMrzReader.js +423 -0
  229. package/dist/runtime/composables/useTesseract.d.ts +16 -0
  230. package/dist/runtime/composables/useTesseract.js +45 -0
  231. package/dist/runtime/composables/userPermission.d.ts +1 -1
  232. package/dist/runtime/composables/utils/fuzzy.d.ts +2 -1
  233. package/dist/runtime/labs/Calendar.d.vue.ts +35 -0
  234. package/dist/runtime/labs/Calendar.vue +47 -75
  235. package/dist/runtime/labs/Calendar.vue.d.ts +35 -0
  236. package/dist/runtime/labs/form/EditMobile.d.vue.ts +12 -0
  237. package/dist/runtime/labs/form/EditMobile.vue +19 -36
  238. package/dist/runtime/labs/form/EditMobile.vue.d.ts +12 -0
  239. package/dist/runtime/labs/form/TextFieldMask.d.vue.ts +21 -0
  240. package/dist/runtime/labs/form/TextFieldMask.vue +19 -25
  241. package/dist/runtime/labs/form/TextFieldMask.vue.d.ts +21 -0
  242. package/dist/runtime/plugins/dialogManager.js +2 -2
  243. package/dist/runtime/plugins/permission.js +3 -3
  244. package/dist/runtime/types/bridge.d.ts +14 -0
  245. package/dist/runtime/utils/asset.d.ts +2 -0
  246. package/dist/runtime/utils/asset.js +49 -0
  247. package/dist/runtime/utils/datetime.js +1 -1
  248. package/dist/types.d.mts +2 -6
  249. package/package.json +79 -57
  250. package/scripts/ci-release.mjs +125 -0
  251. package/scripts/enrich-vue-docs-from-ai.mjs +197 -0
  252. package/scripts/generate-ai-summary.mjs +321 -0
  253. package/scripts/generate-composables-md.mjs +129 -0
  254. package/scripts/release-version.mjs +68 -0
  255. package/scripts/release.mjs +49 -0
  256. package/templates/public/tesseract/mrz.traineddata.gz +0 -0
  257. package/templates/public/tesseract/ocrb.traineddata.gz +0 -0
  258. package/dist/module.cjs +0 -5
  259. package/dist/module.d.ts +0 -8
  260. package/dist/types.d.ts +0 -7
package/README.md CHANGED
@@ -1,45 +1,56 @@
1
- <!--
2
- Get your module up and running quickly.
3
-
4
- Find and replace all on all files (CMD+SHIFT+F):
5
- - Name: Ramahis Common Component
6
- - Package name: @ramahis/common-components
7
- -->
8
-
9
1
  # @ramathibodi/nuxt-commons
10
2
 
11
- [![npm version][npm-version-src]][npm-version-href]
12
- [![npm downloads][npm-downloads-src]][npm-downloads-href]
13
- [![License][license-src]][license-href]
14
- [![Nuxt][nuxt-src]][nuxt-href]
15
-
16
-
17
- ## Quick Setup
3
+ Nuxt module for Nuxt 3 and Nuxt 4 that provides shared runtime building blocks for Rama projects:
4
+ - globally auto-imported UI components
5
+ - auto-imported composables
6
+ - runtime plugins for permission/dialog/default behavior
7
+ - utility and lab exports
18
8
 
19
- 1. Add `'@ramathibodi/nuxt-commons'` dependency to your project
9
+ ## Install
20
10
 
21
11
  ```bash
22
- # Using pnpm
12
+ # pnpm
23
13
  pnpm add -D @ramathibodi/nuxt-commons
24
14
 
25
- # Using yarn
15
+ # yarn
26
16
  yarn add --dev @ramathibodi/nuxt-commons
27
17
 
28
- # Using npm
18
+ # npm
29
19
  npm install --save-dev @ramathibodi/nuxt-commons
30
20
  ```
31
21
 
32
- 2. Add `my-module` to the `modules` section of `nuxt.config.ts`
22
+ ## Nuxt Setup
33
23
 
34
- ```js
24
+ ```ts
25
+ // nuxt.config.ts
35
26
  export default defineNuxtConfig({
36
- modules: [
37
- '@ramathibodi/nuxt-commons'
38
- ]
27
+ modules: ['@ramathibodi/nuxt-commons'],
39
28
  })
40
29
  ```
41
30
 
42
- That's it! You can now use My Module in your Nuxt app ✨
31
+ Supported Nuxt versions: `^3.16.0 || ^4.0.0`
32
+
33
+ ## What The Module Registers
34
+
35
+ Configured in `src/module.ts`:
36
+ - Components from `src/runtime/components` (global + prefixed)
37
+ - Composables from `src/runtime/composables/**` (auto-imported)
38
+ - Plugins:
39
+ - `src/runtime/plugins/permission.ts`
40
+ - `src/runtime/plugins/dialogManager.ts` (client)
41
+ - `src/runtime/plugins/clientConfig.ts` (client)
42
+ - `src/runtime/plugins/default.ts` (client)
43
+ - Type templates from `src/runtime/types/*.d.ts`
44
+
45
+ ## Runtime Config
46
+
47
+ This module uses public runtime config at:
48
+
49
+ ```ts
50
+ runtimeConfig.public['nuxt-commons']
51
+ ```
52
+
53
+ Module options are merged into this key by module setup.
43
54
 
44
55
  ## Development
45
56
 
@@ -47,50 +58,65 @@ That's it! You can now use My Module in your Nuxt app ✨
47
58
  # Install dependencies
48
59
  npm install
49
60
 
50
- # Generate type stubs
61
+ # Prepare stubs/types
51
62
  npm run dev:prepare
52
63
 
53
- # Develop with the playground
64
+ # Run playground
54
65
  npm run dev
55
66
 
56
- # Build the playground
67
+ # Build playground
57
68
  npm run dev:build
58
69
 
59
- # Run ESLint
70
+ # Lint and test
60
71
  npm run lint
61
-
62
- # Run Vitest
63
72
  npm run test
64
- npm run test:watch
65
-
66
- # Release new version
67
- npm run release
68
73
  ```
69
74
 
70
- ## NPM Login
71
- ```bash
72
- npm login
73
- ```
74
- - จะส่ง link url มาให้เข้าไปที่ url login npm
75
+ ## Documentation
76
+
77
+ Generate documentation artifacts from source:
75
78
 
76
- ## NPM PUBLISH
77
79
  ```bash
78
- 1. ตรวจสอบ source code, ตรวจสอบ Branch ว่าเป็น master แล้ว จากนั้นตรวจสอบ version ของ npm ว่ามีการเปลี่ยนและไม่ชนกับ version บน npm
79
- 2. npm run dev:build
80
- 3. npm publish --access public
81
- 4. set token ใน link ที่ npm ให้มา
82
- 5. เสร็จสิ้น
80
+ # Vue component API docs (vue-docgen)
81
+ npm run docs:api:components
82
+
83
+ # Composable API docs (typedoc)
84
+ npm run docs:api:composables
85
+
86
+ # Both API docs
87
+ npm run docs:api
88
+
89
+ # AI-focused summary + type index
90
+ npm run docs:ai:summary
83
91
  ```
84
92
 
85
- <!-- Badges -->
86
- [npm-version-src]: https://img.shields.io/npm/v/my-module/latest.svg?style=flat&colorA=18181B&colorB=28CF8D
87
- [npm-version-href]: https://npmjs.com/package/my-module
93
+ `docs:api:components` now runs a post-process step that enriches missing prop/event descriptions and missing type/default cells in generated markdown using `docs/ai-summary.json`.
94
+
95
+ Documentation config files:
96
+ - [`docs/vue-docgen.config.cjs`](docs/vue-docgen.config.cjs) for component docs generation
97
+ - [`docs/typedoc.json`](docs/typedoc.json) for composable docs generation
98
+ - [`docs/typedoc.tsconfig.json`](docs/typedoc.tsconfig.json) for docs-only TypeScript scope
88
99
 
89
- [npm-downloads-src]: https://img.shields.io/npm/dm/my-module.svg?style=flat&colorA=18181B&colorB=28CF8D
90
- [npm-downloads-href]: https://npmjs.com/package/my-module
100
+ Generated outputs:
101
+ - [`docs/components/`](docs/components/) (vue-docgen output)
102
+ - [`docs/composables/`](docs/composables/) (typedoc output)
103
+ - [`docs/ai-summary.md`](docs/ai-summary.md) (compact AI-oriented markdown summary)
104
+ - [`docs/ai-summary.json`](docs/ai-summary.json) (machine-readable component/composable metadata)
105
+ - [`docs/type-index.json`](docs/type-index.json) (type index for tooling/AI pipelines)
91
106
 
92
- [license-src]: https://img.shields.io/npm/l/my-module.svg?style=flat&colorA=18181B&colorB=28CF8D
93
- [license-href]: https://npmjs.com/package/my-module
107
+ `docs:ai:summary` generates:
108
+ - `docs/ai-summary.md`
109
+ - `docs/ai-summary.json`
110
+ - `docs/type-index.json`
94
111
 
95
- [nuxt-src]: https://img.shields.io/badge/Nuxt-18181B?logo=nuxt.js
96
- [nuxt-href]: https://nuxt.com
112
+ ## Publish Notes
113
+
114
+ `package.json` `version` is used to select the publish line by `major.minor`:
115
+
116
+ - Keep the same `major.minor` line to continue normal releases.
117
+ - Change it to `0.2.0`, `1.1.0`, etc. to start publishing that new line on the next release.
118
+
119
+ ```bash
120
+ npm run dev:build
121
+ npm run release
122
+ ```
package/dist/module.json CHANGED
@@ -2,11 +2,11 @@
2
2
  "name": "@ramathibodi/nuxt-commons",
3
3
  "configKey": "nuxt-commons",
4
4
  "compatibility": {
5
- "nuxt": "^3.0.0"
5
+ "nuxt": "^4.3.1"
6
6
  },
7
- "version": "0.1.73",
7
+ "version": "4.0.0",
8
8
  "builder": {
9
- "@nuxt/module-builder": "0.8.4",
10
- "unbuild": "2.0.0"
9
+ "@nuxt/module-builder": "1.0.2",
10
+ "unbuild": "3.6.1"
11
11
  }
12
12
  }
package/dist/module.mjs CHANGED
@@ -1,11 +1,11 @@
1
1
  import { defineNuxtModule, createResolver, addComponentsDir, addImportsDir, addPlugin, addTypeTemplate } from '@nuxt/kit';
2
2
 
3
- const module = defineNuxtModule({
3
+ const module$1 = defineNuxtModule({
4
4
  meta: {
5
5
  name: "@ramathibodi/nuxt-commons",
6
6
  configKey: "nuxt-commons",
7
7
  compatibility: {
8
- nuxt: "^3.0.0"
8
+ nuxt: "^4.3.1"
9
9
  }
10
10
  },
11
11
  // Default configuration options of the Nuxt module
@@ -20,6 +20,7 @@ const module = defineNuxtModule({
20
20
  global: true
21
21
  });
22
22
  addImportsDir(resolver.resolve("runtime/composables/**"));
23
+ addImportsDir(resolver.resolve("runtime/utils/**"));
23
24
  addPlugin({
24
25
  src: resolver.resolve("runtime/plugins/permission")
25
26
  });
@@ -35,7 +36,7 @@ const module = defineNuxtModule({
35
36
  src: resolver.resolve("runtime/plugins/default"),
36
37
  mode: "client"
37
38
  });
38
- const typeFiles = ["modules", "alert", "menu", "graphqlOperation", "formDialog", "dialogManager", "permission", "clientConfig"];
39
+ const typeFiles = ["modules", "alert", "menu", "graphqlOperation", "formDialog", "dialogManager", "permission", "clientConfig", "bridge"];
39
40
  for (const file of typeFiles) {
40
41
  addTypeTemplate({
41
42
  src: resolver.resolve(`runtime/types/${file}.d.ts`),
@@ -57,4 +58,4 @@ const module = defineNuxtModule({
57
58
  }
58
59
  });
59
60
 
60
- export { module as default };
61
+ export { module$1 as default };
@@ -0,0 +1,21 @@
1
+ export interface AuthenticationUserProfile {
2
+ username?: string;
3
+ [key: string]: any;
4
+ }
5
+ export interface AuthenticationKeycloakState {
6
+ token?: string;
7
+ [key: string]: any;
8
+ }
9
+ export interface AuthenticationState {
10
+ isAuthenticated?: boolean;
11
+ token?: string;
12
+ keycloak?: AuthenticationKeycloakState | null;
13
+ userProfile?: AuthenticationUserProfile | null;
14
+ permissions?: string[];
15
+ hasPermission?: (permissionId: string) => boolean;
16
+ login?: (...args: any[]) => any;
17
+ logout?: (...args: any[]) => any;
18
+ [key: string]: any;
19
+ }
20
+ export type AuthenticationBridgeInput = AuthenticationState | (() => AuthenticationState);
21
+ export declare function useAuthentication(): AuthenticationState;
@@ -0,0 +1,20 @@
1
+ import { useNuxtApp, useState } from "#imports";
2
+ function withPermissionFallback(state) {
3
+ const permissions = Array.isArray(state?.permissions) ? state.permissions : [];
4
+ return {
5
+ ...state,
6
+ hasPermission: state?.hasPermission ?? ((permissionId) => permissions.includes(permissionId))
7
+ };
8
+ }
9
+ export function useAuthentication() {
10
+ const nuxtApp = useNuxtApp();
11
+ const injected = nuxtApp.$appAuthentication;
12
+ if (typeof injected === "function") {
13
+ return withPermissionFallback(injected());
14
+ }
15
+ if (injected) {
16
+ return withPermissionFallback(injected);
17
+ }
18
+ const state = useState("authentication", () => ({}));
19
+ return withPermissionFallback(state.value);
20
+ }
@@ -0,0 +1,17 @@
1
+ import type { graphqlInputObject, graphqlOperationObject, graphqlTypeObject } from '../types/graphqlOperation.js';
2
+ export interface GraphqlBridgeState {
3
+ scalarType: string[];
4
+ graphqlType: Record<string, graphqlTypeObject>;
5
+ graphqlInputType: Record<string, graphqlInputObject>;
6
+ graphqlOperation: Record<string, graphqlOperationObject<any, any>>;
7
+ [key: string]: any;
8
+ }
9
+ export interface GraphqlBridgeInput {
10
+ scalarType?: string[];
11
+ graphqlType?: Record<string, graphqlTypeObject>;
12
+ graphqlInputType?: Record<string, graphqlInputObject>;
13
+ graphqlOperation?: Record<string, graphqlOperationObject<any, any>>;
14
+ [key: string]: any;
15
+ }
16
+ export declare function useGraphqlBridge(): GraphqlBridgeState;
17
+ export declare function registerGraphqlObject(input: GraphqlBridgeInput): void;
@@ -0,0 +1,45 @@
1
+ import { useNuxtApp } from "#imports";
2
+ const fallbackGraphqlState = {
3
+ scalarType: [
4
+ "Boolean",
5
+ "Date",
6
+ "DateTime",
7
+ "Float",
8
+ "ID",
9
+ "Int",
10
+ "JSON",
11
+ "String",
12
+ "Upload"
13
+ ],
14
+ graphqlType: {},
15
+ graphqlInputType: {},
16
+ graphqlOperation: {}
17
+ };
18
+ export function useGraphqlBridge() {
19
+ const nuxtApp = useNuxtApp();
20
+ const injected = nuxtApp.$appGraphql;
21
+ return {
22
+ ...fallbackGraphqlState,
23
+ ...injected,
24
+ scalarType: injected?.scalarType?.length ? [.../* @__PURE__ */ new Set([...fallbackGraphqlState.scalarType, ...injected.scalarType])] : fallbackGraphqlState.scalarType,
25
+ graphqlType: injected?.graphqlType ?? fallbackGraphqlState.graphqlType,
26
+ graphqlInputType: injected?.graphqlInputType ?? fallbackGraphqlState.graphqlInputType,
27
+ graphqlOperation: injected?.graphqlOperation ?? fallbackGraphqlState.graphqlOperation
28
+ };
29
+ }
30
+ export function registerGraphqlObject(input) {
31
+ const nuxtApp = useNuxtApp();
32
+ const bridge = nuxtApp.$appGraphql ?? fallbackGraphqlState;
33
+ const scalarType = bridge.scalarType ?? fallbackGraphqlState.scalarType;
34
+ const graphqlType = bridge.graphqlType ?? fallbackGraphqlState.graphqlType;
35
+ const graphqlInputType = bridge.graphqlInputType ?? fallbackGraphqlState.graphqlInputType;
36
+ const graphqlOperation = bridge.graphqlOperation ?? fallbackGraphqlState.graphqlOperation;
37
+ if (input.scalarType?.length) {
38
+ for (const scalar of input.scalarType) {
39
+ if (!scalarType.includes(scalar)) scalarType.push(scalar);
40
+ }
41
+ }
42
+ if (input.graphqlType) Object.assign(graphqlType, input.graphqlType);
43
+ if (input.graphqlInputType) Object.assign(graphqlInputType, input.graphqlInputType);
44
+ if (input.graphqlOperation) Object.assign(graphqlOperation, input.graphqlOperation);
45
+ }
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -1,30 +1,25 @@
1
- <script lang="ts" setup>
2
- import { ref, watch } from 'vue'
3
- import { isEmpty } from 'lodash-es'
4
- import { useAlert } from '../composables/alert'
5
- import type { AlertItem } from '../types/alert'
6
-
7
- const isAlertOpen = ref(false)
8
- const timeout = ref(3000)
9
- const alert = useAlert()
10
- const currentItem = ref<AlertItem | undefined>()
11
-
1
+ <script setup>
2
+ import { ref, watch } from "vue";
3
+ import { isEmpty } from "lodash-es";
4
+ import { useAlert } from "../composables/alert";
5
+ const isAlertOpen = ref(false);
6
+ const timeout = ref(3e3);
7
+ const alert = useAlert();
8
+ const currentItem = ref();
12
9
  const renewAlert = () => {
13
10
  if (alert?.hasAlert()) {
14
- currentItem.value = alert?.takeAlert()
15
- isAlertOpen.value = true
11
+ currentItem.value = alert?.takeAlert();
12
+ isAlertOpen.value = true;
13
+ } else {
14
+ currentItem.value = void 0;
15
+ isAlertOpen.value = false;
16
16
  }
17
- else {
18
- currentItem.value = undefined
19
- isAlertOpen.value = false
20
- }
21
- }
22
-
17
+ };
23
18
  watch(() => alert?.hasAlert(), (hasAlert) => {
24
19
  if (hasAlert) {
25
- renewAlert()
20
+ renewAlert();
26
21
  }
27
- })
22
+ });
28
23
  </script>
29
24
 
30
25
  <template>
@@ -48,7 +43,7 @@ watch(() => alert?.hasAlert(), (hasAlert) => {
48
43
  v-bind="currentItem.alertIcon ? { icon: currentItem.alertIcon } : {}"
49
44
  @click:close="renewAlert()"
50
45
  >
51
- {{ currentItem.statusCode ? currentItem.statusCode + ' ' : '' }} {{ currentItem.message }} {{ !isEmpty(currentItem.data) ? currentItem.data : '' }}
46
+ {{ currentItem.statusCode ? currentItem.statusCode + " " : "" }} {{ currentItem.message }} {{ !isEmpty(currentItem.data) ? currentItem.data : "" }}
52
47
  </VAlert>
53
48
  </VSnackbar>
54
49
  </template>
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -0,0 +1,9 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
2
+ error: (error: unknown) => any;
3
+ decode: (barcodeValue: string) => any;
4
+ }, string, import("vue").PublicProps, Readonly<{}> & Readonly<{
5
+ onError?: ((error: unknown) => any) | undefined;
6
+ onDecode?: ((barcodeValue: string) => any) | undefined;
7
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
8
+ declare const _default: typeof __VLS_export;
9
+ export default _default;
@@ -1,94 +1,77 @@
1
- <script lang="ts" setup>
2
- import {BrowserMultiFormatReader} from '@zxing/browser'
3
- import {type IScannerControls} from '@zxing/browser/esm'
4
- import type {Exception, Result} from '@zxing/library'
5
- import {computed, onBeforeUnmount, onMounted, ref, watchEffect} from 'vue'
6
- import {useAlert} from '../composables/alert'
7
- import {useDevicesList, useUserMedia} from "@vueuse/core";
8
-
9
- const barcodeReader = new BrowserMultiFormatReader()
10
- const barcodeReaderControl = ref()
11
-
12
- const alert = useAlert()
13
- const isLoading = ref<boolean>(false)
14
-
15
- const emit = defineEmits<{
16
- (event: 'decode', barcodeValue: string): void
17
- (event: 'error', error: string | unknown): void
18
- }>()
19
-
20
- const videoScreen = ref<HTMLVideoElement>()
21
-
22
- const currentCameraId = ref<ConstrainDOMString | undefined>()
1
+ <script setup>
2
+ import { BrowserMultiFormatReader } from "@zxing/browser";
3
+ import {} from "@zxing/browser/esm";
4
+ import { computed, onBeforeUnmount, onMounted, ref, watchEffect } from "vue";
5
+ import { useAlert } from "../composables/alert";
6
+ import { useDevicesList, useUserMedia } from "@vueuse/core";
7
+ const barcodeReader = new BrowserMultiFormatReader();
8
+ const barcodeReaderControl = ref();
9
+ const alert = useAlert();
10
+ const isLoading = ref(false);
11
+ const emit = defineEmits(["decode", "error"]);
12
+ const videoScreen = ref();
13
+ const currentCameraId = ref();
23
14
  const { videoInputs: cameras } = useDevicesList({
24
15
  requestPermissions: true,
25
16
  constraints: { audio: false, video: true },
26
17
  onUpdated() {
27
- if (!cameras.value.find(camera => camera.deviceId === currentCameraId.value))
28
- currentCameraId.value = cameras.value[0]?.deviceId
29
- },
30
- })
31
- const hasCamera = computed(()=>{ return !!currentCameraId.value })
32
-
18
+ if (!cameras.value.find((camera) => camera.deviceId === currentCameraId.value))
19
+ currentCameraId.value = cameras.value[0]?.deviceId;
20
+ }
21
+ });
22
+ const hasCamera = computed(() => {
23
+ return !!currentCameraId.value;
24
+ });
33
25
  const { stream, start: cameraStart, stop: cameraStop, enabled: cameraEnabled } = useUserMedia({
34
- constraints: { video: { deviceId: currentCameraId.value}},
35
- })
36
-
26
+ constraints: { video: { deviceId: currentCameraId.value } }
27
+ });
37
28
  watchEffect(() => {
38
- if (videoScreen.value) videoScreen.value.srcObject = (stream.value) ? stream.value! : null
39
- })
40
-
29
+ if (videoScreen.value) videoScreen.value.srcObject = stream.value ? stream.value : null;
30
+ });
41
31
  function startCamera() {
42
32
  if (!cameraEnabled.value) {
43
- isLoading.value = true
44
- cameraStart().then(()=>{
45
- barcodeReader.decodeFromVideoDevice(currentCameraId.value, videoScreen.value, (result: Result | undefined, error: Exception | undefined, controls: IScannerControls) => {
33
+ isLoading.value = true;
34
+ cameraStart().then(() => {
35
+ barcodeReader.decodeFromVideoDevice(currentCameraId.value, videoScreen.value, (result, error, controls) => {
46
36
  if (result) {
47
- emit('decode', result.getText())
48
- cameraStop()
37
+ emit("decode", result.getText());
38
+ cameraStop();
49
39
  }
50
- }).then((result: any)=>{
51
- barcodeReaderControl.value = result
52
- })
53
- }).finally(()=>{
54
- isLoading.value = false
55
- })
40
+ }).then((result) => {
41
+ barcodeReaderControl.value = result;
42
+ });
43
+ }).finally(() => {
44
+ isLoading.value = false;
45
+ });
56
46
  }
57
47
  }
58
-
59
48
  function stopCamera() {
60
- if (barcodeReaderControl.value) barcodeReaderControl.value.stop()
61
- if (cameraEnabled.value) cameraStop()
49
+ if (barcodeReaderControl.value) barcodeReaderControl.value.stop();
50
+ if (cameraEnabled.value) cameraStop();
62
51
  }
63
-
64
- function scanImageFile(selectedFile: File | File[] | undefined) {
52
+ function scanImageFile(selectedFile) {
65
53
  if (!selectedFile) {
66
- alert?.addAlert({ message: 'No file selected.', alertType: 'error' })
67
- return
54
+ alert?.addAlert({ message: "No file selected.", alertType: "error" });
55
+ return;
68
56
  }
69
-
70
- const scanImageSingleFile: File = Array.isArray(selectedFile) ? selectedFile[0] : selectedFile
71
-
72
- const reader = new FileReader()
57
+ const scanImageSingleFile = Array.isArray(selectedFile) ? selectedFile[0] : selectedFile;
58
+ const reader = new FileReader();
73
59
  reader.onload = async (event) => {
74
60
  try {
75
- const result = await barcodeReader.decodeFromImageUrl(event.target?.result as string)
76
- emit('decode', result.getText())
61
+ const result = await barcodeReader.decodeFromImageUrl(event.target?.result);
62
+ emit("decode", result.getText());
63
+ } catch (e) {
64
+ void e;
77
65
  }
78
- catch (e) {
79
- void e
80
- }
81
- }
82
- reader.readAsDataURL(scanImageSingleFile)
66
+ };
67
+ reader.readAsDataURL(scanImageSingleFile);
83
68
  }
84
-
85
- onMounted( () => {
86
- startCamera()
87
- })
88
-
89
- onBeforeUnmount( () => {
90
- stopCamera()
91
- })
69
+ onMounted(() => {
70
+ startCamera();
71
+ });
72
+ onBeforeUnmount(() => {
73
+ stopCamera();
74
+ });
92
75
  </script>
93
76
 
94
77
  <template>
@@ -98,8 +81,8 @@ onBeforeUnmount( () => {
98
81
  </v-card-text>
99
82
  <v-card-text v-else>
100
83
  <v-col v-if="hasCamera">
101
- <div style="position: relative; display: inline-block; width: 100%;" :style="{maxWidth: '1024px'}">
102
- <video autoplay ref="videoScreen" width="100%" :style="{maxWidth:'1024px'}"></video>
84
+ <div style="position: relative; display: inline-block; width: 100%;" :style="{ maxWidth: '1024px' }">
85
+ <video autoplay ref="videoScreen" width="100%" :style="{ maxWidth: '1024px' }"></video>
103
86
  <div style="position: absolute; bottom: 10px; right: 10px; z-index: 2000;">
104
87
  <FileBtn
105
88
  accept="image/*"
@@ -0,0 +1,9 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
2
+ error: (error: unknown) => any;
3
+ decode: (barcodeValue: string) => any;
4
+ }, string, import("vue").PublicProps, Readonly<{}> & Readonly<{
5
+ onError?: ((error: unknown) => any) | undefined;
6
+ onDecode?: ((barcodeValue: string) => any) | undefined;
7
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
8
+ declare const _default: typeof __VLS_export;
9
+ export default _default;
@@ -0,0 +1,55 @@
1
+ import { VBtn } from 'vuetify/components/VBtn';
2
+ interface ExportButtonProps extends /* @vue-ignore */ InstanceType<typeof VBtn['$props']> {
3
+ fileName?: string;
4
+ sheetName?: string;
5
+ modelValue?: object[];
6
+ stringFields?: Array<string>;
7
+ tooltip?: string | Record<string, any> | undefined;
8
+ }
9
+ declare var __VLS_12: never, __VLS_13: {};
10
+ type __VLS_Slots = {} & {
11
+ [K in NonNullable<typeof __VLS_12>]?: (props: typeof __VLS_13) => any;
12
+ };
13
+ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<ExportButtonProps>, {
14
+ fileName: string;
15
+ sheetName: string;
16
+ stringFields: () => never[];
17
+ tooltip: () => {
18
+ text: string;
19
+ location: string;
20
+ };
21
+ }>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<ExportButtonProps>, {
22
+ fileName: string;
23
+ sheetName: string;
24
+ stringFields: () => never[];
25
+ tooltip: () => {
26
+ text: string;
27
+ location: string;
28
+ };
29
+ }>>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
30
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
31
+ declare const _default: typeof __VLS_export;
32
+ export default _default;
33
+ type __VLS_TypePropsToOption<T> = {
34
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
35
+ type: import('vue').PropType<Required<T>[K]>;
36
+ } : {
37
+ type: import('vue').PropType<T[K]>;
38
+ required: true;
39
+ };
40
+ };
41
+ type __VLS_WithDefaults<P, D> = {
42
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
43
+ default: D[K];
44
+ }> : P[K];
45
+ };
46
+ type __VLS_WithSlots<T, S> = T & {
47
+ new (): {
48
+ $slots: S;
49
+ };
50
+ };
51
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
52
+ [K in keyof T]: T[K];
53
+ } : {
54
+ [K in keyof T as K]: T[K];
55
+ }) & {};