@bravobit/bb-foundation 0.32.0 → 0.33.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.
Files changed (161) hide show
  1. package/elements/lib/date-picker/date-picker.component.d.ts +3 -2
  2. package/elements/lib/directives/image-upload.directive.d.ts +28 -0
  3. package/elements/lib/elements.module.d.ts +21 -20
  4. package/elements/public_api.d.ts +1 -0
  5. package/esm2022/auth/lib/auth.interceptor.mjs +3 -3
  6. package/esm2022/auth/lib/auth.module.mjs +4 -4
  7. package/esm2022/auth/lib/auth.service.mjs +3 -3
  8. package/esm2022/auth/lib/directives/authenticated.directive.mjs +3 -3
  9. package/esm2022/auth/lib/guards/anonymous.guard.mjs +3 -3
  10. package/esm2022/auth/lib/guards/authenticated.guard.mjs +3 -3
  11. package/esm2022/collections/lib/collections.module.mjs +4 -4
  12. package/esm2022/collections/lib/components/collections-pager/collections-pager.component.mjs +3 -3
  13. package/esm2022/collections/lib/components/collections-viewer/collections-viewer.component.mjs +3 -3
  14. package/esm2022/collections/lib/components/collections.directive.mjs +12 -12
  15. package/esm2022/combobox/combobox/combobox-container.directive.mjs +3 -3
  16. package/esm2022/combobox/combobox/combobox.component.mjs +3 -3
  17. package/esm2022/combobox/combobox-label.directive.mjs +3 -3
  18. package/esm2022/combobox/combobox-option.directive.mjs +3 -3
  19. package/esm2022/combobox/combobox-panel/combobox-panel.component.mjs +3 -3
  20. package/esm2022/controls/lib/checkbox/checkbox/checkbox.component.mjs +3 -3
  21. package/esm2022/controls/lib/checkbox/checkbox-group/checkbox-group.component.mjs +3 -3
  22. package/esm2022/controls/lib/checkbox/checkbox.module.mjs +4 -4
  23. package/esm2022/controls/lib/control-error/control-error/control-error.component.mjs +3 -3
  24. package/esm2022/controls/lib/control-error/control-error-submit.directive.mjs +3 -3
  25. package/esm2022/controls/lib/control-error/control-error.module.mjs +4 -4
  26. package/esm2022/controls/lib/controls.module.mjs +4 -4
  27. package/esm2022/controls/lib/form-control/form-control/form-control.component.mjs +3 -3
  28. package/esm2022/controls/lib/form-control/form-control-addon/form-control-addon.component.mjs +3 -3
  29. package/esm2022/controls/lib/form-control/form-control-input.directive.mjs +3 -3
  30. package/esm2022/controls/lib/form-control/form-control.module.mjs +4 -4
  31. package/esm2022/controls/lib/radio/radio-button/radio-button.component.mjs +3 -3
  32. package/esm2022/controls/lib/radio/radio-group/radio-group.component.mjs +3 -3
  33. package/esm2022/controls/lib/radio/radio.module.mjs +4 -4
  34. package/esm2022/controls/lib/toggle/toggle/toggle.component.mjs +3 -3
  35. package/esm2022/controls/lib/toggle/toggle-group/toggle-group.component.mjs +3 -3
  36. package/esm2022/controls/lib/toggle/toggle.module.mjs +4 -4
  37. package/esm2022/dashboard/lib/dashboard/dashboard.component.mjs +3 -3
  38. package/esm2022/dashboard/lib/dashboard-header/dashboard-header.component.mjs +3 -3
  39. package/esm2022/dashboard/lib/dashboard-menu/dashboard-menu.component.mjs +3 -3
  40. package/esm2022/dashboard/lib/dashboard-menu-item/dashboard-menu-item.component.mjs +3 -3
  41. package/esm2022/dashboard/lib/dashboard-sidebar/dashboard-sidebar.component.mjs +3 -3
  42. package/esm2022/dashboard/lib/dashboard-sidebar-group/dashboard-sidebar-group.component.mjs +3 -3
  43. package/esm2022/dashboard/lib/dashboard-sidebar-item/dashboard-sidebar-item.component.mjs +3 -3
  44. package/esm2022/dashboard/lib/dashboard.module.mjs +4 -4
  45. package/esm2022/dialog/lib/dialog-actions/dialog-actions.component.mjs +3 -3
  46. package/esm2022/dialog/lib/dialog-confirm/dialog-confirm.component.mjs +3 -3
  47. package/esm2022/dialog/lib/dialog-container/dialog-container.component.mjs +3 -3
  48. package/esm2022/dialog/lib/dialog-header/dialog-header.component.mjs +3 -3
  49. package/esm2022/dialog/lib/dialog-link/dialog-link.component.mjs +3 -3
  50. package/esm2022/dialog/lib/dialog-modal/dialog-modal.component.mjs +3 -3
  51. package/esm2022/dialog/lib/dialog-overlay/dialog-overlay.component.mjs +3 -3
  52. package/esm2022/dialog/lib/dialog.insertion.mjs +3 -3
  53. package/esm2022/dialog/lib/dialog.module.mjs +4 -4
  54. package/esm2022/dialog/lib/dialog.service.mjs +3 -3
  55. package/esm2022/elements/lib/avatar/avatar.component.mjs +3 -3
  56. package/esm2022/elements/lib/button/button.component.mjs +6 -6
  57. package/esm2022/elements/lib/checkbox/checkbox.component.mjs +3 -3
  58. package/esm2022/elements/lib/date-picker/date-picker.component.mjs +9 -12
  59. package/esm2022/elements/lib/directives/addon.directive.mjs +6 -6
  60. package/esm2022/elements/lib/directives/form-submit.directive.mjs +3 -3
  61. package/esm2022/elements/lib/directives/form-submitter.directive.mjs +3 -3
  62. package/esm2022/elements/lib/directives/image-upload.directive.mjs +139 -0
  63. package/esm2022/elements/lib/directives/input.directive.mjs +6 -6
  64. package/esm2022/elements/lib/dropdown/dropdown.component.mjs +6 -6
  65. package/esm2022/elements/lib/elements.module.mjs +9 -5
  66. package/esm2022/elements/lib/file-picker/file-picker.component.mjs +3 -3
  67. package/esm2022/elements/lib/form-control/form-control.component.mjs +3 -3
  68. package/esm2022/elements/lib/form-error/form-error.component.mjs +3 -3
  69. package/esm2022/elements/lib/form-group/form-group.component.mjs +3 -3
  70. package/esm2022/elements/lib/icon/icon.component.mjs +3 -3
  71. package/esm2022/elements/lib/image-picker/image-picker.component.mjs +3 -3
  72. package/esm2022/elements/lib/pipes/file-image.pipe.mjs +3 -3
  73. package/esm2022/elements/lib/pipes/file-size.pipe.mjs +3 -3
  74. package/esm2022/elements/lib/pipes/relative-time.pipe.mjs +3 -3
  75. package/esm2022/elements/lib/spinner/spinner.component.mjs +3 -3
  76. package/esm2022/elements/lib/tag/tag.component.mjs +3 -3
  77. package/esm2022/elements/public_api.mjs +2 -1
  78. package/esm2022/http/lib/http.module.mjs +4 -4
  79. package/esm2022/http/lib/interceptors/base-url.interceptor.mjs +3 -3
  80. package/esm2022/http/lib/interceptors/error.interceptor.mjs +3 -3
  81. package/esm2022/lib/core/functions/array.utils.mjs +7 -0
  82. package/esm2022/lib/core/miscellaneous/regex.mjs +41 -2
  83. package/esm2022/lib/core/services/exif.service.mjs +3 -3
  84. package/esm2022/lib/core/services/file-loader.service.mjs +3 -3
  85. package/esm2022/lib/core/services/files.service.mjs +86 -0
  86. package/esm2022/lib/core/services/image-converter.service.mjs +3 -3
  87. package/esm2022/lib/core/services/languages.service.mjs +3 -3
  88. package/esm2022/lib/core/services/network.service.mjs +5 -5
  89. package/esm2022/lib/core/services/patch.service.mjs +3 -3
  90. package/esm2022/localize/lib/localize.module.mjs +4 -4
  91. package/esm2022/localize/lib/localize.pipe.mjs +3 -3
  92. package/esm2022/localize/lib/localize.service.mjs +3 -3
  93. package/esm2022/localize/lib/views/localize-string/localize-string.component.mjs +3 -3
  94. package/esm2022/localize/lib/views/localize-template.directive.mjs +3 -3
  95. package/esm2022/masking/lib/directives/currency-mask.directive.mjs +3 -3
  96. package/esm2022/masking/lib/directives/date-mask.directive.mjs +3 -3
  97. package/esm2022/masking/lib/directives/input-mask.directive.mjs +3 -3
  98. package/esm2022/masking/lib/masking.module.mjs +4 -4
  99. package/esm2022/masking/lib/masking.service.mjs +3 -3
  100. package/esm2022/notifications/lib/notifications-item/notifications-item.component.mjs +3 -3
  101. package/esm2022/notifications/lib/notifications-list/notifications-list.component.mjs +3 -3
  102. package/esm2022/notifications/lib/notifications.module.mjs +4 -4
  103. package/esm2022/notifications/lib/notifications.service.mjs +3 -3
  104. package/esm2022/permissions/lib/directives/permission.directive.mjs +3 -3
  105. package/esm2022/permissions/lib/guards/permission.guard.mjs +3 -3
  106. package/esm2022/permissions/lib/permissions.module.mjs +4 -4
  107. package/esm2022/permissions/lib/permissions.service.mjs +3 -3
  108. package/esm2022/public_api.mjs +3 -2
  109. package/esm2022/recaptcha/lib/recaptcha/recaptcha.component.mjs +3 -3
  110. package/esm2022/recaptcha/lib/recaptcha-loader.service.mjs +3 -3
  111. package/esm2022/recaptcha/lib/recaptcha.module.mjs +4 -4
  112. package/esm2022/rxjs/lib/observables/get-route-param.observable.mjs +5 -0
  113. package/esm2022/rxjs/public_api.mjs +2 -1
  114. package/esm2022/storage/lib/storage.service.mjs +3 -3
  115. package/esm2022/table/lib/components/table/table.component.mjs +9 -9
  116. package/esm2022/table/lib/components/table-cell/table-cell.component.mjs +3 -3
  117. package/esm2022/table/lib/components/table-header-cell/table-header-cell.component.mjs +3 -3
  118. package/esm2022/table/lib/components/table-pager/table-pager.component.mjs +3 -3
  119. package/esm2022/table/lib/table.module.mjs +4 -4
  120. package/esm2022/theming/lib/theming.directive.mjs +3 -3
  121. package/esm2022/theming/lib/theming.module.mjs +4 -4
  122. package/esm2022/tooltip/lib/tooltip-container/tooltip-container.component.mjs +3 -3
  123. package/esm2022/tooltip/lib/tooltip.directive.mjs +3 -3
  124. package/esm2022/tooltip/lib/tooltip.module.mjs +4 -4
  125. package/esm2022/utils/lib/directives/autosize.directive.mjs +3 -3
  126. package/esm2022/utils/lib/directives/focus-trap.directive.mjs +3 -3
  127. package/esm2022/utils/lib/directives/focus.directive.mjs +3 -3
  128. package/esm2022/utils/lib/directives/template.directive.mjs +3 -3
  129. package/esm2022/utils/lib/utils.module.mjs +4 -4
  130. package/fesm2022/bravobit-bb-foundation-auth.mjs +19 -19
  131. package/fesm2022/bravobit-bb-foundation-collections.mjs +22 -22
  132. package/fesm2022/bravobit-bb-foundation-combobox.mjs +15 -15
  133. package/fesm2022/bravobit-bb-foundation-controls.mjs +57 -57
  134. package/fesm2022/bravobit-bb-foundation-dashboard.mjs +25 -25
  135. package/fesm2022/bravobit-bb-foundation-dialog.mjs +31 -31
  136. package/fesm2022/bravobit-bb-foundation-elements.mjs +223 -88
  137. package/fesm2022/bravobit-bb-foundation-elements.mjs.map +1 -1
  138. package/fesm2022/bravobit-bb-foundation-http.mjs +10 -10
  139. package/fesm2022/bravobit-bb-foundation-localize.mjs +16 -16
  140. package/fesm2022/bravobit-bb-foundation-masking.mjs +16 -16
  141. package/fesm2022/bravobit-bb-foundation-notifications.mjs +13 -13
  142. package/fesm2022/bravobit-bb-foundation-permissions.mjs +13 -13
  143. package/fesm2022/bravobit-bb-foundation-recaptcha.mjs +10 -10
  144. package/fesm2022/bravobit-bb-foundation-rxjs.mjs +5 -1
  145. package/fesm2022/bravobit-bb-foundation-rxjs.mjs.map +1 -1
  146. package/fesm2022/bravobit-bb-foundation-storage.mjs +3 -3
  147. package/fesm2022/bravobit-bb-foundation-table.mjs +22 -22
  148. package/fesm2022/bravobit-bb-foundation-theming.mjs +7 -7
  149. package/fesm2022/bravobit-bb-foundation-tooltip.mjs +10 -10
  150. package/fesm2022/bravobit-bb-foundation-utils.mjs +16 -16
  151. package/fesm2022/bravobit-bb-foundation.mjs +161 -100
  152. package/fesm2022/bravobit-bb-foundation.mjs.map +1 -1
  153. package/lib/core/functions/array.utils.d.ts +1 -0
  154. package/lib/core/miscellaneous/regex.d.ts +1 -0
  155. package/lib/core/services/files.service.d.ts +19 -0
  156. package/package.json +21 -21
  157. package/public_api.d.ts +2 -1
  158. package/rxjs/lib/observables/get-route-param.observable.d.ts +3 -0
  159. package/rxjs/public_api.d.ts +1 -0
  160. package/esm2022/lib/core/services/clipboard.service.mjs +0 -70
  161. package/lib/core/services/clipboard.service.d.ts +0 -18
