@xleddyl/443-components-vue 0.0.0 → 0.2.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 (214) hide show
  1. package/README.md +81 -20
  2. package/dist/chart/BarChart.vue.d.ts +6 -6
  3. package/dist/chart/ChartLegend.vue.d.ts +16 -16
  4. package/dist/chart/ChartPanel.vue +10 -6
  5. package/dist/chart/ChartPanel.vue.d.ts +6 -8
  6. package/dist/chart/ChartSummary.vue.d.ts +6 -6
  7. package/dist/chart/DoughnutChart.vue.d.ts +6 -6
  8. package/dist/chart/LineChart.vue.d.ts +6 -6
  9. package/dist/components/core/Button.vue +3 -1
  10. package/dist/components/core/Button.vue.d.ts +6 -6
  11. package/dist/components/core/FormField.vue.d.ts +6 -6
  12. package/dist/components/core/Icon.vue +9 -1
  13. package/dist/components/core/Icon.vue.d.ts +4 -4
  14. package/dist/components/core/Input.vue +6 -3
  15. package/dist/components/core/Input.vue.d.ts +18 -19
  16. package/dist/components/core/Kbd.vue.d.ts +6 -6
  17. package/dist/components/core/Root.vue.d.ts +10 -10
  18. package/dist/components/core/Spinner.vue +7 -3
  19. package/dist/components/core/Spinner.vue.d.ts +6 -7
  20. package/dist/components/core/Textarea.vue +36 -23
  21. package/dist/components/core/Textarea.vue.d.ts +31 -21
  22. package/dist/components/core/VisuallyHidden.vue.d.ts +10 -10
  23. package/dist/components/data/Avatar.vue +4 -2
  24. package/dist/components/data/Avatar.vue.d.ts +6 -6
  25. package/dist/components/data/AvatarGroup.vue +5 -2
  26. package/dist/components/data/AvatarGroup.vue.d.ts +7 -8
  27. package/dist/components/data/Badge.vue.d.ts +6 -6
  28. package/dist/components/data/DescriptionList.vue +7 -3
  29. package/dist/components/data/DescriptionList.vue.d.ts +7 -8
  30. package/dist/components/data/FilterPills.vue +13 -4
  31. package/dist/components/data/FilterPills.vue.d.ts +16 -18
  32. package/dist/components/data/Pagination.vue +23 -14
  33. package/dist/components/data/Pagination.vue.d.ts +16 -23
  34. package/dist/components/data/Stat.vue +9 -6
  35. package/dist/components/data/Stat.vue.d.ts +10 -13
  36. package/dist/components/data/Table.vue +12 -7
  37. package/dist/components/data/Tag.vue +7 -4
  38. package/dist/components/data/Tag.vue.d.ts +16 -17
  39. package/dist/components/data/Timeline.vue.d.ts +6 -6
  40. package/dist/components/data/Tree.vue +5 -2
  41. package/dist/components/data/Tree.vue.d.ts +16 -17
  42. package/dist/components/feedback/Alert.vue +5 -2
  43. package/dist/components/feedback/Alert.vue.d.ts +14 -15
  44. package/dist/components/feedback/EmptyState.vue.d.ts +7 -7
  45. package/dist/components/feedback/LoadingOverlay.vue +8 -4
  46. package/dist/components/feedback/LoadingOverlay.vue.d.ts +6 -7
  47. package/dist/components/feedback/Meter.vue.d.ts +6 -6
  48. package/dist/components/feedback/Progress.vue +6 -3
  49. package/dist/components/feedback/Progress.vue.d.ts +6 -7
  50. package/dist/components/feedback/ProgressRing.vue +5 -2
  51. package/dist/components/feedback/ProgressRing.vue.d.ts +6 -7
  52. package/dist/components/feedback/Skeleton.vue.d.ts +6 -6
  53. package/dist/components/forms/Calendar.vue +16 -11
  54. package/dist/components/forms/Calendar.vue.d.ts +17 -21
  55. package/dist/components/forms/ColorInput.vue +8 -4
  56. package/dist/components/forms/ColorInput.vue.d.ts +18 -20
  57. package/dist/components/forms/Combobox.vue +31 -19
  58. package/dist/components/forms/Combobox.vue.d.ts +2 -2
  59. package/dist/components/forms/DateInput.vue.d.ts +16 -16
  60. package/dist/components/forms/DatePicker.vue +17 -11
  61. package/dist/components/forms/DatePicker.vue.d.ts +14 -18
  62. package/dist/components/forms/FileInput.vue +23 -13
  63. package/dist/components/forms/FileInput.vue.d.ts +17 -23
  64. package/dist/components/forms/InputAddon.vue.d.ts +6 -6
  65. package/dist/components/forms/InputGroup.vue.d.ts +6 -6
  66. package/dist/components/forms/NumberInput.vue +15 -10
  67. package/dist/components/forms/NumberInput.vue.d.ts +16 -19
  68. package/dist/components/forms/PasswordInput.vue +21 -13
  69. package/dist/components/forms/PasswordInput.vue.d.ts +14 -20
  70. package/dist/components/forms/PinInput.vue +7 -2
  71. package/dist/components/forms/PinInput.vue.d.ts +18 -16
  72. package/dist/components/forms/Radio.vue.d.ts +6 -6
  73. package/dist/components/forms/Slider.vue.d.ts +18 -18
  74. package/dist/components/forms/Switch.vue.d.ts +16 -16
  75. package/dist/components/forms/TimeInput.vue.d.ts +16 -16
  76. package/dist/components/layout/Accordion.vue.d.ts +16 -16
  77. package/dist/components/layout/AppShell.vue +11 -6
  78. package/dist/components/layout/AppShell.vue.d.ts +16 -19
  79. package/dist/components/layout/Breadcrumbs.vue +5 -2
  80. package/dist/components/layout/Breadcrumbs.vue.d.ts +6 -7
  81. package/dist/components/layout/Card.vue.d.ts +8 -8
  82. package/dist/components/layout/CopyButton.vue +11 -6
  83. package/dist/components/layout/CopyButton.vue.d.ts +16 -18
  84. package/dist/components/layout/Grid.vue.d.ts +7 -7
  85. package/dist/components/layout/NavLink.vue.d.ts +10 -10
  86. package/dist/components/layout/PageHeader.vue.d.ts +6 -6
  87. package/dist/components/layout/Separator.vue.d.ts +6 -6
  88. package/dist/components/layout/Sidebar.vue +10 -5
  89. package/dist/components/layout/Sidebar.vue.d.ts +7 -11
  90. package/dist/components/layout/SidebarSection.vue.d.ts +6 -6
  91. package/dist/components/layout/Stack.vue.d.ts +10 -10
  92. package/dist/components/layout/Tabs.vue.d.ts +16 -16
  93. package/dist/components/layout/ThemeSwitch.vue +12 -6
  94. package/dist/components/layout/ThemeSwitch.vue.d.ts +6 -7
  95. package/dist/components/layout/Toolbar.vue.d.ts +6 -6
  96. package/dist/components/overlays/CommandPalette.vue +38 -24
  97. package/dist/components/overlays/CommandPalette.vue.d.ts +18 -30
  98. package/dist/components/overlays/ConfirmDialog.vue +14 -9
  99. package/dist/components/overlays/ConfirmDialog.vue.d.ts +12 -15
  100. package/dist/components/overlays/ConfirmHost.vue +6 -3
  101. package/dist/components/overlays/ConfirmHost.vue.d.ts +16 -16
  102. package/dist/components/overlays/ContextMenu.vue +6 -3
  103. package/dist/components/overlays/ContextMenu.vue.d.ts +11 -13
  104. package/dist/components/overlays/Drawer.vue +1 -1
  105. package/dist/components/overlays/Drawer.vue.d.ts +10 -11
  106. package/dist/components/overlays/DropdownMenu.vue.d.ts +10 -10
  107. package/dist/components/overlays/HoverCard.vue.d.ts +16 -16
  108. package/dist/components/overlays/Modal.vue +1 -1
  109. package/dist/components/overlays/Modal.vue.d.ts +10 -11
  110. package/dist/components/overlays/OverlayHost.vue.d.ts +1 -1
  111. package/dist/components/overlays/Popover.vue.d.ts +16 -16
  112. package/dist/components/overlays/Toaster.vue +8 -4
  113. package/dist/components/overlays/Toaster.vue.d.ts +8 -10
  114. package/dist/components/overlays/Tooltip.vue.d.ts +6 -6
  115. package/dist/components/templates/AccountMenu.vue +5 -2
  116. package/dist/components/templates/AccountMenu.vue.d.ts +18 -19
  117. package/dist/components/templates/AppearanceSettings.vue +26 -12
  118. package/dist/components/templates/AppearanceSettings.vue.d.ts +7 -11
  119. package/dist/components/templates/AuthLayout.vue +11 -7
  120. package/dist/components/templates/AuthLayout.vue.d.ts +6 -9
  121. package/dist/components/templates/Brand.vue.d.ts +10 -10
  122. package/dist/components/templates/DashboardLayout.vue +25 -16
  123. package/dist/components/templates/DashboardLayout.vue.d.ts +12 -24
  124. package/dist/components/templates/DashboardPage.vue +7 -3
  125. package/dist/components/templates/DashboardPage.vue.d.ts +6 -7
  126. package/dist/components/templates/DetailPage.vue +14 -8
  127. package/dist/components/templates/DetailPage.vue.d.ts +14 -18
  128. package/dist/components/templates/EmptyPage.vue +15 -8
  129. package/dist/components/templates/EmptyPage.vue.d.ts +7 -11
  130. package/dist/components/templates/ErrorPage.vue +32 -25
  131. package/dist/components/templates/ErrorPage.vue.d.ts +6 -6
  132. package/dist/components/templates/FormPage.vue +19 -11
  133. package/dist/components/templates/FormPage.vue.d.ts +3 -3
  134. package/dist/components/templates/ListPage.vue +39 -23
  135. package/dist/components/templates/ListPage.vue.d.ts +2 -2
  136. package/dist/components/templates/NotFoundPage.vue +4 -4
  137. package/dist/components/templates/NotFoundPage.vue.d.ts +1 -1
  138. package/dist/components/templates/SaveBar.vue +20 -11
  139. package/dist/components/templates/SaveBar.vue.d.ts +16 -19
  140. package/dist/components/templates/SettingsGroup.vue.d.ts +7 -7
  141. package/dist/components/templates/SettingsModal.vue +29 -21
  142. package/dist/components/templates/SettingsModal.vue.d.ts +15 -25
  143. package/dist/components/templates/SettingsPage.vue +8 -5
  144. package/dist/components/templates/SettingsPage.vue.d.ts +18 -21
  145. package/dist/components/templates/SettingsSection.vue +7 -3
  146. package/dist/components/templates/SettingsSection.vue.d.ts +8 -9
  147. package/dist/composables/core.d.ts +1 -0
  148. package/dist/composables/core.mjs +1 -0
  149. package/dist/composables/useAlert.mjs +3 -1
  150. package/dist/composables/useConfirm.mjs +5 -3
  151. package/dist/composables/useDirtyGuard.mjs +7 -5
  152. package/dist/composables/useForm.d.ts +4 -1
  153. package/dist/composables/useForm.mjs +33 -16
  154. package/dist/composables/useIcons.d.ts +4 -0
  155. package/dist/composables/useIcons.mjs +10 -0
  156. package/dist/composables/useLocale.d.ts +11 -0
  157. package/dist/composables/useLocale.mjs +26 -0
  158. package/dist/composables/usePasswordStrength.mjs +11 -7
  159. package/dist/composables/usePrompt.mjs +3 -1
  160. package/dist/editor/RichTextEditor.vue +20 -14
  161. package/dist/editor/RichTextEditor.vue.d.ts +22 -15
  162. package/dist/editor/index.d.ts +0 -1
  163. package/dist/editor/index.mjs +0 -1
  164. package/dist/editor/types.d.ts +3 -18
  165. package/dist/grid/DataGrid.vue +11 -2
  166. package/dist/grid/GridToolbar.vue +6 -2
  167. package/dist/grid/GridToolbar.vue.d.ts +21 -20
  168. package/dist/grid/cells/BadgeCell.vue.d.ts +6 -6
  169. package/dist/grid/cells/BooleanCell.vue +5 -2
  170. package/dist/grid/cells/BooleanCell.vue.d.ts +6 -6
  171. package/dist/grid/cells/DateCell.vue +4 -1
  172. package/dist/grid/cells/DateCell.vue.d.ts +6 -6
  173. package/dist/grid/cells/ImageCell.vue.d.ts +6 -6
  174. package/dist/grid/cells/LinkCell.vue.d.ts +6 -6
  175. package/dist/grid/index.d.ts +0 -1
  176. package/dist/grid/index.mjs +0 -1
  177. package/dist/grid/types.d.ts +5 -17
  178. package/dist/icons/collections.d.ts +39 -0
  179. package/dist/icons/collections.mjs +67 -0
  180. package/dist/index.d.ts +4 -1
  181. package/dist/index.mjs +11 -1
  182. package/dist/internal/feedback/LoadingHost.vue +6 -3
  183. package/dist/internal/feedback/LoadingHost.vue.d.ts +0 -1
  184. package/dist/internal/forms/files.mjs +1 -1
  185. package/dist/internal/forms/standard-schema.d.ts +26 -0
  186. package/dist/internal/forms/standard-schema.mjs +21 -0
  187. package/dist/internal/keys.d.ts +4 -1
  188. package/dist/internal/keys.mjs +2 -0
  189. package/dist/internal/overlays/DialogFrame.vue +5 -2
  190. package/dist/internal/overlays/DialogFrame.vue.d.ts +14 -14
  191. package/dist/internal/overlays/MenuList.vue.d.ts +16 -16
  192. package/dist/internal/overlays/OverlayView.vue.d.ts +16 -16
  193. package/dist/internal/overlays/confirm.d.ts +3 -0
  194. package/dist/locale/en.d.ts +2 -0
  195. package/dist/locale/en.mjs +284 -0
  196. package/dist/locale/index.d.ts +16 -0
  197. package/dist/locale/index.mjs +50 -0
  198. package/dist/locale/it.d.ts +2 -0
  199. package/dist/locale/it.mjs +284 -0
  200. package/dist/locale/types.d.ts +292 -0
  201. package/dist/locale/types.mjs +0 -0
  202. package/dist/nuxt/module.d.ts +14 -0
  203. package/dist/nuxt/module.mjs +136 -8
  204. package/dist/nuxt/runtime/layouts/auth.vue.d.ts +16 -16
  205. package/dist/nuxt/runtime/layouts/dashboard.vue.d.ts +16 -16
  206. package/dist/nuxt/runtime/locale.d.ts +2 -0
  207. package/dist/nuxt/runtime/locale.mjs +20 -0
  208. package/dist/styles/core/icon.css +4 -0
  209. package/dist/styles/core/textarea.css +21 -0
  210. package/package.json +1 -1
  211. package/dist/editor/messages.d.ts +0 -2
  212. package/dist/editor/messages.mjs +0 -18
  213. package/dist/grid/messages.d.ts +0 -3
  214. package/dist/grid/messages.mjs +0 -21
