@grapesjs/studio-sdk-plugins 1.0.37 → 1.0.38-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 +3 -3
- package/dist/accordionComponent/index.es.js +12 -12
- package/dist/accordionComponent/index.umd.js +3 -3
- package/dist/aiChat/index.cjs.js +85 -85
- package/dist/aiChat/index.es.js +9759 -9332
- package/dist/aiChat/index.js +85 -85
- package/dist/aiChat/index.umd.js +86 -86
- package/dist/aiChat/locales/en.d.ts +11 -0
- package/dist/aiChat/server/index.cjs.js +1 -1
- package/dist/aiChat/server/index.es.js +1 -1
- package/dist/aiChat/server/index.js +1 -1
- package/dist/aiChat/server/index.umd.js +1 -1
- package/dist/aiChat/types.d.ts +1 -1
- package/dist/animationComponent/index.cjs.js +3 -3
- package/dist/animationComponent/index.es.js +10 -10
- package/dist/animationComponent/index.umd.js +3 -3
- package/dist/canvasAbsoluteMode/index.cjs.js +1 -1
- package/dist/canvasAbsoluteMode/index.es.js +10 -10
- package/dist/canvasAbsoluteMode/index.umd.js +1 -1
- package/dist/canvasEmptyState/index.cjs.js +1 -1
- package/dist/canvasEmptyState/index.es.js +1 -1
- package/dist/canvasEmptyState/index.umd.js +1 -1
- package/dist/canvasFullSize/index.cjs.js +4 -4
- package/dist/canvasFullSize/index.es.js +15 -15
- package/dist/canvasFullSize/index.umd.js +3 -3
- package/dist/canvasGridMode/index.cjs.js +2 -2
- package/dist/canvasGridMode/index.es.js +233 -228
- package/dist/canvasGridMode/index.umd.js +2 -2
- package/dist/canvasScreenshot/index.cjs.js +1 -1
- package/dist/canvasScreenshot/index.es.js +11 -11
- package/dist/canvasScreenshot/index.umd.js +1 -1
- package/dist/dataSourceEjs/index.cjs.js +2 -2
- package/dist/dataSourceEjs/index.es.js +5 -5
- package/dist/dataSourceEjs/index.umd.js +1 -1
- package/dist/dataSourceHandlebars/index.cjs.js +1 -1
- package/dist/dataSourceHandlebars/index.es.js +105 -105
- package/dist/dataSourceHandlebars/index.umd.js +5 -5
- package/dist/dialogComponent/index.cjs.js +3 -3
- package/dist/dialogComponent/index.es.js +18 -18
- package/dist/dialogComponent/index.umd.js +3 -3
- package/dist/flexComponent/index.cjs.js +1 -1
- package/dist/flexComponent/index.es.js +1 -1
- package/dist/flexComponent/index.umd.js +3 -3
- package/dist/fsLightboxComponent/index.cjs.js +1 -1
- package/dist/fsLightboxComponent/index.es.js +7 -7
- package/dist/fsLightboxComponent/index.umd.js +2 -2
- package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
- package/dist/googleFontsAssetProvider/index.es.js +12 -12
- package/dist/googleFontsAssetProvider/index.umd.js +1 -1
- package/dist/iconifyComponent/index.cjs.js +2 -2
- package/dist/iconifyComponent/index.es.js +61 -61
- package/dist/iconifyComponent/index.umd.js +2 -2
- package/dist/index.cjs.js +24 -24
- package/dist/index.es.js +335 -330
- package/dist/index.umd.js +25 -25
- package/dist/layoutSidebarButtons/index.cjs.js +1 -1
- package/dist/layoutSidebarButtons/index.es.js +15 -15
- package/dist/layoutSidebarButtons/index.umd.js +1 -1
- package/dist/lightGalleryComponent/index.cjs.js +1 -1
- package/dist/lightGalleryComponent/index.es.js +20 -20
- package/dist/lightGalleryComponent/index.umd.js +1 -1
- package/dist/linkImageComponent/index.cjs.js +1 -1
- package/dist/linkImageComponent/index.es.js +1 -1
- package/dist/linkImageComponent/index.umd.js +2 -2
- package/dist/listPagesComponent/index.cjs.js +2 -2
- package/dist/listPagesComponent/index.es.js +10 -10
- package/dist/listPagesComponent/index.umd.js +2 -2
- package/dist/presetPrintable/index.cjs.js +5 -5
- package/dist/presetPrintable/index.es.js +47 -47
- package/dist/presetPrintable/index.umd.js +4 -4
- package/dist/prosemirror/index.cjs.js +1 -1
- package/dist/prosemirror/index.es.js +1 -1
- package/dist/prosemirror/index.umd.js +1 -1
- package/dist/rendererReact/index.cjs.js +1 -1
- package/dist/rendererReact/index.es.js +16 -16
- 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 +27 -27
- package/dist/rteTinyMce/index.umd.js +1 -1
- package/dist/shapeDividerComponent/index.cjs.js +1 -1
- package/dist/shapeDividerComponent/index.es.js +10 -10
- package/dist/shapeDividerComponent/index.umd.js +2 -2
- package/dist/swiperComponent/index.cjs.js +1 -1
- package/dist/swiperComponent/index.es.js +1 -1
- package/dist/swiperComponent/index.umd.js +1 -1
- package/dist/tableComponent/index.cjs.js +1 -1
- package/dist/tableComponent/index.es.js +9 -9
- package/dist/tableComponent/index.umd.js +1 -1
- package/dist/youtubeAssetProvider/index.cjs.js +1 -1
- package/dist/youtubeAssetProvider/index.es.js +5 -5
- package/dist/youtubeAssetProvider/index.umd.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";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.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||{}),I=(e=>(e.layoutToggleId="studio:layoutToggle:",e.toggleBlocksPanel="studio:toggleBlocksPanel",e.pageSettingsUpdate="studio:pageSettingsUpdate",e.toggleDataSourcesPreview="studio:toggleDataSourcesPreview",e))(I||{});const x="app.grapesjs.com",O="app-stage.grapesjs.com",_="app2.grapesjs.com",m="app-stage2.grapesjs.com",D=[x,_,O,m,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io",".claudemcpcontent.com",".web-sandbox.oaiusercontent.com"],j="license:check:end",W=()=>typeof window<"u",S=({isDev:e,isStage:o,isPlatform:a})=>`${e?"":`https://${o?O:x}`}/${a?"platform-api":"api"}`,F=()=>{if(!W())return"";const{hostname:e}=window.location;if(e)return e;try{return window.parent.location.hostname||""}catch{return""}},V=()=>{const e=F();return!!e&&(D.includes(e)||D.some(o=>e.endsWith(o)))};async function C({path:e,baseApiUrl:o,method:a="GET",headers:c={},params:i,body:h}){const r=`${o||S({isDev:!1,isStage:!1})}${e}`,d={method:a,headers:{"Content-Type":"application/json",...c}};h&&(d.body=JSON.stringify(h));const b=i?new URLSearchParams(i).toString():"",u=b?`?${b}`:"",t=await fetch(`${r}${u}`,d);if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return t.json()}const G={[B.free]:0,[B.startup]:10,[B.business]:20,[B.enterprise]:30};function K(e){const o=e;return o.init=a=>c=>e(c,a),o}const q=e=>K(e);async function Z({editor:e,plan:o,pluginName:a,licenseKey:c,onLicenseCheckResponse:i,cleanup:h}){let f="",r;const d=t=>{console.warn("Cleanup plugin:",a,"Reason:",t),h()},b=(t={})=>{var l;const{error:L,sdkLicense:n}=t,g=(l=t.plan)==null?void 0:l.category;if(!(n||t.license)||L)d(L||"Invalid license");else if(g){const y=G[o],p=G[g];y>p&&d({pluginRequiredPlan:o,licensePlan:g})}};e.Commands.has(T.settings)&&(r=e.runCommand(T.settings),f=(r==null?void 0:r.baseUrl)||"");const u=t=>{i==null||i(t),t&&b(t)};if(!r){e.onReady(async()=>{if(!V())if(c){const t=await J({licenseKey:c,pluginName:a,baseApiUrl:f});u(t)}else d("The `licenseKey` option not provided")});return}if(r.licensePlan||r.licenseError){const t=z(r);u(t);return}e.on(j,t=>u(t))}const z=e=>({sdkLicense:e.license,license:e.license,error:e.licenseError,plan:e.licensePlan});async function J(e){const{licenseKey:o,pluginName:a,baseApiUrl:c}=e;try{return(await C({baseApiUrl:c,path:`/sdk/${o||"na"}`,method:"POST",params:{d:window.location.hostname,pn:a}})).result||{}}catch(i){return console.error("Error during SDK license check:",i),!1}}var v=(e=>(e.panelBlocks="panelBlocks",e.panelPagesLayers="panelPagesLayers",e.panelGlobalStyles="panelGlobalStyles",e.panelSidebarTabs="panelSidebarTabs",e.panelAssets="panelAssets",e.aiChatPanel="aiChatPanel",e.panelDataSources="panelDataSources",e))(v||{});const E="sidebarButtonsTarget",R=(e,o)=>{const{id:a,icon:c,label:i,tooltip:h,className:f,skipSelfClose:r,removeLayouts:d,layoutComponent:b,layoutCommand:u}=e,{pluginOpts:t,breakpointProps:L}=o,n=a;return{id:U(a),type:"button",icon:c,tooltip:i||h,className:f,editorEvents:{[`${I.layoutToggleId}${n}`]:({fromEvent:g,setState:s,editor:l})=>{s({active:g.isOpen}),setTimeout(()=>l.refresh({tools:!0}),20)}},onClick:({editor:g,state:s})=>{var w;if(s.active&&r)return;const l=(u==null?void 0:u.placer)||{type:"static",layoutId:E},y={...l,skipCleanup:l.type==="static"},p=d||Object.keys(v).filter(k=>k!==n);$(g,{removeLayouts:p,layout:{placer:y}});const A={id:n,placer:l,header:(u==null?void 0:u.header)??{label:i,close:!r},layout:b,style:{width:280,height:"100%",borderRightWidth:1,...u==null?void 0:u.style}},P=((w=t==null?void 0:t.sidebarLayoutCommand)==null?void 0:w.call(t,{...L,layoutCommand:A,sidebarButtonProps:e}))||A;g.runCommand(T.layoutToggle,{...P})}}},U=e=>`button__${e}`,$=(e,o={})=>{(o.removeLayouts||Object.keys(v)).forEach(c=>e.runCommand(T.layoutRemove,{id:c,layout:o.layout}))},N=e=>{const o=(e==null?void 0:e.breakpointTablet)??1024,a=(e==null?void 0:e.breakpointMobile)??768,c={},i=[{id:v.panelBlocks,icon:"plusBox",label:"Blocks",layoutComponent:{type:"panelBlocks"}},{id:v.panelPagesLayers,icon:"layers",label:"Pages & Layers",layoutComponent:{type:"panelPagesLayers"}},{id:v.panelGlobalStyles,icon:'<svg viewBox="0 0 24 24"> <path d="M20 14H6c-2.2 0-4 1.8-4 4s1.8 4 4 4h14a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2M6 20c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2m.3-8L13 5.3a2 2 0 0 1 2.8 0l2.8 2.8c.8.8.8 2 0 2.8l-.9 1.1H6.3M2 13.5V4c0-1.1.9-2 2-2h4a2 2 0 0 1 2 2v1.5l-8 8Z"/></svg>',label:"Global Styles",layoutComponent:{type:"panelGlobalStyles"}},{id:v.panelAssets,icon:'<svg viewBox="0 0 24 24"><path d="M22,16V4A2,2 0 0,0 20,2H8A2,2 0 0,0 6,4V16A2,2 0 0,0 8,18H20A2,2 0 0,0 22,16M11,12L13.03,14.71L16,11L20,16H8M2,6V20A2,2 0 0,0 4,22H18V20H4V6" /></svg>',label:"Assets",layoutComponent:{type:"panelAssets",content:{itemsPerRow:2,header:{addUrl:!1}},style:{padding:7},onSelect:({assetProps:n,editor:g})=>{var p;const s=g.getSelected(),l={type:"image",src:n.src};let y;if(s!=null&&s.is("image"))return s.set("src",n.src);s&&g.Components.canMove(s,l)?y=s.append(l)[0]:s||(y=(p=g.getWrapper())==null?void 0:p.append(l)[0]),y&&g.select(y,{scroll:!0})}}}],h=[...i,{id:v.panelSidebarTabs,layoutCommand:{header:!1},icon:'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 0 1-1.5-1.5A1.5 1.5 0 0 1 17.5 9a1.5 1.5 0 0 1 1.5 1.5 1.5 1.5 0 0 1-1.5 1.5m-3-4A1.5 1.5 0 0 1 13 6.5 1.5 1.5 0 0 1 14.5 5 1.5 1.5 0 0 1 16 6.5 1.5 1.5 0 0 1 14.5 8m-5 0A1.5 1.5 0 0 1 8 6.5 1.5 1.5 0 0 1 9.5 5 1.5 1.5 0 0 1 11 6.5 1.5 1.5 0 0 1 9.5 8m-3 4A1.5 1.5 0 0 1 5 10.5 1.5 1.5 0 0 1 6.5 9 1.5 1.5 0 0 1 8 10.5 1.5 1.5 0 0 1 6.5 12M12 3a9 9 0 0 0-9 9 9 9 0 0 0 9 9 1.5 1.5 0 0 0 1.5-1.5c0-.4-.2-.7-.4-1-.2-.3-.4-.6-.4-1a1.5 1.5 0 0 1 1.5-1.5H16a5 5 0 0 0 5-5c0-4.4-4-8-9-8Z"/></svg>',label:"Styles & Props",layoutComponent:{type:"panelSidebarTabs"}}],f={id:E,type:"column",className:"gs-cmp-layout-sidebar-target",style:{overflow:"hidden"}},r={type:"sidebarLeft",resizable:!1,style:{padding:"10px 5px",alignItems:"center",width:45,gap:10},children:[]},d={type:"canvasSidebarTop",sidebarTop:{leftContainer:{buttons:[]}}},b=n=>({breakpoint:n,breakpointTablet:o,breakpointMobile:a}),u=(n,g,s)=>{const l=b(g),y={pluginOpts:e,breakpointProps:l},p=n.map(P=>{const w=R(P,y);return e!=null&&e.sidebarButton?e.sidebarButton({id:P.id,buttonIds:v,buttonProps:w,sidebarButtonProps:P,...l,createSidebarButton:k=>R({...P,...k},y)}):w}).filter(Boolean);return(e!=null&&e.sidebarButtons?e==null?void 0:e.sidebarButtons({buttonIds:v,sidebarButtons:p,...l,createSidebarButton:P=>R({...P,layoutCommand:{...s==null?void 0:s.layoutCommand,...P.layoutCommand}},y)}):p).filter(Boolean)},t=(n,g,s)=>{var p;const l=b(s),y={pluginOpts:e,breakpointProps:l};return((p=e==null?void 0:e.rootLayout)==null?void 0:p.call(e,{sidebarButtons:g,rootLayout:n,layoutSidebarLeft:r,layoutSidebarTarget:f,...l,createSidebarButton:A=>R({...A},y)}))??n};if(o){const n=u(h,o);c[o]=t({type:"row",style:{height:"100%"},children:[{...r,children:n},f,d]},n,o)}if(a){const n={placer:{type:"absolute",position:"left"},style:{height:"calc(100% - 40px)"}},g=h.map(l=>({...l,layoutCommand:n})),s=u(g,a,{layoutCommand:n});c[a]=t({type:"column",style:{height:"100%"},children:[{type:"sidebarTop",leftContainer:{buttons:[]}},{type:"canvas",grow:!0},{type:"sidebarBottom",style:{padding:"0 5px",alignItems:"center",gap:10,minHeight:39},children:s}]},s,a)}const L=u(i,0);return{default:t({type:"row",style:{height:"100%"},children:[{...r,children:L},f,d,{type:"sidebarRight"}]},L,0),responsive:c}},M="layoutSidebarButtons",Q=B.free,X=function(e,o={}){const{Commands:a}=e,c=a.events,i={...o};(()=>{if(e.runCommand(T.layoutConfigGet)||i.skipLayoutConfig===!0)return;const r=N(i);e.runCommand(T.layoutConfigSet,{...r})})(),a.add(`${M}:toggleButton`,(f,r,d)=>{const b=document.getElementById(U(d==null?void 0:d.id));b==null||b.click()}),e.on(`${c.runCommand}core:preview`,()=>{$(e)}),Z({editor:e,licenseKey:i.licenseKey,plan:Q,pluginName:M,cleanup:()=>{e.runCommand(T.layoutConfigSet)}})},H=q(X);H.createLayoutConfig=e=>N(e);module.exports=H;
|
|
1
|
+
"use strict";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.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||{}),I=(e=>(e.layoutToggleId="studio:layoutToggle:",e.toggleBlocksPanel="studio:toggleBlocksPanel",e.pageSettingsUpdate="studio:pageSettingsUpdate",e.toggleDataSourcesPreview="studio:toggleDataSourcesPreview",e))(I||{});const x="app.grapesjs.com",E="app-stage.grapesjs.com",_="app2.grapesjs.com",j="app-stage2.grapesjs.com",D=[x,_,E,j,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io",".claudemcpcontent.com",".web-sandbox.oaiusercontent.com"],m="license:check:end",W=()=>typeof window<"u",C=({isDev:e,isStage:o,isPlatform:a})=>`${e?"":`https://${o?E:x}`}/${a?"platform-api":"api"}`,F=()=>{if(!W())return"";const{hostname:e}=window.location;if(e)return e;try{return window.parent.location.hostname||""}catch{return""}},S=()=>{const e=F();return!!e&&(D.includes(e)||D.some(o=>e.endsWith(o)))};async function V({path:e,baseApiUrl:o,method:a="GET",headers:c={},params:i,body:h}){const r=`${o||C({isDev:!1,isStage:!1})}${e}`,d={method:a,headers:{"Content-Type":"application/json",...c}};h&&(d.body=JSON.stringify(h));const b=i?new URLSearchParams(i).toString():"",u=b?`?${b}`:"",t=await fetch(`${r}${u}`,d);if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return t.json()}const G={[B.free]:0,[B.startup]:10,[B.business]:20,[B.enterprise]:30};function K(e){const o=e;return o.init=a=>c=>e(c,a),o}const q=e=>K(e);async function Z({editor:e,plan:o,pluginName:a,licenseKey:c,onLicenseCheckResponse:i,cleanup:h}){let f="",r;const d=t=>{console.warn("Cleanup plugin:",a,"Reason:",t),h()},b=(t={})=>{var l;const{error:L,sdkLicense:n}=t,g=(l=t.plan)==null?void 0:l.category;if(!(n||t.license)||L)d(L||"Invalid license");else if(g){const y=G[o],p=G[g];y>p&&d({pluginRequiredPlan:o,licensePlan:g})}};e.Commands.has(T.settings)&&(r=e.runCommand(T.settings),f=(r==null?void 0:r.baseUrl)||"");const u=t=>{i==null||i(t),t&&b(t)};if(!r){e.onReady(async()=>{if(!S())if(c){const t=await J({licenseKey:c,pluginName:a,baseApiUrl:f});u(t)}else d("The `licenseKey` option not provided")});return}if(r.licensePlan||r.licenseError){const t=z(r);u(t);return}e.on(m,t=>u(t))}const z=e=>({sdkLicense:e.license,license:e.license,error:e.licenseError,plan:e.licensePlan});async function J(e){const{licenseKey:o,pluginName:a,baseApiUrl:c}=e;try{return(await V({baseApiUrl:c,path:`/sdk/${o||"na"}`,method:"POST",params:{d:window.location.hostname,pn:a}})).result||{}}catch(i){return console.error("Error during SDK license check:",i),!1}}var v=(e=>(e.panelBlocks="panelBlocks",e.panelPagesLayers="panelPagesLayers",e.panelGlobalStyles="panelGlobalStyles",e.panelSidebarTabs="panelSidebarTabs",e.panelAssets="panelAssets",e.aiChatPanel="aiChatPanel",e.panelDataSources="panelDataSources",e))(v||{});const O="sidebarButtonsTarget",R=(e,o)=>{const{id:a,icon:c,label:i,tooltip:h,className:f,skipSelfClose:r,removeLayouts:d,layoutComponent:b,layoutCommand:u}=e,{pluginOpts:t,breakpointProps:L}=o,n=a;return{id:U(a),type:"button",icon:c,tooltip:i||h,className:f,editorEvents:{[`${I.layoutToggleId}${n}`]:({fromEvent:g,setState:s,editor:l})=>{s({active:g.isOpen}),setTimeout(()=>l.refresh({tools:!0}),20)}},onClick:({editor:g,state:s})=>{var w;if(s.active&&r)return;const l=(u==null?void 0:u.placer)||{type:"static",layoutId:O},y={...l,skipCleanup:l.type==="static"},p=d||Object.keys(v).filter(k=>k!==n);$(g,{removeLayouts:p,layout:{placer:y}});const A={id:n,placer:l,header:(u==null?void 0:u.header)??{label:i,close:!r},layout:b,style:{width:280,height:"100%",borderRightWidth:1,...u==null?void 0:u.style}},P=((w=t==null?void 0:t.sidebarLayoutCommand)==null?void 0:w.call(t,{...L,layoutCommand:A,sidebarButtonProps:e}))||A;g.runCommand(T.layoutToggle,{...P})}}},U=e=>`button__${e}`,$=(e,o={})=>{(o.removeLayouts||Object.keys(v)).forEach(c=>e.runCommand(T.layoutRemove,{id:c,layout:o.layout}))},N=e=>{const o=(e==null?void 0:e.breakpointTablet)??1024,a=(e==null?void 0:e.breakpointMobile)??768,c={},i=[{id:v.panelBlocks,icon:"plusBox",label:"Blocks",layoutComponent:{type:"panelBlocks"}},{id:v.panelPagesLayers,icon:"layers",label:"Pages & Layers",layoutComponent:{type:"panelPagesLayers"}},{id:v.panelGlobalStyles,icon:'<svg viewBox="0 0 24 24"> <path d="M20 14H6c-2.2 0-4 1.8-4 4s1.8 4 4 4h14a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2M6 20c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2m.3-8L13 5.3a2 2 0 0 1 2.8 0l2.8 2.8c.8.8.8 2 0 2.8l-.9 1.1H6.3M2 13.5V4c0-1.1.9-2 2-2h4a2 2 0 0 1 2 2v1.5l-8 8Z"/></svg>',label:"Global Styles",layoutComponent:{type:"panelGlobalStyles"}},{id:v.panelAssets,icon:'<svg viewBox="0 0 24 24"><path d="M22,16V4A2,2 0 0,0 20,2H8A2,2 0 0,0 6,4V16A2,2 0 0,0 8,18H20A2,2 0 0,0 22,16M11,12L13.03,14.71L16,11L20,16H8M2,6V20A2,2 0 0,0 4,22H18V20H4V6" /></svg>',label:"Assets",layoutComponent:{type:"panelAssets",content:{itemsPerRow:2,header:{addUrl:!1}},style:{padding:7},onSelect:({assetProps:n,editor:g})=>{var p;const s=g.getSelected(),l={type:"image",src:n.src};let y;if(s!=null&&s.is("image"))return s.set("src",n.src);s&&g.Components.canMove(s,l)?y=s.append(l)[0]:s||(y=(p=g.getWrapper())==null?void 0:p.append(l)[0]),y&&g.select(y,{scroll:!0})}}}],h=[...i,{id:v.panelSidebarTabs,layoutCommand:{header:!1},icon:'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 0 1-1.5-1.5A1.5 1.5 0 0 1 17.5 9a1.5 1.5 0 0 1 1.5 1.5 1.5 1.5 0 0 1-1.5 1.5m-3-4A1.5 1.5 0 0 1 13 6.5 1.5 1.5 0 0 1 14.5 5 1.5 1.5 0 0 1 16 6.5 1.5 1.5 0 0 1 14.5 8m-5 0A1.5 1.5 0 0 1 8 6.5 1.5 1.5 0 0 1 9.5 5 1.5 1.5 0 0 1 11 6.5 1.5 1.5 0 0 1 9.5 8m-3 4A1.5 1.5 0 0 1 5 10.5 1.5 1.5 0 0 1 6.5 9 1.5 1.5 0 0 1 8 10.5 1.5 1.5 0 0 1 6.5 12M12 3a9 9 0 0 0-9 9 9 9 0 0 0 9 9 1.5 1.5 0 0 0 1.5-1.5c0-.4-.2-.7-.4-1-.2-.3-.4-.6-.4-1a1.5 1.5 0 0 1 1.5-1.5H16a5 5 0 0 0 5-5c0-4.4-4-8-9-8Z"/></svg>',label:"Styles & Props",layoutComponent:{type:"panelSidebarTabs"}}],f={id:O,type:"column",className:"gs-cmp-layout-sidebar-target",style:{overflow:"hidden"}},r={type:"sidebarLeft",resizable:!1,style:{padding:"10px 5px",alignItems:"center",width:45,gap:10},children:[]},d={type:"canvasSidebarTop",sidebarTop:{leftContainer:{buttons:[]}}},b=n=>({breakpoint:n,breakpointTablet:o,breakpointMobile:a}),u=(n,g,s)=>{const l=b(g),y={pluginOpts:e,breakpointProps:l},p=n.map(P=>{const w=R(P,y);return e!=null&&e.sidebarButton?e.sidebarButton({id:P.id,buttonIds:v,buttonProps:w,sidebarButtonProps:P,...l,createSidebarButton:k=>R({...P,...k},y)}):w}).filter(Boolean);return(e!=null&&e.sidebarButtons?e==null?void 0:e.sidebarButtons({buttonIds:v,sidebarButtons:p,...l,createSidebarButton:P=>R({...P,layoutCommand:{...s==null?void 0:s.layoutCommand,...P.layoutCommand}},y)}):p).filter(Boolean)},t=(n,g,s)=>{var p;const l=b(s),y={pluginOpts:e,breakpointProps:l};return((p=e==null?void 0:e.rootLayout)==null?void 0:p.call(e,{sidebarButtons:g,rootLayout:n,layoutSidebarLeft:r,layoutSidebarTarget:f,...l,createSidebarButton:A=>R({...A},y)}))??n};if(o){const n=u(h,o);c[o]=t({type:"row",style:{height:"100%"},children:[{...r,children:n},f,d]},n,o)}if(a){const n={placer:{type:"absolute",position:"left"},style:{height:"calc(100% - 40px)"}},g=h.map(l=>({...l,layoutCommand:n})),s=u(g,a,{layoutCommand:n});c[a]=t({type:"column",style:{height:"100%"},children:[{type:"sidebarTop",leftContainer:{buttons:[]}},{type:"canvas",grow:!0},{type:"sidebarBottom",style:{padding:"0 5px",alignItems:"center",gap:10,minHeight:39},children:s}]},s,a)}const L=u(i,0);return{default:t({type:"row",style:{height:"100%"},children:[{...r,children:L},f,d,{type:"sidebarRight"}]},L,0),responsive:c}},M="layoutSidebarButtons",Q=B.free,X=function(e,o={}){const{Commands:a}=e,c=a.events,i={...o};(()=>{if(e.runCommand(T.layoutConfigGet)||i.skipLayoutConfig===!0)return;const r=N(i);e.runCommand(T.layoutConfigSet,{...r})})(),a.add(`${M}:toggleButton`,(f,r,d)=>{const b=document.getElementById(U(d==null?void 0:d.id));b==null||b.click()}),e.on(`${c.runCommand}core:preview`,()=>{$(e)}),Z({editor:e,licenseKey:i.licenseKey,plan:Q,pluginName:M,cleanup:()=>{e.runCommand(T.layoutConfigSet)}})},H=q(X);H.createLayoutConfig=e=>N(e);module.exports=H;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
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.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 || {}), I = /* @__PURE__ */ ((e) => (e.layoutToggleId = "studio:layoutToggle:", e.toggleBlocksPanel = "studio:toggleBlocksPanel", e.pageSettingsUpdate = "studio:pageSettingsUpdate", e.toggleDataSourcesPreview = "studio:toggleDataSourcesPreview", e))(I || {});
|
|
2
|
-
const x = "app.grapesjs.com",
|
|
1
|
+
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 || {}), I = /* @__PURE__ */ ((e) => (e.layoutToggleId = "studio:layoutToggle:", e.toggleBlocksPanel = "studio:toggleBlocksPanel", e.pageSettingsUpdate = "studio:pageSettingsUpdate", e.toggleDataSourcesPreview = "studio:toggleDataSourcesPreview", e))(I || {});
|
|
2
|
+
const x = "app.grapesjs.com", E = "app-stage.grapesjs.com", H = "app2.grapesjs.com", _ = "app-stage2.grapesjs.com", D = [
|
|
3
3
|
x,
|
|
4
4
|
H,
|
|
5
|
-
|
|
5
|
+
E,
|
|
6
6
|
_,
|
|
7
7
|
"localhost",
|
|
8
8
|
"127.0.0.1",
|
|
@@ -16,12 +16,12 @@ const x = "app.grapesjs.com", O = "app-stage.grapesjs.com", H = "app2.grapesjs.c
|
|
|
16
16
|
// For Claude mcp app
|
|
17
17
|
".web-sandbox.oaiusercontent.com"
|
|
18
18
|
// For OpenAI mcp app
|
|
19
|
-
],
|
|
19
|
+
], j = "license:check:end", m = () => typeof window < "u", W = ({
|
|
20
20
|
isDev: e,
|
|
21
21
|
isStage: o,
|
|
22
22
|
isPlatform: a
|
|
23
|
-
}) => `${e ? "" : `https://${o ?
|
|
24
|
-
if (!
|
|
23
|
+
}) => `${e ? "" : `https://${o ? E : x}`}/${a ? "platform-api" : "api"}`, C = () => {
|
|
24
|
+
if (!m()) return "";
|
|
25
25
|
const { hostname: e } = window.location;
|
|
26
26
|
if (e) return e;
|
|
27
27
|
try {
|
|
@@ -30,10 +30,10 @@ const x = "app.grapesjs.com", O = "app-stage.grapesjs.com", H = "app2.grapesjs.c
|
|
|
30
30
|
return "";
|
|
31
31
|
}
|
|
32
32
|
}, F = () => {
|
|
33
|
-
const e =
|
|
33
|
+
const e = C();
|
|
34
34
|
return !!e && (D.includes(e) || D.some((o) => e.endsWith(o)));
|
|
35
35
|
};
|
|
36
|
-
async function
|
|
36
|
+
async function S({
|
|
37
37
|
path: e,
|
|
38
38
|
baseApiUrl: o,
|
|
39
39
|
method: a = "GET",
|
|
@@ -60,11 +60,11 @@ const G = {
|
|
|
60
60
|
[B.business]: 20,
|
|
61
61
|
[B.enterprise]: 30
|
|
62
62
|
};
|
|
63
|
-
function
|
|
63
|
+
function V(e) {
|
|
64
64
|
const o = e;
|
|
65
65
|
return o.init = (a) => (c) => e(c, a), o;
|
|
66
66
|
}
|
|
67
|
-
const K = (e) => /* @__PURE__ */
|
|
67
|
+
const K = (e) => /* @__PURE__ */ V(e);
|
|
68
68
|
async function q({
|
|
69
69
|
editor: e,
|
|
70
70
|
plan: o,
|
|
@@ -106,7 +106,7 @@ async function q({
|
|
|
106
106
|
u(t);
|
|
107
107
|
return;
|
|
108
108
|
}
|
|
109
|
-
e.on(
|
|
109
|
+
e.on(j, (t) => u(t));
|
|
110
110
|
}
|
|
111
111
|
const Z = (e) => ({
|
|
112
112
|
sdkLicense: e.license,
|
|
@@ -117,7 +117,7 @@ const Z = (e) => ({
|
|
|
117
117
|
async function z(e) {
|
|
118
118
|
const { licenseKey: o, pluginName: a, baseApiUrl: c } = e;
|
|
119
119
|
try {
|
|
120
|
-
return (await
|
|
120
|
+
return (await S({
|
|
121
121
|
baseApiUrl: c,
|
|
122
122
|
path: `/sdk/${o || "na"}`,
|
|
123
123
|
method: "POST",
|
|
@@ -131,7 +131,7 @@ async function z(e) {
|
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
var v = /* @__PURE__ */ ((e) => (e.panelBlocks = "panelBlocks", e.panelPagesLayers = "panelPagesLayers", e.panelGlobalStyles = "panelGlobalStyles", e.panelSidebarTabs = "panelSidebarTabs", e.panelAssets = "panelAssets", e.aiChatPanel = "aiChatPanel", e.panelDataSources = "panelDataSources", e))(v || {});
|
|
134
|
-
const
|
|
134
|
+
const O = "sidebarButtonsTarget", R = (e, o) => {
|
|
135
135
|
const { id: a, icon: c, label: i, tooltip: h, className: f, skipSelfClose: r, removeLayouts: d, layoutComponent: b, layoutCommand: u } = e, { pluginOpts: t, breakpointProps: L } = o, n = a;
|
|
136
136
|
return {
|
|
137
137
|
id: U(a),
|
|
@@ -147,7 +147,7 @@ const E = "sidebarButtonsTarget", R = (e, o) => {
|
|
|
147
147
|
onClick: ({ editor: g, state: s }) => {
|
|
148
148
|
var w;
|
|
149
149
|
if (s.active && r) return;
|
|
150
|
-
const l = (u == null ? void 0 : u.placer) || { type: "static", layoutId:
|
|
150
|
+
const l = (u == null ? void 0 : u.placer) || { type: "static", layoutId: O }, y = { ...l, skipCleanup: l.type === "static" }, p = d || Object.keys(v).filter((k) => k !== n);
|
|
151
151
|
$(g, { removeLayouts: p, layout: { placer: y } });
|
|
152
152
|
const A = {
|
|
153
153
|
id: n,
|
|
@@ -218,7 +218,7 @@ const E = "sidebarButtonsTarget", R = (e, o) => {
|
|
|
218
218
|
layoutComponent: { type: "panelSidebarTabs" }
|
|
219
219
|
}
|
|
220
220
|
], f = {
|
|
221
|
-
id:
|
|
221
|
+
id: O,
|
|
222
222
|
type: "column",
|
|
223
223
|
className: "gs-cmp-layout-sidebar-target",
|
|
224
224
|
style: { overflow: "hidden" }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(v,p){typeof exports=="object"&&typeof module<"u"?module.exports=p():typeof define=="function"&&define.amd?define(p):(v=typeof globalThis<"u"?globalThis:v||self,v.StudioSdkPlugins_layoutSidebarButtons=p())})(this,function(){"use strict";var v=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(v||{}),p=(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.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))(p||{}),D=(e=>(e.layoutToggleId="studio:layoutToggle:",e.toggleBlocksPanel="studio:toggleBlocksPanel",e.pageSettingsUpdate="studio:pageSettingsUpdate",e.toggleDataSourcesPreview="studio:toggleDataSourcesPreview",e))(D||{});const G="app.grapesjs.com",M="app-stage.grapesjs.com",I=[G,"app2.grapesjs.com",M,"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"],m="license:check:end",H=()=>typeof window<"u",j=({isDev:e,isStage:o,isPlatform:a})=>`${e?"":`https://${o?M:G}`}/${a?"platform-api":"api"}`,S=()=>{if(!H())return"";const{hostname:e}=window.location;if(e)return e;try{return window.parent.location.hostname||""}catch{return""}},W=()=>{const e=S();return!!e&&(I.includes(e)||I.some(o=>e.endsWith(o)))};async function F({path:e,baseApiUrl:o,method:a="GET",headers:c={},params:i,body:T}){const r=`${o||j({isDev:!1,isStage:!1})}${e}`,d={method:a,headers:{"Content-Type":"application/json",...c}};T&&(d.body=JSON.stringify(T));const b=i?new URLSearchParams(i).toString():"",u=b?`?${b}`:"",t=await fetch(`${r}${u}`,d);if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return t.json()}const x={[v.free]:0,[v.startup]:10,[v.business]:20,[v.enterprise]:30};function V(e){const o=e;return o.init=a=>c=>e(c,a),o}const C=e=>V(e);async function K({editor:e,plan:o,pluginName:a,licenseKey:c,onLicenseCheckResponse:i,cleanup:T}){let h="",r;const d=t=>{console.warn("Cleanup plugin:",a,"Reason:",t),T()},b=(t={})=>{var l;const{error:A,sdkLicense:s}=t,g=(l=t.plan)==null?void 0:l.category;if(!(s||t.license)||A)d(A||"Invalid license");else if(g){const y=x[o],f=x[g];y>f&&d({pluginRequiredPlan:o,licensePlan:g})}};e.Commands.has(p.settings)&&(r=e.runCommand(p.settings),h=(r==null?void 0:r.baseUrl)||"");const u=t=>{i==null||i(t),t&&b(t)};if(!r){e.onReady(async()=>{if(!W())if(c){const t=await Z({licenseKey:c,pluginName:a,baseApiUrl:h});u(t)}else d("The `licenseKey` option not provided")});return}if(r.licensePlan||r.licenseError){const t=q(r);u(t);return}e.on(m,t=>u(t))}const q=e=>({sdkLicense:e.license,license:e.license,error:e.licenseError,plan:e.licensePlan});async function Z(e){const{licenseKey:o,pluginName:a,baseApiUrl:c}=e;try{return(await F({baseApiUrl:c,path:`/sdk/${o||"na"}`,method:"POST",params:{d:window.location.hostname,pn:a}})).result||{}}catch(i){return console.error("Error during SDK license check:",i),!1}}var P=(e=>(e.panelBlocks="panelBlocks",e.panelPagesLayers="panelPagesLayers",e.panelGlobalStyles="panelGlobalStyles",e.panelSidebarTabs="panelSidebarTabs",e.panelAssets="panelAssets",e.aiChatPanel="aiChatPanel",e.panelDataSources="panelDataSources",e))(P||{});const O="sidebarButtonsTarget",R=(e,o)=>{const{id:a,icon:c,label:i,tooltip:T,className:h,skipSelfClose:r,removeLayouts:d,layoutComponent:b,layoutCommand:u}=e,{pluginOpts:t,breakpointProps:A}=o,s=a;return{id:E(a),type:"button",icon:c,tooltip:i||T,className:h,editorEvents:{[`${D.layoutToggleId}${s}`]:({fromEvent:g,setState:n,editor:l})=>{n({active:g.isOpen}),setTimeout(()=>l.refresh({tools:!0}),20)}},onClick:({editor:g,state:n})=>{var w;if(n.active&&r)return;const l=(u==null?void 0:u.placer)||{type:"static",layoutId:O},y={...l,skipCleanup:l.type==="static"},f=d||Object.keys(P).filter(k=>k!==s);N(g,{removeLayouts:f,layout:{placer:y}});const B={id:s,placer:l,header:(u==null?void 0:u.header)??{label:i,close:!r},layout:b,style:{width:280,height:"100%",borderRightWidth:1,...u==null?void 0:u.style}},L=((w=t==null?void 0:t.sidebarLayoutCommand)==null?void 0:w.call(t,{...A,layoutCommand:B,sidebarButtonProps:e}))||B;g.runCommand(p.layoutToggle,{...L})}}},E=e=>`button__${e}`,N=(e,o={})=>{(o.removeLayouts||Object.keys(P)).forEach(c=>e.runCommand(p.layoutRemove,{id:c,layout:o.layout}))},U=e=>{const o=(e==null?void 0:e.breakpointTablet)??1024,a=(e==null?void 0:e.breakpointMobile)??768,c={},i=[{id:P.panelBlocks,icon:"plusBox",label:"Blocks",layoutComponent:{type:"panelBlocks"}},{id:P.panelPagesLayers,icon:"layers",label:"Pages & Layers",layoutComponent:{type:"panelPagesLayers"}},{id:P.panelGlobalStyles,icon:'<svg viewBox="0 0 24 24"> <path d="M20 14H6c-2.2 0-4 1.8-4 4s1.8 4 4 4h14a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2M6 20c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2m.3-8L13 5.3a2 2 0 0 1 2.8 0l2.8 2.8c.8.8.8 2 0 2.8l-.9 1.1H6.3M2 13.5V4c0-1.1.9-2 2-2h4a2 2 0 0 1 2 2v1.5l-8 8Z"/></svg>',label:"Global Styles",layoutComponent:{type:"panelGlobalStyles"}},{id:P.panelAssets,icon:'<svg viewBox="0 0 24 24"><path d="M22,16V4A2,2 0 0,0 20,2H8A2,2 0 0,0 6,4V16A2,2 0 0,0 8,18H20A2,2 0 0,0 22,16M11,12L13.03,14.71L16,11L20,16H8M2,6V20A2,2 0 0,0 4,22H18V20H4V6" /></svg>',label:"Assets",layoutComponent:{type:"panelAssets",content:{itemsPerRow:2,header:{addUrl:!1}},style:{padding:7},onSelect:({assetProps:s,editor:g})=>{var f;const n=g.getSelected(),l={type:"image",src:s.src};let y;if(n!=null&&n.is("image"))return n.set("src",s.src);n&&g.Components.canMove(n,l)?y=n.append(l)[0]:n||(y=(f=g.getWrapper())==null?void 0:f.append(l)[0]),y&&g.select(y,{scroll:!0})}}}],T=[...i,{id:P.panelSidebarTabs,layoutCommand:{header:!1},icon:'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 0 1-1.5-1.5A1.5 1.5 0 0 1 17.5 9a1.5 1.5 0 0 1 1.5 1.5 1.5 1.5 0 0 1-1.5 1.5m-3-4A1.5 1.5 0 0 1 13 6.5 1.5 1.5 0 0 1 14.5 5 1.5 1.5 0 0 1 16 6.5 1.5 1.5 0 0 1 14.5 8m-5 0A1.5 1.5 0 0 1 8 6.5 1.5 1.5 0 0 1 9.5 5 1.5 1.5 0 0 1 11 6.5 1.5 1.5 0 0 1 9.5 8m-3 4A1.5 1.5 0 0 1 5 10.5 1.5 1.5 0 0 1 6.5 9 1.5 1.5 0 0 1 8 10.5 1.5 1.5 0 0 1 6.5 12M12 3a9 9 0 0 0-9 9 9 9 0 0 0 9 9 1.5 1.5 0 0 0 1.5-1.5c0-.4-.2-.7-.4-1-.2-.3-.4-.6-.4-1a1.5 1.5 0 0 1 1.5-1.5H16a5 5 0 0 0 5-5c0-4.4-4-8-9-8Z"/></svg>',label:"Styles & Props",layoutComponent:{type:"panelSidebarTabs"}}],h={id:O,type:"column",className:"gs-cmp-layout-sidebar-target",style:{overflow:"hidden"}},r={type:"sidebarLeft",resizable:!1,style:{padding:"10px 5px",alignItems:"center",width:45,gap:10},children:[]},d={type:"canvasSidebarTop",sidebarTop:{leftContainer:{buttons:[]}}},b=s=>({breakpoint:s,breakpointTablet:o,breakpointMobile:a}),u=(s,g,n)=>{const l=b(g),y={pluginOpts:e,breakpointProps:l},f=s.map(L=>{const w=R(L,y);return e!=null&&e.sidebarButton?e.sidebarButton({id:L.id,buttonIds:P,buttonProps:w,sidebarButtonProps:L,...l,createSidebarButton:k=>R({...L,...k},y)}):w}).filter(Boolean);return(e!=null&&e.sidebarButtons?e==null?void 0:e.sidebarButtons({buttonIds:P,sidebarButtons:f,...l,createSidebarButton:L=>R({...L,layoutCommand:{...n==null?void 0:n.layoutCommand,...L.layoutCommand}},y)}):f).filter(Boolean)},t=(s,g,n)=>{var f;const l=b(n),y={pluginOpts:e,breakpointProps:l};return((f=e==null?void 0:e.rootLayout)==null?void 0:f.call(e,{sidebarButtons:g,rootLayout:s,layoutSidebarLeft:r,layoutSidebarTarget:h,...l,createSidebarButton:B=>R({...B},y)}))??s};if(o){const s=u(T,o);c[o]=t({type:"row",style:{height:"100%"},children:[{...r,children:s},h,d]},s,o)}if(a){const s={placer:{type:"absolute",position:"left"},style:{height:"calc(100% - 40px)"}},g=T.map(l=>({...l,layoutCommand:s})),n=u(g,a,{layoutCommand:s});c[a]=t({type:"column",style:{height:"100%"},children:[{type:"sidebarTop",leftContainer:{buttons:[]}},{type:"canvas",grow:!0},{type:"sidebarBottom",style:{padding:"0 5px",alignItems:"center",gap:10,minHeight:39},children:n}]},n,a)}const A=u(i,0);return{default:t({type:"row",style:{height:"100%"},children:[{...r,children:A},h,d,{type:"sidebarRight"}]},A,0),responsive:c}},_="layoutSidebarButtons",z=v.free,$=C(function(e,o={}){const{Commands:a}=e,c=a.events,i={...o};(()=>{if(e.runCommand(p.layoutConfigGet)||i.skipLayoutConfig===!0)return;const r=U(i);e.runCommand(p.layoutConfigSet,{...r})})(),a.add(`${_}:toggleButton`,(h,r,d)=>{const b=document.getElementById(E(d==null?void 0:d.id));b==null||b.click()}),e.on(`${c.runCommand}core:preview`,()=>{N(e)}),K({editor:e,licenseKey:i.licenseKey,plan:z,pluginName:_,cleanup:()=>{e.runCommand(p.layoutConfigSet)}})});return $.createLayoutConfig=e=>U(e),$});
|
|
1
|
+
(function(v,p){typeof exports=="object"&&typeof module<"u"?module.exports=p():typeof define=="function"&&define.amd?define(p):(v=typeof globalThis<"u"?globalThis:v||self,v.StudioSdkPlugins_layoutSidebarButtons=p())})(this,function(){"use strict";var v=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(v||{}),p=(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))(p||{}),D=(e=>(e.layoutToggleId="studio:layoutToggle:",e.toggleBlocksPanel="studio:toggleBlocksPanel",e.pageSettingsUpdate="studio:pageSettingsUpdate",e.toggleDataSourcesPreview="studio:toggleDataSourcesPreview",e))(D||{});const G="app.grapesjs.com",M="app-stage.grapesjs.com",I=[G,"app2.grapesjs.com",M,"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"],m="license:check:end",H=()=>typeof window<"u",j=({isDev:e,isStage:o,isPlatform:a})=>`${e?"":`https://${o?M:G}`}/${a?"platform-api":"api"}`,S=()=>{if(!H())return"";const{hostname:e}=window.location;if(e)return e;try{return window.parent.location.hostname||""}catch{return""}},W=()=>{const e=S();return!!e&&(I.includes(e)||I.some(o=>e.endsWith(o)))};async function C({path:e,baseApiUrl:o,method:a="GET",headers:c={},params:i,body:T}){const r=`${o||j({isDev:!1,isStage:!1})}${e}`,d={method:a,headers:{"Content-Type":"application/json",...c}};T&&(d.body=JSON.stringify(T));const b=i?new URLSearchParams(i).toString():"",u=b?`?${b}`:"",t=await fetch(`${r}${u}`,d);if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return t.json()}const x={[v.free]:0,[v.startup]:10,[v.business]:20,[v.enterprise]:30};function F(e){const o=e;return o.init=a=>c=>e(c,a),o}const V=e=>F(e);async function K({editor:e,plan:o,pluginName:a,licenseKey:c,onLicenseCheckResponse:i,cleanup:T}){let h="",r;const d=t=>{console.warn("Cleanup plugin:",a,"Reason:",t),T()},b=(t={})=>{var l;const{error:A,sdkLicense:s}=t,g=(l=t.plan)==null?void 0:l.category;if(!(s||t.license)||A)d(A||"Invalid license");else if(g){const y=x[o],f=x[g];y>f&&d({pluginRequiredPlan:o,licensePlan:g})}};e.Commands.has(p.settings)&&(r=e.runCommand(p.settings),h=(r==null?void 0:r.baseUrl)||"");const u=t=>{i==null||i(t),t&&b(t)};if(!r){e.onReady(async()=>{if(!W())if(c){const t=await Z({licenseKey:c,pluginName:a,baseApiUrl:h});u(t)}else d("The `licenseKey` option not provided")});return}if(r.licensePlan||r.licenseError){const t=q(r);u(t);return}e.on(m,t=>u(t))}const q=e=>({sdkLicense:e.license,license:e.license,error:e.licenseError,plan:e.licensePlan});async function Z(e){const{licenseKey:o,pluginName:a,baseApiUrl:c}=e;try{return(await C({baseApiUrl:c,path:`/sdk/${o||"na"}`,method:"POST",params:{d:window.location.hostname,pn:a}})).result||{}}catch(i){return console.error("Error during SDK license check:",i),!1}}var P=(e=>(e.panelBlocks="panelBlocks",e.panelPagesLayers="panelPagesLayers",e.panelGlobalStyles="panelGlobalStyles",e.panelSidebarTabs="panelSidebarTabs",e.panelAssets="panelAssets",e.aiChatPanel="aiChatPanel",e.panelDataSources="panelDataSources",e))(P||{});const O="sidebarButtonsTarget",R=(e,o)=>{const{id:a,icon:c,label:i,tooltip:T,className:h,skipSelfClose:r,removeLayouts:d,layoutComponent:b,layoutCommand:u}=e,{pluginOpts:t,breakpointProps:A}=o,s=a;return{id:E(a),type:"button",icon:c,tooltip:i||T,className:h,editorEvents:{[`${D.layoutToggleId}${s}`]:({fromEvent:g,setState:n,editor:l})=>{n({active:g.isOpen}),setTimeout(()=>l.refresh({tools:!0}),20)}},onClick:({editor:g,state:n})=>{var w;if(n.active&&r)return;const l=(u==null?void 0:u.placer)||{type:"static",layoutId:O},y={...l,skipCleanup:l.type==="static"},f=d||Object.keys(P).filter(k=>k!==s);N(g,{removeLayouts:f,layout:{placer:y}});const B={id:s,placer:l,header:(u==null?void 0:u.header)??{label:i,close:!r},layout:b,style:{width:280,height:"100%",borderRightWidth:1,...u==null?void 0:u.style}},L=((w=t==null?void 0:t.sidebarLayoutCommand)==null?void 0:w.call(t,{...A,layoutCommand:B,sidebarButtonProps:e}))||B;g.runCommand(p.layoutToggle,{...L})}}},E=e=>`button__${e}`,N=(e,o={})=>{(o.removeLayouts||Object.keys(P)).forEach(c=>e.runCommand(p.layoutRemove,{id:c,layout:o.layout}))},U=e=>{const o=(e==null?void 0:e.breakpointTablet)??1024,a=(e==null?void 0:e.breakpointMobile)??768,c={},i=[{id:P.panelBlocks,icon:"plusBox",label:"Blocks",layoutComponent:{type:"panelBlocks"}},{id:P.panelPagesLayers,icon:"layers",label:"Pages & Layers",layoutComponent:{type:"panelPagesLayers"}},{id:P.panelGlobalStyles,icon:'<svg viewBox="0 0 24 24"> <path d="M20 14H6c-2.2 0-4 1.8-4 4s1.8 4 4 4h14a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2M6 20c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2m.3-8L13 5.3a2 2 0 0 1 2.8 0l2.8 2.8c.8.8.8 2 0 2.8l-.9 1.1H6.3M2 13.5V4c0-1.1.9-2 2-2h4a2 2 0 0 1 2 2v1.5l-8 8Z"/></svg>',label:"Global Styles",layoutComponent:{type:"panelGlobalStyles"}},{id:P.panelAssets,icon:'<svg viewBox="0 0 24 24"><path d="M22,16V4A2,2 0 0,0 20,2H8A2,2 0 0,0 6,4V16A2,2 0 0,0 8,18H20A2,2 0 0,0 22,16M11,12L13.03,14.71L16,11L20,16H8M2,6V20A2,2 0 0,0 4,22H18V20H4V6" /></svg>',label:"Assets",layoutComponent:{type:"panelAssets",content:{itemsPerRow:2,header:{addUrl:!1}},style:{padding:7},onSelect:({assetProps:s,editor:g})=>{var f;const n=g.getSelected(),l={type:"image",src:s.src};let y;if(n!=null&&n.is("image"))return n.set("src",s.src);n&&g.Components.canMove(n,l)?y=n.append(l)[0]:n||(y=(f=g.getWrapper())==null?void 0:f.append(l)[0]),y&&g.select(y,{scroll:!0})}}}],T=[...i,{id:P.panelSidebarTabs,layoutCommand:{header:!1},icon:'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 0 1-1.5-1.5A1.5 1.5 0 0 1 17.5 9a1.5 1.5 0 0 1 1.5 1.5 1.5 1.5 0 0 1-1.5 1.5m-3-4A1.5 1.5 0 0 1 13 6.5 1.5 1.5 0 0 1 14.5 5 1.5 1.5 0 0 1 16 6.5 1.5 1.5 0 0 1 14.5 8m-5 0A1.5 1.5 0 0 1 8 6.5 1.5 1.5 0 0 1 9.5 5 1.5 1.5 0 0 1 11 6.5 1.5 1.5 0 0 1 9.5 8m-3 4A1.5 1.5 0 0 1 5 10.5 1.5 1.5 0 0 1 6.5 9 1.5 1.5 0 0 1 8 10.5 1.5 1.5 0 0 1 6.5 12M12 3a9 9 0 0 0-9 9 9 9 0 0 0 9 9 1.5 1.5 0 0 0 1.5-1.5c0-.4-.2-.7-.4-1-.2-.3-.4-.6-.4-1a1.5 1.5 0 0 1 1.5-1.5H16a5 5 0 0 0 5-5c0-4.4-4-8-9-8Z"/></svg>',label:"Styles & Props",layoutComponent:{type:"panelSidebarTabs"}}],h={id:O,type:"column",className:"gs-cmp-layout-sidebar-target",style:{overflow:"hidden"}},r={type:"sidebarLeft",resizable:!1,style:{padding:"10px 5px",alignItems:"center",width:45,gap:10},children:[]},d={type:"canvasSidebarTop",sidebarTop:{leftContainer:{buttons:[]}}},b=s=>({breakpoint:s,breakpointTablet:o,breakpointMobile:a}),u=(s,g,n)=>{const l=b(g),y={pluginOpts:e,breakpointProps:l},f=s.map(L=>{const w=R(L,y);return e!=null&&e.sidebarButton?e.sidebarButton({id:L.id,buttonIds:P,buttonProps:w,sidebarButtonProps:L,...l,createSidebarButton:k=>R({...L,...k},y)}):w}).filter(Boolean);return(e!=null&&e.sidebarButtons?e==null?void 0:e.sidebarButtons({buttonIds:P,sidebarButtons:f,...l,createSidebarButton:L=>R({...L,layoutCommand:{...n==null?void 0:n.layoutCommand,...L.layoutCommand}},y)}):f).filter(Boolean)},t=(s,g,n)=>{var f;const l=b(n),y={pluginOpts:e,breakpointProps:l};return((f=e==null?void 0:e.rootLayout)==null?void 0:f.call(e,{sidebarButtons:g,rootLayout:s,layoutSidebarLeft:r,layoutSidebarTarget:h,...l,createSidebarButton:B=>R({...B},y)}))??s};if(o){const s=u(T,o);c[o]=t({type:"row",style:{height:"100%"},children:[{...r,children:s},h,d]},s,o)}if(a){const s={placer:{type:"absolute",position:"left"},style:{height:"calc(100% - 40px)"}},g=T.map(l=>({...l,layoutCommand:s})),n=u(g,a,{layoutCommand:s});c[a]=t({type:"column",style:{height:"100%"},children:[{type:"sidebarTop",leftContainer:{buttons:[]}},{type:"canvas",grow:!0},{type:"sidebarBottom",style:{padding:"0 5px",alignItems:"center",gap:10,minHeight:39},children:n}]},n,a)}const A=u(i,0);return{default:t({type:"row",style:{height:"100%"},children:[{...r,children:A},h,d,{type:"sidebarRight"}]},A,0),responsive:c}},_="layoutSidebarButtons",z=v.free,$=V(function(e,o={}){const{Commands:a}=e,c=a.events,i={...o};(()=>{if(e.runCommand(p.layoutConfigGet)||i.skipLayoutConfig===!0)return;const r=U(i);e.runCommand(p.layoutConfigSet,{...r})})(),a.add(`${_}:toggleButton`,(h,r,d)=>{const b=document.getElementById(E(d==null?void 0:d.id));b==null||b.click()}),e.on(`${c.runCommand}core:preview`,()=>{N(e)}),K({editor:e,licenseKey:i.licenseKey,plan:z,pluginName:_,cleanup:()=>{e.runCommand(p.layoutConfigSet)}})});return $.createLayoutConfig=e=>U(e),$});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const re="app.grapesjs.com",ce="app-stage.grapesjs.com",ge="app2.grapesjs.com",he="app-stage2.grapesjs.com",ee=[re,ge,ce,he,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io",".claudemcpcontent.com",".web-sandbox.oaiusercontent.com"],be="license:check:end",de=()=>typeof window<"u",ye=({isDev:e,isStage:l,isPlatform:t})=>`${e?"":`https://${l?ce:re}`}/${t?"platform-api":"api"}`,me=()=>{if(!de())return"";const{hostname:e}=window.location;if(e)return e;try{return window.parent.location.hostname||""}catch{return""}},ve=()=>{const e=me();return!!e&&(ee.includes(e)||ee.some(l=>e.endsWith(l)))};async function fe({path:e,baseApiUrl:l,method:t="GET",headers:o={},params:n,body:g}){const i=`${l||ye({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 E=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(E||{}),Z=(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.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))(Z||{});const te={[E.free]:0,[E.startup]:10,[E.business]:20,[E.enterprise]:30};function Te(e){const l=e;return l.init=t=>o=>e(o,t),l}const we=e=>Te(e);async function xe({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 G;const{error:I,sdkLicense:O}=r,T=(G=r.plan)==null?void 0:G.category;if(!(O||r.license)||I)u(I||"Invalid license");else if(T){const M=te[l],_=te[T];M>_&&u({pluginRequiredPlan:l,licensePlan:T})}};e.Commands.has(Z.settings)&&(i=e.runCommand(Z.settings),c=(i==null?void 0:i.baseUrl)||"");const b=r=>{n==null||n(r),r&&p(r)};if(!i){e.onReady(async()=>{if(!ve())if(o){const r=await Ae({licenseKey:o,pluginName:t,baseApiUrl:c});b(r)}else u("The `licenseKey` option not provided")});return}if(i.licensePlan||i.licenseError){const r=Pe(i);b(r);return}e.on(be,r=>b(r))}const Pe=e=>({sdkLicense:e.license,license:e.license,error:e.licenseError,plan:e.licensePlan});async function Ae(e){const{licenseKey:l,pluginName:t,baseApiUrl:o}=e;try{return(await fe({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 z=(e,l)=>{var t;return!!((t=e==null?void 0:e.hasAttribute)!=null&&t.call(e,l))},Le="lightGalleryComponent",Ie=E.startup;var S=(e=>(e.image="image",e.video="video",e.external="external",e))(S||{});const A="lightGallery",ae=`${A}-item`,j="data-lightgallery",oe=`${j}-item`,N="toggle",L={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>'},F={propKeys:[],props:{},traits:[]},V=(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})},W=(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)})},Ge=(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)},ke={[N]:{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}},Se={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"}]}}},Ee={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}]}}},Oe={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}]}}},f="sourceType",U="data-iframe",J={name:"href",type:"file",label:"Image Source"},H={name:"data-src",label:"Video Source",placeholder:"https://www.youtube.com/watch?v=..."},C={name:"data-poster",label:"Video Poster",type:"file"},le={name:"data-src",label:"External Source",placeholder:"https://some-external-source.com/...."},pe={label:"Caption",name:"data-sub-html",placeholder:"My caption",changeProp:!1},Me={[N]:{type:"button",label:"Toggle Gallery",command:(e,l)=>{var n,g;const t=l.target,o=(n=t==null?void 0:t.closestType(A))==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)}}},[f]:{type:"radio",label:"Source type",labelToTitle:!0,value:"image",subTraits:{image:[J],video:[H,C],external:[le]},options:[{id:"image",label:J.label||"",icon:L.image},{id:"video",label:H.label||"",icon:L.video},{id:"external",label:le.label||"",icon:L.external}]},subHtml:pe},se="lgThumbnail",De="lgVideo",ne="lgAutoplay",ie="lgZoom",k="https://cdn.jsdelivr.net/npm/lightgallery@2.8.2",Ve=function(e,l={}){const{Blocks:t,Components:o}=e,n="LightGallery",g="LightGallery Item",c={toolbarIconOpen:L.eye,block:{},lgLicenseKey:"92DE1DB8-7986-4F02-B908-514F97678D28",defaultSrc:"https://placehold.co/200/777/white.png?text=Image",plugins:[se,De,ne,ie],cdnScript:[`${k}/lightgallery.min.js`,`${k}/plugins/thumbnail/lg-thumbnail.min.js`,`${k}/plugins/video/lg-video.min.js`,`${k}/plugins/autoplay/lg-autoplay.min.js`,`${k}/plugins/zoom/lg-zoom.min.js`],cdnStyle:`${k}/css/lightgallery-bundle.min.css`,...l},{block:i,toolbarIconOpen:u,defaultSrc:p}=c,b=function(a){const s=this,h=window,{plugins:y,cdnScript:w,cdnStyle:D,inline:Q,lgLicenseKey:ue,...m}=a||{},x=d=>isNaN(d)?void 0:parseInt(d,10),X=()=>{var B;const d={...m,licenseKey:ue,speed:x(m.speed),startAnimationDuration:x(m.startAnimationDuration),thumbMargin:x(m.thumbMargin),thumbWidth:x(m.thumbWidth),slideShowInterval:x(m.slideShowInterval),scale:x(m.scale),enableZoomAfter:x(m.enableZoomAfter),plugins:(y||[]).map($=>h[$])};Q&&(d.container=s,d.closable=!1);const K=(B=h.lightGallery)==null?void 0:B.call(h,s,d);Q&&K.openGallery()};if(h.lightGallery)X();else{const{head:d}=document,K=Array.isArray(w)?[...w]:[w],B=Array.isArray(D)?[...D]:[D],$=P=>{if(P.length){const v=document.createElement("link");v.href=P.shift(),v.rel="stylesheet",d.appendChild(v),$(P)}},Y=P=>{if(P.length){const v=document.createElement("script");v.src=P.shift(),v.onerror=v.onload=Y.bind(null,P),d.appendChild(v)}else X()};$(B),Y(K)}},r=a=>{const s=a.getTrait(N);if(!u||!s)return;const{toolbar:h}=a,y={id:N,label:u,command:()=>setTimeout(()=>s.runCommand(),100)};!h.find(D=>D.id===y.id)&&(h==null||h.unshift(y))};let I=[];const O=c.plugins||[],T=V(ke),R=O.includes(se)?V(Se):F,G=O.includes(ne)?V(Ee):F,M=O.includes(ie)?V(Oe):F;o.addType(A,{block:i&&{label:n,media:L.gallery,category:"Extra",select:!0,...c.block},isComponent:a=>z(a,j),extendFn:["init","initToolbar"],model:{defaults:{name:n,icon:L.gallery,draggable:(a,s)=>!s.is(A),attributes:{[j]:!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",...T.propKeys,...R.propKeys,...G.propKeys,...M.propKeys],...T.props,...R.props,...G.props,...M.props,traits:[...T.traits,...R.traits,...G.traits,...M.traits]},init(){W(this,["thumbnail"]),W(this,["autoplay"]),W(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();I=s.getSpots(),setTimeout(()=>s.removeSpots()),h.__lgOpened=!0},onLgClose(){const a=this.getLightGallery();I.forEach(s=>this.em.Canvas.addSpot(s.attributes)),I=[],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 _=V(Me);o.addType(ae,{isComponent:a=>z(a,oe)||a.tagName==="A"&&z(a.parentElement,j),extendFn:["init","initToolbar"],model:{defaults:{tagName:"a",name:g,icon:L.galleryItem,attributes:{[oe]:!0,href:p},components:{type:"image",attributes:{alt:"Image",src:p}},..._.props,traits:[..._.traits]},init(){const a=[f].map(s=>`change:${s}`).join(" ");this.initSourceType(),this.on(a,this.updateTraits),this.updateTraits({init:!0}),this.initScriptUpdate(),Ge(this,f,this.triggerGalleryUpdate)},initToolbar(){r(this)},initScriptUpdate(){const a=[pe.name].map(s=>`change:attributes:${s}`).join(" ");this.on(a,this.triggerGalleryUpdate)},triggerGalleryUpdate(...a){var s;(s=this.closestType(A))==null||s.__scriptPropsChange(...a)},updateTraits(a={}){const{changed:s}=this,{init:h}=a;if(s[f]||h){q(this,f);const y=this.getTrait(f).getValue();if(y===S.image){this.removeAttributes([H.name,C.name,U]);const w=this.getTrait(J.name);w.setValue(w.getValue()||p)}else y===S.video?this.removeAttributes([U]):y===S.external&&this.addAttributes({[U]:!0})}},initSourceType(){const a=this.getAttributes({noClass:!0,noStyle:!0});a[U]?this.set(f,S.external):(a[H.name]||a[C.name])&&this.set(f,S.video)}}}),xe({editor:e,plan:Ie,licenseKey:c.licenseKey,pluginName:Le,cleanup:()=>{t.remove(A),o.removeType(A)}})},Re=we(Ve);module.exports=Re;
|
|
1
|
+
"use strict";const re="app.grapesjs.com",ce="app-stage.grapesjs.com",ge="app2.grapesjs.com",he="app-stage2.grapesjs.com",ee=[re,ge,ce,he,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io",".claudemcpcontent.com",".web-sandbox.oaiusercontent.com"],be="license:check:end",de=()=>typeof window<"u",ye=({isDev:e,isStage:l,isPlatform:t})=>`${e?"":`https://${l?ce:re}`}/${t?"platform-api":"api"}`,me=()=>{if(!de())return"";const{hostname:e}=window.location;if(e)return e;try{return window.parent.location.hostname||""}catch{return""}},ve=()=>{const e=me();return!!e&&(ee.includes(e)||ee.some(l=>e.endsWith(l)))};async function fe({path:e,baseApiUrl:l,method:t="GET",headers:o={},params:n,body:g}){const i=`${l||ye({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 S=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(S||{}),Z=(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))(Z||{});const te={[S.free]:0,[S.startup]:10,[S.business]:20,[S.enterprise]:30};function Te(e){const l=e;return l.init=t=>o=>e(o,t),l}const we=e=>Te(e);async function xe({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 G;const{error:I,sdkLicense:O}=r,T=(G=r.plan)==null?void 0:G.category;if(!(O||r.license)||I)u(I||"Invalid license");else if(T){const M=te[l],_=te[T];M>_&&u({pluginRequiredPlan:l,licensePlan:T})}};e.Commands.has(Z.settings)&&(i=e.runCommand(Z.settings),c=(i==null?void 0:i.baseUrl)||"");const b=r=>{n==null||n(r),r&&p(r)};if(!i){e.onReady(async()=>{if(!ve())if(o){const r=await Ae({licenseKey:o,pluginName:t,baseApiUrl:c});b(r)}else u("The `licenseKey` option not provided")});return}if(i.licensePlan||i.licenseError){const r=Pe(i);b(r);return}e.on(be,r=>b(r))}const Pe=e=>({sdkLicense:e.license,license:e.license,error:e.licenseError,plan:e.licensePlan});async function Ae(e){const{licenseKey:l,pluginName:t,baseApiUrl:o}=e;try{return(await fe({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 z=(e,l)=>{var t;return!!((t=e==null?void 0:e.hasAttribute)!=null&&t.call(e,l))},Le="lightGalleryComponent",Ie=S.startup;var E=(e=>(e.image="image",e.video="video",e.external="external",e))(E||{});const A="lightGallery",ae=`${A}-item`,j="data-lightgallery",oe=`${j}-item`,N="toggle",L={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>'},F={propKeys:[],props:{},traits:[]},V=(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})},W=(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)})},Ge=(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)},ke={[N]:{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}},Ee={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"}]}}},Se={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}]}}},Oe={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}]}}},f="sourceType",U="data-iframe",C={name:"href",type:"file",label:"Image Source"},H={name:"data-src",label:"Video Source",placeholder:"https://www.youtube.com/watch?v=..."},J={name:"data-poster",label:"Video Poster",type:"file"},le={name:"data-src",label:"External Source",placeholder:"https://some-external-source.com/...."},pe={label:"Caption",name:"data-sub-html",placeholder:"My caption",changeProp:!1},Me={[N]:{type:"button",label:"Toggle Gallery",command:(e,l)=>{var n,g;const t=l.target,o=(n=t==null?void 0:t.closestType(A))==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)}}},[f]:{type:"radio",label:"Source type",labelToTitle:!0,value:"image",subTraits:{image:[C],video:[H,J],external:[le]},options:[{id:"image",label:C.label||"",icon:L.image},{id:"video",label:H.label||"",icon:L.video},{id:"external",label:le.label||"",icon:L.external}]},subHtml:pe},se="lgThumbnail",De="lgVideo",ne="lgAutoplay",ie="lgZoom",k="https://cdn.jsdelivr.net/npm/lightgallery@2.8.2",Ve=function(e,l={}){const{Blocks:t,Components:o}=e,n="LightGallery",g="LightGallery Item",c={toolbarIconOpen:L.eye,block:{},lgLicenseKey:"92DE1DB8-7986-4F02-B908-514F97678D28",defaultSrc:"https://placehold.co/200/777/white.png?text=Image",plugins:[se,De,ne,ie],cdnScript:[`${k}/lightgallery.min.js`,`${k}/plugins/thumbnail/lg-thumbnail.min.js`,`${k}/plugins/video/lg-video.min.js`,`${k}/plugins/autoplay/lg-autoplay.min.js`,`${k}/plugins/zoom/lg-zoom.min.js`],cdnStyle:`${k}/css/lightgallery-bundle.min.css`,...l},{block:i,toolbarIconOpen:u,defaultSrc:p}=c,b=function(a){const s=this,h=window,{plugins:y,cdnScript:w,cdnStyle:D,inline:Q,lgLicenseKey:ue,...m}=a||{},x=d=>isNaN(d)?void 0:parseInt(d,10),X=()=>{var B;const d={...m,licenseKey:ue,speed:x(m.speed),startAnimationDuration:x(m.startAnimationDuration),thumbMargin:x(m.thumbMargin),thumbWidth:x(m.thumbWidth),slideShowInterval:x(m.slideShowInterval),scale:x(m.scale),enableZoomAfter:x(m.enableZoomAfter),plugins:(y||[]).map($=>h[$])};Q&&(d.container=s,d.closable=!1);const K=(B=h.lightGallery)==null?void 0:B.call(h,s,d);Q&&K.openGallery()};if(h.lightGallery)X();else{const{head:d}=document,K=Array.isArray(w)?[...w]:[w],B=Array.isArray(D)?[...D]:[D],$=P=>{if(P.length){const v=document.createElement("link");v.href=P.shift(),v.rel="stylesheet",d.appendChild(v),$(P)}},Y=P=>{if(P.length){const v=document.createElement("script");v.src=P.shift(),v.onerror=v.onload=Y.bind(null,P),d.appendChild(v)}else X()};$(B),Y(K)}},r=a=>{const s=a.getTrait(N);if(!u||!s)return;const{toolbar:h}=a,y={id:N,label:u,command:()=>setTimeout(()=>s.runCommand(),100)};!h.find(D=>D.id===y.id)&&(h==null||h.unshift(y))};let I=[];const O=c.plugins||[],T=V(ke),R=O.includes(se)?V(Ee):F,G=O.includes(ne)?V(Se):F,M=O.includes(ie)?V(Oe):F;o.addType(A,{block:i&&{label:n,media:L.gallery,category:"Extra",select:!0,...c.block},isComponent:a=>z(a,j),extendFn:["init","initToolbar"],model:{defaults:{name:n,icon:L.gallery,draggable:(a,s)=>!s.is(A),attributes:{[j]:!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",...T.propKeys,...R.propKeys,...G.propKeys,...M.propKeys],...T.props,...R.props,...G.props,...M.props,traits:[...T.traits,...R.traits,...G.traits,...M.traits]},init(){W(this,["thumbnail"]),W(this,["autoplay"]),W(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();I=s.getSpots(),setTimeout(()=>s.removeSpots()),h.__lgOpened=!0},onLgClose(){const a=this.getLightGallery();I.forEach(s=>this.em.Canvas.addSpot(s.attributes)),I=[],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 _=V(Me);o.addType(ae,{isComponent:a=>z(a,oe)||a.tagName==="A"&&z(a.parentElement,j),extendFn:["init","initToolbar"],model:{defaults:{tagName:"a",name:g,icon:L.galleryItem,attributes:{[oe]:!0,href:p},components:{type:"image",attributes:{alt:"Image",src:p}},..._.props,traits:[..._.traits]},init(){const a=[f].map(s=>`change:${s}`).join(" ");this.initSourceType(),this.on(a,this.updateTraits),this.updateTraits({init:!0}),this.initScriptUpdate(),Ge(this,f,this.triggerGalleryUpdate)},initToolbar(){r(this)},initScriptUpdate(){const a=[pe.name].map(s=>`change:attributes:${s}`).join(" ");this.on(a,this.triggerGalleryUpdate)},triggerGalleryUpdate(...a){var s;(s=this.closestType(A))==null||s.__scriptPropsChange(...a)},updateTraits(a={}){const{changed:s}=this,{init:h}=a;if(s[f]||h){q(this,f);const y=this.getTrait(f).getValue();if(y===E.image){this.removeAttributes([H.name,J.name,U]);const w=this.getTrait(C.name);w.setValue(w.getValue()||p)}else y===E.video?this.removeAttributes([U]):y===E.external&&this.addAttributes({[U]:!0})}},initSourceType(){const a=this.getAttributes({noClass:!0,noStyle:!0});a[U]?this.set(f,E.external):(a[H.name]||a[J.name])&&this.set(f,E.video)}}}),xe({editor:e,plan:Ie,licenseKey:c.licenseKey,pluginName:Le,cleanup:()=>{t.remove(A),o.removeType(A)}})},Re=we(Ve);module.exports=Re;
|
|
@@ -53,12 +53,12 @@ async function fe({
|
|
|
53
53
|
throw new Error(`HTTP error! status: ${r.status}`);
|
|
54
54
|
return r.json();
|
|
55
55
|
}
|
|
56
|
-
var
|
|
56
|
+
var S = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(S || {}), Z = /* @__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))(Z || {});
|
|
57
57
|
const te = {
|
|
58
|
-
[
|
|
59
|
-
[
|
|
60
|
-
[
|
|
61
|
-
[
|
|
58
|
+
[S.free]: 0,
|
|
59
|
+
[S.startup]: 10,
|
|
60
|
+
[S.business]: 20,
|
|
61
|
+
[S.enterprise]: 30
|
|
62
62
|
};
|
|
63
63
|
function Te(e) {
|
|
64
64
|
const l = e;
|
|
@@ -133,8 +133,8 @@ async function Ae(e) {
|
|
|
133
133
|
const z = (e, l) => {
|
|
134
134
|
var t;
|
|
135
135
|
return !!((t = e == null ? void 0 : e.hasAttribute) != null && t.call(e, l));
|
|
136
|
-
}, Le = "lightGalleryComponent", Ie =
|
|
137
|
-
var
|
|
136
|
+
}, Le = "lightGalleryComponent", Ie = S.startup;
|
|
137
|
+
var E = /* @__PURE__ */ ((e) => (e.image = "image", e.video = "video", e.external = "external", e))(E || {});
|
|
138
138
|
const A = "lightGallery", ae = `${A}-item`, j = "data-lightgallery", oe = `${j}-item`, N = "toggle", L = {
|
|
139
139
|
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>',
|
|
140
140
|
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>',
|
|
@@ -295,7 +295,7 @@ const A = "lightGallery", ae = `${A}-item`, j = "data-lightgallery", oe = `${j}-
|
|
|
295
295
|
visible: ({ component: e }) => !!e.getTrait("closable").getValue(),
|
|
296
296
|
value: !0
|
|
297
297
|
}
|
|
298
|
-
},
|
|
298
|
+
}, Ee = {
|
|
299
299
|
thumbnail: {
|
|
300
300
|
category: { id: "thumbnail-options", label: "Thumbnail Options" },
|
|
301
301
|
type: "checkbox",
|
|
@@ -397,7 +397,7 @@ const A = "lightGallery", ae = `${A}-item`, j = "data-lightgallery", oe = `${j}-
|
|
|
397
397
|
]
|
|
398
398
|
}
|
|
399
399
|
}
|
|
400
|
-
},
|
|
400
|
+
}, Se = {
|
|
401
401
|
autoplay: {
|
|
402
402
|
category: { id: "autoplay-options", label: "Autoplay options" },
|
|
403
403
|
type: "checkbox",
|
|
@@ -503,7 +503,7 @@ const A = "lightGallery", ae = `${A}-item`, j = "data-lightgallery", oe = `${j}-
|
|
|
503
503
|
]
|
|
504
504
|
}
|
|
505
505
|
}
|
|
506
|
-
}, f = "sourceType", U = "data-iframe",
|
|
506
|
+
}, f = "sourceType", U = "data-iframe", C = {
|
|
507
507
|
name: "href",
|
|
508
508
|
type: "file",
|
|
509
509
|
label: "Image Source"
|
|
@@ -511,7 +511,7 @@ const A = "lightGallery", ae = `${A}-item`, j = "data-lightgallery", oe = `${j}-
|
|
|
511
511
|
name: "data-src",
|
|
512
512
|
label: "Video Source",
|
|
513
513
|
placeholder: "https://www.youtube.com/watch?v=..."
|
|
514
|
-
},
|
|
514
|
+
}, J = {
|
|
515
515
|
name: "data-poster",
|
|
516
516
|
label: "Video Poster",
|
|
517
517
|
type: "file"
|
|
@@ -543,12 +543,12 @@ const A = "lightGallery", ae = `${A}-item`, j = "data-lightgallery", oe = `${j}-
|
|
|
543
543
|
labelToTitle: !0,
|
|
544
544
|
value: "image",
|
|
545
545
|
subTraits: {
|
|
546
|
-
image: [
|
|
547
|
-
video: [H,
|
|
546
|
+
image: [C],
|
|
547
|
+
video: [H, J],
|
|
548
548
|
external: [le]
|
|
549
549
|
},
|
|
550
550
|
options: [
|
|
551
|
-
{ id: "image", label:
|
|
551
|
+
{ id: "image", label: C.label || "", icon: L.image },
|
|
552
552
|
{ id: "video", label: H.label || "", icon: L.video },
|
|
553
553
|
{ id: "external", label: le.label || "", icon: L.external }
|
|
554
554
|
]
|
|
@@ -619,7 +619,7 @@ const A = "lightGallery", ae = `${A}-item`, j = "data-lightgallery", oe = `${j}-
|
|
|
619
619
|
!h.find((D) => D.id === y.id) && (h == null || h.unshift(y));
|
|
620
620
|
};
|
|
621
621
|
let I = [];
|
|
622
|
-
const O = c.plugins || [], T = V(ke), R = O.includes(se) ? V(
|
|
622
|
+
const O = c.plugins || [], T = V(ke), R = O.includes(se) ? V(Ee) : F, G = O.includes(ne) ? V(Se) : F, M = O.includes(ie) ? V(Oe) : F;
|
|
623
623
|
o.addType(A, {
|
|
624
624
|
block: i && {
|
|
625
625
|
label: n,
|
|
@@ -748,16 +748,16 @@ const A = "lightGallery", ae = `${A}-item`, j = "data-lightgallery", oe = `${j}-
|
|
|
748
748
|
if (s[f] || h) {
|
|
749
749
|
q(this, f);
|
|
750
750
|
const y = this.getTrait(f).getValue();
|
|
751
|
-
if (y ===
|
|
752
|
-
this.removeAttributes([H.name,
|
|
753
|
-
const w = this.getTrait(
|
|
751
|
+
if (y === E.image) {
|
|
752
|
+
this.removeAttributes([H.name, J.name, U]);
|
|
753
|
+
const w = this.getTrait(C.name);
|
|
754
754
|
w.setValue(w.getValue() || p);
|
|
755
|
-
} else y ===
|
|
755
|
+
} else y === E.video ? this.removeAttributes([U]) : y === E.external && this.addAttributes({ [U]: !0 });
|
|
756
756
|
}
|
|
757
757
|
},
|
|
758
758
|
initSourceType() {
|
|
759
759
|
const a = this.getAttributes({ noClass: !0, noStyle: !0 });
|
|
760
|
-
a[U] ? this.set(f,
|
|
760
|
+
a[U] ? this.set(f, E.external) : (a[H.name] || a[J.name]) && this.set(f, E.video);
|
|
761
761
|
}
|
|
762
762
|
}
|
|
763
763
|
}), xe({
|
|
@@ -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.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 S=(e=>(e.image="image",e.video="video",e.external="external",e))(S||{});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},Se={[$]:{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",Ee="lgVideo",ne="lgAutoplay",ie="lgZoom",E="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,Ee,ne,ie],cdnScript:[`${E}/lightgallery.min.js`,`${E}/plugins/thumbnail/lg-thumbnail.min.js`,`${E}/plugins/video/lg-video.min.js`,`${E}/plugins/autoplay/lg-autoplay.min.js`,`${E}/plugins/zoom/lg-zoom.min.js`],cdnStyle:`${E}/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(Se);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===S.image){this.removeAttributes([j.name,Q.name,N]);const P=this.getTrait(J.name);P.setValue(P.getValue()||p)}else m===S.video?this.removeAttributes([N]):m===S.external&&this.addAttributes({[N]:!0})}},initSourceType(){const a=this.getAttributes({noClass:!0,noStyle:!0});a[N]?this.set(y,S.external):(a[j.name]||a[Q.name])&&this.set(y,S.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"],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)}})})});
|