@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,4 +1,4 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const O="app.grapesjs.com",S="app-stage.grapesjs.com",L="app2.grapesjs.com",P="app-stage2.grapesjs.com",M=[O,L,S,P,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],B="license:check:start",D="license:check:end",G=()=>typeof window<"u",V=({isDev:t,isStage:e,isPlatform:o})=>`${t?"":`https://${e?S:O}`}/${o?"platform-api":"api"}`,U=()=>{const t=G()&&window.location.hostname;return!!t&&(M.includes(t)||M.some(e=>t.endsWith(e)))};async function j({path:t,baseApiUrl:e,method:o="GET",headers:c={},params:s,body:l}){const p=`${e||V({isDev:!1,isStage:!1})}${t}`,a={method:o,headers:{"Content-Type":"application/json",...c}};l&&(a.body=JSON.stringify(l));const r=s?new URLSearchParams(s).toString():"",m=r?`?${r}`:"",n=await fetch(`${p}${m}`,a);if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return n.json()}var f=(t=>(t.free="free",t.startup="startup",t.business="business",t.enterprise="enterprise",t))(f||{});const k={[f.free]:0,[f.startup]:10,[f.business]:20,[f.enterprise]:30};function K(t){const e=t;return e.init=o=>c=>t(c,o),e}const W=t=>K(t);async function F({editor:t,plan:e,pluginName:o,licenseKey:c,onLicenseCheckResponse:s,cleanup:l}){let d="",p=!1;const a=U(),r=n=>{console.warn("Cleanup plugin:",o,"Reason:",n),l()},m=(n={})=>{var E;const{error:y,sdkLicense:T}=n,w=(E=n.plan)==null?void 0:E.category;if(!(T||n.license)||y)r(y||"Invalid license");else if(w){const _=k[e],z=k[w];_>z&&r({pluginRequiredPlan:e,licensePlan:w})}};t.on(B,n=>{d=n==null?void 0:n.baseApiUrl,p=!0}),t.on(D,n=>{s==null||s(n),m(n)}),setTimeout(async()=>{if(!p){if(a)return;if(c){const n=await Y({licenseKey:c,pluginName:o,baseApiUrl:d});s==null||s(n),n&&m(n)}else r("The `licenseKey` option not provided")}},2e3)}async function Y(t){const{licenseKey:e,pluginName:o,baseApiUrl:c}=t;try{return(await j({baseApiUrl:c,path:`/sdk/${e||"na"}`,method:"POST",params:{d:window.location.hostname,pn:o}})).result||{}}catch(s){return console.error("Error during SDK license check:",s),!1}}const A=t=>e=>{var o;return((o=e.getAttribute)==null?void 0:o.call(e,b))===t},H=(...t)=>e=>t.some(o=>e.is(o)),Z=(...t)=>(e,o)=>t.some(c=>o.is(c)),$="gjs-plg-",b="data-type-role",i="accordion",q=`${i}-group`,u=`${i}-header`,g=`${i}-content`,h=`${i}-marker`,x=`${$}${u}`,C=`${$}${h}`,J=`${$}${g}`,I=`${C}-open`,v={accordion:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M5.616 20q-.691 0-1.153-.462T4 18.384V5.616q0-.691.463-1.153T5.616 4h12.769q.69 0 1.153.463T20 5.616v12.769q0 .69-.462 1.153T18.384 20zm0-1h12.769q.23 0 .423-.192t.192-.424V8.154H5v10.23q0 .232.192.424t.423.192"/></svg>',accordionGroup:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M8.116 16h10.769q.23 0 .423-.192t.192-.423V6h-12v9.385q0 .23.192.423t.423.192m0 1q-.69 0-1.153-.462T6.5 15.385V4.615q0-.69.463-1.153T8.116 3h10.769q.69 0 1.153.462t.462 1.153v10.77q0 .69-.462 1.152T18.884 17zm-3 3q-.69 0-1.153-.462T3.5 18.385V6.615h1v11.77q0 .23.192.423t.423.192h11.77v1zM7.5 4v12z"/></svg>',accordionHeader:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M5.616 20q-.691 0-1.153-.462T4 18.384V5.616q0-.691.463-1.153T5.616 4h12.769q.69 0 1.153.463T20 5.616v12.769q0 .69-.462 1.153T18.384 20zm0-1h12.769q.23 0 .423-.192t.192-.424V5.616q0-.231-.192-.424T18.384 5H5.616q-.231 0-.424.192T5 5.616v12.769q0 .23.192.423t.423.192M5 5v14zm2.616 4.192h6q.413 0 .706-.293q.294-.293.294-.707t-.294-.706q-.293-.294-.706-.294h-6q-.414 0-.707.294t-.293.706t.293.707t.707.293"/></svg>',accordionContent:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M4.616 19q-.691 0-1.153-.462T3 17.384V6.616q0-.691.463-1.153T4.615 5h14.77q.69 0 1.152.463T21 6.616v10.769q0 .69-.463 1.153T19.385 19zm0-1h14.769q.23 0 .423-.192t.192-.424V6.616q0-.231-.192-.424T19.385 6H4.615q-.23 0-.423.192T4 6.616v10.769q0 .23.192.423t.423.192M4 18V6zm2.23-2.116h11.54q.213 0 .356-.143t.143-.357t-.143-.356t-.357-.144H6.231q-.214 0-.357.144q-.143.143-.143.357q0 .213.143.356t.357.144m0-3.385h11.538q.214 0 .357-.143t.143-.357t-.143-.357t-.357-.143H6.231q-.214 0-.357.143T5.731 12t.143.357t.357.143m0-3.384H14q.214 0 .357-.144q.143-.143.143-.356q0-.214-.143-.357T14 8.116H6.23q-.213 0-.356.143t-.143.357t.143.356t.357.144"/></svg>',accordionMarker:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="m12 15.596l3.173-3.192H8.827zM5.616 20q-.672 0-1.144-.472T4 18.385V5.615q0-.67.472-1.143Q4.944 4 5.616 4h12.769q.67 0 1.143.472q.472.472.472 1.144v12.769q0 .67-.472 1.143q-.472.472-1.143.472zM5 9v9.385q0 .23.192.423t.423.192h12.77q.23 0 .423-.192t.192-.423V9z"/></svg>',caret:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m7.4 8.6 4.6 4.6 4.6-4.6L18 10l-6 6-6-6 1.4-1.4Z"/></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>'},N=(t,e)=>{const{toolbarIconOpen:o=v.eye}=e,c=t.is(i)?t:t.closestType(i);if(!o||!c)return;const{toolbar:s}=t,l={id:"accordion-toggle-open",label:o,command:()=>c.toggleOpen()};!s.find(p=>p.id===l.id)&&(s==null||s.unshift(l))},Q=(t,e)=>{const{Components:o,Blocks:c}=t,{block:s={}}=e,l="Accordion",d=`${$}${i}`,p=function(a={}){const r=this,m=()=>{const{clsMarkerOpen:n}=a,y=r.querySelector('[data-type-role="accordion-marker"]');!y||!n||(r.open?y.classList.add(n):y.classList.remove(n))};r.addEventListener("toggle",()=>{m(),r.dispatchEvent(new CustomEvent("details-toggle",{bubbles:!0}))}),m()};return o.addType(i,{block:s&&{label:l,media:v.accordion,category:"Extra",select:!0,...s},isComponent:A(i),extendFn:["initToolbar"],model:{defaults:{tagName:"details",name:l,classes:d,emptyState:!0,clsMarkerOpen:I,attributes:{[b]:i},droppable:H(u,g),components:[{type:u},{type:g}],"script-props":["clsMarkerOpen"],script:p,traits:[{type:"checkbox",name:"open",label:"Open"}],styles:`
|
|
2
2
|
.${d}::details-content {
|
|
3
3
|
opacity: 0;
|
|
4
4
|
block-size: 0;
|
|
@@ -15,25 +15,25 @@
|
|
|
15
15
|
transform: translateY(0);
|
|
16
16
|
block-size: auto;
|
|
17
17
|
}
|
|
18
|
-
`},toggleOpen(){this.addAttributes({open:!this.getAttributes().open})},initToolbar(){
|
|
18
|
+
`},toggleOpen(){this.addAttributes({open:!this.getAttributes().open})},initToolbar(){N(this,e)}}}),()=>{c.remove(i),o.removeType(i)}},X=t=>{const{Components:e}=t;return e.addType(g,{isComponent:A(g),model:{defaults:{name:"Accordion Content",removable:!1,copyable:!1,draggable:!1,emptyState:!0,classes:J,icon:v.accordionContent,attributes:{[b]:g},components:"<div>Accordion content</div>"}}}),()=>{e.removeType(g)}},R=(t,e)=>{const{Components:o,Blocks:c}=t,{blockGroup:s={}}=e,l="Accordion Group",d=function(a={}){if(!a.single)return;const r=this;r.addEventListener("details-toggle",m=>{const n=m.target;if(!a.single||!n||!n.open)return;r.querySelectorAll('[data-type-role="accordion"]').forEach(T=>{n!==T&&T.open&&(T.open=!1)})})},p=(a={})=>({type:i,attributes:{open:a.open},components:[{type:u,components:[`<div>${a.header}</div>`,{type:h}]},{type:g,components:`<div>${a.content}</div>`}]});return o.addType(q,{block:s&&{label:l,media:v.accordionGroup,category:"Extra",select:!0,...s},isComponent:A(q),model:{defaults:{name:l,attributes:{[b]:q},droppable:H(i),single:!0,emptyState:!0,components:Array(3).fill(0).map((a,r)=>p({open:r===0,header:`Accordion header ${r+1}`,content:`Accordion content ${r+1}`})),traits:[{type:"checkbox",name:"single",changeProp:!0,tip:"Only one accordion can be open at a time",label:"Single open"}],"script-props":["single"],script:d}}}),()=>{c.remove(q),o.removeType(q)}},tt=(t,e)=>{const{Components:o}=t;return o.addType(u,{isComponent:A(u),extendFn:["initToolbar"],model:{defaults:{tagName:"summary",name:"Accordion Header",removable:!1,copyable:!1,draggable:!1,emptyState:!0,icon:v.accordionHeader,classes:x,attributes:{[b]:u},components:["<div>Accordion header</div>",{type:h}],styles:`
|
|
19
19
|
summary {
|
|
20
20
|
list-style: none;
|
|
21
21
|
}
|
|
22
|
-
.${
|
|
22
|
+
.${x} {
|
|
23
23
|
cursor: pointer;
|
|
24
24
|
display: flex;
|
|
25
25
|
align-items: center;
|
|
26
26
|
justify-content: space-between;
|
|
27
27
|
gap: 1rem;
|
|
28
28
|
}
|
|
29
|
-
`},initToolbar(){
|
|
30
|
-
.${
|
|
29
|
+
`},initToolbar(){N(this,e)}}}),()=>{o.removeType(u)}},et=t=>{const{Components:e}=t;return e.addType(h,{extend:"icon",isComponent:A(h),model:{defaults:{name:"Accordion Marker",icon:v.accordionMarker,classes:C,attributes:{[b]:h},components:v.caret,droppable:!1,draggable:Z(u),styles:`
|
|
30
|
+
.${C} {
|
|
31
31
|
min-width: 24px;
|
|
32
32
|
width: 24px;
|
|
33
33
|
height: 24px;
|
|
34
34
|
transition: transform 0.2s ease-in-out;
|
|
35
35
|
}
|
|
36
|
-
.${
|
|
36
|
+
.${I} {
|
|
37
37
|
transform: rotateZ(180deg);
|
|
38
38
|
}
|
|
39
|
-
`}}}),()=>{
|
|
39
|
+
`}}}),()=>{e.removeType(h)}},ot="accordionComponent",nt=f.startup,st=function(t,e={}){const o=[Q(t,e),R(t,e),tt(t,e),et(t),X(t)];F({editor:t,licenseKey:e.licenseKey,plan:nt,pluginName:ot,cleanup:()=>{o.forEach(c=>c())}})},ct=W(st);module.exports=ct;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
z,
|
|
1
|
+
const O = "app.grapesjs.com", S = "app-stage.grapesjs.com", L = "app2.grapesjs.com", P = "app-stage2.grapesjs.com", M = [
|
|
2
|
+
O,
|
|
4
3
|
L,
|
|
4
|
+
S,
|
|
5
5
|
P,
|
|
6
6
|
"localhost",
|
|
7
7
|
"127.0.0.1",
|
|
@@ -11,98 +11,103 @@ const x = "app.grapesjs.com", L = "app-stage.grapesjs.com", z = "app2.grapesjs.c
|
|
|
11
11
|
// For stackblitz.com demos
|
|
12
12
|
"-sandpack.codesandbox.io"
|
|
13
13
|
// For Sandpack demos
|
|
14
|
-
], B = "license:check:start", D = "license:check:end", G = () => typeof window < "u", V = ({
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
], B = "license:check:start", D = "license:check:end", G = () => typeof window < "u", V = ({
|
|
15
|
+
isDev: t,
|
|
16
|
+
isStage: e,
|
|
17
|
+
isPlatform: o
|
|
18
|
+
}) => `${t ? "" : `https://${e ? S : O}`}/${o ? "platform-api" : "api"}`, U = () => {
|
|
19
|
+
const t = G() && window.location.hostname;
|
|
20
|
+
return !!t && (M.includes(t) || M.some((e) => t.endsWith(e)));
|
|
17
21
|
};
|
|
18
22
|
async function j({
|
|
19
|
-
path:
|
|
20
|
-
baseApiUrl:
|
|
21
|
-
method:
|
|
22
|
-
headers:
|
|
23
|
-
params:
|
|
24
|
-
body:
|
|
23
|
+
path: t,
|
|
24
|
+
baseApiUrl: e,
|
|
25
|
+
method: o = "GET",
|
|
26
|
+
headers: c = {},
|
|
27
|
+
params: s,
|
|
28
|
+
body: l
|
|
25
29
|
}) {
|
|
26
|
-
const
|
|
27
|
-
method:
|
|
30
|
+
const p = `${e || V({ isDev: !1, isStage: !1 })}${t}`, a = {
|
|
31
|
+
method: o,
|
|
28
32
|
headers: {
|
|
29
33
|
"Content-Type": "application/json",
|
|
30
|
-
...
|
|
34
|
+
...c
|
|
31
35
|
}
|
|
32
36
|
};
|
|
33
|
-
|
|
34
|
-
const r =
|
|
35
|
-
if (!
|
|
36
|
-
throw new Error(`HTTP error! status: ${
|
|
37
|
-
return
|
|
37
|
+
l && (a.body = JSON.stringify(l));
|
|
38
|
+
const r = s ? new URLSearchParams(s).toString() : "", m = r ? `?${r}` : "", n = await fetch(`${p}${m}`, a);
|
|
39
|
+
if (!n.ok)
|
|
40
|
+
throw new Error(`HTTP error! status: ${n.status}`);
|
|
41
|
+
return n.json();
|
|
38
42
|
}
|
|
39
|
-
var
|
|
40
|
-
const
|
|
41
|
-
[
|
|
42
|
-
[
|
|
43
|
-
[
|
|
44
|
-
[
|
|
43
|
+
var f = /* @__PURE__ */ ((t) => (t.free = "free", t.startup = "startup", t.business = "business", t.enterprise = "enterprise", t))(f || {});
|
|
44
|
+
const k = {
|
|
45
|
+
[f.free]: 0,
|
|
46
|
+
[f.startup]: 10,
|
|
47
|
+
[f.business]: 20,
|
|
48
|
+
[f.enterprise]: 30
|
|
45
49
|
};
|
|
46
|
-
function K(
|
|
47
|
-
const
|
|
48
|
-
return
|
|
50
|
+
function K(t) {
|
|
51
|
+
const e = t;
|
|
52
|
+
return e.init = (o) => (c) => t(c, o), e;
|
|
49
53
|
}
|
|
50
|
-
const
|
|
51
|
-
async function
|
|
52
|
-
editor:
|
|
53
|
-
plan:
|
|
54
|
-
pluginName:
|
|
55
|
-
licenseKey:
|
|
56
|
-
|
|
54
|
+
const W = (t) => /* @__PURE__ */ K(t);
|
|
55
|
+
async function F({
|
|
56
|
+
editor: t,
|
|
57
|
+
plan: e,
|
|
58
|
+
pluginName: o,
|
|
59
|
+
licenseKey: c,
|
|
60
|
+
onLicenseCheckResponse: s,
|
|
61
|
+
cleanup: l
|
|
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 d = "", p = !1;
|
|
64
|
+
const a = U(), r = (n) => {
|
|
65
|
+
console.warn("Cleanup plugin:", o, "Reason:", n), l();
|
|
66
|
+
}, m = (n = {}) => {
|
|
67
|
+
var E;
|
|
68
|
+
const { error: y, sdkLicense: T } = n, w = (E = n.plan) == null ? void 0 : E.category;
|
|
69
|
+
if (!(T || n.license) || y)
|
|
70
|
+
r(y || "Invalid license");
|
|
71
|
+
else if (w) {
|
|
72
|
+
const _ = k[e], z = k[w];
|
|
73
|
+
_ > z && r({ pluginRequiredPlan: e, licensePlan: w });
|
|
69
74
|
}
|
|
70
75
|
};
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}),
|
|
74
|
-
|
|
76
|
+
t.on(B, (n) => {
|
|
77
|
+
d = n == null ? void 0 : n.baseApiUrl, p = !0;
|
|
78
|
+
}), t.on(D, (n) => {
|
|
79
|
+
s == null || s(n), m(n);
|
|
75
80
|
}), setTimeout(async () => {
|
|
76
|
-
if (!
|
|
77
|
-
if (
|
|
78
|
-
if (
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
+
if (!p) {
|
|
82
|
+
if (a) return;
|
|
83
|
+
if (c) {
|
|
84
|
+
const n = await Y({ licenseKey: c, pluginName: o, baseApiUrl: d });
|
|
85
|
+
s == null || s(n), n && m(n);
|
|
81
86
|
} else
|
|
82
|
-
|
|
87
|
+
r("The `licenseKey` option not provided");
|
|
83
88
|
}
|
|
84
89
|
}, 2e3);
|
|
85
90
|
}
|
|
86
|
-
async function
|
|
87
|
-
const { licenseKey:
|
|
91
|
+
async function Y(t) {
|
|
92
|
+
const { licenseKey: e, pluginName: o, baseApiUrl: c } = t;
|
|
88
93
|
try {
|
|
89
94
|
return (await j({
|
|
90
|
-
baseApiUrl:
|
|
91
|
-
path: `/sdk/${
|
|
95
|
+
baseApiUrl: c,
|
|
96
|
+
path: `/sdk/${e || "na"}`,
|
|
92
97
|
method: "POST",
|
|
93
98
|
params: {
|
|
94
99
|
d: window.location.hostname,
|
|
95
|
-
pn:
|
|
100
|
+
pn: o
|
|
96
101
|
}
|
|
97
102
|
})).result || {};
|
|
98
|
-
} catch (
|
|
99
|
-
return console.error("Error during SDK license check:",
|
|
103
|
+
} catch (s) {
|
|
104
|
+
return console.error("Error during SDK license check:", s), !1;
|
|
100
105
|
}
|
|
101
106
|
}
|
|
102
|
-
const A = (
|
|
103
|
-
var
|
|
104
|
-
return ((
|
|
105
|
-
},
|
|
107
|
+
const A = (t) => (e) => {
|
|
108
|
+
var o;
|
|
109
|
+
return ((o = e.getAttribute) == null ? void 0 : o.call(e, b)) === t;
|
|
110
|
+
}, H = (...t) => (e) => t.some((o) => e.is(o)), Z = (...t) => (e, o) => t.some((c) => o.is(c)), $ = "gjs-plg-", b = "data-type-role", i = "accordion", q = `${i}-group`, u = `${i}-header`, g = `${i}-content`, h = `${i}-marker`, x = `${$}${u}`, C = `${$}${h}`, J = `${$}${g}`, I = `${C}-open`, v = {
|
|
106
111
|
accordion: '<svg viewBox="0 0 24 24"><path fill="currentColor" d="M5.616 20q-.691 0-1.153-.462T4 18.384V5.616q0-.691.463-1.153T5.616 4h12.769q.69 0 1.153.463T20 5.616v12.769q0 .69-.462 1.153T18.384 20zm0-1h12.769q.23 0 .423-.192t.192-.424V8.154H5v10.23q0 .232.192.424t.423.192"/></svg>',
|
|
107
112
|
accordionGroup: '<svg viewBox="0 0 24 24"><path fill="currentColor" d="M8.116 16h10.769q.23 0 .423-.192t.192-.423V6h-12v9.385q0 .23.192.423t.423.192m0 1q-.69 0-1.153-.462T6.5 15.385V4.615q0-.69.463-1.153T8.116 3h10.769q.69 0 1.153.462t.462 1.153v10.77q0 .69-.462 1.152T18.884 17zm-3 3q-.69 0-1.153-.462T3.5 18.385V6.615h1v11.77q0 .23.192.423t.423.192h11.77v1zM7.5 4v12z"/></svg>',
|
|
108
113
|
accordionHeader: '<svg viewBox="0 0 24 24"><path fill="currentColor" d="M5.616 20q-.691 0-1.153-.462T4 18.384V5.616q0-.691.463-1.153T5.616 4h12.769q.69 0 1.153.463T20 5.616v12.769q0 .69-.462 1.153T18.384 20zm0-1h12.769q.23 0 .423-.192t.192-.424V5.616q0-.231-.192-.424T18.384 5H5.616q-.231 0-.424.192T5 5.616v12.769q0 .23.192.423t.423.192M5 5v14zm2.616 4.192h6q.413 0 .706-.293q.294-.293.294-.707t-.294-.706q-.293-.294-.706-.294h-6q-.414 0-.707.294t-.293.706t.293.707t.707.293"/></svg>',
|
|
@@ -110,47 +115,47 @@ const A = (e) => (t) => {
|
|
|
110
115
|
accordionMarker: '<svg viewBox="0 0 24 24"><path fill="currentColor" d="m12 15.596l3.173-3.192H8.827zM5.616 20q-.672 0-1.144-.472T4 18.385V5.615q0-.67.472-1.143Q4.944 4 5.616 4h12.769q.67 0 1.143.472q.472.472.472 1.144v12.769q0 .67-.472 1.143q-.472.472-1.143.472zM5 9v9.385q0 .23.192.423t.423.192h12.77q.23 0 .423-.192t.192-.423V9z"/></svg>',
|
|
111
116
|
caret: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m7.4 8.6 4.6 4.6 4.6-4.6L18 10l-6 6-6-6 1.4-1.4Z"/></svg>',
|
|
112
117
|
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>'
|
|
113
|
-
},
|
|
114
|
-
const { toolbarIconOpen:
|
|
115
|
-
if (!
|
|
116
|
-
const { toolbar:
|
|
118
|
+
}, N = (t, e) => {
|
|
119
|
+
const { toolbarIconOpen: o = v.eye } = e, c = t.is(i) ? t : t.closestType(i);
|
|
120
|
+
if (!o || !c) return;
|
|
121
|
+
const { toolbar: s } = t, l = {
|
|
117
122
|
id: "accordion-toggle-open",
|
|
118
|
-
label:
|
|
119
|
-
command: () =>
|
|
123
|
+
label: o,
|
|
124
|
+
command: () => c.toggleOpen()
|
|
120
125
|
};
|
|
121
|
-
!
|
|
122
|
-
},
|
|
123
|
-
const { Components:
|
|
124
|
-
const r = this,
|
|
125
|
-
const { clsMarkerOpen:
|
|
126
|
-
!
|
|
126
|
+
!s.find((p) => p.id === l.id) && (s == null || s.unshift(l));
|
|
127
|
+
}, Q = (t, e) => {
|
|
128
|
+
const { Components: o, Blocks: c } = t, { block: s = {} } = e, l = "Accordion", d = `${$}${i}`, p = function(a = {}) {
|
|
129
|
+
const r = this, m = () => {
|
|
130
|
+
const { clsMarkerOpen: n } = a, y = r.querySelector('[data-type-role="accordion-marker"]');
|
|
131
|
+
!y || !n || (r.open ? y.classList.add(n) : y.classList.remove(n));
|
|
127
132
|
};
|
|
128
133
|
r.addEventListener("toggle", () => {
|
|
129
|
-
|
|
130
|
-
}),
|
|
134
|
+
m(), r.dispatchEvent(new CustomEvent("details-toggle", { bubbles: !0 }));
|
|
135
|
+
}), m();
|
|
131
136
|
};
|
|
132
|
-
return
|
|
133
|
-
block:
|
|
134
|
-
label:
|
|
137
|
+
return o.addType(i, {
|
|
138
|
+
block: s && {
|
|
139
|
+
label: l,
|
|
135
140
|
media: v.accordion,
|
|
136
141
|
category: "Extra",
|
|
137
142
|
select: !0,
|
|
138
|
-
...
|
|
143
|
+
...s
|
|
139
144
|
},
|
|
140
|
-
isComponent: A(
|
|
145
|
+
isComponent: A(i),
|
|
141
146
|
extendFn: ["initToolbar"],
|
|
142
147
|
model: {
|
|
143
148
|
defaults: {
|
|
144
149
|
tagName: "details",
|
|
145
|
-
name:
|
|
150
|
+
name: l,
|
|
146
151
|
classes: d,
|
|
147
152
|
emptyState: !0,
|
|
148
|
-
clsMarkerOpen:
|
|
149
|
-
attributes: { [
|
|
150
|
-
droppable:
|
|
151
|
-
components: [{ type: u }, { type:
|
|
153
|
+
clsMarkerOpen: I,
|
|
154
|
+
attributes: { [b]: i },
|
|
155
|
+
droppable: H(u, g),
|
|
156
|
+
components: [{ type: u }, { type: g }],
|
|
152
157
|
"script-props": ["clsMarkerOpen"],
|
|
153
|
-
script:
|
|
158
|
+
script: p,
|
|
154
159
|
traits: [
|
|
155
160
|
{
|
|
156
161
|
type: "checkbox",
|
|
@@ -181,16 +186,16 @@ const A = (e) => (t) => {
|
|
|
181
186
|
this.addAttributes({ open: !this.getAttributes().open });
|
|
182
187
|
},
|
|
183
188
|
initToolbar() {
|
|
184
|
-
|
|
189
|
+
N(this, e);
|
|
185
190
|
}
|
|
186
191
|
}
|
|
187
192
|
}), () => {
|
|
188
|
-
|
|
193
|
+
c.remove(i), o.removeType(i);
|
|
189
194
|
};
|
|
190
|
-
},
|
|
191
|
-
const { Components:
|
|
192
|
-
return
|
|
193
|
-
isComponent: A(
|
|
195
|
+
}, X = (t) => {
|
|
196
|
+
const { Components: e } = t;
|
|
197
|
+
return e.addType(g, {
|
|
198
|
+
isComponent: A(g),
|
|
194
199
|
model: {
|
|
195
200
|
defaults: {
|
|
196
201
|
name: "Accordion Content",
|
|
@@ -198,58 +203,58 @@ const A = (e) => (t) => {
|
|
|
198
203
|
copyable: !1,
|
|
199
204
|
draggable: !1,
|
|
200
205
|
emptyState: !0,
|
|
201
|
-
classes:
|
|
206
|
+
classes: J,
|
|
202
207
|
icon: v.accordionContent,
|
|
203
|
-
attributes: { [
|
|
208
|
+
attributes: { [b]: g },
|
|
204
209
|
components: "<div>Accordion content</div>"
|
|
205
210
|
}
|
|
206
211
|
}
|
|
207
212
|
}), () => {
|
|
208
|
-
|
|
213
|
+
e.removeType(g);
|
|
209
214
|
};
|
|
210
|
-
},
|
|
211
|
-
const { Components:
|
|
215
|
+
}, R = (t, e) => {
|
|
216
|
+
const { Components: o, Blocks: c } = t, { blockGroup: s = {} } = e, l = "Accordion Group", d = function(a = {}) {
|
|
212
217
|
if (!a.single) return;
|
|
213
218
|
const r = this;
|
|
214
|
-
r.addEventListener("details-toggle", (
|
|
215
|
-
const
|
|
216
|
-
if (!a.single || !
|
|
217
|
-
r.querySelectorAll('[data-type-role="accordion"]').forEach((
|
|
218
|
-
|
|
219
|
+
r.addEventListener("details-toggle", (m) => {
|
|
220
|
+
const n = m.target;
|
|
221
|
+
if (!a.single || !n || !n.open) return;
|
|
222
|
+
r.querySelectorAll('[data-type-role="accordion"]').forEach((T) => {
|
|
223
|
+
n !== T && T.open && (T.open = !1);
|
|
219
224
|
});
|
|
220
225
|
});
|
|
221
|
-
},
|
|
222
|
-
type:
|
|
226
|
+
}, p = (a = {}) => ({
|
|
227
|
+
type: i,
|
|
223
228
|
attributes: { open: a.open },
|
|
224
229
|
components: [
|
|
225
230
|
{
|
|
226
231
|
type: u,
|
|
227
|
-
components: [`<div>${a.header}</div>`, { type:
|
|
232
|
+
components: [`<div>${a.header}</div>`, { type: h }]
|
|
228
233
|
},
|
|
229
234
|
{
|
|
230
|
-
type:
|
|
235
|
+
type: g,
|
|
231
236
|
components: `<div>${a.content}</div>`
|
|
232
237
|
}
|
|
233
238
|
]
|
|
234
239
|
});
|
|
235
|
-
return
|
|
236
|
-
block:
|
|
237
|
-
label:
|
|
240
|
+
return o.addType(q, {
|
|
241
|
+
block: s && {
|
|
242
|
+
label: l,
|
|
238
243
|
media: v.accordionGroup,
|
|
239
244
|
category: "Extra",
|
|
240
245
|
select: !0,
|
|
241
|
-
...
|
|
246
|
+
...s
|
|
242
247
|
},
|
|
243
248
|
isComponent: A(q),
|
|
244
249
|
model: {
|
|
245
250
|
defaults: {
|
|
246
|
-
name:
|
|
247
|
-
attributes: { [
|
|
248
|
-
droppable:
|
|
251
|
+
name: l,
|
|
252
|
+
attributes: { [b]: q },
|
|
253
|
+
droppable: H(i),
|
|
249
254
|
single: !0,
|
|
250
255
|
emptyState: !0,
|
|
251
256
|
components: Array(3).fill(0).map(
|
|
252
|
-
(a, r) =>
|
|
257
|
+
(a, r) => p({
|
|
253
258
|
open: r === 0,
|
|
254
259
|
header: `Accordion header ${r + 1}`,
|
|
255
260
|
content: `Accordion content ${r + 1}`
|
|
@@ -269,11 +274,11 @@ const A = (e) => (t) => {
|
|
|
269
274
|
}
|
|
270
275
|
}
|
|
271
276
|
}), () => {
|
|
272
|
-
|
|
277
|
+
c.remove(q), o.removeType(q);
|
|
273
278
|
};
|
|
274
|
-
},
|
|
275
|
-
const { Components:
|
|
276
|
-
return
|
|
279
|
+
}, tt = (t, e) => {
|
|
280
|
+
const { Components: o } = t;
|
|
281
|
+
return o.addType(u, {
|
|
277
282
|
isComponent: A(u),
|
|
278
283
|
extendFn: ["initToolbar"],
|
|
279
284
|
model: {
|
|
@@ -285,14 +290,14 @@ const A = (e) => (t) => {
|
|
|
285
290
|
draggable: !1,
|
|
286
291
|
emptyState: !0,
|
|
287
292
|
icon: v.accordionHeader,
|
|
288
|
-
classes:
|
|
289
|
-
attributes: { [
|
|
290
|
-
components: ["<div>Accordion header</div>", { type:
|
|
293
|
+
classes: x,
|
|
294
|
+
attributes: { [b]: u },
|
|
295
|
+
components: ["<div>Accordion header</div>", { type: h }],
|
|
291
296
|
styles: `
|
|
292
297
|
summary {
|
|
293
298
|
list-style: none;
|
|
294
299
|
}
|
|
295
|
-
.${
|
|
300
|
+
.${x} {
|
|
296
301
|
cursor: pointer;
|
|
297
302
|
display: flex;
|
|
298
303
|
align-items: center;
|
|
@@ -302,60 +307,60 @@ const A = (e) => (t) => {
|
|
|
302
307
|
`
|
|
303
308
|
},
|
|
304
309
|
initToolbar() {
|
|
305
|
-
|
|
310
|
+
N(this, e);
|
|
306
311
|
}
|
|
307
312
|
}
|
|
308
313
|
}), () => {
|
|
309
|
-
|
|
314
|
+
o.removeType(u);
|
|
310
315
|
};
|
|
311
|
-
},
|
|
312
|
-
const { Components:
|
|
313
|
-
return
|
|
316
|
+
}, et = (t) => {
|
|
317
|
+
const { Components: e } = t;
|
|
318
|
+
return e.addType(h, {
|
|
314
319
|
extend: "icon",
|
|
315
|
-
isComponent: A(
|
|
320
|
+
isComponent: A(h),
|
|
316
321
|
model: {
|
|
317
322
|
defaults: {
|
|
318
323
|
name: "Accordion Marker",
|
|
319
324
|
icon: v.accordionMarker,
|
|
320
|
-
classes:
|
|
321
|
-
attributes: { [
|
|
325
|
+
classes: C,
|
|
326
|
+
attributes: { [b]: h },
|
|
322
327
|
components: v.caret,
|
|
323
328
|
droppable: !1,
|
|
324
|
-
draggable:
|
|
329
|
+
draggable: Z(u),
|
|
325
330
|
styles: `
|
|
326
|
-
.${
|
|
331
|
+
.${C} {
|
|
327
332
|
min-width: 24px;
|
|
328
333
|
width: 24px;
|
|
329
334
|
height: 24px;
|
|
330
335
|
transition: transform 0.2s ease-in-out;
|
|
331
336
|
}
|
|
332
|
-
.${
|
|
337
|
+
.${I} {
|
|
333
338
|
transform: rotateZ(180deg);
|
|
334
339
|
}
|
|
335
340
|
`
|
|
336
341
|
}
|
|
337
342
|
}
|
|
338
343
|
}), () => {
|
|
339
|
-
|
|
344
|
+
e.removeType(h);
|
|
340
345
|
};
|
|
341
|
-
},
|
|
342
|
-
const
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
346
|
+
}, ot = "accordionComponent", nt = f.startup, st = function(t, e = {}) {
|
|
347
|
+
const o = [
|
|
348
|
+
Q(t, e),
|
|
349
|
+
R(t, e),
|
|
350
|
+
tt(t, e),
|
|
351
|
+
et(t),
|
|
352
|
+
X(t)
|
|
348
353
|
];
|
|
349
|
-
|
|
350
|
-
editor:
|
|
351
|
-
licenseKey:
|
|
352
|
-
plan:
|
|
353
|
-
pluginName:
|
|
354
|
+
F({
|
|
355
|
+
editor: t,
|
|
356
|
+
licenseKey: e.licenseKey,
|
|
357
|
+
plan: nt,
|
|
358
|
+
pluginName: ot,
|
|
354
359
|
cleanup: () => {
|
|
355
|
-
|
|
360
|
+
o.forEach((c) => c());
|
|
356
361
|
}
|
|
357
362
|
});
|
|
358
|
-
},
|
|
363
|
+
}, rt = W(st);
|
|
359
364
|
export {
|
|
360
|
-
|
|
365
|
+
rt as default
|
|
361
366
|
};
|