@grapesjs/studio-sdk-plugins 1.0.14 → 1.0.15-rc.1

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 (65) hide show
  1. package/dist/accordionComponent/components/Accordion.d.ts +4 -0
  2. package/dist/accordionComponent/components/AccordionContent.d.ts +3 -0
  3. package/dist/accordionComponent/components/AccordionGroup.d.ts +4 -0
  4. package/dist/accordionComponent/components/AccordionHeader.d.ts +4 -0
  5. package/dist/accordionComponent/components/AccordionMarker.d.ts +3 -0
  6. package/dist/accordionComponent/index.cjs.d.ts +3 -0
  7. package/dist/accordionComponent/index.cjs.js +39 -0
  8. package/dist/accordionComponent/index.d.ts +3 -0
  9. package/dist/accordionComponent/index.es.d.ts +3 -0
  10. package/dist/accordionComponent/index.es.js +360 -0
  11. package/dist/accordionComponent/index.umd.js +39 -0
  12. package/dist/accordionComponent/types.d.ts +6 -0
  13. package/dist/accordionComponent/typesSchema.d.ts +22 -0
  14. package/dist/accordionComponent/utils.d.ts +22 -0
  15. package/dist/canvasEmptyState/index.cjs.js +1 -1
  16. package/dist/canvasEmptyState/index.es.js +15 -15
  17. package/dist/canvasEmptyState/index.umd.js +1 -1
  18. package/dist/canvasFullSize/index.cjs.js +5 -5
  19. package/dist/canvasFullSize/index.es.js +138 -118
  20. package/dist/canvasFullSize/index.umd.js +5 -5
  21. package/dist/canvasFullSize/typesSchema.d.ts +12 -8
  22. package/dist/flexComponent/blocks.d.ts +3 -0
  23. package/dist/flexComponent/components/FlexColumn.d.ts +4 -0
  24. package/dist/flexComponent/components/FlexRow.d.ts +4 -0
  25. package/dist/flexComponent/handlers.d.ts +19 -0
  26. package/dist/flexComponent/index.cjs.d.ts +3 -0
  27. package/dist/flexComponent/index.cjs.js +33 -0
  28. package/dist/flexComponent/index.d.ts +3 -0
  29. package/dist/flexComponent/index.es.d.ts +3 -0
  30. package/dist/flexComponent/index.es.js +715 -0
  31. package/dist/flexComponent/index.umd.js +33 -0
  32. package/dist/flexComponent/resizeDecorator.d.ts +50 -0
  33. package/dist/flexComponent/spots.d.ts +3 -0
  34. package/dist/flexComponent/types.d.ts +32 -0
  35. package/dist/flexComponent/typesSchema.d.ts +112 -0
  36. package/dist/flexComponent/utils.d.ts +63 -0
  37. package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
  38. package/dist/googleFontsAssetProvider/index.es.js +128 -91
  39. package/dist/googleFontsAssetProvider/index.umd.js +1 -1
  40. package/dist/googleFontsAssetProvider/types.d.ts +7 -2
  41. package/dist/googleFontsAssetProvider/utils.d.ts +5 -0
  42. package/dist/iconifyComponent/index.cjs.js +2 -2
  43. package/dist/iconifyComponent/index.es.js +39 -39
  44. package/dist/iconifyComponent/index.umd.js +2 -2
  45. package/dist/index.cjs.d.ts +2 -0
  46. package/dist/index.cjs.js +105 -35
  47. package/dist/index.d.ts +2 -0
  48. package/dist/index.es.d.ts +2 -0
  49. package/dist/index.es.js +6286 -5366
  50. package/dist/index.umd.js +105 -35
  51. package/dist/prosemirror/index.cjs.js +1 -1
  52. package/dist/prosemirror/index.es.js +1 -1
  53. package/dist/prosemirror/index.umd.js +1 -1
  54. package/dist/rteTinyMce/index.cjs.js +1 -1
  55. package/dist/rteTinyMce/index.es.js +28 -28
  56. package/dist/rteTinyMce/index.umd.js +1 -1
  57. package/dist/tableComponent/index.cjs.js +1 -1
  58. package/dist/tableComponent/index.es.js +31 -30
  59. package/dist/tableComponent/index.umd.js +1 -1
  60. package/dist/types.d.ts +3 -1
  61. package/dist/utils.d.ts +4 -0
  62. package/dist/youtubeAssetProvider/index.cjs.js +1 -1
  63. package/dist/youtubeAssetProvider/index.es.js +11 -11
  64. package/dist/youtubeAssetProvider/index.umd.js +1 -1
  65. package/package.json +2 -2
