@osm-editor-kit/street-imagery-react 0.1.0-alpha.12 → 0.1.0-alpha.13

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.
@@ -1,4 +1,5 @@
1
- import { useStreetImageryI18n } from './chunk-6EMFFIL2.js';
1
+ import { useStreetImageryI18n } from './chunk-3DFVM6VK.js';
2
+ import { c } from 'react/compiler-runtime';
2
3
  import { providerById, formatLocalDateTime, formatDate, formatRelativeDate } from '@osm-editor-kit/street-imagery';
3
4
  import { useRef, useEffect } from 'react';
4
5
  import { jsx, jsxs } from 'react/jsx-runtime';
@@ -68,168 +69,238 @@ var PHOTO_DETAILS_LABELS = {
68
69
  };
69
70
  var formatBytes = (bytes) => bytes >= 1e6 ? `${(bytes / 1e6).toFixed(1)} MB` : `${Math.round(bytes / 1e3)} kB`;
70
71
  var LINK_CLASS = "text-zinc-950 underline decoration-zinc-950/30 hover:decoration-zinc-950";
71
- var Section = ({ title, rows }) => {
72
- const filled = rows.filter(([, value]) => value != null && value !== "");
73
- if (filled.length === 0) {
74
- return null;
72
+ var Section = (t0) => {
73
+ const $ = c(16);
74
+ const {
75
+ title,
76
+ rows
77
+ } = t0;
78
+ let t1;
79
+ let t2;
80
+ let t3;
81
+ let t4;
82
+ let t5;
83
+ if ($[0] !== rows || $[1] !== title) {
84
+ t5 = /* @__PURE__ */ Symbol.for("react.early_return_sentinel");
85
+ bb0: {
86
+ const filled = rows.filter(_temp);
87
+ if (filled.length === 0) {
88
+ t5 = null;
89
+ break bb0;
90
+ }
91
+ t3 = "mt-6 first:mt-0";
92
+ if ($[7] !== title) {
93
+ t4 = /* @__PURE__ */ jsx("h3", { className: "text-xs/5 font-semibold tracking-wide text-zinc-500 uppercase", children: title });
94
+ $[7] = title;
95
+ $[8] = t4;
96
+ } else {
97
+ t4 = $[8];
98
+ }
99
+ t1 = "mt-1 grid grid-cols-[minmax(7rem,35%)_1fr] text-sm/6";
100
+ t2 = filled.map(_temp2);
101
+ }
102
+ $[0] = rows;
103
+ $[1] = title;
104
+ $[2] = t1;
105
+ $[3] = t2;
106
+ $[4] = t3;
107
+ $[5] = t4;
108
+ $[6] = t5;
109
+ } else {
110
+ t1 = $[2];
111
+ t2 = $[3];
112
+ t3 = $[4];
113
+ t4 = $[5];
114
+ t5 = $[6];
115
+ }
116
+ if (t5 !== /* @__PURE__ */ Symbol.for("react.early_return_sentinel")) {
117
+ return t5;
118
+ }
119
+ let t6;
120
+ if ($[9] !== t1 || $[10] !== t2) {
121
+ t6 = /* @__PURE__ */ jsx("dl", { className: t1, children: t2 });
122
+ $[9] = t1;
123
+ $[10] = t2;
124
+ $[11] = t6;
125
+ } else {
126
+ t6 = $[11];
75
127
  }
76
- return /* @__PURE__ */ jsxs("section", { className: "mt-6 first:mt-0", children: [
77
- /* @__PURE__ */ jsx("h3", { className: "text-xs/5 font-semibold tracking-wide text-zinc-500 uppercase", children: title }),
78
- /* @__PURE__ */ jsx("dl", { className: "mt-1 grid grid-cols-[minmax(7rem,35%)_1fr] text-sm/6", children: filled.map(([term, value]) => /* @__PURE__ */ jsxs("div", { className: "col-span-2 grid grid-cols-subgrid border-t border-zinc-950/5", children: [
79
- /* @__PURE__ */ jsx("dt", { className: "py-2 pr-3 text-zinc-500", children: term }),
80
- /* @__PURE__ */ jsx("dd", { className: "min-w-0 py-2 wrap-break-word text-zinc-950", children: value })
81
- ] }, term)) })
82
- ] });
128
+ let t7;
129
+ if ($[12] !== t3 || $[13] !== t4 || $[14] !== t6) {
130
+ t7 = /* @__PURE__ */ jsxs("section", { className: t3, children: [
131
+ t4,
132
+ t6
133
+ ] });
134
+ $[12] = t3;
135
+ $[13] = t4;
136
+ $[14] = t6;
137
+ $[15] = t7;
138
+ } else {
139
+ t7 = $[15];
140
+ }
141
+ return t7;
83
142
  };
84
- var PhotoDetailsDialog = ({
85
- photo,
86
- open,
87
- onClose,
88
- externalUrl,
89
- labels
90
- }) => {
91
- const { locale } = useStreetImageryI18n();
92
- const t = { ...PHOTO_DETAILS_LABELS[locale], ...labels };
143
+ var PhotoDetailsDialog = (t0) => {
144
+ const $ = c(19);
145
+ const {
146
+ photo,
147
+ open,
148
+ onClose,
149
+ externalUrl,
150
+ labels
151
+ } = t0;
152
+ const {
153
+ locale
154
+ } = useStreetImageryI18n();
155
+ const t = {
156
+ ...PHOTO_DETAILS_LABELS[locale],
157
+ ...labels
158
+ };
93
159
  const dialogRef = useRef(null);
94
- useEffect(
95
- function syncOpenState() {
160
+ let t1;
161
+ let t2;
162
+ if ($[0] !== open) {
163
+ t1 = function syncOpenState() {
96
164
  const dialog = dialogRef.current;
97
165
  if (!dialog) {
98
166
  return;
99
167
  }
100
168
  if (open && !dialog.open) {
101
169
  dialog.showModal();
102
- dialog.firstElementChild?.scrollTo({ top: 0 });
103
- } else if (!open && dialog.open) {
104
- dialog.close();
170
+ dialog.firstElementChild?.scrollTo({
171
+ top: 0
172
+ });
173
+ } else {
174
+ if (!open && dialog.open) {
175
+ dialog.close();
176
+ }
105
177
  }
106
- },
107
- [open]
108
- );
109
- const details = photo.details ?? {};
178
+ };
179
+ t2 = [open];
180
+ $[0] = open;
181
+ $[1] = t1;
182
+ $[2] = t2;
183
+ } else {
184
+ t1 = $[1];
185
+ t2 = $[2];
186
+ }
187
+ useEffect(t1, t2);
188
+ let t3;
189
+ if ($[3] !== photo.details) {
190
+ t3 = photo.details ?? {};
191
+ $[3] = photo.details;
192
+ $[4] = t3;
193
+ } else {
194
+ t3 = $[4];
195
+ }
196
+ const details = t3;
110
197
  const provider = providerById[photo.providerId];
111
198
  const capturedAt = (details.capturedAtLocal ? formatLocalDateTime(details.capturedAtLocal, locale) : null) ?? (photo.capturedAt != null ? formatDate(photo.capturedAt, locale) : null);
112
- const contact = details.creatorContact?.includes("@") ? /* @__PURE__ */ jsx("a", { className: LINK_CLASS, href: `mailto:${details.creatorContact}`, children: details.creatorContact }) : details.creatorContact;
113
- const license = details.license && details.licenseUrl ? /* @__PURE__ */ jsx("a", { className: LINK_CLASS, href: details.licenseUrl, rel: "noreferrer", target: "_blank", children: details.license }) : details.license;
114
- const photoId = externalUrl ? /* @__PURE__ */ jsx("a", { className: LINK_CLASS, href: externalUrl, rel: "noreferrer", target: "_blank", children: photo.photoId }) : photo.photoId;
115
- const exif = Object.entries(details.exif ?? {}).sort(([a], [b]) => a.localeCompare(b));
116
- return /* @__PURE__ */ jsx(
117
- "dialog",
118
- {
119
- "aria-labelledby": "photo-details-title",
120
- className: "m-auto w-full max-w-lg rounded-2xl bg-white p-0 shadow-lg ring-1 ring-zinc-950/10 backdrop:bg-zinc-950/25",
121
- ref: dialogRef,
122
- onClick: (event) => {
123
- if (event.target === event.currentTarget) {
124
- onClose();
125
- }
126
- },
127
- onClose,
128
- onKeyDown: (event) => {
129
- if (event.key === "Escape") {
130
- event.stopPropagation();
131
- }
132
- },
133
- children: /* @__PURE__ */ jsxs("div", { className: "max-h-[85vh] overflow-y-auto p-6 sm:p-8", children: [
134
- /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-4", children: [
135
- /* @__PURE__ */ jsxs("h2", { className: "text-base/6 font-semibold text-zinc-950", id: "photo-details-title", children: [
136
- t.title,
137
- /* @__PURE__ */ jsx("span", { className: "ml-2 font-normal text-zinc-500", children: provider.label })
138
- ] }),
139
- /* @__PURE__ */ jsx(
140
- "button",
141
- {
142
- className: "-m-1 rounded-md p-1 text-sm/6 font-medium text-zinc-500 hover:bg-zinc-950/5 hover:text-zinc-950",
143
- type: "button",
144
- onClick: onClose,
145
- children: t.close
146
- }
147
- )
148
- ] }),
149
- /* @__PURE__ */ jsxs("div", { className: "mt-6", children: [
150
- /* @__PURE__ */ jsx(
151
- Section,
152
- {
153
- rows: [
154
- [t.creator, photo.creatorName],
155
- [t.contact, contact],
156
- [
157
- t.capturedAt,
158
- capturedAt && photo.capturedAt != null ? `${capturedAt} \xB7 ${formatRelativeDate(photo.capturedAt, locale)}` : capturedAt
159
- ],
160
- [
161
- t.uploadedAt,
162
- details.uploadedAt != null ? formatDate(details.uploadedAt, locale) : null
163
- ],
164
- [t.license, license]
165
- ],
166
- title: t.sectionCapture
167
- }
168
- ),
169
- /* @__PURE__ */ jsx(
170
- Section,
171
- {
172
- rows: [
173
- [t.type, photo.isPano == null ? null : photo.isPano ? t.pano : t.flat],
174
- [t.camera, details.camera],
175
- [t.focalLength, details.focalLengthMm != null ? `${details.focalLengthMm} mm` : null],
176
- [
177
- t.fieldOfView,
178
- details.fieldOfViewDeg != null ? `${Math.round(details.fieldOfViewDeg)}\xB0` : null
179
- ]
180
- ],
181
- title: t.sectionCamera
182
- }
183
- ),
184
- /* @__PURE__ */ jsx(
185
- Section,
186
- {
187
- rows: [
188
- [t.coordinates, `${photo.lngLat[1].toFixed(6)}, ${photo.lngLat[0].toFixed(6)}`],
189
- [t.heading, photo.heading != null ? `${Math.round(photo.heading)}\xB0` : null],
190
- [
191
- t.accuracy,
192
- details.positionAccuracyMeters != null ? `\xB1 ${details.positionAccuracyMeters} m` : null
193
- ]
194
- ],
195
- title: t.sectionPosition
196
- }
197
- ),
198
- /* @__PURE__ */ jsx(
199
- Section,
200
- {
201
- rows: [
202
- [t.provider, provider.label],
203
- [t.instance, details.instance],
204
- [t.photoId, photoId],
205
- [t.sequence, photo.sequenceId],
206
- [t.rankInSequence, details.rankInSequence],
207
- [
208
- t.file,
209
- details.originalFileName ? `${details.originalFileName}${details.originalFileSizeBytes != null ? ` (${formatBytes(details.originalFileSizeBytes)})` : ""}` : null
210
- ]
211
- ],
212
- title: t.sectionSource
213
- }
214
- ),
215
- exif.length > 0 ? /* @__PURE__ */ jsxs("details", { className: "mt-6 border-t border-zinc-950/5 pt-3", children: [
216
- /* @__PURE__ */ jsx("summary", { className: "cursor-pointer text-xs/5 font-semibold tracking-wide text-zinc-500 uppercase hover:text-zinc-950", children: t.exif(exif.length) }),
217
- /* @__PURE__ */ jsx("dl", { className: "mt-2 grid grid-cols-[minmax(7rem,45%)_1fr] text-xs/5", children: exif.map(([key, value]) => /* @__PURE__ */ jsxs(
218
- "div",
219
- {
220
- className: "col-span-2 grid grid-cols-subgrid border-t border-zinc-950/5",
221
- children: [
222
- /* @__PURE__ */ jsx("dt", { className: "py-1 pr-3 wrap-break-word text-zinc-500", children: key }),
223
- /* @__PURE__ */ jsx("dd", { className: "min-w-0 py-1 wrap-break-word text-zinc-950", children: value })
224
- ]
225
- },
226
- key
227
- )) })
228
- ] }) : null
229
- ] })
230
- ] })
231
- }
232
- );
199
+ let t4;
200
+ if ($[5] !== details.creatorContact) {
201
+ t4 = details.creatorContact?.includes("@") ? /* @__PURE__ */ jsx("a", { className: LINK_CLASS, href: `mailto:${details.creatorContact}`, children: details.creatorContact }) : details.creatorContact;
202
+ $[5] = details.creatorContact;
203
+ $[6] = t4;
204
+ } else {
205
+ t4 = $[6];
206
+ }
207
+ const contact = t4;
208
+ let t5;
209
+ if ($[7] !== details.license || $[8] !== details.licenseUrl) {
210
+ t5 = details.license && details.licenseUrl ? /* @__PURE__ */ jsx("a", { className: LINK_CLASS, href: details.licenseUrl, rel: "noreferrer", target: "_blank", children: details.license }) : details.license;
211
+ $[7] = details.license;
212
+ $[8] = details.licenseUrl;
213
+ $[9] = t5;
214
+ } else {
215
+ t5 = $[9];
216
+ }
217
+ const license = t5;
218
+ let t6;
219
+ if ($[10] !== externalUrl || $[11] !== photo.photoId) {
220
+ t6 = externalUrl ? /* @__PURE__ */ jsx("a", { className: LINK_CLASS, href: externalUrl, rel: "noreferrer", target: "_blank", children: photo.photoId }) : photo.photoId;
221
+ $[10] = externalUrl;
222
+ $[11] = photo.photoId;
223
+ $[12] = t6;
224
+ } else {
225
+ t6 = $[12];
226
+ }
227
+ const photoId = t6;
228
+ let t7;
229
+ if ($[13] !== details.exif) {
230
+ t7 = details.exif ?? {};
231
+ $[13] = details.exif;
232
+ $[14] = t7;
233
+ } else {
234
+ t7 = $[14];
235
+ }
236
+ const exif = Object.entries(t7).sort(_temp3);
237
+ let t8;
238
+ if ($[15] !== onClose) {
239
+ t8 = (event) => {
240
+ if (event.target === event.currentTarget) {
241
+ onClose();
242
+ }
243
+ };
244
+ $[15] = onClose;
245
+ $[16] = t8;
246
+ } else {
247
+ t8 = $[16];
248
+ }
249
+ let t9;
250
+ if ($[17] !== provider.label) {
251
+ t9 = /* @__PURE__ */ jsx("span", { className: "ml-2 font-normal text-zinc-500", children: provider.label });
252
+ $[17] = provider.label;
253
+ $[18] = t9;
254
+ } else {
255
+ t9 = $[18];
256
+ }
257
+ return /* @__PURE__ */ jsx("dialog", { "aria-labelledby": "photo-details-title", className: "m-auto w-full max-w-lg rounded-2xl bg-white p-0 shadow-lg ring-1 ring-zinc-950/10 backdrop:bg-zinc-950/25", ref: dialogRef, onClick: t8, onClose, onKeyDown: _temp4, children: /* @__PURE__ */ jsxs("div", { className: "max-h-[85vh] overflow-y-auto p-6 sm:p-8", children: [
258
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-4", children: [
259
+ /* @__PURE__ */ jsxs("h2", { className: "text-base/6 font-semibold text-zinc-950", id: "photo-details-title", children: [
260
+ t.title,
261
+ t9
262
+ ] }),
263
+ /* @__PURE__ */ jsx("button", { className: "-m-1 rounded-md p-1 text-sm/6 font-medium text-zinc-500 hover:bg-zinc-950/5 hover:text-zinc-950", type: "button", onClick: onClose, children: t.close })
264
+ ] }),
265
+ /* @__PURE__ */ jsxs("div", { className: "mt-6", children: [
266
+ /* @__PURE__ */ jsx(Section, { rows: [[t.creator, photo.creatorName], [t.contact, contact], [t.capturedAt, capturedAt && photo.capturedAt != null ? `${capturedAt} \xB7 ${formatRelativeDate(photo.capturedAt, locale)}` : capturedAt], [t.uploadedAt, details.uploadedAt != null ? formatDate(details.uploadedAt, locale) : null], [t.license, license]], title: t.sectionCapture }),
267
+ /* @__PURE__ */ jsx(Section, { rows: [[t.type, photo.isPano == null ? null : photo.isPano ? t.pano : t.flat], [t.camera, details.camera], [t.focalLength, details.focalLengthMm != null ? `${details.focalLengthMm} mm` : null], [t.fieldOfView, details.fieldOfViewDeg != null ? `${Math.round(details.fieldOfViewDeg)}\xB0` : null]], title: t.sectionCamera }),
268
+ /* @__PURE__ */ jsx(Section, { rows: [[t.coordinates, `${photo.lngLat[1].toFixed(6)}, ${photo.lngLat[0].toFixed(6)}`], [t.heading, photo.heading != null ? `${Math.round(photo.heading)}\xB0` : null], [t.accuracy, details.positionAccuracyMeters != null ? `\xB1 ${details.positionAccuracyMeters} m` : null]], title: t.sectionPosition }),
269
+ /* @__PURE__ */ jsx(Section, { rows: [[t.provider, provider.label], [t.instance, details.instance], [t.photoId, photoId], [t.sequence, photo.sequenceId], [t.rankInSequence, details.rankInSequence], [t.file, details.originalFileName ? `${details.originalFileName}${details.originalFileSizeBytes != null ? ` (${formatBytes(details.originalFileSizeBytes)})` : ""}` : null]], title: t.sectionSource }),
270
+ exif.length > 0 ? /* @__PURE__ */ jsxs("details", { className: "mt-6 border-t border-zinc-950/5 pt-3", children: [
271
+ /* @__PURE__ */ jsx("summary", { className: "cursor-pointer text-xs/5 font-semibold tracking-wide text-zinc-500 uppercase hover:text-zinc-950", children: t.exif(exif.length) }),
272
+ /* @__PURE__ */ jsx("dl", { className: "mt-2 grid grid-cols-[minmax(7rem,45%)_1fr] text-xs/5", children: exif.map(_temp5) })
273
+ ] }) : null
274
+ ] })
275
+ ] }) });
233
276
  };
