@grapesjs/studio-sdk-plugins 1.0.33-rc.1 → 1.0.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accordionComponent/index.cjs.js +7 -7
- package/dist/accordionComponent/index.es.js +161 -156
- package/dist/accordionComponent/index.umd.js +9 -9
- package/dist/aiChat/chatManager.d.ts +15 -0
- package/dist/aiChat/clientTools.d.ts +3 -3
- package/dist/aiChat/clientToolsProcessors.d.ts +14 -1
- package/dist/aiChat/components/AiChatEmptyState.d.ts +4 -6
- package/dist/aiChat/components/AiChatError.d.ts +2 -1
- package/dist/aiChat/components/AiChatHeader.d.ts +2 -1
- package/dist/aiChat/components/AiChatInput/AssetsSection.d.ts +7 -0
- package/dist/aiChat/components/AiChatInput/AttachButton.d.ts +10 -0
- package/dist/aiChat/components/AiChatInput/ContextSection.d.ts +5 -0
- package/dist/aiChat/components/AiChatInput/DictateButton.d.ts +7 -0
- package/dist/aiChat/components/AiChatInput/TextAreaWithAutoResize.d.ts +6 -0
- package/dist/aiChat/components/AiChatInput/constants.d.ts +6 -0
- package/dist/aiChat/components/AiChatInput/hooks/useSpeechToText.d.ts +15 -0
- package/dist/aiChat/components/AiChatInput/index.d.ts +37 -0
- package/dist/aiChat/components/AiChatLoadingState.d.ts +2 -1
- package/dist/aiChat/components/AiChatMessage.d.ts +21 -9
- package/dist/aiChat/components/AiChatMessages.d.ts +5 -7
- package/dist/aiChat/components/AiChatMessagesStatus.d.ts +5 -0
- package/dist/aiChat/components/AiChatPanel.d.ts +2 -3
- package/dist/aiChat/components/AiChatProvider.d.ts +14 -0
- package/dist/aiChat/components/MemoizedMarkdown.d.ts +9 -0
- package/dist/aiChat/components/index.d.ts +24 -25
- package/dist/aiChat/components/utils.d.ts +12 -4
- package/dist/aiChat/index.cjs.d.ts +5 -0
- package/dist/aiChat/index.cjs.js +453 -0
- package/dist/aiChat/index.d.ts +4 -3
- package/dist/aiChat/index.es.d.ts +5 -0
- package/dist/aiChat/index.es.js +30930 -0
- package/dist/aiChat/index.js +453 -0
- package/dist/aiChat/index.umd.js +453 -0
- package/dist/aiChat/locales/en.d.ts +64 -0
- package/dist/aiChat/server/index.cjs.d.ts +4 -0
- package/dist/aiChat/server/index.cjs.js +309 -0
- package/dist/aiChat/server/index.d.ts +0 -50
- package/dist/aiChat/server/index.es.d.ts +4 -0
- package/dist/aiChat/server/index.es.js +876 -0
- package/dist/aiChat/server/index.js +309 -0
- package/dist/aiChat/server/index.umd.js +309 -0
- package/dist/aiChat/server/stream.d.ts +0 -6
- package/dist/aiChat/server/tools.d.ts +157 -51
- package/dist/aiChat/server/types.d.ts +108 -64
- package/dist/aiChat/types.d.ts +148 -108
- package/dist/aiChat/typesSchema.d.ts +238 -25
- package/dist/animationComponent/index.cjs.js +3 -3
- package/dist/animationComponent/index.es.js +174 -169
- package/dist/animationComponent/index.umd.js +3 -3
- package/dist/canvasAbsoluteMode/index.cjs.js +1 -1
- package/dist/canvasAbsoluteMode/index.es.js +161 -156
- package/dist/canvasAbsoluteMode/index.umd.js +1 -1
- package/dist/canvasEmptyState/index.cjs.js +1 -1
- package/dist/canvasEmptyState/index.es.js +113 -108
- package/dist/canvasEmptyState/index.umd.js +1 -1
- package/dist/canvasFullSize/index.cjs.js +9 -9
- package/dist/canvasFullSize/index.es.js +137 -132
- package/dist/canvasFullSize/index.umd.js +9 -9
- package/dist/canvasGridMode/index.cjs.js +4 -4
- package/dist/canvasGridMode/index.es.js +168 -163
- package/dist/canvasGridMode/index.umd.js +8 -8
- package/dist/canvasScreenshot/index.cjs.js +1 -1
- package/dist/canvasScreenshot/index.es.js +132 -127
- package/dist/canvasScreenshot/index.umd.js +1 -1
- package/dist/dataSourceEjs/index.cjs.js +5 -5
- package/dist/dataSourceEjs/index.es.js +151 -146
- package/dist/dataSourceEjs/index.umd.js +5 -5
- package/dist/dataSourceHandlebars/index.cjs.js +4 -4
- package/dist/dataSourceHandlebars/index.es.js +91 -86
- package/dist/dataSourceHandlebars/index.umd.js +5 -5
- package/dist/dialogComponent/index.cjs.js +16 -16
- package/dist/dialogComponent/index.es.js +117 -112
- package/dist/dialogComponent/index.umd.js +16 -16
- package/dist/flexComponent/index.cjs.js +11 -11
- package/dist/flexComponent/index.es.js +416 -411
- package/dist/flexComponent/index.umd.js +11 -11
- package/dist/fsLightboxComponent/index.cjs.js +3 -3
- package/dist/fsLightboxComponent/index.es.js +152 -147
- package/dist/fsLightboxComponent/index.umd.js +3 -3
- package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
- package/dist/googleFontsAssetProvider/index.es.js +127 -122
- package/dist/googleFontsAssetProvider/index.umd.js +1 -1
- package/dist/iconifyComponent/index.cjs.js +2 -2
- package/dist/iconifyComponent/index.es.js +170 -165
- package/dist/iconifyComponent/index.umd.js +2 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +27 -22
- package/dist/index.umd.js +1 -1
- package/dist/layoutSidebarButtons/index.cjs.js +1 -1
- package/dist/layoutSidebarButtons/index.es.js +156 -151
- package/dist/layoutSidebarButtons/index.umd.js +1 -1
- package/dist/lightGalleryComponent/index.cjs.js +1 -1
- package/dist/lightGalleryComponent/index.es.js +197 -192
- package/dist/lightGalleryComponent/index.umd.js +1 -1
- package/dist/linkImageComponent/index.cjs.js +2 -2
- package/dist/linkImageComponent/index.es.js +86 -81
- package/dist/linkImageComponent/index.umd.js +2 -2
- package/dist/listPagesComponent/index.cjs.js +5 -5
- package/dist/listPagesComponent/index.es.js +121 -116
- package/dist/listPagesComponent/index.umd.js +5 -5
- package/dist/presetPrintable/index.cjs.js +4 -4
- package/dist/presetPrintable/index.es.js +180 -175
- package/dist/presetPrintable/index.umd.js +4 -4
- package/dist/prosemirror/index.cjs.js +6 -6
- package/dist/prosemirror/index.es.js +128 -123
- package/dist/prosemirror/index.umd.js +8 -8
- package/dist/rendererReact/index.cjs.js +1 -1
- package/dist/rendererReact/index.es.js +127 -122
- package/dist/rendererReact/index.js +1 -1
- package/dist/rendererReact/index.umd.js +1 -1
- package/dist/rteTinyMce/index.cjs.js +2 -2
- package/dist/rteTinyMce/index.es.js +160 -155
- package/dist/rteTinyMce/index.umd.js +2 -2
- package/dist/shapeDividerComponent/index.cjs.js +25 -25
- package/dist/shapeDividerComponent/index.es.js +127 -122
- package/dist/shapeDividerComponent/index.umd.js +25 -25
- package/dist/swiperComponent/index.cjs.js +9 -9
- package/dist/swiperComponent/index.es.js +197 -192
- package/dist/swiperComponent/index.umd.js +9 -9
- package/dist/tableComponent/index.cjs.js +1 -1
- package/dist/tableComponent/index.es.js +227 -222
- package/dist/tableComponent/index.umd.js +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/utils.d.ts +12 -1
- package/dist/youtubeAssetProvider/index.cjs.js +1 -1
- package/dist/youtubeAssetProvider/index.es.js +124 -119
- package/dist/youtubeAssetProvider/index.umd.js +1 -1
- package/package.json +5 -2
- package/dist/aiChat/components/AiChatInput.d.ts +0 -17
- package/dist/aiChat/server/stream-utils.d.ts +0 -16
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
<data-condition data-gjs-data-resolver='${JSON.stringify({condition:
|
|
1
|
+
(function(p,d){typeof exports=="object"&&typeof module<"u"?module.exports=d(require("handlebars/dist/cjs/handlebars")):typeof define=="function"&&define.amd?define(["handlebars/dist/cjs/handlebars"],d):(p=typeof globalThis<"u"?globalThis:p||self,p.StudioSdkPlugins_dataSourceHandlebars=d(p.Handlebars))})(this,function(p){"use strict";const d="app.grapesjs.com",P="app-stage.grapesjs.com",S=[d,"app2.grapesjs.com",P,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],x="license:check:start",I="license:check:end",N=()=>typeof window<"u",_=({isDev:a,isStage:t,isPlatform:e})=>`${a?"":`https://${t?P:d}`}/${e?"platform-api":"api"}`,T=()=>{const a=N()&&window.location.hostname;return!!a&&(S.includes(a)||S.some(t=>a.endsWith(t)))};async function v({path:a,baseApiUrl:t,method:e="GET",headers:n={},params:s,body:i}){const l=`${t||_({isDev:!1,isStage:!1})}${a}`,u={method:e,headers:{"Content-Type":"application/json",...n}};i&&(u.body=JSON.stringify(i));const c=s?new URLSearchParams(s).toString():"",h=c?`?${c}`:"",o=await fetch(`${l}${h}`,u);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return o.json()}var m=(a=>(a.free="free",a.startup="startup",a.business="business",a.enterprise="enterprise",a))(m||{});const y={[m.free]:0,[m.startup]:10,[m.business]:20,[m.enterprise]:30};function C(a){const t=a;return t.init=e=>n=>a(n,e),t}const k=a=>C(a);async function O({editor:a,plan:t,pluginName:e,licenseKey:n,onLicenseCheckResponse:s,cleanup:i}){let r="",l=!1;const u=T(),c=o=>{console.warn("Cleanup plugin:",e,"Reason:",o),i()},h=(o={})=>{var E;const{error:$,sdkLicense:B}=o,g=(E=o.plan)==null?void 0:E.category;if(!(B||o.license)||$)c($||"Invalid license");else if(g){const W=y[t],G=y[g];W>G&&c({pluginRequiredPlan:t,licensePlan:g})}};a.on(x,o=>{r=o==null?void 0:o.baseApiUrl,l=!0}),a.on(I,o=>{s==null||s(o),h(o)}),setTimeout(async()=>{if(!l){if(u)return;if(n){const o=await A({licenseKey:n,pluginName:e,baseApiUrl:r});s==null||s(o),o&&h(o)}else c("The `licenseKey` option not provided")}},2e3)}async function A(a){const{licenseKey:t,pluginName:e,baseApiUrl:n}=a;try{return(await v({baseApiUrl:n,path:`/sdk/${t||"na"}`,method:"POST",params:{d:window.location.hostname,pn:e}})).result||{}}catch(s){return console.error("Error during SDK license check:",s),!1}}const w=(a,t)=>(a.config.optsHtml={...a.config.optsHtml,exporter:t},()=>{a.config.optsHtml.exporter=void 0}),L=(a,t)=>{const e=s=>{const{input:i}=s,{contains:r}=t;(!r||i.includes(r))&&(s.input=t.importer.import(i))},n=a.Parser.events.htmlBefore;return a.on(n,e),()=>{a.off(n,e)}},b={equals:"equals",isTruthy:"isTruthy",isFalsy:"isFalsy",isDefined:"isDefined",isNull:"isNull",isUndefined:"isUndefined",isArray:"isArray",isObject:"isObject",isString:"isString",isNumber:"isNumber",isBoolean:"isBoolean",isDefaultValue:"isDefaultValue"},j={...b,...{">":"numGt","<":"numLt",">=":"numGte","<=":"numLte","=":"numEq","!=":"numNeq"},...{contains:"strContains",startsWith:"strStartsWith",endsWith:"strEndsWith",equalsIgnoreCase:"strEqualsIgnoreCase",trimEquals:"strTrimEquals"}};class D{getHelperId(t){return j[t]||t}getFullPath({collectionId:t,path:e}){let n=e;return t&&(n=[this._sanitizeVariableName(t),e].filter(Boolean).join(".")),n||""}getVariableSyntax({dataResolver:t}){const{defaultValue:e}=t,n=this.getFullPath(t);return e?`{{#if ${n}}}{{{${n}}}}{{else}}${e}{{/if}}`:`{{{${n}}}}`}getCollectionStartSyntax({dataResolver:t}){const{collectionId:e,dataSource:n}=t,s=n==null?void 0:n.path;let i="";if(t.startIndex!==void 0||t.endIndex!==void 0){const c=t.startIndex??0,h=t.endIndex!==void 0?t.endIndex:"";h!==""?i=` (slice ${s} ${c} ${h})`:i=` (slice ${s} ${c})`}const l=` as |${this._sanitizeVariableName(e)}|`;return`{{#each ${i||s}${l}}}`}getCollectionEndSyntax(){return"{{/each}}"}getConditionalStartSyntax({dataResolver:t}){const e=t.condition;if(!e)return"";const n=e,s=e;if(s.statements&&s.logicalOperator==="and"||s.logicalOperator==="or"){const{statements:i}=s,r=s.logicalOperator,l=i.map(c=>this._parseCondition(c)).join(" ");return`{{#if ${i.length>1?`(${r} ${l})`:l}}}`}else return`{{#if ${this._parseCondition(n)}}}`}_parseCondition(t){if(!t)return"";const e=t,n=t;if(n.statements&&n.logicalOperator==="and"||n.logicalOperator==="or"){const{statements:s}=n,i=n.logicalOperator,r=n.statements.map(l=>this._parseCondition(l)).join(" ");return s.length>1?`(${i} ${r})`:r}else{const s=e.operator,i=this.getHelperId(s),r=this._parseValue(e.left),l=this._parseValue(e.right);return this.getExpressionStr(i,r,l)}}getExpressionStr(t,e,n){return b[t]?t==="isTruthy"?e:t==="isFalsy"?`!${e}`:`${t} ${e}`:`(${t} ${e} ${n})`}_parseValue(t){return typeof t=="object"?this.getFullPath(t):typeof t=="string"?`'${t.replace(/'/g,"\\'")}'`:String(t)}_sanitizeVariableName(t){return t.replace(/[^a-zA-Z0-9_$]/g,"_")}getConditionElseSyntax(){return"{{else}}"}getConditionalEndSyntax(){return"{{/if}}"}}class M{constructor(){this.messages=[],this.collectionStack=[]}import(t){this.messages=[],this.collectionStack=[];const e=this.parse(t);return this.astToGrapesJS(e)}parse(t){try{return p.parse(t)}catch(e){if(e instanceof Error&&e.message.includes("Parse error")){const n=e.message.match(/line (\d+)/),s=n?parseInt(n[1]):0,i=e.message.match(/column (\d+)/),r=i?parseInt(i[1]):0;throw new Error(`Handlebars syntax error at line ${s}, column ${r}: ${e.message}`)}throw e}}astToGrapesJS(t){switch(t.type){case"Program":return this.handleProgram(t);case"ContentStatement":return this.handleContentStatement(t);case"MustacheStatement":return this.handleMustacheStatement(t);case"BlockStatement":return this.handleBlockStatement(t);case"PartialStatement":return this.handlePartialStatement(t);case"CommentStatement":return this.handleCommentStatement(t);case"ElementNode":return this.handleElementNode(t);case"TextNode":return this.handleTextNode(t);default:return this.addMessage("warning",`Unsupported node type: ${t.type}`,t.loc),""}}handleProgram(t){let e="";if(t.body)for(const n of t.body)e+=this.astToGrapesJS(n);return e}handleContentStatement(t){return t.value||""}handleMustacheStatement(t,e={}){const n=this.getExpressionString(t.path),s={...e};return this.collectionStack.length>0?this.processPathWithCollectionContext(n,s):s.path=n,`<data-variable data-gjs-data-resolver='${JSON.stringify(s)}'></data-variable>`}processPathWithCollectionContext(t,e){t.startsWith("@")?this.handleDirectCollectionReference(t,e):this.handleRelativePathReference(t,e)}handleDirectCollectionReference(t,e){if(this.isSpecialIterationVariable(t)){this.setSpecialVariableResolver(this.collectionStack[this.collectionStack.length-1],t,e);return}const[n,...s]=t.substring(1).split("/"),i=s.join(".");this.collectionStack.includes(n)?this.setCurrentItemResolver(n,i,e):this.handleParentReferenceFallback(t,e)}isSpecialIterationVariable(t){return["index","@index","key","@key"].includes(t)}setSpecialVariableResolver(t,e,n){n.collectionId=t;const s={index:"currentIndex","@index":"currentIndex",key:"currentKey","@key":"currentKey"};n.variableType=s[e]}setCurrentItemResolver(t,e,n){n.collectionId=t,n.variableType="currentItem",e&&(n.path=e)}handleRelativePathReference(t,e){const n=f(t),{parentLevel:s,remainingPathParts:i}=this.calculateParentLevel(n),r=i.join("."),l=this.collectionStack.length-1-s;l>=0&&l<this.collectionStack.length?this.resolveRelativePath(r,l,e):e.path=i.join(".")}calculateParentLevel(t){const e=this.collectionStack.findLastIndex(i=>i===t[0]);if(e!==-1)return{parentLevel:this.collectionStack.length-1-e,remainingPathParts:t.slice(1)};let n=0;const s=[...t];for(;s[0]==="..";)n++,s.shift();return{parentLevel:n,remainingPathParts:s}}resolveRelativePath(t,e,n){const s=this.collectionStack[e];n.collectionId=s,n.variableType="currentItem",t!=="this"&&(n.path=t.startsWith("this.")?t.split(".").slice(1).join("."):t)}handleParentReferenceFallback(t,e){const n=f(t),{parentLevel:s,remainingPathParts:i}=this.calculateParentLevel(n),r=i.join("."),l=this.collectionStack.length-1-s;l>=0&&l<this.collectionStack.length?this.resolveRelativePath(r,l,e):e.path=i.join(".")}handleBlockStatement(t){const e=t.path.original;switch(e){case"if":case"unless":return this.handleConditionalBlock(t,e);case"each":return this.handleEachBlock(t);default:return this.addMessage("warning",`Unsupported block helper: ${e}`,t.loc),this.handleGenericBlock(t)}}handleConditionalBlock(t,e){const i={logicalOperator:"and",statements:[{left:{type:"data-variable",path:this.getExpressionString(t.params[0])},operator:e==="unless"?"isFalsy":"isTruthy"}]},r=this.handleProgram(t.program),l=t.inverse?this.handleProgram(t.inverse):"";return`
|
|
2
|
+
<data-condition data-gjs-data-resolver='${JSON.stringify({condition:i})}'>
|
|
3
3
|
<data-condition-true-content>${r}</data-condition-true-content>
|
|
4
|
-
<data-condition-false-content>${
|
|
4
|
+
<data-condition-false-content>${l}</data-condition-false-content>
|
|
5
5
|
</data-condition>
|
|
6
|
-
`}handleEachBlock(t){var
|
|
6
|
+
`}handleEachBlock(t){var i,r,l;const e=this.getExpressionString(t.params[0]);let n;t.params.length>=3&&t.params[1]==="as"&&((i=t.params[2])==null?void 0:i.type)==="PathExpression"?n=t.params[2].original:(l=(r=t.program)==null?void 0:r.blockParams)!=null&&l.length?n=t.program.blockParams[0]:n=`collection-${Math.random().toString(36).substring(2,10)}`,this.collectionStack.push(n);const s=this.handleProgram(t.program);return this.collectionStack.pop(),`
|
|
7
7
|
<data-collection data-gjs-data-resolver='${JSON.stringify({dataSource:{type:"data-variable",path:e},collectionId:n})}'>
|
|
8
8
|
<data-collection-item>${s}</data-collection-item>
|
|
9
9
|
</data-collection>
|
|
10
|
-
`}handleCommentStatement(t){return`<!--${t.value}-->`}handleElementNode(t){let e="";if(t.attributes)for(const s of t.attributes)s.value.type==="TextNode"?e+=` ${s.name}="${s.value.chars}"`:(this.addMessage("warning",`Complex attribute values not fully supported: ${s.name}`,t.loc),e+=` ${s.name}="${this.getExpressionString(s.value)}"`);let n="";if(t.children)for(const s of t.children)n+=this.astToGrapesJS(s);return`<${t.tag}${e}>${n}</${t.tag}>`}handleTextNode(t){return t.chars||""}handlePartialStatement(t){return this.addMessage("warning",`Partials are not fully supported: ${t.name.original}`,t.loc),`{{> ${t.name.original}}}`}handleGenericBlock(t){const e=this.handleProgram(t.program);return`<!-- Unsupported block: ${t.path.original} -->${e}`}getExpressionString(t){return t.type==="PathExpression"?t.original:t.type==="StringLiteral"?t.value:t.type==="NumberLiteral"?t.value.toString():t.type==="BooleanLiteral"?t.value?"true":"false":t.type==="SubExpression"?this.getExpressionString(t.params[0]):t.type==="Hash"?`{${t.pairs.map(n=>`${n.key}=${this.getExpressionString(n.value)}`).join(", ")}}`:(this.addMessage("warning",`Complex expression type not fully supported: ${t.type}`,t.loc),"")}addMessage(t,e,n){this.messages.push({type:t,message:e,location:n?{line:n.start.line,column:n.start.column}:void 0})}}const f=
|
|
10
|
+
`}handleCommentStatement(t){return`<!--${t.value}-->`}handleElementNode(t){let e="";if(t.attributes)for(const s of t.attributes)s.value.type==="TextNode"?e+=` ${s.name}="${s.value.chars}"`:(this.addMessage("warning",`Complex attribute values not fully supported: ${s.name}`,t.loc),e+=` ${s.name}="${this.getExpressionString(s.value)}"`);let n="";if(t.children)for(const s of t.children)n+=this.astToGrapesJS(s);return`<${t.tag}${e}>${n}</${t.tag}>`}handleTextNode(t){return t.chars||""}handlePartialStatement(t){return this.addMessage("warning",`Partials are not fully supported: ${t.name.original}`,t.loc),`{{> ${t.name.original}}}`}handleGenericBlock(t){const e=this.handleProgram(t.program);return`<!-- Unsupported block: ${t.path.original} -->${e}`}getExpressionString(t){return t.type==="PathExpression"?t.original:t.type==="StringLiteral"?t.value:t.type==="NumberLiteral"?t.value.toString():t.type==="BooleanLiteral"?t.value?"true":"false":t.type==="SubExpression"?this.getExpressionString(t.params[0]):t.type==="Hash"?`{${t.pairs.map(n=>`${n.key}=${this.getExpressionString(n.value)}`).join(", ")}}`:(this.addMessage("warning",`Complex expression type not fully supported: ${t.type}`,t.loc),"")}addMessage(t,e,n){this.messages.push({type:t,message:e,location:n?{line:n.start.line,column:n.start.column}:void 0})}}const f=a=>{if(a==null||a==="")return[];if(a===".")return["this"];if(a===".."||a==="../")return[".."];if(a.startsWith("../")){const r=a.substring(3);return["..",...f(r)]}const t=[];let e=0,n=a.replace(/\[(?:(['"])(.*?)\1|([^\]]*))\]/g,(r,l,u,c)=>{const h=u!==void 0?u:c||"";return t[e]=h,`__HANDLEBARS_PLACEHOLDER_${e++}__`});n=n.replace(/\//g,".");const s=n.split("."),i=[];for(const r of s){const l=/^__HANDLEBARS_PLACEHOLDER_(\d+)__$/.exec(r);if(l){const u=parseInt(l[1],10);i.push(t[u])}else r!==""&&i.push(r)}return i},H="dataSourceHandlebars",U=m.startup;return k(function(a,t={}){const e=w(a,new D),n=L(a,{contains:"{{",importer:new M});O({editor:a,licenseKey:t.licenseKey,plan:U,pluginName:H,cleanup:()=>{e(),n()}})})});
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const x="app.grapesjs.com",S="app-stage.grapesjs.com",C="app2.grapesjs.com",_="app-stage2.grapesjs.com",T=[x,C,S,_,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],$="license:check:start",N="license:check:end",k=()=>typeof window<"u",D=({isDev:n,isStage:l,isPlatform:r})=>`${n?"":`https://${l?S:x}`}/${r?"platform-api":"api"}`,A=()=>{const n=k()&&window.location.hostname;return!!n&&(T.includes(n)||T.some(l=>n.endsWith(l)))};async function I({path:n,baseApiUrl:l,method:r="GET",headers:o={},params:a,body:i}){const d=`${l||D({isDev:!1,isStage:!1})}${n}`,p={method:r,headers:{"Content-Type":"application/json",...o}};i&&(p.body=JSON.stringify(i));const c=a?new URLSearchParams(a).toString():"",g=c?`?${c}`:"",t=await fetch(`${d}${g}`,p);if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return t.json()}var W=(n=>(n.free="free",n.startup="startup",n.business="business",n.enterprise="enterprise",n))(W||{});const O={[W.free]:0,[W.startup]:10,[W.business]:20,[W.enterprise]:30};function q(n){const l=n;return l.init=r=>o=>n(o,r),l}const U=n=>q(n);async function X({editor:n,plan:l,pluginName:r,licenseKey:o,onLicenseCheckResponse:a,cleanup:i}){let u="",d=!1;const p=A(),c=t=>{console.warn("Cleanup plugin:",r,"Reason:",t),i()},g=(t={})=>{var v;const{error:m,sdkLicense:P}=t,s=(v=t.plan)==null?void 0:v.category;if(!(P||t.license)||m)c(m||"Invalid license");else if(s){const b=O[l],w=O[s];b>w&&c({pluginRequiredPlan:l,licensePlan:s})}};n.on($,t=>{u=t==null?void 0:t.baseApiUrl,d=!0}),n.on(N,t=>{a==null||a(t),g(t)}),setTimeout(async()=>{if(!d){if(p)return;if(o){const t=await M({licenseKey:o,pluginName:r,baseApiUrl:u});a==null||a(t),t&&g(t)}else c("The `licenseKey` option not provided")}},2e3)}async function M(n){const{licenseKey:l,pluginName:r,baseApiUrl:o}=n;try{return(await I({baseApiUrl:o,path:`/sdk/${l||"na"}`,method:"POST",params:{d:window.location.hostname,pn:r}})).result||{}}catch(a){return console.error("Error during SDK license check:",a),!1}}const L=(...n)=>n.map(l=>`[data-gjs-type="${l}"]`).join(","),B="dialogComponent",z=function(n,l={}){const{Blocks:r,Components:o}=n,{licenseKey:a}=l,i="gjs-plg-dialog",u="gjs-plg-dialog-overlay",d="gjs-plg-dialog-content",p="gjs-plg-dialog-close",c="gjs-plg-dialog-title",g="gjs-plg-dialog-body",t="gjs-plg-dialog-description",m="gjs-plg-dialog-placeholder";r.add(i,{label:"Dialog",media:`
|
|
2
2
|
<svg viewBox="0 0 24 24">
|
|
3
3
|
<path d="M4 4h16v10H8l-4 4V4z"></path>
|
|
4
4
|
</svg>
|
|
5
|
-
`,category:"Extra",content:{type:
|
|
6
|
-
.${
|
|
5
|
+
`,category:"Extra",content:{type:i},activate:!0,...l.block}),o.addType(i,{model:{defaults:{tagName:"div",attributes:{class:i,"data-type-role":i},components:[{type:u},{type:m}],draggable:L("wrapper"),droppable:L(i),styles:`
|
|
6
|
+
.${i} {
|
|
7
7
|
position: relative;
|
|
8
8
|
z-index: 1;
|
|
9
9
|
}
|
|
10
|
-
`,traits:[{type:"button",label:"Open dialog",name:"onActive",changeProp:!0,command(
|
|
11
|
-
.${
|
|
10
|
+
`,traits:[{type:"button",label:"Open dialog",name:"onActive",changeProp:!0,command(s){var e;(e=s.getSelected())==null||e.trigger("active")}},{type:"checkbox",label:"Close when pressing X",name:"closeWhenPressingX",default:!0,changeProp:!0},{type:"checkbox",label:"Close when pressing ESC",name:"closeWhenPressingEsc",default:!0,changeProp:!0},{type:"checkbox",label:"Open when leaving the window",name:"openWhenLeavingWindow",default:!1,changeProp:!0},{type:"number",label:"Open when scrolling to level",name:"openWhenScrollingToLevel",default:0,changeProp:!0}],"script-props":["closeWhenPressingX","closeWhenPressingEsc","openWhenLeavingWindow","openWhenScrollingToLevel"],script:function(s){const e=this;function v(h){const f=e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]'),y=e.querySelector('[data-type-role="gjs-plg-dialog-close"]');function E(){f.style.display="none"}h?(e._onCloseWhenPressingX=E,y.addEventListener("click",e._onCloseWhenPressingX)):(y.removeEventListener("click",e._onCloseWhenPressingX),e._onCloseWhenPressingX=null)}function b(h){const f=e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function y(E){E.key==="Escape"&&(f.style.display="none")}h?(e._onCloseWhenPressingEsc=y,e.addEventListener("keydown",e._onCloseWhenPressingEsc)):(e.removeEventListener("keydown",e._onCloseWhenPressingEsc),e._onCloseWhenPressingEsc=null)}function w(h){const f=e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function y(){f.style.display="flex"}h?(e._onOpenWhenLeavingWindow=y,document.addEventListener("mouseleave",e._onOpenWhenLeavingWindow)):(document.removeEventListener("mouseleave",e._onOpenWhenLeavingWindow),e._onOpenWhenLeavingWindow=null)}function j(h){const f=e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function y(){const E=document.documentElement.scrollTop;h&&E>=Number(h)&&(f.style.display="flex")}h?(e._onOpenWhenScrollingToLevel=y,document.addEventListener("scroll",e._onOpenWhenScrollingToLevel)):(document.removeEventListener("scroll",e._onOpenWhenScrollingToLevel),e._onOpenWhenScrollingToLevel=null)}v(s.closeWhenPressingX),b(s.closeWhenPressingEsc),w(s.openWhenLeavingWindow),j(s.openWhenScrollingToLevel)}},init(){this.on("active",this.handleOpenWhenClickPlaceholder)},handleOpenWhenClickPlaceholder(){this.view.el.querySelector('[data-type-role="gjs-plg-dialog-placeholder"]').addEventListener("click",()=>{const e=this.view.el.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');e.style.display="flex"})}},view:{onActive(){const s=this.el.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');s.style.display="flex"}}}),o.addType(u,{model:{defaults:{tagName:"div",attributes:{class:u,"data-type-role":u},components:{type:d},droppable:!1,draggable:!1,styles:`
|
|
11
|
+
.${u} {
|
|
12
12
|
position: fixed;
|
|
13
13
|
top: 0;
|
|
14
14
|
left: 0;
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
justify-content: center;
|
|
20
20
|
background-color: rgba(0, 0, 0, 0.5);
|
|
21
21
|
}
|
|
22
|
-
`}}}),
|
|
23
|
-
.${
|
|
22
|
+
`}}}),o.addType(d,{model:{defaults:{tagName:"div",attributes:{class:d,"data-type-role":d},components:[{type:p},{type:c},{type:g}],droppable:!1,draggable:!1,styles:`
|
|
23
|
+
.${d} {
|
|
24
24
|
position: relative;
|
|
25
25
|
background-color: #fff;
|
|
26
26
|
border-radius: 10px;
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
height: 600px;
|
|
31
31
|
box-sizing: border-box;
|
|
32
32
|
}
|
|
33
|
-
`}}}),
|
|
34
|
-
.${
|
|
33
|
+
`}}}),o.addType(p,{model:{defaults:{tagName:"button",attributes:{class:p,"data-type-role":p},components:"×",droppable:!1,draggable:!1,styles:`
|
|
34
|
+
.${p} {
|
|
35
35
|
position: absolute;
|
|
36
36
|
top: 10px;
|
|
37
37
|
right: 10px;
|
|
@@ -42,18 +42,18 @@
|
|
|
42
42
|
font-size: 20px;
|
|
43
43
|
cursor: pointer;
|
|
44
44
|
}
|
|
45
|
-
`}}}),
|
|
46
|
-
.${
|
|
45
|
+
`}}}),o.addType(c,{model:{defaults:{tagName:"h2",attributes:{class:c,"data-type-role":c},components:"Dialog Title",editable:!0,droppable:!1,draggable:!1,styles:`
|
|
46
|
+
.${c} {
|
|
47
47
|
margin: 0;
|
|
48
48
|
padding: 0 40px 20px 0;
|
|
49
49
|
}
|
|
50
|
-
`}}}),
|
|
51
|
-
.${
|
|
50
|
+
`}}}),o.addType(g,{model:{defaults:{tagName:"div",attributes:{class:g,"data-type-role":g},components:[{type:t}],styles:`
|
|
51
|
+
.${g} {
|
|
52
52
|
height: 90%;
|
|
53
53
|
overflow: auto;
|
|
54
54
|
}
|
|
55
|
-
`}}}),
|
|
56
|
-
.${
|
|
55
|
+
`}}}),o.addType(t,{model:{defaults:{tagName:"p",attributes:{class:t,"data-type-role":t},components:"This is a customizable dialog!",editable:!0,styles:`
|
|
56
|
+
.${t} {
|
|
57
57
|
margin: 0;
|
|
58
58
|
}
|
|
59
|
-
`}}}),
|
|
59
|
+
`}}}),o.addType(m,{model:{toHTML(){return""},defaults:{tagName:"button",attributes:{class:m,"data-type-role":m},components:"Dialog (click me to open)",droppable:!1,draggable:!1}},view:{init(){const{em:s,el:e}=this,v="core:preview",b=s.Commands.events;this.listenTo(s,`${b.runCommand}${v}`,()=>{e.style.display="none"}),this.listenTo(s,`${b.stopCommand}${v}`,()=>{e.style.display=""})}}}),X({editor:n,licenseKey:a,plan:W.startup,pluginName:B,cleanup:()=>{r.remove(i),o.removeType(i)}})},H=U(z);module.exports=H;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const
|
|
1
|
+
const x = "app.grapesjs.com", S = "app-stage.grapesjs.com", C = "app2.grapesjs.com", _ = "app-stage2.grapesjs.com", T = [
|
|
2
|
+
x,
|
|
2
3
|
C,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
j,
|
|
4
|
+
S,
|
|
5
|
+
_,
|
|
6
6
|
"localhost",
|
|
7
7
|
"127.0.0.1",
|
|
8
8
|
".local-credentialless.webcontainer.io",
|
|
@@ -11,97 +11,102 @@ const C = "app.grapesjs.com", O = "app-stage.grapesjs.com", k = "app2.grapesjs.c
|
|
|
11
11
|
// For stackblitz.com demos
|
|
12
12
|
"-sandpack.codesandbox.io"
|
|
13
13
|
// For Sandpack demos
|
|
14
|
-
],
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
], $ = "license:check:start", N = "license:check:end", k = () => typeof window < "u", D = ({
|
|
15
|
+
isDev: n,
|
|
16
|
+
isStage: l,
|
|
17
|
+
isPlatform: r
|
|
18
|
+
}) => `${n ? "" : `https://${l ? S : x}`}/${r ? "platform-api" : "api"}`, A = () => {
|
|
19
|
+
const n = k() && window.location.hostname;
|
|
20
|
+
return !!n && (T.includes(n) || T.some((l) => n.endsWith(l)));
|
|
17
21
|
};
|
|
18
22
|
async function I({
|
|
19
23
|
path: n,
|
|
20
|
-
baseApiUrl:
|
|
21
|
-
method:
|
|
22
|
-
headers:
|
|
23
|
-
params:
|
|
24
|
-
body:
|
|
24
|
+
baseApiUrl: l,
|
|
25
|
+
method: r = "GET",
|
|
26
|
+
headers: o = {},
|
|
27
|
+
params: a,
|
|
28
|
+
body: i
|
|
25
29
|
}) {
|
|
26
|
-
const
|
|
27
|
-
method:
|
|
30
|
+
const d = `${l || D({ isDev: !1, isStage: !1 })}${n}`, p = {
|
|
31
|
+
method: r,
|
|
28
32
|
headers: {
|
|
29
33
|
"Content-Type": "application/json",
|
|
30
|
-
...
|
|
34
|
+
...o
|
|
31
35
|
}
|
|
32
36
|
};
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
if (!
|
|
36
|
-
throw new Error(`HTTP error! status: ${
|
|
37
|
-
return
|
|
37
|
+
i && (p.body = JSON.stringify(i));
|
|
38
|
+
const c = a ? new URLSearchParams(a).toString() : "", g = c ? `?${c}` : "", t = await fetch(`${d}${g}`, p);
|
|
39
|
+
if (!t.ok)
|
|
40
|
+
throw new Error(`HTTP error! status: ${t.status}`);
|
|
41
|
+
return t.json();
|
|
38
42
|
}
|
|
39
43
|
var W = /* @__PURE__ */ ((n) => (n.free = "free", n.startup = "startup", n.business = "business", n.enterprise = "enterprise", n))(W || {});
|
|
40
|
-
const
|
|
44
|
+
const O = {
|
|
41
45
|
[W.free]: 0,
|
|
42
46
|
[W.startup]: 10,
|
|
43
47
|
[W.business]: 20,
|
|
44
48
|
[W.enterprise]: 30
|
|
45
49
|
};
|
|
46
50
|
function q(n) {
|
|
47
|
-
const
|
|
48
|
-
return
|
|
51
|
+
const l = n;
|
|
52
|
+
return l.init = (r) => (o) => n(o, r), l;
|
|
49
53
|
}
|
|
50
54
|
const U = (n) => /* @__PURE__ */ q(n);
|
|
51
55
|
async function X({
|
|
52
56
|
editor: n,
|
|
53
|
-
plan:
|
|
54
|
-
pluginName:
|
|
55
|
-
licenseKey:
|
|
56
|
-
|
|
57
|
+
plan: l,
|
|
58
|
+
pluginName: r,
|
|
59
|
+
licenseKey: o,
|
|
60
|
+
onLicenseCheckResponse: a,
|
|
61
|
+
cleanup: i
|
|
57
62
|
}) {
|
|
58
|
-
let
|
|
59
|
-
const
|
|
60
|
-
console.warn("Cleanup plugin:",
|
|
61
|
-
},
|
|
62
|
-
var
|
|
63
|
-
const { error:
|
|
64
|
-
if (!(
|
|
65
|
-
|
|
66
|
-
else if (
|
|
67
|
-
const
|
|
68
|
-
|
|
63
|
+
let u = "", d = !1;
|
|
64
|
+
const p = A(), c = (t) => {
|
|
65
|
+
console.warn("Cleanup plugin:", r, "Reason:", t), i();
|
|
66
|
+
}, g = (t = {}) => {
|
|
67
|
+
var v;
|
|
68
|
+
const { error: m, sdkLicense: P } = t, s = (v = t.plan) == null ? void 0 : v.category;
|
|
69
|
+
if (!(P || t.license) || m)
|
|
70
|
+
c(m || "Invalid license");
|
|
71
|
+
else if (s) {
|
|
72
|
+
const b = O[l], w = O[s];
|
|
73
|
+
b > w && c({ pluginRequiredPlan: l, licensePlan: s });
|
|
69
74
|
}
|
|
70
75
|
};
|
|
71
|
-
n.on(
|
|
72
|
-
|
|
73
|
-
}), n.on(
|
|
74
|
-
|
|
76
|
+
n.on($, (t) => {
|
|
77
|
+
u = t == null ? void 0 : t.baseApiUrl, d = !0;
|
|
78
|
+
}), n.on(N, (t) => {
|
|
79
|
+
a == null || a(t), g(t);
|
|
75
80
|
}), setTimeout(async () => {
|
|
76
|
-
if (!
|
|
77
|
-
if (
|
|
78
|
-
if (
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
+
if (!d) {
|
|
82
|
+
if (p) return;
|
|
83
|
+
if (o) {
|
|
84
|
+
const t = await M({ licenseKey: o, pluginName: r, baseApiUrl: u });
|
|
85
|
+
a == null || a(t), t && g(t);
|
|
81
86
|
} else
|
|
82
|
-
|
|
87
|
+
c("The `licenseKey` option not provided");
|
|
83
88
|
}
|
|
84
89
|
}, 2e3);
|
|
85
90
|
}
|
|
86
91
|
async function M(n) {
|
|
87
|
-
const { licenseKey:
|
|
92
|
+
const { licenseKey: l, pluginName: r, baseApiUrl: o } = n;
|
|
88
93
|
try {
|
|
89
94
|
return (await I({
|
|
90
|
-
baseApiUrl:
|
|
91
|
-
path: `/sdk/${
|
|
95
|
+
baseApiUrl: o,
|
|
96
|
+
path: `/sdk/${l || "na"}`,
|
|
92
97
|
method: "POST",
|
|
93
98
|
params: {
|
|
94
99
|
d: window.location.hostname,
|
|
95
|
-
pn:
|
|
100
|
+
pn: r
|
|
96
101
|
}
|
|
97
102
|
})).result || {};
|
|
98
|
-
} catch (
|
|
99
|
-
return console.error("Error during SDK license check:",
|
|
103
|
+
} catch (a) {
|
|
104
|
+
return console.error("Error during SDK license check:", a), !1;
|
|
100
105
|
}
|
|
101
106
|
}
|
|
102
|
-
const
|
|
103
|
-
const { Blocks:
|
|
104
|
-
|
|
107
|
+
const L = (...n) => n.map((l) => `[data-gjs-type="${l}"]`).join(","), B = "dialogComponent", z = function(n, l = {}) {
|
|
108
|
+
const { Blocks: r, Components: o } = n, { licenseKey: a } = l, i = "gjs-plg-dialog", u = "gjs-plg-dialog-overlay", d = "gjs-plg-dialog-content", p = "gjs-plg-dialog-close", c = "gjs-plg-dialog-title", g = "gjs-plg-dialog-body", t = "gjs-plg-dialog-description", m = "gjs-plg-dialog-placeholder";
|
|
109
|
+
r.add(i, {
|
|
105
110
|
label: "Dialog",
|
|
106
111
|
media: `
|
|
107
112
|
<svg viewBox="0 0 24 24">
|
|
@@ -109,19 +114,19 @@ const T = (...n) => n.map((s) => `[data-gjs-type="${s}"]`).join(","), B = "dialo
|
|
|
109
114
|
</svg>
|
|
110
115
|
`,
|
|
111
116
|
category: "Extra",
|
|
112
|
-
content: { type:
|
|
117
|
+
content: { type: i },
|
|
113
118
|
activate: !0,
|
|
114
|
-
...
|
|
115
|
-
}),
|
|
119
|
+
...l.block
|
|
120
|
+
}), o.addType(i, {
|
|
116
121
|
model: {
|
|
117
122
|
defaults: {
|
|
118
123
|
tagName: "div",
|
|
119
|
-
attributes: { class:
|
|
120
|
-
components: [{ type:
|
|
121
|
-
draggable:
|
|
122
|
-
droppable:
|
|
124
|
+
attributes: { class: i, "data-type-role": i },
|
|
125
|
+
components: [{ type: u }, { type: m }],
|
|
126
|
+
draggable: L("wrapper"),
|
|
127
|
+
droppable: L(i),
|
|
123
128
|
styles: `
|
|
124
|
-
.${
|
|
129
|
+
.${i} {
|
|
125
130
|
position: relative;
|
|
126
131
|
z-index: 1;
|
|
127
132
|
}
|
|
@@ -132,9 +137,9 @@ const T = (...n) => n.map((s) => `[data-gjs-type="${s}"]`).join(","), B = "dialo
|
|
|
132
137
|
label: "Open dialog",
|
|
133
138
|
name: "onActive",
|
|
134
139
|
changeProp: !0,
|
|
135
|
-
command(
|
|
140
|
+
command(s) {
|
|
136
141
|
var e;
|
|
137
|
-
(e =
|
|
142
|
+
(e = s.getSelected()) == null || e.trigger("active");
|
|
138
143
|
}
|
|
139
144
|
},
|
|
140
145
|
{
|
|
@@ -172,38 +177,38 @@ const T = (...n) => n.map((s) => `[data-gjs-type="${s}"]`).join(","), B = "dialo
|
|
|
172
177
|
"openWhenLeavingWindow",
|
|
173
178
|
"openWhenScrollingToLevel"
|
|
174
179
|
],
|
|
175
|
-
script: function(
|
|
180
|
+
script: function(s) {
|
|
176
181
|
const e = this;
|
|
177
|
-
function
|
|
178
|
-
const
|
|
182
|
+
function v(h) {
|
|
183
|
+
const f = e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]'), y = e.querySelector('[data-type-role="gjs-plg-dialog-close"]');
|
|
179
184
|
function E() {
|
|
180
|
-
|
|
185
|
+
f.style.display = "none";
|
|
181
186
|
}
|
|
182
187
|
h ? (e._onCloseWhenPressingX = E, y.addEventListener("click", e._onCloseWhenPressingX)) : (y.removeEventListener("click", e._onCloseWhenPressingX), e._onCloseWhenPressingX = null);
|
|
183
188
|
}
|
|
184
189
|
function b(h) {
|
|
185
|
-
const
|
|
190
|
+
const f = e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');
|
|
186
191
|
function y(E) {
|
|
187
|
-
E.key === "Escape" && (
|
|
192
|
+
E.key === "Escape" && (f.style.display = "none");
|
|
188
193
|
}
|
|
189
194
|
h ? (e._onCloseWhenPressingEsc = y, e.addEventListener("keydown", e._onCloseWhenPressingEsc)) : (e.removeEventListener("keydown", e._onCloseWhenPressingEsc), e._onCloseWhenPressingEsc = null);
|
|
190
195
|
}
|
|
191
|
-
function
|
|
192
|
-
const
|
|
196
|
+
function w(h) {
|
|
197
|
+
const f = e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');
|
|
193
198
|
function y() {
|
|
194
|
-
|
|
199
|
+
f.style.display = "flex";
|
|
195
200
|
}
|
|
196
201
|
h ? (e._onOpenWhenLeavingWindow = y, document.addEventListener("mouseleave", e._onOpenWhenLeavingWindow)) : (document.removeEventListener("mouseleave", e._onOpenWhenLeavingWindow), e._onOpenWhenLeavingWindow = null);
|
|
197
202
|
}
|
|
198
|
-
function
|
|
199
|
-
const
|
|
203
|
+
function j(h) {
|
|
204
|
+
const f = e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');
|
|
200
205
|
function y() {
|
|
201
206
|
const E = document.documentElement.scrollTop;
|
|
202
|
-
h && E >= Number(h) && (
|
|
207
|
+
h && E >= Number(h) && (f.style.display = "flex");
|
|
203
208
|
}
|
|
204
209
|
h ? (e._onOpenWhenScrollingToLevel = y, document.addEventListener("scroll", e._onOpenWhenScrollingToLevel)) : (document.removeEventListener("scroll", e._onOpenWhenScrollingToLevel), e._onOpenWhenScrollingToLevel = null);
|
|
205
210
|
}
|
|
206
|
-
|
|
211
|
+
v(s.closeWhenPressingX), b(s.closeWhenPressingEsc), w(s.openWhenLeavingWindow), j(s.openWhenScrollingToLevel);
|
|
207
212
|
}
|
|
208
213
|
},
|
|
209
214
|
init() {
|
|
@@ -222,20 +227,20 @@ const T = (...n) => n.map((s) => `[data-gjs-type="${s}"]`).join(","), B = "dialo
|
|
|
222
227
|
},
|
|
223
228
|
view: {
|
|
224
229
|
onActive() {
|
|
225
|
-
const
|
|
226
|
-
|
|
230
|
+
const s = this.el.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');
|
|
231
|
+
s.style.display = "flex";
|
|
227
232
|
}
|
|
228
233
|
}
|
|
229
|
-
}),
|
|
234
|
+
}), o.addType(u, {
|
|
230
235
|
model: {
|
|
231
236
|
defaults: {
|
|
232
237
|
tagName: "div",
|
|
233
|
-
attributes: { class:
|
|
234
|
-
components: { type:
|
|
238
|
+
attributes: { class: u, "data-type-role": u },
|
|
239
|
+
components: { type: d },
|
|
235
240
|
droppable: !1,
|
|
236
241
|
draggable: !1,
|
|
237
242
|
styles: `
|
|
238
|
-
.${
|
|
243
|
+
.${u} {
|
|
239
244
|
position: fixed;
|
|
240
245
|
top: 0;
|
|
241
246
|
left: 0;
|
|
@@ -249,16 +254,16 @@ const T = (...n) => n.map((s) => `[data-gjs-type="${s}"]`).join(","), B = "dialo
|
|
|
249
254
|
`
|
|
250
255
|
}
|
|
251
256
|
}
|
|
252
|
-
}),
|
|
257
|
+
}), o.addType(d, {
|
|
253
258
|
model: {
|
|
254
259
|
defaults: {
|
|
255
260
|
tagName: "div",
|
|
256
|
-
attributes: { class:
|
|
257
|
-
components: [{ type:
|
|
261
|
+
attributes: { class: d, "data-type-role": d },
|
|
262
|
+
components: [{ type: p }, { type: c }, { type: g }],
|
|
258
263
|
droppable: !1,
|
|
259
264
|
draggable: !1,
|
|
260
265
|
styles: `
|
|
261
|
-
.${
|
|
266
|
+
.${d} {
|
|
262
267
|
position: relative;
|
|
263
268
|
background-color: #fff;
|
|
264
269
|
border-radius: 10px;
|
|
@@ -271,16 +276,16 @@ const T = (...n) => n.map((s) => `[data-gjs-type="${s}"]`).join(","), B = "dialo
|
|
|
271
276
|
`
|
|
272
277
|
}
|
|
273
278
|
}
|
|
274
|
-
}),
|
|
279
|
+
}), o.addType(p, {
|
|
275
280
|
model: {
|
|
276
281
|
defaults: {
|
|
277
282
|
tagName: "button",
|
|
278
|
-
attributes: { class:
|
|
283
|
+
attributes: { class: p, "data-type-role": p },
|
|
279
284
|
components: "×",
|
|
280
285
|
droppable: !1,
|
|
281
286
|
draggable: !1,
|
|
282
287
|
styles: `
|
|
283
|
-
.${
|
|
288
|
+
.${p} {
|
|
284
289
|
position: absolute;
|
|
285
290
|
top: 10px;
|
|
286
291
|
right: 10px;
|
|
@@ -294,59 +299,59 @@ const T = (...n) => n.map((s) => `[data-gjs-type="${s}"]`).join(","), B = "dialo
|
|
|
294
299
|
`
|
|
295
300
|
}
|
|
296
301
|
}
|
|
297
|
-
}),
|
|
302
|
+
}), o.addType(c, {
|
|
298
303
|
model: {
|
|
299
304
|
defaults: {
|
|
300
305
|
tagName: "h2",
|
|
301
|
-
attributes: { class:
|
|
306
|
+
attributes: { class: c, "data-type-role": c },
|
|
302
307
|
components: "Dialog Title",
|
|
303
308
|
editable: !0,
|
|
304
309
|
droppable: !1,
|
|
305
310
|
draggable: !1,
|
|
306
311
|
styles: `
|
|
307
|
-
.${
|
|
312
|
+
.${c} {
|
|
308
313
|
margin: 0;
|
|
309
314
|
padding: 0 40px 20px 0;
|
|
310
315
|
}
|
|
311
316
|
`
|
|
312
317
|
}
|
|
313
318
|
}
|
|
314
|
-
}),
|
|
319
|
+
}), o.addType(g, {
|
|
315
320
|
model: {
|
|
316
321
|
defaults: {
|
|
317
322
|
tagName: "div",
|
|
318
|
-
attributes: { class:
|
|
319
|
-
components: [{ type:
|
|
323
|
+
attributes: { class: g, "data-type-role": g },
|
|
324
|
+
components: [{ type: t }],
|
|
320
325
|
styles: `
|
|
321
|
-
.${
|
|
326
|
+
.${g} {
|
|
322
327
|
height: 90%;
|
|
323
328
|
overflow: auto;
|
|
324
329
|
}
|
|
325
330
|
`
|
|
326
331
|
}
|
|
327
332
|
}
|
|
328
|
-
}),
|
|
333
|
+
}), o.addType(t, {
|
|
329
334
|
model: {
|
|
330
335
|
defaults: {
|
|
331
336
|
tagName: "p",
|
|
332
|
-
attributes: { class:
|
|
337
|
+
attributes: { class: t, "data-type-role": t },
|
|
333
338
|
components: "This is a customizable dialog!",
|
|
334
339
|
editable: !0,
|
|
335
340
|
styles: `
|
|
336
|
-
.${
|
|
341
|
+
.${t} {
|
|
337
342
|
margin: 0;
|
|
338
343
|
}
|
|
339
344
|
`
|
|
340
345
|
}
|
|
341
346
|
}
|
|
342
|
-
}),
|
|
347
|
+
}), o.addType(m, {
|
|
343
348
|
model: {
|
|
344
349
|
toHTML() {
|
|
345
350
|
return "";
|
|
346
351
|
},
|
|
347
352
|
defaults: {
|
|
348
353
|
tagName: "button",
|
|
349
|
-
attributes: { class:
|
|
354
|
+
attributes: { class: m, "data-type-role": m },
|
|
350
355
|
components: "Dialog (click me to open)",
|
|
351
356
|
droppable: !1,
|
|
352
357
|
draggable: !1
|
|
@@ -354,24 +359,24 @@ const T = (...n) => n.map((s) => `[data-gjs-type="${s}"]`).join(","), B = "dialo
|
|
|
354
359
|
},
|
|
355
360
|
view: {
|
|
356
361
|
init() {
|
|
357
|
-
const { em:
|
|
358
|
-
this.listenTo(
|
|
362
|
+
const { em: s, el: e } = this, v = "core:preview", b = s.Commands.events;
|
|
363
|
+
this.listenTo(s, `${b.runCommand}${v}`, () => {
|
|
359
364
|
e.style.display = "none";
|
|
360
|
-
}), this.listenTo(
|
|
365
|
+
}), this.listenTo(s, `${b.stopCommand}${v}`, () => {
|
|
361
366
|
e.style.display = "";
|
|
362
367
|
});
|
|
363
368
|
}
|
|
364
369
|
}
|
|
365
370
|
}), X({
|
|
366
371
|
editor: n,
|
|
367
|
-
licenseKey:
|
|
372
|
+
licenseKey: a,
|
|
368
373
|
plan: W.startup,
|
|
369
374
|
pluginName: B,
|
|
370
375
|
cleanup: () => {
|
|
371
|
-
|
|
376
|
+
r.remove(i), o.removeType(i);
|
|
372
377
|
}
|
|
373
378
|
});
|
|
374
|
-
},
|
|
379
|
+
}, H = U(z);
|
|
375
380
|
export {
|
|
376
|
-
|
|
381
|
+
H as default
|
|
377
382
|
};
|