@arenarium/maps 1.0.7 → 1.0.9
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 +49 -46
- package/dist/index.d.ts +5 -1
- package/dist/index.js +62 -63
- package/dist/style.css +1 -1
- package/package.json +9 -7
package/README.md
CHANGED
|
@@ -1,58 +1,61 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Arenarium Maps
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Read more about creating a library [in the docs](https://svelte.dev/docs/kit/packaging).
|
|
6
|
-
|
|
7
|
-
## Creating a project
|
|
8
|
-
|
|
9
|
-
If you're seeing this, you've probably already done this step. Congrats!
|
|
3
|
+
## Installation
|
|
10
4
|
|
|
11
5
|
```bash
|
|
12
|
-
|
|
13
|
-
npx sv create
|
|
14
|
-
|
|
15
|
-
# create a new project in my-app
|
|
16
|
-
npx sv create my-app
|
|
6
|
+
npm install @arenarium/maps
|
|
17
7
|
```
|
|
18
8
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
npm run dev
|
|
25
|
-
|
|
26
|
-
# or start the server and open the app in a new browser tab
|
|
27
|
-
npm run dev -- --open
|
|
9
|
+
```script
|
|
10
|
+
<script src="https://unpkg.com/@arenarium/maps@latest/dist/index.js"></script>
|
|
11
|
+
<link href="https://unpkg.com/@arenarium/maps@latest/dist/style.css" rel="stylesheet"/>
|
|
28
12
|
```
|
|
29
13
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
```web
|
|
17
|
+
<html lang="en">
|
|
18
|
+
<head>
|
|
19
|
+
<script src="https://unpkg.com/@arenarium/maps@latest/dist/index.js"></script>
|
|
20
|
+
<link href="https://unpkg.com/@arenarium/maps@latest/dist/style.css" rel="stylesheet"/>
|
|
21
|
+
</head>
|
|
22
|
+
<body>
|
|
23
|
+
<div id="map"></div>
|
|
24
|
+
<script>
|
|
25
|
+
const map = arenarium.mountMap({
|
|
26
|
+
container: 'map',
|
|
27
|
+
position: {
|
|
28
|
+
center: { lat: 51.505, lng: -0.09 },
|
|
29
|
+
zoom: 13
|
|
30
|
+
},
|
|
31
|
+
theme: 'light'
|
|
32
|
+
});
|
|
33
|
+
</script>
|
|
34
|
+
</body>
|
|
35
|
+
</html>
|
|
38
36
|
```
|
|
39
37
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
```svelte
|
|
39
|
+
<script lang="ts">
|
|
40
|
+
import { onMount } from 'svelte';
|
|
41
|
+
|
|
42
|
+
import { mountMap } from '$lib/index.js';
|
|
43
|
+
|
|
44
|
+
onMount(() => {
|
|
45
|
+
mountMap({
|
|
46
|
+
container: 'map',
|
|
47
|
+
position: {
|
|
48
|
+
center: { lat: 51.505, lng: -0.09 },
|
|
49
|
+
zoom: 13
|
|
50
|
+
},
|
|
51
|
+
theme: 'light'
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
<div id="map"></div>
|
|
44
57
|
```
|
|
45
58
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
|
|
59
|
+
## License
|
|
49
60
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
Go into the `package.json` and give your package the desired name through the `"name"` option. Also consider adding a `"license"` field and point it to a `LICENSE` file which you can create from a template (one popular option is the [MIT license](https://opensource.org/license/mit/)).
|
|
53
|
-
|
|
54
|
-
To publish your library to [npm](https://www.npmjs.com):
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
npm publish
|
|
58
|
-
```
|
|
61
|
+
[MIT](LICENSE)
|
package/dist/index.d.ts
CHANGED
|
@@ -55,7 +55,11 @@ declare const mapOptionsSchema: z.ZodObject<{
|
|
|
55
55
|
theme: "dark" | "light";
|
|
56
56
|
}>;
|
|
57
57
|
export type MapOptions = z.infer<typeof mapOptionsSchema>;
|
|
58
|
-
export declare function mountMap(options: MapOptions):
|
|
58
|
+
export declare function mountMap(options: MapOptions): {
|
|
59
|
+
$on?(type: string, callback: (e: any) => void): () => void;
|
|
60
|
+
$set?(props: Partial<Record<string, any>>): void;
|
|
61
|
+
} & Record<string, any>;
|
|
62
|
+
export declare function unmountMap(map: ReturnType<typeof mountMap>): void;
|
|
59
63
|
|
|
60
64
|
export as namespace arenarium;
|
|
61
65
|
|