@penn-libraries/web 1.1.0 → 1.1.1-dev.2

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.
Files changed (64) hide show
  1. package/dist/cjs/{index-4ixBJUwu.js → index-DVr0pLZy.js} +62 -3
  2. package/dist/cjs/index-DVr0pLZy.js.map +1 -0
  3. package/dist/cjs/index.cjs.js +1 -1
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/cjs/pennlibs-autocomplete.pennlibs-fallback-img.pennlibs-footer.pennlibs-header.pennlibs-iiif-img.entry.cjs.js.map +1 -0
  6. package/dist/cjs/{pennlibs-autocomplete_3.cjs.entry.js → pennlibs-autocomplete_5.cjs.entry.js} +261 -2
  7. package/dist/cjs/pennlibs-banner.cjs.entry.js +1 -1
  8. package/dist/cjs/pennlibs-chat.cjs.entry.js +1 -1
  9. package/dist/cjs/pennlibs-feedback.cjs.entry.js +1 -1
  10. package/dist/cjs/pennlibs-hero.cjs.entry.js +1 -1
  11. package/dist/cjs/web.cjs.js +2 -2
  12. package/dist/collection/collection-manifest.json +2 -1
  13. package/dist/collection/components/pennlibs-iiif-img/pennlibs-iiif-img.css +44 -0
  14. package/dist/collection/components/pennlibs-iiif-img/pennlibs-iiif-img.js +432 -0
  15. package/dist/collection/components/pennlibs-iiif-img/pennlibs-iiif-img.js.map +1 -0
  16. package/dist/components/index.d.ts +2 -0
  17. package/dist/components/index.js +1 -0
  18. package/dist/components/index.js.map +1 -1
  19. package/dist/components/pennlibs-fallback-img.js +1 -32
  20. package/dist/components/pennlibs-fallback-img.js.map +1 -1
  21. package/dist/components/pennlibs-fallback-img2.js +37 -0
  22. package/dist/components/pennlibs-fallback-img2.js.map +1 -0
  23. package/dist/components/pennlibs-iiif-img.d.ts +11 -0
  24. package/dist/components/pennlibs-iiif-img.js +289 -0
  25. package/dist/components/pennlibs-iiif-img.js.map +1 -0
  26. package/dist/docs.json +239 -3
  27. package/dist/{web/p-Di48-Vtw.js → esm/index-Cst_89-s.js} +62 -3
  28. package/dist/esm/index-Cst_89-s.js.map +1 -0
  29. package/dist/esm/index.js +1 -1
  30. package/dist/esm/loader.js +3 -3
  31. package/dist/esm/pennlibs-autocomplete.pennlibs-fallback-img.pennlibs-footer.pennlibs-header.pennlibs-iiif-img.entry.js.map +1 -0
  32. package/dist/esm/{pennlibs-autocomplete_3.entry.js → pennlibs-autocomplete_5.entry.js} +260 -3
  33. package/dist/esm/pennlibs-banner.entry.js +1 -1
  34. package/dist/esm/pennlibs-chat.entry.js +1 -1
  35. package/dist/esm/pennlibs-feedback.entry.js +1 -1
  36. package/dist/esm/pennlibs-hero.entry.js +1 -1
  37. package/dist/esm/web.js +3 -3
  38. package/dist/types/components/pennlibs-iiif-img/pennlibs-iiif-img.d.ts +130 -0
  39. package/dist/types/components.d.ts +119 -0
  40. package/dist/web/index.esm.js +1 -1
  41. package/dist/web/{p-6503bb09.entry.js → p-4ffdbc93.entry.js} +1 -1
  42. package/dist/web/{p-56b9f10c.entry.js → p-621f166e.entry.js} +1 -1
  43. package/dist/web/{p-269363bf.entry.js → p-6e0c2de9.entry.js} +260 -3
  44. package/dist/web/{p-783e2a87.entry.js → p-848d9acc.entry.js} +1 -1
  45. package/dist/{esm/index-Di48-Vtw.js → web/p-Cst_89-s.js} +62 -3
  46. package/dist/web/p-Cst_89-s.js.map +1 -0
  47. package/dist/web/{p-7cbd16c0.entry.js → p-a9c79310.entry.js} +1 -1
  48. package/dist/web/pennlibs-autocomplete.pennlibs-fallback-img.pennlibs-footer.pennlibs-header.pennlibs-iiif-img.entry.esm.js.map +1 -0
  49. package/dist/web/web.esm.js +3 -3
  50. package/hydrate/index.js +323 -2
  51. package/hydrate/index.mjs +323 -2
  52. package/package.json +1 -1
  53. package/dist/cjs/index-4ixBJUwu.js.map +0 -1
  54. package/dist/cjs/pennlibs-autocomplete.pennlibs-footer.pennlibs-header.entry.cjs.js.map +0 -1
  55. package/dist/cjs/pennlibs-fallback-img.cjs.entry.js +0 -20
  56. package/dist/cjs/pennlibs-fallback-img.entry.cjs.js.map +0 -1
  57. package/dist/esm/index-Di48-Vtw.js.map +0 -1
  58. package/dist/esm/pennlibs-autocomplete.pennlibs-footer.pennlibs-header.entry.js.map +0 -1
  59. package/dist/esm/pennlibs-fallback-img.entry.js +0 -18
  60. package/dist/esm/pennlibs-fallback-img.entry.js.map +0 -1
  61. package/dist/web/p-09e4a02c.entry.js +0 -18
  62. package/dist/web/p-Di48-Vtw.js.map +0 -1
  63. package/dist/web/pennlibs-autocomplete.pennlibs-footer.pennlibs-header.entry.esm.js.map +0 -1
  64. package/dist/web/pennlibs-fallback-img.entry.esm.js.map +0 -1
