@leadertechie/personal-site-kit 0.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.
Files changed (124) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +60 -0
  3. package/dist/api/handlers/aboutme.d.ts +3 -0
  4. package/dist/api/handlers/aboutme.d.ts.map +1 -0
  5. package/dist/api/handlers/content-api.d.ts +5 -0
  6. package/dist/api/handlers/content-api.d.ts.map +1 -0
  7. package/dist/api/handlers/content.d.ts +2 -0
  8. package/dist/api/handlers/content.d.ts.map +1 -0
  9. package/dist/api/handlers/home.d.ts +3 -0
  10. package/dist/api/handlers/home.d.ts.map +1 -0
  11. package/dist/api/handlers/info.d.ts +2 -0
  12. package/dist/api/handlers/info.d.ts.map +1 -0
  13. package/dist/api/handlers/logo.d.ts +2 -0
  14. package/dist/api/handlers/logo.d.ts.map +1 -0
  15. package/dist/api/handlers/staticdetails.d.ts +2 -0
  16. package/dist/api/handlers/staticdetails.d.ts.map +1 -0
  17. package/dist/api/index.d.ts +9 -0
  18. package/dist/api/index.d.ts.map +1 -0
  19. package/dist/api/utils.d.ts +8 -0
  20. package/dist/api/utils.d.ts.map +1 -0
  21. package/dist/api.d.ts +4 -0
  22. package/dist/api.js +591 -0
  23. package/dist/index.d.ts +2 -0
  24. package/dist/index.js +354 -0
  25. package/dist/prerender/index.d.ts +5 -0
  26. package/dist/prerender/index.d.ts.map +1 -0
  27. package/dist/prerender/pageContent.d.ts +16 -0
  28. package/dist/prerender/pageContent.d.ts.map +1 -0
  29. package/dist/prerender/prerender.d.ts +3 -0
  30. package/dist/prerender/prerender.d.ts.map +1 -0
  31. package/dist/prerender/template.d.ts +10 -0
  32. package/dist/prerender/template.d.ts.map +1 -0
  33. package/dist/prerender.d.ts +4 -0
  34. package/dist/prerender.js +399 -0
  35. package/dist/shared/config/api.d.ts +2 -0
  36. package/dist/shared/config/api.d.ts.map +1 -0
  37. package/dist/shared/config/index.d.ts +5 -0
  38. package/dist/shared/config/index.d.ts.map +1 -0
  39. package/dist/shared/config/types.d.ts +16 -0
  40. package/dist/shared/config/types.d.ts.map +1 -0
  41. package/dist/shared/core/site-store.d.ts +16 -0
  42. package/dist/shared/core/site-store.d.ts.map +1 -0
  43. package/dist/shared/core/theme-toggle.d.ts +13 -0
  44. package/dist/shared/core/theme-toggle.d.ts.map +1 -0
  45. package/dist/shared/index.d.ts +9 -0
  46. package/dist/shared/index.d.ts.map +1 -0
  47. package/dist/shared/interfaces/iFooterLink.d.ts +5 -0
  48. package/dist/shared/interfaces/iFooterLink.d.ts.map +1 -0
  49. package/dist/shared/interfaces/iRoute.d.ts +5 -0
  50. package/dist/shared/interfaces/iRoute.d.ts.map +1 -0
  51. package/dist/shared/pageContent.d.ts +35 -0
  52. package/dist/shared/pageContent.d.ts.map +1 -0
  53. package/dist/shared/runtime.d.ts +7 -0
  54. package/dist/shared/runtime.d.ts.map +1 -0
  55. package/dist/shared/template.d.ts +8 -0
  56. package/dist/shared/template.d.ts.map +1 -0
  57. package/dist/shared.d.ts +2 -0
  58. package/dist/shared.js +10 -0
  59. package/dist/ui/aboutme/api.d.ts +11 -0
  60. package/dist/ui/aboutme/api.d.ts.map +1 -0
  61. package/dist/ui/aboutme/index.d.ts +26 -0
  62. package/dist/ui/aboutme/index.d.ts.map +1 -0
  63. package/dist/ui/aboutme/renderer.d.ts +5 -0
  64. package/dist/ui/aboutme/renderer.d.ts.map +1 -0
  65. package/dist/ui/aboutme/styles.d.ts +2 -0
  66. package/dist/ui/aboutme/styles.d.ts.map +1 -0
  67. package/dist/ui/admin/index.d.ts +42 -0
  68. package/dist/ui/admin/index.d.ts.map +1 -0
  69. package/dist/ui/admin/styles.d.ts +2 -0
  70. package/dist/ui/admin/styles.d.ts.map +1 -0
  71. package/dist/ui/banner/index.d.ts +17 -0
  72. package/dist/ui/banner/index.d.ts.map +1 -0
  73. package/dist/ui/banner/styles.d.ts +2 -0
  74. package/dist/ui/banner/styles.d.ts.map +1 -0
  75. package/dist/ui/footer/index.d.ts +9 -0
  76. package/dist/ui/footer/index.d.ts.map +1 -0
  77. package/dist/ui/footer/styles.d.ts +2 -0
  78. package/dist/ui/footer/styles.d.ts.map +1 -0
  79. package/dist/ui.d.ts +2 -0
  80. package/dist/ui.js +820 -0
  81. package/package.json +41 -0
  82. package/src/api/__tests__/info.test.ts +44 -0
  83. package/src/api/__tests__/utils.test.ts +78 -0
  84. package/src/api/handlers/aboutme.ts +99 -0
  85. package/src/api/handlers/content-api.ts +268 -0
  86. package/src/api/handlers/content.ts +72 -0
  87. package/src/api/handlers/home.ts +79 -0
  88. package/src/api/handlers/info.ts +12 -0
  89. package/src/api/handlers/logo.ts +55 -0
  90. package/src/api/handlers/staticdetails.ts +48 -0
  91. package/src/api/index.ts +125 -0
  92. package/src/api/utils.ts +16 -0
  93. package/src/prerender/__tests__/pageContent.test.ts +54 -0
  94. package/src/prerender/__tests__/template.test.ts +54 -0
  95. package/src/prerender/index.ts +138 -0
  96. package/src/prerender/pageContent.ts +263 -0
  97. package/src/prerender/prerender.ts +25 -0
  98. package/src/prerender/template.ts +65 -0
  99. package/src/shared/config/api.ts +16 -0
  100. package/src/shared/config/index.ts +41 -0
  101. package/src/shared/config/types.ts +16 -0
  102. package/src/shared/core/__tests__/theme-toggle.test.ts +204 -0
  103. package/src/shared/core/site-store.ts +38 -0
  104. package/src/shared/core/theme-toggle.ts +118 -0
  105. package/src/shared/index.ts +15 -0
  106. package/src/shared/interfaces/iFooterLink.ts +4 -0
  107. package/src/shared/interfaces/iRoute.ts +4 -0
  108. package/src/shared/models/theme-variables.css +25 -0
  109. package/src/shared/pageContent.ts +209 -0
  110. package/src/shared/runtime.ts +11 -0
  111. package/src/shared/styles/markdown.css +129 -0
  112. package/src/shared/template.ts +35 -0
  113. package/src/styles/markdown.css +129 -0
  114. package/src/styles/theme.css +432 -0
  115. package/src/ui/aboutme/api.ts +12 -0
  116. package/src/ui/aboutme/index.ts +155 -0
  117. package/src/ui/aboutme/renderer.ts +7 -0
  118. package/src/ui/aboutme/styles.ts +10 -0
  119. package/src/ui/admin/index.ts +492 -0
  120. package/src/ui/admin/styles.ts +317 -0
  121. package/src/ui/banner/index.ts +38 -0
  122. package/src/ui/banner/styles.ts +10 -0
  123. package/src/ui/footer/index.ts +37 -0
  124. package/src/ui/footer/styles.ts +9 -0
