maz-ui 4.1.7-beta.2 → 4.1.7-beta.4

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 (86) hide show
  1. package/dist/assets/MazDatePicker.D5Hzcubb.css +1 -0
  2. package/dist/assets/MazSelect.BX67LsNc.css +1 -0
  3. package/dist/chunks/{MazDatePicker.B3DDfxjV.js → MazDatePicker.CkJpZYHM.js} +24 -24
  4. package/dist/chunks/{MazDropdown.vue_vue_type_style_index_0_lang.D_CzEKlT.js → MazDropdown.vue_vue_type_style_index_0_lang.FpQyExxD.js} +2 -2
  5. package/dist/chunks/{MazInputNumber.vue_vue_type_style_index_0_lang.B0D4Zzds.js → MazInputNumber.vue_vue_type_style_index_0_lang.B6DYpHfi.js} +2 -2
  6. package/dist/chunks/{MazInputPhoneNumber.CDy6n_Qj.js → MazInputPhoneNumber.CfClhmow.js} +7 -7
  7. package/dist/chunks/{MazInputPrice.vue_vue_type_script_setup_true_lang.3pKYuG8H.js → MazInputPrice.vue_vue_type_script_setup_true_lang.BA6TDX-T.js} +18 -18
  8. package/dist/chunks/{MazPickerCalendar.B5IHMawO.js → MazPickerCalendar.4X9zAxOA.js} +1 -1
  9. package/dist/chunks/{MazPickerCalendarMonth.TJfbseNp.js → MazPickerCalendarMonth.LQs0NMnx.js} +6 -6
  10. package/dist/chunks/{MazPickerCalendarSwitcher.lOvJV15Q.js → MazPickerCalendarSwitcher.5d6kOHZ6.js} +8 -8
  11. package/dist/chunks/{MazPickerContainer.DP0fFknc.js → MazPickerContainer.Dt1Np6w2.js} +1 -1
  12. package/dist/chunks/{MazPickerHeader.JAJVo08c.js → MazPickerHeader.B3prGklk.js} +12 -12
  13. package/dist/chunks/{MazPickerMonthSwitcher.C3OsIZfi.js → MazPickerMonthSwitcher.D1bsoD4Q.js} +8 -8
  14. package/dist/chunks/{MazPickerTime.BpMRZUGU.js → MazPickerTime.DrdtXsuy.js} +1 -1
  15. package/dist/chunks/{MazPickerYearSwitcher.Da4W6W5q.js → MazPickerYearSwitcher.mwQmfacb.js} +2 -2
  16. package/dist/chunks/{MazTabsContent.vue_vue_type_script_setup_true_lang.hIwO-24k.js → MazTabsContent.vue_vue_type_script_setup_true_lang.arGqYTL5.js} +2 -2
  17. package/dist/chunks/{PhoneInput.DukRZp5u.js → PhoneInput.BE6bXfav.js} +1 -1
  18. package/dist/chunks/capitalize.BF6CDS_4.js +6 -0
  19. package/dist/chunks/checkAvailability.aTpZidex.js +16 -0
  20. package/dist/chunks/debounce.Brzkn9pm.js +11 -0
  21. package/dist/chunks/{dom-events.H9KIOv83.js → dom-events.CfOiauCR.js} +41 -41
  22. package/dist/chunks/{fullscreen-img.directive.D9oQ3Gni.js → fullscreen-img.directive.B8ESs0MK.js} +2 -2
  23. package/dist/chunks/{isClient.8V3qjGdO.js → isClient.WI4oSt66.js} +2 -2
  24. package/dist/chunks/{mazUi.CaSMOKic.js → mazUi.raWwR54O.js} +2 -2
  25. package/dist/chunks/{obsidian.C6upWOVF.js → obsidian.Cy0R8RHy.js} +2 -2
  26. package/dist/chunks/{ocean.ehMlC0HV.js → ocean.pHrY5H_S.js} +2 -2
  27. package/dist/chunks/pascalCase.GdDKKQ-O.js +19 -0
  28. package/dist/chunks/{pristine.DMG3eBuN.js → pristine.CxBZzgUG.js} +2 -2
  29. package/dist/chunks/sleep.BLRH1qZG.js +6 -0
  30. package/dist/chunks/truthyFilter.C2WOKUCG.js +6 -0
  31. package/dist/chunks/{useStringMatching.DzSigyZ7.js → useStringMatching.CqudA-tS.js} +25 -25
  32. package/dist/chunks/{vClickOutside.CJBKY5no.js → vClickOutside.DIOiluy0.js} +6 -6
  33. package/dist/components/MazAnimatedCounter.js +3 -3
  34. package/dist/components/MazAnimatedText.js +2 -2
  35. package/dist/components/MazChecklist.js +4 -4
  36. package/dist/components/MazDatePicker.js +1 -1
  37. package/dist/components/MazDropdown.js +1 -1
  38. package/dist/components/MazDropzone.js +3 -3
  39. package/dist/components/MazGallery.js +1 -1
  40. package/dist/components/MazInput.js +2 -2
  41. package/dist/components/MazInputNumber.js +1 -1
  42. package/dist/components/MazInputPhoneNumber.js +1 -1
  43. package/dist/components/MazInputPrice.js +1 -1
  44. package/dist/components/MazInputPrice.vue.d.ts +1 -1
  45. package/dist/components/MazInputTags.js +3 -3
  46. package/dist/components/MazPopover.js +9 -9
  47. package/dist/components/MazPullToRefresh.js +6 -6
  48. package/dist/components/MazReadingProgressBar.js +7 -7
  49. package/dist/components/MazSelect.js +67 -57
  50. package/dist/components/MazSelect.vue.d.ts +21 -4
  51. package/dist/components/MazSelectCountry.js +15 -13
  52. package/dist/components/MazSlider.js +34 -34
  53. package/dist/components/MazTabsBar.js +2 -2
  54. package/dist/components/MazTabsContent.js +1 -1
  55. package/dist/components/MazTextarea.js +5 -5
  56. package/dist/components/index.js +6 -6
  57. package/dist/composables/index.js +1 -1
  58. package/dist/composables/useDisplayNames.js +2 -2
  59. package/dist/composables/useDropzone.js +2 -2
  60. package/dist/composables/useFormField.js +2 -2
  61. package/dist/composables/useFormValidator.js +1 -1
  62. package/dist/composables/useIdleTimeout.js +27 -27
  63. package/dist/composables/useMutationObserver.js +4 -4
  64. package/dist/composables/useStringMatching.js +1 -1
  65. package/dist/composables/useSwipe.js +22 -22
  66. package/dist/composables/useUserVisibility.js +8 -8
  67. package/dist/composables/useWindowSize.js +2 -2
  68. package/dist/directives/index.js +2 -2
  69. package/dist/directives/vClickOutside.js +1 -1
  70. package/dist/directives/vFullscreenImg.js +1 -1
  71. package/dist/plugins/aos.js +5 -5
  72. package/dist/plugins/maz-ui.js +208 -208
  73. package/dist/resolvers/MazComponentsResolver.js +4 -4
  74. package/dist/resolvers/MazDirectivesResolver.js +2 -2
  75. package/dist/resolvers/MazModulesResolver.js +3 -3
  76. package/dist/types/components/MazInputPrice.vue.d.ts +1 -1
  77. package/dist/types/components/MazSelect.vue.d.ts +21 -4
  78. package/package.json +8 -8
  79. package/dist/assets/MazDatePicker.BK088IpL.css +0 -1
  80. package/dist/assets/MazSelect.BjrOOGvL.css +0 -1
  81. package/dist/chunks/capitalize.CVQ1jDrh.js +0 -6
  82. package/dist/chunks/checkAvailability.UFZSC8-1.js +0 -16
  83. package/dist/chunks/debounce.DhXdop6X.js +0 -11
  84. package/dist/chunks/pascalCase.BKTE3qqE.js +0 -19
  85. package/dist/chunks/sleep.Ci7GE4BQ.js +0 -6
  86. package/dist/chunks/truthyFilter.DZvXmxeK.js +0 -6
