ngx-xtroedge-cms 1.3.11 → 1.3.12

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.
@@ -294,7 +294,7 @@
294
294
 
295
295
  /* HIDDEN ELEMENTS */
296
296
  .lcms-hidden { display: none !important; }
297
- `;var h={edit:'<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/></svg>',close:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>',undo:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="1 4 1 10 7 10"/><path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10"/></svg>',redo:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="23 4 23 10 17 10"/><path d="M20.49 15a9 9 0 1 1-2.13-9.36L23 10"/></svg>',history:'<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>',save:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"/><polyline points="17 21 17 13 7 13 7 21"/><polyline points="7 3 7 8 15 8"/></svg>',publish:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="17 1 21 5 17 9"/><path d="M3 11V9a4 4 0 0 1 4-4h14"/></svg>',image:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/></svg>',check:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6L9 17l-5-5"/></svg>',error:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="15" y1="9" x2="9" y2="15"/><line x1="9" y1="9" x2="15" y2="15"/></svg>',logout:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/><polyline points="16 17 21 12 16 7"/><line x1="21" y1="12" x2="9" y2="12"/></svg>'},B="xtroedge_cms_history",b="history",O=["h1","h2","h3","h4","h5","h6","p","span","b","strong","i","em","a","button","li","label","small","blockquote","td","th","div","header","footer"],f=class g{constructor(t){this.brandingEl=null;this.siteIdentifier="";this.siteIdEl=null;this.loginModalEl=null;this.pendingEditMode=!1;this.editMode=!1;this.currentLang="en";this.pageTexts={};this.pageImages={};this.originalTexts={};this.originalImages={};this.unsavedChanges=0;this.isSaving=!1;this.isPublishing=!1;this.loading=!1;this.canUndo=!1;this.canRedo=!1;this.showHistory=!1;this.historyList=[];this.isOpen=!1;this.isEditAllowed=!1;this.imageUploading=!1;this.toastMessage="";this.toastType="success";this.undoStack=[];this.redoStack=[];this.dirtyKeys=new Set;this.dirtyImageKeys=new Set;this.registeredKeys=new Set;this.managedElements=new Map;this.managedImages=new Map;this.autoDetectedElements=new Set;this.observer=null;this.scanTimeout=null;this.activeImageEl=null;this.imageCtxMenu=null;this.currentSlug="";this.currentTitle="";this.initialized=!1;this.origPushState=null;this.origReplaceState=null;this.styleEl=null;this.rootEl=null;this.loaderEl=null;this.toastEl=null;this.fabEl=null;this.fabBtn=null;this.badgeEl=null;this.panelEl=null;this.editToggle=null;this.langSwitchEl=null;this.changesInfoEl=null;this.undoBtn=null;this.redoBtn=null;this.historyBtnEl=null;this.historyPanelEl=null;this.historyListEl=null;this.saveBtn=null;this.publishBtn=null;this.actionsEl=null;this.editModeContent=null;this.fileInput=null;this.imgOverlay=null;this.posX=20;this.posY=20;this.isDragging=!1;this.dragStartX=0;this.dragStartY=0;this.startPosX=0;this.startPosY=0;this.hasMoved=!1;this.toastTimer=null;this.db=null;this.translationCache=new Map;this.config=t||{},this.containerSelector=this.config.containerSelector||"",this.editableTags=(this.config.editableTags||O).map(i=>i.toLowerCase()),this.languages=this.config.languages||["en"],this.defaultLanguage=this.config.defaultLanguage||this.languages[0]||"en",this.highlightColor=this.config.highlightColor||"#00C853",this.historyRetentionMs=(this.config.historyRetentionDays||7)*24*60*60*1e3,this.currentLang=this.defaultLanguage,this.siteIdentifier=this.resolveSiteIdentifier();let e=localStorage.getItem("xtroedge_theme_color");e&&(this.highlightColor=e),this.boundMouseMove=i=>this.onDragMove(i),this.boundMouseUp=()=>this.onDragEnd(),this.boundTouchMove=i=>this.onTouchMove(i),this.boundTouchEnd=()=>this.onTouchEnd(),this.boundPopState=()=>this.handleNavigation(),this.boundHashChange=()=>this.handleNavigation()}init(){this.posY=window.innerHeight-72,this.injectStyles(),this.applyThemeColor(this.highlightColor),this.buildUI(),this.interceptNavigation(),this.observer=new MutationObserver(()=>{this.rootEl&&!document.contains(this.rootEl)&&document.body.appendChild(this.rootEl),this.styleEl&&!document.contains(this.styleEl)&&document.head.appendChild(this.styleEl),this.scanTimeout&&clearTimeout(this.scanTimeout),this.scanTimeout=setTimeout(()=>this.autoDetectAndScan(),150)}),this.observer.observe(document.body,{childList:!0,subtree:!0}),window.addEventListener("popstate",this.boundPopState),window.addEventListener("hashchange",this.boundHashChange),this.handleNavigation()}destroy(){this.cleanupManagedElements(),this.styleEl?.remove(),this.rootEl?.remove(),window.removeEventListener("popstate",this.boundPopState),window.removeEventListener("hashchange",this.boundHashChange),document.removeEventListener("mousemove",this.boundMouseMove),document.removeEventListener("mouseup",this.boundMouseUp),document.removeEventListener("touchmove",this.boundTouchMove),document.removeEventListener("touchend",this.boundTouchEnd),this.origPushState&&(history.pushState=this.origPushState),this.origReplaceState&&(history.replaceState=this.origReplaceState),this.observer?.disconnect(),this.scanTimeout&&clearTimeout(this.scanTimeout),this.toastTimer&&clearTimeout(this.toastTimer),this.db?.close()}injectStyles(){document.getElementById("xtroedge-cms-styles")||(this.styleEl=document.createElement("style"),this.styleEl.id="xtroedge-cms-styles",this.styleEl.textContent=T,document.head.appendChild(this.styleEl))}interceptNavigation(){this.origPushState=history.pushState.bind(history),this.origReplaceState=history.replaceState.bind(history);let t=this;history.pushState=function(...e){t.origPushState(...e),setTimeout(()=>t.handleNavigation(),0)},history.replaceState=function(...e){t.origReplaceState(...e),setTimeout(()=>t.handleNavigation(),0)}}handleNavigation(){let t=window.location.href,e=window.location.pathname||"/",i=window.location.hash||"",s,n;if(i.startsWith("#/")||i.startsWith("#!")){let p=i.replace(/^#[!/]*/,""),u=p.indexOf("?");s=u>=0?p.substring(0,u):p,n=u>=0?p.substring(u):""}else s=e.replace(/^\//,"")||"home",n=window.location.search;let r="/"+(s.replace(/^\//,"")||"home"),a=new URLSearchParams(n).get("edit")==="true";this.isEditAllowed=a||sessionStorage.getItem("builder_edit_mode")==="true";let l=r!==this.currentSlug;l&&(this.cleanupManagedElements(),this.currentSlug=r,this.currentTitle=(s.replace(/^\//,"")||"home").replace(/-/g," ").replace(/\b\w/g,p=>p.toUpperCase())+" Page",this.resetAll());let c=sessionStorage.getItem("builder_edit_mode")==="true",m=a||c;if(m){if(!localStorage.getItem("builder_token")){this.pendingEditMode||(this.pendingEditMode=!0,this.currentLang=this.detectCurrentLanguage(),this.setLoading(!0),setTimeout(()=>{this.loadTranslationsAndInit(!1),this.showLoginModal()},300));return}this.editMode=!0}if(!l&&this.initialized){this.updateUI();return}this.currentLang=this.detectCurrentLanguage(),this.setLoading(!0);let v=m;setTimeout(()=>{this.initialized=!0,this.loadTranslationsAndInit(v)},300)}buildUI(){this.rootEl=document.createElement("div"),this.rootEl.id="xtroedge-cms-root",this.loaderEl=this.createElement("div","lcms-loader-overlay lcms-hidden"),this.loaderEl.innerHTML=`<div class="lcms-loader-content">
297
+ `;var h={edit:'<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/></svg>',close:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>',undo:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="1 4 1 10 7 10"/><path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10"/></svg>',redo:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="23 4 23 10 17 10"/><path d="M20.49 15a9 9 0 1 1-2.13-9.36L23 10"/></svg>',history:'<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>',save:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"/><polyline points="17 21 17 13 7 13 7 21"/><polyline points="7 3 7 8 15 8"/></svg>',publish:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="17 1 21 5 17 9"/><path d="M3 11V9a4 4 0 0 1 4-4h14"/></svg>',image:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/></svg>',check:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6L9 17l-5-5"/></svg>',error:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="15" y1="9" x2="9" y2="15"/><line x1="9" y1="9" x2="15" y2="15"/></svg>',logout:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/><polyline points="16 17 21 12 16 7"/><line x1="21" y1="12" x2="9" y2="12"/></svg>'},B="xtroedge_cms_history",b="history",O=["h1","h2","h3","h4","h5","h6","p","span","b","strong","i","em","a","button","li","label","small","blockquote","td","th","div","header","footer"],f=class g{constructor(t){this.brandingEl=null;this.siteIdentifier="";this.siteIdEl=null;this.loginModalEl=null;this.pendingEditMode=!1;this.editMode=!1;this.currentLang="en";this.pageTexts={};this.pageImages={};this.originalTexts={};this.originalImages={};this.unsavedChanges=0;this.isSaving=!1;this.isPublishing=!1;this.loading=!1;this.canUndo=!1;this.canRedo=!1;this.showHistory=!1;this.historyList=[];this.isOpen=!1;this.isEditAllowed=!1;this.imageUploading=!1;this.toastMessage="";this.toastType="success";this.undoStack=[];this.redoStack=[];this.dirtyKeys=new Set;this.dirtyImageKeys=new Set;this.registeredKeys=new Set;this.managedElements=new Map;this.managedImages=new Map;this.autoDetectedElements=new Set;this.observer=null;this.scanTimeout=null;this.activeImageEl=null;this.imageCtxMenu=null;this.currentSlug="";this.currentTitle="";this.initialized=!1;this.origPushState=null;this.origReplaceState=null;this.styleEl=null;this.rootEl=null;this.loaderEl=null;this.toastEl=null;this.fabEl=null;this.fabBtn=null;this.badgeEl=null;this.panelEl=null;this.editToggle=null;this.langSwitchEl=null;this.changesInfoEl=null;this.undoBtn=null;this.redoBtn=null;this.historyBtnEl=null;this.historyPanelEl=null;this.historyListEl=null;this.saveBtn=null;this.publishBtn=null;this.actionsEl=null;this.editModeContent=null;this.fileInput=null;this.imgOverlay=null;this.posX=20;this.posY=20;this.isDragging=!1;this.dragStartX=0;this.dragStartY=0;this.startPosX=0;this.startPosY=0;this.hasMoved=!1;this.toastTimer=null;this.db=null;this.translationCache=new Map;this.config=t||{},this.containerSelector=this.config.containerSelector||"",this.editableTags=(this.config.editableTags||O).map(i=>i.toLowerCase()),this.languages=this.config.languages||["en"],this.defaultLanguage=this.config.defaultLanguage||this.languages[0]||"en",this.highlightColor=this.config.highlightColor||"#00C853",this.historyRetentionMs=(this.config.historyRetentionDays||7)*24*60*60*1e3,this.currentLang=this.defaultLanguage,this.siteIdentifier=this.resolveSiteIdentifier();let e=localStorage.getItem("xtroedge_theme_color");e&&(this.highlightColor=e),this.boundMouseMove=i=>this.onDragMove(i),this.boundMouseUp=()=>this.onDragEnd(),this.boundTouchMove=i=>this.onTouchMove(i),this.boundTouchEnd=()=>this.onTouchEnd(),this.boundPopState=()=>this.handleNavigation(),this.boundHashChange=()=>this.handleNavigation()}init(){this.posY=window.innerHeight-72,this.injectStyles(),this.applyThemeColor(this.highlightColor),this.buildUI(),this.interceptNavigation(),this.observer=new MutationObserver(()=>{this.rootEl&&!document.contains(this.rootEl)&&document.body.appendChild(this.rootEl),this.styleEl&&!document.contains(this.styleEl)&&document.head.appendChild(this.styleEl),this.scanTimeout&&clearTimeout(this.scanTimeout),this.scanTimeout=setTimeout(()=>this.autoDetectAndScan(),150)}),this.observer.observe(document.body,{childList:!0,subtree:!0}),window.addEventListener("popstate",this.boundPopState),window.addEventListener("hashchange",this.boundHashChange),this.handleNavigation()}destroy(){this.cleanupManagedElements(),this.styleEl?.remove(),this.rootEl?.remove(),window.removeEventListener("popstate",this.boundPopState),window.removeEventListener("hashchange",this.boundHashChange),document.removeEventListener("mousemove",this.boundMouseMove),document.removeEventListener("mouseup",this.boundMouseUp),document.removeEventListener("touchmove",this.boundTouchMove),document.removeEventListener("touchend",this.boundTouchEnd),this.origPushState&&(history.pushState=this.origPushState),this.origReplaceState&&(history.replaceState=this.origReplaceState),this.observer?.disconnect(),this.scanTimeout&&clearTimeout(this.scanTimeout),this.toastTimer&&clearTimeout(this.toastTimer),this.db?.close()}injectStyles(){document.getElementById("xtroedge-cms-styles")||(this.styleEl=document.createElement("style"),this.styleEl.id="xtroedge-cms-styles",this.styleEl.textContent=T,document.head.appendChild(this.styleEl))}interceptNavigation(){this.origPushState=history.pushState.bind(history),this.origReplaceState=history.replaceState.bind(history);let t=this;history.pushState=function(...e){t.origPushState(...e),setTimeout(()=>t.handleNavigation(),0)},history.replaceState=function(...e){t.origReplaceState(...e),setTimeout(()=>t.handleNavigation(),0)}}handleNavigation(){let t=window.location.href,e=window.location.pathname||"/",i=window.location.hash||"",s,n;if(i.startsWith("#/")||i.startsWith("#!")){let p=i.replace(/^#[!/]*/,""),u=p.indexOf("?");s=u>=0?p.substring(0,u):p,n=u>=0?p.substring(u):""}else s=e.replace(/^\//,"")||"home",n=window.location.search;let r="/"+(s.replace(/^\//,"")||"home"),a=new URLSearchParams(n).get("edit")==="true";this.isEditAllowed=a||sessionStorage.getItem("builder_edit_mode")==="true";let l=r!==this.currentSlug;l&&(this.cleanupManagedElements(),this.currentSlug=r,this.currentTitle=(s.replace(/^\//,"")||"home").replace(/-/g," ").replace(/\b\w/g,p=>p.toUpperCase())+" Page",this.resetAll());let c=sessionStorage.getItem("builder_edit_mode")==="true",m=a||c;if(m){if(!localStorage.getItem("builder_token")){this.pendingEditMode||(this.pendingEditMode=!0,this.currentLang=this.detectCurrentLanguage(),this.setLoading(!0),setTimeout(()=>{this.loadTranslationsAndInit(!1),this.showLoginModal()},300));return}this.editMode=!0}if(!l&&this.initialized){this.updateUI();return}this.currentLang=this.detectCurrentLanguage(),this.setLoading(!0),this.initialized=!0;let v=m;setTimeout(()=>{this.loadTranslationsAndInit(v)},300)}buildUI(){this.rootEl=document.createElement("div"),this.rootEl.id="xtroedge-cms-root",this.loaderEl=this.createElement("div","lcms-loader-overlay lcms-hidden"),this.loaderEl.innerHTML=`<div class="lcms-loader-content">
298
298
  <div class="lcms-orbit-loader">
299
299
  <div class="lcms-orbit lcms-orbit-1"><span class="lcms-particle"></span></div>
300
300
  <div class="lcms-orbit lcms-orbit-2"><span class="lcms-particle"></span></div>
package/dist/index.js CHANGED
@@ -585,9 +585,9 @@ var XtroedgeCMS = class _XtroedgeCMS {
585
585
  }
586
586
  this.currentLang = this.detectCurrentLanguage();
587
587
  this.setLoading(true);
588
+ this.initialized = true;
588
589
  const loadDraft = wantsEdit;
589
590
  setTimeout(() => {
590
- this.initialized = true;
591
591
  this.loadTranslationsAndInit(loadDraft);
592
592
  }, 300);
593
593
  }