@dereekb/dbx-web 9.6.3 → 9.7.0

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 (42) hide show
  1. package/esm2020/mapbox/lib/index.mjs +5 -1
  2. package/esm2020/mapbox/lib/mapbox.layout.component.mjs +1 -1
  3. package/esm2020/mapbox/lib/mapbox.marker.component.mjs +10 -8
  4. package/esm2020/mapbox/lib/mapbox.marker.mjs +16 -0
  5. package/esm2020/mapbox/lib/mapbox.markers.component.mjs +59 -0
  6. package/esm2020/mapbox/lib/mapbox.menu.component.mjs +1 -1
  7. package/esm2020/mapbox/lib/mapbox.mjs +1 -1
  8. package/esm2020/mapbox/lib/mapbox.module.mjs +5 -1
  9. package/esm2020/mapbox/lib/mapbox.rxjs.mjs +53 -0
  10. package/esm2020/mapbox/lib/mapbox.store.mjs +27 -14
  11. package/esm2020/mapbox/lib/mapbox.util.mjs +15 -0
  12. package/fesm2015/dereekb-dbx-web-mapbox.mjs +180 -29
  13. package/fesm2015/dereekb-dbx-web-mapbox.mjs.map +1 -1
  14. package/fesm2020/dereekb-dbx-web-mapbox.mjs +180 -29
  15. package/fesm2020/dereekb-dbx-web-mapbox.mjs.map +1 -1
  16. package/lib/layout/text/_text.scss +18 -0
  17. package/mapbox/esm2020/lib/index.mjs +5 -1
  18. package/mapbox/esm2020/lib/mapbox.layout.component.mjs +1 -1
  19. package/mapbox/esm2020/lib/mapbox.marker.component.mjs +10 -8
  20. package/mapbox/esm2020/lib/mapbox.marker.mjs +16 -0
  21. package/mapbox/esm2020/lib/mapbox.markers.component.mjs +59 -0
  22. package/mapbox/esm2020/lib/mapbox.menu.component.mjs +1 -1
  23. package/mapbox/esm2020/lib/mapbox.mjs +1 -1
  24. package/mapbox/esm2020/lib/mapbox.module.mjs +5 -1
  25. package/mapbox/esm2020/lib/mapbox.rxjs.mjs +53 -0
  26. package/mapbox/esm2020/lib/mapbox.store.mjs +27 -14
  27. package/mapbox/esm2020/lib/mapbox.util.mjs +15 -0
  28. package/mapbox/fesm2015/dereekb-dbx-web-mapbox.mjs +180 -29
  29. package/mapbox/fesm2015/dereekb-dbx-web-mapbox.mjs.map +1 -1
  30. package/mapbox/fesm2020/dereekb-dbx-web-mapbox.mjs +180 -29
  31. package/mapbox/fesm2020/dereekb-dbx-web-mapbox.mjs.map +1 -1
  32. package/mapbox/lib/index.d.ts +4 -0
  33. package/mapbox/lib/mapbox.d.ts +6 -0
  34. package/mapbox/lib/mapbox.marker.component.d.ts +4 -33
  35. package/mapbox/lib/mapbox.marker.d.ts +49 -0
  36. package/mapbox/lib/mapbox.markers.component.d.ts +21 -0
  37. package/mapbox/lib/mapbox.module.d.ts +11 -10
  38. package/mapbox/lib/mapbox.rxjs.d.ts +44 -0
  39. package/mapbox/lib/mapbox.store.d.ts +12 -1
  40. package/mapbox/lib/mapbox.util.d.ts +27 -0
  41. package/mapbox/package.json +5 -4
  42. package/package.json +3 -3
