@mintplayer/ng-bootstrap 21.6.0 → 21.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/mintplayer-ng-bootstrap-accordion.mjs +34 -73
- package/fesm2022/mintplayer-ng-bootstrap-accordion.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-alert.mjs +10 -31
- package/fesm2022/mintplayer-ng-bootstrap-alert.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-badge.mjs +4 -4
- package/fesm2022/mintplayer-ng-bootstrap-badge.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-breadcrumb.mjs +12 -29
- package/fesm2022/mintplayer-ng-bootstrap-breadcrumb.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-button-group.mjs +5 -5
- package/fesm2022/mintplayer-ng-bootstrap-button-group.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-button-type.mjs +17 -19
- package/fesm2022/mintplayer-ng-bootstrap-button-type.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-calendar-month.mjs +9 -11
- package/fesm2022/mintplayer-ng-bootstrap-calendar-month.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-calendar.mjs +5 -5
- package/fesm2022/mintplayer-ng-bootstrap-calendar.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-card.mjs +14 -41
- package/fesm2022/mintplayer-ng-bootstrap-card.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-carousel.mjs +47 -89
- package/fesm2022/mintplayer-ng-bootstrap-carousel.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-close.mjs +4 -4
- package/fesm2022/mintplayer-ng-bootstrap-close.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-code-snippet.mjs +10 -13
- package/fesm2022/mintplayer-ng-bootstrap-code-snippet.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-color-picker.mjs +294 -383
- package/fesm2022/mintplayer-ng-bootstrap-color-picker.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-container.mjs +5 -5
- package/fesm2022/mintplayer-ng-bootstrap-container.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-context-menu.mjs +10 -44
- package/fesm2022/mintplayer-ng-bootstrap-context-menu.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-copy.mjs +16 -23
- package/fesm2022/mintplayer-ng-bootstrap-copy.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-datatable.mjs +24 -74
- package/fesm2022/mintplayer-ng-bootstrap-datatable.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-datepicker.mjs +6 -8
- package/fesm2022/mintplayer-ng-bootstrap-datepicker.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-dock.mjs +43 -73
- package/fesm2022/mintplayer-ng-bootstrap-dock.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-dropdown-divider.mjs +8 -12
- package/fesm2022/mintplayer-ng-bootstrap-dropdown-divider.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-dropdown-menu.mjs +23 -60
- package/fesm2022/mintplayer-ng-bootstrap-dropdown-menu.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-dropdown.mjs +34 -86
- package/fesm2022/mintplayer-ng-bootstrap-dropdown.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-enhanced-paste.mjs +9 -12
- package/fesm2022/mintplayer-ng-bootstrap-enhanced-paste.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-enum.mjs +3 -3
- package/fesm2022/mintplayer-ng-bootstrap-file-upload.mjs +35 -96
- package/fesm2022/mintplayer-ng-bootstrap-file-upload.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-floating-labels.mjs +9 -10
- package/fesm2022/mintplayer-ng-bootstrap-floating-labels.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-font-color.mjs +3 -4
- package/fesm2022/mintplayer-ng-bootstrap-font-color.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-for.mjs +23 -26
- package/fesm2022/mintplayer-ng-bootstrap-for.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-form.mjs +29 -54
- package/fesm2022/mintplayer-ng-bootstrap-form.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-grid.mjs +35 -67
- package/fesm2022/mintplayer-ng-bootstrap-grid.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-has-overlay.mjs +5 -5
- package/fesm2022/mintplayer-ng-bootstrap-has-overlay.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-has-property.mjs +3 -4
- package/fesm2022/mintplayer-ng-bootstrap-has-property.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-in-list.mjs +3 -4
- package/fesm2022/mintplayer-ng-bootstrap-in-list.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-input-group.mjs +5 -5
- package/fesm2022/mintplayer-ng-bootstrap-input-group.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-instance-of.mjs +75 -114
- package/fesm2022/mintplayer-ng-bootstrap-instance-of.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-let.mjs +16 -15
- package/fesm2022/mintplayer-ng-bootstrap-let.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-linify.mjs +3 -4
- package/fesm2022/mintplayer-ng-bootstrap-linify.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-list-group.mjs +17 -44
- package/fesm2022/mintplayer-ng-bootstrap-list-group.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-markdown.mjs +12 -16
- package/fesm2022/mintplayer-ng-bootstrap-markdown.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-marquee.mjs +5 -5
- package/fesm2022/mintplayer-ng-bootstrap-marquee.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-modal.mjs +74 -160
- package/fesm2022/mintplayer-ng-bootstrap-modal.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-multiselect.mjs +25 -87
- package/fesm2022/mintplayer-ng-bootstrap-multiselect.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-navbar-toggler.mjs +8 -9
- package/fesm2022/mintplayer-ng-bootstrap-navbar-toggler.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-navbar.mjs +136 -232
- package/fesm2022/mintplayer-ng-bootstrap-navbar.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-navigation-lock.mjs +40 -68
- package/fesm2022/mintplayer-ng-bootstrap-navigation-lock.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-no-noscript.mjs +11 -15
- package/fesm2022/mintplayer-ng-bootstrap-no-noscript.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-offcanvas.mjs +70 -138
- package/fesm2022/mintplayer-ng-bootstrap-offcanvas.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-ordinal-number.mjs +3 -4
- package/fesm2022/mintplayer-ng-bootstrap-ordinal-number.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-pagination.mjs +4 -4
- package/fesm2022/mintplayer-ng-bootstrap-pagination.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-parallax.mjs +5 -5
- package/fesm2022/mintplayer-ng-bootstrap-parallax.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-placeholder.mjs +16 -39
- package/fesm2022/mintplayer-ng-bootstrap-placeholder.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-playlist-toggler.mjs +8 -9
- package/fesm2022/mintplayer-ng-bootstrap-playlist-toggler.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-popover.mjs +40 -70
- package/fesm2022/mintplayer-ng-bootstrap-popover.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-progress-bar.mjs +28 -97
- package/fesm2022/mintplayer-ng-bootstrap-progress-bar.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-range.mjs +30 -58
- package/fesm2022/mintplayer-ng-bootstrap-range.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-rating.mjs +10 -17
- package/fesm2022/mintplayer-ng-bootstrap-rating.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-resizable.mjs +96 -153
- package/fesm2022/mintplayer-ng-bootstrap-resizable.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-scheduler.mjs +26 -41
- package/fesm2022/mintplayer-ng-bootstrap-scheduler.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-scrollspy.mjs +30 -61
- package/fesm2022/mintplayer-ng-bootstrap-scrollspy.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-searchbox.mjs +59 -108
- package/fesm2022/mintplayer-ng-bootstrap-searchbox.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-select.mjs +99 -131
- package/fesm2022/mintplayer-ng-bootstrap-select.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-select2.mjs +63 -106
- package/fesm2022/mintplayer-ng-bootstrap-select2.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-shell.mjs +15 -33
- package/fesm2022/mintplayer-ng-bootstrap-shell.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-signature-pad.mjs +16 -33
- package/fesm2022/mintplayer-ng-bootstrap-signature-pad.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-slugify.mjs +3 -4
- package/fesm2022/mintplayer-ng-bootstrap-slugify.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-spinner.mjs +4 -4
- package/fesm2022/mintplayer-ng-bootstrap-spinner.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-split-string.mjs +3 -4
- package/fesm2022/mintplayer-ng-bootstrap-split-string.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-sticky-footer.mjs +16 -35
- package/fesm2022/mintplayer-ng-bootstrap-sticky-footer.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-tab-control.mjs +39 -81
- package/fesm2022/mintplayer-ng-bootstrap-tab-control.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-table.mjs +4 -4
- package/fesm2022/mintplayer-ng-bootstrap-table.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-timepicker.mjs +13 -17
- package/fesm2022/mintplayer-ng-bootstrap-timepicker.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-toast.mjs +80 -154
- package/fesm2022/mintplayer-ng-bootstrap-toast.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-toggle-button.mjs +116 -153
- package/fesm2022/mintplayer-ng-bootstrap-toggle-button.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-tooltip.mjs +25 -62
- package/fesm2022/mintplayer-ng-bootstrap-tooltip.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-treeview.mjs +16 -33
- package/fesm2022/mintplayer-ng-bootstrap-treeview.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-trust-html.mjs +3 -4
- package/fesm2022/mintplayer-ng-bootstrap-trust-html.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-typeahead.mjs +13 -20
- package/fesm2022/mintplayer-ng-bootstrap-typeahead.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-uc-first.mjs +3 -4
- package/fesm2022/mintplayer-ng-bootstrap-uc-first.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-user-agent.mjs +14 -26
- package/fesm2022/mintplayer-ng-bootstrap-user-agent.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-viewport.mjs +6 -9
- package/fesm2022/mintplayer-ng-bootstrap-viewport.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-word-count.mjs +3 -4
- package/fesm2022/mintplayer-ng-bootstrap-word-count.mjs.map +1 -1
- package/package.json +4 -4
- package/types/mintplayer-ng-bootstrap-accordion.d.ts +20 -30
- package/types/mintplayer-ng-bootstrap-alert.d.ts +3 -9
- package/types/mintplayer-ng-bootstrap-breadcrumb.d.ts +3 -10
- package/types/mintplayer-ng-bootstrap-button-type.d.ts +4 -4
- package/types/mintplayer-ng-bootstrap-card.d.ts +5 -12
- package/types/mintplayer-ng-bootstrap-carousel.d.ts +6 -14
- package/types/mintplayer-ng-bootstrap-code-snippet.d.ts +3 -3
- package/types/mintplayer-ng-bootstrap-color-picker.d.ts +43 -54
- package/types/mintplayer-ng-bootstrap-context-menu.d.ts +2 -11
- package/types/mintplayer-ng-bootstrap-copy.d.ts +5 -7
- package/types/mintplayer-ng-bootstrap-datatable.d.ts +7 -18
- package/types/mintplayer-ng-bootstrap-dock.d.ts +18 -31
- package/types/mintplayer-ng-bootstrap-dropdown-divider.d.ts +0 -1
- package/types/mintplayer-ng-bootstrap-dropdown-menu.d.ts +11 -22
- package/types/mintplayer-ng-bootstrap-dropdown.d.ts +16 -28
- package/types/mintplayer-ng-bootstrap-enhanced-paste.d.ts +1 -2
- package/types/mintplayer-ng-bootstrap-file-upload.d.ts +16 -27
- package/types/mintplayer-ng-bootstrap-floating-labels.d.ts +2 -3
- package/types/mintplayer-ng-bootstrap-for.d.ts +3 -3
- package/types/mintplayer-ng-bootstrap-form.d.ts +11 -20
- package/types/mintplayer-ng-bootstrap-grid.d.ts +23 -35
- package/types/mintplayer-ng-bootstrap-instance-of.d.ts +34 -41
- package/types/mintplayer-ng-bootstrap-let.d.ts +3 -2
- package/types/mintplayer-ng-bootstrap-list-group.d.ts +4 -13
- package/types/mintplayer-ng-bootstrap-modal.d.ts +13 -29
- package/types/mintplayer-ng-bootstrap-multiselect.d.ts +8 -21
- package/types/mintplayer-ng-bootstrap-navbar.d.ts +38 -51
- package/types/mintplayer-ng-bootstrap-navigation-lock.d.ts +8 -15
- package/types/mintplayer-ng-bootstrap-no-noscript.d.ts +1 -1
- package/types/mintplayer-ng-bootstrap-offcanvas.d.ts +20 -30
- package/types/mintplayer-ng-bootstrap-placeholder.d.ts +3 -11
- package/types/mintplayer-ng-bootstrap-popover.d.ts +18 -31
- package/types/mintplayer-ng-bootstrap-progress-bar.d.ts +9 -27
- package/types/mintplayer-ng-bootstrap-range.d.ts +14 -22
- package/types/mintplayer-ng-bootstrap-rating.d.ts +0 -2
- package/types/mintplayer-ng-bootstrap-resizable.d.ts +23 -32
- package/types/mintplayer-ng-bootstrap-scheduler.d.ts +3 -9
- package/types/mintplayer-ng-bootstrap-scrollspy.d.ts +7 -16
- package/types/mintplayer-ng-bootstrap-searchbox.d.ts +20 -34
- package/types/mintplayer-ng-bootstrap-select.d.ts +24 -30
- package/types/mintplayer-ng-bootstrap-select2.d.ts +21 -33
- package/types/mintplayer-ng-bootstrap-shell.d.ts +12 -19
- package/types/mintplayer-ng-bootstrap-signature-pad.d.ts +2 -3
- package/types/mintplayer-ng-bootstrap-sticky-footer.d.ts +4 -12
- package/types/mintplayer-ng-bootstrap-tab-control.d.ts +9 -21
- package/types/mintplayer-ng-bootstrap-timepicker.d.ts +3 -3
- package/types/mintplayer-ng-bootstrap-toast.d.ts +12 -20
- package/types/mintplayer-ng-bootstrap-toggle-button.d.ts +20 -29
- package/types/mintplayer-ng-bootstrap-tooltip.d.ts +4 -24
- package/types/mintplayer-ng-bootstrap-treeview.d.ts +13 -21
- package/types/mintplayer-ng-bootstrap-typeahead.d.ts +3 -3
- package/types/mintplayer-ng-bootstrap-user-agent.d.ts +2 -3
- package/types/mintplayer-ng-bootstrap-viewport.d.ts +2 -2
|
@@ -1,12 +1,272 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, ElementRef, model, output, signal, computed, effect,
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import { inject, ElementRef, viewChild, input, model, output, signal, computed, effect, ChangeDetectionStrategy, Component, Directive, forwardRef } from '@angular/core';
|
|
3
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
4
|
+
|
|
5
|
+
class BsSliderComponent {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.element = inject((ElementRef));
|
|
8
|
+
this.track = viewChild.required('track');
|
|
9
|
+
this.thumb = viewChild.required('thumb');
|
|
10
|
+
this.disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
11
|
+
this.value = model(0.5, ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
12
|
+
this.valueChange = output();
|
|
13
|
+
this.isPointerDown = signal(false, ...(ngDevMode ? [{ debugName: "isPointerDown" }] : []));
|
|
14
|
+
this.thumbMarginLeft = computed(() => {
|
|
15
|
+
const value = this.value();
|
|
16
|
+
const res = value * this.element.nativeElement.clientWidth - 12;
|
|
17
|
+
return res;
|
|
18
|
+
}, ...(ngDevMode ? [{ debugName: "thumbMarginLeft" }] : []));
|
|
19
|
+
this.cursorClass = computed(() => {
|
|
20
|
+
return this.isPointerDown() ? 'cursor-grabbing' : 'cursor-grab';
|
|
21
|
+
}, ...(ngDevMode ? [{ debugName: "cursorClass" }] : []));
|
|
22
|
+
effect(() => {
|
|
23
|
+
const value = this.value();
|
|
24
|
+
this.valueChange.emit(value);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
onPointerDown(ev) {
|
|
28
|
+
if (this.disabled())
|
|
29
|
+
return;
|
|
30
|
+
ev.preventDefault();
|
|
31
|
+
ev.stopPropagation();
|
|
32
|
+
this.isPointerDown.set(true);
|
|
33
|
+
this.updateColor(ev);
|
|
34
|
+
}
|
|
35
|
+
onPointerMove(ev) {
|
|
36
|
+
if (this.isPointerDown()) {
|
|
37
|
+
ev.preventDefault();
|
|
38
|
+
ev.stopPropagation();
|
|
39
|
+
this.updateColor(ev);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
onPointerUp(ev) {
|
|
43
|
+
this.isPointerDown.set(false);
|
|
44
|
+
}
|
|
45
|
+
updateColor(ev) {
|
|
46
|
+
let co;
|
|
47
|
+
const rect = this.track().nativeElement.getBoundingClientRect();
|
|
48
|
+
if ('touches' in ev) {
|
|
49
|
+
co = {
|
|
50
|
+
x: ev.touches[0].clientX - rect.left,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
co = {
|
|
55
|
+
x: ev.clientX - rect.left,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
const percent = co.x / this.track().nativeElement.clientWidth;
|
|
59
|
+
const limited = Math.max(0, Math.min(1, percent));
|
|
60
|
+
this.value.set(limited);
|
|
61
|
+
}
|
|
62
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: BsSliderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
63
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.1.6", type: BsSliderComponent, isStandalone: true, selector: "bs-slider", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, 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)" }, classAttribute: "d-block position-relative" }, viewQueries: [{ propertyName: "track", first: true, predicate: ["track"], descendants: true, isSignal: true }, { propertyName: "thumb", first: true, predicate: ["thumb"], descendants: true, isSignal: 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 }); }
|
|
64
|
+
}
|
|
65
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: BsSliderComponent, decorators: [{
|
|
66
|
+
type: Component,
|
|
67
|
+
args: [{ selector: 'bs-slider', changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
68
|
+
'class': 'd-block position-relative',
|
|
69
|
+
'(document:mousemove)': 'onPointerMove($event)',
|
|
70
|
+
'(document:mouseup)': 'onPointerUp($event)',
|
|
71
|
+
}, 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"] }]
|
|
72
|
+
}], ctorParameters: () => [], propDecorators: { track: [{ type: i0.ViewChild, args: ['track', { isSignal: true }] }], thumb: [{ type: i0.ViewChild, args: ['thumb', { isSignal: true }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }] } });
|
|
73
|
+
class BsThumbDirective {
|
|
74
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: BsThumbDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
75
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.6", type: BsThumbDirective, isStandalone: true, selector: "[bsThumb]", host: { classAttribute: "thumb position-absolute" }, ngImport: i0 }); }
|
|
76
|
+
}
|
|
77
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: BsThumbDirective, decorators: [{
|
|
78
|
+
type: Directive,
|
|
79
|
+
args: [{
|
|
80
|
+
selector: '[bsThumb]',
|
|
81
|
+
host: {
|
|
82
|
+
'class': 'thumb position-absolute',
|
|
83
|
+
},
|
|
84
|
+
}]
|
|
85
|
+
}] });
|
|
86
|
+
class BsTrackDirective {
|
|
87
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: BsTrackDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
88
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.6", type: BsTrackDirective, isStandalone: true, selector: "[bsTrack]", host: { classAttribute: "track" }, ngImport: i0 }); }
|
|
89
|
+
}
|
|
90
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: BsTrackDirective, decorators: [{
|
|
91
|
+
type: Directive,
|
|
92
|
+
args: [{
|
|
93
|
+
selector: '[bsTrack]',
|
|
94
|
+
host: {
|
|
95
|
+
'class': 'track',
|
|
96
|
+
},
|
|
97
|
+
}]
|
|
98
|
+
}] });
|
|
99
|
+
|
|
100
|
+
class BsAlphaStripComponent {
|
|
101
|
+
constructor() {
|
|
102
|
+
this.canvas = viewChild.required('track');
|
|
103
|
+
this.disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
104
|
+
this.hs = model({ hue: 0, saturation: 0 }, ...(ngDevMode ? [{ debugName: "hs" }] : []));
|
|
105
|
+
this.luminosity = model(0.5, ...(ngDevMode ? [{ debugName: "luminosity" }] : []));
|
|
106
|
+
this.alpha = model(1, ...(ngDevMode ? [{ debugName: "alpha" }] : []));
|
|
107
|
+
this.alphaChange = output();
|
|
108
|
+
this.canvasContext = null;
|
|
109
|
+
this.resultBackground = computed(() => {
|
|
110
|
+
const hs = this.hs();
|
|
111
|
+
const luminosity = this.luminosity();
|
|
112
|
+
const alpha = this.alpha();
|
|
113
|
+
return `hsla(${hs.hue}, ${hs.saturation * 100}%, ${luminosity * 100}%, ${alpha})`;
|
|
114
|
+
}, ...(ngDevMode ? [{ debugName: "resultBackground" }] : []));
|
|
115
|
+
// Draw gradient when HS or luminosity changes
|
|
116
|
+
effect(() => {
|
|
117
|
+
const hs = this.hs();
|
|
118
|
+
const luminosity = this.luminosity();
|
|
119
|
+
setTimeout(() => {
|
|
120
|
+
if (this.canvasContext) {
|
|
121
|
+
const width = this.canvas().nativeElement.width;
|
|
122
|
+
const height = this.canvas().nativeElement.height;
|
|
123
|
+
this.canvasContext.clearRect(0, 0, width, height);
|
|
124
|
+
this.canvasContext.save();
|
|
125
|
+
const gradient = this.canvasContext.createLinearGradient(0, 0, width, 0);
|
|
126
|
+
gradient.addColorStop(0, `hsla(${hs.hue}, ${hs.saturation * 100}%, ${luminosity * 100}%, 0)`);
|
|
127
|
+
gradient.addColorStop(1, `hsla(${hs.hue}, ${hs.saturation * 100}%, ${luminosity * 100}%, 1)`);
|
|
128
|
+
this.canvasContext.fillStyle = gradient;
|
|
129
|
+
this.canvasContext.fillRect(0, 0, width, height);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
// Emit alpha changes
|
|
134
|
+
effect(() => {
|
|
135
|
+
const alpha = this.alpha();
|
|
136
|
+
this.alphaChange.emit(alpha);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
ngAfterViewInit() {
|
|
140
|
+
if (typeof window !== 'undefined') {
|
|
141
|
+
this.canvasContext = this.canvas().nativeElement.getContext('2d', { willReadFrequently: true });
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: BsAlphaStripComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
145
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.1.6", type: BsAlphaStripComponent, isStandalone: true, selector: "bs-alpha-strip", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, 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, isSignal: true }], ngImport: i0, template: "<bs-slider [disabled]=\"disabled()\" [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: ["disabled", "value"], outputs: ["valueChange"] }, { kind: "directive", type: BsThumbDirective, selector: "[bsThumb]" }, { kind: "directive", type: BsTrackDirective, selector: "[bsTrack]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
146
|
+
}
|
|
147
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: BsAlphaStripComponent, decorators: [{
|
|
148
|
+
type: Component,
|
|
149
|
+
args: [{ selector: 'bs-alpha-strip', imports: [BsSliderComponent, BsThumbDirective, BsTrackDirective], changeDetection: ChangeDetectionStrategy.OnPush, template: "<bs-slider [disabled]=\"disabled()\" [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"] }]
|
|
150
|
+
}], ctorParameters: () => [], propDecorators: { canvas: [{ type: i0.ViewChild, args: ['track', { isSignal: true }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], 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"] }] } });
|
|
151
|
+
|
|
152
|
+
class BsColorPickerValueAccessor {
|
|
153
|
+
constructor() {
|
|
154
|
+
this.host = inject(BsColorPickerComponent);
|
|
155
|
+
// Effect to emit value changes
|
|
156
|
+
effect(() => {
|
|
157
|
+
const hs = this.host.hs();
|
|
158
|
+
const luminosity = this.host.luminosity();
|
|
159
|
+
const rgb = this.hsl2rgb(hs.hue, hs.saturation, luminosity);
|
|
160
|
+
const hex = this.rgb2hex(rgb);
|
|
161
|
+
setTimeout(() => this.onValueChange && this.onValueChange(hex), 10);
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
hsl2rgb(h, s, l) {
|
|
165
|
+
const k = (n) => (n + h / 30) % 12;
|
|
166
|
+
const a = s * Math.min(l, 1 - l);
|
|
167
|
+
const f = (n) => l - a * Math.max(-1, Math.min(k(n) - 3, Math.min(9 - k(n), 1)));
|
|
168
|
+
const retValue = { r: 255 * f(0), g: 255 * f(8), b: 255 * f(4) };
|
|
169
|
+
return retValue;
|
|
170
|
+
}
|
|
171
|
+
//#region ControlValueAccessor implementation
|
|
172
|
+
registerOnChange(fn) {
|
|
173
|
+
this.onValueChange = fn;
|
|
174
|
+
}
|
|
175
|
+
registerOnTouched(fn) {
|
|
176
|
+
this.onTouched = fn;
|
|
177
|
+
}
|
|
178
|
+
writeValue(value) {
|
|
179
|
+
if (this.host && this.host.colorWheel()) {
|
|
180
|
+
if (value) {
|
|
181
|
+
const rgb = this.hex2rgb(value);
|
|
182
|
+
const hsl = this.rgb2Hsl(rgb);
|
|
183
|
+
this.host.hs.set({ hue: hsl.h, saturation: hsl.s });
|
|
184
|
+
this.host.luminosity.set(hsl.l);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
setDisabledState(isDisabled) {
|
|
189
|
+
this.host.disabled.set(isDisabled);
|
|
190
|
+
}
|
|
191
|
+
//#endregion
|
|
192
|
+
//#region Color Conversion
|
|
193
|
+
rgb2hex(rgb) {
|
|
194
|
+
return '#' + (Math.round((rgb.r << 16) + (rgb.g << 8) + rgb.b)).toString(16).padStart(6, '0');
|
|
195
|
+
}
|
|
196
|
+
hex2rgb(hex) {
|
|
197
|
+
const r = parseInt(hex.slice(1, 3), 16), g = parseInt(hex.slice(3, 5), 16), b = parseInt(hex.slice(5, 7), 16);
|
|
198
|
+
return { r, g, b };
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Divide 1 to n, handling floating point errors.
|
|
202
|
+
* Ensures that the value is in between 0 and 1.
|
|
203
|
+
**/
|
|
204
|
+
bound01(n, max) {
|
|
205
|
+
n = Math.min(max, Math.max(0, n));
|
|
206
|
+
if (Math.abs(n - max) < 0.000001) {
|
|
207
|
+
return 1;
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
return (n % max) / max;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
rgb2Hsl(color) {
|
|
214
|
+
const r01 = this.bound01(color.r, 255);
|
|
215
|
+
const g01 = this.bound01(color.g, 255);
|
|
216
|
+
const b01 = this.bound01(color.b, 255);
|
|
217
|
+
const max = Math.max(r01, g01, b01);
|
|
218
|
+
const min = Math.min(r01, g01, b01);
|
|
219
|
+
let h, s;
|
|
220
|
+
const l = (max + min) / 2;
|
|
221
|
+
if (max === min) {
|
|
222
|
+
h = s = 0;
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
const d = max - min;
|
|
226
|
+
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
227
|
+
switch (max) {
|
|
228
|
+
case r01:
|
|
229
|
+
h = (g01 - b01) / d + (g01 < b01 ? 6 : 0);
|
|
230
|
+
break;
|
|
231
|
+
case g01:
|
|
232
|
+
h = (b01 - r01) / d + 2;
|
|
233
|
+
break;
|
|
234
|
+
case b01:
|
|
235
|
+
h = (r01 - g01) / d + 4;
|
|
236
|
+
break;
|
|
237
|
+
default: {
|
|
238
|
+
throw 'Invalid operation';
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
h /= 6;
|
|
242
|
+
}
|
|
243
|
+
h *= 360;
|
|
244
|
+
return { h, s, l };
|
|
245
|
+
}
|
|
246
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: BsColorPickerValueAccessor, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
247
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.6", type: BsColorPickerValueAccessor, isStandalone: true, selector: "bs-color-picker", providers: [{
|
|
248
|
+
provide: NG_VALUE_ACCESSOR,
|
|
249
|
+
useExisting: forwardRef(() => BsColorPickerValueAccessor),
|
|
250
|
+
multi: true
|
|
251
|
+
}], exportAs: ["bsColorPicker"], ngImport: i0 }); }
|
|
252
|
+
}
|
|
253
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: BsColorPickerValueAccessor, decorators: [{
|
|
254
|
+
type: Directive,
|
|
255
|
+
args: [{
|
|
256
|
+
selector: 'bs-color-picker',
|
|
257
|
+
providers: [{
|
|
258
|
+
provide: NG_VALUE_ACCESSOR,
|
|
259
|
+
useExisting: forwardRef(() => BsColorPickerValueAccessor),
|
|
260
|
+
multi: true
|
|
261
|
+
}],
|
|
262
|
+
exportAs: 'bsColorPicker'
|
|
263
|
+
}]
|
|
264
|
+
}], ctorParameters: () => [] });
|
|
5
265
|
|
|
6
266
|
class BsColorWheelComponent {
|
|
7
267
|
constructor() {
|
|
8
268
|
this.element = inject((ElementRef));
|
|
9
|
-
this.
|
|
269
|
+
this.canvas = viewChild.required('canvas');
|
|
10
270
|
// Inputs
|
|
11
271
|
this.width = model(150, ...(ngDevMode ? [{ debugName: "width" }] : []));
|
|
12
272
|
this.height = model(150, ...(ngDevMode ? [{ debugName: "height" }] : []));
|
|
@@ -16,7 +276,7 @@ class BsColorWheelComponent {
|
|
|
16
276
|
this.hs = model({ hue: 0, saturation: 0 }, ...(ngDevMode ? [{ debugName: "hs" }] : []));
|
|
17
277
|
this.hsChange = output();
|
|
18
278
|
// Internal state
|
|
19
|
-
this.disabled =
|
|
279
|
+
this.disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
20
280
|
this.viewInited = signal(false, ...(ngDevMode ? [{ debugName: "viewInited" }] : []));
|
|
21
281
|
this.isPointerDown = false;
|
|
22
282
|
this.canvasContext = null;
|
|
@@ -93,7 +353,7 @@ class BsColorWheelComponent {
|
|
|
93
353
|
// Use setTimeout to debounce slightly
|
|
94
354
|
setTimeout(() => {
|
|
95
355
|
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);
|
|
356
|
+
this.canvasContext.clearRect(0, 0, this.canvas().nativeElement.width, this.canvas().nativeElement.height);
|
|
97
357
|
this.canvasContext.save();
|
|
98
358
|
this.canvasContext.translate(shiftX + outerRadius, shiftY + outerRadius);
|
|
99
359
|
for (let x = 0; x < 360; x++) {
|
|
@@ -117,7 +377,7 @@ class BsColorWheelComponent {
|
|
|
117
377
|
ngAfterViewInit() {
|
|
118
378
|
this.viewInited.set(true);
|
|
119
379
|
if (typeof window !== 'undefined') {
|
|
120
|
-
this.canvasContext = this.canvas.nativeElement.getContext('2d', { willReadFrequently: true });
|
|
380
|
+
this.canvasContext = this.canvas().nativeElement.getContext('2d', { willReadFrequently: true });
|
|
121
381
|
}
|
|
122
382
|
}
|
|
123
383
|
onPointerDown(ev) {
|
|
@@ -143,7 +403,7 @@ class BsColorWheelComponent {
|
|
|
143
403
|
}
|
|
144
404
|
updateColor(ev, subtract) {
|
|
145
405
|
let co;
|
|
146
|
-
const rect = this.canvas.nativeElement.getBoundingClientRect();
|
|
406
|
+
const rect = this.canvas().nativeElement.getBoundingClientRect();
|
|
147
407
|
if ('touches' in ev) {
|
|
148
408
|
co = {
|
|
149
409
|
x: ev.touches[0].clientX - rect.left,
|
|
@@ -265,146 +525,22 @@ class BsColorWheelComponent {
|
|
|
265
525
|
return (n % max) / max;
|
|
266
526
|
}
|
|
267
527
|
}
|
|
268
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.
|
|
269
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.
|
|
528
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: BsColorWheelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
529
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.6", type: BsColorWheelComponent, isStandalone: true, 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 }, disabled: { classPropertyName: "disabled", publicName: "disabled", 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)" }, classAttribute: "position-relative" }, viewQueries: [{ propertyName: "canvas", first: true, predicate: ["canvas"], descendants: true, isSignal: 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 }); }
|
|
270
530
|
}
|
|
271
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.
|
|
531
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: BsColorWheelComponent, decorators: [{
|
|
272
532
|
type: Component,
|
|
273
|
-
args: [{ selector: 'bs-color-wheel',
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
args: ['canvas']
|
|
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: [{
|
|
281
|
-
type: HostListener,
|
|
282
|
-
args: ['document:mousemove', ['$event']]
|
|
283
|
-
}], onPointerUp: [{
|
|
284
|
-
type: HostListener,
|
|
285
|
-
args: ['document:mouseup', ['$event']]
|
|
286
|
-
}] } });
|
|
287
|
-
|
|
288
|
-
class BsSliderComponent {
|
|
289
|
-
constructor() {
|
|
290
|
-
this.element = inject((ElementRef));
|
|
291
|
-
this.zone = inject(NgZone);
|
|
292
|
-
this.dBlock = true;
|
|
293
|
-
this.positionRelative = true;
|
|
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;
|
|
300
|
-
return res;
|
|
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
|
-
});
|
|
309
|
-
}
|
|
310
|
-
onPointerDown(ev) {
|
|
311
|
-
ev.preventDefault();
|
|
312
|
-
ev.stopPropagation();
|
|
313
|
-
this.zone.run(() => this.isPointerDown.set(true));
|
|
314
|
-
this.updateColor(ev);
|
|
315
|
-
}
|
|
316
|
-
onPointerMove(ev) {
|
|
317
|
-
if (this.isPointerDown()) {
|
|
318
|
-
ev.preventDefault();
|
|
319
|
-
ev.stopPropagation();
|
|
320
|
-
this.updateColor(ev);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
onPointerUp(ev) {
|
|
324
|
-
this.isPointerDown.set(false);
|
|
325
|
-
}
|
|
326
|
-
updateColor(ev) {
|
|
327
|
-
let co;
|
|
328
|
-
const rect = this.track.nativeElement.getBoundingClientRect();
|
|
329
|
-
if ('touches' in ev) {
|
|
330
|
-
co = {
|
|
331
|
-
x: ev.touches[0].clientX - rect.left,
|
|
332
|
-
};
|
|
333
|
-
}
|
|
334
|
-
else {
|
|
335
|
-
co = {
|
|
336
|
-
x: ev.clientX - rect.left,
|
|
337
|
-
};
|
|
338
|
-
}
|
|
339
|
-
const percent = co.x / this.track.nativeElement.clientWidth;
|
|
340
|
-
const limited = Math.max(0, Math.min(1, percent));
|
|
341
|
-
this.value.set(limited);
|
|
342
|
-
}
|
|
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 }); }
|
|
345
|
-
}
|
|
346
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BsSliderComponent, decorators: [{
|
|
347
|
-
type: Component,
|
|
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: [{
|
|
350
|
-
type: HostBinding,
|
|
351
|
-
args: ['class.d-block']
|
|
352
|
-
}], positionRelative: [{
|
|
353
|
-
type: HostBinding,
|
|
354
|
-
args: ['class.position-relative']
|
|
355
|
-
}], track: [{
|
|
356
|
-
type: ViewChild,
|
|
357
|
-
args: ['track']
|
|
358
|
-
}], thumb: [{
|
|
359
|
-
type: ViewChild,
|
|
360
|
-
args: ['thumb']
|
|
361
|
-
}], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }], onPointerMove: [{
|
|
362
|
-
type: HostListener,
|
|
363
|
-
args: ['document:mousemove', ['$event']]
|
|
364
|
-
}], onPointerUp: [{
|
|
365
|
-
type: HostListener,
|
|
366
|
-
args: ['document:mouseup', ['$event']]
|
|
367
|
-
}] } });
|
|
368
|
-
class BsThumbDirective {
|
|
369
|
-
constructor() {
|
|
370
|
-
this.thumbClass = true;
|
|
371
|
-
}
|
|
372
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BsThumbDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
373
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.0.6", type: BsThumbDirective, isStandalone: false, selector: "[bsThumb]", host: { properties: { "class.thumb": "this.thumbClass", "class.position-absolute": "this.thumbClass" } }, ngImport: i0 }); }
|
|
374
|
-
}
|
|
375
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BsThumbDirective, decorators: [{
|
|
376
|
-
type: Directive,
|
|
377
|
-
args: [{
|
|
378
|
-
selector: '[bsThumb]',
|
|
379
|
-
standalone: false,
|
|
380
|
-
}]
|
|
381
|
-
}], propDecorators: { thumbClass: [{
|
|
382
|
-
type: HostBinding,
|
|
383
|
-
args: ['class.thumb']
|
|
384
|
-
}, {
|
|
385
|
-
type: HostBinding,
|
|
386
|
-
args: ['class.position-absolute']
|
|
387
|
-
}] } });
|
|
388
|
-
class BsTrackDirective {
|
|
389
|
-
constructor() {
|
|
390
|
-
this.trackClass = true;
|
|
391
|
-
}
|
|
392
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BsTrackDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
393
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.0.6", type: BsTrackDirective, isStandalone: false, selector: "[bsTrack]", host: { properties: { "class.track": "this.trackClass" } }, ngImport: i0 }); }
|
|
394
|
-
}
|
|
395
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BsTrackDirective, decorators: [{
|
|
396
|
-
type: Directive,
|
|
397
|
-
args: [{
|
|
398
|
-
selector: '[bsTrack]',
|
|
399
|
-
standalone: false,
|
|
400
|
-
}]
|
|
401
|
-
}], propDecorators: { trackClass: [{
|
|
402
|
-
type: HostBinding,
|
|
403
|
-
args: ['class.track']
|
|
404
|
-
}] } });
|
|
533
|
+
args: [{ selector: 'bs-color-wheel', changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
534
|
+
'class': 'position-relative',
|
|
535
|
+
'(document:mousemove)': 'onMouseMove($event)',
|
|
536
|
+
'(document:mouseup)': 'onPointerUp($event)',
|
|
537
|
+
}, 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"] }]
|
|
538
|
+
}], ctorParameters: () => [], propDecorators: { canvas: [{ type: i0.ViewChild, args: ['canvas', { isSignal: true }] }], 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"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }] } });
|
|
405
539
|
|
|
406
540
|
class BsLuminosityStripComponent {
|
|
407
541
|
constructor() {
|
|
542
|
+
this.canvas = viewChild.required('canvas');
|
|
543
|
+
this.disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
408
544
|
this.hs = model({ hue: 0, saturation: 0 }, ...(ngDevMode ? [{ debugName: "hs" }] : []));
|
|
409
545
|
this.luminosity = model(0.5, ...(ngDevMode ? [{ debugName: "luminosity" }] : []));
|
|
410
546
|
this.luminosityChange = output();
|
|
@@ -418,8 +554,8 @@ class BsLuminosityStripComponent {
|
|
|
418
554
|
effect(() => {
|
|
419
555
|
const hs = this.hs();
|
|
420
556
|
if (this.canvasContext) {
|
|
421
|
-
const width = this.canvas.nativeElement.width;
|
|
422
|
-
const height = this.canvas.nativeElement.height;
|
|
557
|
+
const width = this.canvas().nativeElement.width;
|
|
558
|
+
const height = this.canvas().nativeElement.height;
|
|
423
559
|
this.canvasContext.clearRect(0, 0, width, height);
|
|
424
560
|
this.canvasContext.save();
|
|
425
561
|
const gradient = this.canvasContext.createLinearGradient(0, 0, width, 0);
|
|
@@ -438,75 +574,20 @@ class BsLuminosityStripComponent {
|
|
|
438
574
|
}
|
|
439
575
|
ngAfterViewInit() {
|
|
440
576
|
if (typeof window !== 'undefined') {
|
|
441
|
-
this.canvasContext = this.canvas.nativeElement.getContext('2d', { willReadFrequently: true });
|
|
577
|
+
this.canvasContext = this.canvas().nativeElement.getContext('2d', { willReadFrequently: true });
|
|
442
578
|
}
|
|
443
579
|
}
|
|
444
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.
|
|
445
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
580
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: BsLuminosityStripComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
581
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.1.6", type: BsLuminosityStripComponent, isStandalone: true, selector: "bs-luminosity-strip", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, 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, isSignal: true }], ngImport: i0, template: "<bs-slider [disabled]=\"disabled()\" [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: ["disabled", "value"], outputs: ["valueChange"] }, { kind: "directive", type: BsThumbDirective, selector: "[bsThumb]" }, { kind: "directive", type: BsTrackDirective, selector: "[bsTrack]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
446
582
|
}
|
|
447
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.
|
|
583
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: BsLuminosityStripComponent, decorators: [{
|
|
448
584
|
type: Component,
|
|
449
|
-
args: [{ selector: 'bs-luminosity-strip',
|
|
450
|
-
}], ctorParameters: () => [], propDecorators: { canvas: [{
|
|
451
|
-
type: ViewChild,
|
|
452
|
-
args: ['canvas']
|
|
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"] }] } });
|
|
454
|
-
|
|
455
|
-
class BsAlphaStripComponent {
|
|
456
|
-
constructor() {
|
|
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();
|
|
461
|
-
this.canvasContext = null;
|
|
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();
|
|
472
|
-
setTimeout(() => {
|
|
473
|
-
if (this.canvasContext) {
|
|
474
|
-
const width = this.canvas.nativeElement.width;
|
|
475
|
-
const height = this.canvas.nativeElement.height;
|
|
476
|
-
this.canvasContext.clearRect(0, 0, width, height);
|
|
477
|
-
this.canvasContext.save();
|
|
478
|
-
const gradient = this.canvasContext.createLinearGradient(0, 0, width, 0);
|
|
479
|
-
gradient.addColorStop(0, `hsla(${hs.hue}, ${hs.saturation * 100}%, ${luminosity * 100}%, 0)`);
|
|
480
|
-
gradient.addColorStop(1, `hsla(${hs.hue}, ${hs.saturation * 100}%, ${luminosity * 100}%, 1)`);
|
|
481
|
-
this.canvasContext.fillStyle = gradient;
|
|
482
|
-
this.canvasContext.fillRect(0, 0, width, height);
|
|
483
|
-
}
|
|
484
|
-
});
|
|
485
|
-
});
|
|
486
|
-
// Emit alpha changes
|
|
487
|
-
effect(() => {
|
|
488
|
-
const alpha = this.alpha();
|
|
489
|
-
this.alphaChange.emit(alpha);
|
|
490
|
-
});
|
|
491
|
-
}
|
|
492
|
-
ngAfterViewInit() {
|
|
493
|
-
if (typeof window !== 'undefined') {
|
|
494
|
-
this.canvasContext = this.canvas.nativeElement.getContext('2d', { willReadFrequently: true });
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BsAlphaStripComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
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 }); }
|
|
499
|
-
}
|
|
500
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BsAlphaStripComponent, decorators: [{
|
|
501
|
-
type: Component,
|
|
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: [{
|
|
504
|
-
type: ViewChild,
|
|
505
|
-
args: ['track']
|
|
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"] }] } });
|
|
585
|
+
args: [{ selector: 'bs-luminosity-strip', imports: [BsSliderComponent, BsThumbDirective, BsTrackDirective], changeDetection: ChangeDetectionStrategy.OnPush, template: "<bs-slider [disabled]=\"disabled()\" [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" }]
|
|
586
|
+
}], ctorParameters: () => [], propDecorators: { canvas: [{ type: i0.ViewChild, args: ['canvas', { isSignal: true }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], 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"] }] } });
|
|
507
587
|
|
|
508
588
|
class BsColorPickerComponent {
|
|
509
589
|
constructor() {
|
|
590
|
+
this.colorWheel = viewChild.required('wheel');
|
|
510
591
|
this.size = input(150, ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
511
592
|
this.disabled = signal(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
512
593
|
this.allowAlpha = input(true, ...(ngDevMode ? [{ debugName: "allowAlpha" }] : []));
|
|
@@ -519,187 +600,17 @@ class BsColorPickerComponent {
|
|
|
519
600
|
this.alphaChange.emit(alpha);
|
|
520
601
|
});
|
|
521
602
|
}
|
|
522
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.
|
|
523
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.
|
|
603
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: BsColorPickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
604
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.6", type: BsColorPickerComponent, isStandalone: true, 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, isSignal: true }], hostDirectives: [{ directive: BsColorPickerValueAccessor }], ngImport: i0, template: "@let letDisabled = disabled();\n@let letHS = hs();\n@let letLuminosity = luminosity();\n@let letAlpha = alpha();\n\n<bs-color-wheel [disabled]=\"letDisabled\" [hs]=\"letHS\" (hsChange)=\"hs.set($event)\" [luminosity]=\"letLuminosity\" [width]=\"size()\" [height]=\"size()\" #wheel></bs-color-wheel>\n<bs-luminosity-strip [disabled]=\"letDisabled\" [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 [disabled]=\"letDisabled\" [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", "disabled"], outputs: ["widthChange", "heightChange", "diameterRatioChange", "luminosityChange", "hsChange"] }, { kind: "component", type: BsLuminosityStripComponent, selector: "bs-luminosity-strip", inputs: ["disabled", "hs", "luminosity"], outputs: ["hsChange", "luminosityChange"] }, { kind: "component", type: BsAlphaStripComponent, selector: "bs-alpha-strip", inputs: ["disabled", "hs", "luminosity", "alpha"], outputs: ["hsChange", "luminosityChange", "alphaChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
524
605
|
}
|
|
525
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.
|
|
606
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: BsColorPickerComponent, decorators: [{
|
|
526
607
|
type: Component,
|
|
527
|
-
args: [{ selector: 'bs-color-picker',
|
|
528
|
-
}], ctorParameters: () => [], propDecorators: { colorWheel: [{
|
|
529
|
-
type: ViewChild,
|
|
530
|
-
args: ['wheel']
|
|
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"] }] } });
|
|
532
|
-
|
|
533
|
-
class BsColorPickerValueAccessor {
|
|
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();
|
|
540
|
-
const rgb = this.hsl2rgb(hs.hue, hs.saturation, luminosity);
|
|
541
|
-
const hex = this.rgb2hex(rgb);
|
|
542
|
-
setTimeout(() => this.onValueChange && this.onValueChange(hex), 10);
|
|
543
|
-
});
|
|
544
|
-
}
|
|
545
|
-
hsl2rgb(h, s, l) {
|
|
546
|
-
const k = (n) => (n + h / 30) % 12;
|
|
547
|
-
const a = s * Math.min(l, 1 - l);
|
|
548
|
-
const f = (n) => l - a * Math.max(-1, Math.min(k(n) - 3, Math.min(9 - k(n), 1)));
|
|
549
|
-
const retValue = { r: 255 * f(0), g: 255 * f(8), b: 255 * f(4) };
|
|
550
|
-
return retValue;
|
|
551
|
-
}
|
|
552
|
-
//#region ControlValueAccessor implementation
|
|
553
|
-
registerOnChange(fn) {
|
|
554
|
-
this.onValueChange = fn;
|
|
555
|
-
}
|
|
556
|
-
registerOnTouched(fn) {
|
|
557
|
-
this.onTouched = fn;
|
|
558
|
-
}
|
|
559
|
-
writeValue(value) {
|
|
560
|
-
if (this.host && this.host.colorWheel) {
|
|
561
|
-
if (value) {
|
|
562
|
-
const rgb = this.hex2rgb(value);
|
|
563
|
-
const hsl = this.rgb2Hsl(rgb);
|
|
564
|
-
this.host.hs.set({ hue: hsl.h, saturation: hsl.s });
|
|
565
|
-
this.host.luminosity.set(hsl.l);
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
setDisabledState(isDisabled) {
|
|
570
|
-
if (this.host && this.host.colorWheel) {
|
|
571
|
-
this.host.colorWheel.disabled.set(isDisabled);
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
//#endregion
|
|
575
|
-
//#region Color Conversion
|
|
576
|
-
rgb2hex(rgb) {
|
|
577
|
-
return '#' + (Math.round((rgb.r << 16) + (rgb.g << 8) + rgb.b)).toString(16).padStart(6, '0');
|
|
578
|
-
}
|
|
579
|
-
hex2rgb(hex) {
|
|
580
|
-
const r = parseInt(hex.slice(1, 3), 16), g = parseInt(hex.slice(3, 5), 16), b = parseInt(hex.slice(5, 7), 16);
|
|
581
|
-
return { r, g, b };
|
|
582
|
-
}
|
|
583
|
-
/**
|
|
584
|
-
* Divide 1 to n, handling floating point errors.
|
|
585
|
-
* Ensures that the value is in between 0 and 1.
|
|
586
|
-
**/
|
|
587
|
-
bound01(n, max) {
|
|
588
|
-
n = Math.min(max, Math.max(0, n));
|
|
589
|
-
if (Math.abs(n - max) < 0.000001) {
|
|
590
|
-
return 1;
|
|
591
|
-
}
|
|
592
|
-
else {
|
|
593
|
-
return (n % max) / max;
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
rgb2Hsl(color) {
|
|
597
|
-
const r01 = this.bound01(color.r, 255);
|
|
598
|
-
const g01 = this.bound01(color.g, 255);
|
|
599
|
-
const b01 = this.bound01(color.b, 255);
|
|
600
|
-
const max = Math.max(r01, g01, b01);
|
|
601
|
-
const min = Math.min(r01, g01, b01);
|
|
602
|
-
let h, s;
|
|
603
|
-
const l = (max + min) / 2;
|
|
604
|
-
if (max === min) {
|
|
605
|
-
h = s = 0;
|
|
606
|
-
}
|
|
607
|
-
else {
|
|
608
|
-
const d = max - min;
|
|
609
|
-
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
610
|
-
switch (max) {
|
|
611
|
-
case r01:
|
|
612
|
-
h = (g01 - b01) / d + (g01 < b01 ? 6 : 0);
|
|
613
|
-
break;
|
|
614
|
-
case g01:
|
|
615
|
-
h = (b01 - r01) / d + 2;
|
|
616
|
-
break;
|
|
617
|
-
case b01:
|
|
618
|
-
h = (r01 - g01) / d + 4;
|
|
619
|
-
break;
|
|
620
|
-
default: {
|
|
621
|
-
throw 'Invalid operation';
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
h /= 6;
|
|
625
|
-
}
|
|
626
|
-
h *= 360;
|
|
627
|
-
return { h, s, l };
|
|
628
|
-
}
|
|
629
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BsColorPickerValueAccessor, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
630
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.0.6", type: BsColorPickerValueAccessor, isStandalone: false, selector: "bs-color-picker", providers: [{
|
|
631
|
-
provide: NG_VALUE_ACCESSOR,
|
|
632
|
-
useExisting: forwardRef(() => BsColorPickerValueAccessor),
|
|
633
|
-
multi: true
|
|
634
|
-
}], exportAs: ["bsColorPicker"], ngImport: i0 }); }
|
|
635
|
-
}
|
|
636
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BsColorPickerValueAccessor, decorators: [{
|
|
637
|
-
type: Directive,
|
|
638
|
-
args: [{
|
|
639
|
-
selector: 'bs-color-picker',
|
|
640
|
-
standalone: false,
|
|
641
|
-
providers: [{
|
|
642
|
-
provide: NG_VALUE_ACCESSOR,
|
|
643
|
-
useExisting: forwardRef(() => BsColorPickerValueAccessor),
|
|
644
|
-
multi: true
|
|
645
|
-
}],
|
|
646
|
-
exportAs: 'bsColorPicker'
|
|
647
|
-
}]
|
|
648
|
-
}], ctorParameters: () => [] });
|
|
649
|
-
|
|
650
|
-
class BsColorPickerModule {
|
|
651
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BsColorPickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
652
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.0.6", ngImport: i0, type: BsColorPickerModule, declarations: [BsColorPickerComponent,
|
|
653
|
-
BsColorPickerValueAccessor,
|
|
654
|
-
BsColorWheelComponent,
|
|
655
|
-
BsLuminosityStripComponent,
|
|
656
|
-
BsSliderComponent,
|
|
657
|
-
BsThumbDirective,
|
|
658
|
-
BsTrackDirective,
|
|
659
|
-
BsAlphaStripComponent], imports: [AsyncPipe,
|
|
660
|
-
FormsModule], exports: [BsColorPickerComponent,
|
|
661
|
-
BsColorPickerValueAccessor,
|
|
662
|
-
BsColorWheelComponent,
|
|
663
|
-
BsLuminosityStripComponent,
|
|
664
|
-
BsSliderComponent,
|
|
665
|
-
BsThumbDirective,
|
|
666
|
-
BsTrackDirective,
|
|
667
|
-
BsAlphaStripComponent] }); }
|
|
668
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BsColorPickerModule, imports: [FormsModule] }); }
|
|
669
|
-
}
|
|
670
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BsColorPickerModule, decorators: [{
|
|
671
|
-
type: NgModule,
|
|
672
|
-
args: [{
|
|
673
|
-
declarations: [
|
|
674
|
-
BsColorPickerComponent,
|
|
675
|
-
BsColorPickerValueAccessor,
|
|
676
|
-
BsColorWheelComponent,
|
|
677
|
-
BsLuminosityStripComponent,
|
|
678
|
-
BsSliderComponent,
|
|
679
|
-
BsThumbDirective,
|
|
680
|
-
BsTrackDirective,
|
|
681
|
-
BsAlphaStripComponent
|
|
682
|
-
],
|
|
683
|
-
imports: [
|
|
684
|
-
AsyncPipe,
|
|
685
|
-
FormsModule,
|
|
686
|
-
],
|
|
687
|
-
exports: [
|
|
688
|
-
BsColorPickerComponent,
|
|
689
|
-
BsColorPickerValueAccessor,
|
|
690
|
-
BsColorWheelComponent,
|
|
691
|
-
BsLuminosityStripComponent,
|
|
692
|
-
BsSliderComponent,
|
|
693
|
-
BsThumbDirective,
|
|
694
|
-
BsTrackDirective,
|
|
695
|
-
BsAlphaStripComponent
|
|
696
|
-
]
|
|
697
|
-
}]
|
|
698
|
-
}] });
|
|
608
|
+
args: [{ selector: 'bs-color-picker', imports: [BsColorWheelComponent, BsLuminosityStripComponent, BsAlphaStripComponent], changeDetection: ChangeDetectionStrategy.OnPush, hostDirectives: [BsColorPickerValueAccessor], template: "@let letDisabled = disabled();\n@let letHS = hs();\n@let letLuminosity = luminosity();\n@let letAlpha = alpha();\n\n<bs-color-wheel [disabled]=\"letDisabled\" [hs]=\"letHS\" (hsChange)=\"hs.set($event)\" [luminosity]=\"letLuminosity\" [width]=\"size()\" [height]=\"size()\" #wheel></bs-color-wheel>\n<bs-luminosity-strip [disabled]=\"letDisabled\" [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 [disabled]=\"letDisabled\" [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" }]
|
|
609
|
+
}], ctorParameters: () => [], propDecorators: { colorWheel: [{ type: i0.ViewChild, args: ['wheel', { isSignal: true }] }], 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"] }] } });
|
|
699
610
|
|
|
700
611
|
/**
|
|
701
612
|
* Generated bundle index. Do not edit.
|
|
702
613
|
*/
|
|
703
614
|
|
|
704
|
-
export { BsAlphaStripComponent, BsColorPickerComponent,
|
|
615
|
+
export { BsAlphaStripComponent, BsColorPickerComponent, BsColorPickerValueAccessor, BsColorWheelComponent, BsLuminosityStripComponent, BsSliderComponent, BsThumbDirective, BsTrackDirective };
|
|
705
616
|
//# sourceMappingURL=mintplayer-ng-bootstrap-color-picker.mjs.map
|