@grapesjs/studio-sdk-plugins 1.0.33-rc.1 → 1.0.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accordionComponent/index.cjs.js +7 -7
- package/dist/accordionComponent/index.es.js +161 -156
- package/dist/accordionComponent/index.umd.js +9 -9
- package/dist/aiChat/chatManager.d.ts +15 -0
- package/dist/aiChat/clientTools.d.ts +3 -3
- package/dist/aiChat/clientToolsProcessors.d.ts +14 -1
- package/dist/aiChat/components/AiChatEmptyState.d.ts +4 -6
- package/dist/aiChat/components/AiChatError.d.ts +2 -1
- package/dist/aiChat/components/AiChatHeader.d.ts +2 -1
- package/dist/aiChat/components/AiChatInput/AssetsSection.d.ts +7 -0
- package/dist/aiChat/components/AiChatInput/AttachButton.d.ts +10 -0
- package/dist/aiChat/components/AiChatInput/ContextSection.d.ts +5 -0
- package/dist/aiChat/components/AiChatInput/DictateButton.d.ts +7 -0
- package/dist/aiChat/components/AiChatInput/TextAreaWithAutoResize.d.ts +6 -0
- package/dist/aiChat/components/AiChatInput/constants.d.ts +6 -0
- package/dist/aiChat/components/AiChatInput/hooks/useSpeechToText.d.ts +15 -0
- package/dist/aiChat/components/AiChatInput/index.d.ts +37 -0
- package/dist/aiChat/components/AiChatLoadingState.d.ts +2 -1
- package/dist/aiChat/components/AiChatMessage.d.ts +21 -9
- package/dist/aiChat/components/AiChatMessages.d.ts +5 -7
- package/dist/aiChat/components/AiChatMessagesStatus.d.ts +5 -0
- package/dist/aiChat/components/AiChatPanel.d.ts +2 -3
- package/dist/aiChat/components/AiChatProvider.d.ts +14 -0
- package/dist/aiChat/components/MemoizedMarkdown.d.ts +9 -0
- package/dist/aiChat/components/index.d.ts +24 -25
- package/dist/aiChat/components/utils.d.ts +12 -4
- package/dist/aiChat/index.cjs.d.ts +5 -0
- package/dist/aiChat/index.cjs.js +453 -0
- package/dist/aiChat/index.d.ts +4 -3
- package/dist/aiChat/index.es.d.ts +5 -0
- package/dist/aiChat/index.es.js +30930 -0
- package/dist/aiChat/index.js +453 -0
- package/dist/aiChat/index.umd.js +453 -0
- package/dist/aiChat/locales/en.d.ts +64 -0
- package/dist/aiChat/server/index.cjs.d.ts +4 -0
- package/dist/aiChat/server/index.cjs.js +309 -0
- package/dist/aiChat/server/index.d.ts +0 -50
- package/dist/aiChat/server/index.es.d.ts +4 -0
- package/dist/aiChat/server/index.es.js +876 -0
- package/dist/aiChat/server/index.js +309 -0
- package/dist/aiChat/server/index.umd.js +309 -0
- package/dist/aiChat/server/stream.d.ts +0 -6
- package/dist/aiChat/server/tools.d.ts +157 -51
- package/dist/aiChat/server/types.d.ts +108 -64
- package/dist/aiChat/types.d.ts +148 -108
- package/dist/aiChat/typesSchema.d.ts +238 -25
- package/dist/animationComponent/index.cjs.js +3 -3
- package/dist/animationComponent/index.es.js +174 -169
- package/dist/animationComponent/index.umd.js +3 -3
- package/dist/canvasAbsoluteMode/index.cjs.js +1 -1
- package/dist/canvasAbsoluteMode/index.es.js +161 -156
- package/dist/canvasAbsoluteMode/index.umd.js +1 -1
- package/dist/canvasEmptyState/index.cjs.js +1 -1
- package/dist/canvasEmptyState/index.es.js +113 -108
- package/dist/canvasEmptyState/index.umd.js +1 -1
- package/dist/canvasFullSize/index.cjs.js +9 -9
- package/dist/canvasFullSize/index.es.js +137 -132
- package/dist/canvasFullSize/index.umd.js +9 -9
- package/dist/canvasGridMode/index.cjs.js +4 -4
- package/dist/canvasGridMode/index.es.js +168 -163
- package/dist/canvasGridMode/index.umd.js +8 -8
- package/dist/canvasScreenshot/index.cjs.js +1 -1
- package/dist/canvasScreenshot/index.es.js +132 -127
- package/dist/canvasScreenshot/index.umd.js +1 -1
- package/dist/dataSourceEjs/index.cjs.js +5 -5
- package/dist/dataSourceEjs/index.es.js +151 -146
- package/dist/dataSourceEjs/index.umd.js +5 -5
- package/dist/dataSourceHandlebars/index.cjs.js +4 -4
- package/dist/dataSourceHandlebars/index.es.js +91 -86
- package/dist/dataSourceHandlebars/index.umd.js +5 -5
- package/dist/dialogComponent/index.cjs.js +16 -16
- package/dist/dialogComponent/index.es.js +117 -112
- package/dist/dialogComponent/index.umd.js +16 -16
- package/dist/flexComponent/index.cjs.js +11 -11
- package/dist/flexComponent/index.es.js +416 -411
- package/dist/flexComponent/index.umd.js +11 -11
- package/dist/fsLightboxComponent/index.cjs.js +3 -3
- package/dist/fsLightboxComponent/index.es.js +152 -147
- package/dist/fsLightboxComponent/index.umd.js +3 -3
- package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
- package/dist/googleFontsAssetProvider/index.es.js +127 -122
- package/dist/googleFontsAssetProvider/index.umd.js +1 -1
- package/dist/iconifyComponent/index.cjs.js +2 -2
- package/dist/iconifyComponent/index.es.js +170 -165
- package/dist/iconifyComponent/index.umd.js +2 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +27 -22
- package/dist/index.umd.js +1 -1
- package/dist/layoutSidebarButtons/index.cjs.js +1 -1
- package/dist/layoutSidebarButtons/index.es.js +156 -151
- package/dist/layoutSidebarButtons/index.umd.js +1 -1
- package/dist/lightGalleryComponent/index.cjs.js +1 -1
- package/dist/lightGalleryComponent/index.es.js +197 -192
- package/dist/lightGalleryComponent/index.umd.js +1 -1
- package/dist/linkImageComponent/index.cjs.js +2 -2
- package/dist/linkImageComponent/index.es.js +86 -81
- package/dist/linkImageComponent/index.umd.js +2 -2
- package/dist/listPagesComponent/index.cjs.js +5 -5
- package/dist/listPagesComponent/index.es.js +121 -116
- package/dist/listPagesComponent/index.umd.js +5 -5
- package/dist/presetPrintable/index.cjs.js +4 -4
- package/dist/presetPrintable/index.es.js +180 -175
- package/dist/presetPrintable/index.umd.js +4 -4
- package/dist/prosemirror/index.cjs.js +6 -6
- package/dist/prosemirror/index.es.js +128 -123
- package/dist/prosemirror/index.umd.js +8 -8
- package/dist/rendererReact/index.cjs.js +1 -1
- package/dist/rendererReact/index.es.js +127 -122
- package/dist/rendererReact/index.js +1 -1
- package/dist/rendererReact/index.umd.js +1 -1
- package/dist/rteTinyMce/index.cjs.js +2 -2
- package/dist/rteTinyMce/index.es.js +160 -155
- package/dist/rteTinyMce/index.umd.js +2 -2
- package/dist/shapeDividerComponent/index.cjs.js +25 -25
- package/dist/shapeDividerComponent/index.es.js +127 -122
- package/dist/shapeDividerComponent/index.umd.js +25 -25
- package/dist/swiperComponent/index.cjs.js +9 -9
- package/dist/swiperComponent/index.es.js +197 -192
- package/dist/swiperComponent/index.umd.js +9 -9
- package/dist/tableComponent/index.cjs.js +1 -1
- package/dist/tableComponent/index.es.js +227 -222
- package/dist/tableComponent/index.umd.js +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/utils.d.ts +12 -1
- package/dist/youtubeAssetProvider/index.cjs.js +1 -1
- package/dist/youtubeAssetProvider/index.es.js +124 -119
- package/dist/youtubeAssetProvider/index.umd.js +1 -1
- package/package.json +5 -2
- package/dist/aiChat/components/AiChatInput.d.ts +0 -17
- package/dist/aiChat/server/stream-utils.d.ts +0 -16
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const
|
|
2
|
-
q,
|
|
3
|
-
nt,
|
|
1
|
+
const H = "app.grapesjs.com", Y = "app-stage.grapesjs.com", nt = "app2.grapesjs.com", rt = "app-stage2.grapesjs.com", W = [
|
|
4
2
|
H,
|
|
3
|
+
nt,
|
|
4
|
+
Y,
|
|
5
5
|
rt,
|
|
6
6
|
"localhost",
|
|
7
7
|
"127.0.0.1",
|
|
@@ -11,11 +11,15 @@ const q = "app.grapesjs.com", H = "app-stage.grapesjs.com", nt = "app2.grapesjs.
|
|
|
11
11
|
// For stackblitz.com demos
|
|
12
12
|
"-sandpack.codesandbox.io"
|
|
13
13
|
// For Sandpack demos
|
|
14
|
-
], st = "license:check:start", at = "license:check:end", it = () => typeof window < "u", lt = ({
|
|
14
|
+
], st = "license:check:start", at = "license:check:end", it = () => typeof window < "u", lt = ({
|
|
15
|
+
isDev: t,
|
|
16
|
+
isStage: e,
|
|
17
|
+
isPlatform: r
|
|
18
|
+
}) => `${t ? "" : `https://${e ? Y : H}`}/${r ? "platform-api" : "api"}`, ct = () => {
|
|
15
19
|
const t = it() && window.location.hostname;
|
|
16
20
|
return !!t && (W.includes(t) || W.some((e) => t.endsWith(e)));
|
|
17
21
|
};
|
|
18
|
-
function
|
|
22
|
+
function K(t) {
|
|
19
23
|
return typeof t == "function";
|
|
20
24
|
}
|
|
21
25
|
async function pt({
|
|
@@ -26,67 +30,68 @@ async function pt({
|
|
|
26
30
|
params: o,
|
|
27
31
|
body: i
|
|
28
32
|
}) {
|
|
29
|
-
const l = `${e || lt({ isDev: !1, isStage: !1 })}${t}`,
|
|
33
|
+
const l = `${e || lt({ isDev: !1, isStage: !1 })}${t}`, d = {
|
|
30
34
|
method: r,
|
|
31
35
|
headers: {
|
|
32
36
|
"Content-Type": "application/json",
|
|
33
37
|
...n
|
|
34
38
|
}
|
|
35
39
|
};
|
|
36
|
-
i && (
|
|
37
|
-
const
|
|
38
|
-
if (!
|
|
39
|
-
throw new Error(`HTTP error! status: ${
|
|
40
|
-
return
|
|
40
|
+
i && (d.body = JSON.stringify(i));
|
|
41
|
+
const c = o ? new URLSearchParams(o).toString() : "", p = c ? `?${c}` : "", a = await fetch(`${l}${p}`, d);
|
|
42
|
+
if (!a.ok)
|
|
43
|
+
throw new Error(`HTTP error! status: ${a.status}`);
|
|
44
|
+
return a.json();
|
|
41
45
|
}
|
|
42
|
-
var
|
|
46
|
+
var G = /* @__PURE__ */ ((t) => (t.free = "free", t.startup = "startup", t.business = "business", t.enterprise = "enterprise", t))(G || {});
|
|
43
47
|
const j = {
|
|
44
|
-
[
|
|
45
|
-
[
|
|
46
|
-
[
|
|
47
|
-
[
|
|
48
|
+
[G.free]: 0,
|
|
49
|
+
[G.startup]: 10,
|
|
50
|
+
[G.business]: 20,
|
|
51
|
+
[G.enterprise]: 30
|
|
48
52
|
};
|
|
49
53
|
function dt(t) {
|
|
50
54
|
const e = t;
|
|
51
55
|
return e.init = (r) => (n) => t(n, r), e;
|
|
52
56
|
}
|
|
53
57
|
const ut = (t) => /* @__PURE__ */ dt(t);
|
|
54
|
-
async function
|
|
58
|
+
async function mt({
|
|
55
59
|
editor: t,
|
|
56
60
|
plan: e,
|
|
57
61
|
pluginName: r,
|
|
58
62
|
licenseKey: n,
|
|
59
|
-
|
|
63
|
+
onLicenseCheckResponse: o,
|
|
64
|
+
cleanup: i
|
|
60
65
|
}) {
|
|
61
|
-
let
|
|
62
|
-
const
|
|
63
|
-
console.warn("Cleanup plugin:", r, "Reason:", a),
|
|
66
|
+
let s = "", l = !1;
|
|
67
|
+
const d = ct(), c = (a) => {
|
|
68
|
+
console.warn("Cleanup plugin:", r, "Reason:", a), i();
|
|
64
69
|
}, p = (a = {}) => {
|
|
65
|
-
var
|
|
66
|
-
const { error:
|
|
67
|
-
if (!(
|
|
68
|
-
c(
|
|
69
|
-
else if (
|
|
70
|
-
const
|
|
71
|
-
|
|
70
|
+
var w;
|
|
71
|
+
const { error: u, sdkLicense: m } = a, h = (w = a.plan) == null ? void 0 : w.category;
|
|
72
|
+
if (!(m || a.license) || u)
|
|
73
|
+
c(u || "Invalid license");
|
|
74
|
+
else if (h) {
|
|
75
|
+
const b = j[e], v = j[h];
|
|
76
|
+
b > v && c({ pluginRequiredPlan: e, licensePlan: h });
|
|
72
77
|
}
|
|
73
78
|
};
|
|
74
79
|
t.on(st, (a) => {
|
|
75
|
-
|
|
80
|
+
s = a == null ? void 0 : a.baseApiUrl, l = !0;
|
|
76
81
|
}), t.on(at, (a) => {
|
|
77
|
-
p(a);
|
|
82
|
+
o == null || o(a), p(a);
|
|
78
83
|
}), setTimeout(async () => {
|
|
79
|
-
if (!
|
|
80
|
-
if (
|
|
84
|
+
if (!l) {
|
|
85
|
+
if (d) return;
|
|
81
86
|
if (n) {
|
|
82
|
-
const a = await
|
|
83
|
-
a && p(a);
|
|
87
|
+
const a = await gt({ licenseKey: n, pluginName: r, baseApiUrl: s });
|
|
88
|
+
o == null || o(a), a && p(a);
|
|
84
89
|
} else
|
|
85
90
|
c("The `licenseKey` option not provided");
|
|
86
91
|
}
|
|
87
92
|
}, 2e3);
|
|
88
93
|
}
|
|
89
|
-
async function
|
|
94
|
+
async function gt(t) {
|
|
90
95
|
const { licenseKey: e, pluginName: r, baseApiUrl: n } = t;
|
|
91
96
|
try {
|
|
92
97
|
return (await pt({
|
|
@@ -102,10 +107,10 @@ async function mt(t) {
|
|
|
102
107
|
return console.error("Error during SDK license check:", o), !1;
|
|
103
108
|
}
|
|
104
109
|
}
|
|
105
|
-
const N = "canvasGridMode", ft =
|
|
110
|
+
const N = "canvasGridMode", ft = G.startup, F = "component-grid-mode", A = "grid-mode", D = "gjs-drag-grid-spot", X = `${D}__grid-item`, k = `${D}__grid-target`, J = `${D}__snapped`, yt = `${D}__container`, ht = () => {
|
|
106
111
|
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
112
|
o.setAttribute(t, "true"), o.innerHTML = `
|
|
108
|
-
.${
|
|
113
|
+
.${X} {
|
|
109
114
|
outline: 2px solid ${n};
|
|
110
115
|
background: ${r};
|
|
111
116
|
outline-offset: -2px;
|
|
@@ -121,7 +126,7 @@ const N = "canvasGridMode", ft = R.startup, L = "component-grid-mode", A = "grid
|
|
|
121
126
|
outline-offset: -2px;
|
|
122
127
|
position: absolute;
|
|
123
128
|
}
|
|
124
|
-
.${
|
|
129
|
+
.${k} {
|
|
125
130
|
position: absolute;
|
|
126
131
|
z-index: -1;
|
|
127
132
|
background: ${r};
|
|
@@ -132,7 +137,7 @@ const N = "canvasGridMode", ft = R.startup, L = "component-grid-mode", A = "grid
|
|
|
132
137
|
`, e.head.appendChild(o);
|
|
133
138
|
};
|
|
134
139
|
function Q(t) {
|
|
135
|
-
const { editor: e, type: r } = t, n =
|
|
140
|
+
const { editor: e, type: r } = t, n = Ct(e, t.component), o = L(e, n.component);
|
|
136
141
|
if (!vt(e, n, o, r))
|
|
137
142
|
return {
|
|
138
143
|
target: n,
|
|
@@ -148,22 +153,22 @@ function Q(t) {
|
|
|
148
153
|
};
|
|
149
154
|
}
|
|
150
155
|
function Z(t) {
|
|
151
|
-
const { editor: e, shadowTargetEl: r, shadowSnappedEl: n, shadowContainerEl: o, spotEl: i, target: s, container: l } = t, { Canvas:
|
|
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),
|
|
153
|
-
const
|
|
154
|
-
e.em.stopDefault({ preserveSelected: !0 }),
|
|
156
|
+
const { editor: e, shadowTargetEl: r, shadowSnappedEl: n, shadowContainerEl: o, spotEl: i, target: s, container: l } = t, { Canvas: d } = e, c = e.config.stylePrefix;
|
|
157
|
+
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), $t(o, l.el), s.el.style.opacity = "0";
|
|
158
|
+
const p = d.getSpots().filter((a) => a.type !== A);
|
|
159
|
+
e.em.stopDefault({ preserveSelected: !0 }), d.removeSpots(p), d.startAutoscroll(), d.getBody().classList.add(`${c}is__grabbing`);
|
|
155
160
|
}
|
|
156
161
|
function V(t) {
|
|
157
|
-
const { editor: e, shadowSnappedEl: r, shadowContainerEl: n, target: o, cancelled: i } = t, { Canvas: s } = e, l = e.config.stylePrefix, { component:
|
|
162
|
+
const { editor: e, shadowSnappedEl: r, shadowContainerEl: n, target: o, cancelled: i } = t, { Canvas: s } = e, l = e.config.stylePrefix, { component: d } = o;
|
|
158
163
|
if (!i) {
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
"grid-area":
|
|
164
|
+
const c = window.getComputedStyle(r);
|
|
165
|
+
d.addStyle({
|
|
166
|
+
"grid-area": c.gridArea,
|
|
162
167
|
width: "",
|
|
163
168
|
height: ""
|
|
164
169
|
});
|
|
165
170
|
}
|
|
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(
|
|
171
|
+
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(d);
|
|
167
172
|
}
|
|
168
173
|
function wt(t, {
|
|
169
174
|
rows: e,
|
|
@@ -174,19 +179,19 @@ function wt(t, {
|
|
|
174
179
|
n[o] = [];
|
|
175
180
|
for (let i = 0; i < e.length; i++) {
|
|
176
181
|
const s = document.createElement("div");
|
|
177
|
-
s.className =
|
|
182
|
+
s.className = X, s.style.gridArea = `${i + 1} / ${o + 1}`, n[o][i] = s, t.appendChild(s);
|
|
178
183
|
}
|
|
179
184
|
}
|
|
180
185
|
return n;
|
|
181
186
|
}
|
|
182
187
|
function St(t, e, r) {
|
|
183
|
-
return t.className =
|
|
188
|
+
return t.className = k, 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;
|
|
184
189
|
}
|
|
185
190
|
function bt(t, e) {
|
|
186
191
|
const r = ot(e.el, e.computedStyles);
|
|
187
192
|
return t.className = J, t.style.gridArea = `${r.row.start} / ${r.column.start} / ${r.row.end} / ${r.column.end}`, t;
|
|
188
193
|
}
|
|
189
|
-
function
|
|
194
|
+
function $t(t, e) {
|
|
190
195
|
const r = window.getComputedStyle(e);
|
|
191
196
|
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;
|
|
192
197
|
}
|
|
@@ -197,7 +202,7 @@ function tt(t, e) {
|
|
|
197
202
|
} else return [...t.getSelectedAll()].pop();
|
|
198
203
|
return e;
|
|
199
204
|
}
|
|
200
|
-
function
|
|
205
|
+
function Ct(t, e) {
|
|
201
206
|
const r = tt(t, e), n = r.getEl(), o = window.getComputedStyle(n);
|
|
202
207
|
return {
|
|
203
208
|
component: r,
|
|
@@ -212,7 +217,7 @@ function $t(t, e) {
|
|
|
212
217
|
computedStyles: o
|
|
213
218
|
};
|
|
214
219
|
}
|
|
215
|
-
function
|
|
220
|
+
function L(t, e) {
|
|
216
221
|
const r = e.parent(), n = r.getEl(), o = window.getComputedStyle(n);
|
|
217
222
|
return {
|
|
218
223
|
component: r,
|
|
@@ -260,7 +265,7 @@ function _(t, e, r = {}) {
|
|
|
260
265
|
if (!o || !i)
|
|
261
266
|
return !1;
|
|
262
267
|
const { enableGrid: s } = r, l = window.getComputedStyle(i).display === "grid";
|
|
263
|
-
return
|
|
268
|
+
return K(s) ? s({ component: n, parent: o, isParentGrid: l }) : l;
|
|
264
269
|
}
|
|
265
270
|
const B = (t) => t.split(" ").map((e) => parseFloat(e));
|
|
266
271
|
function ot(t, e) {
|
|
@@ -280,21 +285,21 @@ function ot(t, e) {
|
|
|
280
285
|
end: parseInt(n.gridColumnEnd)
|
|
281
286
|
}
|
|
282
287
|
};
|
|
283
|
-
const s = t.parentElement, l = r.getComputedStyle(s),
|
|
284
|
-
let
|
|
285
|
-
for (let
|
|
286
|
-
const I =
|
|
288
|
+
const s = t.parentElement, l = r.getComputedStyle(s), d = parseFloat(l.columnGap) || 0, c = parseFloat(l.rowGap) || 0, p = B(l.gridTemplateColumns), a = B(l.gridTemplateRows), u = parseFloat(l.paddingLeft) || 0, m = parseFloat(l.paddingTop) || 0, h = s.getBoundingClientRect(), f = t.getBoundingClientRect(), w = (S, $, x, C, M) => {
|
|
289
|
+
let P = 1, T = C + M;
|
|
290
|
+
for (let R = 0; R < $.length; R++) {
|
|
291
|
+
const I = $[R], O = T + I;
|
|
287
292
|
if (S >= T && S < O)
|
|
288
|
-
return
|
|
289
|
-
T = O + x,
|
|
293
|
+
return P;
|
|
294
|
+
T = O + x, P++;
|
|
290
295
|
}
|
|
291
296
|
return -1;
|
|
292
|
-
}, b = w(
|
|
297
|
+
}, b = w(f.left, p, d, h.left, u), v = w(f.right - 1, p, d, h.left, u) + 1, y = w(f.top, a, c, h.top, m), g = w(f.bottom - 1, a, c, h.top, m) + 1;
|
|
293
298
|
return {
|
|
294
299
|
...i,
|
|
295
300
|
row: {
|
|
296
301
|
start: y,
|
|
297
|
-
end:
|
|
302
|
+
end: g
|
|
298
303
|
},
|
|
299
304
|
column: {
|
|
300
305
|
start: b,
|
|
@@ -303,7 +308,7 @@ function ot(t, e) {
|
|
|
303
308
|
};
|
|
304
309
|
}
|
|
305
310
|
function Et(t) {
|
|
306
|
-
t.Commands.add(
|
|
311
|
+
t.Commands.add(F, {
|
|
307
312
|
stop() {
|
|
308
313
|
},
|
|
309
314
|
run(e, r, n = {}) {
|
|
@@ -312,38 +317,38 @@ function Et(t) {
|
|
|
312
317
|
this.stopCommand();
|
|
313
318
|
return;
|
|
314
319
|
}
|
|
315
|
-
const { spot: i, target: s, shadowContainerEl: l, shadowSnappedEl:
|
|
316
|
-
let { container:
|
|
320
|
+
const { spot: i, target: s, shadowContainerEl: l, shadowSnappedEl: d, shadowTargetEl: c, startScroll: p } = o;
|
|
321
|
+
let { container: a } = o, u;
|
|
317
322
|
new e.Utils.Dragger({
|
|
318
323
|
doc: s.el.ownerDocument,
|
|
319
324
|
onStart: () => {
|
|
320
325
|
u = setTimeout(() => {
|
|
321
326
|
Z({
|
|
322
327
|
editor: e,
|
|
323
|
-
shadowTargetEl:
|
|
324
|
-
shadowSnappedEl:
|
|
328
|
+
shadowTargetEl: c,
|
|
329
|
+
shadowSnappedEl: d,
|
|
325
330
|
shadowContainerEl: l,
|
|
326
331
|
spotEl: i.attributes.spotEl,
|
|
327
332
|
target: s,
|
|
328
|
-
container:
|
|
329
|
-
}),
|
|
333
|
+
container: a
|
|
334
|
+
}), a = L(e, s.component);
|
|
330
335
|
}, 10);
|
|
331
336
|
},
|
|
332
|
-
onEnd: (h,
|
|
337
|
+
onEnd: (h, f, { cancelled: w }) => {
|
|
333
338
|
clearTimeout(u), V({
|
|
334
339
|
editor: e,
|
|
335
|
-
shadowSnappedEl:
|
|
340
|
+
shadowSnappedEl: d,
|
|
336
341
|
shadowContainerEl: l,
|
|
337
342
|
target: s,
|
|
338
343
|
cancelled: w
|
|
339
344
|
}), this.stopCommand(), e.em.set("_cmpDrag", 1);
|
|
340
345
|
},
|
|
341
|
-
setPosition: ({ x: h, y:
|
|
342
|
-
const { scroll: w } = et(e), { columns: b, rows: v, gap: y, offset:
|
|
343
|
-
E(b,
|
|
346
|
+
setPosition: ({ x: h, y: f }) => {
|
|
347
|
+
const { scroll: w } = et(e), { columns: b, rows: v, gap: y, offset: g, padding: S } = a, { offset: $, margin: x } = s, C = $.top - g.top - S.top - x.top + f - p.top + w.top, M = $.left - g.left - S.left - x.left + h - p.left + w.left, P = Math.min(E(b, 1, M, y.column, 0.5), b.length), T = Math.min(E(v, 1, C, y.row, 0.5), v.length), R = Math.min(
|
|
348
|
+
E(b, P, $.width, y.column) + 1,
|
|
344
349
|
b.length + 1
|
|
345
|
-
), I = Math.min(E(v, T,
|
|
346
|
-
|
|
350
|
+
), I = Math.min(E(v, T, $.height, y.row) + 1, v.length + 1);
|
|
351
|
+
d.style.gridArea = `${T} / ${P} / ${I} / ${R}`, c.style.top = `${C + S.top}px`, c.style.left = `${M + S.left}px`;
|
|
347
352
|
}
|
|
348
353
|
}).start(n.event);
|
|
349
354
|
}
|
|
@@ -353,71 +358,71 @@ function xt(t, e) {
|
|
|
353
358
|
const r = Q({ editor: t, component: e.component, type: "resizable" });
|
|
354
359
|
if (!r)
|
|
355
360
|
return;
|
|
356
|
-
const { onMove: n, onEnd: o } = e.options || {}, { spot: i, target: s, shadowContainerEl: l, shadowSnappedEl:
|
|
357
|
-
let { container:
|
|
361
|
+
const { onMove: n, onEnd: o } = e.options || {}, { spot: i, target: s, shadowContainerEl: l, shadowSnappedEl: d, shadowTargetEl: c } = r;
|
|
362
|
+
let { container: p } = r, a = "", u;
|
|
358
363
|
return {
|
|
359
|
-
onStart: (
|
|
360
|
-
|
|
364
|
+
onStart: (m) => {
|
|
365
|
+
a = m.target.dataset.gjsHandler || "", u = setTimeout(() => {
|
|
361
366
|
Z({
|
|
362
367
|
editor: t,
|
|
363
|
-
shadowTargetEl:
|
|
364
|
-
shadowSnappedEl:
|
|
368
|
+
shadowTargetEl: c,
|
|
369
|
+
shadowSnappedEl: d,
|
|
365
370
|
shadowContainerEl: l,
|
|
366
371
|
spotEl: i.attributes.spotEl,
|
|
367
372
|
target: s,
|
|
368
|
-
container:
|
|
369
|
-
}),
|
|
373
|
+
container: p
|
|
374
|
+
}), p = L(t, s.component);
|
|
370
375
|
}, 10), t.trigger("component:resize", { ...s, type: "start" });
|
|
371
376
|
},
|
|
372
|
-
onEnd: (
|
|
373
|
-
const { startDim:
|
|
374
|
-
clearTimeout(u), V({ editor: t, shadowSnappedEl:
|
|
377
|
+
onEnd: (m, h) => {
|
|
378
|
+
const { startDim: f, rectDim: w } = h.resizer, b = JSON.stringify(f) === JSON.stringify(w);
|
|
379
|
+
clearTimeout(u), V({ editor: t, shadowSnappedEl: d, shadowContainerEl: l, target: s, cancelled: b }), o == null || o(m, h);
|
|
375
380
|
},
|
|
376
|
-
onMove: (
|
|
377
|
-
const
|
|
381
|
+
onMove: (m, h) => {
|
|
382
|
+
const f = ot(d), w = s.margin.left, b = s.margin.top, v = s.margin.bottom, y = s.margin.right, { w: g, t: S, l: $, h: x } = h.resizer.rectDim, C = {
|
|
378
383
|
t: S - b,
|
|
379
|
-
l:
|
|
384
|
+
l: $ - w,
|
|
380
385
|
h: x + b + v,
|
|
381
|
-
w:
|
|
386
|
+
w: g + w + y
|
|
382
387
|
};
|
|
383
|
-
|
|
384
|
-
|
|
388
|
+
a.endsWith("l") && (f.column.start = E(
|
|
389
|
+
p.columns,
|
|
385
390
|
1,
|
|
386
|
-
|
|
387
|
-
|
|
391
|
+
C.l - p.offset.left - p.padding.left,
|
|
392
|
+
p.gap.column,
|
|
388
393
|
0.5
|
|
389
|
-
)),
|
|
390
|
-
|
|
394
|
+
)), a.startsWith("t") && (f.row.start = E(
|
|
395
|
+
p.rows,
|
|
391
396
|
1,
|
|
392
|
-
|
|
393
|
-
|
|
397
|
+
C.t - p.offset.top - p.padding.top,
|
|
398
|
+
p.gap.row,
|
|
394
399
|
0.5
|
|
395
|
-
)),
|
|
396
|
-
E(
|
|
397
|
-
|
|
398
|
-
)),
|
|
399
|
-
E(
|
|
400
|
-
|
|
401
|
-
)),
|
|
400
|
+
)), a.endsWith("r") && (f.column.end = Math.max(
|
|
401
|
+
E(p.columns, f.column.start, C.w, p.gap.column, 0.5),
|
|
402
|
+
f.column.start + 1
|
|
403
|
+
)), a.startsWith("b") && (f.row.end = Math.max(
|
|
404
|
+
E(p.rows, f.row.start, C.h, p.gap.row, 0.5),
|
|
405
|
+
f.row.start + 1
|
|
406
|
+
)), d.style.gridArea = `${f.row.start} / ${f.column.start} / ${f.row.end} / ${f.column.end}`, c.style.width = `${C.w}px`, c.style.height = `${C.h}px`, c.style.left = `${C.l - p.offset.left}px`, c.style.top = `${C.t - p.offset.top}px`, n == null || n(m, h);
|
|
402
407
|
}
|
|
403
408
|
};
|
|
404
409
|
}
|
|
405
|
-
const
|
|
410
|
+
const U = ["px", "%", "em", "rem", "vw", "vh"], Tt = (t, e) => {
|
|
406
411
|
const r = t.Styles.getSectors().find((n) => !!n.getProperty(e));
|
|
407
412
|
return {
|
|
408
413
|
sector: r,
|
|
409
414
|
property: r ? r.getProperty(e) : void 0
|
|
410
415
|
};
|
|
411
|
-
},
|
|
416
|
+
}, Gt = (t, e) => Tt(t, e), Pt = (t, { x: e, y: r, mergable: n } = {}) => {
|
|
412
417
|
const o = {
|
|
413
418
|
property: `${t}-x`,
|
|
414
419
|
type: "integer",
|
|
415
|
-
units:
|
|
420
|
+
units: U,
|
|
416
421
|
...e
|
|
417
422
|
}, i = {
|
|
418
423
|
property: `${t}-y`,
|
|
419
424
|
type: "integer",
|
|
420
|
-
units:
|
|
425
|
+
units: U,
|
|
421
426
|
...r
|
|
422
427
|
};
|
|
423
428
|
return {
|
|
@@ -425,30 +430,30 @@ const k = ["px", "%", "em", "rem", "vw", "vh"], Tt = (t, e) => {
|
|
|
425
430
|
type: "composite",
|
|
426
431
|
properties: [o, i],
|
|
427
432
|
...n && {
|
|
428
|
-
fromStyle(s, { name: l, separator:
|
|
429
|
-
const [
|
|
433
|
+
fromStyle(s, { name: l, separator: d, property: c }) {
|
|
434
|
+
const [p, a] = c.getProperties(), [u, m] = (s[l] || "").split(d);
|
|
430
435
|
return {
|
|
431
|
-
[
|
|
432
|
-
[
|
|
436
|
+
[p.getId()]: s[p.getName()] || u || "",
|
|
437
|
+
[a.getId()]: s[a.getName()] || m || u || ""
|
|
433
438
|
};
|
|
434
439
|
},
|
|
435
|
-
toStyle(s, { name: l, property:
|
|
436
|
-
const [
|
|
440
|
+
toStyle(s, { name: l, property: d }) {
|
|
441
|
+
const [c, p] = d.getProperties(), a = s[c.getId()], u = s[p.getId()];
|
|
437
442
|
return {
|
|
438
|
-
[l]:
|
|
443
|
+
[l]: a === u ? a : `${a} ${u}`
|
|
439
444
|
};
|
|
440
445
|
}
|
|
441
446
|
}
|
|
442
447
|
};
|
|
443
|
-
},
|
|
444
|
-
function
|
|
448
|
+
}, z = { display: ["grid"] };
|
|
449
|
+
function Rt(t = "") {
|
|
445
450
|
const e = /^repeat\(\s*(\d+)\s*,\s*(.+)\s*\)$/i, r = /^minmax\(\s*(.+?)\s*,\s*(.+?)\s*\)$/i, n = t.match(e);
|
|
446
451
|
if (!n)
|
|
447
452
|
return null;
|
|
448
453
|
const o = parseInt(n[1], 10), i = n[2];
|
|
449
454
|
let s = i, l = i;
|
|
450
|
-
const
|
|
451
|
-
return
|
|
455
|
+
const d = i.match(r);
|
|
456
|
+
return d && (s = d[1], l = d[2]), {
|
|
452
457
|
total: o,
|
|
453
458
|
min: s === l ? "" : s,
|
|
454
459
|
max: l
|
|
@@ -456,21 +461,21 @@ function Pt(t = "") {
|
|
|
456
461
|
}
|
|
457
462
|
function At(t = {}) {
|
|
458
463
|
let e = "", r = "", n = "", o = "";
|
|
459
|
-
const i = (
|
|
460
|
-
return u === 4 ? (n =
|
|
464
|
+
const i = (f) => f.split("/").map((w) => w.trim()).filter(Boolean), s = t["grid-area"] || "", l = t["grid-column"] || "", d = t["grid-row"] || "", c = i(s), p = i(l), a = i(d), u = c.length, m = p.length, h = a.length;
|
|
465
|
+
return u === 4 ? (n = c[0], e = c[1], o = c[2], r = c[3]) : u === 3 ? (n = c[0], e = c[1], o = c[2]) : u === 2 ? (n = c[0], e = c[1]) : u === 1 && (n = c[0]), m === 2 ? (e = p[0], r = p[1]) : m === 1 && (e = p[0]), h === 2 ? (n = a[0], o = a[1]) : h === 1 && (n = a[0]), {
|
|
461
466
|
columnStart: e,
|
|
462
467
|
columnEnd: r,
|
|
463
468
|
rowStart: n,
|
|
464
469
|
rowEnd: o
|
|
465
470
|
};
|
|
466
471
|
}
|
|
467
|
-
function
|
|
472
|
+
function q(t) {
|
|
468
473
|
const { property: e, label: r } = t, n = "1", o = "1fr";
|
|
469
474
|
return {
|
|
470
475
|
property: e,
|
|
471
476
|
label: r,
|
|
472
477
|
type: "composite",
|
|
473
|
-
requires:
|
|
478
|
+
requires: z,
|
|
474
479
|
generic: !0,
|
|
475
480
|
properties: [
|
|
476
481
|
{
|
|
@@ -499,34 +504,34 @@ function U(t) {
|
|
|
499
504
|
}
|
|
500
505
|
],
|
|
501
506
|
fromStyle(i, s) {
|
|
502
|
-
const { name: l, property:
|
|
507
|
+
const { name: l, property: d } = s, [c, p, a] = d.getProperties(), u = i[l], m = Rt(u), h = (m == null ? void 0 : m.max) ?? o;
|
|
503
508
|
return {
|
|
504
|
-
[
|
|
505
|
-
[
|
|
506
|
-
[
|
|
509
|
+
[c.id]: (m == null ? void 0 : m.total) ?? n,
|
|
510
|
+
[p.id]: (m == null ? void 0 : m.min) ?? "",
|
|
511
|
+
[a.id]: h === o ? "" : h
|
|
507
512
|
};
|
|
508
513
|
},
|
|
509
514
|
toStyle(i, { name: s, property: l }) {
|
|
510
|
-
const [c, p
|
|
515
|
+
const [d, c, p] = l.getProperties(), a = i[d.id], u = i[c.id], m = i[p.id] || o, h = u && m ? `minmax(${u}, ${m})` : m;
|
|
511
516
|
return {
|
|
512
|
-
[s]: `repeat(${
|
|
517
|
+
[s]: `repeat(${a || n}, ${h})`
|
|
513
518
|
};
|
|
514
519
|
}
|
|
515
520
|
};
|
|
516
521
|
}
|
|
517
522
|
function Dt(t, e) {
|
|
518
523
|
if (!e.styleableGrid) return;
|
|
519
|
-
const { property: r, ...n } =
|
|
524
|
+
const { property: r, ...n } = Gt(t, "display");
|
|
520
525
|
if (!r) return;
|
|
521
526
|
const o = r.getOption("grid"), i = n.sector;
|
|
522
527
|
o || r.addOption({ id: "grid", label: "Grid" }), i.addProperty(
|
|
523
|
-
|
|
528
|
+
q({
|
|
524
529
|
label: "Columns",
|
|
525
530
|
property: "grid-template-columns"
|
|
526
531
|
}),
|
|
527
532
|
{}
|
|
528
533
|
), i.addProperty(
|
|
529
|
-
|
|
534
|
+
q({
|
|
530
535
|
label: "Rows",
|
|
531
536
|
property: "grid-template-rows"
|
|
532
537
|
}),
|
|
@@ -534,8 +539,8 @@ function Dt(t, e) {
|
|
|
534
539
|
), i.addProperty(
|
|
535
540
|
{
|
|
536
541
|
id: "grid-gap",
|
|
537
|
-
requires:
|
|
538
|
-
...
|
|
542
|
+
requires: z,
|
|
543
|
+
...Pt("gap", {
|
|
539
544
|
x: { id: "grid-row-gap", label: "Row", property: "row-gap", min: 0, default: "0" },
|
|
540
545
|
y: { id: "grid-column-gap", label: "Column", property: "column-gap", min: 0, default: "0" },
|
|
541
546
|
mergable: !0
|
|
@@ -547,7 +552,7 @@ function Dt(t, e) {
|
|
|
547
552
|
type: "composite",
|
|
548
553
|
property: "grid-area",
|
|
549
554
|
label: "Grid area",
|
|
550
|
-
requiresParent:
|
|
555
|
+
requiresParent: z,
|
|
551
556
|
// detached: true,
|
|
552
557
|
generic: !0,
|
|
553
558
|
properties: [
|
|
@@ -586,9 +591,9 @@ function Dt(t, e) {
|
|
|
586
591
|
};
|
|
587
592
|
},
|
|
588
593
|
toStyle(s, { name: l }) {
|
|
589
|
-
const
|
|
594
|
+
const d = s["grid-row-start"] || "auto", c = s["grid-row-end"] || "auto", p = s["grid-column-start"] || "auto", a = s["grid-column-end"] || "auto";
|
|
590
595
|
return {
|
|
591
|
-
[l]: `${
|
|
596
|
+
[l]: `${d} / ${p} / ${c} / ${a}`
|
|
592
597
|
};
|
|
593
598
|
}
|
|
594
599
|
},
|
|
@@ -599,28 +604,28 @@ const Mt = function(t, e = {}) {
|
|
|
599
604
|
const r = {
|
|
600
605
|
itemResizable: !0,
|
|
601
606
|
...e
|
|
602
|
-
}, { Canvas: n, Commands: o, Components: i } = t, { itemResizable: s } = r, l = n.events,
|
|
607
|
+
}, { Canvas: n, Commands: o, Components: i } = t, { itemResizable: s } = r, l = n.events, d = o.events, c = i.events, p = `${d.runBeforeCommand}tlb-move`, a = `${d.runBeforeCommand}resize`;
|
|
603
608
|
let u;
|
|
604
609
|
Et(t);
|
|
605
|
-
const
|
|
606
|
-
_(t, y.target, r) && (t.runCommand(
|
|
610
|
+
const m = ({ options: y }) => {
|
|
611
|
+
_(t, y.target, r) && (t.runCommand(F, { ...y }), y.abort = !0);
|
|
607
612
|
}, h = (y) => {
|
|
608
|
-
const { options:
|
|
609
|
-
_(t,
|
|
610
|
-
},
|
|
613
|
+
const { options: g } = y;
|
|
614
|
+
_(t, g.component, r) && (g.options = Object.assign(g.options || {}, xt(t, g)));
|
|
615
|
+
}, f = () => {
|
|
611
616
|
const y = n.getSpots({
|
|
612
617
|
type: A
|
|
613
618
|
}).pop();
|
|
614
619
|
if (!y) return;
|
|
615
|
-
let
|
|
616
|
-
|
|
620
|
+
let g = y.attributes.spotEl;
|
|
621
|
+
g || (g = document.createElement("div"), g.className = D, y.set({ spotEl: g })), Object.entries(y.getStyle()).forEach(([S, $]) => g.style.setProperty(S, $)), u == null || u.appendChild(g);
|
|
617
622
|
}, w = ({ spot: y }) => {
|
|
618
|
-
const
|
|
619
|
-
y.type !== A || !
|
|
623
|
+
const g = y.attributes.spotEl;
|
|
624
|
+
y.type !== A || !g || u == null || u.removeChild(g);
|
|
620
625
|
};
|
|
621
626
|
if (s) {
|
|
622
|
-
const y = (
|
|
623
|
-
const S =
|
|
627
|
+
const y = (g) => {
|
|
628
|
+
const S = K(s) ? s({ component: g }) : s;
|
|
624
629
|
return typeof S == "boolean" ? S : {
|
|
625
630
|
tl: !1,
|
|
626
631
|
tc: !1,
|
|
@@ -633,31 +638,31 @@ const Mt = function(t, e = {}) {
|
|
|
633
638
|
...S
|
|
634
639
|
};
|
|
635
640
|
};
|
|
636
|
-
t.on(
|
|
637
|
-
const { component: S } =
|
|
641
|
+
t.on(c.resizeInit, (g) => {
|
|
642
|
+
const { component: S } = g;
|
|
638
643
|
if (_(t, S, r)) {
|
|
639
|
-
const
|
|
640
|
-
|
|
644
|
+
const $ = y(S);
|
|
645
|
+
g.resizable = $;
|
|
641
646
|
}
|
|
642
647
|
});
|
|
643
648
|
}
|
|
644
649
|
const b = [
|
|
645
|
-
[
|
|
646
|
-
[
|
|
647
|
-
[l.spot,
|
|
650
|
+
[p, m],
|
|
651
|
+
[a, h],
|
|
652
|
+
[l.spot, f],
|
|
648
653
|
[l.spotRemove, w]
|
|
649
654
|
];
|
|
650
|
-
b.forEach(([y,
|
|
651
|
-
t.on(y,
|
|
655
|
+
b.forEach(([y, g]) => {
|
|
656
|
+
t.on(y, g);
|
|
652
657
|
}), t.onReady(() => {
|
|
653
658
|
u = n.getSpotsEl(), ht(), Dt(t, r);
|
|
654
659
|
});
|
|
655
660
|
const v = () => {
|
|
656
|
-
delete t.Commands.commands[
|
|
657
|
-
t.off(y,
|
|
661
|
+
delete t.Commands.commands[F], b.forEach(([y, g]) => {
|
|
662
|
+
t.off(y, g);
|
|
658
663
|
});
|
|
659
664
|
};
|
|
660
|
-
|
|
665
|
+
mt({
|
|
661
666
|
editor: t,
|
|
662
667
|
licenseKey: r.licenseKey,
|
|
663
668
|
plan: ft,
|