@@ -0,0 +1,49 @@
1
+ import { ClickableAnchor } from '@dereekb/dbx-core';
2
+ import { Pixels, FactoryWithRequiredInput, LatLngInputRef } from '@dereekb/util';
3
+ /**
4
+ * DbxMapboxMarkerSize. Numbers are converted to pixels.
5
+ */
6
+ export declare type DbxMapboxMarkerSize = 'small' | 'medium' | 'large' | 'tall' | Pixels;
7
+ export declare type DbxMapboxMarker = LatLngInputRef & {
8
+ /**
9
+ * icon
10
+ */
11
+ icon?: string;
12
+ /**
13
+ * label
14
+ */
15
+ label?: string;
16
+ /**
17
+ * Image URL
18
+ */
19
+ image?: string | FactoryWithRequiredInput<string, Pixels>;
20
+ /**
21
+ * Size of the marker.
22
+ */
23
+ size?: DbxMapboxMarkerSize;
24
+ /**
25
+ *
26
+ */
27
+ anchor?: ClickableAnchor;
28
+ /**
29
+ * Additional object styling
30
+ */
31
+ style?: object;
32
+ };
33
+ /**
34
+ * MapFunction that converts the input data to a DbxMapboxMarker.
35
+ */
36
+ export declare type DbxMapboxMarkerFactory<T> = (value: T, index: number) => DbxMapboxMarker;
37
+ /**
38
+ * Creates the styling for rendering a dot.
39
+ *
40
+ * @param background
41
+ * @param color
42
+ * @returns
43
+ */
44
+ export declare function dbxMapboxColoredDotStyle(background: string, color?: string): {
45
+ background: string;
46
+ padding: string;
47
+ color: string;
48
+ 'border-radius': string;
49
+ };
@@ -0,0 +1,21 @@
1
+ import { Maybe } from '@dereekb/util';
2
+ import { ChangeDetectorRef, OnDestroy } from '@angular/core';
3
+ import { DbxMapboxMarkerFactory } from './mapbox.marker';
4
+ import * as i0 from "@angular/core";
5
+ /**
6
+ * Component used to render a set of DbxMapboxMarker values from the input data and marker factory.
7
+ */
8
+ export declare class DbxMapboxMarkersComponent<T> implements OnDestroy {
9
+ readonly cdRef: ChangeDetectorRef;
10
+ private _data;
11
+ private _markerFactory;
12
+ readonly markers$: import("rxjs").Observable<import("./mapbox.marker").DbxMapboxMarker[]>;
13
+ constructor(cdRef: ChangeDetectorRef);
14
+ get data(): Maybe<T[]>;
15
+ set data(data: Maybe<T[]>);
16
+ get markerFactory(): Maybe<DbxMapboxMarkerFactory<T>>;
17
+ set markerFactory(markerFactory: Maybe<DbxMapboxMarkerFactory<T>>);
18
+ ngOnDestroy(): void;
19
+ static ɵfac: i0.ɵɵFactoryDeclaration<DbxMapboxMarkersComponent<any>, never>;
20
+ static ɵcmp: i0.ɵɵComponentDeclaration<DbxMapboxMarkersComponent<any>, "dbx-mapbox-markers", never, { "data": "data"; "markerFactory": "markerFactory"; }, {}, never, never, false>;
21
+ }
@@ -6,18 +6,19 @@ import * as i2 from "./mapbox.layout.component";
6
6
  import * as i3 from "./mapbox.layout.drawer.component";
7
7
  import * as i4 from "./mapbox.menu.component";
8
8
  import * as i5 from "./mapbox.marker.component";