@@ -1,9 +1,9 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, InjectionToken, Optional, Inject, inject } from '@angular/core';
2
+ import { Injectable, InjectionToken, inject, Optional, Inject } from '@angular/core';
3
3
  import * as i1 from '@angular/cdk/platform';
4
+ import { DOCUMENT, formatDate } from '@angular/common';
4
5
  import { map, distinctUntilChanged, shareReplay, debounceTime, startWith } from 'rxjs/operators';
5
6
  import { of, fromEvent, Observable, merge, Subscription } from 'rxjs';
6
- import { DOCUMENT, formatDate } from '@angular/common';
7
7
  import { coerceBooleanProperty } from '@angular/cdk/coercion';
8
8
 
9
9
  class FileLoader {
@@ -81,10 +81,10 @@ class FileLoader {
81
81
  const blobFile = new Blob([blob], { type: blob?.type });
82
82
  return this.blobToFile(blobFile, name);
83
83
  }
84
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FileLoader, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
85
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FileLoader, providedIn: 'root' }); }
84
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: FileLoader, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
85
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: FileLoader, providedIn: 'root' }); }
86
86
  }
87
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FileLoader, decorators: [{
87
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: FileLoader, decorators: [{
88
88
  type: Injectable,
89
89
  args: [{
90
90
  providedIn: 'root'
@@ -240,10 +240,10 @@ class Exif {
240
240
  image.onload = () => resolve(image);
241
241
  });
242
242
  }
243
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: Exif, deps: [{ token: i1.Platform }, { token: FileLoader }], target: i0.ɵɵFactoryTarget.Injectable }); }
244
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: Exif, providedIn: 'root' }); }
243
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: Exif, deps: [{ token: i1.Platform }, { token: FileLoader }], target: i0.ɵɵFactoryTarget.Injectable }); }
244
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: Exif, providedIn: 'root' }); }
245
245
  }
