shirkasoft-ui-components 1.14.0 → 2.0.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 +4 -8
- package/fesm2022/shirkasoft-ui-components-breadcrumb.mjs +189 -100
- package/fesm2022/shirkasoft-ui-components-breadcrumb.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-button.mjs +363 -69
- package/fesm2022/shirkasoft-ui-components-button.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-chart.mjs +206 -142
- package/fesm2022/shirkasoft-ui-components-chart.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-config.mjs +905 -843
- package/fesm2022/shirkasoft-ui-components-config.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-confirm-dialog.mjs +307 -142
- package/fesm2022/shirkasoft-ui-components-confirm-dialog.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-date-picker.mjs +1624 -1440
- package/fesm2022/shirkasoft-ui-components-date-picker.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-fieldset.mjs +347 -92
- package/fesm2022/shirkasoft-ui-components-fieldset.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-file-upload.mjs +484 -300
- package/fesm2022/shirkasoft-ui-components-file-upload.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-icons.mjs +1028 -533
- package/fesm2022/shirkasoft-ui-components-icons.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-knob.mjs +389 -201
- package/fesm2022/shirkasoft-ui-components-knob.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-loading.mjs +505 -128
- package/fesm2022/shirkasoft-ui-components-loading.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-modal.mjs +311 -314
- package/fesm2022/shirkasoft-ui-components-modal.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-notification.mjs +188 -142
- package/fesm2022/shirkasoft-ui-components-notification.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-price-input.mjs +517 -327
- package/fesm2022/shirkasoft-ui-components-price-input.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-rail-sidebar.mjs +669 -289
- package/fesm2022/shirkasoft-ui-components-rail-sidebar.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-select.mjs +1014 -819
- package/fesm2022/shirkasoft-ui-components-select.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-sidebar.mjs +508 -184
- package/fesm2022/shirkasoft-ui-components-sidebar.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-skeleton.mjs +197 -57
- package/fesm2022/shirkasoft-ui-components-skeleton.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-table.mjs +1916 -1698
- package/fesm2022/shirkasoft-ui-components-table.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-tabs.mjs +419 -175
- package/fesm2022/shirkasoft-ui-components-tabs.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-tag.mjs +175 -49
- package/fesm2022/shirkasoft-ui-components-tag.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-text-field.mjs +687 -402
- package/fesm2022/shirkasoft-ui-components-text-field.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-theme-picker.mjs +310 -124
- package/fesm2022/shirkasoft-ui-components-theme-picker.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-theme.mjs +141 -174
- package/fesm2022/shirkasoft-ui-components-theme.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-timeline.mjs +791 -203
- package/fesm2022/shirkasoft-ui-components-timeline.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-toggle.mjs +179 -109
- package/fesm2022/shirkasoft-ui-components-toggle.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-tooltip.mjs +244 -180
- package/fesm2022/shirkasoft-ui-components-tooltip.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-utils.mjs +95 -134
- package/fesm2022/shirkasoft-ui-components-utils.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-wizard.mjs +673 -165
- package/fesm2022/shirkasoft-ui-components-wizard.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components.mjs +0 -9
- package/package.json +5 -5
- package/types/shirkasoft-ui-components-breadcrumb.d.ts +59 -44
- package/types/shirkasoft-ui-components-button.d.ts +142 -49
- package/types/shirkasoft-ui-components-chart.d.ts +59 -44
- package/types/shirkasoft-ui-components-config.d.ts +193 -204
- package/types/shirkasoft-ui-components-confirm-dialog.d.ts +107 -66
- package/types/shirkasoft-ui-components-date-picker.d.ts +527 -398
- package/types/shirkasoft-ui-components-fieldset.d.ts +135 -60
- package/types/shirkasoft-ui-components-file-upload.d.ts +176 -112
- package/types/shirkasoft-ui-components-icons.d.ts +1302 -1294
- package/types/shirkasoft-ui-components-knob.d.ts +144 -78
- package/types/shirkasoft-ui-components-loading.d.ts +155 -64
- package/types/shirkasoft-ui-components-modal.d.ts +134 -136
- package/types/shirkasoft-ui-components-notification.d.ts +63 -59
- package/types/shirkasoft-ui-components-price-input.d.ts +198 -113
- package/types/shirkasoft-ui-components-rail-sidebar.d.ts +262 -142
- package/types/shirkasoft-ui-components-select.d.ts +301 -196
- package/types/shirkasoft-ui-components-sidebar.d.ts +198 -93
- package/types/shirkasoft-ui-components-skeleton.d.ts +68 -27
- package/types/shirkasoft-ui-components-table.d.ts +849 -660
- package/types/shirkasoft-ui-components-tabs.d.ts +102 -61
- package/types/shirkasoft-ui-components-tag.d.ts +54 -23
- package/types/shirkasoft-ui-components-text-field.d.ts +231 -127
- package/types/shirkasoft-ui-components-theme-picker.d.ts +92 -58
- package/types/shirkasoft-ui-components-theme.d.ts +56 -64
- package/types/shirkasoft-ui-components-timeline.d.ts +325 -150
- package/types/shirkasoft-ui-components-toggle.d.ts +73 -49
- package/types/shirkasoft-ui-components-tooltip.d.ts +64 -43
- package/types/shirkasoft-ui-components-utils.d.ts +15 -16
- package/types/shirkasoft-ui-components-wizard.d.ts +236 -87
- package/types/shirkasoft-ui-components.d.ts +1 -2
- package/fesm2022/shirkasoft-ui-components.mjs.map +0 -1
|
@@ -1,153 +1,217 @@
|
|
|
1
|
-
import * as i0 from
|
|
2
|
-
import {
|
|
3
|
-
import { Chart, registerables } from
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, effect, input, untracked, viewChild } from "@angular/core";
|
|
3
|
+
import { Chart, registerables } from "chart.js";
|
|
4
|
+
var ChartComponent = class ChartComponent {
|
|
5
|
+
static {
|
|
6
|
+
this.registered = false;
|
|
7
|
+
}
|
|
8
|
+
constructor() {
|
|
9
|
+
this.type = input("bar", ...ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []);
|
|
10
|
+
this.data = input({ datasets: [] }, ...ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []);
|
|
11
|
+
this.options = input({}, ...ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []);
|
|
12
|
+
this.canvasRef = viewChild.required("canvas", ...ngDevMode ? [{ debugName: "canvasRef" }] : /* istanbul ignore next */ []);
|
|
13
|
+
this.chartInstance = null;
|
|
14
|
+
this.initialized = false;
|
|
15
|
+
if (!ChartComponent.registered) {
|
|
16
|
+
Chart.register(...registerables);
|
|
17
|
+
ChartComponent.registered = true;
|
|
18
|
+
}
|
|
19
|
+
effect(() => {
|
|
20
|
+
const t = this.type();
|
|
21
|
+
const d = this.data();
|
|
22
|
+
const o = this.options();
|
|
23
|
+
untracked(() => {
|
|
24
|
+
if (!this.initialized) return;
|
|
25
|
+
this.updateChart(t, d, o);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
ngAfterViewInit() {
|
|
30
|
+
this.initialized = true;
|
|
31
|
+
this.initChart();
|
|
32
|
+
}
|
|
33
|
+
ngOnDestroy() {
|
|
34
|
+
this.chartInstance?.destroy();
|
|
35
|
+
}
|
|
36
|
+
resetCanvas() {
|
|
37
|
+
const canvas = this.canvasRef().nativeElement;
|
|
38
|
+
canvas.width = canvas.width;
|
|
39
|
+
}
|
|
40
|
+
initChart() {
|
|
41
|
+
this.resetCanvas();
|
|
42
|
+
const ctx = this.canvasRef().nativeElement.getContext("2d");
|
|
43
|
+
if (!ctx) return;
|
|
44
|
+
this.chartInstance = new Chart(ctx, {
|
|
45
|
+
type: this.type(),
|
|
46
|
+
data: this.deepClone(this.data()),
|
|
47
|
+
options: this.deepClone(this.options())
|
|
48
|
+
});
|
|
49
|
+
this.chartInstance.resize();
|
|
50
|
+
}
|
|
51
|
+
deepClone(value) {
|
|
52
|
+
try {
|
|
53
|
+
if (typeof structuredClone === "function") return structuredClone(value);
|
|
54
|
+
} catch {}
|
|
55
|
+
return JSON.parse(JSON.stringify(value));
|
|
56
|
+
}
|
|
57
|
+
updateChart(type, data, options) {
|
|
58
|
+
if (!this.chartInstance) {
|
|
59
|
+
this.initChart();
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (type !== this.chartInstance.config.type) {
|
|
63
|
+
this.chartInstance.stop();
|
|
64
|
+
this.chartInstance.destroy();
|
|
65
|
+
this.chartInstance = null;
|
|
66
|
+
this.resetCanvas();
|
|
67
|
+
this.initChart();
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
this.chartInstance.data = data;
|
|
71
|
+
this.chartInstance.options = options;
|
|
72
|
+
this.chartInstance.update();
|
|
73
|
+
}
|
|
74
|
+
static {
|
|
75
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
76
|
+
minVersion: "12.0.0",
|
|
77
|
+
version: "22.3.2",
|
|
78
|
+
ngImport: i0,
|
|
79
|
+
type: ChartComponent,
|
|
80
|
+
deps: [],
|
|
81
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
static {
|
|
85
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
86
|
+
minVersion: "17.2.0",
|
|
87
|
+
version: "22.3.2",
|
|
88
|
+
type: ChartComponent,
|
|
89
|
+
isStandalone: true,
|
|
90
|
+
selector: "shk-chart",
|
|
91
|
+
inputs: {
|
|
92
|
+
type: {
|
|
93
|
+
classPropertyName: "type",
|
|
94
|
+
publicName: "type",
|
|
95
|
+
isSignal: true,
|
|
96
|
+
isRequired: false,
|
|
97
|
+
transformFunction: null
|
|
98
|
+
},
|
|
99
|
+
data: {
|
|
100
|
+
classPropertyName: "data",
|
|
101
|
+
publicName: "data",
|
|
102
|
+
isSignal: true,
|
|
103
|
+
isRequired: false,
|
|
104
|
+
transformFunction: null
|
|
105
|
+
},
|
|
106
|
+
options: {
|
|
107
|
+
classPropertyName: "options",
|
|
108
|
+
publicName: "options",
|
|
109
|
+
isSignal: true,
|
|
110
|
+
isRequired: false,
|
|
111
|
+
transformFunction: null
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
viewQueries: [{
|
|
115
|
+
propertyName: "canvasRef",
|
|
116
|
+
first: true,
|
|
117
|
+
predicate: ["canvas"],
|
|
118
|
+
descendants: true,
|
|
119
|
+
isSignal: true
|
|
120
|
+
}],
|
|
121
|
+
ngImport: i0,
|
|
122
|
+
template: `
|
|
103
123
|
<div class="relative h-full w-full">
|
|
104
124
|
<canvas #canvas></canvas>
|
|
105
125
|
</div>
|
|
106
|
-
`,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
126
|
+
`,
|
|
127
|
+
isInline: true,
|
|
128
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
133
|
+
minVersion: "12.0.0",
|
|
134
|
+
version: "22.3.2",
|
|
135
|
+
ngImport: i0,
|
|
136
|
+
type: ChartComponent,
|
|
137
|
+
decorators: [{
|
|
138
|
+
type: Component,
|
|
139
|
+
args: [{
|
|
140
|
+
selector: "shk-chart",
|
|
141
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
142
|
+
template: `
|
|
114
143
|
<div class="relative h-full w-full">
|
|
115
144
|
<canvas #canvas></canvas>
|
|
116
145
|
</div>
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
146
|
+
`
|
|
147
|
+
}]
|
|
148
|
+
}],
|
|
149
|
+
ctorParameters: () => [],
|
|
150
|
+
propDecorators: {
|
|
151
|
+
type: [{
|
|
152
|
+
type: i0.Input,
|
|
153
|
+
args: [{
|
|
154
|
+
isSignal: true,
|
|
155
|
+
alias: "type",
|
|
156
|
+
required: false
|
|
157
|
+
}]
|
|
158
|
+
}],
|
|
159
|
+
data: [{
|
|
160
|
+
type: i0.Input,
|
|
161
|
+
args: [{
|
|
162
|
+
isSignal: true,
|
|
163
|
+
alias: "data",
|
|
164
|
+
required: false
|
|
165
|
+
}]
|
|
166
|
+
}],
|
|
167
|
+
options: [{
|
|
168
|
+
type: i0.Input,
|
|
169
|
+
args: [{
|
|
170
|
+
isSignal: true,
|
|
171
|
+
alias: "options",
|
|
172
|
+
required: false
|
|
173
|
+
}]
|
|
174
|
+
}],
|
|
175
|
+
canvasRef: [{
|
|
176
|
+
type: i0.ViewChild,
|
|
177
|
+
args: ["canvas", { isSignal: true }]
|
|
178
|
+
}]
|
|
179
|
+
}
|
|
180
|
+
});
|
|
127
181
|
const COLOR_PALETTE = [
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
182
|
+
{
|
|
183
|
+
bg: "rgba(59, 130, 246, 0.2)",
|
|
184
|
+
border: "rgb(59, 130, 246)"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
bg: "rgba(34, 197, 94, 0.2)",
|
|
188
|
+
border: "rgb(34, 197, 94)"
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
bg: "rgba(249, 115, 22, 0.2)",
|
|
192
|
+
border: "rgb(249, 115, 22)"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
bg: "rgba(139, 92, 246, 0.2)",
|
|
196
|
+
border: "rgb(139, 92, 246)"
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
bg: "rgba(236, 72, 153, 0.2)",
|
|
200
|
+
border: "rgb(236, 72, 153)"
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
bg: "rgba(6, 182, 212, 0.2)",
|
|
204
|
+
border: "rgb(6, 182, 212)"
|
|
205
|
+
}
|
|
134
206
|
];
|
|
135
|
-
/**
|
|
136
|
-
* Reads the current `--shk-*` CSS variables from the document and returns
|
|
137
|
-
* the text, muted and border colors used by charts to follow the active theme.
|
|
138
|
-
*/
|
|
139
207
|
function readThemeColors() {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
208
|
+
const docStyle = getComputedStyle(document.documentElement);
|
|
209
|
+
return {
|
|
210
|
+
text: docStyle.getPropertyValue("--shk-surface-900") || "#27272a",
|
|
211
|
+
muted: docStyle.getPropertyValue("--shk-surface-500") || "#71717a",
|
|
212
|
+
border: docStyle.getPropertyValue("--shk-surface-200") || "#e4e4e7"
|
|
213
|
+
};
|
|
146
214
|
}
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* Generated bundle index. Do not edit.
|
|
150
|
-
*/
|
|
151
|
-
|
|
152
215
|
export { COLOR_PALETTE, ChartComponent, readThemeColors };
|
|
153
|
-
|
|
216
|
+
|
|
217
|
+
//# sourceMappingURL=shirkasoft-ui-components-chart.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shirkasoft-ui-components-chart.mjs","sources":["../../../projects/ui-components/chart/chart.component.ts","../../../projects/ui-components/chart/chart.utils.ts"
|
|
1
|
+
{"version":3,"file":"shirkasoft-ui-components-chart.mjs","names":[],"sources":["../../../projects/ui-components/chart/chart.component.ts","../../../projects/ui-components/chart/chart.utils.ts"],"sourcesContent":["import {\n Component,\n ChangeDetectionStrategy,\n input,\n viewChild,\n ElementRef,\n effect,\n untracked,\n AfterViewInit,\n OnDestroy,\n} from '@angular/core';\nimport { Chart, registerables } from 'chart.js';\n\n/**\n * Shirkasoft UI Components.\n * Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).\n * Belongs to Shirkasoft.\n */\n\n/**\n * Chart.js wrapper that renders line, bar, pie, doughnut or polarArea charts\n * and updates them reactively as the inputs change.\n */\n@Component({\n selector: 'shk-chart',\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n <div class=\"relative h-full w-full\">\n <canvas #canvas></canvas>\n </div>\n `,\n})\nexport class ChartComponent implements AfterViewInit, OnDestroy {\n /** Guarantees Chart.js plugins are only registered once. */\n private static registered = false;\n\n /** Type of chart to render. */\n type = input<'line' | 'bar' | 'pie' | 'doughnut' | 'polarArea'>('bar');\n /** Chart.js datasets payload. */\n data = input<any>({ datasets: [] });\n /** Chart.js options object. */\n options = input<any>({});\n\n /** Reference to the inner canvas element. */\n private canvasRef = viewChild.required<ElementRef<HTMLCanvasElement>>('canvas');\n /** Live Chart.js instance. */\n private chartInstance: Chart | null = null;\n /** Whether the view has been initialized yet. */\n private initialized = false;\n\n constructor() {\n if (!ChartComponent.registered) {\n Chart.register(...registerables);\n ChartComponent.registered = true;\n }\n\n effect(() => {\n const t = this.type();\n const d = this.data();\n const o = this.options();\n untracked(() => {\n if (!this.initialized) return;\n this.updateChart(t, d, o);\n });\n });\n }\n\n /** Creates the initial chart once the canvas is available. */\n ngAfterViewInit(): void {\n this.initialized = true;\n this.initChart();\n }\n\n /** Destroys the Chart.js instance. */\n ngOnDestroy(): void {\n this.chartInstance?.destroy();\n }\n\n /** Clears the canvas by reassigning its width. */\n private resetCanvas(): void {\n const canvas = this.canvasRef().nativeElement;\n canvas.width = canvas.width;\n }\n\n /** Creates a new Chart.js instance on the canvas. */\n private initChart(): void {\n this.resetCanvas();\n const canvas = this.canvasRef().nativeElement;\n const ctx = canvas.getContext('2d');\n if (!ctx) return;\n this.chartInstance = new Chart(ctx, {\n type: this.type(),\n data: this.deepClone(this.data()),\n options: this.deepClone(this.options()),\n });\n this.chartInstance.resize();\n }\n\n /** Deep clones a value to detach it from Angular's reactive objects. */\n private deepClone<T>(value: T): T {\n try {\n if (typeof structuredClone === 'function') return structuredClone(value);\n } catch {}\n return JSON.parse(JSON.stringify(value));\n }\n\n /** Applies the new data/options, rebuilding the chart when the type changes. */\n private updateChart(type: string, data: any, options: any): void {\n if (!this.chartInstance) {\n this.initChart();\n return;\n }\n\n const config = this.chartInstance.config as any;\n if (type !== config.type) {\n this.chartInstance.stop();\n this.chartInstance.destroy();\n this.chartInstance = null;\n this.resetCanvas();\n this.initChart();\n return;\n }\n\n this.chartInstance.data = data;\n this.chartInstance.options = options;\n this.chartInstance.update();\n }\n}\n","/**\n * Shirkasoft UI Components.\n * Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).\n * Belongs to Shirkasoft.\n */\n\n/** Default dataset colors used by the ChartComponent when no palette is provided. */\nexport const COLOR_PALETTE = [\n { bg: 'rgba(59, 130, 246, 0.2)', border: 'rgb(59, 130, 246)' },\n { bg: 'rgba(34, 197, 94, 0.2)', border: 'rgb(34, 197, 94)' },\n { bg: 'rgba(249, 115, 22, 0.2)', border: 'rgb(249, 115, 22)' },\n { bg: 'rgba(139, 92, 246, 0.2)', border: 'rgb(139, 92, 246)' },\n { bg: 'rgba(236, 72, 153, 0.2)', border: 'rgb(236, 72, 153)' },\n { bg: 'rgba(6, 182, 212, 0.2)', border: 'rgb(6, 182, 212)' },\n];\n\n/**\n * Reads the current `--shk-*` CSS variables from the document and returns\n * the text, muted and border colors used by charts to follow the active theme.\n */\nexport function readThemeColors() {\n const docStyle = getComputedStyle(document.documentElement);\n return {\n text: docStyle.getPropertyValue('--shk-surface-900') || '#27272a',\n muted: docStyle.getPropertyValue('--shk-surface-500') || '#71717a',\n border: docStyle.getPropertyValue('--shk-surface-200') || '#e4e4e7',\n };\n}"],"mappings":";;;AAgCA,IAAa,iBAAb,MAAa,eAAc;CAEV;EAAA,KAAA,aAAa;CAAM;CAgBlC,cAAA;EAbA,KAAA,OAAO,MAAyD,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;EAEtE,KAAA,OAAO,MAAW,EAAE,UAAU,CAAA,EAAE,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;EAEnC,KAAA,UAAU,MAAW,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;EAGhB,KAAA,YAAY,UAAU,SAAwC,UAAS,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;EAEvE,KAAA,gBAA8B;EAE9B,KAAA,cAAc;EAGpB,IAAI,CAAC,eAAe,YAAY;GAC9B,MAAM,SAAS,GAAG,aAAa;GAC/B,eAAe,aAAa;EAC9B;EAEA,aAAY;GACV,MAAM,IAAI,KAAK,KAAI;GACnB,MAAM,IAAI,KAAK,KAAI;GACnB,MAAM,IAAI,KAAK,QAAO;GACtB,gBAAe;IACb,IAAI,CAAC,KAAK,aAAa;IACvB,KAAK,YAAY,GAAG,GAAG,CAAC;GAC1B,CAAC;EACH,CAAC;CACH;CAGA,kBAAe;EACb,KAAK,cAAc;EACnB,KAAK,UAAS;CAChB;CAGA,cAAW;EACT,KAAK,eAAe,QAAO;CAC7B;CAGQ,cAAW;EACjB,MAAM,SAAS,KAAK,UAAS,CAAE,CAAC;EAChC,OAAO,QAAQ,OAAO;CACxB;CAGQ,YAAS;EACf,KAAK,YAAW;EAEhB,MAAM,MADS,KAAK,UAAS,CAAE,CAAC,cACb,WAAW,IAAI;EAClC,IAAI,CAAC,KA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