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.
- package/dist/assets/MazDatePicker.D5Hzcubb.css +1 -0
- package/dist/assets/MazSelect.BX67LsNc.css +1 -0
- package/dist/chunks/{MazDatePicker.B3DDfxjV.js → MazDatePicker.CkJpZYHM.js} +24 -24
- 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
- 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
- package/dist/chunks/{MazInputPhoneNumber.CDy6n_Qj.js → MazInputPhoneNumber.CfClhmow.js} +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
- package/dist/chunks/{MazPickerCalendar.B5IHMawO.js → MazPickerCalendar.4X9zAxOA.js} +1 -1
- package/dist/chunks/{MazPickerCalendarMonth.TJfbseNp.js → MazPickerCalendarMonth.LQs0NMnx.js} +6 -6
- package/dist/chunks/{MazPickerCalendarSwitcher.lOvJV15Q.js → MazPickerCalendarSwitcher.5d6kOHZ6.js} +8 -8
- package/dist/chunks/{MazPickerContainer.DP0fFknc.js → MazPickerContainer.Dt1Np6w2.js} +1 -1
- package/dist/chunks/{MazPickerHeader.JAJVo08c.js → MazPickerHeader.B3prGklk.js} +12 -12
- package/dist/chunks/{MazPickerMonthSwitcher.C3OsIZfi.js → MazPickerMonthSwitcher.D1bsoD4Q.js} +8 -8
- package/dist/chunks/{MazPickerTime.BpMRZUGU.js → MazPickerTime.DrdtXsuy.js} +1 -1
- package/dist/chunks/{MazPickerYearSwitcher.Da4W6W5q.js → MazPickerYearSwitcher.mwQmfacb.js} +2 -2
- 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
- package/dist/chunks/{PhoneInput.DukRZp5u.js → PhoneInput.BE6bXfav.js} +1 -1
- package/dist/chunks/capitalize.BF6CDS_4.js +6 -0
- package/dist/chunks/checkAvailability.aTpZidex.js +16 -0
- package/dist/chunks/debounce.Brzkn9pm.js +11 -0
- package/dist/chunks/{dom-events.H9KIOv83.js → dom-events.CfOiauCR.js} +41 -41
- package/dist/chunks/{fullscreen-img.directive.D9oQ3Gni.js → fullscreen-img.directive.B8ESs0MK.js} +2 -2
- package/dist/chunks/{isClient.8V3qjGdO.js → isClient.WI4oSt66.js} +2 -2
- package/dist/chunks/{mazUi.CaSMOKic.js → mazUi.raWwR54O.js} +2 -2
- package/dist/chunks/{obsidian.C6upWOVF.js → obsidian.Cy0R8RHy.js} +2 -2
- package/dist/chunks/{ocean.ehMlC0HV.js → ocean.pHrY5H_S.js} +2 -2
- package/dist/chunks/pascalCase.GdDKKQ-O.js +19 -0
- package/dist/chunks/{pristine.DMG3eBuN.js → pristine.CxBZzgUG.js} +2 -2
- package/dist/chunks/sleep.BLRH1qZG.js +6 -0
- package/dist/chunks/truthyFilter.C2WOKUCG.js +6 -0
- package/dist/chunks/{useStringMatching.DzSigyZ7.js → useStringMatching.CqudA-tS.js} +25 -25
- package/dist/chunks/{vClickOutside.CJBKY5no.js → vClickOutside.DIOiluy0.js} +6 -6
- package/dist/components/MazAnimatedCounter.js +3 -3
- package/dist/components/MazAnimatedText.js +2 -2
- package/dist/components/MazChecklist.js +4 -4
- package/dist/components/MazDatePicker.js +1 -1
- package/dist/components/MazDropdown.js +1 -1
- package/dist/components/MazDropzone.js +3 -3
- package/dist/components/MazGallery.js +1 -1
- package/dist/components/MazInput.js +2 -2
- package/dist/components/MazInputNumber.js +1 -1
- package/dist/components/MazInputPhoneNumber.js +1 -1
- package/dist/components/MazInputPrice.js +1 -1
- package/dist/components/MazInputPrice.vue.d.ts +1 -1
- package/dist/components/MazInputTags.js +3 -3
- package/dist/components/MazPopover.js +9 -9
- package/dist/components/MazPullToRefresh.js +6 -6
- package/dist/components/MazReadingProgressBar.js +7 -7
- package/dist/components/MazSelect.js +67 -57
- package/dist/components/MazSelect.vue.d.ts +21 -4
- package/dist/components/MazSelectCountry.js +15 -13
- package/dist/components/MazSlider.js +34 -34
- package/dist/components/MazTabsBar.js +2 -2
- package/dist/components/MazTabsContent.js +1 -1
- package/dist/components/MazTextarea.js +5 -5
- package/dist/components/index.js +6 -6
- package/dist/composables/index.js +1 -1
- package/dist/composables/useDisplayNames.js +2 -2
- package/dist/composables/useDropzone.js +2 -2
- package/dist/composables/useFormField.js +2 -2
- package/dist/composables/useFormValidator.js +1 -1
- package/dist/composables/useIdleTimeout.js +27 -27
- package/dist/composables/useMutationObserver.js +4 -4
- package/dist/composables/useStringMatching.js +1 -1
- package/dist/composables/useSwipe.js +22 -22
- package/dist/composables/useUserVisibility.js +8 -8
- package/dist/composables/useWindowSize.js +2 -2
- package/dist/directives/index.js +2 -2
- package/dist/directives/vClickOutside.js +1 -1
- package/dist/directives/vFullscreenImg.js +1 -1
- package/dist/plugins/aos.js +5 -5
- package/dist/plugins/maz-ui.js +208 -208
- package/dist/resolvers/MazComponentsResolver.js +4 -4
- package/dist/resolvers/MazDirectivesResolver.js +2 -2
- package/dist/resolvers/MazModulesResolver.js +3 -3
- package/dist/types/components/MazInputPrice.vue.d.ts +1 -1
- package/dist/types/components/MazSelect.vue.d.ts +21 -4
- package/package.json +8 -8
- package/dist/assets/MazDatePicker.BK088IpL.css +0 -1
- package/dist/assets/MazSelect.BjrOOGvL.css +0 -1
- package/dist/chunks/capitalize.CVQ1jDrh.js +0 -6
- package/dist/chunks/checkAvailability.UFZSC8-1.js +0 -16
- package/dist/chunks/debounce.DhXdop6X.js +0 -11
- package/dist/chunks/pascalCase.BKTE3qqE.js +0 -19
- package/dist/chunks/sleep.Ci7GE4BQ.js +0 -6
- package/dist/chunks/truthyFilter.DZvXmxeK.js +0 -6
package/dist/plugins/aos.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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
|
|
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 (
|
|
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,
|
|
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
|
}
|
package/dist/plugins/maz-ui.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { reactive } from "vue";
|
|
2
2
|
import { MazUiTranslations } from "@maz-ui/translations";
|
|
3
|
-
function
|
|
4
|
-
const
|
|
5
|
-
if (!
|
|
6
|
-
throw new Error(`Invalid HSL format: ${
|
|
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(
|
|
9
|
-
s: Number.parseFloat(
|
|
10
|
-
l: Number.parseFloat(
|
|
8
|
+
h: Number.parseFloat(match[1]),
|
|
9
|
+
s: Number.parseFloat(match[2]),
|
|
10
|
+
l: Number.parseFloat(match[3])
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
const
|
|
15
|
-
return `${
|
|
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
|
|
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
|
|
31
|
-
if (
|
|
30
|
+
function calculateSaturationMultiplier(baseVariant, targetVariant, baseSaturation) {
|
|
31
|
+
if (targetVariant === baseVariant)
|
|
32
32
|
return 1;
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
35
|
-
const
|
|
36
|
-
return Math.max(0.3, 1 -
|
|
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
|
|
39
|
-
return Math.min(1.3, 1 +
|
|
38
|
+
const increase = variantDiff / 400 * 0.15 * saturationFactor;
|
|
39
|
+
return Math.min(1.3, 1 + increase);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
const { h
|
|
44
|
-
return
|
|
45
|
-
if (
|
|
46
|
-
|
|
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
|
|
49
|
-
let
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
|
|
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
|
-
}),
|
|
54
|
+
}), scale;
|
|
55
55
|
}
|
|
56
|
-
const
|
|
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
|
-
],
|
|
78
|
+
], DEFAULT_CRITICAL_FOUNDATION = [
|
|
79
79
|
"radius",
|
|
80
80
|
"font-family",
|
|
81
81
|
"base-font-size",
|
|
82
82
|
"border-width"
|
|
83
|
-
],
|
|
84
|
-
function
|
|
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
|
|
90
|
-
criticalFoundation
|
|
91
|
-
mode
|
|
92
|
-
darkSelectorStrategy
|
|
93
|
-
prefix
|
|
94
|
-
} =
|
|
95
|
-
let
|
|
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 (
|
|
98
|
-
const
|
|
99
|
-
|
|
97
|
+
if (mode === "light" || mode === "both") {
|
|
98
|
+
const lightCritical = extractCriticalVariables(preset.colors.light, criticalColors);
|
|
99
|
+
css += generateVariablesBlock({
|
|
100
100
|
selector: ":root",
|
|
101
|
-
colors:
|
|
102
|
-
foundation:
|
|
103
|
-
prefix
|
|
101
|
+
colors: lightCritical,
|
|
102
|
+
foundation: foundationCritical,
|
|
103
|
+
prefix
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
|
-
if (
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
selector:
|
|
110
|
-
mediaQuery:
|
|
111
|
-
colors:
|
|
112
|
-
foundation:
|
|
113
|
-
prefix
|
|
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
|
|
117
|
-
`,
|
|
116
|
+
return css += `}
|
|
117
|
+
`, css;
|
|
118
118
|
}
|
|
119
|
-
function
|
|
119
|
+
function generateFullCSS(preset, options = {
|
|
120
120
|
mode: "both",
|
|
121
121
|
darkSelectorStrategy: "class"
|
|
122
122
|
}) {
|
|
123
123
|
const {
|
|
124
|
-
excludeCritical
|
|
125
|
-
mode
|
|
126
|
-
darkSelectorStrategy
|
|
127
|
-
prefix
|
|
128
|
-
includeColorScales
|
|
129
|
-
} =
|
|
130
|
-
let
|
|
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 (
|
|
133
|
-
const
|
|
134
|
-
|
|
132
|
+
if (mode === "light" || mode === "both") {
|
|
133
|
+
const lightColors = excludeVariables(preset.colors.light, excludeCritical);
|
|
134
|
+
css += generateVariablesBlock({
|
|
135
135
|
selector: ":root",
|
|
136
|
-
colors:
|
|
137
|
-
foundation
|
|
138
|
-
prefix
|
|
139
|
-
includeScales:
|
|
140
|
-
preset
|
|
136
|
+
colors: lightColors,
|
|
137
|
+
foundation,
|
|
138
|
+
prefix,
|
|
139
|
+
includeScales: includeColorScales,
|
|
140
|
+
preset
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
|
-
if (
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
selector:
|
|
147
|
-
mediaQuery:
|
|
148
|
-
colors:
|
|
149
|
-
foundation:
|
|
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
|
|
152
|
-
includeScales:
|
|
153
|
-
preset
|
|
151
|
+
prefix,
|
|
152
|
+
includeScales: includeColorScales,
|
|
153
|
+
preset,
|
|
154
154
|
isDark: !0
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
|
-
return
|
|
158
|
-
`,
|
|
157
|
+
return css += `}
|
|
158
|
+
`, css;
|
|
159
159
|
}
|
|
160
|
-
function
|
|
160
|
+
function extractCriticalVariables(colors, criticalKeys) {
|
|
161
161
|
return Object.fromEntries(
|
|
162
|
-
|
|
162
|
+
criticalKeys.filter((key) => colors[key]).map((key) => [key, colors[key]])
|
|
163
163
|
);
|
|
164
164
|
}
|
|
165
|
-
function
|
|
166
|
-
return
|
|
167
|
-
|
|
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
|
|
170
|
+
function excludeVariables(colors, excludeKeys) {
|
|
171
171
|
return Object.fromEntries(
|
|
172
|
-
Object.entries(
|
|
172
|
+
Object.entries(colors).filter(([key]) => !excludeKeys.includes(key))
|
|
173
173
|
);
|
|
174
174
|
}
|
|
175
|
-
function
|
|
176
|
-
return
|
|
177
|
-
Object.entries(
|
|
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
|
|
181
|
-
selector
|
|
182
|
-
mediaQuery
|
|
183
|
-
colors
|
|
184
|
-
foundation
|
|
185
|
-
prefix
|
|
186
|
-
includeScales
|
|
187
|
-
preset
|
|
188
|
-
isDark
|
|
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
|
|
191
|
-
if (
|
|
192
|
-
|
|
193
|
-
}),
|
|
194
|
-
|
|
195
|
-
}),
|
|
196
|
-
const
|
|
197
|
-
|
|
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
|
|
199
|
+
const content = variables.join(`
|
|
200
200
|
`);
|
|
201
|
-
return
|
|
202
|
-
${
|
|
203
|
-
${
|
|
204
|
-
${
|
|
201
|
+
return mediaQuery ? `
|
|
202
|
+
${mediaQuery} {
|
|
203
|
+
${selector} {
|
|
204
|
+
${content.replace(/^/gm, " ")}
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
` : `
|
|
208
|
-
${
|
|
209
|
-
${
|
|
208
|
+
${selector} {
|
|
209
|
+
${content}
|
|
210
210
|
}
|
|
211
211
|
`;
|
|
212
212
|
}
|
|
213
|
-
function
|
|
214
|
-
const
|
|
215
|
-
return
|
|
216
|
-
const
|
|
217
|
-
if (
|
|
218
|
-
const
|
|
219
|
-
Object.entries(
|
|
220
|
-
|
|
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
|
-
}),
|
|
223
|
+
}), colorScales;
|
|
224
224
|
}
|
|
225
|
-
var
|
|
226
|
-
function
|
|
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
|
|
230
|
-
if (!
|
|
231
|
-
const
|
|
232
|
-
|
|
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 (
|
|
236
|
-
|
|
235
|
+
if (styleElements.length === 1) {
|
|
236
|
+
styleElements[0].textContent = css;
|
|
237
237
|
return;
|
|
238
238
|
}
|
|
239
|
-
if (
|
|
240
|
-
for (let
|
|
241
|
-
|
|
242
|
-
|
|
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
|
|
245
|
+
function getCookie(key) {
|
|
246
246
|
if (typeof document > "u")
|
|
247
247
|
return null;
|
|
248
|
-
const
|
|
249
|
-
return
|
|
248
|
+
const cookie = document.cookie.split(";").find((c) => c.trim().startsWith(`${key}=`));
|
|
249
|
+
return cookie ? decodeURIComponent(cookie.split("=")[1]) : null;
|
|
250
250
|
}
|
|
251
|
-
function
|
|
252
|
-
if (
|
|
253
|
-
return
|
|
254
|
-
const
|
|
255
|
-
return
|
|
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
|
|
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
|
|
261
|
-
return typeof
|
|
260
|
+
function isPresetObject(preset) {
|
|
261
|
+
return typeof preset == "object" && preset !== null && !!preset.name;
|
|
262
262
|
}
|
|
263
|
-
async function
|
|
264
|
-
if (
|
|
265
|
-
return
|
|
266
|
-
if (
|
|
267
|
-
const { mazUi
|
|
268
|
-
return
|
|
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 (
|
|
271
|
-
const { ocean
|
|
272
|
-
return
|
|
270
|
+
if (preset === "ocean") {
|
|
271
|
+
const { ocean } = await import("../chunks/ocean.pHrY5H_S.js");
|
|
272
|
+
return ocean;
|
|
273
273
|
}
|
|
274
|
-
if (
|
|
275
|
-
const { pristine
|
|
276
|
-
return
|
|
274
|
+
if (preset === "pristine") {
|
|
275
|
+
const { pristine } = await import("../chunks/pristine.CxBZzgUG.js");
|
|
276
|
+
return pristine;
|
|
277
277
|
}
|
|
278
|
-
if (
|
|
279
|
-
const { obsidian
|
|
280
|
-
return
|
|
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 ${
|
|
282
|
+
throw new TypeError(`[@maz-ui/themes] Preset ${preset} not found`);
|
|
283
283
|
}
|
|
284
|
-
function
|
|
284
|
+
function mergePresets(base, overrides) {
|
|
285
285
|
return {
|
|
286
|
-
name:
|
|
286
|
+
name: overrides.name || base.name,
|
|
287
287
|
foundation: {
|
|
288
|
-
...
|
|
289
|
-
...
|
|
288
|
+
...base.foundation,
|
|
289
|
+
...overrides.foundation
|
|
290
290
|
},
|
|
291
291
|
colors: {
|
|
292
|
-
light:
|
|
293
|
-
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
|
|
298
|
-
return
|
|
299
|
-
...
|
|
300
|
-
...
|
|
301
|
-
} :
|
|
297
|
+
function mergeColors(base, overrides) {
|
|
298
|
+
return overrides ? {
|
|
299
|
+
...base,
|
|
300
|
+
...overrides
|
|
301
|
+
} : base;
|
|
302
302
|
}
|
|
303
|
-
function
|
|
304
|
-
typeof document > "u" ||
|
|
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
|
|
306
|
+
function injectThemeCSS(finalPreset, config) {
|
|
307
307
|
if (typeof document > "u")
|
|
308
308
|
return;
|
|
309
|
-
const
|
|
310
|
-
mode:
|
|
311
|
-
darkSelectorStrategy:
|
|
309
|
+
const cssOptions = {
|
|
310
|
+
mode: config.mode,
|
|
311
|
+
darkSelectorStrategy: config.darkModeStrategy
|
|
312
312
|
};
|
|
313
|
-
if (
|
|
314
|
-
const
|
|
315
|
-
|
|
313
|
+
if (config.injectCriticalCSS) {
|
|
314
|
+
const criticalCSS = generateCriticalCSS(finalPreset, cssOptions);
|
|
315
|
+
injectCSS(CSS_IDS.CRITICAL, criticalCSS);
|
|
316
316
|
}
|
|
317
|
-
if (!
|
|
317
|
+
if (!config.injectFullCSS)
|
|
318
318
|
return;
|
|
319
|
-
const
|
|
320
|
-
|
|
321
|
-
|
|
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
|
|
325
|
-
|
|
324
|
+
function injectThemeState(app, themeState) {
|
|
325
|
+
app.provide("mazThemeState", themeState), app.config.globalProperties.$mazThemeState = themeState;
|
|
326
326
|
}
|
|
327
|
-
const
|
|
328
|
-
async install(
|
|
329
|
-
const
|
|
327
|
+
const MazUiTheme = {
|
|
328
|
+
async install(app, options) {
|
|
329
|
+
const config = {
|
|
330
330
|
strategy: "runtime",
|
|
331
331
|
overrides: {},
|
|
332
332
|
darkModeStrategy: "class",
|
|
333
|
-
colorMode: (
|
|
333
|
+
colorMode: (options?.mode !== "both" ? options?.mode : options?.colorMode) ?? "auto",
|
|
334
334
|
injectCriticalCSS: !0,
|
|
335
335
|
injectFullCSS: !0,
|
|
336
336
|
mode: "both",
|
|
337
|
-
...
|
|
338
|
-
},
|
|
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:
|
|
341
|
-
colorMode
|
|
342
|
-
isDark
|
|
343
|
-
strategy:
|
|
344
|
-
darkModeStrategy:
|
|
340
|
+
mode: config.mode,
|
|
341
|
+
colorMode,
|
|
342
|
+
isDark,
|
|
343
|
+
strategy: config.strategy,
|
|
344
|
+
darkModeStrategy: config.darkModeStrategy
|
|
345
345
|
});
|
|
346
|
-
|
|
347
|
-
const
|
|
348
|
-
|
|
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(
|
|
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.
|
|
2
|
-
const
|
|
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) && !
|
|
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}/${
|
|
852
|
+
return { from: `${base}/${pascalCase(name)}` };
|
|
853
853
|
}
|
|
854
854
|
};
|
|
855
855
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
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${
|
|
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 {
|
|
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()}${
|
|
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${
|
|
68
|
+
as: `use${capitalize(prefix)}${name.replace(/^use/, "")}`
|
|
69
69
|
};
|
|
70
70
|
};
|
|
71
71
|
}
|