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