@grapesjs/studio-sdk-plugins 1.0.15 → 1.0.16

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 (66) hide show
  1. package/dist/accordionComponent/index.cjs.js +3 -3
  2. package/dist/accordionComponent/index.es.js +29 -30
  3. package/dist/accordionComponent/index.umd.js +4 -4
  4. package/dist/canvasEmptyState/index.cjs.js +1 -1
  5. package/dist/canvasEmptyState/index.es.js +14 -15
  6. package/dist/canvasEmptyState/index.umd.js +1 -1
  7. package/dist/canvasFullSize/index.cjs.d.ts +2 -2
  8. package/dist/canvasFullSize/index.cjs.js +1 -1
  9. package/dist/canvasFullSize/index.d.ts +2 -2
  10. package/dist/canvasFullSize/index.es.d.ts +2 -2
  11. package/dist/canvasFullSize/index.es.js +2 -3
  12. package/dist/canvasFullSize/index.umd.js +2 -2
  13. package/dist/canvasFullSize/types.d.ts +1 -1
  14. package/dist/dialogComponent/index.cjs.js +2 -2
  15. package/dist/dialogComponent/index.es.js +2 -3
  16. package/dist/dialogComponent/index.umd.js +2 -2
  17. package/dist/flexComponent/index.cjs.js +1 -1
  18. package/dist/flexComponent/index.es.js +2 -3
  19. package/dist/flexComponent/index.umd.js +1 -1
  20. package/dist/fsLightboxComponent/index.cjs.js +2 -2
  21. package/dist/fsLightboxComponent/index.es.js +2 -3
  22. package/dist/fsLightboxComponent/index.umd.js +2 -2
  23. package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
  24. package/dist/googleFontsAssetProvider/index.es.js +39 -40
  25. package/dist/googleFontsAssetProvider/index.umd.js +1 -1
  26. package/dist/iconifyComponent/index.cjs.js +2 -2
  27. package/dist/iconifyComponent/index.es.js +31 -32
  28. package/dist/iconifyComponent/index.umd.js +2 -2
  29. package/dist/index.cjs.d.ts +1 -0
  30. package/dist/index.cjs.js +42 -42
  31. package/dist/index.d.ts +1 -0
  32. package/dist/index.es.d.ts +1 -0
  33. package/dist/index.es.js +3171 -2944
  34. package/dist/index.umd.js +36 -36
  35. package/dist/layoutSidebarButtons/index.cjs.d.ts +3 -0
  36. package/dist/layoutSidebarButtons/index.cjs.js +1 -0
  37. package/dist/layoutSidebarButtons/index.d.ts +3 -0
  38. package/dist/layoutSidebarButtons/index.es.d.ts +3 -0
  39. package/dist/layoutSidebarButtons/index.es.js +328 -0
  40. package/dist/layoutSidebarButtons/index.umd.js +1 -0
  41. package/dist/layoutSidebarButtons/layout.d.ts +8 -0
  42. package/dist/layoutSidebarButtons/types.d.ts +75 -0
  43. package/dist/layoutSidebarButtons/typesSchema.d.ts +49 -0
  44. package/dist/lightGalleryComponent/index.cjs.js +1 -1
  45. package/dist/lightGalleryComponent/index.es.js +2 -3
  46. package/dist/lightGalleryComponent/index.umd.js +1 -1
  47. package/dist/listPagesComponent/index.cjs.js +3 -3
  48. package/dist/listPagesComponent/index.es.js +2 -3
  49. package/dist/listPagesComponent/index.umd.js +3 -3
  50. package/dist/prosemirror/index.cjs.js +2 -2
  51. package/dist/prosemirror/index.es.js +3 -4
  52. package/dist/prosemirror/index.umd.js +2 -2
  53. package/dist/rteTinyMce/index.cjs.js +1 -1
  54. package/dist/rteTinyMce/index.es.js +20 -21
  55. package/dist/rteTinyMce/index.umd.js +1 -1
  56. package/dist/swiperComponent/index.cjs.js +3 -3
  57. package/dist/swiperComponent/index.es.js +2 -3
  58. package/dist/swiperComponent/index.umd.js +3 -3
  59. package/dist/tableComponent/index.cjs.js +1 -1
  60. package/dist/tableComponent/index.es.js +13 -14
  61. package/dist/tableComponent/index.umd.js +1 -1
  62. package/dist/types.d.ts +4 -3
  63. package/dist/youtubeAssetProvider/index.cjs.js +1 -1
  64. package/dist/youtubeAssetProvider/index.es.js +7 -8
  65. package/dist/youtubeAssetProvider/index.umd.js +1 -1
  66. package/package.json +1 -1
