@slidejs/runner-swiper 0.1.2 → 0.1.3
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/.turbo/turbo-build.log +15 -15
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +401 -382
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
- package/src/adapter.ts +8 -10
- package/src/env.d.ts +17 -0
- package/src/index.ts +3 -0
- package/src/runner.ts +39 -2
- package/src/style.css +154 -0
- package/tsconfig.json +1 -1
- package/vite.config.ts +12 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
|
|
2
|
-
> @slidejs/runner-swiper@0.1.
|
|
2
|
+
> @slidejs/runner-swiper@0.1.3 build /Volumes/ORICO/ws/prj/slidejs/slidejs/packages/@slidejs/runner-swiper
|
|
3
3
|
> vite build
|
|
4
4
|
|
|
5
|
-
vite
|
|
5
|
+
vite v7.3.1 building client environment for production...
|
|
6
|
+
transforming...
|
|
7
|
+
✓ 37 modules transformed.
|
|
8
|
+
rendering chunks...
|
|
9
|
+
|
|
10
|
+
[vite:dts] Start generate declaration files...
|
|
11
|
+
computing gzip size...
|
|
6
12
|
[96msrc/adapter.ts[0m:[93m9[0m:[93m15[0m - [91merror[0m[90m TS2614: [0mModule '"swiper"' has no exported member 'SwiperOptions'. Did you mean to use 'import SwiperOptions from "swiper"' instead?
|
|
7
13
|
|
|
8
14
|
[7m9[0m import type { SwiperOptions } from 'swiper';
|
|
9
15
|
[7m [0m [91m ~~~~~~~~~~~~~[0m
|
|
10
|
-
[96msrc/adapter.ts[0m:[
|
|
16
|
+
[96msrc/adapter.ts[0m:[93m359[0m:[93m10[0m - [91merror[0m[90m TS2352: [0mConversion of type 'HTMLElement' to type 'Record<string, unknown>' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
|
|
11
17
|
Index signature for type 'string' is missing in type 'HTMLElement'.
|
|
12
18
|
|
|
13
|
-
[
|
|
19
|
+
[7m359[0m (element as Record<string, unknown>)[key] = value;
|
|
14
20
|
[7m [0m [91m ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[0m
|
|
15
21
|
[96msrc/types.ts[0m:[93m7[0m:[93m15[0m - [91merror[0m[90m TS2614: [0mModule '"swiper"' has no exported member 'SwiperOptions'. Did you mean to use 'import SwiperOptions from "swiper"' instead?
|
|
16
22
|
|
|
17
23
|
[7m7[0m import type { SwiperOptions } from 'swiper';
|
|
18
24
|
[7m [0m [91m ~~~~~~~~~~~~~[0m
|
|
19
25
|
|
|
20
|
-
|
|
21
|
-
✓ 35 modules transformed.
|
|
22
|
-
rendering chunks...
|
|
23
|
-
|
|
24
|
-
[vite:dts] Start generate declaration files...
|
|
25
|
-
computing gzip size...
|
|
26
|
-
dist/index.mjs 30.73 kB │ gzip: 8.75 kB │ map: 92.43 kB
|
|
26
|
+
dist/index.mjs 40.72 kB │ gzip: 12.40 kB │ map: 95.75 kB
|
|
27
27
|
[vite:dts] Start rollup declaration files...
|
|
28
|
-
Analysis will use the bundled TypeScript version 5.
|
|
28
|
+
Analysis will use the bundled TypeScript version 5.8.2
|
|
29
29
|
*** The target project appears to use TypeScript 5.9.3 which is newer than the bundled compiler engine; consider upgrading API Extractor.
|
|
30
|
-
[vite:dts] Declaration files built in
|
|
30
|
+
[vite:dts] Declaration files built in 7244ms.
|
|
31
31
|
|
|
32
|
-
dist/index.cjs
|
|
33
|
-
✓ built in
|
|
32
|
+
dist/index.cjs 31.51 kB │ gzip: 10.60 kB │ map: 92.50 kB
|
|
33
|
+
✓ built in 8.55s
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const V=require("swiper"),z=require("@slidejs/dsl"),Y=require("@slidejs/runner");function q(s){return s!==null&&typeof s=="object"&&"constructor"in s&&s.constructor===Object}function I(s,e){s===void 0&&(s={}),e===void 0&&(e={});const a=["__proto__","constructor","prototype"];Object.keys(e).filter(n=>a.indexOf(n)<0).forEach(n=>{typeof s[n]>"u"?s[n]=e[n]:q(e[n])&&q(s[n])&&Object.keys(e[n]).length>0&&I(s[n],e[n])})}const R={body:{},addEventListener(){},removeEventListener(){},activeElement:{blur(){},nodeName:""},querySelector(){return null},querySelectorAll(){return[]},getElementById(){return null},createEvent(){return{initEvent(){}}},createElement(){return{children:[],childNodes:[],style:{},setAttribute(){},getElementsByTagName(){return[]}}},createElementNS(){return{}},importNode(){return null},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""}};function j(){const s=typeof document<"u"?document:{};return I(s,R),s}const J={document:R,navigator:{userAgent:""},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""},history:{replaceState(){},pushState(){},go(){},back(){}},CustomEvent:function(){return this},addEventListener(){},removeEventListener(){},getComputedStyle(){return{getPropertyValue(){return""}}},Image(){},Date(){},screen:{},setTimeout(){},clearTimeout(){},matchMedia(){return{}},requestAnimationFrame(s){return typeof setTimeout>"u"?(s(),null):setTimeout(s,0)},cancelAnimationFrame(s){typeof setTimeout>"u"||clearTimeout(s)}};function O(){const s=typeof window<"u"?window:{};return I(s,J),s}function Q(s){return s===void 0&&(s=""),s.trim().split(" ").filter(e=>!!e.trim())}function Z(s,e){e===void 0&&(e="");const a=O(),n=[...s.children];return a.HTMLSlotElement&&s instanceof HTMLSlotElement&&n.push(...s.assignedElements()),e?n.filter(o=>o.matches(e)):n}function ee(s,e){e===void 0&&(e=[]);const a=document.createElement(s);return a.classList.add(...Array.isArray(e)?e:Q(e)),a}function te(s){const e=O(),a=j(),n=s.getBoundingClientRect(),o=a.body,r=s.clientTop||o.clientTop||0,g=s.clientLeft||o.clientLeft||0,b=s===e?e.scrollY:s.scrollTop,m=s===e?e.scrollX:s.scrollLeft;return{top:n.top+b-r,left:n.left+m-g}}function W(s){let e=s,a;if(e){for(a=0;(e=e.previousSibling)!==null;)e.nodeType===1&&(a+=1);return a}}function N(s,e){const a=[];let n=s.parentElement;for(;n;)e?n.matches(e)&&a.push(n):a.push(n),n=n.parentElement;return a}function ne(s,e,a){const n=O();return s[e==="width"?"offsetWidth":"offsetHeight"]+parseFloat(n.getComputedStyle(s,null).getPropertyValue(e==="width"?"margin-right":"margin-top"))+parseFloat(n.getComputedStyle(s,null).getPropertyValue(e==="width"?"margin-left":"margin-bottom"))}function L(s){return(Array.isArray(s)?s:[s]).filter(e=>!!e)}function F(s,e){e===void 0&&(e=""),typeof trustedTypes<"u"?s.innerHTML=trustedTypes.createPolicy("html",{createHTML:a=>a}).createHTML(e):s.innerHTML=e}function G(s){let{swiper:e,extendParams:a,on:n,emit:o}=s;const r=j(),g=O();e.keyboard={enabled:!1},a({keyboard:{enabled:!1,onlyInViewport:!0,pageUpDown:!0}});function b(H){if(!e.enabled)return;const{rtlTranslate:$}=e;let h=H;h.originalEvent&&(h=h.originalEvent);const x=h.keyCode||h.charCode,d=e.params.keyboard.pageUpDown,c=d&&x===33,u=d&&x===34,f=x===37,t=x===39,i=x===38,l=x===40;if(!e.allowSlideNext&&(e.isHorizontal()&&t||e.isVertical()&&l||u)||!e.allowSlidePrev&&(e.isHorizontal()&&f||e.isVertical()&&i||c))return!1;if(!(h.shiftKey||h.altKey||h.ctrlKey||h.metaKey)&&!(r.activeElement&&(r.activeElement.isContentEditable||r.activeElement.nodeName&&(r.activeElement.nodeName.toLowerCase()==="input"||r.activeElement.nodeName.toLowerCase()==="textarea")))){if(e.params.keyboard.onlyInViewport&&(c||u||f||t||i||l)){let p=!1;if(N(e.el,`.${e.params.slideClass}, swiper-slide`).length>0&&N(e.el,`.${e.params.slideActiveClass}`).length===0)return;const E=e.el,T=E.clientWidth,B=E.clientHeight,w=g.innerWidth,A=g.innerHeight,v=te(E);$&&(v.left-=E.scrollLeft);const D=[[v.left,v.top],[v.left+T,v.top],[v.left,v.top+B],[v.left+T,v.top+B]];for(let C=0;C<D.length;C+=1){const y=D[C];if(y[0]>=0&&y[0]<=w&&y[1]>=0&&y[1]<=A){if(y[0]===0&&y[1]===0)continue;p=!0}}if(!p)return}e.isHorizontal()?((c||u||f||t)&&(h.preventDefault?h.preventDefault():h.returnValue=!1),((u||t)&&!$||(c||f)&&$)&&e.slideNext(),((c||f)&&!$||(u||t)&&$)&&e.slidePrev()):((c||u||i||l)&&(h.preventDefault?h.preventDefault():h.returnValue=!1),(u||l)&&e.slideNext(),(c||i)&&e.slidePrev()),o("keyPress",x)}}function m(){e.keyboard.enabled||(r.addEventListener("keydown",b),e.keyboard.enabled=!0)}function k(){e.keyboard.enabled&&(r.removeEventListener("keydown",b),e.keyboard.enabled=!1)}n("init",()=>{e.params.keyboard.enabled&&m()}),n("destroy",()=>{e.keyboard.enabled&&k()}),Object.assign(e.keyboard,{enable:m,disable:k})}function U(s,e,a,n){return s.params.createElements&&Object.keys(n).forEach(o=>{if(!a[o]&&a.auto===!0){let r=Z(s.el,`.${n[o]}`)[0];r||(r=ee("div",n[o]),r.className=n[o],s.el.append(r)),a[o]=r,e[o]=r}}),a}function _(s){let{swiper:e,extendParams:a,on:n,emit:o}=s;a({navigation:{nextEl:null,prevEl:null,hideOnClick:!1,disabledClass:"swiper-button-disabled",hiddenClass:"swiper-button-hidden",lockClass:"swiper-button-lock",navigationDisabledClass:"swiper-navigation-disabled"}}),e.navigation={nextEl:null,prevEl:null};function r(d){let c;return d&&typeof d=="string"&&e.isElement&&(c=e.el.querySelector(d)||e.hostEl.querySelector(d),c)?c:(d&&(typeof d=="string"&&(c=[...document.querySelectorAll(d)]),e.params.uniqueNavElements&&typeof d=="string"&&c&&c.length>1&&e.el.querySelectorAll(d).length===1?c=e.el.querySelector(d):c&&c.length===1&&(c=c[0])),d&&!c?d:c)}function g(d,c){const u=e.params.navigation;d=L(d),d.forEach(f=>{f&&(f.classList[c?"add":"remove"](...u.disabledClass.split(" ")),f.tagName==="BUTTON"&&(f.disabled=c),e.params.watchOverflow&&e.enabled&&f.classList[e.isLocked?"add":"remove"](u.lockClass))})}function b(){const{nextEl:d,prevEl:c}=e.navigation;if(e.params.loop){g(c,!1),g(d,!1);return}g(c,e.isBeginning&&!e.params.rewind),g(d,e.isEnd&&!e.params.rewind)}function m(d){d.preventDefault(),!(e.isBeginning&&!e.params.loop&&!e.params.rewind)&&(e.slidePrev(),o("navigationPrev"))}function k(d){d.preventDefault(),!(e.isEnd&&!e.params.loop&&!e.params.rewind)&&(e.slideNext(),o("navigationNext"))}function H(){const d=e.params.navigation;if(e.params.navigation=U(e,e.originalParams.navigation,e.params.navigation,{nextEl:"swiper-button-next",prevEl:"swiper-button-prev"}),!(d.nextEl||d.prevEl))return;let c=r(d.nextEl),u=r(d.prevEl);Object.assign(e.navigation,{nextEl:c,prevEl:u}),c=L(c),u=L(u);const f=(t,i)=>{t&&t.addEventListener("click",i==="next"?k:m),!e.enabled&&t&&t.classList.add(...d.lockClass.split(" "))};c.forEach(t=>f(t,"next")),u.forEach(t=>f(t,"prev"))}function $(){let{nextEl:d,prevEl:c}=e.navigation;d=L(d),c=L(c);const u=(f,t)=>{f.removeEventListener("click",t==="next"?k:m),f.classList.remove(...e.params.navigation.disabledClass.split(" "))};d.forEach(f=>u(f,"next")),c.forEach(f=>u(f,"prev"))}n("init",()=>{e.params.navigation.enabled===!1?x():(H(),b())}),n("toEdge fromEdge lock unlock",()=>{b()}),n("destroy",()=>{$()}),n("enable disable",()=>{let{nextEl:d,prevEl:c}=e.navigation;if(d=L(d),c=L(c),e.enabled){b();return}[...d,...c].filter(u=>!!u).forEach(u=>u.classList.add(e.params.navigation.lockClass))}),n("click",(d,c)=>{let{nextEl:u,prevEl:f}=e.navigation;u=L(u),f=L(f);const t=c.target;let i=f.includes(t)||u.includes(t);if(e.isElement&&!i){const l=c.path||c.composedPath&&c.composedPath();l&&(i=l.find(p=>u.includes(p)||f.includes(p)))}if(e.params.navigation.hideOnClick&&!i){if(e.pagination&&e.params.pagination&&e.params.pagination.clickable&&(e.pagination.el===t||e.pagination.el.contains(t)))return;let l;u.length?l=u[0].classList.contains(e.params.navigation.hiddenClass):f.length&&(l=f[0].classList.contains(e.params.navigation.hiddenClass)),o(l===!0?"navigationShow":"navigationHide"),[...u,...f].filter(p=>!!p).forEach(p=>p.classList.toggle(e.params.navigation.hiddenClass))}});const h=()=>{e.el.classList.remove(...e.params.navigation.navigationDisabledClass.split(" ")),H(),b()},x=()=>{e.el.classList.add(...e.params.navigation.navigationDisabledClass.split(" ")),$()};Object.assign(e.navigation,{enable:h,disable:x,update:b,init:H,destroy:$})}function P(s){return s===void 0&&(s=""),`.${s.trim().replace(/([\.:!+\/()[\]])/g,"\\$1").replace(/ /g,".")}`}function K(s){let{swiper:e,extendParams:a,on:n,emit:o}=s;const r="swiper-pagination";a({pagination:{el:null,bulletElement:"span",clickable:!1,hideOnClick:!1,renderBullet:null,renderProgressbar:null,renderFraction:null,renderCustom:null,progressbarOpposite:!1,type:"bullets",dynamicBullets:!1,dynamicMainBullets:1,formatFractionCurrent:t=>t,formatFractionTotal:t=>t,bulletClass:`${r}-bullet`,bulletActiveClass:`${r}-bullet-active`,modifierClass:`${r}-`,currentClass:`${r}-current`,totalClass:`${r}-total`,hiddenClass:`${r}-hidden`,progressbarFillClass:`${r}-progressbar-fill`,progressbarOppositeClass:`${r}-progressbar-opposite`,clickableClass:`${r}-clickable`,lockClass:`${r}-lock`,horizontalClass:`${r}-horizontal`,verticalClass:`${r}-vertical`,paginationDisabledClass:`${r}-disabled`}}),e.pagination={el:null,bullets:[]};let g,b=0;function m(){return!e.params.pagination.el||!e.pagination.el||Array.isArray(e.pagination.el)&&e.pagination.el.length===0}function k(t,i){const{bulletActiveClass:l}=e.params.pagination;t&&(t=t[`${i==="prev"?"previous":"next"}ElementSibling`],t&&(t.classList.add(`${l}-${i}`),t=t[`${i==="prev"?"previous":"next"}ElementSibling`],t&&t.classList.add(`${l}-${i}-${i}`)))}function H(t,i,l){if(t=t%l,i=i%l,i===t+1)return"next";if(i===t-1)return"previous"}function $(t){const i=t.target.closest(P(e.params.pagination.bulletClass));if(!i)return;t.preventDefault();const l=W(i)*e.params.slidesPerGroup;if(e.params.loop){if(e.realIndex===l)return;const p=H(e.realIndex,l,e.slides.length);p==="next"?e.slideNext():p==="previous"?e.slidePrev():e.slideToLoop(l)}else e.slideTo(l)}function h(){const t=e.rtl,i=e.params.pagination;if(m())return;let l=e.pagination.el;l=L(l);let p,E;const T=e.virtual&&e.params.virtual.enabled?e.virtual.slides.length:e.slides.length,B=e.params.loop?Math.ceil(T/e.params.slidesPerGroup):e.snapGrid.length;if(e.params.loop?(E=e.previousRealIndex||0,p=e.params.slidesPerGroup>1?Math.floor(e.realIndex/e.params.slidesPerGroup):e.realIndex):typeof e.snapIndex<"u"?(p=e.snapIndex,E=e.previousSnapIndex):(E=e.previousIndex||0,p=e.activeIndex||0),i.type==="bullets"&&e.pagination.bullets&&e.pagination.bullets.length>0){const w=e.pagination.bullets;let A,v,D;if(i.dynamicBullets&&(g=ne(w[0],e.isHorizontal()?"width":"height"),l.forEach(C=>{C.style[e.isHorizontal()?"width":"height"]=`${g*(i.dynamicMainBullets+4)}px`}),i.dynamicMainBullets>1&&E!==void 0&&(b+=p-(E||0),b>i.dynamicMainBullets-1?b=i.dynamicMainBullets-1:b<0&&(b=0)),A=Math.max(p-b,0),v=A+(Math.min(w.length,i.dynamicMainBullets)-1),D=(v+A)/2),w.forEach(C=>{const y=[...["","-next","-next-next","-prev","-prev-prev","-main"].map(S=>`${i.bulletActiveClass}${S}`)].map(S=>typeof S=="string"&&S.includes(" ")?S.split(" "):S).flat();C.classList.remove(...y)}),l.length>1)w.forEach(C=>{const y=W(C);y===p?C.classList.add(...i.bulletActiveClass.split(" ")):e.isElement&&C.setAttribute("part","bullet"),i.dynamicBullets&&(y>=A&&y<=v&&C.classList.add(...`${i.bulletActiveClass}-main`.split(" ")),y===A&&k(C,"prev"),y===v&&k(C,"next"))});else{const C=w[p];if(C&&C.classList.add(...i.bulletActiveClass.split(" ")),e.isElement&&w.forEach((y,S)=>{y.setAttribute("part",S===p?"bullet-active":"bullet")}),i.dynamicBullets){const y=w[A],S=w[v];for(let M=A;M<=v;M+=1)w[M]&&w[M].classList.add(...`${i.bulletActiveClass}-main`.split(" "));k(y,"prev"),k(S,"next")}}if(i.dynamicBullets){const C=Math.min(w.length,i.dynamicMainBullets+4),y=(g*C-g)/2-D*g,S=t?"right":"left";w.forEach(M=>{M.style[e.isHorizontal()?S:"top"]=`${y}px`})}}l.forEach((w,A)=>{if(i.type==="fraction"&&(w.querySelectorAll(P(i.currentClass)).forEach(v=>{v.textContent=i.formatFractionCurrent(p+1)}),w.querySelectorAll(P(i.totalClass)).forEach(v=>{v.textContent=i.formatFractionTotal(B)})),i.type==="progressbar"){let v;i.progressbarOpposite?v=e.isHorizontal()?"vertical":"horizontal":v=e.isHorizontal()?"horizontal":"vertical";const D=(p+1)/B;let C=1,y=1;v==="horizontal"?C=D:y=D,w.querySelectorAll(P(i.progressbarFillClass)).forEach(S=>{S.style.transform=`translate3d(0,0,0) scaleX(${C}) scaleY(${y})`,S.style.transitionDuration=`${e.params.speed}ms`})}i.type==="custom"&&i.renderCustom?(F(w,i.renderCustom(e,p+1,B)),A===0&&o("paginationRender",w)):(A===0&&o("paginationRender",w),o("paginationUpdate",w)),e.params.watchOverflow&&e.enabled&&w.classList[e.isLocked?"add":"remove"](i.lockClass)})}function x(){const t=e.params.pagination;if(m())return;const i=e.virtual&&e.params.virtual.enabled?e.virtual.slides.length:e.grid&&e.params.grid.rows>1?e.slides.length/Math.ceil(e.params.grid.rows):e.slides.length;let l=e.pagination.el;l=L(l);let p="";if(t.type==="bullets"){let E=e.params.loop?Math.ceil(i/e.params.slidesPerGroup):e.snapGrid.length;e.params.freeMode&&e.params.freeMode.enabled&&E>i&&(E=i);for(let T=0;T<E;T+=1)t.renderBullet?p+=t.renderBullet.call(e,T,t.bulletClass):p+=`<${t.bulletElement} ${e.isElement?'part="bullet"':""} class="${t.bulletClass}"></${t.bulletElement}>`}t.type==="fraction"&&(t.renderFraction?p=t.renderFraction.call(e,t.currentClass,t.totalClass):p=`<span class="${t.currentClass}"></span> / <span class="${t.totalClass}"></span>`),t.type==="progressbar"&&(t.renderProgressbar?p=t.renderProgressbar.call(e,t.progressbarFillClass):p=`<span class="${t.progressbarFillClass}"></span>`),e.pagination.bullets=[],l.forEach(E=>{t.type!=="custom"&&F(E,p||""),t.type==="bullets"&&e.pagination.bullets.push(...E.querySelectorAll(P(t.bulletClass)))}),t.type!=="custom"&&o("paginationRender",l[0])}function d(){e.params.pagination=U(e,e.originalParams.pagination,e.params.pagination,{el:"swiper-pagination"});const t=e.params.pagination;if(!t.el)return;let i;typeof t.el=="string"&&e.isElement&&(i=e.el.querySelector(t.el)),!i&&typeof t.el=="string"&&(i=[...document.querySelectorAll(t.el)]),i||(i=t.el),!(!i||i.length===0)&&(e.params.uniqueNavElements&&typeof t.el=="string"&&Array.isArray(i)&&i.length>1&&(i=[...e.el.querySelectorAll(t.el)],i.length>1&&(i=i.find(l=>N(l,".swiper")[0]===e.el))),Array.isArray(i)&&i.length===1&&(i=i[0]),Object.assign(e.pagination,{el:i}),i=L(i),i.forEach(l=>{t.type==="bullets"&&t.clickable&&l.classList.add(...(t.clickableClass||"").split(" ")),l.classList.add(t.modifierClass+t.type),l.classList.add(e.isHorizontal()?t.horizontalClass:t.verticalClass),t.type==="bullets"&&t.dynamicBullets&&(l.classList.add(`${t.modifierClass}${t.type}-dynamic`),b=0,t.dynamicMainBullets<1&&(t.dynamicMainBullets=1)),t.type==="progressbar"&&t.progressbarOpposite&&l.classList.add(t.progressbarOppositeClass),t.clickable&&l.addEventListener("click",$),e.enabled||l.classList.add(t.lockClass)}))}function c(){const t=e.params.pagination;if(m())return;let i=e.pagination.el;i&&(i=L(i),i.forEach(l=>{l.classList.remove(t.hiddenClass),l.classList.remove(t.modifierClass+t.type),l.classList.remove(e.isHorizontal()?t.horizontalClass:t.verticalClass),t.clickable&&(l.classList.remove(...(t.clickableClass||"").split(" ")),l.removeEventListener("click",$))})),e.pagination.bullets&&e.pagination.bullets.forEach(l=>l.classList.remove(...t.bulletActiveClass.split(" ")))}n("changeDirection",()=>{if(!e.pagination||!e.pagination.el)return;const t=e.params.pagination;let{el:i}=e.pagination;i=L(i),i.forEach(l=>{l.classList.remove(t.horizontalClass,t.verticalClass),l.classList.add(e.isHorizontal()?t.horizontalClass:t.verticalClass)})}),n("init",()=>{e.params.pagination.enabled===!1?f():(d(),x(),h())}),n("activeIndexChange",()=>{typeof e.snapIndex>"u"&&h()}),n("snapIndexChange",()=>{h()}),n("snapGridLengthChange",()=>{x(),h()}),n("destroy",()=>{c()}),n("enable disable",()=>{let{el:t}=e.pagination;t&&(t=L(t),t.forEach(i=>i.classList[e.enabled?"remove":"add"](e.params.pagination.lockClass)))}),n("lock unlock",()=>{h()}),n("click",(t,i)=>{const l=i.target,p=L(e.pagination.el);if(e.params.pagination.el&&e.params.pagination.hideOnClick&&p&&p.length>0&&!l.classList.contains(e.params.pagination.bulletClass)){if(e.navigation&&(e.navigation.nextEl&&l===e.navigation.nextEl||e.navigation.prevEl&&l===e.navigation.prevEl))return;const E=p[0].classList.contains(e.params.pagination.hiddenClass);o(E===!0?"paginationShow":"paginationHide"),p.forEach(T=>T.classList.toggle(e.params.pagination.hiddenClass))}});const u=()=>{e.el.classList.remove(e.params.pagination.paginationDisabledClass);let{el:t}=e.pagination;t&&(t=L(t),t.forEach(i=>i.classList.remove(e.params.pagination.paginationDisabledClass))),d(),x(),h()},f=()=>{e.el.classList.add(e.params.pagination.paginationDisabledClass);let{el:t}=e.pagination;t&&(t=L(t),t.forEach(i=>i.classList.add(e.params.pagination.paginationDisabledClass))),c()};Object.assign(e.pagination,{enable:u,disable:f,render:x,update:h,init:d,destroy:c})}V.Swiper.use([_,K,G]);class X{constructor(){this.name="swiper",this.eventHandlers=new Map}async initialize(e,a){try{if(this.createSwiperStructure(e),!this.swiperContainer||!this.swiperWrapper)throw new Error("Swiper container not created");const n={direction:"horizontal",loop:!1,speed:300,spaceBetween:30,slidesPerView:1,modules:[_,K,G],navigation:{nextEl:".swiper-button-next",prevEl:".swiper-button-prev"},pagination:{el:".swiper-pagination",clickable:!0},keyboard:{enabled:!0,onlyInViewport:!0},...a==null?void 0:a.swiperConfig};this.swiper=new V.Swiper(this.swiperContainer,n),await new Promise(o=>{requestAnimationFrame(()=>{o()})}),this.setupEventListeners(),this.emit("ready")}catch(n){const o=n instanceof Error?n.message:String(n);throw this.emit("error",{message:o}),new Error(`Failed to initialize SwiperAdapter: ${o}`)}}async render(e){if(!this.swiperWrapper||!this.swiper)throw new Error("SwiperAdapter not initialized");try{this.swiperWrapper.innerHTML="";for(const a of e){const n=await this.renderSlide(a);this.swiperWrapper.appendChild(n)}this.swiper.update(),this.emit("slideRendered",{totalSlides:e.length})}catch(a){const n=a instanceof Error?a.message:String(a);throw this.emit("error",{message:n}),new Error(`Failed to render slides: ${n}`)}}async destroy(){this.swiper&&(this.swiper.destroy(!0,!0),this.swiper=void 0),this.swiperContainer&&(this.swiperContainer.innerHTML="",this.swiperContainer=void 0),this.swiperWrapper=void 0,this.eventHandlers.clear()}navigateTo(e){if(!this.swiper)throw new Error("SwiperAdapter not initialized");this.swiper.slideTo(e)}getCurrentIndex(){return this.swiper?this.swiper.activeIndex:0}getTotalSlides(){return this.swiper?this.swiper.slides.length:0}async updateSlide(e,a){if(!this.swiperWrapper||!this.swiper)throw new Error("SwiperAdapter not initialized");try{const o=this.swiperWrapper.querySelectorAll(".swiper-slide")[e];if(!o)throw new Error(`Slide at index ${e} not found`);const r=await this.renderSlide(a);o.replaceWith(r),this.swiper.update()}catch(n){const o=n instanceof Error?n.message:String(n);throw this.emit("error",{message:o}),new Error(`Failed to update slide: ${o}`)}}on(e,a){this.eventHandlers.has(e)||this.eventHandlers.set(e,new Set),this.eventHandlers.get(e).add(a)}off(e,a){const n=this.eventHandlers.get(e);n&&n.delete(a)}createSwiperStructure(e){const a=document.createElement("div");a.className="swiper";const n=document.createElement("div");n.className="swiper-wrapper";const o=document.createElement("div");o.className="swiper-button-prev";const r=document.createElement("div");r.className="swiper-button-next";const g=document.createElement("div");g.className="swiper-pagination",a.appendChild(n),a.appendChild(o),a.appendChild(r),a.appendChild(g),e.appendChild(a),this.swiperContainer=a,this.swiperWrapper=n}setupEventListeners(){this.swiper&&this.swiper.on("slideChange",()=>{const e=this.swiper.activeIndex,a=this.swiper.previousIndex;this.emit("slideChanged",{index:e,previousIndex:a,from:a,to:e})})}async renderSlide(e){var n;const a=document.createElement("div");if(a.className="swiper-slide",(n=e.behavior)!=null&&n.transition){const o=this.mapTransition(e.behavior.transition.type);o&&a.classList.add(`slide-transition-${o}`)}if(e.content.type==="dynamic"){const o=await this.renderDynamicContent(e.content.component,e.content.props);a.appendChild(o)}else{const o=this.renderTextContent(e.content.lines);a.appendChild(o)}return a}async renderDynamicContent(e,a){const n=document.createElement(e);for(const[o,r]of Object.entries(a))typeof r=="string"||typeof r=="number"?n.setAttribute(o,String(r)):typeof r=="boolean"?r&&n.setAttribute(o,""):n[o]=r;return n}renderTextContent(e){const a=document.createElement("div");a.className="slide-content";let n=null;for(const o of e){const r=o.trim();if(!r){n=null;continue}if(r.startsWith("# ")){n=null;const m=document.createElement("h1");m.textContent=r.substring(2),a.appendChild(m);continue}if(r.startsWith("## ")){n=null;const m=document.createElement("h2");m.textContent=r.substring(3),a.appendChild(m);continue}if(r.startsWith("### ")){n=null;const m=document.createElement("h3");m.textContent=r.substring(4),a.appendChild(m);continue}const g=r.match(/^!\[(.*?)\]\((.*?)\)$/);if(g){n=null;const m=document.createElement("img");m.alt=g[1],m.src=g[2],m.style.maxWidth="80%",m.style.maxHeight="500px",a.appendChild(m);continue}if(r.startsWith("- ")){n||(n=document.createElement("ul"),a.appendChild(n));const m=document.createElement("li");m.textContent=r.substring(2),n.appendChild(m);continue}n=null;const b=document.createElement("p");b.textContent=r,a.appendChild(b)}return a}mapTransition(e){return!e||e==="none"?null:e}emit(e,a){const n=this.eventHandlers.get(e);if(n)for(const o of n)try{o(a)}catch(r){console.error(`Error in ${e} handler:`,r)}}}async function ie(s,e,a){const n=await z.parseSlideDSL(s),o=z.compile(n),r=new X,g=new Y.SlideRunner({container:a.container,adapter:r,adapterOptions:{swiperConfig:a.swiperOptions}});return await g.run(o,e),g}exports.SwiperAdapter=X;exports.createSlideRunner=ie;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $=require("swiper"),T=require("@slidejs/dsl"),K=require("@slidejs/runner");function I(s){return s!==null&&typeof s=="object"&&"constructor"in s&&s.constructor===Object}function G(s,e){s===void 0&&(s={}),e===void 0&&(e={});const n=["__proto__","constructor","prototype"];Object.keys(e).filter(i=>n.indexOf(i)<0).forEach(i=>{typeof s[i]>"u"?s[i]=e[i]:I(e[i])&&I(s[i])&&Object.keys(e[i]).length>0&&G(s[i],e[i])})}const q={body:{},addEventListener(){},removeEventListener(){},activeElement:{blur(){},nodeName:""},querySelector(){return null},querySelectorAll(){return[]},getElementById(){return null},createEvent(){return{initEvent(){}}},createElement(){return{children:[],childNodes:[],style:{},setAttribute(){},getElementsByTagName(){return[]}}},createElementNS(){return{}},importNode(){return null},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""}};function W(){const s=typeof document<"u"?document:{};return G(s,q),s}const J={document:q,navigator:{userAgent:""},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""},history:{replaceState(){},pushState(){},go(){},back(){}},CustomEvent:function(){return this},addEventListener(){},removeEventListener(){},getComputedStyle(){return{getPropertyValue(){return""}}},Image(){},Date(){},screen:{},setTimeout(){},clearTimeout(){},matchMedia(){return{}},requestAnimationFrame(s){return typeof setTimeout>"u"?(s(),null):setTimeout(s,0)},cancelAnimationFrame(s){typeof setTimeout>"u"||clearTimeout(s)}};function H(){const s=typeof window<"u"?window:{};return G(s,J),s}function X(s){return s===void 0&&(s=""),s.trim().split(" ").filter(e=>!!e.trim())}function _(s,e){e===void 0&&(e="");const n=H(),i=[...s.children];return n.HTMLSlotElement&&s instanceof HTMLSlotElement&&i.push(...s.assignedElements()),e?i.filter(l=>l.matches(e)):i}function ee(s,e){e===void 0&&(e=[]);const n=document.createElement(s);return n.classList.add(...Array.isArray(e)?e:X(e)),n}function te(s){const e=H(),n=W(),i=s.getBoundingClientRect(),l=n.body,a=s.clientTop||l.clientTop||0,m=s.clientLeft||l.clientLeft||0,A=s===e?e.scrollY:s.scrollTop,f=s===e?e.scrollX:s.scrollLeft;return{top:i.top+A-a,left:i.left+f-m}}function O(s){let e=s,n;if(e){for(n=0;(e=e.previousSibling)!==null;)e.nodeType===1&&(n+=1);return n}}function N(s,e){const n=[];let i=s.parentElement;for(;i;)e?i.matches(e)&&n.push(i):n.push(i),i=i.parentElement;return n}function ie(s,e,n){const i=H();return s[e==="width"?"offsetWidth":"offsetHeight"]+parseFloat(i.getComputedStyle(s,null).getPropertyValue(e==="width"?"margin-right":"margin-top"))+parseFloat(i.getComputedStyle(s,null).getPropertyValue(e==="width"?"margin-left":"margin-bottom"))}function x(s){return(Array.isArray(s)?s:[s]).filter(e=>!!e)}function F(s,e){e===void 0&&(e=""),typeof trustedTypes<"u"?s.innerHTML=trustedTypes.createPolicy("html",{createHTML:n=>n}).createHTML(e):s.innerHTML=e}function Q(s){let{swiper:e,extendParams:n,on:i,emit:l}=s;const a=W(),m=H();e.keyboard={enabled:!1},n({keyboard:{enabled:!1,onlyInViewport:!0,pageUpDown:!0}});function A(M){if(!e.enabled)return;const{rtlTranslate:v}=e;let w=M;w.originalEvent&&(w=w.originalEvent);const B=w.keyCode||w.charCode,d=e.params.keyboard.pageUpDown,p=d&&B===33,u=d&&B===34,g=B===37,t=B===39,r=B===38,o=B===40;if(!e.allowSlideNext&&(e.isHorizontal()&&t||e.isVertical()&&o||u)||!e.allowSlidePrev&&(e.isHorizontal()&&g||e.isVertical()&&r||p))return!1;if(!(w.shiftKey||w.altKey||w.ctrlKey||w.metaKey)&&!(a.activeElement&&(a.activeElement.isContentEditable||a.activeElement.nodeName&&(a.activeElement.nodeName.toLowerCase()==="input"||a.activeElement.nodeName.toLowerCase()==="textarea")))){if(e.params.keyboard.onlyInViewport&&(p||u||g||t||r||o)){let c=!1;if(N(e.el,`.${e.params.slideClass}, swiper-slide`).length>0&&N(e.el,`.${e.params.slideActiveClass}`).length===0)return;const E=e.el,z=E.clientWidth,Y=E.clientHeight,b=m.innerWidth,k=m.innerHeight,h=te(E);v&&(h.left-=E.scrollLeft);const D=[[h.left,h.top],[h.left+z,h.top],[h.left,h.top+Y],[h.left+z,h.top+Y]];for(let C=0;C<D.length;C+=1){const y=D[C];if(y[0]>=0&&y[0]<=b&&y[1]>=0&&y[1]<=k){if(y[0]===0&&y[1]===0)continue;c=!0}}if(!c)return}e.isHorizontal()?((p||u||g||t)&&(w.preventDefault?w.preventDefault():w.returnValue=!1),((u||t)&&!v||(p||g)&&v)&&e.slideNext(),((p||g)&&!v||(u||t)&&v)&&e.slidePrev()):((p||u||r||o)&&(w.preventDefault?w.preventDefault():w.returnValue=!1),(u||o)&&e.slideNext(),(p||r)&&e.slidePrev()),l("keyPress",B)}}function f(){e.keyboard.enabled||(a.addEventListener("keydown",A),e.keyboard.enabled=!0)}function S(){e.keyboard.enabled&&(a.removeEventListener("keydown",A),e.keyboard.enabled=!1)}i("init",()=>{e.params.keyboard.enabled&&f()}),i("destroy",()=>{e.keyboard.enabled&&S()}),Object.assign(e.keyboard,{enable:f,disable:S})}function R(s,e,n,i){return s.params.createElements&&Object.keys(i).forEach(l=>{if(!n[l]&&n.auto===!0){let a=_(s.el,`.${i[l]}`)[0];a||(a=ee("div",i[l]),a.className=i[l],s.el.append(a)),n[l]=a,e[l]=a}}),n}function Z(s){let{swiper:e,extendParams:n,on:i,emit:l}=s;n({navigation:{nextEl:null,prevEl:null,hideOnClick:!1,disabledClass:"swiper-button-disabled",hiddenClass:"swiper-button-hidden",lockClass:"swiper-button-lock",navigationDisabledClass:"swiper-navigation-disabled"}}),e.navigation={nextEl:null,prevEl:null};function a(d){let p;return d&&typeof d=="string"&&e.isElement&&(p=e.el.querySelector(d)||e.hostEl.querySelector(d),p)?p:(d&&(typeof d=="string"&&(p=[...document.querySelectorAll(d)]),e.params.uniqueNavElements&&typeof d=="string"&&p&&p.length>1&&e.el.querySelectorAll(d).length===1?p=e.el.querySelector(d):p&&p.length===1&&(p=p[0])),d&&!p?d:p)}function m(d,p){const u=e.params.navigation;d=x(d),d.forEach(g=>{g&&(g.classList[p?"add":"remove"](...u.disabledClass.split(" ")),g.tagName==="BUTTON"&&(g.disabled=p),e.params.watchOverflow&&e.enabled&&g.classList[e.isLocked?"add":"remove"](u.lockClass))})}function A(){const{nextEl:d,prevEl:p}=e.navigation;if(e.params.loop){m(p,!1),m(d,!1);return}m(p,e.isBeginning&&!e.params.rewind),m(d,e.isEnd&&!e.params.rewind)}function f(d){d.preventDefault(),!(e.isBeginning&&!e.params.loop&&!e.params.rewind)&&(e.slidePrev(),l("navigationPrev"))}function S(d){d.preventDefault(),!(e.isEnd&&!e.params.loop&&!e.params.rewind)&&(e.slideNext(),l("navigationNext"))}function M(){const d=e.params.navigation;if(e.params.navigation=R(e,e.originalParams.navigation,e.params.navigation,{nextEl:"swiper-button-next",prevEl:"swiper-button-prev"}),!(d.nextEl||d.prevEl))return;let p=a(d.nextEl),u=a(d.prevEl);Object.assign(e.navigation,{nextEl:p,prevEl:u}),p=x(p),u=x(u);const g=(t,r)=>{t&&t.addEventListener("click",r==="next"?S:f),!e.enabled&&t&&t.classList.add(...d.lockClass.split(" "))};p.forEach(t=>g(t,"next")),u.forEach(t=>g(t,"prev"))}function v(){let{nextEl:d,prevEl:p}=e.navigation;d=x(d),p=x(p);const u=(g,t)=>{g.removeEventListener("click",t==="next"?S:f),g.classList.remove(...e.params.navigation.disabledClass.split(" "))};d.forEach(g=>u(g,"next")),p.forEach(g=>u(g,"prev"))}i("init",()=>{e.params.navigation.enabled===!1?B():(M(),A())}),i("toEdge fromEdge lock unlock",()=>{A()}),i("destroy",()=>{v()}),i("enable disable",()=>{let{nextEl:d,prevEl:p}=e.navigation;if(d=x(d),p=x(p),e.enabled){A();return}[...d,...p].filter(u=>!!u).forEach(u=>u.classList.add(e.params.navigation.lockClass))}),i("click",(d,p)=>{let{nextEl:u,prevEl:g}=e.navigation;u=x(u),g=x(g);const t=p.target;let r=g.includes(t)||u.includes(t);if(e.isElement&&!r){const o=p.path||p.composedPath&&p.composedPath();o&&(r=o.find(c=>u.includes(c)||g.includes(c)))}if(e.params.navigation.hideOnClick&&!r){if(e.pagination&&e.params.pagination&&e.params.pagination.clickable&&(e.pagination.el===t||e.pagination.el.contains(t)))return;let o;u.length?o=u[0].classList.contains(e.params.navigation.hiddenClass):g.length&&(o=g[0].classList.contains(e.params.navigation.hiddenClass)),l(o===!0?"navigationShow":"navigationHide"),[...u,...g].filter(c=>!!c).forEach(c=>c.classList.toggle(e.params.navigation.hiddenClass))}});const w=()=>{e.el.classList.remove(...e.params.navigation.navigationDisabledClass.split(" ")),M(),A()},B=()=>{e.el.classList.add(...e.params.navigation.navigationDisabledClass.split(" ")),v()};Object.assign(e.navigation,{enable:w,disable:B,update:A,init:M,destroy:v})}function j(s){return s===void 0&&(s=""),`.${s.trim().replace(/([\.:!+\/()[\]])/g,"\\$1").replace(/ /g,".")}`}function U(s){let{swiper:e,extendParams:n,on:i,emit:l}=s;const a="swiper-pagination";n({pagination:{el:null,bulletElement:"span",clickable:!1,hideOnClick:!1,renderBullet:null,renderProgressbar:null,renderFraction:null,renderCustom:null,progressbarOpposite:!1,type:"bullets",dynamicBullets:!1,dynamicMainBullets:1,formatFractionCurrent:t=>t,formatFractionTotal:t=>t,bulletClass:`${a}-bullet`,bulletActiveClass:`${a}-bullet-active`,modifierClass:`${a}-`,currentClass:`${a}-current`,totalClass:`${a}-total`,hiddenClass:`${a}-hidden`,progressbarFillClass:`${a}-progressbar-fill`,progressbarOppositeClass:`${a}-progressbar-opposite`,clickableClass:`${a}-clickable`,lockClass:`${a}-lock`,horizontalClass:`${a}-horizontal`,verticalClass:`${a}-vertical`,paginationDisabledClass:`${a}-disabled`}}),e.pagination={el:null,bullets:[]};let m,A=0;function f(){return!e.params.pagination.el||!e.pagination.el||Array.isArray(e.pagination.el)&&e.pagination.el.length===0}function S(t,r){const{bulletActiveClass:o}=e.params.pagination;t&&(t=t[`${r==="prev"?"previous":"next"}ElementSibling`],t&&(t.classList.add(`${o}-${r}`),t=t[`${r==="prev"?"previous":"next"}ElementSibling`],t&&t.classList.add(`${o}-${r}-${r}`)))}function M(t,r,o){if(t=t%o,r=r%o,r===t+1)return"next";if(r===t-1)return"previous"}function v(t){const r=t.target.closest(j(e.params.pagination.bulletClass));if(!r)return;t.preventDefault();const o=O(r)*e.params.slidesPerGroup;if(e.params.loop){if(e.realIndex===o)return;const c=M(e.realIndex,o,e.slides.length);c==="next"?e.slideNext():c==="previous"?e.slidePrev():e.slideToLoop(o)}else e.slideTo(o)}function w(){const t=e.rtl,r=e.params.pagination;if(f())return;let o=e.pagination.el;o=x(o);let c,E;const z=e.virtual&&e.params.virtual.enabled?e.virtual.slides.length:e.slides.length,Y=e.params.loop?Math.ceil(z/e.params.slidesPerGroup):e.snapGrid.length;if(e.params.loop?(E=e.previousRealIndex||0,c=e.params.slidesPerGroup>1?Math.floor(e.realIndex/e.params.slidesPerGroup):e.realIndex):typeof e.snapIndex<"u"?(c=e.snapIndex,E=e.previousSnapIndex):(E=e.previousIndex||0,c=e.activeIndex||0),r.type==="bullets"&&e.pagination.bullets&&e.pagination.bullets.length>0){const b=e.pagination.bullets;let k,h,D;if(r.dynamicBullets&&(m=ie(b[0],e.isHorizontal()?"width":"height"),o.forEach(C=>{C.style[e.isHorizontal()?"width":"height"]=`${m*(r.dynamicMainBullets+4)}px`}),r.dynamicMainBullets>1&&E!==void 0&&(A+=c-(E||0),A>r.dynamicMainBullets-1?A=r.dynamicMainBullets-1:A<0&&(A=0)),k=Math.max(c-A,0),h=k+(Math.min(b.length,r.dynamicMainBullets)-1),D=(h+k)/2),b.forEach(C=>{const y=[...["","-next","-next-next","-prev","-prev-prev","-main"].map(L=>`${r.bulletActiveClass}${L}`)].map(L=>typeof L=="string"&&L.includes(" ")?L.split(" "):L).flat();C.classList.remove(...y)}),o.length>1)b.forEach(C=>{const y=O(C);y===c?C.classList.add(...r.bulletActiveClass.split(" ")):e.isElement&&C.setAttribute("part","bullet"),r.dynamicBullets&&(y>=k&&y<=h&&C.classList.add(...`${r.bulletActiveClass}-main`.split(" ")),y===k&&S(C,"prev"),y===h&&S(C,"next"))});else{const C=b[c];if(C&&C.classList.add(...r.bulletActiveClass.split(" ")),e.isElement&&b.forEach((y,L)=>{y.setAttribute("part",L===c?"bullet-active":"bullet")}),r.dynamicBullets){const y=b[k],L=b[h];for(let P=k;P<=h;P+=1)b[P]&&b[P].classList.add(...`${r.bulletActiveClass}-main`.split(" "));S(y,"prev"),S(L,"next")}}if(r.dynamicBullets){const C=Math.min(b.length,r.dynamicMainBullets+4),y=(m*C-m)/2-D*m,L=t?"right":"left";b.forEach(P=>{P.style[e.isHorizontal()?L:"top"]=`${y}px`})}}o.forEach((b,k)=>{if(r.type==="fraction"&&(b.querySelectorAll(j(r.currentClass)).forEach(h=>{h.textContent=r.formatFractionCurrent(c+1)}),b.querySelectorAll(j(r.totalClass)).forEach(h=>{h.textContent=r.formatFractionTotal(Y)})),r.type==="progressbar"){let h;r.progressbarOpposite?h=e.isHorizontal()?"vertical":"horizontal":h=e.isHorizontal()?"horizontal":"vertical";const D=(c+1)/Y;let C=1,y=1;h==="horizontal"?C=D:y=D,b.querySelectorAll(j(r.progressbarFillClass)).forEach(L=>{L.style.transform=`translate3d(0,0,0) scaleX(${C}) scaleY(${y})`,L.style.transitionDuration=`${e.params.speed}ms`})}r.type==="custom"&&r.renderCustom?(F(b,r.renderCustom(e,c+1,Y)),k===0&&l("paginationRender",b)):(k===0&&l("paginationRender",b),l("paginationUpdate",b)),e.params.watchOverflow&&e.enabled&&b.classList[e.isLocked?"add":"remove"](r.lockClass)})}function B(){const t=e.params.pagination;if(f())return;const r=e.virtual&&e.params.virtual.enabled?e.virtual.slides.length:e.grid&&e.params.grid.rows>1?e.slides.length/Math.ceil(e.params.grid.rows):e.slides.length;let o=e.pagination.el;o=x(o);let c="";if(t.type==="bullets"){let E=e.params.loop?Math.ceil(r/e.params.slidesPerGroup):e.snapGrid.length;e.params.freeMode&&e.params.freeMode.enabled&&E>r&&(E=r);for(let z=0;z<E;z+=1)t.renderBullet?c+=t.renderBullet.call(e,z,t.bulletClass):c+=`<${t.bulletElement} ${e.isElement?'part="bullet"':""} class="${t.bulletClass}"></${t.bulletElement}>`}t.type==="fraction"&&(t.renderFraction?c=t.renderFraction.call(e,t.currentClass,t.totalClass):c=`<span class="${t.currentClass}"></span> / <span class="${t.totalClass}"></span>`),t.type==="progressbar"&&(t.renderProgressbar?c=t.renderProgressbar.call(e,t.progressbarFillClass):c=`<span class="${t.progressbarFillClass}"></span>`),e.pagination.bullets=[],o.forEach(E=>{t.type!=="custom"&&F(E,c||""),t.type==="bullets"&&e.pagination.bullets.push(...E.querySelectorAll(j(t.bulletClass)))}),t.type!=="custom"&&l("paginationRender",o[0])}function d(){e.params.pagination=R(e,e.originalParams.pagination,e.params.pagination,{el:"swiper-pagination"});const t=e.params.pagination;if(!t.el)return;let r;typeof t.el=="string"&&e.isElement&&(r=e.el.querySelector(t.el)),!r&&typeof t.el=="string"&&(r=[...document.querySelectorAll(t.el)]),r||(r=t.el),!(!r||r.length===0)&&(e.params.uniqueNavElements&&typeof t.el=="string"&&Array.isArray(r)&&r.length>1&&(r=[...e.el.querySelectorAll(t.el)],r.length>1&&(r=r.find(o=>N(o,".swiper")[0]===e.el))),Array.isArray(r)&&r.length===1&&(r=r[0]),Object.assign(e.pagination,{el:r}),r=x(r),r.forEach(o=>{t.type==="bullets"&&t.clickable&&o.classList.add(...(t.clickableClass||"").split(" ")),o.classList.add(t.modifierClass+t.type),o.classList.add(e.isHorizontal()?t.horizontalClass:t.verticalClass),t.type==="bullets"&&t.dynamicBullets&&(o.classList.add(`${t.modifierClass}${t.type}-dynamic`),A=0,t.dynamicMainBullets<1&&(t.dynamicMainBullets=1)),t.type==="progressbar"&&t.progressbarOpposite&&o.classList.add(t.progressbarOppositeClass),t.clickable&&o.addEventListener("click",v),e.enabled||o.classList.add(t.lockClass)}))}function p(){const t=e.params.pagination;if(f())return;let r=e.pagination.el;r&&(r=x(r),r.forEach(o=>{o.classList.remove(t.hiddenClass),o.classList.remove(t.modifierClass+t.type),o.classList.remove(e.isHorizontal()?t.horizontalClass:t.verticalClass),t.clickable&&(o.classList.remove(...(t.clickableClass||"").split(" ")),o.removeEventListener("click",v))})),e.pagination.bullets&&e.pagination.bullets.forEach(o=>o.classList.remove(...t.bulletActiveClass.split(" ")))}i("changeDirection",()=>{if(!e.pagination||!e.pagination.el)return;const t=e.params.pagination;let{el:r}=e.pagination;r=x(r),r.forEach(o=>{o.classList.remove(t.horizontalClass,t.verticalClass),o.classList.add(e.isHorizontal()?t.horizontalClass:t.verticalClass)})}),i("init",()=>{e.params.pagination.enabled===!1?g():(d(),B(),w())}),i("activeIndexChange",()=>{typeof e.snapIndex>"u"&&w()}),i("snapIndexChange",()=>{w()}),i("snapGridLengthChange",()=>{B(),w()}),i("destroy",()=>{p()}),i("enable disable",()=>{let{el:t}=e.pagination;t&&(t=x(t),t.forEach(r=>r.classList[e.enabled?"remove":"add"](e.params.pagination.lockClass)))}),i("lock unlock",()=>{w()}),i("click",(t,r)=>{const o=r.target,c=x(e.pagination.el);if(e.params.pagination.el&&e.params.pagination.hideOnClick&&c&&c.length>0&&!o.classList.contains(e.params.pagination.bulletClass)){if(e.navigation&&(e.navigation.nextEl&&o===e.navigation.nextEl||e.navigation.prevEl&&o===e.navigation.prevEl))return;const E=c[0].classList.contains(e.params.pagination.hiddenClass);l(E===!0?"paginationShow":"paginationHide"),c.forEach(z=>z.classList.toggle(e.params.pagination.hiddenClass))}});const u=()=>{e.el.classList.remove(e.params.pagination.paginationDisabledClass);let{el:t}=e.pagination;t&&(t=x(t),t.forEach(r=>r.classList.remove(e.params.pagination.paginationDisabledClass))),d(),B(),w()},g=()=>{e.el.classList.add(e.params.pagination.paginationDisabledClass);let{el:t}=e.pagination;t&&(t=x(t),t.forEach(r=>r.classList.add(e.params.pagination.paginationDisabledClass))),p()};Object.assign(e.pagination,{enable:u,disable:g,render:B,update:w,init:d,destroy:p})}$.Swiper.use([Z,U,Q]);class V{constructor(){this.name="swiper",this.eventHandlers=new Map}async initialize(e,n){try{if(this.createSwiperStructure(e),!this.swiperContainer||!this.swiperWrapper)throw new Error("Swiper container not created");const i={direction:"horizontal",loop:!1,speed:300,spaceBetween:30,slidesPerView:1,modules:[Z,U,Q],navigation:{nextEl:".swiper-button-next",prevEl:".swiper-button-prev"},pagination:{el:".swiper-pagination",clickable:!0},keyboard:{enabled:!0,onlyInViewport:!0},...n?.swiperConfig};this.swiper=new $.Swiper(this.swiperContainer,i),await new Promise(l=>{requestAnimationFrame(()=>{l()})}),this.setupEventListeners(),this.emit("ready")}catch(i){const l=i instanceof Error?i.message:String(i);throw this.emit("error",{message:l}),new Error(`Failed to initialize SwiperAdapter: ${l}`)}}async render(e){if(!this.swiperWrapper||!this.swiper)throw new Error("SwiperAdapter not initialized");try{this.swiperWrapper.innerHTML="";for(const n of e){const i=await this.renderSlide(n);this.swiperWrapper.appendChild(i)}this.swiper.update(),this.emit("slideRendered",{totalSlides:e.length})}catch(n){const i=n instanceof Error?n.message:String(n);throw this.emit("error",{message:i}),new Error(`Failed to render slides: ${i}`)}}async destroy(){this.swiper&&(this.swiper.destroy(!0,!0),this.swiper=void 0),this.swiperContainer&&(this.swiperContainer.innerHTML="",this.swiperContainer=void 0),this.swiperWrapper=void 0,this.eventHandlers.clear()}navigateTo(e){if(!this.swiper)throw new Error("SwiperAdapter not initialized");this.swiper.slideTo(e)}getCurrentIndex(){return this.swiper?this.swiper.activeIndex:0}getTotalSlides(){return this.swiper?this.swiper.slides.length:0}async updateSlide(e,n){if(!this.swiperWrapper||!this.swiper)throw new Error("SwiperAdapter not initialized");try{const l=this.swiperWrapper.querySelectorAll(".swiper-slide")[e];if(!l)throw new Error(`Slide at index ${e} not found`);const a=await this.renderSlide(n);l.replaceWith(a),this.swiper.update()}catch(i){const l=i instanceof Error?i.message:String(i);throw this.emit("error",{message:l}),new Error(`Failed to update slide: ${l}`)}}on(e,n){this.eventHandlers.has(e)||this.eventHandlers.set(e,new Set),this.eventHandlers.get(e).add(n)}off(e,n){const i=this.eventHandlers.get(e);i&&i.delete(n)}createSwiperStructure(e){e.className="swiper";const n=document.createElement("div");n.className="swiper-wrapper";const i=document.createElement("div");i.className="swiper-button-prev";const l=document.createElement("div");l.className="swiper-button-next";const a=document.createElement("div");a.className="swiper-pagination",e.appendChild(n),e.appendChild(i),e.appendChild(l),e.appendChild(a),this.swiperContainer=e,this.swiperWrapper=n}setupEventListeners(){this.swiper&&this.swiper.on("slideChange",()=>{const e=this.swiper.activeIndex,n=this.swiper.previousIndex;this.emit("slideChanged",{index:e,previousIndex:n,from:n,to:e})})}async renderSlide(e){const n=document.createElement("div");if(n.className="swiper-slide",e.behavior?.transition){const i=this.mapTransition(e.behavior.transition.type);i&&n.classList.add(`slide-transition-${i}`)}if(e.content.type==="dynamic"){const i=await this.renderDynamicContent(e.content.component,e.content.props);n.appendChild(i)}else{const i=this.renderTextContent(e.content.lines);n.appendChild(i)}return n}async renderDynamicContent(e,n){const i=document.createElement(e);for(const[l,a]of Object.entries(n))typeof a=="string"||typeof a=="number"?i.setAttribute(l,String(a)):typeof a=="boolean"?a&&i.setAttribute(l,""):i[l]=a;return i}renderTextContent(e){const n=document.createElement("div");n.className="slide-content";let i=null;for(const l of e){const a=l.trim();if(!a){i=null;continue}if(a.startsWith("# ")){i=null;const f=document.createElement("h1");f.textContent=a.substring(2),n.appendChild(f);continue}if(a.startsWith("## ")){i=null;const f=document.createElement("h2");f.textContent=a.substring(3),n.appendChild(f);continue}if(a.startsWith("### ")){i=null;const f=document.createElement("h3");f.textContent=a.substring(4),n.appendChild(f);continue}const m=a.match(/^!\[(.*?)\]\((.*?)\)$/);if(m){i=null;const f=document.createElement("img");f.alt=m[1],f.src=m[2],f.style.maxWidth="80%",f.style.maxHeight="500px",n.appendChild(f);continue}if(a.startsWith("- ")){i||(i=document.createElement("ul"),n.appendChild(i));const f=document.createElement("li");f.textContent=a.substring(2),i.appendChild(f);continue}i=null;const A=document.createElement("p");A.textContent=a,n.appendChild(A)}return n}mapTransition(e){return!e||e==="none"?null:e}emit(e,n){const i=this.eventHandlers.get(e);if(i)for(const l of i)try{l(n)}catch(a){console.error(`Error in ${e} handler:`,a)}}}const re='@font-face{font-family:swiper-icons;src:url(data:application/font-woff;charset=utf-8;base64,\\ d09GRgABAAAAAAZgABAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAGRAAAABoAAAAci6qHkUdERUYAAAWgAAAAIwAAACQAYABXR1BPUwAABhQAAAAuAAAANuAY7+xHU1VCAAAFxAAAAFAAAABm2fPczU9TLzIAAAHcAAAASgAAAGBP9V5RY21hcAAAAkQAAACIAAABYt6F0cBjdnQgAAACzAAAAAQAAAAEABEBRGdhc3AAAAWYAAAACAAAAAj//wADZ2x5ZgAAAywAAADMAAAD2MHtryVoZWFkAAABbAAAADAAAAA2E2+eoWhoZWEAAAGcAAAAHwAAACQC9gDzaG10eAAAAigAAAAZAAAArgJkABFsb2NhAAAC0AAAAFoAAABaFQAUGG1heHAAAAG8AAAAHwAAACAAcABAbmFtZQAAA/gAAAE5AAACXvFdBwlwb3N0AAAFNAAAAGIAAACE5s74hXjaY2BkYGAAYpf5Hu/j+W2+MnAzMYDAzaX6QjD6/4//Bxj5GA8AuRwMYGkAPywL13jaY2BkYGA88P8Agx4j+/8fQDYfA1AEBWgDAIB2BOoAeNpjYGRgYNBh4GdgYgABEMnIABJzYNADCQAACWgAsQB42mNgYfzCOIGBlYGB0YcxjYGBwR1Kf2WQZGhhYGBiYGVmgAFGBiQQkOaawtDAoMBQxXjg/wEGPcYDDA4wNUA2CCgwsAAAO4EL6gAAeNpj2M0gyAACqxgGNWBkZ2D4/wMA+xkDdgAAAHjaY2BgYGaAYBkGRgYQiAHyGMF8FgYHIM3DwMHABGQrMOgyWDLEM1T9/w8UBfEMgLzE////P/5//f/V/xv+r4eaAAeMbAxwIUYmIMHEgKYAYjUcsDAwsLKxc3BycfPw8jEQA/gZBASFhEVExcQlJKWkZWTl5BUUlZRVVNXUNTQZBgMAAMR+E+gAEQFEAAAAKgAqACoANAA+AEgAUgBcAGYAcAB6AIQAjgCYAKIArAC2AMAAygDUAN4A6ADyAPwBBgEQARoBJAEuATgBQgFMAVYBYAFqAXQBfgGIAZIBnAGmAbIBzgHsAAB42u2NMQ6CUAyGW568x9AneYYgm4MJbhKFaExIOAVX8ApewSt4Bic4AfeAid3VOBixDxfPYEza5O+Xfi04YADggiUIULCuEJK8VhO4bSvpdnktHI5QCYtdi2sl8ZnXaHlqUrNKzdKcT8cjlq+rwZSvIVczNiezsfnP/uznmfPFBNODM2K7MTQ45YEAZqGP81AmGGcF3iPqOop0r1SPTaTbVkfUe4HXj97wYE+yNwWYxwWu4v1ugWHgo3S1XdZEVqWM7ET0cfnLGxWfkgR42o2PvWrDMBSFj/IHLaF0zKjRgdiVMwScNRAoWUoH78Y2icB/yIY09An6AH2Bdu/UB+yxopYshQiEvnvu0dURgDt8QeC8PDw7Fpji3fEA4z/PEJ6YOB5hKh4dj3EvXhxPqH/SKUY3rJ7srZ4FZnh1PMAtPhwP6fl2PMJMPDgeQ4rY8YT6Gzao0eAEA409DuggmTnFnOcSCiEiLMgxCiTI6Cq5DZUd3Qmp10vO0LaLTd2cjN4fOumlc7lUYbSQcZFkutRG7g6JKZKy0RmdLY680CDnEJ+UMkpFFe1RN7nxdVpXrC4aTtnaurOnYercZg2YVmLN/d/gczfEimrE/fs/bOuq29Zmn8tloORaXgZgGa78yO9/cnXm2BpaGvq25Dv9S4E9+5SIc9PqupJKhYFSSl47+Qcr1mYNAAAAeNptw0cKwkAAAMDZJA8Q7OUJvkLsPfZ6zFVERPy8qHh2YER+3i/BP83vIBLLySsoKimrqKqpa2hp6+jq6RsYGhmbmJqZSy0sraxtbO3sHRydnEMU4uR6yx7JJXveP7WrDycAAAAAAAH//wACeNpjYGRgYOABYhkgZgJCZgZNBkYGLQZtIJsFLMYAAAw3ALgAeNolizEKgDAQBCchRbC2sFER0YD6qVQiBCv/H9ezGI6Z5XBAw8CBK/m5iQQVauVbXLnOrMZv2oLdKFa8Pjuru2hJzGabmOSLzNMzvutpB3N42mNgZGBg4GKQYzBhYMxJLMlj4GBgAYow/P/PAJJhLM6sSoWKfWCAAwDAjgbRAAB42mNgYGBkAIIbCZo5IPrmUn0hGA0AO8EFTQAA);font-weight:400;font-style:normal}:root{--swiper-theme-color: #007aff}:host{position:relative;display:block;margin-left:auto;margin-right:auto;z-index:1}.swiper{margin-left:auto;margin-right:auto;position:relative;overflow:hidden;list-style:none;padding:0;z-index:1;display:block}.swiper-vertical>.swiper-wrapper{flex-direction:column}.swiper-wrapper{position:relative;width:100%;height:100%;z-index:1;display:flex;transition-property:transform;transition-timing-function:var(--swiper-wrapper-transition-timing-function, initial);box-sizing:content-box}.swiper-android .swiper-slide,.swiper-ios .swiper-slide,.swiper-wrapper{transform:translateZ(0)}.swiper-horizontal{touch-action:pan-y}.swiper-vertical{touch-action:pan-x}.swiper-slide{flex-shrink:0;width:100%;height:100%;position:relative;transition-property:transform;display:block}.swiper-slide-invisible-blank{visibility:hidden}.swiper-autoheight,.swiper-autoheight .swiper-slide{height:auto}.swiper-autoheight .swiper-wrapper{align-items:flex-start;transition-property:transform,height}.swiper-backface-hidden .swiper-slide{transform:translateZ(0);-webkit-backface-visibility:hidden;backface-visibility:hidden}.swiper-3d.swiper-css-mode .swiper-wrapper{perspective:1200px}.swiper-3d .swiper-wrapper{transform-style:preserve-3d}.swiper-3d{perspective:1200px}.swiper-3d .swiper-slide,.swiper-3d .swiper-cube-shadow{transform-style:preserve-3d}.swiper-css-mode>.swiper-wrapper{overflow:auto;scrollbar-width:none;-ms-overflow-style:none}.swiper-css-mode>.swiper-wrapper::-webkit-scrollbar{display:none}.swiper-css-mode>.swiper-wrapper>.swiper-slide{scroll-snap-align:start start}.swiper-css-mode.swiper-horizontal>.swiper-wrapper{scroll-snap-type:x mandatory}.swiper-css-mode.swiper-vertical>.swiper-wrapper{scroll-snap-type:y mandatory}.swiper-css-mode.swiper-free-mode>.swiper-wrapper{scroll-snap-type:none}.swiper-css-mode.swiper-free-mode>.swiper-wrapper>.swiper-slide{scroll-snap-align:none}.swiper-css-mode.swiper-centered>.swiper-wrapper:before{content:"";flex-shrink:0;order:9999}.swiper-css-mode.swiper-centered>.swiper-wrapper>.swiper-slide{scroll-snap-align:center center;scroll-snap-stop:always}.swiper-css-mode.swiper-centered.swiper-horizontal>.swiper-wrapper>.swiper-slide:first-child{margin-inline-start:var(--swiper-centered-offset-before)}.swiper-css-mode.swiper-centered.swiper-horizontal>.swiper-wrapper:before{height:100%;min-height:1px;width:var(--swiper-centered-offset-after)}.swiper-css-mode.swiper-centered.swiper-vertical>.swiper-wrapper>.swiper-slide:first-child{margin-block-start:var(--swiper-centered-offset-before)}.swiper-css-mode.swiper-centered.swiper-vertical>.swiper-wrapper:before{width:100%;min-width:1px;height:var(--swiper-centered-offset-after)}.swiper-3d .swiper-slide-shadow,.swiper-3d .swiper-slide-shadow-left,.swiper-3d .swiper-slide-shadow-right,.swiper-3d .swiper-slide-shadow-top,.swiper-3d .swiper-slide-shadow-bottom{position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;z-index:10}.swiper-3d .swiper-slide-shadow{background:#00000026}.swiper-3d .swiper-slide-shadow-left{background-image:linear-gradient(to left,#00000080,#0000)}.swiper-3d .swiper-slide-shadow-right{background-image:linear-gradient(to right,#00000080,#0000)}.swiper-3d .swiper-slide-shadow-top{background-image:linear-gradient(to top,#00000080,#0000)}.swiper-3d .swiper-slide-shadow-bottom{background-image:linear-gradient(to bottom,#00000080,#0000)}.swiper-lazy-preloader{width:42px;height:42px;position:absolute;left:50%;top:50%;margin-left:-21px;margin-top:-21px;z-index:10;transform-origin:50%;box-sizing:border-box;border:4px solid var(--swiper-preloader-color, var(--swiper-theme-color));border-radius:50%;border-top-color:transparent}.swiper:not(.swiper-watch-progress) .swiper-lazy-preloader,.swiper-watch-progress .swiper-slide-visible .swiper-lazy-preloader{animation:swiper-preloader-spin 1s infinite linear}.swiper-lazy-preloader-white{--swiper-preloader-color: #fff}.swiper-lazy-preloader-black{--swiper-preloader-color: #000}@keyframes swiper-preloader-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}',ne=".swiper{width:100%;height:100%;--slidejs-swiper-navigation-color: var(--slidejs-navigation-color, #007aff);--slidejs-swiper-pagination-color: var(--slidejs-pagination-color, #007aff);--slidejs-swiper-pagination-bullet-active-color: var(--slidejs-pagination-active-color, #007aff);--slidejs-swiper-scrollbar-bg: var(--slidejs-scrollbar-bg, rgba(0, 0, 0, .1));--slidejs-swiper-scrollbar-drag-bg: var(--slidejs-scrollbar-drag-bg, rgba(0, 0, 0, .5));--swiper-navigation-color: var(--slidejs-navigation-color, #007aff);--swiper-pagination-color: var(--slidejs-pagination-color, #007aff);--swiper-pagination-bullet-active-color: var(--slidejs-pagination-active-color, #007aff);--swiper-theme-color: var(--slidejs-navigation-color, #007aff)}.swiper .swiper-button-next,.swiper .swiper-button-prev{color:var(--swiper-navigation-color, var(--slidejs-swiper-navigation-color, #007aff))!important}.swiper .swiper-pagination-bullet{background-color:var( --swiper-pagination-color, var(--slidejs-swiper-pagination-color, #007aff) )!important}.swiper .swiper-pagination-bullet-active{background-color:var( --swiper-pagination-bullet-active-color, var(--slidejs-swiper-pagination-bullet-active-color, #007aff) )!important}.swiper .swiper-scrollbar{background:var(--slidejs-swiper-scrollbar-bg, rgba(0, 0, 0, .1))!important}.swiper .swiper-scrollbar-drag{background:var(--slidejs-swiper-scrollbar-drag-bg, rgba(0, 0, 0, .5))!important}.swiper-slide{display:flex;align-items:center;justify-content:center;width:100%;height:100%;background:var(--slidejs-background-color, #fff);padding:2rem;box-sizing:border-box}.slide-content{width:100%;text-align:center}.slide-content h1{font-size:3rem;margin-bottom:1rem;color:var(--slidejs-heading-color, #333)}.slide-content h2{font-size:2rem;margin-bottom:1rem;color:var(--slidejs-heading-color, #666)}.slide-content h3{font-size:1.5rem;margin-bottom:.5rem;color:var(--slidejs-heading-color, #666)}.slide-content p{font-size:1.2rem;line-height:1.6;color:var(--slidejs-text-color, #555);margin-bottom:1rem}.slide-content ul{text-align:left;display:inline-block;font-size:1.2rem;line-height:1.8;color:var(--slidejs-text-color, #555)}.slide-content li{margin-bottom:.5rem}.slide-content img{border-radius:8px;box-shadow:0 4px 12px #0000001a}.swiper-button-next:after,.swiper-button-prev:after{font-size:24px}.swiper-pagination-bullet{opacity:.5}.swiper-pagination-bullet-active{opacity:1}";async function se(s,e,n){const i=await T.parseSlideDSL(s),l=T.compile(i);if(!document.head.querySelector("#swiper-styles")){const v=document.createElement("style");v.id="swiper-styles",v.textContent=re,document.head.appendChild(v)}let m;if(typeof n.container=="string"){const v=document.querySelector(n.container);if(!v)throw new Error(`Container not found: ${n.container}`);m=v}else m=n.container;const A="slidejs-runner-swiper-styles";if(!m.querySelector(`#${A}`)){const v=document.createElement("style");v.id=A,v.textContent=ne,m.appendChild(v)}const f=document.createElement("div");m.appendChild(f);const S=new V,M=new K.SlideRunner({container:f,adapter:S,adapterOptions:{swiperConfig:n.swiperOptions}});return await M.run(l,e),M}exports.SwiperAdapter=V;exports.createSlideRunner=se;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|