@grapesjs/studio-sdk-plugins 1.0.38 → 1.0.39-rc.0
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 +5 -5
- package/dist/accordionComponent/index.es.js +70 -67
- package/dist/accordionComponent/index.js +39 -0
- package/dist/accordionComponent/index.umd.js +4 -4
- package/dist/aiChat/components/AiChatHeader.d.ts +4 -5
- package/dist/aiChat/components/AiChatInput/index.d.ts +4 -5
- package/dist/aiChat/components/AiChatMessage.d.ts +7 -8
- package/dist/aiChat/components/index.d.ts +1 -1
- package/dist/aiChat/components/utils.d.ts +1 -1
- package/dist/aiChat/index.cjs.js +10 -376
- package/dist/aiChat/index.es.js +4569 -28851
- package/dist/aiChat/index.js +10 -376
- package/dist/aiChat/index.umd.js +11 -377
- package/dist/aiChat/server/index.cjs.d.ts +0 -1
- package/dist/aiChat/server/index.cjs.js +45 -45
- package/dist/aiChat/server/index.d.ts +0 -1
- package/dist/aiChat/server/index.es.d.ts +0 -1
- package/dist/aiChat/server/index.es.js +371 -427
- package/dist/aiChat/server/index.js +45 -45
- package/dist/aiChat/server/index.umd.js +41 -41
- package/dist/aiChat/server/stream.test.d.ts +1 -0
- package/dist/aiChat/types.d.ts +18 -4
- package/dist/aiChat/typesSchema.d.ts +13 -0
- package/dist/animationComponent/index.cjs.js +3 -3
- package/dist/animationComponent/index.es.js +49 -46
- package/dist/animationComponent/index.js +519 -0
- package/dist/animationComponent/index.umd.js +3 -3
- package/dist/canvasAbsoluteMode/index.cjs.js +1 -1
- package/dist/canvasAbsoluteMode/index.es.js +115 -112
- package/dist/canvasAbsoluteMode/index.js +1 -0
- package/dist/canvasAbsoluteMode/index.umd.js +1 -1
- package/dist/canvasEmptyState/index.cjs.js +1 -1
- package/dist/canvasEmptyState/index.es.js +71 -68
- package/dist/canvasEmptyState/index.js +1 -0
- package/dist/canvasEmptyState/index.umd.js +1 -1
- package/dist/canvasFullSize/index.cjs.js +3 -3
- package/dist/canvasFullSize/index.es.js +69 -66
- package/dist/canvasFullSize/index.js +10 -0
- package/dist/canvasFullSize/index.umd.js +4 -4
- package/dist/canvasGridMode/index.cjs.js +7 -7
- package/dist/canvasGridMode/index.es.js +142 -139
- package/dist/canvasGridMode/index.js +26 -0
- package/dist/canvasGridMode/index.umd.js +7 -7
- package/dist/canvasScreenshot/index.cjs.js +1 -1
- package/dist/canvasScreenshot/index.es.js +78 -75
- package/dist/canvasScreenshot/index.js +1 -0
- package/dist/canvasScreenshot/index.umd.js +1 -1
- package/dist/dataSourceEjs/EjsExporter.d.ts +1 -1
- package/dist/dataSourceEjs/index.cjs.js +3 -3
- package/dist/dataSourceEjs/index.es.js +40 -37
- package/dist/dataSourceEjs/index.js +21 -0
- package/dist/dataSourceEjs/index.umd.js +3 -3
- package/dist/dataSourceHandlebars/HandlebarsExporter.d.ts +2 -2
- package/dist/dataSourceHandlebars/constants.d.ts +1 -1
- package/dist/dataSourceHandlebars/index.cjs.js +4 -4
- package/dist/dataSourceHandlebars/index.es.js +58 -55
- package/dist/dataSourceHandlebars/index.js +10 -0
- package/dist/dataSourceHandlebars/index.umd.js +2 -2
- package/dist/dialogComponent/index.cjs.js +11 -11
- package/dist/dialogComponent/index.es.js +72 -69
- package/dist/dialogComponent/index.js +59 -0
- package/dist/dialogComponent/index.umd.js +11 -11
- package/dist/flexComponent/index.cjs.js +6 -6
- package/dist/flexComponent/index.es.js +151 -142
- package/dist/flexComponent/index.js +33 -0
- package/dist/flexComponent/index.umd.js +8 -8
- package/dist/flexComponent/typesSchema.d.ts +1 -1
- package/dist/fsLightboxComponent/index.cjs.js +3 -3
- package/dist/fsLightboxComponent/index.es.js +93 -90
- package/dist/fsLightboxComponent/index.js +6 -0
- package/dist/fsLightboxComponent/index.umd.js +3 -3
- package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
- package/dist/googleFontsAssetProvider/index.es.js +112 -109
- package/dist/googleFontsAssetProvider/index.js +1 -0
- package/dist/googleFontsAssetProvider/index.umd.js +1 -1
- package/dist/googleFontsAssetProvider/utils.d.ts +1 -1
- package/dist/iconifyComponent/index.cjs.js +2 -2
- package/dist/iconifyComponent/index.es.js +80 -77
- package/dist/iconifyComponent/index.js +3 -0
- package/dist/iconifyComponent/index.umd.js +2 -2
- package/dist/index.cjs.d.ts +1 -0
- package/dist/index.cjs.js +970 -82
- package/dist/index.d.ts +1 -0
- package/dist/index.es.d.ts +1 -0
- package/dist/index.es.js +7422 -6145
- package/dist/index.umd.js +975 -87
- package/dist/layoutSidebarButtons/index.cjs.js +1 -1
- package/dist/layoutSidebarButtons/index.es.js +95 -92
- package/dist/layoutSidebarButtons/index.js +1 -0
- package/dist/layoutSidebarButtons/index.umd.js +1 -1
- package/dist/lightGalleryComponent/index.cjs.js +1 -1
- package/dist/lightGalleryComponent/index.es.js +164 -161
- package/dist/lightGalleryComponent/index.js +1 -0
- package/dist/lightGalleryComponent/index.umd.js +1 -1
- package/dist/lightGalleryComponent/utils.d.ts +1 -1
- package/dist/linkImageComponent/index.cjs.js +2 -2
- package/dist/linkImageComponent/index.es.js +60 -57
- package/dist/linkImageComponent/index.js +12 -0
- package/dist/linkImageComponent/index.umd.js +2 -2
- package/dist/listPagesComponent/index.cjs.js +4 -4
- package/dist/listPagesComponent/index.es.js +57 -54
- package/dist/listPagesComponent/index.js +11 -0
- package/dist/listPagesComponent/index.umd.js +4 -4
- package/dist/listPagesComponent/utils.d.ts +1 -1
- package/dist/presetBlockLibrary/blocks.d.ts +6 -0
- package/dist/presetBlockLibrary/blocks.test.d.ts +2 -0
- package/dist/presetBlockLibrary/emailBlocks.d.ts +53 -0
- package/dist/presetBlockLibrary/index.cjs.d.ts +3 -0
- package/dist/presetBlockLibrary/index.cjs.js +889 -0
- package/dist/presetBlockLibrary/index.d.ts +3 -0
- package/dist/presetBlockLibrary/index.es.d.ts +3 -0
- package/dist/presetBlockLibrary/index.es.js +1408 -0
- package/dist/presetBlockLibrary/index.js +889 -0
- package/dist/presetBlockLibrary/index.test.d.ts +1 -0
- package/dist/presetBlockLibrary/index.umd.js +889 -0
- package/dist/presetBlockLibrary/shared.d.ts +3 -0
- package/dist/presetBlockLibrary/types.d.ts +24 -0
- package/dist/presetBlockLibrary/typesSchema.d.ts +47 -0
- package/dist/presetPrintable/index.cjs.js +3 -3
- package/dist/presetPrintable/index.es.js +133 -130
- package/dist/presetPrintable/index.js +32 -0
- package/dist/presetPrintable/index.umd.js +4 -4
- package/dist/prosemirror/index.cjs.js +8 -8
- package/dist/prosemirror/index.es.js +552 -549
- package/dist/prosemirror/index.js +10 -0
- package/dist/prosemirror/index.umd.js +9 -9
- package/dist/prosemirror/toolbar.d.ts +2 -2
- package/dist/prosemirror/types.d.ts +5 -5
- package/dist/rendererReact/index.cjs.js +1 -1
- package/dist/rendererReact/index.es.js +137 -134
- 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 +74 -71
- package/dist/rteTinyMce/index.js +104 -0
- package/dist/rteTinyMce/index.umd.js +2 -2
- package/dist/shapeDividerComponent/index.cjs.js +4 -4
- package/dist/shapeDividerComponent/index.es.js +91 -88
- package/dist/shapeDividerComponent/index.js +97 -0
- package/dist/shapeDividerComponent/index.umd.js +4 -4
- package/dist/swiperComponent/index.cjs.js +7 -7
- package/dist/swiperComponent/index.es.js +95 -92
- package/dist/swiperComponent/index.js +45 -0
- package/dist/swiperComponent/index.umd.js +5 -5
- package/dist/tableComponent/index.cjs.js +1 -1
- package/dist/tableComponent/index.es.js +181 -178
- package/dist/tableComponent/index.js +1 -0
- package/dist/tableComponent/index.umd.js +1 -1
- package/dist/tableComponent/types.d.ts +3 -3
- package/dist/types.d.ts +14 -14
- package/dist/utils.d.ts +3 -2
- package/dist/utilsDataSources.d.ts +1 -1
- package/dist/youtubeAssetProvider/index.cjs.js +1 -1
- package/dist/youtubeAssetProvider/index.es.js +90 -87
- package/dist/youtubeAssetProvider/index.js +1 -0
- package/dist/youtubeAssetProvider/index.umd.js +1 -1
- package/package.json +182 -34
- package/dist/aiChat/server/models.d.ts +0 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(L,G){typeof exports=="object"&&typeof module<"u"?module.exports=G():typeof define=="function"&&define.amd?define(G):(L=typeof globalThis<"u"?globalThis:L||self,L.StudioSdkPlugins_lightGalleryComponent=G())})(this,function(){"use strict";const L="app.grapesjs.com",G="app-stage.grapesjs.com",Y=[L,"app2.grapesjs.com",G,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io",".claudemcpcontent.com",".web-sandbox.oaiusercontent.com"],ue="license:check:end",ge=()=>typeof window<"u",he=({isDev:e,isStage:l,isPlatform:t})=>`${e?"":`https://${l?G:L}`}/${t?"platform-api":"api"}`,be=()=>{if(!ge())return"";const{hostname:e}=window.location;if(e)return e;try{return window.parent.location.hostname||""}catch{return""}},de=()=>{const e=be();return!!e&&(Y.includes(e)||Y.some(l=>e.endsWith(l)))};async function ye({path:e,baseApiUrl:l,method:t="GET",headers:o={},params:n,body:g}){const i=`${l||he({isDev:!1,isStage:!1})}${e}`,u={method:t,headers:{"Content-Type":"application/json",...o}};g&&(u.body=JSON.stringify(g));const p=n?new URLSearchParams(n).toString():"",b=p?`?${p}`:"",r=await fetch(`${i}${b}`,u);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return r.json()}var k=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(k||{}),F=(e=>(e.toastAdd="studio:toastAdd",e.toastRemove="studio:toastRemove",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",e.dialogExportCode="studio:dialogExportCode",e.dialogImportCode="studio:dialogImportCode",e.openEditCode="studio:openEditCode",e.sidebarLeftSet="studio:sidebarLeft:set",e.sidebarLeftGet="studio:sidebarLeft:get",e.sidebarLeftToggle="studio:sidebarLeft:toggle",e.sidebarRightSet="studio:sidebarRight:set",e.sidebarRightGet="studio:sidebarRight:get",e.sidebarRightToggle="studio:sidebarRight:toggle",e.sidebarTopSet="studio:sidebarTop:set",e.sidebarTopGet="studio:sidebarTop:get",e.sidebarTopToggle="studio:sidebarTop:toggle",e.sidebarBottomSet="studio:sidebarBottom:set",e.sidebarBottomGet="studio:sidebarBottom:get",e.sidebarBottomToggle="studio:sidebarBottom:toggle",e.symbolAdd="studio:symbolAdd",e.symbolDetach="studio:symbolDetach",e.symbolOverride="studio:symbolOverride",e.symbolPropagateStyles="studio:propagateStyles",e.getPagesConfig="studio:getPagesConfig",e.setPagesConfig="studio:setPagesConfig",e.getPageSettings="studio:getPageSettings",e.setPageSettings="studio:setPageSettings",e.clearPage="studio:clearPage",e.projectFiles="studio:projectFiles",e.validateCode="studio:validateCode",e.canvasReload="studio:canvasReload",e.getBlocksPanel="studio:getBlocksPanel",e.setBlocksPanel="studio:setBlocksPanel",e.getStateContextMenu="studio:getStateContextMenu",e.setStateContextMenu="studio:setStateContextMenu",e.contextMenuComponent="studio:contextMenuComponent",e.layoutAdd="studio:layoutAdd",e.layoutRemove="studio:layoutRemove",e.layoutToggle="studio:layoutToggle",e.layoutUpdate="studio:layoutUpdate",e.layoutGet="studio:layoutGet",e.layoutConfigGet="studio:layoutConfigGet",e.layoutConfigSet="studio:layoutConfigSet",e.layoutComponentAdd="studio:layoutComponentAdd",e.layoutComponentGet="studio:layoutComponentGet",e.layoutComponentRemove="studio:layoutComponentRemove",e.layoutComponentRender="studio:layoutComponentRender",e.getStateTheme="studio:getStateTheme",e.setStateTheme="studio:setStateTheme",e.settings="studio:settings",e.assetProviderGet="studio:assetProviderGet",e.assetProviderAdd="studio:assetProviderAdd",e.assetProviderRemove="studio:assetProviderRemove",e.fontGet="studio:fontGet",e.fontAdd="studio:fontAdd",e.fontRemove="studio:fontRemove",e.fontManagerOpen="studio:fontManagerOpen",e.menuFontLoad="studio:menuFontLoad",e.toggleStateDataSource="studio:toggleStateDataSource",e.getStateDataSource="studio:getStateDataSource",e.dataSourceSetGlobalData="studio:dataSourceSetGlobalData",e.dataSourceSetImporter="studio:dataSourceSetImporter",e.dataSourceSetExporter="studio:dataSourceSetExporter",e.setDragAbsolute="studio:setDragAbsolute",e))(F||{});const ee={[k.free]:0,[k.startup]:10,[k.business]:20,[k.enterprise]:30};function me(e){const l=e;return l.init=t=>o=>e(o,t),l}const fe=e=>me(e);async function ve({editor:e,plan:l,pluginName:t,licenseKey:o,onLicenseCheckResponse:n,cleanup:g}){let c="",i;const u=r=>{console.warn("Cleanup plugin:",t,"Reason:",r),g()},p=(r={})=>{var M;const{error:O,sdkLicense:V}=r,x=(M=r.plan)==null?void 0:M.category;if(!(V||r.license)||O)u(O||"Invalid license");else if(x){const R=ee[l],H=ee[x];R>H&&u({pluginRequiredPlan:l,licensePlan:x})}};e.Commands.has(F.settings)&&(i=e.runCommand(F.settings),c=(i==null?void 0:i.baseUrl)||"");const b=r=>{n==null||n(r),r&&p(r)};if(!i){e.onReady(async()=>{if(!de())if(o){const r=await we({licenseKey:o,pluginName:t,baseApiUrl:c});b(r)}else u("The `licenseKey` option not provided")});return}if(i.licensePlan||i.licenseError){const r=Te(i);b(r);return}e.on(ue,r=>b(r))}const Te=e=>({sdkLicense:e.license,license:e.license,error:e.licenseError,plan:e.licensePlan});async function we(e){const{licenseKey:l,pluginName:t,baseApiUrl:o}=e;try{return(await ye({baseApiUrl:o,path:`/sdk/${l||"na"}`,method:"POST",params:{d:window.location.hostname,pn:t}})).result||{}}catch(n){return console.error("Error during SDK license check:",n),!1}}const W=(e,l)=>{var t;return!!((t=e==null?void 0:e.hasAttribute)!=null&&t.call(e,l))},xe="lightGalleryComponent",Pe=k.startup;var E=(e=>(e.image="image",e.video="video",e.external="external",e))(E||{});const T="lightGallery",te=`${T}-item`,B="data-lightgallery",ae=`${B}-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>'},Z={propKeys:[],props:{},traits:[]},D=(e,l={})=>{var n;const t={},o=[];for(const g in e){const{value:c,...i}=e[g];o.push({id:g,name:g,changeProp:!0,category:l.category,...i}),t[g]=c;const{subTraits:u={}}=i;for(const p in i.subTraits)(n=u[p])==null||n.forEach(b=>{const r=b.id||b.name;t[r]=b.value})}return{propKeys:Object.keys(t),props:t,traits:o}},q=(e,l)=>{const t=e.getTrait(l),o=t.get("category"),n=t.get("subTraits")||{},c=(Object.values(n).flat()||[]).map(p=>p.id||p.name);e.removeTrait(c);const i=n[t.getValue()],u=e.getTraitIndex(l)+1;i&&e.addTrait(i.map(p=>({category:o,...p})),{at:u})},C=(e,l)=>{l.forEach(t=>{const o=e.getTrait(t);if(!o||!o.get("subTraits"))return;const n=o.changeProp?`change:${t}`:`change:attributes:${t}`;e.on(n,()=>q(e,t)),q(e,t)})},Ae=(e,l,t)=>{const n=e.getTrait(l).get("subTraits")||{},c=(Object.values(n).flat()||[]).map(u=>{const p=u.name||u.id;return u.changeProp?`change:${p}`:`change:attributes:${p}`}),i=Array.from(new Set(c));i.length&&e.on(i.join(" "),t)},Ie={[$]:{type:"button",label:"Toggle Gallery",command:(e,l)=>{var t,o;return(o=(t=l.target)==null?void 0:t.getView())==null?void 0:o.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}},Le={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"}]}}},Ge={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}]}}},y="sourceType",N="data-iframe",J={name:"href",type:"file",label:"Image Source"},j={name:"data-src",label:"Video Source",placeholder:"https://www.youtube.com/watch?v=..."},Q={name:"data-poster",label:"Video Poster",type:"file"},oe={name:"data-src",label:"External Source",placeholder:"https://some-external-source.com/...."},le={label:"Caption",name:"data-sub-html",placeholder:"My caption",changeProp:!1},Ee={[$]:{type:"button",label:"Toggle Gallery",command:(e,l)=>{var n,g;const t=l.target,o=(n=t==null?void 0:t.closestType(T))==null?void 0:n.getView();if(o&&t){const c=((g=o.getLightGallery())==null?void 0:g.items)||[],i=Array.from(c).indexOf(t.getEl());i>=0&&o.toggleGallery(i)}}},[y]:{type:"radio",label:"Source type",labelToTitle:!0,value:"image",subTraits:{image:[J],video:[j,Q],external:[oe]},options:[{id:"image",label:J.label||"",icon:w.image},{id:"video",label:j.label||"",icon:w.video},{id:"external",label:oe.label||"",icon:w.external}]},subHtml:le},se="lgThumbnail",Se="lgVideo",ne="lgAutoplay",ie="lgZoom",S="https://cdn.jsdelivr.net/npm/lightgallery@2.8.2";return fe(function(e,l={}){const{Blocks:t,Components:o}=e,n="LightGallery",g="LightGallery Item",c={toolbarIconOpen:w.eye,block:{},lgLicenseKey:"92DE1DB8-7986-4F02-B908-514F97678D28",defaultSrc:"https://placehold.co/200/777/white.png?text=Image",plugins:[se,Se,ne,ie],cdnScript:[`${S}/lightgallery.min.js`,`${S}/plugins/thumbnail/lg-thumbnail.min.js`,`${S}/plugins/video/lg-video.min.js`,`${S}/plugins/autoplay/lg-autoplay.min.js`,`${S}/plugins/zoom/lg-zoom.min.js`],cdnStyle:`${S}/css/lightgallery-bundle.min.css`,...l},{block:i,toolbarIconOpen:u,defaultSrc:p}=c,b=function(a){const s=this,h=window,{plugins:m,cdnScript:P,cdnStyle:_,inline:re,lgLicenseKey:Oe,...f}=a||{},A=d=>isNaN(d)?void 0:parseInt(d,10),ce=()=>{var K;const d={...f,licenseKey:Oe,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:(m||[]).map(z=>h[z])};re&&(d.container=s,d.closable=!1);const X=(K=h.lightGallery)==null?void 0:K.call(h,s,d);re&&X.openGallery()};if(h.lightGallery)ce();else{const{head:d}=document,X=Array.isArray(P)?[...P]:[P],K=Array.isArray(_)?[..._]:[_],z=I=>{if(I.length){const v=document.createElement("link");v.href=I.shift(),v.rel="stylesheet",d.appendChild(v),z(I)}},pe=I=>{if(I.length){const v=document.createElement("script");v.src=I.shift(),v.onerror=v.onload=pe.bind(null,I),d.appendChild(v)}else ce()};z(K),pe(X)}},r=a=>{const s=a.getTrait($);if(!u||!s)return;const{toolbar:h}=a,m={id:$,label:u,command:()=>setTimeout(()=>s.runCommand(),100)};!h.find(_=>_.id===m.id)&&(h==null||h.unshift(m))};let O=[];const V=c.plugins||[],x=D(Ie),U=V.includes(se)?D(Le):Z,M=V.includes(ne)?D(Ge):Z,R=V.includes(ie)?D(ke):Z;o.addType(T,{block:i&&{label:n,media:w.gallery,category:"Extra",select:!0,...c.block},isComponent:a=>W(a,B),extendFn:["init","initToolbar"],model:{defaults:{name:n,icon:w.gallery,draggable:(a,s)=>!s.is(T),attributes:{[B]:!0},components:{type:te},script:b,selector:"",exThumbImage:"",cdnScript:c.cdnScript,cdnStyle:c.cdnStyle,plugins:c.plugins,lgLicenseKey:c.lgLicenseKey,"script-props":["lgLicenseKey","cdnScript","cdnStyle","plugins","selector","exThumbImage",...x.propKeys,...U.propKeys,...M.propKeys,...R.propKeys],...x.props,...U.props,...M.props,...R.props,traits:[...x.traits,...U.traits,...M.traits,...R.traits]},init(){C(this,["thumbnail"]),C(this,["autoplay"]),C(this,["zoom"])},initToolbar(){r(this)}},extendFnView:["init"],view:{events:()=>({lgInit:"onLgInit",lgBeforeOpen:"onLgOpen",lgAfterClose:"onLgClose"}),init(){this.listenTo(this.model,o.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 s;const a=this.getLightGallery();return((s=a==null?void 0:a.settings)==null?void 0:s.container)===this.el},onLgInit(a){this.el.__lg=a.detail.instance,!this.isInlineGallery()&&this.disableLgInCanvas()},onLgOpen(){const{em:a}=this,{Canvas:s}=a,h=this.getLightGallery();O=s.getSpots(),setTimeout(()=>s.removeSpots()),h.__lgOpened=!0},onLgClose(){const a=this.getLightGallery();O.forEach(s=>this.em.Canvas.addSpot(s.attributes)),O=[],a.__lgOpened=!1,setTimeout(()=>this.disableLgInCanvas())},toggleGallery(a){const s=this.getLightGallery();if(s.__lgOpened)return s.closeGallery(!0);s.lgOpened=!1,s.openGallery(a)}}});const H=D(Ee);o.addType(te,{isComponent:a=>W(a,ae)||a.tagName==="A"&&W(a.parentElement,B),extendFn:["init","initToolbar"],model:{defaults:{tagName:"a",name:g,icon:w.galleryItem,attributes:{[ae]:!0,href:p},components:{type:"image",attributes:{alt:"Image",src:p}},...H.props,traits:[...H.traits]},init(){const a=[y].map(s=>`change:${s}`).join(" ");this.initSourceType(),this.on(a,this.updateTraits),this.updateTraits({init:!0}),this.initScriptUpdate(),Ae(this,y,this.triggerGalleryUpdate)},initToolbar(){r(this)},initScriptUpdate(){const a=[le.name].map(s=>`change:attributes:${s}`).join(" ");this.on(a,this.triggerGalleryUpdate)},triggerGalleryUpdate(...a){var s;(s=this.closestType(T))==null||s.__scriptPropsChange(...a)},updateTraits(a={}){const{changed:s}=this,{init:h}=a;if(s[y]||h){q(this,y);const m=this.getTrait(y).getValue();if(m===E.image){this.removeAttributes([j.name,Q.name,N]);const P=this.getTrait(J.name);P.setValue(P.getValue()||p)}else m===E.video?this.removeAttributes([N]):m===E.external&&this.addAttributes({[N]:!0})}},initSourceType(){const a=this.getAttributes({noClass:!0,noStyle:!0});a[N]?this.set(y,E.external):(a[j.name]||a[Q.name])&&this.set(y,E.video)}}}),ve({editor:e,plan:Pe,licenseKey:c.licenseKey,pluginName:xe,cleanup:()=>{t.remove(T),o.removeType(T)}})})});
|
|
1
|
+
(function(L,G){typeof exports=="object"&&typeof module<"u"?module.exports=G():typeof define=="function"&&define.amd?define(G):(L=typeof globalThis<"u"?globalThis:L||self,L.StudioSdkPlugins_lightGalleryComponent=G())})(this,function(){"use strict";const L="app.grapesjs.com",G="app-stage.grapesjs.com",Y=[L,"app2.grapesjs.com",G,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io",".claudemcpcontent.com",".web-sandbox.oaiusercontent.com"],ge="license:check:end",he=()=>typeof window<"u",be=({isDev:e,isStage:o,isPlatform:t})=>`${e?"":`https://${o?G:L}`}/${t?"platform-api":"api"}`,de=()=>{if(!he())return"";const{hostname:e}=window.location;if(e)return e;try{return window.parent.location.hostname||""}catch{return""}},ye=()=>{const e=de();return!!e&&(Y.includes(e)||Y.some(o=>e.endsWith(o)))};async function me({path:e,baseApiUrl:o,method:t="GET",headers:l={},params:s,body:p}){const i=`${o||be({isDev:!1,isStage:!1})}${e}`,g={method:t,headers:{"Content-Type":"application/json",...l}};p&&(g.body=JSON.stringify(p));const u=s?new URLSearchParams(s).toString():"",b=u?`?${u}`:"",r=await fetch(`${i}${b}`,g);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return r.json()}var k=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(k||{}),F=(e=>(e.toastAdd="studio:toastAdd",e.toastRemove="studio:toastRemove",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",e.dialogExportCode="studio:dialogExportCode",e.dialogImportCode="studio:dialogImportCode",e.openEditCode="studio:openEditCode",e.openBlocks="studio:openBlocks",e.appendComponent="studio:appendComponent",e.sidebarLeftSet="studio:sidebarLeft:set",e.sidebarLeftGet="studio:sidebarLeft:get",e.sidebarLeftToggle="studio:sidebarLeft:toggle",e.sidebarRightSet="studio:sidebarRight:set",e.sidebarRightGet="studio:sidebarRight:get",e.sidebarRightToggle="studio:sidebarRight:toggle",e.sidebarTopSet="studio:sidebarTop:set",e.sidebarTopGet="studio:sidebarTop:get",e.sidebarTopToggle="studio:sidebarTop:toggle",e.sidebarBottomSet="studio:sidebarBottom:set",e.sidebarBottomGet="studio:sidebarBottom:get",e.sidebarBottomToggle="studio:sidebarBottom:toggle",e.symbolAdd="studio:symbolAdd",e.symbolDetach="studio:symbolDetach",e.symbolOverride="studio:symbolOverride",e.symbolPropagateStyles="studio:propagateStyles",e.getPagesConfig="studio:getPagesConfig",e.setPagesConfig="studio:setPagesConfig",e.getPageSettings="studio:getPageSettings",e.setPageSettings="studio:setPageSettings",e.clearPage="studio:clearPage",e.projectFiles="studio:projectFiles",e.validateCode="studio:validateCode",e.canvasReload="studio:canvasReload",e.getBlocksPanel="studio:getBlocksPanel",e.setBlocksPanel="studio:setBlocksPanel",e.getStateContextMenu="studio:getStateContextMenu",e.setStateContextMenu="studio:setStateContextMenu",e.contextMenuComponent="studio:contextMenuComponent",e.layoutAdd="studio:layoutAdd",e.layoutRemove="studio:layoutRemove",e.layoutToggle="studio:layoutToggle",e.layoutUpdate="studio:layoutUpdate",e.layoutGet="studio:layoutGet",e.layoutConfigGet="studio:layoutConfigGet",e.layoutConfigSet="studio:layoutConfigSet",e.layoutComponentAdd="studio:layoutComponentAdd",e.layoutComponentGet="studio:layoutComponentGet",e.layoutComponentRemove="studio:layoutComponentRemove",e.layoutComponentRender="studio:layoutComponentRender",e.getStateTheme="studio:getStateTheme",e.setStateTheme="studio:setStateTheme",e.settings="studio:settings",e.assetProviderGet="studio:assetProviderGet",e.assetProviderAdd="studio:assetProviderAdd",e.assetProviderRemove="studio:assetProviderRemove",e.fontGet="studio:fontGet",e.fontAdd="studio:fontAdd",e.fontRemove="studio:fontRemove",e.fontManagerOpen="studio:fontManagerOpen",e.menuFontLoad="studio:menuFontLoad",e.toggleStateDataSource="studio:toggleStateDataSource",e.getStateDataSource="studio:getStateDataSource",e.dataSourceSetGlobalData="studio:dataSourceSetGlobalData",e.dataSourceSetImporter="studio:dataSourceSetImporter",e.dataSourceSetExporter="studio:dataSourceSetExporter",e.setDragAbsolute="studio:setDragAbsolute",e))(F||{});const ee={[k.free]:0,[k.startup]:10,[k.business]:20,[k.enterprise]:30};function fe(e,o){const t=e;return t.init=l=>{const s=p=>e(p,l);return s.__gjsPluginId=o,s},t}const ve=(e,o)=>fe(e,o);async function Te({editor:e,plan:o,pluginName:t,licenseKey:l,onLicenseCheckResponse:s,cleanup:p}){let c="",i;const g=r=>{console.warn("Cleanup plugin:",t,"Reason:",r),p(e,t)},u=(r={})=>{var M;const{error:O,sdkLicense:V}=r,x=(M=r.plan)==null?void 0:M.category;if(!(V||r.license)||O)g(O||"Invalid license");else if(x){const _=ee[o],H=ee[x];_>H&&g({pluginRequiredPlan:o,licensePlan:x})}};e.Commands.has(F.settings)&&(i=e.runCommand(F.settings),c=(i==null?void 0:i.baseUrl)||"");const b=r=>{s==null||s(r),r&&u(r)};if(!i){e.onReady(async()=>{if(!ye())if(l){const r=await xe({licenseKey:l,pluginName:t,baseApiUrl:c});b(r)}else g("The `licenseKey` option not provided")});return}if(i.licensePlan||i.licenseError){const r=we(i);b(r);return}e.on(ge,r=>b(r))}const we=e=>({sdkLicense:e.license,license:e.license,error:e.licenseError,plan:e.licensePlan});async function xe(e){const{licenseKey:o,pluginName:t,baseApiUrl:l}=e;try{return(await me({baseApiUrl:l,path:`/sdk/${o||"na"}`,method:"POST",params:{d:window.location.hostname,pn:t}})).result||{}}catch(s){return console.error("Error during SDK license check:",s),!1}}const W=(e,o)=>{var t;return!!((t=e==null?void 0:e.hasAttribute)!=null&&t.call(e,o))},te="lightGalleryComponent",Pe=k.startup;var E=(e=>(e.image="image",e.video="video",e.external="external",e))(E||{});const T="lightGallery",ae=`${T}-item`,B="data-lightgallery",oe=`${B}-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>'},Z={propKeys:[],props:{},traits:[]},D=(e,o={})=>{var s;const t={},l=[];for(const p in e){const{value:c,...i}=e[p];l.push({id:p,name:p,changeProp:!0,category:o.category,...i}),t[p]=c;const{subTraits:g={}}=i;for(const u in i.subTraits)(s=g[u])==null||s.forEach(b=>{const r=b.id||b.name;t[r]=b.value})}return{propKeys:Object.keys(t),props:t,traits:l}},q=(e,o)=>{const t=e.getTrait(o),l=t.get("category"),s=t.get("subTraits")||{},c=(Object.values(s).flat()||[]).map(u=>u.id||u.name);e.removeTrait(c);const i=s[t.getValue()],g=e.getTraitIndex(o)+1;i&&e.addTrait(i.map(u=>({category:l,...u})),{at:g})},C=(e,o)=>{o.forEach(t=>{const l=e.getTrait(t);if(!l||!l.get("subTraits"))return;const s=l.changeProp?`change:${t}`:`change:attributes:${t}`;e.on(s,()=>q(e,t)),q(e,t)})},Ae=(e,o,t)=>{const s=e.getTrait(o).get("subTraits")||{},c=(Object.values(s).flat()||[]).map(g=>{const u=g.name||g.id;return g.changeProp?`change:${u}`:`change:attributes:${u}`}),i=Array.from(new Set(c));i.length&&e.on(i.join(" "),t)},Ie={[$]:{type:"button",label:"Toggle Gallery",command:(e,o)=>{var t,l;return(l=(t=o.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}},Le={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"}]}}},Ge={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}]}}},y="sourceType",j="data-iframe",J={name:"href",type:"file",label:"Image Source"},N={name:"data-src",label:"Video Source",placeholder:"https://www.youtube.com/watch?v=..."},Q={name:"data-poster",label:"Video Poster",type:"file"},le={name:"data-src",label:"External Source",placeholder:"https://some-external-source.com/...."},se={label:"Caption",name:"data-sub-html",placeholder:"My caption",changeProp:!1},Ee={[$]:{type:"button",label:"Toggle Gallery",command:(e,o)=>{var s,p;const t=o.target,l=(s=t==null?void 0:t.closestType(T))==null?void 0:s.getView();if(l&&t){const c=((p=l.getLightGallery())==null?void 0:p.items)||[],i=Array.from(c).indexOf(t.getEl());i>=0&&l.toggleGallery(i)}}},[y]:{type:"radio",label:"Source type",labelToTitle:!0,value:"image",subTraits:{image:[J],video:[N,Q],external:[le]},options:[{id:"image",label:J.label||"",icon:w.image},{id:"video",label:N.label||"",icon:w.video},{id:"external",label:le.label||"",icon:w.external}]},subHtml:se},ne="lgThumbnail",Se="lgVideo",ie="lgAutoplay",re="lgZoom",S="https://cdn.jsdelivr.net/npm/lightgallery@2.8.2";return ve(function(e,o={}){const{Blocks:t,Components:l}=e,s="LightGallery",p="LightGallery Item",c={toolbarIconOpen:w.eye,block:{},lgLicenseKey:"92DE1DB8-7986-4F02-B908-514F97678D28",defaultSrc:"https://placehold.co/200/777/white.png?text=Image",plugins:[ne,Se,ie,re],cdnScript:[`${S}/lightgallery.min.js`,`${S}/plugins/thumbnail/lg-thumbnail.min.js`,`${S}/plugins/video/lg-video.min.js`,`${S}/plugins/autoplay/lg-autoplay.min.js`,`${S}/plugins/zoom/lg-zoom.min.js`],cdnStyle:`${S}/css/lightgallery-bundle.min.css`,...o},{block:i,toolbarIconOpen:g,defaultSrc:u}=c,b=function(a){const n=this,h=window,{plugins:m,cdnScript:P,cdnStyle:R,inline:ce,lgLicenseKey:Oe,...f}=a||{},A=d=>isNaN(d)?void 0:parseInt(d,10),pe=()=>{var K;const d={...f,licenseKey:Oe,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:(m||[]).map(z=>h[z])};ce&&(d.container=n,d.closable=!1);const X=(K=h.lightGallery)==null?void 0:K.call(h,n,d);ce&&X.openGallery()};if(h.lightGallery)pe();else{const{head:d}=document,X=Array.isArray(P)?[...P]:[P],K=Array.isArray(R)?[...R]:[R],z=I=>{if(I.length){const v=document.createElement("link");v.href=I.shift(),v.rel="stylesheet",d.appendChild(v),z(I)}},ue=I=>{if(I.length){const v=document.createElement("script");v.src=I.shift(),v.onerror=v.onload=ue.bind(null,I),d.appendChild(v)}else pe()};z(K),ue(X)}},r=a=>{const n=a.getTrait($);if(!g||!n)return;const{toolbar:h}=a,m={id:$,label:g,command:()=>setTimeout(()=>n.runCommand(),100)};!h.find(R=>R.id===m.id)&&(h==null||h.unshift(m))};let O=[];const V=c.plugins||[],x=D(Ie),U=V.includes(ne)?D(Le):Z,M=V.includes(ie)?D(Ge):Z,_=V.includes(re)?D(ke):Z;l.addType(T,{block:i&&{label:s,media:w.gallery,category:"Extra",select:!0,...c.block},isComponent:a=>W(a,B),extendFn:["init","initToolbar"],model:{defaults:{name:s,icon:w.gallery,draggable:(a,n)=>!n.is(T),attributes:{[B]:!0},components:{type:ae},script:b,selector:"",exThumbImage:"",cdnScript:c.cdnScript,cdnStyle:c.cdnStyle,plugins:c.plugins,lgLicenseKey:c.lgLicenseKey,"script-props":["lgLicenseKey","cdnScript","cdnStyle","plugins","selector","exThumbImage",...x.propKeys,...U.propKeys,...M.propKeys,..._.propKeys],...x.props,...U.props,...M.props,..._.props,traits:[...x.traits,...U.traits,...M.traits,..._.traits]},init(){C(this,["thumbnail"]),C(this,["autoplay"]),C(this,["zoom"])},initToolbar(){r(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 n;const a=this.getLightGallery();return((n=a==null?void 0:a.settings)==null?void 0:n.container)===this.el},onLgInit(a){this.el.__lg=a.detail.instance,!this.isInlineGallery()&&this.disableLgInCanvas()},onLgOpen(){const{em:a}=this,{Canvas:n}=a,h=this.getLightGallery();O=n.getSpots(),setTimeout(()=>n.removeSpots()),h.__lgOpened=!0},onLgClose(){const a=this.getLightGallery();O.forEach(n=>this.em.Canvas.addSpot(n.attributes)),O=[],a.__lgOpened=!1,setTimeout(()=>this.disableLgInCanvas())},toggleGallery(a){const n=this.getLightGallery();if(n.__lgOpened)return n.closeGallery(!0);n.lgOpened=!1,n.openGallery(a)}}});const H=D(Ee);l.addType(ae,{isComponent:a=>W(a,oe)||a.tagName==="A"&&W(a.parentElement,B),extendFn:["init","initToolbar"],model:{defaults:{tagName:"a",name:p,icon:w.galleryItem,attributes:{[oe]:!0,href:u},components:{type:"image",attributes:{alt:"Image",src:u}},...H.props,traits:[...H.traits]},init(){const a=[y].map(n=>`change:${n}`).join(" ");this.initSourceType(),this.on(a,this.updateTraits),this.updateTraits({init:!0}),this.initScriptUpdate(),Ae(this,y,this.triggerGalleryUpdate)},initToolbar(){r(this)},initScriptUpdate(){const a=[se.name].map(n=>`change:attributes:${n}`).join(" ");this.on(a,this.triggerGalleryUpdate)},triggerGalleryUpdate(...a){var n;(n=this.closestType(T))==null||n.__scriptPropsChange(...a)},updateTraits(a={}){const{changed:n}=this,{init:h}=a;if(n[y]||h){q(this,y);const m=this.getTrait(y).getValue();if(m===E.image){this.removeAttributes([N.name,Q.name,j]);const P=this.getTrait(J.name);P.setValue(P.getValue()||u)}else m===E.video?this.removeAttributes([j]):m===E.external&&this.addAttributes({[j]:!0})}},initSourceType(){const a=this.getAttributes({noClass:!0,noStyle:!0});a[j]?this.set(y,E.external):(a[N.name]||a[Q.name])&&this.set(y,E.video)}}}),Te({editor:e,plan:Pe,licenseKey:c.licenseKey,pluginName:te,cleanup:()=>{t.remove(T),l.removeType(T)}})},te)});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StudioTraitProperties } from '@studio/
|
|
1
|
+
import { StudioTraitProperties } from '@grapesjs/studio-sdk/dist/typeConfigs/components';
|
|
2
2
|
import { Component, TraitProperties } from 'grapesjs';
|
|
3
3
|
type TraitProps = Record<string, Partial<StudioTraitProperties>>;
|
|
4
4
|
export declare enum SourceTypes {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const w="app.grapesjs.com",D="app-stage.grapesjs.com",G="app2.grapesjs.com",
|
|
1
|
+
"use strict";const w="app.grapesjs.com",D="app-stage.grapesjs.com",G="app2.grapesjs.com",I="app-stage2.grapesjs.com",P=[w,G,D,I,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io",".claudemcpcontent.com",".web-sandbox.oaiusercontent.com"],L="license:check:end",x=()=>typeof window<"u",E=({isDev:e,isStage:n,isPlatform:a})=>`${e?"":`https://${n?D:w}`}/${a?"platform-api":"api"}`,B=()=>{if(!x())return"";const{hostname:e}=window.location;if(e)return e;try{return window.parent.location.hostname||""}catch{return""}},M=()=>{const e=B();return!!e&&(P.includes(e)||P.some(n=>e.endsWith(n)))};async function O({path:e,baseApiUrl:n,method:a="GET",headers:r={},params:s,body:c}){const i=`${n||E({isDev:!1,isStage:!1})}${e}`,g={method:a,headers:{"Content-Type":"application/json",...r}};c&&(g.body=JSON.stringify(c));const d=s?new URLSearchParams(s).toString():"",u=d?`?${d}`:"",o=await fetch(`${i}${u}`,g);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return o.json()}var b=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(b||{}),T=(e=>(e.toastAdd="studio:toastAdd",e.toastRemove="studio:toastRemove",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",e.dialogExportCode="studio:dialogExportCode",e.dialogImportCode="studio:dialogImportCode",e.openEditCode="studio:openEditCode",e.openBlocks="studio:openBlocks",e.appendComponent="studio:appendComponent",e.sidebarLeftSet="studio:sidebarLeft:set",e.sidebarLeftGet="studio:sidebarLeft:get",e.sidebarLeftToggle="studio:sidebarLeft:toggle",e.sidebarRightSet="studio:sidebarRight:set",e.sidebarRightGet="studio:sidebarRight:get",e.sidebarRightToggle="studio:sidebarRight:toggle",e.sidebarTopSet="studio:sidebarTop:set",e.sidebarTopGet="studio:sidebarTop:get",e.sidebarTopToggle="studio:sidebarTop:toggle",e.sidebarBottomSet="studio:sidebarBottom:set",e.sidebarBottomGet="studio:sidebarBottom:get",e.sidebarBottomToggle="studio:sidebarBottom:toggle",e.symbolAdd="studio:symbolAdd",e.symbolDetach="studio:symbolDetach",e.symbolOverride="studio:symbolOverride",e.symbolPropagateStyles="studio:propagateStyles",e.getPagesConfig="studio:getPagesConfig",e.setPagesConfig="studio:setPagesConfig",e.getPageSettings="studio:getPageSettings",e.setPageSettings="studio:setPageSettings",e.clearPage="studio:clearPage",e.projectFiles="studio:projectFiles",e.validateCode="studio:validateCode",e.canvasReload="studio:canvasReload",e.getBlocksPanel="studio:getBlocksPanel",e.setBlocksPanel="studio:setBlocksPanel",e.getStateContextMenu="studio:getStateContextMenu",e.setStateContextMenu="studio:setStateContextMenu",e.contextMenuComponent="studio:contextMenuComponent",e.layoutAdd="studio:layoutAdd",e.layoutRemove="studio:layoutRemove",e.layoutToggle="studio:layoutToggle",e.layoutUpdate="studio:layoutUpdate",e.layoutGet="studio:layoutGet",e.layoutConfigGet="studio:layoutConfigGet",e.layoutConfigSet="studio:layoutConfigSet",e.layoutComponentAdd="studio:layoutComponentAdd",e.layoutComponentGet="studio:layoutComponentGet",e.layoutComponentRemove="studio:layoutComponentRemove",e.layoutComponentRender="studio:layoutComponentRender",e.getStateTheme="studio:getStateTheme",e.setStateTheme="studio:setStateTheme",e.settings="studio:settings",e.assetProviderGet="studio:assetProviderGet",e.assetProviderAdd="studio:assetProviderAdd",e.assetProviderRemove="studio:assetProviderRemove",e.fontGet="studio:fontGet",e.fontAdd="studio:fontAdd",e.fontRemove="studio:fontRemove",e.fontManagerOpen="studio:fontManagerOpen",e.menuFontLoad="studio:menuFontLoad",e.toggleStateDataSource="studio:toggleStateDataSource",e.getStateDataSource="studio:getStateDataSource",e.dataSourceSetGlobalData="studio:dataSourceSetGlobalData",e.dataSourceSetImporter="studio:dataSourceSetImporter",e.dataSourceSetExporter="studio:dataSourceSetExporter",e.setDragAbsolute="studio:setDragAbsolute",e))(T||{});const A={[b.free]:0,[b.startup]:10,[b.business]:20,[b.enterprise]:30};function N(e,n){const a=e;return a.init=r=>{const s=c=>e(c,r);return s.__gjsPluginId=n,s},a}const U=(e,n)=>N(e,n);async function $({editor:e,plan:n,pluginName:a,licenseKey:r,onLicenseCheckResponse:s,cleanup:c}){let p="",i;const g=o=>{console.warn("Cleanup plugin:",a,"Reason:",o),c(e,a)},d=(o={})=>{var y;const{error:f,sdkLicense:t}=o,l=(y=o.plan)==null?void 0:y.category;if(!(t||o.license)||f)g(f||"Invalid license");else if(l){const v=A[n],k=A[l];v>k&&g({pluginRequiredPlan:n,licensePlan:l})}};e.Commands.has(T.settings)&&(i=e.runCommand(T.settings),p=(i==null?void 0:i.baseUrl)||"");const u=o=>{s==null||s(o),o&&d(o)};if(!i){e.onReady(async()=>{if(!M())if(r){const o=await _({licenseKey:r,pluginName:a,baseApiUrl:p});u(o)}else g("The `licenseKey` option not provided")});return}if(i.licensePlan||i.licenseError){const o=j(i);u(o);return}e.on(L,o=>u(o))}const j=e=>({sdkLicense:e.license,license:e.license,error:e.licenseError,plan:e.licensePlan});async function _(e){const{licenseKey:n,pluginName:a,baseApiUrl:r}=e;try{return(await O({baseApiUrl:r,path:`/sdk/${n||"na"}`,method:"POST",params:{d:window.location.hostname,pn:a}})).result||{}}catch(s){return console.error("Error during SDK license check:",s),!1}}const R="linkImageComponent",F=b.startup,W=function(e,n={}){const{Components:a,Blocks:r}=e,s="link-image",c="Link Image",p="link-image",{model:i,view:g}=e.Components.getType("image"),d=a.getType("link").model.getDefaults().traits,u=i.getDefaults().traits,o=d.filter(t=>t!=="title"),f=u.filter(t=>t.name!=="customAttributes").map(t=>typeof t=="string"?{name:t}:t).map(t=>({...t,getValue({component:l}){var h;return(h=l.components().at(0).getTrait(t.name))==null?void 0:h.getValue()},setValue({component:l,value:h,options:y}){var v;(v=l.components().at(0).getTrait(t.name))==null||v.setValue(h,y)}}));a.addType(s,{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:[...f,...o],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 t=this.components().at(0);t==null||t.set({layerable:!1,locked:!0})}},view:{onActive(t){
|
|
12
|
+
`},init(){const t=this.components().at(0);t==null||t.set({layerable:!1,locked:!0})}},view:{onActive(t){g.prototype.onActive.call(this,t)}}}),$({editor:e,licenseKey:n.licenseKey,plan:F,pluginName:R,cleanup:()=>{a.removeType(s),r.remove(s)}})},H=U(W,R);module.exports=H;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const w = "app.grapesjs.com", D = "app-stage.grapesjs.com", G = "app2.grapesjs.com",
|
|
1
|
+
const w = "app.grapesjs.com", D = "app-stage.grapesjs.com", G = "app2.grapesjs.com", I = "app-stage2.grapesjs.com", P = [
|
|
2
2
|
w,
|
|
3
3
|
G,
|
|
4
4
|
D,
|
|
5
|
-
|
|
5
|
+
I,
|
|
6
6
|
"localhost",
|
|
7
7
|
"127.0.0.1",
|
|
8
8
|
".local-credentialless.webcontainer.io",
|
|
@@ -15,12 +15,12 @@ const w = "app.grapesjs.com", D = "app-stage.grapesjs.com", G = "app2.grapesjs.c
|
|
|
15
15
|
// For Claude mcp app
|
|
16
16
|
".web-sandbox.oaiusercontent.com"
|
|
17
17
|
// For OpenAI mcp app
|
|
18
|
-
],
|
|
18
|
+
], L = "license:check:end", x = () => typeof window < "u", E = ({
|
|
19
19
|
isDev: e,
|
|
20
|
-
isStage:
|
|
21
|
-
isPlatform:
|
|
22
|
-
}) => `${e ? "" : `https://${
|
|
23
|
-
if (!
|
|
20
|
+
isStage: a,
|
|
21
|
+
isPlatform: n
|
|
22
|
+
}) => `${e ? "" : `https://${a ? D : w}`}/${n ? "platform-api" : "api"}`, B = () => {
|
|
23
|
+
if (!x()) return "";
|
|
24
24
|
const { hostname: e } = window.location;
|
|
25
25
|
if (e) return e;
|
|
26
26
|
try {
|
|
@@ -29,109 +29,112 @@ const w = "app.grapesjs.com", D = "app-stage.grapesjs.com", G = "app2.grapesjs.c
|
|
|
29
29
|
return "";
|
|
30
30
|
}
|
|
31
31
|
}, M = () => {
|
|
32
|
-
const e =
|
|
33
|
-
return !!e && (P.includes(e) || P.some((
|
|
32
|
+
const e = B();
|
|
33
|
+
return !!e && (P.includes(e) || P.some((a) => e.endsWith(a)));
|
|
34
34
|
};
|
|
35
|
-
async function
|
|
35
|
+
async function O({
|
|
36
36
|
path: e,
|
|
37
|
-
baseApiUrl:
|
|
38
|
-
method:
|
|
37
|
+
baseApiUrl: a,
|
|
38
|
+
method: n = "GET",
|
|
39
39
|
headers: r = {},
|
|
40
|
-
params:
|
|
41
|
-
body:
|
|
40
|
+
params: s,
|
|
41
|
+
body: c
|
|
42
42
|
}) {
|
|
43
|
-
const i = `${
|
|
44
|
-
method:
|
|
43
|
+
const i = `${a || E({ isDev: !1, isStage: !1 })}${e}`, g = {
|
|
44
|
+
method: n,
|
|
45
45
|
headers: {
|
|
46
46
|
"Content-Type": "application/json",
|
|
47
47
|
...r
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
|
-
|
|
51
|
-
const d =
|
|
50
|
+
c && (g.body = JSON.stringify(c));
|
|
51
|
+
const d = s ? new URLSearchParams(s).toString() : "", u = d ? `?${d}` : "", o = await fetch(`${i}${u}`, g);
|
|
52
52
|
if (!o.ok)
|
|
53
53
|
throw new Error(`HTTP error! status: ${o.status}`);
|
|
54
54
|
return o.json();
|
|
55
55
|
}
|
|
56
|
-
var b = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(b || {}), T = /* @__PURE__ */ ((e) => (e.toastAdd = "studio:toastAdd", e.toastRemove = "studio:toastRemove", e.dialogOpen = "studio:dialogOpen", e.dialogClose = "studio:dialogClose", e.dialogExportCode = "studio:dialogExportCode", e.dialogImportCode = "studio:dialogImportCode", e.openEditCode = "studio:openEditCode", e.sidebarLeftSet = "studio:sidebarLeft:set", e.sidebarLeftGet = "studio:sidebarLeft:get", e.sidebarLeftToggle = "studio:sidebarLeft:toggle", e.sidebarRightSet = "studio:sidebarRight:set", e.sidebarRightGet = "studio:sidebarRight:get", e.sidebarRightToggle = "studio:sidebarRight:toggle", e.sidebarTopSet = "studio:sidebarTop:set", e.sidebarTopGet = "studio:sidebarTop:get", e.sidebarTopToggle = "studio:sidebarTop:toggle", e.sidebarBottomSet = "studio:sidebarBottom:set", e.sidebarBottomGet = "studio:sidebarBottom:get", e.sidebarBottomToggle = "studio:sidebarBottom:toggle", e.symbolAdd = "studio:symbolAdd", e.symbolDetach = "studio:symbolDetach", e.symbolOverride = "studio:symbolOverride", e.symbolPropagateStyles = "studio:propagateStyles", e.getPagesConfig = "studio:getPagesConfig", e.setPagesConfig = "studio:setPagesConfig", e.getPageSettings = "studio:getPageSettings", e.setPageSettings = "studio:setPageSettings", e.clearPage = "studio:clearPage", e.projectFiles = "studio:projectFiles", e.validateCode = "studio:validateCode", e.canvasReload = "studio:canvasReload", e.getBlocksPanel = "studio:getBlocksPanel", e.setBlocksPanel = "studio:setBlocksPanel", e.getStateContextMenu = "studio:getStateContextMenu", e.setStateContextMenu = "studio:setStateContextMenu", e.contextMenuComponent = "studio:contextMenuComponent", e.layoutAdd = "studio:layoutAdd", e.layoutRemove = "studio:layoutRemove", e.layoutToggle = "studio:layoutToggle", e.layoutUpdate = "studio:layoutUpdate", e.layoutGet = "studio:layoutGet", e.layoutConfigGet = "studio:layoutConfigGet", e.layoutConfigSet = "studio:layoutConfigSet", e.layoutComponentAdd = "studio:layoutComponentAdd", e.layoutComponentGet = "studio:layoutComponentGet", e.layoutComponentRemove = "studio:layoutComponentRemove", e.layoutComponentRender = "studio:layoutComponentRender", e.getStateTheme = "studio:getStateTheme", e.setStateTheme = "studio:setStateTheme", e.settings = "studio:settings", e.assetProviderGet = "studio:assetProviderGet", e.assetProviderAdd = "studio:assetProviderAdd", e.assetProviderRemove = "studio:assetProviderRemove", e.fontGet = "studio:fontGet", e.fontAdd = "studio:fontAdd", e.fontRemove = "studio:fontRemove", e.fontManagerOpen = "studio:fontManagerOpen", e.menuFontLoad = "studio:menuFontLoad", e.toggleStateDataSource = "studio:toggleStateDataSource", e.getStateDataSource = "studio:getStateDataSource", e.dataSourceSetGlobalData = "studio:dataSourceSetGlobalData", e.dataSourceSetImporter = "studio:dataSourceSetImporter", e.dataSourceSetExporter = "studio:dataSourceSetExporter", e.setDragAbsolute = "studio:setDragAbsolute", e))(T || {});
|
|
56
|
+
var b = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(b || {}), T = /* @__PURE__ */ ((e) => (e.toastAdd = "studio:toastAdd", e.toastRemove = "studio:toastRemove", e.dialogOpen = "studio:dialogOpen", e.dialogClose = "studio:dialogClose", e.dialogExportCode = "studio:dialogExportCode", e.dialogImportCode = "studio:dialogImportCode", e.openEditCode = "studio:openEditCode", e.openBlocks = "studio:openBlocks", e.appendComponent = "studio:appendComponent", e.sidebarLeftSet = "studio:sidebarLeft:set", e.sidebarLeftGet = "studio:sidebarLeft:get", e.sidebarLeftToggle = "studio:sidebarLeft:toggle", e.sidebarRightSet = "studio:sidebarRight:set", e.sidebarRightGet = "studio:sidebarRight:get", e.sidebarRightToggle = "studio:sidebarRight:toggle", e.sidebarTopSet = "studio:sidebarTop:set", e.sidebarTopGet = "studio:sidebarTop:get", e.sidebarTopToggle = "studio:sidebarTop:toggle", e.sidebarBottomSet = "studio:sidebarBottom:set", e.sidebarBottomGet = "studio:sidebarBottom:get", e.sidebarBottomToggle = "studio:sidebarBottom:toggle", e.symbolAdd = "studio:symbolAdd", e.symbolDetach = "studio:symbolDetach", e.symbolOverride = "studio:symbolOverride", e.symbolPropagateStyles = "studio:propagateStyles", e.getPagesConfig = "studio:getPagesConfig", e.setPagesConfig = "studio:setPagesConfig", e.getPageSettings = "studio:getPageSettings", e.setPageSettings = "studio:setPageSettings", e.clearPage = "studio:clearPage", e.projectFiles = "studio:projectFiles", e.validateCode = "studio:validateCode", e.canvasReload = "studio:canvasReload", e.getBlocksPanel = "studio:getBlocksPanel", e.setBlocksPanel = "studio:setBlocksPanel", e.getStateContextMenu = "studio:getStateContextMenu", e.setStateContextMenu = "studio:setStateContextMenu", e.contextMenuComponent = "studio:contextMenuComponent", e.layoutAdd = "studio:layoutAdd", e.layoutRemove = "studio:layoutRemove", e.layoutToggle = "studio:layoutToggle", e.layoutUpdate = "studio:layoutUpdate", e.layoutGet = "studio:layoutGet", e.layoutConfigGet = "studio:layoutConfigGet", e.layoutConfigSet = "studio:layoutConfigSet", e.layoutComponentAdd = "studio:layoutComponentAdd", e.layoutComponentGet = "studio:layoutComponentGet", e.layoutComponentRemove = "studio:layoutComponentRemove", e.layoutComponentRender = "studio:layoutComponentRender", e.getStateTheme = "studio:getStateTheme", e.setStateTheme = "studio:setStateTheme", e.settings = "studio:settings", e.assetProviderGet = "studio:assetProviderGet", e.assetProviderAdd = "studio:assetProviderAdd", e.assetProviderRemove = "studio:assetProviderRemove", e.fontGet = "studio:fontGet", e.fontAdd = "studio:fontAdd", e.fontRemove = "studio:fontRemove", e.fontManagerOpen = "studio:fontManagerOpen", e.menuFontLoad = "studio:menuFontLoad", e.toggleStateDataSource = "studio:toggleStateDataSource", e.getStateDataSource = "studio:getStateDataSource", e.dataSourceSetGlobalData = "studio:dataSourceSetGlobalData", e.dataSourceSetImporter = "studio:dataSourceSetImporter", e.dataSourceSetExporter = "studio:dataSourceSetExporter", e.setDragAbsolute = "studio:setDragAbsolute", e))(T || {});
|
|
57
57
|
const A = {
|
|
58
58
|
[b.free]: 0,
|
|
59
59
|
[b.startup]: 10,
|
|
60
60
|
[b.business]: 20,
|
|
61
61
|
[b.enterprise]: 30
|
|
62
62
|
};
|
|
63
|
-
function
|
|
64
|
-
const
|
|
65
|
-
return
|
|
63
|
+
function N(e, a) {
|
|
64
|
+
const n = e;
|
|
65
|
+
return n.init = (r) => {
|
|
66
|
+
const s = (c) => e(c, r);
|
|
67
|
+
return s.__gjsPluginId = a, s;
|
|
68
|
+
}, n;
|
|
66
69
|
}
|
|
67
|
-
const
|
|
68
|
-
async function
|
|
70
|
+
const U = (e, a) => /* @__PURE__ */ N(e, a);
|
|
71
|
+
async function $({
|
|
69
72
|
editor: e,
|
|
70
|
-
plan:
|
|
71
|
-
pluginName:
|
|
73
|
+
plan: a,
|
|
74
|
+
pluginName: n,
|
|
72
75
|
licenseKey: r,
|
|
73
|
-
onLicenseCheckResponse:
|
|
74
|
-
cleanup:
|
|
76
|
+
onLicenseCheckResponse: s,
|
|
77
|
+
cleanup: c
|
|
75
78
|
}) {
|
|
76
79
|
let p = "", i;
|
|
77
|
-
const
|
|
78
|
-
console.warn("Cleanup plugin:",
|
|
80
|
+
const g = (o) => {
|
|
81
|
+
console.warn("Cleanup plugin:", n, "Reason:", o), c(e, n);
|
|
79
82
|
}, d = (o = {}) => {
|
|
80
83
|
var y;
|
|
81
84
|
const { error: f, sdkLicense: t } = o, l = (y = o.plan) == null ? void 0 : y.category;
|
|
82
85
|
if (!(t || o.license) || f)
|
|
83
|
-
|
|
86
|
+
g(f || "Invalid license");
|
|
84
87
|
else if (l) {
|
|
85
|
-
const v = A[
|
|
86
|
-
v >
|
|
88
|
+
const v = A[a], k = A[l];
|
|
89
|
+
v > k && g({ pluginRequiredPlan: a, licensePlan: l });
|
|
87
90
|
}
|
|
88
91
|
};
|
|
89
92
|
e.Commands.has(T.settings) && (i = e.runCommand(T.settings), p = (i == null ? void 0 : i.baseUrl) || "");
|
|
90
93
|
const u = (o) => {
|
|
91
|
-
|
|
94
|
+
s == null || s(o), o && d(o);
|
|
92
95
|
};
|
|
93
96
|
if (!i) {
|
|
94
97
|
e.onReady(async () => {
|
|
95
98
|
if (!M())
|
|
96
99
|
if (r) {
|
|
97
|
-
const o = await
|
|
100
|
+
const o = await _({ licenseKey: r, pluginName: n, baseApiUrl: p });
|
|
98
101
|
u(o);
|
|
99
102
|
} else
|
|
100
|
-
|
|
103
|
+
g("The `licenseKey` option not provided");
|
|
101
104
|
});
|
|
102
105
|
return;
|
|
103
106
|
}
|
|
104
107
|
if (i.licensePlan || i.licenseError) {
|
|
105
|
-
const o =
|
|
108
|
+
const o = j(i);
|
|
106
109
|
u(o);
|
|
107
110
|
return;
|
|
108
111
|
}
|
|
109
|
-
e.on(
|
|
112
|
+
e.on(L, (o) => u(o));
|
|
110
113
|
}
|
|
111
|
-
const
|
|
114
|
+
const j = (e) => ({
|
|
112
115
|
sdkLicense: e.license,
|
|
113
116
|
license: e.license,
|
|
114
117
|
error: e.licenseError,
|
|
115
118
|
plan: e.licensePlan
|
|
116
119
|
});
|
|
117
|
-
async function
|
|
118
|
-
const { licenseKey:
|
|
120
|
+
async function _(e) {
|
|
121
|
+
const { licenseKey: a, pluginName: n, baseApiUrl: r } = e;
|
|
119
122
|
try {
|
|
120
|
-
return (await
|
|
123
|
+
return (await O({
|
|
121
124
|
baseApiUrl: r,
|
|
122
|
-
path: `/sdk/${
|
|
125
|
+
path: `/sdk/${a || "na"}`,
|
|
123
126
|
method: "POST",
|
|
124
127
|
params: {
|
|
125
128
|
d: window.location.hostname,
|
|
126
|
-
pn:
|
|
129
|
+
pn: n
|
|
127
130
|
}
|
|
128
131
|
})).result || {};
|
|
129
|
-
} catch (
|
|
130
|
-
return console.error("Error during SDK license check:",
|
|
132
|
+
} catch (s) {
|
|
133
|
+
return console.error("Error during SDK license check:", s), !1;
|
|
131
134
|
}
|
|
132
135
|
}
|
|
133
|
-
const
|
|
134
|
-
const { Components:
|
|
136
|
+
const R = "linkImageComponent", F = b.startup, W = function(e, a = {}) {
|
|
137
|
+
const { Components: n, Blocks: r } = e, s = "link-image", c = "Link Image", p = "link-image", { model: i, view: g } = e.Components.getType("image"), d = n.getType("link").model.getDefaults().traits, u = i.getDefaults().traits, o = d.filter((t) => t !== "title"), f = u.filter((t) => t.name !== "customAttributes").map((t) => typeof t == "string" ? { name: t } : t).map(
|
|
135
138
|
(t) => ({
|
|
136
139
|
...t,
|
|
137
140
|
getValue({ component: l }) {
|
|
@@ -144,20 +147,20 @@ const _ = "linkImageComponent", F = b.startup, W = function(e, s = {}) {
|
|
|
144
147
|
}
|
|
145
148
|
})
|
|
146
149
|
);
|
|
147
|
-
|
|
150
|
+
n.addType(s, {
|
|
148
151
|
isComponent: (t) => {
|
|
149
152
|
var l;
|
|
150
153
|
return t.tagName === "A" && ((l = t.children) == null ? void 0 : l.length) === 1 && t.children[0].tagName === "IMG";
|
|
151
154
|
},
|
|
152
155
|
block: {
|
|
153
|
-
label:
|
|
156
|
+
label: c,
|
|
154
157
|
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>'
|
|
155
158
|
},
|
|
156
159
|
extend: "link",
|
|
157
160
|
extendFn: ["init"],
|
|
158
161
|
model: {
|
|
159
162
|
defaults: {
|
|
160
|
-
name:
|
|
163
|
+
name: c,
|
|
161
164
|
classes: p,
|
|
162
165
|
resizable: { ratioDefault: !0 },
|
|
163
166
|
traits: [...f, ...o],
|
|
@@ -202,19 +205,19 @@ const _ = "linkImageComponent", F = b.startup, W = function(e, s = {}) {
|
|
|
202
205
|
},
|
|
203
206
|
view: {
|
|
204
207
|
onActive(t) {
|
|
205
|
-
|
|
208
|
+
g.prototype.onActive.call(this, t);
|
|
206
209
|
}
|
|
207
210
|
}
|
|
208
|
-
}),
|
|
211
|
+
}), $({
|
|
209
212
|
editor: e,
|
|
210
|
-
licenseKey:
|
|
213
|
+
licenseKey: a.licenseKey,
|
|
211
214
|
plan: F,
|
|
212
|
-
pluginName:
|
|
215
|
+
pluginName: R,
|
|
213
216
|
cleanup: () => {
|
|
214
|
-
|
|
217
|
+
n.removeType(s), r.remove(s);
|
|
215
218
|
}
|
|
216
219
|
});
|
|
217
|
-
}, H =
|
|
220
|
+
}, H = U(W, R);
|
|
218
221
|
export {
|
|
219
222
|
H as default
|
|
220
223
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";const w="app.grapesjs.com",D="app-stage.grapesjs.com",G="app2.grapesjs.com",I="app-stage2.grapesjs.com",P=[w,G,D,I,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io",".claudemcpcontent.com",".web-sandbox.oaiusercontent.com"],L="license:check:end",x=()=>typeof window<"u",E=({isDev:e,isStage:n,isPlatform:a})=>`${e?"":`https://${n?D:w}`}/${a?"platform-api":"api"}`,B=()=>{if(!x())return"";const{hostname:e}=window.location;if(e)return e;try{return window.parent.location.hostname||""}catch{return""}},M=()=>{const e=B();return!!e&&(P.includes(e)||P.some(n=>e.endsWith(n)))};async function O({path:e,baseApiUrl:n,method:a="GET",headers:r={},params:s,body:c}){const i=`${n||E({isDev:!1,isStage:!1})}${e}`,g={method:a,headers:{"Content-Type":"application/json",...r}};c&&(g.body=JSON.stringify(c));const d=s?new URLSearchParams(s).toString():"",u=d?`?${d}`:"",o=await fetch(`${i}${u}`,g);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return o.json()}var b=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(b||{}),T=(e=>(e.toastAdd="studio:toastAdd",e.toastRemove="studio:toastRemove",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",e.dialogExportCode="studio:dialogExportCode",e.dialogImportCode="studio:dialogImportCode",e.openEditCode="studio:openEditCode",e.openBlocks="studio:openBlocks",e.appendComponent="studio:appendComponent",e.sidebarLeftSet="studio:sidebarLeft:set",e.sidebarLeftGet="studio:sidebarLeft:get",e.sidebarLeftToggle="studio:sidebarLeft:toggle",e.sidebarRightSet="studio:sidebarRight:set",e.sidebarRightGet="studio:sidebarRight:get",e.sidebarRightToggle="studio:sidebarRight:toggle",e.sidebarTopSet="studio:sidebarTop:set",e.sidebarTopGet="studio:sidebarTop:get",e.sidebarTopToggle="studio:sidebarTop:toggle",e.sidebarBottomSet="studio:sidebarBottom:set",e.sidebarBottomGet="studio:sidebarBottom:get",e.sidebarBottomToggle="studio:sidebarBottom:toggle",e.symbolAdd="studio:symbolAdd",e.symbolDetach="studio:symbolDetach",e.symbolOverride="studio:symbolOverride",e.symbolPropagateStyles="studio:propagateStyles",e.getPagesConfig="studio:getPagesConfig",e.setPagesConfig="studio:setPagesConfig",e.getPageSettings="studio:getPageSettings",e.setPageSettings="studio:setPageSettings",e.clearPage="studio:clearPage",e.projectFiles="studio:projectFiles",e.validateCode="studio:validateCode",e.canvasReload="studio:canvasReload",e.getBlocksPanel="studio:getBlocksPanel",e.setBlocksPanel="studio:setBlocksPanel",e.getStateContextMenu="studio:getStateContextMenu",e.setStateContextMenu="studio:setStateContextMenu",e.contextMenuComponent="studio:contextMenuComponent",e.layoutAdd="studio:layoutAdd",e.layoutRemove="studio:layoutRemove",e.layoutToggle="studio:layoutToggle",e.layoutUpdate="studio:layoutUpdate",e.layoutGet="studio:layoutGet",e.layoutConfigGet="studio:layoutConfigGet",e.layoutConfigSet="studio:layoutConfigSet",e.layoutComponentAdd="studio:layoutComponentAdd",e.layoutComponentGet="studio:layoutComponentGet",e.layoutComponentRemove="studio:layoutComponentRemove",e.layoutComponentRender="studio:layoutComponentRender",e.getStateTheme="studio:getStateTheme",e.setStateTheme="studio:setStateTheme",e.settings="studio:settings",e.assetProviderGet="studio:assetProviderGet",e.assetProviderAdd="studio:assetProviderAdd",e.assetProviderRemove="studio:assetProviderRemove",e.fontGet="studio:fontGet",e.fontAdd="studio:fontAdd",e.fontRemove="studio:fontRemove",e.fontManagerOpen="studio:fontManagerOpen",e.menuFontLoad="studio:menuFontLoad",e.toggleStateDataSource="studio:toggleStateDataSource",e.getStateDataSource="studio:getStateDataSource",e.dataSourceSetGlobalData="studio:dataSourceSetGlobalData",e.dataSourceSetImporter="studio:dataSourceSetImporter",e.dataSourceSetExporter="studio:dataSourceSetExporter",e.setDragAbsolute="studio:setDragAbsolute",e))(T||{});const A={[b.free]:0,[b.startup]:10,[b.business]:20,[b.enterprise]:30};function N(e,n){const a=e;return a.init=r=>{const s=c=>e(c,r);return s.__gjsPluginId=n,s},a}const U=(e,n)=>N(e,n);async function $({editor:e,plan:n,pluginName:a,licenseKey:r,onLicenseCheckResponse:s,cleanup:c}){let p="",i;const g=o=>{console.warn("Cleanup plugin:",a,"Reason:",o),c(e,a)},d=(o={})=>{var y;const{error:f,sdkLicense:t}=o,l=(y=o.plan)==null?void 0:y.category;if(!(t||o.license)||f)g(f||"Invalid license");else if(l){const v=A[n],k=A[l];v>k&&g({pluginRequiredPlan:n,licensePlan:l})}};e.Commands.has(T.settings)&&(i=e.runCommand(T.settings),p=(i==null?void 0:i.baseUrl)||"");const u=o=>{s==null||s(o),o&&d(o)};if(!i){e.onReady(async()=>{if(!M())if(r){const o=await _({licenseKey:r,pluginName:a,baseApiUrl:p});u(o)}else g("The `licenseKey` option not provided")});return}if(i.licensePlan||i.licenseError){const o=j(i);u(o);return}e.on(L,o=>u(o))}const j=e=>({sdkLicense:e.license,license:e.license,error:e.licenseError,plan:e.licensePlan});async function _(e){const{licenseKey:n,pluginName:a,baseApiUrl:r}=e;try{return(await O({baseApiUrl:r,path:`/sdk/${n||"na"}`,method:"POST",params:{d:window.location.hostname,pn:a}})).result||{}}catch(s){return console.error("Error during SDK license check:",s),!1}}const R="linkImageComponent",F=b.startup,W=function(e,n={}){const{Components:a,Blocks:r}=e,s="link-image",c="Link Image",p="link-image",{model:i,view:g}=e.Components.getType("image"),d=a.getType("link").model.getDefaults().traits,u=i.getDefaults().traits,o=d.filter(t=>t!=="title"),f=u.filter(t=>t.name!=="customAttributes").map(t=>typeof t=="string"?{name:t}:t).map(t=>({...t,getValue({component:l}){var h;return(h=l.components().at(0).getTrait(t.name))==null?void 0:h.getValue()},setValue({component:l,value:h,options:y}){var v;(v=l.components().at(0).getTrait(t.name))==null||v.setValue(h,y)}}));a.addType(s,{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:[...f,...o],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
|
+
.${p} {
|
|
3
|
+
display: inline-block;
|
|
4
|
+
overflow: hidden;
|
|
5
|
+
}
|
|
6
|
+
.${p} > img {
|
|
7
|
+
object-fit: cover;
|
|
8
|
+
display: block;
|
|
9
|
+
width: 100%;
|
|
10
|
+
height: 100%;
|
|
11
|
+
}
|
|
12
|
+
`},init(){const t=this.components().at(0);t==null||t.set({layerable:!1,locked:!0})}},view:{onActive(t){g.prototype.onActive.call(this,t)}}}),$({editor:e,licenseKey:n.licenseKey,plan:F,pluginName:R,cleanup:()=>{a.removeType(s),r.remove(s)}})},H=U(W,R);module.exports=H;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(d,f){typeof exports=="object"&&typeof module<"u"?module.exports=f():typeof define=="function"&&define.amd?define(f):(d=typeof globalThis<"u"?globalThis:d||self,d.StudioSdkPlugins_linkImageComponent=f())})(this,function(){"use strict";const d="app.grapesjs.com",f="app-stage.grapesjs.com",w=[d,"app2.grapesjs.com",f,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io",".claudemcpcontent.com",".web-sandbox.oaiusercontent.com"],
|
|
1
|
+
(function(d,f){typeof exports=="object"&&typeof module<"u"?module.exports=f():typeof define=="function"&&define.amd?define(f):(d=typeof globalThis<"u"?globalThis:d||self,d.StudioSdkPlugins_linkImageComponent=f())})(this,function(){"use strict";const d="app.grapesjs.com",f="app-stage.grapesjs.com",w=[d,"app2.grapesjs.com",f,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io",".claudemcpcontent.com",".web-sandbox.oaiusercontent.com"],I="license:check:end",R=()=>typeof window<"u",G=({isDev:e,isStage:n,isPlatform:i})=>`${e?"":`https://${n?f:d}`}/${i?"platform-api":"api"}`,x=()=>{if(!R())return"";const{hostname:e}=window.location;if(e)return e;try{return window.parent.location.hostname||""}catch{return""}},L=()=>{const e=x();return!!e&&(w.includes(e)||w.some(n=>e.endsWith(n)))};async function E({path:e,baseApiUrl:n,method:i="GET",headers:r={},params:s,body:c}){const a=`${n||G({isDev:!1,isStage:!1})}${e}`,g={method:i,headers:{"Content-Type":"application/json",...r}};c&&(g.body=JSON.stringify(c));const b=s?new URLSearchParams(s).toString():"",u=b?`?${b}`:"",o=await fetch(`${a}${u}`,g);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return o.json()}var h=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(h||{}),A=(e=>(e.toastAdd="studio:toastAdd",e.toastRemove="studio:toastRemove",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",e.dialogExportCode="studio:dialogExportCode",e.dialogImportCode="studio:dialogImportCode",e.openEditCode="studio:openEditCode",e.openBlocks="studio:openBlocks",e.appendComponent="studio:appendComponent",e.sidebarLeftSet="studio:sidebarLeft:set",e.sidebarLeftGet="studio:sidebarLeft:get",e.sidebarLeftToggle="studio:sidebarLeft:toggle",e.sidebarRightSet="studio:sidebarRight:set",e.sidebarRightGet="studio:sidebarRight:get",e.sidebarRightToggle="studio:sidebarRight:toggle",e.sidebarTopSet="studio:sidebarTop:set",e.sidebarTopGet="studio:sidebarTop:get",e.sidebarTopToggle="studio:sidebarTop:toggle",e.sidebarBottomSet="studio:sidebarBottom:set",e.sidebarBottomGet="studio:sidebarBottom:get",e.sidebarBottomToggle="studio:sidebarBottom:toggle",e.symbolAdd="studio:symbolAdd",e.symbolDetach="studio:symbolDetach",e.symbolOverride="studio:symbolOverride",e.symbolPropagateStyles="studio:propagateStyles",e.getPagesConfig="studio:getPagesConfig",e.setPagesConfig="studio:setPagesConfig",e.getPageSettings="studio:getPageSettings",e.setPageSettings="studio:setPageSettings",e.clearPage="studio:clearPage",e.projectFiles="studio:projectFiles",e.validateCode="studio:validateCode",e.canvasReload="studio:canvasReload",e.getBlocksPanel="studio:getBlocksPanel",e.setBlocksPanel="studio:setBlocksPanel",e.getStateContextMenu="studio:getStateContextMenu",e.setStateContextMenu="studio:setStateContextMenu",e.contextMenuComponent="studio:contextMenuComponent",e.layoutAdd="studio:layoutAdd",e.layoutRemove="studio:layoutRemove",e.layoutToggle="studio:layoutToggle",e.layoutUpdate="studio:layoutUpdate",e.layoutGet="studio:layoutGet",e.layoutConfigGet="studio:layoutConfigGet",e.layoutConfigSet="studio:layoutConfigSet",e.layoutComponentAdd="studio:layoutComponentAdd",e.layoutComponentGet="studio:layoutComponentGet",e.layoutComponentRemove="studio:layoutComponentRemove",e.layoutComponentRender="studio:layoutComponentRender",e.getStateTheme="studio:getStateTheme",e.setStateTheme="studio:setStateTheme",e.settings="studio:settings",e.assetProviderGet="studio:assetProviderGet",e.assetProviderAdd="studio:assetProviderAdd",e.assetProviderRemove="studio:assetProviderRemove",e.fontGet="studio:fontGet",e.fontAdd="studio:fontAdd",e.fontRemove="studio:fontRemove",e.fontManagerOpen="studio:fontManagerOpen",e.menuFontLoad="studio:menuFontLoad",e.toggleStateDataSource="studio:toggleStateDataSource",e.getStateDataSource="studio:getStateDataSource",e.dataSourceSetGlobalData="studio:dataSourceSetGlobalData",e.dataSourceSetImporter="studio:dataSourceSetImporter",e.dataSourceSetExporter="studio:dataSourceSetExporter",e.setDragAbsolute="studio:setDragAbsolute",e))(A||{});const D={[h.free]:0,[h.startup]:10,[h.business]:20,[h.enterprise]:30};function M(e,n){const i=e;return i.init=r=>{const s=c=>e(c,r);return s.__gjsPluginId=n,s},i}const O=(e,n)=>M(e,n);async function B({editor:e,plan:n,pluginName:i,licenseKey:r,onLicenseCheckResponse:s,cleanup:c}){let p="",a;const g=o=>{console.warn("Cleanup plugin:",i,"Reason:",o),c(e,i)},b=(o={})=>{var T;const{error:v,sdkLicense:t}=o,l=(T=o.plan)==null?void 0:T.category;if(!(t||o.license)||v)g(v||"Invalid license");else if(l){const P=D[n],$=D[l];P>$&&g({pluginRequiredPlan:n,licensePlan:l})}};e.Commands.has(A.settings)&&(a=e.runCommand(A.settings),p=(a==null?void 0:a.baseUrl)||"");const u=o=>{s==null||s(o),o&&b(o)};if(!a){e.onReady(async()=>{if(!L())if(r){const o=await U({licenseKey:r,pluginName:i,baseApiUrl:p});u(o)}else g("The `licenseKey` option not provided")});return}if(a.licensePlan||a.licenseError){const o=N(a);u(o);return}e.on(I,o=>u(o))}const N=e=>({sdkLicense:e.license,license:e.license,error:e.licenseError,plan:e.licensePlan});async function U(e){const{licenseKey:n,pluginName:i,baseApiUrl:r}=e;try{return(await E({baseApiUrl:r,path:`/sdk/${n||"na"}`,method:"POST",params:{d:window.location.hostname,pn:i}})).result||{}}catch(s){return console.error("Error during SDK license check:",s),!1}}const k="linkImageComponent",_=h.startup;return O(function(e,n={}){const{Components:i,Blocks:r}=e,s="link-image",c="Link Image",p="link-image",{model:a,view:g}=e.Components.getType("image"),b=i.getType("link").model.getDefaults().traits,u=a.getDefaults().traits,o=b.filter(t=>t!=="title"),v=u.filter(t=>t.name!=="customAttributes").map(t=>typeof t=="string"?{name:t}:t).map(t=>({...t,getValue({component:l}){var y;return(y=l.components().at(0).getTrait(t.name))==null?void 0:y.getValue()},setValue({component:l,value:y,options:T}){var P;(P=l.components().at(0).getTrait(t.name))==null||P.setValue(y,T)}}));i.addType(s,{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:[...v,...o],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 t=this.components().at(0);t==null||t.set({layerable:!1,locked:!0})}},view:{onActive(t){
|
|
12
|
+
`},init(){const t=this.components().at(0);t==null||t.set({layerable:!1,locked:!0})}},view:{onActive(t){g.prototype.onActive.call(this,t)}}}),B({editor:e,licenseKey:n.licenseKey,plan:_,pluginName:k,cleanup:()=>{i.removeType(s),r.remove(s)}})},k)});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";const B="app.grapesjs.com",
|
|
1
|
+
"use strict";const B="app.grapesjs.com",_="app-stage.grapesjs.com",$="app2.grapesjs.com",N="app-stage2.grapesjs.com",x=[B,$,_,N,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io",".claudemcpcontent.com",".web-sandbox.oaiusercontent.com"],U="license:check:end",j=()=>typeof window<"u",F=({isDev:e,isStage:s,isPlatform:a})=>`${e?"":`https://${s?_:B}`}/${a?"platform-api":"api"}`,W=()=>{if(!j())return"";const{hostname:e}=window.location;if(e)return e;try{return window.parent.location.hostname||""}catch{return""}},K=()=>{const e=W();return!!e&&(x.includes(e)||x.some(s=>e.endsWith(s)))};async function m({path:e,baseApiUrl:s,method:a="GET",headers:t={},params:o,body:r}){const i=`${s||F({isDev:!1,isStage:!1})}${e}`,l={method:a,headers:{"Content-Type":"application/json",...t}};r&&(l.body=JSON.stringify(r));const p=o?new URLSearchParams(o).toString():"",c=p?`?${p}`:"",n=await fetch(`${i}${c}`,l);if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return n.json()}var b=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(b||{}),E=(e=>(e.toastAdd="studio:toastAdd",e.toastRemove="studio:toastRemove",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",e.dialogExportCode="studio:dialogExportCode",e.dialogImportCode="studio:dialogImportCode",e.openEditCode="studio:openEditCode",e.openBlocks="studio:openBlocks",e.appendComponent="studio:appendComponent",e.sidebarLeftSet="studio:sidebarLeft:set",e.sidebarLeftGet="studio:sidebarLeft:get",e.sidebarLeftToggle="studio:sidebarLeft:toggle",e.sidebarRightSet="studio:sidebarRight:set",e.sidebarRightGet="studio:sidebarRight:get",e.sidebarRightToggle="studio:sidebarRight:toggle",e.sidebarTopSet="studio:sidebarTop:set",e.sidebarTopGet="studio:sidebarTop:get",e.sidebarTopToggle="studio:sidebarTop:toggle",e.sidebarBottomSet="studio:sidebarBottom:set",e.sidebarBottomGet="studio:sidebarBottom:get",e.sidebarBottomToggle="studio:sidebarBottom:toggle",e.symbolAdd="studio:symbolAdd",e.symbolDetach="studio:symbolDetach",e.symbolOverride="studio:symbolOverride",e.symbolPropagateStyles="studio:propagateStyles",e.getPagesConfig="studio:getPagesConfig",e.setPagesConfig="studio:setPagesConfig",e.getPageSettings="studio:getPageSettings",e.setPageSettings="studio:setPageSettings",e.clearPage="studio:clearPage",e.projectFiles="studio:projectFiles",e.validateCode="studio:validateCode",e.canvasReload="studio:canvasReload",e.getBlocksPanel="studio:getBlocksPanel",e.setBlocksPanel="studio:setBlocksPanel",e.getStateContextMenu="studio:getStateContextMenu",e.setStateContextMenu="studio:setStateContextMenu",e.contextMenuComponent="studio:contextMenuComponent",e.layoutAdd="studio:layoutAdd",e.layoutRemove="studio:layoutRemove",e.layoutToggle="studio:layoutToggle",e.layoutUpdate="studio:layoutUpdate",e.layoutGet="studio:layoutGet",e.layoutConfigGet="studio:layoutConfigGet",e.layoutConfigSet="studio:layoutConfigSet",e.layoutComponentAdd="studio:layoutComponentAdd",e.layoutComponentGet="studio:layoutComponentGet",e.layoutComponentRemove="studio:layoutComponentRemove",e.layoutComponentRender="studio:layoutComponentRender",e.getStateTheme="studio:getStateTheme",e.setStateTheme="studio:setStateTheme",e.settings="studio:settings",e.assetProviderGet="studio:assetProviderGet",e.assetProviderAdd="studio:assetProviderAdd",e.assetProviderRemove="studio:assetProviderRemove",e.fontGet="studio:fontGet",e.fontAdd="studio:fontAdd",e.fontRemove="studio:fontRemove",e.fontManagerOpen="studio:fontManagerOpen",e.menuFontLoad="studio:menuFontLoad",e.toggleStateDataSource="studio:toggleStateDataSource",e.getStateDataSource="studio:getStateDataSource",e.dataSourceSetGlobalData="studio:dataSourceSetGlobalData",e.dataSourceSetImporter="studio:dataSourceSetImporter",e.dataSourceSetExporter="studio:dataSourceSetExporter",e.setDragAbsolute="studio:setDragAbsolute",e))(E||{});const G={[b.free]:0,[b.startup]:10,[b.business]:20,[b.enterprise]:30};function q(e,s){const a=e;return a.init=t=>{const o=r=>e(r,t);return o.__gjsPluginId=s,o},a}const X=(e,s)=>q(e,s);async function Y({editor:e,plan:s,pluginName:a,licenseKey:t,onLicenseCheckResponse:o,cleanup:r}){let g="",i;const l=n=>{console.warn("Cleanup plugin:",a,"Reason:",n),r(e,a)},p=(n={})=>{var h;const{error:P,sdkLicense:L}=n,u=(h=n.plan)==null?void 0:h.category;if(!(L||n.license)||P)l(P||"Invalid license");else if(u){const T=G[s],I=G[u];T>I&&l({pluginRequiredPlan:s,licensePlan:u})}};e.Commands.has(E.settings)&&(i=e.runCommand(E.settings),g=(i==null?void 0:i.baseUrl)||"");const c=n=>{o==null||o(n),n&&p(n)};if(!i){e.onReady(async()=>{if(!K())if(t){const n=await J({licenseKey:t,pluginName:a,baseApiUrl:g});c(n)}else l("The `licenseKey` option not provided")});return}if(i.licensePlan||i.licenseError){const n=Z(i);c(n);return}e.on(U,n=>c(n))}const Z=e=>({sdkLicense:e.license,license:e.license,error:e.licenseError,plan:e.licensePlan});async function J(e){const{licenseKey:s,pluginName:a,baseApiUrl:t}=e;try{return(await m({baseApiUrl:t,path:`/sdk/${s||"na"}`,method:"POST",params:{d:window.location.hostname,pn:a}})).result||{}}catch(o){return console.error("Error during SDK license check:",o),!1}}const V="gjs-plg-",O="listPagesComponent",z=b.startup;function Q(e,s,a){let t,o,r,g,i;const l=s;function p(){const n=Date.now()-g;n<l&&n>=0?t=setTimeout(p,l-n):(t=null,i=e.apply(r,o),r=o=null)}const c=function(){return r=this,o=arguments,g=Date.now(),t||(t=setTimeout(p,l)),i};return c.clear=function(){t&&(clearTimeout(t),t=null)},c.flush=function(){t&&(i=e.apply(r,o),r=o=null,clearTimeout(t),t=null)},c}const k="page://",d="list-pages",f="list-pages-item",y="list-pages-link",C=e=>e.components().reduce((s,a)=>{var g;const t=a.findFirstType(y),o=(g=t==null?void 0:t.attributes.attributes)==null?void 0:g.href,r=o!=null&&o.startsWith(k)?o.replace(k,""):"";if(r&&t){const i=s[r];i?i.push(t):s[r]=[t]}return s},{}),A="data-type-role",S="page_root",ee=e=>s=>s.is(e),te=e=>(s,a)=>a.is(e),M=e=>s=>{var a;return((a=s.getAttribute)==null?void 0:a.call(s,A))===e},se=function(e,s={}){const{Blocks:a,Components:t,Pages:o}=e,{licenseKey:r,block:g={}}=s,i="List Pages",l="List Pages Item",p="Link",c=`${V}${d}`,n=`${V}${y}`,P='<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>',L='<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>';t.addType(d,{block:g&&{label:i,media:P,category:"Extra",select:!0,...s.block},isComponent:M(d),model:{defaults:{tagName:"ul",name:i,[S]:"",classes:c,attributes:{[A]:d,role:"navigation"},droppable:ee(f),styles:`
|
|
2
2
|
.${c} {
|
|
3
3
|
list-style: none;
|
|
4
4
|
margin: 0;
|
|
5
5
|
padding: 0;
|
|
6
6
|
}
|
|
7
|
-
`},init(){this.syncPageItems=Q(this.syncPageItems.bind(this),0),this.listenTo(this.em,
|
|
8
|
-
.${
|
|
7
|
+
`},init(){this.syncPageItems=Q(this.syncPageItems.bind(this),0),this.listenTo(this.em,o.events.all,this.syncPageItems),this.syncPageItems()},syncPageItems(){if(e.Components.getSymbolInfo(this).isInstance)return;const u=this.em.Pages.getAll(),H=this.components(),h=C(this);u.forEach((T,I)=>{const w=T.id,R=T.getName(),v=h[w];v?v==null||v.forEach(D=>{D.getInnerHTML()!==R&&D.components(R)}):H.add({type:f,components:[{type:y,attributes:{href:`page://${w}`},components:{type:"textnode",content:R}}]},{at:I})})}}}),t.addType(f,{isComponent:M(f),model:{defaults:{name:l,tagName:"li",icon:L,attributes:{[A]:f},components:{type:y},draggable:te(d)}}}),t.addType(y,{extend:"link",isComponent:M(y),model:{defaults:{removable:!1,copyable:!1,delegate:{move:u=>u.closestType(f)},name:p,classes:n,attributes:{[A]:y},components:{type:"textnode",content:"Item"},styles:`
|
|
8
|
+
.${n} {
|
|
9
9
|
text-decoration: none;
|
|
10
10
|
}
|
|
11
|
-
`}}}),
|
|
11
|
+
`}}}),Y({editor:e,licenseKey:r,plan:z,pluginName:O,cleanup:()=>{a.remove(d),t.removeType(d)}})},oe=X(se,O);module.exports=oe;
|