@@ -0,0 +1,432 @@
1
+ import { h } from "@stencil/core";
2
+ const PIXEL_DENSITIES = [1, 1.5, 2];
3
+ /**
4
+ * Display responsive, high-quality images from Penn Libraries' IIIF Image API 3.0 server.
5
+ * Measures its own rendered width and automatically generates optimal image sources at
6
+ * multiple pixel densities (1x, 1.5x, 2x) with modern WebP format and JPG fallback support.
7
+ *
8
+ * @component
9
+ * @example
10
+ * <pennlibs-iiif-img
11
+ * uuid="063ff35c-bbdd-4b63-bbdd-6206590e20d5"
12
+ * alt="">
13
+ * </pennlibs-iiif-img>
14
+ */
15
+ export class IIIFImg {
16
+ constructor() {
17
+ /**
18
+ * The IIIF [region](https://iiif.io/api/image/3.0/#41-region) of the image to display.
19
+ * Defines the rectangular portion of the underlying image to return.
20
+ *
21
+ * `full`: The full image is returned, without any cropping.
22
+ *
23
+ * `square`: A square area where width and height equal the shorter dimension.
24
+ *
25
+ * `width:height`: Any aspect ratio format (e.g., `16:9`, `4:3`, `3:2`, `21:9`) applies
26
+ * a centered crop based on the source image dimensions and sets the CSS aspect-ratio
27
+ * property for layout reservation.
28
+ *
29
+ * `x,y,w,h`: Absolute pixel coordinates (x, y position; w, h dimensions).
30
+ *
31
+ * `pct:x,y,w,h`: Percentage-based coordinates of full image dimensions.
32
+ *
33
+ * @default 'full'
34
+ */
35
+ this.region = 'full';
36
+ /**
37
+ * The IIIF [rotation](https://iiif.io/api/image/3.0/#44-rotation) to apply to the image.
38
+ * Specifies mirroring and clockwise rotation in degrees (0-360).
39
+ *
40
+ * `n`: Rotation in degrees only.
41
+ *
42
+ * `!n`: Mirror the image vertically, then rotate by n degrees.
43
+ *
44
+ * @default '0'
45
+ */
46
+ this.rotation = '0';
47
+ /**
48
+ * The IIIF [quality](https://iiif.io/api/image/3.0/#quality) of the image.
49
+ * Controls the color delivery mode.
50
+ *
51
+ * `default`: The server's default quality.
52
+ *
53
+ * `color`: Full color information.
54
+ *
55
+ * `gray`: Grayscale rendering.
56
+ *
57
+ * `bitonal`: Black and white only.
58
+ *
59
+ * @default 'default'
60
+ */
61
+ this.quality = 'default';
62
+ /**
63
+ * Native browser lazy loading behavior. Use "lazy" to defer loading until the image is near the viewport,
64
+ * or "eager" to load immediately.
65
+ * @default 'lazy'
66
+ */
67
+ this.loading = 'lazy';
68
+ /**
69
+ * Whether to display a fallback placeholder image when the IIIF image fails to load.
70
+ * @default true
71
+ */
72
+ this.showFallback = true;
73
+ this.isLoaded = false;
74
+ this.hasError = false;
75
+ this.baseUrl = 'https://iiif-images.library.upenn.edu/iiif/3';
76
+ this.handleLoad = () => {
77
+ this.isLoaded = true;
78
+ };
79
+ this.handleError = () => {
80
+ this.hasError = true;
81
+ };
82
+ }
83
+ /**
84
+ * Fetch IIIF image info to get actual dimensions.
85
+ */
86
+ async fetchImageInfo() {
87
+ try {
88
+ const currentUuid = this.uuid; // Capture current UUID
89
+ const infoUrl = `${this.baseUrl}/${currentUuid}/info.json`;
90
+ const response = await fetch(infoUrl);
91
+ if (!response.ok) {
92
+ console.error(`Failed to fetch IIIF info.json for ${currentUuid}`);
93
+ return;
94
+ }
95
+ const info = await response.json();
96
+ // Only update dimensions if UUID hasn't changed during fetch
97
+ // (protects against race conditions if component updates)
98
+ if (this.uuid === currentUuid) {
99
+ this.imageDimensions = {
100
+ width: info.width,
101
+ height: info.height,
102
+ };
103
+ this.fetchedUuid = currentUuid;
104
+ }
105
+ }
106
+ catch (error) {
107
+ console.error(`Error fetching IIIF image info for ${this.uuid}:`, error);
108
+ }
109
+ }
110
+ /**
111
+ * Check if a region value matches aspect ratio format (e.g., "16:9", "4:3", "3:2").
112
+ */
113
+ isAspectRatio(value) {
114
+ return /^\d+:\d+$/.test(value);
115
+ }
116
+ /**
117
+ * Set CSS custom property for aspect ratio on the host element.
118
+ */
119
+ setAspectRatioCss(aspectRatio) {
120
+ const [widthRatio, heightRatio] = aspectRatio.split(':');
121
+ this.hostElement.style.setProperty('--aspect-ratio', `${widthRatio} / ${heightRatio}`);
122
+ }
123
+ /**
124
+ * Clear CSS custom property for aspect ratio from the host element.
125
+ */
126
+ clearAspectRatioCss() {
127
+ this.hostElement.style.removeProperty('--aspect-ratio');
128
+ }
129
+ /**
130
+ * Format a number for IIIF percentage values (remove trailing zeros).
131
+ * IIIF spec requires no trailing zeros per section 4.7.
132
+ */
133
+ formatPercent(value) {
134
+ return value.toFixed(2).replace(/\.?0+$/, '');
135
+ }
136
+ /**
137
+ * Calculate a centered crop region for a given aspect ratio.
138
+ * Requires actual image dimensions to calculate correctly.
139
+ * @param aspectRatio - The target aspect ratio (e.g., "3:2" or "2:3")
140
+ * @returns A IIIF percentage-based region string (e.g., "pct:0,16.67,100,66.67")
141
+ */
142
+ calculateCenteredCrop(aspectRatio) {
143
+ if (!this.imageDimensions) {
144
+ throw new Error('Image dimensions required for aspect ratio calculation');
145
+ }
146
+ const [widthRatio, heightRatio] = aspectRatio.split(':').map(Number);
147
+ const targetRatio = widthRatio / heightRatio;
148
+ const sourceRatio = this.imageDimensions.width / this.imageDimensions.height;
149
+ // Determine if we need to crop width or height
150
+ if (sourceRatio > targetRatio) {
151
+ // Source is wider than target - crop left and right
152
+ const widthPercent = (targetRatio / sourceRatio) * 100;
153
+ const xOffset = (100 - widthPercent) / 2;
154
+ return `pct:${this.formatPercent(xOffset)},0,${this.formatPercent(widthPercent)},100`;
155
+ }
156
+ else {
157
+ // Source is taller than target - crop top and bottom
158
+ const heightPercent = (sourceRatio / targetRatio) * 100;
159
+ const yOffset = (100 - heightPercent) / 2;
160
+ return `pct:0,${this.formatPercent(yOffset)},100,${this.formatPercent(heightPercent)}`;
161
+ }
162
+ }
163
+ /**
164
+ * Get the region parameter for the IIIF URL.
165
+ */
166
+ getRegionParam() {
167
+ // Handle custom aspect ratios
168
+ let regionParam = this.region || 'full';
169
+ if (this.isAspectRatio(regionParam)) {
170
+ // Only apply crop if we have dimensions for the current UUID
171
+ if (this.imageDimensions && this.fetchedUuid === this.uuid) {
172
+ regionParam = this.calculateCenteredCrop(regionParam);
173
+ }
174
+ else {
175
+ // Use full image until dimensions are loaded
176
+ regionParam = 'full';
177
+ }
178
+ }
179
+ return regionParam;
180
+ }
181
+ buildIIIFUrl(width, format = 'jpg') {
182
+ const sizeParam = width ? `${width},` : 'max';
183
+ const regionParam = this.getRegionParam();
184
+ return `${this.baseUrl}/${this.uuid}/${regionParam}/${sizeParam}/${this.rotation}/${this.quality}.${format}`;
185
+ }
186
+ generateSrcset(baseWidth, format) {
187
+ return PIXEL_DENSITIES.map(density => {
188
+ const width = Math.round(baseWidth * density);
189
+ const url = this.buildIIIFUrl(width, format);
190
+ return `${url} ${density}x`;
191
+ }).join(', ');
192
+ }
193
+ handleRegionChange(newValue, oldValue) {
194
+ // Only process if region actually changed
195
+ if (newValue === oldValue) {
196
+ return;
197
+ }
198
+ // If new region is an aspect ratio, set CSS and fetch info
199
+ if (newValue && this.isAspectRatio(newValue)) {
200
+ this.setAspectRatioCss(newValue);
201
+ this.fetchImageInfo();
202
+ }
203
+ else {
204
+ // Clear aspect ratio CSS if no longer using aspect ratio format
205
+ this.clearAspectRatioCss();
206
+ }
207
+ }
208
+ componentDidLoad() {
209
+ // Set CSS aspect ratio and fetch image info if using aspect ratio format
210
+ if (this.region && this.isAspectRatio(this.region)) {
211
+ this.setAspectRatioCss(this.region);
212
+ this.fetchImageInfo();
213
+ }
214
+ if ('ResizeObserver' in window) {
215
+ this.resizeObserver = new ResizeObserver(entries => {
216
+ for (const entry of entries) {
217
+ this.observedWidth = Math.round(entry.contentRect.width);
218
+ if (this.resizeObserver) {
219
+ this.resizeObserver.disconnect();
220
+ this.resizeObserver = undefined;
221
+ }
222
+ }
223
+ });
224
+ this.resizeObserver.observe(this.hostElement);
225
+ }
226
+ }
227
+ disconnectedCallback() {
228
+ if (this.resizeObserver) {
229
+ this.resizeObserver.disconnect();
230
+ this.resizeObserver = undefined;
231
+ }
232
+ }
233
+ render() {
234
+ // Show placeholder until we've measured the component width
235
+ if (!this.observedWidth) {
236
+ return h("pennlibs-fallback-img", null);
237
+ }
238
+ if (this.hasError && this.showFallback) {
239
+ return (h("div", { class: "fallback-container" }, h("pennlibs-fallback-img", null)));
240
+ }
241
+ const imgClasses = {
242
+ 'iiif-img': true,
243
+ 'loaded': this.isLoaded
244
+ };
245
+ return (h("picture", null, h("source", { type: "image/webp", srcSet: this.generateSrcset(this.observedWidth, 'webp') }), h("img", { class: imgClasses, src: this.buildIIIFUrl(this.observedWidth, 'jpg'), srcSet: this.generateSrcset(this.observedWidth, 'jpg'), alt: this.alt, loading: this.loading, onLoad: this.handleLoad, onError: this.handleError })));
246
+ }
247
+ static get is() { return "pennlibs-iiif-img"; }
248
+ static get encapsulation() { return "shadow"; }
249
+ static get originalStyleUrls() {
250
+ return {
251
+ "$": ["pennlibs-iiif-img.css"]
252
+ };
253
+ }
254
+ static get styleUrls() {
255
+ return {
256
+ "$": ["pennlibs-iiif-img.css"]
257
+ };
258
+ }
259
+ static get properties() {
260
+ return {
261
+ "uuid": {
262
+ "type": "string",
263
+ "mutable": false,
264
+ "complexType": {
265
+ "original": "string",
266
+ "resolved": "string",
267
+ "references": {}
268
+ },
269
+ "required": true,
270
+ "optional": false,
271
+ "docs": {
272
+ "tags": [],
273
+ "text": "The IIIF [UUID identifier](https://iiif.io/api/image/3.0/#3-identifier) of the image resource on the Penn Libraries IIIF server."
274
+ },
275
+ "getter": false,
276
+ "setter": false,
277
+ "reflect": false,
278
+ "attribute": "uuid"
279
+ },
280
+ "alt": {
281
+ "type": "string",
282
+ "mutable": false,
283
+ "complexType": {
284
+ "original": "string",
285
+ "resolved": "string",
286
+ "references": {}
287
+ },
288
+ "required": true,
289
+ "optional": false,
290
+ "docs": {
291
+ "tags": [],
292
+ "text": "Alternative text that describes the image content for screen readers and when images fail to load.\nUse an empty string for purely decorative images."
293
+ },
294
+ "getter": false,
295
+ "setter": false,
296
+ "reflect": false,
297
+ "attribute": "alt"
298
+ },
299
+ "region": {
300
+ "type": "string",
301
+ "mutable": false,
302
+ "complexType": {
303
+ "original": "string",
304
+ "resolved": "string",
305
+ "references": {}
306
+ },
307
+ "required": false,
308
+ "optional": true,
309
+ "docs": {
310
+ "tags": [{
311
+ "name": "default",
312
+ "text": "'full'"
313
+ }],
314
+ "text": "The IIIF [region](https://iiif.io/api/image/3.0/#41-region) of the image to display.\nDefines the rectangular portion of the underlying image to return.\n\n`full`: The full image is returned, without any cropping.\n\n`square`: A square area where width and height equal the shorter dimension.\n\n`width:height`: Any aspect ratio format (e.g., `16:9`, `4:3`, `3:2`, `21:9`) applies\na centered crop based on the source image dimensions and sets the CSS aspect-ratio\nproperty for layout reservation.\n\n`x,y,w,h`: Absolute pixel coordinates (x, y position; w, h dimensions).\n\n`pct:x,y,w,h`: Percentage-based coordinates of full image dimensions."
315
+ },
316
+ "getter": false,
317
+ "setter": false,
318
+ "reflect": true,
319
+ "attribute": "region",
320
+ "defaultValue": "'full'"
321
+ },
322
+ "rotation": {
323
+ "type": "string",
324
+ "mutable": false,
325
+ "complexType": {
326
+ "original": "string",
327
+ "resolved": "string",
328
+ "references": {}
329
+ },
330
+ "required": false,
331
+ "optional": true,
332
+ "docs": {
333
+ "tags": [{
334
+ "name": "default",
335
+ "text": "'0'"
336
+ }],
337
+ "text": "The IIIF [rotation](https://iiif.io/api/image/3.0/#44-rotation) to apply to the image.\nSpecifies mirroring and clockwise rotation in degrees (0-360).\n\n`n`: Rotation in degrees only.\n\n`!n`: Mirror the image vertically, then rotate by n degrees."
338
+ },
339
+ "getter": false,
340
+ "setter": false,
341
+ "reflect": false,
342
+ "attribute": "rotation",
343
+ "defaultValue": "'0'"
344
+ },
345
+ "quality": {
346
+ "type": "string",
347
+ "mutable": false,
348
+ "complexType": {
349
+ "original": "string",
350
+ "resolved": "string",
351
+ "references": {}
352
+ },
353
+ "required": false,
354
+ "optional": true,
355
+ "docs": {
356
+ "tags": [{
357
+ "name": "default",
358
+ "text": "'default'"
359
+ }],
360
+ "text": "The IIIF [quality](https://iiif.io/api/image/3.0/#quality) of the image.\nControls the color delivery mode.\n\n`default`: The server's default quality.\n\n`color`: Full color information.\n\n`gray`: Grayscale rendering.\n\n`bitonal`: Black and white only."
361
+ },
362
+ "getter": false,
363
+ "setter": false,
364
+ "reflect": false,
365
+ "attribute": "quality",
366
+ "defaultValue": "'default'"
367
+ },
368
+ "loading": {
369
+ "type": "string",
370
+ "mutable": false,
371
+ "complexType": {
372
+ "original": "'lazy' | 'eager'",
373
+ "resolved": "\"eager\" | \"lazy\"",
374
+ "references": {}
375
+ },
376
+ "required": false,
377
+ "optional": true,
378
+ "docs": {
379
+ "tags": [{
380
+ "name": "default",
381
+ "text": "'lazy'"
382
+ }],
383
+ "text": "Native browser lazy loading behavior. Use \"lazy\" to defer loading until the image is near the viewport,\nor \"eager\" to load immediately."
384
+ },
385
+ "getter": false,
386
+ "setter": false,
387
+ "reflect": false,
388
+ "attribute": "loading",
389
+ "defaultValue": "'lazy'"
390
+ },
391
+ "showFallback": {
392
+ "type": "boolean",
393
+ "mutable": false,
394
+ "complexType": {
395
+ "original": "boolean",
396
+ "resolved": "boolean",
397
+ "references": {}
398
+ },
399
+ "required": false,
400
+ "optional": true,
401
+ "docs": {
402
+ "tags": [{
403
+ "name": "default",
404
+ "text": "true"
405
+ }],
406
+ "text": "Whether to display a fallback placeholder image when the IIIF image fails to load."
407
+ },
408
+ "getter": false,
409
+ "setter": false,
410
+ "reflect": false,
411
+ "attribute": "show-fallback",
412
+ "defaultValue": "true"
413
+ }
414
+ };
415
+ }
416
+ static get states() {
417
+ return {
418
+ "isLoaded": {},
419
+ "hasError": {},
420
+ "imageDimensions": {},
421
+ "observedWidth": {}
422
+ };
423
+ }
424
+ static get elementRef() { return "hostElement"; }
425
+ static get watchers() {
426
+ return [{
427
+ "propName": "region",
428
+ "methodName": "handleRegionChange"
429
+ }];
430
+ }
431
+ }
432
+ //# sourceMappingURL=pennlibs-iiif-img.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pennlibs-iiif-img.js","sourceRoot":"","sources":["../../../src/components/pennlibs-iiif-img/pennlibs-iiif-img.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAI1E,MAAM,eAAe,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAU,CAAC;AAE7C;;;;;;;;;;;GAWG;AAMH,MAAM,OAAO,OAAO;IALpB;QAqBE;;;;;;;;;;;;;;;;;WAiBG;QACsB,WAAM,GAAY,MAAM,CAAC;QAElD;;;;;;;;;WASG;QACK,aAAQ,GAAY,GAAG,CAAC;QAEhC;;;;;;;;;;;;;WAaG;QACK,YAAO,GAAY,SAAS,CAAC;QAErC;;;;WAIG;QACK,YAAO,GAAsB,MAAM,CAAC;QAE5C;;;WAGG;QACK,iBAAY,GAAa,IAAI,CAAC;QAE7B,aAAQ,GAAY,KAAK,CAAC;QAC1B,aAAQ,GAAY,KAAK,CAAC;QAMlB,YAAO,GAAG,8CAA8C,CAAC;QA2HlE,eAAU,GAAG,GAAG,EAAE;YACxB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACvB,CAAC,CAAC;QAEM,gBAAW,GAAG,GAAG,EAAE;YACzB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC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;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, State, Element, Watch } from '@stencil/core';\n\ntype ImageFormat = 'jpg' | 'webp';\n\nconst PIXEL_DENSITIES = [1, 1.5, 2] as const;\n\n/**\n * Display responsive, high-quality images from Penn Libraries' IIIF Image API 3.0 server.\n * Measures its own rendered width and automatically generates optimal image sources at\n * multiple pixel densities (1x, 1.5x, 2x) with modern WebP format and JPG fallback support.\n *\n * @component\n * @example\n * <pennlibs-iiif-img\n * uuid=\"063ff35c-bbdd-4b63-bbdd-6206590e20d5\"\n * alt=\"\">\n * </pennlibs-iiif-img>\n */\n@Component({\n tag: 'pennlibs-iiif-img',\n styleUrl: 'pennlibs-iiif-img.css',\n shadow: true,\n})\nexport class IIIFImg {\n private resizeObserver?: ResizeObserver;\n\n @Element() hostElement!: HTMLElement;\n\n /**\n * The IIIF [UUID identifier](https://iiif.io/api/image/3.0/#3-identifier) of the image resource on the Penn Libraries IIIF server.\n */\n @Prop() uuid!: string;\n\n /**\n * Alternative text that describes the image content for screen readers and when images fail to load.\n * Use an empty string for purely decorative images.\n */\n @Prop() alt!: string;\n\n /**\n * The IIIF [region](https://iiif.io/api/image/3.0/#41-region) of the image to display.\n * Defines the rectangular portion of the underlying image to return.\n *\n * `full`: The full image is returned, without any cropping.\n *\n * `square`: A square area where width and height equal the shorter dimension.\n *\n * `width:height`: Any aspect ratio format (e.g., `16:9`, `4:3`, `3:2`, `21:9`) applies\n * a centered crop based on the source image dimensions and sets the CSS aspect-ratio\n * property for layout reservation.\n *\n * `x,y,w,h`: Absolute pixel coordinates (x, y position; w, h dimensions).\n *\n * `pct:x,y,w,h`: Percentage-based coordinates of full image dimensions.\n *\n * @default 'full'\n */\n @Prop({ reflect: true }) region?: string = 'full';\n\n /**\n * The IIIF [rotation](https://iiif.io/api/image/3.0/#44-rotation) to apply to the image.\n * Specifies mirroring and clockwise rotation in degrees (0-360).\n * \n * `n`: Rotation in degrees only.\n * \n * `!n`: Mirror the image vertically, then rotate by n degrees.\n * \n * @default '0'\n */\n @Prop() rotation?: string = '0';\n\n /**\n * The IIIF [quality](https://iiif.io/api/image/3.0/#quality) of the image.\n * Controls the color delivery mode.\n * \n * `default`: The server's default quality.\n * \n * `color`: Full color information.\n * \n * `gray`: Grayscale rendering.\n * \n * `bitonal`: Black and white only.\n * \n * @default 'default'\n */\n @Prop() quality?: string = 'default';\n\n /**\n * Native browser lazy loading behavior. Use \"lazy\" to defer loading until the image is near the viewport,\n * or \"eager\" to load immediately.\n * @default 'lazy'\n */\n @Prop() loading?: 'lazy' | 'eager' = 'lazy';\n\n /**\n * Whether to display a fallback placeholder image when the IIIF image fails to load.\n * @default true\n */\n @Prop() showFallback?: boolean = true;\n\n @State() isLoaded: boolean = false;\n @State() hasError: boolean = false;\n @State() imageDimensions?: { width: number; height: number };\n @State() observedWidth?: number;\n\n private fetchedUuid?: string; // Track which UUID these dimensions belong to\n\n private readonly baseUrl = 'https://iiif-images.library.upenn.edu/iiif/3';\n\n /**\n * Fetch IIIF image info to get actual dimensions.\n */\n private async fetchImageInfo(): Promise<void> {\n try {\n const currentUuid = this.uuid; // Capture current UUID\n const infoUrl = `${this.baseUrl}/${currentUuid}/info.json`;\n const response = await fetch(infoUrl);\n if (!response.ok) {\n console.error(`Failed to fetch IIIF info.json for ${currentUuid}`);\n return;\n }\n const info = await response.json();\n\n // Only update dimensions if UUID hasn't changed during fetch\n // (protects against race conditions if component updates)\n if (this.uuid === currentUuid) {\n this.imageDimensions = {\n width: info.width,\n height: info.height,\n };\n this.fetchedUuid = currentUuid;\n }\n } catch (error) {\n console.error(`Error fetching IIIF image info for ${this.uuid}:`, error);\n }\n }\n\n /**\n * Check if a region value matches aspect ratio format (e.g., \"16:9\", \"4:3\", \"3:2\").\n */\n private isAspectRatio(value: string): boolean {\n return /^\\d+:\\d+$/.test(value);\n }\n\n /**\n * Set CSS custom property for aspect ratio on the host element.\n */\n private setAspectRatioCss(aspectRatio: string): void {\n const [widthRatio, heightRatio] = aspectRatio.split(':');\n this.hostElement.style.setProperty('--aspect-ratio', `${widthRatio} / ${heightRatio}`);\n }\n\n /**\n * Clear CSS custom property for aspect ratio from the host element.\n */\n private clearAspectRatioCss(): void {\n this.hostElement.style.removeProperty('--aspect-ratio');\n }\n\n /**\n * Format a number for IIIF percentage values (remove trailing zeros).\n * IIIF spec requires no trailing zeros per section 4.7.\n */\n private formatPercent(value: number): string {\n return value.toFixed(2).replace(/\\.?0+$/, '');\n }\n\n /**\n * Calculate a centered crop region for a given aspect ratio.\n * Requires actual image dimensions to calculate correctly.\n * @param aspectRatio - The target aspect ratio (e.g., \"3:2\" or \"2:3\")\n * @returns A IIIF percentage-based region string (e.g., \"pct:0,16.67,100,66.67\")\n */\n private calculateCenteredCrop(aspectRatio: string): string {\n if (!this.imageDimensions) {\n throw new Error('Image dimensions required for aspect ratio calculation');\n }\n\n const [widthRatio, heightRatio] = aspectRatio.split(':').map(Number);\n const targetRatio = widthRatio / heightRatio;\n const sourceRatio = this.imageDimensions.width / this.imageDimensions.height;\n\n // Determine if we need to crop width or height\n if (sourceRatio > targetRatio) {\n // Source is wider than target - crop left and right\n const widthPercent = (targetRatio / sourceRatio) * 100;\n const xOffset = (100 - widthPercent) / 2;\n return `pct:${this.formatPercent(xOffset)},0,${this.formatPercent(widthPercent)},100`;\n } else {\n // Source is taller than target - crop top and bottom\n const heightPercent = (sourceRatio / targetRatio) * 100;\n const yOffset = (100 - heightPercent) / 2;\n return `pct:0,${this.formatPercent(yOffset)},100,${this.formatPercent(heightPercent)}`;\n }\n }\n\n /**\n * Get the region parameter for the IIIF URL.\n */\n private getRegionParam(): string {\n // Handle custom aspect ratios\n let regionParam = this.region || 'full';\n if (this.isAspectRatio(regionParam)) {\n // Only apply crop if we have dimensions for the current UUID\n if (this.imageDimensions && this.fetchedUuid === this.uuid) {\n regionParam = this.calculateCenteredCrop(regionParam);\n } else {\n // Use full image until dimensions are loaded\n regionParam = 'full';\n }\n }\n\n return regionParam;\n }\n\n private buildIIIFUrl(width?: number, format: ImageFormat = 'jpg'): string {\n const sizeParam = width ? `${width},` : 'max';\n const regionParam = this.getRegionParam();\n return `${this.baseUrl}/${this.uuid}/${regionParam}/${sizeParam}/${this.rotation}/${this.quality}.${format}`;\n }\n\n private generateSrcset(baseWidth: number, format: ImageFormat): string {\n return PIXEL_DENSITIES.map(density => {\n const width = Math.round(baseWidth * density);\n const url = this.buildIIIFUrl(width, format);\n return `${url} ${density}x`;\n }).join(', ');\n }\n\n\n private handleLoad = () => {\n this.isLoaded = true;\n };\n\n private handleError = () => {\n this.hasError = true;\n };\n\n @Watch('region')\n handleRegionChange(newValue: string, oldValue: string) {\n // Only process if region actually changed\n if (newValue === oldValue) {\n return;\n }\n\n // If new region is an aspect ratio, set CSS and fetch info\n if (newValue && this.isAspectRatio(newValue)) {\n this.setAspectRatioCss(newValue);\n this.fetchImageInfo();\n } else {\n // Clear aspect ratio CSS if no longer using aspect ratio format\n this.clearAspectRatioCss();\n }\n }\n\n componentDidLoad() {\n // Set CSS aspect ratio and fetch image info if using aspect ratio format\n if (this.region && this.isAspectRatio(this.region)) {\n this.setAspectRatioCss(this.region);\n this.fetchImageInfo();\n }\n\n if ('ResizeObserver' in window) {\n this.resizeObserver = new ResizeObserver(entries => {\n for (const entry of entries) {\n this.observedWidth = Math.round(entry.contentRect.width);\n\n if (this.resizeObserver) {\n this.resizeObserver.disconnect();\n this.resizeObserver = undefined;\n }\n }\n });\n\n this.resizeObserver.observe(this.hostElement);\n }\n }\n\n disconnectedCallback() {\n if (this.resizeObserver) {\n this.resizeObserver.disconnect();\n this.resizeObserver = undefined;\n }\n }\n\n render() {\n // Show placeholder until we've measured the component width\n if (!this.observedWidth) {\n return <pennlibs-fallback-img />;\n }\n\n if (this.hasError && this.showFallback) {\n return (\n <div class=\"fallback-container\">\n <pennlibs-fallback-img />\n </div>\n );\n }\n\n const imgClasses = {\n 'iiif-img': true,\n 'loaded': this.isLoaded\n };\n\n return (\n <picture>\n <source\n type=\"image/webp\"\n srcSet={this.generateSrcset(this.observedWidth, 'webp')}\n />\n\n <img\n class={imgClasses}\n src={this.buildIIIFUrl(this.observedWidth, 'jpg')}\n srcSet={this.generateSrcset(this.observedWidth, 'jpg')}\n alt={this.alt}\n loading={this.loading}\n onLoad={this.handleLoad}\n onError={this.handleError}\n />\n </picture>\n );\n }\n}\n"]}
@@ -15,6 +15,8 @@ export { Header as PennlibsHeader } from '../types/components/pennlibs-header/pe
15
15
  export { defineCustomElement as defineCustomElementPennlibsHeader } from './pennlibs-header';
