@versatiles/style 3.8.2 → 4.0.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/README.MD +5 -4
- package/dist/index.d.ts +7 -5
- package/dist/index.js +12 -10
- package/dist/index.test.js +11 -12
- package/dist/lib/{style_builder.test.js → build_style.test.js} +1 -1
- package/dist/lib/{style_guesser.test.js → guess_style.test.js} +1 -1
- package/dist/lib/recolor.d.ts +1 -1
- package/dist/lib/recolor.test.d.ts +1 -1
- package/dist/lib/recolor.test.js +1 -1
- package/dist/lib/types.d.ts +1 -1
- package/dist/style/colorful.d.ts +1 -1
- package/dist/style/colorful.js +1 -1
- package/dist/style/neutrino.d.ts +1 -1
- package/dist/style/neutrino.js +1 -1
- package/package.json +3 -3
- /package/dist/lib/{style_builder.d.ts → build_style.d.ts} +0 -0
- /package/dist/lib/{style_builder.js → build_style.js} +0 -0
- /package/dist/lib/{style_builder.test.d.ts → build_style.test.d.ts} +0 -0
- /package/dist/lib/{style_guesser.d.ts → guess_style.d.ts} +0 -0
- /package/dist/lib/{style_guesser.js → guess_style.js} +0 -0
- /package/dist/lib/{style_guesser.test.d.ts → guess_style.test.d.ts} +0 -0
package/README.MD
CHANGED
|
@@ -35,7 +35,7 @@ Use it in:
|
|
|
35
35
|
<script src="maplibre-gl.js"></script>
|
|
36
36
|
<script src="versatiles-style.js"></script>
|
|
37
37
|
<script>
|
|
38
|
-
const style = VersaTilesStyle.graybeard({
|
|
38
|
+
const style = VersaTilesStyle.styles.graybeard({
|
|
39
39
|
tiles: ['https://???.org/tiles/osm/{z}/{x}/{y}'],
|
|
40
40
|
sprite: 'https://???.org/assets/styles/swr-bright/sprite',
|
|
41
41
|
glyphs: 'https://???.org/assets/fonts/{fontstack}/{range}.pbf',
|
|
@@ -62,9 +62,10 @@ npm install versatiles-style
|
|
|
62
62
|
Use it in Node.js:
|
|
63
63
|
|
|
64
64
|
```javascript
|
|
65
|
-
import {
|
|
66
|
-
let style =
|
|
67
|
-
|
|
65
|
+
import { styles } from 'versatiles-style';
|
|
66
|
+
let style = styles.colorful({
|
|
67
|
+
languageSuffix: '_en',
|
|
68
|
+
});
|
|
68
69
|
writeFileSync('style.json', JSON.stringify(style.build()));
|
|
69
70
|
```
|
|
70
71
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { MaplibreStyle, StylemakerOptions } from './lib/types.js';
|
|
2
|
+
export type { TileJSONSpecification, TileJSONSpecificationRaster, TileJSONSpecificationVector } from './lib/types.js';
|
|
2
3
|
import Colorful from './style/colorful.js';
|
|
3
|
-
export declare function colorful(options?: StylemakerOptions<Colorful>): MaplibreStyle;
|
|
4
4
|
import Graybeard from './style/graybeard.js';
|
|
5
|
-
export declare function graybeard(options?: StylemakerOptions<Graybeard>): MaplibreStyle;
|
|
6
5
|
import Neutrino from './style/neutrino.js';
|
|
7
|
-
export declare
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
export declare const styles: {
|
|
7
|
+
colorful: (options?: StylemakerOptions<Colorful>) => MaplibreStyle;
|
|
8
|
+
graybeard: (options?: StylemakerOptions<Graybeard>) => MaplibreStyle;
|
|
9
|
+
neutrino: (options?: StylemakerOptions<Neutrino>) => MaplibreStyle;
|
|
10
|
+
};
|
|
11
|
+
export { default as guessStyle } from './lib/guess_style.js';
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import Colorful from './style/colorful.js';
|
|
2
|
-
export function colorful(options) {
|
|
3
|
-
return new Colorful().build(options);
|
|
4
|
-
}
|
|
5
2
|
import Graybeard from './style/graybeard.js';
|
|
6
|
-
export function graybeard(options) {
|
|
7
|
-
return new Graybeard().build(options);
|
|
8
|
-
}
|
|
9
3
|
import Neutrino from './style/neutrino.js';
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
export const styles = {
|
|
5
|
+
colorful: function colorful(options) {
|
|
6
|
+
return new Colorful().build(options);
|
|
7
|
+
},
|
|
8
|
+
graybeard: function graybeard(options) {
|
|
9
|
+
return new Graybeard().build(options);
|
|
10
|
+
},
|
|
11
|
+
neutrino: function neutrino(options) {
|
|
12
|
+
return new Neutrino().build(options);
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
export { default as guessStyle } from './lib/guess_style.js';
|
package/dist/index.test.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
|
-
import
|
|
3
|
-
describe('
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
]
|
|
9
|
-
styles.forEach(({ name, builder }) => {
|
|
2
|
+
import { guessStyle, styles } from './index.js';
|
|
3
|
+
describe('styles', () => {
|
|
4
|
+
it('should be all styles', () => {
|
|
5
|
+
expect(Array.from(Object.keys(styles)).sort())
|
|
6
|
+
.toStrictEqual(['colorful', 'graybeard', 'neutrino']);
|
|
7
|
+
});
|
|
8
|
+
Object.entries(styles).forEach(([name, builder]) => {
|
|
10
9
|
it(`should create and test an instance of ${name}`, () => {
|
|
11
10
|
expect(typeof builder).toBe('function');
|
|
12
11
|
const style = builder({ baseUrl: 'https://example.org' });
|
|
13
12
|
expect(JSON.stringify(style).length).toBeGreaterThan(50000);
|
|
14
|
-
expect(style.name).toBe('versatiles-' + name
|
|
13
|
+
expect(style.name).toBe('versatiles-' + name);
|
|
15
14
|
expect(style.glyphs).toBe('https://example.org/assets/fonts/{fontstack}/{range}.pbf');
|
|
16
15
|
expect(style.sprite).toBe('https://example.org/assets/sprites/sprites');
|
|
17
16
|
expect(Object.keys(style.sources).join(',')).toBe('versatiles-shortbread');
|
|
@@ -20,7 +19,7 @@ describe('Style Builders', () => {
|
|
|
20
19
|
});
|
|
21
20
|
});
|
|
22
21
|
describe('Colorful', () => {
|
|
23
|
-
const style =
|
|
22
|
+
const style = styles.colorful({
|
|
24
23
|
baseUrl: 'https://dev.null',
|
|
25
24
|
colors: { commercial: '#f00' },
|
|
26
25
|
});
|
|
@@ -38,7 +37,7 @@ describe('guessStyle', () => {
|
|
|
38
37
|
const tiles = ['https://fancy.map/tiles/{z}/{x}/{y}'];
|
|
39
38
|
const vectorLayers = [{ id: 'hallo', fields: { label: 'String' } }];
|
|
40
39
|
it('should build raster styles', () => {
|
|
41
|
-
const style =
|
|
40
|
+
const style = guessStyle({
|
|
42
41
|
tiles,
|
|
43
42
|
format: 'png',
|
|
44
43
|
});
|
|
@@ -49,7 +48,7 @@ describe('guessStyle', () => {
|
|
|
49
48
|
});
|
|
50
49
|
});
|
|
51
50
|
it('should build vector styles', () => {
|
|
52
|
-
const style =
|
|
51
|
+
const style = guessStyle({
|
|
53
52
|
tiles,
|
|
54
53
|
format: 'pbf',
|
|
55
54
|
vectorLayers,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
2
|
import Color from 'color';
|
|
3
|
-
import StyleBuilder from './
|
|
3
|
+
import StyleBuilder from './build_style.js';
|
|
4
4
|
// Mock class for abstract class StyleBuilder
|
|
5
5
|
class MockStyleBuilder extends StyleBuilder {
|
|
6
6
|
name = 'mock';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
2
|
import getTemplate from './shortbread/template.js';
|
|
3
|
-
import guessStyle from './
|
|
3
|
+
import guessStyle from './guess_style.js';
|
|
4
4
|
describe('guessStyle', () => {
|
|
5
5
|
const tiles = ['https://example.com/tiles/{z}/{x}/{y}'];
|
|
6
6
|
const vectorLayersSomething = [{ id: 'geometry', fields: { label: 'String', height: 'Number' } }];
|
package/dist/lib/recolor.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { RecolorOptions, StylemakerColors } from './types.js';
|
|
2
|
-
import type StyleBuilder from './
|
|
2
|
+
import type StyleBuilder from './build_style.ts';
|
|
3
3
|
export declare function getDefaultRecolorFlags(): RecolorOptions;
|
|
4
4
|
export declare function recolor<Subclass extends StyleBuilder<Subclass>>(colors: StylemakerColors<Subclass>, opt?: RecolorOptions): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { StyleRules, StyleRulesOptions } from './types.js';
|
|
2
|
-
import StyleBuilder from './
|
|
2
|
+
import StyleBuilder from './build_style.js';
|
|
3
3
|
export default class TestStyle extends StyleBuilder<TestStyle> {
|
|
4
4
|
readonly name: string;
|
|
5
5
|
defaultFonts: {};
|
package/dist/lib/recolor.test.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getDefaultRecolorFlags, recolor } from './recolor.js';
|
|
2
|
-
import StyleBuilder from './
|
|
2
|
+
import StyleBuilder from './build_style.js';
|
|
3
3
|
describe('colorTransformer', () => {
|
|
4
4
|
describe('getDefaultRecolorFlags', () => {
|
|
5
5
|
it('should return the default color transformer flags', () => {
|
package/dist/lib/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BackgroundLayerSpecification, FillLayerSpecification, FilterSpecification, LineLayerSpecification, StyleSpecification, SymbolLayerSpecification } from '@maplibre/maplibre-gl-style-spec';
|
|
2
2
|
import type Color from 'color';
|
|
3
|
-
import type StyleBuilder from './
|
|
3
|
+
import type StyleBuilder from './build_style.ts';
|
|
4
4
|
/** Represents the available tile formats. */
|
|
5
5
|
export type TileFormat = 'avif' | 'bin' | 'geojson' | 'jpg' | 'json' | 'pbf' | 'png' | 'svg' | 'topojson' | 'webp';
|
|
6
6
|
/** Type for Maplibre layers, including background, fill, line, and symbol specifications. */
|
package/dist/style/colorful.d.ts
CHANGED
package/dist/style/colorful.js
CHANGED
package/dist/style/neutrino.d.ts
CHANGED
package/dist/style/neutrino.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versatiles/style",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Generate StyleJSON for MapLibre",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@types/brace-expansion": "^1.1.2",
|
|
46
46
|
"@types/inquirer": "^9.0.7",
|
|
47
47
|
"@types/jest": "^29.5.12",
|
|
48
|
-
"@types/node": "^20.11.
|
|
48
|
+
"@types/node": "^20.11.19",
|
|
49
49
|
"@typescript-eslint/eslint-plugin": "^7.0.1",
|
|
50
50
|
"@typescript-eslint/parser": "^7.0.1",
|
|
51
51
|
"@versatiles/release-tool": "^1.2.1",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"jest-environment-jsdom": "^29.7.0",
|
|
56
56
|
"jest-ts-webcompat-resolver": "^1.0.0",
|
|
57
57
|
"npm-check-updates": "^16.14.15",
|
|
58
|
-
"rollup": "^4.
|
|
58
|
+
"rollup": "^4.11.0",
|
|
59
59
|
"rollup-plugin-dts": "^6.1.0",
|
|
60
60
|
"ts-jest": "^29.1.2",
|
|
61
61
|
"ts-node": "^10.9.2",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|