@dereekb/dbx-web 9.23.18 → 9.23.19

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 (40) hide show
  1. package/calendar/package.json +2 -2
  2. package/esm2020/lib/layout/text/address.component.mjs +6 -5
  3. package/esm2020/lib/router/layout/anchor/anchor.component.mjs +15 -3
  4. package/esm2020/mapbox/lib/index.mjs +4 -1
  5. package/esm2020/mapbox/lib/mapbox.injection.component.mjs +32 -0
  6. package/esm2020/mapbox/lib/mapbox.injection.store.mjs +39 -0
  7. package/esm2020/mapbox/lib/mapbox.injection.store.provide.mjs +52 -0
  8. package/esm2020/mapbox/lib/mapbox.marker.component.mjs +5 -5
  9. package/esm2020/mapbox/lib/mapbox.marker.mjs +1 -1
  10. package/esm2020/mapbox/lib/mapbox.module.mjs +5 -1
  11. package/fesm2015/dereekb-dbx-web-mapbox.mjs +121 -8
  12. package/fesm2015/dereekb-dbx-web-mapbox.mjs.map +1 -1
  13. package/fesm2015/dereekb-dbx-web.mjs +20 -5
  14. package/fesm2015/dereekb-dbx-web.mjs.map +1 -1
  15. package/fesm2020/dereekb-dbx-web-mapbox.mjs +117 -7
  16. package/fesm2020/dereekb-dbx-web-mapbox.mjs.map +1 -1
  17. package/fesm2020/dereekb-dbx-web.mjs +18 -5
  18. package/fesm2020/dereekb-dbx-web.mjs.map +1 -1
  19. package/lib/router/layout/anchor/anchor.component.d.ts +2 -0
  20. package/mapbox/esm2020/lib/index.mjs +4 -1
  21. package/mapbox/esm2020/lib/mapbox.injection.component.mjs +32 -0
  22. package/mapbox/esm2020/lib/mapbox.injection.store.mjs +39 -0
  23. package/mapbox/esm2020/lib/mapbox.injection.store.provide.mjs +52 -0
  24. package/mapbox/esm2020/lib/mapbox.marker.component.mjs +5 -5
  25. package/mapbox/esm2020/lib/mapbox.marker.mjs +1 -1
  26. package/mapbox/esm2020/lib/mapbox.module.mjs +5 -1
  27. package/mapbox/fesm2015/dereekb-dbx-web-mapbox.mjs +121 -8
  28. package/mapbox/fesm2015/dereekb-dbx-web-mapbox.mjs.map +1 -1
  29. package/mapbox/fesm2020/dereekb-dbx-web-mapbox.mjs +117 -7
  30. package/mapbox/fesm2020/dereekb-dbx-web-mapbox.mjs.map +1 -1
  31. package/mapbox/lib/index.d.ts +3 -0
  32. package/mapbox/lib/mapbox.injection.component.d.ts +16 -0
  33. package/mapbox/lib/mapbox.injection.store.d.ts +45 -0
  34. package/mapbox/lib/mapbox.injection.store.provide.d.ts +24 -0
  35. package/mapbox/lib/mapbox.marker.component.d.ts +3 -2
  36. package/mapbox/lib/mapbox.marker.d.ts +3 -2
  37. package/mapbox/lib/mapbox.module.d.ts +14 -13
  38. package/mapbox/package.json +3 -3
  39. package/package.json +3 -3
  40. package/table/package.json +3 -3
@@ -1,8 +1,8 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, Host, Optional, Inject, Directive, Component, ElementRef, ViewChild, Input, ChangeDetectionStrategy, SkipSelf, Injector, NgModule } from '@angular/core';
2
+ import { Injectable, Host, Optional, Inject, Component, ChangeDetectionStrategy, SkipSelf, Directive, Injector, ElementRef, ViewChild, Input, NgModule } from '@angular/core';
3
3
  import * as i2 from '@dereekb/dbx-core';
4
4
  import { safeMarkForCheck, safeDetectChanges, AbstractSubscriptionDirective, DbxInjectionComponentModule } from '@dereekb/dbx-core';
5
- import { cleanup, filterMaybe, onTrueToFalse, SubscriptionObject, asObservable } from '@dereekb/rxjs';
5
+ import { cleanup, filterMaybe, onTrueToFalse, SubscriptionObject, distinctUntilMapHasDifferentKeys, asObservable } from '@dereekb/rxjs';
6
6
  import { switchMap, NEVER, defaultIfEmpty, map, tap, EMPTY, distinctUntilChanged, shareReplay, of, combineLatest, filter, first, startWith, interval, Subject, merge, throttleTime, BehaviorSubject, combineLatestWith } from 'rxjs';
