@mapcreator/sdk 0.0.0-opacity.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 (70) hide show
  1. package/README.md +29 -0
  2. package/dist/HighlightManager.d.ts +23 -0
  3. package/dist/MCMap.d.ts +26 -0
  4. package/dist/PopupManager.d.ts +44 -0
  5. package/dist/Registry.d.ts +23 -0
  6. package/dist/Video.d.ts +42 -0
  7. package/dist/adornments/categoricalLegend.d.ts +2 -0
  8. package/dist/adornments/connectedLegend.d.ts +3 -0
  9. package/dist/adornments/copyright.d.ts +3 -0
  10. package/dist/adornments/customAdornment.d.ts +2 -0
  11. package/dist/adornments/heading.d.ts +2 -0
  12. package/dist/adornments/insetMap.d.ts +3 -0
  13. package/dist/adornments/manualLegend.d.ts +2 -0
  14. package/dist/adornments/northArrow.d.ts +3 -0
  15. package/dist/adornments/scalebar.d.ts +3 -0
  16. package/dist/constants/index.d.ts +18 -0
  17. package/dist/controls/controls.d.ts +7 -0
  18. package/dist/controls/fullscreenControls.d.ts +2 -0
  19. package/dist/controls/geocoderControl.d.ts +33 -0
  20. package/dist/controls/geolocationControls.d.ts +2 -0
  21. package/dist/controls/refreshMapControls.d.ts +3 -0
  22. package/dist/controls/webControls.d.ts +4 -0
  23. package/dist/controls/zoomControls.d.ts +3 -0
  24. package/dist/favicon-32x32.png +0 -0
  25. package/dist/i18n.d.ts +56 -0
  26. package/dist/index.d.ts +4 -0
  27. package/dist/initMap.d.ts +9 -0
  28. package/dist/locales/da_DK/strings.json.d.ts +10 -0
  29. package/dist/locales/de_DE/strings.json.d.ts +10 -0
  30. package/dist/locales/en_GB/strings.json.d.ts +10 -0
  31. package/dist/locales/es_ES/strings.json.d.ts +10 -0
  32. package/dist/locales/fr_FR/strings.json.d.ts +10 -0
  33. package/dist/locales/it_IT/strings.json.d.ts +10 -0
  34. package/dist/locales/nl_NL/strings.json.d.ts +10 -0
  35. package/dist/mapcreator-sdk.css +2 -0
  36. package/dist/mapcreator-sdk.js +40511 -0
  37. package/dist/mapcreator-sdk.umd.cjs +1178 -0
  38. package/dist/models/area.d.ts +5 -0
  39. package/dist/models/circle.d.ts +7 -0
  40. package/dist/models/dot.d.ts +3 -0
  41. package/dist/models/line.d.ts +6 -0
  42. package/dist/models/marker.d.ts +7 -0
  43. package/dist/models/polygon.d.ts +5 -0
  44. package/dist/renderAdornments.d.ts +4 -0
  45. package/dist/report.html +4950 -0
  46. package/dist/types/geometry.d.ts +10 -0
  47. package/dist/types/index.d.ts +28 -0
  48. package/dist/types/jobObject.d.ts +515 -0
  49. package/dist/types/mapstyle.d.ts +62 -0
  50. package/dist/types/video.d.ts +13 -0
  51. package/dist/utils/browser.d.ts +2 -0
  52. package/dist/utils/choropleth.d.ts +12 -0
  53. package/dist/utils/fullscreen.d.ts +4 -0
  54. package/dist/utils/geolocation.d.ts +6 -0
  55. package/dist/utils/graphhopper.d.ts +6 -0
  56. package/dist/utils/helpers.d.ts +30 -0
  57. package/dist/utils/language.d.ts +19 -0
  58. package/dist/utils/lineSlicer.d.ts +9 -0
  59. package/dist/utils/models.d.ts +16 -0
  60. package/dist/utils/overlays.d.ts +4 -0
  61. package/dist/utils/scalebar.d.ts +2 -0
  62. package/dist/utils/svgHelpers.d.ts +91 -0
  63. package/dist/utils/template.d.ts +5 -0
  64. package/dist/utils/video/animations.d.ts +4 -0
  65. package/dist/utils/video/cameraCurve.d.ts +39 -0
  66. package/dist/utils/video/easings.d.ts +31 -0
  67. package/dist/utils/video/index.d.ts +11 -0
  68. package/dist/utils/video/monotonicCurve.d.ts +23 -0
  69. package/dist/utils/youtube.d.ts +4 -0
  70. package/package.json +78 -0
