@grapesjs/studio-sdk-plugins 1.0.33-rc.1 → 1.0.33
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/accordionComponent/index.cjs.js +7 -7
- package/dist/accordionComponent/index.es.js +161 -156
- package/dist/accordionComponent/index.umd.js +9 -9
- package/dist/aiChat/chatManager.d.ts +15 -0
- package/dist/aiChat/clientTools.d.ts +3 -3
- package/dist/aiChat/clientToolsProcessors.d.ts +14 -1
- package/dist/aiChat/components/AiChatEmptyState.d.ts +4 -6
- package/dist/aiChat/components/AiChatError.d.ts +2 -1
- package/dist/aiChat/components/AiChatHeader.d.ts +2 -1
- package/dist/aiChat/components/AiChatInput/AssetsSection.d.ts +7 -0
- package/dist/aiChat/components/AiChatInput/AttachButton.d.ts +10 -0
- package/dist/aiChat/components/AiChatInput/ContextSection.d.ts +5 -0
- package/dist/aiChat/components/AiChatInput/DictateButton.d.ts +7 -0
- package/dist/aiChat/components/AiChatInput/TextAreaWithAutoResize.d.ts +6 -0
- package/dist/aiChat/components/AiChatInput/constants.d.ts +6 -0
- package/dist/aiChat/components/AiChatInput/hooks/useSpeechToText.d.ts +15 -0
- package/dist/aiChat/components/AiChatInput/index.d.ts +37 -0
- package/dist/aiChat/components/AiChatLoadingState.d.ts +2 -1
- package/dist/aiChat/components/AiChatMessage.d.ts +21 -9
- package/dist/aiChat/components/AiChatMessages.d.ts +5 -7
- package/dist/aiChat/components/AiChatMessagesStatus.d.ts +5 -0
- package/dist/aiChat/components/AiChatPanel.d.ts +2 -3
- package/dist/aiChat/components/AiChatProvider.d.ts +14 -0
- package/dist/aiChat/components/MemoizedMarkdown.d.ts +9 -0
- package/dist/aiChat/components/index.d.ts +24 -25
- package/dist/aiChat/components/utils.d.ts +12 -4
- package/dist/aiChat/index.cjs.d.ts +5 -0
- package/dist/aiChat/index.cjs.js +453 -0
- package/dist/aiChat/index.d.ts +4 -3
- package/dist/aiChat/index.es.d.ts +5 -0
- package/dist/aiChat/index.es.js +30930 -0
- package/dist/aiChat/index.js +453 -0
- package/dist/aiChat/index.umd.js +453 -0
- package/dist/aiChat/locales/en.d.ts +64 -0
- package/dist/aiChat/server/index.cjs.d.ts +4 -0
- package/dist/aiChat/server/index.cjs.js +309 -0
- package/dist/aiChat/server/index.d.ts +0 -50
- package/dist/aiChat/server/index.es.d.ts +4 -0
- package/dist/aiChat/server/index.es.js +876 -0
- package/dist/aiChat/server/index.js +309 -0
- package/dist/aiChat/server/index.umd.js +309 -0
- package/dist/aiChat/server/stream.d.ts +0 -6
- package/dist/aiChat/server/tools.d.ts +157 -51
- package/dist/aiChat/server/types.d.ts +108 -64
- package/dist/aiChat/types.d.ts +148 -108
- package/dist/aiChat/typesSchema.d.ts +238 -25
- package/dist/animationComponent/index.cjs.js +3 -3
- package/dist/animationComponent/index.es.js +174 -169
- package/dist/animationComponent/index.umd.js +3 -3
- package/dist/canvasAbsoluteMode/index.cjs.js +1 -1
- package/dist/canvasAbsoluteMode/index.es.js +161 -156
- package/dist/canvasAbsoluteMode/index.umd.js +1 -1
- package/dist/canvasEmptyState/index.cjs.js +1 -1
- package/dist/canvasEmptyState/index.es.js +113 -108
- package/dist/canvasEmptyState/index.umd.js +1 -1
- package/dist/canvasFullSize/index.cjs.js +9 -9
- package/dist/canvasFullSize/index.es.js +137 -132
- package/dist/canvasFullSize/index.umd.js +9 -9
- package/dist/canvasGridMode/index.cjs.js +4 -4
- package/dist/canvasGridMode/index.es.js +168 -163
- package/dist/canvasGridMode/index.umd.js +8 -8
- package/dist/canvasScreenshot/index.cjs.js +1 -1
- package/dist/canvasScreenshot/index.es.js +132 -127
- package/dist/canvasScreenshot/index.umd.js +1 -1
- package/dist/dataSourceEjs/index.cjs.js +5 -5
- package/dist/dataSourceEjs/index.es.js +151 -146
- package/dist/dataSourceEjs/index.umd.js +5 -5
- package/dist/dataSourceHandlebars/index.cjs.js +4 -4
- package/dist/dataSourceHandlebars/index.es.js +91 -86
- package/dist/dataSourceHandlebars/index.umd.js +5 -5
- package/dist/dialogComponent/index.cjs.js +16 -16
- package/dist/dialogComponent/index.es.js +117 -112
- package/dist/dialogComponent/index.umd.js +16 -16
- package/dist/flexComponent/index.cjs.js +11 -11
- package/dist/flexComponent/index.es.js +416 -411
- package/dist/flexComponent/index.umd.js +11 -11
- package/dist/fsLightboxComponent/index.cjs.js +3 -3
- package/dist/fsLightboxComponent/index.es.js +152 -147
- package/dist/fsLightboxComponent/index.umd.js +3 -3
- package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
- package/dist/googleFontsAssetProvider/index.es.js +127 -122
- package/dist/googleFontsAssetProvider/index.umd.js +1 -1
- package/dist/iconifyComponent/index.cjs.js +2 -2
- package/dist/iconifyComponent/index.es.js +170 -165
- package/dist/iconifyComponent/index.umd.js +2 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +27 -22
- package/dist/index.umd.js +1 -1
- package/dist/layoutSidebarButtons/index.cjs.js +1 -1
- package/dist/layoutSidebarButtons/index.es.js +156 -151
- package/dist/layoutSidebarButtons/index.umd.js +1 -1
- package/dist/lightGalleryComponent/index.cjs.js +1 -1
- package/dist/lightGalleryComponent/index.es.js +197 -192
- package/dist/lightGalleryComponent/index.umd.js +1 -1
- package/dist/linkImageComponent/index.cjs.js +2 -2
- package/dist/linkImageComponent/index.es.js +86 -81
- package/dist/linkImageComponent/index.umd.js +2 -2
- package/dist/listPagesComponent/index.cjs.js +5 -5
- package/dist/listPagesComponent/index.es.js +121 -116
- package/dist/listPagesComponent/index.umd.js +5 -5
- package/dist/presetPrintable/index.cjs.js +4 -4
- package/dist/presetPrintable/index.es.js +180 -175
- package/dist/presetPrintable/index.umd.js +4 -4
- package/dist/prosemirror/index.cjs.js +6 -6
- package/dist/prosemirror/index.es.js +128 -123
- package/dist/prosemirror/index.umd.js +8 -8
- package/dist/rendererReact/index.cjs.js +1 -1
- package/dist/rendererReact/index.es.js +127 -122
- package/dist/rendererReact/index.js +1 -1
- package/dist/rendererReact/index.umd.js +1 -1
- package/dist/rteTinyMce/index.cjs.js +2 -2
- package/dist/rteTinyMce/index.es.js +160 -155
- package/dist/rteTinyMce/index.umd.js +2 -2
- package/dist/shapeDividerComponent/index.cjs.js +25 -25
- package/dist/shapeDividerComponent/index.es.js +127 -122
- package/dist/shapeDividerComponent/index.umd.js +25 -25
- package/dist/swiperComponent/index.cjs.js +9 -9
- package/dist/swiperComponent/index.es.js +197 -192
- package/dist/swiperComponent/index.umd.js +9 -9
- package/dist/tableComponent/index.cjs.js +1 -1
- package/dist/tableComponent/index.es.js +227 -222
- package/dist/tableComponent/index.umd.js +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/utils.d.ts +12 -1
- package/dist/youtubeAssetProvider/index.cjs.js +1 -1
- package/dist/youtubeAssetProvider/index.es.js +124 -119
- package/dist/youtubeAssetProvider/index.umd.js +1 -1
- package/package.json +5 -2
- package/dist/aiChat/components/AiChatInput.d.ts +0 -17
- package/dist/aiChat/server/stream-utils.d.ts +0 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(k,L){typeof exports=="object"&&typeof module<"u"?module.exports=L():typeof define=="function"&&define.amd?define(L):(k=typeof globalThis<"u"?globalThis:k||self,k.StudioSdkPlugins_lightGalleryComponent=L())})(this,function(){"use strict";const k="app.grapesjs.com",L="app-stage.grapesjs.com",Q=[k,"app2.grapesjs.com",L,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],pe="license:check:start",ue="license:check:end",he=()=>typeof window<"u",ge=({isDev:e,isStage:l})=>`${e?"":`https://${l?L:k}`}/api`,be=()=>{const e=he()&&window.location.hostname;return!!e&&(Q.includes(e)||Q.some(l=>e.endsWith(l)))};async function de({path:e,baseApiUrl:l,method:a="GET",headers:n={},params:s,body:u}){const p=`${l||ge({isDev:!1,isStage:!1})}${e}`,h={method:a,headers:{"Content-Type":"application/json",...n}};u&&(h.body=JSON.stringify(u));const c=s?new URLSearchParams(s).toString():"",i=c?`?${c}`:"",b=await fetch(`${p}${i}`,h);if(!b.ok)throw new Error(`HTTP error! status: ${b.status}`);return b.json()}var P=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(P||{});const X={[P.free]:0,[P.startup]:10,[P.business]:20,[P.enterprise]:30};function me(e){const l=e;return l.init=a=>n=>e(n,a),l}const ye=e=>me(e);async function fe({editor:e,plan:l,pluginName:a,licenseKey:n,cleanup:s}){let u="",r=!1;const p=be(),h=i=>{console.warn("Cleanup plugin:",a,"Reason:",i),s()},c=(i={})=>{var C;const{error:b,sdkLicense:V}=i,S=(C=i.plan)==null?void 0:C.category;if(!(V||i.license)||b)h(b||"Invalid license");else if(S){const _=X[l],M=X[S];_>M&&h({pluginRequiredPlan:l,licensePlan:S})}};e.on(pe,i=>{u=i==null?void 0:i.baseApiUrl,r=!0}),e.on(ue,i=>{c(i)}),setTimeout(async()=>{if(!r){if(p)return;if(n){const i=await ve({licenseKey:n,pluginName:a,baseApiUrl:u});i&&c(i)}else h("The `licenseKey` option not provided")}},2e3)}async function ve(e){const{licenseKey:l,pluginName:a,baseApiUrl:n}=e;try{return(await de({baseApiUrl:n,path:`/sdk/${l||"na"}`,method:"POST",params:{d:window.location.hostname,pn:a}})).result||{}}catch(s){return console.error("Error during SDK license check:",s),!1}}const B=(e,l)=>{var a;return!!((a=e==null?void 0:e.hasAttribute)!=null&&a.call(e,l))},Te="lightGalleryComponent",we=P.startup;var E=(e=>(e.image="image",e.video="video",e.external="external",e))(E||{});const T="lightGallery",Y=`${T}-item`,N="data-lightgallery",ee=`${N}-item`,$="toggle",w={image:'<svg viewBox="0 0 24 24"><path d="m8.5 13.5 2.5 3 3.5-4.5 4.5 6H5m16 1V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2Z"/></svg>',video:'<svg viewBox="0 0 24 24"><path d="M17 10.5V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-3.5l4 4v-11l-4 4Z"/></svg>',gallery:'<svg viewBox="0 0 24 24"><path d="M4,2H20A2,2 0 0,1 22,4V16A2,2 0 0,1 20,18H16L12,22L8,18H4A2,2 0 0,1 2,16V4A2,2 0 0,1 4,2M19,15V7L15,11L13,9L7,15H19M7,5A2,2 0 0,0 5,7A2,2 0 0,0 7,9A2,2 0 0,0 9,7A2,2 0 0,0 7,5Z" /></svg>',galleryItem:'<svg viewBox="0 0 24 24"><path d="M20 2H4a2 2 0 0 0-2 2v18l4-4h14a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2M8 14H6v-2h2v2m0-3H6V9h2v2m0-3H6V6h2v2m7 6h-5v-2h5v2m3-3h-8V9h8v2m0-3h-8V6h8v2Z"/></svg>',external:'<svg viewBox="0 0 24 24"><path d="M14 3v2h3.6l-9.8 9.8 1.4 1.4L19 6.4V10h2V3m-2 16H5V5h7V3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h14a2 2 0 0 0 2-2v-7h-2v7z"/></svg>',eye:'<svg viewBox="0 0 24 24"><path d="M12 9a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3m0 8a5 5 0 0 1-5-5 5 5 0 0 1 5-5 5 5 0 0 1 5 5 5 5 0 0 1-5 5m0-12.5C7 4.5 2.7 7.6 1 12a11.8 11.8 0 0 0 22 0c-1.7-4.4-6-7.5-11-7.5Z"/></svg>'},W={propKeys:[],props:{},traits:[]},O=(e,l={})=>{var s;const a={},n=[];for(const u in e){const{value:r,...p}=e[u];n.push({id:u,name:u,changeProp:!0,category:l.category,...p}),a[u]=r;const{subTraits:h={}}=p;for(const c in p.subTraits)(s=h[c])==null||s.forEach(i=>{const b=i.id||i.name;a[b]=i.value})}return{propKeys:Object.keys(a),props:a,traits:n}},Z=(e,l)=>{const a=e.getTrait(l),n=a.get("category"),s=a.get("subTraits")||{},r=(Object.values(s).flat()||[]).map(c=>c.id||c.name);e.removeTrait(r);const p=s[a.getValue()],h=e.getTraitIndex(l)+1;p&&e.addTrait(p.map(c=>({category:n,...c})),{at:h})},R=(e,l)=>{l.forEach(a=>{const n=e.getTrait(a);if(!n||!n.get("subTraits"))return;const s=n.changeProp?`change:${a}`:`change:attributes:${a}`;e.on(s,()=>Z(e,a)),Z(e,a)})},Se=(e,l,a)=>{const s=e.getTrait(l).get("subTraits")||{},r=(Object.values(s).flat()||[]).map(h=>{const c=h.name||h.id;return h.changeProp?`change:${c}`:`change:attributes:${c}`}),p=Array.from(new Set(r));p.length&&e.on(p.join(" "),a)},xe={[$]:{type:"button",label:"Toggle Gallery",command:(e,l)=>{var a,n;return(n=(a=l.target)==null?void 0:a.getView())==null?void 0:n.toggleGallery()}},speed:{type:"number",label:"Speed",tip:"Transition duration between slides (in ms)",value:400,step:50,min:0},inline:{type:"checkbox",label:"Inline Gallery",value:!1},allowMediaOverlap:{type:"checkbox",label:"Allow media overlap",tip:"If enabled, toolbar, captions and thumbnails will overlap with the media element",value:!1},controls:{type:"checkbox",label:"Show controls",tip:"If disabled, prev/next buttons will not be displayed",value:!0},counter:{type:"checkbox",label:"Show counter",tip:"Display the total number of images and index number of the currently displayed slide",value:!0},download:{type:"checkbox",label:"Download icon",tip:"Enable download button",value:!0},enableDrag:{type:"checkbox",label:"Enable drag",tip:"Enables desktop mouse drag support",value:!0},enableSwipe:{type:"checkbox",label:"Enable swipe",tip:"Enables swipe support for mobile devices",value:!0},escKey:{type:"checkbox",label:"Enable Esc key",tip:'Whether the gallery could be closed by pressing the "Esc" key',value:!0},keyPress:{type:"checkbox",label:"Enable keyboard navigation",value:!1},loop:{type:"checkbox",label:"Loop",tip:"If false, will disable the ability to loop back to the beginning of the gallery from the last slide",value:!0},getCaptionFromTitleOrAlt:{type:"checkbox",label:"Caption from title or alt",tip:"Get captions from alt or title tags",value:!0},showMaximizeIcon:{type:"checkbox",label:"Show maximize icon",value:!1},closable:{type:"checkbox",label:"Closable",tip:"If false, it won't be possible to close the gallery",value:!0},showCloseIcon:{type:"checkbox",label:"Show close icon",tip:"If false, close button won't be displayed.",visible:({component:e})=>!!e.getTrait("closable").getValue(),value:!0},closeOnTap:{type:"checkbox",label:"Close on tap",tip:"Allows clicks on black area to close gallery",visible:({component:e})=>!!e.getTrait("closable").getValue(),value:!0}},Ae={thumbnail:{category:{id:"thumbnail-options",label:"Thumbnail Options"},type:"checkbox",label:"Thumbnails",value:!0,subTraits:{false:[],true:[{type:"checkbox",name:"enableThumbDrag",label:"Thumbnail drag",tip:"Enable thumbnail drag on desktop",changeProp:!0,value:!0},{type:"checkbox",name:"enableThumbSwipe",label:"Thumbnail swipe",tip:"Enable thumbnail swipe on mobile devices",changeProp:!0,value:!0},{type:"select",name:"alignThumbnails",tip:"Position of thumbnails when the width of all thumbnails combined is less than the gallery's width",label:"Align Thumbnails",value:"middle",changeProp:!0,options:[{id:"left",label:"Left"},{id:"middle",label:"Middle"},{id:"right",label:"Right"}]},{type:"select",name:"currentPagerPosition",label:"Select thumbnail position",value:"middle",changeProp:!0,options:[{id:"left",label:"Left"},{id:"middle",label:"Middle"},{id:"right",label:"Right"}]},{type:"number",name:"thumbMargin",label:"Thumb margin",tip:"Spacing between each thumbnails",changeProp:!0,min:0,value:"5"},{type:"number",name:"thumbWidth",label:"Thumb width",tip:"Width of each thumbnails",changeProp:!0,min:0,value:"100"}]}}},Ie={autoplay:{category:{id:"autoplay-options",label:"Autoplay options"},type:"checkbox",label:"Autoplay",value:!0,subTraits:{false:[],true:[{type:"checkbox",name:"autoplayControls",label:"Autoplay controls",tip:"Show/hide autoplay controls",changeProp:!0,value:!0},{type:"checkbox",name:"progressBar",label:"Progress bar",tip:"Show autoplay progress bar",changeProp:!0,value:!0},{type:"checkbox",name:"forceSlideShowAutoplay",label:"Force autoplay",tip:"If false, autoplay will be stopped after first user action",changeProp:!0,value:!1},{type:"checkbox",name:"slideShowAutoplay",label:"Start autoplay",tip:"Enable autoplay on start",changeProp:!0,value:!1},{type:"number",name:"slideShowInterval",label:"Interval",tip:"The time (in ms) between each auto transition",changeProp:!0,min:0,step:50,value:5e3}]}}},ke={zoom:{category:{id:"zoom-options",label:"Zoom options"},type:"checkbox",label:"Zoom",value:!0,subTraits:{false:[],true:[{type:"checkbox",name:"actualSize",label:"Show actual size icon",changeProp:!0,value:!0},{type:"checkbox",name:"infiniteZoom",label:"Infinte zoom",changeProp:!0,value:!0},{type:"checkbox",name:"showZoomInOutIcons",label:"Show zoom in/out icons",changeProp:!0,value:!1},{type:"number",name:"scale",label:"Scale",tip:"Value of zoom should be incremented/decremented",changeProp:!0,min:0,value:1}]}}},m="sourceType",j="data-iframe",F={name:"href",type:"file",label:"Image Source"},K={name:"data-src",label:"Video Source",placeholder:"https://www.youtube.com/watch?v=..."},q={name:"data-poster",label:"Video Poster",type:"file"},te={name:"data-src",label:"External Source",placeholder:"https://some-external-source.com/...."},ae={label:"Caption",name:"data-sub-html",placeholder:"My caption",changeProp:!1},Le={[$]:{type:"button",label:"Toggle Gallery",command:(e,l)=>{var s,u;const a=l.target,n=(s=a==null?void 0:a.closestType(T))==null?void 0:s.getView();if(n&&a){const r=((u=n.getLightGallery())==null?void 0:u.items)||[],p=Array.from(r).indexOf(a.getEl());p>=0&&n.toggleGallery(p)}}},[m]:{type:"radio",label:"Source type",labelToTitle:!0,value:"image",subTraits:{image:[F],video:[K,q],external:[te]},options:[{id:"image",label:F.label||"",icon:w.image},{id:"video",label:K.label||"",icon:w.video},{id:"external",label:te.label||"",icon:w.external}]},subHtml:ae},ne="lgThumbnail",Pe="lgVideo",le="lgAutoplay",oe="lgZoom",G="https://cdn.jsdelivr.net/npm/lightgallery@2.8.2";return ye(function(e,l={}){const{Blocks:a,Components:n}=e,s="LightGallery",u="LightGallery Item",r={toolbarIconOpen:w.eye,block:{},lgLicenseKey:"92DE1DB8-7986-4F02-B908-514F97678D28",defaultSrc:"https://placehold.co/200/777/white.png?text=Image",plugins:[ne,Pe,le,oe],cdnScript:[`${G}/lightgallery.min.js`,`${G}/plugins/thumbnail/lg-thumbnail.min.js`,`${G}/plugins/video/lg-video.min.js`,`${G}/plugins/autoplay/lg-autoplay.min.js`,`${G}/plugins/zoom/lg-zoom.min.js`],cdnStyle:`${G}/css/lightgallery-bundle.min.css`,...l},{block:p,toolbarIconOpen:h,defaultSrc:c}=r,i=function(t){const o=this,g=window,{plugins:y,cdnScript:x,cdnStyle:D,inline:ie,lgLicenseKey:Ee,...f}=t||{},A=d=>isNaN(d)?void 0:parseInt(d,10),re=()=>{var H;const d={...f,licenseKey:Ee,speed:A(f.speed),startAnimationDuration:A(f.startAnimationDuration),thumbMargin:A(f.thumbMargin),thumbWidth:A(f.thumbWidth),slideShowInterval:A(f.slideShowInterval),scale:A(f.scale),enableZoomAfter:A(f.enableZoomAfter),plugins:(y||[]).map(z=>g[z])};ie&&(d.container=o,d.closable=!1);const J=(H=g.lightGallery)==null?void 0:H.call(g,o,d);ie&&J.openGallery()};if(g.lightGallery)re();else{const{head:d}=document,J=Array.isArray(x)?[...x]:[x],H=Array.isArray(D)?[...D]:[D],z=I=>{if(I.length){const v=document.createElement("link");v.href=I.shift(),v.rel="stylesheet",d.appendChild(v),z(I)}},ce=I=>{if(I.length){const v=document.createElement("script");v.src=I.shift(),v.onerror=v.onload=ce.bind(null,I),d.appendChild(v)}else re()};z(H),ce(J)}},b=t=>{const o=t.getTrait($);if(!h||!o)return;const{toolbar:g}=t,y={id:$,label:h,command:()=>setTimeout(()=>o.runCommand(),100)};!g.find(D=>D.id===y.id)&&(g==null||g.unshift(y))};let V=[];const S=r.plugins||[],U=O(xe),C=S.includes(ne)?O(Ae):W,_=S.includes(le)?O(Ie):W,M=S.includes(oe)?O(ke):W;n.addType(T,{block:p&&{label:s,media:w.gallery,category:"Extra",select:!0,...r.block},isComponent:t=>B(t,N),extendFn:["init","initToolbar"],model:{defaults:{name:s,icon:w.gallery,draggable:(t,o)=>!o.is(T),attributes:{[N]:!0},components:{type:Y},script:i,selector:"",exThumbImage:"",cdnScript:r.cdnScript,cdnStyle:r.cdnStyle,plugins:r.plugins,lgLicenseKey:r.lgLicenseKey,"script-props":["lgLicenseKey","cdnScript","cdnStyle","plugins","selector","exThumbImage",...U.propKeys,...C.propKeys,..._.propKeys,...M.propKeys],...U.props,...C.props,..._.props,...M.props,traits:[...U.traits,...C.traits,..._.traits,...M.traits]},init(){R(this,["thumbnail"]),R(this,["autoplay"]),R(this,["zoom"])},initToolbar(){b(this)}},extendFnView:["init"],view:{events:()=>({lgInit:"onLgInit",lgBeforeOpen:"onLgOpen",lgAfterClose:"onLgClose"}),init(){this.listenTo(this.model,n.events.scriptUnmount,this.destroyLightGallery)},getLightGallery(){return this.el.__lg},destroyLightGallery(){const t=this.getLightGallery();t==null||t.destroy()},disableLgInCanvas(){const t=this.getLightGallery();t.lgOpened=!0},isInlineGallery(){var o;const t=this.getLightGallery();return((o=t==null?void 0:t.settings)==null?void 0:o.container)===this.el},onLgInit(t){this.el.__lg=t.detail.instance,!this.isInlineGallery()&&this.disableLgInCanvas()},onLgOpen(){const{em:t}=this,{Canvas:o}=t,g=this.getLightGallery();V=o.getSpots(),setTimeout(()=>o.removeSpots()),g.__lgOpened=!0},onLgClose(){const t=this.getLightGallery();V.forEach(o=>this.em.Canvas.addSpot(o.attributes)),V=[],t.__lgOpened=!1,setTimeout(()=>this.disableLgInCanvas())},toggleGallery(t){const o=this.getLightGallery();if(o.__lgOpened)return o.closeGallery(!0);o.lgOpened=!1,o.openGallery(t)}}});const se=O(Le);n.addType(Y,{isComponent:t=>B(t,ee)||t.tagName==="A"&&B(t.parentElement,N),extendFn:["init","initToolbar"],model:{defaults:{tagName:"a",name:u,icon:w.galleryItem,attributes:{[ee]:!0,href:c},components:{type:"image",attributes:{alt:"Image",src:c}},...se.props,traits:[...se.traits]},init(){const t=[m].map(o=>`change:${o}`).join(" ");this.initSourceType(),this.on(t,this.updateTraits),this.updateTraits({init:!0}),this.initScriptUpdate(),Se(this,m,this.triggerGalleryUpdate)},initToolbar(){b(this)},initScriptUpdate(){const t=[ae.name].map(o=>`change:attributes:${o}`).join(" ");this.on(t,this.triggerGalleryUpdate)},triggerGalleryUpdate(...t){var o;(o=this.closestType(T))==null||o.__scriptPropsChange(...t)},updateTraits(t={}){const{changed:o}=this,{init:g}=t;if(o[m]||g){Z(this,m);const y=this.getTrait(m).getValue();if(y===E.image){this.removeAttributes([K.name,q.name,j]);const x=this.getTrait(F.name);x.setValue(x.getValue()||c)}else y===E.video?this.removeAttributes([j]):y===E.external&&this.addAttributes({[j]:!0})}},initSourceType(){const t=this.getAttributes({noClass:!0,noStyle:!0});t[j]?this.set(m,E.external):(t[K.name]||t[q.name])&&this.set(m,E.video)}}}),fe({editor:e,plan:we,licenseKey:r.licenseKey,pluginName:Te,cleanup:()=>{a.remove(T),n.removeType(T)}})})});
|
|
1
|
+
(function(P,k){typeof exports=="object"&&typeof module<"u"?module.exports=k():typeof define=="function"&&define.amd?define(k):(P=typeof globalThis<"u"?globalThis:P||self,P.StudioSdkPlugins_lightGalleryComponent=k())})(this,function(){"use strict";const P="app.grapesjs.com",k="app-stage.grapesjs.com",X=[P,"app2.grapesjs.com",k,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],pe="license:check:start",ue="license:check:end",he=()=>typeof window<"u",ge=({isDev:e,isStage:n,isPlatform:t})=>`${e?"":`https://${n?k:P}`}/${t?"platform-api":"api"}`,be=()=>{const e=he()&&window.location.hostname;return!!e&&(X.includes(e)||X.some(n=>e.endsWith(n)))};async function de({path:e,baseApiUrl:n,method:t="GET",headers:l={},params:o,body:u}){const p=`${n||ge({isDev:!1,isStage:!1})}${e}`,h={method:t,headers:{"Content-Type":"application/json",...l}};u&&(h.body=JSON.stringify(u));const c=o?new URLSearchParams(o).toString():"",b=c?`?${c}`:"",s=await fetch(`${p}${b}`,h);if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);return s.json()}var L=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(L||{});const Y={[L.free]:0,[L.startup]:10,[L.business]:20,[L.enterprise]:30};function me(e){const n=e;return n.init=t=>l=>e(l,t),n}const ye=e=>me(e);async function fe({editor:e,plan:n,pluginName:t,licenseKey:l,onLicenseCheckResponse:o,cleanup:u}){let r="",p=!1;const h=be(),c=s=>{console.warn("Cleanup plugin:",t,"Reason:",s),u()},b=(s={})=>{var V;const{error:O,sdkLicense:C}=s,S=(V=s.plan)==null?void 0:V.category;if(!(C||s.license)||O)c(O||"Invalid license");else if(S){const M=Y[n],H=Y[S];M>H&&c({pluginRequiredPlan:n,licensePlan:S})}};e.on(pe,s=>{r=s==null?void 0:s.baseApiUrl,p=!0}),e.on(ue,s=>{o==null||o(s),b(s)}),setTimeout(async()=>{if(!p){if(h)return;if(l){const s=await ve({licenseKey:l,pluginName:t,baseApiUrl:r});o==null||o(s),s&&b(s)}else c("The `licenseKey` option not provided")}},2e3)}async function ve(e){const{licenseKey:n,pluginName:t,baseApiUrl:l}=e;try{return(await de({baseApiUrl:l,path:`/sdk/${n||"na"}`,method:"POST",params:{d:window.location.hostname,pn:t}})).result||{}}catch(o){return console.error("Error during SDK license check:",o),!1}}const W=(e,n)=>{var t;return!!((t=e==null?void 0:e.hasAttribute)!=null&&t.call(e,n))},Te="lightGalleryComponent",we=L.startup;var E=(e=>(e.image="image",e.video="video",e.external="external",e))(E||{});const T="lightGallery",ee=`${T}-item`,$="data-lightgallery",te=`${$}-item`,N="toggle",w={image:'<svg viewBox="0 0 24 24"><path d="m8.5 13.5 2.5 3 3.5-4.5 4.5 6H5m16 1V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2Z"/></svg>',video:'<svg viewBox="0 0 24 24"><path d="M17 10.5V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-3.5l4 4v-11l-4 4Z"/></svg>',gallery:'<svg viewBox="0 0 24 24"><path d="M4,2H20A2,2 0 0,1 22,4V16A2,2 0 0,1 20,18H16L12,22L8,18H4A2,2 0 0,1 2,16V4A2,2 0 0,1 4,2M19,15V7L15,11L13,9L7,15H19M7,5A2,2 0 0,0 5,7A2,2 0 0,0 7,9A2,2 0 0,0 9,7A2,2 0 0,0 7,5Z" /></svg>',galleryItem:'<svg viewBox="0 0 24 24"><path d="M20 2H4a2 2 0 0 0-2 2v18l4-4h14a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2M8 14H6v-2h2v2m0-3H6V9h2v2m0-3H6V6h2v2m7 6h-5v-2h5v2m3-3h-8V9h8v2m0-3h-8V6h8v2Z"/></svg>',external:'<svg viewBox="0 0 24 24"><path d="M14 3v2h3.6l-9.8 9.8 1.4 1.4L19 6.4V10h2V3m-2 16H5V5h7V3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h14a2 2 0 0 0 2-2v-7h-2v7z"/></svg>',eye:'<svg viewBox="0 0 24 24"><path d="M12 9a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3m0 8a5 5 0 0 1-5-5 5 5 0 0 1 5-5 5 5 0 0 1 5 5 5 5 0 0 1-5 5m0-12.5C7 4.5 2.7 7.6 1 12a11.8 11.8 0 0 0 22 0c-1.7-4.4-6-7.5-11-7.5Z"/></svg>'},Z={propKeys:[],props:{},traits:[]},_=(e,n={})=>{var o;const t={},l=[];for(const u in e){const{value:r,...p}=e[u];l.push({id:u,name:u,changeProp:!0,category:n.category,...p}),t[u]=r;const{subTraits:h={}}=p;for(const c in p.subTraits)(o=h[c])==null||o.forEach(b=>{const s=b.id||b.name;t[s]=b.value})}return{propKeys:Object.keys(t),props:t,traits:l}},F=(e,n)=>{const t=e.getTrait(n),l=t.get("category"),o=t.get("subTraits")||{},r=(Object.values(o).flat()||[]).map(c=>c.id||c.name);e.removeTrait(r);const p=o[t.getValue()],h=e.getTraitIndex(n)+1;p&&e.addTrait(p.map(c=>({category:l,...c})),{at:h})},q=(e,n)=>{n.forEach(t=>{const l=e.getTrait(t);if(!l||!l.get("subTraits"))return;const o=l.changeProp?`change:${t}`:`change:attributes:${t}`;e.on(o,()=>F(e,t)),F(e,t)})},Se=(e,n,t)=>{const o=e.getTrait(n).get("subTraits")||{},r=(Object.values(o).flat()||[]).map(h=>{const c=h.name||h.id;return h.changeProp?`change:${c}`:`change:attributes:${c}`}),p=Array.from(new Set(r));p.length&&e.on(p.join(" "),t)},xe={[N]:{type:"button",label:"Toggle Gallery",command:(e,n)=>{var t,l;return(l=(t=n.target)==null?void 0:t.getView())==null?void 0:l.toggleGallery()}},speed:{type:"number",label:"Speed",tip:"Transition duration between slides (in ms)",value:400,step:50,min:0},inline:{type:"checkbox",label:"Inline Gallery",value:!1},allowMediaOverlap:{type:"checkbox",label:"Allow media overlap",tip:"If enabled, toolbar, captions and thumbnails will overlap with the media element",value:!1},controls:{type:"checkbox",label:"Show controls",tip:"If disabled, prev/next buttons will not be displayed",value:!0},counter:{type:"checkbox",label:"Show counter",tip:"Display the total number of images and index number of the currently displayed slide",value:!0},download:{type:"checkbox",label:"Download icon",tip:"Enable download button",value:!0},enableDrag:{type:"checkbox",label:"Enable drag",tip:"Enables desktop mouse drag support",value:!0},enableSwipe:{type:"checkbox",label:"Enable swipe",tip:"Enables swipe support for mobile devices",value:!0},escKey:{type:"checkbox",label:"Enable Esc key",tip:'Whether the gallery could be closed by pressing the "Esc" key',value:!0},keyPress:{type:"checkbox",label:"Enable keyboard navigation",value:!1},loop:{type:"checkbox",label:"Loop",tip:"If false, will disable the ability to loop back to the beginning of the gallery from the last slide",value:!0},getCaptionFromTitleOrAlt:{type:"checkbox",label:"Caption from title or alt",tip:"Get captions from alt or title tags",value:!0},showMaximizeIcon:{type:"checkbox",label:"Show maximize icon",value:!1},closable:{type:"checkbox",label:"Closable",tip:"If false, it won't be possible to close the gallery",value:!0},showCloseIcon:{type:"checkbox",label:"Show close icon",tip:"If false, close button won't be displayed.",visible:({component:e})=>!!e.getTrait("closable").getValue(),value:!0},closeOnTap:{type:"checkbox",label:"Close on tap",tip:"Allows clicks on black area to close gallery",visible:({component:e})=>!!e.getTrait("closable").getValue(),value:!0}},Ae={thumbnail:{category:{id:"thumbnail-options",label:"Thumbnail Options"},type:"checkbox",label:"Thumbnails",value:!0,subTraits:{false:[],true:[{type:"checkbox",name:"enableThumbDrag",label:"Thumbnail drag",tip:"Enable thumbnail drag on desktop",changeProp:!0,value:!0},{type:"checkbox",name:"enableThumbSwipe",label:"Thumbnail swipe",tip:"Enable thumbnail swipe on mobile devices",changeProp:!0,value:!0},{type:"select",name:"alignThumbnails",tip:"Position of thumbnails when the width of all thumbnails combined is less than the gallery's width",label:"Align Thumbnails",value:"middle",changeProp:!0,options:[{id:"left",label:"Left"},{id:"middle",label:"Middle"},{id:"right",label:"Right"}]},{type:"select",name:"currentPagerPosition",label:"Select thumbnail position",value:"middle",changeProp:!0,options:[{id:"left",label:"Left"},{id:"middle",label:"Middle"},{id:"right",label:"Right"}]},{type:"number",name:"thumbMargin",label:"Thumb margin",tip:"Spacing between each thumbnails",changeProp:!0,min:0,value:"5"},{type:"number",name:"thumbWidth",label:"Thumb width",tip:"Width of each thumbnails",changeProp:!0,min:0,value:"100"}]}}},Ie={autoplay:{category:{id:"autoplay-options",label:"Autoplay options"},type:"checkbox",label:"Autoplay",value:!0,subTraits:{false:[],true:[{type:"checkbox",name:"autoplayControls",label:"Autoplay controls",tip:"Show/hide autoplay controls",changeProp:!0,value:!0},{type:"checkbox",name:"progressBar",label:"Progress bar",tip:"Show autoplay progress bar",changeProp:!0,value:!0},{type:"checkbox",name:"forceSlideShowAutoplay",label:"Force autoplay",tip:"If false, autoplay will be stopped after first user action",changeProp:!0,value:!1},{type:"checkbox",name:"slideShowAutoplay",label:"Start autoplay",tip:"Enable autoplay on start",changeProp:!0,value:!1},{type:"number",name:"slideShowInterval",label:"Interval",tip:"The time (in ms) between each auto transition",changeProp:!0,min:0,step:50,value:5e3}]}}},Pe={zoom:{category:{id:"zoom-options",label:"Zoom options"},type:"checkbox",label:"Zoom",value:!0,subTraits:{false:[],true:[{type:"checkbox",name:"actualSize",label:"Show actual size icon",changeProp:!0,value:!0},{type:"checkbox",name:"infiniteZoom",label:"Infinte zoom",changeProp:!0,value:!0},{type:"checkbox",name:"showZoomInOutIcons",label:"Show zoom in/out icons",changeProp:!0,value:!1},{type:"number",name:"scale",label:"Scale",tip:"Value of zoom should be incremented/decremented",changeProp:!0,min:0,value:1}]}}},m="sourceType",j="data-iframe",R={name:"href",type:"file",label:"Image Source"},K={name:"data-src",label:"Video Source",placeholder:"https://www.youtube.com/watch?v=..."},J={name:"data-poster",label:"Video Poster",type:"file"},ae={name:"data-src",label:"External Source",placeholder:"https://some-external-source.com/...."},le={label:"Caption",name:"data-sub-html",placeholder:"My caption",changeProp:!1},ke={[N]:{type:"button",label:"Toggle Gallery",command:(e,n)=>{var o,u;const t=n.target,l=(o=t==null?void 0:t.closestType(T))==null?void 0:o.getView();if(l&&t){const r=((u=l.getLightGallery())==null?void 0:u.items)||[],p=Array.from(r).indexOf(t.getEl());p>=0&&l.toggleGallery(p)}}},[m]:{type:"radio",label:"Source type",labelToTitle:!0,value:"image",subTraits:{image:[R],video:[K,J],external:[ae]},options:[{id:"image",label:R.label||"",icon:w.image},{id:"video",label:K.label||"",icon:w.video},{id:"external",label:ae.label||"",icon:w.external}]},subHtml:le},ne="lgThumbnail",Le="lgVideo",oe="lgAutoplay",ie="lgZoom",G="https://cdn.jsdelivr.net/npm/lightgallery@2.8.2";return ye(function(e,n={}){const{Blocks:t,Components:l}=e,o="LightGallery",u="LightGallery Item",r={toolbarIconOpen:w.eye,block:{},lgLicenseKey:"92DE1DB8-7986-4F02-B908-514F97678D28",defaultSrc:"https://placehold.co/200/777/white.png?text=Image",plugins:[ne,Le,oe,ie],cdnScript:[`${G}/lightgallery.min.js`,`${G}/plugins/thumbnail/lg-thumbnail.min.js`,`${G}/plugins/video/lg-video.min.js`,`${G}/plugins/autoplay/lg-autoplay.min.js`,`${G}/plugins/zoom/lg-zoom.min.js`],cdnStyle:`${G}/css/lightgallery-bundle.min.css`,...n},{block:p,toolbarIconOpen:h,defaultSrc:c}=r,b=function(a){const i=this,g=window,{plugins:y,cdnScript:x,cdnStyle:D,inline:se,lgLicenseKey:Ee,...f}=a||{},A=d=>isNaN(d)?void 0:parseInt(d,10),re=()=>{var z;const d={...f,licenseKey:Ee,speed:A(f.speed),startAnimationDuration:A(f.startAnimationDuration),thumbMargin:A(f.thumbMargin),thumbWidth:A(f.thumbWidth),slideShowInterval:A(f.slideShowInterval),scale:A(f.scale),enableZoomAfter:A(f.enableZoomAfter),plugins:(y||[]).map(B=>g[B])};se&&(d.container=i,d.closable=!1);const Q=(z=g.lightGallery)==null?void 0:z.call(g,i,d);se&&Q.openGallery()};if(g.lightGallery)re();else{const{head:d}=document,Q=Array.isArray(x)?[...x]:[x],z=Array.isArray(D)?[...D]:[D],B=I=>{if(I.length){const v=document.createElement("link");v.href=I.shift(),v.rel="stylesheet",d.appendChild(v),B(I)}},ce=I=>{if(I.length){const v=document.createElement("script");v.src=I.shift(),v.onerror=v.onload=ce.bind(null,I),d.appendChild(v)}else re()};B(z),ce(Q)}},s=a=>{const i=a.getTrait(N);if(!h||!i)return;const{toolbar:g}=a,y={id:N,label:h,command:()=>setTimeout(()=>i.runCommand(),100)};!g.find(D=>D.id===y.id)&&(g==null||g.unshift(y))};let O=[];const C=r.plugins||[],S=_(xe),U=C.includes(ne)?_(Ae):Z,V=C.includes(oe)?_(Ie):Z,M=C.includes(ie)?_(Pe):Z;l.addType(T,{block:p&&{label:o,media:w.gallery,category:"Extra",select:!0,...r.block},isComponent:a=>W(a,$),extendFn:["init","initToolbar"],model:{defaults:{name:o,icon:w.gallery,draggable:(a,i)=>!i.is(T),attributes:{[$]:!0},components:{type:ee},script:b,selector:"",exThumbImage:"",cdnScript:r.cdnScript,cdnStyle:r.cdnStyle,plugins:r.plugins,lgLicenseKey:r.lgLicenseKey,"script-props":["lgLicenseKey","cdnScript","cdnStyle","plugins","selector","exThumbImage",...S.propKeys,...U.propKeys,...V.propKeys,...M.propKeys],...S.props,...U.props,...V.props,...M.props,traits:[...S.traits,...U.traits,...V.traits,...M.traits]},init(){q(this,["thumbnail"]),q(this,["autoplay"]),q(this,["zoom"])},initToolbar(){s(this)}},extendFnView:["init"],view:{events:()=>({lgInit:"onLgInit",lgBeforeOpen:"onLgOpen",lgAfterClose:"onLgClose"}),init(){this.listenTo(this.model,l.events.scriptUnmount,this.destroyLightGallery)},getLightGallery(){return this.el.__lg},destroyLightGallery(){const a=this.getLightGallery();a==null||a.destroy()},disableLgInCanvas(){const a=this.getLightGallery();a.lgOpened=!0},isInlineGallery(){var i;const a=this.getLightGallery();return((i=a==null?void 0:a.settings)==null?void 0:i.container)===this.el},onLgInit(a){this.el.__lg=a.detail.instance,!this.isInlineGallery()&&this.disableLgInCanvas()},onLgOpen(){const{em:a}=this,{Canvas:i}=a,g=this.getLightGallery();O=i.getSpots(),setTimeout(()=>i.removeSpots()),g.__lgOpened=!0},onLgClose(){const a=this.getLightGallery();O.forEach(i=>this.em.Canvas.addSpot(i.attributes)),O=[],a.__lgOpened=!1,setTimeout(()=>this.disableLgInCanvas())},toggleGallery(a){const i=this.getLightGallery();if(i.__lgOpened)return i.closeGallery(!0);i.lgOpened=!1,i.openGallery(a)}}});const H=_(ke);l.addType(ee,{isComponent:a=>W(a,te)||a.tagName==="A"&&W(a.parentElement,$),extendFn:["init","initToolbar"],model:{defaults:{tagName:"a",name:u,icon:w.galleryItem,attributes:{[te]:!0,href:c},components:{type:"image",attributes:{alt:"Image",src:c}},...H.props,traits:[...H.traits]},init(){const a=[m].map(i=>`change:${i}`).join(" ");this.initSourceType(),this.on(a,this.updateTraits),this.updateTraits({init:!0}),this.initScriptUpdate(),Se(this,m,this.triggerGalleryUpdate)},initToolbar(){s(this)},initScriptUpdate(){const a=[le.name].map(i=>`change:attributes:${i}`).join(" ");this.on(a,this.triggerGalleryUpdate)},triggerGalleryUpdate(...a){var i;(i=this.closestType(T))==null||i.__scriptPropsChange(...a)},updateTraits(a={}){const{changed:i}=this,{init:g}=a;if(i[m]||g){F(this,m);const y=this.getTrait(m).getValue();if(y===E.image){this.removeAttributes([K.name,J.name,j]);const x=this.getTrait(R.name);x.setValue(x.getValue()||c)}else y===E.video?this.removeAttributes([j]):y===E.external&&this.addAttributes({[j]:!0})}},initSourceType(){const a=this.getAttributes({noClass:!0,noStyle:!0});a[j]?this.set(m,E.external):(a[K.name]||a[J.name])&&this.set(m,E.video)}}}),fe({editor:e,plan:we,licenseKey:r.licenseKey,pluginName:Te,cleanup:()=>{t.remove(T),l.removeType(T)}})})});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const A="app.grapesjs.com",v="app-stage.grapesjs.com",N="app2.grapesjs.com",D="app-stage2.grapesjs.com",y=[A,N,v,D,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],k="license:check:start",E="license:check:end",$=()=>typeof window<"u",U=({isDev:t,isStage:a,isPlatform:i})=>`${t?"":`https://${a?v:A}`}/${i?"platform-api":"api"}`,P=()=>{const t=$()&&window.location.hostname;return!!t&&(y.includes(t)||y.some(a=>t.endsWith(a)))};async function _({path:t,baseApiUrl:a,method:i="GET",headers:o={},params:s,body:l}){const m=`${a||U({isDev:!1,isStage:!1})}${t}`,u={method:i,headers:{"Content-Type":"application/json",...o}};l&&(u.body=JSON.stringify(l));const c=s?new URLSearchParams(s).toString():"",d=c?`?${c}`:"",n=await fetch(`${m}${d}`,u);if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return n.json()}var g=(t=>(t.free="free",t.startup="startup",t.business="business",t.enterprise="enterprise",t))(g||{});const T={[g.free]:0,[g.startup]:10,[g.business]:20,[g.enterprise]:30};function x(t){const a=t;return a.init=i=>o=>t(o,i),a}const S=t=>x(t);async function O({editor:t,plan:a,pluginName:i,licenseKey:o,onLicenseCheckResponse:s,cleanup:l}){let p="",m=!1;const u=P(),c=n=>{console.warn("Cleanup plugin:",i,"Reason:",n),l()},d=(n={})=>{var b;const{error:f,sdkLicense:e}=n,r=(b=n.plan)==null?void 0:b.category;if(!(e||n.license)||f)c(f||"Invalid license");else if(r){const w=T[a],I=T[r];w>I&&c({pluginRequiredPlan:a,licensePlan:r})}};t.on(k,n=>{p=n==null?void 0:n.baseApiUrl,m=!0}),t.on(E,n=>{s==null||s(n),d(n)}),setTimeout(async()=>{if(!m){if(u)return;if(o){const n=await W({licenseKey:o,pluginName:i,baseApiUrl:p});s==null||s(n),n&&d(n)}else c("The `licenseKey` option not provided")}},2e3)}async function W(t){const{licenseKey:a,pluginName:i,baseApiUrl:o}=t;try{return(await _({baseApiUrl:o,path:`/sdk/${a||"na"}`,method:"POST",params:{d:window.location.hostname,pn:i}})).result||{}}catch(s){return console.error("Error during SDK license check:",s),!1}}const j="linkImageComponent",C=g.startup,L=function(t,a={}){const{Components:i,Blocks:o}=t,s="link-image",l="Link Image",p="link-image",{model:m,view:u}=t.Components.getType("image"),c=i.getType("link").model.getDefaults().traits,d=m.getDefaults().traits,n=c.filter(e=>e!=="title"),f=d.filter(e=>e.name!=="customAttributes").map(e=>typeof e=="string"?{name:e}:e).map(e=>({...e,getValue({component:r}){var h;return(h=r.components().at(0).getTrait(e.name))==null?void 0:h.getValue()},setValue({component:r,value:h,options:b}){var w;(w=r.components().at(0).getTrait(e.name))==null||w.setValue(h,b)}}));i.addType(s,{isComponent:e=>{var r;return e.tagName==="A"&&((r=e.children)==null?void 0:r.length)===1&&e.children[0].tagName==="IMG"},block:{label:l,media:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M2 6.3A2.3 2.3 0 0 1 4.3 4h15.4A2.3 2.3 0 0 1 22 6.3v7a4.7 4.7 0 0 0-2.8-.8h-3.4a4.8 4.8 0 0 0-4 7.5H4.3A2.3 2.3 0 0 1 2 17.7zm21 11a3.8 3.8 0 0 0-3.8-3.8.8.8 0 0 0 0 1.5h.2a2.3 2.3 0 0 1-.1 4.5H19a.8.8 0 0 0 .2 1.5h.2a3.8 3.8 0 0 0 3.5-3.8m-6.5-3a.8.8 0 0 0-.8-.7h-.1a3.8 3.8 0 0 0 .2 7.5.8.8 0 0 0 0-1.5h-.2a2.3 2.3 0 0 1 .2-4.5.8.8 0 0 0 .7-.7m3.5 3a.8.8 0 0 0-.8-.8h-3.6a.8.8 0 0 0 .2 1.5h3.6a.8.8 0 0 0 .6-.8"/></svg>'},extend:"link",extendFn:["init"],model:{defaults:{name:l,classes:p,resizable:{ratioDefault:!0},traits:[...f,...n],droppable:!1,stylable:["width","min-width","max-width","height","min-height","max-height","padding","margin","position","border-radius","border-width","border-style","border-color","opacity","box-shadow","filter","transform"],components:{type:"image"},styles:`
|
|
2
2
|
.${p} {
|
|
3
3
|
display: inline-block;
|
|
4
4
|
overflow: hidden;
|
|
@@ -9,4 +9,4 @@
|
|
|
9
9
|
width: 100%;
|
|
10
10
|
height: 100%;
|
|
11
11
|
}
|
|
12
|
-
`},init(){const
|
|
12
|
+
`},init(){const e=this.components().at(0);e==null||e.set({layerable:!1,locked:!0})}},view:{onActive(e){u.prototype.onActive.call(this,e)}}}),O({editor:t,licenseKey:a.licenseKey,plan:C,pluginName:j,cleanup:()=>{i.removeType(s),o.remove(s)}})},M=S(L);module.exports=M;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const
|
|
2
|
-
T,
|
|
3
|
-
v,
|
|
1
|
+
const A = "app.grapesjs.com", v = "app-stage.grapesjs.com", N = "app2.grapesjs.com", D = "app-stage2.grapesjs.com", y = [
|
|
4
2
|
A,
|
|
5
|
-
|
|
3
|
+
N,
|
|
4
|
+
v,
|
|
5
|
+
D,
|
|
6
6
|
"localhost",
|
|
7
7
|
"127.0.0.1",
|
|
8
8
|
".local-credentialless.webcontainer.io",
|
|
@@ -11,112 +11,117 @@ const T = "app.grapesjs.com", A = "app-stage.grapesjs.com", v = "app2.grapesjs.c
|
|
|
11
11
|
// For stackblitz.com demos
|
|
12
12
|
"-sandpack.codesandbox.io"
|
|
13
13
|
// For Sandpack demos
|
|
14
|
-
],
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
], k = "license:check:start", E = "license:check:end", $ = () => typeof window < "u", U = ({
|
|
15
|
+
isDev: e,
|
|
16
|
+
isStage: a,
|
|
17
|
+
isPlatform: i
|
|
18
|
+
}) => `${e ? "" : `https://${a ? v : A}`}/${i ? "platform-api" : "api"}`, P = () => {
|
|
19
|
+
const e = $() && window.location.hostname;
|
|
20
|
+
return !!e && (y.includes(e) || y.some((a) => e.endsWith(a)));
|
|
17
21
|
};
|
|
18
|
-
async function
|
|
22
|
+
async function _({
|
|
19
23
|
path: e,
|
|
20
|
-
baseApiUrl:
|
|
24
|
+
baseApiUrl: a,
|
|
21
25
|
method: i = "GET",
|
|
22
26
|
headers: o = {},
|
|
23
|
-
params:
|
|
27
|
+
params: s,
|
|
24
28
|
body: c
|
|
25
29
|
}) {
|
|
26
|
-
const
|
|
30
|
+
const m = `${a || U({ isDev: !1, isStage: !1 })}${e}`, u = {
|
|
27
31
|
method: i,
|
|
28
32
|
headers: {
|
|
29
33
|
"Content-Type": "application/json",
|
|
30
34
|
...o
|
|
31
35
|
}
|
|
32
36
|
};
|
|
33
|
-
c && (
|
|
34
|
-
const
|
|
35
|
-
if (!
|
|
36
|
-
throw new Error(`HTTP error! status: ${
|
|
37
|
-
return
|
|
37
|
+
c && (u.body = JSON.stringify(c));
|
|
38
|
+
const l = s ? new URLSearchParams(s).toString() : "", d = l ? `?${l}` : "", n = await fetch(`${m}${d}`, u);
|
|
39
|
+
if (!n.ok)
|
|
40
|
+
throw new Error(`HTTP error! status: ${n.status}`);
|
|
41
|
+
return n.json();
|
|
38
42
|
}
|
|
39
|
-
var
|
|
40
|
-
const
|
|
41
|
-
[
|
|
42
|
-
[
|
|
43
|
-
[
|
|
44
|
-
[
|
|
43
|
+
var g = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(g || {});
|
|
44
|
+
const T = {
|
|
45
|
+
[g.free]: 0,
|
|
46
|
+
[g.startup]: 10,
|
|
47
|
+
[g.business]: 20,
|
|
48
|
+
[g.enterprise]: 30
|
|
45
49
|
};
|
|
46
|
-
function
|
|
47
|
-
const
|
|
48
|
-
return
|
|
50
|
+
function x(e) {
|
|
51
|
+
const a = e;
|
|
52
|
+
return a.init = (i) => (o) => e(o, i), a;
|
|
49
53
|
}
|
|
50
|
-
const
|
|
51
|
-
async function
|
|
54
|
+
const S = (e) => /* @__PURE__ */ x(e);
|
|
55
|
+
async function O({
|
|
52
56
|
editor: e,
|
|
53
|
-
plan:
|
|
57
|
+
plan: a,
|
|
54
58
|
pluginName: i,
|
|
55
59
|
licenseKey: o,
|
|
56
|
-
|
|
60
|
+
onLicenseCheckResponse: s,
|
|
61
|
+
cleanup: c
|
|
57
62
|
}) {
|
|
58
|
-
let
|
|
59
|
-
const
|
|
60
|
-
console.warn("Cleanup plugin:", i, "Reason:",
|
|
61
|
-
},
|
|
62
|
-
var
|
|
63
|
-
const { error:
|
|
64
|
-
if (!(
|
|
65
|
-
|
|
66
|
-
else if (
|
|
67
|
-
const w =
|
|
68
|
-
w >
|
|
63
|
+
let p = "", m = !1;
|
|
64
|
+
const u = P(), l = (n) => {
|
|
65
|
+
console.warn("Cleanup plugin:", i, "Reason:", n), c();
|
|
66
|
+
}, d = (n = {}) => {
|
|
67
|
+
var b;
|
|
68
|
+
const { error: f, sdkLicense: t } = n, r = (b = n.plan) == null ? void 0 : b.category;
|
|
69
|
+
if (!(t || n.license) || f)
|
|
70
|
+
l(f || "Invalid license");
|
|
71
|
+
else if (r) {
|
|
72
|
+
const w = T[a], I = T[r];
|
|
73
|
+
w > I && l({ pluginRequiredPlan: a, licensePlan: r });
|
|
69
74
|
}
|
|
70
75
|
};
|
|
71
|
-
e.on(
|
|
72
|
-
|
|
73
|
-
}), e.on(
|
|
74
|
-
|
|
76
|
+
e.on(k, (n) => {
|
|
77
|
+
p = n == null ? void 0 : n.baseApiUrl, m = !0;
|
|
78
|
+
}), e.on(E, (n) => {
|
|
79
|
+
s == null || s(n), d(n);
|
|
75
80
|
}), setTimeout(async () => {
|
|
76
|
-
if (!
|
|
77
|
-
if (
|
|
81
|
+
if (!m) {
|
|
82
|
+
if (u) return;
|
|
78
83
|
if (o) {
|
|
79
|
-
const
|
|
80
|
-
|
|
84
|
+
const n = await W({ licenseKey: o, pluginName: i, baseApiUrl: p });
|
|
85
|
+
s == null || s(n), n && d(n);
|
|
81
86
|
} else
|
|
82
|
-
|
|
87
|
+
l("The `licenseKey` option not provided");
|
|
83
88
|
}
|
|
84
89
|
}, 2e3);
|
|
85
90
|
}
|
|
86
|
-
async function
|
|
87
|
-
const { licenseKey:
|
|
91
|
+
async function W(e) {
|
|
92
|
+
const { licenseKey: a, pluginName: i, baseApiUrl: o } = e;
|
|
88
93
|
try {
|
|
89
|
-
return (await
|
|
94
|
+
return (await _({
|
|
90
95
|
baseApiUrl: o,
|
|
91
|
-
path: `/sdk/${
|
|
96
|
+
path: `/sdk/${a || "na"}`,
|
|
92
97
|
method: "POST",
|
|
93
98
|
params: {
|
|
94
99
|
d: window.location.hostname,
|
|
95
100
|
pn: i
|
|
96
101
|
}
|
|
97
102
|
})).result || {};
|
|
98
|
-
} catch (
|
|
99
|
-
return console.error("Error during SDK license check:",
|
|
103
|
+
} catch (s) {
|
|
104
|
+
return console.error("Error during SDK license check:", s), !1;
|
|
100
105
|
}
|
|
101
106
|
}
|
|
102
|
-
const
|
|
103
|
-
const { Components: i, Blocks: o } = e,
|
|
104
|
-
(
|
|
105
|
-
...
|
|
106
|
-
getValue({ component:
|
|
107
|
-
var
|
|
108
|
-
return (
|
|
107
|
+
const j = "linkImageComponent", C = g.startup, L = function(e, a = {}) {
|
|
108
|
+
const { Components: i, Blocks: o } = e, s = "link-image", c = "Link Image", p = "link-image", { model: m, view: u } = e.Components.getType("image"), l = i.getType("link").model.getDefaults().traits, d = m.getDefaults().traits, n = l.filter((t) => t !== "title"), f = d.filter((t) => t.name !== "customAttributes").map((t) => typeof t == "string" ? { name: t } : t).map(
|
|
109
|
+
(t) => ({
|
|
110
|
+
...t,
|
|
111
|
+
getValue({ component: r }) {
|
|
112
|
+
var h;
|
|
113
|
+
return (h = r.components().at(0).getTrait(t.name)) == null ? void 0 : h.getValue();
|
|
109
114
|
},
|
|
110
|
-
setValue({ component:
|
|
111
|
-
var
|
|
112
|
-
(
|
|
115
|
+
setValue({ component: r, value: h, options: b }) {
|
|
116
|
+
var w;
|
|
117
|
+
(w = r.components().at(0).getTrait(t.name)) == null || w.setValue(h, b);
|
|
113
118
|
}
|
|
114
119
|
})
|
|
115
120
|
);
|
|
116
|
-
i.addType(
|
|
117
|
-
isComponent: (
|
|
118
|
-
var
|
|
119
|
-
return
|
|
121
|
+
i.addType(s, {
|
|
122
|
+
isComponent: (t) => {
|
|
123
|
+
var r;
|
|
124
|
+
return t.tagName === "A" && ((r = t.children) == null ? void 0 : r.length) === 1 && t.children[0].tagName === "IMG";
|
|
120
125
|
},
|
|
121
126
|
block: {
|
|
122
127
|
label: c,
|
|
@@ -129,7 +134,7 @@ const S = "linkImageComponent", O = h.startup, W = function(e, s = {}) {
|
|
|
129
134
|
name: c,
|
|
130
135
|
classes: p,
|
|
131
136
|
resizable: { ratioDefault: !0 },
|
|
132
|
-
traits: [...
|
|
137
|
+
traits: [...f, ...n],
|
|
133
138
|
droppable: !1,
|
|
134
139
|
stylable: [
|
|
135
140
|
"width",
|
|
@@ -165,25 +170,25 @@ const S = "linkImageComponent", O = h.startup, W = function(e, s = {}) {
|
|
|
165
170
|
`
|
|
166
171
|
},
|
|
167
172
|
init() {
|
|
168
|
-
const
|
|
169
|
-
|
|
173
|
+
const t = this.components().at(0);
|
|
174
|
+
t == null || t.set({ layerable: !1, locked: !0 });
|
|
170
175
|
}
|
|
171
176
|
},
|
|
172
177
|
view: {
|
|
173
|
-
onActive(
|
|
174
|
-
|
|
178
|
+
onActive(t) {
|
|
179
|
+
u.prototype.onActive.call(this, t);
|
|
175
180
|
}
|
|
176
181
|
}
|
|
177
|
-
}),
|
|
182
|
+
}), O({
|
|
178
183
|
editor: e,
|
|
179
|
-
licenseKey:
|
|
180
|
-
plan:
|
|
181
|
-
pluginName:
|
|
184
|
+
licenseKey: a.licenseKey,
|
|
185
|
+
plan: C,
|
|
186
|
+
pluginName: j,
|
|
182
187
|
cleanup: () => {
|
|
183
|
-
i.removeType(
|
|
188
|
+
i.removeType(s), o.remove(s);
|
|
184
189
|
}
|
|
185
190
|
});
|
|
186
|
-
},
|
|
191
|
+
}, M = S(L);
|
|
187
192
|
export {
|
|
188
|
-
|
|
193
|
+
M as default
|
|
189
194
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(m,d){typeof exports=="object"&&typeof module<"u"?module.exports=d():typeof define=="function"&&define.amd?define(d):(m=typeof globalThis<"u"?globalThis:m||self,m.StudioSdkPlugins_linkImageComponent=d())})(this,function(){"use strict";const m="app.grapesjs.com",d="app-stage.grapesjs.com",A=[m,"app2.grapesjs.com",d,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],v="license:check:start",D="license:check:end",N=()=>typeof window<"u",k=({isDev:e,isStage:s,isPlatform:a})=>`${e?"":`https://${s?d:m}`}/${a?"platform-api":"api"}`,E=()=>{const e=N()&&window.location.hostname;return!!e&&(A.includes(e)||A.some(s=>e.endsWith(s)))};async function _({path:e,baseApiUrl:s,method:a="GET",headers:o={},params:i,body:c}){const g=`${s||k({isDev:!1,isStage:!1})}${e}`,h={method:a,headers:{"Content-Type":"application/json",...o}};c&&(h.body=JSON.stringify(c));const r=i?new URLSearchParams(i).toString():"",f=r?`?${r}`:"",n=await fetch(`${g}${f}`,h);if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return n.json()}var u=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(u||{});const I={[u.free]:0,[u.startup]:10,[u.business]:20,[u.enterprise]:30};function P(e){const s=e;return s.init=a=>o=>e(o,a),s}const S=e=>P(e);async function $({editor:e,plan:s,pluginName:a,licenseKey:o,onLicenseCheckResponse:i,cleanup:c}){let p="",g=!1;const h=E(),r=n=>{console.warn("Cleanup plugin:",a,"Reason:",n),c()},f=(n={})=>{var y;const{error:w,sdkLicense:t}=n,l=(y=n.plan)==null?void 0:y.category;if(!(t||n.license)||w)r(w||"Invalid license");else if(l){const T=I[s],M=I[l];T>M&&r({pluginRequiredPlan:s,licensePlan:l})}};e.on(v,n=>{p=n==null?void 0:n.baseApiUrl,g=!0}),e.on(D,n=>{i==null||i(n),f(n)}),setTimeout(async()=>{if(!g){if(h)return;if(o){const n=await x({licenseKey:o,pluginName:a,baseApiUrl:p});i==null||i(n),n&&f(n)}else r("The `licenseKey` option not provided")}},2e3)}async function x(e){const{licenseKey:s,pluginName:a,baseApiUrl:o}=e;try{return(await _({baseApiUrl:o,path:`/sdk/${s||"na"}`,method:"POST",params:{d:window.location.hostname,pn:a}})).result||{}}catch(i){return console.error("Error during SDK license check:",i),!1}}const O="linkImageComponent",U=u.startup;return S(function(e,s={}){const{Components:a,Blocks:o}=e,i="link-image",c="Link Image",p="link-image",{model:g,view:h}=e.Components.getType("image"),r=a.getType("link").model.getDefaults().traits,f=g.getDefaults().traits,n=r.filter(t=>t!=="title"),w=f.filter(t=>t.name!=="customAttributes").map(t=>typeof t=="string"?{name:t}:t).map(t=>({...t,getValue({component:l}){var b;return(b=l.components().at(0).getTrait(t.name))==null?void 0:b.getValue()},setValue({component:l,value:b,options:y}){var T;(T=l.components().at(0).getTrait(t.name))==null||T.setValue(b,y)}}));a.addType(i,{isComponent:t=>{var l;return t.tagName==="A"&&((l=t.children)==null?void 0:l.length)===1&&t.children[0].tagName==="IMG"},block:{label:c,media:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M2 6.3A2.3 2.3 0 0 1 4.3 4h15.4A2.3 2.3 0 0 1 22 6.3v7a4.7 4.7 0 0 0-2.8-.8h-3.4a4.8 4.8 0 0 0-4 7.5H4.3A2.3 2.3 0 0 1 2 17.7zm21 11a3.8 3.8 0 0 0-3.8-3.8.8.8 0 0 0 0 1.5h.2a2.3 2.3 0 0 1-.1 4.5H19a.8.8 0 0 0 .2 1.5h.2a3.8 3.8 0 0 0 3.5-3.8m-6.5-3a.8.8 0 0 0-.8-.7h-.1a3.8 3.8 0 0 0 .2 7.5.8.8 0 0 0 0-1.5h-.2a2.3 2.3 0 0 1 .2-4.5.8.8 0 0 0 .7-.7m3.5 3a.8.8 0 0 0-.8-.8h-3.6a.8.8 0 0 0 .2 1.5h3.6a.8.8 0 0 0 .6-.8"/></svg>'},extend:"link",extendFn:["init"],model:{defaults:{name:c,classes:p,resizable:{ratioDefault:!0},traits:[...w,...n],droppable:!1,stylable:["width","min-width","max-width","height","min-height","max-height","padding","margin","position","border-radius","border-width","border-style","border-color","opacity","box-shadow","filter","transform"],components:{type:"image"},styles:`
|
|
2
2
|
.${p} {
|
|
3
3
|
display: inline-block;
|
|
4
4
|
overflow: hidden;
|
|
@@ -9,4 +9,4 @@
|
|
|
9
9
|
width: 100%;
|
|
10
10
|
height: 100%;
|
|
11
11
|
}
|
|
12
|
-
`},init(){const
|
|
12
|
+
`},init(){const t=this.components().at(0);t==null||t.set({layerable:!1,locked:!0})}},view:{onActive(t){h.prototype.onActive.call(this,t)}}}),$({editor:e,licenseKey:s.licenseKey,plan:U,pluginName:O,cleanup:()=>{a.removeType(i),o.remove(i)}})})});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";const
|
|
2
|
-
.${
|
|
1
|
+
"use strict";const D="app.grapesjs.com",C="app-stage.grapesjs.com",S="app2.grapesjs.com",x="app-stage2.grapesjs.com",v=[D,S,C,x,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],O="license:check:start",U="license:check:end",k=()=>typeof window<"u",W=({isDev:t,isStage:s,isPlatform:i})=>`${t?"":`https://${s?C:D}`}/${i?"platform-api":"api"}`,j=()=>{const t=k()&&window.location.hostname;return!!t&&(v.includes(t)||v.some(s=>t.endsWith(s)))};async function B({path:t,baseApiUrl:s,method:i="GET",headers:e={},params:o,body:a}){const c=`${s||W({isDev:!1,isStage:!1})}${t}`,u={method:i,headers:{"Content-Type":"application/json",...e}};a&&(u.body=JSON.stringify(a));const r=o?new URLSearchParams(o).toString():"",p=r?`?${r}`:"",n=await fetch(`${c}${p}`,u);if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return n.json()}var y=(t=>(t.free="free",t.startup="startup",t.business="business",t.enterprise="enterprise",t))(y||{});const _={[y.free]:0,[y.startup]:10,[y.business]:20,[y.enterprise]:30};function K(t){const s=t;return s.init=i=>e=>t(e,i),s}const G=t=>K(t);async function F({editor:t,plan:s,pluginName:i,licenseKey:e,onLicenseCheckResponse:o,cleanup:a}){let l="",c=!1;const u=j(),r=n=>{console.warn("Cleanup plugin:",i,"Reason:",n),a()},p=(n={})=>{var P;const{error:h,sdkLicense:A}=n,m=(P=n.plan)==null?void 0:P.category;if(!(A||n.license)||h)r(h||"Invalid license");else if(m){const b=_[s],H=_[m];b>H&&r({pluginRequiredPlan:s,licensePlan:m})}};t.on(O,n=>{l=n==null?void 0:n.baseApiUrl,c=!0}),t.on(U,n=>{o==null||o(n),p(n)}),setTimeout(async()=>{if(!c){if(u)return;if(e){const n=await R({licenseKey:e,pluginName:i,baseApiUrl:l});o==null||o(n),n&&p(n)}else r("The `licenseKey` option not provided")}},2e3)}async function R(t){const{licenseKey:s,pluginName:i,baseApiUrl:e}=t;try{return(await B({baseApiUrl:e,path:`/sdk/${s||"na"}`,method:"POST",params:{d:window.location.hostname,pn:i}})).result||{}}catch(o){return console.error("Error during SDK license check:",o),!1}}const N="gjs-plg-",q="listPagesComponent",X=y.startup;function Y(t,s,i){let e,o,a,l,c;const u=s;function r(){const n=Date.now()-l;n<u&&n>=0?e=setTimeout(r,u-n):(e=null,c=t.apply(a,o),a=o=null)}const p=function(){return a=this,o=arguments,l=Date.now(),e||(e=setTimeout(r,u)),c};return p.clear=function(){e&&(clearTimeout(e),e=null)},p.flush=function(){e&&(c=t.apply(a,o),a=o=null,clearTimeout(e),e=null)},p}const $="page://",g="list-pages",f="list-pages-item",d="list-pages-link",Z=t=>t.components().reduce((s,i)=>{var l;const e=i.findFirstType(d),o=(l=e==null?void 0:e.attributes.attributes)==null?void 0:l.href,a=o!=null&&o.startsWith($)?o.replace($,""):"";if(a&&e){const c=s[a];c?c.push(e):s[a]=[e]}return s},{}),I="data-type-role",J="page_root",z=t=>s=>s.is(t),Q=t=>(s,i)=>i.is(t),w=t=>s=>{var i;return((i=s.getAttribute)==null?void 0:i.call(s,I))===t},tt=function(t,s={}){const{Blocks:i,Components:e,Pages:o}=t,{licenseKey:a,block:l={}}=s,c="List Pages",u="List Pages Item",r="Link",p=`${N}${g}`,n=`${N}${d}`,h='<svg viewBox="0 0 24 24"><path d="M11 15H17V17H11V15M9 7H7V9H9V7M11 13H17V11H11V13M11 9H17V7H11V9M9 11H7V13H9V11M21 5V19C21 20.1 20.1 21 19 21H5C3.9 21 3 20.1 3 19V5C3 3.9 3.9 3 5 3H19C20.1 3 21 3.9 21 5M19 5H5V19H19V5M9 15H7V17H9V15Z"/></svg>',A='<svg viewBox="0 0 24 24"><path d="M7,5H21V7H7V5M7,13V11H21V13H7M4,4.5A1.5,1.5 0 0,1 5.5,6A1.5,1.5 0 0,1 4,7.5A1.5,1.5 0 0,1 2.5,6A1.5,1.5 0 0,1 4,4.5M4,10.5A1.5,1.5 0 0,1 5.5,12A1.5,1.5 0 0,1 4,13.5A1.5,1.5 0 0,1 2.5,12A1.5,1.5 0 0,1 4,10.5M7,19V17H21V19H7M4,16.5A1.5,1.5 0 0,1 5.5,18A1.5,1.5 0 0,1 4,19.5A1.5,1.5 0 0,1 2.5,18A1.5,1.5 0 0,1 4,16.5Z" /></svg>';e.addType(g,{block:l&&{label:c,media:h,category:"Extra",select:!0,...s.block},isComponent:w(g),model:{defaults:{tagName:"ul",name:c,[J]:"",classes:p,attributes:{[I]:g,role:"navigation"},droppable:z(f),styles:`
|
|
2
|
+
.${p} {
|
|
3
3
|
list-style: none;
|
|
4
4
|
margin: 0;
|
|
5
5
|
padding: 0;
|
|
6
6
|
}
|
|
7
|
-
`},init(){this.syncPageItems=Y(this.syncPageItems.bind(this),0),this.listenTo(this.em,o.events.all,this.syncPageItems),this.syncPageItems()},syncPageItems(){if(
|
|
8
|
-
.${
|
|
7
|
+
`},init(){this.syncPageItems=Y(this.syncPageItems.bind(this),0),this.listenTo(this.em,o.events.all,this.syncPageItems),this.syncPageItems()},syncPageItems(){if(t.Components.getSymbolInfo(this).isInstance)return;const m=this.em.Pages.getAll(),E=this.components(),P=Z(this);m.forEach((b,H)=>{const V=b.id,L=b.getName(),T=P[V];T?T==null||T.forEach(M=>{M.getInnerHTML()!==L&&M.components(L)}):E.add({type:f,components:[{type:d,attributes:{href:`page://${V}`},components:{type:"textnode",content:L}}]},{at:H})})}}}),e.addType(f,{isComponent:w(f),model:{defaults:{name:u,tagName:"li",icon:A,attributes:{[I]:f},components:{type:d},draggable:Q(g)}}}),e.addType(d,{extend:"link",isComponent:w(d),model:{defaults:{removable:!1,copyable:!1,delegate:{move:m=>m.closestType(f)},name:r,classes:n,attributes:{[I]:d},components:{type:"textnode",content:"Item"},styles:`
|
|
8
|
+
.${n} {
|
|
9
9
|
text-decoration: none;
|
|
10
10
|
}
|
|
11
|
-
`}}}),
|
|
11
|
+
`}}}),F({editor:t,licenseKey:a,plan:X,pluginName:q,cleanup:()=>{i.remove(g),e.removeType(g)}})},et=G(tt);module.exports=et;
|