@mapcreator/sdk 0.0.0-swipe.0 → 0.0.0-uncluster.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.
@@ -26,3 +26,9 @@ export type LayerInfo = {
26
26
  opacity?: number;
27
27
  };
28
28
  };
29
+ export type Font = {
30
+ name: string;
31
+ family: string;
32
+ weight: string;
33
+ style: string;
34
+ };
@@ -31,7 +31,7 @@ export type JobObject = {
31
31
  layerInfo?: Optional<Array<{
32
32
  id: string;
33
33
  visibility: boolean;
34
- opacity: Optional<number>;
34
+ opacity?: Optional<number>;
35
35
  }>>;
36
36
  overlays?: Optional<number[]>;
37
37
  projection?: Optional<'mercator' | 'globe'>;
@@ -70,6 +70,7 @@ export type JobObjectModels = {
70
70
  marker?: Optional<JobObjectMarkerGroup[]>;
71
71
  polygon?: Optional<JobObjectPolygonGroup[]>;
72
72
  };
73
+ export type JobObjectJustify = 'left' | 'center' | 'right';
73
74
  export type PopupPosition = 'bottomLeft' | 'mapElement';
74
75
  type Optional<T> = T | undefined;
75
76
  type JobObjectGroupType = JobObjectArea | JobObjectCircle | JobObjectDot | JobObjectLine | JobObjectMarker | JobObjectPolygon;
@@ -100,6 +101,7 @@ export type JobObjectMarkerGroup = JobObjectGroupBase<JobObjectMarker> & {
100
101
  textColor?: Optional<string>;
101
102
  textHaloColor?: Optional<string>;
102
103
  collisionDetection?: Optional<boolean>;
104
+ labelCollisionDetection?: Optional<boolean>;
103
105
  clustering?: Optional<boolean>;
104
106
  clusterMaxZoom?: Optional<number>;
105
107
  clusterRadius?: Optional<number>;
@@ -140,6 +142,7 @@ export type JobObjectNorthArrow = {
140
142
  position: AdornmentPosition;
141
143
  stacking?: Optional<Orientation>;
142
144
  scale?: Optional<number>;
145
+ svgString?: Optional<string>;
143
146
  };
144
147
  export type JobObjectScalebar = {
145
148
  type: 'scalebar';
@@ -152,6 +155,7 @@ export type JobObjectScalebar = {
152
155
  fontSize?: Optional<number>;
153
156
  maxWidth?: Optional<number>;
154
157
  unit?: Optional<ScalebarUnit>;
158
+ svgString?: Optional<string>;
155
159
  };
156
160
  export type JobObjectWebControls = {
157
161
  type: 'webControls';
@@ -194,12 +198,12 @@ export type JobObjectHeading = {
194
198
  titleColor?: Optional<string>;
195
199
  titleFont?: Optional<string>;
196
200
  titleFontSize?: Optional<number>;
197
- titleJustify?: Optional<string>;
201
+ titleJustify?: Optional<JobObjectJustify>;
198
202
  subtitle: string;
199
203
  subtitleColor?: Optional<string>;
200
204
  subtitleFont?: Optional<string>;
201
205
  subtitleFontSize?: Optional<number>;
202
- subtitleJustify?: Optional<string>;
206
+ subtitleJustify?: Optional<JobObjectJustify>;
203
207
  background?: Optional<string>;
204
208
  showBackground?: Optional<boolean>;
205
209
  };
@@ -261,7 +265,6 @@ export type JobObjectLine = {
261
265
  lineColor?: Optional<string>;
262
266
  lineStyle?: Optional<'solid' | 'dashed' | 'dotted'>;
263
267
  lineType?: Optional<'line' | 'route'>;
264
- lineDashArray?: Optional<number[]>;
265
268
  transportType?: Optional<'car' | 'bicycle' | 'pedestrian'>;
266
269
  smoothness?: Optional<number>;
267
270
  svg?: Optional<string>;
@@ -351,7 +354,7 @@ export type JobObjectMarker = {
351
354
  textAnchor?: Optional<Anchor>;
352
355
  textLineHeight?: Optional<number>;
353
356
  textLetterSpacing?: Optional<number>;
354
- textJustify?: Optional<'left' | 'center' | 'right'>;
357
+ textJustify?: Optional<JobObjectJustify>;
355
358
  textRotation?: Optional<number>;
356
359
  textOffset?: Optional<[number, number]>;
357
360
  textColor?: Optional<string>;
@@ -0,0 +1,4 @@
1
+ import { Env, Font } from '../types';
2
+ export declare function loadFont(name: string, vapiUrl: string, accessToken: string): Promise<string | undefined>;
3
+ export declare function loadFontFaces(env: Env, vapiUrl: string, accessToken: string): Promise<Map<string, Font>>;
4
+ export declare function fontKey(family: string, weight: string, style: string): string;
@@ -1,6 +1,7 @@
1
1
  import { Map } from '@mapcreator/maplibre-gl';
2
- export declare const loadLocationDot: (map: Map) => void;
3
- export declare const initLayersAndSources: (map: Map) => void;
2
+ import { SvgCache } from './svgHelpers';
3
+ export declare const loadLocationDot: (map: Map, svgCache: SvgCache) => void;
4
+ export declare const initLayersAndSources: (map: Map, svgCache: SvgCache) => void;
4
5
  export declare const addLocationDot: (map: any, lng: number, lat: number) => void;
5
6
  export declare const createCircle: (lng: number, lat: number, meters: number) => any;
6
7
  export declare const showNotification: () => void;
@@ -21,10 +21,12 @@ export declare function unitConvert(from: Unit, to: Unit, value: number): number
21
21
  export declare function lerp(value1: number, value2: number, ratio: number): number;
22
22
  export declare function unlerp(min: number, max: number, value: number): number;
23
23
  export declare function clamp(value: number, min: number, max: number): number;
24
+ export declare function stripQuotes(s: string): string;
24
25
  /**
25
26
  * Fast hash function for non-cryptographic use
26
27
  */
27
28
  export declare function fnv32b(str: string): string;
28
29
  export declare function calculateScaleCorrection(jobObject: JobObject, container: HTMLElement): number;
29
30
  export declare function almostEqual(a: number, b: number, delta?: number): boolean;
31
+ export declare function isInIframe(): boolean;
30
32
  export {};
@@ -0,0 +1,2 @@
1
+ import { StyleSpecification } from '@mapcreator/maplibre-gl';
2
+ export declare function ensureSlotLayers(mapstyle: StyleSpecification): void;
@@ -1,9 +1,9 @@
1
1
  import { JobObjectDataBindings } from '../types/jobObject';
2
2
  import { Map as MapLibre } from '@mapcreator/maplibre-gl';
3
3
  import { ColorGenerator } from './choropleth';
4
+ import { Font } from '../types';
4
5
  export declare function escapeXML(str: string): string;
5
- export declare function loadFonts(fontNames: string[], vapiUrl: string, accessToken: string): Promise<void>;
6
- export declare function createImage(svgString: string, width: number, height: number): Promise<HTMLImageElement>;
6
+ export declare function createImage(svgString: string, width: number, height: number, fontMap: Map<string, Font>, vapiUrl: string, accessToken: string): Promise<HTMLImageElement>;
7
7
  export interface SvgColor {
8
8
  name: string;
9
9
  color: Color | string | undefined;
@@ -13,6 +13,8 @@ export interface SvgText {
13
13
  text: string | undefined;
14
14
  isMultiline: boolean;
15
15
  }
16
+ export declare function collectUsedFonts(svg: string, fontMap: Map<string, Font>): Font[];
17
+ export declare function injectFonts(svg: string, fonts: Font[], fontBuffers: Array<string | undefined>): string;
16
18
  export declare class SvgHelper {
17
19
  private _seen;
18
20
  private _svg;
@@ -62,7 +64,10 @@ export declare class SvgHelper {
62
64
  export declare class SvgCache {
63
65
  private map;
64
66
  private keyCache;
65
- constructor(map: MapLibre);
67
+ fontMap: Map<string, Font>;
68
+ vapiUrl: string;
69
+ accessToken: string;
70
+ constructor(map: MapLibre, fontMap: Map<string, Font>, vapiUrl: string, accessToken: string);
66
71
  getMapLibreImageKey(svg: string, pixelRatio: number): string;
67
72
  }
68
73
  export declare function measureTextBlock(lines: string[], fontFamily: string, fontSize: number): {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mapcreator/sdk",
3
- "version": "0.0.0-swipe.0",
3
+ "version": "0.0.0-uncluster.0",
4
4
  "engines": {
5
5
  "node": "^24.0.0",
6
6
  "npm": "^11.0.0"