@@ -1,11 +1,10 @@
1
- import "grapesjs";
2
- var L = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(L || {}), m = /* @__PURE__ */ ((e) => (e.Info = "info", e.Error = "error", e.Success = "success", e.Warning = "warning", e))(m || {}), f = /* @__PURE__ */ ((e) => (e.toastAdd = "studio:toastAdd", e.dialogOpen = "studio:dialogOpen", e.dialogClose = "studio:dialogClose", 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.projectFiles = "studio:projectFiles", 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.getStateTheme = "studio:getStateTheme", e.setStateTheme = "studio:setStateTheme", e.assetProviderGet = "studio:assetProviderGet", e.assetProviderAdd = "studio:assetProviderAdd", e.assetProviderRemove = "studio:assetProviderRemove", e.fontGet = "studio:fontGet", e.fontAdd = "studio:fontAdd", e.fontRemove = "studio:fontRemove", e))(f || {});
1
+ var L = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(L || {}), x = /* @__PURE__ */ ((e) => (e.Info = "info", e.Error = "error", e.Success = "success", e.Warning = "warning", e))(x || {}), f = /* @__PURE__ */ ((e) => (e.toastAdd = "studio:toastAdd", e.dialogOpen = "studio:dialogOpen", e.dialogClose = "studio:dialogClose", 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.projectFiles = "studio:projectFiles", 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.getStateTheme = "studio:getStateTheme", e.setStateTheme = "studio:setStateTheme", e.assetProviderGet = "studio:assetProviderGet", e.assetProviderAdd = "studio:assetProviderAdd", e.assetProviderRemove = "studio:assetProviderRemove", e.fontGet = "studio:fontGet", e.fontAdd = "studio:fontAdd", e.fontRemove = "studio:fontRemove", e))(f || {});
3
2
  const j = { ratioDefault: !0, tc: !1, cl: !1, cr: !1, bc: !1 }, w = `<svg viewBox="0 0 24 24">
4
3
  <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" />
5
- </svg>`, x = "layout-icon-picker", H = "icons-layout-", R = "icons-list-layout", _ = "gs-iconify-picker", A = "__iconify_collection", B = "https://api.iconify.design", I = /* @__PURE__ */ new Map();
4
+ </svg>`, R = "layout-icon-picker", H = "icons-layout-", _ = "icons-list-layout", $ = "gs-iconify-picker", A = "__iconify_collection", B = "https://api.iconify.design", I = /* @__PURE__ */ new Map();
6
5
  let T;
7
6
  const D = ({ collectionId: e }) => `https://cdn.jsdelivr.net/npm/@iconify-json/${e}@latest/icons.json`;
