@bravobit/bb-foundation 0.23.2 → 0.23.5

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 (168) hide show
  1. package/auth/lib/auth.service.d.ts +4 -3
  2. package/auth/lib/guards/anonymous.guard.d.ts +5 -4
  3. package/auth/lib/guards/authenticated.guard.d.ts +5 -4
  4. package/auth/lib/guards/permission.guard.d.ts +5 -4
  5. package/auth/lib/interfaces/config.interface.d.ts +8 -0
  6. package/elements/lib/date-picker/date-picker.component.d.ts +3 -5
  7. package/esm2020/auth/lib/auth.interceptor.mjs +3 -3
  8. package/esm2020/auth/lib/auth.module.mjs +4 -4
  9. package/esm2020/auth/lib/auth.service.mjs +21 -6
  10. package/esm2020/auth/lib/directives/authenticated.directive.mjs +3 -3
  11. package/esm2020/auth/lib/directives/permission.directive.mjs +3 -3
  12. package/esm2020/auth/lib/guards/anonymous.guard.mjs +17 -7
  13. package/esm2020/auth/lib/guards/authenticated.guard.mjs +17 -7
  14. package/esm2020/auth/lib/guards/permission.guard.mjs +17 -7
  15. package/esm2020/auth/lib/interfaces/config.interface.mjs +3 -1
  16. package/esm2020/auth/lib/permissions/permissions.service.mjs +3 -3
  17. package/esm2020/collections/lib/collections.module.mjs +4 -4
  18. package/esm2020/collections/lib/components/collections-pager/collections-pager.component.mjs +3 -3
  19. package/esm2020/collections/lib/components/collections-viewer/collections-viewer.component.mjs +3 -3
  20. package/esm2020/collections/lib/components/collections.directive.mjs +12 -12
  21. package/esm2020/controls/lib/checkbox/checkbox/checkbox.component.mjs +3 -3
  22. package/esm2020/controls/lib/checkbox/checkbox-group/checkbox-group.component.mjs +3 -3
  23. package/esm2020/controls/lib/checkbox/checkbox.module.mjs +4 -4
  24. package/esm2020/controls/lib/control-error/control-error/control-error.component.mjs +3 -3
  25. package/esm2020/controls/lib/control-error/control-error-submit.directive.mjs +3 -3
  26. package/esm2020/controls/lib/control-error/control-error.module.mjs +4 -4
  27. package/esm2020/controls/lib/controls.module.mjs +4 -4
  28. package/esm2020/controls/lib/form-control/form-control/form-control.component.mjs +3 -3
  29. package/esm2020/controls/lib/form-control/form-control-addon/form-control-addon.component.mjs +3 -3
  30. package/esm2020/controls/lib/form-control/form-control-input.directive.mjs +3 -3
  31. package/esm2020/controls/lib/form-control/form-control.module.mjs +4 -4
  32. package/esm2020/dashboard/lib/dashboard/dashboard.component.mjs +3 -3
  33. package/esm2020/dashboard/lib/dashboard-header/dashboard-header.component.mjs +3 -3
  34. package/esm2020/dashboard/lib/dashboard-menu/dashboard-menu.component.mjs +3 -3
  35. package/esm2020/dashboard/lib/dashboard-menu-item/dashboard-menu-item.component.mjs +3 -3
  36. package/esm2020/dashboard/lib/dashboard-sidebar/dashboard-sidebar.component.mjs +3 -3
  37. package/esm2020/dashboard/lib/dashboard-sidebar-group/dashboard-sidebar-group.component.mjs +3 -3
  38. package/esm2020/dashboard/lib/dashboard-sidebar-item/dashboard-sidebar-item.component.mjs +3 -3
  39. package/esm2020/dashboard/lib/dashboard.module.mjs +4 -4
  40. package/esm2020/dialog/lib/dialog-actions/dialog-actions.component.mjs +3 -3
  41. package/esm2020/dialog/lib/dialog-confirm/dialog-confirm.component.mjs +3 -3
  42. package/esm2020/dialog/lib/dialog-container/dialog-container.component.mjs +3 -3
  43. package/esm2020/dialog/lib/dialog-header/dialog-header.component.mjs +3 -3
  44. package/esm2020/dialog/lib/dialog-link/dialog-link.component.mjs +3 -3
  45. package/esm2020/dialog/lib/dialog-modal/dialog-modal.component.mjs +4 -4
  46. package/esm2020/dialog/lib/dialog-overlay/dialog-overlay.component.mjs +3 -3
  47. package/esm2020/dialog/lib/dialog.insertion.mjs +3 -3
  48. package/esm2020/dialog/lib/dialog.module.mjs +4 -4
  49. package/esm2020/dialog/lib/dialog.service.mjs +3 -3
  50. package/esm2020/elements/lib/avatar/avatar.component.mjs +3 -3
  51. package/esm2020/elements/lib/button/button.component.mjs +6 -6
  52. package/esm2020/elements/lib/checkbox/checkbox.component.mjs +3 -3
  53. package/esm2020/elements/lib/date-picker/date-picker.component.mjs +27 -29
  54. package/esm2020/elements/lib/directives/addon.directive.mjs +6 -6
  55. package/esm2020/elements/lib/directives/form-submit.directive.mjs +3 -3
  56. package/esm2020/elements/lib/directives/form-submitter.directive.mjs +3 -3
  57. package/esm2020/elements/lib/directives/input.directive.mjs +6 -6
  58. package/esm2020/elements/lib/dropdown/dropdown.component.mjs +7 -7
  59. package/esm2020/elements/lib/elements.module.mjs +4 -4
  60. package/esm2020/elements/lib/file-picker/file-picker.component.mjs +3 -3
  61. package/esm2020/elements/lib/form-control/form-control.component.mjs +3 -3
  62. package/esm2020/elements/lib/form-error/form-error.component.mjs +3 -3
  63. package/esm2020/elements/lib/form-group/form-group.component.mjs +3 -3
  64. package/esm2020/elements/lib/icon/icon.component.mjs +3 -3
  65. package/esm2020/elements/lib/image-picker/image-picker.component.mjs +3 -3
  66. package/esm2020/elements/lib/pipes/file-image.pipe.mjs +3 -3
  67. package/esm2020/elements/lib/pipes/file-size.pipe.mjs +3 -3
  68. package/esm2020/elements/lib/pipes/relative-time.pipe.mjs +3 -3
  69. package/esm2020/elements/lib/spinner/spinner.component.mjs +3 -3
  70. package/esm2020/elements/lib/tag/tag.component.mjs +3 -3
  71. package/esm2020/http/lib/http.module.mjs +5 -5
  72. package/esm2020/http/lib/interceptors/base-url.interceptor.mjs +3 -3
  73. package/esm2020/http/lib/interceptors/error.interceptor.mjs +3 -3
  74. package/esm2020/lib/core/services/clipboard.service.mjs +4 -4
  75. package/esm2020/lib/core/services/exif.service.mjs +3 -3
  76. package/esm2020/lib/core/services/file-loader.service.mjs +3 -3
  77. package/esm2020/lib/core/services/image-converter.service.mjs +3 -3
  78. package/esm2020/lib/core/services/languages.service.mjs +3 -3
  79. package/esm2020/lib/core/services/network.service.mjs +4 -4
  80. package/esm2020/lib/core/services/patch.service.mjs +4 -4
  81. package/esm2020/localize/lib/dictionary/dictionary.class.mjs +2 -4
  82. package/esm2020/localize/lib/interfaces/config.interfaces.mjs +1 -1
  83. package/esm2020/localize/lib/locale.token.mjs +14 -0
  84. package/esm2020/localize/lib/localize.module.mjs +8 -5
  85. package/esm2020/localize/lib/localize.pipe.mjs +3 -3
  86. package/esm2020/localize/lib/localize.service.mjs +33 -11
  87. package/esm2020/localize/lib/views/localize-string/localize-string.component.mjs +3 -3
  88. package/esm2020/localize/lib/views/localize-template.directive.mjs +3 -3
  89. package/esm2020/localize/public_api.mjs +2 -1
  90. package/esm2020/masking/lib/directives/currency-mask.directive.mjs +3 -3
  91. package/esm2020/masking/lib/directives/date-mask.directive.mjs +3 -3
  92. package/esm2020/masking/lib/directives/input-mask.directive.mjs +3 -3
  93. package/esm2020/masking/lib/masking.module.mjs +4 -4
  94. package/esm2020/masking/lib/masking.service.mjs +3 -3
  95. package/esm2020/notifications/lib/notifications-item/notifications-item.component.mjs +3 -3
  96. package/esm2020/notifications/lib/notifications-list/notifications-list.component.mjs +3 -3
  97. package/esm2020/notifications/lib/notifications.module.mjs +4 -4
  98. package/esm2020/notifications/lib/notifications.service.mjs +3 -3
  99. package/esm2020/recaptcha/lib/recaptcha/recaptcha.component.mjs +49 -15
  100. package/esm2020/recaptcha/lib/recaptcha-loader.service.mjs +12 -7
  101. package/esm2020/recaptcha/lib/recaptcha.module.mjs +4 -4
  102. package/esm2020/storage/lib/storage.service.mjs +3 -3
  103. package/esm2020/table/lib/components/table/table.component.mjs +9 -9
  104. package/esm2020/table/lib/components/table-cell/table-cell.component.mjs +3 -3
  105. package/esm2020/table/lib/components/table-header-cell/table-header-cell.component.mjs +3 -3
  106. package/esm2020/table/lib/components/table-pager/table-pager.component.mjs +3 -3
  107. package/esm2020/table/lib/table.module.mjs +4 -4
  108. package/esm2020/theming/lib/theming.directive.mjs +3 -3
  109. package/esm2020/theming/lib/theming.module.mjs +4 -4
  110. package/esm2020/utils/lib/directives/autosize.directive.mjs +3 -3
  111. package/esm2020/utils/lib/directives/focus-trap.directive.mjs +3 -3
  112. package/esm2020/utils/lib/directives/focus.directive.mjs +3 -3
  113. package/esm2020/utils/lib/directives/template.directive.mjs +3 -3
  114. package/esm2020/utils/lib/utils.module.mjs +4 -4
  115. package/fesm2015/bravobit-bb-foundation-auth.mjs +80 -38
  116. package/fesm2015/bravobit-bb-foundation-auth.mjs.map +1 -1
  117. package/fesm2015/bravobit-bb-foundation-collections.mjs +22 -22
  118. package/fesm2015/bravobit-bb-foundation-controls.mjs +37 -37
  119. package/fesm2015/bravobit-bb-foundation-dashboard.mjs +25 -25
  120. package/fesm2015/bravobit-bb-foundation-dialog.mjs +31 -31
  121. package/fesm2015/bravobit-bb-foundation-dialog.mjs.map +1 -1
  122. package/fesm2015/bravobit-bb-foundation-elements.mjs +99 -102
  123. package/fesm2015/bravobit-bb-foundation-elements.mjs.map +1 -1
  124. package/fesm2015/bravobit-bb-foundation-http.mjs +10 -10
  125. package/fesm2015/bravobit-bb-foundation-http.mjs.map +1 -1
  126. package/fesm2015/bravobit-bb-foundation-localize.mjs +73 -35
  127. package/fesm2015/bravobit-bb-foundation-localize.mjs.map +1 -1
  128. package/fesm2015/bravobit-bb-foundation-masking.mjs +16 -16
  129. package/fesm2015/bravobit-bb-foundation-notifications.mjs +13 -13
  130. package/fesm2015/bravobit-bb-foundation-recaptcha.mjs +64 -25
  131. package/fesm2015/bravobit-bb-foundation-recaptcha.mjs.map +1 -1
  132. package/fesm2015/bravobit-bb-foundation-storage.mjs +3 -3
  133. package/fesm2015/bravobit-bb-foundation-table.mjs +22 -22
  134. package/fesm2015/bravobit-bb-foundation-theming.mjs +7 -7
  135. package/fesm2015/bravobit-bb-foundation-utils.mjs +16 -16
  136. package/fesm2015/bravobit-bb-foundation.mjs +21 -21
  137. package/fesm2015/bravobit-bb-foundation.mjs.map +1 -1
  138. package/fesm2020/bravobit-bb-foundation-auth.mjs +80 -38
  139. package/fesm2020/bravobit-bb-foundation-auth.mjs.map +1 -1
  140. package/fesm2020/bravobit-bb-foundation-collections.mjs +22 -22
  141. package/fesm2020/bravobit-bb-foundation-controls.mjs +37 -37
  142. package/fesm2020/bravobit-bb-foundation-dashboard.mjs +25 -25
  143. package/fesm2020/bravobit-bb-foundation-dialog.mjs +31 -31
  144. package/fesm2020/bravobit-bb-foundation-dialog.mjs.map +1 -1
  145. package/fesm2020/bravobit-bb-foundation-elements.mjs +99 -101
  146. package/fesm2020/bravobit-bb-foundation-elements.mjs.map +1 -1
  147. package/fesm2020/bravobit-bb-foundation-http.mjs +10 -10
  148. package/fesm2020/bravobit-bb-foundation-http.mjs.map +1 -1
  149. package/fesm2020/bravobit-bb-foundation-localize.mjs +62 -30
  150. package/fesm2020/bravobit-bb-foundation-localize.mjs.map +1 -1
  151. package/fesm2020/bravobit-bb-foundation-masking.mjs +16 -16
  152. package/fesm2020/bravobit-bb-foundation-notifications.mjs +13 -13
  153. package/fesm2020/bravobit-bb-foundation-recaptcha.mjs +61 -23
  154. package/fesm2020/bravobit-bb-foundation-recaptcha.mjs.map +1 -1
  155. package/fesm2020/bravobit-bb-foundation-storage.mjs +3 -3
  156. package/fesm2020/bravobit-bb-foundation-table.mjs +22 -22
  157. package/fesm2020/bravobit-bb-foundation-theming.mjs +7 -7
  158. package/fesm2020/bravobit-bb-foundation-utils.mjs +16 -16
  159. package/fesm2020/bravobit-bb-foundation.mjs +21 -21
  160. package/fesm2020/bravobit-bb-foundation.mjs.map +1 -1
  161. package/localize/lib/interfaces/config.interfaces.d.ts +1 -0
  162. package/localize/lib/locale.token.d.ts +3 -0
  163. package/localize/lib/localize.module.d.ts +1 -1
  164. package/localize/lib/localize.service.d.ts +6 -3
  165. package/localize/public_api.d.ts +1 -0
  166. package/package.json +1 -1
  167. package/recaptcha/lib/recaptcha/recaptcha.component.d.ts +11 -3
  168. package/recaptcha/lib/recaptcha-loader.service.d.ts +4 -2
