ngx-xtroedge-cms 1.0.0

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.
@@ -0,0 +1,223 @@
1
+ /** Configuration for the CMS */
2
+ interface XtroedgeCmsConfig {
3
+ /** Required: API base URL for save/publish/load endpoints */
4
+ apiBase: string;
5
+ /** Base URL prepended to uploaded image paths (defaults to apiBase origin) */
6
+ imageBaseUrl?: string;
7
+ /** CSS selector for the content container to scan (default: 'body') */
8
+ containerSelector?: string;
9
+ /** HTML tags to make editable (default: h1-h6, p, span, b, strong, i, em, a, button, li, label, small, blockquote, td, th) */
10
+ editableTags?: string[];
11
+ /** Supported content languages (default: ['en']) */
12
+ languages?: string[];
13
+ /** Default language (default: 'en') */
14
+ defaultLanguage?: string;
15
+ /** Path to i18n JSON files for pre-populating translations (optional) */
16
+ i18nBasePath?: string;
17
+ /** Days to keep edit history in IndexedDB (default: 7) */
18
+ historyRetentionDays?: number;
19
+ /** Highlight color for editable elements (default: '#6722FB') */
20
+ highlightColor?: string;
21
+ onSaved?: () => void;
22
+ onPublished?: () => void;
23
+ onError?: (action: string, error: any) => void;
24
+ onEditModeChanged?: (editMode: boolean) => void;
25
+ onLangChanged?: (lang: string) => void;
26
+ }
27
+ /** Text entry for a single element across languages */
28
+ interface PageTextEntry {
29
+ [lang: string]: string;
30
+ }
31
+ /** Page content structure from API */
32
+ interface WebPageContent {
33
+ slug: string;
34
+ title: string;
35
+ content: {
36
+ texts: {
37
+ [key: string]: PageTextEntry;
38
+ };
39
+ images?: {
40
+ [key: string]: string;
41
+ };
42
+ };
43
+ published_content?: {
44
+ texts: {
45
+ [key: string]: PageTextEntry;
46
+ };
47
+ images?: {
48
+ [key: string]: string;
49
+ };
50
+ };
51
+ }
52
+ /** Edit history entry stored in IndexedDB */
53
+ interface EditHistoryEntry {
54
+ id?: number;
55
+ slug: string;
56
+ timestamp: number;
57
+ label: string;
58
+ lang: string;
59
+ snapshot: string;
60
+ }
61
+
62
+ declare class XtroedgeCMS {
63
+ private config;
64
+ private containerSelector;
65
+ private editableTags;
66
+ private languages;
67
+ private defaultLanguage;
68
+ private highlightColor;
69
+ private historyRetentionMs;
70
+ private editMode;
71
+ private currentLang;
72
+ private pageTexts;
73
+ private pageImages;
74
+ private originalTexts;
75
+ private originalImages;
76
+ private unsavedChanges;
77
+ private isSaving;
78
+ private isPublishing;
79
+ private loading;
80
+ private canUndo;
81
+ private canRedo;
82
+ private showHistory;
83
+ private historyList;
84
+ private isOpen;
85
+ private isEditAllowed;
86
+ private imageUploading;
87
+ private toastMessage;
88
+ private toastType;
89
+ private undoStack;
90
+ private redoStack;
91
+ private dirtyKeys;
92
+ private dirtyImageKeys;
93
+ private registeredKeys;
94
+ private managedElements;
95
+ private managedImages;
96
+ private autoDetectedElements;
97
+ private observer;
98
+ private scanTimeout;
99
+ private activeImageEl;
100
+ private imageCtxMenu;
101
+ private currentSlug;
102
+ private currentTitle;
103
+ private origPushState;
104
+ private origReplaceState;
105
+ private styleEl;
106
+ private rootEl;
107
+ private loaderEl;
108
+ private toastEl;
109
+ private fabEl;
110
+ private fabBtn;
111
+ private badgeEl;
112
+ private panelEl;
113
+ private editToggle;
114
+ private langSwitchEl;
115
+ private changesInfoEl;
116
+ private undoBtn;
117
+ private redoBtn;
118
+ private historyBtnEl;
119
+ private historyPanelEl;
120
+ private historyListEl;
121
+ private saveBtn;
122
+ private publishBtn;
123
+ private cancelBtn;
124
+ private actionsEl;
125
+ private editModeContent;
126
+ private fileInput;
127
+ private imgOverlay;
128
+ private posX;
129
+ private posY;
130
+ private isDragging;
131
+ private dragStartX;
132
+ private dragStartY;
133
+ private startPosX;
134
+ private startPosY;
135
+ private hasMoved;
136
+ private toastTimer;
137
+ private db;
138
+ private boundMouseMove;
139
+ private boundMouseUp;
140
+ private boundTouchMove;
141
+ private boundTouchEnd;
142
+ private boundPopState;
143
+ private boundHashChange;
144
+ private translationCache;
145
+ constructor(config: XtroedgeCmsConfig);
146
+ init(): void;
147
+ destroy(): void;
148
+ private injectStyles;
149
+ private interceptNavigation;
150
+ private handleNavigation;
151
+ private buildUI;
152
+ private buildPanel;
153
+ private buildLangButtons;
154
+ private updateUI;
155
+ private autoDetectAndScan;
156
+ private autoDetectElements;
157
+ private scanDOM;
158
+ private scanImages;
159
+ private getDirectTextContent;
160
+ private attachElement;
161
+ private detachElement;
162
+ private enableElementEdit;
163
+ private disableElementEdit;
164
+ private applyEditMode;
165
+ private updateElementTexts;
166
+ private cleanupManagedElements;
167
+ private attachImage;
168
+ private detachImage;
169
+ private cleanupManagedImages;
170
+ private applyImageEditMode;
171
+ private enableImageEdit;
172
+ private disableImageEdit;
173
+ private showImageContextMenu;
174
+ private dismissImageCtxMenu;
175
+ private onImageFileSelected;
176
+ private uploadImageToApi;
177
+ private applyPageImages;
178
+ private getPageText;
179
+ private onTextChanged;
180
+ private onImageChanged;
181
+ private createSnapshot;
182
+ private applySnapshot;
183
+ private onUndo;
184
+ private onRedo;
185
+ private recalcDirtyKeys;
186
+ private resetAll;
187
+ private resetAfterSave;
188
+ private cancelEditing;
189
+ private loadTranslationsAndInit;
190
+ private flattenTranslations;
191
+ private getPageSection;
192
+ private loadPageContent;
193
+ private loadPublishedContent;
194
+ private buildDefaultTexts;
195
+ private saveChanges;
196
+ private publishChanges;
197
+ private toggleHistory;
198
+ private loadHistory;
199
+ private renderHistoryList;
200
+ private restoreHistory;
201
+ private pushHistory;
202
+ private cleanOldHistory;
203
+ private openDB;
204
+ private showToast;
205
+ private onFabClick;
206
+ private togglePanel;
207
+ private toggleEditMode;
208
+ private switchLang;
209
+ private onDragStart;
210
+ private onDragMove;
211
+ private onDragEnd;
212
+ private onTouchStart;
213
+ private onTouchMove;
214
+ private onTouchEnd;
215
+ private setLoading;
216
+ private detectCurrentLanguage;
217
+ private createElement;
218
+ private formatDate;
219
+ /** Quick init - create and start CMS in one call */
220
+ static create(config: XtroedgeCmsConfig): XtroedgeCMS;
221
+ }
222
+
223
+ export { type EditHistoryEntry, type PageTextEntry, type WebPageContent, XtroedgeCMS, type XtroedgeCmsConfig };
@@ -0,0 +1,223 @@
1
+ /** Configuration for the CMS */
2
+ interface XtroedgeCmsConfig {
3
+ /** Required: API base URL for save/publish/load endpoints */
4
+ apiBase: string;
5
+ /** Base URL prepended to uploaded image paths (defaults to apiBase origin) */
6
+ imageBaseUrl?: string;
7
+ /** CSS selector for the content container to scan (default: 'body') */
8
+ containerSelector?: string;
9
+ /** HTML tags to make editable (default: h1-h6, p, span, b, strong, i, em, a, button, li, label, small, blockquote, td, th) */
10
+ editableTags?: string[];
11
+ /** Supported content languages (default: ['en']) */
12
+ languages?: string[];
13
+ /** Default language (default: 'en') */
14
+ defaultLanguage?: string;
15
+ /** Path to i18n JSON files for pre-populating translations (optional) */
16
+ i18nBasePath?: string;
17
+ /** Days to keep edit history in IndexedDB (default: 7) */
18
+ historyRetentionDays?: number;
19
+ /** Highlight color for editable elements (default: '#6722FB') */
20
+ highlightColor?: string;
21
+ onSaved?: () => void;
22
+ onPublished?: () => void;
23
+ onError?: (action: string, error: any) => void;
24
+ onEditModeChanged?: (editMode: boolean) => void;
25
+ onLangChanged?: (lang: string) => void;
26
+ }
27
+ /** Text entry for a single element across languages */
28
+ interface PageTextEntry {
29
+ [lang: string]: string;
30
+ }
31
+ /** Page content structure from API */
32
+ interface WebPageContent {
33
+ slug: string;
34
+ title: string;
35
+ content: {
36
+ texts: {
37
+ [key: string]: PageTextEntry;
38
+ };
39
+ images?: {
40
+ [key: string]: string;
41
+ };
42
+ };
43
+ published_content?: {
44
+ texts: {
45
+ [key: string]: PageTextEntry;
46
+ };
47
+ images?: {
48
+ [key: string]: string;
49
+ };
50
+ };
51
+ }
52
+ /** Edit history entry stored in IndexedDB */
53
+ interface EditHistoryEntry {
54
+ id?: number;
55
+ slug: string;
56
+ timestamp: number;
57
+ label: string;
58
+ lang: string;
59
+ snapshot: string;
60
+ }
61
+
62
+ declare class XtroedgeCMS {
63
+ private config;
64
+ private containerSelector;
65
+ private editableTags;
66
+ private languages;
67
+ private defaultLanguage;
68
+ private highlightColor;
69
+ private historyRetentionMs;
70
+ private editMode;
71
+ private currentLang;
72
+ private pageTexts;
73
+ private pageImages;
74
+ private originalTexts;
75
+ private originalImages;
76
+ private unsavedChanges;
77
+ private isSaving;
78
+ private isPublishing;
79
+ private loading;
80
+ private canUndo;
81
+ private canRedo;
82
+ private showHistory;
83
+ private historyList;
84
+ private isOpen;
85
+ private isEditAllowed;
86
+ private imageUploading;
87
+ private toastMessage;
88
+ private toastType;
89
+ private undoStack;
90
+ private redoStack;
91
+ private dirtyKeys;
92
+ private dirtyImageKeys;
93
+ private registeredKeys;
94
+ private managedElements;
95
+ private managedImages;
96
+ private autoDetectedElements;
97
+ private observer;
98
+ private scanTimeout;
99
+ private activeImageEl;
100
+ private imageCtxMenu;
101
+ private currentSlug;
102
+ private currentTitle;
103
+ private origPushState;
104
+ private origReplaceState;
105
+ private styleEl;
106
+ private rootEl;
107
+ private loaderEl;
108
+ private toastEl;
109
+ private fabEl;
110
+ private fabBtn;
111
+ private badgeEl;
112
+ private panelEl;
113
+ private editToggle;
114
+ private langSwitchEl;
115
+ private changesInfoEl;
116
+ private undoBtn;
117
+ private redoBtn;
118
+ private historyBtnEl;
119
+ private historyPanelEl;
120
+ private historyListEl;
121
+ private saveBtn;
122
+ private publishBtn;
123
+ private cancelBtn;
124
+ private actionsEl;
125
+ private editModeContent;
126
+ private fileInput;
127
+ private imgOverlay;
128
+ private posX;
129
+ private posY;
130
+ private isDragging;
131
+ private dragStartX;
132
+ private dragStartY;
133
+ private startPosX;
134
+ private startPosY;
135
+ private hasMoved;
136
+ private toastTimer;
137
+ private db;
138
+ private boundMouseMove;
139
+ private boundMouseUp;
140
+ private boundTouchMove;
141
+ private boundTouchEnd;
142
+ private boundPopState;
143
+ private boundHashChange;
144
+ private translationCache;
145
+ constructor(config: XtroedgeCmsConfig);
146
+ init(): void;
147
+ destroy(): void;
148
+ private injectStyles;
149
+ private interceptNavigation;
150
+ private handleNavigation;
151
+ private buildUI;
152
+ private buildPanel;
153
+ private buildLangButtons;
154
+ private updateUI;
155
+ private autoDetectAndScan;
156
+ private autoDetectElements;
157
+ private scanDOM;
158
+ private scanImages;
159
+ private getDirectTextContent;
160
+ private attachElement;
161
+ private detachElement;
162
+ private enableElementEdit;
163
+ private disableElementEdit;
164
+ private applyEditMode;
165
+ private updateElementTexts;
166
+ private cleanupManagedElements;
167
+ private attachImage;
168
+ private detachImage;
169
+ private cleanupManagedImages;
170
+ private applyImageEditMode;
171
+ private enableImageEdit;
172
+ private disableImageEdit;
173
+ private showImageContextMenu;
174
+ private dismissImageCtxMenu;
175
+ private onImageFileSelected;
176
+ private uploadImageToApi;
177
+ private applyPageImages;
178
+ private getPageText;
179
+ private onTextChanged;
180
+ private onImageChanged;
181
+ private createSnapshot;
182
+ private applySnapshot;
183
+ private onUndo;
184
+ private onRedo;
185
+ private recalcDirtyKeys;
186
+ private resetAll;
187
+ private resetAfterSave;
188
+ private cancelEditing;
189
+ private loadTranslationsAndInit;
190
+ private flattenTranslations;
191
+ private getPageSection;
192
+ private loadPageContent;
193
+ private loadPublishedContent;
194
+ private buildDefaultTexts;
195
+ private saveChanges;
196
+ private publishChanges;
197
+ private toggleHistory;
198
+ private loadHistory;
199
+ private renderHistoryList;
200
+ private restoreHistory;
201
+ private pushHistory;
202
+ private cleanOldHistory;
203
+ private openDB;
204
+ private showToast;
205
+ private onFabClick;
206
+ private togglePanel;
207
+ private toggleEditMode;
208
+ private switchLang;
209
+ private onDragStart;
210
+ private onDragMove;
211
+ private onDragEnd;
212
+ private onTouchStart;
213
+ private onTouchMove;
214
+ private onTouchEnd;
215
+ private setLoading;
216
+ private detectCurrentLanguage;
217
+ private createElement;
218
+ private formatDate;
219
+ /** Quick init - create and start CMS in one call */
220
+ static create(config: XtroedgeCmsConfig): XtroedgeCMS;
221
+ }
222
+
223
+ export { type EditHistoryEntry, type PageTextEntry, type WebPageContent, XtroedgeCMS, type XtroedgeCmsConfig };