@@ -1,11 +1,11 @@
1
1
  import "grapesjs";
2
- var L = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(L || {}), O = /* @__PURE__ */ ((e) => (e.Info = "info", e.Error = "error", e.Success = "success", e.Warning = "warning", e))(O || {}), h = /* @__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.getStateTheme = "studio:getStateTheme", e.setStateTheme = "studio:setStateTheme", e.assetProviderGet = "studio:assetProviderGet", e.assetProviderAdd = "studio:assetProviderAdd", e.assetProviderRemove = "studio:assetProviderRemove", e))(h || {});
2
+ var L = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(L || {}), O = /* @__PURE__ */ ((e) => (e.Info = "info", e.Error = "error", e.Success = "success", e.Warning = "warning", e))(O || {}), 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.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
3
  const H = { ratioDefault: !0, tc: !1, cl: !1, cr: !1, bc: !1 }, w = `<svg viewBox="0 0 24 24">
4
4
  <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", U = "icons-layout-", C = "icons-list-layout", R = "gs-iconify-picker", P = "__iconify_collection", B = "https://api.iconify.design", I = /* @__PURE__ */ new Map();
5
+ </svg>`, x = "layout-icon-picker", U = "icons-layout-", R = "icons-list-layout", _ = "gs-iconify-picker", A = "__iconify_collection", B = "https://api.iconify.design", I = /* @__PURE__ */ new Map();
6
6
  let T;
7
7
  const D = ({ collectionId: e }) => `https://cdn.jsdelivr.net/npm/@iconify-json/${e}@latest/icons.json`;
