@versatiles/svelte 2.0.0 → 2.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.
Files changed (83) hide show
  1. package/dist/components/BBoxMap/BBoxMap.svelte +23 -12
  2. package/dist/components/BBoxMap/lib/bbox.d.ts +1 -1
  3. package/dist/components/BBoxMap/lib/bbox.js +19 -17
  4. package/dist/components/BasicMap/BasicMap.svelte +22 -9
  5. package/dist/components/BasicMap/BasicMap.svelte.d.ts +2 -1
  6. package/dist/components/MapEditor/MapEditor.svelte +51 -20
  7. package/dist/components/MapEditor/components/Dialog.svelte +92 -0
  8. package/dist/components/MapEditor/components/Dialog.svelte.d.ts +17 -0
  9. package/dist/components/MapEditor/components/DialogFile.svelte +112 -0
  10. package/dist/components/MapEditor/components/DialogFile.svelte.d.ts +6 -0
  11. package/dist/components/MapEditor/components/DialogShare.svelte +216 -0
  12. package/dist/components/MapEditor/components/DialogShare.svelte.d.ts +10 -0
  13. package/dist/components/MapEditor/components/Editor.svelte +16 -14
  14. package/dist/components/MapEditor/components/EditorFill.svelte +35 -3
  15. package/dist/components/MapEditor/components/EditorStroke.svelte +35 -3
  16. package/dist/components/MapEditor/components/EditorSymbol.svelte +85 -8
  17. package/dist/components/MapEditor/components/InputRow.svelte +2 -3
  18. package/dist/components/MapEditor/components/PanelFile.svelte +73 -0
  19. package/dist/components/MapEditor/components/PanelFile.svelte.d.ts +7 -0
  20. package/dist/components/MapEditor/components/PanelSymbolSelector.svelte +82 -0
  21. package/dist/components/MapEditor/components/PanelSymbolSelector.svelte.d.ts +8 -0
  22. package/dist/components/MapEditor/components/Sidebar.svelte +59 -103
  23. package/dist/components/MapEditor/components/Sidebar.svelte.d.ts +3 -3
  24. package/dist/components/MapEditor/components/SidebarPanel.svelte +26 -9
  25. package/dist/components/MapEditor/lib/element/abstract.d.ts +8 -4
  26. package/dist/components/MapEditor/lib/element/abstract.js +11 -2
  27. package/dist/components/MapEditor/lib/element/abstract_path.d.ts +3 -2
  28. package/dist/components/MapEditor/lib/element/abstract_path.js +6 -3
  29. package/dist/components/MapEditor/lib/element/circle.d.ts +25 -0
  30. package/dist/components/MapEditor/lib/element/circle.js +118 -0
  31. package/dist/components/MapEditor/lib/element/line.d.ts +2 -2
  32. package/dist/components/MapEditor/lib/element/line.js +1 -1
  33. package/dist/components/MapEditor/lib/element/marker.d.ts +4 -3
  34. package/dist/components/MapEditor/lib/element/marker.js +2 -2
  35. package/dist/components/MapEditor/lib/element/polygon.d.ts +2 -2
  36. package/dist/components/MapEditor/lib/element/polygon.js +2 -2
  37. package/dist/components/MapEditor/lib/element/types.d.ts +2 -3
  38. package/dist/components/MapEditor/lib/geometry_manager.d.ts +12 -29
  39. package/dist/components/MapEditor/lib/geometry_manager.js +44 -162
  40. package/dist/components/MapEditor/lib/geometry_manager_interactive.d.ts +33 -0
  41. package/dist/components/MapEditor/lib/geometry_manager_interactive.js +102 -0
  42. package/dist/components/MapEditor/lib/map_layer/abstract.d.ts +2 -2
  43. package/dist/components/MapEditor/lib/map_layer/abstract.js +25 -25
  44. package/dist/components/MapEditor/lib/map_layer/fill.js +5 -16
  45. package/dist/components/MapEditor/lib/map_layer/line.js +5 -17
  46. package/dist/components/MapEditor/lib/map_layer/symbol.js +1 -1
  47. package/dist/components/MapEditor/lib/selection.d.ts +11 -0
  48. package/dist/components/MapEditor/lib/selection.js +70 -0
  49. package/dist/components/MapEditor/lib/state/constants.js +5 -6
  50. package/dist/components/MapEditor/lib/state/history.d.ts +14 -0
  51. package/dist/components/MapEditor/lib/state/history.js +53 -0
  52. package/dist/components/MapEditor/lib/state/manager.d.ts +8 -10
  53. package/dist/components/MapEditor/lib/state/manager.js +24 -48
  54. package/dist/components/MapEditor/lib/state/reader.d.ts +6 -4
  55. package/dist/components/MapEditor/lib/state/reader.js +70 -18
  56. package/dist/components/MapEditor/lib/state/types.d.ts +19 -2
  57. package/dist/components/MapEditor/lib/state/utils.d.ts +2 -0
  58. package/dist/components/MapEditor/lib/state/utils.js +12 -0
  59. package/dist/components/MapEditor/lib/state/writer.d.ts +6 -4
  60. package/dist/components/MapEditor/lib/state/writer.js +59 -19
  61. package/dist/components/MapEditor/lib/symbols.d.ts +1 -1
  62. package/dist/components/MapEditor/lib/symbols.js +47 -28
  63. package/dist/components/MapEditor/lib/utils/event_handler.d.ts +10 -0
  64. package/dist/components/MapEditor/lib/utils/event_handler.js +39 -0
  65. package/dist/components/MapEditor/lib/utils/geometry.d.ts +12 -0
  66. package/dist/components/MapEditor/lib/utils/geometry.js +87 -0
  67. package/dist/components/MapEditor/lib/utils/types.d.ts +2 -0
  68. package/dist/components/MapEditor/lib/utils/types.js +1 -0
  69. package/dist/components/MapEditor/style/button.scss +115 -0
  70. package/dist/components/MapEditor/style/index.scss +3 -0
  71. package/dist/components/MapEditor/style/layout.scss +20 -0
  72. package/dist/components/MapEditor/style/other.scss +10 -0
  73. package/dist/utils/location.d.ts +1 -0
  74. package/dist/utils/location.js +181 -0
  75. package/dist/utils/map_style.d.ts +2 -2
  76. package/dist/utils/map_style.js +2 -2
  77. package/package.json +29 -29
  78. package/dist/components/MapEditor/components/SymbolSelector.svelte +0 -110
  79. package/dist/components/MapEditor/components/SymbolSelector.svelte.d.ts +0 -8
  80. package/dist/components/MapEditor/lib/utils.d.ts +0 -6
  81. package/dist/components/MapEditor/lib/utils.js +0 -23
  82. /package/dist/components/MapEditor/lib/{geocoder.d.ts → utils/geocoder.d.ts} +0 -0
  83. /package/dist/components/MapEditor/lib/{geocoder.js → utils/geocoder.js} +0 -0