@@ -0,0 +1,292 @@
1
+ export type MessageParams = Record<string, string | number>;
2
+ export interface KMessages {
3
+ common: {
4
+ cancel: string;
5
+ confirm: string;
6
+ close: string;
7
+ ok: string;
8
+ clear: string;
9
+ loading: string;
10
+ areYouSure: string;
11
+ noResults: string;
12
+ remove: string;
13
+ dismiss: string;
14
+ copy: string;
15
+ copied: string;
16
+ search: string;
17
+ back: string;
18
+ save: string;
19
+ saveChanges: string;
20
+ discard: string;
21
+ retry: string;
22
+ unsavedChanges: string;
23
+ somethingWentWrong: string;
24
+ selected: string;
25
+ };
26
+ form: {
27
+ required: string;
28
+ min: string;
29
+ max: string;
30
+ minLength: string;
31
+ maxLength: string;
32
+ minItems: string;
33
+ maxItems: string;
34
+ pattern: string;
35
+ invalid: string;
36
+ };
37
+ editor: {
38
+ bold: string;
39
+ italic: string;
40
+ strike: string;
41
+ code: string;
42
+ heading: string;
43
+ bulletList: string;
44
+ orderedList: string;
45
+ blockquote: string;
46
+ link: string;
47
+ undo: string;
48
+ redo: string;
49
+ toolbar: string;
50
+ linkUrl: string;
51
+ applyLink: string;
52
+ removeLink: string;
53
+ characters: string;
54
+ };
55
+ grid: {
56
+ noRows: string;
57
+ loading: string;
58
+ search: string;
59
+ clearSearch: string;
60
+ toolbar: string;
61
+ columns: string;
62
+ resetColumns: string;
63
+ exportCsv: string;
64
+ rowsPerPage: string;
65
+ previousPage: string;
66
+ nextPage: string;
67
+ pageStatus: string;
68
+ selected: string;
69
+ copied: string;
70
+ yes: string;
71
+ no: string;
72
+ };
73
+ account: {
74
+ label: string;
75
+ };
76
+ alert: {
77
+ title: string;
78
+ };
79
+ appearance: {
80
+ theme: string;
81
+ themeDescription: string;
82
+ style: string;
83
+ styleDescription: string;
84
+ };
85
+ auth: {
86
+ aside: string;
87
+ };
88
+ avatar: {
89
+ label: string;
90
+ online: string;
91
+ away: string;
92
+ busy: string;
93
+ offline: string;
94
+ };
95
+ avatarGroup: {
96
+ more: string;
97
+ };
98
+ breadcrumbs: {
99
+ label: string;
100
+ };
101
+ calendar: {
102
+ previousMonth: string;
103
+ nextMonth: string;
104
+ };
105
+ chart: {
106
+ empty: string;
107
+ loading: string;
108
+ };
109
+ colorInput: {
110
+ pick: string;
111
+ swatches: string;
112
+ };
113
+ combobox: {
114
+ clear: string;
115
+ toggle: string;
116
+ list: string;
117
+ create: string;
118
+ results: string;
119
+ };
120
+ commandPalette: {
121
+ placeholder: string;
122
+ label: string;
123
+ recent: string;
124
+ minQuery: string;
125
+ error: string;
126
+ results: string;
127
+ move: string;
128
+ select: string;
129
+ close: string;
130
+ };
131
+ contextMenu: {
132
+ label: string;
133
+ };
134
+ dashboardLayout: {
135
+ pages: string;
136
+ searchPlaceholder: string;
137
+ };
138
+ dashboardPage: {
139
+ stats: string;
140
+ };
141
+ datePicker: {
142
+ placeholder: string;
143
+ clear: string;
144
+ dialog: string;
145
+ range: string;
146
+ };
147
+ descriptionList: {
148
+ empty: string;
149
+ };
150
+ detailPage: {
151
+ sections: string;
152
+ details: string;
153
+ error: string;
154
+ };
155
+ dirtyGuard: {
156
+ title: string;
157
+ description: string;
158
+ confirm: string;
159
+ cancel: string;
160
+ };
161
+ emptyPage: {
162
+ title: string;
163
+ steps: string;
164
+ done: string;
165
+ todo: string;
166
+ };
167
+ errorPage: {
168
+ home: string;
169
+ back: string;
170
+ retry: string;
171
+ badRequestTitle: string;
172
+ badRequestMessage: string;
173
+ signInTitle: string;
174
+ signInMessage: string;
175
+ forbiddenTitle: string;
176
+ forbiddenMessage: string;
177
+ notFoundTitle: string;
178
+ notFoundMessage: string;
179
+ serverTitle: string;
180
+ serverMessage: string;
181
+ unavailableTitle: string;
182
+ unavailableMessage: string;
183
+ };
184
+ fileInput: {
185
+ title: string;
186
+ drop: string;
187
+ list: string;
188
+ selected: string;
189
+ };
190
+ filterPills: {
191
+ label: string;
192
+ };
193
+ listPage: {
194
+ toolbar: string;
195
+ emptyTitle: string;
196
+ noResultsDescription: string;
197
+ clearFilters: string;
198
+ };
199
+ numberInput: {
200
+ increase: string;
201
+ decrease: string;
202
+ };
203
+ pagination: {
204
+ label: string;
205
+ page: string;
206
+ previous: string;
207
+ next: string;
208
+ pageSize: string;
209
+ of: string;
210
+ };
211
+ passwordInput: {
212
+ show: string;
213
+ hide: string;
214
+ generate: string;
215
+ copy: string;
216
+ strength: string;
217
+ };
218
+ passwordStrength: {
219
+ tooShort: string;
220
+ weak: string;
221
+ fair: string;
222
+ good: string;
223
+ strong: string;
224
+ };
225
+ preset: {
226
+ default: string;
227
+ defaultDescription: string;
228
+ suedtirolDescription: string;
229
+ spotfishDescription: string;
230
+ };
231
+ progress: {
232
+ label: string;
233
+ };
234
+ prompt: {
235
+ title: string;
236
+ };
237
+ saveBar: {
238
+ message: string;
239
+ };
240
+ settings: {
241
+ title: string;
242
+ close: string;
243
+ sections: string;
244
+ signOut: string;
245
+ session: string;
246
+ sessionDescription: string;
247
+ accountDescription: string;
248
+ appearance: string;
249
+ appearanceDescription: string;
250
+ };
251
+ shell: {
252
+ sidebar: string;
253
+ openNavigation: string;
254
+ skipToContent: string;
255
+ main: string;
256
+ collapse: string;
257
+ expand: string;
258
+ };
259
+ stat: {
260
+ increased: string;
261
+ decreased: string;
262
+ };
263
+ table: {
264
+ selectAll: string;
265
+ loading: string;
266
+ selectRow: string;
267
+ };
268
+ theme: {
269
+ label: string;
270
+ system: string;
271
+ light: string;
272
+ dark: string;
273
+ };
274
+ toaster: {
275
+ label: string;
276
+ dismiss: string;
277
+ };
278
+ tree: {
279
+ label: string;
280
+ };
281
+ }
282
+ export interface KLocale {
283
+ code: string;
284
+ dir: 'ltr' | 'rtl';
285
+ messages: KMessages;
286
+ }
287
+ export type DeepPartial<T> = {
288
+ [K in keyof T]?: T[K] extends string ? T[K] : DeepPartial<T[K]>;
289
+ };
290
+ export type MessageKey = {
291
+ [N in keyof KMessages & string]: `${N}.${keyof KMessages[N] & string}`;
292
+ }[keyof KMessages & string];
File without changes
@@ -1,7 +1,13 @@
1
1
  import type { KAppConfig } from '../components/templates/types';