8
- async function _({ collectionId: e, editor: o }) {
8
+ async function $({ collectionId: e, editor: o }) {
9
9
  try {
10
10
  if (I.has(e)) return I.get(e);
11
11
  const t = await fetch(D({ collectionId: e }));
@@ -13,22 +13,22 @@ async function _({ collectionId: e, editor: o }) {
13
13
  const n = await t.json();
14
14
  return I.set(e, n), n;
15
15
  } catch (t) {
16
- console.error("Error fetching collection", t), o.runCommand(h.toastAdd, q());
16
+ console.error("Error fetching collection", t), o.runCommand(f.toastAdd, q());
17
17
  return;
18
18
  }
19
19
  }
20
- async function W({ collectionIds: e, editor: o }) {
20
+ async function G({ collectionIds: e, editor: o }) {
21
21
  try {
22
22
  if (T) return T;
23
23
  const t = e ? `?prefixes=${e.join(",")}` : "", n = await fetch(`${B}/collections${t}`);
24
24
  if (!n.ok) throw new Error(`Failed to fetch collections: ${n.statusText}`);
25
25
  return T = await n.json(), T;
26
26
  } catch (t) {
27
- console.error("Error fetching collections", t), o.runCommand(h.toastAdd, $());
27
+ console.error("Error fetching collections", t), o.runCommand(f.toastAdd, C());
28
28
  return;
29
29
  }
30
30
  }
31
- function m() {
31
+ function P() {
32
32
  return {
33
33
  type: "button",
34
34
  label: "Open Icon Picker",
@@ -40,13 +40,13 @@ function m() {
40
40
  }
41
41
  };
42
42
  }
43
- async function F({ collectionIds: e, editor: o, component: t }) {
44
- const n = await W({ collectionIds: e, editor: o });
43
+ async function W({ collectionIds: e, editor: o, component: t }) {
44
+ const n = await G({ collectionIds: e, editor: o });
45
45
  if (!n) return;
46
46
  const a = ({ icon: s, collectionId: c, iconId: i }) => {
47
47
  t.components(s), t.set({ collectionId: c, iconId: i });
48
48
  }, 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
- o.runCommand(h.layoutToggle, {
49
+ o.runCommand(f.layoutToggle, {
50
50
  id: x,
51
51
  placer: { type: "dialog", size: "l", title: "Select Icon" },
52
52
  header: !1,
@@ -60,11 +60,11 @@ async function F({ collectionIds: e, editor: o, component: t }) {
60
60
  editor: o,
61
61
  handleClick: a
62
62
  }),
63
- { id: C, type: "column", grow: !0 }
63
+ { id: R, type: "column", grow: !0 }
64
64
  ]
65
65
  }
66
66
  });
67
- const r = await _({ collectionId: u, editor: o });
67
+ const r = await $({ collectionId: u, editor: o });
68
68
  r && E({
69
69
  editor: o,
70
70
  collection: r,
@@ -72,11 +72,11 @@ async function F({ collectionIds: e, editor: o, component: t }) {
72
72
  collectionId: u
73
73
  });
74
74
  }
75
- function G({ editor: e, collection: o }) {
76
- e.em.set(P, o);
75
+ function F({ editor: e, collection: o }) {
76
+ e.em.set(A, o);
77
77
  }
78
78
  function K(e) {
79
- return e.em.get(P);
79
+ return e.em.get(A);
80
80
  }
81
81
  function E(e) {
82
82
  const { editor: o } = e, t = {
@@ -84,16 +84,16 @@ function E(e) {
84
84
  layout: Y(e),
85
85
  header: !1,
86
86
  style: { height: "100%" },
87
- placer: { type: "static", layoutId: C }
87
+ placer: { type: "static", layoutId: R }
88
88
  };
89
- o.runCommand(h.layoutRemove, { id: t.id, force: !0 }), setTimeout(() => o.runCommand(h.layoutAdd, t), 10);
89
+ o.runCommand(f.layoutRemove, { id: t.id, force: !0 }), setTimeout(() => o.runCommand(f.layoutAdd, t), 10);
90
90
  }
91
91
  function V(e) {
92
92
  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));
93
93
  return {
94
94
  type: "column",
95
95
  style: { gap: 10 },
96
- className: `${R}__header`,
96
+ className: `${_}__header`,
97
97
  children: [
98
98
  {
99
99
  type: "selectField",
@@ -101,8 +101,8 @@ function V(e) {
101
101
  options: d,
102
102
  emptyState: "Select an icon collection",
103
103
  onChange: async ({ setState: u, value: r }) => {
104
- const s = await _({ collectionId: r, editor: n });
105
- s && (u({ value: r }), G({ editor: n, collection: s }), E({
104
+ const s = await $({ collectionId: r, editor: n });
105
+ s && (u({ value: r }), F({ editor: n, collection: s }), E({
106
106
  editor: n,
107
107
  collection: s,
108
108
  handleClick: a,
@@ -115,7 +115,7 @@ function V(e) {
115
115
  value: "",
116
116
  placeholder: "Search icons inside collection...",
117
117
  editorEvents: {
118
- [`change:${P}`]: ({ setState: u }) => u({ value: "" })
118
+ [`change:${A}`]: ({ setState: u }) => u({ value: "" })
119
119
  },
120
120
  onInput: ({ setState: u, value: r, editor: s }) => {
121
121
  const c = K(s);
@@ -143,7 +143,7 @@ function Y({
143
143
  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
144
  return {
145
145
  type: "column",
146
- className: `${R}__content`,
146
+ className: `${_}__content`,
147
147
  style: { height: "100%" },
148
148
  children: {
149
149
  type: "virtualList",
@@ -152,7 +152,7 @@ function Y({
152
152
  {
153
153
  type: "custom",
154
154
  render: (c) => {
155
- const { editor: i, addEl: g, removeEl: f } = c, l = document.createElementNS("http://www.w3.org/2000/svg", "svg");
155
+ const { editor: i, addEl: g, removeEl: h } = c, l = document.createElementNS("http://www.w3.org/2000/svg", "svg");
156
156
  l.setAttribute("xmlns", "http://www.w3.org/2000/svg"), l.innerHTML = s.body, l.setAttribute("viewBox", `0 0 ${a} ${n}`);
157
157
  const { cssWidth: p, cssHeight: y } = z(a, n);
158
158
  l.style.cssText = `width: ${p}px; height: ${y}px; cursor: pointer;`, l.addEventListener("mouseover", () => {
@@ -164,10 +164,10 @@ function Y({
164
164
  const v = l.cloneNode(!0);
165
165
  v.removeAttribute("style");
166
166
  const j = v.outerHTML;
167
- t({ icon: j, collectionId: u, iconId: s.name }), i == null || i.runCommand(h.layoutRemove, { id: x });
167
+ t({ icon: j, collectionId: u, iconId: s.name }), i == null || i.runCommand(f.layoutRemove, { id: x });
168
168
  };
169
169
  return l.addEventListener("click", b), g(l), () => {
170
- l.removeEventListener("click", b), f(l);
170
+ l.removeEventListener("click", b), h(l);
171
171
  };
172
172
  }
173
173
  }
@@ -180,7 +180,7 @@ function z(e, o) {
180
180
  let n = 48, a = 48;
181
181
  return t > 1 ? a = 48 / t : t < 1 && (n = 48 * t), { cssWidth: n, cssHeight: a };
182
182
  }
183
- function $() {
183
+ function C() {
184
184
  return {
185
185
  id: "toast-error-getCollections",
186
186
  header: "Error",
@@ -190,12 +190,12 @@ function $() {
190
190
  }
191
191
  function q() {
192
192
  return {
193
- ...$(),
193
+ ...C(),
194
194
  id: "toast-error-getCollection",
195
195
  content: "Error fetching collection"
196
196
  };
197
197
  }
198
- const M = "app.grapesjs.com", N = "app-stage.grapesjs.com", A = [
198
+ const M = "app.grapesjs.com", N = "app-stage.grapesjs.com", k = [
199
199
  M,
200
200
  N,
201
201
  "localhost",
@@ -208,7 +208,7 @@ const M = "app.grapesjs.com", N = "app-stage.grapesjs.com", A = [
208
208
  // For Sandpack demos
209
209
  ], J = "license:check:start", X = "license:check:end", Z = () => typeof window < "u", Q = ({ isDev: e, isStage: o }) => `${e ? "" : `https://${o ? N : M}`}/api`, S = () => {
210
210
  const e = Z() && window.location.hostname;
211
- return !!e && (A.includes(e) || A.some((o) => e.endsWith(o)));
211
+ return !!e && (k.includes(e) || k.some((o) => e.endsWith(o)));
212
212
  };
213
213
  async function ee({
214
214
  path: e,
@@ -231,7 +231,7 @@ async function ee({
231
231
  throw new Error(`HTTP error! status: ${g.status}`);
232
232
  return g.json();
233
233
  }
234
- const k = {
234
+ const m = {
235
235
  [L.free]: 0,
236
236
  [L.startup]: 10,
237
237
  [L.business]: 20,
@@ -254,11 +254,11 @@ async function ne({
254
254
  console.warn("Cleanup plugin:", t, "Reason:", i), a();
255
255
  }, c = (i = {}) => {
256
256
  var y;
257
- const { error: g, sdkLicense: f } = i, l = (y = i.plan) == null ? void 0 : y.category;
258
- if (!(f || i.license) || g)
257
+ const { error: g, sdkLicense: h } = i, l = (y = i.plan) == null ? void 0 : y.category;
258
+ if (!(h || i.license) || g)
259
259
  s(g || "Invalid license");
260
260
  else if (l) {
261
- const b = k[o], v = k[l];
261
+ const b = m[o], v = m[l];
262
262
  b > v && s({ pluginRequiredPlan: o, licensePlan: l });
263
263
  }
264
264
  };
@@ -298,12 +298,12 @@ const ie = (e, o) => {
298
298
  return !!((t = e == null ? void 0 : e.hasAttribute) != null && t.call(e, o));
299
299
  }, ce = "iconifyComponent", re = function(e, o = {}) {
300
300
  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", g = "data-type-iconify", f = {
301
+ 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
302
  events: () => ({
303
303
  dblclick: "onActive"
304
304
  }),
305
305
  onActive() {
306
- F({ collectionIds: a, editor: e, component: this.model });
306
+ W({ collectionIds: a, editor: e, component: this.model });
307
307
  }
308
308
  };
309
309
  if (t.addType(c, {
@@ -325,7 +325,7 @@ const ie = (e, o) => {
325
325
  resizable: H,
326
326
  components: w,
327
327
  style: { width: "50px", height: "50px" },
328
- traits: [m()]
328
+ traits: [P()]
329
329
  },
330
330
  init() {
331
331
  this.listenTo(this.components(), "change add", this.disableLayers), this.disableLayers();
@@ -334,16 +334,16 @@ const ie = (e, o) => {
334
334
  this.components().forEach((p) => p.set({ layerable: !1, locked: !0 }));
335
335
  }
336
336
  },
337
- view: f
337
+ view: h
338
338
  }), d) {
339
339
  const p = (l = t.getType(s)) == null ? void 0 : l.model, [y, b, ...v] = p.getDefaults().traits;
340
340
  t.addType(s, {
341
341
  model: {
342
342
  defaults: {
343
- traits: [y, b, m(), ...v]
343
+ traits: [y, b, P(), ...v]
344
344
  }
345
345
  },
346
- view: f
346
+ view: h
347
347
  });
348
348
  }
349
349
  ne({
@@ -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.getStateTheme="studio:getStateTheme",e.setStateTheme="studio:setStateTheme",e.assetProviderGet="studio:assetProviderGet",e.assetProviderAdd="studio:assetProviderAdd",e.assetProviderRemove="studio:assetProviderRemove",e))(h||{});const N={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(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.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 N={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",H="icons-layout-",A="icons-list-layout",x="gs-iconify-picker",E="__iconify_collection",U="https://api.iconify.design",m=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(m.has(e))return m.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 m.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(`${U}/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 C(){return{type:"button",label:"Open Icon Picker",name:"onActive",changeProp:!0,command(e){var o;(o=e.getSelected())==null||o.trigger("active")}}}async function W({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:A,type:"column",grow:!0}]}});const r=await O({collectionId:u,editor:o});r&&P({editor:o,collection:r,handleClick:a,collectionId:u})}function F({editor:e,collection:o}){e.em.set(E,o)}function G(e){return e.em.get(E)}function P(e){const{editor:o}=e,t={id:H,layout:V(e),header:!1,style:{height:"100%"},placer:{type:"static",layoutId:A}};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}),F({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=G(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 R="app.grapesjs.com",$="app-stage.grapesjs.com",j=[R,$,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],z="license:check:start",J="license:check:end",S=()=>typeof window<"u",X=({isDev:e,isStage:o})=>`${e?"":`https://${o?$:R}`}/api`,Z=()=>{const e=S()&&window.location.hostname;return!!e&&(j.includes(e)||j.some(o=>e.endsWith(o)))};async function Q({path:e,baseApiUrl:o,method:t="GET",headers:n={},params:a,body:d}){const r=`${o||X({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 M={[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=Z(),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=M[o],L=M[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 Q({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(){W({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:N,components:I,style:{width:"50px",height:"50px"},traits:[C()]},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,C(),...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",H="icons-layout-",m="icons-list-layout",x="gs-iconify-picker",E="__iconify_collection",U="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(`${U}/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:H,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 M={[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=M[o],L=M[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:N,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)}})})});
@@ -5,6 +5,8 @@ export { default as listPagesComponent } from './listPagesComponent';
5
5
  export { default as fsLightboxComponent } from './fsLightboxComponent';
6
6
  export { default as lightGalleryComponent } from './lightGalleryComponent';
7
7
  export { default as swiperComponent } from './swiperComponent';
8
+ export { default as accordionComponent } from './accordionComponent';
9
+ export { default as flexComponent } from './flexComponent';
8
10
  export { default as rteTinyMce } from './rteTinyMce';
9
11
  export { default as rteProseMirror } from './prosemirror';
10
12
  export { default as canvasEmptyState } from './canvasEmptyState';