@mappable-world/mappable-types 0.0.15 → 0.0.17

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.
@@ -41,10 +41,17 @@ interface RenderedHotspot {
41
41
  readonly geometry: GenericGeometry<PixelCoordinates>;
42
42
  }
43
43
  type Hotspot = WorldHotspot | RenderedHotspot;
44
- interface FetchedTile {
44
+ interface FetchedCommonTile {
45
+ destroy?(): void;
46
+ }
47
+ interface FetchedRasterTile extends FetchedCommonTile {
45
48
  image: HTMLImageElement | HTMLCanvasElement | ImageBitmap;
46
49
  }
47
- type FetchTileFunction = (x: number, y: number, z: number, scale: number, signal: AbortSignal) => Promise<FetchedTile>;
50
+ /**
51
+ * @deprecated Use FetchedRasterTile instead
52
+ */
53
+ type FetchedTile = FetchedRasterTile;
54
+ type FetchTileFunction = (x: number, y: number, z: number, scale: number, signal: AbortSignal) => Promise<FetchedCommonTile | FetchedRasterTile>;
48
55
  type ComposeTileUrlFunction = (x: number, y: number, z: number, scale: number, signal: AbortSignal) => string;
49
56
  /**
50
57
  * Provides hotspots for given tile coordinates and zoom.
@@ -127,6 +134,7 @@ interface VectorTileDataSourceDescription {
127
134
  tileCacheSize?: number;
128
135
  richModelCacheSize?: number;
129
136
  richModelEnabled?: boolean;
137
+ richPointEnabled?: boolean;
130
138
  allObjectsInteractive?: boolean;
131
139
  /** Forces tiles to wait for the icons, disables hiding icons by zoom diff */
132
140
  iconsOnlyTiles?: boolean;
@@ -136,4 +144,4 @@ interface VectorTileDataSourceDescription {
136
144
  /** Defines how hotspots of type should be treated: enabled/disabled or use custom hotspots instead. */
137
145
  hotspots?: Record<string, boolean | FetchHotspotsFunction | HotspotsOptions>;
138
146
  }
139
- export { VectorCustomizationTypes, VectorCustomizationElements, VectorCustomizationItem, VectorCustomization, RasterTileDataSourceDescription, FetchHotspotsFunction, VectorTileDataSourceDescription, VectorTileSize, VectorObjectsCollisionPriority, VectorDataSourcePriority, HotspotsOptions, FetchTileFunction, ComposeTileUrlFunction, Hotspot, WorldHotspot, RenderedHotspot, FetchedTile, MapTheme };
147
+ export { VectorCustomizationTypes, VectorCustomizationElements, VectorCustomizationItem, VectorCustomization, RasterTileDataSourceDescription, FetchHotspotsFunction, VectorTileDataSourceDescription, VectorTileSize, VectorObjectsCollisionPriority, VectorDataSourcePriority, HotspotsOptions, FetchTileFunction, ComposeTileUrlFunction, Hotspot, WorldHotspot, RenderedHotspot, FetchedRasterTile, FetchedTile, FetchedCommonTile, MapTheme };
@@ -20,3 +20,4 @@ export * from "./utils";
20
20
  export * from "./world-options";
21
21
  export * from "./data-source-description";
22
22
  export * from "./matrix";
23
+ export * from "./tilt-range";
@@ -0,0 +1,8 @@
1
+ export interface TiltRange {
2
+ /** Minimum tilt in radians. */
3
+ readonly min: number;
4
+ /** Maximum tilt in radians. */
5
+ readonly max: number;
6
+ /** Behavior tilt expansion in radians. E.g. you can tilt map with fingers a little bit more than `max`. */
7
+ readonly expansion: number;
8
+ }
@@ -91,6 +91,18 @@ declare abstract class GenericEntity<Props, DefaultProps extends {} = {}, Root e
91
91
  * @returns Context value.
92
92
  */
93
93
  protected _consumeContext<T>(consumer: Context<T>): T | undefined;
94
+ /**
95
+ * Subscribes to changes in a context
96
+ * @param context - The context that provides access to the context value.
97
+ * @param watcher - Callback function that is called when the context value is changed.
98
+ * @param params - Params for watcher.
99
+ * @param params.immediate - Calls watcher immediately. For most handlers it allows to inline watcher function.
100
+ * @returns Function to unsubscribe from changes context.
101
+ * For most handlers it can be, because it is called automatically on detach.
102
+ */
103
+ protected _watchContext<T>(context: Context<T>, watcher: ContextWatcherFn, params?: {
104
+ immediate: boolean;
105
+ }): () => void;
94
106
  }