277
+ function _temp(t0) {
278
+ const [, value] = t0;
279
+ return value != null && value !== "";
280
+ }
281
+ function _temp2(t0) {
282
+ const [term, value_0] = t0;
283
+ return /* @__PURE__ */ jsxs("div", { className: "col-span-2 grid grid-cols-subgrid border-t border-zinc-950/5", children: [
284
+ /* @__PURE__ */ jsx("dt", { className: "py-2 pr-3 text-zinc-500", children: term }),
285
+ /* @__PURE__ */ jsx("dd", { className: "min-w-0 py-2 wrap-break-word text-zinc-950", children: value_0 })
286
+ ] }, term);
287
+ }
288
+ function _temp3(t0, t1) {
289
+ const [a] = t0;
290
+ const [b] = t1;
291
+ return a.localeCompare(b);
292
+ }
293
+ function _temp4(event_0) {
294
+ if (event_0.key === "Escape") {
295
+ event_0.stopPropagation();
296
+ }
297
+ }
298
+ function _temp5(t0) {
299
+ const [key, value] = t0;
300
+ return /* @__PURE__ */ jsxs("div", { className: "col-span-2 grid grid-cols-subgrid border-t border-zinc-950/5", children: [
301
+ /* @__PURE__ */ jsx("dt", { className: "py-1 pr-3 wrap-break-word text-zinc-500", children: key }),
302
+ /* @__PURE__ */ jsx("dd", { className: "min-w-0 py-1 wrap-break-word text-zinc-950", children: value })
303
+ ] }, key);
304
+ }
234
305
 
