@molecule/app-exif-panel-angular 0.0.0-stage → 0.0.1-stage
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/LICENSE +202 -0
- package/README.md +542 -2
- package/dist/exif-panel.component.d.ts +121 -0
- package/dist/exif-panel.component.d.ts.map +1 -0
- package/dist/exif-panel.component.js +341 -0
- package/dist/exif-panel.component.js.map +1 -0
- package/dist/format-parts.d.ts +47 -0
- package/dist/format-parts.d.ts.map +1 -0
- package/dist/format-parts.js +88 -0
- package/dist/format-parts.js.map +1 -0
- package/dist/format.d.ts +93 -0
- package/dist/format.d.ts.map +1 -0
- package/dist/format.js +164 -0
- package/dist/format.js.map +1 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +68 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +11 -0
- package/dist/types.js.map +1 -0
- package/package.json +72 -4
package/README.md
CHANGED
|
@@ -1,3 +1,543 @@
|
|
|
1
|
-
|
|
1
|
+
<!--
|
|
2
|
+
AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
3
|
+
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
|
+
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
|
+
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
+
Generated: 2026-11-16T11:08:42.324Z
|
|
7
|
+
-->
|
|
2
8
|
|
|
3
|
-
|
|
9
|
+
# @molecule/app-exif-panel-angular
|
|
10
|
+
|
|
11
|
+
Angular EXIF metadata panel for photo-sharing apps — the counterpart of
|
|
12
|
+
`@molecule/app-exif-panel-react`: the same props (React names) and the same
|
|
13
|
+
DOM for the same input.
|
|
14
|
+
|
|
15
|
+
Exports `<ExifPanel>` — a structured renderer for already-parsed EXIF data
|
|
16
|
+
(camera, lens, aperture, shutter, ISO, focal length, GPS, timestamp,
|
|
17
|
+
software, copyright). The caller is responsible for decoding the raw EXIF
|
|
18
|
+
payload (e.g. via the `exifr` library); this package is a
|
|
19
|
+
styling-agnostic, i18n-aware renderer only.
|
|
20
|
+
|
|
21
|
+
Also exports the `ExifData` and `ExifPanelProps` types and the pure
|
|
22
|
+
formatting helpers (`formatAperture`, `formatShutter`, `formatIso`,
|
|
23
|
+
`formatFocalLength`, `formatGps`, `formatTimestamp`, `formatCamera`,
|
|
24
|
+
`buildMapLink`, `formatDms`).
|
|
25
|
+
|
|
26
|
+
> **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
|
|
27
|
+
> It is written to be read by coding agents as much as by people, and is generated from this
|
|
28
|
+
> package's source — edit `src/index.ts` JSDoc, not this file.
|
|
29
|
+
|
|
30
|
+
## Quick Start
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import { Component } from '@angular/core'
|
|
34
|
+
import { ExifPanel, type ExifData } from '@molecule/app-exif-panel-angular'
|
|
35
|
+
|
|
36
|
+
@Component({
|
|
37
|
+
selector: 'app-photo-metadata',
|
|
38
|
+
standalone: true,
|
|
39
|
+
imports: [ExifPanel],
|
|
40
|
+
template: `<aside mol-exif-panel [exif]="exif" [showGps]="true" [compact]="false"></aside>`,
|
|
41
|
+
})
|
|
42
|
+
export class PhotoMetadata {
|
|
43
|
+
exif: ExifData = {}
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Type
|
|
48
|
+
|
|
49
|
+
`feature`
|
|
50
|
+
|
|
51
|
+
## Installation
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npm install @molecule/app-exif-panel-angular @angular/common @angular/core @angular/platform-browser @molecule/app-angular @molecule/app-i18n @molecule/app-ui @molecule/app-ui-angular
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## API
|
|
58
|
+
|
|
59
|
+
### Interfaces
|
|
60
|
+
|
|
61
|
+
#### `ExifData`
|
|
62
|
+
|
|
63
|
+
Parsed EXIF metadata. Every field is optional — extra fields are
|
|
64
|
+
permitted (the renderer ignores them) so callers can pass through the
|
|
65
|
+
full output of their EXIF parser without filtering.
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
interface ExifData {
|
|
69
|
+
/** Camera manufacturer (e.g. `"Canon"`, `"Sony"`, `"Apple"`). */
|
|
70
|
+
make?: string
|
|
71
|
+
/** Camera model (e.g. `"EOS R5"`, `"a7 III"`, `"iPhone 15 Pro"`). */
|
|
72
|
+
model?: string
|
|
73
|
+
/** Lens model description (e.g. `"RF 24-70mm F2.8 L IS USM"`). */
|
|
74
|
+
lensModel?: string
|
|
75
|
+
/** Aperture as an f-number (the `N` in `f/N`). */
|
|
76
|
+
fNumber?: number
|
|
77
|
+
/** Exposure / shutter time in seconds (e.g. `0.008` ≈ `1/125 s`). */
|
|
78
|
+
exposureTime?: number
|
|
79
|
+
/** ISO sensitivity (e.g. `100`, `1600`). */
|
|
80
|
+
iso?: number
|
|
81
|
+
/** Focal length in millimetres. */
|
|
82
|
+
focalLength?: number
|
|
83
|
+
/** 35 mm-equivalent focal length, when supplied by the camera. */
|
|
84
|
+
focalLength35mm?: number
|
|
85
|
+
/** Capture timestamp — `Date`, ISO 8601 string, or epoch millis. */
|
|
86
|
+
dateTimeOriginal?: Date | string | number
|
|
87
|
+
/** GPS latitude in signed decimal degrees. */
|
|
88
|
+
gpsLatitude?: number
|
|
89
|
+
/** GPS longitude in signed decimal degrees. */
|
|
90
|
+
gpsLongitude?: number
|
|
91
|
+
/** EXIF orientation tag (1–8). */
|
|
92
|
+
orientation?: number
|
|
93
|
+
/** Software / firmware that produced the file. */
|
|
94
|
+
software?: string
|
|
95
|
+
/** Copyright statement embedded in the file. */
|
|
96
|
+
copyright?: string
|
|
97
|
+
/** Pass-through for parser-specific extras the renderer ignores. */
|
|
98
|
+
[key: string]: unknown
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
#### `ExifPanelProps`
|
|
103
|
+
|
|
104
|
+
Props for the `<ExifPanel>` component.
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
interface ExifPanelProps {
|
|
108
|
+
/** Parsed EXIF metadata. */
|
|
109
|
+
exif: ExifData
|
|
110
|
+
/**
|
|
111
|
+
* Compact mode collapses the panel into a single condensed grid with
|
|
112
|
+
* smaller type and tighter spacing. Defaults to `false`.
|
|
113
|
+
*/
|
|
114
|
+
compact?: boolean
|
|
115
|
+
/**
|
|
116
|
+
* Whether to render the GPS coordinates row when latitude / longitude
|
|
117
|
+
* are present. Defaults to `true`.
|
|
118
|
+
*/
|
|
119
|
+
showGps?: boolean
|
|
120
|
+
/** Optional heading override. */
|
|
121
|
+
heading?: string
|
|
122
|
+
/** Extra classes appended to the panel root. */
|
|
123
|
+
className?: string
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Classes
|
|
128
|
+
|
|
129
|
+
#### `ExifPanel`
|
|
130
|
+
|
|
131
|
+
ExifPanel component.
|
|
132
|
+
|
|
133
|
+
A structured renderer for already-parsed EXIF metadata — camera, lens,
|
|
134
|
+
exposure (aperture + shutter + ISO + focal length), GPS (with optional map
|
|
135
|
+
link), and capture timestamp. Empty / undefined fields are silently
|
|
136
|
+
skipped.
|
|
137
|
+
|
|
138
|
+
The host IS the outer `<aside>` (`aside[mol-exif-panel]`), matching React's
|
|
139
|
+
root exactly. This is the Angular counterpart of
|
|
140
|
+
`@molecule/app-exif-panel-react`: the same props (React names), the same
|
|
141
|
+
ClassMap tokens, and the same DOM for the same input. All user-facing text
|
|
142
|
+
resolves through `useTranslation()` — the exposure notations as
|
|
143
|
+
`exifPanel.value.*` keys — and the capture timestamp formats in the app's
|
|
144
|
+
active locale (`useLocale()`).
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
@Component({
|
|
148
|
+
selector: 'aside[mol-exif-panel]',
|
|
149
|
+
standalone: true,
|
|
150
|
+
inputs: ['exif', 'compact', 'showGps', 'heading', 'className'],
|
|
151
|
+
host: {
|
|
152
|
+
'[class]': 'classes()',
|
|
153
|
+
'[attr.data-mol-id]': '"exif-panel"',
|
|
154
|
+
'[attr.aria-label]': 'ariaLabel()',
|
|
155
|
+
},
|
|
156
|
+
template: `<header data-mol-id="exif-panel-header" [class]="headerClasses()">
|
|
157
|
+
<p data-mol-id="exif-panel-eyebrow" [class]="eyebrowClasses()">{{ eyebrowText() }}</p>
|
|
158
|
+
<h3 data-mol-id="exif-panel-heading" [class]="headingClasses()">{{ headingText() }}</h3>
|
|
159
|
+
</header>
|
|
160
|
+
<dl data-mol-id="exif-panel-list">
|
|
161
|
+
@for (row of rows(); track row.molId) {
|
|
162
|
+
<div [attr.data-mol-id]="row.molId" [class]="rowClasses()">
|
|
163
|
+
<dt [class]="labelClasses()">{{ row.label }}</dt>
|
|
164
|
+
<dd [class]="valueClasses()">
|
|
165
|
+
@if (row.href) {
|
|
166
|
+
<a
|
|
167
|
+
[href]="row.href"
|
|
168
|
+
target="_blank"
|
|
169
|
+
rel="noreferrer noopener"
|
|
170
|
+
data-mol-id="exif-panel-map-link"
|
|
171
|
+
[class]="linkClasses()"
|
|
172
|
+
>{{ row.value }}</a
|
|
173
|
+
>
|
|
174
|
+
} @else {
|
|
175
|
+
{{ row.value }}
|
|
176
|
+
}
|
|
177
|
+
</dd>
|
|
178
|
+
</div>
|
|
179
|
+
}
|
|
180
|
+
</dl>`,
|
|
181
|
+
})
|
|
182
|
+
export class ExifPanel {
|
|
183
|
+
exif: ExifData = {}
|
|
184
|
+
|
|
185
|
+
compact?: boolean
|
|
186
|
+
|
|
187
|
+
showGps?: boolean
|
|
188
|
+
|
|
189
|
+
heading?: string
|
|
190
|
+
|
|
191
|
+
className?: string
|
|
192
|
+
|
|
193
|
+
private readonly cm: UIClassMap = getClassMap()
|
|
194
|
+
|
|
195
|
+
private readonly i18n = useTranslation()
|
|
196
|
+
|
|
197
|
+
private readonly activeLocale = useLocale()
|
|
198
|
+
|
|
199
|
+
compactMode(): boolean {
|
|
200
|
+
return this.compact ?? false
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
gpsShown(): boolean {
|
|
204
|
+
return this.showGps ?? true
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
classes(): string {
|
|
208
|
+
return this.cm.cn(this.cm.surface, this.className)
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
headerClasses(): string {
|
|
212
|
+
const pad = this.compactMode() ? 3 : 4
|
|
213
|
+
return this.cm.cn(this.cm.sp('px', pad), this.cm.sp('py', pad), this.cm.borderB)
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
eyebrowClasses(): string {
|
|
217
|
+
return this.cm.cn(this.cm.textSize('xs'), this.cm.fontWeight('medium'), this.cm.textMuted)
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
headingClasses(): string {
|
|
221
|
+
return this.cm.cn(
|
|
222
|
+
this.cm.textSize(this.compactMode() ? 'sm' : 'base'),
|
|
223
|
+
this.cm.fontWeight('bold'),
|
|
224
|
+
)
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
rowClasses(): string {
|
|
228
|
+
const compact = this.compactMode()
|
|
229
|
+
return this.cm.cn(
|
|
230
|
+
this.cm.flex({ align: 'start', justify: 'between', gap: compact ? 'sm' : 'md' }),
|
|
231
|
+
this.cm.sp('px', compact ? 3 : 4),
|
|
232
|
+
this.cm.sp('py', compact ? 2 : 3),
|
|
233
|
+
this.cm.borderB,
|
|
234
|
+
)
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
labelClasses(): string {
|
|
238
|
+
return this.cm.cn(
|
|
239
|
+
this.cm.textSize(this.compactMode() ? 'xs' : 'sm'),
|
|
240
|
+
this.cm.fontWeight('medium'),
|
|
241
|
+
this.cm.textMuted,
|
|
242
|
+
)
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
valueClasses(): string {
|
|
246
|
+
return this.cm.cn(this.cm.textSize(this.compactMode() ? 'sm' : 'base'), this.cm.textRight)
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
linkClasses(): string {
|
|
250
|
+
return this.cm.cn(this.cm.link)
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
ariaLabel(): string {
|
|
254
|
+
return this.i18n.t('exifPanel.aria.region', {}, { defaultValue: 'EXIF metadata' })
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
eyebrowText(): string {
|
|
258
|
+
return this.i18n.t('exifPanel.eyebrow', {}, { defaultValue: 'Frame metadata' })
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
headingText(): string {
|
|
262
|
+
return this.heading ?? this.i18n.t('exifPanel.heading', {}, { defaultValue: 'EXIF' })
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
rows(): ExifRow[] {
|
|
266
|
+
const exif = this.exif
|
|
267
|
+
const camera = formatCamera(exif.make, exif.model)
|
|
268
|
+
const lens = exif.lensModel?.trim() || null
|
|
269
|
+
const apertureDigits = formatApertureNumber(exif.fNumber)
|
|
270
|
+
const shutterDigits = formatShutterNumber(exif.exposureTime)
|
|
271
|
+
const isoDigits = formatIsoNumber(exif.iso)
|
|
272
|
+
const focalDigits = formatFocalLengthNumber(exif.focalLength)
|
|
273
|
+
const focal35Digits = formatFocalLengthNumber(exif.focalLength35mm)
|
|
274
|
+
const apertureText =
|
|
275
|
+
apertureDigits === null
|
|
276
|
+
? null
|
|
277
|
+
: this.i18n.t(
|
|
278
|
+
'exifPanel.value.aperture',
|
|
279
|
+
{ value: apertureDigits },
|
|
280
|
+
{
|
|
281
|
+
defaultValue: 'f/{{value}}',
|
|
282
|
+
},
|
|
283
|
+
)
|
|
284
|
+
const shutterText =
|
|
285
|
+
shutterDigits === null
|
|
286
|
+
? null
|
|
287
|
+
: this.i18n.t(
|
|
288
|
+
'exifPanel.value.shutter',
|
|
289
|
+
{ value: shutterDigits },
|
|
290
|
+
{
|
|
291
|
+
defaultValue: '{{value}} s',
|
|
292
|
+
},
|
|
293
|
+
)
|
|
294
|
+
const isoText =
|
|
295
|
+
isoDigits === null
|
|
296
|
+
? null
|
|
297
|
+
: this.i18n.t(
|
|
298
|
+
'exifPanel.value.iso',
|
|
299
|
+
{ value: isoDigits },
|
|
300
|
+
{ defaultValue: 'ISO {{value}}' },
|
|
301
|
+
)
|
|
302
|
+
const focalText =
|
|
303
|
+
focalDigits === null
|
|
304
|
+
? null
|
|
305
|
+
: this.i18n.t(
|
|
306
|
+
'exifPanel.value.focalLength',
|
|
307
|
+
{ value: focalDigits },
|
|
308
|
+
{
|
|
309
|
+
defaultValue: '{{value}} mm',
|
|
310
|
+
},
|
|
311
|
+
)
|
|
312
|
+
const focal35Text =
|
|
313
|
+
focal35Digits === null
|
|
314
|
+
? null
|
|
315
|
+
: this.i18n.t(
|
|
316
|
+
'exifPanel.value.focalLength',
|
|
317
|
+
{ value: focal35Digits },
|
|
318
|
+
{
|
|
319
|
+
defaultValue: '{{value}} mm',
|
|
320
|
+
},
|
|
321
|
+
)
|
|
322
|
+
const exposureParts = [apertureText, shutterText, isoText, focalText].filter(
|
|
323
|
+
(v): v is string => v !== null,
|
|
324
|
+
)
|
|
325
|
+
const gpsText = this.gpsShown() ? formatGps(exif.gpsLatitude, exif.gpsLongitude) : null
|
|
326
|
+
const mapHref = this.gpsShown() ? buildMapLink(exif.gpsLatitude, exif.gpsLongitude) : null
|
|
327
|
+
const timestamp = formatTimestamp(exif.dateTimeOriginal, this.activeLocale())
|
|
328
|
+
const software = exif.software?.trim() || null
|
|
329
|
+
const copyright = exif.copyright?.trim() || null
|
|
330
|
+
|
|
331
|
+
const out: ExifRow[] = []
|
|
332
|
+
if (camera)
|
|
333
|
+
out.push({
|
|
334
|
+
molId: 'exif-panel-row-camera',
|
|
335
|
+
label: this.i18n.t('exifPanel.camera', {}, { defaultValue: 'Camera' }),
|
|
336
|
+
value: camera,
|
|
337
|
+
})
|
|
338
|
+
if (lens)
|
|
339
|
+
out.push({
|
|
340
|
+
molId: 'exif-panel-row-lens',
|
|
341
|
+
label: this.i18n.t('exifPanel.lens', {}, { defaultValue: 'Lens' }),
|
|
342
|
+
value: lens,
|
|
343
|
+
})
|
|
344
|
+
if (exposureParts.length > 0)
|
|
345
|
+
out.push({
|
|
346
|
+
molId: 'exif-panel-row-exposure',
|
|
347
|
+
label: this.i18n.t('exifPanel.exposure', {}, { defaultValue: 'Exposure' }),
|
|
348
|
+
value: exposureParts.join(' · '),
|
|
349
|
+
})
|
|
350
|
+
if (focal35Text && focal35Text !== focalText)
|
|
351
|
+
out.push({
|
|
352
|
+
molId: 'exif-panel-row-focal35',
|
|
353
|
+
label: this.i18n.t('exifPanel.focalLength35mm', {}, { defaultValue: '35 mm equivalent' }),
|
|
354
|
+
value: focal35Text,
|
|
355
|
+
})
|
|
356
|
+
if (gpsText)
|
|
357
|
+
out.push({
|
|
358
|
+
molId: 'exif-panel-row-gps',
|
|
359
|
+
label: this.i18n.t('exifPanel.gps', {}, { defaultValue: 'GPS' }),
|
|
360
|
+
value: gpsText,
|
|
361
|
+
...(mapHref ? { href: mapHref } : {}),
|
|
362
|
+
})
|
|
363
|
+
if (timestamp)
|
|
364
|
+
out.push({
|
|
365
|
+
molId: 'exif-panel-row-timestamp',
|
|
366
|
+
label: this.i18n.t('exifPanel.timestamp', {}, { defaultValue: 'Captured' }),
|
|
367
|
+
value: timestamp,
|
|
368
|
+
})
|
|
369
|
+
if (software)
|
|
370
|
+
out.push({
|
|
371
|
+
molId: 'exif-panel-row-software',
|
|
372
|
+
label: this.i18n.t('exifPanel.software', {}, { defaultValue: 'Software' }),
|
|
373
|
+
value: software,
|
|
374
|
+
})
|
|
375
|
+
if (copyright)
|
|
376
|
+
out.push({
|
|
377
|
+
molId: 'exif-panel-row-copyright',
|
|
378
|
+
label: this.i18n.t('exifPanel.copyright', {}, { defaultValue: 'Copyright' }),
|
|
379
|
+
value: copyright,
|
|
380
|
+
})
|
|
381
|
+
return out
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
_(Member comments are left out to fit; the full declaration is in `node_modules/@molecule/app-exif-panel-angular/dist/exif-panel.component.d.ts`.)_
|
|
387
|
+
|
|
388
|
+
### Functions
|
|
389
|
+
|
|
390
|
+
#### `formatAperture(fNumber)`
|
|
391
|
+
|
|
392
|
+
Format an aperture f-number as `f/N` with one decimal place dropped
|
|
393
|
+
when whole.
|
|
394
|
+
|
|
395
|
+
```typescript
|
|
396
|
+
function formatAperture(fNumber: number | undefined): string | null
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
- `fNumber` — The aperture value (e.g. `2.8`, `5.6`, `8`).
|
|
400
|
+
|
|
401
|
+
**Returns:** A display string like `"f/2.8"` or `"f/8"`, or `null` when the input is missing / invalid.
|
|
402
|
+
|
|
403
|
+
#### `formatShutter(seconds)`
|
|
404
|
+
|
|
405
|
+
Format a shutter / exposure time in seconds as a human-readable
|
|
406
|
+
string. Sub-second times are rendered as a `1/x s` reciprocal with
|
|
407
|
+
the denominator rounded; longer exposures stay in seconds.
|
|
408
|
+
|
|
409
|
+
```typescript
|
|
410
|
+
function formatShutter(seconds: number | undefined): string | null
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
- `seconds` — Exposure time in seconds.
|
|
414
|
+
|
|
415
|
+
**Returns:** A display string like `"1/125 s"` or `"2 s"`, or `null` when the input is missing / invalid.
|
|
416
|
+
|
|
417
|
+
#### `formatIso(iso)`
|
|
418
|
+
|
|
419
|
+
Format an ISO sensitivity as `ISO N`.
|
|
420
|
+
|
|
421
|
+
```typescript
|
|
422
|
+
function formatIso(iso: number | undefined): string | null
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
- `iso` — The ISO value (e.g. `100`, `1600`).
|
|
426
|
+
|
|
427
|
+
**Returns:** A display string like `"ISO 1600"`, or `null` when missing.
|
|
428
|
+
|
|
429
|
+
#### `formatFocalLength(mm)`
|
|
430
|
+
|
|
431
|
+
Format a focal length value as `N mm`.
|
|
432
|
+
|
|
433
|
+
```typescript
|
|
434
|
+
function formatFocalLength(mm: number | undefined): string | null
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
- `mm` — Focal length in millimetres.
|
|
438
|
+
|
|
439
|
+
**Returns:** A display string like `"50 mm"`, or `null` when missing.
|
|
440
|
+
|
|
441
|
+
#### `formatDms(value, axis)`
|
|
442
|
+
|
|
443
|
+
Format a single GPS coordinate (latitude or longitude) as
|
|
444
|
+
deg/min/sec with a hemisphere suffix.
|
|
445
|
+
|
|
446
|
+
```typescript
|
|
447
|
+
function formatDms(value: number | undefined, axis: 'lat' | 'lon'): string | null
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
- `value` — Signed decimal degrees.
|
|
451
|
+
- `axis` — Which axis the value represents — picks `N`/`S` vs `E`/`W`.
|
|
452
|
+
|
|
453
|
+
**Returns:** A string like `"37° 25' 19.07" N"`, or `null` when missing.
|
|
454
|
+
|
|
455
|
+
#### `formatGps(latitude, longitude)`
|
|
456
|
+
|
|
457
|
+
Format a GPS coordinate pair as a single deg/min/sec string.
|
|
458
|
+
|
|
459
|
+
```typescript
|
|
460
|
+
function formatGps(latitude: number | undefined, longitude: number | undefined): string | null
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
- `latitude` — Latitude in signed decimal degrees.
|
|
464
|
+
- `longitude` — Longitude in signed decimal degrees.
|
|
465
|
+
|
|
466
|
+
**Returns:** A combined string like `"37° 25' 19.07" N, 122° 5' 4.16" W"`, or `null` if either value is missing.
|
|
467
|
+
|
|
468
|
+
#### `buildMapLink(latitude, longitude)`
|
|
469
|
+
|
|
470
|
+
Build an OpenStreetMap link URL for a GPS coordinate pair.
|
|
471
|
+
|
|
472
|
+
```typescript
|
|
473
|
+
function buildMapLink(latitude: number | undefined, longitude: number | undefined): string | null
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
- `latitude` — Latitude in signed decimal degrees.
|
|
477
|
+
- `longitude` — Longitude in signed decimal degrees.
|
|
478
|
+
|
|
479
|
+
**Returns:** An `https://www.openstreetmap.org/?...` URL, or `null` when either input is missing.
|
|
480
|
+
|
|
481
|
+
#### `formatTimestamp(value, locale)`
|
|
482
|
+
|
|
483
|
+
Format an EXIF capture timestamp. Accepts `Date`, ISO string, or
|
|
484
|
+
epoch milliseconds and renders via `toLocaleString` so the result
|
|
485
|
+
respects the given locale and the host environment's timezone — pass
|
|
486
|
+
the app's active locale so the text follows a locale switch.
|
|
487
|
+
|
|
488
|
+
```typescript
|
|
489
|
+
function formatTimestamp(value: Date | string | number | undefined, locale?: string): string | null
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
- `value` — The timestamp value pulled from EXIF.
|
|
493
|
+
- `locale` — The locale to format in (an `Intl` locale code); the host environment's locale when omitted.
|
|
494
|
+
|
|
495
|
+
**Returns:** A locale-formatted date/time string, or `null` when missing or unparseable.
|
|
496
|
+
|
|
497
|
+
#### `formatCamera(make, model)`
|
|
498
|
+
|
|
499
|
+
Compose camera make + model into a single `"Make Model"` string,
|
|
500
|
+
collapsing duplication when the model already starts with the make
|
|
501
|
+
(Sony often does this).
|
|
502
|
+
|
|
503
|
+
```typescript
|
|
504
|
+
function formatCamera(make: string | undefined, model: string | undefined): string | null
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
- `make` — Camera manufacturer.
|
|
508
|
+
- `model` — Camera model.
|
|
509
|
+
|
|
510
|
+
**Returns:** The combined label, or `null` when both inputs are missing.
|
|
511
|
+
|
|
512
|
+
## Injection Notes
|
|
513
|
+
|
|
514
|
+
### Requirements
|
|
515
|
+
|
|
516
|
+
Peer dependencies:
|
|
517
|
+
|
|
518
|
+
- `@angular/common` ^22.0.0
|
|
519
|
+
- `@angular/core` ^22.0.0
|
|
520
|
+
- `@angular/platform-browser` ^22.0.0
|
|
521
|
+
- `@molecule/app-angular` ^3.5.0
|
|
522
|
+
- `@molecule/app-i18n` ^1.0.1
|
|
523
|
+
- `@molecule/app-ui` ^1.0.1
|
|
524
|
+
- `@molecule/app-ui-angular` ^1.1.0
|
|
525
|
+
|
|
526
|
+
### Runtime Dependencies
|
|
527
|
+
|
|
528
|
+
- `@angular/common`
|
|
529
|
+
- `@angular/core`
|
|
530
|
+
- `@angular/platform-browser`
|
|
531
|
+
- `@molecule/app-angular`
|
|
532
|
+
- `@molecule/app-i18n`
|
|
533
|
+
- `@molecule/app-ui`
|
|
534
|
+
- `@molecule/app-ui-angular`
|
|
535
|
+
|
|
536
|
+
Requires a bonded ClassMap (`getClassMap()`) and the binding's i18n
|
|
537
|
+
provider (`provideI18n` or `provideMolecule`) for `useTranslation()`. All
|
|
538
|
+
user-facing text resolves through `t()` with React's keys and English
|
|
539
|
+
`defaultValue`s.
|
|
540
|
+
|
|
541
|
+
## Translations
|
|
542
|
+
|
|
543
|
+
Translation strings are provided by `@molecule/app-locales-exif-panel`.
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import type { ExifData } from './types.js';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
/** One label/value row the panel renders, after the empty ones are dropped. */
|
|
4
|
+
interface ExifRow {
|
|
5
|
+
/** Stable `data-mol-id` token for the row. */
|
|
6
|
+
molId: string;
|
|
7
|
+
/** Translated label text. */
|
|
8
|
+
label: string;
|
|
9
|
+
/** Already-formatted value text. */
|
|
10
|
+
value: string;
|
|
11
|
+
/** Map link the value renders as, for the GPS row. */
|
|
12
|
+
href?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* ExifPanel component.
|
|
16
|
+
*
|
|
17
|
+
* A structured renderer for already-parsed EXIF metadata — camera, lens,
|
|
18
|
+
* exposure (aperture + shutter + ISO + focal length), GPS (with optional map
|
|
19
|
+
* link), and capture timestamp. Empty / undefined fields are silently
|
|
20
|
+
* skipped.
|
|
21
|
+
*
|
|
22
|
+
* The host IS the outer `<aside>` (`aside[mol-exif-panel]`), matching React's
|
|
23
|
+
* root exactly. This is the Angular counterpart of
|
|
24
|
+
* `@molecule/app-exif-panel-react`: the same props (React names), the same
|
|
25
|
+
* ClassMap tokens, and the same DOM for the same input. All user-facing text
|
|
26
|
+
* resolves through `useTranslation()` — the exposure notations as
|
|
27
|
+
* `exifPanel.value.*` keys — and the capture timestamp formats in the app's
|
|
28
|
+
* active locale (`useLocale()`).
|
|
29
|
+
*/
|
|
30
|
+
export declare class ExifPanel {
|
|
31
|
+
/** Parsed EXIF metadata. */
|
|
32
|
+
exif: ExifData;
|
|
33
|
+
/** Compact mode: smaller type and tighter spacing (React's `compact = false`). */
|
|
34
|
+
compact?: boolean;
|
|
35
|
+
/** Whether to render the GPS row (React's `showGps = true`). */
|
|
36
|
+
showGps?: boolean;
|
|
37
|
+
/** Optional heading override. */
|
|
38
|
+
heading?: string;
|
|
39
|
+
/** Extra classes appended to the panel root. */
|
|
40
|
+
className?: string;
|
|
41
|
+
/** The current class map. */
|
|
42
|
+
private readonly cm;
|
|
43
|
+
/** The binding's translation function (React's `useTranslation()`). */
|
|
44
|
+
private readonly i18n;
|
|
45
|
+
/** The app's active locale (React's `useLocale()`); re-formats the timestamp on a switch. */
|
|
46
|
+
private readonly activeLocale;
|
|
47
|
+
/**
|
|
48
|
+
* Whether compact mode is on, with React's `false` default.
|
|
49
|
+
* @returns The effective compact flag.
|
|
50
|
+
*/
|
|
51
|
+
compactMode(): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Whether the GPS row renders, with React's `true` default.
|
|
54
|
+
* @returns The effective `showGps` flag.
|
|
55
|
+
*/
|
|
56
|
+
gpsShown(): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* The wrapper class list (React's `cm.cn(cm.surface, className)`).
|
|
59
|
+
* @returns The class string.
|
|
60
|
+
*/
|
|
61
|
+
classes(): string;
|
|
62
|
+
/**
|
|
63
|
+
* The header class list.
|
|
64
|
+
* @returns The class string.
|
|
65
|
+
*/
|
|
66
|
+
headerClasses(): string;
|
|
67
|
+
/**
|
|
68
|
+
* The eyebrow class list.
|
|
69
|
+
* @returns The class string.
|
|
70
|
+
*/
|
|
71
|
+
eyebrowClasses(): string;
|
|
72
|
+
/**
|
|
73
|
+
* The heading class list.
|
|
74
|
+
* @returns The class string.
|
|
75
|
+
*/
|
|
76
|
+
headingClasses(): string;
|
|
77
|
+
/**
|
|
78
|
+
* The label-value row class list.
|
|
79
|
+
* @returns The class string.
|
|
80
|
+
*/
|
|
81
|
+
rowClasses(): string;
|
|
82
|
+
/**
|
|
83
|
+
* The `<dt>` label class list.
|
|
84
|
+
* @returns The class string.
|
|
85
|
+
*/
|
|
86
|
+
labelClasses(): string;
|
|
87
|
+
/**
|
|
88
|
+
* The `<dd>` value class list.
|
|
89
|
+
* @returns The class string.
|
|
90
|
+
*/
|
|
91
|
+
valueClasses(): string;
|
|
92
|
+
/**
|
|
93
|
+
* The map-link class list.
|
|
94
|
+
* @returns The class string.
|
|
95
|
+
*/
|
|
96
|
+
linkClasses(): string;
|
|
97
|
+
/**
|
|
98
|
+
* The panel's `aria-label`.
|
|
99
|
+
* @returns The translated label.
|
|
100
|
+
*/
|
|
101
|
+
ariaLabel(): string;
|
|
102
|
+
/**
|
|
103
|
+
* The eyebrow text above the heading.
|
|
104
|
+
* @returns The translated text.
|
|
105
|
+
*/
|
|
106
|
+
eyebrowText(): string;
|
|
107
|
+
/**
|
|
108
|
+
* The heading, honouring a custom override.
|
|
109
|
+
* @returns The heading text.
|
|
110
|
+
*/
|
|
111
|
+
headingText(): string;
|
|
112
|
+
/**
|
|
113
|
+
* Build every row the current EXIF object renders, in React's order.
|
|
114
|
+
* @returns The non-empty rows.
|
|
115
|
+
*/
|
|
116
|
+
rows(): ExifRow[];
|
|
117
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ExifPanel, never>;
|
|
118
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ExifPanel, "aside[mol-exif-panel]", never, { "exif": { "alias": "exif"; "required": false; }; "compact": { "alias": "compact"; "required": false; }; "showGps": { "alias": "showGps"; "required": false; }; "heading": { "alias": "heading"; "required": false; }; "className": { "alias": "className"; "required": false; }; }, {}, never, never, true, never>;
|
|
119
|
+
}
|
|
120
|
+
export {};
|
|
121
|
+
//# sourceMappingURL=exif-panel.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exif-panel.component.d.ts","sourceRoot":"","sources":["../src/exif-panel.component.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;;AAE1C,+EAA+E;AAC/E,UAAU,OAAO;IACf,8CAA8C;IAC9C,KAAK,EAAE,MAAM,CAAA;IACb,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAA;IACb,sDAAsD;IACtD,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBAmCa,SAAS;IACpB,4BAA4B;IAC5B,IAAI,EAAE,QAAQ,CAAK;IAEnB,kFAAkF;IAClF,OAAO,CAAC,EAAE,OAAO,CAAA;IAEjB,gEAAgE;IAChE,OAAO,CAAC,EAAE,OAAO,CAAA;IAEjB,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB,6BAA6B;IAC7B,OAAO,CAAC,QAAQ,CAAC,EAAE,CAA4B;IAE/C,uEAAuE;IACvE,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAmB;IAExC,6FAA6F;IAC7F,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAc;IAE3C;;;OAGG;IACH,WAAW,IAAI,OAAO;IAItB;;;OAGG;IACH,QAAQ,IAAI,OAAO;IAInB;;;OAGG;IACH,OAAO,IAAI,MAAM;IAIjB;;;OAGG;IACH,aAAa,IAAI,MAAM;IAKvB;;;OAGG;IACH,cAAc,IAAI,MAAM;IAIxB;;;OAGG;IACH,cAAc,IAAI,MAAM;IAOxB;;;OAGG;IACH,UAAU,IAAI,MAAM;IAUpB;;;OAGG;IACH,YAAY,IAAI,MAAM;IAQtB;;;OAGG;IACH,YAAY,IAAI,MAAM;IAItB;;;OAGG;IACH,WAAW,IAAI,MAAM;IAIrB;;;OAGG;IACH,SAAS,IAAI,MAAM;IAInB;;;OAGG;IACH,WAAW,IAAI,MAAM;IAIrB;;;OAGG;IACH,WAAW,IAAI,MAAM;IAIrB;;;OAGG;IACH,IAAI,IAAI,OAAO,EAAE;yCAnJN,SAAS;2CAAT,SAAS;CA2QrB"}
|