@grapesjs/studio-sdk-plugins 1.0.33-rc.1 → 1.0.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/dist/accordionComponent/index.cjs.js +7 -7
  2. package/dist/accordionComponent/index.es.js +161 -156
  3. package/dist/accordionComponent/index.umd.js +9 -9
  4. package/dist/aiChat/chatManager.d.ts +15 -0
  5. package/dist/aiChat/clientTools.d.ts +3 -3
  6. package/dist/aiChat/clientToolsProcessors.d.ts +14 -1
  7. package/dist/aiChat/components/AiChatEmptyState.d.ts +4 -6
  8. package/dist/aiChat/components/AiChatError.d.ts +2 -1
  9. package/dist/aiChat/components/AiChatHeader.d.ts +2 -1
  10. package/dist/aiChat/components/AiChatInput/AssetsSection.d.ts +7 -0
  11. package/dist/aiChat/components/AiChatInput/AttachButton.d.ts +10 -0
  12. package/dist/aiChat/components/AiChatInput/ContextSection.d.ts +5 -0
  13. package/dist/aiChat/components/AiChatInput/DictateButton.d.ts +7 -0
  14. package/dist/aiChat/components/AiChatInput/TextAreaWithAutoResize.d.ts +6 -0
  15. package/dist/aiChat/components/AiChatInput/constants.d.ts +6 -0
  16. package/dist/aiChat/components/AiChatInput/hooks/useSpeechToText.d.ts +15 -0
  17. package/dist/aiChat/components/AiChatInput/index.d.ts +37 -0
  18. package/dist/aiChat/components/AiChatLoadingState.d.ts +2 -1
  19. package/dist/aiChat/components/AiChatMessage.d.ts +21 -9
  20. package/dist/aiChat/components/AiChatMessages.d.ts +5 -7
  21. package/dist/aiChat/components/AiChatMessagesStatus.d.ts +5 -0
  22. package/dist/aiChat/components/AiChatPanel.d.ts +2 -3
  23. package/dist/aiChat/components/AiChatProvider.d.ts +14 -0
  24. package/dist/aiChat/components/MemoizedMarkdown.d.ts +9 -0
  25. package/dist/aiChat/components/index.d.ts +24 -25
  26. package/dist/aiChat/components/utils.d.ts +12 -4
  27. package/dist/aiChat/index.cjs.d.ts +5 -0
  28. package/dist/aiChat/index.cjs.js +453 -0
  29. package/dist/aiChat/index.d.ts +4 -3
  30. package/dist/aiChat/index.es.d.ts +5 -0
  31. package/dist/aiChat/index.es.js +30930 -0
  32. package/dist/aiChat/index.js +453 -0
  33. package/dist/aiChat/index.umd.js +453 -0
  34. package/dist/aiChat/locales/en.d.ts +64 -0
  35. package/dist/aiChat/server/index.cjs.d.ts +4 -0
  36. package/dist/aiChat/server/index.cjs.js +309 -0
  37. package/dist/aiChat/server/index.d.ts +0 -50
  38. package/dist/aiChat/server/index.es.d.ts +4 -0
  39. package/dist/aiChat/server/index.es.js +876 -0
  40. package/dist/aiChat/server/index.js +309 -0
  41. package/dist/aiChat/server/index.umd.js +309 -0
  42. package/dist/aiChat/server/stream.d.ts +0 -6
  43. package/dist/aiChat/server/tools.d.ts +157 -51
  44. package/dist/aiChat/server/types.d.ts +108 -64
  45. package/dist/aiChat/types.d.ts +148 -108
  46. package/dist/aiChat/typesSchema.d.ts +238 -25
  47. package/dist/animationComponent/index.cjs.js +3 -3
  48. package/dist/animationComponent/index.es.js +174 -169
  49. package/dist/animationComponent/index.umd.js +3 -3
  50. package/dist/canvasAbsoluteMode/index.cjs.js +1 -1
  51. package/dist/canvasAbsoluteMode/index.es.js +161 -156
  52. package/dist/canvasAbsoluteMode/index.umd.js +1 -1
  53. package/dist/canvasEmptyState/index.cjs.js +1 -1
  54. package/dist/canvasEmptyState/index.es.js +113 -108
  55. package/dist/canvasEmptyState/index.umd.js +1 -1
  56. package/dist/canvasFullSize/index.cjs.js +9 -9
  57. package/dist/canvasFullSize/index.es.js +137 -132
  58. package/dist/canvasFullSize/index.umd.js +9 -9
  59. package/dist/canvasGridMode/index.cjs.js +4 -4
  60. package/dist/canvasGridMode/index.es.js +168 -163
  61. package/dist/canvasGridMode/index.umd.js +8 -8
  62. package/dist/canvasScreenshot/index.cjs.js +1 -1
  63. package/dist/canvasScreenshot/index.es.js +132 -127
  64. package/dist/canvasScreenshot/index.umd.js +1 -1
  65. package/dist/dataSourceEjs/index.cjs.js +5 -5
  66. package/dist/dataSourceEjs/index.es.js +151 -146
  67. package/dist/dataSourceEjs/index.umd.js +5 -5
  68. package/dist/dataSourceHandlebars/index.cjs.js +4 -4
  69. package/dist/dataSourceHandlebars/index.es.js +91 -86
  70. package/dist/dataSourceHandlebars/index.umd.js +5 -5
  71. package/dist/dialogComponent/index.cjs.js +16 -16
  72. package/dist/dialogComponent/index.es.js +117 -112
  73. package/dist/dialogComponent/index.umd.js +16 -16
  74. package/dist/flexComponent/index.cjs.js +11 -11
  75. package/dist/flexComponent/index.es.js +416 -411
  76. package/dist/flexComponent/index.umd.js +11 -11
  77. package/dist/fsLightboxComponent/index.cjs.js +3 -3
  78. package/dist/fsLightboxComponent/index.es.js +152 -147
  79. package/dist/fsLightboxComponent/index.umd.js +3 -3
  80. package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
  81. package/dist/googleFontsAssetProvider/index.es.js +127 -122
  82. package/dist/googleFontsAssetProvider/index.umd.js +1 -1
  83. package/dist/iconifyComponent/index.cjs.js +2 -2
  84. package/dist/iconifyComponent/index.es.js +170 -165
  85. package/dist/iconifyComponent/index.umd.js +2 -2
  86. package/dist/index.cjs.js +1 -1
  87. package/dist/index.es.js +27 -22
  88. package/dist/index.umd.js +1 -1
  89. package/dist/layoutSidebarButtons/index.cjs.js +1 -1
  90. package/dist/layoutSidebarButtons/index.es.js +156 -151
  91. package/dist/layoutSidebarButtons/index.umd.js +1 -1
  92. package/dist/lightGalleryComponent/index.cjs.js +1 -1
  93. package/dist/lightGalleryComponent/index.es.js +197 -192
  94. package/dist/lightGalleryComponent/index.umd.js +1 -1
  95. package/dist/linkImageComponent/index.cjs.js +2 -2
  96. package/dist/linkImageComponent/index.es.js +86 -81
  97. package/dist/linkImageComponent/index.umd.js +2 -2
  98. package/dist/listPagesComponent/index.cjs.js +5 -5
  99. package/dist/listPagesComponent/index.es.js +121 -116
  100. package/dist/listPagesComponent/index.umd.js +5 -5
  101. package/dist/presetPrintable/index.cjs.js +4 -4
  102. package/dist/presetPrintable/index.es.js +180 -175
  103. package/dist/presetPrintable/index.umd.js +4 -4
  104. package/dist/prosemirror/index.cjs.js +6 -6
  105. package/dist/prosemirror/index.es.js +128 -123
  106. package/dist/prosemirror/index.umd.js +8 -8
  107. package/dist/rendererReact/index.cjs.js +1 -1
  108. package/dist/rendererReact/index.es.js +127 -122
  109. package/dist/rendererReact/index.js +1 -1
  110. package/dist/rendererReact/index.umd.js +1 -1
  111. package/dist/rteTinyMce/index.cjs.js +2 -2
  112. package/dist/rteTinyMce/index.es.js +160 -155
  113. package/dist/rteTinyMce/index.umd.js +2 -2
  114. package/dist/shapeDividerComponent/index.cjs.js +25 -25
  115. package/dist/shapeDividerComponent/index.es.js +127 -122
  116. package/dist/shapeDividerComponent/index.umd.js +25 -25
  117. package/dist/swiperComponent/index.cjs.js +9 -9
  118. package/dist/swiperComponent/index.es.js +197 -192
  119. package/dist/swiperComponent/index.umd.js +9 -9
  120. package/dist/tableComponent/index.cjs.js +1 -1
  121. package/dist/tableComponent/index.es.js +227 -222
  122. package/dist/tableComponent/index.umd.js +1 -1
  123. package/dist/types.d.ts +1 -1
  124. package/dist/utils.d.ts +12 -1
  125. package/dist/youtubeAssetProvider/index.cjs.js +1 -1
  126. package/dist/youtubeAssetProvider/index.es.js +124 -119
  127. package/dist/youtubeAssetProvider/index.umd.js +1 -1
  128. package/package.json +5 -2
  129. package/dist/aiChat/components/AiChatInput.d.ts +0 -17
  130. package/dist/aiChat/server/stream-utils.d.ts +0 -16