7
7
  import { latLngPointFunction, latLngBoundFunction, latLngBoundFromInput, filterUndefinedValues, isSameLatLngPoint, isDefaultLatLngPoint, swMostLatLngPoint, neMostLatLngPoint, isSameLatLngBound, diffLatLngBoundPoints, latLngBoundWrapsMap, isWithinLatLngBoundFunction, overlapsLatLngBoundFunction, vectorsAreEqual, latLngBoundCenterPoint, addLatLngPoints, latLngPoint, DestroyFunctionObject, getValueFromGetter, LAT_LONG_10M_PRECISION, roundNumberToStepFunction } from '@dereekb/util';
8
8
  import { ComponentStore } from '@ngrx/component-store';
@@ -557,6 +557,113 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
557
557
  }]
558
558
  }], ctorParameters: function () { return [{ type: DbxMapboxMapStore }]; } });
559
559
 
560
+ /**
561
+ * Store used for storing injectable content into the map.
562
+ */
563
+ class DbxMapboxInjectionStore extends ComponentStore {
564
+ constructor() {
565
+ super({
566
+ map: new Map()
567
+ });
568
+ this.map$ = this.state$.pipe(map((x) => x.map), distinctUntilMapHasDifferentKeys(), shareReplay(1));
569
+ this.allInjectionConfigs$ = this.map$.pipe(map((x) => Array.from(x.values())), shareReplay(1));
570
+ // MARK: State Changes
571
+ this.addInjectionConfig = this.updater(updateDbxMapboxMapInjectionStoreStateWithInjectionConfig);
572
+ this.removeInjectionConfigWithKey = this.updater(updateDbxMapboxMapInjectionStoreStateWithRemovedKey);
573
+ }
574
+ }
575
+ DbxMapboxInjectionStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxMapboxInjectionStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
576
+ DbxMapboxInjectionStore.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxMapboxInjectionStore });
577
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxMapboxInjectionStore, decorators: [{
578
+ type: Injectable
579
+ }], ctorParameters: function () { return []; } });
580
+ function updateDbxMapboxMapInjectionStoreStateWithInjectionConfig(state, config) {
581
+ const map = new Map(state.map).set(config.key, config);
582
+ return { ...state, map };
583
+ }
584
+ function updateDbxMapboxMapInjectionStoreStateWithRemovedKey(state, key) {
585
+ // only create a new state if the key is going to get removed
586
+ if (state.map.has(key)) {
587
+ const map = new Map(state.map);
588
+ map.delete(key);
589
+ state = { ...state, map };
590
+ }
591
+ return state;
592
+ }
593
+
594
+ /**
595
+ * Injects the components configured in the DbxMapboxInjectionStore into the view.
596
+ */
597
+ class DbxMapboxInjectionComponent {
598
+ constructor(dbxMapboxMapKeyInjectionStore, injector) {
599
+ this.dbxMapboxMapKeyInjectionStore = dbxMapboxMapKeyInjectionStore;
600
+ this.injector = injector;
601
+ this.entries$ = this.dbxMapboxMapKeyInjectionStore.allInjectionConfigs$.pipe(shareReplay(1));
602
+ }
603
+ }
604
+ DbxMapboxInjectionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxMapboxInjectionComponent, deps: [{ token: DbxMapboxInjectionStore }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
605
+ DbxMapboxInjectionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxMapboxInjectionComponent, selector: "dbx-mapbox-injection", ngImport: i0, template: `
606
+ <dbx-injection-array [entries]="entries$ | async"></dbx-injection-array>
607
+ `, isInline: true, dependencies: [{ kind: "component", type: i2.DbxInjectionArrayComponent, selector: "dbx-injection-array", inputs: ["entries"] }, { kind: "pipe", type: i2$1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
608
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxMapboxInjectionComponent, decorators: [{
609
+ type: Component,
610
+ args: [{
611
+ selector: 'dbx-mapbox-injection',
612
+ template: `
613
+ <dbx-injection-array [entries]="entries$ | async"></dbx-injection-array>
614
+ `,
615
+ changeDetection: ChangeDetectionStrategy.OnPush
616
+ }]
617
+ }], ctorParameters: function () { return [{ type: DbxMapboxInjectionStore }, { type: i0.Injector }]; } });
618
+
619
+ /**
620
+ * Token used by provideMapboxInjectionStoreIfDoesNotExist() to prevent injecting a parent DbxMapboxInjectionStore into the child view.
621
+ */
622
+ class DbxMapboxInjectionStoreProviderBlock {
623
+ constructor(dbxMapboxInjectionStore) {
624
+ this.dbxMapboxInjectionStore = dbxMapboxInjectionStore;
625
+ }
626
+ }
627
+ DbxMapboxInjectionStoreProviderBlock.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxMapboxInjectionStoreProviderBlock, deps: [{ token: DbxMapboxInjectionStore, skipSelf: true }], target: i0.ɵɵFactoryTarget.Injectable });
628
+ DbxMapboxInjectionStoreProviderBlock.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxMapboxInjectionStoreProviderBlock });
629
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxMapboxInjectionStoreProviderBlock, decorators: [{
630
+ type: Injectable
631
+ }], ctorParameters: function () { return [{ type: DbxMapboxInjectionStore, decorators: [{
632
+ type: SkipSelf
633
+ }] }]; } });
634
+ class DbxMapboxInjectionStoreInjectionBlockDirective {
635
+ }
636
+ DbxMapboxInjectionStoreInjectionBlockDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxMapboxInjectionStoreInjectionBlockDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
637
+ DbxMapboxInjectionStoreInjectionBlockDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.12", type: DbxMapboxInjectionStoreInjectionBlockDirective, selector: "[dbxMapboxInjectionStoreParentBlocker]", providers: [DbxMapboxInjectionStoreProviderBlock], ngImport: i0 });
638
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxMapboxInjectionStoreInjectionBlockDirective, decorators: [{
639
+ type: Directive,
640
+ args: [{
641
+ selector: '[dbxMapboxInjectionStoreParentBlocker]',
642
+ providers: [DbxMapboxInjectionStoreProviderBlock]
643
+ }]
644
+ }] });
645
+ /**
646
+ * Creates a Provider that initializes a new DbxMapboxInjectionStore if a parent does not exist.
647
+ *
648
+ * If a DbxMapboxInjectionStoreInjectionBlock is available in the context, and references the same dbxMapboxInjectionStore that is attempting to be injected, a new DbxMapboxInjectionStore is created.
649
+ *
650
+ * @returns
651
+ */
652
+ function provideMapboxInjectionStoreIfParentIsUnavailable() {
653
+ return {
654
+ provide: DbxMapboxInjectionStore,
655
+ useFactory: (parentInjector, dbxMapboxInjectionStoreInjectionBlock, dbxMapboxInjectionStore) => {
656
+ if (!dbxMapboxInjectionStore || (dbxMapboxInjectionStore && dbxMapboxInjectionStoreInjectionBlock != null && dbxMapboxInjectionStoreInjectionBlock.dbxMapboxInjectionStore === dbxMapboxInjectionStore)) {
657
+ // create a new dbxMapboxInjectionStore to use
658
+ const injector = Injector.create({ providers: [{ provide: DbxMapboxInjectionStore }], parent: parentInjector });
659
+ dbxMapboxInjectionStore = injector.get(DbxMapboxInjectionStore);
660
+ }
661
+ return dbxMapboxInjectionStore;
662
+ },
663
+ deps: [Injector, [new Optional(), DbxMapboxInjectionStoreProviderBlock], [new Optional(), new SkipSelf(), DbxMapboxInjectionStore]]
664
+ };
665
+ }
666
+
560
667
  /**
561
668
  * Directive that configures a MapComponent with content from DbxMapboxService. Connects a host MapService to a parent DbxMapboxMapStore if available.
562
669
  */
