vlite3 1.5.4 → 1.5.6

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 (78) hide show
  1. package/README.md +105 -0
  2. package/VLiteIconsVite.d.ts +36 -0
  3. package/components/AppShell/AppShell.vue.d.ts +1 -1
  4. package/components/AppShell/AppShellLayoutDashboard.vue.js +3 -2
  5. package/components/AppShell/AppShellLayoutDock.vue.js +3 -2
  6. package/components/AppShell/AppShellLayoutHeaderShell.vue.js +28 -27
  7. package/components/AppShell/AppShellLayoutSidebarFirst.vue.js +3 -2
  8. package/components/AsyncSelect/createAsyncSelect.d.ts +4 -4
  9. package/components/AsyncSelect/createAsyncSelect.js +3 -2
  10. package/components/BackButton.vue.d.ts +1 -1
  11. package/components/Calendar/Calendar.vue.js +1 -1
  12. package/components/Calendar/Calendar.vue2.js +29 -29
  13. package/components/CategoryManager/CategoryManager.vue2.js +14 -14
  14. package/components/CategoryManager/CategoryNode.vue.js +16 -16
  15. package/components/CategoryMenu/CategoryMenu.vue.js +9 -8
  16. package/components/Chart/BarChart.vue.d.ts +1 -1
  17. package/components/Chart/GanttChart.vue.d.ts +3 -1
  18. package/components/Chart/GanttChart.vue.js +2 -2
  19. package/components/Chart/GanttChart.vue2.js +591 -656
  20. package/components/Chart/LineChart.vue.d.ts +1 -1
  21. package/components/Chart/TimelineChart.vue.d.ts +1 -1
  22. package/components/ColorPicker/ColorIro.vue3.js +2 -2
  23. package/components/ColorPicker/ColorPicker.vue.js +2 -2
  24. package/components/ConfirmationModal.vue.d.ts +4 -0
  25. package/components/ConfirmationModal.vue.js +47 -39
  26. package/components/DataTable/DataTable.vue.js +319 -294
  27. package/components/DataTable/DataTableRow.vue.d.ts +2 -0
  28. package/components/DataTable/DataTableRow.vue.js +2 -2
  29. package/components/DataTable/DataTableRow.vue2.js +57 -54
  30. package/components/DataTable/types.d.ts +2 -0
  31. package/components/DatePicker.vue.js +5 -4
  32. package/components/Empty/Empty.vue.js +3 -2
  33. package/components/ExportData/ExportData.vue.d.ts +1 -1
  34. package/components/Form/Form.vue2.js +44 -43
  35. package/components/Form/FormField.vue.js +24 -24
  36. package/components/Heatmap/Heatmap.vue2.js +3 -2
  37. package/components/Icon.vue.d.ts +3 -2
  38. package/components/Icon.vue.js +22 -12
  39. package/components/IconPicker.vue.js +5 -133
  40. package/components/IconPicker.vue2.js +218 -2
  41. package/components/ImportData/ImportData.vue.js +3 -2
  42. package/components/ImportData/ImportStep2.vue.js +3 -2
  43. package/components/Kanban/KanbanBoard.vue2.js +4 -2
  44. package/components/List/utils.js +5 -4
  45. package/components/Masonry/Masonry.vue2.js +14 -13
  46. package/components/Navbar/Navbar.vue.d.ts +1 -1
  47. package/components/Price/Price.vue.js +13 -12
  48. package/components/QRCode/QRCode.vue.d.ts +1 -1
  49. package/components/Rating/Rating.vue.js +2 -2
  50. package/components/Rating/Rating.vue2.js +41 -41
  51. package/components/Rating/ReviewSummary.vue.js +20 -20
  52. package/components/ScaleGenerator/ScaleGenerator.vue.d.ts +1 -1
  53. package/components/Screen/ScreenFilter.vue.js +5 -3
  54. package/components/Screen/components/ScreenExportModal.vue.d.ts +2 -2
  55. package/components/SidePanel.vue.js +2 -2
  56. package/components/SidePanel.vue2.js +18 -18
  57. package/components/Stats/StatItem.vue.js +3 -2
  58. package/components/StatusChip/StatusChip.vue.js +6 -5
  59. package/components/Workbook/Sheet.vue.js +11 -11
  60. package/core/CoreScale.d.ts +18 -0
  61. package/core/CoreScale.js +44 -0
  62. package/core/config.d.ts +66 -32
  63. package/core/config.js +24 -12
  64. package/core/index.d.ts +3 -2
  65. package/core/index.js +44 -32
  66. package/icons/IconRegistry.d.ts +38 -0
  67. package/icons/IconRegistry.js +166 -0
  68. package/icons/IconTypes.d.ts +37 -0
  69. package/index.d.ts +3 -1
  70. package/index.js +478 -452
  71. package/package.json +15 -3
  72. package/style.css +45 -15
  73. package/types/config.type.d.ts +23 -0
  74. package/utils/functions.js +44 -43
  75. package/utils/index.d.ts +1 -0
  76. package/vite.d.ts +6 -0
  77. package/vite.js +223 -0
  78. /package/components/ColorPicker/{ColorIro.vue.js → ColorIro.vue2.js} +0 -0
