@grapesjs/studio-sdk-plugins 1.0.35 → 1.0.36
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 +175 -162
- package/dist/accordionComponent/index.umd.js +7 -7
- package/dist/aiChat/index.cjs.js +64 -64
- package/dist/aiChat/index.es.js +5785 -5757
- package/dist/aiChat/index.js +64 -64
- package/dist/aiChat/index.umd.js +63 -63
- package/dist/animationComponent/index.cjs.js +3 -3
- package/dist/animationComponent/index.es.js +204 -191
- package/dist/animationComponent/index.umd.js +3 -3
- package/dist/canvasAbsoluteMode/index.cjs.js +1 -1
- package/dist/canvasAbsoluteMode/index.es.js +183 -170
- package/dist/canvasAbsoluteMode/index.umd.js +1 -1
- package/dist/canvasEmptyState/index.cjs.js +1 -1
- package/dist/canvasEmptyState/index.es.js +134 -121
- package/dist/canvasEmptyState/index.umd.js +1 -1
- package/dist/canvasFullSize/index.cjs.js +9 -9
- package/dist/canvasFullSize/index.es.js +165 -152
- package/dist/canvasFullSize/index.umd.js +9 -9
- package/dist/canvasGridMode/index.cjs.js +5 -5
- package/dist/canvasGridMode/index.es.js +245 -232
- package/dist/canvasGridMode/index.umd.js +4 -4
- package/dist/canvasScreenshot/index.cjs.js +1 -1
- package/dist/canvasScreenshot/index.es.js +155 -142
- package/dist/canvasScreenshot/index.umd.js +1 -1
- package/dist/dataSourceEjs/index.cjs.js +9 -9
- package/dist/dataSourceEjs/index.es.js +257 -244
- package/dist/dataSourceEjs/index.umd.js +9 -9
- package/dist/dataSourceHandlebars/index.cjs.js +8 -8
- package/dist/dataSourceHandlebars/index.es.js +216 -203
- package/dist/dataSourceHandlebars/index.umd.js +7 -7
- package/dist/dialogComponent/index.cjs.js +14 -14
- package/dist/dialogComponent/index.es.js +141 -128
- package/dist/dialogComponent/index.umd.js +14 -14
- package/dist/flexComponent/index.cjs.js +13 -13
- package/dist/flexComponent/index.es.js +484 -471
- package/dist/flexComponent/index.umd.js +13 -13
- package/dist/fsLightboxComponent/index.cjs.js +3 -3
- package/dist/fsLightboxComponent/index.es.js +173 -160
- package/dist/fsLightboxComponent/index.umd.js +3 -3
- package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
- package/dist/googleFontsAssetProvider/index.es.js +160 -147
- package/dist/googleFontsAssetProvider/index.umd.js +1 -1
- package/dist/iconifyComponent/index.cjs.js +2 -2
- package/dist/iconifyComponent/index.es.js +196 -183
- package/dist/iconifyComponent/index.umd.js +2 -2
- package/dist/index.cjs.js +25 -25
- package/dist/index.es.js +121 -108
- package/dist/index.umd.js +18 -18
- package/dist/layoutSidebarButtons/index.cjs.js +1 -1
- package/dist/layoutSidebarButtons/index.es.js +157 -144
- package/dist/layoutSidebarButtons/index.umd.js +1 -1
- package/dist/lightGalleryComponent/index.cjs.js +1 -1
- package/dist/lightGalleryComponent/index.es.js +245 -232
- package/dist/lightGalleryComponent/index.umd.js +1 -1
- package/dist/linkImageComponent/index.cjs.js +2 -2
- package/dist/linkImageComponent/index.es.js +106 -93
- package/dist/linkImageComponent/index.umd.js +2 -2
- package/dist/listPagesComponent/index.cjs.js +5 -5
- package/dist/listPagesComponent/index.es.js +157 -144
- package/dist/listPagesComponent/index.umd.js +5 -5
- package/dist/presetPrintable/index.cjs.js +3 -3
- package/dist/presetPrintable/index.es.js +181 -168
- package/dist/presetPrintable/index.umd.js +3 -3
- package/dist/prosemirror/index.cjs.js +7 -7
- package/dist/prosemirror/index.es.js +385 -372
- package/dist/prosemirror/index.umd.js +8 -8
- package/dist/rendererReact/index.cjs.js +1 -1
- package/dist/rendererReact/index.es.js +200 -187
- 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 +118 -105
- package/dist/rteTinyMce/index.umd.js +2 -2
- package/dist/shapeDividerComponent/index.cjs.js +4 -4
- package/dist/shapeDividerComponent/index.es.js +129 -116
- package/dist/shapeDividerComponent/index.umd.js +4 -4
- package/dist/swiperComponent/index.cjs.js +9 -9
- package/dist/swiperComponent/index.es.js +203 -190
- package/dist/swiperComponent/index.umd.js +7 -7
- package/dist/tableComponent/index.cjs.js +1 -1
- package/dist/tableComponent/index.es.js +257 -244
- package/dist/tableComponent/index.umd.js +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/youtubeAssetProvider/index.cjs.js +1 -1
- package/dist/youtubeAssetProvider/index.es.js +121 -108
- package/dist/youtubeAssetProvider/index.umd.js +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
var d = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(d || {}), y = /* @__PURE__ */ ((e) => (e.toastAdd = "studio:toastAdd", e.toastRemove = "studio:toastRemove", e.dialogOpen = "studio:dialogOpen", e.dialogClose = "studio:dialogClose", e.dialogExportCode = "studio:dialogExportCode", e.dialogImportCode = "studio:dialogImportCode", 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.settings = "studio:settings", 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))(y || {});
|
|
2
|
+
const x = "app.grapesjs.com", T = "app-stage.grapesjs.com", I = "app2.grapesjs.com", $ = "app-stage2.grapesjs.com", w = [
|
|
3
|
+
x,
|
|
4
|
+
I,
|
|
5
|
+
T,
|
|
6
6
|
$,
|
|
7
7
|
"localhost",
|
|
8
8
|
"127.0.0.1",
|
|
@@ -12,210 +12,223 @@ const D = "app.grapesjs.com", G = "app-stage.grapesjs.com", R = "app2.grapesjs.c
|
|
|
12
12
|
// For stackblitz.com demos
|
|
13
13
|
"-sandpack.codesandbox.io"
|
|
14
14
|
// For Sandpack demos
|
|
15
|
-
], E = "license:check:
|
|
16
|
-
isDev:
|
|
17
|
-
isStage:
|
|
15
|
+
], E = "license:check:end", M = () => typeof window < "u", U = ({
|
|
16
|
+
isDev: e,
|
|
17
|
+
isStage: t,
|
|
18
18
|
isPlatform: s
|
|
19
|
-
}) => `${
|
|
20
|
-
const
|
|
21
|
-
return !!
|
|
19
|
+
}) => `${e ? "" : `https://${t ? T : x}`}/${s ? "platform-api" : "api"}`, j = () => {
|
|
20
|
+
const e = M() && window.location.hostname;
|
|
21
|
+
return !!e && (w.includes(e) || w.some((t) => e.endsWith(t)));
|
|
22
22
|
};
|
|
23
|
-
async function
|
|
24
|
-
path:
|
|
25
|
-
baseApiUrl:
|
|
23
|
+
async function k({
|
|
24
|
+
path: e,
|
|
25
|
+
baseApiUrl: t,
|
|
26
26
|
method: s = "GET",
|
|
27
|
-
headers:
|
|
28
|
-
params:
|
|
29
|
-
body:
|
|
27
|
+
headers: o = {},
|
|
28
|
+
params: n,
|
|
29
|
+
body: i
|
|
30
30
|
}) {
|
|
31
|
-
const
|
|
31
|
+
const r = `${t || U({ isDev: !1, isStage: !1 })}${e}`, c = {
|
|
32
32
|
method: s,
|
|
33
33
|
headers: {
|
|
34
34
|
"Content-Type": "application/json",
|
|
35
|
-
...
|
|
35
|
+
...o
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
if (!
|
|
41
|
-
throw new Error(`HTTP error! status: ${
|
|
42
|
-
return
|
|
38
|
+
i && (c.body = JSON.stringify(i));
|
|
39
|
+
const p = n ? new URLSearchParams(n).toString() : "", u = p ? `?${p}` : "", a = await fetch(`${r}${u}`, c);
|
|
40
|
+
if (!a.ok)
|
|
41
|
+
throw new Error(`HTTP error! status: ${a.status}`);
|
|
42
|
+
return a.json();
|
|
43
43
|
}
|
|
44
44
|
const F = {
|
|
45
|
-
[
|
|
46
|
-
[
|
|
47
|
-
[
|
|
48
|
-
[
|
|
45
|
+
[d.free]: 0,
|
|
46
|
+
[d.startup]: 10,
|
|
47
|
+
[d.business]: 20,
|
|
48
|
+
[d.enterprise]: 30
|
|
49
49
|
};
|
|
50
|
-
function
|
|
51
|
-
const
|
|
52
|
-
return
|
|
50
|
+
function B(e) {
|
|
51
|
+
const t = e;
|
|
52
|
+
return t.init = (s) => (o) => e(o, s), t;
|
|
53
53
|
}
|
|
54
|
-
const
|
|
55
|
-
async function
|
|
56
|
-
editor:
|
|
57
|
-
plan:
|
|
54
|
+
const N = (e) => /* @__PURE__ */ B(e);
|
|
55
|
+
async function W({
|
|
56
|
+
editor: e,
|
|
57
|
+
plan: t,
|
|
58
58
|
pluginName: s,
|
|
59
|
-
licenseKey:
|
|
60
|
-
onLicenseCheckResponse:
|
|
61
|
-
cleanup:
|
|
59
|
+
licenseKey: o,
|
|
60
|
+
onLicenseCheckResponse: n,
|
|
61
|
+
cleanup: i
|
|
62
62
|
}) {
|
|
63
|
-
let
|
|
64
|
-
const c =
|
|
65
|
-
console.warn("Cleanup plugin:", s, "Reason:",
|
|
66
|
-
},
|
|
63
|
+
let l = "", r;
|
|
64
|
+
const c = (a) => {
|
|
65
|
+
console.warn("Cleanup plugin:", s, "Reason:", a), i();
|
|
66
|
+
}, p = (a = {}) => {
|
|
67
67
|
var A;
|
|
68
|
-
const { error:
|
|
69
|
-
if (!(f ||
|
|
70
|
-
|
|
68
|
+
const { error: g, sdkLicense: f } = a, b = (A = a.plan) == null ? void 0 : A.category;
|
|
69
|
+
if (!(f || a.license) || g)
|
|
70
|
+
c(g || "Invalid license");
|
|
71
71
|
else if (b) {
|
|
72
|
-
const
|
|
73
|
-
|
|
72
|
+
const G = F[t], O = F[b];
|
|
73
|
+
G > O && c({ pluginRequiredPlan: t, licensePlan: b });
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
if (
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
|
|
76
|
+
e.Commands.has(y.settings) && (r = e.runCommand(y.settings), l = (r == null ? void 0 : r.baseUrl) || "");
|
|
77
|
+
const u = (a) => {
|
|
78
|
+
n == null || n(a), a && p(a);
|
|
79
|
+
};
|
|
80
|
+
if (!r) {
|
|
81
|
+
e.onReady(async () => {
|
|
82
|
+
if (!j())
|
|
83
|
+
if (o) {
|
|
84
|
+
const a = await V({ licenseKey: o, pluginName: s, baseApiUrl: l });
|
|
85
|
+
u(a);
|
|
86
|
+
} else
|
|
87
|
+
c("The `licenseKey` option not provided");
|
|
88
|
+
});
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (r.licensePlan || r.licenseError) {
|
|
92
|
+
const a = _(r);
|
|
93
|
+
u(a);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
e.on(E, (a) => u(a));
|
|
90
97
|
}
|
|
91
|
-
|
|
92
|
-
|
|
98
|
+
const _ = (e) => ({
|
|
99
|
+
sdkLicense: e.license,
|
|
100
|
+
license: e.license,
|
|
101
|
+
error: e.licenseError,
|
|
102
|
+
plan: e.licensePlan
|
|
103
|
+
});
|
|
104
|
+
async function V(e) {
|
|
105
|
+
const { licenseKey: t, pluginName: s, baseApiUrl: o } = e;
|
|
93
106
|
try {
|
|
94
|
-
return (await
|
|
95
|
-
baseApiUrl:
|
|
96
|
-
path: `/sdk/${
|
|
107
|
+
return (await k({
|
|
108
|
+
baseApiUrl: o,
|
|
109
|
+
path: `/sdk/${t || "na"}`,
|
|
97
110
|
method: "POST",
|
|
98
111
|
params: {
|
|
99
112
|
d: window.location.hostname,
|
|
100
113
|
pn: s
|
|
101
114
|
}
|
|
102
115
|
})).result || {};
|
|
103
|
-
} catch (
|
|
104
|
-
return console.error("Error during SDK license check:",
|
|
116
|
+
} catch (n) {
|
|
117
|
+
return console.error("Error during SDK license check:", n), !1;
|
|
105
118
|
}
|
|
106
119
|
}
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
const { menuVariant: s, variants:
|
|
120
|
+
const v = (e) => e.replaceAll('"', "").replaceAll("'", ""), P = (e) => e.includes(",") ? e : /\s/.test(e) ? `'${v(e)}'` : v(e), L = (e, t, s) => ({ family: e, variant: t, ...s }), D = (e, t) => {
|
|
121
|
+
e = P(e);
|
|
122
|
+
const { menuVariant: s, variants: o } = t;
|
|
110
123
|
return {
|
|
111
|
-
family:
|
|
112
|
-
familyLabel:
|
|
113
|
-
menuVariant: s &&
|
|
114
|
-
P(`menuFont-${
|
|
124
|
+
family: e,
|
|
125
|
+
familyLabel: v(e),
|
|
126
|
+
menuVariant: s && L(
|
|
127
|
+
P(`menuFont-${v(e)}`),
|
|
115
128
|
"regular",
|
|
116
129
|
s
|
|
117
130
|
),
|
|
118
131
|
variants: Object.assign(
|
|
119
132
|
{},
|
|
120
|
-
...Object.entries(
|
|
121
|
-
[
|
|
133
|
+
...Object.entries(o).map(([n, i]) => ({
|
|
134
|
+
[n]: L(e, n, i)
|
|
122
135
|
}))
|
|
123
136
|
)
|
|
124
137
|
};
|
|
125
|
-
},
|
|
126
|
-
var
|
|
127
|
-
const s =
|
|
128
|
-
if (!
|
|
138
|
+
}, R = (e, t) => {
|
|
139
|
+
var r;
|
|
140
|
+
const s = D(e.family, e), o = s.menuVariant ?? ((r = Object.values(s.variants)) == null ? void 0 : r[0]);
|
|
141
|
+
if (!o)
|
|
129
142
|
return "Arial, Helvetica, sans-serif";
|
|
130
|
-
const { source:
|
|
131
|
-
if (!
|
|
132
|
-
const c = new FontFace(
|
|
133
|
-
for (const
|
|
134
|
-
document.fonts.delete(
|
|
143
|
+
const { source: n, descriptors: i } = o, l = v(o.family);
|
|
144
|
+
if (!t) {
|
|
145
|
+
const c = new FontFace(l, `url("${n}")`, i), p = Array.from(document.fonts.values()).filter((u) => u.family === l);
|
|
146
|
+
for (const u of p)
|
|
147
|
+
document.fonts.delete(u);
|
|
135
148
|
document.fonts.add(c), c.load().catch(() => {
|
|
136
149
|
});
|
|
137
150
|
}
|
|
138
|
-
return P(
|
|
139
|
-
},
|
|
140
|
-
const { family:
|
|
151
|
+
return P(l);
|
|
152
|
+
}, K = (e) => {
|
|
153
|
+
const { family: t, menu: s, axes: o } = e, n = !!o, i = Object.assign(
|
|
141
154
|
{},
|
|
142
|
-
...
|
|
143
|
-
var
|
|
144
|
-
let
|
|
145
|
-
if (
|
|
146
|
-
const
|
|
147
|
-
if (
|
|
148
|
-
const { start: f, end: b } =
|
|
149
|
-
|
|
155
|
+
...e.variants.map((l) => {
|
|
156
|
+
var u, a;
|
|
157
|
+
let r, c;
|
|
158
|
+
if (n) {
|
|
159
|
+
const g = o.find((f) => f.tag === "wght");
|
|
160
|
+
if (g) {
|
|
161
|
+
const { start: f, end: b } = g;
|
|
162
|
+
r = `${f} ${b}`;
|
|
150
163
|
}
|
|
151
164
|
}
|
|
152
|
-
return
|
|
153
|
-
[
|
|
154
|
-
source:
|
|
165
|
+
return r || (r = ((u = l.match(/\d+/)) == null ? void 0 : u[0]) ?? "400"), c = ((a = l.match(/[a-zA-Z]+/)) == null ? void 0 : a[0]) === "italic" ? "italic" : void 0, {
|
|
166
|
+
[l]: {
|
|
167
|
+
source: e.files[l],
|
|
155
168
|
descriptors: {
|
|
156
169
|
style: c,
|
|
157
|
-
weight:
|
|
170
|
+
weight: r
|
|
158
171
|
}
|
|
159
172
|
}
|
|
160
173
|
};
|
|
161
174
|
})
|
|
162
175
|
);
|
|
163
|
-
return
|
|
176
|
+
return D(t, {
|
|
164
177
|
menuVariant: {
|
|
165
178
|
source: s
|
|
166
179
|
},
|
|
167
|
-
variants:
|
|
180
|
+
variants: i
|
|
168
181
|
});
|
|
169
|
-
},
|
|
170
|
-
id: `${
|
|
182
|
+
}, z = (e) => ({
|
|
183
|
+
id: `${e.family}/${e.version}`,
|
|
171
184
|
type: "font",
|
|
172
|
-
src:
|
|
173
|
-
name:
|
|
174
|
-
customData: { font:
|
|
175
|
-
}),
|
|
176
|
-
const { font:
|
|
177
|
-
return
|
|
185
|
+
src: e.menu,
|
|
186
|
+
name: e.family,
|
|
187
|
+
customData: { font: K(e), needsLoading: !0 }
|
|
188
|
+
}), H = (e) => {
|
|
189
|
+
const { font: t } = e.customData;
|
|
190
|
+
return e.customData.needsLoading ? (e.customData.needsLoading = !1, R(t)) : R(t, !0);
|
|
178
191
|
};
|
|
179
192
|
let h;
|
|
180
|
-
const q = (
|
|
181
|
-
const
|
|
182
|
-
for (const s of Object.keys(
|
|
183
|
-
let
|
|
184
|
-
|
|
193
|
+
const q = (e) => {
|
|
194
|
+
const t = [];
|
|
195
|
+
for (const s of Object.keys(e)) {
|
|
196
|
+
let o = e[s];
|
|
197
|
+
o && (Array.isArray(o) ? t.push(...o.map((n) => [s, n.toString()])) : (o = o.toString(), t.push([s, o])));
|
|
185
198
|
}
|
|
186
|
-
return new URLSearchParams(
|
|
187
|
-
}, J = (
|
|
188
|
-
const { apiKey:
|
|
189
|
-
const
|
|
190
|
-
return `${
|
|
199
|
+
return new URLSearchParams(t);
|
|
200
|
+
}, J = (e) => {
|
|
201
|
+
const { apiKey: t, searchParams: s } = e, o = (n = {}) => {
|
|
202
|
+
const i = "https://www.googleapis.com/webfonts/v1/webfonts", l = q(n);
|
|
203
|
+
return `${i}?${l}`;
|
|
191
204
|
};
|
|
192
205
|
return {
|
|
193
206
|
id: "google-fonts",
|
|
194
207
|
types: ["font"],
|
|
195
|
-
label: ({ editor:
|
|
208
|
+
label: ({ editor: n }) => n.I18n.t("googleFontsAssetProvider.providerLabel"),
|
|
196
209
|
search: { reloadOnInput: !1 },
|
|
197
210
|
async onLoad() {
|
|
198
|
-
var
|
|
211
|
+
var p;
|
|
199
212
|
if (h)
|
|
200
213
|
return h;
|
|
201
|
-
const
|
|
202
|
-
key:
|
|
214
|
+
const n = {
|
|
215
|
+
key: t,
|
|
203
216
|
sort: "alpha",
|
|
204
217
|
subset: "latin",
|
|
205
218
|
capability: ["WOFF2", "VF"]
|
|
206
|
-
},
|
|
207
|
-
...
|
|
208
|
-
...
|
|
209
|
-
}, c = await (await fetch(
|
|
210
|
-
return (
|
|
219
|
+
}, i = s == null ? void 0 : s(), l = {
|
|
220
|
+
...n,
|
|
221
|
+
...i
|
|
222
|
+
}, c = await (await fetch(o(l))).json();
|
|
223
|
+
return (p = c.items) != null && p.length ? (h = c.items.map(z), h) : [];
|
|
211
224
|
},
|
|
212
|
-
itemLayout: (
|
|
213
|
-
const
|
|
225
|
+
itemLayout: (n) => {
|
|
226
|
+
const i = h.find((r) => r.id === n.assetProps.id), l = H(i);
|
|
214
227
|
return {
|
|
215
228
|
type: "column",
|
|
216
|
-
onClick: () =>
|
|
229
|
+
onClick: () => n.onSelect(i),
|
|
217
230
|
htmlAttrs: {
|
|
218
|
-
title:
|
|
231
|
+
title: i.name
|
|
219
232
|
},
|
|
220
233
|
style: {
|
|
221
234
|
borderWidth: "1px",
|
|
@@ -226,12 +239,12 @@ const q = (t) => {
|
|
|
226
239
|
children: [
|
|
227
240
|
{
|
|
228
241
|
type: "text",
|
|
229
|
-
content:
|
|
242
|
+
content: i.name,
|
|
230
243
|
style: {
|
|
231
244
|
overflow: "hidden",
|
|
232
245
|
textOverflow: "ellipsis",
|
|
233
246
|
whiteSpace: "nowrap",
|
|
234
|
-
fontFamily:
|
|
247
|
+
fontFamily: l,
|
|
235
248
|
fontSize: "24px",
|
|
236
249
|
paddingLeft: "8px",
|
|
237
250
|
paddingRight: "8px"
|
|
@@ -239,7 +252,7 @@ const q = (t) => {
|
|
|
239
252
|
},
|
|
240
253
|
{
|
|
241
254
|
type: "text",
|
|
242
|
-
content:
|
|
255
|
+
content: i.name,
|
|
243
256
|
style: {
|
|
244
257
|
overflow: "hidden",
|
|
245
258
|
textOverflow: "ellipsis",
|
|
@@ -259,21 +272,21 @@ const q = (t) => {
|
|
|
259
272
|
modalTitle: "Select Font",
|
|
260
273
|
providerLabel: "Google Fonts"
|
|
261
274
|
}
|
|
262
|
-
},
|
|
263
|
-
const { i18n: s = {} } =
|
|
264
|
-
|
|
275
|
+
}, Z = "googleFontsAssetProvider", X = d.startup, Y = function(e, t) {
|
|
276
|
+
const { i18n: s = {} } = t, o = J(t);
|
|
277
|
+
e.runCommand(y.assetProviderAdd, { provider: o }), e.I18n.addMessages({
|
|
265
278
|
en: Q,
|
|
266
279
|
...s
|
|
267
|
-
}),
|
|
268
|
-
editor:
|
|
269
|
-
licenseKey:
|
|
270
|
-
plan:
|
|
271
|
-
pluginName:
|
|
280
|
+
}), W({
|
|
281
|
+
editor: e,
|
|
282
|
+
licenseKey: t.licenseKey,
|
|
283
|
+
plan: X,
|
|
284
|
+
pluginName: Z,
|
|
272
285
|
cleanup: () => {
|
|
273
|
-
|
|
286
|
+
e.runCommand(y.assetProviderRemove, { id: o.id });
|
|
274
287
|
}
|
|
275
288
|
});
|
|
276
|
-
}, m =
|
|
289
|
+
}, m = N(Y);
|
|
277
290
|
export {
|
|
278
291
|
m as default
|
|
279
292
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(g
|
|
1
|
+
(function(p,g){typeof exports=="object"&&typeof module<"u"?module.exports=g():typeof define=="function"&&define.amd?define(g):(p=typeof globalThis<"u"?globalThis:p||self,p.StudioSdkPlugins_googleFontsAssetProvider=g())})(this,function(){"use strict";var p=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(p||{}),g=(e=>(e.toastAdd="studio:toastAdd",e.toastRemove="studio:toastRemove",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",e.dialogExportCode="studio:dialogExportCode",e.dialogImportCode="studio:dialogImportCode",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.settings="studio:settings",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))(g||{});const A="app.grapesjs.com",w="app-stage.grapesjs.com",F=[A,"app2.grapesjs.com",w,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],O="license:check:end",G=()=>typeof window<"u",I=({isDev:e,isStage:t,isPlatform:s})=>`${e?"":`https://${t?w:A}`}/${s?"platform-api":"api"}`,$=()=>{const e=G()&&window.location.hostname;return!!e&&(F.includes(e)||F.some(t=>e.endsWith(t)))};async function M({path:e,baseApiUrl:t,method:s="GET",headers:o={},params:n,body:i}){const a=`${t||I({isDev:!1,isStage:!1})}${e}`,c={method:s,headers:{"Content-Type":"application/json",...o}};i&&(c.body=JSON.stringify(i));const d=n?new URLSearchParams(n).toString():"",u=d?`?${d}`:"",r=await fetch(`${a}${u}`,c);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return r.json()}const L={[p.free]:0,[p.startup]:10,[p.business]:20,[p.enterprise]:30};function E(e){const t=e;return t.init=s=>o=>e(o,s),t}const U=e=>E(e);async function j({editor:e,plan:t,pluginName:s,licenseKey:o,onLicenseCheckResponse:n,cleanup:i}){let l="",a;const c=r=>{console.warn("Cleanup plugin:",s,"Reason:",r),i()},d=(r={})=>{var D;const{error:f,sdkLicense:y}=r,v=(D=r.plan)==null?void 0:D.category;if(!(y||r.license)||f)c(f||"Invalid license");else if(v){const J=L[t],Q=L[v];J>Q&&c({pluginRequiredPlan:t,licensePlan:v})}};e.Commands.has(g.settings)&&(a=e.runCommand(g.settings),l=(a==null?void 0:a.baseUrl)||"");const u=r=>{n==null||n(r),r&&d(r)};if(!a){e.onReady(async()=>{if(!$())if(o){const r=await N({licenseKey:o,pluginName:s,baseApiUrl:l});u(r)}else c("The `licenseKey` option not provided")});return}if(a.licensePlan||a.licenseError){const r=k(a);u(r);return}e.on(O,r=>u(r))}const k=e=>({sdkLicense:e.license,license:e.license,error:e.licenseError,plan:e.licensePlan});async function N(e){const{licenseKey:t,pluginName:s,baseApiUrl:o}=e;try{return(await M({baseApiUrl:o,path:`/sdk/${t||"na"}`,method:"POST",params:{d:window.location.hostname,pn:s}})).result||{}}catch(n){return console.error("Error during SDK license check:",n),!1}}const h=e=>e.replaceAll('"',"").replaceAll("'",""),P=e=>e.includes(",")?e:/\s/.test(e)?`'${h(e)}'`:h(e),R=(e,t,s)=>({family:e,variant:t,...s}),x=(e,t)=>{e=P(e);const{menuVariant:s,variants:o}=t;return{family:e,familyLabel:h(e),menuVariant:s&&R(P(`menuFont-${h(e)}`),"regular",s),variants:Object.assign({},...Object.entries(o).map(([n,i])=>({[n]:R(e,n,i)})))}},T=(e,t)=>{var a;const s=x(e.family,e),o=s.menuVariant??((a=Object.values(s.variants))==null?void 0:a[0]);if(!o)return"Arial, Helvetica, sans-serif";const{source:n,descriptors:i}=o,l=h(o.family);if(!t){const c=new FontFace(l,`url("${n}")`,i),d=Array.from(document.fonts.values()).filter(u=>u.family===l);for(const u of d)document.fonts.delete(u);document.fonts.add(c),c.load().catch(()=>{})}return P(l)},B=e=>{const{family:t,menu:s,axes:o}=e,n=!!o,i=Object.assign({},...e.variants.map(l=>{var u,r;let a,c;if(n){const f=o.find(y=>y.tag==="wght");if(f){const{start:y,end:v}=f;a=`${y} ${v}`}}return a||(a=((u=l.match(/\d+/))==null?void 0:u[0])??"400"),c=((r=l.match(/[a-zA-Z]+/))==null?void 0:r[0])==="italic"?"italic":void 0,{[l]:{source:e.files[l],descriptors:{style:c,weight:a}}}}));return x(t,{menuVariant:{source:s},variants:i})},_=e=>({id:`${e.family}/${e.version}`,type:"font",src:e.menu,name:e.family,customData:{font:B(e),needsLoading:!0}}),W=e=>{const{font:t}=e.customData;return e.customData.needsLoading?(e.customData.needsLoading=!1,T(t)):T(t,!0)};let b;const V=e=>{const t=[];for(const s of Object.keys(e)){let o=e[s];o&&(Array.isArray(o)?t.push(...o.map(n=>[s,n.toString()])):(o=o.toString(),t.push([s,o])))}return new URLSearchParams(t)},K=e=>{const{apiKey:t,searchParams:s}=e,o=(n={})=>{const i="https://www.googleapis.com/webfonts/v1/webfonts",l=V(n);return`${i}?${l}`};return{id:"google-fonts",types:["font"],label:({editor:n})=>n.I18n.t("googleFontsAssetProvider.providerLabel"),search:{reloadOnInput:!1},async onLoad(){var d;if(b)return b;const n={key:t,sort:"alpha",subset:"latin",capability:["WOFF2","VF"]},i=s==null?void 0:s(),l={...n,...i},c=await(await fetch(o(l))).json();return(d=c.items)!=null&&d.length?(b=c.items.map(_),b):[]},itemLayout:n=>{const i=b.find(a=>a.id===n.assetProps.id),l=W(i);return{type:"column",onClick:()=>n.onSelect(i),htmlAttrs:{title:i.name},style:{borderWidth:"1px",borderRadius:8,overflow:"hidden",cursor:"pointer"},children:[{type:"text",content:i.name,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontFamily:l,fontSize:"24px",paddingLeft:"8px",paddingRight:"8px"}},{type:"text",content:i.name,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"16px",paddingLeft:"8px",paddingRight:"8px"}}]}}}},z={googleFontsAssetProvider:{searchBtn:"Search on Google Fonts",modalTitle:"Select Font",providerLabel:"Google Fonts"}},H="googleFontsAssetProvider",q=p.startup;return U(function(e,t){const{i18n:s={}}=t,o=K(t);e.runCommand(g.assetProviderAdd,{provider:o}),e.I18n.addMessages({en:z,...s}),j({editor:e,licenseKey:t.licenseKey,plan:q,pluginName:H,cleanup:()=>{e.runCommand(g.assetProviderRemove,{id:o.id})}})})});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const k="app.grapesjs.com",D="app-stage.grapesjs.com",B="app2.grapesjs.com",H="app-stage2.grapesjs.com",O=[k,B,D,H,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],F="license:check:end",C=()=>typeof window<"u",W=({isDev:e,isStage:t,isPlatform:o})=>`${e?"":`https://${t?D:k}`}/${o?"platform-api":"api"}`,K=()=>{const e=C()&&window.location.hostname;return!!e&&(O.includes(e)||O.some(t=>e.endsWith(t)))};async function V({path:e,baseApiUrl:t,method:o="GET",headers:i={},params:l,body:g}){const s=`${t||W({isDev:!1,isStage:!1})}${e}`,n={method:o,headers:{"Content-Type":"application/json",...i}};g&&(n.body=JSON.stringify(g));const c=l?new URLSearchParams(l).toString():"",p=c?`?${c}`:"",r=await fetch(`${s}${p}`,n);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return r.json()}var w=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(w||{}),_=(e=>(e.Info="info",e.Error="error",e.Success="success",e.Warning="warning",e))(_||{}),f=(e=>(e.toastAdd="studio:toastAdd",e.toastRemove="studio:toastRemove",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",e.dialogExportCode="studio:dialogExportCode",e.dialogImportCode="studio:dialogImportCode",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.settings="studio:settings",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))(f||{});const x={[w.free]:0,[w.startup]:10,[w.business]:20,[w.enterprise]:30};function Y(e){const t=e;return t.init=o=>i=>e(i,o),t}const z=e=>Y(e);async function q({editor:e,plan:t,pluginName:o,licenseKey:i,onLicenseCheckResponse:l,cleanup:g}){let a="",s;const n=r=>{console.warn("Cleanup plugin:",o,"Reason:",r),g()},c=(r={})=>{var b;const{error:h,sdkLicense:u}=r,d=(b=r.plan)==null?void 0:b.category;if(!(u||r.license)||h)n(h||"Invalid license");else if(d){const y=x[t],v=x[d];y>v&&n({pluginRequiredPlan:t,licensePlan:d})}};e.Commands.has(f.settings)&&(s=e.runCommand(f.settings),a=(s==null?void 0:s.baseUrl)||"");const p=r=>{l==null||l(r),r&&c(r)};if(!s){e.onReady(async()=>{if(!K())if(i){const r=await m({licenseKey:i,pluginName:o,baseApiUrl:a});p(r)}else n("The `licenseKey` option not provided")});return}if(s.licensePlan||s.licenseError){const r=J(s);p(r);return}e.on(F,r=>p(r))}const J=e=>({sdkLicense:e.license,license:e.license,error:e.licenseError,plan:e.licensePlan});async function m(e){const{licenseKey:t,pluginName:o,baseApiUrl:i}=e;try{return(await V({baseApiUrl:i,path:`/sdk/${t||"na"}`,method:"POST",params:{d:window.location.hostname,pn:o}})).result||{}}catch(l){return console.error("Error during SDK license check:",l),!1}}const X=(e,t)=>{var o;return!!((o=e==null?void 0:e.hasAttribute)!=null&&o.call(e,t))},Z="iconifyComponent",Q=w.startup,S={ratioDefault:!0,tc:!1,cl:!1,cr:!1,bc:!1},T=`<svg viewBox="0 0 24 24">
|
|
2
2
|
<path d="M19 0H9C7.9 0 7 .9 7 2V18C7 19.1 7.9 20 9 20H19C20.1 20 21 19.1 21 18V2C21 .9 20.1 0 19 0M19 18H9V2H19V18M3 4V22C3 23.1 3.9 24 5 24H17V22H5V4H3M14 5L11 10L14 15L17 10L14 5Z" />
|
|
3
|
-
</svg
|
|
3
|
+
</svg>`,$="layout-icon-picker",ee="icons-layout-",G="icons-list-layout",M="gs-iconify-picker",A="__iconify_collection",te="https://api.iconify.design",E=new Map;let L;const oe=({collectionId:e})=>`https://cdn.jsdelivr.net/npm/@iconify-json/${e}@latest/icons.json`;async function N({collectionId:e,editor:t}){try{if(E.has(e))return E.get(e);const o=await fetch(oe({collectionId:e}));if(!o.ok)throw new Error(`Failed to fetch collection: ${o.statusText}`);const i=await o.json();return E.set(e,i),i}catch(o){console.error("Error fetching collection",o),t.runCommand(f.toastAdd,ae());return}}async function ne({collectionIds:e,editor:t}){try{if(L)return L;const o=e?`?prefixes=${e.join(",")}`:"",i=await fetch(`${te}/collections${o}`);if(!i.ok)throw new Error(`Failed to fetch collections: ${i.statusText}`);return L=await i.json(),L}catch(o){console.error("Error fetching collections",o),t.runCommand(f.toastAdd,j());return}}function R(){return{type:"button",label:"Open Icon Picker",name:"onActive",changeProp:!0,command(e){var t;(t=e.getSelected())==null||t.trigger("active")}}}async function se({collectionIds:e,editor:t,component:o}){const i=await ne({collectionIds:e,editor:t});if(!i)return;const l=({icon:n,collectionId:c,iconId:p})=>{o.components(n),o.set({collectionId:c,iconId:p})},g=Object.entries(i).map(([n,c])=>({id:n,...c})).sort((n,c)=>n.name.localeCompare(c.name)),a=o.get("collectionId")??g[0].id;t.runCommand(f.layoutToggle,{id:$,placer:{type:"dialog",size:"l",title:"Select Icon"},header:!1,layout:{type:"column",style:{height:500,gap:10},children:[re({collectionsList:g,collectionId:a,editor:t,handleClick:l}),{id:G,type:"column",grow:!0}]}});const s=await N({collectionId:a,editor:t});s&&(U({editor:t,collection:s}),P({editor:t,collection:s,handleClick:l,collectionId:a}))}function U({editor:e,collection:t}){e.em.set(A,t)}function ie(e){return e.em.get(A)}function P(e){const{editor:t}=e;t.runCommand(f.layoutUpdate,{id:ee,layout:ce(e),header:!1,style:{height:"100%"},placer:{type:"static",layoutId:G}})}function re(e){const{collectionsList:t,collectionId:o,editor:i,handleClick:l}=e,g=t.map(({id:a,name:s,total:n})=>({id:a,label:`${s} (${n})`})).sort((a,s)=>a.label.localeCompare(s.label));return{type:"column",style:{gap:10},className:`${M}__header`,children:[{type:"selectField",value:o,options:g,emptyState:"Select an icon collection",onChange:async({setState:a,value:s})=>{const n=await N({collectionId:s,editor:i});n&&(a({value:s}),U({editor:i,collection:n}),P({editor:i,collection:n,handleClick:l,collectionId:s}))}},{type:"inputField",value:"",placeholder:"Search icons inside collection...",editorEvents:{[`change:${A}`]:({setState:a})=>a({value:""})},onInput:({setState:a,value:s,editor:n})=>{const c=ie(n);if(!c)return;const p=Object.fromEntries(Object.entries(c.icons).filter(([r])=>r.includes(s)));a({value:s}),P({editor:n,collection:c,handleClick:l,collectionId:o,collectionFiltered:{...c,icons:p}})}}]}}function ce({collection:e,collectionFiltered:t,handleClick:o}){const{height:i=24,width:l=24,icons:g,prefix:a}=t||e,s=Object.entries(g).map(([n,c])=>({name:n,...c}),{});return{type:"column",className:`${M}__content`,style:{height:"100%"},children:{type:"virtualList",items:s,itemLayout:({item:n})=>({type:"custom",render:c=>{const{editor:p,addEl:r,removeEl:h}=c,u=document.createElementNS("http://www.w3.org/2000/svg","svg");u.setAttribute("xmlns","http://www.w3.org/2000/svg"),u.innerHTML=n.body;const d=n.width||l,I=n.height||i;u.setAttribute("viewBox",`0 0 ${d} ${I}`),u.style.cssText="width: 48px; height: 48px; cursor: pointer; border-radius: 4px; transition: padding 0.1s ease-in-out;";const b=[["click",()=>{const y=u.cloneNode(!0);y.removeAttribute("style");const v=y.outerHTML;o({icon:v,collectionId:a,iconId:n.name}),p==null||p.runCommand(f.layoutRemove,{id:$})}],["pointerover",()=>{u.style.border="2px solid currentColor",u.style.padding="4px"}],["pointerout",()=>{u.style.border="",u.style.padding=""}]];return b.forEach(([y,v])=>u.addEventListener(y,v)),r(u),()=>{b.forEach(([y,v])=>u.removeEventListener(y,v)),h(u)}}})}}}function j(){return{id:"toast-error-getCollections",header:"Error",content:"Error fetching collections",variant:_.Error}}function ae(){return{...j(),id:"toast-error-getCollection",content:"Error fetching collection"}}const le=function(e,t={}){var u;const{Components:o,Blocks:i}=e,{collections:l,extendIconComponent:g=!0,licenseKey:a,block:s={}}=t,n="icon",c="iconify",p="Iconify",r="data-type-iconify",h={events:()=>({dblclick:"onActive"}),onActive(){se({collectionIds:l,editor:e,component:this.model})}};if(o.addType(c,{block:s&&{label:p,media:T,content:{type:c},category:"Extra",activate:!0,...s},isComponent:d=>X(d,r),model:{defaults:{name:p,icon:T,droppable:!1,attributes:{[r]:!0},resizable:S,components:T,style:{width:"50px",height:"50px"},traits:[R()]},init(){this.listenTo(this.components(),"change add",this.disableLayers),this.disableLayers()},disableLayers(){this.components().forEach(d=>d.set({layerable:!1,locked:!0}))}},view:h}),g){const d=(u=o.getType(n))==null?void 0:u.model,[I,b,...y]=d.getDefaults().traits;o.addType(n,{model:{defaults:{traits:[I,b,R(),...y]}},view:h})}q({editor:e,licenseKey:a,plan:Q,pluginName:Z,cleanup:()=>{i.remove(c),o.removeType(c)}})},ue=z(le);module.exports=ue;
|