@arenarium/maps-integration-google 1.0.0 → 1.0.2
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.txt +1 -1
- package/dist/main.d.ts +197 -93
- package/dist/main.js +1 -0
- package/package.json +13 -17
- package/src/lib/provider.ts +67 -8
- package/tsconfig.json +1 -1
- package/tsdown.config.ts +10 -0
- package/dist/main.cjs.js +0 -1
- package/dist/main.es.js +0 -243
- package/vite.config.ts +0 -23
package/LICENSE.txt
CHANGED
package/dist/main.d.ts
CHANGED
|
@@ -1,93 +1,197 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
|
|
3
|
+
//#region ../../../2 - shared/dist/schemas-ChiG16AA.d.ts
|
|
4
|
+
|
|
5
|
+
declare const mapCoordinatesSchema: v.ObjectSchema<{
|
|
6
|
+
readonly lat: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -90, undefined>, v.MaxValueAction<number, 90, undefined>]>;
|
|
7
|
+
readonly lng: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -180, undefined>, v.MaxValueAction<number, 180, undefined>]>;
|
|
8
|
+
}, undefined>;
|
|
9
|
+
declare const mapBoundsSchema: v.ObjectSchema<{
|
|
10
|
+
readonly sw: v.ObjectSchema<{
|
|
11
|
+
readonly lat: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -90, undefined>, v.MaxValueAction<number, 90, undefined>]>;
|
|
12
|
+
readonly lng: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -180, undefined>, v.MaxValueAction<number, 180, undefined>]>;
|
|
13
|
+
}, undefined>;
|
|
14
|
+
readonly ne: v.ObjectSchema<{
|
|
15
|
+
readonly lat: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -90, undefined>, v.MaxValueAction<number, 90, undefined>]>;
|
|
16
|
+
readonly lng: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -180, undefined>, v.MaxValueAction<number, 180, undefined>]>;
|
|
17
|
+
}, undefined>;
|
|
18
|
+
}, undefined>;
|
|
19
|
+
declare const mapViewportSchema: v.ObjectSchema<{
|
|
20
|
+
readonly bounds: v.ObjectSchema<{
|
|
21
|
+
readonly sw: v.ObjectSchema<{
|
|
22
|
+
readonly lat: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -90, undefined>, v.MaxValueAction<number, 90, undefined>]>;
|
|
23
|
+
readonly lng: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -180, undefined>, v.MaxValueAction<number, 180, undefined>]>;
|
|
24
|
+
}, undefined>;
|
|
25
|
+
readonly ne: v.ObjectSchema<{
|
|
26
|
+
readonly lat: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -90, undefined>, v.MaxValueAction<number, 90, undefined>]>;
|
|
27
|
+
readonly lng: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -180, undefined>, v.MaxValueAction<number, 180, undefined>]>;
|
|
28
|
+
}, undefined>;
|
|
29
|
+
}, undefined>;
|
|
30
|
+
readonly center: v.ObjectSchema<{
|
|
31
|
+
readonly lat: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -90, undefined>, v.MaxValueAction<number, 90, undefined>]>;
|
|
32
|
+
readonly lng: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -180, undefined>, v.MaxValueAction<number, 180, undefined>]>;
|
|
33
|
+
}, undefined>;
|
|
34
|
+
readonly zoom: v.NumberSchema<undefined>;
|
|
35
|
+
}, undefined>;
|
|
36
|
+
declare const mapProviderParametersSchema: v.ObjectSchema<{
|
|
37
|
+
readonly mapSize: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>]>;
|
|
38
|
+
readonly zoomMin: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
39
|
+
readonly zoomMax: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
40
|
+
readonly zoomScale: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 10, undefined>]>;
|
|
41
|
+
}, undefined>;
|
|
42
|
+
declare const mapProviderMarkerSchema: v.ObjectSchema<{
|
|
43
|
+
readonly inserted: v.SchemaWithPipe<readonly [v.FunctionSchema<undefined>, v.ArgsAction<(...args: unknown[]) => unknown, v.TupleSchema<[], undefined>>, v.ReturnsAction<() => unknown, v.BooleanSchema<undefined>>]>;
|
|
44
|
+
readonly insert: v.SchemaWithPipe<readonly [v.FunctionSchema<undefined>, v.ArgsAction<(...args: unknown[]) => unknown, v.TupleSchema<[], undefined>>, v.ReturnsAction<() => unknown, v.VoidSchema<undefined>>]>;
|
|
45
|
+
readonly remove: v.SchemaWithPipe<readonly [v.FunctionSchema<undefined>, v.ArgsAction<(...args: unknown[]) => unknown, v.TupleSchema<[], undefined>>, v.ReturnsAction<() => unknown, v.VoidSchema<undefined>>]>;
|
|
46
|
+
readonly update: v.SchemaWithPipe<readonly [v.FunctionSchema<undefined>, v.ArgsAction<(...args: unknown[]) => unknown, v.TupleSchema<[v.NumberSchema<undefined>], undefined>>, v.ReturnsAction<(args_0: number) => unknown, v.VoidSchema<undefined>>]>;
|
|
47
|
+
}, undefined>;
|
|
48
|
+
declare const mapProviderEventSchema: v.UnionSchema<[v.LiteralSchema<"idle", undefined>, v.LiteralSchema<"move", undefined>, v.LiteralSchema<"click", undefined>], undefined>;
|
|
49
|
+
declare const mapProviderSchema: v.ObjectSchema<{
|
|
50
|
+
readonly getParameters: v.SchemaWithPipe<readonly [v.FunctionSchema<undefined>, v.ArgsAction<(...args: unknown[]) => unknown, v.TupleSchema<[], undefined>>, v.ReturnsAction<() => unknown, v.ObjectSchema<{
|
|
51
|
+
readonly mapSize: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>]>;
|
|
52
|
+
readonly zoomMin: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
53
|
+
readonly zoomMax: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
54
|
+
readonly zoomScale: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 10, undefined>]>;
|
|
55
|
+
}, undefined>>]>;
|
|
56
|
+
readonly getContainer: v.SchemaWithPipe<readonly [v.FunctionSchema<undefined>, v.ArgsAction<(...args: unknown[]) => unknown, v.TupleSchema<[], undefined>>, v.ReturnsAction<() => unknown, v.CustomSchema<HTMLElement, v.ErrorMessage<v.CustomIssue> | undefined>>]>;
|
|
57
|
+
readonly getZoom: v.SchemaWithPipe<readonly [v.FunctionSchema<undefined>, v.ArgsAction<(...args: unknown[]) => unknown, v.TupleSchema<[], undefined>>, v.ReturnsAction<() => unknown, v.NumberSchema<undefined>>]>;
|
|
58
|
+
readonly getBounds: v.SchemaWithPipe<readonly [v.FunctionSchema<undefined>, v.ArgsAction<(...args: unknown[]) => unknown, v.TupleSchema<[], undefined>>, v.ReturnsAction<() => unknown, v.ObjectSchema<{
|
|
59
|
+
readonly sw: v.ObjectSchema<{
|
|
60
|
+
readonly lat: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -90, undefined>, v.MaxValueAction<number, 90, undefined>]>;
|
|
61
|
+
readonly lng: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -180, undefined>, v.MaxValueAction<number, 180, undefined>]>;
|
|
62
|
+
}, undefined>;
|
|
63
|
+
readonly ne: v.ObjectSchema<{
|
|
64
|
+
readonly lat: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -90, undefined>, v.MaxValueAction<number, 90, undefined>]>;
|
|
65
|
+
readonly lng: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -180, undefined>, v.MaxValueAction<number, 180, undefined>]>;
|
|
66
|
+
}, undefined>;
|
|
67
|
+
}, undefined>>]>;
|
|
68
|
+
readonly getCenter: v.SchemaWithPipe<readonly [v.FunctionSchema<undefined>, v.ArgsAction<(...args: unknown[]) => unknown, v.TupleSchema<[], undefined>>, v.ReturnsAction<() => unknown, v.ObjectSchema<{
|
|
69
|
+
readonly lat: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -90, undefined>, v.MaxValueAction<number, 90, undefined>]>;
|
|
70
|
+
readonly lng: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -180, undefined>, v.MaxValueAction<number, 180, undefined>]>;
|
|
71
|
+
}, undefined>>]>;
|
|
72
|
+
readonly getViewport: v.SchemaWithPipe<readonly [v.FunctionSchema<undefined>, v.ArgsAction<(...args: unknown[]) => unknown, v.TupleSchema<[], undefined>>, v.ReturnsAction<() => unknown, v.ObjectSchema<{
|
|
73
|
+
readonly bounds: v.ObjectSchema<{
|
|
74
|
+
readonly sw: v.ObjectSchema<{
|
|
75
|
+
readonly lat: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -90, undefined>, v.MaxValueAction<number, 90, undefined>]>;
|
|
76
|
+
readonly lng: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -180, undefined>, v.MaxValueAction<number, 180, undefined>]>;
|
|
77
|
+
}, undefined>;
|
|
78
|
+
readonly ne: v.ObjectSchema<{
|
|
79
|
+
readonly lat: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -90, undefined>, v.MaxValueAction<number, 90, undefined>]>;
|
|
80
|
+
readonly lng: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -180, undefined>, v.MaxValueAction<number, 180, undefined>]>;
|
|
81
|
+
}, undefined>;
|
|
82
|
+
}, undefined>;
|
|
83
|
+
readonly center: v.ObjectSchema<{
|
|
84
|
+
readonly lat: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -90, undefined>, v.MaxValueAction<number, 90, undefined>]>;
|
|
85
|
+
readonly lng: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -180, undefined>, v.MaxValueAction<number, 180, undefined>]>;
|
|
86
|
+
}, undefined>;
|
|
87
|
+
readonly zoom: v.NumberSchema<undefined>;
|
|
88
|
+
}, undefined>>]>;
|
|
89
|
+
readonly panBy: v.SchemaWithPipe<readonly [v.FunctionSchema<undefined>, v.ArgsAction<(...args: unknown[]) => unknown, v.TupleSchema<[v.NumberSchema<undefined>, v.NumberSchema<undefined>], undefined>>, v.ReturnsAction<(args_0: number, args_1: number) => unknown, v.VoidSchema<undefined>>]>;
|
|
90
|
+
readonly createMarker: v.SchemaWithPipe<readonly [v.FunctionSchema<undefined>, v.ArgsAction<(...args: unknown[]) => unknown, v.TupleSchema<[v.CustomSchema<HTMLElement, v.ErrorMessage<v.CustomIssue> | undefined>, v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -90, undefined>, v.MaxValueAction<number, 90, undefined>]>, v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -180, undefined>, v.MaxValueAction<number, 180, undefined>]>, v.NumberSchema<undefined>], undefined>>, v.ReturnsAction<(args_0: HTMLElement, args_1: number, args_2: number, args_3: number) => unknown, v.ObjectSchema<{
|
|
91
|
+
readonly inserted: v.SchemaWithPipe<readonly [v.FunctionSchema<undefined>, v.ArgsAction<(...args: unknown[]) => unknown, v.TupleSchema<[], undefined>>, v.ReturnsAction<() => unknown, v.BooleanSchema<undefined>>]>;
|
|
92
|
+
readonly insert: v.SchemaWithPipe<readonly [v.FunctionSchema<undefined>, v.ArgsAction<(...args: unknown[]) => unknown, v.TupleSchema<[], undefined>>, v.ReturnsAction<() => unknown, v.VoidSchema<undefined>>]>;
|
|
93
|
+
readonly remove: v.SchemaWithPipe<readonly [v.FunctionSchema<undefined>, v.ArgsAction<(...args: unknown[]) => unknown, v.TupleSchema<[], undefined>>, v.ReturnsAction<() => unknown, v.VoidSchema<undefined>>]>;
|
|
94
|
+
readonly update: v.SchemaWithPipe<readonly [v.FunctionSchema<undefined>, v.ArgsAction<(...args: unknown[]) => unknown, v.TupleSchema<[v.NumberSchema<undefined>], undefined>>, v.ReturnsAction<(args_0: number) => unknown, v.VoidSchema<undefined>>]>;
|
|
95
|
+
}, undefined>>]>;
|
|
96
|
+
readonly subscribe: v.SchemaWithPipe<readonly [v.FunctionSchema<undefined>, v.ArgsAction<(...args: unknown[]) => unknown, v.TupleSchema<[v.UnionSchema<[v.LiteralSchema<"idle", undefined>, v.LiteralSchema<"move", undefined>, v.LiteralSchema<"click", undefined>], undefined>, v.FunctionSchema<undefined>], undefined>>, v.ReturnsAction<(args_0: "idle" | "move" | "click", args_1: (...args: unknown[]) => unknown) => unknown, v.VoidSchema<undefined>>]>;
|
|
97
|
+
readonly unsubscribe: v.SchemaWithPipe<readonly [v.FunctionSchema<undefined>, v.ArgsAction<(...args: unknown[]) => unknown, v.TupleSchema<[v.UnionSchema<[v.LiteralSchema<"idle", undefined>, v.LiteralSchema<"move", undefined>, v.LiteralSchema<"click", undefined>], undefined>, v.FunctionSchema<undefined>], undefined>>, v.ReturnsAction<(args_0: "idle" | "move" | "click", args_1: (...args: unknown[]) => unknown) => unknown, v.VoidSchema<undefined>>]>;
|
|
98
|
+
}, undefined>;
|
|
99
|
+
type MapCoordinates = v.InferOutput<typeof mapCoordinatesSchema>;
|
|
100
|
+
type MapBounds = v.InferOutput<typeof mapBoundsSchema>;
|
|
101
|
+
type MapViewport = v.InferOutput<typeof mapViewportSchema>;
|
|
102
|
+
type MapProviderParameters = v.InferOutput<typeof mapProviderParametersSchema>;
|
|
103
|
+
type MapProviderMarker = v.InferOutput<typeof mapProviderMarkerSchema>;
|
|
104
|
+
type MapProviderEvent = v.InferOutput<typeof mapProviderEventSchema>;
|
|
105
|
+
type MapProvider = v.InferOutput<typeof mapProviderSchema>;
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region src/lib/provider.d.ts
|
|
108
|
+
interface GoogleMapsClass {
|
|
109
|
+
new (container: HTMLElement, options: google.maps.MapOptions): google.maps.Map;
|
|
110
|
+
}
|
|
111
|
+
interface GoogleMapsMarkerClass {
|
|
112
|
+
new (options: google.maps.marker.AdvancedMarkerElementOptions): google.maps.marker.AdvancedMarkerElement;
|
|
113
|
+
}
|
|
114
|
+
interface GoogleMapsOptions extends google.maps.MapOptions {
|
|
115
|
+
attribution?: boolean;
|
|
116
|
+
}
|
|
117
|
+
declare class GoogleMapsProvider implements MapProvider {
|
|
118
|
+
private MapClass;
|
|
119
|
+
private MapMarkerClass;
|
|
120
|
+
private map;
|
|
121
|
+
private options;
|
|
122
|
+
private listeners;
|
|
123
|
+
private attributionObserver;
|
|
124
|
+
private attributionElement;
|
|
125
|
+
constructor(mapClass: GoogleMapsClass, mapMarkerClass: GoogleMapsMarkerClass, container: HTMLElement, options: GoogleMapsOptions);
|
|
126
|
+
private insertAttributionElement;
|
|
127
|
+
private updateAttributionElement;
|
|
128
|
+
getParameters(): MapProviderParameters;
|
|
129
|
+
getMap(): google.maps.Map;
|
|
130
|
+
getContainer(): HTMLElement;
|
|
131
|
+
getZoom(): number;
|
|
132
|
+
getCenter(): MapCoordinates;
|
|
133
|
+
getBounds(): MapBounds;
|
|
134
|
+
getViewport(): MapViewport;
|
|
135
|
+
panBy(x: number, y: number): undefined;
|
|
136
|
+
createMarker(element: HTMLElement, lat: number, lng: number, zIndex: number): MapProviderMarker;
|
|
137
|
+
subscribe(event: MapProviderEvent, callback: () => void): void;
|
|
138
|
+
unsubscribe(event: MapProviderEvent, callback: () => void): void;
|
|
139
|
+
}
|
|
140
|
+
//#endregion
|
|
141
|
+
//#region src/lib/styles.d.ts
|
|
142
|
+
declare const GoogleMapLightStyle: ({
|
|
143
|
+
elementType: string;
|
|
144
|
+
stylers: {
|
|
145
|
+
visibility: string;
|
|
146
|
+
}[];
|
|
147
|
+
featureType?: undefined;
|
|
148
|
+
} | {
|
|
149
|
+
stylers: ({
|
|
150
|
+
saturation: number;
|
|
151
|
+
lightness?: undefined;
|
|
152
|
+
} | {
|
|
153
|
+
lightness: number;
|
|
154
|
+
saturation?: undefined;
|
|
155
|
+
})[];
|
|
156
|
+
elementType?: undefined;
|
|
157
|
+
featureType?: undefined;
|
|
158
|
+
} | {
|
|
159
|
+
featureType: string;
|
|
160
|
+
stylers: {
|
|
161
|
+
lightness: number;
|
|
162
|
+
}[];
|
|
163
|
+
elementType?: undefined;
|
|
164
|
+
} | {
|
|
165
|
+
featureType: string;
|
|
166
|
+
elementType: string;
|
|
167
|
+
stylers: {
|
|
168
|
+
saturation: number;
|
|
169
|
+
}[];
|
|
170
|
+
})[];
|
|
171
|
+
declare const GoogleMapDarkStyle: ({
|
|
172
|
+
elementType: string;
|
|
173
|
+
stylers: {
|
|
174
|
+
visibility: string;
|
|
175
|
+
}[];
|
|
176
|
+
featureType?: undefined;
|
|
177
|
+
} | {
|
|
178
|
+
stylers: {
|
|
179
|
+
saturation: number;
|
|
180
|
+
}[];
|
|
181
|
+
elementType?: undefined;
|
|
182
|
+
featureType?: undefined;
|
|
183
|
+
} | {
|
|
184
|
+
elementType: string;
|
|
185
|
+
stylers: {
|
|
186
|
+
lightness: number;
|
|
187
|
+
}[];
|
|
188
|
+
featureType?: undefined;
|
|
189
|
+
} | {
|
|
190
|
+
featureType: string;
|
|
191
|
+
elementType: string;
|
|
192
|
+
stylers: {
|
|
193
|
+
lightness: number;
|
|
194
|
+
}[];
|
|
195
|
+
})[];
|
|
196
|
+
//#endregion
|
|
197
|
+
export { GoogleMapDarkStyle, GoogleMapLightStyle, GoogleMapsProvider };
|
package/dist/main.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=()=>`<img src="https://arenarium.dev/favicon.svg" alt="Arenarium Maps" class="arenarium-maps-attribution-image" />`,t=()=>`<a href="https://arenarium.dev" target="_blank" class="arenarium-maps-attribution-link">${e()}<span> arenarium/maps</span></a>`;var n=class{constructor(e,t,n,r){this.listeners=new Set,this.MapClass=e,this.MapMarkerClass=t,this.options=r,this.map=new this.MapClass(n,{...r}),(r.attribution||r.attribution==null)&&(this.map.addListener(`idle`,()=>{this.attributionObserver||(this.attributionObserver=new MutationObserver((e,t)=>{this.insertAttributionElement(),this.attributionElement!=null&&(this.updateAttributionElement(),t.disconnect())}),this.attributionObserver.observe(n,{childList:!0,subtree:!0}))}),this.map.addListener(`bounds_changed`,()=>{this.updateAttributionElement()}))}insertAttributionElement(){let e=this.map.getDiv();if(e==null)return;let n=e.getElementsByClassName(`gmnoprint`)[0];if(n==null||n.parentElement==null)return;let r=n.cloneNode(!0),i=r.childNodes.item(0)?.childNodes.item(1)?.childNodes.item(0);i!=null&&(i.title=``,i.innerHTML=t(),n.parentElement.insertBefore(r,n),this.attributionElement=i)}updateAttributionElement(){let e=this.map.getDiv();if(e==null)return;let t=this.attributionElement?.childNodes.item(0);if(t){t.style.height=`14px`,t.style.display=`inline-flex`,t.style.alignItems=`center`,t.style.gap=`1px`;let n=t.childNodes.item(0);n&&(n.style.height=`12px`,n.style.width=`auto`);let r=t.childNodes.item(1);r&&(r.style.display=e.clientWidth>500?`initial`:`none`,r.style.color=this.options.colorScheme==google.maps.ColorScheme.DARK?`#fff`:`#000`)}}getParameters(){return{mapSize:256,zoomMin:this.options.minZoom??0,zoomMax:this.options.maxZoom??24,zoomScale:10}}getMap(){return this.map}getContainer(){return this.map.getDiv()}getZoom(){return this.map.getZoom()??NaN}getCenter(){let e=this.map.getCenter();return e==null?{lat:NaN,lng:NaN}:{lat:e.lat(),lng:e.lng()}}getBounds(){let e=this.map.getBounds();if(e==null)return{sw:{lat:NaN,lng:NaN},ne:{lat:NaN,lng:NaN}};let t=e.getSouthWest(),n=e.getNorthEast();return{sw:{lat:t.lat(),lng:t.lng()},ne:{lat:n.lat(),lng:n.lng()}}}getViewport(){return{bounds:this.getBounds(),center:this.getCenter(),zoom:this.getZoom()}}panBy(e,t){this.map.panBy(e,t)}createMarker(e,t,n,r){let i=new this.MapMarkerClass({position:{lat:t,lng:n},content:e,zIndex:r});return{inserted:()=>i.map!=null&&i.map==this.map,insert:()=>i.map=this.map,remove:()=>i.map=void 0,update:e=>i.zIndex=e}}subscribe(e,t){let n=google.maps.event.addListener(this.map,e,t);this.listeners.add({id:n,event:e,callback:t})}unsubscribe(e,t){let n=this.listeners.values().find(n=>n.event==e&&n.callback==t);n!=null&&google.maps.event.removeListener(n.id)}};const r=[{elementType:`labels.icon`,stylers:[{visibility:`off`}]},{stylers:[{saturation:-100},{lightness:-10}]},{featureType:`landscape`,stylers:[{lightness:30}]},{featureType:`road`,elementType:`geometry`,stylers:[{saturation:-100}]}],i=[{elementType:`labels.icon`,stylers:[{visibility:`off`}]},{stylers:[{saturation:-100}]},{elementType:`geometry`,stylers:[{lightness:-45}]},{elementType:`labels.text.fill`,stylers:[{lightness:-100}]},{elementType:`labels.text.stroke`,stylers:[{lightness:-15}]},{featureType:`water`,elementType:`geometry`,stylers:[{lightness:-50}]}];export{i as GoogleMapDarkStyle,r as GoogleMapLightStyle,n as GoogleMapsProvider};
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arenarium/maps-integration-google",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"author": "arenarium
|
|
6
|
-
"description": "
|
|
5
|
+
"author": "arenarium",
|
|
6
|
+
"description": "Integration with Google Maps for @arenarium/maps.",
|
|
7
7
|
"homepage": "https://arenarium.dev",
|
|
8
8
|
"keywords": [
|
|
9
9
|
"arenarium",
|
|
@@ -12,33 +12,29 @@
|
|
|
12
12
|
"google maps"
|
|
13
13
|
],
|
|
14
14
|
"type": "module",
|
|
15
|
-
"main": "./dist/main.
|
|
16
|
-
"module": "./dist/main.
|
|
17
|
-
"svelte": "./dist/main.es.js",
|
|
15
|
+
"main": "./dist/main.js",
|
|
16
|
+
"module": "./dist/main.js",
|
|
18
17
|
"types": "./dist/main.d.ts",
|
|
19
|
-
"unpkg": "./dist/main.js",
|
|
20
|
-
"jsdelivr": "./dist/main.js",
|
|
21
18
|
"exports": {
|
|
22
19
|
".": {
|
|
23
20
|
"types": "./dist/main.d.ts",
|
|
24
|
-
"
|
|
25
|
-
"import": "./dist/main.es.js",
|
|
26
|
-
"require": "./dist/main.cjs.js"
|
|
21
|
+
"import": "./dist/main.js"
|
|
27
22
|
}
|
|
28
23
|
},
|
|
29
24
|
"devDependencies": {
|
|
30
|
-
"
|
|
31
|
-
"vite": "^7.1.7",
|
|
32
|
-
"vite-plugin-dts": "^4.5.4",
|
|
33
|
-
"@arenarium/maps": "1.2.0",
|
|
25
|
+
"tsdown": "^0.17.0",
|
|
34
26
|
"@arenarium/maps-shared": "1.0.0"
|
|
35
27
|
},
|
|
36
28
|
"peerDependencies": {
|
|
37
|
-
"@googlemaps/js-api-loader": "^
|
|
29
|
+
"@googlemaps/js-api-loader": "^2.0.2",
|
|
38
30
|
"@types/google.maps": "^3.58.1"
|
|
39
31
|
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"valibot": "^1.2.0"
|
|
34
|
+
},
|
|
40
35
|
"scripts": {
|
|
41
|
-
"lib_google_build": "
|
|
36
|
+
"lib_google_build": "tsdown --minify",
|
|
37
|
+
"lib_google_build_dev": "tsdown",
|
|
42
38
|
"lib_google_patch": "pnpm version patch --no-git-tag-version",
|
|
43
39
|
"lib_google_publish": "pnpm publish --access public"
|
|
44
40
|
}
|
package/src/lib/provider.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
import { getAttributionHtml } from '@arenarium/maps';
|
|
2
|
-
import type {
|
|
1
|
+
import { getAttributionHtml } from '@arenarium/maps-shared/manager/attribution';
|
|
2
|
+
import type {
|
|
3
|
+
MapProvider,
|
|
4
|
+
MapProviderParameters,
|
|
5
|
+
MapProviderMarker,
|
|
6
|
+
MapProviderEvent,
|
|
7
|
+
MapBounds,
|
|
8
|
+
MapViewport,
|
|
9
|
+
MapCoordinates
|
|
10
|
+
} from '@arenarium/maps-shared/schemas';
|
|
3
11
|
|
|
4
12
|
interface GoogleMapsClass {
|
|
5
13
|
new (container: HTMLElement, options: google.maps.MapOptions): google.maps.Map;
|
|
@@ -13,6 +21,12 @@ interface GoogleMapsOptions extends google.maps.MapOptions {
|
|
|
13
21
|
attribution?: boolean;
|
|
14
22
|
}
|
|
15
23
|
|
|
24
|
+
interface GoogleMapsEventListener {
|
|
25
|
+
id: google.maps.MapsEventListener;
|
|
26
|
+
event: MapProviderEvent;
|
|
27
|
+
callback: () => void;
|
|
28
|
+
}
|
|
29
|
+
|
|
16
30
|
export class GoogleMapsProvider implements MapProvider {
|
|
17
31
|
private MapClass: GoogleMapsClass;
|
|
18
32
|
private MapMarkerClass: GoogleMapsMarkerClass;
|
|
@@ -20,6 +34,8 @@ export class GoogleMapsProvider implements MapProvider {
|
|
|
20
34
|
private map: google.maps.Map;
|
|
21
35
|
private options: google.maps.MapOptions;
|
|
22
36
|
|
|
37
|
+
private listeners = new Set<GoogleMapsEventListener>();
|
|
38
|
+
|
|
23
39
|
private attributionObserver: MutationObserver | undefined;
|
|
24
40
|
private attributionElement: HTMLElement | undefined;
|
|
25
41
|
|
|
@@ -90,12 +106,29 @@ export class GoogleMapsProvider implements MapProvider {
|
|
|
90
106
|
const container = this.map.getDiv();
|
|
91
107
|
if (container == undefined) return;
|
|
92
108
|
|
|
93
|
-
// Get attribution element
|
|
94
|
-
const
|
|
95
|
-
if (
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
109
|
+
// Get attribution element
|
|
110
|
+
const attributionElementLink = this.attributionElement?.childNodes.item(0) as HTMLElement;
|
|
111
|
+
if (attributionElementLink) {
|
|
112
|
+
attributionElementLink.style.height = '14px';
|
|
113
|
+
attributionElementLink.style.display = 'inline-flex';
|
|
114
|
+
attributionElementLink.style.alignItems = 'center';
|
|
115
|
+
attributionElementLink.style.gap = '1px';
|
|
116
|
+
|
|
117
|
+
// Get attribution element image
|
|
118
|
+
const attributionElementImage = attributionElementLink.childNodes.item(0) as HTMLElement;
|
|
119
|
+
if (attributionElementImage) {
|
|
120
|
+
attributionElementImage.style.height = '12px';
|
|
121
|
+
attributionElementImage.style.width = 'auto';
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Get attribution element span
|
|
125
|
+
const attributionElementSpan = attributionElementLink.childNodes.item(1) as HTMLElement;
|
|
126
|
+
if (attributionElementSpan) {
|
|
127
|
+
// Set attribution element span display
|
|
128
|
+
attributionElementSpan.style.display = container.clientWidth > 500 ? 'initial' : 'none';
|
|
129
|
+
attributionElementSpan.style.color = this.options.colorScheme == google.maps.ColorScheme.DARK ? '#fff' : '#000';
|
|
130
|
+
}
|
|
131
|
+
}
|
|
99
132
|
}
|
|
100
133
|
|
|
101
134
|
public getParameters(): MapProviderParameters {
|
|
@@ -119,6 +152,13 @@ export class GoogleMapsProvider implements MapProvider {
|
|
|
119
152
|
return this.map.getZoom() ?? NaN;
|
|
120
153
|
}
|
|
121
154
|
|
|
155
|
+
public getCenter(): MapCoordinates {
|
|
156
|
+
const center = this.map.getCenter();
|
|
157
|
+
if (center == undefined) return { lat: NaN, lng: NaN };
|
|
158
|
+
|
|
159
|
+
return { lat: center.lat(), lng: center.lng() };
|
|
160
|
+
}
|
|
161
|
+
|
|
122
162
|
public getBounds(): MapBounds {
|
|
123
163
|
const bounds = this.map.getBounds();
|
|
124
164
|
if (bounds == undefined) return { sw: { lat: NaN, lng: NaN }, ne: { lat: NaN, lng: NaN } };
|
|
@@ -128,6 +168,14 @@ export class GoogleMapsProvider implements MapProvider {
|
|
|
128
168
|
return { sw: { lat: sw.lat(), lng: sw.lng() }, ne: { lat: ne.lat(), lng: ne.lng() } };
|
|
129
169
|
}
|
|
130
170
|
|
|
171
|
+
public getViewport(): MapViewport {
|
|
172
|
+
return {
|
|
173
|
+
bounds: this.getBounds(),
|
|
174
|
+
center: this.getCenter(),
|
|
175
|
+
zoom: this.getZoom()
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
|
|
131
179
|
public panBy(x: number, y: number): undefined {
|
|
132
180
|
this.map.panBy(x, y);
|
|
133
181
|
}
|
|
@@ -141,4 +189,15 @@ export class GoogleMapsProvider implements MapProvider {
|
|
|
141
189
|
update: (zIndex: number) => (marker.zIndex = zIndex)
|
|
142
190
|
};
|
|
143
191
|
}
|
|
192
|
+
|
|
193
|
+
public subscribe(event: MapProviderEvent, callback: () => void) {
|
|
194
|
+
const id = google.maps.event.addListener(this.map, event, callback);
|
|
195
|
+
this.listeners.add({ id, event, callback });
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
public unsubscribe(event: MapProviderEvent, callback: () => void) {
|
|
199
|
+
const listener = this.listeners.values().find((l) => l.event == event && l.callback == callback);
|
|
200
|
+
if (listener == undefined) return;
|
|
201
|
+
google.maps.event.removeListener(listener.id);
|
|
202
|
+
}
|
|
144
203
|
}
|
package/tsconfig.json
CHANGED
package/tsdown.config.ts
ADDED
package/dist/main.cjs.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d="5";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add(d);var u;(l=>{function i(e,s,t){const n=e/2,a=s/2,r=Math.sqrt(n*n+a*a),h=Math.atan(a/n)*(180/Math.PI),o=t*(Math.PI/180);return t<180?t<90?t<h?{x:0,y:r*Math.sin(o)-a}:{x:r*Math.cos(o)-n,y:0}:t<180-h?{x:r*Math.cos(o)-n,y:0}:{x:-e,y:r*Math.sin(o)-a}:t<270?t<180+h?{x:-e,y:r*Math.sin(o)-a}:{x:r*Math.cos(o)-n,y:-s}:t<360-h?{x:r*Math.cos(o)-n,y:-s}:{x:0,y:r*Math.sin(o)-a}}l.getOffsets=i})(u||(u={}));var p;(l=>{async function i(s,t){const n=await fetch(s,t);if(!n.ok)throw new Error(n.statusText);return n.json()}l.get=i;async function e(s,t,n){const a=await fetch(s,{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json",...n?.headers},...n});if(!a.ok)throw new Error(a.statusText);return a.json()}l.post=e})(p||(p={}));var m;(l=>{function i(r,h,o){return{x:s(h)*o,y:t(r)*o}}l.project=i;function e(r,h,o){return{lat:a(h/o),lng:n(r/o)}}l.unproject=e;function s(r){return(180+r)/360}function t(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function n(r){return r*360-180}function a(r){return 360/Math.PI*Math.atan(Math.exp((180-r*360)*Math.PI/180))-90}})(m||(m={}));var c;(l=>{l.COUNT=12,l.DEGREES=[0,30,60,90,120,150,180,210,240,270,300,330],l.DEGREES_DEFAULT=270})(c||(c={}));const y=()=>'<img src="https://arenarium.dev/favicon.svg" alt="Arenarium Maps" style="height: 1.25em; vertical-align: middle;" />',g=()=>`<a href="https://arenarium.dev" target="_blank" style="color: inherit;">${y()}<span> @arenarium/maps</span></a>`;class M{constructor(i,e,s,t){this.MapClass=i,this.MapMarkerClass=e,this.options=t,this.map=new this.MapClass(s,{...t}),(t.attribution||t.attribution==null)&&(this.map.addListener("idle",()=>{this.attributionObserver||(this.attributionObserver=new MutationObserver((n,a)=>{this.insertAttributionElement(),this.attributionElement!=null&&(this.updateAttributionElement(),a.disconnect())}),this.attributionObserver.observe(s,{childList:!0,subtree:!0}))}),this.map.addListener("bounds_changed",()=>{this.updateAttributionElement()}))}insertAttributionElement(){const i=this.map.getDiv();if(i==null)return;const e=i.getElementsByClassName("gmnoprint")[0];if(e==null||e.parentElement==null)return;const s=e.cloneNode(!0),t=s.childNodes.item(0)?.childNodes.item(1)?.childNodes.item(0);t!=null&&(t.title="",t.innerHTML=g(),e.parentElement.insertBefore(s,e),this.attributionElement=t)}updateAttributionElement(){const i=this.map.getDiv();if(i==null)return;const e=this.attributionElement?.childNodes.item(0)?.childNodes.item(1);e!=null&&(e.style.display=i.clientWidth>500?"initial":"none")}getParameters(){return{mapSize:256,zoomMin:this.options.minZoom??0,zoomMax:this.options.maxZoom??24,zoomScale:10}}getMap(){return this.map}getContainer(){return this.map.getDiv()}getZoom(){return this.map.getZoom()??NaN}getBounds(){const i=this.map.getBounds();if(i==null)return{sw:{lat:NaN,lng:NaN},ne:{lat:NaN,lng:NaN}};const e=i.getSouthWest(),s=i.getNorthEast();return{sw:{lat:e.lat(),lng:e.lng()},ne:{lat:s.lat(),lng:s.lng()}}}panBy(i,e){this.map.panBy(i,e)}createMarker(i,e,s,t){const n=new this.MapMarkerClass({position:{lat:e,lng:s},content:i,zIndex:t});return{inserted:()=>n.map!=null&&n.map==this.map,insert:()=>n.map=this.map,remove:()=>n.map=void 0,update:a=>n.zIndex=a}}}const f=[{elementType:"labels.icon",stylers:[{visibility:"off"}]},{stylers:[{saturation:-100},{lightness:-10}]},{featureType:"landscape",stylers:[{lightness:30}]},{featureType:"road",elementType:"geometry",stylers:[{saturation:-100}]}],b=[{elementType:"labels.icon",stylers:[{visibility:"off"}]},{stylers:[{saturation:-100}]},{elementType:"geometry",stylers:[{lightness:-45}]},{elementType:"labels.text.fill",stylers:[{lightness:-100}]},{elementType:"labels.text.stroke",stylers:[{lightness:-15}]},{featureType:"water",elementType:"geometry",stylers:[{lightness:-50}]}];exports.GoogleMapDarkStyle=b;exports.GoogleMapLightStyle=f;exports.GoogleMapsProvider=M;
|
package/dist/main.es.js
DELETED
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
typeof window < "u" && ((window.__svelte ??= {}).v ??= /* @__PURE__ */ new Set()).add("5");
|
|
2
|
-
var u;
|
|
3
|
-
((l) => {
|
|
4
|
-
function i(e, s, t) {
|
|
5
|
-
const n = e / 2, a = s / 2, r = Math.sqrt(n * n + a * a), h = Math.atan(a / n) * (180 / Math.PI), o = t * (Math.PI / 180);
|
|
6
|
-
return t < 180 ? t < 90 ? t < h ? {
|
|
7
|
-
x: 0,
|
|
8
|
-
y: r * Math.sin(o) - a
|
|
9
|
-
} : {
|
|
10
|
-
x: r * Math.cos(o) - n,
|
|
11
|
-
y: 0
|
|
12
|
-
} : t < 180 - h ? {
|
|
13
|
-
x: r * Math.cos(o) - n,
|
|
14
|
-
y: 0
|
|
15
|
-
} : {
|
|
16
|
-
x: -e,
|
|
17
|
-
y: r * Math.sin(o) - a
|
|
18
|
-
} : t < 270 ? t < 180 + h ? {
|
|
19
|
-
x: -e,
|
|
20
|
-
y: r * Math.sin(o) - a
|
|
21
|
-
} : {
|
|
22
|
-
x: r * Math.cos(o) - n,
|
|
23
|
-
y: -s
|
|
24
|
-
} : t < 360 - h ? {
|
|
25
|
-
x: r * Math.cos(o) - n,
|
|
26
|
-
y: -s
|
|
27
|
-
} : {
|
|
28
|
-
x: 0,
|
|
29
|
-
y: r * Math.sin(o) - a
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
l.getOffsets = i;
|
|
33
|
-
})(u || (u = {}));
|
|
34
|
-
var m;
|
|
35
|
-
((l) => {
|
|
36
|
-
async function i(s, t) {
|
|
37
|
-
const n = await fetch(s, t);
|
|
38
|
-
if (!n.ok) throw new Error(n.statusText);
|
|
39
|
-
return n.json();
|
|
40
|
-
}
|
|
41
|
-
l.get = i;
|
|
42
|
-
async function e(s, t, n) {
|
|
43
|
-
const a = await fetch(s, {
|
|
44
|
-
method: "POST",
|
|
45
|
-
body: JSON.stringify(t),
|
|
46
|
-
headers: {
|
|
47
|
-
"Content-Type": "application/json",
|
|
48
|
-
...n?.headers
|
|
49
|
-
},
|
|
50
|
-
...n
|
|
51
|
-
});
|
|
52
|
-
if (!a.ok) throw new Error(a.statusText);
|
|
53
|
-
return a.json();
|
|
54
|
-
}
|
|
55
|
-
l.post = e;
|
|
56
|
-
})(m || (m = {}));
|
|
57
|
-
var p;
|
|
58
|
-
((l) => {
|
|
59
|
-
function i(r, h, o) {
|
|
60
|
-
return {
|
|
61
|
-
x: s(h) * o,
|
|
62
|
-
y: t(r) * o
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
l.project = i;
|
|
66
|
-
function e(r, h, o) {
|
|
67
|
-
return {
|
|
68
|
-
lat: a(h / o),
|
|
69
|
-
lng: n(r / o)
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
l.unproject = e;
|
|
73
|
-
function s(r) {
|
|
74
|
-
return (180 + r) / 360;
|
|
75
|
-
}
|
|
76
|
-
function t(r) {
|
|
77
|
-
return (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + r * Math.PI / 360))) / 360;
|
|
78
|
-
}
|
|
79
|
-
function n(r) {
|
|
80
|
-
return r * 360 - 180;
|
|
81
|
-
}
|
|
82
|
-
function a(r) {
|
|
83
|
-
return 360 / Math.PI * Math.atan(Math.exp((180 - r * 360) * Math.PI / 180)) - 90;
|
|
84
|
-
}
|
|
85
|
-
})(p || (p = {}));
|
|
86
|
-
var c;
|
|
87
|
-
((l) => {
|
|
88
|
-
l.COUNT = 12, l.DEGREES = [0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330], l.DEGREES_DEFAULT = 270;
|
|
89
|
-
})(c || (c = {}));
|
|
90
|
-
const d = () => '<img src="https://arenarium.dev/favicon.svg" alt="Arenarium Maps" style="height: 1.25em; vertical-align: middle;" />', y = () => `<a href="https://arenarium.dev" target="_blank" style="color: inherit;">${d()}<span> @arenarium/maps</span></a>`;
|
|
91
|
-
class g {
|
|
92
|
-
constructor(i, e, s, t) {
|
|
93
|
-
this.MapClass = i, this.MapMarkerClass = e, this.options = t, this.map = new this.MapClass(s, {
|
|
94
|
-
...t
|
|
95
|
-
}), (t.attribution || t.attribution == null) && (this.map.addListener("idle", () => {
|
|
96
|
-
this.attributionObserver || (this.attributionObserver = new MutationObserver((n, a) => {
|
|
97
|
-
this.insertAttributionElement(), this.attributionElement != null && (this.updateAttributionElement(), a.disconnect());
|
|
98
|
-
}), this.attributionObserver.observe(s, { childList: !0, subtree: !0 }));
|
|
99
|
-
}), this.map.addListener("bounds_changed", () => {
|
|
100
|
-
this.updateAttributionElement();
|
|
101
|
-
}));
|
|
102
|
-
}
|
|
103
|
-
insertAttributionElement() {
|
|
104
|
-
const i = this.map.getDiv();
|
|
105
|
-
if (i == null) return;
|
|
106
|
-
const e = i.getElementsByClassName("gmnoprint")[0];
|
|
107
|
-
if (e == null || e.parentElement == null) return;
|
|
108
|
-
const s = e.cloneNode(!0), t = s.childNodes.item(0)?.childNodes.item(1)?.childNodes.item(0);
|
|
109
|
-
t != null && (t.title = "", t.innerHTML = y(), e.parentElement.insertBefore(s, e), this.attributionElement = t);
|
|
110
|
-
}
|
|
111
|
-
updateAttributionElement() {
|
|
112
|
-
const i = this.map.getDiv();
|
|
113
|
-
if (i == null) return;
|
|
114
|
-
const e = this.attributionElement?.childNodes.item(0)?.childNodes.item(1);
|
|
115
|
-
e != null && (e.style.display = i.clientWidth > 500 ? "initial" : "none");
|
|
116
|
-
}
|
|
117
|
-
getParameters() {
|
|
118
|
-
return {
|
|
119
|
-
mapSize: 256,
|
|
120
|
-
zoomMin: this.options.minZoom ?? 0,
|
|
121
|
-
zoomMax: this.options.maxZoom ?? 24,
|
|
122
|
-
zoomScale: 10
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
getMap() {
|
|
126
|
-
return this.map;
|
|
127
|
-
}
|
|
128
|
-
getContainer() {
|
|
129
|
-
return this.map.getDiv();
|
|
130
|
-
}
|
|
131
|
-
getZoom() {
|
|
132
|
-
return this.map.getZoom() ?? NaN;
|
|
133
|
-
}
|
|
134
|
-
getBounds() {
|
|
135
|
-
const i = this.map.getBounds();
|
|
136
|
-
if (i == null) return { sw: { lat: NaN, lng: NaN }, ne: { lat: NaN, lng: NaN } };
|
|
137
|
-
const e = i.getSouthWest(), s = i.getNorthEast();
|
|
138
|
-
return { sw: { lat: e.lat(), lng: e.lng() }, ne: { lat: s.lat(), lng: s.lng() } };
|
|
139
|
-
}
|
|
140
|
-
panBy(i, e) {
|
|
141
|
-
this.map.panBy(i, e);
|
|
142
|
-
}
|
|
143
|
-
createMarker(i, e, s, t) {
|
|
144
|
-
const n = new this.MapMarkerClass({ position: { lat: e, lng: s }, content: i, zIndex: t });
|
|
145
|
-
return {
|
|
146
|
-
inserted: () => n.map != null && n.map == this.map,
|
|
147
|
-
insert: () => n.map = this.map,
|
|
148
|
-
remove: () => n.map = void 0,
|
|
149
|
-
update: (a) => n.zIndex = a
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
const f = [
|
|
154
|
-
{
|
|
155
|
-
elementType: "labels.icon",
|
|
156
|
-
stylers: [
|
|
157
|
-
{
|
|
158
|
-
visibility: "off"
|
|
159
|
-
}
|
|
160
|
-
]
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
stylers: [
|
|
164
|
-
{
|
|
165
|
-
saturation: -100
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
lightness: -10
|
|
169
|
-
}
|
|
170
|
-
]
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
featureType: "landscape",
|
|
174
|
-
stylers: [
|
|
175
|
-
{
|
|
176
|
-
lightness: 30
|
|
177
|
-
}
|
|
178
|
-
]
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
featureType: "road",
|
|
182
|
-
elementType: "geometry",
|
|
183
|
-
stylers: [
|
|
184
|
-
{
|
|
185
|
-
saturation: -100
|
|
186
|
-
}
|
|
187
|
-
]
|
|
188
|
-
}
|
|
189
|
-
], M = [
|
|
190
|
-
{
|
|
191
|
-
elementType: "labels.icon",
|
|
192
|
-
stylers: [
|
|
193
|
-
{
|
|
194
|
-
visibility: "off"
|
|
195
|
-
}
|
|
196
|
-
]
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
stylers: [
|
|
200
|
-
{
|
|
201
|
-
saturation: -100
|
|
202
|
-
}
|
|
203
|
-
]
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
elementType: "geometry",
|
|
207
|
-
stylers: [
|
|
208
|
-
{
|
|
209
|
-
lightness: -45
|
|
210
|
-
}
|
|
211
|
-
]
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
elementType: "labels.text.fill",
|
|
215
|
-
stylers: [
|
|
216
|
-
{
|
|
217
|
-
lightness: -100
|
|
218
|
-
}
|
|
219
|
-
]
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
elementType: "labels.text.stroke",
|
|
223
|
-
stylers: [
|
|
224
|
-
{
|
|
225
|
-
lightness: -15
|
|
226
|
-
}
|
|
227
|
-
]
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
featureType: "water",
|
|
231
|
-
elementType: "geometry",
|
|
232
|
-
stylers: [
|
|
233
|
-
{
|
|
234
|
-
lightness: -50
|
|
235
|
-
}
|
|
236
|
-
]
|
|
237
|
-
}
|
|
238
|
-
];
|
|
239
|
-
export {
|
|
240
|
-
M as GoogleMapDarkStyle,
|
|
241
|
-
f as GoogleMapLightStyle,
|
|
242
|
-
g as GoogleMapsProvider
|
|
243
|
-
};
|
package/vite.config.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'vite';
|
|
2
|
-
import dts from 'vite-plugin-dts';
|
|
3
|
-
|
|
4
|
-
export default defineConfig({
|
|
5
|
-
plugins: [
|
|
6
|
-
dts({
|
|
7
|
-
rollupTypes: true,
|
|
8
|
-
insertTypesEntry: true,
|
|
9
|
-
entryRoot: './src',
|
|
10
|
-
copyDtsFiles: true,
|
|
11
|
-
exclude: ['**/node_modules/**']
|
|
12
|
-
})
|
|
13
|
-
],
|
|
14
|
-
build: {
|
|
15
|
-
lib: {
|
|
16
|
-
entry: './src/main.ts',
|
|
17
|
-
name: 'ArenariumMapsIntegrationGoogle',
|
|
18
|
-
formats: ['es', 'cjs'],
|
|
19
|
-
fileName: (format, entryName) => `${entryName}.${format}.js`,
|
|
20
|
-
cssFileName: 'style'
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
});
|