shirkasoft-ui-components 1.14.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/README.md +12 -9
  2. package/fesm2022/shirkasoft-ui-components-breadcrumb.mjs +189 -100
  3. package/fesm2022/shirkasoft-ui-components-breadcrumb.mjs.map +1 -1
  4. package/fesm2022/shirkasoft-ui-components-button.mjs +363 -69
  5. package/fesm2022/shirkasoft-ui-components-button.mjs.map +1 -1
  6. package/fesm2022/shirkasoft-ui-components-chart.mjs +206 -142
  7. package/fesm2022/shirkasoft-ui-components-chart.mjs.map +1 -1
  8. package/fesm2022/shirkasoft-ui-components-config.mjs +905 -843
  9. package/fesm2022/shirkasoft-ui-components-config.mjs.map +1 -1
  10. package/fesm2022/shirkasoft-ui-components-confirm-dialog.mjs +307 -142
  11. package/fesm2022/shirkasoft-ui-components-confirm-dialog.mjs.map +1 -1
  12. package/fesm2022/shirkasoft-ui-components-date-picker.mjs +1697 -1440
  13. package/fesm2022/shirkasoft-ui-components-date-picker.mjs.map +1 -1
  14. package/fesm2022/shirkasoft-ui-components-fieldset.mjs +347 -92
  15. package/fesm2022/shirkasoft-ui-components-fieldset.mjs.map +1 -1
  16. package/fesm2022/shirkasoft-ui-components-file-upload.mjs +555 -300
  17. package/fesm2022/shirkasoft-ui-components-file-upload.mjs.map +1 -1
  18. package/fesm2022/shirkasoft-ui-components-icons.mjs +1028 -533
  19. package/fesm2022/shirkasoft-ui-components-icons.mjs.map +1 -1
  20. package/fesm2022/shirkasoft-ui-components-knob.mjs +389 -201
  21. package/fesm2022/shirkasoft-ui-components-knob.mjs.map +1 -1
  22. package/fesm2022/shirkasoft-ui-components-loading.mjs +505 -128
  23. package/fesm2022/shirkasoft-ui-components-loading.mjs.map +1 -1
  24. package/fesm2022/shirkasoft-ui-components-modal.mjs +311 -314
  25. package/fesm2022/shirkasoft-ui-components-modal.mjs.map +1 -1
  26. package/fesm2022/shirkasoft-ui-components-notification.mjs +188 -142
  27. package/fesm2022/shirkasoft-ui-components-notification.mjs.map +1 -1
  28. package/fesm2022/shirkasoft-ui-components-price-input.mjs +585 -327
  29. package/fesm2022/shirkasoft-ui-components-price-input.mjs.map +1 -1
  30. package/fesm2022/shirkasoft-ui-components-rail-sidebar.mjs +669 -289
  31. package/fesm2022/shirkasoft-ui-components-rail-sidebar.mjs.map +1 -1
  32. package/fesm2022/shirkasoft-ui-components-select.mjs +1076 -819
  33. package/fesm2022/shirkasoft-ui-components-select.mjs.map +1 -1
  34. package/fesm2022/shirkasoft-ui-components-sidebar.mjs +508 -184
  35. package/fesm2022/shirkasoft-ui-components-sidebar.mjs.map +1 -1
  36. package/fesm2022/shirkasoft-ui-components-skeleton.mjs +197 -57
  37. package/fesm2022/shirkasoft-ui-components-skeleton.mjs.map +1 -1
  38. package/fesm2022/shirkasoft-ui-components-table.mjs +1916 -1698
  39. package/fesm2022/shirkasoft-ui-components-table.mjs.map +1 -1
  40. package/fesm2022/shirkasoft-ui-components-tabs.mjs +419 -175
  41. package/fesm2022/shirkasoft-ui-components-tabs.mjs.map +1 -1
  42. package/fesm2022/shirkasoft-ui-components-tag.mjs +175 -49
  43. package/fesm2022/shirkasoft-ui-components-tag.mjs.map +1 -1
  44. package/fesm2022/shirkasoft-ui-components-text-field.mjs +749 -402
  45. package/fesm2022/shirkasoft-ui-components-text-field.mjs.map +1 -1
  46. package/fesm2022/shirkasoft-ui-components-theme-picker.mjs +310 -124
  47. package/fesm2022/shirkasoft-ui-components-theme-picker.mjs.map +1 -1
  48. package/fesm2022/shirkasoft-ui-components-theme.mjs +141 -174
  49. package/fesm2022/shirkasoft-ui-components-theme.mjs.map +1 -1
  50. package/fesm2022/shirkasoft-ui-components-timeline.mjs +791 -203
  51. package/fesm2022/shirkasoft-ui-components-timeline.mjs.map +1 -1
  52. package/fesm2022/shirkasoft-ui-components-toggle.mjs +179 -109
  53. package/fesm2022/shirkasoft-ui-components-toggle.mjs.map +1 -1
  54. package/fesm2022/shirkasoft-ui-components-tooltip.mjs +244 -180
  55. package/fesm2022/shirkasoft-ui-components-tooltip.mjs.map +1 -1
  56. package/fesm2022/shirkasoft-ui-components-utils.mjs +129 -133
  57. package/fesm2022/shirkasoft-ui-components-utils.mjs.map +1 -1
  58. package/fesm2022/shirkasoft-ui-components-wizard.mjs +673 -165
  59. package/fesm2022/shirkasoft-ui-components-wizard.mjs.map +1 -1
  60. package/fesm2022/shirkasoft-ui-components.mjs +0 -9
  61. package/package.json +5 -5
  62. package/types/shirkasoft-ui-components-breadcrumb.d.ts +59 -44
  63. package/types/shirkasoft-ui-components-button.d.ts +142 -49
  64. package/types/shirkasoft-ui-components-chart.d.ts +59 -44
  65. package/types/shirkasoft-ui-components-config.d.ts +193 -204
  66. package/types/shirkasoft-ui-components-confirm-dialog.d.ts +107 -66
  67. package/types/shirkasoft-ui-components-date-picker.d.ts +561 -398
  68. package/types/shirkasoft-ui-components-fieldset.d.ts +135 -60
  69. package/types/shirkasoft-ui-components-file-upload.d.ts +210 -112
  70. package/types/shirkasoft-ui-components-icons.d.ts +1302 -1294
  71. package/types/shirkasoft-ui-components-knob.d.ts +144 -78
  72. package/types/shirkasoft-ui-components-loading.d.ts +155 -64
  73. package/types/shirkasoft-ui-components-modal.d.ts +134 -136
  74. package/types/shirkasoft-ui-components-notification.d.ts +63 -59
  75. package/types/shirkasoft-ui-components-price-input.d.ts +232 -113
  76. package/types/shirkasoft-ui-components-rail-sidebar.d.ts +262 -142
  77. package/types/shirkasoft-ui-components-select.d.ts +335 -196
  78. package/types/shirkasoft-ui-components-sidebar.d.ts +198 -93
  79. package/types/shirkasoft-ui-components-skeleton.d.ts +68 -27
  80. package/types/shirkasoft-ui-components-table.d.ts +849 -660
  81. package/types/shirkasoft-ui-components-tabs.d.ts +102 -61
  82. package/types/shirkasoft-ui-components-tag.d.ts +54 -23
  83. package/types/shirkasoft-ui-components-text-field.d.ts +263 -127
  84. package/types/shirkasoft-ui-components-theme-picker.d.ts +92 -58
  85. package/types/shirkasoft-ui-components-theme.d.ts +56 -64
  86. package/types/shirkasoft-ui-components-timeline.d.ts +325 -150
  87. package/types/shirkasoft-ui-components-toggle.d.ts +73 -49
  88. package/types/shirkasoft-ui-components-tooltip.d.ts +64 -43
  89. package/types/shirkasoft-ui-components-utils.d.ts +47 -15
  90. package/types/shirkasoft-ui-components-wizard.d.ts +236 -87
  91. package/types/shirkasoft-ui-components.d.ts +1 -2
  92. package/fesm2022/shirkasoft-ui-components.mjs.map +0 -1
