@weconstudio/nuxt 0.0.0-stage → 1.72.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 (208) hide show
  1. package/LICENSE +1 -0
  2. package/README.md +115 -2
  3. package/dist/module.d.mts +7 -0
  4. package/dist/module.json +12 -0
  5. package/dist/module.mjs +250 -0
  6. package/dist/runtime/components/We/Autocomplete.d.vue.ts +13 -0
  7. package/dist/runtime/components/We/Autocomplete.vue +91 -0
  8. package/dist/runtime/components/We/Autocomplete.vue.d.ts +13 -0
  9. package/dist/runtime/components/We/BoldText.d.vue.ts +17 -0
  10. package/dist/runtime/components/We/BoldText.vue +29 -0
  11. package/dist/runtime/components/We/BoldText.vue.d.ts +17 -0
  12. package/dist/runtime/components/We/ColorPicker.d.vue.ts +11 -0
  13. package/dist/runtime/components/We/ColorPicker.vue +199 -0
  14. package/dist/runtime/components/We/ColorPicker.vue.d.ts +11 -0
  15. package/dist/runtime/components/We/ConfirmDialog.d.vue.ts +104 -0
  16. package/dist/runtime/components/We/ConfirmDialog.vue +143 -0
  17. package/dist/runtime/components/We/ConfirmDialog.vue.d.ts +104 -0
  18. package/dist/runtime/components/We/Datatable.d.vue.ts +40 -0
  19. package/dist/runtime/components/We/Datatable.vue +87 -0
  20. package/dist/runtime/components/We/Datatable.vue.d.ts +40 -0
  21. package/dist/runtime/components/We/DatatableInternal.d.vue.ts +194 -0
  22. package/dist/runtime/components/We/DatatableInternal.vue +638 -0
  23. package/dist/runtime/components/We/DatatableInternal.vue.d.ts +194 -0
  24. package/dist/runtime/components/We/DatePicker.d.vue.ts +51 -0
  25. package/dist/runtime/components/We/DatePicker.vue +901 -0
  26. package/dist/runtime/components/We/DatePicker.vue.d.ts +51 -0
  27. package/dist/runtime/components/We/Dt/Actions.d.vue.ts +51 -0
  28. package/dist/runtime/components/We/Dt/Actions.vue +106 -0
  29. package/dist/runtime/components/We/Dt/Actions.vue.d.ts +51 -0
  30. package/dist/runtime/components/We/Dt/BooleanFormatter.d.vue.ts +8 -0
  31. package/dist/runtime/components/We/Dt/BooleanFormatter.vue +26 -0
  32. package/dist/runtime/components/We/Dt/BooleanFormatter.vue.d.ts +8 -0
  33. package/dist/runtime/components/We/Dt/CardFilterContainer.d.vue.ts +17 -0
  34. package/dist/runtime/components/We/Dt/CardFilterContainer.vue +60 -0
  35. package/dist/runtime/components/We/Dt/CardFilterContainer.vue.d.ts +17 -0
  36. package/dist/runtime/components/We/Dt/CheckboxFilter.d.vue.ts +16 -0
  37. package/dist/runtime/components/We/Dt/CheckboxFilter.vue +47 -0
  38. package/dist/runtime/components/We/Dt/CheckboxFilter.vue.d.ts +16 -0
  39. package/dist/runtime/components/We/Dt/ChipGroupSelect.d.vue.ts +7 -0
  40. package/dist/runtime/components/We/Dt/ChipGroupSelect.vue +35 -0
  41. package/dist/runtime/components/We/Dt/ChipGroupSelect.vue.d.ts +7 -0
  42. package/dist/runtime/components/We/Dt/ClusterFilter.d.vue.ts +18 -0
  43. package/dist/runtime/components/We/Dt/ClusterFilter.vue +68 -0
  44. package/dist/runtime/components/We/Dt/ClusterFilter.vue.d.ts +18 -0
  45. package/dist/runtime/components/We/Dt/DatasetFormatter.d.vue.ts +19 -0
  46. package/dist/runtime/components/We/Dt/DatasetFormatter.vue +65 -0
  47. package/dist/runtime/components/We/Dt/DatasetFormatter.vue.d.ts +19 -0
  48. package/dist/runtime/components/We/Dt/DaterangeFilter.d.vue.ts +28 -0
  49. package/dist/runtime/components/We/Dt/DaterangeFilter.vue +140 -0
  50. package/dist/runtime/components/We/Dt/DaterangeFilter.vue.d.ts +28 -0
  51. package/dist/runtime/components/We/Dt/Filter.d.vue.ts +7 -0
  52. package/dist/runtime/components/We/Dt/Filter.vue +234 -0
  53. package/dist/runtime/components/We/Dt/Filter.vue.d.ts +7 -0
  54. package/dist/runtime/components/We/Dt/Filters.d.vue.ts +6 -0
  55. package/dist/runtime/components/We/Dt/Filters.vue +24 -0
  56. package/dist/runtime/components/We/Dt/Filters.vue.d.ts +6 -0
  57. package/dist/runtime/components/We/Dt/LuxonFormatter.d.vue.ts +12 -0
  58. package/dist/runtime/components/We/Dt/LuxonFormatter.vue +23 -0
  59. package/dist/runtime/components/We/Dt/LuxonFormatter.vue.d.ts +12 -0
  60. package/dist/runtime/components/We/Dt/SelectFilter.d.vue.ts +60 -0
  61. package/dist/runtime/components/We/Dt/SelectFilter.vue +333 -0
  62. package/dist/runtime/components/We/Dt/SelectFilter.vue.d.ts +60 -0
  63. package/dist/runtime/components/We/Dt/SelectResourceFilter.d.vue.ts +43 -0
  64. package/dist/runtime/components/We/Dt/SelectResourceFilter.vue +127 -0
  65. package/dist/runtime/components/We/Dt/SelectResourceFilter.vue.d.ts +43 -0
  66. package/dist/runtime/components/We/Dt/dt.types.d.ts +8 -0
  67. package/dist/runtime/components/We/EndpointSwitcher.d.vue.ts +12 -0
  68. package/dist/runtime/components/We/EndpointSwitcher.vue +256 -0
  69. package/dist/runtime/components/We/EndpointSwitcher.vue.d.ts +12 -0
  70. package/dist/runtime/components/We/Import.d.vue.ts +118 -0
  71. package/dist/runtime/components/We/Import.vue +730 -0
  72. package/dist/runtime/components/We/Import.vue.d.ts +118 -0
  73. package/dist/runtime/components/We/ImportDefaultValues.d.vue.ts +3666 -0
  74. package/dist/runtime/components/We/ImportDefaultValues.vue +115 -0
  75. package/dist/runtime/components/We/ImportDefaultValues.vue.d.ts +3666 -0
  76. package/dist/runtime/components/We/ImportMatchColumns.d.vue.ts +66 -0
  77. package/dist/runtime/components/We/ImportMatchColumns.vue +172 -0
  78. package/dist/runtime/components/We/ImportMatchColumns.vue.d.ts +66 -0
  79. package/dist/runtime/components/We/ImportPreviewResults.d.vue.ts +38 -0
  80. package/dist/runtime/components/We/ImportPreviewResults.vue +165 -0
  81. package/dist/runtime/components/We/ImportPreviewResults.vue.d.ts +38 -0
  82. package/dist/runtime/components/We/ImportSelectStart.d.vue.ts +47 -0
  83. package/dist/runtime/components/We/ImportSelectStart.vue +106 -0
  84. package/dist/runtime/components/We/ImportSelectStart.vue.d.ts +47 -0
  85. package/dist/runtime/components/We/Notification.d.vue.ts +7 -0
  86. package/dist/runtime/components/We/Notification.vue +49 -0
  87. package/dist/runtime/components/We/Notification.vue.d.ts +7 -0
  88. package/dist/runtime/components/We/S3Dropzone.d.vue.ts +17 -0
  89. package/dist/runtime/components/We/S3Dropzone.vue +527 -0
  90. package/dist/runtime/components/We/S3Dropzone.vue.d.ts +17 -0
  91. package/dist/runtime/components/We/Select.d.vue.ts +39 -0
  92. package/dist/runtime/components/We/Select.vue +354 -0
  93. package/dist/runtime/components/We/Select.vue.d.ts +39 -0
  94. package/dist/runtime/components/We/TipTap.d.vue.ts +26 -0
  95. package/dist/runtime/components/We/TipTap.vue +362 -0
  96. package/dist/runtime/components/We/TipTap.vue.d.ts +26 -0
  97. package/dist/runtime/components/We/datatable.props.d.ts +57 -0
  98. package/dist/runtime/components/We/datatable.props.js +60 -0
  99. package/dist/runtime/composables/datatable/useAutoFillHeight.d.ts +31 -0
  100. package/dist/runtime/composables/datatable/useAutoFillHeight.js +57 -0
  101. package/dist/runtime/composables/datatable/useDataTable.d.ts +33 -0
  102. package/dist/runtime/composables/datatable/useDataTable.js +161 -0
  103. package/dist/runtime/composables/datatable/useDatatableColumns.d.ts +12 -0
  104. package/dist/runtime/composables/datatable/useDatatableColumns.js +96 -0
  105. package/dist/runtime/composables/useApi.d.ts +56 -0
  106. package/dist/runtime/composables/useApi.js +230 -0
  107. package/dist/runtime/composables/useApiFetch.d.ts +2 -0
  108. package/dist/runtime/composables/useApiFetch.js +9 -0
  109. package/dist/runtime/composables/useApiUrl.d.ts +10 -0
  110. package/dist/runtime/composables/useApiUrl.js +37 -0
  111. package/dist/runtime/composables/useAuth.d.ts +9 -0
  112. package/dist/runtime/composables/useAuth.js +22 -0
  113. package/dist/runtime/composables/useBus.d.ts +8 -0
  114. package/dist/runtime/composables/useBus.js +18 -0
  115. package/dist/runtime/composables/useDateRangePresets.d.ts +21 -0
  116. package/dist/runtime/composables/useDateRangePresets.js +90 -0
  117. package/dist/runtime/composables/useForm.d.ts +29 -0
  118. package/dist/runtime/composables/useForm.js +74 -0
  119. package/dist/runtime/composables/useFormLock.d.ts +11 -0
  120. package/dist/runtime/composables/useFormLock.js +8 -0
  121. package/dist/runtime/composables/useFormWrapper.d.ts +16 -0
  122. package/dist/runtime/composables/useFormWrapper.js +36 -0
  123. package/dist/runtime/composables/useImportJob.d.ts +55 -0
  124. package/dist/runtime/composables/useImportJob.js +94 -0
  125. package/dist/runtime/composables/useLux.d.ts +1 -0
  126. package/dist/runtime/composables/useLux.js +8 -0
  127. package/dist/runtime/composables/useNotify.d.ts +12 -0
  128. package/dist/runtime/composables/useNotify.js +24 -0
  129. package/dist/runtime/composables/usePaginatedFetch.d.ts +24 -0
  130. package/dist/runtime/composables/usePaginatedFetch.js +154 -0
  131. package/dist/runtime/composables/useServerErrors.d.ts +16 -0
  132. package/dist/runtime/composables/useServerErrors.js +60 -0
  133. package/dist/runtime/composables/useValidators.d.ts +18 -0
  134. package/dist/runtime/composables/useValidators.js +56 -0
  135. package/dist/runtime/generator/code/dt.d.ts +8 -0
  136. package/dist/runtime/generator/code/dt.js +97 -0
  137. package/dist/runtime/generator/code/edit.d.ts +4 -0
  138. package/dist/runtime/generator/code/edit.js +41 -0
  139. package/dist/runtime/generator/code/form.d.ts +6 -0
  140. package/dist/runtime/generator/code/form.js +229 -0
  141. package/dist/runtime/generator/code/i18n.d.ts +5 -0
  142. package/dist/runtime/generator/code/i18n.js +43 -0
  143. package/dist/runtime/generator/code/index.d.ts +11 -0
  144. package/dist/runtime/generator/code/index.js +90 -0
  145. package/dist/runtime/generator/components/CodeSnippet.d.vue.ts +14 -0
  146. package/dist/runtime/generator/components/CodeSnippet.vue +49 -0
  147. package/dist/runtime/generator/components/CodeSnippet.vue.d.ts +14 -0
  148. package/dist/runtime/generator/components/Configuration.d.vue.ts +16 -0
  149. package/dist/runtime/generator/components/Configuration.vue +154 -0
  150. package/dist/runtime/generator/components/Configuration.vue.d.ts +16 -0
  151. package/dist/runtime/generator/components/GeneratorPage.d.vue.ts +50 -0
  152. package/dist/runtime/generator/components/GeneratorPage.vue +226 -0
  153. package/dist/runtime/generator/components/GeneratorPage.vue.d.ts +50 -0
  154. package/dist/runtime/generator/fs.d.ts +16 -0
  155. package/dist/runtime/generator/fs.js +79 -0
  156. package/dist/runtime/generator/index.d.vue.ts +52 -0
  157. package/dist/runtime/generator/index.vue +17 -0
  158. package/dist/runtime/generator/index.vue.d.ts +52 -0
  159. package/dist/runtime/internals/api.d.ts +3 -0
  160. package/dist/runtime/internals/api.js +16 -0
  161. package/dist/runtime/internals/bus.d.ts +1 -0
  162. package/dist/runtime/internals/bus.js +2 -0
  163. package/dist/runtime/internals/dt.d.ts +24 -0
  164. package/dist/runtime/internals/dt.js +57 -0
  165. package/dist/runtime/lang/en.json +211 -0
  166. package/dist/runtime/lang/it.json +211 -0
  167. package/dist/runtime/mixins/formValidator.d.ts +38 -0
  168. package/dist/runtime/mixins/formValidator.js +118 -0
  169. package/dist/runtime/plugins/api-legacy.d.ts +76 -0
  170. package/dist/runtime/plugins/api-legacy.js +11 -0
  171. package/dist/runtime/plugins/auth-legacy.d.ts +22 -0
  172. package/dist/runtime/plugins/auth-legacy.js +14 -0
  173. package/dist/runtime/plugins/bus-legacy.d.ts +6 -0
  174. package/dist/runtime/plugins/bus-legacy.js +9 -0
  175. package/dist/runtime/plugins/notify-legacy.d.ts +25 -0
  176. package/dist/runtime/plugins/notify-legacy.js +35 -0
  177. package/dist/runtime/plugins/portal.d.ts +2 -0
  178. package/dist/runtime/plugins/portal.js +5 -0
  179. package/dist/runtime/plugins/update-sanctum-app-config.d.ts +2 -0
  180. package/dist/runtime/plugins/update-sanctum-app-config.js +44 -0
  181. package/dist/runtime/plugins/vuetify-nuxt-icon.d.ts +4 -0
  182. package/dist/runtime/plugins/vuetify-nuxt-icon.js +30 -0
  183. package/dist/runtime/types/app-config.d.ts +24 -0
  184. package/dist/runtime/types/app-config.js +1 -0
  185. package/dist/runtime/types/icons.d.ts +82 -0
  186. package/dist/runtime/types/icons.js +84 -0
  187. package/dist/runtime/types/index.d.ts +2 -0
  188. package/dist/runtime/types/index.js +2 -0
  189. package/dist/runtime/types/module-options.d.ts +29 -0
  190. package/dist/runtime/types/module-options.js +0 -0
  191. package/dist/runtime/types/runtime-hooks.d.ts +17 -0
  192. package/dist/runtime/types/runtime-hooks.js +1 -0
  193. package/dist/runtime/utils/color.d.ts +10 -0
  194. package/dist/runtime/utils/color.js +38 -0
  195. package/dist/runtime/utils/file.d.ts +17 -0
  196. package/dist/runtime/utils/file.js +108 -0
  197. package/dist/runtime/utils/format.d.ts +1 -0
  198. package/dist/runtime/utils/format.js +14 -0
  199. package/dist/runtime/utils/make-enum.d.ts +15 -0
  200. package/dist/runtime/utils/make-enum.js +27 -0
  201. package/dist/runtime/utils/mergeDefaults.d.ts +1 -0
  202. package/dist/runtime/utils/mergeDefaults.js +18 -0
  203. package/dist/runtime/utils/object-to-formdata.d.ts +10 -0
  204. package/dist/runtime/utils/object-to-formdata.js +82 -0
  205. package/dist/runtime/utils/uuid.d.ts +1 -0
  206. package/dist/runtime/utils/uuid.js +9 -0
  207. package/dist/types.d.mts +9 -0
  208. package/package.json +92 -4
