@peak-ai/canvas 1.6.0 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,6 +11,13 @@ type GrapesjsCanvasProps = {
11
11
  mode?: 'editor' | 'preview';
12
12
  setEditor: (editor: Editor) => void;
13
13
  performInteraction: (payload: Record<string, any>) => Promise<Record<string, any> | undefined>;
14
+ downloadTable?: (data: {
15
+ tableId: string;
16
+ title: string;
17
+ limit: number;
18
+ json: any;
19
+ headerMapper?: Record<string, string>;
20
+ }) => Promise<void>;
14
21
  newDataNotifier: (notifHandler: NotificationHandler) => void;
15
22
  setHasChanged: (hasChanged: boolean) => void;
16
23
  isStreaming: boolean;
package/GrapesjsCanvas.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import _extends from"@babel/runtime/helpers/extends";import _asyncToGenerator from"@babel/runtime/helpers/asyncToGenerator";import _regeneratorRuntime from"@babel/runtime/regenerator";/* eslint-disable @typescript-eslint/no-explicit-any */import React,{useEffect,useRef,useState}from"react";// eslint-disable-next-line import/no-named-as-default
2
- import grapesjs from"grapesjs";import"grapesjs/dist/css/grapes.min.css";import tailwind from"grapesjs-tailwind";import{TypesToRegister}from"./constants";import{toKebabCase}from"./helpers";import{tailwindCompiledCss}from"./helpers/css";import{datePickerCss}from"./helpers/date-picker";import{extractPageMetadata,getCurrentPage,mergeStyles,normalizeMultiPageJson}from"./helpers/page-utils";import{createGrapesjsShadcnGenericPlugin}from"./plugins/grapejs-plugin";import{StyledEditor}from"./index.styles";import{PageProvider,usePageContext}from"./contexts/PageContext";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";function isEditorCanvasReady(editor){try{var canvas=editor.Canvas;if(!canvas){return false}var canvasDoc=canvas.getDocument==null?void 0:canvas.getDocument();if(!canvasDoc){return false}var canvasBody=canvasDoc.body;if(!canvasBody){return false}return true}catch(_unused){return false}}function safeStoreEditor(_x){return _safeStoreEditor.apply(this,arguments)}function _safeStoreEditor(){_safeStoreEditor=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(editor){var _editor$Pages,wrapper,pages;return _regeneratorRuntime.wrap(function _callee5$(_context5){while(1)switch(_context5.prev=_context5.next){case 0:_context5.prev=0;wrapper=editor.getWrapper();if(wrapper){_context5.next=4;break}return _context5.abrupt("return",null);case 4:pages=((_editor$Pages=editor.Pages)==null||_editor$Pages.getAll==null?void 0:_editor$Pages.getAll())||[];if(!(pages.length===0)){_context5.next=7;break}return _context5.abrupt("return",null);case 7:_context5.next=9;return editor.store();case 9:return _context5.abrupt("return",_context5.sent);case 12:_context5.prev=12;_context5.t0=_context5["catch"](0);// eslint-disable-next-line no-console
3
- console.warn("Error during store operation:",_context5.t0);return _context5.abrupt("return",null);case 16:case"end":return _context5.stop()}},_callee5,null,[[0,12]])}));return _safeStoreEditor.apply(this,arguments)}function setComponentProperties(editor,isPreview,isStreaming){if(!editor){return}function setPropertiesRecursively(comp){if(!comp){return}var isMutable=!isPreview&&!isStreaming;comp.set({editable:isMutable,draggable:isMutable,droppable:isMutable&&comp.getName()!=="Shadcn-generic",selectable:isMutable,hoverable:isMutable,highlightable:isMutable,copyable:false,resizable:false,removable:isMutable,badgable:false});comp.set("attributes",_extends({},comp.get("attributes")||{},{isEditable:isMutable}));if(isMutable){comp.set("toolbar",[{attributes:{"class":"fa fa-arrows"},command:"tlb-move"},{attributes:{"class":"fa fa-trash"},command:"tlb-delete"}])}else{comp.set("toolbar",[])}comp.components().forEach(setPropertiesRecursively)}var wrapper=editor.getWrapper();var components=(wrapper==null?void 0:wrapper.find("*"))||[];components.forEach(setPropertiesRecursively);if(isEditorCanvasReady(editor)){if(isPreview){editor.runCommand("core:preview")}else{editor.stopCommand("core:preview")}}}function convertStyles(stylesArray){return stylesArray.map(function(block){var selectors=Array.isArray(block.selectors)?block.selectors.join(", "):block.selectors;var declarations=Object.entries(block.style).map(function(_ref){var prop=_ref[0],value=_ref[1];return toKebabCase(prop)+": "+value+";"}).join(" ");return selectors+" { "+declarations+" }"}).join("\n")}function createActionCardConfig(action){var icon=action.icon,title=action.title,description=action.description;return{type:"shadcn-generic",componentName:"ActionCard",badgable:false,copyable:false,removable:true,draggable:true,componentProps:{icon:icon,headerContent:title,bodyContent:description}}}function expandActions(node){if(node.type==="shadcn-generic"&&node.componentName==="Actions"){var _node$componentProps;var actions=(_node$componentProps=node.componentProps)==null?void 0:_node$componentProps.actions;if(Array.isArray(actions)&&actions.length>0){return _extends({},node,{type:"div",classes:["dashboard-cards"].concat(node.classes||[]),componentName:undefined,componentProps:undefined,components:actions.map(function(action,i){return _extends({},createActionCardConfig(action),{id:node.id+"--action-card-"+i})})})}return node}if(Array.isArray(node.components)){return _extends({},node,{components:node.components.map(expandActions)})}return node}function setInteracting(renderedComponents,components,inProgress){components.forEach(function(component){var componentId=component.componentId,showLoader=component.showLoader;if(!showLoader){return}var gjsModel=renderedComponents[componentId];if(gjsModel){gjsModel.set("attributes",_extends({},gjsModel.get("attributes"),{interactionApiInProgress:inProgress}))}})}function expandActionsComponent(model,actions){model.components("");actions.forEach(function(action){model.append(createActionCardConfig(action))});model.set("type","div");model.addClass("dashboard-cards");model.set("componentName",undefined);model.set("componentProps",{})}function resetStreamingComponent(comp){var attrs=comp.get("attributes")||{};var props=comp.get("componentProps")||{};var cleanedProps=_extends({},props);delete cleanedProps.bodyContent;delete cleanedProps.data;delete cleanedProps.rows;delete cleanedProps.series;delete cleanedProps.pagination;delete cleanedProps.error;delete cleanedProps.isMissing;comp.set({attributes:_extends({},attrs,{loading:true,error:undefined,isMissing:undefined}),componentProps:cleanedProps})}function GrapejsCanvasInternal(_ref2){var _pages$;var json=_ref2.json,_ref2$mode=_ref2.mode,mode=_ref2$mode===void 0?"preview":_ref2$mode,setEditor=_ref2.setEditor,performInteraction=_ref2.performInteraction,_ref2$newDataNotifier=_ref2.newDataNotifier,newDataNotifier=_ref2$newDataNotifier===void 0?function(){// no op
2
+ import grapesjs from"grapesjs";import"grapesjs/dist/css/grapes.min.css";import tailwind from"grapesjs-tailwind";import{TypesToRegister}from"./constants";import{toKebabCase}from"./helpers";import{tailwindCompiledCss}from"./helpers/css";import{datePickerCss}from"./helpers/date-picker";import{extractPageMetadata,getCurrentPage,mergeStyles,normalizeMultiPageJson}from"./helpers/page-utils";import{createGrapesjsShadcnGenericPlugin}from"./plugins/grapejs-plugin";import{StyledEditor}from"./index.styles";import{PageProvider,usePageContext}from"./contexts/PageContext";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";function isEditorCanvasReady(editor){try{var canvas=editor.Canvas;if(!canvas){return false}var canvasDoc=canvas.getDocument==null?void 0:canvas.getDocument();if(!canvasDoc){return false}var canvasBody=canvasDoc.body;if(!canvasBody){return false}return true}catch(_unused){return false}}function safeStoreEditor(_x){return _safeStoreEditor.apply(this,arguments)}function _safeStoreEditor(){_safeStoreEditor=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(editor){var _editor$Pages,wrapper,pages;return _regeneratorRuntime.wrap(function _callee6$(_context6){while(1)switch(_context6.prev=_context6.next){case 0:_context6.prev=0;wrapper=editor.getWrapper();if(wrapper){_context6.next=4;break}return _context6.abrupt("return",null);case 4:pages=((_editor$Pages=editor.Pages)==null||_editor$Pages.getAll==null?void 0:_editor$Pages.getAll())||[];if(!(pages.length===0)){_context6.next=7;break}return _context6.abrupt("return",null);case 7:_context6.next=9;return editor.store();case 9:return _context6.abrupt("return",_context6.sent);case 12:_context6.prev=12;_context6.t0=_context6["catch"](0);// eslint-disable-next-line no-console
3
+ console.warn("Error during store operation:",_context6.t0);return _context6.abrupt("return",null);case 16:case"end":return _context6.stop()}},_callee6,null,[[0,12]])}));return _safeStoreEditor.apply(this,arguments)}function setComponentProperties(editor,isPreview,isStreaming){if(!editor){return}function setPropertiesRecursively(comp){if(!comp){return}var isMutable=!isPreview&&!isStreaming;comp.set({editable:isMutable,draggable:isMutable,droppable:isMutable&&comp.getName()!=="Shadcn-generic",selectable:isMutable,hoverable:isMutable,highlightable:isMutable,copyable:false,resizable:false,removable:isMutable,badgable:false});comp.set("attributes",_extends({},comp.get("attributes")||{},{isEditable:isMutable}));if(isMutable){comp.set("toolbar",[{attributes:{"class":"fa fa-arrows"},command:"tlb-move"},{attributes:{"class":"fa fa-trash"},command:"tlb-delete"}])}else{comp.set("toolbar",[])}comp.components().forEach(setPropertiesRecursively)}var wrapper=editor.getWrapper();var components=(wrapper==null?void 0:wrapper.find("*"))||[];components.forEach(setPropertiesRecursively);if(isEditorCanvasReady(editor)){if(isPreview){editor.runCommand("core:preview")}else{editor.stopCommand("core:preview")}}}function convertStyles(stylesArray){return stylesArray.map(function(block){var selectors=Array.isArray(block.selectors)?block.selectors.join(", "):block.selectors;var declarations=Object.entries(block.style).map(function(_ref){var prop=_ref[0],value=_ref[1];return toKebabCase(prop)+": "+value+";"}).join(" ");return selectors+" { "+declarations+" }"}).join("\n")}function createActionCardConfig(action){var icon=action.icon,title=action.title,description=action.description;return{type:"shadcn-generic",componentName:"ActionCard",badgable:false,copyable:false,removable:true,draggable:true,componentProps:{icon:icon,headerContent:title,bodyContent:description}}}function expandActions(node){if(node.type==="shadcn-generic"&&node.componentName==="Actions"){var _node$componentProps;var actions=(_node$componentProps=node.componentProps)==null?void 0:_node$componentProps.actions;if(Array.isArray(actions)&&actions.length>0){return _extends({},node,{type:"div",classes:["dashboard-cards"].concat(node.classes||[]),componentName:undefined,componentProps:undefined,components:actions.map(function(action,i){return _extends({},createActionCardConfig(action),{id:node.id+"--action-card-"+i})})})}return node}if(Array.isArray(node.components)){return _extends({},node,{components:node.components.map(expandActions)})}return node}function setInteracting(renderedComponents,components,inProgress){components.forEach(function(component){var componentId=component.componentId,showLoader=component.showLoader;if(!showLoader){return}var gjsModel=renderedComponents[componentId];if(gjsModel){gjsModel.set("attributes",_extends({},gjsModel.get("attributes"),{interactionApiInProgress:inProgress}))}})}function expandActionsComponent(model,actions){model.components("");actions.forEach(function(action){model.append(createActionCardConfig(action))});model.set("type","div");model.addClass("dashboard-cards");model.set("componentName",undefined);model.set("componentProps",{})}function resetStreamingComponent(comp){var attrs=comp.get("attributes")||{};var props=comp.get("componentProps")||{};var cleanedProps=_extends({},props);delete cleanedProps.bodyContent;delete cleanedProps.data;delete cleanedProps.rows;delete cleanedProps.series;delete cleanedProps.pagination;delete cleanedProps.error;delete cleanedProps.isMissing;comp.set({attributes:_extends({},attrs,{loading:true,error:undefined,isMissing:undefined}),componentProps:cleanedProps})}function GrapejsCanvasInternal(_ref2){var _pages$;var json=_ref2.json,_ref2$mode=_ref2.mode,mode=_ref2$mode===void 0?"preview":_ref2$mode,setEditor=_ref2.setEditor,performInteraction=_ref2.performInteraction,downloadTable=_ref2.downloadTable,_ref2$newDataNotifier=_ref2.newDataNotifier,newDataNotifier=_ref2$newDataNotifier===void 0?function(){// no op
4
4
  }:_ref2$newDataNotifier,_ref2$setHasChanged=_ref2.setHasChanged,setHasChanged=_ref2$setHasChanged===void 0?function(){// no op
5
5
  }:_ref2$setHasChanged,isStreaming=_ref2.isStreaming,_ref2$isModeChangeFro=_ref2.isModeChangeFromToggle,isModeChangeFromToggle=_ref2$isModeChangeFro===void 0?false:_ref2$isModeChangeFro,_ref2$isTemplateView=_ref2.isTemplateView,isTemplateView=_ref2$isTemplateView===void 0?false:_ref2$isTemplateView,externalCurrentPageId=_ref2.currentPageId,externalOnPageChange=_ref2.onPageChange,onRequestPageData=_ref2.onRequestPageData;var pageContext=usePageContext();var normalizedJson=normalizeMultiPageJson(json);var pages=normalizedJson.pages.map(extractPageMetadata);var effectiveCurrentPageId=externalCurrentPageId||(pageContext==null?void 0:pageContext.currentPageId)||((_pages$=pages[0])==null?void 0:_pages$.id)||"";var editorRef=useRef(null);var editorInstance=useRef(null);var renderedComponents=useRef({});var pageDataCache=useRef({});var currentPageIdRef=useRef(effectiveCurrentPageId);var isStreamingRef=useRef(isStreaming!=null?isStreaming:false);var modeRef=useRef(mode);var isSystemUpdateRef=useRef(false);var lastJsonRef=useRef("");var isEditorAliveRef=useRef(false);var onRequestPageDataRef=useRef(onRequestPageData);var _useState=useState(false),isTransitioning=_useState[0],setIsTransitioning=_useState[1];useEffect(function(){currentPageIdRef.current=effectiveCurrentPageId},[effectiveCurrentPageId]);useEffect(function(){isStreamingRef.current=isStreaming!=null?isStreaming:false},[isStreaming!=null?isStreaming:false]);useEffect(function(){modeRef.current=mode},[mode]);useEffect(function(){onRequestPageDataRef.current=onRequestPageData},[onRequestPageData]);function notificationHandler(props){if(!props){return true}var compId=props.componentId,_props$newProps=props.newProps,newProps=_props$newProps===void 0?{}:_props$newProps,_props$newAttributes=props.newAttributes,newAttributes=_props$newAttributes===void 0?{}:_props$newAttributes;var model=renderedComponents.current[compId];if(!model){var pageId=currentPageIdRef.current;if(pageId){if(!pageDataCache.current[pageId]){pageDataCache.current[pageId]={}}pageDataCache.current[pageId][compId]={newProps:newProps,newAttributes:newAttributes,timestamp:Date.now()}}return false}// Filter out complex placeholder objects by setting them to null
6
6
  // This ensures placeholder values are properly cleared and don't cause stale data issues
7
7
  var filteredProps=_extends({},newProps);Object.keys(filteredProps).forEach(function(key){var value=filteredProps[key];if(value&&typeof value==="object"&&value.name==="__peak_placeholder"){filteredProps[key]=null}});var parsedNewProps=_extends({},filteredProps);if(filteredProps.pagination){parsedNewProps.pagination=_extends({},model.get("componentProps").pagination||{},filteredProps.pagination)}// Handle Actions component: expand into ActionCards when data arrives via streaming
8
- var isActionsComponent=model.get("componentName")==="Actions";var hasValidActionsData=parsedNewProps.actions&&parsedNewProps.actions!==null&&Array.isArray(parsedNewProps.actions)&&parsedNewProps.actions.length>0;if(isActionsComponent&&hasValidActionsData){var _model$components$at;var isAlreadyExpanded=model.components().length>0&&((_model$components$at=model.components().at(0))==null?void 0:_model$components$at.get("componentName"))==="ActionCard";if(!isAlreadyExpanded&&editorInstance.current&&isEditorAliveRef.current){expandActionsComponent(model,parsedNewProps.actions);return true}}model.set("componentProps",_extends({},model.get("componentProps"),parsedNewProps));var currentAttrs=model.get("attributes")||{};var hasRealValue=(parsedNewProps==null?void 0:parsedNewProps.bodyContent)!==undefined&&(parsedNewProps==null?void 0:parsedNewProps.bodyContent)!==null||(parsedNewProps==null?void 0:parsedNewProps.data)!==undefined&&(parsedNewProps==null?void 0:parsedNewProps.data)!==null||(parsedNewProps==null?void 0:parsedNewProps.rows)!==undefined&&(parsedNewProps==null?void 0:parsedNewProps.rows)!==null||(parsedNewProps==null?void 0:parsedNewProps.series)!==undefined&&(parsedNewProps==null?void 0:parsedNewProps.series)!==null;var shouldStopLoading=hasRealValue||(newAttributes==null?void 0:newAttributes.error)||(parsedNewProps==null?void 0:parsedNewProps.isMissing);model.set("attributes",_extends({},currentAttrs,newAttributes,shouldStopLoading?{loading:false}:{}));if(model.view){model.view.render()}return true}useEffect(function(){newDataNotifier(notificationHandler)},[]);function handleNavigateToPage(targetPageId){if(externalOnPageChange){externalOnPageChange(targetPageId)}if(pageContext){pageContext.navigateToPage(targetPageId)}}function performInteractionWrapper(_x2){return _performInteractionWrapper.apply(this,arguments)}function _performInteractionWrapper(){_performInteractionWrapper=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(payload){var updatedJson,apiResponse,componentUpdates;return _regeneratorRuntime.wrap(function _callee4$(_context4){while(1)switch(_context4.prev=_context4.next){case 0:updatedJson=null;if(!editorInstance.current){_context4.next=5;break}_context4.next=4;return safeStoreEditor(editorInstance.current);case 4:updatedJson=_context4.sent;case 5:setInteracting(renderedComponents.current,payload.affectedComponents,true);_context4.prev=6;_context4.next=9;return performInteraction(_extends({},payload,{json:updatedJson}));case 9:apiResponse=_context4.sent;componentUpdates=apiResponse||{};Object.entries(componentUpdates).forEach(function(_ref8){var key=_ref8[0],value=_ref8[1];var model=renderedComponents.current[key];if(model){model.set("attributes",_extends({},model.get("attributes"),{error:undefined}));model.set("componentProps",_extends({},model.get("componentProps"),value,{error:undefined,isMissing:undefined}))}});return _context4.abrupt("return",componentUpdates);case 15:_context4.prev=15;_context4.t0=_context4["catch"](6);payload.affectedComponents.forEach(function(componentId){var model=renderedComponents.current[componentId];if(model){var errorMessage=_context4.t0 instanceof Error?_context4.t0.message:"Something went wrong. Please try again.";model.set("attributes",_extends({},model.get("attributes"),{error:errorMessage}));model.set("componentProps",_extends({},model.get("componentProps"),{error:errorMessage,isMissing:undefined}))}});throw _context4.t0;case 19:_context4.prev=19;setInteracting(renderedComponents.current,payload.affectedComponents,false);return _context4.finish(19);case 22:case"end":return _context4.stop()}},_callee4,null,[[6,15,19,22]])}));return _performInteractionWrapper.apply(this,arguments)}useEffect(function(){if(!editorRef.current){return function(){// no op
9
- }}if(editorInstance.current){editorInstance.current.destroy();editorInstance.current=null;isEditorAliveRef.current=false}var currentMode=modeRef.current;var editor=grapesjs.init({container:editorRef.current,height:"100%",plugins:[tailwind,createGrapesjsShadcnGenericPlugin(modeRef,performInteractionWrapper,renderedComponents.current,setHasChanged,isTemplateView,isStreamingRef,handleNavigateToPage)],storageManager:{type:"none"},richTextEditor:{actions:["bold","italic","underline","strikethrough"]},canvas:{customBadgeLabel:function customBadgeLabel(component){var tagName=component.get("tagName");return tagName==="body"?"":tagName||""}}});isEditorAliveRef.current=true;var injectionAttempts=0;function injectStylesEarly(){var _editor$Canvas;var iframeDoc=(_editor$Canvas=editor.Canvas)==null||_editor$Canvas.getDocument==null?void 0:_editor$Canvas.getDocument();if(iframeDoc&&iframeDoc.head){if(!iframeDoc.head.querySelector("[data-grapesjs-styles]")){var style=iframeDoc.createElement("style");var fullCss="\n "+tailwindCompiledCss+"\n "+datePickerCss+"\n ::-webkit-scrollbar {\n width: 0px;\n height: 0px;\n }\n html, body {\n overflow: auto !important;\n -ms-overflow-style: none; /* IE and Edge */\n scrollbar-width: none; /* Firefox */\n }\n ";style.innerHTML=fullCss;style.setAttribute("type","text/css");style.setAttribute("data-grapesjs-styles","true");iframeDoc.head.appendChild(style)}}else if(injectionAttempts<50){injectionAttempts+=1;requestAnimationFrame(injectStylesEarly)}}requestAnimationFrame(injectStylesEarly);function checkDirty(){return _checkDirty.apply(this,arguments)}function _checkDirty(){_checkDirty=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(){var stored,newJson;return _regeneratorRuntime.wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:if(!(isStreamingRef.current||isSystemUpdateRef.current)){_context2.next=2;break}return _context2.abrupt("return");case 2:if(!(!isEditorAliveRef.current||!editorInstance.current)){_context2.next=4;break}return _context2.abrupt("return");case 4:stored=null;_context2.next=7;return safeStoreEditor(editorInstance.current);case 7:stored=_context2.sent;if(stored){_context2.next=10;break}return _context2.abrupt("return");case 10:newJson=JSON.stringify(stored);if(newJson!==lastJsonRef.current){setHasChanged(true);lastJsonRef.current=newJson}case 12:case"end":return _context2.stop()}},_callee2)}));return _checkDirty.apply(this,arguments)}var debouncedCheckDirty=function(){var timeout=null;return function(){if(timeout){clearTimeout(timeout)}timeout=setTimeout(checkDirty,200)}}();["component:add","component:remove","component:update:content","style:update","component:drag:end","rte:change"].forEach(function(evt){editor.on(evt,debouncedCheckDirty)});editor.on("component:update",function(model,prop){if(["attributes","componentProps","content"].includes(prop)){debouncedCheckDirty()}});// Tailwind CSS rules aren't fully added to our component
8
+ var isActionsComponent=model.get("componentName")==="Actions";var hasValidActionsData=parsedNewProps.actions&&parsedNewProps.actions!==null&&Array.isArray(parsedNewProps.actions)&&parsedNewProps.actions.length>0;if(isActionsComponent&&hasValidActionsData){var _model$components$at;var isAlreadyExpanded=model.components().length>0&&((_model$components$at=model.components().at(0))==null?void 0:_model$components$at.get("componentName"))==="ActionCard";if(!isAlreadyExpanded&&editorInstance.current&&isEditorAliveRef.current){expandActionsComponent(model,parsedNewProps.actions);return true}}model.set("componentProps",_extends({},model.get("componentProps"),parsedNewProps));var currentAttrs=model.get("attributes")||{};var hasRealValue=(parsedNewProps==null?void 0:parsedNewProps.bodyContent)!==undefined&&(parsedNewProps==null?void 0:parsedNewProps.bodyContent)!==null||(parsedNewProps==null?void 0:parsedNewProps.data)!==undefined&&(parsedNewProps==null?void 0:parsedNewProps.data)!==null||(parsedNewProps==null?void 0:parsedNewProps.rows)!==undefined&&(parsedNewProps==null?void 0:parsedNewProps.rows)!==null||(parsedNewProps==null?void 0:parsedNewProps.series)!==undefined&&(parsedNewProps==null?void 0:parsedNewProps.series)!==null;var shouldStopLoading=hasRealValue||(newAttributes==null?void 0:newAttributes.error)||(parsedNewProps==null?void 0:parsedNewProps.isMissing);model.set("attributes",_extends({},currentAttrs,newAttributes,shouldStopLoading?{loading:false}:{}));if(model.view){model.view.render()}return true}useEffect(function(){newDataNotifier(notificationHandler)},[]);function handleNavigateToPage(targetPageId){if(externalOnPageChange){externalOnPageChange(targetPageId)}if(pageContext){pageContext.navigateToPage(targetPageId)}}function downloadTableWrapper(_x2){return _downloadTableWrapper.apply(this,arguments)}function _downloadTableWrapper(){_downloadTableWrapper=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(data){var updatedJson;return _regeneratorRuntime.wrap(function _callee4$(_context4){while(1)switch(_context4.prev=_context4.next){case 0:if(downloadTable){_context4.next=2;break}return _context4.abrupt("return");case 2:updatedJson=null;if(!editorInstance.current){_context4.next=7;break}_context4.next=6;return safeStoreEditor(editorInstance.current);case 6:updatedJson=_context4.sent;case 7:_context4.next=9;return downloadTable(_extends({},data,{json:updatedJson}));case 9:case"end":return _context4.stop()}},_callee4)}));return _downloadTableWrapper.apply(this,arguments)}function performInteractionWrapper(_x3){return _performInteractionWrapper.apply(this,arguments)}function _performInteractionWrapper(){_performInteractionWrapper=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(payload){var updatedJson,apiResponse,componentUpdates;return _regeneratorRuntime.wrap(function _callee5$(_context5){while(1)switch(_context5.prev=_context5.next){case 0:updatedJson=null;if(!editorInstance.current){_context5.next=5;break}_context5.next=4;return safeStoreEditor(editorInstance.current);case 4:updatedJson=_context5.sent;case 5:setInteracting(renderedComponents.current,payload.affectedComponents,true);_context5.prev=6;_context5.next=9;return performInteraction(_extends({},payload,{json:updatedJson}));case 9:apiResponse=_context5.sent;componentUpdates=apiResponse||{};Object.entries(componentUpdates).forEach(function(_ref8){var key=_ref8[0],value=_ref8[1];var model=renderedComponents.current[key];if(model){model.set("attributes",_extends({},model.get("attributes"),{error:undefined}));model.set("componentProps",_extends({},model.get("componentProps"),value,{error:undefined,isMissing:undefined}))}});return _context5.abrupt("return",componentUpdates);case 15:_context5.prev=15;_context5.t0=_context5["catch"](6);payload.affectedComponents.forEach(function(componentId){var model=renderedComponents.current[componentId];if(model){var errorMessage=_context5.t0 instanceof Error?_context5.t0.message:"Something went wrong. Please try again.";model.set("attributes",_extends({},model.get("attributes"),{error:errorMessage}));model.set("componentProps",_extends({},model.get("componentProps"),{error:errorMessage,isMissing:undefined}))}});throw _context5.t0;case 19:_context5.prev=19;setInteracting(renderedComponents.current,payload.affectedComponents,false);return _context5.finish(19);case 22:case"end":return _context5.stop()}},_callee5,null,[[6,15,19,22]])}));return _performInteractionWrapper.apply(this,arguments)}useEffect(function(){if(!editorRef.current){return function(){// no op
9
+ }}if(editorInstance.current){editorInstance.current.destroy();editorInstance.current=null;isEditorAliveRef.current=false}var currentMode=modeRef.current;var editor=grapesjs.init({container:editorRef.current,height:"100%",plugins:[tailwind,createGrapesjsShadcnGenericPlugin(modeRef,performInteractionWrapper,renderedComponents.current,setHasChanged,isTemplateView,isStreamingRef,handleNavigateToPage,downloadTableWrapper)],storageManager:{type:"none"},richTextEditor:{actions:["bold","italic","underline","strikethrough"]},canvas:{customBadgeLabel:function customBadgeLabel(component){var tagName=component.get("tagName");return tagName==="body"?"":tagName||""}}});isEditorAliveRef.current=true;var injectionAttempts=0;function injectStylesEarly(){var _editor$Canvas;var iframeDoc=(_editor$Canvas=editor.Canvas)==null||_editor$Canvas.getDocument==null?void 0:_editor$Canvas.getDocument();if(iframeDoc&&iframeDoc.head){if(!iframeDoc.head.querySelector("[data-grapesjs-styles]")){var style=iframeDoc.createElement("style");var fullCss="\n "+tailwindCompiledCss+"\n "+datePickerCss+"\n ::-webkit-scrollbar {\n width: 0px;\n height: 0px;\n }\n html, body {\n overflow: auto !important;\n -ms-overflow-style: none; /* IE and Edge */\n scrollbar-width: none; /* Firefox */\n }\n ";style.innerHTML=fullCss;style.setAttribute("type","text/css");style.setAttribute("data-grapesjs-styles","true");iframeDoc.head.appendChild(style)}}else if(injectionAttempts<50){injectionAttempts+=1;requestAnimationFrame(injectStylesEarly)}}requestAnimationFrame(injectStylesEarly);function checkDirty(){return _checkDirty.apply(this,arguments)}function _checkDirty(){_checkDirty=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(){var stored,newJson;return _regeneratorRuntime.wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:if(!(isStreamingRef.current||isSystemUpdateRef.current)){_context2.next=2;break}return _context2.abrupt("return");case 2:if(!(!isEditorAliveRef.current||!editorInstance.current)){_context2.next=4;break}return _context2.abrupt("return");case 4:stored=null;_context2.next=7;return safeStoreEditor(editorInstance.current);case 7:stored=_context2.sent;if(stored){_context2.next=10;break}return _context2.abrupt("return");case 10:newJson=JSON.stringify(stored);if(newJson!==lastJsonRef.current){setHasChanged(true);lastJsonRef.current=newJson}case 12:case"end":return _context2.stop()}},_callee2)}));return _checkDirty.apply(this,arguments)}var debouncedCheckDirty=function(){var timeout=null;return function(){if(timeout){clearTimeout(timeout)}timeout=setTimeout(checkDirty,200)}}();["component:add","component:remove","component:update:content","style:update","component:drag:end","rte:change"].forEach(function(evt){editor.on(evt,debouncedCheckDirty)});editor.on("component:update",function(model,prop){if(["attributes","componentProps","content"].includes(prop)){debouncedCheckDirty()}});// Tailwind CSS rules aren't fully added to our component
10
10
  // So, adding them from here!
