@grapesjs/studio-sdk-plugins 1.0.38 → 1.0.39-rc.0

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 (158) hide show
  1. package/dist/accordionComponent/index.cjs.js +5 -5
  2. package/dist/accordionComponent/index.es.js +70 -67
  3. package/dist/accordionComponent/index.js +39 -0
  4. package/dist/accordionComponent/index.umd.js +4 -4
  5. package/dist/aiChat/components/AiChatHeader.d.ts +4 -5
  6. package/dist/aiChat/components/AiChatInput/index.d.ts +4 -5
  7. package/dist/aiChat/components/AiChatMessage.d.ts +7 -8
  8. package/dist/aiChat/components/index.d.ts +1 -1
  9. package/dist/aiChat/components/utils.d.ts +1 -1
  10. package/dist/aiChat/index.cjs.js +10 -376
  11. package/dist/aiChat/index.es.js +4569 -28851
  12. package/dist/aiChat/index.js +10 -376
  13. package/dist/aiChat/index.umd.js +11 -377
  14. package/dist/aiChat/server/index.cjs.d.ts +0 -1
  15. package/dist/aiChat/server/index.cjs.js +45 -45
  16. package/dist/aiChat/server/index.d.ts +0 -1
  17. package/dist/aiChat/server/index.es.d.ts +0 -1
  18. package/dist/aiChat/server/index.es.js +371 -427
  19. package/dist/aiChat/server/index.js +45 -45
  20. package/dist/aiChat/server/index.umd.js +41 -41
  21. package/dist/aiChat/server/stream.test.d.ts +1 -0
  22. package/dist/aiChat/types.d.ts +18 -4
  23. package/dist/aiChat/typesSchema.d.ts +13 -0
  24. package/dist/animationComponent/index.cjs.js +3 -3
  25. package/dist/animationComponent/index.es.js +49 -46
  26. package/dist/animationComponent/index.js +519 -0
  27. package/dist/animationComponent/index.umd.js +3 -3
  28. package/dist/canvasAbsoluteMode/index.cjs.js +1 -1
  29. package/dist/canvasAbsoluteMode/index.es.js +115 -112
  30. package/dist/canvasAbsoluteMode/index.js +1 -0
  31. package/dist/canvasAbsoluteMode/index.umd.js +1 -1
  32. package/dist/canvasEmptyState/index.cjs.js +1 -1
  33. package/dist/canvasEmptyState/index.es.js +71 -68
  34. package/dist/canvasEmptyState/index.js +1 -0
  35. package/dist/canvasEmptyState/index.umd.js +1 -1
  36. package/dist/canvasFullSize/index.cjs.js +3 -3
  37. package/dist/canvasFullSize/index.es.js +69 -66
  38. package/dist/canvasFullSize/index.js +10 -0
  39. package/dist/canvasFullSize/index.umd.js +4 -4
  40. package/dist/canvasGridMode/index.cjs.js +7 -7
  41. package/dist/canvasGridMode/index.es.js +142 -139
  42. package/dist/canvasGridMode/index.js +26 -0
  43. package/dist/canvasGridMode/index.umd.js +7 -7
  44. package/dist/canvasScreenshot/index.cjs.js +1 -1
  45. package/dist/canvasScreenshot/index.es.js +78 -75
  46. package/dist/canvasScreenshot/index.js +1 -0
  47. package/dist/canvasScreenshot/index.umd.js +1 -1
  48. package/dist/dataSourceEjs/EjsExporter.d.ts +1 -1
  49. package/dist/dataSourceEjs/index.cjs.js +3 -3
  50. package/dist/dataSourceEjs/index.es.js +40 -37
  51. package/dist/dataSourceEjs/index.js +21 -0
  52. package/dist/dataSourceEjs/index.umd.js +3 -3
  53. package/dist/dataSourceHandlebars/HandlebarsExporter.d.ts +2 -2
  54. package/dist/dataSourceHandlebars/constants.d.ts +1 -1
  55. package/dist/dataSourceHandlebars/index.cjs.js +4 -4
  56. package/dist/dataSourceHandlebars/index.es.js +58 -55
  57. package/dist/dataSourceHandlebars/index.js +10 -0
  58. package/dist/dataSourceHandlebars/index.umd.js +2 -2
  59. package/dist/dialogComponent/index.cjs.js +11 -11
  60. package/dist/dialogComponent/index.es.js +72 -69
  61. package/dist/dialogComponent/index.js +59 -0
  62. package/dist/dialogComponent/index.umd.js +11 -11
  63. package/dist/flexComponent/index.cjs.js +6 -6
  64. package/dist/flexComponent/index.es.js +151 -142
  65. package/dist/flexComponent/index.js +33 -0
  66. package/dist/flexComponent/index.umd.js +8 -8
  67. package/dist/flexComponent/typesSchema.d.ts +1 -1
  68. package/dist/fsLightboxComponent/index.cjs.js +3 -3
  69. package/dist/fsLightboxComponent/index.es.js +93 -90
  70. package/dist/fsLightboxComponent/index.js +6 -0
  71. package/dist/fsLightboxComponent/index.umd.js +3 -3
  72. package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
  73. package/dist/googleFontsAssetProvider/index.es.js +112 -109
  74. package/dist/googleFontsAssetProvider/index.js +1 -0
  75. package/dist/googleFontsAssetProvider/index.umd.js +1 -1
  76. package/dist/googleFontsAssetProvider/utils.d.ts +1 -1
  77. package/dist/iconifyComponent/index.cjs.js +2 -2
  78. package/dist/iconifyComponent/index.es.js +80 -77
  79. package/dist/iconifyComponent/index.js +3 -0
  80. package/dist/iconifyComponent/index.umd.js +2 -2
  81. package/dist/index.cjs.d.ts +1 -0
  82. package/dist/index.cjs.js +970 -82
  83. package/dist/index.d.ts +1 -0
  84. package/dist/index.es.d.ts +1 -0
  85. package/dist/index.es.js +7422 -6145
  86. package/dist/index.umd.js +975 -87
  87. package/dist/layoutSidebarButtons/index.cjs.js +1 -1
  88. package/dist/layoutSidebarButtons/index.es.js +95 -92
  89. package/dist/layoutSidebarButtons/index.js +1 -0
  90. package/dist/layoutSidebarButtons/index.umd.js +1 -1
  91. package/dist/lightGalleryComponent/index.cjs.js +1 -1
  92. package/dist/lightGalleryComponent/index.es.js +164 -161
  93. package/dist/lightGalleryComponent/index.js +1 -0
  94. package/dist/lightGalleryComponent/index.umd.js +1 -1
  95. package/dist/lightGalleryComponent/utils.d.ts +1 -1
  96. package/dist/linkImageComponent/index.cjs.js +2 -2
  97. package/dist/linkImageComponent/index.es.js +60 -57
  98. package/dist/linkImageComponent/index.js +12 -0
  99. package/dist/linkImageComponent/index.umd.js +2 -2
  100. package/dist/listPagesComponent/index.cjs.js +4 -4
  101. package/dist/listPagesComponent/index.es.js +57 -54
  102. package/dist/listPagesComponent/index.js +11 -0
  103. package/dist/listPagesComponent/index.umd.js +4 -4
  104. package/dist/listPagesComponent/utils.d.ts +1 -1
  105. package/dist/presetBlockLibrary/blocks.d.ts +6 -0
  106. package/dist/presetBlockLibrary/blocks.test.d.ts +2 -0
  107. package/dist/presetBlockLibrary/emailBlocks.d.ts +53 -0
  108. package/dist/presetBlockLibrary/index.cjs.d.ts +3 -0
  109. package/dist/presetBlockLibrary/index.cjs.js +889 -0
  110. package/dist/presetBlockLibrary/index.d.ts +3 -0
  111. package/dist/presetBlockLibrary/index.es.d.ts +3 -0
  112. package/dist/presetBlockLibrary/index.es.js +1408 -0
  113. package/dist/presetBlockLibrary/index.js +889 -0
  114. package/dist/presetBlockLibrary/index.test.d.ts +1 -0
  115. package/dist/presetBlockLibrary/index.umd.js +889 -0
  116. package/dist/presetBlockLibrary/shared.d.ts +3 -0
  117. package/dist/presetBlockLibrary/types.d.ts +24 -0
  118. package/dist/presetBlockLibrary/typesSchema.d.ts +47 -0
  119. package/dist/presetPrintable/index.cjs.js +3 -3
  120. package/dist/presetPrintable/index.es.js +133 -130
  121. package/dist/presetPrintable/index.js +32 -0
  122. package/dist/presetPrintable/index.umd.js +4 -4
  123. package/dist/prosemirror/index.cjs.js +8 -8
  124. package/dist/prosemirror/index.es.js +552 -549
  125. package/dist/prosemirror/index.js +10 -0
  126. package/dist/prosemirror/index.umd.js +9 -9
  127. package/dist/prosemirror/toolbar.d.ts +2 -2
  128. package/dist/prosemirror/types.d.ts +5 -5
  129. package/dist/rendererReact/index.cjs.js +1 -1
  130. package/dist/rendererReact/index.es.js +137 -134
  131. package/dist/rendererReact/index.js +1 -1
  132. package/dist/rendererReact/index.umd.js +1 -1
  133. package/dist/rteTinyMce/index.cjs.js +2 -2
  134. package/dist/rteTinyMce/index.es.js +74 -71
  135. package/dist/rteTinyMce/index.js +104 -0
  136. package/dist/rteTinyMce/index.umd.js +2 -2
  137. package/dist/shapeDividerComponent/index.cjs.js +4 -4
  138. package/dist/shapeDividerComponent/index.es.js +91 -88
  139. package/dist/shapeDividerComponent/index.js +97 -0
  140. package/dist/shapeDividerComponent/index.umd.js +4 -4
  141. package/dist/swiperComponent/index.cjs.js +7 -7
  142. package/dist/swiperComponent/index.es.js +95 -92
  143. package/dist/swiperComponent/index.js +45 -0
  144. package/dist/swiperComponent/index.umd.js +5 -5
  145. package/dist/tableComponent/index.cjs.js +1 -1
  146. package/dist/tableComponent/index.es.js +181 -178
  147. package/dist/tableComponent/index.js +1 -0
  148. package/dist/tableComponent/index.umd.js +1 -1
  149. package/dist/tableComponent/types.d.ts +3 -3
  150. package/dist/types.d.ts +14 -14
  151. package/dist/utils.d.ts +3 -2
  152. package/dist/utilsDataSources.d.ts +1 -1
  153. package/dist/youtubeAssetProvider/index.cjs.js +1 -1
  154. package/dist/youtubeAssetProvider/index.es.js +90 -87
  155. package/dist/youtubeAssetProvider/index.js +1 -0
  156. package/dist/youtubeAssetProvider/index.umd.js +1 -1
  157. package/package.json +182 -34
  158. package/dist/aiChat/server/models.d.ts +0 -15
