@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.
Files changed (77) hide show
  1. package/dist/accordionComponent/index.cjs.js +8 -8
  2. package/dist/accordionComponent/index.es.js +71 -69
  3. package/dist/accordionComponent/index.umd.js +6 -6
  4. package/dist/animationComponent/index.cjs.js +3 -3
  5. package/dist/animationComponent/index.es.js +48 -46
  6. package/dist/animationComponent/index.umd.js +3 -3
  7. package/dist/canvasAbsoluteMode/index.cjs.js +1 -1
  8. package/dist/canvasAbsoluteMode/index.es.js +86 -84
  9. package/dist/canvasAbsoluteMode/index.umd.js +1 -1
  10. package/dist/canvasEmptyState/index.cjs.js +1 -1
  11. package/dist/canvasEmptyState/index.es.js +68 -66
  12. package/dist/canvasEmptyState/index.umd.js +1 -1
  13. package/dist/canvasFullSize/index.cjs.js +3 -3
  14. package/dist/canvasFullSize/index.es.js +52 -50
  15. package/dist/canvasFullSize/index.umd.js +7 -7
  16. package/dist/canvasGridMode/index.cjs.js +5 -5
  17. package/dist/canvasGridMode/index.es.js +191 -189
  18. package/dist/canvasGridMode/index.umd.js +2 -2
  19. package/dist/dataSourceEjs/index.cjs.js +3 -3
  20. package/dist/dataSourceEjs/index.es.js +32 -30
  21. package/dist/dataSourceEjs/index.umd.js +3 -3
  22. package/dist/dataSourceHandlebars/index.cjs.js +4 -4
  23. package/dist/dataSourceHandlebars/index.es.js +31 -29
  24. package/dist/dataSourceHandlebars/index.umd.js +2 -2
  25. package/dist/dialogComponent/index.cjs.js +3 -3
  26. package/dist/dialogComponent/index.es.js +32 -30
  27. package/dist/dialogComponent/index.umd.js +4 -4
  28. package/dist/flexComponent/index.cjs.js +6 -6
  29. package/dist/flexComponent/index.es.js +74 -72
  30. package/dist/flexComponent/index.umd.js +7 -7
  31. package/dist/fsLightboxComponent/index.cjs.js +2 -2
  32. package/dist/fsLightboxComponent/index.es.js +40 -38
  33. package/dist/fsLightboxComponent/index.umd.js +2 -2
  34. package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
  35. package/dist/googleFontsAssetProvider/index.es.js +70 -68
  36. package/dist/googleFontsAssetProvider/index.umd.js +1 -1
  37. package/dist/iconifyComponent/index.cjs.js +2 -2
  38. package/dist/iconifyComponent/index.es.js +56 -54
  39. package/dist/iconifyComponent/index.umd.js +2 -2
  40. package/dist/index.cjs.js +43 -43
  41. package/dist/index.es.js +1442 -1440
  42. package/dist/index.umd.js +43 -43
  43. package/dist/layoutSidebarButtons/index.cjs.js +1 -1
  44. package/dist/layoutSidebarButtons/index.es.js +29 -27
  45. package/dist/layoutSidebarButtons/index.umd.js +1 -1
  46. package/dist/lightGalleryComponent/index.cjs.js +1 -1
  47. package/dist/lightGalleryComponent/index.es.js +90 -88
  48. package/dist/lightGalleryComponent/index.umd.js +1 -1
  49. package/dist/linkImageComponent/index.cjs.js +2 -2
  50. package/dist/linkImageComponent/index.es.js +20 -18
  51. package/dist/linkImageComponent/index.umd.js +2 -2
  52. package/dist/listPagesComponent/index.cjs.js +4 -4
  53. package/dist/listPagesComponent/index.es.js +42 -40
  54. package/dist/listPagesComponent/index.umd.js +4 -4
  55. package/dist/presetPrintable/index.cjs.js +3 -3
  56. package/dist/presetPrintable/index.es.js +156 -154
  57. package/dist/presetPrintable/index.umd.js +3 -3
  58. package/dist/prosemirror/index.cjs.js +7 -7
  59. package/dist/prosemirror/index.es.js +165 -163
  60. package/dist/prosemirror/index.umd.js +7 -7
  61. package/dist/rendererReact/index.cjs.js +1 -1
  62. package/dist/rendererReact/index.es.js +101 -99
  63. package/dist/rendererReact/index.js +1 -1
  64. package/dist/rendererReact/index.umd.js +1 -1
  65. package/dist/rteTinyMce/index.cjs.js +2 -2
  66. package/dist/rteTinyMce/index.es.js +54 -52
  67. package/dist/rteTinyMce/index.umd.js +2 -2
  68. package/dist/swiperComponent/index.cjs.js +7 -7
  69. package/dist/swiperComponent/index.es.js +60 -58
  70. package/dist/swiperComponent/index.umd.js +9 -9
  71. package/dist/tableComponent/index.cjs.js +1 -1
  72. package/dist/tableComponent/index.es.js +80 -78
  73. package/dist/tableComponent/index.umd.js +1 -1
  74. package/dist/youtubeAssetProvider/index.cjs.js +1 -1
  75. package/dist/youtubeAssetProvider/index.es.js +66 -64
  76. package/dist/youtubeAssetProvider/index.umd.js +1 -1
  77. package/package.json +1 -1
