@dereekb/dbx-web 9.5.5 → 9.6.2

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 (33) hide show
  1. package/esm2020/mapbox/lib/index.mjs +3 -1
  2. package/esm2020/mapbox/lib/mapbox.layout.component.mjs +26 -10
  3. package/esm2020/mapbox/lib/mapbox.marker.component.mjs +97 -0
  4. package/esm2020/mapbox/lib/mapbox.mjs +6 -1
  5. package/esm2020/mapbox/lib/mapbox.module.mjs +23 -7
  6. package/esm2020/mapbox/lib/mapbox.service.mjs +2 -2
  7. package/esm2020/mapbox/lib/mapbox.store.mjs +96 -22
  8. package/esm2020/mapbox/lib/mapbox.store.provide.mjs +52 -0
  9. package/fesm2015/dereekb-dbx-web-mapbox.mjs +288 -40
  10. package/fesm2015/dereekb-dbx-web-mapbox.mjs.map +1 -1
  11. package/fesm2020/dereekb-dbx-web-mapbox.mjs +287 -40
  12. package/fesm2020/dereekb-dbx-web-mapbox.mjs.map +1 -1
  13. package/mapbox/esm2020/lib/index.mjs +3 -1
  14. package/mapbox/esm2020/lib/mapbox.layout.component.mjs +26 -10
  15. package/mapbox/esm2020/lib/mapbox.marker.component.mjs +97 -0
  16. package/mapbox/esm2020/lib/mapbox.mjs +6 -1
  17. package/mapbox/esm2020/lib/mapbox.module.mjs +23 -7
  18. package/mapbox/esm2020/lib/mapbox.service.mjs +2 -2
  19. package/mapbox/esm2020/lib/mapbox.store.mjs +96 -22
  20. package/mapbox/esm2020/lib/mapbox.store.provide.mjs +52 -0
  21. package/mapbox/fesm2015/dereekb-dbx-web-mapbox.mjs +288 -40
  22. package/mapbox/fesm2015/dereekb-dbx-web-mapbox.mjs.map +1 -1
  23. package/mapbox/fesm2020/dereekb-dbx-web-mapbox.mjs +287 -40
  24. package/mapbox/fesm2020/dereekb-dbx-web-mapbox.mjs.map +1 -1
  25. package/mapbox/lib/index.d.ts +2 -0
  26. package/mapbox/lib/mapbox.d.ts +5 -2
  27. package/mapbox/lib/mapbox.layout.component.d.ts +4 -1
  28. package/mapbox/lib/mapbox.marker.component.d.ts +51 -0
  29. package/mapbox/lib/mapbox.module.d.ts +11 -7
  30. package/mapbox/lib/mapbox.store.d.ts +17 -0
  31. package/mapbox/lib/mapbox.store.provide.d.ts +24 -0
  32. package/mapbox/package.json +3 -3
  33. package/package.json +3 -3
@@ -1,14 +1,16 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, Optional, Inject, Directive, Host, Component, ElementRef, ViewChild, Input, ChangeDetectionStrategy, NgModule } from '@angular/core';
2
+ import { Injectable, Optional, Inject, Directive, Host, Component, ElementRef, ViewChild, Input, ChangeDetectionStrategy, SkipSelf, Injector, NgModule } from '@angular/core';
3
3
  import * as i2$1 from '@angular/common';
4
4
  import { CommonModule } from '@angular/common';
5
- import { latLngPointFunction, latLngBoundFunction, isSameLatLngPoint, isSameLatLngBound, isWithinLatLngBoundFunction, overlapsLatLngBoundFunction, diffLatLngBoundPoints, latLngBoundCenterPoint, addLatLngPoints, latLngPoint, DestroyFunctionObject } from '@dereekb/util';
5
+ import { latLngPointFunction, latLngBoundFunction, isSameLatLngPoint, isDefaultLatLngPoint, swMostLatLngPoint, neMostLatLngPoint, isSameLatLngBound, latLngBoundWrapsMap, isWithinLatLngBoundFunction, overlapsLatLngBoundFunction, diffLatLngBoundPoints, latLngBoundCenterPoint, addLatLngPoints, latLngPoint, DestroyFunctionObject, getValueFromGetter } from '@dereekb/util';
6
6
  import * as i1 from 'ngx-mapbox-gl';
7
+ import { NgxMapboxGLModule } from 'ngx-mapbox-gl';
7
8
  import { cleanup, filterMaybe, onTrueToFalse, SubscriptionObject } from '@dereekb/rxjs';
8
9
  import { ComponentStore } from '@ngrx/component-store';
9
- import { switchMap, NEVER, defaultIfEmpty, map, tap, distinctUntilChanged, shareReplay, of, combineLatest, filter, first, startWith, interval, Subject, BehaviorSubject, throttleTime, skip } from 'rxjs';
10
+ import { switchMap, NEVER, defaultIfEmpty, map, tap, distinctUntilChanged, shareReplay, of, combineLatest, filter, first, startWith, interval, Subject, BehaviorSubject, throttleTime } from 'rxjs';
10
11
  import * as MapboxGl from 'mapbox-gl';
11
- import { dbxColorBackground, disableRightClickInCdkBackdrop } from '@dereekb/dbx-web';
12
+ import * as i3$1 from '@dereekb/dbx-web';
13
+ import { dbxColorBackground, disableRightClickInCdkBackdrop, DbxRouterAnchorModule } from '@dereekb/dbx-web';
12
14
  import * as i3 from '@angular/material/sidenav';
13
15
  import { MatDrawerContainer, MatSidenavModule } from '@angular/material/sidenav';
14
16
  import * as i4 from '@angular/material/button';
@@ -25,7 +27,7 @@ class DbxMapboxConfig {
25
27
  }