@@ -1,8 +1,8 @@
1
- const k = "app.grapesjs.com", D = "app-stage.grapesjs.com", B = "app2.grapesjs.com", H = "app-stage2.grapesjs.com", O = [
2
- k,
3
- B,
4
- D,
1
+ const R = "app.grapesjs.com", _ = "app-stage.grapesjs.com", H = "app2.grapesjs.com", F = "app-stage2.grapesjs.com", O = [
2
+ R,
5
3
  H,
4
+ _,
5
+ F,
6
6
  "localhost",
7
7
  "127.0.0.1",
8
8
  ".local-credentialless.webcontainer.io",
@@ -15,12 +15,12 @@ const k = "app.grapesjs.com", D = "app-stage.grapesjs.com", B = "app2.grapesjs.c
15
15
  // For Claude mcp app
16
16
  ".web-sandbox.oaiusercontent.com"
17
17
  // For OpenAI mcp app
18
- ], F = "license:check:end", C = () => typeof window < "u", W = ({
18
+ ], C = "license:check:end", W = () => typeof window < "u", K = ({
19
19
  isDev: e,
20
20
  isStage: t,
21
21
  isPlatform: o
22
- }) => `${e ? "" : `https://${t ? D : k}`}/${o ? "platform-api" : "api"}`, K = () => {
23
- if (!C()) return "";
22
+ }) => `${e ? "" : `https://${t ? _ : R}`}/${o ? "platform-api" : "api"}`, V = () => {
23
+ if (!W()) return "";
24
24
  const { hostname: e } = window.location;
25
25
  if (e) return e;
26
26
  try {
@@ -28,19 +28,19 @@ const k = "app.grapesjs.com", D = "app-stage.grapesjs.com", B = "app2.grapesjs.c
28
28
  } catch {
29
29
  return "";
30
30
  }
31
- }, V = () => {
32
- const e = K();
31
+ }, Y = () => {
32
+ const e = V();
33
33
  return !!e && (O.includes(e) || O.some((t) => e.endsWith(t)));
34
34
  };
