@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.
Files changed (88) hide show
  1. package/dist/accordionComponent/index.cjs.js +7 -7
  2. package/dist/accordionComponent/index.es.js +175 -162
  3. package/dist/accordionComponent/index.umd.js +7 -7
  4. package/dist/aiChat/index.cjs.js +64 -64
  5. package/dist/aiChat/index.es.js +5785 -5757
  6. package/dist/aiChat/index.js +64 -64
  7. package/dist/aiChat/index.umd.js +63 -63
  8. package/dist/animationComponent/index.cjs.js +3 -3
  9. package/dist/animationComponent/index.es.js +204 -191
  10. package/dist/animationComponent/index.umd.js +3 -3
  11. package/dist/canvasAbsoluteMode/index.cjs.js +1 -1
  12. package/dist/canvasAbsoluteMode/index.es.js +183 -170
  13. package/dist/canvasAbsoluteMode/index.umd.js +1 -1
  14. package/dist/canvasEmptyState/index.cjs.js +1 -1
  15. package/dist/canvasEmptyState/index.es.js +134 -121
  16. package/dist/canvasEmptyState/index.umd.js +1 -1
  17. package/dist/canvasFullSize/index.cjs.js +9 -9
  18. package/dist/canvasFullSize/index.es.js +165 -152
  19. package/dist/canvasFullSize/index.umd.js +9 -9
  20. package/dist/canvasGridMode/index.cjs.js +5 -5
  21. package/dist/canvasGridMode/index.es.js +245 -232
  22. package/dist/canvasGridMode/index.umd.js +4 -4
  23. package/dist/canvasScreenshot/index.cjs.js +1 -1
  24. package/dist/canvasScreenshot/index.es.js +155 -142
  25. package/dist/canvasScreenshot/index.umd.js +1 -1
  26. package/dist/dataSourceEjs/index.cjs.js +9 -9
  27. package/dist/dataSourceEjs/index.es.js +257 -244
  28. package/dist/dataSourceEjs/index.umd.js +9 -9
  29. package/dist/dataSourceHandlebars/index.cjs.js +8 -8
  30. package/dist/dataSourceHandlebars/index.es.js +216 -203
  31. package/dist/dataSourceHandlebars/index.umd.js +7 -7
  32. package/dist/dialogComponent/index.cjs.js +14 -14
  33. package/dist/dialogComponent/index.es.js +141 -128
  34. package/dist/dialogComponent/index.umd.js +14 -14
  35. package/dist/flexComponent/index.cjs.js +13 -13
  36. package/dist/flexComponent/index.es.js +484 -471
  37. package/dist/flexComponent/index.umd.js +13 -13
  38. package/dist/fsLightboxComponent/index.cjs.js +3 -3
  39. package/dist/fsLightboxComponent/index.es.js +173 -160
  40. package/dist/fsLightboxComponent/index.umd.js +3 -3
  41. package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
  42. package/dist/googleFontsAssetProvider/index.es.js +160 -147
  43. package/dist/googleFontsAssetProvider/index.umd.js +1 -1
  44. package/dist/iconifyComponent/index.cjs.js +2 -2
  45. package/dist/iconifyComponent/index.es.js +196 -183
  46. package/dist/iconifyComponent/index.umd.js +2 -2
  47. package/dist/index.cjs.js +25 -25
  48. package/dist/index.es.js +121 -108
  49. package/dist/index.umd.js +18 -18
  50. package/dist/layoutSidebarButtons/index.cjs.js +1 -1
  51. package/dist/layoutSidebarButtons/index.es.js +157 -144
  52. package/dist/layoutSidebarButtons/index.umd.js +1 -1
  53. package/dist/lightGalleryComponent/index.cjs.js +1 -1
  54. package/dist/lightGalleryComponent/index.es.js +245 -232
  55. package/dist/lightGalleryComponent/index.umd.js +1 -1
  56. package/dist/linkImageComponent/index.cjs.js +2 -2
  57. package/dist/linkImageComponent/index.es.js +106 -93
  58. package/dist/linkImageComponent/index.umd.js +2 -2
  59. package/dist/listPagesComponent/index.cjs.js +5 -5
  60. package/dist/listPagesComponent/index.es.js +157 -144
  61. package/dist/listPagesComponent/index.umd.js +5 -5
  62. package/dist/presetPrintable/index.cjs.js +3 -3
  63. package/dist/presetPrintable/index.es.js +181 -168
  64. package/dist/presetPrintable/index.umd.js +3 -3
  65. package/dist/prosemirror/index.cjs.js +7 -7
  66. package/dist/prosemirror/index.es.js +385 -372
  67. package/dist/prosemirror/index.umd.js +8 -8
  68. package/dist/rendererReact/index.cjs.js +1 -1
  69. package/dist/rendererReact/index.es.js +200 -187
  70. package/dist/rendererReact/index.js +1 -1
  71. package/dist/rendererReact/index.umd.js +1 -1
  72. package/dist/rteTinyMce/index.cjs.js +2 -2
  73. package/dist/rteTinyMce/index.es.js +118 -105
  74. package/dist/rteTinyMce/index.umd.js +2 -2
  75. package/dist/shapeDividerComponent/index.cjs.js +4 -4
  76. package/dist/shapeDividerComponent/index.es.js +129 -116
  77. package/dist/shapeDividerComponent/index.umd.js +4 -4
  78. package/dist/swiperComponent/index.cjs.js +9 -9
  79. package/dist/swiperComponent/index.es.js +203 -190
  80. package/dist/swiperComponent/index.umd.js +7 -7
  81. package/dist/tableComponent/index.cjs.js +1 -1
  82. package/dist/tableComponent/index.es.js +257 -244
  83. package/dist/tableComponent/index.umd.js +1 -1
  84. package/dist/types.d.ts +1 -1
  85. package/dist/youtubeAssetProvider/index.cjs.js +1 -1
  86. package/dist/youtubeAssetProvider/index.es.js +121 -108
  87. package/dist/youtubeAssetProvider/index.umd.js +1 -1
  88. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
