@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
5
  import { cleanup, filterMaybe, onTrueToFalse, SubscriptionObject } from '@dereekb/rxjs';
6
- import { latLngPointFunction, latLngBoundFunction, isSameLatLngPoint, isSameLatLngBound, isWithinLatLngBoundFunction, overlapsLatLngBoundFunction, diffLatLngBoundPoints, latLngBoundCenterPoint, addLatLngPoints, latLngPoint, DestroyFunctionObject } from '@dereekb/util';
6
+ import { latLngPointFunction, latLngBoundFunction, isSameLatLngPoint, isDefaultLatLngPoint, swMostLatLngPoint, neMostLatLngPoint, isSameLatLngBound, latLngBoundWrapsMap, isWithinLatLngBoundFunction, overlapsLatLngBoundFunction, diffLatLngBoundPoints, latLngBoundCenterPoint, addLatLngPoints, latLngPoint, DestroyFunctionObject, getValueFromGetter } from '@dereekb/util';
7
7
  import { ComponentStore } from '@ngrx/component-store';
8
- import { switchMap, NEVER, defaultIfEmpty, map, tap, distinctUntilChanged, shareReplay, of, combineLatest, filter, first, startWith, interval, Subject, BehaviorSubject, throttleTime, skip } from 'rxjs';
8
+ import { switchMap, NEVER, defaultIfEmpty, map, tap, distinctUntilChanged, shareReplay, of, combineLatest, filter, first, startWith, interval, Subject, BehaviorSubject, throttleTime } from 'rxjs';
9
9
  import * as MapboxGl from 'mapbox-gl';
10
10
  import * as i1 from 'ngx-mapbox-gl';
11
- import { dbxColorBackground, disableRightClickInCdkBackdrop } from '@dereekb/dbx-web';
11
+ import { NgxMapboxGLModule } from 'ngx-mapbox-gl';
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) {
@@ -69,7 +71,7 @@ class DbxMapboxMapStore extends ComponentStore {
69
71
  });
70
72
  this.dbxMapboxService = dbxMapboxService;
71
73
  this.latLngPoint = latLngPointFunction();
72
- this.latLngBound = latLngBoundFunction();
74
+ this.latLngBound = latLngBoundFunction({ pointFunction: latLngPointFunction({ wrap: false, validate: false }) });
73
75
  // MARK: Effects