235
306
  export { PHOTO_DETAILS_LABELS, PhotoDetailsDialog };
@@ -1,3 +1,3 @@
1
- export { MapillaryPanel, mapillaryViewFor, setMapillaryViewerOutlines, turnMapillaryViewerTo } from './chunk-SGIB7AVC.js';
2
- export { PanoramaxDataProvider, PanoramaxPanel, panoramaxPhotoFromItem } from './chunk-XQXYV6SR.js';
3
- import './chunk-25UGGXIE.js';
1
+ export { MapillaryPanel, mapillaryViewFor, setMapillaryViewerOutlines, turnMapillaryViewerTo } from './chunk-QBBIFF2C.js';
2
+ export { PanoramaxDataProvider, PanoramaxPanel, panoramaxPhotoFromItem } from './chunk-5D7YCQUN.js';
3
+ import './chunk-GYUS2JVV.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osm-editor-kit/street-imagery-react",
3
- "version": "0.1.0-alpha.12",
3
+ "version": "0.1.0-alpha.13",
4
4
  "description": "React MapLibre layers and photo viewers for street-level imagery providers.",
5
5
  "homepage": "https://github.com/osmberlin/street-space-editor/tree/main/packages/street-imagery-react",
6
6
  "license": "MIT",
@@ -48,11 +48,14 @@
48
48
  "postpack": "bun ../../scripts/package-exports-restore.ts"