@@ -1,185 +1,245 @@
1
- import * as i0 from '@angular/core';
2
- import { model, input, output, viewChild, signal, computed, forwardRef, ChangeDetectionStrategy, Component } from '@angular/core';
3
- import { NG_VALUE_ACCESSOR } from '@angular/forms';
4
-
5
- /**
6
- * Shirkasoft UI Components.
7
- * Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).
8
- * Belongs to Shirkasoft.
9
- */
10
- /**
11
- * SVG radial knob with drag and keyboard support.
12
- *
13
- * Implements `ControlValueAccessor` (reactive/template-driven forms) and the
14
- * Angular Signal Forms `FormValueControl<number>` contract through its
15
- * `value` model, so it also works with `[formField]`.
16
- */
17
- class KnobComponent {
18
- constructor() {
19
- /** Current value. Two-way bindable with [(value)]. */
20
- this.value = model(0, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
21
- /**
22
- * Minimum value. Optional so the component satisfies the Signal Forms
23
- * `FormUiControl` contract (`min` accepts `undefined`); defaults to 0.
24
- */
25
- this.min = input(0, ...(ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []));
26
- /**
27
- * Maximum value. Optional so the component satisfies the Signal Forms
28
- * `FormUiControl` contract (`max` accepts `undefined`); defaults to 100.
29
- */
30
- this.max = input(100, ...(ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []));
31
- /** Increment used by arrows and pointer drag rounding. */
32
- this.step = input(1, ...(ngDevMode ? [{ debugName: "step" }] : /* istanbul ignore next */ []));
33
- /** Diameter of the knob in px. */
34
- this.size = input(100, ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
35
- /** Thickness of the arc stroke. */
36
- this.strokeWidth = input(14, ...(ngDevMode ? [{ debugName: "strokeWidth" }] : /* istanbul ignore next */ []));
37
- /** Color of the filled arc. */
38
- this.valueColor = input('var(--shk-primary-600)', ...(ngDevMode ? [{ debugName: "valueColor" }] : /* istanbul ignore next */ []));
39
- /** Color of the track arc. */
40
- this.rangeColor = input('var(--shk-surface-200)', ...(ngDevMode ? [{ debugName: "rangeColor" }] : /* istanbul ignore next */ []));
41
- /** Whether the current value is shown in the center. */
42
- this.showValue = input(true, ...(ngDevMode ? [{ debugName: "showValue" }] : /* istanbul ignore next */ []));
43
- /** Disables user interaction. */
44
- this.disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
45
- /** Blocks editing but keeps the control styled as enabled. */
46
- this.readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
47
- /** Accessible label. */
48
- this.ariaLabel = input('', ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
49
- /** Emitted when the knob value changes. */
50
- this.change = output();
51
- /** Emitted when the user releases the pointer. */
52
- this.end = output();
53
- /** Emitted on blur so Signal Forms can mark the field as touched. */
54
- this.touch = output();
55
- this.knobSvg = viewChild('knobSvg', ...(ngDevMode ? [{ debugName: "knobSvg" }] : /* istanbul ignore next */ []));
56
- this.onChange = () => { };
57
- this.onTouched = () => { };
58
- this.dragging = false;
59
- this.formDisabled = signal(false, ...(ngDevMode ? [{ debugName: "formDisabled" }] : /* istanbul ignore next */ []));
60
- /** Effective disabled state combining the `disabled` input and the form binding. */
61
- this.effectiveDisabled = computed(() => this.disabled() || this.formDisabled(), ...(ngDevMode ? [{ debugName: "effectiveDisabled" }] : /* istanbul ignore next */ []));
62
- /** Minimum value with the `0` fallback applied. */
63
- this.effectiveMin = computed(() => this.min() ?? 0, ...(ngDevMode ? [{ debugName: "effectiveMin" }] : /* istanbul ignore next */ []));
64
- /** Maximum value with the `100` fallback applied. */
65
- this.effectiveMax = computed(() => this.max() ?? 100, ...(ngDevMode ? [{ debugName: "effectiveMax" }] : /* istanbul ignore next */ []));
66
- this.r = computed(() => (this.size() - this.strokeWidth()) / 2, ...(ngDevMode ? [{ debugName: "r" }] : /* istanbul ignore next */ []));
67
- this.center = computed(() => this.size() / 2, ...(ngDevMode ? [{ debugName: "center" }] : /* istanbul ignore next */ []));
68
- this.fraction = computed(() => {
69
- const range = this.effectiveMax() - this.effectiveMin();
70
- if (range <= 0)
71
- return 0;
72
- return Math.max(0, Math.min(1, (this.value() - this.effectiveMin()) / range));
73
- }, ...(ngDevMode ? [{ debugName: "fraction" }] : /* istanbul ignore next */ []));
74
- this.rangeArc = computed(() => this.getArcPath(135, 405), ...(ngDevMode ? [{ debugName: "rangeArc" }] : /* istanbul ignore next */ []));
75
- this.valueArc = computed(() => this.getArcPath(135, 135 + 270 * this.fraction()), ...(ngDevMode ? [{ debugName: "valueArc" }] : /* istanbul ignore next */ []));
76
- }
77
- writeValue(value) {
78
- // `0` is a valid value (e.g. when min < 0); only non-numbers fall back to min.
79
- const numeric = value === null || value === undefined || value === '' ? NaN : Number(value);
80
- this.value.set(this.clamp(Number.isFinite(numeric) ? numeric : this.effectiveMin()));
81
- }
82
- registerOnChange(fn) {
83
- this.onChange = fn;
84
- }
85
- registerOnTouched(fn) {
86
- this.onTouched = fn;
87
- }
88
- /** Marks the control as touched when focus leaves the knob. */
89
- onBlur() {
90
- this.onTouched();
91
- this.touch.emit();
92
- }
93
- setDisabledState(isDisabled) {
94
- this.formDisabled.set(isDisabled);
95
- }
96
- onPointerDown(event) {
97
- if (this.effectiveDisabled() || this.readonly())
98
- return;
99
- this.dragging = true;
100
- this.knobSvg()?.nativeElement.setPointerCapture(event.pointerId);
101
- this.applyEvent(event);
102
- }
103
- onPointerMove(event) {
104
- if (!this.dragging)
105
- return;
106
- this.applyEvent(event);
107
- }
108
- onPointerUp(event) {
109
- if (!this.dragging)
110
- return;
111
- this.dragging = false;
112
- try {
113
- this.knobSvg()?.nativeElement.releasePointerCapture(event.pointerId);
114
- }
115
- catch {
116
- /* noop */
117
- }
118
- this.change.emit(this.value());
119
- this.end.emit(this.value());
120
- }
121
- updateByKey(step) {
122
- if (this.effectiveDisabled() || this.readonly())
123
- return;
124
- this.setValue(this.value() + step);
125
- this.onTouched();
126
- }
127
- applyEvent(event) {
128
- const svg = this.knobSvg()?.nativeElement;
129
- if (!svg)
130
- return;
131
- const rect = svg.getBoundingClientRect();
132
- const cx = rect.left + rect.width / 2;
133
- const cy = rect.top + rect.height / 2;
134
- const angle = Math.atan2(event.clientY - cy, event.clientX - cx);
135
- const deg = ((angle * 180) / Math.PI + 360) % 360;
136
- let t = deg - 135;
137
- if (t < 0)
138
- t += 360;
139
- let fraction;
140
- if (t > 270) {
141
- fraction = 360 - t < t - 270 ? 0 : 1;
142
- }
143
- else {
144
- fraction = t / 270;
145
- }
146
- const raw = this.effectiveMin() + fraction * (this.effectiveMax() - this.effectiveMin());
147
- this.setValue(raw);
148
- this.onTouched();
149
- }
150
- setValue(raw) {
151
- const rounded = Math.round(raw / this.step()) * this.step();
152
- const clamped = this.clamp(rounded);
153
- this.value.set(clamped);
154
- this.onChange(clamped);
155
- }
156
- clamp(value) {
157
- return Math.max(this.effectiveMin(), Math.min(this.effectiveMax(), value));
158
- }
159
- getArcPath(startDeg, endDeg) {
160
- const cx = this.center();
161
- const cy = this.center();
162
- const r = this.r();
163
- const start = this.anglePoint(cx, cy, r, startDeg);
164
- const end = this.anglePoint(cx, cy, r, endDeg);
165
- const largeArc = endDeg - startDeg > 180 ? '1' : '0';
166
- return `M ${start.x.toFixed(2)} ${start.y.toFixed(2)} A ${r.toFixed(2)} ${r.toFixed(2)} 0 ${largeArc} 1 ${end.x.toFixed(2)} ${end.y.toFixed(2)}`;
167
- }
168
- anglePoint(cx, cy, r, angleDeg) {
169
- const rad = (Math.PI * angleDeg) / 180;
170
- return {
171
- x: cx + r * Math.cos(rad),
172
- y: cy + r * Math.sin(rad),
173
- };
174
- }
175
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.27", ngImport: i0, type: KnobComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
176
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.27", type: KnobComponent, isStandalone: true, selector: "shk-knob", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, strokeWidth: { classPropertyName: "strokeWidth", publicName: "strokeWidth", isSignal: true, isRequired: false, transformFunction: null }, valueColor: { classPropertyName: "valueColor", publicName: "valueColor", isSignal: true, isRequired: false, transformFunction: null }, rangeColor: { classPropertyName: "rangeColor", publicName: "rangeColor", isSignal: true, isRequired: false, transformFunction: null }, showValue: { classPropertyName: "showValue", publicName: "showValue", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", change: "change", end: "end", touch: "touch" }, providers: [
177
- {
178
- provide: NG_VALUE_ACCESSOR,
179
- useExisting: forwardRef(() => KnobComponent),
180
- multi: true,
181
- },
182
- ], viewQueries: [{ propertyName: "knobSvg", first: true, predicate: ["knobSvg"], descendants: true, isSignal: true }], ngImport: i0, template: `
1
+ import * as i0 from "@angular/core";
2
+ import { ChangeDetectionStrategy, Component, computed, forwardRef, input, model, output, signal, viewChild } from "@angular/core";
3
+ import { NG_VALUE_ACCESSOR } from "@angular/forms";
4
+ var KnobComponent = class KnobComponent {
5
+ constructor() {
6
+ this.value = model(0, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
7
+ this.min = input(0, ...ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []);
8
+ this.max = input(100, ...ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []);
9
+ this.step = input(1, ...ngDevMode ? [{ debugName: "step" }] : /* istanbul ignore next */ []);
10
+ this.size = input(100, ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
11
+ this.strokeWidth = input(14, ...ngDevMode ? [{ debugName: "strokeWidth" }] : /* istanbul ignore next */ []);
12
+ this.valueColor = input("var(--shk-primary-600)", ...ngDevMode ? [{ debugName: "valueColor" }] : /* istanbul ignore next */ []);
13
+ this.rangeColor = input("var(--shk-surface-200)", ...ngDevMode ? [{ debugName: "rangeColor" }] : /* istanbul ignore next */ []);
14
+ this.showValue = input(true, ...ngDevMode ? [{ debugName: "showValue" }] : /* istanbul ignore next */ []);
15
+ this.disabled = input(false, ...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
16
+ this.readonly = input(false, ...ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []);
17
+ this.ariaLabel = input("", ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
18
+ this.change = output();
19
+ this.end = output();
20
+ this.touch = output();
21
+ this.knobSvg = viewChild("knobSvg", ...ngDevMode ? [{ debugName: "knobSvg" }] : /* istanbul ignore next */ []);
22
+ this.onChange = () => {};
23
+ this.onTouched = () => {};
24
+ this.dragging = false;
25
+ this.formDisabled = signal(false, ...ngDevMode ? [{ debugName: "formDisabled" }] : /* istanbul ignore next */ []);
26
+ this.effectiveDisabled = computed(() => this.disabled() || this.formDisabled(), ...ngDevMode ? [{ debugName: "effectiveDisabled" }] : /* istanbul ignore next */ []);
27
+ this.effectiveMin = computed(() => this.min() ?? 0, ...ngDevMode ? [{ debugName: "effectiveMin" }] : /* istanbul ignore next */ []);
28
+ this.effectiveMax = computed(() => this.max() ?? 100, ...ngDevMode ? [{ debugName: "effectiveMax" }] : /* istanbul ignore next */ []);
29
+ this.r = computed(() => (this.size() - this.strokeWidth()) / 2, ...ngDevMode ? [{ debugName: "r" }] : /* istanbul ignore next */ []);
30
+ this.center = computed(() => this.size() / 2, ...ngDevMode ? [{ debugName: "center" }] : /* istanbul ignore next */ []);
31
+ this.fraction = computed(() => {
32
+ const range = this.effectiveMax() - this.effectiveMin();
33
+ if (range <= 0) return 0;
34
+ return Math.max(0, Math.min(1, (this.value() - this.effectiveMin()) / range));
35
+ }, ...ngDevMode ? [{ debugName: "fraction" }] : /* istanbul ignore next */ []);
36
+ this.rangeArc = computed(() => this.getArcPath(135, 405), ...ngDevMode ? [{ debugName: "rangeArc" }] : /* istanbul ignore next */ []);
37
+ this.valueArc = computed(() => this.getArcPath(135, 135 + 270 * this.fraction()), ...ngDevMode ? [{ debugName: "valueArc" }] : /* istanbul ignore next */ []);
38
+ }
39
+ writeValue(value) {
40
+ const numeric = value === null || value === void 0 || value === "" ? NaN : Number(value);
41
+ this.value.set(this.clamp(Number.isFinite(numeric) ? numeric : this.effectiveMin()));
42
+ }
43
+ registerOnChange(fn) {
44
+ this.onChange = fn;
45
+ }
46
+ registerOnTouched(fn) {
47
+ this.onTouched = fn;
48
+ }
49
+ onBlur() {
50
+ this.onTouched();
51
+ this.touch.emit();
52
+ }
53
+ setDisabledState(isDisabled) {
54
+ this.formDisabled.set(isDisabled);
55
+ }
56
+ onPointerDown(event) {
57
+ if (this.effectiveDisabled() || this.readonly()) return;
58
+ this.dragging = true;
59
+ this.knobSvg()?.nativeElement.setPointerCapture(event.pointerId);
60
+ this.applyEvent(event);
61
+ }
62
+ onPointerMove(event) {
63
+ if (!this.dragging) return;
64
+ this.applyEvent(event);
65
+ }
66
+ onPointerUp(event) {
67
+ if (!this.dragging) return;
68
+ this.dragging = false;
69
+ try {
70
+ this.knobSvg()?.nativeElement.releasePointerCapture(event.pointerId);
71
+ } catch {}
72
+ this.change.emit(this.value());
73
+ this.end.emit(this.value());
74
+ }
75
+ updateByKey(step) {
76
+ if (this.effectiveDisabled() || this.readonly()) return;
77
+ this.setValue(this.value() + step);
78
+ this.onTouched();
79
+ }
80
+ applyEvent(event) {
81
+ const svg = this.knobSvg()?.nativeElement;
82
+ if (!svg) return;
83
+ const rect = svg.getBoundingClientRect();
84
+ const cx = rect.left + rect.width / 2;
85
+ const cy = rect.top + rect.height / 2;
86
+ let t = (Math.atan2(event.clientY - cy, event.clientX - cx) * 180 / Math.PI + 360) % 360 - 135;
87
+ if (t < 0) t += 360;
88
+ let fraction;
89
+ if (t > 270) fraction = 360 - t < t - 270 ? 0 : 1;
90
+ else fraction = t / 270;
91
+ const raw = this.effectiveMin() + fraction * (this.effectiveMax() - this.effectiveMin());
92
+ this.setValue(raw);
93
+ this.onTouched();
94
+ }
95
+ setValue(raw) {
96
+ const rounded = Math.round(raw / this.step()) * this.step();
97
+ const clamped = this.clamp(rounded);
98
+ this.value.set(clamped);
99
+ this.onChange(clamped);
100
+ }
101
+ clamp(value) {
102
+ return Math.max(this.effectiveMin(), Math.min(this.effectiveMax(), value));
103
+ }
104
+ getArcPath(startDeg, endDeg) {
105
+ const cx = this.center();
106
+ const cy = this.center();
107
+ const r = this.r();
108
+ const start = this.anglePoint(cx, cy, r, startDeg);
109
+ const end = this.anglePoint(cx, cy, r, endDeg);
110
+ const largeArc = endDeg - startDeg > 180 ? "1" : "0";
111
+ return `M ${start.x.toFixed(2)} ${start.y.toFixed(2)} A ${r.toFixed(2)} ${r.toFixed(2)} 0 ${largeArc} 1 ${end.x.toFixed(2)} ${end.y.toFixed(2)}`;
112
+ }
113
+ anglePoint(cx, cy, r, angleDeg) {
114
+ const rad = Math.PI * angleDeg / 180;
115
+ return {
116
+ x: cx + r * Math.cos(rad),
117
+ y: cy + r * Math.sin(rad)
118
+ };
119
+ }
120
+ static {
121
+ this.ɵfac = i0.ɵɵngDeclareFactory({
122
+ minVersion: "12.0.0",
123
+ version: "22.3.2",
124
+ ngImport: i0,
125
+ type: KnobComponent,
126
+ deps: [],
127
+ target: i0.ɵɵFactoryTarget.Component
128
+ });
129
+ }
130
+ static {
131
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
132
+ minVersion: "17.0.0",
133
+ version: "22.3.2",
134
+ type: KnobComponent,
135
+ isStandalone: true,
136
+ selector: "shk-knob",
137
+ inputs: {
138
+ value: {
139
+ classPropertyName: "value",
140
+ publicName: "value",
141
+ isSignal: true,
142
+ isRequired: false,
143
+ transformFunction: null
144
+ },
145
+ min: {
146
+ classPropertyName: "min",
147
+ publicName: "min",
148
+ isSignal: true,
149
+ isRequired: false,
150
+ transformFunction: null
151
+ },
152
+ max: {
153
+ classPropertyName: "max",
154
+ publicName: "max",
155
+ isSignal: true,
156
+ isRequired: false,
157
+ transformFunction: null
158
+ },
159
+ step: {
160
+ classPropertyName: "step",
161
+ publicName: "step",
162
+ isSignal: true,
163
+ isRequired: false,
164
+ transformFunction: null
165
+ },
166
+ size: {
167
+ classPropertyName: "size",
168
+ publicName: "size",
169
+ isSignal: true,
170
+ isRequired: false,
171
+ transformFunction: null
172
+ },
173
+ strokeWidth: {
174
+ classPropertyName: "strokeWidth",
175
+ publicName: "strokeWidth",
176
+ isSignal: true,
177
+ isRequired: false,
178
+ transformFunction: null
179
+ },
180
+ valueColor: {
181
+ classPropertyName: "valueColor",
182
+ publicName: "valueColor",
183
+ isSignal: true,
184
+ isRequired: false,
185
+ transformFunction: null
186
+ },
187
+ rangeColor: {
188
+ classPropertyName: "rangeColor",
189
+ publicName: "rangeColor",
190
+ isSignal: true,
191
+ isRequired: false,
192
+ transformFunction: null
193
+ },
194
+ showValue: {
195
+ classPropertyName: "showValue",
196
+ publicName: "showValue",
197
+ isSignal: true,
198
+ isRequired: false,
199
+ transformFunction: null
200
+ },
201
+ disabled: {
202
+ classPropertyName: "disabled",
203
+ publicName: "disabled",
204
+ isSignal: true,
205
+ isRequired: false,
206
+ transformFunction: null
207
+ },
208
+ readonly: {
209
+ classPropertyName: "readonly",
210
+ publicName: "readonly",
211
+ isSignal: true,
212
+ isRequired: false,
213
+ transformFunction: null
214
+ },
215
+ ariaLabel: {
216
+ classPropertyName: "ariaLabel",
217
+ publicName: "ariaLabel",
218
+ isSignal: true,
219
+ isRequired: false,
220
+ transformFunction: null
221
+ }
222
+ },
223
+ outputs: {
224
+ value: "valueChange",
225
+ change: "change",
226
+ end: "end",
227
+ touch: "touch"
228
+ },
229
+ providers: [{
230
+ provide: NG_VALUE_ACCESSOR,
231
+ useExisting: forwardRef(() => KnobComponent),
232
+ multi: true
233
+ }],
234
+ viewQueries: [{
235
+ propertyName: "knobSvg",
236
+ first: true,
237
+ predicate: ["knobSvg"],
238
+ descendants: true,
239
+ isSignal: true
240
+ }],
241
+ ngImport: i0,
242
+ template: `
183
243
  <div
184
244
  class="shk-knob"
185
245
  [class.shk-knob-disabled]="effectiveDisabled()"
@@ -227,11 +287,24 @@ class KnobComponent {
227
287
  <div class="shk-knob-label">{{ value() }}</div>
228
288
  }
229
289
  </div>
230
- `, isInline: true, styles: [".shk-knob{position:relative;display:inline-block}.shk-knob-svg{display:block;touch-action:none}.shk-knob-svg-focusable{cursor:pointer;outline:none}.shk-knob-svg-focusable:focus-visible{border-radius:9999px;outline:2px solid var(--shk-primary-400);outline-offset:2px}.shk-knob-disabled{opacity:.55}.shk-knob-disabled .shk-knob-svg{cursor:not-allowed}.shk-knob-label{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);font-size:1.125rem;font-weight:600;color:var(--shk-surface-800);pointer-events:none;-webkit-user-select:none;user-select:none}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
231
- }
232
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.27", ngImport: i0, type: KnobComponent, decorators: [{
233
- type: Component,
234
- args: [{ selector: 'shk-knob', changeDetection: ChangeDetectionStrategy.OnPush, template: `
290
+ `,
291
+ isInline: true,
292
+ styles: [".shk-knob{position:relative;display:inline-block}.shk-knob-svg{display:block;touch-action:none}.shk-knob-svg-focusable{cursor:pointer;outline:none}.shk-knob-svg-focusable:focus-visible{border-radius:9999px;outline:2px solid var(--shk-primary-400);outline-offset:2px}.shk-knob-disabled{opacity:.55}.shk-knob-disabled .shk-knob-svg{cursor:not-allowed}.shk-knob-label{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);font-size:1.125rem;font-weight:600;color:var(--shk-surface-800);pointer-events:none;-webkit-user-select:none;user-select:none}\n"],
293
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
294
+ });
295
+ }
296
+ };
297
+ i0.ɵɵngDeclareClassMetadata({
298
+ minVersion: "12.0.0",
299
+ version: "22.3.2",
300
+ ngImport: i0,
301
+ type: KnobComponent,
302
+ decorators: [{
303
+ type: Component,
304
+ args: [{
305
+ selector: "shk-knob",
306
+ changeDetection: ChangeDetectionStrategy.OnPush,
307
+ template: `
235
308
  <div
236
309
  class="shk-knob"
237
310
  [class.shk-knob-disabled]="effectiveDisabled()"
@@ -279,18 +352,133 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.27", ngImpo
279
352
  <div class="shk-knob-label">{{ value() }}</div>
280
353
  }
281
354
  </div>
282
- `, providers: [
283
- {
284
- provide: NG_VALUE_ACCESSOR,
285
- useExisting: forwardRef(() => KnobComponent),
286
- multi: true,
287
- },
288
- ], styles: [".shk-knob{position:relative;display:inline-block}.shk-knob-svg{display:block;touch-action:none}.shk-knob-svg-focusable{cursor:pointer;outline:none}.shk-knob-svg-focusable:focus-visible{border-radius:9999px;outline:2px solid var(--shk-primary-400);outline-offset:2px}.shk-knob-disabled{opacity:.55}.shk-knob-disabled .shk-knob-svg{cursor:not-allowed}.shk-knob-label{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);font-size:1.125rem;font-weight:600;color:var(--shk-surface-800);pointer-events:none;-webkit-user-select:none;user-select:none}\n"] }]
289
- }], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], strokeWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "strokeWidth", required: false }] }], valueColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueColor", required: false }] }], rangeColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "rangeColor", required: false }] }], showValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "showValue", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], change: [{ type: i0.Output, args: ["change"] }], end: [{ type: i0.Output, args: ["end"] }], touch: [{ type: i0.Output, args: ["touch"] }], knobSvg: [{ type: i0.ViewChild, args: ['knobSvg', { isSignal: true }] }] } });
290
-
291
- /**
292
- * Generated bundle index. Do not edit.
293
- */
294
-
355
+ `,
356
+ providers: [{
357
+ provide: NG_VALUE_ACCESSOR,
358
+ useExisting: forwardRef(() => KnobComponent),
359
+ multi: true
360
+ }],
361
+ styles: [".shk-knob{position:relative;display:inline-block}.shk-knob-svg{display:block;touch-action:none}.shk-knob-svg-focusable{cursor:pointer;outline:none}.shk-knob-svg-focusable:focus-visible{border-radius:9999px;outline:2px solid var(--shk-primary-400);outline-offset:2px}.shk-knob-disabled{opacity:.55}.shk-knob-disabled .shk-knob-svg{cursor:not-allowed}.shk-knob-label{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);font-size:1.125rem;font-weight:600;color:var(--shk-surface-800);pointer-events:none;-webkit-user-select:none;user-select:none}\n"]
362
+ }]
363
+ }],
364
+ propDecorators: {
365
+ value: [{
366
+ type: i0.Input,
367
+ args: [{
368
+ isSignal: true,
369
+ alias: "value",
370
+ required: false
371
+ }]
372
+ }, {
373
+ type: i0.Output,
374
+ args: ["valueChange"]
375
+ }],
376
+ min: [{
377
+ type: i0.Input,
378
+ args: [{
379
+ isSignal: true,
380
+ alias: "min",
381
+ required: false
382
+ }]
383
+ }],
384
+ max: [{
385
+ type: i0.Input,
386
+ args: [{
387
+ isSignal: true,
388
+ alias: "max",
389
+ required: false
390
+ }]
391
+ }],
392
+ step: [{
393
+ type: i0.Input,
394
+ args: [{
395
+ isSignal: true,
396
+ alias: "step",
397
+ required: false
398
+ }]
399
+ }],
400
+ size: [{
401
+ type: i0.Input,
402
+ args: [{
403
+ isSignal: true,
404
+ alias: "size",
405
+ required: false
406
+ }]
407
+ }],
408
+ strokeWidth: [{
409
+ type: i0.Input,
410
+ args: [{
411
+ isSignal: true,
412
+ alias: "strokeWidth",
413
+ required: false
414
+ }]
415
+ }],
416
+ valueColor: [{
417
+ type: i0.Input,
418
+ args: [{
419
+ isSignal: true,
420
+ alias: "valueColor",
421
+ required: false
422
+ }]
423
+ }],
424
+ rangeColor: [{
425
+ type: i0.Input,
426
+ args: [{
427
+ isSignal: true,
428
+ alias: "rangeColor",
429
+ required: false
430
+ }]
431
+ }],
432
+ showValue: [{
433
+ type: i0.Input,
434
+ args: [{
435
+ isSignal: true,
436
+ alias: "showValue",
437
+ required: false
438
+ }]
439
+ }],
440
+ disabled: [{
441
+ type: i0.Input,
442
+ args: [{
443
+ isSignal: true,
444
+ alias: "disabled",
445
+ required: false
446
+ }]
447
+ }],
448
+ readonly: [{
449
+ type: i0.Input,
450
+ args: [{
451
+ isSignal: true,
452
+ alias: "readonly",
453
+ required: false
454
+ }]
455
+ }],
456
+ ariaLabel: [{
457
+ type: i0.Input,
458
+ args: [{
459
+ isSignal: true,
460
+ alias: "ariaLabel",
461
+ required: false
462
+ }]
463
+ }],
464
+ change: [{
465
+ type: i0.Output,
466
+ args: ["change"]
467
+ }],
468
+ end: [{
469
+ type: i0.Output,
470
+ args: ["end"]
471
+ }],
472
+ touch: [{
473
+ type: i0.Output,
474
+ args: ["touch"]
475
+ }],
476
+ knobSvg: [{
477
+ type: i0.ViewChild,
478
+ args: ["knobSvg", { isSignal: true }]
479
+ }]
480
+ }
481
+ });
295
482
  export { KnobComponent };
296
- //# sourceMappingURL=shirkasoft-ui-components-knob.mjs.map
483
+
484
+ //# sourceMappingURL=shirkasoft-ui-components-knob.mjs.map