@grapesjs/studio-sdk-plugins 1.0.15 → 1.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accordionComponent/index.cjs.js +3 -3
- package/dist/accordionComponent/index.es.js +29 -30
- package/dist/accordionComponent/index.umd.js +4 -4
- package/dist/canvasEmptyState/index.cjs.js +1 -1
- package/dist/canvasEmptyState/index.es.js +14 -15
- package/dist/canvasEmptyState/index.umd.js +1 -1
- package/dist/canvasFullSize/index.cjs.d.ts +2 -2
- package/dist/canvasFullSize/index.cjs.js +1 -1
- package/dist/canvasFullSize/index.d.ts +2 -2
- package/dist/canvasFullSize/index.es.d.ts +2 -2
- package/dist/canvasFullSize/index.es.js +2 -3
- package/dist/canvasFullSize/index.umd.js +2 -2
- package/dist/canvasFullSize/types.d.ts +1 -1
- package/dist/dialogComponent/index.cjs.js +2 -2
- package/dist/dialogComponent/index.es.js +2 -3
- package/dist/dialogComponent/index.umd.js +2 -2
- package/dist/flexComponent/index.cjs.js +1 -1
- package/dist/flexComponent/index.es.js +2 -3
- package/dist/flexComponent/index.umd.js +1 -1
- package/dist/fsLightboxComponent/index.cjs.js +2 -2
- package/dist/fsLightboxComponent/index.es.js +2 -3
- package/dist/fsLightboxComponent/index.umd.js +2 -2
- package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
- package/dist/googleFontsAssetProvider/index.es.js +39 -40
- package/dist/googleFontsAssetProvider/index.umd.js +1 -1
- package/dist/iconifyComponent/index.cjs.js +2 -2
- package/dist/iconifyComponent/index.es.js +31 -32
- package/dist/iconifyComponent/index.umd.js +2 -2
- package/dist/index.cjs.d.ts +1 -0
- package/dist/index.cjs.js +42 -42
- package/dist/index.d.ts +1 -0
- package/dist/index.es.d.ts +1 -0
- package/dist/index.es.js +3171 -2944
- package/dist/index.umd.js +36 -36
- package/dist/layoutSidebarButtons/index.cjs.d.ts +3 -0
- package/dist/layoutSidebarButtons/index.cjs.js +1 -0
- package/dist/layoutSidebarButtons/index.d.ts +3 -0
- package/dist/layoutSidebarButtons/index.es.d.ts +3 -0
- package/dist/layoutSidebarButtons/index.es.js +328 -0
- package/dist/layoutSidebarButtons/index.umd.js +1 -0
- package/dist/layoutSidebarButtons/layout.d.ts +8 -0
- package/dist/layoutSidebarButtons/types.d.ts +75 -0
- package/dist/layoutSidebarButtons/typesSchema.d.ts +49 -0
- package/dist/lightGalleryComponent/index.cjs.js +1 -1
- package/dist/lightGalleryComponent/index.es.js +2 -3
- package/dist/lightGalleryComponent/index.umd.js +1 -1
- package/dist/listPagesComponent/index.cjs.js +3 -3
- package/dist/listPagesComponent/index.es.js +2 -3
- package/dist/listPagesComponent/index.umd.js +3 -3
- package/dist/prosemirror/index.cjs.js +2 -2
- package/dist/prosemirror/index.es.js +3 -4
- package/dist/prosemirror/index.umd.js +2 -2
- package/dist/rteTinyMce/index.cjs.js +1 -1
- package/dist/rteTinyMce/index.es.js +20 -21
- package/dist/rteTinyMce/index.umd.js +1 -1
- package/dist/swiperComponent/index.cjs.js +3 -3
- package/dist/swiperComponent/index.es.js +2 -3
- package/dist/swiperComponent/index.umd.js +3 -3
- package/dist/tableComponent/index.cjs.js +1 -1
- package/dist/tableComponent/index.es.js +13 -14
- package/dist/tableComponent/index.umd.js +1 -1
- package/dist/types.d.ts +4 -3
- package/dist/youtubeAssetProvider/index.cjs.js +1 -1
- package/dist/youtubeAssetProvider/index.es.js +7 -8
- package/dist/youtubeAssetProvider/index.umd.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";const D="app.grapesjs.com",O="app-stage.grapesjs.com",k=[D,O,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],B="license:check:start",G="license:check:end",M=()=>typeof window<"u",_=({isDev:e,isStage:s})=>`${e?"":`https://${s?O:D}`}/api`,N=()=>{const e=M()&&window.location.hostname;return!!e&&(k.includes(e)||k.some(s=>e.endsWith(s)))};async function U({path:e,baseApiUrl:s,method:o="GET",headers:a={},params:l,body:d}){const r=`${s||_({isDev:!1,isStage:!1})}${e}`,n={method:o,headers:{"Content-Type":"application/json",...a}};d&&(n.body=JSON.stringify(d));const i=l?new URLSearchParams(l).toString():"",t=i?`?${i}`:"",c=await fetch(`${r}${t}`,n);if(!c.ok)throw new Error(`HTTP error! status: ${c.status}`);return c.json()}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||{}),I=(e=>(e.dark="dark",e.light="light",e.auto="auto",e))(I||{});const x={[h.free]:0,[h.startup]:10,[h.business]:20,[h.enterprise]:30};function W(e){const s=e;return s.init=o=>a=>e(a,o),s}const C=e=>W(e);async function j({editor:e,plan:s,pluginName:o,licenseKey:a,cleanup:l}){let d="",u=!1;const r=N(),n=t=>{console.warn("Cleanup plugin:",o,"Reason:",t),l()},i=(t={})=>{var f;const{error:c,sdkLicense:g}=t,p=(f=t.plan)==null?void 0:f.category;if(!(g||t.license)||c)n(c||"Invalid license");else if(p){const R=x[s],w=x[p];R>w&&n({pluginRequiredPlan:s,licensePlan:p})}};e.on(B,t=>{d=t==null?void 0:t.baseApiUrl,u=!0}),e.on(G,t=>{i(t)}),setTimeout(async()=>{if(!u){if(r)return;if(a){const t=await $({licenseKey:a,pluginName:o,baseApiUrl:d});t&&i(t)}else n("The `licenseKey` option not provided")}},2e3)}async function $(e){const{licenseKey:s,pluginName:o,baseApiUrl:a}=e;try{return(await U({baseApiUrl:a,path:`/sdk/${s||"na"}`,method:"POST",params:{d:window.location.hostname,pn:o}})).result||{}}catch(l){return console.error("Error during SDK license check:",l),!1}}const F=e=>e.dispatchEvent(new CustomEvent("input"));function K(e,s){if(!s)return()=>{};const o=e.Components.events,a=t=>e.getSelectedAll().includes(t),l=t=>t.isInstanceOf("text")&&!t.isChildOf("text"),d=t=>t.isChildOf("text"),u=t=>e.getEditing()===t,r=(t,c={})=>{t.trigger("focus",c.event)},n=(t,c)=>{a(t)&&l(t)&&!u(t)&&r(t,c)},i=(t,c)=>{if(a(t)&&!l(t)&&d(t)){const g=t.parents().find(p=>p.isInstanceOf("text"));g&&(r(g,c),setTimeout(()=>e.select(g),0))}};return e.on(o.select,n),e.on(o.selectBefore,i),()=>{e.off(o.select,n),e.off(o.selectBefore,i)}}const E=new WeakMap,q=(e,s)=>{E.set(e,s)},H=e=>{E.delete(e)},T=e=>E.get(e),y=e=>{const s=e.target,o=s.closest(".tox"),a=s.matches(".ephox-snooker-resizer-bar");(o||a)&&e.stopPropagation()},L=e=>{e.stopPropagation(),e.preventDefault()},z=(e,s)=>{const o=e.getDoc(),a=e.getWin();if(s!=null&&s.event){const{event:l}=s,{clientX:d,clientY:u}=l;let r;if(o.caretRangeFromPoint)r=o.caretRangeFromPoint(d,u);else if(o.caretPositionFromPoint){const n=o.caretPositionFromPoint(d,u);r=o.createRange(),r==null||r.setStart(n.offsetNode,n.offset)}if(r){const n=a.getSelection();n==null||n.removeAllRanges(),n==null||n.addRange(r),e.selection.setRng(r)}}else e.execCommand("SelectAll")},V=e=>{var i,t;const{el:s,editor:o,componentView:a}=e,l=o.runCommand(v.getStateTheme),d=a.model,u={target:s,inline:!0,skin:(l==null?void 0:l.theme)===I.dark?"oxide-dark":"oxide",menubar:!1,image_advtab:!0,paste_data_images:!0,statusbar:!1,branding:!1,forced_root_block:"div",plugins:"advlist autolink lists link image media table",toolbar_mode:"sliding",toolbar:"bold italic underline strikethrough forecolor backcolor alignleft aligncenter alignright alignjustify link image | fontfamily fontsize bullist numlist outdent indent table"},r=((t=(i=e.pluginOpts)==null?void 0:i.loadConfig)==null?void 0:t.call(i,{config:u,editor:o,componentView:a,component:d}))||{};return{...u,...r}},A=(e,s=document)=>new Promise((o,a)=>{const l=Array.isArray(e)?[...e]:[e],{head:d}=s,u=r=>{if(r.length){const n=s.createElement("script");n.src=r.shift(),n.onload=u.bind(null,r),n.onerror=a,d.appendChild(n)}else o()};u(l)}),J="rteTinyMce",X=function(e,s={}){const o={cdnScript:"https://cdn.jsdelivr.net/npm/tinymce@6.8.5/tinymce.min.js",...s},{cdnScript:a}=o,l=e.Canvas.events,d=async(n,i)=>{const t=n.ownerDocument,c=t.defaultView,g=i==null?void 0:i.view;if(!c||!g){console.warn("Missing required data",{win:c,componentView:g});return}const p=V({el:n,editor:e,componentView:g,pluginOpts:o}),f=(await c.tinymce.init(p))[0];if(!f)return;const w=(await window.tinymce.init({...p,target:document.createElement("div")}))[0];return f.ui.show(),t.body.addEventListener("mousedown",y),document.body.addEventListener("mousedown",y),f.on("Change",()=>F(n)),f.on("blur",()=>f.ui.show()),f.on("OpenWindow",function(){var P;const b=(P=t.querySelector(".tox-dialog"))==null?void 0:P.closest(".tox");b&&(b==null?void 0:b.ownerDocument)!==document&&(document.body.appendChild(b),f.once("CloseWindow",()=>{b&&b.ownerDocument===document&&t.body.appendChild(b)}))}),n.addEventListener("dragstart",L,{capture:!0}),e.runCommand(v.setStateContextMenu,{enabled:!1}),z(f,i),{rteEditor:f,rteEditorShallow:w}},u=(n,i)=>{n.ownerDocument.body.removeEventListener("mousedown",y),document.body.removeEventListener("mousedown",y),n.removeEventListener("dragstart",L,{capture:!0}),e.runCommand(v.setStateContextMenu,{enabled:!0}),i.rteEditor.destroy(),i.rteEditorShallow.destroy()};e.on(l.frameLoad,async({window:n})=>{A(a,n.document)}),e.onReady(()=>{A(a,document)}),e.setCustomRte({parseContent:!0,async enable(n,i,t){const c=T(n);if(c)return c.rteEditor;const g=await d(n,t);return g&&q(n,g),g==null?void 0:g.rteEditor},disable(n){const i=T(n);i&&(H(n),u(n,i))},getContent(n){var t,c;const i=T(n);return i?(c=(t=i.rteEditor).getContent)==null?void 0:c.call(t):n.innerHTML}});const r=K(e,o.enableOnClick);j({editor:e,licenseKey:o.licenseKey,plan:h.startup,pluginName:J,cleanup:()=>{e.RichTextEditor.customRte=void 0,r()}})},Y=C(X);module.exports=Y;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
const D = "app.grapesjs.com", m = "app-stage.grapesjs.com", k = [
|
|
1
|
+
const D = "app.grapesjs.com", O = "app-stage.grapesjs.com", k = [
|
|
3
2
|
D,
|
|
4
|
-
|
|
3
|
+
O,
|
|
5
4
|
"localhost",
|
|
6
5
|
"127.0.0.1",
|
|
7
6
|
".local-credentialless.webcontainer.io",
|
|
@@ -10,8 +9,8 @@ const D = "app.grapesjs.com", m = "app-stage.grapesjs.com", k = [
|
|
|
10
9
|
// For stackblitz.com demos
|
|
11
10
|
"-sandpack.codesandbox.io"
|
|
12
11
|
// For Sandpack demos
|
|
13
|
-
], B = "license:check:start",
|
|
14
|
-
const e =
|
|
12
|
+
], B = "license:check:start", G = "license:check:end", M = () => typeof window < "u", _ = ({ isDev: e, isStage: s }) => `${e ? "" : `https://${s ? O : D}`}/api`, N = () => {
|
|
13
|
+
const e = M() && window.location.hostname;
|
|
15
14
|
return !!e && (k.includes(e) || k.some((s) => e.endsWith(s)));
|
|
16
15
|
};
|
|
17
16
|
async function U({
|
|
@@ -22,7 +21,7 @@ async function U({
|
|
|
22
21
|
params: l,
|
|
23
22
|
body: d
|
|
24
23
|
}) {
|
|
25
|
-
const r = `${s ||
|
|
24
|
+
const r = `${s || _({ isDev: !1, isStage: !1 })}${e}`, n = {
|
|
26
25
|
method: o,
|
|
27
26
|
headers: {
|
|
28
27
|
"Content-Type": "application/json",
|
|
@@ -35,7 +34,7 @@ async function U({
|
|
|
35
34
|
throw new Error(`HTTP error! status: ${c.status}`);
|
|
36
35
|
return c.json();
|
|
37
36
|
}
|
|
38
|
-
var h = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(h || {}),
|
|
37
|
+
var h = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(h || {}), v = /* @__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))(v || {}), I = /* @__PURE__ */ ((e) => (e.dark = "dark", e.light = "light", e.auto = "auto", e))(I || {});
|
|
39
38
|
const x = {
|
|
40
39
|
[h.free]: 0,
|
|
41
40
|
[h.startup]: 10,
|
|
@@ -46,8 +45,8 @@ function W(e) {
|
|
|
46
45
|
const s = e;
|
|
47
46
|
return s.init = (o) => (a) => e(a, o), s;
|
|
48
47
|
}
|
|
49
|
-
const
|
|
50
|
-
async function
|
|
48
|
+
const C = (e) => /* @__PURE__ */ W(e);
|
|
49
|
+
async function j({
|
|
51
50
|
editor: e,
|
|
52
51
|
plan: s,
|
|
53
52
|
pluginName: o,
|
|
@@ -69,20 +68,20 @@ async function $({
|
|
|
69
68
|
};
|
|
70
69
|
e.on(B, (t) => {
|
|
71
70
|
d = t == null ? void 0 : t.baseApiUrl, u = !0;
|
|
72
|
-
}), e.on(
|
|
71
|
+
}), e.on(G, (t) => {
|
|
73
72
|
i(t);
|
|
74
73
|
}), setTimeout(async () => {
|
|
75
74
|
if (!u) {
|
|
76
75
|
if (r) return;
|
|
77
76
|
if (a) {
|
|
78
|
-
const t = await
|
|
77
|
+
const t = await $({ licenseKey: a, pluginName: o, baseApiUrl: d });
|
|
79
78
|
t && i(t);
|
|
80
79
|
} else
|
|
81
80
|
n("The `licenseKey` option not provided");
|
|
82
81
|
}
|
|
83
82
|
}, 2e3);
|
|
84
83
|
}
|
|
85
|
-
async function
|
|
84
|
+
async function $(e) {
|
|
86
85
|
const { licenseKey: s, pluginName: o, baseApiUrl: a } = e;
|
|
87
86
|
try {
|
|
88
87
|
return (await U({
|
|
@@ -120,7 +119,7 @@ const E = /* @__PURE__ */ new WeakMap(), q = (e, s) => {
|
|
|
120
119
|
E.set(e, s);
|
|
121
120
|
}, H = (e) => {
|
|
122
121
|
E.delete(e);
|
|
123
|
-
}, T = (e) => E.get(e),
|
|
122
|
+
}, T = (e) => E.get(e), y = (e) => {
|
|
124
123
|
const s = e.target, o = s.closest(".tox"), a = s.matches(".ephox-snooker-resizer-bar");
|
|
125
124
|
(o || a) && e.stopPropagation();
|
|
126
125
|
}, L = (e) => {
|
|
@@ -144,10 +143,10 @@ const E = /* @__PURE__ */ new WeakMap(), q = (e, s) => {
|
|
|
144
143
|
e.execCommand("SelectAll");
|
|
145
144
|
}, V = (e) => {
|
|
146
145
|
var i, t;
|
|
147
|
-
const { el: s, editor: o, componentView: a } = e, l = o.runCommand(
|
|
146
|
+
const { el: s, editor: o, componentView: a } = e, l = o.runCommand(v.getStateTheme), d = a.model, u = {
|
|
148
147
|
target: s,
|
|
149
148
|
inline: !0,
|
|
150
|
-
skin: (l == null ? void 0 : l.theme) ===
|
|
149
|
+
skin: (l == null ? void 0 : l.theme) === I.dark ? "oxide-dark" : "oxide",
|
|
151
150
|
menubar: !1,
|
|
152
151
|
image_advtab: !0,
|
|
153
152
|
paste_data_images: !0,
|
|
@@ -196,15 +195,15 @@ const E = /* @__PURE__ */ new WeakMap(), q = (e, s) => {
|
|
|
196
195
|
...p,
|
|
197
196
|
target: document.createElement("div")
|
|
198
197
|
}))[0];
|
|
199
|
-
return f.ui.show(), t.body.addEventListener("mousedown",
|
|
198
|
+
return f.ui.show(), t.body.addEventListener("mousedown", y), document.body.addEventListener("mousedown", y), f.on("Change", () => F(n)), f.on("blur", () => f.ui.show()), f.on("OpenWindow", function() {
|
|
200
199
|
var P;
|
|
201
200
|
const b = (P = t.querySelector(".tox-dialog")) == null ? void 0 : P.closest(".tox");
|
|
202
201
|
b && (b == null ? void 0 : b.ownerDocument) !== document && (document.body.appendChild(b), f.once("CloseWindow", () => {
|
|
203
202
|
b && b.ownerDocument === document && t.body.appendChild(b);
|
|
204
203
|
}));
|
|
205
|
-
}), n.addEventListener("dragstart", L, { capture: !0 }), e.runCommand(
|
|
204
|
+
}), n.addEventListener("dragstart", L, { capture: !0 }), e.runCommand(v.setStateContextMenu, { enabled: !1 }), z(f, i), { rteEditor: f, rteEditorShallow: w };
|
|
206
205
|
}, u = (n, i) => {
|
|
207
|
-
n.ownerDocument.body.removeEventListener("mousedown",
|
|
206
|
+
n.ownerDocument.body.removeEventListener("mousedown", y), document.body.removeEventListener("mousedown", y), n.removeEventListener("dragstart", L, { capture: !0 }), e.runCommand(v.setStateContextMenu, { enabled: !0 }), i.rteEditor.destroy(), i.rteEditorShallow.destroy();
|
|
208
207
|
};
|
|
209
208
|
e.on(l.frameLoad, async ({ window: n }) => {
|
|
210
209
|
A(a, n.document);
|
|
@@ -230,7 +229,7 @@ const E = /* @__PURE__ */ new WeakMap(), q = (e, s) => {
|
|
|
230
229
|
}
|
|
231
230
|
});
|
|
232
231
|
const r = K(e, o.enableOnClick);
|
|
233
|
-
|
|
232
|
+
j({
|
|
234
233
|
editor: e,
|
|
235
234
|
licenseKey: o.licenseKey,
|
|
236
235
|
plan: h.startup,
|
|
@@ -239,7 +238,7 @@ const E = /* @__PURE__ */ new WeakMap(), q = (e, s) => {
|
|
|
239
238
|
e.RichTextEditor.customRte = void 0, r();
|
|
240
239
|
}
|
|
241
240
|
});
|
|
242
|
-
},
|
|
241
|
+
}, S = C(X);
|
|
243
242
|
export {
|
|
244
|
-
|
|
243
|
+
S as default
|
|
245
244
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(h,y){typeof exports=="object"&&typeof module<"u"?module.exports=y(
|
|
1
|
+
(function(h,y){typeof exports=="object"&&typeof module<"u"?module.exports=y():typeof define=="function"&&define.amd?define(y):(h=typeof globalThis<"u"?globalThis:h||self,h.StudioSdkPlugins_rteTinyMce=y())})(this,function(){"use strict";const h="app.grapesjs.com",y="app-stage.grapesjs.com",x=[h,y,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],I="license:check:start",M="license:check:end",B=()=>typeof window<"u",G=({isDev:e,isStage:s})=>`${e?"":`https://${s?y:h}`}/api`,_=()=>{const e=B()&&window.location.hostname;return!!e&&(x.includes(e)||x.some(s=>e.endsWith(s)))};async function N({path:e,baseApiUrl:s,method:o="GET",headers:a={},params:l,body:d}){const r=`${s||G({isDev:!1,isStage:!1})}${e}`,n={method:o,headers:{"Content-Type":"application/json",...a}};d&&(n.body=JSON.stringify(d));const i=l?new URLSearchParams(l).toString():"",t=i?`?${i}`:"",c=await fetch(`${r}${t}`,n);if(!c.ok)throw new Error(`HTTP error! status: ${c.status}`);return c.json()}var v=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(v||{}),w=(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))(w||{}),k=(e=>(e.dark="dark",e.light="light",e.auto="auto",e))(k||{});const L={[v.free]:0,[v.startup]:10,[v.business]:20,[v.enterprise]:30};function U(e){const s=e;return s.init=o=>a=>e(a,o),s}const W=e=>U(e);async function j({editor:e,plan:s,pluginName:o,licenseKey:a,cleanup:l}){let d="",u=!1;const r=_(),n=t=>{console.warn("Cleanup plugin:",o,"Reason:",t),l()},i=(t={})=>{var f;const{error:c,sdkLicense:g}=t,p=(f=t.plan)==null?void 0:f.category;if(!(g||t.license)||c)n(c||"Invalid license");else if(p){const O=L[s],P=L[p];O>P&&n({pluginRequiredPlan:s,licensePlan:p})}};e.on(I,t=>{d=t==null?void 0:t.baseApiUrl,u=!0}),e.on(M,t=>{i(t)}),setTimeout(async()=>{if(!u){if(r)return;if(a){const t=await C({licenseKey:a,pluginName:o,baseApiUrl:d});t&&i(t)}else n("The `licenseKey` option not provided")}},2e3)}async function C(e){const{licenseKey:s,pluginName:o,baseApiUrl:a}=e;try{return(await N({baseApiUrl:a,path:`/sdk/${s||"na"}`,method:"POST",params:{d:window.location.hostname,pn:o}})).result||{}}catch(l){return console.error("Error during SDK license check:",l),!1}}const $=e=>e.dispatchEvent(new CustomEvent("input"));function F(e,s){if(!s)return()=>{};const o=e.Components.events,a=t=>e.getSelectedAll().includes(t),l=t=>t.isInstanceOf("text")&&!t.isChildOf("text"),d=t=>t.isChildOf("text"),u=t=>e.getEditing()===t,r=(t,c={})=>{t.trigger("focus",c.event)},n=(t,c)=>{a(t)&&l(t)&&!u(t)&&r(t,c)},i=(t,c)=>{if(a(t)&&!l(t)&&d(t)){const g=t.parents().find(p=>p.isInstanceOf("text"));g&&(r(g,c),setTimeout(()=>e.select(g),0))}};return e.on(o.select,n),e.on(o.selectBefore,i),()=>{e.off(o.select,n),e.off(o.selectBefore,i)}}const E=new WeakMap,K=(e,s)=>{E.set(e,s)},q=e=>{E.delete(e)},R=e=>E.get(e),T=e=>{const s=e.target,o=s.closest(".tox"),a=s.matches(".ephox-snooker-resizer-bar");(o||a)&&e.stopPropagation()},A=e=>{e.stopPropagation(),e.preventDefault()},H=(e,s)=>{const o=e.getDoc(),a=e.getWin();if(s!=null&&s.event){const{event:l}=s,{clientX:d,clientY:u}=l;let r;if(o.caretRangeFromPoint)r=o.caretRangeFromPoint(d,u);else if(o.caretPositionFromPoint){const n=o.caretPositionFromPoint(d,u);r=o.createRange(),r==null||r.setStart(n.offsetNode,n.offset)}if(r){const n=a.getSelection();n==null||n.removeAllRanges(),n==null||n.addRange(r),e.selection.setRng(r)}}else e.execCommand("SelectAll")},z=e=>{var i,t;const{el:s,editor:o,componentView:a}=e,l=o.runCommand(w.getStateTheme),d=a.model,u={target:s,inline:!0,skin:(l==null?void 0:l.theme)===k.dark?"oxide-dark":"oxide",menubar:!1,image_advtab:!0,paste_data_images:!0,statusbar:!1,branding:!1,forced_root_block:"div",plugins:"advlist autolink lists link image media table",toolbar_mode:"sliding",toolbar:"bold italic underline strikethrough forecolor backcolor alignleft aligncenter alignright alignjustify link image | fontfamily fontsize bullist numlist outdent indent table"},r=((t=(i=e.pluginOpts)==null?void 0:i.loadConfig)==null?void 0:t.call(i,{config:u,editor:o,componentView:a,component:d}))||{};return{...u,...r}},D=(e,s=document)=>new Promise((o,a)=>{const l=Array.isArray(e)?[...e]:[e],{head:d}=s,u=r=>{if(r.length){const n=s.createElement("script");n.src=r.shift(),n.onload=u.bind(null,r),n.onerror=a,d.appendChild(n)}else o()};u(l)}),S="rteTinyMce";return W(function(e,s={}){const o={cdnScript:"https://cdn.jsdelivr.net/npm/tinymce@6.8.5/tinymce.min.js",...s},{cdnScript:a}=o,l=e.Canvas.events,d=async(n,i)=>{const t=n.ownerDocument,c=t.defaultView,g=i==null?void 0:i.view;if(!c||!g){console.warn("Missing required data",{win:c,componentView:g});return}const p=z({el:n,editor:e,componentView:g,pluginOpts:o}),f=(await c.tinymce.init(p))[0];if(!f)return;const P=(await window.tinymce.init({...p,target:document.createElement("div")}))[0];return f.ui.show(),t.body.addEventListener("mousedown",T),document.body.addEventListener("mousedown",T),f.on("Change",()=>$(n)),f.on("blur",()=>f.ui.show()),f.on("OpenWindow",function(){var m;const b=(m=t.querySelector(".tox-dialog"))==null?void 0:m.closest(".tox");b&&(b==null?void 0:b.ownerDocument)!==document&&(document.body.appendChild(b),f.once("CloseWindow",()=>{b&&b.ownerDocument===document&&t.body.appendChild(b)}))}),n.addEventListener("dragstart",A,{capture:!0}),e.runCommand(w.setStateContextMenu,{enabled:!1}),H(f,i),{rteEditor:f,rteEditorShallow:P}},u=(n,i)=>{n.ownerDocument.body.removeEventListener("mousedown",T),document.body.removeEventListener("mousedown",T),n.removeEventListener("dragstart",A,{capture:!0}),e.runCommand(w.setStateContextMenu,{enabled:!0}),i.rteEditor.destroy(),i.rteEditorShallow.destroy()};e.on(l.frameLoad,async({window:n})=>{D(a,n.document)}),e.onReady(()=>{D(a,document)}),e.setCustomRte({parseContent:!0,async enable(n,i,t){const c=R(n);if(c)return c.rteEditor;const g=await d(n,t);return g&&K(n,g),g==null?void 0:g.rteEditor},disable(n){const i=R(n);i&&(q(n),u(n,i))},getContent(n){var t,c;const i=R(n);return i?(c=(t=i.rteEditor).getContent)==null?void 0:c.call(t):n.innerHTML}});const r=F(e,o.enableOnClick);j({editor:e,licenseKey:o.licenseKey,plan:v.startup,pluginName:S,cleanup:()=>{e.RichTextEditor.customRte=void 0,r()}})})});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";const Q="app.grapesjs.com",ee="app-stage.grapesjs.com",H=[Q,ee,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],te="license:check:start",ae="license:check:end",le=()=>typeof window<"u",se=({isDev:e,isStage:l})=>`${e?"":`https://${l?ee:Q}`}/api`,ne=()=>{const e=le()&&window.location.hostname;return!!e&&(H.includes(e)||H.some(l=>e.endsWith(l)))},ie=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(l,a)=>(a?"-":"")+l.toLowerCase()),oe=e=>typeof e<"u";async function re({path:e,baseApiUrl:l,method:a="GET",headers:s={},params:i,body:b}){const f=`${l||se({isDev:!1,isStage:!1})}${e}`,d={method:a,headers:{"Content-Type":"application/json",...s}};b&&(d.body=JSON.stringify(b));const u=i?new URLSearchParams(i).toString():"",o=u?`?${u}`:"",h=await fetch(`${f}${o}`,d);if(!h.ok)throw new Error(`HTTP error! status: ${h.status}`);return h.json()}var T=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(T||{});const G={[T.free]:0,[T.startup]:10,[T.business]:20,[T.enterprise]:30};function ce(e){const l=e;return l.init=a=>s=>e(s,a),l}const de=e=>ce(e);async function pe({editor:e,plan:l,pluginName:a,licenseKey:s,cleanup:i}){let b="",c=!1;const f=ne(),d=o=>{console.warn("Cleanup plugin:",a,"Reason:",o),i()},u=(o={})=>{var S;const{error:h,sdkLicense:t}=o,n=(S=o.plan)==null?void 0:S.category;if(!(t||o.license)||h)d(h||"Invalid license");else if(n){const R=G[l],$=G[n];R>$&&d({pluginRequiredPlan:l,licensePlan:n})}};e.on(te,o=>{b=o==null?void 0:o.baseApiUrl,c=!0}),e.on(ae,o=>{u(o)}),setTimeout(async()=>{if(!c){if(f)return;if(s){const o=await ue({licenseKey:s,pluginName:a,baseApiUrl:b});o&&u(o)}else d("The `licenseKey` option not provided")}},2e3)}async function ue(e){const{licenseKey:l,pluginName:a,baseApiUrl:s}=e;try{return(await re({baseApiUrl:s,path:`/sdk/${l||"na"}`,method:"POST",params:{d:window.location.hostname,pn:a}})).result||{}}catch(i){return console.error("Error during SDK license check:",i),!1}}const P=(e,l)=>{var a;return!!((a=e==null?void 0:e.classList)!=null&&a.contains(l))},be=(e,l={})=>{var b;const a={},s=[],i=[];for(const c in e){const{value:f,...d}=e[c];s.push({id:c,name:c,changeProp:!0,category:l.category,...d}),a[c]=f,!oe(f)&&i.push(c);const{subTraits:u={}}=d;for(const o in d.subTraits)(b=u[o])==null||b.forEach(h=>{const t=h.id||h.name;a[t]=h.value})}return{propKeys:Object.keys(a),propsNoValues:i,props:a,traits:s}},fe=(e,l)=>{l.forEach(a=>{if(a.subTraits){const s=`${a.id||a.name}`,i=a.changeProp?`change:${s}`:`change:attributes:${s}`;e.on(i,()=>U(e,s)),U(e,s)}})},U=(e,l)=>{const a=e.getTrait(l),s=a.get("category"),i=a.get("subTraits")||{},c=(Object.values(i).flat()||[]).map(u=>u.id||u.name);e.removeTrait(c);const f=i[a.getValue()],d=e.getTraitIndex(l)+1;f&&e.addTrait(f.map(u=>({category:s,...u})),{at:d})},he=(e,l)=>{l.forEach(a=>{const s=ie(a);s!==a&&e.has(s)&&e.set({[a]:e.get(s),[s]:void 0})})},m="swiper",M=`${m}-slide`,x=`${m}-wrapper`,L=`${m}-nav-prev`,V=`${m}-nav-next`,k=`${m}-pagination`,N=`${m}-scrollbar`,p={slider:`<svg viewBox="0 0 24 24">
|
|
2
2
|
<path d="M22 7.6c0-1-.5-1.6-1.3-1.6H3.4C2.5 6 2 6.7 2 7.6v9.8c0 1 .5 1.6 1.3 1.6h17.4c.8 0 1.3-.6 1.3-1.6V7.6zM21 18H3V7h18v11z" fill-rule="nonzero"/>
|
|
3
3
|
<path d="M4 12.5L6 14v-3zM20 12.5L18 14v-3z"/>
|
|
4
4
|
</svg>`,effect:`<svg viewBox="0 0 24 24">
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
<path d="M2 12c0 5 4 9 9 9 2.4 0 4.7-1 6.4-2.6l-1.5-1.5A6.7 6.7 0 0 1 11 19a7 7 0 1 1 7-7h-3l4 4h.1l3.9-4h-3a9 9 0 0 0-18 0Z"/>
|
|
22
22
|
</svg>`,prev:'<svg viewBox="0 0 24 24"><path d="M15.4 16.6 10.8 12l4.6-4.6L14 6l-6 6 6 6 1.4-1.4Z"/></svg>',next:'<svg viewBox="0 0 24 24"><path d="m8.6 16.6 4.6-4.6-4.6-4.6L10 6l6 6-6 6-1.4-1.4Z"/></svg>',add:`<svg viewBox="0 0 24 24">
|
|
23
23
|
<path d="M12 20a8 8 0 1 1 0-16 8 8 0 0 1 0 16m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m1 5h-2v4H7v2h4v4h2v-4h4v-2h-4V7Z"/>
|
|
24
|
-
</svg>`},j={id:"swiper-responsive",label:"Responsive",icon:p.responsive},K={id:"swiper-extra",label:"Extra",icon:p.extra},ve={actions:{type:"radio",label:!1,labelToTitle:!0,options:[{id:"r",label:"Reload slider",icon:p.reload},{id:"p",label:"Previous slide",icon:p.prev},{id:"n",label:"Next slide",icon:p.next},{id:"a",label:"Add new slide",icon:p.add}],setValue:({component:e,value:l})=>{var s;const a=(s=e.getView())==null?void 0:s.getSwiper();switch(l){case"r":e.reloadSlider();break;case"p":a==null||a.slidePrev();break;case"n":a==null||a.slideNext();break;case"a":e.addSlide();break}}},vertical:{type:"checkbox",label:"Vertical",value:!1},loop:{type:"checkbox",label:"Loop",value:!1},freeMode:{type:"checkbox",label:"Free mode",value:!1},autoHeight:{type:"checkbox",label:"Auto height",value:!1},navigation:{type:"checkbox",label:"Navigation",getValue:({component:e})=>!!e.findFirstType(L),setValue:({component:e,value:l})=>{var a,s;l?e.append([{type:L},{type:V}]):((a=e.findFirstType(L))==null||a.remove(),(s=e.findFirstType(V))==null||s.remove()),e.set({navigation:l})}},initialSlide:{type:"number",label:"Initial slide",min:0,value:"0"},speed:{type:"number",label:"Speed",tip:"Transition duration (in ms)",step:500,min:0,value:300},effect:{category:{id:"swiper-effect",label:"Effects",icon:p.effect},type:"select",label:"Effect Type",value:"slide",options:[{id:"slide",label:"Slide"},{id:"fade",label:"Fade"},{id:"cube",label:"Cube"},{id:"coverflow",label:"Coverflow"},{id:"flip",label:"Flip"},{id:"cards",label:"Cards"}],subTraits:{slide:[{type:"number",name:"slidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"slidesPerGroup",label:"Slides per group",tip:"Numbers of slides for group sliding",changeProp:!0,min:1,value:1},{type:"number",name:"spaceBetween",label:"Space between",tip:"Distance between slides in px",changeProp:!0,min:0,value:0},{type:"number",name:"slidesOffsetBefore",label:"Slides offset before",tip:"Add additional slide offset in the beginning of the container (in px, before all slides)",changeProp:!0,min:0,value:0},{type:"number",name:"slidesOffsetAfter",label:"Slides offset after",tip:"Add additional slide offset in the end of the container (in px, after all slides)",changeProp:!0,min:0,value:0},{type:"checkbox",name:"centeredSlides",label:"Centered slides",tip:"If enabled, the active slide will be centered",changeProp:!0,value:!1}],fade:[{type:"checkbox",name:"crossFade",tip:"Enables slides cross fade",label:"Cross fade",changeProp:!0,value:!1}],cube:[{type:"checkbox",name:"cubeEffectShadow",label:"Shadow",changeProp:!0,value:!0},{type:"checkbox",name:"cubeEffectSlideShadows",label:"Slide shadows",changeProp:!0,value:!0},{type:"number",name:"cubeEffectShadowOffset",label:"Shadow offset",changeProp:!0,value:20},{type:"number",name:"cubeEffectShadowScale",label:"Shadow scale",changeProp:!0,value:.94}],coverflow:[{type:"number",name:"coverflowEffectDepth",tip:"Depth offset in px (slides translate in Z axis)",label:"Depth",changeProp:!0,min:0,value:100},{type:"number",name:"coverflowEffectModifier",tip:"Effect multiplier",label:"Modifier",changeProp:!0,step:.1,min:0,value:1},{type:"number",name:"coverflowEffectRotate",tip:"Slide rotate in degrees",label:"Rotate",changeProp:!0,min:0,value:50},{type:"number",name:"coverflowEffectScale",tip:"Slide scale effect",label:"Scale",changeProp:!0,min:0,step:.1,value:1},{type:"number",name:"coverflowEffectStretch",tip:"Stretch space between slides (in px)",label:"Stretch",changeProp:!0,min:0,value:0},{type:"checkbox",name:"coverflowEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadow",changeProp:!0,value:!0}],flip:[{type:"checkbox",name:"flipEffectLimitRotation",tip:"Limit edge slides rotation",label:"Limit rotation",changeProp:!0,value:!0},{type:"checkbox",name:"flipEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadows",changeProp:!0,value:!0}],cards:[{type:"number",name:"cardsEffectPerSlideOffset",tip:"Offset distance per slide (in px)",label:"Slide offset",changeProp:!0,min:0,value:8},{type:"number",name:"cardsEffectPerSlideRotate",tip:"Rotate angle per slide (in degrees)",label:"Slide rotate",changeProp:!0,min:0,value:2},{type:"checkbox",name:"cardsEffectRotate",tip:"Enables cards rotation",label:"Rotate",changeProp:!0,value:!0},{type:"checkbox",name:"cardsEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadows",changeProp:!0,value:!0}]}},autoplay:{category:{id:"swiper-autoplay",label:"Autoplay",icon:p.autoplay},type:"checkbox",label:"Enable Autoplay",value:!1,subTraits:{true:[{type:"number",name:"autoplayDelay",label:"Delay",changeProp:!0,value:3e3},{type:"checkbox",name:"autoplayDisableOnInteraction",label:"Disable on interaction",changeProp:!0,value:!0},{type:"checkbox",name:"autoplayWaitForTransition",label:"Wait for transition",changeProp:!0,value:!0},{type:"checkbox",name:"autoplayPauseOnMouseEnter",label:"Pause on mouse enter",changeProp:!0,value:!1},{type:"checkbox",name:"autoplayReverseDirection",label:"Reverse direction",changeProp:!0,value:!1},{type:"checkbox",name:"autoplayStopOnLastSlide",label:"Stop on last slide",changeProp:!0,value:!1}]}},pagination:{category:{id:"swiper-pagination",label:"Pagination",icon:p.pagination},type:"select",label:"Pagination Type",options:[{id:"none",label:"None"},{id:"bullets",label:"Bullets"},{id:"progressbar",label:"Progressbar"},{id:"fraction",label:"Fraction"}],getValue:({component:e})=>e.findFirstType(k)?e.get("pagination")||"bullets":"none",setValue:({component:e,value:l})=>{const a=e.findFirstType(k);a==null||a.remove(),l!=="none"&&e.append({type:k}),e.set({pagination:l})},subTraits:{bullets:[{type:"checkbox",name:"dynamicBullets",label:"Dynamic bullets",changeProp:!0,value:!1},{type:"checkbox",name:"clickableBullets",label:"Clickable bullets",changeProp:!0,value:!0}],progressbar:[{type:"checkbox",name:"progressbarOpposite",label:"Progress opposite",changeProp:!0,value:!1}]}},scrollbar:{category:{id:"swiper-scrollbar",label:"Scrollbar",icon:p.scrollbar},type:"checkbox",label:"Enable Scrollbar",getValue:({component:e})=>!!e.findFirstType(N),setValue:({component:e,value:l})=>{const a=e.findFirstType(N);a==null||a.remove(),l&&e.append({type:N}),e.set({scrollbar:l})},subTraits:{false:[],true:[{type:"checkbox",name:"scrollbarDraggable",label:"Draggable",changeProp:!0,value:!1},{type:"checkbox",name:"scrollbarHide",label:"Hide",tip:"Hide scrollbar automatically after user interaction",changeProp:!0,value:!0}]}},parallax:{category:{id:"swiper-parallax",label:"Parallax",icon:p.parallax},type:"checkbox",label:"Enable Parallax",value:!1},mobile:{category:j,type:"checkbox",label:"Enable mobile breakpoint",value:!1,subTraits:{true:[{type:"number",name:"mobileBreakpoint",label:"Mobile breakpoint",tip:"Slide values below will be applied when the screen width is greater than this value",changeProp:!0,min:1,value:460},{type:"number",name:"mobileSlidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"mobileSlidesPerGroup",label:"Slides per group",changeProp:!0,min:1,value:1},{type:"number",name:"mobileSpaceBetween",label:"Space between",changeProp:!0,min:0,value:0}]}},tablet:{category:j,type:"checkbox",label:"Enable tablet breakpoint",value:!1,subTraits:{true:[{type:"number",name:"tabletBreakpoint",label:"Tablet breakpoint",tip:"Slide values below will be applied when the screen width is greater than this value",changeProp:!0,min:1,value:991},{type:"number",name:"tabletSlidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"tabletSlidesPerGroup",label:"Slides per group",changeProp:!0,min:1,value:1},{type:"number",name:"tabletSpaceBetween",label:"Space between",changeProp:!0,min:0,value:0}]}},allowTouchMove:{category:K,type:"checkbox",label:"Allow touch move",tip:"Allow touch interactions",value:!0},grabCursor:{category:K,type:"checkbox",label:"Grab cursor",tip:'If enabled, the user will see the "grab" cursor when hover the slider',value:!1}},Z="Slider",q="swiper",C=`${q}-`,me=(e,l)=>{const{Components:a,Blocks:s,Commands:n}=e,{block:b}=l,c=be(ve),f="core:preview",d=n.events,u=function(t){const i=this,A=window,S=i.__onLoad,R=i.__activeSlide,$=i.__inPreview,{cdnScript:D,cdnStyle:I,slidesPerView:F}=t||{},r=v=>isNaN(v)?void 0:parseFloat(v),z=()=>{const v={loop:t.loop,speed:t.speed,initialSlide:t.initialSlide,direction:t.vertical?"vertical":"horizontal",effect:t.effect,freeMode:t.freeMode,parallax:t.parallax,autoHeight:t.autoHeight,allowTouchMove:t.allowTouchMove,grabCursor:t.grabCursor,simulateTouch:!0,breakpoints:{},slidesPerView:isNaN(F)?F:r(F),slidesPerGroup:r(t.slidesPerGroup),spaceBetween:r(t.spaceBetween),slidesOffsetBefore:r(t.slidesOffsetBefore),slidesOffsetAfter:r(t.slidesOffsetAfter),centeredSlides:t.centeredSlides,fadeEffect:{crossFade:t.crossFade},cubeEffect:{shadow:t.cubeEffectShadow,slideShadows:t.cubeEffectSlideShadows,shadowOffset:r(t.cubeEffectShadowOffset),shadowScale:r(t.cubeEffectShadowScale)},coverflowEffect:{depth:r(t.coverflowEffectDepth),modifier:r(t.coverflowEffectModifier),rotate:r(t.coverflowEffectRotate),scale:r(t.coverflowEffectScale),stretch:r(t.coverflowEffectStretch),slideShadows:t.coverflowEffectSlideShadows},flipEffect:{limitRotation:t.flipEffectLimitRotation,slideShadows:t.flipEffectSlideShadows},cardsEffect:{perSlideOffset:r(t.cardsEffectPerSlideOffset),perSlideRotate:r(t.cardsEffectPerSlideRotate),rotate:t.cardsEffectRotate,slideShadows:t.cardsEffectSlideShadows},navigation:{nextEl:i.querySelector(".swiper-button-next"),prevEl:i.querySelector(".swiper-button-prev")},pagination:{type:t.pagination||"bullets",dynamicBullets:t.dynamicBullets,clickable:t.clickableBullets,progressbarOpposite:t.progressbarOpposite,el:i.querySelector(".swiper-pagination")},scrollbar:{el:i.querySelector(".swiper-scrollbar"),draggable:t.scrollbarDraggable,hide:t.scrollbarHide},autoplay:t.autoplay&&{delay:t.autoplayDelay,disableOnInteraction:t.autoplayDisableOnInteraction,pauseOnMouseEnter:t.autoplayPauseOnMouseEnter,reverseDirection:t.autoplayReverseDirection,stopOnLastSlide:t.autoplayStopOnLastSlide,waitForTransition:t.autoplayWaitForTransition}};if(t.tablet){const{tabletBreakpoint:_,tabletSlidesPerView:g}=t,E=r(_);v.breakpoints[E]={slidesPerView:isNaN(g)?g:r(g),slidesPerGroup:r(t.tabletSlidesPerGroup),spaceBetween:r(t.tabletSpaceBetween)}}if(t.mobile){const{mobileBreakpoint:_,mobileSlidesPerView:g}=t,E=r(_);v.breakpoints[E]={slidesPerView:isNaN(g)?g:r(g),slidesPerGroup:r(t.mobileSlidesPerGroup),spaceBetween:r(t.mobileSpaceBetween)}}S&&!$&&(v.simulateTouch=!1),R&&(v.initialSlide=R);const W=new A.Swiper(i,v);S==null||S(W)};if(A.Swiper)z();else{const{head:v}=document,W=Array.isArray(D)?[...D]:[D],_=Array.isArray(I)?[...I]:[I],g=w=>{if(w.length){const y=document.createElement("link");y.href=w.shift(),y.rel="stylesheet",v.appendChild(y),g(w)}},E=w=>{if(w.length){const y=document.createElement("script");y.src=w.shift(),y.onerror=y.onload=E.bind(null,w),v.appendChild(y)}else z()};g(_),E(W)}},o=(t=0)=>({type:M,style:{padding:"50px"},components:{type:"text",components:{type:"textnode",content:`Slide ${t}`}}}),h=a.getType("default").model;return a.addType(m,{block:b&&{label:Z,media:p.slider,category:"Extra",select:!0,...l.block},isComponent:t=>P(t,q),model:{defaults:()=>({name:Z,icon:p.slider,classes:q,draggable:(t,i)=>!i.is(m),components:[{type:x,components:[o(1),o(2),o(3)]},{type:k}],script:u,cdnScript:l.cdnScript,cdnStyle:l.cdnStyle,"script-props":["cdnScript","cdnStyle",...c.propKeys],...c.props,traits:[...c.traits]}),init(){const{em:t}=this;fe(this,c.traits),he(this,c.propKeys),this.listenTo(t,`${d.runCommand}${f}`,this.onPreviewOn),this.listenTo(t,`${d.stopCommand}${f}`,this.onPreviewOff)},onPreviewOn(){this.__inPreview=!0,this.reloadSlider()},onPreviewOff(){this.__inPreview=!1,this.reloadSlider()},reloadSlider(){this.trigger("rerender")},addSlide(){const t=this.findFirstType(x);t==null||t.append(this.getNewSlideComponentDef())},getNewSlideComponentDef(){var i;const t=((i=this.findFirstType(x))==null?void 0:i.components().length)||0;return{type:M,components:{type:"text",components:{type:"textnode",content:`Slide ${t+1}`}}}},toJSON(...t){const i=h.prototype.toJSON.apply(this,t);return c.propsNoValues.forEach(A=>delete i[A]),delete i["script-props"],i}},view:{init(){this.listenTo(this.model,a.events.scriptUnmount,this.destroySwiper)},getSwiper(){return this.el.swiper},destroySwiper(){var t;(t=this.getSwiper())==null||t.destroy()},onRender(){const t=this.el;t.__onLoad=i=>i.on("slideChange",()=>this.__activeSlide=i.activeIndex),t.__activeSlide=this.__activeSlide,t.__inPreview=this.model.__inPreview}}}),()=>{a.removeType(m),s.remove(m)}},ge="Nav Prev",ye="Nav Next",O=`${C}button-prev`,B=`${C}button-next`,Se=e=>{const{Components:l}=e,a=s=>({type:"svg",selectable:!1,hoverable:!1,attributes:{viewBox:"0 0 27 44"},components:{type:"svg-in",tagName:"path",attributes:{d:s,fill:"currentColor"}}});return l.addType(L,{isComponent:s=>P(s,O),model:{defaults:{name:ge,classes:O,copyable:!1,highlightable:!1,droppable:!1,draggable:!1,selectable:!1,hoverable:!1,layerable:!1,components:a("M0,22L22,0l2.1,2.1L4.2,22l19.9,19.9L22,44L0,22L0,22L0,22z"),styles:`
|
|
24
|
+
</svg>`},j={id:"swiper-responsive",label:"Responsive",icon:p.responsive},K={id:"swiper-extra",label:"Extra",icon:p.extra},ve={actions:{type:"radio",label:!1,labelToTitle:!0,options:[{id:"r",label:"Reload slider",icon:p.reload},{id:"p",label:"Previous slide",icon:p.prev},{id:"n",label:"Next slide",icon:p.next},{id:"a",label:"Add new slide",icon:p.add}],setValue:({component:e,value:l})=>{var s;const a=(s=e.getView())==null?void 0:s.getSwiper();switch(l){case"r":e.reloadSlider();break;case"p":a==null||a.slidePrev();break;case"n":a==null||a.slideNext();break;case"a":e.addSlide();break}}},vertical:{type:"checkbox",label:"Vertical",value:!1},loop:{type:"checkbox",label:"Loop",value:!1},freeMode:{type:"checkbox",label:"Free mode",value:!1},autoHeight:{type:"checkbox",label:"Auto height",value:!1},navigation:{type:"checkbox",label:"Navigation",getValue:({component:e})=>!!e.findFirstType(L),setValue:({component:e,value:l})=>{var a,s;l?e.append([{type:L},{type:V}]):((a=e.findFirstType(L))==null||a.remove(),(s=e.findFirstType(V))==null||s.remove()),e.set({navigation:l})}},initialSlide:{type:"number",label:"Initial slide",min:0,value:"0"},speed:{type:"number",label:"Speed",tip:"Transition duration (in ms)",step:500,min:0,value:300},effect:{category:{id:"swiper-effect",label:"Effects",icon:p.effect},type:"select",label:"Effect Type",value:"slide",options:[{id:"slide",label:"Slide"},{id:"fade",label:"Fade"},{id:"cube",label:"Cube"},{id:"coverflow",label:"Coverflow"},{id:"flip",label:"Flip"},{id:"cards",label:"Cards"}],subTraits:{slide:[{type:"number",name:"slidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"slidesPerGroup",label:"Slides per group",tip:"Numbers of slides for group sliding",changeProp:!0,min:1,value:1},{type:"number",name:"spaceBetween",label:"Space between",tip:"Distance between slides in px",changeProp:!0,min:0,value:0},{type:"number",name:"slidesOffsetBefore",label:"Slides offset before",tip:"Add additional slide offset in the beginning of the container (in px, before all slides)",changeProp:!0,min:0,value:0},{type:"number",name:"slidesOffsetAfter",label:"Slides offset after",tip:"Add additional slide offset in the end of the container (in px, after all slides)",changeProp:!0,min:0,value:0},{type:"checkbox",name:"centeredSlides",label:"Centered slides",tip:"If enabled, the active slide will be centered",changeProp:!0,value:!1}],fade:[{type:"checkbox",name:"crossFade",tip:"Enables slides cross fade",label:"Cross fade",changeProp:!0,value:!1}],cube:[{type:"checkbox",name:"cubeEffectShadow",label:"Shadow",changeProp:!0,value:!0},{type:"checkbox",name:"cubeEffectSlideShadows",label:"Slide shadows",changeProp:!0,value:!0},{type:"number",name:"cubeEffectShadowOffset",label:"Shadow offset",changeProp:!0,value:20},{type:"number",name:"cubeEffectShadowScale",label:"Shadow scale",changeProp:!0,value:.94}],coverflow:[{type:"number",name:"coverflowEffectDepth",tip:"Depth offset in px (slides translate in Z axis)",label:"Depth",changeProp:!0,min:0,value:100},{type:"number",name:"coverflowEffectModifier",tip:"Effect multiplier",label:"Modifier",changeProp:!0,step:.1,min:0,value:1},{type:"number",name:"coverflowEffectRotate",tip:"Slide rotate in degrees",label:"Rotate",changeProp:!0,min:0,value:50},{type:"number",name:"coverflowEffectScale",tip:"Slide scale effect",label:"Scale",changeProp:!0,min:0,step:.1,value:1},{type:"number",name:"coverflowEffectStretch",tip:"Stretch space between slides (in px)",label:"Stretch",changeProp:!0,min:0,value:0},{type:"checkbox",name:"coverflowEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadow",changeProp:!0,value:!0}],flip:[{type:"checkbox",name:"flipEffectLimitRotation",tip:"Limit edge slides rotation",label:"Limit rotation",changeProp:!0,value:!0},{type:"checkbox",name:"flipEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadows",changeProp:!0,value:!0}],cards:[{type:"number",name:"cardsEffectPerSlideOffset",tip:"Offset distance per slide (in px)",label:"Slide offset",changeProp:!0,min:0,value:8},{type:"number",name:"cardsEffectPerSlideRotate",tip:"Rotate angle per slide (in degrees)",label:"Slide rotate",changeProp:!0,min:0,value:2},{type:"checkbox",name:"cardsEffectRotate",tip:"Enables cards rotation",label:"Rotate",changeProp:!0,value:!0},{type:"checkbox",name:"cardsEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadows",changeProp:!0,value:!0}]}},autoplay:{category:{id:"swiper-autoplay",label:"Autoplay",icon:p.autoplay},type:"checkbox",label:"Enable Autoplay",value:!1,subTraits:{true:[{type:"number",name:"autoplayDelay",label:"Delay",changeProp:!0,value:3e3},{type:"checkbox",name:"autoplayDisableOnInteraction",label:"Disable on interaction",changeProp:!0,value:!0},{type:"checkbox",name:"autoplayWaitForTransition",label:"Wait for transition",changeProp:!0,value:!0},{type:"checkbox",name:"autoplayPauseOnMouseEnter",label:"Pause on mouse enter",changeProp:!0,value:!1},{type:"checkbox",name:"autoplayReverseDirection",label:"Reverse direction",changeProp:!0,value:!1},{type:"checkbox",name:"autoplayStopOnLastSlide",label:"Stop on last slide",changeProp:!0,value:!1}]}},pagination:{category:{id:"swiper-pagination",label:"Pagination",icon:p.pagination},type:"select",label:"Pagination Type",options:[{id:"none",label:"None"},{id:"bullets",label:"Bullets"},{id:"progressbar",label:"Progressbar"},{id:"fraction",label:"Fraction"}],getValue:({component:e})=>e.findFirstType(k)?e.get("pagination")||"bullets":"none",setValue:({component:e,value:l})=>{const a=e.findFirstType(k);a==null||a.remove(),l!=="none"&&e.append({type:k}),e.set({pagination:l})},subTraits:{bullets:[{type:"checkbox",name:"dynamicBullets",label:"Dynamic bullets",changeProp:!0,value:!1},{type:"checkbox",name:"clickableBullets",label:"Clickable bullets",changeProp:!0,value:!0}],progressbar:[{type:"checkbox",name:"progressbarOpposite",label:"Progress opposite",changeProp:!0,value:!1}]}},scrollbar:{category:{id:"swiper-scrollbar",label:"Scrollbar",icon:p.scrollbar},type:"checkbox",label:"Enable Scrollbar",getValue:({component:e})=>!!e.findFirstType(N),setValue:({component:e,value:l})=>{const a=e.findFirstType(N);a==null||a.remove(),l&&e.append({type:N}),e.set({scrollbar:l})},subTraits:{false:[],true:[{type:"checkbox",name:"scrollbarDraggable",label:"Draggable",changeProp:!0,value:!1},{type:"checkbox",name:"scrollbarHide",label:"Hide",tip:"Hide scrollbar automatically after user interaction",changeProp:!0,value:!0}]}},parallax:{category:{id:"swiper-parallax",label:"Parallax",icon:p.parallax},type:"checkbox",label:"Enable Parallax",value:!1},mobile:{category:j,type:"checkbox",label:"Enable mobile breakpoint",value:!1,subTraits:{true:[{type:"number",name:"mobileBreakpoint",label:"Mobile breakpoint",tip:"Slide values below will be applied when the screen width is greater than this value",changeProp:!0,min:1,value:460},{type:"number",name:"mobileSlidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"mobileSlidesPerGroup",label:"Slides per group",changeProp:!0,min:1,value:1},{type:"number",name:"mobileSpaceBetween",label:"Space between",changeProp:!0,min:0,value:0}]}},tablet:{category:j,type:"checkbox",label:"Enable tablet breakpoint",value:!1,subTraits:{true:[{type:"number",name:"tabletBreakpoint",label:"Tablet breakpoint",tip:"Slide values below will be applied when the screen width is greater than this value",changeProp:!0,min:1,value:991},{type:"number",name:"tabletSlidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"tabletSlidesPerGroup",label:"Slides per group",changeProp:!0,min:1,value:1},{type:"number",name:"tabletSpaceBetween",label:"Space between",changeProp:!0,min:0,value:0}]}},allowTouchMove:{category:K,type:"checkbox",label:"Allow touch move",tip:"Allow touch interactions",value:!0},grabCursor:{category:K,type:"checkbox",label:"Grab cursor",tip:'If enabled, the user will see the "grab" cursor when hover the slider',value:!1}},Z="Slider",q="swiper",C=`${q}-`,me=(e,l)=>{const{Components:a,Blocks:s,Commands:i}=e,{block:b}=l,c=be(ve),f="core:preview",d=i.events,u=function(t){const n=this,A=window,S=n.__onLoad,R=n.__activeSlide,$=n.__inPreview,{cdnScript:D,cdnStyle:I,slidesPerView:F}=t||{},r=v=>isNaN(v)?void 0:parseFloat(v),z=()=>{const v={loop:t.loop,speed:t.speed,initialSlide:t.initialSlide,direction:t.vertical?"vertical":"horizontal",effect:t.effect,freeMode:t.freeMode,parallax:t.parallax,autoHeight:t.autoHeight,allowTouchMove:t.allowTouchMove,grabCursor:t.grabCursor,simulateTouch:!0,breakpoints:{},slidesPerView:isNaN(F)?F:r(F),slidesPerGroup:r(t.slidesPerGroup),spaceBetween:r(t.spaceBetween),slidesOffsetBefore:r(t.slidesOffsetBefore),slidesOffsetAfter:r(t.slidesOffsetAfter),centeredSlides:t.centeredSlides,fadeEffect:{crossFade:t.crossFade},cubeEffect:{shadow:t.cubeEffectShadow,slideShadows:t.cubeEffectSlideShadows,shadowOffset:r(t.cubeEffectShadowOffset),shadowScale:r(t.cubeEffectShadowScale)},coverflowEffect:{depth:r(t.coverflowEffectDepth),modifier:r(t.coverflowEffectModifier),rotate:r(t.coverflowEffectRotate),scale:r(t.coverflowEffectScale),stretch:r(t.coverflowEffectStretch),slideShadows:t.coverflowEffectSlideShadows},flipEffect:{limitRotation:t.flipEffectLimitRotation,slideShadows:t.flipEffectSlideShadows},cardsEffect:{perSlideOffset:r(t.cardsEffectPerSlideOffset),perSlideRotate:r(t.cardsEffectPerSlideRotate),rotate:t.cardsEffectRotate,slideShadows:t.cardsEffectSlideShadows},navigation:{nextEl:n.querySelector(".swiper-button-next"),prevEl:n.querySelector(".swiper-button-prev")},pagination:{type:t.pagination||"bullets",dynamicBullets:t.dynamicBullets,clickable:t.clickableBullets,progressbarOpposite:t.progressbarOpposite,el:n.querySelector(".swiper-pagination")},scrollbar:{el:n.querySelector(".swiper-scrollbar"),draggable:t.scrollbarDraggable,hide:t.scrollbarHide},autoplay:t.autoplay&&{delay:t.autoplayDelay,disableOnInteraction:t.autoplayDisableOnInteraction,pauseOnMouseEnter:t.autoplayPauseOnMouseEnter,reverseDirection:t.autoplayReverseDirection,stopOnLastSlide:t.autoplayStopOnLastSlide,waitForTransition:t.autoplayWaitForTransition}};if(t.tablet){const{tabletBreakpoint:_,tabletSlidesPerView:g}=t,E=r(_);v.breakpoints[E]={slidesPerView:isNaN(g)?g:r(g),slidesPerGroup:r(t.tabletSlidesPerGroup),spaceBetween:r(t.tabletSpaceBetween)}}if(t.mobile){const{mobileBreakpoint:_,mobileSlidesPerView:g}=t,E=r(_);v.breakpoints[E]={slidesPerView:isNaN(g)?g:r(g),slidesPerGroup:r(t.mobileSlidesPerGroup),spaceBetween:r(t.mobileSpaceBetween)}}S&&!$&&(v.simulateTouch=!1),R&&(v.initialSlide=R);const W=new A.Swiper(n,v);S==null||S(W)};if(A.Swiper)z();else{const{head:v}=document,W=Array.isArray(D)?[...D]:[D],_=Array.isArray(I)?[...I]:[I],g=w=>{if(w.length){const y=document.createElement("link");y.href=w.shift(),y.rel="stylesheet",v.appendChild(y),g(w)}},E=w=>{if(w.length){const y=document.createElement("script");y.src=w.shift(),y.onerror=y.onload=E.bind(null,w),v.appendChild(y)}else z()};g(_),E(W)}},o=(t=0)=>({type:M,style:{padding:"50px"},components:{type:"text",components:{type:"textnode",content:`Slide ${t}`}}}),h=a.getType("default").model;return a.addType(m,{block:b&&{label:Z,media:p.slider,category:"Extra",select:!0,...l.block},isComponent:t=>P(t,q),model:{defaults:()=>({name:Z,icon:p.slider,classes:q,draggable:(t,n)=>!n.is(m),components:[{type:x,components:[o(1),o(2),o(3)]},{type:k}],script:u,cdnScript:l.cdnScript,cdnStyle:l.cdnStyle,"script-props":["cdnScript","cdnStyle",...c.propKeys],...c.props,traits:[...c.traits]}),init(){const{em:t}=this;fe(this,c.traits),he(this,c.propKeys),this.listenTo(t,`${d.runCommand}${f}`,this.onPreviewOn),this.listenTo(t,`${d.stopCommand}${f}`,this.onPreviewOff)},onPreviewOn(){this.__inPreview=!0,this.reloadSlider()},onPreviewOff(){this.__inPreview=!1,this.reloadSlider()},reloadSlider(){this.trigger("rerender")},addSlide(){const t=this.findFirstType(x);t==null||t.append(this.getNewSlideComponentDef())},getNewSlideComponentDef(){var n;const t=((n=this.findFirstType(x))==null?void 0:n.components().length)||0;return{type:M,components:{type:"text",components:{type:"textnode",content:`Slide ${t+1}`}}}},toJSON(...t){const n=h.prototype.toJSON.apply(this,t);return c.propsNoValues.forEach(A=>delete n[A]),delete n["script-props"],n}},view:{init(){this.listenTo(this.model,a.events.scriptUnmount,this.destroySwiper)},getSwiper(){return this.el.swiper},destroySwiper(){var t;(t=this.getSwiper())==null||t.destroy()},onRender(){const t=this.el;t.__onLoad=n=>n.on("slideChange",()=>this.__activeSlide=n.activeIndex),t.__activeSlide=this.__activeSlide,t.__inPreview=this.model.__inPreview}}}),()=>{a.removeType(m),s.remove(m)}},ge="Nav Prev",ye="Nav Next",O=`${C}button-prev`,B=`${C}button-next`,Se=e=>{const{Components:l}=e,a=s=>({type:"svg",selectable:!1,hoverable:!1,attributes:{viewBox:"0 0 27 44"},components:{type:"svg-in",tagName:"path",attributes:{d:s,fill:"currentColor"}}});return l.addType(L,{isComponent:s=>P(s,O),model:{defaults:{name:ge,classes:O,copyable:!1,highlightable:!1,droppable:!1,draggable:!1,selectable:!1,hoverable:!1,layerable:!1,components:a("M0,22L22,0l2.1,2.1L4.2,22l19.9,19.9L22,44L0,22L0,22L0,22z"),styles:`
|
|
25
25
|
.${O} {
|
|
26
26
|
color: inherit;
|
|
27
27
|
}
|
|
@@ -42,4 +42,4 @@
|
|
|
42
42
|
.${a}-progressbar-fill {
|
|
43
43
|
--swiper-pagination-color: currentColor;
|
|
44
44
|
}
|
|
45
|
-
`}}}),()=>{l.removeType(k)}},Pe="Scrollbar",Y=`${C}scrollbar`,Ee=e=>{const{Components:l}=e;return l.addType(N,{isComponent:a=>P(a,Y),model:{defaults:{name:Pe,classes:Y,copyable:!1,highlightable:!1,removable:!1,selectable:!1,hoverable:!1,layerable:!1,droppable:!1,draggable:!1}}}),()=>{l.removeType(N)}},Te="Slide",X=`${C}slide`,xe=e=>{const{Components:l}=e;return l.addType(M,{isComponent:a=>P(a,X),model:{defaults:{name:Te,classes:X,icon:p.slider,draggable:(a,s)=>s.is(x)}}}),()=>{l.removeType(M)}},Le="Wrapper",J=`${C}wrapper`,ke=e=>{const{Components:l}=e,{events:a}=l;return l.addType(x,{isComponent:s=>P(s,J),model:{defaults:{name:Le,icon:p.slider,classes:J,copyable:!1,removable:!1,draggable:!1,highlightable:!1,droppable:s=>s.is(M)},init(){const s=this.components();this.listenTo(s,"add remove",this.updateSlider)},updateSlider(s){const
|
|
45
|
+
`}}}),()=>{l.removeType(k)}},Pe="Scrollbar",Y=`${C}scrollbar`,Ee=e=>{const{Components:l}=e;return l.addType(N,{isComponent:a=>P(a,Y),model:{defaults:{name:Pe,classes:Y,copyable:!1,highlightable:!1,removable:!1,selectable:!1,hoverable:!1,layerable:!1,droppable:!1,draggable:!1}}}),()=>{l.removeType(N)}},Te="Slide",X=`${C}slide`,xe=e=>{const{Components:l}=e;return l.addType(M,{isComponent:a=>P(a,X),model:{defaults:{name:Te,classes:X,icon:p.slider,draggable:(a,s)=>s.is(x)}}}),()=>{l.removeType(M)}},Le="Wrapper",J=`${C}wrapper`,ke=e=>{const{Components:l}=e,{events:a}=l;return l.addType(x,{isComponent:s=>P(s,J),model:{defaults:{name:Le,icon:p.slider,classes:J,copyable:!1,removable:!1,draggable:!1,highlightable:!1,droppable:s=>s.is(M)},init(){const s=this.components();this.listenTo(s,"add remove",this.updateSlider)},updateSlider(s){const i=this.closestType(m);if(i){const b=i.getView();i.reloadSlider(),this.em.once(a.scriptMount,()=>{setTimeout(()=>{var c;return(c=b.getSwiper())==null?void 0:c.slideTo(s.index())},100)})}}}}),()=>{l.removeType(x)}},Ce="swiperComponent",Ae=function(e,l={}){const a={block:{},cdnScript:"https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js",cdnStyle:"https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css",...l},s=[me(e,a),Se(e),ke(e),xe(e),we(e),Ee(e)];pe({editor:e,plan:T.startup,licenseKey:a.licenseKey,pluginName:Ce,cleanup:()=>{s.forEach(i=>i())}})},_e=de(Ae);module.exports=_e;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import "grapesjs";
|
|
2
1
|
const Q = "app.grapesjs.com", ee = "app-stage.grapesjs.com", H = [
|
|
3
2
|
Q,
|
|
4
3
|
ee,
|
|
@@ -1073,7 +1072,7 @@ const P = (e, l) => {
|
|
|
1073
1072
|
s.forEach((i) => i());
|
|
1074
1073
|
}
|
|
1075
1074
|
});
|
|
1076
|
-
},
|
|
1075
|
+
}, _e = de(Ae);
|
|
1077
1076
|
export {
|
|
1078
|
-
|
|
1077
|
+
_e as default
|
|
1079
1078
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(E,T){typeof exports=="object"&&typeof module<"u"?module.exports=T(
|
|
1
|
+
(function(E,T){typeof exports=="object"&&typeof module<"u"?module.exports=T():typeof define=="function"&&define.amd?define(T):(E=typeof globalThis<"u"?globalThis:E||self,E.StudioSdkPlugins_swiperComponent=T())})(this,function(){"use strict";const E="app.grapesjs.com",T="app-stage.grapesjs.com",G=[E,T,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],te="license:check:start",ae="license:check:end",le=()=>typeof window<"u",ne=({isDev:e,isStage:l})=>`${e?"":`https://${l?T:E}`}/api`,ie=()=>{const e=le()&&window.location.hostname;return!!e&&(G.includes(e)||G.some(l=>e.endsWith(l)))},se=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(l,a)=>(a?"-":"")+l.toLowerCase()),oe=e=>typeof e<"u";async function re({path:e,baseApiUrl:l,method:a="GET",headers:n={},params:s,body:b}){const f=`${l||ne({isDev:!1,isStage:!1})}${e}`,p={method:a,headers:{"Content-Type":"application/json",...n}};b&&(p.body=JSON.stringify(b));const u=s?new URLSearchParams(s).toString():"",o=u?`?${u}`:"",h=await fetch(`${f}${o}`,p);if(!h.ok)throw new Error(`HTTP error! status: ${h.status}`);return h.json()}var x=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(x||{});const U={[x.free]:0,[x.startup]:10,[x.business]:20,[x.enterprise]:30};function ce(e){const l=e;return l.init=a=>n=>e(n,a),l}const de=e=>ce(e);async function pe({editor:e,plan:l,pluginName:a,licenseKey:n,cleanup:s}){let b="",c=!1;const f=ie(),p=o=>{console.warn("Cleanup plugin:",a,"Reason:",o),s()},u=(o={})=>{var w;const{error:h,sdkLicense:t}=o,i=(w=o.plan)==null?void 0:w.category;if(!(t||o.license)||h)p(h||"Invalid license");else if(i){const D=U[l],F=U[i];D>F&&p({pluginRequiredPlan:l,licensePlan:i})}};e.on(te,o=>{b=o==null?void 0:o.baseApiUrl,c=!0}),e.on(ae,o=>{u(o)}),setTimeout(async()=>{if(!c){if(f)return;if(n){const o=await ue({licenseKey:n,pluginName:a,baseApiUrl:b});o&&u(o)}else p("The `licenseKey` option not provided")}},2e3)}async function ue(e){const{licenseKey:l,pluginName:a,baseApiUrl:n}=e;try{return(await re({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 S=(e,l)=>{var a;return!!((a=e==null?void 0:e.classList)!=null&&a.contains(l))},be=(e,l={})=>{var b;const a={},n=[],s=[];for(const c in e){const{value:f,...p}=e[c];n.push({id:c,name:c,changeProp:!0,category:l.category,...p}),a[c]=f,!oe(f)&&s.push(c);const{subTraits:u={}}=p;for(const o in p.subTraits)(b=u[o])==null||b.forEach(h=>{const t=h.id||h.name;a[t]=h.value})}return{propKeys:Object.keys(a),propsNoValues:s,props:a,traits:n}},fe=(e,l)=>{l.forEach(a=>{if(a.subTraits){const n=`${a.id||a.name}`,s=a.changeProp?`change:${n}`:`change:attributes:${n}`;e.on(s,()=>j(e,n)),j(e,n)}})},j=(e,l)=>{const a=e.getTrait(l),n=a.get("category"),s=a.get("subTraits")||{},c=(Object.values(s).flat()||[]).map(u=>u.id||u.name);e.removeTrait(c);const f=s[a.getValue()],p=e.getTraitIndex(l)+1;f&&e.addTrait(f.map(u=>({category:n,...u})),{at:p})},he=(e,l)=>{l.forEach(a=>{const n=se(a);n!==a&&e.has(n)&&e.set({[a]:e.get(n),[n]:void 0})})},v="swiper",N=`${v}-slide`,L=`${v}-wrapper`,k=`${v}-nav-prev`,B=`${v}-nav-next`,C=`${v}-pagination`,M=`${v}-scrollbar`,d={slider:`<svg viewBox="0 0 24 24">
|
|
2
2
|
<path d="M22 7.6c0-1-.5-1.6-1.3-1.6H3.4C2.5 6 2 6.7 2 7.6v9.8c0 1 .5 1.6 1.3 1.6h17.4c.8 0 1.3-.6 1.3-1.6V7.6zM21 18H3V7h18v11z" fill-rule="nonzero"/>
|
|
3
3
|
<path d="M4 12.5L6 14v-3zM20 12.5L18 14v-3z"/>
|
|
4
4
|
</svg>`,effect:`<svg viewBox="0 0 24 24">
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
<path d="M2 12c0 5 4 9 9 9 2.4 0 4.7-1 6.4-2.6l-1.5-1.5A6.7 6.7 0 0 1 11 19a7 7 0 1 1 7-7h-3l4 4h.1l3.9-4h-3a9 9 0 0 0-18 0Z"/>
|
|
22
22
|
</svg>`,prev:'<svg viewBox="0 0 24 24"><path d="M15.4 16.6 10.8 12l4.6-4.6L14 6l-6 6 6 6 1.4-1.4Z"/></svg>',next:'<svg viewBox="0 0 24 24"><path d="m8.6 16.6 4.6-4.6-4.6-4.6L10 6l6 6-6 6-1.4-1.4Z"/></svg>',add:`<svg viewBox="0 0 24 24">
|
|
23
23
|
<path d="M12 20a8 8 0 1 1 0-16 8 8 0 0 1 0 16m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m1 5h-2v4H7v2h4v4h2v-4h4v-2h-4V7Z"/>
|
|
24
|
-
</svg>`},K={id:"swiper-responsive",label:"Responsive",icon:d.responsive},Z={id:"swiper-extra",label:"Extra",icon:d.extra},ve={actions:{type:"radio",label:!1,labelToTitle:!0,options:[{id:"r",label:"Reload slider",icon:d.reload},{id:"p",label:"Previous slide",icon:d.prev},{id:"n",label:"Next slide",icon:d.next},{id:"a",label:"Add new slide",icon:d.add}],setValue:({component:e,value:l})=>{var n;const a=(n=e.getView())==null?void 0:n.getSwiper();switch(l){case"r":e.reloadSlider();break;case"p":a==null||a.slidePrev();break;case"n":a==null||a.slideNext();break;case"a":e.addSlide();break}}},vertical:{type:"checkbox",label:"Vertical",value:!1},loop:{type:"checkbox",label:"Loop",value:!1},freeMode:{type:"checkbox",label:"Free mode",value:!1},autoHeight:{type:"checkbox",label:"Auto height",value:!1},navigation:{type:"checkbox",label:"Navigation",getValue:({component:e})=>!!e.findFirstType(k),setValue:({component:e,value:l})=>{var a,n;l?e.append([{type:k},{type:B}]):((a=e.findFirstType(k))==null||a.remove(),(n=e.findFirstType(B))==null||n.remove()),e.set({navigation:l})}},initialSlide:{type:"number",label:"Initial slide",min:0,value:"0"},speed:{type:"number",label:"Speed",tip:"Transition duration (in ms)",step:500,min:0,value:300},effect:{category:{id:"swiper-effect",label:"Effects",icon:d.effect},type:"select",label:"Effect Type",value:"slide",options:[{id:"slide",label:"Slide"},{id:"fade",label:"Fade"},{id:"cube",label:"Cube"},{id:"coverflow",label:"Coverflow"},{id:"flip",label:"Flip"},{id:"cards",label:"Cards"}],subTraits:{slide:[{type:"number",name:"slidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"slidesPerGroup",label:"Slides per group",tip:"Numbers of slides for group sliding",changeProp:!0,min:1,value:1},{type:"number",name:"spaceBetween",label:"Space between",tip:"Distance between slides in px",changeProp:!0,min:0,value:0},{type:"number",name:"slidesOffsetBefore",label:"Slides offset before",tip:"Add additional slide offset in the beginning of the container (in px, before all slides)",changeProp:!0,min:0,value:0},{type:"number",name:"slidesOffsetAfter",label:"Slides offset after",tip:"Add additional slide offset in the end of the container (in px, after all slides)",changeProp:!0,min:0,value:0},{type:"checkbox",name:"centeredSlides",label:"Centered slides",tip:"If enabled, the active slide will be centered",changeProp:!0,value:!1}],fade:[{type:"checkbox",name:"crossFade",tip:"Enables slides cross fade",label:"Cross fade",changeProp:!0,value:!1}],cube:[{type:"checkbox",name:"cubeEffectShadow",label:"Shadow",changeProp:!0,value:!0},{type:"checkbox",name:"cubeEffectSlideShadows",label:"Slide shadows",changeProp:!0,value:!0},{type:"number",name:"cubeEffectShadowOffset",label:"Shadow offset",changeProp:!0,value:20},{type:"number",name:"cubeEffectShadowScale",label:"Shadow scale",changeProp:!0,value:.94}],coverflow:[{type:"number",name:"coverflowEffectDepth",tip:"Depth offset in px (slides translate in Z axis)",label:"Depth",changeProp:!0,min:0,value:100},{type:"number",name:"coverflowEffectModifier",tip:"Effect multiplier",label:"Modifier",changeProp:!0,step:.1,min:0,value:1},{type:"number",name:"coverflowEffectRotate",tip:"Slide rotate in degrees",label:"Rotate",changeProp:!0,min:0,value:50},{type:"number",name:"coverflowEffectScale",tip:"Slide scale effect",label:"Scale",changeProp:!0,min:0,step:.1,value:1},{type:"number",name:"coverflowEffectStretch",tip:"Stretch space between slides (in px)",label:"Stretch",changeProp:!0,min:0,value:0},{type:"checkbox",name:"coverflowEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadow",changeProp:!0,value:!0}],flip:[{type:"checkbox",name:"flipEffectLimitRotation",tip:"Limit edge slides rotation",label:"Limit rotation",changeProp:!0,value:!0},{type:"checkbox",name:"flipEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadows",changeProp:!0,value:!0}],cards:[{type:"number",name:"cardsEffectPerSlideOffset",tip:"Offset distance per slide (in px)",label:"Slide offset",changeProp:!0,min:0,value:8},{type:"number",name:"cardsEffectPerSlideRotate",tip:"Rotate angle per slide (in degrees)",label:"Slide rotate",changeProp:!0,min:0,value:2},{type:"checkbox",name:"cardsEffectRotate",tip:"Enables cards rotation",label:"Rotate",changeProp:!0,value:!0},{type:"checkbox",name:"cardsEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadows",changeProp:!0,value:!0}]}},autoplay:{category:{id:"swiper-autoplay",label:"Autoplay",icon:d.autoplay},type:"checkbox",label:"Enable Autoplay",value:!1,subTraits:{true:[{type:"number",name:"autoplayDelay",label:"Delay",changeProp:!0,value:3e3},{type:"checkbox",name:"autoplayDisableOnInteraction",label:"Disable on interaction",changeProp:!0,value:!0},{type:"checkbox",name:"autoplayWaitForTransition",label:"Wait for transition",changeProp:!0,value:!0},{type:"checkbox",name:"autoplayPauseOnMouseEnter",label:"Pause on mouse enter",changeProp:!0,value:!1},{type:"checkbox",name:"autoplayReverseDirection",label:"Reverse direction",changeProp:!0,value:!1},{type:"checkbox",name:"autoplayStopOnLastSlide",label:"Stop on last slide",changeProp:!0,value:!1}]}},pagination:{category:{id:"swiper-pagination",label:"Pagination",icon:d.pagination},type:"select",label:"Pagination Type",options:[{id:"none",label:"None"},{id:"bullets",label:"Bullets"},{id:"progressbar",label:"Progressbar"},{id:"fraction",label:"Fraction"}],getValue:({component:e})=>e.findFirstType(C)?e.get("pagination")||"bullets":"none",setValue:({component:e,value:l})=>{const a=e.findFirstType(C);a==null||a.remove(),l!=="none"&&e.append({type:C}),e.set({pagination:l})},subTraits:{bullets:[{type:"checkbox",name:"dynamicBullets",label:"Dynamic bullets",changeProp:!0,value:!1},{type:"checkbox",name:"clickableBullets",label:"Clickable bullets",changeProp:!0,value:!0}],progressbar:[{type:"checkbox",name:"progressbarOpposite",label:"Progress opposite",changeProp:!0,value:!1}]}},scrollbar:{category:{id:"swiper-scrollbar",label:"Scrollbar",icon:d.scrollbar},type:"checkbox",label:"Enable Scrollbar",getValue:({component:e})=>!!e.findFirstType(M),setValue:({component:e,value:l})=>{const a=e.findFirstType(M);a==null||a.remove(),l&&e.append({type:M}),e.set({scrollbar:l})},subTraits:{false:[],true:[{type:"checkbox",name:"scrollbarDraggable",label:"Draggable",changeProp:!0,value:!1},{type:"checkbox",name:"scrollbarHide",label:"Hide",tip:"Hide scrollbar automatically after user interaction",changeProp:!0,value:!0}]}},parallax:{category:{id:"swiper-parallax",label:"Parallax",icon:d.parallax},type:"checkbox",label:"Enable Parallax",value:!1},mobile:{category:K,type:"checkbox",label:"Enable mobile breakpoint",value:!1,subTraits:{true:[{type:"number",name:"mobileBreakpoint",label:"Mobile breakpoint",tip:"Slide values below will be applied when the screen width is greater than this value",changeProp:!0,min:1,value:460},{type:"number",name:"mobileSlidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"mobileSlidesPerGroup",label:"Slides per group",changeProp:!0,min:1,value:1},{type:"number",name:"mobileSpaceBetween",label:"Space between",changeProp:!0,min:0,value:0}]}},tablet:{category:K,type:"checkbox",label:"Enable tablet breakpoint",value:!1,subTraits:{true:[{type:"number",name:"tabletBreakpoint",label:"Tablet breakpoint",tip:"Slide values below will be applied when the screen width is greater than this value",changeProp:!0,min:1,value:991},{type:"number",name:"tabletSlidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"tabletSlidesPerGroup",label:"Slides per group",changeProp:!0,min:1,value:1},{type:"number",name:"tabletSpaceBetween",label:"Space between",changeProp:!0,min:0,value:0}]}},allowTouchMove:{category:Z,type:"checkbox",label:"Allow touch move",tip:"Allow touch interactions",value:!0},grabCursor:{category:Z,type:"checkbox",label:"Grab cursor",tip:'If enabled, the user will see the "grab" cursor when hover the slider',value:!1}},Y="Slider",I="swiper",A=`${I}-`,me=(e,l)=>{const{Components:a,Blocks:n,Commands:i}=e,{block:b}=l,c=be(ve),f="core:preview",p=i.events,u=function(t){const s=this,R=window,w=s.__onLoad,D=s.__activeSlide,F=s.__inPreview,{cdnScript:W,cdnStyle:q,slidesPerView:z}=t||{},r=m=>isNaN(m)?void 0:parseFloat(m),ee=()=>{const m={loop:t.loop,speed:t.speed,initialSlide:t.initialSlide,direction:t.vertical?"vertical":"horizontal",effect:t.effect,freeMode:t.freeMode,parallax:t.parallax,autoHeight:t.autoHeight,allowTouchMove:t.allowTouchMove,grabCursor:t.grabCursor,simulateTouch:!0,breakpoints:{},slidesPerView:isNaN(z)?z:r(z),slidesPerGroup:r(t.slidesPerGroup),spaceBetween:r(t.spaceBetween),slidesOffsetBefore:r(t.slidesOffsetBefore),slidesOffsetAfter:r(t.slidesOffsetAfter),centeredSlides:t.centeredSlides,fadeEffect:{crossFade:t.crossFade},cubeEffect:{shadow:t.cubeEffectShadow,slideShadows:t.cubeEffectSlideShadows,shadowOffset:r(t.cubeEffectShadowOffset),shadowScale:r(t.cubeEffectShadowScale)},coverflowEffect:{depth:r(t.coverflowEffectDepth),modifier:r(t.coverflowEffectModifier),rotate:r(t.coverflowEffectRotate),scale:r(t.coverflowEffectScale),stretch:r(t.coverflowEffectStretch),slideShadows:t.coverflowEffectSlideShadows},flipEffect:{limitRotation:t.flipEffectLimitRotation,slideShadows:t.flipEffectSlideShadows},cardsEffect:{perSlideOffset:r(t.cardsEffectPerSlideOffset),perSlideRotate:r(t.cardsEffectPerSlideRotate),rotate:t.cardsEffectRotate,slideShadows:t.cardsEffectSlideShadows},navigation:{nextEl:s.querySelector(".swiper-button-next"),prevEl:s.querySelector(".swiper-button-prev")},pagination:{type:t.pagination||"bullets",dynamicBullets:t.dynamicBullets,clickable:t.clickableBullets,progressbarOpposite:t.progressbarOpposite,el:s.querySelector(".swiper-pagination")},scrollbar:{el:s.querySelector(".swiper-scrollbar"),draggable:t.scrollbarDraggable,hide:t.scrollbarHide},autoplay:t.autoplay&&{delay:t.autoplayDelay,disableOnInteraction:t.autoplayDisableOnInteraction,pauseOnMouseEnter:t.autoplayPauseOnMouseEnter,reverseDirection:t.autoplayReverseDirection,stopOnLastSlide:t.autoplayStopOnLastSlide,waitForTransition:t.autoplayWaitForTransition}};if(t.tablet){const{tabletBreakpoint:O,tabletSlidesPerView:g}=t,_=r(O);m.breakpoints[_]={slidesPerView:isNaN(g)?g:r(g),slidesPerGroup:r(t.tabletSlidesPerGroup),spaceBetween:r(t.tabletSpaceBetween)}}if(t.mobile){const{mobileBreakpoint:O,mobileSlidesPerView:g}=t,_=r(O);m.breakpoints[_]={slidesPerView:isNaN(g)?g:r(g),slidesPerGroup:r(t.mobileSlidesPerGroup),spaceBetween:r(t.mobileSpaceBetween)}}w&&!F&&(m.simulateTouch=!1),D&&(m.initialSlide=D);const H=new R.Swiper(s,m);w==null||w(H)};if(R.Swiper)ee();else{const{head:m}=document,H=Array.isArray(W)?[...W]:[W],O=Array.isArray(q)?[...q]:[q],g=P=>{if(P.length){const y=document.createElement("link");y.href=P.shift(),y.rel="stylesheet",m.appendChild(y),g(P)}},_=P=>{if(P.length){const y=document.createElement("script");y.src=P.shift(),y.onerror=y.onload=_.bind(null,P),m.appendChild(y)}else ee()};g(O),_(H)}},o=(t=0)=>({type:N,style:{padding:"50px"},components:{type:"text",components:{type:"textnode",content:`Slide ${t}`}}}),h=a.getType("default").model;return a.addType(v,{block:b&&{label:Y,media:d.slider,category:"Extra",select:!0,...l.block},isComponent:t=>S(t,I),model:{defaults:()=>({name:Y,icon:d.slider,classes:I,draggable:(t,s)=>!s.is(v),components:[{type:L,components:[o(1),o(2),o(3)]},{type:C}],script:u,cdnScript:l.cdnScript,cdnStyle:l.cdnStyle,"script-props":["cdnScript","cdnStyle",...c.propKeys],...c.props,traits:[...c.traits]}),init(){const{em:t}=this;fe(this,c.traits),he(this,c.propKeys),this.listenTo(t,`${p.runCommand}${f}`,this.onPreviewOn),this.listenTo(t,`${p.stopCommand}${f}`,this.onPreviewOff)},onPreviewOn(){this.__inPreview=!0,this.reloadSlider()},onPreviewOff(){this.__inPreview=!1,this.reloadSlider()},reloadSlider(){this.trigger("rerender")},addSlide(){const t=this.findFirstType(L);t==null||t.append(this.getNewSlideComponentDef())},getNewSlideComponentDef(){var s;const t=((s=this.findFirstType(L))==null?void 0:s.components().length)||0;return{type:N,components:{type:"text",components:{type:"textnode",content:`Slide ${t+1}`}}}},toJSON(...t){const s=h.prototype.toJSON.apply(this,t);return c.propsNoValues.forEach(R=>delete s[R]),delete s["script-props"],s}},view:{init(){this.listenTo(this.model,a.events.scriptUnmount,this.destroySwiper)},getSwiper(){return this.el.swiper},destroySwiper(){var t;(t=this.getSwiper())==null||t.destroy()},onRender(){const t=this.el;t.__onLoad=s=>s.on("slideChange",()=>this.__activeSlide=s.activeIndex),t.__activeSlide=this.__activeSlide,t.__inPreview=this.model.__inPreview}}}),()=>{a.removeType(v),n.remove(v)}},ge="Nav Prev",ye="Nav Next",V=`${A}button-prev`,$=`${A}button-next`,Se=e=>{const{Components:l}=e,a=n=>({type:"svg",selectable:!1,hoverable:!1,attributes:{viewBox:"0 0 27 44"},components:{type:"svg-in",tagName:"path",attributes:{d:n,fill:"currentColor"}}});return l.addType(k,{isComponent:n=>S(n,V),model:{defaults:{name:ge,classes:V,copyable:!1,highlightable:!1,droppable:!1,draggable:!1,selectable:!1,hoverable:!1,layerable:!1,components:a("M0,22L22,0l2.1,2.1L4.2,22l19.9,19.9L22,44L0,22L0,22L0,22z"),styles:`
|
|
24
|
+
</svg>`},K={id:"swiper-responsive",label:"Responsive",icon:d.responsive},Z={id:"swiper-extra",label:"Extra",icon:d.extra},ve={actions:{type:"radio",label:!1,labelToTitle:!0,options:[{id:"r",label:"Reload slider",icon:d.reload},{id:"p",label:"Previous slide",icon:d.prev},{id:"n",label:"Next slide",icon:d.next},{id:"a",label:"Add new slide",icon:d.add}],setValue:({component:e,value:l})=>{var n;const a=(n=e.getView())==null?void 0:n.getSwiper();switch(l){case"r":e.reloadSlider();break;case"p":a==null||a.slidePrev();break;case"n":a==null||a.slideNext();break;case"a":e.addSlide();break}}},vertical:{type:"checkbox",label:"Vertical",value:!1},loop:{type:"checkbox",label:"Loop",value:!1},freeMode:{type:"checkbox",label:"Free mode",value:!1},autoHeight:{type:"checkbox",label:"Auto height",value:!1},navigation:{type:"checkbox",label:"Navigation",getValue:({component:e})=>!!e.findFirstType(k),setValue:({component:e,value:l})=>{var a,n;l?e.append([{type:k},{type:B}]):((a=e.findFirstType(k))==null||a.remove(),(n=e.findFirstType(B))==null||n.remove()),e.set({navigation:l})}},initialSlide:{type:"number",label:"Initial slide",min:0,value:"0"},speed:{type:"number",label:"Speed",tip:"Transition duration (in ms)",step:500,min:0,value:300},effect:{category:{id:"swiper-effect",label:"Effects",icon:d.effect},type:"select",label:"Effect Type",value:"slide",options:[{id:"slide",label:"Slide"},{id:"fade",label:"Fade"},{id:"cube",label:"Cube"},{id:"coverflow",label:"Coverflow"},{id:"flip",label:"Flip"},{id:"cards",label:"Cards"}],subTraits:{slide:[{type:"number",name:"slidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"slidesPerGroup",label:"Slides per group",tip:"Numbers of slides for group sliding",changeProp:!0,min:1,value:1},{type:"number",name:"spaceBetween",label:"Space between",tip:"Distance between slides in px",changeProp:!0,min:0,value:0},{type:"number",name:"slidesOffsetBefore",label:"Slides offset before",tip:"Add additional slide offset in the beginning of the container (in px, before all slides)",changeProp:!0,min:0,value:0},{type:"number",name:"slidesOffsetAfter",label:"Slides offset after",tip:"Add additional slide offset in the end of the container (in px, after all slides)",changeProp:!0,min:0,value:0},{type:"checkbox",name:"centeredSlides",label:"Centered slides",tip:"If enabled, the active slide will be centered",changeProp:!0,value:!1}],fade:[{type:"checkbox",name:"crossFade",tip:"Enables slides cross fade",label:"Cross fade",changeProp:!0,value:!1}],cube:[{type:"checkbox",name:"cubeEffectShadow",label:"Shadow",changeProp:!0,value:!0},{type:"checkbox",name:"cubeEffectSlideShadows",label:"Slide shadows",changeProp:!0,value:!0},{type:"number",name:"cubeEffectShadowOffset",label:"Shadow offset",changeProp:!0,value:20},{type:"number",name:"cubeEffectShadowScale",label:"Shadow scale",changeProp:!0,value:.94}],coverflow:[{type:"number",name:"coverflowEffectDepth",tip:"Depth offset in px (slides translate in Z axis)",label:"Depth",changeProp:!0,min:0,value:100},{type:"number",name:"coverflowEffectModifier",tip:"Effect multiplier",label:"Modifier",changeProp:!0,step:.1,min:0,value:1},{type:"number",name:"coverflowEffectRotate",tip:"Slide rotate in degrees",label:"Rotate",changeProp:!0,min:0,value:50},{type:"number",name:"coverflowEffectScale",tip:"Slide scale effect",label:"Scale",changeProp:!0,min:0,step:.1,value:1},{type:"number",name:"coverflowEffectStretch",tip:"Stretch space between slides (in px)",label:"Stretch",changeProp:!0,min:0,value:0},{type:"checkbox",name:"coverflowEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadow",changeProp:!0,value:!0}],flip:[{type:"checkbox",name:"flipEffectLimitRotation",tip:"Limit edge slides rotation",label:"Limit rotation",changeProp:!0,value:!0},{type:"checkbox",name:"flipEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadows",changeProp:!0,value:!0}],cards:[{type:"number",name:"cardsEffectPerSlideOffset",tip:"Offset distance per slide (in px)",label:"Slide offset",changeProp:!0,min:0,value:8},{type:"number",name:"cardsEffectPerSlideRotate",tip:"Rotate angle per slide (in degrees)",label:"Slide rotate",changeProp:!0,min:0,value:2},{type:"checkbox",name:"cardsEffectRotate",tip:"Enables cards rotation",label:"Rotate",changeProp:!0,value:!0},{type:"checkbox",name:"cardsEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadows",changeProp:!0,value:!0}]}},autoplay:{category:{id:"swiper-autoplay",label:"Autoplay",icon:d.autoplay},type:"checkbox",label:"Enable Autoplay",value:!1,subTraits:{true:[{type:"number",name:"autoplayDelay",label:"Delay",changeProp:!0,value:3e3},{type:"checkbox",name:"autoplayDisableOnInteraction",label:"Disable on interaction",changeProp:!0,value:!0},{type:"checkbox",name:"autoplayWaitForTransition",label:"Wait for transition",changeProp:!0,value:!0},{type:"checkbox",name:"autoplayPauseOnMouseEnter",label:"Pause on mouse enter",changeProp:!0,value:!1},{type:"checkbox",name:"autoplayReverseDirection",label:"Reverse direction",changeProp:!0,value:!1},{type:"checkbox",name:"autoplayStopOnLastSlide",label:"Stop on last slide",changeProp:!0,value:!1}]}},pagination:{category:{id:"swiper-pagination",label:"Pagination",icon:d.pagination},type:"select",label:"Pagination Type",options:[{id:"none",label:"None"},{id:"bullets",label:"Bullets"},{id:"progressbar",label:"Progressbar"},{id:"fraction",label:"Fraction"}],getValue:({component:e})=>e.findFirstType(C)?e.get("pagination")||"bullets":"none",setValue:({component:e,value:l})=>{const a=e.findFirstType(C);a==null||a.remove(),l!=="none"&&e.append({type:C}),e.set({pagination:l})},subTraits:{bullets:[{type:"checkbox",name:"dynamicBullets",label:"Dynamic bullets",changeProp:!0,value:!1},{type:"checkbox",name:"clickableBullets",label:"Clickable bullets",changeProp:!0,value:!0}],progressbar:[{type:"checkbox",name:"progressbarOpposite",label:"Progress opposite",changeProp:!0,value:!1}]}},scrollbar:{category:{id:"swiper-scrollbar",label:"Scrollbar",icon:d.scrollbar},type:"checkbox",label:"Enable Scrollbar",getValue:({component:e})=>!!e.findFirstType(M),setValue:({component:e,value:l})=>{const a=e.findFirstType(M);a==null||a.remove(),l&&e.append({type:M}),e.set({scrollbar:l})},subTraits:{false:[],true:[{type:"checkbox",name:"scrollbarDraggable",label:"Draggable",changeProp:!0,value:!1},{type:"checkbox",name:"scrollbarHide",label:"Hide",tip:"Hide scrollbar automatically after user interaction",changeProp:!0,value:!0}]}},parallax:{category:{id:"swiper-parallax",label:"Parallax",icon:d.parallax},type:"checkbox",label:"Enable Parallax",value:!1},mobile:{category:K,type:"checkbox",label:"Enable mobile breakpoint",value:!1,subTraits:{true:[{type:"number",name:"mobileBreakpoint",label:"Mobile breakpoint",tip:"Slide values below will be applied when the screen width is greater than this value",changeProp:!0,min:1,value:460},{type:"number",name:"mobileSlidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"mobileSlidesPerGroup",label:"Slides per group",changeProp:!0,min:1,value:1},{type:"number",name:"mobileSpaceBetween",label:"Space between",changeProp:!0,min:0,value:0}]}},tablet:{category:K,type:"checkbox",label:"Enable tablet breakpoint",value:!1,subTraits:{true:[{type:"number",name:"tabletBreakpoint",label:"Tablet breakpoint",tip:"Slide values below will be applied when the screen width is greater than this value",changeProp:!0,min:1,value:991},{type:"number",name:"tabletSlidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"tabletSlidesPerGroup",label:"Slides per group",changeProp:!0,min:1,value:1},{type:"number",name:"tabletSpaceBetween",label:"Space between",changeProp:!0,min:0,value:0}]}},allowTouchMove:{category:Z,type:"checkbox",label:"Allow touch move",tip:"Allow touch interactions",value:!0},grabCursor:{category:Z,type:"checkbox",label:"Grab cursor",tip:'If enabled, the user will see the "grab" cursor when hover the slider',value:!1}},Y="Slider",I="swiper",A=`${I}-`,me=(e,l)=>{const{Components:a,Blocks:n,Commands:s}=e,{block:b}=l,c=be(ve),f="core:preview",p=s.events,u=function(t){const i=this,R=window,w=i.__onLoad,D=i.__activeSlide,F=i.__inPreview,{cdnScript:W,cdnStyle:q,slidesPerView:z}=t||{},r=m=>isNaN(m)?void 0:parseFloat(m),ee=()=>{const m={loop:t.loop,speed:t.speed,initialSlide:t.initialSlide,direction:t.vertical?"vertical":"horizontal",effect:t.effect,freeMode:t.freeMode,parallax:t.parallax,autoHeight:t.autoHeight,allowTouchMove:t.allowTouchMove,grabCursor:t.grabCursor,simulateTouch:!0,breakpoints:{},slidesPerView:isNaN(z)?z:r(z),slidesPerGroup:r(t.slidesPerGroup),spaceBetween:r(t.spaceBetween),slidesOffsetBefore:r(t.slidesOffsetBefore),slidesOffsetAfter:r(t.slidesOffsetAfter),centeredSlides:t.centeredSlides,fadeEffect:{crossFade:t.crossFade},cubeEffect:{shadow:t.cubeEffectShadow,slideShadows:t.cubeEffectSlideShadows,shadowOffset:r(t.cubeEffectShadowOffset),shadowScale:r(t.cubeEffectShadowScale)},coverflowEffect:{depth:r(t.coverflowEffectDepth),modifier:r(t.coverflowEffectModifier),rotate:r(t.coverflowEffectRotate),scale:r(t.coverflowEffectScale),stretch:r(t.coverflowEffectStretch),slideShadows:t.coverflowEffectSlideShadows},flipEffect:{limitRotation:t.flipEffectLimitRotation,slideShadows:t.flipEffectSlideShadows},cardsEffect:{perSlideOffset:r(t.cardsEffectPerSlideOffset),perSlideRotate:r(t.cardsEffectPerSlideRotate),rotate:t.cardsEffectRotate,slideShadows:t.cardsEffectSlideShadows},navigation:{nextEl:i.querySelector(".swiper-button-next"),prevEl:i.querySelector(".swiper-button-prev")},pagination:{type:t.pagination||"bullets",dynamicBullets:t.dynamicBullets,clickable:t.clickableBullets,progressbarOpposite:t.progressbarOpposite,el:i.querySelector(".swiper-pagination")},scrollbar:{el:i.querySelector(".swiper-scrollbar"),draggable:t.scrollbarDraggable,hide:t.scrollbarHide},autoplay:t.autoplay&&{delay:t.autoplayDelay,disableOnInteraction:t.autoplayDisableOnInteraction,pauseOnMouseEnter:t.autoplayPauseOnMouseEnter,reverseDirection:t.autoplayReverseDirection,stopOnLastSlide:t.autoplayStopOnLastSlide,waitForTransition:t.autoplayWaitForTransition}};if(t.tablet){const{tabletBreakpoint:O,tabletSlidesPerView:g}=t,_=r(O);m.breakpoints[_]={slidesPerView:isNaN(g)?g:r(g),slidesPerGroup:r(t.tabletSlidesPerGroup),spaceBetween:r(t.tabletSpaceBetween)}}if(t.mobile){const{mobileBreakpoint:O,mobileSlidesPerView:g}=t,_=r(O);m.breakpoints[_]={slidesPerView:isNaN(g)?g:r(g),slidesPerGroup:r(t.mobileSlidesPerGroup),spaceBetween:r(t.mobileSpaceBetween)}}w&&!F&&(m.simulateTouch=!1),D&&(m.initialSlide=D);const H=new R.Swiper(i,m);w==null||w(H)};if(R.Swiper)ee();else{const{head:m}=document,H=Array.isArray(W)?[...W]:[W],O=Array.isArray(q)?[...q]:[q],g=P=>{if(P.length){const y=document.createElement("link");y.href=P.shift(),y.rel="stylesheet",m.appendChild(y),g(P)}},_=P=>{if(P.length){const y=document.createElement("script");y.src=P.shift(),y.onerror=y.onload=_.bind(null,P),m.appendChild(y)}else ee()};g(O),_(H)}},o=(t=0)=>({type:N,style:{padding:"50px"},components:{type:"text",components:{type:"textnode",content:`Slide ${t}`}}}),h=a.getType("default").model;return a.addType(v,{block:b&&{label:Y,media:d.slider,category:"Extra",select:!0,...l.block},isComponent:t=>S(t,I),model:{defaults:()=>({name:Y,icon:d.slider,classes:I,draggable:(t,i)=>!i.is(v),components:[{type:L,components:[o(1),o(2),o(3)]},{type:C}],script:u,cdnScript:l.cdnScript,cdnStyle:l.cdnStyle,"script-props":["cdnScript","cdnStyle",...c.propKeys],...c.props,traits:[...c.traits]}),init(){const{em:t}=this;fe(this,c.traits),he(this,c.propKeys),this.listenTo(t,`${p.runCommand}${f}`,this.onPreviewOn),this.listenTo(t,`${p.stopCommand}${f}`,this.onPreviewOff)},onPreviewOn(){this.__inPreview=!0,this.reloadSlider()},onPreviewOff(){this.__inPreview=!1,this.reloadSlider()},reloadSlider(){this.trigger("rerender")},addSlide(){const t=this.findFirstType(L);t==null||t.append(this.getNewSlideComponentDef())},getNewSlideComponentDef(){var i;const t=((i=this.findFirstType(L))==null?void 0:i.components().length)||0;return{type:N,components:{type:"text",components:{type:"textnode",content:`Slide ${t+1}`}}}},toJSON(...t){const i=h.prototype.toJSON.apply(this,t);return c.propsNoValues.forEach(R=>delete i[R]),delete i["script-props"],i}},view:{init(){this.listenTo(this.model,a.events.scriptUnmount,this.destroySwiper)},getSwiper(){return this.el.swiper},destroySwiper(){var t;(t=this.getSwiper())==null||t.destroy()},onRender(){const t=this.el;t.__onLoad=i=>i.on("slideChange",()=>this.__activeSlide=i.activeIndex),t.__activeSlide=this.__activeSlide,t.__inPreview=this.model.__inPreview}}}),()=>{a.removeType(v),n.remove(v)}},ge="Nav Prev",ye="Nav Next",V=`${A}button-prev`,$=`${A}button-next`,Se=e=>{const{Components:l}=e,a=n=>({type:"svg",selectable:!1,hoverable:!1,attributes:{viewBox:"0 0 27 44"},components:{type:"svg-in",tagName:"path",attributes:{d:n,fill:"currentColor"}}});return l.addType(k,{isComponent:n=>S(n,V),model:{defaults:{name:ge,classes:V,copyable:!1,highlightable:!1,droppable:!1,draggable:!1,selectable:!1,hoverable:!1,layerable:!1,components:a("M0,22L22,0l2.1,2.1L4.2,22l19.9,19.9L22,44L0,22L0,22L0,22z"),styles:`
|
|
25
25
|
.${V} {
|
|
26
26
|
color: inherit;
|
|
27
27
|
}
|
|
@@ -42,4 +42,4 @@
|
|
|
42
42
|
.${a}-progressbar-fill {
|
|
43
43
|
--swiper-pagination-color: currentColor;
|
|
44
44
|
}
|
|
45
|
-
`}}}),()=>{l.removeType(C)}},Pe="Scrollbar",X=`${A}scrollbar`,Ee=e=>{const{Components:l}=e;return l.addType(M,{isComponent:a=>S(a,X),model:{defaults:{name:Pe,classes:X,copyable:!1,highlightable:!1,removable:!1,selectable:!1,hoverable:!1,layerable:!1,droppable:!1,draggable:!1}}}),()=>{l.removeType(M)}},Te="Slide",J=`${A}slide`,xe=e=>{const{Components:l}=e;return l.addType(N,{isComponent:a=>S(a,J),model:{defaults:{name:Te,classes:J,icon:d.slider,draggable:(a,n)=>n.is(L)}}}),()=>{l.removeType(N)}},Le="Wrapper",Q=`${A}wrapper`,ke=e=>{const{Components:l}=e,{events:a}=l;return l.addType(L,{isComponent:n=>S(n,Q),model:{defaults:{name:Le,icon:d.slider,classes:Q,copyable:!1,removable:!1,draggable:!1,highlightable:!1,droppable:n=>n.is(N)},init(){const n=this.components();this.listenTo(n,"add remove",this.updateSlider)},updateSlider(n){const
|
|
45
|
+
`}}}),()=>{l.removeType(C)}},Pe="Scrollbar",X=`${A}scrollbar`,Ee=e=>{const{Components:l}=e;return l.addType(M,{isComponent:a=>S(a,X),model:{defaults:{name:Pe,classes:X,copyable:!1,highlightable:!1,removable:!1,selectable:!1,hoverable:!1,layerable:!1,droppable:!1,draggable:!1}}}),()=>{l.removeType(M)}},Te="Slide",J=`${A}slide`,xe=e=>{const{Components:l}=e;return l.addType(N,{isComponent:a=>S(a,J),model:{defaults:{name:Te,classes:J,icon:d.slider,draggable:(a,n)=>n.is(L)}}}),()=>{l.removeType(N)}},Le="Wrapper",Q=`${A}wrapper`,ke=e=>{const{Components:l}=e,{events:a}=l;return l.addType(L,{isComponent:n=>S(n,Q),model:{defaults:{name:Le,icon:d.slider,classes:Q,copyable:!1,removable:!1,draggable:!1,highlightable:!1,droppable:n=>n.is(N)},init(){const n=this.components();this.listenTo(n,"add remove",this.updateSlider)},updateSlider(n){const s=this.closestType(v);if(s){const b=s.getView();s.reloadSlider(),this.em.once(a.scriptMount,()=>{setTimeout(()=>{var c;return(c=b.getSwiper())==null?void 0:c.slideTo(n.index())},100)})}}}}),()=>{l.removeType(L)}},Ce="swiperComponent";return de(function(e,l={}){const a={block:{},cdnScript:"https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js",cdnStyle:"https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css",...l},n=[me(e,a),Se(e),ke(e),xe(e),we(e),Ee(e)];pe({editor:e,plan:x.startup,licenseKey:a.licenseKey,pluginName:Ce,cleanup:()=>{n.forEach(s=>s())}})})});
|