95
107
  interface ComplexOptions<Root extends GenericRootEntity<unknown> = GenericRootEntity<unknown>> {
96
108
  children?: GenericEntity<unknown, {}, Root>[];
@@ -1,4 +1,4 @@
1
- import type { BehaviorType, LngLat, MapMode, Margin, PixelCoordinates, Projection, ReadonlyLngLat, LngLatBounds, ZoomRange, ZoomRounding, WorldOptions, ZoomStrategy, EasingFunctionDescription } from "../../common/types";
1
+ import type { BehaviorType, LngLat, MapMode, Margin, PixelCoordinates, Projection, ReadonlyLngLat, LngLatBounds, ZoomRange, ZoomRounding, WorldOptions, ZoomStrategy, EasingFunctionDescription, TiltRange } from "../../common/types";
2
2
  import type { MMapEntity } from "../MMapEnities";
3
3
  import { GenericRootEntity } from "../Entities";
4
4
  import { MMapCopyrightsPosition } from "../MMapCopyrights";
@@ -233,6 +233,7 @@ declare class MMap extends GenericRootEntity<MMapProps, DefaultProps> {
233
233
  * getter for {@link MMapProps}.zoomRange prop
234
234
  */
235
235
  get zoomRange(): Readonly<ZoomRange>;
236
+ get tiltRange(): Readonly<TiltRange>;
236
237
  /**
237
238
  * getter for {@link MMapProps}.projection prop
238
239
  */
@@ -1,11 +1,22 @@
1
+ import { Context } from "../Entities";
1
2
  import { MMapEntity, MMapGroupEntity } from "../MMapEnities";
2
- type VerlicalPosition = "top" | "bottom";
3
+ type VerticalPosition = "top" | "bottom";
4
+ type ComputedVerticalPosition = "top" | "center" | "bottom";
3
5
  type HorizontalPosition = "left" | "right";
6
+ type ComputedHorizontalPosition = "left" | "center" | "right";
4
7
  type Orientation = "horizontal" | "vertical";
8
+ export type MMapControlContext = {
9
+ position: [
10
+ ComputedVerticalPosition,
11
+ ComputedHorizontalPosition,
12
+ Orientation
13
+ ];
14
+ };
15
+ export declare const ControlContext: Context<MMapControlContext>;
5
16
  /**
6
17
  * Describes controls position.
7
18
  */
8
- type Position = VerlicalPosition | HorizontalPosition | `${VerlicalPosition} ${HorizontalPosition}` | `${HorizontalPosition} ${VerlicalPosition}`;
19
+ type Position = VerticalPosition | HorizontalPosition | `${VerticalPosition} ${HorizontalPosition}` | `${HorizontalPosition} ${VerticalPosition}`;
9
20
  /**
10
21
  * MMapControls props
11
22
  */
@@ -52,6 +52,7 @@ declare class MMapFeature extends MMapEntity<MMapFeatureProps, DefaultProps> {
52
52
  private _id;
53
53
  private _source;
54
54
  private _defaultPropsId?;
55
+ get id(): string;
55
56
  constructor(props: MMapFeatureProps);
56
57
  get properties(): Record<string, unknown> | undefined;
57
58
  get geometry(): GenericGeometry<LngLat>;
@@ -13,7 +13,7 @@ export * from "./MMapHotspot";
13
13
  export * from "./wrappers";
14
14
  export { MMapMarker, MMapMarkerProps, MMapMarkerEventHandler } from "./MMapMarker";
15
15
  export { MMapTileDataSource, MMapTileDataSourceProps } from "./MMapTileDataSource";
16
- export { MMapControls, MMapControlsProps } from "./MMapControls";
16
+ export * from "./MMapControls";
17
17
  export { MMapControl, MMapControlProps, MMapControlButton, MMapControlButtonProps, MMapControlCommonButton } from "./MMapControl";
18
18
  export { MMapCollection } from "./MMapCollection";
19
19
  export { MMapContainer, MMapContainerProps, MMapContainerPropsImpl, ComputedMMapContainerProps } from "./MMapContainer";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mappable-world/mappable-types",
3
- "version": "0.0.15",
3
+ "version": "0.0.17",
4
4
  "description": "Types for mappable maps library",
5
5
  "main": "",
6
6
  "types": "index.d.ts",
@@ -58,16 +58,16 @@ declare class MMapClusterer extends mappable.MMapComplexEntity<MMapClustererProp
58
58
  static [mappable.overrideKeyReactify]: import("../../../reactify/reactify").CustomReactify<MMapClusterer, import("react").ForwardRefExoticComponent<{
59
59
  features: Feature[];
60
60
  maxZoom?: number | undefined;
61
- method: IClusterMethod;
62
61
  tickTimeout?: number | undefined;
62
+ method: IClusterMethod;
63
63
  onRender?: ((clusters: ClustererObject[]) => false | void) | undefined;
64
64
  marker: (feature: Feature) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
65
65
  cluster: (coordinates: LngLat, features: Feature[]) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
66
66
  ref?: import("react").Ref<MMapEntity<{
67
67
  features: Feature[];
68
68
  maxZoom?: number | undefined;
69
- method: IClusterMethod;
70
69
  tickTimeout?: number | undefined;
70
+ method: IClusterMethod;
71
71
  onRender?: ((clusters: ClustererObject[]) => false | void) | undefined;
72
72
  marker: (feature: Feature) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
73
73
  cluster: (coordinates: LngLat, features: Feature[]) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
@@ -86,7 +86,8 @@ declare class MMapClusterer extends mappable.MMapComplexEntity<MMapClustererProp
86
86
  private _mapListener;
87
87
  constructor(props: MMapClustererProps);
88
88
  /**
89
- * Compare feature coordinates with bounds
89
+ * Compare feature coordinates with bounds.
90
+ * Visible in x2 bounds.
90
91
  *
91
92
  * @param feature
92
93
  * @param bounds
@@ -1,7 +1,4 @@
1
1
  import type { EasingFunctionDescription } from "../../../common/types";
2
- import type { MMapControlCommonButton } from "../../../imperative/MMapControl";
3
- import type { MMapListener } from "../../../imperative/MMapListener";
4
- import type { DomDetach } from "../../../imperative";
5
2
  import type { CustomVuefyOptions } from "../../../modules/vuefy";
6
3
  /**
7
4
  * MMapZoomControl props
@@ -28,24 +25,15 @@ type DefaultProps = typeof defaultProps;
28
25
  * map.addChild(controls);
29
26
  * ```
30
27
  */
31
- declare class MMapZoomControl extends mappable.MMapGroupEntity<MMapZoomControlProps> {
28
+ declare class MMapZoomControl extends mappable.MMapComplexEntity<MMapZoomControlProps> {
29
+ static [mappable.optionsKeyVuefy]: CustomVuefyOptions<MMapZoomControl>;
32
30
  static defaultProps: Readonly<{
33
31
  duration: 200;
34
32
  }>;
35
- static [mappable.optionsKeyVuefy]: CustomVuefyOptions<MMapZoomControl>;
36
- protected _zoomIn: MMapControlCommonButton;
37
- protected _zoomOut: MMapControlCommonButton;
38
- protected _listener: MMapListener;
39
- private _currentZoom;
40
- protected _detachDom?: DomDetach;
41
- protected _element?: HTMLElement;
42
- private _unwatchThemeContext?;
43
- constructor(props: MMapZoomControlProps);
44
- private _onMapUpdate;
45
- private _changeZoom;
33
+ private _control;
34
+ private _zoom;
46
35
  protected _onAttach(): void;
36
+ protected _onUpdate(props: MMapZoomControlProps): void;
47
37
  protected _onDetach(): void;
48
- protected _onUpdate(): void;
49
- private _updateTheme;
50
38
  }
51
39
  export { MMapZoomControl, MMapZoomControlProps };