@grapesjs/studio-sdk-plugins 1.0.35 → 1.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accordionComponent/index.cjs.js +7 -7
- package/dist/accordionComponent/index.es.js +175 -162
- package/dist/accordionComponent/index.umd.js +7 -7
- package/dist/aiChat/index.cjs.js +64 -64
- package/dist/aiChat/index.es.js +5785 -5757
- package/dist/aiChat/index.js +64 -64
- package/dist/aiChat/index.umd.js +63 -63
- package/dist/animationComponent/index.cjs.js +3 -3
- package/dist/animationComponent/index.es.js +204 -191
- package/dist/animationComponent/index.umd.js +3 -3
- package/dist/canvasAbsoluteMode/index.cjs.js +1 -1
- package/dist/canvasAbsoluteMode/index.es.js +183 -170
- package/dist/canvasAbsoluteMode/index.umd.js +1 -1
- package/dist/canvasEmptyState/index.cjs.js +1 -1
- package/dist/canvasEmptyState/index.es.js +134 -121
- package/dist/canvasEmptyState/index.umd.js +1 -1
- package/dist/canvasFullSize/index.cjs.js +9 -9
- package/dist/canvasFullSize/index.es.js +165 -152
- package/dist/canvasFullSize/index.umd.js +9 -9
- package/dist/canvasGridMode/index.cjs.js +5 -5
- package/dist/canvasGridMode/index.es.js +245 -232
- package/dist/canvasGridMode/index.umd.js +4 -4
- package/dist/canvasScreenshot/index.cjs.js +1 -1
- package/dist/canvasScreenshot/index.es.js +155 -142
- package/dist/canvasScreenshot/index.umd.js +1 -1
- package/dist/dataSourceEjs/index.cjs.js +9 -9
- package/dist/dataSourceEjs/index.es.js +257 -244
- package/dist/dataSourceEjs/index.umd.js +9 -9
- package/dist/dataSourceHandlebars/index.cjs.js +8 -8
- package/dist/dataSourceHandlebars/index.es.js +216 -203
- package/dist/dataSourceHandlebars/index.umd.js +7 -7
- package/dist/dialogComponent/index.cjs.js +14 -14
- package/dist/dialogComponent/index.es.js +141 -128
- package/dist/dialogComponent/index.umd.js +14 -14
- package/dist/flexComponent/index.cjs.js +13 -13
- package/dist/flexComponent/index.es.js +484 -471
- package/dist/flexComponent/index.umd.js +13 -13
- package/dist/fsLightboxComponent/index.cjs.js +3 -3
- package/dist/fsLightboxComponent/index.es.js +173 -160
- package/dist/fsLightboxComponent/index.umd.js +3 -3
- package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
- package/dist/googleFontsAssetProvider/index.es.js +160 -147
- package/dist/googleFontsAssetProvider/index.umd.js +1 -1
- package/dist/iconifyComponent/index.cjs.js +2 -2
- package/dist/iconifyComponent/index.es.js +196 -183
- package/dist/iconifyComponent/index.umd.js +2 -2
- package/dist/index.cjs.js +25 -25
- package/dist/index.es.js +121 -108
- package/dist/index.umd.js +18 -18
- package/dist/layoutSidebarButtons/index.cjs.js +1 -1
- package/dist/layoutSidebarButtons/index.es.js +157 -144
- package/dist/layoutSidebarButtons/index.umd.js +1 -1
- package/dist/lightGalleryComponent/index.cjs.js +1 -1
- package/dist/lightGalleryComponent/index.es.js +245 -232
- package/dist/lightGalleryComponent/index.umd.js +1 -1
- package/dist/linkImageComponent/index.cjs.js +2 -2
- package/dist/linkImageComponent/index.es.js +106 -93
- package/dist/linkImageComponent/index.umd.js +2 -2
- package/dist/listPagesComponent/index.cjs.js +5 -5
- package/dist/listPagesComponent/index.es.js +157 -144
- package/dist/listPagesComponent/index.umd.js +5 -5
- package/dist/presetPrintable/index.cjs.js +3 -3
- package/dist/presetPrintable/index.es.js +181 -168
- package/dist/presetPrintable/index.umd.js +3 -3
- package/dist/prosemirror/index.cjs.js +7 -7
- package/dist/prosemirror/index.es.js +385 -372
- package/dist/prosemirror/index.umd.js +8 -8
- package/dist/rendererReact/index.cjs.js +1 -1
- package/dist/rendererReact/index.es.js +200 -187
- package/dist/rendererReact/index.js +1 -1
- package/dist/rendererReact/index.umd.js +1 -1
- package/dist/rteTinyMce/index.cjs.js +2 -2
- package/dist/rteTinyMce/index.es.js +118 -105
- package/dist/rteTinyMce/index.umd.js +2 -2
- package/dist/shapeDividerComponent/index.cjs.js +4 -4
- package/dist/shapeDividerComponent/index.es.js +129 -116
- package/dist/shapeDividerComponent/index.umd.js +4 -4
- package/dist/swiperComponent/index.cjs.js +9 -9
- package/dist/swiperComponent/index.es.js +203 -190
- package/dist/swiperComponent/index.umd.js +7 -7
- package/dist/tableComponent/index.cjs.js +1 -1
- package/dist/tableComponent/index.es.js +257 -244
- package/dist/tableComponent/index.umd.js +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/youtubeAssetProvider/index.cjs.js +1 -1
- package/dist/youtubeAssetProvider/index.es.js +121 -108
- package/dist/youtubeAssetProvider/index.umd.js +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
const ue = "app.grapesjs.com", de = "app-stage.grapesjs.com", Pe = "app2.grapesjs.com", me = "app-stage2.grapesjs.com", ae = [
|
|
2
|
+
ue,
|
|
3
|
+
Pe,
|
|
4
|
+
de,
|
|
5
|
+
me,
|
|
6
6
|
"localhost",
|
|
7
7
|
"127.0.0.1",
|
|
8
8
|
".local-credentialless.webcontainer.io",
|
|
@@ -11,343 +11,356 @@ const pt = "app.grapesjs.com", dt = "app-stage.grapesjs.com", St = "app2.grapesj
|
|
|
11
11
|
// For stackblitz.com demos
|
|
12
12
|
"-sandpack.codesandbox.io"
|
|
13
13
|
// For Sandpack demos
|
|
14
|
-
],
|
|
15
|
-
isDev:
|
|
16
|
-
isStage:
|
|
17
|
-
isPlatform:
|
|
18
|
-
}) => `${
|
|
19
|
-
const
|
|
20
|
-
return !!
|
|
14
|
+
], ze = "license:check:end", Se = () => typeof window < "u", xe = ({
|
|
15
|
+
isDev: t,
|
|
16
|
+
isStage: e,
|
|
17
|
+
isPlatform: s
|
|
18
|
+
}) => `${t ? "" : `https://${e ? de : ue}`}/${s ? "platform-api" : "api"}`, ve = () => {
|
|
19
|
+
const t = Se() && window.location.hostname;
|
|
20
|
+
return !!t && (ae.includes(t) || ae.some((e) => t.endsWith(e)));
|
|
21
21
|
};
|
|
22
|
-
function
|
|
23
|
-
return typeof
|
|
22
|
+
function Re(t) {
|
|
23
|
+
return typeof t == "function";
|
|
24
24
|
}
|
|
25
|
-
async function
|
|
26
|
-
path:
|
|
27
|
-
baseApiUrl:
|
|
28
|
-
method:
|
|
29
|
-
headers:
|
|
30
|
-
params:
|
|
31
|
-
body:
|
|
25
|
+
async function we({
|
|
26
|
+
path: t,
|
|
27
|
+
baseApiUrl: e,
|
|
28
|
+
method: s = "GET",
|
|
29
|
+
headers: n = {},
|
|
30
|
+
params: a,
|
|
31
|
+
body: i
|
|
32
32
|
}) {
|
|
33
|
-
const
|
|
34
|
-
method:
|
|
33
|
+
const l = `${e || xe({ isDev: !1, isStage: !1 })}${t}`, p = {
|
|
34
|
+
method: s,
|
|
35
35
|
headers: {
|
|
36
36
|
"Content-Type": "application/json",
|
|
37
|
-
...
|
|
37
|
+
...n
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
|
-
|
|
41
|
-
const
|
|
40
|
+
i && (p.body = JSON.stringify(i));
|
|
41
|
+
const g = a ? new URLSearchParams(a).toString() : "", f = g ? `?${g}` : "", r = await fetch(`${l}${f}`, p);
|
|
42
42
|
if (!r.ok)
|
|
43
43
|
throw new Error(`HTTP error! status: ${r.status}`);
|
|
44
44
|
return r.json();
|
|
45
45
|
}
|
|
46
|
-
var
|
|
47
|
-
const
|
|
48
|
-
[
|
|
49
|
-
[
|
|
50
|
-
[
|
|
51
|
-
[
|
|
46
|
+
var L = /* @__PURE__ */ ((t) => (t.free = "free", t.startup = "startup", t.business = "business", t.enterprise = "enterprise", t))(L || {}), W = /* @__PURE__ */ ((t) => (t.toastAdd = "studio:toastAdd", t.toastRemove = "studio:toastRemove", t.dialogOpen = "studio:dialogOpen", t.dialogClose = "studio:dialogClose", t.dialogExportCode = "studio:dialogExportCode", t.dialogImportCode = "studio:dialogImportCode", t.sidebarLeftSet = "studio:sidebarLeft:set", t.sidebarLeftGet = "studio:sidebarLeft:get", t.sidebarLeftToggle = "studio:sidebarLeft:toggle", t.sidebarRightSet = "studio:sidebarRight:set", t.sidebarRightGet = "studio:sidebarRight:get", t.sidebarRightToggle = "studio:sidebarRight:toggle", t.sidebarTopSet = "studio:sidebarTop:set", t.sidebarTopGet = "studio:sidebarTop:get", t.sidebarTopToggle = "studio:sidebarTop:toggle", t.sidebarBottomSet = "studio:sidebarBottom:set", t.sidebarBottomGet = "studio:sidebarBottom:get", t.sidebarBottomToggle = "studio:sidebarBottom:toggle", t.symbolAdd = "studio:symbolAdd", t.symbolDetach = "studio:symbolDetach", t.symbolOverride = "studio:symbolOverride", t.symbolPropagateStyles = "studio:propagateStyles", t.getPagesConfig = "studio:getPagesConfig", t.setPagesConfig = "studio:setPagesConfig", t.getPageSettings = "studio:getPageSettings", t.setPageSettings = "studio:setPageSettings", t.clearPage = "studio:clearPage", t.projectFiles = "studio:projectFiles", t.validateCode = "studio:validateCode", t.canvasReload = "studio:canvasReload", t.getBlocksPanel = "studio:getBlocksPanel", t.setBlocksPanel = "studio:setBlocksPanel", t.getStateContextMenu = "studio:getStateContextMenu", t.setStateContextMenu = "studio:setStateContextMenu", t.contextMenuComponent = "studio:contextMenuComponent", t.layoutAdd = "studio:layoutAdd", t.layoutRemove = "studio:layoutRemove", t.layoutToggle = "studio:layoutToggle", t.layoutUpdate = "studio:layoutUpdate", t.layoutGet = "studio:layoutGet", t.layoutConfigGet = "studio:layoutConfigGet", t.layoutConfigSet = "studio:layoutConfigSet", t.layoutComponentAdd = "studio:layoutComponentAdd", t.layoutComponentGet = "studio:layoutComponentGet", t.layoutComponentRemove = "studio:layoutComponentRemove", t.layoutComponentRender = "studio:layoutComponentRender", t.getStateTheme = "studio:getStateTheme", t.setStateTheme = "studio:setStateTheme", t.settings = "studio:settings", t.assetProviderGet = "studio:assetProviderGet", t.assetProviderAdd = "studio:assetProviderAdd", t.assetProviderRemove = "studio:assetProviderRemove", t.fontGet = "studio:fontGet", t.fontAdd = "studio:fontAdd", t.fontRemove = "studio:fontRemove", t.fontManagerOpen = "studio:fontManagerOpen", t.menuFontLoad = "studio:menuFontLoad", t.toggleStateDataSource = "studio:toggleStateDataSource", t.getStateDataSource = "studio:getStateDataSource", t.dataSourceSetGlobalData = "studio:dataSourceSetGlobalData", t.dataSourceSetImporter = "studio:dataSourceSetImporter", t.dataSourceSetExporter = "studio:dataSourceSetExporter", t.setDragAbsolute = "studio:setDragAbsolute", t))(W || {}), ge = /* @__PURE__ */ ((t) => (t.web = "web", t.email = "email", t.document = "document", t.react = "react", t))(ge || {});
|
|
47
|
+
const ie = {
|
|
48
|
+
[L.free]: 0,
|
|
49
|
+
[L.startup]: 10,
|
|
50
|
+
[L.business]: 20,
|
|
51
|
+
[L.enterprise]: 30
|
|
52
52
|
};
|
|
53
|
-
function
|
|
54
|
-
const
|
|
55
|
-
return
|
|
53
|
+
function Ge(t) {
|
|
54
|
+
const e = t;
|
|
55
|
+
return e.init = (s) => (n) => t(n, s), e;
|
|
56
56
|
}
|
|
57
|
-
const
|
|
58
|
-
async function
|
|
59
|
-
editor:
|
|
60
|
-
plan:
|
|
61
|
-
pluginName:
|
|
62
|
-
licenseKey:
|
|
63
|
-
onLicenseCheckResponse:
|
|
64
|
-
cleanup:
|
|
57
|
+
const Ce = (t) => /* @__PURE__ */ Ge(t);
|
|
58
|
+
async function Ie({
|
|
59
|
+
editor: t,
|
|
60
|
+
plan: e,
|
|
61
|
+
pluginName: s,
|
|
62
|
+
licenseKey: n,
|
|
63
|
+
onLicenseCheckResponse: a,
|
|
64
|
+
cleanup: i
|
|
65
65
|
}) {
|
|
66
|
-
let o = "",
|
|
67
|
-
const p =
|
|
68
|
-
console.warn("Cleanup plugin:",
|
|
69
|
-
},
|
|
70
|
-
var
|
|
71
|
-
const { error:
|
|
72
|
-
if (!(
|
|
73
|
-
|
|
74
|
-
else if (
|
|
75
|
-
const
|
|
76
|
-
|
|
66
|
+
let o = "", l;
|
|
67
|
+
const p = (r) => {
|
|
68
|
+
console.warn("Cleanup plugin:", s, "Reason:", r), i();
|
|
69
|
+
}, g = (r = {}) => {
|
|
70
|
+
var v;
|
|
71
|
+
const { error: h, sdkLicense: I } = r, b = (v = r.plan) == null ? void 0 : v.category;
|
|
72
|
+
if (!(I || r.license) || h)
|
|
73
|
+
p(h || "Invalid license");
|
|
74
|
+
else if (b) {
|
|
75
|
+
const G = ie[e], m = ie[b];
|
|
76
|
+
G > m && p({ pluginRequiredPlan: e, licensePlan: b });
|
|
77
77
|
}
|
|
78
78
|
};
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
|
|
79
|
+
t.Commands.has(W.settings) && (l = t.runCommand(W.settings), o = (l == null ? void 0 : l.baseUrl) || "");
|
|
80
|
+
const f = (r) => {
|
|
81
|
+
a == null || a(r), r && g(r);
|
|
82
|
+
};
|
|
83
|
+
if (!l) {
|
|
84
|
+
t.onReady(async () => {
|
|
85
|
+
if (!ve())
|
|
86
|
+
if (n) {
|
|
87
|
+
const r = await Ee({ licenseKey: n, pluginName: s, baseApiUrl: o });
|
|
88
|
+
f(r);
|
|
89
|
+
} else
|
|
90
|
+
p("The `licenseKey` option not provided");
|
|
91
|
+
});
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (l.licensePlan || l.licenseError) {
|
|
95
|
+
const r = Te(l);
|
|
96
|
+
f(r);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
t.on(ze, (r) => f(r));
|
|
93
100
|
}
|
|
94
|
-
|
|
95
|
-
|
|
101
|
+
const Te = (t) => ({
|
|
102
|
+
sdkLicense: t.license,
|
|
103
|
+
license: t.license,
|
|
104
|
+
error: t.licenseError,
|
|
105
|
+
plan: t.licensePlan
|
|
106
|
+
});
|
|
107
|
+
async function Ee(t) {
|
|
108
|
+
const { licenseKey: e, pluginName: s, baseApiUrl: n } = t;
|
|
96
109
|
try {
|
|
97
|
-
return (await
|
|
98
|
-
baseApiUrl:
|
|
99
|
-
path: `/sdk/${
|
|
110
|
+
return (await we({
|
|
111
|
+
baseApiUrl: n,
|
|
112
|
+
path: `/sdk/${e || "na"}`,
|
|
100
113
|
method: "POST",
|
|
101
114
|
params: {
|
|
102
115
|
d: window.location.hostname,
|
|
103
|
-
pn:
|
|
116
|
+
pn: s
|
|
104
117
|
}
|
|
105
118
|
})).result || {};
|
|
106
|
-
} catch (
|
|
107
|
-
return console.error("Error during SDK license check:",
|
|
119
|
+
} catch (a) {
|
|
120
|
+
return console.error("Error during SDK license check:", a), !1;
|
|
108
121
|
}
|
|
109
122
|
}
|
|
110
|
-
const
|
|
111
|
-
var
|
|
112
|
-
return ((
|
|
113
|
-
},
|
|
114
|
-
constructor(
|
|
115
|
-
this.config =
|
|
116
|
-
}
|
|
117
|
-
getSize(
|
|
118
|
-
var
|
|
119
|
-
return (
|
|
120
|
-
}
|
|
121
|
-
setSize(
|
|
122
|
-
var
|
|
123
|
-
if ((
|
|
124
|
-
this.config.setSize(
|
|
123
|
+
const he = (t) => (e) => {
|
|
124
|
+
var s;
|
|
125
|
+
return ((s = e.getAttribute) == null ? void 0 : s.call(e, se)) === t;
|
|
126
|
+
}, Ae = (...t) => (e) => t.some((s) => e.is(s)), Le = (...t) => (e, s) => t.some((n) => s.is(n)), fe = "gjs-plg-", se = "data-type-role", D = class D {
|
|
127
|
+
constructor(e) {
|
|
128
|
+
this.config = e;
|
|
129
|
+
}
|
|
130
|
+
getSize(e) {
|
|
131
|
+
var s;
|
|
132
|
+
return (s = this.config) != null && s.getSize ? this.config.getSize(e) : ne(e.componentColumn, D.CSS_FLEX_BASIS);
|
|
133
|
+
}
|
|
134
|
+
setSize(e) {
|
|
135
|
+
var s;
|
|
136
|
+
if ((s = this.config) != null && s.setSize)
|
|
137
|
+
this.config.setSize(e);
|
|
125
138
|
else {
|
|
126
|
-
const { componentColumn:
|
|
127
|
-
|
|
139
|
+
const { componentColumn: n, sizeValue: a, partial: i } = e;
|
|
140
|
+
n.addStyle({ [D.CSS_FLEX_BASIS]: a }, { partial: i });
|
|
128
141
|
}
|
|
129
142
|
}
|
|
130
143
|
};
|
|
131
|
-
|
|
132
|
-
let
|
|
144
|
+
D.CSS_FLEX_BASIS = "flex-basis";
|
|
145
|
+
let K = D;
|
|
133
146
|
const j = class j {
|
|
134
|
-
constructor(
|
|
135
|
-
this.config =
|
|
147
|
+
constructor(e) {
|
|
148
|
+
this.config = e;
|
|
136
149
|
}
|
|
137
150
|
isGapSupported() {
|
|
138
151
|
return !0;
|
|
139
152
|
}
|
|
140
|
-
getGap(
|
|
141
|
-
var
|
|
142
|
-
return (
|
|
153
|
+
getGap(e) {
|
|
154
|
+
var s;
|
|
155
|
+
return (s = this.config) != null && s.getGap ? this.config.getGap(e) : ne(e.componentRow, j.CSS_GAP);
|
|
143
156
|
}
|
|
144
|
-
setGap(
|
|
145
|
-
var
|
|
146
|
-
if ((
|
|
147
|
-
this.config.setGap(
|
|
157
|
+
setGap(e) {
|
|
158
|
+
var s;
|
|
159
|
+
if ((s = this.config) != null && s.setGap)
|
|
160
|
+
this.config.setGap(e);
|
|
148
161
|
else {
|
|
149
|
-
const { componentRow:
|
|
150
|
-
|
|
162
|
+
const { componentRow: n, gapValue: a, partial: i } = e;
|
|
163
|
+
n.addStyle({ [j.CSS_GAP]: a }, { partial: i });
|
|
151
164
|
}
|
|
152
165
|
}
|
|
153
166
|
};
|
|
154
167
|
j.CSS_GAP = "gap";
|
|
155
|
-
let
|
|
156
|
-
const
|
|
157
|
-
constructor(
|
|
158
|
-
this.config =
|
|
159
|
-
}
|
|
160
|
-
getParentSize(t) {
|
|
161
|
-
var a;
|
|
162
|
-
if ((a = this.config) != null && a.getParentSize) return this.config.getParentSize(t);
|
|
163
|
-
const { componentRow: e, isVertical: s } = t, i = e.getEl();
|
|
164
|
-
return i ? s ? i.clientHeight : i.clientWidth : 0;
|
|
165
|
-
}
|
|
166
|
-
isLayoutVertical(t) {
|
|
167
|
-
var s;
|
|
168
|
-
if ((s = this.config) != null && s.isParentVertical) return this.config.isParentVertical(t);
|
|
169
|
-
const e = nt(t.componentRow, Y.CSS_FLEX_DIRECTION, !0);
|
|
170
|
-
return e === "column" || e === "column-reverse";
|
|
168
|
+
let J = j;
|
|
169
|
+
const U = class U {
|
|
170
|
+
constructor(e) {
|
|
171
|
+
this.config = e;
|
|
171
172
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
this.config = t;
|
|
173
|
+
getParentSize(e) {
|
|
174
|
+
var i;
|
|
175
|
+
if ((i = this.config) != null && i.getParentSize) return this.config.getParentSize(e);
|
|
176
|
+
const { componentRow: s, isVertical: n } = e, a = s.getEl();
|
|
177
|
+
return a ? n ? a.clientHeight : a.clientWidth : 0;
|
|
178
178
|
}
|
|
179
|
-
|
|
180
|
-
var
|
|
181
|
-
if ((
|
|
182
|
-
const
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
179
|
+
isLayoutVertical(e) {
|
|
180
|
+
var n;
|
|
181
|
+
if ((n = this.config) != null && n.isParentVertical) return this.config.isParentVertical(e);
|
|
182
|
+
const s = ne(e.componentRow, U.CSS_FLEX_DIRECTION, !0);
|
|
183
|
+
return s === "column" || s === "column-reverse";
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
U.CSS_FLEX_DIRECTION = "flex-direction";
|
|
187
|
+
let q = U;
|
|
188
|
+
const N = class N {
|
|
189
|
+
constructor(e) {
|
|
190
|
+
this.config = e;
|
|
191
|
+
}
|
|
192
|
+
getSize(e) {
|
|
193
|
+
var n;
|
|
194
|
+
if ((n = this.config) != null && n.getSize) return this.config.getSize(e);
|
|
195
|
+
const s = e.componentColumn;
|
|
196
|
+
if (s.is(N.MJML_COLUMN_TYPE)) {
|
|
197
|
+
const i = s.getAttributes().width;
|
|
198
|
+
if (i && (i.includes("%") || !isNaN(parseFloat(i))))
|
|
199
|
+
return parseFloat(i);
|
|
200
|
+
const o = s.parent();
|
|
188
201
|
return 100 / (o ? o.components().length : 1);
|
|
189
202
|
}
|
|
190
203
|
return 0;
|
|
191
204
|
}
|
|
192
|
-
setSize(
|
|
193
|
-
var
|
|
194
|
-
if ((
|
|
195
|
-
this.config.setSize(
|
|
205
|
+
setSize(e) {
|
|
206
|
+
var s;
|
|
207
|
+
if ((s = this.config) != null && s.setSize)
|
|
208
|
+
this.config.setSize(e);
|
|
196
209
|
else {
|
|
197
|
-
const { componentColumn:
|
|
198
|
-
|
|
210
|
+
const { componentColumn: n, sizeValue: a, partial: i } = e;
|
|
211
|
+
n.is(N.MJML_COLUMN_TYPE) && n.addAttributes({ width: `${parseFloat(a)}%` }, { partial: i });
|
|
199
212
|
}
|
|
200
213
|
}
|
|
201
214
|
};
|
|
202
|
-
|
|
203
|
-
let
|
|
204
|
-
const
|
|
205
|
-
constructor(
|
|
206
|
-
this.config =
|
|
215
|
+
N.MJML_COLUMN_TYPE = "mj-column";
|
|
216
|
+
let Z = N;
|
|
217
|
+
const X = class X {
|
|
218
|
+
constructor(e) {
|
|
219
|
+
this.config = e;
|
|
207
220
|
}
|
|
208
221
|
isGapSupported() {
|
|
209
222
|
return !1;
|
|
210
223
|
}
|
|
211
|
-
getGap(
|
|
212
|
-
var
|
|
213
|
-
if ((
|
|
214
|
-
const { componentRow:
|
|
215
|
-
if (
|
|
216
|
-
const
|
|
217
|
-
if (
|
|
218
|
-
return parseInt(
|
|
224
|
+
getGap(e) {
|
|
225
|
+
var n;
|
|
226
|
+
if ((n = this.config) != null && n.getGap) return this.config.getGap(e);
|
|
227
|
+
const { componentRow: s } = e;
|
|
228
|
+
if (s.is(X.MJML_SECTION_TYPE)) {
|
|
229
|
+
const a = s.getAttributes();
|
|
230
|
+
if (a && a.padding)
|
|
231
|
+
return parseInt(a.padding, 10) || 0;
|
|
219
232
|
}
|
|
220
233
|
return 0;
|
|
221
234
|
}
|
|
222
|
-
setGap(
|
|
223
|
-
var
|
|
224
|
-
(
|
|
235
|
+
setGap(e) {
|
|
236
|
+
var s, n;
|
|
237
|
+
(n = (s = this.config) == null ? void 0 : s.setGap) == null || n.call(s, e);
|
|
225
238
|
}
|
|
226
239
|
};
|
|
227
|
-
|
|
228
|
-
let
|
|
229
|
-
class
|
|
230
|
-
constructor(
|
|
231
|
-
this.config =
|
|
240
|
+
X.MJML_SECTION_TYPE = "mj-section";
|
|
241
|
+
let Q = X;
|
|
242
|
+
class Me {
|
|
243
|
+
constructor(e) {
|
|
244
|
+
this.config = e;
|
|
232
245
|
}
|
|
233
|
-
getParentSize(
|
|
246
|
+
getParentSize(e) {
|
|
234
247
|
var o;
|
|
235
|
-
if ((o = this.config) != null && o.getParentSize) return this.config.getParentSize(
|
|
236
|
-
const { componentRow:
|
|
237
|
-
if (!
|
|
238
|
-
let
|
|
239
|
-
if (
|
|
240
|
-
const
|
|
241
|
-
|
|
248
|
+
if ((o = this.config) != null && o.getParentSize) return this.config.getParentSize(e);
|
|
249
|
+
const { componentRow: s, isVertical: n } = e, a = s.getEl();
|
|
250
|
+
if (!a) return 0;
|
|
251
|
+
let i = a;
|
|
252
|
+
if (a.tagName !== "TABLE") {
|
|
253
|
+
const l = a.querySelectorAll("table");
|
|
254
|
+
l.length && (i = l[0]);
|
|
242
255
|
}
|
|
243
|
-
return
|
|
256
|
+
return n ? i.clientHeight : i.clientWidth;
|
|
244
257
|
}
|
|
245
|
-
isLayoutVertical(
|
|
246
|
-
var
|
|
247
|
-
return (
|
|
258
|
+
isLayoutVertical(e) {
|
|
259
|
+
var s;
|
|
260
|
+
return (s = this.config) != null && s.isParentVertical ? this.config.isParentVertical(e) : !1;
|
|
248
261
|
}
|
|
249
262
|
}
|
|
250
|
-
class
|
|
263
|
+
class M {
|
|
251
264
|
constructor() {
|
|
252
265
|
this.handlerCache = /* @__PURE__ */ new Map();
|
|
253
266
|
}
|
|
254
267
|
static getInstance() {
|
|
255
|
-
return
|
|
256
|
-
}
|
|
257
|
-
getHandlers(
|
|
258
|
-
const
|
|
259
|
-
return this.handlerCache.has(
|
|
260
|
-
sizeHandler: new
|
|
261
|
-
gapHandler: new
|
|
262
|
-
parentSizeHandler: new
|
|
263
|
-
}) : this.handlerCache.set(
|
|
264
|
-
sizeHandler: new
|
|
265
|
-
gapHandler: new
|
|
266
|
-
parentSizeHandler: new
|
|
267
|
-
})), this.handlerCache.get(
|
|
268
|
+
return M.instance || (M.instance = new M()), M.instance;
|
|
269
|
+
}
|
|
270
|
+
getHandlers(e) {
|
|
271
|
+
const s = `${e.projectType}-${e.disableGapHandler ? "nogap" : "gap"}`;
|
|
272
|
+
return this.handlerCache.has(s) || ($(e) ? this.handlerCache.set(s, {
|
|
273
|
+
sizeHandler: new Z(e),
|
|
274
|
+
gapHandler: new Q(e),
|
|
275
|
+
parentSizeHandler: new Me(e)
|
|
276
|
+
}) : this.handlerCache.set(s, {
|
|
277
|
+
sizeHandler: new K(e),
|
|
278
|
+
gapHandler: new J(e),
|
|
279
|
+
parentSizeHandler: new q(e)
|
|
280
|
+
})), this.handlerCache.get(s);
|
|
268
281
|
}
|
|
269
282
|
}
|
|
270
|
-
function
|
|
271
|
-
return
|
|
283
|
+
function T(t) {
|
|
284
|
+
return M.getInstance().getHandlers(t);
|
|
272
285
|
}
|
|
273
|
-
const
|
|
274
|
-
|
|
275
|
-
},
|
|
276
|
-
|
|
277
|
-
},
|
|
278
|
-
const
|
|
279
|
-
return
|
|
280
|
-
},
|
|
281
|
-
const
|
|
282
|
-
if (!
|
|
283
|
-
const
|
|
284
|
-
return
|
|
285
|
-
},
|
|
286
|
-
const
|
|
287
|
-
if (!
|
|
288
|
-
const
|
|
289
|
-
return
|
|
290
|
-
},
|
|
291
|
-
const
|
|
292
|
-
return
|
|
293
|
-
}, O = (
|
|
294
|
-
const
|
|
295
|
-
return
|
|
296
|
-
},
|
|
297
|
-
const
|
|
298
|
-
if (!
|
|
299
|
-
return
|
|
300
|
-
const o = window.getComputedStyle(
|
|
301
|
-
if (
|
|
302
|
-
let
|
|
303
|
-
return typeof o == "string" ? (
|
|
286
|
+
const oe = (t) => {
|
|
287
|
+
t.style.display = "none";
|
|
288
|
+
}, re = (t) => {
|
|
289
|
+
t.style.display = "block";
|
|
290
|
+
}, H = (t) => +parseFloat(`${t}`).toFixed(2), $ = (t) => t.projectType === ge.email, $e = (t) => t ? ["top", "bottom"] : ["left", "right"], He = (t) => {
|
|
291
|
+
const e = t.parent();
|
|
292
|
+
return e ? e.components().models.indexOf(t) === 0 : !1;
|
|
293
|
+
}, Ve = (t) => {
|
|
294
|
+
const e = t.parent();
|
|
295
|
+
if (!e) return !1;
|
|
296
|
+
const s = e.components().models;
|
|
297
|
+
return s.indexOf(t) === s.length - 1;
|
|
298
|
+
}, De = (t) => {
|
|
299
|
+
const e = t.parent();
|
|
300
|
+
if (!e) return !1;
|
|
301
|
+
const s = e.components().models;
|
|
302
|
+
return s.length > 1 && t.index() === s.length - 1;
|
|
303
|
+
}, je = (t, e, s, n) => {
|
|
304
|
+
const i = t + (s ? e === "top" ? -1 : e === "bottom" ? 1 : 0 : e === "left" ? -1 : e === "right" ? 1 : 0);
|
|
305
|
+
return i >= 0 && i < n ? i : -1;
|
|
306
|
+
}, O = (t) => t === "top" || t === "bottom", Ne = (t, e) => !!(He(t) && (e === "left" || e === "top") || Ve(t) && (e === "right" || e === "bottom")), Be = (t) => {
|
|
307
|
+
const e = t.parent();
|
|
308
|
+
return e ? e.components().models.length > 1 : !1;
|
|
309
|
+
}, le = (t, e) => t === "right" || t === "bottom" ? e > 0 : e < 0, ne = (t, e, s = !1) => {
|
|
310
|
+
const n = !s, a = t.getEl();
|
|
311
|
+
if (!a)
|
|
312
|
+
return n ? 0 : "";
|
|
313
|
+
const o = window.getComputedStyle(a)[e] || "";
|
|
314
|
+
if (n) {
|
|
315
|
+
let l;
|
|
316
|
+
return typeof o == "string" ? (l = parseFloat(o.replace(/[^-\d.]/g, "")), isNaN(l) && (l = 0)) : l = Number(o) || 0, l;
|
|
304
317
|
}
|
|
305
318
|
return o;
|
|
306
|
-
},
|
|
307
|
-
const
|
|
308
|
-
return
|
|
309
|
-
},
|
|
310
|
-
if (
|
|
311
|
-
const { gapHandler:
|
|
312
|
-
if (!
|
|
313
|
-
const
|
|
314
|
-
return
|
|
315
|
-
},
|
|
316
|
-
|
|
317
|
-
},
|
|
318
|
-
const
|
|
319
|
-
V({ ...
|
|
320
|
-
},
|
|
321
|
-
if (
|
|
322
|
-
const { gapHandler:
|
|
323
|
-
|
|
324
|
-
},
|
|
325
|
-
const
|
|
326
|
-
if (!
|
|
327
|
-
const
|
|
328
|
-
|
|
319
|
+
}, ce = (t, e, s) => {
|
|
320
|
+
const n = ee({ componentRow: t, isVertical: e }, s), a = t.components().models;
|
|
321
|
+
return n * (a.length - 1);
|
|
322
|
+
}, B = (t, e) => T(e).parentSizeHandler.isLayoutVertical({ componentRow: t }), F = (t, e) => T(e).sizeHandler.getSize(t), ee = (t, e) => {
|
|
323
|
+
if (e != null && e.disableGapHandler) return 0;
|
|
324
|
+
const { gapHandler: s, parentSizeHandler: n } = T(e);
|
|
325
|
+
if (!s.isGapSupported()) return 0;
|
|
326
|
+
const a = s.getGap(t), i = n.getParentSize(t);
|
|
327
|
+
return a / 100 * i;
|
|
328
|
+
}, te = (t, e) => T(e).parentSizeHandler.getParentSize(t), V = (t, e) => {
|
|
329
|
+
T(e).sizeHandler.setSize(t);
|
|
330
|
+
}, ye = (t, e) => {
|
|
331
|
+
const s = F(t, e);
|
|
332
|
+
V({ ...t, sizeValue: `${s}%`, partial: !1 }, e);
|
|
333
|
+
}, be = (t, e) => {
|
|
334
|
+
if (e != null && e.disableGapHandler) return;
|
|
335
|
+
const { gapHandler: s } = T(e);
|
|
336
|
+
s.isGapSupported() && s.setGap(t);
|
|
337
|
+
}, Fe = (t, e) => {
|
|
338
|
+
const s = t.getStyle().gap;
|
|
339
|
+
if (!s) return;
|
|
340
|
+
const n = t.components().models, a = { componentRow: t, isVertical: B(t, e) };
|
|
341
|
+
n.map((i) => ye({ ...a, componentColumn: i }, e)), be({ ...a, gapValue: String(s), partial: !1 }, e);
|
|
329
342
|
};
|
|
330
|
-
function
|
|
331
|
-
const { Blocks:
|
|
332
|
-
if (
|
|
343
|
+
function _e(t, e) {
|
|
344
|
+
const { Blocks: s } = t, { typeColumn: n, typeRow: a, blocks: i } = e;
|
|
345
|
+
if (i === !1 || $(e)) return;
|
|
333
346
|
const o = (r) => ({
|
|
334
|
-
type:
|
|
335
|
-
components: r.map((
|
|
336
|
-
type:
|
|
337
|
-
style: { "flex-basis": `${
|
|
347
|
+
type: a,
|
|
348
|
+
components: r.map((h) => ({
|
|
349
|
+
type: n,
|
|
350
|
+
style: { "flex-basis": `${h}%` }
|
|
338
351
|
}))
|
|
339
|
-
}),
|
|
340
|
-
${r.map((
|
|
341
|
-
</div>`, p = (r,
|
|
342
|
-
id: `flex-row-${
|
|
352
|
+
}), l = (r) => `<div class="gs-block-item__flex-row" style="display: flex; height: 1.75rem; width: 100%; flex-wrap: nowrap; gap: 0.5rem;">
|
|
353
|
+
${r.map((h) => `<div style="flex-basis: ${h}%; border-color: currentColor; border-width: 2px; border-radius: 0.12rem;"></div>`).join("")}
|
|
354
|
+
</div>`, p = (r, h) => ({
|
|
355
|
+
id: `flex-row-${h.join("-")}`,
|
|
343
356
|
label: r,
|
|
344
357
|
category: "Layout",
|
|
345
358
|
select: !0,
|
|
346
359
|
full: !0,
|
|
347
360
|
attributes: { class: "gs-block-item__flex gs-utl-w-full" },
|
|
348
|
-
media:
|
|
349
|
-
content: o(
|
|
350
|
-
}),
|
|
361
|
+
media: l(h),
|
|
362
|
+
content: o(h)
|
|
363
|
+
}), g = [
|
|
351
364
|
p("1 Column", [100]),
|
|
352
365
|
p("2 Columns 50/50", [50, 50]),
|
|
353
366
|
p("2 Columns 25/75", [25, 75]),
|
|
@@ -358,16 +371,16 @@ function Bt(n, t) {
|
|
|
358
371
|
p("3 Columns 25/25/50", [25, 25, 50]),
|
|
359
372
|
p("4 Columns", [25, 25, 25, 25]),
|
|
360
373
|
p("5 Columns", [20, 20, 20, 20, 20])
|
|
361
|
-
], f =
|
|
362
|
-
return f.forEach((r) =>
|
|
363
|
-
f.forEach((r) =>
|
|
374
|
+
], f = Re(i) ? i({ blocks: g }) : g;
|
|
375
|
+
return f.forEach((r) => s.add(r.id, r)), () => {
|
|
376
|
+
f.forEach((r) => s.remove(r.id));
|
|
364
377
|
};
|
|
365
378
|
}
|
|
366
|
-
const
|
|
367
|
-
const { Components:
|
|
368
|
-
if (!(!
|
|
369
|
-
return
|
|
370
|
-
isComponent:
|
|
379
|
+
const Oe = (t, e) => {
|
|
380
|
+
const { Components: s } = t, { typeRow: n, typeColumn: a, extendTypeColumn: i } = e, o = `${fe}${a}`, p = !!a && !!s.getType(a) && !i;
|
|
381
|
+
if (!(!a || p || $(e)))
|
|
382
|
+
return s.addType(a, {
|
|
383
|
+
isComponent: he(a),
|
|
371
384
|
model: {
|
|
372
385
|
defaults: {
|
|
373
386
|
name: "Column",
|
|
@@ -375,8 +388,8 @@ const Ft = (n, t) => {
|
|
|
375
388
|
emptyState: !0,
|
|
376
389
|
classes: o,
|
|
377
390
|
icon: '<svg viewBox="0 0 24 24"><path d="M14.5 2.3A1.8 1.8 0 0 0 12.7 4v16c0 1 .8 1.8 1.8 1.8h3a1.8 1.8 0 0 0 1.8-1.8V4a1.8 1.8 0 0 0-1.8-1.8zm-8 0A1.8 1.8 0 0 0 4.7 4v16c0 1 .8 1.8 1.8 1.8h3a1.8 1.8 0 0 0 1.8-1.8V4a1.8 1.8 0 0 0-1.8-1.8z"/></svg>',
|
|
378
|
-
draggable:
|
|
379
|
-
attributes: { [
|
|
391
|
+
draggable: Le(n),
|
|
392
|
+
attributes: { [se]: a },
|
|
380
393
|
styles: `
|
|
381
394
|
.${o} {
|
|
382
395
|
flex-grow: 1;
|
|
@@ -385,21 +398,21 @@ const Ft = (n, t) => {
|
|
|
385
398
|
}
|
|
386
399
|
}
|
|
387
400
|
}), () => {
|
|
388
|
-
|
|
401
|
+
s.removeType(a);
|
|
389
402
|
};
|
|
390
|
-
},
|
|
391
|
-
const { Components:
|
|
392
|
-
if (!(!
|
|
393
|
-
return
|
|
394
|
-
isComponent:
|
|
403
|
+
}, ke = (t, e) => {
|
|
404
|
+
const { Components: s } = t, { typeRow: n, typeColumn: a, extendTypeRow: i } = e, o = `${fe}${n}`, p = !!n && !!s.getType(n) && !i;
|
|
405
|
+
if (!(!n || p || $(e)))
|
|
406
|
+
return s.addType(n, {
|
|
407
|
+
isComponent: he(n),
|
|
395
408
|
model: {
|
|
396
409
|
defaults: {
|
|
397
410
|
name: "Row",
|
|
398
411
|
classes: o,
|
|
399
412
|
icon: '<svg viewBox="0 0 24 24"><path d="M4 4.8a1.8 1.8 0 0 0-1.8 1.7v3c0 1 .8 1.8 1.8 1.8h16a1.8 1.8 0 0 0 1.8-1.8v-3A1.8 1.8 0 0 0 20 4.7zm0 8a1.8 1.8 0 0 0-1.8 1.7v3c0 1 .8 1.8 1.8 1.8h16a1.8 1.8 0 0 0 1.8-1.8v-3a1.8 1.8 0 0 0-1.8-1.8z"/></svg>',
|
|
400
413
|
emptyState: { styleIn: "width: 100%" },
|
|
401
|
-
attributes: { [
|
|
402
|
-
droppable:
|
|
414
|
+
attributes: { [se]: n },
|
|
415
|
+
droppable: Ae(a),
|
|
403
416
|
traits: [
|
|
404
417
|
// {
|
|
405
418
|
// type: 'number',
|
|
@@ -423,7 +436,7 @@ const Ft = (n, t) => {
|
|
|
423
436
|
type: "checkbox",
|
|
424
437
|
name: "snap",
|
|
425
438
|
label: "Enable Snap",
|
|
426
|
-
default:
|
|
439
|
+
default: e.snapEnabled,
|
|
427
440
|
changeProp: !0
|
|
428
441
|
},
|
|
429
442
|
{
|
|
@@ -433,7 +446,7 @@ const Ft = (n, t) => {
|
|
|
433
446
|
min: 1,
|
|
434
447
|
max: 12,
|
|
435
448
|
step: 1,
|
|
436
|
-
default:
|
|
449
|
+
default: e.snapDivisions,
|
|
437
450
|
changeProp: !0
|
|
438
451
|
}
|
|
439
452
|
],
|
|
@@ -455,163 +468,163 @@ const Ft = (n, t) => {
|
|
|
455
468
|
}
|
|
456
469
|
}
|
|
457
470
|
}), () => {
|
|
458
|
-
|
|
471
|
+
s.removeType(n);
|
|
459
472
|
};
|
|
460
|
-
},
|
|
461
|
-
class
|
|
473
|
+
}, Ue = "flexComponent", Xe = L.startup;
|
|
474
|
+
class Ye {
|
|
462
475
|
constructor() {
|
|
463
476
|
this.resizableChildTypes = /* @__PURE__ */ new Set(), this.gapAdjustableParentTypes = /* @__PURE__ */ new Set(), this.typeRelationships = /* @__PURE__ */ new Map();
|
|
464
477
|
}
|
|
465
|
-
registerResizableChild(
|
|
466
|
-
this.resizableChildTypes.add(
|
|
478
|
+
registerResizableChild(e) {
|
|
479
|
+
this.resizableChildTypes.add(e);
|
|
467
480
|
}
|
|
468
|
-
registerGapAdjustableParent(
|
|
469
|
-
this.gapAdjustableParentTypes.add(
|
|
481
|
+
registerGapAdjustableParent(e) {
|
|
482
|
+
this.gapAdjustableParentTypes.add(e);
|
|
470
483
|
}
|
|
471
|
-
registerTypeRelationship(
|
|
472
|
-
this.typeRelationships.has(
|
|
484
|
+
registerTypeRelationship(e, s) {
|
|
485
|
+
this.typeRelationships.has(e) || this.typeRelationships.set(e, /* @__PURE__ */ new Set()), this.typeRelationships.get(e).add(s), this.registerResizableChild(s), this.registerGapAdjustableParent(e);
|
|
473
486
|
}
|
|
474
|
-
isResizableChild(
|
|
475
|
-
return this.resizableChildTypes.has(
|
|
487
|
+
isResizableChild(e) {
|
|
488
|
+
return this.resizableChildTypes.has(e.get("type"));
|
|
476
489
|
}
|
|
477
|
-
isGapAdjustableParent(
|
|
478
|
-
return this.gapAdjustableParentTypes.has(
|
|
490
|
+
isGapAdjustableParent(e) {
|
|
491
|
+
return this.gapAdjustableParentTypes.has(e.get("type"));
|
|
479
492
|
}
|
|
480
|
-
isValidRelationship(
|
|
481
|
-
const
|
|
482
|
-
return this.typeRelationships.has(
|
|
493
|
+
isValidRelationship(e, s) {
|
|
494
|
+
const n = e.get("type"), a = s.get("type");
|
|
495
|
+
return this.typeRelationships.has(n) ? this.typeRelationships.get(n).has(a) : !1;
|
|
483
496
|
}
|
|
484
497
|
}
|
|
485
|
-
class
|
|
486
|
-
constructor(
|
|
487
|
-
this.editor =
|
|
488
|
-
}
|
|
489
|
-
getState(
|
|
490
|
-
return this.resizeState.has(
|
|
491
|
-
}
|
|
492
|
-
clearState(
|
|
493
|
-
return this.resizeState.delete(
|
|
494
|
-
}
|
|
495
|
-
startResize(
|
|
496
|
-
const { opts:
|
|
497
|
-
|
|
498
|
-
const o =
|
|
499
|
-
if (!o || !this.registry.isValidRelationship(o,
|
|
500
|
-
|
|
501
|
-
const
|
|
502
|
-
f !== -1 && (
|
|
503
|
-
const r = { componentColumn:
|
|
504
|
-
if (
|
|
505
|
-
const
|
|
506
|
-
|
|
498
|
+
class We {
|
|
499
|
+
constructor(e, s, n) {
|
|
500
|
+
this.editor = e, this.registry = s, this.opts = n, this.resizeState = /* @__PURE__ */ new WeakMap();
|
|
501
|
+
}
|
|
502
|
+
getState(e) {
|
|
503
|
+
return this.resizeState.has(e) || this.resizeState.set(e, {}), this.resizeState.get(e);
|
|
504
|
+
}
|
|
505
|
+
clearState(e) {
|
|
506
|
+
return this.resizeState.delete(e);
|
|
507
|
+
}
|
|
508
|
+
startResize(e, s, n) {
|
|
509
|
+
const { opts: a } = this, i = this.getState(e);
|
|
510
|
+
i.direction = s, i.startX = n.clientX, i.startY = n.clientY, i.resizing = !0, i.lastSnappedPercent = void 0;
|
|
511
|
+
const o = e.parent();
|
|
512
|
+
if (!o || !this.registry.isValidRelationship(o, e)) return;
|
|
513
|
+
i.snapEnabled = o.get("snap") ?? a.snapEnabled, i.snapDivisions = o.get("snap-divisions") ?? a.snapDivisions ?? 12;
|
|
514
|
+
const l = o.components().models, p = l.findIndex((h) => h.cid === e.cid), g = B(o, a), f = je(p, s, g, l.length);
|
|
515
|
+
f !== -1 && (i.adjacentIdx = f);
|
|
516
|
+
const r = { componentColumn: e, componentRow: o, isVertical: g };
|
|
517
|
+
if (i.startPercent = F(r, a), typeof i.adjacentIdx < "u") {
|
|
518
|
+
const h = l[i.adjacentIdx];
|
|
519
|
+
i.neighborStartPercent = F({ ...r, componentColumn: h }, a);
|
|
507
520
|
}
|
|
508
521
|
}
|
|
509
|
-
updateResizeByDelta(
|
|
510
|
-
const
|
|
511
|
-
!
|
|
512
|
-
}
|
|
513
|
-
finishResize(
|
|
514
|
-
const
|
|
515
|
-
|
|
516
|
-
}
|
|
517
|
-
updateContinuesResize(
|
|
518
|
-
const
|
|
519
|
-
if (!
|
|
520
|
-
const
|
|
521
|
-
if (typeof
|
|
522
|
-
const
|
|
523
|
-
V({ ...
|
|
524
|
-
{ ...
|
|
522
|
+
updateResizeByDelta(e, s, n) {
|
|
523
|
+
const a = this.getState(e), i = e.parent();
|
|
524
|
+
!a.resizing || !i || (a.snapEnabled ? this.updateSnapResize(e, s, n) : this.updateContinuesResize(e, s, n));
|
|
525
|
+
}
|
|
526
|
+
finishResize(e) {
|
|
527
|
+
const s = e.parent(), n = s == null ? void 0 : s.components().models, a = { componentRow: s, isVertical: !!s && B(s, this.opts) };
|
|
528
|
+
n == null || n.forEach((i) => ye({ ...a, componentColumn: i }, this.opts)), this.clearState(e);
|
|
529
|
+
}
|
|
530
|
+
updateContinuesResize(e, s, n) {
|
|
531
|
+
const a = this.getState(e), i = e.parent(), { opts: o } = this;
|
|
532
|
+
if (!i) return;
|
|
533
|
+
const l = o.minItemPercent ?? 0, p = O(s), g = te({ componentRow: i, isVertical: p }, o), f = ce(i, p, this.opts), h = 100 - f / g * 100, I = n / (g - f) * h, { startPercent: b = 0, neighborStartPercent: x = 0 } = a, v = { componentRow: i, isVertical: p, componentColumn: e, partial: !0 }, G = le(s, n) ? b + Math.abs(I) : b - Math.abs(I);
|
|
534
|
+
if (typeof a.adjacentIdx < "u") {
|
|
535
|
+
const m = i.components().models[a.adjacentIdx], R = b + x, z = R - l, c = Math.min(z, Math.max(l, G)), u = R - c;
|
|
536
|
+
V({ ...v, sizeValue: `${H(c)}%` }, o), V(
|
|
537
|
+
{ ...v, componentColumn: m, sizeValue: `${H(u)}%` },
|
|
525
538
|
o
|
|
526
539
|
);
|
|
527
540
|
} else {
|
|
528
|
-
const
|
|
529
|
-
V({ ...
|
|
541
|
+
const m = Math.max(l, Math.min(h, G));
|
|
542
|
+
V({ ...v, sizeValue: `${H(m)}%` }, o);
|
|
530
543
|
}
|
|
531
544
|
}
|
|
532
|
-
updateSnapResize(
|
|
533
|
-
const
|
|
534
|
-
if (
|
|
535
|
-
|
|
536
|
-
let
|
|
537
|
-
(r && (
|
|
538
|
-
} else
|
|
545
|
+
updateSnapResize(e, s, n) {
|
|
546
|
+
const a = this.getState(e), i = e.parent(), o = O(s), l = te({ componentRow: i, isVertical: o }, this.opts), p = ce(i, o, this.opts), g = l - p, f = n / g * 100, r = le(s, n), { startPercent: h = 0, snapDivisions: I = 12 } = a, b = r ? h + Math.abs(f) : h - Math.abs(f), x = 100 / I, v = Math.floor(b / x) * x, G = Math.ceil(b / x) * x, m = Math.abs(G - b), R = Math.abs(b - v), z = x * 0.2, S = m < R ? G : v;
|
|
547
|
+
if (S > 0 && S < 100 && (m < z || R < z) && a.lastSnappedPercent !== S) {
|
|
548
|
+
a.lastSnappedPercent = S;
|
|
549
|
+
let y = Math.abs(S - h) / 100 * g;
|
|
550
|
+
(r && (s === "left" || s === "top") || !r && (s === "right" || s === "bottom")) && (y = -y), this.updateContinuesResize(e, s, y);
|
|
551
|
+
} else m >= z && R >= z && (a.lastSnappedPercent = void 0);
|
|
539
552
|
}
|
|
540
553
|
}
|
|
541
|
-
class
|
|
542
|
-
constructor(
|
|
543
|
-
this.editor =
|
|
544
|
-
}
|
|
545
|
-
updateGapByDelta(
|
|
546
|
-
if (!this.registry.isGapAdjustableParent(
|
|
547
|
-
const { opts:
|
|
548
|
-
(
|
|
554
|
+
class Ke {
|
|
555
|
+
constructor(e, s, n) {
|
|
556
|
+
this.editor = e, this.registry = s, this.opts = n;
|
|
557
|
+
}
|
|
558
|
+
updateGapByDelta(e, s, n, a) {
|
|
559
|
+
if (!this.registry.isGapAdjustableParent(e)) return;
|
|
560
|
+
const { opts: i } = this, o = Math.max(0, n + s), l = te({ componentRow: e, isVertical: a }, i), p = o / l * 100, g = e.components().models, f = g.length - 1, r = { componentRow: e, isVertical: a }, h = g.reduce(
|
|
561
|
+
(z, S) => z + F({ ...r, componentColumn: S }, i),
|
|
549
562
|
0
|
|
550
|
-
),
|
|
551
|
-
if (
|
|
563
|
+
), b = 100 - p * f, x = i.minItemPercent || 5;
|
|
564
|
+
if (b < x * g.length)
|
|
552
565
|
return;
|
|
553
|
-
const
|
|
554
|
-
|
|
555
|
-
const
|
|
556
|
-
V({ ...
|
|
557
|
-
}),
|
|
566
|
+
const G = 100 - f * p, m = h - G, R = { componentRow: e, isVertical: a, partial: !0 };
|
|
567
|
+
g.map((z) => {
|
|
568
|
+
const S = F({ ...r, componentColumn: z }, i), c = S - S / h * m;
|
|
569
|
+
V({ ...R, componentColumn: z, sizeValue: `${H(c)}%` }, i);
|
|
570
|
+
}), be({ ...R, gapValue: `${H(p)}%` }, i);
|
|
558
571
|
}
|
|
559
|
-
finishGapAdjust(
|
|
560
|
-
|
|
572
|
+
finishGapAdjust(e) {
|
|
573
|
+
Fe(e, this.opts);
|
|
561
574
|
}
|
|
562
575
|
}
|
|
563
|
-
class
|
|
564
|
-
constructor(
|
|
565
|
-
this.editor =
|
|
576
|
+
class Je {
|
|
577
|
+
constructor(e, s, n) {
|
|
578
|
+
this.editor = e, this.registry = s, this.opts = n, this.resizeHandler = new We(e, s, n), this.gapHandler = new Ke(e, s, n);
|
|
566
579
|
}
|
|
567
|
-
startResize(
|
|
568
|
-
this.resizeHandler.startResize(
|
|
580
|
+
startResize(e, s, n) {
|
|
581
|
+
this.resizeHandler.startResize(e, s, n);
|
|
569
582
|
}
|
|
570
|
-
updateResizeByDelta(
|
|
571
|
-
this.resizeHandler.updateResizeByDelta(
|
|
583
|
+
updateResizeByDelta(e, s, n) {
|
|
584
|
+
this.resizeHandler.updateResizeByDelta(e, s, n);
|
|
572
585
|
}
|
|
573
|
-
finishResize(
|
|
574
|
-
this.resizeHandler.finishResize(
|
|
586
|
+
finishResize(e) {
|
|
587
|
+
this.resizeHandler.finishResize(e);
|
|
575
588
|
}
|
|
576
|
-
updateGapByDelta(
|
|
577
|
-
this.gapHandler.updateGapByDelta(
|
|
589
|
+
updateGapByDelta(e, s, n, a) {
|
|
590
|
+
this.gapHandler.updateGapByDelta(e, s, n, a);
|
|
578
591
|
}
|
|
579
|
-
finishGapAdjust(
|
|
580
|
-
this.gapHandler.finishGapAdjust(
|
|
592
|
+
finishGapAdjust(e) {
|
|
593
|
+
this.gapHandler.finishGapAdjust(e);
|
|
581
594
|
}
|
|
582
|
-
canResize(
|
|
583
|
-
const
|
|
584
|
-
return
|
|
595
|
+
canResize(e) {
|
|
596
|
+
const s = e.parent();
|
|
597
|
+
return s ? this.registry.isValidRelationship(s, e) : !1;
|
|
585
598
|
}
|
|
586
|
-
canAdjustGap(
|
|
587
|
-
return this.registry.isGapAdjustableParent(
|
|
599
|
+
canAdjustGap(e) {
|
|
600
|
+
return this.registry.isGapAdjustableParent(e);
|
|
588
601
|
}
|
|
589
602
|
}
|
|
590
|
-
const
|
|
591
|
-
function
|
|
592
|
-
const { Canvas:
|
|
593
|
-
let
|
|
594
|
-
const f = new
|
|
595
|
-
var
|
|
596
|
-
|
|
603
|
+
const k = "gs-flex-spots", pe = `${k}__handle-size`, qe = `${k}__handle-gap`;
|
|
604
|
+
function Ze(t, e) {
|
|
605
|
+
const { Canvas: s } = t, n = "flex-resize-spot";
|
|
606
|
+
let a, i, o, l, p = null, g = null;
|
|
607
|
+
const f = new Ye(), r = new Je(t, f, e), h = () => {
|
|
608
|
+
var c;
|
|
609
|
+
a = document.createElement("div"), a.className = k, a.style.display = "none", i = document.createElement("div"), i.className = `${k}__handles`, i.style.position = "absolute", i.style.pointerEvents = "none", i.style.zIndex = "21", o = {
|
|
597
610
|
left: document.createElement("div"),
|
|
598
611
|
right: document.createElement("div"),
|
|
599
612
|
top: document.createElement("div"),
|
|
600
613
|
bottom: document.createElement("div")
|
|
601
|
-
}, Object.entries(o).forEach(([
|
|
602
|
-
const
|
|
603
|
-
|
|
614
|
+
}, Object.entries(o).forEach(([u, y]) => {
|
|
615
|
+
const P = u, d = O(P);
|
|
616
|
+
y.className = `${pe} ${pe}-${P} gjs-resizer-h gjs-cv-unscale`, y.style.cssText = `
|
|
604
617
|
pointer-events: all;
|
|
605
618
|
position: absolute;
|
|
606
619
|
z-index: 1;
|
|
607
|
-
cursor: ${
|
|
608
|
-
${
|
|
609
|
-
${
|
|
610
|
-
${
|
|
611
|
-
${
|
|
612
|
-
${
|
|
613
|
-
`,
|
|
614
|
-
}), !
|
|
620
|
+
cursor: ${d ? "ns-resize" : "ew-resize"};
|
|
621
|
+
${d ? "left: 50%;" : "top: 50%;"}
|
|
622
|
+
${P === "left" ? "left: 0px;" : ""}
|
|
623
|
+
${P === "right" ? "right: 0px;" : ""}
|
|
624
|
+
${P === "top" ? "top: 0px;" : ""}
|
|
625
|
+
${P === "bottom" ? "bottom: 0px;" : ""}
|
|
626
|
+
`, y.addEventListener("pointerdown", I(P)), i.appendChild(y);
|
|
627
|
+
}), !e.disableGapHandler && !$(e) && (l = document.createElement("div"), l.className = qe, l.style.cssText = `
|
|
615
628
|
position: absolute;
|
|
616
629
|
background-color: var(--gs-theme-cl-cmp-bg1, #3b97e3);
|
|
617
630
|
border-width: 2px;
|
|
@@ -621,98 +634,98 @@ function qt(n, t) {
|
|
|
621
634
|
pointer-events: all;
|
|
622
635
|
max-width: 3rem;
|
|
623
636
|
max-height: 3rem;
|
|
624
|
-
`,
|
|
625
|
-
},
|
|
637
|
+
`, l.addEventListener("pointerdown", b()), i.appendChild(l)), a.append(i), (c = s.getSpotsEl()) == null || c.appendChild(a);
|
|
638
|
+
}, I = (c) => (u) => {
|
|
626
639
|
if (!p) return;
|
|
627
|
-
|
|
628
|
-
const
|
|
629
|
-
|
|
630
|
-
const
|
|
631
|
-
const
|
|
632
|
-
r.updateResizeByDelta(p,
|
|
633
|
-
},
|
|
634
|
-
r.finishResize(p),
|
|
640
|
+
u.stopPropagation(), u.preventDefault(), r.startResize(p, c, u);
|
|
641
|
+
const y = u.clientX, P = u.clientY;
|
|
642
|
+
u.target.setPointerCapture(u.pointerId);
|
|
643
|
+
const d = (E) => {
|
|
644
|
+
const C = t.Canvas.getZoomMultiplier(), A = (E.clientX - y) * C, _ = (E.clientY - P) * C, Y = O(c) ? _ : A;
|
|
645
|
+
r.updateResizeByDelta(p, c, Y);
|
|
646
|
+
}, w = () => {
|
|
647
|
+
r.finishResize(p), u.target.releasePointerCapture(u.pointerId), document.removeEventListener("pointermove", d), document.removeEventListener("pointerup", w);
|
|
635
648
|
};
|
|
636
|
-
document.addEventListener("pointermove",
|
|
637
|
-
},
|
|
638
|
-
if (!
|
|
639
|
-
const
|
|
640
|
-
|
|
641
|
-
const
|
|
642
|
-
|
|
643
|
-
const
|
|
644
|
-
const
|
|
645
|
-
r.updateGapByDelta(
|
|
646
|
-
},
|
|
647
|
-
r.finishGapAdjust(
|
|
649
|
+
document.addEventListener("pointermove", d), document.addEventListener("pointerup", w);
|
|
650
|
+
}, b = () => (c) => {
|
|
651
|
+
if (!g) return;
|
|
652
|
+
const u = g;
|
|
653
|
+
c.stopPropagation(), c.preventDefault();
|
|
654
|
+
const y = B(u, e), P = ee({ componentRow: u, isVertical: y }, e), d = c.clientX, w = c.clientY;
|
|
655
|
+
c.target.setPointerCapture(c.pointerId);
|
|
656
|
+
const E = (A) => {
|
|
657
|
+
const _ = t.Canvas.getZoomMultiplier(), Y = y ? (A.clientY - w) * _ : (A.clientX - d) * _;
|
|
658
|
+
r.updateGapByDelta(u, Y, P, y);
|
|
659
|
+
}, C = () => {
|
|
660
|
+
r.finishGapAdjust(u), c.target.releasePointerCapture(c.pointerId), document.removeEventListener("pointermove", E), document.removeEventListener("pointerup", C);
|
|
648
661
|
};
|
|
649
|
-
document.addEventListener("pointermove",
|
|
650
|
-
},
|
|
651
|
-
const
|
|
652
|
-
if (!
|
|
653
|
-
const
|
|
654
|
-
|
|
655
|
-
const
|
|
656
|
-
|
|
657
|
-
const
|
|
658
|
-
if (Object.values(o).forEach(
|
|
659
|
-
if (
|
|
660
|
-
const
|
|
661
|
-
|
|
662
|
-
}),
|
|
663
|
-
const
|
|
664
|
-
|
|
662
|
+
document.addEventListener("pointermove", E), document.addEventListener("pointerup", C);
|
|
663
|
+
}, x = (c) => {
|
|
664
|
+
const u = c.component;
|
|
665
|
+
if (!u || !a || (p = u, g = u.parent(), !g)) return;
|
|
666
|
+
const y = g;
|
|
667
|
+
re(a);
|
|
668
|
+
const P = c.getStyle();
|
|
669
|
+
i && Object.assign(i.style, P);
|
|
670
|
+
const d = B(y, e), w = $e(d);
|
|
671
|
+
if (Object.values(o).forEach(oe), w.forEach((C) => {
|
|
672
|
+
if (Ne(u, C)) return;
|
|
673
|
+
const A = o[C];
|
|
674
|
+
re(A);
|
|
675
|
+
}), T(e).gapHandler.isGapSupported() && l && Be(u)) {
|
|
676
|
+
const C = ee({ componentRow: y, isVertical: d }, e);
|
|
677
|
+
v(C, d, De(u));
|
|
665
678
|
}
|
|
666
|
-
},
|
|
667
|
-
const
|
|
668
|
-
if (
|
|
669
|
-
|
|
670
|
-
const
|
|
671
|
-
|
|
679
|
+
}, v = (c, u, y = !1) => {
|
|
680
|
+
const P = e.gapHandleSize, d = l.style;
|
|
681
|
+
if (u) {
|
|
682
|
+
d.height = `${P}px`;
|
|
683
|
+
const w = l.offsetHeight;
|
|
684
|
+
y ? (d.top = `-${(c + w) / 2}px`, d.bottom = "") : (d.bottom = `-${(c + w) / 2}px`, d.top = ""), d.width = "50%", d.left = "50%", d.transform = "translateX(-50%)", d.cursor = "row-resize";
|
|
672
685
|
} else {
|
|
673
|
-
|
|
674
|
-
const
|
|
675
|
-
|
|
686
|
+
d.width = `${P}px`;
|
|
687
|
+
const w = l.offsetWidth;
|
|
688
|
+
y ? (d.left = `-${(c + w) / 2}px`, d.right = "") : (d.right = `-${(c + w) / 2}px`, d.left = ""), d.height = "50%", d.top = "50%", d.transform = "translateY(-50%)", d.cursor = "col-resize";
|
|
676
689
|
}
|
|
677
|
-
},
|
|
678
|
-
|
|
679
|
-
},
|
|
680
|
-
|
|
681
|
-
const
|
|
682
|
-
|
|
683
|
-
},
|
|
684
|
-
const
|
|
685
|
-
|
|
686
|
-
},
|
|
687
|
-
f.registerTypeRelationship(
|
|
690
|
+
}, G = () => {
|
|
691
|
+
a && (oe(a), p = null, g = null);
|
|
692
|
+
}, m = () => {
|
|
693
|
+
s.removeSpots({ type: n });
|
|
694
|
+
const c = t.getSelected(), u = c == null ? void 0 : c.parent();
|
|
695
|
+
c && u && f.isValidRelationship(u, c) ? s.addSpot({ type: n, component: c }) : G();
|
|
696
|
+
}, R = () => {
|
|
697
|
+
const c = s.getSpots().filter((u) => u.type === n)[0];
|
|
698
|
+
c && x(c);
|
|
699
|
+
}, z = (c, u) => {
|
|
700
|
+
f.registerTypeRelationship(c, u);
|
|
688
701
|
};
|
|
689
|
-
|
|
690
|
-
|
|
702
|
+
t.onReady(() => {
|
|
703
|
+
h(), $(e) ? z("mj-section", "mj-column") : z(e.typeRow, e.typeColumn);
|
|
691
704
|
});
|
|
692
|
-
const
|
|
693
|
-
return
|
|
694
|
-
|
|
705
|
+
const S = "component:toggled";
|
|
706
|
+
return t.on(s.events.spot, R), t.on(S, m), () => {
|
|
707
|
+
t.off(s.events.spot, R), t.off(S, m);
|
|
695
708
|
};
|
|
696
709
|
}
|
|
697
|
-
const
|
|
698
|
-
const
|
|
710
|
+
const Qe = function(t, e = {}) {
|
|
711
|
+
const s = {
|
|
699
712
|
typeRow: "flex-row",
|
|
700
713
|
typeColumn: "flex-column",
|
|
701
714
|
gapHandleSize: 3,
|
|
702
715
|
snapDivisions: 12,
|
|
703
716
|
minItemPercent: 5,
|
|
704
|
-
...
|
|
705
|
-
},
|
|
706
|
-
|
|
707
|
-
editor:
|
|
708
|
-
licenseKey:
|
|
709
|
-
plan:
|
|
710
|
-
pluginName:
|
|
717
|
+
...e
|
|
718
|
+
}, n = [ke(t, s), Oe(t, s)], a = Ze(t, s), i = _e(t, s);
|
|
719
|
+
Ie({
|
|
720
|
+
editor: t,
|
|
721
|
+
licenseKey: s.licenseKey,
|
|
722
|
+
plan: Xe,
|
|
723
|
+
pluginName: Ue,
|
|
711
724
|
cleanup: () => {
|
|
712
|
-
|
|
725
|
+
n.forEach((o) => o == null ? void 0 : o()), a(), i == null || i();
|
|
713
726
|
}
|
|
714
727
|
});
|
|
715
|
-
},
|
|
728
|
+
}, et = Ce(Qe);
|
|
716
729
|
export {
|
|
717
|
-
|
|
730
|
+
et as default
|
|
718
731
|
};
|