@@ -92,9 +92,9 @@ class BaseUrlInterceptor {
92
92
  return null;
93
93
  }
94
94
  }
95
- BaseUrlInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: BaseUrlInterceptor, deps: [{ token: HttpConfig }], target: i0.ɵɵFactoryTarget.Injectable });
96
- BaseUrlInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: BaseUrlInterceptor });
97
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: BaseUrlInterceptor, decorators: [{
95
+ BaseUrlInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: BaseUrlInterceptor, deps: [{ token: HttpConfig }], target: i0.ɵɵFactoryTarget.Injectable });
96
+ BaseUrlInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: BaseUrlInterceptor });
97
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: BaseUrlInterceptor, decorators: [{
98
98
  type: Injectable
99
99
  }], ctorParameters: function () { return [{ type: HttpConfig }]; } });
100
100
 
@@ -117,9 +117,9 @@ class ErrorInterceptor {
117
117
  }));
118
118
  }
119
119
  }
120
- ErrorInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ErrorInterceptor, deps: [{ token: HttpConfig }], target: i0.ɵɵFactoryTarget.Injectable });
121
- ErrorInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ErrorInterceptor });
122
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ErrorInterceptor, decorators: [{
120
+ ErrorInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: ErrorInterceptor, deps: [{ token: HttpConfig }], target: i0.ɵɵFactoryTarget.Injectable });
121
+ ErrorInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: ErrorInterceptor });
122
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: ErrorInterceptor, decorators: [{
123
123
  type: Injectable
124
124
  }], ctorParameters: function () { return [{ type: HttpConfig }]; } });
