peek-carousel 1.1.1 → 2.0.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/COPYRIGHT.md +50 -28
- package/LICENSE +68 -18
- package/LICENSE-MIT +22 -0
- package/README.en.md +49 -19
- package/README.md +44 -18
- package/THIRD_PARTY_NOTICES.md +53 -24
- package/dist/peek-carousel.cjs +2 -2
- package/dist/peek-carousel.css +2 -2
- package/dist/peek-carousel.esm.js +2 -2
- package/dist/peek-carousel.js +2 -2
- package/dist/peek-carousel.min.css +2 -2
- package/docs/en/reference.md +14 -16
- package/docs/integrations.md +120 -29
- package/docs/ko/reference.md +11 -12
- package/examples/custom-theme.css +292 -46
- package/examples/custom-theme.html +96 -62
- package/examples/custom-theme.ja.html +103 -0
- package/examples/custom-theme.js +6 -121
- package/examples/custom-theme.ko.html +102 -0
- package/examples/example-built.html +80 -63
- package/examples/example-built.ja.html +172 -0
- package/examples/example-built.ko.html +171 -0
- package/examples/example.min.css +3 -3
- package/examples/example.min.js +3 -3
- package/package.json +24 -8
- package/public/favicon-16x16.png +0 -0
- package/public/favicon-32x32.png +0 -0
- package/public/favicon.ico +0 -0
- package/public/fonts/OFL-noto.txt +93 -0
- package/public/fonts/OFL-pretendard.txt +94 -0
- package/public/fonts/inter-latin.css +1 -1
- package/public/fonts/noto-sans-ja-bold.woff2 +0 -0
- package/public/fonts/noto-sans-ja.css +70 -0
- package/public/fonts/noto-sans-ja.woff2 +0 -0
- package/public/fonts/peek-preview-kr.css +53 -0
- package/public/fonts/peek-preview-kr.woff2 +0 -0
- package/public/peek-mark.svg +5 -0
package/dist/peek-carousel.css
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! PeekCarousel
|
|
1
|
+
/*! PeekCarousel v2.0.1
|
|
2
2
|
* Copyright (c) 2025 PeekCarousel
|
|
3
3
|
* Copyright (c) 2026 PeekCarousel contributors
|
|
4
|
-
* @license
|
|
4
|
+
* @license See LICENSE, LICENSE-MIT and THIRD_PARTY_NOTICES.md.
|
|
5
5
|
*/
|
|
6
6
|
.peek-carousel__item:focus-visible{border-radius:var(--peek-carousel-card-radius,12px);outline:3px solid var(--peek-carousel-focus-color,rgba(102,126,234,.8));outline-offset:8px}@supports not selector(:focus-visible){.peek-carousel button:focus,.peek-carousel:focus,.peek-carousel__item:focus{outline:3px solid var(--peek-carousel-focus-color,#667eea);outline-offset:4px}}.peek-carousel{animation:fadeInUp .8s cubic-bezier(.4,0,.2,1) forwards;animation-delay:.1s;cursor:grab;display:grid;font-family:var(--peek-carousel-font-family,inherit);height:100%;opacity:0;place-items:center;position:relative;transform:translateY(30px);-webkit-user-select:none;-moz-user-select:none;user-select:none;width:100%;--drag-offset:0px;--drag-rotation:0deg;--drag-rotation-y:0deg}.peek-carousel__track{height:100%;position:relative;touch-action:pan-y;transform-style:preserve-3d;width:100%}.peek-carousel__item{aspect-ratio:1.3265306122;-webkit-backface-visibility:hidden;backface-visibility:hidden;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%) scale(.8);transform-origin:center;width:clamp(300px,35vw,500px);z-index:0;--item-x:0%;--item-scale:0.8;--item-offset-x:0px;--item-angle:0deg;--item-radius:400px}.peek-carousel__item--active,.peek-carousel__item--next,.peek-carousel__item--prev{will-change:transform,opacity}.peek-carousel__item--active .peek-carousel__caption{opacity:1}@media (max-width:768px){.peek-carousel__item{width:clamp(280px,80vw,400px);--item-radius:300px}}.peek-carousel__figure{height:100%;margin:0;position:relative;width:100%}.peek-carousel__image{border-radius:var(--peek-carousel-card-radius,16px);box-shadow:var(--peek-carousel-card-shadow,0,20px,60px,rgba(0,0,0,.6),0,5px,15px,rgba(0,0,0,.4));height:100%;-o-object-fit:cover;object-fit:cover;transition:filter .4s cubic-bezier(.4,0,.2,1),box-shadow .4s cubic-bezier(.4,0,.2,1);width:100%}.peek-carousel__caption{background:var(--peek-carousel-caption-background,linear-gradient(to top,rgba(0,0,0,.8),transparent));border-radius:0 0 var(--peek-carousel-card-radius,16px) var(--peek-carousel-card-radius,16px);color:var(--peek-carousel-text-color,#fff);inset:auto 0 0;opacity:0;padding:1.5rem;pointer-events:none;position:absolute;text-align:center;transition:opacity .3s ease}@keyframes fadeInUp{to{opacity:1;transform:translateY(0)}}.peek-carousel--stack .peek-carousel__track{transform:none;transition:none}.peek-carousel--stack .peek-carousel__item{cursor:pointer;opacity:.5;transition:transform .05s,opacity .05s,z-index 0s;visibility:visible}.peek-carousel--stack .peek-carousel__item:not(.peek-carousel__item--dragging-left):not(.peek-carousel__item--dragging-right){transition:transform .5s,opacity .5s,z-index 0s}.peek-carousel--stack .peek-carousel__item--active{opacity:1;z-index:100}.peek-carousel--stack .peek-carousel__item--active .peek-carousel__image{box-shadow:var(--peek-carousel-active-shadow,0 40px 100px rgba(102,126,234,.6),0 0 40px rgba(102,126,234,.4),0 0 80px rgba(118,75,162,.3));filter:var(--peek-carousel-image-filter,brightness(1.2) saturate(1.1))}.peek-carousel--stack .peek-carousel__item:not(.peek-carousel--stack .peek-carousel__item--active) .peek-carousel__image{box-shadow:var(--peek-carousel-card-shadow,0 20px 50px rgba(0,0,0,.5));filter:var(--peek-carousel-image-filter,brightness(.7) saturate(.85))}.peek-carousel--stack .peek-carousel__item:not(.peek-carousel--stack .peek-carousel__item--active):hover .peek-carousel__image{box-shadow:var(--peek-carousel-card-shadow,0 30px 70px rgba(102,126,234,.3))!important;filter:var(--peek-carousel-image-filter,brightness(.9) saturate(1))!important;transition:all .3s ease}.peek-carousel--stack .peek-carousel__item--center{transform:translate(-50%,-50%) scale(1.15) translateX(var(--drag-offset)) rotate(var(--drag-rotation))}.peek-carousel--stack .peek-carousel__item--prev{transform:translate(-95%,-50%) scale(.85) translateX(calc(-15px + var(--drag-offset))) rotate(var(--drag-rotation))}.peek-carousel--stack .peek-carousel__item--next{transform:translate(-5%,-50%) scale(.85) translateX(calc(15px + var(--drag-offset))) rotate(var(--drag-rotation))}.peek-carousel--stack .peek-carousel__item--hidden{opacity:0;pointer-events:none;transform:translate(-50%,-50%) scale(.7) translateX(var(--drag-offset)) rotate(var(--drag-rotation));visibility:hidden}.peek-carousel--radial{perspective:1200px}.peek-carousel--radial .peek-carousel__track{transform:rotateY(calc(var(--carousel-rotation, 0deg) + var(--drag-rotation-y)));transition:transform .5s cubic-bezier(.4,0,.2,1)}.peek-carousel--radial .peek-carousel__track:active{transition:transform .05s}.peek-carousel--radial .peek-carousel__item{cursor:default;opacity:0;transform:translate(-50%,-50%) rotateY(var(--item-angle)) translateZ(var(--item-radius));transition:transform .5s cubic-bezier(.4,0,.2,1),opacity .5s cubic-bezier(.4,0,.2,1),visibility 0s .5s,z-index 0s;visibility:hidden}.peek-carousel--radial .peek-carousel__item--active{cursor:grab;opacity:1;transition:transform .5s cubic-bezier(.4,0,.2,1),opacity .5s cubic-bezier(.4,0,.2,1),visibility 0s 0s,z-index 0s;visibility:visible;z-index:100}.peek-carousel--radial .peek-carousel__item--active:active{cursor:grabbing}.peek-carousel--radial .peek-carousel__item--active .peek-carousel__image{box-shadow:var(--peek-carousel-active-shadow,0 40px 100px rgba(102,126,234,.6),0 0 40px rgba(102,126,234,.4),0 0 80px rgba(118,75,162,.3));filter:var(--peek-carousel-image-filter,brightness(1.2) saturate(1.1))}.peek-carousel--radial .peek-carousel__item--next,.peek-carousel--radial .peek-carousel__item--prev{opacity:.3;transition:transform .5s cubic-bezier(.4,0,.2,1),opacity .5s cubic-bezier(.4,0,.2,1),visibility 0s 0s,z-index 0s;visibility:visible;z-index:50}.peek-carousel--radial .peek-carousel__item--next .peek-carousel__image,.peek-carousel--radial .peek-carousel__item--prev .peek-carousel__image{box-shadow:var(--peek-carousel-card-shadow,0 25px 60px rgba(0,0,0,.6));filter:var(--peek-carousel-image-filter,brightness(.8) saturate(.9))}.peek-carousel--radial .peek-carousel__item:not(.peek-carousel--radial .peek-carousel__item--active) .peek-carousel__image{box-shadow:var(--peek-carousel-card-shadow,0 20px 50px rgba(0,0,0,.5));filter:var(--peek-carousel-image-filter,brightness(.7) saturate(.85))}@media (max-width:768px){.peek-carousel--radial .peek-carousel__item{--item-radius:300px}}.peek-carousel--classic{overflow:hidden}.peek-carousel--classic .peek-carousel__track{transform:translateX(calc(var(--track-offset, 0px) + var(--drag-offset)));transition:transform .5s cubic-bezier(.4,0,.2,1)}.peek-carousel--classic .peek-carousel__track:active{transition:transform .05s}.peek-carousel--classic .peek-carousel__item{cursor:default;left:var(--item-x,50%);opacity:0;position:absolute;transform:translate(-50%,-50%) scale(var(--item-scale,1));transition:transform .5s cubic-bezier(.4,0,.2,1),opacity .5s cubic-bezier(.4,0,.2,1),left .5s cubic-bezier(.4,0,.2,1),visibility 0s cubic-bezier(.4,0,.2,1) .5s,z-index 0s;visibility:hidden;z-index:0}.peek-carousel--classic .peek-carousel__item--active{cursor:grab;opacity:1;transition:transform .5s cubic-bezier(.4,0,.2,1),opacity .5s cubic-bezier(.4,0,.2,1),left .5s cubic-bezier(.4,0,.2,1),visibility 0s 0s,z-index 0s;visibility:visible;z-index:100}.peek-carousel--classic .peek-carousel__item--active:active{cursor:grabbing}.peek-carousel--classic .peek-carousel__item--active .peek-carousel__image{box-shadow:var(--peek-carousel-active-shadow,0 40px 100px rgba(102,126,234,.6),0 0 40px rgba(102,126,234,.4),0 0 80px rgba(118,75,162,.3));filter:var(--peek-carousel-image-filter,brightness(1.15) saturate(1.1))}.peek-carousel--classic .peek-carousel__item--next,.peek-carousel--classic .peek-carousel__item--prev{cursor:pointer;opacity:.6;transition:transform .5s cubic-bezier(.4,0,.2,1),opacity .5s cubic-bezier(.4,0,.2,1),left .5s cubic-bezier(.4,0,.2,1),visibility 0s 0s,z-index 0s;visibility:visible;z-index:50}.peek-carousel--classic .peek-carousel__item--next .peek-carousel__image,.peek-carousel--classic .peek-carousel__item--prev .peek-carousel__image{box-shadow:var(--peek-carousel-card-shadow,0 25px 60px rgba(0,0,0,.5));filter:var(--peek-carousel-image-filter,brightness(.8) saturate(.95))}.peek-carousel--classic .peek-carousel__item--next:hover .peek-carousel__image,.peek-carousel--classic .peek-carousel__item--prev:hover .peek-carousel__image{box-shadow:var(--peek-carousel-card-shadow,0 30px 70px rgba(102,126,234,.3))!important;filter:var(--peek-carousel-image-filter,brightness(1) saturate(1.05))!important;transition:all .3s ease}.peek-carousel--classic .peek-carousel__item:not(.peek-carousel--classic .peek-carousel__item--active):not(.peek-carousel--classic .peek-carousel__item--prev):not(.peek-carousel--classic .peek-carousel__item--next) .peek-carousel__image{box-shadow:var(--peek-carousel-card-shadow,0 10px 30px rgba(0,0,0,.3));filter:var(--peek-carousel-image-filter,brightness(.5) saturate(.7))}.peek-carousel--fan .peek-carousel__track{transform:none}.peek-carousel--fan .peek-carousel__item{cursor:pointer;opacity:1;transform:translate(calc(-50% + var(--fan-x) + var(--drag-offset)),calc(-50% + var(--fan-y))) rotate(calc(var(--fan-angle) + var(--drag-rotation))) scale(var(--fan-scale));transform-origin:50% 100%;transition:transform .5s cubic-bezier(.22,1,.36,1);visibility:visible;z-index:var(--fan-layer)}.peek-carousel--fan .peek-carousel__item--active .peek-carousel__image{box-shadow:var(--peek-carousel-active-shadow,var(--peek-carousel-card-shadow,0 18px 45px rgba(0,0,0,.25)))}.peek-carousel--fan .peek-carousel__item .peek-carousel__image{filter:var(--peek-carousel-image-filter,none)}.peek-carousel--fan .peek-carousel__item--fan-repositioning{transition:none}.peek-carousel--fan .peek-carousel__item--fan-hidden{opacity:0;pointer-events:none;visibility:hidden}@media (prefers-reduced-motion:reduce){.peek-carousel--fan .peek-carousel__item{animation:none;transition:none}}.peek-carousel__controls{align-items:center;animation:fadeInUpControls .6s cubic-bezier(.4,0,.2,1) forwards;animation-delay:.6s;display:flex;gap:.75rem;inset:auto auto 3% 50%;opacity:0;position:absolute;transform:translateX(-50%);z-index:100}.peek-carousel__indicators{align-items:center;-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);background:var(--peek-carousel-indicators-background,rgba(0,0,0,.5));border:1px solid hsla(0,0%,100%,.15);border-radius:50px;display:flex;gap:.875rem;padding:.625rem 1rem}.peek-carousel__indicator{align-items:center;background:transparent;border:none;border-radius:50%;cursor:pointer;display:flex;height:10px;justify-content:center;padding:0;position:relative;transition:all .3s ease;width:10px}.peek-carousel__indicator:before{background:var(--peek-carousel-indicator-color,hsla(0,0%,100%,.4));border-radius:50%;content:"";height:10px;transition:all .3s ease;width:10px}.peek-carousel__indicator:hover:before{background:var(--peek-carousel-indicator-color,hsla(0,0%,100%,.6));transform:scale(1.2)}.peek-carousel__indicator--active{border-radius:50px;overflow:hidden;width:50px}.peek-carousel__indicator--active:before{background:var(--peek-carousel-indicator-track-color,hsla(0,0%,100%,.3));border-radius:50px;content:"";height:8px;transition:all .3s ease;width:50px}.peek-carousel__indicator--active:after{background:var(--peek-carousel-indicator-active-color,hsla(0,0%,100%,.95));border-radius:50px;box-shadow:var(--peek-carousel-indicator-shadow,0 2px 8px hsla(0,0%,100%,.3),0 0 12px hsla(0,0%,100%,.2));content:"";height:8px;inset:50% auto auto 0;position:absolute;transform:translateY(-50%);transition:all .3s ease;width:50px}.peek-carousel__indicator--active:hover:before{background:var(--peek-carousel-indicator-track-color,hsla(0,0%,100%,.4))}.peek-carousel__indicator--active:hover:after{background:var(--peek-carousel-indicator-active-color,#fff);box-shadow:var(--peek-carousel-indicator-shadow,0 2px 12px hsla(0,0%,100%,.4),0 0 16px hsla(0,0%,100%,.3))}.peek-carousel__indicator--active.peek-carousel__indicator--progress:after{animation:indicatorProgress linear forwards;animation-duration:var(--progress-duration,2.5s);width:0}.peek-carousel__indicator--completed:after{animation:none;width:50px!important}@keyframes fadeInUpControls{0%{opacity:0;transform:translateX(-50%) translateY(20px)}to{opacity:1;transform:translateX(-50%) translateY(0)}}@keyframes indicatorProgress{0%{width:0}to{width:50px}}.peek-carousel__nav{align-items:center;animation:fadeInUpNav .6s cubic-bezier(.4,0,.2,1) forwards;animation-delay:.5s;display:flex;gap:2rem;inset:auto auto max(8%,3% + var(--peek-carousel-button-size,0px) * 1.2) 50%;opacity:0;position:absolute;transform:translateX(-50%);z-index:100}@media (max-width:768px){.peek-carousel__nav{bottom:max(12%,3% + var(--peek-carousel-button-size,0px) * 1.2)}}.peek-carousel__btn{align-items:center;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);background:var(--peek-carousel-button-background,hsla(0,0%,100%,.1));border:1px solid var(--peek-carousel-button-border-color,hsla(0,0%,100%,.2));border-radius:var(--peek-carousel-button-radius,50%);color:var(--peek-carousel-text-color,#fff);cursor:pointer;display:flex;display:grid;font-family:inherit;font-size:1rem;height:var(--peek-carousel-button-size,36px);justify-content:center;place-items:center;transition:all .3s ease;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:var(--peek-carousel-button-size,36px)}.peek-carousel__btn svg{flex-shrink:0;height:18px;transition:transform .15s ease-out;width:18px}.peek-carousel__btn:hover{background:var(--peek-carousel-button-hover-background,hsla(0,0%,100%,.2));transform:scale(1.1)}.peek-carousel__btn:active{transform:scale(.95)}.peek-carousel__btn:focus-visible{outline:3px solid var(--peek-carousel-focus-color,rgba(102,126,234,.8));outline-offset:4px}.peek-carousel__btn:hover svg{transform:translateX(0)}.peek-carousel__btn.prev-btn:hover svg{transform:translateX(-2px)}.peek-carousel__btn.next-btn:hover svg{transform:translateX(2px)}@media (max-width:768px){.peek-carousel__btn{height:var(--peek-carousel-button-size,36px);width:var(--peek-carousel-button-size,36px)}}.peek-carousel__btn--auto-rotate{align-items:center;-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);background:var(--peek-carousel-button-background,rgba(0,0,0,.5));border:1px solid var(--peek-carousel-button-border-color,hsla(0,0%,100%,.15));border-radius:var(--peek-carousel-button-radius,50%);cursor:pointer;display:flex;height:var(--peek-carousel-button-size,36px);justify-content:center;padding:0;transition:all .3s ease;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:var(--peek-carousel-button-size,36px)}.peek-carousel__btn--auto-rotate svg{flex-shrink:0}.peek-carousel__btn--auto-rotate .play-icon{display:block}.peek-carousel__btn--auto-rotate .pause-icon{display:none}.peek-carousel__btn--auto-rotate:hover{background:var(--peek-carousel-button-hover-background,rgba(0,0,0,.6));border-color:var(--peek-carousel-button-border-color,hsla(0,0%,100%,.3));transform:scale(1.1)}.peek-carousel__btn--auto-rotate:active{transform:scale(.95)}.peek-carousel__btn--auto-rotate:focus-visible{outline:3px solid var(--peek-carousel-focus-color,rgba(102,126,234,.8));outline-offset:4px}.peek-carousel__btn--auto-rotate.peek-carousel__btn--active{background:var(--peek-carousel-button-active-background,hsla(0,0%,100%,.2));border-color:var(--peek-carousel-button-border-color,hsla(0,0%,100%,.3))}.peek-carousel__btn--auto-rotate.peek-carousel__btn--active .play-icon{display:none}.peek-carousel__btn--auto-rotate.peek-carousel__btn--active .pause-icon{display:block}@keyframes fadeInUpNav{0%{opacity:0;transform:translateX(-50%) translateY(20px)}to{opacity:1;transform:translateX(-50%) translateY(0)}}.peek-carousel__counter{animation:fadeInDown .6s cubic-bezier(.4,0,.2,1) forwards;animation-delay:.7s;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);background:var(--peek-carousel-counter-background,rgba(0,0,0,.5));border:1px solid hsla(0,0%,100%,.15);border-radius:20px;color:var(--peek-carousel-text-color,#fff);font-size:.875rem;font-weight:500;inset:3% auto auto 3%;line-height:1;opacity:0;padding:.5rem 1rem;pointer-events:none;position:absolute;transform:translateY(-10px);-webkit-user-select:none;-moz-user-select:none;user-select:none;z-index:100}@media (max-width:768px){.peek-carousel__counter{font-size:.75rem;inset:2% auto auto 2%;padding:.4rem .8rem;position:absolute}}.peek-carousel__counter-separator{margin:0 .25rem;opacity:.7}.peek-carousel__counter-current{font-weight:600}.peek-carousel__counter-total{opacity:.8}@keyframes fadeInDown{to{opacity:1;transform:translateY(0)}}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! PeekCarousel
|
|
1
|
+
/*! PeekCarousel v2.0.1
|
|
2
2
|
* Copyright (c) 2025 PeekCarousel
|
|
3
3
|
* Copyright (c) 2026 PeekCarousel contributors
|
|
4
|
-
* @license
|
|
4
|
+
* @license See LICENSE, LICENSE-MIT and THIRD_PARTY_NOTICES.md.
|
|
5
5
|
*/
|
|
6
6
|
const t=/* @__PURE__ */new WeakMap;function e(t){return new Map([...t.attributes].map(({name:t,value:e})=>[t,e]))}function s(e){const s=t.get(e);if(s&&!s.destroyed)throw new Error("PeekCarousel: call destroy() first");s?.reset(),t.delete(e)}const i=Object.freeze({startIndex:{type:"integer",default:1,minimum:0,maximum:9007199254740991},layoutMode:{type:"string",default:"stack",enum:["stack","radial","classic","fan"]},autoRotate:{type:"boolean",default:!1},autoRotateInterval:{type:"integer",default:2500,minimum:100,maximum:2147483647},swipeThreshold:{type:"number",default:50,minimum:0},dragThreshold:{type:"number",default:80,minimum:0},preloadRange:{type:"integer",default:2,minimum:0,maximum:9007199254740991},enableKeyboard:{type:"boolean",default:!0},enableWheel:{type:"boolean",default:!0},enableTouch:{type:"boolean",default:!0},enableMouse:{type:"boolean",default:!0},showNavigation:{type:"boolean",default:!0},showCounter:{type:"boolean",default:!0},showIndicators:{type:"boolean",default:!0},showAutoRotateButton:{type:"boolean",default:!0}}),a=Object.entries(i),r=Object.freeze(Object.fromEntries(a.map(([t,e])=>[t,e.default])));function o(t,e){return!("integer"===e.type&&!Number.isSafeInteger(t))&&!("number"===e.type&&!Number.isFinite(t))&&("integer"===e.type||typeof t===e.type)&&!(void 0!==e.minimum&&t<e.minimum)&&!(void 0!==e.maximum&&t>e.maximum)&&(!e.enum||e.enum.includes(t))}const n=Object.freeze({item:"peek-carousel__item",itemActive:"peek-carousel__item--active",itemPrev:"peek-carousel__item--prev",itemNext:"peek-carousel__item--next",itemCenter:"peek-carousel__item--center",itemHidden:"peek-carousel__item--hidden",itemDraggingLeft:"peek-carousel__item--dragging-left",itemDraggingRight:"peek-carousel__item--dragging-right",image:"peek-carousel__image",nav:"peek-carousel__nav",navBtn:"nav-btn",btn:"peek-carousel__btn",prevBtn:"prev-btn",nextBtn:"next-btn",autoRotateBtn:"auto-rotate-btn",btnAutoRotate:"peek-carousel__btn--auto-rotate",btnActive:"peek-carousel__btn--active",controls:"peek-carousel__controls",indicators:"peek-carousel__indicators",indicator:"indicator",indicatorPeek:"peek-carousel__indicator",indicatorActive:"peek-carousel__indicator--active",indicatorProgress:"peek-carousel__indicator--progress",indicatorCompleted:"peek-carousel__indicator--completed",counter:"peek-carousel__counter",counterCurrent:"peek-carousel__counter-current",counterSeparator:"peek-carousel__counter-separator",counterTotal:"peek-carousel__counter-total"}),l=Object.freeze({carousel:".peek-carousel__track",item:".peek-carousel__item",prevBtn:".prev-btn",nextBtn:".next-btn",autoRotateBtn:".auto-rotate-btn"}),c=Object.freeze({current:"aria-current",pressed:"aria-pressed"}),u=Object.freeze({mobile:768}),h=Object.freeze({transition:500,progressReset:10}),d=Object.freeze({arrowLeft:"ArrowLeft",arrowRight:"ArrowRight",home:"Home",end:"End",space:" "});function m(t,...e){t instanceof HTMLElement&&e.length>0&&t.classList.add(...e)}function p(t,...e){t instanceof HTMLElement&&e.length>0&&t.classList.remove(...e)}function g(t,e,s){t instanceof HTMLElement&&e&&t.setAttribute(e,s)}function f(t,e){if(!Number.isSafeInteger(t))throw new TypeError("PeekCarousel: 인덱스는 안전한 정수여야 합니다");return e<=0?0:(t%e+e)%e}const v=/* @__PURE__ */new Map,y=/* @__PURE__ */new Set;let b=0;class I{constructor(t){this.carousel=t}get currentIndex(){return this.carousel.state.currentIndex}set currentIndex(t){this.carousel.state.currentIndex=f(t,this.carousel.totalItems)}getShortestDistance(t,e){const s=this.carousel.totalItems,i=f(e,s),a=f(t,s),r=(i-a+s)%s,o=(a-i+s)%s;return r<=o?r:-o}isNearby(t,e){return Math.abs(this.getShortestDistance(t,e))<=2}updateAfterNavigation(){this.carousel.animator.updateCarousel(),this.carousel.updateCounter(),this.carousel.options.preloadRange>0&&this.carousel.preloadImages()}rotate(t){this.currentIndex=this.currentIndex+t,this.updateAfterNavigation()}next(){this.rotate(1)}prev(){this.rotate(-1)}goTo(t){const e=f(t,this.carousel.totalItems);e!==this.currentIndex&&(this.currentIndex=e,this.updateAfterNavigation())}navigateIfDifferent(t,e){const s=f(t,this.carousel.totalItems);return s!==this.currentIndex&&(e(s),!0)}handleItemClick(t){this.navigateIfDifferent(t,t=>{const{layoutMode:e}=this.carousel.options;"radial"===e?this.handleRadialItemClick(t):this.handleStackItemClick(t)})}handleRadialItemClick(t){const e=this.getShortestDistance(this.currentIndex,t);if(Math.abs(e)>1){const t=e>0?1:-1;this.rotate(t)}else this.rotate(e)}handleStackItemClick(t){if(this.isNearby(this.currentIndex,t)){const e=this.getShortestDistance(this.currentIndex,t);this.rotate(e)}else this.goTo(t)}handleIndicatorClick(t){this.navigateIfDifferent(t,t=>{const{layoutMode:e}=this.carousel.options;if("radial"===e){const e=this.getShortestDistance(this.currentIndex,t);this.rotate(e)}else this.goTo(t)})}}function x(t){const e=Math.abs(t);return`translate(calc(-50% + ${38*t}%), calc(-50% + ${e*e*12}px)) rotate(${12*t}deg) scale(${1-.08*e})`}function k(t,e,s,i){const a=t.carousel.items[e];if("function"!=typeof a.animate||window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;const r="translate(-50%, -50%) scale(0.65)",o=Math.abs(s)<=2?x(s):r,n=a.animate([{transform:o,zIndex:0},{transform:r,zIndex:0,offset:.4},{transform:r,zIndex:0,offset:.6},{transform:x(i),zIndex:0}],{duration:500,easing:"cubic-bezier(0.22, 1, 0.36, 1)"});t.fanAnimations.set(e,n),n.onfinish=()=>{t.fanAnimations.get(e)===n&&t.fanAnimations.delete(e)}}const w=[n.itemCenter,n.itemPrev,n.itemNext,n.itemHidden];class A{constructor(t){this.carousel=t,this.momentumAnimation=null,this.isAnimating=!1,this.previousIndex=null,this.stackIndex=null,this.fanIndex=null,this.fanAnimations=/* @__PURE__ */new Map,this.radialGeometry=null,this.transitionFrame=null,this.classicWidth=null,this.classicSpacing=null,this.classicTransitions=/* @__PURE__ */new Set}normalizeAngleDiff(t){return((t+180)%360+360)%360-180}round(t,e=2){return Math.round(t*10**e)/10**e}getAdjacentIndices(t){return{prev:f(t-1,this.carousel.totalItems),next:f(t+1,this.carousel.totalItems)}}setCarouselRotation(t){const e=this.round(t,2);this.setCSSVariables(this.carousel.container,{"--carousel-rotation":`${e}deg`})}setCSSVariables(t,e){for(const[s,i]of Object.entries(e))t.style.getPropertyValue(s)!==i&&t.style.setProperty(s,i)}updateRadialRotation(t){return function(t,e){const s=-t.carousel.state.angleUnit*e,i=t.carousel.container.style.getPropertyValue("--carousel-rotation");if(!i)return void t.setCarouselRotation(s);const a=Number(i.replace(/deg$/,""));if(!Number.isFinite(a))return void t.setCarouselRotation(s);const r=a+t.normalizeAngleDiff(s-a);t.setCarouselRotation(r)}(this,t)}updateCarousel(t=!1){const{currentIndex:e}=this.carousel.state,{layoutMode:s}=this.carousel.options;"classic"!==s||!t&&null!==this.classicWidth&&"function"==typeof ResizeObserver||(this.classicWidth=this.carousel.container.offsetWidth),"radial"!==s?this.setCarouselRotation(0):this.updateRadialRotation(e),this.updateActiveItem()}updateActiveItem(){const{currentIndex:t}=this.carousel.state,{layoutMode:e}=this.carousel.options;this.carousel.ui.updateActiveStates(t),"radial"===e?this.updateRadialPositions(t):"fan"===e?function(t,e){const{items:s,totalItems:i}=t.carousel,a=t.fanIndex,r=null===a?s.map((t,e)=>e):new Set([a,e].flatMap(t=>[-2,-1,0,1,2].map(e=>((t+e)%i+i)%i)));for(const l of r){let r=(l-e+i)%i;r>i/2&&(r-=i);const o=Math.abs(r);let n=null;if(a!==e){t.fanAnimations.get(l)?.cancel(),t.fanAnimations.delete(l);let e=(l-a+i)%i;e>i/2&&(e-=i);const c=o<=2&&null!==a&&(Math.abs(e)>2||r*e<0&&Math.abs(r-e)>1);n=c?e:null,s[l].classList.toggle("peek-carousel__item--fan-repositioning",c)}s[l].classList.toggle("peek-carousel__item--fan-hidden",o>2),o>2||(t.setCSSVariables(s[l],{"--fan-x":38*r+"%","--fan-y":o*o*12+"px","--fan-angle":12*r+"deg","--fan-scale":String(1-.08*Math.min(o,3)),"--fan-layer":String(100-o)}),null!==n&&k(t,l,n,r))}t.fanIndex=e;const{prev:o,next:n}=t.getAdjacentIndices(e);t.carousel.ui.setPeekItems(o,n)}(this,t):"classic"===e?this.updateClassicPositions(t):this.updateStackPositions(t)}updateRadialPositions(t){return function(t,e){const{angleUnit:s}=t.carousel.state,i=`${s}:${t.carousel.items.length}`;if(t.radialGeometry!==i){for(let e=0;e<t.carousel.items.length;e++)t.setCSSVariables(t.carousel.items[e],{"--item-angle":`${t.round(s*e,2)}deg`,"--item-radius":"400px"});t.radialGeometry=i}const{prev:a,next:r}=t.getAdjacentIndices(e);t.carousel.ui.setPeekItems(a,r)}(this,t)}updateStackPositions(t){return function(t,e){const{prev:s,next:i}=t.getAdjacentIndices(e),a=t.stackIndex,r=null===a?null:t.getAdjacentIndices(a),o=null===a?t.carousel.items.map((t,e)=>e):/* @__PURE__ */new Set([a,r.prev,r.next,e,s,i]);for(const l of o){const a=t.carousel.items[l],r=l===e?n.itemCenter:l===s?n.itemPrev:l===i?n.itemNext:n.itemHidden;a.classList.contains(r)||(a.classList.remove(...w),a.classList.add(r))}t.stackIndex=e}(this,t)}calculateClassicSpacing(t){return function(t){return t<=0&&(t=300),Math.max(300,Math.min(.35*t,500))/t*50+5+(t<=768?40:15)}(t)}getWrapInfo(t,e){return function(t,e,s){if(null===e)return{isWrap:!1,direction:0};const i=s-e,a=Math.abs(i)===t.carousel.totalItems-1,r=i>0?1:-1;return{isWrap:a,direction:a?-r:r}}(this,t,e)}getClassicItemPosition(t,e,s,i){return function(t,e,s,i,a=t.getAdjacentIndices(s)){const{prev:r,next:o}=a,n=t.carousel.totalItems;return e===s?{x:50,scale:1,isCenter:!0}:e===r?{x:50-i,scale:1,isPrev:!0}:e===o?{x:50+i,scale:1,isNext:!0}:{x:50+((e-s+n)%n<(s-e+n)%n?2:-2)*i,scale:.85,isHidden:!0}}(this,t,e,s,i)}updateClassicPositions(t){return function(t,e){const s=t.previousIndex,i=t.getAdjacentIndices(e),{prev:a,next:r}=i,o=t.classicWidth??t.carousel.container.offsetWidth,n=t.calculateClassicSpacing(o),{isWrap:l}=t.getWrapInfo(s,e),c=t.carousel.items,u=t.getAdjacentIndices(s??e),h=c.length,d=null===s?0:(e-s+h)%h,m=/* @__PURE__ */new Set([e,a,r,s,u.prev,u.next]),p=Math.ceil(h/2),g=t.classicSpacing!==n||null===s||0!==d&&1!==d&&d!==h-1?new Set(c.keys()):/* @__PURE__ */new Set([...m,(s+p)%h,(e+p)%h]);let f=!1;for(const v of m){const e=c[v];t.classicTransitions.delete(e)&&(e.style.transition="",f=!0)}if(l)for(const v of g)if(!m.has(v)){const e=c[v];e.style.transition="none",t.classicTransitions.add(e),f=!0}f&&t.carousel.container.offsetHeight;for(const v of g){const s=c[v],a=t.getClassicItemPosition(v,e,n,i);t.setCSSVariables(s,{"--item-x":`${t.round(a.x,2)}%`,"--item-scale":String(a.scale)}),a.isCenter?t.setItemVisibility(s,"1","visible","100"):a.isPrev||a.isNext?t.setItemVisibility(s,"0.6","visible","50"):t.setItemVisibility(s,"0","hidden","0")}l&&(null!==t.transitionFrame&&cancelAnimationFrame(t.transitionFrame),t.transitionFrame=requestAnimationFrame(()=>{t.transitionFrame=null;for(const e of t.classicTransitions)e.style.transition="";t.classicTransitions.clear()})),t.classicSpacing=n,t.previousIndex=e,t.carousel.ui.setPeekItems(a,r)}(this,t)}setItemVisibility(t,e,s,i){return function(t,e,s,i){t.style.opacity!==e&&(t.style.opacity=e),t.style.visibility!==s&&(t.style.visibility=s),t.style.zIndex!==i&&(t.style.zIndex=i)}(t,e,s,i)}destroy(){for(const t of this.fanAnimations.values())t.cancel();this.fanAnimations.clear(),this.stopMomentum(),null!==this.transitionFrame&&cancelAnimationFrame(this.transitionFrame),this.transitionFrame=null;for(const t of this.classicTransitions)t.style.transition="";this.classicTransitions.clear()}startMomentum(t){this.stopMomentum();let e=t;const s=()=>{if(e*=.92,Math.abs(e)<.05)this.stopMomentum();else{if(Math.abs(e)>1.5){const t=e>0?-1:1;this.carousel.navigator.rotate(t),e*=.6}this.momentumAnimation=requestAnimationFrame(s)}};this.isAnimating=!0,this.momentumAnimation=requestAnimationFrame(s)}stopMomentum(){this.momentumAnimation&&(cancelAnimationFrame(this.momentumAnimation),this.momentumAnimation=null),this.isAnimating=!1}}class C{constructor(t){this.carousel=t,this.interval=null,this.isActive=!1}setActiveState(t){this.isActive=t,this.carousel.ui.updateAutoRotateButton(t)}toggle(){this.isActive?this.stop():this.start()}start(){if(this.isActive)return;this.setActiveState(!0);const t=this.carousel.options.autoRotateInterval;this.interval=setInterval(()=>{this.carousel.navigator.next()},t)}stop(){this.isActive&&(this.setActiveState(!1),this.interval&&(clearInterval(this.interval),this.interval=null))}destroy(){this.stop(),this.carousel=null}}const S=Object.freeze({threshold:50,timeout:150,cooldown:100}),M=Object.freeze({touchThreshold:15,mouseThreshold:10,velocityThreshold:.5});let T=0;class R{constructor(t){this.carousel=t,this.boundHandlers=/* @__PURE__ */new Map,this.resizeTimer=null,this.resizeObserver=null,this.dragFrame=null,this.pendingDrag=null,this.touch={startX:0,endX:0},this.drag={active:!1,startX:0,currentX:0,lastX:0,lastTime:0,velocity:0},this.wheel={isScrolling:!1,scrollTimeout:null,lastWheelTime:0,accumulatedDelta:0}}init(){this.initNavigationButtons(),this.initKeyboard(),this.initWheel(),this.initItemClick(),this.initIndicatorClick(),this.initTouch(),this.initMouse(),this.initResize()}stopAutoRotateAndNavigate(t){this.completeCurrentIndicator(),this.carousel.autoRotate.stop(),t()}completeCurrentIndicator(){const t=this.carousel.indicators[this.carousel.state.currentIndex];t&&t.classList.contains("peek-carousel__indicator--active")&&t.classList.add("peek-carousel__indicator--completed")}resetDragState(t){this.cancelDragFrame(),this.carousel.ui.removeDraggingClass(t),this.carousel.ui.clearDragTransform()}queueDragTransform(t,e,s){this.pendingDrag={distance:t,index:e,threshold:s},null===this.dragFrame&&(this.dragFrame=requestAnimationFrame(()=>{this.dragFrame=null;const t=this.pendingDrag;this.pendingDrag=null,t&&this.carousel&&(this.carousel.ui.updateDragTransform(t.distance),this.updateDraggingClass(t.distance,t.index,t.threshold))}))}cancelDragFrame(){null!==this.dragFrame&&cancelAnimationFrame(this.dragFrame),this.dragFrame=null,this.pendingDrag=null}updateDraggingClass(t,e,s){t>s?this.carousel.ui.addDraggingClass(e,"right"):t<-s&&this.carousel.ui.addDraggingClass(e,"left")}initDragState(t){this.drag.active=!0,this.drag.startX=t,this.drag.currentX=t,this.drag.lastX=t,this.drag.lastTime=Date.now(),this.drag.velocity=0}resetMouseCursor(){this.carousel.elements.carousel.style.cursor="grab"}calculateWheelDelta(t){return Math.abs(t.deltaX)>Math.abs(t.deltaY)?-t.deltaX:t.deltaY}resetWheelState(){this.wheel.isScrolling=!1,this.wheel.accumulatedDelta=0}initNavigationButtons(){const{prevBtn:t,nextBtn:e,autoRotateBtn:s}=this.carousel.elements;t&&this.addHandler(t,"click",()=>{this.stopAutoRotateAndNavigate(()=>this.carousel.navigator.prev())}),e&&this.addHandler(e,"click",()=>{this.stopAutoRotateAndNavigate(()=>this.carousel.navigator.next())}),s&&this.addHandler(s,"click",()=>{this.carousel.autoRotate.toggle()})}initKeyboard(){if(!this.carousel.options.enableKeyboard)return;const t=this.carousel.container;t.hasAttribute("tabindex")||t.setAttribute("tabindex","0"),this.addHandler(t,"keydown",t=>{if(t.defaultPrevented||t.isComposing||t.altKey||t.ctrlKey||t.metaKey)return;const e=t.target,s=this.carousel.indicators.includes(e);if(e.closest('input, textarea, select, a, button, [role="button"], [contenteditable]:not([contenteditable="false"])')&&!s)return;if(s&&(t.key===d.space||"Enter"===t.key))return;const{navigator:i,autoRotate:a,totalItems:r}=this.carousel;switch(t.key){case d.arrowLeft:t.preventDefault(),a.stop(),i.prev();break;case d.arrowRight:t.preventDefault(),a.stop(),i.next();break;case d.home:t.preventDefault(),a.stop(),i.goTo(0);break;case d.end:t.preventDefault(),a.stop(),i.goTo(r-1);break;case d.space:t.preventDefault(),a.toggle();break;default:{const e=Number(t.key);1===t.key.length&&e>=1&&e<=r&&(t.preventDefault(),a.stop(),i.goTo(e-1))}}s&&t.defaultPrevented&&this.carousel.indicators[this.carousel.state.currentIndex]?.focus()})}initWheel(){this.carousel.options.enableWheel&&this.addHandler(this.carousel.elements.carousel,"wheel",t=>{const e=Math.abs(t.deltaX),s=Math.abs(t.deltaY);if(e<1&&s<1)return;if(e===s)return;t.preventDefault();const i=Date.now();if(!(i-this.wheel.lastWheelTime<S.cooldown)){if(this.wheel.isScrolling||(this.wheel.isScrolling=!0,this.wheel.accumulatedDelta=0,this.carousel.autoRotate.stop(),this.carousel.animator.stopMomentum()),this.wheel.accumulatedDelta+=this.calculateWheelDelta(t),Math.abs(this.wheel.accumulatedDelta)>=S.threshold){const t=this.wheel.accumulatedDelta>0?1:-1;this.carousel.navigator.rotate(t),this.wheel.accumulatedDelta=0,this.wheel.lastWheelTime=i}clearTimeout(this.wheel.scrollTimeout),this.wheel.scrollTimeout=setTimeout(()=>{this.resetWheelState()},S.timeout)}},{passive:!1})}initItemClick(){const{items:t}=this.carousel;for(let e=0;e<t.length;e++)this.addHandler(t[e],"click",()=>{this.carousel.autoRotate.stop(),this.carousel.navigator.handleItemClick(e)})}initIndicatorClick(){const{indicators:t}=this.carousel;for(let e=0;e<t.length;e++)this.addHandler(t[e],"click",()=>{this.carousel.autoRotate.stop(),this.carousel.navigator.handleIndicatorClick(e)})}initTouch(){this.carousel.options.enableTouch&&(this.addHandler(this.carousel.elements.carousel,"touchstart",t=>{this.touch.startX=t.changedTouches[0].screenX}),this.addHandler(this.carousel.elements.carousel,"touchmove",t=>{const e=t.changedTouches[0].screenX-this.touch.startX,{currentIndex:s}=this.carousel.state;this.queueDragTransform(e,s,M.touchThreshold)}),this.addHandler(this.carousel.elements.carousel,"touchend",t=>{this.touch.endX=t.changedTouches[0].screenX;const e=this.touch.endX-this.touch.startX,{swipeThreshold:s}=this.carousel.options,{currentIndex:i}=this.carousel.state;this.resetDragState(i),e<-s?(this.carousel.autoRotate.stop(),this.carousel.navigator.next()):e>s&&(this.carousel.autoRotate.stop(),this.carousel.navigator.prev())}),this.addHandler(this.carousel.elements.carousel,"touchcancel",()=>{this.resetDragState(this.carousel.state.currentIndex)}))}initMouse(){this.carousel.options.enableMouse&&(this.addHandler(this.carousel.elements.carousel,"mousedown",t=>{window.innerWidth<=768||(this.initDragState(t.clientX),this.carousel.autoRotate.stop(),this.carousel.animator.stopMomentum(),this.carousel.elements.carousel.style.cursor="grabbing",t.preventDefault())}),this.addHandler(document,"mousemove",t=>{if(!this.drag.active)return;const e=Date.now(),s=e-this.drag.lastTime,i=t.clientX-this.drag.lastX;s>0&&(this.drag.velocity=i/s),this.drag.currentX=t.clientX,this.drag.lastX=t.clientX,this.drag.lastTime=e;const a=this.drag.currentX-this.drag.startX,{currentIndex:r}=this.carousel.state;if(this.queueDragTransform(a,r,M.mouseThreshold),Math.abs(a)>this.carousel.options.dragThreshold){const t=a>0?-1:1;this.carousel.navigator.rotate(t),this.drag.startX=this.drag.currentX,this.resetDragState(r)}}),this.addHandler(document,"mouseup",()=>{if(!this.drag.active)return;this.drag.active=!1,this.resetMouseCursor();const{currentIndex:t}=this.carousel.state;this.resetDragState(t),Math.abs(this.drag.velocity)>M.velocityThreshold&&this.carousel.animator.startMomentum(this.drag.velocity)}),this.addHandler(this.carousel.elements.carousel,"mouseleave",()=>{if(this.drag.active){this.drag.active=!1,this.resetMouseCursor();const{currentIndex:t}=this.carousel.state;this.resetDragState(t)}}),window.innerWidth>u.mobile&&this.resetMouseCursor())}initResize(){const t=()=>{clearTimeout(this.resizeTimer),this.resizeTimer=setTimeout(()=>{this.carousel&&this.carousel.animator.updateCarousel(!0)},100)};this.addHandler(window,"resize",t),"classic"===this.carousel.options.layoutMode&&"function"==typeof ResizeObserver&&(this.resizeObserver=new ResizeObserver(()=>{this.carousel&&this.carousel.container.offsetWidth!==this.carousel.animator.classicWidth&&t()}),this.resizeObserver.observe(this.carousel.container,{box:"border-box"}))}addHandler(t,e,s,i){t.addEventListener(e,s,i);const a=`${e}-${++T}`;this.boundHandlers.set(a,{element:t,event:e,handler:s,options:i})}destroy(){this.cancelDragFrame(),this.resizeObserver?.disconnect(),this.resizeObserver=null,this.wheel.scrollTimeout&&(clearTimeout(this.wheel.scrollTimeout),this.wheel.scrollTimeout=null),this.resizeTimer&&(clearTimeout(this.resizeTimer),this.resizeTimer=null);for(const{element:t,event:e,handler:s,options:i}of this.boundHandlers.values())t.removeEventListener(e,s,i);this.boundHandlers.clear(),this.drag.active=!1,this.drag.velocity=0,this.wheel.isScrolling=!1,this.wheel.accumulatedDelta=0,this.carousel=null}}const D=/* @__PURE__ */new Map;function _(t){return String(t).replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"}[t]))}const P={prev:{path:"M15 18L9 12L15 6",options:{}},next:{path:"M9 18L15 12L9 6",options:{}},play:{path:"M8 6.5v11l9-5.5z",options:{fill:"currentColor",stroke:"currentColor",strokeWidth:0,strokeLinecap:"round",strokeLinejoin:"round"}},pause:{path:"M7 5.5C7 5.22386 7.22386 5 7.5 5H9.5C9.77614 5 10 5.22386 10 5.5V18.5C10 18.7761 9.77614 19 9.5 19H7.5C7.22386 19 7 18.7761 7 18.5V5.5ZM14 5.5C14 5.22386 14.2239 5 14.5 5H16.5C16.7761 5 17 5.22386 17 5.5V18.5C17 18.7761 16.7761 19 16.5 19H14.5C14.2239 19 14 18.7761 14 18.5V5.5Z",options:{fill:"currentColor",stroke:"none"}}};function L(t,e={}){const s=Object.prototype.hasOwnProperty.call(P,t)?P[t]:null;if(!s)return console.warn("PeekCarousel: unknown icon"),"";const i={...s.options,...e};return function(t,e={}){const{width:s=24,height:i=24,viewBox:a="0 0 24 24",fill:r="none",stroke:o="currentColor",strokeWidth:n=2,strokeLinecap:l="round",strokeLinejoin:c="round",className:u=""}=e,h=`${t}-${JSON.stringify(e)}`;if(D.has(h))return D.get(h);const d=`<svg width="${_(s)}" height="${_(i)}" viewBox="${_(a)}" fill="${_(r)}" xmlns="http://www.w3.org/2000/svg" class="${_(u)}"><path d="${_(t)}" stroke="${_(o)}" stroke-width="${_(n)}" stroke-linecap="${_(l)}" stroke-linejoin="${_(c)}"/></svg>`;return D.size>=100&&D.delete(D.keys().next().value),D.set(h,d),d}(s.path,i)}function N(t,e,s={}){if(!(t&&t instanceof HTMLElement))return;if(t.querySelector("svg"))return;const i=L(e,s);i&&(t.innerHTML=i)}const $=Object.freeze({stack:{maxDrag:200,offsetMultiplier:100,rotationMultiplier:3},radial:{rotationSensitivity:.2},classic:{dragSensitivity:.5}});class H{constructor(t){this.carousel=t,this.progressTimers=/* @__PURE__ */new Map,this.previousIndex=null,this.peekIndices=null}createNavigation(){if(!this.carousel.options.showNavigation)return;const t=this.carousel.container.querySelector(`.${n.nav}`);if(t)return this.carousel.elements.nav=t,this.carousel.elements.prevBtn=t.querySelector(l.prevBtn),void(this.carousel.elements.nextBtn=t.querySelector(l.nextBtn));const e=document.createElement("div");e.className=n.nav;const[s,i]=[[n.prevBtn,"Previous"],[n.nextBtn,"Next"]].map(([t,s])=>{const i=document.createElement("button");return i.type="button",i.className=`${n.navBtn} ${n.btn} ${t}`,i.setAttribute("aria-label",s),e.appendChild(i),i});this.carousel.container.appendChild(e),this.carousel.elements.nav=e,this.carousel.elements.prevBtn=s,this.carousel.elements.nextBtn=i}createControls(){if(!this.carousel.options.showIndicators&&!this.carousel.options.showAutoRotateButton)return;const t=this.carousel.container.querySelector(`.${n.controls}`);if(t){this.carousel.elements.controls=t;const e=t.querySelector(`.${n.indicators}`);return e&&this.carousel.options.showIndicators&&(e.innerHTML="",this.createIndicators(e)),void(this.carousel.elements.autoRotateBtn=t.querySelector(l.autoRotateBtn))}const e=document.createElement("div");if(e.className=n.controls,this.carousel.options.showIndicators){const t=document.createElement("div");t.className=n.indicators,this.createIndicators(t),e.appendChild(t)}if(this.carousel.options.showAutoRotateButton){const t=document.createElement("button");t.type="button",t.className=`${n.autoRotateBtn} ${n.btn} ${n.btnAutoRotate}`,t.setAttribute("aria-label","Toggle auto-rotate"),t.setAttribute("aria-pressed","false"),e.appendChild(t),this.carousel.elements.autoRotateBtn=t}this.carousel.container.appendChild(e),this.carousel.elements.controls=e}createIndicators(t){this.carousel.indicators=[],t.setAttribute("role","group"),t.setAttribute("aria-label","Choose a slide");for(let e=0;e<this.carousel.totalItems;e++){const s=document.createElement("button");s.type="button";const i=e===this.carousel.state.currentIndex;s.className=n.indicator,s.classList.add(n.indicatorPeek),s.setAttribute("aria-label",`Image ${e+1}`),s.setAttribute("aria-pressed",i?"true":"false"),i&&s.classList.add(n.indicatorActive),t.appendChild(s),this.carousel.indicators.push(s)}}injectIcons(){const{prevBtn:t,nextBtn:e,autoRotateBtn:s}=this.carousel.elements;t&&N(t,"prev"),e&&N(e,"next"),s&&function(t){if(!(t&&t instanceof HTMLElement))return;if(t.querySelector("svg"))return;const e=L("play",{className:"play-icon"}),s=L("pause",{className:"pause-icon"});e&&s&&(t.innerHTML=e+s)}(s)}createCounter(){if(!this.carousel.options.showCounter)return;const t=this.carousel.container.querySelector(`.${n.counter}`);if(t)return this.carousel.counterElement=t,void this.updateCounter();const e=document.createElement("div");e.className=n.counter,e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true");for(const[s,i]of[[n.counterCurrent,this.carousel.state.currentIndex+1],[n.counterSeparator,"/"],[n.counterTotal,this.carousel.totalItems]]){const t=document.createElement("span");t.className=s,t.textContent=i,e.appendChild(t)}this.carousel.container.appendChild(e),this.carousel.counterElement=e}updateCounter(){if(!this.carousel.counterElement)return;const t=this.carousel.counterElement.querySelector(`.${n.counterCurrent}`);t&&(t.textContent=this.carousel.state.currentIndex+1)}updateActiveStates(t){this.clearProgressTimers();const e=null===this.previousIndex?this.carousel.items.map((t,e)=>e):[this.previousIndex];for(const a of e){const t=this.carousel.items[a];p(t,n.itemActive),t?.removeAttribute(c.current);const e=this.carousel.indicators[a];p(e,n.indicatorActive,n.indicatorProgress),g(e,c.pressed,"false")}this.clearPeekItems(),this.previousIndex=t;const s=this.carousel.items[t],i=this.carousel.indicators[t];s&&(m(s,n.itemActive),g(s,c.current,"true")),i&&(p(i,n.indicatorCompleted),m(i,n.indicatorActive),g(i,c.pressed,"true"),this.carousel.autoRotate.isActive&&this.updateIndicatorProgress(i))}updateIndicatorProgress(t){var e,s,i;clearTimeout(this.progressTimers.get(t)),e=t,s="--progress-duration",i=`${this.carousel.options.autoRotateInterval}ms`,e instanceof HTMLElement&&s&&e.style.setProperty(s,i);const a=setTimeout(()=>{this.progressTimers.delete(t),this.carousel.autoRotate.isActive&&t.classList.contains(n.indicatorActive)&&m(t,n.indicatorProgress)},h.progressReset);this.progressTimers.set(t,a)}clearPeekItems(){const t=this.peekIndices??this.carousel.items.map((t,e)=>e);for(const e of t)p(this.carousel.items[e],n.itemPrev,n.itemNext);this.peekIndices=[]}setPeekItems(t,e){const s=this.carousel.items[t],i=this.carousel.items[e];s&&m(s,n.itemPrev),i&&m(i,n.itemNext),this.peekIndices=[t,e]}updateAutoRotateButton(t){const{autoRotateBtn:e}=this.carousel.elements;e&&(e.classList.toggle(n.btnActive,t),g(e,c.pressed,String(t)))}addDraggingClass(t,e){const s=this.carousel.items[t];if(!s)return;const i=n.itemDraggingLeft,a=n.itemDraggingRight;p(s,i,a),"left"===e?m(s,i):"right"===e&&m(s,a)}removeDraggingClass(t){const e=this.carousel.items[t];e&&p(e,n.itemDraggingLeft,n.itemDraggingRight)}round(t,e=2){return Math.round(t*10**e)/10**e}applyEasing(t){return t*(2-Math.abs(t))}updateDragTransform(t){const{layoutMode:e}=this.carousel.options;if("stack"===e||"fan"===e){const e=$.stack,s=Math.max(-e.maxDrag,Math.min(e.maxDrag,t))/e.maxDrag,i=this.applyEasing(s),a=this.round(i*e.offsetMultiplier),r=this.round(i*e.rotationMultiplier);this.carousel.container.style.setProperty("--drag-offset",`${a}px`),this.carousel.container.style.setProperty("--drag-rotation",`${r}deg`)}else if("radial"===e){const e=$.radial,s=this.round(t*e.rotationSensitivity);this.carousel.container.style.setProperty("--drag-rotation-y",`${s}deg`)}else if("classic"===e){const e=$.classic,s=this.round(t*e.dragSensitivity);this.carousel.container.style.setProperty("--drag-offset",`${s}px`)}}clearDragTransform(){this.carousel.container.style.setProperty("--drag-offset","0px"),this.carousel.container.style.setProperty("--drag-rotation","0deg"),this.carousel.container.style.setProperty("--drag-rotation-y","0deg")}clearProgressTimers(){for(const t of this.progressTimers.values())clearTimeout(t);this.progressTimers.clear()}destroy(){this.clearProgressTimers()}}class z{constructor(i,n={}){if(this.counterElement=null,this.currentLayoutMode=null,this.container=function(t){return"string"==typeof t?document.querySelector(t):t instanceof HTMLElement?t:null}(i),!this.container)throw new Error("PeekCarousel: container not found");if(s(this.container),this.options=function(t={}){const e=t&&"object"==typeof t&&!Array.isArray(t)?t:{},s={...r};for(const[i,r]of a){if(!Object.prototype.hasOwnProperty.call(e,i))continue;const t=e[i];o(t,r)?s[i]=t:"startIndex"===i||"preloadRange"===i?console.warn(`PeekCarousel: ${i}는 0 이상이어야 합니다. 기본값 ${r.default} 사용`):"layoutMode"===i?console.warn("PeekCarousel: invalid layoutMode; using stack"):"autoRotateInterval"===i&&console.warn("PeekCarousel: autoRotateInterval은 100ms 이상이어야 합니다. 기본값 2500 사용")}return s}(n),this.initElements(),0===this.items.length)throw new Error("PeekCarousel: 캐러셀 아이템을 찾을 수 없습니다");this.state={currentIndex:f(this.options.startIndex,this.totalItems),angleUnit:360/this.totalItems},this.markupState=function(s){const{container:i}=s,a=/* @__PURE__ */new Map,r=/* @__PURE__ */new Map;for(const t of[i,...i.querySelectorAll("*")])a.set(t,e(t)),t.closest(".peek-carousel__nav, .peek-carousel__controls, .peek-carousel__counter")&&r.set(t,[...t.childNodes]);const o=[],n=[],l={destroyed:!1,finish(){l.destroyed=!0;for(const[t,s]of a){const i=e(t);for(const e of/* @__PURE__ */new Set([...s.keys(),...i.keys()]))s.get(e)!==i.get(e)&&o.push([t,e,s.get(e),i.get(e)])}for(const[t,e]of r)n.push([t,e,[...t.childNodes]])},reset(){for(const t of[s.elements.nav,s.elements.controls,s.counterElement])t&&!a.has(t)&&t.remove();for(const[t,e,s,i]of o)t.getAttribute(e)===(i??null)&&(void 0===s?t.removeAttribute(e):t.setAttribute(e,s));for(const[t,e,s]of n)t.childNodes.length===s.length&&s.every((e,s)=>t.childNodes[s]===e)&&t.replaceChildren(...e)}};return t.set(i,l),l}(this),this.initModules();try{this.init()}catch(l){throw this.destroy(),s(this.container),l}}initElements(){if(this.elements={carousel:this.container.querySelector(l.carousel),prevBtn:null,nextBtn:null,autoRotateBtn:null,controls:null,nav:null},!this.elements.carousel)throw new Error("PeekCarousel: missing track");this.items=function(t,e=document){return"string"!=typeof t?[]:Array.from(e.querySelectorAll(t))}(l.item,this.elements.carousel),this.totalItems=this.items.length,this.indicators=[]}initModules(){this.navigator=new I(this),this.animator=new A(this),this.autoRotate=new C(this),this.eventHandler=new R(this),this.ui=new H(this)}init(){this.updateLayoutClass(),this.createNavigation(),this.createControls(),this.injectIcons(),this.createCounter(),this.setImageLoadingAttributes(),this.initCSSVariables(),this.eventHandler.init(),this.animator.updateCarousel(),this.options.autoRotate&&this.autoRotate.start(),this.options.preloadRange>0&&this.preloadImages()}initCSSVariables(){this.container.style.setProperty("--carousel-rotation","0deg"),this.ui.clearDragTransform()}createNavigation(){return this.ui.createNavigation()}createControls(){return this.ui.createControls()}createIndicators(t){return this.ui.createIndicators(t)}injectIcons(){return this.ui.injectIcons()}createCounter(){return this.ui.createCounter()}updateCounter(){return this.ui.updateCounter()}setImageLoadingAttributes(){const t=this.state.currentIndex,e=this.options.preloadRange;for(let s=0;s<this.items.length;s++){const i=this.items[s].querySelector(`.${n.image}`);if(!i)continue;if(i.hasAttribute("decoding")||i.setAttribute("decoding","async"),s!==t||i.hasAttribute("fetchpriority")||i.setAttribute("fetchpriority","high"),i.hasAttribute("loading"))continue;const a=Math.abs(s-t),r=Math.min(a,this.totalItems-a)<=e;i.setAttribute("loading",r?"eager":"lazy")}}updateLayoutClass(){const t=this.currentLayoutMode,e=this.options.layoutMode;t&&t!==e&&this.container.classList.remove(`peek-carousel--${t}`),this.container.classList.add(`peek-carousel--${e}`),this.currentLayoutMode=e}preloadImages(){!function(t,e,s){if(!t||0===t.length||!Number.isSafeInteger(s)||s<0||!Number.isSafeInteger(e))return;const i=t.length;e=(e%i+i)%i;const a=Math.min(s,Math.floor(i/2)),r=/* @__PURE__ */new Set;for(let o=1;o<=a;o++){const s=(e-o+i)%i,a=(e+o)%i,n=s===a?[s]:[s,a];for(const e of n){const s=t[e]?.querySelector("img");s&&!s.complete&&s.src&&r.add(s.src)}}r.size>0&&function(t){if(!t||0===t.length)return Promise.resolve([]);const e=[...new Set(t)];return Promise.all(e.map(t=>function(t){if(!t)return Promise.reject(new Error("이미지 소스가 제공되지 않았습니다"));const e=v.get(t);if(e)return e;const s=new Image,i=new Promise((e,i)=>{s.onload=async()=>{await async function(t){if("function"==typeof t.decode){b>=2?await new Promise(t=>{y.add(t)}):b++;try{await t.decode()}catch{}finally{const t=y.values().next().value;t?(y.delete(t),t()):b--}}}(s),e(s)},s.onerror=()=>i(new Error("이미지 로드 실패")),s.src=t}).finally(()=>{v.delete(t),s.onload=null,s.onerror=null});return v.set(t,i),i}(t)))}([...r]).catch(()=>{console.warn("일부 이미지 프리로드 실패")})}(this.items,this.state.currentIndex,this.options.preloadRange)}next(){this.navigator.next()}prev(){this.navigator.prev()}goTo(t){this.navigator.goTo(t)}startAutoRotate(){this.autoRotate.start()}stopAutoRotate(){this.autoRotate.stop()}toggleAutoRotate(){this.autoRotate.toggle()}destroy(){this.markupState.destroyed||(this.autoRotate.destroy(),this.animator.destroy(),this.eventHandler.destroy(),this.ui.destroy(),this.markupState.finish())}get currentIndex(){return this.state.currentIndex}get isAutoRotating(){return this.autoRotate.isActive}}export{z as default};
|
package/dist/peek-carousel.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).PeekCarousel=e()}(this,function(){"use strict";
|
|
2
|
-
/*! PeekCarousel
|
|
2
|
+
/*! PeekCarousel v2.0.1
|
|
3
3
|
* Copyright (c) 2025 PeekCarousel
|
|
4
4
|
* Copyright (c) 2026 PeekCarousel contributors
|
|
5
|
-
* @license
|
|
5
|
+
* @license See LICENSE, LICENSE-MIT and THIRD_PARTY_NOTICES.md.
|
|
6
6
|
*/const t=new WeakMap;function e(t){return new Map([...t.attributes].map(({name:t,value:e})=>[t,e]))}function s(e){const s=t.get(e);if(s&&!s.destroyed)throw new Error("PeekCarousel: call destroy() first");s?.reset(),t.delete(e)}const i=Object.freeze({startIndex:{type:"integer",default:1,minimum:0,maximum:9007199254740991},layoutMode:{type:"string",default:"stack",enum:["stack","radial","classic","fan"]},autoRotate:{type:"boolean",default:!1},autoRotateInterval:{type:"integer",default:2500,minimum:100,maximum:2147483647},swipeThreshold:{type:"number",default:50,minimum:0},dragThreshold:{type:"number",default:80,minimum:0},preloadRange:{type:"integer",default:2,minimum:0,maximum:9007199254740991},enableKeyboard:{type:"boolean",default:!0},enableWheel:{type:"boolean",default:!0},enableTouch:{type:"boolean",default:!0},enableMouse:{type:"boolean",default:!0},showNavigation:{type:"boolean",default:!0},showCounter:{type:"boolean",default:!0},showIndicators:{type:"boolean",default:!0},showAutoRotateButton:{type:"boolean",default:!0}}),a=Object.entries(i),r=Object.freeze(Object.fromEntries(a.map(([t,e])=>[t,e.default])));function o(t,e){return!("integer"===e.type&&!Number.isSafeInteger(t))&&!("number"===e.type&&!Number.isFinite(t))&&("integer"===e.type||typeof t===e.type)&&!(void 0!==e.minimum&&t<e.minimum)&&!(void 0!==e.maximum&&t>e.maximum)&&(!e.enum||e.enum.includes(t))}const n=Object.freeze({item:"peek-carousel__item",itemActive:"peek-carousel__item--active",itemPrev:"peek-carousel__item--prev",itemNext:"peek-carousel__item--next",itemCenter:"peek-carousel__item--center",itemHidden:"peek-carousel__item--hidden",itemDraggingLeft:"peek-carousel__item--dragging-left",itemDraggingRight:"peek-carousel__item--dragging-right",image:"peek-carousel__image",nav:"peek-carousel__nav",navBtn:"nav-btn",btn:"peek-carousel__btn",prevBtn:"prev-btn",nextBtn:"next-btn",autoRotateBtn:"auto-rotate-btn",btnAutoRotate:"peek-carousel__btn--auto-rotate",btnActive:"peek-carousel__btn--active",controls:"peek-carousel__controls",indicators:"peek-carousel__indicators",indicator:"indicator",indicatorPeek:"peek-carousel__indicator",indicatorActive:"peek-carousel__indicator--active",indicatorProgress:"peek-carousel__indicator--progress",indicatorCompleted:"peek-carousel__indicator--completed",counter:"peek-carousel__counter",counterCurrent:"peek-carousel__counter-current",counterSeparator:"peek-carousel__counter-separator",counterTotal:"peek-carousel__counter-total"}),l=Object.freeze({carousel:".peek-carousel__track",item:".peek-carousel__item",prevBtn:".prev-btn",nextBtn:".next-btn",autoRotateBtn:".auto-rotate-btn"}),c=Object.freeze({current:"aria-current",pressed:"aria-pressed"}),u=Object.freeze({mobile:768}),h=Object.freeze({transition:500,progressReset:10}),d=Object.freeze({arrowLeft:"ArrowLeft",arrowRight:"ArrowRight",home:"Home",end:"End",space:" "});function m(t,...e){t instanceof HTMLElement&&e.length>0&&t.classList.add(...e)}function p(t,...e){t instanceof HTMLElement&&e.length>0&&t.classList.remove(...e)}function g(t,e,s){t instanceof HTMLElement&&e&&t.setAttribute(e,s)}function f(t,e){if(!Number.isSafeInteger(t))throw new TypeError("PeekCarousel: 인덱스는 안전한 정수여야 합니다");return e<=0?0:(t%e+e)%e}const v=new Map,y=new Set;let b=0;class I{constructor(t){this.carousel=t}get currentIndex(){return this.carousel.state.currentIndex}set currentIndex(t){this.carousel.state.currentIndex=f(t,this.carousel.totalItems)}getShortestDistance(t,e){const s=this.carousel.totalItems,i=f(e,s),a=f(t,s),r=(i-a+s)%s,o=(a-i+s)%s;return r<=o?r:-o}isNearby(t,e){return Math.abs(this.getShortestDistance(t,e))<=2}updateAfterNavigation(){this.carousel.animator.updateCarousel(),this.carousel.updateCounter(),this.carousel.options.preloadRange>0&&this.carousel.preloadImages()}rotate(t){this.currentIndex=this.currentIndex+t,this.updateAfterNavigation()}next(){this.rotate(1)}prev(){this.rotate(-1)}goTo(t){const e=f(t,this.carousel.totalItems);e!==this.currentIndex&&(this.currentIndex=e,this.updateAfterNavigation())}navigateIfDifferent(t,e){const s=f(t,this.carousel.totalItems);return s!==this.currentIndex&&(e(s),!0)}handleItemClick(t){this.navigateIfDifferent(t,t=>{const{layoutMode:e}=this.carousel.options;"radial"===e?this.handleRadialItemClick(t):this.handleStackItemClick(t)})}handleRadialItemClick(t){const e=this.getShortestDistance(this.currentIndex,t);if(Math.abs(e)>1){const t=e>0?1:-1;this.rotate(t)}else this.rotate(e)}handleStackItemClick(t){if(this.isNearby(this.currentIndex,t)){const e=this.getShortestDistance(this.currentIndex,t);this.rotate(e)}else this.goTo(t)}handleIndicatorClick(t){this.navigateIfDifferent(t,t=>{const{layoutMode:e}=this.carousel.options;if("radial"===e){const e=this.getShortestDistance(this.currentIndex,t);this.rotate(e)}else this.goTo(t)})}}function x(t){const e=Math.abs(t);return`translate(calc(-50% + ${38*t}%), calc(-50% + ${e*e*12}px)) rotate(${12*t}deg) scale(${1-.08*e})`}function k(t,e,s,i){const a=t.carousel.items[e];if("function"!=typeof a.animate||window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;const r="translate(-50%, -50%) scale(0.65)",o=Math.abs(s)<=2?x(s):r,n=a.animate([{transform:o,zIndex:0},{transform:r,zIndex:0,offset:.4},{transform:r,zIndex:0,offset:.6},{transform:x(i),zIndex:0}],{duration:500,easing:"cubic-bezier(0.22, 1, 0.36, 1)"});t.fanAnimations.set(e,n),n.onfinish=()=>{t.fanAnimations.get(e)===n&&t.fanAnimations.delete(e)}}const w=[n.itemCenter,n.itemPrev,n.itemNext,n.itemHidden];class A{constructor(t){this.carousel=t,this.momentumAnimation=null,this.isAnimating=!1,this.previousIndex=null,this.stackIndex=null,this.fanIndex=null,this.fanAnimations=new Map,this.radialGeometry=null,this.transitionFrame=null,this.classicWidth=null,this.classicSpacing=null,this.classicTransitions=new Set}normalizeAngleDiff(t){return((t+180)%360+360)%360-180}round(t,e=2){return Math.round(t*10**e)/10**e}getAdjacentIndices(t){return{prev:f(t-1,this.carousel.totalItems),next:f(t+1,this.carousel.totalItems)}}setCarouselRotation(t){const e=this.round(t,2);this.setCSSVariables(this.carousel.container,{"--carousel-rotation":`${e}deg`})}setCSSVariables(t,e){for(const[s,i]of Object.entries(e))t.style.getPropertyValue(s)!==i&&t.style.setProperty(s,i)}updateRadialRotation(t){return function(t,e){const s=-t.carousel.state.angleUnit*e,i=t.carousel.container.style.getPropertyValue("--carousel-rotation");if(!i)return void t.setCarouselRotation(s);const a=Number(i.replace(/deg$/,""));if(!Number.isFinite(a))return void t.setCarouselRotation(s);const r=a+t.normalizeAngleDiff(s-a);t.setCarouselRotation(r)}(this,t)}updateCarousel(t=!1){const{currentIndex:e}=this.carousel.state,{layoutMode:s}=this.carousel.options;"classic"!==s||!t&&null!==this.classicWidth&&"function"==typeof ResizeObserver||(this.classicWidth=this.carousel.container.offsetWidth),"radial"!==s?this.setCarouselRotation(0):this.updateRadialRotation(e),this.updateActiveItem()}updateActiveItem(){const{currentIndex:t}=this.carousel.state,{layoutMode:e}=this.carousel.options;this.carousel.ui.updateActiveStates(t),"radial"===e?this.updateRadialPositions(t):"fan"===e?function(t,e){const{items:s,totalItems:i}=t.carousel,a=t.fanIndex,r=null===a?s.map((t,e)=>e):new Set([a,e].flatMap(t=>[-2,-1,0,1,2].map(e=>((t+e)%i+i)%i)));for(const l of r){let r=(l-e+i)%i;r>i/2&&(r-=i);const o=Math.abs(r);let n=null;if(a!==e){t.fanAnimations.get(l)?.cancel(),t.fanAnimations.delete(l);let e=(l-a+i)%i;e>i/2&&(e-=i);const c=o<=2&&null!==a&&(Math.abs(e)>2||r*e<0&&Math.abs(r-e)>1);n=c?e:null,s[l].classList.toggle("peek-carousel__item--fan-repositioning",c)}s[l].classList.toggle("peek-carousel__item--fan-hidden",o>2),o>2||(t.setCSSVariables(s[l],{"--fan-x":38*r+"%","--fan-y":o*o*12+"px","--fan-angle":12*r+"deg","--fan-scale":String(1-.08*Math.min(o,3)),"--fan-layer":String(100-o)}),null!==n&&k(t,l,n,r))}t.fanIndex=e;const{prev:o,next:n}=t.getAdjacentIndices(e);t.carousel.ui.setPeekItems(o,n)}(this,t):"classic"===e?this.updateClassicPositions(t):this.updateStackPositions(t)}updateRadialPositions(t){return function(t,e){const{angleUnit:s}=t.carousel.state,i=`${s}:${t.carousel.items.length}`;if(t.radialGeometry!==i){for(let e=0;e<t.carousel.items.length;e++)t.setCSSVariables(t.carousel.items[e],{"--item-angle":`${t.round(s*e,2)}deg`,"--item-radius":"400px"});t.radialGeometry=i}const{prev:a,next:r}=t.getAdjacentIndices(e);t.carousel.ui.setPeekItems(a,r)}(this,t)}updateStackPositions(t){return function(t,e){const{prev:s,next:i}=t.getAdjacentIndices(e),a=t.stackIndex,r=null===a?null:t.getAdjacentIndices(a),o=null===a?t.carousel.items.map((t,e)=>e):new Set([a,r.prev,r.next,e,s,i]);for(const l of o){const a=t.carousel.items[l],r=l===e?n.itemCenter:l===s?n.itemPrev:l===i?n.itemNext:n.itemHidden;a.classList.contains(r)||(a.classList.remove(...w),a.classList.add(r))}t.stackIndex=e}(this,t)}calculateClassicSpacing(t){return function(t){return t<=0&&(t=300),Math.max(300,Math.min(.35*t,500))/t*50+5+(t<=768?40:15)}(t)}getWrapInfo(t,e){return function(t,e,s){if(null===e)return{isWrap:!1,direction:0};const i=s-e,a=Math.abs(i)===t.carousel.totalItems-1,r=i>0?1:-1;return{isWrap:a,direction:a?-r:r}}(this,t,e)}getClassicItemPosition(t,e,s,i){return function(t,e,s,i,a=t.getAdjacentIndices(s)){const{prev:r,next:o}=a,n=t.carousel.totalItems;return e===s?{x:50,scale:1,isCenter:!0}:e===r?{x:50-i,scale:1,isPrev:!0}:e===o?{x:50+i,scale:1,isNext:!0}:{x:50+((e-s+n)%n<(s-e+n)%n?2:-2)*i,scale:.85,isHidden:!0}}(this,t,e,s,i)}updateClassicPositions(t){return function(t,e){const s=t.previousIndex,i=t.getAdjacentIndices(e),{prev:a,next:r}=i,o=t.classicWidth??t.carousel.container.offsetWidth,n=t.calculateClassicSpacing(o),{isWrap:l}=t.getWrapInfo(s,e),c=t.carousel.items,u=t.getAdjacentIndices(s??e),h=c.length,d=null===s?0:(e-s+h)%h,m=new Set([e,a,r,s,u.prev,u.next]),p=Math.ceil(h/2),g=t.classicSpacing!==n||null===s||0!==d&&1!==d&&d!==h-1?new Set(c.keys()):new Set([...m,(s+p)%h,(e+p)%h]);let f=!1;for(const v of m){const e=c[v];t.classicTransitions.delete(e)&&(e.style.transition="",f=!0)}if(l)for(const v of g)if(!m.has(v)){const e=c[v];e.style.transition="none",t.classicTransitions.add(e),f=!0}f&&t.carousel.container.offsetHeight;for(const v of g){const s=c[v],a=t.getClassicItemPosition(v,e,n,i);t.setCSSVariables(s,{"--item-x":`${t.round(a.x,2)}%`,"--item-scale":String(a.scale)}),a.isCenter?t.setItemVisibility(s,"1","visible","100"):a.isPrev||a.isNext?t.setItemVisibility(s,"0.6","visible","50"):t.setItemVisibility(s,"0","hidden","0")}l&&(null!==t.transitionFrame&&cancelAnimationFrame(t.transitionFrame),t.transitionFrame=requestAnimationFrame(()=>{t.transitionFrame=null;for(const e of t.classicTransitions)e.style.transition="";t.classicTransitions.clear()})),t.classicSpacing=n,t.previousIndex=e,t.carousel.ui.setPeekItems(a,r)}(this,t)}setItemVisibility(t,e,s,i){return function(t,e,s,i){t.style.opacity!==e&&(t.style.opacity=e),t.style.visibility!==s&&(t.style.visibility=s),t.style.zIndex!==i&&(t.style.zIndex=i)}(t,e,s,i)}destroy(){for(const t of this.fanAnimations.values())t.cancel();this.fanAnimations.clear(),this.stopMomentum(),null!==this.transitionFrame&&cancelAnimationFrame(this.transitionFrame),this.transitionFrame=null;for(const t of this.classicTransitions)t.style.transition="";this.classicTransitions.clear()}startMomentum(t){this.stopMomentum();let e=t;const s=()=>{if(e*=.92,Math.abs(e)<.05)this.stopMomentum();else{if(Math.abs(e)>1.5){const t=e>0?-1:1;this.carousel.navigator.rotate(t),e*=.6}this.momentumAnimation=requestAnimationFrame(s)}};this.isAnimating=!0,this.momentumAnimation=requestAnimationFrame(s)}stopMomentum(){this.momentumAnimation&&(cancelAnimationFrame(this.momentumAnimation),this.momentumAnimation=null),this.isAnimating=!1}}class C{constructor(t){this.carousel=t,this.interval=null,this.isActive=!1}setActiveState(t){this.isActive=t,this.carousel.ui.updateAutoRotateButton(t)}toggle(){this.isActive?this.stop():this.start()}start(){if(this.isActive)return;this.setActiveState(!0);const t=this.carousel.options.autoRotateInterval;this.interval=setInterval(()=>{this.carousel.navigator.next()},t)}stop(){this.isActive&&(this.setActiveState(!1),this.interval&&(clearInterval(this.interval),this.interval=null))}destroy(){this.stop(),this.carousel=null}}const S=Object.freeze({threshold:50,timeout:150,cooldown:100}),T=Object.freeze({touchThreshold:15,mouseThreshold:10,velocityThreshold:.5});let M=0;class R{constructor(t){this.carousel=t,this.boundHandlers=new Map,this.resizeTimer=null,this.resizeObserver=null,this.dragFrame=null,this.pendingDrag=null,this.touch={startX:0,endX:0},this.drag={active:!1,startX:0,currentX:0,lastX:0,lastTime:0,velocity:0},this.wheel={isScrolling:!1,scrollTimeout:null,lastWheelTime:0,accumulatedDelta:0}}init(){this.initNavigationButtons(),this.initKeyboard(),this.initWheel(),this.initItemClick(),this.initIndicatorClick(),this.initTouch(),this.initMouse(),this.initResize()}stopAutoRotateAndNavigate(t){this.completeCurrentIndicator(),this.carousel.autoRotate.stop(),t()}completeCurrentIndicator(){const t=this.carousel.indicators[this.carousel.state.currentIndex];t&&t.classList.contains("peek-carousel__indicator--active")&&t.classList.add("peek-carousel__indicator--completed")}resetDragState(t){this.cancelDragFrame(),this.carousel.ui.removeDraggingClass(t),this.carousel.ui.clearDragTransform()}queueDragTransform(t,e,s){this.pendingDrag={distance:t,index:e,threshold:s},null===this.dragFrame&&(this.dragFrame=requestAnimationFrame(()=>{this.dragFrame=null;const t=this.pendingDrag;this.pendingDrag=null,t&&this.carousel&&(this.carousel.ui.updateDragTransform(t.distance),this.updateDraggingClass(t.distance,t.index,t.threshold))}))}cancelDragFrame(){null!==this.dragFrame&&cancelAnimationFrame(this.dragFrame),this.dragFrame=null,this.pendingDrag=null}updateDraggingClass(t,e,s){t>s?this.carousel.ui.addDraggingClass(e,"right"):t<-s&&this.carousel.ui.addDraggingClass(e,"left")}initDragState(t){this.drag.active=!0,this.drag.startX=t,this.drag.currentX=t,this.drag.lastX=t,this.drag.lastTime=Date.now(),this.drag.velocity=0}resetMouseCursor(){this.carousel.elements.carousel.style.cursor="grab"}calculateWheelDelta(t){return Math.abs(t.deltaX)>Math.abs(t.deltaY)?-t.deltaX:t.deltaY}resetWheelState(){this.wheel.isScrolling=!1,this.wheel.accumulatedDelta=0}initNavigationButtons(){const{prevBtn:t,nextBtn:e,autoRotateBtn:s}=this.carousel.elements;t&&this.addHandler(t,"click",()=>{this.stopAutoRotateAndNavigate(()=>this.carousel.navigator.prev())}),e&&this.addHandler(e,"click",()=>{this.stopAutoRotateAndNavigate(()=>this.carousel.navigator.next())}),s&&this.addHandler(s,"click",()=>{this.carousel.autoRotate.toggle()})}initKeyboard(){if(!this.carousel.options.enableKeyboard)return;const t=this.carousel.container;t.hasAttribute("tabindex")||t.setAttribute("tabindex","0"),this.addHandler(t,"keydown",t=>{if(t.defaultPrevented||t.isComposing||t.altKey||t.ctrlKey||t.metaKey)return;const e=t.target,s=this.carousel.indicators.includes(e);if(e.closest('input, textarea, select, a, button, [role="button"], [contenteditable]:not([contenteditable="false"])')&&!s)return;if(s&&(t.key===d.space||"Enter"===t.key))return;const{navigator:i,autoRotate:a,totalItems:r}=this.carousel;switch(t.key){case d.arrowLeft:t.preventDefault(),a.stop(),i.prev();break;case d.arrowRight:t.preventDefault(),a.stop(),i.next();break;case d.home:t.preventDefault(),a.stop(),i.goTo(0);break;case d.end:t.preventDefault(),a.stop(),i.goTo(r-1);break;case d.space:t.preventDefault(),a.toggle();break;default:{const e=Number(t.key);1===t.key.length&&e>=1&&e<=r&&(t.preventDefault(),a.stop(),i.goTo(e-1))}}s&&t.defaultPrevented&&this.carousel.indicators[this.carousel.state.currentIndex]?.focus()})}initWheel(){this.carousel.options.enableWheel&&this.addHandler(this.carousel.elements.carousel,"wheel",t=>{const e=Math.abs(t.deltaX),s=Math.abs(t.deltaY);if(e<1&&s<1)return;if(e===s)return;t.preventDefault();const i=Date.now();if(!(i-this.wheel.lastWheelTime<S.cooldown)){if(this.wheel.isScrolling||(this.wheel.isScrolling=!0,this.wheel.accumulatedDelta=0,this.carousel.autoRotate.stop(),this.carousel.animator.stopMomentum()),this.wheel.accumulatedDelta+=this.calculateWheelDelta(t),Math.abs(this.wheel.accumulatedDelta)>=S.threshold){const t=this.wheel.accumulatedDelta>0?1:-1;this.carousel.navigator.rotate(t),this.wheel.accumulatedDelta=0,this.wheel.lastWheelTime=i}clearTimeout(this.wheel.scrollTimeout),this.wheel.scrollTimeout=setTimeout(()=>{this.resetWheelState()},S.timeout)}},{passive:!1})}initItemClick(){const{items:t}=this.carousel;for(let e=0;e<t.length;e++)this.addHandler(t[e],"click",()=>{this.carousel.autoRotate.stop(),this.carousel.navigator.handleItemClick(e)})}initIndicatorClick(){const{indicators:t}=this.carousel;for(let e=0;e<t.length;e++)this.addHandler(t[e],"click",()=>{this.carousel.autoRotate.stop(),this.carousel.navigator.handleIndicatorClick(e)})}initTouch(){this.carousel.options.enableTouch&&(this.addHandler(this.carousel.elements.carousel,"touchstart",t=>{this.touch.startX=t.changedTouches[0].screenX}),this.addHandler(this.carousel.elements.carousel,"touchmove",t=>{const e=t.changedTouches[0].screenX-this.touch.startX,{currentIndex:s}=this.carousel.state;this.queueDragTransform(e,s,T.touchThreshold)}),this.addHandler(this.carousel.elements.carousel,"touchend",t=>{this.touch.endX=t.changedTouches[0].screenX;const e=this.touch.endX-this.touch.startX,{swipeThreshold:s}=this.carousel.options,{currentIndex:i}=this.carousel.state;this.resetDragState(i),e<-s?(this.carousel.autoRotate.stop(),this.carousel.navigator.next()):e>s&&(this.carousel.autoRotate.stop(),this.carousel.navigator.prev())}),this.addHandler(this.carousel.elements.carousel,"touchcancel",()=>{this.resetDragState(this.carousel.state.currentIndex)}))}initMouse(){this.carousel.options.enableMouse&&(this.addHandler(this.carousel.elements.carousel,"mousedown",t=>{window.innerWidth<=768||(this.initDragState(t.clientX),this.carousel.autoRotate.stop(),this.carousel.animator.stopMomentum(),this.carousel.elements.carousel.style.cursor="grabbing",t.preventDefault())}),this.addHandler(document,"mousemove",t=>{if(!this.drag.active)return;const e=Date.now(),s=e-this.drag.lastTime,i=t.clientX-this.drag.lastX;s>0&&(this.drag.velocity=i/s),this.drag.currentX=t.clientX,this.drag.lastX=t.clientX,this.drag.lastTime=e;const a=this.drag.currentX-this.drag.startX,{currentIndex:r}=this.carousel.state;if(this.queueDragTransform(a,r,T.mouseThreshold),Math.abs(a)>this.carousel.options.dragThreshold){const t=a>0?-1:1;this.carousel.navigator.rotate(t),this.drag.startX=this.drag.currentX,this.resetDragState(r)}}),this.addHandler(document,"mouseup",()=>{if(!this.drag.active)return;this.drag.active=!1,this.resetMouseCursor();const{currentIndex:t}=this.carousel.state;this.resetDragState(t),Math.abs(this.drag.velocity)>T.velocityThreshold&&this.carousel.animator.startMomentum(this.drag.velocity)}),this.addHandler(this.carousel.elements.carousel,"mouseleave",()=>{if(this.drag.active){this.drag.active=!1,this.resetMouseCursor();const{currentIndex:t}=this.carousel.state;this.resetDragState(t)}}),window.innerWidth>u.mobile&&this.resetMouseCursor())}initResize(){const t=()=>{clearTimeout(this.resizeTimer),this.resizeTimer=setTimeout(()=>{this.carousel&&this.carousel.animator.updateCarousel(!0)},100)};this.addHandler(window,"resize",t),"classic"===this.carousel.options.layoutMode&&"function"==typeof ResizeObserver&&(this.resizeObserver=new ResizeObserver(()=>{this.carousel&&this.carousel.container.offsetWidth!==this.carousel.animator.classicWidth&&t()}),this.resizeObserver.observe(this.carousel.container,{box:"border-box"}))}addHandler(t,e,s,i){t.addEventListener(e,s,i);const a=`${e}-${++M}`;this.boundHandlers.set(a,{element:t,event:e,handler:s,options:i})}destroy(){this.cancelDragFrame(),this.resizeObserver?.disconnect(),this.resizeObserver=null,this.wheel.scrollTimeout&&(clearTimeout(this.wheel.scrollTimeout),this.wheel.scrollTimeout=null),this.resizeTimer&&(clearTimeout(this.resizeTimer),this.resizeTimer=null);for(const{element:t,event:e,handler:s,options:i}of this.boundHandlers.values())t.removeEventListener(e,s,i);this.boundHandlers.clear(),this.drag.active=!1,this.drag.velocity=0,this.wheel.isScrolling=!1,this.wheel.accumulatedDelta=0,this.carousel=null}}const D=new Map;function _(t){return String(t).replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"}[t]))}const P={prev:{path:"M15 18L9 12L15 6",options:{}},next:{path:"M9 18L15 12L9 6",options:{}},play:{path:"M8 6.5v11l9-5.5z",options:{fill:"currentColor",stroke:"currentColor",strokeWidth:0,strokeLinecap:"round",strokeLinejoin:"round"}},pause:{path:"M7 5.5C7 5.22386 7.22386 5 7.5 5H9.5C9.77614 5 10 5.22386 10 5.5V18.5C10 18.7761 9.77614 19 9.5 19H7.5C7.22386 19 7 18.7761 7 18.5V5.5ZM14 5.5C14 5.22386 14.2239 5 14.5 5H16.5C16.7761 5 17 5.22386 17 5.5V18.5C17 18.7761 16.7761 19 16.5 19H14.5C14.2239 19 14 18.7761 14 18.5V5.5Z",options:{fill:"currentColor",stroke:"none"}}};function L(t,e={}){const s=Object.prototype.hasOwnProperty.call(P,t)?P[t]:null;if(!s)return console.warn("PeekCarousel: unknown icon"),"";const i={...s.options,...e};return function(t,e={}){const{width:s=24,height:i=24,viewBox:a="0 0 24 24",fill:r="none",stroke:o="currentColor",strokeWidth:n=2,strokeLinecap:l="round",strokeLinejoin:c="round",className:u=""}=e,h=`${t}-${JSON.stringify(e)}`;if(D.has(h))return D.get(h);const d=`<svg width="${_(s)}" height="${_(i)}" viewBox="${_(a)}" fill="${_(r)}" xmlns="http://www.w3.org/2000/svg" class="${_(u)}"><path d="${_(t)}" stroke="${_(o)}" stroke-width="${_(n)}" stroke-linecap="${_(l)}" stroke-linejoin="${_(c)}"/></svg>`;return D.size>=100&&D.delete(D.keys().next().value),D.set(h,d),d}(s.path,i)}function N(t,e,s={}){if(!(t&&t instanceof HTMLElement))return;if(t.querySelector("svg"))return;const i=L(e,s);i&&(t.innerHTML=i)}const $=Object.freeze({stack:{maxDrag:200,offsetMultiplier:100,rotationMultiplier:3},radial:{rotationSensitivity:.2},classic:{dragSensitivity:.5}});class H{constructor(t){this.carousel=t,this.progressTimers=new Map,this.previousIndex=null,this.peekIndices=null}createNavigation(){if(!this.carousel.options.showNavigation)return;const t=this.carousel.container.querySelector(`.${n.nav}`);if(t)return this.carousel.elements.nav=t,this.carousel.elements.prevBtn=t.querySelector(l.prevBtn),void(this.carousel.elements.nextBtn=t.querySelector(l.nextBtn));const e=document.createElement("div");e.className=n.nav;const[s,i]=[[n.prevBtn,"Previous"],[n.nextBtn,"Next"]].map(([t,s])=>{const i=document.createElement("button");return i.type="button",i.className=`${n.navBtn} ${n.btn} ${t}`,i.setAttribute("aria-label",s),e.appendChild(i),i});this.carousel.container.appendChild(e),this.carousel.elements.nav=e,this.carousel.elements.prevBtn=s,this.carousel.elements.nextBtn=i}createControls(){if(!this.carousel.options.showIndicators&&!this.carousel.options.showAutoRotateButton)return;const t=this.carousel.container.querySelector(`.${n.controls}`);if(t){this.carousel.elements.controls=t;const e=t.querySelector(`.${n.indicators}`);return e&&this.carousel.options.showIndicators&&(e.innerHTML="",this.createIndicators(e)),void(this.carousel.elements.autoRotateBtn=t.querySelector(l.autoRotateBtn))}const e=document.createElement("div");if(e.className=n.controls,this.carousel.options.showIndicators){const t=document.createElement("div");t.className=n.indicators,this.createIndicators(t),e.appendChild(t)}if(this.carousel.options.showAutoRotateButton){const t=document.createElement("button");t.type="button",t.className=`${n.autoRotateBtn} ${n.btn} ${n.btnAutoRotate}`,t.setAttribute("aria-label","Toggle auto-rotate"),t.setAttribute("aria-pressed","false"),e.appendChild(t),this.carousel.elements.autoRotateBtn=t}this.carousel.container.appendChild(e),this.carousel.elements.controls=e}createIndicators(t){this.carousel.indicators=[],t.setAttribute("role","group"),t.setAttribute("aria-label","Choose a slide");for(let e=0;e<this.carousel.totalItems;e++){const s=document.createElement("button");s.type="button";const i=e===this.carousel.state.currentIndex;s.className=n.indicator,s.classList.add(n.indicatorPeek),s.setAttribute("aria-label",`Image ${e+1}`),s.setAttribute("aria-pressed",i?"true":"false"),i&&s.classList.add(n.indicatorActive),t.appendChild(s),this.carousel.indicators.push(s)}}injectIcons(){const{prevBtn:t,nextBtn:e,autoRotateBtn:s}=this.carousel.elements;t&&N(t,"prev"),e&&N(e,"next"),s&&function(t){if(!(t&&t instanceof HTMLElement))return;if(t.querySelector("svg"))return;const e=L("play",{className:"play-icon"}),s=L("pause",{className:"pause-icon"});e&&s&&(t.innerHTML=e+s)}(s)}createCounter(){if(!this.carousel.options.showCounter)return;const t=this.carousel.container.querySelector(`.${n.counter}`);if(t)return this.carousel.counterElement=t,void this.updateCounter();const e=document.createElement("div");e.className=n.counter,e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true");for(const[s,i]of[[n.counterCurrent,this.carousel.state.currentIndex+1],[n.counterSeparator,"/"],[n.counterTotal,this.carousel.totalItems]]){const t=document.createElement("span");t.className=s,t.textContent=i,e.appendChild(t)}this.carousel.container.appendChild(e),this.carousel.counterElement=e}updateCounter(){if(!this.carousel.counterElement)return;const t=this.carousel.counterElement.querySelector(`.${n.counterCurrent}`);t&&(t.textContent=this.carousel.state.currentIndex+1)}updateActiveStates(t){this.clearProgressTimers();const e=null===this.previousIndex?this.carousel.items.map((t,e)=>e):[this.previousIndex];for(const a of e){const t=this.carousel.items[a];p(t,n.itemActive),t?.removeAttribute(c.current);const e=this.carousel.indicators[a];p(e,n.indicatorActive,n.indicatorProgress),g(e,c.pressed,"false")}this.clearPeekItems(),this.previousIndex=t;const s=this.carousel.items[t],i=this.carousel.indicators[t];s&&(m(s,n.itemActive),g(s,c.current,"true")),i&&(p(i,n.indicatorCompleted),m(i,n.indicatorActive),g(i,c.pressed,"true"),this.carousel.autoRotate.isActive&&this.updateIndicatorProgress(i))}updateIndicatorProgress(t){var e,s,i;clearTimeout(this.progressTimers.get(t)),e=t,s="--progress-duration",i=`${this.carousel.options.autoRotateInterval}ms`,e instanceof HTMLElement&&s&&e.style.setProperty(s,i);const a=setTimeout(()=>{this.progressTimers.delete(t),this.carousel.autoRotate.isActive&&t.classList.contains(n.indicatorActive)&&m(t,n.indicatorProgress)},h.progressReset);this.progressTimers.set(t,a)}clearPeekItems(){const t=this.peekIndices??this.carousel.items.map((t,e)=>e);for(const e of t)p(this.carousel.items[e],n.itemPrev,n.itemNext);this.peekIndices=[]}setPeekItems(t,e){const s=this.carousel.items[t],i=this.carousel.items[e];s&&m(s,n.itemPrev),i&&m(i,n.itemNext),this.peekIndices=[t,e]}updateAutoRotateButton(t){const{autoRotateBtn:e}=this.carousel.elements;e&&(e.classList.toggle(n.btnActive,t),g(e,c.pressed,String(t)))}addDraggingClass(t,e){const s=this.carousel.items[t];if(!s)return;const i=n.itemDraggingLeft,a=n.itemDraggingRight;p(s,i,a),"left"===e?m(s,i):"right"===e&&m(s,a)}removeDraggingClass(t){const e=this.carousel.items[t];e&&p(e,n.itemDraggingLeft,n.itemDraggingRight)}round(t,e=2){return Math.round(t*10**e)/10**e}applyEasing(t){return t*(2-Math.abs(t))}updateDragTransform(t){const{layoutMode:e}=this.carousel.options;if("stack"===e||"fan"===e){const e=$.stack,s=Math.max(-e.maxDrag,Math.min(e.maxDrag,t))/e.maxDrag,i=this.applyEasing(s),a=this.round(i*e.offsetMultiplier),r=this.round(i*e.rotationMultiplier);this.carousel.container.style.setProperty("--drag-offset",`${a}px`),this.carousel.container.style.setProperty("--drag-rotation",`${r}deg`)}else if("radial"===e){const e=$.radial,s=this.round(t*e.rotationSensitivity);this.carousel.container.style.setProperty("--drag-rotation-y",`${s}deg`)}else if("classic"===e){const e=$.classic,s=this.round(t*e.dragSensitivity);this.carousel.container.style.setProperty("--drag-offset",`${s}px`)}}clearDragTransform(){this.carousel.container.style.setProperty("--drag-offset","0px"),this.carousel.container.style.setProperty("--drag-rotation","0deg"),this.carousel.container.style.setProperty("--drag-rotation-y","0deg")}clearProgressTimers(){for(const t of this.progressTimers.values())clearTimeout(t);this.progressTimers.clear()}destroy(){this.clearProgressTimers()}}return class{constructor(i,n={}){if(this.counterElement=null,this.currentLayoutMode=null,this.container=function(t){return"string"==typeof t?document.querySelector(t):t instanceof HTMLElement?t:null}(i),!this.container)throw new Error("PeekCarousel: container not found");if(s(this.container),this.options=function(t={}){const e=t&&"object"==typeof t&&!Array.isArray(t)?t:{},s={...r};for(const[i,r]of a){if(!Object.prototype.hasOwnProperty.call(e,i))continue;const t=e[i];o(t,r)?s[i]=t:"startIndex"===i||"preloadRange"===i?console.warn(`PeekCarousel: ${i}는 0 이상이어야 합니다. 기본값 ${r.default} 사용`):"layoutMode"===i?console.warn("PeekCarousel: invalid layoutMode; using stack"):"autoRotateInterval"===i&&console.warn("PeekCarousel: autoRotateInterval은 100ms 이상이어야 합니다. 기본값 2500 사용")}return s}(n),this.initElements(),0===this.items.length)throw new Error("PeekCarousel: 캐러셀 아이템을 찾을 수 없습니다");this.state={currentIndex:f(this.options.startIndex,this.totalItems),angleUnit:360/this.totalItems},this.markupState=function(s){const{container:i}=s,a=new Map,r=new Map;for(const t of[i,...i.querySelectorAll("*")])a.set(t,e(t)),t.closest(".peek-carousel__nav, .peek-carousel__controls, .peek-carousel__counter")&&r.set(t,[...t.childNodes]);const o=[],n=[],l={destroyed:!1,finish(){l.destroyed=!0;for(const[t,s]of a){const i=e(t);for(const e of new Set([...s.keys(),...i.keys()]))s.get(e)!==i.get(e)&&o.push([t,e,s.get(e),i.get(e)])}for(const[t,e]of r)n.push([t,e,[...t.childNodes]])},reset(){for(const t of[s.elements.nav,s.elements.controls,s.counterElement])t&&!a.has(t)&&t.remove();for(const[t,e,s,i]of o)t.getAttribute(e)===(i??null)&&(void 0===s?t.removeAttribute(e):t.setAttribute(e,s));for(const[t,e,s]of n)t.childNodes.length===s.length&&s.every((e,s)=>t.childNodes[s]===e)&&t.replaceChildren(...e)}};return t.set(i,l),l}(this),this.initModules();try{this.init()}catch(l){throw this.destroy(),s(this.container),l}}initElements(){if(this.elements={carousel:this.container.querySelector(l.carousel),prevBtn:null,nextBtn:null,autoRotateBtn:null,controls:null,nav:null},!this.elements.carousel)throw new Error("PeekCarousel: missing track");this.items=function(t,e=document){return"string"!=typeof t?[]:Array.from(e.querySelectorAll(t))}(l.item,this.elements.carousel),this.totalItems=this.items.length,this.indicators=[]}initModules(){this.navigator=new I(this),this.animator=new A(this),this.autoRotate=new C(this),this.eventHandler=new R(this),this.ui=new H(this)}init(){this.updateLayoutClass(),this.createNavigation(),this.createControls(),this.injectIcons(),this.createCounter(),this.setImageLoadingAttributes(),this.initCSSVariables(),this.eventHandler.init(),this.animator.updateCarousel(),this.options.autoRotate&&this.autoRotate.start(),this.options.preloadRange>0&&this.preloadImages()}initCSSVariables(){this.container.style.setProperty("--carousel-rotation","0deg"),this.ui.clearDragTransform()}createNavigation(){return this.ui.createNavigation()}createControls(){return this.ui.createControls()}createIndicators(t){return this.ui.createIndicators(t)}injectIcons(){return this.ui.injectIcons()}createCounter(){return this.ui.createCounter()}updateCounter(){return this.ui.updateCounter()}setImageLoadingAttributes(){const t=this.state.currentIndex,e=this.options.preloadRange;for(let s=0;s<this.items.length;s++){const i=this.items[s].querySelector(`.${n.image}`);if(!i)continue;if(i.hasAttribute("decoding")||i.setAttribute("decoding","async"),s!==t||i.hasAttribute("fetchpriority")||i.setAttribute("fetchpriority","high"),i.hasAttribute("loading"))continue;const a=Math.abs(s-t),r=Math.min(a,this.totalItems-a)<=e;i.setAttribute("loading",r?"eager":"lazy")}}updateLayoutClass(){const t=this.currentLayoutMode,e=this.options.layoutMode;t&&t!==e&&this.container.classList.remove(`peek-carousel--${t}`),this.container.classList.add(`peek-carousel--${e}`),this.currentLayoutMode=e}preloadImages(){!function(t,e,s){if(!t||0===t.length||!Number.isSafeInteger(s)||s<0||!Number.isSafeInteger(e))return;const i=t.length;e=(e%i+i)%i;const a=Math.min(s,Math.floor(i/2)),r=new Set;for(let o=1;o<=a;o++){const s=(e-o+i)%i,a=(e+o)%i,n=s===a?[s]:[s,a];for(const e of n){const s=t[e]?.querySelector("img");s&&!s.complete&&s.src&&r.add(s.src)}}r.size>0&&function(t){if(!t||0===t.length)return Promise.resolve([]);const e=[...new Set(t)];return Promise.all(e.map(t=>function(t){if(!t)return Promise.reject(new Error("이미지 소스가 제공되지 않았습니다"));const e=v.get(t);if(e)return e;const s=new Image,i=new Promise((e,i)=>{s.onload=async()=>{await async function(t){if("function"==typeof t.decode){b>=2?await new Promise(t=>{y.add(t)}):b++;try{await t.decode()}catch{}finally{const t=y.values().next().value;t?(y.delete(t),t()):b--}}}(s),e(s)},s.onerror=()=>i(new Error("이미지 로드 실패")),s.src=t}).finally(()=>{v.delete(t),s.onload=null,s.onerror=null});return v.set(t,i),i}(t)))}([...r]).catch(()=>{console.warn("일부 이미지 프리로드 실패")})}(this.items,this.state.currentIndex,this.options.preloadRange)}next(){this.navigator.next()}prev(){this.navigator.prev()}goTo(t){this.navigator.goTo(t)}startAutoRotate(){this.autoRotate.start()}stopAutoRotate(){this.autoRotate.stop()}toggleAutoRotate(){this.autoRotate.toggle()}destroy(){this.markupState.destroyed||(this.autoRotate.destroy(),this.animator.destroy(),this.eventHandler.destroy(),this.ui.destroy(),this.markupState.finish())}get currentIndex(){return this.state.currentIndex}get isAutoRotating(){return this.autoRotate.isActive}}});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! PeekCarousel
|
|
1
|
+
/*! PeekCarousel v2.0.1
|
|
2
2
|
* Copyright (c) 2025 PeekCarousel
|
|
3
3
|
* Copyright (c) 2026 PeekCarousel contributors
|
|
4
|
-
* @license
|
|
4
|
+
* @license See LICENSE, LICENSE-MIT and THIRD_PARTY_NOTICES.md.
|
|
5
5
|
*/
|
|
6
6
|
.peek-carousel__item:focus-visible{border-radius:var(--peek-carousel-card-radius,12px);outline:3px solid var(--peek-carousel-focus-color,rgba(102,126,234,.8));outline-offset:8px}@supports not selector(:focus-visible){.peek-carousel button:focus,.peek-carousel:focus,.peek-carousel__item:focus{outline:3px solid var(--peek-carousel-focus-color,#667eea);outline-offset:4px}}.peek-carousel{animation:fadeInUp .8s cubic-bezier(.4,0,.2,1) forwards;animation-delay:.1s;cursor:grab;display:grid;font-family:var(--peek-carousel-font-family,inherit);height:100%;opacity:0;place-items:center;position:relative;transform:translateY(30px);-webkit-user-select:none;-moz-user-select:none;user-select:none;width:100%;--drag-offset:0px;--drag-rotation:0deg;--drag-rotation-y:0deg}.peek-carousel__track{height:100%;position:relative;touch-action:pan-y;transform-style:preserve-3d;width:100%}.peek-carousel__item{aspect-ratio:1.3265306122;-webkit-backface-visibility:hidden;backface-visibility:hidden;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%) scale(.8);transform-origin:center;width:clamp(300px,35vw,500px);z-index:0;--item-x:0%;--item-scale:0.8;--item-offset-x:0px;--item-angle:0deg;--item-radius:400px}.peek-carousel__item--active,.peek-carousel__item--next,.peek-carousel__item--prev{will-change:transform,opacity}.peek-carousel__item--active .peek-carousel__caption{opacity:1}@media (max-width:768px){.peek-carousel__item{width:clamp(280px,80vw,400px);--item-radius:300px}}.peek-carousel__figure{height:100%;margin:0;position:relative;width:100%}.peek-carousel__image{border-radius:var(--peek-carousel-card-radius,16px);box-shadow:var(--peek-carousel-card-shadow,0,20px,60px,rgba(0,0,0,.6),0,5px,15px,rgba(0,0,0,.4));height:100%;-o-object-fit:cover;object-fit:cover;transition:filter .4s cubic-bezier(.4,0,.2,1),box-shadow .4s cubic-bezier(.4,0,.2,1);width:100%}.peek-carousel__caption{background:var(--peek-carousel-caption-background,linear-gradient(to top,rgba(0,0,0,.8),transparent));border-radius:0 0 var(--peek-carousel-card-radius,16px) var(--peek-carousel-card-radius,16px);color:var(--peek-carousel-text-color,#fff);inset:auto 0 0;opacity:0;padding:1.5rem;pointer-events:none;position:absolute;text-align:center;transition:opacity .3s ease}@keyframes fadeInUp{to{opacity:1;transform:translateY(0)}}.peek-carousel--stack .peek-carousel__track{transform:none;transition:none}.peek-carousel--stack .peek-carousel__item{cursor:pointer;opacity:.5;transition:transform .05s,opacity .05s,z-index 0s;visibility:visible}.peek-carousel--stack .peek-carousel__item:not(.peek-carousel__item--dragging-left):not(.peek-carousel__item--dragging-right){transition:transform .5s,opacity .5s,z-index 0s}.peek-carousel--stack .peek-carousel__item--active{opacity:1;z-index:100}.peek-carousel--stack .peek-carousel__item--active .peek-carousel__image{box-shadow:var(--peek-carousel-active-shadow,0 40px 100px rgba(102,126,234,.6),0 0 40px rgba(102,126,234,.4),0 0 80px rgba(118,75,162,.3));filter:var(--peek-carousel-image-filter,brightness(1.2) saturate(1.1))}.peek-carousel--stack .peek-carousel__item:not(.peek-carousel--stack .peek-carousel__item--active) .peek-carousel__image{box-shadow:var(--peek-carousel-card-shadow,0 20px 50px rgba(0,0,0,.5));filter:var(--peek-carousel-image-filter,brightness(.7) saturate(.85))}.peek-carousel--stack .peek-carousel__item:not(.peek-carousel--stack .peek-carousel__item--active):hover .peek-carousel__image{box-shadow:var(--peek-carousel-card-shadow,0 30px 70px rgba(102,126,234,.3))!important;filter:var(--peek-carousel-image-filter,brightness(.9) saturate(1))!important;transition:all .3s ease}.peek-carousel--stack .peek-carousel__item--center{transform:translate(-50%,-50%) scale(1.15) translateX(var(--drag-offset)) rotate(var(--drag-rotation))}.peek-carousel--stack .peek-carousel__item--prev{transform:translate(-95%,-50%) scale(.85) translateX(calc(-15px + var(--drag-offset))) rotate(var(--drag-rotation))}.peek-carousel--stack .peek-carousel__item--next{transform:translate(-5%,-50%) scale(.85) translateX(calc(15px + var(--drag-offset))) rotate(var(--drag-rotation))}.peek-carousel--stack .peek-carousel__item--hidden{opacity:0;pointer-events:none;transform:translate(-50%,-50%) scale(.7) translateX(var(--drag-offset)) rotate(var(--drag-rotation));visibility:hidden}.peek-carousel--radial{perspective:1200px}.peek-carousel--radial .peek-carousel__track{transform:rotateY(calc(var(--carousel-rotation, 0deg) + var(--drag-rotation-y)));transition:transform .5s cubic-bezier(.4,0,.2,1)}.peek-carousel--radial .peek-carousel__track:active{transition:transform .05s}.peek-carousel--radial .peek-carousel__item{cursor:default;opacity:0;transform:translate(-50%,-50%) rotateY(var(--item-angle)) translateZ(var(--item-radius));transition:transform .5s cubic-bezier(.4,0,.2,1),opacity .5s cubic-bezier(.4,0,.2,1),visibility 0s .5s,z-index 0s;visibility:hidden}.peek-carousel--radial .peek-carousel__item--active{cursor:grab;opacity:1;transition:transform .5s cubic-bezier(.4,0,.2,1),opacity .5s cubic-bezier(.4,0,.2,1),visibility 0s 0s,z-index 0s;visibility:visible;z-index:100}.peek-carousel--radial .peek-carousel__item--active:active{cursor:grabbing}.peek-carousel--radial .peek-carousel__item--active .peek-carousel__image{box-shadow:var(--peek-carousel-active-shadow,0 40px 100px rgba(102,126,234,.6),0 0 40px rgba(102,126,234,.4),0 0 80px rgba(118,75,162,.3));filter:var(--peek-carousel-image-filter,brightness(1.2) saturate(1.1))}.peek-carousel--radial .peek-carousel__item--next,.peek-carousel--radial .peek-carousel__item--prev{opacity:.3;transition:transform .5s cubic-bezier(.4,0,.2,1),opacity .5s cubic-bezier(.4,0,.2,1),visibility 0s 0s,z-index 0s;visibility:visible;z-index:50}.peek-carousel--radial .peek-carousel__item--next .peek-carousel__image,.peek-carousel--radial .peek-carousel__item--prev .peek-carousel__image{box-shadow:var(--peek-carousel-card-shadow,0 25px 60px rgba(0,0,0,.6));filter:var(--peek-carousel-image-filter,brightness(.8) saturate(.9))}.peek-carousel--radial .peek-carousel__item:not(.peek-carousel--radial .peek-carousel__item--active) .peek-carousel__image{box-shadow:var(--peek-carousel-card-shadow,0 20px 50px rgba(0,0,0,.5));filter:var(--peek-carousel-image-filter,brightness(.7) saturate(.85))}@media (max-width:768px){.peek-carousel--radial .peek-carousel__item{--item-radius:300px}}.peek-carousel--classic{overflow:hidden}.peek-carousel--classic .peek-carousel__track{transform:translateX(calc(var(--track-offset, 0px) + var(--drag-offset)));transition:transform .5s cubic-bezier(.4,0,.2,1)}.peek-carousel--classic .peek-carousel__track:active{transition:transform .05s}.peek-carousel--classic .peek-carousel__item{cursor:default;left:var(--item-x,50%);opacity:0;position:absolute;transform:translate(-50%,-50%) scale(var(--item-scale,1));transition:transform .5s cubic-bezier(.4,0,.2,1),opacity .5s cubic-bezier(.4,0,.2,1),left .5s cubic-bezier(.4,0,.2,1),visibility 0s cubic-bezier(.4,0,.2,1) .5s,z-index 0s;visibility:hidden;z-index:0}.peek-carousel--classic .peek-carousel__item--active{cursor:grab;opacity:1;transition:transform .5s cubic-bezier(.4,0,.2,1),opacity .5s cubic-bezier(.4,0,.2,1),left .5s cubic-bezier(.4,0,.2,1),visibility 0s 0s,z-index 0s;visibility:visible;z-index:100}.peek-carousel--classic .peek-carousel__item--active:active{cursor:grabbing}.peek-carousel--classic .peek-carousel__item--active .peek-carousel__image{box-shadow:var(--peek-carousel-active-shadow,0 40px 100px rgba(102,126,234,.6),0 0 40px rgba(102,126,234,.4),0 0 80px rgba(118,75,162,.3));filter:var(--peek-carousel-image-filter,brightness(1.15) saturate(1.1))}.peek-carousel--classic .peek-carousel__item--next,.peek-carousel--classic .peek-carousel__item--prev{cursor:pointer;opacity:.6;transition:transform .5s cubic-bezier(.4,0,.2,1),opacity .5s cubic-bezier(.4,0,.2,1),left .5s cubic-bezier(.4,0,.2,1),visibility 0s 0s,z-index 0s;visibility:visible;z-index:50}.peek-carousel--classic .peek-carousel__item--next .peek-carousel__image,.peek-carousel--classic .peek-carousel__item--prev .peek-carousel__image{box-shadow:var(--peek-carousel-card-shadow,0 25px 60px rgba(0,0,0,.5));filter:var(--peek-carousel-image-filter,brightness(.8) saturate(.95))}.peek-carousel--classic .peek-carousel__item--next:hover .peek-carousel__image,.peek-carousel--classic .peek-carousel__item--prev:hover .peek-carousel__image{box-shadow:var(--peek-carousel-card-shadow,0 30px 70px rgba(102,126,234,.3))!important;filter:var(--peek-carousel-image-filter,brightness(1) saturate(1.05))!important;transition:all .3s ease}.peek-carousel--classic .peek-carousel__item:not(.peek-carousel--classic .peek-carousel__item--active):not(.peek-carousel--classic .peek-carousel__item--prev):not(.peek-carousel--classic .peek-carousel__item--next) .peek-carousel__image{box-shadow:var(--peek-carousel-card-shadow,0 10px 30px rgba(0,0,0,.3));filter:var(--peek-carousel-image-filter,brightness(.5) saturate(.7))}.peek-carousel--fan .peek-carousel__track{transform:none}.peek-carousel--fan .peek-carousel__item{cursor:pointer;opacity:1;transform:translate(calc(-50% + var(--fan-x) + var(--drag-offset)),calc(-50% + var(--fan-y))) rotate(calc(var(--fan-angle) + var(--drag-rotation))) scale(var(--fan-scale));transform-origin:50% 100%;transition:transform .5s cubic-bezier(.22,1,.36,1);visibility:visible;z-index:var(--fan-layer)}.peek-carousel--fan .peek-carousel__item--active .peek-carousel__image{box-shadow:var(--peek-carousel-active-shadow,var(--peek-carousel-card-shadow,0 18px 45px rgba(0,0,0,.25)))}.peek-carousel--fan .peek-carousel__item .peek-carousel__image{filter:var(--peek-carousel-image-filter,none)}.peek-carousel--fan .peek-carousel__item--fan-repositioning{transition:none}.peek-carousel--fan .peek-carousel__item--fan-hidden{opacity:0;pointer-events:none;visibility:hidden}@media (prefers-reduced-motion:reduce){.peek-carousel--fan .peek-carousel__item{animation:none;transition:none}}.peek-carousel__controls{align-items:center;animation:fadeInUpControls .6s cubic-bezier(.4,0,.2,1) forwards;animation-delay:.6s;display:flex;gap:.75rem;inset:auto auto 3% 50%;opacity:0;position:absolute;transform:translateX(-50%);z-index:100}.peek-carousel__indicators{align-items:center;-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);background:var(--peek-carousel-indicators-background,rgba(0,0,0,.5));border:1px solid hsla(0,0%,100%,.15);border-radius:50px;display:flex;gap:.875rem;padding:.625rem 1rem}.peek-carousel__indicator{align-items:center;background:transparent;border:none;border-radius:50%;cursor:pointer;display:flex;height:10px;justify-content:center;padding:0;position:relative;transition:all .3s ease;width:10px}.peek-carousel__indicator:before{background:var(--peek-carousel-indicator-color,hsla(0,0%,100%,.4));border-radius:50%;content:"";height:10px;transition:all .3s ease;width:10px}.peek-carousel__indicator:hover:before{background:var(--peek-carousel-indicator-color,hsla(0,0%,100%,.6));transform:scale(1.2)}.peek-carousel__indicator--active{border-radius:50px;overflow:hidden;width:50px}.peek-carousel__indicator--active:before{background:var(--peek-carousel-indicator-track-color,hsla(0,0%,100%,.3));border-radius:50px;content:"";height:8px;transition:all .3s ease;width:50px}.peek-carousel__indicator--active:after{background:var(--peek-carousel-indicator-active-color,hsla(0,0%,100%,.95));border-radius:50px;box-shadow:var(--peek-carousel-indicator-shadow,0 2px 8px hsla(0,0%,100%,.3),0 0 12px hsla(0,0%,100%,.2));content:"";height:8px;inset:50% auto auto 0;position:absolute;transform:translateY(-50%);transition:all .3s ease;width:50px}.peek-carousel__indicator--active:hover:before{background:var(--peek-carousel-indicator-track-color,hsla(0,0%,100%,.4))}.peek-carousel__indicator--active:hover:after{background:var(--peek-carousel-indicator-active-color,#fff);box-shadow:var(--peek-carousel-indicator-shadow,0 2px 12px hsla(0,0%,100%,.4),0 0 16px hsla(0,0%,100%,.3))}.peek-carousel__indicator--active.peek-carousel__indicator--progress:after{animation:indicatorProgress linear forwards;animation-duration:var(--progress-duration,2.5s);width:0}.peek-carousel__indicator--completed:after{animation:none;width:50px!important}@keyframes fadeInUpControls{0%{opacity:0;transform:translateX(-50%) translateY(20px)}to{opacity:1;transform:translateX(-50%) translateY(0)}}@keyframes indicatorProgress{0%{width:0}to{width:50px}}.peek-carousel__nav{align-items:center;animation:fadeInUpNav .6s cubic-bezier(.4,0,.2,1) forwards;animation-delay:.5s;display:flex;gap:2rem;inset:auto auto max(8%,3% + var(--peek-carousel-button-size,0px) * 1.2) 50%;opacity:0;position:absolute;transform:translateX(-50%);z-index:100}@media (max-width:768px){.peek-carousel__nav{bottom:max(12%,3% + var(--peek-carousel-button-size,0px) * 1.2)}}.peek-carousel__btn{align-items:center;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);background:var(--peek-carousel-button-background,hsla(0,0%,100%,.1));border:1px solid var(--peek-carousel-button-border-color,hsla(0,0%,100%,.2));border-radius:var(--peek-carousel-button-radius,50%);color:var(--peek-carousel-text-color,#fff);cursor:pointer;display:flex;display:grid;font-family:inherit;font-size:1rem;height:var(--peek-carousel-button-size,36px);justify-content:center;place-items:center;transition:all .3s ease;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:var(--peek-carousel-button-size,36px)}.peek-carousel__btn svg{flex-shrink:0;height:18px;transition:transform .15s ease-out;width:18px}.peek-carousel__btn:hover{background:var(--peek-carousel-button-hover-background,hsla(0,0%,100%,.2));transform:scale(1.1)}.peek-carousel__btn:active{transform:scale(.95)}.peek-carousel__btn:focus-visible{outline:3px solid var(--peek-carousel-focus-color,rgba(102,126,234,.8));outline-offset:4px}.peek-carousel__btn:hover svg{transform:translateX(0)}.peek-carousel__btn.prev-btn:hover svg{transform:translateX(-2px)}.peek-carousel__btn.next-btn:hover svg{transform:translateX(2px)}@media (max-width:768px){.peek-carousel__btn{height:var(--peek-carousel-button-size,36px);width:var(--peek-carousel-button-size,36px)}}.peek-carousel__btn--auto-rotate{align-items:center;-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);background:var(--peek-carousel-button-background,rgba(0,0,0,.5));border:1px solid var(--peek-carousel-button-border-color,hsla(0,0%,100%,.15));border-radius:var(--peek-carousel-button-radius,50%);cursor:pointer;display:flex;height:var(--peek-carousel-button-size,36px);justify-content:center;padding:0;transition:all .3s ease;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:var(--peek-carousel-button-size,36px)}.peek-carousel__btn--auto-rotate svg{flex-shrink:0}.peek-carousel__btn--auto-rotate .play-icon{display:block}.peek-carousel__btn--auto-rotate .pause-icon{display:none}.peek-carousel__btn--auto-rotate:hover{background:var(--peek-carousel-button-hover-background,rgba(0,0,0,.6));border-color:var(--peek-carousel-button-border-color,hsla(0,0%,100%,.3));transform:scale(1.1)}.peek-carousel__btn--auto-rotate:active{transform:scale(.95)}.peek-carousel__btn--auto-rotate:focus-visible{outline:3px solid var(--peek-carousel-focus-color,rgba(102,126,234,.8));outline-offset:4px}.peek-carousel__btn--auto-rotate.peek-carousel__btn--active{background:var(--peek-carousel-button-active-background,hsla(0,0%,100%,.2));border-color:var(--peek-carousel-button-border-color,hsla(0,0%,100%,.3))}.peek-carousel__btn--auto-rotate.peek-carousel__btn--active .play-icon{display:none}.peek-carousel__btn--auto-rotate.peek-carousel__btn--active .pause-icon{display:block}@keyframes fadeInUpNav{0%{opacity:0;transform:translateX(-50%) translateY(20px)}to{opacity:1;transform:translateX(-50%) translateY(0)}}.peek-carousel__counter{animation:fadeInDown .6s cubic-bezier(.4,0,.2,1) forwards;animation-delay:.7s;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);background:var(--peek-carousel-counter-background,rgba(0,0,0,.5));border:1px solid hsla(0,0%,100%,.15);border-radius:20px;color:var(--peek-carousel-text-color,#fff);font-size:.875rem;font-weight:500;inset:3% auto auto 3%;line-height:1;opacity:0;padding:.5rem 1rem;pointer-events:none;position:absolute;transform:translateY(-10px);-webkit-user-select:none;-moz-user-select:none;user-select:none;z-index:100}@media (max-width:768px){.peek-carousel__counter{font-size:.75rem;inset:2% auto auto 2%;padding:.4rem .8rem;position:absolute}}.peek-carousel__counter-separator{margin:0 .25rem;opacity:.7}.peek-carousel__counter-current{font-weight:600}.peek-carousel__counter-total{opacity:.8}@keyframes fadeInDown{to{opacity:1;transform:translateY(0)}}
|
package/docs/en/reference.md
CHANGED
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
## Loading built files
|
|
10
10
|
|
|
11
11
|
See the [quick start](../../README.en.md#quick-start) for ESM and CSS imports.
|
|
12
|
-
Without a bundler, load
|
|
13
|
-
`dist/peek-carousel.js` with a regular `<script>`, then use
|
|
14
|
-
`PeekCarousel` constructor. CommonJS uses `require('peek-carousel')`.
|
|
12
|
+
Without a bundler, load the installed package’s `dist/peek-carousel.min.css`
|
|
13
|
+
with `<link>` and `dist/peek-carousel.js` with a regular `<script>`, then use
|
|
14
|
+
the global `PeekCarousel` constructor. CommonJS uses `require('peek-carousel')`.
|
|
15
15
|
Construction requires a browser DOM; matching ESM/CommonJS declarations support
|
|
16
16
|
TypeScript `NodeNext`.
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
generated.
|
|
18
|
+
The npm package includes distribution JS/CSS and type declarations. See
|
|
19
|
+
[installation](../../README.en.md#installation). The UMD filename is
|
|
20
|
+
`peek-carousel.js`; no `peek-carousel.min.js` is generated.
|
|
21
21
|
|
|
22
22
|
## Configuration options
|
|
23
23
|
|
|
@@ -120,11 +120,9 @@ require verification in the integrating application. Accessibility conformance
|
|
|
120
120
|
and compatibility with specific older mobile operating systems are not
|
|
121
121
|
guaranteed.
|
|
122
122
|
|
|
123
|
-
The support target is iOS/iPadOS Safari 15.0 and later.
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
Automation exercises current browser engines and selected missing APIs. iOS 15
|
|
127
|
-
physical-device, VoiceOver and native touch-gesture checks remain unverified.
|
|
123
|
+
The support target is iOS/iPadOS Safari 15.0 and later. iOS 15 physical-device,
|
|
124
|
+
VoiceOver and native touch-gesture checks have not yet been performed; automated
|
|
125
|
+
WebKit checks do not replace them.
|
|
128
126
|
|
|
129
127
|
## Multiple carousels and styling
|
|
130
128
|
|
|
@@ -202,9 +200,9 @@ container.style.removeProperty('--peek-carousel-indicator-active-color');
|
|
|
202
200
|
|
|
203
201
|
The [live custom theme example](../../examples/custom-theme.html) includes
|
|
204
202
|
Original, Light, and Flat presets, color/radius/button size controls, and
|
|
205
|
-
generated CSS.
|
|
206
|
-
[
|
|
207
|
-
|
|
203
|
+
generated CSS. Try the
|
|
204
|
+
[hosted theme example](https://lledellebell.github.io/peek-carousel/examples/custom-theme.html)
|
|
205
|
+
without installing the package.
|
|
208
206
|
|
|
209
207
|
## Troubleshooting
|
|
210
208
|
|
|
@@ -216,6 +214,6 @@ open `/examples/custom-theme.html`.
|
|
|
216
214
|
| Duplicate controls after changing views | Keep one active instance per container. Call `destroy()` before reinitializing; the next instance resets the previous generated state. |
|
|
217
215
|
| Demo photos do not load | The main demo requests `picsum.photos`. Check network/CSP settings or supply your own images. |
|
|
218
216
|
|
|
219
|
-
The main demo requests external photos. The custom theme example
|
|
220
|
-
|
|
217
|
+
The main demo requests external photos. The custom theme example uses inline SVG
|
|
218
|
+
and can run without external photo requests. See the
|
|
221
219
|
[third-party notices](../../THIRD_PARTY_NOTICES.md) for image sources.
|
package/docs/integrations.md
CHANGED
|
@@ -1,25 +1,122 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 프로젝트별 연동 · Integrations
|
|
2
|
+
|
|
3
|
+
[한국어](#한국어-연동-안내) · [English](#use-peekcarousel-across-projects)
|
|
4
|
+
|
|
5
|
+
## 한국어 연동 안내
|
|
6
|
+
|
|
7
|
+
PeekCarousel은 브라우저에서 실행합니다. TypeScript 타입 선언을 포함하며,
|
|
8
|
+
Python·Go·Ruby·PHP·Java·.NET 서버 프로젝트는 같은 JS·CSS를 정적 파일로 제공해
|
|
9
|
+
연동합니다. 해당 서버 언어의 네이티브 API를 제공하는 것은 아닙니다.
|
|
10
|
+
|
|
11
|
+
### 설치와 실행 환경
|
|
12
|
+
|
|
13
|
+
[설치 안내](../README.md#설치)에 따라 `npm install peek-carousel`로 설치하세요.
|
|
14
|
+
배포용 JS·CSS와 타입 선언이 포함되어 있어 라이브러리 소스를 따로 빌드하거나
|
|
15
|
+
`@types` 패키지를 설치할 필요가 없습니다. 앱의 번들러·정적 파일 처리 절차는
|
|
16
|
+
그대로 사용하세요. 생성자는 브라우저 DOM이 준비된 뒤 호출해야 합니다.
|
|
17
|
+
|
|
18
|
+
| 환경 | 불러오는 방법 |
|
|
19
|
+
| -------------------- | ------------------------------------ |
|
|
20
|
+
| TypeScript NodeNext | ESM 기본 import 또는 CommonJS 생성자 |
|
|
21
|
+
| TypeScript Bundler | 기본 import와 옵션 타입 |
|
|
22
|
+
| JavaScript `checkJs` | 기본 import와 JSDoc 옵션 타입 |
|
|
23
|
+
| 번들러 없는 브라우저 | CSS link와 UMD script |
|
|
24
|
+
| 서버 템플릿 | HTML과 브라우저용 정적 파일 제공 |
|
|
25
|
+
|
|
26
|
+
### TypeScript와 JavaScript
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
import PeekCarousel, {type PeekCarouselOptions} from 'peek-carousel';
|
|
30
|
+
import 'peek-carousel/dist/peek-carousel.css';
|
|
31
|
+
|
|
32
|
+
const options = {
|
|
33
|
+
layoutMode: 'fan',
|
|
34
|
+
startIndex: 0,
|
|
35
|
+
enableKeyboard: false,
|
|
36
|
+
} satisfies PeekCarouselOptions;
|
|
37
|
+
|
|
38
|
+
const host = document.querySelector<HTMLElement>('.gallery-carousel');
|
|
39
|
+
if (!host) {
|
|
40
|
+
throw new Error('Gallery markup is missing');
|
|
41
|
+
}
|
|
42
|
+
const carousel = new PeekCarousel(host, options);
|
|
43
|
+
|
|
44
|
+
carousel.next();
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
호스트 높이와 트랙·슬라이드 마크업은 [빠른 시작](../README.md#빠른-시작)을
|
|
48
|
+
참조하세요. 여러 인스턴스에는 고유한 ID 또는 각각의 DOM 참조를 사용합니다. 일반
|
|
49
|
+
JavaScript에서는 위 코드의 타입 import와 `satisfies`를 빼고 사용하세요.
|
|
50
|
+
`checkJs` 환경에서는 JSDoc에 `import('peek-carousel').PeekCarouselOptions`로
|
|
51
|
+
옵션 타입을 지정할 수 있습니다.
|
|
52
|
+
|
|
53
|
+
### 프레임워크 생명주기
|
|
54
|
+
|
|
55
|
+
| 환경 | 초기화 시점 | 정리 시점 |
|
|
56
|
+
| ------ | --------------------------------- | ---------------------------------- |
|
|
57
|
+
| React | DOM ref를 사용하는 `useEffect` | 반환하는 정리 함수에서 `destroy()` |
|
|
58
|
+
| Vue | template ref가 준비된 `onMounted` | `onBeforeUnmount`에서 `destroy()` |
|
|
59
|
+
| Svelte | 동기 `onMount` 콜백 | 반환하는 정리 함수에서 `destroy()` |
|
|
60
|
+
|
|
61
|
+
인스턴스는 컴포넌트별로 보관하고 DOM 제거·교체 전에 정리하세요. 서버 렌더링
|
|
62
|
+
도중이나 렌더마다 초기화하지 마세요. 프레임워크와 캐러셀이 같은 슬라이드 노드를
|
|
63
|
+
동시에 재배열·교체하지 않도록 하세요. 슬라이드 목록을 바꿀 때는 먼저 해제하고
|
|
64
|
+
마크업을 갱신한 다음 새 인스턴스를 만듭니다.
|
|
65
|
+
|
|
66
|
+
별도의 React·Vue·Svelte 패키지는 제공하지 않으며, 프레임워크별 앱 전체 검증은
|
|
67
|
+
수행하지 않았습니다. 설치한 프레임워크의 CSS 로딩 및 클라이언트·서버 경계 규칙은
|
|
68
|
+
아래 공식 문서를 참조하세요.
|
|
69
|
+
|
|
70
|
+
### Python·Go 등 서버 프로젝트
|
|
71
|
+
|
|
72
|
+
설치한 패키지의 `dist/peek-carousel.min.css`와 `dist/peek-carousel.js`를 앱의
|
|
73
|
+
정적 파일 경로로 복사·제공하세요. 다음은 앱에서 직접 정하는 URL 예시이며,
|
|
74
|
+
호스팅된 CDN 주소가 아닙니다. 스크립트는 표시한 순서대로 불러옵니다.
|
|
75
|
+
|
|
76
|
+
```html
|
|
77
|
+
<link rel="stylesheet" href="/static/peek-carousel/peek-carousel.min.css" />
|
|
78
|
+
<script src="/static/peek-carousel/peek-carousel.js" defer></script>
|
|
79
|
+
<script src="/static/gallery.js" defer></script>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
별도의 `gallery.js` 파일에서 초기화합니다.
|
|
83
|
+
|
|
84
|
+
```javascript
|
|
85
|
+
const host = document.querySelector('.gallery-carousel');
|
|
86
|
+
if (host) {
|
|
87
|
+
const carousel = new PeekCarousel(host, {layoutMode: 'fan', startIndex: 0});
|
|
88
|
+
// 클라이언트 코드가 호스트를 교체하기 전에 carousel.destroy()를 호출하세요.
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Django·Flask·Go templates·Rails·Laravel·Spring·ASP.NET 등에서 같은 방식을 사용할
|
|
93
|
+
수 있습니다. 클라이언트 라우팅이나 부분 HTML 교체 전에는 기존 인스턴스의
|
|
94
|
+
`destroy()`를 호출하세요. 재배포하는 자산에는 `LICENSE`·`LICENSE-MIT`·
|
|
95
|
+
`THIRD_PARTY_NOTICES.md`를 포함하세요. 앱 통합과 라이브러리 자체의 독립 재배포
|
|
96
|
+
조건은 [이용 조건](../LICENSE)과 [저작권 안내](../COPYRIGHT.md)를 확인하세요.
|
|
97
|
+
|
|
98
|
+
## Use PeekCarousel across projects
|
|
2
99
|
|
|
3
100
|
PeekCarousel runs in the browser. TypeScript projects can use the included
|
|
4
101
|
option and instance types; projects written in another server language can serve
|
|
5
102
|
the same browser JavaScript and CSS. This does not provide native Python, Go,
|
|
6
103
|
Ruby, PHP, Java or .NET APIs.
|
|
7
104
|
|
|
8
|
-
|
|
105
|
+
### Checked entry points
|
|
9
106
|
|
|
10
|
-
| Project setup | Integration |
|
|
11
|
-
| ----------------------------------- | ------------------------------------------ |
|
|
12
|
-
| TypeScript with NodeNext resolution | Default ESM import or CommonJS constructor |
|
|
13
|
-
| TypeScript with Bundler resolution | Default import and named option type |
|
|
14
|
-
| JavaScript with `checkJs` | Default import and JSDoc option type |
|
|
15
|
-
| Browser without a bundler | CSS link and UMD script |
|
|
16
|
-
| Server-rendered templates | Serve the browser assets with the page |
|
|
107
|
+
| Project setup | Integration |
|
|
108
|
+
| ----------------------------------- | ------------------------------------------ |
|
|
109
|
+
| TypeScript with NodeNext resolution | Default ESM import or CommonJS constructor |
|
|
110
|
+
| TypeScript with Bundler resolution | Default import and named option type |
|
|
111
|
+
| JavaScript with `checkJs` | Default import and JSDoc option type |
|
|
112
|
+
| Browser without a bundler | CSS link and UMD script |
|
|
113
|
+
| Server-rendered templates | Serve the browser assets with the page |
|
|
17
114
|
|
|
18
|
-
|
|
115
|
+
Install the published npm package using the
|
|
19
116
|
[installation instructions](../README.en.md#installation). No additional
|
|
20
117
|
`@types` package or runtime dependency is needed.
|
|
21
118
|
|
|
22
|
-
|
|
119
|
+
### TypeScript and JavaScript
|
|
23
120
|
|
|
24
121
|
```typescript
|
|
25
122
|
import PeekCarousel, {type PeekCarouselOptions} from 'peek-carousel';
|
|
@@ -51,7 +148,7 @@ The host needs a height, a `.peek-carousel__track` child, and
|
|
|
51
148
|
contains complete markup. A stable element reference avoids duplicate selector
|
|
52
149
|
IDs when several component instances are mounted.
|
|
53
150
|
|
|
54
|
-
|
|
151
|
+
### Component lifecycle
|
|
55
152
|
|
|
56
153
|
Initialize after the framework has mounted the DOM and destroy before removing
|
|
57
154
|
it. Keep each instance local to its component. Do not initialize during server
|
|
@@ -65,18 +162,17 @@ reorder or replace the same slide nodes.
|
|
|
65
162
|
| Svelte | Synchronous `onMount` callback | Return a function that calls `destroy()` |
|
|
66
163
|
|
|
67
164
|
These are lifecycle integration patterns, not separately published framework
|
|
68
|
-
components.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
fresh instance.
|
|
165
|
+
components. Full React, Vue and Svelte applications have not been verified.
|
|
166
|
+
Follow the installed framework's asset-loading and client/server boundary rules.
|
|
167
|
+
When replacing the slide collection, destroy, update the markup, and initialize
|
|
168
|
+
a fresh instance.
|
|
73
169
|
|
|
74
170
|
The patterns follow the official
|
|
75
171
|
[React effect documentation](https://react.dev/reference/react/useEffect),
|
|
76
172
|
[Vue lifecycle API](https://vuejs.org/api/composition-api-lifecycle.html) and
|
|
77
173
|
[Svelte lifecycle documentation](https://svelte.dev/docs/svelte/lifecycle-hooks).
|
|
78
174
|
|
|
79
|
-
|
|
175
|
+
### Python, Go and other server projects
|
|
80
176
|
|
|
81
177
|
Django, Flask, Go templates, Rails, Laravel, Spring and ASP.NET can serve the
|
|
82
178
|
built assets through their existing static-file mechanism. Render the same HTML
|
|
@@ -99,14 +195,9 @@ if (host) {
|
|
|
99
195
|
```
|
|
100
196
|
|
|
101
197
|
For client-side route changes or partial HTML replacement, call `destroy()` at
|
|
102
|
-
the application's removal boundary before creating the next instance.
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
NodeNext·Bundler 방식의 TypeScript와 타입 검사하는 JavaScript를 검증합니다.
|
|
109
|
-
React·Vue·Svelte에서는 DOM 마운트 후 초기화하고 제거 시 `destroy()`를
|
|
110
|
-
호출합니다. Python·Go 등 서버 프로젝트는 HTML과 정적 JS/CSS를 제공하는 방식으로
|
|
111
|
-
연동합니다. 별도의 네이티브 언어 API나 프레임워크 패키지를 제공하는 것은
|
|
112
|
-
아닙니다.
|
|
198
|
+
the application's removal boundary before creating the next instance.
|
|
199
|
+
Application integration is allowed under [LICENSE](../LICENSE). Include the
|
|
200
|
+
current license, legacy MIT license and third-party notices with redistributed
|
|
201
|
+
assets. Standalone redistribution of new covered library material requires
|
|
202
|
+
separate written permission. Example URLs above are placeholders for the
|
|
203
|
+
application's static routing, not hosted CDN URLs.
|
package/docs/ko/reference.md
CHANGED
|
@@ -8,14 +8,15 @@
|
|
|
8
8
|
## 빌드 파일 불러오기
|
|
9
9
|
|
|
10
10
|
ESM·CSS import는 [빠른 시작](../../README.md#빠른-시작)을 참조하세요. 번들러
|
|
11
|
-
없이 사용하려면
|
|
11
|
+
없이 사용하려면 설치한 패키지의 `dist/peek-carousel.min.css`를 `<link>`로,
|
|
12
12
|
`dist/peek-carousel.js`를 일반 `<script>`로 불러온 뒤 전역 `PeekCarousel`
|
|
13
13
|
생성자를 사용합니다. CommonJS는 `require('peek-carousel')`로 불러옵니다.
|
|
14
14
|
생성자는 브라우저 DOM이 필요하며 TypeScript `NodeNext`에 맞는 ESM·CommonJS 타입
|
|
15
15
|
선언을 제공합니다.
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
npm으로 설치한 패키지에는 배포용 JS·CSS와 타입 선언이 포함됩니다.
|
|
18
|
+
[설치 안내](../../README.md#설치)를 참조하세요. UMD 파일 이름은
|
|
19
|
+
`peek-carousel.js`이며 `peek-carousel.min.js`는 생성하지 않습니다.
|
|
19
20
|
|
|
20
21
|
## 설정 옵션
|
|
21
22
|
|
|
@@ -114,11 +115,8 @@ Space·Enter는 기본 버튼 활성화 동작을 사용합니다. 일반 페이
|
|
|
114
115
|
설정·키보드 포커스 흐름은 통합한 앱에서 검증해야 합니다. 접근성 규격 준수나 특정
|
|
115
116
|
구형 모바일 OS 호환성을 보장하지 않습니다.
|
|
116
117
|
|
|
117
|
-
지원
|
|
118
|
-
|
|
119
|
-
사용합니다. `:focus-visible` 미지원 브라우저에는 초점 표시 대체 스타일을
|
|
120
|
-
제공합니다. 자동 검증은 현재 브라우저 엔진과 일부 API 부재 조건을 확인합니다.
|
|
121
|
-
iOS 15 실기기·VoiceOver·실제 터치 제스처 검증은 아직 수행하지 않았습니다.
|
|
118
|
+
지원 대상은 iOS/iPadOS Safari 15.0 이상입니다. iOS 15 실기기·VoiceOver·실제 터치
|
|
119
|
+
제스처 검증은 아직 수행하지 않았으며, 자동 WebKit 검사가 이를 대신하지 않습니다.
|
|
122
120
|
|
|
123
121
|
## 여러 캐러셀과 스타일 변경
|
|
124
122
|
|
|
@@ -196,8 +194,9 @@ container.style.removeProperty('--peek-carousel-indicator-active-color');
|
|
|
196
194
|
|
|
197
195
|
[실시간 커스텀 테마 예제](../../examples/custom-theme.html)는
|
|
198
196
|
Original·Light·Flat 프리셋, 색상·모서리·버튼 크기 조절과 CSS 출력 기능을
|
|
199
|
-
제공합니다.
|
|
200
|
-
|
|
197
|
+
제공합니다.
|
|
198
|
+
[호스팅된 한국어 테마 예제](https://lledellebell.github.io/peek-carousel/examples/custom-theme.ko.html)에서
|
|
199
|
+
설치 없이 체험할 수 있습니다.
|
|
201
200
|
|
|
202
201
|
## 문제 해결
|
|
203
202
|
|
|
@@ -209,6 +208,6 @@ Original·Light·Flat 프리셋, 색상·모서리·버튼 크기 조절과 CSS
|
|
|
209
208
|
| 화면 전환 후 컨트롤이 중복됨 | 컨테이너마다 활성 인스턴스는 하나만 두세요. 재생성 전에 `destroy()`를 호출하면 다음 초기화가 이전 생성 상태를 정리합니다. |
|
|
210
209
|
| 데모 사진이 로드되지 않음 | 기본 데모는 `picsum.photos`를 요청합니다. 네트워크·CSP 설정을 확인하거나 직접 제공하는 이미지로 교체하세요. |
|
|
211
210
|
|
|
212
|
-
기본 데모는 외부 사진을 요청합니다. 커스텀 테마
|
|
213
|
-
|
|
211
|
+
기본 데모는 외부 사진을 요청합니다. 커스텀 테마 예제는 인라인 SVG를 사용해 외부
|
|
212
|
+
사진 요청 없이 실행할 수 있습니다. 이미지 출처는
|
|
214
213
|
[제3자 자료 안내](../../THIRD_PARTY_NOTICES.md)를 참조하세요.
|