@m3ui-vue/m3ui-vue 1.1.4 → 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.
Files changed (199) hide show
  1. package/dist/API.md +511 -34
  2. package/dist/MMenuItem-DI351kIf.js +929 -0
  3. package/dist/MMenuItem-DI351kIf.js.map +1 -0
  4. package/dist/{MSlider-JflHJ70q.js → MSlider-BnEy5ieZ.js} +295 -320
  5. package/dist/MSlider-BnEy5ieZ.js.map +1 -0
  6. package/dist/MTextField-BBmkaIbO.js +633 -0
  7. package/dist/MTextField-BBmkaIbO.js.map +1 -0
  8. package/dist/api.json +1 -1
  9. package/dist/chart.js +83 -49
  10. package/dist/chart.js.map +1 -1
  11. package/dist/code-editor.js +1 -1
  12. package/dist/components/MButton.vue.d.ts +7 -1
  13. package/dist/components/MButtonGroup.vue.d.ts +40 -31
  14. package/dist/components/MCarousel.vue.d.ts +2 -0
  15. package/dist/components/MChart.vue.d.ts +6 -0
  16. package/dist/components/MCircleProgressBar.vue.d.ts +5 -3
  17. package/dist/components/MContextMenu.vue.d.ts +2 -2
  18. package/dist/components/MCopyButton.vue.d.ts +1 -1
  19. package/dist/components/MExportButton.vue.d.ts +1 -1
  20. package/dist/components/MFab.vue.d.ts +2 -2
  21. package/dist/components/MFabMenu.vue.d.ts +1 -1
  22. package/dist/components/MIconButton.vue.d.ts +13 -1
  23. package/dist/components/MInfiniteScroll.vue.d.ts +1 -1
  24. package/dist/components/MMap.vue.d.ts +20 -2
  25. package/dist/components/MMapBaseLayers.vue.d.ts +3 -0
  26. package/dist/components/MMapFilter.vue.d.ts +3 -0
  27. package/dist/components/MMapLayers.vue.d.ts +3 -0
  28. package/dist/components/MMenu.vue.d.ts +2 -2
  29. package/dist/components/MMenuItem.vue.d.ts +7 -3
  30. package/dist/components/MNavigationDrawer.vue.d.ts +13 -2
  31. package/dist/components/MOverlay.vue.d.ts +12 -1
  32. package/dist/components/MProgressBar.vue.d.ts +5 -3
  33. package/dist/components/MPullToRefresh.vue.d.ts +7 -2
  34. package/dist/components/MRichTextEditor.vue.d.ts +7 -1
  35. package/dist/components/MSearchField.vue.d.ts +58 -0
  36. package/dist/components/MSegmentedButton.vue.d.ts +31 -23
  37. package/dist/components/MSimpleCarousel.vue.d.ts +2 -0
  38. package/dist/components/MSkeleton.vue.d.ts +6 -3
  39. package/dist/components/MSwipeToDismiss.vue.d.ts +1 -1
  40. package/dist/components/MSwitch.vue.d.ts +1 -1
  41. package/dist/components/MTextField.vue.d.ts +5 -1
  42. package/dist/components/MTimeline.vue.d.ts +85 -22
  43. package/dist/components/MTooltip.vue.d.ts +1 -1
  44. package/dist/components/_MDrawerItemList.vue.d.ts +2 -0
  45. package/dist/composables/_mapStyle.d.ts +13 -0
  46. package/dist/composables/_themeTransition.d.ts +2 -0
  47. package/dist/composables/_tooltipTrigger.d.ts +22 -0
  48. package/dist/composables/_useMenuNav.d.ts +28 -0
  49. package/dist/composables/useAutoGrow.d.ts +21 -0
  50. package/dist/composables/useColorPalette.d.ts +1 -1
  51. package/dist/composables/useLocale.d.ts +3 -0
  52. package/dist/composables/useMap.d.ts +19 -3
  53. package/dist/composables/useMapFilter.d.ts +4 -1
  54. package/dist/composables/useMapLayers.d.ts +5 -2
  55. package/dist/composables/useScrollReveal.d.ts +44 -0
  56. package/dist/composables/useThemeTokens.d.ts +21 -0
  57. package/dist/composables/viewportHints.d.ts +27 -0
  58. package/dist/directives/vClickOutside.d.ts +25 -0
  59. package/dist/directives/vFocusRing.d.ts +22 -0
  60. package/dist/directives/vLongPress.d.ts +27 -0
  61. package/dist/directives/vReveal.d.ts +10 -0
  62. package/dist/directives/vScrollElevation.d.ts +31 -0
  63. package/dist/directives/vSkeleton.d.ts +19 -0
  64. package/dist/directives/vStateLayer.d.ts +20 -0
  65. package/dist/directives/vSwipe.d.ts +45 -0
  66. package/dist/directives/vTooltip.d.ts +23 -0
  67. package/dist/index.d.ts +28 -1
  68. package/dist/locales/index.js +21 -7
  69. package/dist/locales/index.js.map +1 -1
  70. package/dist/m3ui-vue.css +1 -1
  71. package/dist/m3ui.js +7131 -6216
  72. package/dist/m3ui.js.map +1 -1
  73. package/dist/map.d.ts +1 -1
  74. package/dist/map.js +821 -791
  75. package/dist/map.js.map +1 -1
  76. package/dist/motion-DZiXG09o.js +150 -0
  77. package/dist/motion-DZiXG09o.js.map +1 -0
  78. package/dist/plugin.d.ts +24 -0
  79. package/dist/rich-text-editor.js +13 -9
  80. package/dist/rich-text-editor.js.map +1 -1
  81. package/dist/styles/theme.css +63 -0
  82. package/dist/styles.css +1 -1
  83. package/dist/{useLocale-CXibICQA.js → useLocale-JYxDDeXC.js} +4 -2
  84. package/dist/useLocale-JYxDDeXC.js.map +1 -0
  85. package/dist/useThemeTokens-Bv-Uv8eX.js +135 -0
  86. package/dist/useThemeTokens-Bv-Uv8eX.js.map +1 -0
  87. package/package.json +1 -1
  88. package/src/__tests__/MButton.test.ts +22 -0
  89. package/src/__tests__/MCarousel.test.ts +9 -0
  90. package/src/__tests__/MChart.test.ts +77 -5
  91. package/src/__tests__/MIconButton.test.ts +33 -0
  92. package/src/__tests__/MMap.test.ts +53 -1
  93. package/src/__tests__/MMapLayers.test.ts +46 -2
  94. package/src/__tests__/MMenu.test.ts +104 -1
  95. package/src/__tests__/MMenuItem.test.ts +18 -0
  96. package/src/__tests__/MNavigationDrawer.test.ts +80 -0
  97. package/src/__tests__/MOverlay.test.ts +49 -0
  98. package/src/__tests__/MProgressBar.test.ts +41 -0
  99. package/src/__tests__/MPullToRefresh.test.ts +33 -0
  100. package/src/__tests__/MRichTextEditor.test.ts +22 -0
  101. package/src/__tests__/MSearchField.test.ts +71 -0
  102. package/src/__tests__/MSkeleton.test.ts +38 -0
  103. package/src/__tests__/MTimeline.test.ts +238 -0
  104. package/src/__tests__/_fakeMaplibre.ts +3 -1
  105. package/src/__tests__/attrsFallthrough.test.ts +3 -0
  106. package/src/__tests__/escapeStack.test.ts +93 -0
  107. package/src/__tests__/ssr.test.ts +21 -2
  108. package/src/__tests__/useAutoGrow.test.ts +103 -0
  109. package/src/__tests__/useScrollReveal.test.ts +102 -0
  110. package/src/__tests__/useThemeTokens.test.ts +114 -0
  111. package/src/__tests__/vClickOutside.test.ts +82 -0
  112. package/src/__tests__/vFocusRing.test.ts +36 -0
  113. package/src/__tests__/vLongPress.test.ts +81 -0
  114. package/src/__tests__/vScrollElevation.test.ts +89 -0
  115. package/src/__tests__/vSkeleton.test.ts +48 -0
  116. package/src/__tests__/vStateLayer.test.ts +53 -0
  117. package/src/__tests__/vSwipe.test.ts +93 -0
  118. package/src/__tests__/vTooltip.test.ts +95 -0
  119. package/src/__tests__/viewportHints.test.ts +41 -0
  120. package/src/components/MAutocomplete.vue +5 -0
  121. package/src/components/MBottomSheet.vue +4 -1
  122. package/src/components/MButton.vue +15 -1
  123. package/src/components/MButtonGroup.vue +22 -17
  124. package/src/components/MCarousel.vue +7 -1
  125. package/src/components/MChart.vue +74 -34
  126. package/src/components/MCircleProgressBar.vue +14 -9
  127. package/src/components/MCommandPalette.vue +3 -2
  128. package/src/components/MContextMenu.vue +19 -60
  129. package/src/components/MDragDropList.vue +2 -0
  130. package/src/components/MIconButton.vue +40 -1
  131. package/src/components/MKanban.vue +2 -0
  132. package/src/components/MLightbox.vue +7 -2
  133. package/src/components/MMap.vue +38 -5
  134. package/src/components/MMapBaseLayers.vue +7 -3
  135. package/src/components/MMapFilter.vue +7 -4
  136. package/src/components/MMapGeoJson.vue +1 -1
  137. package/src/components/MMapLayers.vue +6 -2
  138. package/src/components/MMapMeasure.vue +5 -2
  139. package/src/components/MMenu.vue +18 -59
  140. package/src/components/MMenuItem.vue +11 -2
  141. package/src/components/MMultiAutocomplete.vue +5 -0
  142. package/src/components/MNavigationDrawer.vue +96 -11
  143. package/src/components/MNavigationRail.vue +4 -15
  144. package/src/components/MOverlay.vue +32 -13
  145. package/src/components/MProgressBar.vue +25 -27
  146. package/src/components/MPullToRefresh.vue +20 -1
  147. package/src/components/MRichTextEditor.vue +19 -5
  148. package/src/components/MSearchBar.vue +5 -0
  149. package/src/components/MSearchField.vue +142 -0
  150. package/src/components/MSegmentedButton.vue +19 -17
  151. package/src/components/MSelect.vue +10 -1
  152. package/src/components/MSideSheet.vue +5 -2
  153. package/src/components/MSimpleCarousel.vue +10 -1
  154. package/src/components/MSkeleton.vue +30 -8
  155. package/src/components/MSpotlightSearch.vue +3 -2
  156. package/src/components/MTextField.vue +15 -2
  157. package/src/components/MTimeline.vue +370 -81
  158. package/src/components/MTooltip.vue +20 -152
  159. package/src/components/_MDrawerItemList.vue +25 -6
  160. package/src/composables/_mapStyle.ts +45 -0
  161. package/src/composables/_themeTransition.ts +2 -0
  162. package/src/composables/_tooltipTrigger.ts +184 -0
  163. package/src/composables/_useMenuNav.ts +209 -0
  164. package/src/composables/useAutoGrow.ts +78 -0
  165. package/src/composables/useLocale.ts +5 -0
  166. package/src/composables/useMap.ts +43 -5
  167. package/src/composables/useMapFilter.ts +6 -5
  168. package/src/composables/useMapLayers.ts +7 -6
  169. package/src/composables/useScrollReveal.ts +151 -0
  170. package/src/composables/useThemeTokens.ts +116 -0
  171. package/src/composables/viewportHints.ts +80 -0
  172. package/src/directives/vClickOutside.ts +90 -0
  173. package/src/directives/vFocusRing.ts +60 -0
  174. package/src/directives/vLongPress.ts +134 -0
  175. package/src/directives/vReveal.ts +57 -0
  176. package/src/directives/vScrollElevation.ts +116 -0
  177. package/src/directives/vSkeleton.ts +87 -0
  178. package/src/directives/vStateLayer.ts +83 -0
  179. package/src/directives/vSwipe.ts +197 -0
  180. package/src/directives/vTooltip.ts +128 -0
  181. package/src/index.ts +28 -1
  182. package/src/locales/de.ts +2 -0
  183. package/src/locales/es.ts +2 -0
  184. package/src/locales/fr.ts +2 -0
  185. package/src/locales/ja.ts +2 -0
  186. package/src/locales/ko.ts +2 -0
  187. package/src/locales/pt.ts +2 -0
  188. package/src/locales/zh.ts +2 -0
  189. package/src/map.ts +1 -1
  190. package/src/plugin.ts +34 -0
  191. package/src/styles/theme.css +63 -0
  192. package/dist/MMenuItem-BfjqwcYP.js +0 -830
  193. package/dist/MMenuItem-BfjqwcYP.js.map +0 -1
  194. package/dist/MSlider-JflHJ70q.js.map +0 -1
  195. package/dist/MTextField-NaIB6RbM.js +0 -673
  196. package/dist/MTextField-NaIB6RbM.js.map +0 -1
  197. package/dist/composables/_useThemeTokens.d.ts +0 -7
  198. package/dist/useLocale-CXibICQA.js.map +0 -1
  199. package/src/composables/_useThemeTokens.ts +0 -42