246
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: Exif, decorators: [{
246
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: Exif, decorators: [{
247
247
  type: Injectable,
248
248
  args: [{
249
249
  providedIn: 'root'
@@ -358,16 +358,108 @@ class ImageConverter {
358
358
  // If the contents is a string convert it to an HTML image element.
359
359
  return this.stringToImage(contents);
360
360
  }
361
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ImageConverter, deps: [{ token: Exif }, { token: i1.Platform }, { token: FileLoader }], target: i0.ɵɵFactoryTarget.Injectable }); }
362
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ImageConverter, providedIn: 'root' }); }
361
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: ImageConverter, deps: [{ token: Exif }, { token: i1.Platform }, { token: FileLoader }], target: i0.ɵɵFactoryTarget.Injectable }); }
362
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: ImageConverter, providedIn: 'root' }); }
363
363
  }
364
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ImageConverter, decorators: [{
364
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: ImageConverter, decorators: [{
365
365
  type: Injectable,
366
366
  args: [{
367
367
  providedIn: 'root'
368
368
  }]
369
369
  }], ctorParameters: () => [{ type: Exif }, { type: i1.Platform }, { type: FileLoader }] });
370
370
 
371
+ const WINDOW = new InjectionToken('An abstraction over global window object', {
372
+ factory: () => {
373
+ const { defaultView } = inject(DOCUMENT);
374
+ if (!defaultView) {
375
+ throw new Error('Window is not available');
376
+ }
377
+ return defaultView;
378
+ }
379
+ });
380
+
381
+ class Files {
382
+ constructor(_platform, _rendererFactory, _window) {
383
+ this._platform = _platform;
384
+ this._rendererFactory = _rendererFactory;
385
+ this._window = _window;
386
+ this._renderer = this._rendererFactory.createRenderer(null, null);
387
+ }
388
+ download(blobOrFile, name) {
389
+ if (!this._platform.isBrowser) {
390
+ return;
391
+ }
392
+ const anchor = this.createAnchorElement(blobOrFile, name);
393
+ this.revokeUrlAndPressAnchor(anchor);
394
+ }
395
+ fromDataUri(dataUri, name) {
396
+ if (!dataUri) {
397
+ return null;
398
+ }
399
+ try {
400
+ const byteString = this._window.atob(dataUri.split(',')[1]);
401
+ // Separate out the mime component.
402
+ const mimeString = dataUri
403
+ .split(',')[0]
404
+ .split(':')[1]
405
+ .split(';')[0];
406
+ // Write the bytes of the string to an ArrayBuffer.
407
+ const arrayBuffer = new ArrayBuffer(byteString.length);
408
+ const uint8Array = new Uint8Array(arrayBuffer);
409
+ for (let index = 0; index < byteString.length; index++) {
410
+ uint8Array[index] = byteString.charCodeAt(index);
411
+ }
412
+ const dataView = new DataView(arrayBuffer);
413
+ const blob = new Blob([dataView.buffer], { type: mimeString });
414
+ return this.create(blob, name);
415
+ }
416
+ catch {
417
+ return null;
418
+ }
419
+ }
420
+ create(blob, name) {
421
+ if (!navigator['msSaveBlob']) {
422
+ return new File([blob], name, { lastModified: Date.now(), type: blob?.type });
423
+ }
424
+ const anyBlob = new Blob([blob], { type: blob?.type });
425
+ anyBlob.lastModifiedDate = new Date();
426
+ anyBlob.name = name;
427
+ return anyBlob;
428
+ }
429
+ createAnchorElement(blobOrFile, name) {
430
+ const anchor = this._renderer.createElement('a');
431
+ this._renderer.setProperty(anchor, 'download', name ?? blobOrFile?.['name']);
432
+ this._renderer.setProperty(anchor, 'rel', 'noopener');
433
+ this._renderer.setProperty(anchor, 'href', URL.createObjectURL(blobOrFile));
434
+ return anchor;
435
+ }
436
+ revokeUrlAndPressAnchor(anchor) {
437
+ setTimeout(() => URL.revokeObjectURL(anchor?.href), 40_000);
438
+ setTimeout(() => this.pressAnchor(anchor), 0);
439
+ }
440
+ pressAnchor(anchor) {
441
+ try {
442
+ anchor.dispatchEvent(new MouseEvent('click'));
443
+ }
444
+ catch {
445
+ anchor.click();
446
+ }
447
+ }
448
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: Files, deps: [{ token: i1.Platform }, { token: i0.RendererFactory2 }, { token: WINDOW, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
449
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: Files, providedIn: 'root' }); }
450
+ }
451
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: Files, decorators: [{
452
+ type: Injectable,
453
+ args: [{
454
+ providedIn: 'root'
455
+ }]
456
+ }], ctorParameters: () => [{ type: i1.Platform }, { type: i0.RendererFactory2 }, { type: Window, decorators: [{
457
+ type: Optional
458
+ }, {
459
+ type: Inject,
460
+ args: [WINDOW]
461
+ }] }] });
462
+
371
463
  const ACCEPT_LANGUAGE = new InjectionToken('AcceptLanguage');
