ngx-xtroedge-cms 1.3.7 → 1.3.9
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/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.global.js +12 -8
- package/dist/index.js +50 -24
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +50 -24
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -131,10 +131,12 @@ var CMS_STYLES = `
|
|
|
131
131
|
.lcms-toggle input:checked + .lcms-toggle-slider::after { transform: translateX(16px); background: white; }
|
|
132
132
|
.lcms-toggle-label { font-size: 12px; font-weight: 700; color: rgba(255,255,255,0.5); letter-spacing: 0.5px; transition: color 0.25s; }
|
|
133
133
|
.lcms-toggle input:checked ~ .lcms-toggle-label { color: rgba(var(--lcms-primary-rgb, 0,200,83),0.75); }
|
|
134
|
-
.lcms-lang-switch {
|
|
135
|
-
.lcms-lang-
|
|
136
|
-
.lcms-lang-
|
|
137
|
-
.lcms-lang-
|
|
134
|
+
.lcms-lang-switch { margin-left: auto; position: relative; }
|
|
135
|
+
.lcms-lang-select { background: rgba(var(--lcms-primary-rgb, 0,200,83),0.15); border: 1px solid rgba(var(--lcms-primary-rgb, 0,200,83),0.4); border-radius: 6px; color: white; padding: 3px 24px 3px 8px; font-size: 11px; font-weight: 600; cursor: pointer; appearance: none; -webkit-appearance: none; outline: none; transition: all 0.2s; }
|
|
136
|
+
.lcms-lang-select:hover { background: rgba(var(--lcms-primary-rgb, 0,200,83),0.3); }
|
|
137
|
+
.lcms-lang-select:focus { border-color: var(--lcms-primary, #00C853); }
|
|
138
|
+
.lcms-lang-select option { background: #1a1a2e; color: white; }
|
|
139
|
+
.lcms-lang-arrow { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); pointer-events: none; color: rgba(255,255,255,0.6); font-size: 10px; }
|
|
138
140
|
.lcms-close-btn { background: transparent; border: none; color: rgba(255,255,255,0.4); cursor: pointer; padding: 2px; display: flex; transition: color 0.2s; }
|
|
139
141
|
.lcms-close-btn:hover { color: white; }
|
|
140
142
|
.lcms-changes-info { font-size: 12px; color: rgba(var(--lcms-primary-rgb, 0,200,83),0.75); margin-bottom: 10px; padding-left: 2px; }
|
|
@@ -221,6 +223,8 @@ var CMS_STYLES = `
|
|
|
221
223
|
.lcms-btn-cancel { background: transparent; color: rgba(255,255,255,0.5); border: 1px solid rgba(var(--lcms-primary-rgb, 0,200,83),0.25) !important; }
|
|
222
224
|
.lcms-btn-cancel:hover { color: white; border-color: rgba(var(--lcms-primary-rgb, 0,200,83),0.5) !important; background: rgba(var(--lcms-primary-rgb, 0,200,83),0.08); }
|
|
223
225
|
.lcms-btn-cancel:disabled { opacity: 0.3; cursor: not-allowed; }
|
|
226
|
+
.lcms-btn-logout { background: rgba(244,67,54,0.12); color: rgba(244,67,54,0.85); border: 1px solid rgba(244,67,54,0.25) !important; margin-top: 4px; }
|
|
227
|
+
.lcms-btn-logout:hover { background: rgba(244,67,54,0.2); color: #f44336; border-color: rgba(244,67,54,0.5) !important; }
|
|
224
228
|
|
|
225
229
|
.lcms-spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,0.3); border-top-color: white; border-radius: 50%; animation: lcmsSpin 0.6s linear infinite; }
|
|
226
230
|
|
|
@@ -304,7 +308,8 @@ var ICON = {
|
|
|
304
308
|
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>',
|
|
305
309
|
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>',
|
|
306
310
|
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>',
|
|
307
|
-
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>'
|
|
311
|
+
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>',
|
|
312
|
+
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>'
|
|
308
313
|
};
|
|
309
314
|
var DB_NAME = "xtroedge_cms_history";
|
|
310
315
|
var STORE_NAME = "history";
|
|
@@ -722,9 +727,17 @@ var XtroedgeCMS = class _XtroedgeCMS {
|
|
|
722
727
|
e.stopPropagation();
|
|
723
728
|
this.cancelEditing();
|
|
724
729
|
});
|
|
730
|
+
const logoutBtn = document.createElement("button");
|
|
731
|
+
logoutBtn.className = "lcms-btn-logout";
|
|
732
|
+
logoutBtn.innerHTML = `${ICON.logout} Logout`;
|
|
733
|
+
logoutBtn.addEventListener("click", (e) => {
|
|
734
|
+
e.stopPropagation();
|
|
735
|
+
this.logout();
|
|
736
|
+
});
|
|
725
737
|
this.actionsEl.appendChild(this.saveBtn);
|
|
726
738
|
this.actionsEl.appendChild(this.publishBtn);
|
|
727
739
|
this.actionsEl.appendChild(this.cancelBtn);
|
|
740
|
+
this.actionsEl.appendChild(logoutBtn);
|
|
728
741
|
this.editModeContent.appendChild(this.actionsEl);
|
|
729
742
|
this.panelEl.appendChild(this.editModeContent);
|
|
730
743
|
this.brandingEl = this.createElement("div", "lcms-branding");
|
|
@@ -738,16 +751,24 @@ var XtroedgeCMS = class _XtroedgeCMS {
|
|
|
738
751
|
buildLangButtons() {
|
|
739
752
|
if (!this.langSwitchEl) return;
|
|
740
753
|
this.langSwitchEl.innerHTML = "";
|
|
754
|
+
const select = document.createElement("select");
|
|
755
|
+
select.className = "lcms-lang-select";
|
|
741
756
|
for (const lang of this.languages) {
|
|
742
|
-
const
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
this.switchLang(lang);
|
|
748
|
-
});
|
|
749
|
-
this.langSwitchEl.appendChild(btn);
|
|
757
|
+
const opt = document.createElement("option");
|
|
758
|
+
opt.value = lang;
|
|
759
|
+
opt.textContent = lang.toUpperCase();
|
|
760
|
+
if (lang === this.currentLang) opt.selected = true;
|
|
761
|
+
select.appendChild(opt);
|
|
750
762
|
}
|
|
763
|
+
select.addEventListener("change", (e) => {
|
|
764
|
+
e.stopPropagation();
|
|
765
|
+
this.switchLang(e.target.value);
|
|
766
|
+
});
|
|
767
|
+
this.langSwitchEl.appendChild(select);
|
|
768
|
+
const arrow = document.createElement("span");
|
|
769
|
+
arrow.className = "lcms-lang-arrow";
|
|
770
|
+
arrow.textContent = "\u25BC";
|
|
771
|
+
this.langSwitchEl.appendChild(arrow);
|
|
751
772
|
}
|
|
752
773
|
// ===============================================
|
|
753
774
|
// UI UPDATE
|
|
@@ -778,10 +799,8 @@ var XtroedgeCMS = class _XtroedgeCMS {
|
|
|
778
799
|
if (this.editToggle) this.editToggle.checked = this.editMode;
|
|
779
800
|
if (this.langSwitchEl) {
|
|
780
801
|
this.langSwitchEl.classList.toggle("lcms-hidden", !this.editMode || this.languages.length <= 1);
|
|
781
|
-
const
|
|
782
|
-
|
|
783
|
-
btn.classList.toggle("active", btn.textContent === this.currentLang.toUpperCase());
|
|
784
|
-
});
|
|
802
|
+
const sel = this.langSwitchEl.querySelector(".lcms-lang-select");
|
|
803
|
+
if (sel) sel.value = this.currentLang;
|
|
785
804
|
}
|
|
786
805
|
if (this.editModeContent) {
|
|
787
806
|
this.editModeContent.classList.toggle("lcms-hidden", !this.editMode);
|
|
@@ -1264,6 +1283,16 @@ var XtroedgeCMS = class _XtroedgeCMS {
|
|
|
1264
1283
|
this.applyPageImages();
|
|
1265
1284
|
this.updateUI();
|
|
1266
1285
|
}
|
|
1286
|
+
logout() {
|
|
1287
|
+
localStorage.removeItem("builder_token");
|
|
1288
|
+
sessionStorage.removeItem("builder_edit_mode");
|
|
1289
|
+
this.editMode = false;
|
|
1290
|
+
this.isEditAllowed = false;
|
|
1291
|
+
this.applyEditMode(false);
|
|
1292
|
+
this.isOpen = false;
|
|
1293
|
+
this.updateUI();
|
|
1294
|
+
this.showToast("Logged out", "success");
|
|
1295
|
+
}
|
|
1267
1296
|
// ===============================================
|
|
1268
1297
|
// API
|
|
1269
1298
|
// ===============================================
|
|
@@ -1668,15 +1697,12 @@ var XtroedgeCMS = class _XtroedgeCMS {
|
|
|
1668
1697
|
}
|
|
1669
1698
|
switchLang(lang) {
|
|
1670
1699
|
this.currentLang = lang;
|
|
1671
|
-
const html = document.documentElement;
|
|
1672
|
-
html.setAttribute("lang", lang);
|
|
1673
|
-
html.setAttribute("dir", lang === "ar" ? "rtl" : "ltr");
|
|
1674
1700
|
localStorage.setItem("selectedLanguage", lang);
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
this.updateUI();
|
|
1678
|
-
window.dispatchEvent(new CustomEvent("cms:langChanged", { detail: { lang } }));
|
|
1701
|
+
document.documentElement.setAttribute("lang", lang);
|
|
1702
|
+
document.documentElement.setAttribute("dir", lang === "ar" ? "rtl" : "ltr");
|
|
1679
1703
|
this.config.onLangChanged?.(lang);
|
|
1704
|
+
window.dispatchEvent(new CustomEvent("cms:langChanged", { detail: { lang } }));
|
|
1705
|
+
window.location.reload();
|
|
1680
1706
|
}
|
|
1681
1707
|
// ===============================================
|
|
1682
1708
|
// FAB DRAG
|