@@ -973,11 +1080,11 @@ class DbxMapboxMarkerComponent {
973
1080
  return style;
974
1081
  }
975
1082
  get presentation() {
976
- return this._marker.presentation ?? 'normal';
1083
+ return this._marker?.presentation ?? 'normal';
977
1084
  }
978
1085
  get presentationClasses() {
979
1086
  const presentation = this.presentation;
980
- const markerClasses = this._marker.markerClasses;
1087
+ const markerClasses = this._marker?.markerClasses;
981
1088
  let cssClasses = '';
982
1089
  switch (presentation) {
983
1090
  case 'chip':
@@ -1003,7 +1110,7 @@ class DbxMapboxMarkerComponent {
1003
1110
  DbxMapboxMarkerComponent._latLngPoint = latLngPointFunction({ wrap: true });
1004
1111
  DbxMapboxMarkerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxMapboxMarkerComponent, deps: [{ token: DbxMapboxChangeService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1005
1112
  DbxMapboxMarkerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxMapboxMarkerComponent, selector: "dbx-mapbox-marker", inputs: { marker: "marker" }, ngImport: i0, template: `
1006
- <mgl-marker [lngLat]="latLng">
1113
+ <mgl-marker *ngIf="marker" [lngLat]="latLng">
1007
1114
  <dbx-anchor [anchor]="anchor">
1008
1115
  <div class="dbx-mapbox-marker" [ngClass]="presentationClasses">
1009
1116
  <div class="dbx-mapbox-marker-icon-content" [ngStyle]="style">
@@ -1017,7 +1124,7 @@ DbxMapboxMarkerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0
1017
1124
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxMapboxMarkerComponent, decorators: [{
1018
1125
  type: Component,
1019
1126
  args: [{ selector: 'dbx-mapbox-marker', template: `
1020
- <mgl-marker [lngLat]="latLng">
1127
+ <mgl-marker *ngIf="marker" [lngLat]="latLng">
1021
1128
  <dbx-anchor [anchor]="anchor">
1022
1129
  <div class="dbx-mapbox-marker" [ngClass]="presentationClasses">
1023
1130
  <div class="dbx-mapbox-marker-icon-content" [ngStyle]="style">
@@ -1094,6 +1201,7 @@ const declarations = [
1094
1201
  DbxMapboxMapDirective,
1095
1202
  DbxMapboxLayoutComponent,
1096
1203
  DbxMapboxLayoutDrawerComponent,
1204
+ DbxMapboxInjectionComponent,
1097
1205
  DbxMapboxMenuComponent,
1098
1206
  DbxMapboxMarkerComponent,
1099
1207
  DbxMapboxMarkersComponent,
@@ -1118,6 +1226,7 @@ DbxMapboxModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version
1118
1226
  DbxMapboxMapDirective,
1119
1227
  DbxMapboxLayoutComponent,
1120
1228
  DbxMapboxLayoutDrawerComponent,
1229
+ DbxMapboxInjectionComponent,
1121
1230
  DbxMapboxMenuComponent,
1122
1231
  DbxMapboxMarkerComponent,
1123
1232
  DbxMapboxMarkersComponent,
@@ -1135,6 +1244,7 @@ DbxMapboxModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version
1135
1244
  DbxMapboxMapDirective,
1136
1245
  DbxMapboxLayoutComponent,
1137
1246
  DbxMapboxLayoutDrawerComponent,
1247
+ DbxMapboxInjectionComponent,
1138
1248
  DbxMapboxMenuComponent,
1139
1249
  DbxMapboxMarkerComponent,
1140
1250
  DbxMapboxMarkersComponent,
@@ -1255,5 +1365,5 @@ function mapboxZoomLevel(input) {
1255
1365
  * Generated bundle index. Do not edit.
1256
1366
  */
1257
1367
 
1258
- export { DEFAULT_MAPBOX_CENTER, DEFAULT_MAPBOX_MAP_STORE_TIMER_REFRESH_PERIOD, DEFAULT_MAPBOX_STYLE, DEFAULT_MAPBOX_ZOOM, DbxMapboxChangeDetectorRefService, DbxMapboxChangeService, DbxMapboxConfig, DbxMapboxLayoutComponent, DbxMapboxLayoutDrawerComponent, DbxMapboxMapDirective, DbxMapboxMapStore, DbxMapboxMapStoreInjectionBlockDirective, DbxMapboxMapStoreProviderBlock, DbxMapboxMarkerComponent, DbxMapboxMarkersComponent, DbxMapboxMenuComponent, DbxMapboxModule, DbxMapboxService, KNOWN_MAPBOX_STYLES, MAPBOX_MAX_ZOOM_LEVEL, MAPBOX_MIN_ZOOM_LEVEL, dbxMapboxColoredDotStyle, filterByMapboxViewportBound, mapboxViewportBoundFunction, mapboxZoomLevel, provideMapboxStoreIfParentIsUnavailable };
1368
+ export { DEFAULT_MAPBOX_CENTER, DEFAULT_MAPBOX_MAP_STORE_TIMER_REFRESH_PERIOD, DEFAULT_MAPBOX_STYLE, DEFAULT_MAPBOX_ZOOM, DbxMapboxChangeDetectorRefService, DbxMapboxChangeService, DbxMapboxConfig, DbxMapboxInjectionComponent, DbxMapboxInjectionStore, DbxMapboxInjectionStoreInjectionBlockDirective, DbxMapboxInjectionStoreProviderBlock, DbxMapboxLayoutComponent, DbxMapboxLayoutDrawerComponent, DbxMapboxMapDirective, DbxMapboxMapStore, DbxMapboxMapStoreInjectionBlockDirective, DbxMapboxMapStoreProviderBlock, DbxMapboxMarkerComponent, DbxMapboxMarkersComponent, DbxMapboxMenuComponent, DbxMapboxModule, DbxMapboxService, KNOWN_MAPBOX_STYLES, MAPBOX_MAX_ZOOM_LEVEL, MAPBOX_MIN_ZOOM_LEVEL, dbxMapboxColoredDotStyle, filterByMapboxViewportBound, mapboxViewportBoundFunction, mapboxZoomLevel, provideMapboxInjectionStoreIfParentIsUnavailable, provideMapboxStoreIfParentIsUnavailable, updateDbxMapboxMapInjectionStoreStateWithInjectionConfig, updateDbxMapboxMapInjectionStoreStateWithRemovedKey };
1259
1369
  //# sourceMappingURL=dereekb-dbx-web-mapbox.mjs.map