@maliardic/ma-ui 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +72 -2
- package/fesm2022/maliardic-ma-ui-chart.mjs +261 -0
- package/fesm2022/maliardic-ma-ui-chart.mjs.map +1 -0
- package/fesm2022/maliardic-ma-ui-editor.mjs +457 -0
- package/fesm2022/maliardic-ma-ui-editor.mjs.map +1 -0
- package/fesm2022/maliardic-ma-ui.mjs +13466 -0
- package/fesm2022/maliardic-ma-ui.mjs.map +1 -0
- package/package.json +75 -3
- package/styles/components/_accordion.scss +172 -0
- package/styles/components/_badge.scss +160 -0
- package/styles/components/_button.scss +123 -0
- package/styles/components/_chart.scss +12 -0
- package/styles/components/_checkbox.scss +88 -0
- package/styles/components/_command-menu.scss +49 -0
- package/styles/components/_date-picker.scss +247 -0
- package/styles/components/_dialog.scss +144 -0
- package/styles/components/_drawer.scss +165 -0
- package/styles/components/_editor.scss +260 -0
- package/styles/components/_file-list.scss +59 -0
- package/styles/components/_file-upload.scss +141 -0
- package/styles/components/_input-number.scss +18 -0
- package/styles/components/_input.scss +197 -0
- package/styles/components/_listbox.scss +88 -0
- package/styles/components/_menu-search.scss +72 -0
- package/styles/components/_menu.scss +177 -0
- package/styles/components/_multi-select.scss +216 -0
- package/styles/components/_popover.scss +63 -0
- package/styles/components/_progress-bar.scss +123 -0
- package/styles/components/_progress-spinner.scss +108 -0
- package/styles/components/_radio.scss +79 -0
- package/styles/components/_select.scss +320 -0
- package/styles/components/_switch.scss +63 -0
- package/styles/components/_table.scss +599 -0
- package/styles/components/_tabs.scss +130 -0
- package/styles/components/_textarea.scss +4 -0
- package/styles/components/_tiered-menu.scss +96 -0
- package/styles/components/_toast.scss +155 -0
- package/styles/components/_tooltip.scss +63 -0
- package/styles/components.scss +30 -0
- package/styles/core.scss +46 -0
- package/styles/index.scss +4 -0
- package/styles/ma-ui.css +1 -0
- package/styles/tokens.scss +368 -0
- package/types/maliardic-ma-ui-chart.d.ts +44 -0
- package/types/maliardic-ma-ui-editor.d.ts +130 -0
- package/types/maliardic-ma-ui.d.ts +3553 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 maliardic
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,73 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @maliardic/ma-ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Standalone Angular UI components, directives and CSS variable themes.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
Requires Angular 22.2 and Angular CDK 22.1 or later within major version 22.
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install @maliardic/ma-ui @angular/cdk@^22.1.1 @fortawesome/fontawesome-free@^6.7.2
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Import the theme and icon CSS once in the application's global stylesheet:
|
|
14
|
+
|
|
15
|
+
```scss
|
|
16
|
+
@use '@maliardic/ma-ui/styles';
|
|
17
|
+
@use '@fortawesome/fontawesome-free/css/all.min.css';
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The theme includes the structural Angular CDK overlay styles. Tailwind is not required.
|
|
21
|
+
For applications without Sass, add the package's `styles/ma-ui.css` and the icon
|
|
22
|
+
stylesheet to the application's global styles configuration instead.
|
|
23
|
+
|
|
24
|
+
## Table example
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import { Component } from '@angular/core';
|
|
28
|
+
import { MTable } from '@maliardic/ma-ui';
|
|
29
|
+
|
|
30
|
+
@Component({
|
|
31
|
+
selector: 'app-example',
|
|
32
|
+
imports: [MTable],
|
|
33
|
+
template: `<m-table [value]="users" [columns]="columns"
|
|
34
|
+
[pageSize]="10" [rowsPerPageOptions]="[10, 20, 50]" />`,
|
|
35
|
+
})
|
|
36
|
+
export class Example {
|
|
37
|
+
readonly users = [{ id: 1, name: 'Ada' }];
|
|
38
|
+
readonly columns = [{ field: 'name', header: 'Name', sortable: true }];
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
`[(pageSize)]` is supported when the application needs to track the user's choice.
|
|
43
|
+
|
|
44
|
+
## Optional chart and editor
|
|
45
|
+
|
|
46
|
+
These have separate entry points and optional peer dependencies. Applications using
|
|
47
|
+
only the main entry point do not need Chart.js or Tiptap.
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
npm install chart.js@^4.5.1
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import { MChart } from '@maliardic/ma-ui/chart';
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
```sh
|
|
58
|
+
npm install @tiptap/core@^3.30.0 @tiptap/pm@^3.30.0 @tiptap/starter-kit@^3.30.0 @tiptap/extension-link@^3.30.0 @tiptap/extension-placeholder@^3.30.0
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
import { MEditor } from '@maliardic/ma-ui/editor';
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Themes
|
|
66
|
+
|
|
67
|
+
Use `.m-light` or `.m-dark` on a container and override the `--m-*` CSS variables.
|
|
68
|
+
Overlay components inherit theme settings from their host. Keep custom theme
|
|
69
|
+
overrides after the library stylesheet.
|
|
70
|
+
|
|
71
|
+
## License
|
|
72
|
+
|
|
73
|
+
MIT. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { Component, ElementRef, afterNextRender, effect, inject, input, signal, viewChild } from "@angular/core";
|
|
3
|
+
function copy(value) {
|
|
4
|
+
if (Array.isArray(value)) return value.map(copy);
|
|
5
|
+
if (value && Object.getPrototypeOf(value) === Object.prototype) return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, copy(item)]));
|
|
6
|
+
return value;
|
|
7
|
+
}
|
|
8
|
+
function merge(base, overrides) {
|
|
9
|
+
const result = copy(base);
|
|
10
|
+
for (const [key, value] of Object.entries(overrides)) {
|
|
11
|
+
if (value === void 0) continue;
|
|
12
|
+
result[key] = value && Object.getPrototypeOf(value) === Object.prototype ? merge(result[key] && typeof result[key] === "object" ? result[key] : {}, value) : copy(value);
|
|
13
|
+
}
|
|
14
|
+
return result;
|
|
15
|
+
}
|
|
16
|
+
var MChart = class MChart {
|
|
17
|
+
type = input("bar", ...ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []);
|
|
18
|
+
data = input.required(...ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []);
|
|
19
|
+
options = input({}, ...ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []);
|
|
20
|
+
ariaLabel = input("Chart", ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
21
|
+
failed = signal(false, ...ngDevMode ? [{ debugName: "failed" }] : /* istanbul ignore next */ []);
|
|
22
|
+
host = inject(ElementRef);
|
|
23
|
+
canvas = viewChild.required("canvas", ...ngDevMode ? [{ debugName: "canvas" }] : /* istanbul ignore next */ []);
|
|
24
|
+
constructorRef = signal(null, ...ngDevMode ? [{ debugName: "constructorRef" }] : /* istanbul ignore next */ []);
|
|
25
|
+
chart;
|
|
26
|
+
chartType;
|
|
27
|
+
observer;
|
|
28
|
+
destroyed = false;
|
|
29
|
+
constructor() {
|
|
30
|
+
afterNextRender(() => {
|
|
31
|
+
import("chart.js/auto").then(({ default: ChartConstructor }) => {
|
|
32
|
+
if (this.destroyed) return;
|
|
33
|
+
this.constructorRef.set(ChartConstructor);
|
|
34
|
+
this.observer = new MutationObserver(() => this.refreshTheme());
|
|
35
|
+
for (let node = this.host.nativeElement; node; node = node.parentElement) this.observer.observe(node, {
|
|
36
|
+
attributes: true,
|
|
37
|
+
attributeFilter: ["class", "style"]
|
|
38
|
+
});
|
|
39
|
+
}).catch(() => {
|
|
40
|
+
if (!this.destroyed) this.failed.set(true);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
effect(() => {
|
|
44
|
+
const ChartConstructor = this.constructorRef();
|
|
45
|
+
if (!ChartConstructor) return;
|
|
46
|
+
const type = this.type();
|
|
47
|
+
const data = copy(this.data());
|
|
48
|
+
const options = this.themedOptions();
|
|
49
|
+
if (this.chart && this.chartType === type) {
|
|
50
|
+
this.chart.data = data;
|
|
51
|
+
this.chart.options = options;
|
|
52
|
+
this.chart.update();
|
|
53
|
+
} else {
|
|
54
|
+
this.chart?.destroy();
|
|
55
|
+
this.chartType = type;
|
|
56
|
+
this.chart = new ChartConstructor(this.canvas().nativeElement, {
|
|
57
|
+
type,
|
|
58
|
+
data,
|
|
59
|
+
options
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
themedOptions() {
|
|
65
|
+
const style = getComputedStyle(this.host.nativeElement);
|
|
66
|
+
const color = style.getPropertyValue("--m-color-text").trim() || style.color;
|
|
67
|
+
const gridColor = style.getPropertyValue("--m-color-border").trim();
|
|
68
|
+
const font = {
|
|
69
|
+
family: style.fontFamily,
|
|
70
|
+
size: parseFloat(style.fontSize)
|
|
71
|
+
};
|
|
72
|
+
const axis = {
|
|
73
|
+
ticks: {
|
|
74
|
+
color,
|
|
75
|
+
font
|
|
76
|
+
},
|
|
77
|
+
grid: { color: gridColor },
|
|
78
|
+
border: { color: gridColor },
|
|
79
|
+
title: {
|
|
80
|
+
color,
|
|
81
|
+
font
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
const type = this.type();
|
|
85
|
+
const scales = {};
|
|
86
|
+
if (type === "radar" || type === "polarArea") scales["r"] = {
|
|
87
|
+
...axis,
|
|
88
|
+
angleLines: { color: gridColor },
|
|
89
|
+
pointLabels: {
|
|
90
|
+
color,
|
|
91
|
+
font
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
else if (type !== "pie" && type !== "doughnut") {
|
|
95
|
+
scales["x"] = axis;
|
|
96
|
+
scales["y"] = axis;
|
|
97
|
+
}
|
|
98
|
+
for (const key of Object.keys(this.options().scales ?? {})) scales[key] ??= axis;
|
|
99
|
+
return merge({
|
|
100
|
+
responsive: true,
|
|
101
|
+
maintainAspectRatio: false,
|
|
102
|
+
color,
|
|
103
|
+
font,
|
|
104
|
+
scales,
|
|
105
|
+
plugins: {
|
|
106
|
+
legend: { labels: {
|
|
107
|
+
color,
|
|
108
|
+
font
|
|
109
|
+
} },
|
|
110
|
+
title: {
|
|
111
|
+
color,
|
|
112
|
+
font
|
|
113
|
+
},
|
|
114
|
+
subtitle: {
|
|
115
|
+
color,
|
|
116
|
+
font
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}, this.options());
|
|
120
|
+
}
|
|
121
|
+
refreshTheme() {
|
|
122
|
+
if (!this.chart || this.destroyed) return;
|
|
123
|
+
this.chart.options = this.themedOptions();
|
|
124
|
+
this.chart.update("none");
|
|
125
|
+
}
|
|
126
|
+
ngOnDestroy() {
|
|
127
|
+
this.destroyed = true;
|
|
128
|
+
this.observer?.disconnect();
|
|
129
|
+
this.chart?.destroy();
|
|
130
|
+
}
|
|
131
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
132
|
+
minVersion: "12.0.0",
|
|
133
|
+
version: "22.2.0",
|
|
134
|
+
ngImport: i0,
|
|
135
|
+
type: MChart,
|
|
136
|
+
deps: [],
|
|
137
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
138
|
+
});
|
|
139
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
140
|
+
minVersion: "17.0.0",
|
|
141
|
+
version: "22.2.0",
|
|
142
|
+
type: MChart,
|
|
143
|
+
isStandalone: true,
|
|
144
|
+
selector: "m-chart",
|
|
145
|
+
inputs: {
|
|
146
|
+
type: {
|
|
147
|
+
classPropertyName: "type",
|
|
148
|
+
publicName: "type",
|
|
149
|
+
isSignal: true,
|
|
150
|
+
isRequired: false,
|
|
151
|
+
transformFunction: null
|
|
152
|
+
},
|
|
153
|
+
data: {
|
|
154
|
+
classPropertyName: "data",
|
|
155
|
+
publicName: "data",
|
|
156
|
+
isSignal: true,
|
|
157
|
+
isRequired: true,
|
|
158
|
+
transformFunction: null
|
|
159
|
+
},
|
|
160
|
+
options: {
|
|
161
|
+
classPropertyName: "options",
|
|
162
|
+
publicName: "options",
|
|
163
|
+
isSignal: true,
|
|
164
|
+
isRequired: false,
|
|
165
|
+
transformFunction: null
|
|
166
|
+
},
|
|
167
|
+
ariaLabel: {
|
|
168
|
+
classPropertyName: "ariaLabel",
|
|
169
|
+
publicName: "ariaLabel",
|
|
170
|
+
isSignal: true,
|
|
171
|
+
isRequired: false,
|
|
172
|
+
transformFunction: null
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
host: { classAttribute: "m-chart" },
|
|
176
|
+
viewQueries: [{
|
|
177
|
+
propertyName: "canvas",
|
|
178
|
+
first: true,
|
|
179
|
+
predicate: ["canvas"],
|
|
180
|
+
descendants: true,
|
|
181
|
+
isSignal: true
|
|
182
|
+
}],
|
|
183
|
+
ngImport: i0,
|
|
184
|
+
template: `
|
|
185
|
+
<div class="m-chart__container">
|
|
186
|
+
<canvas #canvas role="img" [attr.aria-label]="ariaLabel()">{{
|
|
187
|
+
ariaLabel()
|
|
188
|
+
}}</canvas>
|
|
189
|
+
</div>
|
|
190
|
+
@if (failed()) {
|
|
191
|
+
<span role="status">Chart could not be loaded.</span>
|
|
192
|
+
}
|
|
193
|
+
`,
|
|
194
|
+
isInline: true
|
|
195
|
+
});
|
|
196
|
+
};
|
|
197
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
198
|
+
minVersion: "12.0.0",
|
|
199
|
+
version: "22.2.0",
|
|
200
|
+
ngImport: i0,
|
|
201
|
+
type: MChart,
|
|
202
|
+
decorators: [{
|
|
203
|
+
type: Component,
|
|
204
|
+
args: [{
|
|
205
|
+
selector: "m-chart",
|
|
206
|
+
template: `
|
|
207
|
+
<div class="m-chart__container">
|
|
208
|
+
<canvas #canvas role="img" [attr.aria-label]="ariaLabel()">{{
|
|
209
|
+
ariaLabel()
|
|
210
|
+
}}</canvas>
|
|
211
|
+
</div>
|
|
212
|
+
@if (failed()) {
|
|
213
|
+
<span role="status">Chart could not be loaded.</span>
|
|
214
|
+
}
|
|
215
|
+
`,
|
|
216
|
+
host: { class: "m-chart" }
|
|
217
|
+
}]
|
|
218
|
+
}],
|
|
219
|
+
ctorParameters: () => [],
|
|
220
|
+
propDecorators: {
|
|
221
|
+
type: [{
|
|
222
|
+
type: i0.Input,
|
|
223
|
+
args: [{
|
|
224
|
+
isSignal: true,
|
|
225
|
+
alias: "type",
|
|
226
|
+
required: false
|
|
227
|
+
}]
|
|
228
|
+
}],
|
|
229
|
+
data: [{
|
|
230
|
+
type: i0.Input,
|
|
231
|
+
args: [{
|
|
232
|
+
isSignal: true,
|
|
233
|
+
alias: "data",
|
|
234
|
+
required: true
|
|
235
|
+
}]
|
|
236
|
+
}],
|
|
237
|
+
options: [{
|
|
238
|
+
type: i0.Input,
|
|
239
|
+
args: [{
|
|
240
|
+
isSignal: true,
|
|
241
|
+
alias: "options",
|
|
242
|
+
required: false
|
|
243
|
+
}]
|
|
244
|
+
}],
|
|
245
|
+
ariaLabel: [{
|
|
246
|
+
type: i0.Input,
|
|
247
|
+
args: [{
|
|
248
|
+
isSignal: true,
|
|
249
|
+
alias: "ariaLabel",
|
|
250
|
+
required: false
|
|
251
|
+
}]
|
|
252
|
+
}],
|
|
253
|
+
canvas: [{
|
|
254
|
+
type: i0.ViewChild,
|
|
255
|
+
args: ["canvas", { isSignal: true }]
|
|
256
|
+
}]
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
export { MChart };
|
|
260
|
+
|
|
261
|
+
//# sourceMappingURL=maliardic-ma-ui-chart.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maliardic-ma-ui-chart.mjs","names":[],"sources":["../../../projects/ma-ui/chart/src/lib/chart.ts"],"sourcesContent":["import {\n Component,\n ElementRef,\n OnDestroy,\n afterNextRender,\n effect,\n inject,\n input,\n type InputSignal,\n signal,\n viewChild,\n} from \"@angular/core\";\nimport type { Chart, ChartData, ChartOptions, ChartType } from \"chart.js\";\n\n// Copy plain configuration objects only: callbacks, gradients and other instances retain identity.\nfunction copy<T>(value: T): T {\n if (Array.isArray(value)) return value.map(copy) as T;\n if (value && Object.getPrototypeOf(value) === Object.prototype) {\n return Object.fromEntries(\n Object.entries(value).map(([key, item]) => [key, copy(item)]),\n ) as T;\n }\n return value;\n}\n\nfunction merge(\n base: Record<string, any>,\n overrides: Record<string, any>,\n): Record<string, any> {\n const result = copy(base);\n for (const [key, value] of Object.entries(overrides)) {\n if (value === undefined) continue;\n result[key] =\n value && Object.getPrototypeOf(value) === Object.prototype\n ? merge(\n result[key] && typeof result[key] === \"object\" ? result[key] : {},\n value,\n )\n : copy(value);\n }\n return result;\n}\n\n@Component({\n selector: \"m-chart\",\n template: `\n <div class=\"m-chart__container\">\n <canvas #canvas role=\"img\" [attr.aria-label]=\"ariaLabel()\">{{\n ariaLabel()\n }}</canvas>\n </div>\n @if (failed()) {\n <span role=\"status\">Chart could not be loaded.</span>\n }\n `,\n host: { class: \"m-chart\" },\n})\nexport class MChart implements OnDestroy {\n readonly type = input<ChartType>(\"bar\");\n readonly data = input.required<ChartData>();\n readonly options: InputSignal<ChartOptions> = input<ChartOptions>({});\n readonly ariaLabel = input(\"Chart\");\n protected readonly failed = signal(false);\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly canvas =\n viewChild.required<ElementRef<HTMLCanvasElement>>(\"canvas\");\n private readonly constructorRef = signal<typeof Chart | null>(null);\n private chart?: Chart;\n private chartType?: ChartType;\n private observer?: MutationObserver;\n private destroyed = false;\n\n constructor() {\n afterNextRender(() => {\n void import(\"chart.js/auto\")\n .then(({ default: ChartConstructor }) => {\n if (this.destroyed) return;\n this.constructorRef.set(ChartConstructor);\n this.observer = new MutationObserver(() => this.refreshTheme());\n for (\n let node: HTMLElement | null = this.host.nativeElement;\n node;\n node = node.parentElement\n ) {\n this.observer.observe(node, {\n attributes: true,\n attributeFilter: [\"class\", \"style\"],\n });\n }\n })\n .catch(() => {\n if (!this.destroyed) this.failed.set(true);\n });\n });\n effect(() => {\n const ChartConstructor = this.constructorRef();\n if (!ChartConstructor) return;\n const type = this.type();\n const data = copy(this.data());\n const options = this.themedOptions();\n if (this.chart && this.chartType === type) {\n this.chart.data = data;\n this.chart.options = options;\n this.chart.update();\n } else {\n this.chart?.destroy();\n this.chartType = type;\n this.chart = new ChartConstructor(this.canvas().nativeElement, {\n type,\n data,\n options,\n });\n }\n });\n }\n\n private themedOptions(): ChartOptions {\n const style = getComputedStyle(this.host.nativeElement);\n const color =\n style.getPropertyValue(\"--m-color-text\").trim() || style.color;\n const gridColor = style.getPropertyValue(\"--m-color-border\").trim();\n const font = { family: style.fontFamily, size: parseFloat(style.fontSize) };\n const axis = {\n ticks: { color, font },\n grid: { color: gridColor },\n border: { color: gridColor },\n title: { color, font },\n };\n const type = this.type();\n const scales: Record<string, unknown> = {};\n if (type === \"radar\" || type === \"polarArea\") {\n scales[\"r\"] = {\n ...axis,\n angleLines: { color: gridColor },\n pointLabels: { color, font },\n };\n } else if (type !== \"pie\" && type !== \"doughnut\") {\n scales[\"x\"] = axis;\n scales[\"y\"] = axis;\n }\n for (const key of Object.keys(this.options().scales ?? {})) {\n scales[key] ??= axis;\n }\n return merge(\n {\n responsive: true,\n maintainAspectRatio: false,\n color,\n font,\n scales,\n plugins: {\n legend: { labels: { color, font } },\n title: { color, font },\n subtitle: { color, font },\n },\n },\n this.options(),\n ) as ChartOptions;\n }\n\n private refreshTheme(): void {\n if (!this.chart || this.destroyed) return;\n this.chart.options = this.themedOptions();\n this.chart.update(\"none\");\n }\n\n ngOnDestroy(): void {\n this.destroyed = true;\n this.observer?.disconnect();\n this.chart?.destroy();\n }\n}\n"],"mappings":";;AAeA,SAAS,KAAQ,OAAQ;CACvB,IAAI,MAAM,QAAQ,KAAK,GAAG,OAAO,MAAM,IAAI,IAAI;CAC/C,IAAI,SAAS,OAAO,eAAe,KAAK,MAAM,OAAO,WACnD,OAAO,OAAO,YACZ,OAAO,QAAQ,KAAK,CAAC,CAAC,KAAK,CAAC,KAAK,UAAU,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC;CAGjE,OAAO;AACT;AAEA,SAAS,MACP,MACA,WAA8B;CAE9B,MAAM,SAAS,KAAK,IAAI;CACxB,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,SAAS,GAAG;EACpD,IAAI,UAAU,QAAW;EACzB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