basemapkit 0.1.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.
- package/biome.json +52 -0
- package/dist/basemapkit.d.ts +138 -0
- package/dist/basemapkit.js +3340 -0
- package/dist/basemapkit.js.map +1 -0
- package/dist/colorchange.d.ts +8 -0
- package/dist/language.d.ts +2 -0
- package/index.html +31 -0
- package/package.json +32 -0
- package/readme.md +165 -0
- package/tsconfig.json +25 -0
- package/vite.config-lib.ts +36 -0
package/biome.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"assist": {
|
|
3
|
+
"actions": {
|
|
4
|
+
"source": {
|
|
5
|
+
"organizeImports": "off"
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
|
|
10
|
+
"files": {
|
|
11
|
+
"includes": ["src/**/*.ts"]
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
"formatter": {
|
|
15
|
+
"indentStyle": "space",
|
|
16
|
+
"indentWidth": 2,
|
|
17
|
+
"lineWidth": 120
|
|
18
|
+
},
|
|
19
|
+
"javascript": {
|
|
20
|
+
"formatter": {
|
|
21
|
+
"arrowParentheses": "always",
|
|
22
|
+
"bracketSameLine": false,
|
|
23
|
+
"bracketSpacing": true,
|
|
24
|
+
"jsxQuoteStyle": "double",
|
|
25
|
+
"quoteProperties": "asNeeded",
|
|
26
|
+
"semicolons": "always",
|
|
27
|
+
"trailingCommas": "all"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"json": {
|
|
31
|
+
"formatter": {
|
|
32
|
+
"trailingCommas": "none"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"linter": {
|
|
36
|
+
"rules": {
|
|
37
|
+
"suspicious": {
|
|
38
|
+
"noExplicitAny": {
|
|
39
|
+
"level": "off"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"complexity": {
|
|
43
|
+
"noUselessTernary": {
|
|
44
|
+
"level": "off"
|
|
45
|
+
},
|
|
46
|
+
"useOptionalChain": {
|
|
47
|
+
"level": "off"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { StyleSpecification } from 'maplibre-gl';
|
|
2
|
+
/**
|
|
3
|
+
* Options to modify colors of a base style
|
|
4
|
+
*/
|
|
5
|
+
export type ColorEdit = {
|
|
6
|
+
/**
|
|
7
|
+
* Invert the image color
|
|
8
|
+
*/
|
|
9
|
+
negate?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Ratio relative to current brightness.
|
|
12
|
+
* Value in [-1, 1] but the range is actually open
|
|
13
|
+
*/
|
|
14
|
+
brightness?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Absolute brightness shift
|
|
17
|
+
* Value in [-1, 1] but the range is actually open
|
|
18
|
+
*/
|
|
19
|
+
brightnessShift?: number;
|
|
20
|
+
/**
|
|
21
|
+
* Exposure, like brightness but more preserving
|
|
22
|
+
* Value in [-1, 1] but the range is actually open
|
|
23
|
+
*/
|
|
24
|
+
exposure?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Rotate the hue wheel
|
|
27
|
+
* Value in [-180, 180] but the range is actually open
|
|
28
|
+
*/
|
|
29
|
+
hueRotation?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Modifiy color saturation
|
|
32
|
+
* Value in [-1, 1] but the range is actually open
|
|
33
|
+
*/
|
|
34
|
+
saturation?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Multiply every color with the given one.
|
|
37
|
+
*/
|
|
38
|
+
multiplyColor?: [
|
|
39
|
+
/**
|
|
40
|
+
* CSS color
|
|
41
|
+
*/
|
|
42
|
+
string,
|
|
43
|
+
/**
|
|
44
|
+
* Mixing ratio in [0, 1], where 0 is fully the original color and 1 is fully the provided one.
|
|
45
|
+
*/
|
|
46
|
+
number
|
|
47
|
+
];
|
|
48
|
+
/**
|
|
49
|
+
* Mix every color with the given one.
|
|
50
|
+
*/
|
|
51
|
+
mixColor?: [
|
|
52
|
+
/**
|
|
53
|
+
* CSS color
|
|
54
|
+
*/
|
|
55
|
+
string,
|
|
56
|
+
/**
|
|
57
|
+
* Mixing ratio in [0, 1], where 0 is fully the original color and 1 is fully the one provided.
|
|
58
|
+
*/
|
|
59
|
+
number
|
|
60
|
+
];
|
|
61
|
+
/**
|
|
62
|
+
* Apply contrast, providing a contrast intensity and a mid (inflection) point
|
|
63
|
+
*/
|
|
64
|
+
contrast?: [
|
|
65
|
+
/**
|
|
66
|
+
* Contrast intensity. Value in [-1, 1] but is actually an open range
|
|
67
|
+
*/
|
|
68
|
+
number,
|
|
69
|
+
/**
|
|
70
|
+
* Color intensity mid point in the range [0, 255]
|
|
71
|
+
*/
|
|
72
|
+
number
|
|
73
|
+
];
|
|
74
|
+
};
|
|
75
|
+
export type Lang = "ar" | "cs" | "bg" | "da" | "de" | "el" | "en" | "es" | "et" | "fa" | "fi" | "fr" | "ga" | "he" | "hi" | "hr" | "hu" | "id" | "it" | "ja" | "ko" | "lt" | "lv" | "ne" | "nl" | "no" | "mr" | "mt" | "pl" | "pt" | "ro" | "ru" | "sk" | "sl" | "sv" | "tr" | "uk" | "ur" | "vi" | "zh-Hans" | "zh-Hant";
|
|
76
|
+
export type GetStyleOptions = {
|
|
77
|
+
/**
|
|
78
|
+
* The public URL of a pmtiles files. To use if sourcing tiles directly with
|
|
79
|
+
* range-request using the `pmtiles`'s protocol. Alternatively, the option `tileJson` can be used and will take precedence.
|
|
80
|
+
*/
|
|
81
|
+
pmtiles?: string;
|
|
82
|
+
/**
|
|
83
|
+
* The public URL to a tile JSON file. To use if classic z/x/y MVT tiles are served through
|
|
84
|
+
* Maplibre's Martin or the pmtiles CLI. Will take precedence on the option `pmtiles` if both are provided.
|
|
85
|
+
*/
|
|
86
|
+
tilejson?: string;
|
|
87
|
+
/**
|
|
88
|
+
* URL of the sprites
|
|
89
|
+
*/
|
|
90
|
+
sprite?: string;
|
|
91
|
+
/**
|
|
92
|
+
* URL of the glyphs
|
|
93
|
+
*/
|
|
94
|
+
glyphs: string;
|
|
95
|
+
/**
|
|
96
|
+
* Language to apply to the basemap. Leaving this undefined will set to auto mode and use the platform language of the end user.
|
|
97
|
+
*/
|
|
98
|
+
lang?: Lang;
|
|
99
|
+
/**
|
|
100
|
+
* Language script to apply to the basemap
|
|
101
|
+
*/
|
|
102
|
+
script?: string;
|
|
103
|
+
/**
|
|
104
|
+
* Points Of Interests are shown by default, requiring a sprite URL. Passing this option as `true` will remove the POIs layer
|
|
105
|
+
* and make the `sprite` option unnecessary.
|
|
106
|
+
*/
|
|
107
|
+
hidePOIs?: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Labels are shown by default, requiring a glyphs URL. Passing this options as `true` will remove the label layers and make the
|
|
110
|
+
* `glyphs` option unnecessary.
|
|
111
|
+
*/
|
|
112
|
+
hideLabels?: boolean;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Options relative to building a style
|
|
116
|
+
*/
|
|
117
|
+
export type BuildStyleOptions = GetStyleOptions & {
|
|
118
|
+
/**
|
|
119
|
+
* Name of the style to start from
|
|
120
|
+
*/
|
|
121
|
+
baseStyleName: string;
|
|
122
|
+
/**
|
|
123
|
+
* Optional color modification to apply to the provided style
|
|
124
|
+
*/
|
|
125
|
+
colorEdit?: ColorEdit;
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* Returns the list of styles available.
|
|
129
|
+
*/
|
|
130
|
+
export declare function getStyleList(): string[];
|
|
131
|
+
/**
|
|
132
|
+
* Get a style.
|
|
133
|
+
*/
|
|
134
|
+
export declare function getStyle(styleName: string, options: GetStyleOptions): StyleSpecification;
|
|
135
|
+
/**
|
|
136
|
+
* Build your own style, using one of the base style as starting point.
|
|
137
|
+
*/
|
|
138
|
+
export declare function buildStyle(options: BuildStyleOptions): StyleSpecification;
|