@mintplayer/ng-bootstrap 21.0.0 → 21.1.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 (155) hide show
  1. package/fesm2022/mintplayer-ng-bootstrap-accordion.mjs +33 -46
  2. package/fesm2022/mintplayer-ng-bootstrap-accordion.mjs.map +1 -1
  3. package/fesm2022/mintplayer-ng-bootstrap-alert.mjs +12 -30
  4. package/fesm2022/mintplayer-ng-bootstrap-alert.mjs.map +1 -1
  5. package/fesm2022/mintplayer-ng-bootstrap-badge.mjs +6 -18
  6. package/fesm2022/mintplayer-ng-bootstrap-badge.mjs.map +1 -1
  7. package/fesm2022/mintplayer-ng-bootstrap-calendar.mjs +31 -65
  8. package/fesm2022/mintplayer-ng-bootstrap-calendar.mjs.map +1 -1
  9. package/fesm2022/mintplayer-ng-bootstrap-carousel.mjs +200 -132
  10. package/fesm2022/mintplayer-ng-bootstrap-carousel.mjs.map +1 -1
  11. package/fesm2022/mintplayer-ng-bootstrap-close.mjs +5 -7
  12. package/fesm2022/mintplayer-ng-bootstrap-close.mjs.map +1 -1
  13. package/fesm2022/mintplayer-ng-bootstrap-code-snippet.mjs +14 -17
  14. package/fesm2022/mintplayer-ng-bootstrap-code-snippet.mjs.map +1 -1
  15. package/fesm2022/mintplayer-ng-bootstrap-color-picker.mjs +231 -347
  16. package/fesm2022/mintplayer-ng-bootstrap-color-picker.mjs.map +1 -1
  17. package/fesm2022/mintplayer-ng-bootstrap-datatable.mjs +43 -39
  18. package/fesm2022/mintplayer-ng-bootstrap-datatable.mjs.map +1 -1
  19. package/fesm2022/mintplayer-ng-bootstrap-datepicker.mjs +7 -35
  20. package/fesm2022/mintplayer-ng-bootstrap-datepicker.mjs.map +1 -1
  21. package/fesm2022/mintplayer-ng-bootstrap-dock.mjs +1 -0
  22. package/fesm2022/mintplayer-ng-bootstrap-dock.mjs.map +1 -1
  23. package/fesm2022/mintplayer-ng-bootstrap-dropdown-menu.mjs +1 -1
  24. package/fesm2022/mintplayer-ng-bootstrap-dropdown-menu.mjs.map +1 -1
  25. package/fesm2022/mintplayer-ng-bootstrap-dropdown.mjs +46 -86
  26. package/fesm2022/mintplayer-ng-bootstrap-dropdown.mjs.map +1 -1
  27. package/fesm2022/mintplayer-ng-bootstrap-enhanced-paste.mjs +7 -7
  28. package/fesm2022/mintplayer-ng-bootstrap-enhanced-paste.mjs.map +1 -1
  29. package/fesm2022/mintplayer-ng-bootstrap-file-upload.mjs +7 -6
  30. package/fesm2022/mintplayer-ng-bootstrap-file-upload.mjs.map +1 -1
  31. package/fesm2022/mintplayer-ng-bootstrap-grid.mjs +32 -74
  32. package/fesm2022/mintplayer-ng-bootstrap-grid.mjs.map +1 -1
  33. package/fesm2022/mintplayer-ng-bootstrap-let.mjs +6 -7
  34. package/fesm2022/mintplayer-ng-bootstrap-let.mjs.map +1 -1
  35. package/fesm2022/mintplayer-ng-bootstrap-markdown.mjs +18 -18
  36. package/fesm2022/mintplayer-ng-bootstrap-markdown.mjs.map +1 -1
  37. package/fesm2022/mintplayer-ng-bootstrap-modal.mjs +20 -22
  38. package/fesm2022/mintplayer-ng-bootstrap-modal.mjs.map +1 -1
  39. package/fesm2022/mintplayer-ng-bootstrap-multiselect.mjs +16 -10
  40. package/fesm2022/mintplayer-ng-bootstrap-multiselect.mjs.map +1 -1
  41. package/fesm2022/mintplayer-ng-bootstrap-navbar-toggler.mjs +8 -28
  42. package/fesm2022/mintplayer-ng-bootstrap-navbar-toggler.mjs.map +1 -1
  43. package/fesm2022/mintplayer-ng-bootstrap-navbar.mjs +208 -265
  44. package/fesm2022/mintplayer-ng-bootstrap-navbar.mjs.map +1 -1
  45. package/fesm2022/mintplayer-ng-bootstrap-navigation-lock.mjs +8 -21
  46. package/fesm2022/mintplayer-ng-bootstrap-navigation-lock.mjs.map +1 -1
  47. package/fesm2022/mintplayer-ng-bootstrap-offcanvas.mjs +43 -38
  48. package/fesm2022/mintplayer-ng-bootstrap-offcanvas.mjs.map +1 -1
  49. package/fesm2022/mintplayer-ng-bootstrap-ordinal-number.mjs +6 -6
  50. package/fesm2022/mintplayer-ng-bootstrap-ordinal-number.mjs.map +1 -1
  51. package/fesm2022/mintplayer-ng-bootstrap-pagination.mjs +59 -120
  52. package/fesm2022/mintplayer-ng-bootstrap-pagination.mjs.map +1 -1
  53. package/fesm2022/mintplayer-ng-bootstrap-placeholder.mjs +11 -25
  54. package/fesm2022/mintplayer-ng-bootstrap-placeholder.mjs.map +1 -1
  55. package/fesm2022/mintplayer-ng-bootstrap-playlist-toggler.mjs +8 -28
  56. package/fesm2022/mintplayer-ng-bootstrap-playlist-toggler.mjs.map +1 -1
  57. package/fesm2022/mintplayer-ng-bootstrap-popover.mjs +67 -103
  58. package/fesm2022/mintplayer-ng-bootstrap-popover.mjs.map +1 -1
  59. package/fesm2022/mintplayer-ng-bootstrap-progress-bar.mjs +34 -63
  60. package/fesm2022/mintplayer-ng-bootstrap-progress-bar.mjs.map +1 -1
  61. package/fesm2022/mintplayer-ng-bootstrap-range.mjs +6 -6
  62. package/fesm2022/mintplayer-ng-bootstrap-range.mjs.map +1 -1
  63. package/fesm2022/mintplayer-ng-bootstrap-rating.mjs +19 -47
  64. package/fesm2022/mintplayer-ng-bootstrap-rating.mjs.map +1 -1
  65. package/fesm2022/mintplayer-ng-bootstrap-resizable.mjs +35 -41
  66. package/fesm2022/mintplayer-ng-bootstrap-resizable.mjs.map +1 -1
  67. package/fesm2022/mintplayer-ng-bootstrap-scheduler.mjs +205 -779
  68. package/fesm2022/mintplayer-ng-bootstrap-scheduler.mjs.map +1 -1
  69. package/fesm2022/mintplayer-ng-bootstrap-scrollspy.mjs +34 -39
  70. package/fesm2022/mintplayer-ng-bootstrap-scrollspy.mjs.map +1 -1
  71. package/fesm2022/mintplayer-ng-bootstrap-searchbox.mjs +74 -100
  72. package/fesm2022/mintplayer-ng-bootstrap-searchbox.mjs.map +1 -1
  73. package/fesm2022/mintplayer-ng-bootstrap-select.mjs +37 -79
  74. package/fesm2022/mintplayer-ng-bootstrap-select.mjs.map +1 -1
  75. package/fesm2022/mintplayer-ng-bootstrap-select2.mjs +78 -45
  76. package/fesm2022/mintplayer-ng-bootstrap-select2.mjs.map +1 -1
  77. package/fesm2022/mintplayer-ng-bootstrap-shell.mjs +16 -26
  78. package/fesm2022/mintplayer-ng-bootstrap-shell.mjs.map +1 -1
  79. package/fesm2022/mintplayer-ng-bootstrap-signature-pad.mjs +14 -40
  80. package/fesm2022/mintplayer-ng-bootstrap-signature-pad.mjs.map +1 -1
  81. package/fesm2022/mintplayer-ng-bootstrap-spinner.mjs +8 -32
  82. package/fesm2022/mintplayer-ng-bootstrap-spinner.mjs.map +1 -1
  83. package/fesm2022/mintplayer-ng-bootstrap-splitter.mjs +70 -76
  84. package/fesm2022/mintplayer-ng-bootstrap-splitter.mjs.map +1 -1
  85. package/fesm2022/mintplayer-ng-bootstrap-sticky-footer.mjs +11 -11
  86. package/fesm2022/mintplayer-ng-bootstrap-sticky-footer.mjs.map +1 -1
  87. package/fesm2022/mintplayer-ng-bootstrap-tab-control.mjs +53 -99
  88. package/fesm2022/mintplayer-ng-bootstrap-tab-control.mjs.map +1 -1
  89. package/fesm2022/mintplayer-ng-bootstrap-table.mjs +7 -38
  90. package/fesm2022/mintplayer-ng-bootstrap-table.mjs.map +1 -1
  91. package/fesm2022/mintplayer-ng-bootstrap-timepicker.mjs +23 -49
  92. package/fesm2022/mintplayer-ng-bootstrap-timepicker.mjs.map +1 -1
  93. package/fesm2022/mintplayer-ng-bootstrap-toast.mjs +33 -38
  94. package/fesm2022/mintplayer-ng-bootstrap-toast.mjs.map +1 -1
  95. package/fesm2022/mintplayer-ng-bootstrap-toggle-button.mjs +45 -98
  96. package/fesm2022/mintplayer-ng-bootstrap-toggle-button.mjs.map +1 -1
  97. package/fesm2022/mintplayer-ng-bootstrap-tooltip.mjs +12 -24
  98. package/fesm2022/mintplayer-ng-bootstrap-tooltip.mjs.map +1 -1
  99. package/fesm2022/mintplayer-ng-bootstrap-treeview.mjs +21 -43
  100. package/fesm2022/mintplayer-ng-bootstrap-treeview.mjs.map +1 -1
  101. package/fesm2022/mintplayer-ng-bootstrap-trust-html.mjs +6 -6
  102. package/fesm2022/mintplayer-ng-bootstrap-trust-html.mjs.map +1 -1
  103. package/fesm2022/mintplayer-ng-bootstrap-typeahead.mjs +29 -49
  104. package/fesm2022/mintplayer-ng-bootstrap-typeahead.mjs.map +1 -1
  105. package/package.json +5 -5
  106. package/types/mintplayer-ng-bootstrap-accordion.d.ts +11 -15
  107. package/types/mintplayer-ng-bootstrap-alert.d.ts +4 -9
  108. package/types/mintplayer-ng-bootstrap-badge.d.ts +5 -9
  109. package/types/mintplayer-ng-bootstrap-calendar.d.ts +14 -22
  110. package/types/mintplayer-ng-bootstrap-carousel.d.ts +41 -35
  111. package/types/mintplayer-ng-bootstrap-close.d.ts +1 -2
  112. package/types/mintplayer-ng-bootstrap-code-snippet.d.ts +4 -5
  113. package/types/mintplayer-ng-bootstrap-color-picker.d.ts +70 -97
  114. package/types/mintplayer-ng-bootstrap-datatable.d.ts +11 -11
  115. package/types/mintplayer-ng-bootstrap-datepicker.d.ts +6 -13
  116. package/types/mintplayer-ng-bootstrap-dropdown.d.ts +14 -20
  117. package/types/mintplayer-ng-bootstrap-enhanced-paste.d.ts +1 -3
  118. package/types/mintplayer-ng-bootstrap-file-upload.d.ts +1 -1
  119. package/types/mintplayer-ng-bootstrap-grid.d.ts +14 -26
  120. package/types/mintplayer-ng-bootstrap-let.d.ts +0 -2
  121. package/types/mintplayer-ng-bootstrap-markdown.d.ts +1 -5
  122. package/types/mintplayer-ng-bootstrap-modal.d.ts +3 -6
  123. package/types/mintplayer-ng-bootstrap-multiselect.d.ts +6 -6
  124. package/types/mintplayer-ng-bootstrap-navbar-toggler.d.ts +5 -11
  125. package/types/mintplayer-ng-bootstrap-navbar.d.ts +75 -80
  126. package/types/mintplayer-ng-bootstrap-navigation-lock.d.ts +2 -4
  127. package/types/mintplayer-ng-bootstrap-offcanvas.d.ts +12 -14
  128. package/types/mintplayer-ng-bootstrap-ordinal-number.d.ts +1 -2
  129. package/types/mintplayer-ng-bootstrap-pagination.d.ts +17 -31
  130. package/types/mintplayer-ng-bootstrap-placeholder.d.ts +3 -8
  131. package/types/mintplayer-ng-bootstrap-playlist-toggler.d.ts +5 -11
  132. package/types/mintplayer-ng-bootstrap-popover.d.ts +15 -23
  133. package/types/mintplayer-ng-bootstrap-progress-bar.d.ts +19 -22
  134. package/types/mintplayer-ng-bootstrap-range.d.ts +1 -2
  135. package/types/mintplayer-ng-bootstrap-rating.d.ts +8 -14
  136. package/types/mintplayer-ng-bootstrap-resizable.d.ts +7 -11
  137. package/types/mintplayer-ng-bootstrap-scheduler.d.ts +132 -220
  138. package/types/mintplayer-ng-bootstrap-scrollspy.d.ts +14 -15
  139. package/types/mintplayer-ng-bootstrap-searchbox.d.ts +20 -27
  140. package/types/mintplayer-ng-bootstrap-select.d.ts +13 -23
  141. package/types/mintplayer-ng-bootstrap-select2.d.ts +16 -14
  142. package/types/mintplayer-ng-bootstrap-shell.d.ts +6 -12
  143. package/types/mintplayer-ng-bootstrap-signature-pad.d.ts +7 -12
  144. package/types/mintplayer-ng-bootstrap-spinner.d.ts +8 -16
  145. package/types/mintplayer-ng-bootstrap-splitter.d.ts +21 -27
  146. package/types/mintplayer-ng-bootstrap-sticky-footer.d.ts +3 -3
  147. package/types/mintplayer-ng-bootstrap-tab-control.d.ts +29 -37
  148. package/types/mintplayer-ng-bootstrap-table.d.ts +6 -13
  149. package/types/mintplayer-ng-bootstrap-timepicker.d.ts +7 -14
  150. package/types/mintplayer-ng-bootstrap-toast.d.ts +5 -10
  151. package/types/mintplayer-ng-bootstrap-toggle-button.d.ts +22 -36
  152. package/types/mintplayer-ng-bootstrap-tooltip.d.ts +4 -7
  153. package/types/mintplayer-ng-bootstrap-treeview.d.ts +10 -15
  154. package/types/mintplayer-ng-bootstrap-trust-html.d.ts +0 -2
  155. package/types/mintplayer-ng-bootstrap-typeahead.d.ts +14 -17
