@dereekb/dbx-web 9.6.5 → 9.7.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 (34) hide show
  1. package/esm2020/mapbox/lib/index.mjs +4 -1
  2. package/esm2020/mapbox/lib/mapbox.cdref.service.mjs +28 -0
  3. package/esm2020/mapbox/lib/mapbox.marker.component.mjs +2 -3
  4. package/esm2020/mapbox/lib/mapbox.markers.component.mjs +18 -11
  5. package/esm2020/mapbox/lib/mapbox.mjs +1 -1
  6. package/esm2020/mapbox/lib/mapbox.rxjs.mjs +53 -0
  7. package/esm2020/mapbox/lib/mapbox.store.mjs +28 -14
  8. package/esm2020/mapbox/lib/mapbox.util.mjs +15 -0
  9. package/fesm2015/dereekb-dbx-web-mapbox.mjs +146 -35
  10. package/fesm2015/dereekb-dbx-web-mapbox.mjs.map +1 -1
  11. package/fesm2020/dereekb-dbx-web-mapbox.mjs +141 -35
  12. package/fesm2020/dereekb-dbx-web-mapbox.mjs.map +1 -1
  13. package/mapbox/esm2020/lib/index.mjs +4 -1
  14. package/mapbox/esm2020/lib/mapbox.cdref.service.mjs +28 -0
  15. package/mapbox/esm2020/lib/mapbox.marker.component.mjs +2 -3
  16. package/mapbox/esm2020/lib/mapbox.markers.component.mjs +18 -11
  17. package/mapbox/esm2020/lib/mapbox.mjs +1 -1
  18. package/mapbox/esm2020/lib/mapbox.rxjs.mjs +53 -0
  19. package/mapbox/esm2020/lib/mapbox.store.mjs +28 -14
  20. package/mapbox/esm2020/lib/mapbox.util.mjs +15 -0
  21. package/mapbox/fesm2015/dereekb-dbx-web-mapbox.mjs +146 -35
  22. package/mapbox/fesm2015/dereekb-dbx-web-mapbox.mjs.map +1 -1
  23. package/mapbox/fesm2020/dereekb-dbx-web-mapbox.mjs +141 -35
  24. package/mapbox/fesm2020/dereekb-dbx-web-mapbox.mjs.map +1 -1
  25. package/mapbox/lib/index.d.ts +3 -0
  26. package/mapbox/lib/mapbox.cdref.service.d.ts +13 -0
  27. package/mapbox/lib/mapbox.d.ts +6 -0
  28. package/mapbox/lib/mapbox.marker.component.d.ts +0 -1
  29. package/mapbox/lib/mapbox.markers.component.d.ts +4 -1
  30. package/mapbox/lib/mapbox.rxjs.d.ts +44 -0
  31. package/mapbox/lib/mapbox.store.d.ts +12 -1
  32. package/mapbox/lib/mapbox.util.d.ts +27 -0
  33. package/mapbox/package.json +5 -5
  34. package/package.json +3 -3
@@ -1,19 +1,22 @@
1
1
  import { Maybe } from '@dereekb/util';
2
2
  import { OnDestroy } from '@angular/core';
3
3
  import { DbxMapboxMarkerFactory } from './mapbox.marker';
4
+ import { DbxMapboxChangeDetectorRefService } from './mapbox.cdref.service';
4
5
  import * as i0 from "@angular/core";
5
6
  /**
6
7
  * Component used to render a set of DbxMapboxMarker values from the input data and marker factory.
7
8
  */
8
9
  export declare class DbxMapboxMarkersComponent<T> implements OnDestroy {
10
+ readonly cdRefService?: DbxMapboxChangeDetectorRefService | undefined;
9
11
  private _data;
10
12
  private _markerFactory;
11
13
  readonly markers$: import("rxjs").Observable<import("./mapbox.marker").DbxMapboxMarker[]>;
14
+ constructor(cdRefService?: DbxMapboxChangeDetectorRefService | undefined);
12
15
  get data(): Maybe<T[]>;
13
16
  set data(data: Maybe<T[]>);
14
17
  get markerFactory(): Maybe<DbxMapboxMarkerFactory<T>>;
15
18
  set markerFactory(markerFactory: Maybe<DbxMapboxMarkerFactory<T>>);
16
19
  ngOnDestroy(): void;
17
- static ɵfac: i0.ɵɵFactoryDeclaration<DbxMapboxMarkersComponent<any>, never>;
20
+ static ɵfac: i0.ɵɵFactoryDeclaration<DbxMapboxMarkersComponent<any>, [{ optional: true; }]>;
18
21
  static ɵcmp: i0.ɵɵComponentDeclaration<DbxMapboxMarkersComponent<any>, "dbx-mapbox-markers", never, { "data": "data"; "markerFactory": "markerFactory"; }, {}, never, never, false>;
19
22
  }
