@bravobit/bb-foundation 0.42.0 → 0.42.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/auth/lib/auth.interceptor.d.ts +3 -6
- package/dialog/lib/dialog-confirm/dialog-confirm.component.d.ts +2 -5
- package/dialog/lib/dialog-container/dialog-container.component.d.ts +4 -6
- package/dialog/lib/dialog-overlay/dialog-overlay.component.d.ts +5 -7
- package/esm2022/auth/lib/auth.interceptor.mjs +36 -42
- package/esm2022/auth/lib/auth.module.mjs +4 -4
- package/esm2022/auth/lib/auth.service.mjs +18 -7
- package/esm2022/auth/lib/auth.session.mjs +26 -22
- package/esm2022/auth/lib/directives/authenticated.directive.mjs +16 -12
- package/esm2022/auth/lib/helpers/jwt.helper.mjs +29 -31
- package/esm2022/auth/lib/providers/email.provider.mjs +4 -1
- package/esm2022/auth/lib/providers/verify.provider.mjs +4 -1
- package/esm2022/collections/lib/collection.mjs +17 -7
- package/esm2022/collections/lib/collections.module.mjs +6 -6
- package/esm2022/collections/lib/components/collections-actions/collections-actions.component.mjs +7 -9
- package/esm2022/collections/lib/components/collections-grid/collections-grid.component.mjs +11 -11
- package/esm2022/collections/lib/components/collections-pager/collections-pager.component.mjs +10 -10
- package/esm2022/collections/lib/components/collections-table/collections-table.component.mjs +16 -16
- package/esm2022/collections/lib/components/collections-table-label/collections-table-label.component.mjs +9 -11
- package/esm2022/collections/lib/components/collections-table-sorting/collections-table-sorting.component.mjs +12 -9
- package/esm2022/collections/lib/components/collections-viewer/collections-viewer.component.mjs +10 -7
- package/esm2022/collections/lib/directives/collections-data-row.directive.mjs +6 -3
- package/esm2022/collections/lib/directives/collections-data.directive.mjs +6 -3
- package/esm2022/collections/lib/directives/collections-empty.directive.mjs +6 -3
- package/esm2022/collections/lib/directives/collections-error.directive.mjs +6 -3
- package/esm2022/collections/lib/directives/collections-initial.directive.mjs +4 -3
- package/esm2022/collections/lib/directives/collections-item.directive.mjs +6 -3
- package/esm2022/collections/lib/providers/api-collection.provider.mjs +6 -4
- package/esm2022/collections/lib/providers/local-collection.provider.mjs +2 -2
- package/esm2022/combobox/combobox/combobox-container.directive.mjs +12 -7
- package/esm2022/combobox/combobox/combobox.component.mjs +23 -20
- package/esm2022/combobox/combobox-label.directive.mjs +3 -3
- package/esm2022/combobox/combobox-option.directive.mjs +3 -3
- package/esm2022/combobox/combobox-panel/combobox-panel.component.mjs +10 -6
- package/esm2022/dashboard/lib/dashboard/dashboard.component.mjs +13 -13
- package/esm2022/dashboard/lib/dashboard-header/dashboard-header.component.mjs +5 -7
- package/esm2022/dashboard/lib/dashboard-menu/dashboard-menu.component.mjs +8 -10
- package/esm2022/dashboard/lib/dashboard-menu-item/dashboard-menu-item.component.mjs +5 -7
- package/esm2022/dashboard/lib/dashboard-sidebar/dashboard-sidebar.component.mjs +12 -13
- package/esm2022/dashboard/lib/dashboard-sidebar-group/dashboard-sidebar-group.component.mjs +13 -12
- package/esm2022/dashboard/lib/dashboard-sidebar-item/dashboard-sidebar-item.component.mjs +7 -5
- package/esm2022/dashboard/lib/dashboard.module.mjs +5 -5
- package/esm2022/dialog/lib/dialog-actions/dialog-actions.component.mjs +3 -3
- package/esm2022/dialog/lib/dialog-confirm/dialog-confirm.component.mjs +21 -20
- package/esm2022/dialog/lib/dialog-container/dialog-container.component.mjs +19 -24
- package/esm2022/dialog/lib/dialog-header/dialog-header.component.mjs +5 -7
- package/esm2022/dialog/lib/dialog-link/dialog-link.component.mjs +3 -3
- package/esm2022/dialog/lib/dialog-modal/dialog-modal.component.mjs +9 -6
- package/esm2022/dialog/lib/dialog-overlay/dialog-overlay.component.mjs +19 -26
- package/esm2022/dialog/lib/dialog.insertion.mjs +4 -3
- package/esm2022/dialog/lib/dialog.interfaces.mjs +4 -1
- package/esm2022/dialog/lib/dialog.module.mjs +6 -6
- package/esm2022/dialog/lib/dialog.ref.mjs +4 -6
- package/esm2022/dialog/lib/dialog.service.mjs +5 -3
- package/esm2022/dialog/lib/directives/confirm.directive.mjs +12 -14
- package/esm2022/elements/lib/avatar/avatar.component.mjs +75 -77
- package/esm2022/elements/lib/button/button.component.mjs +12 -10
- package/esm2022/elements/lib/checkbox/checkbox.component.mjs +21 -17
- package/esm2022/elements/lib/checkbox-group/checkbox-group.component.mjs +8 -10
- package/esm2022/elements/lib/date-picker/date-picker.component.mjs +82 -76
- package/esm2022/elements/lib/directives/addon.directive.mjs +5 -5
- package/esm2022/elements/lib/directives/extra-error-controls.directive.mjs +7 -9
- package/esm2022/elements/lib/directives/form-submit.directive.mjs +6 -3
- package/esm2022/elements/lib/directives/form-submitter.directive.mjs +5 -7
- package/esm2022/elements/lib/directives/image-upload.directive.mjs +14 -11
- package/esm2022/elements/lib/directives/input.directive.mjs +6 -4
- package/esm2022/elements/lib/elements.module.mjs +6 -6
- package/esm2022/elements/lib/file-picker/file-picker.component.mjs +52 -51
- package/esm2022/elements/lib/form-control/form-control.component.mjs +14 -14
- package/esm2022/elements/lib/form-error/form-error.component.mjs +16 -8
- package/esm2022/elements/lib/form-group/form-group.component.mjs +5 -7
- package/esm2022/elements/lib/icon/icon.component.mjs +14 -13
- package/esm2022/elements/lib/image-picker/image-picker.component.mjs +20 -17
- package/esm2022/elements/lib/multi-file-control/multi-file-control.component.mjs +28 -24
- package/esm2022/elements/lib/pipes/date.pipe.mjs +6 -8
- package/esm2022/elements/lib/pipes/file-image.pipe.mjs +6 -3
- package/esm2022/elements/lib/pipes/file-size.pipe.mjs +13 -15
- package/esm2022/elements/lib/pipes/relative-time.pipe.mjs +37 -35
- package/esm2022/elements/lib/radio-button/radio-button.component.mjs +8 -7
- package/esm2022/elements/lib/radio-group/radio-group.component.mjs +21 -20
- package/esm2022/elements/lib/spinner/spinner.component.mjs +7 -9
- package/esm2022/http/lib/classes/http.config.mjs +19 -15
- package/esm2022/http/lib/http.interfaces.mjs +1 -1
- package/esm2022/http/lib/http.module.mjs +5 -4
- package/esm2022/http/lib/interceptors/base-url.interceptor.mjs +12 -20
- package/esm2022/http/lib/interceptors/error.interceptor.mjs +9 -14
- package/esm2022/lib/core/services/exif.service.mjs +102 -100
- package/esm2022/lib/core/services/file-loader.service.mjs +15 -17
- package/esm2022/lib/core/services/files.service.mjs +7 -3
- package/esm2022/lib/core/services/image-converter.service.mjs +33 -30
- package/esm2022/lib/core/services/languages.service.mjs +25 -24
- package/esm2022/lib/core/services/network.service.mjs +8 -5
- package/esm2022/lib/core/services/patch.service.mjs +9 -6
- package/esm2022/localize/lib/dictionary/dictionary.class.mjs +7 -1
- package/esm2022/localize/lib/dictionary/dictionary.context.mjs +2 -4
- package/esm2022/localize/lib/dictionary/dictionary.data.mjs +2 -1
- package/esm2022/localize/lib/handlers/missing.handler.mjs +2 -4
- package/esm2022/localize/lib/localize.module.mjs +5 -5
- package/esm2022/localize/lib/localize.pipe.mjs +4 -3
- package/esm2022/localize/lib/localize.service.mjs +30 -21
- package/esm2022/localize/lib/transforms/interpolate.transform.mjs +5 -1
- package/esm2022/localize/lib/transforms/plural.transform.mjs +6 -4
- package/esm2022/localize/lib/transforms/reference.transform.mjs +3 -1
- package/esm2022/localize/lib/views/localize-string/localize-string.component.mjs +14 -11
- package/esm2022/localize/lib/views/localize-template.directive.mjs +6 -5
- package/esm2022/masking/lib/directives/currency-mask.directive.mjs +11 -6
- package/esm2022/masking/lib/directives/date-mask.directive.mjs +11 -6
- package/esm2022/masking/lib/directives/input-mask.directive.mjs +21 -14
- package/esm2022/masking/lib/masking.module.mjs +5 -5
- package/esm2022/masking/lib/masking.service.mjs +4 -3
- package/esm2022/notifications/lib/notifications-item/notifications-item.component.mjs +50 -36
- package/esm2022/notifications/lib/notifications-list/notifications-list.component.mjs +8 -7
- package/esm2022/notifications/lib/notifications.interfaces.mjs +10 -1
- package/esm2022/notifications/lib/notifications.module.mjs +4 -4
- package/esm2022/notifications/lib/notifications.service.mjs +24 -10
- package/esm2022/permissions/lib/directives/permission.directive.mjs +20 -14
- package/esm2022/permissions/lib/handlers/local.handler.mjs +3 -1
- package/esm2022/permissions/lib/permissions.interface.mjs +4 -1
- package/esm2022/permissions/lib/permissions.module.mjs +4 -4
- package/esm2022/permissions/lib/permissions.service.mjs +8 -7
- package/esm2022/recaptcha/lib/recaptcha/recaptcha.component.mjs +34 -27
- package/esm2022/recaptcha/lib/recaptcha-loader.service.mjs +15 -15
- package/esm2022/recaptcha/lib/recaptcha.module.mjs +4 -4
- package/esm2022/select/lib/select/select.component.mjs +52 -47
- package/esm2022/select/lib/select-label.directive.mjs +4 -3
- package/esm2022/select/lib/select-multi-label.directive.mjs +4 -3
- package/esm2022/select/lib/select-option-group.directive.mjs +4 -3
- package/esm2022/select/lib/select-option.directive.mjs +4 -3
- package/esm2022/select/lib/select.module.mjs +5 -5
- package/esm2022/storage/lib/storage.service.mjs +25 -21
- package/esm2022/storage/lib/strategies/cookie-storage.strategy.mjs +66 -64
- package/esm2022/storage/lib/strategies/memory-storage.strategy.mjs +16 -18
- package/esm2022/storage/lib/strategies/polyfill-storage.strategy.mjs +31 -30
- package/esm2022/table/lib/components/table/table.component.mjs +30 -20
- package/esm2022/table/lib/components/table-cell/table-cell.component.mjs +3 -3
- package/esm2022/table/lib/components/table-header-cell/table-header-cell.component.mjs +15 -11
- package/esm2022/table/lib/components/table-pager/table-pager.component.mjs +18 -16
- package/esm2022/table/lib/data/datasource.data.mjs +4 -6
- package/esm2022/table/lib/data/generic.data.mjs +38 -36
- package/esm2022/table/lib/table.module.mjs +6 -6
- package/esm2022/tooltip/lib/tooltip-container/tooltip-container.component.mjs +5 -7
- package/esm2022/tooltip/lib/tooltip.directive.mjs +15 -15
- package/esm2022/tooltip/lib/tooltip.module.mjs +4 -4
- package/esm2022/utils/lib/directives/autosize.directive.mjs +9 -7
- package/esm2022/utils/lib/directives/focus-trap.directive.mjs +24 -22
- package/esm2022/utils/lib/directives/focus.directive.mjs +8 -5
- package/esm2022/utils/lib/directives/template.directive.mjs +7 -3
- package/esm2022/utils/lib/utils.module.mjs +5 -5
- package/fesm2022/bravobit-bb-foundation-auth.mjs +127 -110
- package/fesm2022/bravobit-bb-foundation-auth.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-collections.mjs +123 -93
- package/fesm2022/bravobit-bb-foundation-collections.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-combobox.mjs +46 -34
- package/fesm2022/bravobit-bb-foundation-combobox.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-dashboard.mjs +60 -64
- package/fesm2022/bravobit-bb-foundation-dashboard.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-dialog.mjs +97 -103
- package/fesm2022/bravobit-bb-foundation-dialog.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-elements.mjs +468 -440
- package/fesm2022/bravobit-bb-foundation-elements.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-http.mjs +40 -46
- package/fesm2022/bravobit-bb-foundation-http.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-localize.mjs +74 -49
- package/fesm2022/bravobit-bb-foundation-localize.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-masking.mjs +47 -29
- package/fesm2022/bravobit-bb-foundation-masking.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-notifications.mjs +91 -53
- package/fesm2022/bravobit-bb-foundation-notifications.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-permissions.mjs +34 -22
- package/fesm2022/bravobit-bb-foundation-permissions.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-recaptcha.mjs +50 -43
- package/fesm2022/bravobit-bb-foundation-recaptcha.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-select.mjs +67 -58
- package/fesm2022/bravobit-bb-foundation-select.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-storage.mjs +134 -129
- package/fesm2022/bravobit-bb-foundation-storage.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-table.mjs +107 -91
- package/fesm2022/bravobit-bb-foundation-table.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-tooltip.mjs +21 -23
- package/fesm2022/bravobit-bb-foundation-tooltip.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation-utils.mjs +48 -37
- package/fesm2022/bravobit-bb-foundation-utils.mjs.map +1 -1
- package/fesm2022/bravobit-bb-foundation.mjs +192 -178
- package/fesm2022/bravobit-bb-foundation.mjs.map +1 -1
- package/http/lib/http.interfaces.d.ts +2 -1
- package/http/lib/interceptors/base-url.interceptor.d.ts +2 -4
- package/http/lib/interceptors/error.interceptor.d.ts +1 -3
- package/package.json +13 -13
|
@@ -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 standalone: true\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 standalone: true\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, booleanAttribute, Directive, ElementRef, Input, NgZone} from '@angular/core';\nimport {Platform} from '@angular/cdk/platform';\n\n@Directive({\n selector: '[bbFocus]',\n standalone: true\n})\nexport class BbFocus implements AfterViewInit {\n\n // Inputs.\n @Input({transform: booleanAttribute}) bbFocusOnlyDesktop: boolean = false;\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 if (this.bbFocusOnlyDesktop && 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 standalone: true\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":";;;;MAMa,UAAU,CAAA;IAEnB,IAAa,UAAU,CAAC,OAAkC,EAAA;;AAEtD,QAAA,MAAM,QAAQ,GAAG,OAAO,YAAY,WAAW;AAC3C,cAAE,OAAO;AACT,cAAE,IAAI,CAAC,YAAY,CAAC;;AAGxB,QAAA,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;AAC/B,QAAA,IAAI,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;KACvD;IAED,WAAoB,CAAA,YAA8B,EAC9B,iBAAmC,EAAA;QADnC,IAAY,CAAA,YAAA,GAAZ,YAAY,CAAkB;QAC9B,IAAiB,CAAA,iBAAA,GAAjB,iBAAiB,CAAkB;KACtD;8GAfQ,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,CAAA,EAAA;kGAAV,UAAU,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,cAAA,EAAA,MAAA,EAAA,EAAA,UAAA,EAAA,YAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA;;2FAAV,UAAU,EAAA,UAAA,EAAA,CAAA;kBAJtB,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,UAAU;wBACV,OAAO;wBACP,WAAW;AACd,qBAAA;AACJ,iBAAA,CAAA;;;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, Input, TemplateRef, ViewContainerRef} from '@angular/core';\n\n@Directive({\n selector: '[bbTemplate]',\n standalone: true\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 standalone: true\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, booleanAttribute, Directive, ElementRef, Input, NgZone} from '@angular/core';\nimport {Platform} from '@angular/cdk/platform';\n\n@Directive({\n selector: '[bbFocus]',\n standalone: true\n})\nexport class BbFocus implements AfterViewInit {\n\n // Inputs.\n @Input({transform: booleanAttribute}) bbFocusOnlyDesktop: boolean = false;\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 if (this.bbFocusOnlyDesktop && 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 standalone: true\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 Ut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,EAAA,EAAA,SAAA,EAAA,EAAA,SAAA,EAAA,mBAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAAX,WAAW,EAAA,UAAA,EAAA,CAAA;kBAJvB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,eAAe;AACzB,oBAAA,UAAU,EAAE,IAAI;AACnB,iBAAA,CAAA;sGAsBG,SAAS,EAAA,CAAA;sBADR,YAAY;uBAAC,SAAS,EAAE,CAAC,QAAQ,CAAC,CAAA;;;MCP1B,WAAW,CAAA;uGAAX,WAAW,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAAX,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAW,YAZhB,UAAU;YACV,UAAU;YACV,OAAO;AACP,YAAA,WAAW,aAGX,UAAU;YACV,UAAU;YACV,OAAO;YACP,WAAW,CAAA,EAAA,CAAA,CAAA;wGAGN,WAAW,EAAA,CAAA,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,WAAW;AACd,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACL,UAAU;wBACV,UAAU;wBACV,OAAO;wBACP,WAAW;AACd,qBAAA;AACJ,iBAAA,CAAA;;;ACnBD;;AAEG;;;;"}
|
|
@@ -6,20 +6,6 @@ import { map, distinctUntilChanged, shareReplay, debounceTime, startWith } from
|
|
|
6
6
|
import { of, fromEvent, Observable, merge, Subscription, isObservable } from 'rxjs';
|
|
7
7
|
|
|
8
8
|
class FileLoader {
|
|
9
|
-
constructor() {
|
|
10
|
-
this.isFile = (input) => {
|
|
11
|
-
return 'File' in window && input instanceof File;
|
|
12
|
-
};
|
|
13
|
-
this.isBlob = (input) => {
|
|
14
|
-
return 'Blob' in window && input instanceof Blob;
|
|
15
|
-
};
|
|
16
|
-
this.blobToFile = (blob, fileName) => {
|
|
17
|
-
const anyBlob = blob;
|
|
18
|
-
anyBlob.lastModifiedDate = new Date();
|
|
19
|
-
anyBlob.name = fileName;
|
|
20
|
-
return anyBlob;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
9
|
fromDataUrl(value, name = 'file') {
|
|
24
10
|
if (!value) {
|
|
25
11
|
return null;
|
|
@@ -73,6 +59,12 @@ class FileLoader {
|
|
|
73
59
|
}
|
|
74
60
|
});
|
|
75
61
|
}
|
|
62
|
+
isFile = (input) => {
|
|
63
|
+
return 'File' in window && input instanceof File;
|
|
64
|
+
};
|
|
65
|
+
isBlob = (input) => {
|
|
66
|
+
return 'Blob' in window && input instanceof Blob;
|
|
67
|
+
};
|
|
76
68
|
createFile(blob, name) {
|
|
77
69
|
if (!navigator['msSaveBlob']) {
|
|
78
70
|
return new File([blob], name, { lastModified: Date.now(), type: blob?.type });
|
|
@@ -80,8 +72,14 @@ class FileLoader {
|
|
|
80
72
|
const blobFile = new Blob([blob], { type: blob?.type });
|
|
81
73
|
return this.blobToFile(blobFile, name);
|
|
82
74
|
}
|
|
83
|
-
|
|
84
|
-
|
|
75
|
+
blobToFile = (blob, fileName) => {
|
|
76
|
+
const anyBlob = blob;
|
|
77
|
+
anyBlob.lastModifiedDate = new Date();
|
|
78
|
+
anyBlob.name = fileName;
|
|
79
|
+
return anyBlob;
|
|
80
|
+
};
|
|
81
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: FileLoader, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
82
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: FileLoader, providedIn: 'root' });
|
|
85
83
|
}
|
|
86
84
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: FileLoader, decorators: [{
|
|
87
85
|
type: Injectable,
|
|
@@ -91,106 +89,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.0", ngImpor
|
|
|
91
89
|
}] });
|
|
92
90
|
|
|
93
91
|
class Exif {
|
|
92
|
+
_platform;
|
|
93
|
+
_fileLoader;
|
|
94
94
|
constructor(_platform, _fileLoader) {
|
|
95
95
|
this._platform = _platform;
|
|
96
96
|
this._fileLoader = _fileLoader;
|
|
97
|
-
this.transformImage = (image, type, orientation, quality = 100) => {
|
|
98
|
-
// Create the canvas and context.
|
|
99
|
-
const canvas = document.createElement('canvas');
|
|
100
|
-
const context = canvas.getContext('2d');
|
|
101
|
-
// Validate the context exists.
|
|
102
|
-
if (!context) {
|
|
103
|
-
return null;
|
|
104
|
-
}
|
|
105
|
-
// Set the canvas size based on the image.
|
|
106
|
-
const { width, height } = image;
|
|
107
|
-
canvas.width = width;
|
|
108
|
-
canvas.height = height;
|
|
109
|
-
// Validate the orientation is correct
|
|
110
|
-
// else flip the canvas sizes.
|
|
111
|
-
if (4 < orientation && orientation < 9) {
|
|
112
|
-
canvas.width = height;
|
|
113
|
-
canvas.height = width;
|
|
114
|
-
}
|
|
115
|
-
// Transform the context based on the orientation.
|
|
116
|
-
switch (orientation) {
|
|
117
|
-
case 2:
|
|
118
|
-
context.transform(-1, 0, 0, 1, width, 0);
|
|
119
|
-
break;
|
|
120
|
-
case 3:
|
|
121
|
-
context.transform(-1, 0, 0, -1, width, height);
|
|
122
|
-
break;
|
|
123
|
-
case 4:
|
|
124
|
-
context.transform(1, 0, 0, -1, 0, height);
|
|
125
|
-
break;
|
|
126
|
-
case 5:
|
|
127
|
-
context.transform(0, 1, 1, 0, 0, 0);
|
|
128
|
-
break;
|
|
129
|
-
case 6:
|
|
130
|
-
context.transform(0, 1, -1, 0, height, 0);
|
|
131
|
-
break;
|
|
132
|
-
case 7:
|
|
133
|
-
context.transform(0, -1, -1, 0, height, width);
|
|
134
|
-
break;
|
|
135
|
-
case 8:
|
|
136
|
-
context.transform(0, -1, 1, 0, 0, width);
|
|
137
|
-
break;
|
|
138
|
-
default:
|
|
139
|
-
break;
|
|
140
|
-
}
|
|
141
|
-
// Draw the image on the context and return the data URL.
|
|
142
|
-
context.drawImage(image, 0, 0, width, height);
|
|
143
|
-
return canvas.toDataURL(type, quality / 100);
|
|
144
|
-
};
|
|
145
|
-
this.getSupportedCanvasType = (fileType) => {
|
|
146
|
-
switch (fileType) {
|
|
147
|
-
case 'image/jpeg':
|
|
148
|
-
case 'image/jpg':
|
|
149
|
-
return 'image/jpeg';
|
|
150
|
-
case 'image/x-windows-bmp':
|
|
151
|
-
case 'image/bmp':
|
|
152
|
-
return 'image/bmp';
|
|
153
|
-
default:
|
|
154
|
-
return 'image/png';
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
this.getOrientation = (buffer) => {
|
|
158
|
-
// Create a new data view.
|
|
159
|
-
const view = new DataView(buffer);
|
|
160
|
-
if (view.getUint16(0, false) !== 0xFFD8) {
|
|
161
|
-
return -2;
|
|
162
|
-
}
|
|
163
|
-
const length = view.byteLength;
|
|
164
|
-
let offset = 2;
|
|
165
|
-
while (offset < length) {
|
|
166
|
-
if (view.getUint16(offset + 2, false) <= 8) {
|
|
167
|
-
return -1;
|
|
168
|
-
}
|
|
169
|
-
const marker = view.getUint16(offset, false);
|
|
170
|
-
offset += 2;
|
|
171
|
-
if (marker === 0xFFE1) {
|
|
172
|
-
if (view.getUint32(offset += 2, false) !== 0x45786966) {
|
|
173
|
-
return -1;
|
|
174
|
-
}
|
|
175
|
-
const little = view.getUint16(offset += 6, false) === 0x4949;
|
|
176
|
-
offset += view.getUint32(offset + 4, little);
|
|
177
|
-
const tags = view.getUint16(offset, little);
|
|
178
|
-
offset += 2;
|
|
179
|
-
for (let index = 0; index < tags; index++) {
|
|
180
|
-
if (view.getUint16(offset + index * 12, little) === 0x0112) {
|
|
181
|
-
return view.getUint16(offset + index * 12 + 8, little);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
else if ((marker & 0xFF00) !== 0xFF00) {
|
|
186
|
-
break;
|
|
187
|
-
}
|
|
188
|
-
else {
|
|
189
|
-
offset += view.getUint16(offset, false);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
return -1;
|
|
193
|
-
};
|
|
194
97
|
}
|
|
195
98
|
async strip(file, quality = 100) {
|
|
196
99
|
// Validate we are on a browser.
|
|
@@ -239,8 +142,105 @@ class Exif {
|
|
|
239
142
|
image.onload = () => resolve(image);
|
|
240
143
|
});
|
|
241
144
|
}
|
|
242
|
-
|
|
243
|
-
|
|
145
|
+
transformImage = (image, type, orientation, quality = 100) => {
|
|
146
|
+
// Create the canvas and context.
|
|
147
|
+
const canvas = document.createElement('canvas');
|
|
148
|
+
const context = canvas.getContext('2d');
|
|
149
|
+
// Validate the context exists.
|
|
150
|
+
if (!context) {
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
// Set the canvas size based on the image.
|
|
154
|
+
const { width, height } = image;
|
|
155
|
+
canvas.width = width;
|
|
156
|
+
canvas.height = height;
|
|
157
|
+
// Validate the orientation is correct
|
|
158
|
+
// else flip the canvas sizes.
|
|
159
|
+
if (4 < orientation && orientation < 9) {
|
|
160
|
+
canvas.width = height;
|
|
161
|
+
canvas.height = width;
|
|
162
|
+
}
|
|
163
|
+
// Transform the context based on the orientation.
|
|
164
|
+
switch (orientation) {
|
|
165
|
+
case 2:
|
|
166
|
+
context.transform(-1, 0, 0, 1, width, 0);
|
|
167
|
+
break;
|
|
168
|
+
case 3:
|
|
169
|
+
context.transform(-1, 0, 0, -1, width, height);
|
|
170
|
+
break;
|
|
171
|
+
case 4:
|
|
172
|
+
context.transform(1, 0, 0, -1, 0, height);
|
|
173
|
+
break;
|
|
174
|
+
case 5:
|
|
175
|
+
context.transform(0, 1, 1, 0, 0, 0);
|
|
176
|
+
break;
|
|
177
|
+
case 6:
|
|
178
|
+
context.transform(0, 1, -1, 0, height, 0);
|
|
179
|
+
break;
|
|
180
|
+
case 7:
|
|
181
|
+
context.transform(0, -1, -1, 0, height, width);
|
|
182
|
+
break;
|
|
183
|
+
case 8:
|
|
184
|
+
context.transform(0, -1, 1, 0, 0, width);
|
|
185
|
+
break;
|
|
186
|
+
default:
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
// Draw the image on the context and return the data URL.
|
|
190
|
+
context.drawImage(image, 0, 0, width, height);
|
|
191
|
+
return canvas.toDataURL(type, quality / 100);
|
|
192
|
+
};
|
|
193
|
+
getSupportedCanvasType = (fileType) => {
|
|
194
|
+
switch (fileType) {
|
|
195
|
+
case 'image/jpeg':
|
|
196
|
+
case 'image/jpg':
|
|
197
|
+
return 'image/jpeg';
|
|
198
|
+
case 'image/x-windows-bmp':
|
|
199
|
+
case 'image/bmp':
|
|
200
|
+
return 'image/bmp';
|
|
201
|
+
default:
|
|
202
|
+
return 'image/png';
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
getOrientation = (buffer) => {
|
|
206
|
+
// Create a new data view.
|
|
207
|
+
const view = new DataView(buffer);
|
|
208
|
+
if (view.getUint16(0, false) !== 0xFFD8) {
|
|
209
|
+
return -2;
|
|
210
|
+
}
|
|
211
|
+
const length = view.byteLength;
|
|
212
|
+
let offset = 2;
|
|
213
|
+
while (offset < length) {
|
|
214
|
+
if (view.getUint16(offset + 2, false) <= 8) {
|
|
215
|
+
return -1;
|
|
216
|
+
}
|
|
217
|
+
const marker = view.getUint16(offset, false);
|
|
218
|
+
offset += 2;
|
|
219
|
+
if (marker === 0xFFE1) {
|
|
220
|
+
if (view.getUint32(offset += 2, false) !== 0x45786966) {
|
|
221
|
+
return -1;
|
|
222
|
+
}
|
|
223
|
+
const little = view.getUint16(offset += 6, false) === 0x4949;
|
|
224
|
+
offset += view.getUint32(offset + 4, little);
|
|
225
|
+
const tags = view.getUint16(offset, little);
|
|
226
|
+
offset += 2;
|
|
227
|
+
for (let index = 0; index < tags; index++) {
|
|
228
|
+
if (view.getUint16(offset + index * 12, little) === 0x0112) {
|
|
229
|
+
return view.getUint16(offset + index * 12 + 8, little);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
else if ((marker & 0xFF00) !== 0xFF00) {
|
|
234
|
+
break;
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
offset += view.getUint16(offset, false);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return -1;
|
|
241
|
+
};
|
|
242
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Exif, deps: [{ token: i1.Platform }, { token: FileLoader }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
243
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Exif, providedIn: 'root' });
|
|
244
244
|
}
|
|
245
245
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Exif, decorators: [{
|
|
246
246
|
type: Injectable,
|
|
@@ -250,37 +250,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.0", ngImpor
|
|
|
250
250
|
}], ctorParameters: () => [{ type: i1.Platform }, { type: FileLoader }] });
|
|
251
251
|
|
|
252
252
|
class ImageConverter {
|
|
253
|
+
_exif;
|
|
254
|
+
_platform;
|
|
255
|
+
_fileLoader;
|
|
256
|
+
// Data.
|
|
257
|
+
_types = ['image/png', 'image/jpeg', 'image/webp'];
|
|
253
258
|
constructor(_exif, _platform, _fileLoader) {
|
|
254
259
|
this._exif = _exif;
|
|
255
260
|
this._platform = _platform;
|
|
256
261
|
this._fileLoader = _fileLoader;
|
|
257
|
-
// Data.
|
|
258
|
-
this._types = ['image/png', 'image/jpeg', 'image/webp'];
|
|
259
|
-
this.calculateOffsetAndDimensions = (image, canvasWidth, canvasHeight) => {
|
|
260
|
-
const originalWidth = image.width;
|
|
261
|
-
const originalHeight = image.height;
|
|
262
|
-
const widthRatio = canvasWidth / originalWidth;
|
|
263
|
-
const heightRatio = canvasHeight / originalHeight;
|
|
264
|
-
let width;
|
|
265
|
-
let height;
|
|
266
|
-
if (originalWidth > originalHeight) {
|
|
267
|
-
height = originalHeight * heightRatio;
|
|
268
|
-
width = (originalWidth / originalHeight) * height;
|
|
269
|
-
}
|
|
270
|
-
else {
|
|
271
|
-
width = originalWidth * widthRatio;
|
|
272
|
-
height = (originalHeight / originalWidth) * width;
|
|
273
|
-
}
|
|
274
|
-
let xOffset = 0;
|
|
275
|
-
let yOffset = 0;
|
|
276
|
-
if (canvasHeight === height) {
|
|
277
|
-
xOffset = -((width - canvasWidth) / 2);
|
|
278
|
-
}
|
|
279
|
-
else if (canvasWidth === width) {
|
|
280
|
-
yOffset = -((height - canvasHeight) / 2);
|
|
281
|
-
}
|
|
282
|
-
return { xOffset, yOffset, width, height };
|
|
283
|
-
};
|
|
284
262
|
}
|
|
285
263
|
async toDataUri(contents, options = null) {
|
|
286
264
|
// Check if the current platform is a browser.
|
|
@@ -357,8 +335,33 @@ class ImageConverter {
|
|
|
357
335
|
// If the contents is a string convert it to an HTML image element.
|
|
358
336
|
return this.stringToImage(contents);
|
|
359
337
|
}
|
|
360
|
-
|
|
361
|
-
|
|
338
|
+
calculateOffsetAndDimensions = (image, canvasWidth, canvasHeight) => {
|
|
339
|
+
const originalWidth = image.width;
|
|
340
|
+
const originalHeight = image.height;
|
|
341
|
+
const widthRatio = canvasWidth / originalWidth;
|
|
342
|
+
const heightRatio = canvasHeight / originalHeight;
|
|
343
|
+
let width;
|
|
344
|
+
let height;
|
|
345
|
+
if (originalWidth > originalHeight) {
|
|
346
|
+
height = originalHeight * heightRatio;
|
|
347
|
+
width = (originalWidth / originalHeight) * height;
|
|
348
|
+
}
|
|
349
|
+
else {
|
|
350
|
+
width = originalWidth * widthRatio;
|
|
351
|
+
height = (originalHeight / originalWidth) * width;
|
|
352
|
+
}
|
|
353
|
+
let xOffset = 0;
|
|
354
|
+
let yOffset = 0;
|
|
355
|
+
if (canvasHeight === height) {
|
|
356
|
+
xOffset = -((width - canvasWidth) / 2);
|
|
357
|
+
}
|
|
358
|
+
else if (canvasWidth === width) {
|
|
359
|
+
yOffset = -((height - canvasHeight) / 2);
|
|
360
|
+
}
|
|
361
|
+
return { xOffset, yOffset, width, height };
|
|
362
|
+
};
|
|
363
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: ImageConverter, deps: [{ token: Exif }, { token: i1.Platform }, { token: FileLoader }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
364
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: ImageConverter, providedIn: 'root' });
|
|
362
365
|
}
|
|
363
366
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: ImageConverter, decorators: [{
|
|
364
367
|
type: Injectable,
|
|
@@ -378,6 +381,10 @@ const WINDOW = new InjectionToken('An abstraction over global window object', {
|
|
|
378
381
|
});
|
|
379
382
|
|
|
380
383
|
class Files {
|
|
384
|
+
_platform;
|
|
385
|
+
_rendererFactory;
|
|
386
|
+
_window;
|
|
387
|
+
_renderer;
|
|
381
388
|
constructor(_platform, _rendererFactory, _window) {
|
|
382
389
|
this._platform = _platform;
|
|
383
390
|
this._rendererFactory = _rendererFactory;
|
|
@@ -444,8 +451,8 @@ class Files {
|
|
|
444
451
|
anchor.click();
|
|
445
452
|
}
|
|
446
453
|
}
|
|
447
|
-
static
|
|
448
|
-
static
|
|
454
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Files, deps: [{ token: i1.Platform }, { token: i0.RendererFactory2 }, { token: WINDOW, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
455
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Files, providedIn: 'root' });
|
|
449
456
|
}
|
|
450
457
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Files, decorators: [{
|
|
451
458
|
type: Injectable,
|
|
@@ -462,29 +469,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.0", ngImpor
|
|
|
462
469
|
const ACCEPT_LANGUAGE = new InjectionToken('AcceptLanguage');
|
|
463
470
|
|
|
464
471
|
class Languages {
|
|
472
|
+
_acceptLanguage;
|
|
473
|
+
// Data.
|
|
474
|
+
_data = [];
|
|
465
475
|
constructor(_acceptLanguage) {
|
|
466
476
|
this._acceptLanguage = _acceptLanguage;
|
|
467
|
-
// Data.
|
|
468
|
-
this._data = [];
|
|
469
|
-
this.getLanguages = () => {
|
|
470
|
-
// If defined we must be in a server environment.
|
|
471
|
-
if (this._acceptLanguage) {
|
|
472
|
-
return this._acceptLanguage;
|
|
473
|
-
}
|
|
474
|
-
// Try to get the languages from the navigator.
|
|
475
|
-
if (typeof navigator !== 'object') {
|
|
476
|
-
return null;
|
|
477
|
-
}
|
|
478
|
-
let t = 'anguage';
|
|
479
|
-
let n = navigator;
|
|
480
|
-
let f = n['l' + t + 's'];
|
|
481
|
-
const data = f && f.length ? f : (t = n['l' + t] ||
|
|
482
|
-
n['browserL' + t] ||
|
|
483
|
-
n['userL' + t]) ? [t] : t;
|
|
484
|
-
return typeof data === 'string'
|
|
485
|
-
? data
|
|
486
|
-
: data.join(';');
|
|
487
|
-
};
|
|
488
477
|
this._data = this.initialize();
|
|
489
478
|
}
|
|
490
479
|
get all() {
|
|
@@ -517,8 +506,27 @@ class Languages {
|
|
|
517
506
|
.filter(item => !!item)
|
|
518
507
|
.sort((a, b) => b.quality - a.quality);
|
|
519
508
|
}
|
|
520
|
-
|
|
521
|
-
|
|
509
|
+
getLanguages = () => {
|
|
510
|
+
// If defined we must be in a server environment.
|
|
511
|
+
if (this._acceptLanguage) {
|
|
512
|
+
return this._acceptLanguage;
|
|
513
|
+
}
|
|
514
|
+
// Try to get the languages from the navigator.
|
|
515
|
+
if (typeof navigator !== 'object') {
|
|
516
|
+
return null;
|
|
517
|
+
}
|
|
518
|
+
let t = 'anguage';
|
|
519
|
+
let n = navigator;
|
|
520
|
+
let f = n['l' + t + 's'];
|
|
521
|
+
const data = f && f.length ? f : (t = n['l' + t] ||
|
|
522
|
+
n['browserL' + t] ||
|
|
523
|
+
n['userL' + t]) ? [t] : t;
|
|
524
|
+
return typeof data === 'string'
|
|
525
|
+
? data
|
|
526
|
+
: data.join(';');
|
|
527
|
+
};
|
|
528
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Languages, deps: [{ token: ACCEPT_LANGUAGE, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
529
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Languages, providedIn: 'root' });
|
|
522
530
|
}
|
|
523
531
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Languages, decorators: [{
|
|
524
532
|
type: Injectable,
|
|
@@ -537,12 +545,15 @@ const NAVIGATOR = new InjectionToken('An abstraction over window.navigator objec
|
|
|
537
545
|
});
|
|
538
546
|
|
|
539
547
|
class Network {
|
|
548
|
+
_platform;
|
|
549
|
+
_window;
|
|
550
|
+
_navigator;
|
|
551
|
+
// Data.
|
|
552
|
+
_online$ = of(true);
|
|
540
553
|
constructor(_platform, _window, _navigator) {
|
|
541
554
|
this._platform = _platform;
|
|
542
555
|
this._window = _window;
|
|
543
556
|
this._navigator = _navigator;
|
|
544
|
-
// Data.
|
|
545
|
-
this._online$ = of(true);
|
|
546
557
|
this.getOnlineObservable();
|
|
547
558
|
}
|
|
548
559
|
online() {
|
|
@@ -564,8 +575,8 @@ class Network {
|
|
|
564
575
|
// a user is online/offline.
|
|
565
576
|
this._online$ = merge(now$, online$, offline$).pipe(distinctUntilChanged(), shareReplay({ refCount: true, bufferSize: 1 }));
|
|
566
577
|
}
|
|
567
|
-
static
|
|
568
|
-
static
|
|
578
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Network, deps: [{ token: i1.Platform }, { token: WINDOW, optional: true }, { token: NAVIGATOR, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
579
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Network, providedIn: 'root' });
|
|
569
580
|
}
|
|
570
581
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Network, decorators: [{
|
|
571
582
|
type: Injectable,
|
|
@@ -585,13 +596,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.0", ngImpor
|
|
|
585
596
|
}] }] });
|
|
586
597
|
|
|
587
598
|
class Patch {
|
|
599
|
+
_platform;
|
|
600
|
+
_window;
|
|
601
|
+
_document;
|
|
602
|
+
_hasPatchedMobileVerticalHeight = false;
|
|
603
|
+
// Subscriptions.
|
|
604
|
+
_subscription = new Subscription();
|
|
588
605
|
constructor(_platform, _window, _document) {
|
|
589
606
|
this._platform = _platform;
|
|
590
607
|
this._window = _window;
|
|
591
608
|
this._document = _document;
|
|
592
|
-
this._hasPatchedMobileVerticalHeight = false;
|
|
593
|
-
// Subscriptions.
|
|
594
|
-
this._subscription = new Subscription();
|
|
595
609
|
}
|
|
596
610
|
mobileVerticalHeight() {
|
|
597
611
|
// Check if the user has already patched
|
|
@@ -620,8 +634,8 @@ class Patch {
|
|
|
620
634
|
// Save the subscription so we can destroy it later.
|
|
621
635
|
this._subscription.add(subscription);
|
|
622
636
|
}
|
|
623
|
-
static
|
|
624
|
-
static
|
|
637
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Patch, deps: [{ token: i1.Platform }, { token: WINDOW, optional: true }, { token: DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
638
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Patch, providedIn: 'root' });
|
|
625
639
|
}
|
|
626
640
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Patch, decorators: [{
|
|
627
641
|
type: Injectable,
|