125
125
 
@@ -142,10 +142,10 @@ class HttpModule {
142
142
  };
143
143
  }
144
144
  }
145
- HttpModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: HttpModule, deps: [{ token: HttpModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule });
146
- HttpModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.0", ngImport: i0, type: HttpModule, imports: [HttpClientModule] });
147
- HttpModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: HttpModule, imports: [HttpClientModule] });
148
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: HttpModule, decorators: [{
145
+ HttpModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: HttpModule, deps: [{ token: HttpModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule });
146
+ HttpModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.1", ngImport: i0, type: HttpModule, imports: [HttpClientModule] });
147
+ HttpModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: HttpModule, imports: [HttpClientModule] });
148
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: HttpModule, decorators: [{
149
149
  type: NgModule,
150
150
  args: [{
151
151
  imports: [HttpClientModule]
@@ -1 +1 @@
1
- {"version":3,"file":"bravobit-bb-foundation-http.mjs","sources":["../../../projects/bb-foundation/http/src/lib/classes/http.config.ts","../../../projects/bb-foundation/http/src/lib/classes/http.error.ts","../../../projects/bb-foundation/http/src/lib/interceptors/base-url.interceptor.ts","../../../projects/bb-foundation/http/src/lib/interceptors/error.interceptor.ts","../../../projects/bb-foundation/http/src/lib/http.module.ts","../../../projects/bb-foundation/http/src/bravobit-bb-foundation-http.ts"],"sourcesContent":["import {HttpConfigAliases, HttpConfigData, HttpConfigUrl} from '../http.interfaces';\n\ndeclare let ngDevMode;\n\nexport class HttpConfig {\n\n readonly aliases: HttpConfigAliases;\n readonly prefix: string;\n readonly defaultAlias: string;\n readonly disableErrorParsing: boolean;\n\n constructor(data: HttpConfigData) {\n // Get the data from the config.\n this.prefix = data?.alias?.prefix ?? '$';\n this.disableErrorParsing = data?.disableErrorParsing ?? false;\n\n // Parse the aliases.\n const standardAlias = data?.alias?.standard ?? 'api';\n this.aliases = this.parseAliases(data?.url, standardAlias);\n\n // Get the default alias.\n const firstAvailableAlias = Object.keys(this.aliases ?? {})?.[0];\n this.defaultAlias = `${this.prefix}${firstAvailableAlias}`;\n }\n\n private parseAliases = (value: HttpConfigUrl, standardAlias: string) => {\n if (typeof value === 'string') {\n value = {[standardAlias]: value};\n }\n\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n const stringRegex = /^[a-zA-Z]+$/;\n for (const alias in value) {\n if (value.hasOwnProperty(alias) && !stringRegex.test(alias)) {\n console?.warn?.(`[HttpModule]: Invalid HTTP-alias in HttpConfig named \"${alias}\"; only latin characters should be used.`);\n }\n }\n }\n\n return value;\n };\n\n}\n","import {HttpErrorResponse} from '@angular/common/http';\n\nexport class HttpError extends HttpErrorResponse {\n\n constructor(error: HttpErrorResponse) {\n super(error);\n }\n\n get<T = any>(token: string, delimiter: string = '.') {\n const error = this.error ?? {};\n return (token ?? '')\n .split(delimiter)\n .reduce((previous, current) => previous?.[current] ? previous?.[current] : null, error) as T;\n }\n\n has(token: string, delimiter: string = '.') {\n return !!this.get(token, delimiter);\n }\n\n includes<T = any>(token: string, value: T) {\n const array = this.get<T[]>(token);\n return (array ?? []).includes(value);\n }\n\n}\n","import {HttpHandler, HttpInterceptor, HttpRequest} from '@angular/common/http';\nimport {HttpConfigAliases} from '../http.interfaces';\nimport {HttpConfig} from '../classes/http.config';\nimport {Injectable} from '@angular/core';\n\ndeclare let ngDevMode;\n\n@Injectable()\nexport class BaseUrlInterceptor implements HttpInterceptor {\n\n // Aliases.\n private readonly _aliases: HttpConfigAliases = this._config?.aliases;\n private readonly _prefix: string = this._config?.prefix;\n private readonly _extractRegex: RegExp = new RegExp(`\\\\${this._prefix}[a-zA-Z]+`);\n\n constructor(private _config: HttpConfig) {\n }\n\n intercept(request: HttpRequest<unknown>, next: HttpHandler) {\n const url = this.getUrlBasedOnAlias(request.url);\n const modified = request.clone({url});\n\n return next.handle(modified);\n }\n\n private getUrlBasedOnAlias(url: string) {\n const matches = this._extractRegex.exec(url);\n if (!matches) {\n return url;\n }\n\n return matches.reduce((previous, current) => {\n const alias = this.getAlias(current);\n if (!alias) {\n return previous;\n }\n\n return previous.replace(current, alias);\n }, url);\n }\n\n private getAlias(value: string) {\n const alias = value.replace(this._prefix, '');\n const fetched = this._aliases?.[alias] ?? null;\n if (fetched) {\n return fetched;\n }\n\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n const available = Object.keys(this._aliases)\n .map(item => `\\$${item}`)\n .join(', ');\n console?.warn?.(`[HttpModule]: Used an invalid HTTP-alias named \"${value}\", skipped parsing; Available aliases is one of (${available}).`);\n }\n\n return null;\n }\n\n}\n","import {HttpErrorResponse, HttpHandler, HttpInterceptor, HttpRequest} from '@angular/common/http';\nimport {HttpConfig} from '../classes/http.config';\nimport {HttpError} from '../classes/http.error';\nimport {catchError} from 'rxjs/operators';\nimport {Injectable} from '@angular/core';\nimport {throwError} from 'rxjs';\n\n@Injectable()\nexport class ErrorInterceptor implements HttpInterceptor {\n\n // State.\n private readonly _disabled = this._config?.disableErrorParsing ?? false;\n\n constructor(private _config: HttpConfig) {\n }\n\n intercept(request: HttpRequest<unknown>, next: HttpHandler) {\n return next.handle(request).pipe(\n catchError(error => {\n // If we have a matching http error response\n // re-map it with our custom class (if not disabled).\n if (!this._disabled && error instanceof HttpErrorResponse) {\n const parsed = new HttpError(error);\n return throwError(() => parsed);\n }\n\n // We did not match anything, just re-trow the error.\n return throwError(() => error);\n })\n );\n }\n\n}\n","import {InjectionToken, ModuleWithProviders, NgModule, Optional, SkipSelf} from '@angular/core';\nimport {HTTP_INTERCEPTORS, HttpClientModule} from '@angular/common/http';\nimport {BaseUrlInterceptor} from './interceptors/base-url.interceptor';\nimport {ErrorInterceptor} from './interceptors/error.interceptor';\nimport {HttpConfigData} from './http.interfaces';\nimport {HttpConfig} from './classes/http.config';\n\n@NgModule({\n imports: [HttpClientModule]\n})\nexport class HttpModule {\n\n constructor(@Optional() @SkipSelf() private _parent?: HttpModule) {\n if (this._parent) {\n throw new Error('HttpModule is already loaded; Import it in the core module only.');\n }\n }\n\n static forRoot(config: HttpConfigData): ModuleWithProviders<HttpModule> {\n return {\n ngModule: HttpModule,\n providers: [\n {provide: HTTP_CONFIGURATION_DATA, useValue: config},\n {provide: HttpConfig, useFactory: createHttpConfig, deps: [HTTP_CONFIGURATION_DATA]},\n {provide: HTTP_INTERCEPTORS, useClass: BaseUrlInterceptor, multi: true},\n {provide: HTTP_INTERCEPTORS, useClass: ErrorInterceptor, multi: true}\n ]\n };\n }\n\n}\n\nexport const HTTP_CONFIGURATION_DATA = new InjectionToken<HttpConfigData>('HTTP_CONFIGURATION_DATA');\n\nexport function createHttpConfig(data: HttpConfigData) {\n return new HttpConfig(data);\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["i1.HttpConfig"],"mappings":";;;;;;MAIa,UAAU,CAAA;AAOnB,IAAA,WAAA,CAAY,IAAoB,EAAA;AAcxB,QAAA,IAAA,CAAA,YAAY,GAAG,CAAC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,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,UAAU,YAFT,gBAAgB,CAAA,EAAA,CAAA,CAAA;2FAEjB,UAAU,EAAA,UAAA,EAAA,CAAA;kBAHtB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACN,OAAO,EAAE,CAAC,gBAAgB,CAAC;AAC9B,iBAAA,CAAA;0DAGyD,UAAU,EAAA,UAAA,EAAA,CAAA;0BAAnD,QAAQ;;0BAAI,QAAQ;;MAoBxB,uBAAuB,GAAG,IAAI,cAAc,CAAiB,yBAAyB,EAAE;AAE/F,SAAU,gBAAgB,CAAC,IAAoB,EAAA;AACjD,IAAA,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;AAChC;;ACpCA;;AAEG;;;;"}
1
+ {"version":3,"file":"bravobit-bb-foundation-http.mjs","sources":["../../../projects/bb-foundation/http/src/lib/classes/http.config.ts","../../../projects/bb-foundation/http/src/lib/classes/http.error.ts","../../../projects/bb-foundation/http/src/lib/interceptors/base-url.interceptor.ts","../../../projects/bb-foundation/http/src/lib/interceptors/error.interceptor.ts","../../../projects/bb-foundation/http/src/lib/http.module.ts","../../../projects/bb-foundation/http/src/bravobit-bb-foundation-http.ts"],"sourcesContent":["import {HttpConfigAliases, HttpConfigData, HttpConfigUrl} from '../http.interfaces';\n\ndeclare let ngDevMode;\n\nexport class HttpConfig {\n\n readonly aliases: HttpConfigAliases;\n readonly prefix: string;\n readonly defaultAlias: string;\n readonly disableErrorParsing: boolean;\n\n constructor(data: HttpConfigData) {\n // Get the data from the config.\n this.prefix = data?.alias?.prefix ?? '$';\n this.disableErrorParsing = data?.disableErrorParsing ?? false;\n\n // Parse the aliases.\n const standardAlias = data?.alias?.standard ?? 'api';\n this.aliases = this.parseAliases(data?.url, standardAlias);\n\n // Get the default alias.\n const firstAvailableAlias = Object.keys(this.aliases ?? {})?.[0];\n this.defaultAlias = `${this.prefix}${firstAvailableAlias}`;\n }\n\n private parseAliases = (value: HttpConfigUrl, standardAlias: string) => {\n if (typeof value === 'string') {\n value = {[standardAlias]: value};\n }\n\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n const stringRegex = /^[a-zA-Z]+$/;\n for (const alias in value) {\n if (value.hasOwnProperty(alias) && !stringRegex.test(alias)) {\n console?.warn?.(`[HttpModule]: Invalid HTTP-alias in HttpConfig named \"${alias}\"; only latin characters should be used.`);\n }\n }\n }\n\n return value;\n };\n\n}\n","import {HttpErrorResponse} from '@angular/common/http';\n\nexport class HttpError extends HttpErrorResponse {\n\n constructor(error: HttpErrorResponse) {\n super(error);\n }\n\n get<T = any>(token: string, delimiter: string = '.') {\n const error = this.error ?? {};\n return (token ?? '')\n .split(delimiter)\n .reduce((previous, current) => previous?.[current] ? previous?.[current] : null, error) as T;\n }\n\n has(token: string, delimiter: string = '.') {\n return !!this.get(token, delimiter);\n }\n\n includes<T = any>(token: string, value: T) {\n const array = this.get<T[]>(token);\n return (array ?? []).includes(value);\n }\n\n}\n","import {HttpHandler, HttpInterceptor, HttpRequest} from '@angular/common/http';\nimport {HttpConfigAliases} from '../http.interfaces';\nimport {HttpConfig} from '../classes/http.config';\nimport {Injectable} from '@angular/core';\n\ndeclare let ngDevMode;\n\n@Injectable()\nexport class BaseUrlInterceptor implements HttpInterceptor {\n\n // Aliases.\n private readonly _aliases: HttpConfigAliases = this._config?.aliases;\n private readonly _prefix: string = this._config?.prefix;\n private readonly _extractRegex: RegExp = new RegExp(`\\\\${this._prefix}[a-zA-Z]+`);\n\n constructor(private _config: HttpConfig) {\n }\n\n intercept(request: HttpRequest<unknown>, next: HttpHandler) {\n const url = this.getUrlBasedOnAlias(request.url);\n const modified = request.clone({url});\n\n return next.handle(modified);\n }\n\n private getUrlBasedOnAlias(url: string) {\n const matches = this._extractRegex.exec(url);\n if (!matches) {\n return url;\n }\n\n return matches.reduce((previous, current) => {\n const alias = this.getAlias(current);\n if (!alias) {\n return previous;\n }\n\n return previous.replace(current, alias);\n }, url);\n }\n\n private getAlias(value: string) {\n const alias = value.replace(this._prefix, '');\n const fetched = this._aliases?.[alias] ?? null;\n if (fetched) {\n return fetched;\n }\n\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n const available = Object.keys(this._aliases)\n .map(item => `\\$${item}`)\n .join(', ');\n console?.warn?.(`[HttpModule]: Used an invalid HTTP-alias named \"${value}\", skipped parsing; Available aliases is one of (${available}).`);\n }\n\n return null;\n }\n\n}\n","import {HttpErrorResponse, HttpHandler, HttpInterceptor, HttpRequest} from '@angular/common/http';\nimport {HttpConfig} from '../classes/http.config';\nimport {HttpError} from '../classes/http.error';\nimport {catchError} from 'rxjs/operators';\nimport {Injectable} from '@angular/core';\nimport {throwError} from 'rxjs';\n\n@Injectable()\nexport class ErrorInterceptor implements HttpInterceptor {\n\n // State.\n private readonly _disabled = this._config?.disableErrorParsing ?? false;\n\n constructor(private _config: HttpConfig) {\n }\n\n intercept(request: HttpRequest<unknown>, next: HttpHandler) {\n return next.handle(request).pipe(\n catchError(error => {\n // If we have a matching http error response\n // re-map it with our custom class (if not disabled).\n if (!this._disabled && error instanceof HttpErrorResponse) {\n const parsed = new HttpError(error);\n return throwError(() => parsed);\n }\n\n // We did not match anything, just re-trow the error.\n return throwError(() => error);\n })\n );\n }\n\n}\n","import {InjectionToken, ModuleWithProviders, NgModule, Optional, SkipSelf} from '@angular/core';\nimport {HTTP_INTERCEPTORS, HttpClientModule} from '@angular/common/http';\nimport {BaseUrlInterceptor} from './interceptors/base-url.interceptor';\nimport {ErrorInterceptor} from './interceptors/error.interceptor';\nimport {HttpConfigData} from './http.interfaces';\nimport {HttpConfig} from './classes/http.config';\n\n@NgModule({\n imports: [HttpClientModule]\n})\nexport class HttpModule {\n\n constructor(@Optional() @SkipSelf() private _parent?: HttpModule) {\n if (this._parent) {\n throw new Error('HttpModule is already loaded; Import it in the core module only.');\n }\n }\n\n static forRoot(config: HttpConfigData): ModuleWithProviders<HttpModule> {\n return {\n ngModule: HttpModule,\n providers: [\n {provide: HTTP_CONFIGURATION_DATA, useValue: config},\n {provide: HttpConfig, useFactory: createHttpConfig, deps: [HTTP_CONFIGURATION_DATA]},\n {provide: HTTP_INTERCEPTORS, useClass: BaseUrlInterceptor, multi: true},\n {provide: HTTP_INTERCEPTORS, useClass: ErrorInterceptor, multi: true}\n ]\n };\n }\n\n}\n\nexport const HTTP_CONFIGURATION_DATA = new InjectionToken<HttpConfigData>('HTTP_CONFIGURATION_DATA');\n\nexport function createHttpConfig(data: HttpConfigData) {\n return new HttpConfig(data);\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["i1.HttpConfig"],"mappings":";;;;;;MAIa,UAAU,CAAA;AAOnB,IAAA,WAAA,CAAY,IAAoB,EAAA;AAcxB,QAAA,IAAA,CAAA,YAAY,GAAG,CAAC,KAAoB,EAAE,aAAqB,KAAI;AACnE,YAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;gBAC3B,KAAK,GAAG,EAAC,CAAC,aAAa,GAAG,KAAK,EAAC,CAAC;AACpC,aAAA;AAED,YAAA,IAAI,OAAO,SAAS,KAAK,WAAW,IAAI,SAAS,EAAE;gBAC/C,MAAM,WAAW,GAAG,aAAa,CAAC;AAClC,gBAAA,KAAK,MAAM,KAAK,IAAI,KAAK,EAAE;AACvB,oBAAA,IAAI,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;wBACzD,OAAO,EAAE,IAAI,GAAG,yDAAyD,KAAK,CAAA,wCAAA,CAA0C,CAAC,CAAC;AAC7H,qBAAA;AACJ,iBAAA;AACJ,aAAA;AAED,YAAA,OAAO,KAAK,CAAC;AACjB,SAAC,CAAC;;QA3BE,IAAI,CAAC,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,IAAI,GAAG,CAAC;QACzC,IAAI,CAAC,mBAAmB,GAAG,IAAI,EAAE,mBAAmB,IAAI,KAAK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,UAAA,EAAA,QAAA,EAAA,IAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAAV,UAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,UAAU,YAFT,gBAAgB,CAAA,EAAA,CAAA,CAAA;AAEjB,UAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,UAAU,YAFT,gBAAgB,CAAA,EAAA,CAAA,CAAA;2FAEjB,UAAU,EAAA,UAAA,EAAA,CAAA;kBAHtB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACN,OAAO,EAAE,CAAC,gBAAgB,CAAC;AAC9B,iBAAA,CAAA;;0BAGgB,QAAQ;;0BAAI,QAAQ;;MAoBxB,uBAAuB,GAAG,IAAI,cAAc,CAAiB,yBAAyB,EAAE;AAE/F,SAAU,gBAAgB,CAAC,IAAoB,EAAA;AACjD,IAAA,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;AAChC;;ACpCA;;AAEG;;;;"}
@@ -1,10 +1,10 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, Optional, Inject, Directive, Input, Component, ChangeDetectionStrategy, ViewEncapsulation, ContentChildren, Injectable, Pipe, APP_INITIALIZER, LOCALE_ID, NgModule } from '@angular/core';
2
+ import { InjectionToken, Optional, Inject, Directive, Input, Component, ChangeDetectionStrategy, ViewEncapsulation, ContentChildren, Injectable, inject, LOCALE_ID, Pipe, APP_INITIALIZER, NgModule } from '@angular/core';
3
3
  import * as i1 from '@angular/common';
4
4
  import { formatDate, DOCUMENT, CommonModule } from '@angular/common';
5
5
  import { __decorate, __param } from 'tslib';
6
- import { startWith } from 'rxjs/operators';
7
- import { Subscription } from 'rxjs';
6
+ import { startWith, map, distinctUntilChanged } from 'rxjs/operators';
7
+ import { Subscription, BehaviorSubject, of } from 'rxjs';
8
8
  import * as i2 from '@bravobit/bb-foundation/utils';
9
9
  import { UtilsModule } from '@bravobit/bb-foundation/utils';
10
10
  import * as i2$1 from '@bravobit/bb-foundation';
@@ -252,7 +252,6 @@ class LocalizeDictionary {
252
252
  const dictionaryIds = (Array.isArray(to) ? to : [to]);
253
253
  const dictionaries = [];
254
254
  for (const dictionaryId of dictionaryIds) {
255
- console.log(`Making sure dictionary "${dictionaryId}" is loaded.`);
256
255
  const dictionary = await this._localize.load(dictionaryId);
257
256
  dictionaries.push(dictionary);
258
257
  }
@@ -274,11 +273,10 @@ class LocalizeDictionary {
274
273
  }
275
274
  }
276
275
  const compareDictionaryIds = dictionaries.map(dictionary => dictionary?.id).join(', ');
277
- console.log(`Comparing currency dictionary [${this.id}] with [${compareDictionaryIds}]...`);
278
276
  for (const warning of warnings) {
279
277
  console?.warn?.(`Dictionary "${warning.dictionary}" is missing token "${warning.value}"`);
280
278
  }
281
- console?.warn?.(`Total of ${warnings.length} warning(s) found.`);
279
+ console?.warn?.(`Total of ${warnings.length} warning(s) found while comparing "${this.id}" -> [${compareDictionaryIds}].`);
282
280
  }
283
281
  }
284
282
  count() {
@@ -407,9 +405,9 @@ class BbLocalizeTemplate {
407
405
  this.name = null;
408
406
  }
409
407
  }
410
- BbLocalizeTemplate.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: BbLocalizeTemplate, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
411
- BbLocalizeTemplate.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0", type: BbLocalizeTemplate, selector: "[bbLocalizeTemplate]", inputs: { name: ["bbLocalizeTemplate", "name"] }, ngImport: i0 });
412
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: BbLocalizeTemplate, decorators: [{
408
+ BbLocalizeTemplate.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: BbLocalizeTemplate, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
409
+ BbLocalizeTemplate.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.1", type: BbLocalizeTemplate, selector: "[bbLocalizeTemplate]", inputs: { name: ["bbLocalizeTemplate", "name"] }, ngImport: i0 });
410
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: BbLocalizeTemplate, decorators: [{
413
411
  type: Directive,
414
412
  args: [{
415
413
  selector: '[bbLocalizeTemplate]'
@@ -484,9 +482,9 @@ class BbLocalizeString {
484
482
  ];
485
483
  }
486
484
  }
487
- BbLocalizeString.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: BbLocalizeString, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
488
- BbLocalizeString.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: BbLocalizeString, selector: "bb-localize-string, [bb-localize-string]", inputs: { substitutions: "substitutions", value: "value" }, host: { classAttribute: "bb-localize-string" }, queries: [{ propertyName: "items", predicate: BbLocalizeTemplate }], ngImport: i0, template: "<ng-container *ngFor=\"let component of components\">\n <ng-template [bbTemplate]=\"component\">{{ component }}</ng-template>\n</ng-container>\n", styles: [".bb-localize-string{display:inline}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.BbTemplate, selector: "[bbTemplate]", inputs: ["bbTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
489
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: BbLocalizeString, decorators: [{
485
+ BbLocalizeString.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: BbLocalizeString, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
486
+ BbLocalizeString.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.1", type: BbLocalizeString, selector: "bb-localize-string, [bb-localize-string]", inputs: { substitutions: "substitutions", value: "value" }, host: { classAttribute: "bb-localize-string" }, queries: [{ propertyName: "items", predicate: BbLocalizeTemplate }], ngImport: i0, template: "<ng-container *ngFor=\"let component of components\">\n <ng-template [bbTemplate]=\"component\">{{ component }}</ng-template>\n</ng-container>\n", styles: [".bb-localize-string{display:inline}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.BbTemplate, selector: "[bbTemplate]", inputs: ["bbTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
487
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: BbLocalizeString, decorators: [{
490
488
  type: Component,
491
489
  args: [{ selector: 'bb-localize-string, [bb-localize-string]', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, preserveWhitespaces: false, host: {
492
490
  'class': 'bb-localize-string'
@@ -515,7 +513,9 @@ class Localize {
515
513
  this._bestMatchingLanguage = this.retrieveBestMatchingLanguage();
516
514
  this._loadedDictionaries = new Map();
517
515
  // Current dictionary.
518
- this._current = null;
516
+ this._current$ = new BehaviorSubject(null);
517
+ // State changes.
518
+ this.dictionaryChanges$ = this._current$.asObservable();
519
519
  this.convertToParams = (tokenOrParams) => {
520
520
  if (typeof tokenOrParams !== 'string') {
521
521
  // Destruct the params from the object.
@@ -533,7 +533,7 @@ class Localize {
533
533
  return this._availableLanguages ?? [];
534
534
  }
535
535
  get current() {
536
- return this._current;
536
+ return this._current$.getValue();
537
537
  }
538
538
  async load(id) {
539
539
  if (id === null || id === undefined) {
@@ -553,17 +553,23 @@ class Localize {
553
553
  this._loadedDictionaries.set(id, dictionary);
554
554
  return dictionary;
555
555
  }
556
+ async loadAllLanguages() {
557
+ for (const language of this.languages) {
558
+ await this.load(this.current?.id);
559
+ }
560
+ }
556
561
  async switch(id, options) {
557
- this._current = await this.load(id);
562
+ const dictionary = await this.load(id);
563
+ this._current$.next(dictionary);
558
564
  const cache = options?.cache ?? true;
559
565
  if (cache) {
560
- this._storage.cookie.set(this._storageToken, this._current?.id, {});
566
+ this._storage.cookie.set(this._storageToken, dictionary?.id, {});
561
567
  }
562
568
  const reload = options?.reload ?? false;
563
569
  if (reload) {
564
570
  this._window?.location?.reload?.();
565
571
  }
566
- return this._current;
572
+ return dictionary;
567
573
  }
568
574
  select(id) {
569
575
  if (!this._loadedDictionaries.has(id)) {
@@ -572,7 +578,10 @@ class Localize {
572
578
  return this._loadedDictionaries.get(id);
573
579
  }
574
580
  initialize() {
575
- return async () => this.switch(this._bestMatchingLanguage?.id, { reload: false, cache: false });
581
+ return async () => {
582
+ await this.switch(this._bestMatchingLanguage?.id, { reload: false, cache: false });
583
+ return this.compareDictionaries();
584
+ };
576
585
  }
577
586
  clear() {
578
587
  this._storage.cookie.remove(this._storageToken);
@@ -618,7 +627,7 @@ class Localize {
618
627
  }
619
628
  getDictionary(id) {
620
629
  if (id === null || id === undefined) {
621
- return this._current;
630
+ return this.current;
622
631
  }
623
632
  return this.select(id);
624
633
  }
@@ -629,10 +638,20 @@ class Localize {
629
638
  }
630
639
  element.lang = this._bestMatchingLanguage?.supported?.[0] ?? this._bestMatchingLanguage?.locale;
631
640
  }
641
+ async compareDictionaries() {
642
+ const compareDictionaries = this._config.compareDictionaries ?? false;
643
+ if (!compareDictionaries || !this.current) {
644
+ return;
645
+ }
646
+ const languageIds = (this.languages ?? [])
647
+ ?.filter(language => language?.id !== this.current?.id)
648
+ ?.map(language => language?.id);
649
+ return await this.current.compare(languageIds);
650
+ }
632
651
  }
633
- Localize.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: Localize, deps: [{ token: i1$1.Storage }, { token: i2$1.Languages }, { token: LocalizeMissingHandler }, { token: LocalizeConfig, optional: true }, { token: WINDOW, optional: true }, { token: DOCUMENT, optional: true }, { token: LOCALIZE_TRANSFORM, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
634
- Localize.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: Localize });
635
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: Localize, decorators: [{
652
+ Localize.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: Localize, deps: [{ token: i1$1.Storage }, { token: i2$1.Languages }, { token: LocalizeMissingHandler }, { token: LocalizeConfig, optional: true }, { token: WINDOW, optional: true }, { token: DOCUMENT, optional: true }, { token: LOCALIZE_TRANSFORM, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
653
+ Localize.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: Localize });
654
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: Localize, decorators: [{
636
655
  type: Injectable
637
656
  }], ctorParameters: function () { return [{ type: i1$1.Storage }, { type: i2$1.Languages }, { type: LocalizeMissingHandler }, { type: LocalizeConfig, decorators: [{
638
657
  type: Optional
@@ -653,6 +672,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
653
672
  args: [LOCALIZE_TRANSFORM]
654
673
  }] }]; } });
655
674
 
675
+ const LOCALIZE_ID = new InjectionToken('An abstraction over locale changes', {
676
+ factory: () => {
677
+ const localize = inject(Localize, { optional: true });
678
+ if (!localize) {
679
+ return of(inject(LOCALE_ID));
680
+ }
681
+ return localize.dictionaryChanges$.pipe(map(dictionary => dictionary?.locale ?? null), distinctUntilChanged(), startWith(localize?.current?.locale ?? null));
682
+ }
683
+ });
684
+
656
685
  class BbLocalize {
657
686
  constructor(_localize) {
658
687
  this._localize = _localize;
@@ -685,9 +714,9 @@ class BbLocalize {
685
714
  return { ...params, ...options };
686
715
  }
687
716
  }
688
- BbLocalize.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: BbLocalize, deps: [{ token: Localize, optional: true }], target: i0.ɵɵFactoryTarget.Pipe });
689
- BbLocalize.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.2.0", ngImport: i0, type: BbLocalize, name: "bbLocalize" });
690
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: BbLocalize, decorators: [{
717
+ BbLocalize.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: BbLocalize, deps: [{ token: Localize, optional: true }], target: i0.ɵɵFactoryTarget.Pipe });
718
+ BbLocalize.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.2.1", ngImport: i0, type: BbLocalize, name: "bbLocalize" });
719
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: BbLocalize, decorators: [{
691
720
  type: Pipe,
692
721
  args: [{
693
722
  name: 'bbLocalize'
@@ -701,6 +730,9 @@ class LocalizeModule {
701
730
  if (config?.languages?.length <= 0) {
702
731
  throw new Error('One or more languages should be supplied.');
703
732
  }
733
+ if (config?.compareDictionaries && config?.mode === 'manual') {
734
+ console?.warn?.('You cannot enable "compareDictionaries" when having mode set to "manual"; This setting will be ignored.');
735
+ }
704
736
  const mode = config?.mode ?? 'automatic';
705
737
  return {
706
738
  ngModule: LocalizeModule,
@@ -727,14 +759,14 @@ class LocalizeModule {
727
759
  };
728
760
  }
729
761
  }
730
- LocalizeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: LocalizeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
731
- LocalizeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.0", ngImport: i0, type: LocalizeModule, declarations: [BbLocalize,
762
+ LocalizeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: LocalizeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
763
+ LocalizeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.1", ngImport: i0, type: LocalizeModule, declarations: [BbLocalize,
732
764
  BbLocalizeString,
733
765
  BbLocalizeTemplate], imports: [CommonModule, UtilsModule], exports: [BbLocalize,
734
766
  BbLocalizeString,
735
767
  BbLocalizeTemplate] });
736
- LocalizeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: LocalizeModule, imports: [CommonModule, UtilsModule] });
737
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: LocalizeModule, decorators: [{
768
+ LocalizeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: LocalizeModule, imports: [CommonModule, UtilsModule] });
769
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.1", ngImport: i0, type: LocalizeModule, decorators: [{
738
770
  type: NgModule,
739
771
  args: [{
740
772
  imports: [CommonModule, UtilsModule],
@@ -761,5 +793,5 @@ function getLocale(localize) {
761
793
  * Generated bundle index. Do not edit.
762
794
  */
763
795
 
764
- export { BbLocalize, BbLocalizeString, BbLocalizeTemplate, LOCALIZE_FUNCTION, LOCALIZE_TRANSFORM, Localize, LocalizeConfig, LocalizeDateFunction, LocalizeDictionary, LocalizeDictionaryContext, LocalizeDictionaryData, LocalizeInterpolateTransform, LocalizeLowercaseFunction, LocalizeMissingHandler, LocalizeModule, LocalizeReferenceTransform, LocalizeTransform, LocalizeUppercaseFunction, extraDutchDictionary, extraEnglishDictionary, getLocale, initializeLocale };
796
+ export { BbLocalize, BbLocalizeString, BbLocalizeTemplate, LOCALIZE_FUNCTION, LOCALIZE_ID, LOCALIZE_TRANSFORM, Localize, LocalizeConfig, LocalizeDateFunction, LocalizeDictionary, LocalizeDictionaryContext, LocalizeDictionaryData, LocalizeInterpolateTransform, LocalizeLowercaseFunction, LocalizeMissingHandler, LocalizeModule, LocalizeReferenceTransform, LocalizeTransform, LocalizeUppercaseFunction, extraDutchDictionary, extraEnglishDictionary, getLocale, initializeLocale };
765
797
  //# sourceMappingURL=bravobit-bb-foundation-localize.mjs.map