49
49
  },
50
50
  "devDependencies": {
51
+ "@babel/core": "^7.29.7",
51
52
  "@panoramax/web-viewer": "^5",
52
53
  "@tanstack/react-query": "^5.85.5",
54
+ "@types/babel__core": "^7.20.5",
53
55
  "@types/geojson": "^7946.0.16",
54
56
  "@types/react": "^19.1.10",
55
57
  "@types/react-dom": "^19.1.7",
58
+ "babel-plugin-react-compiler": "^19.1.0-rc.2",
56
59
  "bun-types": "^1.2.20",
57
60
  "mapillary-js": "^4.1.2",
58
61
  "maplibre-gl": "^6.7.0",
@@ -64,7 +67,7 @@
64
67
  "zustand": "^5.0.7"
65
68
  },
66
69
  "peerDependencies": {
67
- "@osm-editor-kit/street-imagery": "^0.1.0-alpha.9",
70
+ "@osm-editor-kit/street-imagery": "^0.1.0-alpha.10",
68
71
  "@panoramax/web-viewer": "^5",
69
72
  "@tanstack/react-query": "^5",
70
73
  "mapillary-js": "^4",
@@ -1,2 +0,0 @@
1
- export { MapillaryPanel } from './chunk-SGIB7AVC.js';
2
- import './chunk-25UGGXIE.js';
@@ -1,2 +0,0 @@
1
- export { PanoramaxPanel } from './chunk-XQXYV6SR.js';
2
- import './chunk-25UGGXIE.js';