@leadertechie/personal-site-kit 0.1.0-alpha.8 → 0.1.0-alpha.9
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/dist/api/content-utils.d.ts +27 -0
- package/dist/api/content-utils.d.ts.map +1 -0
- package/dist/api/handlers/content-api.d.ts +0 -1
- package/dist/api/handlers/content-api.d.ts.map +1 -1
- package/dist/api.js +2 -2
- package/dist/chunks/{index-CYd_Pe2U.js → index-CnSEOZse.js} +81 -121
- package/dist/chunks/{template-D1uGvdWZ.js → template-DWcsZW22.js} +1 -1
- package/dist/chunks/{website-api-FLejlWxJ.js → website-api-BEYGOsT3.js} +90 -131
- package/dist/index.js +3 -3
- package/dist/shared.js +1 -1
- package/dist/ui/admin/index.d.ts +8 -0
- package/dist/ui/admin/index.d.ts.map +1 -1
- package/dist/ui.js +1 -1
- package/package.json +4 -4
- package/src/api/__tests__/info.test.ts +0 -44
- package/src/api/__tests__/utils.test.ts +0 -78
- package/src/api/handlers/about-me.ts +0 -109
- package/src/api/handlers/auth-handler.ts +0 -204
- package/src/api/handlers/auth.ts +0 -157
- package/src/api/handlers/content-api.ts +0 -268
- package/src/api/handlers/content.ts +0 -139
- package/src/api/handlers/home.ts +0 -79
- package/src/api/handlers/info.ts +0 -12
- package/src/api/handlers/logo.ts +0 -55
- package/src/api/handlers/static-details.ts +0 -48
- package/src/api/index.ts +0 -9
- package/src/api/utils.ts +0 -16
- package/src/api/website-api.ts +0 -142
- package/src/index.ts +0 -4
- package/src/prerender/__tests__/page-content.test.ts +0 -44
- package/src/prerender/__tests__/template.test.ts +0 -54
- package/src/prerender/data-fetcher.ts +0 -93
- package/src/prerender/index.ts +0 -7
- package/src/prerender/page-content.ts +0 -266
- package/src/prerender/page-generators/about.ts +0 -38
- package/src/prerender/page-generators/base.ts +0 -77
- package/src/prerender/page-generators/blog-detail.ts +0 -35
- package/src/prerender/page-generators/blogs-list.ts +0 -43
- package/src/prerender/page-generators/home.ts +0 -54
- package/src/prerender/page-generators/index.ts +0 -8
- package/src/prerender/page-generators/not-found.ts +0 -36
- package/src/prerender/page-generators/stories-list.ts +0 -43
- package/src/prerender/page-generators/story-detail.ts +0 -35
- package/src/prerender/prerender.ts +0 -25
- package/src/prerender/template.ts +0 -65
- package/src/prerender/website-prerender.ts +0 -152
- package/src/shared/config/api.ts +0 -16
- package/src/shared/config/index.ts +0 -43
- package/src/shared/config/types.ts +0 -16
- package/src/shared/core/__tests__/theme-toggle.test.ts +0 -204
- package/src/shared/core/site-store.ts +0 -38
- package/src/shared/core/theme-toggle.ts +0 -118
- package/src/shared/index.ts +0 -17
- package/src/shared/interfaces/ifooter-link.ts +0 -4
- package/src/shared/interfaces/iroute.ts +0 -4
- package/src/shared/models/theme-variables.css +0 -25
- package/src/shared/page-content.ts +0 -210
- package/src/shared/router.ts +0 -250
- package/src/shared/runtime.ts +0 -11
- package/src/shared/template.ts +0 -35
- package/src/shared/website-ui.ts +0 -92
- package/src/styles/markdown.css +0 -129
- package/src/ui/about-me/api.ts +0 -12
- package/src/ui/about-me/index.ts +0 -121
- package/src/ui/about-me/styles.ts +0 -85
- package/src/ui/admin/api.ts +0 -93
- package/src/ui/admin/components/AboutMeSection.ts +0 -47
- package/src/ui/admin/components/AdminSection.ts +0 -134
- package/src/ui/admin/components/BlogsSection.ts +0 -62
- package/src/ui/admin/components/HomeSection.ts +0 -47
- package/src/ui/admin/components/ImagesSection.ts +0 -54
- package/src/ui/admin/components/LoginForm.ts +0 -116
- package/src/ui/admin/components/LogoSection.ts +0 -51
- package/src/ui/admin/components/ProfileSection.ts +0 -47
- package/src/ui/admin/components/StaticSection.ts +0 -67
- package/src/ui/admin/components/StoriesSection.ts +0 -62
- package/src/ui/admin/components/index.ts +0 -10
- package/src/ui/admin/index.ts +0 -413
- package/src/ui/admin/styles.ts +0 -270
- package/src/ui/admin/types.ts +0 -26
- package/src/ui/banner/index.ts +0 -38
- package/src/ui/banner/styles.ts +0 -95
- package/src/ui/blog-viewer/__tests__/blogviewer.test.ts +0 -7
- package/src/ui/blog-viewer/index.ts +0 -127
- package/src/ui/blog-viewer/styles.ts +0 -23
- package/src/ui/footer/index.ts +0 -37
- package/src/ui/footer/styles.ts +0 -50
- package/src/ui/index.ts +0 -13
- package/src/ui/story-viewer/__tests__/storyviewer.test.ts +0 -7
- package/src/ui/story-viewer/index.ts +0 -123
- package/src/ui/story-viewer/styles.ts +0 -54
- /package/{src/shared → dist}/styles/markdown.css +0 -0
- /package/{src → dist}/styles/theme.css +0 -0
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { LitElement, html, css } from 'lit';
|
|
2
|
-
import { customElement, property, state } from 'lit/decorators.js';
|
|
3
|
-
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
|
4
|
-
import { MarkdownPipeline } from '@leadertechie/md2html';
|
|
5
|
-
|
|
6
|
-
import { storyviewerStyles } from './styles';
|
|
7
|
-
|
|
8
|
-
const pipeline = new MarkdownPipeline({
|
|
9
|
-
imagePathPrefix: 'images/',
|
|
10
|
-
styleOptions: {
|
|
11
|
-
classPrefix: 'md-',
|
|
12
|
-
addHeadingIds: true
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
interface StoryPost {
|
|
17
|
-
title: string;
|
|
18
|
-
description: string;
|
|
19
|
-
date: string;
|
|
20
|
-
tags: string[];
|
|
21
|
-
author: string;
|
|
22
|
-
imageUrl: string;
|
|
23
|
-
content: string;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
@customElement('my-story-viewer')
|
|
27
|
-
export class StoryViewer extends LitElement {
|
|
28
|
-
static styles = storyviewerStyles;
|
|
29
|
-
|
|
30
|
-
@property({ type: String })
|
|
31
|
-
accessor slug = '';
|
|
32
|
-
|
|
33
|
-
@state()
|
|
34
|
-
accessor storyPost: StoryPost | null = null;
|
|
35
|
-
|
|
36
|
-
@state()
|
|
37
|
-
accessor loading = true;
|
|
38
|
-
|
|
39
|
-
@state()
|
|
40
|
-
accessor error = '';
|
|
41
|
-
|
|
42
|
-
private get apiBaseUrl(): string {
|
|
43
|
-
return this.getAttribute('api-url') ||
|
|
44
|
-
(window as any).__VITE_API_URL__ ||
|
|
45
|
-
import.meta.env.VITE_API_URL ||
|
|
46
|
-
'https://api.exampledomain.com';
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
async connectedCallback() {
|
|
50
|
-
super.connectedCallback();
|
|
51
|
-
if (this.slug) {
|
|
52
|
-
await this.loadStory();
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
updated(changedProperties: Map<string, any>) {
|
|
57
|
-
if (changedProperties.has('slug') && this.slug) {
|
|
58
|
-
this.loadStory();
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
async loadStory() {
|
|
63
|
-
this.loading = true;
|
|
64
|
-
this.error = '';
|
|
65
|
-
|
|
66
|
-
try {
|
|
67
|
-
const res = await fetch(`${this.apiBaseUrl}/api/stories/${this.slug}`);
|
|
68
|
-
if (res.ok) {
|
|
69
|
-
const story = await res.json();
|
|
70
|
-
if (story && story.content) {
|
|
71
|
-
this.storyPost = story;
|
|
72
|
-
} else {
|
|
73
|
-
this.error = 'Story content not found';
|
|
74
|
-
}
|
|
75
|
-
} else {
|
|
76
|
-
this.error = 'Story not found';
|
|
77
|
-
}
|
|
78
|
-
} catch (e) {
|
|
79
|
-
this.error = 'Failed to load story';
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
this.loading = false;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
render() {
|
|
86
|
-
if (this.loading) {
|
|
87
|
-
return html`<div class="loading">Loading...</div>`;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if (this.error) {
|
|
91
|
-
return html`<div class="error">${this.error}</div>`;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (!this.storyPost) {
|
|
95
|
-
return html`<div class="error">Story not found</div>`;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
const { title, date, tags, content } = this.storyPost;
|
|
99
|
-
|
|
100
|
-
return html`
|
|
101
|
-
<article>
|
|
102
|
-
<h1>${title}</h1>
|
|
103
|
-
<div class="meta">
|
|
104
|
-
<span>${date}</span>
|
|
105
|
-
</div>
|
|
106
|
-
${tags?.length ? html`
|
|
107
|
-
<div class="tags">
|
|
108
|
-
${tags.map(tag => html`<span class="tag">${tag}</span>`)}
|
|
109
|
-
</div>
|
|
110
|
-
` : ''}
|
|
111
|
-
<div class="content">
|
|
112
|
-
${unsafeHTML(this.renderMarkdown(content))}
|
|
113
|
-
</div>
|
|
114
|
-
</article>
|
|
115
|
-
`;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
private renderMarkdown(content: string): string {
|
|
119
|
-
if (!content) return '';
|
|
120
|
-
const nodes = pipeline.parse(content);
|
|
121
|
-
return pipeline.render(nodes);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { css } from 'lit';
|
|
2
|
-
|
|
3
|
-
export const storyviewerStyles = css`
|
|
4
|
-
:host {
|
|
5
|
-
display: block;
|
|
6
|
-
max-width: 800px;
|
|
7
|
-
margin: 0 auto;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.loading {
|
|
11
|
-
text-align: center;
|
|
12
|
-
padding: 2rem;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.error {
|
|
16
|
-
color: red;
|
|
17
|
-
text-align: center;
|
|
18
|
-
padding: 2rem;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
h1 {
|
|
22
|
-
margin-bottom: 0.5rem;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.meta {
|
|
26
|
-
color: #666;
|
|
27
|
-
margin-bottom: 2rem;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.tags {
|
|
31
|
-
display: flex;
|
|
32
|
-
gap: 0.5rem;
|
|
33
|
-
flex-wrap: wrap;
|
|
34
|
-
margin-top: 1rem;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.tag {
|
|
38
|
-
background: var(--nav-link-hover-bg, #f0f0f0);
|
|
39
|
-
color: var(--text-color, #333);
|
|
40
|
-
padding: 0.25rem 0.5rem;
|
|
41
|
-
border-radius: 4px;
|
|
42
|
-
font-size: 0.875rem;
|
|
43
|
-
border: 1px solid var(--border-color, transparent);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.content {
|
|
47
|
-
line-height: 1.8;
|
|
48
|
-
text-align: left;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.content h1, .content h2, .content h3 {
|
|
52
|
-
margin-top: 1.5rem;
|
|
53
|
-
}
|
|
54
|
-
`;
|
|
File without changes
|
|
File without changes
|