@mapcreator/sdk 0.0.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/HighlightManager.d.ts +23 -0
- package/dist/PopupManager.d.ts +44 -0
- package/dist/Registry.d.ts +23 -0
- package/dist/adornments/categoricalLegend.d.ts +2 -0
- package/dist/adornments/connectedLegend.d.ts +3 -0
- package/dist/adornments/customAdornment.d.ts +2 -0
- package/dist/adornments/heading.d.ts +2 -0
- package/dist/adornments/insetMap.d.ts +3 -0
- package/dist/adornments/manualLegend.d.ts +2 -0
- package/dist/adornments/northArrow.d.ts +3 -0
- package/dist/adornments/scalebar.d.ts +3 -0
- package/dist/constants/index.d.ts +11 -0
- package/dist/controls/controls.d.ts +7 -0
- package/dist/controls/fullscreenControls.d.ts +2 -0
- package/dist/controls/geocoderControl.d.ts +33 -0
- package/dist/controls/geolocationControls.d.ts +2 -0
- package/dist/controls/refreshMapControls.d.ts +3 -0
- package/dist/controls/webControls.d.ts +4 -0
- package/dist/controls/zoomControls.d.ts +3 -0
- package/dist/i18n.d.ts +56 -0
- package/dist/index.d.ts +16 -0
- package/dist/locales/da_DK/strings.json.d.ts +10 -0
- package/dist/locales/de_DE/strings.json.d.ts +10 -0
- package/dist/locales/en_GB/strings.json.d.ts +10 -0
- package/dist/locales/es_ES/strings.json.d.ts +10 -0
- package/dist/locales/fr_FR/strings.json.d.ts +10 -0
- package/dist/locales/it_IT/strings.json.d.ts +10 -0
- package/dist/locales/nl_NL/strings.json.d.ts +10 -0
- package/dist/mapcreator-sdk.css +2 -0
- package/dist/mapcreator-sdk.js +39590 -0
- package/dist/mapcreator-sdk.umd.cjs +1140 -0
- package/dist/models/area.d.ts +5 -0
- package/dist/models/circle.d.ts +5 -0
- package/dist/models/dot.d.ts +3 -0
- package/dist/models/line.d.ts +4 -0
- package/dist/models/marker.d.ts +5 -0
- package/dist/models/polygon.d.ts +5 -0
- package/dist/renderAdornments.d.ts +4 -0
- package/dist/types/geometry.d.ts +6 -0
- package/dist/types/index.d.ts +19 -0
- package/dist/types/jobObject.d.ts +514 -0
- package/dist/types/mapstyle.d.ts +62 -0
- package/dist/utils/browser.d.ts +2 -0
- package/dist/utils/choropleth.d.ts +12 -0
- package/dist/utils/fullscreen.d.ts +4 -0
- package/dist/utils/geolocation.d.ts +6 -0
- package/dist/utils/graphhopper.d.ts +6 -0
- package/dist/utils/helpers.d.ts +28 -0
- package/dist/utils/language.d.ts +19 -0
- package/dist/utils/models.d.ts +16 -0
- package/dist/utils/overlays.d.ts +4 -0
- package/dist/utils/scalebar.d.ts +2 -0
- package/dist/utils/svgHelpers.d.ts +90 -0
- package/dist/utils/template.d.ts +5 -0
- package/dist/utils/youtube.d.ts +4 -0
- package/package.json +63 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { JobObjectDataBindings, JobObjectStoredValue } from '../types/jobObject';
|
|
2
|
+
import { LngLat } from '../types/geometry';
|
|
3
|
+
export declare const numberRe: RegExp;
|
|
4
|
+
export declare function degToRad(angle: number): number;
|
|
5
|
+
export declare function radToDeg(angle: number): number;
|
|
6
|
+
export declare function calcDistance(lngLat1: LngLat, lngLat2: LngLat): number;
|
|
7
|
+
export declare function stringToId(str: string): number;
|
|
8
|
+
/**
|
|
9
|
+
* Resolves a potential binding reference.
|
|
10
|
+
*
|
|
11
|
+
* 1. If the string starts with a $, it is considered a binding reference. The value of the binding
|
|
12
|
+
* is then returned.
|
|
13
|
+
* 2. Otherwise, the string is returned as is.
|
|
14
|
+
*/
|
|
15
|
+
export declare function resolveBinding(str: string, bindings: JobObjectDataBindings): string;
|
|
16
|
+
export declare function bindingToString(binding: JobObjectStoredValue | undefined): string;
|
|
17
|
+
export declare function bindingToPrimitive(binding: JobObjectStoredValue | undefined): string | number | boolean | null;
|
|
18
|
+
export declare function getYoutubeVideoId(url: string): string | undefined;
|
|
19
|
+
type Unit = 'millimeter' | 'centimeter' | 'inch' | 'pixel' | 'pica' | 'kilometer' | 'mile' | 'nauticalMile' | 'foot' | 'meter';
|
|
20
|
+
export declare function unitConvert(from: Unit, to: Unit, value: number): number;
|
|
21
|
+
export declare function lerp(value1: number, value2: number, ratio: number): number;
|
|
22
|
+
export declare function unlerp(min: number, max: number, value: number): number;
|
|
23
|
+
export declare function clamp(value: number, min: number, max: number): number;
|
|
24
|
+
/**
|
|
25
|
+
* Fast hash function for non-cryptographic use
|
|
26
|
+
*/
|
|
27
|
+
export declare function fnv32b(str: string): string;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Map } from '@mapcreator/maplibre-gl';
|
|
2
|
+
export declare function setLanguage(language: string, map: Map): void;
|
|
3
|
+
export declare const LanguageNotation: Readonly<{
|
|
4
|
+
THREE: "ISO 639-2/B";
|
|
5
|
+
API: "ISO 639-2/B";
|
|
6
|
+
TWO: "ISO 639-1";
|
|
7
|
+
MAPLIBRE_COMPAT: "ISO 639-1";
|
|
8
|
+
ENDONYM: "name";
|
|
9
|
+
NAME: "name";
|
|
10
|
+
LOCALE: "locale";
|
|
11
|
+
i18n: "locale";
|
|
12
|
+
}>;
|
|
13
|
+
export declare const LanguageCodes: readonly {
|
|
14
|
+
"ISO 639-1": string;
|
|
15
|
+
"ISO 639-2/B": string;
|
|
16
|
+
name: string;
|
|
17
|
+
locale: string;
|
|
18
|
+
}[];
|
|
19
|
+
export declare function transformLanguageCode(input: string, type?: (typeof LanguageNotation)[keyof typeof LanguageNotation]): string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LngLat, Position } from '../types/geometry';
|
|
2
|
+
import { JobObjectPolygon } from '../types/jobObject';
|
|
3
|
+
import { ModelBindings } from '../types';
|
|
4
|
+
import { Map } from '@mapcreator/maplibre-gl';
|
|
5
|
+
export declare function calculateCircle(center: LngLat, radius: number): Array<[number, number]>;
|
|
6
|
+
export declare function calculateRadiusLine(center: LngLat, radius: number, bearing: number): Position[];
|
|
7
|
+
export declare function calculatePolygonGeometry(polygon: JobObjectPolygon): Position[][];
|
|
8
|
+
export declare function getAreaLayerId(groupId: string, area: {
|
|
9
|
+
vectorUrl: string;
|
|
10
|
+
sourceLayerId: string;
|
|
11
|
+
}): string;
|
|
12
|
+
export declare function getAreaSourceId(area: {
|
|
13
|
+
vectorUrl: string;
|
|
14
|
+
}): string;
|
|
15
|
+
export declare function getBoundValues(modelBindings: ModelBindings[], dataColumn: string): Array<number | string>;
|
|
16
|
+
export declare function getLineAngle(line: Position[], map: Map): number;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { JobObjectDataBindings } from '../types/jobObject';
|
|
2
|
+
import { Map as MapLibre } from '@mapcreator/maplibre-gl';
|
|
3
|
+
import { ColorGenerator } from './choropleth';
|
|
4
|
+
export declare function escapeXML(str: string): string;
|
|
5
|
+
export declare function loadFonts(fontNames: string[], vapiUrl: string, accessToken: string): Promise<void>;
|
|
6
|
+
export interface SvgColor {
|
|
7
|
+
name: string;
|
|
8
|
+
color: Color | string | undefined;
|
|
9
|
+
}
|
|
10
|
+
export interface SvgText {
|
|
11
|
+
name: string;
|
|
12
|
+
text: string | undefined;
|
|
13
|
+
isMultiline: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare class SvgHelper {
|
|
16
|
+
private _seen;
|
|
17
|
+
private _svg;
|
|
18
|
+
private _element;
|
|
19
|
+
constructor(svg: string);
|
|
20
|
+
private setElement;
|
|
21
|
+
getSvgString(): string;
|
|
22
|
+
getSvgSize(): [number, number];
|
|
23
|
+
getSvgColors(): SvgColor[];
|
|
24
|
+
setSvgColors(values: {
|
|
25
|
+
name: string;
|
|
26
|
+
color: Color;
|
|
27
|
+
}[]): SvgHelper;
|
|
28
|
+
getSvgTexts(): SvgText[];
|
|
29
|
+
setSvgTexts(values: Pick<SvgText, 'name' | 'text'>[]): SvgHelper;
|
|
30
|
+
private nodeChanged;
|
|
31
|
+
private autoResizeId;
|
|
32
|
+
private sameWidth;
|
|
33
|
+
private sameHeight;
|
|
34
|
+
private stack;
|
|
35
|
+
private rectPosition;
|
|
36
|
+
private pathPosition;
|
|
37
|
+
private copyPosition;
|
|
38
|
+
private resetSize;
|
|
39
|
+
private resetAnchor;
|
|
40
|
+
private getBBox;
|
|
41
|
+
/**
|
|
42
|
+
* Convert the points in the path shape into an array of points
|
|
43
|
+
* @param {Object} node of the shape to be used for this object
|
|
44
|
+
* @return {Object} node Array of coordinates
|
|
45
|
+
*/
|
|
46
|
+
private nodeToPoints;
|
|
47
|
+
/**
|
|
48
|
+
* Convert the points in the given array into a path string
|
|
49
|
+
* @param {Object} pnts Node of the shape to be used for this object
|
|
50
|
+
* @return {String} String of the SVG path
|
|
51
|
+
*/
|
|
52
|
+
private pointsToString;
|
|
53
|
+
private getCoordinate;
|
|
54
|
+
private setCoordinate;
|
|
55
|
+
private moveElement;
|
|
56
|
+
/**
|
|
57
|
+
* TODO Needs to be made DRY
|
|
58
|
+
*/
|
|
59
|
+
private wrapText;
|
|
60
|
+
}
|
|
61
|
+
export declare class SvgCache {
|
|
62
|
+
private map;
|
|
63
|
+
private keyCache;
|
|
64
|
+
constructor(map: MapLibre);
|
|
65
|
+
getMapLibreImageKey(svg: string, pixelRatio: number): string;
|
|
66
|
+
}
|
|
67
|
+
export declare function measureTextBlock(lines: string[], fontFamily: string, fontSize: number): {
|
|
68
|
+
width: number;
|
|
69
|
+
height: number;
|
|
70
|
+
ascent: number;
|
|
71
|
+
descent: number;
|
|
72
|
+
};
|
|
73
|
+
export declare function getColorValue(dataBindings: JobObjectDataBindings, modelOrigValue: string | undefined, groupOrigValue: string | undefined, colorGenerator?: ColorGenerator, unmatchedColor?: string): string;
|
|
74
|
+
export declare function getTextValue(dataBindings: JobObjectDataBindings, modelOrigValue: string | undefined, groupOrigValue: string | undefined): string | undefined;
|
|
75
|
+
export declare function getSvgValue(dataBindings: JobObjectDataBindings, modelOrigValue: string | undefined, groupOrigValue: string | undefined): string | undefined;
|
|
76
|
+
type RGB = [number, number, number];
|
|
77
|
+
type RGBA = [number, number, number, number];
|
|
78
|
+
declare class Color {
|
|
79
|
+
private readonly _error;
|
|
80
|
+
private readonly _rgba;
|
|
81
|
+
static fromRGB(rgb: RGB | RGBA): Color;
|
|
82
|
+
constructor(cstr: string);
|
|
83
|
+
get badValue(): boolean;
|
|
84
|
+
get a(): number;
|
|
85
|
+
get hex(): string;
|
|
86
|
+
get rgba(): RGBA;
|
|
87
|
+
sameColor(color: Color): boolean;
|
|
88
|
+
toString(): string;
|
|
89
|
+
}
|
|
90
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Mode } from '../types';
|
|
2
|
+
import { JobObjectDataBindings, PopupMedia } from '../types/jobObject';
|
|
3
|
+
export declare function buildTemplate(template: string | undefined, popupMedia: PopupMedia | undefined, bindings: JobObjectDataBindings, mode: Mode): string;
|
|
4
|
+
export declare const closeButtonHtml: string;
|
|
5
|
+
export declare const cycleButtonsHtml: string;
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mapcreator/sdk",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Mapcreator JavaScript SDK",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/mapcreator-sdk.umd.cjs",
|
|
7
|
+
"module": "./dist/mapcreator-sdk.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/mapcreator-sdk.js",
|
|
12
|
+
"require": "./dist/mapcreator-sdk.umd.cjs",
|
|
13
|
+
"types": "./dist/index.d.ts"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"dev": "vite",
|
|
18
|
+
"build": "tsc && vite build",
|
|
19
|
+
"prettier": "prettier --check src/",
|
|
20
|
+
"prettier:fix": "prettier --write src/",
|
|
21
|
+
"types": "tsc",
|
|
22
|
+
"lint": "eslint src --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --ignore-path .gitignore",
|
|
23
|
+
"lint:fix": "eslint src --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
|
|
24
|
+
},
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://gitlab.com/mapcreator/sdk.git"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist"
|
|
31
|
+
],
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/d3-array": "^3.2.2",
|
|
34
|
+
"@types/d3-format": "^3.0.4",
|
|
35
|
+
"@types/d3-geo": "^3.1.0",
|
|
36
|
+
"@types/d3-interpolate": "^3.0.4",
|
|
37
|
+
"@types/d3-scale": "^4.0.9",
|
|
38
|
+
"@types/topojson-client": "^3.1.5",
|
|
39
|
+
"@vue/eslint-config-prettier": "^10.2.0",
|
|
40
|
+
"@vue/eslint-config-typescript": "^13.0.0",
|
|
41
|
+
"eslint": "^8.57.1",
|
|
42
|
+
"eslint-plugin-import": "^2.32.0",
|
|
43
|
+
"eslint-plugin-vue": "^9.33.0",
|
|
44
|
+
"prettier": "^3.8.1",
|
|
45
|
+
"typescript": "^5.9.3",
|
|
46
|
+
"vite": "^8.0.1",
|
|
47
|
+
"vite-plugin-dts": "^4.5.4"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@mapcreator/maplibre-gl": "5.7.0-mc.5",
|
|
51
|
+
"@turf/area": "^7.3.4",
|
|
52
|
+
"@turf/bbox-clip": "^7.3.4",
|
|
53
|
+
"@turf/intersect": "^7.3.4",
|
|
54
|
+
"@turf/polygon-smooth": "^7.3.4",
|
|
55
|
+
"d3-array": "^3.2.4",
|
|
56
|
+
"d3-format": "^3.1.2",
|
|
57
|
+
"d3-geo": "^3.1.1",
|
|
58
|
+
"d3-interpolate": "^3.0.1",
|
|
59
|
+
"d3-scale": "^4.0.2",
|
|
60
|
+
"path-data-polyfill": "^1.0.10",
|
|
61
|
+
"topojson-client": "^3.1.0"
|
|
62
|
+
}
|
|
63
|
+
}
|