package/README.md ADDED
@@ -0,0 +1,29 @@
1
+ [Mapcreator](https://mapcreator.io/) JavaScript SDK. Renders Mapcreator projects on a [MapLibre](https://maplibre.org/) interactive map.
2
+
3
+ ## Installation
4
+
5
+ ```
6
+ npm i --save @mapcreator/sdk
7
+ ```
8
+
9
+ ## Usage
10
+
11
+ ```javascript
12
+ // Import scripts
13
+ import { initMap } from '@mapcreator/sdk';
14
+
15
+ // Import styles
16
+ import '@mapcreator/sdk/dist/mapcreator-sdk.css';
17
+
18
+ // Initialize the map
19
+ const { map } = await initMap({
20
+ container: '<map container element or its id>',
21
+ job: '<interactive map id>',
22
+ accessToken: '<mapcreator access token>',
23
+ });
24
+
25
+ // map is now an instance of MapLibre GL JS:
26
+ //
27
+ // map.setZoom(10);
28
+ // map.getZoom();
29
+ ```
@@ -0,0 +1,23 @@
1
+ import { Map } from '@mapcreator/maplibre-gl';
2
+ import { PopupElement } from './Registry';
3
+ export declare class HighlightManager {
4
+ private map;
5
+ private popupElements;
6
+ private markerLayerIds;
7
+ private resizeObserver?;
8
+ constructor(map: Map, popupElements: PopupElement[]);
9
+ highlight(popupElement: PopupElement | undefined): void;
10
+ private deselect;
11
+ private highlightGroupedMarker;
12
+ private fadeOtherMarkers;
13
+ private repositionMap;
14
+ private getElementBounds;
15
+ private flattenCoordinates;
16
+ private panToElement;
17
+ private visibleOnGlobe;
18
+ private lngLatToUnitVector;
19
+ private rotateVectorAroundAxis;
20
+ private rotateAroundZ;
21
+ private cross;
22
+ private normalize;
23
+ }
@@ -0,0 +1,26 @@
1
+ import { Evented, Map as MapLibre, StyleSpecification } from '@mapcreator/maplibre-gl';
2
+ import { JobObject } from './types/jobObject';
3
+ import { SvgCache } from './utils/svgHelpers';
4
+ import { LayerInfo, Svgs } from './types';
5
+ type SdkEventType = {
6
+ playstart: VideoEvent;
7
+ playend: VideoEvent;
8
+ play: VideoEvent;
9
+ };
10
+ type VideoEvent = {
11
+ time: number;
12
+ };
13
+ export declare class MCMap extends Evented {
14
+ map: MapLibre;
15
+ private video;
16
+ constructor(map: MapLibre, jobObject: JobObject, svgs: Svgs, svgCache: SvgCache, mapstyle: StyleSpecification, overlays: Map<number, StyleSpecification>, layerInfo: LayerInfo);
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
+ play(): void;
22
+ pause(): void;
23
+ seekTo(time: number): void;
24
+ frames(): AsyncGenerator<ImageData, void, void>;
25
+ }
26
+ export {};
@@ -0,0 +1,44 @@
1
+ import { Map as MapLibre, MapGeoJSONFeature, MapLayerMouseEvent, LngLatLike } from '@mapcreator/maplibre-gl';
2
+ import { JobObject, PopupPosition } from './types/jobObject';
3
+ import { PopupElement } from './Registry';
4
+ import { Mode } from './types';
5
+ export declare class PopupManager {
6
+ private map;
7
+ private popupPosition;
8
+ private mapContainer;
9
+ private popupContainer;
10
+ private feature;
11
+ private currentFeatureId;
12
+ private currentModelId;
13
+ private popupElements;
14
+ private language;
15
+ private promoteIdCache;
16
+ private publication;
17
+ private floatingPopup;
18
+ private registry;
19
+ private highlightManager;
20
+ private mode;
21
+ private restrictMapMovement;
22
+ private center;
23
+ constructor(map: MapLibre, mode: Mode);
24
+ setJobObject(jobObject: JobObject): void;
25
+ setParams(popupPosition: PopupPosition, language: string, restrictMapMovement: boolean, center: LngLatLike): void;
26
+ setPublication(publication: string | undefined): void;
27
+ setpopupElements(): void;
28
+ setHighlightManager(): void;
29
+ private onMouseMove;
30
+ private onClick;
31
+ getPopupElementFromFeature(feature: MapGeoJSONFeature): PopupElement | undefined;
32
+ getInteractiveFeature(e: MapLayerMouseEvent): MapGeoJSONFeature | undefined;
33
+ private addPopup;
34
+ private addFloatingPopup;
35
+ private getAnchor;
36
+ private hidePopup;
37
+ private getTemplate;
38
+ private htmlToElement;
39
+ private addPopupControls;
40
+ private fillDatalayerTemplate;
41
+ private getProperty;
42
+ private getVectorProperty;
43
+ private cyclePopups;
44
+ }
@@ -0,0 +1,23 @@
1
+ import { Position } from './types/geometry';
2
+ import { JobObject, JobObjectArea, JobObjectCircle, JobObjectDot, JobObjectLine, JobObjectMarker, JobObjectPolygon, PopupMedia, JobObjectDataBindings } from './types/jobObject';
3
+ import { LngLat, MapGeoJSONFeature } from '@mapcreator/maplibre-gl';
4
+ type Model = JobObjectArea | JobObjectCircle | JobObjectDot | JobObjectLine | JobObjectMarker | JobObjectPolygon;
5
+ export type PopupElement = {
6
+ groupId: string;
7
+ modelId: string;
8
+ popup: string;
9
+ lngLat?: LngLat;
10
+ center?: LngLat;
11
+ radius?: number;
12
+ anchorPoints?: Position[][] | Position[];
13
+ popupMedia: PopupMedia;
14
+ dataBindings: JobObjectDataBindings;
15
+ };
16
+ export declare class Registry {
17
+ private data;
18
+ private customGroupIds;
19
+ constructor(jobObject: JobObject);
20
+ getModel(feature: MapGeoJSONFeature): Model | undefined;
21
+ getPopupElements(): PopupElement[];
22
+ }
23
+ export {};
@@ -0,0 +1,42 @@
1
+ import { JobObject } from './types/jobObject';
2
+ import { SvgCache } from './utils/svgHelpers';
3
+ import { LayerInfo, Svgs } from './types';
4
+ import { MCMap } from './MCMap';
5
+ import { StyleSpecification } from '@mapcreator/maplibre-gl';
6
+ export declare class Video {
7
+ private mcMap;
8
+ private cameraCurve;
9
+ private jobObject;
10
+ private svgs;
11
+ private svgCache;
12
+ private duration;
13
+ private mapstyle;
14
+ private overlays;
15
+ private layerInfo;
16
+ private playhead;
17
+ private playbackContext;
18
+ constructor(mcMap: MCMap, jobObject: JobObject, svgs: Svgs, svgCache: SvgCache, mapstyle: StyleSpecification, overlays: Map<number, StyleSpecification>, layerInfo: LayerInfo);
19
+ play(): void;
20
+ pause(): void;
21
+ seekTo(time: number): void;
22
+ frames(): AsyncGenerator<ImageData, void, void>;
23
+ private captureFrame;
24
+ private drawAdornments;
25
+ private playFrame;
26
+ private setCamera;
27
+ private applyAnimations;
28
+ /**
29
+ * Prepares map for any change during playback (camera movement or animation update):
30
+ *
31
+ * 1. Disables center clamping to ground for manual elevation control
32
+ * 2. Disables paint property transitions
33
+ *
34
+ * Initial state is restored 300ms later
35
+ */
36
+ private prepareForPlayback;
37
+ private restoreAfterPlayback;
38
+ private getGroupAnimations;
39
+ private getLayerOpacity;
40
+ private setLayerOpacity;
41
+ private resetLayerOpacity;
42
+ }
@@ -0,0 +1,2 @@
1
+ import { JobObjectManualLegend } from '../types/jobObject';
2
+ export declare function getCategoricalLegendSvg(legend: JobObjectManualLegend, defaultFont: string, mapScale: number): string;
@@ -0,0 +1,3 @@
1
+ import { Map as MapLibre } from '@mapcreator/maplibre-gl';
2
+ import { JobObject, JobObjectConnectedLegend } from '../types/jobObject';
3
+ export declare function useConnectedLegend(legend: JobObjectConnectedLegend, jobObject: JobObject, map: MapLibre, vapiUrl: string, accessToken: string, mapScale: number): HTMLElement;
@@ -0,0 +1,3 @@
1
+ import { Map } from '@mapcreator/maplibre-gl';
2
+ import { JobObjectCopyright } from '../types/jobObject';
3
+ export declare function useCopyright(copyright: JobObjectCopyright, map: Map, mapScale: number): HTMLElement;
@@ -0,0 +1,2 @@
1
+ import { JobObjectCustomAdornment } from '../types/jobObject';
2
+ export declare function useCustomAdornment(adornment: JobObjectCustomAdornment, mapScale: number): HTMLElement;
@@ -0,0 +1,2 @@
1
+ import { JobObjectHeading } from '../types/jobObject';
2
+ export declare function useHeading(heading: JobObjectHeading, vapiUrl: string, accessToken: string, mapScale: number): HTMLElement;
@@ -0,0 +1,3 @@
1
+ import { Map } from '@mapcreator/maplibre-gl';
2
+ import { JobObjectInsetMap } from '../types/jobObject';
3
+ export declare function useInsetMap(insetMap: JobObjectInsetMap, map: Map, cdnUrl: string, mapScale: number): HTMLElement;
@@ -0,0 +1,2 @@
1
+ import { JobObjectManualLegend } from '../types/jobObject';
2
+ export declare function useManualLegend(legend: JobObjectManualLegend, vapiUrl: string, accessToken: string, mapScale: number): HTMLElement;
@@ -0,0 +1,3 @@
1
+ import { Map } from '@mapcreator/maplibre-gl';
2
+ import { JobObjectNorthArrow } from '../types/jobObject';
3
+ export declare function useNorthArrow(northArrow: JobObjectNorthArrow, map: Map, mapScale: number): HTMLElement;
@@ -0,0 +1,3 @@
1
+ import { Map } from '@mapcreator/maplibre-gl';
2
+ import { JobObjectScalebar } from '../types/jobObject';
3
+ export declare function useScalebar(scalebar: JobObjectScalebar, map: Map, mapScale: number): HTMLElement;
@@ -0,0 +1,18 @@
1
+ import { AdornmentPosition, PositionOffsets } from '../types/jobObject';
2
+ import { SkySpecification, StyleLayer } from '@mapcreator/maplibre-gl';
3
+ export declare const defaultSky: SkySpecification;
4
+ type PositionConfig = {
5
+ x: 'left' | 'right' | 'center';
6
+ y: 'top' | 'bottom' | 'center';
7
+ };
8
+ export declare const defaultPositionOffsets: PositionOffsets;
9
+ export declare const positionConfig: {
10
+ [position in AdornmentPosition]: PositionConfig;
11
+ };
12
+ export declare const defaultFov = 36.87;
13
+ type OpacityConfig = {
14
+ props: string[];
15
+ defaultValue: number;
16
+ };
17
+ export declare const opacityConfigByType: Partial<Record<StyleLayer['type'], OpacityConfig>>;
18
+ export {};
@@ -0,0 +1,7 @@
1
+ export interface ButtonControl {
2
+ type: 'button';
3
+ className: string;
4
+ content: string;
5
+ onClick: () => void;
6
+ }
7
+ export declare function useButtonControl(props: ButtonControl): HTMLElement;
@@ -0,0 +1,2 @@
1
+ import { Map } from '@mapcreator/maplibre-gl';
2
+ export declare function useFullScreenButton(map: Map): HTMLElement;
@@ -0,0 +1,33 @@
1
+ import { Map } from '@mapcreator/maplibre-gl';
2
+ export declare class GeocoderControl {
3
+ private map;
4
+ private mapContainer;
5
+ private container;
6
+ private control;
7
+ private input;
8
+ private dropdown;
9
+ private inputWrapper;
10
+ private button;
11
+ private isOpen;
12
+ private geocoder;
13
+ private suggestions;
14
+ private items;
15
+ private index;
16
+ private debounce?;
17
+ constructor(map: Map);
18
+ init(): HTMLElement;
19
+ private clickOutside;
20
+ private setMaxSizes;
21
+ private toggle;
22
+ private hide;
23
+ private clearDropdown;
24
+ private clearAll;
25
+ private updateVisibility;
26
+ private onInput;
27
+ private renderSuggestions;
28
+ private updateHighlight;
29
+ private onKeyDown;
30
+ private onMouseMove;
31
+ private goToSelection;
32
+ private adjustScroll;
33
+ }
@@ -0,0 +1,2 @@
1
+ import { Map } from '@mapcreator/maplibre-gl';
2
+ export declare function useGeolocationButton(map: Map): HTMLElement;
@@ -0,0 +1,3 @@
1
+ import { InitialPositionInfo } from '../types';
2
+ import { Map } from '@mapcreator/maplibre-gl';
3
+ export declare function useRefreshButton(map: Map, initialPosition: InitialPositionInfo): HTMLElement;
@@ -0,0 +1,4 @@
1
+ import { JobObjectWebControls } from '../types/jobObject';
2
+ import { InitialPositionInfo } from '../types';
3
+ import { Map } from '@mapcreator/maplibre-gl';
4
+ export declare function useWebControls(webControls: JobObjectWebControls, map: Map, initialPosition: InitialPositionInfo): HTMLElement;
@@ -0,0 +1,3 @@
1
+ import { Map } from '@mapcreator/maplibre-gl';
2
+ export declare function useZoomInButton(map: Map): HTMLElement;
3
+ export declare function useZoomOutButton(map: Map): HTMLElement;
Binary file
package/dist/i18n.d.ts ADDED
@@ -0,0 +1,56 @@
1
+ declare const locales: {
2
+ da_DK: {
3
+ search: string;
4
+ videoAlert: string;
5
+ mobileHelpText: string;
6
+ windowsHelpText: string;
7
+ macHelpText: string;
8
+ };
9
+ de_DE: {
10
+ search: string;
11
+ videoAlert: string;
12
+ mobileHelpText: string;
13
+ windowsHelpText: string;
14
+ macHelpText: string;
15
+ };
16
+ en_GB: {
17
+ search: string;
18
+ videoAlert: string;
19
+ mobileHelpText: string;
20
+ windowsHelpText: string;
21
+ macHelpText: string;
22
+ };
23
+ es_ES: {
24
+ search: string;
25
+ videoAlert: string;
26
+ mobileHelpText: string;
27
+ windowsHelpText: string;
28
+ macHelpText: string;
29
+ };
30
+ fr_FR: {
31
+ search: string;
32
+ videoAlert: string;
33
+ mobileHelpText: string;
34
+ windowsHelpText: string;
35
+ macHelpText: string;
36
+ };
37
+ it_IT: {
38
+ search: string;
39
+ videoAlert: string;
40
+ mobileHelpText: string;
41
+ windowsHelpText: string;
42
+ macHelpText: string;
43
+ };
44
+ nl_NL: {
45
+ search: string;
46
+ videoAlert: string;
47
+ mobileHelpText: string;
48
+ windowsHelpText: string;
49
+ macHelpText: string;
50
+ };
51
+ };
52
+ type Locale = keyof typeof locales;
53
+ type Key = keyof typeof locales.en_GB;
54
+ export declare const locale: Locale;
55
+ export declare function t(key: Key): string;
56
+ export {};
@@ -0,0 +1,4 @@
1
+ import { setRTLTextPlugin } from '@mapcreator/maplibre-gl';
2
+ import { initMap } from './initMap';
3
+ import { MCMap } from './MCMap';
4
+ export { setRTLTextPlugin, initMap, type MCMap };
@@ -0,0 +1,9 @@
1
+ import { MCMap } from './MCMap';
2
+ import { Env, JobObjectAugmented, Mode } from './types';
3
+ export declare function initMap(options: {
4
+ container: HTMLElement | string;
5
+ job: JobObjectAugmented | string;
6
+ accessToken: string;
7
+ mode?: Mode | undefined;
8
+ env?: Env | undefined;
9
+ }): Promise<MCMap>;
@@ -0,0 +1,10 @@
1
+ declare const _default: {
2
+ "search": "Search",
3
+ "videoAlert": "The video will only work when you publish the map",
4
+ "mobileHelpText": "Use two fingers to move the map",
5
+ "windowsHelpText": "Use Ctrl + scroll to zoom the map",
6
+ "macHelpText": "Use ⌘ + scroll to zoom the map"
7
+ }
8
+ ;
9
+
10
+ export default _default;
@@ -0,0 +1,10 @@
1
+ declare const _default: {
2
+ "search": "Suche",
3
+ "videoAlert": "Das Video ist in der veröffentlichten Karte sichtbar.",
4
+ "mobileHelpText": "Verwenden Sie zwei Finger um die Karte zu bewegen",
5
+ "windowsHelpText": "Verwenden Sie Strg + Scroll um in der Karte zu zoomen",
6
+ "macHelpText": "Verwenden Sie ⌘ + Scroll um in der Karte zu zoomen"
7
+ }
8
+ ;
9
+
10
+ export default _default;
@@ -0,0 +1,10 @@
1
+ declare const _default: {
2
+ "search": "Search",
3
+ "videoAlert": "The video will only work when you publish the map",
4
+ "mobileHelpText": "Use two fingers to move the map",
5
+ "windowsHelpText": "Use Ctrl + scroll to zoom the map",
6
+ "macHelpText": "Use ⌘ + scroll to zoom the map"
7
+ }
8
+ ;
9
+
10
+ export default _default;
@@ -0,0 +1,10 @@
1
+ declare const _default: {
2
+ "search": "Buscar",
3
+ "videoAlert": "The video will only work when you publish the map",
4
+ "mobileHelpText": "Use dos dedos para mover el mapa",
5
+ "windowsHelpText": "Use Ctrl + desplazamiento para hacer zoom en el mapa",
6
+ "macHelpText": "Use ⌘ + desplazamiento para hacer zoom en el mapa"
7
+ }
8
+ ;
9
+
10
+ export default _default;
@@ -0,0 +1,10 @@
1
+ declare const _default: {
2
+ "search": "Rechercher",
3
+ "videoAlert": "Votre vidéo sera diffusée sur la carte publiée",
4
+ "mobileHelpText": "Utilisez deux doigts pour déplacer la carte",
5
+ "windowsHelpText": "Utilisez Ctrl + défilement pour zoomer sur la carte",
6
+ "macHelpText": "Utilisez ⌘ + défilement pour zoomer sur la carte"
7
+ }
8
+ ;
9
+
10
+ export default _default;
@@ -0,0 +1,10 @@
1
+ declare const _default: {
2
+ "search": "Cercare",
3
+ "videoAlert": "The video will only work when you publish the map",
4
+ "mobileHelpText": "Usa due dita per muovere la mappa",
5
+ "windowsHelpText": "Usa Ctrl + Scroll per ingrandire la mappa",
6
+ "macHelpText": "Usa ⌘ + Scroll per ingrandire la mappa"
7
+ }
8
+ ;
9
+
10
+ export default _default;
@@ -0,0 +1,10 @@
1
+ declare const _default: {
2
+ "search": "Zoeken",
3
+ "videoAlert": "The video will only work when you publish the map",
4
+ "mobileHelpText": "Gebruik twee vingers om de kaart te bewegen",
5
+ "windowsHelpText": "Gebruik Ctrl + Scroll om de kaart te zoomen",
6
+ "macHelpText": "Gebruik ⌘ + Scroll om de kaart te zoomen"
7
+ }
8
+ ;
9
+
10
+ export default _default;