- const D = "app.grapesjs.com", $ = "app-stage.grapesjs.com", B = "app2.grapesjs.com", H = "app-stage2.grapesjs.com", O = [
2
- D,
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:start", W = "license:check:end", C = () => typeof window < "u", K = ({
15
- isDev: t,
16
- isStage: e,
14
+ ], F = "license:check:end", C = () => typeof window < "u", W = ({
15
+ isDev: e,
16
+ isStage: t,
17
17
  isPlatform: o
18
- }) => `${t ? "" : `https://${e ? $ : D}`}/${o ? "platform-api" : "api"}`, V = () => {
19
- const t = C() && window.location.hostname;
20
- return !!t && (O.includes(t) || O.some((e) => t.endsWith(e)));
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 Y({
23
- path: t,
24
- baseApiUrl: e,
22
+ async function V({
23
+ path: e,
24
+ baseApiUrl: t,
25
25
  method: o = "GET",
26
- headers: s = {},
27
- params: a,
28
- body: p
26
+ headers: i = {},
27
+ params: l,
28
+ body: g
29
29
  }) {
30
- const c = `${e || K({ isDev: !1, isStage: !1 })}${t}`, n = {
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
- ...s
34
+ ...i
35
35
  }
36
36
  };
37
- p && (n.body = JSON.stringify(p));
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();
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 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.dialogImportCode = "studio:dialogImportCode", 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 || {});
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
- [v.free]: 0,
46
- [v.startup]: 10,
47
- [v.business]: 20,
48
- [v.enterprise]: 30
45
+ [w.free]: 0,
46
+ [w.startup]: 10,
47
+ [w.business]: 20,
48
+ [w.enterprise]: 30
49
49
  };