16
16
  export { Hero as PennlibsHero } from '../types/components/pennlibs-hero/pennlibs-hero';
17
17
  export { defineCustomElement as defineCustomElementPennlibsHero } from './pennlibs-hero';
18
+ export { IIIFImg as PennlibsIiifImg } from '../types/components/pennlibs-iiif-img/pennlibs-iiif-img';
19
+ export { defineCustomElement as defineCustomElementPennlibsIiifImg } from './pennlibs-iiif-img';
18
20
 
19
21
  /**
20
22
  * Get the base path to where the assets can be found. Use "setAssetPath(path)"
@@ -7,6 +7,7 @@ export { PennlibsFeedback, defineCustomElement as defineCustomElementPennlibsFee
7
7
  export { PennlibsFooter, defineCustomElement as defineCustomElementPennlibsFooter } from './pennlibs-footer.js';
8
8
  export { PennlibsHeader, defineCustomElement as defineCustomElementPennlibsHeader } from './pennlibs-header.js';
9
9
  export { PennlibsHero, defineCustomElement as defineCustomElementPennlibsHero } from './pennlibs-hero.js';
10
+ export { PennlibsIiifImg, defineCustomElement as defineCustomElementPennlibsIiifImg } from './pennlibs-iiif-img.js';
10
11
  //# sourceMappingURL=index.js.map
11
12
 
12
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"file":"index.js","mappings":";;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
1
+ {"file":"index.js","mappings":";;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
@@ -1,35 +1,4 @@
1
- import { proxyCustomElement, HTMLElement, getAssetPath, h } from '@stencil/core/internal/client';
2
-
3
- const pennlibsFallbackImgCss = ":host{font-family:var(--pl-font-family);font-size:var(--pl-font-size);display:flex;align-items:center;justify-content:center;padding:1rem;background:var(--pl-color-bg-subtle);aspect-ratio:3/2}.no-image__img{width:100%;max-width:150px;filter:grayscale(1) opacity(0.3)}";
4
-
5
- const NoImage = /*@__PURE__*/ proxyCustomElement(class NoImage extends HTMLElement {
6
- constructor(registerHost) {
7
- super();
8
- if (registerHost !== false) {
9
- this.__registerHost();
10
- }
11
- this.__attachShadow();
12
- }
13
- render() {
14
- const shieldImg = getAssetPath('./assets/simplified-shield.webp');
15
- return (h("img", { key: 'ba6cc227e90aac2e22b9997ad5c794fd4fd6d5ef', src: shieldImg, alt: "", class: "no-image__img" }));
16
- }
17
- static get assetsDirs() { return ["assets"]; }
18
- static get style() { return pennlibsFallbackImgCss; }
19
- }, [257, "pennlibs-fallback-img"]);
20
- function defineCustomElement$1() {
21
- if (typeof customElements === "undefined") {
22
- return;
23
- }
24
- const components = ["pennlibs-fallback-img"];
25
- components.forEach(tagName => { switch (tagName) {
26
- case "pennlibs-fallback-img":
27
- if (!customElements.get(tagName)) {
28
- customElements.define(tagName, NoImage);
29
- }
30
- break;
31
- } });
32
- }
1
+ import { N as NoImage, d as defineCustomElement$1 } from './pennlibs-fallback-img2.js';
33
2
 
