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

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 (61) hide show
  1. package/dist/cjs/{index-4ixBJUwu.js → index-C0qvW4Ra.js} +7 -2
  2. package/dist/cjs/index-C0qvW4Ra.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_3.cjs.entry.js +1 -1
  6. package/dist/cjs/pennlibs-banner.cjs.entry.js +1 -1
  7. package/dist/cjs/pennlibs-chat.cjs.entry.js +1 -1
  8. package/dist/cjs/pennlibs-fallback-img.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/pennlibs-iiif-img.cjs.entry.js +132 -0
  12. package/dist/cjs/pennlibs-iiif-img.entry.cjs.js.map +1 -0
  13. package/dist/cjs/web.cjs.js +2 -2
  14. package/dist/collection/collection-manifest.json +2 -1
  15. package/dist/collection/components/pennlibs-iiif-img/pennlibs-iiif-img.css +37 -0
  16. package/dist/collection/components/pennlibs-iiif-img/pennlibs-iiif-img.js +310 -0
  17. package/dist/collection/components/pennlibs-iiif-img/pennlibs-iiif-img.js.map +1 -0
  18. package/dist/components/index.d.ts +2 -0
  19. package/dist/components/index.js +1 -0
  20. package/dist/components/index.js.map +1 -1
  21. package/dist/components/pennlibs-fallback-img.js +1 -32
  22. package/dist/components/pennlibs-fallback-img.js.map +1 -1
  23. package/dist/components/pennlibs-fallback-img2.js +37 -0
  24. package/dist/components/pennlibs-fallback-img2.js.map +1 -0
  25. package/dist/components/pennlibs-iiif-img.d.ts +11 -0
  26. package/dist/components/pennlibs-iiif-img.js +168 -0
  27. package/dist/components/pennlibs-iiif-img.js.map +1 -0
  28. package/dist/docs.json +239 -3
  29. package/dist/{web/p-Di48-Vtw.js → esm/index-D9dYrmUF.js} +7 -2
  30. package/dist/esm/index-D9dYrmUF.js.map +1 -0
  31. package/dist/esm/index.js +1 -1
  32. package/dist/esm/loader.js +3 -3
  33. package/dist/esm/pennlibs-autocomplete_3.entry.js +1 -1
  34. package/dist/esm/pennlibs-banner.entry.js +1 -1
  35. package/dist/esm/pennlibs-chat.entry.js +1 -1
  36. package/dist/esm/pennlibs-fallback-img.entry.js +1 -1
  37. package/dist/esm/pennlibs-feedback.entry.js +1 -1
  38. package/dist/esm/pennlibs-hero.entry.js +1 -1
  39. package/dist/esm/pennlibs-iiif-img.entry.js +130 -0
  40. package/dist/esm/pennlibs-iiif-img.entry.js.map +1 -0
  41. package/dist/esm/web.js +3 -3
  42. package/dist/types/components/pennlibs-iiif-img/pennlibs-iiif-img.d.ts +89 -0
  43. package/dist/types/components.d.ts +119 -0
  44. package/dist/web/index.esm.js +1 -1
  45. package/dist/web/{p-7cbd16c0.entry.js → p-43d9c2d4.entry.js} +1 -1
  46. package/dist/{esm/index-Di48-Vtw.js → web/p-D9dYrmUF.js} +7 -2
  47. package/dist/web/p-D9dYrmUF.js.map +1 -0
  48. package/dist/web/{p-783e2a87.entry.js → p-ad92090a.entry.js} +1 -1
  49. package/dist/web/{p-56b9f10c.entry.js → p-b4b58af0.entry.js} +1 -1
  50. package/dist/web/p-c4074cf1.entry.js +130 -0
  51. package/dist/web/{p-6503bb09.entry.js → p-cb2584da.entry.js} +1 -1
  52. package/dist/web/{p-09e4a02c.entry.js → p-ce97059c.entry.js} +1 -1
  53. package/dist/web/{p-269363bf.entry.js → p-e6188c30.entry.js} +1 -1
  54. package/dist/web/pennlibs-iiif-img.entry.esm.js.map +1 -0
  55. package/dist/web/web.esm.js +3 -3
  56. package/hydrate/index.js +162 -0
  57. package/hydrate/index.mjs +162 -0
  58. package/package.json +1 -1
  59. package/dist/cjs/index-4ixBJUwu.js.map +0 -1
  60. package/dist/esm/index-Di48-Vtw.js.map +0 -1
  61. package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,GAAG,EACb,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,MAAM,EAAE,IAAI,CAAC,UAAU,EACvB,OAAO,EAAE,IAAI,CAAC,WAAW,GACzB,CACM,CACX,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, State, Element } from '@stencil/core';\n\ntype ImageFormat = 'jpg' | 'webp';\n\nconst PIXEL_DENSITY_MULTIPLIERS = [0.5, 0.75, 1, 1.5, 2] as const;\nconst DEFAULT_IMAGE_SIZES = [400, 600, 800, 1200, 1600, 2400] as const;\n\n/**\n * Display responsive, high-quality images from Penn Libraries' IIIF Image API 3.0 server.\n * Automatically generates optimal image sources for different viewport sizes and pixel densities,\n * 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 * `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() 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\n private observedWidth?: number;\n\n private readonly baseUrl = 'https://iiif-images.library.upenn.edu/iiif/3';\n\n private buildIIIFUrl(width?: number, format: ImageFormat = 'jpg'): string {\n const sizeParam = width ? `${width},` : 'max';\n return `${this.baseUrl}/${this.uuid}/${this.region}/${sizeParam}/${this.rotation}/${this.quality}.${format}`;\n }\n\n private generateSrcset(sizes: number[], format: ImageFormat): string {\n const uniqueSizes = [...new Set(sizes)].sort((a, b) => a - b);\n\n const srcsetEntries = uniqueSizes.map(size => {\n const url = this.buildIIIFUrl(size, format);\n return `${url} ${size}w`;\n });\n\n return srcsetEntries.join(', ');\n }\n\n private getOptimalSizes(): number[] {\n if (this.observedWidth) {\n const baseSizes = PIXEL_DENSITY_MULTIPLIERS.map(multiplier =>\n Math.round(this.observedWidth! * multiplier)\n );\n\n return baseSizes;\n }\n\n return [...DEFAULT_IMAGE_SIZES];\n }\n\n private handleLoad = () => {\n this.isLoaded = true;\n };\n\n private handleError = () => {\n this.hasError = true;\n };\n\n componentDidLoad() {\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 // Trigger re-render with optimized sizes\n this.isLoaded = this.isLoaded;\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 const sizes = this.getOptimalSizes();\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 const defaultSize = sizes[0];\n\n return (\n <picture>\n <source\n type=\"image/webp\"\n srcSet={this.generateSrcset(sizes, 'webp')}\n sizes=\"100vw\"\n />\n\n <img\n class={imgClasses}\n src={this.buildIIIFUrl(defaultSize, 'jpg')}\n srcSet={this.generateSrcset(sizes, 'jpg')}\n sizes=\"100vw\"\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;
@@ -0,0 +1,168 @@
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%}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:auto;min-height:200px}.fallback-container pennlibs-fallback-img{width:100%;height:100%}";
5
+
6
+ const PIXEL_DENSITY_MULTIPLIERS = [0.5, 0.75, 1, 1.5, 2];
7
+ const DEFAULT_IMAGE_SIZES = [400, 600, 800, 1200, 1600, 2400];
8
+ const IIIFImg = /*@__PURE__*/ proxyCustomElement(class IIIFImg extends HTMLElement {
9
+ constructor(registerHost) {
10
+ super();
11
+ if (registerHost !== false) {
12
+ this.__registerHost();
13
+ }
14
+ this.__attachShadow();
15
+ /**
16
+ * The IIIF [region](https://iiif.io/api/image/3.0/#41-region) of the image to display.
17
+ * Defines the rectangular portion of the underlying image to return.
18
+ *
19
+ * `full`: The full image is returned, without any cropping.
20
+ *
21
+ * `square`: A square area where width and height equal the shorter dimension.
22
+ *
23
+ * `x,y,w,h`: Absolute pixel coordinates (x, y position; w, h dimensions).
24
+ *
25
+ * `pct:x,y,w,h`: Percentage-based coordinates of full image dimensions.
26
+ *
27
+ * @default 'full'
28
+ */
29
+ this.region = 'full';
30
+ /**
31
+ * The IIIF [rotation](https://iiif.io/api/image/3.0/#44-rotation) to apply to the image.
32
+ * Specifies mirroring and clockwise rotation in degrees (0-360).
33
+ *
34
+ * `n`: Rotation in degrees only.
35
+ *
36
+ * `!n`: Mirror the image vertically, then rotate by n degrees.
37
+ *
38
+ * @default '0'
39
+ */
40
+ this.rotation = '0';
41
+ /**
42
+ * The IIIF [quality](https://iiif.io/api/image/3.0/#quality) of the image.
43
+ * Controls the color delivery mode.
44
+ *
45
+ * `default`: The server's default quality.
46
+ *
47
+ * `color`: Full color information.
48
+ *
49
+ * `gray`: Grayscale rendering.
50
+ *
51
+ * `bitonal`: Black and white only.
52
+ *
53
+ * @default 'default'
54
+ */
55
+ this.quality = 'default';
56
+ /**
57
+ * Native browser lazy loading behavior. Use "lazy" to defer loading until the image is near the viewport,
58
+ * or "eager" to load immediately.
59
+ * @default 'lazy'
60
+ */
61
+ this.loading = 'lazy';
62
+ /**
63
+ * Whether to display a fallback placeholder image when the IIIF image fails to load.
64
+ * @default true
65
+ */
66
+ this.showFallback = true;
67
+ this.isLoaded = false;
68
+ this.hasError = false;
69
+ this.baseUrl = 'https://iiif-images.library.upenn.edu/iiif/3';
70
+ this.handleLoad = () => {
71
+ this.isLoaded = true;
72
+ };
73
+ this.handleError = () => {
74
+ this.hasError = true;
75
+ };
76
+ }
77
+ buildIIIFUrl(width, format = 'jpg') {
78
+ const sizeParam = width ? `${width},` : 'max';
79
+ return `${this.baseUrl}/${this.uuid}/${this.region}/${sizeParam}/${this.rotation}/${this.quality}.${format}`;
80
+ }
81
+ generateSrcset(sizes, format) {
82
+ const uniqueSizes = [...new Set(sizes)].sort((a, b) => a - b);
83
+ const srcsetEntries = uniqueSizes.map(size => {
84
+ const url = this.buildIIIFUrl(size, format);
85
+ return `${url} ${size}w`;
86
+ });
87
+ return srcsetEntries.join(', ');
88
+ }
89
+ getOptimalSizes() {
90
+ if (this.observedWidth) {
91
+ const baseSizes = PIXEL_DENSITY_MULTIPLIERS.map(multiplier => Math.round(this.observedWidth * multiplier));
92
+ return baseSizes;
93
+ }
94
+ return [...DEFAULT_IMAGE_SIZES];
95
+ }
96
+ componentDidLoad() {
97
+ if ('ResizeObserver' in window) {
98
+ this.resizeObserver = new ResizeObserver(entries => {
99
+ for (const entry of entries) {
100
+ this.observedWidth = Math.round(entry.contentRect.width);
101
+ if (this.resizeObserver) {
102
+ this.resizeObserver.disconnect();
103
+ this.resizeObserver = undefined;
104
+ }
105
+ // Trigger re-render with optimized sizes
106
+ this.isLoaded = this.isLoaded;
107
+ }
108
+ });
109
+ this.resizeObserver.observe(this.hostElement);
110
+ }
111
+ }
112
+ disconnectedCallback() {
113
+ if (this.resizeObserver) {
114
+ this.resizeObserver.disconnect();
115
+ this.resizeObserver = undefined;
116
+ }
117
+ }
118
+ render() {
119
+ const sizes = this.getOptimalSizes();
120
+ if (this.hasError && this.showFallback) {
121
+ return (h("div", { class: "fallback-container" }, h("pennlibs-fallback-img", null)));
122
+ }
123
+ const imgClasses = {
124
+ 'iiif-img': true,
125
+ 'loaded': this.isLoaded
126
+ };
127
+ const defaultSize = sizes[0];
128
+ return (h("picture", null, h("source", { type: "image/webp", srcSet: this.generateSrcset(sizes, 'webp'), sizes: "100vw" }), h("img", { class: imgClasses, src: this.buildIIIFUrl(defaultSize, 'jpg'), srcSet: this.generateSrcset(sizes, 'jpg'), sizes: "100vw", alt: this.alt, loading: this.loading, onLoad: this.handleLoad, onError: this.handleError })));
129
+ }
130
+ get hostElement() { return this; }
131
+ static get style() { return pennlibsIiifImgCss; }
132
+ }, [257, "pennlibs-iiif-img", {
133
+ "uuid": [1],
134
+ "alt": [1],
135
+ "region": [1],
136
+ "rotation": [1],
137
+ "quality": [1],
138
+ "loading": [1],
139
+ "showFallback": [4, "show-fallback"],
140
+ "isLoaded": [32],
141
+ "hasError": [32]
142
+ }]);
143
+ function defineCustomElement$1() {
144
+ if (typeof customElements === "undefined") {
145
+ return;
146
+ }
147
+ const components = ["pennlibs-iiif-img", "pennlibs-fallback-img"];
148
+ components.forEach(tagName => { switch (tagName) {
149
+ case "pennlibs-iiif-img":
150
+ if (!customElements.get(tagName)) {
151
+ customElements.define(tagName, IIIFImg);
152
+ }
153
+ break;
154
+ case "pennlibs-fallback-img":
155
+ if (!customElements.get(tagName)) {
156
+ defineCustomElement$2();
157
+ }
158
+ break;
159
+ } });
160
+ }
161
+
162
+ const PennlibsIiifImg = IIIFImg;
163
+ const defineCustomElement = defineCustomElement$1;
164
+
165
+ export { PennlibsIiifImg, defineCustomElement };
166
+ //# sourceMappingURL=pennlibs-iiif-img.js.map
167
+
168
+ //# sourceMappingURL=pennlibs-iiif-img.js.map
@@ -0,0 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,EACb,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}\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: auto;\n min-height: 200px;\n}\n\n.fallback-container pennlibs-fallback-img {\n width: 100%;\n height: 100%;\n}\n","import { Component, h, Prop, State, Element } from '@stencil/core';\n\ntype ImageFormat = 'jpg' | 'webp';\n\nconst PIXEL_DENSITY_MULTIPLIERS = [0.5, 0.75, 1, 1.5, 2] as const;\nconst DEFAULT_IMAGE_SIZES = [400, 600, 800, 1200, 1600, 2400] as const;\n\n/**\n * Display responsive, high-quality images from Penn Libraries' IIIF Image API 3.0 server.\n * Automatically generates optimal image sources for different viewport sizes and pixel densities,\n * 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 * `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() 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\n private observedWidth?: number;\n\n private readonly baseUrl = 'https://iiif-images.library.upenn.edu/iiif/3';\n\n private buildIIIFUrl(width?: number, format: ImageFormat = 'jpg'): string {\n const sizeParam = width ? `${width},` : 'max';\n return `${this.baseUrl}/${this.uuid}/${this.region}/${sizeParam}/${this.rotation}/${this.quality}.${format}`;\n }\n\n private generateSrcset(sizes: number[], format: ImageFormat): string {\n const uniqueSizes = [...new Set(sizes)].sort((a, b) => a - b);\n\n const srcsetEntries = uniqueSizes.map(size => {\n const url = this.buildIIIFUrl(size, format);\n return `${url} ${size}w`;\n });\n\n return srcsetEntries.join(', ');\n }\n\n private getOptimalSizes(): number[] {\n if (this.observedWidth) {\n const baseSizes = PIXEL_DENSITY_MULTIPLIERS.map(multiplier =>\n Math.round(this.observedWidth! * multiplier)\n );\n\n return baseSizes;\n }\n\n return [...DEFAULT_IMAGE_SIZES];\n }\n\n private handleLoad = () => {\n this.isLoaded = true;\n };\n\n private handleError = () => {\n this.hasError = true;\n };\n\n componentDidLoad() {\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 // Trigger re-render with optimized sizes\n this.isLoaded = this.isLoaded;\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 const sizes = this.getOptimalSizes();\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 const defaultSize = sizes[0];\n\n return (\n <picture>\n <source\n type=\"image/webp\"\n srcSet={this.generateSrcset(sizes, 'webp')}\n sizes=\"100vw\"\n />\n\n <img\n class={imgClasses}\n src={this.buildIIIFUrl(defaultSize, 'jpg')}\n srcSet={this.generateSrcset(sizes, 'jpg')}\n sizes=\"100vw\"\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-13T21:27:12",
2
+ "timestamp": "2025-11-20T21:55:55",
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.\nAutomatically generates optimal image sources for different viewport sizes and pixel densities,\nwith 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": false,
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`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": {
@@ -1107,6 +1107,11 @@ var parsePropertyValue = (propValue, propType, isFormAssociated) => {
1107
1107
  return propValue;
1108
1108
  }
1109
1109
  if (propValue != null && !isComplexType(propValue)) {
1110
+ if (propType & 4 /* Boolean */) {
1111
+ {
1112
+ return propValue === "false" ? false : propValue === "" || !!propValue;
1113
+ }
1114
+ }
1110
1115
  if (propType & 1 /* String */) {
1111
1116
  return String(propValue);
1112
1117
  }
@@ -2210,6 +2215,6 @@ var hostListenerOpts = (flags) => supportsListenerOptions ? {
2210
2215
  var setNonce = (nonce) => plt.$nonce$ = nonce;
2211
2216
 
2212
2217
  export { getAssetPath as a, bootstrapLazy as b, createEvent as c, getElement as d, setAssetPath as e, globalScripts as g, h, promiseResolve as p, registerInstance as r, setNonce as s };
2213
- //# sourceMappingURL=p-Di48-Vtw.js.map
2218
+ //# sourceMappingURL=index-D9dYrmUF.js.map
2214
2219
 
2215
- //# sourceMappingURL=p-Di48-Vtw.js.map
2220
+ //# sourceMappingURL=index-D9dYrmUF.js.map