@grapesjs/studio-sdk-plugins 1.0.12 → 1.0.13-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/iconifyComponent/index.d.ts +3 -0
- package/dist/iconifyComponent/types.d.ts +42 -0
- package/dist/iconifyComponent/typesSchema.d.ts +19 -0
- package/dist/iconifyComponent/utils.d.ts +18 -0
- package/dist/index.cjs.d.ts +2 -0
- package/dist/index.cjs.js +182 -170
- package/dist/index.d.ts +2 -0
- package/dist/index.es.d.ts +2 -0
- package/dist/index.es.js +21738 -16239
- package/dist/index.umd.js +182 -170
- package/dist/lightGalleryComponent/index.cjs.js +1 -1
- package/dist/lightGalleryComponent/index.es.js +29 -30
- package/dist/lightGalleryComponent/index.umd.js +1 -1
- package/dist/prosemirror/index.cjs.js +6 -6
- package/dist/prosemirror/index.es.js +97 -96
- package/dist/prosemirror/index.umd.js +6 -6
- package/dist/prosemirror/types.d.ts +3 -3
- package/dist/rteTinyMce/index.cjs.js +81 -71
- package/dist/rteTinyMce/index.es.js +9747 -4641
- package/dist/rteTinyMce/index.umd.js +81 -71
- package/dist/swiperComponent/index.cjs.js +3 -3
- package/dist/swiperComponent/index.es.js +50 -53
- package/dist/swiperComponent/index.umd.js +3 -3
- package/dist/tableComponent/index.cjs.js +1 -1
- package/dist/tableComponent/index.es.js +121 -121
- package/dist/tableComponent/index.umd.js +1 -1
- package/dist/youtubeAssetProvider/assetProviders/youtube.d.ts +3 -0
- package/dist/youtubeAssetProvider/index.cjs.d.ts +3 -0
- package/dist/youtubeAssetProvider/index.cjs.js +1 -0
- package/dist/youtubeAssetProvider/index.d.ts +3 -0
- package/dist/youtubeAssetProvider/index.es.d.ts +3 -0
- package/dist/youtubeAssetProvider/index.es.js +242 -0
- package/dist/youtubeAssetProvider/index.umd.js +1 -0
- package/dist/youtubeAssetProvider/types.d.ts +202 -0
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";require("grapesjs");const Q="app.grapesjs.com",ee="app-stage.grapesjs.com",H=[Q,ee,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],te="license:check:start",ae="license:check:end",le=()=>typeof window<"u",se=({isDev:e,isStage:l})=>`${e?"":`https://${l?ee:Q}`}/api`,
|
|
1
|
+
"use strict";require("grapesjs");const Q="app.grapesjs.com",ee="app-stage.grapesjs.com",H=[Q,ee,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],te="license:check:start",ae="license:check:end",le=()=>typeof window<"u",se=({isDev:e,isStage:l})=>`${e?"":`https://${l?ee:Q}`}/api`,ie=()=>{const e=le()&&window.location.hostname;return!!e&&(H.includes(e)||H.some(l=>e.endsWith(l)))},ne=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(l,a)=>(a?"-":"")+l.toLowerCase()),oe=e=>typeof e<"u";var T=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(T||{});async function re({path:e,baseApiUrl:l,method:a="GET",headers:s={},params:n,body:b}){const f=`${l||se({isDev:!1,isStage:!1})}${e}`,d={method:a,headers:{"Content-Type":"application/json",...s}};b&&(d.body=JSON.stringify(b));const u=n?new URLSearchParams(n).toString():"",o=u?`?${u}`:"",h=await fetch(`${f}${o}`,d);if(!h.ok)throw new Error(`HTTP error! status: ${h.status}`);return h.json()}const G={[T.free]:0,[T.startup]:10,[T.business]:20,[T.enterprise]:30};function ce(e){const l=e;return l.init=a=>s=>e(s,a),l}const de=e=>ce(e);async function pe({editor:e,plan:l,pluginName:a,licenseKey:s,cleanup:n}){let b="",c=!1;const f=ie(),d=o=>{console.warn("Cleanup plugin:",a,"Reason:",o),n()},u=(o={})=>{var S;const{error:h,sdkLicense:t}=o,i=(S=o.plan)==null?void 0:S.category;if(!(t||o.license)||h)d(h||"Invalid license");else if(i){const R=G[l],$=G[i];R>$&&d({pluginRequiredPlan:l,licensePlan:i})}};e.on(te,o=>{b=o==null?void 0:o.baseApiUrl,c=!0}),e.on(ae,o=>{u(o)}),setTimeout(async()=>{if(!c){if(f)return;if(s){const o=await ue({licenseKey:s,pluginName:a,baseApiUrl:b});o&&u(o)}else d("The `licenseKey` option not provided")}},2e3)}async function ue(e){const{licenseKey:l,pluginName:a,baseApiUrl:s}=e;try{return(await re({baseApiUrl:s,path:`/sdk/${l||"na"}`,method:"POST",params:{d:window.location.hostname,pn:a}})).result||{}}catch(n){return console.error("Error during SDK license check:",n),!1}}const P=(e,l)=>{var a;return!!((a=e==null?void 0:e.classList)!=null&&a.contains(l))},be=(e,l={})=>{var b;const a={},s=[],n=[];for(const c in e){const{value:f,...d}=e[c];s.push({id:c,name:c,changeProp:!0,category:l.category,...d}),a[c]=f,!oe(f)&&n.push(c);const{subTraits:u={}}=d;for(const o in d.subTraits)(b=u[o])==null||b.forEach(h=>{const t=h.id||h.name;a[t]=h.value})}return{propKeys:Object.keys(a),propsNoValues:n,props:a,traits:s}},fe=(e,l)=>{l.forEach(a=>{if(a.subTraits){const s=`${a.id||a.name}`,n=a.changeProp?`change:${s}`:`change:attributes:${s}`;e.on(n,()=>U(e,s)),U(e,s)}})},U=(e,l)=>{const a=e.getTrait(l),s=a.get("category"),n=a.get("subTraits")||{},c=(Object.values(n).flat()||[]).map(u=>u.id||u.name);e.removeTrait(c);const f=n[a.getValue()],d=e.getTraitIndex(l)+1;f&&e.addTrait(f.map(u=>({category:s,...u})),{at:d})},he=(e,l)=>{l.forEach(a=>{const s=ne(a);s!==a&&e.has(s)&&e.set({[a]:e.get(s),[s]:void 0})})},m="swiper",M=`${m}-slide`,x=`${m}-wrapper`,L=`${m}-nav-prev`,V=`${m}-nav-next`,k=`${m}-pagination`,N=`${m}-scrollbar`,p={slider:`<svg viewBox="0 0 24 24">
|
|
2
2
|
<path d="M22 7.6c0-1-.5-1.6-1.3-1.6H3.4C2.5 6 2 6.7 2 7.6v9.8c0 1 .5 1.6 1.3 1.6h17.4c.8 0 1.3-.6 1.3-1.6V7.6zM21 18H3V7h18v11z" fill-rule="nonzero"/>
|
|
3
3
|
<path d="M4 12.5L6 14v-3zM20 12.5L18 14v-3z"/>
|
|
4
4
|
</svg>`,effect:`<svg viewBox="0 0 24 24">
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
<path d="M2 12c0 5 4 9 9 9 2.4 0 4.7-1 6.4-2.6l-1.5-1.5A6.7 6.7 0 0 1 11 19a7 7 0 1 1 7-7h-3l4 4h.1l3.9-4h-3a9 9 0 0 0-18 0Z"/>
|
|
22
22
|
</svg>`,prev:'<svg viewBox="0 0 24 24"><path d="M15.4 16.6 10.8 12l4.6-4.6L14 6l-6 6 6 6 1.4-1.4Z"/></svg>',next:'<svg viewBox="0 0 24 24"><path d="m8.6 16.6 4.6-4.6-4.6-4.6L10 6l6 6-6 6-1.4-1.4Z"/></svg>',add:`<svg viewBox="0 0 24 24">
|
|
23
23
|
<path d="M12 20a8 8 0 1 1 0-16 8 8 0 0 1 0 16m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m1 5h-2v4H7v2h4v4h2v-4h4v-2h-4V7Z"/>
|
|
24
|
-
</svg>`},j={id:"swiper-responsive",label:"Responsive",icon:u.responsive},K={id:"swiper-extra",label:"Extra",icon:u.extra},ve={actions:{type:"radio",label:!1,labelToTitle:!0,options:[{id:"r",label:"Reload slider",icon:u.reload},{id:"p",label:"Previous slide",icon:u.prev},{id:"n",label:"Next slide",icon:u.next},{id:"a",label:"Add new slide",icon:u.add}],setValue:({component:e,value:l})=>{var s;const a=(s=e.getView())==null?void 0:s.getSwiper();switch(l){case"r":e.reloadSlider();break;case"p":a==null||a.slidePrev();break;case"n":a==null||a.slideNext();break;case"a":e.addSlide();break}}},vertical:{type:"checkbox",label:"Vertical",value:!1},loop:{type:"checkbox",label:"Loop",value:!1},freeMode:{type:"checkbox",label:"Free mode",value:!1},autoHeight:{type:"checkbox",label:"Auto height",value:!1},navigation:{type:"checkbox",label:"Navigation",getValue:({component:e})=>!!e.findFirstType(L),setValue:({component:e,value:l})=>{var a,s;l?e.append([{type:L},{type:V}]):((a=e.findFirstType(L))==null||a.remove(),(s=e.findFirstType(V))==null||s.remove()),e.set({navigation:l})}},initialSlide:{type:"number",label:"Initial slide",min:0,value:"0"},speed:{type:"number",label:"Speed",tip:"Transition duration (in ms)",step:500,min:0,value:300},effect:{category:{id:"swiper-effect",label:"Effects",icon:u.effect},type:"select",label:"Effect Type",value:"slide",options:[{id:"slide",label:"Slide"},{id:"fade",label:"Fade"},{id:"cube",label:"Cube"},{id:"coverflow",label:"Coverflow"},{id:"flip",label:"Flip"},{id:"cards",label:"Cards"}],subTraits:{slide:[{type:"number",name:"slidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"slidesPerGroup",label:"Slides per group",tip:"Numbers of slides for group sliding",changeProp:!0,min:1,value:1},{type:"number",name:"spaceBetween",label:"Space between",tip:"Distance between slides in px",changeProp:!0,min:0,value:0},{type:"number",name:"slidesOffsetBefore",label:"Slides offset before",tip:"Add additional slide offset in the beginning of the container (in px, before all slides)",changeProp:!0,min:0,value:0},{type:"number",name:"slidesOffsetAfter",label:"Slides offset after",tip:"Add additional slide offset in the end of the container (in px, after all slides)",changeProp:!0,min:0,value:0},{type:"checkbox",name:"centeredSlides",label:"Centered slides",tip:"If enabled, the active slide will be centered",changeProp:!0,value:!1}],fade:[{type:"checkbox",name:"crossFade",tip:"Enables slides cross fade",label:"Cross fade",changeProp:!0,value:!1}],cube:[{type:"checkbox",name:"cubeEffectShadow",label:"Shadow",changeProp:!0,value:!0},{type:"checkbox",name:"cubeEffectSlideShadows",label:"Slide shadows",changeProp:!0,value:!0},{type:"number",name:"cubeEffectShadowOffset",label:"Shadow offset",changeProp:!0,value:20},{type:"number",name:"cubeEffectShadowScale",label:"Shadow scale",changeProp:!0,value:.94}],coverflow:[{type:"number",name:"coverflowEffectDepth",tip:"Depth offset in px (slides translate in Z axis)",label:"Depth",changeProp:!0,min:0,value:100},{type:"number",name:"coverflowEffectModifier",tip:"Effect multiplier",label:"Modifier",changeProp:!0,step:.1,min:0,value:1},{type:"number",name:"coverflowEffectRotate",tip:"Slide rotate in degrees",label:"Rotate",changeProp:!0,min:0,value:50},{type:"number",name:"coverflowEffectScale",tip:"Slide scale effect",label:"Scale",changeProp:!0,min:0,step:.1,value:1},{type:"number",name:"coverflowEffectStretch",tip:"Stretch space between slides (in px)",label:"Stretch",changeProp:!0,min:0,value:0},{type:"checkbox",name:"coverflowEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadow",changeProp:!0,value:!0}],flip:[{type:"checkbox",name:"flipEffectLimitRotation",tip:"Limit edge slides rotation",label:"Limit rotation",changeProp:!0,value:!0},{type:"checkbox",name:"flipEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadows",changeProp:!0,value:!0}],cards:[{type:"number",name:"cardsEffectPerSlideOffset",tip:"Offset distance per slide (in px)",label:"Slide offset",changeProp:!0,min:0,value:8},{type:"number",name:"cardsEffectPerSlideRotate",tip:"Rotate angle per slide (in degrees)",label:"Slide rotate",changeProp:!0,min:0,value:2},{type:"checkbox",name:"cardsEffectRotate",tip:"Enables cards rotation",label:"Rotate",changeProp:!0,value:!0},{type:"checkbox",name:"cardsEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadows",changeProp:!0,value:!0}]}},autoplay:{category:{id:"swiper-autoplay",label:"Autoplay",icon:u.autoplay},type:"checkbox",label:"Enable Autoplay",value:!1,subTraits:{true:[{type:"number",name:"autoplayDelay",label:"Delay",changeProp:!0,value:3e3},{type:"checkbox",name:"autoplayDisableOnInteraction",label:"Disable on interaction",changeProp:!0,value:!0},{type:"checkbox",name:"autoplayWaitForTransition",label:"Wait for transition",changeProp:!0,value:!0},{type:"checkbox",name:"autoplayPauseOnMouseEnter",label:"Pause on mouse enter",changeProp:!0,value:!1},{type:"checkbox",name:"autoplayReverseDirection",label:"Reverse direction",changeProp:!0,value:!1},{type:"checkbox",name:"autoplayStopOnLastSlide",label:"Stop on last slide",changeProp:!0,value:!1}]}},pagination:{category:{id:"swiper-pagination",label:"Pagination",icon:u.pagination},type:"select",label:"Pagination Type",options:[{id:"none",label:"None"},{id:"bullets",label:"Bullets"},{id:"progressbar",label:"Progressbar"},{id:"fraction",label:"Fraction"}],getValue:({component:e})=>e.findFirstType(k)?e.get("pagination")||"bullets":"none",setValue:({component:e,value:l})=>{const a=e.findFirstType(k);a==null||a.remove(),l!=="none"&&e.append({type:k}),e.set({pagination:l})},subTraits:{bullets:[{type:"checkbox",name:"dynamicBullets",label:"Dynamic bullets",changeProp:!0,value:!1},{type:"checkbox",name:"clickableBullets",label:"Clickable bullets",changeProp:!0,value:!0}],progressbar:[{type:"checkbox",name:"progressbarOpposite",label:"Progress opposite",changeProp:!0,value:!1}]}},scrollbar:{category:{id:"swiper-scrollbar",label:"Scrollbar",icon:u.scrollbar},type:"checkbox",label:"Enable Scrollbar",getValue:({component:e})=>!!e.findFirstType(N),setValue:({component:e,value:l})=>{const a=e.findFirstType(N);a==null||a.remove(),l&&e.append({type:N}),e.set({scrollbar:l})},subTraits:{false:[],true:[{type:"checkbox",name:"scrollbarDraggable",label:"Draggable",changeProp:!0,value:!1},{type:"checkbox",name:"scrollbarHide",label:"Hide",tip:"Hide scrollbar automatically after user interaction",changeProp:!0,value:!0}]}},parallax:{category:{id:"swiper-parallax",label:"Parallax",icon:u.parallax},type:"checkbox",label:"Enable Parallax",value:!1},mobile:{category:j,type:"checkbox",label:"Enable mobile breakpoint",value:!1,subTraits:{true:[{type:"number",name:"mobileBreakpoint",label:"Mobile breakpoint",tip:"Slide values below will be applied when the screen width is greater than this value",changeProp:!0,min:1,value:460},{type:"number",name:"mobileSlidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"mobileSlidesPerGroup",label:"Slides per group",changeProp:!0,min:1,value:1},{type:"number",name:"mobileSpaceBetween",label:"Space between",changeProp:!0,min:0,value:0}]}},tablet:{category:j,type:"checkbox",label:"Enable tablet breakpoint",value:!1,subTraits:{true:[{type:"number",name:"tabletBreakpoint",label:"Tablet breakpoint",tip:"Slide values below will be applied when the screen width is greater than this value",changeProp:!0,min:1,value:991},{type:"number",name:"tabletSlidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"tabletSlidesPerGroup",label:"Slides per group",changeProp:!0,min:1,value:1},{type:"number",name:"tabletSpaceBetween",label:"Space between",changeProp:!0,min:0,value:0}]}},allowTouchMove:{category:K,type:"checkbox",label:"Allow touch move",tip:"Allow touch interactions",value:!0},grabCursor:{category:K,type:"checkbox",label:"Grab cursor",tip:'If enabled, the user will see the "grab" cursor when hover the slider',value:!1}},Z="Slider",q="swiper",C=`${q}-`,me=(e,l)=>{const{Components:a,Blocks:s,Commands:i}=e,{block:f}=l,c=be(ve),d="core:preview",p=i.events,b=function(t){const n=this,A=window,S=n.__onLoad,R=n.__activeSlide,$=n.__inPreview,{cdnScript:D,cdnStyle:I,slidesPerView:F}=t||{},r=v=>isNaN(v)?void 0:parseFloat(v),z=()=>{const v={loop:t.loop,speed:t.speed,initialSlide:t.initialSlide,direction:t.vertical?"vertical":"horizontal",effect:t.effect,freeMode:t.freeMode,parallax:t.parallax,autoHeight:t.autoHeight,allowTouchMove:t.allowTouchMove,grabCursor:t.grabCursor,simulateTouch:!0,breakpoints:{},slidesPerView:isNaN(F)?F:r(F),slidesPerGroup:r(t.slidesPerGroup),spaceBetween:r(t.spaceBetween),slidesOffsetBefore:r(t.slidesOffsetBefore),slidesOffsetAfter:r(t.slidesOffsetAfter),centeredSlides:t.centeredSlides,fadeEffect:{crossFade:t.crossFade},cubeEffect:{shadow:t.cubeEffectShadow,slideShadows:t.cubeEffectSlideShadows,shadowOffset:r(t.cubeEffectShadowOffset),shadowScale:r(t.cubeEffectShadowScale)},coverflowEffect:{depth:r(t.coverflowEffectDepth),modifier:r(t.coverflowEffectModifier),rotate:r(t.coverflowEffectRotate),scale:r(t.coverflowEffectScale),stretch:r(t.coverflowEffectStretch),slideShadows:t.coverflowEffectSlideShadows},flipEffect:{limitRotation:t.flipEffectLimitRotation,slideShadows:t.flipEffectSlideShadows},cardsEffect:{perSlideOffset:r(t.cardsEffectPerSlideOffset),perSlideRotate:r(t.cardsEffectPerSlideRotate),rotate:t.cardsEffectRotate,slideShadows:t.cardsEffectSlideShadows},navigation:{nextEl:n.querySelector(".swiper-button-next"),prevEl:n.querySelector(".swiper-button-prev")},pagination:{type:t.pagination||"bullets",dynamicBullets:t.dynamicBullets,clickable:t.clickableBullets,progressbarOpposite:t.progressbarOpposite,el:n.querySelector(".swiper-pagination")},scrollbar:{el:n.querySelector(".swiper-scrollbar"),draggable:t.scrollbarDraggable,hide:t.scrollbarHide},autoplay:t.autoplay&&{delay:t.autoplayDelay,disableOnInteraction:t.autoplayDisableOnInteraction,pauseOnMouseEnter:t.autoplayPauseOnMouseEnter,reverseDirection:t.autoplayReverseDirection,stopOnLastSlide:t.autoplayStopOnLastSlide,waitForTransition:t.autoplayWaitForTransition}};if(t.tablet){const{tabletBreakpoint:_,tabletSlidesPerView:g}=t,E=r(_);v.breakpoints[E]={slidesPerView:isNaN(g)?g:r(g),slidesPerGroup:r(t.tabletSlidesPerGroup),spaceBetween:r(t.tabletSpaceBetween)}}if(t.mobile){const{mobileBreakpoint:_,mobileSlidesPerView:g}=t,E=r(_);v.breakpoints[E]={slidesPerView:isNaN(g)?g:r(g),slidesPerGroup:r(t.mobileSlidesPerGroup),spaceBetween:r(t.mobileSpaceBetween)}}S&&!$&&(v.simulateTouch=!1),R&&(v.initialSlide=R);const W=new A.Swiper(n,v);S==null||S(W)};if(A.Swiper)z();else{const{head:v}=document,W=Array.isArray(D)?[...D]:[D],_=Array.isArray(I)?[...I]:[I],g=w=>{if(w.length){const y=document.createElement("link");y.href=w.shift(),y.rel="stylesheet",v.appendChild(y),g(w)}},E=w=>{if(w.length){const y=document.createElement("script");y.src=w.shift(),y.onerror=y.onload=E.bind(null,w),v.appendChild(y)}else z()};g(_),E(W)}},o=(t=0)=>({type:M,style:{padding:"50px"},components:{type:"text",components:{type:"textnode",content:`Slide ${t}`}}}),h=a.getType("default").model;return a.addType(m,{block:f&&{label:Z,media:u.slider,category:"Extra",select:!0,...l.block},isComponent:t=>P(t,q),model:{defaults:()=>({name:Z,icon:u.slider,classes:q,draggable:(t,n)=>!n.is(m),components:[{type:x,components:[o(1),o(2),o(3)]},{type:k}],script:b,cdnScript:l.cdnScript,cdnStyle:l.cdnStyle,"script-props":["cdnScript","cdnStyle",...c.propKeys],...c.props,traits:[...c.traits]}),init(){const{em:t}=this;fe(this,c.traits),he(this,c.propKeys),this.listenTo(t,`${p.runCommand}${d}`,this.onPreviewOn),this.listenTo(t,`${p.stopCommand}${d}`,this.onPreviewOff)},onPreviewOn(){this.__inPreview=!0,this.reloadSlider()},onPreviewOff(){this.__inPreview=!1,this.reloadSlider()},reloadSlider(){this.trigger("rerender")},addSlide(){const t=this.findFirstType(x);t==null||t.append(this.getNewSlideComponentDef())},getNewSlideComponentDef(){var n;const t=((n=this.findFirstType(x))==null?void 0:n.components().length)||0;return{type:M,components:{type:"text",components:{type:"textnode",content:`Slide ${t+1}`}}}},toJSON(...t){const n=h.prototype.toJSON.apply(this,t);return c.propsNoValues.forEach(A=>delete n[A]),delete n["script-props"],n}},view:{init(){const t=a.events.scriptUnmount;t&&this.listenTo(this.model,t,this.destroySwiper)},getSwiper(){return this.el.swiper},destroySwiper(){var t;(t=this.getSwiper())==null||t.destroy()},onRender(){const t=this.el;t.__onLoad=n=>n.on("slideChange",()=>this.__activeSlide=n.activeIndex),t.__activeSlide=this.__activeSlide,t.__inPreview=this.model.__inPreview}}}),()=>{a.removeType(m),s.remove(m)}},ge="Nav Prev",ye="Nav Next",O=`${C}button-prev`,B=`${C}button-next`,Se=e=>{const{Components:l}=e,a=s=>({type:"svg",selectable:!1,hoverable:!1,attributes:{viewBox:"0 0 27 44"},components:{type:"svg-in",tagName:"path",attributes:{d:s,fill:"currentColor"}}});return l.addType(L,{isComponent:s=>P(s,O),model:{defaults:{name:ge,classes:O,copyable:!1,highlightable:!1,droppable:!1,draggable:!1,selectable:!1,hoverable:!1,layerable:!1,components:a("M0,22L22,0l2.1,2.1L4.2,22l19.9,19.9L22,44L0,22L0,22L0,22z"),styles:`
|
|
24
|
+
</svg>`},j={id:"swiper-responsive",label:"Responsive",icon:p.responsive},K={id:"swiper-extra",label:"Extra",icon:p.extra},ve={actions:{type:"radio",label:!1,labelToTitle:!0,options:[{id:"r",label:"Reload slider",icon:p.reload},{id:"p",label:"Previous slide",icon:p.prev},{id:"n",label:"Next slide",icon:p.next},{id:"a",label:"Add new slide",icon:p.add}],setValue:({component:e,value:l})=>{var s;const a=(s=e.getView())==null?void 0:s.getSwiper();switch(l){case"r":e.reloadSlider();break;case"p":a==null||a.slidePrev();break;case"n":a==null||a.slideNext();break;case"a":e.addSlide();break}}},vertical:{type:"checkbox",label:"Vertical",value:!1},loop:{type:"checkbox",label:"Loop",value:!1},freeMode:{type:"checkbox",label:"Free mode",value:!1},autoHeight:{type:"checkbox",label:"Auto height",value:!1},navigation:{type:"checkbox",label:"Navigation",getValue:({component:e})=>!!e.findFirstType(L),setValue:({component:e,value:l})=>{var a,s;l?e.append([{type:L},{type:V}]):((a=e.findFirstType(L))==null||a.remove(),(s=e.findFirstType(V))==null||s.remove()),e.set({navigation:l})}},initialSlide:{type:"number",label:"Initial slide",min:0,value:"0"},speed:{type:"number",label:"Speed",tip:"Transition duration (in ms)",step:500,min:0,value:300},effect:{category:{id:"swiper-effect",label:"Effects",icon:p.effect},type:"select",label:"Effect Type",value:"slide",options:[{id:"slide",label:"Slide"},{id:"fade",label:"Fade"},{id:"cube",label:"Cube"},{id:"coverflow",label:"Coverflow"},{id:"flip",label:"Flip"},{id:"cards",label:"Cards"}],subTraits:{slide:[{type:"number",name:"slidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"slidesPerGroup",label:"Slides per group",tip:"Numbers of slides for group sliding",changeProp:!0,min:1,value:1},{type:"number",name:"spaceBetween",label:"Space between",tip:"Distance between slides in px",changeProp:!0,min:0,value:0},{type:"number",name:"slidesOffsetBefore",label:"Slides offset before",tip:"Add additional slide offset in the beginning of the container (in px, before all slides)",changeProp:!0,min:0,value:0},{type:"number",name:"slidesOffsetAfter",label:"Slides offset after",tip:"Add additional slide offset in the end of the container (in px, after all slides)",changeProp:!0,min:0,value:0},{type:"checkbox",name:"centeredSlides",label:"Centered slides",tip:"If enabled, the active slide will be centered",changeProp:!0,value:!1}],fade:[{type:"checkbox",name:"crossFade",tip:"Enables slides cross fade",label:"Cross fade",changeProp:!0,value:!1}],cube:[{type:"checkbox",name:"cubeEffectShadow",label:"Shadow",changeProp:!0,value:!0},{type:"checkbox",name:"cubeEffectSlideShadows",label:"Slide shadows",changeProp:!0,value:!0},{type:"number",name:"cubeEffectShadowOffset",label:"Shadow offset",changeProp:!0,value:20},{type:"number",name:"cubeEffectShadowScale",label:"Shadow scale",changeProp:!0,value:.94}],coverflow:[{type:"number",name:"coverflowEffectDepth",tip:"Depth offset in px (slides translate in Z axis)",label:"Depth",changeProp:!0,min:0,value:100},{type:"number",name:"coverflowEffectModifier",tip:"Effect multiplier",label:"Modifier",changeProp:!0,step:.1,min:0,value:1},{type:"number",name:"coverflowEffectRotate",tip:"Slide rotate in degrees",label:"Rotate",changeProp:!0,min:0,value:50},{type:"number",name:"coverflowEffectScale",tip:"Slide scale effect",label:"Scale",changeProp:!0,min:0,step:.1,value:1},{type:"number",name:"coverflowEffectStretch",tip:"Stretch space between slides (in px)",label:"Stretch",changeProp:!0,min:0,value:0},{type:"checkbox",name:"coverflowEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadow",changeProp:!0,value:!0}],flip:[{type:"checkbox",name:"flipEffectLimitRotation",tip:"Limit edge slides rotation",label:"Limit rotation",changeProp:!0,value:!0},{type:"checkbox",name:"flipEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadows",changeProp:!0,value:!0}],cards:[{type:"number",name:"cardsEffectPerSlideOffset",tip:"Offset distance per slide (in px)",label:"Slide offset",changeProp:!0,min:0,value:8},{type:"number",name:"cardsEffectPerSlideRotate",tip:"Rotate angle per slide (in degrees)",label:"Slide rotate",changeProp:!0,min:0,value:2},{type:"checkbox",name:"cardsEffectRotate",tip:"Enables cards rotation",label:"Rotate",changeProp:!0,value:!0},{type:"checkbox",name:"cardsEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadows",changeProp:!0,value:!0}]}},autoplay:{category:{id:"swiper-autoplay",label:"Autoplay",icon:p.autoplay},type:"checkbox",label:"Enable Autoplay",value:!1,subTraits:{true:[{type:"number",name:"autoplayDelay",label:"Delay",changeProp:!0,value:3e3},{type:"checkbox",name:"autoplayDisableOnInteraction",label:"Disable on interaction",changeProp:!0,value:!0},{type:"checkbox",name:"autoplayWaitForTransition",label:"Wait for transition",changeProp:!0,value:!0},{type:"checkbox",name:"autoplayPauseOnMouseEnter",label:"Pause on mouse enter",changeProp:!0,value:!1},{type:"checkbox",name:"autoplayReverseDirection",label:"Reverse direction",changeProp:!0,value:!1},{type:"checkbox",name:"autoplayStopOnLastSlide",label:"Stop on last slide",changeProp:!0,value:!1}]}},pagination:{category:{id:"swiper-pagination",label:"Pagination",icon:p.pagination},type:"select",label:"Pagination Type",options:[{id:"none",label:"None"},{id:"bullets",label:"Bullets"},{id:"progressbar",label:"Progressbar"},{id:"fraction",label:"Fraction"}],getValue:({component:e})=>e.findFirstType(k)?e.get("pagination")||"bullets":"none",setValue:({component:e,value:l})=>{const a=e.findFirstType(k);a==null||a.remove(),l!=="none"&&e.append({type:k}),e.set({pagination:l})},subTraits:{bullets:[{type:"checkbox",name:"dynamicBullets",label:"Dynamic bullets",changeProp:!0,value:!1},{type:"checkbox",name:"clickableBullets",label:"Clickable bullets",changeProp:!0,value:!0}],progressbar:[{type:"checkbox",name:"progressbarOpposite",label:"Progress opposite",changeProp:!0,value:!1}]}},scrollbar:{category:{id:"swiper-scrollbar",label:"Scrollbar",icon:p.scrollbar},type:"checkbox",label:"Enable Scrollbar",getValue:({component:e})=>!!e.findFirstType(N),setValue:({component:e,value:l})=>{const a=e.findFirstType(N);a==null||a.remove(),l&&e.append({type:N}),e.set({scrollbar:l})},subTraits:{false:[],true:[{type:"checkbox",name:"scrollbarDraggable",label:"Draggable",changeProp:!0,value:!1},{type:"checkbox",name:"scrollbarHide",label:"Hide",tip:"Hide scrollbar automatically after user interaction",changeProp:!0,value:!0}]}},parallax:{category:{id:"swiper-parallax",label:"Parallax",icon:p.parallax},type:"checkbox",label:"Enable Parallax",value:!1},mobile:{category:j,type:"checkbox",label:"Enable mobile breakpoint",value:!1,subTraits:{true:[{type:"number",name:"mobileBreakpoint",label:"Mobile breakpoint",tip:"Slide values below will be applied when the screen width is greater than this value",changeProp:!0,min:1,value:460},{type:"number",name:"mobileSlidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"mobileSlidesPerGroup",label:"Slides per group",changeProp:!0,min:1,value:1},{type:"number",name:"mobileSpaceBetween",label:"Space between",changeProp:!0,min:0,value:0}]}},tablet:{category:j,type:"checkbox",label:"Enable tablet breakpoint",value:!1,subTraits:{true:[{type:"number",name:"tabletBreakpoint",label:"Tablet breakpoint",tip:"Slide values below will be applied when the screen width is greater than this value",changeProp:!0,min:1,value:991},{type:"number",name:"tabletSlidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"tabletSlidesPerGroup",label:"Slides per group",changeProp:!0,min:1,value:1},{type:"number",name:"tabletSpaceBetween",label:"Space between",changeProp:!0,min:0,value:0}]}},allowTouchMove:{category:K,type:"checkbox",label:"Allow touch move",tip:"Allow touch interactions",value:!0},grabCursor:{category:K,type:"checkbox",label:"Grab cursor",tip:'If enabled, the user will see the "grab" cursor when hover the slider',value:!1}},Z="Slider",q="swiper",C=`${q}-`,me=(e,l)=>{const{Components:a,Blocks:s,Commands:n}=e,{block:b}=l,c=be(ve),f="core:preview",d=n.events,u=function(t){const i=this,A=window,S=i.__onLoad,R=i.__activeSlide,$=i.__inPreview,{cdnScript:D,cdnStyle:I,slidesPerView:F}=t||{},r=v=>isNaN(v)?void 0:parseFloat(v),z=()=>{const v={loop:t.loop,speed:t.speed,initialSlide:t.initialSlide,direction:t.vertical?"vertical":"horizontal",effect:t.effect,freeMode:t.freeMode,parallax:t.parallax,autoHeight:t.autoHeight,allowTouchMove:t.allowTouchMove,grabCursor:t.grabCursor,simulateTouch:!0,breakpoints:{},slidesPerView:isNaN(F)?F:r(F),slidesPerGroup:r(t.slidesPerGroup),spaceBetween:r(t.spaceBetween),slidesOffsetBefore:r(t.slidesOffsetBefore),slidesOffsetAfter:r(t.slidesOffsetAfter),centeredSlides:t.centeredSlides,fadeEffect:{crossFade:t.crossFade},cubeEffect:{shadow:t.cubeEffectShadow,slideShadows:t.cubeEffectSlideShadows,shadowOffset:r(t.cubeEffectShadowOffset),shadowScale:r(t.cubeEffectShadowScale)},coverflowEffect:{depth:r(t.coverflowEffectDepth),modifier:r(t.coverflowEffectModifier),rotate:r(t.coverflowEffectRotate),scale:r(t.coverflowEffectScale),stretch:r(t.coverflowEffectStretch),slideShadows:t.coverflowEffectSlideShadows},flipEffect:{limitRotation:t.flipEffectLimitRotation,slideShadows:t.flipEffectSlideShadows},cardsEffect:{perSlideOffset:r(t.cardsEffectPerSlideOffset),perSlideRotate:r(t.cardsEffectPerSlideRotate),rotate:t.cardsEffectRotate,slideShadows:t.cardsEffectSlideShadows},navigation:{nextEl:i.querySelector(".swiper-button-next"),prevEl:i.querySelector(".swiper-button-prev")},pagination:{type:t.pagination||"bullets",dynamicBullets:t.dynamicBullets,clickable:t.clickableBullets,progressbarOpposite:t.progressbarOpposite,el:i.querySelector(".swiper-pagination")},scrollbar:{el:i.querySelector(".swiper-scrollbar"),draggable:t.scrollbarDraggable,hide:t.scrollbarHide},autoplay:t.autoplay&&{delay:t.autoplayDelay,disableOnInteraction:t.autoplayDisableOnInteraction,pauseOnMouseEnter:t.autoplayPauseOnMouseEnter,reverseDirection:t.autoplayReverseDirection,stopOnLastSlide:t.autoplayStopOnLastSlide,waitForTransition:t.autoplayWaitForTransition}};if(t.tablet){const{tabletBreakpoint:_,tabletSlidesPerView:g}=t,E=r(_);v.breakpoints[E]={slidesPerView:isNaN(g)?g:r(g),slidesPerGroup:r(t.tabletSlidesPerGroup),spaceBetween:r(t.tabletSpaceBetween)}}if(t.mobile){const{mobileBreakpoint:_,mobileSlidesPerView:g}=t,E=r(_);v.breakpoints[E]={slidesPerView:isNaN(g)?g:r(g),slidesPerGroup:r(t.mobileSlidesPerGroup),spaceBetween:r(t.mobileSpaceBetween)}}S&&!$&&(v.simulateTouch=!1),R&&(v.initialSlide=R);const W=new A.Swiper(i,v);S==null||S(W)};if(A.Swiper)z();else{const{head:v}=document,W=Array.isArray(D)?[...D]:[D],_=Array.isArray(I)?[...I]:[I],g=w=>{if(w.length){const y=document.createElement("link");y.href=w.shift(),y.rel="stylesheet",v.appendChild(y),g(w)}},E=w=>{if(w.length){const y=document.createElement("script");y.src=w.shift(),y.onerror=y.onload=E.bind(null,w),v.appendChild(y)}else z()};g(_),E(W)}},o=(t=0)=>({type:M,style:{padding:"50px"},components:{type:"text",components:{type:"textnode",content:`Slide ${t}`}}}),h=a.getType("default").model;return a.addType(m,{block:b&&{label:Z,media:p.slider,category:"Extra",select:!0,...l.block},isComponent:t=>P(t,q),model:{defaults:()=>({name:Z,icon:p.slider,classes:q,draggable:(t,i)=>!i.is(m),components:[{type:x,components:[o(1),o(2),o(3)]},{type:k}],script:u,cdnScript:l.cdnScript,cdnStyle:l.cdnStyle,"script-props":["cdnScript","cdnStyle",...c.propKeys],...c.props,traits:[...c.traits]}),init(){const{em:t}=this;fe(this,c.traits),he(this,c.propKeys),this.listenTo(t,`${d.runCommand}${f}`,this.onPreviewOn),this.listenTo(t,`${d.stopCommand}${f}`,this.onPreviewOff)},onPreviewOn(){this.__inPreview=!0,this.reloadSlider()},onPreviewOff(){this.__inPreview=!1,this.reloadSlider()},reloadSlider(){this.trigger("rerender")},addSlide(){const t=this.findFirstType(x);t==null||t.append(this.getNewSlideComponentDef())},getNewSlideComponentDef(){var i;const t=((i=this.findFirstType(x))==null?void 0:i.components().length)||0;return{type:M,components:{type:"text",components:{type:"textnode",content:`Slide ${t+1}`}}}},toJSON(...t){const i=h.prototype.toJSON.apply(this,t);return c.propsNoValues.forEach(A=>delete i[A]),delete i["script-props"],i}},view:{init(){this.listenTo(this.model,a.events.scriptUnmount,this.destroySwiper)},getSwiper(){return this.el.swiper},destroySwiper(){var t;(t=this.getSwiper())==null||t.destroy()},onRender(){const t=this.el;t.__onLoad=i=>i.on("slideChange",()=>this.__activeSlide=i.activeIndex),t.__activeSlide=this.__activeSlide,t.__inPreview=this.model.__inPreview}}}),()=>{a.removeType(m),s.remove(m)}},ge="Nav Prev",ye="Nav Next",O=`${C}button-prev`,B=`${C}button-next`,Se=e=>{const{Components:l}=e,a=s=>({type:"svg",selectable:!1,hoverable:!1,attributes:{viewBox:"0 0 27 44"},components:{type:"svg-in",tagName:"path",attributes:{d:s,fill:"currentColor"}}});return l.addType(L,{isComponent:s=>P(s,O),model:{defaults:{name:ge,classes:O,copyable:!1,highlightable:!1,droppable:!1,draggable:!1,selectable:!1,hoverable:!1,layerable:!1,components:a("M0,22L22,0l2.1,2.1L4.2,22l19.9,19.9L22,44L0,22L0,22L0,22z"),styles:`
|
|
25
25
|
.${O} {
|
|
26
26
|
color: inherit;
|
|
27
27
|
}
|
|
@@ -42,4 +42,4 @@
|
|
|
42
42
|
.${a}-progressbar-fill {
|
|
43
43
|
--swiper-pagination-color: currentColor;
|
|
44
44
|
}
|
|
45
|
-
`}}}),()=>{l.removeType(k)}},Pe="Scrollbar",Y=`${C}scrollbar`,Ee=e=>{const{Components:l}=e;return l.addType(N,{isComponent:a=>P(a,Y),model:{defaults:{name:Pe,classes:Y,copyable:!1,highlightable:!1,removable:!1,selectable:!1,hoverable:!1,layerable:!1,droppable:!1,draggable:!1}}}),()=>{l.removeType(N)}},Te="Slide",X=`${C}slide`,xe=e=>{const{Components:l}=e;return l.addType(M,{isComponent:a=>P(a,X),model:{defaults:{name:Te,classes:X,icon:
|
|
45
|
+
`}}}),()=>{l.removeType(k)}},Pe="Scrollbar",Y=`${C}scrollbar`,Ee=e=>{const{Components:l}=e;return l.addType(N,{isComponent:a=>P(a,Y),model:{defaults:{name:Pe,classes:Y,copyable:!1,highlightable:!1,removable:!1,selectable:!1,hoverable:!1,layerable:!1,droppable:!1,draggable:!1}}}),()=>{l.removeType(N)}},Te="Slide",X=`${C}slide`,xe=e=>{const{Components:l}=e;return l.addType(M,{isComponent:a=>P(a,X),model:{defaults:{name:Te,classes:X,icon:p.slider,draggable:(a,s)=>s.is(x)}}}),()=>{l.removeType(M)}},Le="Wrapper",J=`${C}wrapper`,ke=e=>{const{Components:l}=e,{events:a}=l;return l.addType(x,{isComponent:s=>P(s,J),model:{defaults:{name:Le,icon:p.slider,classes:J,copyable:!1,removable:!1,draggable:!1,highlightable:!1,droppable:s=>s.is(M)},init(){const s=this.components();this.listenTo(s,"add remove",this.updateSlider)},updateSlider(s){const n=this.closestType(m);if(n){const b=n.getView();n.reloadSlider(),this.em.once(a.scriptMount,()=>{setTimeout(()=>{var c;return(c=b.getSwiper())==null?void 0:c.slideTo(s.index())},100)})}}}}),()=>{l.removeType(x)}},Ce="swiperComponent",Ae=function(e,l={}){const a={block:{},cdnScript:"https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js",cdnStyle:"https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css",...l},s=[me(e,a),Se(e),ke(e),xe(e),we(e),Ee(e)];pe({editor:e,plan:T.startup,licenseKey:a.licenseKey,pluginName:Ce,cleanup:()=>{s.forEach(n=>n())}})},_e=de(Ae);module.exports=_e;
|
|
@@ -21,17 +21,17 @@ async function re({
|
|
|
21
21
|
method: a = "GET",
|
|
22
22
|
headers: s = {},
|
|
23
23
|
params: i,
|
|
24
|
-
body:
|
|
24
|
+
body: b
|
|
25
25
|
}) {
|
|
26
|
-
const
|
|
26
|
+
const f = `${l || se({ isDev: !1, isStage: !1 })}${e}`, d = {
|
|
27
27
|
method: a,
|
|
28
28
|
headers: {
|
|
29
29
|
"Content-Type": "application/json",
|
|
30
30
|
...s
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
|
-
|
|
34
|
-
const
|
|
33
|
+
b && (d.body = JSON.stringify(b));
|
|
34
|
+
const u = i ? new URLSearchParams(i).toString() : "", o = u ? `?${u}` : "", h = await fetch(`${f}${o}`, d);
|
|
35
35
|
if (!h.ok)
|
|
36
36
|
throw new Error(`HTTP error! status: ${h.status}`);
|
|
37
37
|
return h.json();
|
|
@@ -54,31 +54,31 @@ async function pe({
|
|
|
54
54
|
licenseKey: s,
|
|
55
55
|
cleanup: i
|
|
56
56
|
}) {
|
|
57
|
-
let
|
|
58
|
-
const
|
|
57
|
+
let b = "", c = !1;
|
|
58
|
+
const f = ne(), d = (o) => {
|
|
59
59
|
console.warn("Cleanup plugin:", a, "Reason:", o), i();
|
|
60
|
-
},
|
|
60
|
+
}, u = (o = {}) => {
|
|
61
61
|
var S;
|
|
62
62
|
const { error: h, sdkLicense: t } = o, n = (S = o.plan) == null ? void 0 : S.category;
|
|
63
63
|
if (!(t || o.license) || h)
|
|
64
|
-
|
|
64
|
+
d(h || "Invalid license");
|
|
65
65
|
else if (n) {
|
|
66
66
|
const R = G[l], $ = G[n];
|
|
67
|
-
R > $ &&
|
|
67
|
+
R > $ && d({ pluginRequiredPlan: l, licensePlan: n });
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
70
|
e.on(te, (o) => {
|
|
71
|
-
|
|
71
|
+
b = o == null ? void 0 : o.baseApiUrl, c = !0;
|
|
72
72
|
}), e.on(ae, (o) => {
|
|
73
|
-
|
|
73
|
+
u(o);
|
|
74
74
|
}), setTimeout(async () => {
|
|
75
75
|
if (!c) {
|
|
76
|
-
if (
|
|
76
|
+
if (f) return;
|
|
77
77
|
if (s) {
|
|
78
|
-
const o = await ue({ licenseKey: s, pluginName: a, baseApiUrl:
|
|
79
|
-
o &&
|
|
78
|
+
const o = await ue({ licenseKey: s, pluginName: a, baseApiUrl: b });
|
|
79
|
+
o && u(o);
|
|
80
80
|
} else
|
|
81
|
-
|
|
81
|
+
d("The `licenseKey` option not provided");
|
|
82
82
|
}
|
|
83
83
|
}, 2e3);
|
|
84
84
|
}
|
|
@@ -102,14 +102,14 @@ const P = (e, l) => {
|
|
|
102
102
|
var a;
|
|
103
103
|
return !!((a = e == null ? void 0 : e.classList) != null && a.contains(l));
|
|
104
104
|
}, be = (e, l = {}) => {
|
|
105
|
-
var
|
|
105
|
+
var b;
|
|
106
106
|
const a = {}, s = [], i = [];
|
|
107
107
|
for (const c in e) {
|
|
108
|
-
const { value:
|
|
109
|
-
s.push({ id: c, name: c, changeProp: !0, category: l.category, ...
|
|
110
|
-
const { subTraits:
|
|
111
|
-
for (const o in
|
|
112
|
-
(
|
|
108
|
+
const { value: f, ...d } = e[c];
|
|
109
|
+
s.push({ id: c, name: c, changeProp: !0, category: l.category, ...d }), a[c] = f, !oe(f) && i.push(c);
|
|
110
|
+
const { subTraits: u = {} } = d;
|
|
111
|
+
for (const o in d.subTraits)
|
|
112
|
+
(b = u[o]) == null || b.forEach((h) => {
|
|
113
113
|
const t = h.id || h.name;
|
|
114
114
|
a[t] = h.value;
|
|
115
115
|
});
|
|
@@ -128,19 +128,19 @@ const P = (e, l) => {
|
|
|
128
128
|
}
|
|
129
129
|
});
|
|
130
130
|
}, U = (e, l) => {
|
|
131
|
-
const a = e.getTrait(l), s = a.get("category"), i = a.get("subTraits") || {}, c = (Object.values(i).flat() || []).map((
|
|
131
|
+
const a = e.getTrait(l), s = a.get("category"), i = a.get("subTraits") || {}, c = (Object.values(i).flat() || []).map((u) => u.id || u.name);
|
|
132
132
|
e.removeTrait(c);
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
{ at:
|
|
133
|
+
const f = i[a.getValue()], d = e.getTraitIndex(l) + 1;
|
|
134
|
+
f && e.addTrait(
|
|
135
|
+
f.map((u) => ({ category: s, ...u })),
|
|
136
|
+
{ at: d }
|
|
137
137
|
);
|
|
138
138
|
}, he = (e, l) => {
|
|
139
139
|
l.forEach((a) => {
|
|
140
140
|
const s = ie(a);
|
|
141
141
|
s !== a && e.has(s) && e.set({ [a]: e.get(s), [s]: void 0 });
|
|
142
142
|
});
|
|
143
|
-
}, m = "swiper", M = `${m}-slide`, x = `${m}-wrapper`, L = `${m}-nav-prev`, V = `${m}-nav-next`, k = `${m}-pagination`, N = `${m}-scrollbar`,
|
|
143
|
+
}, m = "swiper", M = `${m}-slide`, x = `${m}-wrapper`, L = `${m}-nav-prev`, V = `${m}-nav-next`, k = `${m}-pagination`, N = `${m}-scrollbar`, p = {
|
|
144
144
|
slider: `<svg viewBox="0 0 24 24">
|
|
145
145
|
<path d="M22 7.6c0-1-.5-1.6-1.3-1.6H3.4C2.5 6 2 6.7 2 7.6v9.8c0 1 .5 1.6 1.3 1.6h17.4c.8 0 1.3-.6 1.3-1.6V7.6zM21 18H3V7h18v11z" fill-rule="nonzero"/>
|
|
146
146
|
<path d="M4 12.5L6 14v-3zM20 12.5L18 14v-3z"/>
|
|
@@ -176,16 +176,16 @@ const P = (e, l) => {
|
|
|
176
176
|
add: `<svg viewBox="0 0 24 24">
|
|
177
177
|
<path d="M12 20a8 8 0 1 1 0-16 8 8 0 0 1 0 16m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m1 5h-2v4H7v2h4v4h2v-4h4v-2h-4V7Z"/>
|
|
178
178
|
</svg>`
|
|
179
|
-
}, j = { id: "swiper-responsive", label: "Responsive", icon:
|
|
179
|
+
}, j = { id: "swiper-responsive", label: "Responsive", icon: p.responsive }, K = { id: "swiper-extra", label: "Extra", icon: p.extra }, ve = {
|
|
180
180
|
actions: {
|
|
181
181
|
type: "radio",
|
|
182
182
|
label: !1,
|
|
183
183
|
labelToTitle: !0,
|
|
184
184
|
options: [
|
|
185
|
-
{ id: "r", label: "Reload slider", icon:
|
|
186
|
-
{ id: "p", label: "Previous slide", icon:
|
|
187
|
-
{ id: "n", label: "Next slide", icon:
|
|
188
|
-
{ id: "a", label: "Add new slide", icon:
|
|
185
|
+
{ id: "r", label: "Reload slider", icon: p.reload },
|
|
186
|
+
{ id: "p", label: "Previous slide", icon: p.prev },
|
|
187
|
+
{ id: "n", label: "Next slide", icon: p.next },
|
|
188
|
+
{ id: "a", label: "Add new slide", icon: p.add }
|
|
189
189
|
],
|
|
190
190
|
setValue: ({ component: e, value: l }) => {
|
|
191
191
|
var s;
|
|
@@ -250,7 +250,7 @@ const P = (e, l) => {
|
|
|
250
250
|
value: 300
|
|
251
251
|
},
|
|
252
252
|
effect: {
|
|
253
|
-
category: { id: "swiper-effect", label: "Effects", icon:
|
|
253
|
+
category: { id: "swiper-effect", label: "Effects", icon: p.effect },
|
|
254
254
|
type: "select",
|
|
255
255
|
label: "Effect Type",
|
|
256
256
|
value: "slide",
|
|
@@ -471,7 +471,7 @@ const P = (e, l) => {
|
|
|
471
471
|
}
|
|
472
472
|
},
|
|
473
473
|
autoplay: {
|
|
474
|
-
category: { id: "swiper-autoplay", label: "Autoplay", icon:
|
|
474
|
+
category: { id: "swiper-autoplay", label: "Autoplay", icon: p.autoplay },
|
|
475
475
|
type: "checkbox",
|
|
476
476
|
label: "Enable Autoplay",
|
|
477
477
|
value: !1,
|
|
@@ -523,7 +523,7 @@ const P = (e, l) => {
|
|
|
523
523
|
}
|
|
524
524
|
},
|
|
525
525
|
pagination: {
|
|
526
|
-
category: { id: "swiper-pagination", label: "Pagination", icon:
|
|
526
|
+
category: { id: "swiper-pagination", label: "Pagination", icon: p.pagination },
|
|
527
527
|
type: "select",
|
|
528
528
|
label: "Pagination Type",
|
|
529
529
|
options: [
|
|
@@ -566,7 +566,7 @@ const P = (e, l) => {
|
|
|
566
566
|
}
|
|
567
567
|
},
|
|
568
568
|
scrollbar: {
|
|
569
|
-
category: { id: "swiper-scrollbar", label: "Scrollbar", icon:
|
|
569
|
+
category: { id: "swiper-scrollbar", label: "Scrollbar", icon: p.scrollbar },
|
|
570
570
|
type: "checkbox",
|
|
571
571
|
label: "Enable Scrollbar",
|
|
572
572
|
getValue: ({ component: e }) => !!e.findFirstType(N),
|
|
@@ -596,7 +596,7 @@ const P = (e, l) => {
|
|
|
596
596
|
}
|
|
597
597
|
},
|
|
598
598
|
parallax: {
|
|
599
|
-
category: { id: "swiper-parallax", label: "Parallax", icon:
|
|
599
|
+
category: { id: "swiper-parallax", label: "Parallax", icon: p.parallax },
|
|
600
600
|
type: "checkbox",
|
|
601
601
|
label: "Enable Parallax",
|
|
602
602
|
value: !1
|
|
@@ -702,7 +702,7 @@ const P = (e, l) => {
|
|
|
702
702
|
value: !1
|
|
703
703
|
}
|
|
704
704
|
}, Z = "Slider", q = "swiper", C = `${q}-`, me = (e, l) => {
|
|
705
|
-
const { Components: a, Blocks: s, Commands: i } = e, { block:
|
|
705
|
+
const { Components: a, Blocks: s, Commands: i } = e, { block: b } = l, c = be(ve), f = "core:preview", d = i.events, u = function(t) {
|
|
706
706
|
const n = this, A = window, S = n.__onLoad, R = n.__activeSlide, $ = n.__inPreview, { cdnScript: D, cdnStyle: I, slidesPerView: F } = t || {}, r = (v) => isNaN(v) ? void 0 : parseFloat(v), z = () => {
|
|
707
707
|
const v = {
|
|
708
708
|
loop: t.loop,
|
|
@@ -816,9 +816,9 @@ const P = (e, l) => {
|
|
|
816
816
|
components: { type: "text", components: { type: "textnode", content: `Slide ${t}` } }
|
|
817
817
|
}), h = a.getType("default").model;
|
|
818
818
|
return a.addType(m, {
|
|
819
|
-
block:
|
|
819
|
+
block: b && {
|
|
820
820
|
label: Z,
|
|
821
|
-
media:
|
|
821
|
+
media: p.slider,
|
|
822
822
|
category: "Extra",
|
|
823
823
|
select: !0,
|
|
824
824
|
...l.block
|
|
@@ -827,7 +827,7 @@ const P = (e, l) => {
|
|
|
827
827
|
model: {
|
|
828
828
|
defaults: () => ({
|
|
829
829
|
name: Z,
|
|
830
|
-
icon:
|
|
830
|
+
icon: p.slider,
|
|
831
831
|
classes: q,
|
|
832
832
|
draggable: (t, n) => !n.is(m),
|
|
833
833
|
components: [
|
|
@@ -837,7 +837,7 @@ const P = (e, l) => {
|
|
|
837
837
|
},
|
|
838
838
|
{ type: k }
|
|
839
839
|
],
|
|
840
|
-
script:
|
|
840
|
+
script: u,
|
|
841
841
|
cdnScript: l.cdnScript,
|
|
842
842
|
cdnStyle: l.cdnStyle,
|
|
843
843
|
"script-props": ["cdnScript", "cdnStyle", ...c.propKeys],
|
|
@@ -846,7 +846,7 @@ const P = (e, l) => {
|
|
|
846
846
|
}),
|
|
847
847
|
init() {
|
|
848
848
|
const { em: t } = this;
|
|
849
|
-
fe(this, c.traits), he(this, c.propKeys), this.listenTo(t, `${
|
|
849
|
+
fe(this, c.traits), he(this, c.propKeys), this.listenTo(t, `${d.runCommand}${f}`, this.onPreviewOn), this.listenTo(t, `${d.stopCommand}${f}`, this.onPreviewOff);
|
|
850
850
|
},
|
|
851
851
|
onPreviewOn() {
|
|
852
852
|
this.__inPreview = !0, this.reloadSlider();
|
|
@@ -876,8 +876,7 @@ const P = (e, l) => {
|
|
|
876
876
|
},
|
|
877
877
|
view: {
|
|
878
878
|
init() {
|
|
879
|
-
|
|
880
|
-
t && this.listenTo(this.model, t, this.destroySwiper);
|
|
879
|
+
this.listenTo(this.model, a.events.scriptUnmount, this.destroySwiper);
|
|
881
880
|
},
|
|
882
881
|
getSwiper() {
|
|
883
882
|
return this.el.swiper;
|
|
@@ -1008,7 +1007,7 @@ const P = (e, l) => {
|
|
|
1008
1007
|
defaults: {
|
|
1009
1008
|
name: Te,
|
|
1010
1009
|
classes: X,
|
|
1011
|
-
icon:
|
|
1010
|
+
icon: p.slider,
|
|
1012
1011
|
draggable: (a, s) => s.is(x)
|
|
1013
1012
|
}
|
|
1014
1013
|
// TODO VIEW slide to this slide when selected
|
|
@@ -1023,7 +1022,7 @@ const P = (e, l) => {
|
|
|
1023
1022
|
model: {
|
|
1024
1023
|
defaults: {
|
|
1025
1024
|
name: Le,
|
|
1026
|
-
icon:
|
|
1025
|
+
icon: p.slider,
|
|
1027
1026
|
classes: J,
|
|
1028
1027
|
copyable: !1,
|
|
1029
1028
|
removable: !1,
|
|
@@ -1038,13 +1037,11 @@ const P = (e, l) => {
|
|
|
1038
1037
|
updateSlider(s) {
|
|
1039
1038
|
const i = this.closestType(m);
|
|
1040
1039
|
if (i) {
|
|
1041
|
-
const
|
|
1042
|
-
i.reloadSlider()
|
|
1043
|
-
const c = a.scriptMount;
|
|
1044
|
-
c && this.em.once(c, () => {
|
|
1040
|
+
const b = i.getView();
|
|
1041
|
+
i.reloadSlider(), this.em.once(a.scriptMount, () => {
|
|
1045
1042
|
setTimeout(() => {
|
|
1046
|
-
var
|
|
1047
|
-
return (
|
|
1043
|
+
var c;
|
|
1044
|
+
return (c = b.getSwiper()) == null ? void 0 : c.slideTo(s.index());
|
|
1048
1045
|
}, 100);
|
|
1049
1046
|
});
|
|
1050
1047
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(E,T){typeof exports=="object"&&typeof module<"u"?module.exports=T(require("grapesjs")):typeof define=="function"&&define.amd?define(["grapesjs"],T):(E=typeof globalThis<"u"?globalThis:E||self,E.StudioSdkPlugins_swiperComponent=T())})(this,function(){"use strict";const E="app.grapesjs.com",T="app-stage.grapesjs.com",G=[E,T,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],te="license:check:start",ae="license:check:end",le=()=>typeof window<"u",ne=({isDev:e,isStage:l})=>`${e?"":`https://${l?T:E}`}/api`,se=()=>{const e=le()&&window.location.hostname;return!!e&&(G.includes(e)||G.some(l=>e.endsWith(l)))},ie=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(l,a)=>(a?"-":"")+l.toLowerCase()),oe=e=>typeof e<"u";var x=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(x||{});async function re({path:e,baseApiUrl:l,method:a="GET",headers:n={},params:i,body:
|
|
1
|
+
(function(E,T){typeof exports=="object"&&typeof module<"u"?module.exports=T(require("grapesjs")):typeof define=="function"&&define.amd?define(["grapesjs"],T):(E=typeof globalThis<"u"?globalThis:E||self,E.StudioSdkPlugins_swiperComponent=T())})(this,function(){"use strict";const E="app.grapesjs.com",T="app-stage.grapesjs.com",G=[E,T,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],te="license:check:start",ae="license:check:end",le=()=>typeof window<"u",ne=({isDev:e,isStage:l})=>`${e?"":`https://${l?T:E}`}/api`,se=()=>{const e=le()&&window.location.hostname;return!!e&&(G.includes(e)||G.some(l=>e.endsWith(l)))},ie=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(l,a)=>(a?"-":"")+l.toLowerCase()),oe=e=>typeof e<"u";var x=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(x||{});async function re({path:e,baseApiUrl:l,method:a="GET",headers:n={},params:i,body:b}){const f=`${l||ne({isDev:!1,isStage:!1})}${e}`,p={method:a,headers:{"Content-Type":"application/json",...n}};b&&(p.body=JSON.stringify(b));const u=i?new URLSearchParams(i).toString():"",o=u?`?${u}`:"",h=await fetch(`${f}${o}`,p);if(!h.ok)throw new Error(`HTTP error! status: ${h.status}`);return h.json()}const j={[x.free]:0,[x.startup]:10,[x.business]:20,[x.enterprise]:30};function ce(e){const l=e;return l.init=a=>n=>e(n,a),l}const de=e=>ce(e);async function pe({editor:e,plan:l,pluginName:a,licenseKey:n,cleanup:i}){let b="",c=!1;const f=se(),p=o=>{console.warn("Cleanup plugin:",a,"Reason:",o),i()},u=(o={})=>{var w;const{error:h,sdkLicense:t}=o,s=(w=o.plan)==null?void 0:w.category;if(!(t||o.license)||h)p(h||"Invalid license");else if(s){const D=j[l],F=j[s];D>F&&p({pluginRequiredPlan:l,licensePlan:s})}};e.on(te,o=>{b=o==null?void 0:o.baseApiUrl,c=!0}),e.on(ae,o=>{u(o)}),setTimeout(async()=>{if(!c){if(f)return;if(n){const o=await ue({licenseKey:n,pluginName:a,baseApiUrl:b});o&&u(o)}else p("The `licenseKey` option not provided")}},2e3)}async function ue(e){const{licenseKey:l,pluginName:a,baseApiUrl:n}=e;try{return(await re({baseApiUrl:n,path:`/sdk/${l||"na"}`,method:"POST",params:{d:window.location.hostname,pn:a}})).result||{}}catch(i){return console.error("Error during SDK license check:",i),!1}}const S=(e,l)=>{var a;return!!((a=e==null?void 0:e.classList)!=null&&a.contains(l))},be=(e,l={})=>{var b;const a={},n=[],i=[];for(const c in e){const{value:f,...p}=e[c];n.push({id:c,name:c,changeProp:!0,category:l.category,...p}),a[c]=f,!oe(f)&&i.push(c);const{subTraits:u={}}=p;for(const o in p.subTraits)(b=u[o])==null||b.forEach(h=>{const t=h.id||h.name;a[t]=h.value})}return{propKeys:Object.keys(a),propsNoValues:i,props:a,traits:n}},fe=(e,l)=>{l.forEach(a=>{if(a.subTraits){const n=`${a.id||a.name}`,i=a.changeProp?`change:${n}`:`change:attributes:${n}`;e.on(i,()=>U(e,n)),U(e,n)}})},U=(e,l)=>{const a=e.getTrait(l),n=a.get("category"),i=a.get("subTraits")||{},c=(Object.values(i).flat()||[]).map(u=>u.id||u.name);e.removeTrait(c);const f=i[a.getValue()],p=e.getTraitIndex(l)+1;f&&e.addTrait(f.map(u=>({category:n,...u})),{at:p})},he=(e,l)=>{l.forEach(a=>{const n=ie(a);n!==a&&e.has(n)&&e.set({[a]:e.get(n),[n]:void 0})})},v="swiper",N=`${v}-slide`,L=`${v}-wrapper`,k=`${v}-nav-prev`,B=`${v}-nav-next`,C=`${v}-pagination`,M=`${v}-scrollbar`,d={slider:`<svg viewBox="0 0 24 24">
|
|
2
2
|
<path d="M22 7.6c0-1-.5-1.6-1.3-1.6H3.4C2.5 6 2 6.7 2 7.6v9.8c0 1 .5 1.6 1.3 1.6h17.4c.8 0 1.3-.6 1.3-1.6V7.6zM21 18H3V7h18v11z" fill-rule="nonzero"/>
|
|
3
3
|
<path d="M4 12.5L6 14v-3zM20 12.5L18 14v-3z"/>
|
|
4
4
|
</svg>`,effect:`<svg viewBox="0 0 24 24">
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
<path d="M2 12c0 5 4 9 9 9 2.4 0 4.7-1 6.4-2.6l-1.5-1.5A6.7 6.7 0 0 1 11 19a7 7 0 1 1 7-7h-3l4 4h.1l3.9-4h-3a9 9 0 0 0-18 0Z"/>
|
|
22
22
|
</svg>`,prev:'<svg viewBox="0 0 24 24"><path d="M15.4 16.6 10.8 12l4.6-4.6L14 6l-6 6 6 6 1.4-1.4Z"/></svg>',next:'<svg viewBox="0 0 24 24"><path d="m8.6 16.6 4.6-4.6-4.6-4.6L10 6l6 6-6 6-1.4-1.4Z"/></svg>',add:`<svg viewBox="0 0 24 24">
|
|
23
23
|
<path d="M12 20a8 8 0 1 1 0-16 8 8 0 0 1 0 16m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m1 5h-2v4H7v2h4v4h2v-4h4v-2h-4V7Z"/>
|
|
24
|
-
</svg>`},K={id:"swiper-responsive",label:"Responsive",icon:d.responsive},Z={id:"swiper-extra",label:"Extra",icon:d.extra},ve={actions:{type:"radio",label:!1,labelToTitle:!0,options:[{id:"r",label:"Reload slider",icon:d.reload},{id:"p",label:"Previous slide",icon:d.prev},{id:"n",label:"Next slide",icon:d.next},{id:"a",label:"Add new slide",icon:d.add}],setValue:({component:e,value:l})=>{var n;const a=(n=e.getView())==null?void 0:n.getSwiper();switch(l){case"r":e.reloadSlider();break;case"p":a==null||a.slidePrev();break;case"n":a==null||a.slideNext();break;case"a":e.addSlide();break}}},vertical:{type:"checkbox",label:"Vertical",value:!1},loop:{type:"checkbox",label:"Loop",value:!1},freeMode:{type:"checkbox",label:"Free mode",value:!1},autoHeight:{type:"checkbox",label:"Auto height",value:!1},navigation:{type:"checkbox",label:"Navigation",getValue:({component:e})=>!!e.findFirstType(k),setValue:({component:e,value:l})=>{var a,n;l?e.append([{type:k},{type:B}]):((a=e.findFirstType(k))==null||a.remove(),(n=e.findFirstType(B))==null||n.remove()),e.set({navigation:l})}},initialSlide:{type:"number",label:"Initial slide",min:0,value:"0"},speed:{type:"number",label:"Speed",tip:"Transition duration (in ms)",step:500,min:0,value:300},effect:{category:{id:"swiper-effect",label:"Effects",icon:d.effect},type:"select",label:"Effect Type",value:"slide",options:[{id:"slide",label:"Slide"},{id:"fade",label:"Fade"},{id:"cube",label:"Cube"},{id:"coverflow",label:"Coverflow"},{id:"flip",label:"Flip"},{id:"cards",label:"Cards"}],subTraits:{slide:[{type:"number",name:"slidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"slidesPerGroup",label:"Slides per group",tip:"Numbers of slides for group sliding",changeProp:!0,min:1,value:1},{type:"number",name:"spaceBetween",label:"Space between",tip:"Distance between slides in px",changeProp:!0,min:0,value:0},{type:"number",name:"slidesOffsetBefore",label:"Slides offset before",tip:"Add additional slide offset in the beginning of the container (in px, before all slides)",changeProp:!0,min:0,value:0},{type:"number",name:"slidesOffsetAfter",label:"Slides offset after",tip:"Add additional slide offset in the end of the container (in px, after all slides)",changeProp:!0,min:0,value:0},{type:"checkbox",name:"centeredSlides",label:"Centered slides",tip:"If enabled, the active slide will be centered",changeProp:!0,value:!1}],fade:[{type:"checkbox",name:"crossFade",tip:"Enables slides cross fade",label:"Cross fade",changeProp:!0,value:!1}],cube:[{type:"checkbox",name:"cubeEffectShadow",label:"Shadow",changeProp:!0,value:!0},{type:"checkbox",name:"cubeEffectSlideShadows",label:"Slide shadows",changeProp:!0,value:!0},{type:"number",name:"cubeEffectShadowOffset",label:"Shadow offset",changeProp:!0,value:20},{type:"number",name:"cubeEffectShadowScale",label:"Shadow scale",changeProp:!0,value:.94}],coverflow:[{type:"number",name:"coverflowEffectDepth",tip:"Depth offset in px (slides translate in Z axis)",label:"Depth",changeProp:!0,min:0,value:100},{type:"number",name:"coverflowEffectModifier",tip:"Effect multiplier",label:"Modifier",changeProp:!0,step:.1,min:0,value:1},{type:"number",name:"coverflowEffectRotate",tip:"Slide rotate in degrees",label:"Rotate",changeProp:!0,min:0,value:50},{type:"number",name:"coverflowEffectScale",tip:"Slide scale effect",label:"Scale",changeProp:!0,min:0,step:.1,value:1},{type:"number",name:"coverflowEffectStretch",tip:"Stretch space between slides (in px)",label:"Stretch",changeProp:!0,min:0,value:0},{type:"checkbox",name:"coverflowEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadow",changeProp:!0,value:!0}],flip:[{type:"checkbox",name:"flipEffectLimitRotation",tip:"Limit edge slides rotation",label:"Limit rotation",changeProp:!0,value:!0},{type:"checkbox",name:"flipEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadows",changeProp:!0,value:!0}],cards:[{type:"number",name:"cardsEffectPerSlideOffset",tip:"Offset distance per slide (in px)",label:"Slide offset",changeProp:!0,min:0,value:8},{type:"number",name:"cardsEffectPerSlideRotate",tip:"Rotate angle per slide (in degrees)",label:"Slide rotate",changeProp:!0,min:0,value:2},{type:"checkbox",name:"cardsEffectRotate",tip:"Enables cards rotation",label:"Rotate",changeProp:!0,value:!0},{type:"checkbox",name:"cardsEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadows",changeProp:!0,value:!0}]}},autoplay:{category:{id:"swiper-autoplay",label:"Autoplay",icon:d.autoplay},type:"checkbox",label:"Enable Autoplay",value:!1,subTraits:{true:[{type:"number",name:"autoplayDelay",label:"Delay",changeProp:!0,value:3e3},{type:"checkbox",name:"autoplayDisableOnInteraction",label:"Disable on interaction",changeProp:!0,value:!0},{type:"checkbox",name:"autoplayWaitForTransition",label:"Wait for transition",changeProp:!0,value:!0},{type:"checkbox",name:"autoplayPauseOnMouseEnter",label:"Pause on mouse enter",changeProp:!0,value:!1},{type:"checkbox",name:"autoplayReverseDirection",label:"Reverse direction",changeProp:!0,value:!1},{type:"checkbox",name:"autoplayStopOnLastSlide",label:"Stop on last slide",changeProp:!0,value:!1}]}},pagination:{category:{id:"swiper-pagination",label:"Pagination",icon:d.pagination},type:"select",label:"Pagination Type",options:[{id:"none",label:"None"},{id:"bullets",label:"Bullets"},{id:"progressbar",label:"Progressbar"},{id:"fraction",label:"Fraction"}],getValue:({component:e})=>e.findFirstType(C)?e.get("pagination")||"bullets":"none",setValue:({component:e,value:l})=>{const a=e.findFirstType(C);a==null||a.remove(),l!=="none"&&e.append({type:C}),e.set({pagination:l})},subTraits:{bullets:[{type:"checkbox",name:"dynamicBullets",label:"Dynamic bullets",changeProp:!0,value:!1},{type:"checkbox",name:"clickableBullets",label:"Clickable bullets",changeProp:!0,value:!0}],progressbar:[{type:"checkbox",name:"progressbarOpposite",label:"Progress opposite",changeProp:!0,value:!1}]}},scrollbar:{category:{id:"swiper-scrollbar",label:"Scrollbar",icon:d.scrollbar},type:"checkbox",label:"Enable Scrollbar",getValue:({component:e})=>!!e.findFirstType(M),setValue:({component:e,value:l})=>{const a=e.findFirstType(M);a==null||a.remove(),l&&e.append({type:M}),e.set({scrollbar:l})},subTraits:{false:[],true:[{type:"checkbox",name:"scrollbarDraggable",label:"Draggable",changeProp:!0,value:!1},{type:"checkbox",name:"scrollbarHide",label:"Hide",tip:"Hide scrollbar automatically after user interaction",changeProp:!0,value:!0}]}},parallax:{category:{id:"swiper-parallax",label:"Parallax",icon:d.parallax},type:"checkbox",label:"Enable Parallax",value:!1},mobile:{category:K,type:"checkbox",label:"Enable mobile breakpoint",value:!1,subTraits:{true:[{type:"number",name:"mobileBreakpoint",label:"Mobile breakpoint",tip:"Slide values below will be applied when the screen width is greater than this value",changeProp:!0,min:1,value:460},{type:"number",name:"mobileSlidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"mobileSlidesPerGroup",label:"Slides per group",changeProp:!0,min:1,value:1},{type:"number",name:"mobileSpaceBetween",label:"Space between",changeProp:!0,min:0,value:0}]}},tablet:{category:K,type:"checkbox",label:"Enable tablet breakpoint",value:!1,subTraits:{true:[{type:"number",name:"tabletBreakpoint",label:"Tablet breakpoint",tip:"Slide values below will be applied when the screen width is greater than this value",changeProp:!0,min:1,value:991},{type:"number",name:"tabletSlidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"tabletSlidesPerGroup",label:"Slides per group",changeProp:!0,min:1,value:1},{type:"number",name:"tabletSpaceBetween",label:"Space between",changeProp:!0,min:0,value:0}]}},allowTouchMove:{category:Z,type:"checkbox",label:"Allow touch move",tip:"Allow touch interactions",value:!0},grabCursor:{category:Z,type:"checkbox",label:"Grab cursor",tip:'If enabled, the user will see the "grab" cursor when hover the slider',value:!1}},Y="Slider",I="swiper",A=`${I}-`,me=(e,l)=>{const{Components:a,Blocks:n,Commands:i}=e,{block:f}=l,c=be(ve),p="core:preview",u=i.events,b=function(t){const s=this,R=window,w=s.__onLoad,D=s.__activeSlide,F=s.__inPreview,{cdnScript:W,cdnStyle:q,slidesPerView:z}=t||{},r=m=>isNaN(m)?void 0:parseFloat(m),ee=()=>{const m={loop:t.loop,speed:t.speed,initialSlide:t.initialSlide,direction:t.vertical?"vertical":"horizontal",effect:t.effect,freeMode:t.freeMode,parallax:t.parallax,autoHeight:t.autoHeight,allowTouchMove:t.allowTouchMove,grabCursor:t.grabCursor,simulateTouch:!0,breakpoints:{},slidesPerView:isNaN(z)?z:r(z),slidesPerGroup:r(t.slidesPerGroup),spaceBetween:r(t.spaceBetween),slidesOffsetBefore:r(t.slidesOffsetBefore),slidesOffsetAfter:r(t.slidesOffsetAfter),centeredSlides:t.centeredSlides,fadeEffect:{crossFade:t.crossFade},cubeEffect:{shadow:t.cubeEffectShadow,slideShadows:t.cubeEffectSlideShadows,shadowOffset:r(t.cubeEffectShadowOffset),shadowScale:r(t.cubeEffectShadowScale)},coverflowEffect:{depth:r(t.coverflowEffectDepth),modifier:r(t.coverflowEffectModifier),rotate:r(t.coverflowEffectRotate),scale:r(t.coverflowEffectScale),stretch:r(t.coverflowEffectStretch),slideShadows:t.coverflowEffectSlideShadows},flipEffect:{limitRotation:t.flipEffectLimitRotation,slideShadows:t.flipEffectSlideShadows},cardsEffect:{perSlideOffset:r(t.cardsEffectPerSlideOffset),perSlideRotate:r(t.cardsEffectPerSlideRotate),rotate:t.cardsEffectRotate,slideShadows:t.cardsEffectSlideShadows},navigation:{nextEl:s.querySelector(".swiper-button-next"),prevEl:s.querySelector(".swiper-button-prev")},pagination:{type:t.pagination||"bullets",dynamicBullets:t.dynamicBullets,clickable:t.clickableBullets,progressbarOpposite:t.progressbarOpposite,el:s.querySelector(".swiper-pagination")},scrollbar:{el:s.querySelector(".swiper-scrollbar"),draggable:t.scrollbarDraggable,hide:t.scrollbarHide},autoplay:t.autoplay&&{delay:t.autoplayDelay,disableOnInteraction:t.autoplayDisableOnInteraction,pauseOnMouseEnter:t.autoplayPauseOnMouseEnter,reverseDirection:t.autoplayReverseDirection,stopOnLastSlide:t.autoplayStopOnLastSlide,waitForTransition:t.autoplayWaitForTransition}};if(t.tablet){const{tabletBreakpoint:O,tabletSlidesPerView:g}=t,_=r(O);m.breakpoints[_]={slidesPerView:isNaN(g)?g:r(g),slidesPerGroup:r(t.tabletSlidesPerGroup),spaceBetween:r(t.tabletSpaceBetween)}}if(t.mobile){const{mobileBreakpoint:O,mobileSlidesPerView:g}=t,_=r(O);m.breakpoints[_]={slidesPerView:isNaN(g)?g:r(g),slidesPerGroup:r(t.mobileSlidesPerGroup),spaceBetween:r(t.mobileSpaceBetween)}}w&&!F&&(m.simulateTouch=!1),D&&(m.initialSlide=D);const H=new R.Swiper(s,m);w==null||w(H)};if(R.Swiper)ee();else{const{head:m}=document,H=Array.isArray(W)?[...W]:[W],O=Array.isArray(q)?[...q]:[q],g=P=>{if(P.length){const y=document.createElement("link");y.href=P.shift(),y.rel="stylesheet",m.appendChild(y),g(P)}},_=P=>{if(P.length){const y=document.createElement("script");y.src=P.shift(),y.onerror=y.onload=_.bind(null,P),m.appendChild(y)}else ee()};g(O),_(H)}},o=(t=0)=>({type:N,style:{padding:"50px"},components:{type:"text",components:{type:"textnode",content:`Slide ${t}`}}}),h=a.getType("default").model;return a.addType(v,{block:f&&{label:Y,media:d.slider,category:"Extra",select:!0,...l.block},isComponent:t=>S(t,I),model:{defaults:()=>({name:Y,icon:d.slider,classes:I,draggable:(t,s)=>!s.is(v),components:[{type:L,components:[o(1),o(2),o(3)]},{type:C}],script:b,cdnScript:l.cdnScript,cdnStyle:l.cdnStyle,"script-props":["cdnScript","cdnStyle",...c.propKeys],...c.props,traits:[...c.traits]}),init(){const{em:t}=this;fe(this,c.traits),he(this,c.propKeys),this.listenTo(t,`${u.runCommand}${p}`,this.onPreviewOn),this.listenTo(t,`${u.stopCommand}${p}`,this.onPreviewOff)},onPreviewOn(){this.__inPreview=!0,this.reloadSlider()},onPreviewOff(){this.__inPreview=!1,this.reloadSlider()},reloadSlider(){this.trigger("rerender")},addSlide(){const t=this.findFirstType(L);t==null||t.append(this.getNewSlideComponentDef())},getNewSlideComponentDef(){var s;const t=((s=this.findFirstType(L))==null?void 0:s.components().length)||0;return{type:N,components:{type:"text",components:{type:"textnode",content:`Slide ${t+1}`}}}},toJSON(...t){const s=h.prototype.toJSON.apply(this,t);return c.propsNoValues.forEach(R=>delete s[R]),delete s["script-props"],s}},view:{init(){const t=a.events.scriptUnmount;t&&this.listenTo(this.model,t,this.destroySwiper)},getSwiper(){return this.el.swiper},destroySwiper(){var t;(t=this.getSwiper())==null||t.destroy()},onRender(){const t=this.el;t.__onLoad=s=>s.on("slideChange",()=>this.__activeSlide=s.activeIndex),t.__activeSlide=this.__activeSlide,t.__inPreview=this.model.__inPreview}}}),()=>{a.removeType(v),n.remove(v)}},ge="Nav Prev",ye="Nav Next",V=`${A}button-prev`,$=`${A}button-next`,Se=e=>{const{Components:l}=e,a=n=>({type:"svg",selectable:!1,hoverable:!1,attributes:{viewBox:"0 0 27 44"},components:{type:"svg-in",tagName:"path",attributes:{d:n,fill:"currentColor"}}});return l.addType(k,{isComponent:n=>S(n,V),model:{defaults:{name:ge,classes:V,copyable:!1,highlightable:!1,droppable:!1,draggable:!1,selectable:!1,hoverable:!1,layerable:!1,components:a("M0,22L22,0l2.1,2.1L4.2,22l19.9,19.9L22,44L0,22L0,22L0,22z"),styles:`
|
|
24
|
+
</svg>`},K={id:"swiper-responsive",label:"Responsive",icon:d.responsive},Z={id:"swiper-extra",label:"Extra",icon:d.extra},ve={actions:{type:"radio",label:!1,labelToTitle:!0,options:[{id:"r",label:"Reload slider",icon:d.reload},{id:"p",label:"Previous slide",icon:d.prev},{id:"n",label:"Next slide",icon:d.next},{id:"a",label:"Add new slide",icon:d.add}],setValue:({component:e,value:l})=>{var n;const a=(n=e.getView())==null?void 0:n.getSwiper();switch(l){case"r":e.reloadSlider();break;case"p":a==null||a.slidePrev();break;case"n":a==null||a.slideNext();break;case"a":e.addSlide();break}}},vertical:{type:"checkbox",label:"Vertical",value:!1},loop:{type:"checkbox",label:"Loop",value:!1},freeMode:{type:"checkbox",label:"Free mode",value:!1},autoHeight:{type:"checkbox",label:"Auto height",value:!1},navigation:{type:"checkbox",label:"Navigation",getValue:({component:e})=>!!e.findFirstType(k),setValue:({component:e,value:l})=>{var a,n;l?e.append([{type:k},{type:B}]):((a=e.findFirstType(k))==null||a.remove(),(n=e.findFirstType(B))==null||n.remove()),e.set({navigation:l})}},initialSlide:{type:"number",label:"Initial slide",min:0,value:"0"},speed:{type:"number",label:"Speed",tip:"Transition duration (in ms)",step:500,min:0,value:300},effect:{category:{id:"swiper-effect",label:"Effects",icon:d.effect},type:"select",label:"Effect Type",value:"slide",options:[{id:"slide",label:"Slide"},{id:"fade",label:"Fade"},{id:"cube",label:"Cube"},{id:"coverflow",label:"Coverflow"},{id:"flip",label:"Flip"},{id:"cards",label:"Cards"}],subTraits:{slide:[{type:"number",name:"slidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"slidesPerGroup",label:"Slides per group",tip:"Numbers of slides for group sliding",changeProp:!0,min:1,value:1},{type:"number",name:"spaceBetween",label:"Space between",tip:"Distance between slides in px",changeProp:!0,min:0,value:0},{type:"number",name:"slidesOffsetBefore",label:"Slides offset before",tip:"Add additional slide offset in the beginning of the container (in px, before all slides)",changeProp:!0,min:0,value:0},{type:"number",name:"slidesOffsetAfter",label:"Slides offset after",tip:"Add additional slide offset in the end of the container (in px, after all slides)",changeProp:!0,min:0,value:0},{type:"checkbox",name:"centeredSlides",label:"Centered slides",tip:"If enabled, the active slide will be centered",changeProp:!0,value:!1}],fade:[{type:"checkbox",name:"crossFade",tip:"Enables slides cross fade",label:"Cross fade",changeProp:!0,value:!1}],cube:[{type:"checkbox",name:"cubeEffectShadow",label:"Shadow",changeProp:!0,value:!0},{type:"checkbox",name:"cubeEffectSlideShadows",label:"Slide shadows",changeProp:!0,value:!0},{type:"number",name:"cubeEffectShadowOffset",label:"Shadow offset",changeProp:!0,value:20},{type:"number",name:"cubeEffectShadowScale",label:"Shadow scale",changeProp:!0,value:.94}],coverflow:[{type:"number",name:"coverflowEffectDepth",tip:"Depth offset in px (slides translate in Z axis)",label:"Depth",changeProp:!0,min:0,value:100},{type:"number",name:"coverflowEffectModifier",tip:"Effect multiplier",label:"Modifier",changeProp:!0,step:.1,min:0,value:1},{type:"number",name:"coverflowEffectRotate",tip:"Slide rotate in degrees",label:"Rotate",changeProp:!0,min:0,value:50},{type:"number",name:"coverflowEffectScale",tip:"Slide scale effect",label:"Scale",changeProp:!0,min:0,step:.1,value:1},{type:"number",name:"coverflowEffectStretch",tip:"Stretch space between slides (in px)",label:"Stretch",changeProp:!0,min:0,value:0},{type:"checkbox",name:"coverflowEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadow",changeProp:!0,value:!0}],flip:[{type:"checkbox",name:"flipEffectLimitRotation",tip:"Limit edge slides rotation",label:"Limit rotation",changeProp:!0,value:!0},{type:"checkbox",name:"flipEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadows",changeProp:!0,value:!0}],cards:[{type:"number",name:"cardsEffectPerSlideOffset",tip:"Offset distance per slide (in px)",label:"Slide offset",changeProp:!0,min:0,value:8},{type:"number",name:"cardsEffectPerSlideRotate",tip:"Rotate angle per slide (in degrees)",label:"Slide rotate",changeProp:!0,min:0,value:2},{type:"checkbox",name:"cardsEffectRotate",tip:"Enables cards rotation",label:"Rotate",changeProp:!0,value:!0},{type:"checkbox",name:"cardsEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadows",changeProp:!0,value:!0}]}},autoplay:{category:{id:"swiper-autoplay",label:"Autoplay",icon:d.autoplay},type:"checkbox",label:"Enable Autoplay",value:!1,subTraits:{true:[{type:"number",name:"autoplayDelay",label:"Delay",changeProp:!0,value:3e3},{type:"checkbox",name:"autoplayDisableOnInteraction",label:"Disable on interaction",changeProp:!0,value:!0},{type:"checkbox",name:"autoplayWaitForTransition",label:"Wait for transition",changeProp:!0,value:!0},{type:"checkbox",name:"autoplayPauseOnMouseEnter",label:"Pause on mouse enter",changeProp:!0,value:!1},{type:"checkbox",name:"autoplayReverseDirection",label:"Reverse direction",changeProp:!0,value:!1},{type:"checkbox",name:"autoplayStopOnLastSlide",label:"Stop on last slide",changeProp:!0,value:!1}]}},pagination:{category:{id:"swiper-pagination",label:"Pagination",icon:d.pagination},type:"select",label:"Pagination Type",options:[{id:"none",label:"None"},{id:"bullets",label:"Bullets"},{id:"progressbar",label:"Progressbar"},{id:"fraction",label:"Fraction"}],getValue:({component:e})=>e.findFirstType(C)?e.get("pagination")||"bullets":"none",setValue:({component:e,value:l})=>{const a=e.findFirstType(C);a==null||a.remove(),l!=="none"&&e.append({type:C}),e.set({pagination:l})},subTraits:{bullets:[{type:"checkbox",name:"dynamicBullets",label:"Dynamic bullets",changeProp:!0,value:!1},{type:"checkbox",name:"clickableBullets",label:"Clickable bullets",changeProp:!0,value:!0}],progressbar:[{type:"checkbox",name:"progressbarOpposite",label:"Progress opposite",changeProp:!0,value:!1}]}},scrollbar:{category:{id:"swiper-scrollbar",label:"Scrollbar",icon:d.scrollbar},type:"checkbox",label:"Enable Scrollbar",getValue:({component:e})=>!!e.findFirstType(M),setValue:({component:e,value:l})=>{const a=e.findFirstType(M);a==null||a.remove(),l&&e.append({type:M}),e.set({scrollbar:l})},subTraits:{false:[],true:[{type:"checkbox",name:"scrollbarDraggable",label:"Draggable",changeProp:!0,value:!1},{type:"checkbox",name:"scrollbarHide",label:"Hide",tip:"Hide scrollbar automatically after user interaction",changeProp:!0,value:!0}]}},parallax:{category:{id:"swiper-parallax",label:"Parallax",icon:d.parallax},type:"checkbox",label:"Enable Parallax",value:!1},mobile:{category:K,type:"checkbox",label:"Enable mobile breakpoint",value:!1,subTraits:{true:[{type:"number",name:"mobileBreakpoint",label:"Mobile breakpoint",tip:"Slide values below will be applied when the screen width is greater than this value",changeProp:!0,min:1,value:460},{type:"number",name:"mobileSlidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"mobileSlidesPerGroup",label:"Slides per group",changeProp:!0,min:1,value:1},{type:"number",name:"mobileSpaceBetween",label:"Space between",changeProp:!0,min:0,value:0}]}},tablet:{category:K,type:"checkbox",label:"Enable tablet breakpoint",value:!1,subTraits:{true:[{type:"number",name:"tabletBreakpoint",label:"Tablet breakpoint",tip:"Slide values below will be applied when the screen width is greater than this value",changeProp:!0,min:1,value:991},{type:"number",name:"tabletSlidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"tabletSlidesPerGroup",label:"Slides per group",changeProp:!0,min:1,value:1},{type:"number",name:"tabletSpaceBetween",label:"Space between",changeProp:!0,min:0,value:0}]}},allowTouchMove:{category:Z,type:"checkbox",label:"Allow touch move",tip:"Allow touch interactions",value:!0},grabCursor:{category:Z,type:"checkbox",label:"Grab cursor",tip:'If enabled, the user will see the "grab" cursor when hover the slider',value:!1}},Y="Slider",I="swiper",A=`${I}-`,me=(e,l)=>{const{Components:a,Blocks:n,Commands:i}=e,{block:b}=l,c=be(ve),f="core:preview",p=i.events,u=function(t){const s=this,R=window,w=s.__onLoad,D=s.__activeSlide,F=s.__inPreview,{cdnScript:W,cdnStyle:q,slidesPerView:z}=t||{},r=m=>isNaN(m)?void 0:parseFloat(m),ee=()=>{const m={loop:t.loop,speed:t.speed,initialSlide:t.initialSlide,direction:t.vertical?"vertical":"horizontal",effect:t.effect,freeMode:t.freeMode,parallax:t.parallax,autoHeight:t.autoHeight,allowTouchMove:t.allowTouchMove,grabCursor:t.grabCursor,simulateTouch:!0,breakpoints:{},slidesPerView:isNaN(z)?z:r(z),slidesPerGroup:r(t.slidesPerGroup),spaceBetween:r(t.spaceBetween),slidesOffsetBefore:r(t.slidesOffsetBefore),slidesOffsetAfter:r(t.slidesOffsetAfter),centeredSlides:t.centeredSlides,fadeEffect:{crossFade:t.crossFade},cubeEffect:{shadow:t.cubeEffectShadow,slideShadows:t.cubeEffectSlideShadows,shadowOffset:r(t.cubeEffectShadowOffset),shadowScale:r(t.cubeEffectShadowScale)},coverflowEffect:{depth:r(t.coverflowEffectDepth),modifier:r(t.coverflowEffectModifier),rotate:r(t.coverflowEffectRotate),scale:r(t.coverflowEffectScale),stretch:r(t.coverflowEffectStretch),slideShadows:t.coverflowEffectSlideShadows},flipEffect:{limitRotation:t.flipEffectLimitRotation,slideShadows:t.flipEffectSlideShadows},cardsEffect:{perSlideOffset:r(t.cardsEffectPerSlideOffset),perSlideRotate:r(t.cardsEffectPerSlideRotate),rotate:t.cardsEffectRotate,slideShadows:t.cardsEffectSlideShadows},navigation:{nextEl:s.querySelector(".swiper-button-next"),prevEl:s.querySelector(".swiper-button-prev")},pagination:{type:t.pagination||"bullets",dynamicBullets:t.dynamicBullets,clickable:t.clickableBullets,progressbarOpposite:t.progressbarOpposite,el:s.querySelector(".swiper-pagination")},scrollbar:{el:s.querySelector(".swiper-scrollbar"),draggable:t.scrollbarDraggable,hide:t.scrollbarHide},autoplay:t.autoplay&&{delay:t.autoplayDelay,disableOnInteraction:t.autoplayDisableOnInteraction,pauseOnMouseEnter:t.autoplayPauseOnMouseEnter,reverseDirection:t.autoplayReverseDirection,stopOnLastSlide:t.autoplayStopOnLastSlide,waitForTransition:t.autoplayWaitForTransition}};if(t.tablet){const{tabletBreakpoint:O,tabletSlidesPerView:g}=t,_=r(O);m.breakpoints[_]={slidesPerView:isNaN(g)?g:r(g),slidesPerGroup:r(t.tabletSlidesPerGroup),spaceBetween:r(t.tabletSpaceBetween)}}if(t.mobile){const{mobileBreakpoint:O,mobileSlidesPerView:g}=t,_=r(O);m.breakpoints[_]={slidesPerView:isNaN(g)?g:r(g),slidesPerGroup:r(t.mobileSlidesPerGroup),spaceBetween:r(t.mobileSpaceBetween)}}w&&!F&&(m.simulateTouch=!1),D&&(m.initialSlide=D);const H=new R.Swiper(s,m);w==null||w(H)};if(R.Swiper)ee();else{const{head:m}=document,H=Array.isArray(W)?[...W]:[W],O=Array.isArray(q)?[...q]:[q],g=P=>{if(P.length){const y=document.createElement("link");y.href=P.shift(),y.rel="stylesheet",m.appendChild(y),g(P)}},_=P=>{if(P.length){const y=document.createElement("script");y.src=P.shift(),y.onerror=y.onload=_.bind(null,P),m.appendChild(y)}else ee()};g(O),_(H)}},o=(t=0)=>({type:N,style:{padding:"50px"},components:{type:"text",components:{type:"textnode",content:`Slide ${t}`}}}),h=a.getType("default").model;return a.addType(v,{block:b&&{label:Y,media:d.slider,category:"Extra",select:!0,...l.block},isComponent:t=>S(t,I),model:{defaults:()=>({name:Y,icon:d.slider,classes:I,draggable:(t,s)=>!s.is(v),components:[{type:L,components:[o(1),o(2),o(3)]},{type:C}],script:u,cdnScript:l.cdnScript,cdnStyle:l.cdnStyle,"script-props":["cdnScript","cdnStyle",...c.propKeys],...c.props,traits:[...c.traits]}),init(){const{em:t}=this;fe(this,c.traits),he(this,c.propKeys),this.listenTo(t,`${p.runCommand}${f}`,this.onPreviewOn),this.listenTo(t,`${p.stopCommand}${f}`,this.onPreviewOff)},onPreviewOn(){this.__inPreview=!0,this.reloadSlider()},onPreviewOff(){this.__inPreview=!1,this.reloadSlider()},reloadSlider(){this.trigger("rerender")},addSlide(){const t=this.findFirstType(L);t==null||t.append(this.getNewSlideComponentDef())},getNewSlideComponentDef(){var s;const t=((s=this.findFirstType(L))==null?void 0:s.components().length)||0;return{type:N,components:{type:"text",components:{type:"textnode",content:`Slide ${t+1}`}}}},toJSON(...t){const s=h.prototype.toJSON.apply(this,t);return c.propsNoValues.forEach(R=>delete s[R]),delete s["script-props"],s}},view:{init(){this.listenTo(this.model,a.events.scriptUnmount,this.destroySwiper)},getSwiper(){return this.el.swiper},destroySwiper(){var t;(t=this.getSwiper())==null||t.destroy()},onRender(){const t=this.el;t.__onLoad=s=>s.on("slideChange",()=>this.__activeSlide=s.activeIndex),t.__activeSlide=this.__activeSlide,t.__inPreview=this.model.__inPreview}}}),()=>{a.removeType(v),n.remove(v)}},ge="Nav Prev",ye="Nav Next",V=`${A}button-prev`,$=`${A}button-next`,Se=e=>{const{Components:l}=e,a=n=>({type:"svg",selectable:!1,hoverable:!1,attributes:{viewBox:"0 0 27 44"},components:{type:"svg-in",tagName:"path",attributes:{d:n,fill:"currentColor"}}});return l.addType(k,{isComponent:n=>S(n,V),model:{defaults:{name:ge,classes:V,copyable:!1,highlightable:!1,droppable:!1,draggable:!1,selectable:!1,hoverable:!1,layerable:!1,components:a("M0,22L22,0l2.1,2.1L4.2,22l19.9,19.9L22,44L0,22L0,22L0,22z"),styles:`
|
|
25
25
|
.${V} {
|
|
26
26
|
color: inherit;
|
|
27
27
|
}
|
|
@@ -42,4 +42,4 @@
|
|
|
42
42
|
.${a}-progressbar-fill {
|
|
43
43
|
--swiper-pagination-color: currentColor;
|
|
44
44
|
}
|
|
45
|
-
`}}}),()=>{l.removeType(C)}},Pe="Scrollbar",X=`${A}scrollbar`,Ee=e=>{const{Components:l}=e;return l.addType(M,{isComponent:a=>S(a,X),model:{defaults:{name:Pe,classes:X,copyable:!1,highlightable:!1,removable:!1,selectable:!1,hoverable:!1,layerable:!1,droppable:!1,draggable:!1}}}),()=>{l.removeType(M)}},Te="Slide",J=`${A}slide`,xe=e=>{const{Components:l}=e;return l.addType(N,{isComponent:a=>S(a,J),model:{defaults:{name:Te,classes:J,icon:d.slider,draggable:(a,n)=>n.is(L)}}}),()=>{l.removeType(N)}},Le="Wrapper",Q=`${A}wrapper`,ke=e=>{const{Components:l}=e,{events:a}=l;return l.addType(L,{isComponent:n=>S(n,Q),model:{defaults:{name:Le,icon:d.slider,classes:Q,copyable:!1,removable:!1,draggable:!1,highlightable:!1,droppable:n=>n.is(N)},init(){const n=this.components();this.listenTo(n,"add remove",this.updateSlider)},updateSlider(n){const i=this.closestType(v);if(i){const
|
|
45
|
+
`}}}),()=>{l.removeType(C)}},Pe="Scrollbar",X=`${A}scrollbar`,Ee=e=>{const{Components:l}=e;return l.addType(M,{isComponent:a=>S(a,X),model:{defaults:{name:Pe,classes:X,copyable:!1,highlightable:!1,removable:!1,selectable:!1,hoverable:!1,layerable:!1,droppable:!1,draggable:!1}}}),()=>{l.removeType(M)}},Te="Slide",J=`${A}slide`,xe=e=>{const{Components:l}=e;return l.addType(N,{isComponent:a=>S(a,J),model:{defaults:{name:Te,classes:J,icon:d.slider,draggable:(a,n)=>n.is(L)}}}),()=>{l.removeType(N)}},Le="Wrapper",Q=`${A}wrapper`,ke=e=>{const{Components:l}=e,{events:a}=l;return l.addType(L,{isComponent:n=>S(n,Q),model:{defaults:{name:Le,icon:d.slider,classes:Q,copyable:!1,removable:!1,draggable:!1,highlightable:!1,droppable:n=>n.is(N)},init(){const n=this.components();this.listenTo(n,"add remove",this.updateSlider)},updateSlider(n){const i=this.closestType(v);if(i){const b=i.getView();i.reloadSlider(),this.em.once(a.scriptMount,()=>{setTimeout(()=>{var c;return(c=b.getSwiper())==null?void 0:c.slideTo(n.index())},100)})}}}}),()=>{l.removeType(L)}},Ce="swiperComponent";return de(function(e,l={}){const a={block:{},cdnScript:"https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js",cdnStyle:"https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css",...l},n=[me(e,a),Se(e),ke(e),xe(e),we(e),Ee(e)];pe({editor:e,plan:x.startup,licenseKey:a.licenseKey,pluginName:Ce,cleanup:()=>{n.forEach(i=>i())}})})});
|