package/dist/chart.js CHANGED
@@ -1,59 +1,93 @@
1
- import { computed as e, createBlock as t, createCommentVNode as n, createElementBlock as r, defineComponent as i, normalizeStyle as a, onBeforeUnmount as o, onMounted as s, openBlock as c, ref as l, resolveDynamicComponent as u, shallowRef as d, watch as f } from "vue";
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__ */ i({
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(i) {
13
- let p = i, m = l(!1), h = d(null), g = d({});
14
- function _() {
15
- let e = typeof document > "u" ? null : getComputedStyle(document.documentElement), t = (t) => e?.getPropertyValue(t).trim() ?? "";
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
- primary: t("--color-primary"),
18
- onSurface: t("--color-on-surface"),
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
- v.value = _(), y = new MutationObserver(() => {
29
- v.value = _();
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), g.value = {
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
- }, m.value = !0;
48
- }), o(() => {
49
- y?.disconnect();
83
+ }, h.value = !0;
50
84
  }), f(() => p.type, () => {
51
- m.value && (h.value = g.value[p.type] ?? null);
52
- }, { immediate: !0 }), f(m, () => {
53
- h.value = g.value[p.type] ?? null;
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 b = e(() => {
56
- let e = v.value, t = {
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 + "40",
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 + "40",
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 + "40" },
125
- angleLines: { color: e.outlineVariant + "40" },
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
- } }), x(t, p.options ?? {});
172
+ } }), O(t, p.options ?? {});
139
173
  });
