@mappedin/viewer 0.59.4 → 0.59.5-051027e.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/dist/index.js +56362 -52849
  2. package/dist/third-party-licenses.json +8 -0
  3. package/dist/types/src/components/annotation-hover-label/index.d.ts +10 -0
  4. package/dist/types/src/components/annotation-marker/build-annotation-marker-html.d.ts +20 -0
  5. package/dist/types/src/components/annotation-marker/build-annotation-marker-html.test.d.ts +1 -0
  6. package/dist/types/src/components/annotation-marker/index.d.ts +12 -7
  7. package/dist/types/src/components/carousel/nav-chevrons.d.ts +13 -13
  8. package/dist/types/src/components/common/fullscreen-overlay.d.ts +13 -13
  9. package/dist/types/src/components/common/global-styles.d.ts +5 -0
  10. package/dist/types/src/components/directions/warning-text.d.ts +13 -13
  11. package/dist/types/src/components/search-results/search-result.d.ts +13 -13
  12. package/dist/types/src/components/with-content/index.d.ts +13 -13
  13. package/dist/types/src/lib/sdk/index.d.ts +0 -1
  14. package/dist/types/src/lib/sdk/load-data.d.ts +5 -0
  15. package/dist/types/src/lib/types/options.d.ts +4 -0
  16. package/dist/types/src/lib/utils/annotation-utils.d.ts +100 -0
  17. package/dist/types/src/lib/utils/annotation-utils.test.d.ts +1 -0
  18. package/dist/types/src/lib/utils/icon-utils.d.ts +11 -11
  19. package/dist/types/src/stores/feature-flag-store/index.d.ts +2 -0
  20. package/dist/types/src/stores/map-store/controllers/events.d.ts +6 -0
  21. package/dist/types/src/stores/map-store/controllers/labels.d.ts +29 -1
  22. package/dist/types/src/stores/map-store/controllers/markers.d.ts +19 -1
  23. package/dist/types/src/stores/ui-store/index.d.ts +1 -1
  24. package/package.json +6 -4
  25. package/dist/types/src/lib/sdk/load-annotations.d.ts +0 -2
@@ -1,6 +1,6 @@
1
1
  import type MapStore from '..';
2
2
  import type RootStore from '../../root-store';
3
- import { Place, Label, Area, Floor, Facade } from '../../../lib/sdk';
3
+ import { Place, Annotation, Label, Area, Floor, Facade } from '../../../lib/sdk';
4
4
  import { FloorStack } from '@mappedin/mappedin-js';