34
3
  const PennlibsFallbackImg = NoImage;
35
4
  const defineCustomElement = defineCustomElement$1;
@@ -1 +1 @@
1
- {"file":"pennlibs-fallback-img.js","mappings":";;AAAA,MAAM,sBAAsB,GAAG,6QAA6Q;;MCQ/R,OAAO,iBAAAA,kBAAA,CAAA,MAAA,OAAA,SAAA,WAAA,CAAA;;;;;;;;IAClB,MAAM,GAAA;AACJ,QAAA,MAAM,SAAS,GAAG,YAAY,CAAC,iCAAiC,CAAC;QAEjE,QACE,CAAA,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAK,GAAG,EAAE,SAAS,EAAE,GAAG,EAAC,EAAE,EAAC,KAAK,EAAC,eAAe,EAAA,CAAG;;;;;;;;;;;;;;;;;;;;;;;;","names":["__stencil_proxyCustomElement"],"sources":["src/components/pennlibs-fallback-img/pennlibs-fallback-img.css?tag=pennlibs-fallback-img&encapsulation=shadow","src/components/pennlibs-fallback-img/pennlibs-fallback-img.tsx"],"sourcesContent":[":host {\n font-family: var(--pl-font-family);\n font-size: var(--pl-font-size);\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 1rem;\n background: var(--pl-color-bg-subtle);\n aspect-ratio: 3/2;\n}\n\n.no-image__img {\n width: 100%;\n max-width: 150px;\n filter: grayscale(1) opacity(0.3);\n} ","import { Component, h, getAssetPath } from '@stencil/core';\n\n@Component({\n tag: 'pennlibs-fallback-img',\n styleUrl: 'pennlibs-fallback-img.css',\n shadow: true,\n assetsDirs: ['assets']\n})\nexport class NoImage {\n render() {\n const shieldImg = getAssetPath('./assets/simplified-shield.webp');\n\n return (\n <img src={shieldImg} alt=\"\" class=\"no-image__img\" />\n );\n }\n} "],"version":3}
1
+ {"file":"pennlibs-fallback-img.js","mappings":";;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
@@ -0,0 +1,37 @@
1
+ import { proxyCustomElement, HTMLElement, getAssetPath, h } from '@stencil/core/internal/client';
2
+
3
+ const pennlibsFallbackImgCss = ":host{font-family:var(--pl-font-family);font-size:var(--pl-font-size);display:flex;align-items:center;justify-content:center;padding:1rem;background:var(--pl-color-bg-subtle);aspect-ratio:3/2}.no-image__img{width:100%;max-width:150px;filter:grayscale(1) opacity(0.3)}";
4
+
5
+ const NoImage = /*@__PURE__*/ proxyCustomElement(class NoImage extends HTMLElement {
6
+ constructor(registerHost) {
7
+ super();
8
+ if (registerHost !== false) {
9
+ this.__registerHost();
10
+ }
11
+ this.__attachShadow();
12
+ }
13
+ render() {
14
+ const shieldImg = getAssetPath('./assets/simplified-shield.webp');
15
+ return (h("img", { key: 'ba6cc227e90aac2e22b9997ad5c794fd4fd6d5ef', src: shieldImg, alt: "", class: "no-image__img" }));
16
+ }
17
+ static get assetsDirs() { return ["assets"]; }
18
+ static get style() { return pennlibsFallbackImgCss; }
19
+ }, [257, "pennlibs-fallback-img"]);
20
+ function defineCustomElement() {
21
+ if (typeof customElements === "undefined") {
22
+ return;
23
+ }
24
+ const components = ["pennlibs-fallback-img"];
25
+ components.forEach(tagName => { switch (tagName) {
26
+ case "pennlibs-fallback-img":
27
+ if (!customElements.get(tagName)) {
28
+ customElements.define(tagName, NoImage);
29
+ }
30
+ break;
31
+ } });
32
+ }
33
+
34
+ export { NoImage as N, defineCustomElement as d };
35
+ //# sourceMappingURL=pennlibs-fallback-img2.js.map
36
+
37
+ //# sourceMappingURL=pennlibs-fallback-img2.js.map
@@ -0,0 +1 @@
1
+ {"file":"pennlibs-fallback-img2.js","mappings":";;AAAA,MAAM,sBAAsB,GAAG,6QAA6Q;;MCQ/R,OAAO,iBAAAA,kBAAA,CAAA,MAAA,OAAA,SAAA,WAAA,CAAA;;;;;;;;IAClB,MAAM,GAAA;AACJ,QAAA,MAAM,SAAS,GAAG,YAAY,CAAC,iCAAiC,CAAC;QAEjE,QACE,CAAA,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAK,GAAG,EAAE,SAAS,EAAE,GAAG,EAAC,EAAE,EAAC,KAAK,EAAC,eAAe,EAAA,CAAG;;;;;;;;;;;;;;;;;;;;;","names":["__stencil_proxyCustomElement"],"sources":["src/components/pennlibs-fallback-img/pennlibs-fallback-img.css?tag=pennlibs-fallback-img&encapsulation=shadow","src/components/pennlibs-fallback-img/pennlibs-fallback-img.tsx"],"sourcesContent":[":host {\n font-family: var(--pl-font-family);\n font-size: var(--pl-font-size);\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 1rem;\n background: var(--pl-color-bg-subtle);\n aspect-ratio: 3/2;\n}\n\n.no-image__img {\n width: 100%;\n max-width: 150px;\n filter: grayscale(1) opacity(0.3);\n} ","import { Component, h, getAssetPath } from '@stencil/core';\n\n@Component({\n tag: 'pennlibs-fallback-img',\n styleUrl: 'pennlibs-fallback-img.css',\n shadow: true,\n assetsDirs: ['assets']\n})\nexport class NoImage {\n render() {\n const shieldImg = getAssetPath('./assets/simplified-shield.webp');\n\n return (\n <img src={shieldImg} alt=\"\" class=\"no-image__img\" />\n );\n }\n} "],"version":3}
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface PennlibsIiifImg extends Components.PennlibsIiifImg, HTMLElement {}
4
+ export const PennlibsIiifImg: {
5
+ prototype: PennlibsIiifImg;
6
+ new (): PennlibsIiifImg;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;