11
11
  editor.on("load",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(){var canvasDoc,canvasHead,style,fullCss,storeResult;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:canvasDoc=editor.Canvas.getDocument();canvasHead=canvasDoc.head;if(!canvasHead.querySelector("[data-grapesjs-styles]")){style=canvasDoc.createElement("style");fullCss="\n "+tailwindCompiledCss+"\n "+datePickerCss+"\n ::-webkit-scrollbar {\n width: 0px;\n height: 0px;\n }\n html, body {\n overflow: auto !important;\n -ms-overflow-style: none; /* IE and Edge */\n scrollbar-width: none; /* Firefox */\n }\n ";style.innerHTML=fullCss;style.setAttribute("type","text/css");style.setAttribute("data-grapesjs-styles","true");canvasHead.appendChild(style)}isSystemUpdateRef.current=true;_context.next=6;return safeStoreEditor(editor);case 6:storeResult=_context.sent;if(storeResult){lastJsonRef.current=JSON.stringify(storeResult)}isSystemUpdateRef.current=false;setComponentProperties(editor,currentMode==="preview",isStreamingRef.current);case 10:case"end":return _context.stop()}},_callee)})));editorInstance.current=editor;if(setEditor){setEditor(editor)}TypesToRegister.forEach(function(_ref4){var type=_ref4.type,tagName=_ref4.tagName;if(!editor.DomComponents.getType(type)){editor.DomComponents.addType(type,{model:{defaults:{tagName:tagName}},view:{}})}});return function cleanup(){editor.destroy();isEditorAliveRef.current=false}},[]);useEffect(function(){var _json$pages;if(json&&((_json$pages=json.pages)==null?void 0:_json$pages.length)>0){var _currentPage$frames,_editorInstance$curre3;if(!isEditorAliveRef.current||!editorInstance.current){return}var pageNormalizedJson=normalizeMultiPageJson(json);var currentPage=getCurrentPage(pageNormalizedJson.pages,effectiveCurrentPageId);if(!currentPage||!((_currentPage$frames=currentPage.frames)!=null&&_currentPage$frames.length)){return}isSystemUpdateRef.current=true;var raw=currentPage.frames[0].component;var processed=expandActions(raw);try{var _editorInstance$curre;(_editorInstance$curre=editorInstance.current)==null||_editorInstance$curre.setComponents(processed);setTimeout(function(){if(editorInstance.current&&isEditorAliveRef.current){var _editorInstance$curre2;var domComponents=(_editorInstance$curre2=editorInstance.current)==null?void 0:_editorInstance$curre2.DomComponents;if(domComponents){var _domComponents$getWra;var allComponents=domComponents==null||(_domComponents$getWra=domComponents.getWrapper())==null?void 0:_domComponents$getWra.findType("shadcn-generic");allComponents==null||allComponents.forEach(function(comp){if(comp.get("componentName")==="Tabs"){var _comp$view;(_comp$view=comp.view)==null||_comp$view.render()}})}}},100)}catch(error){// eslint-disable-next-line no-console
12
12
  console.error("Error during component restoration:",error)}var globalStyles=pageNormalizedJson.styles||[];var pageStyles=currentPage.styles||[];var mergedStyles=mergeStyles(globalStyles,pageStyles);var cssText=convertStyles(mergedStyles);(_editorInstance$curre3=editorInstance.current)==null||_editorInstance$curre3.setStyle(cssText);if(onRequestPageDataRef.current){var isMultiPage=Boolean(currentPage.dataQueries);var pageId=isMultiPage?currentPage.id:"";var queries=currentPage.dataQueries||[];onRequestPageDataRef.current(pageId,queries)}if(editorInstance.current){setComponentProperties(editorInstance.current,mode==="preview",isStreaming);setTimeout(function(){if(editorInstance.current&&isEditorAliveRef.current&&mode==="preview"){setComponentProperties(editorInstance.current,true,isStreaming)}},50)}setTimeout(function(){if(currentPage&&pageDataCache.current[currentPage.id]){var cachedData=pageDataCache.current[currentPage.id];Object.entries(cachedData).forEach(function(_ref5){var componentId=_ref5[0],data=_ref5[1];var model=renderedComponents.current[componentId];if(model&&data){if(data.newProps){model.set("componentProps",_extends({},model.get("componentProps"),data.newProps))}var updatedAttributes=_extends({},model.get("attributes"),data.newAttributes||{});model.set("attributes",updatedAttributes);if(model.view){model.view.render()}}});delete pageDataCache.current[currentPage.id]}},150);var cacheCheckInterval=setInterval(function(){if(!currentPage||!pageDataCache.current[currentPage.id]){return}var cachedData=pageDataCache.current[currentPage.id];var appliedAny=false;Object.entries(cachedData).forEach(function(_ref6){var componentId=_ref6[0],data=_ref6[1];var model=renderedComponents.current[componentId];if(model&&data){if(data.newProps){model.set("componentProps",_extends({},model.get("componentProps"),data.newProps))}var updatedAttributes=_extends({},model.get("attributes"),data.newAttributes||{});model.set("attributes",updatedAttributes);if(model.view){model.view.render()}appliedAny=true}});if(appliedAny){Object.keys(cachedData).forEach(function(componentId){if(renderedComponents.current[componentId]){delete cachedData[componentId]}});if(Object.keys(cachedData).length===0){delete pageDataCache.current[currentPage.id]}}},100);setTimeout(function(){clearInterval(cacheCheckInterval)},5000);setTimeout(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(){var storeResult;return _regeneratorRuntime.wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:if(!(editorInstance.current&&isEditorAliveRef.current)){_context3.next=6;break}_context3.next=3;return safeStoreEditor(editorInstance.current);case 3:storeResult=_context3.sent;if(storeResult){lastJsonRef.current=JSON.stringify(storeResult)}isSystemUpdateRef.current=false;case 6:case"end":return _context3.stop()}},_callee3)})),100)}},[json,effectiveCurrentPageId]);useEffect(function(){var editor=editorInstance.current;if(!editor||!isEditorAliveRef.current){return}if(isModeChangeFromToggle){setIsTransitioning(true)}setComponentProperties(editorInstance.current,mode==="preview",isStreaming!=null?isStreaming:false);var wrapper=editor.getWrapper();var shadcnComponents=(wrapper==null?void 0:wrapper.find("[data-gjs-type=\"shadcn-generic\"]"))||[];shadcnComponents.forEach(function(comp){if(comp.view&&typeof comp.view.render==="function"){comp.view.render()}});if(isModeChangeFromToggle){requestAnimationFrame(function(){setIsTransitioning(false)})}},[mode,isStreaming!=null?isStreaming:false]);useEffect(function(){var editor=editorInstance.current;var currentIsStreaming=isStreaming!=null?isStreaming:false;var prevIsStreaming=isStreamingRef.current;if(editor&&isEditorAliveRef.current&&currentIsStreaming&&!prevIsStreaming){var wrapper=editor.getWrapper();var shadcnComponents=(wrapper==null?void 0:wrapper.findType("shadcn-generic"))||[];shadcnComponents.forEach(function(comp){resetStreamingComponent(comp)})}isStreamingRef.current=currentIsStreaming},[isStreaming]);return/*#__PURE__*/_jsxs(React.Fragment,{children:[/*#__PURE__*/_jsx(StyledEditor,{}),/*#__PURE__*/_jsx("div",{ref:editorRef,id:"grapesjs-editor",style:{opacity:isTransitioning?0:1,transition:"opacity 0.15s ease-in-out"}})]})}function GrapejsCanvas(props){var _pages$2;var existingContext=usePageContext();if(existingContext){return/*#__PURE__*/_jsx(GrapejsCanvasInternal,_extends({},props))}var normalizedJson=normalizeMultiPageJson(props.json);var pages=normalizedJson.pages.map(extractPageMetadata);var initialPageId=props.currentPageId||((_pages$2=pages[0])==null?void 0:_pages$2.id)||"";return/*#__PURE__*/_jsx(PageProvider,{pages:pages,initialPageId:initialPageId,onPageChange:props.onPageChange,children:/*#__PURE__*/_jsx(GrapejsCanvasInternal,_extends({},props))})}export default GrapejsCanvas;
