@mapvx/web-js 3.5.1 → 4.0.0-dev.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.
Files changed (182) hide show
  1. package/README.md +6 -1
  2. package/dist/cjs/index.js +2 -95
  3. package/dist/cjs/index.js.LICENSE.txt +1 -0
  4. package/dist/cjs/index.js.map +1 -1
  5. package/dist/es/controllers/routeController.d.ts.map +1 -1
  6. package/dist/es/controllers/routeController.js +25 -8
  7. package/dist/es/controllers/routeController.js.map +1 -1
  8. package/dist/es/logger/sentry.js +1 -1
  9. package/dist/es/map/fitCamera.d.ts +7 -5
  10. package/dist/es/map/fitCamera.d.ts.map +1 -1
  11. package/dist/es/map/fitCamera.js +1 -1
  12. package/dist/es/map/fitCamera.js.map +1 -1
  13. package/dist/es/map/liveMapFitTransform.d.ts +104 -0
  14. package/dist/es/map/liveMapFitTransform.d.ts.map +1 -0
  15. package/dist/es/map/liveMapFitTransform.js +185 -0
  16. package/dist/es/map/liveMapFitTransform.js.map +1 -0
  17. package/dist/es/map/map.d.ts.map +1 -1
  18. package/dist/es/map/map.js +15 -7
  19. package/dist/es/map/map.js.map +1 -1
  20. package/dist/umd/index.js +1133 -117
  21. package/dist/umd/index.js.map +1 -1
  22. package/dist/umd/styles.css +1 -1
  23. package/dist/umd/styles.css.map +1 -1
  24. package/package.json +7 -7
  25. package/dist/cjs/assets/icons.js +0 -85
  26. package/dist/cjs/assets/icons.js.map +0 -1
  27. package/dist/cjs/config/draco.js +0 -15
  28. package/dist/cjs/config/draco.js.map +0 -1
  29. package/dist/cjs/config/sdkConfig.js +0 -3
  30. package/dist/cjs/config/sdkConfig.js.map +0 -1
  31. package/dist/cjs/controllers/markerLayoutController.js +0 -359
  32. package/dist/cjs/controllers/markerLayoutController.js.map +0 -1
  33. package/dist/cjs/controllers/routeController.js +0 -1549
  34. package/dist/cjs/controllers/routeController.js.map +0 -1
  35. package/dist/cjs/domain/models/_internal.js +0 -14
  36. package/dist/cjs/domain/models/_internal.js.map +0 -1
  37. package/dist/cjs/domain/models/_rtl.js +0 -10
  38. package/dist/cjs/domain/models/_rtl.js.map +0 -1
  39. package/dist/cjs/domain/models/animation.js +0 -64
  40. package/dist/cjs/domain/models/animation.js.map +0 -1
  41. package/dist/cjs/domain/models/banner.js +0 -24
  42. package/dist/cjs/domain/models/banner.js.map +0 -1
  43. package/dist/cjs/domain/models/campaign.js +0 -73
  44. package/dist/cjs/domain/models/campaign.js.map +0 -1
  45. package/dist/cjs/domain/models/categories.js +0 -37
  46. package/dist/cjs/domain/models/categories.js.map +0 -1
  47. package/dist/cjs/domain/models/circle.js +0 -253
  48. package/dist/cjs/domain/models/circle.js.map +0 -1
  49. package/dist/cjs/domain/models/cityFilterOption.js +0 -3
  50. package/dist/cjs/domain/models/cityFilterOption.js.map +0 -1
  51. package/dist/cjs/domain/models/configuration.js +0 -3
  52. package/dist/cjs/domain/models/configuration.js.map +0 -1
  53. package/dist/cjs/domain/models/cssCustomization.js +0 -3
  54. package/dist/cjs/domain/models/cssCustomization.js.map +0 -1
  55. package/dist/cjs/domain/models/fitOptions.js +0 -3
  56. package/dist/cjs/domain/models/fitOptions.js.map +0 -1
  57. package/dist/cjs/domain/models/innerFloors.js +0 -3
  58. package/dist/cjs/domain/models/innerFloors.js.map +0 -1
  59. package/dist/cjs/domain/models/institution.js +0 -45
  60. package/dist/cjs/domain/models/institution.js.map +0 -1
  61. package/dist/cjs/domain/models/latLng.js +0 -3
  62. package/dist/cjs/domain/models/latLng.js.map +0 -1
  63. package/dist/cjs/domain/models/location.js +0 -3
  64. package/dist/cjs/domain/models/location.js.map +0 -1
  65. package/dist/cjs/domain/models/loggeable.js +0 -52
  66. package/dist/cjs/domain/models/loggeable.js.map +0 -1
  67. package/dist/cjs/domain/models/mapCamera.js +0 -3
  68. package/dist/cjs/domain/models/mapCamera.js.map +0 -1
  69. package/dist/cjs/domain/models/mapConfig.js +0 -37
  70. package/dist/cjs/domain/models/mapConfig.js.map +0 -1
  71. package/dist/cjs/domain/models/marker.js +0 -502
  72. package/dist/cjs/domain/models/marker.js.map +0 -1
  73. package/dist/cjs/domain/models/multilanguage.js +0 -17
  74. package/dist/cjs/domain/models/multilanguage.js.map +0 -1
  75. package/dist/cjs/domain/models/openingHours.js +0 -3
  76. package/dist/cjs/domain/models/openingHours.js.map +0 -1
  77. package/dist/cjs/domain/models/place.js +0 -127
  78. package/dist/cjs/domain/models/place.js.map +0 -1
  79. package/dist/cjs/domain/models/platform.js +0 -3
  80. package/dist/cjs/domain/models/platform.js.map +0 -1
  81. package/dist/cjs/domain/models/popover.js +0 -3
  82. package/dist/cjs/domain/models/popover.js.map +0 -1
  83. package/dist/cjs/domain/models/product.js +0 -3
  84. package/dist/cjs/domain/models/product.js.map +0 -1
  85. package/dist/cjs/domain/models/property.js +0 -104
  86. package/dist/cjs/domain/models/property.js.map +0 -1
  87. package/dist/cjs/domain/models/route.js +0 -166
  88. package/dist/cjs/domain/models/route.js.map +0 -1
  89. package/dist/cjs/domain/models/routeConfiguration.js +0 -82
  90. package/dist/cjs/domain/models/routeConfiguration.js.map +0 -1
  91. package/dist/cjs/domain/models/routeInstance.js +0 -30
  92. package/dist/cjs/domain/models/routeInstance.js.map +0 -1
  93. package/dist/cjs/domain/models/routeStyle.js +0 -3
  94. package/dist/cjs/domain/models/routeStyle.js.map +0 -1
  95. package/dist/cjs/domain/models/scene3D.js +0 -3
  96. package/dist/cjs/domain/models/scene3D.js.map +0 -1
  97. package/dist/cjs/domain/models/transport.js +0 -22
  98. package/dist/cjs/domain/models/transport.js.map +0 -1
  99. package/dist/cjs/domain/ports/ICache.js +0 -3
  100. package/dist/cjs/domain/ports/ICache.js.map +0 -1
  101. package/dist/cjs/domain/ports/IHttpClient.js +0 -3
  102. package/dist/cjs/domain/ports/IHttpClient.js.map +0 -1
  103. package/dist/cjs/domain/ports/ILogger.js +0 -23
  104. package/dist/cjs/domain/ports/ILogger.js.map +0 -1
  105. package/dist/cjs/domain/ports/index.js +0 -10
  106. package/dist/cjs/domain/ports/index.js.map +0 -1
  107. package/dist/cjs/infrastructure/cache/CacheManager.js +0 -258
  108. package/dist/cjs/infrastructure/cache/CacheManager.js.map +0 -1
  109. package/dist/cjs/infrastructure/cache/LRUCache.js +0 -153
  110. package/dist/cjs/infrastructure/cache/LRUCache.js.map +0 -1
  111. package/dist/cjs/infrastructure/cache/PersistentCache.js +0 -168
  112. package/dist/cjs/infrastructure/cache/PersistentCache.js.map +0 -1
  113. package/dist/cjs/infrastructure/cache/cacheConfig.js +0 -70
  114. package/dist/cjs/infrastructure/cache/cacheConfig.js.map +0 -1
  115. package/dist/cjs/infrastructure/http/FetchHttpClient.js +0 -75
  116. package/dist/cjs/infrastructure/http/FetchHttpClient.js.map +0 -1
  117. package/dist/cjs/infrastructure/logging/MVXLogger.js +0 -80
  118. package/dist/cjs/infrastructure/logging/MVXLogger.js.map +0 -1
  119. package/dist/cjs/interfaces/cache.js +0 -3
  120. package/dist/cjs/interfaces/cache.js.map +0 -1
  121. package/dist/cjs/interfaces/healthResponse.js +0 -3
  122. package/dist/cjs/interfaces/healthResponse.js.map +0 -1
  123. package/dist/cjs/interfaces/institutionResponse.js +0 -3
  124. package/dist/cjs/interfaces/institutionResponse.js.map +0 -1
  125. package/dist/cjs/interfaces/metadata.js +0 -3
  126. package/dist/cjs/interfaces/metadata.js.map +0 -1
  127. package/dist/cjs/interfaces/placeResponse.js +0 -3
  128. package/dist/cjs/interfaces/placeResponse.js.map +0 -1
  129. package/dist/cjs/interfaces/routeCacheResponse.js +0 -3
  130. package/dist/cjs/interfaces/routeCacheResponse.js.map +0 -1
  131. package/dist/cjs/interfaces/routeResponse.js +0 -3
  132. package/dist/cjs/interfaces/routeResponse.js.map +0 -1
  133. package/dist/cjs/interfaces/styleResponse.js +0 -3
  134. package/dist/cjs/interfaces/styleResponse.js.map +0 -1
  135. package/dist/cjs/logger/logger.js +0 -78
  136. package/dist/cjs/logger/logger.js.map +0 -1
  137. package/dist/cjs/logger/sentry.js +0 -81
  138. package/dist/cjs/logger/sentry.js.map +0 -1
  139. package/dist/cjs/map/fitCamera.js +0 -124
  140. package/dist/cjs/map/fitCamera.js.map +0 -1
  141. package/dist/cjs/map/map.js +0 -2755
  142. package/dist/cjs/map/map.js.map +0 -1
  143. package/dist/cjs/map/mapInteractionOptions.js +0 -73
  144. package/dist/cjs/map/mapInteractionOptions.js.map +0 -1
  145. package/dist/cjs/map/scene3DController.js +0 -849
  146. package/dist/cjs/map/scene3DController.js.map +0 -1
  147. package/dist/cjs/repository/repository.js +0 -694
  148. package/dist/cjs/repository/repository.js.map +0 -1
  149. package/dist/cjs/repository/requester.js +0 -771
  150. package/dist/cjs/repository/requester.js.map +0 -1
  151. package/dist/cjs/sdk.js +0 -438
  152. package/dist/cjs/sdk.js.map +0 -1
  153. package/dist/cjs/utils/3d.js +0 -245
  154. package/dist/cjs/utils/3d.js.map +0 -1
  155. package/dist/cjs/utils/deckLayers.js +0 -153
  156. package/dist/cjs/utils/deckLayers.js.map +0 -1
  157. package/dist/cjs/utils/error.js +0 -19
  158. package/dist/cjs/utils/error.js.map +0 -1
  159. package/dist/cjs/utils/images.js +0 -25
  160. package/dist/cjs/utils/images.js.map +0 -1
  161. package/dist/cjs/utils/loadGlb.js +0 -190
  162. package/dist/cjs/utils/loadGlb.js.map +0 -1
  163. package/dist/cjs/utils/mapvxHostname.js +0 -21
  164. package/dist/cjs/utils/mapvxHostname.js.map +0 -1
  165. package/dist/cjs/utils/nav-functions.js +0 -150
  166. package/dist/cjs/utils/nav-functions.js.map +0 -1
  167. package/dist/cjs/utils/opening-hours-helper.js +0 -914
  168. package/dist/cjs/utils/opening-hours-helper.js.map +0 -1
  169. package/dist/cjs/utils/preconnect.js +0 -131
  170. package/dist/cjs/utils/preconnect.js.map +0 -1
  171. package/dist/cjs/utils/route-utils.js +0 -57
  172. package/dist/cjs/utils/route-utils.js.map +0 -1
  173. package/dist/cjs/utils/semaphore.js +0 -143
  174. package/dist/cjs/utils/semaphore.js.map +0 -1
  175. package/dist/cjs/utils/three.js +0 -113
  176. package/dist/cjs/utils/three.js.map +0 -1
  177. package/dist/cjs/utils/threeScene.js +0 -126
  178. package/dist/cjs/utils/threeScene.js.map +0 -1
  179. package/dist/cjs/utils/update-css.js +0 -76
  180. package/dist/cjs/utils/update-css.js.map +0 -1
  181. package/dist/cjs/utils/utils.js +0 -104
  182. package/dist/cjs/utils/utils.js.map +0 -1