package/LICENSE ADDED
@@ -0,0 +1 @@
1
+ Copyright (c) 2026 WeConStudio S.r.l. All rights reserved.
package/README.md CHANGED
@@ -1,3 +1,116 @@
1
- # Temporary Holding Version
1
+ # @weconstudio/nuxt
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![Nuxt][nuxt-src]][nuxt-href]
4
+
5
+ Modulo Nuxt interno di Weconstudio: componenti, composables e plugin condivisi tra i progetti.
6
+
7
+ - [📖  Documentazione](https://nuxt.weconstudio.it/)
8
+ - [✨  Release Notes](/CHANGELOG.md)
9
+
10
+ ## Features
11
+
12
+ - 🧩  Componenti auto-importati con prefisso `We` — Datatable, DatePicker, Select, Autocomplete, TipTap, S3Dropzone, ConfirmDialog, ColorPicker, Import\*
13
+ - 🔌  Composables — `useApi`, `useApiFetch`, `usePaginatedFetch`, `useForm`, `useValidators`, `useServerErrors`, `useAuth`, `useDataTable`, `useBus`, `useNotify`, `useLux`
14
+ - 🚩  Feature flag per caricare solo ciò che serve (`bus`, `notify`, `portal`, `form`, `api`, `gen`)
15
+ - 🕰  Supporto Options API tramite i plugin `-legacy`
16
+ - 🌍  Traduzioni `it` / `en` registrate automaticamente su `@nuxtjs/i18n`
17
+ - ⚡️  Moduli peer (`@nuxtjs/i18n`, `@nuxt/icon`, `@vueuse/nuxt`, `vue-lux/nuxt`, `nuxt-auth-sanctum`, `notivue/nuxt`) installati e preconfigurati via `moduleDependencies()`
18
+
19
+ Richiede Nuxt `>=3.17.0` (Nuxt 4 incluso).
20
+
21
+ ## Quick Setup
22
+
23
+ ```bash
24
+ pnpm add @weconstudio/nuxt
25
+ ```
26
+
27
+ Poi registra il modulo in `nuxt.config.ts`:
28
+
29
+ ```ts
30
+ export default defineNuxtConfig({
31
+ modules: ['@weconstudio/nuxt'],
32
+ })
33
+ ```
34
+
35
+ That's it! Puoi usare `@weconstudio/nuxt` nella tua app Nuxt ✨
36
+
37
+ La documentazione completa di componenti e composables è su
38
+ [nuxt.weconstudio.it](https://nuxt.weconstudio.it/).
39
+
40
+ ## Configurazione
41
+
42
+ Tutte le opzioni stanno sotto la chiave `we` e sono facoltative — qui sono mostrati i valori di default.
43
+
44
+ ```ts
45
+ export default defineNuxtConfig({
46
+ modules: ['@weconstudio/nuxt'],
47
+
48
+ we: {
49
+ host: 'localhost',
50
+ bus: { enabled: true, optionsApi: true },
51
+ notify: { enabled: true, css: true, optionsApi: true },
52
+ portal: { enabled: true },
53
+ form: { enabled: true, formValidatorMixin: true },
54
+ api: {
55
+ baseUrl: '',
56
+ apiSuffix: 'api',
57
+ endpoints: [],
58
+ cache: { ttl: 3600000, max: 10 },
59
+ },
60
+ gen: true,
61
+ },
62
+ })
63
+ ```
64
+
65
+ | Opzione | Descrizione |
66
+ | --- | --- |
67
+ | `host` | Host mostrato nel log di avvio del dev server. |
68
+ | `bus` | Event bus (`useBus`). `optionsApi` aggiunge il plugin per l'Options API. |
69
+ | `notify` | Notifiche via notivue (`useNotify`). `css` accetta `true` per i fogli di stile di default o un array di path. |
70
+ | `portal` | Plugin portal. |
71
+ | `form` | Composables per i form. `formValidatorMixin` espone il mixin per l'Options API. |
72
+ | `api` | `useApi` / `useApiFetch`: base URL, suffisso, endpoint e cache LRU (`ttl` in ms, `max` voci). |
73
+ | `gen` | Pagina generatore su `/gen`. Attiva **solo in dev**, anche quando è `true`. |
74
+
75
+ ## Contribution
76
+
77
+ <details>
78
+ <summary>Local development</summary>
79
+
80
+ ```bash
81
+ # Installa le dipendenze
82
+ pnpm install
83
+
84
+ # Genera i type stub
85
+ pnpm dev:prepare
86
+
87
+ # Sviluppa con il playground
88
+ pnpm dev
89
+
90
+ # Build del playground
91
+ pnpm dev:build
92
+
93
+ # ESLint
94
+ pnpm lint
95
+
96
+ # Vitest
97
+ pnpm test
98
+ pnpm test:watch
99
+
100
+ # Type check (root + playground)
101
+ pnpm test:types
102
+
103
+ # Rilascia una nuova versione
104
+ pnpm release
105
+ ```
106
+
107
+ </details>
108
+
109
+ > [!NOTE]
110
+ > `dist/` è versionato, perché il pacchetto viene consumato direttamente da git.
111
+ > `pnpm release` esegue il build, stagea `dist/` e crea il tag: dopo una modifica a
112
+ > `src/` fai sempre una release, altrimenti i consumer non vedono il cambiamento.
113
+
114
+ <!-- Badges -->
115
+ [nuxt-src]: https://img.shields.io/badge/Nuxt-020420?logo=nuxt.js
116
+ [nuxt-href]: https://nuxt.com
@@ -0,0 +1,7 @@
1
+ import { NuxtModule } from '@nuxt/schema';
2
+ import { WeNuxtModuleOptions } from '../dist/runtime/types/module-options.js';
3
+ export * from '../dist/runtime/types/index.js';
4
+
5
+ declare const weNuxtModule: NuxtModule<WeNuxtModuleOptions>;
6
+
7
+ export { weNuxtModule as default };
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "@weconstudio/nuxt",
3
+ "configKey": "we",
4
+ "compatibility": {
5
+ "nuxt": ">=3.17.0"
6
+ },
7
+ "version": "1.72.0",
8
+ "builder": {
9
+ "@nuxt/module-builder": "1.0.2",
10
+ "unbuild": "3.6.1"
11
+ }
12
+ }
@@ -0,0 +1,250 @@
1
+ import { hasNuxtModule, createResolver, defineNuxtModule, extendViteConfig, addVitePlugin, addPlugin, addImportsDir, addImports, addComponentsDir, extendPages, resolveModule, directoryToURL } from '@nuxt/kit';
2
+ import defu from 'defu';
3
+ import { colors } from 'consola/utils';
4
+ import { aliases, vuetifyAliases } from '../dist/runtime/types/icons.js';
5
+
6
+ async function extendsI18n(nuxt, resolve) {
7
+ const configuredLocales = nuxt.options.i18n?.locales;
8
+ const userLangs = configuredLocales?.map((l) => typeof l === "string" ? l : l.code) ?? ["it"];
9
+ const langs = userLangs.filter((lang) => ["it", "en"].includes(lang));
10
+ const langDir = "./runtime/lang";
11
+ nuxt.hook("i18n:registerModule", (register) => {
12
+ register({
13
+ // i file stanno nel modulo, non nell'app: qui `langDir` va assoluto
14
+ langDir: resolve(langDir),
15
+ locales: langs.map((lang) => ({
16
+ code: lang,
17
+ // risolti da @nuxtjs/i18n rispetto al `langDir` sopra
18
+ files: [
19
+ `${lang}.json`
20
+ ]
21
+ }))
22
+ });
23
+ });
24
+ }
25
+ function getVuetifyAliases(nuxt) {
26
+ if (!hasNuxtModule("vuetify-nuxt-module", nuxt)) {
27
+ return {};
28
+ }
29
+ return vuetifyAliases;
30
+ }
31
+ function getNuxtIconsBundle(nuxt) {
32
+ if (!hasNuxtModule("vuetify-nuxt-module", nuxt)) {
33
+ return [];
34
+ }
35
+ const vuetifyIconAliases = getVuetifyAliases(nuxt);
36
+ return Object.values({ ...vuetifyIconAliases, ...aliases }).filter((i) => typeof i === "string").map((i) => i.replace("mdi-", "mdi:"));
37
+ }
38
+ function listenHost(nuxt, options) {
39
+ nuxt.hook("listen", async (server, listener) => {
40
+ let url = listener.url;
41
+ const port = url.match(/:(\d+)\//)[1];
42
+ if (options.host) {
43
+ url = `http://${options.host}:${port}/`;
44
+ console.log(`
45
+ ${colors.green(` \u279C Listening: `)}`, colors.cyan(
46
+ colors.underline(
47
+ decodeURI(url).replace(/:(\d+)\//g, `:${colors.bold("$1")}/`)
48
+ )
49
+ ) + (options.gen ? "" : "\n"));
50
+ }
51
+ if (options.gen) {
52
+ console.log((options.host ? "" : "\n") + colors.green(` \u279C @we/gen: `), `${colors.cyan(
53
+ colors.underline(
54
+ decodeURI(`${url}gen`).replace(/:(\d+)\//g, `:${colors.bold("$1")}/`)
55
+ )
56
+ )}
57
+ `);
58
+ }
59
+ });
60
+ }
61
+
62
+ const resolver = createResolver(import.meta.url);
63
+ const resolve = createResolver(import.meta.url).resolve;
64
+ function addComposable(name, as, from) {
65
+ addImports({
66
+ name,
67
+ // name of the composable to be used
68
+ as: name,
69
+ from: from || resolve(`runtime/composables/${name}`)
70
+ });
71
+ }
72
+ function canResolve(id, rootDir) {
73
+ try {
74
+ return !!resolveModule(id, { url: directoryToURL(rootDir) });
75
+ } catch {
76
+ return false;
77
+ }
78
+ }
79
+ const defaults = {
80
+ host: "localhost",
81
+ bus: {
82
+ enabled: true,
83
+ optionsApi: true
84
+ },
85
+ notify: {
86
+ enabled: true,
87
+ css: true,
88
+ optionsApi: true
89
+ },
90
+ portal: {
91
+ enabled: true
92
+ },
93
+ form: {
94
+ enabled: true,
95
+ formValidatorMixin: true
96
+ },
97
+ api: {
98
+ cache: {
99
+ ttl: 60 * 60 * 1e3,
100
+ // 1 hour
101
+ max: 10
102
+ },
103
+ baseUrl: "",
104
+ apiSuffix: "api",
105
+ endpoints: []
106
+ },
107
+ gen: true
108
+ };
109
+ const weNuxtModule = defineNuxtModule({
110
+ meta: {
111
+ name: "@weconstudio/nuxt",
112
+ configKey: "we",
113
+ compatibility: {
114
+ nuxt: ">=3.17.0"
115
+ }
116
+ },
117
+ defaults,
118
+ moduleDependencies(nuxt) {
119
+ return {
120
+ "@nuxtjs/i18n": {
121
+ version: "^10.6.0",
122
+ optional: false
123
+ },
124
+ "@nuxt/icon": {
125
+ version: "^1.15.0",
126
+ optional: false,
127
+ defaults: {
128
+ clientBundle: {
129
+ scan: {
130
+ globInclude: ["**/*.{vue,js,ts}"],
131
+ globExclude: ["node_modules", "dist", "build", "coverage", "test", "tests", ".*"]
132
+ },
133
+ icons: getNuxtIconsBundle(nuxt)
134
+ }
135
+ }
136
+ },
137
+ "vue-lux/nuxt": {
138
+ // nuxt-luxon??
139
+ version: "^1.2.2",
140
+ optional: false
141
+ },
142
+ "@vueuse/nuxt": {
143
+ version: "^11.3.0 || ^14.0.0",
144
+ optional: false
145
+ },
146
+ "nuxt-auth-sanctum": {
147
+ version: "^1.4.1",
148
+ // TODO controllare
149
+ optional: false,
150
+ defaults: {
151
+ mode: "token",
152
+ endpoints: {
153
+ csrf: void 0,
154
+ login: "/login",
155
+ logout: "/logout",
156
+ user: "/user"
157
+ }
158
+ }
159
+ },
160
+ "notivue/nuxt": {
161
+ version: "^2.4.5",
162
+ optional: nuxt.options.we ? nuxt.options.we.notify?.enabled === false : false
163
+ }
164
+ };
165
+ },
166
+ async setup(_options, _nuxt) {
167
+ const isDev = !!_nuxt.options.dev;
168
+ _nuxt.options.runtimeConfig.public.we = defu(_nuxt.options.runtimeConfig.public.we, _options);
169
+ listenHost(_nuxt, _nuxt.options.runtimeConfig.public.we);
170
+ _nuxt.options.build.transpile.push(resolve("./runtime"));
171
+ const dedupe = ["vue", "vuetify"];
172
+ if (_options.notify.enabled && canResolve("notivue", _nuxt.options.rootDir)) {
173
+ dedupe.push("notivue");
174
+ }
175
+ extendViteConfig((config) => {
176
+ config.resolve ??= {};
177
+ config.resolve.dedupe = [.../* @__PURE__ */ new Set([...config.resolve.dedupe ?? [], ...dedupe])];
178
+ });
179
+ if (process.env.BUNDLE_SBOM === "true" && !isDev) {
180
+ const { default: sbom } = await import('rollup-plugin-sbom');
181
+ addVitePlugin(sbom({ includeWellKnown: false }), { server: false, dev: false });
182
+ }
183
+ if (_options.bus.enabled) {
184
+ addComposable("useBus");
185
+ if (_options.bus.optionsApi) {
186
+ addPlugin(resolve("./runtime/plugins/bus-legacy"));
187
+ }
188
+ }
189
+ if (_options.notify.enabled) {
190
+ const notivueCss = Array.isArray(_options.notify.css) ? _options.notify.css : _options.notify.css === true ? ["notivue/notification.css", "notivue/animations.css"] : [];
191
+ _nuxt.options.css.push(...notivueCss);
192
+ addComposable("useNotify");
193
+ if (_options.notify.optionsApi) {
194
+ addPlugin(resolve("./runtime/plugins/notify-legacy"));
195
+ }
196
+ }
197
+ addComposable("useLux");
198
+ extendsI18n(_nuxt, resolver.resolve);
199
+ if (hasNuxtModule("vuetify-nuxt-module", _nuxt)) {
200
+ addPlugin(resolve("./runtime/plugins/vuetify-nuxt-icon"));
201
+ }
202
+ addImportsDir(resolve("./runtime/utils"));
203
+ addImports({ from: resolve("./runtime/composables/useDateRangePresets"), name: "useDateRangePresets" });
204
+ if (_options.portal.enabled) {
205
+ addPlugin(resolve("./runtime/plugins/portal"));
206
+ }
207
+ if (_options.form.enabled) {
208
+ addComposable("useFormWrapper");
209
+ addComposable("useValidators");
210
+ addComposable("useServerErrors");
211
+ addComposable("useForm");
212
+ if (_options.form.formValidatorMixin) {
213
+ addImports({
214
+ name: "formValidatorMixin",
215
+ from: resolve(`runtime/mixins/formValidator`)
216
+ });
217
+ }
218
+ }
219
+ addComposable("useApiUrl");
220
+ addComposable("useDataTable", void 0, resolve(`runtime/composables/datatable/useDataTable`));
221
+ addComposable("useAutoFillHeight", void 0, resolve(`runtime/composables/datatable/useAutoFillHeight`));
222
+ addPlugin(resolve("./runtime/plugins/update-sanctum-app-config"));
223
+ addComposable("useAuth");
224
+ addPlugin(resolve("./runtime/plugins/auth-legacy"));
225
+ addComposable("useApi");
226
+ addComposable("useApiFetch");
227
+ addPlugin(resolve("./runtime/plugins/api-legacy"));
228
+ addComposable("usePaginatedFetch");
229
+ addComposable("useImportJob");
230
+ addComponentsDir({
231
+ path: resolve("./runtime/components/We"),
232
+ prefix: "We"
233
+ });
234
+ if (_options.gen && isDev) {
235
+ addPlugin(resolve("./runtime/generator/fs.js"));
236
+ extendPages((pages) => {
237
+ pages.unshift({
238
+ path: "/gen",
239
+ name: "gen",
240
+ file: resolve("./runtime/generator/index.vue")
241
+ });
242
+ });
243
+ }
244
+ _nuxt.hook("prepare:types", ({ references }) => {
245
+ references.push({ path: resolve("./runtime/types") });
246
+ });
247
+ }
248
+ });
249
+
250
+ export { weNuxtModule as default };
@@ -0,0 +1,13 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {
2
+ $emit: (event: "error", ...args: any[]) => void;
3
+ extraParams: Record<string, any>;
4
+ paginate: boolean | Record<string, any>;
5
+ resource: string;
6
+ multiple: boolean;
7
+ field: string;
8
+ clearable: boolean;
9
+ readonly: boolean;
10
+ disabled: boolean;
11
+ $props: any;
12
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
13
+ export default _default;
@@ -0,0 +1,91 @@
1
+ <template>
2
+ <v-combobox
3
+ v-model:search="search"
4
+ v-bind="$attrs"
5
+ :clearable="clearable && !isReadonly"
6
+ :readonly="isReadonly"
7
+ :disabled="isDisabled"
8
+ :items="allItems"
9
+ :no-filter="usePagination"
10
+ >
11
+ <template #append-item>
12
+ <v-card
13
+ v-if="hasMore"
14
+ v-intersect="infiniteScrolling"
15
+ :loading="loading"
16
+ />
17
+ </template>
18
+ </v-combobox>
19
+ </template>
20
+
21
+ <script setup>
22
+ import { computed, ref, toRef, useAttrs } from "vue";
23
+ import { useFormLock } from "../../composables/useFormLock";
24
+ import { usePaginatedFetch } from "../../composables/usePaginatedFetch";
25
+ const props = defineProps({
26
+ resource: {
27
+ type: String,
28
+ required: true
29
+ },
30
+ extraParams: {
31
+ type: Object,
32
+ default: () => ({})
33
+ },
34
+ multiple: {
35
+ type: Boolean,
36
+ default: false
37
+ },
38
+ paginate: {
39
+ type: [Boolean, Object],
40
+ default: false
41
+ },
42
+ field: {
43
+ type: String,
44
+ default: ""
45
+ },
46
+ clearable: Boolean,
47
+ readonly: {
48
+ type: Boolean,
49
+ default: null
50
+ },
51
+ disabled: {
52
+ type: Boolean,
53
+ default: null
54
+ }
55
+ });
56
+ const emit = defineEmits(["error"]);
57
+ const { isReadonly, isDisabled } = useFormLock(props);
58
+ const attrs = useAttrs();
59
+ const multiple = toRef(props, "multiple");
60
+ const lazy = ref(false);
61
+ const search = ref(null);
62
+ const usePagination = computed(() => props.paginate !== false);
63
+ const extraParams = ref(props.extraParams);
64
+ const { items, hasMore, loadMore, loading } = usePaginatedFetch(
65
+ toRef(props, "resource"),
66
+ {
67
+ extraParams,
68
+ paginate: toRef(props, "paginate"),
69
+ search,
70
+ lazy,
71
+ onError: (e) => {
72
+ emit("error", e);
73
+ }
74
+ }
75
+ );
76
+ const allItems = computed(() => {
77
+ const allItems2 = [...items.value];
78
+ if (attrs.modelValue) {
79
+ const existingIds = new Set(allItems2.map((item) => item[props.itemValue]));
80
+ const modelValues = multiple.value ? attrs.modelValue : [attrs.modelValue];
81
+ allItems2.push(...modelValues.filter((val) => !existingIds.has(val[props.itemValue])));
82
+ }
83
+ return allItems2;
84
+ });
85
+ function infiniteScrolling(isIntersecting) {
86
+ if (!isIntersecting || !hasMore.value || loading.value) {
87
+ return;
88
+ }
89
+ loadMore();
90
+ }
91
+ </script>
@@ -0,0 +1,13 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {
2
+ $emit: (event: "error", ...args: any[]) => void;
3
+ extraParams: Record<string, any>;
4
+ paginate: boolean | Record<string, any>;
5
+ resource: string;
6
+ multiple: boolean;
7
+ field: string;
8
+ clearable: boolean;
9
+ readonly: boolean;
10
+ disabled: boolean;
11
+ $props: any;
12
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
13
+ export default _default;
@@ -0,0 +1,17 @@
1
+ type __VLS_Props = {
2
+ bold?: boolean;
3
+ };
4
+ declare var __VLS_1: {}, __VLS_3: {};
5
+ type __VLS_Slots = {} & {
6
+ default?: (props: typeof __VLS_1) => any;
7
+ } & {
8
+ default?: (props: typeof __VLS_3) => any;
9
+ };
10
+ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
12
+ export default _default;
13
+ type __VLS_WithSlots<T, S> = T & {
14
+ new (): {
15
+ $slots: S;
16
+ };
17
+ };
@@ -0,0 +1,29 @@
1
+ <template>
2
+ <span
3
+ v-bind="$attrs"
4
+ style="white-space: nowrap;"
5
+ class="d-flex flex-column flex-nowrap"
6
+ >
7
+ <!-- Invisible bold text reserves space -->
8
+ <span
9
+ class="status-text font-weight-bold"
10
+ style="opacity: 0; margin-bottom: -1.5em;"
11
+ >
12
+ <slot />
13
+ </span>
14
+ <!-- Visible text toggles bold -->
15
+ <span
16
+ class="status-text"
17
+ :class="{ 'font-weight-bold': bold }"
18
+ style=""
19
+ >
20
+ <slot />
21
+ </span>
22
+ </span>
23
+ </template>
24
+
25
+ <script setup>
26
+ const { bold = true } = defineProps({
27
+ bold: { type: Boolean, required: false }
28
+ });
29
+ </script>
@@ -0,0 +1,17 @@
1
+ type __VLS_Props = {
2
+ bold?: boolean;
3
+ };
4
+ declare var __VLS_1: {}, __VLS_3: {};
5
+ type __VLS_Slots = {} & {
6
+ default?: (props: typeof __VLS_1) => any;
7
+ } & {
8
+ default?: (props: typeof __VLS_3) => any;
9
+ };
10
+ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
12
+ export default _default;
13
+ type __VLS_WithSlots<T, S> = T & {
14
+ new (): {
15
+ $slots: S;
16
+ };
17
+ };
@@ -0,0 +1,11 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {
2
+ $emit: (event: "update:modelValue", ...args: any[]) => void;
3
+ readonly: boolean;
4
+ disabled: boolean;
5
+ colors: unknown[];
6
+ maxWidth: string | number;
7
+ hideCustomColors: boolean;
8
+ modelValue?: string | undefined;
9
+ $props: any;
10
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
11
+ export default _default;