@leadertechie/personal-site-kit 0.1.0-alpha.6 → 0.1.0-alpha.8

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 (109) hide show
  1. package/dist/api/handlers/about-me.d.ts.map +1 -1
  2. package/dist/api/handlers/auth-handler.d.ts.map +1 -1
  3. package/dist/api/website-api.d.ts.map +1 -1
  4. package/dist/api.js +2 -2
  5. package/dist/chunks/index-CGvOrVf8.js +213 -0
  6. package/dist/chunks/{index-C3wLSCKU.js → index-CYd_Pe2U.js} +1353 -482
  7. package/dist/chunks/{template-MawmknFQ.js → template-D1uGvdWZ.js} +10 -8
  8. package/dist/chunks/{website-api-DI3muo2s.js → website-api-FLejlWxJ.js} +78 -41
  9. package/dist/index.js +19 -9
  10. package/dist/prerender/data-fetcher.d.ts +19 -0
  11. package/dist/prerender/data-fetcher.d.ts.map +1 -0
  12. package/dist/prerender/page-content.d.ts.map +1 -1
  13. package/dist/prerender/page-generators/about.d.ts +16 -0
  14. package/dist/prerender/page-generators/about.d.ts.map +1 -0
  15. package/dist/prerender/page-generators/base.d.ts +26 -0
  16. package/dist/prerender/page-generators/base.d.ts.map +1 -0
  17. package/dist/prerender/page-generators/blog-detail.d.ts +15 -0
  18. package/dist/prerender/page-generators/blog-detail.d.ts.map +1 -0
  19. package/dist/prerender/page-generators/blogs-list.d.ts +17 -0
  20. package/dist/prerender/page-generators/blogs-list.d.ts.map +1 -0
  21. package/dist/prerender/page-generators/home.d.ts +19 -0
  22. package/dist/prerender/page-generators/home.d.ts.map +1 -0
  23. package/dist/prerender/page-generators/index.d.ts +9 -0
  24. package/dist/prerender/page-generators/index.d.ts.map +1 -0
  25. package/dist/prerender/page-generators/not-found.d.ts +14 -0
  26. package/dist/prerender/page-generators/not-found.d.ts.map +1 -0
  27. package/dist/prerender/page-generators/stories-list.d.ts +17 -0
  28. package/dist/prerender/page-generators/stories-list.d.ts.map +1 -0
  29. package/dist/prerender/page-generators/story-detail.d.ts +15 -0
  30. package/dist/prerender/page-generators/story-detail.d.ts.map +1 -0
  31. package/dist/prerender.js +109 -102
  32. package/dist/shared/config/index.d.ts.map +1 -1
  33. package/dist/shared.js +1 -1
  34. package/dist/ui/about-me/index.d.ts +2 -10
  35. package/dist/ui/about-me/index.d.ts.map +1 -1
  36. package/dist/ui/admin/api.d.ts +16 -0
  37. package/dist/ui/admin/api.d.ts.map +1 -0
  38. package/dist/ui/admin/components/AboutMeSection.d.ts +7 -0
  39. package/dist/ui/admin/components/AboutMeSection.d.ts.map +1 -0
  40. package/dist/ui/admin/components/AdminSection.d.ts +13 -0
  41. package/dist/ui/admin/components/AdminSection.d.ts.map +1 -0
  42. package/dist/ui/admin/components/BlogsSection.d.ts +7 -0
  43. package/dist/ui/admin/components/BlogsSection.d.ts.map +1 -0
  44. package/dist/ui/admin/components/HomeSection.d.ts +7 -0
  45. package/dist/ui/admin/components/HomeSection.d.ts.map +1 -0
  46. package/dist/ui/admin/components/ImagesSection.d.ts +7 -0
  47. package/dist/ui/admin/components/ImagesSection.d.ts.map +1 -0
  48. package/dist/ui/admin/components/LoginForm.d.ts +9 -0
  49. package/dist/ui/admin/components/LoginForm.d.ts.map +1 -0
  50. package/dist/ui/admin/components/LogoSection.d.ts +7 -0
  51. package/dist/ui/admin/components/LogoSection.d.ts.map +1 -0
  52. package/dist/ui/admin/components/ProfileSection.d.ts +7 -0
  53. package/dist/ui/admin/components/ProfileSection.d.ts.map +1 -0
  54. package/dist/ui/admin/components/StaticSection.d.ts +13 -0
  55. package/dist/ui/admin/components/StaticSection.d.ts.map +1 -0
  56. package/dist/ui/admin/components/StoriesSection.d.ts +7 -0
  57. package/dist/ui/admin/components/StoriesSection.d.ts.map +1 -0
  58. package/dist/ui/admin/components/index.d.ts +11 -0
  59. package/dist/ui/admin/components/index.d.ts.map +1 -0
  60. package/dist/ui/admin/index.d.ts +10 -26
  61. package/dist/ui/admin/index.d.ts.map +1 -1
  62. package/dist/ui/admin/types.d.ts +24 -0
  63. package/dist/ui/admin/types.d.ts.map +1 -0
  64. package/dist/ui/blog-viewer/index.d.ts.map +1 -1
  65. package/dist/ui/index.d.ts.map +1 -1
  66. package/dist/ui/story-viewer/index.d.ts.map +1 -1
  67. package/dist/ui.js +14 -4
  68. package/package.json +1 -1
  69. package/src/api/handlers/about-me.ts +19 -9
  70. package/src/api/handlers/auth-handler.ts +41 -18
  71. package/src/api/handlers/content.ts +1 -1
  72. package/src/api/handlers/home.ts +2 -2
  73. package/src/api/website-api.ts +25 -13
  74. package/src/prerender/__tests__/page-content.test.ts +1 -11
  75. package/src/prerender/data-fetcher.ts +93 -0
  76. package/src/prerender/page-content.ts +109 -106
  77. package/src/prerender/page-generators/about.ts +38 -0
  78. package/src/prerender/page-generators/base.ts +77 -0
  79. package/src/prerender/page-generators/blog-detail.ts +35 -0
  80. package/src/prerender/page-generators/blogs-list.ts +43 -0
  81. package/src/prerender/page-generators/home.ts +54 -0
  82. package/src/prerender/page-generators/index.ts +8 -0
  83. package/src/prerender/page-generators/not-found.ts +36 -0
  84. package/src/prerender/page-generators/stories-list.ts +43 -0
  85. package/src/prerender/page-generators/story-detail.ts +35 -0
  86. package/src/shared/config/index.ts +4 -2
  87. package/src/shared/page-content.ts +1 -1
  88. package/src/shared/router.ts +5 -5
  89. package/src/ui/about-me/index.ts +23 -57
  90. package/src/ui/admin/api.ts +93 -0
  91. package/src/ui/admin/components/AboutMeSection.ts +47 -0
  92. package/src/ui/admin/components/AdminSection.ts +134 -0
  93. package/src/ui/admin/components/BlogsSection.ts +62 -0
  94. package/src/ui/admin/components/HomeSection.ts +47 -0
  95. package/src/ui/admin/components/ImagesSection.ts +54 -0
  96. package/src/ui/admin/components/LoginForm.ts +116 -0
  97. package/src/ui/admin/components/LogoSection.ts +51 -0
  98. package/src/ui/admin/components/ProfileSection.ts +47 -0
  99. package/src/ui/admin/components/StaticSection.ts +67 -0
  100. package/src/ui/admin/components/StoriesSection.ts +62 -0
  101. package/src/ui/admin/components/index.ts +10 -0
  102. package/src/ui/admin/index.ts +192 -434
  103. package/src/ui/admin/types.ts +26 -0
  104. package/src/ui/blog-viewer/index.ts +4 -1
  105. package/src/ui/index.ts +7 -0
  106. package/src/ui/story-viewer/index.ts +4 -1
  107. package/dist/ui/about-me/renderer.d.ts +0 -5
  108. package/dist/ui/about-me/renderer.d.ts.map +0 -1
  109. package/src/ui/about-me/renderer.ts +0 -7
