@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,7 +1,7 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
1
|
+
const k = "app.grapesjs.com", D = "app-stage.grapesjs.com", B = "app2.grapesjs.com", H = "app-stage2.grapesjs.com", O = [
|
|
2
|
+
k,
|
|
3
3
|
B,
|
|
4
|
-
|
|
4
|
+
D,
|
|
5
5
|
H,
|
|
6
6
|
"localhost",
|
|
7
7
|
"127.0.0.1",
|
|
@@ -11,209 +11,222 @@ const D = "app.grapesjs.com", $ = "app-stage.grapesjs.com", B = "app2.grapesjs.c
|
|
|
11
11
|
// For stackblitz.com demos
|
|
12
12
|
"-sandpack.codesandbox.io"
|
|
13
13
|
// For Sandpack demos
|
|
14
|
-
], F = "license:check:
|
|
15
|
-
isDev:
|
|
16
|
-
isStage:
|
|
14
|
+
], F = "license:check:end", C = () => typeof window < "u", W = ({
|
|
15
|
+
isDev: e,
|
|
16
|
+
isStage: t,
|
|
17
17
|
isPlatform: o
|
|
18
|
-
}) => `${
|
|
19
|
-
const
|
|
20
|
-
return !!
|
|
18
|
+
}) => `${e ? "" : `https://${t ? D : k}`}/${o ? "platform-api" : "api"}`, K = () => {
|
|
19
|
+
const e = C() && window.location.hostname;
|
|
20
|
+
return !!e && (O.includes(e) || O.some((t) => e.endsWith(t)));
|
|
21
21
|
};
|
|
22
|
-
async function
|
|
23
|
-
path:
|
|
24
|
-
baseApiUrl:
|
|
22
|
+
async function V({
|
|
23
|
+
path: e,
|
|
24
|
+
baseApiUrl: t,
|
|
25
25
|
method: o = "GET",
|
|
26
|
-
headers:
|
|
27
|
-
params:
|
|
28
|
-
body:
|
|
26
|
+
headers: i = {},
|
|
27
|
+
params: l,
|
|
28
|
+
body: g
|
|
29
29
|
}) {
|
|
30
|
-
const
|
|
30
|
+
const s = `${t || W({ isDev: !1, isStage: !1 })}${e}`, n = {
|
|
31
31
|
method: o,
|
|
32
32
|
headers: {
|
|
33
33
|
"Content-Type": "application/json",
|
|
34
|
-
...
|
|
34
|
+
...i
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
if (!
|
|
40
|
-
throw new Error(`HTTP error! status: ${
|
|
41
|
-
return
|
|
37
|
+
g && (n.body = JSON.stringify(g));
|
|
38
|
+
const c = l ? new URLSearchParams(l).toString() : "", p = c ? `?${c}` : "", r = await fetch(`${s}${p}`, n);
|
|
39
|
+
if (!r.ok)
|
|
40
|
+
throw new Error(`HTTP error! status: ${r.status}`);
|
|
41
|
+
return r.json();
|
|
42
42
|
}
|
|
43
|
-
var
|
|
43
|
+
var w = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(w || {}), _ = /* @__PURE__ */ ((e) => (e.Info = "info", e.Error = "error", e.Success = "success", e.Warning = "warning", e))(_ || {}), 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 || {});
|
|
44
44
|
const x = {
|
|
45
|
-
[
|
|
46
|
-
[
|
|
47
|
-
[
|
|
48
|
-
[
|
|
45
|
+
[w.free]: 0,
|
|
46
|
+
[w.startup]: 10,
|
|
47
|
+
[w.business]: 20,
|
|
48
|
+
[w.enterprise]: 30
|
|
49
49
|
};
|
|
50
|
-
function
|
|
51
|
-
const
|
|
52
|
-
return
|
|
50
|
+
function Y(e) {
|
|
51
|
+
const t = e;
|
|
52
|
+
return t.init = (o) => (i) => e(i, o), t;
|
|
53
53
|
}
|
|
54
|
-
const
|
|
55
|
-
async function
|
|
56
|
-
editor:
|
|
57
|
-
plan:
|
|
54
|
+
const z = (e) => /* @__PURE__ */ Y(e);
|
|
55
|
+
async function q({
|
|
56
|
+
editor: e,
|
|
57
|
+
plan: t,
|
|
58
58
|
pluginName: o,
|
|
59
|
-
licenseKey:
|
|
60
|
-
onLicenseCheckResponse:
|
|
61
|
-
cleanup:
|
|
59
|
+
licenseKey: i,
|
|
60
|
+
onLicenseCheckResponse: l,
|
|
61
|
+
cleanup: g
|
|
62
62
|
}) {
|
|
63
|
-
let
|
|
64
|
-
const n =
|
|
65
|
-
console.warn("Cleanup plugin:", o, "Reason:",
|
|
66
|
-
},
|
|
67
|
-
var
|
|
68
|
-
const { error:
|
|
69
|
-
if (!(u ||
|
|
70
|
-
|
|
63
|
+
let a = "", s;
|
|
64
|
+
const n = (r) => {
|
|
65
|
+
console.warn("Cleanup plugin:", o, "Reason:", r), g();
|
|
66
|
+
}, c = (r = {}) => {
|
|
67
|
+
var b;
|
|
68
|
+
const { error: h, sdkLicense: u } = r, d = (b = r.plan) == null ? void 0 : b.category;
|
|
69
|
+
if (!(u || r.license) || h)
|
|
70
|
+
n(h || "Invalid license");
|
|
71
71
|
else if (d) {
|
|
72
|
-
const f = x[
|
|
73
|
-
f >
|
|
72
|
+
const f = x[t], v = x[d];
|
|
73
|
+
f > v && n({ pluginRequiredPlan: t, licensePlan: d });
|
|
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) && (s = e.runCommand(y.settings), a = (s == null ? void 0 : s.baseUrl) || "");
|
|
77
|
+
const p = (r) => {
|
|
78
|
+
l == null || l(r), r && c(r);
|
|
79
|
+
};
|
|
80
|
+
if (!s) {
|
|
81
|
+
e.onReady(async () => {
|
|
82
|
+
if (!K())
|
|
83
|
+
if (i) {
|
|
84
|
+
const r = await m({ licenseKey: i, pluginName: o, baseApiUrl: a });
|
|
85
|
+
p(r);
|
|
86
|
+
} else
|
|
87
|
+
n("The `licenseKey` option not provided");
|
|
88
|
+
});
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (s.licensePlan || s.licenseError) {
|
|
92
|
+
const r = J(s);
|
|
93
|
+
p(r);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
e.on(F, (r) => p(r));
|
|
90
97
|
}
|
|
91
|
-
|
|
92
|
-
|
|
98
|
+
const J = (e) => ({
|
|
99
|
+
sdkLicense: e.license,
|
|
100
|
+
license: e.license,
|
|
101
|
+
error: e.licenseError,
|
|
102
|
+
plan: e.licensePlan
|
|
103
|
+
});
|
|
104
|
+
async function m(e) {
|
|
105
|
+
const { licenseKey: t, pluginName: o, baseApiUrl: i } = e;
|
|
93
106
|
try {
|
|
94
|
-
return (await
|
|
95
|
-
baseApiUrl:
|
|
96
|
-
path: `/sdk/${
|
|
107
|
+
return (await V({
|
|
108
|
+
baseApiUrl: i,
|
|
109
|
+
path: `/sdk/${t || "na"}`,
|
|
97
110
|
method: "POST",
|
|
98
111
|
params: {
|
|
99
112
|
d: window.location.hostname,
|
|
100
113
|
pn: o
|
|
101
114
|
}
|
|
102
115
|
})).result || {};
|
|
103
|
-
} catch (
|
|
104
|
-
return console.error("Error during SDK license check:",
|
|
116
|
+
} catch (l) {
|
|
117
|
+
return console.error("Error during SDK license check:", l), !1;
|
|
105
118
|
}
|
|
106
119
|
}
|
|
107
|
-
const
|
|
120
|
+
const X = (e, t) => {
|
|
108
121
|
var o;
|
|
109
|
-
return !!((o =
|
|
110
|
-
},
|
|
122
|
+
return !!((o = e == null ? void 0 : e.hasAttribute) != null && o.call(e, t));
|
|
123
|
+
}, Z = "iconifyComponent", Q = w.startup, S = { ratioDefault: !0, tc: !1, cl: !1, cr: !1, bc: !1 }, T = `<svg viewBox="0 0 24 24">
|
|
111
124
|
<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" />
|
|
112
|
-
</svg>`,
|
|
113
|
-
let
|
|
114
|
-
const
|
|
115
|
-
async function
|
|
125
|
+
</svg>`, $ = "layout-icon-picker", ee = "icons-layout-", G = "icons-list-layout", M = "gs-iconify-picker", A = "__iconify_collection", te = "https://api.iconify.design", E = /* @__PURE__ */ new Map();
|
|
126
|
+
let L;
|
|
127
|
+
const oe = ({ collectionId: e }) => `https://cdn.jsdelivr.net/npm/@iconify-json/${e}@latest/icons.json`;
|
|
128
|
+
async function N({ collectionId: e, editor: t }) {
|
|
116
129
|
try {
|
|
117
|
-
if (
|
|
118
|
-
const o = await fetch(
|
|
130
|
+
if (E.has(e)) return E.get(e);
|
|
131
|
+
const o = await fetch(oe({ collectionId: e }));
|
|
119
132
|
if (!o.ok) throw new Error(`Failed to fetch collection: ${o.statusText}`);
|
|
120
|
-
const
|
|
121
|
-
return
|
|
133
|
+
const i = await o.json();
|
|
134
|
+
return E.set(e, i), i;
|
|
122
135
|
} catch (o) {
|
|
123
|
-
console.error("Error fetching collection", o),
|
|
136
|
+
console.error("Error fetching collection", o), t.runCommand(y.toastAdd, ae());
|
|
124
137
|
return;
|
|
125
138
|
}
|
|
126
139
|
}
|
|
127
|
-
async function
|
|
140
|
+
async function ne({ collectionIds: e, editor: t }) {
|
|
128
141
|
try {
|
|
129
|
-
if (
|
|
130
|
-
const o =
|
|
131
|
-
if (!
|
|
132
|
-
return
|
|
142
|
+
if (L) return L;
|
|
143
|
+
const o = e ? `?prefixes=${e.join(",")}` : "", i = await fetch(`${te}/collections${o}`);
|
|
144
|
+
if (!i.ok) throw new Error(`Failed to fetch collections: ${i.statusText}`);
|
|
145
|
+
return L = await i.json(), L;
|
|
133
146
|
} catch (o) {
|
|
134
|
-
console.error("Error fetching collections", o),
|
|
147
|
+
console.error("Error fetching collections", o), t.runCommand(y.toastAdd, j());
|
|
135
148
|
return;
|
|
136
149
|
}
|
|
137
150
|
}
|
|
138
|
-
function
|
|
151
|
+
function R() {
|
|
139
152
|
return {
|
|
140
153
|
type: "button",
|
|
141
154
|
label: "Open Icon Picker",
|
|
142
155
|
name: "onActive",
|
|
143
156
|
changeProp: !0,
|
|
144
|
-
command(
|
|
145
|
-
var
|
|
146
|
-
(
|
|
157
|
+
command(e) {
|
|
158
|
+
var t;
|
|
159
|
+
(t = e.getSelected()) == null || t.trigger("active");
|
|
147
160
|
}
|
|
148
161
|
};
|
|
149
162
|
}
|
|
150
|
-
async function
|
|
151
|
-
const
|
|
152
|
-
if (!
|
|
153
|
-
const
|
|
154
|
-
o.components(n), o.set({ collectionId:
|
|
155
|
-
},
|
|
156
|
-
|
|
157
|
-
id:
|
|
163
|
+
async function se({ collectionIds: e, editor: t, component: o }) {
|
|
164
|
+
const i = await ne({ collectionIds: e, editor: t });
|
|
165
|
+
if (!i) return;
|
|
166
|
+
const l = ({ icon: n, collectionId: c, iconId: p }) => {
|
|
167
|
+
o.components(n), o.set({ collectionId: c, iconId: p });
|
|
168
|
+
}, 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;
|
|
169
|
+
t.runCommand(y.layoutToggle, {
|
|
170
|
+
id: $,
|
|
158
171
|
placer: { type: "dialog", size: "l", title: "Select Icon" },
|
|
159
172
|
header: !1,
|
|
160
173
|
layout: {
|
|
161
174
|
type: "column",
|
|
162
175
|
style: { height: 500, gap: 10 },
|
|
163
176
|
children: [
|
|
164
|
-
|
|
165
|
-
collectionsList:
|
|
166
|
-
collectionId:
|
|
167
|
-
editor:
|
|
168
|
-
handleClick:
|
|
177
|
+
re({
|
|
178
|
+
collectionsList: g,
|
|
179
|
+
collectionId: a,
|
|
180
|
+
editor: t,
|
|
181
|
+
handleClick: l
|
|
169
182
|
}),
|
|
170
|
-
{ id:
|
|
183
|
+
{ id: G, type: "column", grow: !0 }
|
|
171
184
|
]
|
|
172
185
|
}
|
|
173
186
|
});
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
editor:
|
|
177
|
-
collection:
|
|
178
|
-
handleClick:
|
|
179
|
-
collectionId:
|
|
187
|
+
const s = await N({ collectionId: a, editor: t });
|
|
188
|
+
s && (U({ editor: t, collection: s }), P({
|
|
189
|
+
editor: t,
|
|
190
|
+
collection: s,
|
|
191
|
+
handleClick: l,
|
|
192
|
+
collectionId: a
|
|
180
193
|
}));
|
|
181
194
|
}
|
|
182
|
-
function U({ editor:
|
|
183
|
-
|
|
195
|
+
function U({ editor: e, collection: t }) {
|
|
196
|
+
e.em.set(A, t);
|
|
184
197
|
}
|
|
185
|
-
function
|
|
186
|
-
return
|
|
198
|
+
function ie(e) {
|
|
199
|
+
return e.em.get(A);
|
|
187
200
|
}
|
|
188
|
-
function
|
|
189
|
-
const { editor:
|
|
190
|
-
|
|
191
|
-
id:
|
|
192
|
-
layout:
|
|
201
|
+
function P(e) {
|
|
202
|
+
const { editor: t } = e;
|
|
203
|
+
t.runCommand(y.layoutUpdate, {
|
|
204
|
+
id: ee,
|
|
205
|
+
layout: ce(e),
|
|
193
206
|
header: !1,
|
|
194
207
|
style: { height: "100%" },
|
|
195
|
-
placer: { type: "static", layoutId:
|
|
208
|
+
placer: { type: "static", layoutId: G }
|
|
196
209
|
});
|
|
197
210
|
}
|
|
198
|
-
function
|
|
199
|
-
const { collectionsList:
|
|
211
|
+
function re(e) {
|
|
212
|
+
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));
|
|
200
213
|
return {
|
|
201
214
|
type: "column",
|
|
202
215
|
style: { gap: 10 },
|
|
203
|
-
className: `${
|
|
216
|
+
className: `${M}__header`,
|
|
204
217
|
children: [
|
|
205
218
|
{
|
|
206
219
|
type: "selectField",
|
|
207
220
|
value: o,
|
|
208
|
-
options:
|
|
221
|
+
options: g,
|
|
209
222
|
emptyState: "Select an icon collection",
|
|
210
|
-
onChange: async ({ setState:
|
|
211
|
-
const n = await
|
|
212
|
-
n && (
|
|
213
|
-
editor:
|
|
223
|
+
onChange: async ({ setState: a, value: s }) => {
|
|
224
|
+
const n = await N({ collectionId: s, editor: i });
|
|
225
|
+
n && (a({ value: s }), U({ editor: i, collection: n }), P({
|
|
226
|
+
editor: i,
|
|
214
227
|
collection: n,
|
|
215
|
-
handleClick:
|
|
216
|
-
collectionId:
|
|
228
|
+
handleClick: l,
|
|
229
|
+
collectionId: s
|
|
217
230
|
}));
|
|
218
231
|
}
|
|
219
232
|
},
|
|
@@ -222,54 +235,54 @@ function rt(t) {
|
|
|
222
235
|
value: "",
|
|
223
236
|
placeholder: "Search icons inside collection...",
|
|
224
237
|
editorEvents: {
|
|
225
|
-
[`change:${
|
|
238
|
+
[`change:${A}`]: ({ setState: a }) => a({ value: "" })
|
|
226
239
|
},
|
|
227
|
-
onInput: ({ setState:
|
|
228
|
-
const
|
|
229
|
-
if (!
|
|
230
|
-
const
|
|
231
|
-
Object.entries(
|
|
240
|
+
onInput: ({ setState: a, value: s, editor: n }) => {
|
|
241
|
+
const c = ie(n);
|
|
242
|
+
if (!c) return;
|
|
243
|
+
const p = Object.fromEntries(
|
|
244
|
+
Object.entries(c.icons).filter(([r]) => r.includes(s))
|
|
232
245
|
);
|
|
233
|
-
|
|
246
|
+
a({ value: s }), P({
|
|
234
247
|
editor: n,
|
|
235
|
-
collection:
|
|
236
|
-
handleClick:
|
|
248
|
+
collection: c,
|
|
249
|
+
handleClick: l,
|
|
237
250
|
collectionId: o,
|
|
238
|
-
collectionFiltered: { ...
|
|
251
|
+
collectionFiltered: { ...c, icons: p }
|
|
239
252
|
});
|
|
240
253
|
}
|
|
241
254
|
}
|
|
242
255
|
]
|
|
243
256
|
};
|
|
244
257
|
}
|
|
245
|
-
function
|
|
246
|
-
collection:
|
|
247
|
-
collectionFiltered:
|
|
258
|
+
function ce({
|
|
259
|
+
collection: e,
|
|
260
|
+
collectionFiltered: t,
|
|
248
261
|
handleClick: o
|
|
249
262
|
}) {
|
|
250
|
-
const { height:
|
|
263
|
+
const { height: i = 24, width: l = 24, icons: g, prefix: a } = t || e, s = Object.entries(g).map(([n, c]) => ({ name: n, ...c }), {});
|
|
251
264
|
return {
|
|
252
265
|
type: "column",
|
|
253
|
-
className: `${
|
|
266
|
+
className: `${M}__content`,
|
|
254
267
|
style: { height: "100%" },
|
|
255
268
|
children: {
|
|
256
269
|
type: "virtualList",
|
|
257
|
-
items:
|
|
270
|
+
items: s,
|
|
258
271
|
itemLayout: ({ item: n }) => ({
|
|
259
272
|
type: "custom",
|
|
260
|
-
render: (
|
|
261
|
-
const { editor:
|
|
273
|
+
render: (c) => {
|
|
274
|
+
const { editor: p, addEl: r, removeEl: h } = c, u = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
262
275
|
u.setAttribute("xmlns", "http://www.w3.org/2000/svg"), u.innerHTML = n.body;
|
|
263
|
-
const d = n.width ||
|
|
276
|
+
const d = n.width || l, I = n.height || i;
|
|
264
277
|
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;";
|
|
265
|
-
const
|
|
278
|
+
const b = [
|
|
266
279
|
[
|
|
267
280
|
"click",
|
|
268
281
|
() => {
|
|
269
282
|
const f = u.cloneNode(!0);
|
|
270
283
|
f.removeAttribute("style");
|
|
271
|
-
const
|
|
272
|
-
o({ icon:
|
|
284
|
+
const v = f.outerHTML;
|
|
285
|
+
o({ icon: v, collectionId: a, iconId: n.name }), p == null || p.runCommand(y.layoutRemove, { id: $ });
|
|
273
286
|
}
|
|
274
287
|
],
|
|
275
288
|
[
|
|
@@ -285,8 +298,8 @@ function ct({
|
|
|
285
298
|
}
|
|
286
299
|
]
|
|
287
300
|
];
|
|
288
|
-
return
|
|
289
|
-
|
|
301
|
+
return b.forEach(([f, v]) => u.addEventListener(f, v)), r(u), () => {
|
|
302
|
+
b.forEach(([f, v]) => u.removeEventListener(f, v)), h(u);
|
|
290
303
|
};
|
|
291
304
|
}
|
|
292
305
|
})
|
|
@@ -298,46 +311,46 @@ function j() {
|
|
|
298
311
|
id: "toast-error-getCollections",
|
|
299
312
|
header: "Error",
|
|
300
313
|
content: "Error fetching collections",
|
|
301
|
-
variant:
|
|
314
|
+
variant: _.Error
|
|
302
315
|
};
|
|
303
316
|
}
|
|
304
|
-
function
|
|
317
|
+
function ae() {
|
|
305
318
|
return {
|
|
306
319
|
...j(),
|
|
307
320
|
id: "toast-error-getCollection",
|
|
308
321
|
content: "Error fetching collection"
|
|
309
322
|
};
|
|
310
323
|
}
|
|
311
|
-
const
|
|
324
|
+
const le = function(e, t = {}) {
|
|
312
325
|
var u;
|
|
313
|
-
const { Components: o, Blocks:
|
|
326
|
+
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 = {
|
|
314
327
|
events: () => ({
|
|
315
328
|
dblclick: "onActive"
|
|
316
329
|
}),
|
|
317
330
|
onActive() {
|
|
318
|
-
|
|
331
|
+
se({ collectionIds: l, editor: e, component: this.model });
|
|
319
332
|
}
|
|
320
333
|
};
|
|
321
|
-
if (o.addType(
|
|
322
|
-
block:
|
|
323
|
-
label:
|
|
324
|
-
media:
|
|
325
|
-
content: { type:
|
|
334
|
+
if (o.addType(c, {
|
|
335
|
+
block: s && {
|
|
336
|
+
label: p,
|
|
337
|
+
media: T,
|
|
338
|
+
content: { type: c },
|
|
326
339
|
category: "Extra",
|
|
327
340
|
activate: !0,
|
|
328
|
-
...
|
|
341
|
+
...s
|
|
329
342
|
},
|
|
330
|
-
isComponent: (d) =>
|
|
343
|
+
isComponent: (d) => X(d, r),
|
|
331
344
|
model: {
|
|
332
345
|
defaults: {
|
|
333
|
-
name:
|
|
334
|
-
icon:
|
|
346
|
+
name: p,
|
|
347
|
+
icon: T,
|
|
335
348
|
droppable: !1,
|
|
336
|
-
attributes: { [
|
|
349
|
+
attributes: { [r]: !0 },
|
|
337
350
|
resizable: S,
|
|
338
|
-
components:
|
|
351
|
+
components: T,
|
|
339
352
|
style: { width: "50px", height: "50px" },
|
|
340
|
-
traits: [
|
|
353
|
+
traits: [R()]
|
|
341
354
|
},
|
|
342
355
|
init() {
|
|
343
356
|
this.listenTo(this.components(), "change add", this.disableLayers), this.disableLayers();
|
|
@@ -346,28 +359,28 @@ const lt = function(t, e = {}) {
|
|
|
346
359
|
this.components().forEach((d) => d.set({ layerable: !1, locked: !0 }));
|
|
347
360
|
}
|
|
348
361
|
},
|
|
349
|
-
view:
|
|
350
|
-
}),
|
|
351
|
-
const d = (u = o.getType(n)) == null ? void 0 : u.model, [I,
|
|
362
|
+
view: h
|
|
363
|
+
}), g) {
|
|
364
|
+
const d = (u = o.getType(n)) == null ? void 0 : u.model, [I, b, ...f] = d.getDefaults().traits;
|
|
352
365
|
o.addType(n, {
|
|
353
366
|
model: {
|
|
354
367
|
defaults: {
|
|
355
|
-
traits: [I,
|
|
368
|
+
traits: [I, b, R(), ...f]
|
|
356
369
|
}
|
|
357
370
|
},
|
|
358
|
-
view:
|
|
371
|
+
view: h
|
|
359
372
|
});
|
|
360
373
|
}
|
|
361
|
-
|
|
362
|
-
editor:
|
|
363
|
-
licenseKey:
|
|
374
|
+
q({
|
|
375
|
+
editor: e,
|
|
376
|
+
licenseKey: a,
|
|
364
377
|
plan: Q,
|
|
365
|
-
pluginName:
|
|
378
|
+
pluginName: Z,
|
|
366
379
|
cleanup: () => {
|
|
367
|
-
|
|
380
|
+
i.remove(c), o.removeType(c);
|
|
368
381
|
}
|
|
369
382
|
});
|
|
370
|
-
},
|
|
383
|
+
}, ue = z(le);
|
|
371
384
|
export {
|
|
372
|
-
|
|
385
|
+
ue as default
|
|
373
386
|
};
|