26
28
  const DEFAULT_MAPBOX_STYLE = 'mapbox://styles/mapbox/streets-v11';
27
29
  const DEFAULT_MAPBOX_CENTER = [30.2690138665, -97.7408297965];
28
- const DEFAULT_MAPBOX_ZOOM = 12;
30
+ const DEFAULT_MAPBOX_ZOOM = 8;
29
31
  const DEFAULT_MAPBOX_MAP_STORE_TIMER_REFRESH_PERIOD = 200;
30
32
  class DbxMapboxService {
31
33
  constructor(config) {
@@ -75,7 +77,7 @@ class DbxMapboxMapStore extends ComponentStore {
75
77
  });
76
78
  this.dbxMapboxService = dbxMapboxService;
77
79
  this.latLngPoint = latLngPointFunction();
78
- this.latLngBound = latLngBoundFunction();
80
+ this.latLngBound = latLngBoundFunction({ pointFunction: latLngPointFunction({ wrap: false, validate: false }) });
79
81
  // MARK: Effects
80
82
  this.setMapService = this.effect((input) => {
81
83
  return input.pipe(switchMap((service) => {
@@ -160,6 +162,56 @@ class DbxMapboxMapStore extends ComponentStore {
160
162
  return this.mapInstance$.pipe(tap((map) => map.setMaxZoom(zoom)));
161
163
  }));
162
164
  });
165
+ this.setKeyboardDisabled = this.effect((input) => {
166
+ return input.pipe(switchMap((disabled) => {
167
+ return this.mapInstance$.pipe(tap((map) => {
168
+ if (disabled === false) {
169
+ map.keyboard.enable();
170
+ }
171
+ else {
172
+ map.keyboard.disable();
173
+ }
174
+ }));
175
+ }));
176
+ });
177
+ this.setDragRotateDisabled = this.effect((input) => {
178
+ return input.pipe(switchMap((disabled) => {
179
+ return this.mapInstance$.pipe(tap((map) => {
180
+ if (disabled === false) {
181
+ map.dragRotate.enable();
182
+ }
183
+ else {
184
+ map.dragRotate.disable();
185
+ }
186
+ }));
187
+ }));
188
+ });
189
+ this.setDragPanDisabled = this.effect((input) => {
190
+ return input.pipe(switchMap((disabled) => {
191
+ return this.mapInstance$.pipe(tap((map) => {
192
+ if (disabled === false) {
193
+ map.dragPan.enable();
194
+ }
195
+ else {
196
+ map.dragPan.disable();
197
+ }
198
+ }));
199
+ }));
200
+ });
201
+ this.setZoomDisabled = this.effect((input) => {
202
+ return input.pipe(switchMap((disabled) => {
203
+ return this.mapInstance$.pipe(tap((map) => {
204
+ if (disabled === false) {
205
+ map.scrollZoom.enable();
206
+ map.doubleClickZoom.enable();
207
+ }
208
+ else {
209
+ map.scrollZoom.disable();
210
+ map.doubleClickZoom.disable();
211
+ }
212
+ }));
213
+ }));
214
+ });
163
215
  this.setPitch = this.effect((input) => {
164
216
  return input.pipe(switchMap((pitch) => {
165
217
  return this.mapInstance$.pipe(tap((map) => map.setPitch(pitch)));
@@ -269,17 +321,41 @@ class DbxMapboxMapStore extends ComponentStore {
269
321
  this.isRotating$ = this.whenInitialized$.pipe(switchMap(() => this.rotateState$.pipe(map((x) => x === 'rotating'), distinctUntilChanged(), shareReplay())));
270
322
  this._movingTimer = this.movingTimer();
271
323
  this._renderingTimer = this.lifecycleRenderTimer();
272
- this.centerNow$ = this.whenInitialized$.pipe(switchMap(() => this.mapInstance$.pipe(switchMap((x) => this._movingTimer.pipe(map(() => this.latLngPoint(x.getCenter())))), shareReplay(1))));
324
+ this.centerNow$ = this.whenInitialized$.pipe(switchMap(() => this.mapInstance$.pipe(switchMap((x) => this._movingTimer.pipe(map(() => this.latLngPoint(x.getCenter())))), shareReplay(1))), shareReplay(1));
273
325
  this.center$ = this.whenInitialized$.pipe(switchMap(() => {
274
326
  return this.isMoving$.pipe(onTrueToFalse(), startWith(undefined), switchMap(() => this.centerNow$.pipe(first())), distinctUntilChanged(isSameLatLngPoint), shareReplay(1));
327
+ }), shareReplay(1));
328
+ this.margin$ = this.state$.pipe(map((x) => x.margin), distinctUntilChanged((a, b) => a != null && b != null && a.fullWidth === b.fullWidth && a.leftMargin === b.leftMargin && a.rightMargin === b.rightMargin), shareReplay(1));
329
+ this.reverseMargin$ = this.margin$.pipe(map((x) => {
330
+ if (x) {
331
+ return { leftMargin: -x.leftMargin, rightMargin: -x.rightMargin, fullWidth: x.fullWidth };
332
+ }
333
+ else {
334
+ return x;
335
+ }
275
336
  }));
337
+ this.centerGivenMargin$ = this.whenInitialized$.pipe(switchMap(() => {
338
+ return this.reverseMargin$.pipe(switchMap((x) => {
339
+ if (x) {
340
+ return this.center$.pipe(switchMap((_) => this.calculateNextCenterOffsetWithScreenMarginChange(x)));
341
+ }
342
+ else {
343
+ return this.isMoving$.pipe(filter((x) => !x), switchMap(() => this.center$));
344
+ }
345
+ }));
346
+ }), shareReplay(1));
276
347
  this.boundNow$ = this.whenInitialized$.pipe(switchMap(() => this.mapInstance$.pipe(switchMap((x) => this._renderingTimer.pipe(map(() => {
277
348
  const bound = x.getBounds();
278
- return this.latLngBound([bound.getSouthWest(), bound.getNorthEast()]);
349
+ const boundSw = bound.getSouthWest();
350
+ const boundNe = bound.getNorthEast();
351
+ const sw = isDefaultLatLngPoint(boundSw) ? swMostLatLngPoint() : boundSw;
352
+ const ne = isDefaultLatLngPoint(boundNe) ? neMostLatLngPoint() : boundNe;
353
+ return this.latLngBound(sw, ne);
279
354
  }))), shareReplay(1))));
280
355
  this.bound$ = this.whenInitialized$.pipe(switchMap(() => {
281
356
  return this.isRendering$.pipe(onTrueToFalse(), startWith(undefined), switchMap((x) => this.boundNow$.pipe(first())), distinctUntilChanged(isSameLatLngBound), shareReplay(1));
282
357
  }));
358
+ this.boundWrapsAroundWorld$ = this.bound$.pipe(map((x) => latLngBoundWrapsMap(x)), distinctUntilChanged(), shareReplay(1));
283
359
  this.isWithinBoundFunction$ = this.bound$.pipe(map((x) => isWithinLatLngBoundFunction(x)), shareReplay(1));
284
360
  this.overlapsBoundFunction$ = this.bound$.pipe(map((x) => overlapsLatLngBoundFunction(x)), shareReplay(1));
285
361
  this.zoomNow$ = this.whenInitialized$.pipe(switchMap(() => this.mapInstance$.pipe(switchMap((x) => this._renderingTimer.pipe(map(() => x.getZoom()))), shareReplay(1))));
@@ -300,6 +376,7 @@ class DbxMapboxMapStore extends ComponentStore {
300
376
  this.doubleClickEvent$ = this.state$.pipe(map((x) => x.doubleClickEvent), distinctUntilChanged(), shareReplay(1));
301
377
  this.rightClickEvent$ = this.state$.pipe(map((x) => x.rightClickEvent), distinctUntilChanged(), shareReplay(1));
302
378
  // MARK: State Changes
379
+ this.setMargin = this.updater((state, margin) => (Object.assign(Object.assign({}, state), { margin: margin && (margin.rightMargin !== 0 || margin.leftMargin !== 0) ? margin : undefined })));
303
380
  this._setMapService = this.updater((state, mapService) => ({ mapService, moveState: 'init', lifecycleState: 'init', zoomState: 'init', rotateState: 'init', retainContent: state.retainContent, content: state.retainContent ? state.content : undefined }));
304
381
  this._setLifecycleState = this.updater((state, lifecycleState) => (Object.assign(Object.assign({}, state), { lifecycleState })));
305
382
  this._setMoveState = this.updater((state, moveState) => (Object.assign(Object.assign({}, state), { moveState })));
@@ -350,23 +427,22 @@ class DbxMapboxMapStore extends ComponentStore {
350
427
  }))));
351
428
  }
352
429
  calculateNextCenterOffsetWithScreenMarginChange(sizing) {
353
- return this.atNextIdle().pipe(switchMap(() => this.bound$.pipe((first(),
354
- map((bounds) => {
355
- const diff = diffLatLngBoundPoints(bounds);
356
- const center = latLngBoundCenterPoint(bounds);
357
- const offsetWidth = sizing.leftMargin + sizing.rightMargin; // 300 + 0
358
- const newWidth = sizing.fullWidth - offsetWidth; // 1000 - 300 - 0
359
- const newWidthRatio = newWidth / sizing.fullWidth; // 700 / 1000
360
- const newCenterLongitudeWidth = diff.lng * newWidthRatio; // 70% offset
361
- const effectiveOffset = {
362
- lat: 0,
363
- lng: newCenterLongitudeWidth / 2
364
- };
365
- const newCenter = addLatLngPoints(bounds.sw, effectiveOffset);
366
- newCenter.lat = center.lat; // retain center position
367
- // console.log({ sizing, bounds, effectiveOffset, newWidth, offsetWidth, diff, center, newCenter });
368
- return newCenter;
369
- })))));
430
+ return this.atNextIdle().pipe(switchMap(() => this.bound$.pipe(first(), map((bounds) => {
431
+ const diff = diffLatLngBoundPoints(bounds);
432
+ const center = latLngBoundCenterPoint(bounds);
433
+ const offsetWidth = sizing.leftMargin + sizing.rightMargin; // 300 + 0
434
+ const newWidth = sizing.fullWidth - offsetWidth; // 1000 - 300 - 0
435
+ const newWidthRatio = newWidth / sizing.fullWidth; // 700 / 1000
436
+ const newCenterLongitudeWidth = diff.lng * newWidthRatio; // 70% offset
437
+ const effectiveOffset = {
438
+ lat: 0,
439
+ lng: newCenterLongitudeWidth / 2
440
+ };
441
+ const newCenter = addLatLngPoints(bounds.sw, effectiveOffset);
442
+ newCenter.lat = center.lat; // retain center position
443
+ // console.log({ sizing, bounds, effectiveOffset, newWidth, offsetWidth, diff, center, newCenter });
444
+ return newCenter;
445
+ }))));
370
446
  }
371
447
  }
372
448
  DbxMapboxMapStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxMapStore, deps: [{ token: DbxMapboxService }], target: i0.ɵɵFactoryTarget.Injectable });
@@ -450,12 +526,14 @@ class DbxMapboxLayoutComponent extends SubscriptionObject {
450
526
  this.dbxMapboxMapStore = dbxMapboxMapStore;
451
527
  this._resized = new Subject();
452
528
  this._updateMargins = new Subject();
529
+ this._forceHasContent = new BehaviorSubject(false);
453
530
  this._side = new BehaviorSubject('right');
454
531
  this._openToggle = new BehaviorSubject(true);
455
532
  this._color = new BehaviorSubject(undefined);
456
533
  this._toggleSub = new SubscriptionObject();
457
534
  this.side$ = this._side.pipe(distinctUntilChanged(), shareReplay(1));
458
- this.opened$ = combineLatest([this.dbxMapboxMapStore.hasContent$, this._openToggle]).pipe(map(([hasContent, open]) => hasContent && open), distinctUntilChanged(), shareReplay(1));
535
+ this.hasContent$ = combineLatest([this._forceHasContent, this.dbxMapboxMapStore.hasContent$]).pipe(map(([hasContent, forceHasContent]) => hasContent || forceHasContent), distinctUntilChanged(), shareReplay(1));
536
+ this.opened$ = combineLatest([this.hasContent$, this._openToggle]).pipe(map(([hasContent, open]) => hasContent && open), distinctUntilChanged(), shareReplay(1));
459
537
  this.position$ = this.side$.pipe(map((x) => (x === 'right' ? 'end' : 'start')), distinctUntilChanged(), shareReplay(1));
460
538
  this.drawerClasses$ = combineLatest([this.side$, this.dbxMapboxMapStore.hasContent$, this.opened$]).pipe(
461
539
  //
@@ -483,7 +561,8 @@ class DbxMapboxLayoutComponent extends SubscriptionObject {
483
561
  }
484
562
  });
485
563
  });