74
76
  this.setMapService = this.effect((input) => {
75
77
  return input.pipe(switchMap((service) => {
@@ -154,6 +156,56 @@ class DbxMapboxMapStore extends ComponentStore {
154
156
  return this.mapInstance$.pipe(tap((map) => map.setMaxZoom(zoom)));
155
157
  }));
156
158
  });
159
+ this.setKeyboardDisabled = this.effect((input) => {
160
+ return input.pipe(switchMap((disabled) => {
161
+ return this.mapInstance$.pipe(tap((map) => {
162
+ if (disabled === false) {
163
+ map.keyboard.enable();
164
+ }
165
+ else {
166
+ map.keyboard.disable();
167
+ }
168
+ }));
169
+ }));
170
+ });
171
+ this.setDragRotateDisabled = this.effect((input) => {
172
+ return input.pipe(switchMap((disabled) => {
173
+ return this.mapInstance$.pipe(tap((map) => {
174
+ if (disabled === false) {
175
+ map.dragRotate.enable();
176
+ }
177
+ else {
178
+ map.dragRotate.disable();
179
+ }
180
+ }));
181
+ }));
182
+ });
183
+ this.setDragPanDisabled = this.effect((input) => {
184
+ return input.pipe(switchMap((disabled) => {
185
+ return this.mapInstance$.pipe(tap((map) => {
186
+ if (disabled === false) {
187
+ map.dragPan.enable();
188
+ }
189
+ else {
190
+ map.dragPan.disable();
191
+ }
192
+ }));
193
+ }));
194
+ });
195
+ this.setZoomDisabled = this.effect((input) => {
196
+ return input.pipe(switchMap((disabled) => {
197
+ return this.mapInstance$.pipe(tap((map) => {
198
+ if (disabled === false) {
199
+ map.scrollZoom.enable();
200
+ map.doubleClickZoom.enable();
201
+ }
202
+ else {
203
+ map.scrollZoom.disable();
204
+ map.doubleClickZoom.disable();
205
+ }
206
+ }));
207
+ }));
208
+ });
157
209
  this.setPitch = this.effect((input) => {
158
210
  return input.pipe(switchMap((pitch) => {
159
211
  return this.mapInstance$.pipe(tap((map) => map.setPitch(pitch)));
@@ -260,17 +312,41 @@ class DbxMapboxMapStore extends ComponentStore {
260
312
  this.isRotating$ = this.whenInitialized$.pipe(switchMap(() => this.rotateState$.pipe(map((x) => x === 'rotating'), distinctUntilChanged(), shareReplay())));
261
313
  this._movingTimer = this.movingTimer();
262
314
  this._renderingTimer = this.lifecycleRenderTimer();
263
- this.centerNow$ = this.whenInitialized$.pipe(switchMap(() => this.mapInstance$.pipe(switchMap((x) => this._movingTimer.pipe(map(() => this.latLngPoint(x.getCenter())))), shareReplay(1))));
315
+ this.centerNow$ = this.whenInitialized$.pipe(switchMap(() => this.mapInstance$.pipe(switchMap((x) => this._movingTimer.pipe(map(() => this.latLngPoint(x.getCenter())))), shareReplay(1))), shareReplay(1));
264
316
  this.center$ = this.whenInitialized$.pipe(switchMap(() => {
265
317
  return this.isMoving$.pipe(onTrueToFalse(), startWith(undefined), switchMap(() => this.centerNow$.pipe(first())), distinctUntilChanged(isSameLatLngPoint), shareReplay(1));
318
+ }), shareReplay(1));
319
+ 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));
320
+ this.reverseMargin$ = this.margin$.pipe(map((x) => {
321
+ if (x) {
322
+ return { leftMargin: -x.leftMargin, rightMargin: -x.rightMargin, fullWidth: x.fullWidth };
323
+ }
324
+ else {
325
+ return x;
326
+ }
266
327
  }));
328
+ this.centerGivenMargin$ = this.whenInitialized$.pipe(switchMap(() => {
329
+ return this.reverseMargin$.pipe(switchMap((x) => {
330
+ if (x) {
331
+ return this.center$.pipe(switchMap((_) => this.calculateNextCenterOffsetWithScreenMarginChange(x)));
332
+ }
333
+ else {
334
+ return this.isMoving$.pipe(filter((x) => !x), switchMap(() => this.center$));
335
+ }
336
+ }));
337
+ }), shareReplay(1));
267
338
  this.boundNow$ = this.whenInitialized$.pipe(switchMap(() => this.mapInstance$.pipe(switchMap((x) => this._renderingTimer.pipe(map(() => {
268
339
  const bound = x.getBounds();
269
- return this.latLngBound([bound.getSouthWest(), bound.getNorthEast()]);
340
+ const boundSw = bound.getSouthWest();
341
+ const boundNe = bound.getNorthEast();
342
+ const sw = isDefaultLatLngPoint(boundSw) ? swMostLatLngPoint() : boundSw;
343
+ const ne = isDefaultLatLngPoint(boundNe) ? neMostLatLngPoint() : boundNe;
344
+ return this.latLngBound(sw, ne);
270
345
  }))), shareReplay(1))));
271
346
  this.bound$ = this.whenInitialized$.pipe(switchMap(() => {
272
347
  return this.isRendering$.pipe(onTrueToFalse(), startWith(undefined), switchMap((x) => this.boundNow$.pipe(first())), distinctUntilChanged(isSameLatLngBound), shareReplay(1));
273
348
  }));
349
+ this.boundWrapsAroundWorld$ = this.bound$.pipe(map((x) => latLngBoundWrapsMap(x)), distinctUntilChanged(), shareReplay(1));
274
350
  this.isWithinBoundFunction$ = this.bound$.pipe(map((x) => isWithinLatLngBoundFunction(x)), shareReplay(1));
275
351
  this.overlapsBoundFunction$ = this.bound$.pipe(map((x) => overlapsLatLngBoundFunction(x)), shareReplay(1));
276
352
  this.zoomNow$ = this.whenInitialized$.pipe(switchMap(() => this.mapInstance$.pipe(switchMap((x) => this._renderingTimer.pipe(map(() => x.getZoom()))), shareReplay(1))));
@@ -291,6 +367,7 @@ class DbxMapboxMapStore extends ComponentStore {
291
367
  this.doubleClickEvent$ = this.state$.pipe(map((x) => x.doubleClickEvent), distinctUntilChanged(), shareReplay(1));
292
368
  this.rightClickEvent$ = this.state$.pipe(map((x) => x.rightClickEvent), distinctUntilChanged(), shareReplay(1));
293
369
  // MARK: State Changes
370
+ this.setMargin = this.updater((state, margin) => ({ ...state, margin: margin && (margin.rightMargin !== 0 || margin.leftMargin !== 0) ? margin : undefined }));
294
371
  this._setMapService = this.updater((state, mapService) => ({ mapService, moveState: 'init', lifecycleState: 'init', zoomState: 'init', rotateState: 'init', retainContent: state.retainContent, content: state.retainContent ? state.content : undefined }));
295
372
  this._setLifecycleState = this.updater((state, lifecycleState) => ({ ...state, lifecycleState }));
296
373
  this._setMoveState = this.updater((state, moveState) => ({ ...state, moveState }));
@@ -341,23 +418,22 @@ class DbxMapboxMapStore extends ComponentStore {
341
418
  }))));
342
419
  }
343
420
  calculateNextCenterOffsetWithScreenMarginChange(sizing) {
344
- return this.atNextIdle().pipe(switchMap(() => this.bound$.pipe((first(),
345
- map((bounds) => {
346
- const diff = diffLatLngBoundPoints(bounds);
347
- const center = latLngBoundCenterPoint(bounds);
348
- const offsetWidth = sizing.leftMargin + sizing.rightMargin; // 300 + 0
349
- const newWidth = sizing.fullWidth - offsetWidth; // 1000 - 300 - 0
350
- const newWidthRatio = newWidth / sizing.fullWidth; // 700 / 1000
351
- const newCenterLongitudeWidth = diff.lng * newWidthRatio; // 70% offset
352
- const effectiveOffset = {
353
- lat: 0,
354
- lng: newCenterLongitudeWidth / 2
355
- };
356
- const newCenter = addLatLngPoints(bounds.sw, effectiveOffset);
357
- newCenter.lat = center.lat; // retain center position
358
- // console.log({ sizing, bounds, effectiveOffset, newWidth, offsetWidth, diff, center, newCenter });
359
- return newCenter;
360
- })))));
421
+ return this.atNextIdle().pipe(switchMap(() => this.bound$.pipe(first(), map((bounds) => {
422
+ const diff = diffLatLngBoundPoints(bounds);
423
+ const center = latLngBoundCenterPoint(bounds);
424
+ const offsetWidth = sizing.leftMargin + sizing.rightMargin; // 300 + 0
425
+ const newWidth = sizing.fullWidth - offsetWidth; // 1000 - 300 - 0
426
+ const newWidthRatio = newWidth / sizing.fullWidth; // 700 / 1000
427
+ const newCenterLongitudeWidth = diff.lng * newWidthRatio; // 70% offset
428
+ const effectiveOffset = {
429
+ lat: 0,
430
+ lng: newCenterLongitudeWidth / 2
431
+ };
432
+ const newCenter = addLatLngPoints(bounds.sw, effectiveOffset);
433
+ newCenter.lat = center.lat; // retain center position
434
+ // console.log({ sizing, bounds, effectiveOffset, newWidth, offsetWidth, diff, center, newCenter });
435
+ return newCenter;
436
+ }))));
361
437
  }
362
438
  }