@@ -1 +1 @@
1
- {"version":3,"file":"GrapesjsCanvas.js","names":["React","useEffect","useRef","useState","grapesjs","tailwind","TypesToRegister","toKebabCase","tailwindCompiledCss","datePickerCss","extractPageMetadata","getCurrentPage","mergeStyles","normalizeMultiPageJson","createGrapesjsShadcnGenericPlugin","StyledEditor","PageProvider","usePageContext","jsx","_jsx","jsxs","_jsxs","isEditorCanvasReady","editor","canvas","Canvas","canvasDoc","getDocument","canvasBody","body","_unused","safeStoreEditor","_x","_safeStoreEditor","apply","arguments","_asyncToGenerator","_regeneratorRuntime","mark","_callee5","_editor$Pages","wrapper","pages","wrap","_callee5$","_context5","prev","next","getWrapper","abrupt","Pages","getAll","length","store","sent","t0","console","warn","stop","setComponentProperties","isPreview","isStreaming","setPropertiesRecursively","comp","isMutable","set","editable","draggable","droppable","getName","selectable","hoverable","highlightable","copyable","resizable","removable","badgable","_extends","get","isEditable","attributes","command","components","forEach","find","runCommand","stopCommand","convertStyles","stylesArray","map","block","selectors","Array","isArray","join","declarations","Object","entries","style","_ref","prop","value","createActionCardConfig","action","icon","title","description","type","componentName","componentProps","headerContent","bodyContent","expandActions","node","_node$componentProps","actions","classes","concat","undefined","i","id","setInteracting","renderedComponents","inProgress","component","componentId","showLoader","gjsModel","interactionApiInProgress","expandActionsComponent","model","append","addClass","resetStreamingComponent","attrs","props","cleanedProps","data","rows","series","pagination","error","isMissing","loading","GrapejsCanvasInternal","_ref2","_pages$","json","_ref2$mode","mode","setEditor","performInteraction","_ref2$newDataNotifier","newDataNotifier","_ref2$setHasChanged","setHasChanged","_ref2$isModeChangeFro","isModeChangeFromToggle","_ref2$isTemplateView","isTemplateView","externalCurrentPageId","currentPageId","externalOnPageChange","onPageChange","onRequestPageData","pageContext","normalizedJson","effectiveCurrentPageId","editorRef","editorInstance","pageDataCache","currentPageIdRef","isStreamingRef","modeRef","isSystemUpdateRef","lastJsonRef","isEditorAliveRef","onRequestPageDataRef","_useState","isTransitioning","setIsTransitioning","current","notificationHandler","compId","_props$newProps","newProps","_props$newAttributes","newAttributes","pageId","timestamp","Date","now","filteredProps","keys","key","name","parsedNewProps","isActionsComponent","hasValidActionsData","_model$components$at","isAlreadyExpanded","at","currentAttrs","hasRealValue","shouldStopLoading","view","render","handleNavigateToPage","targetPageId","navigateToPage","performInteractionWrapper","_x2","_performInteractionWrapper","_callee4","payload","updatedJson","apiResponse","componentUpdates","_callee4$","_context4","affectedComponents","_ref8","errorMessage","Error","message","finish","destroy","currentMode","init","container","height","plugins","storageManager","richTextEditor","customBadgeLabel","tagName","injectionAttempts","injectStylesEarly","_editor$Canvas","iframeDoc","head","querySelector","createElement","fullCss","innerHTML","setAttribute","appendChild","requestAnimationFrame","checkDirty","_checkDirty","_callee2","stored","newJson","_callee2$","_context2","JSON","stringify","debouncedCheckDirty","timeout","clearTimeout","setTimeout","evt","on","includes","_callee","canvasHead","storeResult","_callee$","_context","_ref4","DomComponents","getType","addType","defaults","cleanup","_json$pages","_currentPage$frames","_editorInstance$curre3","pageNormalizedJson","currentPage","frames","raw","processed","_editorInstance$curre","setComponents","_editorInstance$curre2","domComponents","_domComponents$getWra","allComponents","findType","_comp$view","globalStyles","styles","pageStyles","mergedStyles","cssText","setStyle","isMultiPage","Boolean","dataQueries","queries","cachedData","_ref5","updatedAttributes","cacheCheckInterval","setInterval","appliedAny","_ref6","clearInterval","_callee3","_callee3$","_context3","shadcnComponents","currentIsStreaming","prevIsStreaming","Fragment","children","ref","opacity","transition","GrapejsCanvas","_pages$2","existingContext","initialPageId"],"sources":["../src/GrapesjsCanvas.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React, { useEffect, useRef, useState } from 'react';\n// eslint-disable-next-line import/no-named-as-default\nimport grapesjs, { Component, Editor } from 'grapesjs';\nimport 'grapesjs/dist/css/grapes.min.css';\nimport tailwind from 'grapesjs-tailwind';\n\nimport { TypesToRegister } from './constants';\nimport { toKebabCase } from './helpers';\nimport { tailwindCompiledCss } from './helpers/css';\nimport { datePickerCss } from './helpers/date-picker';\nimport {\n extractPageMetadata,\n getCurrentPage,\n mergeStyles,\n normalizeMultiPageJson,\n} from './helpers/page-utils';\nimport { createGrapesjsShadcnGenericPlugin } from './plugins/grapejs-plugin';\nimport { StyledEditor } from './index.styles';\nimport type { PageAwareProps } from './types/page';\nimport { PageProvider, usePageContext } from './contexts/PageContext';\n\ntype NotificationHandler = (newData: {\n componentId: string;\n newProps: Record<string, any>;\n newAttributes: Record<string, any>;\n}) => boolean;\n\ntype GrapesjsCanvasProps = {\n json: any;\n mode?: 'editor' | 'preview';\n setEditor: (editor: Editor) => void;\n performInteraction: (payload: Record<string, any>) => Promise<Record<string, any> | undefined>;\n newDataNotifier: (notifHandler: NotificationHandler) => void;\n setHasChanged: (hasChanged: boolean) => void;\n isStreaming: boolean;\n isModeChangeFromToggle?: boolean;\n isTemplateView?: boolean;\n} & PageAwareProps;\n\nfunction isEditorCanvasReady(editor: Editor): boolean {\n try {\n const canvas = editor.Canvas;\n\n if (!canvas) {\n return false;\n }\n\n const canvasDoc = canvas.getDocument?.();\n\n if (!canvasDoc) {\n return false;\n }\n\n const canvasBody = canvasDoc.body;\n\n if (!canvasBody) {\n return false;\n }\n\n return true;\n } catch {\n return false;\n }\n}\n\nasync function safeStoreEditor(editor: Editor): Promise<any | null> {\n try {\n const wrapper = editor.getWrapper();\n\n if (!wrapper) {\n return null;\n }\n\n const pages = editor.Pages?.getAll?.() || [];\n\n if (pages.length === 0) {\n return null;\n }\n\n return await editor.store();\n } catch (error) {\n // eslint-disable-next-line no-console\n console.warn('Error during store operation:', error);\n\n return null;\n }\n}\n\nfunction setComponentProperties(editor: Editor, isPreview: boolean, isStreaming: boolean): void {\n if (!editor) {\n return;\n }\n\n function setPropertiesRecursively(comp: Component) {\n if (!comp) {\n return;\n }\n\n const isMutable = !isPreview && !isStreaming;\n\n comp.set({\n editable: isMutable,\n draggable: isMutable,\n droppable: isMutable && comp.getName() !== 'Shadcn-generic',\n selectable: isMutable,\n hoverable: isMutable,\n highlightable: isMutable,\n copyable: false,\n resizable: false,\n removable: isMutable,\n badgable: false,\n });\n\n comp.set('attributes', {\n ...(comp.get('attributes') || {}),\n isEditable: isMutable,\n });\n\n if (isMutable) {\n comp.set('toolbar', [\n { attributes: { class: 'fa fa-arrows' }, command: 'tlb-move' },\n { attributes: { class: 'fa fa-trash' }, command: 'tlb-delete' },\n ]);\n } else {\n comp.set('toolbar', []);\n }\n\n comp.components().forEach(setPropertiesRecursively);\n }\n\n const wrapper = editor.getWrapper();\n const components = wrapper?.find('*') || [];\n\n components.forEach(setPropertiesRecursively);\n\n if (isEditorCanvasReady(editor)) {\n if (isPreview) {\n editor.runCommand('core:preview');\n } else {\n editor.stopCommand('core:preview');\n }\n }\n}\n\nfunction convertStyles(stylesArray: any[]): string {\n return stylesArray\n .map((block) => {\n const selectors = Array.isArray(block.selectors)\n ? block.selectors.join(', ')\n : block.selectors;\n const declarations = Object.entries(block.style)\n .map(([prop, value]) => `${toKebabCase(prop)}: ${value};`)\n .join(' ');\n\n return `${selectors} { ${declarations} }`;\n })\n .join('\\n');\n}\n\nfunction createActionCardConfig(action: any): any {\n const { icon, title, description } = action;\n\n return {\n type: 'shadcn-generic',\n componentName: 'ActionCard',\n badgable: false,\n copyable: false,\n removable: true,\n draggable: true,\n componentProps: {\n icon,\n headerContent: title,\n bodyContent: description,\n },\n };\n}\n\nfunction expandActions(node: any): any {\n if (node.type === 'shadcn-generic' && node.componentName === 'Actions') {\n const actions = node.componentProps?.actions;\n\n if (Array.isArray(actions) && actions.length > 0) {\n return {\n ...node,\n type: 'div',\n classes: ['dashboard-cards', ...(node.classes || [])],\n componentName: undefined,\n componentProps: undefined,\n components: actions.map((action: any, i: number) => ({\n ...createActionCardConfig(action),\n id: `${node.id}--action-card-${i}`,\n })),\n };\n }\n\n return node;\n }\n\n if (Array.isArray(node.components)) {\n return {\n ...node,\n components: node.components.map(expandActions),\n };\n }\n\n return node;\n}\n\nfunction setInteracting(\n renderedComponents: Record<string, Component>,\n components: { componentId: string; showLoader: boolean }[],\n inProgress: boolean,\n) {\n components.forEach((component) => {\n const { componentId, showLoader } = component;\n\n if (!showLoader) {\n return;\n }\n\n const gjsModel = renderedComponents[componentId];\n\n if (gjsModel) {\n gjsModel.set('attributes', {\n ...gjsModel.get('attributes'),\n interactionApiInProgress: inProgress,\n });\n }\n });\n}\n\nfunction expandActionsComponent(model: Component, actions: any[]): void {\n model.components('');\n\n actions.forEach((action: any) => {\n model.append(createActionCardConfig(action));\n });\n\n model.set('type', 'div');\n model.addClass('dashboard-cards');\n model.set('componentName', undefined);\n model.set('componentProps', {});\n}\n\nfunction resetStreamingComponent(comp: Component): void {\n const attrs = comp.get('attributes') || {};\n const props = comp.get('componentProps') || {};\n\n const cleanedProps = { ...props };\n\n delete cleanedProps.bodyContent;\n delete cleanedProps.data;\n delete cleanedProps.rows;\n delete cleanedProps.series;\n delete cleanedProps.pagination;\n delete cleanedProps.error;\n delete cleanedProps.isMissing;\n\n comp.set({\n attributes: {\n ...attrs,\n loading: true,\n error: undefined,\n isMissing: undefined,\n },\n componentProps: cleanedProps,\n });\n}\n\nfunction GrapejsCanvasInternal({\n json,\n mode = 'preview',\n setEditor,\n performInteraction,\n newDataNotifier = () => {\n // no op\n },\n setHasChanged = () => {\n // no op\n },\n isStreaming,\n isModeChangeFromToggle = false,\n isTemplateView = false,\n currentPageId: externalCurrentPageId,\n onPageChange: externalOnPageChange, // eslint-disable-line @typescript-eslint/no-unused-vars\n onRequestPageData,\n}: GrapesjsCanvasProps) {\n const pageContext = usePageContext();\n\n const normalizedJson = normalizeMultiPageJson(json);\n const pages = normalizedJson.pages.map(extractPageMetadata);\n const effectiveCurrentPageId =\n externalCurrentPageId || pageContext?.currentPageId || pages[0]?.id || '';\n\n const editorRef = useRef<HTMLDivElement>(null);\n const editorInstance = useRef<Editor | null>(null);\n const renderedComponents = useRef<Record<string, Component>>({});\n const pageDataCache = useRef<Record<string, Record<string, any>>>({});\n const currentPageIdRef = useRef<string>(effectiveCurrentPageId);\n const isStreamingRef = useRef(isStreaming ?? false);\n const modeRef = useRef(mode);\n const isSystemUpdateRef = useRef(false);\n const lastJsonRef = useRef<string>('');\n const isEditorAliveRef = useRef(false);\n const onRequestPageDataRef = useRef(onRequestPageData);\n const [isTransitioning, setIsTransitioning] = useState(false);\n\n useEffect(() => {\n currentPageIdRef.current = effectiveCurrentPageId;\n }, [effectiveCurrentPageId]);\n\n useEffect(() => {\n isStreamingRef.current = isStreaming ?? false;\n }, [isStreaming ?? false]);\n\n useEffect(() => {\n modeRef.current = mode;\n }, [mode]);\n\n useEffect(() => {\n onRequestPageDataRef.current = onRequestPageData;\n }, [onRequestPageData]);\n\n function notificationHandler(\n props: Parameters<NotificationHandler>[0],\n ): ReturnType<NotificationHandler> {\n if (!props) {\n return true;\n }\n\n const { componentId: compId, newProps = {}, newAttributes = {} } = props;\n\n const model = renderedComponents.current[compId];\n\n if (!model) {\n const pageId = currentPageIdRef.current;\n\n if (pageId) {\n if (!pageDataCache.current[pageId]) {\n pageDataCache.current[pageId] = {};\n }\n\n pageDataCache.current[pageId][compId] = {\n newProps,\n newAttributes,\n timestamp: Date.now(),\n };\n }\n\n return false;\n }\n\n // Filter out complex placeholder objects by setting them to null\n // This ensures placeholder values are properly cleared and don't cause stale data issues\n const filteredProps = { ...newProps };\n\n Object.keys(filteredProps).forEach((key) => {\n const value = filteredProps[key];\n\n if (value && typeof value === 'object' && value.name === '__peak_placeholder') {\n filteredProps[key] = null;\n }\n });\n\n const parsedNewProps = {\n ...filteredProps,\n };\n\n if (filteredProps.pagination) {\n parsedNewProps.pagination = {\n ...(model.get('componentProps').pagination || {}),\n ...filteredProps.pagination,\n };\n }\n\n // Handle Actions component: expand into ActionCards when data arrives via streaming\n const isActionsComponent = model.get('componentName') === 'Actions';\n const hasValidActionsData =\n parsedNewProps.actions &&\n parsedNewProps.actions !== null &&\n Array.isArray(parsedNewProps.actions) &&\n parsedNewProps.actions.length > 0;\n\n if (isActionsComponent && hasValidActionsData) {\n const isAlreadyExpanded =\n model.components().length > 0 &&\n model.components().at(0)?.get('componentName') === 'ActionCard';\n\n if (!isAlreadyExpanded && editorInstance.current && isEditorAliveRef.current) {\n expandActionsComponent(model, parsedNewProps.actions);\n\n return true;\n }\n }\n\n model.set('componentProps', {\n ...model.get('componentProps'),\n ...parsedNewProps,\n });\n\n const currentAttrs = model.get('attributes') || {};\n\n const hasRealValue =\n (parsedNewProps?.bodyContent !== undefined && parsedNewProps?.bodyContent !== null) ||\n (parsedNewProps?.data !== undefined && parsedNewProps?.data !== null) ||\n (parsedNewProps?.rows !== undefined && parsedNewProps?.rows !== null) ||\n (parsedNewProps?.series !== undefined && parsedNewProps?.series !== null);\n\n const shouldStopLoading = hasRealValue || newAttributes?.error || parsedNewProps?.isMissing;\n\n model.set('attributes', {\n ...currentAttrs,\n ...newAttributes,\n ...(shouldStopLoading ? { loading: false } : {}),\n });\n\n if (model.view) {\n model.view.render();\n }\n\n return true;\n }\n\n useEffect(() => {\n newDataNotifier(notificationHandler);\n }, []);\n\n function handleNavigateToPage(targetPageId: string) {\n if (externalOnPageChange) {\n externalOnPageChange(targetPageId);\n }\n\n if (pageContext) {\n pageContext.navigateToPage(targetPageId);\n }\n }\n\n async function performInteractionWrapper(payload: Record<string, any>) {\n let updatedJson = null;\n\n if (editorInstance.current) {\n updatedJson = await safeStoreEditor(editorInstance.current);\n }\n\n setInteracting(renderedComponents.current, payload.affectedComponents, true);\n\n try {\n const apiResponse = await performInteraction({\n ...payload,\n json: updatedJson,\n });\n\n const componentUpdates = apiResponse || {};\n\n Object.entries(componentUpdates).forEach(([key, value]) => {\n const model = renderedComponents.current[key];\n\n if (model) {\n model.set('attributes', {\n ...model.get('attributes'),\n error: undefined,\n });\n\n model.set('componentProps', {\n ...model.get('componentProps'),\n ...value,\n error: undefined,\n isMissing: undefined,\n });\n }\n });\n\n return componentUpdates;\n } catch (error) {\n payload.affectedComponents.forEach((componentId: string) => {\n const model = renderedComponents.current[componentId];\n\n if (model) {\n const errorMessage =\n error instanceof Error ? error.message : 'Something went wrong. Please try again.';\n\n model.set('attributes', {\n ...model.get('attributes'),\n error: errorMessage,\n });\n\n model.set('componentProps', {\n ...model.get('componentProps'),\n error: errorMessage,\n isMissing: undefined,\n });\n }\n });\n\n throw error;\n } finally {\n setInteracting(renderedComponents.current, payload.affectedComponents, false);\n }\n }\n\n useEffect(() => {\n if (!editorRef.current) {\n return () => {\n // no op\n };\n }\n\n if (editorInstance.current) {\n editorInstance.current.destroy();\n editorInstance.current = null;\n isEditorAliveRef.current = false;\n }\n\n const currentMode = modeRef.current;\n\n const editor = grapesjs.init({\n container: editorRef.current,\n height: '100%',\n plugins: [\n tailwind,\n createGrapesjsShadcnGenericPlugin(\n modeRef,\n performInteractionWrapper,\n renderedComponents.current,\n setHasChanged,\n isTemplateView,\n isStreamingRef,\n handleNavigateToPage,\n ),\n ],\n storageManager: { type: 'none' },\n richTextEditor: {\n actions: ['bold', 'italic', 'underline', 'strikethrough'],\n },\n canvas: {\n customBadgeLabel: (component) => {\n const tagName = component.get('tagName');\n\n return tagName === 'body' ? '' : tagName || '';\n },\n },\n });\n\n isEditorAliveRef.current = true;\n\n let injectionAttempts = 0;\n\n function injectStylesEarly() {\n const iframeDoc = editor.Canvas?.getDocument?.();\n\n if (iframeDoc && iframeDoc.head) {\n if (!iframeDoc.head.querySelector('[data-grapesjs-styles]')) {\n const style = iframeDoc.createElement('style');\n const fullCss = `\n ${tailwindCompiledCss}\n ${datePickerCss}\n ::-webkit-scrollbar {\n width: 0px;\n height: 0px;\n }\n html, body {\n overflow: auto !important;\n -ms-overflow-style: none; /* IE and Edge */\n scrollbar-width: none; /* Firefox */\n }\n `;\n style.innerHTML = fullCss;\n style.setAttribute('type', 'text/css');\n style.setAttribute('data-grapesjs-styles', 'true');\n iframeDoc.head.appendChild(style);\n }\n } else if (injectionAttempts < 50) {\n injectionAttempts += 1;\n requestAnimationFrame(injectStylesEarly);\n }\n }\n\n requestAnimationFrame(injectStylesEarly);\n\n async function checkDirty() {\n if (isStreamingRef.current || isSystemUpdateRef.current) {\n return;\n }\n\n if (!isEditorAliveRef.current || !editorInstance.current) {\n return;\n }\n\n let stored = null;\n\n stored = await safeStoreEditor(editorInstance.current);\n\n if (!stored) {\n return;\n }\n\n const newJson = JSON.stringify(stored);\n\n if (newJson !== lastJsonRef.current) {\n setHasChanged(true);\n lastJsonRef.current = newJson;\n }\n }\n\n const debouncedCheckDirty = (() => {\n let timeout: NodeJS.Timeout | null = null;\n\n return () => {\n if (timeout) {\n clearTimeout(timeout);\n }\n\n timeout = setTimeout(checkDirty, 200);\n };\n })();\n\n [\n 'component:add',\n 'component:remove',\n 'component:update:content',\n 'style:update',\n 'component:drag:end',\n 'rte:change',\n ].forEach((evt) => {\n editor.on(evt, debouncedCheckDirty);\n });\n\n editor.on('component:update', (model, prop) => {\n if (['attributes', 'componentProps', 'content'].includes(prop)) {\n debouncedCheckDirty();\n }\n });\n\n // Tailwind CSS rules aren't fully added to our component\n // So, adding them from here!\n editor.on('load', async () => {\n const canvasDoc = editor.Canvas.getDocument();\n const canvasHead = canvasDoc.head;\n\n if (!canvasHead.querySelector('[data-grapesjs-styles]')) {\n const style = canvasDoc.createElement('style');\n const fullCss = `\n ${tailwindCompiledCss}\n ${datePickerCss}\n ::-webkit-scrollbar {\n width: 0px;\n height: 0px;\n }\n html, body {\n overflow: auto !important;\n -ms-overflow-style: none; /* IE and Edge */\n scrollbar-width: none; /* Firefox */\n }\n `;\n style.innerHTML = fullCss;\n style.setAttribute('type', 'text/css');\n style.setAttribute('data-grapesjs-styles', 'true');\n canvasHead.appendChild(style);\n }\n\n isSystemUpdateRef.current = true;\n const storeResult = await safeStoreEditor(editor);\n\n if (storeResult) {\n lastJsonRef.current = JSON.stringify(storeResult);\n }\n\n isSystemUpdateRef.current = false;\n\n setComponentProperties(editor, currentMode === 'preview', isStreamingRef.current);\n });\n\n editorInstance.current = editor;\n\n if (setEditor) {\n setEditor(editor);\n }\n\n TypesToRegister.forEach(({ type, tagName }) => {\n if (!editor.DomComponents.getType(type)) {\n editor.DomComponents.addType(type, {\n model: {\n defaults: { tagName },\n },\n view: {},\n });\n }\n });\n\n return function cleanup() {\n editor.destroy();\n isEditorAliveRef.current = false;\n };\n }, []);\n\n useEffect(() => {\n if (json && json.pages?.length > 0) {\n if (!isEditorAliveRef.current || !editorInstance.current) {\n return;\n }\n\n const pageNormalizedJson = normalizeMultiPageJson(json);\n\n const currentPage = getCurrentPage(pageNormalizedJson.pages, effectiveCurrentPageId);\n\n if (!currentPage || !currentPage.frames?.length) {\n return;\n }\n\n isSystemUpdateRef.current = true;\n const raw = currentPage.frames[0].component;\n const processed = expandActions(raw);\n\n try {\n editorInstance.current?.setComponents(processed);\n\n setTimeout(() => {\n if (editorInstance.current && isEditorAliveRef.current) {\n const domComponents = editorInstance.current?.DomComponents;\n\n if (domComponents) {\n const allComponents = domComponents?.getWrapper()?.findType('shadcn-generic');\n allComponents?.forEach((comp: any) => {\n if (comp.get('componentName') === 'Tabs') {\n comp.view?.render();\n }\n });\n }\n }\n }, 100);\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('Error during component restoration:', error);\n }\n\n const globalStyles = pageNormalizedJson.styles || [];\n const pageStyles = currentPage.styles || [];\n const mergedStyles = mergeStyles(globalStyles, pageStyles);\n const cssText = convertStyles(mergedStyles);\n editorInstance.current?.setStyle(cssText);\n\n if (onRequestPageDataRef.current) {\n const isMultiPage = Boolean(currentPage.dataQueries);\n const pageId = isMultiPage ? currentPage.id : '';\n const queries = currentPage.dataQueries || [];\n onRequestPageDataRef.current(pageId, queries);\n }\n\n if (editorInstance.current) {\n setComponentProperties(editorInstance.current, mode === 'preview', isStreaming);\n\n setTimeout(() => {\n if (editorInstance.current && isEditorAliveRef.current && mode === 'preview') {\n setComponentProperties(editorInstance.current, true, isStreaming);\n }\n }, 50);\n }\n\n setTimeout(() => {\n if (currentPage && pageDataCache.current[currentPage.id]) {\n const cachedData = pageDataCache.current[currentPage.id];\n\n Object.entries(cachedData).forEach(([componentId, data]) => {\n const model = renderedComponents.current[componentId];\n\n if (model && data) {\n if (data.newProps) {\n model.set('componentProps', {\n ...model.get('componentProps'),\n ...data.newProps,\n });\n }\n\n const updatedAttributes = {\n ...model.get('attributes'),\n ...(data.newAttributes || {}),\n };\n\n model.set('attributes', updatedAttributes);\n\n if (model.view) {\n model.view.render();\n }\n }\n });\n\n delete pageDataCache.current[currentPage.id];\n }\n }, 150);\n\n const cacheCheckInterval = setInterval(() => {\n if (!currentPage || !pageDataCache.current[currentPage.id]) {\n return;\n }\n\n const cachedData = pageDataCache.current[currentPage.id];\n let appliedAny = false;\n\n Object.entries(cachedData).forEach(([componentId, data]) => {\n const model = renderedComponents.current[componentId];\n\n if (model && data) {\n if (data.newProps) {\n model.set('componentProps', {\n ...model.get('componentProps'),\n ...data.newProps,\n });\n }\n\n const updatedAttributes = {\n ...model.get('attributes'),\n ...(data.newAttributes || {}),\n };\n\n model.set('attributes', updatedAttributes);\n\n if (model.view) {\n model.view.render();\n }\n\n appliedAny = true;\n }\n });\n\n if (appliedAny) {\n Object.keys(cachedData).forEach((componentId) => {\n if (renderedComponents.current[componentId]) {\n delete cachedData[componentId];\n }\n });\n\n if (Object.keys(cachedData).length === 0) {\n delete pageDataCache.current[currentPage.id];\n }\n }\n }, 100);\n\n setTimeout(() => {\n clearInterval(cacheCheckInterval);\n }, 5000);\n\n setTimeout(async () => {\n if (editorInstance.current && isEditorAliveRef.current) {\n const storeResult = await safeStoreEditor(editorInstance.current);\n\n if (storeResult) {\n lastJsonRef.current = JSON.stringify(storeResult);\n }\n\n isSystemUpdateRef.current = false;\n }\n }, 100);\n }\n }, [json, effectiveCurrentPageId]);\n\n useEffect(() => {\n const editor = editorInstance.current;\n\n if (!editor || !isEditorAliveRef.current) {\n return;\n }\n\n if (isModeChangeFromToggle) {\n setIsTransitioning(true);\n }\n\n setComponentProperties(\n editorInstance.current as Editor,\n mode === 'preview',\n isStreaming ?? false,\n );\n\n const wrapper = editor.getWrapper();\n const shadcnComponents = wrapper?.find('[data-gjs-type=\"shadcn-generic\"]') || [];\n\n shadcnComponents.forEach((comp: Component) => {\n if (comp.view && typeof comp.view.render === 'function') {\n comp.view.render();\n }\n });\n\n if (isModeChangeFromToggle) {\n requestAnimationFrame(() => {\n setIsTransitioning(false);\n });\n }\n }, [mode, isStreaming ?? false]);\n\n useEffect(() => {\n const editor = editorInstance.current;\n const currentIsStreaming = isStreaming ?? false;\n const prevIsStreaming = isStreamingRef.current;\n\n if (editor && isEditorAliveRef.current && currentIsStreaming && !prevIsStreaming) {\n const wrapper = editor.getWrapper();\n const shadcnComponents = wrapper?.findType('shadcn-generic') || [];\n\n shadcnComponents.forEach((comp: Component) => {\n resetStreamingComponent(comp);\n });\n }\n\n isStreamingRef.current = currentIsStreaming;\n }, [isStreaming]);\n\n return (\n <React.Fragment>\n <StyledEditor />\n <div\n ref={editorRef}\n id=\"grapesjs-editor\"\n style={{\n opacity: isTransitioning ? 0 : 1,\n transition: 'opacity 0.15s ease-in-out',\n }}\n />\n </React.Fragment>\n );\n}\n\nfunction GrapejsCanvas(props: GrapesjsCanvasProps) {\n const existingContext = usePageContext();\n\n if (existingContext) {\n return <GrapejsCanvasInternal {...props} />;\n }\n\n const normalizedJson = normalizeMultiPageJson(props.json);\n const pages = normalizedJson.pages.map(extractPageMetadata);\n const initialPageId = props.currentPageId || pages[0]?.id || '';\n\n return (\n <PageProvider pages={pages} initialPageId={initialPageId} onPageChange={props.onPageChange}>\n <GrapejsCanvasInternal {...props} />\n </PageProvider>\n );\n}\n\nexport default GrapejsCanvas;\n"],"mappings":"wLAAA,uDACA,MAAO,CAAAA,KAAK,EAAIC,SAAS,CAAEC,MAAM,CAAEC,QAAQ,KAAQ,OAAO,CAC1D;AACA,MAAO,CAAAC,QAAQ,KAA6B,UAAU,CACtD,MAAO,kCAAkC,CACzC,MAAO,CAAAC,QAAQ,KAAM,mBAAmB,CAExC,OAASC,eAAe,KAAQ,aAAa,CAC7C,OAASC,WAAW,KAAQ,WAAW,CACvC,OAASC,mBAAmB,KAAQ,eAAe,CACnD,OAASC,aAAa,KAAQ,uBAAuB,CACrD,OACEC,mBAAmB,CACnBC,cAAc,CACdC,WAAW,CACXC,sBAAsB,KACjB,sBAAsB,CAC7B,OAASC,iCAAiC,KAAQ,0BAA0B,CAC5E,OAASC,YAAY,KAAQ,gBAAgB,CAE7C,OAASC,YAAY,CAAEC,cAAc,KAAQ,wBAAwB,CAAC,OAAAC,GAAA,IAAAC,IAAA,CAAAC,IAAA,IAAAC,KAAA,yBAoBtE,QAAS,CAAAC,mBAAmBA,CAACC,MAAc,CAAW,CACpD,GAAI,CACF,GAAM,CAAAC,MAAM,CAAGD,MAAM,CAACE,MAAM,CAE5B,GAAI,CAACD,MAAM,CAAE,CACX,MAAO,MACT,CAEA,GAAM,CAAAE,SAAS,CAAGF,MAAM,CAACG,WAAW,cAAlBH,MAAM,CAACG,WAAW,CAAG,CAAC,CAExC,GAAI,CAACD,SAAS,CAAE,CACd,MAAO,MACT,CAEA,GAAM,CAAAE,UAAU,CAAGF,SAAS,CAACG,IAAI,CAEjC,GAAI,CAACD,UAAU,CAAE,CACf,MAAO,MACT,CAEA,MAAO,KACT,CAAE,MAAAE,OAAA,CAAM,CACN,MAAO,MACT,CACF,CAAC,QAEc,CAAAC,eAAeA,CAAAC,EAAA,SAAAC,gBAAA,CAAAC,KAA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as.js","names":["React","useEffect","useRef","useState","grapesjs","tailwind","TypesToRegister","toKebabCase","tailwindCompiledCss","datePickerCss","extractPageMetadata","getCurrentPage","mergeStyles","normalizeMultiPageJson","createGrapesjsShadcnGenericPlugin","StyledEditor","PageProvider","usePageContext","jsx","_jsx","jsxs","_jsxs","isEditorCanvasReady","editor","canvas","Canvas","canvasDoc","getDocument","canvasBody","body","_unused","safeStoreEditor","_x","_safeStoreEditor","apply","arguments","_asyncToGenerator","_regeneratorRuntime","mark","_callee6","_editor$Pages","wrapper","pages","wrap","_callee6$","_context6","prev","next","getWrapper","abrupt","Pages","getAll","length","store","sent","t0","console","warn","stop","setComponentProperties","isPreview","isStreaming","setPropertiesRecursively","comp","isMutable","set","editable","draggable","droppable","getName","selectable","hoverable","highlightable","copyable","resizable","removable","badgable","_extends","get","isEditable","attributes","command","components","forEach","find","runCommand","stopCommand","convertStyles","stylesArray","map","block","selectors","Array","isArray","join","declarations","Object","entries","style","_ref","prop","value","createActionCardConfig","action","icon","title","description","type","componentName","componentProps","headerContent","bodyContent","expandActions","node","_node$componentProps","actions","classes","concat","undefined","i","id","setInteracting","renderedComponents","inProgress","component","componentId","showLoader","gjsModel","interactionApiInProgress","expandActionsComponent","model","append","addClass","resetStreamingComponent","attrs","props","cleanedProps","data","rows","series","pagination","error","isMissing","loading","GrapejsCanvasInternal","_ref2","_pages$","json","_ref2$mode","mode","setEditor","performInteraction","downloadTable","_ref2$newDataNotifier","newDataNotifier","_ref2$setHasChanged","setHasChanged","_ref2$isModeChangeFro","isModeChangeFromToggle","_ref2$isTemplateView","isTemplateView","externalCurrentPageId","currentPageId","externalOnPageChange","onPageChange","onRequestPageData","pageContext","normalizedJson","effectiveCurrentPageId","editorRef","editorInstance","pageDataCache","currentPageIdRef","isStreamingRef","modeRef","isSystemUpdateRef","lastJsonRef","isEditorAliveRef","onRequestPageDataRef","_useState","isTransitioning","setIsTransitioning","current","notificationHandler","compId","_props$newProps","newProps","_props$newAttributes","newAttributes","pageId","timestamp","Date","now","filteredProps","keys","key","name","parsedNewProps","isActionsComponent","hasValidActionsData","_model$components$at","isAlreadyExpanded","at","currentAttrs","hasRealValue","shouldStopLoading","view","render","handleNavigateToPage","targetPageId","navigateToPage","downloadTableWrapper","_x2","_downloadTableWrapper","_callee4","updatedJson","_callee4$","_context4","performInteractionWrapper","_x3","_performInteractionWrapper","_callee5","payload","apiResponse","componentUpdates","_callee5$","_context5","affectedComponents","_ref8","errorMessage","Error","message","finish","destroy","currentMode","init","container","height","plugins","storageManager","richTextEditor","customBadgeLabel","tagName","injectionAttempts","injectStylesEarly","_editor$Canvas","iframeDoc","head","querySelector","createElement","fullCss","innerHTML","setAttribute","appendChild","requestAnimationFrame","checkDirty","_checkDirty","_callee2","stored","newJson","_callee2$","_context2","JSON","stringify","debouncedCheckDirty","timeout","clearTimeout","setTimeout","evt","on","includes","_callee","canvasHead","storeResult","_callee$","_context","_ref4","DomComponents","getType","addType","defaults","cleanup","_json$pages","_currentPage$frames","_editorInstance$curre3","pageNormalizedJson","currentPage","frames","raw","processed","_editorInstance$curre","setComponents","_editorInstance$curre2","domComponents","_domComponents$getWra","allComponents","findType","_comp$view","globalStyles","styles","pageStyles","mergedStyles","cssText","setStyle","isMultiPage","Boolean","dataQueries","queries","cachedData","_ref5","updatedAttributes","cacheCheckInterval","setInterval","appliedAny","_ref6","clearInterval","_callee3","_callee3$","_context3","shadcnComponents","currentIsStreaming","prevIsStreaming","Fragment","children","ref","opacity","transition","GrapejsCanvas","_pages$2","existingContext","initialPageId"],"sources":["../src/GrapesjsCanvas.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React, { useEffect, useRef, useState } from 'react';\n// eslint-disable-next-line import/no-named-as-default\nimport grapesjs, { Component, Editor } from 'grapesjs';\nimport 'grapesjs/dist/css/grapes.min.css';\nimport tailwind from 'grapesjs-tailwind';\n\nimport { TypesToRegister } from './constants';\nimport { toKebabCase } from './helpers';\nimport { tailwindCompiledCss } from './helpers/css';\nimport { datePickerCss } from './helpers/date-picker';\nimport {\n extractPageMetadata,\n getCurrentPage,\n mergeStyles,\n normalizeMultiPageJson,\n} from './helpers/page-utils';\nimport { createGrapesjsShadcnGenericPlugin } from './plugins/grapejs-plugin';\nimport { StyledEditor } from './index.styles';\nimport type { PageAwareProps } from './types/page';\nimport { PageProvider, usePageContext } from './contexts/PageContext';\n\ntype NotificationHandler = (newData: {\n componentId: string;\n newProps: Record<string, any>;\n newAttributes: Record<string, any>;\n}) => boolean;\n\ntype GrapesjsCanvasProps = {\n json: any;\n mode?: 'editor' | 'preview';\n setEditor: (editor: Editor) => void;\n performInteraction: (payload: Record<string, any>) => Promise<Record<string, any> | undefined>;\n downloadTable?: (data: { tableId: string; title: string; limit: number; json: any; headerMapper?: Record<string, string> }) => Promise<void>;\n newDataNotifier: (notifHandler: NotificationHandler) => void;\n setHasChanged: (hasChanged: boolean) => void;\n isStreaming: boolean;\n isModeChangeFromToggle?: boolean;\n isTemplateView?: boolean;\n} & PageAwareProps;\n\nfunction isEditorCanvasReady(editor: Editor): boolean {\n try {\n const canvas = editor.Canvas;\n\n if (!canvas) {\n return false;\n }\n\n const canvasDoc = canvas.getDocument?.();\n\n if (!canvasDoc) {\n return false;\n }\n\n const canvasBody = canvasDoc.body;\n\n if (!canvasBody) {\n return false;\n }\n\n return true;\n } catch {\n return false;\n }\n}\n\nasync function safeStoreEditor(editor: Editor): Promise<any | null> {\n try {\n const wrapper = editor.getWrapper();\n\n if (!wrapper) {\n return null;\n }\n\n const pages = editor.Pages?.getAll?.() || [];\n\n if (pages.length === 0) {\n return null;\n }\n\n return await editor.store();\n } catch (error) {\n // eslint-disable-next-line no-console\n console.warn('Error during store operation:', error);\n\n return null;\n }\n}\n\nfunction setComponentProperties(editor: Editor, isPreview: boolean, isStreaming: boolean): void {\n if (!editor) {\n return;\n }\n\n function setPropertiesRecursively(comp: Component) {\n if (!comp) {\n return;\n }\n\n const isMutable = !isPreview && !isStreaming;\n\n comp.set({\n editable: isMutable,\n draggable: isMutable,\n droppable: isMutable && comp.getName() !== 'Shadcn-generic',\n selectable: isMutable,\n hoverable: isMutable,\n highlightable: isMutable,\n copyable: false,\n resizable: false,\n removable: isMutable,\n badgable: false,\n });\n\n comp.set('attributes', {\n ...(comp.get('attributes') || {}),\n isEditable: isMutable,\n });\n\n if (isMutable) {\n comp.set('toolbar', [\n { attributes: { class: 'fa fa-arrows' }, command: 'tlb-move' },\n { attributes: { class: 'fa fa-trash' }, command: 'tlb-delete' },\n ]);\n } else {\n comp.set('toolbar', []);\n }\n\n comp.components().forEach(setPropertiesRecursively);\n }\n\n const wrapper = editor.getWrapper();\n const components = wrapper?.find('*') || [];\n\n components.forEach(setPropertiesRecursively);\n\n if (isEditorCanvasReady(editor)) {\n if (isPreview) {\n editor.runCommand('core:preview');\n } else {\n editor.stopCommand('core:preview');\n }\n }\n}\n\nfunction convertStyles(stylesArray: any[]): string {\n return stylesArray\n .map((block) => {\n const selectors = Array.isArray(block.selectors)\n ? block.selectors.join(', ')\n : block.selectors;\n const declarations = Object.entries(block.style)\n .map(([prop, value]) => `${toKebabCase(prop)}: ${value};`)\n .join(' ');\n\n return `${selectors} { ${declarations} }`;\n })\n .join('\\n');\n}\n\nfunction createActionCardConfig(action: any): any {\n const { icon, title, description } = action;\n\n return {\n type: 'shadcn-generic',\n componentName: 'ActionCard',\n badgable: false,\n copyable: false,\n removable: true,\n draggable: true,\n componentProps: {\n icon,\n headerContent: title,\n bodyContent: description,\n },\n };\n}\n\nfunction expandActions(node: any): any {\n if (node.type === 'shadcn-generic' && node.componentName === 'Actions') {\n const actions = node.componentProps?.actions;\n\n if (Array.isArray(actions) && actions.length > 0) {\n return {\n ...node,\n type: 'div',\n classes: ['dashboard-cards', ...(node.classes || [])],\n componentName: undefined,\n componentProps: undefined,\n components: actions.map((action: any, i: number) => ({\n ...createActionCardConfig(action),\n id: `${node.id}--action-card-${i}`,\n })),\n };\n }\n\n return node;\n }\n\n if (Array.isArray(node.components)) {\n return {\n ...node,\n components: node.components.map(expandActions),\n };\n }\n\n return node;\n}\n\nfunction setInteracting(\n renderedComponents: Record<string, Component>,\n components: { componentId: string; showLoader: boolean }[],\n inProgress: boolean,\n) {\n components.forEach((component) => {\n const { componentId, showLoader } = component;\n\n if (!showLoader) {\n return;\n }\n\n const gjsModel = renderedComponents[componentId];\n\n if (gjsModel) {\n gjsModel.set('attributes', {\n ...gjsModel.get('attributes'),\n interactionApiInProgress: inProgress,\n });\n }\n });\n}\n\nfunction expandActionsComponent(model: Component, actions: any[]): void {\n model.components('');\n\n actions.forEach((action: any) => {\n model.append(createActionCardConfig(action));\n });\n\n model.set('type', 'div');\n model.addClass('dashboard-cards');\n model.set('componentName', undefined);\n model.set('componentProps', {});\n}\n\nfunction resetStreamingComponent(comp: Component): void {\n const attrs = comp.get('attributes') || {};\n const props = comp.get('componentProps') || {};\n\n const cleanedProps = { ...props };\n\n delete cleanedProps.bodyContent;\n delete cleanedProps.data;\n delete cleanedProps.rows;\n delete cleanedProps.series;\n delete cleanedProps.pagination;\n delete cleanedProps.error;\n delete cleanedProps.isMissing;\n\n comp.set({\n attributes: {\n ...attrs,\n loading: true,\n error: undefined,\n isMissing: undefined,\n },\n componentProps: cleanedProps,\n });\n}\n\nfunction GrapejsCanvasInternal({\n json,\n mode = 'preview',\n setEditor,\n performInteraction,\n downloadTable,\n newDataNotifier = () => {\n // no op\n },\n setHasChanged = () => {\n // no op\n },\n isStreaming,\n isModeChangeFromToggle = false,\n isTemplateView = false,\n currentPageId: externalCurrentPageId,\n onPageChange: externalOnPageChange, // eslint-disable-line @typescript-eslint/no-unused-vars\n onRequestPageData,\n}: GrapesjsCanvasProps) {\n const pageContext = usePageContext();\n\n const normalizedJson = normalizeMultiPageJson(json);\n const pages = normalizedJson.pages.map(extractPageMetadata);\n const effectiveCurrentPageId =\n externalCurrentPageId || pageContext?.currentPageId || pages[0]?.id || '';\n\n const editorRef = useRef<HTMLDivElement>(null);\n const editorInstance = useRef<Editor | null>(null);\n const renderedComponents = useRef<Record<string, Component>>({});\n const pageDataCache = useRef<Record<string, Record<string, any>>>({});\n const currentPageIdRef = useRef<string>(effectiveCurrentPageId);\n const isStreamingRef = useRef(isStreaming ?? false);\n const modeRef = useRef(mode);\n const isSystemUpdateRef = useRef(false);\n const lastJsonRef = useRef<string>('');\n const isEditorAliveRef = useRef(false);\n const onRequestPageDataRef = useRef(onRequestPageData);\n const [isTransitioning, setIsTransitioning] = useState(false);\n\n useEffect(() => {\n currentPageIdRef.current = effectiveCurrentPageId;\n }, [effectiveCurrentPageId]);\n\n useEffect(() => {\n isStreamingRef.current = isStreaming ?? false;\n }, [isStreaming ?? false]);\n\n useEffect(() => {\n modeRef.current = mode;\n }, [mode]);\n\n useEffect(() => {\n onRequestPageDataRef.current = onRequestPageData;\n }, [onRequestPageData]);\n\n function notificationHandler(\n props: Parameters<NotificationHandler>[0],\n ): ReturnType<NotificationHandler> {\n if (!props) {\n return true;\n }\n\n const { componentId: compId, newProps = {}, newAttributes = {} } = props;\n\n const model = renderedComponents.current[compId];\n\n if (!model) {\n const pageId = currentPageIdRef.current;\n\n if (pageId) {\n if (!pageDataCache.current[pageId]) {\n pageDataCache.current[pageId] = {};\n }\n\n pageDataCache.current[pageId][compId] = {\n newProps,\n newAttributes,\n timestamp: Date.now(),\n };\n }\n\n return false;\n }\n\n // Filter out complex placeholder objects by setting them to null\n // This ensures placeholder values are properly cleared and don't cause stale data issues\n const filteredProps = { ...newProps };\n\n Object.keys(filteredProps).forEach((key) => {\n const value = filteredProps[key];\n\n if (value && typeof value === 'object' && value.name === '__peak_placeholder') {\n filteredProps[key] = null;\n }\n });\n\n const parsedNewProps = {\n ...filteredProps,\n };\n\n if (filteredProps.pagination) {\n parsedNewProps.pagination = {\n ...(model.get('componentProps').pagination || {}),\n ...filteredProps.pagination,\n };\n }\n\n // Handle Actions component: expand into ActionCards when data arrives via streaming\n const isActionsComponent = model.get('componentName') === 'Actions';\n const hasValidActionsData =\n parsedNewProps.actions &&\n parsedNewProps.actions !== null &&\n Array.isArray(parsedNewProps.actions) &&\n parsedNewProps.actions.length > 0;\n\n if (isActionsComponent && hasValidActionsData) {\n const isAlreadyExpanded =\n model.components().length > 0 &&\n model.components().at(0)?.get('componentName') === 'ActionCard';\n\n if (!isAlreadyExpanded && editorInstance.current && isEditorAliveRef.current) {\n expandActionsComponent(model, parsedNewProps.actions);\n\n return true;\n }\n }\n\n model.set('componentProps', {\n ...model.get('componentProps'),\n ...parsedNewProps,\n });\n\n const currentAttrs = model.get('attributes') || {};\n\n const hasRealValue =\n (parsedNewProps?.bodyContent !== undefined && parsedNewProps?.bodyContent !== null) ||\n (parsedNewProps?.data !== undefined && parsedNewProps?.data !== null) ||\n (parsedNewProps?.rows !== undefined && parsedNewProps?.rows !== null) ||\n (parsedNewProps?.series !== undefined && parsedNewProps?.series !== null);\n\n const shouldStopLoading = hasRealValue || newAttributes?.error || parsedNewProps?.isMissing;\n\n model.set('attributes', {\n ...currentAttrs,\n ...newAttributes,\n ...(shouldStopLoading ? { loading: false } : {}),\n });\n\n if (model.view) {\n model.view.render();\n }\n\n return true;\n }\n\n useEffect(() => {\n newDataNotifier(notificationHandler);\n }, []);\n\n function handleNavigateToPage(targetPageId: string) {\n if (externalOnPageChange) {\n externalOnPageChange(targetPageId);\n }\n\n if (pageContext) {\n pageContext.navigateToPage(targetPageId);\n }\n }\n\n async function downloadTableWrapper(data: { tableId: string; title: string; limit: number; headerMapper?: Record<string, string> }) {\n if (!downloadTable) return;\n let updatedJson = null;\n if (editorInstance.current) {\n updatedJson = await safeStoreEditor(editorInstance.current);\n }\n await downloadTable({ ...data, json: updatedJson });\n }\n\n async function performInteractionWrapper(payload: Record<string, any>) {\n let updatedJson = null;\n\n if (editorInstance.current) {\n updatedJson = await safeStoreEditor(editorInstance.current);\n }\n\n setInteracting(renderedComponents.current, payload.affectedComponents, true);\n\n try {\n const apiResponse = await performInteraction({\n ...payload,\n json: updatedJson,\n });\n\n const componentUpdates = apiResponse || {};\n\n Object.entries(componentUpdates).forEach(([key, value]) => {\n const model = renderedComponents.current[key];\n\n if (model) {\n model.set('attributes', {\n ...model.get('attributes'),\n error: undefined,\n });\n\n model.set('componentProps', {\n ...model.get('componentProps'),\n ...value,\n error: undefined,\n isMissing: undefined,\n });\n }\n });\n\n return componentUpdates;\n } catch (error) {\n payload.affectedComponents.forEach((componentId: string) => {\n const model = renderedComponents.current[componentId];\n\n if (model) {\n const errorMessage =\n error instanceof Error ? error.message : 'Something went wrong. Please try again.';\n\n model.set('attributes', {\n ...model.get('attributes'),\n error: errorMessage,\n });\n\n model.set('componentProps', {\n ...model.get('componentProps'),\n error: errorMessage,\n isMissing: undefined,\n });\n }\n });\n\n throw error;\n } finally {\n setInteracting(renderedComponents.current, payload.affectedComponents, false);\n }\n }\n\n useEffect(() => {\n if (!editorRef.current) {\n return () => {\n // no op\n };\n }\n\n if (editorInstance.current) {\n editorInstance.current.destroy();\n editorInstance.current = null;\n isEditorAliveRef.current = false;\n }\n\n const currentMode = modeRef.current;\n\n const editor = grapesjs.init({\n container: editorRef.current,\n height: '100%',\n plugins: [\n tailwind,\n createGrapesjsShadcnGenericPlugin(\n modeRef,\n performInteractionWrapper,\n renderedComponents.current,\n setHasChanged,\n isTemplateView,\n isStreamingRef,\n handleNavigateToPage,\n downloadTableWrapper,\n ),\n ],\n storageManager: { type: 'none' },\n richTextEditor: {\n actions: ['bold', 'italic', 'underline', 'strikethrough'],\n },\n canvas: {\n customBadgeLabel: (component) => {\n const tagName = component.get('tagName');\n\n return tagName === 'body' ? '' : tagName || '';\n },\n },\n });\n\n isEditorAliveRef.current = true;\n\n let injectionAttempts = 0;\n\n function injectStylesEarly() {\n const iframeDoc = editor.Canvas?.getDocument?.();\n\n if (iframeDoc && iframeDoc.head) {\n if (!iframeDoc.head.querySelector('[data-grapesjs-styles]')) {\n const style = iframeDoc.createElement('style');\n const fullCss = `\n ${tailwindCompiledCss}\n ${datePickerCss}\n ::-webkit-scrollbar {\n width: 0px;\n height: 0px;\n }\n html, body {\n overflow: auto !important;\n -ms-overflow-style: none; /* IE and Edge */\n scrollbar-width: none; /* Firefox */\n }\n `;\n style.innerHTML = fullCss;\n style.setAttribute('type', 'text/css');\n style.setAttribute('data-grapesjs-styles', 'true');\n iframeDoc.head.appendChild(style);\n }\n } else if (injectionAttempts < 50) {\n injectionAttempts += 1;\n requestAnimationFrame(injectStylesEarly);\n }\n }\n\n requestAnimationFrame(injectStylesEarly);\n\n async function checkDirty() {\n if (isStreamingRef.current || isSystemUpdateRef.current) {\n return;\n }\n\n if (!isEditorAliveRef.current || !editorInstance.current) {\n return;\n }\n\n let stored = null;\n\n stored = await safeStoreEditor(editorInstance.current);\n\n if (!stored) {\n return;\n }\n\n const newJson = JSON.stringify(stored);\n\n if (newJson !== lastJsonRef.current) {\n setHasChanged(true);\n lastJsonRef.current = newJson;\n }\n }\n\n const debouncedCheckDirty = (() => {\n let timeout: NodeJS.Timeout | null = null;\n\n return () => {\n if (timeout) {\n clearTimeout(timeout);\n }\n\n timeout = setTimeout(checkDirty, 200);\n };\n })();\n\n [\n 'component:add',\n 'component:remove',\n 'component:update:content',\n 'style:update',\n 'component:drag:end',\n 'rte:change',\n ].forEach((evt) => {\n editor.on(evt, debouncedCheckDirty);\n });\n\n editor.on('component:update', (model, prop) => {\n if (['attributes', 'componentProps', 'content'].includes(prop)) {\n debouncedCheckDirty();\n }\n });\n\n // Tailwind CSS rules aren't fully added to our component\n // So, adding them from here!\n editor.on('load', async () => {\n const canvasDoc = editor.Canvas.getDocument();\n const canvasHead = canvasDoc.head;\n\n if (!canvasHead.querySelector('[data-grapesjs-styles]')) {\n const style = canvasDoc.createElement('style');\n const fullCss = `\n ${tailwindCompiledCss}\n ${datePickerCss}\n ::-webkit-scrollbar {\n width: 0px;\n height: 0px;\n }\n html, body {\n overflow: auto !important;\n -ms-overflow-style: none; /* IE and Edge */\n scrollbar-width: none; /* Firefox */\n }\n `;\n style.innerHTML = fullCss;\n style.setAttribute('type', 'text/css');\n style.setAttribute('data-grapesjs-styles', 'true');\n canvasHead.appendChild(style);\n }\n\n isSystemUpdateRef.current = true;\n const storeResult = await safeStoreEditor(editor);\n\n if (storeResult) {\n lastJsonRef.current = JSON.stringify(storeResult);\n }\n\n isSystemUpdateRef.current = false;\n\n setComponentProperties(editor, currentMode === 'preview', isStreamingRef.current);\n });\n\n editorInstance.current = editor;\n\n if (setEditor) {\n setEditor(editor);\n }\n\n TypesToRegister.forEach(({ type, tagName }) => {\n if (!editor.DomComponents.getType(type)) {\n editor.DomComponents.addType(type, {\n model: {\n defaults: { tagName },\n },\n view: {},\n });\n }\n });\n\n return function cleanup() {\n editor.destroy();\n isEditorAliveRef.current = false;\n };\n }, []);\n\n useEffect(() => {\n if (json && json.pages?.length > 0) {\n if (!isEditorAliveRef.current || !editorInstance.current) {\n return;\n }\n\n const pageNormalizedJson = normalizeMultiPageJson(json);\n\n const currentPage = getCurrentPage(pageNormalizedJson.pages, effectiveCurrentPageId);\n\n if (!currentPage || !currentPage.frames?.length) {\n return;\n }\n\n isSystemUpdateRef.current = true;\n const raw = currentPage.frames[0].component;\n const processed = expandActions(raw);\n\n try {\n editorInstance.current?.setComponents(processed);\n\n setTimeout(() => {\n if (editorInstance.current && isEditorAliveRef.current) {\n const domComponents = editorInstance.current?.DomComponents;\n\n if (domComponents) {\n const allComponents = domComponents?.getWrapper()?.findType('shadcn-generic');\n allComponents?.forEach((comp: any) => {\n if (comp.get('componentName') === 'Tabs') {\n comp.view?.render();\n }\n });\n }\n }\n }, 100);\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('Error during component restoration:', error);\n }\n\n const globalStyles = pageNormalizedJson.styles || [];\n const pageStyles = currentPage.styles || [];\n const mergedStyles = mergeStyles(globalStyles, pageStyles);\n const cssText = convertStyles(mergedStyles);\n editorInstance.current?.setStyle(cssText);\n\n if (onRequestPageDataRef.current) {\n const isMultiPage = Boolean(currentPage.dataQueries);\n const pageId = isMultiPage ? currentPage.id : '';\n const queries = currentPage.dataQueries || [];\n onRequestPageDataRef.current(pageId, queries);\n }\n\n if (editorInstance.current) {\n setComponentProperties(editorInstance.current, mode === 'preview', isStreaming);\n\n setTimeout(() => {\n if (editorInstance.current && isEditorAliveRef.current && mode === 'preview') {\n setComponentProperties(editorInstance.current, true, isStreaming);\n }\n }, 50);\n }\n\n setTimeout(() => {\n if (currentPage && pageDataCache.current[currentPage.id]) {\n const cachedData = pageDataCache.current[currentPage.id];\n\n Object.entries(cachedData).forEach(([componentId, data]) => {\n const model = renderedComponents.current[componentId];\n\n if (model && data) {\n if (data.newProps) {\n model.set('componentProps', {\n ...model.get('componentProps'),\n ...data.newProps,\n });\n }\n\n const updatedAttributes = {\n ...model.get('attributes'),\n ...(data.newAttributes || {}),\n };\n\n model.set('attributes', updatedAttributes);\n\n if (model.view) {\n model.view.render();\n }\n }\n });\n\n delete pageDataCache.current[currentPage.id];\n }\n }, 150);\n\n const cacheCheckInterval = setInterval(() => {\n if (!currentPage || !pageDataCache.current[currentPage.id]) {\n return;\n }\n\n const cachedData = pageDataCache.current[currentPage.id];\n let appliedAny = false;\n\n Object.entries(cachedData).forEach(([componentId, data]) => {\n const model = renderedComponents.current[componentId];\n\n if (model && data) {\n if (data.newProps) {\n model.set('componentProps', {\n ...model.get('componentProps'),\n ...data.newProps,\n });\n }\n\n const updatedAttributes = {\n ...model.get('attributes'),\n ...(data.newAttributes || {}),\n };\n\n model.set('attributes', updatedAttributes);\n\n if (model.view) {\n model.view.render();\n }\n\n appliedAny = true;\n }\n });\n\n if (appliedAny) {\n Object.keys(cachedData).forEach((componentId) => {\n if (renderedComponents.current[componentId]) {\n delete cachedData[componentId];\n }\n });\n\n if (Object.keys(cachedData).length === 0) {\n delete pageDataCache.current[currentPage.id];\n }\n }\n }, 100);\n\n setTimeout(() => {\n clearInterval(cacheCheckInterval);\n }, 5000);\n\n setTimeout(async () => {\n if (editorInstance.current && isEditorAliveRef.current) {\n const storeResult = await safeStoreEditor(editorInstance.current);\n\n if (storeResult) {\n lastJsonRef.current = JSON.stringify(storeResult);\n }\n\n isSystemUpdateRef.current = false;\n }\n }, 100);\n }\n }, [json, effectiveCurrentPageId]);\n\n useEffect(() => {\n const editor = editorInstance.current;\n\n if (!editor || !isEditorAliveRef.current) {\n return;\n }\n\n if (isModeChangeFromToggle) {\n setIsTransitioning(true);\n }\n\n setComponentProperties(\n editorInstance.current as Editor,\n mode === 'preview',\n isStreaming ?? false,\n );\n\n const wrapper = editor.getWrapper();\n const shadcnComponents = wrapper?.find('[data-gjs-type=\"shadcn-generic\"]') || [];\n\n shadcnComponents.forEach((comp: Component) => {\n if (comp.view && typeof comp.view.render === 'function') {\n comp.view.render();\n }\n });\n\n if (isModeChangeFromToggle) {\n requestAnimationFrame(() => {\n setIsTransitioning(false);\n });\n }\n }, [mode, isStreaming ?? false]);\n\n useEffect(() => {\n const editor = editorInstance.current;\n const currentIsStreaming = isStreaming ?? false;\n const prevIsStreaming = isStreamingRef.current;\n\n if (editor && isEditorAliveRef.current && currentIsStreaming && !prevIsStreaming) {\n const wrapper = editor.getWrapper();\n const shadcnComponents = wrapper?.findType('shadcn-generic') || [];\n\n shadcnComponents.forEach((comp: Component) => {\n resetStreamingComponent(comp);\n });\n }\n\n isStreamingRef.current = currentIsStreaming;\n }, [isStreaming]);\n\n return (\n <React.Fragment>\n <StyledEditor />\n <div\n ref={editorRef}\n id=\"grapesjs-editor\"\n style={{\n opacity: isTransitioning ? 0 : 1,\n transition: 'opacity 0.15s ease-in-out',\n }}\n />\n </React.Fragment>\n );\n}\n\nfunction GrapejsCanvas(props: GrapesjsCanvasProps) {\n const existingContext = usePageContext();\n\n if (existingContext) {\n return <GrapejsCanvasInternal {...props} />;\n }\n\n const normalizedJson = normalizeMultiPageJson(props.json);\n const pages = normalizedJson.pages.map(extractPageMetadata);\n const initialPageId = props.currentPageId || pages[0]?.id || '';\n\n return (\n <PageProvider pages={pages} initialPageId={initialPageId} onPageChange={props.onPageChange}>\n <GrapejsCanvas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