@@ -50,14 +50,16 @@ export class StateWriter {
50
50
  for (let i = 0; i < length; i++)
51
51
  cb(array[i]);
52
52
  }
53
- writePoint(point, level = 14) {
54
- const scale = Math.pow(2, level + 2);
55
- this.writeInteger(Math.round(point[0] * scale), level + 11);
56
- this.writeInteger(Math.round(point[1] * scale), level + 10);
57
- }
58
- writePoints(points, level = 14) {
53
+ writePoint(point, resolutionInMeters = 1) {
54
+ if (!resolutionInMeters || resolutionInMeters < 1)
55
+ resolutionInMeters = 1;
56
+ const scale = Math.round(1e5 / resolutionInMeters);
57
+ this.writeVarint(Math.round(point[0] * scale), true);
58
+ this.writeVarint(Math.round(point[1] * scale), true);
59
+ }
60
+ writePoints(points, resolutionInMeters = 1) {
59
61
  this.writeVarint(points.length);
60
- const scale = Math.pow(2, level + 2);
62
+ const scale = Math.round(1e5 / resolutionInMeters);
61
63
  let x = 0;
62
64
  let y = 0;
63
65
  points.forEach((point) => {
@@ -72,15 +74,8 @@ export class StateWriter {
72
74
  writeRoot(root) {
73
75
  // Write the version
74
76
  this.writeInteger(0, 3);
75
- if (root.map) {
76
- this.writeBit(true);
77
- this.writeMap(root.map);
78
- }
79
- else {
80
- this.writeBit(false);
81
- }
82
- // metadata is not used yet
83
- this.writeBit(false);
77
+ this.writeMap(root.map);
78
+ this.writeMetadata(root.meta);
84
79
  root.elements.forEach((element) => {
85
80
  switch (element.type) {
86
81
  case 'marker':
@@ -95,12 +90,35 @@ export class StateWriter {
95
90
  this.writeInteger(3, 3);
96
91
  this.writeElementPolygon(element);
97
92
  break;
93
+ case 'circle':
94
+ this.writeInteger(4, 3);
95
+ this.writeElementCircle(element);
96
+ break;
98
97
  }
99
98
  });
100
99
  }
101
100
  writeMap(map) {
102
- this.writeInteger(Math.round(map.zoom * 32), 10);
103
- this.writePoint(map.center, Math.ceil(map.zoom));
101
+ if (!map) {
102
+ return this.writeBit(false);
103
+ }
104
+ this.writeBit(true);
105
+ const value = Math.round(Math.log2(map.radius) * 40);
106
+ const radius = Math.pow(2, value / 40);
107
+ this.writeInteger(value, 10);
108
+ // effective resolution of coordinates is 1000 times the visible radius
109
+ this.writePoint(map.center, radius / 1e3);
110
+ this.writeBit(false); // additional map data not supported yet
111
+ }
112
+ writeMetadata(metadata) {
113
+ if (!metadata || Object.keys(metadata).length === 0) {
114
+ return this.writeBit(false);
115
+ }
116
+ this.writeBit(true);
117
+ //if (metadata.heading) {
118
+ // this.writeInteger(1, 6);
119
+ // this.writeString(metadata.heading);
120
+ //}
121
+ this.writeInteger(0, 6);
104
122
  }
105
123
  writeElementMarker(element) {
106
124
  this.writePoint(element.point);
@@ -111,6 +129,7 @@ export class StateWriter {
111
129
  else {
112
130
  this.writeBit(false);
113
131
  }
132
+ this.writeBit(false); // tooltip not supported yet
114
133
  return element;
115
134
  }
116
135
  writeElementLine(element) {
@@ -122,6 +141,7 @@ export class StateWriter {
122
141
  else {
123
142
  this.writeBit(false);
124
143
  }
144
+ this.writeBit(false); // tooltip not supported yet
125
145
  return element;
126
146
  }
127
147
  writeElementPolygon(element) {
@@ -140,6 +160,26 @@ export class StateWriter {
140
160
  else {
141
161
  this.writeBit(false);
142
162
  }
163
+ this.writeBit(false); // tooltip not supported yet
164
+ }
165
+ writeElementCircle(element) {
166
+ this.writePoint(element.point);
167
+ this.writeVarint(Math.round(element.radius));
168
+ if (element.style) {
169
+ this.writeBit(true);
170
+ this.writeStyle(element.style);
171
+ }
172
+ else {
173
+ this.writeBit(false);
174
+ }
175
+ if (element.strokeStyle) {
176
+ this.writeBit(true);
177
+ this.writeStyle(element.strokeStyle);
178
+ }
179
+ else {
180
+ this.writeBit(false);
181
+ }
182
+ this.writeBit(false); // tooltip not supported yet
143
183
  }
144
184
  writeStyle(style) {
145
185
  if (style.halo != null) {
@@ -184,7 +224,7 @@ export class StateWriter {
184
224
  this.writeInteger(0, 4);
185
225
  }
186
226
  writeColor(color) {
187
- const rgb = Color.parse(color).toRGB();
227
+ const rgb = Color.parse(color).asRGB();
188
228
  this.writeInteger(rgb.r, 8);
189
229
  this.writeInteger(rgb.g, 8);
190
230
  this.writeInteger(rgb.b, 8);
@@ -11,6 +11,6 @@ export declare class SymbolLibrary {
11
11
  private map;
12
12
  constructor(map: maplibregl.Map);
13
13
  getSymbol(index: number): SymbolInfo;
14
- drawSymbol(canvas: HTMLCanvasElement, index: number, halo?: boolean): void;
14
+ drawSymbol(canvas: HTMLCanvasElement, index: number, halo?: number): void;
15
15
  asList(): SymbolInfo[];
16
16
  }
@@ -84,8 +84,7 @@ const entries = [
84
84
  [82, 'shield', 'basics:icon-historic', [0, -10]],
85
85
  [83, 'shoes', 'basics:icon-shoes', [-5, 0]],
86
86
  [84, 'shop', 'basics:icon-shop'],
87
- [85, 'shop', 'basics:icon-shop'],
88
- [86, 'shrine', 'basics:icon-shrine'],
87
+ [85, 'shrine', 'basics:icon-shrine'],
89
88
  [87, 'sports', 'basics:icon-sports'],
90
89
  [88, 'stadium', 'basics:icon-stadium'],
91
90
  [89, 'stationery', 'basics:icon-stationery'],
@@ -126,46 +125,66 @@ export class SymbolLibrary {
126
125
  getSymbol(index) {
127
126
  return symbols.get(index) ?? defaultSymbol;
128
127
  }
129
- drawSymbol(canvas, index, halo = false) {
128
+ drawSymbol(canvas, index, halo = 0) {
130
129
  const symbol = this.getSymbol(index);
131
130
  if (!symbol.image)
132
131
  return;
133
- const { sdf, data: imageData0 } = this.map.getImage(symbol.image);
134
- const { data: data0, width: width0, height: height0 } = imageData0;
135
- const { width: width1, height: height1 } = canvas;
136
- const data1 = new Uint8ClampedArray(width1 * height1 * 4);
137
- for (let y1 = 0; y1 < height1; y1++) {
138
- const y0 = Math.floor((y1 / height1) * height0);
139
- for (let x1 = 0; x1 < width1; x1++) {
140
- const x0 = Math.floor((x1 / width1) * width0);
141
- const i0 = (y0 * width0 + x0) * 4;
142
- const i1 = (y1 * width1 + x1) * 4;
132
+ const { sdf, data: imageDataSrc } = this.map.getImage(symbol.image);
133
+ const { data: dataSrc, width: widthSrc, height: heightSrc } = imageDataSrc;
134
+ const { width: widthDst, height: heightDst } = canvas;
135
+ const scale = Math.min(widthDst / widthSrc, heightDst / heightSrc);
136
+ const x0 = (widthDst - widthSrc * scale) / 2;
137
+ const y0 = (heightDst - heightSrc * scale) / 2;
138
+ const border = halo;
139
+ const dataDst = new Uint8ClampedArray(widthDst * heightDst * 4);
140
+ for (let yi = 0; yi < heightDst; yi++) {
141
+ for (let xi = 0; xi < widthDst; xi++) {
142
+ const x = (xi - x0) / scale;
143
+ const y = (yi - y0) / scale;
144
+ const i = (yi * widthDst + xi) * 4;
143
145
  if (sdf) {
144
- const v = (data0[i0 + 3] - 191) * 16;
145
- let a, b;
146
+ const v = (interpolate(x, y, 3) - 191) * 8 * scale;
147
+ let alpha, color;
146
148
  if (halo) {
147
- b = Math.min(255, Math.max(0, 255 - v));
148
- a = Math.min(255, Math.max(0, 256 * 6 + v));
149
+ color = Math.min(255, Math.max(0, 127.5 - v));
150
+ alpha = Math.min(255, Math.max(0, 256 * border + v));
149
151
  }
150
152
  else {
151
- b = 0;
152
- a = Math.min(255, Math.max(0, v));
153
+ color = 0;
154
+ alpha = Math.min(255, Math.max(0, v));
153
155
  }
154
- data1[i1] = b;
155
- data1[i1 + 1] = b;
156
- data1[i1 + 2] = b;
157
- data1[i1 + 3] = a;
156
+ dataDst[i] = color;
157
+ dataDst[i + 1] = color;
158
+ dataDst[i + 2] = color;
159
+ dataDst[i + 3] = alpha;
158
160
  }
159
161
  else {
160
- data1[i1] = data0[i0];
161
- data1[i1 + 1] = data0[i0 + 1];
162
- data1[i1 + 2] = data0[i0 + 2];
163
- data1[i1 + 3] = data0[i0 + 3];
162
+ dataDst[i] = interpolate(x, y, 0);
163
+ dataDst[i + 1] = interpolate(x, y, 1);
164
+ dataDst[i + 2] = interpolate(x, y, 2);
165
+ dataDst[i + 3] = interpolate(x, y, 3);
164
166
  }
165
167
  }
166
168
  }
167
169
  const ctx = canvas.getContext('2d');
168
- ctx.putImageData(new ImageData(data1, width1, height1), 0, 0);
170
+ ctx.putImageData(new ImageData(dataDst, widthDst, heightDst), 0, 0);
171
+ function interpolate(x, y, c) {
172
+ if (x < 0 || y < 0 || x >= widthSrc - 1 || y >= heightSrc - 1)
173
+ return 0;
174
+ const x0 = Math.floor(x);
175
+ const y0 = Math.floor(y);
176
+ const x1 = Math.ceil(x);
177
+ const y1 = Math.ceil(y);
178
+ const xa = (x - x0) / Math.max(1, x1 - x0);
179
+ const ya = (y - y0) / Math.max(1, y1 - y0);
180
+ const v00 = dataSrc[(y0 * widthSrc + x0) * 4 + c];
181
+ const v01 = dataSrc[(y0 * widthSrc + x1) * 4 + c];
182
+ const v10 = dataSrc[(y1 * widthSrc + x0) * 4 + c];
183
+ const v11 = dataSrc[(y1 * widthSrc + x1) * 4 + c];
184
+ const v0 = v00 * (1 - xa) + v01 * xa;
185
+ const v1 = v10 * (1 - xa) + v11 * xa;
186
+ return v0 * (1 - ya) + v1 * ya;
187
+ }
169
188
  }
170
189
  asList() {
171
190
  return Array.from(symbols.values());
@@ -0,0 +1,10 @@
1
+ export declare class EventHandler {
2
+ private index;
3
+ private events;
4
+ constructor();
5
+ emit(event: string): void;
6
+ on(name: string, callback: () => void): number;
7
+ once(name: string, callback: () => void): number;
8
+ off(name: string, index?: number): void;
9
+ clear(): void;
10
+ }
@@ -0,0 +1,39 @@
1
+ export class EventHandler {
2
+ index = 0;
3
+ events = new Map();
4
+ constructor() { }
5
+ emit(event) {
6
+ this.events.get(event)?.forEach((callback) => callback());
7
+ }
8
+ on(name, callback) {
9
+ if (!callback)
10
+ throw new Error('Callback is required');
11
+ if (!this.events.has(name))
12
+ this.events.set(name, new Map());
13
+ this.index++;
14
+ this.events.get(name).set(this.index, callback);
15
+ return this.index;
16
+ }
17
+ once(name, callback) {
18
+ if (!callback)
19
+ throw new Error('Callback is required');
20
+ const index = this.on(name, () => {
21
+ this.off(name, index);
22
+ callback();
23
+ });
24
+ return index;
25
+ }
26
+ off(name, index) {
27
+ if (!this.events.has(name))
28
+ return;
29
+ if (index) {
30
+ this.events.get(name)?.delete(index);
31
+ }
32
+ else {
33
+ this.events.delete(name);
34
+ }
35
+ }
36
+ clear() {
37
+ this.events.clear();
38
+ }
39
+ }
@@ -0,0 +1,12 @@
1
+ import type { GeoPath, GeoPoint } from './types.js';
2
+ export declare const EARTH_RADIUS = 6371008.8;
3
+ export declare function getMiddlePoint(p0: GeoPoint, p1: GeoPoint): GeoPoint;
4
+ export declare function lat2mercator(lat: number): number;
5
+ export declare function mercator2lat(y: number): number;
6
+ export declare function distance(point1: GeoPoint, point2: GeoPoint): number;
7
+ export declare function degreesToRadians(degrees: number): number;
8
+ export declare function radiansToDegrees(radians: number): number;
9
+ export declare function circle(center: GeoPoint, radius: number, steps: number): GeoPath;
10
+ type SimpleGeometry = GeoJSON.Point | GeoJSON.LineString | GeoJSON.Polygon;
11
+ export declare function flatten(features: GeoJSON.Feature[]): GeoJSON.Feature<SimpleGeometry>[];
12
+ export {};
@@ -0,0 +1,87 @@
1
+ export const EARTH_RADIUS = 6371008.8; // Radius of the Earth in meters
2
+ export function getMiddlePoint(p0, p1) {
3
+ const y0 = lat2mercator(p0[1]);
4
+ const y1 = lat2mercator(p1[1]);
5
+ return [(p0[0] + p1[0]) / 2, mercator2lat((y0 + y1) / 2)];
6
+ }
7
+ export function lat2mercator(lat) {
8
+ return Math.log(Math.tan(Math.PI / 4 + (lat * Math.PI) / 360));
9
+ }
10
+ export function mercator2lat(y) {
11
+ return ((2 * Math.atan(Math.exp(y)) - Math.PI / 2) * 180) / Math.PI;
12
+ }
13
+ export function distance(point1, point2) {
14
+ const lat1 = degreesToRadians(point1[1]);
15
+ const lat2 = degreesToRadians(point2[1]);
16
+ const deltaLat = degreesToRadians(point2[1] - point1[1]);
17
+ const deltaLng = degreesToRadians(point2[0] - point1[0]);
18
+ const a = Math.sin(deltaLat / 2) * Math.sin(deltaLat / 2) +
19
+ Math.cos(lat1) * Math.cos(lat2) * Math.sin(deltaLng / 2) * Math.sin(deltaLng / 2);
20
+ const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
21
+ return EARTH_RADIUS * c; // Distance in meters
22
+ }
23
+ export function degreesToRadians(degrees) {
24
+ return ((degrees % 360) * Math.PI) / 180;
25
+ }
26
+ export function radiansToDegrees(radians) {
27
+ return ((radians / Math.PI) % 2) * 180;
28
+ }
29
+ export function circle(center, radius, steps) {
30
+ const radians = radius / EARTH_RADIUS;
31
+ const lng1 = degreesToRadians(center[0]);
32
+ const lat1 = degreesToRadians(center[1]);
33
+ const result = [];
34
+ for (let i = 0; i < steps; i++) {
35
+ const bearingRad = degreesToRadians((i * 360) / steps);
36
+ const lat2 = Math.asin(Math.sin(lat1) * Math.cos(radians) + Math.cos(lat1) * Math.sin(radians) * Math.cos(bearingRad));
37
+ const lng2 = lng1 +
38
+ Math.atan2(Math.sin(bearingRad) * Math.sin(radians) * Math.cos(lat1), Math.cos(radians) - Math.sin(lat1) * Math.sin(lat2));
39
+ result.push([radiansToDegrees(lng2), radiansToDegrees(lat2)]);
40
+ }
41
+ return result;
42
+ }
43
+ export function flatten(features) {
44
+ return features.flatMap((feature) => {
45
+ if (feature.type !== 'Feature') {
46
+ throw new Error(`Expected Feature, got ${feature.type}`);
47
+ }
48
+ return flattenGeometry(feature.geometry, feature.properties);
49
+ });
50
+ function flattenGeometry(geometry, properties) {
51
+ switch (geometry.type) {
52
+ case 'Point':
53
+ case 'LineString':
54
+ case 'Polygon':
55
+ return [
56
+ {
57
+ type: 'Feature',
58
+ properties,
59
+ geometry
60
+ }
61
+ ];
62
+ case 'GeometryCollection':
63
+ return geometry.geometries.flatMap((g) => flattenGeometry(g, properties));
64
+ case 'MultiPoint':
65
+ return geometry.coordinates.map((coordinates) => ({
66
+ type: 'Feature',
67
+ properties,
68
+ geometry: { type: 'Point', coordinates }
69
+ }));
70
+ case 'MultiLineString':
71
+ return geometry.coordinates.map((coordinates) => ({
72
+ type: 'Feature',
73
+ properties,
74
+ geometry: { type: 'LineString', coordinates }
75
+ }));
76
+ case 'MultiPolygon':
77
+ return geometry.coordinates.map((coordinates) => ({
78
+ type: 'Feature',
79
+ properties,
80
+ geometry: { type: 'Polygon', coordinates }
81
+ }));
82
+ default:
83
+ // @ts-expect-error error on unknown geometry type
84
+ throw new Error(`Unknown geometry type "${geometry?.type}"`);
85
+ }
86
+ }
87
+ }
@@ -0,0 +1,2 @@
1
+ export type GeoPoint = [number, number];
2
+ export type GeoPath = GeoPoint[];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,115 @@
1
+ button.btn,
2
+ fieldset.btn {
3
+ font-size: 0.8rem;
4
+ }
5
+
6
+ button.btn,
7
+ fieldset.btn > div > label {
8
+ background-color: var(--color-blue);
9
+ opacity: 0.7;
10
+ border-radius: var(--border-radius);
11
+ border: none;
12
+ color: var(--color-bg);
13
+ cursor: pointer;
14
+ display: inline-block;
15
+ font-weight: 600;
16
+ position: relative;
17
+ padding: 0;
18
+ transition: opacity 0.1s ease-in-out;
19
+ padding-block: 0.6em;
20
+ padding-inline: 1.2em;
21
+ }
22
+
23
+ button.btn {
24
+ &:focus {
25
+ outline: 1px solid var(--color-blue);
26
+ outline-offset: 2px;
27
+ }
28
+
29
+ &:not([disabled]):hover {
30
+ opacity: 1;
31
+ }
32
+
33
+ &:disabled {
34
+ opacity: 0.3;
35
+ }
36
+
37
+ &:after {
38
+ content: '✓';
39
+ background-color: var(--color-green);
40
+ border-radius: 1em;
41
+ color: var(--color-bg);
42
+ display: block;
43
+ font-size: 1em;
44
+ height: 1.6em;
45
+ line-height: 1.6em;
46
+ margin-left: 5px;
47
+ opacity: 0;
48
+ pointer-events: none;
49
+ position: absolute;
50
+ right: -0.6em;
51
+ text-align: center;
52
+ top: -0.6em;
53
+ transition: opacity 0.1s ease-in-out;
54
+ width: 1.6em;
55
+ }
56
+
57
+ &.success {
58
+ &:after {
59
+ opacity: 1;
60
+ }
61
+ }
62
+ }
63
+
64
+ fieldset.btn {
65
+ position: relative;
66
+ display: inline-block;
67
+ border: none;
68
+ padding: 0;
69
+
70
+ legend {
71
+ padding-inline: 0;
72
+ position: absolute;
73
+ display: block;
74
+ text-align: center;
75
+ top: -1.3em;
76
+ left: 0;
77
+ right: 0;
78
+ }
79
+
80
+ & > div {
81
+ border-radius: var(--border-radius);
82
+ overflow: hidden;
83
+ border: none;
84
+ display: inline-flex;
85
+ padding: 0;
86
+
87
+ & > label {
88
+ margin: 0;
89
+ border-radius: 0;
90
+ border: none;
91
+ border-left: 0.5px solid color-mix(in srgb, var(--color-bg) 20%, transparent);
92
+
93
+ &:first-of-type {
94
+ border-left: none;
95
+ }
96
+ }
97
+
98
+ input[type='radio'] {
99
+ display: none;
100
+ }
101
+
102
+ input:checked + label,
103
+ label:hover {
104
+ background-color: var(--color-blue);
105
+ color: var(--color-bg);
106
+ }
107
+ }
108
+ }
109
+
110
+ .label {
111
+ opacity: 0.5;
112
+ font-size: 0.7rem;
113
+ font-weight: normal;
114
+ margin: 0;
115
+ }
@@ -0,0 +1,3 @@
1
+ @import url('button.scss');
2
+ @import url('layout.scss');
3
+ @import url('other.scss');
@@ -0,0 +1,20 @@
1
+ .grid1,
2
+ .grid2 {
3
+ display: grid;
4
+ gap: var(--btn-gap);
5
+ margin: var(--btn-gap) 0;
6
+ width: 100%;
7
+ }
8
+
9
+ .grid1 {
10
+ grid-template-columns: 1fr;
11
+ }
12
+
13
+ .grid2 {
14
+ grid-template-columns: repeat(2, 1fr);
15
+ }
16
+
17
+ .grid1 > button,
18
+ .grid2 > button {
19
+ width: 100%;
20
+ }
@@ -0,0 +1,10 @@
1
+ hr {
2
+ border: none;
3
+ border-top: 1px solid var(--color-text);
4
+ opacity: 0.1;
5
+ margin-block: var(--gap);
6
+
7
+ &.thick {
8
+ opacity: 0.2;
9
+ }
10
+ }
@@ -2,3 +2,4 @@ import type { Language } from '@versatiles/style';
2
2
  export declare function getCountryName(): string | null;
3
3
  export declare function getCountryCode(): string | null;
4
4
  export declare function getLanguage(): Language;
5
+ export declare function getCountryBoundingBox(): [number, number, number, number] | null;