@internetarchive/elements 1.1.0 → 1.1.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.
- package/dist/src/elements/ia-image-viewer/ia-image-viewer.d.ts.map +1 -1
- package/dist/src/elements/ia-image-viewer/ia-image-viewer.js +0 -7
- package/dist/src/elements/ia-image-viewer/ia-image-viewer.js.map +1 -1
- package/dist/src/elements/ia-image-viewer/ia-imgview-controls.d.ts +11 -4
- package/dist/src/elements/ia-image-viewer/ia-imgview-controls.d.ts.map +1 -1
- package/dist/src/elements/ia-image-viewer/ia-imgview-controls.js +39 -23
- package/dist/src/elements/ia-image-viewer/ia-imgview-controls.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ia-image-viewer.d.ts","sourceRoot":"","sources":["../../../../src/elements/ia-image-viewer/ia-image-viewer.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EAEnB,UAAU,EACV,OAAO,EACP,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,KAAK,CAAC;AAUb,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAY,MAAM,UAAU,CAAC;AAE3E,OAAO,oBAAoB,CAAC;AAC5B,OAAO,uBAAuB,CAAC;AAK/B;;;;;;;;;;;;;;;;;GAiBG;AACH,qBACa,aAAc,SAAQ,UAAU;IAChB,MAAM,EAAE,gBAAgB,EAAE,CAAM;IAE3D;;;OAGG;IACyB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAEtD,uEAAuE;IACjD,SAAS,CAAC,EAAE,WAAW,CAAC;IAE9C,yEAAyE;IAClD,UAAU,CAAC,EAAE,WAAW,CAAC;IAEhD,gFAAgF;IACvE,YAAY,SAAK;IAEjB,OAAO,CAAC,SAAS,CAAS;IAEnC;;;;OAIG;IACM,OAAO,CAAC,eAAe,CAAK;IAErC,kEAAkE;IACzD,OAAO,CAAC,QAAQ,CAA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G;IACH,OAAO,CAAC,gBAAgB;IAcxB;;;;;OAKG;IACH,gBAAgB,IAAI,IAAI;IAgBxB,gBAAgB,IAAI,IAAI;IAOxB,OAAO,CAAC,eAAe;IASvB,QAAQ,IAAI,IAAI;IAKhB,YAAY,IAAI,IAAI;IAQpB;;;;OAIG;IACH,OAAO,CAAC,MAAM;IAmBd;;;OAGG;IACH,UAAU,CAAC,SAAS,EAAE,cAAc,GAAG,IAAI;IAc3C;;;;OAIG;IACH,iBAAiB,IAAI,IAAI;IAMzB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,UAAU;IAMlB,8CAA8C;IAC9C,OAAO,CAAC,oBAAoB;IAS5B,OAAO,CAAC,gBAAgB;IAUxB;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IAI7B;;;;;;;;;OASG;IACH,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAUvC,MAAM,KAAK,MAAM,IAAI,cAAc,CAyIlC;CACF"}
|
|
@@ -370,13 +370,6 @@ let IAImageViewer = class IAImageViewer extends LitElement {
|
|
|
370
370
|
--image-viewer-glow-color,
|
|
371
371
|
rgba(255, 255, 255, 0.25)
|
|
372
372
|
);
|
|
373
|
-
/*
|
|
374
|
-
* The breakpoint the controls query against. Named so the query in
|
|
375
|
-
* ia-imgview-controls resolves to this host rather than to whatever
|
|
376
|
-
* container the consumer happens to have further up.
|
|
377
|
-
*/
|
|
378
|
-
container: image-viewer / inline-size;
|
|
379
|
-
|
|
380
373
|
/*
|
|
381
374
|
* Size and placement are the host's business, set with ordinary CSS
|
|
382
375
|
* on the element. These are only defaults for a host that sets
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ia-image-viewer.js","sourceRoot":"","sources":["../../../../src/elements/ia-image-viewer/ia-image-viewer.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,GAAG,EAEH,IAAI,EACJ,UAAU,EACV,OAAO,GAGR,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,QAA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AAK,EAAE;gDAA2B;AAOlB;IAAhB,KAAK,EAAE;sDAA6B;AAGpB;IAAhB,KAAK,EAAE;+CAA0C;AA5BvC,aAAa;IADzB,aAAa,CAAC,iBAAiB,CAAC;GACpB,aAAa,CA4iBzB","sourcesContent":["import {\n css,\n type CSSResultGroup,\n html,\n LitElement,\n nothing,\n type PropertyValues,\n type TemplateResult,\n} from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { customElement } from '@src/util/custom-element';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { keyed } from 'lit/directives/keyed.js';\nimport { msg, str } from '@lit/localize';\n\nimport themeStyles from '@src/themes/theme-styles';\nimport { prefersReducedMotion } from '@src/util/prefers-reduced-motion';\nimport { ImageViewerGestures } from './image-viewer-gestures';\nimport type { ImageViewerImage, SlideDirection, WrapEdge } from './models';\nimport type { IAImageViewerSlide } from './ia-imgview-slide';\nimport './ia-imgview-slide';\nimport './ia-imgview-controls';\n\n/** Detail carried by the load and failure events a slide reports. */\ntype SlideImageEvent = CustomEvent<{ image: ImageViewerImage }>;\n\n/**\n * A swipeable image carousel.\n *\n * Shows one image at a time from a list, with previous/next buttons, a\n * counter, keyboard arrows, horizontal wheel scrolling and touch swipes.\n * Clicking an image opens it in a new tab.\n *\n * The viewer holds no opinion about where the images came from: it takes a\n * plain list of names and URLs, and reports the image it lands on through\n * `imageChanged` so a host can mirror that into its own URL or analytics.\n *\n * @fires imageChanged - The viewer settled on a new image.\n * @fires imageLoaded - An image the viewer showed finished loading.\n * @fires imageLoadFailed - An image the viewer showed could not be loaded.\n * Fires once per image until it loads successfully or the set changes.\n * @fires imageActivated - An image was clicked. Cancelable: preventing it\n * stops the default of opening the image in a new tab.\n */\n@customElement('ia-image-viewer')\nexport class IAImageViewer extends LitElement {\n @property({ type: Array }) images: ImageViewerImage[] = [];\n\n /**\n * Name of the image to show. Changing it jumps straight to that image\n * without animating. An unknown name shows the first image.\n */\n @property({ type: String }) currentImageName?: string;\n\n /** Read by the gesture controller, which tracks touches against it. */\n @query('.image-area') imageArea?: HTMLElement;\n\n /** Read by the gesture controller, which translates it during a drag. */\n @query('.slide-track') slideTrack?: HTMLElement;\n\n /** Read by the gesture controller to navigate relative to the current image. */\n @state() currentIndex = 0;\n\n @state() private animating = false;\n\n /**\n * Incremented when an animation is interrupted to force the track element to\n * be recreated via the `keyed()` directive, which guarantees the CSS\n * animation restarts even if the direction is the same.\n */\n @state() private slideGeneration = 0;\n\n /** Which edge just wrapped, if any. Drives the glow indicator. */\n @state() private wrapEdge: WrapEdge | null = null;\n\n /**\n * Images already reported as failed, so a broken image isn't counted again\n * every time the viewer passes over it. Navigating back re-fires `error` on\n * the recreated element, and the neighbouring slides staged during an\n * animation or a drag load the same image too, so without this a single\n * broken derivative reports several times a session.\n *\n * Cleared when the image set changes, which is the point a name stops\n * standing for the same file.\n */\n private reportedFailures = new Set<string>();\n\n private slideTarget: number | null = null;\n\n private slideDirection: SlideDirection | null = null;\n\n private gestures = new ImageViewerGestures(this);\n\n get imageCount(): number {\n return this.images.length;\n }\n\n /** The image currently on screen, if there is one. */\n get currentImage(): ImageViewerImage | undefined {\n return this.images[this.currentIndex];\n }\n\n protected willUpdate(changed: PropertyValues): void {\n if (changed.has('images') || changed.has('currentImageName')) {\n const previous = changed.get('images') as ImageViewerImage[] | undefined;\n this.currentIndex = this.indexToShow(changed, previous);\n\n this.animating = false;\n this.slideGeneration = 0;\n this.slideTarget = null;\n this.slideDirection = null;\n this.wrapEdge = null;\n this.reportedFailures.clear();\n this.preloadAdjacentImages();\n }\n }\n\n /**\n * Where to land when the images or the requested name change.\n *\n * A new `currentImageName` is the host asking for a particular image, so it\n * wins. A new `images` array on its own isn't: a host that builds its list\n * in a getter hands over a fresh array on every render, which says nothing\n * about the images having changed. So the viewer holds its place by name and\n * only goes back to the start when the image it was showing is really gone.\n */\n private indexToShow(\n changed: PropertyValues,\n previousImages: ImageViewerImage[] | undefined,\n ): number {\n if (changed.has('currentImageName') && this.currentImageName) {\n const requested = this.images.findIndex(\n (image) => image.name === this.currentImageName,\n );\n if (requested >= 0) return requested;\n }\n\n const showing = previousImages?.[this.currentIndex]?.name;\n if (showing) {\n const stillThere = this.images.findIndex(\n (image) => image.name === showing,\n );\n if (stillThere >= 0) return stillThere;\n }\n\n const named = this.currentImageName\n ? this.images.findIndex((image) => image.name === this.currentImageName)\n : -1;\n return named >= 0 ? named : 0;\n }\n\n render(): TemplateResult | typeof nothing {\n if (this.images.length === 0) return nothing;\n\n const { dragging } = this.gestures;\n const current = this.images[this.currentIndex];\n const showControls = this.images.length > 1;\n\n const trackClasses = {\n 'slide-track': true,\n 'sliding-next':\n this.animating && !dragging && this.slideDirection === 'next',\n 'sliding-prev':\n this.animating && !dragging && this.slideDirection === 'prev',\n dragging,\n };\n\n const prevIndex =\n (this.currentIndex - 1 + this.images.length) % this.images.length;\n const nextIndex = (this.currentIndex + 1) % this.images.length;\n\n const slideTarget =\n this.animating && !dragging && this.slideTarget !== null\n ? this.images[this.slideTarget]\n : null;\n const prevImage = dragging ? this.images[prevIndex] : slideTarget;\n const nextImage = dragging ? this.images[nextIndex] : slideTarget;\n const showPrev =\n dragging || (slideTarget !== null && this.slideDirection === 'prev');\n const showNext =\n dragging || (slideTarget !== null && this.slideDirection === 'next');\n\n const displayIndex =\n this.animating && this.slideTarget !== null\n ? this.slideTarget\n : this.currentIndex;\n\n return html`\n <div class=\"viewer\">\n <div class=\"image-area\">\n ${this.wrapEdge\n ? html`<div\n class=\"wrap-glow ${this.wrapEdge === 'start'\n ? 'glow-start'\n : 'glow-end'}\"\n @animationend=${this.onWrapGlowEnd}\n ></div>`\n : nothing}\n ${keyed(\n this.slideGeneration,\n html`<div\n class=${classMap(trackClasses)}\n @animationend=${this.onSlideEnd}\n @imageLoaded=${this.onImageLoaded}\n @imageFailed=${this.onImageFailed}\n @imageActivated=${this.onImageActivated}\n >\n ${showPrev && prevImage ? this.slideTemplate(prevImage) : nothing}\n ${this.slideTemplate(current)}\n ${showNext && nextImage ? this.slideTemplate(nextImage) : nothing}\n </div>`,\n )}\n </div>\n ${showControls\n ? html`\n <ia-imgview-controls\n .currentIndex=${displayIndex}\n .totalImages=${this.images.length}\n @showPrevious=${this.showPrevious}\n @showNext=${this.showNext}\n ></ia-imgview-controls>\n `\n : nothing}\n ${this.announcementTemplate}\n </div>\n `;\n }\n\n private slideTemplate(image: ImageViewerImage): TemplateResult {\n return html`<ia-imgview-slide .image=${image}></ia-imgview-slide>`;\n }\n\n /**\n * Announces the image to a screen reader, which otherwise gets nothing when\n * the counter and the picture change under it.\n */\n private get announcementTemplate(): TemplateResult {\n const current = this.images[this.currentIndex];\n const position = msg(\n str`Image ${this.currentIndex + 1} of ${this.images.length}`,\n );\n const label = current?.title ?? current?.name;\n return html`\n <div class=\"sr-only\" role=\"status\" aria-live=\"polite\" aria-atomic=\"true\">\n ${label ? `${position}: ${label}` : position}\n </div>\n `;\n }\n\n /**\n * Passes a slide's load result on to the host, which is where reporting\n * belongs. The slide's own events stop at this shadow root, so they're\n * re-dispatched rather than allowed to escape.\n */\n private onImageLoaded(e: SlideImageEvent): void {\n // A load that succeeds clears the failure, so an image that breaks again\n // later is reported again rather than swallowed as a repeat.\n this.reportedFailures.delete(e.detail.image.name);\n this.dispatchEvent(\n new CustomEvent('imageLoaded', { detail: { image: e.detail.image } }),\n );\n }\n\n private onImageFailed(e: SlideImageEvent): void {\n const { image } = e.detail;\n if (this.reportedFailures.has(image.name)) return;\n this.reportedFailures.add(image.name);\n this.dispatchEvent(\n new CustomEvent('imageLoadFailed', { detail: { image } }),\n );\n }\n\n /**\n * Decides whether a click on a slide opens the image.\n *\n * Two things can stop it: the click is the tail end of a swipe, or the host\n * cancels the event to show the image its own way. The slide's event doesn't\n * cross this shadow root, so it's re-raised here for the host to see, and a\n * veto is passed back down to cancel the click.\n */\n private onImageActivated(e: SlideImageEvent): void {\n if (this.gestures.consumeSwipeTap()) {\n e.preventDefault();\n return;\n }\n const allowed = this.dispatchEvent(\n new CustomEvent('imageActivated', {\n detail: { image: e.detail.image },\n cancelable: true,\n }),\n );\n if (!allowed) e.preventDefault();\n }\n\n /**\n * Inserts the neighbouring slides around the current one so the touch target\n * element stays in the DOM (avoiding touchcancel). These aren't rendered\n * from the template, so they're marked for the gesture controller to clean\n * up. The dragging class shifts the track to centre on the middle slide.\n */\n insertDragSlides(): void {\n const track = this.slideTrack;\n if (!track) return;\n const prevIdx =\n (this.currentIndex - 1 + this.images.length) % this.images.length;\n const nextIdx = (this.currentIndex + 1) % this.images.length;\n\n track.insertBefore(\n this.createDragSlide(this.images[prevIdx]),\n track.firstChild,\n );\n track.appendChild(this.createDragSlide(this.images[nextIdx]));\n\n track.classList.add('dragging');\n }\n\n removeDragSlides(): void {\n const track = this.slideTrack;\n if (!track) return;\n track.querySelectorAll('[data-drag-slide]').forEach((el) => el.remove());\n track.classList.remove('dragging');\n }\n\n private createDragSlide(image: ImageViewerImage): IAImageViewerSlide {\n const slide = document.createElement(\n 'ia-imgview-slide',\n ) as IAImageViewerSlide;\n slide.image = image;\n slide.dataset.dragSlide = '';\n return slide;\n }\n\n showNext(): void {\n this.settleIfAnimating();\n this.moveTo((this.currentIndex + 1) % this.images.length, 'next');\n }\n\n showPrevious(): void {\n this.settleIfAnimating();\n this.moveTo(\n (this.currentIndex - 1 + this.images.length) % this.images.length,\n 'prev',\n );\n }\n\n /**\n * Starts the move to another image. With reduced motion there's no animation\n * to wait on, so the move lands immediately: nothing would fire the\n * `animationend` that otherwise commits it.\n */\n private moveTo(target: number, direction: SlideDirection): void {\n const wraps =\n direction === 'next'\n ? this.currentIndex === this.images.length - 1\n : this.currentIndex === 0;\n this.preloadAroundIndex(target);\n\n if (prefersReducedMotion()) {\n this.currentIndex = target;\n this.settleAtCurrentIndex();\n return;\n }\n\n this.slideTarget = target;\n this.slideDirection = direction;\n this.animating = true;\n this.wrapEdge = wraps ? (direction === 'next' ? 'end' : 'start') : null;\n }\n\n /**\n * Moves to the image a completed drag landed on. The drag has already\n * animated the track there, so this only updates state.\n */\n commitDrag(direction: SlideDirection): void {\n const wraps =\n direction === 'next'\n ? this.currentIndex === this.images.length - 1\n : this.currentIndex === 0;\n const step = direction === 'next' ? 1 : -1;\n this.currentIndex =\n (this.currentIndex + step + this.images.length) % this.images.length;\n if (wraps && !prefersReducedMotion()) {\n this.wrapEdge = direction === 'next' ? 'end' : 'start';\n }\n this.emitImageChanged();\n }\n\n /**\n * If an animation is in progress, immediately commit its target so the next\n * animation starts from the right position. Bumps the generation key to\n * force the track element to be recreated, which restarts the CSS animation.\n */\n settleIfAnimating(): void {\n if (!this.animating || this.slideTarget === null) return;\n this.currentIndex = this.slideTarget;\n this.slideGeneration++;\n }\n\n private onWrapGlowEnd(): void {\n this.wrapEdge = null;\n }\n\n private onSlideEnd(): void {\n if (this.slideTarget === null) return;\n this.currentIndex = this.slideTarget;\n this.settleAtCurrentIndex();\n }\n\n /** Finishes a move, however it was driven. */\n private settleAtCurrentIndex(): void {\n this.slideTarget = null;\n this.slideDirection = null;\n this.animating = false;\n this.gestures.animationSettled();\n this.emitImageChanged();\n this.preloadAdjacentImages();\n }\n\n private emitImageChanged(): void {\n const image = this.images[this.currentIndex];\n if (!image) return;\n this.dispatchEvent(\n new CustomEvent('imageChanged', {\n detail: { image, index: this.currentIndex },\n }),\n );\n }\n\n /**\n * Preloads the next and previous images around `currentIndex` so the first\n * navigation feels instant.\n */\n private preloadAdjacentImages(): void {\n this.preloadAroundIndex(this.currentIndex);\n }\n\n /**\n * Preloads images adjacent to the given index. Called both at rest (around\n * `currentIndex`) and at the start of a move (around the target) so rapid\n * navigation stays ahead of the browser cache.\n *\n * A preload that fails is deliberately not reported. These requests are\n * speculative and the viewer may never show them, so counting them would\n * inflate the failure rate with images nobody looked at. Navigating to a\n * broken image renders a real slide, whose `error` reports it then.\n */\n preloadAroundIndex(index: number): void {\n if (this.images.length <= 1) return;\n const next = (index + 1) % this.images.length;\n const prev = (index - 1 + this.images.length) % this.images.length;\n for (const idx of [next, prev]) {\n const img = new Image();\n img.src = this.images[idx].url;\n }\n }\n\n static get styles(): CSSResultGroup {\n return [\n themeStyles,\n css`\n :host {\n --image-viewer-slide-duration--: var(\n --image-viewer-slide-duration,\n 500ms\n );\n --image-viewer-glow-color--: var(\n --image-viewer-glow-color,\n rgba(255, 255, 255, 0.25)\n );\n /*\n * The breakpoint the controls query against. Named so the query in\n * ia-imgview-controls resolves to this host rather than to whatever\n * container the consumer happens to have further up.\n */\n container: image-viewer / inline-size;\n\n /*\n * Size and placement are the host's business, set with ordinary CSS\n * on the element. These are only defaults for a host that sets\n * neither; a rule in the outer tree beats them.\n */\n display: block;\n height: 100%;\n margin: 0 auto;\n }\n\n .viewer {\n position: relative;\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n\n .image-area {\n position: relative;\n flex: 1;\n min-height: 0;\n width: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n touch-action: pan-y pinch-zoom;\n }\n\n .wrap-glow {\n position: absolute;\n top: 0;\n bottom: 0;\n width: 100px;\n pointer-events: none;\n z-index: 2;\n animation: glow-fade 700ms ease-out both;\n }\n\n .glow-start {\n left: 0;\n background: linear-gradient(\n to right,\n var(--image-viewer-glow-color--),\n transparent\n );\n }\n\n .glow-end {\n right: 0;\n background: linear-gradient(\n to left,\n var(--image-viewer-glow-color--),\n transparent\n );\n }\n\n @keyframes glow-fade {\n 0% {\n opacity: 0;\n }\n 20% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n\n .slide-track {\n display: flex;\n width: 100%;\n height: 100%;\n flex-shrink: 0;\n }\n\n @keyframes slide-next {\n from {\n transform: translateX(0);\n }\n to {\n transform: translateX(-100%);\n }\n }\n\n @keyframes slide-prev {\n from {\n transform: translateX(-100%);\n }\n to {\n transform: translateX(0);\n }\n }\n\n .slide-track.dragging {\n transform: translateX(-100%);\n }\n\n .slide-track.sliding-next {\n animation: slide-next var(--image-viewer-slide-duration--) ease-in-out\n both;\n }\n\n .slide-track.sliding-prev {\n animation: slide-prev var(--image-viewer-slide-duration--) ease-in-out\n both;\n }\n\n .sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n border: 0;\n overflow: hidden;\n white-space: nowrap;\n clip-path: inset(50%);\n }\n `,\n ];\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ia-image-viewer.js","sourceRoot":"","sources":["../../../../src/elements/ia-image-viewer/ia-image-viewer.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,GAAG,EAEH,IAAI,EACJ,UAAU,EACV,OAAO,GAGR,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,WAAW,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAG9D,OAAO,oBAAoB,CAAC;AAC5B,OAAO,uBAAuB,CAAC;AAK/B;;;;;;;;;;;;;;;;;GAiBG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,UAAU;IAAtC;;QACsB,WAAM,GAAuB,EAAE,CAAC;QAc3D,gFAAgF;QACvE,iBAAY,GAAG,CAAC,CAAC;QAET,cAAS,GAAG,KAAK,CAAC;QAEnC;;;;WAIG;QACc,oBAAe,GAAG,CAAC,CAAC;QAErC,kEAAkE;QACjD,aAAQ,GAAoB,IAAI,CAAC;QAElD;;;;;;;;;WASG;QACK,qBAAgB,GAAG,IAAI,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoIF;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AApiB4B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;6CAAiC;AAM/B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAA2B;AAGhC;IAArB,KAAK,CAAC,aAAa,CAAC;gDAAyB;AAGvB;IAAtB,KAAK,CAAC,cAAc,CAAC;iDAA0B;AAGvC;IAAR,KAAK,EAAE;mDAAkB;AAET;IAAhB,KAAK,EAAE;gDAA2B;AAOlB;IAAhB,KAAK,EAAE;sDAA6B;AAGpB;IAAhB,KAAK,EAAE;+CAA0C;AA5BvC,aAAa;IADzB,aAAa,CAAC,iBAAiB,CAAC;GACpB,aAAa,CAqiBzB","sourcesContent":["import {\n css,\n type CSSResultGroup,\n html,\n LitElement,\n nothing,\n type PropertyValues,\n type TemplateResult,\n} from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { customElement } from '@src/util/custom-element';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { keyed } from 'lit/directives/keyed.js';\nimport { msg, str } from '@lit/localize';\n\nimport themeStyles from '@src/themes/theme-styles';\nimport { prefersReducedMotion } from '@src/util/prefers-reduced-motion';\nimport { ImageViewerGestures } from './image-viewer-gestures';\nimport type { ImageViewerImage, SlideDirection, WrapEdge } from './models';\nimport type { IAImageViewerSlide } from './ia-imgview-slide';\nimport './ia-imgview-slide';\nimport './ia-imgview-controls';\n\n/** Detail carried by the load and failure events a slide reports. */\ntype SlideImageEvent = CustomEvent<{ image: ImageViewerImage }>;\n\n/**\n * A swipeable image carousel.\n *\n * Shows one image at a time from a list, with previous/next buttons, a\n * counter, keyboard arrows, horizontal wheel scrolling and touch swipes.\n * Clicking an image opens it in a new tab.\n *\n * The viewer holds no opinion about where the images came from: it takes a\n * plain list of names and URLs, and reports the image it lands on through\n * `imageChanged` so a host can mirror that into its own URL or analytics.\n *\n * @fires imageChanged - The viewer settled on a new image.\n * @fires imageLoaded - An image the viewer showed finished loading.\n * @fires imageLoadFailed - An image the viewer showed could not be loaded.\n * Fires once per image until it loads successfully or the set changes.\n * @fires imageActivated - An image was clicked. Cancelable: preventing it\n * stops the default of opening the image in a new tab.\n */\n@customElement('ia-image-viewer')\nexport class IAImageViewer extends LitElement {\n @property({ type: Array }) images: ImageViewerImage[] = [];\n\n /**\n * Name of the image to show. Changing it jumps straight to that image\n * without animating. An unknown name shows the first image.\n */\n @property({ type: String }) currentImageName?: string;\n\n /** Read by the gesture controller, which tracks touches against it. */\n @query('.image-area') imageArea?: HTMLElement;\n\n /** Read by the gesture controller, which translates it during a drag. */\n @query('.slide-track') slideTrack?: HTMLElement;\n\n /** Read by the gesture controller to navigate relative to the current image. */\n @state() currentIndex = 0;\n\n @state() private animating = false;\n\n /**\n * Incremented when an animation is interrupted to force the track element to\n * be recreated via the `keyed()` directive, which guarantees the CSS\n * animation restarts even if the direction is the same.\n */\n @state() private slideGeneration = 0;\n\n /** Which edge just wrapped, if any. Drives the glow indicator. */\n @state() private wrapEdge: WrapEdge | null = null;\n\n /**\n * Images already reported as failed, so a broken image isn't counted again\n * every time the viewer passes over it. Navigating back re-fires `error` on\n * the recreated element, and the neighbouring slides staged during an\n * animation or a drag load the same image too, so without this a single\n * broken derivative reports several times a session.\n *\n * Cleared when the image set changes, which is the point a name stops\n * standing for the same file.\n */\n private reportedFailures = new Set<string>();\n\n private slideTarget: number | null = null;\n\n private slideDirection: SlideDirection | null = null;\n\n private gestures = new ImageViewerGestures(this);\n\n get imageCount(): number {\n return this.images.length;\n }\n\n /** The image currently on screen, if there is one. */\n get currentImage(): ImageViewerImage | undefined {\n return this.images[this.currentIndex];\n }\n\n protected willUpdate(changed: PropertyValues): void {\n if (changed.has('images') || changed.has('currentImageName')) {\n const previous = changed.get('images') as ImageViewerImage[] | undefined;\n this.currentIndex = this.indexToShow(changed, previous);\n\n this.animating = false;\n this.slideGeneration = 0;\n this.slideTarget = null;\n this.slideDirection = null;\n this.wrapEdge = null;\n this.reportedFailures.clear();\n this.preloadAdjacentImages();\n }\n }\n\n /**\n * Where to land when the images or the requested name change.\n *\n * A new `currentImageName` is the host asking for a particular image, so it\n * wins. A new `images` array on its own isn't: a host that builds its list\n * in a getter hands over a fresh array on every render, which says nothing\n * about the images having changed. So the viewer holds its place by name and\n * only goes back to the start when the image it was showing is really gone.\n */\n private indexToShow(\n changed: PropertyValues,\n previousImages: ImageViewerImage[] | undefined,\n ): number {\n if (changed.has('currentImageName') && this.currentImageName) {\n const requested = this.images.findIndex(\n (image) => image.name === this.currentImageName,\n );\n if (requested >= 0) return requested;\n }\n\n const showing = previousImages?.[this.currentIndex]?.name;\n if (showing) {\n const stillThere = this.images.findIndex(\n (image) => image.name === showing,\n );\n if (stillThere >= 0) return stillThere;\n }\n\n const named = this.currentImageName\n ? this.images.findIndex((image) => image.name === this.currentImageName)\n : -1;\n return named >= 0 ? named : 0;\n }\n\n render(): TemplateResult | typeof nothing {\n if (this.images.length === 0) return nothing;\n\n const { dragging } = this.gestures;\n const current = this.images[this.currentIndex];\n const showControls = this.images.length > 1;\n\n const trackClasses = {\n 'slide-track': true,\n 'sliding-next':\n this.animating && !dragging && this.slideDirection === 'next',\n 'sliding-prev':\n this.animating && !dragging && this.slideDirection === 'prev',\n dragging,\n };\n\n const prevIndex =\n (this.currentIndex - 1 + this.images.length) % this.images.length;\n const nextIndex = (this.currentIndex + 1) % this.images.length;\n\n const slideTarget =\n this.animating && !dragging && this.slideTarget !== null\n ? this.images[this.slideTarget]\n : null;\n const prevImage = dragging ? this.images[prevIndex] : slideTarget;\n const nextImage = dragging ? this.images[nextIndex] : slideTarget;\n const showPrev =\n dragging || (slideTarget !== null && this.slideDirection === 'prev');\n const showNext =\n dragging || (slideTarget !== null && this.slideDirection === 'next');\n\n const displayIndex =\n this.animating && this.slideTarget !== null\n ? this.slideTarget\n : this.currentIndex;\n\n return html`\n <div class=\"viewer\">\n <div class=\"image-area\">\n ${this.wrapEdge\n ? html`<div\n class=\"wrap-glow ${this.wrapEdge === 'start'\n ? 'glow-start'\n : 'glow-end'}\"\n @animationend=${this.onWrapGlowEnd}\n ></div>`\n : nothing}\n ${keyed(\n this.slideGeneration,\n html`<div\n class=${classMap(trackClasses)}\n @animationend=${this.onSlideEnd}\n @imageLoaded=${this.onImageLoaded}\n @imageFailed=${this.onImageFailed}\n @imageActivated=${this.onImageActivated}\n >\n ${showPrev && prevImage ? this.slideTemplate(prevImage) : nothing}\n ${this.slideTemplate(current)}\n ${showNext && nextImage ? this.slideTemplate(nextImage) : nothing}\n </div>`,\n )}\n </div>\n ${showControls\n ? html`\n <ia-imgview-controls\n .currentIndex=${displayIndex}\n .totalImages=${this.images.length}\n @showPrevious=${this.showPrevious}\n @showNext=${this.showNext}\n ></ia-imgview-controls>\n `\n : nothing}\n ${this.announcementTemplate}\n </div>\n `;\n }\n\n private slideTemplate(image: ImageViewerImage): TemplateResult {\n return html`<ia-imgview-slide .image=${image}></ia-imgview-slide>`;\n }\n\n /**\n * Announces the image to a screen reader, which otherwise gets nothing when\n * the counter and the picture change under it.\n */\n private get announcementTemplate(): TemplateResult {\n const current = this.images[this.currentIndex];\n const position = msg(\n str`Image ${this.currentIndex + 1} of ${this.images.length}`,\n );\n const label = current?.title ?? current?.name;\n return html`\n <div class=\"sr-only\" role=\"status\" aria-live=\"polite\" aria-atomic=\"true\">\n ${label ? `${position}: ${label}` : position}\n </div>\n `;\n }\n\n /**\n * Passes a slide's load result on to the host, which is where reporting\n * belongs. The slide's own events stop at this shadow root, so they're\n * re-dispatched rather than allowed to escape.\n */\n private onImageLoaded(e: SlideImageEvent): void {\n // A load that succeeds clears the failure, so an image that breaks again\n // later is reported again rather than swallowed as a repeat.\n this.reportedFailures.delete(e.detail.image.name);\n this.dispatchEvent(\n new CustomEvent('imageLoaded', { detail: { image: e.detail.image } }),\n );\n }\n\n private onImageFailed(e: SlideImageEvent): void {\n const { image } = e.detail;\n if (this.reportedFailures.has(image.name)) return;\n this.reportedFailures.add(image.name);\n this.dispatchEvent(\n new CustomEvent('imageLoadFailed', { detail: { image } }),\n );\n }\n\n /**\n * Decides whether a click on a slide opens the image.\n *\n * Two things can stop it: the click is the tail end of a swipe, or the host\n * cancels the event to show the image its own way. The slide's event doesn't\n * cross this shadow root, so it's re-raised here for the host to see, and a\n * veto is passed back down to cancel the click.\n */\n private onImageActivated(e: SlideImageEvent): void {\n if (this.gestures.consumeSwipeTap()) {\n e.preventDefault();\n return;\n }\n const allowed = this.dispatchEvent(\n new CustomEvent('imageActivated', {\n detail: { image: e.detail.image },\n cancelable: true,\n }),\n );\n if (!allowed) e.preventDefault();\n }\n\n /**\n * Inserts the neighbouring slides around the current one so the touch target\n * element stays in the DOM (avoiding touchcancel). These aren't rendered\n * from the template, so they're marked for the gesture controller to clean\n * up. The dragging class shifts the track to centre on the middle slide.\n */\n insertDragSlides(): void {\n const track = this.slideTrack;\n if (!track) return;\n const prevIdx =\n (this.currentIndex - 1 + this.images.length) % this.images.length;\n const nextIdx = (this.currentIndex + 1) % this.images.length;\n\n track.insertBefore(\n this.createDragSlide(this.images[prevIdx]),\n track.firstChild,\n );\n track.appendChild(this.createDragSlide(this.images[nextIdx]));\n\n track.classList.add('dragging');\n }\n\n removeDragSlides(): void {\n const track = this.slideTrack;\n if (!track) return;\n track.querySelectorAll('[data-drag-slide]').forEach((el) => el.remove());\n track.classList.remove('dragging');\n }\n\n private createDragSlide(image: ImageViewerImage): IAImageViewerSlide {\n const slide = document.createElement(\n 'ia-imgview-slide',\n ) as IAImageViewerSlide;\n slide.image = image;\n slide.dataset.dragSlide = '';\n return slide;\n }\n\n showNext(): void {\n this.settleIfAnimating();\n this.moveTo((this.currentIndex + 1) % this.images.length, 'next');\n }\n\n showPrevious(): void {\n this.settleIfAnimating();\n this.moveTo(\n (this.currentIndex - 1 + this.images.length) % this.images.length,\n 'prev',\n );\n }\n\n /**\n * Starts the move to another image. With reduced motion there's no animation\n * to wait on, so the move lands immediately: nothing would fire the\n * `animationend` that otherwise commits it.\n */\n private moveTo(target: number, direction: SlideDirection): void {\n const wraps =\n direction === 'next'\n ? this.currentIndex === this.images.length - 1\n : this.currentIndex === 0;\n this.preloadAroundIndex(target);\n\n if (prefersReducedMotion()) {\n this.currentIndex = target;\n this.settleAtCurrentIndex();\n return;\n }\n\n this.slideTarget = target;\n this.slideDirection = direction;\n this.animating = true;\n this.wrapEdge = wraps ? (direction === 'next' ? 'end' : 'start') : null;\n }\n\n /**\n * Moves to the image a completed drag landed on. The drag has already\n * animated the track there, so this only updates state.\n */\n commitDrag(direction: SlideDirection): void {\n const wraps =\n direction === 'next'\n ? this.currentIndex === this.images.length - 1\n : this.currentIndex === 0;\n const step = direction === 'next' ? 1 : -1;\n this.currentIndex =\n (this.currentIndex + step + this.images.length) % this.images.length;\n if (wraps && !prefersReducedMotion()) {\n this.wrapEdge = direction === 'next' ? 'end' : 'start';\n }\n this.emitImageChanged();\n }\n\n /**\n * If an animation is in progress, immediately commit its target so the next\n * animation starts from the right position. Bumps the generation key to\n * force the track element to be recreated, which restarts the CSS animation.\n */\n settleIfAnimating(): void {\n if (!this.animating || this.slideTarget === null) return;\n this.currentIndex = this.slideTarget;\n this.slideGeneration++;\n }\n\n private onWrapGlowEnd(): void {\n this.wrapEdge = null;\n }\n\n private onSlideEnd(): void {\n if (this.slideTarget === null) return;\n this.currentIndex = this.slideTarget;\n this.settleAtCurrentIndex();\n }\n\n /** Finishes a move, however it was driven. */\n private settleAtCurrentIndex(): void {\n this.slideTarget = null;\n this.slideDirection = null;\n this.animating = false;\n this.gestures.animationSettled();\n this.emitImageChanged();\n this.preloadAdjacentImages();\n }\n\n private emitImageChanged(): void {\n const image = this.images[this.currentIndex];\n if (!image) return;\n this.dispatchEvent(\n new CustomEvent('imageChanged', {\n detail: { image, index: this.currentIndex },\n }),\n );\n }\n\n /**\n * Preloads the next and previous images around `currentIndex` so the first\n * navigation feels instant.\n */\n private preloadAdjacentImages(): void {\n this.preloadAroundIndex(this.currentIndex);\n }\n\n /**\n * Preloads images adjacent to the given index. Called both at rest (around\n * `currentIndex`) and at the start of a move (around the target) so rapid\n * navigation stays ahead of the browser cache.\n *\n * A preload that fails is deliberately not reported. These requests are\n * speculative and the viewer may never show them, so counting them would\n * inflate the failure rate with images nobody looked at. Navigating to a\n * broken image renders a real slide, whose `error` reports it then.\n */\n preloadAroundIndex(index: number): void {\n if (this.images.length <= 1) return;\n const next = (index + 1) % this.images.length;\n const prev = (index - 1 + this.images.length) % this.images.length;\n for (const idx of [next, prev]) {\n const img = new Image();\n img.src = this.images[idx].url;\n }\n }\n\n static get styles(): CSSResultGroup {\n return [\n themeStyles,\n css`\n :host {\n --image-viewer-slide-duration--: var(\n --image-viewer-slide-duration,\n 500ms\n );\n --image-viewer-glow-color--: var(\n --image-viewer-glow-color,\n rgba(255, 255, 255, 0.25)\n );\n /*\n * Size and placement are the host's business, set with ordinary CSS\n * on the element. These are only defaults for a host that sets\n * neither; a rule in the outer tree beats them.\n */\n display: block;\n height: 100%;\n margin: 0 auto;\n }\n\n .viewer {\n position: relative;\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n\n .image-area {\n position: relative;\n flex: 1;\n min-height: 0;\n width: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n touch-action: pan-y pinch-zoom;\n }\n\n .wrap-glow {\n position: absolute;\n top: 0;\n bottom: 0;\n width: 100px;\n pointer-events: none;\n z-index: 2;\n animation: glow-fade 700ms ease-out both;\n }\n\n .glow-start {\n left: 0;\n background: linear-gradient(\n to right,\n var(--image-viewer-glow-color--),\n transparent\n );\n }\n\n .glow-end {\n right: 0;\n background: linear-gradient(\n to left,\n var(--image-viewer-glow-color--),\n transparent\n );\n }\n\n @keyframes glow-fade {\n 0% {\n opacity: 0;\n }\n 20% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n\n .slide-track {\n display: flex;\n width: 100%;\n height: 100%;\n flex-shrink: 0;\n }\n\n @keyframes slide-next {\n from {\n transform: translateX(0);\n }\n to {\n transform: translateX(-100%);\n }\n }\n\n @keyframes slide-prev {\n from {\n transform: translateX(-100%);\n }\n to {\n transform: translateX(0);\n }\n }\n\n .slide-track.dragging {\n transform: translateX(-100%);\n }\n\n .slide-track.sliding-next {\n animation: slide-next var(--image-viewer-slide-duration--) ease-in-out\n both;\n }\n\n .slide-track.sliding-prev {\n animation: slide-prev var(--image-viewer-slide-duration--) ease-in-out\n both;\n }\n\n .sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n border: 0;\n overflow: hidden;\n white-space: nowrap;\n clip-path: inset(50%);\n }\n `,\n ];\n }\n}\n"]}
|
|
@@ -5,10 +5,17 @@ import { type CSSResultGroup, LitElement, type TemplateResult } from 'lit';
|
|
|
5
5
|
* Past the wide breakpoint the buttons position themselves over the image
|
|
6
6
|
* area, which lives in the viewer's shadow root. That works because an
|
|
7
7
|
* absolutely positioned element finds its containing block through the flat
|
|
8
|
-
* tree, so the viewer's frame is still the reference as long as this
|
|
9
|
-
*
|
|
10
|
-
* container
|
|
11
|
-
*
|
|
8
|
+
* tree, so the viewer's frame is still the reference as long as this host
|
|
9
|
+
* stays unpositioned. The breakpoint itself queries this host's own
|
|
10
|
+
* (unnamed) container from `.controls`, a genuine descendant inside this
|
|
11
|
+
* element's own shadow root, rather than a named container on the
|
|
12
|
+
* `ia-image-viewer` ancestor — Safari doesn't reliably resolve a named
|
|
13
|
+
* container query across a shadow-tree boundary, so querying across from
|
|
14
|
+
* here left the wide layout permanently off in Safari. `:host` stays full
|
|
15
|
+
* width the whole time; once the buttons come out of flow, `.controls` only
|
|
16
|
+
* has the counter left to lay out, so switching its `justify-content` to
|
|
17
|
+
* `center` puts the counter in the middle of the image without needing
|
|
18
|
+
* anything to shrink-wrap.
|
|
12
19
|
*/
|
|
13
20
|
export declare class IAImageViewerControls extends LitElement {
|
|
14
21
|
/** Zero-based index of the image being shown, for the counter. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ia-imgview-controls.d.ts","sourceRoot":"","sources":["../../../../src/elements/ia-image-viewer/ia-imgview-controls.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EAEnB,UAAU,EACV,KAAK,cAAc,EACpB,MAAM,KAAK,CAAC;AAOb
|
|
1
|
+
{"version":3,"file":"ia-imgview-controls.d.ts","sourceRoot":"","sources":["../../../../src/elements/ia-image-viewer/ia-imgview-controls.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EAEnB,UAAU,EACV,KAAK,cAAc,EACpB,MAAM,KAAK,CAAC;AAOb;;;;;;;;;;;;;;;;;GAiBG;AACH,qBACa,qBAAsB,SAAQ,UAAU;IACnD,kEAAkE;IACtC,YAAY,SAAK;IAEjB,WAAW,SAAK;IAE5C,MAAM,IAAI,cAAc;IAwBxB,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,MAAM;IAId,MAAM,KAAK,MAAM,IAAI,cAAc,CAyFlC;CACF"}
|
|
@@ -10,10 +10,17 @@ import themeStyles from '../../themes/theme-styles.js';
|
|
|
10
10
|
* Past the wide breakpoint the buttons position themselves over the image
|
|
11
11
|
* area, which lives in the viewer's shadow root. That works because an
|
|
12
12
|
* absolutely positioned element finds its containing block through the flat
|
|
13
|
-
* tree, so the viewer's frame is still the reference as long as this
|
|
14
|
-
*
|
|
15
|
-
* container
|
|
16
|
-
*
|
|
13
|
+
* tree, so the viewer's frame is still the reference as long as this host
|
|
14
|
+
* stays unpositioned. The breakpoint itself queries this host's own
|
|
15
|
+
* (unnamed) container from `.controls`, a genuine descendant inside this
|
|
16
|
+
* element's own shadow root, rather than a named container on the
|
|
17
|
+
* `ia-image-viewer` ancestor — Safari doesn't reliably resolve a named
|
|
18
|
+
* container query across a shadow-tree boundary, so querying across from
|
|
19
|
+
* here left the wide layout permanently off in Safari. `:host` stays full
|
|
20
|
+
* width the whole time; once the buttons come out of flow, `.controls` only
|
|
21
|
+
* has the counter left to lay out, so switching its `justify-content` to
|
|
22
|
+
* `center` puts the counter in the middle of the image without needing
|
|
23
|
+
* anything to shrink-wrap.
|
|
17
24
|
*/
|
|
18
25
|
let IAImageViewerControls = class IAImageViewerControls extends LitElement {
|
|
19
26
|
constructor() {
|
|
@@ -24,21 +31,25 @@ let IAImageViewerControls = class IAImageViewerControls extends LitElement {
|
|
|
24
31
|
}
|
|
25
32
|
render() {
|
|
26
33
|
return html `
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
<div class="controls">
|
|
35
|
+
<button
|
|
36
|
+
class="nav-btn prev"
|
|
37
|
+
aria-label=${msg('Previous image')}
|
|
38
|
+
@click=${this.onPrevious}
|
|
39
|
+
>
|
|
40
|
+
‹
|
|
41
|
+
</button>
|
|
42
|
+
<div class="counter">
|
|
43
|
+
${this.currentIndex + 1} / ${this.totalImages}
|
|
44
|
+
</div>
|
|
45
|
+
<button
|
|
46
|
+
class="nav-btn next"
|
|
47
|
+
aria-label=${msg('Next image')}
|
|
48
|
+
@click=${this.onNext}
|
|
49
|
+
>
|
|
50
|
+
›
|
|
51
|
+
</button>
|
|
52
|
+
</div>
|
|
42
53
|
`;
|
|
43
54
|
}
|
|
44
55
|
onPrevious() {
|
|
@@ -57,6 +68,12 @@ let IAImageViewerControls = class IAImageViewerControls extends LitElement {
|
|
|
57
68
|
var(--true-white)
|
|
58
69
|
);
|
|
59
70
|
|
|
71
|
+
display: block;
|
|
72
|
+
width: 100%;
|
|
73
|
+
container-type: inline-size;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.controls {
|
|
60
77
|
display: flex;
|
|
61
78
|
align-items: center;
|
|
62
79
|
justify-content: space-between;
|
|
@@ -101,10 +118,9 @@ let IAImageViewerControls = class IAImageViewerControls extends LitElement {
|
|
|
101
118
|
}
|
|
102
119
|
}
|
|
103
120
|
|
|
104
|
-
@container
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
width: auto;
|
|
121
|
+
@container (min-width: 890px) {
|
|
122
|
+
.controls {
|
|
123
|
+
justify-content: center;
|
|
108
124
|
margin-top: 0;
|
|
109
125
|
}
|
|
110
126
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ia-imgview-controls.js","sourceRoot":"","sources":["../../../../src/elements/ia-image-viewer/ia-imgview-controls.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,GAAG,EAEH,IAAI,EACJ,UAAU,GAEX,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEpC,OAAO,WAAW,MAAM,0BAA0B,CAAC;AAEnD
|
|
1
|
+
{"version":3,"file":"ia-imgview-controls.js","sourceRoot":"","sources":["../../../../src/elements/ia-image-viewer/ia-imgview-controls.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,GAAG,EAEH,IAAI,EACJ,UAAU,GAEX,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEpC,OAAO,WAAW,MAAM,0BAA0B,CAAC;AAEnD;;;;;;;;;;;;;;;;;GAiBG;AAEI,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,UAAU;IAA9C;;QACL,kEAAkE;QACtC,iBAAY,GAAG,CAAC,CAAC;QAEjB,gBAAW,GAAG,CAAC,CAAC;IA4H9C,CAAC;IA1HC,MAAM;QACJ,OAAO,IAAI,CAAA;;;;uBAIQ,GAAG,CAAC,gBAAgB,CAAC;mBACzB,IAAI,CAAC,UAAU;;;;;YAKtB,IAAI,CAAC,YAAY,GAAG,CAAC,MAAM,IAAI,CAAC,WAAW;;;;uBAIhC,GAAG,CAAC,YAAY,CAAC;mBACrB,IAAI,CAAC,MAAM;;;;;KAKzB,CAAC;IACJ,CAAC;IAEO,UAAU;QAChB,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC;IACtD,CAAC;IAEO,MAAM;QACZ,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC;IAClD,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO;YACL,WAAW;YACX,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoFF;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AA9H6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DAAkB;AAEjB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0DAAiB;AAJjC,qBAAqB;IADjC,aAAa,CAAC,qBAAqB,CAAC;GACxB,qBAAqB,CAgIjC","sourcesContent":["import {\n css,\n type CSSResultGroup,\n html,\n LitElement,\n type TemplateResult,\n} from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { customElement } from '@src/util/custom-element';\nimport { msg } from '@lit/localize';\n\nimport themeStyles from '@src/themes/theme-styles';\n\n/**\n * The image viewer's previous / next buttons and the \"n / total\" counter.\n *\n * Past the wide breakpoint the buttons position themselves over the image\n * area, which lives in the viewer's shadow root. That works because an\n * absolutely positioned element finds its containing block through the flat\n * tree, so the viewer's frame is still the reference as long as this host\n * stays unpositioned. The breakpoint itself queries this host's own\n * (unnamed) container from `.controls`, a genuine descendant inside this\n * element's own shadow root, rather than a named container on the\n * `ia-image-viewer` ancestor — Safari doesn't reliably resolve a named\n * container query across a shadow-tree boundary, so querying across from\n * here left the wide layout permanently off in Safari. `:host` stays full\n * width the whole time; once the buttons come out of flow, `.controls` only\n * has the counter left to lay out, so switching its `justify-content` to\n * `center` puts the counter in the middle of the image without needing\n * anything to shrink-wrap.\n */\n@customElement('ia-imgview-controls')\nexport class IAImageViewerControls extends LitElement {\n /** Zero-based index of the image being shown, for the counter. */\n @property({ type: Number }) currentIndex = 0;\n\n @property({ type: Number }) totalImages = 0;\n\n render(): TemplateResult {\n return html`\n <div class=\"controls\">\n <button\n class=\"nav-btn prev\"\n aria-label=${msg('Previous image')}\n @click=${this.onPrevious}\n >\n ‹\n </button>\n <div class=\"counter\">\n ${this.currentIndex + 1} / ${this.totalImages}\n </div>\n <button\n class=\"nav-btn next\"\n aria-label=${msg('Next image')}\n @click=${this.onNext}\n >\n ›\n </button>\n </div>\n `;\n }\n\n private onPrevious(): void {\n this.dispatchEvent(new CustomEvent('showPrevious'));\n }\n\n private onNext(): void {\n this.dispatchEvent(new CustomEvent('showNext'));\n }\n\n static get styles(): CSSResultGroup {\n return [\n themeStyles,\n css`\n :host {\n --imgview-controls-text-color--: var(\n --image-viewer-text-color,\n var(--true-white)\n );\n\n display: block;\n width: 100%;\n container-type: inline-size;\n }\n\n .controls {\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n margin-top: 0.8rem;\n }\n\n .nav-btn {\n width: 40px;\n background: transparent;\n color: var(--imgview-controls-text-color--);\n border: none;\n cursor: pointer;\n font-size: 30px;\n display: flex;\n align-items: center;\n justify-content: center;\n opacity: 0.5;\n text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);\n transition: opacity 0.15s;\n }\n\n .nav-btn:hover {\n opacity: 1;\n }\n\n .nav-btn:focus-visible {\n outline: 2px solid rgba(255, 255, 255, 0.8);\n outline-offset: -2px;\n }\n\n .counter {\n color: var(--imgview-controls-text-color--);\n font-size: 14px;\n font-weight: 200;\n letter-spacing: 0.05em;\n }\n\n @media (prefers-reduced-motion: reduce) {\n .nav-btn {\n transition: none;\n }\n }\n\n @container (min-width: 890px) {\n .controls {\n justify-content: center;\n margin-top: 0;\n }\n\n .nav-btn {\n position: absolute;\n top: 0;\n bottom: 0;\n width: 60px;\n font-size: 60px;\n z-index: 1;\n }\n\n .prev {\n left: 0;\n }\n\n .next {\n right: 0;\n }\n\n .counter {\n margin-top: 0.8rem;\n }\n }\n `,\n ];\n }\n}\n"]}
|