@@ -1,6 +1,8 @@
1
- const q = "app.grapesjs.com", H = "app-stage.grapesjs.com", B = [
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
- ], 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)));
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 lt({
21
+ async function pt({
20
22
  path: t,
21
23
  baseApiUrl: e,
22
24
  method: r = "GET",
23
- headers: o = {},
24
- params: n,
25
+ headers: n = {},
26
+ params: o,
25
27
  body: i
26
28
  }) {
27
- const l = `${e || at({ isDev: !1, isStage: !1 })}${t}`, c = {
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
- ...o
33
+ ...n
32
34
  }
33
35
  };
34
36
  i && (c.body = JSON.stringify(i));
35
- const p = n ? new URLSearchParams(n).toString() : "", a = p ? `?${p}` : "", d = await fetch(`${l}${a}`, c);
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 O = {
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 ct(t) {
49
+ function dt(t) {
48
50
  const e = t;
49
- return e.init = (r) => (o) => t(o, r), e;
51
+ return e.init = (r) => (n) => t(n, r), e;
50
52
  }
51
- const pt = (t) => /* @__PURE__ */ ct(t);
52
- async function dt({
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: o,
57
- cleanup: n
58
+ licenseKey: n,
59
+ cleanup: o
58
60
  }) {
59
61
  let i = "", s = !1;
60
- const l = it(), c = (a) => {
61
- console.warn("Cleanup plugin:", r, "Reason:", a), n();
62
+ const l = ct(), c = (a) => {
63
+ console.warn("Cleanup plugin:", r, "Reason:", a), o();
62
64
  }, p = (a = {}) => {
63
- var g;
64
- const { error: d, sdkLicense: u } = a, m = (g = a.plan) == null ? void 0 : g.category;
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 (m) {
68
- const w = O[e], b = O[m];
69
- w > b && c({ pluginRequiredPlan: e, licensePlan: m });
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(ot, (a) => {
74
+ t.on(st, (a) => {
73
75
  i = a == null ? void 0 : a.baseApiUrl, s = !0;
74
- }), t.on(rt, (a) => {
76
+ }), t.on(at, (a) => {
75
77
  p(a);
76
78
  }), setTimeout(async () => {
77
79
  if (!s) {
78
80
  if (l) return;
79
- if (o) {
80
- const a = await ut({ licenseKey: o, pluginName: r, baseApiUrl: i });
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 ut(t) {
88
- const { licenseKey: e, pluginName: r, baseApiUrl: o } = t;
89
+ async function mt(t) {
90
+ const { licenseKey: e, pluginName: r, baseApiUrl: n } = t;
89
91
  try {
90
- return (await lt({
91
- baseApiUrl: o,
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 (n) {
100
- return console.error("Error during SDK license check:", n), !1;
101
+ } catch (o) {
102
+ return console.error("Error during SDK license check:", o), !1;
101
103
  }
102
104
  }
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
- 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
- n.setAttribute(t, "true"), n.innerHTML = `
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 ${o};
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 ${o};
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 ${o};
128
+ outline: 1px solid ${n};
127
129
  outline-offset: -1px;
128
130
  opacity: 0.35;
129
131
  }
130
- `, e.head.appendChild(n);
132
+ `, e.head.appendChild(o);
131
133
  };
132
134
  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
+ 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: o,
137
- container: n,
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: n.component
146
+ component: o.component
145
147
  })
146
148
  };
147
149
  }
148
150
  function Z(t) {
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), yt(n, l), ht(r, s, l), wt(o, s), St(n, l.el), s.el.style.opacity = "0";
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: o, target: n, cancelled: i } = t, { Canvas: s } = e, l = e.config.stylePrefix, { component: c } = n;
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
- 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);
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 yt(t, {
168
+ function wt(t, {
167
169
  rows: e,
168
170
  columns: r
169
171
  }) {
170
- const o = [];
171
- for (let n = 0; n < r.length; n++) {
172
- o[n] = [];
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} / ${n + 1}`, o[n][i] = s, t.appendChild(s);
177
+ s.className = K, s.style.gridArea = `${i + 1} / ${o + 1}`, n[o][i] = s, t.appendChild(s);
176
178
  }
177
179
  }
178
- return o;
180
+ return n;
179
181
  }
180
- function ht(t, e, r) {
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 wt(t, e) {
184
- const r = nt(e.el, e.computedStyles);
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 St(t, e) {
189
+ function Ct(t, e) {
188
190
  const r = window.getComputedStyle(e);
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;
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 bt(t, e) {
199
- const r = tt(t, e), o = r.getEl(), n = window.getComputedStyle(o);
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: o,
203
- offset: t.Canvas.offset(o),
204
+ el: n,
205
+ offset: t.Canvas.offset(n),
204
206
  margin: {
205
- top: parseFloat(n.marginTop),
206
- right: parseFloat(n.marginRight),
207
- bottom: parseFloat(n.marginBottom),
208
- left: parseFloat(n.marginLeft)
207
+ top: parseFloat(o.marginTop),
208
+ right: parseFloat(o.marginRight),
209
+ bottom: parseFloat(o.marginBottom),
210
+ left: parseFloat(o.marginLeft)
209
211
  },
210
- computedStyles: n
212
+ computedStyles: o
211
213
  };
212
214
  }
213
215
  function z(t, e) {
214
- const r = e.parent(), o = r.getEl(), n = window.getComputedStyle(o);
216
+ const r = e.parent(), n = r.getEl(), o = window.getComputedStyle(n);
215
217
  return {
216
218
  component: r,
217
- el: o,
218
- offset: t.Canvas.offset(o),
219
- computedStyles: n,
219
+ el: n,
220
+ offset: t.Canvas.offset(n),
221
+ computedStyles: o,
220
222
  padding: {
221
- top: parseFloat(n.paddingTop),
222
- right: parseFloat(n.paddingRight),
223
- bottom: parseFloat(n.paddingBottom),
224
- left: parseFloat(n.paddingLeft)
223
+ top: parseFloat(o.paddingTop),
224
+ right: parseFloat(o.paddingRight),
225
+ bottom: parseFloat(o.paddingBottom),
226
+ left: parseFloat(o.paddingLeft)
225
227
  },
226
- columns: n.gridTemplateColumns.split(" ").map((s) => parseFloat(s)),
227
- rows: n.gridTemplateRows.split(" ").map((s) => parseFloat(s)),
228
+ columns: o.gridTemplateColumns.split(" ").map((s) => parseFloat(s)),
229
+ rows: o.gridTemplateRows.split(" ").map((s) => parseFloat(s)),
228
230
  gap: {
229
- column: parseInt(n.columnGap),
230
- row: parseInt(n.rowGap)
231
+ column: parseInt(o.columnGap),
232
+ row: parseInt(o.rowGap)
231
233
  }
232
234
  };
233
235
  }
234
- function E(t, e, r, o, n = 1) {
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] + o) * n > r)
239
+ if (i + (t[s - 1] + n) * o > r)
238
240
  return s;
239
- i += o + t[s - 1];
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 Ct(t, e, r, o) {
253
- const n = (i) => t.em.logWarning(i);
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;
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 o = tt(t, e), n = o == null ? void 0 : o.parent(), i = n == null ? void 0 : n.getEl();
258
- if (!n || !i)
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: o, parent: n, isParentGrid: l }) : l;
263
+ return Y(s) ? s({ component: n, parent: o, isParentGrid: l }) : l;
262
264
  }
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
- isComputed: n,
267
- raw: o.gridArea
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 (!n)
271
+ if (!o)
270
272
  return {
271
273
  ...i,
272
274
  row: {
273
- start: parseInt(o.gridRowStart),
274
- end: parseInt(o.gridRowEnd)
275
+ start: parseInt(n.gridRowStart),
276
+ end: parseInt(n.gridRowEnd)
275
277
  },
276
278
  column: {
277
- start: parseInt(o.gridColumnStart),
278
- end: parseInt(o.gridColumnEnd)
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 = 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) => {
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], W = T + I;
285
- if (S >= T && S < W)
286
+ const I = C[P], O = T + I;
287
+ if (S >= T && S < O)
286
288
  return G;
287
- T = W + x, G++;
289
+ T = O + x, G++;
288
290
  }
289
291
  return -1;
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;
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 $t(t) {
304
- t.Commands.add(N, {
305
+ function Et(t) {
306
+ t.Commands.add(L, {
305
307
  stop() {
306
308
  },
307
- run(e, r, o = {}) {
308
- const n = Q({ editor: e, component: o.target, type: "draggable" });
309
- if (!n) {
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 } = n;
314
- let { container: d } = n, u;
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, g, { cancelled: w }) => {
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: 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
+ 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(o.event);
348
+ }).start(n.event);
347
349
  }
348
350
  });
349
351
  }
350
- function vt(t, e) {
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: o, onEnd: n } = e.options || {}, { spot: i, target: s, shadowContainerEl: l, shadowSnappedEl: c, shadowTargetEl: p } = r;
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: (m) => {
358
- d = m.target.dataset.gjsHandler || "", u = setTimeout(() => {
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: (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);
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: (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
+ 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") && (g.column.start = E(
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") && (g.row.start = E(
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") && (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);
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 U = ["px", "%", "em", "rem", "vw", "vh"], Et = (t, e) => {
404
- const r = t.Styles.getSectors().find((o) => !!o.getProperty(e));
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
- }, xt = (t, e) => Et(t, e), Tt = (t, { x: e, y: r, mergable: o } = {}) => {
410
- const n = {
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: U,
415
+ units: k,
414
416
  ...e
415
417
  }, i = {
416
418
  property: `${t}-y`,
417
419
  type: "integer",
418
- units: U,
420
+ units: k,
419
421
  ...r
420
422
  };
421
423
  return {
422
424
  property: t,
423
425
  type: "composite",
424
- properties: [n, i],
425
- ...o && {
426
+ properties: [o, i],
427
+ ...n && {
426
428
  fromStyle(s, { name: l, separator: c, property: p }) {
427
- const [a, d] = p.getProperties(), [u, m] = (s[l] || "").split(c);
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()] || m || u || ""
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 Rt(t = "") {
443
- const e = /^repeat\(\s*(\d+)\s*,\s*(.+)\s*\)$/i, r = /^minmax\(\s*(.+?)\s*,\s*(.+?)\s*\)$/i, o = t.match(e);
444
- if (!o)
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 n = parseInt(o[1], 10), i = o[2];
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: n,
452
+ total: o,
451
453
  min: s === l ? "" : s,
452
454
  max: l
453
455
  };
454
456
  }
455
- function Gt(t = {}) {
456
- let e = "", r = "", o = "", n = "";
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]), {
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: o,
462
- rowEnd: n
463
+ rowStart: n,
464
+ rowEnd: o
463
465
  };
464
466
  }
465
- function j(t) {
466
- const { property: e, label: r } = t, o = "1", n = "1fr";
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], m = Rt(u), h = (m == null ? void 0 : m.max) ?? n;
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]: (m == null ? void 0 : m.total) ?? o,
503
- [a.id]: (m == null ? void 0 : m.min) ?? "",
504
- [d.id]: h === n ? "" : 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], m = i[a.id] || n, h = u && m ? `minmax(${u}, ${m})` : m;
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 || o}, ${h})`
512
+ [s]: `repeat(${d || n}, ${h})`
511
513
  };
512
514
  }
513
515
  };
514
516
  }
515
- function Pt(t, e) {
517
+ function Dt(t, e) {
516
518
  if (!e.styleableGrid) return;
517
- const { property: r, ...o } = xt(t, "display");
519
+ const { property: r, ...n } = Rt(t, "display");
518
520
  if (!r) return;
519
- const n = r.getOption("grid"), i = o.sector;
520
- n || r.addOption({ id: "grid", label: "Grid" }), i.addProperty(
521
- j({
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
- j({
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
- ...Tt("gap", {
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 = Gt(s);
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 At = function(t, e = {}) {
598
+ const Mt = function(t, e = {}) {
597
599
  const r = {
598
600
  itemResizable: !0,
599
601
  ...e
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`;
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
- $t(t);
603
- const m = ({ options: y }) => {
604
- _(t, y.target, r) && (t.runCommand(N, { ...y }), y.abort = !0);
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 || {}, vt(t, f)));
608
- }, g = () => {
609
- const y = o.getSpots({
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, m],
645
+ [a, g],
644
646
  [d, h],
645
- [l.spot, g],
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 = o.getSpotsEl(), ft(), Pt(t, r);
653
+ u = n.getSpotsEl(), ht(), Dt(t, r);
652
654
  });
653
655
  const v = () => {
654
- delete t.Commands.commands[N], b.forEach(([y, f]) => {
656
+ delete t.Commands.commands[L], b.forEach(([y, f]) => {
655
657
  t.off(y, f);
656
658
  });
657
659
  };
658
- dt({
660
+ gt({
659
661
  editor: t,
660
662
  licenseKey: r.licenseKey,
661
- plan: mt,
662
- pluginName: L,
663
+ plan: ft,
664
+ pluginName: N,
663
665
  cleanup: v
664
666
  });
665
- }, Dt = pt(At);
667
+ }, It = ut(Mt);
666
668
  export {
667
- Dt as default
669
+ It as default
668
670
  };