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