363
439
  DbxMapboxMapStore.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxMapStore, deps: [{ token: DbxMapboxService }], target: i0.ɵɵFactoryTarget.Injectable });
@@ -437,12 +513,14 @@ class DbxMapboxLayoutComponent extends SubscriptionObject {
437
513
  this.dbxMapboxMapStore = dbxMapboxMapStore;
438
514
  this._resized = new Subject();
439
515
  this._updateMargins = new Subject();
516
+ this._forceHasContent = new BehaviorSubject(false);
440
517
  this._side = new BehaviorSubject('right');
441
518
  this._openToggle = new BehaviorSubject(true);
442
519
  this._color = new BehaviorSubject(undefined);
443
520
  this._toggleSub = new SubscriptionObject();
444
521
  this.side$ = this._side.pipe(distinctUntilChanged(), shareReplay(1));
445
- this.opened$ = combineLatest([this.dbxMapboxMapStore.hasContent$, this._openToggle]).pipe(map(([hasContent, open]) => hasContent && open), distinctUntilChanged(), shareReplay(1));
522
+ this.hasContent$ = combineLatest([this._forceHasContent, this.dbxMapboxMapStore.hasContent$]).pipe(map(([hasContent, forceHasContent]) => hasContent || forceHasContent), distinctUntilChanged(), shareReplay(1));
523
+ this.opened$ = combineLatest([this.hasContent$, this._openToggle]).pipe(map(([hasContent, open]) => hasContent && open), distinctUntilChanged(), shareReplay(1));
446
524
  this.position$ = this.side$.pipe(map((x) => (x === 'right' ? 'end' : 'start')), distinctUntilChanged(), shareReplay(1));
447
525
  this.drawerClasses$ = combineLatest([this.side$, this.dbxMapboxMapStore.hasContent$, this.opened$]).pipe(
448
526
  //
@@ -470,7 +548,8 @@ class DbxMapboxLayoutComponent extends SubscriptionObject {
470
548
  }
471
549
  });
