@molecule/app-exif-panel-angular
Feature · exif-panel · App (browser) · v1.1.1 · Apache-2.0
EXIF metadata renderer for photo-sharing apps — camera, lens, aperture, shutter, ISO, focal length, GPS, timestamp
npm install @molecule/app-exif-panel-angularHow it works
@molecule/app-exif-panel-angular is a ready-made exif-panel feature for the app (browser) side. It composes the core interfaces it needs, so it works with whichever providers your app has bonded.
import { Component } from '@angular/core'
import { ExifPanel, type ExifData } from '@molecule/app-exif-panel-angular'
@Component({
selector: 'app-photo-metadata',
standalone: true,
imports: [ExifPanel],
template: `<aside mol-exif-panel [exif]="exif" [showGps]="true" [compact]="false"></aside>`,
})
export class PhotoMetadata {
exif: ExifData = {}
}Works with: @molecule/app-angular, @molecule/app-i18n, @molecule/app-ui, @molecule/app-ui-angular
Reference
Angular EXIF metadata panel for photo-sharing apps — the counterpart of
@molecule/app-exif-panel-react: the same props (React names) and the same
DOM for the same input.
Exports <ExifPanel> — a structured renderer for already-parsed EXIF data
(camera, lens, aperture, shutter, ISO, focal length, GPS, timestamp,
software, copyright). The caller is responsible for decoding the raw EXIF
payload (e.g. via the exifr library); this package is a
styling-agnostic, i18n-aware renderer only.
Also exports the ExifData and ExifPanelProps types and the pure
formatting helpers (formatAperture, formatShutter, formatIso,
formatFocalLength, formatGps, formatTimestamp, formatCamera,
buildMapLink, formatDms).
Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit
src/index.tsJSDoc, not this file.
Quick Start
import { Component } from '@angular/core'
import { ExifPanel, type ExifData } from '@molecule/app-exif-panel-angular'
@Component({
selector: 'app-photo-metadata',
standalone: true,
imports: [ExifPanel],
template: `<aside mol-exif-panel [exif]="exif" [showGps]="true" [compact]="false"></aside>`,
})
export class PhotoMetadata {
exif: ExifData = {}
}
Type
feature
Installation
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
API
Interfaces
ExifData
Parsed EXIF metadata. Every field is optional — extra fields are permitted (the renderer ignores them) so callers can pass through the full output of their EXIF parser without filtering.
interface ExifData {
/** Camera manufacturer (e.g. `"Canon"`, `"Sony"`, `"Apple"`). */
make?: string
/** Camera model (e.g. `"EOS R5"`, `"a7 III"`, `"iPhone 15 Pro"`). */
model?: string
/** Lens model description (e.g. `"RF 24-70mm F2.8 L IS USM"`). */
lensModel?: string
/** Aperture as an f-number (the `N` in `f/N`). */
fNumber?: number
/** Exposure / shutter time in seconds (e.g. `0.008` ≈ `1/125 s`). */
exposureTime?: number
/** ISO sensitivity (e.g. `100`, `1600`). */
iso?: number
/** Focal length in millimetres. */
focalLength?: number
/** 35 mm-equivalent focal length, when supplied by the camera. */
focalLength35mm?: number
/** Capture timestamp — `Date`, ISO 8601 string, or epoch millis. */
dateTimeOriginal?: Date | string | number
/** GPS latitude in signed decimal degrees. */
gpsLatitude?: number
/** GPS longitude in signed decimal degrees. */
gpsLongitude?: number
/** EXIF orientation tag (1–8). */
orientation?: number
/** Software / firmware that produced the file. */
software?: string
/** Copyright statement embedded in the file. */
copyright?: string
/** Pass-through for parser-specific extras the renderer ignores. */
[key: string]: unknown
}
ExifPanelProps
Props for the <ExifPanel> component.
interface ExifPanelProps {
/** Parsed EXIF metadata. */
exif: ExifData
/**
* Compact mode collapses the panel into a single condensed grid with
* smaller type and tighter spacing. Defaults to `false`.
*/
compact?: boolean
/**
* Whether to render the GPS coordinates row when latitude / longitude
* are present. Defaults to `true`.
*/
showGps?: boolean
/** Optional heading override. */
heading?: string
/** Extra classes appended to the panel root. */
className?: string
}
Classes
ExifPanel
ExifPanel component.
A structured renderer for already-parsed EXIF metadata — camera, lens, exposure (aperture + shutter + ISO + focal length), GPS (with optional map link), and capture timestamp. Empty / undefined fields are silently skipped.
The host IS the outer <aside> (aside[mol-exif-panel]), matching React's
root exactly. This is the Angular counterpart of
@molecule/app-exif-panel-react: the same props (React names), the same
ClassMap tokens, and the same DOM for the same input. All user-facing text
resolves through useTranslation() — the exposure notations as
exifPanel.value.* keys — and the capture timestamp formats in the app's
active locale (useLocale()).
@Component({
selector: 'aside[mol-exif-panel]',
standalone: true,
inputs: ['exif', 'compact', 'showGps', 'heading', 'className'],
host: {
'[class]': 'classes()',
'[attr.data-mol-id]': '"exif-panel"',
'[attr.aria-label]': 'ariaLabel()',
},
template: `<header data-mol-id="exif-panel-header" [class]="headerClasses()">
<p data-mol-id="exif-panel-eyebrow" [class]="eyebrowClasses()">{{ eyebrowText() }}</p>
<h3 data-mol-id="exif-panel-heading" [class]="headingClasses()">{{ headingText() }}</h3>
</header>
<dl data-mol-id="exif-panel-list">
@for (row of rows(); track row.molId) {
<div [attr.data-mol-id]="row.molId" [class]="rowClasses()">
<dt [class]="labelClasses()">{{ row.label }}</dt>
<dd [class]="valueClasses()">
@if (row.href) {
<a
[href]="row.href"
target="_blank"
rel="noreferrer noopener"
data-mol-id="exif-panel-map-link"
[class]="linkClasses()"
>{{ row.value }}</a
>
} @else {
{{ row.value }}
}
</dd>
</div>
}
</dl>`,
})
export class ExifPanel {
/** Parsed EXIF metadata. */
exif: ExifData = {}
compact?: boolean
/** Whether to render the GPS row (React's `showGps = true`). */
showGps?: boolean
/** Optional heading override. */
heading?: string
/** Extra classes appended to the panel root. */
className?: string
/** The current class map. */
private readonly cm: UIClassMap = getClassMap()
private readonly i18n = useTranslation()
private readonly activeLocale = useLocale()
/** Whether compact mode is on, with React's `false` default. */
compactMode(): boolean {
return this.compact ?? false
}
/** Whether the GPS row renders, with React's `true` default. */
gpsShown(): boolean {
return this.showGps ?? true
}
/** The wrapper class list (React's `cm.cn(cm.surface, className)`). */
classes(): string {
return this.cm.cn(this.cm.surface, this.className)
}
/** The header class list. */
headerClasses(): string {
const pad = this.compactMode() ? 3 : 4
return this.cm.cn(this.cm.sp('px', pad), this.cm.sp('py', pad), this.cm.borderB)
}
/** The eyebrow class list. */
eyebrowClasses(): string {
return this.cm.cn(this.cm.textSize('xs'), this.cm.fontWeight('medium'), this.cm.textMuted)
}
/** The heading class list. */
headingClasses(): string {
return this.cm.cn(
this.cm.textSize(this.compactMode() ? 'sm' : 'base'),
this.cm.fontWeight('bold'),
)
}
/** The label-value row class list. */
rowClasses(): string {
const compact = this.compactMode()
return this.cm.cn(
this.cm.flex({ align: 'start', justify: 'between', gap: compact ? 'sm' : 'md' }),
this.cm.sp('px', compact ? 3 : 4),
this.cm.sp('py', compact ? 2 : 3),
this.cm.borderB,
)
}
/** The `<dt>` label class list. */
labelClasses(): string {
return this.cm.cn(
this.cm.textSize(this.compactMode() ? 'xs' : 'sm'),
this.cm.fontWeight('medium'),
this.cm.textMuted,
)
}
/** The `<dd>` value class list. */
valueClasses(): string {
return this.cm.cn(this.cm.textSize(this.compactMode() ? 'sm' : 'base'), this.cm.textRight)
}
/** The map-link class list. */
linkClasses(): string {
return this.cm.cn(this.cm.link)
}
/** The panel's `aria-label`. */
ariaLabel(): string {
return this.i18n.t('exifPanel.aria.region', {}, { defaultValue: 'EXIF metadata' })
}
/** The eyebrow text above the heading. */
eyebrowText(): string {
return this.i18n.t('exifPanel.eyebrow', {}, { defaultValue: 'Frame metadata' })
}
/** The heading, honouring a custom override. */
headingText(): string {
return this.heading ?? this.i18n.t('exifPanel.heading', {}, { defaultValue: 'EXIF' })
}
rows(): ExifRow[] {
const exif = this.exif
const camera = formatCamera(exif.make, exif.model)
const lens = exif.lensModel?.trim() || null
const apertureDigits = formatApertureNumber(exif.fNumber)
const shutterDigits = formatShutterNumber(exif.exposureTime)
const isoDigits = formatIsoNumber(exif.iso)
const focalDigits = formatFocalLengthNumber(exif.focalLength)
const focal35Digits = formatFocalLengthNumber(exif.focalLength35mm)
// locale re-words the unit around them; the ` · ` join is punctuation.
const apertureText =
apertureDigits === null
? null
: this.i18n.t(
'exifPanel.value.aperture',
{ value: apertureDigits },
{
defaultValue: 'f/{{value}}',
},
)
const shutterText =
shutterDigits === null
? null
: this.i18n.t(
'exifPanel.value.shutter',
{ value: shutterDigits },
{
defaultValue: '{{value}} s',
},
)
const isoText =
isoDigits === null
? null
: this.i18n.t(
'exifPanel.value.iso',
{ value: isoDigits },
{ defaultValue: 'ISO {{value}}' },
)
const focalText =
focalDigits === null
? null
: this.i18n.t(
'exifPanel.value.focalLength',
{ value: focalDigits },
{
defaultValue: '{{value}} mm',
},
)
const focal35Text =
focal35Digits === null
? null
: this.i18n.t(
'exifPanel.value.focalLength',
{ value: focal35Digits },
{
defaultValue: '{{value}} mm',
},
)
const exposureParts = [apertureText, shutterText, isoText, focalText].filter(
(v): v is string => v !== null,
)
const gpsText = this.gpsShown() ? formatGps(exif.gpsLatitude, exif.gpsLongitude) : null
const mapHref = this.gpsShown() ? buildMapLink(exif.gpsLatitude, exif.gpsLongitude) : null
const timestamp = formatTimestamp(exif.dateTimeOriginal, this.activeLocale())
const software = exif.software?.trim() || null
const copyright = exif.copyright?.trim() || null
const out: ExifRow[] = []
if (camera)
out.push({
molId: 'exif-panel-row-camera',
label: this.i18n.t('exifPanel.camera', {}, { defaultValue: 'Camera' }),
value: camera,
})
if (lens)
out.push({
molId: 'exif-panel-row-lens',
label: this.i18n.t('exifPanel.lens', {}, { defaultValue: 'Lens' }),
value: lens,
})
if (exposureParts.length > 0)
out.push({
molId: 'exif-panel-row-exposure',
label: this.i18n.t('exifPanel.exposure', {}, { defaultValue: 'Exposure' }),
value: exposureParts.join(' · '),
})
if (focal35Text && focal35Text !== focalText)
out.push({
molId: 'exif-panel-row-focal35',
label: this.i18n.t('exifPanel.focalLength35mm', {}, { defaultValue: '35 mm equivalent' }),
value: focal35Text,
})
if (gpsText)
out.push({
molId: 'exif-panel-row-gps',
label: this.i18n.t('exifPanel.gps', {}, { defaultValue: 'GPS' }),
value: gpsText,
...(mapHref ? { href: mapHref } : {}),
})
if (timestamp)
out.push({
molId: 'exif-panel-row-timestamp',
label: this.i18n.t('exifPanel.timestamp', {}, { defaultValue: 'Captured' }),
value: timestamp,
})
if (software)
out.push({
molId: 'exif-panel-row-software',
label: this.i18n.t('exifPanel.software', {}, { defaultValue: 'Software' }),
value: software,
})
if (copyright)
out.push({
molId: 'exif-panel-row-copyright',
label: this.i18n.t('exifPanel.copyright', {}, { defaultValue: 'Copyright' }),
value: copyright,
})
return out
}
}
(Member comments are shortened to their first sentence, and the 5 longest are left out to fit; the full declaration is in node_modules/@molecule/app-exif-panel-angular/dist/exif-panel.component.d.ts.)
Functions
formatAperture(fNumber)
Format an aperture f-number as f/N with one decimal place dropped
when whole.
function formatAperture(fNumber: number | undefined): string | null
fNumber— The aperture value (e.g.2.8,5.6,8).
Returns: A display string like "f/2.8" or "f/8", or null when the input is missing / invalid.
formatShutter(seconds)
Format a shutter / exposure time in seconds as a human-readable
string. Sub-second times are rendered as a 1/x s reciprocal with
the denominator rounded; longer exposures stay in seconds.
function formatShutter(seconds: number | undefined): string | null
seconds— Exposure time in seconds.
Returns: A display string like "1/125 s" or "2 s", or null when the input is missing / invalid.
formatIso(iso)
Format an ISO sensitivity as ISO N.
function formatIso(iso: number | undefined): string | null
iso— The ISO value (e.g.100,1600).
Returns: A display string like "ISO 1600", or null when missing.
formatFocalLength(mm)
Format a focal length value as N mm.
function formatFocalLength(mm: number | undefined): string | null
mm— Focal length in millimetres.
Returns: A display string like "50 mm", or null when missing.
formatDms(value, axis)
Format a single GPS coordinate (latitude or longitude) as deg/min/sec with a hemisphere suffix.
function formatDms(value: number | undefined, axis: 'lat' | 'lon'): string | null
value— Signed decimal degrees.axis— Which axis the value represents — picksN/SvsE/W.
Returns: A string like "37° 25' 19.07" N", or null when missing.
formatGps(latitude, longitude)
Format a GPS coordinate pair as a single deg/min/sec string.
function formatGps(latitude: number | undefined, longitude: number | undefined): string | null
latitude— Latitude in signed decimal degrees.longitude— Longitude in signed decimal degrees.
Returns: A combined string like "37° 25' 19.07" N, 122° 5' 4.16" W", or null if either value is missing.
buildMapLink(latitude, longitude)
Build an OpenStreetMap link URL for a GPS coordinate pair.
function buildMapLink(latitude: number | undefined, longitude: number | undefined): string | null
latitude— Latitude in signed decimal degrees.longitude— Longitude in signed decimal degrees.
Returns: An https://www.openstreetmap.org/?... URL, or null when either input is missing.
formatTimestamp(value, locale)
Format an EXIF capture timestamp. Accepts Date, ISO string, or
epoch milliseconds and renders via toLocaleString so the result
respects the given locale and the host environment's timezone — pass
the app's active locale so the text follows a locale switch.
function formatTimestamp(value: Date | string | number | undefined, locale?: string): string | null
value— The timestamp value pulled from EXIF.locale— The locale to format in (anIntllocale code); the host environment's locale when omitted.
Returns: A locale-formatted date/time string, or null when missing or unparseable.
formatCamera(make, model)
Compose camera make + model into a single "Make Model" string,
collapsing duplication when the model already starts with the make
(Sony often does this).
function formatCamera(make: string | undefined, model: string | undefined): string | null
make— Camera manufacturer.model— Camera model.
Returns: The combined label, or null when both inputs are missing.
Injection Notes
Requirements
Peer dependencies:
@angular/common^22.0.0@angular/core^22.0.0@angular/platform-browser^22.0.0@molecule/app-angular^3.5.0 || ^4.0.0@molecule/app-i18n^1.0.1@molecule/app-ui^1.0.1@molecule/app-ui-angular^1.1.0
Runtime Dependencies
@angular/common@angular/core@angular/platform-browser@molecule/app-angular@molecule/app-i18n@molecule/app-ui@molecule/app-ui-angular
Requires a bonded ClassMap (getClassMap()) and the binding's i18n
provider (provideI18n or provideMolecule) for useTranslation(). All
user-facing text resolves through t() with React's keys and English
defaultValues.
Translations
Translation strings are provided by @molecule/app-locales-exif-panel.