486
- this._toggleSub.subscription = combineLatest([this.opened$.pipe(distinctUntilChanged(), skip(1)), this._updateMargins]).subscribe(([opened]) => {
564
+ let init = false;
565
+ this._toggleSub.subscription = combineLatest([this.opened$.pipe(distinctUntilChanged()), this._updateMargins]).subscribe(([opened]) => {
487
566
  let { right } = this.container._contentMargins;
488
567
  this.container.updateContentMargins();
489
568
  setTimeout(() => {
@@ -494,14 +573,19 @@ class DbxMapboxLayoutComponent extends SubscriptionObject {
494
573
  right = (right || 0) * flip;
495
574
  const element = this.content.nativeElement;
496
575
  const width = element.clientWidth;
497
- const easeTo = this.dbxMapboxMapStore
498
- .calculateNextCenterOffsetWithScreenMarginChange({
576
+ const margin = {
499
577
  leftMargin: 0,
500
578
  rightMargin: right,
501
579
  fullWidth: width
502
- })
503
- .pipe(first(), map((center) => ({ to: { center, duration: 3200, essential: false } })));
504
- this.dbxMapboxMapStore.easeTo(easeTo);
580
+ };
581
+ const easeTo = this.dbxMapboxMapStore.calculateNextCenterOffsetWithScreenMarginChange(margin).pipe(first(), map((center) => ({ to: { center, duration: 3200, essential: false } })));
582
+ this.dbxMapboxMapStore.setMargin(opened ? margin : undefined);
583
+ if (!init) {
584
+ this.dbxMapboxMapStore.easeTo(easeTo);
585
+ }
586
+ else {
587
+ init = true;
588
+ }
505
589
  });
506
590
  });
507
591
  }
@@ -512,6 +596,7 @@ class DbxMapboxLayoutComponent extends SubscriptionObject {
512
596
  this._openToggle.complete();
513
597
  this._color.complete();
514
598
  this._toggleSub.destroy();
599
+ this._forceHasContent.complete();
515
600
  }
516
601
  toggleDrawer(open) {
517
602
  if (open == null) {
@@ -529,6 +614,11 @@ class DbxMapboxLayoutComponent extends SubscriptionObject {
529
614
  this._openToggle.next(opened);
530
615
  }
531
616
  }
617
+ set hasContent(hasContent) {
618
+ if (hasContent != null) {
619
+ this._forceHasContent.next(hasContent);
620
+ }
621
+ }
532
622
  set drawerColor(color) {
533
623
  this._color.next(color);
534
624
  }
@@ -537,7 +627,7 @@ class DbxMapboxLayoutComponent extends SubscriptionObject {
537
627
  }
538
628
  }
539
629
  DbxMapboxLayoutComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxLayoutComponent, deps: [{ token: DbxMapboxMapStore }], target: i0.ɵɵFactoryTarget.Component });
