@peak-ai/canvas 1.6.2 → 1.6.4-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/GrapesjsCanvas.js +3 -3
- package/GrapesjsCanvas.js.map +1 -1
- package/contexts/PageContext.d.ts +1 -1
- package/contexts/PageContext.js +1 -1
- package/contexts/PageContext.js.map +1 -1
- package/package.json +1 -1
- package/plugins/grapejs-plugin.d.ts +1 -1
- package/plugins/grapejs-plugin.js.map +1 -1
- package/plugins/helpers/data-table.d.ts +1 -1
- package/plugins/helpers/data-table.js +3 -3
- package/plugins/helpers/data-table.js.map +1 -1
- package/plugins/helpers/render-components.js +1 -1
- package/plugins/helpers/render-components.js.map +1 -1
- package/types/page.d.js.map +1 -1
package/GrapesjsCanvas.js
CHANGED
|
@@ -2,12 +2,12 @@ import _extends from"@babel/runtime/helpers/extends";import _asyncToGenerator fr
|
|
|
2
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
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
|
-
}:_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
|
|
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 rowNavigationContextRef=useRef(null);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 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
|
|
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,rowContext){rowNavigationContextRef.current=rowContext!=null?rowContext:null;if(externalOnPageChange){externalOnPageChange(targetPageId,rowContext)}if(pageContext){pageContext.navigateToPage(targetPageId,rowContext)}}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
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
|
-
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&¤tIsStreaming&&!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;
|
|
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 _rowNavigationContext;var isMultiPage=Boolean(currentPage.dataQueries);var pageId=isMultiPage?currentPage.id:"";var queries=currentPage.dataQueries||[];var rowContext=(_rowNavigationContext=rowNavigationContextRef.current)!=null?_rowNavigationContext:undefined;onRequestPageDataRef.current(pageId,queries,rowContext);rowNavigationContextRef.current=null}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&¤tIsStreaming&&!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;
|
|
13
13
|
//# sourceMappingURL=GrapesjsCanvas.js.map
|
package/GrapesjsCanvas.js.map
CHANGED
|
@@ -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","_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 <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,yBAqBtE,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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AK,CAACkU,QAAQ,EAAAC,QAAA,eACbhT,IAAA,CAACJ,YAAY,GAAE,CAAC,cAChBI,IAAA,QACEiT,GAAG,CAAE3J,SAAU,CACfjD,EAAE,CAAC,iBAAiB,CACpBtB,KAAK,CAAE,CACLmO,OAAO,CAAEjJ,eAAe,CAAG,CAAC,CAAG,CAAC,CAChCkJ,UAAU,CAAE,2BACd,CAAE,CACH,CAAC,EACY,CAEpB,CAEA,QAAS,CAAAC,aAAaA,CAAChM,KAA0B,CAAE,KAAAiM,QAAA,CACjD,GAAM,CAAAC,eAAe,CAAGxT,cAAc,CAAC,CAAC,CAExC,GAAIwT,eAAe,CAAE,CACnB,mBAAOtT,IAAA,CAAC6H,qBAAqB,CAAAnE,QAAA,IAAK0D,KAAK,CAAG,CAC5C,CAEA,GAAM,CAAAgC,cAAc,CAAG1J,sBAAsB,CAAC0H,KAAK,CAACY,IAAI,CAAC,CACzD,GAAM,CAAAzG,KAAK,CAAG6H,cAAc,CAAC7H,KAAK,CAAC+C,GAAG,CAAC/E,mBAAmB,CAAC,CAC3D,GAAM,CAAAgU,aAAa,CAAGnM,KAAK,CAAC2B,aAAa,IAAAsK,QAAA,CAAI9R,KAAK,CAAC,CAAC,CAAC,eAAR8R,QAAA,CAAUhN,EAAE,GAAI,EAAE,CAE/D,mBACErG,IAAA,CAACH,YAAY,EAAC0B,KAAK,CAAEA,KAAM,CAACgS,aAAa,CAAEA,aAAc,CAACtK,YAAY,CAAE7B,KAAK,CAAC6B,YAAa,CAAA+J,QAAA,cACzFhT,IAAA,CAAC6H,qBAAqB,CAAAnE,QAAA,IAAK0D,KAAK,CAAG,CAAC,CACxB,CAElB,CAEA,cAAe,CAAAgM,aAAa","ignoreList":[]}
|
|
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","_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","rowNavigationContextRef","_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","rowContext","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","_rowNavigationContext","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 rowNavigationContextRef = useRef<Record<string, any> | null>(null);\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, rowContext?: Record<string, any>) {\n rowNavigationContextRef.current = rowContext ?? null;\n\n if (externalOnPageChange) {\n externalOnPageChange(targetPageId, rowContext);\n }\n\n if (pageContext) {\n pageContext.navigateToPage(targetPageId, rowContext);\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 const rowContext = rowNavigationContextRef.current ?? undefined;\n onRequestPageDataRef.current(pageId, queries, rowContext);\n rowNavigationContextRef.current = null;\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,yBAqBtE,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,KAAA,MAAAC,SAAA,W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kBAC3B,CAAC,CAAE,CAACtQ,WAAW,CAAC,CAAC,CAEjB,mBACExC,KAAA,CAACrB,KAAK,CAACqU,QAAQ,EAAAC,QAAA,eACbnT,IAAA,CAACJ,YAAY,GAAE,CAAC,cAChBI,IAAA,QACEoT,GAAG,CAAE9J,SAAU,CACfjD,EAAE,CAAC,iBAAiB,CACpBtB,KAAK,CAAE,CACLsO,OAAO,CAAEnJ,eAAe,CAAG,CAAC,CAAG,CAAC,CAChCoJ,UAAU,CAAE,2BACd,CAAE,CACH,CAAC,EACY,CAEpB,CAEA,QAAS,CAAAC,aAAaA,CAACnM,KAA0B,CAAE,KAAAoM,QAAA,CACjD,GAAM,CAAAC,eAAe,CAAG3T,cAAc,CAAC,CAAC,CAExC,GAAI2T,eAAe,CAAE,CACnB,mBAAOzT,IAAA,CAAC6H,qBAAqB,CAAAnE,QAAA,IAAK0D,KAAK,CAAG,CAC5C,CAEA,GAAM,CAAAgC,cAAc,CAAG1J,sBAAsB,CAAC0H,KAAK,CAACY,IAAI,CAAC,CACzD,GAAM,CAAAzG,KAAK,CAAG6H,cAAc,CAAC7H,KAAK,CAAC+C,GAAG,CAAC/E,mBAAmB,CAAC,CAC3D,GAAM,CAAAmU,aAAa,CAAGtM,KAAK,CAAC2B,aAAa,IAAAyK,QAAA,CAAIjS,KAAK,CAAC,CAAC,CAAC,eAARiS,QAAA,CAAUnN,EAAE,GAAI,EAAE,CAE/D,mBACErG,IAAA,CAACH,YAAY,EAAC0B,KAAK,CAAEA,KAAM,CAACmS,aAAa,CAAEA,aAAc,CAACzK,YAAY,CAAE7B,KAAK,CAAC6B,YAAa,CAAAkK,QAAA,cACzFnT,IAAA,CAAC6H,qBAAqB,CAAAnE,QAAA,IAAK0D,KAAK,CAAG,CAAC,CACxB,CAElB,CAEA,cAAe,CAAAmM,aAAa","ignoreList":[]}
|
|
@@ -11,7 +11,7 @@ export declare function usePageContext(): PageContextType | null;
|
|
|
11
11
|
export declare function useRequiredPageContext(): PageContextType;
|
|
12
12
|
export declare function useCurrentPage(): PageMetadata | undefined;
|
|
13
13
|
export declare function usePageNavigation(): {
|
|
14
|
-
navigateToPage: (pageId: string) => void;
|
|
14
|
+
navigateToPage: (pageId: string, rowContext?: import("../types/page").RowNavigationContext | undefined) => void;
|
|
15
15
|
navigateToNextPage: () => void;
|
|
16
16
|
navigateToPreviousPage: () => void;
|
|
17
17
|
canNavigateNext: boolean;
|
package/contexts/PageContext.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */import React,{createContext,useCallback,useContext,useMemo,useState}from"react";import{jsx as _jsx}from"react/jsx-runtime";var PageContext=/*#__PURE__*/createContext(null);export function PageProvider(_ref){var children=_ref.children,pages=_ref.pages,initialPageId=_ref.initialPageId,onPageChange=_ref.onPageChange;var _useState=useState(initialPageId||(pages.length>0?pages[0].id:"")),currentPageId=_useState[0],setCurrentPageId=_useState[1];var _useState2=useState(false),isTransitioning=_useState2[0],setIsTransitioning=_useState2[1];var _useState3=useState({}),pageDataCache=_useState3[0],setPageDataCache=_useState3[1];var navigateToPage=useCallback(function(pageId){var targetPage=pages.find(function(p){return p.id===pageId});if(!targetPage){return}if(pageId===currentPageId){return}setIsTransitioning(true);setCurrentPageId(pageId);if(onPageChange){onPageChange(pageId)}setTimeout(function(){setIsTransitioning(false)},300)},[currentPageId,pages,onPageChange]);var contextValue=useMemo(function(){return{currentPageId:currentPageId,pages:pages,navigateToPage:navigateToPage,isTransitioning:isTransitioning,pageDataCache:pageDataCache,setPageDataCache:setPageDataCache}},[currentPageId,pages,navigateToPage,isTransitioning,pageDataCache]);return/*#__PURE__*/_jsx(PageContext.Provider,{value:contextValue,children:children})}export function usePageContext(){return useContext(PageContext)}export function useRequiredPageContext(){var context=useContext(PageContext);if(!context){throw new Error("useRequiredPageContext must be used within a PageProvider")}return context}export function useCurrentPage(){var context=usePageContext();if(!context){return undefined}return context.pages.find(function(p){return p.id===context.currentPageId})}export function usePageNavigation(){var context=useRequiredPageContext();var navigateToNextPage=useCallback(function(){var currentIndex=context.pages.findIndex(function(p){return p.id===context.currentPageId});if(currentIndex<context.pages.length-1){context.navigateToPage(context.pages[currentIndex+1].id)}},[context]);var navigateToPreviousPage=useCallback(function(){var currentIndex=context.pages.findIndex(function(p){return p.id===context.currentPageId});if(currentIndex>0){context.navigateToPage(context.pages[currentIndex-1].id)}},[context]);var canNavigateNext=useMemo(function(){var currentIndex=context.pages.findIndex(function(p){return p.id===context.currentPageId});return currentIndex<context.pages.length-1},[context.pages,context.currentPageId]);var canNavigatePrevious=useMemo(function(){var currentIndex=context.pages.findIndex(function(p){return p.id===context.currentPageId});return currentIndex>0},[context.pages,context.currentPageId]);return{navigateToPage:context.navigateToPage,navigateToNextPage:navigateToNextPage,navigateToPreviousPage:navigateToPreviousPage,canNavigateNext:canNavigateNext,canNavigatePrevious:canNavigatePrevious,currentPageId:context.currentPageId,pages:context.pages}}
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */import React,{createContext,useCallback,useContext,useMemo,useState}from"react";import{jsx as _jsx}from"react/jsx-runtime";var PageContext=/*#__PURE__*/createContext(null);export function PageProvider(_ref){var children=_ref.children,pages=_ref.pages,initialPageId=_ref.initialPageId,onPageChange=_ref.onPageChange;var _useState=useState(initialPageId||(pages.length>0?pages[0].id:"")),currentPageId=_useState[0],setCurrentPageId=_useState[1];var _useState2=useState(false),isTransitioning=_useState2[0],setIsTransitioning=_useState2[1];var _useState3=useState({}),pageDataCache=_useState3[0],setPageDataCache=_useState3[1];var _useState4=useState(null),rowNavigationContext=_useState4[0],setRowNavigationContext=_useState4[1];var navigateToPage=useCallback(function(pageId,rowContext){var targetPage=pages.find(function(p){return p.id===pageId});if(!targetPage){return}if(pageId===currentPageId){return}setIsTransitioning(true);setRowNavigationContext(rowContext!=null?rowContext:null);setCurrentPageId(pageId);if(onPageChange){onPageChange(pageId)}setTimeout(function(){setIsTransitioning(false)},300)},[currentPageId,pages,onPageChange]);var contextValue=useMemo(function(){return{currentPageId:currentPageId,pages:pages,navigateToPage:navigateToPage,isTransitioning:isTransitioning,pageDataCache:pageDataCache,rowNavigationContext:rowNavigationContext,setPageDataCache:setPageDataCache}},[currentPageId,pages,navigateToPage,isTransitioning,pageDataCache,rowNavigationContext]);return/*#__PURE__*/_jsx(PageContext.Provider,{value:contextValue,children:children})}export function usePageContext(){return useContext(PageContext)}export function useRequiredPageContext(){var context=useContext(PageContext);if(!context){throw new Error("useRequiredPageContext must be used within a PageProvider")}return context}export function useCurrentPage(){var context=usePageContext();if(!context){return undefined}return context.pages.find(function(p){return p.id===context.currentPageId})}export function usePageNavigation(){var context=useRequiredPageContext();var navigateToNextPage=useCallback(function(){var currentIndex=context.pages.findIndex(function(p){return p.id===context.currentPageId});if(currentIndex<context.pages.length-1){context.navigateToPage(context.pages[currentIndex+1].id)}},[context]);var navigateToPreviousPage=useCallback(function(){var currentIndex=context.pages.findIndex(function(p){return p.id===context.currentPageId});if(currentIndex>0){context.navigateToPage(context.pages[currentIndex-1].id)}},[context]);var canNavigateNext=useMemo(function(){var currentIndex=context.pages.findIndex(function(p){return p.id===context.currentPageId});return currentIndex<context.pages.length-1},[context.pages,context.currentPageId]);var canNavigatePrevious=useMemo(function(){var currentIndex=context.pages.findIndex(function(p){return p.id===context.currentPageId});return currentIndex>0},[context.pages,context.currentPageId]);return{navigateToPage:context.navigateToPage,navigateToNextPage:navigateToNextPage,navigateToPreviousPage:navigateToPreviousPage,canNavigateNext:canNavigateNext,canNavigatePrevious:canNavigatePrevious,currentPageId:context.currentPageId,pages:context.pages}}
|
|
2
2
|
//# sourceMappingURL=PageContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageContext.js","names":["React","createContext","useCallback","useContext","useMemo","useState","jsx","_jsx","PageContext","PageProvider","_ref","children","pages","initialPageId","onPageChange","_useState","length","id","currentPageId","setCurrentPageId","_useState2","isTransitioning","setIsTransitioning","_useState3","pageDataCache","setPageDataCache","navigateToPage","pageId","targetPage","find","p","setTimeout","contextValue","Provider","value","usePageContext","useRequiredPageContext","context","Error","useCurrentPage","undefined","usePageNavigation","navigateToNextPage","currentIndex","findIndex","navigateToPreviousPage","canNavigateNext","canNavigatePrevious"],"sources":["../../src/contexts/PageContext.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React, { createContext, useCallback, useContext, useMemo, useState } from 'react';\n\nimport type { PageContext as PageContextType, PageMetadata } from '../types/page';\n\nconst PageContext = createContext<PageContextType | null>(null);\n\ntype PageProviderProps = {\n children: React.ReactNode;\n initialPageId?: string;\n onPageChange?: (pageId: string) => void;\n pages: PageMetadata[];\n};\n\nexport function PageProvider({\n children,\n pages,\n initialPageId,\n onPageChange,\n}: PageProviderProps): React.JSX.Element {\n const [currentPageId, setCurrentPageId] = useState<string>(\n initialPageId || (pages.length > 0 ? pages[0].id : ''),\n );\n const [isTransitioning, setIsTransitioning] = useState(false);\n const [pageDataCache, setPageDataCache] = useState<Record<string, Record<string, any>>>({});\n\n const navigateToPage = useCallback(\n (pageId: string) => {\n const targetPage = pages.find((p) => p.id === pageId);\n\n if (!targetPage) {\n return;\n }\n\n if (pageId === currentPageId) {\n return;\n }\n\n setIsTransitioning(true);\n
|
|
1
|
+
{"version":3,"file":"PageContext.js","names":["React","createContext","useCallback","useContext","useMemo","useState","jsx","_jsx","PageContext","PageProvider","_ref","children","pages","initialPageId","onPageChange","_useState","length","id","currentPageId","setCurrentPageId","_useState2","isTransitioning","setIsTransitioning","_useState3","pageDataCache","setPageDataCache","_useState4","rowNavigationContext","setRowNavigationContext","navigateToPage","pageId","rowContext","targetPage","find","p","setTimeout","contextValue","Provider","value","usePageContext","useRequiredPageContext","context","Error","useCurrentPage","undefined","usePageNavigation","navigateToNextPage","currentIndex","findIndex","navigateToPreviousPage","canNavigateNext","canNavigatePrevious"],"sources":["../../src/contexts/PageContext.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React, { createContext, useCallback, useContext, useMemo, useState } from 'react';\n\nimport type { PageContext as PageContextType, PageMetadata } from '../types/page';\n\nconst PageContext = createContext<PageContextType | null>(null);\n\ntype PageProviderProps = {\n children: React.ReactNode;\n initialPageId?: string;\n onPageChange?: (pageId: string) => void;\n pages: PageMetadata[];\n};\n\nexport function PageProvider({\n children,\n pages,\n initialPageId,\n onPageChange,\n}: PageProviderProps): React.JSX.Element {\n const [currentPageId, setCurrentPageId] = useState<string>(\n initialPageId || (pages.length > 0 ? pages[0].id : ''),\n );\n const [isTransitioning, setIsTransitioning] = useState(false);\n const [pageDataCache, setPageDataCache] = useState<Record<string, Record<string, any>>>({});\n const [rowNavigationContext, setRowNavigationContext] = useState<Record<string, any> | null>(null);\n\n const navigateToPage = useCallback(\n (pageId: string, rowContext?: Record<string, any>) => {\n const targetPage = pages.find((p) => p.id === pageId);\n\n if (!targetPage) {\n return;\n }\n\n if (pageId === currentPageId) {\n return;\n }\n\n setIsTransitioning(true);\n setRowNavigationContext(rowContext ?? null);\n setCurrentPageId(pageId);\n\n if (onPageChange) {\n onPageChange(pageId);\n }\n\n setTimeout(() => {\n setIsTransitioning(false);\n }, 300);\n },\n [currentPageId, pages, onPageChange],\n );\n\n const contextValue = useMemo(\n () => ({\n currentPageId,\n pages,\n navigateToPage,\n isTransitioning,\n pageDataCache,\n rowNavigationContext,\n setPageDataCache,\n }),\n [currentPageId, pages, navigateToPage, isTransitioning, pageDataCache, rowNavigationContext],\n );\n\n return <PageContext.Provider value={contextValue}>{children}</PageContext.Provider>;\n}\n\nexport function usePageContext(): PageContextType | null {\n return useContext(PageContext);\n}\n\nexport function useRequiredPageContext(): PageContextType {\n const context = useContext(PageContext);\n\n if (!context) {\n throw new Error('useRequiredPageContext must be used within a PageProvider');\n }\n\n return context;\n}\n\nexport function useCurrentPage(): PageMetadata | undefined {\n const context = usePageContext();\n\n if (!context) {\n return undefined;\n }\n\n return context.pages.find((p) => p.id === context.currentPageId);\n}\n\nexport function usePageNavigation() {\n const context = useRequiredPageContext();\n\n const navigateToNextPage = useCallback(() => {\n const currentIndex = context.pages.findIndex((p) => p.id === context.currentPageId);\n\n if (currentIndex < context.pages.length - 1) {\n context.navigateToPage(context.pages[currentIndex + 1].id);\n }\n }, [context]);\n\n const navigateToPreviousPage = useCallback(() => {\n const currentIndex = context.pages.findIndex((p) => p.id === context.currentPageId);\n\n if (currentIndex > 0) {\n context.navigateToPage(context.pages[currentIndex - 1].id);\n }\n }, [context]);\n\n const canNavigateNext = useMemo(() => {\n const currentIndex = context.pages.findIndex((p) => p.id === context.currentPageId);\n\n return currentIndex < context.pages.length - 1;\n }, [context.pages, context.currentPageId]);\n\n const canNavigatePrevious = useMemo(() => {\n const currentIndex = context.pages.findIndex((p) => p.id === context.currentPageId);\n\n return currentIndex > 0;\n }, [context.pages, context.currentPageId]);\n\n return {\n navigateToPage: context.navigateToPage,\n navigateToNextPage,\n navigateToPreviousPage,\n canNavigateNext,\n canNavigatePrevious,\n currentPageId: context.currentPageId,\n pages: context.pages,\n };\n}\n"],"mappings":"AAAA,uDACA,MAAO,CAAAA,KAAK,EAAIC,aAAa,CAAEC,WAAW,CAAEC,UAAU,CAAEC,OAAO,CAAEC,QAAQ,KAAQ,OAAO,CAAC,OAAAC,GAAA,IAAAC,IAAA,yBAIzF,GAAM,CAAAC,WAAW,cAAGP,aAAa,CAAyB,IAAI,CAAC,CAS/D,MAAO,SAAS,CAAAQ,YAAYA,CAAAC,IAAA,CAKa,IAJvC,CAAAC,QAAQ,CAAAD,IAAA,CAARC,QAAQ,CACRC,KAAK,CAAAF,IAAA,CAALE,KAAK,CACLC,aAAa,CAAAH,IAAA,CAAbG,aAAa,CACbC,YAAY,CAAAJ,IAAA,CAAZI,YAAY,CAEZ,IAAAC,SAAA,CAA0CV,QAAQ,CAChDQ,aAAa,GAAKD,KAAK,CAACI,MAAM,CAAG,CAAC,CAAGJ,KAAK,CAAC,CAAC,CAAC,CAACK,EAAE,CAAG,EAAE,CACvD,C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AO,CAACvB,aAAa,CAAC,CAAC,CAE1C,MAAO,CACLW,cAAc,CAAEY,OAAO,CAACZ,cAAc,CACtCiB,kBAAkB,CAAlBA,kBAAkB,CAClBG,sBAAsB,CAAtBA,sBAAsB,CACtBC,eAAe,CAAfA,eAAe,CACfC,mBAAmB,CAAnBA,mBAAmB,CACnBjC,aAAa,CAAEuB,OAAO,CAACvB,aAAa,CACpCN,KAAK,CAAE6B,OAAO,CAAC7B,KACjB,CACF","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Editor, Component } from 'grapesjs';
|
|
3
|
-
export declare function createGrapesjsShadcnGenericPlugin(modeRef: React.MutableRefObject<'editor' | 'preview'>, performInteraction: (payload: Record<string, any>) => void, renderedComponents: Record<string, Component> | undefined, setHasChanged: (hasChanged: boolean) => void, isTemplateView: boolean | undefined, isStreamingRef: React.MutableRefObject<boolean>, navigateToPage?: (pageId: string) => void, downloadTable?: (data: {
|
|
3
|
+
export declare function createGrapesjsShadcnGenericPlugin(modeRef: React.MutableRefObject<'editor' | 'preview'>, performInteraction: (payload: Record<string, any>) => void, renderedComponents: Record<string, Component> | undefined, setHasChanged: (hasChanged: boolean) => void, isTemplateView: boolean | undefined, isStreamingRef: React.MutableRefObject<boolean>, navigateToPage?: (pageId: string, rowContext?: Record<string, any>) => void, downloadTable?: (data: {
|
|
4
4
|
tableId: string;
|
|
5
5
|
title: string;
|
|
6
6
|
limit: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grapejs-plugin.js","names":["React","ReactDOM","getRenderers","QueryCacheProvider","jsx","_jsx","createGrapesjsShadcnGenericPlugin","modeRef","performInteraction","renderedComponents","setHasChanged","isTemplateView","isStreamingRef","navigateToPage","downloadTable","grapesjsShadcnGenericPlugin","editor","DomComponents","addType","model","defaults","tagName","droppable","componentName","componentProps","traits","view","events","handleSlotInput","e","target","slot","dataset","text","innerText","props","get","startsWith","_props$data","idx","parseInt","split","dataKeys","Object","keys","data","headerMapper","key","set","_extends","includes","render","_this","compName","compProps","JSON","parse","err","console","error","isEditable","current","onChange","renderers","Renderer","_cleanupTabsSetup","maxCacheSize","maxCacheAge","children","gjsModel","el","components","length","tabAttributes","hasTabsError","hasTabsMissing","isMissing","injectChildren","tabsContent","querySelectorAll","isFallback","Array","from","some","fallback","each","childModel","stopListening","i","container","childView","createView","innerHTML","appendChild","listenTo","childAttributes","childProps","hasError","hasMissing","loading","inheritedFromParent","silent","_tabsTimeoutId","setTimeout","warn","clearTimeout","_this$em$get$getType","ComponentView","em","getType","config","componentTypes","remove","unmountComponentAtNode"],"sources":["../../src/plugins/grapejs-plugin.tsx"],"sourcesContent":["/* eslint-disable import/no-named-as-default-member */\n/* eslint-disable func-names */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport { Editor, Component } from 'grapesjs';\nimport { getRenderers } from './helpers/render-components';\nimport { QueryCacheProvider } from './helpers/query-cache-context';\n\nexport function createGrapesjsShadcnGenericPlugin(\n modeRef: React.MutableRefObject<'editor' | 'preview'>,\n performInteraction: (payload: Record<string, any>) => void,\n renderedComponents: Record<string, Component> = {},\n setHasChanged: (hasChanged: boolean) => void,\n isTemplateView = false,\n isStreamingRef: React.MutableRefObject<boolean>,\n navigateToPage?: (pageId: string) => void,\n downloadTable?: (data: { tableId: string; title: string; limit: number; headerMapper?: Record<string, string> }) => Promise<void>,\n) {\n return function grapesjsShadcnGenericPlugin(editor: Editor): void {\n editor.DomComponents.addType('shadcn-generic', {\n model: {\n defaults: {\n tagName: 'div',\n droppable: false,\n componentName: 'Card',\n componentProps: {},\n traits: [],\n },\n },\n view: {\n events: {\n 'input [data-slot]': 'handleSlotInput',\n } as any,\n handleSlotInput(e: Event) {\n const target = e.target as HTMLElement;\n const slot = target.dataset.slot;\n const text = target.innerText;\n\n const props = this.model.get('componentProps') || {};\n\n if (!slot) {\n return;\n }\n\n if (slot.startsWith('table-header-')) {\n const idx = parseInt(slot.split('-')[2], 10);\n const dataKeys = Object.keys(props.data?.[0] || {});\n\n if (!props.headerMapper) {\n props.headerMapper = {};\n }\n\n const key = dataKeys[idx];\n\n if (key) {\n props.headerMapper[key] = text;\n }\n } else {\n props[slot] = text;\n }\n\n this.model.set('componentProps', {\n ...props,\n });\n\n if (!['search-input'].includes(slot)) {\n setHasChanged(true);\n }\n },\n render: function () {\n const compName: string = this.model.get('componentName');\n let compProps: any = this.model.get('componentProps');\n\n if (typeof compProps === 'string') {\n try {\n compProps = JSON.parse(compProps);\n } catch (err) {\n // eslint-disable-next-line no-console\n console.error('Invalid JSON in componentProps', err);\n compProps = {};\n }\n }\n\n compProps.performInteraction = performInteraction;\n compProps.navigateToPage = navigateToPage;\n compProps.downloadTable = downloadTable;\n compProps.isTemplateView = isTemplateView;\n compProps.isEditable = modeRef.current === 'editor' && !isStreamingRef.current;\n\n compProps.onChange = (data: Record<string, any>) => {\n this.model.set('componentProps', {\n ...this.model.get('componentProps'),\n ...data,\n });\n };\n\n const renderers = getRenderers();\n const Renderer = renderers[compName];\n\n if (Renderer) {\n if (compName === 'Tabs') {\n this._cleanupTabsSetup();\n\n ReactDOM.render(\n <QueryCacheProvider maxCacheSize={100} maxCacheAge={5 * 60 * 1000}>\n <Renderer {...compProps} gjsModel={this.model} />\n </QueryCacheProvider>,\n this.el,\n );\n\n const children = this.model.components();\n\n if (children.length === 0) {\n return this;\n }\n\n const tabAttributes = this.model.get('attributes') || {};\n const hasTabsError = tabAttributes.error || compProps.error;\n const hasTabsMissing = tabAttributes.isMissing || compProps.isMissing;\n\n const injectChildren = () => {\n const tabsContent = this.el.querySelectorAll('.tabs-content');\n const isFallback = Array.from(tabsContent).some(\n (el: Element) => (el as HTMLElement).dataset.fallback === 'true',\n );\n\n if (isFallback || tabsContent.length === 0) {\n return false;\n }\n\n children.each((childModel: any) => {\n this.stopListening(childModel, 'change:attributes');\n });\n\n children.each((childModel: any, i: number) => {\n const container = tabsContent[i];\n\n if (!container) {\n return;\n }\n\n const childView = this.createView(childModel);\n\n if (childView) {\n container.innerHTML = '';\n childView.render();\n container.appendChild(childView.el);\n\n this.listenTo(childModel, 'change:attributes', () => {\n const childAttributes = childModel.get('attributes') || {};\n const childProps = childModel.get('componentProps') || {};\n const hasError = hasTabsError || childAttributes.error || childProps.error;\n const hasMissing =\n hasTabsMissing || childAttributes.isMissing || childProps.isMissing;\n\n if (hasError || hasMissing) {\n childModel.set(\n 'attributes',\n {\n ...childAttributes,\n loading: false,\n error: hasError,\n isMissing: hasMissing,\n inheritedFromParent: !!(hasTabsError || hasTabsMissing),\n },\n { silent: false },\n );\n }\n });\n }\n });\n\n return true;\n };\n\n if (injectChildren()) {\n return this;\n }\n\n this._tabsTimeoutId = setTimeout(() => {\n if (injectChildren()) {\n return;\n }\n\n // eslint-disable-next-line no-console\n console.warn('Could not inject tabs content after delay');\n }, 100);\n } else {\n ReactDOM.render(\n <QueryCacheProvider maxCacheSize={100} maxCacheAge={5 * 60 * 1000}>\n <Renderer {...compProps} gjsModel={this.model} />\n </QueryCacheProvider>,\n this.el,\n );\n }\n } else {\n this.el.innerHTML = `<div>Unsupported component: ${compName}</div>`;\n }\n\n renderedComponents[this.model.get('id')] = this.model;\n\n return this;\n },\n _cleanupTabsSetup: function () {\n if (this._tabsTimeoutId) {\n clearTimeout(this._tabsTimeoutId);\n this._tabsTimeoutId = null;\n }\n },\n createView(model: any) {\n const ComponentView = this.em.get('DomComponents').getType(model.get('type'))?.view;\n\n if (!ComponentView) {\n // eslint-disable-next-line no-console\n console.warn('No view found for component type:', model.get('type'));\n\n return null;\n }\n\n const view = new ComponentView({\n model,\n config: this.config,\n componentTypes: this.componentTypes,\n });\n\n return view;\n },\n remove: function () {\n this.stopListening();\n\n this._cleanupTabsSetup();\n\n // eslint-disable-next-line import/no-named-as-default-member\n ReactDOM.unmountComponentAtNode(this.el);\n\n return this;\n },\n },\n });\n };\n}\n"],"mappings":"qD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List":[]}
|
|
1
|
+
{"version":3,"file":"grapejs-plugin.js","names":["React","ReactDOM","getRenderers","QueryCacheProvider","jsx","_jsx","createGrapesjsShadcnGenericPlugin","modeRef","performInteraction","renderedComponents","setHasChanged","isTemplateView","isStreamingRef","navigateToPage","downloadTable","grapesjsShadcnGenericPlugin","editor","DomComponents","addType","model","defaults","tagName","droppable","componentName","componentProps","traits","view","events","handleSlotInput","e","target","slot","dataset","text","innerText","props","get","startsWith","_props$data","idx","parseInt","split","dataKeys","Object","keys","data","headerMapper","key","set","_extends","includes","render","_this","compName","compProps","JSON","parse","err","console","error","isEditable","current","onChange","renderers","Renderer","_cleanupTabsSetup","maxCacheSize","maxCacheAge","children","gjsModel","el","components","length","tabAttributes","hasTabsError","hasTabsMissing","isMissing","injectChildren","tabsContent","querySelectorAll","isFallback","Array","from","some","fallback","each","childModel","stopListening","i","container","childView","createView","innerHTML","appendChild","listenTo","childAttributes","childProps","hasError","hasMissing","loading","inheritedFromParent","silent","_tabsTimeoutId","setTimeout","warn","clearTimeout","_this$em$get$getType","ComponentView","em","getType","config","componentTypes","remove","unmountComponentAtNode"],"sources":["../../src/plugins/grapejs-plugin.tsx"],"sourcesContent":["/* eslint-disable import/no-named-as-default-member */\n/* eslint-disable func-names */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport { Editor, Component } from 'grapesjs';\nimport { getRenderers } from './helpers/render-components';\nimport { QueryCacheProvider } from './helpers/query-cache-context';\n\nexport function createGrapesjsShadcnGenericPlugin(\n modeRef: React.MutableRefObject<'editor' | 'preview'>,\n performInteraction: (payload: Record<string, any>) => void,\n renderedComponents: Record<string, Component> = {},\n setHasChanged: (hasChanged: boolean) => void,\n isTemplateView = false,\n isStreamingRef: React.MutableRefObject<boolean>,\n navigateToPage?: (pageId: string, rowContext?: Record<string, any>) => void,\n downloadTable?: (data: { tableId: string; title: string; limit: number; headerMapper?: Record<string, string> }) => Promise<void>,\n) {\n return function grapesjsShadcnGenericPlugin(editor: Editor): void {\n editor.DomComponents.addType('shadcn-generic', {\n model: {\n defaults: {\n tagName: 'div',\n droppable: false,\n componentName: 'Card',\n componentProps: {},\n traits: [],\n },\n },\n view: {\n events: {\n 'input [data-slot]': 'handleSlotInput',\n } as any,\n handleSlotInput(e: Event) {\n const target = e.target as HTMLElement;\n const slot = target.dataset.slot;\n const text = target.innerText;\n\n const props = this.model.get('componentProps') || {};\n\n if (!slot) {\n return;\n }\n\n if (slot.startsWith('table-header-')) {\n const idx = parseInt(slot.split('-')[2], 10);\n const dataKeys = Object.keys(props.data?.[0] || {});\n\n if (!props.headerMapper) {\n props.headerMapper = {};\n }\n\n const key = dataKeys[idx];\n\n if (key) {\n props.headerMapper[key] = text;\n }\n } else {\n props[slot] = text;\n }\n\n this.model.set('componentProps', {\n ...props,\n });\n\n if (!['search-input'].includes(slot)) {\n setHasChanged(true);\n }\n },\n render: function () {\n const compName: string = this.model.get('componentName');\n let compProps: any = this.model.get('componentProps');\n\n if (typeof compProps === 'string') {\n try {\n compProps = JSON.parse(compProps);\n } catch (err) {\n // eslint-disable-next-line no-console\n console.error('Invalid JSON in componentProps', err);\n compProps = {};\n }\n }\n\n compProps.performInteraction = performInteraction;\n compProps.navigateToPage = navigateToPage;\n compProps.downloadTable = downloadTable;\n compProps.isTemplateView = isTemplateView;\n compProps.isEditable = modeRef.current === 'editor' && !isStreamingRef.current;\n\n compProps.onChange = (data: Record<string, any>) => {\n this.model.set('componentProps', {\n ...this.model.get('componentProps'),\n ...data,\n });\n };\n\n const renderers = getRenderers();\n const Renderer = renderers[compName];\n\n if (Renderer) {\n if (compName === 'Tabs') {\n this._cleanupTabsSetup();\n\n ReactDOM.render(\n <QueryCacheProvider maxCacheSize={100} maxCacheAge={5 * 60 * 1000}>\n <Renderer {...compProps} gjsModel={this.model} />\n </QueryCacheProvider>,\n this.el,\n );\n\n const children = this.model.components();\n\n if (children.length === 0) {\n return this;\n }\n\n const tabAttributes = this.model.get('attributes') || {};\n const hasTabsError = tabAttributes.error || compProps.error;\n const hasTabsMissing = tabAttributes.isMissing || compProps.isMissing;\n\n const injectChildren = () => {\n const tabsContent = this.el.querySelectorAll('.tabs-content');\n const isFallback = Array.from(tabsContent).some(\n (el: Element) => (el as HTMLElement).dataset.fallback === 'true',\n );\n\n if (isFallback || tabsContent.length === 0) {\n return false;\n }\n\n children.each((childModel: any) => {\n this.stopListening(childModel, 'change:attributes');\n });\n\n children.each((childModel: any, i: number) => {\n const container = tabsContent[i];\n\n if (!container) {\n return;\n }\n\n const childView = this.createView(childModel);\n\n if (childView) {\n container.innerHTML = '';\n childView.render();\n container.appendChild(childView.el);\n\n this.listenTo(childModel, 'change:attributes', () => {\n const childAttributes = childModel.get('attributes') || {};\n const childProps = childModel.get('componentProps') || {};\n const hasError = hasTabsError || childAttributes.error || childProps.error;\n const hasMissing =\n hasTabsMissing || childAttributes.isMissing || childProps.isMissing;\n\n if (hasError || hasMissing) {\n childModel.set(\n 'attributes',\n {\n ...childAttributes,\n loading: false,\n error: hasError,\n isMissing: hasMissing,\n inheritedFromParent: !!(hasTabsError || hasTabsMissing),\n },\n { silent: false },\n );\n }\n });\n }\n });\n\n return true;\n };\n\n if (injectChildren()) {\n return this;\n }\n\n this._tabsTimeoutId = setTimeout(() => {\n if (injectChildren()) {\n return;\n }\n\n // eslint-disable-next-line no-console\n console.warn('Could not inject tabs content after delay');\n }, 100);\n } else {\n ReactDOM.render(\n <QueryCacheProvider maxCacheSize={100} maxCacheAge={5 * 60 * 1000}>\n <Renderer {...compProps} gjsModel={this.model} />\n </QueryCacheProvider>,\n this.el,\n );\n }\n } else {\n this.el.innerHTML = `<div>Unsupported component: ${compName}</div>`;\n }\n\n renderedComponents[this.model.get('id')] = this.model;\n\n return this;\n },\n _cleanupTabsSetup: function () {\n if (this._tabsTimeoutId) {\n clearTimeout(this._tabsTimeoutId);\n this._tabsTimeoutId = null;\n }\n },\n createView(model: any) {\n const ComponentView = this.em.get('DomComponents').getType(model.get('type'))?.view;\n\n if (!ComponentView) {\n // eslint-disable-next-line no-console\n console.warn('No view found for component type:', model.get('type'));\n\n return null;\n }\n\n const view = new ComponentView({\n model,\n config: this.config,\n componentTypes: this.componentTypes,\n });\n\n return view;\n },\n remove: function () {\n this.stopListening();\n\n this._cleanupTabsSetup();\n\n // eslint-disable-next-line import/no-named-as-default-member\n ReactDOM.unmountComponentAtNode(this.el);\n\n return this;\n },\n },\n });\n };\n}\n"],"mappings":"qDAAA,sDACA,+BACA,uDACA,MAAO,CAAAA,KAAK,KAAM,OAAO,CACzB,MAAO,CAAAC,QAAQ,KAAM,WAAW,CAEhC,OAASC,YAAY,KAAQ,6BAA6B,CAC1D,OAASC,kBAAkB,KAAQ,+BAA+B,CAAC,OAAAC,GAAA,IAAAC,IAAA,yBAEnE,MAAO,SAAS,CAAAC,iCAAiCA,CAC/CC,OAAqD,CACrDC,kBAA0D,CAC1DC,kBAA6C,CAC7CC,aAA4C,CAC5CC,cAAc,CACdC,cAA+C,CAC/CC,cAA2E,CAC3EC,aAAiI,CACjI,IANAL,kBAA6C,WAA7CA,kBAA6C,CAAG,CAAC,CAAC,IAElDE,cAAc,WAAdA,cAAc,CAAG,KAAK,CAKtB,MAAO,SAAS,CAAAI,2BAA2BA,CAACC,MAAc,CAAQ,CAChEA,MAAM,CAACC,aAAa,CAACC,OAAO,CAAC,gBAAgB,CAAE,CAC7CC,KAAK,CAAE,CACLC,QAAQ,CAAE,CACRC,OAAO,CAAE,KAAK,CACdC,SAAS,CAAE,KAAK,CAChBC,aAAa,CAAE,MAAM,CACrBC,cAAc,CAAE,CAAC,CAAC,CAClBC,MAAM,CAAE,EACV,CACF,CAAC,CACDC,IAAI,CAAE,CACJC,MAAM,CAAE,CACN,mBAAmB,CAAE,iBACvB,CAAQ,CACRC,eAAe,SAAf,CAAAA,eAAeA,CAACC,CAAQ,CAAE,CACxB,GAAM,CAAAC,MAAM,CAAGD,CAAC,CAACC,MAAqB,CACtC,GAAM,CAA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