2
2
  import type { ThemePreference } from '../composables/useTheme';
3
3
  import type { ThemePreset } from '../internal/core/preset-data';
4
+ import type { DeepPartial, KMessages } from '../locale/types';
4
5
  export type { KAppConfig } from '../components/templates/types';
6
+ export interface IconCollectionOption {
7
+ prefix: string;
8
+ include?: string[];
9
+ exclude?: string[];
10
+ }
5
11
  export interface LayoutsOption {
6
12
  dashboard?: string | false;
7
13
  auth?: string | false;
@@ -10,6 +16,7 @@ export interface ModuleOptions {
10
16
  prefix: string;
11
17
  global: boolean;
12
18
  css: boolean;
19
+ cssLayers: string | false;
13
20
  composables: boolean;
14
21
  grid: boolean;
15
22
  editor: boolean;
@@ -18,6 +25,9 @@ export interface ModuleOptions {
18
25
  cssTarget: string[] | false;
19
26
  icons: {
20
27
  dir?: string;
28
+ collections?: (string | IconCollectionOption)[];
29
+ defaultCollection?: string;
30
+ aliases?: Record<string, string>;
21
31
  };
22
32
  theme: {
23
33
  cookie: string;
@@ -28,6 +38,8 @@ export interface ModuleOptions {
28
38
  default: ThemePreset;
29
39
  };
30
40
  fonts: boolean | ThemePreset[];
41
+ locale: string;
42
+ messages: Record<string, DeepPartial<KMessages>>;
31
43
  }
32
44
  export interface KRuntimeConfig {
33
45
  global: boolean;
@@ -35,6 +47,8 @@ export interface KRuntimeConfig {
35
47
  themeDefault: ThemePreference;
36
48
  presetCookie: string;
37
49
  presetDefault: ThemePreset;
50
+ locale: string;
51
+ messages: Record<string, DeepPartial<KMessages>>;
38
52
  }
39
53
  declare module '@nuxt/schema' {
40
54
  interface PublicRuntimeConfig {
@@ -1,5 +1,6 @@
1
1
  import { existsSync, readdirSync, readFileSync } from "node:fs";
2
2
  import { isAbsolute, join, relative } from "node:path";
3
+ import { fileURLToPath } from "node:url";
3
4
  import {
4
5
  addComponent,
5
6
  addComponentsDir,
@@ -7,6 +8,7 @@ import {
7
8
  addImportsDir,
8
9
  addPlugin,
9
10
  addPluginTemplate,
11
+ addTemplate,
10
12
  createResolver,
11
13
  defineNuxtModule,
12
14
  directoryToURL,
@@ -25,6 +27,7 @@ export default defineNuxtModule({
25
27
  prefix: "K",
26
28
  global: false,
27
29
  css: true,
30
+ cssLayers: "theme, base, k, components, utilities",
28
31
  composables: true,
29
32
  grid: false,
30
33
  editor: false,
@@ -40,7 +43,9 @@ export default defineNuxtModule({
40
43
  cookie: "k-preset",
41
44
  default: "default"
42
45
  },
43
- fonts: true
46
+ fonts: true,
47
+ locale: "en",
48
+ messages: {}
44
49
  },
45
50
  async setup(options, nuxt) {
46
51
  const resolver = createResolver(import.meta.url);
@@ -107,10 +112,13 @@ export default defineNuxtModule({
107
112
  themeCookie: options.theme.cookie,
108
113
  themeDefault: options.theme.default,
109
114
  presetCookie: options.preset.cookie,
110
- presetDefault
115
+ presetDefault,
116
+ locale: options.locale,
117
+ messages: options.messages
111
118
  };
112
119
  addPlugin(resolver.resolve("./runtime/theme"));
113
120
  addPlugin(resolver.resolve("./runtime/storage"));
121
+ addPlugin(resolver.resolve("./runtime/locale"));
114
122
  if (options.composables)
115
123
  addImports({ name: "useDashboard", from: resolver.resolve("./runtime/dashboard") });
116
124
  const layouts = resolveLayouts(options.layouts);
@@ -139,16 +147,65 @@ export default defineNuxtModule({
139
147
  `})`
140
148
  ].join("\n")
141
149
  });
142
- if (options.icons.dir) {
143
- const aliased = resolveAlias(options.icons.dir);
144
- const iconsDir = isAbsolute(aliased) ? aliased : join(nuxt.options.srcDir, aliased);
145
- if (!existsSync(iconsDir)) console.warn(`[@xleddyl/443-components-vue] icons.dir not found: ${iconsDir}`);
150
+ const collections = [];
151
+ for (const entry of options.icons.collections ?? []) {
152
+ const collection = typeof entry === "string" ? { prefix: entry } : entry;
153
+ const file = await resolveCollectionFile(collection.prefix, searchPaths);
154
+ if (!file) {
155
+ console.warn(
156
+ `[@xleddyl/443-components-vue] icon collection "${collection.prefix}" not installed: pnpm add -D @iconify-json/${collection.prefix}`
157
+ );
158
+ continue;
159
+ }
160
+ const data = filterCollection(JSON.parse(readFileSync(file, "utf8")), collection);
161
+ collections.push(data);
162
+ addTemplate({
163
+ filename: `k-icons/${collection.prefix}.mjs`,
164
+ getContents: () => `export default ${JSON.stringify(data)}
165
+ `
166
+ });
167
+ }
168
+ if (collections.length || options.icons.defaultCollection) {
169
+ addPluginTemplate({
170
+ filename: "k-icon-collections.mjs",
171
+ getContents: () => [
172
+ `import { defineNuxtPlugin } from '#app'`,
173
+ `import { ICON_USAGE_KEY, loadIconCollection, registerIconCollection, setDefaultIconCollection } from '@xleddyl/443-components-vue'`,
174
+ ...collections.map(
175
+ (collection) => `registerIconCollection(${JSON.stringify(collection.prefix)}, () => import('#build/k-icons/${collection.prefix}.mjs'))`
176
+ ),
177
+ `setDefaultIconCollection(${JSON.stringify(options.icons.defaultCollection)})`,
178
+ `const prefixes = ${JSON.stringify(collections.map((collection) => collection.prefix))}`,
179
+ `export default defineNuxtPlugin({`,
180
+ ` name: 'k:icon-collections',`,
181
+ ` async setup(nuxtApp) {`,
182
+ ` if (import.meta.server) {`,
183
+ ` await Promise.all(prefixes.map(loadIconCollection))`,
184
+ ` const used = new Set()`,
185
+ ` nuxtApp.vueApp.provide(ICON_USAGE_KEY, used)`,
186
+ ` nuxtApp.hook('app:rendered', () => {`,
187
+ ` nuxtApp.payload.kIconCollections = [...used]`,
188
+ ` })`,
189
+ ` return`,
190
+ ` }`,
191
+ ` const used = nuxtApp.payload.kIconCollections ?? []`,
192
+ ` await Promise.all(used.map(loadIconCollection))`,
193
+ ` },`,
194
+ `})`
195
+ ].join("\n")
196
+ });
197
+ }
198
+ const aliasIcons = resolveAliasIcons(options.icons.aliases ?? {}, collections);
199
+ const iconsDir = options.icons.dir ? resolveIconsDir(options.icons.dir, nuxt.options.srcDir) : void 0;
200
+ if (iconsDir && !existsSync(iconsDir))
201
+ console.warn(`[@xleddyl/443-components-vue] icons.dir not found: ${iconsDir}`);
202
+ if (iconsDir || Object.keys(options.icons.aliases ?? {}).length) {
146
203
  addPluginTemplate({
147
204
  filename: "k-icons.mjs",
148
205
  getContents: () => [
149
206
  `import { defineNuxtPlugin } from '#app'`,
150
207
  `import { createIcons } from '@xleddyl/443-components-vue'`,
151
- `const icons = ${JSON.stringify(readIconsDir(iconsDir), null, 2)}`,
208
+ `const icons = ${JSON.stringify(withDirAliases(iconsDir ? readIconsDir(iconsDir) : {}, aliasIcons, options.icons.aliases ?? {}), null, 2)}`,
152
209
  `export default defineNuxtPlugin({`,
153
210
  ` name: 'k:icons',`,
154
211
  ` setup(nuxtApp) {`,
@@ -158,12 +215,20 @@ export default defineNuxtModule({
158
215
  ].join("\n")
159
216
  });
160
217
  nuxt.hook("builder:watch", async (_event, path) => {
161
- if (!path.endsWith(".svg")) return;
218
+ if (!iconsDir || !path.endsWith(".svg")) return;
162
219
  const candidates = isAbsolute(path) ? [path] : [join(nuxt.options.srcDir, path), join(nuxt.options.rootDir, path)];
163
220
  if (!candidates.some((candidate) => candidate.startsWith(iconsDir))) return;
164
221
  await updateTemplates({ filter: (template) => template.filename === "k-icons.mjs" });
165
222
  });
166
223
  }
224
+ if (options.css && options.cssLayers) {
225
+ const layers = addTemplate({
226
+ filename: "k-layers.css",
227
+ getContents: () => `@layer ${options.cssLayers};
228
+ `
229
+ });
230
+ nuxt.options.css.unshift(layers.dst);
231
+ }
167
232
  }
168
233
  });
169
234
  function resolveLayouts(option) {
@@ -198,6 +263,69 @@ const OPTIONAL_GROUPS = [
198
263
  dependencies: ["chart.js", "chart.js/helpers", "vue-chartjs"]
199
264
  }
200
265
  ];
266
+ function resolveIconsDir(dir, srcDir) {
267
+ const aliased = resolveAlias(dir);
268
+ return isAbsolute(aliased) ? aliased : join(srcDir, aliased);
269
+ }
270
+ async function resolveCollectionFile(prefix, searchPaths) {
271
+ for (const id of [`@iconify-json/${prefix}/icons.json`, `@iconify/json/json/${prefix}.json`]) {
272
+ const resolved = await tryResolveModule(id, searchPaths);
273
+ if (resolved) return resolved.startsWith("file:") ? fileURLToPath(resolved) : resolved;
274
+ }
275
+ return void 0;
276
+ }
277
+ function globToRegExp(pattern) {
278
+ const escaped = pattern.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*");
279
+ return new RegExp(`^${escaped}$`);
280
+ }
281
+ function filterCollection(data, option) {
282
+ const include = (option.include ?? []).map(globToRegExp);
283
+ const exclude = (option.exclude ?? []).map(globToRegExp);
284
+ const keep = (name) => (!include.length || include.some((pattern) => pattern.test(name))) && !exclude.some((pattern) => pattern.test(name));
285
+ const icons = Object.fromEntries(Object.entries(data.icons).filter(([name]) => keep(name)));
286
+ const aliases = Object.fromEntries(
287
+ Object.entries(data.aliases ?? {}).filter(
288
+ ([name, alias]) => keep(name) && alias.parent in icons
289
+ )
290
+ );
291
+ return { prefix: data.prefix, icons, aliases, width: data.width, height: data.height };
292
+ }
293
+ function collectionSvg(collections, name) {
294
+ const index = name.indexOf(":");
295
+ if (index <= 0) return void 0;
296
+ const collection = collections.find((entry) => entry.prefix === name.slice(0, index));
297
+ if (!collection) return void 0;
298
+ let key = name.slice(index + 1);
299
+ for (let depth = 0; depth < 5 && !collection.icons[key]; depth++) {
300
+ const parent = collection.aliases?.[key]?.parent;
301
+ if (!parent) break;
302
+ key = parent;
303
+ }
304
+ const icon = collection.icons[key];
305
+ if (!icon) return void 0;
306
+ const width = icon.width ?? collection.width ?? 16;
307
+ const height = icon.height ?? collection.height ?? 16;
308
+ return `<svg viewBox="${icon.left ?? 0} ${icon.top ?? 0} ${width} ${height}">${icon.body}</svg>`;
309
+ }
310
+ function resolveAliasIcons(aliases, collections) {
311
+ const icons = {};
312
+ for (const [name, target] of Object.entries(aliases)) {
313
+ const svg = collectionSvg(collections, target);
314
+ if (svg) icons[name] = svg;
315
+ }
316
+ return icons;
317
+ }
318
+ function withDirAliases(dirIcons, aliasIcons, aliases) {
319
+ const icons = { ...dirIcons, ...aliasIcons };
320
+ for (const [name, target] of Object.entries(aliases)) {
321
+ if (name in aliasIcons) continue;
322
+ const svg = dirIcons[target];
323
+ if (svg) icons[name] = svg;
324
+ else
325
+ console.warn(`[@xleddyl/443-components-vue] icon alias "${name}" -> "${target}" not found`);
326
+ }
327
+ return icons;
328
+ }
201
329
  function readIconsDir(dir) {
202
330
  if (!existsSync(dir)) return {};
203
331
  const icons = {};
@@ -15,17 +15,19 @@ declare const __VLS_base: import("vue").DefineComponent<Partial<NonNullable<{
15
15
  readonly inlist?: any;
16
16
  readonly download?: any;
17
17
  readonly key?: PropertyKey | undefined;
18
+ readonly prefix?: string | undefined | undefined;
19
+ readonly title?: string | undefined | undefined;
20
+ readonly style?: import("vue").StyleValue;
21
+ readonly results?: (string | number) | undefined;
22
+ readonly placeholder?: string | undefined | undefined;
18
23
  readonly bind?: Record<string, unknown> | undefined;
19
24
  readonly type?: string | undefined | undefined;
20
25
  readonly ref?: import("vue").VNodeRef | undefined;
21
- readonly placeholder?: string | undefined | undefined;
22
26
  readonly target?: string | undefined | undefined;
23
27
  readonly class?: import("vue").ClassValue;
24
28
  readonly role?: string | undefined | undefined;
25
29
  readonly 'aria-label'?: string | undefined | undefined;
26
30
  readonly 'aria-hidden'?: (boolean | "true" | "false") | undefined;
27
- readonly style?: import("vue").StyleValue;
28
- readonly title?: string | undefined | undefined;
29
31
  readonly onCopy?: ((payload: ClipboardEvent) => void) | undefined;
30
32
  readonly onCut?: ((payload: ClipboardEvent) => void) | undefined;
31
33
  readonly onPaste?: ((payload: ClipboardEvent) => void) | undefined;
@@ -136,7 +138,7 @@ declare const __VLS_base: import("vue").DefineComponent<Partial<NonNullable<{
136
138
  readonly 'aria-colindex'?: (string | number) | undefined;
137
139
  readonly 'aria-colspan'?: (string | number) | undefined;
138
140
  readonly 'aria-controls'?: string | undefined | undefined;
139
- readonly 'aria-current'?: "location" | "time" | (boolean | "true" | "false") | "page" | "step" | "date" | undefined;
141
+ readonly 'aria-current'?: "page" | "location" | "time" | (boolean | "true" | "false") | "step" | "date" | undefined;
140
142
  readonly 'aria-describedby'?: string | undefined | undefined;
141
143
  readonly 'aria-details'?: string | undefined | undefined;
142
144
  readonly 'aria-disabled'?: (boolean | "true" | "false") | undefined;
@@ -145,7 +147,7 @@ declare const __VLS_base: import("vue").DefineComponent<Partial<NonNullable<{
145
147
  readonly 'aria-expanded'?: (boolean | "true" | "false") | undefined;
146
148
  readonly 'aria-flowto'?: string | undefined | undefined;
147
149
  readonly 'aria-grabbed'?: (boolean | "true" | "false") | undefined;
148
- readonly 'aria-haspopup'?: "dialog" | "menu" | (boolean | "true" | "false") | "listbox" | "tree" | "grid" | undefined;
150
+ readonly 'aria-haspopup'?: "grid" | "tree" | "dialog" | "menu" | (boolean | "true" | "false") | "listbox" | undefined;
149
151
  readonly 'aria-invalid'?: (boolean | "true" | "false") | "grammar" | "spelling" | undefined;
150
152
  readonly 'aria-keyshortcuts'?: string | undefined | undefined;
151
153
  readonly 'aria-labelledby'?: string | undefined | undefined;
@@ -181,7 +183,7 @@ declare const __VLS_base: import("vue").DefineComponent<Partial<NonNullable<{
181
183
  readonly dir?: string | undefined | undefined;
182
184
  readonly draggable?: (boolean | "true" | "false") | undefined;
183
185
  readonly enterkeyhint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined | undefined;
184
- readonly enterKeyHint?: "search" | "done" | "enter" | "go" | "next" | "previous" | "send" | undefined;
186
+ readonly enterKeyHint?: "search" | "done" | "previous" | "next" | "enter" | "go" | "send" | undefined;
185
187
  readonly hidden?: "" | (boolean | "true" | "false") | "hidden" | "until-found" | undefined;
186
188
  readonly inert?: (boolean | "true" | "false") | undefined;
187
189
  readonly spellcheck?: (boolean | "true" | "false") | undefined;
@@ -189,7 +191,6 @@ declare const __VLS_base: import("vue").DefineComponent<Partial<NonNullable<{
189
191
  readonly radiogroup?: string | undefined | undefined;
190
192
  readonly about?: string | undefined | undefined;
191
193
  readonly datatype?: string | undefined | undefined;
192
- readonly prefix?: string | undefined | undefined;
193
194
  readonly property?: string | undefined | undefined;
194
195
  readonly resource?: string | undefined | undefined;
195
196
  readonly typeof?: string | undefined | undefined;
@@ -202,7 +203,6 @@ declare const __VLS_base: import("vue").DefineComponent<Partial<NonNullable<{
202
203
  readonly itemtype?: string | undefined | undefined;
203
204
  readonly itemid?: string | undefined | undefined;
204
205
  readonly itemref?: string | undefined | undefined;
205
- readonly results?: (string | number) | undefined;
206
206
  readonly security?: string | undefined | undefined;
207
207
  readonly unselectable?: "on" | "off" | undefined | undefined;
208
208
  readonly inputmode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined | undefined;
@@ -233,17 +233,19 @@ declare const __VLS_base: import("vue").DefineComponent<Partial<NonNullable<{
233
233
  readonly inlist?: any;
234
234
  readonly download?: any;
235
235
  readonly key?: PropertyKey | undefined;
236
+ readonly prefix?: string | undefined | undefined;
237
+ readonly title?: string | undefined | undefined;
238
+ readonly style?: import("vue").StyleValue;
239
+ readonly results?: (string | number) | undefined;
240
+ readonly placeholder?: string | undefined | undefined;
236
241
  readonly bind?: Record<string, unknown> | undefined;
237
242
  readonly type?: string | undefined | undefined;
238
243
  readonly ref?: import("vue").VNodeRef | undefined;
239
- readonly placeholder?: string | undefined | undefined;
240
244
  readonly target?: string | undefined | undefined;
241
245
  readonly class?: import("vue").ClassValue;
242
246
  readonly role?: string | undefined | undefined;
243
247
  readonly 'aria-label'?: string | undefined | undefined;
244
248
  readonly 'aria-hidden'?: (boolean | "true" | "false") | undefined;
245
- readonly style?: import("vue").StyleValue;
246
- readonly title?: string | undefined | undefined;
247
249
  readonly onCopy?: ((payload: ClipboardEvent) => void) | undefined;
248
250
  readonly onCut?: ((payload: ClipboardEvent) => void) | undefined;
249
251
  readonly onPaste?: ((payload: ClipboardEvent) => void) | undefined;
@@ -354,7 +356,7 @@ declare const __VLS_base: import("vue").DefineComponent<Partial<NonNullable<{
354
356
  readonly 'aria-colindex'?: (string | number) | undefined;
355
357
  readonly 'aria-colspan'?: (string | number) | undefined;
356
358
  readonly 'aria-controls'?: string | undefined | undefined;
357
- readonly 'aria-current'?: "location" | "time" | (boolean | "true" | "false") | "page" | "step" | "date" | undefined;
359
+ readonly 'aria-current'?: "page" | "location" | "time" | (boolean | "true" | "false") | "step" | "date" | undefined;
358
360
  readonly 'aria-describedby'?: string | undefined | undefined;
359
361
  readonly 'aria-details'?: string | undefined | undefined;
360
362
  readonly 'aria-disabled'?: (boolean | "true" | "false") | undefined;
@@ -363,7 +365,7 @@ declare const __VLS_base: import("vue").DefineComponent<Partial<NonNullable<{
363
365
  readonly 'aria-expanded'?: (boolean | "true" | "false") | undefined;
364
366
  readonly 'aria-flowto'?: string | undefined | undefined;
365
367
  readonly 'aria-grabbed'?: (boolean | "true" | "false") | undefined;
366
- readonly 'aria-haspopup'?: "dialog" | "menu" | (boolean | "true" | "false") | "listbox" | "tree" | "grid" | undefined;
368
+ readonly 'aria-haspopup'?: "grid" | "tree" | "dialog" | "menu" | (boolean | "true" | "false") | "listbox" | undefined;
367
369
  readonly 'aria-invalid'?: (boolean | "true" | "false") | "grammar" | "spelling" | undefined;
368
370
  readonly 'aria-keyshortcuts'?: string | undefined | undefined;
369
371
  readonly 'aria-labelledby'?: string | undefined | undefined;
@@ -399,7 +401,7 @@ declare const __VLS_base: import("vue").DefineComponent<Partial<NonNullable<{
399
401
  readonly dir?: string | undefined | undefined;
400
402
  readonly draggable?: (boolean | "true" | "false") | undefined;
401
403
  readonly enterkeyhint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined | undefined;
402
- readonly enterKeyHint?: "search" | "done" | "enter" | "go" | "next" | "previous" | "send" | undefined;
404
+ readonly enterKeyHint?: "search" | "done" | "previous" | "next" | "enter" | "go" | "send" | undefined;
403
405
  readonly hidden?: "" | (boolean | "true" | "false") | "hidden" | "until-found" | undefined;
404
406
  readonly inert?: (boolean | "true" | "false") | undefined;
405
407
  readonly spellcheck?: (boolean | "true" | "false") | undefined;
@@ -407,7 +409,6 @@ declare const __VLS_base: import("vue").DefineComponent<Partial<NonNullable<{
407
409
  readonly radiogroup?: string | undefined | undefined;
408
410
  readonly about?: string | undefined | undefined;
409
411
  readonly datatype?: string | undefined | undefined;
410
- readonly prefix?: string | undefined | undefined;
411
412
  readonly property?: string | undefined | undefined;
412
413
  readonly resource?: string | undefined | undefined;
413
414
  readonly typeof?: string | undefined | undefined;
@@ -420,7 +421,6 @@ declare const __VLS_base: import("vue").DefineComponent<Partial<NonNullable<{
420
421
  readonly itemtype?: string | undefined | undefined;
421
422
  readonly itemid?: string | undefined | undefined;
422
423
  readonly itemref?: string | undefined | undefined;
423
- readonly results?: (string | number) | undefined;
424
424
  readonly security?: string | undefined | undefined;
425
425
  readonly unselectable?: "on" | "off" | undefined | undefined;
426
426
  readonly inputmode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined | undefined;