540
- DbxMapboxLayoutComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.2", type: DbxMapboxLayoutComponent, selector: "dbx-mapbox-layout", inputs: { side: "side", opened: "opened", drawerColor: "drawerColor" }, viewQueries: [{ propertyName: "container", first: true, predicate: MatDrawerContainer, descendants: true }, { propertyName: "content", first: true, predicate: ["content"], descendants: true, read: ElementRef, static: true }], usesInheritance: true, ngImport: i0, template: "<mat-drawer-container class=\"dbx-mapbox-layout-container\" [ngClass]=\"(drawerClasses$ | async) || ''\" [hasBackdrop]=\"false\">\n <mat-drawer class=\"dbx-mapbox-layout-drawer\" #drawer [opened]=\"opened$ | async\" mode=\"push\" [position]=\"(position$ | async) || 'end'\">\n <div class=\"dbx-mapbox-layout-drawer-content\" [ngClass]=\"(drawerButtonClasses$ | async) || ''\">\n <ng-content select=\"[drawer]\"></ng-content>\n <dbx-mapbox-layout-drawer></dbx-mapbox-layout-drawer>\n </div>\n </mat-drawer>\n <mat-drawer-content #content class=\"dbx-mapbox-layout-content\" (resized)=\"onResized($event)\">\n <button mat-icon-button (click)=\"toggleDrawer()\" class=\"dbx-mapbox-layout-drawer-button\" [ngClass]=\"(drawerButtonClasses$ | async) || ''\">\n <mat-icon>{{ buttonIcon$ | async }}</mat-icon>\n </button>\n <ng-content></ng-content>\n </mat-drawer-content>\n</mat-drawer-container>\n", styles: [".dbx-mapbox-layout-container{height:100%;max-width:100%}.dbx-mapbox-layout-container .mat-drawer-container{height:100%}.dbx-mapbox-layout-container .dbx-mapbox-layout-drawer{max-width:calc(100% - var(--dbx-mapbox-min-width-var, 60px))}.dbx-mapbox-layout-container .dbx-mapbox-layout-drawer-content{height:100%;width:100%;overflow:hidden}.dbx-mapbox-layout-content>.dbx-mapbox-layout-drawer-button{position:absolute;z-index:2;top:40%;border:none;display:flex;overflow:hidden}.left-drawer .dbx-mapbox-layout-content>.dbx-mapbox-layout-drawer-button{left:0;border-radius:0 20px 20px 0}.right-drawer .dbx-mapbox-layout-content>.dbx-mapbox-layout-drawer-button{right:0;border-radius:20px 0 0 20px}.has-drawer-content .dbx-mapbox-layout-content>.dbx-mapbox-layout-drawer-button{width:35px}.has-drawer-content.open-drawer .dbx-mapbox-layout-content>.dbx-mapbox-layout-drawer-button{width:35px}.no-drawer-content .dbx-mapbox-layout-content>.dbx-mapbox-layout-drawer-button{width:0px}.dbx-mapbox-layout-content>.dbx-mapbox-layout-drawer-button mat-icon{padding-left:8px}\n"], dependencies: [{ kind: "directive", type: i2$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: i3.MatDrawer, selector: "mat-drawer", inputs: ["position", "mode", "disableClose", "autoFocus", "opened"], outputs: ["openedChange", "opened", "openedStart", "closed", "closedStart", "positionChanged"], exportAs: ["matDrawer"] }, { kind: "component", type: i3.MatDrawerContainer, selector: "mat-drawer-container", inputs: ["autosize", "hasBackdrop"], outputs: ["backdropClick"], exportAs: ["matDrawerContainer"] }, { kind: "component", type: i3.MatDrawerContent, selector: "mat-drawer-content" }, { kind: "component", type: i4.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i6.ResizedDirective, selector: "[resized]", outputs: ["resized"] }, { kind: "component", type: DbxMapboxLayoutDrawerComponent, selector: "dbx-mapbox-layout-drawer" }, { kind: "pipe", type: i2$1.AsyncPipe, name: "async" }] });
630
+ DbxMapboxLayoutComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.2", type: DbxMapboxLayoutComponent, selector: "dbx-mapbox-layout", inputs: { side: "side", opened: "opened", hasContent: "hasContent", drawerColor: "drawerColor" }, viewQueries: [{ propertyName: "container", first: true, predicate: MatDrawerContainer, descendants: true }, { propertyName: "content", first: true, predicate: ["content"], descendants: true, read: ElementRef, static: true }], usesInheritance: true, ngImport: i0, template: "<mat-drawer-container class=\"dbx-mapbox-layout-container\" [ngClass]=\"(drawerClasses$ | async) || ''\" [hasBackdrop]=\"false\">\n <mat-drawer class=\"dbx-mapbox-layout-drawer\" #drawer [opened]=\"opened$ | async\" mode=\"push\" [position]=\"(position$ | async) || 'end'\">\n <div class=\"dbx-mapbox-layout-drawer-content\" [ngClass]=\"(drawerButtonClasses$ | async) || ''\">\n <ng-content select=\"[drawer]\"></ng-content>\n <dbx-mapbox-layout-drawer></dbx-mapbox-layout-drawer>\n </div>\n </mat-drawer>\n <mat-drawer-content #content class=\"dbx-mapbox-layout-content\" (resized)=\"onResized($event)\">\n <button mat-icon-button (click)=\"toggleDrawer()\" class=\"dbx-mapbox-layout-drawer-button\" [ngClass]=\"(drawerButtonClasses$ | async) || ''\">\n <mat-icon>{{ buttonIcon$ | async }}</mat-icon>\n </button>\n <ng-content></ng-content>\n </mat-drawer-content>\n</mat-drawer-container>\n", styles: [".dbx-mapbox-layout-container{height:100%;max-width:100%}.dbx-mapbox-layout-container .mat-drawer-container{height:100%}.dbx-mapbox-layout-container .dbx-mapbox-layout-drawer{max-width:calc(100% - var(--dbx-mapbox-min-width-var, 60px))}.dbx-mapbox-layout-container .dbx-mapbox-layout-drawer-content{height:100%;width:100%;overflow:hidden}.dbx-mapbox-layout-content>.dbx-mapbox-layout-drawer-button{position:absolute;z-index:2;top:40%;border:none;display:flex;overflow:hidden}.left-drawer .dbx-mapbox-layout-content>.dbx-mapbox-layout-drawer-button{left:0;border-radius:0 20px 20px 0}.right-drawer .dbx-mapbox-layout-content>.dbx-mapbox-layout-drawer-button{right:0;border-radius:20px 0 0 20px}.has-drawer-content .dbx-mapbox-layout-content>.dbx-mapbox-layout-drawer-button{width:35px}.has-drawer-content.open-drawer .dbx-mapbox-layout-content>.dbx-mapbox-layout-drawer-button{width:35px}.no-drawer-content .dbx-mapbox-layout-content>.dbx-mapbox-layout-drawer-button{width:0px}.dbx-mapbox-layout-content>.dbx-mapbox-layout-drawer-button mat-icon{padding-left:8px}\n"], dependencies: [{ kind: "directive", type: i2$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: i3.MatDrawer, selector: "mat-drawer", inputs: ["position", "mode", "disableClose", "autoFocus", "opened"], outputs: ["openedChange", "opened", "openedStart", "closed", "closedStart", "positionChanged"], exportAs: ["matDrawer"] }, { kind: "component", type: i3.MatDrawerContainer, selector: "mat-drawer-container", inputs: ["autosize", "hasBackdrop"], outputs: ["backdropClick"], exportAs: ["matDrawerContainer"] }, { kind: "component", type: i3.MatDrawerContent, selector: "mat-drawer-content" }, { kind: "component", type: i4.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i6.ResizedDirective, selector: "[resized]", outputs: ["resized"] }, { kind: "component", type: DbxMapboxLayoutDrawerComponent, selector: "dbx-mapbox-layout-drawer" }, { kind: "pipe", type: i2$1.AsyncPipe, name: "async" }] });
541
631
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxLayoutComponent, decorators: [{
542
632
  type: Component,
543
633
  args: [{ selector: 'dbx-mapbox-layout', template: "<mat-drawer-container class=\"dbx-mapbox-layout-container\" [ngClass]=\"(drawerClasses$ | async) || ''\" [hasBackdrop]=\"false\">\n <mat-drawer class=\"dbx-mapbox-layout-drawer\" #drawer [opened]=\"opened$ | async\" mode=\"push\" [position]=\"(position$ | async) || 'end'\">\n <div class=\"dbx-mapbox-layout-drawer-content\" [ngClass]=\"(drawerButtonClasses$ | async) || ''\">\n <ng-content select=\"[drawer]\"></ng-content>\n <dbx-mapbox-layout-drawer></dbx-mapbox-layout-drawer>\n </div>\n </mat-drawer>\n <mat-drawer-content #content class=\"dbx-mapbox-layout-content\" (resized)=\"onResized($event)\">\n <button mat-icon-button (click)=\"toggleDrawer()\" class=\"dbx-mapbox-layout-drawer-button\" [ngClass]=\"(drawerButtonClasses$ | async) || ''\">\n <mat-icon>{{ buttonIcon$ | async }}</mat-icon>\n </button>\n <ng-content></ng-content>\n </mat-drawer-content>\n</mat-drawer-container>\n", styles: [".dbx-mapbox-layout-container{height:100%;max-width:100%}.dbx-mapbox-layout-container .mat-drawer-container{height:100%}.dbx-mapbox-layout-container .dbx-mapbox-layout-drawer{max-width:calc(100% - var(--dbx-mapbox-min-width-var, 60px))}.dbx-mapbox-layout-container .dbx-mapbox-layout-drawer-content{height:100%;width:100%;overflow:hidden}.dbx-mapbox-layout-content>.dbx-mapbox-layout-drawer-button{position:absolute;z-index:2;top:40%;border:none;display:flex;overflow:hidden}.left-drawer .dbx-mapbox-layout-content>.dbx-mapbox-layout-drawer-button{left:0;border-radius:0 20px 20px 0}.right-drawer .dbx-mapbox-layout-content>.dbx-mapbox-layout-drawer-button{right:0;border-radius:20px 0 0 20px}.has-drawer-content .dbx-mapbox-layout-content>.dbx-mapbox-layout-drawer-button{width:35px}.has-drawer-content.open-drawer .dbx-mapbox-layout-content>.dbx-mapbox-layout-drawer-button{width:35px}.no-drawer-content .dbx-mapbox-layout-content>.dbx-mapbox-layout-drawer-button{width:0px}.dbx-mapbox-layout-content>.dbx-mapbox-layout-drawer-button mat-icon{padding-left:8px}\n"] }]
@@ -551,6 +641,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImpor
551
641
  type: Input
552
642
  }], opened: [{
553
643
  type: Input
644
+ }], hasContent: [{
645
+ type: Input
554
646
  }], drawerColor: [{
555
647
  type: Input
556
648
  }] } });