372
464
 
373
465
  class Languages {
@@ -426,10 +518,10 @@ class Languages {
426
518
  .filter(item => !!item)
427
519
  .sort((a, b) => b.quality - a.quality);
428
520
  }
429
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: Languages, deps: [{ token: ACCEPT_LANGUAGE, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
430
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: Languages, providedIn: 'root' }); }
521
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: Languages, deps: [{ token: ACCEPT_LANGUAGE, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
522
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: Languages, providedIn: 'root' }); }
431
523
  }
432
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: Languages, decorators: [{
524
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: Languages, decorators: [{
433
525
  type: Injectable,
434
526
  args: [{
435
527
  providedIn: 'root'
@@ -441,16 +533,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImpor
441
533
  args: [ACCEPT_LANGUAGE]
442
534
  }] }] });
443
535
 
444
- const WINDOW = new InjectionToken('An abstraction over global window object', {
445
- factory: () => {
446
- const { defaultView } = inject(DOCUMENT);
447
- if (!defaultView) {
448
- throw new Error('Window is not available');
449
- }
450
- return defaultView;
451
- }
452
- });
453
-
454
536
  const NAVIGATOR = new InjectionToken('An abstraction over window.navigator object', {
455
537
  factory: () => inject(WINDOW).navigator
456
538
  });