@@ -0,0 +1,44 @@
1
+ import { ObservableOrValue } from '@dereekb/rxjs';
2
+ import { LatLngPointInput, LatLngBound, LatLngBoundCheckFunction, RoundNumberToStepFunctionInput, LatLngPrecision, Maybe } from '@dereekb/util';
3
+ import { OperatorFunction } from 'rxjs';
4
+ import { MapboxZoomLevel } from './mapbox';
5
+ import { MapboxViewportBoundFunction } from './mapbox.util';
6
+ export interface FilterMapboxBoundConfig<T> {
7
+ boundFunctionObs: ObservableOrValue<MapboxViewportBoundFunction>;
8
+ boundDecisionObs: ObservableOrValue<LatLngBoundCheckFunction>;
9
+ /**
10
+ * Reads the value from the input item.
11
+ */
12
+ readValue: (value: T) => MapboxViewportBoundFunctionItemValue;
13
+ /**
14
+ * Minimum precision to retain. Defaults to LAT_LONG_10M_PRECISION
15
+ */
16
+ precision?: LatLngPrecision;
17
+ /**
18
+ * Amount of zoom rounding to use. By default rounds to 0.5 steps using "floor" in order to "round up" since zoom values are inversely proportional to bounds area.
19
+ */
20
+ zoomRounding?: RoundNumberToStepFunctionInput;
21
+ /**
22
+ * Default zoom level for item values that do not have an explicit zoom, or a zoom of 0.
23
+ *
24
+ * Defaults to 17, which can produce a viewport/bounds about the size of a park.
25
+ */
26
+ defaultZoom?: MapboxZoomLevel;
27
+ }
28
+ export interface MapboxViewportBoundFunctionItemValue {
29
+ readonly center: LatLngPointInput;
30
+ readonly zoom?: Maybe<MapboxZoomLevel>;
31
+ }
32
+ export interface MapboxViewportBoundFunctionItem<T> {
33
+ readonly value: T;
34
+ readonly bound: LatLngBound;
35
+ }
36
+ /**
37
+ * Filters the input objects based on their center and zoom values.
38
+ *
39
+ * This function caches the bounds computations for each of the input values.
40
+ *
41
+ * @param config
42
+ * @returns
43
+ */
44
+ export declare function filterByMapboxViewportBound<T>(config: FilterMapboxBoundConfig<T>): OperatorFunction<T[], T[]>;
@@ -1,5 +1,5 @@
1
1
  import { OnDestroy } from '@angular/core';
2
- import { IsWithinLatLngBoundFunction, LatLngBound, LatLngPointInput, LatLngPoint, Maybe, OverlapsLatLngBoundFunction } from '@dereekb/util';
2
+ import { IsWithinLatLngBoundFunction, LatLngBound, LatLngPointInput, LatLngPoint, Maybe, OverlapsLatLngBoundFunction, Vector } from '@dereekb/util';
3
3
  import { ComponentStore } from '@ngrx/component-store';
4
4
  import { MapService } from 'ngx-mapbox-gl';
5
5
  import { Observable, Subscription } from 'rxjs';
@@ -7,6 +7,7 @@ import * as MapboxGl from 'mapbox-gl';
7
7
  import { DbxMapboxClickEvent, MapboxEaseTo, MapboxFitBounds, MapboxFlyTo, MapboxJumpTo, MapboxResetNorth, MapboxResetNorthPitch, MapboxRotateTo, MapboxSnapToNorth, MapboxStyleConfig, MapboxZoomLevel } from './mapbox';
8
8
  import { DbxMapboxService } from './mapbox.service';
9
9
  import { DbxInjectionComponentConfig } from '@dereekb/dbx-core';
10
+ import { MapboxViewportBoundFunction } from './mapbox.util';
10
11
  import * as i0 from "@angular/core";
11
12
  export declare type MapboxMapLifecycleState = 'init' | 'load' | 'render' | 'idle';
12
13
  export declare type MapboxMapMoveState = 'init' | 'idle' | 'moving';