@@ -1,5 +1,5 @@
1
- (function(v,b){typeof exports=="object"&&typeof module<"u"?module.exports=b():typeof define=="function"&&define.amd?define(b):(v=typeof globalThis<"u"?globalThis:v||self,v.StudioSdkPlugins_accordionComponent=b())})(this,function(){"use strict";const v="app.grapesjs.com",b="app-stage.grapesjs.com",E=[v,"app2.grapesjs.com",b,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],H="license:check:start",I="license:check:end",N=()=>typeof window<"u",D=({isDev:e,isStage:n})=>`${e?"":`https://${n?b:v}`}/api`,P=()=>{const e=N()&&window.location.hostname;return!!e&&(E.includes(e)||E.some(n=>e.endsWith(n)))};async function z({path:e,baseApiUrl:n,method:t="GET",headers:s={},params:c,body:l}){const m=`${n||D({isDev:!1,isStage:!1})}${e}`,i={method:t,headers:{"Content-Type":"application/json",...s}};l&&(i.body=JSON.stringify(l));const r=c?new URLSearchParams(c).toString():"",o=r?`?${r}`:"",d=await fetch(`${m}${o}`,i);if(!d.ok)throw new Error(`HTTP error! status: ${d.status}`);return d.json()}var T=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(T||{});const M={[T.free]:0,[T.startup]:10,[T.business]:20,[T.enterprise]:30};function G(e){const n=e;return n.init=t=>s=>e(s,t),n}const B=e=>G(e);async function V({editor:e,plan:n,pluginName:t,licenseKey:s,cleanup:c}){let l="",p=!1;const m=P(),i=o=>{console.warn("Cleanup plugin:",t,"Reason:",o),c()},r=(o={})=>{var _;const{error:d,sdkLicense:A}=o,y=(_=o.plan)==null?void 0:_.category;if(!(A||o.license)||d)i(d||"Invalid license");else if(y){const ee=M[n],ne=M[y];ee>ne&&i({pluginRequiredPlan:n,licensePlan:y})}};e.on(H,o=>{l=o==null?void 0:o.baseApiUrl,p=!0}),e.on(I,o=>{r(o)}),setTimeout(async()=>{if(!p){if(m)return;if(s){const o=await U({licenseKey:s,pluginName:t,baseApiUrl:l});o&&r(o)}else i("The `licenseKey` option not provided")}},2e3)}async function U(e){const{licenseKey:n,pluginName:t,baseApiUrl:s}=e;try{return(await z({baseApiUrl:s,path:`/sdk/${n||"na"}`,method:"POST",params:{d:window.location.hostname,pn:t}})).result||{}}catch(c){return console.error("Error during SDK license check:",c),!1}}const C=e=>n=>{var t;return((t=n.getAttribute)==null?void 0:t.call(n,q))===e},x=(...e)=>n=>e.some(t=>n.is(t)),j=(...e)=>(n,t)=>e.some(s=>t.is(s)),w="gjs-plg-",q="data-type-role",a="accordion",k=`${a}-group`,u=`${a}-header`,h=`${a}-content`,g=`${a}-marker`,O=`${w}${u}`,$=`${w}${g}`,R=`${w}${h}`,L=`${$}-open`,f={accordion:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M5.616 20q-.691 0-1.153-.462T4 18.384V5.616q0-.691.463-1.153T5.616 4h12.769q.69 0 1.153.463T20 5.616v12.769q0 .69-.462 1.153T18.384 20zm0-1h12.769q.23 0 .423-.192t.192-.424V8.154H5v10.23q0 .232.192.424t.423.192"/></svg>',accordionGroup:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M8.116 16h10.769q.23 0 .423-.192t.192-.423V6h-12v9.385q0 .23.192.423t.423.192m0 1q-.69 0-1.153-.462T6.5 15.385V4.615q0-.69.463-1.153T8.116 3h10.769q.69 0 1.153.462t.462 1.153v10.77q0 .69-.462 1.152T18.884 17zm-3 3q-.69 0-1.153-.462T3.5 18.385V6.615h1v11.77q0 .23.192.423t.423.192h11.77v1zM7.5 4v12z"/></svg>',accordionHeader:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M5.616 20q-.691 0-1.153-.462T4 18.384V5.616q0-.691.463-1.153T5.616 4h12.769q.69 0 1.153.463T20 5.616v12.769q0 .69-.462 1.153T18.384 20zm0-1h12.769q.23 0 .423-.192t.192-.424V5.616q0-.231-.192-.424T18.384 5H5.616q-.231 0-.424.192T5 5.616v12.769q0 .23.192.423t.423.192M5 5v14zm2.616 4.192h6q.413 0 .706-.293q.294-.293.294-.707t-.294-.706q-.293-.294-.706-.294h-6q-.414 0-.707.294t-.293.706t.293.707t.707.293"/></svg>',accordionContent:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M4.616 19q-.691 0-1.153-.462T3 17.384V6.616q0-.691.463-1.153T4.615 5h14.77q.69 0 1.152.463T21 6.616v10.769q0 .69-.463 1.153T19.385 19zm0-1h14.769q.23 0 .423-.192t.192-.424V6.616q0-.231-.192-.424T19.385 6H4.615q-.23 0-.423.192T4 6.616v10.769q0 .23.192.423t.423.192M4 18V6zm2.23-2.116h11.54q.213 0 .356-.143t.143-.357t-.143-.356t-.357-.144H6.231q-.214 0-.357.144q-.143.143-.143.357q0 .213.143.356t.357.144m0-3.385h11.538q.214 0 .357-.143t.143-.357t-.143-.357t-.357-.143H6.231q-.214 0-.357.143T5.731 12t.143.357t.357.143m0-3.384H14q.214 0 .357-.144q.143-.143.143-.356q0-.214-.143-.357T14 8.116H6.23q-.213 0-.356.143t-.143.357t.143.356t.357.144"/></svg>',accordionMarker:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="m12 15.596l3.173-3.192H8.827zM5.616 20q-.672 0-1.144-.472T4 18.385V5.615q0-.67.472-1.143Q4.944 4 5.616 4h12.769q.67 0 1.143.472q.472.472.472 1.144v12.769q0 .67-.472 1.143q-.472.472-1.143.472zM5 9v9.385q0 .23.192.423t.423.192h12.77q.23 0 .423-.192t.192-.423V9z"/></svg>',caret:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m7.4 8.6 4.6 4.6 4.6-4.6L18 10l-6 6-6-6 1.4-1.4Z"/></svg>',eye:'<svg viewBox="0 0 24 24"><path d="M12 9a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3m0 8a5 5 0 0 1-5-5 5 5 0 0 1 5-5 5 5 0 0 1 5 5 5 5 0 0 1-5 5m0-12.5C7 4.5 2.7 7.6 1 12a11.8 11.8 0 0 0 22 0c-1.7-4.4-6-7.5-11-7.5Z"/></svg>'},S=(e,n)=>{const{toolbarIconOpen:t=f.eye}=n,s=e.is(a)?e:e.closestType(a);if(!t||!s)return;const{toolbar:c}=e,l={id:"accordion-toggle-open",label:t,command:()=>s.toggleOpen()};!c.find(m=>m.id===l.id)&&(c==null||c.unshift(l))},K=(e,n)=>{const{Components:t,Blocks:s}=e,{block:c={}}=n,l="Accordion",p=`${w}${a}`,m=function(i={}){const r=this,o=()=>{const{clsMarkerOpen:d}=i,A=r.querySelector('[data-type-role="accordion-marker"]');!A||!d||(r.open?A.classList.add(d):A.classList.remove(d))};r.addEventListener("toggle",()=>{o(),r.dispatchEvent(new CustomEvent("details-toggle",{bubbles:!0}))}),o()};return t.addType(a,{block:c&&{label:l,media:f.accordion,category:"Extra",select:!0,...c},isComponent:C(a),extendFn:["initToolbar"],model:{defaults:{tagName:"details",name:l,classes:p,emptyState:!0,clsMarkerOpen:L,attributes:{[q]:a},droppable:x(u,h),components:[{type:u},{type:h}],"script-props":["clsMarkerOpen"],script:m,traits:[{type:"checkbox",name:"open",label:"Open"}],styles:`
2
- .${p}::details-content {
1
+ (function(v,b){typeof exports=="object"&&typeof module<"u"?module.exports=b():typeof define=="function"&&define.amd?define(b):(v=typeof globalThis<"u"?globalThis:v||self,v.StudioSdkPlugins_accordionComponent=b())})(this,function(){"use strict";const v="app.grapesjs.com",b="app-stage.grapesjs.com",x=[v,"app2.grapesjs.com",b,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],N="license:check:start",D="license:check:end",P=()=>typeof window<"u",z=({isDev:e,isStage:t,isPlatform:o})=>`${e?"":`https://${t?b:v}`}/${o?"platform-api":"api"}`,L=()=>{const e=P()&&window.location.hostname;return!!e&&(x.includes(e)||x.some(t=>e.endsWith(t)))};async function G({path:e,baseApiUrl:t,method:o="GET",headers:c={},params:s,body:l}){const p=`${t||z({isDev:!1,isStage:!1})}${e}`,a={method:o,headers:{"Content-Type":"application/json",...c}};l&&(a.body=JSON.stringify(l));const r=s?new URLSearchParams(s).toString():"",m=r?`?${r}`:"",n=await fetch(`${p}${m}`,a);if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return n.json()}var T=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(T||{});const k={[T.free]:0,[T.startup]:10,[T.business]:20,[T.enterprise]:30};function B(e){const t=e;return t.init=o=>c=>e(c,o),t}const V=e=>B(e);async function U({editor:e,plan:t,pluginName:o,licenseKey:c,onLicenseCheckResponse:s,cleanup:l}){let d="",p=!1;const a=L(),r=n=>{console.warn("Cleanup plugin:",o,"Reason:",n),l()},m=(n={})=>{var I;const{error:y,sdkLicense:$}=n,E=(I=n.plan)==null?void 0:I.category;if(!($||n.license)||y)r(y||"Invalid license");else if(E){const ee=k[t],te=k[E];ee>te&&r({pluginRequiredPlan:t,licensePlan:E})}};e.on(N,n=>{d=n==null?void 0:n.baseApiUrl,p=!0}),e.on(D,n=>{s==null||s(n),m(n)}),setTimeout(async()=>{if(!p){if(a)return;if(c){const n=await j({licenseKey:c,pluginName:o,baseApiUrl:d});s==null||s(n),n&&m(n)}else r("The `licenseKey` option not provided")}},2e3)}async function j(e){const{licenseKey:t,pluginName:o,baseApiUrl:c}=e;try{return(await G({baseApiUrl:c,path:`/sdk/${t||"na"}`,method:"POST",params:{d:window.location.hostname,pn:o}})).result||{}}catch(s){return console.error("Error during SDK license check:",s),!1}}const A=e=>t=>{var o;return((o=t.getAttribute)==null?void 0:o.call(t,q))===e},O=(...e)=>t=>e.some(o=>t.is(o)),K=(...e)=>(t,o)=>e.some(c=>o.is(c)),C="gjs-plg-",q="data-type-role",i="accordion",w=`${i}-group`,u=`${i}-header`,g=`${i}-content`,f=`${i}-marker`,S=`${C}${u}`,M=`${C}${f}`,W=`${C}${g}`,_=`${M}-open`,h={accordion:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M5.616 20q-.691 0-1.153-.462T4 18.384V5.616q0-.691.463-1.153T5.616 4h12.769q.69 0 1.153.463T20 5.616v12.769q0 .69-.462 1.153T18.384 20zm0-1h12.769q.23 0 .423-.192t.192-.424V8.154H5v10.23q0 .232.192.424t.423.192"/></svg>',accordionGroup:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M8.116 16h10.769q.23 0 .423-.192t.192-.423V6h-12v9.385q0 .23.192.423t.423.192m0 1q-.69 0-1.153-.462T6.5 15.385V4.615q0-.69.463-1.153T8.116 3h10.769q.69 0 1.153.462t.462 1.153v10.77q0 .69-.462 1.152T18.884 17zm-3 3q-.69 0-1.153-.462T3.5 18.385V6.615h1v11.77q0 .23.192.423t.423.192h11.77v1zM7.5 4v12z"/></svg>',accordionHeader:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M5.616 20q-.691 0-1.153-.462T4 18.384V5.616q0-.691.463-1.153T5.616 4h12.769q.69 0 1.153.463T20 5.616v12.769q0 .69-.462 1.153T18.384 20zm0-1h12.769q.23 0 .423-.192t.192-.424V5.616q0-.231-.192-.424T18.384 5H5.616q-.231 0-.424.192T5 5.616v12.769q0 .23.192.423t.423.192M5 5v14zm2.616 4.192h6q.413 0 .706-.293q.294-.293.294-.707t-.294-.706q-.293-.294-.706-.294h-6q-.414 0-.707.294t-.293.706t.293.707t.707.293"/></svg>',accordionContent:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M4.616 19q-.691 0-1.153-.462T3 17.384V6.616q0-.691.463-1.153T4.615 5h14.77q.69 0 1.152.463T21 6.616v10.769q0 .69-.463 1.153T19.385 19zm0-1h14.769q.23 0 .423-.192t.192-.424V6.616q0-.231-.192-.424T19.385 6H4.615q-.23 0-.423.192T4 6.616v10.769q0 .23.192.423t.423.192M4 18V6zm2.23-2.116h11.54q.213 0 .356-.143t.143-.357t-.143-.356t-.357-.144H6.231q-.214 0-.357.144q-.143.143-.143.357q0 .213.143.356t.357.144m0-3.385h11.538q.214 0 .357-.143t.143-.357t-.143-.357t-.357-.143H6.231q-.214 0-.357.143T5.731 12t.143.357t.357.143m0-3.384H14q.214 0 .357-.144q.143-.143.143-.356q0-.214-.143-.357T14 8.116H6.23q-.213 0-.356.143t-.143.357t.143.356t.357.144"/></svg>',accordionMarker:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="m12 15.596l3.173-3.192H8.827zM5.616 20q-.672 0-1.144-.472T4 18.385V5.615q0-.67.472-1.143Q4.944 4 5.616 4h12.769q.67 0 1.143.472q.472.472.472 1.144v12.769q0 .67-.472 1.143q-.472.472-1.143.472zM5 9v9.385q0 .23.192.423t.423.192h12.77q.23 0 .423-.192t.192-.423V9z"/></svg>',caret:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m7.4 8.6 4.6 4.6 4.6-4.6L18 10l-6 6-6-6 1.4-1.4Z"/></svg>',eye:'<svg viewBox="0 0 24 24"><path d="M12 9a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3m0 8a5 5 0 0 1-5-5 5 5 0 0 1 5-5 5 5 0 0 1 5 5 5 5 0 0 1-5 5m0-12.5C7 4.5 2.7 7.6 1 12a11.8 11.8 0 0 0 22 0c-1.7-4.4-6-7.5-11-7.5Z"/></svg>'},H=(e,t)=>{const{toolbarIconOpen:o=h.eye}=t,c=e.is(i)?e:e.closestType(i);if(!o||!c)return;const{toolbar:s}=e,l={id:"accordion-toggle-open",label:o,command:()=>c.toggleOpen()};!s.find(p=>p.id===l.id)&&(s==null||s.unshift(l))},F=(e,t)=>{const{Components:o,Blocks:c}=e,{block:s={}}=t,l="Accordion",d=`${C}${i}`,p=function(a={}){const r=this,m=()=>{const{clsMarkerOpen:n}=a,y=r.querySelector('[data-type-role="accordion-marker"]');!y||!n||(r.open?y.classList.add(n):y.classList.remove(n))};r.addEventListener("toggle",()=>{m(),r.dispatchEvent(new CustomEvent("details-toggle",{bubbles:!0}))}),m()};return o.addType(i,{block:s&&{label:l,media:h.accordion,category:"Extra",select:!0,...s},isComponent:A(i),extendFn:["initToolbar"],model:{defaults:{tagName:"details",name:l,classes:d,emptyState:!0,clsMarkerOpen:_,attributes:{[q]:i},droppable:O(u,g),components:[{type:u},{type:g}],"script-props":["clsMarkerOpen"],script:p,traits:[{type:"checkbox",name:"open",label:"Open"}],styles:`
2
+ .${d}::details-content {
3
3
  opacity: 0;
4
4
  block-size: 0;
5
5
  overflow: hidden;
@@ -10,30 +10,30 @@
10
10
  transition-duration: 0.2s;
11
11
  }
12
12
 
13
- .${p}[open]::details-content {
13
+ .${d}[open]::details-content {
14
14
  opacity: 1;
15
15
  transform: translateY(0);
16
16
  block-size: auto;
17
17
  }
18
- `},toggleOpen(){this.addAttributes({open:!this.getAttributes().open})},initToolbar(){S(this,n)}}}),()=>{s.remove(a),t.removeType(a)}},W=e=>{const{Components:n}=e;return n.addType(h,{isComponent:C(h),model:{defaults:{name:"Accordion Content",removable:!1,copyable:!1,draggable:!1,emptyState:!0,classes:R,icon:f.accordionContent,attributes:{[q]:h},components:"<div>Accordion content</div>"}}}),()=>{n.removeType(h)}},F=(e,n)=>{const{Components:t,Blocks:s}=e,{blockGroup:c={}}=n,l="Accordion Group",p=function(i={}){if(!i.single)return;const r=this;r.addEventListener("details-toggle",o=>{const d=o.target;if(!i.single||!d||!d.open)return;r.querySelectorAll('[data-type-role="accordion"]').forEach(y=>{d!==y&&y.open&&(y.open=!1)})})},m=(i={})=>({type:a,attributes:{open:i.open},components:[{type:u,components:[`<div>${i.header}</div>`,{type:g}]},{type:h,components:`<div>${i.content}</div>`}]});return t.addType(k,{block:c&&{label:l,media:f.accordionGroup,category:"Extra",select:!0,...c},isComponent:C(k),model:{defaults:{name:l,attributes:{[q]:k},droppable:x(a),single:!0,emptyState:!0,components:Array(3).fill(0).map((i,r)=>m({open:r===0,header:`Accordion header ${r+1}`,content:`Accordion content ${r+1}`})),traits:[{type:"checkbox",name:"single",changeProp:!0,tip:"Only one accordion can be open at a time",label:"Single open"}],"script-props":["single"],script:p}}}),()=>{s.remove(k),t.removeType(k)}},Y=(e,n)=>{const{Components:t}=e;return t.addType(u,{isComponent:C(u),extendFn:["initToolbar"],model:{defaults:{tagName:"summary",name:"Accordion Header",removable:!1,copyable:!1,draggable:!1,emptyState:!0,icon:f.accordionHeader,classes:O,attributes:{[q]:u},components:["<div>Accordion header</div>",{type:g}],styles:`
18
+ `},toggleOpen(){this.addAttributes({open:!this.getAttributes().open})},initToolbar(){H(this,t)}}}),()=>{c.remove(i),o.removeType(i)}},Y=e=>{const{Components:t}=e;return t.addType(g,{isComponent:A(g),model:{defaults:{name:"Accordion Content",removable:!1,copyable:!1,draggable:!1,emptyState:!0,classes:W,icon:h.accordionContent,attributes:{[q]:g},components:"<div>Accordion content</div>"}}}),()=>{t.removeType(g)}},Z=(e,t)=>{const{Components:o,Blocks:c}=e,{blockGroup:s={}}=t,l="Accordion Group",d=function(a={}){if(!a.single)return;const r=this;r.addEventListener("details-toggle",m=>{const n=m.target;if(!a.single||!n||!n.open)return;r.querySelectorAll('[data-type-role="accordion"]').forEach($=>{n!==$&&$.open&&($.open=!1)})})},p=(a={})=>({type:i,attributes:{open:a.open},components:[{type:u,components:[`<div>${a.header}</div>`,{type:f}]},{type:g,components:`<div>${a.content}</div>`}]});return o.addType(w,{block:s&&{label:l,media:h.accordionGroup,category:"Extra",select:!0,...s},isComponent:A(w),model:{defaults:{name:l,attributes:{[q]:w},droppable:O(i),single:!0,emptyState:!0,components:Array(3).fill(0).map((a,r)=>p({open:r===0,header:`Accordion header ${r+1}`,content:`Accordion content ${r+1}`})),traits:[{type:"checkbox",name:"single",changeProp:!0,tip:"Only one accordion can be open at a time",label:"Single open"}],"script-props":["single"],script:d}}}),()=>{c.remove(w),o.removeType(w)}},J=(e,t)=>{const{Components:o}=e;return o.addType(u,{isComponent:A(u),extendFn:["initToolbar"],model:{defaults:{tagName:"summary",name:"Accordion Header",removable:!1,copyable:!1,draggable:!1,emptyState:!0,icon:h.accordionHeader,classes:S,attributes:{[q]:u},components:["<div>Accordion header</div>",{type:f}],styles:`
19
19
  summary {
20
20
  list-style: none;
21
21
  }
22
- .${O} {
22
+ .${S} {
23
23
  cursor: pointer;
24
24
  display: flex;
25
25
  align-items: center;
26
26
  justify-content: space-between;
27
27
  gap: 1rem;
28
28
  }
29
- `},initToolbar(){S(this,n)}}}),()=>{t.removeType(u)}},Z=e=>{const{Components:n}=e;return n.addType(g,{extend:"icon",isComponent:C(g),model:{defaults:{name:"Accordion Marker",icon:f.accordionMarker,classes:$,attributes:{[q]:g},components:f.caret,droppable:!1,draggable:j(u),styles:`
30
- .${$} {
29
+ `},initToolbar(){H(this,t)}}}),()=>{o.removeType(u)}},Q=e=>{const{Components:t}=e;return t.addType(f,{extend:"icon",isComponent:A(f),model:{defaults:{name:"Accordion Marker",icon:h.accordionMarker,classes:M,attributes:{[q]:f},components:h.caret,droppable:!1,draggable:K(u),styles:`
30
+ .${M} {
31
31
  min-width: 24px;
32
32
  width: 24px;
33
33
  height: 24px;
34
34
  transition: transform 0.2s ease-in-out;
35
35
  }
36
- .${L} {
36
+ .${_} {
37
37
  transform: rotateZ(180deg);
38
38
  }
39
- `}}}),()=>{n.removeType(g)}},J="accordionComponent",Q=T.startup;return B(function(e,n={}){const t=[K(e,n),F(e,n),Y(e,n),Z(e),W(e)];V({editor:e,licenseKey:n.licenseKey,plan:Q,pluginName:J,cleanup:()=>{t.forEach(s=>s())}})})});
39
+ `}}}),()=>{t.removeType(f)}},X="accordionComponent",R=T.startup;return V(function(e,t={}){const o=[F(e,t),Z(e,t),J(e,t),Q(e),Y(e)];U({editor:e,licenseKey:t.licenseKey,plan:R,pluginName:X,cleanup:()=>{o.forEach(c=>c())}})})});
@@ -0,0 +1,15 @@
1
+ import { Editor } from 'grapesjs';
2
+ import { AiChatOptions, AiChatTools, ChatState } from './types';
3
+ export declare class ChatManager {
4
+ readonly editor: Editor;
5
+ readonly options: AiChatOptions;
6
+ readonly chatStates: Map<string, ChatState>;
7
+ currentChatId: string;
8
+ tools: AiChatTools;
9
+ constructor(editor: Editor, options: AiChatOptions);
10
+ get currentChatState(): ChatState;
11
+ getChat(id: string): ChatState | undefined;
12
+ setCurrentChat(id: string): void;
13
+ removeChat(id: string): void;
14
+ private createChat;
15
+ }
@@ -1,4 +1,4 @@
1
1
  import { Editor } from 'grapesjs';
2
- import { AiChatDefaultTools, AiChatToolApis } from './types';
3
- export declare const defaultToolApis: Required<AiChatToolApis>;
4
- export declare function createDefaultTools(editor: Editor, toolApis?: AiChatToolApis): AiChatDefaultTools;
2
+ import { AiChatDefaultTools } from './types';
3
+ export declare const defaultToolApis: Record<string, string>;
4
+ export declare function createDefaultTools(editor: Editor, toolApis?: Record<string, string>): AiChatDefaultTools;
@@ -33,24 +33,37 @@ export interface ToolAddProjectPageSetupResult {
33
33
  interface ToolStatusAddComponent {
34
34
  type: ChatToolAgentCode.ADD_COMPONENT_CODE;
35
35
  toolSetup: ToolAddComponentSetupResult;
36
+ content: string;
36
37
  completed?: boolean;
37
38
  }
38
39
  interface ToolStatusEditComponent {
39
40
  type: ChatToolAgentCode.EDIT_COMPONENT_CODE;
40
41
  toolSetup: ToolEditComponentSetupResult;
42
+ content: string;
41
43
  completed?: boolean;
42
44
  }
43
45
  interface ToolStatusAddPage {
44
46
  type: ChatToolAgentCode.ADD_PAGE_CODE;
45
47
  toolSetup: ToolAddPageSetupResult;
48
+ content: string;
46
49
  completed?: boolean;
47
50
  }
48
51
  interface ToolStatusAddProjectPage {
49
52
  type: ChatToolAgentCode.ADD_PROJECT_PAGE_CODE;
50
53
  toolSetup: ToolAddProjectPageSetupResult;
54
+ content: string;
51
55
  completed?: boolean;
52
56
  }
53
- export type ToolStatusProgressEntry = ToolStatusAddComponent | ToolStatusEditComponent | ToolStatusAddPage | ToolStatusAddProjectPage;
57
+ /**
58
+ * Generic tool status entry for buffering streaming content
59
+ * Used for tools that don't have a specific processor
60
+ */
61
+ export interface ToolStatusGeneric {
62
+ type: 'generic';
63
+ content: string;
64
+ completed?: boolean;
65
+ }
66
+ export type ToolStatusProgressEntry = ToolStatusAddComponent | ToolStatusEditComponent | ToolStatusAddPage | ToolStatusAddProjectPage | ToolStatusGeneric;
54
67
  export type ToolStatusProgressMap = Map<string, ToolStatusProgressEntry>;
55
68
  export declare function toolAddComponentSetup(editor: Editor, args: AiChatToolsArguments[AiChatToolName.ADD_NEW_COMPONENT]): ToolAddComponentSetupResult;
56
69
  export declare function toolAddComponentEnd(editor: Editor, toolSetup: ToolAddComponentSetupResult, content: string): Component | undefined;
@@ -1,9 +1,7 @@
1
- import { CommonComponentProps } from '../types';
2
- export interface AiChatEmptyStateProps extends CommonComponentProps {
3
- /**
4
- * Suggestions to show in the empty state.
5
- */
6
- suggestions?: string[];
1
+ import { AiChatSuggestion, CommonComponentProps } from '../types';
2
+ import { AiChatEmptyStatePropsSchema } from '../typesSchema';
3
+ export interface AiChatEmptyStateProps extends CommonComponentProps, Omit<AiChatEmptyStatePropsSchema, 'suggestions'> {
4
+ suggestions?: AiChatSuggestion[];
7
5
  }
8
6
  export declare const AiChatEmptyState: React.FC<AiChatEmptyStateProps>;
9
7
  export default AiChatEmptyState;
@@ -1,4 +1,5 @@
1
1
  import { CommonComponentProps } from '../types';
2
- export interface AiChatErrorProps extends CommonComponentProps {
2
+ import { AiChatErrorPropsSchema } from '../typesSchema';
3
+ export interface AiChatErrorProps extends CommonComponentProps, AiChatErrorPropsSchema {
3
4
  }
4
5
  export declare const AiChatError: React.FC<AiChatErrorProps>;
@@ -1,5 +1,6 @@
1
1
  import { CommonComponentProps } from '../types';
2
- export interface AiChatHeaderProps extends CommonComponentProps {
2
+ import { AiChatHeaderPropsSchema } from '../typesSchema';
3
+ export interface AiChatHeaderProps extends CommonComponentProps, AiChatHeaderPropsSchema {
3
4
  }
4
5
  export declare const AiChatHeader: React.FC<AiChatHeaderProps>;
5
6
  export default AiChatHeader;
@@ -0,0 +1,7 @@
1
+ import { CommonComponentProps } from '../../types';
2
+ import { ChatAsset } from './constants';
3
+ export interface AssetsSectionProps extends Omit<CommonComponentProps, 'chatContext'> {
4
+ assets: ChatAsset[];
5
+ onRemove?: (index: number) => void;
6
+ }
7
+ export declare const AssetsSection: React.FC<AssetsSectionProps>;
@@ -0,0 +1,10 @@
1
+ import { CommonComponentProps } from '../../types';
2
+ export interface AttachButtonProps extends Omit<CommonComponentProps, 'chatContext'> {
3
+ disabled?: boolean;
4
+ maxAssets: number;
5
+ currentAssetsCount: number;
6
+ acceptAssetType?: string;
7
+ onFilesSelected: (files: File[]) => void;
8
+ onAssetSelected: (assetUrl: string) => void;
9
+ }
10
+ export declare const AttachButton: React.FC<AttachButtonProps>;
@@ -0,0 +1,5 @@
1
+ import { ChatState, CommonComponentProps } from '../../types';
2
+ export interface ContextSectionProps extends Omit<CommonComponentProps, 'chatContext'>, Pick<ChatState, 'contextComponents'> {
3
+ disabled?: boolean;
4
+ }
5
+ export declare const ContextSection: React.FC<ContextSectionProps>;
@@ -0,0 +1,7 @@
1
+ import { CommonComponentProps } from '../../types';
2
+ export interface DictateButtonProps extends Omit<CommonComponentProps, 'chatContext'> {
3
+ disabled?: boolean;
4
+ onTranscript: (text: string) => void;
5
+ onListeningChange?: (listening: boolean) => void;
6
+ }
7
+ export declare const DictateButton: React.FC<DictateButtonProps>;
@@ -0,0 +1,6 @@
1
+ import { ComponentProps } from 'react';
2
+ interface TextAreaWithAutoResizeProps extends ComponentProps<'textarea'> {
3
+ autoResize?: boolean;
4
+ }
5
+ export declare const TextAreaWithAutoResize: React.FC<TextAreaWithAutoResizeProps>;
6
+ export {};
@@ -0,0 +1,6 @@
1
+ export declare const clsMain = "gs-cmp-ai-chat-input";
2
+ export interface ChatAsset {
3
+ src: string;
4
+ file?: File;
5
+ mediaType: string;
6
+ }
@@ -0,0 +1,15 @@
1
+ type SpeechRecognition = any;
2
+ declare global {
3
+ interface Window {
4
+ SpeechRecognition: SpeechRecognition;
5
+ webkitSpeechRecognition: SpeechRecognition;
6
+ }
7
+ }
8
+ export declare function useSpeechToText(): {
9
+ transcript: string;
10
+ isSupported: boolean;
11
+ isListening: boolean;
12
+ start: () => void;
13
+ stop: () => void;
14
+ };
15
+ export {};
@@ -0,0 +1,37 @@
1
+ import { ButtonProps } from '@studio/editor/src/components/Button/index';
2
+ import { StudioLayoutComponentsConfig } from '../../../types';
3
+ import { ChatContext, CommonComponentProps, UploadedAsset } from '../../types';
4
+ import { AiChatInputPropsSchema } from '../../typesSchema';
5
+ import { AssetsSectionProps } from './AssetsSection';
6
+ import { AttachButtonProps } from './AttachButton';
7
+ import { ContextSectionProps } from './ContextSection';
8
+ import { DictateButtonProps } from './DictateButton';
9
+ import { ChatAsset } from './constants';
10
+ export interface AiChatInputState {
11
+ input: string;
12
+ assets: ChatAsset[];
13
+ }
14
+ export interface AiChatInputLayoutProps {
15
+ state: AiChatInputState;
16
+ }
17
+ export interface AiChatInputProps extends Omit<CommonComponentProps, 'chatContext'>, Omit<AiChatInputPropsSchema, 'uploadProjectAssets' | 'onSubmit' | 'layoutBefore' | 'layoutAfter' | 'contextSectionProps' | 'textareaProps' | 'assetsSectionProps' | 'attachButtonProps' | 'dictateButtonProps' | 'submitButtonProps'> {
18
+ uploadProjectAssets?: (props: {
19
+ files: File[];
20
+ }) => Promise<UploadedAsset[]>;
21
+ chatContext?: ChatContext;
22
+ layoutBefore?: (props: AiChatInputLayoutProps) => StudioLayoutComponentsConfig | undefined | void;
23
+ layoutAfter?: (props: AiChatInputLayoutProps) => StudioLayoutComponentsConfig | undefined | void;
24
+ onSubmit?: (props: {
25
+ event: React.FormEvent;
26
+ submit: () => Promise<void>;
27
+ state: AiChatInputState;
28
+ }) => void;
29
+ contextSectionProps?: Partial<ContextSectionProps>;
30
+ textareaProps?: Partial<React.ComponentProps<'textarea'>>;
31
+ assetsSectionProps?: Partial<AssetsSectionProps>;
32
+ attachButtonProps?: Partial<AttachButtonProps>;
33
+ dictateButtonProps?: Partial<DictateButtonProps>;
34
+ submitButtonProps?: Partial<ButtonProps>;
35
+ }
36
+ export declare const AiChatInput: React.FC<AiChatInputProps>;
37
+ export default AiChatInput;
@@ -1,4 +1,5 @@
1
1
  import { CommonComponentProps } from '../types';
2
- export interface AiChatLoadingStateProps extends CommonComponentProps {
2
+ import { AiChatLoadingStatePropsSchema } from '../typesSchema';
3
+ export interface AiChatLoadingStateProps extends CommonComponentProps, AiChatLoadingStatePropsSchema {
3
4
  }
4
5
  export declare const AiChatLoadingState: React.FC<AiChatLoadingStateProps>;
@@ -1,17 +1,29 @@
1
- import { Editor } from 'grapesjs';
2
- import { CSSProperties } from 'react';
3
- import { ChatContext, ChatMessage } from '../types';
4
- export interface AiChatMessageProps {
5
- editor: Editor;
6
- chatContext: ChatContext;
1
+ import { StudioLayoutComponentsConfig } from '../../types';
2
+ import { AiChatMessageLayoutProps, AiChatMessagePartLayoutProps, AiChatMessageToolDetailLayoutProps, ChatMessage, CommonComponentProps } from '../types';
3
+ import { AiChatMessagePropsSchema } from '../typesSchema';
4
+ export interface AiChatMessageToolLabelLayoutProps extends AiChatMessageToolDetailLayoutProps {
5
+ }
6
+ export interface AiChatMessageToolResultLayoutProps extends AiChatMessageToolDetailLayoutProps {
7
+ }
8
+ export interface AiChatMessageProps extends CommonComponentProps, Omit<AiChatMessagePropsSchema, 'message' | 'layoutBeforeMessage' | 'layoutAfterMessage' | 'layoutPart' | 'layoutPartToolLabel' | 'layoutPartToolDetail' | 'layoutPartToolResult'> {
7
9
  message: ChatMessage;
8
- isStreaming?: boolean;
9
- className?: string;
10
- style?: CSSProperties;
10
+ layoutBeforeMessage?: (props: AiChatMessageLayoutProps) => StudioLayoutComponentsConfig | undefined | void;
11
+ layoutAfterMessage?: (props: AiChatMessageLayoutProps) => StudioLayoutComponentsConfig | undefined | void;
12
+ layoutPart?: (props: AiChatMessagePartLayoutProps) => StudioLayoutComponentsConfig | undefined | void;
13
+ layoutPartToolLabel?: (props: AiChatMessageToolLabelLayoutProps) => StudioLayoutComponentsConfig | undefined | void;
14
+ layoutPartToolDetail?: (props: AiChatMessageToolDetailLayoutProps) => StudioLayoutComponentsConfig | undefined | void;
15
+ layoutPartToolResult?: (props: AiChatMessageToolResultLayoutProps) => StudioLayoutComponentsConfig | undefined | void;
11
16
  }
12
17
  export interface AiChatMessagePartProps {
13
18
  part: ChatMessage['parts'][0];
19
+ messageId: string;
20
+ partIndex: number;
14
21
  isStreamingPart?: boolean;
22
+ layoutPart?: AiChatMessageProps['layoutPart'];
23
+ layoutPartToolLabel?: AiChatMessageProps['layoutPartToolLabel'];
24
+ layoutPartToolDetail?: AiChatMessageProps['layoutPartToolDetail'];
25
+ layoutPartToolResult?: AiChatMessageProps['layoutPartToolResult'];
26
+ layoutProps: AiChatMessageLayoutProps;
15
27
  }
16
28
  export declare const AiChatMessage: React.FC<AiChatMessageProps>;
17
29
  export default AiChatMessage;
@@ -1,13 +1,11 @@
1
- import { useChat } from '@ai-sdk/react';
2
1
  import { Editor } from 'grapesjs';
3
- import { ChatContext, ChatMessage } from '../types';
4
- type ChatStatus = ReturnType<typeof useChat>['status'];
5
- export interface AiChatMessagesProps {
2
+ import { AiChatOptions, ChatContext, ChatMessage } from '../types';
3
+ import { AiChatMessagesPropsSchema } from '../typesSchema';
4
+ export interface AiChatMessagesProps extends Omit<AiChatMessagesPropsSchema, 'editor' | 'chatContext' | 'messages' | 'pluginOptions'> {
6
5
  editor: Editor;
7
6
  chatContext: ChatContext;
8
7
  messages: ChatMessage[];
9
- status: ChatStatus;
10
- suggestions?: string[];
8
+ pluginOptions: AiChatOptions;
11
9
  }
12
- export declare function AiChatMessages({ editor, chatContext, messages, status, suggestions }: AiChatMessagesProps): import("react/jsx-runtime").JSX.Element;
10
+ export declare function AiChatMessages({ editor, chatContext, messages, pluginOptions }: AiChatMessagesProps): import("react/jsx-runtime").JSX.Element;
13
11
  export default AiChatMessages;
@@ -0,0 +1,5 @@
1
+ import { CommonComponentProps } from '../types';
2
+ import { AiChatMessagesStatusPropsSchema } from '../typesSchema';
3
+ export interface AiChatMessagesStatusProps extends CommonComponentProps, AiChatMessagesStatusPropsSchema {
4
+ }
5
+ export declare const AiChatMessagesStatus: React.FC<AiChatMessagesStatusProps>;
@@ -1,10 +1,9 @@
1
1
  import { Editor } from 'grapesjs';
2
2
  import { AiChatOptions } from '../types';
3
- export interface AiChatPanelProps {
3
+ import { AiChatPanelPropsSchema } from '../typesSchema';
4
+ export interface AiChatPanelProps extends Omit<AiChatPanelPropsSchema, 'editor' | 'pluginOptions'> {
4
5
  editor: Editor;
5
6
  pluginOptions: AiChatOptions;
6
- style?: React.CSSProperties;
7
- className?: string;
8
7
  }
9
8
  /**
10
9
  * Uses AI SDK v6 patterns with DefaultChatTransport and sendMessage.
@@ -0,0 +1,14 @@
1
+ import { ReactNode } from 'react';
2
+ import { ChatManager } from '../chatManager';
3
+ import { ChatState } from '../types';
4
+ import { AiChatProviderPropsSchema } from '../typesSchema';
5
+ export interface AiChatProviderValue {
6
+ chatManager: ChatManager;
7
+ chatState: ChatState;
8
+ }
9
+ export interface AiChatProviderProps extends Omit<AiChatProviderPropsSchema, 'chatManager' | 'children'> {
10
+ chatManager: ChatManager;
11
+ children: ReactNode;
12
+ }
13
+ export declare const AiChatProvider: ({ chatManager, children }: AiChatProviderProps) => import("react/jsx-runtime").JSX.Element;
14
+ export declare const useAiChatContext: () => AiChatProviderValue | undefined;
@@ -0,0 +1,9 @@
1
+ export declare const TAG_FILE_REFS = "file-refs";
2
+ export declare function remarkCustomElements(): (tree: any) => void;
3
+ interface MemoizedMarkdownProps {
4
+ content: string;
5
+ id: string;
6
+ className?: string;
7
+ }
8
+ export declare const MemoizedMarkdown: import('react').NamedExoticComponent<MemoizedMarkdownProps>;
9
+ export {};
@@ -1,41 +1,40 @@
1
1
  import { Editor } from 'grapesjs';
2
+ import { ChatManager } from '../chatManager';
2
3
  import { AiChatOptions } from '../types';
3
4
  import { AiChatEmptyStateProps } from './AiChatEmptyState';
4
5
  import { AiChatErrorProps } from './AiChatError';
5
6
  import { AiChatHeaderProps } from './AiChatHeader';
6
- import { AiChatInputProps } from './AiChatInput';
7
+ import { AiChatInputProps } from './AiChatInput/index';
7
8
  import { AiChatLoadingStateProps } from './AiChatLoadingState';
8
9
  import { AiChatMessageProps } from './AiChatMessage';
10
+ import { AiChatMessagesStatusProps } from './AiChatMessagesStatus';
9
11
  import { AiChatPanelProps } from './AiChatPanel';
10
12
  export type { AiChatEmptyStateProps } from './AiChatEmptyState';
11
13
  export type { AiChatErrorProps } from './AiChatError';
12
14
  export type { AiChatHeaderProps } from './AiChatHeader';
13
- export type { AiChatInputProps } from './AiChatInput';
15
+ export type { AiChatInputProps } from './AiChatInput/index';
14
16
  export type { AiChatMessageProps } from './AiChatMessage';
15
17
  export type { AiChatMessagesProps } from './AiChatMessages';
18
+ export type { AiChatMessagesStatusProps } from './AiChatMessagesStatus';
19
+ type AiChatLayoutComponentProps<T, Type extends string> = Omit<T, 'editor'> & {
20
+ type: Type;
21
+ };
22
+ export interface AiChatLayoutComponentsRegistryEntries {
23
+ aiChatPanel: Omit<AiChatLayoutComponentProps<AiChatPanelProps, 'aiChatPanel'>, 'pluginOptions'>;
24
+ aiChatHeader: AiChatLayoutComponentProps<AiChatHeaderProps, 'aiChatHeader'>;
25
+ aiChatError: AiChatLayoutComponentProps<AiChatErrorProps, 'aiChatError'>;
26
+ aiChatLoadingState: AiChatLayoutComponentProps<AiChatLoadingStateProps, 'aiChatLoadingState'>;
27
+ aiChatInput: AiChatLayoutComponentProps<AiChatInputProps, 'aiChatInput'>;
28
+ aiChatEmptyState: AiChatLayoutComponentProps<AiChatEmptyStateProps, 'aiChatEmptyState'>;
29
+ aiChatMessage: AiChatLayoutComponentProps<AiChatMessageProps, 'aiChatMessage'>;
30
+ aiChatMessagesStatus: AiChatLayoutComponentProps<AiChatMessagesStatusProps, 'aiChatMessagesStatus'>;
31
+ }
16
32
  declare module '@studio/editor/src/types' {
17
- interface CustomLayoutComponentsRegistry {
18
- aiChatPanel: Pick<AiChatPanelProps, 'className' | 'style'> & {
19
- type: 'aiChatPanel';
20
- };
21
- aiChatHeader: Pick<AiChatHeaderProps, 'className' | 'style' | 'chatContext'> & {
22
- type: 'aiChatHeader';
23
- };
24
- aiChatError: Pick<AiChatErrorProps, 'className' | 'style' | 'chatContext'> & {
25
- type: 'aiChatError';
26
- };
27
- aiChatLoadingState: Pick<AiChatLoadingStateProps, 'className' | 'style' | 'chatContext'> & {
28
- type: 'aiChatLoadingState';
29
- };
30
- aiChatInput: Pick<AiChatInputProps, 'className' | 'style' | 'chatContext' | 'maxImages' | 'uploadProjectAssets'> & {
31
- type: 'aiChatInput';
32
- };
33
- aiChatEmptyState: Pick<AiChatEmptyStateProps, 'className' | 'style' | 'chatContext' | 'suggestions'> & {
34
- type: 'aiChatEmptyState';
35
- };
36
- aiChatMessage: Pick<AiChatMessageProps, 'className' | 'style' | 'chatContext' | 'message' | 'isStreaming'> & {
37
- type: 'aiChatMessage';
38
- };
33
+ interface CustomLayoutComponentsRegistry extends AiChatLayoutComponentsRegistryEntries {
34
+ }
35
+ }
36
+ declare module '@grapesjs/studio-sdk' {
37
+ interface CustomLayoutComponentsRegistry extends AiChatLayoutComponentsRegistryEntries {
39
38
  }
40
39
  }
41
- export declare const registerLayoutComponents: (editor: Editor, options: AiChatOptions) => () => void;
40
+ export declare const registerLayoutComponents: (editor: Editor, options: AiChatOptions, chatManager: ChatManager) => () => void;
@@ -1,11 +1,18 @@
1
1
  import { Component, Editor } from 'grapesjs';
2
2
  import { StudioLayoutComponentsConfig } from '../../types';
3
- import { ProjectContext } from '../types';
4
- export declare const getProjectContext: (editor: Editor, { withPageContent, imageUrls }?: {
3
+ import { AccessTokenStore, AiChatOptions, ProjectContext } from '../types';
4
+ export declare const accessTokenStore: AccessTokenStore;
5
+ export declare const cleanupAccesTokenStore: () => void;
6
+ export declare const refreshAccessToken: () => Promise<void>;
7
+ interface ProjectContextOptions {
8
+ selectedComponents?: Component[];
5
9
  withPageContent?: boolean;
6
10
  imageUrls?: string[];
7
- }) => ProjectContext;
8
- export declare const renderLayoutComponent: (editor: Editor, components: StudioLayoutComponentsConfig) => any;
11
+ }
12
+ export declare const getProjectType: (editor: Editor) => string;
13
+ export declare const isProjectTypeEmail: (editor: Editor) => boolean;
14
+ export declare const getProjectContext: (editor: Editor, opts?: ProjectContextOptions) => ProjectContext;
15
+ export declare const renderLayoutComponent: (editor: Editor, components: StudioLayoutComponentsConfig, pluginOptions?: AiChatOptions) => any;
9
16
  export declare function clearGeneratedCode(code: string): string;
10
17
  export declare const updateDomWithStreamContent: (content?: string, el?: HTMLElement, opts?: {
11
18
  skipScroll?: boolean;
@@ -32,3 +39,4 @@ export declare const createUpdatesFromStream: (editor: Editor) => {
32
39
  update: (content: string) => Map<string, UpdatesFromStream>;
33
40
  };
34
41
  export declare const replaceComponentWithHTML: (cmp: Component, content: string) => void;
42
+ export {};
@@ -0,0 +1,5 @@
1
+ import { AiChatOptions } from './types';
2
+ declare const _default: import('../utils').PluginWithInit<AiChatOptions>;
3
+ export default _default;
4
+ export type { ChatManager } from './chatManager';
5
+ export type * from './types';