@@ -0,0 +1,116 @@
1
+ import { LitElement, html, css } from 'lit';
2
+ import { customElement, property } from 'lit/decorators.js';
3
+
4
+ @customElement('admin-login-form')
5
+ export class AdminLoginForm extends LitElement {
6
+
7
+ static styles = css`
8
+ :host {
9
+ display: block;
10
+ width: 100%;
11
+ }
12
+
13
+ .container {
14
+ width: 100%;
15
+ max-width: 900px;
16
+ margin: 0 auto;
17
+ padding: 1rem;
18
+ }
19
+
20
+ .login-box {
21
+ border: 1px solid var(--border-color, #e0e0e0);
22
+ padding: 3rem 2.5rem;
23
+ border-radius: 16px;
24
+ width: 100%;
25
+ max-width: 420px;
26
+ margin: 80px auto;
27
+ text-align: center;
28
+ background: var(--card-bg, #fff);
29
+ box-shadow: 0 4px 6px rgba(0,0,0,0.07), 0 10px 20px rgba(0,0,0,0.05);
30
+ }
31
+
32
+ .login-box h2 {
33
+ margin: 0 0 0.5rem 0;
34
+ font-size: 1.75rem;
35
+ font-weight: 600;
36
+ color: var(--text-color, #213547);
37
+ }
38
+
39
+ .login-box p {
40
+ color: var(--secondary-text, #666);
41
+ margin-bottom: 1.5rem;
42
+ }
43
+
44
+ input {
45
+ width: 100%;
46
+ padding: 10px;
47
+ margin-bottom: 20px;
48
+ border: 1px solid var(--border-color);
49
+ border-radius: 4px;
50
+ background: var(--background-color);
51
+ color: var(--text-color);
52
+ box-sizing: border-box;
53
+ }
54
+
55
+ button {
56
+ padding: 10px 20px;
57
+ border: none;
58
+ border-radius: 4px;
59
+ cursor: pointer;
60
+ font-size: 1rem;
61
+ transition: background-color 0.3s ease;
62
+ }
63
+
64
+ .btn-primary {
65
+ background: var(--link-color, #646cff);
66
+ color: white;
67
+ }
68
+
69
+ .btn-primary:hover {
70
+ background: var(--link-hover-color, #535bf2);
71
+ }
72
+
73
+ .error-message {
74
+ color: red;
75
+ margin-bottom: 10px;
76
+ }
77
+ `;
78
+
79
+ @property({ type: String })
80
+ accessor errorMessage = '';
81
+
82
+ @property({ type: Boolean })
83
+ accessor isSetup = false;
84
+
85
+ private handleSubmit(e: Event) {
86
+ e.preventDefault();
87
+ const formData = new FormData(e.target as HTMLFormElement);
88
+ const username = formData.get('username') as string;
89
+ const password = formData.get('password') as string;
90
+ const confirmPassword = formData.get('confirmPassword') as string;
91
+
92
+ this.dispatchEvent(new CustomEvent('login-submit', {
93
+ detail: { username, password, confirmPassword },
94
+ bubbles: true,
95
+ composed: true
96
+ }));
97
+ }
98
+
99
+ render() {
100
+ return html`
101
+ <div class="container">
102
+ <div class="login-box">
103
+ <h2>${this.isSetup ? 'Admin Login' : 'Admin Setup'}</h2>
104
+ <p>${this.isSetup ? 'Enter your credentials' : 'Create your admin credentials'}</p>
105
+ <form @submit=${this.handleSubmit}>
106
+ <input type="text" name="username" placeholder="Username${this.isSetup ? '' : ' (3+ chars)'}" autocomplete="username" required />
107
+ <input type="password" name="password" placeholder="Password${this.isSetup ? '' : ' (8+ chars)'}" autocomplete="current-password" required />
108
+ ${!this.isSetup ? html`<input type="password" name="confirmPassword" placeholder="Confirm Password" required />` : ''}
109
+ ${this.errorMessage ? html`<div class="error-message">${this.errorMessage}</div>` : ''}
110
+ <button type="submit" class="btn-primary">${this.isSetup ? 'Login' : 'Create Account'}</button>
111
+ </form>
112
+ </div>
113
+ </div>
114
+ `;
115
+ }
116
+ }
@@ -0,0 +1,51 @@
1
+ import { html } from 'lit';
2
+ import { customElement } from 'lit/decorators.js';
3
+ import { AdminSection } from './AdminSection';
4
+
5
+ @customElement('admin-logo-section')
6
+ export class AdminLogoSection extends AdminSection {
7
+ private async handleUpload() {
8
+ const input = this.shadowRoot?.querySelector('#logoFile') as HTMLInputElement;
9
+ if (input.files?.[0]) {
10
+ try {
11
+ await this.onUpload('logo.svg', input.files[0]);
12
+ this.onStatusMessage('Upload successful!');
13
+ } catch (e) {
14
+ this.onStatusMessage('Upload failed.');
15
+ }
16
+ }
17
+ }
18
+
19
+ private async handleDelete() {
20
+ if (!confirm('Delete logo.svg?')) return;
21
+ try {
22
+ await this.onDelete('logo.svg');
23
+ } catch (e) {
24
+ this.onStatusMessage('Delete failed.');
25
+ }
26
+ }
27
+
28
+ render() {
29
+ const logo = this.getContent('logo.svg');
30
+ return html`
31
+ <div class="section">
32
+ <h3>Site Logo</h3>
33
+ <p class="help-text">Upload your site logo (SVG format recommended). This appears in the header of your site.</p>
34
+
35
+ ${logo ? html`
36
+ <div class="current-file">
37
+ <strong>Current:</strong> logo.svg (${logo.size} bytes)
38
+ <button class="btn-danger" @click=${this.handleDelete}>Delete</button>
39
+ </div>
40
+ ` : ''}
41
+
42
+ <input type="file" id="logoFile" accept=".svg,image/svg+xml" />
43
+ <button class="btn-primary mt-1 mb-1" @click=${this.handleUpload}>Upload logo.svg</button>
44
+
45
+ <div class="info-box">
46
+ <strong>Tip:</strong> Use an SVG with transparent background. The logo will automatically adapt to light/dark themes.
47
+ </div>
48
+ </div>
49
+ `;
50
+ }
51
+ }
@@ -0,0 +1,47 @@
1
+ import { html } from 'lit';
2
+ import { customElement } from 'lit/decorators.js';
3
+ import { AdminSection } from './AdminSection';
4
+
5
+ @customElement('admin-profile-section')
6
+ export class AdminProfileSection extends AdminSection {
7
+ private async handleUpload() {
8
+ const input = this.shadowRoot?.querySelector('#profileFile') as HTMLInputElement;
9
+ if (input.files?.[0]) {
10
+ try {
11
+ await this.onUpload('profile.json', input.files[0]);
12
+ this.onStatusMessage('Upload successful!');
13
+ } catch (e) {
14
+ this.onStatusMessage('Upload failed.');
15
+ }
16
+ }
17
+ }
18
+
19
+ private async handleDelete() {
20
+ if (!confirm('Delete profile.json?')) return;
21
+ try {
22
+ await this.onDelete('profile.json');
23
+ } catch (e) {
24
+ this.onStatusMessage('Delete failed.');
25
+ }
26
+ }
27
+
28
+ render() {
29
+ const profile = this.getContent('profile.json');
30
+ return html`
31
+ <div class="section">
32
+ <h3>Profile <span class="required-badge">Required</span></h3>
33
+ <p class="help-text">This file contains your profile information (name, title, experience).</p>
34
+
35
+ ${profile ? html`
36
+ <div class="current-file">
37
+ <strong>Current:</strong> profile.json (${profile.size} bytes)
38
+ <button class="btn-danger" @click=${this.handleDelete}>Delete</button>
39
+ </div>
40
+ ` : ''}
41
+
42
+ <input type="file" id="profileFile" accept=".json" />
43
+ <button class="btn-primary" @click=${this.handleUpload}>Upload profile.json</button>
44
+ </div>
45
+ `;
46
+ }
47
+ }
@@ -0,0 +1,67 @@
1
+ import { html } from 'lit';
2
+ import { customElement, state } from 'lit/decorators.js';
3
+ import { AdminSection } from './AdminSection';
4
+
5
+ @customElement('admin-static-section')
6
+ export class AdminStaticSection extends AdminSection {
7
+ @state()
8
+ accessor localDetails = { ...this.staticDetails };
9
+
10
+ private async handleSave() {
11
+ const siteTitle = (this.shadowRoot?.querySelector('#siteTitle') as HTMLInputElement)?.value;
12
+ const copyright = (this.shadowRoot?.querySelector('#copyright') as HTMLInputElement)?.value;
13
+ const linkedin = (this.shadowRoot?.querySelector('#linkedin') as HTMLInputElement)?.value;
14
+ const github = (this.shadowRoot?.querySelector('#github') as HTMLInputElement)?.value;
15
+ const email = (this.shadowRoot?.querySelector('#email') as HTMLInputElement)?.value;
16
+
17
+ const data: Record<string, string> = {};
18
+ if (siteTitle) data.siteTitle = siteTitle;
19
+ if (copyright) data.copyright = copyright;
20
+ if (linkedin) data.linkedin = linkedin;
21
+ if (github) data.github = github;
22
+ if (email) data.email = email;
23
+
24
+ try {
25
+ await this.onUpload('staticdetails.json', new File([JSON.stringify(data)], 'staticdetails.json', { type: 'application/json' }));
26
+ this.onStatusMessage('Settings saved!');
27
+ } catch (e) {
28
+ this.onStatusMessage('Failed to save settings.');
29
+ }
30
+ }
31
+
32
+ render() {
33
+ return html`
34
+ <div class="section">
35
+ <h3>Site Settings</h3>
36
+ <p class="help-text">Manage your site's static details like title, footer links, etc.</p>
37
+
38
+ <div class="mb-1">
39
+ <label style="display:block;margin-bottom:4px;font-weight:500">Site Title</label>
40
+ <input type="text" id="siteTitle" .value=${this.staticDetails?.siteTitle || ''} />
41
+ </div>
42
+
43
+ <div class="mb-1">
44
+ <label style="display:block;margin-bottom:4px;font-weight:500">Copyright Text</label>
45
+ <input type="text" id="copyright" .value=${this.staticDetails?.copyright || ''} />
46
+ </div>
47
+
48
+ <div class="mb-1">
49
+ <label style="display:block;margin-bottom:4px;font-weight:500">LinkedIn URL</label>
50
+ <input type="text" id="linkedin" .value=${this.staticDetails?.linkedin || ''} />
51
+ </div>
52
+
53
+ <div class="mb-1">
54
+ <label style="display:block;margin-bottom:4px;font-weight:500">GitHub URL</label>
55
+ <input type="text" id="github" .value=${this.staticDetails?.github || ''} />
56
+ </div>
57
+
58
+ <div class="mb-1">
59
+ <label style="display:block;margin-bottom:4px;font-weight:500">Email</label>
60
+ <input type="text" id="email" .value=${this.staticDetails?.email || ''} />
61
+ </div>
62
+
63
+ <button class="btn-primary" @click=${this.handleSave}>Save Settings</button>
64
+ </div>
65
+ `;
66
+ }
67
+ }
@@ -0,0 +1,62 @@
1
+ import { html } from 'lit';
2
+ import { customElement } from 'lit/decorators.js';
3
+ import { AdminSection } from './AdminSection';
4
+
5
+ @customElement('admin-stories-section')
6
+ export class AdminStoriesSection extends AdminSection {
7
+ private async handleUpload() {
8
+ const metaInput = this.shadowRoot?.querySelector('#storyMetaFile') as HTMLInputElement;
9
+ const contentInput = this.shadowRoot?.querySelector('#storyContentFile') as HTMLInputElement;
10
+ const slugInput = this.shadowRoot?.querySelector('#storySlug') as HTMLInputElement;
11
+
12
+ if (metaInput.files?.[0] && contentInput.files?.[0] && slugInput.value) {
13
+ try {
14
+ await this.onUpload(`stories/${slugInput.value}.json`, metaInput.files[0]);
15
+ await this.onUpload(`stories/${slugInput.value}.md`, contentInput.files[0]);
16
+ this.onStatusMessage('Upload successful!');
17
+ } catch (e) {
18
+ this.onStatusMessage('Upload failed.');
19
+ }
20
+ }
21
+ }
22
+
23
+ private async handleDelete(slug: string) {
24
+ if (!confirm(`Delete story ${slug}?`)) return;
25
+ try {
26
+ await this.onDelete(`stories/${slug}.json`);
27
+ await this.onDelete(`stories/${slug}.md`);
28
+ } catch (e) {
29
+ this.onStatusMessage('Delete failed.');
30
+ }
31
+ }
32
+
33
+ render() {
34
+ const stories = this.getSectionFiles('stories/').filter(s => s.key.endsWith('.json'));
35
+ return html`
36
+ <div class="section">
37
+ <h3>Stories</h3>
38
+ <p class="help-text">Each story needs 2 files: a JSON (metadata) and MD (content) file.</p>
39
+
40
+ <h4>Upload New Story</h4>
41
+ <input type="file" id="storyMetaFile" accept=".json" />
42
+ <input type="file" id="storyContentFile" accept=".md" />
43
+ <input type="text" id="storySlug" placeholder="Slug (e.g., my-story)" class="mt-1" />
44
+ <button class="btn-primary" @click=${this.handleUpload}>Upload Story (JSON + MD)</button>
45
+
46
+ <div class="file-list">
47
+ <h4>Current Stories (${stories.length})</h4>
48
+ ${stories.map(s => {
49
+ const slug = s.key.replace('stories/', '').replace('.json', '');
50
+ return html`
51
+ <div class="file-item">
52
+ <span>${s.key.replace('.json', '')}</span>
53
+ <button class="btn-danger" @click=${() => this.handleDelete(slug)}>Delete</button>
54
+ </div>
55
+ `;
56
+ })}
57
+ ${stories.length === 0 ? html`<p>No stories yet.</p>` : ''}
58
+ </div>
59
+ </div>
60
+ `;
61
+ }
62
+ }
@@ -0,0 +1,10 @@
1
+ export * from './AdminSection';
2
+ export * from './LoginForm';
3
+ export * from './HomeSection';
4
+ export * from './ProfileSection';
5
+ export * from './AboutMeSection';
6
+ export * from './BlogsSection';
7
+ export * from './StoriesSection';
8
+ export * from './ImagesSection';
9
+ export * from './LogoSection';
10
+ export * from './StaticSection';