9
- import * as i6 from "./mapbox.store.provide";
10
- import * as i7 from "@angular/common";
11
- import * as i8 from "@angular/material/sidenav";
12
- import * as i9 from "@dereekb/dbx-core";
13
- import * as i10 from "@angular/material/button";
14
- import * as i11 from "@angular/material/icon";
15
- import * as i12 from "angular-resize-event";
16
- import * as i13 from "@dereekb/dbx-web";
17
- import * as i14 from "ngx-mapbox-gl";
9
+ import * as i6 from "./mapbox.markers.component";
10
+ import * as i7 from "./mapbox.store.provide";
11
+ import * as i8 from "@angular/common";
12
+ import * as i9 from "@angular/material/sidenav";
13
+ import * as i10 from "@dereekb/dbx-core";
14
+ import * as i11 from "@angular/material/button";
15
+ import * as i12 from "@angular/material/icon";
16
+ import * as i13 from "angular-resize-event";
17
+ import * as i14 from "@dereekb/dbx-web";
18
+ import * as i15 from "ngx-mapbox-gl";
18
19
  export declare class DbxMapboxModule {
19
20
  static forRoot(config: DbxMapboxConfig): ModuleWithProviders<DbxMapboxModule>;
20
21
  static ɵfac: i0.ɵɵFactoryDeclaration<DbxMapboxModule, never>;
21
- static ɵmod: i0.ɵɵNgModuleDeclaration<DbxMapboxModule, [typeof i1.DbxMapboxMapDirective, typeof i2.DbxMapboxLayoutComponent, typeof i3.DbxMapboxLayoutDrawerComponent, typeof i4.DbxMapboxMenuComponent, typeof i5.DbxMapboxMarkerComponent, typeof i6.DbxMapboxMapStoreInjectionBlockDirective], [typeof i7.CommonModule, typeof i8.MatSidenavModule, typeof i9.DbxInjectionComponentModule, typeof i10.MatButtonModule, typeof i11.MatIconModule, typeof i12.AngularResizeEventModule, typeof i13.DbxRouterAnchorModule, typeof i14.NgxMapboxGLModule], [typeof i1.DbxMapboxMapDirective, typeof i2.DbxMapboxLayoutComponent, typeof i3.DbxMapboxLayoutDrawerComponent, typeof i4.DbxMapboxMenuComponent, typeof i5.DbxMapboxMarkerComponent, typeof i6.DbxMapboxMapStoreInjectionBlockDirective]>;
22
+ static ɵmod: i0.ɵɵNgModuleDeclaration<DbxMapboxModule, [typeof i1.DbxMapboxMapDirective, typeof i2.DbxMapboxLayoutComponent, typeof i3.DbxMapboxLayoutDrawerComponent, typeof i4.DbxMapboxMenuComponent, typeof i5.DbxMapboxMarkerComponent, typeof i6.DbxMapboxMarkersComponent, typeof i7.DbxMapboxMapStoreInjectionBlockDirective], [typeof i8.CommonModule, typeof i9.MatSidenavModule, typeof i10.DbxInjectionComponentModule, typeof i11.MatButtonModule, typeof i12.MatIconModule, typeof i13.AngularResizeEventModule, typeof i14.DbxRouterAnchorModule, typeof i15.NgxMapboxGLModule], [typeof i1.DbxMapboxMapDirective, typeof i2.DbxMapboxLayoutComponent, typeof i3.DbxMapboxLayoutDrawerComponent, typeof i4.DbxMapboxMenuComponent, typeof i5.DbxMapboxMarkerComponent, typeof i6.DbxMapboxMarkersComponent, typeof i7.DbxMapboxMapStoreInjectionBlockDirective]>;
22
23
  static ɵinj: i0.ɵɵInjectorDeclaration<DbxMapboxModule>;
23
24
  }
@@ -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,15 @@
1
1
  {
2
2
  "name": "@dereekb/dbx-web/mapbox",
3
- "version": "9.6.3",
3
+ "version": "9.7.0",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^14.1.0",
6
6
  "@angular/core": "^14.1.0",
7
7
  "rxjs": "^7.5.0",
8
- "@dereekb/util": "9.6.3",
9
- "@dereekb/dbx-web": "9.6.3",
8
+ "@dereekb/util": "9.7.0",
9
+ "@dereekb/dbx-web": "9.7.0",
10
10
  "ngx-mapbox-gl": "^9.1.0",
11
- "mapbox-gl": "^2.9.2"
11
+ "mapbox-gl": "^2.9.2",
12
+ "@mapbox/geo-viewport": "git+https://git@github.com/dereekb/geo-viewport#165513972f87dca23a20c177f4d173edc51b5e2f"
12
13
  },
13
14
  "dependencies": {
14
15
  "tslib": "^2.3.0"
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@dereekb/dbx-web",
3
- "version": "9.6.3",
3
+ "version": "9.7.0",
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.3",
11
- "@dereekb/dbx-core": "9.6.3",
10
+ "@dereekb/rxjs": "9.7.0",
11
+ "@dereekb/dbx-core": "9.7.0",
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",