@grapesjs/studio-sdk-plugins 1.0.18 → 1.0.19-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accordionComponent/index.cjs.js +2 -2
- package/dist/accordionComponent/index.es.js +12 -12
- package/dist/accordionComponent/index.umd.js +2 -2
- package/dist/accordionComponent/shared.d.ts +3 -0
- package/dist/canvasEmptyState/index.cjs.js +1 -1
- package/dist/canvasEmptyState/index.es.js +25 -25
- package/dist/canvasEmptyState/index.umd.js +1 -1
- package/dist/canvasEmptyState/shared.d.ts +3 -0
- package/dist/canvasFullSize/index.cjs.js +2 -2
- package/dist/canvasFullSize/index.es.js +26 -26
- package/dist/canvasFullSize/index.umd.js +2 -2
- package/dist/canvasFullSize/shared.d.ts +3 -0
- package/dist/canvasGridMode/commands/moveCommand.d.ts +2 -0
- package/dist/canvasGridMode/commands/resizeCommand.d.ts +6 -0
- package/dist/canvasGridMode/commands/updateCommand.d.ts +2 -0
- package/dist/canvasGridMode/index.cjs.d.ts +3 -0
- package/dist/canvasGridMode/index.cjs.js +26 -0
- package/dist/canvasGridMode/index.d.ts +3 -0
- package/dist/canvasGridMode/index.es.d.ts +3 -0
- package/dist/canvasGridMode/index.es.js +673 -0
- package/dist/canvasGridMode/index.umd.js +26 -0
- package/dist/canvasGridMode/shared.d.ts +3 -0
- package/dist/canvasGridMode/styleManager.d.ts +3 -0
- package/dist/canvasGridMode/types.d.ts +16 -0
- package/dist/canvasGridMode/typesSchema.d.ts +36 -0
- package/dist/canvasGridMode/utils.d.ts +150 -0
- package/dist/flexComponent/index.cjs.js +6 -6
- package/dist/flexComponent/index.es.js +40 -40
- package/dist/flexComponent/index.umd.js +6 -6
- package/dist/flexComponent/shared.d.ts +3 -0
- package/dist/fsLightboxComponent/index.cjs.js +2 -2
- package/dist/fsLightboxComponent/index.es.js +28 -28
- package/dist/fsLightboxComponent/index.umd.js +2 -2
- package/dist/fsLightboxComponent/shared.d.ts +3 -0
- package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
- package/dist/googleFontsAssetProvider/index.es.js +118 -98
- package/dist/googleFontsAssetProvider/index.umd.js +1 -1
- package/dist/googleFontsAssetProvider/utils.d.ts +1 -1
- package/dist/iconifyComponent/index.cjs.js +2 -2
- package/dist/iconifyComponent/index.es.js +160 -160
- package/dist/iconifyComponent/index.umd.js +2 -2
- package/dist/iconifyComponent/shared.d.ts +3 -0
- package/dist/index.cjs.d.ts +2 -0
- package/dist/index.cjs.js +87 -51
- package/dist/index.d.ts +2 -0
- package/dist/index.es.d.ts +2 -0
- package/dist/index.es.js +5629 -4929
- package/dist/index.umd.js +79 -43
- package/dist/layoutSidebarButtons/index.cjs.js +1 -1
- package/dist/layoutSidebarButtons/index.es.js +81 -81
- package/dist/layoutSidebarButtons/index.umd.js +1 -1
- package/dist/layoutSidebarButtons/shared.d.ts +3 -0
- package/dist/lightGalleryComponent/index.cjs.js +1 -1
- package/dist/lightGalleryComponent/index.es.js +45 -45
- package/dist/lightGalleryComponent/index.umd.js +1 -1
- package/dist/lightGalleryComponent/shared.d.ts +3 -0
- package/dist/listPagesComponent/index.cjs.js +3 -3
- package/dist/listPagesComponent/index.es.js +63 -62
- package/dist/listPagesComponent/index.umd.js +3 -3
- package/dist/listPagesComponent/shared.d.ts +3 -0
- package/dist/presetPrintable/index.cjs.d.ts +3 -0
- package/dist/presetPrintable/index.cjs.js +12 -0
- package/dist/presetPrintable/index.d.ts +3 -0
- package/dist/presetPrintable/index.es.d.ts +3 -0
- package/dist/presetPrintable/index.es.js +215 -0
- package/dist/presetPrintable/index.umd.js +12 -0
- package/dist/presetPrintable/types.d.ts +17 -0
- package/dist/presetPrintable/typesSchema.d.ts +13 -0
- package/dist/presetPrintable/utils.d.ts +5 -0
- package/dist/prosemirror/index.cjs.js +7 -7
- package/dist/prosemirror/index.es.js +437 -436
- package/dist/prosemirror/index.umd.js +1 -1
- package/dist/prosemirror/shared.d.ts +3 -0
- package/dist/rteTinyMce/index.cjs.js +2 -2
- package/dist/rteTinyMce/index.es.js +37 -37
- package/dist/rteTinyMce/index.umd.js +2 -2
- package/dist/rteTinyMce/shared.d.ts +3 -0
- package/dist/swiperComponent/index.cjs.js +1 -1
- package/dist/swiperComponent/index.es.js +4 -4
- package/dist/swiperComponent/index.umd.js +3 -3
- package/dist/swiperComponent/shared.d.ts +3 -0
- package/dist/tableComponent/index.cjs.js +1 -1
- package/dist/tableComponent/index.es.js +95 -94
- package/dist/tableComponent/index.umd.js +1 -1
- package/dist/tableComponent/shared.d.ts +3 -0
- package/dist/types.d.ts +2 -1
- package/dist/utils.d.ts +1 -0
- package/dist/youtubeAssetProvider/index.cjs.js +1 -1
- package/dist/youtubeAssetProvider/index.es.js +29 -28
- package/dist/youtubeAssetProvider/index.umd.js +1 -1
- package/dist/youtubeAssetProvider/shared.d.ts +3 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var L=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(L||{}),B=(e=>(e.toastAdd="studio:toastAdd",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",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.projectFiles="studio:projectFiles",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.getStateTheme="studio:getStateTheme",e.setStateTheme="studio:setStateTheme",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))(B||{}),R=(e=>(e.layoutToggleId="studio:layoutToggle:",e.toggleBlocksPanel="studio:toggleBlocksPanel",e.pageSettingsUpdate="studio:pageSettingsUpdate",e))(R||{});const M="app.grapesjs.com",G="app-stage.grapesjs.com",
|
|
1
|
+
"use strict";var L=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(L||{}),B=(e=>(e.toastAdd="studio:toastAdd",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",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.projectFiles="studio:projectFiles",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.getStateTheme="studio:getStateTheme",e.setStateTheme="studio:setStateTheme",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.toggleStateDataSource="studio:toggleStateDataSource",e.getStateDataSource="studio:getStateDataSource",e))(B||{}),R=(e=>(e.layoutToggleId="studio:layoutToggle:",e.toggleBlocksPanel="studio:toggleBlocksPanel",e.pageSettingsUpdate="studio:pageSettingsUpdate",e.toggleDataSourcesPreview="studio:toggleDataSourcesPreview",e))(R||{});const M="app.grapesjs.com",G="app-stage.grapesjs.com",A=[M,G,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],E="license:check:start",H="license:check:end",N=()=>typeof window<"u",S=({isDev:e,isStage:t})=>`${e?"":`https://${t?G:M}`}/api`,_=()=>{const e=N()&&window.location.hostname;return!!e&&(A.includes(e)||A.some(t=>e.endsWith(t)))};async function W({path:e,baseApiUrl:t,method:n="GET",headers:l={},params:c,body:b}){const y=`${t||S({isDev:!1,isStage:!1})}${e}`,r={method:n,headers:{"Content-Type":"application/json",...l}};b&&(r.body=JSON.stringify(b));const a=c?new URLSearchParams(c).toString():"",s=a?`?${a}`:"",g=await fetch(`${y}${s}`,r);if(!g.ok)throw new Error(`HTTP error! status: ${g.status}`);return g.json()}const k={[L.free]:0,[L.startup]:10,[L.business]:20,[L.enterprise]:30};function j(e){const t=e;return t.init=n=>l=>e(l,n),t}const K=e=>j(e);async function V({editor:e,plan:t,pluginName:n,licenseKey:l,cleanup:c}){let b="",f=!1;const y=_(),r=s=>{console.warn("Cleanup plugin:",n,"Reason:",s),c()},a=(s={})=>{var i;const{error:g,sdkLicense:v}=s,o=(i=s.plan)==null?void 0:i.category;if(!(v||s.license)||g)r(g||"Invalid license");else if(o){const p=k[t],d=k[o];p>d&&r({pluginRequiredPlan:t,licensePlan:o})}};e.on(E,s=>{b=s==null?void 0:s.baseApiUrl,f=!0}),e.on(H,s=>{a(s)}),setTimeout(async()=>{if(!f){if(y)return;if(l){const s=await C({licenseKey:l,pluginName:n,baseApiUrl:b});s&&a(s)}else r("The `licenseKey` option not provided")}},2e3)}async function C(e){const{licenseKey:t,pluginName:n,baseApiUrl:l}=e;try{return(await W({baseApiUrl:l,path:`/sdk/${t||"na"}`,method:"POST",params:{d:window.location.hostname,pn:n}})).result||{}}catch(c){return console.error("Error during SDK license check:",c),!1}}var h=(e=>(e.panelBlocks="panelBlocks",e.panelPagesLayers="panelPagesLayers",e.panelGlobalStyles="panelGlobalStyles",e.panelSidebarTabs="panelSidebarTabs",e.panelAssets="panelAssets",e))(h||{});const D="sidebarButtonsTarget",P=e=>{const{id:t,icon:n,label:l,tooltip:c,className:b,skipSelfClose:f,removeLayouts:y,layoutComponent:r,layoutCommand:a}=e,s=t;return{id:I(t),type:"button",icon:n,tooltip:l||c,className:b,editorEvents:{[`${R.layoutToggleId}${s}`]:({fromEvent:g,setState:v,editor:o})=>{v({active:g.isOpen}),setTimeout(()=>o.refresh({tools:!0}),20)}},onClick:({editor:g,state:v})=>{if(v.active&&f)return;const o=(a==null?void 0:a.placer)||{type:"static",layoutId:D},u={...o,skipCleanup:o.type==="static"},i=y||Object.keys(h).filter(d=>d!==s);x(g,{removeLayouts:i,layout:{placer:u}});const p={id:s,placer:o,header:(a==null?void 0:a.header)??{label:l,close:!f},layout:r,style:{width:280,height:"100%",borderRightWidth:1,...a==null?void 0:a.style}};g.runCommand(B.layoutToggle,p)}}},I=e=>`button__${e}`,x=(e,t={})=>{(t.removeLayouts||Object.keys(h)).forEach(l=>e.runCommand(B.layoutRemove,{id:l,layout:t.layout}))},U=e=>{const t=(e==null?void 0:e.breakpointTablet)??1024,n=(e==null?void 0:e.breakpointMobile)??768,l={breakpointTablet:t,breakpointMobile:n},c={},b=[{id:h.panelBlocks,icon:"plusBox",label:"Blocks",layoutComponent:{type:"panelBlocks"}},{id:h.panelPagesLayers,icon:"layers",label:"Pages & Layers",layoutComponent:{type:"panelPagesLayers"}},{id:h.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:h.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:o,editor:u})=>{var d;const i=u.getSelected(),p={type:"image",src:o.src};if(i!=null&&i.is("image"))return i.set("src",o.src);if(i&&u.Components.canMove(i,p)){const T=i.append(p)[0];T&&u.select(T)}else if(!i){const T=(d=u.getWrapper())==null?void 0:d.append(p)[0];T&&u.select(T)}}}}],f=[...b,{id:h.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"}}],y={id:D,type:"column",style:{overflow:"hidden"}},r={type:"sidebarLeft",resizable:!1,style:{padding:"10px 5px",alignItems:"center",width:45,gap:10},children:[]},a={type:"canvasSidebarTop",sidebarTop:{leftContainer:{buttons:[]}}},s=(o,u)=>{const i=o.map(d=>{const T=P(d);return e!=null&&e.sidebarButton?e.sidebarButton({id:d.id,buttonIds:h,breakpoint:u,buttonProps:T,sidebarButtonProps:d,...l,createSidebarButton:$=>P({...d,...$})}):T}).filter(Boolean);return(e!=null&&e.sidebarButtons?e==null?void 0:e.sidebarButtons({buttonIds:h,breakpoint:u,sidebarButtons:i,...l,createSidebarButton:d=>P({...d})}):i).filter(Boolean)},g=(o,u,i)=>{var p;return((p=e==null?void 0:e.rootLayout)==null?void 0:p.call(e,{breakpoint:i,sidebarButtons:u,rootLayout:o,layoutSidebarLeft:r,layoutSidebarTarget:y,...l,createSidebarButton:d=>P({...d})}))??o};if(t){const o=s(f,t);c[t]=g({type:"row",style:{height:"100%"},children:[{...r,children:o},y,a]},o,t)}if(n){const o=f.map(i=>({...i,layoutCommand:{placer:{type:"absolute",position:"left"},style:{height:"calc(100% - 40px)"}}})),u=s(o,n);c[n]=g({type:"column",style:{height:"100%"},children:[{type:"sidebarTop",leftContainer:{buttons:[]}},{type:"canvas"},{type:"sidebarBottom",style:{padding:"0 5px",alignItems:"center",gap:10,minHeight:39},children:u}]},u,n)}const v=s(b,0);return{default:g({type:"row",style:{height:"100%"},children:[{...r,children:v},y,a,{type:"sidebarRight"}]},v,0),responsive:c}},w="layoutSidebarButtons",F=L.free,q=function(e,t={}){const{Commands:n}=e,l=n.events,c={...t};(()=>{if(e.runCommand(B.layoutConfigGet)||c.skipLayoutConfig===!0)return;const y=U(c);e.runCommand(B.layoutConfigSet,{...y})})(),n.add(`${w}:toggleButton`,(f,y,r)=>{const a=document.getElementById(I(r==null?void 0:r.id));a==null||a.click()}),e.on(`${l.runCommand}core:preview`,()=>{x(e)}),V({editor:e,licenseKey:c.licenseKey,plan:F,pluginName:w,cleanup:()=>{e.runCommand(B.layoutConfigSet)}})},O=K(q);O.createLayoutConfig=e=>U(e);module.exports=O;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var L = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(L || {}), B = /* @__PURE__ */ ((e) => (e.toastAdd = "studio:toastAdd", e.dialogOpen = "studio:dialogOpen", e.dialogClose = "studio:dialogClose", 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.projectFiles = "studio:projectFiles", 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.getStateTheme = "studio:getStateTheme", e.setStateTheme = "studio:setStateTheme", 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))(B || {}), R = /* @__PURE__ */ ((e) => (e.layoutToggleId = "studio:layoutToggle:", e.toggleBlocksPanel = "studio:toggleBlocksPanel", e.pageSettingsUpdate = "studio:pageSettingsUpdate", e))(R || {});
|
|
2
|
-
const M = "app.grapesjs.com", G = "app-stage.grapesjs.com",
|
|
1
|
+
var L = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(L || {}), B = /* @__PURE__ */ ((e) => (e.toastAdd = "studio:toastAdd", e.dialogOpen = "studio:dialogOpen", e.dialogClose = "studio:dialogClose", 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.projectFiles = "studio:projectFiles", 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.getStateTheme = "studio:getStateTheme", e.setStateTheme = "studio:setStateTheme", 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.toggleStateDataSource = "studio:toggleStateDataSource", e.getStateDataSource = "studio:getStateDataSource", e))(B || {}), R = /* @__PURE__ */ ((e) => (e.layoutToggleId = "studio:layoutToggle:", e.toggleBlocksPanel = "studio:toggleBlocksPanel", e.pageSettingsUpdate = "studio:pageSettingsUpdate", e.toggleDataSourcesPreview = "studio:toggleDataSourcesPreview", e))(R || {});
|
|
2
|
+
const M = "app.grapesjs.com", G = "app-stage.grapesjs.com", A = [
|
|
3
3
|
M,
|
|
4
4
|
G,
|
|
5
5
|
"localhost",
|
|
@@ -10,27 +10,27 @@ const M = "app.grapesjs.com", G = "app-stage.grapesjs.com", P = [
|
|
|
10
10
|
// For stackblitz.com demos
|
|
11
11
|
"-sandpack.codesandbox.io"
|
|
12
12
|
// For Sandpack demos
|
|
13
|
-
],
|
|
14
|
-
const e =
|
|
15
|
-
return !!e && (
|
|
13
|
+
], $ = "license:check:start", E = "license:check:end", H = () => typeof window < "u", N = ({ isDev: e, isStage: t }) => `${e ? "" : `https://${t ? G : M}`}/api`, S = () => {
|
|
14
|
+
const e = H() && window.location.hostname;
|
|
15
|
+
return !!e && (A.includes(e) || A.some((t) => e.endsWith(t)));
|
|
16
16
|
};
|
|
17
|
-
async function
|
|
17
|
+
async function _({
|
|
18
18
|
path: e,
|
|
19
19
|
baseApiUrl: t,
|
|
20
|
-
method:
|
|
20
|
+
method: n = "GET",
|
|
21
21
|
headers: l = {},
|
|
22
22
|
params: c,
|
|
23
23
|
body: b
|
|
24
24
|
}) {
|
|
25
|
-
const y = `${t ||
|
|
26
|
-
method:
|
|
25
|
+
const y = `${t || N({ isDev: !1, isStage: !1 })}${e}`, r = {
|
|
26
|
+
method: n,
|
|
27
27
|
headers: {
|
|
28
28
|
"Content-Type": "application/json",
|
|
29
29
|
...l
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
b && (r.body = JSON.stringify(b));
|
|
33
|
-
const
|
|
33
|
+
const a = c ? new URLSearchParams(c).toString() : "", s = a ? `?${a}` : "", g = await fetch(`${y}${s}`, r);
|
|
34
34
|
if (!g.ok)
|
|
35
35
|
throw new Error(`HTTP error! status: ${g.status}`);
|
|
36
36
|
return g.json();
|
|
@@ -41,56 +41,56 @@ const k = {
|
|
|
41
41
|
[L.business]: 20,
|
|
42
42
|
[L.enterprise]: 30
|
|
43
43
|
};
|
|
44
|
-
function
|
|
44
|
+
function W(e) {
|
|
45
45
|
const t = e;
|
|
46
|
-
return t.init = (
|
|
46
|
+
return t.init = (n) => (l) => e(l, n), t;
|
|
47
47
|
}
|
|
48
|
-
const
|
|
48
|
+
const j = (e) => /* @__PURE__ */ W(e);
|
|
49
49
|
async function K({
|
|
50
50
|
editor: e,
|
|
51
51
|
plan: t,
|
|
52
|
-
pluginName:
|
|
52
|
+
pluginName: n,
|
|
53
53
|
licenseKey: l,
|
|
54
54
|
cleanup: c
|
|
55
55
|
}) {
|
|
56
56
|
let b = "", f = !1;
|
|
57
|
-
const y =
|
|
58
|
-
console.warn("Cleanup plugin:",
|
|
59
|
-
},
|
|
57
|
+
const y = S(), r = (s) => {
|
|
58
|
+
console.warn("Cleanup plugin:", n, "Reason:", s), c();
|
|
59
|
+
}, a = (s = {}) => {
|
|
60
60
|
var i;
|
|
61
|
-
const { error: g, sdkLicense: v } = s,
|
|
61
|
+
const { error: g, sdkLicense: v } = s, o = (i = s.plan) == null ? void 0 : i.category;
|
|
62
62
|
if (!(v || s.license) || g)
|
|
63
63
|
r(g || "Invalid license");
|
|
64
|
-
else if (
|
|
65
|
-
const p = k[t], d = k[
|
|
66
|
-
p > d && r({ pluginRequiredPlan: t, licensePlan:
|
|
64
|
+
else if (o) {
|
|
65
|
+
const p = k[t], d = k[o];
|
|
66
|
+
p > d && r({ pluginRequiredPlan: t, licensePlan: o });
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
|
-
e.on(
|
|
69
|
+
e.on($, (s) => {
|
|
70
70
|
b = s == null ? void 0 : s.baseApiUrl, f = !0;
|
|
71
|
-
}), e.on(
|
|
72
|
-
|
|
71
|
+
}), e.on(E, (s) => {
|
|
72
|
+
a(s);
|
|
73
73
|
}), setTimeout(async () => {
|
|
74
74
|
if (!f) {
|
|
75
75
|
if (y) return;
|
|
76
76
|
if (l) {
|
|
77
|
-
const s = await
|
|
78
|
-
s &&
|
|
77
|
+
const s = await V({ licenseKey: l, pluginName: n, baseApiUrl: b });
|
|
78
|
+
s && a(s);
|
|
79
79
|
} else
|
|
80
80
|
r("The `licenseKey` option not provided");
|
|
81
81
|
}
|
|
82
82
|
}, 2e3);
|
|
83
83
|
}
|
|
84
|
-
async function
|
|
85
|
-
const { licenseKey: t, pluginName:
|
|
84
|
+
async function V(e) {
|
|
85
|
+
const { licenseKey: t, pluginName: n, baseApiUrl: l } = e;
|
|
86
86
|
try {
|
|
87
|
-
return (await
|
|
87
|
+
return (await _({
|
|
88
88
|
baseApiUrl: l,
|
|
89
89
|
path: `/sdk/${t || "na"}`,
|
|
90
90
|
method: "POST",
|
|
91
91
|
params: {
|
|
92
92
|
d: window.location.hostname,
|
|
93
|
-
pn:
|
|
93
|
+
pn: n
|
|
94
94
|
}
|
|
95
95
|
})).result || {};
|
|
96
96
|
} catch (c) {
|
|
@@ -98,45 +98,45 @@ async function S(e) {
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
var h = /* @__PURE__ */ ((e) => (e.panelBlocks = "panelBlocks", e.panelPagesLayers = "panelPagesLayers", e.panelGlobalStyles = "panelGlobalStyles", e.panelSidebarTabs = "panelSidebarTabs", e.panelAssets = "panelAssets", e))(h || {});
|
|
101
|
-
const
|
|
102
|
-
const { id: t, icon:
|
|
101
|
+
const D = "sidebarButtonsTarget", P = (e) => {
|
|
102
|
+
const { id: t, icon: n, label: l, tooltip: c, className: b, skipSelfClose: f, removeLayouts: y, layoutComponent: r, layoutCommand: a } = e, s = t;
|
|
103
103
|
return {
|
|
104
|
-
id:
|
|
104
|
+
id: I(t),
|
|
105
105
|
type: "button",
|
|
106
|
-
icon:
|
|
106
|
+
icon: n,
|
|
107
107
|
tooltip: l || c,
|
|
108
108
|
className: b,
|
|
109
109
|
editorEvents: {
|
|
110
|
-
[`${R.layoutToggleId}${s}`]: ({ fromEvent: g, setState: v, editor:
|
|
111
|
-
v({ active: g.isOpen }), setTimeout(() =>
|
|
110
|
+
[`${R.layoutToggleId}${s}`]: ({ fromEvent: g, setState: v, editor: o }) => {
|
|
111
|
+
v({ active: g.isOpen }), setTimeout(() => o.refresh({ tools: !0 }), 20);
|
|
112
112
|
}
|
|
113
113
|
},
|
|
114
114
|
onClick: ({ editor: g, state: v }) => {
|
|
115
115
|
if (v.active && f) return;
|
|
116
|
-
const
|
|
116
|
+
const o = (a == null ? void 0 : a.placer) || {
|
|
117
117
|
type: "static",
|
|
118
|
-
layoutId:
|
|
119
|
-
}, u = { ...
|
|
120
|
-
|
|
118
|
+
layoutId: D
|
|
119
|
+
}, u = { ...o, skipCleanup: o.type === "static" }, i = y || Object.keys(h).filter((d) => d !== s);
|
|
120
|
+
x(g, { removeLayouts: i, layout: { placer: u } });
|
|
121
121
|
const p = {
|
|
122
122
|
id: s,
|
|
123
|
-
placer:
|
|
124
|
-
header: (
|
|
123
|
+
placer: o,
|
|
124
|
+
header: (a == null ? void 0 : a.header) ?? { label: l, close: !f },
|
|
125
125
|
layout: r,
|
|
126
126
|
style: {
|
|
127
127
|
width: 280,
|
|
128
128
|
height: "100%",
|
|
129
129
|
borderRightWidth: 1,
|
|
130
|
-
...
|
|
130
|
+
...a == null ? void 0 : a.style
|
|
131
131
|
}
|
|
132
132
|
};
|
|
133
133
|
g.runCommand(B.layoutToggle, p);
|
|
134
134
|
}
|
|
135
135
|
};
|
|
136
|
-
},
|
|
136
|
+
}, I = (e) => `button__${e}`, x = (e, t = {}) => {
|
|
137
137
|
(t.removeLayouts || Object.keys(h)).forEach((l) => e.runCommand(B.layoutRemove, { id: l, layout: t.layout }));
|
|
138
|
-
},
|
|
139
|
-
const t = (e == null ? void 0 : e.breakpointTablet) ?? 1024,
|
|
138
|
+
}, U = (e) => {
|
|
139
|
+
const t = (e == null ? void 0 : e.breakpointTablet) ?? 1024, n = (e == null ? void 0 : e.breakpointMobile) ?? 768, l = { breakpointTablet: t, breakpointMobile: n }, c = {}, b = [
|
|
140
140
|
{
|
|
141
141
|
id: h.panelBlocks,
|
|
142
142
|
icon: "plusBox",
|
|
@@ -163,11 +163,11 @@ const I = "sidebarButtonsTarget", A = (e) => {
|
|
|
163
163
|
type: "panelAssets",
|
|
164
164
|
content: { itemsPerRow: 2, header: { addUrl: !1 } },
|
|
165
165
|
style: { padding: 7 },
|
|
166
|
-
onSelect: ({ assetProps:
|
|
166
|
+
onSelect: ({ assetProps: o, editor: u }) => {
|
|
167
167
|
var d;
|
|
168
|
-
const i = u.getSelected(), p = { type: "image", src:
|
|
168
|
+
const i = u.getSelected(), p = { type: "image", src: o.src };
|
|
169
169
|
if (i != null && i.is("image"))
|
|
170
|
-
return i.set("src",
|
|
170
|
+
return i.set("src", o.src);
|
|
171
171
|
if (i && u.Components.canMove(i, p)) {
|
|
172
172
|
const T = i.append(p)[0];
|
|
173
173
|
T && u.select(T);
|
|
@@ -188,7 +188,7 @@ const I = "sidebarButtonsTarget", A = (e) => {
|
|
|
188
188
|
layoutComponent: { type: "panelSidebarTabs" }
|
|
189
189
|
}
|
|
190
190
|
], y = {
|
|
191
|
-
id:
|
|
191
|
+
id: D,
|
|
192
192
|
type: "column",
|
|
193
193
|
style: { overflow: "hidden" }
|
|
194
194
|
}, r = {
|
|
@@ -196,16 +196,16 @@ const I = "sidebarButtonsTarget", A = (e) => {
|
|
|
196
196
|
resizable: !1,
|
|
197
197
|
style: { padding: "10px 5px", alignItems: "center", width: 45, gap: 10 },
|
|
198
198
|
children: []
|
|
199
|
-
},
|
|
199
|
+
}, a = {
|
|
200
200
|
type: "canvasSidebarTop",
|
|
201
201
|
sidebarTop: {
|
|
202
202
|
leftContainer: {
|
|
203
203
|
buttons: []
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
|
-
}, s = (
|
|
207
|
-
const i =
|
|
208
|
-
const T =
|
|
206
|
+
}, s = (o, u) => {
|
|
207
|
+
const i = o.map((d) => {
|
|
208
|
+
const T = P(d);
|
|
209
209
|
return e != null && e.sidebarButton ? e.sidebarButton({
|
|
210
210
|
id: d.id,
|
|
211
211
|
buttonIds: h,
|
|
@@ -213,7 +213,7 @@ const I = "sidebarButtonsTarget", A = (e) => {
|
|
|
213
213
|
buttonProps: T,
|
|
214
214
|
sidebarButtonProps: d,
|
|
215
215
|
...l,
|
|
216
|
-
createSidebarButton: (
|
|
216
|
+
createSidebarButton: (O) => P({ ...d, ...O })
|
|
217
217
|
}) : T;
|
|
218
218
|
}).filter(Boolean);
|
|
219
219
|
return (e != null && e.sidebarButtons ? e == null ? void 0 : e.sidebarButtons({
|
|
@@ -221,22 +221,22 @@ const I = "sidebarButtonsTarget", A = (e) => {
|
|
|
221
221
|
breakpoint: u,
|
|
222
222
|
sidebarButtons: i,
|
|
223
223
|
...l,
|
|
224
|
-
createSidebarButton: (d) =>
|
|
224
|
+
createSidebarButton: (d) => P({ ...d })
|
|
225
225
|
}) : i).filter(Boolean);
|
|
226
|
-
}, g = (
|
|
226
|
+
}, g = (o, u, i) => {
|
|
227
227
|
var p;
|
|
228
228
|
return ((p = e == null ? void 0 : e.rootLayout) == null ? void 0 : p.call(e, {
|
|
229
229
|
breakpoint: i,
|
|
230
230
|
sidebarButtons: u,
|
|
231
|
-
rootLayout:
|
|
231
|
+
rootLayout: o,
|
|
232
232
|
layoutSidebarLeft: r,
|
|
233
233
|
layoutSidebarTarget: y,
|
|
234
234
|
...l,
|
|
235
|
-
createSidebarButton: (d) =>
|
|
236
|
-
})) ??
|
|
235
|
+
createSidebarButton: (d) => P({ ...d })
|
|
236
|
+
})) ?? o;
|
|
237
237
|
};
|
|
238
238
|
if (t) {
|
|
239
|
-
const
|
|
239
|
+
const o = s(f, t);
|
|
240
240
|
c[t] = g(
|
|
241
241
|
{
|
|
242
242
|
type: "row",
|
|
@@ -244,18 +244,18 @@ const I = "sidebarButtonsTarget", A = (e) => {
|
|
|
244
244
|
children: [
|
|
245
245
|
{
|
|
246
246
|
...r,
|
|
247
|
-
children:
|
|
247
|
+
children: o
|
|
248
248
|
},
|
|
249
249
|
y,
|
|
250
|
-
|
|
250
|
+
a
|
|
251
251
|
]
|
|
252
252
|
},
|
|
253
|
-
|
|
253
|
+
o,
|
|
254
254
|
t
|
|
255
255
|
);
|
|
256
256
|
}
|
|
257
|
-
if (
|
|
258
|
-
const
|
|
257
|
+
if (n) {
|
|
258
|
+
const o = f.map(
|
|
259
259
|
(i) => ({
|
|
260
260
|
...i,
|
|
261
261
|
layoutCommand: {
|
|
@@ -263,8 +263,8 @@ const I = "sidebarButtonsTarget", A = (e) => {
|
|
|
263
263
|
style: { height: "calc(100% - 40px)" }
|
|
264
264
|
}
|
|
265
265
|
})
|
|
266
|
-
), u = s(
|
|
267
|
-
c[
|
|
266
|
+
), u = s(o, n);
|
|
267
|
+
c[n] = g(
|
|
268
268
|
{
|
|
269
269
|
type: "column",
|
|
270
270
|
style: { height: "100%" },
|
|
@@ -279,7 +279,7 @@ const I = "sidebarButtonsTarget", A = (e) => {
|
|
|
279
279
|
]
|
|
280
280
|
},
|
|
281
281
|
u,
|
|
282
|
-
|
|
282
|
+
n
|
|
283
283
|
);
|
|
284
284
|
}
|
|
285
285
|
const v = s(b, 0);
|
|
@@ -294,7 +294,7 @@ const I = "sidebarButtonsTarget", A = (e) => {
|
|
|
294
294
|
children: v
|
|
295
295
|
},
|
|
296
296
|
y,
|
|
297
|
-
|
|
297
|
+
a,
|
|
298
298
|
{ type: "sidebarRight" }
|
|
299
299
|
]
|
|
300
300
|
},
|
|
@@ -303,30 +303,30 @@ const I = "sidebarButtonsTarget", A = (e) => {
|
|
|
303
303
|
),
|
|
304
304
|
responsive: c
|
|
305
305
|
};
|
|
306
|
-
}, w = "layoutSidebarButtons",
|
|
307
|
-
const { Commands:
|
|
306
|
+
}, w = "layoutSidebarButtons", C = L.free, F = function(e, t = {}) {
|
|
307
|
+
const { Commands: n } = e, l = n.events, c = {
|
|
308
308
|
...t
|
|
309
309
|
};
|
|
310
310
|
(() => {
|
|
311
311
|
if (e.runCommand(B.layoutConfigGet) || c.skipLayoutConfig === !0) return;
|
|
312
|
-
const y =
|
|
312
|
+
const y = U(c);
|
|
313
313
|
e.runCommand(B.layoutConfigSet, { ...y });
|
|
314
|
-
})(),
|
|
315
|
-
const
|
|
316
|
-
|
|
314
|
+
})(), n.add(`${w}:toggleButton`, (f, y, r) => {
|
|
315
|
+
const a = document.getElementById(I(r == null ? void 0 : r.id));
|
|
316
|
+
a == null || a.click();
|
|
317
317
|
}), e.on(`${l.runCommand}core:preview`, () => {
|
|
318
|
-
|
|
318
|
+
x(e);
|
|
319
319
|
}), K({
|
|
320
320
|
editor: e,
|
|
321
321
|
licenseKey: c.licenseKey,
|
|
322
|
-
plan:
|
|
322
|
+
plan: C,
|
|
323
323
|
pluginName: w,
|
|
324
324
|
cleanup: () => {
|
|
325
325
|
e.runCommand(B.layoutConfigSet);
|
|
326
326
|
}
|
|
327
327
|
});
|
|
328
|
-
},
|
|
329
|
-
|
|
328
|
+
}, q = j(F);
|
|
329
|
+
q.createLayoutConfig = (e) => U(e);
|
|
330
330
|
export {
|
|
331
|
-
|
|
331
|
+
q as default
|
|
332
332
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(h,v){typeof exports=="object"&&typeof module<"u"?module.exports=v():typeof define=="function"&&define.amd?define(v):(h=typeof globalThis<"u"?globalThis:h||self,h.StudioSdkPlugins_layoutSidebarButtons=v())})(this,function(){"use strict";var h=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(h||{}),v=(e=>(e.toastAdd="studio:toastAdd",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",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.projectFiles="studio:projectFiles",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.getStateTheme="studio:getStateTheme",e.setStateTheme="studio:setStateTheme",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))(v||{}),A=(e=>(e.layoutToggleId="studio:layoutToggle:",e.toggleBlocksPanel="studio:toggleBlocksPanel",e.pageSettingsUpdate="studio:pageSettingsUpdate",e))(A||{});const k="app.grapesjs.com",w="app-stage.grapesjs.com",R=[k,w,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],
|
|
1
|
+
(function(h,v){typeof exports=="object"&&typeof module<"u"?module.exports=v():typeof define=="function"&&define.amd?define(v):(h=typeof globalThis<"u"?globalThis:h||self,h.StudioSdkPlugins_layoutSidebarButtons=v())})(this,function(){"use strict";var h=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(h||{}),v=(e=>(e.toastAdd="studio:toastAdd",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",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.projectFiles="studio:projectFiles",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.getStateTheme="studio:getStateTheme",e.setStateTheme="studio:setStateTheme",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.toggleStateDataSource="studio:toggleStateDataSource",e.getStateDataSource="studio:getStateDataSource",e))(v||{}),A=(e=>(e.layoutToggleId="studio:layoutToggle:",e.toggleBlocksPanel="studio:toggleBlocksPanel",e.pageSettingsUpdate="studio:pageSettingsUpdate",e.toggleDataSourcesPreview="studio:toggleDataSourcesPreview",e))(A||{});const k="app.grapesjs.com",w="app-stage.grapesjs.com",R=[k,w,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],O="license:check:start",$="license:check:end",E=()=>typeof window<"u",_=({isDev:e,isStage:t})=>`${e?"":`https://${t?w:k}`}/api`,H=()=>{const e=E()&&window.location.hostname;return!!e&&(R.includes(e)||R.some(t=>e.endsWith(t)))};async function N({path:e,baseApiUrl:t,method:a="GET",headers:l={},params:c,body:b}){const y=`${t||_({isDev:!1,isStage:!1})}${e}`,r={method:a,headers:{"Content-Type":"application/json",...l}};b&&(r.body=JSON.stringify(b));const o=c?new URLSearchParams(c).toString():"",s=o?`?${o}`:"",g=await fetch(`${y}${s}`,r);if(!g.ok)throw new Error(`HTTP error! status: ${g.status}`);return g.json()}const M={[h.free]:0,[h.startup]:10,[h.business]:20,[h.enterprise]:30};function W(e){const t=e;return t.init=a=>l=>e(l,a),t}const j=e=>W(e);async function K({editor:e,plan:t,pluginName:a,licenseKey:l,cleanup:c}){let b="",f=!1;const y=H(),r=s=>{console.warn("Cleanup plugin:",a,"Reason:",s),c()},o=(s={})=>{var i;const{error:g,sdkLicense:L}=s,n=(i=s.plan)==null?void 0:i.category;if(!(L||s.license)||g)r(g||"Invalid license");else if(n){const p=M[t],d=M[n];p>d&&r({pluginRequiredPlan:t,licensePlan:n})}};e.on(O,s=>{b=s==null?void 0:s.baseApiUrl,f=!0}),e.on($,s=>{o(s)}),setTimeout(async()=>{if(!f){if(y)return;if(l){const s=await V({licenseKey:l,pluginName:a,baseApiUrl:b});s&&o(s)}else r("The `licenseKey` option not provided")}},2e3)}async function V(e){const{licenseKey:t,pluginName:a,baseApiUrl:l}=e;try{return(await N({baseApiUrl:l,path:`/sdk/${t||"na"}`,method:"POST",params:{d:window.location.hostname,pn:a}})).result||{}}catch(c){return console.error("Error during SDK license check:",c),!1}}var T=(e=>(e.panelBlocks="panelBlocks",e.panelPagesLayers="panelPagesLayers",e.panelGlobalStyles="panelGlobalStyles",e.panelSidebarTabs="panelSidebarTabs",e.panelAssets="panelAssets",e))(T||{});const G="sidebarButtonsTarget",P=e=>{const{id:t,icon:a,label:l,tooltip:c,className:b,skipSelfClose:f,removeLayouts:y,layoutComponent:r,layoutCommand:o}=e,s=t;return{id:D(t),type:"button",icon:a,tooltip:l||c,className:b,editorEvents:{[`${A.layoutToggleId}${s}`]:({fromEvent:g,setState:L,editor:n})=>{L({active:g.isOpen}),setTimeout(()=>n.refresh({tools:!0}),20)}},onClick:({editor:g,state:L})=>{if(L.active&&f)return;const n=(o==null?void 0:o.placer)||{type:"static",layoutId:G},u={...n,skipCleanup:n.type==="static"},i=y||Object.keys(T).filter(d=>d!==s);I(g,{removeLayouts:i,layout:{placer:u}});const p={id:s,placer:n,header:(o==null?void 0:o.header)??{label:l,close:!f},layout:r,style:{width:280,height:"100%",borderRightWidth:1,...o==null?void 0:o.style}};g.runCommand(v.layoutToggle,p)}}},D=e=>`button__${e}`,I=(e,t={})=>{(t.removeLayouts||Object.keys(T)).forEach(l=>e.runCommand(v.layoutRemove,{id:l,layout:t.layout}))},x=e=>{const t=(e==null?void 0:e.breakpointTablet)??1024,a=(e==null?void 0:e.breakpointMobile)??768,l={breakpointTablet:t,breakpointMobile:a},c={},b=[{id:T.panelBlocks,icon:"plusBox",label:"Blocks",layoutComponent:{type:"panelBlocks"}},{id:T.panelPagesLayers,icon:"layers",label:"Pages & Layers",layoutComponent:{type:"panelPagesLayers"}},{id:T.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:T.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:u})=>{var d;const i=u.getSelected(),p={type:"image",src:n.src};if(i!=null&&i.is("image"))return i.set("src",n.src);if(i&&u.Components.canMove(i,p)){const B=i.append(p)[0];B&&u.select(B)}else if(!i){const B=(d=u.getWrapper())==null?void 0:d.append(p)[0];B&&u.select(B)}}}}],f=[...b,{id:T.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"}}],y={id:G,type:"column",style:{overflow:"hidden"}},r={type:"sidebarLeft",resizable:!1,style:{padding:"10px 5px",alignItems:"center",width:45,gap:10},children:[]},o={type:"canvasSidebarTop",sidebarTop:{leftContainer:{buttons:[]}}},s=(n,u)=>{const i=n.map(d=>{const B=P(d);return e!=null&&e.sidebarButton?e.sidebarButton({id:d.id,buttonIds:T,breakpoint:u,buttonProps:B,sidebarButtonProps:d,...l,createSidebarButton:F=>P({...d,...F})}):B}).filter(Boolean);return(e!=null&&e.sidebarButtons?e==null?void 0:e.sidebarButtons({buttonIds:T,breakpoint:u,sidebarButtons:i,...l,createSidebarButton:d=>P({...d})}):i).filter(Boolean)},g=(n,u,i)=>{var p;return((p=e==null?void 0:e.rootLayout)==null?void 0:p.call(e,{breakpoint:i,sidebarButtons:u,rootLayout:n,layoutSidebarLeft:r,layoutSidebarTarget:y,...l,createSidebarButton:d=>P({...d})}))??n};if(t){const n=s(f,t);c[t]=g({type:"row",style:{height:"100%"},children:[{...r,children:n},y,o]},n,t)}if(a){const n=f.map(i=>({...i,layoutCommand:{placer:{type:"absolute",position:"left"},style:{height:"calc(100% - 40px)"}}})),u=s(n,a);c[a]=g({type:"column",style:{height:"100%"},children:[{type:"sidebarTop",leftContainer:{buttons:[]}},{type:"canvas"},{type:"sidebarBottom",style:{padding:"0 5px",alignItems:"center",gap:10,minHeight:39},children:u}]},u,a)}const L=s(b,0);return{default:g({type:"row",style:{height:"100%"},children:[{...r,children:L},y,o,{type:"sidebarRight"}]},L,0),responsive:c}},U="layoutSidebarButtons",C=h.free,S=j(function(e,t={}){const{Commands:a}=e,l=a.events,c={...t};(()=>{if(e.runCommand(v.layoutConfigGet)||c.skipLayoutConfig===!0)return;const y=x(c);e.runCommand(v.layoutConfigSet,{...y})})(),a.add(`${U}:toggleButton`,(f,y,r)=>{const o=document.getElementById(D(r==null?void 0:r.id));o==null||o.click()}),e.on(`${l.runCommand}core:preview`,()=>{I(e)}),K({editor:e,licenseKey:c.licenseKey,plan:C,pluginName:U,cleanup:()=>{e.runCommand(v.layoutConfigSet)}})});return S.createLayoutConfig=e=>x(e),S});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const ie="app.grapesjs.com",re="app-stage.grapesjs.com",Y=[ie,re,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],ue="license:check:start",he="license:check:end",ge=()=>typeof window<"u",be=({isDev:e,isStage:l})=>`${e?"":`https://${l?re:ie}`}/api`,de=()=>{const e=ge()&&window.location.hostname;return!!e&&(Y.includes(e)||Y.some(l=>e.endsWith(l)))};async function me({path:e,baseApiUrl:l,method:a="GET",headers:n={},params:s,body:u}){const p=`${l||be({isDev:!1,isStage:!1})}${e}`,h={method:a,headers:{"Content-Type":"application/json",...n}};u&&(h.body=JSON.stringify(u));const c=s?new URLSearchParams(s).toString():"",i=c?`?${c}`:"",b=await fetch(`${p}${i}`,h);if(!b.ok)throw new Error(`HTTP error! status: ${b.status}`);return b.json()}var E=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(E||{});const ee={[E.free]:0,[E.startup]:10,[E.business]:20,[E.enterprise]:30};function ye(e){const l=e;return l.init=a=>n=>e(n,a),l}const ve=e=>ye(e);async function fe({editor:e,plan:l,pluginName:a,licenseKey:n,cleanup:s}){let u="",r=!1;const p=de(),h=i=>{console.warn("Cleanup plugin:",a,"Reason:",i),s()},c=(i={})=>{var L;const{error:b,sdkLicense:C}=i,T=(L=i.plan)==null?void 0:L.category;if(!(C||i.license)||b)h(b||"Invalid license");else if(T){const G=ee[l],V=ee[T];G>V&&h({pluginRequiredPlan:l,licensePlan:T})}};e.on(ue,i=>{u=i==null?void 0:i.baseApiUrl,r=!0}),e.on(he,i=>{c(i)}),setTimeout(async()=>{if(!r){if(p)return;if(n){const i=await Te({licenseKey:n,pluginName:a,baseApiUrl:u});i&&c(i)}else h("The `licenseKey` option not provided")}},2e3)}async function Te(e){const{licenseKey:l,pluginName:a,baseApiUrl:n}=e;try{return(await me({baseApiUrl:n,path:`/sdk/${l||"na"}`,method:"POST",params:{d:window.location.hostname,pn:a}})).result||{}}catch(s){return console.error("Error during SDK license check:",s),!1}}const z=(e,l)=>{var a;return!!((a=e==null?void 0:e.hasAttribute)!=null&&a.call(e,l))};var P=(e=>(e.image="image",e.video="video",e.external="external",e))(P||{});const k="lightGallery",te=`${k}-item`,H="data-lightgallery",ae=`${H}-item`,U="toggle",I={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>'},B={propKeys:[],props:{},traits:[]},M=(e,l={})=>{var s;const a={},n=[];for(const u in e){const{value:r,...p}=e[u];n.push({id:u,name:u,changeProp:!0,category:l.category,...p}),a[u]=r;const{subTraits:h={}}=p;for(const c in p.subTraits)(s=h[c])==null||s.forEach(i=>{const b=i.id||i.name;a[b]=i.value})}return{propKeys:Object.keys(a),props:a,traits:n}},Z=(e,l)=>{const a=e.getTrait(l),n=a.get("category"),s=a.get("subTraits")||{},r=(Object.values(s).flat()||[]).map(c=>c.id||c.name);e.removeTrait(r);const p=s[a.getValue()],h=e.getTraitIndex(l)+1;p&&e.addTrait(p.map(c=>({category:n,...c})),{at:h})},W=(e,l)=>{l.forEach(a=>{const n=e.getTrait(a);if(!n||!n.get("subTraits"))return;const s=n.changeProp?`change:${a}`:`change:attributes:${a}`;e.on(s,()=>Z(e,a)),Z(e,a)})},we=(e,l,a)=>{const s=e.getTrait(l).get("subTraits")||{},r=(Object.values(s).flat()||[]).map(h=>{const c=h.name||h.id;return h.changeProp?`change:${c}`:`change:attributes:${c}`}),p=Array.from(new Set(r));p.length&&e.on(p.join(" "),a)},Se={[U]:{type:"button",label:"Toggle Gallery",command:(e,l)=>{var a,n;return(n=(a=l.target)==null?void 0:a.getView())==null?void 0:n.toggleGallery()}},speed:{type:"number",label:"Speed",tip:"Transition duration between slides (in ms)",value:400,step:50,min:0},inline:{type:"checkbox",label:"Inline Gallery",value:!1},allowMediaOverlap:{type:"checkbox",label:"Allow media overlap",tip:"If enabled, toolbar, captions and thumbnails will overlap with the media element",value:!1},controls:{type:"checkbox",label:"Show controls",tip:"If disabled, prev/next buttons will not be displayed",value:!0},counter:{type:"checkbox",label:"Show counter",tip:"Display the total number of images and index number of the currently displayed slide",value:!0},download:{type:"checkbox",label:"Download icon",tip:"Enable download button",value:!0},enableDrag:{type:"checkbox",label:"Enable drag",tip:"Enables desktop mouse drag support",value:!0},enableSwipe:{type:"checkbox",label:"Enable swipe",tip:"Enables swipe support for mobile devices",value:!0},escKey:{type:"checkbox",label:"Enable Esc key",tip:'Whether the gallery could be closed by pressing the "Esc" key',value:!0},keyPress:{type:"checkbox",label:"Enable keyboard navigation",value:!1},loop:{type:"checkbox",label:"Loop",tip:"If false, will disable the ability to loop back to the beginning of the gallery from the last slide",value:!0},getCaptionFromTitleOrAlt:{type:"checkbox",label:"Caption from title or alt",tip:"Get captions from alt or title tags",value:!0},showMaximizeIcon:{type:"checkbox",label:"Show maximize icon",value:!1},closable:{type:"checkbox",label:"Closable",tip:"If false, it won't be possible to close the gallery",value:!0},showCloseIcon:{type:"checkbox",label:"Show close icon",tip:"If false, close button won't be displayed.",visible:({component:e})=>!!e.getTrait("closable").getValue(),value:!0},closeOnTap:{type:"checkbox",label:"Close on tap",tip:"Allows clicks on black area to close gallery",visible:({component:e})=>!!e.getTrait("closable").getValue(),value:!0}},xe={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"}]}}},ke={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}]}}},Ie={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",D="data-iframe",R={name:"href",type:"file",label:"Image Source"},N={name:"data-src",label:"Video Source",placeholder:"https://www.youtube.com/watch?v=..."},F={name:"data-poster",label:"Video Poster",type:"file"},ne={name:"data-src",label:"External Source",placeholder:"https://some-external-source.com/...."},ce={label:"Caption",name:"data-sub-html",placeholder:"My caption",changeProp:!1},Le={[U]:{type:"button",label:"Toggle Gallery",command:(e,l)=>{var s,u;const a=l.target,n=(s=a==null?void 0:a.closestType(k))==null?void 0:s.getView();if(n&&a){const r=((u=n.getLightGallery())==null?void 0:u.items)||[],p=Array.from(r).indexOf(a.getEl());p>=0&&n.toggleGallery(p)}}},[f]:{type:"radio",label:"Source type",labelToTitle:!0,value:"image",subTraits:{image:[R],video:[N,F],external:[ne]},options:[{id:"image",label:R.label||"",icon:I.image},{id:"video",label:N.label||"",icon:I.video},{id:"external",label:ne.label||"",icon:I.external}]},subHtml:ce},Ae="lightGalleryComponent",le="lgThumbnail",Pe="lgVideo",oe="lgAutoplay",se="lgZoom",A="https://cdn.jsdelivr.net/npm/lightgallery@2.8.2",Ee=function(e,l={}){const{Blocks:a,Components:n}=e,s="LightGallery",u="LightGallery Item",r={toolbarIconOpen:I.eye,block:{},lgLicenseKey:"92DE1DB8-7986-4F02-B908-514F97678D28",defaultSrc:"https://placehold.co/200/777/white.png?text=Image",plugins:[le,Pe,oe,se],cdnScript:[`${A}/lightgallery.min.js`,`${A}/plugins/thumbnail/lg-thumbnail.min.js`,`${A}/plugins/video/lg-video.min.js`,`${A}/plugins/autoplay/lg-autoplay.min.js`,`${A}/plugins/zoom/lg-zoom.min.js`],cdnStyle:`${A}/css/lightgallery-bundle.min.css`,...l},{block:p,toolbarIconOpen:h,defaultSrc:c}=r,i=function(t){const o=this,g=window,{plugins:m,cdnScript:w,cdnStyle:O,inline:J,lgLicenseKey:pe,...y}=t||{},S=d=>isNaN(d)?void 0:parseInt(d,10),Q=()=>{var $;const d={...y,licenseKey:pe,speed:S(y.speed),startAnimationDuration:S(y.startAnimationDuration),thumbMargin:S(y.thumbMargin),thumbWidth:S(y.thumbWidth),slideShowInterval:S(y.slideShowInterval),scale:S(y.scale),enableZoomAfter:S(y.enableZoomAfter),plugins:(m||[]).map(K=>g[K])};J&&(d.container=o,d.closable=!1);const j=($=g.lightGallery)==null?void 0:$.call(g,o,d);J&&j.openGallery()};if(g.lightGallery)Q();else{const{head:d}=document,j=Array.isArray(w)?[...w]:[w],$=Array.isArray(O)?[...O]:[O],K=x=>{if(x.length){const v=document.createElement("link");v.href=x.shift(),v.rel="stylesheet",d.appendChild(v),K(x)}},X=x=>{if(x.length){const v=document.createElement("script");v.src=x.shift(),v.onerror=v.onload=X.bind(null,x),d.appendChild(v)}else Q()};K($),X(j)}},b=t=>{const o=t.getTrait(U);if(!h||!o)return;const{toolbar:g}=t,m={id:U,label:h,command:()=>setTimeout(()=>o.runCommand(),100)};!g.find(O=>O.id===m.id)&&(g==null||g.unshift(m))};let C=[];const T=r.plugins||[],_=M(Se),L=T.includes(le)?M(xe):B,G=T.includes(oe)?M(ke):B,V=T.includes(se)?M(Ie):B;n.addType(k,{block:p&&{label:s,media:I.gallery,category:"Extra",select:!0,...r.block},isComponent:t=>z(t,H),extendFn:["init","initToolbar"],model:{defaults:{name:s,icon:I.gallery,draggable:(t,o)=>!o.is(k),attributes:{[H]:!0},components:{type:te},script:i,selector:"",exThumbImage:"",cdnScript:r.cdnScript,cdnStyle:r.cdnStyle,plugins:r.plugins,lgLicenseKey:r.lgLicenseKey,"script-props":["lgLicenseKey","cdnScript","cdnStyle","plugins","selector","exThumbImage",..._.propKeys,...L.propKeys,...G.propKeys,...V.propKeys],..._.props,...L.props,...G.props,...V.props,traits:[..._.traits,...L.traits,...G.traits,...V.traits]},init(){W(this,["thumbnail"]),W(this,["autoplay"]),W(this,["zoom"])},initToolbar(){b(this)}},extendFnView:["init"],view:{events:()=>({lgInit:"onLgInit",lgBeforeOpen:"onLgOpen",lgAfterClose:"onLgClose"}),init(){this.listenTo(this.model,n.events.scriptUnmount,this.destroyLightGallery)},getLightGallery(){return this.el.__lg},destroyLightGallery(){const t=this.getLightGallery();t==null||t.destroy()},disableLgInCanvas(){const t=this.getLightGallery();t.lgOpened=!0},isInlineGallery(){var o;const t=this.getLightGallery();return((o=t==null?void 0:t.settings)==null?void 0:o.container)===this.el},onLgInit(t){this.el.__lg=t.detail.instance,!this.isInlineGallery()&&this.disableLgInCanvas()},onLgOpen(){const{em:t}=this,{Canvas:o}=t,g=this.getLightGallery();C=o.getSpots(),setTimeout(()=>o.removeSpots()),g.__lgOpened=!0},onLgClose(){const t=this.getLightGallery();C.forEach(o=>this.em.Canvas.addSpot(o.attributes)),C=[],t.__lgOpened=!1,setTimeout(()=>this.disableLgInCanvas())},toggleGallery(t){const o=this.getLightGallery();if(o.__lgOpened)return o.closeGallery(!0);o.lgOpened=!1,o.openGallery(t)}}});const q=M(Le);n.addType(te,{isComponent:t=>z(t,ae)||t.tagName==="A"&&z(t.parentElement,H),extendFn:["init","initToolbar"],model:{defaults:{tagName:"a",name:u,icon:I.galleryItem,attributes:{[ae]:!0,href:c},components:{type:"image",attributes:{alt:"Image",src:c}},...q.props,traits:[...q.traits]},init(){const t=[f].map(o=>`change:${o}`).join(" ");this.initSourceType(),this.on(t,this.updateTraits),this.updateTraits({init:!0}),this.initScriptUpdate(),we(this,f,this.triggerGalleryUpdate)},initToolbar(){b(this)},initScriptUpdate(){const t=[ce.name].map(o=>`change:attributes:${o}`).join(" ");this.on(t,this.triggerGalleryUpdate)},triggerGalleryUpdate(...t){var o;(o=this.closestType(k))==null||o.__scriptPropsChange(...t)},updateTraits(t={}){const{changed:o}=this,{init:g}=t;if(o[f]||g){Z(this,f);const m=this.getTrait(f).getValue();if(m===P.image){this.removeAttributes([N.name,F.name,D]);const w=this.getTrait(R.name);w.setValue(w.getValue()||c)}else m===P.video?this.removeAttributes([D]):m===P.external&&this.addAttributes({[D]:!0})}},initSourceType(){const t=this.getAttributes({noClass:!0,noStyle:!0});t[D]?this.set(f,P.external):(t[N.name]||t[F.name])&&this.set(f,P.video)}}}),fe({editor:e,plan:E.startup,licenseKey:r.licenseKey,pluginName:Ae,cleanup:()=>{a.remove(k),n.removeType(k)}})},Ce=ve(Ee);module.exports=Ce;
|
|
1
|
+
"use strict";const ie="app.grapesjs.com",re="app-stage.grapesjs.com",Y=[ie,re,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],ue="license:check:start",he="license:check:end",ge=()=>typeof window<"u",be=({isDev:e,isStage:l})=>`${e?"":`https://${l?re:ie}`}/api`,de=()=>{const e=ge()&&window.location.hostname;return!!e&&(Y.includes(e)||Y.some(l=>e.endsWith(l)))};async function me({path:e,baseApiUrl:l,method:a="GET",headers:n={},params:s,body:u}){const p=`${l||be({isDev:!1,isStage:!1})}${e}`,h={method:a,headers:{"Content-Type":"application/json",...n}};u&&(h.body=JSON.stringify(u));const c=s?new URLSearchParams(s).toString():"",i=c?`?${c}`:"",b=await fetch(`${p}${i}`,h);if(!b.ok)throw new Error(`HTTP error! status: ${b.status}`);return b.json()}var E=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(E||{});const ee={[E.free]:0,[E.startup]:10,[E.business]:20,[E.enterprise]:30};function ye(e){const l=e;return l.init=a=>n=>e(n,a),l}const ve=e=>ye(e);async function fe({editor:e,plan:l,pluginName:a,licenseKey:n,cleanup:s}){let u="",r=!1;const p=de(),h=i=>{console.warn("Cleanup plugin:",a,"Reason:",i),s()},c=(i={})=>{var I;const{error:b,sdkLicense:C}=i,T=(I=i.plan)==null?void 0:I.category;if(!(C||i.license)||b)h(b||"Invalid license");else if(T){const G=ee[l],V=ee[T];G>V&&h({pluginRequiredPlan:l,licensePlan:T})}};e.on(ue,i=>{u=i==null?void 0:i.baseApiUrl,r=!0}),e.on(he,i=>{c(i)}),setTimeout(async()=>{if(!r){if(p)return;if(n){const i=await Te({licenseKey:n,pluginName:a,baseApiUrl:u});i&&c(i)}else h("The `licenseKey` option not provided")}},2e3)}async function Te(e){const{licenseKey:l,pluginName:a,baseApiUrl:n}=e;try{return(await me({baseApiUrl:n,path:`/sdk/${l||"na"}`,method:"POST",params:{d:window.location.hostname,pn:a}})).result||{}}catch(s){return console.error("Error during SDK license check:",s),!1}}const z=(e,l)=>{var a;return!!((a=e==null?void 0:e.hasAttribute)!=null&&a.call(e,l))},we="lightGalleryComponent",Se=E.startup;var P=(e=>(e.image="image",e.video="video",e.external="external",e))(P||{});const k="lightGallery",te=`${k}-item`,U="data-lightgallery",ae=`${U}-item`,D="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>'},B={propKeys:[],props:{},traits:[]},_=(e,l={})=>{var s;const a={},n=[];for(const u in e){const{value:r,...p}=e[u];n.push({id:u,name:u,changeProp:!0,category:l.category,...p}),a[u]=r;const{subTraits:h={}}=p;for(const c in p.subTraits)(s=h[c])==null||s.forEach(i=>{const b=i.id||i.name;a[b]=i.value})}return{propKeys:Object.keys(a),props:a,traits:n}},Z=(e,l)=>{const a=e.getTrait(l),n=a.get("category"),s=a.get("subTraits")||{},r=(Object.values(s).flat()||[]).map(c=>c.id||c.name);e.removeTrait(r);const p=s[a.getValue()],h=e.getTraitIndex(l)+1;p&&e.addTrait(p.map(c=>({category:n,...c})),{at:h})},W=(e,l)=>{l.forEach(a=>{const n=e.getTrait(a);if(!n||!n.get("subTraits"))return;const s=n.changeProp?`change:${a}`:`change:attributes:${a}`;e.on(s,()=>Z(e,a)),Z(e,a)})},xe=(e,l,a)=>{const s=e.getTrait(l).get("subTraits")||{},r=(Object.values(s).flat()||[]).map(h=>{const c=h.name||h.id;return h.changeProp?`change:${c}`:`change:attributes:${c}`}),p=Array.from(new Set(r));p.length&&e.on(p.join(" "),a)},ke={[D]:{type:"button",label:"Toggle Gallery",command:(e,l)=>{var a,n;return(n=(a=l.target)==null?void 0:a.getView())==null?void 0:n.toggleGallery()}},speed:{type:"number",label:"Speed",tip:"Transition duration between slides (in ms)",value:400,step:50,min:0},inline:{type:"checkbox",label:"Inline Gallery",value:!1},allowMediaOverlap:{type:"checkbox",label:"Allow media overlap",tip:"If enabled, toolbar, captions and thumbnails will overlap with the media element",value:!1},controls:{type:"checkbox",label:"Show controls",tip:"If disabled, prev/next buttons will not be displayed",value:!0},counter:{type:"checkbox",label:"Show counter",tip:"Display the total number of images and index number of the currently displayed slide",value:!0},download:{type:"checkbox",label:"Download icon",tip:"Enable download button",value:!0},enableDrag:{type:"checkbox",label:"Enable drag",tip:"Enables desktop mouse drag support",value:!0},enableSwipe:{type:"checkbox",label:"Enable swipe",tip:"Enables swipe support for mobile devices",value:!0},escKey:{type:"checkbox",label:"Enable Esc key",tip:'Whether the gallery could be closed by pressing the "Esc" key',value:!0},keyPress:{type:"checkbox",label:"Enable keyboard navigation",value:!1},loop:{type:"checkbox",label:"Loop",tip:"If false, will disable the ability to loop back to the beginning of the gallery from the last slide",value:!0},getCaptionFromTitleOrAlt:{type:"checkbox",label:"Caption from title or alt",tip:"Get captions from alt or title tags",value:!0},showMaximizeIcon:{type:"checkbox",label:"Show maximize icon",value:!1},closable:{type:"checkbox",label:"Closable",tip:"If false, it won't be possible to close the gallery",value:!0},showCloseIcon:{type:"checkbox",label:"Show close icon",tip:"If false, close button won't be displayed.",visible:({component:e})=>!!e.getTrait("closable").getValue(),value:!0},closeOnTap:{type:"checkbox",label:"Close on tap",tip:"Allows clicks on black area to close gallery",visible:({component:e})=>!!e.getTrait("closable").getValue(),value:!0}},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"}]}}},Ie={autoplay:{category:{id:"autoplay-options",label:"Autoplay options"},type:"checkbox",label:"Autoplay",value:!0,subTraits:{false:[],true:[{type:"checkbox",name:"autoplayControls",label:"Autoplay controls",tip:"Show/hide autoplay controls",changeProp:!0,value:!0},{type:"checkbox",name:"progressBar",label:"Progress bar",tip:"Show autoplay progress bar",changeProp:!0,value:!0},{type:"checkbox",name:"forceSlideShowAutoplay",label:"Force autoplay",tip:"If false, autoplay will be stopped after first user action",changeProp:!0,value:!1},{type:"checkbox",name:"slideShowAutoplay",label:"Start autoplay",tip:"Enable autoplay on start",changeProp:!0,value:!1},{type:"number",name:"slideShowInterval",label:"Interval",tip:"The time (in ms) between each auto transition",changeProp:!0,min:0,step:50,value:5e3}]}}},Ae={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",N="data-iframe",R={name:"href",type:"file",label:"Image Source"},H={name:"data-src",label:"Video Source",placeholder:"https://www.youtube.com/watch?v=..."},F={name:"data-poster",label:"Video Poster",type:"file"},ne={name:"data-src",label:"External Source",placeholder:"https://some-external-source.com/...."},ce={label:"Caption",name:"data-sub-html",placeholder:"My caption",changeProp:!1},Pe={[D]:{type:"button",label:"Toggle Gallery",command:(e,l)=>{var s,u;const a=l.target,n=(s=a==null?void 0:a.closestType(k))==null?void 0:s.getView();if(n&&a){const r=((u=n.getLightGallery())==null?void 0:u.items)||[],p=Array.from(r).indexOf(a.getEl());p>=0&&n.toggleGallery(p)}}},[f]:{type:"radio",label:"Source type",labelToTitle:!0,value:"image",subTraits:{image:[R],video:[H,F],external:[ne]},options:[{id:"image",label:R.label||"",icon:L.image},{id:"video",label:H.label||"",icon:L.video},{id:"external",label:ne.label||"",icon:L.external}]},subHtml:ce},le="lgThumbnail",Ee="lgVideo",oe="lgAutoplay",se="lgZoom",A="https://cdn.jsdelivr.net/npm/lightgallery@2.8.2",Ce=function(e,l={}){const{Blocks:a,Components:n}=e,s="LightGallery",u="LightGallery Item",r={toolbarIconOpen:L.eye,block:{},lgLicenseKey:"92DE1DB8-7986-4F02-B908-514F97678D28",defaultSrc:"https://placehold.co/200/777/white.png?text=Image",plugins:[le,Ee,oe,se],cdnScript:[`${A}/lightgallery.min.js`,`${A}/plugins/thumbnail/lg-thumbnail.min.js`,`${A}/plugins/video/lg-video.min.js`,`${A}/plugins/autoplay/lg-autoplay.min.js`,`${A}/plugins/zoom/lg-zoom.min.js`],cdnStyle:`${A}/css/lightgallery-bundle.min.css`,...l},{block:p,toolbarIconOpen:h,defaultSrc:c}=r,i=function(t){const o=this,g=window,{plugins:m,cdnScript:w,cdnStyle:O,inline:J,lgLicenseKey:pe,...y}=t||{},S=d=>isNaN(d)?void 0:parseInt(d,10),Q=()=>{var $;const d={...y,licenseKey:pe,speed:S(y.speed),startAnimationDuration:S(y.startAnimationDuration),thumbMargin:S(y.thumbMargin),thumbWidth:S(y.thumbWidth),slideShowInterval:S(y.slideShowInterval),scale:S(y.scale),enableZoomAfter:S(y.enableZoomAfter),plugins:(m||[]).map(K=>g[K])};J&&(d.container=o,d.closable=!1);const j=($=g.lightGallery)==null?void 0:$.call(g,o,d);J&&j.openGallery()};if(g.lightGallery)Q();else{const{head:d}=document,j=Array.isArray(w)?[...w]:[w],$=Array.isArray(O)?[...O]:[O],K=x=>{if(x.length){const v=document.createElement("link");v.href=x.shift(),v.rel="stylesheet",d.appendChild(v),K(x)}},X=x=>{if(x.length){const v=document.createElement("script");v.src=x.shift(),v.onerror=v.onload=X.bind(null,x),d.appendChild(v)}else Q()};K($),X(j)}},b=t=>{const o=t.getTrait(D);if(!h||!o)return;const{toolbar:g}=t,m={id:D,label:h,command:()=>setTimeout(()=>o.runCommand(),100)};!g.find(O=>O.id===m.id)&&(g==null||g.unshift(m))};let C=[];const T=r.plugins||[],M=_(ke),I=T.includes(le)?_(Le):B,G=T.includes(oe)?_(Ie):B,V=T.includes(se)?_(Ae):B;n.addType(k,{block:p&&{label:s,media:L.gallery,category:"Extra",select:!0,...r.block},isComponent:t=>z(t,U),extendFn:["init","initToolbar"],model:{defaults:{name:s,icon:L.gallery,draggable:(t,o)=>!o.is(k),attributes:{[U]:!0},components:{type:te},script:i,selector:"",exThumbImage:"",cdnScript:r.cdnScript,cdnStyle:r.cdnStyle,plugins:r.plugins,lgLicenseKey:r.lgLicenseKey,"script-props":["lgLicenseKey","cdnScript","cdnStyle","plugins","selector","exThumbImage",...M.propKeys,...I.propKeys,...G.propKeys,...V.propKeys],...M.props,...I.props,...G.props,...V.props,traits:[...M.traits,...I.traits,...G.traits,...V.traits]},init(){W(this,["thumbnail"]),W(this,["autoplay"]),W(this,["zoom"])},initToolbar(){b(this)}},extendFnView:["init"],view:{events:()=>({lgInit:"onLgInit",lgBeforeOpen:"onLgOpen",lgAfterClose:"onLgClose"}),init(){this.listenTo(this.model,n.events.scriptUnmount,this.destroyLightGallery)},getLightGallery(){return this.el.__lg},destroyLightGallery(){const t=this.getLightGallery();t==null||t.destroy()},disableLgInCanvas(){const t=this.getLightGallery();t.lgOpened=!0},isInlineGallery(){var o;const t=this.getLightGallery();return((o=t==null?void 0:t.settings)==null?void 0:o.container)===this.el},onLgInit(t){this.el.__lg=t.detail.instance,!this.isInlineGallery()&&this.disableLgInCanvas()},onLgOpen(){const{em:t}=this,{Canvas:o}=t,g=this.getLightGallery();C=o.getSpots(),setTimeout(()=>o.removeSpots()),g.__lgOpened=!0},onLgClose(){const t=this.getLightGallery();C.forEach(o=>this.em.Canvas.addSpot(o.attributes)),C=[],t.__lgOpened=!1,setTimeout(()=>this.disableLgInCanvas())},toggleGallery(t){const o=this.getLightGallery();if(o.__lgOpened)return o.closeGallery(!0);o.lgOpened=!1,o.openGallery(t)}}});const q=_(Pe);n.addType(te,{isComponent:t=>z(t,ae)||t.tagName==="A"&&z(t.parentElement,U),extendFn:["init","initToolbar"],model:{defaults:{tagName:"a",name:u,icon:L.galleryItem,attributes:{[ae]:!0,href:c},components:{type:"image",attributes:{alt:"Image",src:c}},...q.props,traits:[...q.traits]},init(){const t=[f].map(o=>`change:${o}`).join(" ");this.initSourceType(),this.on(t,this.updateTraits),this.updateTraits({init:!0}),this.initScriptUpdate(),xe(this,f,this.triggerGalleryUpdate)},initToolbar(){b(this)},initScriptUpdate(){const t=[ce.name].map(o=>`change:attributes:${o}`).join(" ");this.on(t,this.triggerGalleryUpdate)},triggerGalleryUpdate(...t){var o;(o=this.closestType(k))==null||o.__scriptPropsChange(...t)},updateTraits(t={}){const{changed:o}=this,{init:g}=t;if(o[f]||g){Z(this,f);const m=this.getTrait(f).getValue();if(m===P.image){this.removeAttributes([H.name,F.name,N]);const w=this.getTrait(R.name);w.setValue(w.getValue()||c)}else m===P.video?this.removeAttributes([N]):m===P.external&&this.addAttributes({[N]:!0})}},initSourceType(){const t=this.getAttributes({noClass:!0,noStyle:!0});t[N]?this.set(f,P.external):(t[H.name]||t[F.name])&&this.set(f,P.video)}}}),fe({editor:e,plan:Se,licenseKey:r.licenseKey,pluginName:we,cleanup:()=>{a.remove(k),n.removeType(k)}})},Ge=ve(Ce);module.exports=Ge;
|