5
5
  declare class LabelsController {
6
6
  private rootStore;
@@ -18,6 +18,14 @@ declare class LabelsController {
18
18
  floorStackLabelsOnFloor: Map<Floor, Label>;
19
19
  floorStackByLabelId: Record<string, FloorStack>;
20
20
  placeByLabelId: Record<string, Place>;
21
+ annotationLabelByPlaceId: Map<string, Label>;
22
+ /** The annotation whose name is currently shown by `AnnotationHoverLabel`. */
23
+ hoveredAnnotation: Annotation | null;
24
+ /** Container-relative pixel position of the hovered annotation's pin. */
25
+ hoveredAnnotationPosition: {
26
+ x: number;
27
+ y: number;
28
+ } | null;
21
29
  constructor({ rootStore, mapStore }: {
22
30
  rootStore: RootStore;
23
31
  mapStore: MapStore;
@@ -28,6 +36,7 @@ declare class LabelsController {
28
36
  private initialize;
29
37
  private getLabelColor;
30
38
  private getDefaultLabelRank;
39
+ private getLabelOptionsForAnnotation;
31
40
  private getLabelOptionsForFloorStack;
32
41
  private getLabelOptionsForPlace;
33
42
  private labelPlace;
@@ -36,6 +45,25 @@ declare class LabelsController {
36
45
  private labelPlaces;
37
46
  private labelFloorStacks;
38
47
  private getVisibilityForPlaceLabel;
48
+ /**
49
+ * Show the hovered annotation's name and hide the previous one's.
50
+ *
51
+ * The name is drawn as DOM rather than label text so that showing it never disturbs the
52
+ * collision layout. The screen position is projected once here: the label is cleared while
53
+ * the camera moves, so the snapshot never has to be kept in sync.
54
+ * @param annotation - The hovered annotation, or null when nothing is hovered
55
+ */
56
+ setHoveredAnnotation(annotation: Annotation | null): void;
57
+ /**
58
+ * Push the current rank, appearance, and visibility for one annotation's label.
59
+ * @param annotation - The annotation whose label should be synced
60
+ */
61
+ private updateAnnotationLabel;
62
+ /**
63
+ * Keep annotation label rank, size, and visibility in sync with safety mode, selection,
64
+ * and directions. The label is disabled while a DOM marker represents the annotation.
65
+ */
66
+ private updateAnnotationLabels;
39
67
  private updateLabelsInAreas;
40
68
  private updateFloorStackLabels;
41
69
  private updateAllLabels;
@@ -6,7 +6,12 @@ type TMarker = {
6
6
  key: string;
7
7
  type: string;
8
8
  text?: string;
9
- elementFn: () => ReactNode | Promise<ReactNode>;
9
+ elementFn?: () => ReactNode | Promise<ReactNode>;
10
+ /**
11
+ * Prebuilt HTML string, or async factory. When set, skips React renderToString.
12
+ * Prefer this for hot paths (e.g. annotations) — SDK Markers.add only accepts a string.
13
+ */
14
+ html?: string | (() => string | Promise<string>);
10
15
  onPointerDown?: () => void;
11
16
  onClick?: () => void;
12
17
  onWheel?: (e: WheelEvent) => void;
@@ -21,11 +26,17 @@ declare class MarkersController {
21
26
  private reactionDisposers;
22
27
  private markersVisible;
23
28
  private sdkMarkersByKey;
29
+ private annotationRootByContentEl;
24
30
  placeByMarkerId: Record<string, Place>;
25
31
  constructor({ rootStore, mapStore }: {
26
32
  rootStore: RootStore;
27
33
  mapStore: MapStore;
28
34
  });
35
+ /**
36
+ * DOM markers only for selected annotations. At-rest annotations are GPU labels;
37
+ * `LabelsController` disables the matching label while this marker exists, since
38
+ * collision can't hide it (see `getVisibilityForPlaceLabel`).
39
+ */
29
40
  private get annotationMarkers();
30
41
  private get areaMarkers();
31
42
  private get youAreHereMarkers();
@@ -39,6 +50,13 @@ declare class MarkersController {
39
50
  private getMarkerColor;
40
51
  private getAnnotationRank;
41
52
  private getAreaRank;
53
+ /**
54
+ * Resolve (and memoize) the annotation marker root inside an SDK marker's content element.
55
+ * Cached because it is hit for every annotation marker on every selection change.
56
+ * @param marker - The SDK marker to look inside
57
+ * @returns The annotation root element, or undefined if this marker has none
58
+ */
59
+ private getAnnotationRoot;
42
60
  private forEachMarker;
43
61
  private handleZoomChange;
44
62
  private zoomOnWheel;
@@ -153,7 +153,7 @@ declare class UIStore {
153
153
  get shareButtonVisible(): boolean;
154
154
  get mainUIVisible(): boolean;
155
155
  get mainUIMaxHeight(): number;
156
- get appPadding(): 0 | 10 | 20 | 15;
156
+ get appPadding(): 0 | 20 | 10 | 15;
157
157
  get makerPopUpVisible(): boolean;
158
158
  get metadataCardVisible(): boolean;
159
159
  get availableDepartureModes(): E_DEPARTURE_MODE[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mappedin/viewer",
3
- "version": "0.59.4",
3
+ "version": "0.59.5-051027e.0",
4
4
  "type": "module",
5
5
  "browser": "./dist/index.js",
6
6
  "license": "UNLICENSED",
@@ -18,9 +18,9 @@
18
18
  },
19
19
  "devDependencies": {
20
20
  "@ladle/react": "^5.0.3",
21
- "@mappedin/blue-dot": "6.17.0-v6-13d60ac3.0",
22
- "@mappedin/dynamic-focus": "6.17.0-v6-13d60ac3.0",
23
- "@mappedin/mappedin-js": "6.17.1-v6-13d60ac3.0",
21
+ "@mappedin/blue-dot": "6.23.0-pr-1669-sdk-room-1-99f56e05.0",
22
+ "@mappedin/dynamic-focus": "6.23.0-pr-1669-sdk-room-1-99f56e05.0",
23
+ "@mappedin/mappedin-js": "6.23.1-pr-1669-sdk-room-1-99f56e05.0",
24
24
  "@mappedin/mvf": "3.0.0-69b7308.0",
25
25
  "@mappedin/self-serve-icons": "1.105.0-alpha.SRV-2719-add-bleed-kit-annotation.1754600609",
26
26
  "@napi-rs/canvas": "^0.1.89",
@@ -31,6 +31,7 @@
31
31
  "@turf/difference": "^7.2.0",
32
32
  "@turf/geojson-rbush": "^7.2.0",
33
33
  "@turf/helpers": "^7.2.0",
34
+ "@types/escape-html": "1.0.4",
34
35
  "@types/geojson": "^7946.0.16",
35
36
  "@types/lodash.isequal": "^4.5.8",
36
37
  "@types/lodash.merge": "^4.6.9",
@@ -46,6 +47,7 @@
46
47
  "@vitest/coverage-istanbul": "^3.2.6",
47
48
  "dompurify": "^3.4.11",
48
49
  "dotenv": "^16.4.5",
50
+ "escape-html": "1.0.3",
49
51
  "escape-string-regexp": "^5.0.0",
50
52
  "eslint": "^8.45.0",
51
53
  "eslint-plugin-react-hooks": "^4.6.0",
@@ -1,2 +0,0 @@
1
- import { Annotation } from './mappedin-js';
2
- export declare const loadAnnotationAsset: (annotation: Annotation) => string | undefined;