@@ -645,12 +737,153 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImpor
645
737
  args: ['dbxMapboxMenu']
646
738
  }] } });
647
739
 
740
+ /**
741
+ * Token used by provideMapboxStoreIfDoesNotExist() to prevent injecting a parent DbxMapboxMapStore into the child view.
742
+ */
743
+ class DbxMapboxMapStoreProviderBlock {
744
+ constructor(dbxMapboxMapStore) {
745
+ this.dbxMapboxMapStore = dbxMapboxMapStore;
746
+ }
747
+ }
748
+ DbxMapboxMapStoreProviderBlock.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxMapStoreProviderBlock, deps: [{ token: DbxMapboxMapStore, skipSelf: true }], target: i0.ɵɵFactoryTarget.Injectable });
749
+ DbxMapboxMapStoreProviderBlock.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxMapStoreProviderBlock });
750
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxMapStoreProviderBlock, decorators: [{
751
+ type: Injectable
752
+ }], ctorParameters: function () {
753
+ return [{ type: DbxMapboxMapStore, decorators: [{
754
+ type: SkipSelf
755
+ }] }];
756
+ } });
757
+ class DbxMapboxMapStoreInjectionBlockDirective {
758
+ }
759
+ DbxMapboxMapStoreInjectionBlockDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxMapStoreInjectionBlockDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
760
+ DbxMapboxMapStoreInjectionBlockDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.2", type: DbxMapboxMapStoreInjectionBlockDirective, selector: "[dbxMapboxStoreParentBlocker]", providers: [DbxMapboxMapStoreProviderBlock], ngImport: i0 });
761
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxMapStoreInjectionBlockDirective, decorators: [{
762
+ type: Directive,
763
+ args: [{
764
+ selector: '[dbxMapboxStoreParentBlocker]',
765
+ providers: [DbxMapboxMapStoreProviderBlock]
766
+ }]
767
+ }] });
768
+ /**
769
+ * Creates a Provider that initializes a new DbxMapboxMapStore if a parent does not exist.
770
+ *
771
+ * If a DbxMapboxMapStoreInjectionBlock is available in the context, and references the same dbxMapboxMapStore that is attempting to be injected, a new DbxMapboxMapStore is created.
772
+ *
773
+ * @returns
774
+ */
775
+ function provideMapboxStoreIfParentIsUnavailable() {
776
+ return {
777
+ provide: DbxMapboxMapStore,
778
+ useFactory: (parentInjector, dbxMapboxMapStoreInjectionBlock, dbxMapboxMapStore) => {
779
+ if (!dbxMapboxMapStore || (dbxMapboxMapStore && dbxMapboxMapStoreInjectionBlock != null && dbxMapboxMapStoreInjectionBlock.dbxMapboxMapStore === dbxMapboxMapStore)) {
780
+ // create a new dbxMapboxMapStore to use
781
+ const injector = Injector.create({ providers: [{ provide: DbxMapboxMapStore }], parent: parentInjector });
782
+ dbxMapboxMapStore = injector.get(DbxMapboxMapStore);
783
+ }
784
+ return dbxMapboxMapStore;
785
+ },
786
+ deps: [Injector, [new Optional(), DbxMapboxMapStoreProviderBlock], [new Optional(), new SkipSelf(), DbxMapboxMapStore]]
787
+ };
788
+ }
789
+
790
+ class DbxMapboxMarkerComponent {
791
+ constructor() { }
792
+ get marker() {
793
+ return this._marker;
794
+ }
795
+ set marker(marker) {
796
+ this._marker = marker;
797
+ }
798
+ get latLng() {
799
+ var _a;
800
+ return (_a = this._marker) === null || _a === void 0 ? void 0 : _a.latLng;
801
+ }
802
+ get anchor() {
803
+ var _a;
804
+ return (_a = this._marker) === null || _a === void 0 ? void 0 : _a.anchor;
805
+ }
806
+ get label() {
807
+ var _a;
808
+ return (_a = this._marker) === null || _a === void 0 ? void 0 : _a.label;
809
+ }
810
+ get icon() {
811
+ var _a;
812
+ return (_a = this._marker) === null || _a === void 0 ? void 0 : _a.icon;
813
+ }
814
+ get style() {
815
+ var _a, _b, _c;
816
+ let width = 0;
817
+ let height = 0;
818
+ const size = ((_a = this._marker) === null || _a === void 0 ? void 0 : _a.size) || 'medium';
819
+ if (typeof size === 'number') {
820
+ width = size;
821
+ }
822
+ else {
823
+ switch (size) {
824
+ case 'small':
825
+ width = 18;
826
+ break;
827
+ case 'medium':
828
+ width = 24;
829
+ break;
830
+ case 'large':
831
+ width = 32;
832
+ break;
833
+ case 'tall':
834
+ width = 24;
835
+ height = 32;
836
+ break;
837
+ }
838
+ }
839
+ if (!height) {
840
+ height = width;
841
+ }
842
+ const imageInput = (_b = this._marker) === null || _b === void 0 ? void 0 : _b.image;
843
+ const image = imageInput ? (typeof imageInput === 'string' ? imageInput : getValueFromGetter(imageInput, width)) : undefined;
844
+ let style = Object.assign(Object.assign({}, (_c = this._marker) === null || _c === void 0 ? void 0 : _c.style), { width: width + 'px', height: height + 'px', 'font-size': width + 'px', 'background-image': image });
845
+ return style;
846
+ }
847
+ }
848
+ DbxMapboxMarkerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxMarkerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
849
+ DbxMapboxMarkerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.2", type: DbxMapboxMarkerComponent, selector: "dbx-mapbox-marker", inputs: { marker: "marker" }, ngImport: i0, template: `
850
+ <mgl-marker *ngIf="marker" [lngLat]="latLng">
851
+ <dbx-anchor [anchor]="anchor">
852
+ <div class="dbx-mapbox-marker">
853
+ <div class="dbx-mapbox-marker-content" [ngStyle]="style">
854
+ <mat-icon *ngIf="icon">{{ icon }}</mat-icon>
855
+ </div>
856
+ <div class="dbx-mapbox-marker-label" *ngIf="label">{{ label }}</div>
857
+ </div>
858
+ </dbx-anchor>
859
+ </mgl-marker>
860
+ `, isInline: true, styles: [".dbx-mapbox-marker{display:flex;align-items:center;flex-direction:column;font-weight:700}.dbx-mapbox-marker .dbx-mapbox-marker-content{display:flex;align-items:center;justify-content:center}.dbx-mapbox-marker .dbx-mapbox-marker-content mat-icon{width:100%;height:100%;font-size:inherit}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i3$1.DbxAnchorComponent, selector: "dbx-anchor, [dbx-anchor]", inputs: ["block"] }, { kind: "component", type: i1.MarkerComponent, selector: "mgl-marker", inputs: ["offset", "anchor", "clickTolerance", "feature", "lngLat", "draggable", "popupShown", "className", "pitchAlignment", "rotationAlignment"], outputs: ["markerDragStart", "markerDragEnd", "markerDrag", "dragStart", "dragEnd", "drag"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
861
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxMarkerComponent, decorators: [{
862
+ type: Component,
863
+ args: [{ selector: 'dbx-mapbox-marker', template: `
864
+ <mgl-marker *ngIf="marker" [lngLat]="latLng">
865
+ <dbx-anchor [anchor]="anchor">
866
+ <div class="dbx-mapbox-marker">
867
+ <div class="dbx-mapbox-marker-content" [ngStyle]="style">
868
+ <mat-icon *ngIf="icon">{{ icon }}</mat-icon>
869
+ </div>
870
+ <div class="dbx-mapbox-marker-label" *ngIf="label">{{ label }}</div>
871
+ </div>
872
+ </dbx-anchor>
873
+ </mgl-marker>
874
+ `, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".dbx-mapbox-marker{display:flex;align-items:center;flex-direction:column;font-weight:700}.dbx-mapbox-marker .dbx-mapbox-marker-content{display:flex;align-items:center;justify-content:center}.dbx-mapbox-marker .dbx-mapbox-marker-content mat-icon{width:100%;height:100%;font-size:inherit}\n"] }]
875
+ }], ctorParameters: function () { return []; }, propDecorators: { marker: [{
876
+ type: Input
877
+ }] } });
878
+
648
879
  const declarations = [
649
880
  //
650
881
  DbxMapboxMapDirective,
651
882
  DbxMapboxLayoutComponent,
652
883
  DbxMapboxLayoutDrawerComponent,
653
- DbxMapboxMenuComponent
884
+ DbxMapboxMenuComponent,
885
+ DbxMapboxMarkerComponent,
886
+ DbxMapboxMapStoreInjectionBlockDirective
654
887
  ];
655
888
  class DbxMapboxModule {
656
889
  static forRoot(config) {
@@ -671,7 +904,9 @@ DbxMapboxModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version
671
904
  DbxMapboxMapDirective,
672
905
  DbxMapboxLayoutComponent,
673
906
  DbxMapboxLayoutDrawerComponent,
674
- DbxMapboxMenuComponent
907
+ DbxMapboxMenuComponent,
908
+ DbxMapboxMarkerComponent,
909
+ DbxMapboxMapStoreInjectionBlockDirective
675
910
  ], imports: [
676
911
  //
677
912
  CommonModule,
@@ -679,13 +914,17 @@ DbxMapboxModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version
679
914
  DbxInjectionComponentModule,
680
915
  MatButtonModule,
681
916
  MatIconModule,
682
- AngularResizeEventModule
917
+ AngularResizeEventModule,
918
+ DbxRouterAnchorModule,
919
+ NgxMapboxGLModule
683
920
  ], exports: [
684
921
  //
685
922
  DbxMapboxMapDirective,
686
923
  DbxMapboxLayoutComponent,
687
924
  DbxMapboxLayoutDrawerComponent,
688
- DbxMapboxMenuComponent
925
+ DbxMapboxMenuComponent,
926
+ DbxMapboxMarkerComponent,
927
+ DbxMapboxMapStoreInjectionBlockDirective
689
928
  ] });
690
929
  DbxMapboxModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxModule, imports: [
691
930
  //
@@ -694,7 +933,9 @@ DbxMapboxModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version
694
933
  DbxInjectionComponentModule,
695
934
  MatButtonModule,
696
935
  MatIconModule,
697
- AngularResizeEventModule
936
+ AngularResizeEventModule,
937
+ DbxRouterAnchorModule,
938
+ NgxMapboxGLModule
698
939
  ] });
699
940
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxModule, decorators: [{
700
941
  type: NgModule,
@@ -706,7 +947,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImpor
706
947
  DbxInjectionComponentModule,
707
948
  MatButtonModule,
708
949
  MatIconModule,
709
- AngularResizeEventModule
950
+ AngularResizeEventModule,
951
+ DbxRouterAnchorModule,
952
+ NgxMapboxGLModule
710
953
  ],
711
954
  declarations,
712
955
  exports: declarations
@@ -724,10 +967,15 @@ const KNOWN_MAPBOX_STYLES = [
724
967
  'mapbox://styles/mapbox/navigation-day-v1',
725
968
  'mapbox://styles/mapbox/navigation-night-v1'
726
969
  ];
970
+ const MAPBOX_MIN_ZOOM_LEVEL = 0;
971
+ const MAPBOX_MAX_ZOOM_LEVEL = 22;
972
+ function mapboxZoomLevel(input) {
973
+ return Math.min(Math.max(input, MAPBOX_MIN_ZOOM_LEVEL), MAPBOX_MAX_ZOOM_LEVEL);
974
+ }
727
975
 
728
976
  /**
729
977
  * Generated bundle index. Do not edit.
730
978
  */
731
979
 
732
- export { DEFAULT_MAPBOX_CENTER, DEFAULT_MAPBOX_MAP_STORE_TIMER_REFRESH_PERIOD, DEFAULT_MAPBOX_STYLE, DEFAULT_MAPBOX_ZOOM, DbxMapboxConfig, DbxMapboxLayoutComponent, DbxMapboxLayoutDrawerComponent, DbxMapboxMapDirective, DbxMapboxMapStore, DbxMapboxMenuComponent, DbxMapboxModule, DbxMapboxService, KNOWN_MAPBOX_STYLES };
980
+ export { DEFAULT_MAPBOX_CENTER, DEFAULT_MAPBOX_MAP_STORE_TIMER_REFRESH_PERIOD, DEFAULT_MAPBOX_STYLE, DEFAULT_MAPBOX_ZOOM, DbxMapboxConfig, DbxMapboxLayoutComponent, DbxMapboxLayoutDrawerComponent, DbxMapboxMapDirective, DbxMapboxMapStore, DbxMapboxMapStoreInjectionBlockDirective, DbxMapboxMapStoreProviderBlock, DbxMapboxMarkerComponent, DbxMapboxMenuComponent, DbxMapboxModule, DbxMapboxService, KNOWN_MAPBOX_STYLES, MAPBOX_MAX_ZOOM_LEVEL, MAPBOX_MIN_ZOOM_LEVEL, mapboxZoomLevel, provideMapboxStoreIfParentIsUnavailable };
733
981
  //# sourceMappingURL=dereekb-dbx-web-mapbox.mjs.map