@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,8 +1,8 @@
|
|
|
1
|
-
const
|
|
2
|
-
_,
|
|
1
|
+
const D = "app.grapesjs.com", C = "app-stage.grapesjs.com", S = "app2.grapesjs.com", x = "app-stage2.grapesjs.com", v = [
|
|
3
2
|
D,
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
S,
|
|
4
|
+
C,
|
|
5
|
+
x,
|
|
6
6
|
"localhost",
|
|
7
7
|
"127.0.0.1",
|
|
8
8
|
".local-credentialless.webcontainer.io",
|
|
@@ -11,83 +11,88 @@ const _ = "app.grapesjs.com", N = "app-stage.grapesjs.com", D = "app2.grapesjs.c
|
|
|
11
11
|
// For stackblitz.com demos
|
|
12
12
|
"-sandpack.codesandbox.io"
|
|
13
13
|
// For Sandpack demos
|
|
14
|
-
],
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
], O = "license:check:start", U = "license:check:end", k = () => typeof window < "u", W = ({
|
|
15
|
+
isDev: t,
|
|
16
|
+
isStage: s,
|
|
17
|
+
isPlatform: i
|
|
18
|
+
}) => `${t ? "" : `https://${s ? C : D}`}/${i ? "platform-api" : "api"}`, j = () => {
|
|
19
|
+
const t = k() && window.location.hostname;
|
|
20
|
+
return !!t && (v.includes(t) || v.some((s) => t.endsWith(s)));
|
|
17
21
|
};
|
|
18
|
-
async function
|
|
19
|
-
path:
|
|
22
|
+
async function B({
|
|
23
|
+
path: t,
|
|
20
24
|
baseApiUrl: s,
|
|
21
25
|
method: i = "GET",
|
|
22
|
-
headers:
|
|
26
|
+
headers: e = {},
|
|
23
27
|
params: o,
|
|
24
28
|
body: a
|
|
25
29
|
}) {
|
|
26
|
-
const c = `${s ||
|
|
30
|
+
const c = `${s || W({ isDev: !1, isStage: !1 })}${t}`, u = {
|
|
27
31
|
method: i,
|
|
28
32
|
headers: {
|
|
29
33
|
"Content-Type": "application/json",
|
|
30
|
-
...
|
|
34
|
+
...e
|
|
31
35
|
}
|
|
32
36
|
};
|
|
33
|
-
a && (
|
|
34
|
-
const
|
|
35
|
-
if (!
|
|
36
|
-
throw new Error(`HTTP error! status: ${
|
|
37
|
-
return
|
|
37
|
+
a && (u.body = JSON.stringify(a));
|
|
38
|
+
const r = o ? new URLSearchParams(o).toString() : "", p = r ? `?${r}` : "", n = await fetch(`${c}${p}`, u);
|
|
39
|
+
if (!n.ok)
|
|
40
|
+
throw new Error(`HTTP error! status: ${n.status}`);
|
|
41
|
+
return n.json();
|
|
38
42
|
}
|
|
39
|
-
var
|
|
40
|
-
const
|
|
41
|
-
[
|
|
42
|
-
[
|
|
43
|
-
[
|
|
44
|
-
[
|
|
43
|
+
var y = /* @__PURE__ */ ((t) => (t.free = "free", t.startup = "startup", t.business = "business", t.enterprise = "enterprise", t))(y || {});
|
|
44
|
+
const _ = {
|
|
45
|
+
[y.free]: 0,
|
|
46
|
+
[y.startup]: 10,
|
|
47
|
+
[y.business]: 20,
|
|
48
|
+
[y.enterprise]: 30
|
|
45
49
|
};
|
|
46
|
-
function
|
|
47
|
-
const s =
|
|
48
|
-
return s.init = (i) => (
|
|
50
|
+
function K(t) {
|
|
51
|
+
const s = t;
|
|
52
|
+
return s.init = (i) => (e) => t(e, i), s;
|
|
49
53
|
}
|
|
50
|
-
const
|
|
51
|
-
async function
|
|
52
|
-
editor:
|
|
54
|
+
const G = (t) => /* @__PURE__ */ K(t);
|
|
55
|
+
async function F({
|
|
56
|
+
editor: t,
|
|
53
57
|
plan: s,
|
|
54
58
|
pluginName: i,
|
|
55
|
-
licenseKey:
|
|
56
|
-
|
|
59
|
+
licenseKey: e,
|
|
60
|
+
onLicenseCheckResponse: o,
|
|
61
|
+
cleanup: a
|
|
57
62
|
}) {
|
|
58
|
-
let
|
|
59
|
-
const
|
|
60
|
-
console.warn("Cleanup plugin:", i, "Reason:", n),
|
|
61
|
-
},
|
|
63
|
+
let l = "", c = !1;
|
|
64
|
+
const u = j(), r = (n) => {
|
|
65
|
+
console.warn("Cleanup plugin:", i, "Reason:", n), a();
|
|
66
|
+
}, p = (n = {}) => {
|
|
62
67
|
var P;
|
|
63
|
-
const { error:
|
|
64
|
-
if (!(
|
|
65
|
-
r(
|
|
66
|
-
else if (
|
|
67
|
-
const
|
|
68
|
-
|
|
68
|
+
const { error: h, sdkLicense: A } = n, m = (P = n.plan) == null ? void 0 : P.category;
|
|
69
|
+
if (!(A || n.license) || h)
|
|
70
|
+
r(h || "Invalid license");
|
|
71
|
+
else if (m) {
|
|
72
|
+
const b = _[s], H = _[m];
|
|
73
|
+
b > H && r({ pluginRequiredPlan: s, licensePlan: m });
|
|
69
74
|
}
|
|
70
75
|
};
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}),
|
|
74
|
-
|
|
76
|
+
t.on(O, (n) => {
|
|
77
|
+
l = n == null ? void 0 : n.baseApiUrl, c = !0;
|
|
78
|
+
}), t.on(U, (n) => {
|
|
79
|
+
o == null || o(n), p(n);
|
|
75
80
|
}), setTimeout(async () => {
|
|
76
|
-
if (!
|
|
77
|
-
if (
|
|
78
|
-
if (
|
|
79
|
-
const n = await
|
|
80
|
-
n &&
|
|
81
|
+
if (!c) {
|
|
82
|
+
if (u) return;
|
|
83
|
+
if (e) {
|
|
84
|
+
const n = await R({ licenseKey: e, pluginName: i, baseApiUrl: l });
|
|
85
|
+
o == null || o(n), n && p(n);
|
|
81
86
|
} else
|
|
82
87
|
r("The `licenseKey` option not provided");
|
|
83
88
|
}
|
|
84
89
|
}, 2e3);
|
|
85
90
|
}
|
|
86
|
-
async function
|
|
87
|
-
const { licenseKey: s, pluginName: i, baseApiUrl:
|
|
91
|
+
async function R(t) {
|
|
92
|
+
const { licenseKey: s, pluginName: i, baseApiUrl: e } = t;
|
|
88
93
|
try {
|
|
89
|
-
return (await
|
|
90
|
-
baseApiUrl:
|
|
94
|
+
return (await B({
|
|
95
|
+
baseApiUrl: e,
|
|
91
96
|
path: `/sdk/${s || "na"}`,
|
|
92
97
|
method: "POST",
|
|
93
98
|
params: {
|
|
@@ -99,58 +104,58 @@ async function F(e) {
|
|
|
99
104
|
return console.error("Error during SDK license check:", o), !1;
|
|
100
105
|
}
|
|
101
106
|
}
|
|
102
|
-
const
|
|
103
|
-
function Y(
|
|
104
|
-
let
|
|
105
|
-
const
|
|
106
|
-
function
|
|
107
|
-
const
|
|
108
|
-
|
|
107
|
+
const N = "gjs-plg-", q = "listPagesComponent", X = y.startup;
|
|
108
|
+
function Y(t, s, i) {
|
|
109
|
+
let e, o, a, l, c;
|
|
110
|
+
const u = s;
|
|
111
|
+
function r() {
|
|
112
|
+
const n = Date.now() - l;
|
|
113
|
+
n < u && n >= 0 ? e = setTimeout(r, u - n) : (e = null, c = t.apply(a, o), a = o = null);
|
|
109
114
|
}
|
|
110
|
-
const
|
|
111
|
-
return a = this, o = arguments,
|
|
115
|
+
const p = function() {
|
|
116
|
+
return a = this, o = arguments, l = Date.now(), e || (e = setTimeout(r, u)), c;
|
|
112
117
|
};
|
|
113
|
-
return
|
|
114
|
-
|
|
115
|
-
},
|
|
116
|
-
|
|
117
|
-
},
|
|
118
|
+
return p.clear = function() {
|
|
119
|
+
e && (clearTimeout(e), e = null);
|
|
120
|
+
}, p.flush = function() {
|
|
121
|
+
e && (c = t.apply(a, o), a = o = null, clearTimeout(e), e = null);
|
|
122
|
+
}, p;
|
|
118
123
|
}
|
|
119
|
-
const
|
|
124
|
+
const $ = "page://", g = "list-pages", f = "list-pages-item", d = "list-pages-link", Z = (t) => t.components().reduce(
|
|
120
125
|
(s, i) => {
|
|
121
|
-
var
|
|
122
|
-
const
|
|
123
|
-
if (a &&
|
|
126
|
+
var l;
|
|
127
|
+
const e = i.findFirstType(d), o = (l = e == null ? void 0 : e.attributes.attributes) == null ? void 0 : l.href, a = o != null && o.startsWith($) ? o.replace($, "") : "";
|
|
128
|
+
if (a && e) {
|
|
124
129
|
const c = s[a];
|
|
125
|
-
c ? c.push(
|
|
130
|
+
c ? c.push(e) : s[a] = [e];
|
|
126
131
|
}
|
|
127
132
|
return s;
|
|
128
133
|
},
|
|
129
134
|
{}
|
|
130
|
-
),
|
|
135
|
+
), I = "data-type-role", J = "page_root", z = (t) => (s) => s.is(t), Q = (t) => (s, i) => i.is(t), w = (t) => (s) => {
|
|
131
136
|
var i;
|
|
132
|
-
return ((i = s.getAttribute) == null ? void 0 : i.call(s,
|
|
133
|
-
},
|
|
134
|
-
const { Blocks: i, Components:
|
|
135
|
-
|
|
136
|
-
block:
|
|
137
|
+
return ((i = s.getAttribute) == null ? void 0 : i.call(s, I)) === t;
|
|
138
|
+
}, tt = function(t, s = {}) {
|
|
139
|
+
const { Blocks: i, Components: e, Pages: o } = t, { licenseKey: a, block: l = {} } = s, c = "List Pages", u = "List Pages Item", r = "Link", p = `${N}${g}`, n = `${N}${d}`, h = '<svg viewBox="0 0 24 24"><path d="M11 15H17V17H11V15M9 7H7V9H9V7M11 13H17V11H11V13M11 9H17V7H11V9M9 11H7V13H9V11M21 5V19C21 20.1 20.1 21 19 21H5C3.9 21 3 20.1 3 19V5C3 3.9 3.9 3 5 3H19C20.1 3 21 3.9 21 5M19 5H5V19H19V5M9 15H7V17H9V15Z"/></svg>', A = '<svg viewBox="0 0 24 24"><path d="M7,5H21V7H7V5M7,13V11H21V13H7M4,4.5A1.5,1.5 0 0,1 5.5,6A1.5,1.5 0 0,1 4,7.5A1.5,1.5 0 0,1 2.5,6A1.5,1.5 0 0,1 4,4.5M4,10.5A1.5,1.5 0 0,1 5.5,12A1.5,1.5 0 0,1 4,13.5A1.5,1.5 0 0,1 2.5,12A1.5,1.5 0 0,1 4,10.5M7,19V17H21V19H7M4,16.5A1.5,1.5 0 0,1 5.5,18A1.5,1.5 0 0,1 4,19.5A1.5,1.5 0 0,1 2.5,18A1.5,1.5 0 0,1 4,16.5Z" /></svg>';
|
|
140
|
+
e.addType(g, {
|
|
141
|
+
block: l && {
|
|
137
142
|
label: c,
|
|
138
|
-
media:
|
|
143
|
+
media: h,
|
|
139
144
|
category: "Extra",
|
|
140
145
|
select: !0,
|
|
141
146
|
...s.block
|
|
142
147
|
},
|
|
143
|
-
isComponent: w(
|
|
148
|
+
isComponent: w(g),
|
|
144
149
|
model: {
|
|
145
150
|
defaults: {
|
|
146
151
|
tagName: "ul",
|
|
147
152
|
name: c,
|
|
148
153
|
[J]: "",
|
|
149
|
-
classes:
|
|
150
|
-
attributes: { [
|
|
151
|
-
droppable: z(
|
|
154
|
+
classes: p,
|
|
155
|
+
attributes: { [I]: g, role: "navigation" },
|
|
156
|
+
droppable: z(f),
|
|
152
157
|
styles: `
|
|
153
|
-
.${
|
|
158
|
+
.${p} {
|
|
154
159
|
list-style: none;
|
|
155
160
|
margin: 0;
|
|
156
161
|
padding: 0;
|
|
@@ -161,71 +166,71 @@ const k = "page://", m = "list-pages", d = "list-pages-item", g = "list-pages-li
|
|
|
161
166
|
this.syncPageItems = Y(this.syncPageItems.bind(this), 0), this.listenTo(this.em, o.events.all, this.syncPageItems), this.syncPageItems();
|
|
162
167
|
},
|
|
163
168
|
syncPageItems() {
|
|
164
|
-
if (
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}) :
|
|
169
|
+
if (t.Components.getSymbolInfo(this).isInstance) return;
|
|
170
|
+
const m = this.em.Pages.getAll(), E = this.components(), P = Z(this);
|
|
171
|
+
m.forEach((b, H) => {
|
|
172
|
+
const V = b.id, L = b.getName(), T = P[V];
|
|
173
|
+
T ? T == null || T.forEach((M) => {
|
|
174
|
+
M.getInnerHTML() !== L && M.components(L);
|
|
175
|
+
}) : E.add(
|
|
171
176
|
{
|
|
172
|
-
type:
|
|
177
|
+
type: f,
|
|
173
178
|
components: [
|
|
174
179
|
{
|
|
175
|
-
type:
|
|
176
|
-
attributes: { href: `page://${
|
|
177
|
-
components: { type: "textnode", content:
|
|
180
|
+
type: d,
|
|
181
|
+
attributes: { href: `page://${V}` },
|
|
182
|
+
components: { type: "textnode", content: L }
|
|
178
183
|
}
|
|
179
184
|
]
|
|
180
185
|
},
|
|
181
|
-
{ at:
|
|
186
|
+
{ at: H }
|
|
182
187
|
);
|
|
183
188
|
});
|
|
184
189
|
}
|
|
185
190
|
}
|
|
186
|
-
}),
|
|
187
|
-
isComponent: w(
|
|
191
|
+
}), e.addType(f, {
|
|
192
|
+
isComponent: w(f),
|
|
188
193
|
model: {
|
|
189
194
|
defaults: {
|
|
190
|
-
name:
|
|
195
|
+
name: u,
|
|
191
196
|
tagName: "li",
|
|
192
|
-
icon:
|
|
193
|
-
attributes: { [
|
|
194
|
-
components: { type:
|
|
195
|
-
draggable: Q(
|
|
197
|
+
icon: A,
|
|
198
|
+
attributes: { [I]: f },
|
|
199
|
+
components: { type: d },
|
|
200
|
+
draggable: Q(g)
|
|
196
201
|
}
|
|
197
202
|
}
|
|
198
|
-
}),
|
|
203
|
+
}), e.addType(d, {
|
|
199
204
|
extend: "link",
|
|
200
|
-
isComponent: w(
|
|
205
|
+
isComponent: w(d),
|
|
201
206
|
model: {
|
|
202
207
|
defaults: {
|
|
203
208
|
removable: !1,
|
|
204
209
|
copyable: !1,
|
|
205
210
|
delegate: {
|
|
206
|
-
move: (
|
|
211
|
+
move: (m) => m.closestType(f)
|
|
207
212
|
},
|
|
208
|
-
name:
|
|
209
|
-
classes:
|
|
210
|
-
attributes: { [
|
|
213
|
+
name: r,
|
|
214
|
+
classes: n,
|
|
215
|
+
attributes: { [I]: d },
|
|
211
216
|
components: { type: "textnode", content: "Item" },
|
|
212
217
|
styles: `
|
|
213
|
-
.${
|
|
218
|
+
.${n} {
|
|
214
219
|
text-decoration: none;
|
|
215
220
|
}
|
|
216
221
|
`
|
|
217
222
|
}
|
|
218
223
|
}
|
|
219
|
-
}),
|
|
220
|
-
editor:
|
|
224
|
+
}), F({
|
|
225
|
+
editor: t,
|
|
221
226
|
licenseKey: a,
|
|
222
227
|
plan: X,
|
|
223
228
|
pluginName: q,
|
|
224
229
|
cleanup: () => {
|
|
225
|
-
i.remove(
|
|
230
|
+
i.remove(g), e.removeType(g);
|
|
226
231
|
}
|
|
227
232
|
});
|
|
228
|
-
},
|
|
233
|
+
}, et = G(tt);
|
|
229
234
|
export {
|
|
230
|
-
|
|
235
|
+
et as default
|
|
231
236
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
.${
|
|
1
|
+
(function(f,y){typeof exports=="object"&&typeof module<"u"?module.exports=y():typeof define=="function"&&define.amd?define(y):(f=typeof globalThis<"u"?globalThis:f||self,f.StudioSdkPlugins_listPagesComponent=y())})(this,function(){"use strict";const f="app.grapesjs.com",y="app-stage.grapesjs.com",V=[f,"app2.grapesjs.com",y,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],O="license:check:start",x="license:check:end",C=()=>typeof window<"u",U=({isDev:t,isStage:s,isPlatform:i})=>`${t?"":`https://${s?y:f}`}/${i?"platform-api":"api"}`,k=()=>{const t=C()&&window.location.hostname;return!!t&&(V.includes(t)||V.some(s=>t.endsWith(s)))};async function W({path:t,baseApiUrl:s,method:i="GET",headers:e={},params:o,body:a}){const c=`${s||U({isDev:!1,isStage:!1})}${t}`,u={method:i,headers:{"Content-Type":"application/json",...e}};a&&(u.body=JSON.stringify(a));const r=o?new URLSearchParams(o).toString():"",p=r?`?${r}`:"",n=await fetch(`${c}${p}`,u);if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return n.json()}var h=(t=>(t.free="free",t.startup="startup",t.business="business",t.enterprise="enterprise",t))(h||{});const _={[h.free]:0,[h.startup]:10,[h.business]:20,[h.enterprise]:30};function j(t){const s=t;return s.init=i=>e=>t(e,i),s}const B=t=>j(t);async function G({editor:t,plan:s,pluginName:i,licenseKey:e,onLicenseCheckResponse:o,cleanup:a}){let l="",c=!1;const u=k(),r=n=>{console.warn("Cleanup plugin:",i,"Reason:",n),a()},p=(n={})=>{var A;const{error:T,sdkLicense:E}=n,g=(A=n.plan)==null?void 0:A.category;if(!(E||n.license)||T)r(T||"Invalid license");else if(g){const I=_[s],w=_[g];I>w&&r({pluginRequiredPlan:s,licensePlan:g})}};t.on(O,n=>{l=n==null?void 0:n.baseApiUrl,c=!0}),t.on(x,n=>{o==null||o(n),p(n)}),setTimeout(async()=>{if(!c){if(u)return;if(e){const n=await K({licenseKey:e,pluginName:i,baseApiUrl:l});o==null||o(n),n&&p(n)}else r("The `licenseKey` option not provided")}},2e3)}async function K(t){const{licenseKey:s,pluginName:i,baseApiUrl:e}=t;try{return(await W({baseApiUrl:e,path:`/sdk/${s||"na"}`,method:"POST",params:{d:window.location.hostname,pn:i}})).result||{}}catch(o){return console.error("Error during SDK license check:",o),!1}}const v="gjs-plg-",F="listPagesComponent",R=h.startup;function q(t,s,i){let e,o,a,l,c;const u=s;function r(){const n=Date.now()-l;n<u&&n>=0?e=setTimeout(r,u-n):(e=null,c=t.apply(a,o),a=o=null)}const p=function(){return a=this,o=arguments,l=Date.now(),e||(e=setTimeout(r,u)),c};return p.clear=function(){e&&(clearTimeout(e),e=null)},p.flush=function(){e&&(c=t.apply(a,o),a=o=null,clearTimeout(e),e=null)},p}const N="page://",m="list-pages",P="list-pages-item",d="list-pages-link",X=t=>t.components().reduce((s,i)=>{var l;const e=i.findFirstType(d),o=(l=e==null?void 0:e.attributes.attributes)==null?void 0:l.href,a=o!=null&&o.startsWith(N)?o.replace(N,""):"";if(a&&e){const c=s[a];c?c.push(e):s[a]=[e]}return s},{}),b="data-type-role",Y="page_root",Z=t=>s=>s.is(t),J=t=>(s,i)=>i.is(t),L=t=>s=>{var i;return((i=s.getAttribute)==null?void 0:i.call(s,b))===t};return B(function(t,s={}){const{Blocks:i,Components:e,Pages:o}=t,{licenseKey:a,block:l={}}=s,c="List Pages",u="List Pages Item",r="Link",p=`${v}${m}`,n=`${v}${d}`,T='<svg viewBox="0 0 24 24"><path d="M11 15H17V17H11V15M9 7H7V9H9V7M11 13H17V11H11V13M11 9H17V7H11V9M9 11H7V13H9V11M21 5V19C21 20.1 20.1 21 19 21H5C3.9 21 3 20.1 3 19V5C3 3.9 3.9 3 5 3H19C20.1 3 21 3.9 21 5M19 5H5V19H19V5M9 15H7V17H9V15Z"/></svg>',E='<svg viewBox="0 0 24 24"><path d="M7,5H21V7H7V5M7,13V11H21V13H7M4,4.5A1.5,1.5 0 0,1 5.5,6A1.5,1.5 0 0,1 4,7.5A1.5,1.5 0 0,1 2.5,6A1.5,1.5 0 0,1 4,4.5M4,10.5A1.5,1.5 0 0,1 5.5,12A1.5,1.5 0 0,1 4,13.5A1.5,1.5 0 0,1 2.5,12A1.5,1.5 0 0,1 4,10.5M7,19V17H21V19H7M4,16.5A1.5,1.5 0 0,1 5.5,18A1.5,1.5 0 0,1 4,19.5A1.5,1.5 0 0,1 2.5,18A1.5,1.5 0 0,1 4,16.5Z" /></svg>';e.addType(m,{block:l&&{label:c,media:T,category:"Extra",select:!0,...s.block},isComponent:L(m),model:{defaults:{tagName:"ul",name:c,[Y]:"",classes:p,attributes:{[b]:m,role:"navigation"},droppable:Z(P),styles:`
|
|
2
|
+
.${p} {
|
|
3
3
|
list-style: none;
|
|
4
4
|
margin: 0;
|
|
5
5
|
padding: 0;
|
|
6
6
|
}
|
|
7
|
-
`},init(){this.syncPageItems=
|
|
8
|
-
.${
|
|
7
|
+
`},init(){this.syncPageItems=q(this.syncPageItems.bind(this),0),this.listenTo(this.em,o.events.all,this.syncPageItems),this.syncPageItems()},syncPageItems(){if(t.Components.getSymbolInfo(this).isInstance)return;const g=this.em.Pages.getAll(),$=this.components(),A=X(this);g.forEach((I,w)=>{const D=I.id,M=I.getName(),H=A[D];H?H==null||H.forEach(S=>{S.getInnerHTML()!==M&&S.components(M)}):$.add({type:P,components:[{type:d,attributes:{href:`page://${D}`},components:{type:"textnode",content:M}}]},{at:w})})}}}),e.addType(P,{isComponent:L(P),model:{defaults:{name:u,tagName:"li",icon:E,attributes:{[b]:P},components:{type:d},draggable:J(m)}}}),e.addType(d,{extend:"link",isComponent:L(d),model:{defaults:{removable:!1,copyable:!1,delegate:{move:g=>g.closestType(P)},name:r,classes:n,attributes:{[b]:d},components:{type:"textnode",content:"Item"},styles:`
|
|
8
|
+
.${n} {
|
|
9
9
|
text-decoration: none;
|
|
10
10
|
}
|
|
11
|
-
`}}}),
|
|
11
|
+
`}}}),G({editor:t,licenseKey:a,plan:R,pluginName:F,cleanup:()=>{i.remove(m),e.removeType(m)}})})});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const W="app.grapesjs.com",z="app-stage.grapesjs.com",X="app2.grapesjs.com",Z="app-stage2.grapesjs.com",U=[W,X,z,Z,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],Q="license:check:start",ee="license:check:end",te=()=>typeof window<"u",O=(e,s={})=>{const t=ne(e)?{id:e,src:e}:e;return new Promise((o,n)=>{var p,u;const{loadedScripts:r}=s,{id:i,src:l}=t,d=document.querySelector(`script[src="${l}"]`);if(d){if((p=s.onScript)==null||p.call(s,d),r&&!r.get(l)){d.addEventListener("load",()=>o(i)),d.addEventListener("error",()=>n(i));return}return o(i)}const g=window.define;window.define=void 0;const f=()=>{r==null||r.set(l,!0),window.define=g},a=document.createElement("script");a.src=l,a.onload=()=>{o(i),f()},a.onerror=()=>{n(i),f()},document.head.appendChild(a),(u=s.onScript)==null||u.call(s,a)})},oe=({isDev:e,isStage:s,isPlatform:t})=>`${e?"":`https://${s?z:W}`}/${t?"platform-api":"api"}`,se=()=>{const e=te()&&window.location.hostname;return!!e&&(U.includes(e)||U.some(s=>e.endsWith(s)))},ne=e=>typeof e=="string";async function ae({path:e,baseApiUrl:s,method:t="GET",headers:o={},params:n,body:r}){const l=`${s||oe({isDev:!1,isStage:!1})}${e}`,d={method:t,headers:{"Content-Type":"application/json",...o}};r&&(d.body=JSON.stringify(r));const g=n?new URLSearchParams(n).toString():"",f=g?`?${g}`:"",a=await fetch(`${l}${f}`,d);if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);return a.json()}var $=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))($||{}),K=(e=>(e.toastAdd="studio:toastAdd",e.toastRemove="studio:toastRemove",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",e.dialogExportCode="studio:dialogExportCode",e.sidebarLeftSet="studio:sidebarLeft:set",e.sidebarLeftGet="studio:sidebarLeft:get",e.sidebarLeftToggle="studio:sidebarLeft:toggle",e.sidebarRightSet="studio:sidebarRight:set",e.sidebarRightGet="studio:sidebarRight:get",e.sidebarRightToggle="studio:sidebarRight:toggle",e.sidebarTopSet="studio:sidebarTop:set",e.sidebarTopGet="studio:sidebarTop:get",e.sidebarTopToggle="studio:sidebarTop:toggle",e.sidebarBottomSet="studio:sidebarBottom:set",e.sidebarBottomGet="studio:sidebarBottom:get",e.sidebarBottomToggle="studio:sidebarBottom:toggle",e.symbolAdd="studio:symbolAdd",e.symbolDetach="studio:symbolDetach",e.symbolOverride="studio:symbolOverride",e.symbolPropagateStyles="studio:propagateStyles",e.getPagesConfig="studio:getPagesConfig",e.setPagesConfig="studio:setPagesConfig",e.getPageSettings="studio:getPageSettings",e.setPageSettings="studio:setPageSettings",e.clearPage="studio:clearPage",e.projectFiles="studio:projectFiles",e.validateCode="studio:validateCode",e.canvasReload="studio:canvasReload",e.getBlocksPanel="studio:getBlocksPanel",e.setBlocksPanel="studio:setBlocksPanel",e.getStateContextMenu="studio:getStateContextMenu",e.setStateContextMenu="studio:setStateContextMenu",e.contextMenuComponent="studio:contextMenuComponent",e.layoutAdd="studio:layoutAdd",e.layoutRemove="studio:layoutRemove",e.layoutToggle="studio:layoutToggle",e.layoutUpdate="studio:layoutUpdate",e.layoutGet="studio:layoutGet",e.layoutConfigGet="studio:layoutConfigGet",e.layoutConfigSet="studio:layoutConfigSet",e.layoutComponentAdd="studio:layoutComponentAdd",e.layoutComponentGet="studio:layoutComponentGet",e.layoutComponentRemove="studio:layoutComponentRemove",e.layoutComponentRender="studio:layoutComponentRender",e.getStateTheme="studio:getStateTheme",e.setStateTheme="studio:setStateTheme",e.assetProviderGet="studio:assetProviderGet",e.assetProviderAdd="studio:assetProviderAdd",e.assetProviderRemove="studio:assetProviderRemove",e.fontGet="studio:fontGet",e.fontAdd="studio:fontAdd",e.fontRemove="studio:fontRemove",e.fontManagerOpen="studio:fontManagerOpen",e.menuFontLoad="studio:menuFontLoad",e.toggleStateDataSource="studio:toggleStateDataSource",e.getStateDataSource="studio:getStateDataSource",e.dataSourceSetGlobalData="studio:dataSourceSetGlobalData",e.dataSourceSetImporter="studio:dataSourceSetImporter",e.dataSourceSetExporter="studio:dataSourceSetExporter",e.setDragAbsolute="studio:setDragAbsolute",e))(K||{});const I={[$.free]:0,[$.startup]:10,[$.business]:20,[$.enterprise]:30};function re(e){const s=e;return s.init=t=>o=>e(o,t),s}const ie=e=>re(e);async function ce({editor:e,plan:s,pluginName:t,licenseKey:o,onLicenseCheckResponse:n,cleanup:r}){let i="",l=!1;const d=se(),g=a=>{console.warn("Cleanup plugin:",t,"Reason:",a),r()},f=(a={})=>{var c;const{error:p,sdkLicense:u}=a,m=(c=a.plan)==null?void 0:c.category;if(!(u||a.license)||p)g(p||"Invalid license");else if(m){const h=I[s],k=I[m];h>k&&g({pluginRequiredPlan:s,licensePlan:m})}};e.on(Q,a=>{i=a==null?void 0:a.baseApiUrl,l=!0}),e.on(ee,a=>{n==null||n(a),f(a)}),setTimeout(async()=>{if(!l){if(d)return;if(o){const a=await le({licenseKey:o,pluginName:t,baseApiUrl:i});n==null||n(a),a&&f(a)}else g("The `licenseKey` option not provided")}},2e3)}async function le(e){const{licenseKey:s,pluginName:t,baseApiUrl:o}=e;try{return(await ae({baseApiUrl:o,path:`/sdk/${s||"na"}`,method:"POST",params:{d:window.location.hostname,pn:t}})).result||{}}catch(n){return console.error("Error during SDK license check:",n),!1}}const de=e=>s=>{var t;return((t=s.getAttribute)==null?void 0:t.call(s,V))===e},pe=(...e)=>(s,t)=>e.some(o=>t.is(o)),C=(e,s,t)=>{const{doc:o=document}=t,n=t.target||o.head,r=n.querySelector(`style[${e}]`)||o.createElement("style");r.setAttribute(e,"true"),r.innerHTML=s,!n.contains(r)&&n.appendChild(r)},ge="gjs-plg-",q="data-gs-plg-",V="data-type-role";function N(e,s,t){let o,n,r,i,l;const d=s===void 0?100:s;function g(){const a=Date.now()-i;a<d&&a>=0?o=setTimeout(g,d-a):(o=null,l=e.apply(r,n),r=n=null)}const f=function(){return r=this,n=arguments,i=Date.now(),o||(o=setTimeout(g,d)),l};return f.clear=function(){o&&(clearTimeout(o),o=null)},f.flush=function(){o&&(l=e.apply(r,n),r=n=null,clearTimeout(o),o=null)},f}const A="page-break";var y=(e=>(e.A5="a5",e.A5Portrait="a5-portrait",e.A4="a4",e.A3="a3",e.B5="b5",e.B4="b4",e.letter="letter",e.legal="legal",e.ledger="ledger",e))(y||{});function _(e,s){const o={mm:3.7795275590551185,cm:37.79527559055118,in:96,pt:1.3333333333333333,pc:16};return o[s]?e*o[s]:null}const ue=(e,s)=>{const{name:t,id:o,width:n,height:r,unit:i}=e,{fixedHeight:l}=s,d=`${n}${i}`,g=`${r}${i}`;return{id:o||t.toLowerCase().replace(/\s/g,"-"),name:`${t} (${d} x ${g})`,sizeH:r,sizeW:n,sizeUnit:i,widthMedia:"",width:d,minHeight:l?"0":`${_(r,i)}px`,height:l?g:void 0}},G="page-breaks",D="gjs-page-breaks-spot",j=e=>e.type===G;function he(e){const{Devices:s}=e,{height:t,minHeight:o}=s.getSelected().attributes,r=parseFloat(`${t&&t!=="auto"?t:o}`),i=e.getWrapper(),l=i==null?void 0:i.getEl(),d=[];if(!i||!l)return d;const g=l.getBoundingClientRect().height,a=i.findType(A).map(u=>u.getEl()).filter(Boolean).map(u=>({top:u.offsetTop,height:u.offsetHeight}));let p=0;for(;p<g;){const u=a.find(m=>m.top>p&&m.top<p+r);u?(p=u.top+u.height,d.push(u.top)):(p+=r,p<g&&d.push(p))}return d}function fe(e,s){const{Canvas:t}=e,o=t.events,n=e.events;let r;const i=()=>{C(`${q}preset-printable-spots`,`.${D} {
|
|
2
2
|
position: absolute;
|
|
3
3
|
left: 0;
|
|
4
4
|
width: 100%;
|
|
5
5
|
border-top: 1px dashed var(--gs-theme-cl-cmp-bg2, var(--gjs-color-blue));
|
|
6
6
|
color: var(--gs-theme-cl-prm-txt, var(--gjs-font-color));
|
|
7
7
|
}
|
|
8
|
-
.${
|
|
8
|
+
.${D}::after {
|
|
9
9
|
background-color: var(--gs-theme-cl-cmp-bg1, var(--gjs-color-highlight));
|
|
10
10
|
content: attr(data-page-number);
|
|
11
11
|
display: block;
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
right: 0;
|
|
17
17
|
transform: translate(100%, -50%);
|
|
18
18
|
}
|
|
19
|
-
`,{target:window.document.head})},
|
|
19
|
+
`,{target:window.document.head})},l=()=>{if(s.enablePageBreaksSpot===!1)return;const c={id:G,type:G,component:e.getWrapper()};return t.getSpots(c).pop()||t.addSpot(c)},d=({spot:c})=>{const{spotEl:h}=c.attributes;!j(c)||!h||!r||r.removeChild(h)},g=({spot:c})=>{if(!j(c)||!r)return;let{spotEl:h}=c.attributes;h||(h=document.createElement("div"),h.className=`${D}__items`,c.set({spotEl:h})),r.appendChild(h)},f=({spot:c})=>{const{spotEl:h,pageBreaks:k=[]}=c.attributes;!j(c)||!h||!r||(Object.entries(c.getStyle()).forEach(([x,L])=>h.style.setProperty(x,L)),h.innerHTML="",k.forEach((x,L)=>{const E=document.createElement("div");E.setAttribute("data-page-number",`${L+2}`),E.className=D,E.style.top=`${x}px`,h.appendChild(E)}))},a=N(()=>{if(e.em.destroyed)return;const c=l();c&&c.set({pageBreaks:he(e),up:(c.attributes.up||0)+1})},150),p=N(a,200),u=()=>{r=t.getSpotsEl(),l()},m=()=>{const c=l();c&&c.set({up:(c.attributes.up||0)+1})},w=[["component:input",a],["frame:scroll",m],[n.update,a],[o.spotAdd,g],[o.spotUpdate,f],[o.spotRemove,d],[o.frameLoadBody,u]];return w.forEach(([c,h])=>e.on(c,h)),e.onReady(()=>{i(),new ResizeObserver(m).observe(t.getElement().parentElement)}),()=>{w.forEach(([c,h])=>e.off(c,h)),a.clear(),p.clear()}}var H=(e=>(e.print="presetPrintable:print",e))(H||{});const F=e=>new Promise(s=>{const t=document.createElement("iframe");t.style.cssText="position: absolute; width: 0; height: 0; border: 0; opacity: 0; pointer-events: none;",t.srcdoc=e.content,t.onload=()=>s(t),document.body.appendChild(t)});function ve(e,s){const{Commands:t,Pages:o}=e;return t.add(H.print,async(n,r,i={})=>{const l={page:i.allPages?void 0:o.getSelected(),styles:"inline",optionsHtml:{exporter:null}},g=(await t.run(K.projectFiles,l)).filter(p=>p.filename.endsWith(".html")),f=g.map(p=>p.content).join('<div style="break-before: page;"></div>'),a=[];if(i.separatePrints)for(const p of g)a.push(await F(p));else a.push(await F({content:f,filename:"",mimeType:""}));for(const p of a){const u=p.contentWindow;u.focus(),u.print()}setTimeout(()=>a.forEach(p=>p.remove()),1e3)}),t.add("presetPrintable:exp",async n=>{await O("https://cdn.jsdelivr.net/npm/html2canvas@1.4.1/dist/html2canvas.min.js"),await O("https://cdn.jsdelivr.net/npm/jspdf@3.0.0/dist/jspdf.umd.min.js");const{Devices:r,Canvas:i}=n,{sizeW:l,sizeH:d,sizeUnit:g}=r.getSelected().attributes,f=i.getFrameEl().contentDocument,a="px",p=[_(l,g),_(d,g)],u=new window.jspdf.jsPDF({unit:a,format:p}),m=f.body;u.html(m,{callback:w=>w.save()})}),()=>{delete e.Commands.commands[H.print]}}function be(e,s){const{blockPageBreak:t={}}=s,{Components:o,Blocks:n}=e,r="Page Break",i=`${ge}${A}`;return o.addType(A,{block:t&&{label:r,media:'<svg viewBox="0 0 24 24"><path d="M18 20H6v-2H4v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2h-2v2M14 2H6a2 2 0 0 0-2 2v8h2V4h8v4h4v4h2V8l-6-6m-3 14H8v-2h3v2m5 0h-3v-2h3v2M3 14h3v2H3v-2m18 2h-3v-2h3v2Z"/></svg>',category:"Extra",select:!0,...t},isComponent:de(A),model:{defaults:{name:r,classes:i,attributes:{[V]:A},emptyState:!0,stylable:!1,droppable:!1,draggable:pe("wrapper"),styles:`.${i} { break-before: page; }`,traits:[]}}}),()=>{o.removeType(A),n.remove(A)}}const me="presetPrintable",ye=$.free,we=function(e,s={}){var M;const t={selectedDevice:y.A4,...s},{Canvas:o,Devices:n,Blocks:r}=e,i=o.events,l=e.events,d=t.selectedDevice||n.getConfig().default,g=[{id:y.A5,name:"A5",width:148,height:210,unit:"mm"},{id:y.A5Portrait,name:"A5 Portrait",width:210,height:148,unit:"mm"},{id:y.A4,name:"A4",width:210,height:297,unit:"mm"},{id:y.A3,name:"A3",width:297,height:420,unit:"mm"},{id:y.B5,name:"B5",width:176,height:250,unit:"mm"},{id:y.B4,name:"B4",width:250,height:353,unit:"mm"},{id:y.letter,name:"Letter",width:8.5,height:11,unit:"in"},{id:y.legal,name:"Legal",width:8.5,height:14,unit:"in"},{id:y.ledger,name:"Ledger",width:11,height:17,unit:"in"}],a=(((M=t.devices)==null?void 0:M.call(t,{items:g}))||g).map(v=>ue(v,t));n.devices.reset(a);const p=d&&n.get(d)||n.getAll().at(0);n.select(p),["map","video"].forEach(v=>r.remove(v));const m=(v={})=>{const b="page-rule",{rules:P}=e.Css,{width:T,height:B,minHeight:R}=n.getSelected().attributes,Y=B&&B!=="auto"?B:R,S=P.where({id:b}).pop(),J=S||P.add({id:b,selectors:[],selectorsAdd:"@page"},{at:0});(v.fromDeviceChange||!S)&&J.addStyle({size:`${T} ${Y}`,...!S&&{margin:"0"}})},w=(v,b={})=>{const P=v.document,{minHeight:T}=n.getSelected().attributes,R=`
|
|
20
20
|
${!!parseFloat(`${T}`)?`
|
|
21
21
|
[data-gjs-type="wrapper"] { min-height: ${T}; }
|
|
22
22
|
`:`
|
|
@@ -29,4 +29,4 @@
|
|
|
29
29
|
height: 100dvh;
|
|
30
30
|
}
|
|
31
31
|
`}
|
|
32
|
-
`;
|
|
32
|
+
`;C(`${q}preset-printable`,R,{doc:P,target:P.head}),m(b)};e.on(i.frameLoadBody,v=>{const b=v.window;if(w(b),t.fixedHeight){const T=v.model.getComponent().getEl();T==null||T.addEventListener("scroll",B=>{const R=B.target;R.scrollTop>0&&R.scrollTo(0,0)})}}),e.on(n.events.select,()=>{var b;const v=(b=o.getFrameEl().contentDocument)==null?void 0:b.defaultView;v&&w(v,{fromDeviceChange:!0})});const c=()=>{const b=e.Css.getRules().filter(P=>P.selectorsToString()==="body").pop();b==null||b.addStyle({"margin-top":"","margin-right":"","margin-bottom":"","margin-left":"",margin:"0"})},h=[[l.projectLoad,c]];h.forEach(([v,b])=>e.on(v,b));const k=fe(e,t),x=ve(e),L=be(e,t);e.onReady(()=>{e.UndoManager.clear()});const E=()=>{h.forEach(([v,b])=>e.off(v,b)),k(),x(),L()};e.on(l.destroy,E),ce({editor:e,licenseKey:t.licenseKey,plan:ye,pluginName:me,cleanup:E})},Pe=ie(we);module.exports=Pe;
|