@bravobit/bb-foundation 0.50.7 → 0.50.9
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/dialog/lib/dialog-modal/dialog-modal.component.d.ts +3 -1
- package/fesm2022/bravobit-bb-foundation-collections.mjs +2 -2
- package/fesm2022/bravobit-bb-foundation-collections.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-dialog.mjs +12 -7
- package/fesm2022/bravobit-bb-foundation-dialog.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-elements.mjs +16 -16
- package/fesm2022/bravobit-bb-foundation-elements.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-notifications.mjs +8 -13
- package/fesm2022/bravobit-bb-foundation-notifications.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-permissions.mjs +7 -11
- package/fesm2022/bravobit-bb-foundation-permissions.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-recaptcha.mjs +12 -28
- package/fesm2022/bravobit-bb-foundation-recaptcha.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-select.mjs +19 -27
- package/fesm2022/bravobit-bb-foundation-select.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-storage.mjs +8 -14
- package/fesm2022/bravobit-bb-foundation-storage.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-table.mjs +4 -4
- package/fesm2022/bravobit-bb-foundation-table.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-utils.mjs +22 -36
- package/fesm2022/bravobit-bb-foundation-utils.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation.mjs +31 -69
- package/fesm2022/bravobit-bb-foundation.mjs.map +1 -1
- package/lib/core/services/exif.service.d.ts +2 -5
- package/lib/core/services/image-converter.service.d.ts +3 -7
- package/lib/core/services/languages.service.d.ts +3 -3
- package/lib/core/services/network.service.d.ts +5 -6
- package/lib/core/services/patch.service.d.ts +4 -6
- package/localize/lib/transforms/interpolate.transform.d.ts +1 -1
- package/localize/lib/transforms/reference.transform.d.ts +1 -1
- package/notifications/lib/notifications-item/notifications-item.component.d.ts +4 -6
- package/package.json +21 -21
- package/permissions/lib/directives/permission.directive.d.ts +4 -6
- package/recaptcha/lib/recaptcha/recaptcha.component.d.ts +10 -14
- package/select/lib/select-label.directive.d.ts +0 -1
- package/select/lib/select-multi-label.directive.d.ts +0 -1
- package/select/lib/select-option-group.directive.d.ts +0 -1
- package/select/lib/select-option.directive.d.ts +0 -1
- package/storage/lib/storage.service.d.ts +4 -5
- package/styles/theme.scss +29 -14
- package/utils/lib/directives/autosize.directive.d.ts +3 -4
- package/utils/lib/directives/focus-trap.directive.d.ts +2 -5
- package/utils/lib/directives/focus.directive.d.ts +4 -6
- package/utils/lib/directives/template.directive.d.ts +3 -4
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { TemplateRef, Directive, Input, numberAttribute, HostBinding, HostListener,
|
|
2
|
+
import { inject, TemplateRef, ViewContainerRef, Directive, Input, Renderer2, ElementRef, numberAttribute, HostBinding, HostListener, NgZone, NgModule } from '@angular/core';
|
|
3
3
|
import { GLOBAL_FOCUS_MODE } from '@bravobit/bb-foundation';
|
|
4
|
-
import
|
|
4
|
+
import { Platform } from '@angular/cdk/platform';
|
|
5
5
|
|
|
6
6
|
class BbTemplate {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
// Dependencies.
|
|
8
|
+
_templateRef = inject(TemplateRef);
|
|
9
|
+
_viewContainerRef = inject(ViewContainerRef);
|
|
9
10
|
set bbTemplate(content) {
|
|
10
11
|
// Get the template.
|
|
11
12
|
const template = content instanceof TemplateRef
|
|
@@ -15,13 +16,9 @@ class BbTemplate {
|
|
|
15
16
|
this._viewContainerRef.clear();
|
|
16
17
|
this._viewContainerRef.createEmbeddedView(template);
|
|
17
18
|
}
|
|
18
|
-
constructor(_templateRef, _viewContainerRef) {
|
|
19
|
-
this._templateRef = _templateRef;
|
|
20
|
-
this._viewContainerRef = _viewContainerRef;
|
|
21
|
-
}
|
|
22
19
|
// Required so that the template type checker can infer the type of the coerced inputs.
|
|
23
20
|
static ngAcceptInputType_bbTemplate;
|
|
24
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: BbTemplate, deps: [
|
|
21
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: BbTemplate, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
25
22
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.4", type: BbTemplate, isStandalone: true, selector: "[bbTemplate]", inputs: { bbTemplate: "bbTemplate" }, ngImport: i0 });
|
|
26
23
|
}
|
|
27
24
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: BbTemplate, decorators: [{
|
|
@@ -29,21 +26,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImpor
|
|
|
29
26
|
args: [{
|
|
30
27
|
selector: '[bbTemplate]'
|
|
31
28
|
}]
|
|
32
|
-
}],
|
|
29
|
+
}], propDecorators: { bbTemplate: [{
|
|
33
30
|
type: Input
|
|
34
31
|
}] } });
|
|
35
32
|
|
|
36
33
|
class BbAutosize {
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
// Dependencies.
|
|
35
|
+
_renderer = inject(Renderer2);
|
|
36
|
+
_elementRef = inject(ElementRef);
|
|
39
37
|
// Min/max heights for the textarea.
|
|
40
38
|
minHeight = null;
|
|
41
39
|
maxHeight = null;
|
|
42
40
|
rows = 1;
|
|
43
|
-
constructor(_renderer, _elementRef) {
|
|
44
|
-
this._renderer = _renderer;
|
|
45
|
-
this._elementRef = _elementRef;
|
|
46
|
-
}
|
|
47
41
|
get element() {
|
|
48
42
|
return this._elementRef?.nativeElement;
|
|
49
43
|
}
|
|
@@ -74,7 +68,7 @@ class BbAutosize {
|
|
|
74
68
|
setHeight(value) {
|
|
75
69
|
this._renderer.setStyle(this.element, 'height', value);
|
|
76
70
|
}
|
|
77
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: BbAutosize, deps: [
|
|
71
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: BbAutosize, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
78
72
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "19.0.4", type: BbAutosize, isStandalone: true, selector: "textarea[bbAutosize]", inputs: { minHeight: "minHeight", maxHeight: "maxHeight", rows: ["rows", "rows", numberAttribute] }, host: { listeners: { "window:resize": "onWindowResize()", "input": "onInputReceived()" }, properties: { "style.min-height": "this.minHeight", "style.max-height": "this.maxHeight", "rows": "this.rows" } }, ngImport: i0 });
|
|
79
73
|
}
|
|
80
74
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: BbAutosize, decorators: [{
|
|
@@ -82,7 +76,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImpor
|
|
|
82
76
|
args: [{
|
|
83
77
|
selector: 'textarea[bbAutosize]'
|
|
84
78
|
}]
|
|
85
|
-
}],
|
|
79
|
+
}], propDecorators: { minHeight: [{
|
|
86
80
|
type: Input
|
|
87
81
|
}, {
|
|
88
82
|
type: HostBinding,
|
|
@@ -107,18 +101,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImpor
|
|
|
107
101
|
}] } });
|
|
108
102
|
|
|
109
103
|
class BbFocus {
|
|
110
|
-
_zone;
|
|
111
|
-
_platform;
|
|
112
|
-
_elementRef;
|
|
113
104
|
// Dependencies.
|
|
105
|
+
_zone = inject(NgZone);
|
|
106
|
+
_platform = inject(Platform);
|
|
107
|
+
_elementRef = inject(ElementRef);
|
|
114
108
|
_globalFocusMode = inject(GLOBAL_FOCUS_MODE);
|
|
115
109
|
// Inputs.
|
|
116
110
|
bbFocusMode = null;
|
|
117
|
-
constructor(_zone, _platform, _elementRef) {
|
|
118
|
-
this._zone = _zone;
|
|
119
|
-
this._platform = _platform;
|
|
120
|
-
this._elementRef = _elementRef;
|
|
121
|
-
}
|
|
122
111
|
get nativeElement() {
|
|
123
112
|
return this._elementRef.nativeElement;
|
|
124
113
|
}
|
|
@@ -146,7 +135,7 @@ class BbFocus {
|
|
|
146
135
|
// Execute the focus method in a timeout.
|
|
147
136
|
setTimeout(() => this.nativeElement.focus(), 0);
|
|
148
137
|
}
|
|
149
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: BbFocus, deps: [
|
|
138
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: BbFocus, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
150
139
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.4", type: BbFocus, isStandalone: true, selector: "[bbFocus]", inputs: { bbFocusMode: "bbFocusMode" }, ngImport: i0 });
|
|
151
140
|
}
|
|
152
141
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: BbFocus, decorators: [{
|
|
@@ -154,13 +143,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImpor
|
|
|
154
143
|
args: [{
|
|
155
144
|
selector: '[bbFocus]'
|
|
156
145
|
}]
|
|
157
|
-
}],
|
|
146
|
+
}], propDecorators: { bbFocusMode: [{
|
|
158
147
|
type: Input
|
|
159
148
|
}] } });
|
|
160
149
|
|
|
161
150
|
class BbFocusTrap {
|
|
162
|
-
|
|
163
|
-
|
|
151
|
+
// Dependencies.
|
|
152
|
+
_platform = inject(Platform);
|
|
153
|
+
_elementRef = inject(ElementRef);
|
|
164
154
|
_focusableElements = [
|
|
165
155
|
'a[href]',
|
|
166
156
|
'area[href]',
|
|
@@ -174,10 +164,6 @@ class BbFocusTrap {
|
|
|
174
164
|
'[contenteditable]',
|
|
175
165
|
'[tabindex]:not([tabindex^="-"])'
|
|
176
166
|
];
|
|
177
|
-
constructor(_platform, _elementRef) {
|
|
178
|
-
this._platform = _platform;
|
|
179
|
-
this._elementRef = _elementRef;
|
|
180
|
-
}
|
|
181
167
|
onKeydown(event) {
|
|
182
168
|
// Validate it is a tab event.
|
|
183
169
|
if (!this.isTabEvent(event)) {
|
|
@@ -221,7 +207,7 @@ class BbFocusTrap {
|
|
|
221
207
|
isTabEvent = (event) => {
|
|
222
208
|
return event?.key === 'Tab' || event?.keyCode === 9;
|
|
223
209
|
};
|
|
224
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: BbFocusTrap, deps: [
|
|
210
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: BbFocusTrap, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
225
211
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.4", type: BbFocusTrap, isStandalone: true, selector: "[bbFocusTrap]", host: { listeners: { "keydown": "onKeydown($event)" } }, ngImport: i0 });
|
|
226
212
|
}
|
|
227
213
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: BbFocusTrap, decorators: [{
|
|
@@ -229,7 +215,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImpor
|
|
|
229
215
|
args: [{
|
|
230
216
|
selector: '[bbFocusTrap]'
|
|
231
217
|
}]
|
|
232
|
-
}],
|
|
218
|
+
}], propDecorators: { onKeydown: [{
|
|
233
219
|
type: HostListener,
|
|
234
220
|
args: ['keydown', ['$event']]
|
|
235
221
|
}] } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bravobit-bb-foundation-utils.mjs","sources":["../../../projects/bb-foundation/utils/src/lib/directives/template.directive.ts","../../../projects/bb-foundation/utils/src/lib/directives/autosize.directive.ts","../../../projects/bb-foundation/utils/src/lib/directives/focus.directive.ts","../../../projects/bb-foundation/utils/src/lib/directives/focus-trap.directive.ts","../../../projects/bb-foundation/utils/src/lib/utils.module.ts","../../../projects/bb-foundation/utils/src/bravobit-bb-foundation-utils.ts"],"sourcesContent":["import {Directive, Input, TemplateRef, ViewContainerRef} from '@angular/core';\n\n@Directive({\n selector: '[bbTemplate]'\n})\nexport class BbTemplate {\n\n @Input() set bbTemplate(content: string | TemplateRef<any>) {\n // Get the template.\n const template = content instanceof TemplateRef\n ? content\n : this._templateRef;\n\n // Clear the view container ref and create the view.\n this._viewContainerRef.clear();\n this._viewContainerRef.createEmbeddedView(template);\n }\n\n constructor(private _templateRef: TemplateRef<any>,\n private _viewContainerRef: ViewContainerRef) {\n }\n\n\n // Required so that the template type checker can infer the type of the coerced inputs.\n static ngAcceptInputType_bbTemplate: string | TemplateRef<any>;\n\n}\n","import {AfterViewInit, Directive, ElementRef, HostBinding, HostListener, Input, numberAttribute, Renderer2} from '@angular/core';\n\n@Directive({\n selector: 'textarea[bbAutosize]'\n})\nexport class BbAutosize implements AfterViewInit {\n\n // Min/max heights for the textarea.\n @Input() @HostBinding('style.min-height') minHeight: string | null = null;\n @Input() @HostBinding('style.max-height') maxHeight: string | null = null;\n @Input({transform: numberAttribute}) @HostBinding('rows') rows: number = 1;\n\n constructor(private _renderer: Renderer2,\n private _elementRef: ElementRef) {\n }\n\n get element() {\n return this._elementRef?.nativeElement as HTMLTextAreaElement;\n }\n\n ngAfterViewInit() {\n // Update the styles after the DOM has loaded.\n this.updateStyles();\n }\n\n @HostListener('window:resize')\n onWindowResize() {\n // Update the styles when the window is resized.\n this.updateStyles();\n }\n\n @HostListener('input')\n onInputReceived() {\n // Update the styles after the textarea received input.\n this.updateStyles();\n }\n\n private updateStyles() {\n // Validate the element exists.\n if (!this.element) {\n return;\n }\n\n // Calculate border height which is not included in the scroll height.\n const borderHeight = this.element?.offsetHeight - this.element?.clientHeight;\n\n // Reset textarea height to auto that correctly calculate the new height.\n this.setHeight('auto');\n\n // Set new height.\n this.setHeight(`${this.element?.scrollHeight + borderHeight}px`);\n }\n\n private setHeight(value: string) {\n this._renderer.setStyle(this.element, 'height', value);\n }\n\n}\n","import {AfterViewInit, Directive, ElementRef, inject, Input, NgZone} from '@angular/core';\nimport {GLOBAL_FOCUS_MODE, FocusMode} from '@bravobit/bb-foundation';\nimport {Platform} from '@angular/cdk/platform';\n\n@Directive({\n selector: '[bbFocus]'\n})\nexport class BbFocus implements AfterViewInit {\n\n // Dependencies.\n private readonly _globalFocusMode: FocusMode = inject(GLOBAL_FOCUS_MODE);\n\n // Inputs.\n @Input() bbFocusMode: FocusMode | null = null;\n\n constructor(private _zone: NgZone,\n private _platform: Platform,\n private _elementRef: ElementRef) {\n }\n\n private get nativeElement() {\n return this._elementRef.nativeElement;\n }\n\n ngAfterViewInit() {\n // Run the method outside the Angular zone.\n this._zone.runOutsideAngular(() => this.focus());\n }\n\n private isMobile() {\n return this._platform.IOS || this._platform.ANDROID;\n }\n\n private focus() {\n const focusMode = this.bbFocusMode ?? this._globalFocusMode;\n if (focusMode === 'only-desktop' && this.isMobile()) {\n return;\n }\n\n // Check if set timeout exists and the user is\n // using the site on desktop devices.\n if (!setTimeout) {\n return;\n }\n\n // Check if the element and the focus method exist, if so focus the element.\n if (!this.nativeElement || !this.nativeElement.focus) {\n return;\n }\n\n // Execute the focus method in a timeout.\n setTimeout(() => this.nativeElement.focus(), 0);\n }\n\n}\n","import {Directive, ElementRef, HostListener} from '@angular/core';\nimport {Platform} from '@angular/cdk/platform';\n\n@Directive({\n selector: '[bbFocusTrap]'\n})\nexport class BbFocusTrap {\n\n private readonly _focusableElements = [\n 'a[href]',\n 'area[href]',\n 'input:not([disabled]):not([type=\"hidden\"]):not([aria-hidden])',\n 'select:not([disabled]):not([aria-hidden])',\n 'textarea:not([disabled]):not([aria-hidden])',\n 'button:not([disabled]):not([aria-hidden])',\n 'iframe',\n 'object',\n 'embed',\n '[contenteditable]',\n '[tabindex]:not([tabindex^=\"-\"])'\n ];\n\n constructor(private _platform: Platform,\n private _elementRef: ElementRef) {\n }\n\n @HostListener('keydown', ['$event'])\n onKeydown(event: KeyboardEvent) {\n // Validate it is a tab event.\n if (!this.isTabEvent(event)) {\n return;\n }\n\n // Trap the focus inside the element.\n return this.trapFocus(event);\n }\n\n trapFocus(event: KeyboardEvent) {\n // Validate that the DOM is available.\n if (!this._platform.isBrowser) {\n return;\n }\n\n // Get all focusable nodes.\n const focusableNodes = this.getFocusableNodes();\n\n // Focus the first available element if the focus\n // is not in the modal.\n if (!this.element.contains(document.activeElement)) {\n return this.focus(focusableNodes[0]);\n }\n\n const focusedItemIndex = focusableNodes.indexOf(document.activeElement);\n\n if (event.shiftKey && focusedItemIndex === 0) {\n this.focus(focusableNodes[focusableNodes.length - 1]);\n return event.preventDefault();\n }\n\n if (!event.shiftKey && focusedItemIndex === focusableNodes.length - 1) {\n this.focus(focusableNodes[0]);\n return event.preventDefault();\n }\n }\n\n private get element() {\n return this._elementRef.nativeElement;\n }\n\n private getFocusableNodes() {\n const nodes = this.element.querySelectorAll(this._focusableElements);\n return Array(...nodes);\n }\n\n private focus = (element: HTMLElement) => {\n return element && element.focus && element.focus();\n };\n\n private isTabEvent = (event: KeyboardEvent) => {\n return event?.key === 'Tab' || event?.keyCode === 9;\n };\n\n}\n","import {BbFocusTrap} from './directives/focus-trap.directive';\nimport {BbTemplate} from './directives/template.directive';\nimport {BbAutosize} from './directives/autosize.directive';\nimport {BbFocus} from './directives/focus.directive';\nimport {NgModule} from '@angular/core';\n\n@NgModule({\n imports: [\n BbTemplate,\n BbAutosize,\n BbFocus,\n BbFocusTrap\n ],\n exports: [\n BbTemplate,\n BbAutosize,\n BbFocus,\n BbFocusTrap\n ]\n})\nexport class UtilsModule {\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;MAKa,UAAU,CAAA;AAaC,IAAA,YAAA;AACA,IAAA,iBAAA;IAZpB,IAAa,UAAU,CAAC,OAAkC,EAAA;;AAEtD,QAAA,MAAM,QAAQ,GAAG,OAAO,YAAY;AAChC,cAAE;AACF,cAAE,IAAI,CAAC,YAAY;;AAGvB,QAAA,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE;AAC9B,QAAA,IAAI,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,QAAQ,CAAC;;IAGvD,WAAoB,CAAA,YAA8B,EAC9B,iBAAmC,EAAA;QADnC,IAAY,CAAA,YAAA,GAAZ,YAAY;QACZ,IAAiB,CAAA,iBAAA,GAAjB,iBAAiB;;;IAKrC,OAAO,4BAA4B;uGAnB1B,UAAU,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,WAAA,EAAA,EAAA,EAAA,KAAA,EAAA,EAAA,CAAA,gBAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAAV,UAAU,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,cAAA,EAAA,MAAA,EAAA,EAAA,UAAA,EAAA,YAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAV,UAAU,EAAA,UAAA,EAAA,CAAA;kBAHtB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE;AACb,iBAAA;+GAGgB,UAAU,EAAA,CAAA;sBAAtB;;;MCFQ,UAAU,CAAA;AAOC,IAAA,SAAA;AACA,IAAA,WAAA;;IALsB,SAAS,GAAkB,IAAI;IAC/B,SAAS,GAAkB,IAAI;IACf,IAAI,GAAW,C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X,UAAU;YACV,UAAU;YACV,OAAO;YACP,WAAW,CAAA,EAAA,CAAA;wGAGN,WAAW,EAAA,CAAA;;2FAAX,WAAW,EAAA,UAAA,EAAA,CAAA;kBAdvB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE;wBACL,UAAU;wBACV,UAAU;wBACV,OAAO;wBACP;AACH,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACL,UAAU;wBACV,UAAU;wBACV,OAAO;wBACP;AACH;AACJ,iBAAA;;;ACnBD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"bravobit-bb-foundation-utils.mjs","sources":["../../../projects/bb-foundation/utils/src/lib/directives/template.directive.ts","../../../projects/bb-foundation/utils/src/lib/directives/autosize.directive.ts","../../../projects/bb-foundation/utils/src/lib/directives/focus.directive.ts","../../../projects/bb-foundation/utils/src/lib/directives/focus-trap.directive.ts","../../../projects/bb-foundation/utils/src/lib/utils.module.ts","../../../projects/bb-foundation/utils/src/bravobit-bb-foundation-utils.ts"],"sourcesContent":["import {Directive, inject, Input, TemplateRef, ViewContainerRef} from '@angular/core';\n\n@Directive({\n selector: '[bbTemplate]'\n})\nexport class BbTemplate {\n\n // Dependencies.\n private readonly _templateRef: TemplateRef<any> = inject(TemplateRef);\n private readonly _viewContainerRef: ViewContainerRef = inject(ViewContainerRef);\n\n @Input() set bbTemplate(content: string | TemplateRef<any>) {\n // Get the template.\n const template = content instanceof TemplateRef\n ? content\n : this._templateRef;\n\n // Clear the view container ref and create the view.\n this._viewContainerRef.clear();\n this._viewContainerRef.createEmbeddedView(template);\n }\n\n // Required so that the template type checker can infer the type of the coerced inputs.\n static ngAcceptInputType_bbTemplate: string | TemplateRef<any>;\n\n}\n","import {AfterViewInit, Directive, ElementRef, HostBinding, HostListener, inject, Input, numberAttribute, Renderer2} from '@angular/core';\n\n@Directive({\n selector: 'textarea[bbAutosize]'\n})\nexport class BbAutosize implements AfterViewInit {\n\n // Dependencies.\n private readonly _renderer: Renderer2 = inject(Renderer2);\n private readonly _elementRef: ElementRef = inject(ElementRef);\n\n // Min/max heights for the textarea.\n @Input() @HostBinding('style.min-height') minHeight: string | null = null;\n @Input() @HostBinding('style.max-height') maxHeight: string | null = null;\n @Input({transform: numberAttribute}) @HostBinding('rows') rows: number = 1;\n\n get element() {\n return this._elementRef?.nativeElement as HTMLTextAreaElement;\n }\n\n ngAfterViewInit() {\n // Update the styles after the DOM has loaded.\n this.updateStyles();\n }\n\n @HostListener('window:resize')\n onWindowResize() {\n // Update the styles when the window is resized.\n this.updateStyles();\n }\n\n @HostListener('input')\n onInputReceived() {\n // Update the styles after the textarea received input.\n this.updateStyles();\n }\n\n private updateStyles() {\n // Validate the element exists.\n if (!this.element) {\n return;\n }\n\n // Calculate border height which is not included in the scroll height.\n const borderHeight = this.element?.offsetHeight - this.element?.clientHeight;\n\n // Reset textarea height to auto that correctly calculate the new height.\n this.setHeight('auto');\n\n // Set new height.\n this.setHeight(`${this.element?.scrollHeight + borderHeight}px`);\n }\n\n private setHeight(value: string) {\n this._renderer.setStyle(this.element, 'height', value);\n }\n\n}\n","import {AfterViewInit, Directive, ElementRef, inject, Input, NgZone} from '@angular/core';\nimport {GLOBAL_FOCUS_MODE, FocusMode} from '@bravobit/bb-foundation';\nimport {Platform} from '@angular/cdk/platform';\n\n@Directive({\n selector: '[bbFocus]'\n})\nexport class BbFocus implements AfterViewInit {\n\n // Dependencies.\n private readonly _zone: NgZone = inject(NgZone);\n private readonly _platform: Platform = inject(Platform);\n private readonly _elementRef: ElementRef = inject(ElementRef);\n private readonly _globalFocusMode: FocusMode = inject(GLOBAL_FOCUS_MODE);\n\n // Inputs.\n @Input() bbFocusMode: FocusMode | null = null;\n\n private get nativeElement() {\n return this._elementRef.nativeElement;\n }\n\n ngAfterViewInit() {\n // Run the method outside the Angular zone.\n this._zone.runOutsideAngular(() => this.focus());\n }\n\n private isMobile() {\n return this._platform.IOS || this._platform.ANDROID;\n }\n\n private focus() {\n const focusMode = this.bbFocusMode ?? this._globalFocusMode;\n if (focusMode === 'only-desktop' && this.isMobile()) {\n return;\n }\n\n // Check if set timeout exists and the user is\n // using the site on desktop devices.\n if (!setTimeout) {\n return;\n }\n\n // Check if the element and the focus method exist, if so focus the element.\n if (!this.nativeElement || !this.nativeElement.focus) {\n return;\n }\n\n // Execute the focus method in a timeout.\n setTimeout(() => this.nativeElement.focus(), 0);\n }\n\n}\n","import {Directive, ElementRef, HostListener, inject} from '@angular/core';\nimport {Platform} from '@angular/cdk/platform';\n\n@Directive({\n selector: '[bbFocusTrap]'\n})\nexport class BbFocusTrap {\n\n // Dependencies.\n private readonly _platform: Platform = inject(Platform);\n private readonly _elementRef: ElementRef = inject(ElementRef);\n\n private readonly _focusableElements = [\n 'a[href]',\n 'area[href]',\n 'input:not([disabled]):not([type=\"hidden\"]):not([aria-hidden])',\n 'select:not([disabled]):not([aria-hidden])',\n 'textarea:not([disabled]):not([aria-hidden])',\n 'button:not([disabled]):not([aria-hidden])',\n 'iframe',\n 'object',\n 'embed',\n '[contenteditable]',\n '[tabindex]:not([tabindex^=\"-\"])'\n ];\n\n @HostListener('keydown', ['$event'])\n onKeydown(event: KeyboardEvent) {\n // Validate it is a tab event.\n if (!this.isTabEvent(event)) {\n return;\n }\n\n // Trap the focus inside the element.\n return this.trapFocus(event);\n }\n\n trapFocus(event: KeyboardEvent) {\n // Validate that the DOM is available.\n if (!this._platform.isBrowser) {\n return;\n }\n\n // Get all focusable nodes.\n const focusableNodes = this.getFocusableNodes();\n\n // Focus the first available element if the focus\n // is not in the modal.\n if (!this.element.contains(document.activeElement)) {\n return this.focus(focusableNodes[0]);\n }\n\n const focusedItemIndex = focusableNodes.indexOf(document.activeElement);\n\n if (event.shiftKey && focusedItemIndex === 0) {\n this.focus(focusableNodes[focusableNodes.length - 1]);\n return event.preventDefault();\n }\n\n if (!event.shiftKey && focusedItemIndex === focusableNodes.length - 1) {\n this.focus(focusableNodes[0]);\n return event.preventDefault();\n }\n }\n\n private get element() {\n return this._elementRef.nativeElement;\n }\n\n private getFocusableNodes() {\n const nodes = this.element.querySelectorAll(this._focusableElements);\n return Array(...nodes);\n }\n\n private focus = (element: HTMLElement) => {\n return element && element.focus && element.focus();\n };\n\n private isTabEvent = (event: KeyboardEvent) => {\n return event?.key === 'Tab' || event?.keyCode === 9;\n };\n\n}\n","import {BbFocusTrap} from './directives/focus-trap.directive';\nimport {BbTemplate} from './directives/template.directive';\nimport {BbAutosize} from './directives/autosize.directive';\nimport {BbFocus} from './directives/focus.directive';\nimport {NgModule} from '@angular/core';\n\n@NgModule({\n imports: [\n BbTemplate,\n BbAutosize,\n BbFocus,\n BbFocusTrap\n ],\n exports: [\n BbTemplate,\n BbAutosize,\n BbFocus,\n BbFocusTrap\n ]\n})\nexport class UtilsModule {\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;MAKa,UAAU,CAAA;;AAGF,IAAA,YAAY,GAAqB,MAAM,CAAC,WAAW,CAAC;AACpD,IAAA,iBAAiB,GAAqB,MAAM,CAAC,gBAAgB,CAAC;IAE/E,IAAa,UAAU,CAAC,OAAkC,EAAA;;AAEtD,QAAA,MAAM,QAAQ,GAAG,OAAO,YAAY;AAChC,cAAE;AACF,cAAE,IAAI,CAAC,YAAY;;AAGvB,QAAA,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE;AAC9B,QAAA,IAAI,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,QAAQ,CAAC;;;IAIvD,OAAO,4BAA4B;uGAlB1B,UAAU,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAAV,UAAU,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,cAAA,EAAA,MAAA,EAAA,EAAA,UAAA,EAAA,YAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAV,UAAU,EAAA,UAAA,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AE;wBACL,UAAU;wBACV,UAAU;wBACV,OAAO;wBACP;AACH;AACJ,iBAAA;;;ACnBD;;AAEG;;;;"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable,
|
|
3
|
-
import * as i1 from '@angular/cdk/platform';
|
|
2
|
+
import { Injectable, inject, InjectionToken, RendererFactory2, makeEnvironmentProviders } from '@angular/core';
|
|
4
3
|
import { Platform } from '@angular/cdk/platform';
|
|
5
4
|
import { DOCUMENT, formatDate } from '@angular/common';
|
|
6
5
|
import { map, distinctUntilChanged, shareReplay, debounceTime, startWith } from 'rxjs/operators';
|
|
@@ -90,12 +89,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImpor
|
|
|
90
89
|
}] });
|
|
91
90
|
|
|
92
91
|
class Exif {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
this._platform = _platform;
|
|
97
|
-
this._fileLoader = _fileLoader;
|
|
98
|
-
}
|
|
92
|
+
// Dependencies.
|
|
93
|
+
_platform = inject(Platform);
|
|
94
|
+
_fileLoader = inject(FileLoader);
|
|
99
95
|
async strip(file, quality = 100) {
|
|
100
96
|
// Validate we are on a browser.
|
|
101
97
|
if (!this._platform.isBrowser) {
|
|
@@ -240,7 +236,7 @@ class Exif {
|
|
|
240
236
|
}
|
|
241
237
|
return -1;
|
|
242
238
|
};
|
|
243
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: Exif, deps: [
|
|
239
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: Exif, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
244
240
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: Exif, providedIn: 'root' });
|
|
245
241
|
}
|
|
246
242
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: Exif, decorators: [{
|
|
@@ -248,19 +244,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImpor
|
|
|
248
244
|
args: [{
|
|
249
245
|
providedIn: 'root'
|
|
250
246
|
}]
|
|
251
|
-
}]
|
|
247
|
+
}] });
|
|
252
248
|
|
|
253
249
|
class ImageConverter {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
250
|
+
// Dependencies.
|
|
251
|
+
_exif = inject(Exif);
|
|
252
|
+
_platform = inject(Platform);
|
|
253
|
+
_fileLoader = inject(FileLoader);
|
|
257
254
|
// Data.
|
|
258
255
|
_types = ['image/png', 'image/jpeg', 'image/webp'];
|
|
259
|
-
constructor(_exif, _platform, _fileLoader) {
|
|
260
|
-
this._exif = _exif;
|
|
261
|
-
this._platform = _platform;
|
|
262
|
-
this._fileLoader = _fileLoader;
|
|
263
|
-
}
|
|
264
256
|
async toDataUri(contents, options = null) {
|
|
265
257
|
// Check if the current platform is a browser.
|
|
266
258
|
if (!this._platform.isBrowser) {
|
|
@@ -361,7 +353,7 @@ class ImageConverter {
|
|
|
361
353
|
}
|
|
362
354
|
return { xOffset, yOffset, width, height };
|
|
363
355
|
};
|
|
364
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: ImageConverter, deps: [
|
|
356
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: ImageConverter, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
365
357
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: ImageConverter, providedIn: 'root' });
|
|
366
358
|
}
|
|
367
359
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: ImageConverter, decorators: [{
|
|
@@ -369,7 +361,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImpor
|
|
|
369
361
|
args: [{
|
|
370
362
|
providedIn: 'root'
|
|
371
363
|
}]
|
|
372
|
-
}]
|
|
364
|
+
}] });
|
|
373
365
|
|
|
374
366
|
const WINDOW = new InjectionToken('An abstraction over global window object', {
|
|
375
367
|
factory: () => {
|
|
@@ -458,11 +450,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImpor
|
|
|
458
450
|
const ACCEPT_LANGUAGE = new InjectionToken('AcceptLanguage');
|
|
459
451
|
|
|
460
452
|
class Languages {
|
|
461
|
-
|
|
453
|
+
// Dependencies.
|
|
454
|
+
_acceptLanguage = inject(ACCEPT_LANGUAGE, { optional: true });
|
|
462
455
|
// Data.
|
|
463
456
|
_data = [];
|
|
464
|
-
constructor(
|
|
465
|
-
this._acceptLanguage = _acceptLanguage;
|
|
457
|
+
constructor() {
|
|
466
458
|
this._data = this.initialize();
|
|
467
459
|
}
|
|
468
460
|
get all() {
|
|
@@ -514,7 +506,7 @@ class Languages {
|
|
|
514
506
|
? data
|
|
515
507
|
: data.join(';');
|
|
516
508
|
};
|
|
517
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: Languages, deps: [
|
|
509
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: Languages, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
518
510
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: Languages, providedIn: 'root' });
|
|
519
511
|
}
|
|
520
512
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: Languages, decorators: [{
|
|
@@ -522,27 +514,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImpor
|
|
|
522
514
|
args: [{
|
|
523
515
|
providedIn: 'root'
|
|
524
516
|
}]
|
|
525
|
-
}], ctorParameters: () => [
|
|
526
|
-
type: Optional
|
|
527
|
-
}, {
|
|
528
|
-
type: Inject,
|
|
529
|
-
args: [ACCEPT_LANGUAGE]
|
|
530
|
-
}] }] });
|
|
517
|
+
}], ctorParameters: () => [] });
|
|
531
518
|
|
|
532
519
|
const NAVIGATOR = new InjectionToken('An abstraction over window.navigator object', {
|
|
533
520
|
factory: () => inject(WINDOW).navigator
|
|
534
521
|
});
|
|
535
522
|
|
|
536
523
|
class Network {
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
524
|
+
// Dependencies.
|
|
525
|
+
_platform = inject(Platform);
|
|
526
|
+
_window = inject(WINDOW, { optional: true });
|
|
527
|
+
_navigator = inject(NAVIGATOR, { optional: true });
|
|
540
528
|
// Data.
|
|
541
529
|
_online$ = of(true);
|
|
542
|
-
constructor(
|
|
543
|
-
this._platform = _platform;
|
|
544
|
-
this._window = _window;
|
|
545
|
-
this._navigator = _navigator;
|
|
530
|
+
constructor() {
|
|
546
531
|
this.getOnlineObservable();
|
|
547
532
|
}
|
|
548
533
|
online() {
|
|
@@ -564,7 +549,7 @@ class Network {
|
|
|
564
549
|
// a user is online/offline.
|
|
565
550
|
this._online$ = merge(now$, online$, offline$).pipe(distinctUntilChanged(), shareReplay({ refCount: true, bufferSize: 1 }));
|
|
566
551
|
}
|
|
567
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: Network, deps: [
|
|
552
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: Network, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
568
553
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: Network, providedIn: 'root' });
|
|
569
554
|
}
|
|
570
555
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: Network, decorators: [{
|
|
@@ -572,30 +557,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImpor
|
|
|
572
557
|
args: [{
|
|
573
558
|
providedIn: 'root'
|
|
574
559
|
}]
|
|
575
|
-
}], ctorParameters: () => [
|
|
576
|
-
type: Optional
|
|
577
|
-
}, {
|
|
578
|
-
type: Inject,
|
|
579
|
-
args: [WINDOW]
|
|
580
|
-
}] }, { type: Navigator, decorators: [{
|
|
581
|
-
type: Optional
|
|
582
|
-
}, {
|
|
583
|
-
type: Inject,
|
|
584
|
-
args: [NAVIGATOR]
|
|
585
|
-
}] }] });
|
|
560
|
+
}], ctorParameters: () => [] });
|
|
586
561
|
|
|
587
562
|
class Patch {
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
563
|
+
// Dependencies.
|
|
564
|
+
_platform = inject(Platform);
|
|
565
|
+
_window = inject(WINDOW, { optional: true });
|
|
566
|
+
_document = inject(DOCUMENT, { optional: true });
|
|
567
|
+
// State.
|
|
591
568
|
_hasPatchedMobileVerticalHeight = false;
|
|
592
569
|
// Subscriptions.
|
|
593
570
|
_subscription = new Subscription();
|
|
594
|
-
constructor(_platform, _window, _document) {
|
|
595
|
-
this._platform = _platform;
|
|
596
|
-
this._window = _window;
|
|
597
|
-
this._document = _document;
|
|
598
|
-
}
|
|
599
571
|
mobileVerticalHeight() {
|
|
600
572
|
// Check if the user has already patched
|
|
601
573
|
// the mobile vertical height.
|
|
@@ -623,7 +595,7 @@ class Patch {
|
|
|
623
595
|
// Save the subscription so we can destroy it later.
|
|
624
596
|
this._subscription.add(subscription);
|
|
625
597
|
}
|
|
626
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: Patch, deps: [
|
|
598
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: Patch, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
627
599
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: Patch, providedIn: 'root' });
|
|
628
600
|
}
|
|
629
601
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: Patch, decorators: [{
|
|
@@ -631,17 +603,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImpor
|
|
|
631
603
|
args: [{
|
|
632
604
|
providedIn: 'root'
|
|
633
605
|
}]
|
|
634
|
-
}]
|
|
635
|
-
type: Optional
|
|
636
|
-
}, {
|
|
637
|
-
type: Inject,
|
|
638
|
-
args: [WINDOW]
|
|
639
|
-
}] }, { type: Document, decorators: [{
|
|
640
|
-
type: Optional
|
|
641
|
-
}, {
|
|
642
|
-
type: Inject,
|
|
643
|
-
args: [DOCUMENT]
|
|
644
|
-
}] }] });
|
|
606
|
+
}] });
|
|
645
607
|
|
|
646
608
|
const BASE_URL = new InjectionToken('BaseUrl');
|
|
647
609
|
|