@@ -481,12 +563,12 @@ class Network {
481
563
  });
482
564
  // Merge all event so we get notified when
483
565
  // a user is online/offline.
484
- this._online$ = merge(now$, online$, offline$).pipe(map(value => value), distinctUntilChanged(), shareReplay({ refCount: true, bufferSize: 1 }));
566
+ this._online$ = merge(now$, online$, offline$).pipe(distinctUntilChanged(), shareReplay({ refCount: true, bufferSize: 1 }));
485
567
  }
486
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: Network, deps: [{ token: i1.Platform }, { token: WINDOW, optional: true }, { token: NAVIGATOR, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
487
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: Network, providedIn: 'root' }); }
568
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: Network, deps: [{ token: i1.Platform }, { token: WINDOW, optional: true }, { token: NAVIGATOR, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
569
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: Network, providedIn: 'root' }); }
488
570
  }
489
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: Network, decorators: [{
571
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: Network, decorators: [{
490
572
  type: Injectable,
491
573
  args: [{
492
574
  providedIn: 'root'
@@ -539,10 +621,10 @@ class Patch {
539
621
  // Save the subscription so we can destroy it later.
540
622
  this._subscription.add(subscription);
541
623
  }
542
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: Patch, deps: [{ token: i1.Platform }, { token: WINDOW, optional: true }, { token: DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
543
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: Patch, providedIn: 'root' }); }
624
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: Patch, deps: [{ token: i1.Platform }, { token: WINDOW, optional: true }, { token: DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
625
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: Patch, providedIn: 'root' }); }
544
626
  }
545
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: Patch, decorators: [{
627
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: Patch, decorators: [{
546
628
  type: Injectable,
547
629
  args: [{
548
630
  providedIn: 'root'
@@ -559,73 +641,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImpor
559
641
  args: [DOCUMENT]
560
642
  }] }] });
561
643
 
562
- class Clipboard {
563
- constructor(_document) {
564
- this._document = _document;
565
- }
566
- copy(text) {
567
- const pendingCopy = this.beginCopy(text);
568
- const successful = pendingCopy.copy();
569
- pendingCopy.destroy();
570
- return successful;
571
- }
572
- beginCopy(text) {
573
- return new ClipboardCopy(text, this._document);
574
- }
575
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: Clipboard, deps: [{ token: DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
576
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: Clipboard, providedIn: 'root' }); }
577
- }
578
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: Clipboard, decorators: [{
579
- type: Injectable,
580
- args: [{
581
- providedIn: 'root'
582
- }]
583
- }], ctorParameters: () => [{ type: Document, decorators: [{
584
- type: Optional
585
- }, {
586
- type: Inject,
587
- args: [DOCUMENT]
588
- }] }] });
589
- class ClipboardCopy {
590
- constructor(_text, _document) {
591
- this._text = _text;
592
- this._document = _document;
593
- this.initialize();
594
- }
595
- copy() {
596
- const textarea = this._textarea;
597
- let successful = false;
598
- try {
599
- const currentFocus = this._document.activeElement;
600
- textarea?.select?.();
601
- textarea?.setSelectionRange?.(0, textarea?.value?.length);
602
- successful = this._document?.execCommand?.('copy');
603
- currentFocus?.focus?.();
604
- }
605
- catch {
606
- // Do nothing.
607
- }
608
- return successful;
609
- }
610
- destroy() {
611
- this._textarea?.parentNode?.removeChild?.(this._textarea);
612
- this._textarea = undefined;
613
- }
614
- initialize() {
615
- const textarea = this._textarea = this._document.createElement('textarea');
616
- const styles = textarea.style;
617
- // Hide the element for display and accessibility. Set a fixed position so the page layout
618
- // isn't affected. We use `fixed` with `top: 0`, because focus is moved into the textarea
619
- // for a split second and if it's off-screen, some browsers will attempt to scroll it into view.
620
- styles.position = 'fixed';
621
- styles.top = styles.opacity = '0';
622
- styles.left = '-999em';
623
- textarea.setAttribute('aria-hidden', 'true');
624
- textarea.value = this._text;
625
- this._document.body.appendChild(textarea);
626
- }
627
- }
628
-
629
644
  function mixinDisabled(base) {
630
645
  return class extends base {
631
646
  get disabled() {
@@ -756,7 +771,46 @@ const LOCATION = new InjectionToken('An abstraction over window.location object'
756
771
 
757
772
  const BbRegex = {
758
773
  email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
759
- fullNumber: /^\d*[1-9]\d*$/
774
+ fullNumber: /^\d*[1-9]\d*$/,
775
+ url: new RegExp('^' +
776
+ // protocol identifier (optional)
777
+ // short syntax // still required
778
+ '(?:(?:(?:https?|ftp):)?\\/\\/)' +
779
+ // user:pass BasicAuth (optional)
780
+ '(?:\\S+(?::\\S*)?@)?' +
781
+ '(?:' +
782
+ // IP address exclusion
783
+ // private & local networks
784
+ '(?!(?:10|127)(?:\\.\\d{1,3}){3})' +
785
+ '(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})' +
786
+ '(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})' +
787
+ // IP address dotted notation octets
788
+ // excludes loopback network 0.0.0.0
789
+ // excludes reserved space >= 224.0.0.0
790
+ // excludes network & broadcast addresses
791
+ // (first & last IP address of each class)
792
+ '(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])' +
793
+ '(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}' +
794
+ '(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))' +
795
+ '|' +
796
+ // host & domain names, may end with dot
797
+ // can be replaced by a shortest alternative
798
+ // (?![-_])(?:[-\\w\\u00a1-\\uffff]{0,63}[^-_]\\.)+
799
+ '(?:' +
800
+ '(?:' +
801
+ '[a-z0-9\\u00a1-\\uffff]' +
802
+ '[a-z0-9\\u00a1-\\uffff_-]{0,62}' +
803
+ ')?' +
804
+ '[a-z0-9\\u00a1-\\uffff]\\.' +
805
+ ')+' +
806
+ // TLD identifier name, may end with dot
807
+ '(?:[a-z\\u00a1-\\uffff]{2,}\\.?)' +
808
+ ')' +
809
+ // port number (optional)
810
+ '(?::\\d{2,5})?' +
811
+ // resource path (optional)
812
+ '(?:[/?#]\\S*)?' +
813
+ '$', 'i')
760
814
  };
761
815
 
762
816
  class BbValidator {
@@ -890,6 +944,13 @@ function generatePassword(length = 12) {
890
944
  return generatedPassword;
891
945
  }
892
946
 
947
+ function arrayToMap(items, value) {
948
+ return items.reduce((previous, current) => {
949
+ const key = current?.[value];
950
+ return { ...previous, [key]: current };
951
+ }, {});
952
+ }
953
+
893
954
  /*
894
955
  * Public API Surface of bb-foundation
895
956
  */
@@ -898,5 +959,5 @@ function generatePassword(length = 12) {
898
959
  * Generated bundle index. Do not edit.
899
960
  */
900
961
 
901
- export { ACCEPT_LANGUAGE, BASE_URL, BbRegex, BbValidator, COOKIE, Clipboard, ClipboardCopy, Exif, FileLoader, ImageConverter, LOCATION, Languages, NAVIGATOR, Network, Patch, WINDOW, createDate, generatePassword, isDate, isValidDate, mixinDisabled, mixinError, mixinFocused, mixinGrouped, mixinHideErrors, mixinLoad, mixinReadonly, mixinRequired, parseDate };
962
+ export { ACCEPT_LANGUAGE, BASE_URL, BbRegex, BbValidator, COOKIE, Exif, FileLoader, Files, ImageConverter, LOCATION, Languages, NAVIGATOR, Network, Patch, WINDOW, arrayToMap, createDate, generatePassword, isDate, isValidDate, mixinDisabled, mixinError, mixinFocused, mixinGrouped, mixinHideErrors, mixinLoad, mixinReadonly, mixinRequired, parseDate };
902
963
  //# sourceMappingURL=bravobit-bb-foundation.mjs.map