50
- function z(t) {
51
- const e = t;
52
- return e.init = (o) => (s) => t(s, o), e;
50
+ function Y(e) {
51
+ const t = e;
52
+ return t.init = (o) => (i) => e(i, o), t;
53
53
  }
54
- const q = (t) => /* @__PURE__ */ z(t);
55
- async function J({
56
- editor: t,
57
- plan: e,
54
+ const z = (e) => /* @__PURE__ */ Y(e);
55
+ async function q({
56
+ editor: e,
57
+ plan: t,
58
58
  pluginName: o,
59
- licenseKey: s,
60
- onLicenseCheckResponse: a,
61
- cleanup: p
59
+ licenseKey: i,
60
+ onLicenseCheckResponse: l,
61
+ cleanup: g
62
62
  }) {
63
- let l = "", c = !1;
64
- const n = V(), r = (i) => {
65
- console.warn("Cleanup plugin:", o, "Reason:", i), p();
66
- }, g = (i = {}) => {
67
- var h;
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");
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[e], b = x[d];
73
- f > b && r({ pluginRequiredPlan: e, licensePlan: d });
72
+ const f = x[t], v = x[d];
73
+ f > v && n({ pluginRequiredPlan: t, licensePlan: d });
74
74
  }
75
75
  };
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);
80
- }), setTimeout(async () => {
81
- if (!c) {
82
- if (n) return;
83
- if (s) {
84
- const i = await X({ licenseKey: s, pluginName: o, baseApiUrl: l });
85
- a == null || a(i), i && g(i);
86
- } else
87
- r("The `licenseKey` option not provided");
88
- }
89
- }, 2e3);
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
- async function X(t) {
92
- const { licenseKey: e, pluginName: o, baseApiUrl: s } = t;
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 Y({
95
- baseApiUrl: s,
96
- path: `/sdk/${e || "na"}`,
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 (a) {
104
- return console.error("Error during SDK license check:", a), !1;
116
+ } catch (l) {
117
+ return console.error("Error during SDK license check:", l), !1;
105
118
  }
106
119
  }
107
- const Z = (t, e) => {
120
+ const X = (e, t) => {
108
121
  var o;
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">
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>`, 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 T;
114
- const ot = ({ collectionId: t }) => `https://cdn.jsdelivr.net/npm/@iconify-json/${t}@latest/icons.json`;
115
- async function R({ collectionId: t, editor: e }) {
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 (A.has(t)) return A.get(t);
118
- const o = await fetch(ot({ collectionId: t }));
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 s = await o.json();
121
- return A.set(t, s), s;
133
+ const i = await o.json();
134
+ return E.set(e, i), i;
122
135
  } catch (o) {
123
- console.error("Error fetching collection", o), e.runCommand(w.toastAdd, at());
136
+ console.error("Error fetching collection", o), t.runCommand(y.toastAdd, ae());
124
137
  return;
125
138
  }
126
139
  }
127
- async function nt({ collectionIds: t, editor: e }) {
140
+ async function ne({ collectionIds: e, editor: t }) {
128
141
  try {
129
- if (T) return T;
130
- const o = t ? `?prefixes=${t.join(",")}` : "", s = await fetch(`${et}/collections${o}`);
131
- if (!s.ok) throw new Error(`Failed to fetch collections: ${s.statusText}`);
132
- return T = await s.json(), T;
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), e.runCommand(w.toastAdd, j());
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(t) {
145
- var e;
146
- (e = t.getSelected()) == null || e.trigger("active");
157
+ command(e) {
158
+ var t;
159
+ (t = e.getSelected()) == null || t.trigger("active");
147
160
  }
148
161
  };
149
162
  }
150
- async function st({ collectionIds: t, editor: e, component: o }) {
151
- const s = await nt({ collectionIds: t, editor: e });
152
- if (!s) return;
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,
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
- rt({
165
- collectionsList: p,
166
- collectionId: l,
167
- editor: e,
168
- handleClick: a
177
+ re({
178
+ collectionsList: g,
179
+ collectionId: a,
180
+ editor: t,
181
+ handleClick: l
169
182
  }),
170
- { id: M, type: "column", grow: !0 }
183
+ { id: G, type: "column", grow: !0 }
171
184
  ]
172
185
  }
173
186
  });
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
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: t, collection: e }) {
183
- t.em.set(P, e);
195
+ function U({ editor: e, collection: t }) {
196
+ e.em.set(A, t);
184
197
  }
185
- function it(t) {
186
- return t.em.get(P);
198
+ function ie(e) {
199
+ return e.em.get(A);
187
200
  }
188
- function L(t) {
189
- const { editor: e } = t;
190
- e.runCommand(w.layoutUpdate, {
191
- id: tt,
192
- layout: ct(t),
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: M }
208
+ placer: { type: "static", layoutId: G }
196
209
  });
197
210
  }
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));
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: `${N}__header`,
216
+ className: `${M}__header`,
204
217
  children: [
205
218
  {
206
219
  type: "selectField",
207
220
  value: o,
208
- options: p,
221
+ options: g,
209
222
  emptyState: "Select an icon collection",
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({
213
- editor: s,
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: a,
216
- collectionId: c
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:${P}`]: ({ setState: l }) => l({ value: "" })
238
+ [`change:${A}`]: ({ setState: a }) => a({ value: "" })
226
239
  },
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))
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
- l({ value: c }), L({
246
+ a({ value: s }), P({
234
247
  editor: n,
235
- collection: r,
236
- handleClick: a,
248
+ collection: c,
249
+ handleClick: l,
237
250
  collectionId: o,
238
- collectionFiltered: { ...r, icons: g }
251
+ collectionFiltered: { ...c, icons: p }
239
252
  });
240
253
  }
241
254
  }
242
255
  ]
243
256
  };
244
257
  }
245
- function ct({
246
- collection: t,
247
- collectionFiltered: e,
258
+ function ce({
259
+ collection: e,
260
+ collectionFiltered: t,
248
261
  handleClick: o
249
262
  }) {
250
- const { height: s = 24, width: a = 24, icons: p, prefix: l } = e || t, c = Object.entries(p).map(([n, r]) => ({ name: n, ...r }), {});
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: `${N}__content`,
266
+ className: `${M}__content`,
254
267
  style: { height: "100%" },
255
268
  children: {
256
269
  type: "virtualList",
257
- items: c,
270
+ items: s,
258
271
  itemLayout: ({ item: n }) => ({
259
272
  type: "custom",
260
- render: (r) => {
261
- const { editor: g, addEl: i, removeEl: y } = r, u = document.createElementNS("http://www.w3.org/2000/svg", "svg");
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 || a, I = n.height || s;
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 h = [
278
+ const b = [
266
279
  [
267
280
  "click",
268
281
  () => {
269
282
  const f = u.cloneNode(!0);
270
283
  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 });
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 h.forEach(([f, b]) => u.addEventListener(f, b)), i(u), () => {
289
- h.forEach(([f, b]) => u.removeEventListener(f, b)), y(u);
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: k.Error
314
+ variant: _.Error
302
315
  };
303
316
  }
304
- function at() {
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 lt = function(t, e = {}) {
324
+ const le = function(e, t = {}) {
312
325
  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 = {
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
- st({ collectionIds: a, editor: t, component: this.model });
331
+ se({ collectionIds: l, editor: e, component: this.model });
319
332
  }
320
333
  };
321
- if (o.addType(r, {
322
- block: c && {
323
- label: g,
324
- media: E,
325
- content: { type: r },
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
- ...c
341
+ ...s
329
342
  },
330
- isComponent: (d) => Z(d, i),
343
+ isComponent: (d) => X(d, r),
331
344
  model: {
332
345
  defaults: {
333
- name: g,
334
- icon: E,
346
+ name: p,
347
+ icon: T,
335
348
  droppable: !1,
336
- attributes: { [i]: !0 },
349
+ attributes: { [r]: !0 },
337
350
  resizable: S,
338
- components: E,
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: y
350
- }), p) {
351
- const d = (u = o.getType(n)) == null ? void 0 : u.model, [I, h, ...f] = d.getDefaults().traits;
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, h, _(), ...f]
368
+ traits: [I, b, R(), ...f]
356
369
  }
357
370
  },
358
- view: y
371
+ view: h
359
372
  });
360
373
  }
361
- J({
362
- editor: t,
363
- licenseKey: l,
374
+ q({
375
+ editor: e,
376
+ licenseKey: a,
364
377
  plan: Q,
365
- pluginName: m,
378
+ pluginName: Z,
366
379
  cleanup: () => {
367
- s.remove(r), o.removeType(r);
380
+ i.remove(c), o.removeType(c);
368
381
  }
369
382
  });
370
- }, ut = q(lt);
383
+ }, ue = z(le);
371
384
  export {
372
- ut as default
385
+ ue as default
373
386
  };