35
- async function m({
35
+ async function z({
36
36
  path: e,
37
37
  baseApiUrl: t,
38
38
  method: o = "GET",
39
39
  headers: i = {},
40
- params: l,
40
+ params: a,
41
41
  body: g
42
42
  }) {
43
- const s = `${t || W({ isDev: !1, isStage: !1 })}${e}`, n = {
43
+ const s = `${t || K({ isDev: !1, isStage: !1 })}${e}`, n = {
44
44
  method: o,
45
45
  headers: {
46
46
  "Content-Type": "application/json",
@@ -48,34 +48,37 @@ async function m({
48
48
  }
49
49
  };
50
50
  g && (n.body = JSON.stringify(g));
51
- const c = l ? new URLSearchParams(l).toString() : "", p = c ? `?${c}` : "", r = await fetch(`${s}${p}`, n);
51
+ const c = a ? new URLSearchParams(a).toString() : "", p = c ? `?${c}` : "", r = await fetch(`${s}${p}`, n);
52
52
  if (!r.ok)
53
53
  throw new Error(`HTTP error! status: ${r.status}`);
54
54
  return r.json();
55
55
  }
56
- 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.openEditCode = "studio:openEditCode", 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 || {});
56
+ var w = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(w || {}), D = /* @__PURE__ */ ((e) => (e.Info = "info", e.Error = "error", e.Success = "success", e.Warning = "warning", e))(D || {}), 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.openEditCode = "studio:openEditCode", e.openBlocks = "studio:openBlocks", e.appendComponent = "studio:appendComponent", 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 || {});
57
57
  const x = {
58
58
  [w.free]: 0,
59
59
  [w.startup]: 10,
60
60
  [w.business]: 20,
61
61
  [w.enterprise]: 30
62
62
  };
63
- function Y(e) {
64
- const t = e;
65
- return t.init = (o) => (i) => e(i, o), t;
63
+ function q(e, t) {
64
+ const o = e;
65
+ return o.init = (i) => {
66
+ const a = (g) => e(g, i);
67
+ return a.__gjsPluginId = t, a;
68
+ }, o;
66
69
  }
67
- const z = (e) => /* @__PURE__ */ Y(e);
68
- async function q({
70
+ const J = (e, t) => /* @__PURE__ */ q(e, t);
71
+ async function m({
69
72
  editor: e,
70
73
  plan: t,
71
74
  pluginName: o,
72
75
  licenseKey: i,
73
- onLicenseCheckResponse: l,
76
+ onLicenseCheckResponse: a,
74
77
  cleanup: g
75
78
  }) {
76
- let a = "", s;
79
+ let l = "", s;
77
80
  const n = (r) => {
78
- console.warn("Cleanup plugin:", o, "Reason:", r), g();
81
+ console.warn("Cleanup plugin:", o, "Reason:", r), g(e, o);
79
82
  }, c = (r = {}) => {
80
83
  var b;
81
84
  const { error: h, sdkLicense: u } = r, d = (b = r.plan) == null ? void 0 : b.category;
@@ -86,15 +89,15 @@ async function q({
86
89
  f > v && n({ pluginRequiredPlan: t, licensePlan: d });
87
90
  }
88
91
  };
89
- e.Commands.has(y.settings) && (s = e.runCommand(y.settings), a = (s == null ? void 0 : s.baseUrl) || "");
92
+ e.Commands.has(y.settings) && (s = e.runCommand(y.settings), l = (s == null ? void 0 : s.baseUrl) || "");
90
93
  const p = (r) => {
91
- l == null || l(r), r && c(r);
94
+ a == null || a(r), r && c(r);
92
95
  };
93
96
  if (!s) {
94
97
  e.onReady(async () => {
95
- if (!V())
98
+ if (!Y())
96
99
  if (i) {
97
- const r = await X({ licenseKey: i, pluginName: o, baseApiUrl: a });
100
+ const r = await Z({ licenseKey: i, pluginName: o, baseApiUrl: l });
98
101
  p(r);
99
102
  } else
100
103
  n("The `licenseKey` option not provided");
@@ -102,22 +105,22 @@ async function q({
102
105
  return;
103
106
  }
104
107
  if (s.licensePlan || s.licenseError) {
105
- const r = J(s);
108
+ const r = X(s);
106
109
  p(r);
107
110
  return;
108
111
  }
109
- e.on(F, (r) => p(r));
112
+ e.on(C, (r) => p(r));
110
113
  }
111
- const J = (e) => ({
114
+ const X = (e) => ({
112
115
  sdkLicense: e.license,
113
116
  license: e.license,
114
117
  error: e.licenseError,
115
118
  plan: e.licensePlan
116
119
  });
117
- async function X(e) {
120
+ async function Z(e) {
118
121
  const { licenseKey: t, pluginName: o, baseApiUrl: i } = e;
119
122
  try {
120
- return (await m({
123
+ return (await z({
121
124
  baseApiUrl: i,
122
125
  path: `/sdk/${t || "na"}`,
123
126
  method: "POST",
@@ -126,19 +129,19 @@ async function X(e) {
126
129
  pn: o
127
130
  }
128
131
  })).result || {};
129
- } catch (l) {
130
- return console.error("Error during SDK license check:", l), !1;
132
+ } catch (a) {
133
+ return console.error("Error during SDK license check:", a), !1;
131
134
  }
132
135
  }
133
- const Z = (e, t) => {
136
+ const Q = (e, t) => {
134
137
  var o;
135
138
  return !!((o = e == null ? void 0 : e.hasAttribute) != null && o.call(e, t));
136
- }, Q = "iconifyComponent", S = w.startup, ee = { ratioDefault: !0, tc: !1, cl: !1, cr: !1, bc: !1 }, E = `<svg viewBox="0 0 24 24">
139
+ }, $ = "iconifyComponent", S = w.startup, ee = { ratioDefault: !0, tc: !1, cl: !1, cr: !1, bc: !1 }, E = `<svg viewBox="0 0 24 24">
137
140
  <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" />
138
- </svg>`, $ = "layout-icon-picker", te = "icons-layout-", G = "icons-list-layout", M = "gs-iconify-picker", A = "__iconify_collection", oe = "https://api.iconify.design", T = /* @__PURE__ */ new Map();
141
+ </svg>`, G = "layout-icon-picker", te = "icons-layout-", M = "icons-list-layout", U = "gs-iconify-picker", A = "__iconify_collection", oe = "https://api.iconify.design", T = /* @__PURE__ */ new Map();
139
142
  let L;
140
143
  const ne = ({ collectionId: e }) => `https://cdn.jsdelivr.net/npm/@iconify-json/${e}@latest/icons.json`;
141
- async function N({ collectionId: e, editor: t }) {
144
+ async function j({ collectionId: e, editor: t }) {
142
145
  try {
143
146
  if (T.has(e)) return T.get(e);
144
147
  const o = await fetch(ne({ collectionId: e }));
@@ -157,11 +160,11 @@ async function se({ collectionIds: e, editor: t }) {
157
160
  if (!i.ok) throw new Error(`Failed to fetch collections: ${i.statusText}`);
158
161
  return L = await i.json(), L;
159
162
  } catch (o) {
160
- console.error("Error fetching collections", o), t.runCommand(y.toastAdd, j());
163
+ console.error("Error fetching collections", o), t.runCommand(y.toastAdd, B());
161
164
  return;
162
165
  }
163
166
  }
164
- function R() {
167
+ function k() {
165
168
  return {
166
169
  type: "button",
167
170
  label: "Open Icon Picker",
@@ -176,11 +179,11 @@ function R() {
176
179
  async function ie({ collectionIds: e, editor: t, component: o }) {
177
180
  const i = await se({ collectionIds: e, editor: t });
178
181
  if (!i) return;
179
- const l = ({ icon: n, collectionId: c, iconId: p }) => {
182
+ const a = ({ icon: n, collectionId: c, iconId: p }) => {
180
183
  o.components(n), o.set({ collectionId: c, iconId: p });
181
- }, 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;
184
+ }, g = Object.entries(i).map(([n, c]) => ({ id: n, ...c })).sort((n, c) => n.name.localeCompare(c.name)), l = o.get("collectionId") ?? g[0].id;
182
185
  t.runCommand(y.layoutToggle, {
183
- id: $,
186
+ id: G,
184
187
  placer: { type: "dialog", size: "l", title: "Select Icon" },
185
188
  header: !1,
186
189
  layout: {
@@ -189,23 +192,23 @@ async function ie({ collectionIds: e, editor: t, component: o }) {
189
192
  children: [
190
193
  ce({
191
194
  collectionsList: g,
192
- collectionId: a,
195
+ collectionId: l,
193
196
  editor: t,
194
- handleClick: l
197
+ handleClick: a
195
198
  }),
196
- { id: G, type: "column", grow: !0 }
199
+ { id: M, type: "column", grow: !0 }
197
200
  ]
198
201
  }
199
202
  });
200
- const s = await N({ collectionId: a, editor: t });
201
- s && (U({ editor: t, collection: s }), P({
203
+ const s = await j({ collectionId: l, editor: t });
204
+ s && (N({ editor: t, collection: s }), P({
202
205
  editor: t,
203
206
  collection: s,
204
- handleClick: l,
205
- collectionId: a
207
+ handleClick: a,
208
+ collectionId: l
206
209
  }));
207
210
  }
208
- function U({ editor: e, collection: t }) {
211
+ function N({ editor: e, collection: t }) {
209
212
  e.em.set(A, t);
210
213
  }
211
214
  function re(e) {
@@ -218,27 +221,27 @@ function P(e) {
218
221
  layout: ae(e),
219
222
  header: !1,
220
223
  style: { height: "100%" },
221
- placer: { type: "static", layoutId: G }
224
+ placer: { type: "static", layoutId: M }
222
225
  });
223
226
  }
224
227
  function ce(e) {
225
- 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));
228
+ const { collectionsList: t, collectionId: o, editor: i, handleClick: a } = e, g = t.map(({ id: l, name: s, total: n }) => ({ id: l, label: `${s} (${n})` })).sort((l, s) => l.label.localeCompare(s.label));
226
229
  return {
227
230
  type: "column",
228
231
  style: { gap: 10 },
229
- className: `${M}__header`,
232
+ className: `${U}__header`,
230
233
  children: [
231
234
  {
232
235
  type: "selectField",
233
236
  value: o,
234
237
  options: g,
235
238
  emptyState: "Select an icon collection",
236
- onChange: async ({ setState: a, value: s }) => {
237
- const n = await N({ collectionId: s, editor: i });
238
- n && (a({ value: s }), U({ editor: i, collection: n }), P({
239
+ onChange: async ({ setState: l, value: s }) => {
240
+ const n = await j({ collectionId: s, editor: i });
241
+ n && (l({ value: s }), N({ editor: i, collection: n }), P({
239
242
  editor: i,
240
243
  collection: n,
241
- handleClick: l,
244
+ handleClick: a,
242
245
  collectionId: s
243
246
  }));
244
247
  }
@@ -248,18 +251,18 @@ function ce(e) {
248
251
  value: "",
249
252
  placeholder: "Search icons inside collection...",
250
253
  editorEvents: {
251
- [`change:${A}`]: ({ setState: a }) => a({ value: "" })
254
+ [`change:${A}`]: ({ setState: l }) => l({ value: "" })
252
255
  },
253
- onInput: ({ setState: a, value: s, editor: n }) => {
256
+ onInput: ({ setState: l, value: s, editor: n }) => {
254
257
  const c = re(n);
255
258
  if (!c) return;
256
259
  const p = Object.fromEntries(
257
260
  Object.entries(c.icons).filter(([r]) => r.includes(s))
258
261
  );
259
- a({ value: s }), P({
262
+ l({ value: s }), P({
260
263
  editor: n,
261
264
  collection: c,
262
- handleClick: l,
265
+ handleClick: a,
263
266
  collectionId: o,
264
267
  collectionFiltered: { ...c, icons: p }
265
268
  });
@@ -273,10 +276,10 @@ function ae({
273
276
  collectionFiltered: t,
274
277
  handleClick: o
275
278
  }) {
276
- const { height: i = 24, width: l = 24, icons: g, prefix: a } = t || e, s = Object.entries(g).map(([n, c]) => ({ name: n, ...c }), {});
279
+ const { height: i = 24, width: a = 24, icons: g, prefix: l } = t || e, s = Object.entries(g).map(([n, c]) => ({ name: n, ...c }), {});
277
280
  return {
278
281
  type: "column",
279
- className: `${M}__content`,
282
+ className: `${U}__content`,
280
283
  style: { height: "100%" },
281
284
  children: {
282
285
  type: "virtualList",
@@ -286,7 +289,7 @@ function ae({
286
289
  render: (c) => {
287
290
  const { editor: p, addEl: r, removeEl: h } = c, u = document.createElementNS("http://www.w3.org/2000/svg", "svg");
288
291
  u.setAttribute("xmlns", "http://www.w3.org/2000/svg"), u.innerHTML = n.body;
289
- const d = n.width || l, I = n.height || i;
292
+ const d = n.width || a, I = n.height || i;
290
293
  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;";
291
294
  const b = [
292
295
  [
@@ -295,7 +298,7 @@ function ae({
295
298
  const f = u.cloneNode(!0);
296
299
  f.removeAttribute("style");
297
300
  const v = f.outerHTML;
298
- o({ icon: v, collectionId: a, iconId: n.name }), p == null || p.runCommand(y.layoutRemove, { id: $ });
301
+ o({ icon: v, collectionId: l, iconId: n.name }), p == null || p.runCommand(y.layoutRemove, { id: G });
299
302
  }
300
303
  ],
301
304
  [
@@ -319,29 +322,29 @@ function ae({
319
322
  }
320
323
  };
321
324
  }
322
- function j() {
325
+ function B() {
323
326
  return {
324
327
  id: "toast-error-getCollections",
325
328
  header: "Error",
326
329
  content: "Error fetching collections",
327
- variant: _.Error
330
+ variant: D.Error
328
331
  };
329
332
  }
330
333
  function le() {
331
334
  return {
332
- ...j(),
335
+ ...B(),
333
336
  id: "toast-error-getCollection",
334
337
  content: "Error fetching collection"
335
338
  };
336
339
  }
337
340
  const ue = function(e, t = {}) {
338
341
  var u;
339
- 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 = {
342
+ const { Components: o, Blocks: i } = e, { collections: a, extendIconComponent: g = !0, licenseKey: l, block: s = {} } = t, n = "icon", c = "iconify", p = "Iconify", r = "data-type-iconify", h = {
340
343
  events: () => ({
341
344
  dblclick: "onActive"
342
345
  }),
343
346
  onActive() {
344
- ie({ collectionIds: l, editor: e, component: this.model });
347
+ ie({ collectionIds: a, editor: e, component: this.model });
345
348
  }
346
349
  };
347
350
  if (o.addType(c, {
@@ -353,7 +356,7 @@ const ue = function(e, t = {}) {
353
356
  activate: !0,
354
357
  ...s
355
358
  },
356
- isComponent: (d) => Z(d, r),
359
+ isComponent: (d) => Q(d, r),
357
360
  model: {
358
361
  defaults: {
359
362
  name: p,
@@ -363,7 +366,7 @@ const ue = function(e, t = {}) {
363
366
  resizable: ee,
364
367
  components: E,
365
368
  style: { width: "50px", height: "50px" },
366
- traits: [R()]
369
+ traits: [k()]
367
370
  },
368
371
  init() {
369
372
  this.listenTo(this.components(), "change add", this.disableLayers), this.disableLayers();
@@ -378,22 +381,22 @@ const ue = function(e, t = {}) {
378
381
  o.addType(n, {
379
382
  model: {
380
383
  defaults: {
381
- traits: [I, b, R(), ...f]
384
+ traits: [I, b, k(), ...f]
382
385
  }
383
386
  },
384
387
  view: h
385
388
  });
386
389
  }
387
- q({
390
+ m({
388
391
  editor: e,
389
- licenseKey: a,
392
+ licenseKey: l,
390
393
  plan: S,
391
- pluginName: Q,
394
+ pluginName: $,
392
395
  cleanup: () => {
393
396
  i.remove(c), o.removeType(c);
394
397
  }
395
398
  });
396
- }, pe = z(ue);
399
+ }, pe = J(ue, $);
397
400
  export {
398
401
  pe as default
399
402
  };
@@ -0,0 +1,3 @@
1
+ "use strict";const R="app.grapesjs.com",_="app-stage.grapesjs.com",H="app2.grapesjs.com",F="app-stage2.grapesjs.com",O=[R,H,_,F,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io",".claudemcpcontent.com",".web-sandbox.oaiusercontent.com"],C="license:check:end",W=()=>typeof window<"u",K=({isDev:e,isStage:t,isPlatform:o})=>`${e?"":`https://${t?_:R}`}/${o?"platform-api":"api"}`,V=()=>{if(!W())return"";const{hostname:e}=window.location;if(e)return e;try{return window.parent.location.hostname||""}catch{return""}},Y=()=>{const e=V();return!!e&&(O.includes(e)||O.some(t=>e.endsWith(t)))};async function z({path:e,baseApiUrl:t,method:o="GET",headers:i={},params:a,body:g}){const s=`${t||K({isDev:!1,isStage:!1})}${e}`,n={method:o,headers:{"Content-Type":"application/json",...i}};g&&(n.body=JSON.stringify(g));const c=a?new URLSearchParams(a).toString():"",p=c?`?${c}`:"",r=await fetch(`${s}${p}`,n);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return r.json()}var w=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(w||{}),D=(e=>(e.Info="info",e.Error="error",e.Success="success",e.Warning="warning",e))(D||{}),y=(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.openEditCode="studio:openEditCode",e.openBlocks="studio:openBlocks",e.appendComponent="studio:appendComponent",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||{});const x={[w.free]:0,[w.startup]:10,[w.business]:20,[w.enterprise]:30};function q(e,t){const o=e;return o.init=i=>{const a=g=>e(g,i);return a.__gjsPluginId=t,a},o}const J=(e,t)=>q(e,t);async function m({editor:e,plan:t,pluginName:o,licenseKey:i,onLicenseCheckResponse:a,cleanup:g}){let l="",s;const n=r=>{console.warn("Cleanup plugin:",o,"Reason:",r),g(e,o)},c=(r={})=>{var b;const{error:h,sdkLicense:u}=r,d=(b=r.plan)==null?void 0:b.category;if(!(u||r.license)||h)n(h||"Invalid license");else if(d){const f=x[t],v=x[d];f>v&&n({pluginRequiredPlan:t,licensePlan:d})}};e.Commands.has(y.settings)&&(s=e.runCommand(y.settings),l=(s==null?void 0:s.baseUrl)||"");const p=r=>{a==null||a(r),r&&c(r)};if(!s){e.onReady(async()=>{if(!Y())if(i){const r=await Z({licenseKey:i,pluginName:o,baseApiUrl:l});p(r)}else n("The `licenseKey` option not provided")});return}if(s.licensePlan||s.licenseError){const r=X(s);p(r);return}e.on(C,r=>p(r))}const X=e=>({sdkLicense:e.license,license:e.license,error:e.licenseError,plan:e.licensePlan});async function Z(e){const{licenseKey:t,pluginName:o,baseApiUrl:i}=e;try{return(await z({baseApiUrl:i,path:`/sdk/${t||"na"}`,method:"POST",params:{d:window.location.hostname,pn:o}})).result||{}}catch(a){return console.error("Error during SDK license check:",a),!1}}const Q=(e,t)=>{var o;return!!((o=e==null?void 0:e.hasAttribute)!=null&&o.call(e,t))},$="iconifyComponent",S=w.startup,ee={ratioDefault:!0,tc:!1,cl:!1,cr:!1,bc:!1},E=`<svg viewBox="0 0 24 24">
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>`,G="layout-icon-picker",te="icons-layout-",M="icons-list-layout",U="gs-iconify-picker",A="__iconify_collection",oe="https://api.iconify.design",T=new Map;let L;const ne=({collectionId:e})=>`https://cdn.jsdelivr.net/npm/@iconify-json/${e}@latest/icons.json`;async function j({collectionId:e,editor:t}){try{if(T.has(e))return T.get(e);const o=await fetch(ne({collectionId:e}));if(!o.ok)throw new Error(`Failed to fetch collection: ${o.statusText}`);const i=await o.json();return T.set(e,i),i}catch(o){console.error("Error fetching collection",o),t.runCommand(y.toastAdd,le());return}}async function se({collectionIds:e,editor:t}){try{if(L)return L;const o=e?`?prefixes=${e.join(",")}`:"",i=await fetch(`${oe}/collections${o}`);if(!i.ok)throw new Error(`Failed to fetch collections: ${i.statusText}`);return L=await i.json(),L}catch(o){console.error("Error fetching collections",o),t.runCommand(y.toastAdd,B());return}}function k(){return{type:"button",label:"Open Icon Picker",name:"onActive",changeProp:!0,command(e){var t;(t=e.getSelected())==null||t.trigger("active")}}}async function ie({collectionIds:e,editor:t,component:o}){const i=await se({collectionIds:e,editor:t});if(!i)return;const a=({icon:n,collectionId:c,iconId:p})=>{o.components(n),o.set({collectionId:c,iconId:p})},g=Object.entries(i).map(([n,c])=>({id:n,...c})).sort((n,c)=>n.name.localeCompare(c.name)),l=o.get("collectionId")??g[0].id;t.runCommand(y.layoutToggle,{id:G,placer:{type:"dialog",size:"l",title:"Select Icon"},header:!1,layout:{type:"column",style:{height:500,gap:10},children:[ce({collectionsList:g,collectionId:l,editor:t,handleClick:a}),{id:M,type:"column",grow:!0}]}});const s=await j({collectionId:l,editor:t});s&&(N({editor:t,collection:s}),P({editor:t,collection:s,handleClick:a,collectionId:l}))}function N({editor:e,collection:t}){e.em.set(A,t)}function re(e){return e.em.get(A)}function P(e){const{editor:t}=e;t.runCommand(y.layoutUpdate,{id:te,layout:ae(e),header:!1,style:{height:"100%"},placer:{type:"static",layoutId:M}})}function ce(e){const{collectionsList:t,collectionId:o,editor:i,handleClick:a}=e,g=t.map(({id:l,name:s,total:n})=>({id:l,label:`${s} (${n})`})).sort((l,s)=>l.label.localeCompare(s.label));return{type:"column",style:{gap:10},className:`${U}__header`,children:[{type:"selectField",value:o,options:g,emptyState:"Select an icon collection",onChange:async({setState:l,value:s})=>{const n=await j({collectionId:s,editor:i});n&&(l({value:s}),N({editor:i,collection:n}),P({editor:i,collection:n,handleClick:a,collectionId:s}))}},{type:"inputField",value:"",placeholder:"Search icons inside collection...",editorEvents:{[`change:${A}`]:({setState:l})=>l({value:""})},onInput:({setState:l,value:s,editor:n})=>{const c=re(n);if(!c)return;const p=Object.fromEntries(Object.entries(c.icons).filter(([r])=>r.includes(s)));l({value:s}),P({editor:n,collection:c,handleClick:a,collectionId:o,collectionFiltered:{...c,icons:p}})}}]}}function ae({collection:e,collectionFiltered:t,handleClick:o}){const{height:i=24,width:a=24,icons:g,prefix:l}=t||e,s=Object.entries(g).map(([n,c])=>({name:n,...c}),{});return{type:"column",className:`${U}__content`,style:{height:"100%"},children:{type:"virtualList",items:s,itemLayout:({item:n})=>({type:"custom",render:c=>{const{editor:p,addEl:r,removeEl:h}=c,u=document.createElementNS("http://www.w3.org/2000/svg","svg");u.setAttribute("xmlns","http://www.w3.org/2000/svg"),u.innerHTML=n.body;const d=n.width||a,I=n.height||i;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;";const b=[["click",()=>{const f=u.cloneNode(!0);f.removeAttribute("style");const v=f.outerHTML;o({icon:v,collectionId:l,iconId:n.name}),p==null||p.runCommand(y.layoutRemove,{id:G})}],["pointerover",()=>{u.style.border="2px solid currentColor",u.style.padding="4px"}],["pointerout",()=>{u.style.border="",u.style.padding=""}]];return b.forEach(([f,v])=>u.addEventListener(f,v)),r(u),()=>{b.forEach(([f,v])=>u.removeEventListener(f,v)),h(u)}}})}}}function B(){return{id:"toast-error-getCollections",header:"Error",content:"Error fetching collections",variant:D.Error}}function le(){return{...B(),id:"toast-error-getCollection",content:"Error fetching collection"}}const ue=function(e,t={}){var u;const{Components:o,Blocks:i}=e,{collections:a,extendIconComponent:g=!0,licenseKey:l,block:s={}}=t,n="icon",c="iconify",p="Iconify",r="data-type-iconify",h={events:()=>({dblclick:"onActive"}),onActive(){ie({collectionIds:a,editor:e,component:this.model})}};if(o.addType(c,{block:s&&{label:p,media:E,content:{type:c},category:"Extra",activate:!0,...s},isComponent:d=>Q(d,r),model:{defaults:{name:p,icon:E,droppable:!1,attributes:{[r]:!0},resizable:ee,components:E,style:{width:"50px",height:"50px"},traits:[k()]},init(){this.listenTo(this.components(),"change add",this.disableLayers),this.disableLayers()},disableLayers(){this.components().forEach(d=>d.set({layerable:!1,locked:!0}))}},view:h}),g){const d=(u=o.getType(n))==null?void 0:u.model,[I,b,...f]=d.getDefaults().traits;o.addType(n,{model:{defaults:{traits:[I,b,k(),...f]}},view:h})}m({editor:e,licenseKey:l,plan:S,pluginName:$,cleanup:()=>{i.remove(c),o.removeType(c)}})},pe=J(ue,$);module.exports=pe;
@@ -1,3 +1,3 @@
1
- (function(w,I){typeof exports=="object"&&typeof module<"u"?module.exports=I():typeof define=="function"&&define.amd?define(I):(w=typeof globalThis<"u"?globalThis:w||self,w.StudioSdkPlugins_iconifyComponent=I())})(this,function(){"use strict";const w="app.grapesjs.com",I="app-stage.grapesjs.com",D=[w,"app2.grapesjs.com",I,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io",".claudemcpcontent.com",".web-sandbox.oaiusercontent.com"],B="license:check:end",H=()=>typeof window<"u",C=({isDev:e,isStage:t,isPlatform:o})=>`${e?"":`https://${t?I:w}`}/${o?"platform-api":"api"}`,F=()=>{if(!H())return"";const{hostname:e}=window.location;if(e)return e;try{return window.parent.location.hostname||""}catch{return""}},W=()=>{const e=F();return!!e&&(D.includes(e)||D.some(t=>e.endsWith(t)))};async function m({path:e,baseApiUrl:t,method:o="GET",headers:i={},params:l,body:d}){const s=`${t||C({isDev:!1,isStage:!1})}${e}`,n={method:o,headers:{"Content-Type":"application/json",...i}};d&&(n.body=JSON.stringify(d));const c=l?new URLSearchParams(l).toString():"",p=c?`?${c}`:"",r=await fetch(`${s}${p}`,n);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return r.json()}var T=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(T||{}),R=(e=>(e.Info="info",e.Error="error",e.Success="success",e.Warning="warning",e))(R||{}),y=(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.openEditCode="studio:openEditCode",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||{});const _={[T.free]:0,[T.startup]:10,[T.business]:20,[T.enterprise]:30};function K(e){const t=e;return t.init=o=>i=>e(i,o),t}const V=e=>K(e);async function Y({editor:e,plan:t,pluginName:o,licenseKey:i,onLicenseCheckResponse:l,cleanup:d}){let a="",s;const n=r=>{console.warn("Cleanup plugin:",o,"Reason:",r),d()},c=(r={})=>{var b;const{error:h,sdkLicense:u}=r,g=(b=r.plan)==null?void 0:b.category;if(!(u||r.license)||h)n(h||"Invalid license");else if(g){const f=_[t],v=_[g];f>v&&n({pluginRequiredPlan:t,licensePlan:g})}};e.Commands.has(y.settings)&&(s=e.runCommand(y.settings),a=(s==null?void 0:s.baseUrl)||"");const p=r=>{l==null||l(r),r&&c(r)};if(!s){e.onReady(async()=>{if(!W())if(i){const r=await q({licenseKey:i,pluginName:o,baseApiUrl:a});p(r)}else n("The `licenseKey` option not provided")});return}if(s.licensePlan||s.licenseError){const r=z(s);p(r);return}e.on(B,r=>p(r))}const z=e=>({sdkLicense:e.license,license:e.license,error:e.licenseError,plan:e.licensePlan});async function q(e){const{licenseKey:t,pluginName:o,baseApiUrl:i}=e;try{return(await m({baseApiUrl:i,path:`/sdk/${t||"na"}`,method:"POST",params:{d:window.location.hostname,pn:o}})).result||{}}catch(l){return console.error("Error during SDK license check:",l),!1}}const J=(e,t)=>{var o;return!!((o=e==null?void 0:e.hasAttribute)!=null&&o.call(e,t))},X="iconifyComponent",Z=T.startup,Q={ratioDefault:!0,tc:!1,cl:!1,cr:!1,bc:!1},P=`<svg viewBox="0 0 24 24">
1
+ (function(w,I){typeof exports=="object"&&typeof module<"u"?module.exports=I():typeof define=="function"&&define.amd?define(I):(w=typeof globalThis<"u"?globalThis:w||self,w.StudioSdkPlugins_iconifyComponent=I())})(this,function(){"use strict";const w="app.grapesjs.com",I="app-stage.grapesjs.com",_=[w,"app2.grapesjs.com",I,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io",".claudemcpcontent.com",".web-sandbox.oaiusercontent.com"],H="license:check:end",C=()=>typeof window<"u",F=({isDev:e,isStage:t,isPlatform:o})=>`${e?"":`https://${t?I:w}`}/${o?"platform-api":"api"}`,W=()=>{if(!C())return"";const{hostname:e}=window.location;if(e)return e;try{return window.parent.location.hostname||""}catch{return""}},K=()=>{const e=W();return!!e&&(_.includes(e)||_.some(t=>e.endsWith(t)))};async function m({path:e,baseApiUrl:t,method:o="GET",headers:i={},params:a,body:g}){const s=`${t||F({isDev:!1,isStage:!1})}${e}`,n={method:o,headers:{"Content-Type":"application/json",...i}};g&&(n.body=JSON.stringify(g));const c=a?new URLSearchParams(a).toString():"",p=c?`?${c}`:"",r=await fetch(`${s}${p}`,n);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return r.json()}var T=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(T||{}),k=(e=>(e.Info="info",e.Error="error",e.Success="success",e.Warning="warning",e))(k||{}),y=(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.openEditCode="studio:openEditCode",e.openBlocks="studio:openBlocks",e.appendComponent="studio:appendComponent",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||{});const D={[T.free]:0,[T.startup]:10,[T.business]:20,[T.enterprise]:30};function V(e,t){const o=e;return o.init=i=>{const a=g=>e(g,i);return a.__gjsPluginId=t,a},o}const Y=(e,t)=>V(e,t);async function z({editor:e,plan:t,pluginName:o,licenseKey:i,onLicenseCheckResponse:a,cleanup:g}){let l="",s;const n=r=>{console.warn("Cleanup plugin:",o,"Reason:",r),g(e,o)},c=(r={})=>{var b;const{error:h,sdkLicense:u}=r,d=(b=r.plan)==null?void 0:b.category;if(!(u||r.license)||h)n(h||"Invalid license");else if(d){const f=D[t],v=D[d];f>v&&n({pluginRequiredPlan:t,licensePlan:d})}};e.Commands.has(y.settings)&&(s=e.runCommand(y.settings),l=(s==null?void 0:s.baseUrl)||"");const p=r=>{a==null||a(r),r&&c(r)};if(!s){e.onReady(async()=>{if(!K())if(i){const r=await J({licenseKey:i,pluginName:o,baseApiUrl:l});p(r)}else n("The `licenseKey` option not provided")});return}if(s.licensePlan||s.licenseError){const r=q(s);p(r);return}e.on(H,r=>p(r))}const q=e=>({sdkLicense:e.license,license:e.license,error:e.licenseError,plan:e.licensePlan});async function J(e){const{licenseKey:t,pluginName:o,baseApiUrl:i}=e;try{return(await m({baseApiUrl:i,path:`/sdk/${t||"na"}`,method:"POST",params:{d:window.location.hostname,pn:o}})).result||{}}catch(a){return console.error("Error during SDK license check:",a),!1}}const X=(e,t)=>{var o;return!!((o=e==null?void 0:e.hasAttribute)!=null&&o.call(e,t))},R="iconifyComponent",Z=T.startup,Q={ratioDefault:!0,tc:!1,cl:!1,cr:!1,bc:!1},P=`<svg viewBox="0 0 24 24">
2
2
  <path d="M19 0H9C7.9 0 7 .9 7 2V18C7 19.1 7.9 20 9 20H19C20.1 20 21 19.1 21 18V2C21 .9 20.1 0 19 0M19 18H9V2H19V18M3 4V22C3 23.1 3.9 24 5 24H17V22H5V4H3M14 5L11 10L14 15L17 10L14 5Z" />
3
- </svg>`,k="layout-icon-picker",S="icons-layout-",M="icons-list-layout",$="gs-iconify-picker",A="__iconify_collection",ee="https://api.iconify.design",O=new Map;let E;const te=({collectionId:e})=>`https://cdn.jsdelivr.net/npm/@iconify-json/${e}@latest/icons.json`;async function G({collectionId:e,editor:t}){try{if(O.has(e))return O.get(e);const o=await fetch(te({collectionId:e}));if(!o.ok)throw new Error(`Failed to fetch collection: ${o.statusText}`);const i=await o.json();return O.set(e,i),i}catch(o){console.error("Error fetching collection",o),t.runCommand(y.toastAdd,ce());return}}async function oe({collectionIds:e,editor:t}){try{if(E)return E;const o=e?`?prefixes=${e.join(",")}`:"",i=await fetch(`${ee}/collections${o}`);if(!i.ok)throw new Error(`Failed to fetch collections: ${i.statusText}`);return E=await i.json(),E}catch(o){console.error("Error fetching collections",o),t.runCommand(y.toastAdd,j());return}}function N(){return{type:"button",label:"Open Icon Picker",name:"onActive",changeProp:!0,command(e){var t;(t=e.getSelected())==null||t.trigger("active")}}}async function ne({collectionIds:e,editor:t,component:o}){const i=await oe({collectionIds:e,editor:t});if(!i)return;const l=({icon:n,collectionId:c,iconId:p})=>{o.components(n),o.set({collectionId:c,iconId:p})},d=Object.entries(i).map(([n,c])=>({id:n,...c})).sort((n,c)=>n.name.localeCompare(c.name)),a=o.get("collectionId")??d[0].id;t.runCommand(y.layoutToggle,{id:k,placer:{type:"dialog",size:"l",title:"Select Icon"},header:!1,layout:{type:"column",style:{height:500,gap:10},children:[ie({collectionsList:d,collectionId:a,editor:t,handleClick:l}),{id:M,type:"column",grow:!0}]}});const s=await G({collectionId:a,editor:t});s&&(U({editor:t,collection:s}),x({editor:t,collection:s,handleClick:l,collectionId:a}))}function U({editor:e,collection:t}){e.em.set(A,t)}function se(e){return e.em.get(A)}function x(e){const{editor:t}=e;t.runCommand(y.layoutUpdate,{id:S,layout:re(e),header:!1,style:{height:"100%"},placer:{type:"static",layoutId:M}})}function ie(e){const{collectionsList:t,collectionId:o,editor:i,handleClick:l}=e,d=t.map(({id:a,name:s,total:n})=>({id:a,label:`${s} (${n})`})).sort((a,s)=>a.label.localeCompare(s.label));return{type:"column",style:{gap:10},className:`${$}__header`,children:[{type:"selectField",value:o,options:d,emptyState:"Select an icon collection",onChange:async({setState:a,value:s})=>{const n=await G({collectionId:s,editor:i});n&&(a({value:s}),U({editor:i,collection:n}),x({editor:i,collection:n,handleClick:l,collectionId:s}))}},{type:"inputField",value:"",placeholder:"Search icons inside collection...",editorEvents:{[`change:${A}`]:({setState:a})=>a({value:""})},onInput:({setState:a,value:s,editor:n})=>{const c=se(n);if(!c)return;const p=Object.fromEntries(Object.entries(c.icons).filter(([r])=>r.includes(s)));a({value:s}),x({editor:n,collection:c,handleClick:l,collectionId:o,collectionFiltered:{...c,icons:p}})}}]}}function re({collection:e,collectionFiltered:t,handleClick:o}){const{height:i=24,width:l=24,icons:d,prefix:a}=t||e,s=Object.entries(d).map(([n,c])=>({name:n,...c}),{});return{type:"column",className:`${$}__content`,style:{height:"100%"},children:{type:"virtualList",items:s,itemLayout:({item:n})=>({type:"custom",render:c=>{const{editor:p,addEl:r,removeEl:h}=c,u=document.createElementNS("http://www.w3.org/2000/svg","svg");u.setAttribute("xmlns","http://www.w3.org/2000/svg"),u.innerHTML=n.body;const g=n.width||l,L=n.height||i;u.setAttribute("viewBox",`0 0 ${g} ${L}`),u.style.cssText="width: 48px; height: 48px; cursor: pointer; border-radius: 4px; transition: padding 0.1s ease-in-out;";const b=[["click",()=>{const f=u.cloneNode(!0);f.removeAttribute("style");const v=f.outerHTML;o({icon:v,collectionId:a,iconId:n.name}),p==null||p.runCommand(y.layoutRemove,{id:k})}],["pointerover",()=>{u.style.border="2px solid currentColor",u.style.padding="4px"}],["pointerout",()=>{u.style.border="",u.style.padding=""}]];return b.forEach(([f,v])=>u.addEventListener(f,v)),r(u),()=>{b.forEach(([f,v])=>u.removeEventListener(f,v)),h(u)}}})}}}function j(){return{id:"toast-error-getCollections",header:"Error",content:"Error fetching collections",variant:R.Error}}function ce(){return{...j(),id:"toast-error-getCollection",content:"Error fetching collection"}}return V(function(e,t={}){var u;const{Components:o,Blocks:i}=e,{collections:l,extendIconComponent:d=!0,licenseKey:a,block:s={}}=t,n="icon",c="iconify",p="Iconify",r="data-type-iconify",h={events:()=>({dblclick:"onActive"}),onActive(){ne({collectionIds:l,editor:e,component:this.model})}};if(o.addType(c,{block:s&&{label:p,media:P,content:{type:c},category:"Extra",activate:!0,...s},isComponent:g=>J(g,r),model:{defaults:{name:p,icon:P,droppable:!1,attributes:{[r]:!0},resizable:Q,components:P,style:{width:"50px",height:"50px"},traits:[N()]},init(){this.listenTo(this.components(),"change add",this.disableLayers),this.disableLayers()},disableLayers(){this.components().forEach(g=>g.set({layerable:!1,locked:!0}))}},view:h}),d){const g=(u=o.getType(n))==null?void 0:u.model,[L,b,...f]=g.getDefaults().traits;o.addType(n,{model:{defaults:{traits:[L,b,N(),...f]}},view:h})}Y({editor:e,licenseKey:a,plan:Z,pluginName:X,cleanup:()=>{i.remove(c),o.removeType(c)}})})});
3
+ </svg>`,M="layout-icon-picker",S="icons-layout-",$="icons-list-layout",G="gs-iconify-picker",A="__iconify_collection",ee="https://api.iconify.design",O=new Map;let E;const te=({collectionId:e})=>`https://cdn.jsdelivr.net/npm/@iconify-json/${e}@latest/icons.json`;async function N({collectionId:e,editor:t}){try{if(O.has(e))return O.get(e);const o=await fetch(te({collectionId:e}));if(!o.ok)throw new Error(`Failed to fetch collection: ${o.statusText}`);const i=await o.json();return O.set(e,i),i}catch(o){console.error("Error fetching collection",o),t.runCommand(y.toastAdd,ce());return}}async function oe({collectionIds:e,editor:t}){try{if(E)return E;const o=e?`?prefixes=${e.join(",")}`:"",i=await fetch(`${ee}/collections${o}`);if(!i.ok)throw new Error(`Failed to fetch collections: ${i.statusText}`);return E=await i.json(),E}catch(o){console.error("Error fetching collections",o),t.runCommand(y.toastAdd,B());return}}function j(){return{type:"button",label:"Open Icon Picker",name:"onActive",changeProp:!0,command(e){var t;(t=e.getSelected())==null||t.trigger("active")}}}async function ne({collectionIds:e,editor:t,component:o}){const i=await oe({collectionIds:e,editor:t});if(!i)return;const a=({icon:n,collectionId:c,iconId:p})=>{o.components(n),o.set({collectionId:c,iconId:p})},g=Object.entries(i).map(([n,c])=>({id:n,...c})).sort((n,c)=>n.name.localeCompare(c.name)),l=o.get("collectionId")??g[0].id;t.runCommand(y.layoutToggle,{id:M,placer:{type:"dialog",size:"l",title:"Select Icon"},header:!1,layout:{type:"column",style:{height:500,gap:10},children:[ie({collectionsList:g,collectionId:l,editor:t,handleClick:a}),{id:$,type:"column",grow:!0}]}});const s=await N({collectionId:l,editor:t});s&&(U({editor:t,collection:s}),x({editor:t,collection:s,handleClick:a,collectionId:l}))}function U({editor:e,collection:t}){e.em.set(A,t)}function se(e){return e.em.get(A)}function x(e){const{editor:t}=e;t.runCommand(y.layoutUpdate,{id:S,layout:re(e),header:!1,style:{height:"100%"},placer:{type:"static",layoutId:$}})}function ie(e){const{collectionsList:t,collectionId:o,editor:i,handleClick:a}=e,g=t.map(({id:l,name:s,total:n})=>({id:l,label:`${s} (${n})`})).sort((l,s)=>l.label.localeCompare(s.label));return{type:"column",style:{gap:10},className:`${G}__header`,children:[{type:"selectField",value:o,options:g,emptyState:"Select an icon collection",onChange:async({setState:l,value:s})=>{const n=await N({collectionId:s,editor:i});n&&(l({value:s}),U({editor:i,collection:n}),x({editor:i,collection:n,handleClick:a,collectionId:s}))}},{type:"inputField",value:"",placeholder:"Search icons inside collection...",editorEvents:{[`change:${A}`]:({setState:l})=>l({value:""})},onInput:({setState:l,value:s,editor:n})=>{const c=se(n);if(!c)return;const p=Object.fromEntries(Object.entries(c.icons).filter(([r])=>r.includes(s)));l({value:s}),x({editor:n,collection:c,handleClick:a,collectionId:o,collectionFiltered:{...c,icons:p}})}}]}}function re({collection:e,collectionFiltered:t,handleClick:o}){const{height:i=24,width:a=24,icons:g,prefix:l}=t||e,s=Object.entries(g).map(([n,c])=>({name:n,...c}),{});return{type:"column",className:`${G}__content`,style:{height:"100%"},children:{type:"virtualList",items:s,itemLayout:({item:n})=>({type:"custom",render:c=>{const{editor:p,addEl:r,removeEl:h}=c,u=document.createElementNS("http://www.w3.org/2000/svg","svg");u.setAttribute("xmlns","http://www.w3.org/2000/svg"),u.innerHTML=n.body;const d=n.width||a,L=n.height||i;u.setAttribute("viewBox",`0 0 ${d} ${L}`),u.style.cssText="width: 48px; height: 48px; cursor: pointer; border-radius: 4px; transition: padding 0.1s ease-in-out;";const b=[["click",()=>{const f=u.cloneNode(!0);f.removeAttribute("style");const v=f.outerHTML;o({icon:v,collectionId:l,iconId:n.name}),p==null||p.runCommand(y.layoutRemove,{id:M})}],["pointerover",()=>{u.style.border="2px solid currentColor",u.style.padding="4px"}],["pointerout",()=>{u.style.border="",u.style.padding=""}]];return b.forEach(([f,v])=>u.addEventListener(f,v)),r(u),()=>{b.forEach(([f,v])=>u.removeEventListener(f,v)),h(u)}}})}}}function B(){return{id:"toast-error-getCollections",header:"Error",content:"Error fetching collections",variant:k.Error}}function ce(){return{...B(),id:"toast-error-getCollection",content:"Error fetching collection"}}return Y(function(e,t={}){var u;const{Components:o,Blocks:i}=e,{collections:a,extendIconComponent:g=!0,licenseKey:l,block:s={}}=t,n="icon",c="iconify",p="Iconify",r="data-type-iconify",h={events:()=>({dblclick:"onActive"}),onActive(){ne({collectionIds:a,editor:e,component:this.model})}};if(o.addType(c,{block:s&&{label:p,media:P,content:{type:c},category:"Extra",activate:!0,...s},isComponent:d=>X(d,r),model:{defaults:{name:p,icon:P,droppable:!1,attributes:{[r]:!0},resizable:Q,components:P,style:{width:"50px",height:"50px"},traits:[j()]},init(){this.listenTo(this.components(),"change add",this.disableLayers),this.disableLayers()},disableLayers(){this.components().forEach(d=>d.set({layerable:!1,locked:!0}))}},view:h}),g){const d=(u=o.getType(n))==null?void 0:u.model,[L,b,...f]=d.getDefaults().traits;o.addType(n,{model:{defaults:{traits:[L,b,j(),...f]}},view:h})}z({editor:e,licenseKey:l,plan:Z,pluginName:R,cleanup:()=>{i.remove(c),o.removeType(c)}})},R)});
@@ -17,6 +17,7 @@ export { default as canvasGridMode } from './canvasGridMode';
17
17
  export { default as canvasScreenshot } from './canvasScreenshot';
18
18
  export { default as layoutSidebarButtons } from './layoutSidebarButtons';
19
19
  export { default as presetPrintable } from './presetPrintable';
20
+ export { default as presetBlockLibrary } from './presetBlockLibrary';
20
21
  export { default as dataSourceEjs } from './dataSourceEjs';
21
22
  export { default as dataSourceHandlebars } from './dataSourceHandlebars';
22
23
  export { default as youtubeAssetProvider } from './youtubeAssetProvider';