@@ -1,502 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MarkerAttribute = exports.MarkerUtils = exports.DEFAULT_MAX_LABEL_WIDTH_PX = exports.DEFAULT_ICON_SIZE_PX = exports.TextPosition = void 0;
4
- const maplibre_gl_1 = require("maplibre-gl");
5
- const utils_1 = require("../../utils/utils");
6
- /**
7
- * Represents the possible placements of text elements in a marker container.
8
- * Defines the relative positioning of text labels around marker icons.
9
- *
10
- * @example
11
- * ```typescript
12
- * const markerConfig: MarkerConfig = {
13
- * text: "Coffee Shop",
14
- * textPosition: TextPosition.right,
15
- * coordinate: { lat: 40.7128, lng: -74.0060 }
16
- * };
17
- * ```
18
- *
19
- * @group Markers
20
- */
21
- var TextPosition;
22
- (function (TextPosition) {
23
- /** Text positioned to the left of the icon */
24
- TextPosition[TextPosition["left"] = 0] = "left";
25
- /** Text positioned to the right of the icon */
26
- TextPosition[TextPosition["right"] = 1] = "right";
27
- /** Text positioned above the icon */
28
- TextPosition[TextPosition["top"] = 2] = "top";
29
- /** Text positioned below the icon */
30
- TextPosition[TextPosition["bottom"] = 3] = "bottom";
31
- })(TextPosition || (exports.TextPosition = TextPosition = {}));
32
- /**
33
- * Fallback icon width/height, in pixels, used whenever a marker is created
34
- * without explicit `iconProperties`.
35
- *
36
- * @group Markers
37
- */
38
- exports.DEFAULT_ICON_SIZE_PX = 40;
39
- /**
40
- * Fallback maximum label width, in pixels, used whenever neither the marker
41
- * nor the map's `markerLayout` configuration specifies one.
42
- *
43
- * @group Markers
44
- */
45
- exports.DEFAULT_MAX_LABEL_WIDTH_PX = 200;
46
- /**
47
- * Utility class for creating and manipulating marker elements on a map.
48
- * Provides static methods for marker element creation and styling.
49
- */
50
- class MarkerUtils {
51
- /**
52
- * Creates a container element for the marker and adds the icon and text
53
- * according to the properties specified in the `MarkerConfig` object.
54
- *
55
- * @param marker - `MarkerConfig` object containing the marker configuration
56
- * @returns Marker container element ready to be added to the map
57
- *
58
- * @example
59
- * ```typescript
60
- * const markerElement = MarkerUtils.createMarkerElement(markerConfig);
61
- * map.addLayer(markerElement);
62
- * ```
63
- */
64
- static createMarkerElement(marker) {
65
- var _a, _b, _c, _d;
66
- const markerContainer = document.createElement("div");
67
- // Configure specific marker dimensions
68
- const iconWidth = (_b = (_a = marker.iconProperties) === null || _a === void 0 ? void 0 : _a.width) !== null && _b !== void 0 ? _b : exports.DEFAULT_ICON_SIZE_PX;
69
- const iconHeight = (_d = (_c = marker.iconProperties) === null || _c === void 0 ? void 0 : _c.height) !== null && _d !== void 0 ? _d : exports.DEFAULT_ICON_SIZE_PX;
70
- // Apply base class. The container's own box is always the icon's box (or
71
- // the custom `element`'s natural box) — the label is positioned
72
- // absolutely (see .text-container in styles.css) so it never affects
73
- // this box, which is exactly what MapLibre anchors the marker to.
74
- markerContainer.className = "mapvx-marker";
75
- markerContainer.addEventListener("click", () => {
76
- var _a;
77
- (_a = marker.onClick) === null || _a === void 0 ? void 0 : _a.call(marker);
78
- });
79
- // Custom element replaces icon entirely; the label (if any) still gets
80
- // appended, positioned absolutely relative to it.
81
- if (marker.element) {
82
- // Only force a box when the caller declared the footprint. Otherwise
83
- // the container is left to size itself to the custom element, and
84
- // automatic label collision avoidance measures that real box from the
85
- // DOM instead of assuming the default icon size — see
86
- // {@link MarkerAttribute.measureIconFromDom}.
87
- if (marker.iconProperties) {
88
- markerContainer.style.width = `${iconWidth}px`;
89
- markerContainer.style.height = `${iconHeight}px`;
90
- }
91
- markerContainer.appendChild(marker.element);
92
- return this.setAndCreateText(marker, markerContainer);
93
- }
94
- markerContainer.style.width = `${iconWidth}px`;
95
- markerContainer.style.height = `${iconHeight}px`;
96
- const iconElement = this.createIconElement(marker, iconWidth, iconHeight);
97
- markerContainer.appendChild(iconElement);
98
- return this.setAndCreateText(marker, markerContainer);
99
- }
100
- /**
101
- * Appends the marker's text label (if any) to the container, positioned
102
- * around whichever element (icon or custom `element`) is already there.
103
- *
104
- * @param markerConfig - Configuration object containing text properties
105
- * @param container - Container element to append the label to
106
- * @returns The same container, with the label appended when text is present
107
- */
108
- static setAndCreateText(markerConfig, container) {
109
- if (markerConfig.text) {
110
- const textElement = typeof markerConfig.text === "string"
111
- ? this.createTextElement(markerConfig.text, markerConfig.textProperties)
112
- : markerConfig.text;
113
- const textContainer = this.createTextContainer(textElement, markerConfig.textPosition, markerConfig.maxLabelWidthPx);
114
- container.appendChild(textContainer);
115
- }
116
- return container;
117
- }
118
- /**
119
- * Creates an icon element with proper styling.
120
- *
121
- * @param marker - Marker configuration
122
- * @param iconWidth - Width of the icon
123
- * @param iconHeight - Height of the icon
124
- * @returns Icon element ready to be added to the container
125
- */
126
- static createIconElement(marker, iconWidth, iconHeight) {
127
- if (typeof marker.icon === "string") {
128
- return this.createIcon(marker);
129
- }
130
- else if (marker.icon instanceof HTMLImageElement) {
131
- marker.icon.style.width = `${iconWidth}px`;
132
- marker.icon.style.height = `${iconHeight}px`;
133
- return marker.icon;
134
- }
135
- else if (marker.icon) {
136
- return marker.icon;
137
- }
138
- else {
139
- // Create default element if no icon is provided
140
- const defaultIcon = document.createElement("div");
141
- defaultIcon.className = "icon-default";
142
- defaultIcon.style.width = `${iconWidth}px`;
143
- defaultIcon.style.height = `${iconHeight}px`;
144
- return defaultIcon;
145
- }
146
- }
147
- /**
148
- * Creates a text container, absolutely positioned around the marker's icon
149
- * via CSS (see `.text-container` in styles.css), so the label never affects
150
- * the container's own box.
151
- *
152
- * @param textElement - The text element to contain
153
- * @param textPosition - Desired position relative to the icon
154
- * @param maxLabelWidthPx - Maximum label width in pixels before truncation
155
- * @returns Container with text positioned using CSS classes
156
- */
157
- static createTextContainer(textElement, textPosition, maxLabelWidthPx) {
158
- const textContainer = document.createElement("div");
159
- // Apply base class
160
- textContainer.className = "text-container";
161
- textContainer.style.maxWidth = `${maxLabelWidthPx !== null && maxLabelWidthPx !== void 0 ? maxLabelWidthPx : exports.DEFAULT_MAX_LABEL_WIDTH_PX}px`;
162
- this.setTextPositionClass(textContainer, this.resolveTextPosition(textPosition));
163
- textElement.style.display = "block";
164
- textElement.style.margin = "0";
165
- textContainer.appendChild(textElement);
166
- return textContainer;
167
- }
168
- /**
169
- * Resolves an optional {@link TextPosition} to its default (`right`), the
170
- * same default `createTextContainer` has always applied.
171
- */
172
- static resolveTextPosition(textPosition) {
173
- return textPosition !== null && textPosition !== void 0 ? textPosition : TextPosition.right;
174
- }
175
- /**
176
- * Swaps a text container's position class, keeping exactly one of
177
- * `top|bottom|left|right` applied at a time.
178
- */
179
- static setTextPositionClass(textContainer, position) {
180
- textContainer.classList.remove("top", "bottom", "left", "right");
181
- textContainer.classList.add(TextPosition[position]);
182
- }
183
- /**
184
- * Repositions (or hides) a marker's already-rendered text label at
185
- * runtime, without rebuilding any DOM. Used both by automatic collision
186
- * avoidance and by anything else that needs to move a label after
187
- * creation.
188
- *
189
- * @param textContainer - The `.text-container` element to reposition
190
- * @param position - Side of the icon the label should render on
191
- * @param hidden - Whether the label should be hidden (kept measurable via
192
- * `visibility`, never removed via `display`, so it can be measured again
193
- * to decide whether it fits once something else changes)
194
- *
195
- * @example
196
- * ```typescript
197
- * MarkerUtils.applyTextPosition(textEl, TextPosition.left, false);
198
- * ```
199
- */
200
- static applyTextPosition(textContainer, position, hidden) {
201
- this.setTextPositionClass(textContainer, position);
202
- textContainer.style.visibility = hidden ? "hidden" : "";
203
- }
204
- /**
205
- * Creates and returns an icon element for the marker, using the image URL
206
- * specified in the `MarkerConfig` object.
207
- *
208
- * @param marker - `MarkerConfig` object containing the marker configuration
209
- * @returns Marker icon element with proper styling and dimensions
210
- *
211
- * @example
212
- * ```typescript
213
- * const iconElement = MarkerUtils.createIcon(markerConfig);
214
- * container.appendChild(iconElement);
215
- * ```
216
- */
217
- static createIcon(marker) {
218
- var _a, _b, _c, _d;
219
- const image = document.createElement("img");
220
- image.src = typeof marker.icon == "string" ? marker.icon : "";
221
- image.width = (_b = (_a = marker.iconProperties) === null || _a === void 0 ? void 0 : _a.width) !== null && _b !== void 0 ? _b : exports.DEFAULT_ICON_SIZE_PX;
222
- image.height = (_d = (_c = marker.iconProperties) === null || _c === void 0 ? void 0 : _c.height) !== null && _d !== void 0 ? _d : exports.DEFAULT_ICON_SIZE_PX;
223
- image.style.objectFit = "contain";
224
- image.style.filter = "drop-shadow(0px 4px 4px rgba(0, 0, 0, 0.25))";
225
- return image;
226
- }
227
- /**
228
- * Creates and returns a text element for the marker container, applying
229
- * custom text styles if provided in the marker properties.
230
- *
231
- * @param text - Text content to display
232
- * @param properties - Optional text styling properties
233
- * @returns Text element with applied styles
234
- *
235
- * @example
236
- * ```typescript
237
- * const textElement = MarkerUtils.createTextElement("Coffee Shop", {
238
- * fontSize: "14px",
239
- * color: "#333333"
240
- * });
241
- * ```
242
- */
243
- static createTextElement(text, properties) {
244
- var _a, _b, _c, _d, _e, _f, _g;
245
- const textElement = document.createElement("p");
246
- textElement.textContent = text;
247
- textElement.style.fontSize = (_a = properties === null || properties === void 0 ? void 0 : properties.fontSize) !== null && _a !== void 0 ? _a : "14px";
248
- textElement.style.padding = (_b = properties === null || properties === void 0 ? void 0 : properties.padding) !== null && _b !== void 0 ? _b : "0px";
249
- textElement.style.margin = (_c = properties === null || properties === void 0 ? void 0 : properties.margin) !== null && _c !== void 0 ? _c : "0px";
250
- textElement.style.fontWeight = (_d = properties === null || properties === void 0 ? void 0 : properties.fontWeight) !== null && _d !== void 0 ? _d : "600";
251
- textElement.style.fontFamily = (_e = properties === null || properties === void 0 ? void 0 : properties.fontFamily) !== null && _e !== void 0 ? _e : "'Open Sans', sans-serif";
252
- textElement.style.color = (_f = properties === null || properties === void 0 ? void 0 : properties.color) !== null && _f !== void 0 ? _f : "#000000";
253
- textElement.style.textShadow =
254
- (_g = properties === null || properties === void 0 ? void 0 : properties.textShadow) !== null && _g !== void 0 ? _g : "-1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff";
255
- return textElement;
256
- }
257
- }
258
- exports.MarkerUtils = MarkerUtils;
259
- /**
260
- * Custom implementation of a MapLibre Marker with additional functionality.
261
- * Extends the base MapLibre Marker class with MapVX-specific features.
262
- *
263
- * @example
264
- * ```typescript
265
- * const marker = new MarkerAttribute({
266
- * id: "place-1",
267
- * coordinate: { lat: 40.7128, lng: -74.0060 },
268
- * icon: "https://example.com/icon.png"
269
- * });
270
- * marker.addToMap(map);
271
- * ```
272
- */
273
- class MarkerAttribute extends maplibre_gl_1.Marker {
274
- /**
275
- * Constructs a new `MarkerAttribute` object with the specified properties.
276
- *
277
- * @param markerConfig - `MarkerConfig` object containing the configuration properties
278
- *
279
- * @example
280
- * ```typescript
281
- * const marker = new MarkerAttribute({
282
- * id: "coffee-shop",
283
- * coordinate: { lat: 40.7128, lng: -74.0060 },
284
- * floorId: "ground-floor",
285
- * icon: "coffee-icon.png"
286
- * });
287
- * ```
288
- */
289
- constructor(markerConfig) {
290
- var _a, _b, _c, _d, _e;
291
- super({
292
- element: MarkerUtils.createMarkerElement(markerConfig),
293
- draggable: false,
294
- anchor: (_a = markerConfig.anchor) !== null && _a !== void 0 ? _a : "center",
295
- offset: [0, 0],
296
- });
297
- /**
298
- * True while this marker is hidden on purpose, via {@link hide} (or {@link changeFloor}
299
- * resolving to a floor this marker is not on).
300
- *
301
- * DOM connectivity cannot answer this: {@link hide} works by calling maplibre's
302
- * `Marker.remove()`, which detaches the element, so a hidden marker and one that never got
303
- * attached look identical from `getElement().isConnected`. Anything that re-attaches a marker
304
- * it does not own — the route animation re-attaches its arrow when a step transition drops it —
305
- * has to consult this flag, or it silently un-hides the marker on its next frame.
306
- *
307
- * Any attach clears it — see the {@link addTo} override — so "attached" and "not hidden"
308
- * never disagree, whichever entry point put the marker back on the map.
309
- * @internal
310
- */
311
- this.hiddenOnPurpose = false;
312
- this.setLngLat([markerConfig.coordinate.lng, markerConfig.coordinate.lat]);
313
- this.setRotationAlignment((_b = markerConfig.rotationAlignment) !== null && _b !== void 0 ? _b : "viewport");
314
- this.setPitchAlignment("viewport");
315
- if (typeof markerConfig.rotation === "number") {
316
- this.setRotation(markerConfig.rotation);
317
- }
318
- this.id = (_c = markerConfig.id) !== null && _c !== void 0 ? _c : (0, utils_1.generateHexadecimalKey)();
319
- this.coordinate = markerConfig.coordinate;
320
- this.floorId = (_d = markerConfig.floorId) !== null && _d !== void 0 ? _d : "";
321
- // MapLibre resolves the anchor once, in the `super()` call above, and
322
- // offers no way to change it afterwards — so this mirror is set here and
323
- // never touched by `updateIcon`.
324
- this.anchorType = (_e = markerConfig.anchor) !== null && _e !== void 0 ? _e : "center";
325
- this.currentConfig = markerConfig;
326
- this.applyLayoutState(markerConfig);
327
- }
328
- /**
329
- * Derives the state automatic label collision avoidance reads (icon box,
330
- * preferred label side, priority, label element) from a fully-resolved
331
- * config. It is what assigns the fields declared with `!` above — the
332
- * constructor always calls it, but TypeScript can't see through the
333
- * indirection. Shared by the constructor and {@link updateIcon} so the two can
334
- * never drift apart.
335
- */
336
- applyLayoutState(config) {
337
- var _a, _b, _c, _d, _e;
338
- this.iconSize = {
339
- width: (_b = (_a = config.iconProperties) === null || _a === void 0 ? void 0 : _a.width) !== null && _b !== void 0 ? _b : exports.DEFAULT_ICON_SIZE_PX,
340
- height: (_d = (_c = config.iconProperties) === null || _c === void 0 ? void 0 : _c.height) !== null && _d !== void 0 ? _d : exports.DEFAULT_ICON_SIZE_PX,
341
- };
342
- this.preferredTextPosition = MarkerUtils.resolveTextPosition(config.textPosition);
343
- this.labelPriority = (_e = config.labelPriority) !== null && _e !== void 0 ? _e : 0;
344
- this.measureIconFromDom = config.element != null && config.iconProperties == null;
345
- this.textContainerEl = this.findTextContainerEl();
346
- }
347
- /**
348
- * Merges an update on top of the marker's current config, so a partial
349
- * update such as `{ id, coordinate, icon }` keeps the marker's existing
350
- * icon dimensions, label side and priority.
351
- *
352
- * `element` is deliberately *not* carried forward: it and `icon` are
353
- * mutually exclusive rendering paths, and `updateIcon` has always chosen
354
- * the path named by the update itself.
355
- */
356
- mergeConfig(update) {
357
- return Object.assign(Object.assign(Object.assign({}, this.currentConfig), update), { element: update.element });
358
- }
359
- /**
360
- * Finds this marker's `.text-container` child element, if it has one.
361
- */
362
- findTextContainerEl() {
363
- return Array.from(this._element.children).find((child) => child instanceof HTMLElement && child.classList.contains("text-container"));
364
- }
365
- /**
366
- * Adds the marker attribute to the specified map.
367
- *
368
- * @param map - The map instance where the marker attribute will be added
369
- *
370
- * @example
371
- * ```typescript
372
- * const marker = new MarkerAttribute(markerConfig);
373
- * marker.addToMap(mapInstance);
374
- * ```
375
- */
376
- addToMap(map) {
377
- if (!map)
378
- return;
379
- this.addTo(map);
380
- }
381
- /**
382
- * Updates the icon of the marker attribute based on the specified marker configuration.
383
- *
384
- * The config is merged on top of the one the marker currently renders
385
- * from, so a partial update keeps every property it omits — passing only
386
- * `{ icon }` no longer resets the marker's icon dimensions, preferred
387
- * label side or label priority to their defaults.
388
- *
389
- * @param marker - `MarkerConfig` object containing the new marker configuration
390
- *
391
- * @example
392
- * ```typescript
393
- * marker.updateIcon({
394
- * icon: "new-icon.png",
395
- * text: "Updated Text"
396
- * });
397
- * ```
398
- */
399
- updateIcon(marker) {
400
- var _a, _b;
401
- const config = this.mergeConfig(marker);
402
- if (config.element) {
403
- this._element.innerHTML = "";
404
- this._element.appendChild(config.element);
405
- }
406
- else {
407
- const markerElement = MarkerUtils.createMarkerElement(config);
408
- const oldMarkerContent = this._element.querySelector("div");
409
- const newMarkerContent = markerElement.querySelector("div");
410
- if (newMarkerContent) {
411
- (_a = oldMarkerContent === null || oldMarkerContent === void 0 ? void 0 : oldMarkerContent.parentElement) === null || _a === void 0 ? void 0 : _a.replaceChild(newMarkerContent, oldMarkerContent);
412
- }
413
- }
414
- this.setRotationAlignment((_b = config.rotationAlignment) !== null && _b !== void 0 ? _b : "viewport");
415
- this.setPitchAlignment("viewport");
416
- if (typeof config.rotation === "number") {
417
- this.setRotation(config.rotation);
418
- }
419
- this.currentConfig = config;
420
- this.applyLayoutState(config);
421
- }
422
- /**
423
- * Sets the current floor ID for the marker.
424
- * Marker will be shown if and only if such floor is displayed.
425
- *
426
- * @param floorId - The ID of the floor to set for the marker.
427
- * This parameter is optional and defaults to `undefined` if not provided.
428
- *
429
- * @example
430
- * ```typescript
431
- * marker.setFloor("ground-floor");
432
- * ```
433
- */
434
- setFloor(floorId) {
435
- this.floorId = floorId;
436
- }
437
- /**
438
- * Hides the marker element from the map without deleting it.
439
- * The marker can be shown again using the {@link show} method.
440
- *
441
- * @example
442
- * ```typescript
443
- * marker.hide();
444
- * ```
445
- */
446
- hide() {
447
- this.hiddenOnPurpose = true;
448
- this.remove();
449
- }
450
- /**
451
- * Makes the marker visible again after it has been hidden.
452
- *
453
- * @param map - The map instance where the marker should be shown
454
- *
455
- * @example
456
- * ```typescript
457
- * marker.show(mapInstance);
458
- * ```
459
- */
460
- show(map) {
461
- if (!map)
462
- return;
463
- this.addTo(map);
464
- }
465
- /**
466
- * Attaches the marker, clearing {@link hiddenOnPurpose}.
467
- *
468
- * Overridden so every attach path agrees on visibility: {@link show}, {@link addToMap} and a
469
- * direct `addTo` all funnel through here, so a marker cannot end up on the map while still
470
- * flagged as deliberately hidden — which would make the route animation refuse to restore an
471
- * arrow that is in fact visible.
472
- *
473
- * @param map - The map instance to attach the marker to.
474
- * @returns This marker, for chaining, as maplibre's `Marker.addTo` does.
475
- */
476
- addTo(map) {
477
- this.hiddenOnPurpose = false;
478
- return super.addTo(map);
479
- }
480
- /**
481
- * Hides marker if currentFloor is different from the marker floor.
482
- * Used for floor-based marker visibility management.
483
- *
484
- * @param floorId - The current floor ID to compare against
485
- * @param map - The map instance for showing/hiding the marker
486
- *
487
- * @example
488
- * ```typescript
489
- * marker.changeFloor("first-floor", mapInstance);
490
- * ```
491
- */
492
- changeFloor(floorId, map, isOutdoor = false) {
493
- if (floorId == this.floorId || (isOutdoor && !this.floorId)) {
494
- this.show(map);
495
- }
496
- else {
497
- this.hide();
498
- }
499
- }
500
- }
501
- exports.MarkerAttribute = MarkerAttribute;
502
- //# sourceMappingURL=marker.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"marker.js","sourceRoot":"","sources":["../../../../src/domain/models/marker.ts"],"names":[],"mappings":";;;AAAA,6CAAmE;AACnE,6CAA0D;AAG1D;;;;;;;;;;;;;;GAcG;AACH,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,4BAAZ,YAAY,QASvB;AAED;;;;;GAKG;AACU,QAAA,oBAAoB,GAAG,EAAE,CAAA;AAEtC;;;;;GAKG;AACU,QAAA,0BAA0B,GAAG,GAAG,CAAA;AAwN7C;;;GAGG;AACH,MAAa,WAAW;IACtB;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,mBAAmB,CAAC,MAAoB;;QAC7C,MAAM,eAAe,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;QAErD,uCAAuC;QACvC,MAAM,SAAS,GAAG,MAAA,MAAA,MAAM,CAAC,cAAc,0CAAE,KAAK,mCAAI,4BAAoB,CAAA;QACtE,MAAM,UAAU,GAAG,MAAA,MAAA,MAAM,CAAC,cAAc,0CAAE,MAAM,mCAAI,4BAAoB,CAAA;QAExE,yEAAyE;QACzE,gEAAgE;QAChE,qEAAqE;QACrE,kEAAkE;QAClE,eAAe,CAAC,SAAS,GAAG,cAAc,C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AC,aAAa,GAAG,MAAM,CAAA;QAC3B,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAA;IAC/B,CAAC;IAED;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,OAAgB;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAED;;;;;;;;OAQG;IACH,IAAI;QACF,IAAI,CAAC,eAAe,GAAG,IAAI,CAAA;QAC3B,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;;;;;;;;;;OAUG;IACH,KAAK,CAAC,GAAQ;QACZ,IAAI,CAAC,eAAe,GAAG,KAAK,CAAA;QAC5B,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACzB,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,CAAC;YAC5D,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAChB,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,IAAI,EAAE,CAAA;QACb,CAAC;IACH,CAAC;CACF;AAtTD,0CAsTC"}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getString = getString;
4
- /**
5
- * Returns the string corresponding to the given language prefix.
6
- * If the requested language is not available, falls back to the default language.
7
- *
8
- * @param multiLangString Multilanguage string to localize
9
- * @param lang Local language prefix for translations (e.g., "en", "es", "fr")
10
- * @returns Localized string in the requested language or default if not available
11
- * @group Places & Locations
12
- */
13
- function getString(multiLangString, lang) {
14
- var _a, _b;
15
- return (_b = (_a = multiLangString[lang]) !== null && _a !== void 0 ? _a : multiLangString.default) !== null && _b !== void 0 ? _b : "";
16
- }
17
- //# sourceMappingURL=multilanguage.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"multilanguage.js","sourceRoot":"","sources":["../../../../src/domain/models/multilanguage.ts"],"names":[],"mappings":";;AA2BA,8BAEC;AAXD;;;;;;;;GAQG;AACH,SAAgB,SAAS,CAAC,eAA8B,EAAE,IAAY;;IACpE,OAAO,MAAA,MAAA,eAAe,CAAC,IAAI,CAAC,mCAAI,eAAe,CAAC,OAAO,mCAAI,EAAE,CAAA;AAC/D,CAAC"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=openingHours.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"openingHours.js","sourceRoot":"","sources":["../../../../src/domain/models/openingHours.ts"],"names":[],"mappings":""}
@@ -1,127 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MVXPlace = void 0;
4
- const banner_1 = require("./banner");
5
- const property_1 = require("./property");
6
- /**
7
- * MapVX place object, is a custom object containing data of a specific real place.
8
- * Represents a physical location with all its associated metadata and properties.
9
- *
10
- * @example
11
- * ```typescript
12
- * const place = new MVXPlace(placeResponse);
13
- * console.log(place.title); // "Coffee Shop"
14
- * console.log(place.position); // { lat: 40.7128, lng: -74.0060 }
15
- * ```
16
- *
17
- * @group Places & Locations
18
- */
19
- class MVXPlace {
20
- /**
21
- * Creates a new place instance with the parameters specified in the data.
22
- *
23
- * @param rawPlace - JSON configuration parameters for the place from API response
24
- * @returns A new instance of MVXPlace
25
- *
26
- * @example
27
- * ```typescript
28
- * const placeResponse = await fetchPlaceData(placeId);
29
- * const place = new MVXPlace(placeResponse);
30
- * ```
31
- */
32
- constructor(rawPlace) {
33
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
34
- const tagsAndKeywords = ((_a = rawPlace.tags) !== null && _a !== void 0 ? _a : []).concat((_b = rawPlace.keywords) !== null && _b !== void 0 ? _b : []);
35
- this.mapvxId = rawPlace.id;
36
- this.clientId = (_c = rawPlace.alias) !== null && _c !== void 0 ? _c : rawPlace.externalId;
37
- this.title = rawPlace.title;
38
- this.hidePlace = tagsAndKeywords.includes("hide_search");
39
- this.description = rawPlace.description;
40
- this.shortDescription = rawPlace.shortDescription;
41
- // @ts-expect-error - lon is not in the type but search results have it
42
- this.position = { lat: rawPlace.lat, lng: rawPlace.lng || rawPlace.lon };
43
- this.category = rawPlace.category;
44
- this.tags = (_d = rawPlace.tags) !== null && _d !== void 0 ? _d : [];
45
- this.generalCategory = rawPlace.general_category;
46
- this.localizedCategory = (_e = rawPlace.localizedCategory) !== null && _e !== void 0 ? _e : "";
47
- this.parentInstitutionId = rawPlace.parent_institution;
48
- this.inFloors = rawPlace.inFloor;
49
- this.innerFloors = [];
50
- for (const key in rawPlace.innerFloors) {
51
- this.innerFloors.push(Object.assign(Object.assign({}, rawPlace.innerFloors[key]), { key }));
52
- }
53
- this.innerFloors.sort((a, b) => a.index - b.index);
54
- this.openingHours = rawPlace.opening_hours;
55
- this.address = rawPlace.address;
56
- this.transportLine = (_f = rawPlace.properties) === null || _f === void 0 ? void 0 : _f.filter((p) => p.type === "transport_line");
57
- if (rawPlace.logo) {
58
- this.logo = typeof rawPlace.logo === "string" ? rawPlace.logo : rawPlace.logo.light;
59
- }
60
- this.images = (_g = rawPlace.images) !== null && _g !== void 0 ? _g : [];
61
- this.banners = ((_h = rawPlace.banners) !== null && _h !== void 0 ? _h : []).map((bannerResponse) => new banner_1.Banner(bannerResponse));
62
- this.properties = property_1.PropertyUtils.parseProperties((_j = rawPlace.properties) !== null && _j !== void 0 ? _j : []);
63
- this.parentId = rawPlace.parent_id;
64
- this.parentType = rawPlace.parent_type;
65
- this.metadata = rawPlace.metadata;
66
- this.visibility = (_k = rawPlace.visibility) !== null && _k !== void 0 ? _k : "public";
67
- }
68
- /**
69
- * Rebuilds an {@link MVXPlace} from a value that has lost its prototype — e.g. a
70
- * place rehydrated from the persistent (localStorage) cache, where `JSON.parse`
71
- * produces a plain object stripped of the class methods.
72
- *
73
- * The place's methods only read its own data fields, so restoring the prototype is
74
- * sufficient; the raw API {@link PlaceResponse} shape is not needed (and would not
75
- * fit, since a serialized place already carries the mapped `MVXPlace` fields). Live
76
- * instances and non-object values are returned unchanged.
77
- *
78
- * @param value - A cached place value (plain object) or an existing instance.
79
- * @returns An MVXPlace whose methods (e.g. {@link inFloor}) work again.
80
- *
81
- * @example
82
- * ```typescript
83
- * const place = MVXPlace.fromCache(cachedValue);
84
- * place.inFloor(parentFloors); // no longer throws
85
- * ```
86
- */
87
- static fromCache(value) {
88
- if (value instanceof MVXPlace)
89
- return value;
90
- if (value === null || typeof value !== "object")
91
- return value;
92
- return Object.assign(Object.create(MVXPlace.prototype), value);
93
- }
94
- /**
95
- * Returns the floor in which the place exists as an InnerFloor object.
96
- * If no matching available floor is found or if the place is not indoor,
97
- * an undefined value will be returned.
98
- *
99
- * @param parentPlaceFloors - Array of existing parent place floors to search in
100
- * @returns The matching InnerFloor object or undefined if not found
101
- *
102
- * @example
103
- * ```typescript
104
- * const buildingFloors = getBuildingFloors();
105
- * const placeFloor = place.inFloor(buildingFloors);
106
- * if (placeFloor) {
107
- * console.log(`Place is on floor: ${placeFloor.name}`);
108
- * }
109
- * ```
110
- */
111
- inFloor(parentPlaceFloors) {
112
- if (!this.inFloors || this.inFloors.length === 0) {
113
- // outdoor place
114
- return parentPlaceFloors.find((floor) => floor.reachableFromGPS);
115
- }
116
- return parentPlaceFloors.find((floor) => { var _a; return floor.key === ((_a = this.inFloors) === null || _a === void 0 ? void 0 : _a[0]); });
117
- }
118
- /**
119
- * Returns a string representation of the place
120
- * @returns String in format "MVXPlace {mapvxId}"
121
- */
122
- toString() {
123
- return `MVXPlace ${this.mapvxId}`;
124
- }
125
- }
126
- exports.MVXPlace = MVXPlace;
127
- //# sourceMappingURL=place.js.map