@mapcreator/sdk 2.0.1 → 3.0.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/README.md +26 -6
- package/dist/MCMap.d.ts +2 -14
- package/dist/constants/index.d.ts +2 -2
- package/dist/events.d.ts +12 -0
- package/dist/index.bundler.d.ts +1 -0
- package/dist/index.d.ts +1 -2
- package/dist/mapcreator-sdk-worker.mjs +10 -0
- package/dist/mapcreator-sdk.bundler.mjs +5809 -0
- package/dist/mapcreator-sdk.css +1 -1
- package/dist/mapcreator-sdk.mjs +542 -0
- package/dist/maplibre-gl-shared.mjs +6 -0
- package/dist/maplibre-gl-worker.mjs +6 -0
- package/dist/maplibre-gl.mjs +819 -0
- package/package.json +14 -13
- package/dist/mapcreator-sdk.js +0 -41109
- package/dist/mapcreator-sdk.umd.cjs +0 -1227
- package/dist/report.html +0 -4950
package/README.md
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
[Mapcreator](https://mapcreator.io/) JavaScript SDK. Renders Mapcreator projects on a [MapLibre](https://maplibre.org/) interactive map.
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Usage with a bundler
|
|
4
4
|
|
|
5
5
|
```
|
|
6
6
|
npm i --save @mapcreator/sdk
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
## Usage
|
|
10
|
-
|
|
11
9
|
```javascript
|
|
12
|
-
// Import scripts
|
|
13
|
-
import { initMap } from '@mapcreator/sdk';
|
|
14
|
-
|
|
15
10
|
// Import styles
|
|
16
11
|
import '@mapcreator/sdk/dist/mapcreator-sdk.css';
|
|
17
12
|
|
|
13
|
+
// Import scripts
|
|
14
|
+
import { initMap } from '@mapcreator/sdk';
|
|
15
|
+
|
|
18
16
|
// Initialize the map
|
|
19
17
|
const { map } = await initMap({
|
|
20
18
|
container: '<map container element or its id>',
|
|
@@ -27,3 +25,25 @@ const { map } = await initMap({
|
|
|
27
25
|
// map.setZoom(10);
|
|
28
26
|
// map.getZoom();
|
|
29
27
|
```
|
|
28
|
+
|
|
29
|
+
## Usage in the browser
|
|
30
|
+
|
|
31
|
+
```html
|
|
32
|
+
<link rel="stylesheet" href="https://unpkg.com/@mapcreator/sdk@^3.0.0/dist/mapcreator-sdk.css" />
|
|
33
|
+
<div id="map" style="height: 400px"></div>
|
|
34
|
+
|
|
35
|
+
<script type="module">
|
|
36
|
+
import { initMap } from 'https://unpkg.com/@mapcreator/sdk@^3.0.0/dist/mapcreator-sdk.mjs';
|
|
37
|
+
|
|
38
|
+
const { map } = await initMap({
|
|
39
|
+
container: 'map',
|
|
40
|
+
job: '<interactive map id>',
|
|
41
|
+
accessToken: '<mapcreator access token>',
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// map is now an instance of MapLibre GL JS:
|
|
45
|
+
//
|
|
46
|
+
// map.setZoom(10);
|
|
47
|
+
// map.getZoom();
|
|
48
|
+
</script>
|
|
49
|
+
```
|
package/dist/MCMap.d.ts
CHANGED
|
@@ -2,22 +2,11 @@ import { Evented, Map as MapLibre, StyleSpecification } from '@mapcreator/maplib
|
|
|
2
2
|
import { ExportType, LayerInfo, Svgs } from './types';
|
|
3
3
|
import { JobObject } from './types/jobObject';
|
|
4
4
|
import { SvgCache } from './utils/svgHelpers';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
playend: VideoEvent;
|
|
8
|
-
play: VideoEvent;
|
|
9
|
-
};
|
|
10
|
-
type VideoEvent = {
|
|
11
|
-
time: number;
|
|
12
|
-
};
|
|
13
|
-
export declare class MCMap extends Evented {
|
|
5
|
+
import { SdkEventType } from './events';
|
|
6
|
+
export declare class MCMap extends Evented<SdkEventType> {
|
|
14
7
|
map: MapLibre;
|
|
15
8
|
private video;
|
|
16
9
|
constructor(map: MapLibre, exportType: ExportType, jobObject: JobObject, svgs: Svgs, svgCache: SvgCache, mapstyle: StyleSpecification, overlays: Map<number, StyleSpecification>, layerInfo: LayerInfo, backgroundColor: string);
|
|
17
|
-
on<T extends keyof SdkEventType>(type: T, listener: (e: SdkEventType[T]) => void): import('@mapcreator/maplibre-gl').Subscription;
|
|
18
|
-
once<T extends keyof SdkEventType>(type: T, listener: (e: SdkEventType[T]) => void): Promise<any> | this;
|
|
19
|
-
off<T extends keyof SdkEventType>(type: T, listener: (e: SdkEventType[T]) => void): this;
|
|
20
|
-
fire<T extends keyof SdkEventType>(type: T, payload: SdkEventType[T]): this;
|
|
21
10
|
play(): void;
|
|
22
11
|
pause(): void;
|
|
23
12
|
seekTo(time: number): void;
|
|
@@ -25,4 +14,3 @@ export declare class MCMap extends Evented {
|
|
|
25
14
|
preload(): Promise<void>;
|
|
26
15
|
remove(): void;
|
|
27
16
|
}
|
|
28
|
-
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PositionOffsets, AdornmentPosition, JobObjectSlotName } from '../types/jobObject';
|
|
2
|
-
import { SkySpecification, StyleLayer } from '@mapcreator/maplibre-gl';
|
|
2
|
+
import { AllPaintProperties, SkySpecification, StyleLayer } from '@mapcreator/maplibre-gl';
|
|
3
3
|
export declare const defaultSky: SkySpecification;
|
|
4
4
|
type PositionConfig = {
|
|
5
5
|
x: 'left' | 'right' | 'center';
|
|
@@ -11,7 +11,7 @@ export declare const positionConfig: {
|
|
|
11
11
|
};
|
|
12
12
|
export declare const defaultFov = 36.87;
|
|
13
13
|
type OpacityConfig = {
|
|
14
|
-
props:
|
|
14
|
+
props: Array<keyof AllPaintProperties>;
|
|
15
15
|
defaultValue: number;
|
|
16
16
|
};
|
|
17
17
|
export declare const opacityConfigByType: Record<StyleLayer['type'], OpacityConfig>;
|
package/dist/events.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Event } from '@mapcreator/maplibre-gl';
|
|
2
|
+
type VideoEventType = 'playstart' | 'playend' | 'play';
|
|
3
|
+
export declare class VideoEvent<T extends VideoEventType = VideoEventType> extends Event<T> {
|
|
4
|
+
readonly time: number;
|
|
5
|
+
constructor(type: T, time: number);
|
|
6
|
+
}
|
|
7
|
+
export type SdkEventType = {
|
|
8
|
+
playstart: VideoEvent<'playstart'>;
|
|
9
|
+
playend: VideoEvent<'playend'>;
|
|
10
|
+
play: VideoEvent<'play'>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './index';
|
package/dist/index.d.ts
CHANGED