8
- async function $({ collectionId: e, editor: o }) {
7
+ async function m({ collectionId: e, editor: o }) {
9
8
  try {
10
9
  if (I.has(e)) return I.get(e);
11
10
  const t = await fetch(D({ collectionId: e }));
@@ -47,7 +46,7 @@ async function W({ collectionIds: e, editor: o, component: t }) {
47
46
  t.components(s), t.set({ collectionId: c, iconId: i });
48
47
  }, d = Object.entries(n).map(([s, c]) => ({ id: s, ...c })).sort((s, c) => s.name.localeCompare(c.name)), u = t.get("collectionId") ?? d[0].id;
49
48
  o.runCommand(f.layoutToggle, {
50
- id: x,
49
+ id: R,
51
50
  placer: { type: "dialog", size: "l", title: "Select Icon" },
52
51
  header: !1,
53
52
  layout: {
@@ -60,11 +59,11 @@ async function W({ collectionIds: e, editor: o, component: t }) {
60
59
  editor: o,
61
60
  handleClick: a
62
61
  }),
63
- { id: R, type: "column", grow: !0 }
62
+ { id: _, type: "column", grow: !0 }
64
63
  ]
65
64
  }
66
65
  });
67
- const r = await $({ collectionId: u, editor: o });
66
+ const r = await m({ collectionId: u, editor: o });
68
67
  r && E({
69
68
  editor: o,
70
69
  collection: r,
@@ -84,7 +83,7 @@ function E(e) {
84
83
  layout: Y(e),
85
84
  header: !1,
86
85
  style: { height: "100%" },
87
- placer: { type: "static", layoutId: R }
86
+ placer: { type: "static", layoutId: _ }
88
87
  };
89
88
  o.runCommand(f.layoutRemove, { id: t.id, force: !0 }), setTimeout(() => o.runCommand(f.layoutAdd, t), 10);
90
89
  }
@@ -93,7 +92,7 @@ function V(e) {
93
92
  return {
94
93
  type: "column",
95
94
  style: { gap: 10 },
96
- className: `${_}__header`,
95
+ className: `${$}__header`,
97
96
  children: [
98
97
  {
99
98
  type: "selectField",
@@ -101,7 +100,7 @@ function V(e) {
101
100
  options: d,
102
101
  emptyState: "Select an icon collection",
103
102
  onChange: async ({ setState: u, value: r }) => {
104
- const s = await $({ collectionId: r, editor: n });
103
+ const s = await m({ collectionId: r, editor: n });
105
104
  s && (u({ value: r }), F({ editor: n, collection: s }), E({
106
105
  editor: n,
107
106
  collection: s,
@@ -121,7 +120,7 @@ function V(e) {
121
120
  const c = K(s);
122
121
  if (!c) return;
123
122
  const i = Object.fromEntries(
124
- Object.entries(c.icons).filter(([p]) => p.includes(r))
123
+ Object.entries(c.icons).filter(([g]) => g.includes(r))
125
124
  );
126
125
  u({ value: r }), E({
127
126
  editor: s,
@@ -143,7 +142,7 @@ function Y({
143
142
  const { height: n = 24, width: a = 24, icons: d, prefix: u } = o || e, r = Object.entries(d).map(([s, { body: c }]) => ({ name: s, body: c }), {});
144
143
  return {
145
144
  type: "column",
146
- className: `${_}__content`,
145
+ className: `${$}__content`,
147
146
  style: { height: "100%" },
148
147
  children: {
149
148
  type: "virtualList",
@@ -152,10 +151,10 @@ function Y({
152
151
  {
153
152
  type: "custom",
154
153
  render: (c) => {
155
- const { editor: i, addEl: p, removeEl: h } = c, l = document.createElementNS("http://www.w3.org/2000/svg", "svg");
154
+ const { editor: i, addEl: g, removeEl: h } = c, l = document.createElementNS("http://www.w3.org/2000/svg", "svg");
156
155
  l.setAttribute("xmlns", "http://www.w3.org/2000/svg"), l.innerHTML = s.body, l.setAttribute("viewBox", `0 0 ${a} ${n}`);
157
- const { cssWidth: g, cssHeight: y } = z(a, n);
158
- l.style.cssText = `width: ${g}px; height: ${y}px; cursor: pointer;`, l.addEventListener("mouseover", () => {
156
+ const { cssWidth: p, cssHeight: y } = z(a, n);
157
+ l.style.cssText = `width: ${p}px; height: ${y}px; cursor: pointer;`, l.addEventListener("mouseover", () => {
159
158
  l.style.border = "2px solid currentColor", l.style.borderRadius = "4px", l.style.padding = "4px";
160
159
  }), l.addEventListener("mouseout", () => {
161
160
  l.style.border = "none";
@@ -164,9 +163,9 @@ function Y({
164
163
  const v = l.cloneNode(!0);
165
164
  v.removeAttribute("style");
166
165
  const N = v.outerHTML;
167
- t({ icon: N, collectionId: u, iconId: s.name }), i == null || i.runCommand(f.layoutRemove, { id: x });
166
+ t({ icon: N, collectionId: u, iconId: s.name }), i == null || i.runCommand(f.layoutRemove, { id: R });
168
167
  };
169
- return l.addEventListener("click", b), p(l), () => {
168
+ return l.addEventListener("click", b), g(l), () => {
170
169
  l.removeEventListener("click", b), h(l);
171
170
  };
172
171
  }
@@ -185,7 +184,7 @@ function C() {
185
184
  id: "toast-error-getCollections",
186
185
  header: "Error",
187
186
  content: "Error fetching collections",
188
- variant: m.Error
187
+ variant: x.Error
189
188
  };
190
189
  }
191
190
  function q() {
@@ -226,10 +225,10 @@ async function ee({
226
225
  }
227
226
  };
228
227
  d && (s.body = JSON.stringify(d));
229
- const c = a ? new URLSearchParams(a).toString() : "", i = c ? `?${c}` : "", p = await fetch(`${r}${i}`, s);
230
- if (!p.ok)
231
- throw new Error(`HTTP error! status: ${p.status}`);
232
- return p.json();
228
+ const c = a ? new URLSearchParams(a).toString() : "", i = c ? `?${c}` : "", g = await fetch(`${r}${i}`, s);
229
+ if (!g.ok)
230
+ throw new Error(`HTTP error! status: ${g.status}`);
231
+ return g.json();
233
232
  }
234
233
  const O = {
235
234
  [L.free]: 0,
@@ -254,9 +253,9 @@ async function ne({
254
253
  console.warn("Cleanup plugin:", t, "Reason:", i), a();
255
254
  }, c = (i = {}) => {
256
255
  var y;
257
- const { error: p, sdkLicense: h } = i, l = (y = i.plan) == null ? void 0 : y.category;
258
- if (!(h || i.license) || p)
259
- s(p || "Invalid license");
256
+ const { error: g, sdkLicense: h } = i, l = (y = i.plan) == null ? void 0 : y.category;
257
+ if (!(h || i.license) || g)
258
+ s(g || "Invalid license");
260
259
  else if (l) {
261
260
  const b = O[o], v = O[l];
262
261
  b > v && s({ pluginRequiredPlan: o, licensePlan: l });
@@ -298,7 +297,7 @@ const ie = (e, o) => {
298
297
  return !!((t = e == null ? void 0 : e.hasAttribute) != null && t.call(e, o));
299
298
  }, ce = "iconifyComponent", re = function(e, o = {}) {
300
299
  var l;
301
- const { Components: t, Blocks: n } = e, { collections: a, extendIconComponent: d = !0, licenseKey: u, block: r = {} } = o, s = "icon", c = "iconify", i = "Iconify", p = "data-type-iconify", h = {
300
+ const { Components: t, Blocks: n } = e, { collections: a, extendIconComponent: d = !0, licenseKey: u, block: r = {} } = o, s = "icon", c = "iconify", i = "Iconify", g = "data-type-iconify", h = {
302
301
  events: () => ({
303
302
  dblclick: "onActive"
304
303
  }),
@@ -315,13 +314,13 @@ const ie = (e, o) => {
315
314
  activate: !0,
316
315
  ...r
317
316
  },
318
- isComponent: (g) => ie(g, p),
317
+ isComponent: (p) => ie(p, g),
319
318
  model: {
320
319
  defaults: {
321
320
  name: i,
322
321
  icon: w,
323
322
  droppable: !1,
324
- attributes: { [p]: !0 },
323
+ attributes: { [g]: !0 },
325
324
  resizable: j,
326
325
  components: w,
327
326
  style: { width: "50px", height: "50px" },
@@ -331,12 +330,12 @@ const ie = (e, o) => {
331
330
  this.listenTo(this.components(), "change add", this.disableLayers), this.disableLayers();
332
331
  },
333
332
  disableLayers() {
334
- this.components().forEach((g) => g.set({ layerable: !1, locked: !0 }));
333
+ this.components().forEach((p) => p.set({ layerable: !1, locked: !0 }));
335
334
  }
336
335
  },
337
336
  view: h
338
337
  }), d) {
339
- const g = (l = t.getType(s)) == null ? void 0 : l.model, [y, b, ...v] = g.getDefaults().traits;
338
+ const p = (l = t.getType(s)) == null ? void 0 : l.model, [y, b, ...v] = p.getDefaults().traits;
340
339
  t.addType(s, {
341
340
  model: {
342
341
  defaults: {
@@ -355,7 +354,7 @@ const ie = (e, o) => {
355
354
  n.remove(c), t.removeType(c);
356
355
  }
357
356
  });
358
- }, ae = oe(re);
357
+ }, le = oe(re);
359
358
  export {
360
- ae as default
359
+ le as default
361
360
  };
@@ -1,3 +1,3 @@
1
- (function(g,y){typeof exports=="object"&&typeof module<"u"?module.exports=y(require("grapesjs")):typeof define=="function"&&define.amd?define(["grapesjs"],y):(g=typeof globalThis<"u"?globalThis:g||self,g.StudioSdkPlugins_iconifyComponent=y())})(this,function(){"use strict";var g=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(g||{}),y=(e=>(e.Info="info",e.Error="error",e.Success="success",e.Warning="warning",e))(y||{}),h=(e=>(e.toastAdd="studio:toastAdd",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",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.projectFiles="studio:projectFiles",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.getStateTheme="studio:getStateTheme",e.setStateTheme="studio:setStateTheme",e.assetProviderGet="studio:assetProviderGet",e.assetProviderAdd="studio:assetProviderAdd",e.assetProviderRemove="studio:assetProviderRemove",e.fontGet="studio:fontGet",e.fontAdd="studio:fontAdd",e.fontRemove="studio:fontRemove",e))(h||{});const M={ratioDefault:!0,tc:!1,cl:!1,cr:!1,bc:!1},I=`<svg viewBox="0 0 24 24">
1
+ (function(g,y){typeof exports=="object"&&typeof module<"u"?module.exports=y():typeof define=="function"&&define.amd?define(y):(g=typeof globalThis<"u"?globalThis:g||self,g.StudioSdkPlugins_iconifyComponent=y())})(this,function(){"use strict";var g=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(g||{}),y=(e=>(e.Info="info",e.Error="error",e.Success="success",e.Warning="warning",e))(y||{}),h=(e=>(e.toastAdd="studio:toastAdd",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",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.projectFiles="studio:projectFiles",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.getStateTheme="studio:getStateTheme",e.setStateTheme="studio:setStateTheme",e.assetProviderGet="studio:assetProviderGet",e.assetProviderAdd="studio:assetProviderAdd",e.assetProviderRemove="studio:assetProviderRemove",e.fontGet="studio:fontGet",e.fontAdd="studio:fontAdd",e.fontRemove="studio:fontRemove",e))(h||{});const M={ratioDefault:!0,tc:!1,cl:!1,cr:!1,bc:!1},I=`<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>`,k="layout-icon-picker",N="icons-layout-",m="icons-list-layout",x="gs-iconify-picker",E="__iconify_collection",H="https://api.iconify.design",A=new Map;let w;const B=({collectionId:e})=>`https://cdn.jsdelivr.net/npm/@iconify-json/${e}@latest/icons.json`;async function O({collectionId:e,editor:o}){try{if(A.has(e))return A.get(e);const t=await fetch(B({collectionId:e}));if(!t.ok)throw new Error(`Failed to fetch collection: ${t.statusText}`);const n=await t.json();return A.set(e,n),n}catch(t){console.error("Error fetching collection",t),o.runCommand(h.toastAdd,q());return}}async function D({collectionIds:e,editor:o}){try{if(w)return w;const t=e?`?prefixes=${e.join(",")}`:"",n=await fetch(`${H}/collections${t}`);if(!n.ok)throw new Error(`Failed to fetch collections: ${n.statusText}`);return w=await n.json(),w}catch(t){console.error("Error fetching collections",t),o.runCommand(h.toastAdd,_());return}}function R(){return{type:"button",label:"Open Icon Picker",name:"onActive",changeProp:!0,command(e){var o;(o=e.getSelected())==null||o.trigger("active")}}}async function G({collectionIds:e,editor:o,component:t}){const n=await D({collectionIds:e,editor:o});if(!n)return;const a=({icon:s,collectionId:c,iconId:i})=>{t.components(s),t.set({collectionId:c,iconId:i})},d=Object.entries(n).map(([s,c])=>({id:s,...c})).sort((s,c)=>s.name.localeCompare(c.name)),u=t.get("collectionId")??d[0].id;o.runCommand(h.layoutToggle,{id:k,placer:{type:"dialog",size:"l",title:"Select Icon"},header:!1,layout:{type:"column",style:{height:500,gap:10},children:[K({collectionsList:d,collectionId:u,editor:o,handleClick:a}),{id:m,type:"column",grow:!0}]}});const r=await O({collectionId:u,editor:o});r&&P({editor:o,collection:r,handleClick:a,collectionId:u})}function W({editor:e,collection:o}){e.em.set(E,o)}function F(e){return e.em.get(E)}function P(e){const{editor:o}=e,t={id:N,layout:V(e),header:!1,style:{height:"100%"},placer:{type:"static",layoutId:m}};o.runCommand(h.layoutRemove,{id:t.id,force:!0}),setTimeout(()=>o.runCommand(h.layoutAdd,t),10)}function K(e){const{collectionsList:o,collectionId:t,editor:n,handleClick:a}=e,d=o.map(({id:u,name:r,total:s})=>({id:u,label:`${r} (${s})`})).sort((u,r)=>u.label.localeCompare(r.label));return{type:"column",style:{gap:10},className:`${x}__header`,children:[{type:"selectField",value:t,options:d,emptyState:"Select an icon collection",onChange:async({setState:u,value:r})=>{const s=await O({collectionId:r,editor:n});s&&(u({value:r}),W({editor:n,collection:s}),P({editor:n,collection:s,handleClick:a,collectionId:r}))}},{type:"inputField",value:"",placeholder:"Search icons inside collection...",editorEvents:{[`change:${E}`]:({setState:u})=>u({value:""})},onInput:({setState:u,value:r,editor:s})=>{const c=F(s);if(!c)return;const i=Object.fromEntries(Object.entries(c.icons).filter(([p])=>p.includes(r)));u({value:r}),P({editor:s,collection:c,handleClick:a,collectionId:r,collectionFiltered:{...c,icons:i}})}}]}}function V({collection:e,collectionFiltered:o,handleClick:t}){const{height:n=24,width:a=24,icons:d,prefix:u}=o||e,r=Object.entries(d).map(([s,{body:c}])=>({name:s,body:c}),{});return{type:"column",className:`${x}__content`,style:{height:"100%"},children:{type:"virtualList",items:r,itemLayout:({item:s})=>[{type:"custom",render:c=>{const{editor:i,addEl:p,removeEl:b}=c,l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.setAttribute("xmlns","http://www.w3.org/2000/svg"),l.innerHTML=s.body,l.setAttribute("viewBox",`0 0 ${a} ${n}`);const{cssWidth:f,cssHeight:v}=Y(a,n);l.style.cssText=`width: ${f}px; height: ${v}px; cursor: pointer;`,l.addEventListener("mouseover",()=>{l.style.border="2px solid currentColor",l.style.borderRadius="4px",l.style.padding="4px"}),l.addEventListener("mouseout",()=>{l.style.border="none"});const T=()=>{const L=l.cloneNode(!0);L.removeAttribute("style");const ce=L.outerHTML;t({icon:ce,collectionId:u,iconId:s.name}),i==null||i.runCommand(h.layoutRemove,{id:k})};return l.addEventListener("click",T),p(l),()=>{l.removeEventListener("click",T),b(l)}}}]}}}function Y(e,o){const t=e/o;let n=48,a=48;return t>1?a=48/t:t<1&&(n=48*t),{cssWidth:n,cssHeight:a}}function _(){return{id:"toast-error-getCollections",header:"Error",content:"Error fetching collections",variant:y.Error}}function q(){return{..._(),id:"toast-error-getCollection",content:"Error fetching collection"}}const $="app.grapesjs.com",C="app-stage.grapesjs.com",j=[$,C,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],z="license:check:start",J="license:check:end",X=()=>typeof window<"u",Z=({isDev:e,isStage:o})=>`${e?"":`https://${o?C:$}`}/api`,Q=()=>{const e=X()&&window.location.hostname;return!!e&&(j.includes(e)||j.some(o=>e.endsWith(o)))};async function S({path:e,baseApiUrl:o,method:t="GET",headers:n={},params:a,body:d}){const r=`${o||Z({isDev:!1,isStage:!1})}${e}`,s={method:t,headers:{"Content-Type":"application/json",...n}};d&&(s.body=JSON.stringify(d));const c=a?new URLSearchParams(a).toString():"",i=c?`?${c}`:"",p=await fetch(`${r}${i}`,s);if(!p.ok)throw new Error(`HTTP error! status: ${p.status}`);return p.json()}const U={[g.free]:0,[g.startup]:10,[g.business]:20,[g.enterprise]:30};function ee(e){const o=e;return o.init=t=>n=>e(n,t),o}const te=e=>ee(e);async function oe({editor:e,plan:o,pluginName:t,licenseKey:n,cleanup:a}){let d="",u=!1;const r=Q(),s=i=>{console.warn("Cleanup plugin:",t,"Reason:",i),a()},c=(i={})=>{var v;const{error:p,sdkLicense:b}=i,l=(v=i.plan)==null?void 0:v.category;if(!(b||i.license)||p)s(p||"Invalid license");else if(l){const T=U[o],L=U[l];T>L&&s({pluginRequiredPlan:o,licensePlan:l})}};e.on(z,i=>{d=i==null?void 0:i.baseApiUrl,u=!0}),e.on(J,i=>{c(i)}),setTimeout(async()=>{if(!u){if(r)return;if(n){const i=await ne({licenseKey:n,pluginName:t,baseApiUrl:d});i&&c(i)}else s("The `licenseKey` option not provided")}},2e3)}async function ne(e){const{licenseKey:o,pluginName:t,baseApiUrl:n}=e;try{return(await S({baseApiUrl:n,path:`/sdk/${o||"na"}`,method:"POST",params:{d:window.location.hostname,pn:t}})).result||{}}catch(a){return console.error("Error during SDK license check:",a),!1}}const se=(e,o)=>{var t;return!!((t=e==null?void 0:e.hasAttribute)!=null&&t.call(e,o))},ie="iconifyComponent";return te(function(e,o={}){var l;const{Components:t,Blocks:n}=e,{collections:a,extendIconComponent:d=!0,licenseKey:u,block:r={}}=o,s="icon",c="iconify",i="Iconify",p="data-type-iconify",b={events:()=>({dblclick:"onActive"}),onActive(){G({collectionIds:a,editor:e,component:this.model})}};if(t.addType(c,{block:r&&{label:i,media:I,content:{type:c},category:"Extra",activate:!0,...r},isComponent:f=>se(f,p),model:{defaults:{name:i,icon:I,droppable:!1,attributes:{[p]:!0},resizable:M,components:I,style:{width:"50px",height:"50px"},traits:[R()]},init(){this.listenTo(this.components(),"change add",this.disableLayers),this.disableLayers()},disableLayers(){this.components().forEach(f=>f.set({layerable:!1,locked:!0}))}},view:b}),d){const f=(l=t.getType(s))==null?void 0:l.model,[v,T,...L]=f.getDefaults().traits;t.addType(s,{model:{defaults:{traits:[v,T,R(),...L]}},view:b})}oe({editor:e,licenseKey:u,plan:g.startup,pluginName:ie,cleanup:()=>{n.remove(c),t.removeType(c)}})})});
3
+ </svg>`,k="layout-icon-picker",N="icons-layout-",x="icons-list-layout",O="gs-iconify-picker",E="__iconify_collection",H="https://api.iconify.design",A=new Map;let w;const B=({collectionId:e})=>`https://cdn.jsdelivr.net/npm/@iconify-json/${e}@latest/icons.json`;async function R({collectionId:e,editor:o}){try{if(A.has(e))return A.get(e);const t=await fetch(B({collectionId:e}));if(!t.ok)throw new Error(`Failed to fetch collection: ${t.statusText}`);const n=await t.json();return A.set(e,n),n}catch(t){console.error("Error fetching collection",t),o.runCommand(h.toastAdd,z());return}}async function D({collectionIds:e,editor:o}){try{if(w)return w;const t=e?`?prefixes=${e.join(",")}`:"",n=await fetch(`${H}/collections${t}`);if(!n.ok)throw new Error(`Failed to fetch collections: ${n.statusText}`);return w=await n.json(),w}catch(t){console.error("Error fetching collections",t),o.runCommand(h.toastAdd,_());return}}function m(){return{type:"button",label:"Open Icon Picker",name:"onActive",changeProp:!0,command(e){var o;(o=e.getSelected())==null||o.trigger("active")}}}async function G({collectionIds:e,editor:o,component:t}){const n=await D({collectionIds:e,editor:o});if(!n)return;const a=({icon:s,collectionId:c,iconId:i})=>{t.components(s),t.set({collectionId:c,iconId:i})},d=Object.entries(n).map(([s,c])=>({id:s,...c})).sort((s,c)=>s.name.localeCompare(c.name)),u=t.get("collectionId")??d[0].id;o.runCommand(h.layoutToggle,{id:k,placer:{type:"dialog",size:"l",title:"Select Icon"},header:!1,layout:{type:"column",style:{height:500,gap:10},children:[K({collectionsList:d,collectionId:u,editor:o,handleClick:a}),{id:x,type:"column",grow:!0}]}});const r=await R({collectionId:u,editor:o});r&&P({editor:o,collection:r,handleClick:a,collectionId:u})}function W({editor:e,collection:o}){e.em.set(E,o)}function F(e){return e.em.get(E)}function P(e){const{editor:o}=e,t={id:N,layout:V(e),header:!1,style:{height:"100%"},placer:{type:"static",layoutId:x}};o.runCommand(h.layoutRemove,{id:t.id,force:!0}),setTimeout(()=>o.runCommand(h.layoutAdd,t),10)}function K(e){const{collectionsList:o,collectionId:t,editor:n,handleClick:a}=e,d=o.map(({id:u,name:r,total:s})=>({id:u,label:`${r} (${s})`})).sort((u,r)=>u.label.localeCompare(r.label));return{type:"column",style:{gap:10},className:`${O}__header`,children:[{type:"selectField",value:t,options:d,emptyState:"Select an icon collection",onChange:async({setState:u,value:r})=>{const s=await R({collectionId:r,editor:n});s&&(u({value:r}),W({editor:n,collection:s}),P({editor:n,collection:s,handleClick:a,collectionId:r}))}},{type:"inputField",value:"",placeholder:"Search icons inside collection...",editorEvents:{[`change:${E}`]:({setState:u})=>u({value:""})},onInput:({setState:u,value:r,editor:s})=>{const c=F(s);if(!c)return;const i=Object.fromEntries(Object.entries(c.icons).filter(([p])=>p.includes(r)));u({value:r}),P({editor:s,collection:c,handleClick:a,collectionId:r,collectionFiltered:{...c,icons:i}})}}]}}function V({collection:e,collectionFiltered:o,handleClick:t}){const{height:n=24,width:a=24,icons:d,prefix:u}=o||e,r=Object.entries(d).map(([s,{body:c}])=>({name:s,body:c}),{});return{type:"column",className:`${O}__content`,style:{height:"100%"},children:{type:"virtualList",items:r,itemLayout:({item:s})=>[{type:"custom",render:c=>{const{editor:i,addEl:p,removeEl:b}=c,l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.setAttribute("xmlns","http://www.w3.org/2000/svg"),l.innerHTML=s.body,l.setAttribute("viewBox",`0 0 ${a} ${n}`);const{cssWidth:f,cssHeight:v}=Y(a,n);l.style.cssText=`width: ${f}px; height: ${v}px; cursor: pointer;`,l.addEventListener("mouseover",()=>{l.style.border="2px solid currentColor",l.style.borderRadius="4px",l.style.padding="4px"}),l.addEventListener("mouseout",()=>{l.style.border="none"});const T=()=>{const L=l.cloneNode(!0);L.removeAttribute("style");const ce=L.outerHTML;t({icon:ce,collectionId:u,iconId:s.name}),i==null||i.runCommand(h.layoutRemove,{id:k})};return l.addEventListener("click",T),p(l),()=>{l.removeEventListener("click",T),b(l)}}}]}}}function Y(e,o){const t=e/o;let n=48,a=48;return t>1?a=48/t:t<1&&(n=48*t),{cssWidth:n,cssHeight:a}}function _(){return{id:"toast-error-getCollections",header:"Error",content:"Error fetching collections",variant:y.Error}}function z(){return{..._(),id:"toast-error-getCollection",content:"Error fetching collection"}}const $="app.grapesjs.com",C="app-stage.grapesjs.com",U=[$,C,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],q="license:check:start",J="license:check:end",X=()=>typeof window<"u",Z=({isDev:e,isStage:o})=>`${e?"":`https://${o?C:$}`}/api`,Q=()=>{const e=X()&&window.location.hostname;return!!e&&(U.includes(e)||U.some(o=>e.endsWith(o)))};async function S({path:e,baseApiUrl:o,method:t="GET",headers:n={},params:a,body:d}){const r=`${o||Z({isDev:!1,isStage:!1})}${e}`,s={method:t,headers:{"Content-Type":"application/json",...n}};d&&(s.body=JSON.stringify(d));const c=a?new URLSearchParams(a).toString():"",i=c?`?${c}`:"",p=await fetch(`${r}${i}`,s);if(!p.ok)throw new Error(`HTTP error! status: ${p.status}`);return p.json()}const j={[g.free]:0,[g.startup]:10,[g.business]:20,[g.enterprise]:30};function ee(e){const o=e;return o.init=t=>n=>e(n,t),o}const te=e=>ee(e);async function oe({editor:e,plan:o,pluginName:t,licenseKey:n,cleanup:a}){let d="",u=!1;const r=Q(),s=i=>{console.warn("Cleanup plugin:",t,"Reason:",i),a()},c=(i={})=>{var v;const{error:p,sdkLicense:b}=i,l=(v=i.plan)==null?void 0:v.category;if(!(b||i.license)||p)s(p||"Invalid license");else if(l){const T=j[o],L=j[l];T>L&&s({pluginRequiredPlan:o,licensePlan:l})}};e.on(q,i=>{d=i==null?void 0:i.baseApiUrl,u=!0}),e.on(J,i=>{c(i)}),setTimeout(async()=>{if(!u){if(r)return;if(n){const i=await ne({licenseKey:n,pluginName:t,baseApiUrl:d});i&&c(i)}else s("The `licenseKey` option not provided")}},2e3)}async function ne(e){const{licenseKey:o,pluginName:t,baseApiUrl:n}=e;try{return(await S({baseApiUrl:n,path:`/sdk/${o||"na"}`,method:"POST",params:{d:window.location.hostname,pn:t}})).result||{}}catch(a){return console.error("Error during SDK license check:",a),!1}}const se=(e,o)=>{var t;return!!((t=e==null?void 0:e.hasAttribute)!=null&&t.call(e,o))},ie="iconifyComponent";return te(function(e,o={}){var l;const{Components:t,Blocks:n}=e,{collections:a,extendIconComponent:d=!0,licenseKey:u,block:r={}}=o,s="icon",c="iconify",i="Iconify",p="data-type-iconify",b={events:()=>({dblclick:"onActive"}),onActive(){G({collectionIds:a,editor:e,component:this.model})}};if(t.addType(c,{block:r&&{label:i,media:I,content:{type:c},category:"Extra",activate:!0,...r},isComponent:f=>se(f,p),model:{defaults:{name:i,icon:I,droppable:!1,attributes:{[p]:!0},resizable:M,components:I,style:{width:"50px",height:"50px"},traits:[m()]},init(){this.listenTo(this.components(),"change add",this.disableLayers),this.disableLayers()},disableLayers(){this.components().forEach(f=>f.set({layerable:!1,locked:!0}))}},view:b}),d){const f=(l=t.getType(s))==null?void 0:l.model,[v,T,...L]=f.getDefaults().traits;t.addType(s,{model:{defaults:{traits:[v,T,m(),...L]}},view:b})}oe({editor:e,licenseKey:u,plan:g.startup,pluginName:ie,cleanup:()=>{n.remove(c),t.removeType(c)}})})});
@@ -11,5 +11,6 @@ export { default as rteTinyMce } from './rteTinyMce';
11
11
  export { default as rteProseMirror } from './prosemirror';
12
12
  export { default as canvasEmptyState } from './canvasEmptyState';
13
13
  export { default as canvasFullSize } from './canvasFullSize';
14
+ export { default as layoutSidebarButtons } from './layoutSidebarButtons';
14
15
  export { default as youtubeAssetProvider } from './youtubeAssetProvider';
15
16
  export { default as googleFontsAssetProvider } from './googleFontsAssetProvider';