package/dist/ui.js ADDED
@@ -0,0 +1,820 @@
1
+ import { css, html, LitElement } from "lit";
2
+ import { customElement, state } from "lit/decorators.js";
3
+ const adminStyles = css`
4
+ :host {
5
+ display: block;
6
+ width: 100%;
7
+ max-width: 100%;
8
+ padding: 20px;
9
+ font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
10
+ color: var(--text-color, #213547);
11
+ background-color: var(--background-color, #fff);
12
+ min-height: 100vh;
13
+ box-sizing: border-box;
14
+ }
15
+
16
+ *, *::before, *::after {
17
+ box-sizing: border-box;
18
+ }
19
+
20
+ .container {
21
+ width: 100%;
22
+ max-width: 900px;
23
+ margin: 0 auto;
24
+ padding: 1rem;
25
+ }
26
+
27
+ .login-box {
28
+ border: 1px solid var(--border-color, #e0e0e0);
29
+ padding: 3rem 2.5rem;
30
+ border-radius: 16px;
31
+ width: 100%;
32
+ max-width: 420px;
33
+ margin: 80px auto;
34
+ text-align: center;
35
+ background: var(--card-bg, #fff);
36
+ box-shadow: 0 4px 6px rgba(0,0,0,0.07), 0 10px 20px rgba(0,0,0,0.05);
37
+ }
38
+
39
+ .login-box h2 {
40
+ margin: 0 0 0.5rem 0;
41
+ font-size: 1.75rem;
42
+ font-weight: 600;
43
+ color: var(--text-color, #213547);
44
+ }
45
+
46
+ .login-box p {
47
+ color: var(--secondary-text, #666);
48
+ margin-bottom: 1.5rem;
49
+ }
50
+
51
+ .nav-tabs {
52
+ display: flex;
53
+ gap: 8px;
54
+ margin-bottom: 24px;
55
+ flex-wrap: wrap;
56
+ padding: 0.5rem;
57
+ background: var(--card-bg, #fff);
58
+ border-radius: 12px;
59
+ box-shadow: 0 2px 4px rgba(0,0,0,0.05);
60
+ width: 100%;
61
+ }
62
+
63
+ .nav-tab {
64
+ padding: 0.6rem 1.25rem;
65
+ border: none;
66
+ border-radius: 8px;
67
+ cursor: pointer;
68
+ background: transparent;
69
+ color: var(--text-color, #213547);
70
+ font-size: 0.95rem;
71
+ font-weight: 500;
72
+ transition: all 0.2s ease;
73
+ }
74
+
75
+ .nav-tab:hover {
76
+ background: var(--nav-link-hover-bg, #f0f0f0);
77
+ color: var(--link-color, #646cff);
78
+ }
79
+
80
+ .nav-tab.active {
81
+ background: var(--link-color, #646cff);
82
+ color: white;
83
+ box-shadow: 0 2px 8px rgba(100, 108, 255, 0.3);
84
+ }
85
+
86
+ .section {
87
+ width: 100%;
88
+ border: none;
89
+ padding: 24px;
90
+ border-radius: 16px;
91
+ background: var(--card-bg, #fff);
92
+ box-shadow: 0 4px 6px rgba(0,0,0,0.07), 0 10px 20px rgba(0,0,0,0.05);
93
+ margin-bottom: 20px;
94
+ min-height: 450px;
95
+ box-sizing: border-box;
96
+ }
97
+
98
+ .section h3 {
99
+ margin: 0 0 0.5rem 0;
100
+ font-size: 1.25rem;
101
+ font-weight: 600;
102
+ color: var(--text-color, #213547);
103
+ display: flex;
104
+ align-items: center;
105
+ gap: 0.5rem;
106
+ }
107
+
108
+ .section h4 {
109
+ margin: 1.5rem 0 0.75rem 0;
110
+ font-size: 1rem;
111
+ font-weight: 600;
112
+ color: var(--text-color, #213547);
113
+ }
114
+
115
+ .file-list {
116
+ margin-top: 20px;
117
+ }
118
+
119
+ .file-item {
120
+ display: flex;
121
+ justify-content: space-between;
122
+ align-items: center;
123
+ padding: 12px 16px;
124
+ border-bottom: 1px solid var(--border-color, #eee);
125
+ border-radius: 8px;
126
+ transition: background 0.15s ease;
127
+ }
128
+
129
+ .file-item:hover {
130
+ background: var(--nav-link-hover-bg, #f8f9fa);
131
+ }
132
+
133
+ .file-item:last-child {
134
+ border-bottom: none;
135
+ }
136
+
137
+ button {
138
+ cursor: pointer;
139
+ padding: 10px 20px;
140
+ border-radius: 8px;
141
+ font-weight: 500;
142
+ font-size: 0.95rem;
143
+ transition: all 0.2s ease;
144
+ border: none;
145
+ }
146
+
147
+ .btn-primary {
148
+ background: var(--link-color, #646cff);
149
+ color: white;
150
+ box-shadow: 0 2px 4px rgba(100, 108, 255, 0.25);
151
+ }
152
+
153
+ .btn-primary:hover {
154
+ background: var(--link-hover-color, #535bf2);
155
+ transform: translateY(-1px);
156
+ box-shadow: 0 4px 8px rgba(100, 108, 255, 0.3);
157
+ }
158
+
159
+ .btn-danger {
160
+ color: #dc3545;
161
+ background: transparent;
162
+ border: 1px solid #dc3545;
163
+ padding: 6px 12px;
164
+ font-size: 0.85rem;
165
+ }
166
+
167
+ .btn-danger:hover {
168
+ background: #dc3545;
169
+ color: white;
170
+ }
171
+
172
+ .btn-secondary {
173
+ background: var(--nav-link-hover-bg, #f0f0f0);
174
+ color: var(--text-color, #333);
175
+ border: none;
176
+ font-size: 0.85rem;
177
+ padding: 8px 16px;
178
+ }
179
+
180
+ .btn-secondary:hover {
181
+ background: #e0e0e0;
182
+ }
183
+
184
+ input[type="text"], input[type="password"], input[type="file"] {
185
+ padding: 12px 14px;
186
+ width: 100%;
187
+ box-sizing: border-box;
188
+ margin-bottom: 12px;
189
+ border: 2px solid var(--border-color, #e0e0e0);
190
+ border-radius: 10px;
191
+ background-color: var(--background-color, #fff);
192
+ color: var(--text-color, #213547);
193
+ font-size: 0.95rem;
194
+ transition: border-color 0.2s ease, box-shadow 0.2s ease;
195
+ }
196
+
197
+ input[type="text"]:focus, input[type="password"]:focus {
198
+ outline: none;
199
+ border-color: var(--link-color, #646cff);
200
+ box-shadow: 0 0 0 3px rgba(100, 108, 255, 0.15);
201
+ }
202
+
203
+ input[type="file"] {
204
+ padding: 10px;
205
+ border-style: dashed;
206
+ cursor: pointer;
207
+ }
208
+
209
+ input[type="file"]:hover {
210
+ border-color: var(--link-color, #646cff);
211
+ background: rgba(100, 108, 255, 0.03);
212
+ }
213
+
214
+ .help-text {
215
+ color: var(--secondary-text, #666);
216
+ font-size: 0.9rem;
217
+ margin-bottom: 16px;
218
+ line-height: 1.5;
219
+ }
220
+
221
+ .required-badge {
222
+ background: linear-gradient(135deg, #dc3545, #c82333);
223
+ color: white;
224
+ padding: 4px 10px;
225
+ border-radius: 20px;
226
+ font-size: 0.75rem;
227
+ font-weight: 600;
228
+ margin-left: 8px;
229
+ text-transform: uppercase;
230
+ letter-spacing: 0.5px;
231
+ }
232
+
233
+ .current-file {
234
+ background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
235
+ color: #2e7d32;
236
+ padding: 14px 16px;
237
+ border-radius: 10px;
238
+ margin-bottom: 16px;
239
+ border: 1px solid #a5d6a7;
240
+ display: flex;
241
+ justify-content: space-between;
242
+ align-items: center;
243
+ flex-wrap: wrap;
244
+ gap: 10px;
245
+ }
246
+
247
+ .current-file strong {
248
+ color: #1b5e20;
249
+ }
250
+
251
+ .info-box {
252
+ background: linear-gradient(135deg, #fff8e1, #ffecb3);
253
+ color: #f57c00;
254
+ padding: 14px 16px;
255
+ border-radius: 10px;
256
+ margin-bottom: 16px;
257
+ font-size: 0.9rem;
258
+ border: 1px solid #ffe082;
259
+ }
260
+
261
+ .status-message {
262
+ padding: 12px 16px;
263
+ border-radius: 8px;
264
+ margin-bottom: 16px;
265
+ font-size: 0.9rem;
266
+ background: var(--nav-link-hover-bg, #f5f5f5);
267
+ color: var(--text-color, #333);
268
+ }
269
+
270
+ .status-message.success {
271
+ background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
272
+ color: #2e7d32;
273
+ border: 1px solid #a5d6a7;
274
+ }
275
+
276
+ .status-message.error {
277
+ background: linear-gradient(135deg, #ffebee, #ffcdd2);
278
+ color: #c62828;
279
+ border: 1px solid #ef9a9a;
280
+ }
281
+
282
+ .header {
283
+ display: flex;
284
+ justify-content: space-between;
285
+ align-items: center;
286
+ margin-bottom: 24px;
287
+ padding-bottom: 16px;
288
+ border-bottom: 2px solid var(--border-color, #eee);
289
+ }
290
+
291
+ .header h1 {
292
+ margin: 0;
293
+ font-size: 1.5rem;
294
+ font-weight: 600;
295
+ color: var(--text-color, #213547);
296
+ }
297
+
298
+ .mt-1 { margin-top: 12px; }
299
+ .mb-1 { margin-bottom: 1rem; }
300
+
301
+ @media (max-width: 600px) {
302
+ .container {
303
+ padding: 0.5rem;
304
+ }
305
+ .section {
306
+ padding: 16px;
307
+ }
308
+ .nav-tabs {
309
+ gap: 4px;
310
+ padding: 8px;
311
+ }
312
+ .nav-tab {
313
+ padding: 8px 12px;
314
+ font-size: 0.85rem;
315
+ }
316
+ }
317
+ `;
318
+ var __create = Object.create;
319
+ var __defProp = Object.defineProperty;
320
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
321
+ var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
322
+ var __typeError = (msg) => {
323
+ throw TypeError(msg);
324
+ };
325
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
326
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
327
+ var __decoratorStart = (base) => [, , , __create(base?.[__knownSymbol("metadata")] ?? null)];
328
+ var __decoratorStrings = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
329
+ var __expectFn = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError("Function expected") : fn;
330
+ var __decoratorContext = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError("Already initialized") : fns.push(__expectFn(fn || null)) });
331
+ var __decoratorMetadata = (array, target) => __defNormalProp(target, __knownSymbol("metadata"), array[3]);
332
+ var __runInitializers = (array, flags, self, value) => {
333
+ for (var i = 0, fns = array[flags >> 1], n = fns && fns.length; i < n; i++) flags & 1 ? fns[i].call(self) : value = fns[i].call(self, value);
334
+ return value;
335
+ };
336
+ var __decorateElement = (array, flags, name, decorators, target, extra) => {
337
+ var fn, it, done, ctx, access, k = flags & 7, s = !!(flags & 8), p = !!(flags & 16);
338
+ var j = k > 3 ? array.length + 1 : k ? s ? 1 : 2 : 0, key = __decoratorStrings[k + 5];
339
+ var initializers = k > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
340
+ var desc = k && (!p && !s && (target = target.prototype), k < 5 && (k > 3 || !p) && __getOwnPropDesc(k < 4 ? target : { get [name]() {
341
+ return __privateGet(this, extra);
342
+ }, set [name](x) {
343
+ return __privateSet(this, extra, x);
344
+ } }, name));
345
+ k ? p && k < 4 && __name(extra, (k > 2 ? "set " : k > 1 ? "get " : "") + name) : __name(target, name);
346
+ for (var i = decorators.length - 1; i >= 0; i--) {
347
+ ctx = __decoratorContext(k, name, done = {}, array[3], extraInitializers);
348
+ if (k) {
349
+ ctx.static = s, ctx.private = p, access = ctx.access = { has: p ? (x) => __privateIn(target, x) : (x) => name in x };
350
+ if (k ^ 3) access.get = p ? (x) => (k ^ 1 ? __privateGet : __privateMethod)(x, target, k ^ 4 ? extra : desc.get) : (x) => x[name];
351
+ if (k > 2) access.set = p ? (x, y) => __privateSet(x, target, y, k ^ 4 ? extra : desc.set) : (x, y) => x[name] = y;
352
+ }
353
+ it = (0, decorators[i])(k ? k < 4 ? p ? extra : desc[key] : k > 4 ? void 0 : { get: desc.get, set: desc.set } : target, ctx), done._ = 1;
354
+ if (k ^ 4 || it === void 0) __expectFn(it) && (k > 4 ? initializers.unshift(it) : k ? p ? extra = it : desc[key] = it : target = it);
355
+ else if (typeof it !== "object" || it === null) __typeError("Object expected");
356
+ else __expectFn(fn = it.get) && (desc.get = fn), __expectFn(fn = it.set) && (desc.set = fn), __expectFn(fn = it.init) && initializers.unshift(fn);
357
+ }
358
+ return k || __decoratorMetadata(array, target), desc && __defProp(target, name, desc), p ? k ^ 4 ? extra : desc : target;
359
+ };
360
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
361
+ var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError('Cannot use the "in" operator on this value') : member.has(obj);
362
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
363
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
364
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
365
+ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
366
+ var _staticDetails_dec, _activeSection_dec, _statusMessage_dec, _contentList_dec, _isAuthenticated_dec, _apiKey_dec, _a, _AdminPortal_decorators, _init, _apiKey, _isAuthenticated, _contentList, _statusMessage, _activeSection, _staticDetails;
367
+ console.log("[AdminPortal] Module loading");
368
+ console.log("[AdminPortal] About to define custom element");
369
+ _AdminPortal_decorators = [customElement("admin-portal")];
370
+ class AdminPortal extends (_a = LitElement, _apiKey_dec = [state()], _isAuthenticated_dec = [state()], _contentList_dec = [state()], _statusMessage_dec = [state()], _activeSection_dec = [state()], _staticDetails_dec = [state()], _a) {
371
+ constructor() {
372
+ super(...arguments);
373
+ __privateAdd(this, _apiKey, __runInitializers(_init, 8, this, "")), __runInitializers(_init, 11, this);
374
+ __privateAdd(this, _isAuthenticated, __runInitializers(_init, 12, this, false)), __runInitializers(_init, 15, this);
375
+ __privateAdd(this, _contentList, __runInitializers(_init, 16, this, [])), __runInitializers(_init, 19, this);
376
+ __privateAdd(this, _statusMessage, __runInitializers(_init, 20, this, "")), __runInitializers(_init, 23, this);
377
+ __privateAdd(this, _activeSection, __runInitializers(_init, 24, this, "profile")), __runInitializers(_init, 27, this);
378
+ __privateAdd(this, _staticDetails, __runInitializers(_init, 28, this, {})), __runInitializers(_init, 31, this);
379
+ }
380
+ get apiUrl() {
381
+ return window.__VITE_API_URL__ || void 0 || "http://localhost:8787";
382
+ }
383
+ handleLogin(e) {
384
+ e.preventDefault();
385
+ const input = this.shadowRoot?.querySelector("#apiKey");
386
+ if (input.value) {
387
+ this.apiKey = input.value;
388
+ this.isAuthenticated = true;
389
+ this.fetchContent();
390
+ }
391
+ }
392
+ async fetchContent() {
393
+ try {
394
+ const res = await fetch(`${this.apiUrl}/content`, {
395
+ headers: {
396
+ "Authorization": `Bearer ${this.apiKey}`
397
+ }
398
+ });
399
+ if (res.ok) {
400
+ this.contentList = await res.json();
401
+ } else {
402
+ this.statusMessage = "Failed to fetch content.";
403
+ }
404
+ } catch (e) {
405
+ this.statusMessage = "Error fetching content.";
406
+ }
407
+ }
408
+ async fetchStaticDetails() {
409
+ try {
410
+ const res = await fetch(`${this.apiUrl}/api/static`);
411
+ if (res.ok) {
412
+ this.staticDetails = await res.json();
413
+ }
414
+ } catch (e) {
415
+ }
416
+ }
417
+ async handleUpload(key, file) {
418
+ try {
419
+ this.statusMessage = "Uploading...";
420
+ const res = await fetch(`${this.apiUrl}/content/${key}`, {
421
+ method: "PUT",
422
+ headers: {
423
+ "Authorization": `Bearer ${this.apiKey}`
424
+ },
425
+ body: file
426
+ });
427
+ if (res.ok) {
428
+ this.statusMessage = "Upload successful!";
429
+ this.fetchContent();
430
+ } else {
431
+ this.statusMessage = "Upload failed.";
432
+ }
433
+ } catch (e) {
434
+ this.statusMessage = "Error uploading.";
435
+ }
436
+ }
437
+ async handleClearCache() {
438
+ try {
439
+ this.statusMessage = "Clearing cache...";
440
+ const res = await fetch(`${this.apiUrl}/cache-clear`, {
441
+ method: "POST",
442
+ headers: {
443
+ "Authorization": `Bearer ${this.apiKey}`
444
+ }
445
+ });
446
+ if (res.ok) {
447
+ this.statusMessage = "Cache cleared!";
448
+ } else {
449
+ this.statusMessage = "Failed to clear cache.";
450
+ }
451
+ } catch (e) {
452
+ this.statusMessage = "Error clearing cache.";
453
+ }
454
+ }
455
+ async handleDelete(key) {
456
+ if (!confirm(`Delete ${key}?`)) return;
457
+ try {
458
+ const res = await fetch(`${this.apiUrl}/content/${key}`, {
459
+ method: "DELETE",
460
+ headers: {
461
+ "Authorization": `Bearer ${this.apiKey}`
462
+ }
463
+ });
464
+ if (res.ok) {
465
+ this.fetchContent();
466
+ } else {
467
+ this.statusMessage = "Delete failed.";
468
+ }
469
+ } catch (e) {
470
+ this.statusMessage = "Error deleting.";
471
+ }
472
+ }
473
+ getContent(key) {
474
+ return this.contentList.find((c) => c.key === key);
475
+ }
476
+ getSectionFiles(prefix) {
477
+ return this.contentList.filter((c) => c.key.startsWith(prefix));
478
+ }
479
+ renderHomeSection() {
480
+ const home = this.getContent("home.md");
481
+ return html`
482
+ <div class="section">
483
+ <h3>Home Page</h3>
484
+ <p class="help-text">Content for your home page. Upload home.md with your main content.</p>
485
+
486
+ ${home ? html`
487
+ <div class="current-file">
488
+ <strong>Current:</strong> home.md (${home.size} bytes)
489
+ <button class="btn-danger" @click=${() => this.handleDelete("home.md")}>Delete</button>
490
+ </div>
491
+ ` : ""}
492
+
493
+ <input type="file" id="homeFile" accept=".md" />
494
+ <button class="btn-primary" @click=${() => {
495
+ const input = this.shadowRoot?.querySelector("#homeFile");
496
+ if (input.files?.[0]) this.handleUpload("home.md", input.files[0]);
497
+ }}>Upload home.md</button>
498
+ </div>
499
+ `;
500
+ }
501
+ renderProfileSection() {
502
+ const profile = this.getContent("profile.json");
503
+ return html`
504
+ <div class="section">
505
+ <h3>Profile <span class="required-badge">Required</span></h3>
506
+ <p class="help-text">This file contains your profile information (name, title, experience).</p>
507
+
508
+ ${profile ? html`
509
+ <div class="current-file">
510
+ <strong>Current:</strong> profile.json (${profile.size} bytes)
511
+ <button class="btn-danger" @click=${() => this.handleDelete("profile.json")}>Delete</button>
512
+ </div>
513
+ ` : ""}
514
+
515
+ <input type="file" id="profileFile" accept=".json" />
516
+ <button class="btn-primary" @click=${() => {
517
+ const input = this.shadowRoot?.querySelector("#profileFile");
518
+ if (input.files?.[0]) this.handleUpload("profile.json", input.files[0]);
519
+ }}>Upload profile.json</button>
520
+ </div>
521
+ `;
522
+ }
523
+ renderAboutMeSection() {
524
+ const aboutMe = this.getContent("about-me.md");
525
+ return html`
526
+ <div class="section">
527
+ <h3>About Me Page <span class="required-badge">Required</span></h3>
528
+ <p class="help-text">Content for your About Me page. Supports Markdown with frontmatter.</p>
529
+
530
+ ${aboutMe ? html`
531
+ <div class="current-file">
532
+ <strong>Current:</strong> about-me.md (${aboutMe.size} bytes)
533
+ <button class="btn-danger" @click=${() => this.handleDelete("about-me.md")}>Delete</button>
534
+ </div>
535
+ ` : ""}
536
+
537
+ <input type="file" id="aboutFile" accept=".md" />
538
+ <button class="btn-primary" @click=${() => {
539
+ const input = this.shadowRoot?.querySelector("#aboutFile");
540
+ if (input.files?.[0]) this.handleUpload("about-me.md", input.files[0]);
541
+ }}>Upload about-me.md</button>
542
+ </div>
543
+ `;
544
+ }
545
+ renderBlogsSection() {
546
+ const blogs = this.getSectionFiles("blogs/").filter((b) => b.key.endsWith(".json"));
547
+ return html`
548
+ <div class="section">
549
+ <h3>Blog Posts</h3>
550
+ <p class="help-text">Each blog needs 2 files: a JSON (metadata) and MD (content) file.</p>
551
+
552
+ <h4>Upload New Blog</h4>
553
+ <input type="file" id="blogMetaFile" accept=".json" />
554
+ <input type="file" id="blogContentFile" accept=".md" />
555
+ <input type="text" id="blogSlug" placeholder="Slug (e.g., my-new-post)" class="mt-1" />
556
+ <button class="btn-primary" @click=${() => {
557
+ const metaInput = this.shadowRoot?.querySelector("#blogMetaFile");
558
+ const contentInput = this.shadowRoot?.querySelector("#blogContentFile");
559
+ const slugInput = this.shadowRoot?.querySelector("#blogSlug");
560
+ if (metaInput.files?.[0] && contentInput.files?.[0] && slugInput.value) {
561
+ this.handleUpload(`blogs/${slugInput.value}.json`, metaInput.files[0]);
562
+ this.handleUpload(`blogs/${slugInput.value}.md`, contentInput.files[0]);
563
+ }
564
+ }}>Upload Blog (JSON + MD)</button>
565
+
566
+ <div class="file-list">
567
+ <h4>Current Blogs (${blogs.length})</h4>
568
+ ${blogs.map((b) => html`
569
+ <div class="file-item">
570
+ <span>${b.key.replace(".json", "")}</span>
571
+ <button class="btn-danger" @click=${() => {
572
+ const slug = b.key.replace("blogs/", "").replace(".json", "");
573
+ this.handleDelete(`blogs/${slug}.json`);
574
+ this.handleDelete(`blogs/${slug}.md`);
575
+ }}>Delete</button>
576
+ </div>
577
+ `)}
578
+ ${blogs.length === 0 ? html`<p>No blogs yet.</p>` : ""}
579
+ </div>
580
+ </div>
581
+ `;
582
+ }
583
+ renderStoriesSection() {
584
+ const stories = this.getSectionFiles("stories/").filter((s) => s.key.endsWith(".json"));
585
+ return html`
586
+ <div class="section">
587
+ <h3>Stories</h3>
588
+ <p class="help-text">Each story needs 2 files: a JSON (metadata) and MD (content) file.</p>
589
+
590
+ <h4>Upload New Story</h4>
591
+ <input type="file" id="storyMetaFile" accept=".json" />
592
+ <input type="file" id="storyContentFile" accept=".md" />
593
+ <input type="text" id="storySlug" placeholder="Slug (e.g., my-story)" class="mt-1" />
594
+ <button class="btn-primary" @click=${() => {
595
+ const metaInput = this.shadowRoot?.querySelector("#storyMetaFile");
596
+ const contentInput = this.shadowRoot?.querySelector("#storyContentFile");
597
+ const slugInput = this.shadowRoot?.querySelector("#storySlug");
598
+ if (metaInput.files?.[0] && contentInput.files?.[0] && slugInput.value) {
599
+ this.handleUpload(`stories/${slugInput.value}.json`, metaInput.files[0]);
600
+ this.handleUpload(`stories/${slugInput.value}.md`, contentInput.files[0]);
601
+ }
602
+ }}>Upload Story (JSON + MD)</button>
603
+
604
+ <div class="file-list">
605
+ <h4>Current Stories (${stories.length})</h4>
606
+ ${stories.map((s) => html`
607
+ <div class="file-item">
608
+ <span>${s.key.replace(".json", "")}</span>
609
+ <button class="btn-danger" @click=${() => {
610
+ const slug = s.key.replace("stories/", "").replace(".json", "");
611
+ this.handleDelete(`stories/${slug}.json`);
612
+ this.handleDelete(`stories/${slug}.md`);
613
+ }}>Delete</button>
614
+ </div>
615
+ `)}
616
+ ${stories.length === 0 ? html`<p>No stories yet.</p>` : ""}
617
+ </div>
618
+ </div>
619
+ `;
620
+ }
621
+ renderImagesSection() {
622
+ const images = this.getSectionFiles("images/");
623
+ return html`
624
+ <div class="section">
625
+ <h3>Images</h3>
626
+ <p class="help-text">Upload images for use in your content. In markdown, reference images by filename only (e.g., use <code>my-photo.jpg</code> not <code>/images/my-photo.jpg</code>). The renderer automatically prepends <code>images/</code>.</p>
627
+
628
+ <input type="file" id="imageFile" accept="image/*" />
629
+ <input type="text" id="imagePath" placeholder="Image name (e.g., profile-photo.jpg)" class="mt-1" />
630
+ <button class="btn-primary" @click=${() => {
631
+ const fileInput = this.shadowRoot?.querySelector("#imageFile");
632
+ const pathInput = this.shadowRoot?.querySelector("#imagePath");
633
+ if (fileInput.files?.[0] && pathInput.value) {
634
+ this.handleUpload(`images/${pathInput.value}`, fileInput.files[0]);
635
+ }
636
+ }}>Upload to images/</button>
637
+
638
+ <div class="file-list">
639
+ <h4>Current Images (${images.length})</h4>
640
+ ${images.map((img) => html`
641
+ <div class="file-item">
642
+ <span>${img.key} (${img.size} bytes)</span>
643
+ <button class="btn-danger" @click=${() => this.handleDelete(img.key)}>Delete</button>
644
+ </div>
645
+ `)}
646
+ ${images.length === 0 ? html`<p>No images yet.</p>` : ""}
647
+ </div>
648
+ </div>
649
+ `;
650
+ }
651
+ renderLogoSection() {
652
+ const logo = this.getContent("logo.svg");
653
+ return html`
654
+ <div class="section">
655
+ <h3>Site Logo</h3>
656
+ <p class="help-text">Upload your site logo (SVG format recommended). This appears in the header of your site.</p>
657
+
658
+ ${logo ? html`
659
+ <div class="current-file">
660
+ <strong>Current:</strong> logo.svg (${logo.size} bytes)
661
+ <button class="btn-danger" @click=${() => this.handleDelete("logo.svg")}>Delete</button>
662
+ </div>
663
+ ` : ""}
664
+
665
+ <input type="file" id="logoFile" accept=".svg,image/svg+xml" />
666
+ <button class="btn-primary mt-1 mb-1" @click=${() => {
667
+ const input = this.shadowRoot?.querySelector("#logoFile");
668
+ if (input.files?.[0]) this.handleUpload("logo.svg", input.files[0]);
669
+ }}>Upload logo.svg</button>
670
+
671
+ <div class="info-box">
672
+ <strong>Tip:</strong> Use an SVG with transparent background. The logo will automatically adapt to light/dark themes.
673
+ </div>
674
+ </div>
675
+ `;
676
+ }
677
+ render() {
678
+ if (!this.isAuthenticated) {
679
+ return html`
680
+ <div class="container">
681
+ <div class="login-box">
682
+ <h2>Admin Login</h2>
683
+ <p>Enter your API key to manage content</p>
684
+ <form @submit=${this.handleLogin}>
685
+ <input type="password" id="apiKey" placeholder="API Key" />
686
+ <button type="submit" class="btn-primary">Login</button>
687
+ </form>
688
+ </div>
689
+ </div>
690
+ `;
691
+ }
692
+ return html`
693
+ <div class="container">
694
+ <div class="header">
695
+ <h1>Content Manager</h1>
696
+ <button class="btn-secondary" @click=${() => this.handleClearCache()}>Clear Cache</button>
697
+ </div>
698
+
699
+ <div class="nav-tabs">
700
+ <button class="nav-tab ${this.activeSection === "home" ? "active" : ""}"
701
+ @click=${() => this.activeSection = "home"}>Home</button>
702
+ <button class="nav-tab ${this.activeSection === "profile" ? "active" : ""}"
703
+ @click=${() => this.activeSection = "profile"}>Profile</button>
704
+ <button class="nav-tab ${this.activeSection === "aboutme" ? "active" : ""}"
705
+ @click=${() => this.activeSection = "aboutme"}>About Me</button>
706
+ <button class="nav-tab ${this.activeSection === "blogs" ? "active" : ""}"
707
+ @click=${() => this.activeSection = "blogs"}>Blogs</button>
708
+ <button class="nav-tab ${this.activeSection === "stories" ? "active" : ""}"
709
+ @click=${() => this.activeSection = "stories"}>Stories</button>
710
+ <button class="nav-tab ${this.activeSection === "images" ? "active" : ""}"
711
+ @click=${() => this.activeSection = "images"}>Images</button>
712
+ <button class="nav-tab ${this.activeSection === "logo" ? "active" : ""}"
713
+ @click=${() => this.activeSection = "logo"}>Logo</button>
714
+ <button class="nav-tab ${this.activeSection === "static" ? "active" : ""}"
715
+ @click=${() => {
716
+ this.activeSection = "static";
717
+ this.fetchStaticDetails();
718
+ }}>Site Settings</button>
719
+ </div>
720
+
721
+ ${this.statusMessage ? html`
722
+ <div class="status-message ${this.statusMessage.includes("successful") || this.statusMessage.includes("cleared") ? "success" : this.statusMessage.includes("failed") || this.statusMessage.includes("Error") ? "error" : ""}">
723
+ ${this.statusMessage}
724
+ </div>
725
+ ` : ""}
726
+
727
+ ${this.activeSection === "home" ? this.renderHomeSection() : ""}
728
+ ${this.activeSection === "profile" ? this.renderProfileSection() : ""}
729
+ ${this.activeSection === "aboutme" ? this.renderAboutMeSection() : ""}
730
+ ${this.activeSection === "blogs" ? this.renderBlogsSection() : ""}
731
+ ${this.activeSection === "stories" ? this.renderStoriesSection() : ""}
732
+ ${this.activeSection === "images" ? this.renderImagesSection() : ""}
733
+ ${this.activeSection === "logo" ? this.renderLogoSection() : ""}
734
+ ${this.activeSection === "static" ? this.renderStaticSection() : ""}
735
+ </div>
736
+ `;
737
+ }
738
+ renderStaticSection() {
739
+ return html`
740
+ <div class="section">
741
+ <h3>Site Settings</h3>
742
+ <p class="help-text">Manage your site's static details like title, footer links, etc.</p>
743
+
744
+ <div class="mb-1">
745
+ <label style="display:block;margin-bottom:4px;font-weight:500">Site Title</label>
746
+ <input type="text" id="siteTitle" .value=${this.staticDetails?.siteTitle || ""} />
747
+ </div>
748
+
749
+ <div class="mb-1">
750
+ <label style="display:block;margin-bottom:4px;font-weight:500">Copyright Text</label>
751
+ <input type="text" id="copyright" .value=${this.staticDetails?.copyright || ""} />
752
+ </div>
753
+
754
+ <div class="mb-1">
755
+ <label style="display:block;margin-bottom:4px;font-weight:500">LinkedIn URL</label>
756
+ <input type="text" id="linkedin" .value=${this.staticDetails?.linkedin || ""} />
757
+ </div>
758
+
759
+ <div class="mb-1">
760
+ <label style="display:block;margin-bottom:4px;font-weight:500">GitHub URL</label>
761
+ <input type="text" id="github" .value=${this.staticDetails?.github || ""} />
762
+ </div>
763
+
764
+ <div class="mb-1">
765
+ <label style="display:block;margin-bottom:4px;font-weight:500">Email</label>
766
+ <input type="text" id="email" .value=${this.staticDetails?.email || ""} />
767
+ </div>
768
+
769
+ <button class="btn-primary" @click=${async () => {
770
+ const siteTitle = this.shadowRoot?.querySelector("#siteTitle")?.value;
771
+ const copyright = this.shadowRoot?.querySelector("#copyright")?.value;
772
+ const linkedin = this.shadowRoot?.querySelector("#linkedin")?.value;
773
+ const github = this.shadowRoot?.querySelector("#github")?.value;
774
+ const email = this.shadowRoot?.querySelector("#email")?.value;
775
+ const data = {};
776
+ if (siteTitle) data.siteTitle = siteTitle;
777
+ if (copyright) data.copyright = copyright;
778
+ if (linkedin) data.linkedin = linkedin;
779
+ if (github) data.github = github;
780
+ if (email) data.email = email;
781
+ try {
782
+ const url = `${this.apiUrl}/content/staticdetails.json`;
783
+ const res = await fetch(url, {
784
+ method: "PUT",
785
+ headers: { "Authorization": `Bearer ${this.apiKey}`, "Content-Type": "application/json" },
786
+ body: JSON.stringify(data)
787
+ });
788
+ if (res.ok) {
789
+ this.statusMessage = "Settings saved!";
790
+ this.fetchContent();
791
+ } else {
792
+ this.statusMessage = "Failed to save settings.";
793
+ }
794
+ } catch (e) {
795
+ this.statusMessage = "Error saving settings.";
796
+ }
797
+ }}>Save Settings</button>
798
+ </div>
799
+ `;
800
+ }
801
+ }
802
+ _init = __decoratorStart(_a);
803
+ _apiKey = /* @__PURE__ */ new WeakMap();
804
+ _isAuthenticated = /* @__PURE__ */ new WeakMap();
805
+ _contentList = /* @__PURE__ */ new WeakMap();
806
+ _statusMessage = /* @__PURE__ */ new WeakMap();
807
+ _activeSection = /* @__PURE__ */ new WeakMap();
808
+ _staticDetails = /* @__PURE__ */ new WeakMap();
809
+ __decorateElement(_init, 4, "apiKey", _apiKey_dec, AdminPortal, _apiKey);
810
+ __decorateElement(_init, 4, "isAuthenticated", _isAuthenticated_dec, AdminPortal, _isAuthenticated);
811
+ __decorateElement(_init, 4, "contentList", _contentList_dec, AdminPortal, _contentList);
812
+ __decorateElement(_init, 4, "statusMessage", _statusMessage_dec, AdminPortal, _statusMessage);
813
+ __decorateElement(_init, 4, "activeSection", _activeSection_dec, AdminPortal, _activeSection);
814
+ __decorateElement(_init, 4, "staticDetails", _staticDetails_dec, AdminPortal, _staticDetails);
815
+ AdminPortal = __decorateElement(_init, 0, "AdminPortal", _AdminPortal_decorators, AdminPortal);
816
+ AdminPortal.styles = adminStyles;
817
+ __runInitializers(_init, 1, AdminPortal);
818
+ export {
819
+ AdminPortal
820
+ };