140
- function x(e, t) {
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]) ? x(e[r] ?? {}, t[r]) : 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, o) => (c(), r("div", {
179
+ return (e, t) => (c(), i("div", {
146
180
  class: "rounded-lg border border-outline-variant bg-surface p-4",
147
- style: a({ height: i.height })
148
- }, [m.value && h.value ? (c(), t(u(h.value), {
181
+ style: o({ height: a.height })
182
+ }, [h.value && g.value ? (c(), n(u(g.value), {
149
183
  key: 0,
150
- data: i.data,
151
- options: b.value
152
- }, null, 8, ["data", "options"])) : n("", !0)], 4));
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;GAEnE,IAAM,CAAC,GAAS,KAAc,MAAM,QAAQ,IAAI,CAC9C,OAAO,aACP,OAAO,cACT,CAAC;GAwBD,AAtBA,EAAQ,MAAM,SACZ,EAAQ,eACR,EAAQ,aACR,EAAQ,cACR,EAAQ,aACR,EAAQ,YACR,EAAQ,YACR,EAAQ,mBACR,EAA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AO,EAAE,iBAAiB;MAAM,WAAW;KAAM;KACzD,OAAO;MAAE,OAAO,EAAE;MAAkB,MAAM;OAAE,QAAQ,EAAE;OAAY,MAAM;MAAG;MAAG,SAAS;KAAE;KACzF,QAAQ,EAAE,OAAO,EAAE,eAAe;IACpC;GACF,IAGE,EAAM,SAAS,YACjB,EAAK,SAAS,EACZ,GAAG;IACD,MAAM,EAAE,OAAO,EAAE,iBAAiB,KAAK;IACvC,YAAY,EAAE,OAAO,EAAE,iBAAiB,KAAK;IAC7C,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"}
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=\"{ height }\">\n <component\n v-if=\"ready && chartComponent\"\n :is=\"chartComponent\"\n :data=\"themedData\"\n :options=\"mergedOptions\"\n />\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;EAWA,IAAM,IAAQ,GAuBR,IAAS;GAAC;GAAW;GAAY;GAAa;GAAW;GAAS;EAAS,GAE3E,IAAQ,E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D,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"}
@@ -1,4 +1,4 @@
1
- import { i as e } from "./useLocale-CXibICQA.js";
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";
@@ -33,6 +33,12 @@ type __VLS_Props = {
33
33
  to?: string | Record<string, any>;
34
34
  /** Any CSS color for the press ripple; defaults to the button's content color */
35
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;
36
42
  };
37
43
  declare var __VLS_18: {};
38
44
  type __VLS_Slots = {} & {
@@ -44,8 +50,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
44
50
  size: "xs" | "sm" | "md" | "lg" | "xl";
45
51
  loading: boolean;
46
52
  variant: "filled" | "tonal" | "outlined" | "text" | "elevated";
47
- shape: "rounded" | "squared";
48
53
  disabled: boolean;
54
+ shape: "rounded" | "squared";
49
55
  iconPos: "leading" | "trailing";
50
56
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
51
57
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -1,37 +1,46 @@
1
- export interface ButtonGroupOption {
2
- value: unknown;
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>;
@@ -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: {}, __VLS_52: {};
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 __VLS_52) => any;
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;
@@ -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
- expanded: boolean;
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;
@@ -5,6 +5,18 @@ type __VLS_Props = {
5
5
  label?: string;
6
6
  /** Visual style */
7
7
  variant?: 'standard' | 'filled' | 'tonal' | 'outlined';
8
+ /**
9
+ * An M3 role or any CSS color (`#fff` over a photo, `rgb(0 0 0 / 0.3)` for a scrim-like filled button,
10
+ * `currentColor` to follow the surrounding text). Standard and outlined use it for the icon; filled for the
11
+ * container with white (or the role's on-color) on it; tonal for a 20% container with the color on it.
12
+ * Disabled buttons and toggles keep their own colors
13
+ */
14
+ color?: 'primary' | 'secondary' | 'tertiary' | 'error' | (string & {});
15
+ /**
16
+ * Icon color over what the variant and `color` give: an M3 role (`on-surface`…) or any CSS color (`#000` on a
17
+ * white filled button). Disabled buttons and toggles keep their own
18
+ */
19
+ contentColor?: string;
8
20
  /**
9
21
  * Button shape — rounded (pill, always) or squared (corner radius scales with size: 12px xs/sm, 16px md,
10
22
  * 28px lg/xl)
@@ -35,8 +47,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
35
47
  }>, {
36
48
  size: "xs" | "sm" | "md" | "lg" | "xl" | number;
37
49
  variant: "standard" | "filled" | "tonal" | "outlined";
38
- shape: "rounded" | "squared";
39
50
  disabled: boolean;
51
+ shape: "rounded" | "squared";
40
52
  checked: boolean;
41
53
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
42
54
  declare const _default: typeof __VLS_export;
@@ -29,8 +29,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
29
29
  }>, {
30
30
  loading: boolean;
31
31
  ended: boolean;
32
- disabled: boolean;
33
32
  threshold: number;
33
+ disabled: boolean;
34
34
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
35
35
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
36
36
  declare const _default: typeof __VLS_export;
@@ -1,9 +1,24 @@
1
1
  import type * as Maplibre from 'maplibre-gl';
2
+ import { type MapContext } from '../composables/useMap';
2
3
  import type { MapAdapter } from '../composables/mapAdapters';
3
4
  export type MapControlPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
4
5
  type __VLS_Props = {
5
- /** The map's style: a style JSON URL or a style object (MapLibre's `StyleSpecification`). Changing it reloads the style */
6
+ /**
7
+ * The map's style: a style JSON URL or a style object (MapLibre's `StyleSpecification`). Changing it reloads the
8
+ * style, keeping what was added at runtime (see `keepLayers`)
9
+ */
6
10
  mapStyle: string | Maplibre.StyleSpecification;
11
+ /**
12
+ * What happens to the sources and layers added at runtime (with `useMap()`, or by `MMapGeoJson`, `MMapMeasure`…)
13
+ * when `mapStyle` changes: `true` carries them into the new style, on top of its layers; `false` drops them, as
14
+ * MapLibre does; a function picks the layers to carry (their sources come along)
15
+ */
16
+ keepLayers?: boolean | ((layer: Maplibre.LayerSpecification) => boolean);
17
+ /**
18
+ * MapLibre's `transformStyle` for a `mapStyle` change, run after `keepLayers`: edit the next style before it
19
+ * loads (copy a layer's paint over, add a sprite…)
20
+ */
21
+ transformStyle?: Maplibre.TransformStyleFunction;
7
22
  /** `[lng, lat]` (v-model). When left out, the style's (or the remembered view's) */
8
23
  center?: [number, number];
9
24
  /** Zoom level (v-model) */
@@ -42,6 +57,8 @@ type __VLS_Slots = {} & {
42
57
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
43
58
  /** The MapLibre map, once loaded */
44
59
  map: import("vue").ShallowRef<Maplibre.Map | undefined, Maplibre.Map | undefined>;
60
+ /** What the components inside it share: pass the `MMap` (or this) as `map` to `MMapLayers`, `useMap()`… outside it */
61
+ context: MapContext;
45
62
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
46
63
  ready: (map: Maplibre.Map) => any;
47
64
  click: (event: Maplibre.MapMouseEvent) => any;
@@ -57,10 +74,11 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
57
74
  "onUpdate:bearing"?: ((bearing: number) => any) | undefined;
58
75
  "onUpdate:pitch"?: ((pitch: number) => any) | undefined;
59
76
  }>, {
77
+ scale: boolean | MapControlPosition;
60
78
  fullscreen: boolean | MapControlPosition;
61
79
  navigation: boolean | MapControlPosition;
62
- scale: boolean | MapControlPosition;
63
80
  attribution: boolean | MapControlPosition;
81
+ keepLayers: boolean | ((layer: Maplibre.LayerSpecification) => boolean);
64
82
  persist: boolean | string;
65
83
  geolocate: boolean | MapControlPosition;
66
84
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -1,3 +1,4 @@
1
+ import type { MapSource } from '../composables/useMap';
1
2
  type __VLS_Props = {
2
3
  /** Prefix for the thumbnails' paths (e.g. `/images/`); full URLs are used as they are */
3
4
  imageBase?: string;
@@ -5,6 +6,8 @@ type __VLS_Props = {
5
6
  none?: boolean;
6
7
  /** Lay them out in a column */
7
8
  vertical?: boolean;
9
+ /** The map, when this is outside it (a side panel): the `MMap`'s template ref */
10
+ map?: MapSource;
8
11
  };
9
12
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
10
13
  none: boolean;
@@ -1,3 +1,4 @@
1
+ import { type MapSource } from '../composables/useMap';
1
2
  type __VLS_Props = {
2
3
  /** The layer's id */
3
4
  layer: string;
@@ -9,6 +10,8 @@ type __VLS_Props = {
9
10
  labels?: Record<string, string>;
10
11
  /** The selected values (v-model) */
11
12
  modelValue?: (string | number)[];
13
+ /** The map, when this is outside it (a side panel): the `MMap`'s template ref */
14
+ map?: MapSource;
12
15
  };
13
16
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
14
17
  "update:modelValue": (values: (string | number)[]) => any;
@@ -1,9 +1,12 @@
1
+ import type { MapSource } from '../composables/useMap';
1
2
  import type { MapLayerInfo } from '../composables/mapAdapters';
2
3
  type __VLS_Props = {
3
4
  /** Show the search field */
4
5
  search?: boolean;
5
6
  /** Groups start collapsed */
6
7
  collapsed?: boolean;
8
+ /** The map, when this is outside it (a side panel): the `MMap`'s template ref */
9
+ map?: MapSource;
7
10
  };
8
11
  declare var __VLS_25: {
9
12
  layer: MapLayerInfo;