@versatiles/style 4.4.0 → 4.4.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/README.MD +7 -6
- package/dist/guess_style/guess_style.js +6 -3
- package/dist/style_builder/style_builder.js +1 -1
- package/dist/styles/empty.d.ts +11 -0
- package/dist/styles/empty.js +13 -0
- package/dist/styles/index.d.ts +6 -2
- package/dist/styles/index.js +2 -0
- package/package.json +17 -16
package/README.MD
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
[](https://www.npmjs.com/package/@versatiles/style)
|
|
2
2
|
[](https://codecov.io/gh/versatiles-org/versatiles-style)
|
|
3
3
|
[](https://github.com/versatiles-org/versatiles-style/actions/workflows/ci.yml)
|
|
4
|
+
[](https://github.com/versatiles-org/versatiles-style/releases/latest)
|
|
4
5
|
|
|
5
6
|
# VersaTiles Style
|
|
6
7
|
|
|
@@ -46,12 +47,12 @@ Use it in:
|
|
|
46
47
|
colors: { label: '#222' },
|
|
47
48
|
recolor: { gamma: 0.5 }
|
|
48
49
|
});
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
|
|
51
|
+
const map = new maplibregl.Map({
|
|
52
|
+
container: 'map',
|
|
53
|
+
style
|
|
54
|
+
});
|
|
55
|
+
</script>
|
|
55
56
|
```
|
|
56
57
|
|
|
57
58
|
# Create styles in the backend (Node.js)
|
|
@@ -90,9 +90,12 @@ export async function guessStyleFromContainer(container, options) {
|
|
|
90
90
|
}
|
|
91
91
|
let vectorLayers;
|
|
92
92
|
if (typeof metadata === 'string') {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
try {
|
|
94
|
+
const t = JSON.parse(metadata);
|
|
95
|
+
if (('vector_layers' in t) && Array.isArray(t.vector_layers))
|
|
96
|
+
vectorLayers = t.vector_layers;
|
|
97
|
+
}
|
|
98
|
+
catch (e) { }
|
|
96
99
|
}
|
|
97
100
|
const guessStyleOptions = {
|
|
98
101
|
...options,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import StyleBuilder from '../style_builder/style_builder.js';
|
|
2
|
+
import type { StyleRules, StyleRulesOptions } from '../style_builder/types.js';
|
|
3
|
+
export default class Empty extends StyleBuilder<Empty> {
|
|
4
|
+
readonly name: string;
|
|
5
|
+
defaultFonts: {
|
|
6
|
+
regular: string;
|
|
7
|
+
bold: string;
|
|
8
|
+
};
|
|
9
|
+
defaultColors: {};
|
|
10
|
+
protected getStyleRules(options: StyleRulesOptions<Empty>): StyleRules;
|
|
11
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import StyleBuilder from '../style_builder/style_builder.js';
|
|
2
|
+
export default class Empty extends StyleBuilder {
|
|
3
|
+
name = 'Empty';
|
|
4
|
+
defaultFonts = {
|
|
5
|
+
regular: 'noto_sans_regular',
|
|
6
|
+
bold: 'noto_sans_bold',
|
|
7
|
+
};
|
|
8
|
+
defaultColors = {};
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
10
|
+
getStyleRules(options) {
|
|
11
|
+
return {};
|
|
12
|
+
}
|
|
13
|
+
}
|
package/dist/styles/index.d.ts
CHANGED
|
@@ -7,11 +7,13 @@ import Colorful from './colorful.js';
|
|
|
7
7
|
import Eclipse from './eclipse.js';
|
|
8
8
|
import Graybeard from './graybeard.js';
|
|
9
9
|
import Neutrino from './neutrino.js';
|
|
10
|
+
import Empty from './empty.js';
|
|
10
11
|
export type ColorfulOptions = StyleBuilderOptions<Colorful>;
|
|
11
12
|
export type EclipseOptions = StyleBuilderOptions<Eclipse>;
|
|
12
13
|
export type GraybeardOptions = StyleBuilderOptions<Graybeard>;
|
|
13
14
|
export type NeutrinoOptions = StyleBuilderOptions<Neutrino>;
|
|
14
|
-
export type
|
|
15
|
+
export type EmptyOptions = StyleBuilderOptions<Empty>;
|
|
16
|
+
export type SomeOptions = ColorfulOptions | EclipseOptions | EmptyOptions | GraybeardOptions | NeutrinoOptions;
|
|
15
17
|
type MakeStyle<T extends StyleBuilder<T>, O extends StyleBuilderOptions<T>> = ((options?: O) => MaplibreStyle) & {
|
|
16
18
|
getOptions: () => O;
|
|
17
19
|
};
|
|
@@ -19,8 +21,10 @@ export type ColorfulBuilder = MakeStyle<Colorful, ColorfulOptions>;
|
|
|
19
21
|
export type EclipseBuilder = MakeStyle<Eclipse, EclipseOptions>;
|
|
20
22
|
export type GraybeardBuilder = MakeStyle<Graybeard, GraybeardOptions>;
|
|
21
23
|
export type NeutrinoBuilder = MakeStyle<Neutrino, NeutrinoOptions>;
|
|
22
|
-
export type
|
|
24
|
+
export type EmptyBuilder = MakeStyle<Empty, EmptyOptions>;
|
|
25
|
+
export type SomeBuilder = ColorfulBuilder | EclipseBuilder | EmptyBuilder | GraybeardBuilder | NeutrinoBuilder;
|
|
23
26
|
export declare const colorful: ColorfulBuilder;
|
|
24
27
|
export declare const eclipse: EclipseBuilder;
|
|
25
28
|
export declare const graybeard: GraybeardBuilder;
|
|
26
29
|
export declare const neutrino: NeutrinoBuilder;
|
|
30
|
+
export declare const empty: EmptyBuilder;
|
package/dist/styles/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import Colorful from './colorful.js';
|
|
|
3
3
|
import Eclipse from './eclipse.js';
|
|
4
4
|
import Graybeard from './graybeard.js';
|
|
5
5
|
import Neutrino from './neutrino.js';
|
|
6
|
+
import Empty from './empty.js';
|
|
6
7
|
function getStyleBuilder(styleBuilder) {
|
|
7
8
|
const fn = function (options) {
|
|
8
9
|
return new styleBuilder().build(options);
|
|
@@ -15,3 +16,4 @@ export const colorful = getStyleBuilder(Colorful);
|
|
|
15
16
|
export const eclipse = getStyleBuilder(Eclipse);
|
|
16
17
|
export const graybeard = getStyleBuilder(Graybeard);
|
|
17
18
|
export const neutrino = getStyleBuilder(Neutrino);
|
|
19
|
+
export const empty = getStyleBuilder(Empty);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versatiles/style",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.1",
|
|
4
4
|
"description": "Generate StyleJSON for MapLibre",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"// dev": "????",
|
|
15
15
|
"// doc": "vrt ts2md src/index.ts tsconfig.node.json | vrt insertmd README.md '# API'",
|
|
16
16
|
"lint": "eslint --color .",
|
|
17
|
+
"prepack": "npm run build",
|
|
17
18
|
"release": "npx vrt release-npm",
|
|
18
19
|
"test": "npm run test-typescript",
|
|
19
20
|
"test-coverage": "NODE_OPTIONS=--experimental-vm-modules jest --coverage",
|
|
@@ -37,8 +38,8 @@
|
|
|
37
38
|
"dist/**/*.d.ts"
|
|
38
39
|
],
|
|
39
40
|
"devDependencies": {
|
|
40
|
-
"@maplibre/maplibre-gl-style-spec": "^20.
|
|
41
|
-
"@rollup/plugin-commonjs": "^
|
|
41
|
+
"@maplibre/maplibre-gl-style-spec": "^20.3.0",
|
|
42
|
+
"@rollup/plugin-commonjs": "^26.0.1",
|
|
42
43
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
43
44
|
"@rollup/plugin-terser": "^0.4.4",
|
|
44
45
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
@@ -46,26 +47,26 @@
|
|
|
46
47
|
"@types/brace-expansion": "^1.1.2",
|
|
47
48
|
"@types/inquirer": "^9.0.7",
|
|
48
49
|
"@types/jest": "^29.5.12",
|
|
49
|
-
"@types/node": "^20.
|
|
50
|
+
"@types/node": "^20.14.2",
|
|
50
51
|
"@types/tar-stream": "^3.1.3",
|
|
51
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
52
|
-
"@typescript-eslint/parser": "^7.
|
|
52
|
+
"@typescript-eslint/eslint-plugin": "^7.12.0",
|
|
53
|
+
"@typescript-eslint/parser": "^7.12.0",
|
|
53
54
|
"@versatiles/container": "^1.2.1",
|
|
54
|
-
"@versatiles/release-tool": "^1.2.
|
|
55
|
+
"@versatiles/release-tool": "^1.2.3",
|
|
55
56
|
"bin-pack": "^1.0.2",
|
|
56
|
-
"eslint": "^8.
|
|
57
|
-
"inquirer": "^9.2.
|
|
57
|
+
"eslint": "^8.56.0",
|
|
58
|
+
"inquirer": "^9.2.23",
|
|
58
59
|
"jest": "^29.7.0",
|
|
59
60
|
"jest-environment-jsdom": "^29.7.0",
|
|
60
61
|
"jest-ts-webcompat-resolver": "^1.0.0",
|
|
61
|
-
"npm-check-updates": "^16.14.
|
|
62
|
-
"rollup": "^4.
|
|
63
|
-
"rollup-plugin-dts": "^6.1.
|
|
64
|
-
"sharp": "^0.33.
|
|
62
|
+
"npm-check-updates": "^16.14.20",
|
|
63
|
+
"rollup": "^4.18.0",
|
|
64
|
+
"rollup-plugin-dts": "^6.1.1",
|
|
65
|
+
"sharp": "^0.33.4",
|
|
65
66
|
"tar-stream": "^3.1.7",
|
|
66
|
-
"ts-jest": "^29.1.
|
|
67
|
+
"ts-jest": "^29.1.4",
|
|
67
68
|
"ts-node": "^10.9.2",
|
|
68
|
-
"tsx": "^4.
|
|
69
|
-
"typescript": "^5.4.
|
|
69
|
+
"tsx": "^4.12.0",
|
|
70
|
+
"typescript": "^5.4.5"
|
|
70
71
|
}
|
|
71
72
|
}
|