@nodestackapp/server 1.3.0 → 2.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.
- package/LICENSE +15 -0
- package/README.md +10 -10
- package/dist/NodeStack.d.ts +5 -0
- package/dist/NodeStack.d.ts.map +1 -1
- package/dist/NodeStack.js +19 -1
- package/dist/NodeStack.js.map +1 -1
- package/dist/admin/AdminUIBundler.d.ts.map +1 -1
- package/dist/admin/AdminUIBundler.js +1 -0
- package/dist/admin/AdminUIBundler.js.map +1 -1
- package/dist/admin/ui/css/analytics.css +68 -11
- package/dist/admin/ui/css/main.css +2189 -2015
- package/dist/admin/ui/css/rules.css +292 -264
- package/dist/admin/ui/css/webhooks.css +34 -10
- package/dist/admin/ui/index.html +10434 -9850
- package/dist/admin/ui/js/analytics.js +673 -624
- package/dist/admin/ui/js/api.js +16 -0
- package/dist/admin/ui/js/app.js +9 -18
- package/dist/admin/ui/js/apps.js +24 -6
- package/dist/admin/ui/js/collections.js +3 -4
- package/dist/admin/ui/js/command-palette.js +49 -18
- package/dist/admin/ui/js/demo.js +373 -271
- package/dist/admin/ui/js/modals.js +14 -14
- package/dist/admin/ui/js/plugin-tester.js +6 -6
- package/dist/admin/ui/js/plugins.js +31 -21
- package/dist/admin/ui/js/records.js +9 -9
- package/dist/admin/ui/js/rules.js +1 -1
- package/dist/admin/ui/js/theme.js +120 -0
- package/dist/admin/ui/js/views.js +632 -714
- package/dist/admin/ui/js/webhooks.js +27 -9
- package/dist/apps/AppScope.d.ts +2 -0
- package/dist/apps/AppScope.d.ts.map +1 -1
- package/dist/apps/AppScope.js +7 -3
- package/dist/apps/AppScope.js.map +1 -1
- package/dist/auth/AuthService.d.ts.map +1 -1
- package/dist/auth/AuthService.js +36 -9
- package/dist/auth/AuthService.js.map +1 -1
- package/dist/cli/cli.d.ts.map +1 -1
- package/dist/cli/cli.js +65 -1
- package/dist/cli/cli.js.map +1 -1
- package/dist/core/config/ConfigService.d.ts +1 -0
- package/dist/core/config/ConfigService.d.ts.map +1 -1
- package/dist/core/config/ConfigService.js +4 -1
- package/dist/core/config/ConfigService.js.map +1 -1
- package/dist/core/container/Tokens.d.ts +2 -0
- package/dist/core/container/Tokens.d.ts.map +1 -1
- package/dist/core/container/Tokens.js +2 -0
- package/dist/core/container/Tokens.js.map +1 -1
- package/dist/database/migrations/SystemMigrations.js +1 -1
- package/dist/database/migrations/SystemMigrations.js.map +1 -1
- package/dist/demo/DemoService.d.ts +15 -103
- package/dist/demo/DemoService.d.ts.map +1 -1
- package/dist/demo/DemoService.js +14 -419
- package/dist/demo/DemoService.js.map +1 -1
- package/dist/http/HttpServer.d.ts +3 -1
- package/dist/http/HttpServer.d.ts.map +1 -1
- package/dist/http/HttpServer.js +43 -8
- package/dist/http/HttpServer.js.map +1 -1
- package/dist/http/controllers/DemoController.d.ts.map +1 -1
- package/dist/http/controllers/DemoController.js +1 -0
- package/dist/http/controllers/DemoController.js.map +1 -1
- package/dist/http/controllers/HealthController.js +2 -2
- package/dist/http/controllers/SnapshotController.d.ts +58 -0
- package/dist/http/controllers/SnapshotController.d.ts.map +1 -0
- package/dist/http/controllers/SnapshotController.js +79 -0
- package/dist/http/controllers/SnapshotController.js.map +1 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/records/QueryFilterParser.d.ts.map +1 -1
- package/dist/records/QueryFilterParser.js +2 -1
- package/dist/records/QueryFilterParser.js.map +1 -1
- package/dist/records/RecordService.d.ts.map +1 -1
- package/dist/records/RecordService.js +32 -14
- package/dist/records/RecordService.js.map +1 -1
- package/dist/rules/RuleEngine.d.ts +14 -0
- package/dist/rules/RuleEngine.d.ts.map +1 -1
- package/dist/rules/RuleEngine.js +144 -1
- package/dist/rules/RuleEngine.js.map +1 -1
- package/dist/schema/OpenApiGenerator.js +3 -3
- package/dist/snapshots/SnapshotService.d.ts +75 -0
- package/dist/snapshots/SnapshotService.d.ts.map +1 -0
- package/dist/snapshots/SnapshotService.js +775 -0
- package/dist/snapshots/SnapshotService.js.map +1 -0
- package/dist/snapshots/types.d.ts +63 -0
- package/dist/snapshots/types.d.ts.map +1 -0
- package/dist/snapshots/types.js +5 -0
- package/dist/snapshots/types.js.map +1 -0
- package/dist/templates/definitions/ecommerce.js +13 -13
- package/dist/templates/definitions/ecommerce.js.map +1 -1
- package/dist/webhooks/WebhookService.js +1 -1
- package/package.json +88 -88
|
@@ -600,19 +600,19 @@
|
|
|
600
600
|
</div>
|
|
601
601
|
<div class="modal-body">
|
|
602
602
|
<div style="background: rgba(59, 130, 246, 0.08); border: 1px solid rgba(59, 130, 246, 0.25); border-radius: 8px; padding: 0.75rem 0.9rem; margin-bottom: 1.25rem;">
|
|
603
|
-
<div style="font-weight: 600; font-size: 11px; color:
|
|
603
|
+
<div style="font-weight: 600; font-size: 11px; color: var(--accent-primary); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem;">Or Start Fast With:</div>
|
|
604
604
|
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 8px;">
|
|
605
605
|
<button type="button" class="btn btn-secondary btn-sm" onclick="openTemplatesModal()" style="display: flex; align-items: center; justify-content: flex-start; gap: 8px; padding: 7px 10px; border-color: rgba(147, 197, 253, 0.25); text-align: left;">
|
|
606
606
|
<span style="font-size: 16px;">✨</span>
|
|
607
607
|
<div>
|
|
608
|
-
<div style="font-weight: 600; font-size: 12px; color:
|
|
608
|
+
<div style="font-weight: 600; font-size: 12px; color: var(--text-heading);">Starter Templates</div>
|
|
609
609
|
<div style="font-size: 10px; color: var(--text-muted);">E-Commerce, Blog, CRM</div>
|
|
610
610
|
</div>
|
|
611
611
|
</button>
|
|
612
612
|
<button type="button" class="btn btn-secondary btn-sm" onclick="openImportJsonModal()" style="display: flex; align-items: center; justify-content: flex-start; gap: 8px; padding: 7px 10px; border-color: rgba(147, 197, 253, 0.25); text-align: left;">
|
|
613
613
|
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="color:#60a5fa;"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>
|
|
614
614
|
<div>
|
|
615
|
-
<div style="font-weight: 600; font-size: 12px; color:
|
|
615
|
+
<div style="font-weight: 600; font-size: 12px; color: var(--text-heading);">Paste JSON → Instant API</div>
|
|
616
616
|
<div style="font-size: 10px; color: var(--text-muted);">Auto-infer schema in 1 second</div>
|
|
617
617
|
</div>
|
|
618
618
|
</button>
|
|
@@ -989,7 +989,7 @@
|
|
|
989
989
|
previewContainer.innerHTML = `
|
|
990
990
|
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:0.75rem; border-bottom:1px solid var(--border-subtle); padding-bottom:0.5rem;">
|
|
991
991
|
<div style="display:flex; align-items:center; gap:8px;">
|
|
992
|
-
<span style="font-weight:700; font-size:13px; color
|
|
992
|
+
<span style="font-weight:700; font-size:13px; color: var(--text-heading);">✓ ${parsedRecords.length} record${parsedRecords.length === 1 ? '' : 's'} detected</span>
|
|
993
993
|
<span class="badge badge-get" style="font-size:11px;">${inferredFields.length} columns inferred</span>
|
|
994
994
|
</div>
|
|
995
995
|
<span style="font-size:11px; color:var(--text-muted);">Instant SQLite columns</span>
|
|
@@ -999,7 +999,7 @@
|
|
|
999
999
|
${inferredFields.map((f, idx) => `
|
|
1000
1000
|
<div style="display:flex; align-items:center; justify-content:space-between; background:var(--bg-card); padding:6px 10px; border-radius:6px; border:1px solid var(--border-subtle); font-size:12px;">
|
|
1001
1001
|
<div style="display:flex; align-items:center; gap:8px; min-width:140px;">
|
|
1002
|
-
<span style="font-family:monospace; font-weight:600; color
|
|
1002
|
+
<span style="font-family:monospace; font-weight:600; color: var(--text-heading);">${f.name}</span>
|
|
1003
1003
|
${f.originalKey !== f.name ? `<span style="font-size:10px; color:var(--text-muted); font-family:monospace;">(from "${f.originalKey}")</span>` : ''}
|
|
1004
1004
|
</div>
|
|
1005
1005
|
<div style="display:flex; align-items:center; gap:8px;">
|
|
@@ -1023,7 +1023,7 @@
|
|
|
1023
1023
|
<div style="background:rgba(0,0,0,0.25); border:1px solid rgba(59,130,246,0.2); border-radius:6px; padding:6px 10px; font-size:11px; color:var(--text-muted); display:flex; justify-content:space-between; align-items:center;">
|
|
1024
1024
|
<div>
|
|
1025
1025
|
<span style="color:#60a5fa; font-weight:600;">REST API ready:</span>
|
|
1026
|
-
<code style="margin-left:6px; color
|
|
1026
|
+
<code style="margin-left:6px; color: var(--text-heading);">GET /api/collections/${colName}/records</code>
|
|
1027
1027
|
</div>
|
|
1028
1028
|
<span style="font-size:10px; color:#34d399;">● Full CRUD + Realtime + Docs</span>
|
|
1029
1029
|
</div>
|
|
@@ -2052,9 +2052,9 @@
|
|
|
2052
2052
|
<div>
|
|
2053
2053
|
<div style="display:flex; align-items:center; justify-content:space-between; margin-bottom:0.6rem;">
|
|
2054
2054
|
<span style="font-size:24px;">${t.icon}</span>
|
|
2055
|
-
<span class="badge" style="background:
|
|
2055
|
+
<span class="badge" style="background:var(--bg-hover-subtle); border-color:rgba(255,255,255,0.15); font-size:11px; color: var(--text-heading);">${t.badge}</span>
|
|
2056
2056
|
</div>
|
|
2057
|
-
<h3 style="font-size:16px; font-weight:700; margin-bottom:0.3rem; color
|
|
2057
|
+
<h3 style="font-size:16px; font-weight:700; margin-bottom:0.3rem; color: var(--text-heading);">${t.name}</h3>
|
|
2058
2058
|
<p style="font-size:12px; color:var(--text-muted); line-height:1.4; margin-bottom:0.75rem;">${t.description}</p>
|
|
2059
2059
|
|
|
2060
2060
|
<div style="background:var(--bg-card); border:1px solid var(--border-subtle); border-radius:6px; padding:0.6rem; margin-bottom:0.5rem;">
|
|
@@ -2149,7 +2149,7 @@
|
|
|
2149
2149
|
${t.icon}
|
|
2150
2150
|
</div>
|
|
2151
2151
|
<div>
|
|
2152
|
-
<h2 class="modal-title" style="font-size: 16px; margin: 0; color:
|
|
2152
|
+
<h2 class="modal-title" style="font-size: 16px; margin: 0; color: var(--text-heading);">Confirm Template Launch: ${t.name}</h2>
|
|
2153
2153
|
<span style="font-size: 11px; color: var(--text-muted);">${t.badge}</span>
|
|
2154
2154
|
</div>
|
|
2155
2155
|
</div>
|
|
@@ -2169,14 +2169,14 @@
|
|
|
2169
2169
|
${t.collections.map(c => `
|
|
2170
2170
|
<div style="display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; font-size: 12px; border-bottom: 1px solid rgba(255,255,255,0.04); padding-bottom: 0.35rem;">
|
|
2171
2171
|
<div>
|
|
2172
|
-
<strong style="color:
|
|
2172
|
+
<strong style="color: var(--text-heading); font-family: var(--font-mono);">${c.name}</strong>
|
|
2173
2173
|
<span style="color: var(--text-muted); font-size: 11px; margin-left: 6px;">(${c.desc})</span>
|
|
2174
2174
|
</div>
|
|
2175
2175
|
<span class="badge badge-get" style="font-size: 10px; flex-shrink: 0;">${c.count} records</span>
|
|
2176
2176
|
</div>
|
|
2177
2177
|
`).join('')}
|
|
2178
2178
|
</div>
|
|
2179
|
-
<div style="margin-top: 0.6rem; font-size: 11px; color:
|
|
2179
|
+
<div style="margin-top: 0.6rem; font-size: 11px; color: var(--accent-primary);">
|
|
2180
2180
|
✨ ${t.stats}
|
|
2181
2181
|
</div>
|
|
2182
2182
|
</div>
|
|
@@ -2187,7 +2187,7 @@
|
|
|
2187
2187
|
⚠️ Existing Collections Detected
|
|
2188
2188
|
</div>
|
|
2189
2189
|
<div style="font-size: 12px; color: #cbd5e1; line-height: 1.4;">
|
|
2190
|
-
The following collection(s) already exist: <strong style="color
|
|
2190
|
+
The following collection(s) already exist: <strong style="color: var(--text-heading);">${existingMatches.map(m => m.name).join(', ')}</strong>.
|
|
2191
2191
|
</div>
|
|
2192
2192
|
</div>
|
|
2193
2193
|
` : ''}
|
|
@@ -2196,7 +2196,7 @@
|
|
|
2196
2196
|
<label style="display: flex; align-items: flex-start; gap: 0.6rem; font-size: 12px; color: var(--text-main); cursor: pointer;">
|
|
2197
2197
|
<input type="checkbox" id="confirm-template-overwrite" style="margin-top: 2px;">
|
|
2198
2198
|
<div>
|
|
2199
|
-
<strong style="color:
|
|
2199
|
+
<strong style="color: var(--text-heading);">Overwrite existing collections if they match</strong>
|
|
2200
2200
|
<div style="font-size: 11px; color: var(--text-muted); margin-top: 2px;">
|
|
2201
2201
|
If checked, matching tables and their records will be overwritten with the template data.
|
|
2202
2202
|
</div>
|
|
@@ -2288,7 +2288,7 @@
|
|
|
2288
2288
|
</div>
|
|
2289
2289
|
<div class="modal-body" style="padding:1.25rem; display:flex; flex-direction:column; gap:1rem;">
|
|
2290
2290
|
<p style="font-size:13px; color:#cbd5e1; line-height:1.5; margin:0;">
|
|
2291
|
-
Are you sure you want to permanently delete the collection <strong style="color
|
|
2291
|
+
Are you sure you want to permanently delete the collection <strong style="color: var(--text-heading); font-family:var(--font-mono);">${col.name}</strong>?
|
|
2292
2292
|
</p>
|
|
2293
2293
|
<div style="background:rgba(239, 68, 68, 0.08); border:1px solid rgba(239, 68, 68, 0.25); border-radius:6px; padding:0.75rem; font-size:12px; color:#fca5a5; line-height:1.4;">
|
|
2294
2294
|
This will drop the SQLite table <strong style="font-family:var(--font-mono);">${col.name}</strong>, remove all schema definitions, and permanently erase all stored records and file assets.
|
|
@@ -42,7 +42,7 @@ function openPluginTesterDrawer(pluginId) {
|
|
|
42
42
|
<div>Live Stripe Secret Key (<code>sk_live_...</code>) is configured. Creating checkout sessions will initiate REAL credit card transactions and monetary deductions!</div>
|
|
43
43
|
</div>
|
|
44
44
|
` : `
|
|
45
|
-
<div style="background: rgba(59, 130, 246, 0.1); border: 1px solid rgba(59, 130, 246, 0.25); border-radius: 6px; padding: 0.5rem 0.75rem; margin-bottom: 0.85rem; color:
|
|
45
|
+
<div style="background: rgba(59, 130, 246, 0.1); border: 1px solid rgba(59, 130, 246, 0.25); border-radius: 6px; padding: 0.5rem 0.75rem; margin-bottom: 0.85rem; color: var(--accent-primary); font-size: 11px;">
|
|
46
46
|
🛡️ <strong>Test Mode Active:</strong> Using Stripe test credentials (<code>sk_test_...</code>). Simulated charges will not debit real payment cards.
|
|
47
47
|
</div>
|
|
48
48
|
`}
|
|
@@ -206,7 +206,7 @@ function openPluginTesterDrawer(pluginId) {
|
|
|
206
206
|
<div class="drawer-section-title">Plugin Workbench</div>
|
|
207
207
|
<div class="drawer-card">
|
|
208
208
|
<div style="font-size: 12.5px; color: var(--text-muted);">
|
|
209
|
-
Custom registered plugin: <code style="color:
|
|
209
|
+
Custom registered plugin: <code style="color: var(--accent-primary);">${escapeHtml(cleanId)}</code>
|
|
210
210
|
</div>
|
|
211
211
|
<button class="btn btn-primary btn-sm" onclick="checkPluginTesterStatus('${escapeHtml(cleanId)}')" style="margin-top: 4px;">
|
|
212
212
|
Check Extension Status
|
|
@@ -227,7 +227,7 @@ function openPluginTesterDrawer(pluginId) {
|
|
|
227
227
|
);
|
|
228
228
|
const isUnconfigured = activePluginNavItem && (activePluginNavItem.badge === 'UNCONFIGURED' || activePluginNavItem.badgeVariant === 'warning');
|
|
229
229
|
const statusBadgeHtml = isUnconfigured
|
|
230
|
-
? `<span class="badge badge-warning" style="font-size: 10px;
|
|
230
|
+
? `<span class="badge badge-warning" style="font-size: 10px;">● UNCONFIGURED</span>`
|
|
231
231
|
: `<span class="badge badge-success" style="font-size: 10px;">● ACTIVE</span>`;
|
|
232
232
|
|
|
233
233
|
root.innerHTML = `
|
|
@@ -328,7 +328,7 @@ async function executePluginTest(actionFn) {
|
|
|
328
328
|
const output = document.getElementById('plugin-tester-output');
|
|
329
329
|
if (badge) {
|
|
330
330
|
badge.textContent = 'Status: Executing...';
|
|
331
|
-
badge.style.color = '
|
|
331
|
+
badge.style.color = 'var(--accent-primary)';
|
|
332
332
|
}
|
|
333
333
|
if (output) output.textContent = '// Sending request...';
|
|
334
334
|
const start = performance.now();
|
|
@@ -338,7 +338,7 @@ async function executePluginTest(actionFn) {
|
|
|
338
338
|
if (latency) latency.textContent = `${duration}ms`;
|
|
339
339
|
if (badge) {
|
|
340
340
|
badge.textContent = 'Status: 200 OK';
|
|
341
|
-
badge.style.color = '
|
|
341
|
+
badge.style.color = 'var(--accent-success)';
|
|
342
342
|
}
|
|
343
343
|
if (output) output.textContent = JSON.stringify(data, null, 2);
|
|
344
344
|
toast('Action completed successfully!', 'success');
|
|
@@ -347,7 +347,7 @@ async function executePluginTest(actionFn) {
|
|
|
347
347
|
if (latency) latency.textContent = `${duration}ms`;
|
|
348
348
|
if (badge) {
|
|
349
349
|
badge.textContent = `Status: ${err.status ? err.status + ' Error' : 'Error'}`;
|
|
350
|
-
badge.style.color = '
|
|
350
|
+
badge.style.color = 'var(--accent-danger)';
|
|
351
351
|
}
|
|
352
352
|
const errPayload = err.data || { error: err.message };
|
|
353
353
|
if (output) output.textContent = JSON.stringify(errPayload, null, 2);
|
|
@@ -15,6 +15,16 @@ function renderPluginNavItems() {
|
|
|
15
15
|
railCount.textContent = String(items.length);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
const homePlugEl = document.getElementById('home-stat-plugins');
|
|
19
|
+
const homePlugSubEl = document.getElementById('home-stat-plugins-sub');
|
|
20
|
+
if (homePlugEl) {
|
|
21
|
+
homePlugEl.textContent = String(items.length);
|
|
22
|
+
}
|
|
23
|
+
if (homePlugSubEl) {
|
|
24
|
+
const catalogCount = (state.pluginCatalog && state.pluginCatalog.length) || 5;
|
|
25
|
+
homePlugSubEl.textContent = `${items.length} active / ${catalogCount} available`;
|
|
26
|
+
}
|
|
27
|
+
|
|
18
28
|
if (!group || !container) return;
|
|
19
29
|
|
|
20
30
|
if (items.length === 0) {
|
|
@@ -95,11 +105,11 @@ function renderPluginView(item) {
|
|
|
95
105
|
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.75rem;">
|
|
96
106
|
<div style="background: rgba(0,0,0,0.2); padding: 0.65rem 0.85rem; border-radius: 6px; border: 1px solid rgba(255,255,255,0.04);">
|
|
97
107
|
<div style="font-size: 11px; color: var(--text-muted);">Plugin ID</div>
|
|
98
|
-
<div style="font-size: 13px; font-weight: 600; color:
|
|
108
|
+
<div style="font-size: 13px; font-weight: 600; color: var(--accent-primary); font-family: monospace;">${escapeHtml(item.id)}</div>
|
|
99
109
|
</div>
|
|
100
110
|
<div style="background: rgba(0,0,0,0.2); padding: 0.65rem 0.85rem; border-radius: 6px; border: 1px solid rgba(255,255,255,0.04);">
|
|
101
111
|
<div style="font-size: 11px; color: var(--text-muted);">Lifecycle State</div>
|
|
102
|
-
<div style="font-size: 13px; font-weight: 600; color:
|
|
112
|
+
<div style="font-size: 13px; font-weight: 600; color: var(--accent-success);">Active & Mounted</div>
|
|
103
113
|
</div>
|
|
104
114
|
</div>
|
|
105
115
|
</div>
|
|
@@ -110,12 +120,12 @@ function renderPluginView(item) {
|
|
|
110
120
|
<div id="plugin-overview-card-${escapeHtml(item.id)}" style="background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 10px; padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem;">
|
|
111
121
|
<div style="display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem;">
|
|
112
122
|
<div style="display: flex; align-items: center; gap: 0.75rem;">
|
|
113
|
-
<div style="width: 40px; height: 40px; border-radius: 10px; background:
|
|
123
|
+
<div style="width: 40px; height: 40px; border-radius: 10px; background: var(--bg-main); border: 1px solid rgba(59, 130, 246, 0.4); display: flex; align-items: center; justify-content: center; flex-shrink: 0;">
|
|
114
124
|
<span style="font-size: 20px;">🧩</span>
|
|
115
125
|
</div>
|
|
116
126
|
<div>
|
|
117
127
|
<div style="display: flex; align-items: center; gap: 8px;">
|
|
118
|
-
<span id="plugin-overview-title-${escapeHtml(item.id)}" style="font-weight: 800; font-size: 16px; color:
|
|
128
|
+
<span id="plugin-overview-title-${escapeHtml(item.id)}" style="font-weight: 800; font-size: 16px; color: var(--text-heading);">${escapeHtml(title)}</span>
|
|
119
129
|
<span id="plugin-overview-badge-${escapeHtml(item.id)}">${item.badge ? `<span class="badge ${item.badgeVariant ? 'badge-' + item.badgeVariant : 'badge-get'}">${escapeHtml(item.badge)}</span>` : ''}</span>
|
|
120
130
|
</div>
|
|
121
131
|
<div id="plugin-overview-desc-${escapeHtml(item.id)}" style="font-size: 12px; color: var(--text-muted); margin-top: 2px;">
|
|
@@ -206,11 +216,11 @@ function syncPluginOverview(pluginId, fields) {
|
|
|
206
216
|
</div>
|
|
207
217
|
<div style="background: var(--bg-input); border: 1px solid var(--border-subtle); border-radius: 8px; padding: 0.85rem 1rem;">
|
|
208
218
|
<div style="font-size: 11px; color: var(--text-muted); text-transform: uppercase;">Region</div>
|
|
209
|
-
<div style="font-size: 13px; font-weight: 700; color:
|
|
219
|
+
<div style="font-size: 13px; font-weight: 700; color: var(--accent-success); font-family: monospace; margin-top: 4px;">${escapeHtml(curRegion)}</div>
|
|
210
220
|
</div>
|
|
211
221
|
<div style="background: var(--bg-input); border: 1px solid var(--border-subtle); border-radius: 8px; padding: 0.85rem 1rem;">
|
|
212
222
|
<div style="font-size: 11px; color: var(--text-muted); text-transform: uppercase;">Tracking Collection</div>
|
|
213
|
-
<div style="font-size: 13px; font-weight: 700; color:
|
|
223
|
+
<div style="font-size: 13px; font-weight: 700; color: var(--accent-warning); font-family: monospace; margin-top: 4px;">_s3_uploads</div>
|
|
214
224
|
</div>
|
|
215
225
|
</div>
|
|
216
226
|
`;
|
|
@@ -296,7 +306,7 @@ async function loadPluginConfig(pluginId) {
|
|
|
296
306
|
<div style="display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; border-bottom: 1px solid var(--border-subtle); padding-bottom: 0.85rem;">
|
|
297
307
|
<div>
|
|
298
308
|
<div style="display: flex; align-items: center; gap: 8px;">
|
|
299
|
-
<span style="font-weight: 800; font-size: 15px; color:
|
|
309
|
+
<span style="font-weight: 800; font-size: 15px; color: var(--text-heading);">⚙️ Configuration & Credentials</span>
|
|
300
310
|
<span class="badge badge-info" style="font-size: 10.5px;">Option B Precedence</span>
|
|
301
311
|
</div>
|
|
302
312
|
<div style="font-size: 12px; color: var(--text-muted); margin-top: 3px;">
|
|
@@ -304,8 +314,8 @@ async function loadPluginConfig(pluginId) {
|
|
|
304
314
|
</div>
|
|
305
315
|
</div>
|
|
306
316
|
<div style="display: flex; align-items: center; gap: 0.5rem; font-size: 11.5px;">
|
|
307
|
-
<span class="badge
|
|
308
|
-
<span class="badge
|
|
317
|
+
<span class="badge badge-secondary">🔒 ${lockedCount} Locked</span>
|
|
318
|
+
<span class="badge badge-success">✏️ ${editableCount} Editable</span>
|
|
309
319
|
</div>
|
|
310
320
|
</div>
|
|
311
321
|
|
|
@@ -316,19 +326,19 @@ async function loadPluginConfig(pluginId) {
|
|
|
316
326
|
return `
|
|
317
327
|
<div style="background: var(--bg-input); border: 1px solid ${isLocked ? 'rgba(255,255,255,0.06)' : 'var(--border-subtle)'}; border-radius: 8px; padding: 0.85rem 1rem; display: flex; flex-direction: column; gap: 0.45rem;">
|
|
318
328
|
<div style="display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;">
|
|
319
|
-
<label style="font-size: 12.5px; font-weight: 700; color:
|
|
329
|
+
<label style="font-size: 12.5px; font-weight: 700; color: var(--text-heading);" for="${fieldId}">
|
|
320
330
|
${escapeHtml(field.label)} ${field.required ? '<span style="color:#ef4444;">*</span>' : ''}
|
|
321
331
|
</label>
|
|
322
332
|
${isLocked ? `
|
|
323
|
-
<span class="badge" style="
|
|
333
|
+
<span class="badge badge-secondary" style="font-size: 10px; padding: 2px 6px;" title="${escapeHtml(field.lockReason || 'Locked')}">
|
|
324
334
|
🔒 ENV LOCKED
|
|
325
335
|
</span>
|
|
326
336
|
` : (field.source === 'db' ? `
|
|
327
|
-
<span class="badge" style="
|
|
337
|
+
<span class="badge badge-success" style="font-size: 10px; padding: 2px 6px;">
|
|
328
338
|
✏️ DATABASE OVERRIDE
|
|
329
339
|
</span>
|
|
330
340
|
` : `
|
|
331
|
-
<span class="badge" style="
|
|
341
|
+
<span class="badge badge-primary" style="font-size: 10px; padding: 2px 6px;">
|
|
332
342
|
✏️ ${field.source === 'code' ? 'CODE DEFAULT' : 'DEFAULT'}
|
|
333
343
|
</span>
|
|
334
344
|
`)}
|
|
@@ -337,7 +347,7 @@ async function loadPluginConfig(pluginId) {
|
|
|
337
347
|
${isLocked ? `
|
|
338
348
|
${field.type === 'select' ? `
|
|
339
349
|
<select class="form-input" disabled
|
|
340
|
-
style="opacity: 0.7; cursor: not-allowed; background: rgba(0,0,0,0.35); font-size: 12.5px; border-color: rgba(255,255,255,0.06); color:
|
|
350
|
+
style="opacity: 0.7; cursor: not-allowed; background: rgba(0,0,0,0.35); font-size: 12.5px; border-color: rgba(255,255,255,0.06); color: var(--text-heading);">
|
|
341
351
|
${field.value !== undefined && !(field.options || []).some(opt => String(typeof opt === 'object' && opt !== null && 'value' in opt ? opt.value : opt) === String(field.value)) ? `
|
|
342
352
|
<option value="${escapeHtml(String(field.value))}" selected>${escapeHtml(String(field.value))}</option>
|
|
343
353
|
` : ''}
|
|
@@ -358,11 +368,11 @@ async function loadPluginConfig(pluginId) {
|
|
|
358
368
|
` : (field.type === 'boolean' ? `
|
|
359
369
|
<div style="display: flex; align-items: center; gap: 0.5rem; height: 36px;">
|
|
360
370
|
<input type="checkbox" id="${fieldId}" ${field.value ? 'checked' : ''} style="cursor: pointer; width: 18px; height: 18px;" />
|
|
361
|
-
<label for="${fieldId}" style="font-size: 12.5px; color:
|
|
371
|
+
<label for="${fieldId}" style="font-size: 12.5px; color: var(--text-main); cursor: pointer;">Enabled</label>
|
|
362
372
|
</div>
|
|
363
373
|
` : (field.type === 'select' ? `
|
|
364
374
|
<select class="form-input" id="${fieldId}"
|
|
365
|
-
style="cursor: pointer; font-size: 12.5px; background: var(--bg-card); color:
|
|
375
|
+
style="cursor: pointer; font-size: 12.5px; background: var(--bg-card); color: var(--text-heading);">
|
|
366
376
|
${!field.required && !(field.options || []).some(opt => (typeof opt === 'object' && opt !== null && 'value' in opt ? opt.value : opt) === '') ? `
|
|
367
377
|
<option value="" ${field.value === undefined || field.value === '' ? 'selected' : ''}>${escapeHtml(field.placeholder || '-- Select an option --')}</option>
|
|
368
378
|
` : (field.placeholder && (field.value === undefined || field.value === '') ? `
|
|
@@ -381,7 +391,7 @@ async function loadPluginConfig(pluginId) {
|
|
|
381
391
|
autocomplete="new-password"
|
|
382
392
|
style="font-family: monospace; font-size: 12.5px;" />
|
|
383
393
|
${field.hasValue ? `
|
|
384
|
-
<div style="font-size: 10.5px; color:
|
|
394
|
+
<div style="font-size: 10.5px; color: var(--accent-success); display: flex; align-items: center; gap: 4px; margin-top: 2px;">
|
|
385
395
|
<span>✓</span> <span>Secret is configured. Leave blank to keep existing secret.</span>
|
|
386
396
|
</div>
|
|
387
397
|
` : ''}
|
|
@@ -613,7 +623,7 @@ function renderPluginsHubView() {
|
|
|
613
623
|
<div class="hub-hero-banner">
|
|
614
624
|
<div style="display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:0.75rem;">
|
|
615
625
|
<div>
|
|
616
|
-
<h2 style="font-size:18px; font-weight:800; color
|
|
626
|
+
<h2 style="font-size:18px; font-weight:800; color: var(--text-heading); letter-spacing:-0.02em;">Installed Extensions & Plugins Hub</h2>
|
|
617
627
|
<p style="font-size:12px; color:var(--text-muted); margin-top:3px;">
|
|
618
628
|
Modular official plugins extending NodeStack with Stripe payments, S3 cloud storage, Resend emails, Webhooks, and Algolia search.
|
|
619
629
|
</p>
|
|
@@ -626,11 +636,11 @@ function renderPluginsHubView() {
|
|
|
626
636
|
<div class="hub-stats-row" style="margin-top:0.5rem;">
|
|
627
637
|
<div class="hub-stat-card">
|
|
628
638
|
<span style="font-size:11px; font-weight:700; color:var(--text-muted); text-transform:uppercase;">Active Extensions</span>
|
|
629
|
-
<span style="font-size:20px; font-weight:800; color
|
|
639
|
+
<span style="font-size:20px; font-weight:800; color:var(--accent-primary);">${items.length}</span>
|
|
630
640
|
</div>
|
|
631
641
|
<div class="hub-stat-card">
|
|
632
642
|
<span style="font-size:11px; font-weight:700; color:var(--text-muted); text-transform:uppercase;">Architecture</span>
|
|
633
|
-
<span style="font-size:13px; font-weight:700; color
|
|
643
|
+
<span style="font-size:13px; font-weight:700; color:var(--accent-success); margin-top:4px;">app.use(plugin)</span>
|
|
634
644
|
</div>
|
|
635
645
|
<div class="hub-stat-card">
|
|
636
646
|
<span style="font-size:11px; font-weight:700; color:var(--text-muted); text-transform:uppercase;">Official Catalog</span>
|
|
@@ -684,7 +694,7 @@ function renderPluginsHubView() {
|
|
|
684
694
|
` : `
|
|
685
695
|
<div style="background:var(--bg-card); border:1px solid var(--border-subtle); border-radius:10px; padding:1.25rem; text-align:center; color:var(--text-muted); margin-bottom:1.5rem;">
|
|
686
696
|
<div style="font-size:22px; margin-bottom:0.25rem;">🧩</div>
|
|
687
|
-
<div style="font-weight:700; font-size:14px; color
|
|
697
|
+
<div style="font-weight:700; font-size:14px; color: var(--text-heading);">No Extensions Currently Active</div>
|
|
688
698
|
<div style="font-size:12px; margin-top:4px;">Enable any of the official community extensions below with 1-click, or mount custom plugins using <code>app.use(plugin)</code> in code.</div>
|
|
689
699
|
</div>
|
|
690
700
|
`}
|
|
@@ -171,7 +171,7 @@
|
|
|
171
171
|
<span>Export</span>
|
|
172
172
|
<span style="font-size:10px; margin-left:1px; opacity:0.7;">▾</span>
|
|
173
173
|
</button>
|
|
174
|
-
<div id="export-dropdown-menu" style="display:none; position:absolute; right:0; top:calc(100% + 4px); background:var(--bg-card); border:1px solid var(--border-subtle); border-radius:6px; box-shadow:
|
|
174
|
+
<div id="export-dropdown-menu" style="display:none; position:absolute; right:0; top:calc(100% + 4px); background:var(--bg-card); border:1px solid var(--border-subtle); border-radius:6px; box-shadow:var(--shadow-dropdown); min-width:150px; z-index:100; padding:4px 0;">
|
|
175
175
|
<button class="dropdown-menu-item" onclick="exportData('csv')">
|
|
176
176
|
<span style="color:#60a5fa; font-weight:bold;">CSV</span> Export as CSV
|
|
177
177
|
</button>
|
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
<span>Import CSV</span>
|
|
187
187
|
</button>
|
|
188
188
|
|
|
189
|
-
<button class="btn btn-secondary btn-sm" onclick="openMockDataModal()" title="1-Click Generate Mock Data (Built-in Faker Engine)" style="border-color: rgba(96, 165, 250, 0.4); color:
|
|
189
|
+
<button class="btn btn-secondary btn-sm" onclick="openMockDataModal()" title="1-Click Generate Mock Data (Built-in Faker Engine)" style="border-color: rgba(96, 165, 250, 0.4); color: var(--accent-primary);">
|
|
190
190
|
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/></svg>
|
|
191
191
|
<span>Generate Mock Data</span>
|
|
192
192
|
</button>
|
|
@@ -719,7 +719,7 @@
|
|
|
719
719
|
<div class="drawer-field-item">
|
|
720
720
|
<div class="drawer-field-header">
|
|
721
721
|
<span class="drawer-field-name">id</span>
|
|
722
|
-
<span class="badge" style="background:
|
|
722
|
+
<span class="badge" style="background:var(--bg-hover-subtle); color:var(--text-muted);">system</span>
|
|
723
723
|
</div>
|
|
724
724
|
<div class="drawer-field-value" style="display:flex; align-items:center; justify-content:space-between;">
|
|
725
725
|
<span class="id-pill">${safeRecId}</span>
|
|
@@ -730,7 +730,7 @@
|
|
|
730
730
|
<div class="drawer-field-item">
|
|
731
731
|
<div class="drawer-field-header">
|
|
732
732
|
<span class="drawer-field-name">created</span>
|
|
733
|
-
<span class="badge" style="background:
|
|
733
|
+
<span class="badge" style="background:var(--bg-hover-subtle); color:var(--text-muted);">datetime</span>
|
|
734
734
|
</div>
|
|
735
735
|
<div class="drawer-field-value" style="font-size:12px; color:var(--text-muted);">
|
|
736
736
|
${new Date(rec.created).toLocaleString()} <span style="font-family:var(--font-mono); opacity:0.7;">(${escapeHtml(rec.created)})</span>
|
|
@@ -741,7 +741,7 @@
|
|
|
741
741
|
<div class="drawer-field-item">
|
|
742
742
|
<div class="drawer-field-header">
|
|
743
743
|
<span class="drawer-field-name">updated</span>
|
|
744
|
-
<span class="badge" style="background:
|
|
744
|
+
<span class="badge" style="background:var(--bg-hover-subtle); color:var(--text-muted);">datetime</span>
|
|
745
745
|
</div>
|
|
746
746
|
<div class="drawer-field-value" style="font-size:12px; color:var(--text-muted);">
|
|
747
747
|
${new Date(rec.updated).toLocaleString()} <span style="font-family:var(--font-mono); opacity:0.7;">(${escapeHtml(rec.updated)})</span>
|
|
@@ -756,14 +756,14 @@
|
|
|
756
756
|
<span class="badge badge-get">auth</span>
|
|
757
757
|
</div>
|
|
758
758
|
<div class="drawer-field-value" style="display:flex; align-items:center; justify-content:space-between;">
|
|
759
|
-
<span style="font-family:var(--font-mono); color
|
|
759
|
+
<span style="font-family:var(--font-mono); color: var(--accent-primary);">${escapeHtml(rec.email || '—')}</span>
|
|
760
760
|
<button class="btn btn-secondary btn-sm" style="padding:2px 6px; font-size:11px;" data-email="${escapeHtml(rec.email || '')}" onclick="handleDrawerCopyEmail(this)">Copy</button>
|
|
761
761
|
</div>
|
|
762
762
|
</div>
|
|
763
763
|
<div class="drawer-field-item">
|
|
764
764
|
<div class="drawer-field-header">
|
|
765
765
|
<span class="drawer-field-name">verified</span>
|
|
766
|
-
<span class="badge" style="background:
|
|
766
|
+
<span class="badge" style="background:var(--bg-hover-subtle); color:var(--text-muted);">auth</span>
|
|
767
767
|
</div>
|
|
768
768
|
<div class="drawer-field-value">
|
|
769
769
|
<span class="badge ${rec.verified ? 'badge-get' : 'badge-delete'}">${rec.verified ? 'Verified' : 'Unverified'}</span>
|
|
@@ -772,7 +772,7 @@
|
|
|
772
772
|
<div class="drawer-field-item">
|
|
773
773
|
<div class="drawer-field-header">
|
|
774
774
|
<span class="drawer-field-name">emailVisibility</span>
|
|
775
|
-
<span class="badge" style="background:
|
|
775
|
+
<span class="badge" style="background:var(--bg-hover-subtle); color:var(--text-muted);">auth</span>
|
|
776
776
|
</div>
|
|
777
777
|
<div class="drawer-field-value">
|
|
778
778
|
<span class="badge ${rec.emailVisibility ? 'badge-get' : 'badge-delete'}">${rec.emailVisibility ? 'Public' : 'Hidden'}</span>
|
|
@@ -868,7 +868,7 @@
|
|
|
868
868
|
}
|
|
869
869
|
|
|
870
870
|
if (typeof val === 'number' || field.type === 'number') {
|
|
871
|
-
return `<span style="font-family:var(--font-mono); font-weight:600; color
|
|
871
|
+
return `<span style="font-family:var(--font-mono); font-weight:600; color: var(--accent-primary);">${val}</span>`;
|
|
872
872
|
}
|
|
873
873
|
|
|
874
874
|
// Plain text or long text: display full inspection with copy button
|
|
@@ -296,7 +296,7 @@
|
|
|
296
296
|
let badgeHtml = '';
|
|
297
297
|
if (r.mode === 'admin') badgeHtml = '<span class="badge" style="background:rgba(239,68,68,0.18); color:#fca5a5;">🔒 Admin Only</span>';
|
|
298
298
|
else if (r.mode === 'public') badgeHtml = '<span class="badge" style="background:rgba(16,185,129,0.18); color:#6ee7b7;">🌐 Public</span>';
|
|
299
|
-
else if (r.mode === 'auth') badgeHtml = '<span class="badge" style="background:rgba(59,130,246,0.18); color
|
|
299
|
+
else if (r.mode === 'auth') badgeHtml = '<span class="badge" style="background:rgba(59,130,246,0.18); color: var(--accent-primary);">👤 Auth Users</span>';
|
|
300
300
|
else badgeHtml = '<span class="badge" style="background:rgba(245,158,11,0.18); color:#fbbf24;">⚙ Custom Rule</span>';
|
|
301
301
|
|
|
302
302
|
return `
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// ==========================================
|
|
2
|
+
// NodeStack Admin UI - Theme Manager
|
|
3
|
+
// Handles System, Light, and Dark appearance themes
|
|
4
|
+
// with localStorage persistence and OS change detection.
|
|
5
|
+
// ==========================================
|
|
6
|
+
|
|
7
|
+
const ThemeManager = {
|
|
8
|
+
STORAGE_KEY: 'nodestack_theme',
|
|
9
|
+
|
|
10
|
+
getTheme() {
|
|
11
|
+
try {
|
|
12
|
+
const stored = localStorage.getItem(this.STORAGE_KEY);
|
|
13
|
+
if (stored === 'light' || stored === 'dark' || stored === 'system') {
|
|
14
|
+
return stored;
|
|
15
|
+
}
|
|
16
|
+
} catch (e) {}
|
|
17
|
+
return 'system';
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
getSystemPreference() {
|
|
21
|
+
try {
|
|
22
|
+
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
|
23
|
+
return 'dark';
|
|
24
|
+
}
|
|
25
|
+
} catch (e) {}
|
|
26
|
+
return 'light';
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
getEffectiveTheme() {
|
|
30
|
+
const pref = this.getTheme();
|
|
31
|
+
return pref === 'system' ? this.getSystemPreference() : pref;
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
applyTheme(theme) {
|
|
35
|
+
const validTheme = ['system', 'dark', 'light'].includes(theme) ? theme : 'system';
|
|
36
|
+
try {
|
|
37
|
+
localStorage.setItem(this.STORAGE_KEY, validTheme);
|
|
38
|
+
} catch (e) {}
|
|
39
|
+
|
|
40
|
+
const effective = validTheme === 'system' ? this.getSystemPreference() : validTheme;
|
|
41
|
+
const root = document.documentElement;
|
|
42
|
+
|
|
43
|
+
root.classList.remove('dark', 'light');
|
|
44
|
+
root.classList.add(effective);
|
|
45
|
+
root.setAttribute('data-theme', validTheme);
|
|
46
|
+
root.setAttribute('data-color-scheme', effective);
|
|
47
|
+
|
|
48
|
+
this.updateUI(validTheme);
|
|
49
|
+
|
|
50
|
+
// If Analytics view is active, redraw charts with theme-aware colors
|
|
51
|
+
if (typeof renderCurrentAnalyticsView === 'function' && typeof state !== 'undefined' && state && state.activeNav === 'analytics') {
|
|
52
|
+
try {
|
|
53
|
+
renderCurrentAnalyticsView();
|
|
54
|
+
} catch (e) {}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (typeof window !== 'undefined' && window.dispatchEvent) {
|
|
58
|
+
window.dispatchEvent(new CustomEvent('nodestack-theme-changed', {
|
|
59
|
+
detail: { theme: validTheme, effective }
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
updateUI(theme) {
|
|
65
|
+
const currentTheme = theme || this.getTheme();
|
|
66
|
+
const buttons = document.querySelectorAll('.theme-picker-btn');
|
|
67
|
+
buttons.forEach((btn) => {
|
|
68
|
+
const btnTheme = btn.getAttribute('data-theme-value');
|
|
69
|
+
if (btnTheme === currentTheme) {
|
|
70
|
+
btn.classList.add('active');
|
|
71
|
+
btn.setAttribute('aria-pressed', 'true');
|
|
72
|
+
} else {
|
|
73
|
+
btn.classList.remove('active');
|
|
74
|
+
btn.setAttribute('aria-pressed', 'false');
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
init() {
|
|
80
|
+
const currentTheme = this.getTheme();
|
|
81
|
+
this.applyTheme(currentTheme);
|
|
82
|
+
|
|
83
|
+
// Listen for OS system theme changes
|
|
84
|
+
if (typeof window !== 'undefined' && window.matchMedia) {
|
|
85
|
+
const mql = window.matchMedia('(prefers-color-scheme: dark)');
|
|
86
|
+
const handleMediaChange = () => {
|
|
87
|
+
if (this.getTheme() === 'system') {
|
|
88
|
+
this.applyTheme('system');
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
if (typeof mql.addEventListener === 'function') {
|
|
93
|
+
mql.addEventListener('change', handleMediaChange);
|
|
94
|
+
} else if (typeof mql.addListener === 'function') {
|
|
95
|
+
mql.addListener(handleMediaChange);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
this.updateUI(currentTheme);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
// Global shorthand for inline onclick handlers
|
|
104
|
+
function setTheme(theme) {
|
|
105
|
+
ThemeManager.applyTheme(theme);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (typeof window !== 'undefined') {
|
|
109
|
+
window.ThemeManager = ThemeManager;
|
|
110
|
+
window.setTheme = setTheme;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Auto-initialize when DOM is ready
|
|
114
|
+
if (typeof document !== 'undefined') {
|
|
115
|
+
if (document.readyState === 'loading') {
|
|
116
|
+
document.addEventListener('DOMContentLoaded', () => ThemeManager.init());
|
|
117
|
+
} else {
|
|
118
|
+
ThemeManager.init();
|
|
119
|
+
}
|
|
120
|
+
}
|