@mapvx/web-js 1.1.0 → 1.1.1
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/marker.js +6 -0
- package/dist/cjs/domain/models/marker.js.map +1 -1
- package/dist/cjs/index.js +4 -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/utils/preconnect.js +131 -0
- package/dist/cjs/utils/preconnect.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 +1 -0
- package/dist/es/index.d.ts.map +1 -1
- package/dist/es/index.js +1 -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/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 +186 -22
- package/dist/umd/index.js.map +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollbar.js","sourceRoot":"","sources":["../../../src/logger/rollbar.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rollbar.js","sourceRoot":"","sources":["../../../src/logger/rollbar.ts"],"names":[],"mappings":"AAIA,0EAA0E;AAC1E,wEAAwE;AACxE,4EAA4E;AAC5E,wEAAwE;AACxE,MAAM,WAAW,GAAW,OAAO,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,iBAAiB,CAAA;AAExF,MAAM,CAAC,MAAM,cAAc,GAAkB;IAC3C,WAAW,EAAE,kCAAkC;IAC/C,yEAAyE;IACzE,uEAAuE;IACvE,uEAAuE;IACvE,6BAA6B;IAC7B,eAAe,EAAE,KAAK;IACtB,0BAA0B,EAAE,KAAK;IACjC,wDAAwD;IACxD,WAAW,EAAE,OAAO;IACpB,OAAO,EAAE;QACP,WAAW,EAAE,YAAY;QACzB,MAAM,EAAE;YACN,UAAU,EAAE;gBACV,YAAY,EAAE,WAAW;aAC1B;SACF;KACF;CACF,CAAA;AAED,MAAM,UAAU,UAAU,CAAC,GAAG,IAAmB;IAC/C,OAAO,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAA;AAC/D,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hostnames that MapVX maps typically need to talk to during the first
|
|
3
|
+
* paint: vector tiles, sprite, glyphs and indoor tile sources. Exposed so
|
|
4
|
+
* that consumer apps can call `injectPreconnects(MAPVX_DEFAULT_PRECONNECT_HOSTS)`
|
|
5
|
+
* without having to maintain the list themselves.
|
|
6
|
+
*
|
|
7
|
+
* @group Utils
|
|
8
|
+
*/
|
|
9
|
+
export declare const MAPVX_DEFAULT_PRECONNECT_HOSTS: readonly string[];
|
|
10
|
+
/**
|
|
11
|
+
* Injects `<link rel="preconnect">` (and a `<link rel="dns-prefetch">` fallback)
|
|
12
|
+
* tags into `document.head` for the given origins, so the browser starts the
|
|
13
|
+
* DNS + TLS handshake before MapLibre actually requests sprite/glyph/tile
|
|
14
|
+
* resources.
|
|
15
|
+
*
|
|
16
|
+
* Call this as early as possible — ideally before {@link initializeSDK} — to
|
|
17
|
+
* maximize the savings. In real captures this shaves ~150-300 ms off the
|
|
18
|
+
* first-paint cascade.
|
|
19
|
+
*
|
|
20
|
+
* Idempotent: hosts that already have a `<link rel="preconnect" crossorigin>`
|
|
21
|
+
* are skipped. If an existing `preconnect` link is missing `crossorigin`, it
|
|
22
|
+
* is upgraded in place (added `crossorigin="anonymous"`) — without that
|
|
23
|
+
* attribute the warmed socket can't be reused for the CORS tile/font/sprite
|
|
24
|
+
* fetches MapLibre performs, so leaving the existing link untouched would
|
|
25
|
+
* silently defeat the optimization. Existing `crossorigin="use-credentials"`
|
|
26
|
+
* is respected and never overwritten.
|
|
27
|
+
*
|
|
28
|
+
* @param hosts - Origin URLs (`"https://tiles.mapvx.com"`) or bare hostnames
|
|
29
|
+
* (`"tiles.mapvx.com"`, normalized to `https://`). Invalid entries are
|
|
30
|
+
* silently ignored.
|
|
31
|
+
* @returns The origins where the helper made a change — either a new link was
|
|
32
|
+
* appended, or an existing one was upgraded with `crossorigin="anonymous"`.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* import { initializeSDK, injectPreconnects, MAPVX_DEFAULT_PRECONNECT_HOSTS } from "@mapvx/web-js"
|
|
37
|
+
*
|
|
38
|
+
* injectPreconnects(MAPVX_DEFAULT_PRECONNECT_HOSTS)
|
|
39
|
+
* const sdk = initializeSDK(apiKey)
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @group Utils
|
|
43
|
+
*/
|
|
44
|
+
export declare function injectPreconnects(hosts: readonly string[]): string[];
|
|
45
|
+
//# sourceMappingURL=preconnect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preconnect.d.ts","sourceRoot":"","sources":["../../../src/utils/preconnect.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,8BAA8B,EAAE,SAAS,MAAM,EAI3D,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CA+CpE"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hostnames that MapVX maps typically need to talk to during the first
|
|
3
|
+
* paint: vector tiles, sprite, glyphs and indoor tile sources. Exposed so
|
|
4
|
+
* that consumer apps can call `injectPreconnects(MAPVX_DEFAULT_PRECONNECT_HOSTS)`
|
|
5
|
+
* without having to maintain the list themselves.
|
|
6
|
+
*
|
|
7
|
+
* @group Utils
|
|
8
|
+
*/
|
|
9
|
+
export const MAPVX_DEFAULT_PRECONNECT_HOSTS = [
|
|
10
|
+
"https://tiles.mapvx.com",
|
|
11
|
+
"https://api.maptiler.com",
|
|
12
|
+
"https://indoorequals.mapvx.com",
|
|
13
|
+
];
|
|
14
|
+
/**
|
|
15
|
+
* Injects `<link rel="preconnect">` (and a `<link rel="dns-prefetch">` fallback)
|
|
16
|
+
* tags into `document.head` for the given origins, so the browser starts the
|
|
17
|
+
* DNS + TLS handshake before MapLibre actually requests sprite/glyph/tile
|
|
18
|
+
* resources.
|
|
19
|
+
*
|
|
20
|
+
* Call this as early as possible — ideally before {@link initializeSDK} — to
|
|
21
|
+
* maximize the savings. In real captures this shaves ~150-300 ms off the
|
|
22
|
+
* first-paint cascade.
|
|
23
|
+
*
|
|
24
|
+
* Idempotent: hosts that already have a `<link rel="preconnect" crossorigin>`
|
|
25
|
+
* are skipped. If an existing `preconnect` link is missing `crossorigin`, it
|
|
26
|
+
* is upgraded in place (added `crossorigin="anonymous"`) — without that
|
|
27
|
+
* attribute the warmed socket can't be reused for the CORS tile/font/sprite
|
|
28
|
+
* fetches MapLibre performs, so leaving the existing link untouched would
|
|
29
|
+
* silently defeat the optimization. Existing `crossorigin="use-credentials"`
|
|
30
|
+
* is respected and never overwritten.
|
|
31
|
+
*
|
|
32
|
+
* @param hosts - Origin URLs (`"https://tiles.mapvx.com"`) or bare hostnames
|
|
33
|
+
* (`"tiles.mapvx.com"`, normalized to `https://`). Invalid entries are
|
|
34
|
+
* silently ignored.
|
|
35
|
+
* @returns The origins where the helper made a change — either a new link was
|
|
36
|
+
* appended, or an existing one was upgraded with `crossorigin="anonymous"`.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* import { initializeSDK, injectPreconnects, MAPVX_DEFAULT_PRECONNECT_HOSTS } from "@mapvx/web-js"
|
|
41
|
+
*
|
|
42
|
+
* injectPreconnects(MAPVX_DEFAULT_PRECONNECT_HOSTS)
|
|
43
|
+
* const sdk = initializeSDK(apiKey)
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @group Utils
|
|
47
|
+
*/
|
|
48
|
+
export function injectPreconnects(hosts) {
|
|
49
|
+
if (typeof document === "undefined" || !document.head)
|
|
50
|
+
return [];
|
|
51
|
+
if (!Array.isArray(hosts) || hosts.length === 0)
|
|
52
|
+
return [];
|
|
53
|
+
const injected = [];
|
|
54
|
+
for (const raw of hosts) {
|
|
55
|
+
if (typeof raw !== "string" || raw.length === 0)
|
|
56
|
+
continue;
|
|
57
|
+
const origin = normalizeOrigin(raw);
|
|
58
|
+
if (origin === null)
|
|
59
|
+
continue;
|
|
60
|
+
// Check what's already in <head>. We may need to UPGRADE an existing
|
|
61
|
+
// preconnect — server-rendered or hand-authored hints frequently omit
|
|
62
|
+
// `crossorigin`, and a warmed socket without it cannot be reused for
|
|
63
|
+
// the CORS tile/font/sprite fetches that MapLibre performs. Without
|
|
64
|
+
// this branch the optimization would silently no-op when the page
|
|
65
|
+
// already had a partial hint.
|
|
66
|
+
const existingPreconnect = findLinkForOrigin("preconnect", origin);
|
|
67
|
+
let preconnectChanged = false;
|
|
68
|
+
if (existingPreconnect) {
|
|
69
|
+
if (!existingPreconnect.hasAttribute("crossorigin")) {
|
|
70
|
+
existingPreconnect.crossOrigin = "anonymous";
|
|
71
|
+
preconnectChanged = true;
|
|
72
|
+
}
|
|
73
|
+
// If the existing link already has any `crossorigin` value
|
|
74
|
+
// (including `use-credentials`), respect the author's intent and
|
|
75
|
+
// leave it alone.
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
const preconnect = document.createElement("link");
|
|
79
|
+
preconnect.rel = "preconnect";
|
|
80
|
+
preconnect.href = origin;
|
|
81
|
+
preconnect.crossOrigin = "anonymous";
|
|
82
|
+
document.head.appendChild(preconnect);
|
|
83
|
+
preconnectChanged = true;
|
|
84
|
+
}
|
|
85
|
+
// dns-prefetch is a fallback for older browsers that ignore preconnect.
|
|
86
|
+
if (!findLinkForOrigin("dns-prefetch", origin)) {
|
|
87
|
+
const dnsPrefetch = document.createElement("link");
|
|
88
|
+
dnsPrefetch.rel = "dns-prefetch";
|
|
89
|
+
dnsPrefetch.href = origin;
|
|
90
|
+
document.head.appendChild(dnsPrefetch);
|
|
91
|
+
}
|
|
92
|
+
if (preconnectChanged)
|
|
93
|
+
injected.push(origin);
|
|
94
|
+
}
|
|
95
|
+
return injected;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Returns the first `<link rel="${rel}">` in `<head>` whose resolved origin
|
|
99
|
+
* matches `origin`, or null. We compare canonical URL origins instead of
|
|
100
|
+
* the raw `href` attribute text — the same origin can be written as
|
|
101
|
+
* `https://tiles.mapvx.com` or `https://tiles.mapvx.com/`, and a strict
|
|
102
|
+
* attribute selector would miss the second form and inject a duplicate.
|
|
103
|
+
*/
|
|
104
|
+
function findLinkForOrigin(rel, origin) {
|
|
105
|
+
const links = document.head.querySelectorAll(`link[rel="${rel}"]`);
|
|
106
|
+
for (let i = 0; i < links.length; i++) {
|
|
107
|
+
const link = links[i];
|
|
108
|
+
try {
|
|
109
|
+
if (new URL(link.href).origin === origin)
|
|
110
|
+
return link;
|
|
111
|
+
}
|
|
112
|
+
catch (_a) {
|
|
113
|
+
// Malformed href — skip and keep scanning.
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
function normalizeOrigin(raw) {
|
|
119
|
+
try {
|
|
120
|
+
const candidate = /^https?:\/\//i.test(raw) ? raw : `https://${raw}`;
|
|
121
|
+
return new URL(candidate).origin;
|
|
122
|
+
}
|
|
123
|
+
catch (_a) {
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=preconnect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preconnect.js","sourceRoot":"","sources":["../../../src/utils/preconnect.ts"],"names":[],"mappings":"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"}
|
package/dist/umd/index.js
CHANGED
|
@@ -5728,6 +5728,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
5728
5728
|
FetchHttpClient: () => (/* reexport */ FetchHttpClient),
|
|
5729
5729
|
Institution: () => (/* reexport */ Institution),
|
|
5730
5730
|
LRUCache: () => (/* reexport */ LRUCache),
|
|
5731
|
+
MAPVX_DEFAULT_PRECONNECT_HOSTS: () => (/* reexport */ MAPVX_DEFAULT_PRECONNECT_HOSTS),
|
|
5731
5732
|
MVXPlace: () => (/* reexport */ place_MVXPlace),
|
|
5732
5733
|
MVXRoute: () => (/* reexport */ MVXRoute),
|
|
5733
5734
|
MVXRouteLeg: () => (/* reexport */ MVXRouteLeg),
|
|
@@ -5740,6 +5741,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
5740
5741
|
UnitSystem: () => (/* reexport */ UnitSystem),
|
|
5741
5742
|
createRouteAnimationIconDataUrl: () => (/* reexport */ createRouteAnimationIconDataUrl),
|
|
5742
5743
|
initializeSDK: () => (/* reexport */ initializeSDK),
|
|
5744
|
+
injectPreconnects: () => (/* reexport */ injectPreconnects),
|
|
5743
5745
|
isBasicWithIcon: () => (/* reexport */ isBasicWithIcon),
|
|
5744
5746
|
isBasicWithLogo: () => (/* reexport */ isBasicWithLogo),
|
|
5745
5747
|
isMapVxRequestHostname: () => (/* reexport */ isMapVxRequestHostname),
|
|
@@ -6784,18 +6786,26 @@ var countly_default = /*#__PURE__*/__webpack_require__.n(countly);
|
|
|
6784
6786
|
var rollbar_umd_min = __webpack_require__(916);
|
|
6785
6787
|
var rollbar_umd_min_default = /*#__PURE__*/__webpack_require__.n(rollbar_umd_min);
|
|
6786
6788
|
;// ./src/logger/rollbar.ts
|
|
6789
|
+
// VERSION is a webpack DefinePlugin constant, substituted only in the UMD
|
|
6790
|
+
// bundle. The tsc-built ES/CJS outputs keep it as a bare global, so the
|
|
6791
|
+
// typeof guard makes the lookup safe everywhere; the version placeholder is
|
|
6792
|
+
// replaced with the package version by scripts/inject-build-defines.js.
|
|
6793
|
+
var SDK_VERSION = true ? "1.1.1" : 0;
|
|
6787
6794
|
var _rollbarConfig = {
|
|
6788
|
-
accessToken: "
|
|
6789
|
-
|
|
6790
|
-
|
|
6795
|
+
accessToken: "28279d52df43411ebd138c2bee0ab1df",
|
|
6796
|
+
// Only report what the SDK logs explicitly via logError. Capturing every
|
|
6797
|
+
// uncaught error / unhandled rejection on the host page floods Rollbar
|
|
6798
|
+
// with items from third-party code (e.g. Countly, the host app itself)
|
|
6799
|
+
// that the SDK does not own.
|
|
6800
|
+
captureUncaught: false,
|
|
6801
|
+
captureUnhandledRejections: false,
|
|
6802
|
+
// Drop anything below error level (debug/info/warning).
|
|
6803
|
+
reportLevel: "error",
|
|
6791
6804
|
payload: {
|
|
6792
|
-
environment: "
|
|
6793
|
-
// context: 'rollbar/test'
|
|
6805
|
+
environment: "production",
|
|
6794
6806
|
client: {
|
|
6795
6807
|
javascript: {
|
|
6796
|
-
code_version:
|
|
6797
|
-
// source_map_enabled: true,
|
|
6798
|
-
// guess_uncaught_frames: true
|
|
6808
|
+
code_version: SDK_VERSION
|
|
6799
6809
|
}
|
|
6800
6810
|
}
|
|
6801
6811
|
}
|
|
@@ -6822,19 +6832,30 @@ var logger_countly = {
|
|
|
6822
6832
|
apiKey: "f0c8d3b96d336e857a8628f49dd1baf7d7add0e9",
|
|
6823
6833
|
url: "https://countly.lazarillo.app"
|
|
6824
6834
|
};
|
|
6835
|
+
// DEBUG and VERSION are webpack DefinePlugin constants, substituted only in
|
|
6836
|
+
// the UMD bundle. The tsc-built ES/CJS outputs keep them as bare globals, so
|
|
6837
|
+
// reading them directly throws ReferenceError in consumers of those builds.
|
|
6838
|
+
// The typeof guards make the lookup safe everywhere; the version placeholder
|
|
6839
|
+
// is replaced with the package version by scripts/inject-build-defines.js.
|
|
6840
|
+
var IS_DEBUG = true ? false : 0;
|
|
6841
|
+
var logger_SDK_VERSION = true ? "1.1.1" : 0;
|
|
6825
6842
|
var Logger = /*#__PURE__*/function () {
|
|
6826
6843
|
function Logger() {
|
|
6827
6844
|
logger_classCallCheck(this, Logger);
|
|
6828
|
-
if (
|
|
6829
|
-
|
|
6845
|
+
if (IS_DEBUG) {
|
|
6846
|
+
console.log("Initializing Countly");
|
|
6847
|
+
this.countly = {
|
|
6848
|
+
q: []
|
|
6849
|
+
};
|
|
6850
|
+
} else {
|
|
6830
6851
|
var _Countly$q;
|
|
6831
6852
|
this.rollbar = new (rollbar_umd_min_default())(_rollbarConfig);
|
|
6832
6853
|
countly_default().init({
|
|
6833
6854
|
app_key: logger_countly.apiKey,
|
|
6834
6855
|
url: logger_countly.url,
|
|
6835
|
-
app_version:
|
|
6856
|
+
app_version: logger_SDK_VERSION,
|
|
6836
6857
|
session_update: 10,
|
|
6837
|
-
debug:
|
|
6858
|
+
debug: IS_DEBUG,
|
|
6838
6859
|
require_consent: false,
|
|
6839
6860
|
namespace: "SDK JS"
|
|
6840
6861
|
});
|
|
@@ -6846,8 +6867,9 @@ var Logger = /*#__PURE__*/function () {
|
|
|
6846
6867
|
return logger_createClass(Logger, [{
|
|
6847
6868
|
key: "logEvent",
|
|
6848
6869
|
value: function logEvent(eventName, eventSegmentation) {
|
|
6849
|
-
if (
|
|
6850
|
-
|
|
6870
|
+
if (IS_DEBUG) {
|
|
6871
|
+
console.log(eventName, eventSegmentation);
|
|
6872
|
+
} else {
|
|
6851
6873
|
this.countly.q.push(["add_event", {
|
|
6852
6874
|
key: eventName,
|
|
6853
6875
|
segmentation: eventSegmentation
|
|
@@ -6857,14 +6879,18 @@ var Logger = /*#__PURE__*/function () {
|
|
|
6857
6879
|
}, {
|
|
6858
6880
|
key: "logDebug",
|
|
6859
6881
|
value: function logDebug() {
|
|
6860
|
-
if (
|
|
6861
|
-
|
|
6882
|
+
if (IS_DEBUG) {
|
|
6883
|
+
var _console;
|
|
6884
|
+
(_console = console).log.apply(_console, arguments);
|
|
6885
|
+
}
|
|
6862
6886
|
}
|
|
6863
6887
|
}, {
|
|
6864
6888
|
key: "logWarning",
|
|
6865
6889
|
value: function logWarning() {
|
|
6866
|
-
if (
|
|
6867
|
-
|
|
6890
|
+
if (IS_DEBUG) {
|
|
6891
|
+
var _console2;
|
|
6892
|
+
(_console2 = console).warn.apply(_console2, arguments);
|
|
6893
|
+
}
|
|
6868
6894
|
}
|
|
6869
6895
|
}, {
|
|
6870
6896
|
key: "logError",
|
|
@@ -6872,8 +6898,10 @@ var Logger = /*#__PURE__*/function () {
|
|
|
6872
6898
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
6873
6899
|
args[_key] = arguments[_key];
|
|
6874
6900
|
}
|
|
6875
|
-
if (
|
|
6876
|
-
|
|
6901
|
+
if (IS_DEBUG) {
|
|
6902
|
+
var _console3;
|
|
6903
|
+
(_console3 = console).error.apply(_console3, args);
|
|
6904
|
+
} else {
|
|
6877
6905
|
var _this$rollbar;
|
|
6878
6906
|
(_this$rollbar = this.rollbar) === null || _this$rollbar === void 0 || _this$rollbar.error.apply(_this$rollbar, args);
|
|
6879
6907
|
}
|
|
@@ -6882,8 +6910,7 @@ var Logger = /*#__PURE__*/function () {
|
|
|
6882
6910
|
key: "debugLog",
|
|
6883
6911
|
value: function debugLog() {
|
|
6884
6912
|
var _console4;
|
|
6885
|
-
if (
|
|
6886
|
-
{}
|
|
6913
|
+
if (IS_DEBUG) (_console4 = console).log.apply(_console4, arguments);
|
|
6887
6914
|
}
|
|
6888
6915
|
}], [{
|
|
6889
6916
|
key: "getInstance",
|
|
@@ -7569,6 +7596,9 @@ var MarkerAttribute = /*#__PURE__*/function (_Marker) {
|
|
|
7569
7596
|
_this.setLngLat([markerConfig.coordinate.lng, markerConfig.coordinate.lat]);
|
|
7570
7597
|
_this.setRotationAlignment((_markerConfig$rotatio = markerConfig.rotationAlignment) !== null && _markerConfig$rotatio !== void 0 ? _markerConfig$rotatio : "viewport");
|
|
7571
7598
|
_this.setPitchAlignment("viewport");
|
|
7599
|
+
if (typeof markerConfig.rotation === "number") {
|
|
7600
|
+
_this.setRotation(markerConfig.rotation);
|
|
7601
|
+
}
|
|
7572
7602
|
_this.id = (_markerConfig$id = markerConfig.id) !== null && _markerConfig$id !== void 0 ? _markerConfig$id : generateHexadecimalKey();
|
|
7573
7603
|
_this.coordinate = markerConfig.coordinate;
|
|
7574
7604
|
_this.floorId = (_markerConfig$floorId = markerConfig.floorId) !== null && _markerConfig$floorId !== void 0 ? _markerConfig$floorId : "";
|
|
@@ -7625,6 +7655,9 @@ var MarkerAttribute = /*#__PURE__*/function (_Marker) {
|
|
|
7625
7655
|
}
|
|
7626
7656
|
this.setRotationAlignment((_marker$rotationAlign = marker.rotationAlignment) !== null && _marker$rotationAlign !== void 0 ? _marker$rotationAlign : "viewport");
|
|
7627
7657
|
this.setPitchAlignment("viewport");
|
|
7658
|
+
if (typeof marker.rotation === "number") {
|
|
7659
|
+
this.setRotation(marker.rotation);
|
|
7660
|
+
}
|
|
7628
7661
|
}
|
|
7629
7662
|
|
|
7630
7663
|
/**
|
|
@@ -17054,6 +17087,136 @@ function is24Hours(openingTime) {
|
|
|
17054
17087
|
// Check if open is "00:00" and close is "24:00" or "00:00"
|
|
17055
17088
|
return open === "00:00" && close === "24:00" || open === "00:00" && close === "00:00";
|
|
17056
17089
|
}
|
|
17090
|
+
;// ./src/utils/preconnect.ts
|
|
17091
|
+
function preconnect_createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = preconnect_unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
17092
|
+
function preconnect_unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return preconnect_arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? preconnect_arrayLikeToArray(r, a) : void 0; } }
|
|
17093
|
+
function preconnect_arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
17094
|
+
/**
|
|
17095
|
+
* Hostnames that MapVX maps typically need to talk to during the first
|
|
17096
|
+
* paint: vector tiles, sprite, glyphs and indoor tile sources. Exposed so
|
|
17097
|
+
* that consumer apps can call `injectPreconnects(MAPVX_DEFAULT_PRECONNECT_HOSTS)`
|
|
17098
|
+
* without having to maintain the list themselves.
|
|
17099
|
+
*
|
|
17100
|
+
* @group Utils
|
|
17101
|
+
*/
|
|
17102
|
+
var MAPVX_DEFAULT_PRECONNECT_HOSTS = ["https://tiles.mapvx.com", "https://api.maptiler.com", "https://indoorequals.mapvx.com"];
|
|
17103
|
+
|
|
17104
|
+
/**
|
|
17105
|
+
* Injects `<link rel="preconnect">` (and a `<link rel="dns-prefetch">` fallback)
|
|
17106
|
+
* tags into `document.head` for the given origins, so the browser starts the
|
|
17107
|
+
* DNS + TLS handshake before MapLibre actually requests sprite/glyph/tile
|
|
17108
|
+
* resources.
|
|
17109
|
+
*
|
|
17110
|
+
* Call this as early as possible — ideally before {@link initializeSDK} — to
|
|
17111
|
+
* maximize the savings. In real captures this shaves ~150-300 ms off the
|
|
17112
|
+
* first-paint cascade.
|
|
17113
|
+
*
|
|
17114
|
+
* Idempotent: hosts that already have a `<link rel="preconnect" crossorigin>`
|
|
17115
|
+
* are skipped. If an existing `preconnect` link is missing `crossorigin`, it
|
|
17116
|
+
* is upgraded in place (added `crossorigin="anonymous"`) — without that
|
|
17117
|
+
* attribute the warmed socket can't be reused for the CORS tile/font/sprite
|
|
17118
|
+
* fetches MapLibre performs, so leaving the existing link untouched would
|
|
17119
|
+
* silently defeat the optimization. Existing `crossorigin="use-credentials"`
|
|
17120
|
+
* is respected and never overwritten.
|
|
17121
|
+
*
|
|
17122
|
+
* @param hosts - Origin URLs (`"https://tiles.mapvx.com"`) or bare hostnames
|
|
17123
|
+
* (`"tiles.mapvx.com"`, normalized to `https://`). Invalid entries are
|
|
17124
|
+
* silently ignored.
|
|
17125
|
+
* @returns The origins where the helper made a change — either a new link was
|
|
17126
|
+
* appended, or an existing one was upgraded with `crossorigin="anonymous"`.
|
|
17127
|
+
*
|
|
17128
|
+
* @example
|
|
17129
|
+
* ```ts
|
|
17130
|
+
* import { initializeSDK, injectPreconnects, MAPVX_DEFAULT_PRECONNECT_HOSTS } from "@mapvx/web-js"
|
|
17131
|
+
*
|
|
17132
|
+
* injectPreconnects(MAPVX_DEFAULT_PRECONNECT_HOSTS)
|
|
17133
|
+
* const sdk = initializeSDK(apiKey)
|
|
17134
|
+
* ```
|
|
17135
|
+
*
|
|
17136
|
+
* @group Utils
|
|
17137
|
+
*/
|
|
17138
|
+
function injectPreconnects(hosts) {
|
|
17139
|
+
if (typeof document === "undefined" || !document.head) return [];
|
|
17140
|
+
if (!Array.isArray(hosts) || hosts.length === 0) return [];
|
|
17141
|
+
var injected = [];
|
|
17142
|
+
var _iterator = preconnect_createForOfIteratorHelper(hosts),
|
|
17143
|
+
_step;
|
|
17144
|
+
try {
|
|
17145
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
17146
|
+
var raw = _step.value;
|
|
17147
|
+
if (typeof raw !== "string" || raw.length === 0) continue;
|
|
17148
|
+
var origin = normalizeOrigin(raw);
|
|
17149
|
+
if (origin === null) continue;
|
|
17150
|
+
|
|
17151
|
+
// Check what's already in <head>. We may need to UPGRADE an existing
|
|
17152
|
+
// preconnect — server-rendered or hand-authored hints frequently omit
|
|
17153
|
+
// `crossorigin`, and a warmed socket without it cannot be reused for
|
|
17154
|
+
// the CORS tile/font/sprite fetches that MapLibre performs. Without
|
|
17155
|
+
// this branch the optimization would silently no-op when the page
|
|
17156
|
+
// already had a partial hint.
|
|
17157
|
+
var existingPreconnect = findLinkForOrigin("preconnect", origin);
|
|
17158
|
+
var preconnectChanged = false;
|
|
17159
|
+
if (existingPreconnect) {
|
|
17160
|
+
if (!existingPreconnect.hasAttribute("crossorigin")) {
|
|
17161
|
+
existingPreconnect.crossOrigin = "anonymous";
|
|
17162
|
+
preconnectChanged = true;
|
|
17163
|
+
}
|
|
17164
|
+
// If the existing link already has any `crossorigin` value
|
|
17165
|
+
// (including `use-credentials`), respect the author's intent and
|
|
17166
|
+
// leave it alone.
|
|
17167
|
+
} else {
|
|
17168
|
+
var preconnect = document.createElement("link");
|
|
17169
|
+
preconnect.rel = "preconnect";
|
|
17170
|
+
preconnect.href = origin;
|
|
17171
|
+
preconnect.crossOrigin = "anonymous";
|
|
17172
|
+
document.head.appendChild(preconnect);
|
|
17173
|
+
preconnectChanged = true;
|
|
17174
|
+
}
|
|
17175
|
+
|
|
17176
|
+
// dns-prefetch is a fallback for older browsers that ignore preconnect.
|
|
17177
|
+
if (!findLinkForOrigin("dns-prefetch", origin)) {
|
|
17178
|
+
var dnsPrefetch = document.createElement("link");
|
|
17179
|
+
dnsPrefetch.rel = "dns-prefetch";
|
|
17180
|
+
dnsPrefetch.href = origin;
|
|
17181
|
+
document.head.appendChild(dnsPrefetch);
|
|
17182
|
+
}
|
|
17183
|
+
if (preconnectChanged) injected.push(origin);
|
|
17184
|
+
}
|
|
17185
|
+
} catch (err) {
|
|
17186
|
+
_iterator.e(err);
|
|
17187
|
+
} finally {
|
|
17188
|
+
_iterator.f();
|
|
17189
|
+
}
|
|
17190
|
+
return injected;
|
|
17191
|
+
}
|
|
17192
|
+
|
|
17193
|
+
/**
|
|
17194
|
+
* Returns the first `<link rel="${rel}">` in `<head>` whose resolved origin
|
|
17195
|
+
* matches `origin`, or null. We compare canonical URL origins instead of
|
|
17196
|
+
* the raw `href` attribute text — the same origin can be written as
|
|
17197
|
+
* `https://tiles.mapvx.com` or `https://tiles.mapvx.com/`, and a strict
|
|
17198
|
+
* attribute selector would miss the second form and inject a duplicate.
|
|
17199
|
+
*/
|
|
17200
|
+
function findLinkForOrigin(rel, origin) {
|
|
17201
|
+
var links = document.head.querySelectorAll("link[rel=\"".concat(rel, "\"]"));
|
|
17202
|
+
for (var i = 0; i < links.length; i++) {
|
|
17203
|
+
var link = links[i];
|
|
17204
|
+
try {
|
|
17205
|
+
if (new URL(link.href).origin === origin) return link;
|
|
17206
|
+
} catch (_unused) {
|
|
17207
|
+
// Malformed href — skip and keep scanning.
|
|
17208
|
+
}
|
|
17209
|
+
}
|
|
17210
|
+
return null;
|
|
17211
|
+
}
|
|
17212
|
+
function normalizeOrigin(raw) {
|
|
17213
|
+
try {
|
|
17214
|
+
var candidate = /^https?:\/\//i.test(raw) ? raw : "https://".concat(raw);
|
|
17215
|
+
return new URL(candidate).origin;
|
|
17216
|
+
} catch (_unused2) {
|
|
17217
|
+
return null;
|
|
17218
|
+
}
|
|
17219
|
+
}
|
|
17057
17220
|
;// ./src/index.ts
|
|
17058
17221
|
// ─── Domain Ports (interfaces) ───────────────────────────────────────────────
|
|
17059
17222
|
|
|
@@ -17135,6 +17298,7 @@ function is24Hours(openingTime) {
|
|
|
17135
17298
|
|
|
17136
17299
|
|
|
17137
17300
|
|
|
17301
|
+
|
|
17138
17302
|
/**
|
|
17139
17303
|
* Function to load default styles
|
|
17140
17304
|
* @group Utils
|