@grapesjs/studio-sdk-plugins 1.0.30 → 1.0.31

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.
@@ -1,8 +1,8 @@
1
- const de = "app.grapesjs.com", ue = "app-stage.grapesjs.com", ye = "app2.grapesjs.com", be = "app-stage2.grapesjs.com", ie = [
1
+ const pe = "app.grapesjs.com", de = "app-stage.grapesjs.com", Se = "app2.grapesjs.com", ye = "app-stage2.grapesjs.com", se = [
2
+ pe,
3
+ Se,
2
4
  de,
3
5
  ye,
4
- ue,
5
- be,
6
6
  "localhost",
7
7
  "127.0.0.1",
8
8
  ".local-credentialless.webcontainer.io",
@@ -11,11 +11,11 @@ const de = "app.grapesjs.com", ue = "app-stage.grapesjs.com", ye = "app2.grapesj
11
11
  // For stackblitz.com demos
12
12
  "-sandpack.codesandbox.io"
13
13
  // For Sandpack demos
14
- ], Ce = "license:check:start", Pe = "license:check:end", ze = () => typeof window < "u", xe = ({ isDev: n, isStage: e }) => `${n ? "" : `https://${e ? ue : de}`}/api`, we = () => {
15
- const n = ze() && window.location.hostname;
16
- return !!n && (ie.includes(n) || ie.some((e) => n.endsWith(e)));
14
+ ], be = "license:check:start", Ce = "license:check:end", Pe = () => typeof window < "u", ze = ({ isDev: n, isStage: e }) => `${n ? "" : `https://${e ? de : pe}`}/api`, xe = () => {
15
+ const n = Pe() && window.location.hostname;
16
+ return !!n && (se.includes(n) || se.some((e) => n.endsWith(e)));
17
17
  };
