@versatiles/svelte 0.1.2 → 0.2.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 VersaTiles
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -4,13 +4,13 @@
4
4
  import { onMount, createEventDispatcher } from 'svelte';
5
5
  import 'maplibre-gl/dist/maplibre-gl.css';
6
6
  import { getMapStyle, isDarkMode } from '../../utils/style.js';
7
- import type { ColorfulOptions } from '@versatiles/style';
7
+ import type { StyleBuilderOptions } from '@versatiles/style';
8
8
 
9
9
  // Props
10
10
  export let style: string = 'position:absolute; left:0px; top:0px; width:100%; height:100%;';
11
11
  export let container: HTMLDivElement | undefined = undefined;
12
12
  export let map: MaplibreMapType | undefined = undefined;
13
- export let styleOptions: ColorfulOptions = {};
13
+ export let styleOptions: StyleBuilderOptions = {};
14
14
  export let mapOptions: Partial<MapOptions> = {};
15
15
 
16
16
  // Create the event dispatcher
@@ -1,6 +1,6 @@
1
1
  import type { Map as MaplibreMapType, MapOptions } from 'maplibre-gl';
2
2
  import 'maplibre-gl/dist/maplibre-gl.css';
3
- import type { ColorfulOptions } from '@versatiles/style';
3
+ import type { StyleBuilderOptions } from '@versatiles/style';
4
4
  interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
5
5
  new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
6
6
  $$bindings?: Bindings;
@@ -18,7 +18,7 @@ declare const BasicMap: $$__sveltets_2_IsomorphicComponent<{
18
18
  style?: string;
19
19
  container?: HTMLDivElement | undefined;
20
20
  map?: MaplibreMapType | undefined;
21
- styleOptions?: ColorfulOptions;
21
+ styleOptions?: StyleBuilderOptions;
22
22
  mapOptions?: Partial<MapOptions>;
23
23
  }, {
24
24
  mapReady: CustomEvent<any>;
@@ -1,3 +1,3 @@
1
- import type { LanguageSuffix } from '@versatiles/style/dist/style_builder/types.js';
1
+ import type { Language } from '@versatiles/style';
2
2
  export declare function getCountry(): string;
3
- export declare function getLanguage(): LanguageSuffix;
3
+ export declare function getLanguage(): Language;
@@ -22,10 +22,10 @@ export function getLanguage() {
22
22
  case 'de':
23
23
  return language;
24
24
  }
25
- return undefined;
25
+ return null;
26
26
  }
27
27
  catch (error) {
28
28
  console.error('Could not determine country from timezone:', error);
29
- return undefined; // Fallback if no country can be determined
29
+ return null; // Fallback if no country can be determined
30
30
  }
31
31
  }
@@ -1,3 +1,3 @@
1
- import { styles, type ColorfulOptions } from '@versatiles/style';
2
- export declare function getMapStyle(darkMode: boolean, styleOptions?: ColorfulOptions): styles.MaplibreStyle;
1
+ import { type StyleBuilderOptions } from '@versatiles/style';
2
+ export declare function getMapStyle(darkMode: boolean, styleOptions?: StyleBuilderOptions): import("maplibre-gl").StyleSpecification;
3
3
  export declare function isDarkMode(element: HTMLElement): boolean;
@@ -3,7 +3,7 @@ import { getLanguage } from './location.js';
3
3
  export function getMapStyle(darkMode, styleOptions = {}) {
4
4
  return styles.colorful({
5
5
  baseUrl: 'https://tiles.versatiles.org',
6
- languageSuffix: getLanguage(),
6
+ language: getLanguage(),
7
7
  recolor: {
8
8
  invertBrightness: darkMode,
9
9
  gamma: darkMode ? 0.5 : 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@versatiles/svelte",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "scripts": {
5
5
  "build": "vite build && npm run package",
6
6
  "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
@@ -36,40 +36,40 @@
36
36
  "svelte": "^5.0.3"
37
37
  },
38
38
  "devDependencies": {
39
- "@playwright/test": "^1.48.1",
40
- "@sveltejs/adapter-auto": "^3.2.5",
41
- "@sveltejs/kit": "^2.7.2",
42
- "@sveltejs/package": "^2.3.5",
43
- "@sveltejs/vite-plugin-svelte": "^4.0.0",
44
- "@turf/turf": "^7.1.0",
39
+ "@playwright/test": "^1.50.0",
40
+ "@sveltejs/adapter-auto": "^4.0.0",
41
+ "@sveltejs/kit": "^2.16.1",
42
+ "@sveltejs/package": "^2.3.9",
43
+ "@sveltejs/vite-plugin-svelte": "^5.0.3",
44
+ "@turf/turf": "^7.2.0",
45
45
  "@types/eslint": "^9.6.1",
46
- "@types/node": "^22.7.7",
46
+ "@types/node": "^22.10.10",
47
47
  "@types/split2": "^4.2.3",
48
48
  "@versatiles/release-tool": "^1.2.6",
49
- "cookie": "^1.0.1",
50
- "eslint": "^9.13.0",
51
- "eslint-config-prettier": "^9.1.0",
52
- "eslint-plugin-svelte": "^2.45.1",
49
+ "cookie": "^1.0.2",
50
+ "eslint": "^9.19.0",
51
+ "eslint-config-prettier": "^10.0.1",
52
+ "eslint-plugin-svelte": "^2.46.1",
53
53
  "geojson": "^0.5.0",
54
- "globals": "^15.11.0",
55
- "npm-check-updates": "^17.1.4",
56
- "prettier": "^3.3.3",
57
- "prettier-plugin-svelte": "^3.2.7",
58
- "publint": "^0.2.11",
54
+ "globals": "^15.14.0",
55
+ "npm-check-updates": "^17.1.14",
56
+ "prettier": "^3.4.2",
57
+ "prettier-plugin-svelte": "^3.3.3",
58
+ "publint": "^0.3.2",
59
59
  "split2": "^4.2.0",
60
- "svelte": "^5.0.3",
61
- "svelte-check": "^4.0.5",
62
- "tsx": "^4.19.1",
63
- "typescript": "^5.6.3",
64
- "typescript-eslint": "^8.10.0",
65
- "vite": "^5.4.9",
66
- "vitest": "^2.1.3"
60
+ "svelte": "^5.19.2",
61
+ "svelte-check": "^4.1.4",
62
+ "tsx": "^4.19.2",
63
+ "typescript": "^5.7.3",
64
+ "typescript-eslint": "^8.21.0",
65
+ "vite": "^6.0.11",
66
+ "vitest": "^3.0.4"
67
67
  },
68
68
  "svelte": "./dist/index.js",
69
69
  "types": "./dist/index.d.ts",
70
70
  "type": "module",
71
71
  "dependencies": {
72
- "@versatiles/style": "^4.4.1",
73
- "maplibre-gl": "^4.7.1"
72
+ "@versatiles/style": "^5.2.5",
73
+ "maplibre-gl": "^5.0.1"
74
74
  }
75
75
  }