@@ -34,6 +35,10 @@ export interface DbxMapboxStoreState {
34
35
  moveState: MapboxMapMoveState;
35
36
  zoomState: MapboxMapZoomState;
36
37
  rotateState: MapboxMapRotateState;
38
+ /**
39
+ * Visual container size of the map.
40
+ */
41
+ mapCanvasSize?: Maybe<Vector>;
37
42
  /**
38
43
  * Latest click event
39
44
  */
@@ -70,6 +75,7 @@ export interface DbxMapboxStoreState {
70
75
  */
71
76
  export declare class DbxMapboxMapStore extends ComponentStore<DbxMapboxStoreState> implements OnDestroy {
72
77
  private readonly dbxMapboxService;
78
+ private safeLatLngPoint;
73
79
  private latLngPoint;
74
80
  private latLngBound;
75
81
  constructor(dbxMapboxService: DbxMapboxService);
@@ -129,6 +135,7 @@ export declare class DbxMapboxMapStore extends ComponentStore<DbxMapboxStoreStat
129
135
  readonly centerGivenMargin$: Observable<LatLngPoint>;
130
136
  readonly boundNow$: Observable<LatLngBound>;
131
137
  readonly bound$: Observable<LatLngBound>;
138
+ readonly boundSizing$: Observable<LatLngPoint>;
132
139
  readonly boundWrapsAroundWorld$: Observable<boolean>;
133
140
  readonly isWithinBoundFunction$: Observable<IsWithinLatLngBoundFunction>;
134
141
  readonly overlapsBoundFunction$: Observable<OverlapsLatLngBoundFunction>;
@@ -140,6 +147,9 @@ export declare class DbxMapboxMapStore extends ComponentStore<DbxMapboxStoreStat
140
147
  readonly bearing$: Observable<number>;
141
148
  readonly content$: Observable<Maybe<DbxInjectionComponentConfig<unknown>>>;
142
149
  readonly hasContent$: Observable<boolean>;
150
+ readonly currentMapCanvasSize$: Observable<Maybe<Vector>>;
151
+ readonly mapCanvasSize$: Observable<Vector>;
152
+ readonly viewportBoundFunction$: Observable<MapboxViewportBoundFunction>;
143
153
  readonly clickEvent$: Observable<Maybe<DbxMapboxClickEvent>>;
144
154
  readonly doubleClickEvent$: Observable<Maybe<DbxMapboxClickEvent>>;
145
155
  readonly rightClickEvent$: Observable<Maybe<DbxMapboxClickEvent>>;
@@ -149,6 +159,7 @@ export declare class DbxMapboxMapStore extends ComponentStore<DbxMapboxStoreStat
149
159
  private readonly _setMoveState;
150
160
  private readonly _setZoomState;
151
161
  private readonly _setRotateState;
162
+ private readonly _setMapCanvasSize;
152
163
  private readonly _setClickEvent;
153
164
  private readonly _setDoubleClickEvent;
154
165
  private readonly _setRightClickEvent;
@@ -0,0 +1,27 @@
1
+ import { LatLngBound, LatLngPoint, Vector } from '@dereekb/util';
2
+ import { MapboxTileSize, MapboxZoomLevel } from './mapbox';
3
+ export interface MapboxViewportBoundFunctionConfig {
4
+ readonly mapCanvasSize: Vector;
5
+ /**
6
+ * Mapbox tilesize being used. Defaults to 512x512.
7
+ */
8
+ readonly tileSize?: MapboxTileSize;
9
+ }
10
+ /**
11
+ * Input for MapboxViewportBoundFunction.
12
+ */
13
+ export interface MapboxViewportBoundFunctionInput {
14
+ /**
15
+ * Center of the viewport
16
+ */
17
+ readonly center: LatLngPoint;
18
+ /**
19
+ * Zoom level
20
+ */
21
+ readonly zoom: MapboxZoomLevel;
22
+ }
23
+ /**
24
+ * Used to calculate the bounds of a view/object given the input MapboxViewportBoundFunctionInput.
25
+ */
26
+ export declare type MapboxViewportBoundFunction = (input: MapboxViewportBoundFunctionInput) => LatLngBound;
27
+ export declare function mapboxViewportBoundFunction(config: MapboxViewportBoundFunctionConfig): MapboxViewportBoundFunction;
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@dereekb/dbx-web/mapbox",
3
- "version": "9.6.5",
3
+ "version": "9.7.2",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^14.1.0",
6
6
  "@angular/core": "^14.1.0",
7
- "rxjs": "^7.5.0",
8
- "@dereekb/util": "9.6.5",
9
- "@dereekb/dbx-web": "9.6.5",
7
+ "@dereekb/dbx-core": "9.7.2",
8
+ "@dereekb/dbx-web": "9.7.2",
10
9
  "ngx-mapbox-gl": "^9.1.0",
11
- "mapbox-gl": "^2.9.2"
10
+ "mapbox-gl": "^2.9.2",
11
+ "@mapbox/geo-viewport": "git+https://git@github.com/dereekb/geo-viewport#165513972f87dca23a20c177f4d173edc51b5e2f"
12
12
  },
13
13
  "dependencies": {
14
14
  "tslib": "^2.3.0"
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@dereekb/dbx-web",
3
- "version": "9.6.5",
3
+ "version": "9.7.2",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^14.0.0",
6
6
  "@angular/core": "^14.0.0",
7
7
  "linkify-string": "4.0.0-beta.5",
8
8
  "linkifyjs": "^4.0.0-beta.5",
9
9
  "@angular/material": "^14.0.0",
10
- "@dereekb/rxjs": "9.6.5",
11
- "@dereekb/dbx-core": "9.6.5",
10
+ "@dereekb/rxjs": "9.7.2",
11
+ "@dereekb/dbx-core": "9.7.2",
12
12
  "angular-calendar": "^0.30.1",
13
13
  "@angular/flex-layout": "^14.0.0-beta.40",
14
14
  "ng-overlay-container": "^14.0.0",