@@ -1,5 +1,5 @@
1
- import { e } from "../chunks/isClient.8V3qjGdO.js";
2
- import { n } from "../chunks/sleep.Ci7GE4BQ.js";
1
+ import { i as isClient } from "../chunks/isClient.WI4oSt66.js";
2
+ import { s as sleep } from "../chunks/sleep.BLRH1qZG.js";
3
3
  const DEFAULT_OPTIONS = {
4
4
  delay: 100,
5
5
  observer: {
@@ -56,7 +56,7 @@ class AosHandler {
56
56
  }
57
57
  }
58
58
  async handleObserver() {
59
- await n(this.options.delay);
59
+ await sleep(this.options.delay);
60
60
  const observer = new IntersectionObserver(this.handleIntersect.bind(this), this.options.observer);
61
61
  for (const element of document.querySelectorAll("[data-maz-aos]")) {
62
62
  const anchorAttr = element.getAttribute("data-maz-aos-anchor");
@@ -68,7 +68,7 @@ class AosHandler {
68
68
  }
69
69
  }
70
70
  runAnimations() {
71
- if (e())
71
+ if (isClient())
72
72
  return this.handleObserver();
73
73
  console.warn("[MazAos](runAnimations) should be executed on client side");
74
74
  }
@@ -76,7 +76,7 @@ class AosHandler {
76
76
  let instance;
77
77
  const AosPlugin = {
78
78
  install: (app, options) => {
79
- instance = new AosHandler(options), app.provide("mazAos", instance), app.config.globalProperties.$mazAos = instance, e() && (options?.router ? options.router.afterEach(() => {
79
+ instance = new AosHandler(options), app.provide("mazAos", instance), app.config.globalProperties.$mazAos = instance, isClient() && (options?.router ? options.router.afterEach(() => {
80
80
  instance.runAnimations();
81
81
  }) : instance.runAnimations());
82
82
  }
@@ -1,20 +1,20 @@
1
1
  import { reactive } from "vue";
2
2
  import { MazUiTranslations } from "@maz-ui/translations";
3
- function l(n2) {
4
- const t2 = n2.match(/^(\d+(?:\.\d+)?)\s+(\d+(?:\.\d+)?)%\s+(\d+(?:\.\d+)?)%$/);
5
- if (!t2)
6
- throw new Error(`Invalid HSL format: ${n2}`);
3
+ function parseHSL(hsl) {
4
+ const match = hsl.match(/^(\d+(?:\.\d+)?)\s+(\d+(?:\.\d+)?)%\s+(\d+(?:\.\d+)?)%$/);
5
+ if (!match)
6
+ throw new Error(`Invalid HSL format: ${hsl}`);
7
7
  return {
8
- h: Number.parseFloat(t2[1]),
9
- s: Number.parseFloat(t2[2]),
10
- l: Number.parseFloat(t2[3])
8
+ h: Number.parseFloat(match[1]),
9
+ s: Number.parseFloat(match[2]),
10
+ l: Number.parseFloat(match[3])
11
11
  };
12
12
  }
13
- function i(n2, t2, r) {
14
- const o2 = Math.round(n2 * 10) / 10, s = Math.round(t2 * 10) / 10, e = Math.round(r * 10) / 10;
15
- return `${o2} ${s}% ${e}%`;
13
+ function formatHSL(h, s, l) {
14
+ const roundedH = Math.round(h * 10) / 10, roundedS = Math.round(s * 10) / 10, roundedL = Math.round(l * 10) / 10;
15
+ return `${roundedH} ${roundedS}% ${roundedL}%`;
16
16
  }
17
- const d = {
17
+ const LUMINOSITY_OFFSETS = {
18
18
  50: 37.5,
19
19
  100: 30,
20
20
  200: 22.5,
@@ -27,33 +27,33 @@ const d = {
27
27
  900: -30,
28
28
  950: -37.5
29
29
  };
30
- function p$1(n2, t2, r) {
31
- if (t2 === n2)
30
+ function calculateSaturationMultiplier(baseVariant, targetVariant, baseSaturation) {
31
+ if (targetVariant === baseVariant)
32
32
  return 1;
33
- const o2 = Math.min(r / 100, 1), s = Math.abs(t2 - n2);
34
- if (t2 < n2) {
35
- const e = s / 500 * 0.25 * o2;
36
- return Math.max(0.3, 1 - e);
33
+ const saturationFactor = Math.min(baseSaturation / 100, 1), variantDiff = Math.abs(targetVariant - baseVariant);
34
+ if (targetVariant < baseVariant) {
35
+ const reduction = variantDiff / 500 * 0.25 * saturationFactor;
36
+ return Math.max(0.3, 1 - reduction);
37
37
  } else {
38
- const e = s / 400 * 0.15 * o2;
39
- return Math.min(1.3, 1 + e);
38
+ const increase = variantDiff / 400 * 0.15 * saturationFactor;
39
+ return Math.min(1.3, 1 + increase);
40
40
  }
41
41
  }
42
- function b(n2) {
43
- const { h: t2, s: r, l: o2 } = l(n2), s = 500, e = o2, m2 = Object.keys(d).map(Number), u2 = {};
44
- return m2.forEach((c2) => {
45
- if (c2 === s)
46
- u2[c2] = i(t2, r, o2);
42
+ function generateColorScale(baseColor) {
43
+ const { h, s, l } = parseHSL(baseColor), baseVariant = 500, baseLuminosity = l, variants = Object.keys(LUMINOSITY_OFFSETS).map(Number), scale = {};
44
+ return variants.forEach((variant) => {
45
+ if (variant === baseVariant)
46
+ scale[variant] = formatHSL(h, s, l);
47
47
  else {
48
- const h2 = c2 < s, f2 = c2 > s, M2 = d[c2];
49
- let a;
50
- h2 && o2 >= 100 ? a = e : a = e + M2, f2 && o2 <= 0 && (a = 0), a = Math.min(100, Math.max(0, a));
51
- const S2 = p$1(s, c2, r), L2 = Math.min(100, Math.max(5, r * S2));
52
- u2[c2] = i(t2, L2, a);
48
+ const isUnderBase = variant < baseVariant, isOverBase = variant > baseVariant, luminosityOffset = LUMINOSITY_OFFSETS[variant];
49
+ let targetLuminosity;
50
+ isUnderBase && l >= 100 ? targetLuminosity = baseLuminosity : targetLuminosity = baseLuminosity + luminosityOffset, isOverBase && l <= 0 && (targetLuminosity = 0), targetLuminosity = Math.min(100, Math.max(0, targetLuminosity));
51
+ const saturationMultiplier = calculateSaturationMultiplier(baseVariant, variant, s), adjustedSaturation = Math.min(100, Math.max(5, s * saturationMultiplier));
52
+ scale[variant] = formatHSL(h, adjustedSaturation, targetLuminosity);
53
53
  }
54
- }), u2;
54
+ }), scale;
55
55
  }
56
- const h = [
56
+ const DEFAULT_CRITICAL_COLORS = [
57
57
  "background",
58
58
  "foreground",
59
59
  "primary",
@@ -75,282 +75,282 @@ const h = [
75
75
  "muted",
76
76
  "shadow",
77
77
  "border"
78
- ], C = [
78
+ ], DEFAULT_CRITICAL_FOUNDATION = [
79
79
  "radius",
80
80
  "font-family",
81
81
  "base-font-size",
82
82
  "border-width"
83
- ], S = ["primary", "secondary", "accent", "destructive", "success", "warning", "info", "contrast", "background", "foreground", "border", "muted", "overlay", "shadow"];
84
- function j(r, t2 = {
83
+ ], scaleColors = ["primary", "secondary", "accent", "destructive", "success", "warning", "info", "contrast", "background", "foreground", "border", "muted", "overlay", "shadow"];
84
+ function generateCriticalCSS(preset, options = {
85
85
  mode: "both",
86
86
  darkSelectorStrategy: "class"
87
87
  }) {
88
88
  const {
89
- criticalColors: e = h,
90
- criticalFoundation: o2 = C,
91
- mode: n2,
92
- darkSelectorStrategy: l2,
93
- prefix: i2 = "maz"
94
- } = t2, s = y(r.foundation, o2);
95
- let c2 = `@layer maz-ui-theme {
89
+ criticalColors = DEFAULT_CRITICAL_COLORS,
90
+ criticalFoundation = DEFAULT_CRITICAL_FOUNDATION,
91
+ mode,
92
+ darkSelectorStrategy,
93
+ prefix = "maz"
94
+ } = options, foundationCritical = extractCriticalFoundation(preset.foundation, criticalFoundation);
95
+ let css = `@layer maz-ui-theme {
96
96
  `;
97
- if (n2 === "light" || n2 === "both") {
98
- const a = m(r.colors.light, e);
99
- c2 += f$1({
97
+ if (mode === "light" || mode === "both") {
98
+ const lightCritical = extractCriticalVariables(preset.colors.light, criticalColors);
99
+ css += generateVariablesBlock({
100
100
  selector: ":root",
101
- colors: a,
102
- foundation: s,
103
- prefix: i2
101
+ colors: lightCritical,
102
+ foundation: foundationCritical,
103
+ prefix
104
104
  });
105
105
  }
106
- if (n2 === "dark" || n2 === "both") {
107
- const a = m(r.colors.dark, e);
108
- c2 += f$1({
109
- selector: l2 === "media" ? ":root" : ".dark",
110
- mediaQuery: l2 === "media" ? "@media (prefers-color-scheme: dark)" : void 0,
111
- colors: a,
112
- foundation: s,
113
- prefix: i2
106
+ if (mode === "dark" || mode === "both") {
107
+ const darkCritical = extractCriticalVariables(preset.colors.dark, criticalColors);
108
+ css += generateVariablesBlock({
109
+ selector: darkSelectorStrategy === "media" ? ":root" : ".dark",
110
+ mediaQuery: darkSelectorStrategy === "media" ? "@media (prefers-color-scheme: dark)" : void 0,
111
+ colors: darkCritical,
112
+ foundation: foundationCritical,
113
+ prefix
114
114
  });
115
115
  }
116
- return c2 += `}
117
- `, c2;
116
+ return css += `}
117
+ `, css;
118
118
  }
119
- function p(r, t2 = {
119
+ function generateFullCSS(preset, options = {
120
120
  mode: "both",
121
121
  darkSelectorStrategy: "class"
122
122
  }) {
123
123
  const {
124
- excludeCritical: e = h,
125
- mode: o2,
126
- darkSelectorStrategy: n2,
127
- prefix: l2 = "maz",
128
- includeColorScales: i2 = !0
129
- } = t2, s = k$1(r.foundation, C);
130
- let c2 = `@layer maz-ui-theme {
124
+ excludeCritical = DEFAULT_CRITICAL_COLORS,
125
+ mode,
126
+ darkSelectorStrategy,
127
+ prefix = "maz",
128
+ includeColorScales = !0
129
+ } = options, foundation = excludeFoundationVariables(preset.foundation, DEFAULT_CRITICAL_FOUNDATION);
130
+ let css = `@layer maz-ui-theme {
131
131
  `;
132
- if (o2 === "light" || o2 === "both") {
133
- const a = g$1(r.colors.light, e);
134
- c2 += f$1({
132
+ if (mode === "light" || mode === "both") {
133
+ const lightColors = excludeVariables(preset.colors.light, excludeCritical);
134
+ css += generateVariablesBlock({
135
135
  selector: ":root",
136
- colors: a,
137
- foundation: s,
138
- prefix: l2,
139
- includeScales: i2,
140
- preset: r
136
+ colors: lightColors,
137
+ foundation,
138
+ prefix,
139
+ includeScales: includeColorScales,
140
+ preset
141
141
  });
142
142
  }
143
- if (o2 === "dark" || o2 === "both") {
144
- const a = g$1(r.colors.dark, e);
145
- c2 += f$1({
146
- selector: n2 === "media" ? ":root" : ".dark",
147
- mediaQuery: n2 === "media" ? "@media (prefers-color-scheme: dark)" : void 0,
148
- colors: a,
149
- foundation: o2 === "dark" ? s : void 0,
143
+ if (mode === "dark" || mode === "both") {
144
+ const darkColors = excludeVariables(preset.colors.dark, excludeCritical);
145
+ css += generateVariablesBlock({
146
+ selector: darkSelectorStrategy === "media" ? ":root" : ".dark",
147
+ mediaQuery: darkSelectorStrategy === "media" ? "@media (prefers-color-scheme: dark)" : void 0,
148
+ colors: darkColors,
149
+ foundation: mode === "dark" ? foundation : void 0,
150
150
  // Appearance only if dark mode only
151
- prefix: l2,
152
- includeScales: i2,
153
- preset: r,
151
+ prefix,
152
+ includeScales: includeColorScales,
153
+ preset,
154
154
  isDark: !0
155
155
  });
156
156
  }
157
- return c2 += `}
158
- `, c2;
157
+ return css += `}
158
+ `, css;
159
159
  }
160
- function m(r, t2) {
160
+ function extractCriticalVariables(colors, criticalKeys) {
161
161
  return Object.fromEntries(
162
- t2.filter((e) => r[e]).map((e) => [e, r[e]])
162
+ criticalKeys.filter((key) => colors[key]).map((key) => [key, colors[key]])
163
163
  );
164
164
  }
165
- function y(r, t2) {
166
- return r ? Object.fromEntries(
167
- t2.filter((e) => r[e]).map((e) => [e, r[e]])
165
+ function extractCriticalFoundation(foundation, criticalKeys) {
166
+ return foundation ? Object.fromEntries(
167
+ criticalKeys.filter((key) => foundation[key]).map((key) => [key, foundation[key]])
168
168
  ) : {};
169
169
  }
170
- function g$1(r, t2) {
170
+ function excludeVariables(colors, excludeKeys) {
171
171
  return Object.fromEntries(
172
- Object.entries(r).filter(([e]) => !t2.includes(e))
172
+ Object.entries(colors).filter(([key]) => !excludeKeys.includes(key))
173
173
  );
174
174
  }
175
- function k$1(r, t2) {
176
- return r ? Object.fromEntries(
177
- Object.entries(r).filter(([e]) => !t2.includes(e))
175
+ function excludeFoundationVariables(foundation, excludeKeys) {
176
+ return foundation ? Object.fromEntries(
177
+ Object.entries(foundation).filter(([key]) => !excludeKeys.includes(key))
178
178
  ) : {};
179
179
  }
180
- function f$1({
181
- selector: r,
182
- mediaQuery: t2,
183
- colors: e,
184
- foundation: o2,
185
- prefix: n2,
186
- includeScales: l2 = !1,
187
- preset: i2,
188
- isDark: s = !1
180
+ function generateVariablesBlock({
181
+ selector,
182
+ mediaQuery,
183
+ colors,
184
+ foundation,
185
+ prefix,
186
+ includeScales = !1,
187
+ preset,
188
+ isDark = !1
189
189
  }) {
190
- const c2 = [];
191
- if (e && Object.entries(e).forEach(([u2, d2]) => {
192
- d2 && c2.push(` --${n2}-${u2}: ${d2};`);
193
- }), o2 && Object.entries(o2).forEach(([u2, d2]) => {
194
- d2 && c2.push(` --${n2}-${u2}: ${d2};`);
195
- }), l2 && i2) {
196
- const u2 = s ? i2.colors.dark : i2.colors.light, d2 = $(u2, n2);
197
- c2.push(...d2);
190
+ const variables = [];
191
+ if (colors && Object.entries(colors).forEach(([key, value]) => {
192
+ value && variables.push(` --${prefix}-${key}: ${value};`);
193
+ }), foundation && Object.entries(foundation).forEach(([key, value]) => {
194
+ value && variables.push(` --${prefix}-${key}: ${value};`);
195
+ }), includeScales && preset) {
196
+ const sourceColors = isDark ? preset.colors.dark : preset.colors.light, colorScales = generateAllColorScales(sourceColors, prefix);
197
+ variables.push(...colorScales);
198
198
  }
199
- const a = c2.join(`
199
+ const content = variables.join(`
200
200
  `);
201
- return t2 ? `
202
- ${t2} {
203
- ${r} {
204
- ${a.replace(/^/gm, " ")}
201
+ return mediaQuery ? `
202
+ ${mediaQuery} {
203
+ ${selector} {
204
+ ${content.replace(/^/gm, " ")}
205
205
  }
206
206
  }
207
207
  ` : `
208
- ${r} {
209
- ${a}
208
+ ${selector} {
209
+ ${content}
210
210
  }
211
211
  `;
212
212
  }
213
- function $(r, t2) {
214
- const e = [];
215
- return S.forEach((o2) => {
216
- const n2 = r[o2];
217
- if (n2) {
218
- const l2 = b(n2);
219
- Object.entries(l2).forEach(([i2, s]) => {
220
- e.push(` --${t2}-${o2}-${i2}: ${s};`);
213
+ function generateAllColorScales(colors, prefix) {
214
+ const colorScales = [];
215
+ return scaleColors.forEach((colorName) => {
216
+ const baseColor = colors[colorName];
217
+ if (baseColor) {
218
+ const scale = generateColorScale(baseColor);
219
+ Object.entries(scale).forEach(([scaleKey, scaleValue]) => {
220
+ colorScales.push(` --${prefix}-${colorName}-${scaleKey}: ${scaleValue};`);
221
221
  });
222
222
  }
223
- }), e;
223
+ }), colorScales;
224
224
  }
225
- var E = /* @__PURE__ */ ((r) => (r.FULL = "maz-theme-full", r.CRITICAL = "maz-theme-critical", r))(E || {});
226
- function v(r, t2) {
225
+ var CSS_IDS = /* @__PURE__ */ ((CSS_IDS2) => (CSS_IDS2.FULL = "maz-theme-full", CSS_IDS2.CRITICAL = "maz-theme-critical", CSS_IDS2))(CSS_IDS || {});
226
+ function injectCSS(id, css) {
227
227
  if (typeof document > "u")
228
228
  return;
229
- const e = document.querySelectorAll(`#${r}`);
230
- if (!e || e.length === 0) {
231
- const o2 = document.createElement("style");
232
- o2.id = r, document.head.appendChild(o2), o2.textContent = t2;
229
+ const styleElements = document.querySelectorAll(`#${id}`);
230
+ if (!styleElements || styleElements.length === 0) {
231
+ const element = document.createElement("style");
232
+ element.id = id, document.head.appendChild(element), element.textContent = css;
233
233
  return;
234
234
  }
235
- if (e.length === 1) {
236
- e[0].textContent = t2;
235
+ if (styleElements.length === 1) {
236
+ styleElements[0].textContent = css;
237
237
  return;
238
238
  }
239
- if (e.length > 1) {
240
- for (let o2 = 0; o2 < e.length - 1; o2++)
241
- e[o2].remove();
242
- e[e.length - 1].textContent = t2;
239
+ if (styleElements.length > 1) {
240
+ for (let i = 0; i < styleElements.length - 1; i++)
241
+ styleElements[i].remove();
242
+ styleElements[styleElements.length - 1].textContent = css;
243
243
  }
244
244
  }
245
- function c(e) {
245
+ function getCookie(key) {
246
246
  if (typeof document > "u")
247
247
  return null;
248
- const t2 = document.cookie.split(";").find((n2) => n2.trim().startsWith(`${e}=`));
249
- return t2 ? decodeURIComponent(t2.split("=")[1]) : null;
248
+ const cookie = document.cookie.split(";").find((c) => c.trim().startsWith(`${key}=`));
249
+ return cookie ? decodeURIComponent(cookie.split("=")[1]) : null;
250
250
  }
251
- function o$1(e) {
252
- if (e && ["light", "dark"].includes(e))
253
- return e;
254
- const t2 = c("maz-color-mode");
255
- return t2 && ["light", "dark"].includes(t2) ? t2 : "auto";
251
+ function getColorMode(colorMode) {
252
+ if (colorMode && ["light", "dark"].includes(colorMode))
253
+ return colorMode;
254
+ const savedMode = getCookie("maz-color-mode");
255
+ return savedMode && ["light", "dark"].includes(savedMode) ? savedMode : "auto";
256
256
  }
257
- function n() {
257
+ function isSystemPrefersDark() {
258
258
  return typeof globalThis.window < "u" && typeof globalThis.matchMedia == "function" && globalThis.matchMedia("(prefers-color-scheme: dark)").matches;
259
259
  }
260
- function t(i2) {
261
- return typeof i2 == "object" && i2 !== null && !!i2.name;
260
+ function isPresetObject(preset) {
261
+ return typeof preset == "object" && preset !== null && !!preset.name;
262
262
  }
263
- async function o(i2) {
264
- if (t(i2))
265
- return i2;
266
- if (i2 === "mazUi" || !i2 || i2 === "maz-ui") {
267
- const { mazUi: n2 } = await import("../chunks/mazUi.CaSMOKic.js");
268
- return n2;
263
+ async function getPreset(preset) {
264
+ if (isPresetObject(preset))
265
+ return preset;
266
+ if (preset === "mazUi" || !preset || preset === "maz-ui") {
267
+ const { mazUi } = await import("../chunks/mazUi.raWwR54O.js");
268
+ return mazUi;
269
269
  }
270
- if (i2 === "ocean") {
271
- const { ocean: n2 } = await import("../chunks/ocean.ehMlC0HV.js");
272
- return n2;
270
+ if (preset === "ocean") {
271
+ const { ocean } = await import("../chunks/ocean.pHrY5H_S.js");
272
+ return ocean;
273
273
  }
274
- if (i2 === "pristine") {
275
- const { pristine: n2 } = await import("../chunks/pristine.DMG3eBuN.js");
276
- return n2;
274
+ if (preset === "pristine") {
275
+ const { pristine } = await import("../chunks/pristine.CxBZzgUG.js");
276
+ return pristine;
277
277
  }
278
- if (i2 === "obsidian") {
279
- const { obsidian: n2 } = await import("../chunks/obsidian.C6upWOVF.js");
280
- return n2;
278
+ if (preset === "obsidian") {
279
+ const { obsidian } = await import("../chunks/obsidian.Cy0R8RHy.js");
280
+ return obsidian;
281
281
  }
282
- throw new TypeError(`[@maz-ui/themes] Preset ${i2} not found`);
282
+ throw new TypeError(`[@maz-ui/themes] Preset ${preset} not found`);
283
283
  }
284
- function f(n2, o2) {
284
+ function mergePresets(base, overrides) {
285
285
  return {
286
- name: o2.name || n2.name,
286
+ name: overrides.name || base.name,
287
287
  foundation: {
288
- ...n2.foundation,
289
- ...o2.foundation
288
+ ...base.foundation,
289
+ ...overrides.foundation
290
290
  },
291
291
  colors: {
292
- light: u(n2.colors.light, o2.colors?.light),
293
- dark: u(n2.colors.dark, o2.colors?.dark)
292
+ light: mergeColors(base.colors.light, overrides.colors?.light),
293
+ dark: mergeColors(base.colors.dark, overrides.colors?.dark)
294
294
  }
295
295
  };
296
296
  }
297
- function u(n2, o2) {
298
- return o2 ? {
299
- ...n2,
300
- ...o2
301
- } : n2;
297
+ function mergeColors(base, overrides) {
298
+ return overrides ? {
299
+ ...base,
300
+ ...overrides
301
+ } : base;
302
302
  }
303
- function g(r, t2) {
304
- typeof document > "u" || r !== "class" || (t2 ? document.documentElement.classList.add("dark") : document.documentElement.classList.remove("dark"));
303
+ function applyDarkMode(darkModeStrategy, isDark) {
304
+ typeof document > "u" || darkModeStrategy !== "class" || (isDark ? document.documentElement.classList.add("dark") : document.documentElement.classList.remove("dark"));
305
305
  }
306
- function k(r, t2) {
306
+ function injectThemeCSS(finalPreset, config) {
307
307
  if (typeof document > "u")
308
308
  return;
309
- const e = {
310
- mode: t2.mode,
311
- darkSelectorStrategy: t2.darkModeStrategy
309
+ const cssOptions = {
310
+ mode: config.mode,
311
+ darkSelectorStrategy: config.darkModeStrategy
312
312
  };
313
- if (t2.injectCriticalCSS) {
314
- const a = j(r, e);
315
- v(E.CRITICAL, a);
313
+ if (config.injectCriticalCSS) {
314
+ const criticalCSS = generateCriticalCSS(finalPreset, cssOptions);
315
+ injectCSS(CSS_IDS.CRITICAL, criticalCSS);
316
316
  }
317
- if (!t2.injectFullCSS)
317
+ if (!config.injectFullCSS)
318
318
  return;
319
- const o2 = p(r, e);
320
- t2.strategy === "runtime" ? v(E.FULL, o2) : t2.strategy === "hybrid" && requestIdleCallback(() => {
321
- v(E.FULL, o2);
319
+ const fullCSS = generateFullCSS(finalPreset, cssOptions);
320
+ config.strategy === "runtime" ? injectCSS(CSS_IDS.FULL, fullCSS) : config.strategy === "hybrid" && requestIdleCallback(() => {
321
+ injectCSS(CSS_IDS.FULL, fullCSS);
322
322
  }, { timeout: 100 });
323
323
  }
324
- function M(r, t2) {
325
- r.provide("mazThemeState", t2), r.config.globalProperties.$mazThemeState = t2;
324
+ function injectThemeState(app, themeState) {
325
+ app.provide("mazThemeState", themeState), app.config.globalProperties.$mazThemeState = themeState;
326
326
  }
327
- const L = {
328
- async install(r, t2) {
329
- const e = {
327
+ const MazUiTheme = {
328
+ async install(app, options) {
329
+ const config = {
330
330
  strategy: "runtime",
331
331
  overrides: {},
332
332
  darkModeStrategy: "class",
333
- colorMode: (t2?.mode !== "both" ? t2?.mode : t2?.colorMode) ?? "auto",
333
+ colorMode: (options?.mode !== "both" ? options?.mode : options?.colorMode) ?? "auto",
334
334
  injectCriticalCSS: !0,
335
335
  injectFullCSS: !0,
336
336
  mode: "both",
337
- ...t2
338
- }, o$2 = e.mode !== "both" ? e.mode : o$1(e.colorMode), a = o$2 === "auto" && e.mode === "both" ? n() : o$2 === "dark" || e.mode === "dark", m2 = reactive({
337
+ ...options
338
+ }, colorMode = config.mode !== "both" ? config.mode : getColorMode(config.colorMode), isDark = colorMode === "auto" && config.mode === "both" ? isSystemPrefersDark() : colorMode === "dark" || config.mode === "dark", themeState = reactive({
339
339
  currentPreset: void 0,
340
- mode: e.mode,
341
- colorMode: o$2,
342
- isDark: a,
343
- strategy: e.strategy,
344
- darkModeStrategy: e.darkModeStrategy
340
+ mode: config.mode,
341
+ colorMode,
342
+ isDark,
343
+ strategy: config.strategy,
344
+ darkModeStrategy: config.darkModeStrategy
345
345
  });
346
- g(e.darkModeStrategy, a), M(r, m2);
347
- const i2 = e.strategy === "buildtime" ? e.preset : await o(e.preset), d2 = Object.keys(e.overrides).length > 0 && i2 ? f(i2, e.overrides) : i2;
348
- d2 && (m2.currentPreset = d2), !(e.strategy === "buildtime" || !d2) && k(d2, e);
346
+ applyDarkMode(config.darkModeStrategy, isDark), injectThemeState(app, themeState);
347
+ const preset = config.strategy === "buildtime" ? config.preset : await getPreset(config.preset), finalPreset = Object.keys(config.overrides).length > 0 && preset ? mergePresets(preset, config.overrides) : preset;
348
+ finalPreset && (themeState.currentPreset = finalPreset), !(config.strategy === "buildtime" || !finalPreset) && injectThemeCSS(finalPreset, config);
349
349
  }
350
350
  }, MazUi = {
351
351
  install(app, options) {
352
352
  const { theme, translations } = options;
353
- app.use(L, theme), app.use(MazUiTranslations, translations);
353
+ app.use(MazUiTheme, theme), app.use(MazUiTranslations, translations);
354
354
  }
355
355
  };
356
356
  export {
@@ -1,5 +1,5 @@
1
- import { p } from "../chunks/pascalCase.BKTE3qqE.js";
2
- const a = [
1
+ import { p as pascalCase } from "../chunks/pascalCase.GdDKKQ-O.js";
2
+ const iconList = [
3
3
  "MazAcademicCap",
4
4
  "MazAdjustmentsHorizontal",
5
5
  "MazAdjustmentsVertical",
@@ -846,10 +846,10 @@ function MazComponentsResolver(options) {
846
846
  type: "component",
847
847
  resolve: (name) => {
848
848
  const { devMode = !1 } = options || {}, base = devMode ? "maz-ui/src/components" : "maz-ui/components", extension = devMode ? ".vue" : "";
849
- if (/^(Maz[A-Z])/.test(name) && !a.includes(name))
849
+ if (/^(Maz[A-Z])/.test(name) && !iconList.includes(name))
850
850
  return { from: `${base}/${name}${extension}` };
851
851
  if (/^(maz-[a-z])/.test(name))
852
- return { from: `${base}/${p(name)}` };
852
+ return { from: `${base}/${pascalCase(name)}` };
853
853
  }
854
854
  };
855
855
  }
@@ -1,10 +1,10 @@
1
- import { r } from "../chunks/capitalize.CVQ1jDrh.js";
1
+ import { c as capitalize } from "../chunks/capitalize.BF6CDS_4.js";
2
2
  function MazDirectivesResolver(options) {
3
3
  return {
4
4
  type: "directive",
5
5
  resolve: (name) => {
6
6
  const { devMode = !1, prefix = "" } = options || {};
7
- return { from: devMode ? "maz-ui/src/directives/index.ts" : "maz-ui/directives", as: `v${r(prefix)}${r(name.replace(/^v/, ""))}`, name: `v${name}` };
7
+ return { from: devMode ? "maz-ui/src/directives/index.ts" : "maz-ui/directives", as: `v${capitalize(prefix)}${capitalize(name.replace(/^v/, ""))}`, name: `v${name}` };
8
8
  }
9
9
  };
10
10
  }
@@ -1,4 +1,4 @@
1
- import { r } from "../chunks/capitalize.CVQ1jDrh.js";
1
+ import { c as capitalize } from "../chunks/capitalize.BF6CDS_4.js";
2
2
  const composablesMap = {
3
3
  useInjectStrict: !0,
4
4
  useAos: !0,
@@ -59,13 +59,13 @@ function MazModulesResolver(options) {
59
59
  return {
60
60
  from: `${base}${extension}`,
61
61
  name,
62
- as: `${prefix.toLowerCase()}${r(name)}`
62
+ as: `${prefix.toLowerCase()}${capitalize(name)}`
63
63
  };
64
64
  if (composablesMap[name] === !0)
65
65
  return {
66
66
  from: `${base}/composables${extension}`,
67
67
  name,
68
- as: `use${r(prefix)}${name.replace(/^use/, "")}`
68
+ as: `use${capitalize(prefix)}${name.replace(/^use/, "")}`
69
69
  };
70
70
  };
71
71
  }