@osm-editor-kit/street-imagery-react 1.0.0 → 1.1.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/README.md +4 -4
- package/dist/StreetLevelImageryViewer.d.ts +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +2 -93
- package/dist/mapillary/lookAt.d.ts +26 -0
- package/dist/panels/MapillaryPanel.d.ts +1 -1
- package/dist/panels/mapillaryLookAt.d.ts +2 -26
- package/dist/viewer/index.d.ts +1 -0
- package/dist/viewer.js +98 -0
- package/package.json +15 -2
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ React and MapLibre layers, hooks and photo viewers for street-level imagery (Map
|
|
|
11
11
|
npm install @osm-editor-kit/street-imagery-react
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
Peer dependencies to install as well: `@osm-editor-kit/street-imagery`, `react`, `react-dom`, `maplibre-gl`, `react-map-gl`, `@tanstack/react-query`, `zustand
|
|
14
|
+
Peer dependencies to install as well: `@osm-editor-kit/street-imagery`, `react`, `react-dom`, `maplibre-gl`, `react-map-gl`, `@tanstack/react-query`, `zustand`. `mapillary-js` is optional: you only need it for the photo viewer (the `viewer` and `viewer-panels` entries). `@panoramax/web-viewer` is optional too (see below). Wrap your app in a TanStack `QueryClientProvider`; the hooks use it.
|
|
15
15
|
|
|
16
16
|
## What it does
|
|
17
17
|
|
|
@@ -28,11 +28,11 @@ Peer dependencies to install as well: `@osm-editor-kit/street-imagery`, `react`,
|
|
|
28
28
|
```tsx
|
|
29
29
|
import {
|
|
30
30
|
StreetLevelImagerySourcesAndLayers,
|
|
31
|
-
StreetLevelImageryViewer,
|
|
32
31
|
useMapViewportBbox,
|
|
33
32
|
queryStreetImageryFeatures,
|
|
34
33
|
streetImageryInteractiveLayerIds,
|
|
35
34
|
} from '@osm-editor-kit/street-imagery-react'
|
|
35
|
+
import { StreetLevelImageryViewer } from '@osm-editor-kit/street-imagery-react/viewer'
|
|
36
36
|
import { createStreetImageryConfig } from '@osm-editor-kit/street-imagery'
|
|
37
37
|
|
|
38
38
|
// Inside <Map id="main">: the bbox follows the map
|
|
@@ -66,7 +66,7 @@ const hits = queryStreetImageryFeatures(event)
|
|
|
66
66
|
|
|
67
67
|
**Mapillary:** `createStreetImageryConfig({ mapillaryToken })` or `setStreetImageryConfig` at boot (`@osm-editor-kit/street-imagery`). **Panoramax:** nothing to set up, the Mapillary viewer shows its pictures too (see below).
|
|
68
68
|
|
|
69
|
-
Also: `useAllProviderPhotos`, `useProviderPhotos` / `useProviderSequences` / `useProviderMapFeatures`, `usePhotoThumbnail` / `usePhotoFullUrl`, `resolveSelectedSequence`, `StreetLevelImageryViewCone`, `useViewerBearing` / `useViewerActions`. The panels themselves (`MapillaryPanel`, `PanoramaxPanel`) are in `@osm-editor-kit/street-imagery-react/viewer-panels
|
|
69
|
+
Also: `useAllProviderPhotos`, `useProviderPhotos` / `useProviderSequences` / `useProviderMapFeatures`, `usePhotoThumbnail` / `usePhotoFullUrl`, `resolveSelectedSequence`, `StreetLevelImageryViewCone`, `useViewerBearing` / `useViewerActions`. The panels themselves (`MapillaryPanel`, `PanoramaxPanel`) are in `@osm-editor-kit/street-imagery-react/viewer-panels`. `StreetLevelImageryViewer` is in `@osm-editor-kit/street-imagery-react/viewer` and loads them on demand, so `mapillary-js` is only loaded when a photo is shown.
|
|
70
70
|
|
|
71
71
|
### Panoramax in the Mapillary viewer
|
|
72
72
|
|
|
@@ -181,11 +181,11 @@ const [view, setView] = useState<PhotoView | null>(null)
|
|
|
181
181
|
```tsx
|
|
182
182
|
import { JUNCTION_DETECTION_GROUPS, matchesAnyGroup, PLACE_TARGET } from '@osm-editor-kit/street-imagery'
|
|
183
183
|
import {
|
|
184
|
-
StreetLevelImageryViewer,
|
|
185
184
|
useMapillaryImageDetections,
|
|
186
185
|
useMapillaryMapFeatureImages,
|
|
187
186
|
useMapillaryMapFeaturesNear,
|
|
188
187
|
} from '@osm-editor-kit/street-imagery-react'
|
|
188
|
+
import { StreetLevelImageryViewer } from '@osm-editor-kit/street-imagery-react/viewer'
|
|
189
189
|
|
|
190
190
|
// Turn any Mapillary photo (360° or flat) towards a junction:
|
|
191
191
|
<StreetLevelImageryViewer photo={photo} lookAt={{ lngLat: node, shape: PLACE_TARGET }} … />
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { NormalizedPhoto, PhotoView } from '@osm-editor-kit/street-imagery';
|
|
2
2
|
import { type ComponentType } from 'react';
|
|
3
|
-
import type { MapillaryLookAt, MapillaryViewerOutline } from './
|
|
3
|
+
import type { MapillaryLookAt, MapillaryViewerOutline } from './mapillary/lookAt';
|
|
4
4
|
import type { PanoramaxPanelProps } from './panels/PanoramaxPanel';
|
|
5
5
|
import type { StreetImageryPhotoSelection } from './types';
|
|
6
6
|
type StreetLevelImageryViewerProps = {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export { BASE_COLOR, SELECTION_COLOR, StreetLevelImagerySelectionOverlay, resolveSelectedSequence, } from './StreetLevelImagerySelectionOverlay';
|
|
2
2
|
export { StreetLevelImagerySourcesAndLayers, type PhotoFilter, } from './StreetLevelImagerySourcesAndLayers';
|
|
3
3
|
export { StreetLevelImageryViewCone, VIEW_SHAPE_FILL_OPACITY } from './StreetLevelImageryViewCone';
|
|
4
|
-
export { StreetLevelImageryViewer } from './StreetLevelImageryViewer';
|
|
5
4
|
export type { StreetImageryPhotoSelection } from './types';
|
|
6
5
|
export { queryStreetImageryFeatures, streetImageryInteractiveLayerIds, type StreetImageryClickFeature, } from './streetImageryClick';
|
|
7
6
|
export { useAllProviderMapFeatures } from './hooks/useAllProviderMapFeatures';
|
|
@@ -16,7 +15,7 @@ export { viewSuggestionLabel } from './viewpoints/viewDirectionLabels';
|
|
|
16
15
|
export { getViewpointSession, useActiveDirectionKey, useCanGoBack, useCanGoForward, useCurrentHistoryEntry, useViewpointLine, useViewpoints, type ViewpointHistoryEntry, } from './viewpoints/useViewpointSessionStore';
|
|
17
16
|
export { useViewSuggestions, type ViewSuggestionsOptions, type ViewSuggestionsResult, } from './viewpoints/useViewSuggestions';
|
|
18
17
|
export { usePhotosLookingAt, type PhotosLookingAtOptions, type PhotosLookingAtResult, } from './viewpoints/usePhotosLookingAt';
|
|
19
|
-
export type { MapillaryLookAt, MapillaryViewerOutline } from './
|
|
18
|
+
export type { MapillaryLookAt, MapillaryViewerOutline } from './mapillary/lookAt';
|
|
20
19
|
export { useMapillaryImageDetections, useMapillaryMapFeatureImages, useMapillaryMapFeaturesNear, useSelectedMapillaryFeature, } from './mapillary/useMapillaryFeatures';
|
|
21
20
|
export { LocationPickOnMap, type LocationPickOnMapProps } from './openers/LocationPickOnMap';
|
|
22
21
|
export { useArmedLocationOpenerId, useLocationPickActions } from './openers/useLocationPickStore';
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { c } from 'react/compiler-runtime';
|
|
|
5
5
|
import { distanceMeters, sequencesToFeatureCollection, emptyLineCollection, getProviderAdapter, providerById, providerCoversBbox, fetchedSequencesMinZoom, viewShapeRadiusMeters, viewConeGeoJson, viewfieldLayerId, photoLayerId, photoTargetLayerId, featureLayerId, PROVIDER_IDS, mapFeatureMatchesDateRange, isBrowserAvailableProvider, photoFilter, photoFullUrlQueryKey, photoThumbnailQueryKey, formatLocalDateTime, formatRelativeDate, formatDateTooltip, formatMonth, mapillaryPhotoSource, buildViewSuggestions, yearsToMs, rankPhotosLookingAt, SIGN_TARGET, bestTargetImage, MAP_FEATURE_COLOR, mapillaryValueName, mapillaryIconUrl, dateRangeToSliderPositions, sliderPositionsToDateRange, dateSliderBins, dateSliderPosition, yearsAgoMs, parseIsoDateStartMs, findLocationOpener, formatDate, isIsoDate, alignLineToPoints, setStreetImageryConfig, fetchImageDetections, fetchMapFeatureImages, fetchMapillaryMapFeaturesInBbox, bboxAround, resolvePhotoPanoramaUrl, resolvePhotoThumbnailUrl, coneRadiusMeters, openLocationInNewTab, buildMapFeatureLayerFilter, featureSourceId, viewfieldZoomStep, buildPhotoLayerFilter, photoSourceId, viewfieldSourceId, sequenceTilesSourceId, renameExpressionProperties, sequenceTilesLayerId, sequenceSourceId, sequenceLayerId, viewfieldLineLayerId, VIEWFIELD_MIN_ZOOM, emptyPointCollection, mapFeaturesToFeatureCollection, photosToFeatureCollection, photosToViewfieldsFeatureCollection, emptyPolygonCollection, bboxIntersects } from '@osm-editor-kit/street-imagery';
|
|
6
6
|
import { useMap, Source, Layer } from 'react-map-gl/maplibre';
|
|
7
7
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
|
-
import {
|
|
8
|
+
import { useEffect, useSyncExternalStore, useState, useRef, useEffectEvent, Fragment as Fragment$1 } from 'react';
|
|
9
9
|
import { useQuery, useQueries, keepPreviousData } from '@tanstack/react-query';
|
|
10
10
|
import { create } from 'zustand';
|
|
11
11
|
|
|
@@ -1433,97 +1433,6 @@ var StreetLevelImagerySourcesAndLayers = (t0) => {
|
|
|
1433
1433
|
function _temp(id) {
|
|
1434
1434
|
return providerById[id].kind === "photo" && getProviderAdapter(id)?.fetchPhotos;
|
|
1435
1435
|
}
|
|
1436
|
-
var MapillaryPanel = lazy(() => import('./MapillaryPanel-SOHGB7JA.js').then((module) => ({
|
|
1437
|
-
default: module.MapillaryPanel
|
|
1438
|
-
})));
|
|
1439
|
-
var PanoramaxPanel = lazy(() => import('./PanoramaxPanel-5P5LWMRY.js').then((module) => ({
|
|
1440
|
-
default: module.PanoramaxPanel
|
|
1441
|
-
})));
|
|
1442
|
-
var ViewerPanelPlaceholder = () => {
|
|
1443
|
-
const $ = c(2);
|
|
1444
|
-
const {
|
|
1445
|
-
messages
|
|
1446
|
-
} = useStreetImageryI18n();
|
|
1447
|
-
let t0;
|
|
1448
|
-
if ($[0] !== messages.viewer.loading) {
|
|
1449
|
-
t0 = /* @__PURE__ */ jsx("div", { className: "flex min-h-48 animate-pulse items-center justify-center rounded-lg border border-slate-200 bg-slate-100", children: /* @__PURE__ */ jsx("span", { className: "text-sm text-slate-500", children: messages.viewer.loading }) });
|
|
1450
|
-
$[0] = messages.viewer.loading;
|
|
1451
|
-
$[1] = t0;
|
|
1452
|
-
} else {
|
|
1453
|
-
t0 = $[1];
|
|
1454
|
-
}
|
|
1455
|
-
return t0;
|
|
1456
|
-
};
|
|
1457
|
-
var StreetLevelImageryViewer = (t0) => {
|
|
1458
|
-
const $ = c(22);
|
|
1459
|
-
const {
|
|
1460
|
-
photo,
|
|
1461
|
-
groupPhotos,
|
|
1462
|
-
onPhotoSelected,
|
|
1463
|
-
onEaseMapToPoint,
|
|
1464
|
-
onViewerPhoto,
|
|
1465
|
-
onViewerView,
|
|
1466
|
-
lookAtBearing,
|
|
1467
|
-
lookAt,
|
|
1468
|
-
outlines,
|
|
1469
|
-
hideAttribution,
|
|
1470
|
-
panoramaxPanel: PanoramaxPanelOverride
|
|
1471
|
-
} = t0;
|
|
1472
|
-
if (photo.providerId === "mapillary") {
|
|
1473
|
-
let t1;
|
|
1474
|
-
if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
1475
|
-
t1 = /* @__PURE__ */ jsx(ViewerPanelPlaceholder, {});
|
|
1476
|
-
$[0] = t1;
|
|
1477
|
-
} else {
|
|
1478
|
-
t1 = $[0];
|
|
1479
|
-
}
|
|
1480
|
-
let t2;
|
|
1481
|
-
if ($[1] !== groupPhotos || $[2] !== hideAttribution || $[3] !== lookAt || $[4] !== lookAtBearing || $[5] !== onEaseMapToPoint || $[6] !== onPhotoSelected || $[7] !== onViewerPhoto || $[8] !== onViewerView || $[9] !== outlines || $[10] !== photo) {
|
|
1482
|
-
t2 = /* @__PURE__ */ jsx(Suspense, { fallback: t1, children: /* @__PURE__ */ jsx(MapillaryPanel, { groupPhotos, hideAttribution, onEaseMapToPoint, onPhotoSelected, lookAt, lookAtBearing, outlines, onViewerPhoto, onViewerView, photo }) });
|
|
1483
|
-
$[1] = groupPhotos;
|
|
1484
|
-
$[2] = hideAttribution;
|
|
1485
|
-
$[3] = lookAt;
|
|
1486
|
-
$[4] = lookAtBearing;
|
|
1487
|
-
$[5] = onEaseMapToPoint;
|
|
1488
|
-
$[6] = onPhotoSelected;
|
|
1489
|
-
$[7] = onViewerPhoto;
|
|
1490
|
-
$[8] = onViewerView;
|
|
1491
|
-
$[9] = outlines;
|
|
1492
|
-
$[10] = photo;
|
|
1493
|
-
$[11] = t2;
|
|
1494
|
-
} else {
|
|
1495
|
-
t2 = $[11];
|
|
1496
|
-
}
|
|
1497
|
-
return t2;
|
|
1498
|
-
}
|
|
1499
|
-
if (photo.providerId === "panoramax") {
|
|
1500
|
-
const Panel = PanoramaxPanelOverride ?? PanoramaxPanel;
|
|
1501
|
-
let t1;
|
|
1502
|
-
if ($[12] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
1503
|
-
t1 = /* @__PURE__ */ jsx(ViewerPanelPlaceholder, {});
|
|
1504
|
-
$[12] = t1;
|
|
1505
|
-
} else {
|
|
1506
|
-
t1 = $[12];
|
|
1507
|
-
}
|
|
1508
|
-
let t2;
|
|
1509
|
-
if ($[13] !== Panel || $[14] !== groupPhotos || $[15] !== hideAttribution || $[16] !== onEaseMapToPoint || $[17] !== onPhotoSelected || $[18] !== onViewerPhoto || $[19] !== onViewerView || $[20] !== photo) {
|
|
1510
|
-
t2 = /* @__PURE__ */ jsx(Suspense, { fallback: t1, children: /* @__PURE__ */ jsx(Panel, { groupPhotos, hideAttribution, onViewerPhoto, onViewerView, onEaseMapToPoint, onPhotoSelected, photo }) });
|
|
1511
|
-
$[13] = Panel;
|
|
1512
|
-
$[14] = groupPhotos;
|
|
1513
|
-
$[15] = hideAttribution;
|
|
1514
|
-
$[16] = onEaseMapToPoint;
|
|
1515
|
-
$[17] = onPhotoSelected;
|
|
1516
|
-
$[18] = onViewerPhoto;
|
|
1517
|
-
$[19] = onViewerView;
|
|
1518
|
-
$[20] = photo;
|
|
1519
|
-
$[21] = t2;
|
|
1520
|
-
} else {
|
|
1521
|
-
t2 = $[21];
|
|
1522
|
-
}
|
|
1523
|
-
return t2;
|
|
1524
|
-
}
|
|
1525
|
-
return null;
|
|
1526
|
-
};
|
|
1527
1436
|
var streetImageryInteractiveLayerIds = (providers) => [...providers.map((providerId) => photoLayerId(providerId)), ...providers.map((providerId) => photoTargetLayerId(providerId)), ...providers.map((providerId) => viewfieldLayerId(providerId)), ...providers.map((providerId) => featureLayerId(providerId))];
|
|
1528
1437
|
var parseProviderIdFromLayerId = (layerId) => {
|
|
1529
1438
|
const photoMatch = layerId.match(/^photos-(.+)$/);
|
|
@@ -4418,4 +4327,4 @@ var PhotoDateRangeFilter = ({
|
|
|
4418
4327
|
] });
|
|
4419
4328
|
};
|
|
4420
4329
|
|
|
4421
|
-
export { BASE_COLOR, FloatingPhotoViewer, FloatingViewerInfoButton, LocationPickOnMap, MAPILLARY_FEATURE_BAR_LABELS, MapillaryFeatureBar, PhotoCount, PhotoDate, PhotoDateRangeFilter, SELECTION_COLOR, SelectedMapFeatureLayer, StreetLevelImagerySelectionOverlay, StreetLevelImagerySourcesAndLayers, StreetLevelImageryViewCone,
|
|
4330
|
+
export { BASE_COLOR, FloatingPhotoViewer, FloatingViewerInfoButton, LocationPickOnMap, MAPILLARY_FEATURE_BAR_LABELS, MapillaryFeatureBar, PhotoCount, PhotoDate, PhotoDateRangeFilter, SELECTION_COLOR, SelectedMapFeatureLayer, StreetLevelImagerySelectionOverlay, StreetLevelImagerySourcesAndLayers, StreetLevelImageryViewCone, VIEWPOINT_DEFAULT_COLOR, VIEWPOINT_DIRECTION_LAYER_ID, VIEW_SHAPE_FILL_OPACITY, ViewpointLayer, getViewpointSession, queryStreetImageryFeatures, resolveSelectedSequence, streetImageryInteractiveLayerIds, useActiveDirectionKey, useAllProviderMapFeatures, useAllProviderPhotos, useArmedLocationOpenerId, useCanGoBack, useCanGoForward, useCurrentHistoryEntry, useLocationPickActions, useMapViewportBbox, useMapillaryImageDetections, useMapillaryMapFeatureImages, useMapillaryMapFeaturesNear, usePhotoFullUrl, usePhotoThumbnail, usePhotosLookingAt, useProviderMapFeatures, useProviderPhotos, useProviderSequences, useSelectedMapillaryFeature, useViewSuggestions, useViewpointLine, useViewpoints, viewDirectionKeyFromFeatures, viewSuggestionLabel };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { LngLat, TargetShape } from '@osm-editor-kit/street-imagery';
|
|
2
|
+
/** A place the Mapillary viewer should turn to: a sign, a traffic light, a junction … */
|
|
3
|
+
export type MapillaryLookAt = {
|
|
4
|
+
lngLat: LngLat;
|
|
5
|
+
/** Size and height of the target; decides zoom and vertical position. Default: a traffic sign. */
|
|
6
|
+
shape?: TargetShape;
|
|
7
|
+
/** The target's outline in the shown image, if known; it is more exact than the location. */
|
|
8
|
+
outline?: [number, number][];
|
|
9
|
+
/**
|
|
10
|
+
* Mapillary value of the target (`regulatory--bicycles-only--g1`). Without an `outline`, the
|
|
11
|
+
* image's own detection of this value is used: Mapillary links a map feature to few of its
|
|
12
|
+
* images, but almost every image has a detection of it. With several, the one nearest to the
|
|
13
|
+
* computed position wins (the computed position alone can be far off in 360° images).
|
|
14
|
+
*/
|
|
15
|
+
value?: string;
|
|
16
|
+
/** Label for the outline drawn around the target. */
|
|
17
|
+
label?: string;
|
|
18
|
+
};
|
|
19
|
+
export type MapillaryViewerOutline = {
|
|
20
|
+
id: string;
|
|
21
|
+
/** Image ("basic") coordinates, `[0, 0]` top left to `[1, 1]` bottom right. */
|
|
22
|
+
outline: [number, number][];
|
|
23
|
+
label?: string;
|
|
24
|
+
/** CSS color number, e.g. `0xffff00`. Default yellow. */
|
|
25
|
+
color?: number;
|
|
26
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { NormalizedPhoto, PhotoView } from '@osm-editor-kit/street-imagery';
|
|
2
2
|
import 'mapillary-js/dist/mapillary.css';
|
|
3
|
+
import type { MapillaryLookAt, MapillaryViewerOutline } from '../mapillary/lookAt';
|
|
3
4
|
import type { StreetImageryPhotoSelection } from '../types';
|
|
4
|
-
import { type MapillaryLookAt, type MapillaryViewerOutline } from './mapillaryLookAt';
|
|
5
5
|
type MapillaryPanelProps = {
|
|
6
6
|
photo: NormalizedPhoto;
|
|
7
7
|
groupPhotos: NormalizedPhoto[];
|
|
@@ -1,30 +1,6 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ViewTarget } from '@osm-editor-kit/street-imagery';
|
|
2
2
|
import { type Image, type Viewer } from 'mapillary-js';
|
|
3
|
-
|
|
4
|
-
export type MapillaryLookAt = {
|
|
5
|
-
lngLat: LngLat;
|
|
6
|
-
/** Size and height of the target; decides zoom and vertical position. Default: a traffic sign. */
|
|
7
|
-
shape?: TargetShape;
|
|
8
|
-
/** The target's outline in the shown image, if known; it is more exact than the location. */
|
|
9
|
-
outline?: [number, number][];
|
|
10
|
-
/**
|
|
11
|
-
* Mapillary value of the target (`regulatory--bicycles-only--g1`). Without an `outline`, the
|
|
12
|
-
* image's own detection of this value is used: Mapillary links a map feature to few of its
|
|
13
|
-
* images, but almost every image has a detection of it. With several, the one nearest to the
|
|
14
|
-
* computed position wins (the computed position alone can be far off in 360° images).
|
|
15
|
-
*/
|
|
16
|
-
value?: string;
|
|
17
|
-
/** Label for the outline drawn around the target. */
|
|
18
|
-
label?: string;
|
|
19
|
-
};
|
|
20
|
-
export type MapillaryViewerOutline = {
|
|
21
|
-
id: string;
|
|
22
|
-
/** Image ("basic") coordinates, `[0, 0]` top left to `[1, 1]` bottom right. */
|
|
23
|
-
outline: [number, number][];
|
|
24
|
-
label?: string;
|
|
25
|
-
/** CSS color number, e.g. `0xffff00`. Default yellow. */
|
|
26
|
-
color?: number;
|
|
27
|
-
};
|
|
3
|
+
import type { MapillaryLookAt, MapillaryViewerOutline } from '../mapillary/lookAt';
|
|
28
4
|
/**
|
|
29
5
|
* Where the target is in the image: from its outline, else computed from the locations
|
|
30
6
|
* (360°: the viewer's own projection; flat: a pinhole model). `undefined` when a flat image does
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { StreetLevelImageryViewer } from '../StreetLevelImageryViewer';
|
package/dist/viewer.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { useStreetImageryI18n } from './chunk-3DFVM6VK.js';
|
|
2
|
+
import { c } from 'react/compiler-runtime';
|
|
3
|
+
import { lazy, Suspense } from 'react';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
var MapillaryPanel = lazy(() => import('./MapillaryPanel-SOHGB7JA.js').then((module) => ({
|
|
7
|
+
default: module.MapillaryPanel
|
|
8
|
+
})));
|
|
9
|
+
var PanoramaxPanel = lazy(() => import('./PanoramaxPanel-5P5LWMRY.js').then((module) => ({
|
|
10
|
+
default: module.PanoramaxPanel
|
|
11
|
+
})));
|
|
12
|
+
var ViewerPanelPlaceholder = () => {
|
|
13
|
+
const $ = c(2);
|
|
14
|
+
const {
|
|
15
|
+
messages
|
|
16
|
+
} = useStreetImageryI18n();
|
|
17
|
+
let t0;
|
|
18
|
+
if ($[0] !== messages.viewer.loading) {
|
|
19
|
+
t0 = /* @__PURE__ */ jsx("div", { className: "flex min-h-48 animate-pulse items-center justify-center rounded-lg border border-slate-200 bg-slate-100", children: /* @__PURE__ */ jsx("span", { className: "text-sm text-slate-500", children: messages.viewer.loading }) });
|
|
20
|
+
$[0] = messages.viewer.loading;
|
|
21
|
+
$[1] = t0;
|
|
22
|
+
} else {
|
|
23
|
+
t0 = $[1];
|
|
24
|
+
}
|
|
25
|
+
return t0;
|
|
26
|
+
};
|
|
27
|
+
var StreetLevelImageryViewer = (t0) => {
|
|
28
|
+
const $ = c(22);
|
|
29
|
+
const {
|
|
30
|
+
photo,
|
|
31
|
+
groupPhotos,
|
|
32
|
+
onPhotoSelected,
|
|
33
|
+
onEaseMapToPoint,
|
|
34
|
+
onViewerPhoto,
|
|
35
|
+
onViewerView,
|
|
36
|
+
lookAtBearing,
|
|
37
|
+
lookAt,
|
|
38
|
+
outlines,
|
|
39
|
+
hideAttribution,
|
|
40
|
+
panoramaxPanel: PanoramaxPanelOverride
|
|
41
|
+
} = t0;
|
|
42
|
+
if (photo.providerId === "mapillary") {
|
|
43
|
+
let t1;
|
|
44
|
+
if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
45
|
+
t1 = /* @__PURE__ */ jsx(ViewerPanelPlaceholder, {});
|
|
46
|
+
$[0] = t1;
|
|
47
|
+
} else {
|
|
48
|
+
t1 = $[0];
|
|
49
|
+
}
|
|
50
|
+
let t2;
|
|
51
|
+
if ($[1] !== groupPhotos || $[2] !== hideAttribution || $[3] !== lookAt || $[4] !== lookAtBearing || $[5] !== onEaseMapToPoint || $[6] !== onPhotoSelected || $[7] !== onViewerPhoto || $[8] !== onViewerView || $[9] !== outlines || $[10] !== photo) {
|
|
52
|
+
t2 = /* @__PURE__ */ jsx(Suspense, { fallback: t1, children: /* @__PURE__ */ jsx(MapillaryPanel, { groupPhotos, hideAttribution, onEaseMapToPoint, onPhotoSelected, lookAt, lookAtBearing, outlines, onViewerPhoto, onViewerView, photo }) });
|
|
53
|
+
$[1] = groupPhotos;
|
|
54
|
+
$[2] = hideAttribution;
|
|
55
|
+
$[3] = lookAt;
|
|
56
|
+
$[4] = lookAtBearing;
|
|
57
|
+
$[5] = onEaseMapToPoint;
|
|
58
|
+
$[6] = onPhotoSelected;
|
|
59
|
+
$[7] = onViewerPhoto;
|
|
60
|
+
$[8] = onViewerView;
|
|
61
|
+
$[9] = outlines;
|
|
62
|
+
$[10] = photo;
|
|
63
|
+
$[11] = t2;
|
|
64
|
+
} else {
|
|
65
|
+
t2 = $[11];
|
|
66
|
+
}
|
|
67
|
+
return t2;
|
|
68
|
+
}
|
|
69
|
+
if (photo.providerId === "panoramax") {
|
|
70
|
+
const Panel = PanoramaxPanelOverride ?? PanoramaxPanel;
|
|
71
|
+
let t1;
|
|
72
|
+
if ($[12] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
73
|
+
t1 = /* @__PURE__ */ jsx(ViewerPanelPlaceholder, {});
|
|
74
|
+
$[12] = t1;
|
|
75
|
+
} else {
|
|
76
|
+
t1 = $[12];
|
|
77
|
+
}
|
|
78
|
+
let t2;
|
|
79
|
+
if ($[13] !== Panel || $[14] !== groupPhotos || $[15] !== hideAttribution || $[16] !== onEaseMapToPoint || $[17] !== onPhotoSelected || $[18] !== onViewerPhoto || $[19] !== onViewerView || $[20] !== photo) {
|
|
80
|
+
t2 = /* @__PURE__ */ jsx(Suspense, { fallback: t1, children: /* @__PURE__ */ jsx(Panel, { groupPhotos, hideAttribution, onViewerPhoto, onViewerView, onEaseMapToPoint, onPhotoSelected, photo }) });
|
|
81
|
+
$[13] = Panel;
|
|
82
|
+
$[14] = groupPhotos;
|
|
83
|
+
$[15] = hideAttribution;
|
|
84
|
+
$[16] = onEaseMapToPoint;
|
|
85
|
+
$[17] = onPhotoSelected;
|
|
86
|
+
$[18] = onViewerPhoto;
|
|
87
|
+
$[19] = onViewerView;
|
|
88
|
+
$[20] = photo;
|
|
89
|
+
$[21] = t2;
|
|
90
|
+
} else {
|
|
91
|
+
t2 = $[21];
|
|
92
|
+
}
|
|
93
|
+
return t2;
|
|
94
|
+
}
|
|
95
|
+
return null;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export { StreetLevelImageryViewer };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osm-editor-kit/street-imagery-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "React MapLibre layers and photo viewers for street-level imagery providers.",
|
|
5
5
|
"homepage": "https://osm-editor-kit.github.io/street-imagery/",
|
|
6
6
|
"bugs": {
|
|
@@ -27,6 +27,10 @@
|
|
|
27
27
|
"types": "./dist/photo-details/index.d.ts",
|
|
28
28
|
"import": "./dist/photo-details.js"
|
|
29
29
|
},
|
|
30
|
+
"./viewer": {
|
|
31
|
+
"types": "./dist/viewer/index.d.ts",
|
|
32
|
+
"import": "./dist/viewer.js"
|
|
33
|
+
},
|
|
30
34
|
"./viewer-panels": {
|
|
31
35
|
"types": "./dist/viewer-panels/index.d.ts",
|
|
32
36
|
"import": "./dist/viewer-panels.js"
|
|
@@ -49,12 +53,14 @@
|
|
|
49
53
|
"prepack": "bun ../../scripts/package-exports-for-publish.ts",
|
|
50
54
|
"postpack": "bun ../../scripts/package-exports-restore.ts"
|
|
51
55
|
},
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"@types/geojson": "^7946.0.16"
|
|
58
|
+
},
|
|
52
59
|
"devDependencies": {
|
|
53
60
|
"@babel/core": "^7.29.7",
|
|
54
61
|
"@panoramax/web-viewer": "^5",
|
|
55
62
|
"@tanstack/react-query": "^5.85.5",
|
|
56
63
|
"@types/babel__core": "^7.20.5",
|
|
57
|
-
"@types/geojson": "^7946.0.16",
|
|
58
64
|
"@types/react": "^19.1.10",
|
|
59
65
|
"@types/react-dom": "^19.1.7",
|
|
60
66
|
"babel-plugin-react-compiler": "^19.1.0-rc.2",
|
|
@@ -82,6 +88,9 @@
|
|
|
82
88
|
"peerDependenciesMeta": {
|
|
83
89
|
"@panoramax/web-viewer": {
|
|
84
90
|
"optional": true
|
|
91
|
+
},
|
|
92
|
+
"mapillary-js": {
|
|
93
|
+
"optional": true
|
|
85
94
|
}
|
|
86
95
|
},
|
|
87
96
|
"publishExports": {
|
|
@@ -93,6 +102,10 @@
|
|
|
93
102
|
"types": "./dist/photo-details/index.d.ts",
|
|
94
103
|
"import": "./dist/photo-details.js"
|
|
95
104
|
},
|
|
105
|
+
"./viewer": {
|
|
106
|
+
"types": "./dist/viewer/index.d.ts",
|
|
107
|
+
"import": "./dist/viewer.js"
|
|
108
|
+
},
|
|
96
109
|
"./viewer-panels": {
|
|
97
110
|
"types": "./dist/viewer-panels/index.d.ts",
|
|
98
111
|
"import": "./dist/viewer-panels.js"
|