@m3ui-vue/m3ui-vue 1.1.3 → 1.2.0
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 +1 -1
- package/dist/API.md +579 -40
- package/dist/MMenuItem-DI351kIf.js +929 -0
- package/dist/MMenuItem-DI351kIf.js.map +1 -0
- package/dist/MSlider-BnEy5ieZ.js +1500 -0
- package/dist/MSlider-BnEy5ieZ.js.map +1 -0
- package/dist/MTextField-BBmkaIbO.js +633 -0
- package/dist/MTextField-BBmkaIbO.js.map +1 -0
- package/dist/api.json +1 -1
- package/dist/chart.js +83 -49
- package/dist/chart.js.map +1 -1
- package/dist/code-editor.js +1 -1
- package/dist/components/MAnimatedNumber.vue.d.ts +3 -1
- package/dist/components/MButton.vue.d.ts +9 -1
- package/dist/components/MButtonGroup.vue.d.ts +40 -31
- package/dist/components/MCarousel.vue.d.ts +2 -0
- package/dist/components/MChart.vue.d.ts +6 -0
- package/dist/components/MCircleProgressBar.vue.d.ts +5 -3
- package/dist/components/MContainerTransform.vue.d.ts +59 -0
- package/dist/components/MContextMenu.vue.d.ts +2 -2
- package/dist/components/MCopyButton.vue.d.ts +1 -1
- package/dist/components/MDialog.vue.d.ts +8 -5
- package/dist/components/MExportButton.vue.d.ts +1 -1
- package/dist/components/MFab.vue.d.ts +2 -2
- package/dist/components/MFabMenu.vue.d.ts +1 -1
- package/dist/components/MFlex.vue.d.ts +1 -1
- package/dist/components/MIconButton.vue.d.ts +15 -1
- package/dist/components/MInfiniteScroll.vue.d.ts +1 -1
- package/dist/components/MListItem.vue.d.ts +5 -5
- package/dist/components/MMap.vue.d.ts +20 -2
- package/dist/components/MMapBaseLayers.vue.d.ts +3 -0
- package/dist/components/MMapFilter.vue.d.ts +3 -0
- package/dist/components/MMapLayers.vue.d.ts +3 -0
- package/dist/components/MMenu.vue.d.ts +2 -2
- package/dist/components/MMenuItem.vue.d.ts +7 -3
- package/dist/components/MNavigationDrawer.vue.d.ts +13 -2
- package/dist/components/MNavigationRail.vue.d.ts +1 -1
- package/dist/components/MOverlay.vue.d.ts +12 -1
- package/dist/components/MProgressBar.vue.d.ts +5 -3
- package/dist/components/MPullToRefresh.vue.d.ts +7 -2
- package/dist/components/MRichTextEditor.vue.d.ts +7 -1
- package/dist/components/MSearchField.vue.d.ts +58 -0
- package/dist/components/MSegmentedButton.vue.d.ts +31 -23
- package/dist/components/MSimpleCarousel.vue.d.ts +2 -0
- package/dist/components/MSkeleton.vue.d.ts +6 -3
- package/dist/components/MSplitter.vue.d.ts +1 -1
- package/dist/components/MStack.vue.d.ts +1 -1
- package/dist/components/MSwipeToDismiss.vue.d.ts +1 -1
- package/dist/components/MSwitch.vue.d.ts +1 -1
- package/dist/components/MTextField.vue.d.ts +5 -1
- package/dist/components/MTimeline.vue.d.ts +85 -22
- package/dist/components/MToolbar.vue.d.ts +32 -5
- package/dist/components/MTooltip.vue.d.ts +1 -1
- package/dist/components/_MDrawerItemList.vue.d.ts +2 -0
- package/dist/components/_MToolbarFab.vue.d.ts +16 -0
- package/dist/composables/_containerTransform.d.ts +48 -0
- package/dist/composables/_mapStyle.d.ts +13 -0
- package/dist/composables/_themeTransition.d.ts +2 -0
- package/dist/composables/_tooltipTrigger.d.ts +22 -0
- package/dist/composables/_useMenuNav.d.ts +28 -0
- package/dist/composables/useAutoGrow.d.ts +21 -0
- package/dist/composables/useColorPalette.d.ts +1 -1
- package/dist/composables/useContainerTransform.d.ts +30 -0
- package/dist/composables/useLocale.d.ts +6 -0
- package/dist/composables/useMap.d.ts +19 -3
- package/dist/composables/useMapFilter.d.ts +4 -1
- package/dist/composables/useMapLayers.d.ts +5 -2
- package/dist/composables/useScrollReveal.d.ts +44 -0
- package/dist/composables/useThemeTokens.d.ts +21 -0
- package/dist/composables/viewportHints.d.ts +27 -0
- package/dist/directives/vClickOutside.d.ts +25 -0
- package/dist/directives/vFocusRing.d.ts +22 -0
- package/dist/directives/vLongPress.d.ts +27 -0
- package/dist/directives/vReveal.d.ts +10 -0
- package/dist/directives/vScrollElevation.d.ts +31 -0
- package/dist/directives/vSkeleton.d.ts +19 -0
- package/dist/directives/vStateLayer.d.ts +20 -0
- package/dist/directives/vSwipe.d.ts +45 -0
- package/dist/directives/vTooltip.d.ts +23 -0
- package/dist/index.d.ts +31 -1
- package/dist/locales/index.js +35 -7
- package/dist/locales/index.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +7692 -6273
- package/dist/m3ui.js.map +1 -1
- package/dist/map.d.ts +1 -1
- package/dist/map.js +823 -793
- package/dist/map.js.map +1 -1
- package/dist/motion-DZiXG09o.js +150 -0
- package/dist/motion-DZiXG09o.js.map +1 -0
- package/dist/plugin.d.ts +24 -0
- package/dist/rich-text-editor.js +20 -16
- package/dist/rich-text-editor.js.map +1 -1
- package/dist/styles/theme.css +63 -0
- package/dist/styles.css +1 -1
- package/dist/{useLocale-SfQHnJfp.js → useLocale-JYxDDeXC.js} +6 -2
- package/dist/useLocale-JYxDDeXC.js.map +1 -0
- package/dist/useThemeTokens-Bv-Uv8eX.js +135 -0
- package/dist/useThemeTokens-Bv-Uv8eX.js.map +1 -0
- package/package.json +2 -1
- package/src/__tests__/MAnimatedNumber.test.ts +24 -2
- package/src/__tests__/MButton.test.ts +22 -0
- package/src/__tests__/MCarousel.test.ts +9 -0
- package/src/__tests__/MChart.test.ts +77 -5
- package/src/__tests__/MContainerTransform.test.ts +279 -0
- package/src/__tests__/MDialog.test.ts +27 -0
- package/src/__tests__/MIconButton.test.ts +33 -0
- package/src/__tests__/MListItemExpandable.test.ts +48 -0
- package/src/__tests__/MListItemShape.test.ts +9 -6
- package/src/__tests__/MListKeyboard.test.ts +90 -0
- package/src/__tests__/MMap.test.ts +53 -1
- package/src/__tests__/MMapLayers.test.ts +46 -2
- package/src/__tests__/MMapTools.test.ts +2 -1
- package/src/__tests__/MMenu.test.ts +104 -1
- package/src/__tests__/MMenuItem.test.ts +18 -0
- package/src/__tests__/MNavigationDrawer.test.ts +80 -0
- package/src/__tests__/MNavigationRail.test.ts +33 -0
- package/src/__tests__/MOverlay.test.ts +49 -0
- package/src/__tests__/MProgressBar.test.ts +41 -0
- package/src/__tests__/MPullToRefresh.test.ts +33 -0
- package/src/__tests__/MRichTextEditor.test.ts +22 -0
- package/src/__tests__/MSearchField.test.ts +71 -0
- package/src/__tests__/MSkeleton.test.ts +38 -0
- package/src/__tests__/MSlider.test.ts +161 -0
- package/src/__tests__/MTimeline.test.ts +238 -0
- package/src/__tests__/MToolbar.test.ts +157 -0
- package/src/__tests__/_fakeMaplibre.ts +3 -1
- package/src/__tests__/attrsFallthrough.test.ts +9 -0
- package/src/__tests__/escapeStack.test.ts +93 -0
- package/src/__tests__/hydration.test.ts +25 -0
- package/src/__tests__/ssr.test.ts +21 -2
- package/src/__tests__/useAutoGrow.test.ts +103 -0
- package/src/__tests__/useScrollReveal.test.ts +102 -0
- package/src/__tests__/useThemeTokens.test.ts +114 -0
- package/src/__tests__/vClickOutside.test.ts +82 -0
- package/src/__tests__/vFocusRing.test.ts +36 -0
- package/src/__tests__/vLongPress.test.ts +81 -0
- package/src/__tests__/vScrollElevation.test.ts +89 -0
- package/src/__tests__/vSkeleton.test.ts +48 -0
- package/src/__tests__/vStateLayer.test.ts +53 -0
- package/src/__tests__/vSwipe.test.ts +93 -0
- package/src/__tests__/vTooltip.test.ts +95 -0
- package/src/__tests__/viewportHints.test.ts +41 -0
- package/src/components/MAnimatedNumber.vue +32 -6
- package/src/components/MAutocomplete.vue +5 -0
- package/src/components/MBottomSheet.vue +4 -1
- package/src/components/MButton.vue +19 -3
- package/src/components/MButtonGroup.vue +22 -17
- package/src/components/MCarousel.vue +7 -1
- package/src/components/MChart.vue +74 -34
- package/src/components/MCircleProgressBar.vue +14 -9
- package/src/components/MCommandPalette.vue +3 -2
- package/src/components/MContainerTransform.vue +321 -0
- package/src/components/MContextMenu.vue +19 -60
- package/src/components/MDialog.vue +31 -6
- package/src/components/MDragDropList.vue +2 -0
- package/src/components/MFab.vue +10 -5
- package/src/components/MIconButton.vue +43 -2
- package/src/components/MKanban.vue +2 -0
- package/src/components/MLightbox.vue +7 -2
- package/src/components/MList.vue +26 -2
- package/src/components/MListItem.vue +138 -84
- package/src/components/MMap.vue +38 -5
- package/src/components/MMapBaseLayers.vue +7 -3
- package/src/components/MMapFilter.vue +7 -4
- package/src/components/MMapGeoJson.vue +1 -1
- package/src/components/MMapLayers.vue +6 -2
- package/src/components/MMapMeasure.vue +5 -2
- package/src/components/MMenu.vue +18 -59
- package/src/components/MMenuItem.vue +11 -2
- package/src/components/MMultiAutocomplete.vue +5 -0
- package/src/components/MNavigationDrawer.vue +96 -11
- package/src/components/MNavigationRail.vue +44 -25
- package/src/components/MOverlay.vue +32 -13
- package/src/components/MProgressBar.vue +25 -27
- package/src/components/MPullToRefresh.vue +20 -1
- package/src/components/MRichTextEditor.vue +19 -5
- package/src/components/MSearchBar.vue +5 -0
- package/src/components/MSearchField.vue +142 -0
- package/src/components/MSegmentedButton.vue +19 -17
- package/src/components/MSelect.vue +10 -1
- package/src/components/MSideSheet.vue +5 -2
- package/src/components/MSimpleCarousel.vue +10 -1
- package/src/components/MSkeleton.vue +30 -8
- package/src/components/MSlider.vue +161 -42
- package/src/components/MSpotlightSearch.vue +3 -2
- package/src/components/MTextField.vue +15 -2
- package/src/components/MTimeline.vue +370 -81
- package/src/components/MToolbar.vue +256 -15
- package/src/components/MTooltip.vue +20 -152
- package/src/components/_MDrawerItemList.vue +25 -6
- package/src/components/_MToolbarFab.vue +14 -0
- package/src/composables/_containerTransform.ts +179 -0
- package/src/composables/_mapStyle.ts +45 -0
- package/src/composables/_themeTransition.ts +2 -0
- package/src/composables/_tooltipTrigger.ts +184 -0
- package/src/composables/_useEscapeStack.ts +2 -0
- package/src/composables/_useMenuNav.ts +209 -0
- package/src/composables/useAutoGrow.ts +78 -0
- package/src/composables/useContainerTransform.ts +59 -0
- package/src/composables/useLocale.ts +10 -0
- package/src/composables/useMap.ts +43 -5
- package/src/composables/useMapFilter.ts +6 -5
- package/src/composables/useMapLayers.ts +7 -6
- package/src/composables/useScrollReveal.ts +151 -0
- package/src/composables/useThemeTokens.ts +116 -0
- package/src/composables/viewportHints.ts +80 -0
- package/src/directives/vClickOutside.ts +90 -0
- package/src/directives/vFocusRing.ts +60 -0
- package/src/directives/vLongPress.ts +134 -0
- package/src/directives/vReveal.ts +57 -0
- package/src/directives/vScrollElevation.ts +116 -0
- package/src/directives/vSkeleton.ts +87 -0
- package/src/directives/vStateLayer.ts +83 -0
- package/src/directives/vSwipe.ts +197 -0
- package/src/directives/vTooltip.ts +128 -0
- package/src/index.ts +31 -1
- package/src/locales/de.ts +4 -0
- package/src/locales/es.ts +4 -0
- package/src/locales/fr.ts +4 -0
- package/src/locales/ja.ts +4 -0
- package/src/locales/ko.ts +4 -0
- package/src/locales/pt.ts +4 -0
- package/src/locales/zh.ts +4 -0
- package/src/map.ts +1 -1
- package/src/plugin.ts +34 -0
- package/src/styles/theme.css +63 -0
- package/dist/MMenuItem-BckcR0nW.js +0 -809
- package/dist/MMenuItem-BckcR0nW.js.map +0 -1
- package/dist/MSlider-LyH_gy8D.js +0 -1411
- package/dist/MSlider-LyH_gy8D.js.map +0 -1
- package/dist/MTextField-FCPOTB0o.js +0 -672
- package/dist/MTextField-FCPOTB0o.js.map +0 -1
- package/dist/composables/_useThemeTokens.d.ts +0 -7
- package/dist/useLocale-SfQHnJfp.js.map +0 -1
- package/src/composables/_useThemeTokens.ts +0 -42
package/dist/chart.js
CHANGED
|
@@ -1,59 +1,93 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as e } from "./useThemeTokens-Bv-Uv8eX.js";
|
|
2
|
+
import { computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, defineComponent as a, normalizeStyle as o, onMounted as s, openBlock as c, ref as l, resolveDynamicComponent as u, shallowRef as d, watch as f } from "vue";
|
|
2
3
|
//#endregion
|
|
3
4
|
//#region src/components/MChart.vue
|
|
4
|
-
var p = /* @__PURE__ */
|
|
5
|
+
var p = /* @__PURE__ */ a({
|
|
5
6
|
__name: "MChart",
|
|
6
7
|
props: {
|
|
7
8
|
type: {},
|
|
8
9
|
data: {},
|
|
9
10
|
options: {},
|
|
10
|
-
height: { default: "300px" }
|
|
11
|
+
height: { default: "300px" },
|
|
12
|
+
colors: {}
|
|
11
13
|
},
|
|
12
|
-
setup(
|
|
13
|
-
let p =
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
setup(a) {
|
|
15
|
+
let p = a, m = [
|
|
16
|
+
"primary",
|
|
17
|
+
"tertiary",
|
|
18
|
+
"secondary",
|
|
19
|
+
"success",
|
|
20
|
+
"error",
|
|
21
|
+
"outline"
|
|
22
|
+
], h = l(!1), g = d(null), _ = d({}), v = [
|
|
23
|
+
"primary",
|
|
24
|
+
"secondary",
|
|
25
|
+
"tertiary",
|
|
26
|
+
"error",
|
|
27
|
+
"success",
|
|
28
|
+
"outline",
|
|
29
|
+
"outline-variant",
|
|
30
|
+
"inverse-primary",
|
|
31
|
+
"primary-container",
|
|
32
|
+
"secondary-container",
|
|
33
|
+
"tertiary-container",
|
|
34
|
+
"error-container",
|
|
35
|
+
"success-container",
|
|
36
|
+
"on-surface",
|
|
37
|
+
"on-surface-variant",
|
|
38
|
+
"surface",
|
|
39
|
+
"surface-container"
|
|
40
|
+
], y = e(v), b = (e) => v.includes(e), x = (e) => b(e) ? y.value[e] : e, S = () => (typeof document > "u" ? "" : getComputedStyle(document.documentElement).getPropertyValue("--font-sans").trim()) || "'Roboto', system-ui, sans-serif", C = l(S()), w = t(() => ({
|
|
41
|
+
onSurface: y.value["on-surface"],
|
|
42
|
+
onSurfaceVariant: y.value["on-surface-variant"],
|
|
43
|
+
outlineVariant: y.value["outline-variant"],
|
|
44
|
+
surface: y.value.surface,
|
|
45
|
+
surfaceContainer: y.value["surface-container"],
|
|
46
|
+
fontFamily: C.value
|
|
47
|
+
}));
|
|
48
|
+
function T(e, t) {
|
|
49
|
+
let n = e.match(/^#([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i);
|
|
50
|
+
return n ? `rgba(${parseInt(n[1], 16)}, ${parseInt(n[2], 16)}, ${parseInt(n[3], 16)}, ${t})` : `color-mix(in srgb, ${e} ${Math.round(t * 100)}%, transparent)`;
|
|
51
|
+
}
|
|
52
|
+
let E = t(() => {
|
|
53
|
+
let e = p.data;
|
|
54
|
+
if (!Array.isArray(e?.datasets)) return e;
|
|
55
|
+
let t = (p.colors?.length ? p.colors : m).map(x), n = (e) => t[e % t.length], r = p.type === "pie" || p.type === "doughnut", i = e.datasets.map((e, t) => {
|
|
56
|
+
let i = {};
|
|
57
|
+
if (r) e.backgroundColor === void 0 && (i.backgroundColor = (e.data ?? []).map((e, t) => n(t))), e.borderColor === void 0 && (i.borderColor = w.value.surface);
|
|
58
|
+
else {
|
|
59
|
+
let r = n(t);
|
|
60
|
+
e.borderColor === void 0 && (i.borderColor = r), e.backgroundColor === void 0 && (i.backgroundColor = p.type === "bar" ? r : T(r, p.type === "radar" ? .2 : .15)), p.type !== "bar" && e.pointBackgroundColor === void 0 && (i.pointBackgroundColor = r);
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
...i,
|
|
64
|
+
...e
|
|
65
|
+
};
|
|
66
|
+
});
|
|
16
67
|
return {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
onSurfaceVariant: t("--color-on-surface-variant"),
|
|
20
|
-
outlineVariant: t("--color-outline-variant"),
|
|
21
|
-
surface: t("--color-surface"),
|
|
22
|
-
surfaceContainer: t("--color-surface-container"),
|
|
23
|
-
fontFamily: t("--font-sans") || "'Roboto', system-ui, sans-serif"
|
|
68
|
+
...e,
|
|
69
|
+
datasets: i
|
|
24
70
|
};
|
|
25
|
-
}
|
|
26
|
-
let v = l(_()), y = null;
|
|
71
|
+
});
|
|
27
72
|
s(async () => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}), y.observe(document.documentElement, {
|
|
31
|
-
attributes: !0,
|
|
32
|
-
attributeFilter: [
|
|
33
|
-
"class",
|
|
34
|
-
"style",
|
|
35
|
-
"data-palette"
|
|
36
|
-
]
|
|
37
|
-
}), document.fonts?.ready.then(() => {
|
|
38
|
-
v.value = _();
|
|
73
|
+
C.value = S(), document.fonts?.ready.then(() => {
|
|
74
|
+
C.value = S();
|
|
39
75
|
});
|
|
40
76
|
let [e, t] = await Promise.all([import("chart.js"), import("vue-chartjs")]);
|
|
41
|
-
e.Chart.register(e.CategoryScale, e.LinearScale, e.PointElement, e.LineElement, e.BarElement, e.ArcElement, e.RadialLinearScale, e.Filler, e.Tooltip, e.Legend, e.Title),
|
|
77
|
+
e.Chart.register(e.CategoryScale, e.LinearScale, e.PointElement, e.LineElement, e.BarElement, e.ArcElement, e.RadialLinearScale, e.Filler, e.Tooltip, e.Legend, e.Title), _.value = {
|
|
42
78
|
line: t.Line,
|
|
43
79
|
bar: t.Bar,
|
|
44
80
|
pie: t.Pie,
|
|
45
81
|
doughnut: t.Doughnut,
|
|
46
82
|
radar: t.Radar
|
|
47
|
-
},
|
|
48
|
-
}), o(() => {
|
|
49
|
-
y?.disconnect();
|
|
83
|
+
}, h.value = !0;
|
|
50
84
|
}), f(() => p.type, () => {
|
|
51
|
-
|
|
52
|
-
}, { immediate: !0 }), f(
|
|
53
|
-
|
|
85
|
+
h.value && (g.value = _.value[p.type] ?? null);
|
|
86
|
+
}, { immediate: !0 }), f(h, () => {
|
|
87
|
+
g.value = _.value[p.type] ?? null;
|
|
54
88
|
});
|
|
55
|
-
let
|
|
56
|
-
let e =
|
|
89
|
+
let D = t(() => {
|
|
90
|
+
let e = w.value, t = {
|
|
57
91
|
responsive: !0,
|
|
58
92
|
maintainAspectRatio: !1,
|
|
59
93
|
plugins: {
|
|
@@ -92,7 +126,7 @@ var p = /* @__PURE__ */ i({
|
|
|
92
126
|
return p.type !== "pie" && p.type !== "doughnut" && (t.scales = {
|
|
93
127
|
x: {
|
|
94
128
|
grid: {
|
|
95
|
-
color: e.outlineVariant
|
|
129
|
+
color: T(e.outlineVariant, .25),
|
|
96
130
|
drawTicks: !1
|
|
97
131
|
},
|
|
98
132
|
ticks: {
|
|
@@ -107,7 +141,7 @@ var p = /* @__PURE__ */ i({
|
|
|
107
141
|
},
|
|
108
142
|
y: {
|
|
109
143
|
grid: {
|
|
110
|
-
color: e.outlineVariant
|
|
144
|
+
color: T(e.outlineVariant, .25),
|
|
111
145
|
drawTicks: !1
|
|
112
146
|
},
|
|
113
147
|
ticks: {
|
|
@@ -121,8 +155,8 @@ var p = /* @__PURE__ */ i({
|
|
|
121
155
|
border: { color: e.outlineVariant }
|
|
122
156
|
}
|
|
123
157
|
}), p.type === "radar" && (t.scales = { r: {
|
|
124
|
-
grid: { color: e.outlineVariant
|
|
125
|
-
angleLines: { color: e.outlineVariant
|
|
158
|
+
grid: { color: T(e.outlineVariant, .25) },
|
|
159
|
+
angleLines: { color: T(e.outlineVariant, .25) },
|
|
126
160
|
pointLabels: {
|
|
127
161
|
color: e.onSurfaceVariant,
|
|
128
162
|
font: {
|
|
@@ -135,21 +169,21 @@ var p = /* @__PURE__ */ i({
|
|
|
135
169
|
backdropColor: "transparent",
|
|
136
170
|
font: { family: e.fontFamily }
|
|
137
171
|
}
|
|
138
|
-
} }),
|
|
172
|
+
} }), O(t, p.options ?? {});
|
|
139
173
|
});
|
|
140
|
-
function
|
|
174
|
+
function O(e, t) {
|
|
141
175
|
let n = { ...e };
|
|
142
|
-
for (let r of Object.keys(t)) n[r] = t[r] && typeof t[r] == "object" && !Array.isArray(t[r]) ?
|
|
176
|
+
for (let r of Object.keys(t)) n[r] = t[r] && typeof t[r] == "object" && !Array.isArray(t[r]) ? O(e[r] ?? {}, t[r]) : t[r];
|
|
143
177
|
return n;
|
|
144
178
|
}
|
|
145
|
-
return (e,
|
|
179
|
+
return (e, t) => (c(), i("div", {
|
|
146
180
|
class: "rounded-lg border border-outline-variant bg-surface p-4",
|
|
147
|
-
style:
|
|
148
|
-
}, [
|
|
181
|
+
style: o({ height: a.height })
|
|
182
|
+
}, [h.value && g.value ? (c(), n(u(g.value), {
|
|
149
183
|
key: 0,
|
|
150
|
-
data:
|
|
151
|
-
options:
|
|
152
|
-
}, null, 8, ["data", "options"])) :
|
|
184
|
+
data: E.value,
|
|
185
|
+
options: D.value
|
|
186
|
+
}, null, 8, ["data", "options"])) : r("", !0)], 4));
|
|
153
187
|
}
|
|
154
188
|
});
|
|
155
189
|
//#endregion
|
package/dist/chart.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart.js","names":[],"sources":["../src/components/MChart.vue","../src/components/MChart.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * A thin Chart.js wrapper — line, bar, pie, doughnut, and radar types, with legend/tooltip/axis colors that\n * automatically track the active M3 theme (light/dark, and any palette swap). Available from the `/chart` entry\n * point.\n */\nimport { computed, ref, watch, onMounted, onBeforeUnmount, shallowRef, type Component } from 'vue'\n\ntype ChartType = 'line' | 'bar' | 'pie' | 'doughnut' | 'radar'\n\nconst props = withDefaults(\n defineProps<{\n /** Chart type. Required — there is no default. */\n type: ChartType\n /** Chart.js data object with labels and datasets. Required — there is no default. */\n data: Record<string, any>\n /**\n * Chart.js options, deep-merged on top of MChart's own M3-themed defaults (legend/tooltip/axis colors that\n * track the active theme automatically)\n */\n options?: Record<string, any>\n /** Chart height */\n height?: string\n }>(),\n { height: '300px' },\n)\n\nconst ready = ref(false)\nconst chartComponent = shallowRef<Component | null>(null)\nconst componentMap = shallowRef<Record<string, Component>>({})\n\nfunction getM3Colors() {\n // No DOM on the server (SSR): the chart only draws on the client, which reads them again in onMounted\n const style = typeof document === 'undefined' ? null : getComputedStyle(document.documentElement)\n const get = (v: string) => style?.getPropertyValue(v).trim() ?? ''\n return {\n primary: get('--color-primary'),\n onSurface: get('--color-on-surface'),\n onSurfaceVariant: get('--color-on-surface-variant'),\n outlineVariant: get('--color-outline-variant'),\n surface: get('--color-surface'),\n surfaceContainer: get('--color-surface-container'),\n // Canvas can't resolve CSS vars, so pass Chart.js the resolved font stack\n fontFamily: get('--font-sans') || \"'Roboto', system-ui, sans-serif\",\n }\n}\n\nconst m3Colors = ref(getM3Colors())\n\nlet themeObserver: MutationObserver | null = null\n\nonMounted(async () => {\n m3Colors.value = getM3Colors()\n\n themeObserver = new MutationObserver(() => { m3Colors.value = getM3Colors() })\n // `class` flips light/dark, `data-palette` switches the palette (useColorPalette / createM3UI).\n themeObserver.observe(document.documentElement, { attributes: true, attributeFilter: ['class', 'style', 'data-palette'] })\n // Canvas text drawn before a web font finishes loading keeps the fallback, so redraw once it has\n document.fonts?.ready.then(() => { m3Colors.value = getM3Colors() })\n\n const [chartjs, vueChartjs] = await Promise.all([\n import('chart.js'),\n import('vue-chartjs'),\n ])\n\n chartjs.Chart.register(\n chartjs.CategoryScale,\n chartjs.LinearScale,\n chartjs.PointElement,\n chartjs.LineElement,\n chartjs.BarElement,\n chartjs.ArcElement,\n chartjs.RadialLinearScale,\n chartjs.Filler,\n chartjs.Tooltip,\n chartjs.Legend,\n chartjs.Title,\n )\n\n componentMap.value = {\n line: vueChartjs.Line,\n bar: vueChartjs.Bar,\n pie: vueChartjs.Pie,\n doughnut: vueChartjs.Doughnut,\n radar: vueChartjs.Radar,\n }\n\n ready.value = true\n})\n\nonBeforeUnmount(() => { themeObserver?.disconnect() })\n\nwatch(() => props.type, () => {\n if (ready.value) chartComponent.value = componentMap.value[props.type] ?? null\n}, { immediate: true })\n\nwatch(ready, () => {\n chartComponent.value = componentMap.value[props.type] ?? null\n})\n\nconst mergedOptions = computed<Record<string, any>>(() => {\n const c = m3Colors.value\n const base: Record<string, any> = {\n responsive: true,\n maintainAspectRatio: false,\n plugins: {\n legend: {\n labels: {\n color: c.onSurface,\n font: { family: c.fontFamily, size: 12 },\n usePointStyle: true,\n pointStyle: 'circle',\n padding: 16,\n },\n },\n tooltip: {\n backgroundColor: c.surfaceContainer,\n titleColor: c.onSurface,\n bodyColor: c.onSurfaceVariant,\n borderColor: c.outlineVariant,\n borderWidth: 1,\n cornerRadius: 12,\n padding: 12,\n titleFont: { family: c.fontFamily, size: 13, weight: '600' as const },\n bodyFont: { family: c.fontFamily, size: 12 },\n displayColors: true,\n boxPadding: 4,\n },\n },\n }\n\n if (props.type !== 'pie' && props.type !== 'doughnut') {\n base.scales = {\n x: {\n grid: { color: c.outlineVariant + '40', drawTicks: false },\n ticks: { color: c.onSurfaceVariant, font: { family: c.fontFamily, size: 11 }, padding: 8 },\n border: { color: c.outlineVariant },\n },\n y: {\n grid: { color: c.outlineVariant + '40', drawTicks: false },\n ticks: { color: c.onSurfaceVariant, font: { family: c.fontFamily, size: 11 }, padding: 8 },\n border: { color: c.outlineVariant },\n },\n }\n }\n\n if (props.type === 'radar') {\n base.scales = {\n r: {\n grid: { color: c.outlineVariant + '40' },\n angleLines: { color: c.outlineVariant + '40' },\n pointLabels: { color: c.onSurfaceVariant, font: { family: c.fontFamily, size: 11 } },\n ticks: { color: c.onSurfaceVariant, backdropColor: 'transparent', font: { family: c.fontFamily } },\n },\n }\n }\n\n return deepMerge(base, props.options ?? {})\n})\n\nfunction deepMerge(target: any, source: any): any {\n const output = { ...target }\n for (const key of Object.keys(source)) {\n if (source[key] && typeof source[key] === 'object' && !Array.isArray(source[key])) {\n output[key] = deepMerge(target[key] ?? {}, source[key])\n } else {\n output[key] = source[key]\n }\n }\n return output\n}\n</script>\n\n<template>\n <div class=\"rounded-lg border border-outline-variant bg-surface p-4\" :style=\"{ height }\">\n <component\n v-if=\"ready && chartComponent\"\n :is=\"chartComponent\"\n :data=\"data\"\n :options=\"mergedOptions\"\n />\n </div>\n</template>\n","<script setup lang=\"ts\">\n/**\n * A thin Chart.js wrapper — line, bar, pie, doughnut, and radar types, with legend/tooltip/axis colors that\n * automatically track the active M3 theme (light/dark, and any palette swap). Available from the `/chart` entry\n * point.\n */\nimport { computed, ref, watch, onMounted, onBeforeUnmount, shallowRef, type Component } from 'vue'\n\ntype ChartType = 'line' | 'bar' | 'pie' | 'doughnut' | 'radar'\n\nconst props = withDefaults(\n defineProps<{\n /** Chart type. Required — there is no default. */\n type: ChartType\n /** Chart.js data object with labels and datasets. Required — there is no default. */\n data: Record<string, any>\n /**\n * Chart.js options, deep-merged on top of MChart's own M3-themed defaults (legend/tooltip/axis colors that\n * track the active theme automatically)\n */\n options?: Record<string, any>\n /** Chart height */\n height?: string\n }>(),\n { height: '300px' },\n)\n\nconst ready = ref(false)\nconst chartComponent = shallowRef<Component | null>(null)\nconst componentMap = shallowRef<Record<string, Component>>({})\n\nfunction getM3Colors() {\n // No DOM on the server (SSR): the chart only draws on the client, which reads them again in onMounted\n const style = typeof document === 'undefined' ? null : getComputedStyle(document.documentElement)\n const get = (v: string) => style?.getPropertyValue(v).trim() ?? ''\n return {\n primary: get('--color-primary'),\n onSurface: get('--color-on-surface'),\n onSurfaceVariant: get('--color-on-surface-variant'),\n outlineVariant: get('--color-outline-variant'),\n surface: get('--color-surface'),\n surfaceContainer: get('--color-surface-container'),\n // Canvas can't resolve CSS vars, so pass Chart.js the resolved font stack\n fontFamily: get('--font-sans') || \"'Roboto', system-ui, sans-serif\",\n }\n}\n\nconst m3Colors = ref(getM3Colors())\n\nlet themeObserver: MutationObserver | null = null\n\nonMounted(async () => {\n m3Colors.value = getM3Colors()\n\n themeObserver = new MutationObserver(() => { m3Colors.value = getM3Colors() })\n // `class` flips light/dark, `data-palette` switches the palette (useColorPalette / createM3UI).\n themeObserver.observe(document.documentElement, { attributes: true, attributeFilter: ['class', 'style', 'data-palette'] })\n // Canvas text drawn before a web font finishes loading keeps the fallback, so redraw once it has\n document.fonts?.ready.then(() => { m3Colors.value = getM3Colors() })\n\n const [chartjs, vueChartjs] = await Promise.all([\n import('chart.js'),\n import('vue-chartjs'),\n ])\n\n chartjs.Chart.register(\n chartjs.CategoryScale,\n chartjs.LinearScale,\n chartjs.PointElement,\n chartjs.LineElement,\n chartjs.BarElement,\n chartjs.ArcElement,\n chartjs.RadialLinearScale,\n chartjs.Filler,\n chartjs.Tooltip,\n chartjs.Legend,\n chartjs.Title,\n )\n\n componentMap.value = {\n line: vueChartjs.Line,\n bar: vueChartjs.Bar,\n pie: vueChartjs.Pie,\n doughnut: vueChartjs.Doughnut,\n radar: vueChartjs.Radar,\n }\n\n ready.value = true\n})\n\nonBeforeUnmount(() => { themeObserver?.disconnect() })\n\nwatch(() => props.type, () => {\n if (ready.value) chartComponent.value = componentMap.value[props.type] ?? null\n}, { immediate: true })\n\nwatch(ready, () => {\n chartComponent.value = componentMap.value[props.type] ?? null\n})\n\nconst mergedOptions = computed<Record<string, any>>(() => {\n const c = m3Colors.value\n const base: Record<string, any> = {\n responsive: true,\n maintainAspectRatio: false,\n plugins: {\n legend: {\n labels: {\n color: c.onSurface,\n font: { family: c.fontFamily, size: 12 },\n usePointStyle: true,\n pointStyle: 'circle',\n padding: 16,\n },\n },\n tooltip: {\n backgroundColor: c.surfaceContainer,\n titleColor: c.onSurface,\n bodyColor: c.onSurfaceVariant,\n borderColor: c.outlineVariant,\n borderWidth: 1,\n cornerRadius: 12,\n padding: 12,\n titleFont: { family: c.fontFamily, size: 13, weight: '600' as const },\n bodyFont: { family: c.fontFamily, size: 12 },\n displayColors: true,\n boxPadding: 4,\n },\n },\n }\n\n if (props.type !== 'pie' && props.type !== 'doughnut') {\n base.scales = {\n x: {\n grid: { color: c.outlineVariant + '40', drawTicks: false },\n ticks: { color: c.onSurfaceVariant, font: { family: c.fontFamily, size: 11 }, padding: 8 },\n border: { color: c.outlineVariant },\n },\n y: {\n grid: { color: c.outlineVariant + '40', drawTicks: false },\n ticks: { color: c.onSurfaceVariant, font: { family: c.fontFamily, size: 11 }, padding: 8 },\n border: { color: c.outlineVariant },\n },\n }\n }\n\n if (props.type === 'radar') {\n base.scales = {\n r: {\n grid: { color: c.outlineVariant + '40' },\n angleLines: { color: c.outlineVariant + '40' },\n pointLabels: { color: c.onSurfaceVariant, font: { family: c.fontFamily, size: 11 } },\n ticks: { color: c.onSurfaceVariant, backdropColor: 'transparent', font: { family: c.fontFamily } },\n },\n }\n }\n\n return deepMerge(base, props.options ?? {})\n})\n\nfunction deepMerge(target: any, source: any): any {\n const output = { ...target }\n for (const key of Object.keys(source)) {\n if (source[key] && typeof source[key] === 'object' && !Array.isArray(source[key])) {\n output[key] = deepMerge(target[key] ?? {}, source[key])\n } else {\n output[key] = source[key]\n }\n }\n return output\n}\n</script>\n\n<template>\n <div class=\"rounded-lg border border-outline-variant bg-surface p-4\" :style=\"{ height }\">\n <component\n v-if=\"ready && chartComponent\"\n :is=\"chartComponent\"\n :data=\"data\"\n :options=\"mergedOptions\"\n />\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;EAUA,IAAM,IAAQ,GAiBR,IAAQ,EAAI,EAAK,GACjB,IAAiB,EAA6B,IAAI,GAClD,IAAe,EAAsC,CAAC,CAAC;EAE7D,SAAS,IAAc;GAErB,IAAM,IAAQ,OAAO,WAAa,MAAc,OAAO,iBAAiB,SAAS,eAAe,GAC1F,KAAO,MAAc,GAAO,iBAAiB,CAAC,CAAC,CAAC,KAAK,KAAK;GAChE,OAAO;IACL,SAAS,EAAI,iBAAiB;IAC9B,WAAW,EAAI,oBAAoB;IACnC,kBAAkB,EAAI,4BAA4B;IAClD,gBAAgB,EAAI,yBAAyB;IAC7C,SAAS,EAAI,iBAAiB;IAC9B,kBAAkB,EAAI,2BAA2B;IAEjD,YAAY,EAAI,aAAa,KAAK;GACpC;EACF;EAEA,IAAM,IAAW,EAAI,EAAY,CAAC,GAE9B,IAAyC;EA+C7C,AA7CA,EAAU,YAAY;GAOpB,AANA,EAAS,QAAQ,EAAY,GAE7B,IAAgB,IAAI,uBAAuB;IAAE,EAAS,QAAQ,EAAY;GAAE,CAAC,GAE7E,EAAc,QAAQ,SAAS,iBAAiB;IAAE,YAAY;IAAM,iBAAiB;KAAC;KAAS;KAAS;IAAc;GAAE,CAAC,GAEzH,SAAS,OAAO,MAAM,WAAW;IAAE,EAAS,QAAQ,EAAY;GAAE,CAAC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ClB,MAAM,EAAA;GACN,SAAS,EAAA"}
|
|
1
|
+
{"version":3,"file":"chart.js","names":[],"sources":["../src/components/MChart.vue","../src/components/MChart.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * A thin Chart.js wrapper — line, bar, pie, doughnut, and radar types, with legend/tooltip/axis colors that\n * automatically track the active M3 theme (light/dark, palette, contrast). Datasets without colors of their own get\n * the theme's too, one per series (one per slice in a pie or doughnut). Available from the `/chart` entry point.\n */\nimport { computed, ref, watch, onMounted, shallowRef, type Component } from 'vue'\nimport { useThemeTokens } from '../composables/useThemeTokens'\n\ntype ChartType = 'line' | 'bar' | 'pie' | 'doughnut' | 'radar'\n\nconst props = withDefaults(\n defineProps<{\n /** Chart type. Required — there is no default. */\n type: ChartType\n /** Chart.js data object with labels and datasets. Required — there is no default. */\n data: Record<string, any>\n /**\n * Chart.js options, deep-merged on top of MChart's own M3-themed defaults (legend/tooltip/axis colors that\n * track the active theme automatically)\n */\n options?: Record<string, any>\n /** Chart height */\n height?: string\n /**\n * Colors for datasets that don't set their own, in order (one per series; per slice in a pie or doughnut): M3\n * role names (`primary`, `tertiary-container`…) or any CSS colors. Default primary, tertiary, secondary, success,\n * error, outline\n */\n colors?: string[]\n }>(),\n { height: '300px' },\n)\n\nconst SERIES = ['primary', 'tertiary', 'secondary', 'success', 'error', 'outline']\n\nconst ready = ref(false)\nconst chartComponent = shallowRef<Component | null>(null)\nconst componentMap = shallowRef<Record<string, Component>>({})\n\n// Every role a color list may name, read as plain strings (a canvas can't resolve CSS variables) and kept current\n// across theme, palette, contrast and generated-palette changes, settled after the switch's color transition\nconst ROLES = [\n 'primary', 'secondary', 'tertiary', 'error', 'success', 'outline', 'outline-variant', 'inverse-primary',\n 'primary-container', 'secondary-container', 'tertiary-container', 'error-container', 'success-container',\n 'on-surface', 'on-surface-variant', 'surface', 'surface-container',\n] as const\nconst tokens = useThemeTokens(ROLES)\nconst isRole = (c: string): c is (typeof ROLES)[number] => (ROLES as readonly string[]).includes(c)\nconst resolve = (c: string) => (isRole(c) ? tokens.value[c] : c)\n\n// Canvas can't resolve CSS vars either for fonts: pass Chart.js the resolved stack, read again once web fonts load\n// (text drawn before keeps the fallback)\nconst readFont = () =>\n (typeof document === 'undefined' ? '' : getComputedStyle(document.documentElement).getPropertyValue('--font-sans').trim())\n || \"'Roboto', system-ui, sans-serif\"\nconst fontFamily = ref(readFont())\n\nconst m3Colors = computed(() => ({\n onSurface: tokens.value['on-surface'],\n onSurfaceVariant: tokens.value['on-surface-variant'],\n outlineVariant: tokens.value['outline-variant'],\n surface: tokens.value.surface,\n surfaceContainer: tokens.value['surface-container'],\n fontFamily: fontFamily.value,\n}))\n\n/** A color at some opacity, for fills under a line or inside a radar. */\nfunction withAlpha(color: string, a: number) {\n const m = color.match(/^#([\\da-f]{2})([\\da-f]{2})([\\da-f]{2})$/i)\n if (m) return `rgba(${parseInt(m[1]!, 16)}, ${parseInt(m[2]!, 16)}, ${parseInt(m[3]!, 16)}, ${a})`\n return `color-mix(in srgb, ${color} ${Math.round(a * 100)}%, transparent)`\n}\n\n// Datasets without colors get the theme's: only the keys they leave unset, so a consumer's own colors always win\nconst themedData = computed(() => {\n const data = props.data\n if (!Array.isArray(data?.datasets)) return data\n const palette = (props.colors?.length ? props.colors : SERIES).map(resolve)\n const at = (i: number) => palette[i % palette.length]!\n const slices = props.type === 'pie' || props.type === 'doughnut'\n const datasets = data.datasets.map((ds: Record<string, any>, i: number) => {\n const fill: Record<string, any> = {}\n if (slices) {\n if (ds.backgroundColor === undefined) fill.backgroundColor = (ds.data ?? []).map((_: unknown, j: number) => at(j))\n // Slices separated by the card's own color\n if (ds.borderColor === undefined) fill.borderColor = m3Colors.value.surface\n } else {\n const c = at(i)\n if (ds.borderColor === undefined) fill.borderColor = c\n if (ds.backgroundColor === undefined) fill.backgroundColor = props.type === 'bar' ? c : withAlpha(c, props.type === 'radar' ? 0.2 : 0.15)\n if (props.type !== 'bar' && ds.pointBackgroundColor === undefined) fill.pointBackgroundColor = c\n }\n return { ...fill, ...ds }\n })\n return { ...data, datasets }\n})\n\nonMounted(async () => {\n fontFamily.value = readFont()\n document.fonts?.ready.then(() => { fontFamily.value = readFont() })\n\n const [chartjs, vueChartjs] = await Promise.all([\n import('chart.js'),\n import('vue-chartjs'),\n ])\n\n chartjs.Chart.register(\n chartjs.CategoryScale,\n chartjs.LinearScale,\n chartjs.PointElement,\n chartjs.LineElement,\n chartjs.BarElement,\n chartjs.ArcElement,\n chartjs.RadialLinearScale,\n chartjs.Filler,\n chartjs.Tooltip,\n chartjs.Legend,\n chartjs.Title,\n )\n\n componentMap.value = {\n line: vueChartjs.Line,\n bar: vueChartjs.Bar,\n pie: vueChartjs.Pie,\n doughnut: vueChartjs.Doughnut,\n radar: vueChartjs.Radar,\n }\n\n ready.value = true\n})\n\nwatch(() => props.type, () => {\n if (ready.value) chartComponent.value = componentMap.value[props.type] ?? null\n}, { immediate: true })\n\nwatch(ready, () => {\n chartComponent.value = componentMap.value[props.type] ?? null\n})\n\nconst mergedOptions = computed<Record<string, any>>(() => {\n const c = m3Colors.value\n const base: Record<string, any> = {\n responsive: true,\n maintainAspectRatio: false,\n plugins: {\n legend: {\n labels: {\n color: c.onSurface,\n font: { family: c.fontFamily, size: 12 },\n usePointStyle: true,\n pointStyle: 'circle',\n padding: 16,\n },\n },\n tooltip: {\n backgroundColor: c.surfaceContainer,\n titleColor: c.onSurface,\n bodyColor: c.onSurfaceVariant,\n borderColor: c.outlineVariant,\n borderWidth: 1,\n cornerRadius: 12,\n padding: 12,\n titleFont: { family: c.fontFamily, size: 13, weight: '600' as const },\n bodyFont: { family: c.fontFamily, size: 12 },\n displayColors: true,\n boxPadding: 4,\n },\n },\n }\n\n if (props.type !== 'pie' && props.type !== 'doughnut') {\n base.scales = {\n x: {\n grid: { color: withAlpha(c.outlineVariant, 0.25), drawTicks: false },\n ticks: { color: c.onSurfaceVariant, font: { family: c.fontFamily, size: 11 }, padding: 8 },\n border: { color: c.outlineVariant },\n },\n y: {\n grid: { color: withAlpha(c.outlineVariant, 0.25), drawTicks: false },\n ticks: { color: c.onSurfaceVariant, font: { family: c.fontFamily, size: 11 }, padding: 8 },\n border: { color: c.outlineVariant },\n },\n }\n }\n\n if (props.type === 'radar') {\n base.scales = {\n r: {\n grid: { color: withAlpha(c.outlineVariant, 0.25) },\n angleLines: { color: withAlpha(c.outlineVariant, 0.25) },\n pointLabels: { color: c.onSurfaceVariant, font: { family: c.fontFamily, size: 11 } },\n ticks: { color: c.onSurfaceVariant, backdropColor: 'transparent', font: { family: c.fontFamily } },\n },\n }\n }\n\n return deepMerge(base, props.options ?? {})\n})\n\nfunction deepMerge(target: any, source: any): any {\n const output = { ...target }\n for (const key of Object.keys(source)) {\n if (source[key] && typeof source[key] === 'object' && !Array.isArray(source[key])) {\n output[key] = deepMerge(target[key] ?? {}, source[key])\n } else {\n output[key] = source[key]\n }\n }\n return output\n}\n</script>\n\n<template>\n <div class=\"rounded-lg border border-outline-variant bg-surface p-4\" :style=\"{ height }\">\n <component\n v-if=\"ready && chartComponent\"\n :is=\"chartComponent\"\n :data=\"themedData\"\n :options=\"mergedOptions\"\n />\n </div>\n</template>\n","<script setup lang=\"ts\">\n/**\n * A thin Chart.js wrapper — line, bar, pie, doughnut, and radar types, with legend/tooltip/axis colors that\n * automatically track the active M3 theme (light/dark, palette, contrast). Datasets without colors of their own get\n * the theme's too, one per series (one per slice in a pie or doughnut). Available from the `/chart` entry point.\n */\nimport { computed, ref, watch, onMounted, shallowRef, type Component } from 'vue'\nimport { useThemeTokens } from '../composables/useThemeTokens'\n\ntype ChartType = 'line' | 'bar' | 'pie' | 'doughnut' | 'radar'\n\nconst props = withDefaults(\n defineProps<{\n /** Chart type. Required — there is no default. */\n type: ChartType\n /** Chart.js data object with labels and datasets. Required — there is no default. */\n data: Record<string, any>\n /**\n * Chart.js options, deep-merged on top of MChart's own M3-themed defaults (legend/tooltip/axis colors that\n * track the active theme automatically)\n */\n options?: Record<string, any>\n /** Chart height */\n height?: string\n /**\n * Colors for datasets that don't set their own, in order (one per series; per slice in a pie or doughnut): M3\n * role names (`primary`, `tertiary-container`…) or any CSS colors. Default primary, tertiary, secondary, success,\n * error, outline\n */\n colors?: string[]\n }>(),\n { height: '300px' },\n)\n\nconst SERIES = ['primary', 'tertiary', 'secondary', 'success', 'error', 'outline']\n\nconst ready = ref(false)\nconst chartComponent = shallowRef<Component | null>(null)\nconst componentMap = shallowRef<Record<string, Component>>({})\n\n// Every role a color list may name, read as plain strings (a canvas can't resolve CSS variables) and kept current\n// across theme, palette, contrast and generated-palette changes, settled after the switch's color transition\nconst ROLES = [\n 'primary', 'secondary', 'tertiary', 'error', 'success', 'outline', 'outline-variant', 'inverse-primary',\n 'primary-container', 'secondary-container', 'tertiary-container', 'error-container', 'success-container',\n 'on-surface', 'on-surface-variant', 'surface', 'surface-container',\n] as const\nconst tokens = useThemeTokens(ROLES)\nconst isRole = (c: string): c is (typeof ROLES)[number] => (ROLES as readonly string[]).includes(c)\nconst resolve = (c: string) => (isRole(c) ? tokens.value[c] : c)\n\n// Canvas can't resolve CSS vars either for fonts: pass Chart.js the resolved stack, read again once web fonts load\n// (text drawn before keeps the fallback)\nconst readFont = () =>\n (typeof document === 'undefined' ? '' : getComputedStyle(document.documentElement).getPropertyValue('--font-sans').trim())\n || \"'Roboto', system-ui, sans-serif\"\nconst fontFamily = ref(readFont())\n\nconst m3Colors = computed(() => ({\n onSurface: tokens.value['on-surface'],\n onSurfaceVariant: tokens.value['on-surface-variant'],\n outlineVariant: tokens.value['outline-variant'],\n surface: tokens.value.surface,\n surfaceContainer: tokens.value['surface-container'],\n fontFamily: fontFamily.value,\n}))\n\n/** A color at some opacity, for fills under a line or inside a radar. */\nfunction withAlpha(color: string, a: number) {\n const m = color.match(/^#([\\da-f]{2})([\\da-f]{2})([\\da-f]{2})$/i)\n if (m) return `rgba(${parseInt(m[1]!, 16)}, ${parseInt(m[2]!, 16)}, ${parseInt(m[3]!, 16)}, ${a})`\n return `color-mix(in srgb, ${color} ${Math.round(a * 100)}%, transparent)`\n}\n\n// Datasets without colors get the theme's: only the keys they leave unset, so a consumer's own colors always win\nconst themedData = computed(() => {\n const data = props.data\n if (!Array.isArray(data?.datasets)) return data\n const palette = (props.colors?.length ? props.colors : SERIES).map(resolve)\n const at = (i: number) => palette[i % palette.length]!\n const slices = props.type === 'pie' || props.type === 'doughnut'\n const datasets = data.datasets.map((ds: Record<string, any>, i: number) => {\n const fill: Record<string, any> = {}\n if (slices) {\n if (ds.backgroundColor === undefined) fill.backgroundColor = (ds.data ?? []).map((_: unknown, j: number) => at(j))\n // Slices separated by the card's own color\n if (ds.borderColor === undefined) fill.borderColor = m3Colors.value.surface\n } else {\n const c = at(i)\n if (ds.borderColor === undefined) fill.borderColor = c\n if (ds.backgroundColor === undefined) fill.backgroundColor = props.type === 'bar' ? c : withAlpha(c, props.type === 'radar' ? 0.2 : 0.15)\n if (props.type !== 'bar' && ds.pointBackgroundColor === undefined) fill.pointBackgroundColor = c\n }\n return { ...fill, ...ds }\n })\n return { ...data, datasets }\n})\n\nonMounted(async () => {\n fontFamily.value = readFont()\n document.fonts?.ready.then(() => { fontFamily.value = readFont() })\n\n const [chartjs, vueChartjs] = await Promise.all([\n import('chart.js'),\n import('vue-chartjs'),\n ])\n\n chartjs.Chart.register(\n chartjs.CategoryScale,\n chartjs.LinearScale,\n chartjs.PointElement,\n chartjs.LineElement,\n chartjs.BarElement,\n chartjs.ArcElement,\n chartjs.RadialLinearScale,\n chartjs.Filler,\n chartjs.Tooltip,\n chartjs.Legend,\n chartjs.Title,\n )\n\n componentMap.value = {\n line: vueChartjs.Line,\n bar: vueChartjs.Bar,\n pie: vueChartjs.Pie,\n doughnut: vueChartjs.Doughnut,\n radar: vueChartjs.Radar,\n }\n\n ready.value = true\n})\n\nwatch(() => props.type, () => {\n if (ready.value) chartComponent.value = componentMap.value[props.type] ?? null\n}, { immediate: true })\n\nwatch(ready, () => {\n chartComponent.value = componentMap.value[props.type] ?? null\n})\n\nconst mergedOptions = computed<Record<string, any>>(() => {\n const c = m3Colors.value\n const base: Record<string, any> = {\n responsive: true,\n maintainAspectRatio: false,\n plugins: {\n legend: {\n labels: {\n color: c.onSurface,\n font: { family: c.fontFamily, size: 12 },\n usePointStyle: true,\n pointStyle: 'circle',\n padding: 16,\n },\n },\n tooltip: {\n backgroundColor: c.surfaceContainer,\n titleColor: c.onSurface,\n bodyColor: c.onSurfaceVariant,\n borderColor: c.outlineVariant,\n borderWidth: 1,\n cornerRadius: 12,\n padding: 12,\n titleFont: { family: c.fontFamily, size: 13, weight: '600' as const },\n bodyFont: { family: c.fontFamily, size: 12 },\n displayColors: true,\n boxPadding: 4,\n },\n },\n }\n\n if (props.type !== 'pie' && props.type !== 'doughnut') {\n base.scales = {\n x: {\n grid: { color: withAlpha(c.outlineVariant, 0.25), drawTicks: false },\n ticks: { color: c.onSurfaceVariant, font: { family: c.fontFamily, size: 11 }, padding: 8 },\n border: { color: c.outlineVariant },\n },\n y: {\n grid: { color: withAlpha(c.outlineVariant, 0.25), drawTicks: false },\n ticks: { color: c.onSurfaceVariant, font: { family: c.fontFamily, size: 11 }, padding: 8 },\n border: { color: c.outlineVariant },\n },\n }\n }\n\n if (props.type === 'radar') {\n base.scales = {\n r: {\n grid: { color: withAlpha(c.outlineVariant, 0.25) },\n angleLines: { color: withAlpha(c.outlineVariant, 0.25) },\n pointLabels: { color: c.onSurfaceVariant, font: { family: c.fontFamily, size: 11 } },\n ticks: { color: c.onSurfaceVariant, backdropColor: 'transparent', font: { family: c.fontFamily } },\n },\n }\n }\n\n return deepMerge(base, props.options ?? {})\n})\n\nfunction deepMerge(target: any, source: any): any {\n const output = { ...target }\n for (const key of Object.keys(source)) {\n if (source[key] && typeof source[key] === 'object' && !Array.isArray(source[key])) {\n output[key] = deepMerge(target[key] ?? {}, source[key])\n } else {\n output[key] = source[key]\n }\n }\n return output\n}\n</script>\n\n<template>\n <div class=\"rounded-lg border border-outline-variant bg-surface p-4\" :style=\"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AAE;KACzF,QAAQ,EAAE,OAAO,EAAE,eAAe;IACpC;GACF,IAGE,EAAM,SAAS,YACjB,EAAK,SAAS,EACZ,GAAG;IACD,MAAM,EAAE,OAAO,EAAU,EAAE,gBAAgB,GAAI,EAAE;IACjD,YAAY,EAAE,OAAO,EAAU,EAAE,gBAAgB,GAAI,EAAE;IACvD,aAAa;KAAE,OAAO,EAAE;KAAkB,MAAM;MAAE,QAAQ,EAAE;MAAY,MAAM;KAAG;IAAE;IACnF,OAAO;KAAE,OAAO,EAAE;KAAkB,eAAe;KAAe,MAAM,EAAE,QAAQ,EAAE,WAAW;IAAE;GACnG,EACF,IAGK,EAAU,GAAM,EAAM,WAAW,CAAC,CAAC;EAC5C,CAAC;EAED,SAAS,EAAU,GAAa,GAAkB;GAChD,IAAM,IAAS,EAAE,GAAG,EAAO;GAC3B,KAAK,IAAM,KAAO,OAAO,KAAK,CAAM,GAClC,AAGE,EAAO,KAHL,EAAO,MAAQ,OAAO,EAAO,MAAS,YAAY,CAAC,MAAM,QAAQ,EAAO,EAAI,IAChE,EAAU,EAAO,MAAQ,CAAC,GAAG,EAAO,EAAI,IAExC,EAAO;GAGzB,OAAO;EACT;oBAIE,EAAA,GAAA,EAOM,OAAA;GAPD,OAAM;GAA2D,OAAK,EAAA,EAAA,QAAI,EAAA,OAAM,CAAA;EAE3E,GAAA,CAAA,EAAA,SAAS,EAAA,SADjB,EAAA,GAAA,EAKE,EAHK,EAAA,KAAc,GAAA;;GAClB,MAAM,EAAA;GACN,SAAS,EAAA"}
|
package/dist/code-editor.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as e } from "./useLocale-
|
|
1
|
+
import { i as e } from "./useLocale-JYxDDeXC.js";
|
|
2
2
|
import { t } from "./MIcon-Bxh9j135.js";
|
|
3
3
|
import { t as n } from "./_plugin-vue_export-helper-B3ysoDQm.js";
|
|
4
4
|
import { computed as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createTextVNode as s, createVNode as c, defineComponent as l, normalizeClass as u, normalizeStyle as d, onBeforeUnmount as f, onMounted as p, openBlock as m, ref as h, renderSlot as g, toDisplayString as _, watch as v, withCtx as y } from "vue";
|
|
@@ -10,7 +10,9 @@ type __VLS_Props = {
|
|
|
10
10
|
/**
|
|
11
11
|
* Intl options for the type: `{ style: 'currency', currency: 'EUR' }`, `{ style: 'percent' }`,
|
|
12
12
|
* `{ style: 'unit', unit: 'kilometer-per-hour' }`, `{ notation: 'compact' }` for numbers; `{ timeStyle: 'medium' }`
|
|
13
|
-
* (the default), `{ hour: '2-digit', minute: '2-digit' }`, `{ dateStyle: 'short' }` for times. Unused for durations
|
|
13
|
+
* (the default), `{ hour: '2-digit', minute: '2-digit' }`, `{ dateStyle: 'short' }` for times. Unused for durations.
|
|
14
|
+
* Dollar-sign currencies show their country (`AR$`, `MX$`, `US$`) in any language; set `currencyDisplay` for
|
|
15
|
+
* Intl's own output (`'symbol'` gives the local peso as a plain `$`)
|
|
14
16
|
*/
|
|
15
17
|
format?: Intl.NumberFormatOptions | Intl.DateTimeFormatOptions;
|
|
16
18
|
/** BCP-47 language for the format (`es-AR` for Argentine pesos and separators); defaults to the app's locale */
|
|
@@ -15,6 +15,8 @@ type __VLS_Props = {
|
|
|
15
15
|
loading?: boolean;
|
|
16
16
|
/** Material Symbol icon name shown next to the label */
|
|
17
17
|
icon?: string;
|
|
18
|
+
/** Draw the icon filled (Material Symbols' FILL axis), e.g. a starred star or a play icon */
|
|
19
|
+
iconFilled?: boolean;
|
|
18
20
|
/** Which side of the label the icon renders on */
|
|
19
21
|
iconPos?: 'leading' | 'trailing';
|
|
20
22
|
/**
|
|
@@ -31,6 +33,12 @@ type __VLS_Props = {
|
|
|
31
33
|
to?: string | Record<string, any>;
|
|
32
34
|
/** Any CSS color for the press ripple; defaults to the button's content color */
|
|
33
35
|
rippleColor?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Label and icon color, over what the variant and `color` give: an M3 role (`on-surface` for a neutral text
|
|
38
|
+
* button, `on-primary-container`…) or any CSS color (`#000` on a white filled button). Disabled buttons keep
|
|
39
|
+
* their own
|
|
40
|
+
*/
|
|
41
|
+
contentColor?: string;
|
|
34
42
|
};
|
|
35
43
|
declare var __VLS_18: {};
|
|
36
44
|
type __VLS_Slots = {} & {
|
|
@@ -42,8 +50,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
|
|
|
42
50
|
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
43
51
|
loading: boolean;
|
|
44
52
|
variant: "filled" | "tonal" | "outlined" | "text" | "elevated";
|
|
45
|
-
shape: "rounded" | "squared";
|
|
46
53
|
disabled: boolean;
|
|
54
|
+
shape: "rounded" | "squared";
|
|
47
55
|
iconPos: "leading" | "trailing";
|
|
48
56
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
49
57
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -1,37 +1,46 @@
|
|
|
1
|
-
export interface ButtonGroupOption {
|
|
2
|
-
value:
|
|
1
|
+
export interface ButtonGroupOption<T = unknown> {
|
|
2
|
+
value: T;
|
|
3
3
|
label?: string;
|
|
4
4
|
icon?: string;
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
}
|
|
7
|
-
type __VLS_Props = {
|
|
8
|
-
/** Selected value(s) — any type (v-model) */
|
|
9
|
-
modelValue: unknown;
|
|
10
|
-
/** The options to choose from; see `ButtonGroupOption`. */
|
|
11
|
-
options: ButtonGroupOption[];
|
|
12
|
-
/** Standard (separated) or connected (joined) */
|
|
13
|
-
variant?: 'standard' | 'connected';
|
|
14
|
-
/** Button size */
|
|
15
|
-
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
16
|
-
/** Allow multiple selections */
|
|
17
|
-
multiSelect?: boolean;
|
|
18
|
-
/** At least one must be selected */
|
|
19
|
-
selectionRequired?: boolean;
|
|
20
|
-
/** Selected button color */
|
|
21
|
-
color?: 'primary' | 'secondary' | 'tertiary';
|
|
22
|
-
/** Any CSS color for the press ripple; defaults to the button's content color */
|
|
23
|
-
rippleColor?: string;
|
|
24
|
-
};
|
|
25
|
-
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
26
|
-
"update:modelValue": (args_0: unknown) => any;
|
|
27
|
-
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
28
|
-
"onUpdate:modelValue"?: ((args_0: unknown) => any) | undefined;
|
|
29
|
-
}>, {
|
|
30
|
-
color: "primary" | "secondary" | "tertiary";
|
|
31
|
-
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
32
|
-
variant: "standard" | "connected";
|
|
33
|
-
multiSelect: boolean;
|
|
34
|
-
selectionRequired: boolean;
|
|
35
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
36
7
|
declare const _default: typeof __VLS_export;
|
|
37
8
|
export default _default;
|
|
9
|
+
declare const __VLS_export: <T, M extends T | T[] | null = T | null>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
10
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<{
|
|
11
|
+
/**
|
|
12
|
+
* Selected value (null when none), or values with `multiSelect` (v-model) — any type, typed after the options'
|
|
13
|
+
* values
|
|
14
|
+
*/
|
|
15
|
+
modelValue: M;
|
|
16
|
+
/** The options to choose from; see `ButtonGroupOption`. */
|
|
17
|
+
options: ButtonGroupOption<T>[];
|
|
18
|
+
/** Standard (separated) or connected (joined) */
|
|
19
|
+
variant?: "standard" | "connected";
|
|
20
|
+
/** Button size */
|
|
21
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
22
|
+
/** Allow multiple selections */
|
|
23
|
+
multiSelect?: boolean;
|
|
24
|
+
/** At least one must be selected */
|
|
25
|
+
selectionRequired?: boolean;
|
|
26
|
+
/** Selected button color */
|
|
27
|
+
color?: "primary" | "secondary" | "tertiary";
|
|
28
|
+
/** Any CSS color for the press ripple; defaults to the button's content color */
|
|
29
|
+
rippleColor?: string;
|
|
30
|
+
} & {
|
|
31
|
+
"onUpdate:modelValue"?: ((args_0: M) => any) | undefined;
|
|
32
|
+
}> & (typeof globalThis extends {
|
|
33
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
34
|
+
} ? P : {});
|
|
35
|
+
expose: (exposed: {}) => void;
|
|
36
|
+
attrs: any;
|
|
37
|
+
slots: {};
|
|
38
|
+
emit: (evt: "update:modelValue", args_0: M) => void;
|
|
39
|
+
}>) => import("vue").VNode & {
|
|
40
|
+
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
41
|
+
};
|
|
42
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
43
|
+
[K in keyof T]: T[K];
|
|
44
|
+
} : {
|
|
45
|
+
[K in keyof T as K]: T[K];
|
|
46
|
+
}) & {};
|
|
@@ -49,6 +49,8 @@ declare const __VLS_export: <T = CarouselItem>(__VLS_props: NonNullable<Awaited<
|
|
|
49
49
|
scrollToItem: (index: number, animate?: boolean) => void;
|
|
50
50
|
next: () => void;
|
|
51
51
|
prev: () => void;
|
|
52
|
+
/** Moves keyboard focus to the carousel, so the arrow keys scroll it */
|
|
53
|
+
focus: (options?: FocusOptions) => void | undefined;
|
|
52
54
|
}>) => void;
|
|
53
55
|
attrs: any;
|
|
54
56
|
slots: {
|
|
@@ -11,6 +11,12 @@ type __VLS_Props = {
|
|
|
11
11
|
options?: Record<string, any>;
|
|
12
12
|
/** Chart height */
|
|
13
13
|
height?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Colors for datasets that don't set their own, in order (one per series; per slice in a pie or doughnut): M3
|
|
16
|
+
* role names (`primary`, `tertiary-container`…) or any CSS colors. Default primary, tertiary, secondary, success,
|
|
17
|
+
* error, outline
|
|
18
|
+
*/
|
|
19
|
+
colors?: string[];
|
|
14
20
|
};
|
|
15
21
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
16
22
|
height: string;
|
|
@@ -3,8 +3,10 @@ type __VLS_Props = {
|
|
|
3
3
|
value?: number;
|
|
4
4
|
/** Spinning arc — no value needed. Identical for both variants. */
|
|
5
5
|
indeterminate?: boolean;
|
|
6
|
-
/** Ring color */
|
|
7
|
-
color?: "primary" | "secondary" | "tertiary" | "error";
|
|
6
|
+
/** Ring color: an M3 role or any CSS color */
|
|
7
|
+
color?: "primary" | "secondary" | "tertiary" | "error" | (string & {});
|
|
8
|
+
/** Track color: an M3 role or any CSS color. Default the role's container, or the ring color at 24% for a CSS color */
|
|
9
|
+
trackColor?: string;
|
|
8
10
|
/** wavy: animated bumpy ring that fades to circle near 0% and 100%; circle: smooth arc */
|
|
9
11
|
variant?: "circle" | "wavy";
|
|
10
12
|
/** Label text below the circle */
|
|
@@ -19,7 +21,7 @@ type __VLS_Slots = {} & {
|
|
|
19
21
|
default?: (props: typeof __VLS_1) => any;
|
|
20
22
|
};
|
|
21
23
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
22
|
-
color: "primary" | "secondary" | "tertiary" | "error";
|
|
24
|
+
color: "primary" | "secondary" | "tertiary" | "error" | (string & {});
|
|
23
25
|
variant: "circle" | "wavy";
|
|
24
26
|
thickness: number;
|
|
25
27
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type ContainerTransformController } from '../composables/useContainerTransform';
|
|
2
|
+
declare const __VLS_export: <T = unknown>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
3
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<({
|
|
4
|
+
/** A `useContainerTransform()` controller, to open it from elements elsewhere (`controller.open($event, item)`) */
|
|
5
|
+
controller?: ContainerTransformController<T>;
|
|
6
|
+
/**
|
|
7
|
+
* Where the expanded view opens: over the whole screen, as a centered panel (wider screens), or `custom`: the
|
|
8
|
+
* classes you give the component place and size it (`bottom-4 right-4 w-80 h-96`, `inset-y-0 right-0 w-96`…),
|
|
9
|
+
* anywhere over the page
|
|
10
|
+
*/
|
|
11
|
+
mode?: "fullscreen" | "dialog" | "custom";
|
|
12
|
+
/** The centered panel's maximum width (`dialog` mode) */
|
|
13
|
+
maxWidth?: string;
|
|
14
|
+
/** Accessible name of the expanded view */
|
|
15
|
+
label?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Dims the page behind it, which makes it modal (scroll lock, `aria-modal`). Without one the page stays usable:
|
|
18
|
+
* a click outside closes it instead (unless `persistent`)
|
|
19
|
+
*/
|
|
20
|
+
scrim?: boolean;
|
|
21
|
+
/** A click on the scrim, or outside without one, doesn't close it */
|
|
22
|
+
persistent?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Android's back (button or gesture) closes it, like an expanded view in an app, where the browser has the
|
|
25
|
+
* CloseWatcher API (Chrome, Edge); the history and the router are left alone. Default `true`
|
|
26
|
+
*/
|
|
27
|
+
closeOnBack?: boolean;
|
|
28
|
+
} & {
|
|
29
|
+
/** Whether the expanded view is open; opening it from here grows it from the default slot's element */
|
|
30
|
+
open?: boolean;
|
|
31
|
+
}) & {
|
|
32
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
33
|
+
}> & (typeof globalThis extends {
|
|
34
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
35
|
+
} ? P : {});
|
|
36
|
+
expose: (exposed: {}) => void;
|
|
37
|
+
attrs: any;
|
|
38
|
+
slots: {
|
|
39
|
+
default?: (props: {
|
|
40
|
+
open: () => void;
|
|
41
|
+
isOpen: boolean;
|
|
42
|
+
}) => any;
|
|
43
|
+
} & {
|
|
44
|
+
expanded?: (props: {
|
|
45
|
+
close: () => void;
|
|
46
|
+
item: T | undefined;
|
|
47
|
+
}) => any;
|
|
48
|
+
};
|
|
49
|
+
emit: (event: "update:open", value: boolean) => void;
|
|
50
|
+
}>) => import("vue").VNode & {
|
|
51
|
+
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
52
|
+
};
|
|
53
|
+
declare const _default: typeof __VLS_export;
|
|
54
|
+
export default _default;
|
|
55
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
56
|
+
[K in keyof T]: T[K];
|
|
57
|
+
} : {
|
|
58
|
+
[K in keyof T as K]: T[K];
|
|
59
|
+
}) & {};
|
|
@@ -16,11 +16,11 @@ type __VLS_Props = {
|
|
|
16
16
|
declare function showAt(x: number, y: number): Promise<void>;
|
|
17
17
|
declare function show(e: MouseEvent): void;
|
|
18
18
|
declare function hide(): void;
|
|
19
|
-
declare var __VLS_1: {},
|
|
19
|
+
declare var __VLS_1: {}, __VLS_47: {};
|
|
20
20
|
type __VLS_Slots = {} & {
|
|
21
21
|
trigger?: (props: typeof __VLS_1) => any;
|
|
22
22
|
} & {
|
|
23
|
-
default?: (props: typeof
|
|
23
|
+
default?: (props: typeof __VLS_47) => any;
|
|
24
24
|
};
|
|
25
25
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
26
26
|
show: typeof show;
|
|
@@ -30,9 +30,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
30
30
|
label: string;
|
|
31
31
|
size: "xs" | "sm" | "md" | "lg" | "xl" | number;
|
|
32
32
|
variant: "standard" | "filled" | "tonal" | "outlined";
|
|
33
|
+
disabled: boolean;
|
|
33
34
|
icon: string;
|
|
34
35
|
shape: "rounded" | "squared";
|
|
35
|
-
disabled: boolean;
|
|
36
36
|
copiedIcon: string;
|
|
37
37
|
copiedLabel: string;
|
|
38
38
|
resetDelay: number;
|
|
@@ -24,11 +24,12 @@ type __VLS_Props = {
|
|
|
24
24
|
/**
|
|
25
25
|
* Just the dialog's box (surface, shape, elevation), scrim, Escape, scroll lock and animation, with the default
|
|
26
26
|
* slot filling it: no title row, padding, close button or actions. For dialogs that draw everything themselves
|
|
27
|
-
* (the date and time pickers). `
|
|
27
|
+
* (the date and time pickers). With `fullscreen`, the slot fills the screen and draws its own top bar. `title`
|
|
28
|
+
* then only names it for assistive technology
|
|
28
29
|
*/
|
|
29
30
|
bare?: boolean;
|
|
30
31
|
};
|
|
31
|
-
declare var __VLS_13: {}, __VLS_22: {}, __VLS_24: {}, __VLS_26: {}, __VLS_28: {},
|
|
32
|
+
declare var __VLS_13: {}, __VLS_22: {}, __VLS_24: {}, __VLS_26: {}, __VLS_28: {}, __VLS_36: {}, __VLS_45: {}, __VLS_47: {}, __VLS_49: {};
|
|
32
33
|
type __VLS_Slots = {} & {
|
|
33
34
|
default?: (props: typeof __VLS_13) => any;
|
|
34
35
|
} & {
|
|
@@ -40,11 +41,13 @@ type __VLS_Slots = {} & {
|
|
|
40
41
|
} & {
|
|
41
42
|
actions?: (props: typeof __VLS_28) => any;
|
|
42
43
|
} & {
|
|
43
|
-
|
|
44
|
+
default?: (props: typeof __VLS_36) => any;
|
|
44
45
|
} & {
|
|
45
|
-
|
|
46
|
+
title?: (props: typeof __VLS_45) => any;
|
|
46
47
|
} & {
|
|
47
|
-
|
|
48
|
+
actions?: (props: typeof __VLS_47) => any;
|
|
49
|
+
} & {
|
|
50
|
+
default?: (props: typeof __VLS_49) => any;
|
|
48
51
|
};
|
|
49
52
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
50
53
|
"update:modelValue": (args_0: boolean) => any;
|
|
@@ -37,8 +37,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
|
|
|
37
37
|
label: string;
|
|
38
38
|
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
39
39
|
variant: "filled" | "tonal" | "outlined" | "text" | "elevated";
|
|
40
|
-
icon: string;
|
|
41
40
|
disabled: boolean;
|
|
41
|
+
icon: string;
|
|
42
42
|
filename: string;
|
|
43
43
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
44
44
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -65,10 +65,10 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
|
|
|
65
65
|
onClick?: ((args_0: MouseEvent) => any) | undefined;
|
|
66
66
|
}>, {
|
|
67
67
|
color: "primary" | "secondary" | "tertiary" | "surface";
|
|
68
|
-
size: "small" | "regular" | "medium" | "large";
|
|
69
68
|
scrim: boolean;
|
|
70
|
-
|
|
69
|
+
size: "small" | "regular" | "medium" | "large";
|
|
71
70
|
disabled: boolean;
|
|
71
|
+
expanded: boolean;
|
|
72
72
|
persistent: boolean;
|
|
73
73
|
direction: "up" | "down" | "left" | "right" | "radial";
|
|
74
74
|
align: "start" | "end";
|
|
@@ -39,8 +39,8 @@ type __VLS_Props = {
|
|
|
39
39
|
};
|
|
40
40
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
41
41
|
color: "primary" | "secondary" | "tertiary" | "surface";
|
|
42
|
-
size: "small" | "regular" | "large";
|
|
43
42
|
scrim: boolean;
|
|
43
|
+
size: "small" | "regular" | "large";
|
|
44
44
|
disabled: boolean;
|
|
45
45
|
itemSize: "small" | "regular" | "large";
|
|
46
46
|
persistent: boolean;
|
|
@@ -19,8 +19,8 @@ type __VLS_Slots = {} & {
|
|
|
19
19
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
20
20
|
wrap: boolean;
|
|
21
21
|
inline: boolean;
|
|
22
|
-
gap: "none" | "xs" | "sm" | "md" | "lg" | "xl";
|
|
23
22
|
direction: "row" | "column" | "row-reverse" | "column-reverse";
|
|
23
|
+
gap: "none" | "xs" | "sm" | "md" | "lg" | "xl";
|
|
24
24
|
align: "start" | "center" | "end" | "stretch" | "baseline";
|
|
25
25
|
justify: "start" | "center" | "end" | "between" | "around" | "evenly";
|
|
26
26
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|