18
- function ve(n) {
18
+ function we(n) {
19
19
  return typeof n == "function";
20
20
  }
21
21
  async function Ie({
@@ -26,7 +26,7 @@ async function Ie({
26
26
  params: i,
27
27
  body: a
28
28
  }) {
29
- const l = `${e || xe({ isDev: !1, isStage: !1 })}${n}`, c = {
29
+ const l = `${e || ze({ isDev: !1, isStage: !1 })}${n}`, c = {
30
30
  method: t,
31
31
  headers: {
32
32
  "Content-Type": "application/json",
@@ -39,18 +39,18 @@ async function Ie({
39
39
  throw new Error(`HTTP error! status: ${u.status}`);
40
40
  return u.json();
41
41
  }
42
- var $ = /* @__PURE__ */ ((n) => (n.free = "free", n.startup = "startup", n.business = "business", n.enterprise = "enterprise", n))($ || {}), he = /* @__PURE__ */ ((n) => (n.web = "web", n.email = "email", n.document = "document", n.react = "react", n))(he || {});
43
- const ae = {
42
+ var $ = /* @__PURE__ */ ((n) => (n.free = "free", n.startup = "startup", n.business = "business", n.enterprise = "enterprise", n))($ || {}), ue = /* @__PURE__ */ ((n) => (n.web = "web", n.email = "email", n.document = "document", n.react = "react", n))(ue || {});
43
+ const ie = {
44
44
  [$.free]: 0,
45
45
  [$.startup]: 10,
46
46
  [$.business]: 20,
47
47
  [$.enterprise]: 30
48
48
  };
49
- function Re(n) {
49
+ function ve(n) {
50
50
  const e = n;
51
51
  return e.init = (t) => (s) => n(s, t), e;
52
52
  }
53
- const Ee = (n) => /* @__PURE__ */ Re(n);
53
+ const Re = (n) => /* @__PURE__ */ ve(n);
54
54
  async function Ge({
55
55
  editor: n,
56
56
  plan: e,
@@ -59,34 +59,34 @@ async function Ge({
59
59
  cleanup: i
60
60
  }) {
61
61
  let a = "", o = !1;
62
- const l = we(), c = (p) => {
62
+ const l = xe(), c = (p) => {
63
63
  console.warn("Cleanup plugin:", t, "Reason:", p), i();
64
64
  }, g = (p = {}) => {
65
65
  var y;
66
- const { error: u, sdkLicense: f } = p, v = (y = p.plan) == null ? void 0 : y.category;
66
+ const { error: u, sdkLicense: f } = p, I = (y = p.plan) == null ? void 0 : y.category;
67
67
  if (!(f || p.license) || u)
68
68
  c(u || "Invalid license");
69
- else if (v) {
70
- const I = ae[e], R = ae[v];
71
- I > R && c({ pluginRequiredPlan: e, licensePlan: v });
69
+ else if (I) {
70
+ const v = ie[e], R = ie[I];
71
+ v > R && c({ pluginRequiredPlan: e, licensePlan: I });
72
72
  }
73
73
  };
74
- n.on(Ce, (p) => {
74
+ n.on(be, (p) => {
75
75
  a = p == null ? void 0 : p.baseApiUrl, o = !0;
76
- }), n.on(Pe, (p) => {
76
+ }), n.on(Ce, (p) => {
77
77
  g(p);
78
78
  }), setTimeout(async () => {
79
79
  if (!o) {
80
80
  if (l) return;
81
81
  if (s) {
82
- const p = await Te({ licenseKey: s, pluginName: t, baseApiUrl: a });
82
+ const p = await Ee({ licenseKey: s, pluginName: t, baseApiUrl: a });
83
83
  p && g(p);
84
84
  } else
85
85
  c("The `licenseKey` option not provided");
86
86
  }
87
87
  }, 2e3);
88
88
  }
89
- async function Te(n) {
89
+ async function Ee(n) {
90
90
  const { licenseKey: e, pluginName: t, baseApiUrl: s } = n;
91
91
  try {
92
92
  return (await Ie({
@@ -102,16 +102,16 @@ async function Te(n) {
102
102
  return console.error("Error during SDK license check:", i), !1;
103
103
  }
104
104
  }
105
- const ge = (n) => (e) => {
105
+ const he = (n) => (e) => {
106
106
  var t;
107
- return ((t = e.getAttribute) == null ? void 0 : t.call(e, ne)) === n;
108
- }, Le = (...n) => (e) => n.some((t) => e.is(t)), $e = (...n) => (e, t) => n.some((s) => t.is(s)), fe = "gjs-plg-", ne = "data-type-role", N = class N {
107
+ return ((t = e.getAttribute) == null ? void 0 : t.call(e, te)) === n;
108
+ }, Te = (...n) => (e) => n.some((t) => e.is(t)), Le = (...n) => (e, t) => n.some((s) => t.is(s)), ge = "gjs-plg-", te = "data-type-role", N = class N {
109
109
  constructor(e) {
110
110
  this.config = e;
111
111
  }
112
112
  getSize(e) {
113
113
  var t;
114
- return (t = this.config) != null && t.getSize ? this.config.getSize(e) : se(e.componentColumn, N.CSS_FLEX_BASIS);
114
+ return (t = this.config) != null && t.getSize ? this.config.getSize(e) : ne(e.componentColumn, N.CSS_FLEX_BASIS);
115
115
  }
116
116
  setSize(e) {
117
117
  var t;
@@ -124,7 +124,7 @@ const ge = (n) => (e) => {
124
124
  }
125
125
  };
126
126
  N.CSS_FLEX_BASIS = "flex-basis";
127
- let K = N;
127
+ let W = N;
128
128
  const j = class j {
129
129
  constructor(e) {
130
130
  this.config = e;
@@ -134,7 +134,7 @@ const j = class j {
134
134
  }
135
135
  getGap(e) {
136
136
  var t;
137
- return (t = this.config) != null && t.getGap ? this.config.getGap(e) : se(e.componentRow, j.CSS_GAP);
137
+ return (t = this.config) != null && t.getGap ? this.config.getGap(e) : ne(e.componentRow, j.CSS_GAP);
138
138
  }
139
139
  setGap(e) {
140
140
  var t;
@@ -147,8 +147,8 @@ const j = class j {
147
147
  }
148
148
  };
149
149
  j.CSS_GAP = "gap";
150
- let J = j;
151
- const Y = class Y {
150
+ let K = j;
151
+ const X = class X {
152
152
  constructor(e) {
153
153
  this.config = e;
154
154
  }
@@ -161,12 +161,12 @@ const Y = class Y {
161
161
  isLayoutVertical(e) {
162
162
  var s;
163
163
  if ((s = this.config) != null && s.isParentVertical) return this.config.isParentVertical(e);
164
- const t = se(e.componentRow, Y.CSS_FLEX_DIRECTION, !0);
164
+ const t = ne(e.componentRow, X.CSS_FLEX_DIRECTION, !0);
165
165
  return t === "column" || t === "column-reverse";
166
166
  }
167
167
  };
168
- Y.CSS_FLEX_DIRECTION = "flex-direction";
169
- let q = Y;
168
+ X.CSS_FLEX_DIRECTION = "flex-direction";
169
+ let J = X;
170
170
  const _ = class _ {
171
171
  constructor(e) {
172
172
  this.config = e;
@@ -195,8 +195,8 @@ const _ = class _ {
195
195
  }
196
196
  };
197
197
  _.MJML_COLUMN_TYPE = "mj-column";
198
- let Z = _;
199
- const U = class U {
198
+ let q = _;
199
+ const Y = class Y {
200
200
  constructor(e) {
201
201
  this.config = e;
202
202
  }
@@ -207,7 +207,7 @@ const U = class U {
207
207
  var s;
208
208
  if ((s = this.config) != null && s.getGap) return this.config.getGap(e);
209
209
  const { componentRow: t } = e;
210
- if (t.is(U.MJML_SECTION_TYPE)) {
210
+ if (t.is(Y.MJML_SECTION_TYPE)) {
211
211
  const i = t.getAttributes();
212
212
  if (i && i.padding)
213
213
  return parseInt(i.padding, 10) || 0;
@@ -219,9 +219,9 @@ const U = class U {
219
219
  (s = (t = this.config) == null ? void 0 : t.setGap) == null || s.call(t, e);
220
220
  }
221
221
  };
222
- U.MJML_SECTION_TYPE = "mj-section";
223
- let Q = U;
224
- class Ae {
222
+ Y.MJML_SECTION_TYPE = "mj-section";
223
+ let Z = Y;
224
+ class $e {
225
225
  constructor(e) {
226
226
  this.config = e;
227
227
  }
@@ -252,46 +252,43 @@ class A {
252
252
  getHandlers(e) {
253
253
  const t = `${e.projectType}-${e.disableGapHandler ? "nogap" : "gap"}`;
254
254
  return this.handlerCache.has(t) || (H(e) ? this.handlerCache.set(t, {
255
- sizeHandler: new Z(e),
256
- gapHandler: new Q(e),
257
- parentSizeHandler: new Ae(e)
255
+ sizeHandler: new q(e),
256
+ gapHandler: new Z(e),
257
+ parentSizeHandler: new $e(e)
258
258
  }) : this.handlerCache.set(t, {
259
- sizeHandler: new K(e),
260
- gapHandler: new J(e),
261
- parentSizeHandler: new q(e)
259
+ sizeHandler: new W(e),
260
+ gapHandler: new K(e),
261
+ parentSizeHandler: new J(e)
262
262
  })), this.handlerCache.get(t);
263
263
  }
264
264
  }
265
- function G(n) {
265
+ function E(n) {
266
266
  return A.getInstance().getHandlers(n);
267
267
  }
268
- const oe = (n) => {
268
+ const ae = (n) => {
269
269
  n.style.display = "none";
270
- }, re = (n) => {
270
+ }, oe = (n) => {
271
271
  n.style.display = "block";
272
- }, M = (n) => +parseFloat(`${n}`).toFixed(2), H = (n) => n.projectType === he.email, k = (n, e) => {
273
- const t = n.Canvas.getFramesEl();
274
- t && (t.style.pointerEvents = e ? "none" : "");
275
- }, He = (n) => n ? ["top", "bottom"] : ["left", "right"], Me = (n) => {
272
+ }, M = (n) => +parseFloat(`${n}`).toFixed(2), H = (n) => n.projectType === ue.email, Ae = (n) => n ? ["top", "bottom"] : ["left", "right"], He = (n) => {
276
273
  const e = n.parent();
277
274
  return e ? e.components().models.indexOf(n) === 0 : !1;
278
- }, Ve = (n) => {
275
+ }, Me = (n) => {
279
276
  const e = n.parent();
280
277
  if (!e) return !1;
281
278
  const t = e.components().models;
282
279
  return t.indexOf(n) === t.length - 1;
283
- }, Ne = (n) => {
280
+ }, Ve = (n) => {
284
281
  const e = n.parent();
285
282
  if (!e) return !1;
286
283
  const t = e.components().models;
287
284
  return t.length > 1 && n.index() === t.length - 1;
288
- }, je = (n, e, t, s) => {
285
+ }, Ne = (n, e, t, s) => {
289
286
  const a = n + (t ? e === "top" ? -1 : e === "bottom" ? 1 : 0 : e === "left" ? -1 : e === "right" ? 1 : 0);
290
287
  return a >= 0 && a < s ? a : -1;
291
- }, O = (n) => n === "top" || n === "bottom", _e = (n, e) => !!(Me(n) && (e === "left" || e === "top") || Ve(n) && (e === "right" || e === "bottom")), De = (n) => {
288
+ }, k = (n) => n === "top" || n === "bottom", je = (n, e) => !!(He(n) && (e === "left" || e === "top") || Me(n) && (e === "right" || e === "bottom")), _e = (n) => {
292
289
  const e = n.parent();
293
290
  return e ? e.components().models.length > 1 : !1;
294
- }, ce = (n, e) => n === "right" || n === "bottom" ? e > 0 : e < 0, se = (n, e, t = !1) => {
291
+ }, re = (n, e) => n === "right" || n === "bottom" ? e > 0 : e < 0, ne = (n, e, t = !1) => {
295
292
  const s = !t, i = n.getEl();
296
293
  if (!i)
297
294
  return s ? 0 : "";
@@ -301,29 +298,29 @@ const oe = (n) => {
301
298
  return typeof o == "string" ? (l = parseFloat(o.replace(/[^-\d.]/g, "")), isNaN(l) && (l = 0)) : l = Number(o) || 0, l;
302
299
  }
303
300
  return o;
304
- }, le = (n, e, t) => {
305
- const s = ee({ componentRow: n, isVertical: e }, t), i = n.components().models;
301
+ }, ce = (n, e, t) => {
302
+ const s = Q({ componentRow: n, isVertical: e }, t), i = n.components().models;
306
303
  return s * (i.length - 1);
307
- }, D = (n, e) => G(e).parentSizeHandler.isLayoutVertical({ componentRow: n }), F = (n, e) => G(e).sizeHandler.getSize(n), ee = (n, e) => {
304
+ }, D = (n, e) => E(e).parentSizeHandler.isLayoutVertical({ componentRow: n }), B = (n, e) => E(e).sizeHandler.getSize(n), Q = (n, e) => {
308
305
  if (e != null && e.disableGapHandler) return 0;
309
- const { gapHandler: t, parentSizeHandler: s } = G(e);
306
+ const { gapHandler: t, parentSizeHandler: s } = E(e);
310
307
  if (!t.isGapSupported()) return 0;
311
308
  const i = t.getGap(n), a = s.getParentSize(n);
312
309
  return i / 100 * a;
313
- }, te = (n, e) => G(e).parentSizeHandler.getParentSize(n), V = (n, e) => {
314
- G(e).sizeHandler.setSize(n);
315
- }, me = (n, e) => {
316
- const t = F(n, e);
310
+ }, ee = (n, e) => E(e).parentSizeHandler.getParentSize(n), V = (n, e) => {
311
+ E(e).sizeHandler.setSize(n);
312
+ }, fe = (n, e) => {
313
+ const t = B(n, e);
317
314
  V({ ...n, sizeValue: `${t}%`, partial: !1 }, e);
318
- }, Se = (n, e) => {
315
+ }, me = (n, e) => {
319
316
  if (e != null && e.disableGapHandler) return;
320
- const { gapHandler: t } = G(e);
317
+ const { gapHandler: t } = E(e);
321
318
  t.isGapSupported() && t.setGap(n);
322
- }, Fe = (n, e) => {
319
+ }, De = (n, e) => {
323
320
  const t = n.getStyle().gap;
324
321
  if (!t) return;
325
322
  const s = n.components().models, i = { componentRow: n, isVertical: D(n, e) };
326
- s.map((a) => me({ ...i, componentColumn: a }, e)), Se({ ...i, gapValue: String(t), partial: !1 }, e);
323
+ s.map((a) => fe({ ...i, componentColumn: a }, e)), me({ ...i, gapValue: String(t), partial: !1 }, e);
327
324
  };
328
325
  function Be(n, e) {
329
326
  const { Blocks: t } = n, { typeColumn: s, typeRow: i, blocks: a } = e;
@@ -356,16 +353,16 @@ function Be(n, e) {
356
353
  c("3 Columns 25/25/50", [25, 25, 50]),
357
354
  c("4 Columns", [25, 25, 25, 25]),
358
355
  c("5 Columns", [20, 20, 20, 20, 20])
359
- ], p = ve(a) ? a({ blocks: g }) : g;
356
+ ], p = we(a) ? a({ blocks: g }) : g;
360
357
  return p.forEach((u) => t.add(u.id, u)), () => {
361
358
  p.forEach((u) => t.remove(u.id));
362
359
  };
363
360
  }
364
- const ke = (n, e) => {
365
- const { Components: t } = n, { typeRow: s, typeColumn: i, extendTypeColumn: a } = e, o = `${fe}${i}`, c = !!i && !!t.getType(i) && !a;
361
+ const Fe = (n, e) => {
362
+ const { Components: t } = n, { typeRow: s, typeColumn: i, extendTypeColumn: a } = e, o = `${ge}${i}`, c = !!i && !!t.getType(i) && !a;
366
363
  if (!(!i || c || H(e)))
367
364
  return t.addType(i, {
368
- isComponent: ge(i),
365
+ isComponent: he(i),
369
366
  model: {
370
367
  defaults: {
371
368
  name: "Column",
@@ -373,8 +370,8 @@ const ke = (n, e) => {
373
370
  emptyState: !0,
374
371
  classes: o,
375
372
  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>',
376
- draggable: $e(s),
377
- attributes: { [ne]: i },
373
+ draggable: Le(s),
374
+ attributes: { [te]: i },
378
375
  styles: `
379
376
  .${o} {
380
377
  flex-grow: 1;
@@ -385,19 +382,19 @@ const ke = (n, e) => {
385
382
  }), () => {
386
383
  t.removeType(i);
387
384
  };
388
- }, Oe = (n, e) => {
389
- const { Components: t } = n, { typeRow: s, typeColumn: i, extendTypeRow: a } = e, o = `${fe}${s}`, c = !!s && !!t.getType(s) && !a;
385
+ }, ke = (n, e) => {
386
+ const { Components: t } = n, { typeRow: s, typeColumn: i, extendTypeRow: a } = e, o = `${ge}${s}`, c = !!s && !!t.getType(s) && !a;
390
387
  if (!(!s || c || H(e)))
391
388
  return t.addType(s, {
392
- isComponent: ge(s),
389
+ isComponent: he(s),
393
390
  model: {
394
391
  defaults: {
395
392
  name: "Row",
396
393
  classes: o,
397
394
  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>',
398
395
  emptyState: { styleIn: "width: 100%" },
399
- attributes: { [ne]: s },
400
- droppable: Le(i),
396
+ attributes: { [te]: s },
397
+ droppable: Te(i),
401
398
  traits: [
402
399
  // {
403
400
  // type: 'number',
@@ -455,8 +452,8 @@ const ke = (n, e) => {
455
452
  }), () => {
456
453
  t.removeType(s);
457
454
  };
458
- }, Xe = "flexComponent", Ye = $.startup;
459
- class Ue {
455
+ }, Oe = "flexComponent", Xe = $.startup;
456
+ class Ye {
460
457
  constructor() {
461
458
  this.resizableChildTypes = /* @__PURE__ */ new Set(), this.gapAdjustableParentTypes = /* @__PURE__ */ new Set(), this.typeRelationships = /* @__PURE__ */ new Map();
462
459
  }
@@ -480,7 +477,7 @@ class Ue {
480
477
  return this.typeRelationships.has(s) ? this.typeRelationships.get(s).has(i) : !1;
481
478
  }
482
479
  }
483
- class We {
480
+ class Ue {
484
481
  constructor(e, t, s) {
485
482
  this.editor = e, this.registry = t, this.opts = s, this.resizeState = /* @__PURE__ */ new WeakMap();
486
483
  }
@@ -496,12 +493,12 @@ class We {
496
493
  const o = e.parent();
497
494
  if (!o || !this.registry.isValidRelationship(o, e)) return;
498
495
  a.snapEnabled = o.get("snap") ?? i.snapEnabled, a.snapDivisions = o.get("snap-divisions") ?? i.snapDivisions ?? 12;
499
- const l = o.components().models, c = l.findIndex((f) => f.cid === e.cid), g = D(o, i), p = je(c, t, g, l.length);
496
+ const l = o.components().models, c = l.findIndex((f) => f.cid === e.cid), g = D(o, i), p = Ne(c, t, g, l.length);
500
497
  p !== -1 && (a.adjacentIdx = p);
501
498
  const u = { componentColumn: e, componentRow: o, isVertical: g };
502
- if (a.startPercent = F(u, i), typeof a.adjacentIdx < "u") {
499
+ if (a.startPercent = B(u, i), typeof a.adjacentIdx < "u") {
503
500
  const f = l[a.adjacentIdx];
504
- a.neighborStartPercent = F({ ...u, componentColumn: f }, i);
501
+ a.neighborStartPercent = B({ ...u, componentColumn: f }, i);
505
502
  }
506
503
  }
507
504
  updateResizeByDelta(e, t, s) {
@@ -510,25 +507,25 @@ class We {
510
507
  }
511
508
  finishResize(e) {
512
509
  const t = e.parent(), s = t == null ? void 0 : t.components().models, i = { componentRow: t, isVertical: !!t && D(t, this.opts) };
513
- s == null || s.forEach((a) => me({ ...i, componentColumn: a }, this.opts)), this.clearState(e);
510
+ s == null || s.forEach((a) => fe({ ...i, componentColumn: a }, this.opts)), this.clearState(e);
514
511
  }
515
512
  updateContinuesResize(e, t, s) {
516
513
  const i = this.getState(e), a = e.parent(), { opts: o } = this;
517
514
  if (!a) return;
518
- const l = o.minItemPercent ?? 0, c = O(t), g = te({ componentRow: a, isVertical: c }, o), p = le(a, c, this.opts), f = 100 - p / g * 100, v = s / (g - p) * f, { startPercent: P = 0, neighborStartPercent: y = 0 } = i, I = { componentRow: a, isVertical: c, componentColumn: e, partial: !0 }, R = ce(t, s) ? P + Math.abs(v) : P - Math.abs(v);
515
+ const l = o.minItemPercent ?? 0, c = k(t), g = ee({ componentRow: a, isVertical: c }, o), p = ce(a, c, this.opts), f = 100 - p / g * 100, I = s / (g - p) * f, { startPercent: P = 0, neighborStartPercent: y = 0 } = i, v = { componentRow: a, isVertical: c, componentColumn: e, partial: !0 }, R = re(t, s) ? P + Math.abs(I) : P - Math.abs(I);
519
516
  if (typeof i.adjacentIdx < "u") {
520
517
  const z = a.components().models[i.adjacentIdx], x = P + y, b = x - l, r = Math.min(b, Math.max(l, R)), d = x - r;
521
- V({ ...I, sizeValue: `${M(r)}%` }, o), V(
522
- { ...I, componentColumn: z, sizeValue: `${M(d)}%` },
518
+ V({ ...v, sizeValue: `${M(r)}%` }, o), V(
519
+ { ...v, componentColumn: z, sizeValue: `${M(d)}%` },
523
520
  o
524
521
  );
525
522
  } else {
526
523
  const z = Math.max(l, Math.min(f, R));
527
- V({ ...I, sizeValue: `${M(z)}%` }, o);
524
+ V({ ...v, sizeValue: `${M(z)}%` }, o);
528
525
  }
529
526
  }
530
527
  updateSnapResize(e, t, s) {
531
- const i = this.getState(e), a = e.parent(), o = O(t), l = te({ componentRow: a, isVertical: o }, this.opts), c = le(a, o, this.opts), g = l - c, p = s / g * 100, u = ce(t, s), { startPercent: f = 0, snapDivisions: v = 12 } = i, P = u ? f + Math.abs(p) : f - Math.abs(p), y = 100 / v, I = Math.floor(P / y) * y, R = Math.ceil(P / y) * y, z = Math.abs(R - P), x = Math.abs(P - I), b = y * 0.2, C = z < x ? R : I;
528
+ const i = this.getState(e), a = e.parent(), o = k(t), l = ee({ componentRow: a, isVertical: o }, this.opts), c = ce(a, o, this.opts), g = l - c, p = s / g * 100, u = re(t, s), { startPercent: f = 0, snapDivisions: I = 12 } = i, P = u ? f + Math.abs(p) : f - Math.abs(p), y = 100 / I, v = Math.floor(P / y) * y, R = Math.ceil(P / y) * y, z = Math.abs(R - P), x = Math.abs(P - v), b = y * 0.2, C = z < x ? R : v;
532
529
  if (C > 0 && C < 100 && (z < b || x < b) && i.lastSnappedPercent !== C) {
533
530
  i.lastSnappedPercent = C;
534
531
  let m = Math.abs(C - f) / 100 * g;
@@ -536,31 +533,31 @@ class We {
536
533
  } else z >= b && x >= b && (i.lastSnappedPercent = void 0);
537
534
  }
538
535
  }
539
- class Ke {
536
+ class We {
540
537
  constructor(e, t, s) {
541
538
  this.editor = e, this.registry = t, this.opts = s;
542
539
  }
543
540
  updateGapByDelta(e, t, s, i) {
544
541
  if (!this.registry.isGapAdjustableParent(e)) return;
545
- const { opts: a } = this, o = Math.max(0, s + t), l = te({ componentRow: e, isVertical: i }, a), c = o / l * 100, g = e.components().models, p = g.length - 1, u = { componentRow: e, isVertical: i }, f = g.reduce(
546
- (b, C) => b + F({ ...u, componentColumn: C }, a),
542
+ const { opts: a } = this, o = Math.max(0, s + t), l = ee({ componentRow: e, isVertical: i }, a), c = o / l * 100, g = e.components().models, p = g.length - 1, u = { componentRow: e, isVertical: i }, f = g.reduce(
543
+ (b, C) => b + B({ ...u, componentColumn: C }, a),
547
544
  0
548
545
  ), P = 100 - c * p, y = a.minItemPercent || 5;
549
546
  if (P < y * g.length)
550
547
  return;
551
548
  const R = 100 - p * c, z = f - R, x = { componentRow: e, isVertical: i, partial: !0 };
552
549
  g.map((b) => {
553
- const C = F({ ...u, componentColumn: b }, a), r = C - C / f * z;
550
+ const C = B({ ...u, componentColumn: b }, a), r = C - C / f * z;
554
551
  V({ ...x, componentColumn: b, sizeValue: `${M(r)}%` }, a);
555
- }), Se({ ...x, gapValue: `${M(c)}%` }, a);
552
+ }), me({ ...x, gapValue: `${M(c)}%` }, a);
556
553
  }
557
554
  finishGapAdjust(e) {
558
- Fe(e, this.opts);
555
+ De(e, this.opts);
559
556
  }
560
557
  }
561
- class Je {
558
+ class Ke {
562
559
  constructor(e, t, s) {
563
- this.editor = e, this.registry = t, this.opts = s, this.resizeHandler = new We(e, t, s), this.gapHandler = new Ke(e, t, s);
560
+ this.editor = e, this.registry = t, this.opts = s, this.resizeHandler = new Ue(e, t, s), this.gapHandler = new We(e, t, s);
564
561
  }
565
562
  startResize(e, t, s) {
566
563
  this.resizeHandler.startResize(e, t, s);
@@ -585,20 +582,20 @@ class Je {
585
582
  return this.registry.isGapAdjustableParent(e);
586
583
  }
587
584
  }
588
- const X = "gs-flex-spots", pe = `${X}__handle-size`, qe = `${X}__handle-gap`;
589
- function Ze(n, e) {
585
+ const O = "gs-flex-spots", le = `${O}__handle-size`, Je = `${O}__handle-gap`;
586
+ function qe(n, e) {
590
587
  const { Canvas: t } = n, s = "flex-resize-spot";
591
588
  let i, a, o, l, c = null, g = null;
592
- const p = new Ue(), u = new Je(n, p, e), f = () => {
589
+ const p = new Ye(), u = new Ke(n, p, e), f = () => {
593
590
  var r;
594
- i = document.createElement("div"), i.className = X, i.style.display = "none", a = document.createElement("div"), a.className = `${X}__handles`, a.style.position = "absolute", a.style.pointerEvents = "none", a.style.zIndex = "21", o = {
591
+ i = document.createElement("div"), i.className = O, i.style.display = "none", a = document.createElement("div"), a.className = `${O}__handles`, a.style.position = "absolute", a.style.pointerEvents = "none", a.style.zIndex = "21", o = {
595
592
  left: document.createElement("div"),
596
593
  right: document.createElement("div"),
597
594
  top: document.createElement("div"),
598
595
  bottom: document.createElement("div")
599
596
  }, Object.entries(o).forEach(([d, m]) => {
600
- const S = d, h = O(S);
601
- m.className = `${pe} ${pe}-${S} gjs-resizer-h gjs-cv-unscale`, m.style.cssText = `
597
+ const S = d, h = k(S);
598
+ m.className = `${le} ${le}-${S} gjs-resizer-h gjs-cv-unscale`, m.style.cssText = `
602
599
  pointer-events: all;
603
600
  position: absolute;
604
601
  z-index: 1;
@@ -608,8 +605,8 @@ function Ze(n, e) {
608
605
  ${S === "right" ? "right: 0px;" : ""}
609
606
  ${S === "top" ? "top: 0px;" : ""}
610
607
  ${S === "bottom" ? "bottom: 0px;" : ""}
611
- `, m.addEventListener("pointerdown", v(S)), a.appendChild(m);
612
- }), !e.disableGapHandler && !H(e) && (l = document.createElement("div"), l.className = qe, l.style.cssText = `
608
+ `, m.addEventListener("pointerdown", I(S)), a.appendChild(m);
609
+ }), !e.disableGapHandler && !H(e) && (l = document.createElement("div"), l.className = Je, l.style.cssText = `
613
610
  position: absolute;
614
611
  background-color: var(--gs-theme-cl-cmp-bg1, #3b97e3);
615
612
  border-width: 2px;
@@ -620,48 +617,48 @@ function Ze(n, e) {
620
617
  max-width: 3rem;
621
618
  max-height: 3rem;
622
619
  `, l.addEventListener("pointerdown", P()), a.appendChild(l)), i.append(a), (r = t.getSpotsEl()) == null || r.appendChild(i);
623
- }, v = (r) => (d) => {
620
+ }, I = (r) => (d) => {
624
621
  if (!c) return;
625
- k(n, !0), d.stopPropagation(), d.preventDefault(), u.startResize(c, r, d);
622
+ d.stopPropagation(), d.preventDefault(), u.startResize(c, r, d);
626
623
  const m = d.clientX, S = d.clientY;
627
624
  d.target.setPointerCapture(d.pointerId);
628
625
  const h = (T) => {
629
- const E = n.Canvas.getZoomMultiplier(), L = (T.clientX - m) * E, B = (T.clientY - S) * E, W = O(r) ? B : L;
630
- u.updateResizeByDelta(c, r, W);
626
+ const G = n.Canvas.getZoomMultiplier(), L = (T.clientX - m) * G, F = (T.clientY - S) * G, U = k(r) ? F : L;
627
+ u.updateResizeByDelta(c, r, U);
631
628
  }, w = () => {
632
- k(n, !1), u.finishResize(c), d.target.releasePointerCapture(d.pointerId), document.removeEventListener("pointermove", h), document.removeEventListener("pointerup", w);
629
+ u.finishResize(c), d.target.releasePointerCapture(d.pointerId), document.removeEventListener("pointermove", h), document.removeEventListener("pointerup", w);
633
630
  };
634
631
  document.addEventListener("pointermove", h), document.addEventListener("pointerup", w);
635
632
  }, P = () => (r) => {
636
633
  if (!g) return;
637
634
  const d = g;
638
- k(n, !0), r.stopPropagation(), r.preventDefault();
639
- const m = D(d, e), S = ee({ componentRow: d, isVertical: m }, e), h = r.clientX, w = r.clientY;
635
+ r.stopPropagation(), r.preventDefault();
636
+ const m = D(d, e), S = Q({ componentRow: d, isVertical: m }, e), h = r.clientX, w = r.clientY;
640
637
  r.target.setPointerCapture(r.pointerId);
641
638
  const T = (L) => {
642
- const B = n.Canvas.getZoomMultiplier(), W = m ? (L.clientY - w) * B : (L.clientX - h) * B;
643
- u.updateGapByDelta(d, W, S, m);
644
- }, E = () => {
645
- k(n, !1), u.finishGapAdjust(d), r.target.releasePointerCapture(r.pointerId), document.removeEventListener("pointermove", T), document.removeEventListener("pointerup", E);
639
+ const F = n.Canvas.getZoomMultiplier(), U = m ? (L.clientY - w) * F : (L.clientX - h) * F;
640
+ u.updateGapByDelta(d, U, S, m);
641
+ }, G = () => {
642
+ u.finishGapAdjust(d), r.target.releasePointerCapture(r.pointerId), document.removeEventListener("pointermove", T), document.removeEventListener("pointerup", G);
646
643
  };
647
- document.addEventListener("pointermove", T), document.addEventListener("pointerup", E);
644
+ document.addEventListener("pointermove", T), document.addEventListener("pointerup", G);
648
645
  }, y = (r) => {
649
646
  const d = r.component;
650
647
  if (!d || !i || (c = d, g = d.parent(), !g)) return;
651
648
  const m = g;
652
- re(i);
649
+ oe(i);
653
650
  const S = r.getStyle();
654
651
  a && Object.assign(a.style, S);
655
- const h = D(m, e), w = He(h);
656
- if (Object.values(o).forEach(oe), w.forEach((E) => {
657
- if (_e(d, E)) return;
658
- const L = o[E];
659
- re(L);
660
- }), G(e).gapHandler.isGapSupported() && l && De(d)) {
661
- const E = ee({ componentRow: m, isVertical: h }, e);
662
- I(E, h, Ne(d));
652
+ const h = D(m, e), w = Ae(h);
653
+ if (Object.values(o).forEach(ae), w.forEach((G) => {
654
+ if (je(d, G)) return;
655
+ const L = o[G];
656
+ oe(L);
657
+ }), E(e).gapHandler.isGapSupported() && l && _e(d)) {
658
+ const G = Q({ componentRow: m, isVertical: h }, e);
659
+ v(G, h, Ve(d));
663
660
  }
664
- }, I = (r, d, m = !1) => {
661
+ }, v = (r, d, m = !1) => {
665
662
  const S = e.gapHandleSize, h = l.style;
666
663
  if (d) {
667
664
  h.height = `${S}px`;
@@ -673,7 +670,7 @@ function Ze(n, e) {
673
670
  m ? (h.left = `-${(r + w) / 2}px`, h.right = "") : (h.right = `-${(r + w) / 2}px`, h.left = ""), h.height = "50%", h.top = "50%", h.transform = "translateY(-50%)", h.cursor = "col-resize";
674
671
  }
675
672
  }, R = () => {
676
- i && (oe(i), c = null, g = null);
673
+ i && (ae(i), c = null, g = null);
677
674
  }, z = () => {
678
675
  t.removeSpots({ type: s });
679
676
  const r = n.getSelected(), d = r == null ? void 0 : r.parent();
@@ -692,7 +689,7 @@ function Ze(n, e) {
692
689
  n.off(t.events.spot, x), n.off(C, z);
693
690
  };
694
691
  }
695
- const Qe = function(n, e = {}) {
692
+ const Ze = function(n, e = {}) {
696
693
  const t = {
697
694
  typeRow: "flex-row",
698
695
  typeColumn: "flex-column",
@@ -700,17 +697,17 @@ const Qe = function(n, e = {}) {
700
697
  snapDivisions: 12,
701
698
  minItemPercent: 5,
702
699
  ...e
703
- }, s = [Oe(n, t), ke(n, t)], i = Ze(n, t), a = Be(n, t);
700
+ }, s = [ke(n, t), Fe(n, t)], i = qe(n, t), a = Be(n, t);
704
701
  Ge({
705
702
  editor: n,
706
703
  licenseKey: t.licenseKey,
707
- plan: Ye,
708
- pluginName: Xe,
704
+ plan: Xe,
705
+ pluginName: Oe,
709
706
  cleanup: () => {
710
707
  s.forEach((o) => o == null ? void 0 : o()), i(), a == null || a();
711
708
  }
712
709
  });
713
- }, et = Ee(Qe);
710
+ }, Qe = Re(Ze);
714
711
  export {
715
- et as default
712
+ Qe as default
716
713
  };