translime-sdk 1.0.1
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/README.md +153 -0
- package/dist/index.cjs +111 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +93 -0
- package/dist/index.d.ts +93 -0
- package/dist/index.js +111 -0
- package/dist/index.js.map +1 -0
- package/dist/preview/settings.scss +86 -0
- package/dist/preview-mock.cjs +253 -0
- package/dist/preview-mock.cjs.map +1 -0
- package/dist/preview-mock.js +253 -0
- package/dist/preview-mock.js.map +1 -0
- package/dist/preview-template.html +13 -0
- package/dist/preview.cjs +3607 -0
- package/dist/preview.cjs.map +1 -0
- package/dist/preview.js +3589 -0
- package/dist/preview.js.map +1 -0
- package/dist/translime-sdk.css +1224 -0
- package/dist/vite-plugin.cjs +196 -0
- package/dist/vite-plugin.cjs.map +1 -0
- package/dist/vite-plugin.d.cts +22 -0
- package/dist/vite-plugin.d.ts +22 -0
- package/dist/vite-plugin.js +195 -0
- package/dist/vite-plugin.js.map +1 -0
- package/package.json +99 -0
package/dist/preview.js
ADDED
|
@@ -0,0 +1,3589 @@
|
|
|
1
|
+
import { warn, reactive, watchEffect, toRef, capitalize, shallowRef, Fragment, getCurrentInstance as getCurrentInstance$1, ref, computed, unref, provide, inject, defineComponent as defineComponent$1, h, camelize, onBeforeUnmount, watch, readonly, onMounted, onScopeDispose, effectScope, toRaw, createElementVNode, normalizeStyle, normalizeClass, toRefs, toValue, createVNode, mergeProps, Text, isRef, TransitionGroup, Transition, onBeforeMount, nextTick, withDirectives, vShow, useId, onUpdated, resolveDynamicComponent, toDisplayString, createBlock, openBlock, withCtx, createElementBlock, createApp } from "vue";
|
|
2
|
+
import { createVuetify } from "vuetify";
|
|
3
|
+
import { zhHans } from "vuetify/locale";
|
|
4
|
+
import * as components from "vuetify/components";
|
|
5
|
+
import * as directives from "vuetify/directives";
|
|
6
|
+
import { md, aliases } from "vuetify/iconsets/md";
|
|
7
|
+
import { md3 } from "vuetify/blueprints";
|
|
8
|
+
import "vuetify/styles";
|
|
9
|
+
import { initPreviewMock } from "./preview-mock.js";
|
|
10
|
+
const _export_sfc = (sfc, props) => {
|
|
11
|
+
const target = sfc.__vccOpts || sfc;
|
|
12
|
+
for (const [key, val] of props) {
|
|
13
|
+
target[key] = val;
|
|
14
|
+
}
|
|
15
|
+
return target;
|
|
16
|
+
};
|
|
17
|
+
function propsFactory(props, source) {
|
|
18
|
+
return (defaults) => {
|
|
19
|
+
return Object.keys(props).reduce((obj, prop) => {
|
|
20
|
+
const isObjectDefinition = typeof props[prop] === "object" && props[prop] != null && !Array.isArray(props[prop]);
|
|
21
|
+
const definition = isObjectDefinition ? props[prop] : {
|
|
22
|
+
type: props[prop]
|
|
23
|
+
};
|
|
24
|
+
if (defaults && prop in defaults) {
|
|
25
|
+
obj[prop] = {
|
|
26
|
+
...definition,
|
|
27
|
+
default: defaults[prop]
|
|
28
|
+
};
|
|
29
|
+
} else {
|
|
30
|
+
obj[prop] = definition;
|
|
31
|
+
}
|
|
32
|
+
if (source && !obj[prop].source) {
|
|
33
|
+
obj[prop].source = source;
|
|
34
|
+
}
|
|
35
|
+
return obj;
|
|
36
|
+
}, {});
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
const makeComponentProps = propsFactory({
|
|
40
|
+
class: [String, Array, Object],
|
|
41
|
+
style: {
|
|
42
|
+
type: [String, Array, Object],
|
|
43
|
+
default: null
|
|
44
|
+
}
|
|
45
|
+
}, "component");
|
|
46
|
+
function consoleWarn(message) {
|
|
47
|
+
warn(`Vuetify: ${message}`);
|
|
48
|
+
}
|
|
49
|
+
const IN_BROWSER = typeof window !== "undefined";
|
|
50
|
+
const SUPPORTS_INTERSECTION = IN_BROWSER && "IntersectionObserver" in window;
|
|
51
|
+
const SUPPORTS_MATCH_MEDIA = IN_BROWSER && "matchMedia" in window && typeof window.matchMedia === "function";
|
|
52
|
+
const PREFERS_REDUCED_MOTION = () => SUPPORTS_MATCH_MEDIA && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
53
|
+
function convertToUnit(str) {
|
|
54
|
+
let unit = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "px";
|
|
55
|
+
if (str == null || str === "") {
|
|
56
|
+
return void 0;
|
|
57
|
+
}
|
|
58
|
+
const num = Number(str);
|
|
59
|
+
if (isNaN(num)) {
|
|
60
|
+
return String(str);
|
|
61
|
+
} else if (!isFinite(num)) {
|
|
62
|
+
return void 0;
|
|
63
|
+
} else {
|
|
64
|
+
return `${num}${unit}`;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function isObject(obj) {
|
|
68
|
+
return obj !== null && typeof obj === "object" && !Array.isArray(obj);
|
|
69
|
+
}
|
|
70
|
+
function isPlainObject(obj) {
|
|
71
|
+
let proto;
|
|
72
|
+
return obj !== null && typeof obj === "object" && ((proto = Object.getPrototypeOf(obj)) === Object.prototype || proto === null);
|
|
73
|
+
}
|
|
74
|
+
function refElement(obj) {
|
|
75
|
+
if (obj && "$el" in obj) {
|
|
76
|
+
const el = obj.$el;
|
|
77
|
+
if (el?.nodeType === Node.TEXT_NODE) {
|
|
78
|
+
return el.nextElementSibling;
|
|
79
|
+
}
|
|
80
|
+
return el;
|
|
81
|
+
}
|
|
82
|
+
return obj;
|
|
83
|
+
}
|
|
84
|
+
function has(obj, key) {
|
|
85
|
+
return key.every((k) => obj.hasOwnProperty(k));
|
|
86
|
+
}
|
|
87
|
+
function pick(obj, paths) {
|
|
88
|
+
const found = {};
|
|
89
|
+
for (const key of paths) {
|
|
90
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
91
|
+
found[key] = obj[key];
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return found;
|
|
95
|
+
}
|
|
96
|
+
function omit(obj, exclude) {
|
|
97
|
+
const clone = {
|
|
98
|
+
...obj
|
|
99
|
+
};
|
|
100
|
+
exclude.forEach((prop) => delete clone[prop]);
|
|
101
|
+
return clone;
|
|
102
|
+
}
|
|
103
|
+
function wrapInArray(v) {
|
|
104
|
+
return v == null ? [] : Array.isArray(v) ? v : [v];
|
|
105
|
+
}
|
|
106
|
+
function clamp(value) {
|
|
107
|
+
let min = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
|
|
108
|
+
let max = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1;
|
|
109
|
+
return Math.max(min, Math.min(max, value));
|
|
110
|
+
}
|
|
111
|
+
function padEnd(str, length) {
|
|
112
|
+
let char = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "0";
|
|
113
|
+
return str + char.repeat(Math.max(0, length - str.length));
|
|
114
|
+
}
|
|
115
|
+
function chunk(str) {
|
|
116
|
+
let size = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
|
|
117
|
+
const chunked = [];
|
|
118
|
+
let index = 0;
|
|
119
|
+
while (index < str.length) {
|
|
120
|
+
chunked.push(str.substr(index, size));
|
|
121
|
+
index += size;
|
|
122
|
+
}
|
|
123
|
+
return chunked;
|
|
124
|
+
}
|
|
125
|
+
function mergeDeep() {
|
|
126
|
+
let source = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
127
|
+
let target = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
128
|
+
let arrayFn = arguments.length > 2 ? arguments[2] : void 0;
|
|
129
|
+
const out = {};
|
|
130
|
+
for (const key in source) {
|
|
131
|
+
out[key] = source[key];
|
|
132
|
+
}
|
|
133
|
+
for (const key in target) {
|
|
134
|
+
const sourceProperty = source[key];
|
|
135
|
+
const targetProperty = target[key];
|
|
136
|
+
if (isPlainObject(sourceProperty) && isPlainObject(targetProperty)) {
|
|
137
|
+
out[key] = mergeDeep(sourceProperty, targetProperty, arrayFn);
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
if (arrayFn && Array.isArray(sourceProperty) && Array.isArray(targetProperty)) {
|
|
141
|
+
out[key] = arrayFn(sourceProperty, targetProperty);
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
out[key] = targetProperty;
|
|
145
|
+
}
|
|
146
|
+
return out;
|
|
147
|
+
}
|
|
148
|
+
function flattenFragments(nodes) {
|
|
149
|
+
return nodes.map((node) => {
|
|
150
|
+
if (node.type === Fragment) {
|
|
151
|
+
return flattenFragments(node.children);
|
|
152
|
+
} else {
|
|
153
|
+
return node;
|
|
154
|
+
}
|
|
155
|
+
}).flat();
|
|
156
|
+
}
|
|
157
|
+
function toKebabCase() {
|
|
158
|
+
let str = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
|
|
159
|
+
if (toKebabCase.cache.has(str)) return toKebabCase.cache.get(str);
|
|
160
|
+
const kebab = str.replace(/[^a-z]/gi, "-").replace(/\B([A-Z])/g, "-$1").toLowerCase();
|
|
161
|
+
toKebabCase.cache.set(str, kebab);
|
|
162
|
+
return kebab;
|
|
163
|
+
}
|
|
164
|
+
toKebabCase.cache = /* @__PURE__ */ new Map();
|
|
165
|
+
function findChildrenWithProvide(key, vnode) {
|
|
166
|
+
if (!vnode || typeof vnode !== "object") return [];
|
|
167
|
+
if (Array.isArray(vnode)) {
|
|
168
|
+
return vnode.map((child) => findChildrenWithProvide(key, child)).flat(1);
|
|
169
|
+
} else if (vnode.suspense) {
|
|
170
|
+
return findChildrenWithProvide(key, vnode.ssContent);
|
|
171
|
+
} else if (Array.isArray(vnode.children)) {
|
|
172
|
+
return vnode.children.map((child) => findChildrenWithProvide(key, child)).flat(1);
|
|
173
|
+
} else if (vnode.component) {
|
|
174
|
+
if (Object.getOwnPropertyDescriptor(vnode.component.provides, key)) {
|
|
175
|
+
return [vnode.component];
|
|
176
|
+
} else if (vnode.component.subTree) {
|
|
177
|
+
return findChildrenWithProvide(key, vnode.component.subTree).flat(1);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return [];
|
|
181
|
+
}
|
|
182
|
+
function destructComputed(getter) {
|
|
183
|
+
const refs = reactive({});
|
|
184
|
+
watchEffect(() => {
|
|
185
|
+
const base = getter();
|
|
186
|
+
for (const key in base) {
|
|
187
|
+
refs[key] = base[key];
|
|
188
|
+
}
|
|
189
|
+
}, {
|
|
190
|
+
flush: "sync"
|
|
191
|
+
});
|
|
192
|
+
const obj = {};
|
|
193
|
+
for (const key in refs) {
|
|
194
|
+
obj[key] = toRef(() => refs[key]);
|
|
195
|
+
}
|
|
196
|
+
return obj;
|
|
197
|
+
}
|
|
198
|
+
function includes(arr, val) {
|
|
199
|
+
return arr.includes(val);
|
|
200
|
+
}
|
|
201
|
+
function hasEvent(props, name) {
|
|
202
|
+
name = "on" + capitalize(name);
|
|
203
|
+
return !!(props[name] || props[`${name}Once`] || props[`${name}Capture`] || props[`${name}OnceCapture`] || props[`${name}CaptureOnce`]);
|
|
204
|
+
}
|
|
205
|
+
function templateRef() {
|
|
206
|
+
const el = shallowRef();
|
|
207
|
+
const fn = (target) => {
|
|
208
|
+
el.value = target;
|
|
209
|
+
};
|
|
210
|
+
Object.defineProperty(fn, "value", {
|
|
211
|
+
enumerable: true,
|
|
212
|
+
get: () => el.value,
|
|
213
|
+
set: (val) => el.value = val
|
|
214
|
+
});
|
|
215
|
+
Object.defineProperty(fn, "el", {
|
|
216
|
+
enumerable: true,
|
|
217
|
+
get: () => refElement(el.value)
|
|
218
|
+
});
|
|
219
|
+
return fn;
|
|
220
|
+
}
|
|
221
|
+
function isPrimitive(value) {
|
|
222
|
+
return typeof value === "string" || typeof value === "number" || typeof value === "boolean" || typeof value === "bigint";
|
|
223
|
+
}
|
|
224
|
+
function onlyDefinedProps(props) {
|
|
225
|
+
const booleanAttributes = ["checked", "disabled"];
|
|
226
|
+
return Object.fromEntries(Object.entries(props).filter((_ref) => {
|
|
227
|
+
let [key, v] = _ref;
|
|
228
|
+
return booleanAttributes.includes(key) ? !!v : v !== void 0;
|
|
229
|
+
}));
|
|
230
|
+
}
|
|
231
|
+
const block = ["top", "bottom"];
|
|
232
|
+
const inline = ["start", "end", "left", "right"];
|
|
233
|
+
function parseAnchor(anchor, isRtl) {
|
|
234
|
+
let [side, align] = anchor.split(" ");
|
|
235
|
+
if (!align) {
|
|
236
|
+
align = includes(block, side) ? "start" : includes(inline, side) ? "top" : "center";
|
|
237
|
+
}
|
|
238
|
+
return {
|
|
239
|
+
side: toPhysical(side, isRtl),
|
|
240
|
+
align: toPhysical(align, isRtl)
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
function toPhysical(str, isRtl) {
|
|
244
|
+
if (str === "start") return isRtl ? "right" : "left";
|
|
245
|
+
if (str === "end") return isRtl ? "left" : "right";
|
|
246
|
+
return str;
|
|
247
|
+
}
|
|
248
|
+
const mainTRC = 2.4;
|
|
249
|
+
const Rco = 0.2126729;
|
|
250
|
+
const Gco = 0.7151522;
|
|
251
|
+
const Bco = 0.072175;
|
|
252
|
+
const normBG = 0.55;
|
|
253
|
+
const normTXT = 0.58;
|
|
254
|
+
const revTXT = 0.57;
|
|
255
|
+
const revBG = 0.62;
|
|
256
|
+
const blkThrs = 0.03;
|
|
257
|
+
const blkClmp = 1.45;
|
|
258
|
+
const deltaYmin = 5e-4;
|
|
259
|
+
const scaleBoW = 1.25;
|
|
260
|
+
const scaleWoB = 1.25;
|
|
261
|
+
const loConThresh = 0.078;
|
|
262
|
+
const loConFactor = 12.82051282051282;
|
|
263
|
+
const loConOffset = 0.06;
|
|
264
|
+
const loClip = 1e-3;
|
|
265
|
+
function APCAcontrast(text, background) {
|
|
266
|
+
const Rtxt = (text.r / 255) ** mainTRC;
|
|
267
|
+
const Gtxt = (text.g / 255) ** mainTRC;
|
|
268
|
+
const Btxt = (text.b / 255) ** mainTRC;
|
|
269
|
+
const Rbg = (background.r / 255) ** mainTRC;
|
|
270
|
+
const Gbg = (background.g / 255) ** mainTRC;
|
|
271
|
+
const Bbg = (background.b / 255) ** mainTRC;
|
|
272
|
+
let Ytxt = Rtxt * Rco + Gtxt * Gco + Btxt * Bco;
|
|
273
|
+
let Ybg = Rbg * Rco + Gbg * Gco + Bbg * Bco;
|
|
274
|
+
if (Ytxt <= blkThrs) Ytxt += (blkThrs - Ytxt) ** blkClmp;
|
|
275
|
+
if (Ybg <= blkThrs) Ybg += (blkThrs - Ybg) ** blkClmp;
|
|
276
|
+
if (Math.abs(Ybg - Ytxt) < deltaYmin) return 0;
|
|
277
|
+
let outputContrast;
|
|
278
|
+
if (Ybg > Ytxt) {
|
|
279
|
+
const SAPC = (Ybg ** normBG - Ytxt ** normTXT) * scaleBoW;
|
|
280
|
+
outputContrast = SAPC < loClip ? 0 : SAPC < loConThresh ? SAPC - SAPC * loConFactor * loConOffset : SAPC - loConOffset;
|
|
281
|
+
} else {
|
|
282
|
+
const SAPC = (Ybg ** revBG - Ytxt ** revTXT) * scaleWoB;
|
|
283
|
+
outputContrast = SAPC > -loClip ? 0 : SAPC > -loConThresh ? SAPC - SAPC * loConFactor * loConOffset : SAPC + loConOffset;
|
|
284
|
+
}
|
|
285
|
+
return outputContrast * 100;
|
|
286
|
+
}
|
|
287
|
+
function isCssColor(color) {
|
|
288
|
+
return !!color && /^(#|var\(--|(rgb|hsl)a?\()/.test(color);
|
|
289
|
+
}
|
|
290
|
+
function isParsableColor(color) {
|
|
291
|
+
return isCssColor(color) && !/^((rgb|hsl)a?\()?var\(--/.test(color);
|
|
292
|
+
}
|
|
293
|
+
const cssColorRe = /^(?<fn>(?:rgb|hsl)a?)\((?<values>.+)\)/;
|
|
294
|
+
const mappers = {
|
|
295
|
+
rgb: (r, g, b, a) => ({
|
|
296
|
+
r,
|
|
297
|
+
g,
|
|
298
|
+
b,
|
|
299
|
+
a
|
|
300
|
+
}),
|
|
301
|
+
rgba: (r, g, b, a) => ({
|
|
302
|
+
r,
|
|
303
|
+
g,
|
|
304
|
+
b,
|
|
305
|
+
a
|
|
306
|
+
}),
|
|
307
|
+
hsl: (h2, s, l, a) => HSLtoRGB({
|
|
308
|
+
h: h2,
|
|
309
|
+
s,
|
|
310
|
+
l,
|
|
311
|
+
a
|
|
312
|
+
}),
|
|
313
|
+
hsla: (h2, s, l, a) => HSLtoRGB({
|
|
314
|
+
h: h2,
|
|
315
|
+
s,
|
|
316
|
+
l,
|
|
317
|
+
a
|
|
318
|
+
}),
|
|
319
|
+
hsv: (h2, s, v, a) => HSVtoRGB({
|
|
320
|
+
h: h2,
|
|
321
|
+
s,
|
|
322
|
+
v,
|
|
323
|
+
a
|
|
324
|
+
}),
|
|
325
|
+
hsva: (h2, s, v, a) => HSVtoRGB({
|
|
326
|
+
h: h2,
|
|
327
|
+
s,
|
|
328
|
+
v,
|
|
329
|
+
a
|
|
330
|
+
})
|
|
331
|
+
};
|
|
332
|
+
function parseColor(color) {
|
|
333
|
+
if (typeof color === "number") {
|
|
334
|
+
if (isNaN(color) || color < 0 || color > 16777215) {
|
|
335
|
+
consoleWarn(`'${color}' is not a valid hex color`);
|
|
336
|
+
}
|
|
337
|
+
return {
|
|
338
|
+
r: (color & 16711680) >> 16,
|
|
339
|
+
g: (color & 65280) >> 8,
|
|
340
|
+
b: color & 255
|
|
341
|
+
};
|
|
342
|
+
} else if (typeof color === "string" && cssColorRe.test(color)) {
|
|
343
|
+
const {
|
|
344
|
+
groups
|
|
345
|
+
} = color.match(cssColorRe);
|
|
346
|
+
const {
|
|
347
|
+
fn,
|
|
348
|
+
values
|
|
349
|
+
} = groups;
|
|
350
|
+
const realValues = values.split(/,\s*|\s*\/\s*|\s+/).map((v, i) => {
|
|
351
|
+
if (v.endsWith("%") || // unitless slv are %
|
|
352
|
+
i > 0 && i < 3 && ["hsl", "hsla", "hsv", "hsva"].includes(fn)) {
|
|
353
|
+
return parseFloat(v) / 100;
|
|
354
|
+
} else {
|
|
355
|
+
return parseFloat(v);
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
return mappers[fn](...realValues);
|
|
359
|
+
} else if (typeof color === "string") {
|
|
360
|
+
let hex = color.startsWith("#") ? color.slice(1) : color;
|
|
361
|
+
if ([3, 4].includes(hex.length)) {
|
|
362
|
+
hex = hex.split("").map((char) => char + char).join("");
|
|
363
|
+
} else if (![6, 8].includes(hex.length)) {
|
|
364
|
+
consoleWarn(`'${color}' is not a valid hex(a) color`);
|
|
365
|
+
}
|
|
366
|
+
const int = parseInt(hex, 16);
|
|
367
|
+
if (isNaN(int) || int < 0 || int > 4294967295) {
|
|
368
|
+
consoleWarn(`'${color}' is not a valid hex(a) color`);
|
|
369
|
+
}
|
|
370
|
+
return HexToRGB(hex);
|
|
371
|
+
} else if (typeof color === "object") {
|
|
372
|
+
if (has(color, ["r", "g", "b"])) {
|
|
373
|
+
return color;
|
|
374
|
+
} else if (has(color, ["h", "s", "l"])) {
|
|
375
|
+
return HSVtoRGB(HSLtoHSV(color));
|
|
376
|
+
} else if (has(color, ["h", "s", "v"])) {
|
|
377
|
+
return HSVtoRGB(color);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
throw new TypeError(`Invalid color: ${color == null ? color : String(color) || color.constructor.name}
|
|
381
|
+
Expected #hex, #hexa, rgb(), rgba(), hsl(), hsla(), object or number`);
|
|
382
|
+
}
|
|
383
|
+
function HSVtoRGB(hsva) {
|
|
384
|
+
const {
|
|
385
|
+
h: h2,
|
|
386
|
+
s,
|
|
387
|
+
v,
|
|
388
|
+
a
|
|
389
|
+
} = hsva;
|
|
390
|
+
const f = (n) => {
|
|
391
|
+
const k = (n + h2 / 60) % 6;
|
|
392
|
+
return v - v * s * Math.max(Math.min(k, 4 - k, 1), 0);
|
|
393
|
+
};
|
|
394
|
+
const rgb = [f(5), f(3), f(1)].map((v2) => Math.round(v2 * 255));
|
|
395
|
+
return {
|
|
396
|
+
r: rgb[0],
|
|
397
|
+
g: rgb[1],
|
|
398
|
+
b: rgb[2],
|
|
399
|
+
a
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
function HSLtoRGB(hsla) {
|
|
403
|
+
return HSVtoRGB(HSLtoHSV(hsla));
|
|
404
|
+
}
|
|
405
|
+
function HSLtoHSV(hsl) {
|
|
406
|
+
const {
|
|
407
|
+
h: h2,
|
|
408
|
+
s,
|
|
409
|
+
l,
|
|
410
|
+
a
|
|
411
|
+
} = hsl;
|
|
412
|
+
const v = l + s * Math.min(l, 1 - l);
|
|
413
|
+
const sprime = v === 0 ? 0 : 2 - 2 * l / v;
|
|
414
|
+
return {
|
|
415
|
+
h: h2,
|
|
416
|
+
s: sprime,
|
|
417
|
+
v,
|
|
418
|
+
a
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
function HexToRGB(hex) {
|
|
422
|
+
hex = parseHex(hex);
|
|
423
|
+
let [r, g, b, a] = chunk(hex, 2).map((c) => parseInt(c, 16));
|
|
424
|
+
a = a === void 0 ? a : a / 255;
|
|
425
|
+
return {
|
|
426
|
+
r,
|
|
427
|
+
g,
|
|
428
|
+
b,
|
|
429
|
+
a
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
function parseHex(hex) {
|
|
433
|
+
if (hex.startsWith("#")) {
|
|
434
|
+
hex = hex.slice(1);
|
|
435
|
+
}
|
|
436
|
+
hex = hex.replace(/([^0-9a-f])/gi, "F");
|
|
437
|
+
if (hex.length === 3 || hex.length === 4) {
|
|
438
|
+
hex = hex.split("").map((x) => x + x).join("");
|
|
439
|
+
}
|
|
440
|
+
if (hex.length !== 6) {
|
|
441
|
+
hex = padEnd(padEnd(hex, 6), 8, "F");
|
|
442
|
+
}
|
|
443
|
+
return hex;
|
|
444
|
+
}
|
|
445
|
+
function getForeground(color) {
|
|
446
|
+
const blackContrast = Math.abs(APCAcontrast(parseColor(0), parseColor(color)));
|
|
447
|
+
const whiteContrast = Math.abs(APCAcontrast(parseColor(16777215), parseColor(color)));
|
|
448
|
+
return whiteContrast > Math.min(blackContrast, 50) ? "#fff" : "#000";
|
|
449
|
+
}
|
|
450
|
+
function getCurrentInstance(name, message) {
|
|
451
|
+
const vm = getCurrentInstance$1();
|
|
452
|
+
if (!vm) {
|
|
453
|
+
throw new Error(`[Vuetify] ${name} ${"must be called from inside a setup function"}`);
|
|
454
|
+
}
|
|
455
|
+
return vm;
|
|
456
|
+
}
|
|
457
|
+
function getCurrentInstanceName() {
|
|
458
|
+
let name = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "composables";
|
|
459
|
+
const vm = getCurrentInstance(name).type;
|
|
460
|
+
return toKebabCase(vm?.aliasName || vm?.name);
|
|
461
|
+
}
|
|
462
|
+
function injectSelf(key) {
|
|
463
|
+
let vm = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : getCurrentInstance("injectSelf");
|
|
464
|
+
const {
|
|
465
|
+
provides
|
|
466
|
+
} = vm;
|
|
467
|
+
if (provides && key in provides) {
|
|
468
|
+
return provides[key];
|
|
469
|
+
}
|
|
470
|
+
return void 0;
|
|
471
|
+
}
|
|
472
|
+
const DefaultsSymbol = /* @__PURE__ */ Symbol.for("vuetify:defaults");
|
|
473
|
+
function injectDefaults() {
|
|
474
|
+
const defaults = inject(DefaultsSymbol);
|
|
475
|
+
if (!defaults) throw new Error("[Vuetify] Could not find defaults instance");
|
|
476
|
+
return defaults;
|
|
477
|
+
}
|
|
478
|
+
function provideDefaults(defaults, options) {
|
|
479
|
+
const injectedDefaults = injectDefaults();
|
|
480
|
+
const providedDefaults = ref(defaults);
|
|
481
|
+
const newDefaults = computed(() => {
|
|
482
|
+
const disabled = unref(options?.disabled);
|
|
483
|
+
if (disabled) return injectedDefaults.value;
|
|
484
|
+
const scoped = unref(options?.scoped);
|
|
485
|
+
const reset = unref(options?.reset);
|
|
486
|
+
const root = unref(options?.root);
|
|
487
|
+
if (providedDefaults.value == null && !(scoped || reset || root)) return injectedDefaults.value;
|
|
488
|
+
let properties = mergeDeep(providedDefaults.value, {
|
|
489
|
+
prev: injectedDefaults.value
|
|
490
|
+
});
|
|
491
|
+
if (scoped) return properties;
|
|
492
|
+
if (reset || root) {
|
|
493
|
+
const len = Number(reset || Infinity);
|
|
494
|
+
for (let i = 0; i <= len; i++) {
|
|
495
|
+
if (!properties || !("prev" in properties)) {
|
|
496
|
+
break;
|
|
497
|
+
}
|
|
498
|
+
properties = properties.prev;
|
|
499
|
+
}
|
|
500
|
+
if (properties && typeof root === "string" && root in properties) {
|
|
501
|
+
properties = mergeDeep(mergeDeep(properties, {
|
|
502
|
+
prev: properties
|
|
503
|
+
}), properties[root]);
|
|
504
|
+
}
|
|
505
|
+
return properties;
|
|
506
|
+
}
|
|
507
|
+
return properties.prev ? mergeDeep(properties.prev, properties) : properties;
|
|
508
|
+
});
|
|
509
|
+
provide(DefaultsSymbol, newDefaults);
|
|
510
|
+
return newDefaults;
|
|
511
|
+
}
|
|
512
|
+
function propIsDefined(vnode, prop) {
|
|
513
|
+
return vnode.props && (typeof vnode.props[prop] !== "undefined" || typeof vnode.props[toKebabCase(prop)] !== "undefined");
|
|
514
|
+
}
|
|
515
|
+
function internalUseDefaults() {
|
|
516
|
+
let props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
517
|
+
let name = arguments.length > 1 ? arguments[1] : void 0;
|
|
518
|
+
let defaults = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : injectDefaults();
|
|
519
|
+
const vm = getCurrentInstance("useDefaults");
|
|
520
|
+
name = name ?? vm.type.name ?? vm.type.__name;
|
|
521
|
+
if (!name) {
|
|
522
|
+
throw new Error("[Vuetify] Could not determine component name");
|
|
523
|
+
}
|
|
524
|
+
const componentDefaults = computed(() => defaults.value?.[props._as ?? name]);
|
|
525
|
+
const _props = new Proxy(props, {
|
|
526
|
+
get(target, prop) {
|
|
527
|
+
const propValue = Reflect.get(target, prop);
|
|
528
|
+
if (prop === "class" || prop === "style") {
|
|
529
|
+
return [componentDefaults.value?.[prop], propValue].filter((v) => v != null);
|
|
530
|
+
}
|
|
531
|
+
if (propIsDefined(vm.vnode, prop)) return propValue;
|
|
532
|
+
const _componentDefault = componentDefaults.value?.[prop];
|
|
533
|
+
if (_componentDefault !== void 0) return _componentDefault;
|
|
534
|
+
const _globalDefault = defaults.value?.global?.[prop];
|
|
535
|
+
if (_globalDefault !== void 0) return _globalDefault;
|
|
536
|
+
return propValue;
|
|
537
|
+
}
|
|
538
|
+
});
|
|
539
|
+
const _subcomponentDefaults = shallowRef();
|
|
540
|
+
watchEffect(() => {
|
|
541
|
+
if (componentDefaults.value) {
|
|
542
|
+
const subComponents = Object.entries(componentDefaults.value).filter((_ref) => {
|
|
543
|
+
let [key] = _ref;
|
|
544
|
+
return key.startsWith(key[0].toUpperCase());
|
|
545
|
+
});
|
|
546
|
+
_subcomponentDefaults.value = subComponents.length ? Object.fromEntries(subComponents) : void 0;
|
|
547
|
+
} else {
|
|
548
|
+
_subcomponentDefaults.value = void 0;
|
|
549
|
+
}
|
|
550
|
+
});
|
|
551
|
+
function provideSubDefaults() {
|
|
552
|
+
const injected = injectSelf(DefaultsSymbol, vm);
|
|
553
|
+
provide(DefaultsSymbol, computed(() => {
|
|
554
|
+
return _subcomponentDefaults.value ? mergeDeep(injected?.value ?? {}, _subcomponentDefaults.value) : injected?.value;
|
|
555
|
+
}));
|
|
556
|
+
}
|
|
557
|
+
return {
|
|
558
|
+
props: _props,
|
|
559
|
+
provideSubDefaults
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
function defineComponent(options) {
|
|
563
|
+
options._setup = options._setup ?? options.setup;
|
|
564
|
+
if (!options.name) {
|
|
565
|
+
consoleWarn("The component is missing an explicit name, unable to generate default prop value");
|
|
566
|
+
return options;
|
|
567
|
+
}
|
|
568
|
+
if (options._setup) {
|
|
569
|
+
options.props = propsFactory(options.props ?? {}, options.name)();
|
|
570
|
+
const propKeys = Object.keys(options.props).filter((key) => key !== "class" && key !== "style");
|
|
571
|
+
options.filterProps = function filterProps(props) {
|
|
572
|
+
return pick(props, propKeys);
|
|
573
|
+
};
|
|
574
|
+
options.props._as = String;
|
|
575
|
+
options.setup = function setup(props, ctx) {
|
|
576
|
+
const defaults = injectDefaults();
|
|
577
|
+
if (!defaults.value) return options._setup(props, ctx);
|
|
578
|
+
const {
|
|
579
|
+
props: _props,
|
|
580
|
+
provideSubDefaults
|
|
581
|
+
} = internalUseDefaults(props, props._as ?? options.name, defaults);
|
|
582
|
+
const setupBindings = options._setup(_props, ctx);
|
|
583
|
+
provideSubDefaults();
|
|
584
|
+
return setupBindings;
|
|
585
|
+
};
|
|
586
|
+
}
|
|
587
|
+
return options;
|
|
588
|
+
}
|
|
589
|
+
function genericComponent() {
|
|
590
|
+
let exposeDefaults = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
|
|
591
|
+
return (options) => (exposeDefaults ? defineComponent : defineComponent$1)(options);
|
|
592
|
+
}
|
|
593
|
+
function createSimpleFunctional(klass) {
|
|
594
|
+
let tag = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "div";
|
|
595
|
+
let name = arguments.length > 2 ? arguments[2] : void 0;
|
|
596
|
+
return genericComponent()({
|
|
597
|
+
name: name ?? capitalize(camelize(klass.replace(/__/g, "-"))),
|
|
598
|
+
props: {
|
|
599
|
+
tag: {
|
|
600
|
+
type: String,
|
|
601
|
+
default: tag
|
|
602
|
+
},
|
|
603
|
+
...makeComponentProps()
|
|
604
|
+
},
|
|
605
|
+
setup(props, _ref) {
|
|
606
|
+
let {
|
|
607
|
+
slots
|
|
608
|
+
} = _ref;
|
|
609
|
+
return () => {
|
|
610
|
+
return h(props.tag, {
|
|
611
|
+
class: [klass, props.class],
|
|
612
|
+
style: props.style
|
|
613
|
+
}, slots.default?.());
|
|
614
|
+
};
|
|
615
|
+
}
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
function updateRecursionCache(a, b, cache, result) {
|
|
619
|
+
if (!cache || isPrimitive(a) || isPrimitive(b)) return;
|
|
620
|
+
const visitedObject = cache.get(a);
|
|
621
|
+
if (visitedObject) {
|
|
622
|
+
visitedObject.set(b, result);
|
|
623
|
+
} else {
|
|
624
|
+
const newCacheItem = /* @__PURE__ */ new WeakMap();
|
|
625
|
+
newCacheItem.set(b, result);
|
|
626
|
+
cache.set(a, newCacheItem);
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
function findCachedComparison(a, b, cache) {
|
|
630
|
+
if (!cache || isPrimitive(a) || isPrimitive(b)) return null;
|
|
631
|
+
const r1 = cache.get(a)?.get(b);
|
|
632
|
+
if (typeof r1 === "boolean") return r1;
|
|
633
|
+
const r2 = cache.get(b)?.get(a);
|
|
634
|
+
if (typeof r2 === "boolean") return r2;
|
|
635
|
+
return null;
|
|
636
|
+
}
|
|
637
|
+
function deepEqual(a, b) {
|
|
638
|
+
let recursionCache = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : /* @__PURE__ */ new WeakMap();
|
|
639
|
+
if (a === b) return true;
|
|
640
|
+
if (a instanceof Date && b instanceof Date && a.getTime() !== b.getTime()) {
|
|
641
|
+
return false;
|
|
642
|
+
}
|
|
643
|
+
if (a !== Object(a) || b !== Object(b)) {
|
|
644
|
+
return false;
|
|
645
|
+
}
|
|
646
|
+
const props = Object.keys(a);
|
|
647
|
+
if (props.length !== Object.keys(b).length) {
|
|
648
|
+
return false;
|
|
649
|
+
}
|
|
650
|
+
const cachedComparisonResult = findCachedComparison(a, b, recursionCache);
|
|
651
|
+
if (cachedComparisonResult) {
|
|
652
|
+
return cachedComparisonResult;
|
|
653
|
+
}
|
|
654
|
+
updateRecursionCache(a, b, recursionCache, true);
|
|
655
|
+
return props.every((p) => deepEqual(a[p], b[p], recursionCache));
|
|
656
|
+
}
|
|
657
|
+
function useRender(render) {
|
|
658
|
+
const vm = getCurrentInstance("useRender");
|
|
659
|
+
vm.render = render;
|
|
660
|
+
}
|
|
661
|
+
function useResizeObserver(callback) {
|
|
662
|
+
let box = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "content";
|
|
663
|
+
const resizeRef = templateRef();
|
|
664
|
+
const contentRect = ref();
|
|
665
|
+
if (IN_BROWSER) {
|
|
666
|
+
const observer = new ResizeObserver((entries) => {
|
|
667
|
+
if (!entries.length) return;
|
|
668
|
+
if (box === "content") {
|
|
669
|
+
contentRect.value = entries[0].contentRect;
|
|
670
|
+
} else {
|
|
671
|
+
contentRect.value = entries[0].target.getBoundingClientRect();
|
|
672
|
+
}
|
|
673
|
+
});
|
|
674
|
+
onBeforeUnmount(() => {
|
|
675
|
+
observer.disconnect();
|
|
676
|
+
});
|
|
677
|
+
watch(() => resizeRef.el, (newValue, oldValue) => {
|
|
678
|
+
if (oldValue) {
|
|
679
|
+
observer.unobserve(oldValue);
|
|
680
|
+
contentRect.value = void 0;
|
|
681
|
+
}
|
|
682
|
+
if (newValue) observer.observe(newValue);
|
|
683
|
+
}, {
|
|
684
|
+
flush: "post"
|
|
685
|
+
});
|
|
686
|
+
}
|
|
687
|
+
return {
|
|
688
|
+
resizeRef,
|
|
689
|
+
contentRect: readonly(contentRect)
|
|
690
|
+
};
|
|
691
|
+
}
|
|
692
|
+
const VuetifyLayoutKey = /* @__PURE__ */ Symbol.for("vuetify:layout");
|
|
693
|
+
const VuetifyLayoutItemKey = /* @__PURE__ */ Symbol.for("vuetify:layout-item");
|
|
694
|
+
const ROOT_ZINDEX = 1e3;
|
|
695
|
+
const makeLayoutProps = propsFactory({
|
|
696
|
+
overlaps: {
|
|
697
|
+
type: Array,
|
|
698
|
+
default: () => []
|
|
699
|
+
},
|
|
700
|
+
fullHeight: Boolean
|
|
701
|
+
}, "layout");
|
|
702
|
+
function useLayout() {
|
|
703
|
+
const layout = inject(VuetifyLayoutKey);
|
|
704
|
+
if (!layout) throw new Error("[Vuetify] Could not find injected layout");
|
|
705
|
+
return {
|
|
706
|
+
getLayoutItem: layout.getLayoutItem,
|
|
707
|
+
mainRect: layout.mainRect,
|
|
708
|
+
mainStyles: layout.mainStyles
|
|
709
|
+
};
|
|
710
|
+
}
|
|
711
|
+
const generateLayers = (layout, positions, layoutSizes, activeItems) => {
|
|
712
|
+
let previousLayer = {
|
|
713
|
+
top: 0,
|
|
714
|
+
left: 0,
|
|
715
|
+
right: 0,
|
|
716
|
+
bottom: 0
|
|
717
|
+
};
|
|
718
|
+
const layers = [{
|
|
719
|
+
id: "",
|
|
720
|
+
layer: {
|
|
721
|
+
...previousLayer
|
|
722
|
+
}
|
|
723
|
+
}];
|
|
724
|
+
for (const id of layout) {
|
|
725
|
+
const position = positions.get(id);
|
|
726
|
+
const amount = layoutSizes.get(id);
|
|
727
|
+
const active = activeItems.get(id);
|
|
728
|
+
if (!position || !amount || !active) continue;
|
|
729
|
+
const layer = {
|
|
730
|
+
...previousLayer,
|
|
731
|
+
[position.value]: parseInt(previousLayer[position.value], 10) + (active.value ? parseInt(amount.value, 10) : 0)
|
|
732
|
+
};
|
|
733
|
+
layers.push({
|
|
734
|
+
id,
|
|
735
|
+
layer
|
|
736
|
+
});
|
|
737
|
+
previousLayer = layer;
|
|
738
|
+
}
|
|
739
|
+
return layers;
|
|
740
|
+
};
|
|
741
|
+
function createLayout(props) {
|
|
742
|
+
const parentLayout = inject(VuetifyLayoutKey, null);
|
|
743
|
+
const rootZIndex = computed(() => parentLayout ? parentLayout.rootZIndex.value - 100 : ROOT_ZINDEX);
|
|
744
|
+
const registered = ref([]);
|
|
745
|
+
const positions = reactive(/* @__PURE__ */ new Map());
|
|
746
|
+
const layoutSizes = reactive(/* @__PURE__ */ new Map());
|
|
747
|
+
const priorities = reactive(/* @__PURE__ */ new Map());
|
|
748
|
+
const activeItems = reactive(/* @__PURE__ */ new Map());
|
|
749
|
+
const disabledTransitions = reactive(/* @__PURE__ */ new Map());
|
|
750
|
+
const {
|
|
751
|
+
resizeRef,
|
|
752
|
+
contentRect: layoutRect
|
|
753
|
+
} = useResizeObserver();
|
|
754
|
+
const computedOverlaps = computed(() => {
|
|
755
|
+
const map = /* @__PURE__ */ new Map();
|
|
756
|
+
const overlaps = props.overlaps ?? [];
|
|
757
|
+
for (const overlap of overlaps.filter((item) => item.includes(":"))) {
|
|
758
|
+
const [top, bottom] = overlap.split(":");
|
|
759
|
+
if (!registered.value.includes(top) || !registered.value.includes(bottom)) continue;
|
|
760
|
+
const topPosition = positions.get(top);
|
|
761
|
+
const bottomPosition = positions.get(bottom);
|
|
762
|
+
const topAmount = layoutSizes.get(top);
|
|
763
|
+
const bottomAmount = layoutSizes.get(bottom);
|
|
764
|
+
if (!topPosition || !bottomPosition || !topAmount || !bottomAmount) continue;
|
|
765
|
+
map.set(bottom, {
|
|
766
|
+
position: topPosition.value,
|
|
767
|
+
amount: parseInt(topAmount.value, 10)
|
|
768
|
+
});
|
|
769
|
+
map.set(top, {
|
|
770
|
+
position: bottomPosition.value,
|
|
771
|
+
amount: -parseInt(bottomAmount.value, 10)
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
return map;
|
|
775
|
+
});
|
|
776
|
+
const layers = computed(() => {
|
|
777
|
+
const uniquePriorities = [...new Set([...priorities.values()].map((p) => p.value))].sort((a, b) => a - b);
|
|
778
|
+
const layout = [];
|
|
779
|
+
for (const p of uniquePriorities) {
|
|
780
|
+
const items2 = registered.value.filter((id) => priorities.get(id)?.value === p);
|
|
781
|
+
layout.push(...items2);
|
|
782
|
+
}
|
|
783
|
+
return generateLayers(layout, positions, layoutSizes, activeItems);
|
|
784
|
+
});
|
|
785
|
+
const transitionsEnabled = computed(() => {
|
|
786
|
+
return !Array.from(disabledTransitions.values()).some((ref2) => ref2.value);
|
|
787
|
+
});
|
|
788
|
+
const mainRect = computed(() => {
|
|
789
|
+
return layers.value[layers.value.length - 1].layer;
|
|
790
|
+
});
|
|
791
|
+
const mainStyles = toRef(() => {
|
|
792
|
+
return {
|
|
793
|
+
"--v-layout-left": convertToUnit(mainRect.value.left),
|
|
794
|
+
"--v-layout-right": convertToUnit(mainRect.value.right),
|
|
795
|
+
"--v-layout-top": convertToUnit(mainRect.value.top),
|
|
796
|
+
"--v-layout-bottom": convertToUnit(mainRect.value.bottom),
|
|
797
|
+
...transitionsEnabled.value ? void 0 : {
|
|
798
|
+
transition: "none"
|
|
799
|
+
}
|
|
800
|
+
};
|
|
801
|
+
});
|
|
802
|
+
const items = computed(() => {
|
|
803
|
+
return layers.value.slice(1).map((_ref, index) => {
|
|
804
|
+
let {
|
|
805
|
+
id
|
|
806
|
+
} = _ref;
|
|
807
|
+
const {
|
|
808
|
+
layer
|
|
809
|
+
} = layers.value[index];
|
|
810
|
+
const size = layoutSizes.get(id);
|
|
811
|
+
const position = positions.get(id);
|
|
812
|
+
return {
|
|
813
|
+
id,
|
|
814
|
+
...layer,
|
|
815
|
+
size: Number(size.value),
|
|
816
|
+
position: position.value
|
|
817
|
+
};
|
|
818
|
+
});
|
|
819
|
+
});
|
|
820
|
+
const getLayoutItem = (id) => {
|
|
821
|
+
return items.value.find((item) => item.id === id);
|
|
822
|
+
};
|
|
823
|
+
const rootVm = getCurrentInstance("createLayout");
|
|
824
|
+
const isMounted = shallowRef(false);
|
|
825
|
+
onMounted(() => {
|
|
826
|
+
isMounted.value = true;
|
|
827
|
+
});
|
|
828
|
+
provide(VuetifyLayoutKey, {
|
|
829
|
+
register: (vm, _ref2) => {
|
|
830
|
+
let {
|
|
831
|
+
id,
|
|
832
|
+
order,
|
|
833
|
+
position,
|
|
834
|
+
layoutSize,
|
|
835
|
+
elementSize,
|
|
836
|
+
active,
|
|
837
|
+
disableTransitions,
|
|
838
|
+
absolute
|
|
839
|
+
} = _ref2;
|
|
840
|
+
priorities.set(id, order);
|
|
841
|
+
positions.set(id, position);
|
|
842
|
+
layoutSizes.set(id, layoutSize);
|
|
843
|
+
activeItems.set(id, active);
|
|
844
|
+
disableTransitions && disabledTransitions.set(id, disableTransitions);
|
|
845
|
+
const instances = findChildrenWithProvide(VuetifyLayoutItemKey, rootVm?.vnode);
|
|
846
|
+
const instanceIndex = instances.indexOf(vm);
|
|
847
|
+
if (instanceIndex > -1) registered.value.splice(instanceIndex, 0, id);
|
|
848
|
+
else registered.value.push(id);
|
|
849
|
+
const index = computed(() => items.value.findIndex((i) => i.id === id));
|
|
850
|
+
const zIndex = computed(() => rootZIndex.value + layers.value.length * 2 - index.value * 2);
|
|
851
|
+
const layoutItemStyles = computed(() => {
|
|
852
|
+
const isHorizontal = position.value === "left" || position.value === "right";
|
|
853
|
+
const isOppositeHorizontal = position.value === "right";
|
|
854
|
+
const isOppositeVertical = position.value === "bottom";
|
|
855
|
+
const size = elementSize.value ?? layoutSize.value;
|
|
856
|
+
const unit = size === 0 ? "%" : "px";
|
|
857
|
+
const styles = {
|
|
858
|
+
[position.value]: 0,
|
|
859
|
+
zIndex: zIndex.value,
|
|
860
|
+
transform: `translate${isHorizontal ? "X" : "Y"}(${(active.value ? 0 : -(size === 0 ? 100 : size)) * (isOppositeHorizontal || isOppositeVertical ? -1 : 1)}${unit})`,
|
|
861
|
+
position: absolute.value || rootZIndex.value !== ROOT_ZINDEX ? "absolute" : "fixed",
|
|
862
|
+
...transitionsEnabled.value ? void 0 : {
|
|
863
|
+
transition: "none"
|
|
864
|
+
}
|
|
865
|
+
};
|
|
866
|
+
if (!isMounted.value) return styles;
|
|
867
|
+
const item = items.value[index.value];
|
|
868
|
+
if (!item) consoleWarn(`[Vuetify] Could not find layout item "${id}"`);
|
|
869
|
+
const overlap = computedOverlaps.value.get(id);
|
|
870
|
+
if (overlap) {
|
|
871
|
+
item[overlap.position] += overlap.amount;
|
|
872
|
+
}
|
|
873
|
+
return {
|
|
874
|
+
...styles,
|
|
875
|
+
height: isHorizontal ? `calc(100% - ${item.top}px - ${item.bottom}px)` : elementSize.value ? `${elementSize.value}px` : void 0,
|
|
876
|
+
left: isOppositeHorizontal ? void 0 : `${item.left}px`,
|
|
877
|
+
right: isOppositeHorizontal ? `${item.right}px` : void 0,
|
|
878
|
+
top: position.value !== "bottom" ? `${item.top}px` : void 0,
|
|
879
|
+
bottom: position.value !== "top" ? `${item.bottom}px` : void 0,
|
|
880
|
+
width: !isHorizontal ? `calc(100% - ${item.left}px - ${item.right}px)` : elementSize.value ? `${elementSize.value}px` : void 0
|
|
881
|
+
};
|
|
882
|
+
});
|
|
883
|
+
const layoutItemScrimStyles = computed(() => ({
|
|
884
|
+
zIndex: zIndex.value - 1
|
|
885
|
+
}));
|
|
886
|
+
return {
|
|
887
|
+
layoutItemStyles,
|
|
888
|
+
layoutItemScrimStyles,
|
|
889
|
+
zIndex
|
|
890
|
+
};
|
|
891
|
+
},
|
|
892
|
+
unregister: (id) => {
|
|
893
|
+
priorities.delete(id);
|
|
894
|
+
positions.delete(id);
|
|
895
|
+
layoutSizes.delete(id);
|
|
896
|
+
activeItems.delete(id);
|
|
897
|
+
disabledTransitions.delete(id);
|
|
898
|
+
registered.value = registered.value.filter((v) => v !== id);
|
|
899
|
+
},
|
|
900
|
+
mainRect,
|
|
901
|
+
mainStyles,
|
|
902
|
+
getLayoutItem,
|
|
903
|
+
items,
|
|
904
|
+
layoutRect,
|
|
905
|
+
rootZIndex
|
|
906
|
+
});
|
|
907
|
+
const layoutClasses = toRef(() => ["v-layout", {
|
|
908
|
+
"v-layout--full-height": props.fullHeight
|
|
909
|
+
}]);
|
|
910
|
+
const layoutStyles = toRef(() => ({
|
|
911
|
+
zIndex: parentLayout ? rootZIndex.value : void 0,
|
|
912
|
+
position: parentLayout ? "relative" : void 0,
|
|
913
|
+
overflow: parentLayout ? "hidden" : void 0
|
|
914
|
+
}));
|
|
915
|
+
return {
|
|
916
|
+
layoutClasses,
|
|
917
|
+
layoutStyles,
|
|
918
|
+
getLayoutItem,
|
|
919
|
+
items,
|
|
920
|
+
layoutRect,
|
|
921
|
+
layoutRef: resizeRef
|
|
922
|
+
};
|
|
923
|
+
}
|
|
924
|
+
function useToggleScope(source, fn) {
|
|
925
|
+
let scope;
|
|
926
|
+
function start() {
|
|
927
|
+
scope = effectScope();
|
|
928
|
+
scope.run(() => fn.length ? fn(() => {
|
|
929
|
+
scope?.stop();
|
|
930
|
+
start();
|
|
931
|
+
}) : fn());
|
|
932
|
+
}
|
|
933
|
+
watch(source, (active) => {
|
|
934
|
+
if (active && !scope) {
|
|
935
|
+
start();
|
|
936
|
+
} else if (!active) {
|
|
937
|
+
scope?.stop();
|
|
938
|
+
scope = void 0;
|
|
939
|
+
}
|
|
940
|
+
}, {
|
|
941
|
+
immediate: true
|
|
942
|
+
});
|
|
943
|
+
onScopeDispose(() => {
|
|
944
|
+
scope?.stop();
|
|
945
|
+
});
|
|
946
|
+
}
|
|
947
|
+
function useProxiedModel(props, prop, defaultValue) {
|
|
948
|
+
let transformIn = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : (v) => v;
|
|
949
|
+
let transformOut = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : (v) => v;
|
|
950
|
+
const vm = getCurrentInstance("useProxiedModel");
|
|
951
|
+
const internal = ref(props[prop] !== void 0 ? props[prop] : defaultValue);
|
|
952
|
+
const kebabProp = toKebabCase(prop);
|
|
953
|
+
const checkKebab = kebabProp !== prop;
|
|
954
|
+
const isControlled = checkKebab ? computed(() => {
|
|
955
|
+
void props[prop];
|
|
956
|
+
return !!((vm.vnode.props?.hasOwnProperty(prop) || vm.vnode.props?.hasOwnProperty(kebabProp)) && (vm.vnode.props?.hasOwnProperty(`onUpdate:${prop}`) || vm.vnode.props?.hasOwnProperty(`onUpdate:${kebabProp}`)));
|
|
957
|
+
}) : computed(() => {
|
|
958
|
+
void props[prop];
|
|
959
|
+
return !!(vm.vnode.props?.hasOwnProperty(prop) && vm.vnode.props?.hasOwnProperty(`onUpdate:${prop}`));
|
|
960
|
+
});
|
|
961
|
+
useToggleScope(() => !isControlled.value, () => {
|
|
962
|
+
watch(() => props[prop], (val) => {
|
|
963
|
+
internal.value = val;
|
|
964
|
+
});
|
|
965
|
+
});
|
|
966
|
+
const model = computed({
|
|
967
|
+
get() {
|
|
968
|
+
const externalValue = props[prop];
|
|
969
|
+
return transformIn(isControlled.value ? externalValue : internal.value);
|
|
970
|
+
},
|
|
971
|
+
set(internalValue) {
|
|
972
|
+
const newValue = transformOut(internalValue);
|
|
973
|
+
const value = toRaw(isControlled.value ? props[prop] : internal.value);
|
|
974
|
+
if (value === newValue || transformIn(value) === internalValue) {
|
|
975
|
+
return;
|
|
976
|
+
}
|
|
977
|
+
internal.value = newValue;
|
|
978
|
+
vm?.emit(`update:${prop}`, newValue);
|
|
979
|
+
}
|
|
980
|
+
});
|
|
981
|
+
Object.defineProperty(model, "externalValue", {
|
|
982
|
+
get: () => isControlled.value ? props[prop] : internal.value
|
|
983
|
+
});
|
|
984
|
+
return model;
|
|
985
|
+
}
|
|
986
|
+
const LocaleSymbol = /* @__PURE__ */ Symbol.for("vuetify:locale");
|
|
987
|
+
function useRtl() {
|
|
988
|
+
const locale = inject(LocaleSymbol);
|
|
989
|
+
if (!locale) throw new Error("[Vuetify] Could not find injected rtl instance");
|
|
990
|
+
return {
|
|
991
|
+
isRtl: locale.isRtl,
|
|
992
|
+
rtlClasses: locale.rtlClasses
|
|
993
|
+
};
|
|
994
|
+
}
|
|
995
|
+
const ThemeSymbol = /* @__PURE__ */ Symbol.for("vuetify:theme");
|
|
996
|
+
const makeThemeProps = propsFactory({
|
|
997
|
+
theme: String
|
|
998
|
+
}, "theme");
|
|
999
|
+
function provideTheme(props) {
|
|
1000
|
+
getCurrentInstance("provideTheme");
|
|
1001
|
+
const theme = inject(ThemeSymbol, null);
|
|
1002
|
+
if (!theme) throw new Error("Could not find Vuetify theme injection");
|
|
1003
|
+
const name = toRef(() => props.theme ?? theme.name.value);
|
|
1004
|
+
const current = toRef(() => theme.themes.value[name.value]);
|
|
1005
|
+
const themeClasses = toRef(() => theme.isDisabled ? void 0 : `${theme.prefix}theme--${name.value}`);
|
|
1006
|
+
const newTheme = {
|
|
1007
|
+
...theme,
|
|
1008
|
+
name,
|
|
1009
|
+
current,
|
|
1010
|
+
themeClasses
|
|
1011
|
+
};
|
|
1012
|
+
provide(ThemeSymbol, newTheme);
|
|
1013
|
+
return newTheme;
|
|
1014
|
+
}
|
|
1015
|
+
function useTheme() {
|
|
1016
|
+
getCurrentInstance("useTheme");
|
|
1017
|
+
const theme = inject(ThemeSymbol, null);
|
|
1018
|
+
if (!theme) throw new Error("Could not find Vuetify theme injection");
|
|
1019
|
+
return theme;
|
|
1020
|
+
}
|
|
1021
|
+
const makeVAppProps = propsFactory({
|
|
1022
|
+
...makeComponentProps(),
|
|
1023
|
+
...omit(makeLayoutProps(), ["fullHeight"]),
|
|
1024
|
+
...makeThemeProps()
|
|
1025
|
+
}, "VApp");
|
|
1026
|
+
const VApp = genericComponent()({
|
|
1027
|
+
name: "VApp",
|
|
1028
|
+
props: makeVAppProps(),
|
|
1029
|
+
setup(props, _ref) {
|
|
1030
|
+
let {
|
|
1031
|
+
slots
|
|
1032
|
+
} = _ref;
|
|
1033
|
+
const theme = provideTheme(props);
|
|
1034
|
+
const {
|
|
1035
|
+
layoutClasses,
|
|
1036
|
+
getLayoutItem,
|
|
1037
|
+
items,
|
|
1038
|
+
layoutRef
|
|
1039
|
+
} = createLayout({
|
|
1040
|
+
...props,
|
|
1041
|
+
fullHeight: true
|
|
1042
|
+
});
|
|
1043
|
+
const {
|
|
1044
|
+
rtlClasses
|
|
1045
|
+
} = useRtl();
|
|
1046
|
+
useRender(() => createElementVNode("div", {
|
|
1047
|
+
"ref": layoutRef,
|
|
1048
|
+
"class": normalizeClass(["v-application", theme.themeClasses.value, layoutClasses.value, rtlClasses.value, props.class]),
|
|
1049
|
+
"style": normalizeStyle([props.style])
|
|
1050
|
+
}, [createElementVNode("div", {
|
|
1051
|
+
"class": "v-application__wrap"
|
|
1052
|
+
}, [slots.default?.()])]));
|
|
1053
|
+
return {
|
|
1054
|
+
getLayoutItem,
|
|
1055
|
+
items,
|
|
1056
|
+
theme
|
|
1057
|
+
};
|
|
1058
|
+
}
|
|
1059
|
+
});
|
|
1060
|
+
const makeVBannerActionsProps = propsFactory({
|
|
1061
|
+
color: String,
|
|
1062
|
+
density: String,
|
|
1063
|
+
...makeComponentProps()
|
|
1064
|
+
}, "VBannerActions");
|
|
1065
|
+
const VBannerActions = genericComponent()({
|
|
1066
|
+
name: "VBannerActions",
|
|
1067
|
+
props: makeVBannerActionsProps(),
|
|
1068
|
+
setup(props, _ref) {
|
|
1069
|
+
let {
|
|
1070
|
+
slots
|
|
1071
|
+
} = _ref;
|
|
1072
|
+
provideDefaults({
|
|
1073
|
+
VBtn: {
|
|
1074
|
+
color: props.color,
|
|
1075
|
+
density: props.density,
|
|
1076
|
+
slim: true,
|
|
1077
|
+
variant: "text"
|
|
1078
|
+
}
|
|
1079
|
+
});
|
|
1080
|
+
useRender(() => createElementVNode("div", {
|
|
1081
|
+
"class": normalizeClass(["v-banner-actions", props.class]),
|
|
1082
|
+
"style": normalizeStyle(props.style)
|
|
1083
|
+
}, [slots.default?.()]));
|
|
1084
|
+
return {};
|
|
1085
|
+
}
|
|
1086
|
+
});
|
|
1087
|
+
const VBannerText = createSimpleFunctional("v-banner-text");
|
|
1088
|
+
const makeVDefaultsProviderProps = propsFactory({
|
|
1089
|
+
defaults: Object,
|
|
1090
|
+
disabled: Boolean,
|
|
1091
|
+
reset: [Number, String],
|
|
1092
|
+
root: [Boolean, String],
|
|
1093
|
+
scoped: Boolean
|
|
1094
|
+
}, "VDefaultsProvider");
|
|
1095
|
+
const VDefaultsProvider = genericComponent(false)({
|
|
1096
|
+
name: "VDefaultsProvider",
|
|
1097
|
+
props: makeVDefaultsProviderProps(),
|
|
1098
|
+
setup(props, _ref) {
|
|
1099
|
+
let {
|
|
1100
|
+
slots
|
|
1101
|
+
} = _ref;
|
|
1102
|
+
const {
|
|
1103
|
+
defaults,
|
|
1104
|
+
disabled,
|
|
1105
|
+
reset,
|
|
1106
|
+
root,
|
|
1107
|
+
scoped
|
|
1108
|
+
} = toRefs(props);
|
|
1109
|
+
provideDefaults(defaults, {
|
|
1110
|
+
reset,
|
|
1111
|
+
root,
|
|
1112
|
+
scoped,
|
|
1113
|
+
disabled
|
|
1114
|
+
});
|
|
1115
|
+
return () => slots.default?.();
|
|
1116
|
+
}
|
|
1117
|
+
});
|
|
1118
|
+
function useColor(colors) {
|
|
1119
|
+
return destructComputed(() => {
|
|
1120
|
+
const {
|
|
1121
|
+
class: colorClasses,
|
|
1122
|
+
style: colorStyles
|
|
1123
|
+
} = computeColor(colors);
|
|
1124
|
+
return {
|
|
1125
|
+
colorClasses,
|
|
1126
|
+
colorStyles
|
|
1127
|
+
};
|
|
1128
|
+
});
|
|
1129
|
+
}
|
|
1130
|
+
function useTextColor(color) {
|
|
1131
|
+
const {
|
|
1132
|
+
colorClasses: textColorClasses,
|
|
1133
|
+
colorStyles: textColorStyles
|
|
1134
|
+
} = useColor(() => ({
|
|
1135
|
+
text: toValue(color)
|
|
1136
|
+
}));
|
|
1137
|
+
return {
|
|
1138
|
+
textColorClasses,
|
|
1139
|
+
textColorStyles
|
|
1140
|
+
};
|
|
1141
|
+
}
|
|
1142
|
+
function useBackgroundColor(color) {
|
|
1143
|
+
const {
|
|
1144
|
+
colorClasses: backgroundColorClasses,
|
|
1145
|
+
colorStyles: backgroundColorStyles
|
|
1146
|
+
} = useColor(() => ({
|
|
1147
|
+
background: toValue(color)
|
|
1148
|
+
}));
|
|
1149
|
+
return {
|
|
1150
|
+
backgroundColorClasses,
|
|
1151
|
+
backgroundColorStyles
|
|
1152
|
+
};
|
|
1153
|
+
}
|
|
1154
|
+
function computeColor(colors) {
|
|
1155
|
+
const _colors = toValue(colors);
|
|
1156
|
+
const classes = [];
|
|
1157
|
+
const styles = {};
|
|
1158
|
+
if (_colors.background) {
|
|
1159
|
+
if (isCssColor(_colors.background)) {
|
|
1160
|
+
styles.backgroundColor = _colors.background;
|
|
1161
|
+
if (!_colors.text && isParsableColor(_colors.background)) {
|
|
1162
|
+
const backgroundColor = parseColor(_colors.background);
|
|
1163
|
+
if (backgroundColor.a == null || backgroundColor.a === 1) {
|
|
1164
|
+
const textColor = getForeground(backgroundColor);
|
|
1165
|
+
styles.color = textColor;
|
|
1166
|
+
styles.caretColor = textColor;
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
} else {
|
|
1170
|
+
classes.push(`bg-${_colors.background}`);
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
if (_colors.text) {
|
|
1174
|
+
if (isCssColor(_colors.text)) {
|
|
1175
|
+
styles.color = _colors.text;
|
|
1176
|
+
styles.caretColor = _colors.text;
|
|
1177
|
+
} else {
|
|
1178
|
+
classes.push(`text-${_colors.text}`);
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
return {
|
|
1182
|
+
class: classes,
|
|
1183
|
+
style: styles
|
|
1184
|
+
};
|
|
1185
|
+
}
|
|
1186
|
+
const IconValue = [String, Function, Object, Array];
|
|
1187
|
+
const IconSymbol = /* @__PURE__ */ Symbol.for("vuetify:icons");
|
|
1188
|
+
const makeIconProps = propsFactory({
|
|
1189
|
+
icon: {
|
|
1190
|
+
type: IconValue
|
|
1191
|
+
},
|
|
1192
|
+
// Could not remove this and use makeTagProps, types complained because it is not required
|
|
1193
|
+
tag: {
|
|
1194
|
+
type: [String, Object, Function],
|
|
1195
|
+
required: true
|
|
1196
|
+
}
|
|
1197
|
+
}, "icon");
|
|
1198
|
+
const VComponentIcon = genericComponent()({
|
|
1199
|
+
name: "VComponentIcon",
|
|
1200
|
+
props: makeIconProps(),
|
|
1201
|
+
setup(props, _ref) {
|
|
1202
|
+
let {
|
|
1203
|
+
slots
|
|
1204
|
+
} = _ref;
|
|
1205
|
+
return () => {
|
|
1206
|
+
const Icon = props.icon;
|
|
1207
|
+
return createVNode(props.tag, null, {
|
|
1208
|
+
default: () => [props.icon ? createVNode(Icon, null, null) : slots.default?.()]
|
|
1209
|
+
});
|
|
1210
|
+
};
|
|
1211
|
+
}
|
|
1212
|
+
});
|
|
1213
|
+
const VSvgIcon = defineComponent({
|
|
1214
|
+
name: "VSvgIcon",
|
|
1215
|
+
inheritAttrs: false,
|
|
1216
|
+
props: makeIconProps(),
|
|
1217
|
+
setup(props, _ref2) {
|
|
1218
|
+
let {
|
|
1219
|
+
attrs
|
|
1220
|
+
} = _ref2;
|
|
1221
|
+
return () => {
|
|
1222
|
+
return createVNode(props.tag, mergeProps(attrs, {
|
|
1223
|
+
"style": null
|
|
1224
|
+
}), {
|
|
1225
|
+
default: () => [createElementVNode("svg", {
|
|
1226
|
+
"class": "v-icon__svg",
|
|
1227
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
1228
|
+
"viewBox": "0 0 24 24",
|
|
1229
|
+
"role": "img",
|
|
1230
|
+
"aria-hidden": "true"
|
|
1231
|
+
}, [Array.isArray(props.icon) ? props.icon.map((path) => Array.isArray(path) ? createElementVNode("path", {
|
|
1232
|
+
"d": path[0],
|
|
1233
|
+
"fill-opacity": path[1]
|
|
1234
|
+
}, null) : createElementVNode("path", {
|
|
1235
|
+
"d": path
|
|
1236
|
+
}, null)) : createElementVNode("path", {
|
|
1237
|
+
"d": props.icon
|
|
1238
|
+
}, null)])]
|
|
1239
|
+
});
|
|
1240
|
+
};
|
|
1241
|
+
}
|
|
1242
|
+
});
|
|
1243
|
+
defineComponent({
|
|
1244
|
+
name: "VLigatureIcon",
|
|
1245
|
+
props: makeIconProps(),
|
|
1246
|
+
setup(props) {
|
|
1247
|
+
return () => {
|
|
1248
|
+
return createVNode(props.tag, null, {
|
|
1249
|
+
default: () => [props.icon]
|
|
1250
|
+
});
|
|
1251
|
+
};
|
|
1252
|
+
}
|
|
1253
|
+
});
|
|
1254
|
+
defineComponent({
|
|
1255
|
+
name: "VClassIcon",
|
|
1256
|
+
props: makeIconProps(),
|
|
1257
|
+
setup(props) {
|
|
1258
|
+
return () => {
|
|
1259
|
+
return createVNode(props.tag, {
|
|
1260
|
+
"class": normalizeClass(props.icon)
|
|
1261
|
+
}, null);
|
|
1262
|
+
};
|
|
1263
|
+
}
|
|
1264
|
+
});
|
|
1265
|
+
const useIcon = (props) => {
|
|
1266
|
+
const icons = inject(IconSymbol);
|
|
1267
|
+
if (!icons) throw new Error("Missing Vuetify Icons provide!");
|
|
1268
|
+
const iconData = computed(() => {
|
|
1269
|
+
const iconAlias = toValue(props);
|
|
1270
|
+
if (!iconAlias) return {
|
|
1271
|
+
component: VComponentIcon
|
|
1272
|
+
};
|
|
1273
|
+
let icon = iconAlias;
|
|
1274
|
+
if (typeof icon === "string") {
|
|
1275
|
+
icon = icon.trim();
|
|
1276
|
+
if (icon.startsWith("$")) {
|
|
1277
|
+
icon = icons.aliases?.[icon.slice(1)];
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
if (!icon) consoleWarn(`Could not find aliased icon "${iconAlias}"`);
|
|
1281
|
+
if (Array.isArray(icon)) {
|
|
1282
|
+
return {
|
|
1283
|
+
component: VSvgIcon,
|
|
1284
|
+
icon
|
|
1285
|
+
};
|
|
1286
|
+
} else if (typeof icon !== "string") {
|
|
1287
|
+
return {
|
|
1288
|
+
component: VComponentIcon,
|
|
1289
|
+
icon
|
|
1290
|
+
};
|
|
1291
|
+
}
|
|
1292
|
+
const iconSetName = Object.keys(icons.sets).find((setName) => typeof icon === "string" && icon.startsWith(`${setName}:`));
|
|
1293
|
+
const iconName = iconSetName ? icon.slice(iconSetName.length + 1) : icon;
|
|
1294
|
+
const iconSet = icons.sets[iconSetName ?? icons.defaultSet];
|
|
1295
|
+
return {
|
|
1296
|
+
component: iconSet.component,
|
|
1297
|
+
icon: iconName
|
|
1298
|
+
};
|
|
1299
|
+
});
|
|
1300
|
+
return {
|
|
1301
|
+
iconData
|
|
1302
|
+
};
|
|
1303
|
+
};
|
|
1304
|
+
const predefinedSizes = ["x-small", "small", "default", "large", "x-large"];
|
|
1305
|
+
const makeSizeProps = propsFactory({
|
|
1306
|
+
size: {
|
|
1307
|
+
type: [String, Number],
|
|
1308
|
+
default: "default"
|
|
1309
|
+
}
|
|
1310
|
+
}, "size");
|
|
1311
|
+
function useSize(props) {
|
|
1312
|
+
let name = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : getCurrentInstanceName();
|
|
1313
|
+
return destructComputed(() => {
|
|
1314
|
+
const size = props.size;
|
|
1315
|
+
let sizeClasses;
|
|
1316
|
+
let sizeStyles;
|
|
1317
|
+
if (includes(predefinedSizes, size)) {
|
|
1318
|
+
sizeClasses = `${name}--size-${size}`;
|
|
1319
|
+
} else if (size) {
|
|
1320
|
+
sizeStyles = {
|
|
1321
|
+
width: convertToUnit(size),
|
|
1322
|
+
height: convertToUnit(size)
|
|
1323
|
+
};
|
|
1324
|
+
}
|
|
1325
|
+
return {
|
|
1326
|
+
sizeClasses,
|
|
1327
|
+
sizeStyles
|
|
1328
|
+
};
|
|
1329
|
+
});
|
|
1330
|
+
}
|
|
1331
|
+
const makeTagProps = propsFactory({
|
|
1332
|
+
tag: {
|
|
1333
|
+
type: [String, Object, Function],
|
|
1334
|
+
default: "div"
|
|
1335
|
+
}
|
|
1336
|
+
}, "tag");
|
|
1337
|
+
const makeVIconProps = propsFactory({
|
|
1338
|
+
color: String,
|
|
1339
|
+
disabled: Boolean,
|
|
1340
|
+
start: Boolean,
|
|
1341
|
+
end: Boolean,
|
|
1342
|
+
icon: IconValue,
|
|
1343
|
+
opacity: [String, Number],
|
|
1344
|
+
...makeComponentProps(),
|
|
1345
|
+
...makeSizeProps(),
|
|
1346
|
+
...makeTagProps({
|
|
1347
|
+
tag: "i"
|
|
1348
|
+
}),
|
|
1349
|
+
...makeThemeProps()
|
|
1350
|
+
}, "VIcon");
|
|
1351
|
+
const VIcon = genericComponent()({
|
|
1352
|
+
name: "VIcon",
|
|
1353
|
+
props: makeVIconProps(),
|
|
1354
|
+
setup(props, _ref) {
|
|
1355
|
+
let {
|
|
1356
|
+
attrs,
|
|
1357
|
+
slots
|
|
1358
|
+
} = _ref;
|
|
1359
|
+
const slotIcon = shallowRef();
|
|
1360
|
+
const {
|
|
1361
|
+
themeClasses
|
|
1362
|
+
} = useTheme();
|
|
1363
|
+
const {
|
|
1364
|
+
iconData
|
|
1365
|
+
} = useIcon(() => slotIcon.value || props.icon);
|
|
1366
|
+
const {
|
|
1367
|
+
sizeClasses
|
|
1368
|
+
} = useSize(props);
|
|
1369
|
+
const {
|
|
1370
|
+
textColorClasses,
|
|
1371
|
+
textColorStyles
|
|
1372
|
+
} = useTextColor(() => props.color);
|
|
1373
|
+
useRender(() => {
|
|
1374
|
+
const slotValue = slots.default?.();
|
|
1375
|
+
if (slotValue) {
|
|
1376
|
+
slotIcon.value = flattenFragments(slotValue).filter((node) => node.type === Text && node.children && typeof node.children === "string")[0]?.children;
|
|
1377
|
+
}
|
|
1378
|
+
const hasClick = !!(attrs.onClick || attrs.onClickOnce);
|
|
1379
|
+
return createVNode(iconData.value.component, {
|
|
1380
|
+
"tag": props.tag,
|
|
1381
|
+
"icon": iconData.value.icon,
|
|
1382
|
+
"class": normalizeClass(["v-icon", "notranslate", themeClasses.value, sizeClasses.value, textColorClasses.value, {
|
|
1383
|
+
"v-icon--clickable": hasClick,
|
|
1384
|
+
"v-icon--disabled": props.disabled,
|
|
1385
|
+
"v-icon--start": props.start,
|
|
1386
|
+
"v-icon--end": props.end
|
|
1387
|
+
}, props.class]),
|
|
1388
|
+
"style": normalizeStyle([{
|
|
1389
|
+
"--v-icon-opacity": props.opacity
|
|
1390
|
+
}, !sizeClasses.value ? {
|
|
1391
|
+
fontSize: convertToUnit(props.size),
|
|
1392
|
+
height: convertToUnit(props.size),
|
|
1393
|
+
width: convertToUnit(props.size)
|
|
1394
|
+
} : void 0, textColorStyles.value, props.style]),
|
|
1395
|
+
"role": hasClick ? "button" : void 0,
|
|
1396
|
+
"aria-hidden": !hasClick,
|
|
1397
|
+
"tabindex": hasClick ? props.disabled ? -1 : 0 : void 0
|
|
1398
|
+
}, {
|
|
1399
|
+
default: () => [slotValue]
|
|
1400
|
+
});
|
|
1401
|
+
});
|
|
1402
|
+
return {};
|
|
1403
|
+
}
|
|
1404
|
+
});
|
|
1405
|
+
const makeDimensionProps = propsFactory({
|
|
1406
|
+
height: [Number, String],
|
|
1407
|
+
maxHeight: [Number, String],
|
|
1408
|
+
maxWidth: [Number, String],
|
|
1409
|
+
minHeight: [Number, String],
|
|
1410
|
+
minWidth: [Number, String],
|
|
1411
|
+
width: [Number, String]
|
|
1412
|
+
}, "dimension");
|
|
1413
|
+
function useDimension(props) {
|
|
1414
|
+
const dimensionStyles = computed(() => {
|
|
1415
|
+
const styles = {};
|
|
1416
|
+
const height = convertToUnit(props.height);
|
|
1417
|
+
const maxHeight = convertToUnit(props.maxHeight);
|
|
1418
|
+
const maxWidth = convertToUnit(props.maxWidth);
|
|
1419
|
+
const minHeight = convertToUnit(props.minHeight);
|
|
1420
|
+
const minWidth = convertToUnit(props.minWidth);
|
|
1421
|
+
const width = convertToUnit(props.width);
|
|
1422
|
+
if (height != null) styles.height = height;
|
|
1423
|
+
if (maxHeight != null) styles.maxHeight = maxHeight;
|
|
1424
|
+
if (maxWidth != null) styles.maxWidth = maxWidth;
|
|
1425
|
+
if (minHeight != null) styles.minHeight = minHeight;
|
|
1426
|
+
if (minWidth != null) styles.minWidth = minWidth;
|
|
1427
|
+
if (width != null) styles.width = width;
|
|
1428
|
+
return styles;
|
|
1429
|
+
});
|
|
1430
|
+
return {
|
|
1431
|
+
dimensionStyles
|
|
1432
|
+
};
|
|
1433
|
+
}
|
|
1434
|
+
function useAspectStyles(props) {
|
|
1435
|
+
return {
|
|
1436
|
+
aspectStyles: computed(() => {
|
|
1437
|
+
const ratio = Number(props.aspectRatio);
|
|
1438
|
+
return ratio ? {
|
|
1439
|
+
paddingBottom: String(1 / ratio * 100) + "%"
|
|
1440
|
+
} : void 0;
|
|
1441
|
+
})
|
|
1442
|
+
};
|
|
1443
|
+
}
|
|
1444
|
+
const makeVResponsiveProps = propsFactory({
|
|
1445
|
+
aspectRatio: [String, Number],
|
|
1446
|
+
contentClass: null,
|
|
1447
|
+
inline: Boolean,
|
|
1448
|
+
...makeComponentProps(),
|
|
1449
|
+
...makeDimensionProps()
|
|
1450
|
+
}, "VResponsive");
|
|
1451
|
+
const VResponsive = genericComponent()({
|
|
1452
|
+
name: "VResponsive",
|
|
1453
|
+
props: makeVResponsiveProps(),
|
|
1454
|
+
setup(props, _ref) {
|
|
1455
|
+
let {
|
|
1456
|
+
slots
|
|
1457
|
+
} = _ref;
|
|
1458
|
+
const {
|
|
1459
|
+
aspectStyles
|
|
1460
|
+
} = useAspectStyles(props);
|
|
1461
|
+
const {
|
|
1462
|
+
dimensionStyles
|
|
1463
|
+
} = useDimension(props);
|
|
1464
|
+
useRender(() => createElementVNode("div", {
|
|
1465
|
+
"class": normalizeClass(["v-responsive", {
|
|
1466
|
+
"v-responsive--inline": props.inline
|
|
1467
|
+
}, props.class]),
|
|
1468
|
+
"style": normalizeStyle([dimensionStyles.value, props.style])
|
|
1469
|
+
}, [createElementVNode("div", {
|
|
1470
|
+
"class": "v-responsive__sizer",
|
|
1471
|
+
"style": normalizeStyle(aspectStyles.value)
|
|
1472
|
+
}, null), slots.additional?.(), slots.default && createElementVNode("div", {
|
|
1473
|
+
"class": normalizeClass(["v-responsive__content", props.contentClass])
|
|
1474
|
+
}, [slots.default()])]));
|
|
1475
|
+
return {};
|
|
1476
|
+
}
|
|
1477
|
+
});
|
|
1478
|
+
const makeRoundedProps = propsFactory({
|
|
1479
|
+
rounded: {
|
|
1480
|
+
type: [Boolean, Number, String],
|
|
1481
|
+
default: void 0
|
|
1482
|
+
},
|
|
1483
|
+
tile: Boolean
|
|
1484
|
+
}, "rounded");
|
|
1485
|
+
function useRounded(props) {
|
|
1486
|
+
let name = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : getCurrentInstanceName();
|
|
1487
|
+
const roundedClasses = computed(() => {
|
|
1488
|
+
const rounded = isRef(props) ? props.value : props.rounded;
|
|
1489
|
+
const tile = isRef(props) ? false : props.tile;
|
|
1490
|
+
const classes = [];
|
|
1491
|
+
if (tile || rounded === false) {
|
|
1492
|
+
classes.push("rounded-0");
|
|
1493
|
+
} else if (rounded === true || rounded === "") {
|
|
1494
|
+
classes.push(`${name}--rounded`);
|
|
1495
|
+
} else if (typeof rounded === "string" || rounded === 0) {
|
|
1496
|
+
for (const value of String(rounded).split(" ")) {
|
|
1497
|
+
classes.push(`rounded-${value}`);
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
return classes;
|
|
1501
|
+
});
|
|
1502
|
+
return {
|
|
1503
|
+
roundedClasses
|
|
1504
|
+
};
|
|
1505
|
+
}
|
|
1506
|
+
const makeTransitionProps = propsFactory({
|
|
1507
|
+
transition: {
|
|
1508
|
+
type: null,
|
|
1509
|
+
default: "fade-transition",
|
|
1510
|
+
validator: (val) => val !== true
|
|
1511
|
+
}
|
|
1512
|
+
}, "transition");
|
|
1513
|
+
const MaybeTransition = (props, _ref) => {
|
|
1514
|
+
let {
|
|
1515
|
+
slots
|
|
1516
|
+
} = _ref;
|
|
1517
|
+
const {
|
|
1518
|
+
transition,
|
|
1519
|
+
disabled,
|
|
1520
|
+
group,
|
|
1521
|
+
...rest
|
|
1522
|
+
} = props;
|
|
1523
|
+
const {
|
|
1524
|
+
component = group ? TransitionGroup : Transition,
|
|
1525
|
+
...customProps
|
|
1526
|
+
} = isObject(transition) ? transition : {};
|
|
1527
|
+
let transitionProps;
|
|
1528
|
+
if (isObject(transition)) {
|
|
1529
|
+
transitionProps = mergeProps(customProps, onlyDefinedProps({
|
|
1530
|
+
disabled,
|
|
1531
|
+
group
|
|
1532
|
+
}), rest);
|
|
1533
|
+
} else {
|
|
1534
|
+
transitionProps = mergeProps({
|
|
1535
|
+
name: disabled || !transition ? "" : transition
|
|
1536
|
+
}, rest);
|
|
1537
|
+
}
|
|
1538
|
+
return h(component, transitionProps, slots);
|
|
1539
|
+
};
|
|
1540
|
+
function mounted$1(el, binding) {
|
|
1541
|
+
if (!SUPPORTS_INTERSECTION) return;
|
|
1542
|
+
const modifiers = binding.modifiers || {};
|
|
1543
|
+
const value = binding.value;
|
|
1544
|
+
const {
|
|
1545
|
+
handler,
|
|
1546
|
+
options
|
|
1547
|
+
} = typeof value === "object" ? value : {
|
|
1548
|
+
handler: value,
|
|
1549
|
+
options: {}
|
|
1550
|
+
};
|
|
1551
|
+
const observer = new IntersectionObserver(function() {
|
|
1552
|
+
let entries = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
|
|
1553
|
+
let observer2 = arguments.length > 1 ? arguments[1] : void 0;
|
|
1554
|
+
const _observe = el._observe?.[binding.instance.$.uid];
|
|
1555
|
+
if (!_observe) return;
|
|
1556
|
+
const isIntersecting = entries.some((entry) => entry.isIntersecting);
|
|
1557
|
+
if (handler && (!modifiers.quiet || _observe.init) && (!modifiers.once || isIntersecting || _observe.init)) {
|
|
1558
|
+
handler(isIntersecting, entries, observer2);
|
|
1559
|
+
}
|
|
1560
|
+
if (isIntersecting && modifiers.once) unmounted$1(el, binding);
|
|
1561
|
+
else _observe.init = true;
|
|
1562
|
+
}, options);
|
|
1563
|
+
el._observe = Object(el._observe);
|
|
1564
|
+
el._observe[binding.instance.$.uid] = {
|
|
1565
|
+
init: false,
|
|
1566
|
+
observer
|
|
1567
|
+
};
|
|
1568
|
+
observer.observe(el);
|
|
1569
|
+
}
|
|
1570
|
+
function unmounted$1(el, binding) {
|
|
1571
|
+
const observe = el._observe?.[binding.instance.$.uid];
|
|
1572
|
+
if (!observe) return;
|
|
1573
|
+
observe.observer.unobserve(el);
|
|
1574
|
+
delete el._observe[binding.instance.$.uid];
|
|
1575
|
+
}
|
|
1576
|
+
const Intersect = {
|
|
1577
|
+
mounted: mounted$1,
|
|
1578
|
+
unmounted: unmounted$1
|
|
1579
|
+
};
|
|
1580
|
+
const makeVImgProps = propsFactory({
|
|
1581
|
+
absolute: Boolean,
|
|
1582
|
+
alt: String,
|
|
1583
|
+
cover: Boolean,
|
|
1584
|
+
color: String,
|
|
1585
|
+
draggable: {
|
|
1586
|
+
type: [Boolean, String],
|
|
1587
|
+
default: void 0
|
|
1588
|
+
},
|
|
1589
|
+
eager: Boolean,
|
|
1590
|
+
gradient: String,
|
|
1591
|
+
lazySrc: String,
|
|
1592
|
+
options: {
|
|
1593
|
+
type: Object,
|
|
1594
|
+
// For more information on types, navigate to:
|
|
1595
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API
|
|
1596
|
+
default: () => ({
|
|
1597
|
+
root: void 0,
|
|
1598
|
+
rootMargin: void 0,
|
|
1599
|
+
threshold: void 0
|
|
1600
|
+
})
|
|
1601
|
+
},
|
|
1602
|
+
sizes: String,
|
|
1603
|
+
src: {
|
|
1604
|
+
type: [String, Object],
|
|
1605
|
+
default: ""
|
|
1606
|
+
},
|
|
1607
|
+
crossorigin: String,
|
|
1608
|
+
referrerpolicy: String,
|
|
1609
|
+
srcset: String,
|
|
1610
|
+
position: String,
|
|
1611
|
+
...makeVResponsiveProps(),
|
|
1612
|
+
...makeComponentProps(),
|
|
1613
|
+
...makeRoundedProps(),
|
|
1614
|
+
...makeTransitionProps()
|
|
1615
|
+
}, "VImg");
|
|
1616
|
+
const VImg = genericComponent()({
|
|
1617
|
+
name: "VImg",
|
|
1618
|
+
directives: {
|
|
1619
|
+
vIntersect: Intersect
|
|
1620
|
+
},
|
|
1621
|
+
props: makeVImgProps(),
|
|
1622
|
+
emits: {
|
|
1623
|
+
loadstart: (value) => true,
|
|
1624
|
+
load: (value) => true,
|
|
1625
|
+
error: (value) => true
|
|
1626
|
+
},
|
|
1627
|
+
setup(props, _ref) {
|
|
1628
|
+
let {
|
|
1629
|
+
emit,
|
|
1630
|
+
slots
|
|
1631
|
+
} = _ref;
|
|
1632
|
+
const {
|
|
1633
|
+
backgroundColorClasses,
|
|
1634
|
+
backgroundColorStyles
|
|
1635
|
+
} = useBackgroundColor(() => props.color);
|
|
1636
|
+
const {
|
|
1637
|
+
roundedClasses
|
|
1638
|
+
} = useRounded(props);
|
|
1639
|
+
const vm = getCurrentInstance("VImg");
|
|
1640
|
+
const currentSrc = shallowRef("");
|
|
1641
|
+
const image = ref();
|
|
1642
|
+
const state = shallowRef(props.eager ? "loading" : "idle");
|
|
1643
|
+
const naturalWidth = shallowRef();
|
|
1644
|
+
const naturalHeight = shallowRef();
|
|
1645
|
+
const normalisedSrc = computed(() => {
|
|
1646
|
+
return props.src && typeof props.src === "object" ? {
|
|
1647
|
+
src: props.src.src,
|
|
1648
|
+
srcset: props.srcset || props.src.srcset,
|
|
1649
|
+
lazySrc: props.lazySrc || props.src.lazySrc,
|
|
1650
|
+
aspect: Number(props.aspectRatio || props.src.aspect || 0)
|
|
1651
|
+
} : {
|
|
1652
|
+
src: props.src,
|
|
1653
|
+
srcset: props.srcset,
|
|
1654
|
+
lazySrc: props.lazySrc,
|
|
1655
|
+
aspect: Number(props.aspectRatio || 0)
|
|
1656
|
+
};
|
|
1657
|
+
});
|
|
1658
|
+
const aspectRatio = computed(() => {
|
|
1659
|
+
return normalisedSrc.value.aspect || naturalWidth.value / naturalHeight.value || 0;
|
|
1660
|
+
});
|
|
1661
|
+
watch(() => props.src, () => {
|
|
1662
|
+
init(state.value !== "idle");
|
|
1663
|
+
});
|
|
1664
|
+
watch(aspectRatio, (val, oldVal) => {
|
|
1665
|
+
if (!val && oldVal && image.value) {
|
|
1666
|
+
pollForSize(image.value);
|
|
1667
|
+
}
|
|
1668
|
+
});
|
|
1669
|
+
onBeforeMount(() => init());
|
|
1670
|
+
function init(isIntersecting) {
|
|
1671
|
+
if (props.eager && isIntersecting) return;
|
|
1672
|
+
if (SUPPORTS_INTERSECTION && !isIntersecting && !props.eager) return;
|
|
1673
|
+
state.value = "loading";
|
|
1674
|
+
if (normalisedSrc.value.lazySrc) {
|
|
1675
|
+
const lazyImg = new Image();
|
|
1676
|
+
lazyImg.src = normalisedSrc.value.lazySrc;
|
|
1677
|
+
pollForSize(lazyImg, null);
|
|
1678
|
+
}
|
|
1679
|
+
if (!normalisedSrc.value.src) return;
|
|
1680
|
+
nextTick(() => {
|
|
1681
|
+
emit("loadstart", image.value?.currentSrc || normalisedSrc.value.src);
|
|
1682
|
+
setTimeout(() => {
|
|
1683
|
+
if (vm.isUnmounted) return;
|
|
1684
|
+
if (image.value?.complete) {
|
|
1685
|
+
if (!image.value.naturalWidth) {
|
|
1686
|
+
onError();
|
|
1687
|
+
}
|
|
1688
|
+
if (state.value === "error") return;
|
|
1689
|
+
if (!aspectRatio.value) pollForSize(image.value, null);
|
|
1690
|
+
if (state.value === "loading") onLoad();
|
|
1691
|
+
} else {
|
|
1692
|
+
if (!aspectRatio.value) pollForSize(image.value);
|
|
1693
|
+
getSrc();
|
|
1694
|
+
}
|
|
1695
|
+
});
|
|
1696
|
+
});
|
|
1697
|
+
}
|
|
1698
|
+
function onLoad() {
|
|
1699
|
+
if (vm.isUnmounted) return;
|
|
1700
|
+
getSrc();
|
|
1701
|
+
pollForSize(image.value);
|
|
1702
|
+
state.value = "loaded";
|
|
1703
|
+
emit("load", image.value?.currentSrc || normalisedSrc.value.src);
|
|
1704
|
+
}
|
|
1705
|
+
function onError() {
|
|
1706
|
+
if (vm.isUnmounted) return;
|
|
1707
|
+
state.value = "error";
|
|
1708
|
+
emit("error", image.value?.currentSrc || normalisedSrc.value.src);
|
|
1709
|
+
}
|
|
1710
|
+
function getSrc() {
|
|
1711
|
+
const img = image.value;
|
|
1712
|
+
if (img) currentSrc.value = img.currentSrc || img.src;
|
|
1713
|
+
}
|
|
1714
|
+
let timer = -1;
|
|
1715
|
+
onBeforeUnmount(() => {
|
|
1716
|
+
clearTimeout(timer);
|
|
1717
|
+
});
|
|
1718
|
+
function pollForSize(img) {
|
|
1719
|
+
let timeout = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 100;
|
|
1720
|
+
const poll = () => {
|
|
1721
|
+
clearTimeout(timer);
|
|
1722
|
+
if (vm.isUnmounted) return;
|
|
1723
|
+
const {
|
|
1724
|
+
naturalHeight: imgHeight,
|
|
1725
|
+
naturalWidth: imgWidth
|
|
1726
|
+
} = img;
|
|
1727
|
+
if (imgHeight || imgWidth) {
|
|
1728
|
+
naturalWidth.value = imgWidth;
|
|
1729
|
+
naturalHeight.value = imgHeight;
|
|
1730
|
+
} else if (!img.complete && state.value === "loading" && timeout != null) {
|
|
1731
|
+
timer = window.setTimeout(poll, timeout);
|
|
1732
|
+
} else if (img.currentSrc.endsWith(".svg") || img.currentSrc.startsWith("data:image/svg+xml")) {
|
|
1733
|
+
naturalWidth.value = 1;
|
|
1734
|
+
naturalHeight.value = 1;
|
|
1735
|
+
}
|
|
1736
|
+
};
|
|
1737
|
+
poll();
|
|
1738
|
+
}
|
|
1739
|
+
const containClasses = toRef(() => ({
|
|
1740
|
+
"v-img__img--cover": props.cover,
|
|
1741
|
+
"v-img__img--contain": !props.cover
|
|
1742
|
+
}));
|
|
1743
|
+
const __image = () => {
|
|
1744
|
+
if (!normalisedSrc.value.src || state.value === "idle") return null;
|
|
1745
|
+
const img = createElementVNode("img", {
|
|
1746
|
+
"class": normalizeClass(["v-img__img", containClasses.value]),
|
|
1747
|
+
"style": {
|
|
1748
|
+
objectPosition: props.position
|
|
1749
|
+
},
|
|
1750
|
+
"crossorigin": props.crossorigin,
|
|
1751
|
+
"src": normalisedSrc.value.src,
|
|
1752
|
+
"srcset": normalisedSrc.value.srcset,
|
|
1753
|
+
"alt": props.alt,
|
|
1754
|
+
"referrerpolicy": props.referrerpolicy,
|
|
1755
|
+
"draggable": props.draggable,
|
|
1756
|
+
"sizes": props.sizes,
|
|
1757
|
+
"ref": image,
|
|
1758
|
+
"onLoad": onLoad,
|
|
1759
|
+
"onError": onError
|
|
1760
|
+
}, null);
|
|
1761
|
+
const sources = slots.sources?.();
|
|
1762
|
+
return createVNode(MaybeTransition, {
|
|
1763
|
+
"transition": props.transition,
|
|
1764
|
+
"appear": true
|
|
1765
|
+
}, {
|
|
1766
|
+
default: () => [withDirectives(sources ? createElementVNode("picture", {
|
|
1767
|
+
"class": "v-img__picture"
|
|
1768
|
+
}, [sources, img]) : img, [[vShow, state.value === "loaded"]])]
|
|
1769
|
+
});
|
|
1770
|
+
};
|
|
1771
|
+
const __preloadImage = () => createVNode(MaybeTransition, {
|
|
1772
|
+
"transition": props.transition
|
|
1773
|
+
}, {
|
|
1774
|
+
default: () => [normalisedSrc.value.lazySrc && state.value !== "loaded" && createElementVNode("img", {
|
|
1775
|
+
"class": normalizeClass(["v-img__img", "v-img__img--preload", containClasses.value]),
|
|
1776
|
+
"style": {
|
|
1777
|
+
objectPosition: props.position
|
|
1778
|
+
},
|
|
1779
|
+
"crossorigin": props.crossorigin,
|
|
1780
|
+
"src": normalisedSrc.value.lazySrc,
|
|
1781
|
+
"alt": props.alt,
|
|
1782
|
+
"referrerpolicy": props.referrerpolicy,
|
|
1783
|
+
"draggable": props.draggable
|
|
1784
|
+
}, null)]
|
|
1785
|
+
});
|
|
1786
|
+
const __placeholder = () => {
|
|
1787
|
+
if (!slots.placeholder) return null;
|
|
1788
|
+
return createVNode(MaybeTransition, {
|
|
1789
|
+
"transition": props.transition,
|
|
1790
|
+
"appear": true
|
|
1791
|
+
}, {
|
|
1792
|
+
default: () => [(state.value === "loading" || state.value === "error" && !slots.error) && createElementVNode("div", {
|
|
1793
|
+
"class": "v-img__placeholder"
|
|
1794
|
+
}, [slots.placeholder()])]
|
|
1795
|
+
});
|
|
1796
|
+
};
|
|
1797
|
+
const __error = () => {
|
|
1798
|
+
if (!slots.error) return null;
|
|
1799
|
+
return createVNode(MaybeTransition, {
|
|
1800
|
+
"transition": props.transition,
|
|
1801
|
+
"appear": true
|
|
1802
|
+
}, {
|
|
1803
|
+
default: () => [state.value === "error" && createElementVNode("div", {
|
|
1804
|
+
"class": "v-img__error"
|
|
1805
|
+
}, [slots.error()])]
|
|
1806
|
+
});
|
|
1807
|
+
};
|
|
1808
|
+
const __gradient = () => {
|
|
1809
|
+
if (!props.gradient) return null;
|
|
1810
|
+
return createElementVNode("div", {
|
|
1811
|
+
"class": "v-img__gradient",
|
|
1812
|
+
"style": {
|
|
1813
|
+
backgroundImage: `linear-gradient(${props.gradient})`
|
|
1814
|
+
}
|
|
1815
|
+
}, null);
|
|
1816
|
+
};
|
|
1817
|
+
const isBooted = shallowRef(false);
|
|
1818
|
+
{
|
|
1819
|
+
const stop = watch(aspectRatio, (val) => {
|
|
1820
|
+
if (val) {
|
|
1821
|
+
requestAnimationFrame(() => {
|
|
1822
|
+
requestAnimationFrame(() => {
|
|
1823
|
+
isBooted.value = true;
|
|
1824
|
+
});
|
|
1825
|
+
});
|
|
1826
|
+
stop();
|
|
1827
|
+
}
|
|
1828
|
+
});
|
|
1829
|
+
}
|
|
1830
|
+
useRender(() => {
|
|
1831
|
+
const responsiveProps = VResponsive.filterProps(props);
|
|
1832
|
+
return withDirectives(createVNode(VResponsive, mergeProps({
|
|
1833
|
+
"class": ["v-img", {
|
|
1834
|
+
"v-img--absolute": props.absolute,
|
|
1835
|
+
"v-img--booting": !isBooted.value
|
|
1836
|
+
}, backgroundColorClasses.value, roundedClasses.value, props.class],
|
|
1837
|
+
"style": [{
|
|
1838
|
+
width: convertToUnit(props.width === "auto" ? naturalWidth.value : props.width)
|
|
1839
|
+
}, backgroundColorStyles.value, props.style]
|
|
1840
|
+
}, responsiveProps, {
|
|
1841
|
+
"aspectRatio": aspectRatio.value,
|
|
1842
|
+
"aria-label": props.alt,
|
|
1843
|
+
"role": props.alt ? "img" : void 0
|
|
1844
|
+
}), {
|
|
1845
|
+
additional: () => createElementVNode(Fragment, null, [createVNode(__image, null, null), createVNode(__preloadImage, null, null), createVNode(__gradient, null, null), createVNode(__placeholder, null, null), createVNode(__error, null, null)]),
|
|
1846
|
+
default: slots.default
|
|
1847
|
+
}), [[Intersect, {
|
|
1848
|
+
handler: init,
|
|
1849
|
+
options: props.options
|
|
1850
|
+
}, null, {
|
|
1851
|
+
once: true
|
|
1852
|
+
}]]);
|
|
1853
|
+
});
|
|
1854
|
+
return {
|
|
1855
|
+
currentSrc,
|
|
1856
|
+
image,
|
|
1857
|
+
state,
|
|
1858
|
+
naturalWidth,
|
|
1859
|
+
naturalHeight
|
|
1860
|
+
};
|
|
1861
|
+
}
|
|
1862
|
+
});
|
|
1863
|
+
const makeBorderProps = propsFactory({
|
|
1864
|
+
border: [Boolean, Number, String]
|
|
1865
|
+
}, "border");
|
|
1866
|
+
function useBorder(props) {
|
|
1867
|
+
let name = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : getCurrentInstanceName();
|
|
1868
|
+
const borderClasses = computed(() => {
|
|
1869
|
+
const border = props.border;
|
|
1870
|
+
if (border === true || border === "") {
|
|
1871
|
+
return `${name}--border`;
|
|
1872
|
+
} else if (typeof border === "string" || border === 0) {
|
|
1873
|
+
return String(border).split(" ").map((v) => `border-${v}`);
|
|
1874
|
+
}
|
|
1875
|
+
return [];
|
|
1876
|
+
});
|
|
1877
|
+
return {
|
|
1878
|
+
borderClasses
|
|
1879
|
+
};
|
|
1880
|
+
}
|
|
1881
|
+
const allowedDensities = [null, "default", "comfortable", "compact"];
|
|
1882
|
+
const makeDensityProps = propsFactory({
|
|
1883
|
+
density: {
|
|
1884
|
+
type: String,
|
|
1885
|
+
default: "default",
|
|
1886
|
+
validator: (v) => allowedDensities.includes(v)
|
|
1887
|
+
}
|
|
1888
|
+
}, "density");
|
|
1889
|
+
function useDensity(props) {
|
|
1890
|
+
let name = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : getCurrentInstanceName();
|
|
1891
|
+
const densityClasses = toRef(() => {
|
|
1892
|
+
return `${name}--density-${props.density}`;
|
|
1893
|
+
});
|
|
1894
|
+
return {
|
|
1895
|
+
densityClasses
|
|
1896
|
+
};
|
|
1897
|
+
}
|
|
1898
|
+
const allowedVariants = ["elevated", "flat", "tonal", "outlined", "text", "plain"];
|
|
1899
|
+
function genOverlays(isClickable, name) {
|
|
1900
|
+
return createElementVNode(Fragment, null, [isClickable && createElementVNode("span", {
|
|
1901
|
+
"key": "overlay",
|
|
1902
|
+
"class": normalizeClass(`${name}__overlay`)
|
|
1903
|
+
}, null), createElementVNode("span", {
|
|
1904
|
+
"key": "underlay",
|
|
1905
|
+
"class": normalizeClass(`${name}__underlay`)
|
|
1906
|
+
}, null)]);
|
|
1907
|
+
}
|
|
1908
|
+
const makeVariantProps = propsFactory({
|
|
1909
|
+
color: String,
|
|
1910
|
+
variant: {
|
|
1911
|
+
type: String,
|
|
1912
|
+
default: "elevated",
|
|
1913
|
+
validator: (v) => allowedVariants.includes(v)
|
|
1914
|
+
}
|
|
1915
|
+
}, "variant");
|
|
1916
|
+
function useVariant(props) {
|
|
1917
|
+
let name = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : getCurrentInstanceName();
|
|
1918
|
+
const variantClasses = toRef(() => {
|
|
1919
|
+
const {
|
|
1920
|
+
variant
|
|
1921
|
+
} = toValue(props);
|
|
1922
|
+
return `${name}--variant-${variant}`;
|
|
1923
|
+
});
|
|
1924
|
+
const {
|
|
1925
|
+
colorClasses,
|
|
1926
|
+
colorStyles
|
|
1927
|
+
} = useColor(() => {
|
|
1928
|
+
const {
|
|
1929
|
+
variant,
|
|
1930
|
+
color
|
|
1931
|
+
} = toValue(props);
|
|
1932
|
+
return {
|
|
1933
|
+
[["elevated", "flat"].includes(variant) ? "background" : "text"]: color
|
|
1934
|
+
};
|
|
1935
|
+
});
|
|
1936
|
+
return {
|
|
1937
|
+
colorClasses,
|
|
1938
|
+
colorStyles,
|
|
1939
|
+
variantClasses
|
|
1940
|
+
};
|
|
1941
|
+
}
|
|
1942
|
+
const makeVAvatarProps = propsFactory({
|
|
1943
|
+
start: Boolean,
|
|
1944
|
+
end: Boolean,
|
|
1945
|
+
icon: IconValue,
|
|
1946
|
+
image: String,
|
|
1947
|
+
text: String,
|
|
1948
|
+
...makeBorderProps(),
|
|
1949
|
+
...makeComponentProps(),
|
|
1950
|
+
...makeDensityProps(),
|
|
1951
|
+
...makeRoundedProps(),
|
|
1952
|
+
...makeSizeProps(),
|
|
1953
|
+
...makeTagProps(),
|
|
1954
|
+
...makeThemeProps(),
|
|
1955
|
+
...makeVariantProps({
|
|
1956
|
+
variant: "flat"
|
|
1957
|
+
})
|
|
1958
|
+
}, "VAvatar");
|
|
1959
|
+
const VAvatar = genericComponent()({
|
|
1960
|
+
name: "VAvatar",
|
|
1961
|
+
props: makeVAvatarProps(),
|
|
1962
|
+
setup(props, _ref) {
|
|
1963
|
+
let {
|
|
1964
|
+
slots
|
|
1965
|
+
} = _ref;
|
|
1966
|
+
const {
|
|
1967
|
+
themeClasses
|
|
1968
|
+
} = provideTheme(props);
|
|
1969
|
+
const {
|
|
1970
|
+
borderClasses
|
|
1971
|
+
} = useBorder(props);
|
|
1972
|
+
const {
|
|
1973
|
+
colorClasses,
|
|
1974
|
+
colorStyles,
|
|
1975
|
+
variantClasses
|
|
1976
|
+
} = useVariant(props);
|
|
1977
|
+
const {
|
|
1978
|
+
densityClasses
|
|
1979
|
+
} = useDensity(props);
|
|
1980
|
+
const {
|
|
1981
|
+
roundedClasses
|
|
1982
|
+
} = useRounded(props);
|
|
1983
|
+
const {
|
|
1984
|
+
sizeClasses,
|
|
1985
|
+
sizeStyles
|
|
1986
|
+
} = useSize(props);
|
|
1987
|
+
useRender(() => createVNode(props.tag, {
|
|
1988
|
+
"class": normalizeClass(["v-avatar", {
|
|
1989
|
+
"v-avatar--start": props.start,
|
|
1990
|
+
"v-avatar--end": props.end
|
|
1991
|
+
}, themeClasses.value, borderClasses.value, colorClasses.value, densityClasses.value, roundedClasses.value, sizeClasses.value, variantClasses.value, props.class]),
|
|
1992
|
+
"style": normalizeStyle([colorStyles.value, sizeStyles.value, props.style])
|
|
1993
|
+
}, {
|
|
1994
|
+
default: () => [!slots.default ? props.image ? createVNode(VImg, {
|
|
1995
|
+
"key": "image",
|
|
1996
|
+
"src": props.image,
|
|
1997
|
+
"alt": "",
|
|
1998
|
+
"cover": true
|
|
1999
|
+
}, null) : props.icon ? createVNode(VIcon, {
|
|
2000
|
+
"key": "icon",
|
|
2001
|
+
"icon": props.icon
|
|
2002
|
+
}, null) : props.text : createVNode(VDefaultsProvider, {
|
|
2003
|
+
"key": "content-defaults",
|
|
2004
|
+
"defaults": {
|
|
2005
|
+
VImg: {
|
|
2006
|
+
cover: true,
|
|
2007
|
+
src: props.image
|
|
2008
|
+
},
|
|
2009
|
+
VIcon: {
|
|
2010
|
+
icon: props.icon
|
|
2011
|
+
}
|
|
2012
|
+
}
|
|
2013
|
+
}, {
|
|
2014
|
+
default: () => [slots.default()]
|
|
2015
|
+
}), genOverlays(false, "v-avatar")]
|
|
2016
|
+
}));
|
|
2017
|
+
return {};
|
|
2018
|
+
}
|
|
2019
|
+
});
|
|
2020
|
+
const DisplaySymbol = /* @__PURE__ */ Symbol.for("vuetify:display");
|
|
2021
|
+
const makeDisplayProps = propsFactory({
|
|
2022
|
+
mobile: {
|
|
2023
|
+
type: Boolean,
|
|
2024
|
+
default: false
|
|
2025
|
+
},
|
|
2026
|
+
mobileBreakpoint: [Number, String]
|
|
2027
|
+
}, "display");
|
|
2028
|
+
function useDisplay() {
|
|
2029
|
+
let props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
|
|
2030
|
+
mobile: null
|
|
2031
|
+
};
|
|
2032
|
+
let name = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : getCurrentInstanceName();
|
|
2033
|
+
const display = inject(DisplaySymbol);
|
|
2034
|
+
if (!display) throw new Error("Could not find Vuetify display injection");
|
|
2035
|
+
const mobile = computed(() => {
|
|
2036
|
+
if (props.mobile) {
|
|
2037
|
+
return true;
|
|
2038
|
+
} else if (typeof props.mobileBreakpoint === "number") {
|
|
2039
|
+
return display.width.value < props.mobileBreakpoint;
|
|
2040
|
+
} else if (props.mobileBreakpoint) {
|
|
2041
|
+
return display.width.value < display.thresholds.value[props.mobileBreakpoint];
|
|
2042
|
+
} else if (props.mobile === null) {
|
|
2043
|
+
return display.mobile.value;
|
|
2044
|
+
} else {
|
|
2045
|
+
return false;
|
|
2046
|
+
}
|
|
2047
|
+
});
|
|
2048
|
+
const displayClasses = toRef(() => {
|
|
2049
|
+
if (!name) return {};
|
|
2050
|
+
return {
|
|
2051
|
+
[`${name}--mobile`]: mobile.value
|
|
2052
|
+
};
|
|
2053
|
+
});
|
|
2054
|
+
return {
|
|
2055
|
+
...display,
|
|
2056
|
+
displayClasses,
|
|
2057
|
+
mobile
|
|
2058
|
+
};
|
|
2059
|
+
}
|
|
2060
|
+
const makeElevationProps = propsFactory({
|
|
2061
|
+
elevation: {
|
|
2062
|
+
type: [Number, String],
|
|
2063
|
+
validator(v) {
|
|
2064
|
+
const value = parseInt(v);
|
|
2065
|
+
return !isNaN(value) && value >= 0 && // Material Design has a maximum elevation of 24
|
|
2066
|
+
// https://material.io/design/environment/elevation.html#default-elevations
|
|
2067
|
+
value <= 24;
|
|
2068
|
+
}
|
|
2069
|
+
}
|
|
2070
|
+
}, "elevation");
|
|
2071
|
+
function useElevation(props) {
|
|
2072
|
+
const elevationClasses = toRef(() => {
|
|
2073
|
+
const elevation = isRef(props) ? props.value : props.elevation;
|
|
2074
|
+
if (elevation == null) return [];
|
|
2075
|
+
return [`elevation-${elevation}`];
|
|
2076
|
+
});
|
|
2077
|
+
return {
|
|
2078
|
+
elevationClasses
|
|
2079
|
+
};
|
|
2080
|
+
}
|
|
2081
|
+
const oppositeMap = {
|
|
2082
|
+
center: "center",
|
|
2083
|
+
top: "bottom",
|
|
2084
|
+
bottom: "top",
|
|
2085
|
+
left: "right",
|
|
2086
|
+
right: "left"
|
|
2087
|
+
};
|
|
2088
|
+
const makeLocationProps = propsFactory({
|
|
2089
|
+
location: String
|
|
2090
|
+
}, "location");
|
|
2091
|
+
function useLocation(props) {
|
|
2092
|
+
let opposite = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
2093
|
+
let offset = arguments.length > 2 ? arguments[2] : void 0;
|
|
2094
|
+
const {
|
|
2095
|
+
isRtl
|
|
2096
|
+
} = useRtl();
|
|
2097
|
+
const locationStyles = computed(() => {
|
|
2098
|
+
if (!props.location) return {};
|
|
2099
|
+
const {
|
|
2100
|
+
side,
|
|
2101
|
+
align
|
|
2102
|
+
} = parseAnchor(props.location.split(" ").length > 1 ? props.location : `${props.location} center`, isRtl.value);
|
|
2103
|
+
function getOffset(side2) {
|
|
2104
|
+
return offset ? offset(side2) : 0;
|
|
2105
|
+
}
|
|
2106
|
+
const styles = {};
|
|
2107
|
+
if (side !== "center") {
|
|
2108
|
+
if (opposite) styles[oppositeMap[side]] = `calc(100% - ${getOffset(side)}px)`;
|
|
2109
|
+
else styles[side] = 0;
|
|
2110
|
+
}
|
|
2111
|
+
if (align !== "center") {
|
|
2112
|
+
if (opposite) styles[oppositeMap[align]] = `calc(100% - ${getOffset(align)}px)`;
|
|
2113
|
+
else styles[align] = 0;
|
|
2114
|
+
} else {
|
|
2115
|
+
if (side === "center") styles.top = styles.left = "50%";
|
|
2116
|
+
else {
|
|
2117
|
+
styles[{
|
|
2118
|
+
top: "left",
|
|
2119
|
+
bottom: "left",
|
|
2120
|
+
left: "top",
|
|
2121
|
+
right: "top"
|
|
2122
|
+
}[side]] = "50%";
|
|
2123
|
+
}
|
|
2124
|
+
styles.transform = {
|
|
2125
|
+
top: "translateX(-50%)",
|
|
2126
|
+
bottom: "translateX(-50%)",
|
|
2127
|
+
left: "translateY(-50%)",
|
|
2128
|
+
right: "translateY(-50%)",
|
|
2129
|
+
center: "translate(-50%, -50%)"
|
|
2130
|
+
}[side];
|
|
2131
|
+
}
|
|
2132
|
+
return styles;
|
|
2133
|
+
});
|
|
2134
|
+
return {
|
|
2135
|
+
locationStyles
|
|
2136
|
+
};
|
|
2137
|
+
}
|
|
2138
|
+
const positionValues = ["static", "relative", "fixed", "absolute", "sticky"];
|
|
2139
|
+
const makePositionProps = propsFactory({
|
|
2140
|
+
position: {
|
|
2141
|
+
type: String,
|
|
2142
|
+
validator: (
|
|
2143
|
+
/* istanbul ignore next */
|
|
2144
|
+
(v) => positionValues.includes(v)
|
|
2145
|
+
)
|
|
2146
|
+
}
|
|
2147
|
+
}, "position");
|
|
2148
|
+
function usePosition(props) {
|
|
2149
|
+
let name = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : getCurrentInstanceName();
|
|
2150
|
+
const positionClasses = toRef(() => {
|
|
2151
|
+
return props.position ? `${name}--${props.position}` : void 0;
|
|
2152
|
+
});
|
|
2153
|
+
return {
|
|
2154
|
+
positionClasses
|
|
2155
|
+
};
|
|
2156
|
+
}
|
|
2157
|
+
const makeVBannerProps = propsFactory({
|
|
2158
|
+
avatar: String,
|
|
2159
|
+
bgColor: String,
|
|
2160
|
+
color: String,
|
|
2161
|
+
icon: IconValue,
|
|
2162
|
+
lines: String,
|
|
2163
|
+
stacked: Boolean,
|
|
2164
|
+
sticky: Boolean,
|
|
2165
|
+
text: String,
|
|
2166
|
+
...makeBorderProps(),
|
|
2167
|
+
...makeComponentProps(),
|
|
2168
|
+
...makeDensityProps(),
|
|
2169
|
+
...makeDimensionProps(),
|
|
2170
|
+
...makeDisplayProps({
|
|
2171
|
+
mobile: null
|
|
2172
|
+
}),
|
|
2173
|
+
...makeElevationProps(),
|
|
2174
|
+
...makeLocationProps(),
|
|
2175
|
+
...makePositionProps(),
|
|
2176
|
+
...makeRoundedProps(),
|
|
2177
|
+
...makeTagProps(),
|
|
2178
|
+
...makeThemeProps()
|
|
2179
|
+
}, "VBanner");
|
|
2180
|
+
const VBanner = genericComponent()({
|
|
2181
|
+
name: "VBanner",
|
|
2182
|
+
props: makeVBannerProps(),
|
|
2183
|
+
setup(props, _ref) {
|
|
2184
|
+
let {
|
|
2185
|
+
slots
|
|
2186
|
+
} = _ref;
|
|
2187
|
+
const {
|
|
2188
|
+
backgroundColorClasses,
|
|
2189
|
+
backgroundColorStyles
|
|
2190
|
+
} = useBackgroundColor(() => props.bgColor);
|
|
2191
|
+
const {
|
|
2192
|
+
borderClasses
|
|
2193
|
+
} = useBorder(props);
|
|
2194
|
+
const {
|
|
2195
|
+
densityClasses
|
|
2196
|
+
} = useDensity(props);
|
|
2197
|
+
const {
|
|
2198
|
+
displayClasses,
|
|
2199
|
+
mobile
|
|
2200
|
+
} = useDisplay(props);
|
|
2201
|
+
const {
|
|
2202
|
+
dimensionStyles
|
|
2203
|
+
} = useDimension(props);
|
|
2204
|
+
const {
|
|
2205
|
+
elevationClasses
|
|
2206
|
+
} = useElevation(props);
|
|
2207
|
+
const {
|
|
2208
|
+
locationStyles
|
|
2209
|
+
} = useLocation(props);
|
|
2210
|
+
const {
|
|
2211
|
+
positionClasses
|
|
2212
|
+
} = usePosition(props);
|
|
2213
|
+
const {
|
|
2214
|
+
roundedClasses
|
|
2215
|
+
} = useRounded(props);
|
|
2216
|
+
const {
|
|
2217
|
+
themeClasses
|
|
2218
|
+
} = provideTheme(props);
|
|
2219
|
+
const color = toRef(() => props.color);
|
|
2220
|
+
const density = toRef(() => props.density);
|
|
2221
|
+
provideDefaults({
|
|
2222
|
+
VBannerActions: {
|
|
2223
|
+
color,
|
|
2224
|
+
density
|
|
2225
|
+
}
|
|
2226
|
+
});
|
|
2227
|
+
useRender(() => {
|
|
2228
|
+
const hasText = !!(props.text || slots.text);
|
|
2229
|
+
const hasPrependMedia = !!(props.avatar || props.icon);
|
|
2230
|
+
const hasPrepend = !!(hasPrependMedia || slots.prepend);
|
|
2231
|
+
return createVNode(props.tag, {
|
|
2232
|
+
"class": normalizeClass(["v-banner", {
|
|
2233
|
+
"v-banner--stacked": props.stacked || mobile.value,
|
|
2234
|
+
"v-banner--sticky": props.sticky,
|
|
2235
|
+
[`v-banner--${props.lines}-line`]: !!props.lines
|
|
2236
|
+
}, themeClasses.value, backgroundColorClasses.value, borderClasses.value, densityClasses.value, displayClasses.value, elevationClasses.value, positionClasses.value, roundedClasses.value, props.class]),
|
|
2237
|
+
"style": normalizeStyle([backgroundColorStyles.value, dimensionStyles.value, locationStyles.value, props.style]),
|
|
2238
|
+
"role": "banner"
|
|
2239
|
+
}, {
|
|
2240
|
+
default: () => [hasPrepend && createElementVNode("div", {
|
|
2241
|
+
"key": "prepend",
|
|
2242
|
+
"class": "v-banner__prepend"
|
|
2243
|
+
}, [!slots.prepend ? createVNode(VAvatar, {
|
|
2244
|
+
"key": "prepend-avatar",
|
|
2245
|
+
"color": color.value,
|
|
2246
|
+
"density": density.value,
|
|
2247
|
+
"icon": props.icon,
|
|
2248
|
+
"image": props.avatar
|
|
2249
|
+
}, null) : createVNode(VDefaultsProvider, {
|
|
2250
|
+
"key": "prepend-defaults",
|
|
2251
|
+
"disabled": !hasPrependMedia,
|
|
2252
|
+
"defaults": {
|
|
2253
|
+
VAvatar: {
|
|
2254
|
+
color: color.value,
|
|
2255
|
+
density: density.value,
|
|
2256
|
+
icon: props.icon,
|
|
2257
|
+
image: props.avatar
|
|
2258
|
+
}
|
|
2259
|
+
}
|
|
2260
|
+
}, slots.prepend)]), createElementVNode("div", {
|
|
2261
|
+
"class": "v-banner__content"
|
|
2262
|
+
}, [hasText && createVNode(VBannerText, {
|
|
2263
|
+
"key": "text"
|
|
2264
|
+
}, {
|
|
2265
|
+
default: () => [slots.text?.() ?? props.text]
|
|
2266
|
+
}), slots.default?.()]), slots.actions && createVNode(VBannerActions, {
|
|
2267
|
+
"key": "actions"
|
|
2268
|
+
}, slots.actions)]
|
|
2269
|
+
});
|
|
2270
|
+
});
|
|
2271
|
+
}
|
|
2272
|
+
});
|
|
2273
|
+
const makeVBtnGroupProps = propsFactory({
|
|
2274
|
+
baseColor: String,
|
|
2275
|
+
divided: Boolean,
|
|
2276
|
+
direction: {
|
|
2277
|
+
type: String,
|
|
2278
|
+
default: "horizontal"
|
|
2279
|
+
},
|
|
2280
|
+
...makeBorderProps(),
|
|
2281
|
+
...makeComponentProps(),
|
|
2282
|
+
...makeDensityProps(),
|
|
2283
|
+
...makeElevationProps(),
|
|
2284
|
+
...makeRoundedProps(),
|
|
2285
|
+
...makeTagProps(),
|
|
2286
|
+
...makeThemeProps(),
|
|
2287
|
+
...makeVariantProps()
|
|
2288
|
+
}, "VBtnGroup");
|
|
2289
|
+
const VBtnGroup = genericComponent()({
|
|
2290
|
+
name: "VBtnGroup",
|
|
2291
|
+
props: makeVBtnGroupProps(),
|
|
2292
|
+
setup(props, _ref) {
|
|
2293
|
+
let {
|
|
2294
|
+
slots
|
|
2295
|
+
} = _ref;
|
|
2296
|
+
const {
|
|
2297
|
+
themeClasses
|
|
2298
|
+
} = provideTheme(props);
|
|
2299
|
+
const {
|
|
2300
|
+
densityClasses
|
|
2301
|
+
} = useDensity(props);
|
|
2302
|
+
const {
|
|
2303
|
+
borderClasses
|
|
2304
|
+
} = useBorder(props);
|
|
2305
|
+
const {
|
|
2306
|
+
elevationClasses
|
|
2307
|
+
} = useElevation(props);
|
|
2308
|
+
const {
|
|
2309
|
+
roundedClasses
|
|
2310
|
+
} = useRounded(props);
|
|
2311
|
+
provideDefaults({
|
|
2312
|
+
VBtn: {
|
|
2313
|
+
height: toRef(() => props.direction === "horizontal" ? "auto" : null),
|
|
2314
|
+
baseColor: toRef(() => props.baseColor),
|
|
2315
|
+
color: toRef(() => props.color),
|
|
2316
|
+
density: toRef(() => props.density),
|
|
2317
|
+
flat: true,
|
|
2318
|
+
variant: toRef(() => props.variant)
|
|
2319
|
+
}
|
|
2320
|
+
});
|
|
2321
|
+
useRender(() => {
|
|
2322
|
+
return createVNode(props.tag, {
|
|
2323
|
+
"class": normalizeClass(["v-btn-group", `v-btn-group--${props.direction}`, {
|
|
2324
|
+
"v-btn-group--divided": props.divided
|
|
2325
|
+
}, themeClasses.value, borderClasses.value, densityClasses.value, elevationClasses.value, roundedClasses.value, props.class]),
|
|
2326
|
+
"style": normalizeStyle(props.style)
|
|
2327
|
+
}, slots);
|
|
2328
|
+
});
|
|
2329
|
+
}
|
|
2330
|
+
});
|
|
2331
|
+
const makeGroupProps = propsFactory({
|
|
2332
|
+
modelValue: {
|
|
2333
|
+
type: null,
|
|
2334
|
+
default: void 0
|
|
2335
|
+
},
|
|
2336
|
+
multiple: Boolean,
|
|
2337
|
+
mandatory: [Boolean, String],
|
|
2338
|
+
max: Number,
|
|
2339
|
+
selectedClass: String,
|
|
2340
|
+
disabled: Boolean
|
|
2341
|
+
}, "group");
|
|
2342
|
+
const makeGroupItemProps = propsFactory({
|
|
2343
|
+
value: null,
|
|
2344
|
+
disabled: Boolean,
|
|
2345
|
+
selectedClass: String
|
|
2346
|
+
}, "group-item");
|
|
2347
|
+
function useGroupItem(props, injectKey) {
|
|
2348
|
+
let required = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true;
|
|
2349
|
+
const vm = getCurrentInstance("useGroupItem");
|
|
2350
|
+
if (!vm) {
|
|
2351
|
+
throw new Error("[Vuetify] useGroupItem composable must be used inside a component setup function");
|
|
2352
|
+
}
|
|
2353
|
+
const id = useId();
|
|
2354
|
+
provide(/* @__PURE__ */ Symbol.for(`${injectKey.description}:id`), id);
|
|
2355
|
+
const group = inject(injectKey, null);
|
|
2356
|
+
if (!group) {
|
|
2357
|
+
if (!required) return group;
|
|
2358
|
+
throw new Error(`[Vuetify] Could not find useGroup injection with symbol ${injectKey.description}`);
|
|
2359
|
+
}
|
|
2360
|
+
const value = toRef(() => props.value);
|
|
2361
|
+
const disabled = computed(() => !!(group.disabled.value || props.disabled));
|
|
2362
|
+
function register() {
|
|
2363
|
+
group?.register({
|
|
2364
|
+
id,
|
|
2365
|
+
value,
|
|
2366
|
+
disabled
|
|
2367
|
+
}, vm);
|
|
2368
|
+
}
|
|
2369
|
+
function unregister() {
|
|
2370
|
+
group?.unregister(id);
|
|
2371
|
+
}
|
|
2372
|
+
register();
|
|
2373
|
+
onBeforeUnmount(() => unregister());
|
|
2374
|
+
const isSelected = computed(() => {
|
|
2375
|
+
return group.isSelected(id);
|
|
2376
|
+
});
|
|
2377
|
+
const isFirst = computed(() => {
|
|
2378
|
+
return group.items.value[0].id === id;
|
|
2379
|
+
});
|
|
2380
|
+
const isLast = computed(() => {
|
|
2381
|
+
return group.items.value[group.items.value.length - 1].id === id;
|
|
2382
|
+
});
|
|
2383
|
+
const selectedClass = computed(() => isSelected.value && [group.selectedClass.value, props.selectedClass]);
|
|
2384
|
+
watch(isSelected, (value2) => {
|
|
2385
|
+
vm.emit("group:selected", {
|
|
2386
|
+
value: value2
|
|
2387
|
+
});
|
|
2388
|
+
}, {
|
|
2389
|
+
flush: "sync"
|
|
2390
|
+
});
|
|
2391
|
+
return {
|
|
2392
|
+
id,
|
|
2393
|
+
isSelected,
|
|
2394
|
+
isFirst,
|
|
2395
|
+
isLast,
|
|
2396
|
+
toggle: () => group.select(id, !isSelected.value),
|
|
2397
|
+
select: (value2) => group.select(id, value2),
|
|
2398
|
+
selectedClass,
|
|
2399
|
+
value,
|
|
2400
|
+
disabled,
|
|
2401
|
+
group,
|
|
2402
|
+
register,
|
|
2403
|
+
unregister
|
|
2404
|
+
};
|
|
2405
|
+
}
|
|
2406
|
+
function useGroup(props, injectKey) {
|
|
2407
|
+
let isUnmounted = false;
|
|
2408
|
+
const items = reactive([]);
|
|
2409
|
+
const selected = useProxiedModel(props, "modelValue", [], (v) => {
|
|
2410
|
+
if (v === void 0) return [];
|
|
2411
|
+
return getIds(items, v === null ? [null] : wrapInArray(v));
|
|
2412
|
+
}, (v) => {
|
|
2413
|
+
const arr = getValues(items, v);
|
|
2414
|
+
return props.multiple ? arr : arr[0];
|
|
2415
|
+
});
|
|
2416
|
+
const groupVm = getCurrentInstance("useGroup");
|
|
2417
|
+
function register(item, vm) {
|
|
2418
|
+
const unwrapped = item;
|
|
2419
|
+
const key = /* @__PURE__ */ Symbol.for(`${injectKey.description}:id`);
|
|
2420
|
+
const children = findChildrenWithProvide(key, groupVm?.vnode);
|
|
2421
|
+
const index = children.indexOf(vm);
|
|
2422
|
+
if (unref(unwrapped.value) === void 0) {
|
|
2423
|
+
unwrapped.value = index;
|
|
2424
|
+
unwrapped.useIndexAsValue = true;
|
|
2425
|
+
}
|
|
2426
|
+
if (index > -1) {
|
|
2427
|
+
items.splice(index, 0, unwrapped);
|
|
2428
|
+
} else {
|
|
2429
|
+
items.push(unwrapped);
|
|
2430
|
+
}
|
|
2431
|
+
}
|
|
2432
|
+
function unregister(id) {
|
|
2433
|
+
if (isUnmounted) return;
|
|
2434
|
+
forceMandatoryValue();
|
|
2435
|
+
const index = items.findIndex((item) => item.id === id);
|
|
2436
|
+
items.splice(index, 1);
|
|
2437
|
+
}
|
|
2438
|
+
function forceMandatoryValue() {
|
|
2439
|
+
const item = items.find((item2) => !item2.disabled);
|
|
2440
|
+
if (item && props.mandatory === "force" && !selected.value.length) {
|
|
2441
|
+
selected.value = [item.id];
|
|
2442
|
+
}
|
|
2443
|
+
}
|
|
2444
|
+
onMounted(() => {
|
|
2445
|
+
forceMandatoryValue();
|
|
2446
|
+
});
|
|
2447
|
+
onBeforeUnmount(() => {
|
|
2448
|
+
isUnmounted = true;
|
|
2449
|
+
});
|
|
2450
|
+
onUpdated(() => {
|
|
2451
|
+
for (let i = 0; i < items.length; i++) {
|
|
2452
|
+
if (items[i].useIndexAsValue) {
|
|
2453
|
+
items[i].value = i;
|
|
2454
|
+
}
|
|
2455
|
+
}
|
|
2456
|
+
});
|
|
2457
|
+
function select(id, value) {
|
|
2458
|
+
const item = items.find((item2) => item2.id === id);
|
|
2459
|
+
if (value && item?.disabled) return;
|
|
2460
|
+
if (props.multiple) {
|
|
2461
|
+
const internalValue = selected.value.slice();
|
|
2462
|
+
const index = internalValue.findIndex((v) => v === id);
|
|
2463
|
+
const isSelected = ~index;
|
|
2464
|
+
value = value ?? !isSelected;
|
|
2465
|
+
if (isSelected && props.mandatory && internalValue.length <= 1) return;
|
|
2466
|
+
if (!isSelected && props.max != null && internalValue.length + 1 > props.max) return;
|
|
2467
|
+
if (index < 0 && value) internalValue.push(id);
|
|
2468
|
+
else if (index >= 0 && !value) internalValue.splice(index, 1);
|
|
2469
|
+
selected.value = internalValue;
|
|
2470
|
+
} else {
|
|
2471
|
+
const isSelected = selected.value.includes(id);
|
|
2472
|
+
if (props.mandatory && isSelected) return;
|
|
2473
|
+
if (!isSelected && !value) return;
|
|
2474
|
+
selected.value = value ?? !isSelected ? [id] : [];
|
|
2475
|
+
}
|
|
2476
|
+
}
|
|
2477
|
+
function step(offset) {
|
|
2478
|
+
if (props.multiple) consoleWarn('This method is not supported when using "multiple" prop');
|
|
2479
|
+
if (!selected.value.length) {
|
|
2480
|
+
const item = items.find((item2) => !item2.disabled);
|
|
2481
|
+
item && (selected.value = [item.id]);
|
|
2482
|
+
} else {
|
|
2483
|
+
const currentId = selected.value[0];
|
|
2484
|
+
const currentIndex = items.findIndex((i) => i.id === currentId);
|
|
2485
|
+
let newIndex = (currentIndex + offset) % items.length;
|
|
2486
|
+
let newItem = items[newIndex];
|
|
2487
|
+
while (newItem.disabled && newIndex !== currentIndex) {
|
|
2488
|
+
newIndex = (newIndex + offset) % items.length;
|
|
2489
|
+
newItem = items[newIndex];
|
|
2490
|
+
}
|
|
2491
|
+
if (newItem.disabled) return;
|
|
2492
|
+
selected.value = [items[newIndex].id];
|
|
2493
|
+
}
|
|
2494
|
+
}
|
|
2495
|
+
const state = {
|
|
2496
|
+
register,
|
|
2497
|
+
unregister,
|
|
2498
|
+
selected,
|
|
2499
|
+
select,
|
|
2500
|
+
disabled: toRef(() => props.disabled),
|
|
2501
|
+
prev: () => step(items.length - 1),
|
|
2502
|
+
next: () => step(1),
|
|
2503
|
+
isSelected: (id) => selected.value.includes(id),
|
|
2504
|
+
selectedClass: toRef(() => props.selectedClass),
|
|
2505
|
+
items: toRef(() => items),
|
|
2506
|
+
getItemIndex: (value) => getItemIndex(items, value)
|
|
2507
|
+
};
|
|
2508
|
+
provide(injectKey, state);
|
|
2509
|
+
return state;
|
|
2510
|
+
}
|
|
2511
|
+
function getItemIndex(items, value) {
|
|
2512
|
+
const ids = getIds(items, [value]);
|
|
2513
|
+
if (!ids.length) return -1;
|
|
2514
|
+
return items.findIndex((item) => item.id === ids[0]);
|
|
2515
|
+
}
|
|
2516
|
+
function getIds(items, modelValue) {
|
|
2517
|
+
const ids = [];
|
|
2518
|
+
modelValue.forEach((value) => {
|
|
2519
|
+
const item = items.find((item2) => deepEqual(value, item2.value));
|
|
2520
|
+
const itemByIndex = items[value];
|
|
2521
|
+
if (item?.value !== void 0) {
|
|
2522
|
+
ids.push(item.id);
|
|
2523
|
+
} else if (itemByIndex?.useIndexAsValue) {
|
|
2524
|
+
ids.push(itemByIndex.id);
|
|
2525
|
+
}
|
|
2526
|
+
});
|
|
2527
|
+
return ids;
|
|
2528
|
+
}
|
|
2529
|
+
function getValues(items, ids) {
|
|
2530
|
+
const values = [];
|
|
2531
|
+
ids.forEach((id) => {
|
|
2532
|
+
const itemIndex = items.findIndex((item) => item.id === id);
|
|
2533
|
+
if (~itemIndex) {
|
|
2534
|
+
const item = items[itemIndex];
|
|
2535
|
+
values.push(item.value !== void 0 ? item.value : itemIndex);
|
|
2536
|
+
}
|
|
2537
|
+
});
|
|
2538
|
+
return values;
|
|
2539
|
+
}
|
|
2540
|
+
const VBtnToggleSymbol = /* @__PURE__ */ Symbol.for("vuetify:v-btn-toggle");
|
|
2541
|
+
const makeVBtnToggleProps = propsFactory({
|
|
2542
|
+
...makeVBtnGroupProps(),
|
|
2543
|
+
...makeGroupProps()
|
|
2544
|
+
}, "VBtnToggle");
|
|
2545
|
+
genericComponent()({
|
|
2546
|
+
name: "VBtnToggle",
|
|
2547
|
+
props: makeVBtnToggleProps(),
|
|
2548
|
+
emits: {
|
|
2549
|
+
"update:modelValue": (value) => true
|
|
2550
|
+
},
|
|
2551
|
+
setup(props, _ref) {
|
|
2552
|
+
let {
|
|
2553
|
+
slots
|
|
2554
|
+
} = _ref;
|
|
2555
|
+
const {
|
|
2556
|
+
isSelected,
|
|
2557
|
+
next,
|
|
2558
|
+
prev,
|
|
2559
|
+
select,
|
|
2560
|
+
selected
|
|
2561
|
+
} = useGroup(props, VBtnToggleSymbol);
|
|
2562
|
+
useRender(() => {
|
|
2563
|
+
const btnGroupProps = VBtnGroup.filterProps(props);
|
|
2564
|
+
return createVNode(VBtnGroup, mergeProps({
|
|
2565
|
+
"class": ["v-btn-toggle", props.class]
|
|
2566
|
+
}, btnGroupProps, {
|
|
2567
|
+
"style": props.style
|
|
2568
|
+
}), {
|
|
2569
|
+
default: () => [slots.default?.({
|
|
2570
|
+
isSelected,
|
|
2571
|
+
next,
|
|
2572
|
+
prev,
|
|
2573
|
+
select,
|
|
2574
|
+
selected
|
|
2575
|
+
})]
|
|
2576
|
+
});
|
|
2577
|
+
});
|
|
2578
|
+
return {
|
|
2579
|
+
next,
|
|
2580
|
+
prev,
|
|
2581
|
+
select
|
|
2582
|
+
};
|
|
2583
|
+
}
|
|
2584
|
+
});
|
|
2585
|
+
function useIntersectionObserver(callback, options) {
|
|
2586
|
+
const intersectionRef = ref();
|
|
2587
|
+
const isIntersecting = shallowRef(false);
|
|
2588
|
+
if (SUPPORTS_INTERSECTION) {
|
|
2589
|
+
const observer = new IntersectionObserver((entries) => {
|
|
2590
|
+
isIntersecting.value = !!entries.find((entry) => entry.isIntersecting);
|
|
2591
|
+
}, options);
|
|
2592
|
+
onScopeDispose(() => {
|
|
2593
|
+
observer.disconnect();
|
|
2594
|
+
});
|
|
2595
|
+
watch(intersectionRef, (newValue, oldValue) => {
|
|
2596
|
+
if (oldValue) {
|
|
2597
|
+
observer.unobserve(oldValue);
|
|
2598
|
+
isIntersecting.value = false;
|
|
2599
|
+
}
|
|
2600
|
+
if (newValue) observer.observe(newValue);
|
|
2601
|
+
}, {
|
|
2602
|
+
flush: "post"
|
|
2603
|
+
});
|
|
2604
|
+
}
|
|
2605
|
+
return {
|
|
2606
|
+
intersectionRef,
|
|
2607
|
+
isIntersecting
|
|
2608
|
+
};
|
|
2609
|
+
}
|
|
2610
|
+
const makeVProgressCircularProps = propsFactory({
|
|
2611
|
+
bgColor: String,
|
|
2612
|
+
color: String,
|
|
2613
|
+
indeterminate: [Boolean, String],
|
|
2614
|
+
rounded: Boolean,
|
|
2615
|
+
modelValue: {
|
|
2616
|
+
type: [Number, String],
|
|
2617
|
+
default: 0
|
|
2618
|
+
},
|
|
2619
|
+
rotate: {
|
|
2620
|
+
type: [Number, String],
|
|
2621
|
+
default: 0
|
|
2622
|
+
},
|
|
2623
|
+
width: {
|
|
2624
|
+
type: [Number, String],
|
|
2625
|
+
default: 4
|
|
2626
|
+
},
|
|
2627
|
+
...makeComponentProps(),
|
|
2628
|
+
...makeSizeProps(),
|
|
2629
|
+
...makeTagProps({
|
|
2630
|
+
tag: "div"
|
|
2631
|
+
}),
|
|
2632
|
+
...makeThemeProps()
|
|
2633
|
+
}, "VProgressCircular");
|
|
2634
|
+
const VProgressCircular = genericComponent()({
|
|
2635
|
+
name: "VProgressCircular",
|
|
2636
|
+
props: makeVProgressCircularProps(),
|
|
2637
|
+
setup(props, _ref) {
|
|
2638
|
+
let {
|
|
2639
|
+
slots
|
|
2640
|
+
} = _ref;
|
|
2641
|
+
const MAGIC_RADIUS_CONSTANT = 20;
|
|
2642
|
+
const CIRCUMFERENCE = 2 * Math.PI * MAGIC_RADIUS_CONSTANT;
|
|
2643
|
+
const root = ref();
|
|
2644
|
+
const {
|
|
2645
|
+
themeClasses
|
|
2646
|
+
} = provideTheme(props);
|
|
2647
|
+
const {
|
|
2648
|
+
sizeClasses,
|
|
2649
|
+
sizeStyles
|
|
2650
|
+
} = useSize(props);
|
|
2651
|
+
const {
|
|
2652
|
+
textColorClasses,
|
|
2653
|
+
textColorStyles
|
|
2654
|
+
} = useTextColor(() => props.color);
|
|
2655
|
+
const {
|
|
2656
|
+
textColorClasses: underlayColorClasses,
|
|
2657
|
+
textColorStyles: underlayColorStyles
|
|
2658
|
+
} = useTextColor(() => props.bgColor);
|
|
2659
|
+
const {
|
|
2660
|
+
intersectionRef,
|
|
2661
|
+
isIntersecting
|
|
2662
|
+
} = useIntersectionObserver();
|
|
2663
|
+
const {
|
|
2664
|
+
resizeRef,
|
|
2665
|
+
contentRect
|
|
2666
|
+
} = useResizeObserver();
|
|
2667
|
+
const normalizedValue = toRef(() => clamp(parseFloat(props.modelValue), 0, 100));
|
|
2668
|
+
const width = toRef(() => Number(props.width));
|
|
2669
|
+
const size = toRef(() => {
|
|
2670
|
+
return sizeStyles.value ? Number(props.size) : contentRect.value ? contentRect.value.width : Math.max(width.value, 32);
|
|
2671
|
+
});
|
|
2672
|
+
const diameter = toRef(() => MAGIC_RADIUS_CONSTANT / (1 - width.value / size.value) * 2);
|
|
2673
|
+
const strokeWidth = toRef(() => width.value / size.value * diameter.value);
|
|
2674
|
+
const strokeDashOffset = toRef(() => {
|
|
2675
|
+
const baseLength = (100 - normalizedValue.value) / 100 * CIRCUMFERENCE;
|
|
2676
|
+
return props.rounded && normalizedValue.value > 0 && normalizedValue.value < 100 ? convertToUnit(Math.min(CIRCUMFERENCE - 0.01, baseLength + strokeWidth.value)) : convertToUnit(baseLength);
|
|
2677
|
+
});
|
|
2678
|
+
const startAngle = computed(() => {
|
|
2679
|
+
const baseAngle = Number(props.rotate);
|
|
2680
|
+
return props.rounded ? baseAngle + strokeWidth.value / 2 / CIRCUMFERENCE * 360 : baseAngle;
|
|
2681
|
+
});
|
|
2682
|
+
watchEffect(() => {
|
|
2683
|
+
intersectionRef.value = root.value;
|
|
2684
|
+
resizeRef.value = root.value;
|
|
2685
|
+
});
|
|
2686
|
+
useRender(() => createVNode(props.tag, {
|
|
2687
|
+
"ref": root,
|
|
2688
|
+
"class": normalizeClass(["v-progress-circular", {
|
|
2689
|
+
"v-progress-circular--indeterminate": !!props.indeterminate,
|
|
2690
|
+
"v-progress-circular--visible": isIntersecting.value,
|
|
2691
|
+
"v-progress-circular--disable-shrink": props.indeterminate && (props.indeterminate === "disable-shrink" || PREFERS_REDUCED_MOTION())
|
|
2692
|
+
}, themeClasses.value, sizeClasses.value, textColorClasses.value, props.class]),
|
|
2693
|
+
"style": normalizeStyle([sizeStyles.value, textColorStyles.value, props.style]),
|
|
2694
|
+
"role": "progressbar",
|
|
2695
|
+
"aria-valuemin": "0",
|
|
2696
|
+
"aria-valuemax": "100",
|
|
2697
|
+
"aria-valuenow": props.indeterminate ? void 0 : normalizedValue.value
|
|
2698
|
+
}, {
|
|
2699
|
+
default: () => [createElementVNode("svg", {
|
|
2700
|
+
"style": {
|
|
2701
|
+
transform: `rotate(calc(-90deg + ${startAngle.value}deg))`
|
|
2702
|
+
},
|
|
2703
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
2704
|
+
"viewBox": `0 0 ${diameter.value} ${diameter.value}`
|
|
2705
|
+
}, [createElementVNode("circle", {
|
|
2706
|
+
"class": normalizeClass(["v-progress-circular__underlay", underlayColorClasses.value]),
|
|
2707
|
+
"style": normalizeStyle(underlayColorStyles.value),
|
|
2708
|
+
"fill": "transparent",
|
|
2709
|
+
"cx": "50%",
|
|
2710
|
+
"cy": "50%",
|
|
2711
|
+
"r": MAGIC_RADIUS_CONSTANT,
|
|
2712
|
+
"stroke-width": strokeWidth.value,
|
|
2713
|
+
"stroke-dasharray": CIRCUMFERENCE,
|
|
2714
|
+
"stroke-dashoffset": 0
|
|
2715
|
+
}, null), createElementVNode("circle", {
|
|
2716
|
+
"class": "v-progress-circular__overlay",
|
|
2717
|
+
"fill": "transparent",
|
|
2718
|
+
"cx": "50%",
|
|
2719
|
+
"cy": "50%",
|
|
2720
|
+
"r": MAGIC_RADIUS_CONSTANT,
|
|
2721
|
+
"stroke-width": strokeWidth.value,
|
|
2722
|
+
"stroke-dasharray": CIRCUMFERENCE,
|
|
2723
|
+
"stroke-dashoffset": strokeDashOffset.value,
|
|
2724
|
+
"stroke-linecap": props.rounded ? "round" : void 0
|
|
2725
|
+
}, null)]), slots.default && createElementVNode("div", {
|
|
2726
|
+
"class": "v-progress-circular__content"
|
|
2727
|
+
}, [slots.default({
|
|
2728
|
+
value: normalizedValue.value
|
|
2729
|
+
})])]
|
|
2730
|
+
}));
|
|
2731
|
+
return {};
|
|
2732
|
+
}
|
|
2733
|
+
});
|
|
2734
|
+
const makeLoaderProps = propsFactory({
|
|
2735
|
+
loading: [Boolean, String]
|
|
2736
|
+
}, "loader");
|
|
2737
|
+
function useLoader(props) {
|
|
2738
|
+
let name = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : getCurrentInstanceName();
|
|
2739
|
+
const loaderClasses = toRef(() => ({
|
|
2740
|
+
[`${name}--loading`]: props.loading
|
|
2741
|
+
}));
|
|
2742
|
+
return {
|
|
2743
|
+
loaderClasses
|
|
2744
|
+
};
|
|
2745
|
+
}
|
|
2746
|
+
function useRoute() {
|
|
2747
|
+
const vm = getCurrentInstance("useRoute");
|
|
2748
|
+
return computed(() => vm?.proxy?.$route);
|
|
2749
|
+
}
|
|
2750
|
+
function useLink(props, attrs) {
|
|
2751
|
+
const RouterLink = resolveDynamicComponent("RouterLink");
|
|
2752
|
+
const isLink = toRef(() => !!(props.href || props.to));
|
|
2753
|
+
const isClickable = computed(() => {
|
|
2754
|
+
return isLink?.value || hasEvent(attrs, "click") || hasEvent(props, "click");
|
|
2755
|
+
});
|
|
2756
|
+
if (typeof RouterLink === "string" || !("useLink" in RouterLink)) {
|
|
2757
|
+
const href2 = toRef(() => props.href);
|
|
2758
|
+
return {
|
|
2759
|
+
isLink,
|
|
2760
|
+
isRouterLink: toRef(() => false),
|
|
2761
|
+
isClickable,
|
|
2762
|
+
href: href2,
|
|
2763
|
+
linkProps: reactive({
|
|
2764
|
+
href: href2
|
|
2765
|
+
})
|
|
2766
|
+
};
|
|
2767
|
+
}
|
|
2768
|
+
const routerLink = RouterLink.useLink({
|
|
2769
|
+
to: toRef(() => props.to || ""),
|
|
2770
|
+
replace: toRef(() => props.replace)
|
|
2771
|
+
});
|
|
2772
|
+
const link = computed(() => props.to ? routerLink : void 0);
|
|
2773
|
+
const route = useRoute();
|
|
2774
|
+
const isActive = computed(() => {
|
|
2775
|
+
if (!link.value) return false;
|
|
2776
|
+
if (!props.exact) return link.value.isActive?.value ?? false;
|
|
2777
|
+
if (!route.value) return link.value.isExactActive?.value ?? false;
|
|
2778
|
+
return link.value.isExactActive?.value && deepEqual(link.value.route.value.query, route.value.query);
|
|
2779
|
+
});
|
|
2780
|
+
const href = computed(() => props.to ? link.value?.route.value.href : props.href);
|
|
2781
|
+
const isRouterLink = toRef(() => !!props.to);
|
|
2782
|
+
return {
|
|
2783
|
+
isLink,
|
|
2784
|
+
isRouterLink,
|
|
2785
|
+
isClickable,
|
|
2786
|
+
isActive,
|
|
2787
|
+
route: link.value?.route,
|
|
2788
|
+
navigate: link.value?.navigate,
|
|
2789
|
+
href,
|
|
2790
|
+
linkProps: reactive({
|
|
2791
|
+
href,
|
|
2792
|
+
"aria-current": toRef(() => isActive.value ? "page" : void 0),
|
|
2793
|
+
"aria-disabled": toRef(() => props.disabled && isLink.value ? "true" : void 0),
|
|
2794
|
+
tabindex: toRef(() => props.disabled && isLink.value ? "-1" : void 0)
|
|
2795
|
+
})
|
|
2796
|
+
};
|
|
2797
|
+
}
|
|
2798
|
+
const makeRouterProps = propsFactory({
|
|
2799
|
+
href: String,
|
|
2800
|
+
replace: Boolean,
|
|
2801
|
+
to: [String, Object],
|
|
2802
|
+
exact: Boolean
|
|
2803
|
+
}, "router");
|
|
2804
|
+
function useSelectLink(link, select) {
|
|
2805
|
+
watch(() => link.isActive?.value, (isActive) => {
|
|
2806
|
+
if (link.isLink.value && isActive != null && select) {
|
|
2807
|
+
nextTick(() => {
|
|
2808
|
+
select(isActive);
|
|
2809
|
+
});
|
|
2810
|
+
}
|
|
2811
|
+
}, {
|
|
2812
|
+
immediate: true
|
|
2813
|
+
});
|
|
2814
|
+
}
|
|
2815
|
+
const stopSymbol = /* @__PURE__ */ Symbol("rippleStop");
|
|
2816
|
+
const DELAY_RIPPLE = 80;
|
|
2817
|
+
function transform(el, value) {
|
|
2818
|
+
el.style.transform = value;
|
|
2819
|
+
el.style.webkitTransform = value;
|
|
2820
|
+
}
|
|
2821
|
+
function isTouchEvent(e) {
|
|
2822
|
+
return e.constructor.name === "TouchEvent";
|
|
2823
|
+
}
|
|
2824
|
+
function isKeyboardEvent(e) {
|
|
2825
|
+
return e.constructor.name === "KeyboardEvent";
|
|
2826
|
+
}
|
|
2827
|
+
const calculate = function(e, el) {
|
|
2828
|
+
let value = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
2829
|
+
let localX = 0;
|
|
2830
|
+
let localY = 0;
|
|
2831
|
+
if (!isKeyboardEvent(e)) {
|
|
2832
|
+
const offset = el.getBoundingClientRect();
|
|
2833
|
+
const target = isTouchEvent(e) ? e.touches[e.touches.length - 1] : e;
|
|
2834
|
+
localX = target.clientX - offset.left;
|
|
2835
|
+
localY = target.clientY - offset.top;
|
|
2836
|
+
}
|
|
2837
|
+
let radius = 0;
|
|
2838
|
+
let scale = 0.3;
|
|
2839
|
+
if (el._ripple?.circle) {
|
|
2840
|
+
scale = 0.15;
|
|
2841
|
+
radius = el.clientWidth / 2;
|
|
2842
|
+
radius = value.center ? radius : radius + Math.sqrt((localX - radius) ** 2 + (localY - radius) ** 2) / 4;
|
|
2843
|
+
} else {
|
|
2844
|
+
radius = Math.sqrt(el.clientWidth ** 2 + el.clientHeight ** 2) / 2;
|
|
2845
|
+
}
|
|
2846
|
+
const centerX = `${(el.clientWidth - radius * 2) / 2}px`;
|
|
2847
|
+
const centerY = `${(el.clientHeight - radius * 2) / 2}px`;
|
|
2848
|
+
const x = value.center ? centerX : `${localX - radius}px`;
|
|
2849
|
+
const y = value.center ? centerY : `${localY - radius}px`;
|
|
2850
|
+
return {
|
|
2851
|
+
radius,
|
|
2852
|
+
scale,
|
|
2853
|
+
x,
|
|
2854
|
+
y,
|
|
2855
|
+
centerX,
|
|
2856
|
+
centerY
|
|
2857
|
+
};
|
|
2858
|
+
};
|
|
2859
|
+
const ripples = {
|
|
2860
|
+
/* eslint-disable max-statements */
|
|
2861
|
+
show(e, el) {
|
|
2862
|
+
let value = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
2863
|
+
if (!el?._ripple?.enabled) {
|
|
2864
|
+
return;
|
|
2865
|
+
}
|
|
2866
|
+
const container = document.createElement("span");
|
|
2867
|
+
const animation = document.createElement("span");
|
|
2868
|
+
container.appendChild(animation);
|
|
2869
|
+
container.className = "v-ripple__container";
|
|
2870
|
+
if (value.class) {
|
|
2871
|
+
container.className += ` ${value.class}`;
|
|
2872
|
+
}
|
|
2873
|
+
const {
|
|
2874
|
+
radius,
|
|
2875
|
+
scale,
|
|
2876
|
+
x,
|
|
2877
|
+
y,
|
|
2878
|
+
centerX,
|
|
2879
|
+
centerY
|
|
2880
|
+
} = calculate(e, el, value);
|
|
2881
|
+
const size = `${radius * 2}px`;
|
|
2882
|
+
animation.className = "v-ripple__animation";
|
|
2883
|
+
animation.style.width = size;
|
|
2884
|
+
animation.style.height = size;
|
|
2885
|
+
el.appendChild(container);
|
|
2886
|
+
const computed2 = window.getComputedStyle(el);
|
|
2887
|
+
if (computed2 && computed2.position === "static") {
|
|
2888
|
+
el.style.position = "relative";
|
|
2889
|
+
el.dataset.previousPosition = "static";
|
|
2890
|
+
}
|
|
2891
|
+
animation.classList.add("v-ripple__animation--enter");
|
|
2892
|
+
animation.classList.add("v-ripple__animation--visible");
|
|
2893
|
+
transform(animation, `translate(${x}, ${y}) scale3d(${scale},${scale},${scale})`);
|
|
2894
|
+
animation.dataset.activated = String(performance.now());
|
|
2895
|
+
requestAnimationFrame(() => {
|
|
2896
|
+
requestAnimationFrame(() => {
|
|
2897
|
+
animation.classList.remove("v-ripple__animation--enter");
|
|
2898
|
+
animation.classList.add("v-ripple__animation--in");
|
|
2899
|
+
transform(animation, `translate(${centerX}, ${centerY}) scale3d(1,1,1)`);
|
|
2900
|
+
});
|
|
2901
|
+
});
|
|
2902
|
+
},
|
|
2903
|
+
hide(el) {
|
|
2904
|
+
if (!el?._ripple?.enabled) return;
|
|
2905
|
+
const ripples2 = el.getElementsByClassName("v-ripple__animation");
|
|
2906
|
+
if (ripples2.length === 0) return;
|
|
2907
|
+
const animation = Array.from(ripples2).findLast((ripple) => !ripple.dataset.isHiding);
|
|
2908
|
+
if (!animation) return;
|
|
2909
|
+
else animation.dataset.isHiding = "true";
|
|
2910
|
+
const diff = performance.now() - Number(animation.dataset.activated);
|
|
2911
|
+
const delay = Math.max(250 - diff, 0);
|
|
2912
|
+
setTimeout(() => {
|
|
2913
|
+
animation.classList.remove("v-ripple__animation--in");
|
|
2914
|
+
animation.classList.add("v-ripple__animation--out");
|
|
2915
|
+
setTimeout(() => {
|
|
2916
|
+
const ripples3 = el.getElementsByClassName("v-ripple__animation");
|
|
2917
|
+
if (ripples3.length === 1 && el.dataset.previousPosition) {
|
|
2918
|
+
el.style.position = el.dataset.previousPosition;
|
|
2919
|
+
delete el.dataset.previousPosition;
|
|
2920
|
+
}
|
|
2921
|
+
if (animation.parentNode?.parentNode === el) el.removeChild(animation.parentNode);
|
|
2922
|
+
}, 300);
|
|
2923
|
+
}, delay);
|
|
2924
|
+
}
|
|
2925
|
+
};
|
|
2926
|
+
function isRippleEnabled(value) {
|
|
2927
|
+
return typeof value === "undefined" || !!value;
|
|
2928
|
+
}
|
|
2929
|
+
function rippleShow(e) {
|
|
2930
|
+
const value = {};
|
|
2931
|
+
const element = e.currentTarget;
|
|
2932
|
+
if (!element?._ripple || element._ripple.touched || e[stopSymbol]) return;
|
|
2933
|
+
e[stopSymbol] = true;
|
|
2934
|
+
if (isTouchEvent(e)) {
|
|
2935
|
+
element._ripple.touched = true;
|
|
2936
|
+
element._ripple.isTouch = true;
|
|
2937
|
+
} else {
|
|
2938
|
+
if (element._ripple.isTouch) return;
|
|
2939
|
+
}
|
|
2940
|
+
value.center = element._ripple.centered || isKeyboardEvent(e);
|
|
2941
|
+
if (element._ripple.class) {
|
|
2942
|
+
value.class = element._ripple.class;
|
|
2943
|
+
}
|
|
2944
|
+
if (isTouchEvent(e)) {
|
|
2945
|
+
if (element._ripple.showTimerCommit) return;
|
|
2946
|
+
element._ripple.showTimerCommit = () => {
|
|
2947
|
+
ripples.show(e, element, value);
|
|
2948
|
+
};
|
|
2949
|
+
element._ripple.showTimer = window.setTimeout(() => {
|
|
2950
|
+
if (element?._ripple?.showTimerCommit) {
|
|
2951
|
+
element._ripple.showTimerCommit();
|
|
2952
|
+
element._ripple.showTimerCommit = null;
|
|
2953
|
+
}
|
|
2954
|
+
}, DELAY_RIPPLE);
|
|
2955
|
+
} else {
|
|
2956
|
+
ripples.show(e, element, value);
|
|
2957
|
+
}
|
|
2958
|
+
}
|
|
2959
|
+
function rippleStop(e) {
|
|
2960
|
+
e[stopSymbol] = true;
|
|
2961
|
+
}
|
|
2962
|
+
function rippleHide(e) {
|
|
2963
|
+
const element = e.currentTarget;
|
|
2964
|
+
if (!element?._ripple) return;
|
|
2965
|
+
window.clearTimeout(element._ripple.showTimer);
|
|
2966
|
+
if (e.type === "touchend" && element._ripple.showTimerCommit) {
|
|
2967
|
+
element._ripple.showTimerCommit();
|
|
2968
|
+
element._ripple.showTimerCommit = null;
|
|
2969
|
+
element._ripple.showTimer = window.setTimeout(() => {
|
|
2970
|
+
rippleHide(e);
|
|
2971
|
+
});
|
|
2972
|
+
return;
|
|
2973
|
+
}
|
|
2974
|
+
window.setTimeout(() => {
|
|
2975
|
+
if (element._ripple) {
|
|
2976
|
+
element._ripple.touched = false;
|
|
2977
|
+
}
|
|
2978
|
+
});
|
|
2979
|
+
ripples.hide(element);
|
|
2980
|
+
}
|
|
2981
|
+
function rippleCancelShow(e) {
|
|
2982
|
+
const element = e.currentTarget;
|
|
2983
|
+
if (!element?._ripple) return;
|
|
2984
|
+
if (element._ripple.showTimerCommit) {
|
|
2985
|
+
element._ripple.showTimerCommit = null;
|
|
2986
|
+
}
|
|
2987
|
+
window.clearTimeout(element._ripple.showTimer);
|
|
2988
|
+
}
|
|
2989
|
+
let keyboardRipple = false;
|
|
2990
|
+
function keyboardRippleShow(e, keys) {
|
|
2991
|
+
if (!keyboardRipple && keys.includes(e.key)) {
|
|
2992
|
+
keyboardRipple = true;
|
|
2993
|
+
rippleShow(e);
|
|
2994
|
+
}
|
|
2995
|
+
}
|
|
2996
|
+
function keyboardRippleHide(e) {
|
|
2997
|
+
keyboardRipple = false;
|
|
2998
|
+
rippleHide(e);
|
|
2999
|
+
}
|
|
3000
|
+
function focusRippleHide(e) {
|
|
3001
|
+
if (keyboardRipple) {
|
|
3002
|
+
keyboardRipple = false;
|
|
3003
|
+
rippleHide(e);
|
|
3004
|
+
}
|
|
3005
|
+
}
|
|
3006
|
+
function updateRipple(el, binding, wasEnabled) {
|
|
3007
|
+
const {
|
|
3008
|
+
value,
|
|
3009
|
+
modifiers
|
|
3010
|
+
} = binding;
|
|
3011
|
+
const enabled = isRippleEnabled(value);
|
|
3012
|
+
if (!enabled) {
|
|
3013
|
+
ripples.hide(el);
|
|
3014
|
+
}
|
|
3015
|
+
el._ripple = el._ripple ?? {};
|
|
3016
|
+
el._ripple.enabled = enabled;
|
|
3017
|
+
el._ripple.centered = modifiers.center;
|
|
3018
|
+
el._ripple.circle = modifiers.circle;
|
|
3019
|
+
const bindingValue = isObject(value) ? value : {};
|
|
3020
|
+
if (bindingValue.class) {
|
|
3021
|
+
el._ripple.class = bindingValue.class;
|
|
3022
|
+
}
|
|
3023
|
+
const allowedKeys = bindingValue.keys ?? ["Enter", "Space"];
|
|
3024
|
+
el._ripple.keyDownHandler = (e) => keyboardRippleShow(e, allowedKeys);
|
|
3025
|
+
if (enabled && !wasEnabled) {
|
|
3026
|
+
if (modifiers.stop) {
|
|
3027
|
+
el.addEventListener("touchstart", rippleStop, {
|
|
3028
|
+
passive: true
|
|
3029
|
+
});
|
|
3030
|
+
el.addEventListener("mousedown", rippleStop);
|
|
3031
|
+
return;
|
|
3032
|
+
}
|
|
3033
|
+
el.addEventListener("touchstart", rippleShow, {
|
|
3034
|
+
passive: true
|
|
3035
|
+
});
|
|
3036
|
+
el.addEventListener("touchend", rippleHide, {
|
|
3037
|
+
passive: true
|
|
3038
|
+
});
|
|
3039
|
+
el.addEventListener("touchmove", rippleCancelShow, {
|
|
3040
|
+
passive: true
|
|
3041
|
+
});
|
|
3042
|
+
el.addEventListener("touchcancel", rippleHide);
|
|
3043
|
+
el.addEventListener("mousedown", rippleShow);
|
|
3044
|
+
el.addEventListener("mouseup", rippleHide);
|
|
3045
|
+
el.addEventListener("mouseleave", rippleHide);
|
|
3046
|
+
el.addEventListener("keydown", el._ripple.keyDownHandler);
|
|
3047
|
+
el.addEventListener("keyup", keyboardRippleHide);
|
|
3048
|
+
el.addEventListener("blur", focusRippleHide);
|
|
3049
|
+
el.addEventListener("dragstart", rippleHide, {
|
|
3050
|
+
passive: true
|
|
3051
|
+
});
|
|
3052
|
+
} else if (!enabled && wasEnabled) {
|
|
3053
|
+
removeListeners(el);
|
|
3054
|
+
}
|
|
3055
|
+
}
|
|
3056
|
+
function removeListeners(el) {
|
|
3057
|
+
el.removeEventListener("touchstart", rippleStop);
|
|
3058
|
+
el.removeEventListener("mousedown", rippleStop);
|
|
3059
|
+
el.removeEventListener("touchstart", rippleShow);
|
|
3060
|
+
el.removeEventListener("touchend", rippleHide);
|
|
3061
|
+
el.removeEventListener("touchmove", rippleCancelShow);
|
|
3062
|
+
el.removeEventListener("touchcancel", rippleHide);
|
|
3063
|
+
el.removeEventListener("mousedown", rippleShow);
|
|
3064
|
+
el.removeEventListener("mouseup", rippleHide);
|
|
3065
|
+
el.removeEventListener("mouseleave", rippleHide);
|
|
3066
|
+
if (el._ripple?.keyDownHandler) {
|
|
3067
|
+
el.removeEventListener("keydown", el._ripple.keyDownHandler);
|
|
3068
|
+
}
|
|
3069
|
+
el.removeEventListener("keyup", keyboardRippleHide);
|
|
3070
|
+
el.removeEventListener("blur", focusRippleHide);
|
|
3071
|
+
el.removeEventListener("dragstart", rippleHide);
|
|
3072
|
+
}
|
|
3073
|
+
function mounted(el, binding) {
|
|
3074
|
+
updateRipple(el, binding, false);
|
|
3075
|
+
}
|
|
3076
|
+
function unmounted(el) {
|
|
3077
|
+
removeListeners(el);
|
|
3078
|
+
delete el._ripple;
|
|
3079
|
+
}
|
|
3080
|
+
function updated(el, binding) {
|
|
3081
|
+
if (binding.value === binding.oldValue) {
|
|
3082
|
+
return;
|
|
3083
|
+
}
|
|
3084
|
+
const wasEnabled = isRippleEnabled(binding.oldValue);
|
|
3085
|
+
updateRipple(el, binding, wasEnabled);
|
|
3086
|
+
}
|
|
3087
|
+
const Ripple = {
|
|
3088
|
+
mounted,
|
|
3089
|
+
unmounted,
|
|
3090
|
+
updated
|
|
3091
|
+
};
|
|
3092
|
+
const makeVBtnProps = propsFactory({
|
|
3093
|
+
active: {
|
|
3094
|
+
type: Boolean,
|
|
3095
|
+
default: void 0
|
|
3096
|
+
},
|
|
3097
|
+
activeColor: String,
|
|
3098
|
+
baseColor: String,
|
|
3099
|
+
symbol: {
|
|
3100
|
+
type: null,
|
|
3101
|
+
default: VBtnToggleSymbol
|
|
3102
|
+
},
|
|
3103
|
+
flat: Boolean,
|
|
3104
|
+
icon: [Boolean, String, Function, Object],
|
|
3105
|
+
prependIcon: IconValue,
|
|
3106
|
+
appendIcon: IconValue,
|
|
3107
|
+
block: Boolean,
|
|
3108
|
+
readonly: Boolean,
|
|
3109
|
+
slim: Boolean,
|
|
3110
|
+
stacked: Boolean,
|
|
3111
|
+
spaced: String,
|
|
3112
|
+
ripple: {
|
|
3113
|
+
type: [Boolean, Object],
|
|
3114
|
+
default: true
|
|
3115
|
+
},
|
|
3116
|
+
text: {
|
|
3117
|
+
type: [String, Number, Boolean],
|
|
3118
|
+
default: void 0
|
|
3119
|
+
},
|
|
3120
|
+
...makeBorderProps(),
|
|
3121
|
+
...makeComponentProps(),
|
|
3122
|
+
...makeDensityProps(),
|
|
3123
|
+
...makeDimensionProps(),
|
|
3124
|
+
...makeElevationProps(),
|
|
3125
|
+
...makeGroupItemProps(),
|
|
3126
|
+
...makeLoaderProps(),
|
|
3127
|
+
...makeLocationProps(),
|
|
3128
|
+
...makePositionProps(),
|
|
3129
|
+
...makeRoundedProps(),
|
|
3130
|
+
...makeRouterProps(),
|
|
3131
|
+
...makeSizeProps(),
|
|
3132
|
+
...makeTagProps({
|
|
3133
|
+
tag: "button"
|
|
3134
|
+
}),
|
|
3135
|
+
...makeThemeProps(),
|
|
3136
|
+
...makeVariantProps({
|
|
3137
|
+
variant: "elevated"
|
|
3138
|
+
})
|
|
3139
|
+
}, "VBtn");
|
|
3140
|
+
const VBtn = genericComponent()({
|
|
3141
|
+
name: "VBtn",
|
|
3142
|
+
props: makeVBtnProps(),
|
|
3143
|
+
emits: {
|
|
3144
|
+
"group:selected": (val) => true
|
|
3145
|
+
},
|
|
3146
|
+
setup(props, _ref) {
|
|
3147
|
+
let {
|
|
3148
|
+
attrs,
|
|
3149
|
+
slots
|
|
3150
|
+
} = _ref;
|
|
3151
|
+
const {
|
|
3152
|
+
themeClasses
|
|
3153
|
+
} = provideTheme(props);
|
|
3154
|
+
const {
|
|
3155
|
+
borderClasses
|
|
3156
|
+
} = useBorder(props);
|
|
3157
|
+
const {
|
|
3158
|
+
densityClasses
|
|
3159
|
+
} = useDensity(props);
|
|
3160
|
+
const {
|
|
3161
|
+
dimensionStyles
|
|
3162
|
+
} = useDimension(props);
|
|
3163
|
+
const {
|
|
3164
|
+
elevationClasses
|
|
3165
|
+
} = useElevation(props);
|
|
3166
|
+
const {
|
|
3167
|
+
loaderClasses
|
|
3168
|
+
} = useLoader(props);
|
|
3169
|
+
const {
|
|
3170
|
+
locationStyles
|
|
3171
|
+
} = useLocation(props);
|
|
3172
|
+
const {
|
|
3173
|
+
positionClasses
|
|
3174
|
+
} = usePosition(props);
|
|
3175
|
+
const {
|
|
3176
|
+
roundedClasses
|
|
3177
|
+
} = useRounded(props);
|
|
3178
|
+
const {
|
|
3179
|
+
sizeClasses,
|
|
3180
|
+
sizeStyles
|
|
3181
|
+
} = useSize(props);
|
|
3182
|
+
const group = useGroupItem(props, props.symbol, false);
|
|
3183
|
+
const link = useLink(props, attrs);
|
|
3184
|
+
const isActive = computed(() => {
|
|
3185
|
+
if (props.active !== void 0) {
|
|
3186
|
+
return props.active;
|
|
3187
|
+
}
|
|
3188
|
+
if (link.isRouterLink.value) {
|
|
3189
|
+
return link.isActive?.value;
|
|
3190
|
+
}
|
|
3191
|
+
return group?.isSelected.value;
|
|
3192
|
+
});
|
|
3193
|
+
const color = toRef(() => isActive.value ? props.activeColor ?? props.color : props.color);
|
|
3194
|
+
const variantProps = computed(() => {
|
|
3195
|
+
const showColor = group?.isSelected.value && (!link.isLink.value || link.isActive?.value) || !group || link.isActive?.value;
|
|
3196
|
+
return {
|
|
3197
|
+
color: showColor ? color.value ?? props.baseColor : props.baseColor,
|
|
3198
|
+
variant: props.variant
|
|
3199
|
+
};
|
|
3200
|
+
});
|
|
3201
|
+
const {
|
|
3202
|
+
colorClasses,
|
|
3203
|
+
colorStyles,
|
|
3204
|
+
variantClasses
|
|
3205
|
+
} = useVariant(variantProps);
|
|
3206
|
+
const isDisabled = computed(() => group?.disabled.value || props.disabled);
|
|
3207
|
+
const isElevated = toRef(() => {
|
|
3208
|
+
return props.variant === "elevated" && !(props.disabled || props.flat || props.border);
|
|
3209
|
+
});
|
|
3210
|
+
const valueAttr = computed(() => {
|
|
3211
|
+
if (props.value === void 0 || typeof props.value === "symbol") return void 0;
|
|
3212
|
+
return Object(props.value) === props.value ? JSON.stringify(props.value, null, 0) : props.value;
|
|
3213
|
+
});
|
|
3214
|
+
function onClick(e) {
|
|
3215
|
+
if (isDisabled.value || link.isLink.value && (e.metaKey || e.ctrlKey || e.shiftKey || e.button !== 0 || attrs.target === "_blank")) return;
|
|
3216
|
+
if (link.isRouterLink.value) {
|
|
3217
|
+
link.navigate?.(e);
|
|
3218
|
+
} else {
|
|
3219
|
+
group?.toggle();
|
|
3220
|
+
}
|
|
3221
|
+
}
|
|
3222
|
+
useSelectLink(link, group?.select);
|
|
3223
|
+
useRender(() => {
|
|
3224
|
+
const Tag = link.isLink.value ? "a" : props.tag;
|
|
3225
|
+
const hasPrepend = !!(props.prependIcon || slots.prepend);
|
|
3226
|
+
const hasAppend = !!(props.appendIcon || slots.append);
|
|
3227
|
+
const hasIcon = !!(props.icon && props.icon !== true);
|
|
3228
|
+
return withDirectives(createVNode(Tag, mergeProps(link.linkProps, {
|
|
3229
|
+
"type": Tag === "a" ? void 0 : "button",
|
|
3230
|
+
"class": ["v-btn", group?.selectedClass.value, {
|
|
3231
|
+
"v-btn--active": isActive.value,
|
|
3232
|
+
"v-btn--block": props.block,
|
|
3233
|
+
"v-btn--disabled": isDisabled.value,
|
|
3234
|
+
"v-btn--elevated": isElevated.value,
|
|
3235
|
+
"v-btn--flat": props.flat,
|
|
3236
|
+
"v-btn--icon": !!props.icon,
|
|
3237
|
+
"v-btn--loading": props.loading,
|
|
3238
|
+
"v-btn--readonly": props.readonly,
|
|
3239
|
+
"v-btn--slim": props.slim,
|
|
3240
|
+
"v-btn--stacked": props.stacked
|
|
3241
|
+
}, props.spaced ? ["v-btn--spaced", `v-btn--spaced-${props.spaced}`] : [], themeClasses.value, borderClasses.value, colorClasses.value, densityClasses.value, elevationClasses.value, loaderClasses.value, positionClasses.value, roundedClasses.value, sizeClasses.value, variantClasses.value, props.class],
|
|
3242
|
+
"style": [colorStyles.value, dimensionStyles.value, locationStyles.value, sizeStyles.value, props.style],
|
|
3243
|
+
"aria-busy": props.loading ? true : void 0,
|
|
3244
|
+
"disabled": isDisabled.value && Tag !== "a" || void 0,
|
|
3245
|
+
"tabindex": props.loading || props.readonly ? -1 : void 0,
|
|
3246
|
+
"onClick": onClick,
|
|
3247
|
+
"value": valueAttr.value
|
|
3248
|
+
}), {
|
|
3249
|
+
default: () => [genOverlays(true, "v-btn"), !props.icon && hasPrepend && createElementVNode("span", {
|
|
3250
|
+
"key": "prepend",
|
|
3251
|
+
"class": "v-btn__prepend"
|
|
3252
|
+
}, [!slots.prepend ? createVNode(VIcon, {
|
|
3253
|
+
"key": "prepend-icon",
|
|
3254
|
+
"icon": props.prependIcon
|
|
3255
|
+
}, null) : createVNode(VDefaultsProvider, {
|
|
3256
|
+
"key": "prepend-defaults",
|
|
3257
|
+
"disabled": !props.prependIcon,
|
|
3258
|
+
"defaults": {
|
|
3259
|
+
VIcon: {
|
|
3260
|
+
icon: props.prependIcon
|
|
3261
|
+
}
|
|
3262
|
+
}
|
|
3263
|
+
}, slots.prepend)]), createElementVNode("span", {
|
|
3264
|
+
"class": "v-btn__content",
|
|
3265
|
+
"data-no-activator": ""
|
|
3266
|
+
}, [!slots.default && hasIcon ? createVNode(VIcon, {
|
|
3267
|
+
"key": "content-icon",
|
|
3268
|
+
"icon": props.icon
|
|
3269
|
+
}, null) : createVNode(VDefaultsProvider, {
|
|
3270
|
+
"key": "content-defaults",
|
|
3271
|
+
"disabled": !hasIcon,
|
|
3272
|
+
"defaults": {
|
|
3273
|
+
VIcon: {
|
|
3274
|
+
icon: props.icon
|
|
3275
|
+
}
|
|
3276
|
+
}
|
|
3277
|
+
}, {
|
|
3278
|
+
default: () => [slots.default?.() ?? toDisplayString(props.text)]
|
|
3279
|
+
})]), !props.icon && hasAppend && createElementVNode("span", {
|
|
3280
|
+
"key": "append",
|
|
3281
|
+
"class": "v-btn__append"
|
|
3282
|
+
}, [!slots.append ? createVNode(VIcon, {
|
|
3283
|
+
"key": "append-icon",
|
|
3284
|
+
"icon": props.appendIcon
|
|
3285
|
+
}, null) : createVNode(VDefaultsProvider, {
|
|
3286
|
+
"key": "append-defaults",
|
|
3287
|
+
"disabled": !props.appendIcon,
|
|
3288
|
+
"defaults": {
|
|
3289
|
+
VIcon: {
|
|
3290
|
+
icon: props.appendIcon
|
|
3291
|
+
}
|
|
3292
|
+
}
|
|
3293
|
+
}, slots.append)]), !!props.loading && createElementVNode("span", {
|
|
3294
|
+
"key": "loader",
|
|
3295
|
+
"class": "v-btn__loader"
|
|
3296
|
+
}, [slots.loader?.() ?? createVNode(VProgressCircular, {
|
|
3297
|
+
"color": typeof props.loading === "boolean" ? void 0 : props.loading,
|
|
3298
|
+
"indeterminate": true,
|
|
3299
|
+
"width": "2"
|
|
3300
|
+
}, null)])]
|
|
3301
|
+
}), [[Ripple, !isDisabled.value && props.ripple, "", {
|
|
3302
|
+
center: !!props.icon
|
|
3303
|
+
}]]);
|
|
3304
|
+
});
|
|
3305
|
+
return {
|
|
3306
|
+
group
|
|
3307
|
+
};
|
|
3308
|
+
}
|
|
3309
|
+
});
|
|
3310
|
+
function useSsrBoot() {
|
|
3311
|
+
const isBooted = shallowRef(false);
|
|
3312
|
+
onMounted(() => {
|
|
3313
|
+
window.requestAnimationFrame(() => {
|
|
3314
|
+
isBooted.value = true;
|
|
3315
|
+
});
|
|
3316
|
+
});
|
|
3317
|
+
const ssrBootStyles = toRef(() => !isBooted.value ? {
|
|
3318
|
+
transition: "none !important"
|
|
3319
|
+
} : void 0);
|
|
3320
|
+
return {
|
|
3321
|
+
ssrBootStyles,
|
|
3322
|
+
isBooted: readonly(isBooted)
|
|
3323
|
+
};
|
|
3324
|
+
}
|
|
3325
|
+
const makeVMainProps = propsFactory({
|
|
3326
|
+
scrollable: Boolean,
|
|
3327
|
+
...makeComponentProps(),
|
|
3328
|
+
...makeDimensionProps(),
|
|
3329
|
+
...makeTagProps({
|
|
3330
|
+
tag: "main"
|
|
3331
|
+
})
|
|
3332
|
+
}, "VMain");
|
|
3333
|
+
const VMain = genericComponent()({
|
|
3334
|
+
name: "VMain",
|
|
3335
|
+
props: makeVMainProps(),
|
|
3336
|
+
setup(props, _ref) {
|
|
3337
|
+
let {
|
|
3338
|
+
slots
|
|
3339
|
+
} = _ref;
|
|
3340
|
+
const {
|
|
3341
|
+
dimensionStyles
|
|
3342
|
+
} = useDimension(props);
|
|
3343
|
+
const {
|
|
3344
|
+
mainStyles
|
|
3345
|
+
} = useLayout();
|
|
3346
|
+
const {
|
|
3347
|
+
ssrBootStyles
|
|
3348
|
+
} = useSsrBoot();
|
|
3349
|
+
useRender(() => createVNode(props.tag, {
|
|
3350
|
+
"class": normalizeClass(["v-main", {
|
|
3351
|
+
"v-main--scrollable": props.scrollable
|
|
3352
|
+
}, props.class]),
|
|
3353
|
+
"style": normalizeStyle([mainStyles.value, ssrBootStyles.value, dimensionStyles.value, props.style])
|
|
3354
|
+
}, {
|
|
3355
|
+
default: () => [props.scrollable ? createElementVNode("div", {
|
|
3356
|
+
"class": "v-main__scroller"
|
|
3357
|
+
}, [slots.default?.()]) : slots.default?.()]
|
|
3358
|
+
}));
|
|
3359
|
+
return {};
|
|
3360
|
+
}
|
|
3361
|
+
});
|
|
3362
|
+
const _hoisted_1 = {
|
|
3363
|
+
key: 1,
|
|
3364
|
+
class: "d-flex align-center justify-center",
|
|
3365
|
+
style: { "height": "200px" }
|
|
3366
|
+
};
|
|
3367
|
+
const _sfc_main = /* @__PURE__ */ Object.assign({
|
|
3368
|
+
name: "PreviewApp"
|
|
3369
|
+
}, {
|
|
3370
|
+
__name: "App",
|
|
3371
|
+
setup(__props, { expose: __expose }) {
|
|
3372
|
+
const currentTheme = ref("light");
|
|
3373
|
+
const pluginComponent = shallowRef(null);
|
|
3374
|
+
const toggleTheme = () => {
|
|
3375
|
+
currentTheme.value = currentTheme.value === "light" ? "dark" : "light";
|
|
3376
|
+
};
|
|
3377
|
+
onMounted(() => {
|
|
3378
|
+
if (window.__PREVIEW_PLUGIN_COMPONENT__) {
|
|
3379
|
+
pluginComponent.value = window.__PREVIEW_PLUGIN_COMPONENT__;
|
|
3380
|
+
}
|
|
3381
|
+
});
|
|
3382
|
+
__expose({
|
|
3383
|
+
setPluginComponent: (component) => {
|
|
3384
|
+
pluginComponent.value = component;
|
|
3385
|
+
}
|
|
3386
|
+
});
|
|
3387
|
+
return (_ctx, _cache) => {
|
|
3388
|
+
return openBlock(), createBlock(VApp, { theme: currentTheme.value }, {
|
|
3389
|
+
default: withCtx(() => [
|
|
3390
|
+
createVNode(VMain, null, {
|
|
3391
|
+
default: withCtx(() => [
|
|
3392
|
+
createVNode(VBanner, {
|
|
3393
|
+
density: "compact",
|
|
3394
|
+
color: "info",
|
|
3395
|
+
lines: "one"
|
|
3396
|
+
}, {
|
|
3397
|
+
text: withCtx(() => _cache[0] || (_cache[0] = [
|
|
3398
|
+
createElementVNode("span", { class: "text-caption" }, "Preview 模式 - Electron API 已 mock", -1)
|
|
3399
|
+
])),
|
|
3400
|
+
actions: withCtx(() => [
|
|
3401
|
+
createVNode(VBtn, {
|
|
3402
|
+
variant: "text",
|
|
3403
|
+
icon: currentTheme.value === "light" ? "dark_mode" : "light_mode",
|
|
3404
|
+
onClick: toggleTheme
|
|
3405
|
+
}, null, 8, ["icon"])
|
|
3406
|
+
]),
|
|
3407
|
+
_: 1
|
|
3408
|
+
}),
|
|
3409
|
+
pluginComponent.value ? (openBlock(), createBlock(resolveDynamicComponent(pluginComponent.value), { key: 0 })) : (openBlock(), createElementBlock("div", _hoisted_1, _cache[1] || (_cache[1] = [
|
|
3410
|
+
createElementVNode("span", { class: "text-medium-emphasis" }, "加载中...", -1)
|
|
3411
|
+
])))
|
|
3412
|
+
]),
|
|
3413
|
+
_: 1
|
|
3414
|
+
})
|
|
3415
|
+
]),
|
|
3416
|
+
_: 1
|
|
3417
|
+
}, 8, ["theme"]);
|
|
3418
|
+
};
|
|
3419
|
+
}
|
|
3420
|
+
});
|
|
3421
|
+
const PreviewApp = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-10207be4"]]);
|
|
3422
|
+
async function startPreview(pluginComponent, options = {}) {
|
|
3423
|
+
const { mountId = "app" } = options;
|
|
3424
|
+
initPreviewMock();
|
|
3425
|
+
const vuetify = createVuetify({
|
|
3426
|
+
components,
|
|
3427
|
+
directives,
|
|
3428
|
+
locale: {
|
|
3429
|
+
locale: "zhHans",
|
|
3430
|
+
messages: { zhHans }
|
|
3431
|
+
},
|
|
3432
|
+
icons: {
|
|
3433
|
+
defaultSet: "md",
|
|
3434
|
+
aliases,
|
|
3435
|
+
sets: { md }
|
|
3436
|
+
},
|
|
3437
|
+
theme: {
|
|
3438
|
+
defaultTheme: "light",
|
|
3439
|
+
layers: true,
|
|
3440
|
+
themes: {
|
|
3441
|
+
light: {
|
|
3442
|
+
colors: {
|
|
3443
|
+
primary: "#00639b",
|
|
3444
|
+
"on-primary": "#ffffff",
|
|
3445
|
+
"primary-container": "#cee5ff",
|
|
3446
|
+
"on-primary-container": "#004a76",
|
|
3447
|
+
"inverse-primary": "#96cbff",
|
|
3448
|
+
"primary-fixed": "#cee5ff",
|
|
3449
|
+
"primary-fixed-dim": "#96cbff",
|
|
3450
|
+
"on-primary-fixed": "#001d33",
|
|
3451
|
+
"on-primary-fixed-variant": "#004a76",
|
|
3452
|
+
secondary: "#51606f",
|
|
3453
|
+
"on-secondary": "#ffffff",
|
|
3454
|
+
"secondary-container": "#d5e4f7",
|
|
3455
|
+
"on-secondary-container": "#3a4857",
|
|
3456
|
+
"secondary-fixed": "#d5e4f7",
|
|
3457
|
+
"secondary-fixed-dim": "#b9c8da",
|
|
3458
|
+
"on-secondary-fixed": "#0e1d2a",
|
|
3459
|
+
"on-secondary-fixed-variant": "#3a4857",
|
|
3460
|
+
tertiary: "#68587a",
|
|
3461
|
+
"on-tertiary": "#ffffff",
|
|
3462
|
+
"tertiary-container": "#eedbff",
|
|
3463
|
+
"on-tertiary-container": "#504061",
|
|
3464
|
+
"tertiary-fixed": "#eedbff",
|
|
3465
|
+
"tertiary-fixed-dim": "#d3bfe6",
|
|
3466
|
+
"on-tertiary-fixed": "#231533",
|
|
3467
|
+
"on-tertiary-fixed-variant": "#504061",
|
|
3468
|
+
error: "#ba1a1a",
|
|
3469
|
+
"on-error": "#ffffff",
|
|
3470
|
+
"error-container": "#ffdad6",
|
|
3471
|
+
"on-error-container": "#93000a",
|
|
3472
|
+
"surface-dim": "#dadada",
|
|
3473
|
+
surface: "#f9f9f9",
|
|
3474
|
+
"surface-bright": "#f9f9f9",
|
|
3475
|
+
"surface-container-lowest": "#ffffff",
|
|
3476
|
+
"surface-container-low": "#f3f3f3",
|
|
3477
|
+
"surface-container": "#eeeeee",
|
|
3478
|
+
"surface-container-high": "#e8e8e8",
|
|
3479
|
+
"surface-container-highest": "#e2e2e2",
|
|
3480
|
+
"on-surface": "#1b1b1b",
|
|
3481
|
+
"on-surface-variant": "#474747",
|
|
3482
|
+
outline: "#777777",
|
|
3483
|
+
"outline-variant": "#c6c6c6",
|
|
3484
|
+
"inverse-surface": "#303030",
|
|
3485
|
+
"inverse-on-surface": "#f1f1f1",
|
|
3486
|
+
"surface-variant": "#e2e2e2",
|
|
3487
|
+
"surface-tint": "#00639b",
|
|
3488
|
+
background: "#f9f9f9",
|
|
3489
|
+
"on-background": "#1b1b1b",
|
|
3490
|
+
shadow: "#000000",
|
|
3491
|
+
scrim: "#000000"
|
|
3492
|
+
},
|
|
3493
|
+
dark: false
|
|
3494
|
+
},
|
|
3495
|
+
dark: {
|
|
3496
|
+
colors: {
|
|
3497
|
+
primary: "#96cbff",
|
|
3498
|
+
"on-primary": "#003353",
|
|
3499
|
+
"primary-container": "#004a76",
|
|
3500
|
+
"on-primary-container": "#cee5ff",
|
|
3501
|
+
"inverse-primary": "#00639b",
|
|
3502
|
+
"primary-fixed": "#cee5ff",
|
|
3503
|
+
"primary-fixed-dim": "#96cbff",
|
|
3504
|
+
"on-primary-fixed": "#001d33",
|
|
3505
|
+
"on-primary-fixed-variant": "#004a76",
|
|
3506
|
+
secondary: "#b9c8da",
|
|
3507
|
+
"on-secondary": "#233240",
|
|
3508
|
+
"secondary-container": "#3a4857",
|
|
3509
|
+
"on-secondary-container": "#d5e4f7",
|
|
3510
|
+
"secondary-fixed": "#d5e4f7",
|
|
3511
|
+
"secondary-fixed-dim": "#b9c8da",
|
|
3512
|
+
"on-secondary-fixed": "#0e1d2a",
|
|
3513
|
+
"on-secondary-fixed-variant": "#3a4857",
|
|
3514
|
+
tertiary: "#d3bfe6",
|
|
3515
|
+
"on-tertiary": "#382a49",
|
|
3516
|
+
"tertiary-container": "#504061",
|
|
3517
|
+
"on-tertiary-container": "#eedbff",
|
|
3518
|
+
"tertiary-fixed": "#eedbff",
|
|
3519
|
+
"tertiary-fixed-dim": "#d3bfe6",
|
|
3520
|
+
"on-tertiary-fixed": "#231533",
|
|
3521
|
+
"on-tertiary-fixed-variant": "#504061",
|
|
3522
|
+
error: "#ffb4ab",
|
|
3523
|
+
"on-error": "#690005",
|
|
3524
|
+
"error-container": "#93000a",
|
|
3525
|
+
"on-error-container": "#ffdad6",
|
|
3526
|
+
"surface-dim": "#131313",
|
|
3527
|
+
surface: "#131313",
|
|
3528
|
+
"surface-bright": "#393939",
|
|
3529
|
+
"surface-container-lowest": "#0e0e0e",
|
|
3530
|
+
"surface-container-low": "#1b1b1b",
|
|
3531
|
+
"surface-container": "#1f1f1f",
|
|
3532
|
+
"surface-container-high": "#2a2a2a",
|
|
3533
|
+
"surface-container-highest": "#353535",
|
|
3534
|
+
"on-surface": "#e2e2e2",
|
|
3535
|
+
"on-surface-variant": "#c6c6c6",
|
|
3536
|
+
outline: "#919191",
|
|
3537
|
+
"outline-variant": "#474747",
|
|
3538
|
+
"inverse-surface": "#e2e2e2",
|
|
3539
|
+
"inverse-on-surface": "#303030",
|
|
3540
|
+
"surface-variant": "#474747",
|
|
3541
|
+
"surface-tint": "#96cbff",
|
|
3542
|
+
background: "#131313",
|
|
3543
|
+
"on-background": "#e2e2e2",
|
|
3544
|
+
shadow: "#000000",
|
|
3545
|
+
scrim: "#000000"
|
|
3546
|
+
},
|
|
3547
|
+
dark: true
|
|
3548
|
+
}
|
|
3549
|
+
}
|
|
3550
|
+
},
|
|
3551
|
+
defaults: {
|
|
3552
|
+
VBtn: {
|
|
3553
|
+
class: "normal-case"
|
|
3554
|
+
},
|
|
3555
|
+
VSwitch: {
|
|
3556
|
+
color: "primary",
|
|
3557
|
+
hideDetails: true,
|
|
3558
|
+
inset: true,
|
|
3559
|
+
trueIcon: "check"
|
|
3560
|
+
},
|
|
3561
|
+
VCard: {
|
|
3562
|
+
color: "surface-container"
|
|
3563
|
+
}
|
|
3564
|
+
},
|
|
3565
|
+
blueprint: md3
|
|
3566
|
+
});
|
|
3567
|
+
window.vuetify$ = {
|
|
3568
|
+
instance: vuetify,
|
|
3569
|
+
components,
|
|
3570
|
+
directives
|
|
3571
|
+
};
|
|
3572
|
+
window.__PREVIEW_PLUGIN_COMPONENT__ = pluginComponent;
|
|
3573
|
+
const app = createApp(PreviewApp);
|
|
3574
|
+
app.use(vuetify);
|
|
3575
|
+
let mountEl = document.getElementById(mountId);
|
|
3576
|
+
if (!mountEl) {
|
|
3577
|
+
mountEl = document.createElement("div");
|
|
3578
|
+
mountEl.id = mountId;
|
|
3579
|
+
document.body.appendChild(mountEl);
|
|
3580
|
+
}
|
|
3581
|
+
app.mount(`#${mountId}`);
|
|
3582
|
+
console.log("[Preview] 插件预览模式已启动");
|
|
3583
|
+
return app;
|
|
3584
|
+
}
|
|
3585
|
+
export {
|
|
3586
|
+
startPreview as default,
|
|
3587
|
+
startPreview
|
|
3588
|
+
};
|
|
3589
|
+
//# sourceMappingURL=preview.js.map
|