@mapcreator/sdk 1.1.0 → 1.2.1
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.
- package/dist/MCMap.d.ts +1 -1
- package/dist/Video.d.ts +2 -1
- package/dist/adornments/connectedLegend.d.ts +4 -1
- package/dist/adornments/heading.d.ts +4 -1
- package/dist/adornments/insetMap.d.ts +5 -2
- package/dist/adornments/manualLegend.d.ts +4 -1
- package/dist/constants/index.d.ts +11 -2
- package/dist/controls/geolocationControls.d.ts +2 -1
- package/dist/controls/webControls.d.ts +2 -1
- package/dist/mapcreator-sdk.css +1 -1
- package/dist/mapcreator-sdk.js +4598 -4362
- package/dist/mapcreator-sdk.umd.cjs +112 -105
- package/dist/models/marker.d.ts +1 -1
- package/dist/polyfills.d.ts +1 -0
- package/dist/renderAdornments.d.ts +2 -1
- package/dist/report.html +1 -1
- package/dist/types/index.d.ts +7 -0
- package/dist/types/jobObject.d.ts +8 -4
- package/dist/utils/fonts.d.ts +4 -0
- package/dist/utils/geolocation.d.ts +3 -2
- package/dist/utils/helpers.d.ts +2 -0
- package/dist/utils/mapstyle.d.ts +2 -0
- package/dist/utils/svgHelpers.d.ts +8 -3
- package/package.json +2 -2
package/dist/types/index.d.ts
CHANGED
|
@@ -23,5 +23,12 @@ export type JobObjectAugmented = JobObject & {
|
|
|
23
23
|
export type LayerInfo = {
|
|
24
24
|
[layerId: string]: {
|
|
25
25
|
visibility: boolean;
|
|
26
|
+
opacity?: number;
|
|
26
27
|
};
|
|
27
28
|
};
|
|
29
|
+
export type Font = {
|
|
30
|
+
name: string;
|
|
31
|
+
family: string;
|
|
32
|
+
weight: string;
|
|
33
|
+
style: string;
|
|
34
|
+
};
|
|
@@ -31,6 +31,7 @@ export type JobObject = {
|
|
|
31
31
|
layerInfo?: Optional<Array<{
|
|
32
32
|
id: string;
|
|
33
33
|
visibility: boolean;
|
|
34
|
+
opacity?: Optional<number>;
|
|
34
35
|
}>>;
|
|
35
36
|
overlays?: Optional<number[]>;
|
|
36
37
|
projection?: Optional<'mercator' | 'globe'>;
|
|
@@ -69,6 +70,7 @@ export type JobObjectModels = {
|
|
|
69
70
|
marker?: Optional<JobObjectMarkerGroup[]>;
|
|
70
71
|
polygon?: Optional<JobObjectPolygonGroup[]>;
|
|
71
72
|
};
|
|
73
|
+
export type JobObjectJustify = 'left' | 'center' | 'right';
|
|
72
74
|
export type PopupPosition = 'bottomLeft' | 'mapElement';
|
|
73
75
|
type Optional<T> = T | undefined;
|
|
74
76
|
type JobObjectGroupType = JobObjectArea | JobObjectCircle | JobObjectDot | JobObjectLine | JobObjectMarker | JobObjectPolygon;
|
|
@@ -99,6 +101,7 @@ export type JobObjectMarkerGroup = JobObjectGroupBase<JobObjectMarker> & {
|
|
|
99
101
|
textColor?: Optional<string>;
|
|
100
102
|
textHaloColor?: Optional<string>;
|
|
101
103
|
collisionDetection?: Optional<boolean>;
|
|
104
|
+
labelCollisionDetection?: Optional<boolean>;
|
|
102
105
|
clustering?: Optional<boolean>;
|
|
103
106
|
clusterMaxZoom?: Optional<number>;
|
|
104
107
|
clusterRadius?: Optional<number>;
|
|
@@ -139,6 +142,7 @@ export type JobObjectNorthArrow = {
|
|
|
139
142
|
position: AdornmentPosition;
|
|
140
143
|
stacking?: Optional<Orientation>;
|
|
141
144
|
scale?: Optional<number>;
|
|
145
|
+
svgString?: Optional<string>;
|
|
142
146
|
};
|
|
143
147
|
export type JobObjectScalebar = {
|
|
144
148
|
type: 'scalebar';
|
|
@@ -151,6 +155,7 @@ export type JobObjectScalebar = {
|
|
|
151
155
|
fontSize?: Optional<number>;
|
|
152
156
|
maxWidth?: Optional<number>;
|
|
153
157
|
unit?: Optional<ScalebarUnit>;
|
|
158
|
+
svgString?: Optional<string>;
|
|
154
159
|
};
|
|
155
160
|
export type JobObjectWebControls = {
|
|
156
161
|
type: 'webControls';
|
|
@@ -193,12 +198,12 @@ export type JobObjectHeading = {
|
|
|
193
198
|
titleColor?: Optional<string>;
|
|
194
199
|
titleFont?: Optional<string>;
|
|
195
200
|
titleFontSize?: Optional<number>;
|
|
196
|
-
titleJustify?: Optional<
|
|
201
|
+
titleJustify?: Optional<JobObjectJustify>;
|
|
197
202
|
subtitle: string;
|
|
198
203
|
subtitleColor?: Optional<string>;
|
|
199
204
|
subtitleFont?: Optional<string>;
|
|
200
205
|
subtitleFontSize?: Optional<number>;
|
|
201
|
-
subtitleJustify?: Optional<
|
|
206
|
+
subtitleJustify?: Optional<JobObjectJustify>;
|
|
202
207
|
background?: Optional<string>;
|
|
203
208
|
showBackground?: Optional<boolean>;
|
|
204
209
|
};
|
|
@@ -260,7 +265,6 @@ export type JobObjectLine = {
|
|
|
260
265
|
lineColor?: Optional<string>;
|
|
261
266
|
lineStyle?: Optional<'solid' | 'dashed' | 'dotted'>;
|
|
262
267
|
lineType?: Optional<'line' | 'route'>;
|
|
263
|
-
lineDashArray?: Optional<number[]>;
|
|
264
268
|
transportType?: Optional<'car' | 'bicycle' | 'pedestrian'>;
|
|
265
269
|
smoothness?: Optional<number>;
|
|
266
270
|
svg?: Optional<string>;
|
|
@@ -350,7 +354,7 @@ export type JobObjectMarker = {
|
|
|
350
354
|
textAnchor?: Optional<Anchor>;
|
|
351
355
|
textLineHeight?: Optional<number>;
|
|
352
356
|
textLetterSpacing?: Optional<number>;
|
|
353
|
-
textJustify?: Optional<
|
|
357
|
+
textJustify?: Optional<JobObjectJustify>;
|
|
354
358
|
textRotation?: Optional<number>;
|
|
355
359
|
textOffset?: Optional<[number, number]>;
|
|
356
360
|
textColor?: Optional<string>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Env, Font } from '../types';
|
|
2
|
+
export declare function loadFont(name: string, vapiUrl: string, accessToken: string): Promise<string | undefined>;
|
|
3
|
+
export declare function loadFontFaces(env: Env, vapiUrl: string, accessToken: string): Promise<Map<string, Font>>;
|
|
4
|
+
export declare function fontKey(family: string, weight: string, style: string): string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Map } from '@mapcreator/maplibre-gl';
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
2
|
+
import { SvgCache } from './svgHelpers';
|
|
3
|
+
export declare const loadLocationDot: (map: Map, svgCache: SvgCache) => void;
|
|
4
|
+
export declare const initLayersAndSources: (map: Map, svgCache: SvgCache) => void;
|
|
4
5
|
export declare const addLocationDot: (map: any, lng: number, lat: number) => void;
|
|
5
6
|
export declare const createCircle: (lng: number, lat: number, meters: number) => any;
|
|
6
7
|
export declare const showNotification: () => void;
|
package/dist/utils/helpers.d.ts
CHANGED
|
@@ -21,10 +21,12 @@ export declare function unitConvert(from: Unit, to: Unit, value: number): number
|
|
|
21
21
|
export declare function lerp(value1: number, value2: number, ratio: number): number;
|
|
22
22
|
export declare function unlerp(min: number, max: number, value: number): number;
|
|
23
23
|
export declare function clamp(value: number, min: number, max: number): number;
|
|
24
|
+
export declare function stripQuotes(s: string): string;
|
|
24
25
|
/**
|
|
25
26
|
* Fast hash function for non-cryptographic use
|
|
26
27
|
*/
|
|
27
28
|
export declare function fnv32b(str: string): string;
|
|
28
29
|
export declare function calculateScaleCorrection(jobObject: JobObject, container: HTMLElement): number;
|
|
29
30
|
export declare function almostEqual(a: number, b: number, delta?: number): boolean;
|
|
31
|
+
export declare function isInIframe(): boolean;
|
|
30
32
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { JobObjectDataBindings } from '../types/jobObject';
|
|
2
2
|
import { Map as MapLibre } from '@mapcreator/maplibre-gl';
|
|
3
3
|
import { ColorGenerator } from './choropleth';
|
|
4
|
+
import { Font } from '../types';
|
|
4
5
|
export declare function escapeXML(str: string): string;
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function createImage(svgString: string, width: number, height: number): Promise<HTMLImageElement>;
|
|
6
|
+
export declare function createImage(svgString: string, width: number, height: number, fontMap: Map<string, Font>, vapiUrl: string, accessToken: string): Promise<HTMLImageElement>;
|
|
7
7
|
export interface SvgColor {
|
|
8
8
|
name: string;
|
|
9
9
|
color: Color | string | undefined;
|
|
@@ -13,6 +13,8 @@ export interface SvgText {
|
|
|
13
13
|
text: string | undefined;
|
|
14
14
|
isMultiline: boolean;
|
|
15
15
|
}
|
|
16
|
+
export declare function collectUsedFonts(svg: string, fontMap: Map<string, Font>): Font[];
|
|
17
|
+
export declare function injectFonts(svg: string, fonts: Font[], fontBuffers: Array<string | undefined>): string;
|
|
16
18
|
export declare class SvgHelper {
|
|
17
19
|
private _seen;
|
|
18
20
|
private _svg;
|
|
@@ -62,7 +64,10 @@ export declare class SvgHelper {
|
|
|
62
64
|
export declare class SvgCache {
|
|
63
65
|
private map;
|
|
64
66
|
private keyCache;
|
|
65
|
-
|
|
67
|
+
fontMap: Map<string, Font>;
|
|
68
|
+
vapiUrl: string;
|
|
69
|
+
accessToken: string;
|
|
70
|
+
constructor(map: MapLibre, fontMap: Map<string, Font>, vapiUrl: string, accessToken: string);
|
|
66
71
|
getMapLibreImageKey(svg: string, pixelRatio: number): string;
|
|
67
72
|
}
|
|
68
73
|
export declare function measureTextBlock(lines: string[], fontFamily: string, fontSize: number): {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mapcreator/sdk",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": "^24.0.0",
|
|
6
6
|
"npm": "^11.0.0"
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"vite-plugin-dts": "^4.5.4"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@mapcreator/maplibre-gl": "5.7.0-mc.
|
|
54
|
+
"@mapcreator/maplibre-gl": "5.7.0-mc.6",
|
|
55
55
|
"@turf/area": "^7.3.4",
|
|
56
56
|
"@turf/bbox-clip": "^7.3.4",
|
|
57
57
|
"@turf/intersect": "^7.3.4",
|