@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.
- package/dist/cjs/{index-4ixBJUwu.js → index-DVr0pLZy.js} +62 -3
- package/dist/cjs/index-DVr0pLZy.js.map +1 -0
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/pennlibs-autocomplete.pennlibs-fallback-img.pennlibs-footer.pennlibs-header.pennlibs-iiif-img.entry.cjs.js.map +1 -0
- package/dist/cjs/{pennlibs-autocomplete_3.cjs.entry.js → pennlibs-autocomplete_5.cjs.entry.js} +261 -2
- package/dist/cjs/pennlibs-banner.cjs.entry.js +1 -1
- package/dist/cjs/pennlibs-chat.cjs.entry.js +1 -1
- package/dist/cjs/pennlibs-feedback.cjs.entry.js +1 -1
- package/dist/cjs/pennlibs-hero.cjs.entry.js +1 -1
- package/dist/cjs/web.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +2 -1
- package/dist/collection/components/pennlibs-iiif-img/pennlibs-iiif-img.css +44 -0
- package/dist/collection/components/pennlibs-iiif-img/pennlibs-iiif-img.js +432 -0
- package/dist/collection/components/pennlibs-iiif-img/pennlibs-iiif-img.js.map +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/pennlibs-fallback-img.js +1 -32
- package/dist/components/pennlibs-fallback-img.js.map +1 -1
- package/dist/components/pennlibs-fallback-img2.js +37 -0
- package/dist/components/pennlibs-fallback-img2.js.map +1 -0
- package/dist/components/pennlibs-iiif-img.d.ts +11 -0
- package/dist/components/pennlibs-iiif-img.js +289 -0
- package/dist/components/pennlibs-iiif-img.js.map +1 -0
- package/dist/docs.json +239 -3
- package/dist/{web/p-Di48-Vtw.js → esm/index-Cst_89-s.js} +62 -3
- package/dist/esm/index-Cst_89-s.js.map +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/pennlibs-autocomplete.pennlibs-fallback-img.pennlibs-footer.pennlibs-header.pennlibs-iiif-img.entry.js.map +1 -0
- package/dist/esm/{pennlibs-autocomplete_3.entry.js → pennlibs-autocomplete_5.entry.js} +260 -3
- package/dist/esm/pennlibs-banner.entry.js +1 -1
- package/dist/esm/pennlibs-chat.entry.js +1 -1
- package/dist/esm/pennlibs-feedback.entry.js +1 -1
- package/dist/esm/pennlibs-hero.entry.js +1 -1
- package/dist/esm/web.js +3 -3
- package/dist/types/components/pennlibs-iiif-img/pennlibs-iiif-img.d.ts +130 -0
- package/dist/types/components.d.ts +119 -0
- package/dist/web/index.esm.js +1 -1
- package/dist/web/{p-6503bb09.entry.js → p-4ffdbc93.entry.js} +1 -1
- package/dist/web/{p-56b9f10c.entry.js → p-621f166e.entry.js} +1 -1
- package/dist/web/{p-269363bf.entry.js → p-6e0c2de9.entry.js} +260 -3
- package/dist/web/{p-783e2a87.entry.js → p-848d9acc.entry.js} +1 -1
- package/dist/{esm/index-Di48-Vtw.js → web/p-Cst_89-s.js} +62 -3
- package/dist/web/p-Cst_89-s.js.map +1 -0
- package/dist/web/{p-7cbd16c0.entry.js → p-a9c79310.entry.js} +1 -1
- package/dist/web/pennlibs-autocomplete.pennlibs-fallback-img.pennlibs-footer.pennlibs-header.pennlibs-iiif-img.entry.esm.js.map +1 -0
- package/dist/web/web.esm.js +3 -3
- package/hydrate/index.js +323 -2
- package/hydrate/index.mjs +323 -2
- package/package.json +1 -1
- package/dist/cjs/index-4ixBJUwu.js.map +0 -1
- package/dist/cjs/pennlibs-autocomplete.pennlibs-footer.pennlibs-header.entry.cjs.js.map +0 -1
- package/dist/cjs/pennlibs-fallback-img.cjs.entry.js +0 -20
- package/dist/cjs/pennlibs-fallback-img.entry.cjs.js.map +0 -1
- package/dist/esm/index-Di48-Vtw.js.map +0 -1
- package/dist/esm/pennlibs-autocomplete.pennlibs-footer.pennlibs-header.entry.js.map +0 -1
- package/dist/esm/pennlibs-fallback-img.entry.js +0 -18
- package/dist/esm/pennlibs-fallback-img.entry.js.map +0 -1
- package/dist/web/p-09e4a02c.entry.js +0 -18
- package/dist/web/p-Di48-Vtw.js.map +0 -1
- package/dist/web/pennlibs-autocomplete.pennlibs-footer.pennlibs-header.entry.esm.js.map +0 -1
- package/dist/web/pennlibs-fallback-img.entry.esm.js.map +0 -1
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
2
|
+
import { d as defineCustomElement$2 } from './pennlibs-fallback-img2.js';
|
|
3
|
+
|
|
4
|
+
const pennlibsIiifImgCss = ":host{display:block;width:100%;max-width:100%;align-self:flex-start;aspect-ratio:var(--aspect-ratio, auto)}picture{display:block;line-height:0}.iiif-img{display:block;width:100%;max-width:100%;height:auto;opacity:0;filter:blur(5px);transition:opacity 0.15s ease-in, filter 0.15s ease-in}.iiif-img.loaded{opacity:1;filter:blur(0)}.fallback-container{display:block;width:100%;height:100%}.fallback-container pennlibs-fallback-img{width:100%;height:100%}pennlibs-fallback-img{display:block;width:100%;height:100%}";
|
|
5
|
+
|
|
6
|
+
const PIXEL_DENSITIES = [1, 1.5, 2];
|
|
7
|
+
const IIIFImg = /*@__PURE__*/ proxyCustomElement(class IIIFImg extends HTMLElement {
|
|
8
|
+
constructor(registerHost) {
|
|
9
|
+
super();
|
|
10
|
+
if (registerHost !== false) {
|
|
11
|
+
this.__registerHost();
|
|
12
|
+
}
|
|
13
|
+
this.__attachShadow();
|
|
14
|
+
/**
|
|
15
|
+
* The IIIF [region](https://iiif.io/api/image/3.0/#41-region) of the image to display.
|
|
16
|
+
* Defines the rectangular portion of the underlying image to return.
|
|
17
|
+
*
|
|
18
|
+
* `full`: The full image is returned, without any cropping.
|
|
19
|
+
*
|
|
20
|
+
* `square`: A square area where width and height equal the shorter dimension.
|
|
21
|
+
*
|
|
22
|
+
* `width:height`: Any aspect ratio format (e.g., `16:9`, `4:3`, `3:2`, `21:9`) applies
|
|
23
|
+
* a centered crop based on the source image dimensions and sets the CSS aspect-ratio
|
|
24
|
+
* property for layout reservation.
|
|
25
|
+
*
|
|
26
|
+
* `x,y,w,h`: Absolute pixel coordinates (x, y position; w, h dimensions).
|
|
27
|
+
*
|
|
28
|
+
* `pct:x,y,w,h`: Percentage-based coordinates of full image dimensions.
|
|
29
|
+
*
|
|
30
|
+
* @default 'full'
|
|
31
|
+
*/
|
|
32
|
+
this.region = 'full';
|
|
33
|
+
/**
|
|
34
|
+
* The IIIF [rotation](https://iiif.io/api/image/3.0/#44-rotation) to apply to the image.
|
|
35
|
+
* Specifies mirroring and clockwise rotation in degrees (0-360).
|
|
36
|
+
*
|
|
37
|
+
* `n`: Rotation in degrees only.
|
|
38
|
+
*
|
|
39
|
+
* `!n`: Mirror the image vertically, then rotate by n degrees.
|
|
40
|
+
*
|
|
41
|
+
* @default '0'
|
|
42
|
+
*/
|
|
43
|
+
this.rotation = '0';
|
|
44
|
+
/**
|
|
45
|
+
* The IIIF [quality](https://iiif.io/api/image/3.0/#quality) of the image.
|
|
46
|
+
* Controls the color delivery mode.
|
|
47
|
+
*
|
|
48
|
+
* `default`: The server's default quality.
|
|
49
|
+
*
|
|
50
|
+
* `color`: Full color information.
|
|
51
|
+
*
|
|
52
|
+
* `gray`: Grayscale rendering.
|
|
53
|
+
*
|
|
54
|
+
* `bitonal`: Black and white only.
|
|
55
|
+
*
|
|
56
|
+
* @default 'default'
|
|
57
|
+
*/
|
|
58
|
+
this.quality = 'default';
|
|
59
|
+
/**
|
|
60
|
+
* Native browser lazy loading behavior. Use "lazy" to defer loading until the image is near the viewport,
|
|
61
|
+
* or "eager" to load immediately.
|
|
62
|
+
* @default 'lazy'
|
|
63
|
+
*/
|
|
64
|
+
this.loading = 'lazy';
|
|
65
|
+
/**
|
|
66
|
+
* Whether to display a fallback placeholder image when the IIIF image fails to load.
|
|
67
|
+
* @default true
|
|
68
|
+
*/
|
|
69
|
+
this.showFallback = true;
|
|
70
|
+
this.isLoaded = false;
|
|
71
|
+
this.hasError = false;
|
|
72
|
+
this.baseUrl = 'https://iiif-images.library.upenn.edu/iiif/3';
|
|
73
|
+
this.handleLoad = () => {
|
|
74
|
+
this.isLoaded = true;
|
|
75
|
+
};
|
|
76
|
+
this.handleError = () => {
|
|
77
|
+
this.hasError = true;
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Fetch IIIF image info to get actual dimensions.
|
|
82
|
+
*/
|
|
83
|
+
async fetchImageInfo() {
|
|
84
|
+
try {
|
|
85
|
+
const currentUuid = this.uuid; // Capture current UUID
|
|
86
|
+
const infoUrl = `${this.baseUrl}/${currentUuid}/info.json`;
|
|
87
|
+
const response = await fetch(infoUrl);
|
|
88
|
+
if (!response.ok) {
|
|
89
|
+
console.error(`Failed to fetch IIIF info.json for ${currentUuid}`);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const info = await response.json();
|
|
93
|
+
// Only update dimensions if UUID hasn't changed during fetch
|
|
94
|
+
// (protects against race conditions if component updates)
|
|
95
|
+
if (this.uuid === currentUuid) {
|
|
96
|
+
this.imageDimensions = {
|
|
97
|
+
width: info.width,
|
|
98
|
+
height: info.height,
|
|
99
|
+
};
|
|
100
|
+
this.fetchedUuid = currentUuid;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
console.error(`Error fetching IIIF image info for ${this.uuid}:`, error);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Check if a region value matches aspect ratio format (e.g., "16:9", "4:3", "3:2").
|
|
109
|
+
*/
|
|
110
|
+
isAspectRatio(value) {
|
|
111
|
+
return /^\d+:\d+$/.test(value);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Set CSS custom property for aspect ratio on the host element.
|
|
115
|
+
*/
|
|
116
|
+
setAspectRatioCss(aspectRatio) {
|
|
117
|
+
const [widthRatio, heightRatio] = aspectRatio.split(':');
|
|
118
|
+
this.hostElement.style.setProperty('--aspect-ratio', `${widthRatio} / ${heightRatio}`);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Clear CSS custom property for aspect ratio from the host element.
|
|
122
|
+
*/
|
|
123
|
+
clearAspectRatioCss() {
|
|
124
|
+
this.hostElement.style.removeProperty('--aspect-ratio');
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Format a number for IIIF percentage values (remove trailing zeros).
|
|
128
|
+
* IIIF spec requires no trailing zeros per section 4.7.
|
|
129
|
+
*/
|
|
130
|
+
formatPercent(value) {
|
|
131
|
+
return value.toFixed(2).replace(/\.?0+$/, '');
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Calculate a centered crop region for a given aspect ratio.
|
|
135
|
+
* Requires actual image dimensions to calculate correctly.
|
|
136
|
+
* @param aspectRatio - The target aspect ratio (e.g., "3:2" or "2:3")
|
|
137
|
+
* @returns A IIIF percentage-based region string (e.g., "pct:0,16.67,100,66.67")
|
|
138
|
+
*/
|
|
139
|
+
calculateCenteredCrop(aspectRatio) {
|
|
140
|
+
if (!this.imageDimensions) {
|
|
141
|
+
throw new Error('Image dimensions required for aspect ratio calculation');
|
|
142
|
+
}
|
|
143
|
+
const [widthRatio, heightRatio] = aspectRatio.split(':').map(Number);
|
|
144
|
+
const targetRatio = widthRatio / heightRatio;
|
|
145
|
+
const sourceRatio = this.imageDimensions.width / this.imageDimensions.height;
|
|
146
|
+
// Determine if we need to crop width or height
|
|
147
|
+
if (sourceRatio > targetRatio) {
|
|
148
|
+
// Source is wider than target - crop left and right
|
|
149
|
+
const widthPercent = (targetRatio / sourceRatio) * 100;
|
|
150
|
+
const xOffset = (100 - widthPercent) / 2;
|
|
151
|
+
return `pct:${this.formatPercent(xOffset)},0,${this.formatPercent(widthPercent)},100`;
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
// Source is taller than target - crop top and bottom
|
|
155
|
+
const heightPercent = (sourceRatio / targetRatio) * 100;
|
|
156
|
+
const yOffset = (100 - heightPercent) / 2;
|
|
157
|
+
return `pct:0,${this.formatPercent(yOffset)},100,${this.formatPercent(heightPercent)}`;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Get the region parameter for the IIIF URL.
|
|
162
|
+
*/
|
|
163
|
+
getRegionParam() {
|
|
164
|
+
// Handle custom aspect ratios
|
|
165
|
+
let regionParam = this.region || 'full';
|
|
166
|
+
if (this.isAspectRatio(regionParam)) {
|
|
167
|
+
// Only apply crop if we have dimensions for the current UUID
|
|
168
|
+
if (this.imageDimensions && this.fetchedUuid === this.uuid) {
|
|
169
|
+
regionParam = this.calculateCenteredCrop(regionParam);
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
// Use full image until dimensions are loaded
|
|
173
|
+
regionParam = 'full';
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return regionParam;
|
|
177
|
+
}
|
|
178
|
+
buildIIIFUrl(width, format = 'jpg') {
|
|
179
|
+
const sizeParam = width ? `${width},` : 'max';
|
|
180
|
+
const regionParam = this.getRegionParam();
|
|
181
|
+
return `${this.baseUrl}/${this.uuid}/${regionParam}/${sizeParam}/${this.rotation}/${this.quality}.${format}`;
|
|
182
|
+
}
|
|
183
|
+
generateSrcset(baseWidth, format) {
|
|
184
|
+
return PIXEL_DENSITIES.map(density => {
|
|
185
|
+
const width = Math.round(baseWidth * density);
|
|
186
|
+
const url = this.buildIIIFUrl(width, format);
|
|
187
|
+
return `${url} ${density}x`;
|
|
188
|
+
}).join(', ');
|
|
189
|
+
}
|
|
190
|
+
handleRegionChange(newValue, oldValue) {
|
|
191
|
+
// Only process if region actually changed
|
|
192
|
+
if (newValue === oldValue) {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
// If new region is an aspect ratio, set CSS and fetch info
|
|
196
|
+
if (newValue && this.isAspectRatio(newValue)) {
|
|
197
|
+
this.setAspectRatioCss(newValue);
|
|
198
|
+
this.fetchImageInfo();
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
// Clear aspect ratio CSS if no longer using aspect ratio format
|
|
202
|
+
this.clearAspectRatioCss();
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
componentDidLoad() {
|
|
206
|
+
// Set CSS aspect ratio and fetch image info if using aspect ratio format
|
|
207
|
+
if (this.region && this.isAspectRatio(this.region)) {
|
|
208
|
+
this.setAspectRatioCss(this.region);
|
|
209
|
+
this.fetchImageInfo();
|
|
210
|
+
}
|
|
211
|
+
if ('ResizeObserver' in window) {
|
|
212
|
+
this.resizeObserver = new ResizeObserver(entries => {
|
|
213
|
+
for (const entry of entries) {
|
|
214
|
+
this.observedWidth = Math.round(entry.contentRect.width);
|
|
215
|
+
if (this.resizeObserver) {
|
|
216
|
+
this.resizeObserver.disconnect();
|
|
217
|
+
this.resizeObserver = undefined;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
this.resizeObserver.observe(this.hostElement);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
disconnectedCallback() {
|
|
225
|
+
if (this.resizeObserver) {
|
|
226
|
+
this.resizeObserver.disconnect();
|
|
227
|
+
this.resizeObserver = undefined;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
render() {
|
|
231
|
+
// Show placeholder until we've measured the component width
|
|
232
|
+
if (!this.observedWidth) {
|
|
233
|
+
return h("pennlibs-fallback-img", null);
|
|
234
|
+
}
|
|
235
|
+
if (this.hasError && this.showFallback) {
|
|
236
|
+
return (h("div", { class: "fallback-container" }, h("pennlibs-fallback-img", null)));
|
|
237
|
+
}
|
|
238
|
+
const imgClasses = {
|
|
239
|
+
'iiif-img': true,
|
|
240
|
+
'loaded': this.isLoaded
|
|
241
|
+
};
|
|
242
|
+
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 })));
|
|
243
|
+
}
|
|
244
|
+
get hostElement() { return this; }
|
|
245
|
+
static get watchers() { return {
|
|
246
|
+
"region": ["handleRegionChange"]
|
|
247
|
+
}; }
|
|
248
|
+
static get style() { return pennlibsIiifImgCss; }
|
|
249
|
+
}, [257, "pennlibs-iiif-img", {
|
|
250
|
+
"uuid": [1],
|
|
251
|
+
"alt": [1],
|
|
252
|
+
"region": [513],
|
|
253
|
+
"rotation": [1],
|
|
254
|
+
"quality": [1],
|
|
255
|
+
"loading": [1],
|
|
256
|
+
"showFallback": [4, "show-fallback"],
|
|
257
|
+
"isLoaded": [32],
|
|
258
|
+
"hasError": [32],
|
|
259
|
+
"imageDimensions": [32],
|
|
260
|
+
"observedWidth": [32]
|
|
261
|
+
}, undefined, {
|
|
262
|
+
"region": ["handleRegionChange"]
|
|
263
|
+
}]);
|
|
264
|
+
function defineCustomElement$1() {
|
|
265
|
+
if (typeof customElements === "undefined") {
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
const components = ["pennlibs-iiif-img", "pennlibs-fallback-img"];
|
|
269
|
+
components.forEach(tagName => { switch (tagName) {
|
|
270
|
+
case "pennlibs-iiif-img":
|
|
271
|
+
if (!customElements.get(tagName)) {
|
|
272
|
+
customElements.define(tagName, IIIFImg);
|
|
273
|
+
}
|
|
274
|
+
break;
|
|
275
|
+
case "pennlibs-fallback-img":
|
|
276
|
+
if (!customElements.get(tagName)) {
|
|
277
|
+
defineCustomElement$2();
|
|
278
|
+
}
|
|
279
|
+
break;
|
|
280
|
+
} });
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
const PennlibsIiifImg = IIIFImg;
|
|
284
|
+
const defineCustomElement = defineCustomElement$1;
|
|
285
|
+
|
|
286
|
+
export { PennlibsIiifImg, defineCustomElement };
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AE,IAAI,CAAC;SAChB;QAED,QACE,CAAA,CAAA,SAAA,EAAA,IAAA,EACE,CAAA,CAAA,QAAA,EAAA,EACE,IAAI,EAAC,YAAY,EACjB,MAAM,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,EACvD,CAAA,EAEF,CACE,CAAA,KAAA,EAAA,EAAA,KAAK,EAAE,UAAU,EACjB,GAAG,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,EACjD,MAAM,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,EACtD,GAAG,EAAE,IAAI,CAAC,GAAG,EACb,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,MAAM,EAAE,IAAI,CAAC,UAAU,EACvB,OAAO,EAAE,IAAI,CAAC,WAAW,EAAA,CACzB,CACM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["__stencil_proxyCustomElement"],"sources":["src/components/pennlibs-iiif-img/pennlibs-iiif-img.css?tag=pennlibs-iiif-img&encapsulation=shadow","src/components/pennlibs-iiif-img/pennlibs-iiif-img.tsx"],"sourcesContent":[":host {\n display: block;\n width: 100%;\n max-width: 100%;\n align-self: flex-start;\n aspect-ratio: var(--aspect-ratio, auto);\n}\n\npicture {\n display: block;\n line-height: 0;\n}\n\n.iiif-img {\n display: block;\n width: 100%;\n max-width: 100%;\n height: auto;\n opacity: 0;\n filter: blur(5px);\n transition: opacity 0.15s ease-in, filter 0.15s ease-in;\n}\n\n.iiif-img.loaded {\n opacity: 1;\n filter: blur(0);\n}\n\n.fallback-container {\n display: block;\n width: 100%;\n height: 100%;\n}\n\n.fallback-container pennlibs-fallback-img {\n width: 100%;\n height: 100%;\n}\n\npennlibs-fallback-img {\n display: block;\n width: 100%;\n height: 100%;\n}\n","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"],"version":3}
|
package/dist/docs.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"timestamp": "2025-11-
|
|
2
|
+
"timestamp": "2025-11-21T15:30:56",
|
|
3
3
|
"compiler": {
|
|
4
4
|
"name": "@stencil/core",
|
|
5
5
|
"version": "4.38.1",
|
|
@@ -177,9 +177,15 @@
|
|
|
177
177
|
"styles": [],
|
|
178
178
|
"slots": [],
|
|
179
179
|
"parts": [],
|
|
180
|
-
"dependents": [
|
|
180
|
+
"dependents": [
|
|
181
|
+
"pennlibs-iiif-img"
|
|
182
|
+
],
|
|
181
183
|
"dependencies": [],
|
|
182
|
-
"dependencyGraph": {
|
|
184
|
+
"dependencyGraph": {
|
|
185
|
+
"pennlibs-iiif-img": [
|
|
186
|
+
"pennlibs-fallback-img"
|
|
187
|
+
]
|
|
188
|
+
}
|
|
183
189
|
},
|
|
184
190
|
{
|
|
185
191
|
"filePath": "src/components/pennlibs-feedback/pennlibs-feedback.tsx",
|
|
@@ -457,6 +463,236 @@
|
|
|
457
463
|
"dependents": [],
|
|
458
464
|
"dependencies": [],
|
|
459
465
|
"dependencyGraph": {}
|
|
466
|
+
},
|
|
467
|
+
{
|
|
468
|
+
"filePath": "src/components/pennlibs-iiif-img/pennlibs-iiif-img.tsx",
|
|
469
|
+
"encapsulation": "shadow",
|
|
470
|
+
"tag": "pennlibs-iiif-img",
|
|
471
|
+
"readme": "# pennlibs-iiif-img\n\n\n",
|
|
472
|
+
"docs": "Display responsive, high-quality images from Penn Libraries' IIIF Image API 3.0 server.\nMeasures its own rendered width and automatically generates optimal image sources at\nmultiple pixel densities (1x, 1.5x, 2x) with modern WebP format and JPG fallback support.",
|
|
473
|
+
"docsTags": [
|
|
474
|
+
{
|
|
475
|
+
"name": "component"
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
"name": "example",
|
|
479
|
+
"text": "<pennlibs-iiif-img\n uuid=\"063ff35c-bbdd-4b63-bbdd-6206590e20d5\"\n alt=\"\">\n</pennlibs-iiif-img>"
|
|
480
|
+
}
|
|
481
|
+
],
|
|
482
|
+
"usage": {},
|
|
483
|
+
"props": [
|
|
484
|
+
{
|
|
485
|
+
"name": "alt",
|
|
486
|
+
"type": "string",
|
|
487
|
+
"complexType": {
|
|
488
|
+
"original": "string",
|
|
489
|
+
"resolved": "string",
|
|
490
|
+
"references": {}
|
|
491
|
+
},
|
|
492
|
+
"mutable": false,
|
|
493
|
+
"attr": "alt",
|
|
494
|
+
"reflectToAttr": false,
|
|
495
|
+
"docs": "Alternative text that describes the image content for screen readers and when images fail to load.\nUse an empty string for purely decorative images.",
|
|
496
|
+
"docsTags": [],
|
|
497
|
+
"values": [
|
|
498
|
+
{
|
|
499
|
+
"type": "string"
|
|
500
|
+
}
|
|
501
|
+
],
|
|
502
|
+
"optional": false,
|
|
503
|
+
"required": true,
|
|
504
|
+
"getter": false,
|
|
505
|
+
"setter": false
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
"name": "loading",
|
|
509
|
+
"type": "\"eager\" | \"lazy\"",
|
|
510
|
+
"complexType": {
|
|
511
|
+
"original": "'lazy' | 'eager'",
|
|
512
|
+
"resolved": "\"eager\" | \"lazy\"",
|
|
513
|
+
"references": {}
|
|
514
|
+
},
|
|
515
|
+
"mutable": false,
|
|
516
|
+
"attr": "loading",
|
|
517
|
+
"reflectToAttr": false,
|
|
518
|
+
"docs": "Native browser lazy loading behavior. Use \"lazy\" to defer loading until the image is near the viewport,\nor \"eager\" to load immediately.",
|
|
519
|
+
"docsTags": [
|
|
520
|
+
{
|
|
521
|
+
"name": "default",
|
|
522
|
+
"text": "'lazy'"
|
|
523
|
+
}
|
|
524
|
+
],
|
|
525
|
+
"default": "'lazy'",
|
|
526
|
+
"values": [
|
|
527
|
+
{
|
|
528
|
+
"value": "eager",
|
|
529
|
+
"type": "string"
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
"value": "lazy",
|
|
533
|
+
"type": "string"
|
|
534
|
+
}
|
|
535
|
+
],
|
|
536
|
+
"optional": true,
|
|
537
|
+
"required": false,
|
|
538
|
+
"getter": false,
|
|
539
|
+
"setter": false
|
|
540
|
+
},
|
|
541
|
+
{
|
|
542
|
+
"name": "quality",
|
|
543
|
+
"type": "string",
|
|
544
|
+
"complexType": {
|
|
545
|
+
"original": "string",
|
|
546
|
+
"resolved": "string",
|
|
547
|
+
"references": {}
|
|
548
|
+
},
|
|
549
|
+
"mutable": false,
|
|
550
|
+
"attr": "quality",
|
|
551
|
+
"reflectToAttr": false,
|
|
552
|
+
"docs": "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.",
|
|
553
|
+
"docsTags": [
|
|
554
|
+
{
|
|
555
|
+
"name": "default",
|
|
556
|
+
"text": "'default'"
|
|
557
|
+
}
|
|
558
|
+
],
|
|
559
|
+
"default": "'default'",
|
|
560
|
+
"values": [
|
|
561
|
+
{
|
|
562
|
+
"type": "string"
|
|
563
|
+
}
|
|
564
|
+
],
|
|
565
|
+
"optional": true,
|
|
566
|
+
"required": false,
|
|
567
|
+
"getter": false,
|
|
568
|
+
"setter": false
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
"name": "region",
|
|
572
|
+
"type": "string",
|
|
573
|
+
"complexType": {
|
|
574
|
+
"original": "string",
|
|
575
|
+
"resolved": "string",
|
|
576
|
+
"references": {}
|
|
577
|
+
},
|
|
578
|
+
"mutable": false,
|
|
579
|
+
"attr": "region",
|
|
580
|
+
"reflectToAttr": true,
|
|
581
|
+
"docs": "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.",
|
|
582
|
+
"docsTags": [
|
|
583
|
+
{
|
|
584
|
+
"name": "default",
|
|
585
|
+
"text": "'full'"
|
|
586
|
+
}
|
|
587
|
+
],
|
|
588
|
+
"default": "'full'",
|
|
589
|
+
"values": [
|
|
590
|
+
{
|
|
591
|
+
"type": "string"
|
|
592
|
+
}
|
|
593
|
+
],
|
|
594
|
+
"optional": true,
|
|
595
|
+
"required": false,
|
|
596
|
+
"getter": false,
|
|
597
|
+
"setter": false
|
|
598
|
+
},
|
|
599
|
+
{
|
|
600
|
+
"name": "rotation",
|
|
601
|
+
"type": "string",
|
|
602
|
+
"complexType": {
|
|
603
|
+
"original": "string",
|
|
604
|
+
"resolved": "string",
|
|
605
|
+
"references": {}
|
|
606
|
+
},
|
|
607
|
+
"mutable": false,
|
|
608
|
+
"attr": "rotation",
|
|
609
|
+
"reflectToAttr": false,
|
|
610
|
+
"docs": "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.",
|
|
611
|
+
"docsTags": [
|
|
612
|
+
{
|
|
613
|
+
"name": "default",
|
|
614
|
+
"text": "'0'"
|
|
615
|
+
}
|
|
616
|
+
],
|
|
617
|
+
"default": "'0'",
|
|
618
|
+
"values": [
|
|
619
|
+
{
|
|
620
|
+
"type": "string"
|
|
621
|
+
}
|
|
622
|
+
],
|
|
623
|
+
"optional": true,
|
|
624
|
+
"required": false,
|
|
625
|
+
"getter": false,
|
|
626
|
+
"setter": false
|
|
627
|
+
},
|
|
628
|
+
{
|
|
629
|
+
"name": "showFallback",
|
|
630
|
+
"type": "boolean",
|
|
631
|
+
"complexType": {
|
|
632
|
+
"original": "boolean",
|
|
633
|
+
"resolved": "boolean",
|
|
634
|
+
"references": {}
|
|
635
|
+
},
|
|
636
|
+
"mutable": false,
|
|
637
|
+
"attr": "show-fallback",
|
|
638
|
+
"reflectToAttr": false,
|
|
639
|
+
"docs": "Whether to display a fallback placeholder image when the IIIF image fails to load.",
|
|
640
|
+
"docsTags": [
|
|
641
|
+
{
|
|
642
|
+
"name": "default",
|
|
643
|
+
"text": "true"
|
|
644
|
+
}
|
|
645
|
+
],
|
|
646
|
+
"default": "true",
|
|
647
|
+
"values": [
|
|
648
|
+
{
|
|
649
|
+
"type": "boolean"
|
|
650
|
+
}
|
|
651
|
+
],
|
|
652
|
+
"optional": true,
|
|
653
|
+
"required": false,
|
|
654
|
+
"getter": false,
|
|
655
|
+
"setter": false
|
|
656
|
+
},
|
|
657
|
+
{
|
|
658
|
+
"name": "uuid",
|
|
659
|
+
"type": "string",
|
|
660
|
+
"complexType": {
|
|
661
|
+
"original": "string",
|
|
662
|
+
"resolved": "string",
|
|
663
|
+
"references": {}
|
|
664
|
+
},
|
|
665
|
+
"mutable": false,
|
|
666
|
+
"attr": "uuid",
|
|
667
|
+
"reflectToAttr": false,
|
|
668
|
+
"docs": "The IIIF [UUID identifier](https://iiif.io/api/image/3.0/#3-identifier) of the image resource on the Penn Libraries IIIF server.",
|
|
669
|
+
"docsTags": [],
|
|
670
|
+
"values": [
|
|
671
|
+
{
|
|
672
|
+
"type": "string"
|
|
673
|
+
}
|
|
674
|
+
],
|
|
675
|
+
"optional": false,
|
|
676
|
+
"required": true,
|
|
677
|
+
"getter": false,
|
|
678
|
+
"setter": false
|
|
679
|
+
}
|
|
680
|
+
],
|
|
681
|
+
"methods": [],
|
|
682
|
+
"events": [],
|
|
683
|
+
"listeners": [],
|
|
684
|
+
"styles": [],
|
|
685
|
+
"slots": [],
|
|
686
|
+
"parts": [],
|
|
687
|
+
"dependents": [],
|
|
688
|
+
"dependencies": [
|
|
689
|
+
"pennlibs-fallback-img"
|
|
690
|
+
],
|
|
691
|
+
"dependencyGraph": {
|
|
692
|
+
"pennlibs-iiif-img": [
|
|
693
|
+
"pennlibs-fallback-img"
|
|
694
|
+
]
|
|
695
|
+
}
|
|
460
696
|
}
|
|
461
697
|
],
|
|
462
698
|
"typeLibrary": {
|