@mapvx/web-js 1.1.0 → 1.2.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/dist/cjs/domain/models/circle.js +218 -0
- package/dist/cjs/domain/models/circle.js.map +1 -0
- package/dist/cjs/domain/models/marker.js +6 -0
- package/dist/cjs/domain/models/marker.js.map +1 -1
- package/dist/cjs/index.js +10 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/logger/logger.js +15 -8
- package/dist/cjs/logger/logger.js.map +1 -1
- package/dist/cjs/logger/rollbar.js +16 -8
- package/dist/cjs/logger/rollbar.js.map +1 -1
- package/dist/cjs/map/map.js +274 -3
- package/dist/cjs/map/map.js.map +1 -1
- package/dist/cjs/utils/preconnect.js +131 -0
- package/dist/cjs/utils/preconnect.js.map +1 -0
- package/dist/es/domain/models/circle.d.ts +183 -0
- package/dist/es/domain/models/circle.d.ts.map +1 -0
- package/dist/es/domain/models/circle.js +212 -0
- package/dist/es/domain/models/circle.js.map +1 -0
- package/dist/es/domain/models/marker.d.ts +8 -0
- package/dist/es/domain/models/marker.d.ts.map +1 -1
- package/dist/es/domain/models/marker.js +6 -0
- package/dist/es/domain/models/marker.js.map +1 -1
- package/dist/es/index.d.ts +3 -0
- package/dist/es/index.d.ts.map +1 -1
- package/dist/es/index.js +3 -0
- package/dist/es/index.js.map +1 -1
- package/dist/es/logger/logger.d.ts.map +1 -1
- package/dist/es/logger/logger.js +15 -8
- package/dist/es/logger/logger.js.map +1 -1
- package/dist/es/logger/rollbar.d.ts.map +1 -1
- package/dist/es/logger/rollbar.js +16 -8
- package/dist/es/logger/rollbar.js.map +1 -1
- package/dist/es/map/map.d.ts +196 -0
- package/dist/es/map/map.d.ts.map +1 -1
- package/dist/es/map/map.js +274 -3
- package/dist/es/map/map.js.map +1 -1
- package/dist/es/utils/preconnect.d.ts +45 -0
- package/dist/es/utils/preconnect.d.ts.map +1 -0
- package/dist/es/utils/preconnect.js +127 -0
- package/dist/es/utils/preconnect.js.map +1 -0
- package/dist/umd/index.js +735 -36
- package/dist/umd/index.js.map +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.injectPreconnects = exports.MAPVX_DEFAULT_PRECONNECT_HOSTS = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Hostnames that MapVX maps typically need to talk to during the first
|
|
6
|
+
* paint: vector tiles, sprite, glyphs and indoor tile sources. Exposed so
|
|
7
|
+
* that consumer apps can call `injectPreconnects(MAPVX_DEFAULT_PRECONNECT_HOSTS)`
|
|
8
|
+
* without having to maintain the list themselves.
|
|
9
|
+
*
|
|
10
|
+
* @group Utils
|
|
11
|
+
*/
|
|
12
|
+
exports.MAPVX_DEFAULT_PRECONNECT_HOSTS = [
|
|
13
|
+
"https://tiles.mapvx.com",
|
|
14
|
+
"https://api.maptiler.com",
|
|
15
|
+
"https://indoorequals.mapvx.com",
|
|
16
|
+
];
|
|
17
|
+
/**
|
|
18
|
+
* Injects `<link rel="preconnect">` (and a `<link rel="dns-prefetch">` fallback)
|
|
19
|
+
* tags into `document.head` for the given origins, so the browser starts the
|
|
20
|
+
* DNS + TLS handshake before MapLibre actually requests sprite/glyph/tile
|
|
21
|
+
* resources.
|
|
22
|
+
*
|
|
23
|
+
* Call this as early as possible — ideally before {@link initializeSDK} — to
|
|
24
|
+
* maximize the savings. In real captures this shaves ~150-300 ms off the
|
|
25
|
+
* first-paint cascade.
|
|
26
|
+
*
|
|
27
|
+
* Idempotent: hosts that already have a `<link rel="preconnect" crossorigin>`
|
|
28
|
+
* are skipped. If an existing `preconnect` link is missing `crossorigin`, it
|
|
29
|
+
* is upgraded in place (added `crossorigin="anonymous"`) — without that
|
|
30
|
+
* attribute the warmed socket can't be reused for the CORS tile/font/sprite
|
|
31
|
+
* fetches MapLibre performs, so leaving the existing link untouched would
|
|
32
|
+
* silently defeat the optimization. Existing `crossorigin="use-credentials"`
|
|
33
|
+
* is respected and never overwritten.
|
|
34
|
+
*
|
|
35
|
+
* @param hosts - Origin URLs (`"https://tiles.mapvx.com"`) or bare hostnames
|
|
36
|
+
* (`"tiles.mapvx.com"`, normalized to `https://`). Invalid entries are
|
|
37
|
+
* silently ignored.
|
|
38
|
+
* @returns The origins where the helper made a change — either a new link was
|
|
39
|
+
* appended, or an existing one was upgraded with `crossorigin="anonymous"`.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* import { initializeSDK, injectPreconnects, MAPVX_DEFAULT_PRECONNECT_HOSTS } from "@mapvx/web-js"
|
|
44
|
+
*
|
|
45
|
+
* injectPreconnects(MAPVX_DEFAULT_PRECONNECT_HOSTS)
|
|
46
|
+
* const sdk = initializeSDK(apiKey)
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @group Utils
|
|
50
|
+
*/
|
|
51
|
+
function injectPreconnects(hosts) {
|
|
52
|
+
if (typeof document === "undefined" || !document.head)
|
|
53
|
+
return [];
|
|
54
|
+
if (!Array.isArray(hosts) || hosts.length === 0)
|
|
55
|
+
return [];
|
|
56
|
+
const injected = [];
|
|
57
|
+
for (const raw of hosts) {
|
|
58
|
+
if (typeof raw !== "string" || raw.length === 0)
|
|
59
|
+
continue;
|
|
60
|
+
const origin = normalizeOrigin(raw);
|
|
61
|
+
if (origin === null)
|
|
62
|
+
continue;
|
|
63
|
+
// Check what's already in <head>. We may need to UPGRADE an existing
|
|
64
|
+
// preconnect — server-rendered or hand-authored hints frequently omit
|
|
65
|
+
// `crossorigin`, and a warmed socket without it cannot be reused for
|
|
66
|
+
// the CORS tile/font/sprite fetches that MapLibre performs. Without
|
|
67
|
+
// this branch the optimization would silently no-op when the page
|
|
68
|
+
// already had a partial hint.
|
|
69
|
+
const existingPreconnect = findLinkForOrigin("preconnect", origin);
|
|
70
|
+
let preconnectChanged = false;
|
|
71
|
+
if (existingPreconnect) {
|
|
72
|
+
if (!existingPreconnect.hasAttribute("crossorigin")) {
|
|
73
|
+
existingPreconnect.crossOrigin = "anonymous";
|
|
74
|
+
preconnectChanged = true;
|
|
75
|
+
}
|
|
76
|
+
// If the existing link already has any `crossorigin` value
|
|
77
|
+
// (including `use-credentials`), respect the author's intent and
|
|
78
|
+
// leave it alone.
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
const preconnect = document.createElement("link");
|
|
82
|
+
preconnect.rel = "preconnect";
|
|
83
|
+
preconnect.href = origin;
|
|
84
|
+
preconnect.crossOrigin = "anonymous";
|
|
85
|
+
document.head.appendChild(preconnect);
|
|
86
|
+
preconnectChanged = true;
|
|
87
|
+
}
|
|
88
|
+
// dns-prefetch is a fallback for older browsers that ignore preconnect.
|
|
89
|
+
if (!findLinkForOrigin("dns-prefetch", origin)) {
|
|
90
|
+
const dnsPrefetch = document.createElement("link");
|
|
91
|
+
dnsPrefetch.rel = "dns-prefetch";
|
|
92
|
+
dnsPrefetch.href = origin;
|
|
93
|
+
document.head.appendChild(dnsPrefetch);
|
|
94
|
+
}
|
|
95
|
+
if (preconnectChanged)
|
|
96
|
+
injected.push(origin);
|
|
97
|
+
}
|
|
98
|
+
return injected;
|
|
99
|
+
}
|
|
100
|
+
exports.injectPreconnects = injectPreconnects;
|
|
101
|
+
/**
|
|
102
|
+
* Returns the first `<link rel="${rel}">` in `<head>` whose resolved origin
|
|
103
|
+
* matches `origin`, or null. We compare canonical URL origins instead of
|
|
104
|
+
* the raw `href` attribute text — the same origin can be written as
|
|
105
|
+
* `https://tiles.mapvx.com` or `https://tiles.mapvx.com/`, and a strict
|
|
106
|
+
* attribute selector would miss the second form and inject a duplicate.
|
|
107
|
+
*/
|
|
108
|
+
function findLinkForOrigin(rel, origin) {
|
|
109
|
+
const links = document.head.querySelectorAll(`link[rel="${rel}"]`);
|
|
110
|
+
for (let i = 0; i < links.length; i++) {
|
|
111
|
+
const link = links[i];
|
|
112
|
+
try {
|
|
113
|
+
if (new URL(link.href).origin === origin)
|
|
114
|
+
return link;
|
|
115
|
+
}
|
|
116
|
+
catch (_a) {
|
|
117
|
+
// Malformed href — skip and keep scanning.
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
function normalizeOrigin(raw) {
|
|
123
|
+
try {
|
|
124
|
+
const candidate = /^https?:\/\//i.test(raw) ? raw : `https://${raw}`;
|
|
125
|
+
return new URL(candidate).origin;
|
|
126
|
+
}
|
|
127
|
+
catch (_a) {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=preconnect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preconnect.js","sourceRoot":"","sources":["../../../src/utils/preconnect.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACU,QAAA,8BAA8B,GAAsB;IAC/D,yBAAyB;IACzB,0BAA0B;IAC1B,gCAAgC;CACjC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,SAAgB,iBAAiB,CAAC,KAAwB;IACxD,IAAI,OAAO,QAAQ,KAAK,WAAW,IAAI,CAAC,QAAQ,CAAC,IAAI;QAAE,OAAO,EAAE,CAAA;IAChE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAA;IAE1D,MAAM,QAAQ,GAAa,EAAE,CAAA;IAC7B,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE;QACvB,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;YAAE,SAAQ;QACzD,MAAM,MAAM,GAAG,eAAe,CAAC,GAAG,CAAC,CAAA;QACnC,IAAI,MAAM,KAAK,IAAI;YAAE,SAAQ;QAE7B,qEAAqE;QACrE,sEAAsE;QACtE,qEAAqE;Q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,GAAG,IAAI,CAAC,CAAA;IAClE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACrC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAoB,CAAA;QACxC,IAAI;YACF,IAAI,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM;gBAAE,OAAO,IAAI,CAAA;SACtD;QAAC,WAAM;YACN,2CAA2C;SAC5C;KACF;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAED,SAAS,eAAe,CAAC,GAAW;IAClC,IAAI;QACF,MAAM,SAAS,GAAG,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW,GAAG,EAAE,CAAA;QACpE,OAAO,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC,MAAM,CAAA;KACjC;IAAC,WAAM;QACN,OAAO,IAAI,CAAA;KACZ;AACH,CAAC"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { type LatLng } from "./latLng";
|
|
2
|
+
/**
|
|
3
|
+
* MapVX brand color used as the default for circle styling and other
|
|
4
|
+
* SDK-drawn overlays (colored places, borders).
|
|
5
|
+
*
|
|
6
|
+
* @group Circles
|
|
7
|
+
*/
|
|
8
|
+
export declare const MAPVX_BRAND_COLOR = "#276EF1";
|
|
9
|
+
/**
|
|
10
|
+
* Default styling values applied to a circle when the corresponding
|
|
11
|
+
* {@link CircleConfig} fields are omitted.
|
|
12
|
+
*
|
|
13
|
+
* @group Circles
|
|
14
|
+
*/
|
|
15
|
+
export declare const CIRCLE_DEFAULTS: {
|
|
16
|
+
readonly fillColor: "#276EF1";
|
|
17
|
+
readonly fillOpacity: 0.14;
|
|
18
|
+
readonly strokeColor: "#276EF1";
|
|
19
|
+
readonly strokeWidth: 2;
|
|
20
|
+
readonly strokeOpacity: 0.65;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Represents the configuration for the creation of a metric radius circle on a map.
|
|
24
|
+
* The radius is expressed in meters (geographic), so the drawn circle stays
|
|
25
|
+
* metrically accurate at every zoom level.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* const circleConfig: CircleConfig = {
|
|
30
|
+
* id: "geofence-1",
|
|
31
|
+
* coordinate: { lat: 40.7128, lng: -74.0060 },
|
|
32
|
+
* radiusMeters: 150,
|
|
33
|
+
* fillOpacity: 0.2,
|
|
34
|
+
* };
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @group Circles
|
|
38
|
+
*/
|
|
39
|
+
export interface CircleConfig {
|
|
40
|
+
/**
|
|
41
|
+
* Unique identifier for the circle.
|
|
42
|
+
* If not provided, a hexadecimal key will be generated automatically.
|
|
43
|
+
*/
|
|
44
|
+
id?: string;
|
|
45
|
+
/**
|
|
46
|
+
* The geographic coordinates of the circle center.
|
|
47
|
+
* Latitude must be between -90 and 90; longitude between -180 and 180.
|
|
48
|
+
* @see {@link LatLng} for coordinate structure
|
|
49
|
+
* @throws Error if coordinates are out of bounds.
|
|
50
|
+
*/
|
|
51
|
+
coordinate: LatLng;
|
|
52
|
+
/**
|
|
53
|
+
* Radius of the circle in meters (geographic, not pixels).
|
|
54
|
+
* Must be a positive finite number. The circle keeps its metric size at every zoom level.
|
|
55
|
+
* @throws Error if radiusMeters is ≤ 0 or non-finite.
|
|
56
|
+
*/
|
|
57
|
+
radiusMeters: number;
|
|
58
|
+
/**
|
|
59
|
+
* Fill color of the circle in any valid CSS color format.
|
|
60
|
+
* @defaultValue {@link MAPVX_BRAND_COLOR}
|
|
61
|
+
*/
|
|
62
|
+
fillColor?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Opacity of the circle fill, between 0 and 1.
|
|
65
|
+
* Values outside this range are automatically clamped.
|
|
66
|
+
* @defaultValue 0.14
|
|
67
|
+
*/
|
|
68
|
+
fillOpacity?: number;
|
|
69
|
+
/**
|
|
70
|
+
* Stroke (outline) color of the circle in any valid CSS color format.
|
|
71
|
+
* @defaultValue {@link MAPVX_BRAND_COLOR}
|
|
72
|
+
*/
|
|
73
|
+
strokeColor?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Width of the circle outline in pixels.
|
|
76
|
+
* @defaultValue 2
|
|
77
|
+
*/
|
|
78
|
+
strokeWidth?: number;
|
|
79
|
+
/**
|
|
80
|
+
* Opacity of the circle outline, between 0 and 1.
|
|
81
|
+
* Values outside this range are automatically clamped.
|
|
82
|
+
* @defaultValue 0.65
|
|
83
|
+
*/
|
|
84
|
+
strokeOpacity?: number;
|
|
85
|
+
/**
|
|
86
|
+
* Identifier for the floor on which the circle is located.
|
|
87
|
+
* A circle with a floor is shown only while that floor is displayed.
|
|
88
|
+
* A circle without a floor is shown only in outdoor contexts,
|
|
89
|
+
* matching the visibility semantics of {@link MarkerConfig.floorId}.
|
|
90
|
+
*/
|
|
91
|
+
floorId?: string;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Internal resolved representation of a circle kept by the map.
|
|
95
|
+
* Holds the full configuration with defaults applied, plus visibility state.
|
|
96
|
+
*
|
|
97
|
+
* Unlike markers, the hidden flag persists across floor changes and map
|
|
98
|
+
* restyles: a circle hidden via `hideCircle` stays hidden until `showCircle`.
|
|
99
|
+
*/
|
|
100
|
+
export interface CircleRecord {
|
|
101
|
+
id: string;
|
|
102
|
+
coordinate: LatLng;
|
|
103
|
+
radiusMeters: number;
|
|
104
|
+
fillColor: string;
|
|
105
|
+
fillOpacity: number;
|
|
106
|
+
strokeColor: string;
|
|
107
|
+
strokeWidth: number;
|
|
108
|
+
strokeOpacity: number;
|
|
109
|
+
floorId?: string;
|
|
110
|
+
hidden: boolean;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Type guard for validating circle configurations without throwing.
|
|
114
|
+
* Returns true if the configuration is valid and can be added to the map.
|
|
115
|
+
*
|
|
116
|
+
* @param config Configuration to validate.
|
|
117
|
+
* @returns True if config is a valid CircleConfig, false otherwise.
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```typescript
|
|
121
|
+
* if (isValidCircleConfig(userInput)) {
|
|
122
|
+
* map.addCircle(userInput);
|
|
123
|
+
* } else {
|
|
124
|
+
* console.error('Invalid circle configuration');
|
|
125
|
+
* }
|
|
126
|
+
* ```
|
|
127
|
+
*
|
|
128
|
+
* @group Circles
|
|
129
|
+
*/
|
|
130
|
+
export declare function isValidCircleConfig(config: unknown): config is CircleConfig;
|
|
131
|
+
/**
|
|
132
|
+
* Resolves a {@link CircleConfig} into a {@link CircleRecord}, applying
|
|
133
|
+
* default styling, generating an id when one is not provided, and validating inputs.
|
|
134
|
+
*
|
|
135
|
+
* @param config Circle configuration provided by the SDK consumer.
|
|
136
|
+
* @param hidden Initial hidden state, defaults to visible.
|
|
137
|
+
* @returns The resolved circle record ready to be stored and rendered.
|
|
138
|
+
* @throws {Error} If radiusMeters is ≤ 0, not finite, or coordinates are invalid.
|
|
139
|
+
*
|
|
140
|
+
* @group Circles
|
|
141
|
+
*/
|
|
142
|
+
export declare function resolveCircleConfig(config: CircleConfig, hidden?: boolean): CircleRecord;
|
|
143
|
+
/**
|
|
144
|
+
* Builds a closed GeoJSON polygon ring approximating a geographic circle.
|
|
145
|
+
*
|
|
146
|
+
* The ring is computed with an equirectangular approximation: meters are
|
|
147
|
+
* converted to degrees independently per axis, with the longitude scale
|
|
148
|
+
* corrected by the cosine of the latitude. For the radii the SDK works with
|
|
149
|
+
* (tens to hundreds of meters) the metric error is negligible (≤1%) at any latitude
|
|
150
|
+
* where the projection is defined. At extreme polar latitudes, the approximation
|
|
151
|
+
* breaks down, so circles near poles (|lat| > 85°) should be used with caution.
|
|
152
|
+
*
|
|
153
|
+
* @param lng Longitude of the circle center in degrees.
|
|
154
|
+
* @param lat Latitude of the circle center in degrees.
|
|
155
|
+
* @param radiusMeters Radius of the circle in meters. Must be positive and finite.
|
|
156
|
+
* @param points Number of segments in the ring. Defaults to 64. Non-integer
|
|
157
|
+
* values are floored and the count is clamped to a minimum of 3,
|
|
158
|
+
* the smallest valid GeoJSON linear ring; non-finite values fall
|
|
159
|
+
* back to the default.
|
|
160
|
+
* @returns A closed ring of `[lng, lat]` positions (first equals last).
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* ```typescript
|
|
164
|
+
* import { circleRing } from '@mapvx/web-js';
|
|
165
|
+
*
|
|
166
|
+
* // Create a 150-meter radius circle ring
|
|
167
|
+
* const ring = circleRing(-74.0060, 40.7128, 150);
|
|
168
|
+
* const polygon = { type: "Polygon", coordinates: [ring] };
|
|
169
|
+
*
|
|
170
|
+
* // Custom segments (32 instead of 64) for lower resolution
|
|
171
|
+
* const coarseRing = circleRing(-74.0060, 40.7128, 150, 32);
|
|
172
|
+
* ```
|
|
173
|
+
*
|
|
174
|
+
* @note Equirectangular approximation is accurate for radii up to ~500 km and
|
|
175
|
+
* latitudes between approximately ±80°. Beyond these limits, visual
|
|
176
|
+
* distortion may occur near the poles.
|
|
177
|
+
* @note Generated rings do not account for geographic obstacles, walls, or
|
|
178
|
+
* buildings. For complex geofencing, consider server-side validation.
|
|
179
|
+
*
|
|
180
|
+
* @group Circles
|
|
181
|
+
*/
|
|
182
|
+
export declare function circleRing(lng: number, lat: number, radiusMeters: number, points?: number): [number, number][];
|
|
183
|
+
//# sourceMappingURL=circle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"circle.d.ts","sourceRoot":"","sources":["../../../../src/domain/models/circle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,UAAU,CAAA;AAEtC;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,YAAY,CAAA;AAE1C;;;;;GAKG;AACH,eAAO,MAAM,eAAe;;;;;;CAMlB,CAAA;AAEV;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,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AE,MAAM,CAAC,EAAE,CAiBpB"}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { generateHexadecimalKey } from "../../utils/utils";
|
|
2
|
+
/**
|
|
3
|
+
* MapVX brand color used as the default for circle styling and other
|
|
4
|
+
* SDK-drawn overlays (colored places, borders).
|
|
5
|
+
*
|
|
6
|
+
* @group Circles
|
|
7
|
+
*/
|
|
8
|
+
export const MAPVX_BRAND_COLOR = "#276EF1";
|
|
9
|
+
/**
|
|
10
|
+
* Default styling values applied to a circle when the corresponding
|
|
11
|
+
* {@link CircleConfig} fields are omitted.
|
|
12
|
+
*
|
|
13
|
+
* @group Circles
|
|
14
|
+
*/
|
|
15
|
+
export const CIRCLE_DEFAULTS = {
|
|
16
|
+
fillColor: MAPVX_BRAND_COLOR,
|
|
17
|
+
fillOpacity: 0.14,
|
|
18
|
+
strokeColor: MAPVX_BRAND_COLOR,
|
|
19
|
+
strokeWidth: 2,
|
|
20
|
+
strokeOpacity: 0.65,
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Validates that a radius in meters is positive and finite.
|
|
24
|
+
* @param radius The radius value to validate.
|
|
25
|
+
* @throws {Error} If radius is ≤ 0 or not finite (NaN/Infinity).
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
function validateRadiusMeters(radius) {
|
|
29
|
+
if (!Number.isFinite(radius) || radius <= 0) {
|
|
30
|
+
throw new Error(`Invalid radiusMeters: ${radius}. Must be a positive finite number.`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Validates that a coordinate is within valid geographic bounds.
|
|
35
|
+
* @param coord The coordinate to validate.
|
|
36
|
+
* @throws {Error} If latitude is outside [-90, 90] or longitude outside [-180, 180], or not finite.
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
function validateCoordinate(coord) {
|
|
40
|
+
if (coord == null || typeof coord !== "object") {
|
|
41
|
+
throw new Error("Invalid coordinate: expected an object with lat and lng properties.");
|
|
42
|
+
}
|
|
43
|
+
if (!Number.isFinite(coord.lat) ||
|
|
44
|
+
!Number.isFinite(coord.lng) ||
|
|
45
|
+
coord.lat < -90 ||
|
|
46
|
+
coord.lat > 90 ||
|
|
47
|
+
coord.lng < -180 ||
|
|
48
|
+
coord.lng > 180) {
|
|
49
|
+
throw new Error(`Invalid coordinate: lat=${coord.lat}, lng=${coord.lng}. ` +
|
|
50
|
+
`latitude must be in [-90, 90], longitude in [-180, 180], and both finite.`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Clamps an opacity value to the valid range [0, 1].
|
|
55
|
+
* @param opacity The opacity value to clamp.
|
|
56
|
+
* @param defaultValue Value to use if opacity is not a finite number.
|
|
57
|
+
* @returns The clamped opacity value.
|
|
58
|
+
* @internal
|
|
59
|
+
*/
|
|
60
|
+
function clampOpacity(opacity, defaultValue) {
|
|
61
|
+
if (!Number.isFinite(opacity))
|
|
62
|
+
return defaultValue;
|
|
63
|
+
return Math.max(0, Math.min(1, opacity));
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Type guard for validating circle configurations without throwing.
|
|
67
|
+
* Returns true if the configuration is valid and can be added to the map.
|
|
68
|
+
*
|
|
69
|
+
* @param config Configuration to validate.
|
|
70
|
+
* @returns True if config is a valid CircleConfig, false otherwise.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```typescript
|
|
74
|
+
* if (isValidCircleConfig(userInput)) {
|
|
75
|
+
* map.addCircle(userInput);
|
|
76
|
+
* } else {
|
|
77
|
+
* console.error('Invalid circle configuration');
|
|
78
|
+
* }
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* @group Circles
|
|
82
|
+
*/
|
|
83
|
+
export function isValidCircleConfig(config) {
|
|
84
|
+
if (config === null || config === undefined || typeof config !== "object") {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
const c = config;
|
|
88
|
+
if (typeof c.coordinate !== "object" || c.coordinate === null)
|
|
89
|
+
return false;
|
|
90
|
+
const coord = c.coordinate;
|
|
91
|
+
if (typeof coord.lat !== "number" ||
|
|
92
|
+
typeof coord.lng !== "number" ||
|
|
93
|
+
!Number.isFinite(coord.lat) ||
|
|
94
|
+
!Number.isFinite(coord.lng) ||
|
|
95
|
+
coord.lat < -90 ||
|
|
96
|
+
coord.lat > 90 ||
|
|
97
|
+
coord.lng < -180 ||
|
|
98
|
+
coord.lng > 180) {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
if (typeof c.radiusMeters !== "number" ||
|
|
102
|
+
!Number.isFinite(c.radiusMeters) ||
|
|
103
|
+
c.radiusMeters <= 0) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
if (c.id !== undefined && typeof c.id !== "string")
|
|
107
|
+
return false;
|
|
108
|
+
if (c.fillColor !== undefined && typeof c.fillColor !== "string")
|
|
109
|
+
return false;
|
|
110
|
+
if (c.fillOpacity !== undefined) {
|
|
111
|
+
if (typeof c.fillOpacity !== "number" || !Number.isFinite(c.fillOpacity))
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
if (c.strokeColor !== undefined && typeof c.strokeColor !== "string")
|
|
115
|
+
return false;
|
|
116
|
+
if (c.strokeWidth !== undefined) {
|
|
117
|
+
if (typeof c.strokeWidth !== "number" || !Number.isFinite(c.strokeWidth))
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
if (c.strokeOpacity !== undefined) {
|
|
121
|
+
if (typeof c.strokeOpacity !== "number" || !Number.isFinite(c.strokeOpacity))
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
if (c.floorId !== undefined && typeof c.floorId !== "string")
|
|
125
|
+
return false;
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Resolves a {@link CircleConfig} into a {@link CircleRecord}, applying
|
|
130
|
+
* default styling, generating an id when one is not provided, and validating inputs.
|
|
131
|
+
*
|
|
132
|
+
* @param config Circle configuration provided by the SDK consumer.
|
|
133
|
+
* @param hidden Initial hidden state, defaults to visible.
|
|
134
|
+
* @returns The resolved circle record ready to be stored and rendered.
|
|
135
|
+
* @throws {Error} If radiusMeters is ≤ 0, not finite, or coordinates are invalid.
|
|
136
|
+
*
|
|
137
|
+
* @group Circles
|
|
138
|
+
*/
|
|
139
|
+
export function resolveCircleConfig(config, hidden = false) {
|
|
140
|
+
var _a, _b, _c, _d;
|
|
141
|
+
validateRadiusMeters(config.radiusMeters);
|
|
142
|
+
validateCoordinate(config.coordinate);
|
|
143
|
+
return {
|
|
144
|
+
id: (_a = config.id) !== null && _a !== void 0 ? _a : generateHexadecimalKey(),
|
|
145
|
+
coordinate: config.coordinate,
|
|
146
|
+
radiusMeters: config.radiusMeters,
|
|
147
|
+
fillColor: (_b = config.fillColor) !== null && _b !== void 0 ? _b : CIRCLE_DEFAULTS.fillColor,
|
|
148
|
+
fillOpacity: clampOpacity(config.fillOpacity, CIRCLE_DEFAULTS.fillOpacity),
|
|
149
|
+
strokeColor: (_c = config.strokeColor) !== null && _c !== void 0 ? _c : CIRCLE_DEFAULTS.strokeColor,
|
|
150
|
+
strokeWidth: (_d = config.strokeWidth) !== null && _d !== void 0 ? _d : CIRCLE_DEFAULTS.strokeWidth,
|
|
151
|
+
strokeOpacity: clampOpacity(config.strokeOpacity, CIRCLE_DEFAULTS.strokeOpacity),
|
|
152
|
+
floorId: config.floorId,
|
|
153
|
+
hidden,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Builds a closed GeoJSON polygon ring approximating a geographic circle.
|
|
158
|
+
*
|
|
159
|
+
* The ring is computed with an equirectangular approximation: meters are
|
|
160
|
+
* converted to degrees independently per axis, with the longitude scale
|
|
161
|
+
* corrected by the cosine of the latitude. For the radii the SDK works with
|
|
162
|
+
* (tens to hundreds of meters) the metric error is negligible (≤1%) at any latitude
|
|
163
|
+
* where the projection is defined. At extreme polar latitudes, the approximation
|
|
164
|
+
* breaks down, so circles near poles (|lat| > 85°) should be used with caution.
|
|
165
|
+
*
|
|
166
|
+
* @param lng Longitude of the circle center in degrees.
|
|
167
|
+
* @param lat Latitude of the circle center in degrees.
|
|
168
|
+
* @param radiusMeters Radius of the circle in meters. Must be positive and finite.
|
|
169
|
+
* @param points Number of segments in the ring. Defaults to 64. Non-integer
|
|
170
|
+
* values are floored and the count is clamped to a minimum of 3,
|
|
171
|
+
* the smallest valid GeoJSON linear ring; non-finite values fall
|
|
172
|
+
* back to the default.
|
|
173
|
+
* @returns A closed ring of `[lng, lat]` positions (first equals last).
|
|
174
|
+
*
|
|
175
|
+
* @example
|
|
176
|
+
* ```typescript
|
|
177
|
+
* import { circleRing } from '@mapvx/web-js';
|
|
178
|
+
*
|
|
179
|
+
* // Create a 150-meter radius circle ring
|
|
180
|
+
* const ring = circleRing(-74.0060, 40.7128, 150);
|
|
181
|
+
* const polygon = { type: "Polygon", coordinates: [ring] };
|
|
182
|
+
*
|
|
183
|
+
* // Custom segments (32 instead of 64) for lower resolution
|
|
184
|
+
* const coarseRing = circleRing(-74.0060, 40.7128, 150, 32);
|
|
185
|
+
* ```
|
|
186
|
+
*
|
|
187
|
+
* @note Equirectangular approximation is accurate for radii up to ~500 km and
|
|
188
|
+
* latitudes between approximately ±80°. Beyond these limits, visual
|
|
189
|
+
* distortion may occur near the poles.
|
|
190
|
+
* @note Generated rings do not account for geographic obstacles, walls, or
|
|
191
|
+
* buildings. For complex geofencing, consider server-side validation.
|
|
192
|
+
*
|
|
193
|
+
* @group Circles
|
|
194
|
+
*/
|
|
195
|
+
export function circleRing(lng, lat, radiusMeters, points = 64) {
|
|
196
|
+
// A linear ring needs at least 3 distinct positions to be valid GeoJSON
|
|
197
|
+
const segments = Number.isFinite(points) ? Math.max(3, Math.floor(points)) : 64;
|
|
198
|
+
const ring = [];
|
|
199
|
+
const latRad = (lat * Math.PI) / 180;
|
|
200
|
+
const metersPerDegLat = 110574;
|
|
201
|
+
const metersPerDegLng = 111320 * Math.cos(latRad || 0.000001);
|
|
202
|
+
const latR = radiusMeters / metersPerDegLat;
|
|
203
|
+
const lngR = radiusMeters / (metersPerDegLng || 1);
|
|
204
|
+
for (let i = 0; i < segments; i += 1) {
|
|
205
|
+
const a = (i / segments) * Math.PI * 2;
|
|
206
|
+
ring.push([lng + lngR * Math.cos(a), lat + latR * Math.sin(a)]);
|
|
207
|
+
}
|
|
208
|
+
// Close the ring with an exact copy of the first position, as GeoJSON requires
|
|
209
|
+
ring.push([ring[0][0], ring[0][1]]);
|
|
210
|
+
return ring;
|
|
211
|
+
}
|
|
212
|
+
//# sourceMappingURL=circle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"circle.js","sourceRoot":"","sources":["../../../../src/domain/models/circle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAG1D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,SAAS,CAAA;AAE1C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,SAAS,EAAE,iBAAiB;IAC5B,WAAW,EAAE,IAAI;IACjB,WAAW,EAAE,iBAAiB;IAC9B,WAAW,EAAE,CAAC;IACd,aAAa,EAAE,IAAI;CACX,CAAA;AAsGV;;;;;GAKG;AACH,SAAS,oBAAoB,CAAC,MAAc;IAC1C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,IAAI,CAAC,EAAE;QAC3C,MAAM,IAAI,KAAK,CAAC,yBAAyB,MAAM,qCAAqC,CAAC,CAAA;KACtF;AACH,CAAC;AAED;;;;;GAKG;AACH,SAAS,kBAAkB,CAAC,KAAgC;IAC1D,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC9C,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAA;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,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IAE/E,MAAM,IAAI,GAAuB,EAAE,CAAA;IACnC,MAAM,MAAM,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAA;IACpC,MAAM,eAAe,GAAG,MAAM,CAAA;IAC9B,MAAM,eAAe,GAAG,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,IAAI,QAAQ,CAAC,CAAA;IAC7D,MAAM,IAAI,GAAG,YAAY,GAAG,eAAe,CAAA;IAC3C,MAAM,IAAI,GAAG,YAAY,GAAG,CAAC,eAAe,IAAI,CAAC,CAAC,CAAA;IAClD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAE;QACpC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAA;QACtC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAChE;IACD,+EAA+E;IAC/E,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IACnC,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -110,6 +110,14 @@ export interface MarkerConfig {
|
|
|
110
110
|
* @see {@link Alignment} for available alignment options
|
|
111
111
|
*/
|
|
112
112
|
rotationAlignment?: Alignment;
|
|
113
|
+
/**
|
|
114
|
+
* Rotation angle of the marker in degrees clockwise from north.
|
|
115
|
+
* Useful for directional markers (e.g. compass arrows). Combine with
|
|
116
|
+
* `rotationAlignment: "map"` to keep the marker pointing the same
|
|
117
|
+
* compass direction as the user rotates the map.
|
|
118
|
+
* @defaultValue 0
|
|
119
|
+
*/
|
|
120
|
+
rotation?: number;
|
|
113
121
|
/**
|
|
114
122
|
* A string indicating the part of the Marker that should be positioned closest to the coordinate set via {@link coordinate}.
|
|
115
123
|
* Options are `'center'`, `'top'`, `'bottom'`, `'left'`, `'right'`, `'top-left'`, `'top-right'`, `'bottom-left'`, and `'bottom-right'`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marker.d.ts","sourceRoot":"","sources":["../../../../src/domain/models/marker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,GAAG,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAA;AAEnE,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,UAAU,CAAA;AAEtC;;;;;;;;;;;;;;GAcG;AACH,oBAAY,YAAY;IACtB,8CAA8C;IAC9C,IAAI,IAAA;IACJ,+CAA+C;IAC/C,KAAK,IAAA;IACL,qCAAqC;IACrC,GAAG,IAAA;IACH,qCAAqC;IACrC,MAAM,IAAA;CACP;AAED;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,UAAU,GAAG,MAAM,CAAA;AAEnD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAA;IAEX;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAA;IAElB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB;;;OAGG;IACH,YAAY,CAAC,EAAE,YAAY,CAAA;IAE3B;;;OAGG;IACH,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,CAAA;IAE3B;;;OAGG;IACH,cAAc,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.setLngLat([markerConfig.coordinate.lng, markerConfig.coordinate.lat]);
|
|
281
281
|
this.setRotationAlignment((_b = markerConfig.rotationAlignment) !== null && _b !== void 0 ? _b : "viewport");
|
|
282
282
|
this.setPitchAlignment("viewport");
|
|
283
|
+
if (typeof markerConfig.rotation === "number") {
|
|
284
|
+
this.setRotation(markerConfig.rotation);
|
|
285
|
+
}
|
|
283
286
|
this.id = (_c = markerConfig.id) !== null && _c !== void 0 ? _c : generateHexadecimalKey();
|
|
284
287
|
this.coordinate = markerConfig.coordinate;
|
|
285
288
|
this.floorId = (_d = markerConfig.floorId) !== null && _d !== void 0 ? _d : "";
|
|
@@ -329,6 +332,9 @@ export class MarkerAttribute extends Marker {
|
|
|
329
332
|
}
|
|
330
333
|
this.setRotationAlignment((_b = marker.rotationAlignment) !== null && _b !== void 0 ? _b : "viewport");
|
|
331
334
|
this.setPitchAlignment("viewport");
|
|
335
|
+
if (typeof marker.rotation === "number") {
|
|
336
|
+
this.setRotation(marker.rotation);
|
|
337
|
+
}
|
|
332
338
|
}
|
|
333
339
|
/**
|
|
334
340
|
* Sets the current floor ID for the marker.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marker.js","sourceRoot":"","sources":["../../../../src/domain/models/marker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAiC,MAAM,aAAa,CAAA;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAG1D;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAN,IAAY,YASX;AATD,WAAY,YAAY;IACtB,8CAA8C;IAC9C,+CAAI,CAAA;IACJ,+CAA+C;IAC/C,iDAAK,CAAA;IACL,qCAAqC;IACrC,6CAAG,CAAA;IACH,qCAAqC;IACrC,mDAAM,CAAA;AACR,CAAC,EATW,YAAY,KAAZ,YAAY,QASvB;
|
|
1
|
+
{"version":3,"file":"marker.js","sourceRoot":"","sources":["../../../../src/domain/models/marker.ts"],"names":[],"mappings":"A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AED;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,OAAgB;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAED;;;;;;;;OAQG;IACH,IAAI;QACF,IAAI,CAAC,MAAM,EAAE,CAAA;IACf,CAAC;IAED;;;;;;;;;OASG;IACH,IAAI,CAAC,GAAQ;QACX,IAAI,CAAC,GAAG;YAAE,OAAM;QAChB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACjB,CAAC;IAED;;;;;;;;;;;OAWG;IACH,WAAW,CAAC,OAAkC,EAAE,GAAQ,EAAE,YAAqB,KAAK;QAClF,IAAI,OAAO,IAAI,IAAI,CAAC,OAAO,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;YAC3D,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;SACf;aAAM;YACL,IAAI,CAAC,IAAI,EAAE,CAAA;SACZ;IACH,CAAC;CACF"}
|
package/dist/es/index.d.ts
CHANGED
|
@@ -18,6 +18,8 @@ export type { RouteAnimationIconConfig } from "./assets/icons";
|
|
|
18
18
|
export { Banner } from "./domain/models/banner";
|
|
19
19
|
export { isBasicWithIcon, isBasicWithLogo } from "./domain/models/categories";
|
|
20
20
|
export type { BasicCategory, BasicWithIcon, BasicWithLogo, Category, InternalLinkCategory, NestedCategory, PhoneCategory, PlaceCategory, ProductCategory, TextCategory, UrlCategory, } from "./domain/models/categories";
|
|
21
|
+
export { circleRing, CIRCLE_DEFAULTS, MAPVX_BRAND_COLOR, isValidCircleConfig, } from "./domain/models/circle";
|
|
22
|
+
export type { CircleConfig, CircleRecord } from "./domain/models/circle";
|
|
21
23
|
export type { CityFilterOption, InstitutionCityFilterOption, ParentPlaceCityFilterOption, } from "./domain/models/cityFilterOption";
|
|
22
24
|
export type { Configuration } from "./domain/models/configuration";
|
|
23
25
|
export type { CssComponent, CssCustomization, CssDefinitions, CssElement, CssScreen, CssTheme, } from "./domain/models/cssCustomization";
|
|
@@ -46,6 +48,7 @@ export type { PlaceResponse } from "./interfaces/placeResponse";
|
|
|
46
48
|
export { loadCustomization } from "./utils/update-css";
|
|
47
49
|
export { OpeningHoursHelper } from "./utils/opening-hours-helper";
|
|
48
50
|
export { isMapVxRequestHostname } from "./utils/mapvxHostname";
|
|
51
|
+
export { injectPreconnects, MAPVX_DEFAULT_PRECONNECT_HOSTS } from "./utils/preconnect";
|
|
49
52
|
/**
|
|
50
53
|
* Function to load default styles
|
|
51
54
|
* @group Utils
|