@m3ui-vue/m3ui-vue 1.0.1 → 1.0.3
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/API.md +636 -20
- package/dist/MMenuItem-DFyXflk9.js +707 -0
- package/dist/MMenuItem-DFyXflk9.js.map +1 -0
- package/dist/MSlider-CdNIH7jc.js +1376 -0
- package/dist/MSlider-CdNIH7jc.js.map +1 -0
- package/dist/MTextField-B4X92vH_.js +671 -0
- package/dist/MTextField-B4X92vH_.js.map +1 -0
- package/dist/api.json +1 -1
- package/dist/chart.js +1 -1
- package/dist/chart.js.map +1 -1
- package/dist/code-editor.js +1 -1
- package/dist/components/MIconButton.vue.d.ts +1 -1
- package/dist/components/MMap.vue.d.ts +74 -0
- package/dist/components/MMapBaseLayers.vue.d.ts +15 -0
- package/dist/components/MMapControl.vue.d.ts +23 -0
- package/dist/components/MMapFeatureInfo.vue.d.ts +25 -0
- package/dist/components/MMapFilter.vue.d.ts +19 -0
- package/dist/components/MMapGeoJson.vue.d.ts +34 -0
- package/dist/components/MMapHover.vue.d.ts +17 -0
- package/dist/components/MMapIdentify.vue.d.ts +37 -0
- package/dist/components/MMapLayers.vue.d.ts +31 -0
- package/dist/components/MMapMarker.vue.d.ts +42 -0
- package/dist/components/MMapMeasure.vue.d.ts +43 -0
- package/dist/components/MMapPopup.vue.d.ts +43 -0
- package/dist/components/MMapSearch.vue.d.ts +28 -0
- package/dist/components/MShader.vue.d.ts +9 -3
- package/dist/components/_MMapLayerItem.vue.d.ts +25 -0
- package/dist/composables/_hydration.d.ts +4 -0
- package/dist/composables/_mapGeometry.d.ts +13 -0
- package/dist/composables/_ssrState.d.ts +30 -0
- package/dist/composables/_storageKeys.d.ts +3 -0
- package/dist/composables/_useThemeTokens.d.ts +7 -0
- package/dist/composables/mapAdapters.d.ts +111 -0
- package/dist/composables/mapSearch.d.ts +31 -0
- package/dist/composables/themeInitScript.d.ts +22 -0
- package/dist/composables/useColorPalette.d.ts +176 -6
- package/dist/composables/useLocale.d.ts +30 -0
- package/dist/composables/useMap.d.ts +47 -0
- package/dist/composables/useMapFilter.d.ts +10 -0
- package/dist/composables/useMapLayers.d.ts +30 -0
- package/dist/composables/useTheme.d.ts +2 -0
- package/dist/index.d.ts +4 -1
- package/dist/locales/index.js +217 -7
- package/dist/locales/index.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +6742 -7961
- package/dist/m3ui.js.map +1 -1
- package/dist/map.d.ts +24 -0
- package/dist/map.js +1931 -0
- package/dist/map.js.map +1 -0
- package/dist/plugin.d.ts +25 -2
- package/dist/rich-text-editor.js +27 -26
- package/dist/rich-text-editor.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/{useLocale-CuvWRZ1h.js → useLocale-b5-hzsL3.js} +32 -2
- package/dist/useLocale-b5-hzsL3.js.map +1 -0
- package/package.json +11 -2
- package/src/__tests__/MFab.test.ts +52 -6
- package/src/__tests__/MMap.test.ts +292 -0
- package/src/__tests__/MMapLayers.test.ts +257 -0
- package/src/__tests__/MMapTools.test.ts +233 -0
- package/src/__tests__/MShader.test.ts +16 -0
- package/src/__tests__/_fakeMaplibre.ts +158 -0
- package/src/__tests__/hydration.test.ts +119 -0
- package/src/__tests__/ssr.test.ts +171 -0
- package/src/__tests__/ssrState.test.ts +155 -0
- package/src/__tests__/themeInitScript.test.ts +122 -0
- package/src/components/MChart.vue +3 -2
- package/src/components/MFab.vue +29 -7
- package/src/components/MIconButton.vue +1 -1
- package/src/components/MLightbox.vue +10 -1
- package/src/components/MMap.vue +522 -0
- package/src/components/MMapBaseLayers.vue +67 -0
- package/src/components/MMapControl.vue +61 -0
- package/src/components/MMapFeatureInfo.vue +41 -0
- package/src/components/MMapFilter.vue +80 -0
- package/src/components/MMapGeoJson.vue +136 -0
- package/src/components/MMapHover.vue +131 -0
- package/src/components/MMapIdentify.vue +103 -0
- package/src/components/MMapLayers.vue +111 -0
- package/src/components/MMapMarker.vue +102 -0
- package/src/components/MMapMeasure.vue +452 -0
- package/src/components/MMapPopup.vue +99 -0
- package/src/components/MMapSearch.vue +162 -0
- package/src/components/MSearchBar.vue +4 -1
- package/src/components/MShader.vue +11 -3
- package/src/components/_MMapLayerItem.vue +77 -0
- package/src/composables/_hydration.ts +10 -0
- package/src/composables/_mapGeometry.ts +75 -0
- package/src/composables/_ssrState.ts +80 -0
- package/src/composables/_storageKeys.ts +6 -0
- package/src/composables/_useThemeTokens.ts +42 -0
- package/src/composables/mapAdapters.ts +208 -0
- package/src/composables/mapSearch.ts +56 -0
- package/src/composables/themeInitScript.ts +51 -0
- package/src/composables/useColorPalette.ts +32 -14
- package/src/composables/useLocale.ts +62 -0
- package/src/composables/useMap.ts +98 -0
- package/src/composables/useMapFilter.ts +45 -0
- package/src/composables/useMapLayers.ts +124 -0
- package/src/composables/useTheme.ts +18 -7
- package/src/composables/useWindowSizeClass.ts +23 -4
- package/src/index.ts +4 -1
- package/src/locales/de.ts +31 -1
- package/src/locales/es.ts +31 -1
- package/src/locales/fr.ts +31 -1
- package/src/locales/ja.ts +31 -1
- package/src/locales/ko.ts +31 -1
- package/src/locales/pt.ts +31 -1
- package/src/locales/zh.ts +31 -1
- package/src/map.ts +32 -0
- package/src/plugin.ts +77 -13
- package/dist/MTextField-BPbFeI9M.js +0 -1368
- package/dist/MTextField-BPbFeI9M.js.map +0 -1
- package/dist/useLocale-CuvWRZ1h.js.map +0 -1
|
@@ -0,0 +1,671 @@
|
|
|
1
|
+
import { i as e } from "./useLocale-b5-hzsL3.js";
|
|
2
|
+
import { t } from "./MIcon-DLOkQduI.js";
|
|
3
|
+
import { computed as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createTextVNode as s, createVNode as c, defineComponent as l, normalizeClass as u, normalizeStyle as d, onBeforeUnmount as f, onMounted as p, onUnmounted as m, openBlock as h, ref as g, renderSlot as _, resolveDynamicComponent as v, toDisplayString as y, unref as b, useId as x, useSlots as S, watch as C, withCtx as w, withDirectives as T } from "vue";
|
|
4
|
+
//#region src/directives/vRipple.ts
|
|
5
|
+
function E(e) {
|
|
6
|
+
return e === !1 ? { disabled: !0 } : typeof e == "string" ? { color: e } : e === !0 || e == null ? {} : e;
|
|
7
|
+
}
|
|
8
|
+
function D(e, t, n) {
|
|
9
|
+
let r = e.getBoundingClientRect(), i = Math.max(r.width, r.height) * 2, a = document.createElement("span");
|
|
10
|
+
a.className = "m3-ripple-layer";
|
|
11
|
+
let o = document.createElement("span");
|
|
12
|
+
o.className = "m3-ripple", o.style.cssText = `width:${i}px;height:${i}px;top:${t.clientY - r.top - i / 2}px;left:${t.clientX - r.left - i / 2}px`, n && (o.style.background = n), a.appendChild(o), e.appendChild(a), o.addEventListener("animationend", () => a.remove(), { once: !0 });
|
|
13
|
+
}
|
|
14
|
+
var O = /* @__PURE__ */ new WeakMap(), k = {
|
|
15
|
+
mounted(e, t) {
|
|
16
|
+
let n = {
|
|
17
|
+
options: E(t.value),
|
|
18
|
+
onPointerDown(t) {
|
|
19
|
+
if (n.options.disabled || t.button !== 0) return;
|
|
20
|
+
let { position: r } = getComputedStyle(e);
|
|
21
|
+
(!r || r === "static") && (e.style.position = "relative"), D(e, t, n.options.color);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
O.set(e, n), e.addEventListener("pointerdown", n.onPointerDown);
|
|
25
|
+
},
|
|
26
|
+
updated(e, t) {
|
|
27
|
+
let n = O.get(e);
|
|
28
|
+
n && (n.options = E(t.value));
|
|
29
|
+
},
|
|
30
|
+
beforeUnmount(e) {
|
|
31
|
+
let t = O.get(e);
|
|
32
|
+
t && e.removeEventListener("pointerdown", t.onPointerDown), O.delete(e);
|
|
33
|
+
}
|
|
34
|
+
}, A = ["aria-label"], j = {
|
|
35
|
+
key: 0,
|
|
36
|
+
class: "block h-full w-full animate-spin rounded-full border-2 border-current border-t-transparent"
|
|
37
|
+
}, M = [
|
|
38
|
+
"width",
|
|
39
|
+
"height",
|
|
40
|
+
"viewBox"
|
|
41
|
+
], N = ["d", "stroke-dasharray"], P = 3, F = 9, I = /* @__PURE__ */ l({
|
|
42
|
+
__name: "MSpinner",
|
|
43
|
+
props: {
|
|
44
|
+
size: { default: 20 },
|
|
45
|
+
wavy: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: !1
|
|
48
|
+
},
|
|
49
|
+
label: {}
|
|
50
|
+
},
|
|
51
|
+
setup(t) {
|
|
52
|
+
let r = t, i = e(), s = n(() => (r.size / 2 - 1 - P / 2) / 1.25), c = n(() => r.size / 2), l = n(() => {
|
|
53
|
+
let e = c.value, t = s.value, n = t * .08, r = [], i = 0, a = 0, o = 0;
|
|
54
|
+
for (let s = 0; s <= 216; s++) {
|
|
55
|
+
let c = 2 * Math.PI * s / 216 - Math.PI / 2, l = t + n * Math.sin(F * c), u = e + l * Math.cos(c), d = e + l * Math.sin(c);
|
|
56
|
+
s > 0 && (i += Math.sqrt((u - a) ** 2 + (d - o) ** 2)), r.push(`${s === 0 ? "M" : "L"}${u.toFixed(2)},${d.toFixed(2)}`), a = u, o = d;
|
|
57
|
+
}
|
|
58
|
+
let l = i * .58, u = i - l, d = `${l.toFixed(1)} ${u.toFixed(1)}`;
|
|
59
|
+
return {
|
|
60
|
+
path: r.join("") + "Z",
|
|
61
|
+
dash: d,
|
|
62
|
+
len: i.toFixed(1)
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
return (e, n) => (h(), a("span", {
|
|
66
|
+
class: "inline-flex shrink-0 items-center justify-center",
|
|
67
|
+
style: d({
|
|
68
|
+
width: `${t.size}px`,
|
|
69
|
+
height: `${t.size}px`
|
|
70
|
+
}),
|
|
71
|
+
role: "status",
|
|
72
|
+
"aria-label": t.label ?? b(i).loading
|
|
73
|
+
}, [t.wavy ? (h(), a("svg", {
|
|
74
|
+
key: 1,
|
|
75
|
+
width: t.size,
|
|
76
|
+
height: t.size,
|
|
77
|
+
viewBox: `0 0 ${t.size} ${t.size}`,
|
|
78
|
+
fill: "none",
|
|
79
|
+
class: "animate-[m3-wavy-spin_2.8s_linear_infinite]",
|
|
80
|
+
style: d(`transform-origin: ${c.value}px ${c.value}px`)
|
|
81
|
+
}, [o("path", {
|
|
82
|
+
d: l.value.path,
|
|
83
|
+
stroke: "currentColor",
|
|
84
|
+
"stroke-width": P,
|
|
85
|
+
"stroke-linecap": "round",
|
|
86
|
+
"stroke-dasharray": l.value.dash,
|
|
87
|
+
class: "animate-[m3-wavy-travel_2s_linear_infinite]",
|
|
88
|
+
style: d({ "--m3-wave-len": l.value.len })
|
|
89
|
+
}, null, 12, N)], 12, M)) : (h(), a("span", j))], 12, A));
|
|
90
|
+
}
|
|
91
|
+
}), L = [
|
|
92
|
+
"bg-surface-container-highest",
|
|
93
|
+
"bg-surface-container-high",
|
|
94
|
+
"bg-surface-container-low",
|
|
95
|
+
"bg-surface-container-lowest",
|
|
96
|
+
"bg-surface-container",
|
|
97
|
+
"bg-surface-variant",
|
|
98
|
+
"bg-surface-bright",
|
|
99
|
+
"bg-surface-dim",
|
|
100
|
+
"bg-surface",
|
|
101
|
+
"bg-background",
|
|
102
|
+
"bg-inverse-surface",
|
|
103
|
+
"bg-primary-container",
|
|
104
|
+
"bg-secondary-container",
|
|
105
|
+
"bg-tertiary-container",
|
|
106
|
+
"bg-error-container",
|
|
107
|
+
"bg-primary-fixed",
|
|
108
|
+
"bg-primary-fixed-dim",
|
|
109
|
+
"bg-secondary-fixed",
|
|
110
|
+
"bg-secondary-fixed-dim",
|
|
111
|
+
"bg-tertiary-fixed",
|
|
112
|
+
"bg-tertiary-fixed-dim",
|
|
113
|
+
"bg-primary",
|
|
114
|
+
"bg-secondary",
|
|
115
|
+
"bg-tertiary",
|
|
116
|
+
"bg-error"
|
|
117
|
+
];
|
|
118
|
+
function R(e) {
|
|
119
|
+
for (let t of L) if (e.classList.contains(t)) return `var(--color-${t.slice(3)})`;
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
function ee(e) {
|
|
123
|
+
if (!e || e === "transparent") return !0;
|
|
124
|
+
let t = e.match(/^rgba?\(([^)]+)\)$/);
|
|
125
|
+
if (t) {
|
|
126
|
+
let e = t[1].split(",").map((e) => e.trim());
|
|
127
|
+
if (e.length === 4 && parseFloat(e[3]) === 0) return !0;
|
|
128
|
+
}
|
|
129
|
+
return !1;
|
|
130
|
+
}
|
|
131
|
+
function z(e, t) {
|
|
132
|
+
let r = g("var(--color-surface)");
|
|
133
|
+
function i(n) {
|
|
134
|
+
r.value = n, e.value?.style.setProperty("--field-bg", t() ?? n);
|
|
135
|
+
}
|
|
136
|
+
function a() {
|
|
137
|
+
let t = e.value?.parentElement ?? null;
|
|
138
|
+
for (; t;) {
|
|
139
|
+
let e = R(t);
|
|
140
|
+
if (e) {
|
|
141
|
+
i(e);
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
if (t === document.body) {
|
|
145
|
+
i("var(--color-surface)");
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
let n = getComputedStyle(t).backgroundColor;
|
|
149
|
+
if (!ee(n)) {
|
|
150
|
+
i(n);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
t = t.parentElement;
|
|
154
|
+
}
|
|
155
|
+
i("var(--color-surface)");
|
|
156
|
+
}
|
|
157
|
+
let o = null;
|
|
158
|
+
return p(() => {
|
|
159
|
+
a(), o = new MutationObserver(() => a()), o.observe(document.documentElement, {
|
|
160
|
+
attributes: !0,
|
|
161
|
+
attributeFilter: [
|
|
162
|
+
"class",
|
|
163
|
+
"style",
|
|
164
|
+
"data-theme"
|
|
165
|
+
]
|
|
166
|
+
});
|
|
167
|
+
}), f(() => o?.disconnect()), { resolvedFieldBg: n(() => t() ?? r.value) };
|
|
168
|
+
}
|
|
169
|
+
//#endregion
|
|
170
|
+
//#region src/composables/useDebounce.ts
|
|
171
|
+
function B(e, t) {
|
|
172
|
+
let n = null;
|
|
173
|
+
function r(...r) {
|
|
174
|
+
n && clearTimeout(n), n = setTimeout(() => {
|
|
175
|
+
n = null, e(...r);
|
|
176
|
+
}, t);
|
|
177
|
+
}
|
|
178
|
+
function i() {
|
|
179
|
+
n &&= (clearTimeout(n), null);
|
|
180
|
+
}
|
|
181
|
+
return f(i), {
|
|
182
|
+
debounced: r,
|
|
183
|
+
cancel: i
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
//#endregion
|
|
187
|
+
//#region src/composables/motion.ts
|
|
188
|
+
var V = {
|
|
189
|
+
standard: {
|
|
190
|
+
fastSpatial: {
|
|
191
|
+
dampingRatio: .9,
|
|
192
|
+
stiffness: 1400
|
|
193
|
+
},
|
|
194
|
+
defaultSpatial: {
|
|
195
|
+
dampingRatio: .9,
|
|
196
|
+
stiffness: 700
|
|
197
|
+
},
|
|
198
|
+
slowSpatial: {
|
|
199
|
+
dampingRatio: .9,
|
|
200
|
+
stiffness: 300
|
|
201
|
+
},
|
|
202
|
+
fastEffects: {
|
|
203
|
+
dampingRatio: 1,
|
|
204
|
+
stiffness: 3800
|
|
205
|
+
},
|
|
206
|
+
defaultEffects: {
|
|
207
|
+
dampingRatio: 1,
|
|
208
|
+
stiffness: 1600
|
|
209
|
+
},
|
|
210
|
+
slowEffects: {
|
|
211
|
+
dampingRatio: 1,
|
|
212
|
+
stiffness: 800
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
expressive: {
|
|
216
|
+
fastSpatial: {
|
|
217
|
+
dampingRatio: .6,
|
|
218
|
+
stiffness: 800
|
|
219
|
+
},
|
|
220
|
+
defaultSpatial: {
|
|
221
|
+
dampingRatio: .8,
|
|
222
|
+
stiffness: 380
|
|
223
|
+
},
|
|
224
|
+
slowSpatial: {
|
|
225
|
+
dampingRatio: .8,
|
|
226
|
+
stiffness: 200
|
|
227
|
+
},
|
|
228
|
+
fastEffects: {
|
|
229
|
+
dampingRatio: 1,
|
|
230
|
+
stiffness: 3800
|
|
231
|
+
},
|
|
232
|
+
defaultEffects: {
|
|
233
|
+
dampingRatio: 1,
|
|
234
|
+
stiffness: 1600
|
|
235
|
+
},
|
|
236
|
+
slowEffects: {
|
|
237
|
+
dampingRatio: 1,
|
|
238
|
+
stiffness: 800
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}, H = {
|
|
242
|
+
emphasized: [
|
|
243
|
+
.2,
|
|
244
|
+
0,
|
|
245
|
+
0,
|
|
246
|
+
1
|
|
247
|
+
],
|
|
248
|
+
emphasizedDecelerate: [
|
|
249
|
+
.05,
|
|
250
|
+
.7,
|
|
251
|
+
.1,
|
|
252
|
+
1
|
|
253
|
+
],
|
|
254
|
+
emphasizedAccelerate: [
|
|
255
|
+
.3,
|
|
256
|
+
0,
|
|
257
|
+
.8,
|
|
258
|
+
.15
|
|
259
|
+
],
|
|
260
|
+
standard: [
|
|
261
|
+
.2,
|
|
262
|
+
0,
|
|
263
|
+
0,
|
|
264
|
+
1
|
|
265
|
+
],
|
|
266
|
+
standardDecelerate: [
|
|
267
|
+
0,
|
|
268
|
+
0,
|
|
269
|
+
0,
|
|
270
|
+
1
|
|
271
|
+
],
|
|
272
|
+
standardAccelerate: [
|
|
273
|
+
.3,
|
|
274
|
+
0,
|
|
275
|
+
1,
|
|
276
|
+
1
|
|
277
|
+
],
|
|
278
|
+
legacy: [
|
|
279
|
+
.4,
|
|
280
|
+
0,
|
|
281
|
+
.2,
|
|
282
|
+
1
|
|
283
|
+
],
|
|
284
|
+
legacyDecelerate: [
|
|
285
|
+
0,
|
|
286
|
+
0,
|
|
287
|
+
.2,
|
|
288
|
+
1
|
|
289
|
+
],
|
|
290
|
+
legacyAccelerate: [
|
|
291
|
+
.4,
|
|
292
|
+
0,
|
|
293
|
+
1,
|
|
294
|
+
1
|
|
295
|
+
],
|
|
296
|
+
linear: [
|
|
297
|
+
0,
|
|
298
|
+
0,
|
|
299
|
+
1,
|
|
300
|
+
1
|
|
301
|
+
]
|
|
302
|
+
}, U = {
|
|
303
|
+
short1: 50,
|
|
304
|
+
short2: 100,
|
|
305
|
+
short3: 150,
|
|
306
|
+
short4: 200,
|
|
307
|
+
medium1: 250,
|
|
308
|
+
medium2: 300,
|
|
309
|
+
medium3: 350,
|
|
310
|
+
medium4: 400,
|
|
311
|
+
long1: 450,
|
|
312
|
+
long2: 500,
|
|
313
|
+
long3: 550,
|
|
314
|
+
long4: 600,
|
|
315
|
+
extraLong1: 700,
|
|
316
|
+
extraLong2: 800,
|
|
317
|
+
extraLong3: 900,
|
|
318
|
+
extraLong4: 1e3
|
|
319
|
+
};
|
|
320
|
+
function W(e, t, n, r) {
|
|
321
|
+
return (i) => {
|
|
322
|
+
if (i <= 0) return 0;
|
|
323
|
+
if (i >= 1) return 1;
|
|
324
|
+
let a = i;
|
|
325
|
+
for (let t = 0; t < 8; t++) {
|
|
326
|
+
let t = 3 * a * (1 - a) ** 2 * e + 3 * a ** 2 * (1 - a) * n + a ** 3 - i, r = 3 * (1 - a) ** 2 * e + 6 * a * (1 - a) * (n - e) + 3 * a ** 2 * (1 - n);
|
|
327
|
+
if (Math.abs(r) < 1e-6) break;
|
|
328
|
+
a -= t / r;
|
|
329
|
+
}
|
|
330
|
+
return 3 * a * (1 - a) ** 2 * t + 3 * a ** 2 * (1 - a) * r + a ** 3;
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
//#endregion
|
|
334
|
+
//#region src/composables/_useSpring.ts
|
|
335
|
+
var G = V.standard.fastSpatial, K = V.standard.fastEffects, q = V.standard.defaultEffects, J = V.standard.defaultSpatial, Y = .004;
|
|
336
|
+
function X(e, t, n = G) {
|
|
337
|
+
let r = [...e()], i = r.map(() => 0), a = 0, o = 0;
|
|
338
|
+
function s(c) {
|
|
339
|
+
let l = Math.min((c - o) / 1e3, 1 / 30);
|
|
340
|
+
o = c;
|
|
341
|
+
let u = e();
|
|
342
|
+
u.length !== r.length && (r = [...u], i = u.map(() => 0));
|
|
343
|
+
let d = n.stiffness, f = 2 * n.dampingRatio * Math.sqrt(d);
|
|
344
|
+
for (; l > 0;) {
|
|
345
|
+
let e = Math.min(l, Y);
|
|
346
|
+
l -= e;
|
|
347
|
+
for (let t = 0; t < u.length; t++) i[t] += (-d * (r[t] - u[t]) - f * i[t]) * e, r[t] += i[t] * e;
|
|
348
|
+
}
|
|
349
|
+
let p = u.every((e, t) => Math.abs(e - r[t]) < .05 && Math.abs(i[t]) < .05);
|
|
350
|
+
p && (r = [...u], i = u.map(() => 0)), t(r), a = p ? 0 : requestAnimationFrame(s);
|
|
351
|
+
}
|
|
352
|
+
function c() {
|
|
353
|
+
a ||= (o = performance.now(), requestAnimationFrame(s));
|
|
354
|
+
}
|
|
355
|
+
function l() {
|
|
356
|
+
cancelAnimationFrame(a), a = 0, r = [...e()], i = r.map(() => 0), t(r);
|
|
357
|
+
}
|
|
358
|
+
return C(() => e().join(","), c), p(() => t(r)), m(() => cancelAnimationFrame(a)), { snap: l };
|
|
359
|
+
}
|
|
360
|
+
var Z = W(.4, 0, .2, 1), Q = "relative inline-flex shrink-0 items-center justify-center overflow-hidden transition-colors duration-150 cursor-pointer disabled:cursor-not-allowed disabled:text-on-surface/38 before:content-[''] before:pointer-events-none before:absolute before:inset-0 before:bg-current before:opacity-0 before:transition-opacity before:duration-150 enabled:hover:before:opacity-[0.08] enabled:active:before:opacity-[0.12]", te = /* @__PURE__ */ l({
|
|
361
|
+
__name: "MIconButton",
|
|
362
|
+
props: {
|
|
363
|
+
icon: {},
|
|
364
|
+
label: {},
|
|
365
|
+
variant: { default: "standard" },
|
|
366
|
+
shape: { default: "rounded" },
|
|
367
|
+
size: { default: "sm" },
|
|
368
|
+
disabled: {
|
|
369
|
+
type: Boolean,
|
|
370
|
+
default: !1
|
|
371
|
+
},
|
|
372
|
+
to: {},
|
|
373
|
+
rippleColor: {},
|
|
374
|
+
checked: {
|
|
375
|
+
type: Boolean,
|
|
376
|
+
default: void 0
|
|
377
|
+
},
|
|
378
|
+
checkedIcon: {}
|
|
379
|
+
},
|
|
380
|
+
emits: ["update:checked"],
|
|
381
|
+
setup(e, { emit: i }) {
|
|
382
|
+
let a = e, o = i, s = n(() => a.checked !== void 0), l = n(() => a.to && !s.value ? "RouterLink" : "button"), f = {
|
|
383
|
+
xs: {
|
|
384
|
+
px: 32,
|
|
385
|
+
icon: 20,
|
|
386
|
+
squareRadius: "rounded-md",
|
|
387
|
+
square: 12,
|
|
388
|
+
pressed: 8,
|
|
389
|
+
checkedRound: 12
|
|
390
|
+
},
|
|
391
|
+
sm: {
|
|
392
|
+
px: 40,
|
|
393
|
+
icon: 24,
|
|
394
|
+
squareRadius: "rounded-md",
|
|
395
|
+
square: 12,
|
|
396
|
+
pressed: 8,
|
|
397
|
+
checkedRound: 12
|
|
398
|
+
},
|
|
399
|
+
md: {
|
|
400
|
+
px: 56,
|
|
401
|
+
icon: 24,
|
|
402
|
+
squareRadius: "rounded-lg",
|
|
403
|
+
square: 16,
|
|
404
|
+
pressed: 12,
|
|
405
|
+
checkedRound: 16
|
|
406
|
+
},
|
|
407
|
+
lg: {
|
|
408
|
+
px: 96,
|
|
409
|
+
icon: 32,
|
|
410
|
+
squareRadius: "rounded-xl",
|
|
411
|
+
square: 28,
|
|
412
|
+
pressed: 16,
|
|
413
|
+
checkedRound: 28
|
|
414
|
+
},
|
|
415
|
+
xl: {
|
|
416
|
+
px: 136,
|
|
417
|
+
icon: 40,
|
|
418
|
+
squareRadius: "rounded-xl",
|
|
419
|
+
square: 28,
|
|
420
|
+
pressed: 16,
|
|
421
|
+
checkedRound: 28
|
|
422
|
+
}
|
|
423
|
+
}, p = n(() => typeof a.size == "number" ? {
|
|
424
|
+
px: a.size,
|
|
425
|
+
icon: Math.round(a.size * .55),
|
|
426
|
+
squareRadius: "rounded-md",
|
|
427
|
+
square: 12,
|
|
428
|
+
pressed: 8,
|
|
429
|
+
checkedRound: 12
|
|
430
|
+
} : f[a.size] ?? f.sm), m = g(null), _ = g(!1);
|
|
431
|
+
function y() {
|
|
432
|
+
let e = p.value, t = e.px / 2;
|
|
433
|
+
return _.value ? e.pressed : a.checked ? a.shape === "squared" ? t : e.checkedRound : a.shape === "squared" ? e.square : t;
|
|
434
|
+
}
|
|
435
|
+
X(() => s.value ? [y()] : [], (e) => {
|
|
436
|
+
m.value instanceof HTMLElement && (m.value.style.borderRadius = e.length ? `${e[0]}px` : "");
|
|
437
|
+
}, q);
|
|
438
|
+
function x() {
|
|
439
|
+
s.value && !a.disabled && (_.value = !0);
|
|
440
|
+
}
|
|
441
|
+
function S() {
|
|
442
|
+
_.value = !1;
|
|
443
|
+
}
|
|
444
|
+
function C() {
|
|
445
|
+
s.value && !a.disabled && o("update:checked", !a.checked);
|
|
446
|
+
}
|
|
447
|
+
let E = n(() => {
|
|
448
|
+
if (a.variant === "outlined" && a.checked) return "disabled:bg-on-surface/10";
|
|
449
|
+
switch (a.variant) {
|
|
450
|
+
case "filled":
|
|
451
|
+
case "tonal": return "disabled:bg-on-surface/10";
|
|
452
|
+
default: return "";
|
|
453
|
+
}
|
|
454
|
+
}), D = n(() => a.shape === "squared" ? p.value.squareRadius : "rounded-full"), O = n(() => {
|
|
455
|
+
let e = a.checked;
|
|
456
|
+
switch (a.variant) {
|
|
457
|
+
case "filled": return e ? "bg-primary text-on-primary" : "bg-surface-container text-on-surface-variant";
|
|
458
|
+
case "tonal": return e ? "bg-secondary text-on-secondary" : "bg-secondary-container text-on-secondary-container";
|
|
459
|
+
case "outlined": return e ? "bg-inverse-surface text-inverse-on-surface" : "border border-current text-on-surface-variant";
|
|
460
|
+
default: return e ? "text-primary" : "text-on-surface-variant";
|
|
461
|
+
}
|
|
462
|
+
}), A = n(() => {
|
|
463
|
+
if (s.value) return O.value;
|
|
464
|
+
switch (a.variant) {
|
|
465
|
+
case "filled": return "bg-primary text-on-primary";
|
|
466
|
+
case "tonal": return "bg-secondary-container text-on-secondary-container";
|
|
467
|
+
case "outlined": return "border border-current text-on-surface-variant";
|
|
468
|
+
default: return "text-on-surface-variant";
|
|
469
|
+
}
|
|
470
|
+
});
|
|
471
|
+
return (n, i) => T((h(), r(v(l.value), {
|
|
472
|
+
ref_key: "rootEl",
|
|
473
|
+
ref: m,
|
|
474
|
+
to: l.value === "RouterLink" ? e.to : void 0,
|
|
475
|
+
type: l.value === "RouterLink" ? void 0 : "button",
|
|
476
|
+
"aria-label": e.label || void 0,
|
|
477
|
+
"aria-pressed": s.value ? e.checked : void 0,
|
|
478
|
+
disabled: e.disabled,
|
|
479
|
+
class: u([
|
|
480
|
+
Q,
|
|
481
|
+
D.value,
|
|
482
|
+
A.value,
|
|
483
|
+
E.value
|
|
484
|
+
]),
|
|
485
|
+
style: d({
|
|
486
|
+
width: `${p.value.px}px`,
|
|
487
|
+
height: `${p.value.px}px`
|
|
488
|
+
}),
|
|
489
|
+
onPointerdown: x,
|
|
490
|
+
onPointerup: S,
|
|
491
|
+
onPointerleave: S,
|
|
492
|
+
onPointercancel: S,
|
|
493
|
+
onClick: C
|
|
494
|
+
}, {
|
|
495
|
+
default: w(() => [c(t, {
|
|
496
|
+
name: e.checked && e.checkedIcon ? e.checkedIcon : e.icon,
|
|
497
|
+
size: p.value.icon,
|
|
498
|
+
filled: !!e.checked
|
|
499
|
+
}, null, 8, [
|
|
500
|
+
"name",
|
|
501
|
+
"size",
|
|
502
|
+
"filled"
|
|
503
|
+
])]),
|
|
504
|
+
_: 1
|
|
505
|
+
}, 40, [
|
|
506
|
+
"to",
|
|
507
|
+
"type",
|
|
508
|
+
"aria-label",
|
|
509
|
+
"aria-pressed",
|
|
510
|
+
"disabled",
|
|
511
|
+
"class",
|
|
512
|
+
"style"
|
|
513
|
+
])), [[b(k), {
|
|
514
|
+
disabled: e.disabled,
|
|
515
|
+
color: e.rippleColor
|
|
516
|
+
}]]);
|
|
517
|
+
}
|
|
518
|
+
}), ne = { class: "flex flex-col gap-1" }, re = [
|
|
519
|
+
"id",
|
|
520
|
+
"value",
|
|
521
|
+
"rows",
|
|
522
|
+
"disabled",
|
|
523
|
+
"required"
|
|
524
|
+
], ie = [
|
|
525
|
+
"id",
|
|
526
|
+
"type",
|
|
527
|
+
"value",
|
|
528
|
+
"disabled",
|
|
529
|
+
"required",
|
|
530
|
+
"autocomplete"
|
|
531
|
+
], ae = ["for"], oe = {
|
|
532
|
+
key: 0,
|
|
533
|
+
class: "text-error"
|
|
534
|
+
}, $ = {
|
|
535
|
+
key: 3,
|
|
536
|
+
class: "absolute right-2 top-1/2 -translate-y-1/2"
|
|
537
|
+
}, se = {
|
|
538
|
+
key: 0,
|
|
539
|
+
class: "px-4 text-body-small text-error"
|
|
540
|
+
}, ce = {
|
|
541
|
+
key: 1,
|
|
542
|
+
class: "px-4 text-body-small text-on-surface-variant"
|
|
543
|
+
}, le = /* @__PURE__ */ l({
|
|
544
|
+
__name: "MTextField",
|
|
545
|
+
props: {
|
|
546
|
+
modelValue: {},
|
|
547
|
+
label: {},
|
|
548
|
+
type: { default: "text" },
|
|
549
|
+
variant: { default: "filled" },
|
|
550
|
+
error: { type: Boolean },
|
|
551
|
+
errorLabel: {},
|
|
552
|
+
hint: {},
|
|
553
|
+
disabled: { type: Boolean },
|
|
554
|
+
required: { type: Boolean },
|
|
555
|
+
multiline: { type: Boolean },
|
|
556
|
+
rows: { default: 3 },
|
|
557
|
+
autocomplete: {},
|
|
558
|
+
leadingIcon: {},
|
|
559
|
+
clearable: {
|
|
560
|
+
type: Boolean,
|
|
561
|
+
default: !1
|
|
562
|
+
},
|
|
563
|
+
fieldBg: {},
|
|
564
|
+
debounce: { default: 0 }
|
|
565
|
+
},
|
|
566
|
+
emits: ["update:modelValue", "debounced"],
|
|
567
|
+
setup(e, { emit: r }) {
|
|
568
|
+
let l = e, f = r, p = x(), m = S(), v = g(null), { resolvedFieldBg: C } = z(v, () => l.fieldBg), { debounced: w, cancel: T } = B((e) => f("debounced", e), l.debounce), E = n(() => l.clearable && String(l.modelValue).length > 0 && !l.disabled), D = n(() => {
|
|
569
|
+
let e = !!m.trailing || l.clearable, t = l.leadingIcon ? "pl-12" : "pl-4", n = e ? "pr-12" : "pr-4", r = l.multiline ? "resize-y min-h-[56px]" : "h-14", i = [
|
|
570
|
+
"peer block w-full text-body-large text-on-surface outline-none placeholder:text-transparent",
|
|
571
|
+
"transition-[border-color,border-width] duration-150",
|
|
572
|
+
"disabled:cursor-not-allowed disabled:text-on-surface/38",
|
|
573
|
+
l.error ? "caret-error" : "caret-primary",
|
|
574
|
+
r,
|
|
575
|
+
t,
|
|
576
|
+
n
|
|
577
|
+
];
|
|
578
|
+
return l.variant === "outlined" ? [
|
|
579
|
+
...i,
|
|
580
|
+
"rounded-xs border bg-transparent py-4",
|
|
581
|
+
l.error ? "border-error focus:border-2 focus:border-error" : "border-outline hover:border-on-surface focus:border-2 focus:border-primary",
|
|
582
|
+
"disabled:border-on-surface/12"
|
|
583
|
+
].join(" ") : [
|
|
584
|
+
...i,
|
|
585
|
+
"rounded-t-xs bg-surface-container-highest border-b pt-6 pb-2",
|
|
586
|
+
l.error ? "border-error focus:border-b-2 focus:border-error" : "border-on-surface-variant hover:border-on-surface focus:border-b-2 focus:border-primary",
|
|
587
|
+
"disabled:border-on-surface/38 disabled:bg-[color-mix(in_srgb,var(--color-on-surface)_4%,var(--color-surface-container-highest))]"
|
|
588
|
+
].join(" ");
|
|
589
|
+
}), O = n(() => {
|
|
590
|
+
let e = [
|
|
591
|
+
"pointer-events-none absolute truncate transition-all duration-200",
|
|
592
|
+
l.leadingIcon ? l.variant === "outlined" ? "left-11" : "left-12" : l.variant === "outlined" ? "left-3" : "left-4",
|
|
593
|
+
"right-4",
|
|
594
|
+
`${l.variant === "filled" ? "top-[53%]" : "top-1/2"} -translate-y-1/2 text-body-large`
|
|
595
|
+
];
|
|
596
|
+
return l.variant === "outlined" ? [
|
|
597
|
+
...e,
|
|
598
|
+
"peer-focus:-top-2.5 peer-focus:translate-y-0 peer-focus:text-label-small peer-focus:right-auto peer-focus:max-w-[calc(100%-1.5rem)] peer-focus:bg-[var(--field-bg)] peer-focus:px-1",
|
|
599
|
+
"peer-[&:not(:placeholder-shown)]:-top-2.5 peer-[&:not(:placeholder-shown)]:translate-y-0 peer-[&:not(:placeholder-shown)]:right-auto peer-[&:not(:placeholder-shown)]:max-w-[calc(100%-1.5rem)]",
|
|
600
|
+
"peer-[&:not(:placeholder-shown)]:text-label-small peer-[&:not(:placeholder-shown)]:bg-[var(--field-bg)] peer-[&:not(:placeholder-shown)]:px-1",
|
|
601
|
+
l.error ? "text-error peer-focus:text-error" : "text-on-surface-variant peer-focus:text-primary",
|
|
602
|
+
"peer-disabled:text-on-surface/38"
|
|
603
|
+
].join(" ") : [
|
|
604
|
+
...e,
|
|
605
|
+
"peer-focus:top-2 peer-focus:translate-y-0 peer-focus:text-label-small",
|
|
606
|
+
"peer-[&:not(:placeholder-shown)]:top-2 peer-[&:not(:placeholder-shown)]:translate-y-0 peer-[&:not(:placeholder-shown)]:text-label-small",
|
|
607
|
+
l.error ? "text-error peer-focus:text-error" : "text-on-surface-variant peer-focus:text-primary",
|
|
608
|
+
"peer-disabled:text-on-surface/38"
|
|
609
|
+
].join(" ");
|
|
610
|
+
});
|
|
611
|
+
function k(e) {
|
|
612
|
+
let t = e.target;
|
|
613
|
+
f("update:modelValue", t.value), l.debounce > 0 && w(t.value);
|
|
614
|
+
}
|
|
615
|
+
return (n, r) => (h(), a("div", ne, [o("div", {
|
|
616
|
+
ref_key: "fieldBgEl",
|
|
617
|
+
ref: v,
|
|
618
|
+
class: u(["relative", e.variant === "outlined" ? "mt-2" : ""]),
|
|
619
|
+
style: d(e.variant === "outlined" ? { "--field-bg": b(C) } : void 0)
|
|
620
|
+
}, [
|
|
621
|
+
e.leadingIcon ? (h(), a("div", {
|
|
622
|
+
key: 0,
|
|
623
|
+
class: u(["pointer-events-none absolute left-3.5", [e.multiline ? "top-[55%] -translate-y-1/2" : e.variant === "filled" ? "top-4.5" : "top-4", e.disabled ? "text-on-surface/38" : "text-on-surface-variant"]])
|
|
624
|
+
}, [c(t, {
|
|
625
|
+
name: e.leadingIcon,
|
|
626
|
+
size: 24
|
|
627
|
+
}, null, 8, ["name"])], 2)) : i("", !0),
|
|
628
|
+
e.multiline ? (h(), a("textarea", {
|
|
629
|
+
key: 1,
|
|
630
|
+
id: b(p),
|
|
631
|
+
value: String(e.modelValue),
|
|
632
|
+
rows: e.rows,
|
|
633
|
+
disabled: e.disabled,
|
|
634
|
+
required: e.required,
|
|
635
|
+
placeholder: " ",
|
|
636
|
+
class: u(D.value),
|
|
637
|
+
onInput: k
|
|
638
|
+
}, null, 42, re)) : (h(), a("input", {
|
|
639
|
+
key: 2,
|
|
640
|
+
id: b(p),
|
|
641
|
+
type: e.type,
|
|
642
|
+
value: e.modelValue,
|
|
643
|
+
disabled: e.disabled,
|
|
644
|
+
required: e.required,
|
|
645
|
+
autocomplete: e.autocomplete,
|
|
646
|
+
placeholder: " ",
|
|
647
|
+
class: u(D.value),
|
|
648
|
+
onInput: k
|
|
649
|
+
}, null, 42, ie)),
|
|
650
|
+
o("label", {
|
|
651
|
+
for: b(p),
|
|
652
|
+
class: u(O.value)
|
|
653
|
+
}, [s(y(e.label), 1), e.required ? (h(), a("span", oe, "\xA0*")) : i("", !0)], 10, ae),
|
|
654
|
+
n.$slots.trailing ? (h(), a("div", $, [_(n.$slots, "trailing")])) : E.value ? (h(), a("button", {
|
|
655
|
+
key: 4,
|
|
656
|
+
type: "button",
|
|
657
|
+
class: "absolute right-3 top-1/2 -translate-y-1/2 flex h-6 w-6 cursor-pointer items-center justify-center rounded-full text-on-surface-variant transition-colors hover:bg-on-surface/8 hover:text-on-surface",
|
|
658
|
+
onClick: r[0] ||= (e) => {
|
|
659
|
+
b(T)(), f("update:modelValue", "");
|
|
660
|
+
}
|
|
661
|
+
}, [c(t, {
|
|
662
|
+
name: "close",
|
|
663
|
+
size: 18
|
|
664
|
+
})])) : i("", !0)
|
|
665
|
+
], 6), e.error && e.errorLabel ? (h(), a("p", se, y(e.errorLabel), 1)) : e.hint ? (h(), a("p", ce, y(e.hint), 1)) : i("", !0)]));
|
|
666
|
+
}
|
|
667
|
+
});
|
|
668
|
+
//#endregion
|
|
669
|
+
export { K as a, X as c, H as d, V as f, k as g, I as h, J as i, W as l, z as m, te as n, G as o, B as p, q as r, Z as s, le as t, U as u };
|
|
670
|
+
|
|
671
|
+
//# sourceMappingURL=MTextField-B4X92vH_.js.map
|