472
550
  });
473
- this._toggleSub.subscription = combineLatest([this.opened$.pipe(distinctUntilChanged(), skip(1)), this._updateMargins]).subscribe(([opened]) => {
551
+ let init = false;
552
+ this._toggleSub.subscription = combineLatest([this.opened$.pipe(distinctUntilChanged()), this._updateMargins]).subscribe(([opened]) => {
474
553
  let { right } = this.container._contentMargins;
475
554
  this.container.updateContentMargins();
476
555
  setTimeout(() => {
@@ -481,14 +560,19 @@ class DbxMapboxLayoutComponent extends SubscriptionObject {
481
560
  right = (right || 0) * flip;
482
561
  const element = this.content.nativeElement;
483
562
  const width = element.clientWidth;
484
- const easeTo = this.dbxMapboxMapStore
485
- .calculateNextCenterOffsetWithScreenMarginChange({
563
+ const margin = {
486
564
  leftMargin: 0,
487
565
  rightMargin: right,
488
566
  fullWidth: width
489
- })
490
- .pipe(first(), map((center) => ({ to: { center, duration: 3200, essential: false } })));
491
- this.dbxMapboxMapStore.easeTo(easeTo);
567
+ };
568
+ const easeTo = this.dbxMapboxMapStore.calculateNextCenterOffsetWithScreenMarginChange(margin).pipe(first(), map((center) => ({ to: { center, duration: 3200, essential: false } })));
569
+ this.dbxMapboxMapStore.setMargin(opened ? margin : undefined);
570
+ if (!init) {
571
+ this.dbxMapboxMapStore.easeTo(easeTo);
572
+ }
573
+ else {
574
+ init = true;
575
+ }
492
576
  });
493
577
  });
494
578
  }
@@ -499,6 +583,7 @@ class DbxMapboxLayoutComponent extends SubscriptionObject {
499
583
  this._openToggle.complete();
500
584
  this._color.complete();
501
585
  this._toggleSub.destroy();
586
+ this._forceHasContent.complete();
502
587
  }
503
588
  toggleDrawer(open) {
504
589
  if (open == null) {
@@ -516,6 +601,11 @@ class DbxMapboxLayoutComponent extends SubscriptionObject {
516
601
  this._openToggle.next(opened);
517
602
  }
518
603
  }
604
+ set hasContent(hasContent) {
605
+ if (hasContent != null) {
606
+ this._forceHasContent.next(hasContent);
607
+ }
608
+ }
519
609
  set drawerColor(color) {
520
610
  this._color.next(color);
521
611
  }
@@ -524,7 +614,7 @@ class DbxMapboxLayoutComponent extends SubscriptionObject {
524
614
  }
525
615
  }
526
616
  DbxMapboxLayoutComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxLayoutComponent, deps: [{ token: DbxMapboxMapStore }], target: i0.ɵɵFactoryTarget.Component });