package/core/config.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { InjectionKey } from 'vue';
2
- import { VLiteConfig } from '../types/config.type';
2
+ import { ResolvedVLiteConfig, VLiteConfig, VLiteScale } from '../types/config.type.ts';
3
3
  /**
4
4
  * Unique symbol for injecting the VLite configuration.
5
5
  */
6
- export declare const VLITE_CONFIG_KEY: InjectionKey<VLiteConfig>;
6
+ export declare const VLITE_CONFIG_KEY: InjectionKey<ResolvedVLiteConfig>;
7
7
  /**
8
8
  * Global reactive configuration state.
9
9
  * This acts as a singleton fallback if inject() is used outside a component
@@ -11,8 +11,8 @@ export declare const VLITE_CONFIG_KEY: InjectionKey<VLiteConfig>;
11
11
  */
12
12
  export declare const configState: {
13
13
  services?: {
14
- upload?: import('..').FileUploadHandler;
15
- t?: import('..').TranslationHandler;
14
+ upload?: import('../index.ts').FileUploadHandler;
15
+ t?: import('../index.ts').TranslationHandler;
16
16
  importApi?: (entity: string, payload: any) => Promise<any>;
17
17
  exportApi?: (entity: string, payload: any) => Promise<any>;
18
18
  };
@@ -25,9 +25,9 @@ export declare const configState: {
25
25
  };
26
26
  components?: {
27
27
  form?: {
28
- variant?: import('..').InputVariant;
29
- size?: import('..').InputSize;
30
- rounded?: import('..').InputRounded;
28
+ variant?: import('../index.ts').InputVariant;
29
+ size?: import('../index.ts').InputSize;
30
+ rounded?: import('../index.ts').InputRounded;
31
31
  showRequiredAsterisk?: boolean;
32
32
  };
33
33
  price?: {
@@ -42,11 +42,11 @@ export declare const configState: {
42
42
  apiKey?: string;
43
43
  };
44
44
  empty?: {
45
- variant?: import('..').EmptyVariant;
45
+ variant?: import('../index.ts').EmptyVariant;
46
46
  };
47
47
  statusChip?: {
48
48
  hideIcon?: boolean;
49
- customStatuses?: Record<string, import('..').CustomStatusConfig>;
49
+ customStatuses?: Record<string, import('../index.ts').CustomStatusConfig>;
50
50
  };
51
51
  attachmentsList?: {
52
52
  variant?: "default" | "list" | "inline" | "card";
@@ -73,16 +73,16 @@ export declare const configState: {
73
73
  title?: string;
74
74
  class?: string;
75
75
  titleI18n?: string;
76
- variant?: import('..').ListVariant;
76
+ variant?: import('../index.ts').ListVariant;
77
77
  titleIcon?: string;
78
- columns?: import('..').ListColumns;
78
+ columns?: import('../index.ts').ListColumns;
79
79
  showColon?: boolean;
80
80
  loading?: boolean;
81
81
  skeletonRows?: number;
82
- stackedBorderStyle?: import('..').StackedBorderStyle;
82
+ stackedBorderStyle?: import('../index.ts').StackedBorderStyle;
83
83
  };
84
84
  invoice?: {
85
- variant?: import('..').InvoiceVariant;
85
+ variant?: import('../index.ts').InvoiceVariant;
86
86
  compact?: boolean;
87
87
  displayBarcodeValue?: boolean;
88
88
  labels?: {
@@ -108,7 +108,7 @@ export declare const configState: {
108
108
  };
109
109
  };
110
110
  footer?: {
111
- variant?: import('..').FooterVariant;
111
+ variant?: import('../index.ts').FooterVariant;
112
112
  labels?: {
113
113
  followUs?: string;
114
114
  subscribe?: string;
@@ -117,7 +117,7 @@ export declare const configState: {
117
117
  containerClass?: string | any[] | Record<string, boolean>;
118
118
  };
119
119
  cart?: {
120
- variant?: import('..').CartVariant;
120
+ variant?: import('../index.ts').CartVariant;
121
121
  labels?: {
122
122
  cart?: string;
123
123
  emptyTitle?: string;
@@ -173,28 +173,47 @@ export declare const configState: {
173
173
  validateCoupon?: (code: string, context: {
174
174
  subtotal: number;
175
175
  currency?: string;
176
- items: import('..').CartItem[];
177
- }) => Promise<import('..').CartCouponDefinition | {
176
+ items: import('../index.ts').CartItem[];
177
+ }) => Promise<import('../index.ts').CartCouponDefinition | {
178
178
  code: string;
179
179
  message: string;
180
180
  state?: "invalid" | "expired" | "error";
181
181
  } | null>;
182
182
  };
183
183
  };
184
+ scale: VLiteScale;
185
+ icons: {
186
+ mode: import('../index.ts').VLiteIconMode;
187
+ fallback: string | {
188
+ body: string;
189
+ left?: number;
190
+ top?: number;
191
+ width?: number;
192
+ height?: number;
193
+ rotate?: number;
194
+ hFlip?: boolean;
195
+ vFlip?: boolean;
196
+ };
197
+ warnOnMissing: boolean;
198
+ };
184
199
  };
185
200
  /**
186
201
  * Helper to update the global configuration safely.
187
202
  * Uses deep merge to preserve existing nested objects.
188
203
  */
189
204
  export declare function updateConfig(updates: Partial<VLiteConfig>): void;
205
+ /**
206
+ * Updates the reactive configuration, root attribute, and saved user preference.
207
+ */
208
+ export declare function setVLiteScale(scale: VLiteScale): VLiteScale;
190
209
  /**
191
210
  * Composable to access the VLite configuration.
192
211
  * It attempts to inject from the Vue context first, falling back to the global singleton.
193
212
  */
194
213
  export declare function useVLiteConfig(): {
195
214
  services?: {
196
- upload?: import('..').FileUploadHandler;
197
- t?: import('..').TranslationHandler;
215
+ upload?: import('../index.ts').FileUploadHandler;
216
+ t?: import('../index.ts').TranslationHandler;
198
217
  importApi?: (entity: string, payload: any) => Promise<any>;
199
218
  exportApi?: (entity: string, payload: any) => Promise<any>;
200
219
  };
@@ -207,9 +226,9 @@ export declare function useVLiteConfig(): {
207
226
  };
208
227
  components?: {
209
228
  form?: {
210
- variant?: import('..').InputVariant;
211
- size?: import('..').InputSize;
212
- rounded?: import('..').InputRounded;
229
+ variant?: import('../index.ts').InputVariant;
230
+ size?: import('../index.ts').InputSize;
231
+ rounded?: import('../index.ts').InputRounded;
213
232
  showRequiredAsterisk?: boolean;
214
233
  };
215
234
  price?: {
@@ -224,11 +243,11 @@ export declare function useVLiteConfig(): {
224
243
  apiKey?: string;
225
244
  };
226
245
  empty?: {
227
- variant?: import('..').EmptyVariant;
246
+ variant?: import('../index.ts').EmptyVariant;
228
247
  };
229
248
  statusChip?: {
230
249
  hideIcon?: boolean;
231
- customStatuses?: Record<string, import('..').CustomStatusConfig>;
250
+ customStatuses?: Record<string, import('../index.ts').CustomStatusConfig>;
232
251
  };
233
252
  attachmentsList?: {
234
253
  variant?: "default" | "list" | "inline" | "card";
@@ -255,16 +274,16 @@ export declare function useVLiteConfig(): {
255
274
  title?: string;
256
275
  class?: string;
257
276
  titleI18n?: string;
258
- variant?: import('..').ListVariant;
277
+ variant?: import('../index.ts').ListVariant;
259
278
  titleIcon?: string;
260
- columns?: import('..').ListColumns;
279
+ columns?: import('../index.ts').ListColumns;
261
280
  showColon?: boolean;
262
281
  loading?: boolean;
263
282
  skeletonRows?: number;
264
- stackedBorderStyle?: import('..').StackedBorderStyle;
283
+ stackedBorderStyle?: import('../index.ts').StackedBorderStyle;
265
284
  };
266
285
  invoice?: {
267
- variant?: import('..').InvoiceVariant;
286
+ variant?: import('../index.ts').InvoiceVariant;
268
287
  compact?: boolean;
269
288
  displayBarcodeValue?: boolean;
270
289
  labels?: {
@@ -290,7 +309,7 @@ export declare function useVLiteConfig(): {
290
309
  };
291
310
  };
292
311
  footer?: {
293
- variant?: import('..').FooterVariant;
312
+ variant?: import('../index.ts').FooterVariant;
294
313
  labels?: {
295
314
  followUs?: string;
296
315
  subscribe?: string;
@@ -299,7 +318,7 @@ export declare function useVLiteConfig(): {
299
318
  containerClass?: string | any[] | Record<string, boolean>;
300
319
  };
301
320
  cart?: {
302
- variant?: import('..').CartVariant;
321
+ variant?: import('../index.ts').CartVariant;
303
322
  labels?: {
304
323
  cart?: string;
305
324
  emptyTitle?: string;
@@ -355,12 +374,27 @@ export declare function useVLiteConfig(): {
355
374
  validateCoupon?: (code: string, context: {
356
375
  subtotal: number;
357
376
  currency?: string;
358
- items: import('..').CartItem[];
359
- }) => Promise<import('..').CartCouponDefinition | {
377
+ items: import('../index.ts').CartItem[];
378
+ }) => Promise<import('../index.ts').CartCouponDefinition | {
360
379
  code: string;
361
380
  message: string;
362
381
  state?: "invalid" | "expired" | "error";
363
382
  } | null>;
364
383
  };
365
384
  };
385
+ scale: VLiteScale;
386
+ icons: {
387
+ mode: import('../index.ts').VLiteIconMode;
388
+ fallback: string | {
389
+ body: string;
390
+ left?: number;
391
+ top?: number;
392
+ width?: number;
393
+ height?: number;
394
+ rotate?: number;
395
+ hFlip?: boolean;
396
+ vFlip?: boolean;
397
+ };
398
+ warnOnMissing: boolean;
399
+ };
366
400
  };
package/core/config.js CHANGED
@@ -1,6 +1,10 @@
1
- import { reactive as n, inject as c } from "vue";
2
- import { deepMerge as r } from "../utils/object.js";
3
- const i = /* @__PURE__ */ Symbol("vlite-config"), s = {
1
+ import { reactive as s, inject as r } from "vue";
2
+ import { deepMerge as a } from "../utils/object.js";
3
+ import { DEFAULT_VLITE_SCALE as f, applyVLiteScale as t, resolveVLiteScale as l } from "./CoreScale.js";
4
+ import { getVLiteIconConfig as m, configureVLiteIcons as g } from "../icons/IconRegistry.js";
5
+ const d = /* @__PURE__ */ Symbol("vlite-config"), p = {
6
+ scale: f,
7
+ icons: m(),
4
8
  services: {},
5
9
  components: {
6
10
  form: {},
@@ -17,17 +21,25 @@ const i = /* @__PURE__ */ Symbol("vlite-config"), s = {
17
21
  customStatuses: {}
18
22
  }
19
23
  }
20
- }, e = n({ ...s });
21
- function f(t) {
22
- const o = r(e, t);
23
- Object.assign(e, o);
24
+ }, e = s({ ...p });
25
+ function V(o) {
26
+ const { icons: c, ...i } = o, n = a(e, {
27
+ ...i,
28
+ ...o.scale === void 0 ? {} : { scale: l(o.scale) }
29
+ });
30
+ Object.assign(e, n), c !== void 0 && (e.icons = g(c)), o.scale !== void 0 && (e.scale = t(e.scale));
24
31
  }
25
- function u() {
26
- return c(i, e);
32
+ function C(o) {
33
+ const c = t(o);
34
+ return e.scale = c, c;
35
+ }
36
+ function I() {
37
+ return r(d, e);
27
38
  }
28
39
  export {
29
- i as VLITE_CONFIG_KEY,
40
+ d as VLITE_CONFIG_KEY,
30
41
  e as configState,
31
- f as updateConfig,
32
- u as useVLiteConfig
42
+ C as setVLiteScale,
43
+ V as updateConfig,
44
+ I as useVLiteConfig
33
45
  };
package/core/index.d.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  import { App } from 'vue';
2
- import { VLiteConfig } from '../types/config.type';
2
+ import { VLiteConfig } from '../types/config.type.ts';
3
3
  /**
4
4
  * Creates the VLite plugin instance.
5
5
  */
6
6
  export declare function createVLite(options?: VLiteConfig): {
7
7
  install(app: App): void;
8
8
  };
9
- export * from './config';
9
+ export * from './config.ts';
10
+ export * from './CoreScale.ts';
package/core/index.js CHANGED
@@ -1,59 +1,71 @@
1
- import { configState as t, VLITE_CONFIG_KEY as m } from "./config.js";
2
- import { updateConfig as p, useVLiteConfig as i } from "./config.js";
3
- function c(e = {}) {
1
+ import { configState as e, VLITE_CONFIG_KEY as o } from "./config.js";
2
+ import { setVLiteScale as L, updateConfig as f, useVLiteConfig as u } from "./config.js";
3
+ import { initializeVLiteScale as m } from "./CoreScale.js";
4
+ import { DEFAULT_VLITE_SCALE as g, VLITE_SCALE_ATTRIBUTE as V, VLITE_SCALE_STORAGE_KEY as E, applyVLiteScale as C, getStoredVLiteScale as v, isVLiteScale as D, resolveVLiteScale as T } from "./CoreScale.js";
5
+ import { configureVLiteIcons as s } from "../icons/IconRegistry.js";
6
+ function r(t = {}) {
4
7
  return {
5
- install(o) {
6
- e && (e.services && (t.services = { ...t.services, ...e.services }), e.importData && (t.importData = { ...t.importData, ...e.importData }), e.exportData && (t.exportData = { ...t.exportData, ...e.exportData }), e.components && (t.components = {
7
- ...t.components,
8
+ install(c) {
9
+ e.icons = s(t.icons), e.scale = m(t.scale), t && (t.services && (e.services = { ...e.services, ...t.services }), t.importData && (e.importData = { ...e.importData, ...t.importData }), t.exportData && (e.exportData = { ...e.exportData, ...t.exportData }), t.components && (e.components = {
8
10
  ...e.components,
11
+ ...t.components,
9
12
  form: {
10
- ...t.components?.form || {},
11
- ...e.components.form || {}
13
+ ...e.components?.form || {},
14
+ ...t.components.form || {}
12
15
  },
13
16
  price: {
14
- ...t.components?.price || {},
15
- ...e.components.price || {}
17
+ ...e.components?.price || {},
18
+ ...t.components.price || {}
16
19
  },
17
20
  datetime: {
18
- ...t.components?.datetime || {},
19
- ...e.components.datetime || {}
21
+ ...e.components?.datetime || {},
22
+ ...t.components.datetime || {}
20
23
  },
21
24
  googleMap: {
22
- ...t.components?.googleMap || {},
23
- ...e.components.googleMap || {}
25
+ ...e.components?.googleMap || {},
26
+ ...t.components.googleMap || {}
24
27
  },
25
28
  empty: {
26
- ...t.components?.empty || {},
27
- ...e.components.empty || {}
29
+ ...e.components?.empty || {},
30
+ ...t.components.empty || {}
28
31
  },
29
32
  statusChip: {
30
- ...t.components?.statusChip || {},
31
- ...e.components.statusChip || {},
33
+ ...e.components?.statusChip || {},
34
+ ...t.components.statusChip || {},
32
35
  customStatuses: {
33
- ...t.components?.statusChip?.customStatuses || {},
34
- ...e.components.statusChip?.customStatuses || {}
36
+ ...e.components?.statusChip?.customStatuses || {},
37
+ ...t.components.statusChip?.customStatuses || {}
35
38
  }
36
39
  },
37
40
  attachmentsList: {
38
- ...t.components?.attachmentsList || {},
39
- ...e.components.attachmentsList || {}
41
+ ...e.components?.attachmentsList || {},
42
+ ...t.components.attachmentsList || {}
40
43
  },
41
44
  list: {
42
- ...t.components?.list || {},
43
- ...e.components.list || {}
45
+ ...e.components?.list || {},
46
+ ...t.components.list || {}
44
47
  },
45
48
  invoice: {
46
- ...t.components?.invoice || {},
47
- ...e.components.invoice || {}
49
+ ...e.components?.invoice || {},
50
+ ...t.components.invoice || {}
48
51
  }
49
- })), o.provide(m, t), o.config.globalProperties.$vlite = t;
52
+ })), c.provide(o, e), c.config.globalProperties.$vlite = e;
50
53
  }
51
54
  };
52
55
  }
53
56
  export {
54
- m as VLITE_CONFIG_KEY,
55
- t as configState,
56
- c as createVLite,
57
- p as updateConfig,
58
- i as useVLiteConfig
57
+ g as DEFAULT_VLITE_SCALE,
58
+ o as VLITE_CONFIG_KEY,
59
+ V as VLITE_SCALE_ATTRIBUTE,
60
+ E as VLITE_SCALE_STORAGE_KEY,
61
+ C as applyVLiteScale,
62
+ e as configState,
63
+ r as createVLite,
64
+ v as getStoredVLiteScale,
65
+ m as initializeVLiteScale,
66
+ D as isVLiteScale,
67
+ T as resolveVLiteScale,
68
+ L as setVLiteScale,
69
+ f as updateConfig,
70
+ u as useVLiteConfig
59
71
  };
@@ -0,0 +1,38 @@
1
+ import { IconifyIcon } from '@iconify/vue';
2
+ import { ResolvedVLiteIconsConfig, VLiteIconCollection, VLiteIconListOptions, VLiteIconRegistrationResult, VLiteIconsConfig, VLiteIconSource } from './IconTypes';
3
+ export declare function isVLiteIconName(name: string): boolean;
4
+ /**
5
+ * Register one Iconify icon in the same module registry used by VLite's Icon.
6
+ */
7
+ export declare function registerVLiteIcon(name: string, data: IconifyIcon): boolean;
8
+ /**
9
+ * Register one complete or partial IconifyJSON collection.
10
+ */
11
+ export declare function registerVLiteIconCollection(collection: VLiteIconCollection): VLiteIconRegistrationResult;
12
+ export declare function registerVLiteIconCollections(collections: VLiteIconCollection | readonly VLiteIconCollection[]): VLiteIconRegistrationResult;
13
+ /**
14
+ * Register the data-bearing part of an icon configuration without changing
15
+ * the current online/hybrid/offline resolution strategy.
16
+ */
17
+ export declare function registerVLiteIcons(registration: Pick<VLiteIconsConfig, 'collections' | 'individualIcons'>): VLiteIconRegistrationResult;
18
+ /**
19
+ * Configure resolution and synchronously register supplied local data.
20
+ */
21
+ export declare function configureVLiteIcons(config?: VLiteIconsConfig): ResolvedVLiteIconsConfig;
22
+ export declare function getVLiteIconConfig(): ResolvedVLiteIconsConfig;
23
+ export declare function hasVLiteIcon(name: string): boolean;
24
+ /**
25
+ * Resolve only explicitly VLite-registered local data. This never loads.
26
+ */
27
+ export declare function resolveVLiteIcon(name: string): Required<IconifyIcon> | null;
28
+ export declare function listVLiteIcons(options?: VLiteIconListOptions): string[];
29
+ export declare function warnOnMissingVLiteIcon(name: string): void;
30
+ /**
31
+ * Resolve the value passed to Iconify's Vue renderer. Offline mode returns
32
+ * icon data (or null) only, so unresolved names never reach its API loader.
33
+ */
34
+ export declare function resolveVLiteIconForRendering(icon: VLiteIconSource): VLiteIconSource | null;
35
+ /**
36
+ * Serialize a registered icon for IconPicker's existing SVG event payload.
37
+ */
38
+ export declare function renderVLiteIconSvg(name: string): string;
@@ -0,0 +1,166 @@
1
+ import { reactive as m } from "vue";
2
+ import { addIcon as h, getIcon as I, addCollection as b, buildIcon as k } from "@iconify/vue";
3
+ const l = {
4
+ mode: "online",
5
+ fallback: null,
6
+ warnOnMissing: !1
7
+ }, a = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Set(), o = m({
8
+ ...l,
9
+ revision: 0
10
+ }), O = /^(?:@[a-z0-9]+(?:-[a-z0-9]+)*:)?[a-z0-9]+(?:-[a-z0-9]+)*:[a-z0-9]+(?:-[a-z0-9]+)*$/;
11
+ function s(e) {
12
+ return e.trim().toLowerCase();
13
+ }
14
+ function y(e, r) {
15
+ return `${e.provider ? `@${e.provider}:` : ""}${e.prefix}:${r}`;
16
+ }
17
+ function $(e) {
18
+ const r = [
19
+ ...Object.keys(e.icons).map(
20
+ (i) => `${i}:${JSON.stringify(e.icons[i])}`
21
+ ),
22
+ ...Object.keys(e.aliases ?? {}).map(
23
+ (i) => `${i}:${JSON.stringify(e.aliases?.[i])}`
24
+ )
25
+ ].sort();
26
+ let n = 2166136261;
27
+ for (const i of r)
28
+ for (let t = 0; t < i.length; t += 1)
29
+ n ^= i.charCodeAt(t), n = Math.imul(n, 16777619);
30
+ return [
31
+ e.provider ?? "",
32
+ e.prefix,
33
+ e.lastModified ?? "",
34
+ r.length,
35
+ (n >>> 0).toString(16)
36
+ ].join("::");
37
+ }
38
+ function C(e) {
39
+ return e ? Array.isArray(e) ? [...e] : Object.entries(e).map(([r, n]) => ({ name: r, data: n })) : [];
40
+ }
41
+ function p() {
42
+ o.revision += 1;
43
+ }
44
+ function L(e) {
45
+ return O.test(s(e));
46
+ }
47
+ function x(e, r) {
48
+ const n = s(e);
49
+ if (!L(n))
50
+ throw new Error(`[vlite3] Invalid Iconify icon identifier "${e}".`);
51
+ if (a.has(n)) return !1;
52
+ if (!h(n, r))
53
+ throw new Error(`[vlite3] Could not register icon "${n}".`);
54
+ const i = I(n);
55
+ if (!i)
56
+ throw new Error(`[vlite3] Icon "${n}" was not available after registration.`);
57
+ return a.set(n, i), f.delete(n), p(), !0;
58
+ }
59
+ function N(e) {
60
+ if (!e?.prefix || !e.icons)
61
+ throw new Error("[vlite3] Icon collections require a prefix and icons map.");
62
+ const r = $(e), n = [...Object.keys(e.icons), ...Object.keys(e.aliases ?? {})];
63
+ if (g.has(r))
64
+ return { added: 0, skipped: n.length };
65
+ if (!b(e, e.provider))
66
+ throw new Error(`[vlite3] Could not register the "${e.prefix}" icon collection.`);
67
+ let i = 0, t = 0;
68
+ for (const c of n.sort()) {
69
+ const d = s(y(e, c));
70
+ if (a.has(d)) {
71
+ t += 1;
72
+ continue;
73
+ }
74
+ const v = I(d);
75
+ if (!v) {
76
+ t += 1;
77
+ continue;
78
+ }
79
+ a.set(d, v), f.delete(d), i += 1;
80
+ }
81
+ return g.add(r), i > 0 && p(), { added: i, skipped: t };
82
+ }
83
+ function z(e) {
84
+ return (Array.isArray(e) ? e : [e]).reduce(
85
+ (n, i) => {
86
+ const t = N(i);
87
+ return n.added += t.added, n.skipped += t.skipped, n;
88
+ },
89
+ { added: 0, skipped: 0 }
90
+ );
91
+ }
92
+ function M(e) {
93
+ const r = { added: 0, skipped: 0 };
94
+ if (e.collections) {
95
+ const n = z(e.collections);
96
+ r.added += n.added, r.skipped += n.skipped;
97
+ }
98
+ for (const n of C(e.individualIcons))
99
+ x(n.name, n.data) ? r.added += 1 : r.skipped += 1;
100
+ return r;
101
+ }
102
+ function E(e = {}) {
103
+ return M(e), o.mode = e.mode ?? l.mode, o.fallback = e.fallback ?? l.fallback, o.warnOnMissing = e.warnOnMissing ?? l.warnOnMissing, f.clear(), p(), V();
104
+ }
105
+ function V() {
106
+ return o.revision, {
107
+ mode: o.mode,
108
+ fallback: o.fallback,
109
+ warnOnMissing: o.warnOnMissing
110
+ };
111
+ }
112
+ function S(e) {
113
+ return o.revision, a.has(s(e));
114
+ }
115
+ function u(e) {
116
+ return o.revision, a.get(s(e)) ?? null;
117
+ }
118
+ function F(e = {}) {
119
+ o.revision;
120
+ const r = e.prefix?.toLowerCase(), n = e.provider?.toLowerCase();
121
+ return [...a.keys()].filter((i) => {
122
+ const t = i.startsWith("@") ? i.slice(i.indexOf(":") + 1) : i, c = t.slice(0, t.indexOf(":")), d = i.startsWith("@") ? i.slice(1, i.indexOf(":")) : "";
123
+ return (!r || c === r) && (n === void 0 || d === n);
124
+ }).sort();
125
+ }
126
+ function w(e) {
127
+ const r = s(e);
128
+ !o.warnOnMissing || f.has(r) || (f.add(r), console.warn(
129
+ `[vlite3] Icon "${r}" is not locally registered and cannot render in offline mode.`
130
+ ));
131
+ }
132
+ function P(e) {
133
+ if (typeof e != "string") return e;
134
+ const r = s(e), n = u(r);
135
+ if (n) return n;
136
+ if (o.mode !== "offline")
137
+ return o.mode === "hybrid" ? r : e;
138
+ w(r);
139
+ const i = o.fallback;
140
+ if (!i) return null;
141
+ if (typeof i != "string") return i;
142
+ if (s(i) === r) return null;
143
+ const t = u(i);
144
+ return t || w(i), t;
145
+ }
146
+ function R(e) {
147
+ const r = u(e);
148
+ if (!r) return "";
149
+ const n = k(r);
150
+ return `<svg xmlns="http://www.w3.org/2000/svg" ${Object.entries(n.attributes).map(([t, c]) => `${t}="${String(c)}"`).join(" ")}>${n.body}</svg>`;
151
+ }
152
+ export {
153
+ E as configureVLiteIcons,
154
+ V as getVLiteIconConfig,
155
+ S as hasVLiteIcon,
156
+ L as isVLiteIconName,
157
+ F as listVLiteIcons,
158
+ x as registerVLiteIcon,
159
+ N as registerVLiteIconCollection,
160
+ z as registerVLiteIconCollections,
161
+ M as registerVLiteIcons,
162
+ R as renderVLiteIconSvg,
163
+ u as resolveVLiteIcon,
164
+ P as resolveVLiteIconForRendering,
165
+ w as warnOnMissingVLiteIcon
166
+ };
@@ -0,0 +1,37 @@
1
+ import { IconifyIcon, IconifyJSON } from '@iconify/vue';
2
+ export type VLiteIconMode = 'online' | 'hybrid' | 'offline';
3
+ export type VLiteIconData = IconifyIcon;
4
+ export type VLiteIconCollection = IconifyJSON;
5
+ export type VLiteIconSource = string | VLiteIconData;
6
+ export interface VLiteIconRegistration {
7
+ name: string;
8
+ data: VLiteIconData;
9
+ }
10
+ export type VLiteIndividualIcons = readonly VLiteIconRegistration[] | Readonly<Record<string, VLiteIconData>>;
11
+ /**
12
+ * Runtime icon resolution policy.
13
+ *
14
+ * Collections and individual icons are registered synchronously when the
15
+ * VLite plugin is installed. They can also be registered through the public
16
+ * registry helpers before or after plugin installation.
17
+ */
18
+ export interface VLiteIconsConfig {
19
+ mode?: VLiteIconMode;
20
+ collections?: VLiteIconCollection | readonly VLiteIconCollection[];
21
+ individualIcons?: VLiteIndividualIcons;
22
+ fallback?: VLiteIconSource | null;
23
+ warnOnMissing?: boolean;
24
+ }
25
+ export interface ResolvedVLiteIconsConfig {
26
+ mode: VLiteIconMode;
27
+ fallback: VLiteIconSource | null;
28
+ warnOnMissing: boolean;
29
+ }
30
+ export interface VLiteIconListOptions {
31
+ prefix?: string;
32
+ provider?: string;
33
+ }
34
+ export interface VLiteIconRegistrationResult {
35
+ added: number;
36
+ skipped: number;
37
+ }
package/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { default as GoogleSignInPlugin } from 'vue3-google-signin';
2
2
  export * from './utils';
3
3
  export * from './types';
4
+ export * from './icons/IconRegistry';
5
+ export * from './icons/IconTypes';
4
6
  export * from './components/Chip';
5
7
  export * from './components/Form';
6
8
  export * from './components/Tabes';
@@ -104,7 +106,7 @@ export { default as CommandPaletteContent } from './components/CommandPalette/Co
104
106
  export { default as NavbarCommandPalette } from './components/NavbarCommandPalette.vue';
105
107
  export { default as DateRangePicker } from './components/DateRangePicker.vue';
106
108
  export { $t } from './utils/i18n';
107
- export { createVLite, useVLiteConfig } from './core';
109
+ export { applyVLiteScale, createVLite, DEFAULT_VLITE_SCALE, getStoredVLiteScale, initializeVLiteScale, isVLiteScale, resolveVLiteScale, setVLiteScale, useVLiteConfig, VLITE_SCALE_ATTRIBUTE, VLITE_SCALE_STORAGE_KEY, } from './core';
108
110
  export { GoogleSignInPlugin };
109
111
  export * from './components/StatusChip';
110
112
  export * from './components/Price';