@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.
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The package's components: one Svelte 5 component per React component in
3
+ * `@molecule/app-exif-panel-react`, under the same React name.
4
+ *
5
+ * @module
6
+ */
7
+ export { default as ExifPanel } from './ExifPanel.svelte';
8
+ //# sourceMappingURL=components.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../src/components.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,oBAAoB,CAAA"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The package's components: one Svelte 5 component per React component in
3
+ * `@molecule/app-exif-panel-react`, under the same React name.
4
+ *
5
+ * @module
6
+ */
7
+ export { default as ExifPanel } from './ExifPanel.svelte';
@@ -0,0 +1,47 @@
1
+ /**
2
+ * The number part of each EXIF notation, without its prefix or unit.
3
+ *
4
+ * `format.ts` joins these digits with the canonical English prefix / unit
5
+ * (`f/`, `s`, `ISO`, `mm`) for callers that want the plain notation. The
6
+ * components instead pass them to `t()` as the `{{value}}` of an
7
+ * `exifPanel.value.*` key, so a locale re-words the unit around the digits
8
+ * (Japanese `{{value}}秒`) while the digits stay this helper's.
9
+ *
10
+ * Internal to the panel — not part of the package's public exports.
11
+ *
12
+ * @module
13
+ */
14
+ /**
15
+ * The f-number of an aperture as digits, without the `f/`.
16
+ *
17
+ * @param fNumber - The aperture value (e.g. `2.8`, `5.6`, `8`).
18
+ * @returns A digit string like `"2.8"` or `"8"`, or `null` when the input
19
+ * is missing / invalid.
20
+ */
21
+ export declare function formatApertureNumber(fNumber: number | undefined): string | null;
22
+ /**
23
+ * A shutter / exposure time as digits, without the `s`. Sub-second times
24
+ * render as a `1/x` reciprocal with the denominator rounded; longer
25
+ * exposures stay in seconds.
26
+ *
27
+ * @param seconds - Exposure time in seconds.
28
+ * @returns A digit string like `"1/125"`, `"2.5"` or `"30"`, or `null`
29
+ * when the input is missing / invalid.
30
+ */
31
+ export declare function formatShutterNumber(seconds: number | undefined): string | null;
32
+ /**
33
+ * An ISO sensitivity as digits, without the `ISO` prefix.
34
+ *
35
+ * @param iso - The ISO value (e.g. `100`, `1600`).
36
+ * @returns A digit string like `"1600"`, or `null` when missing.
37
+ */
38
+ export declare function formatIsoNumber(iso: number | undefined): string | null;
39
+ /**
40
+ * A focal length as digits, without the `mm`.
41
+ *
42
+ * @param mm - Focal length in millimetres.
43
+ * @returns A digit string like `"50"` or `"35.5"`, or `null` when the
44
+ * input is missing / invalid.
45
+ */
46
+ export declare function formatFocalLengthNumber(mm: number | undefined): string | null;
47
+ //# sourceMappingURL=format-parts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-parts.d.ts","sourceRoot":"","sources":["../src/format-parts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA0BH;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAG/E;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAM9E;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAGtE;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAG7E"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * The number part of each EXIF notation, without its prefix or unit.
3
+ *
4
+ * `format.ts` joins these digits with the canonical English prefix / unit
5
+ * (`f/`, `s`, `ISO`, `mm`) for callers that want the plain notation. The
6
+ * components instead pass them to `t()` as the `{{value}}` of an
7
+ * `exifPanel.value.*` key, so a locale re-words the unit around the digits
8
+ * (Japanese `{{value}}秒`) while the digits stay this helper's.
9
+ *
10
+ * Internal to the panel — not part of the package's public exports.
11
+ *
12
+ * @module
13
+ */
14
+ /**
15
+ * The digits of a quantity rounded to one decimal, a whole number's
16
+ * trailing `.0` dropped.
17
+ *
18
+ * @param value - A validated, positive quantity.
19
+ * @returns Its digit text, e.g. `"2.8"`, `"50"`.
20
+ */
21
+ const digits = (value) => {
22
+ const rounded = Math.round(value * 10) / 10;
23
+ return Number.isInteger(rounded) ? String(rounded) : rounded.toFixed(1);
24
+ };
25
+ /**
26
+ * The guard every quantity shares: a finite number above zero.
27
+ *
28
+ * @param value - The raw EXIF quantity.
29
+ * @returns The number, or `null` when it is missing / invalid.
30
+ */
31
+ const positive = (value) => {
32
+ if (value === undefined || value === null)
33
+ return null;
34
+ if (!Number.isFinite(value) || value <= 0)
35
+ return null;
36
+ return value;
37
+ };
38
+ /**
39
+ * The f-number of an aperture as digits, without the `f/`.
40
+ *
41
+ * @param fNumber - The aperture value (e.g. `2.8`, `5.6`, `8`).
42
+ * @returns A digit string like `"2.8"` or `"8"`, or `null` when the input
43
+ * is missing / invalid.
44
+ */
45
+ export function formatApertureNumber(fNumber) {
46
+ const value = positive(fNumber);
47
+ return value === null ? null : digits(value);
48
+ }
49
+ /**
50
+ * A shutter / exposure time as digits, without the `s`. Sub-second times
51
+ * render as a `1/x` reciprocal with the denominator rounded; longer
52
+ * exposures stay in seconds.
53
+ *
54
+ * @param seconds - Exposure time in seconds.
55
+ * @returns A digit string like `"1/125"`, `"2.5"` or `"30"`, or `null`
56
+ * when the input is missing / invalid.
57
+ */
58
+ export function formatShutterNumber(seconds) {
59
+ const value = positive(seconds);
60
+ if (value === null)
61
+ return null;
62
+ if (value >= 1)
63
+ return digits(value);
64
+ // Round the reciprocal denominator to nearest integer for sub-second.
65
+ return `1/${Math.round(1 / value)}`;
66
+ }
67
+ /**
68
+ * An ISO sensitivity as digits, without the `ISO` prefix.
69
+ *
70
+ * @param iso - The ISO value (e.g. `100`, `1600`).
71
+ * @returns A digit string like `"1600"`, or `null` when missing.
72
+ */
73
+ export function formatIsoNumber(iso) {
74
+ const value = positive(iso);
75
+ return value === null ? null : String(Math.round(value));
76
+ }
77
+ /**
78
+ * A focal length as digits, without the `mm`.
79
+ *
80
+ * @param mm - Focal length in millimetres.
81
+ * @returns A digit string like `"50"` or `"35.5"`, or `null` when the
82
+ * input is missing / invalid.
83
+ */
84
+ export function formatFocalLengthNumber(mm) {
85
+ const value = positive(mm);
86
+ return value === null ? null : digits(value);
87
+ }
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Pure string-formatting helpers for EXIF values.
3
+ *
4
+ * Kept separate from the React component so they can be unit-tested
5
+ * without a DOM and reused by callers that want the formatted strings
6
+ * for non-rendering purposes (alt text, share captions, etc.).
7
+ *
8
+ * @module
9
+ */
10
+ /**
11
+ * Format an aperture f-number as `f/N` with one decimal place dropped
12
+ * when whole.
13
+ *
14
+ * @param fNumber - The aperture value (e.g. `2.8`, `5.6`, `8`).
15
+ * @returns A display string like `"f/2.8"` or `"f/8"`, or `null` when
16
+ * the input is missing / invalid.
17
+ */
18
+ export declare function formatAperture(fNumber: number | undefined): string | null;
19
+ /**
20
+ * Format a shutter / exposure time in seconds as a human-readable
21
+ * string. Sub-second times are rendered as a `1/x s` reciprocal with
22
+ * the denominator rounded; longer exposures stay in seconds.
23
+ *
24
+ * @param seconds - Exposure time in seconds.
25
+ * @returns A display string like `"1/125 s"` or `"2 s"`, or `null` when
26
+ * the input is missing / invalid.
27
+ */
28
+ export declare function formatShutter(seconds: number | undefined): string | null;
29
+ /**
30
+ * Format an ISO sensitivity as `ISO N`.
31
+ *
32
+ * @param iso - The ISO value (e.g. `100`, `1600`).
33
+ * @returns A display string like `"ISO 1600"`, or `null` when missing.
34
+ */
35
+ export declare function formatIso(iso: number | undefined): string | null;
36
+ /**
37
+ * Format a focal length value as `N mm`.
38
+ *
39
+ * @param mm - Focal length in millimetres.
40
+ * @returns A display string like `"50 mm"`, or `null` when missing.
41
+ */
42
+ export declare function formatFocalLength(mm: number | undefined): string | null;
43
+ /**
44
+ * Format a single GPS coordinate (latitude or longitude) as
45
+ * deg/min/sec with a hemisphere suffix.
46
+ *
47
+ * @param value - Signed decimal degrees.
48
+ * @param axis - Which axis the value represents — picks `N`/`S` vs `E`/`W`.
49
+ * @returns A string like `"37° 25' 19.07" N"`, or `null` when missing.
50
+ */
51
+ export declare function formatDms(value: number | undefined, axis: 'lat' | 'lon'): string | null;
52
+ /**
53
+ * Format a GPS coordinate pair as a single deg/min/sec string.
54
+ *
55
+ * @param latitude - Latitude in signed decimal degrees.
56
+ * @param longitude - Longitude in signed decimal degrees.
57
+ * @returns A combined string like `"37° 25' 19.07" N, 122° 5' 4.16" W"`,
58
+ * or `null` if either value is missing.
59
+ */
60
+ export declare function formatGps(latitude: number | undefined, longitude: number | undefined): string | null;
61
+ /**
62
+ * Build an OpenStreetMap link URL for a GPS coordinate pair.
63
+ *
64
+ * @param latitude - Latitude in signed decimal degrees.
65
+ * @param longitude - Longitude in signed decimal degrees.
66
+ * @returns An `https://www.openstreetmap.org/?...` URL, or `null` when
67
+ * either input is missing.
68
+ */
69
+ export declare function buildMapLink(latitude: number | undefined, longitude: number | undefined): string | null;
70
+ /**
71
+ * Format an EXIF capture timestamp. Accepts `Date`, ISO string, or
72
+ * epoch milliseconds and renders via `toLocaleString` so the result
73
+ * respects the given locale and the host environment's timezone — pass
74
+ * the app's active locale so the text follows a locale switch.
75
+ *
76
+ * @param value - The timestamp value pulled from EXIF.
77
+ * @param locale - The locale to format in (an `Intl` locale code); the
78
+ * host environment's locale when omitted.
79
+ * @returns A locale-formatted date/time string, or `null` when missing
80
+ * or unparseable.
81
+ */
82
+ export declare function formatTimestamp(value: Date | string | number | undefined, locale?: string): string | null;
83
+ /**
84
+ * Compose camera make + model into a single `"Make Model"` string,
85
+ * collapsing duplication when the model already starts with the make
86
+ * (Sony often does this).
87
+ *
88
+ * @param make - Camera manufacturer.
89
+ * @param model - Camera model.
90
+ * @returns The combined label, or `null` when both inputs are missing.
91
+ */
92
+ export declare function formatCamera(make: string | undefined, model: string | undefined): string | null;
93
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AASH;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAGzE;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAGxE;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAGhE;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAGvE;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,IAAI,CAavF;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CACvB,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,SAAS,EAAE,MAAM,GAAG,SAAS,GAC5B,MAAM,GAAG,IAAI,CAKf;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,SAAS,EAAE,MAAM,GAAG,SAAS,GAC5B,MAAM,GAAG,IAAI,CAMf;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,EACzC,MAAM,CAAC,EAAE,MAAM,GACd,MAAM,GAAG,IAAI,CAYf;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAS/F"}
package/dist/format.js ADDED
@@ -0,0 +1,163 @@
1
+ /**
2
+ * Pure string-formatting helpers for EXIF values.
3
+ *
4
+ * Kept separate from the React component so they can be unit-tested
5
+ * without a DOM and reused by callers that want the formatted strings
6
+ * for non-rendering purposes (alt text, share captions, etc.).
7
+ *
8
+ * @module
9
+ */
10
+ import { formatApertureNumber, formatFocalLengthNumber, formatIsoNumber, formatShutterNumber, } from './format-parts.js';
11
+ /**
12
+ * Format an aperture f-number as `f/N` with one decimal place dropped
13
+ * when whole.
14
+ *
15
+ * @param fNumber - The aperture value (e.g. `2.8`, `5.6`, `8`).
16
+ * @returns A display string like `"f/2.8"` or `"f/8"`, or `null` when
17
+ * the input is missing / invalid.
18
+ */
19
+ export function formatAperture(fNumber) {
20
+ const digits = formatApertureNumber(fNumber);
21
+ return digits === null ? null : `f/${digits}`;
22
+ }
23
+ /**
24
+ * Format a shutter / exposure time in seconds as a human-readable
25
+ * string. Sub-second times are rendered as a `1/x s` reciprocal with
26
+ * the denominator rounded; longer exposures stay in seconds.
27
+ *
28
+ * @param seconds - Exposure time in seconds.
29
+ * @returns A display string like `"1/125 s"` or `"2 s"`, or `null` when
30
+ * the input is missing / invalid.
31
+ */
32
+ export function formatShutter(seconds) {
33
+ const digits = formatShutterNumber(seconds);
34
+ return digits === null ? null : `${digits} s`;
35
+ }
36
+ /**
37
+ * Format an ISO sensitivity as `ISO N`.
38
+ *
39
+ * @param iso - The ISO value (e.g. `100`, `1600`).
40
+ * @returns A display string like `"ISO 1600"`, or `null` when missing.
41
+ */
42
+ export function formatIso(iso) {
43
+ const digits = formatIsoNumber(iso);
44
+ return digits === null ? null : `ISO ${digits}`;
45
+ }
46
+ /**
47
+ * Format a focal length value as `N mm`.
48
+ *
49
+ * @param mm - Focal length in millimetres.
50
+ * @returns A display string like `"50 mm"`, or `null` when missing.
51
+ */
52
+ export function formatFocalLength(mm) {
53
+ const digits = formatFocalLengthNumber(mm);
54
+ return digits === null ? null : `${digits} mm`;
55
+ }
56
+ /**
57
+ * Format a single GPS coordinate (latitude or longitude) as
58
+ * deg/min/sec with a hemisphere suffix.
59
+ *
60
+ * @param value - Signed decimal degrees.
61
+ * @param axis - Which axis the value represents — picks `N`/`S` vs `E`/`W`.
62
+ * @returns A string like `"37° 25' 19.07" N"`, or `null` when missing.
63
+ */
64
+ export function formatDms(value, axis) {
65
+ if (value === undefined || value === null)
66
+ return null;
67
+ if (!Number.isFinite(value))
68
+ return null;
69
+ const positiveLabel = axis === 'lat' ? 'N' : 'E';
70
+ const negativeLabel = axis === 'lat' ? 'S' : 'W';
71
+ const hemisphere = value >= 0 ? positiveLabel : negativeLabel;
72
+ const abs = Math.abs(value);
73
+ const deg = Math.floor(abs);
74
+ const minutesFloat = (abs - deg) * 60;
75
+ const min = Math.floor(minutesFloat);
76
+ const seconds = (minutesFloat - min) * 60;
77
+ const secText = (Math.round(seconds * 100) / 100).toFixed(2);
78
+ return `${deg}° ${min}' ${secText}" ${hemisphere}`;
79
+ }
80
+ /**
81
+ * Format a GPS coordinate pair as a single deg/min/sec string.
82
+ *
83
+ * @param latitude - Latitude in signed decimal degrees.
84
+ * @param longitude - Longitude in signed decimal degrees.
85
+ * @returns A combined string like `"37° 25' 19.07" N, 122° 5' 4.16" W"`,
86
+ * or `null` if either value is missing.
87
+ */
88
+ export function formatGps(latitude, longitude) {
89
+ const lat = formatDms(latitude, 'lat');
90
+ const lon = formatDms(longitude, 'lon');
91
+ if (!lat || !lon)
92
+ return null;
93
+ return `${lat}, ${lon}`;
94
+ }
95
+ /**
96
+ * Build an OpenStreetMap link URL for a GPS coordinate pair.
97
+ *
98
+ * @param latitude - Latitude in signed decimal degrees.
99
+ * @param longitude - Longitude in signed decimal degrees.
100
+ * @returns An `https://www.openstreetmap.org/?...` URL, or `null` when
101
+ * either input is missing.
102
+ */
103
+ export function buildMapLink(latitude, longitude) {
104
+ if (latitude === undefined || longitude === undefined)
105
+ return null;
106
+ if (!Number.isFinite(latitude) || !Number.isFinite(longitude))
107
+ return null;
108
+ const lat = latitude.toFixed(6);
109
+ const lon = longitude.toFixed(6);
110
+ return `https://www.openstreetmap.org/?mlat=${lat}&mlon=${lon}#map=15/${lat}/${lon}`;
111
+ }
112
+ /**
113
+ * Format an EXIF capture timestamp. Accepts `Date`, ISO string, or
114
+ * epoch milliseconds and renders via `toLocaleString` so the result
115
+ * respects the given locale and the host environment's timezone — pass
116
+ * the app's active locale so the text follows a locale switch.
117
+ *
118
+ * @param value - The timestamp value pulled from EXIF.
119
+ * @param locale - The locale to format in (an `Intl` locale code); the
120
+ * host environment's locale when omitted.
121
+ * @returns A locale-formatted date/time string, or `null` when missing
122
+ * or unparseable.
123
+ */
124
+ export function formatTimestamp(value, locale) {
125
+ if (value === undefined || value === null)
126
+ return null;
127
+ let date;
128
+ if (value instanceof Date) {
129
+ date = value;
130
+ }
131
+ else if (typeof value === 'number') {
132
+ date = new Date(value);
133
+ }
134
+ else {
135
+ date = new Date(value);
136
+ }
137
+ if (Number.isNaN(date.getTime()))
138
+ return null;
139
+ return date.toLocaleString(locale);
140
+ }
141
+ /**
142
+ * Compose camera make + model into a single `"Make Model"` string,
143
+ * collapsing duplication when the model already starts with the make
144
+ * (Sony often does this).
145
+ *
146
+ * @param make - Camera manufacturer.
147
+ * @param model - Camera model.
148
+ * @returns The combined label, or `null` when both inputs are missing.
149
+ */
150
+ export function formatCamera(make, model) {
151
+ const m = make?.trim();
152
+ const md = model?.trim();
153
+ if (!m && !md)
154
+ return null;
155
+ if (!md)
156
+ return m ?? null;
157
+ if (!m)
158
+ return md;
159
+ // Avoid "Sony Sony a7 III" when model already starts with make.
160
+ if (md.toLowerCase().startsWith(m.toLowerCase()))
161
+ return md;
162
+ return `${m} ${md}`;
163
+ }
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Svelte EXIF metadata panel for photo-sharing apps.
3
+ *
4
+ * Exports `ExifPanel` — a structured renderer for already-parsed EXIF data
5
+ * (camera, lens, aperture, shutter, ISO, focal length, GPS, timestamp,
6
+ * software, copyright). The caller is responsible for decoding the raw EXIF
7
+ * payload (e.g. via the `exifr` library); this package is a
8
+ * styling-agnostic, i18n-aware renderer only.
9
+ *
10
+ * Also exports the `ExifData` and `ExifPanelProps` types and the pure
11
+ * formatting helpers (`formatAperture`, `formatShutter`, `formatIso`,
12
+ * `formatFocalLength`, `formatGps`, `formatTimestamp`, `formatCamera`,
13
+ * `buildMapLink`, `formatDms`).
14
+ *
15
+ * It is the Svelte counterpart of `@molecule/app-exif-panel-react`: the same
16
+ * props (React names) and the same DOM for the same input.
17
+ *
18
+ * @example
19
+ * ```svelte
20
+ * <script lang="ts">
21
+ * import { ExifPanel } from '@molecule/app-exif-panel-svelte'
22
+ *
23
+ * let { exif } = $props()
24
+ * </script>
25
+ *
26
+ * <ExifPanel {exif} showGps compact={false} />
27
+ * ```
28
+ *
29
+ * @remarks
30
+ * Requires a bonded ClassMap (`getClassMap()`) and the binding's i18n
31
+ * context (`setMoleculeContext({ i18n })`) for `useTranslation()`. All
32
+ * user-facing text resolves through `t()` with React's keys and English
33
+ * `defaultValue`s.
34
+ *
35
+ * @module
36
+ */
37
+ export * from './components.js';
38
+ export * from './format.js';
39
+ export * from './types.js';
40
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Svelte EXIF metadata panel for photo-sharing apps.
3
+ *
4
+ * Exports `ExifPanel` — a structured renderer for already-parsed EXIF data
5
+ * (camera, lens, aperture, shutter, ISO, focal length, GPS, timestamp,
6
+ * software, copyright). The caller is responsible for decoding the raw EXIF
7
+ * payload (e.g. via the `exifr` library); this package is a
8
+ * styling-agnostic, i18n-aware renderer only.
9
+ *
10
+ * Also exports the `ExifData` and `ExifPanelProps` types and the pure
11
+ * formatting helpers (`formatAperture`, `formatShutter`, `formatIso`,
12
+ * `formatFocalLength`, `formatGps`, `formatTimestamp`, `formatCamera`,
13
+ * `buildMapLink`, `formatDms`).
14
+ *
15
+ * It is the Svelte counterpart of `@molecule/app-exif-panel-react`: the same
16
+ * props (React names) and the same DOM for the same input.
17
+ *
18
+ * @example
19
+ * ```svelte
20
+ * <script lang="ts">
21
+ * import { ExifPanel } from '@molecule/app-exif-panel-svelte'
22
+ *
23
+ * let { exif } = $props()
24
+ * </script>
25
+ *
26
+ * <ExifPanel {exif} showGps compact={false} />
27
+ * ```
28
+ *
29
+ * @remarks
30
+ * Requires a bonded ClassMap (`getClassMap()`) and the binding's i18n
31
+ * context (`setMoleculeContext({ i18n })`) for `useTranslation()`. All
32
+ * user-facing text resolves through `t()` with React's keys and English
33
+ * `defaultValue`s.
34
+ *
35
+ * @module
36
+ */
37
+ export * from './components.js';
38
+ export * from './format.js';
39
+ export * from './types.js';
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Type definitions for the EXIF panel renderer.
3
+ *
4
+ * The caller is responsible for parsing the EXIF metadata (e.g. via the
5
+ * `exifr` library) — this package only renders an already-parsed object
6
+ * with normalized field names.
7
+ *
8
+ * @module
9
+ */
10
+ /**
11
+ * Parsed EXIF metadata. Every field is optional — extra fields are
12
+ * permitted (the renderer ignores them) so callers can pass through the
13
+ * full output of their EXIF parser without filtering.
14
+ */
15
+ export interface ExifData {
16
+ /** Camera manufacturer (e.g. `"Canon"`, `"Sony"`, `"Apple"`). */
17
+ make?: string;
18
+ /** Camera model (e.g. `"EOS R5"`, `"a7 III"`, `"iPhone 15 Pro"`). */
19
+ model?: string;
20
+ /** Lens model description (e.g. `"RF 24-70mm F2.8 L IS USM"`). */
21
+ lensModel?: string;
22
+ /** Aperture as an f-number (the `N` in `f/N`). */
23
+ fNumber?: number;
24
+ /** Exposure / shutter time in seconds (e.g. `0.008` ≈ `1/125 s`). */
25
+ exposureTime?: number;
26
+ /** ISO sensitivity (e.g. `100`, `1600`). */
27
+ iso?: number;
28
+ /** Focal length in millimetres. */
29
+ focalLength?: number;
30
+ /** 35 mm-equivalent focal length, when supplied by the camera. */
31
+ focalLength35mm?: number;
32
+ /** Capture timestamp — `Date`, ISO 8601 string, or epoch millis. */
33
+ dateTimeOriginal?: Date | string | number;
34
+ /** GPS latitude in signed decimal degrees. */
35
+ gpsLatitude?: number;
36
+ /** GPS longitude in signed decimal degrees. */
37
+ gpsLongitude?: number;
38
+ /** EXIF orientation tag (1–8). */
39
+ orientation?: number;
40
+ /** Software / firmware that produced the file. */
41
+ software?: string;
42
+ /** Copyright statement embedded in the file. */
43
+ copyright?: string;
44
+ /** Pass-through for parser-specific extras the renderer ignores. */
45
+ [key: string]: unknown;
46
+ }
47
+ /**
48
+ * Props for the `<ExifPanel>` component.
49
+ */
50
+ export interface ExifPanelProps {
51
+ /** Parsed EXIF metadata. */
52
+ exif: ExifData;
53
+ /**
54
+ * Compact mode collapses the panel into a single condensed grid with
55
+ * smaller type and tighter spacing. Defaults to `false`.
56
+ */
57
+ compact?: boolean;
58
+ /**
59
+ * Whether to render the GPS coordinates row when latitude / longitude
60
+ * are present. Defaults to `true`.
61
+ */
62
+ showGps?: boolean;
63
+ /** Optional heading override. */
64
+ heading?: string;
65
+ /** Extra classes appended to the panel root. */
66
+ className?: string;
67
+ }
68
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACvB,iEAAiE;IACjE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,kEAAkE;IAClE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,kDAAkD;IAClD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,qEAAqE;IACrE,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,4CAA4C;IAC5C,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,mCAAmC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,kEAAkE;IAClE,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,oEAAoE;IACpE,gBAAgB,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAA;IACzC,8CAA8C;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,+CAA+C;IAC/C,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,kCAAkC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,kDAAkD;IAClD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,oEAAoE;IACpE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,4BAA4B;IAC5B,IAAI,EAAE,QAAQ,CAAA;IACd;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
package/dist/types.js ADDED
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Type definitions for the EXIF panel renderer.
3
+ *
4
+ * The caller is responsible for parsing the EXIF metadata (e.g. via the
5
+ * `exifr` library) — this package only renders an already-parsed object
6
+ * with normalized field names.
7
+ *
8
+ * @module
9
+ */
10
+ export {};
package/package.json CHANGED
@@ -1,6 +1,76 @@
1
1
  {
2
2
  "name": "@molecule/app-exif-panel-svelte",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.1.0",
4
+ "description": "EXIF metadata renderer for photo-sharing apps — camera, lens, aperture, shutter, ISO, focal length, GPS, timestamp",
5
+ "homepage": "https://www.molecule.dev/packages/app-exif-panel-svelte",
6
+ "type": "module",
7
+ "main": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "svelte": "./dist/index.js",
13
+ "default": "./dist/index.js"
14
+ },
15
+ "./package.json": "./package.json"
16
+ },
17
+ "svelte": "./dist/index.js",
18
+ "files": [
19
+ "dist",
20
+ "!dist/**/__tests__",
21
+ "!dist/**/*.test.*",
22
+ "!dist/**/*.spec.*",
23
+ "README.md"
24
+ ],
25
+ "scripts": {
26
+ "build": "svelte-check --tsconfig ./tsconfig.json --fail-on-warnings && svelte-package --input src --output dist --tsconfig ./tsconfig.json",
27
+ "dev": "svelte-package --input src --output dist --tsconfig ./tsconfig.json --watch",
28
+ "test": "vitest run",
29
+ "test:watch": "vitest"
30
+ },
31
+ "keywords": [
32
+ "molecule",
33
+ "exif",
34
+ "photo",
35
+ "metadata",
36
+ "svelte"
37
+ ],
38
+ "author": "Molecule Dev, Inc. (https://molecule.dev)",
39
+ "license": "Apache-2.0",
40
+ "repository": {
41
+ "type": "git",
42
+ "url": "https://github.com/molecule-dev/molecule.git",
43
+ "directory": "packages/app/features/exif-panel-svelte"
44
+ },
45
+ "engines": {
46
+ "node": ">=20"
47
+ },
48
+ "bugs": "https://github.com/molecule-dev/molecule/issues",
49
+ "publishConfig": {
50
+ "access": "public"
51
+ },
52
+ "peerDependencies": {
53
+ "@molecule/app-i18n": "^1.0.1",
54
+ "@molecule/app-svelte": "^3.5.0",
55
+ "@molecule/app-ui": "^1.0.1",
56
+ "@molecule/app-ui-svelte": "^1.1.0",
57
+ "svelte": "^5.0.0"
58
+ },
59
+ "devDependencies": {
60
+ "@molecule/app-framework-conformance": "0.0.0",
61
+ "@molecule/app-i18n": "1.2.2",
62
+ "@molecule/app-icons": "1.0.4",
63
+ "@molecule/app-svelte": "3.7.1",
64
+ "@molecule/app-ui": "1.4.0",
65
+ "@molecule/app-ui-svelte": "1.1.5",
66
+ "@sveltejs/package": "3.0.2",
67
+ "@sveltejs/vite-plugin-svelte": "7.1.2",
68
+ "@types/node": "26.6.5",
69
+ "jsdom": "30.1.3",
70
+ "svelte": "5.57.2",
71
+ "svelte-check": "4.7.7",
72
+ "typescript": "6.0.3",
73
+ "vite": "8.3.5",
74
+ "vitest": "4.1.12"
75
+ }
76
+ }