527
- 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" }] });
617
+ 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" }] });
528
618
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxLayoutComponent, decorators: [{
529
619
  type: Component,
530
620
  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"] }]
@@ -538,6 +628,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImpor
538
628
  type: Input
539
629
  }], opened: [{
540
630
  type: Input
631
+ }], hasContent: [{
632
+ type: Input
541
633
  }], drawerColor: [{
542
634
  type: Input
543
635
  }] } });
@@ -630,12 +722,152 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImpor
630
722
  args: ['dbxMapboxMenu']
631
723
  }] } });
632
724
 
725
+ /**
726
+ * Token used by provideMapboxStoreIfDoesNotExist() to prevent injecting a parent DbxMapboxMapStore into the child view.
727
+ */
728
+ class DbxMapboxMapStoreProviderBlock {
729
+ constructor(dbxMapboxMapStore) {
730
+ this.dbxMapboxMapStore = dbxMapboxMapStore;
731
+ }
732
+ }
733
+ 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 });
734
+ DbxMapboxMapStoreProviderBlock.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxMapStoreProviderBlock });
735
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxMapStoreProviderBlock, decorators: [{
736
+ type: Injectable
737
+ }], ctorParameters: function () { return [{ type: DbxMapboxMapStore, decorators: [{
738
+ type: SkipSelf
739
+ }] }]; } });
740
+ class DbxMapboxMapStoreInjectionBlockDirective {
741
+ }
742
+ DbxMapboxMapStoreInjectionBlockDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxMapStoreInjectionBlockDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
743
+ DbxMapboxMapStoreInjectionBlockDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.2", type: DbxMapboxMapStoreInjectionBlockDirective, selector: "[dbxMapboxStoreParentBlocker]", providers: [DbxMapboxMapStoreProviderBlock], ngImport: i0 });
744
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxMapStoreInjectionBlockDirective, decorators: [{
745
+ type: Directive,
746
+ args: [{
747
+ selector: '[dbxMapboxStoreParentBlocker]',
748
+ providers: [DbxMapboxMapStoreProviderBlock]
749
+ }]
750
+ }] });
751
+ /**
752
+ * Creates a Provider that initializes a new DbxMapboxMapStore if a parent does not exist.
753
+ *
754
+ * If a DbxMapboxMapStoreInjectionBlock is available in the context, and references the same dbxMapboxMapStore that is attempting to be injected, a new DbxMapboxMapStore is created.
755
+ *
756
+ * @returns
757
+ */
758
+ function provideMapboxStoreIfParentIsUnavailable() {
759
+ return {
760
+ provide: DbxMapboxMapStore,
761
+ useFactory: (parentInjector, dbxMapboxMapStoreInjectionBlock, dbxMapboxMapStore) => {
762
+ if (!dbxMapboxMapStore || (dbxMapboxMapStore && dbxMapboxMapStoreInjectionBlock != null && dbxMapboxMapStoreInjectionBlock.dbxMapboxMapStore === dbxMapboxMapStore)) {
763
+ // create a new dbxMapboxMapStore to use
764
+ const injector = Injector.create({ providers: [{ provide: DbxMapboxMapStore }], parent: parentInjector });
765
+ dbxMapboxMapStore = injector.get(DbxMapboxMapStore);
766
+ }
767
+ return dbxMapboxMapStore;
768
+ },
769
+ deps: [Injector, [new Optional(), DbxMapboxMapStoreProviderBlock], [new Optional(), new SkipSelf(), DbxMapboxMapStore]]
770
+ };
771
+ }
772
+
773
+ class DbxMapboxMarkerComponent {
774
+ constructor() { }
775
+ get marker() {
776
+ return this._marker;
777
+ }
778
+ set marker(marker) {
779
+ this._marker = marker;
780
+ }
781
+ get latLng() {
782
+ return this._marker?.latLng;
783
+ }
784
+ get anchor() {
785
+ return this._marker?.anchor;
786
+ }
787
+ get label() {
788
+ return this._marker?.label;
789
+ }
790
+ get icon() {
791
+ return this._marker?.icon;
792
+ }
793
+ get style() {
794
+ let width = 0;
795
+ let height = 0;
796
+ const size = this._marker?.size || 'medium';
797
+ if (typeof size === 'number') {
798
+ width = size;
799
+ }
800
+ else {
801
+ switch (size) {
802
+ case 'small':
803
+ width = 18;
804
+ break;
805
+ case 'medium':
806
+ width = 24;
807
+ break;
808
+ case 'large':
809
+ width = 32;
810
+ break;
811
+ case 'tall':
812
+ width = 24;
813
+ height = 32;
814
+ break;
815
+ }
816
+ }
817
+ if (!height) {
818
+ height = width;
819
+ }
820
+ const imageInput = this._marker?.image;
821
+ const image = imageInput ? (typeof imageInput === 'string' ? imageInput : getValueFromGetter(imageInput, width)) : undefined;
822
+ let style = {
823
+ ...this._marker?.style,
824
+ width: width + 'px',
825
+ height: height + 'px',
826
+ 'font-size': width + 'px',
827
+ 'background-image': image
828
+ };
829
+ return style;
830
+ }
831
+ }
832
+ DbxMapboxMarkerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxMarkerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
833
+ DbxMapboxMarkerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.2", type: DbxMapboxMarkerComponent, selector: "dbx-mapbox-marker", inputs: { marker: "marker" }, ngImport: i0, template: `
834
+ <mgl-marker *ngIf="marker" [lngLat]="latLng">
835
+ <dbx-anchor [anchor]="anchor">
836
+ <div class="dbx-mapbox-marker">
837
+ <div class="dbx-mapbox-marker-content" [ngStyle]="style">
838
+ <mat-icon *ngIf="icon">{{ icon }}</mat-icon>
839
+ </div>
840
+ <div class="dbx-mapbox-marker-label" *ngIf="label">{{ label }}</div>
841
+ </div>
842
+ </dbx-anchor>
843
+ </mgl-marker>
844
+ `, 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 });
845
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxMarkerComponent, decorators: [{
846
+ type: Component,
847
+ args: [{ selector: 'dbx-mapbox-marker', template: `
848
+ <mgl-marker *ngIf="marker" [lngLat]="latLng">
849
+ <dbx-anchor [anchor]="anchor">
850
+ <div class="dbx-mapbox-marker">
851
+ <div class="dbx-mapbox-marker-content" [ngStyle]="style">
852
+ <mat-icon *ngIf="icon">{{ icon }}</mat-icon>
853
+ </div>
854
+ <div class="dbx-mapbox-marker-label" *ngIf="label">{{ label }}</div>
855
+ </div>
856
+ </dbx-anchor>
857
+ </mgl-marker>
858
+ `, 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"] }]
859
+ }], ctorParameters: function () { return []; }, propDecorators: { marker: [{
860
+ type: Input
861
+ }] } });
862
+
633
863
  const declarations = [
634
864
  //
635
865
  DbxMapboxMapDirective,
636
866
  DbxMapboxLayoutComponent,
637
867
  DbxMapboxLayoutDrawerComponent,
638
- DbxMapboxMenuComponent
868
+ DbxMapboxMenuComponent,
869
+ DbxMapboxMarkerComponent,
870
+ DbxMapboxMapStoreInjectionBlockDirective
639
871
  ];
640
872
  class DbxMapboxModule {
641
873
  static forRoot(config) {
@@ -656,19 +888,25 @@ DbxMapboxModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version
656
888
  DbxMapboxMapDirective,
657
889
  DbxMapboxLayoutComponent,
658
890
  DbxMapboxLayoutDrawerComponent,
659
- DbxMapboxMenuComponent], imports: [
891
+ DbxMapboxMenuComponent,
892
+ DbxMapboxMarkerComponent,
893
+ DbxMapboxMapStoreInjectionBlockDirective], imports: [
660
894
  //
661
895
  CommonModule,
662
896
  MatSidenavModule,
663
897
  DbxInjectionComponentModule,
664
898
  MatButtonModule,
665
899
  MatIconModule,
666
- AngularResizeEventModule], exports: [
900
+ AngularResizeEventModule,
901
+ DbxRouterAnchorModule,
902
+ NgxMapboxGLModule], exports: [
667
903
  //
668
904
  DbxMapboxMapDirective,
669
905
  DbxMapboxLayoutComponent,
670
906
  DbxMapboxLayoutDrawerComponent,
671
- DbxMapboxMenuComponent] });
907
+ DbxMapboxMenuComponent,
908
+ DbxMapboxMarkerComponent,
909
+ DbxMapboxMapStoreInjectionBlockDirective] });
672
910
  DbxMapboxModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxModule, imports: [
673
911
  //
674
912
  CommonModule,
@@ -676,7 +914,9 @@ DbxMapboxModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version
676
914
  DbxInjectionComponentModule,
677
915
  MatButtonModule,
678
916
  MatIconModule,
679
- AngularResizeEventModule] });
917
+ AngularResizeEventModule,
918
+ DbxRouterAnchorModule,
919
+ NgxMapboxGLModule] });
680
920
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: DbxMapboxModule, decorators: [{
681
921
  type: NgModule,
682
922
  args: [{
@@ -687,7 +927,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImpor
687
927
  DbxInjectionComponentModule,
688
928
  MatButtonModule,
689
929
  MatIconModule,
690
- AngularResizeEventModule
930
+ AngularResizeEventModule,
931
+ DbxRouterAnchorModule,
932
+ NgxMapboxGLModule
691
933
  ],
692
934
  declarations,
693
935
  exports: declarations
@@ -705,10 +947,15 @@ const KNOWN_MAPBOX_STYLES = [
705
947
  'mapbox://styles/mapbox/navigation-day-v1',
706
948
  'mapbox://styles/mapbox/navigation-night-v1'
707
949
  ];
950
+ const MAPBOX_MIN_ZOOM_LEVEL = 0;
951
+ const MAPBOX_MAX_ZOOM_LEVEL = 22;
952
+ function mapboxZoomLevel(input) {
953
+ return Math.min(Math.max(input, MAPBOX_MIN_ZOOM_LEVEL), MAPBOX_MAX_ZOOM_LEVEL);
954
+ }
708
955
 
709
956
  /**
710
957
  * Generated bundle index. Do not edit.
711
958
  */
712
959
 
713
- 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 };
960
+ 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 };
714
961
  //# sourceMappingURL=dereekb-dbx-web-mapbox.mjs.map