@grapesjs/studio-sdk-plugins 1.0.28-rc.2 → 1.0.28
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 +8 -8
- package/dist/accordionComponent/index.es.js +71 -69
- package/dist/accordionComponent/index.umd.js +6 -6
- package/dist/animationComponent/index.cjs.js +3 -3
- package/dist/animationComponent/index.es.js +48 -46
- package/dist/animationComponent/index.umd.js +3 -3
- package/dist/canvasAbsoluteMode/index.cjs.js +1 -1
- package/dist/canvasAbsoluteMode/index.es.js +86 -84
- package/dist/canvasAbsoluteMode/index.umd.js +1 -1
- package/dist/canvasEmptyState/index.cjs.js +1 -1
- package/dist/canvasEmptyState/index.es.js +68 -66
- package/dist/canvasEmptyState/index.umd.js +1 -1
- package/dist/canvasFullSize/index.cjs.js +3 -3
- package/dist/canvasFullSize/index.es.js +52 -50
- package/dist/canvasFullSize/index.umd.js +7 -7
- package/dist/canvasGridMode/index.cjs.js +5 -5
- package/dist/canvasGridMode/index.es.js +191 -189
- package/dist/canvasGridMode/index.umd.js +2 -2
- package/dist/dataSourceEjs/index.cjs.js +3 -3
- package/dist/dataSourceEjs/index.es.js +32 -30
- package/dist/dataSourceEjs/index.umd.js +3 -3
- package/dist/dataSourceHandlebars/index.cjs.js +4 -4
- package/dist/dataSourceHandlebars/index.es.js +31 -29
- package/dist/dataSourceHandlebars/index.umd.js +2 -2
- package/dist/dialogComponent/index.cjs.js +3 -3
- package/dist/dialogComponent/index.es.js +32 -30
- package/dist/dialogComponent/index.umd.js +4 -4
- package/dist/flexComponent/index.cjs.js +6 -6
- package/dist/flexComponent/index.es.js +74 -72
- package/dist/flexComponent/index.umd.js +7 -7
- package/dist/fsLightboxComponent/index.cjs.js +2 -2
- package/dist/fsLightboxComponent/index.es.js +40 -38
- package/dist/fsLightboxComponent/index.umd.js +2 -2
- package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
- package/dist/googleFontsAssetProvider/index.es.js +70 -68
- package/dist/googleFontsAssetProvider/index.umd.js +1 -1
- package/dist/iconifyComponent/index.cjs.js +2 -2
- package/dist/iconifyComponent/index.es.js +56 -54
- package/dist/iconifyComponent/index.umd.js +2 -2
- package/dist/index.cjs.js +43 -43
- package/dist/index.es.js +1442 -1440
- package/dist/index.umd.js +43 -43
- package/dist/layoutSidebarButtons/index.cjs.js +1 -1
- package/dist/layoutSidebarButtons/index.es.js +29 -27
- package/dist/layoutSidebarButtons/index.umd.js +1 -1
- package/dist/lightGalleryComponent/index.cjs.js +1 -1
- package/dist/lightGalleryComponent/index.es.js +90 -88
- package/dist/lightGalleryComponent/index.umd.js +1 -1
- package/dist/linkImageComponent/index.cjs.js +2 -2
- package/dist/linkImageComponent/index.es.js +20 -18
- package/dist/linkImageComponent/index.umd.js +2 -2
- package/dist/listPagesComponent/index.cjs.js +4 -4
- package/dist/listPagesComponent/index.es.js +42 -40
- package/dist/listPagesComponent/index.umd.js +4 -4
- package/dist/presetPrintable/index.cjs.js +3 -3
- package/dist/presetPrintable/index.es.js +156 -154
- package/dist/presetPrintable/index.umd.js +3 -3
- package/dist/prosemirror/index.cjs.js +7 -7
- package/dist/prosemirror/index.es.js +165 -163
- package/dist/prosemirror/index.umd.js +7 -7
- package/dist/rendererReact/index.cjs.js +1 -1
- package/dist/rendererReact/index.es.js +101 -99
- 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 +54 -52
- package/dist/rteTinyMce/index.umd.js +2 -2
- package/dist/swiperComponent/index.cjs.js +7 -7
- package/dist/swiperComponent/index.es.js +60 -58
- package/dist/swiperComponent/index.umd.js +9 -9
- package/dist/tableComponent/index.cjs.js +1 -1
- package/dist/tableComponent/index.es.js +80 -78
- package/dist/tableComponent/index.umd.js +1 -1
- package/dist/youtubeAssetProvider/index.cjs.js +1 -1
- package/dist/youtubeAssetProvider/index.es.js +66 -64
- package/dist/youtubeAssetProvider/index.umd.js +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
const q = "app.grapesjs.com", H = "app-stage.grapesjs.com",
|
|
1
|
+
const q = "app.grapesjs.com", H = "app-stage.grapesjs.com", nt = "app2.grapesjs.com", rt = "app-stage2.grapesjs.com", W = [
|
|
2
2
|
q,
|
|
3
|
+
nt,
|
|
3
4
|
H,
|
|
5
|
+
rt,
|
|
4
6
|
"localhost",
|
|
5
7
|
"127.0.0.1",
|
|
6
8
|
".local-credentialless.webcontainer.io",
|
|
@@ -9,86 +11,86 @@ const q = "app.grapesjs.com", H = "app-stage.grapesjs.com", B = [
|
|
|
9
11
|
// For stackblitz.com demos
|
|
10
12
|
"-sandpack.codesandbox.io"
|
|
11
13
|
// For Sandpack demos
|
|
12
|
-
],
|
|
13
|
-
const t =
|
|
14
|
-
return !!t && (
|
|
14
|
+
], st = "license:check:start", at = "license:check:end", it = () => typeof window < "u", lt = ({ isDev: t, isStage: e }) => `${t ? "" : `https://${e ? H : q}`}/api`, ct = () => {
|
|
15
|
+
const t = it() && window.location.hostname;
|
|
16
|
+
return !!t && (W.includes(t) || W.some((e) => t.endsWith(e)));
|
|
15
17
|
};
|
|
16
18
|
function Y(t) {
|
|
17
19
|
return typeof t == "function";
|
|
18
20
|
}
|
|
19
|
-
async function
|
|
21
|
+
async function pt({
|
|
20
22
|
path: t,
|
|
21
23
|
baseApiUrl: e,
|
|
22
24
|
method: r = "GET",
|
|
23
|
-
headers:
|
|
24
|
-
params:
|
|
25
|
+
headers: n = {},
|
|
26
|
+
params: o,
|
|
25
27
|
body: i
|
|
26
28
|
}) {
|
|
27
|
-
const l = `${e ||
|
|
29
|
+
const l = `${e || lt({ isDev: !1, isStage: !1 })}${t}`, c = {
|
|
28
30
|
method: r,
|
|
29
31
|
headers: {
|
|
30
32
|
"Content-Type": "application/json",
|
|
31
|
-
...
|
|
33
|
+
...n
|
|
32
34
|
}
|
|
33
35
|
};
|
|
34
36
|
i && (c.body = JSON.stringify(i));
|
|
35
|
-
const p =
|
|
37
|
+
const p = o ? new URLSearchParams(o).toString() : "", a = p ? `?${p}` : "", d = await fetch(`${l}${a}`, c);
|
|
36
38
|
if (!d.ok)
|
|
37
39
|
throw new Error(`HTTP error! status: ${d.status}`);
|
|
38
40
|
return d.json();
|
|
39
41
|
}
|
|
40
42
|
var R = /* @__PURE__ */ ((t) => (t.free = "free", t.startup = "startup", t.business = "business", t.enterprise = "enterprise", t))(R || {});
|
|
41
|
-
const
|
|
43
|
+
const j = {
|
|
42
44
|
[R.free]: 0,
|
|
43
45
|
[R.startup]: 10,
|
|
44
46
|
[R.business]: 20,
|
|
45
47
|
[R.enterprise]: 30
|
|
46
48
|
};
|
|
47
|
-
function
|
|
49
|
+
function dt(t) {
|
|
48
50
|
const e = t;
|
|
49
|
-
return e.init = (r) => (
|
|
51
|
+
return e.init = (r) => (n) => t(n, r), e;
|
|
50
52
|
}
|
|
51
|
-
const
|
|
52
|
-
async function
|
|
53
|
+
const ut = (t) => /* @__PURE__ */ dt(t);
|
|
54
|
+
async function gt({
|
|
53
55
|
editor: t,
|
|
54
56
|
plan: e,
|
|
55
57
|
pluginName: r,
|
|
56
|
-
licenseKey:
|
|
57
|
-
cleanup:
|
|
58
|
+
licenseKey: n,
|
|
59
|
+
cleanup: o
|
|
58
60
|
}) {
|
|
59
61
|
let i = "", s = !1;
|
|
60
|
-
const l =
|
|
61
|
-
console.warn("Cleanup plugin:", r, "Reason:", a),
|
|
62
|
+
const l = ct(), c = (a) => {
|
|
63
|
+
console.warn("Cleanup plugin:", r, "Reason:", a), o();
|
|
62
64
|
}, p = (a = {}) => {
|
|
63
|
-
var
|
|
64
|
-
const { error: d, sdkLicense: u } = a,
|
|
65
|
+
var m;
|
|
66
|
+
const { error: d, sdkLicense: u } = a, g = (m = a.plan) == null ? void 0 : m.category;
|
|
65
67
|
if (!(u || a.license) || d)
|
|
66
68
|
c(d || "Invalid license");
|
|
67
|
-
else if (
|
|
68
|
-
const w =
|
|
69
|
-
w > b && c({ pluginRequiredPlan: e, licensePlan:
|
|
69
|
+
else if (g) {
|
|
70
|
+
const w = j[e], b = j[g];
|
|
71
|
+
w > b && c({ pluginRequiredPlan: e, licensePlan: g });
|
|
70
72
|
}
|
|
71
73
|
};
|
|
72
|
-
t.on(
|
|
74
|
+
t.on(st, (a) => {
|
|
73
75
|
i = a == null ? void 0 : a.baseApiUrl, s = !0;
|
|
74
|
-
}), t.on(
|
|
76
|
+
}), t.on(at, (a) => {
|
|
75
77
|
p(a);
|
|
76
78
|
}), setTimeout(async () => {
|
|
77
79
|
if (!s) {
|
|
78
80
|
if (l) return;
|
|
79
|
-
if (
|
|
80
|
-
const a = await
|
|
81
|
+
if (n) {
|
|
82
|
+
const a = await mt({ licenseKey: n, pluginName: r, baseApiUrl: i });
|
|
81
83
|
a && p(a);
|
|
82
84
|
} else
|
|
83
85
|
c("The `licenseKey` option not provided");
|
|
84
86
|
}
|
|
85
87
|
}, 2e3);
|
|
86
88
|
}
|
|
87
|
-
async function
|
|
88
|
-
const { licenseKey: e, pluginName: r, baseApiUrl:
|
|
89
|
+
async function mt(t) {
|
|
90
|
+
const { licenseKey: e, pluginName: r, baseApiUrl: n } = t;
|
|
89
91
|
try {
|
|
90
|
-
return (await
|
|
91
|
-
baseApiUrl:
|
|
92
|
+
return (await pt({
|
|
93
|
+
baseApiUrl: n,
|
|
92
94
|
path: `/sdk/${e || "na"}`,
|
|
93
95
|
method: "POST",
|
|
94
96
|
params: {
|
|
@@ -96,15 +98,15 @@ async function ut(t) {
|
|
|
96
98
|
pn: r
|
|
97
99
|
}
|
|
98
100
|
})).result || {};
|
|
99
|
-
} catch (
|
|
100
|
-
return console.error("Error during SDK license check:",
|
|
101
|
+
} catch (o) {
|
|
102
|
+
return console.error("Error during SDK license check:", o), !1;
|
|
101
103
|
}
|
|
102
104
|
}
|
|
103
|
-
const
|
|
104
|
-
const t = "data-gjs-drag-grid-style", e = document, r = "var(--gs-theme-cl-cmp-bg1, var(--gjs-color-highlight))",
|
|
105
|
-
|
|
105
|
+
const N = "canvasGridMode", ft = R.startup, L = "component-grid-mode", A = "grid-mode", D = "gjs-drag-grid-spot", K = `${D}__grid-item`, X = `${D}__grid-target`, J = `${D}__snapped`, yt = `${D}__container`, ht = () => {
|
|
106
|
+
const t = "data-gjs-drag-grid-style", e = document, r = "var(--gs-theme-cl-cmp-bg1, var(--gjs-color-highlight))", n = "var(--gs-theme-cl-cmp-bg2, var(--gjs-color-blue))", o = e.querySelector(`style[${t}]`) || e.createElement("style");
|
|
107
|
+
o.setAttribute(t, "true"), o.innerHTML = `
|
|
106
108
|
.${K} {
|
|
107
|
-
outline: 2px solid ${
|
|
109
|
+
outline: 2px solid ${n};
|
|
108
110
|
background: ${r};
|
|
109
111
|
outline-offset: -2px;
|
|
110
112
|
border-radius: 3px;
|
|
@@ -115,7 +117,7 @@ const L = "canvasGridMode", mt = R.startup, N = "component-grid-mode", A = "grid
|
|
|
115
117
|
.${J} {
|
|
116
118
|
width: 100%;
|
|
117
119
|
height: 100%;
|
|
118
|
-
outline: 2px solid ${
|
|
120
|
+
outline: 2px solid ${n};
|
|
119
121
|
outline-offset: -2px;
|
|
120
122
|
position: absolute;
|
|
121
123
|
}
|
|
@@ -123,36 +125,36 @@ const L = "canvasGridMode", mt = R.startup, N = "component-grid-mode", A = "grid
|
|
|
123
125
|
position: absolute;
|
|
124
126
|
z-index: -1;
|
|
125
127
|
background: ${r};
|
|
126
|
-
outline: 1px solid ${
|
|
128
|
+
outline: 1px solid ${n};
|
|
127
129
|
outline-offset: -1px;
|
|
128
130
|
opacity: 0.35;
|
|
129
131
|
}
|
|
130
|
-
`, e.head.appendChild(
|
|
132
|
+
`, e.head.appendChild(o);
|
|
131
133
|
};
|
|
132
134
|
function Q(t) {
|
|
133
|
-
const { editor: e, type: r } = t,
|
|
134
|
-
if (!
|
|
135
|
+
const { editor: e, type: r } = t, n = $t(e, t.component), o = z(e, n.component);
|
|
136
|
+
if (!vt(e, n, o, r))
|
|
135
137
|
return {
|
|
136
|
-
target:
|
|
137
|
-
container:
|
|
138
|
+
target: n,
|
|
139
|
+
container: o,
|
|
138
140
|
startScroll: et(e).scroll,
|
|
139
141
|
shadowContainerEl: document.createElement("div"),
|
|
140
142
|
shadowSnappedEl: document.createElement("div"),
|
|
141
143
|
shadowTargetEl: document.createElement("div"),
|
|
142
144
|
spot: e.Canvas.addSpot({
|
|
143
145
|
type: A,
|
|
144
|
-
component:
|
|
146
|
+
component: o.component
|
|
145
147
|
})
|
|
146
148
|
};
|
|
147
149
|
}
|
|
148
150
|
function Z(t) {
|
|
149
|
-
const { editor: e, shadowTargetEl: r, shadowSnappedEl:
|
|
150
|
-
i == null || i.appendChild(
|
|
151
|
+
const { editor: e, shadowTargetEl: r, shadowSnappedEl: n, shadowContainerEl: o, spotEl: i, target: s, container: l } = t, { Canvas: c } = e, p = e.config.stylePrefix;
|
|
152
|
+
i == null || i.appendChild(o), o == null || o.appendChild(r), o == null || o.appendChild(n), wt(o, l), St(r, s, l), bt(n, s), Ct(o, l.el), s.el.style.opacity = "0";
|
|
151
153
|
const a = c.getSpots().filter((d) => d.type !== A);
|
|
152
154
|
e.em.stopDefault({ preserveSelected: !0 }), c.removeSpots(a), c.startAutoscroll(), c.getBody().classList.add(`${p}is__grabbing`);
|
|
153
155
|
}
|
|
154
156
|
function V(t) {
|
|
155
|
-
const { editor: e, shadowSnappedEl: r, shadowContainerEl:
|
|
157
|
+
const { editor: e, shadowSnappedEl: r, shadowContainerEl: n, target: o, cancelled: i } = t, { Canvas: s } = e, l = e.config.stylePrefix, { component: c } = o;
|
|
156
158
|
if (!i) {
|
|
157
159
|
const p = window.getComputedStyle(r);
|
|
158
160
|
c.addStyle({
|
|
@@ -161,32 +163,32 @@ function V(t) {
|
|
|
161
163
|
height: ""
|
|
162
164
|
});
|
|
163
165
|
}
|
|
164
|
-
|
|
166
|
+
o.el.style.opacity = "", n.contains(r) && (n == null || n.removeChild(r)), e.getModel().runDefault({ preserveSelected: 1 }), s.stopAutoscroll(), s.getBody().classList.remove(`${l}is__grabbing`), s.removeSpots({ type: A }), e.select(c);
|
|
165
167
|
}
|
|
166
|
-
function
|
|
168
|
+
function wt(t, {
|
|
167
169
|
rows: e,
|
|
168
170
|
columns: r
|
|
169
171
|
}) {
|
|
170
|
-
const
|
|
171
|
-
for (let
|
|
172
|
-
o
|
|
172
|
+
const n = [];
|
|
173
|
+
for (let o = 0; o < r.length; o++) {
|
|
174
|
+
n[o] = [];
|
|
173
175
|
for (let i = 0; i < e.length; i++) {
|
|
174
176
|
const s = document.createElement("div");
|
|
175
|
-
s.className = K, s.style.gridArea = `${i + 1} / ${
|
|
177
|
+
s.className = K, s.style.gridArea = `${i + 1} / ${o + 1}`, n[o][i] = s, t.appendChild(s);
|
|
176
178
|
}
|
|
177
179
|
}
|
|
178
|
-
return
|
|
180
|
+
return n;
|
|
179
181
|
}
|
|
180
|
-
function
|
|
182
|
+
function St(t, e, r) {
|
|
181
183
|
return t.className = X, t.style.top = `${e.offset.top - r.offset.top}px`, t.style.left = `${e.offset.left - r.offset.left}px`, t.style.width = `${e.offset.width + e.margin.left + e.margin.right}px`, t.style.height = `${e.offset.height + e.margin.top + e.margin.bottom}px`, t;
|
|
182
184
|
}
|
|
183
|
-
function
|
|
184
|
-
const r =
|
|
185
|
+
function bt(t, e) {
|
|
186
|
+
const r = ot(e.el, e.computedStyles);
|
|
185
187
|
return t.className = J, t.style.gridArea = `${r.row.start} / ${r.column.start} / ${r.row.end} / ${r.column.end}`, t;
|
|
186
188
|
}
|
|
187
|
-
function
|
|
189
|
+
function Ct(t, e) {
|
|
188
190
|
const r = window.getComputedStyle(e);
|
|
189
|
-
t.className =
|
|
191
|
+
t.className = yt, t.style.position = "relative", t.style.display = r.display, t.style.gap = r.gap, t.style.padding = r.padding, t.style.border = r.border, t.style.gridTemplateColumns = r.gridTemplateColumns, t.style.gridTemplateRows = r.gridTemplateRows;
|
|
190
192
|
}
|
|
191
193
|
function tt(t, e) {
|
|
192
194
|
if (e) {
|
|
@@ -195,48 +197,48 @@ function tt(t, e) {
|
|
|
195
197
|
} else return [...t.getSelectedAll()].pop();
|
|
196
198
|
return e;
|
|
197
199
|
}
|
|
198
|
-
function
|
|
199
|
-
const r = tt(t, e),
|
|
200
|
+
function $t(t, e) {
|
|
201
|
+
const r = tt(t, e), n = r.getEl(), o = window.getComputedStyle(n);
|
|
200
202
|
return {
|
|
201
203
|
component: r,
|
|
202
|
-
el:
|
|
203
|
-
offset: t.Canvas.offset(
|
|
204
|
+
el: n,
|
|
205
|
+
offset: t.Canvas.offset(n),
|
|
204
206
|
margin: {
|
|
205
|
-
top: parseFloat(
|
|
206
|
-
right: parseFloat(
|
|
207
|
-
bottom: parseFloat(
|
|
208
|
-
left: parseFloat(
|
|
207
|
+
top: parseFloat(o.marginTop),
|
|
208
|
+
right: parseFloat(o.marginRight),
|
|
209
|
+
bottom: parseFloat(o.marginBottom),
|
|
210
|
+
left: parseFloat(o.marginLeft)
|
|
209
211
|
},
|
|
210
|
-
computedStyles:
|
|
212
|
+
computedStyles: o
|
|
211
213
|
};
|
|
212
214
|
}
|
|
213
215
|
function z(t, e) {
|
|
214
|
-
const r = e.parent(),
|
|
216
|
+
const r = e.parent(), n = r.getEl(), o = window.getComputedStyle(n);
|
|
215
217
|
return {
|
|
216
218
|
component: r,
|
|
217
|
-
el:
|
|
218
|
-
offset: t.Canvas.offset(
|
|
219
|
-
computedStyles:
|
|
219
|
+
el: n,
|
|
220
|
+
offset: t.Canvas.offset(n),
|
|
221
|
+
computedStyles: o,
|
|
220
222
|
padding: {
|
|
221
|
-
top: parseFloat(
|
|
222
|
-
right: parseFloat(
|
|
223
|
-
bottom: parseFloat(
|
|
224
|
-
left: parseFloat(
|
|
223
|
+
top: parseFloat(o.paddingTop),
|
|
224
|
+
right: parseFloat(o.paddingRight),
|
|
225
|
+
bottom: parseFloat(o.paddingBottom),
|
|
226
|
+
left: parseFloat(o.paddingLeft)
|
|
225
227
|
},
|
|
226
|
-
columns:
|
|
227
|
-
rows:
|
|
228
|
+
columns: o.gridTemplateColumns.split(" ").map((s) => parseFloat(s)),
|
|
229
|
+
rows: o.gridTemplateRows.split(" ").map((s) => parseFloat(s)),
|
|
228
230
|
gap: {
|
|
229
|
-
column: parseInt(
|
|
230
|
-
row: parseInt(
|
|
231
|
+
column: parseInt(o.columnGap),
|
|
232
|
+
row: parseInt(o.rowGap)
|
|
231
233
|
}
|
|
232
234
|
};
|
|
233
235
|
}
|
|
234
|
-
function E(t, e, r,
|
|
236
|
+
function E(t, e, r, n, o = 1) {
|
|
235
237
|
let i = 0;
|
|
236
238
|
for (let s = e; s <= t.length; s++) {
|
|
237
|
-
if (i + (t[s - 1] +
|
|
239
|
+
if (i + (t[s - 1] + n) * o > r)
|
|
238
240
|
return s;
|
|
239
|
-
i +=
|
|
241
|
+
i += n + t[s - 1];
|
|
240
242
|
}
|
|
241
243
|
return t.length + 1;
|
|
242
244
|
}
|
|
@@ -249,45 +251,45 @@ function et(t) {
|
|
|
249
251
|
}
|
|
250
252
|
};
|
|
251
253
|
}
|
|
252
|
-
function
|
|
253
|
-
const
|
|
254
|
-
return
|
|
254
|
+
function vt(t, e, r, n) {
|
|
255
|
+
const o = (i) => t.em.logWarning(i);
|
|
256
|
+
return n === "draggable" && e.component.get(n) === !1 ? (o(`[${N}] The element is not ${n}`), !0) : r.computedStyles.display !== "grid" ? (o(`[${N}] The container does not have style display:grid`), !0) : !1;
|
|
255
257
|
}
|
|
256
258
|
function _(t, e, r = {}) {
|
|
257
|
-
const
|
|
258
|
-
if (!
|
|
259
|
+
const n = tt(t, e), o = n == null ? void 0 : n.parent(), i = o == null ? void 0 : o.getEl();
|
|
260
|
+
if (!o || !i)
|
|
259
261
|
return !1;
|
|
260
262
|
const { enableGrid: s } = r, l = window.getComputedStyle(i).display === "grid";
|
|
261
|
-
return Y(s) ? s({ component:
|
|
263
|
+
return Y(s) ? s({ component: n, parent: o, isParentGrid: l }) : l;
|
|
262
264
|
}
|
|
263
|
-
const
|
|
264
|
-
function
|
|
265
|
-
const r = t.ownerDocument.defaultView,
|
|
266
|
-
isComputed:
|
|
267
|
-
raw:
|
|
265
|
+
const B = (t) => t.split(" ").map((e) => parseFloat(e));
|
|
266
|
+
function ot(t, e) {
|
|
267
|
+
const r = t.ownerDocument.defaultView, n = e || r.getComputedStyle(t), o = n.gridArea.split("/").some((S) => isNaN(parseInt(S.trim()))), i = {
|
|
268
|
+
isComputed: o,
|
|
269
|
+
raw: n.gridArea
|
|
268
270
|
};
|
|
269
|
-
if (!
|
|
271
|
+
if (!o)
|
|
270
272
|
return {
|
|
271
273
|
...i,
|
|
272
274
|
row: {
|
|
273
|
-
start: parseInt(
|
|
274
|
-
end: parseInt(
|
|
275
|
+
start: parseInt(n.gridRowStart),
|
|
276
|
+
end: parseInt(n.gridRowEnd)
|
|
275
277
|
},
|
|
276
278
|
column: {
|
|
277
|
-
start: parseInt(
|
|
278
|
-
end: parseInt(
|
|
279
|
+
start: parseInt(n.gridColumnStart),
|
|
280
|
+
end: parseInt(n.gridColumnEnd)
|
|
279
281
|
}
|
|
280
282
|
};
|
|
281
|
-
const s = t.parentElement, l = r.getComputedStyle(s), c = parseFloat(l.columnGap) || 0, p = parseFloat(l.rowGap) || 0, a =
|
|
283
|
+
const s = t.parentElement, l = r.getComputedStyle(s), c = parseFloat(l.columnGap) || 0, p = parseFloat(l.rowGap) || 0, a = B(l.gridTemplateColumns), d = B(l.gridTemplateRows), u = parseFloat(l.paddingLeft) || 0, g = parseFloat(l.paddingTop) || 0, h = s.getBoundingClientRect(), m = t.getBoundingClientRect(), w = (S, C, x, $, M) => {
|
|
282
284
|
let G = 1, T = $ + M;
|
|
283
285
|
for (let P = 0; P < C.length; P++) {
|
|
284
|
-
const I = C[P],
|
|
285
|
-
if (S >= T && S <
|
|
286
|
+
const I = C[P], O = T + I;
|
|
287
|
+
if (S >= T && S < O)
|
|
286
288
|
return G;
|
|
287
|
-
T =
|
|
289
|
+
T = O + x, G++;
|
|
288
290
|
}
|
|
289
291
|
return -1;
|
|
290
|
-
}, b = w(
|
|
292
|
+
}, b = w(m.left, a, c, h.left, u), v = w(m.right - 1, a, c, h.left, u) + 1, y = w(m.top, d, p, h.top, g), f = w(m.bottom - 1, d, p, h.top, g) + 1;
|
|
291
293
|
return {
|
|
292
294
|
...i,
|
|
293
295
|
row: {
|
|
@@ -300,18 +302,18 @@ function nt(t, e) {
|
|
|
300
302
|
}
|
|
301
303
|
};
|
|
302
304
|
}
|
|
303
|
-
function
|
|
304
|
-
t.Commands.add(
|
|
305
|
+
function Et(t) {
|
|
306
|
+
t.Commands.add(L, {
|
|
305
307
|
stop() {
|
|
306
308
|
},
|
|
307
|
-
run(e, r,
|
|
308
|
-
const
|
|
309
|
-
if (!
|
|
309
|
+
run(e, r, n = {}) {
|
|
310
|
+
const o = Q({ editor: e, component: n.target, type: "draggable" });
|
|
311
|
+
if (!o) {
|
|
310
312
|
this.stopCommand();
|
|
311
313
|
return;
|
|
312
314
|
}
|
|
313
|
-
const { spot: i, target: s, shadowContainerEl: l, shadowSnappedEl: c, shadowTargetEl: p, startScroll: a } =
|
|
314
|
-
let { container: d } =
|
|
315
|
+
const { spot: i, target: s, shadowContainerEl: l, shadowSnappedEl: c, shadowTargetEl: p, startScroll: a } = o;
|
|
316
|
+
let { container: d } = o, u;
|
|
315
317
|
new e.Utils.Dragger({
|
|
316
318
|
doc: s.el.ownerDocument,
|
|
317
319
|
onStart: () => {
|
|
@@ -327,7 +329,7 @@ function $t(t) {
|
|
|
327
329
|
}), d = z(e, s.component);
|
|
328
330
|
}, 10);
|
|
329
331
|
},
|
|
330
|
-
onEnd: (h,
|
|
332
|
+
onEnd: (h, m, { cancelled: w }) => {
|
|
331
333
|
clearTimeout(u), V({
|
|
332
334
|
editor: e,
|
|
333
335
|
shadowSnappedEl: c,
|
|
@@ -336,26 +338,26 @@ function $t(t) {
|
|
|
336
338
|
cancelled: w
|
|
337
339
|
}), this.stopCommand(), e.em.set("_cmpDrag", 1);
|
|
338
340
|
},
|
|
339
|
-
setPosition: ({ x: h, y:
|
|
340
|
-
const { scroll: w } = et(e), { columns: b, rows: v, gap: y, offset: f, padding: S } = d, { offset: C, margin: x } = s, $ = C.top - f.top - S.top - x.top +
|
|
341
|
+
setPosition: ({ x: h, y: m }) => {
|
|
342
|
+
const { scroll: w } = et(e), { columns: b, rows: v, gap: y, offset: f, padding: S } = d, { offset: C, margin: x } = s, $ = C.top - f.top - S.top - x.top + m - a.top + w.top, M = C.left - f.left - S.left - x.left + h - a.left + w.left, G = Math.min(E(b, 1, M, y.column, 0.5), b.length), T = Math.min(E(v, 1, $, y.row, 0.5), v.length), P = Math.min(
|
|
341
343
|
E(b, G, C.width, y.column) + 1,
|
|
342
344
|
b.length + 1
|
|
343
345
|
), I = Math.min(E(v, T, C.height, y.row) + 1, v.length + 1);
|
|
344
346
|
c.style.gridArea = `${T} / ${G} / ${I} / ${P}`, p.style.top = `${$ + S.top}px`, p.style.left = `${M + S.left}px`;
|
|
345
347
|
}
|
|
346
|
-
}).start(
|
|
348
|
+
}).start(n.event);
|
|
347
349
|
}
|
|
348
350
|
});
|
|
349
351
|
}
|
|
350
|
-
function
|
|
352
|
+
function xt(t, e) {
|
|
351
353
|
const r = Q({ editor: t, component: e.component, type: "resizable" });
|
|
352
354
|
if (!r)
|
|
353
355
|
return;
|
|
354
|
-
const { onMove:
|
|
356
|
+
const { onMove: n, onEnd: o } = e.options || {}, { spot: i, target: s, shadowContainerEl: l, shadowSnappedEl: c, shadowTargetEl: p } = r;
|
|
355
357
|
let { container: a } = r, d = "", u;
|
|
356
358
|
return {
|
|
357
|
-
onStart: (
|
|
358
|
-
d =
|
|
359
|
+
onStart: (g) => {
|
|
360
|
+
d = g.target.dataset.gjsHandler || "", u = setTimeout(() => {
|
|
359
361
|
Z({
|
|
360
362
|
editor: t,
|
|
361
363
|
shadowTargetEl: p,
|
|
@@ -367,67 +369,67 @@ function vt(t, e) {
|
|
|
367
369
|
}), a = z(t, s.component);
|
|
368
370
|
}, 10), t.trigger("component:resize", { ...s, type: "start" });
|
|
369
371
|
},
|
|
370
|
-
onEnd: (
|
|
371
|
-
const { startDim:
|
|
372
|
-
clearTimeout(u), V({ editor: t, shadowSnappedEl: c, shadowContainerEl: l, target: s, cancelled: b }),
|
|
372
|
+
onEnd: (g, h) => {
|
|
373
|
+
const { startDim: m, rectDim: w } = h.resizer, b = JSON.stringify(m) === JSON.stringify(w);
|
|
374
|
+
clearTimeout(u), V({ editor: t, shadowSnappedEl: c, shadowContainerEl: l, target: s, cancelled: b }), o == null || o(g, h);
|
|
373
375
|
},
|
|
374
|
-
onMove: (
|
|
375
|
-
const
|
|
376
|
+
onMove: (g, h) => {
|
|
377
|
+
const m = ot(c), w = s.margin.left, b = s.margin.top, v = s.margin.bottom, y = s.margin.right, { w: f, t: S, l: C, h: x } = h.resizer.rectDim, $ = {
|
|
376
378
|
t: S - b,
|
|
377
379
|
l: C - w,
|
|
378
380
|
h: x + b + v,
|
|
379
381
|
w: f + w + y
|
|
380
382
|
};
|
|
381
|
-
d.endsWith("l") && (
|
|
383
|
+
d.endsWith("l") && (m.column.start = E(
|
|
382
384
|
a.columns,
|
|
383
385
|
1,
|
|
384
386
|
$.l - a.offset.left - a.padding.left,
|
|
385
387
|
a.gap.column,
|
|
386
388
|
0.5
|
|
387
|
-
)), d.startsWith("t") && (
|
|
389
|
+
)), d.startsWith("t") && (m.row.start = E(
|
|
388
390
|
a.rows,
|
|
389
391
|
1,
|
|
390
392
|
$.t - a.offset.top - a.padding.top,
|
|
391
393
|
a.gap.row,
|
|
392
394
|
0.5
|
|
393
|
-
)), d.endsWith("r") && (
|
|
394
|
-
E(a.columns,
|
|
395
|
-
|
|
396
|
-
)), d.startsWith("b") && (
|
|
397
|
-
E(a.rows,
|
|
398
|
-
|
|
399
|
-
)), c.style.gridArea = `${
|
|
395
|
+
)), d.endsWith("r") && (m.column.end = Math.max(
|
|
396
|
+
E(a.columns, m.column.start, $.w, a.gap.column, 0.5),
|
|
397
|
+
m.column.start + 1
|
|
398
|
+
)), d.startsWith("b") && (m.row.end = Math.max(
|
|
399
|
+
E(a.rows, m.row.start, $.h, a.gap.row, 0.5),
|
|
400
|
+
m.row.start + 1
|
|
401
|
+
)), c.style.gridArea = `${m.row.start} / ${m.column.start} / ${m.row.end} / ${m.column.end}`, p.style.width = `${$.w}px`, p.style.height = `${$.h}px`, p.style.left = `${$.l - a.offset.left}px`, p.style.top = `${$.t - a.offset.top}px`, n == null || n(g, h);
|
|
400
402
|
}
|
|
401
403
|
};
|
|
402
404
|
}
|
|
403
|
-
const
|
|
404
|
-
const r = t.Styles.getSectors().find((
|
|
405
|
+
const k = ["px", "%", "em", "rem", "vw", "vh"], Tt = (t, e) => {
|
|
406
|
+
const r = t.Styles.getSectors().find((n) => !!n.getProperty(e));
|
|
405
407
|
return {
|
|
406
408
|
sector: r,
|
|
407
409
|
property: r ? r.getProperty(e) : void 0
|
|
408
410
|
};
|
|
409
|
-
},
|
|
410
|
-
const
|
|
411
|
+
}, Rt = (t, e) => Tt(t, e), Gt = (t, { x: e, y: r, mergable: n } = {}) => {
|
|
412
|
+
const o = {
|
|
411
413
|
property: `${t}-x`,
|
|
412
414
|
type: "integer",
|
|
413
|
-
units:
|
|
415
|
+
units: k,
|
|
414
416
|
...e
|
|
415
417
|
}, i = {
|
|
416
418
|
property: `${t}-y`,
|
|
417
419
|
type: "integer",
|
|
418
|
-
units:
|
|
420
|
+
units: k,
|
|
419
421
|
...r
|
|
420
422
|
};
|
|
421
423
|
return {
|
|
422
424
|
property: t,
|
|
423
425
|
type: "composite",
|
|
424
|
-
properties: [
|
|
425
|
-
...
|
|
426
|
+
properties: [o, i],
|
|
427
|
+
...n && {
|
|
426
428
|
fromStyle(s, { name: l, separator: c, property: p }) {
|
|
427
|
-
const [a, d] = p.getProperties(), [u,
|
|
429
|
+
const [a, d] = p.getProperties(), [u, g] = (s[l] || "").split(c);
|
|
428
430
|
return {
|
|
429
431
|
[a.getId()]: s[a.getName()] || u || "",
|
|
430
|
-
[d.getId()]: s[d.getName()] ||
|
|
432
|
+
[d.getId()]: s[d.getName()] || g || u || ""
|
|
431
433
|
};
|
|
432
434
|
},
|
|
433
435
|
toStyle(s, { name: l, property: c }) {
|
|
@@ -439,31 +441,31 @@ const U = ["px", "%", "em", "rem", "vw", "vh"], Et = (t, e) => {
|
|
|
439
441
|
}
|
|
440
442
|
};
|
|
441
443
|
}, F = { display: ["grid"] };
|
|
442
|
-
function
|
|
443
|
-
const e = /^repeat\(\s*(\d+)\s*,\s*(.+)\s*\)$/i, r = /^minmax\(\s*(.+?)\s*,\s*(.+?)\s*\)$/i,
|
|
444
|
-
if (!
|
|
444
|
+
function Pt(t = "") {
|
|
445
|
+
const e = /^repeat\(\s*(\d+)\s*,\s*(.+)\s*\)$/i, r = /^minmax\(\s*(.+?)\s*,\s*(.+?)\s*\)$/i, n = t.match(e);
|
|
446
|
+
if (!n)
|
|
445
447
|
return null;
|
|
446
|
-
const
|
|
448
|
+
const o = parseInt(n[1], 10), i = n[2];
|
|
447
449
|
let s = i, l = i;
|
|
448
450
|
const c = i.match(r);
|
|
449
451
|
return c && (s = c[1], l = c[2]), {
|
|
450
|
-
total:
|
|
452
|
+
total: o,
|
|
451
453
|
min: s === l ? "" : s,
|
|
452
454
|
max: l
|
|
453
455
|
};
|
|
454
456
|
}
|
|
455
|
-
function
|
|
456
|
-
let e = "", r = "",
|
|
457
|
-
const i = (
|
|
458
|
-
return u === 4 ? (
|
|
457
|
+
function At(t = {}) {
|
|
458
|
+
let e = "", r = "", n = "", o = "";
|
|
459
|
+
const i = (m) => m.split("/").map((w) => w.trim()).filter(Boolean), s = t["grid-area"] || "", l = t["grid-column"] || "", c = t["grid-row"] || "", p = i(s), a = i(l), d = i(c), u = p.length, g = a.length, h = d.length;
|
|
460
|
+
return u === 4 ? (n = p[0], e = p[1], o = p[2], r = p[3]) : u === 3 ? (n = p[0], e = p[1], o = p[2]) : u === 2 ? (n = p[0], e = p[1]) : u === 1 && (n = p[0]), g === 2 ? (e = a[0], r = a[1]) : g === 1 && (e = a[0]), h === 2 ? (n = d[0], o = d[1]) : h === 1 && (n = d[0]), {
|
|
459
461
|
columnStart: e,
|
|
460
462
|
columnEnd: r,
|
|
461
|
-
rowStart:
|
|
462
|
-
rowEnd:
|
|
463
|
+
rowStart: n,
|
|
464
|
+
rowEnd: o
|
|
463
465
|
};
|
|
464
466
|
}
|
|
465
|
-
function
|
|
466
|
-
const { property: e, label: r } = t,
|
|
467
|
+
function U(t) {
|
|
468
|
+
const { property: e, label: r } = t, n = "1", o = "1fr";
|
|
467
469
|
return {
|
|
468
470
|
property: e,
|
|
469
471
|
label: r,
|
|
@@ -497,34 +499,34 @@ function j(t) {
|
|
|
497
499
|
}
|
|
498
500
|
],
|
|
499
501
|
fromStyle(i, s) {
|
|
500
|
-
const { name: l, property: c } = s, [p, a, d] = c.getProperties(), u = i[l],
|
|
502
|
+
const { name: l, property: c } = s, [p, a, d] = c.getProperties(), u = i[l], g = Pt(u), h = (g == null ? void 0 : g.max) ?? o;
|
|
501
503
|
return {
|
|
502
|
-
[p.id]: (
|
|
503
|
-
[a.id]: (
|
|
504
|
-
[d.id]: h ===
|
|
504
|
+
[p.id]: (g == null ? void 0 : g.total) ?? n,
|
|
505
|
+
[a.id]: (g == null ? void 0 : g.min) ?? "",
|
|
506
|
+
[d.id]: h === o ? "" : h
|
|
505
507
|
};
|
|
506
508
|
},
|
|
507
509
|
toStyle(i, { name: s, property: l }) {
|
|
508
|
-
const [c, p, a] = l.getProperties(), d = i[c.id], u = i[p.id],
|
|
510
|
+
const [c, p, a] = l.getProperties(), d = i[c.id], u = i[p.id], g = i[a.id] || o, h = u && g ? `minmax(${u}, ${g})` : g;
|
|
509
511
|
return {
|
|
510
|
-
[s]: `repeat(${d ||
|
|
512
|
+
[s]: `repeat(${d || n}, ${h})`
|
|
511
513
|
};
|
|
512
514
|
}
|
|
513
515
|
};
|
|
514
516
|
}
|
|
515
|
-
function
|
|
517
|
+
function Dt(t, e) {
|
|
516
518
|
if (!e.styleableGrid) return;
|
|
517
|
-
const { property: r, ...
|
|
519
|
+
const { property: r, ...n } = Rt(t, "display");
|
|
518
520
|
if (!r) return;
|
|
519
|
-
const
|
|
520
|
-
|
|
521
|
-
|
|
521
|
+
const o = r.getOption("grid"), i = n.sector;
|
|
522
|
+
o || r.addOption({ id: "grid", label: "Grid" }), i.addProperty(
|
|
523
|
+
U({
|
|
522
524
|
label: "Columns",
|
|
523
525
|
property: "grid-template-columns"
|
|
524
526
|
}),
|
|
525
527
|
{}
|
|
526
528
|
), i.addProperty(
|
|
527
|
-
|
|
529
|
+
U({
|
|
528
530
|
label: "Rows",
|
|
529
531
|
property: "grid-template-rows"
|
|
530
532
|
}),
|
|
@@ -533,7 +535,7 @@ function Pt(t, e) {
|
|
|
533
535
|
{
|
|
534
536
|
id: "grid-gap",
|
|
535
537
|
requires: F,
|
|
536
|
-
...
|
|
538
|
+
...Gt("gap", {
|
|
537
539
|
x: { id: "grid-row-gap", label: "Row", property: "row-gap", min: 0, default: "0" },
|
|
538
540
|
y: { id: "grid-column-gap", label: "Column", property: "column-gap", min: 0, default: "0" },
|
|
539
541
|
mergable: !0
|
|
@@ -575,7 +577,7 @@ function Pt(t, e) {
|
|
|
575
577
|
}
|
|
576
578
|
],
|
|
577
579
|
fromStyle(s) {
|
|
578
|
-
const l =
|
|
580
|
+
const l = At(s);
|
|
579
581
|
return {
|
|
580
582
|
"grid-column-start": s["grid-column-start"] || l.columnStart,
|
|
581
583
|
"grid-column-end": s["grid-column-end"] || l.columnEnd,
|
|
@@ -593,20 +595,20 @@ function Pt(t, e) {
|
|
|
593
595
|
{}
|
|
594
596
|
);
|
|
595
597
|
}
|
|
596
|
-
const
|
|
598
|
+
const Mt = function(t, e = {}) {
|
|
597
599
|
const r = {
|
|
598
600
|
itemResizable: !0,
|
|
599
601
|
...e
|
|
600
|
-
}, { Canvas:
|
|
602
|
+
}, { Canvas: n, Commands: o, Components: i } = t, { itemResizable: s } = r, l = n.events, c = o.events, p = i.events, a = `${c.runBeforeCommand}tlb-move`, d = `${c.runBeforeCommand}resize`;
|
|
601
603
|
let u;
|
|
602
|
-
|
|
603
|
-
const
|
|
604
|
-
_(t, y.target, r) && (t.runCommand(
|
|
604
|
+
Et(t);
|
|
605
|
+
const g = ({ options: y }) => {
|
|
606
|
+
_(t, y.target, r) && (t.runCommand(L, { ...y }), y.abort = !0);
|
|
605
607
|
}, h = (y) => {
|
|
606
608
|
const { options: f } = y;
|
|
607
|
-
_(t, f.component, r) && (f.options = Object.assign(f.options || {},
|
|
608
|
-
},
|
|
609
|
-
const y =
|
|
609
|
+
_(t, f.component, r) && (f.options = Object.assign(f.options || {}, xt(t, f)));
|
|
610
|
+
}, m = () => {
|
|
611
|
+
const y = n.getSpots({
|
|
610
612
|
type: A
|
|
611
613
|
}).pop();
|
|
612
614
|
if (!y) return;
|
|
@@ -640,29 +642,29 @@ const At = function(t, e = {}) {
|
|
|
640
642
|
});
|
|
641
643
|
}
|
|
642
644
|
const b = [
|
|
643
|
-
[a,
|
|
645
|
+
[a, g],
|
|
644
646
|
[d, h],
|
|
645
|
-
[l.spot,
|
|
647
|
+
[l.spot, m],
|
|
646
648
|
[l.spotRemove, w]
|
|
647
649
|
];
|
|
648
650
|
b.forEach(([y, f]) => {
|
|
649
651
|
t.on(y, f);
|
|
650
652
|
}), t.onReady(() => {
|
|
651
|
-
u =
|
|
653
|
+
u = n.getSpotsEl(), ht(), Dt(t, r);
|
|
652
654
|
});
|
|
653
655
|
const v = () => {
|
|
654
|
-
delete t.Commands.commands[
|
|
656
|
+
delete t.Commands.commands[L], b.forEach(([y, f]) => {
|
|
655
657
|
t.off(y, f);
|
|
656
658
|
});
|
|
657
659
|
};
|
|
658
|
-
|
|
660
|
+
gt({
|
|
659
661
|
editor: t,
|
|
660
662
|
licenseKey: r.licenseKey,
|
|
661
|
-
plan:
|
|
662
|
-
pluginName:
|
|
663
|
+
plan: ft,
|
|
664
|
+
pluginName: N,
|
|
663
665
|
cleanup: v
|
|
664
666
|
});
|
|
665
|
-
},
|
|
667
|
+
}, It = ut(Mt);
|
|
666
668
|
export {
|
|
667
|
-
|
|
669
|
+
It as default
|
|
668
670
|
};
|