@@ -1,52 +1,38 @@
1
1
  import * as i0 from '@angular/core';
2
- import { EventEmitter, HostListener, Input, Output, ViewChild, HostBinding, Component, Directive, forwardRef, Inject, NgModule } from '@angular/core';
3
- import * as i1 from '@angular/common';
2
+ import { inject, ElementRef, model, output, signal, computed, effect, HostListener, ViewChild, HostBinding, ChangeDetectionStrategy, Component, NgZone, Directive, input, forwardRef, NgModule } from '@angular/core';
4
3
  import { AsyncPipe } from '@angular/common';
5
4
  import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
6
- import { BehaviorSubject, combineLatest, map, debounceTime, switchMap, take } from 'rxjs';
7
- import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
8
5
 
9
6
  class BsColorWheelComponent {
10
- constructor(element, destroy) {
11
- // this.resizeObserver = new ResizeObserver((entries) => {
12
- // for (const entry of entries) {
13
- // if (entry.target === this.element.nativeElement) {
14
- // console.log(entry.contentRect);
15
- // this.width$.next(entry.contentRect.width);
16
- // this.height$.next(entry.contentRect.height);
17
- // break;
18
- // }
19
- // }
20
- // });
21
- this.element = element;
22
- this.destroy = destroy;
7
+ constructor() {
8
+ this.element = inject((ElementRef));
23
9
  this.positionRelative = true;
24
- //#region Hue/Luminosity
25
- this.hs$ = new BehaviorSubject({ hue: 0, saturation: 0 });
26
- this.hsChange = new EventEmitter();
27
- //#endregion
28
- //#region Luminosity
29
- this.luminosity$ = new BehaviorSubject(0);
30
- //#endregion
31
- // private resizeObserver: ResizeObserver;
32
- this.canvasContext = null;
10
+ // Inputs
11
+ this.width = model(150, ...(ngDevMode ? [{ debugName: "width" }] : []));
12
+ this.height = model(150, ...(ngDevMode ? [{ debugName: "height" }] : []));
13
+ this.diameterRatio = model(0, ...(ngDevMode ? [{ debugName: "diameterRatio" }] : []));
14
+ this.luminosity = model(0, ...(ngDevMode ? [{ debugName: "luminosity" }] : []));
15
+ // HS model with output
16
+ this.hs = model({ hue: 0, saturation: 0 }, ...(ngDevMode ? [{ debugName: "hs" }] : []));
17
+ this.hsChange = output();
18
+ // Internal state
19
+ this.disabled = signal(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
20
+ this.viewInited = signal(false, ...(ngDevMode ? [{ debugName: "viewInited" }] : []));
33
21
  this.isPointerDown = false;
34
- this.width$ = new BehaviorSubject(150);
35
- this.height$ = new BehaviorSubject(150);
36
- this.diameterRatio$ = new BehaviorSubject(0);
37
- this.disabled$ = new BehaviorSubject(false);
38
- this.viewInited$ = new BehaviorSubject(false);
39
- this.squareSize$ = combineLatest([this.width$, this.height$])
40
- .pipe(map(([width, height]) => {
41
- if ((width === null) || (height === null)) {
22
+ this.canvasContext = null;
23
+ // Computed values
24
+ this.squareSize = computed(() => {
25
+ const width = this.width();
26
+ const height = this.height();
27
+ if (width === null || height === null) {
42
28
  return null;
43
29
  }
44
- const squareSize = Math.min(width, height);
45
- return squareSize;
46
- }));
47
- this.shiftX$ = combineLatest([this.width$, this.height$])
48
- .pipe(map(([width, height]) => {
49
- if ((width === null) || (height === null)) {
30
+ return Math.min(width, height);
31
+ }, ...(ngDevMode ? [{ debugName: "squareSize" }] : []));
32
+ this.shiftX = computed(() => {
33
+ const width = this.width();
34
+ const height = this.height();
35
+ if (width === null || height === null) {
50
36
  return null;
51
37
  }
52
38
  else if (width < height) {
@@ -55,10 +41,11 @@ class BsColorWheelComponent {
55
41
  else {
56
42
  return (width - height) / 2;
57
43
  }
58
- }));
59
- this.shiftY$ = combineLatest([this.width$, this.height$])
60
- .pipe(map(([width, height]) => {
61
- if ((width === null) || (height === null)) {
44
+ }, ...(ngDevMode ? [{ debugName: "shiftX" }] : []));
45
+ this.shiftY = computed(() => {
46
+ const width = this.width();
47
+ const height = this.height();
48
+ if (width === null || height === null) {
62
49
  return null;
63
50
  }
64
51
  else if (width < height) {
@@ -67,88 +54,76 @@ class BsColorWheelComponent {
67
54
  else {
68
55
  return 0;
69
56
  }
70
- }));
71
- this.innerRadius$ = combineLatest([this.squareSize$, this.diameterRatio$])
72
- .pipe(map(([squareSize, diameterRatio]) => {
57
+ }, ...(ngDevMode ? [{ debugName: "shiftY" }] : []));
58
+ this.innerRadius = computed(() => {
59
+ const squareSize = this.squareSize();
60
+ const diameterRatio = this.diameterRatio();
73
61
  if (squareSize) {
74
62
  return squareSize / 2 * diameterRatio;
75
63
  }
76
64
  else {
77
65
  return 0;
78
66
  }
79
- }));
80
- this.outerRadius$ = combineLatest([this.squareSize$, this.diameterRatio$])
81
- .pipe(map(([squareSize, diameterRatio]) => {
67
+ }, ...(ngDevMode ? [{ debugName: "innerRadius" }] : []));
68
+ this.outerRadius = computed(() => {
69
+ const squareSize = this.squareSize();
82
70
  if (squareSize) {
83
71
  return squareSize / 2;
84
72
  }
85
73
  else {
86
74
  return 150;
87
75
  }
88
- }));
89
- combineLatest([this.innerRadius$, this.outerRadius$, this.shiftX$, this.shiftY$])
90
- .pipe(debounceTime(20), takeUntilDestroyed())
91
- .subscribe(([innerRadius, outerRadius, shiftX, shiftY]) => {
92
- if (this.canvasContext && (innerRadius !== null) && (outerRadius !== null) && (shiftX !== null) && (shiftY !== null)) {
93
- this.canvasContext.clearRect(0, 0, this.canvas.nativeElement.width, this.canvas.nativeElement.height);
94
- this.canvasContext.save();
95
- this.canvasContext.translate(shiftX + outerRadius, shiftY + outerRadius);
96
- for (let x = 0; x < 360; x++) {
97
- this.canvasContext.rotate(1 * Math.PI / 180);
98
- const gradient = this.canvasContext.createLinearGradient(innerRadius, 0, outerRadius, 0);
99
- gradient.addColorStop(0, `hsl(${x}, 0%, 50%)`);
100
- gradient.addColorStop(1, `hsl(${x}, 100%, 50%)`);
101
- this.canvasContext.fillStyle = gradient;
102
- this.canvasContext.fillRect(innerRadius, 0, outerRadius - innerRadius, outerRadius / 50);
103
- }
104
- this.canvasContext.restore();
105
- }
106
- });
107
- this.markerPosition$ = combineLatest([this.hs$, this.shiftX$, this.shiftY$])
108
- .pipe(switchMap(([hs, shiftX, shiftY]) => {
109
- return this.color2position(hs)
110
- .pipe(map((position) => ({ position, shiftX: (shiftX ?? 0), shiftY: (shiftY ?? 0) })));
111
- }))
112
- .pipe(map(({ position, shiftX, shiftY }) => {
76
+ }, ...(ngDevMode ? [{ debugName: "outerRadius" }] : []));
77
+ this.markerPosition = computed(() => {
78
+ const hs = this.hs();
79
+ const shiftX = this.shiftX() ?? 0;
80
+ const shiftY = this.shiftY() ?? 0;
81
+ const position = this.color2position(hs);
113
82
  return {
114
83
  x: position.x + shiftX,
115
84
  y: position.y + shiftY,
116
85
  };
117
- }));
118
- this.hs$.pipe(takeUntilDestroyed())
119
- .subscribe((hs) => this.hsChange.emit(hs));
120
- }
121
- set diameterRatio(value) {
122
- this.diameterRatio$.next(value);
123
- }
124
- set width(value) {
125
- this.width$.next(value);
126
- }
127
- set height(value) {
128
- this.height$.next(value);
129
- }
130
- get hs() {
131
- return this.hs$.value;
132
- }
133
- set hs(value) {
134
- this.hs$.next(value);
135
- }
136
- get luminosity() {
137
- return this.luminosity$.value;
138
- }
139
- set luminosity(value) {
140
- this.luminosity$.next(value);
86
+ }, ...(ngDevMode ? [{ debugName: "markerPosition" }] : []));
87
+ // Draw color wheel when dimensions change
88
+ effect(() => {
89
+ const innerRadius = this.innerRadius();
90
+ const outerRadius = this.outerRadius();
91
+ const shiftX = this.shiftX();
92
+ const shiftY = this.shiftY();
93
+ // Use setTimeout to debounce slightly
94
+ setTimeout(() => {
95
+ if (this.canvasContext && innerRadius !== null && outerRadius !== null && shiftX !== null && shiftY !== null) {
96
+ this.canvasContext.clearRect(0, 0, this.canvas.nativeElement.width, this.canvas.nativeElement.height);
97
+ this.canvasContext.save();
98
+ this.canvasContext.translate(shiftX + outerRadius, shiftY + outerRadius);
99
+ for (let x = 0; x < 360; x++) {
100
+ this.canvasContext.rotate(1 * Math.PI / 180);
101
+ const gradient = this.canvasContext.createLinearGradient(innerRadius, 0, outerRadius, 0);
102
+ gradient.addColorStop(0, `hsl(${x}, 0%, 50%)`);
103
+ gradient.addColorStop(1, `hsl(${x}, 100%, 50%)`);
104
+ this.canvasContext.fillStyle = gradient;
105
+ this.canvasContext.fillRect(innerRadius, 0, outerRadius - innerRadius, outerRadius / 50);
106
+ }
107
+ this.canvasContext.restore();
108
+ }
109
+ }, 20);
110
+ });
111
+ // Emit HS changes
112
+ effect(() => {
113
+ const hs = this.hs();
114
+ this.hsChange.emit(hs);
115
+ });
141
116
  }
142
117
  ngAfterViewInit() {
143
- // this.resizeObserver.observe(this.element.nativeElement);
144
- this.viewInited$.next(true);
118
+ this.viewInited.set(true);
145
119
  if (typeof window !== 'undefined') {
146
120
  this.canvasContext = this.canvas.nativeElement.getContext('2d', { willReadFrequently: true });
147
121
  }
148
122
  }
149
123
  onPointerDown(ev) {
150
- if (!this.disabled$.value) {
124
+ if (!this.disabled()) {
151
125
  ev.preventDefault();
126
+ ev.stopPropagation();
152
127
  this.isPointerDown = true;
153
128
  this.updateColor(ev, !('touches' in ev));
154
129
  }
@@ -181,65 +156,62 @@ class BsColorWheelComponent {
181
156
  y: ev.clientY - (subtract ? rect.top : 0),
182
157
  };
183
158
  }
184
- this.position2color(co.x, co.y).pipe(take(1), takeUntilDestroyed(this.destroy)).subscribe((color) => {
185
- if (color) {
186
- this.hs$.next({ hue: color.hue, saturation: color.saturation });
187
- }
188
- else {
189
- console.warn('Color is null');
190
- }
191
- });
159
+ const color = this.position2color(co.x, co.y);
160
+ if (color) {
161
+ this.hs.set({ hue: color.hue, saturation: color.saturation });
162
+ }
163
+ else {
164
+ console.warn('Color is null');
165
+ }
192
166
  }
193
167
  isInsideCircle(x, y) {
194
- return combineLatest([this.squareSize$, this.shiftX$, this.shiftY$])
195
- .pipe(map(([squareSize, shiftX, shiftY]) => {
196
- // Position to the square
197
- const sx = x - (shiftX ?? 0);
198
- const sy = y - (shiftY ?? 0);
199
- // Square radius
200
- const sr = (squareSize ?? 0) / 2;
201
- const radius = Math.sqrt(Math.pow(sx - sr, 2) + Math.pow(sy - sr, 2));
202
- const angle = (Math.atan2(sr - sy, sr - sx) + Math.PI) % 360;
203
- return {
204
- inside: radius <= sr,
205
- angle
206
- };
207
- }));
168
+ const squareSize = this.squareSize();
169
+ const shiftX = this.shiftX();
170
+ const shiftY = this.shiftY();
171
+ // Position to the square
172
+ const sx = x - (shiftX ?? 0);
173
+ const sy = y - (shiftY ?? 0);
174
+ // Square radius
175
+ const sr = (squareSize ?? 0) / 2;
176
+ const radius = Math.sqrt(Math.pow(sx - sr, 2) + Math.pow(sy - sr, 2));
177
+ const angle = (Math.atan2(sr - sy, sr - sx) + Math.PI) % 360;
178
+ return {
179
+ inside: radius <= sr,
180
+ angle
181
+ };
208
182
  }
209
183
  position2color(x, y) {
210
- return this.isInsideCircle(x, y).pipe(map((result) => {
211
- if (!this.canvasContext) {
212
- return null;
213
- }
214
- if (result.inside) {
215
- const imageData = this.canvasContext.getImageData(x, y, 1, 1).data;
216
- const hsl = this.rgb2Hsl({ r: imageData[0], g: imageData[1], b: imageData[2] });
217
- return hsl;
218
- }
219
- return { hue: result.angle * 180 / Math.PI, saturation: 1, luminosity: 0.5 };
220
- }));
184
+ if (!this.canvasContext) {
185
+ return null;
186
+ }
187
+ const result = this.isInsideCircle(x, y);
188
+ if (result.inside) {
189
+ const imageData = this.canvasContext.getImageData(x, y, 1, 1).data;
190
+ const hsl = this.rgb2Hsl({ r: imageData[0], g: imageData[1], b: imageData[2] });
191
+ return hsl;
192
+ }
193
+ return { hue: result.angle * 180 / Math.PI, saturation: 1, luminosity: 0.5 };
221
194
  }
222
195
  color2position(hs) {
223
- return combineLatest([this.innerRadius$, this.outerRadius$])
224
- .pipe(map(([innerRadius, outerRadius]) => {
225
- if (innerRadius === null) {
226
- innerRadius = 0;
227
- }
228
- if (!outerRadius) {
229
- outerRadius = 100;
230
- }
231
- const theta = hs.hue * Math.PI / 180;
232
- const c = {
233
- x: -outerRadius * Math.cos(theta),
234
- y: -outerRadius * Math.sin(theta)
235
- };
236
- const d = hs.saturation * (outerRadius - innerRadius) + innerRadius;
237
- const o = { x: outerRadius, y: outerRadius };
238
- return {
239
- x: o.x - d * (c.x / outerRadius),
240
- y: o.y - d * (c.y / outerRadius),
241
- };
242
- }));
196
+ let innerRadius = this.innerRadius();
197
+ let outerRadius = this.outerRadius();
198
+ if (innerRadius === null) {
199
+ innerRadius = 0;
200
+ }
201
+ if (!outerRadius) {
202
+ outerRadius = 100;
203
+ }
204
+ const theta = hs.hue * Math.PI / 180;
205
+ const c = {
206
+ x: -outerRadius * Math.cos(theta),
207
+ y: -outerRadius * Math.sin(theta)
208
+ };
209
+ const d = hs.saturation * (outerRadius - innerRadius) + innerRadius;
210
+ const o = { x: outerRadius, y: outerRadius };
211
+ return {
212
+ x: o.x - d * (c.x / outerRadius),
213
+ y: o.y - d * (c.y / outerRadius),
214
+ };
243
215
  }
244
216
  rgb2Hsl(color) {
245
217
  const r01 = this.bound01(color.r, 255);
@@ -293,31 +265,19 @@ class BsColorWheelComponent {
293
265
  return (n % max) / max;
294
266
  }
295
267
  }
296
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BsColorWheelComponent, deps: [{ token: i0.ElementRef }, { token: i0.DestroyRef }], target: i0.ɵɵFactoryTarget.Component }); }
297
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: BsColorWheelComponent, isStandalone: false, selector: "bs-color-wheel", inputs: { diameterRatio: "diameterRatio", width: "width", height: "height", hs: "hs", luminosity: "luminosity" }, outputs: { hsChange: "hsChange" }, host: { listeners: { "document:mousemove": "onMouseMove($event)", "document:mouseup": "onPointerUp($event)" }, properties: { "class.position-relative": "this.positionRelative" } }, viewQueries: [{ propertyName: "canvas", first: true, predicate: ["canvas"], descendants: true }], ngImport: i0, template: "<canvas\n class=\"d-block\"\n [width]=\"width$ | async\"\n [height]=\"height$ | async\"\n (mousedown)=\"onPointerDown($event)\"\n (touchstart)=\"onPointerDown($event)\"\n (touchmove)=\"onPointerMove($event)\"\n (touchend)=\"onPointerUp($event)\"\n #canvas></canvas>\n\n@if (markerPosition$ | async; as markerPosition) {\n <div class=\"thumb position-absolute pe-none\" [style.left.px]=\"markerPosition.x\" [style.top.px]=\"markerPosition.y\"></div>\n}", styles: [".thumb{width:30px;height:30px;border-radius:15px;margin-top:-15px;margin-left:-15px;box-sizing:border-box;border:2px solid white;box-shadow:#0000001a 0 0 10px 5px}\n"], dependencies: [{ kind: "pipe", type: i1.AsyncPipe, name: "async" }] }); }
268
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BsColorWheelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
269
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: BsColorWheelComponent, isStandalone: false, selector: "bs-color-wheel", inputs: { width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, diameterRatio: { classPropertyName: "diameterRatio", publicName: "diameterRatio", isSignal: true, isRequired: false, transformFunction: null }, luminosity: { classPropertyName: "luminosity", publicName: "luminosity", isSignal: true, isRequired: false, transformFunction: null }, hs: { classPropertyName: "hs", publicName: "hs", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { width: "widthChange", height: "heightChange", diameterRatio: "diameterRatioChange", luminosity: "luminosityChange", hs: "hsChange", hsChange: "hsChange" }, host: { listeners: { "document:mousemove": "onMouseMove($event)", "document:mouseup": "onPointerUp($event)" }, properties: { "class.position-relative": "this.positionRelative" } }, viewQueries: [{ propertyName: "canvas", first: true, predicate: ["canvas"], descendants: true }], ngImport: i0, template: "<canvas\n class=\"d-block\"\n [width]=\"width()\"\n [height]=\"height()\"\n (mousedown)=\"onPointerDown($event)\"\n (touchstart)=\"onPointerDown($event)\"\n (touchmove)=\"onPointerMove($event)\"\n (touchend)=\"onPointerUp($event)\"\n #canvas></canvas>\n\n@if (markerPosition(); as markerPosition) {\n <div class=\"thumb position-absolute pe-none\" [style.left.px]=\"markerPosition.x\" [style.top.px]=\"markerPosition.y\"></div>\n}\n", styles: [".thumb{width:30px;height:30px;border-radius:15px;margin-top:-15px;margin-left:-15px;box-sizing:border-box;border:2px solid white;box-shadow:#0000001a 0 0 10px 5px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
298
270
  }
299
271
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BsColorWheelComponent, decorators: [{
300
272
  type: Component,
301
- args: [{ selector: 'bs-color-wheel', standalone: false, template: "<canvas\n class=\"d-block\"\n [width]=\"width$ | async\"\n [height]=\"height$ | async\"\n (mousedown)=\"onPointerDown($event)\"\n (touchstart)=\"onPointerDown($event)\"\n (touchmove)=\"onPointerMove($event)\"\n (touchend)=\"onPointerUp($event)\"\n #canvas></canvas>\n\n@if (markerPosition$ | async; as markerPosition) {\n <div class=\"thumb position-absolute pe-none\" [style.left.px]=\"markerPosition.x\" [style.top.px]=\"markerPosition.y\"></div>\n}", styles: [".thumb{width:30px;height:30px;border-radius:15px;margin-top:-15px;margin-left:-15px;box-sizing:border-box;border:2px solid white;box-shadow:#0000001a 0 0 10px 5px}\n"] }]
302
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.DestroyRef }], propDecorators: { positionRelative: [{
273
+ args: [{ selector: 'bs-color-wheel', standalone: false, changeDetection: ChangeDetectionStrategy.OnPush, template: "<canvas\n class=\"d-block\"\n [width]=\"width()\"\n [height]=\"height()\"\n (mousedown)=\"onPointerDown($event)\"\n (touchstart)=\"onPointerDown($event)\"\n (touchmove)=\"onPointerMove($event)\"\n (touchend)=\"onPointerUp($event)\"\n #canvas></canvas>\n\n@if (markerPosition(); as markerPosition) {\n <div class=\"thumb position-absolute pe-none\" [style.left.px]=\"markerPosition.x\" [style.top.px]=\"markerPosition.y\"></div>\n}\n", styles: [".thumb{width:30px;height:30px;border-radius:15px;margin-top:-15px;margin-left:-15px;box-sizing:border-box;border:2px solid white;box-shadow:#0000001a 0 0 10px 5px}\n"] }]
274
+ }], ctorParameters: () => [], propDecorators: { positionRelative: [{
303
275
  type: HostBinding,
304
276
  args: ['class.position-relative']
305
- }], diameterRatio: [{
306
- type: Input
307
- }], width: [{
308
- type: Input
309
- }], height: [{
310
- type: Input
311
277
  }], canvas: [{
312
278
  type: ViewChild,
313
279
  args: ['canvas']
314
- }], hsChange: [{
315
- type: Output
316
- }], hs: [{
317
- type: Input
318
- }], luminosity: [{
319
- type: Input
320
- }], onMouseMove: [{
280
+ }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }, { type: i0.Output, args: ["widthChange"] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }, { type: i0.Output, args: ["heightChange"] }], diameterRatio: [{ type: i0.Input, args: [{ isSignal: true, alias: "diameterRatio", required: false }] }, { type: i0.Output, args: ["diameterRatioChange"] }], luminosity: [{ type: i0.Input, args: [{ isSignal: true, alias: "luminosity", required: false }] }, { type: i0.Output, args: ["luminosityChange"] }], hs: [{ type: i0.Input, args: [{ isSignal: true, alias: "hs", required: false }] }, { type: i0.Output, args: ["hsChange"] }], hsChange: [{ type: i0.Output, args: ["hsChange"] }], onMouseMove: [{
321
281
  type: HostListener,
322
282
  args: ['document:mousemove', ['$event']]
323
283
  }], onPointerUp: [{
@@ -326,46 +286,42 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
326
286
  }] } });
327
287
 
328
288
  class BsSliderComponent {
329
- constructor(element, zone) {
330
- this.element = element;
331
- this.zone = zone;
289
+ constructor() {
290
+ this.element = inject((ElementRef));
291
+ this.zone = inject(NgZone);
332
292
  this.dBlock = true;
333
293
  this.positionRelative = true;
334
- //#region Value
335
- this.value$ = new BehaviorSubject(0.5);
336
- this.valueChange = new EventEmitter();
337
- //#endregion
338
- this.isPointerDown$ = new BehaviorSubject(false);
339
- this.value$.pipe(takeUntilDestroyed())
340
- .subscribe((value) => this.valueChange.emit(value));
341
- this.thumbMarginLeft$ = this.value$.pipe(map((value) => {
342
- const res = value * element.nativeElement.clientWidth - 12;
294
+ this.value = model(0.5, ...(ngDevMode ? [{ debugName: "value" }] : []));
295
+ this.valueChange = output();
296
+ this.isPointerDown = signal(false, ...(ngDevMode ? [{ debugName: "isPointerDown" }] : []));
297
+ this.thumbMarginLeft = computed(() => {
298
+ const value = this.value();
299
+ const res = value * this.element.nativeElement.clientWidth - 12;
343
300
  return res;
344
- }));
345
- this.cursorClass$ = this.isPointerDown$.pipe(map((isPointerDown) => {
346
- return isPointerDown ? 'cursor-grabbing' : 'cursor-grab';
347
- }));
348
- }
349
- get value() {
350
- return this.value$.value;
351
- }
352
- set value(value) {
353
- this.value$.next(value);
301
+ }, ...(ngDevMode ? [{ debugName: "thumbMarginLeft" }] : []));
302
+ this.cursorClass = computed(() => {
303
+ return this.isPointerDown() ? 'cursor-grabbing' : 'cursor-grab';
304
+ }, ...(ngDevMode ? [{ debugName: "cursorClass" }] : []));
305
+ effect(() => {
306
+ const value = this.value();
307
+ this.valueChange.emit(value);
308
+ });
354
309
  }
355
310
  onPointerDown(ev) {
356
311
  ev.preventDefault();
357
- this.zone.run(() => this.isPointerDown$.next(true));
312
+ ev.stopPropagation();
313
+ this.zone.run(() => this.isPointerDown.set(true));
358
314
  this.updateColor(ev);
359
315
  }
360
316
  onPointerMove(ev) {
361
- if (this.isPointerDown$.value) {
317
+ if (this.isPointerDown()) {
362
318
  ev.preventDefault();
363
319
  ev.stopPropagation();
364
320
  this.updateColor(ev);
365
321
  }
366
322
  }
367
323
  onPointerUp(ev) {
368
- this.isPointerDown$.next(false);
324
+ this.isPointerDown.set(false);
369
325
  }
370
326
  updateColor(ev) {
371
327
  let co;
@@ -382,15 +338,15 @@ class BsSliderComponent {
382
338
  }
383
339
  const percent = co.x / this.track.nativeElement.clientWidth;
384
340
  const limited = Math.max(0, Math.min(1, percent));
385
- this.value$.next(limited);
341
+ this.value.set(limited);
386
342
  }
387
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BsSliderComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); }
388
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: BsSliderComponent, isStandalone: false, selector: "bs-slider", inputs: { value: "value" }, outputs: { valueChange: "valueChange" }, host: { listeners: { "document:mousemove": "onPointerMove($event)", "document:mouseup": "onPointerUp($event)" }, properties: { "class.d-block": "this.dBlock", "class.position-relative": "this.positionRelative" } }, viewQueries: [{ propertyName: "track", first: true, predicate: ["track"], descendants: true }, { propertyName: "thumb", first: true, predicate: ["thumb"], descendants: true }], ngImport: i0, template: "<div class=\"wrapper d-block position-relative\">\n <div #track class=\"track2\"\n (mousedown)=\"onPointerDown($event)\"\n (touchstart)=\"onPointerDown($event)\"\n (touchmove)=\"onPointerMove($event)\"\n (touchend)=\"onPointerUp($event)\">\n <ng-content select=\"[bsTrack]\"></ng-content>\n </div>\n <div #thumb\n (mousedown)=\"onPointerDown($event)\"\n (touchstart)=\"onPointerDown($event)\"\n (touchmove)=\"onPointerMove($event)\"\n (touchend)=\"onPointerUp($event)\"\n [class]=\"cursorClass$ | async\"\n [style.margin-left.px]=\"thumbMarginLeft$ | async\">\n <ng-content select=\"[bsThumb]\"></ng-content>\n </div>\n</div>", styles: [".track2{height:8px}.wrapper{padding-top:8px;padding-bottom:8px}::ng-deep .thumb{width:24px;height:24px;top:0;border-radius:50%;box-shadow:0 0 0 .1rem #646b7240}::ng-deep .track{height:8px;border-radius:8px}\n"], dependencies: [{ kind: "pipe", type: i1.AsyncPipe, name: "async" }] }); }
343
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BsSliderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
344
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: BsSliderComponent, isStandalone: false, selector: "bs-slider", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", valueChange: "valueChange" }, host: { listeners: { "document:mousemove": "onPointerMove($event)", "document:mouseup": "onPointerUp($event)" }, properties: { "class.d-block": "this.dBlock", "class.position-relative": "this.positionRelative" } }, viewQueries: [{ propertyName: "track", first: true, predicate: ["track"], descendants: true }, { propertyName: "thumb", first: true, predicate: ["thumb"], descendants: true }], ngImport: i0, template: "<div class=\"wrapper d-block position-relative\">\n <div #track class=\"track2\"\n (mousedown)=\"onPointerDown($event)\"\n (touchstart)=\"onPointerDown($event)\"\n (touchmove)=\"onPointerMove($event)\"\n (touchend)=\"onPointerUp($event)\">\n <ng-content select=\"[bsTrack]\"></ng-content>\n </div>\n <div #thumb\n (mousedown)=\"onPointerDown($event)\"\n (touchstart)=\"onPointerDown($event)\"\n (touchmove)=\"onPointerMove($event)\"\n (touchend)=\"onPointerUp($event)\"\n [class]=\"cursorClass()\"\n [style.margin-left.px]=\"thumbMarginLeft()\">\n <ng-content select=\"[bsThumb]\"></ng-content>\n </div>\n</div>\n", styles: [".track2{height:8px}.wrapper{padding-top:8px;padding-bottom:8px}::ng-deep .thumb{width:24px;height:24px;top:0;border-radius:50%;box-shadow:0 0 0 .1rem #646b7240}::ng-deep .track{height:8px;border-radius:8px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
389
345
  }
390
346
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BsSliderComponent, decorators: [{
391
347
  type: Component,
392
- args: [{ selector: 'bs-slider', standalone: false, template: "<div class=\"wrapper d-block position-relative\">\n <div #track class=\"track2\"\n (mousedown)=\"onPointerDown($event)\"\n (touchstart)=\"onPointerDown($event)\"\n (touchmove)=\"onPointerMove($event)\"\n (touchend)=\"onPointerUp($event)\">\n <ng-content select=\"[bsTrack]\"></ng-content>\n </div>\n <div #thumb\n (mousedown)=\"onPointerDown($event)\"\n (touchstart)=\"onPointerDown($event)\"\n (touchmove)=\"onPointerMove($event)\"\n (touchend)=\"onPointerUp($event)\"\n [class]=\"cursorClass$ | async\"\n [style.margin-left.px]=\"thumbMarginLeft$ | async\">\n <ng-content select=\"[bsThumb]\"></ng-content>\n </div>\n</div>", styles: [".track2{height:8px}.wrapper{padding-top:8px;padding-bottom:8px}::ng-deep .thumb{width:24px;height:24px;top:0;border-radius:50%;box-shadow:0 0 0 .1rem #646b7240}::ng-deep .track{height:8px;border-radius:8px}\n"] }]
393
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.NgZone }], propDecorators: { dBlock: [{
348
+ args: [{ selector: 'bs-slider', standalone: false, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"wrapper d-block position-relative\">\n <div #track class=\"track2\"\n (mousedown)=\"onPointerDown($event)\"\n (touchstart)=\"onPointerDown($event)\"\n (touchmove)=\"onPointerMove($event)\"\n (touchend)=\"onPointerUp($event)\">\n <ng-content select=\"[bsTrack]\"></ng-content>\n </div>\n <div #thumb\n (mousedown)=\"onPointerDown($event)\"\n (touchstart)=\"onPointerDown($event)\"\n (touchmove)=\"onPointerMove($event)\"\n (touchend)=\"onPointerUp($event)\"\n [class]=\"cursorClass()\"\n [style.margin-left.px]=\"thumbMarginLeft()\">\n <ng-content select=\"[bsThumb]\"></ng-content>\n </div>\n</div>\n", styles: [".track2{height:8px}.wrapper{padding-top:8px;padding-bottom:8px}::ng-deep .thumb{width:24px;height:24px;top:0;border-radius:50%;box-shadow:0 0 0 .1rem #646b7240}::ng-deep .track{height:8px;border-radius:8px}\n"] }]
349
+ }], ctorParameters: () => [], propDecorators: { dBlock: [{
394
350
  type: HostBinding,
395
351
  args: ['class.d-block']
396
352
  }], positionRelative: [{
@@ -402,11 +358,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
402
358
  }], thumb: [{
403
359
  type: ViewChild,
404
360
  args: ['thumb']
405
- }], valueChange: [{
406
- type: Output
407
- }], value: [{
408
- type: Input
409
- }], onPointerMove: [{
361
+ }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }], onPointerMove: [{
410
362
  type: HostListener,
411
363
  args: ['document:mousemove', ['$event']]
412
364
  }], onPointerUp: [{
@@ -453,23 +405,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
453
405
 
454
406
  class BsLuminosityStripComponent {
455
407
  constructor() {
456
- //#region HS
457
- this.hs$ = new BehaviorSubject({ hue: 0, saturation: 0 });
458
- //#endregion
459
- //#region Luminosity
460
- this.luminosity$ = new BehaviorSubject(0.5);
461
- this.luminosityChange = new EventEmitter();
462
- //#endregion
408
+ this.hs = model({ hue: 0, saturation: 0 }, ...(ngDevMode ? [{ debugName: "hs" }] : []));
409
+ this.luminosity = model(0.5, ...(ngDevMode ? [{ debugName: "luminosity" }] : []));
410
+ this.luminosityChange = output();
463
411
  this.canvasContext = null;
464
- this.hs$.pipe(takeUntilDestroyed()).subscribe((hs) => {
412
+ this.resultBackground = computed(() => {
413
+ const hs = this.hs();
414
+ const luminosity = this.luminosity();
415
+ return `hsl(${hs.hue}, ${hs.saturation * 100}%, ${luminosity * 100}%)`;
416
+ }, ...(ngDevMode ? [{ debugName: "resultBackground" }] : []));
417
+ // Draw gradient when HS changes
418
+ effect(() => {
419
+ const hs = this.hs();
465
420
  if (this.canvasContext) {
466
- const width = this.canvas.nativeElement.width, height = this.canvas.nativeElement.height;
421
+ const width = this.canvas.nativeElement.width;
422
+ const height = this.canvas.nativeElement.height;
467
423
  this.canvasContext.clearRect(0, 0, width, height);
468
424
  this.canvasContext.save();
469
- // HSL
470
- // - H: 0 - 359
471
- // - S: "0%" - "100%"
472
- // - L: "0%" - "50%" - "100%"
473
425
  const gradient = this.canvasContext.createLinearGradient(0, 0, width, 0);
474
426
  gradient.addColorStop(0, `hsl(${hs.hue}, ${hs.saturation * 100}%, 0%)`);
475
427
  gradient.addColorStop(0.5, `hsl(${hs.hue}, ${hs.saturation * 100}%, 50%)`);
@@ -478,24 +430,11 @@ class BsLuminosityStripComponent {
478
430
  this.canvasContext.fillRect(0, 0, width, height);
479
431
  }
480
432
  });
481
- this.resultBackground$ = combineLatest([this.hs$, this.luminosity$])
482
- .pipe(map(([hs, luminosity]) => {
483
- return `hsl(${hs.hue}, ${hs.saturation * 100}%, ${luminosity * 100}%)`;
484
- }));
485
- this.luminosity$.pipe(takeUntilDestroyed())
486
- .subscribe(luminosity => this.luminosityChange.emit(luminosity));
487
- }
488
- get hs() {
489
- return this.hs$.value;
490
- }
491
- set hs(value) {
492
- this.hs$.next(value);
493
- }
494
- get luminosity() {
495
- return this.luminosity$.value;
496
- }
497
- set luminosity(value) {
498
- this.luminosity$.next(value);
433
+ // Emit luminosity changes
434
+ effect(() => {
435
+ const luminosity = this.luminosity();
436
+ this.luminosityChange.emit(luminosity);
437
+ });
499
438
  }
500
439
  ngAfterViewInit() {
501
440
  if (typeof window !== 'undefined') {
@@ -503,39 +442,37 @@ class BsLuminosityStripComponent {
503
442
  }
504
443
  }
505
444
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BsLuminosityStripComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
506
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: BsLuminosityStripComponent, isStandalone: false, selector: "bs-luminosity-strip", inputs: { hs: "hs", luminosity: "luminosity" }, outputs: { luminosityChange: "luminosityChange" }, viewQueries: [{ propertyName: "canvas", first: true, predicate: ["canvas"], descendants: true }], ngImport: i0, template: "<bs-slider [value]=\"(luminosity$ | async)!\" (valueChange)=\"luminosityChange.emit($event)\">\n <canvas bsTrack class=\"position-absolute w-100\" #canvas></canvas>\n <div bsThumb [style.background]=\"resultBackground$ | async\"></div>\n</bs-slider>", styles: [""], dependencies: [{ kind: "component", type: BsSliderComponent, selector: "bs-slider", inputs: ["value"], outputs: ["valueChange"] }, { kind: "directive", type: BsThumbDirective, selector: "[bsThumb]" }, { kind: "directive", type: BsTrackDirective, selector: "[bsTrack]" }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }] }); }
445
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: BsLuminosityStripComponent, isStandalone: false, selector: "bs-luminosity-strip", inputs: { hs: { classPropertyName: "hs", publicName: "hs", isSignal: true, isRequired: false, transformFunction: null }, luminosity: { classPropertyName: "luminosity", publicName: "luminosity", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { hs: "hsChange", luminosity: "luminosityChange", luminosityChange: "luminosityChange" }, viewQueries: [{ propertyName: "canvas", first: true, predicate: ["canvas"], descendants: true }], ngImport: i0, template: "<bs-slider [value]=\"luminosity()\" (valueChange)=\"luminosityChange.emit($event)\">\n <canvas bsTrack class=\"position-absolute w-100\" #canvas></canvas>\n <div bsThumb [style.background]=\"resultBackground()\"></div>\n</bs-slider>\n", styles: [""], dependencies: [{ kind: "component", type: BsSliderComponent, selector: "bs-slider", inputs: ["value"], outputs: ["valueChange"] }, { kind: "directive", type: BsThumbDirective, selector: "[bsThumb]" }, { kind: "directive", type: BsTrackDirective, selector: "[bsTrack]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
507
446
  }
508
447
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BsLuminosityStripComponent, decorators: [{
509
448
  type: Component,
510
- args: [{ selector: 'bs-luminosity-strip', standalone: false, template: "<bs-slider [value]=\"(luminosity$ | async)!\" (valueChange)=\"luminosityChange.emit($event)\">\n <canvas bsTrack class=\"position-absolute w-100\" #canvas></canvas>\n <div bsThumb [style.background]=\"resultBackground$ | async\"></div>\n</bs-slider>" }]
511
- }], ctorParameters: () => [], propDecorators: { hs: [{
512
- type: Input
513
- }], luminosityChange: [{
514
- type: Output
515
- }], luminosity: [{
516
- type: Input
517
- }], canvas: [{
449
+ args: [{ selector: 'bs-luminosity-strip', standalone: false, changeDetection: ChangeDetectionStrategy.OnPush, template: "<bs-slider [value]=\"luminosity()\" (valueChange)=\"luminosityChange.emit($event)\">\n <canvas bsTrack class=\"position-absolute w-100\" #canvas></canvas>\n <div bsThumb [style.background]=\"resultBackground()\"></div>\n</bs-slider>\n" }]
450
+ }], ctorParameters: () => [], propDecorators: { canvas: [{
518
451
  type: ViewChild,
519
452
  args: ['canvas']
520
- }] } });
453
+ }], hs: [{ type: i0.Input, args: [{ isSignal: true, alias: "hs", required: false }] }, { type: i0.Output, args: ["hsChange"] }], luminosity: [{ type: i0.Input, args: [{ isSignal: true, alias: "luminosity", required: false }] }, { type: i0.Output, args: ["luminosityChange"] }], luminosityChange: [{ type: i0.Output, args: ["luminosityChange"] }] } });
521
454
 
522
455
  class BsAlphaStripComponent {
523
456
  constructor() {
524
- //#region HS
525
- this.hs$ = new BehaviorSubject({ hue: 0, saturation: 0 });
526
- //#endregion
527
- //#region Luminosity
528
- this.luminosity$ = new BehaviorSubject(0.5);
529
- //#endregion
530
- //#region Alpha
531
- this.alpha$ = new BehaviorSubject(1);
532
- this.alphaChange = new EventEmitter();
533
- //#endregion
457
+ this.hs = model({ hue: 0, saturation: 0 }, ...(ngDevMode ? [{ debugName: "hs" }] : []));
458
+ this.luminosity = model(0.5, ...(ngDevMode ? [{ debugName: "luminosity" }] : []));
459
+ this.alpha = model(1, ...(ngDevMode ? [{ debugName: "alpha" }] : []));
460
+ this.alphaChange = output();
534
461
  this.canvasContext = null;
535
- combineLatest([this.hs$, this.luminosity$]).pipe(takeUntilDestroyed()).subscribe(([hs, luminosity]) => {
462
+ this.resultBackground = computed(() => {
463
+ const hs = this.hs();
464
+ const luminosity = this.luminosity();
465
+ const alpha = this.alpha();
466
+ return `hsla(${hs.hue}, ${hs.saturation * 100}%, ${luminosity * 100}%, ${alpha})`;
467
+ }, ...(ngDevMode ? [{ debugName: "resultBackground" }] : []));
468
+ // Draw gradient when HS or luminosity changes
469
+ effect(() => {
470
+ const hs = this.hs();
471
+ const luminosity = this.luminosity();
536
472
  setTimeout(() => {
537
473
  if (this.canvasContext) {
538
- const width = this.canvas.nativeElement.width, height = this.canvas.nativeElement.height;
474
+ const width = this.canvas.nativeElement.width;
475
+ const height = this.canvas.nativeElement.height;
539
476
  this.canvasContext.clearRect(0, 0, width, height);
540
477
  this.canvasContext.save();
541
478
  const gradient = this.canvasContext.createLinearGradient(0, 0, width, 0);
@@ -546,30 +483,11 @@ class BsAlphaStripComponent {
546
483
  }
547
484
  });
548
485
  });
549
- this.resultBackground$ = combineLatest([this.hs$, this.luminosity$, this.alpha$])
550
- .pipe(map(([hs, luminosity, alpha]) => {
551
- return `hsla(${hs.hue}, ${hs.saturation * 100}%, ${luminosity * 100}%, ${alpha})`;
552
- }));
553
- this.alpha$.pipe(takeUntilDestroyed())
554
- .subscribe((alpha) => this.alphaChange.emit(alpha));
555
- }
556
- get hs() {
557
- return this.hs$.value;
558
- }
559
- set hs(value) {
560
- this.hs$.next(value);
561
- }
562
- get luminosity() {
563
- return this.luminosity$.value;
564
- }
565
- set luminosity(value) {
566
- this.luminosity$.next(value);
567
- }
568
- get alpha() {
569
- return this.alpha$.value;
570
- }
571
- set alpha(value) {
572
- this.alpha$.next(value);
486
+ // Emit alpha changes
487
+ effect(() => {
488
+ const alpha = this.alpha();
489
+ this.alphaChange.emit(alpha);
490
+ });
573
491
  }
574
492
  ngAfterViewInit() {
575
493
  if (typeof window !== 'undefined') {
@@ -577,77 +495,48 @@ class BsAlphaStripComponent {
577
495
  }
578
496
  }
579
497
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BsAlphaStripComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
580
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: BsAlphaStripComponent, isStandalone: false, selector: "bs-alpha-strip", inputs: { hs: "hs", luminosity: "luminosity", alpha: "alpha" }, outputs: { alphaChange: "alphaChange" }, viewQueries: [{ propertyName: "canvas", first: true, predicate: ["track"], descendants: true }], ngImport: i0, template: "<bs-slider [value]=\"(alpha$ | async)!\" (valueChange)=\"alphaChange.emit($event)\">\n <canvas bsTrack class=\" track position-absolute w-100\" #track></canvas>\n\n <!-- [style.background]=\"resultBackground$ | async\" -->\n <div bsThumb [style.background]=\"resultBackground$ | async\"></div>\n</bs-slider>", styles: [".track{background-image:linear-gradient(45deg,#C0C0C0 25%,transparent 25%),linear-gradient(-45deg,#C0C0C0 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#C0C0C0 75%),linear-gradient(-45deg,transparent 75%,#C0C0C0 75%);background-size:10px 10px;background-position:0 0,0 5px,5px -5px,-5px 0px}\n"], dependencies: [{ kind: "component", type: BsSliderComponent, selector: "bs-slider", inputs: ["value"], outputs: ["valueChange"] }, { kind: "directive", type: BsThumbDirective, selector: "[bsThumb]" }, { kind: "directive", type: BsTrackDirective, selector: "[bsTrack]" }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }] }); }
498
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: BsAlphaStripComponent, isStandalone: false, selector: "bs-alpha-strip", inputs: { hs: { classPropertyName: "hs", publicName: "hs", isSignal: true, isRequired: false, transformFunction: null }, luminosity: { classPropertyName: "luminosity", publicName: "luminosity", isSignal: true, isRequired: false, transformFunction: null }, alpha: { classPropertyName: "alpha", publicName: "alpha", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { hs: "hsChange", luminosity: "luminosityChange", alpha: "alphaChange", alphaChange: "alphaChange" }, viewQueries: [{ propertyName: "canvas", first: true, predicate: ["track"], descendants: true }], ngImport: i0, template: "<bs-slider [value]=\"alpha()\" (valueChange)=\"alphaChange.emit($event)\">\n <canvas bsTrack class=\" track position-absolute w-100\" #track></canvas>\n\n <!-- [style.background]=\"resultBackground()\" -->\n <div bsThumb [style.background]=\"resultBackground()\"></div>\n</bs-slider>\n", styles: [".track{background-image:linear-gradient(45deg,#C0C0C0 25%,transparent 25%),linear-gradient(-45deg,#C0C0C0 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#C0C0C0 75%),linear-gradient(-45deg,transparent 75%,#C0C0C0 75%);background-size:10px 10px;background-position:0 0,0 5px,5px -5px,-5px 0px}\n"], dependencies: [{ kind: "component", type: BsSliderComponent, selector: "bs-slider", inputs: ["value"], outputs: ["valueChange"] }, { kind: "directive", type: BsThumbDirective, selector: "[bsThumb]" }, { kind: "directive", type: BsTrackDirective, selector: "[bsTrack]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
581
499
  }
582
500
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BsAlphaStripComponent, decorators: [{
583
501
  type: Component,
584
- args: [{ selector: 'bs-alpha-strip', standalone: false, template: "<bs-slider [value]=\"(alpha$ | async)!\" (valueChange)=\"alphaChange.emit($event)\">\n <canvas bsTrack class=\" track position-absolute w-100\" #track></canvas>\n\n <!-- [style.background]=\"resultBackground$ | async\" -->\n <div bsThumb [style.background]=\"resultBackground$ | async\"></div>\n</bs-slider>", styles: [".track{background-image:linear-gradient(45deg,#C0C0C0 25%,transparent 25%),linear-gradient(-45deg,#C0C0C0 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#C0C0C0 75%),linear-gradient(-45deg,transparent 75%,#C0C0C0 75%);background-size:10px 10px;background-position:0 0,0 5px,5px -5px,-5px 0px}\n"] }]
585
- }], ctorParameters: () => [], propDecorators: { hs: [{
586
- type: Input
587
- }], luminosity: [{
588
- type: Input
589
- }], alphaChange: [{
590
- type: Output
591
- }], alpha: [{
592
- type: Input
593
- }], canvas: [{
502
+ args: [{ selector: 'bs-alpha-strip', standalone: false, changeDetection: ChangeDetectionStrategy.OnPush, template: "<bs-slider [value]=\"alpha()\" (valueChange)=\"alphaChange.emit($event)\">\n <canvas bsTrack class=\" track position-absolute w-100\" #track></canvas>\n\n <!-- [style.background]=\"resultBackground()\" -->\n <div bsThumb [style.background]=\"resultBackground()\"></div>\n</bs-slider>\n", styles: [".track{background-image:linear-gradient(45deg,#C0C0C0 25%,transparent 25%),linear-gradient(-45deg,#C0C0C0 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#C0C0C0 75%),linear-gradient(-45deg,transparent 75%,#C0C0C0 75%);background-size:10px 10px;background-position:0 0,0 5px,5px -5px,-5px 0px}\n"] }]
503
+ }], ctorParameters: () => [], propDecorators: { canvas: [{
594
504
  type: ViewChild,
595
505
  args: ['track']
596
- }] } });
506
+ }], hs: [{ type: i0.Input, args: [{ isSignal: true, alias: "hs", required: false }] }, { type: i0.Output, args: ["hsChange"] }], luminosity: [{ type: i0.Input, args: [{ isSignal: true, alias: "luminosity", required: false }] }, { type: i0.Output, args: ["luminosityChange"] }], alpha: [{ type: i0.Input, args: [{ isSignal: true, alias: "alpha", required: false }] }, { type: i0.Output, args: ["alphaChange"] }], alphaChange: [{ type: i0.Output, args: ["alphaChange"] }] } });
597
507
 
598
508
  class BsColorPickerComponent {
599
509
  constructor() {
600
- this.size$ = new BehaviorSubject(150);
601
- this.disabled$ = new BehaviorSubject(false);
602
- this.allowAlpha$ = new BehaviorSubject(true);
603
- this.hs$ = new BehaviorSubject({ hue: 0, saturation: 0 });
604
- this.luminosity$ = new BehaviorSubject(0);
605
- //#region Alpha
606
- this.alpha$ = new BehaviorSubject(1);
607
- this.alphaChange = new EventEmitter();
608
- this.alpha$.pipe(takeUntilDestroyed())
609
- .subscribe((alpha) => this.alphaChange.emit(alpha));
610
- }
611
- set size(value) {
612
- this.size$.next(value);
613
- }
614
- set allowAlpha(value) {
615
- this.allowAlpha$.next(value);
616
- }
617
- get alpha() {
618
- return this.alpha$.value;
619
- }
620
- set alpha(value) {
621
- this.alpha$.next(value);
510
+ this.size = input(150, ...(ngDevMode ? [{ debugName: "size" }] : []));
511
+ this.disabled = signal(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
512
+ this.allowAlpha = input(true, ...(ngDevMode ? [{ debugName: "allowAlpha" }] : []));
513
+ this.hs = signal({ hue: 0, saturation: 0 }, ...(ngDevMode ? [{ debugName: "hs" }] : []));
514
+ this.luminosity = signal(0, ...(ngDevMode ? [{ debugName: "luminosity" }] : []));
515
+ this.alpha = model(1, ...(ngDevMode ? [{ debugName: "alpha" }] : []));
516
+ this.alphaChange = output();
517
+ effect(() => {
518
+ const alpha = this.alpha();
519
+ this.alphaChange.emit(alpha);
520
+ });
622
521
  }
623
522
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BsColorPickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
624
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: BsColorPickerComponent, isStandalone: false, selector: "bs-color-picker", inputs: { size: "size", allowAlpha: "allowAlpha", alpha: "alpha" }, outputs: { alphaChange: "alphaChange" }, viewQueries: [{ propertyName: "colorWheel", first: true, predicate: ["wheel"], descendants: true }], ngImport: i0, template: "@let letDisabled = (disabled$ | async)!;\n@let letHS = (hs$ | async)!;\n@let letLuminosity = (luminosity$ | async)!;\n@let letAlpha = (alpha$ | async)!;\n\n<bs-color-wheel [hs]=\"letHS\" (hsChange)=\"hs$.next($event)\" [luminosity]=\"letLuminosity\" [width]=\"(size$ | async) ?? 150\" [height]=\"(size$ | async) ?? 150\" #wheel></bs-color-wheel>\n<bs-luminosity-strip [hs]=\"letHS\" [luminosity]=\"letLuminosity\" (luminosityChange)=\"luminosity$.next($event)\" class=\"d-block mt-2\" [style.width.px]=\"size$ | async\" #strip></bs-luminosity-strip>\n@if (allowAlpha$ | async) {\n <bs-alpha-strip [hs]=\"letHS\" [luminosity]=\"letLuminosity\" [alpha]=\"letAlpha\" (alphaChange)=\"alpha$.next($event)\" class=\"d-block mt-2\" [style.width.px]=\"size$ | async\" #alpha></bs-alpha-strip>\n}", styles: [""], dependencies: [{ kind: "component", type: BsColorWheelComponent, selector: "bs-color-wheel", inputs: ["diameterRatio", "width", "height", "hs", "luminosity"], outputs: ["hsChange"] }, { kind: "component", type: BsLuminosityStripComponent, selector: "bs-luminosity-strip", inputs: ["hs", "luminosity"], outputs: ["luminosityChange"] }, { kind: "component", type: BsAlphaStripComponent, selector: "bs-alpha-strip", inputs: ["hs", "luminosity", "alpha"], outputs: ["alphaChange"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }] }); }
523
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: BsColorPickerComponent, isStandalone: false, selector: "bs-color-picker", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, allowAlpha: { classPropertyName: "allowAlpha", publicName: "allowAlpha", isSignal: true, isRequired: false, transformFunction: null }, alpha: { classPropertyName: "alpha", publicName: "alpha", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { alpha: "alphaChange", alphaChange: "alphaChange" }, viewQueries: [{ propertyName: "colorWheel", first: true, predicate: ["wheel"], descendants: true }], ngImport: i0, template: "@let letDisabled = disabled();\n@let letHS = hs();\n@let letLuminosity = luminosity();\n@let letAlpha = alpha();\n\n<bs-color-wheel [hs]=\"letHS\" (hsChange)=\"hs.set($event)\" [luminosity]=\"letLuminosity\" [width]=\"size()\" [height]=\"size()\" #wheel></bs-color-wheel>\n<bs-luminosity-strip [hs]=\"letHS\" [luminosity]=\"letLuminosity\" (luminosityChange)=\"luminosity.set($event)\" class=\"d-block mt-2\" [style.width.px]=\"size()\" #strip></bs-luminosity-strip>\n@if (allowAlpha()) {\n <bs-alpha-strip [hs]=\"letHS\" [luminosity]=\"letLuminosity\" [alpha]=\"letAlpha\" (alphaChange)=\"alpha.set($event)\" class=\"d-block mt-2\" [style.width.px]=\"size()\" #alphaStrip></bs-alpha-strip>\n}\n", styles: [""], dependencies: [{ kind: "component", type: BsColorWheelComponent, selector: "bs-color-wheel", inputs: ["width", "height", "diameterRatio", "luminosity", "hs"], outputs: ["widthChange", "heightChange", "diameterRatioChange", "luminosityChange", "hsChange"] }, { kind: "component", type: BsLuminosityStripComponent, selector: "bs-luminosity-strip", inputs: ["hs", "luminosity"], outputs: ["hsChange", "luminosityChange"] }, { kind: "component", type: BsAlphaStripComponent, selector: "bs-alpha-strip", inputs: ["hs", "luminosity", "alpha"], outputs: ["hsChange", "luminosityChange", "alphaChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
625
524
  }
626
525
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BsColorPickerComponent, decorators: [{
627
526
  type: Component,
628
- args: [{ selector: 'bs-color-picker', standalone: false, template: "@let letDisabled = (disabled$ | async)!;\n@let letHS = (hs$ | async)!;\n@let letLuminosity = (luminosity$ | async)!;\n@let letAlpha = (alpha$ | async)!;\n\n<bs-color-wheel [hs]=\"letHS\" (hsChange)=\"hs$.next($event)\" [luminosity]=\"letLuminosity\" [width]=\"(size$ | async) ?? 150\" [height]=\"(size$ | async) ?? 150\" #wheel></bs-color-wheel>\n<bs-luminosity-strip [hs]=\"letHS\" [luminosity]=\"letLuminosity\" (luminosityChange)=\"luminosity$.next($event)\" class=\"d-block mt-2\" [style.width.px]=\"size$ | async\" #strip></bs-luminosity-strip>\n@if (allowAlpha$ | async) {\n <bs-alpha-strip [hs]=\"letHS\" [luminosity]=\"letLuminosity\" [alpha]=\"letAlpha\" (alphaChange)=\"alpha$.next($event)\" class=\"d-block mt-2\" [style.width.px]=\"size$ | async\" #alpha></bs-alpha-strip>\n}" }]
527
+ args: [{ selector: 'bs-color-picker', standalone: false, changeDetection: ChangeDetectionStrategy.OnPush, template: "@let letDisabled = disabled();\n@let letHS = hs();\n@let letLuminosity = luminosity();\n@let letAlpha = alpha();\n\n<bs-color-wheel [hs]=\"letHS\" (hsChange)=\"hs.set($event)\" [luminosity]=\"letLuminosity\" [width]=\"size()\" [height]=\"size()\" #wheel></bs-color-wheel>\n<bs-luminosity-strip [hs]=\"letHS\" [luminosity]=\"letLuminosity\" (luminosityChange)=\"luminosity.set($event)\" class=\"d-block mt-2\" [style.width.px]=\"size()\" #strip></bs-luminosity-strip>\n@if (allowAlpha()) {\n <bs-alpha-strip [hs]=\"letHS\" [luminosity]=\"letLuminosity\" [alpha]=\"letAlpha\" (alphaChange)=\"alpha.set($event)\" class=\"d-block mt-2\" [style.width.px]=\"size()\" #alphaStrip></bs-alpha-strip>\n}\n" }]
629
528
  }], ctorParameters: () => [], propDecorators: { colorWheel: [{
630
529
  type: ViewChild,
631
530
  args: ['wheel']
632
- }], size: [{
633
- type: Input
634
- }], allowAlpha: [{
635
- type: Input
636
- }], alphaChange: [{
637
- type: Output
638
- }], alpha: [{
639
- type: Input
640
- }] } });
531
+ }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], allowAlpha: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowAlpha", required: false }] }], alpha: [{ type: i0.Input, args: [{ isSignal: true, alias: "alpha", required: false }] }, { type: i0.Output, args: ["alphaChange"] }], alphaChange: [{ type: i0.Output, args: ["alphaChange"] }] } });
641
532
 
