@molecule/app-exif-panel-svelte 0.0.0-stage → 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/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,282 @@
1
- # Temporary Holding Version
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:46.156Z
7
+ -->
2
8
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
9
+ # @molecule/app-exif-panel-svelte
10
+
11
+ Svelte EXIF metadata panel for photo-sharing apps.
12
+
13
+ Exports `ExifPanel` — a structured renderer for already-parsed EXIF data
14
+ (camera, lens, aperture, shutter, ISO, focal length, GPS, timestamp,
15
+ software, copyright). The caller is responsible for decoding the raw EXIF
16
+ payload (e.g. via the `exifr` library); this package is a
17
+ styling-agnostic, i18n-aware renderer only.
18
+
19
+ Also exports the `ExifData` and `ExifPanelProps` types and the pure
20
+ formatting helpers (`formatAperture`, `formatShutter`, `formatIso`,
21
+ `formatFocalLength`, `formatGps`, `formatTimestamp`, `formatCamera`,
22
+ `buildMapLink`, `formatDms`).
23
+
24
+ It is the Svelte counterpart of `@molecule/app-exif-panel-react`: the same
25
+ props (React names) and the same DOM for the same input.
26
+
27
+ > **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
28
+ > It is written to be read by coding agents as much as by people, and is generated from this
29
+ > package's source — edit `src/index.ts` JSDoc, not this file.
30
+
31
+ ## Quick Start
32
+
33
+ ```svelte
34
+ <script lang="ts">
35
+ import { ExifPanel } from '@molecule/app-exif-panel-svelte'
36
+
37
+ let { exif } = $props()
38
+ </script>
39
+
40
+ <ExifPanel {exif} showGps compact={false} />
41
+ ```
42
+
43
+ ## Type
44
+
45
+ `feature`
46
+
47
+ ## Installation
48
+
49
+ ```bash
50
+ npm install @molecule/app-exif-panel-svelte @molecule/app-i18n @molecule/app-svelte @molecule/app-ui @molecule/app-ui-svelte svelte
51
+ ```
52
+
53
+ ## API
54
+
55
+ ### Interfaces
56
+
57
+ #### `ExifData`
58
+
59
+ Parsed EXIF metadata. Every field is optional — extra fields are
60
+ permitted (the renderer ignores them) so callers can pass through the
61
+ full output of their EXIF parser without filtering.
62
+
63
+ ```typescript
64
+ interface ExifData {
65
+ /** Camera manufacturer (e.g. `"Canon"`, `"Sony"`, `"Apple"`). */
66
+ make?: string
67
+ /** Camera model (e.g. `"EOS R5"`, `"a7 III"`, `"iPhone 15 Pro"`). */
68
+ model?: string
69
+ /** Lens model description (e.g. `"RF 24-70mm F2.8 L IS USM"`). */
70
+ lensModel?: string
71
+ /** Aperture as an f-number (the `N` in `f/N`). */
72
+ fNumber?: number
73
+ /** Exposure / shutter time in seconds (e.g. `0.008` ≈ `1/125 s`). */
74
+ exposureTime?: number
75
+ /** ISO sensitivity (e.g. `100`, `1600`). */
76
+ iso?: number
77
+ /** Focal length in millimetres. */
78
+ focalLength?: number
79
+ /** 35 mm-equivalent focal length, when supplied by the camera. */
80
+ focalLength35mm?: number
81
+ /** Capture timestamp — `Date`, ISO 8601 string, or epoch millis. */
82
+ dateTimeOriginal?: Date | string | number
83
+ /** GPS latitude in signed decimal degrees. */
84
+ gpsLatitude?: number
85
+ /** GPS longitude in signed decimal degrees. */
86
+ gpsLongitude?: number
87
+ /** EXIF orientation tag (1–8). */
88
+ orientation?: number
89
+ /** Software / firmware that produced the file. */
90
+ software?: string
91
+ /** Copyright statement embedded in the file. */
92
+ copyright?: string
93
+ /** Pass-through for parser-specific extras the renderer ignores. */
94
+ [key: string]: unknown
95
+ }
96
+ ```
97
+
98
+ #### `ExifPanelProps`
99
+
100
+ Props for the `<ExifPanel>` component.
101
+
102
+ ```typescript
103
+ interface ExifPanelProps {
104
+ /** Parsed EXIF metadata. */
105
+ exif: ExifData
106
+ /**
107
+ * Compact mode collapses the panel into a single condensed grid with
108
+ * smaller type and tighter spacing. Defaults to `false`.
109
+ */
110
+ compact?: boolean
111
+ /**
112
+ * Whether to render the GPS coordinates row when latitude / longitude
113
+ * are present. Defaults to `true`.
114
+ */
115
+ showGps?: boolean
116
+ /** Optional heading override. */
117
+ heading?: string
118
+ /** Extra classes appended to the panel root. */
119
+ className?: string
120
+ }
121
+ ```
122
+
123
+ ### Functions
124
+
125
+ #### `formatAperture(fNumber)`
126
+
127
+ Format an aperture f-number as `f/N` with one decimal place dropped
128
+ when whole.
129
+
130
+ ```typescript
131
+ function formatAperture(fNumber: number | undefined): string | null
132
+ ```
133
+
134
+ - `fNumber` — The aperture value (e.g. `2.8`, `5.6`, `8`).
135
+
136
+ **Returns:** A display string like `"f/2.8"` or `"f/8"`, or `null` when the input is missing / invalid.
137
+
138
+ #### `formatShutter(seconds)`
139
+
140
+ Format a shutter / exposure time in seconds as a human-readable
141
+ string. Sub-second times are rendered as a `1/x s` reciprocal with
142
+ the denominator rounded; longer exposures stay in seconds.
143
+
144
+ ```typescript
145
+ function formatShutter(seconds: number | undefined): string | null
146
+ ```
147
+
148
+ - `seconds` — Exposure time in seconds.
149
+
150
+ **Returns:** A display string like `"1/125 s"` or `"2 s"`, or `null` when the input is missing / invalid.
151
+
152
+ #### `formatIso(iso)`
153
+
154
+ Format an ISO sensitivity as `ISO N`.
155
+
156
+ ```typescript
157
+ function formatIso(iso: number | undefined): string | null
158
+ ```
159
+
160
+ - `iso` — The ISO value (e.g. `100`, `1600`).
161
+
162
+ **Returns:** A display string like `"ISO 1600"`, or `null` when missing.
163
+
164
+ #### `formatFocalLength(mm)`
165
+
166
+ Format a focal length value as `N mm`.
167
+
168
+ ```typescript
169
+ function formatFocalLength(mm: number | undefined): string | null
170
+ ```
171
+
172
+ - `mm` — Focal length in millimetres.
173
+
174
+ **Returns:** A display string like `"50 mm"`, or `null` when missing.
175
+
176
+ #### `formatDms(value, axis)`
177
+
178
+ Format a single GPS coordinate (latitude or longitude) as
179
+ deg/min/sec with a hemisphere suffix.
180
+
181
+ ```typescript
182
+ function formatDms(value: number | undefined, axis: 'lat' | 'lon'): string | null
183
+ ```
184
+
185
+ - `value` — Signed decimal degrees.
186
+ - `axis` — Which axis the value represents — picks `N`/`S` vs `E`/`W`.
187
+
188
+ **Returns:** A string like `"37° 25' 19.07" N"`, or `null` when missing.
189
+
190
+ #### `formatGps(latitude, longitude)`
191
+
192
+ Format a GPS coordinate pair as a single deg/min/sec string.
193
+
194
+ ```typescript
195
+ function formatGps(latitude: number | undefined, longitude: number | undefined): string | null
196
+ ```
197
+
198
+ - `latitude` — Latitude in signed decimal degrees.
199
+ - `longitude` — Longitude in signed decimal degrees.
200
+
201
+ **Returns:** A combined string like `"37° 25' 19.07" N, 122° 5' 4.16" W"`, or `null` if either value is missing.
202
+
203
+ #### `buildMapLink(latitude, longitude)`
204
+
205
+ Build an OpenStreetMap link URL for a GPS coordinate pair.
206
+
207
+ ```typescript
208
+ function buildMapLink(latitude: number | undefined, longitude: number | undefined): string | null
209
+ ```
210
+
211
+ - `latitude` — Latitude in signed decimal degrees.
212
+ - `longitude` — Longitude in signed decimal degrees.
213
+
214
+ **Returns:** An `https://www.openstreetmap.org/?...` URL, or `null` when either input is missing.
215
+
216
+ #### `formatTimestamp(value, locale)`
217
+
218
+ Format an EXIF capture timestamp. Accepts `Date`, ISO string, or
219
+ epoch milliseconds and renders via `toLocaleString` so the result
220
+ respects the given locale and the host environment's timezone — pass
221
+ the app's active locale so the text follows a locale switch.
222
+
223
+ ```typescript
224
+ function formatTimestamp(value: Date | string | number | undefined, locale?: string): string | null
225
+ ```
226
+
227
+ - `value` — The timestamp value pulled from EXIF.
228
+ - `locale` — The locale to format in (an `Intl` locale code); the host environment's locale when omitted.
229
+
230
+ **Returns:** A locale-formatted date/time string, or `null` when missing or unparseable.
231
+
232
+ #### `formatCamera(make, model)`
233
+
234
+ Compose camera make + model into a single `"Make Model"` string,
235
+ collapsing duplication when the model already starts with the make
236
+ (Sony often does this).
237
+
238
+ ```typescript
239
+ function formatCamera(make: string | undefined, model: string | undefined): string | null
240
+ ```
241
+
242
+ - `make` — Camera manufacturer.
243
+ - `model` — Camera model.
244
+
245
+ **Returns:** The combined label, or `null` when both inputs are missing.
246
+
247
+ ### Constants
248
+
249
+ #### `ExifPanel`
250
+
251
+ ```typescript
252
+ const ExifPanel: LegacyComponentType
253
+ ```
254
+
255
+ ## Injection Notes
256
+
257
+ ### Requirements
258
+
259
+ Peer dependencies:
260
+
261
+ - `@molecule/app-i18n` ^1.0.1
262
+ - `@molecule/app-svelte` ^3.5.0
263
+ - `@molecule/app-ui` ^1.0.1
264
+ - `@molecule/app-ui-svelte` ^1.1.0
265
+ - `svelte` ^5.0.0
266
+
267
+ ### Runtime Dependencies
268
+
269
+ - `@molecule/app-i18n`
270
+ - `@molecule/app-svelte`
271
+ - `@molecule/app-ui`
272
+ - `@molecule/app-ui-svelte`
273
+ - `svelte`
274
+
275
+ Requires a bonded ClassMap (`getClassMap()`) and the binding's i18n
276
+ context (`setMoleculeContext({ i18n })`) for `useTranslation()`. All
277
+ user-facing text resolves through `t()` with React's keys and English
278
+ `defaultValue`s.
279
+
280
+ ## Translations
281
+
282
+ Translation strings are provided by `@molecule/app-locales-exif-panel`.
@@ -0,0 +1,193 @@
1
+ <!--
2
+ ExifPanel: the Svelte counterpart of `@molecule/app-exif-panel-react`'s
3
+ `ExifPanel` — a structured renderer for already-parsed EXIF metadata. Same
4
+ props (React names), same ClassMap tokens, same DOM for the same input.
5
+ -->
6
+ <script lang="ts">
7
+ import { useLocale, useTranslation } from '@molecule/app-svelte'
8
+ import { getClassMap } from '@molecule/app-ui'
9
+
10
+ import { buildMapLink, formatCamera, formatGps, formatTimestamp } from './format.js'
11
+ import {
12
+ formatApertureNumber,
13
+ formatFocalLengthNumber,
14
+ formatIsoNumber,
15
+ formatShutterNumber,
16
+ } from './format-parts.js'
17
+ import type { ExifPanelProps } from './types.js'
18
+
19
+ /** One label/value row the panel renders, after the empty ones are dropped. */
20
+ interface Row {
21
+ /** Stable `data-mol-id` token for the row. */
22
+ molId: string
23
+ /** Translated label text. */
24
+ label: string
25
+ /** Already-formatted value text. */
26
+ value: string
27
+ /** Map link the value renders as, for the GPS row. */
28
+ href?: string
29
+ }
30
+
31
+ let { exif, compact = false, showGps = true, heading, className }: ExifPanelProps = $props()
32
+
33
+ const cm = getClassMap()
34
+ const { t } = useTranslation()
35
+ // Re-renders on a locale switch, so the timestamp re-formats at once.
36
+ const activeLocale = useLocale()
37
+
38
+ const labelSize = $derived(compact ? 'xs' : 'sm')
39
+ const valueSize = $derived(compact ? 'sm' : 'base')
40
+ const rowGap = $derived(compact ? 'sm' : 'md')
41
+ const padScale = $derived(compact ? 3 : 4)
42
+
43
+ const rowClasses = $derived(
44
+ cm.cn(
45
+ cm.flex({ align: 'start', justify: 'between', gap: rowGap }),
46
+ cm.sp('px', padScale),
47
+ cm.sp('py', compact ? 2 : 3),
48
+ cm.borderB,
49
+ ),
50
+ )
51
+ const labelClasses = $derived(
52
+ cm.cn(cm.textSize(labelSize), cm.fontWeight('medium'), cm.textMuted),
53
+ )
54
+ const valueClasses = $derived(cm.cn(cm.textSize(valueSize), cm.textRight))
55
+
56
+ const eyebrowText = $derived(t('exifPanel.eyebrow', {}, { defaultValue: 'Frame metadata' }))
57
+ const headingText = $derived(heading ?? t('exifPanel.heading', {}, { defaultValue: 'EXIF' }))
58
+ const ariaLabel = $derived(t('exifPanel.aria.region', {}, { defaultValue: 'EXIF metadata' }))
59
+
60
+ const rows = $derived.by((): Row[] => {
61
+ const camera = formatCamera(exif.make, exif.model)
62
+ const lens = exif.lensModel?.trim() || null
63
+ const apertureDigits = formatApertureNumber(exif.fNumber)
64
+ const shutterDigits = formatShutterNumber(exif.exposureTime)
65
+ const isoDigits = formatIsoNumber(exif.iso)
66
+ const focalDigits = formatFocalLengthNumber(exif.focalLength)
67
+ const focal35Digits = formatFocalLengthNumber(exif.focalLength35mm)
68
+ // Each notation's digits render through t() (`exifPanel.value.*`), so a
69
+ // locale re-words the unit around them; the ` · ` join is punctuation.
70
+ const apertureText =
71
+ apertureDigits === null
72
+ ? null
73
+ : t('exifPanel.value.aperture', { value: apertureDigits }, { defaultValue: 'f/{{value}}' })
74
+ const shutterText =
75
+ shutterDigits === null
76
+ ? null
77
+ : t('exifPanel.value.shutter', { value: shutterDigits }, { defaultValue: '{{value}} s' })
78
+ const isoText =
79
+ isoDigits === null
80
+ ? null
81
+ : t('exifPanel.value.iso', { value: isoDigits }, { defaultValue: 'ISO {{value}}' })
82
+ const focalText =
83
+ focalDigits === null
84
+ ? null
85
+ : t('exifPanel.value.focalLength', { value: focalDigits }, { defaultValue: '{{value}} mm' })
86
+ const focal35Text =
87
+ focal35Digits === null
88
+ ? null
89
+ : t(
90
+ 'exifPanel.value.focalLength',
91
+ { value: focal35Digits },
92
+ {
93
+ defaultValue: '{{value}} mm',
94
+ },
95
+ )
96
+ const exposureParts = [apertureText, shutterText, isoText, focalText].filter(
97
+ (v): v is string => v !== null,
98
+ )
99
+ const gpsText = showGps ? formatGps(exif.gpsLatitude, exif.gpsLongitude) : null
100
+ const mapHref = showGps ? buildMapLink(exif.gpsLatitude, exif.gpsLongitude) : null
101
+ const timestamp = formatTimestamp(exif.dateTimeOriginal, $activeLocale)
102
+ const software = exif.software?.trim() || null
103
+ const copyright = exif.copyright?.trim() || null
104
+
105
+ const out: Row[] = []
106
+ if (camera)
107
+ out.push({
108
+ molId: 'exif-panel-row-camera',
109
+ label: t('exifPanel.camera', {}, { defaultValue: 'Camera' }),
110
+ value: camera,
111
+ })
112
+ if (lens)
113
+ out.push({
114
+ molId: 'exif-panel-row-lens',
115
+ label: t('exifPanel.lens', {}, { defaultValue: 'Lens' }),
116
+ value: lens,
117
+ })
118
+ if (exposureParts.length > 0)
119
+ out.push({
120
+ molId: 'exif-panel-row-exposure',
121
+ label: t('exifPanel.exposure', {}, { defaultValue: 'Exposure' }),
122
+ value: exposureParts.join(' · '),
123
+ })
124
+ if (focal35Text && focal35Text !== focalText)
125
+ out.push({
126
+ molId: 'exif-panel-row-focal35',
127
+ label: t('exifPanel.focalLength35mm', {}, { defaultValue: '35 mm equivalent' }),
128
+ value: focal35Text,
129
+ })
130
+ if (gpsText)
131
+ out.push({
132
+ molId: 'exif-panel-row-gps',
133
+ label: t('exifPanel.gps', {}, { defaultValue: 'GPS' }),
134
+ value: gpsText,
135
+ ...(mapHref ? { href: mapHref } : {}),
136
+ })
137
+ if (timestamp)
138
+ out.push({
139
+ molId: 'exif-panel-row-timestamp',
140
+ label: t('exifPanel.timestamp', {}, { defaultValue: 'Captured' }),
141
+ value: timestamp,
142
+ })
143
+ if (software)
144
+ out.push({
145
+ molId: 'exif-panel-row-software',
146
+ label: t('exifPanel.software', {}, { defaultValue: 'Software' }),
147
+ value: software,
148
+ })
149
+ if (copyright)
150
+ out.push({
151
+ molId: 'exif-panel-row-copyright',
152
+ label: t('exifPanel.copyright', {}, { defaultValue: 'Copyright' }),
153
+ value: copyright,
154
+ })
155
+ return out
156
+ })
157
+ </script>
158
+
159
+ <aside data-mol-id="exif-panel" aria-label={ariaLabel} class={cm.cn(cm.surface, className)}>
160
+ <header
161
+ data-mol-id="exif-panel-header"
162
+ class={cm.cn(cm.sp('px', padScale), cm.sp('py', padScale), cm.borderB)}
163
+ >
164
+ <p
165
+ data-mol-id="exif-panel-eyebrow"
166
+ class={cm.cn(cm.textSize('xs'), cm.fontWeight('medium'), cm.textMuted)}
167
+ >
168
+ {eyebrowText}
169
+ </p>
170
+ <h3
171
+ data-mol-id="exif-panel-heading"
172
+ class={cm.cn(cm.textSize(compact ? 'sm' : 'base'), cm.fontWeight('bold'))}
173
+ >
174
+ {headingText}
175
+ </h3>
176
+ </header>
177
+ <dl data-mol-id="exif-panel-list">
178
+ {#each rows as row (row.molId)}
179
+ <div data-mol-id={row.molId} class={rowClasses}>
180
+ <dt class={labelClasses}>{row.label}</dt>
181
+ <dd class={valueClasses}>
182
+ {#if row.href}<a
183
+ href={row.href}
184
+ target="_blank"
185
+ rel="noreferrer noopener"
186
+ data-mol-id="exif-panel-map-link"
187
+ class={cm.link}>{row.value}</a
188
+ >{:else}{row.value}{/if}
189
+ </dd>
190
+ </div>
191
+ {/each}
192
+ </dl>
193
+ </aside>
@@ -0,0 +1,5 @@
1
+ import type { ExifPanelProps } from './types.js';
2
+ declare const ExifPanel: import("svelte").Component<ExifPanelProps, {}, "">;
3
+ type ExifPanel = ReturnType<typeof ExifPanel>;
4
+ export default ExifPanel;
5
+ //# sourceMappingURL=ExifPanel.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExifPanel.svelte.d.ts","sourceRoot":"","sources":["../src/ExifPanel.svelte"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AA8KjD,QAAA,MAAM,SAAS,oDAAwC,CAAC;AACxD,KAAK,SAAS,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC;AAC9C,eAAe,SAAS,CAAC"}