@arenarium/maps 1.0.6 → 1.0.8

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 CHANGED
@@ -1,58 +1,61 @@
1
- # Svelte library
1
+ # Arenarium Maps
2
2
 
3
- Everything you need to build a Svelte library, powered by [`sv`](https://npmjs.com/package/sv).
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
- # create a new project in the current directory
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
- ## Developing
20
-
21
- Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
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
- Everything inside `src/lib` is part of your library, everything inside `src/routes` can be used as a showcase or preview app.
31
-
32
- ## Building
33
-
34
- To build your library:
35
-
36
- ```bash
37
- npm run package
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
- To create a production version of your showcase app:
41
-
42
- ```bash
43
- npm run build
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
- You can preview the production build with `npm run preview`.
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
- ## Publishing
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
@@ -3,10 +3,7 @@
3
3
  import { z } from 'zod';
4
4
 
5
5
  declare const mapOptionsSchema: z.ZodObject<{
6
- container: z.ZodUnion<[
7
- z.ZodString,
8
- z.ZodType<HTMLElement, z.ZodTypeDef, HTMLElement>
9
- ]>;
6
+ container: z.ZodString;
10
7
  position: z.ZodObject<{
11
8
  center: z.ZodObject<{
12
9
  lat: z.ZodNumber;
@@ -37,7 +34,7 @@ declare const mapOptionsSchema: z.ZodObject<{
37
34
  z.ZodLiteral<"light">
38
35
  ]>;
39
36
  }, "strip", z.ZodTypeAny, {
40
- container: string | HTMLElement;
37
+ container: string;
41
38
  position: {
42
39
  center: {
43
40
  lat: number;
@@ -47,7 +44,7 @@ declare const mapOptionsSchema: z.ZodObject<{
47
44
  };
48
45
  theme: "dark" | "light";
49
46
  }, {
50
- container: string | HTMLElement;
47
+ container: string;
51
48
  position: {
52
49
  center: {
53
50
  lat: number;
@@ -58,7 +55,11 @@ declare const mapOptionsSchema: z.ZodObject<{
58
55
  theme: "dark" | "light";
59
56
  }>;
60
57
  export type MapOptions = z.infer<typeof mapOptionsSchema>;
61
- export declare function mountMap(options: MapOptions): void;
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;
62
63
 
63
64
  export as namespace arenarium;
64
65