642
533
  class BsColorPickerValueAccessor {
643
- constructor(host, destroy) {
644
- this.host = host;
645
- this.destroy = destroy;
646
- }
647
- ngAfterViewInit() {
648
- combineLatest([this.host.hs$, this.host.luminosity$])
649
- .pipe(takeUntilDestroyed(this.destroy))
650
- .subscribe(([hs, luminosity]) => {
534
+ constructor() {
535
+ this.host = inject(BsColorPickerComponent);
536
+ // Effect to emit value changes
537
+ effect(() => {
538
+ const hs = this.host.hs();
539
+ const luminosity = this.host.luminosity();
651
540
  const rgb = this.hsl2rgb(hs.hue, hs.saturation, luminosity);
652
541
  const hex = this.rgb2hex(rgb);
653
542
  setTimeout(() => this.onValueChange && this.onValueChange(hex), 10);
@@ -672,14 +561,14 @@ class BsColorPickerValueAccessor {
672
561
  if (value) {
673
562
  const rgb = this.hex2rgb(value);
674
563
  const hsl = this.rgb2Hsl(rgb);
675
- this.host.hs$.next({ hue: hsl.h, saturation: hsl.s });
676
- this.host.luminosity$.next(hsl.l);
564
+ this.host.hs.set({ hue: hsl.h, saturation: hsl.s });
565
+ this.host.luminosity.set(hsl.l);
677
566
  }
678
567
  }
679
568
  }
680
569
  setDisabledState(isDisabled) {
681
570
  if (this.host && this.host.colorWheel) {
682
- this.host.colorWheel.disabled$.next(isDisabled);
571
+ this.host.colorWheel.disabled.set(isDisabled);
683
572
  }
684
573
  }
685
574
  //#endregion
@@ -737,10 +626,9 @@ class BsColorPickerValueAccessor {
737
626
  h *= 360;
738
627
  return { h, s, l };
739
628
  }
740
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BsColorPickerValueAccessor, deps: [{ token: forwardRef(() => BsColorPickerComponent) }, { token: i0.DestroyRef }], target: i0.ɵɵFactoryTarget.Directive }); }
629
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BsColorPickerValueAccessor, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
741
630
  static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.0.6", type: BsColorPickerValueAccessor, isStandalone: false, selector: "bs-color-picker", providers: [{
742
631
  provide: NG_VALUE_ACCESSOR,
743
- // useExisting: BsColorPickerValueAccessor,
744
632
  useExisting: forwardRef(() => BsColorPickerValueAccessor),
745
633
  multi: true
746
634
  }], exportAs: ["bsColorPicker"], ngImport: i0 }); }
@@ -752,16 +640,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
752
640
  standalone: false,
753
641
  providers: [{
754
642
  provide: NG_VALUE_ACCESSOR,
755
- // useExisting: BsColorPickerValueAccessor,
756
643
  useExisting: forwardRef(() => BsColorPickerValueAccessor),
757
644
  multi: true
758
645
  }],
759
646
  exportAs: 'bsColorPicker'
760
647
  }]
761
- }], ctorParameters: () => [{ type: BsColorPickerComponent, decorators: [{
762
- type: Inject,
763
- args: [forwardRef(() => BsColorPickerComponent)]
764
- }] }, { type: i0.DestroyRef }] });
648
+ }], ctorParameters: () => [] });
765
649
 
766
650
  class BsColorPickerModule {
767
651
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BsColorPickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }