@postalsys/ee-client 1.2.1 → 1.3.2
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/README.md +11 -0
- package/index.js +287 -20
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -111,6 +111,7 @@ When used in a browser with a container element, the client automatically create
|
|
|
111
111
|
- Message list with pagination
|
|
112
112
|
- Message viewer with actions (mark as read/unread, delete, move)
|
|
113
113
|
- Responsive design
|
|
114
|
+
- Dark mode support with persistent preference
|
|
114
115
|
|
|
115
116
|
```html
|
|
116
117
|
<div id="email-client" style="height: 600px;"></div>
|
|
@@ -184,6 +185,16 @@ The library uses contextually appropriate titles and button texts:
|
|
|
184
185
|
|
|
185
186
|
Both methods can be synchronous or asynchronous and should return a boolean for confirm dialogs.
|
|
186
187
|
|
|
188
|
+
### Dark Mode
|
|
189
|
+
|
|
190
|
+
The email client includes built-in dark mode support with automatic persistence of user preference:
|
|
191
|
+
|
|
192
|
+
- **Toggle Button**: A moon/sun icon in the top-right corner toggles between light and dark modes
|
|
193
|
+
- **Persistent Preference**: Dark mode preference is saved to localStorage and restored on page reload
|
|
194
|
+
- **Complete Theme**: All UI components are styled for optimal readability in both light and dark modes
|
|
195
|
+
|
|
196
|
+
Dark mode is automatically initialized based on the saved preference when the client is created.
|
|
197
|
+
|
|
187
198
|
## License
|
|
188
199
|
|
|
189
200
|
MIT © Postal Systems OÜ
|
package/index.js
CHANGED
|
@@ -21,6 +21,12 @@ export class EmailEngineClient {
|
|
|
21
21
|
this.keepAliveTimer = null;
|
|
22
22
|
this.lastActivity = Date.now();
|
|
23
23
|
|
|
24
|
+
// Dark mode state
|
|
25
|
+
this.darkMode = false;
|
|
26
|
+
if (typeof window !== 'undefined' && window.localStorage) {
|
|
27
|
+
this.darkMode = localStorage.getItem('ee-client-dark-mode') === 'true';
|
|
28
|
+
}
|
|
29
|
+
|
|
24
30
|
// Get page size from localStorage or options or default
|
|
25
31
|
const savedPageSize =
|
|
26
32
|
typeof window !== 'undefined' && window.localStorage ? localStorage.getItem('ee-client-page-size') : null;
|
|
@@ -177,6 +183,15 @@ export class EmailEngineClient {
|
|
|
177
183
|
|
|
178
184
|
if (this.container) {
|
|
179
185
|
this.renderMessage();
|
|
186
|
+
|
|
187
|
+
// Scroll to top of the email client container
|
|
188
|
+
this.container.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
189
|
+
|
|
190
|
+
// Also scroll the window to ensure visibility
|
|
191
|
+
if (typeof window !== 'undefined') {
|
|
192
|
+
const containerTop = this.container.getBoundingClientRect().top + window.pageYOffset;
|
|
193
|
+
window.scrollTo({ top: containerTop, behavior: 'smooth' });
|
|
194
|
+
}
|
|
180
195
|
}
|
|
181
196
|
|
|
182
197
|
return this.currentMessage;
|
|
@@ -358,6 +373,14 @@ export class EmailEngineClient {
|
|
|
358
373
|
return Math.round((bytes / Math.pow(1024, i)) * 100) / 100 + ' ' + sizes[i];
|
|
359
374
|
}
|
|
360
375
|
|
|
376
|
+
escapeHtml(value) {
|
|
377
|
+
if (value === null || value === undefined) {
|
|
378
|
+
return '';
|
|
379
|
+
}
|
|
380
|
+
const htmlEscapes = { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' };
|
|
381
|
+
return String(value).replace(/[&<>"']/g, ch => htmlEscapes[ch]);
|
|
382
|
+
}
|
|
383
|
+
|
|
361
384
|
async downloadAttachment(attachmentId, suggestedFilename = null) {
|
|
362
385
|
try {
|
|
363
386
|
const headers = {};
|
|
@@ -1035,6 +1058,219 @@ export class EmailEngineClient {
|
|
|
1035
1058
|
.ee-compose-cancel:hover {
|
|
1036
1059
|
background: #545b62;
|
|
1037
1060
|
}
|
|
1061
|
+
|
|
1062
|
+
/* Dark mode toggle button */
|
|
1063
|
+
.ee-dark-mode-toggle {
|
|
1064
|
+
position: absolute;
|
|
1065
|
+
top: 8px;
|
|
1066
|
+
right: 16px;
|
|
1067
|
+
background: #f8f9fa;
|
|
1068
|
+
border: 1px solid #dee2e6;
|
|
1069
|
+
border-radius: 3px;
|
|
1070
|
+
padding: 6px 10px;
|
|
1071
|
+
font-size: 12px;
|
|
1072
|
+
cursor: pointer;
|
|
1073
|
+
z-index: 100;
|
|
1074
|
+
transition: all 0.2s ease;
|
|
1075
|
+
display: flex;
|
|
1076
|
+
align-items: center;
|
|
1077
|
+
justify-content: center;
|
|
1078
|
+
color: #495057;
|
|
1079
|
+
font-weight: 500;
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
.ee-dark-mode-toggle:hover {
|
|
1083
|
+
background: #e9ecef;
|
|
1084
|
+
border-color: #adb5bd;
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
.ee-dark-mode-icon {
|
|
1088
|
+
font-size: 14px;
|
|
1089
|
+
line-height: 1;
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
/* Dark mode styles */
|
|
1093
|
+
.ee-dark-mode {
|
|
1094
|
+
background: #1a1a1a;
|
|
1095
|
+
color: #e0e0e0;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
.ee-dark-mode .ee-dark-mode-toggle {
|
|
1099
|
+
background: #333;
|
|
1100
|
+
border-color: #444;
|
|
1101
|
+
color: #e0e0e0;
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
.ee-dark-mode .ee-dark-mode-toggle:hover {
|
|
1105
|
+
background: #444;
|
|
1106
|
+
border-color: #555;
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
.ee-dark-mode .ee-sidebar {
|
|
1110
|
+
background: #202020;
|
|
1111
|
+
border-color: #333;
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
.ee-dark-mode .ee-folder-item {
|
|
1115
|
+
border-color: #333;
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
.ee-dark-mode .ee-folder-item:hover {
|
|
1119
|
+
background: #2a2a2a;
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
.ee-dark-mode .ee-folder-item.active {
|
|
1123
|
+
background: #0056b3;
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
.ee-dark-mode .ee-message-list {
|
|
1127
|
+
background: #202020;
|
|
1128
|
+
border-color: #333;
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
.ee-dark-mode .ee-message-item {
|
|
1132
|
+
border-color: #333;
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
.ee-dark-mode .ee-message-item:hover {
|
|
1136
|
+
background: #2a2a2a;
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
.ee-dark-mode .ee-message-item.active {
|
|
1140
|
+
background: #1a3d5c;
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
.ee-dark-mode .ee-message-date,
|
|
1144
|
+
.ee-dark-mode .ee-message-preview,
|
|
1145
|
+
.ee-dark-mode .ee-attachment-indicator {
|
|
1146
|
+
color: #999;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
.ee-dark-mode .ee-pane-header {
|
|
1150
|
+
background: linear-gradient(to bottom, #2a2a2a, #252525);
|
|
1151
|
+
border-color: #333;
|
|
1152
|
+
color: #e0e0e0;
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
.ee-dark-mode .ee-pane-title {
|
|
1156
|
+
color: #e0e0e0;
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
.ee-dark-mode .ee-page-size-label {
|
|
1160
|
+
color: #e0e0e0;
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
.ee-dark-mode .ee-message-viewer {
|
|
1164
|
+
background: #1a1a1a;
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
.ee-dark-mode .ee-message-actions {
|
|
1168
|
+
background: linear-gradient(to bottom, #2a2a2a, #252525);
|
|
1169
|
+
border-color: #333;
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
.ee-dark-mode .ee-button {
|
|
1173
|
+
background: #333;
|
|
1174
|
+
border-color: #444;
|
|
1175
|
+
color: #e0e0e0;
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
.ee-dark-mode .ee-button:hover {
|
|
1179
|
+
background: #444;
|
|
1180
|
+
border-color: #555;
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
.ee-dark-mode .ee-button:disabled {
|
|
1184
|
+
background: #222;
|
|
1185
|
+
color: #666;
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
.ee-dark-mode select {
|
|
1189
|
+
background: #2a2a2a;
|
|
1190
|
+
border-color: #444;
|
|
1191
|
+
color: #e0e0e0;
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
.ee-dark-mode .ee-message-content {
|
|
1195
|
+
background: #1a1a1a;
|
|
1196
|
+
color: #e0e0e0;
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
.ee-dark-mode .ee-attachments {
|
|
1200
|
+
background: #252525;
|
|
1201
|
+
border-color: #333;
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
.ee-dark-mode .ee-attachment-item {
|
|
1205
|
+
background: #2a2a2a;
|
|
1206
|
+
border-color: #333;
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
.ee-dark-mode .ee-attachment-item:hover {
|
|
1210
|
+
background: #333;
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
.ee-dark-mode .ee-loading,
|
|
1214
|
+
.ee-dark-mode .ee-empty-state,
|
|
1215
|
+
.ee-dark-mode .ee-error {
|
|
1216
|
+
color: #999;
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
.ee-dark-mode .ee-pagination {
|
|
1220
|
+
background: #252525;
|
|
1221
|
+
border-color: #333;
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
.ee-dark-mode .ee-compose-button {
|
|
1225
|
+
background: #0056b3;
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
.ee-dark-mode .ee-compose-modal {
|
|
1229
|
+
background: rgba(0, 0, 0, 0.7);
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
.ee-dark-mode .ee-compose-content {
|
|
1233
|
+
background: #202020;
|
|
1234
|
+
color: #e0e0e0;
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
.ee-dark-mode .ee-compose-header {
|
|
1238
|
+
background: linear-gradient(to bottom, #2a2a2a, #252525);
|
|
1239
|
+
border-color: #333;
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
.ee-dark-mode .ee-compose-close {
|
|
1243
|
+
color: #999;
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
.ee-dark-mode .ee-compose-close:hover {
|
|
1247
|
+
color: #fff;
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
.ee-dark-mode .ee-compose-input,
|
|
1251
|
+
.ee-dark-mode .ee-compose-textarea {
|
|
1252
|
+
background: #1a1a1a;
|
|
1253
|
+
border-color: #444;
|
|
1254
|
+
color: #e0e0e0;
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
.ee-dark-mode .ee-compose-input:focus,
|
|
1258
|
+
.ee-dark-mode .ee-compose-textarea:focus {
|
|
1259
|
+
border-color: #0056b3;
|
|
1260
|
+
box-shadow: 0 0 0 2px rgba(0,86,179,0.2);
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
.ee-dark-mode .ee-compose-actions {
|
|
1264
|
+
border-color: #333;
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
.ee-dark-mode .ee-compose-cancel {
|
|
1268
|
+
background: #444;
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1271
|
+
.ee-dark-mode .ee-compose-cancel:hover {
|
|
1272
|
+
background: #555;
|
|
1273
|
+
}
|
|
1038
1274
|
`;
|
|
1039
1275
|
document.head.appendChild(style);
|
|
1040
1276
|
}
|
|
@@ -1129,11 +1365,11 @@ export class EmailEngineClient {
|
|
|
1129
1365
|
const hasChildren = this.folders.some(f => f.parentPath === folder.path);
|
|
1130
1366
|
return `
|
|
1131
1367
|
<li class="ee-folder-item ${folder.path === this.currentFolder ? 'active' : ''}"
|
|
1132
|
-
data-path="${folder.path}"
|
|
1368
|
+
data-path="${this.escapeHtml(folder.path)}"
|
|
1133
1369
|
data-depth="${depth}">
|
|
1134
1370
|
<div class="ee-folder-content" style="padding-left: ${8 + depth * 12}px;">
|
|
1135
1371
|
${depth > 0 ? '<span class="ee-folder-indent">└ </span>' : ''}
|
|
1136
|
-
<span class="ee-folder-name ${hasChildren ? 'has-children' : ''}">${folder.name}</span>
|
|
1372
|
+
<span class="ee-folder-name ${hasChildren ? 'has-children' : ''}">${this.escapeHtml(folder.name)}</span>
|
|
1137
1373
|
${folder.status && folder.status.messages > 0 ? `<span class="ee-folder-count">${folder.status.messages}</span>` : ''}
|
|
1138
1374
|
</div>
|
|
1139
1375
|
</li>
|
|
@@ -1202,16 +1438,16 @@ export class EmailEngineClient {
|
|
|
1202
1438
|
${this.messages
|
|
1203
1439
|
.map(
|
|
1204
1440
|
msg => `
|
|
1205
|
-
<div class="ee-message-item ${msg.unseen ? 'unread' : ''} ${msg.id === (this.currentMessage && this.currentMessage.id) ? 'active' : ''}" data-id="${msg.id}">
|
|
1441
|
+
<div class="ee-message-item ${msg.unseen ? 'unread' : ''} ${msg.id === (this.currentMessage && this.currentMessage.id) ? 'active' : ''}" data-id="${this.escapeHtml(msg.id)}">
|
|
1206
1442
|
<div class="ee-message-header">
|
|
1207
|
-
<span class="ee-message-from">${msg.from ? msg.from.name || msg.from.address : 'Unknown'}</span>
|
|
1443
|
+
<span class="ee-message-from">${this.escapeHtml(msg.from ? msg.from.name || msg.from.address : 'Unknown')}</span>
|
|
1208
1444
|
<span class="ee-message-date">${this.formatDate(msg.date)}</span>
|
|
1209
1445
|
</div>
|
|
1210
1446
|
<div class="ee-message-subject">
|
|
1211
|
-
<span class="ee-message-subject-text">${msg.subject || '(no subject)'}</span>
|
|
1447
|
+
<span class="ee-message-subject-text">${this.escapeHtml(msg.subject || '(no subject)')}</span>
|
|
1212
1448
|
${msg.attachments && msg.attachments.length > 0 ? `<span class="ee-attachment-indicator">${msg.attachments.length}</span>` : ''}
|
|
1213
1449
|
</div>
|
|
1214
|
-
<div class="ee-message-preview">${msg.intro || ''}</div>
|
|
1450
|
+
<div class="ee-message-preview">${this.escapeHtml(msg.intro || '')}</div>
|
|
1215
1451
|
</div>
|
|
1216
1452
|
`
|
|
1217
1453
|
)
|
|
@@ -1281,7 +1517,7 @@ export class EmailEngineClient {
|
|
|
1281
1517
|
const depth = this.calculateFolderDepth(folder);
|
|
1282
1518
|
const indent = ' '.repeat(depth);
|
|
1283
1519
|
const prefix = depth > 0 ? '└ ' : '';
|
|
1284
|
-
return `<option value="${folder.path}" ${folder.path === this.currentFolder ? 'disabled' : ''}>${indent}${prefix}${folder.name}</option>`;
|
|
1520
|
+
return `<option value="${this.escapeHtml(folder.path)}" ${folder.path === this.currentFolder ? 'disabled' : ''}>${indent}${prefix}${this.escapeHtml(folder.name)}</option>`;
|
|
1285
1521
|
})
|
|
1286
1522
|
.join('')}
|
|
1287
1523
|
</select>
|
|
@@ -1290,18 +1526,18 @@ export class EmailEngineClient {
|
|
|
1290
1526
|
<div class="ee-message-meta">
|
|
1291
1527
|
<div class="ee-message-meta-row">
|
|
1292
1528
|
<span class="ee-message-meta-label">From:</span>
|
|
1293
|
-
${msg.from ? `${msg.from.name || ''} <${msg.from.address}>` : 'Unknown'}
|
|
1529
|
+
${msg.from ? `${this.escapeHtml(msg.from.name || '')} <${this.escapeHtml(msg.from.address)}>` : 'Unknown'}
|
|
1294
1530
|
</div>
|
|
1295
1531
|
<div class="ee-message-meta-row">
|
|
1296
1532
|
<span class="ee-message-meta-label">To:</span>
|
|
1297
|
-
${msg.to ? msg.to.map(t => `${t.name || ''} <${t.address}>`).join(', ') : ''}
|
|
1533
|
+
${msg.to ? msg.to.map(t => `${this.escapeHtml(t.name || '')} <${this.escapeHtml(t.address)}>`).join(', ') : ''}
|
|
1298
1534
|
</div>
|
|
1299
1535
|
${
|
|
1300
1536
|
msg.cc && msg.cc.length
|
|
1301
1537
|
? `
|
|
1302
1538
|
<div class="ee-message-meta-row">
|
|
1303
1539
|
<span class="ee-message-meta-label">Cc:</span>
|
|
1304
|
-
${msg.cc.map(c => `${c.name || ''} <${c.address}>`).join(', ')}
|
|
1540
|
+
${msg.cc.map(c => `${this.escapeHtml(c.name || '')} <${this.escapeHtml(c.address)}>`).join(', ')}
|
|
1305
1541
|
</div>
|
|
1306
1542
|
`
|
|
1307
1543
|
: ''
|
|
@@ -1312,11 +1548,11 @@ export class EmailEngineClient {
|
|
|
1312
1548
|
</div>
|
|
1313
1549
|
<div class="ee-message-meta-row">
|
|
1314
1550
|
<span class="ee-message-meta-label">Subject:</span>
|
|
1315
|
-
${msg.subject || '(no subject)'}
|
|
1551
|
+
${this.escapeHtml(msg.subject || '(no subject)')}
|
|
1316
1552
|
</div>
|
|
1317
1553
|
</div>
|
|
1318
1554
|
<div class="ee-message-body">
|
|
1319
|
-
${msg.text && msg.text.html ? msg.text.html : msg.text && msg.text.plain ? `<pre>${msg.text.plain}</pre>` : ''}
|
|
1555
|
+
${msg.text && msg.text.html ? msg.text.html : msg.text && msg.text.plain ? `<pre>${this.escapeHtml(msg.text.plain)}</pre>` : ''}
|
|
1320
1556
|
</div>
|
|
1321
1557
|
${
|
|
1322
1558
|
msg.attachments && msg.attachments.length > 0
|
|
@@ -1326,10 +1562,10 @@ export class EmailEngineClient {
|
|
|
1326
1562
|
${msg.attachments
|
|
1327
1563
|
.map(
|
|
1328
1564
|
att => `
|
|
1329
|
-
<div class="ee-attachment-item" data-attachment-id="${att.id}">
|
|
1565
|
+
<div class="ee-attachment-item" data-attachment-id="${this.escapeHtml(att.id)}">
|
|
1330
1566
|
<div class="ee-attachment-icon">📎</div>
|
|
1331
1567
|
<div class="ee-attachment-info">
|
|
1332
|
-
<div class="ee-attachment-name">${att.filename || 'Unnamed attachment'}</div>
|
|
1568
|
+
<div class="ee-attachment-name">${this.escapeHtml(att.filename || 'Unnamed attachment')}</div>
|
|
1333
1569
|
${att.size ? `<div class="ee-attachment-size">${this.formatFileSize(att.size)}</div>` : ''}
|
|
1334
1570
|
</div>
|
|
1335
1571
|
</div>
|
|
@@ -1381,11 +1617,7 @@ export class EmailEngineClient {
|
|
|
1381
1617
|
});
|
|
1382
1618
|
});
|
|
1383
1619
|
|
|
1384
|
-
//
|
|
1385
|
-
const messageContent = viewer.querySelector('.ee-message-content');
|
|
1386
|
-
if (messageContent) {
|
|
1387
|
-
messageContent.scrollTop = 0;
|
|
1388
|
-
}
|
|
1620
|
+
// Message content scrolling is now handled in loadMessage method
|
|
1389
1621
|
}
|
|
1390
1622
|
|
|
1391
1623
|
createLayout() {
|
|
@@ -1394,7 +1626,10 @@ export class EmailEngineClient {
|
|
|
1394
1626
|
}
|
|
1395
1627
|
|
|
1396
1628
|
this.container.innerHTML = `
|
|
1397
|
-
<div class="ee-client">
|
|
1629
|
+
<div class="ee-client${this.darkMode ? ' ee-dark-mode' : ''}">
|
|
1630
|
+
<button class="ee-dark-mode-toggle" title="Toggle dark mode">
|
|
1631
|
+
<span class="ee-dark-mode-icon">${this.darkMode ? '☀️' : '🌙'}</span>
|
|
1632
|
+
</button>
|
|
1398
1633
|
<div class="ee-sidebar">
|
|
1399
1634
|
<div class="ee-pane-header">
|
|
1400
1635
|
<span class="ee-pane-title">Folders</span>
|
|
@@ -1626,6 +1861,13 @@ export class EmailEngineClient {
|
|
|
1626
1861
|
|
|
1627
1862
|
this.createStyles();
|
|
1628
1863
|
this.createLayout();
|
|
1864
|
+
|
|
1865
|
+
// Set up dark mode toggle
|
|
1866
|
+
const toggleBtn = this.container.querySelector('.ee-dark-mode-toggle');
|
|
1867
|
+
if (toggleBtn) {
|
|
1868
|
+
toggleBtn.addEventListener('click', () => this.toggleDarkMode());
|
|
1869
|
+
}
|
|
1870
|
+
|
|
1629
1871
|
this.loadFolders()
|
|
1630
1872
|
.then(() => {
|
|
1631
1873
|
const inbox =
|
|
@@ -1678,6 +1920,31 @@ export class EmailEngineClient {
|
|
|
1678
1920
|
}
|
|
1679
1921
|
}
|
|
1680
1922
|
|
|
1923
|
+
toggleDarkMode() {
|
|
1924
|
+
this.darkMode = !this.darkMode;
|
|
1925
|
+
|
|
1926
|
+
// Save preference
|
|
1927
|
+
if (typeof window !== 'undefined' && window.localStorage) {
|
|
1928
|
+
localStorage.setItem('ee-client-dark-mode', this.darkMode.toString());
|
|
1929
|
+
}
|
|
1930
|
+
|
|
1931
|
+
// Update UI
|
|
1932
|
+
const client = this.container.querySelector('.ee-client');
|
|
1933
|
+
if (client) {
|
|
1934
|
+
if (this.darkMode) {
|
|
1935
|
+
client.classList.add('ee-dark-mode');
|
|
1936
|
+
} else {
|
|
1937
|
+
client.classList.remove('ee-dark-mode');
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
|
|
1941
|
+
// Update toggle button icon
|
|
1942
|
+
const icon = this.container.querySelector('.ee-dark-mode-icon');
|
|
1943
|
+
if (icon) {
|
|
1944
|
+
icon.textContent = this.darkMode ? '☀️' : '🌙';
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1947
|
+
|
|
1681
1948
|
destroy() {
|
|
1682
1949
|
// Clean up keep-alive timer
|
|
1683
1950
|
if (this.keepAliveTimer) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@postalsys/ee-client",
|
|
3
|
-
"version": "1.2
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "EmailEngine client library for browser and Node.js applications",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
"lint": "eslint *.js",
|
|
17
17
|
"format": "prettier --write *.js *.json *.md",
|
|
18
18
|
"format:check": "prettier --check *.js *.json *.md",
|
|
19
|
+
"test": "npm run lint && npm run format:check",
|
|
20
|
+
"update": "rm -rf node_modules package-lock.json && ncu -u && npm install",
|
|
19
21
|
"prepublishOnly": "npm run lint && npm run format:check"
|
|
20
22
|
},
|
|
21
23
|
"keywords": [
|