methanol 0.0.18 → 0.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/package.json +2 -2
- package/src/build-system.js +76 -19
- package/src/components.js +2 -0
- package/src/config.js +41 -0
- package/src/dev-server.js +6 -4
- package/src/feed.js +198 -0
- package/src/main.js +6 -1
- package/src/mdx.js +48 -24
- package/src/pages.js +105 -111
- package/src/reframe.js +19 -2
- package/src/state.js +22 -0
- package/src/templates/atom-feed.jsx +61 -0
- package/src/{error-page.jsx → templates/error-page.jsx} +2 -2
- package/src/templates/rss-feed.jsx +60 -0
- package/src/workers/build-pool.js +10 -1
- package/src/workers/build-worker.js +51 -21
- package/themes/README.md +52 -0
- package/themes/blog/README.md +34 -14
- package/themes/blog/sources/style.css +44 -4
- package/themes/blog/src/layout-categories.jsx +2 -2
- package/themes/blog/src/layout-collections.jsx +2 -2
- package/themes/blog/src/layout-home.jsx +2 -2
- package/themes/blog/src/page.jsx +55 -6
- package/themes/blog/src/post-utils.js +13 -3
- package/themes/default/README.md +26 -0
- package/themes/default/components/ThemeColorSwitch.client.jsx +13 -0
- package/themes/default/sources/style.css +27 -1
- package/themes/default/sources/theme-prepare.js +13 -0
- package/themes/default/src/nav-tree.jsx +70 -55
- package/themes/default/src/page.jsx +25 -0
|
@@ -45,63 +45,78 @@ const toSignal = (i) => {
|
|
|
45
45
|
return sig
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
</ul>
|
|
87
|
-
)}
|
|
88
|
-
</If>
|
|
89
|
-
</details>
|
|
90
|
-
</li>
|
|
91
|
-
)
|
|
92
|
-
} else {
|
|
93
|
-
const label = title.or(node.isIndex ? 'Home' : name)
|
|
94
|
-
return (
|
|
95
|
-
<li>
|
|
96
|
-
<a class={isActive.choose('active', null)} href={href}>
|
|
48
|
+
const filterVisible = (items) => {
|
|
49
|
+
if (!Array.isArray(items)) return []
|
|
50
|
+
return items.filter(({ value: item }) => {
|
|
51
|
+
if (!item.hidden) {
|
|
52
|
+
return true
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const _currentPath = currentPath.value
|
|
56
|
+
return _currentPath.startsWith(item.routePath)
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const NavTree = ({ nodes, depth }) => {
|
|
61
|
+
const filtered = signal(nodes, filterVisible)
|
|
62
|
+
return (
|
|
63
|
+
<For entries={filtered}>
|
|
64
|
+
{({ item }) => {
|
|
65
|
+
const node = read(item)
|
|
66
|
+
const { routeHref: href, routePath, type, name, isRoot } = node
|
|
67
|
+
const { title } = extract(item, 'title')
|
|
68
|
+
|
|
69
|
+
const isActive = matchCurrentPath(routePath)
|
|
70
|
+
|
|
71
|
+
if (type === 'directory') {
|
|
72
|
+
const label = title.or(name)
|
|
73
|
+
const { children } = extract(item, 'children')
|
|
74
|
+
|
|
75
|
+
const isOpen = $(() => {
|
|
76
|
+
if (depth < 1) {
|
|
77
|
+
return true
|
|
78
|
+
}
|
|
79
|
+
const _active = isActive.value
|
|
80
|
+
const _currentPath = currentPath.value
|
|
81
|
+
return _active || _currentPath.startsWith(routePath)
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
const header = href ? (
|
|
85
|
+
<a class={isActive.choose('nav-dir-link active', 'nav-dir-link')} href={href}>
|
|
97
86
|
{label}
|
|
98
87
|
</a>
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
)
|
|
88
|
+
) : (
|
|
89
|
+
<span class="nav-dir-label">{label}</span>
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<li class={isActive.choose('is-active', null)}>
|
|
94
|
+
<details class="sidebar-collapsible" open={isOpen.choose(true, null)}>
|
|
95
|
+
<summary class="sb-dir-header">{header}</summary>
|
|
96
|
+
<If condition={() => children.value.length}>
|
|
97
|
+
{() => (
|
|
98
|
+
<ul data-depth={depth + 1}>
|
|
99
|
+
<NavTree nodes={children} depth={depth + 1} />
|
|
100
|
+
</ul>
|
|
101
|
+
)}
|
|
102
|
+
</If>
|
|
103
|
+
</details>
|
|
104
|
+
</li>
|
|
105
|
+
)
|
|
106
|
+
} else {
|
|
107
|
+
const label = title.or(node.isIndex ? 'Home' : name)
|
|
108
|
+
return (
|
|
109
|
+
<li>
|
|
110
|
+
<a class={isActive.choose('active', null)} href={href}>
|
|
111
|
+
{label}
|
|
112
|
+
</a>
|
|
113
|
+
</li>
|
|
114
|
+
)
|
|
115
|
+
}
|
|
116
|
+
}}
|
|
117
|
+
</For>
|
|
118
|
+
)
|
|
119
|
+
}
|
|
105
120
|
|
|
106
121
|
const rootNodes = signal()
|
|
107
122
|
const rootTree = HTMLRenderer.createElement(NavTree, { nodes: rootNodes, depth: 0 })
|
|
@@ -61,6 +61,10 @@ const PAGE_TEMPLATE = ({ PageContent, ExtraHead, components, ctx }) => {
|
|
|
61
61
|
const htmlLang = typeof languageCode === 'string' && languageCode.trim() ? languageCode : 'en'
|
|
62
62
|
const pagefindEnabled = ctx.site.pagefind?.enabled !== false
|
|
63
63
|
const pagefindOptions = ctx.site.pagefind?.options || null
|
|
64
|
+
const feedInfo = ctx.site.feed
|
|
65
|
+
const rssHref = feedInfo?.enabled ? feedInfo.href : null
|
|
66
|
+
const feedType = feedInfo?.atom ? 'application/atom+xml' : 'application/rss+xml'
|
|
67
|
+
const feedLabel = feedInfo?.atom ? 'Atom' : 'RSS'
|
|
64
68
|
const repoBase = ctx.site.repoBase
|
|
65
69
|
const sourceUrl = pageFrontmatter.sourceURL
|
|
66
70
|
const editUrl = sourceUrl || (repoBase && page.relativePath ? new URL(page.relativePath, repoBase).href : null)
|
|
@@ -108,6 +112,8 @@ const PAGE_TEMPLATE = ({ PageContent, ExtraHead, components, ctx }) => {
|
|
|
108
112
|
<head>
|
|
109
113
|
<meta charset="UTF-8" />
|
|
110
114
|
<meta name="viewport" content="width=device-width" />
|
|
115
|
+
<meta name="theme-color" content="#ffffff" media="(prefers-color-scheme: light)" />
|
|
116
|
+
<meta name="theme-color" content="#09090b" media="(prefers-color-scheme: dark)" />
|
|
111
117
|
<title>
|
|
112
118
|
{title} | {siteName}
|
|
113
119
|
</title>
|
|
@@ -122,6 +128,7 @@ const PAGE_TEMPLATE = ({ PageContent, ExtraHead, components, ctx }) => {
|
|
|
122
128
|
{twitterTitle ? <meta name="twitter:title" content={twitterTitle} /> : null}
|
|
123
129
|
{twitterDescription ? <meta name="twitter:description" content={twitterDescription} /> : null}
|
|
124
130
|
{twitterImage ? <meta name="twitter:image" content={twitterImage} /> : null}
|
|
131
|
+
{rssHref ? <link rel="alternate" type={feedType} title={`${siteName} ${feedLabel}`} href={rssHref} /> : null}
|
|
125
132
|
<link
|
|
126
133
|
rel="preload stylesheet"
|
|
127
134
|
as="style"
|
|
@@ -205,6 +212,24 @@ const PAGE_TEMPLATE = ({ PageContent, ExtraHead, components, ctx }) => {
|
|
|
205
212
|
{languageSelector}
|
|
206
213
|
<ThemeColorSwitch />
|
|
207
214
|
<ThemeAccentSwitch />
|
|
215
|
+
{rssHref ? (
|
|
216
|
+
<a class="rss-link" href={rssHref} aria-label={feedLabel} title={feedLabel}>
|
|
217
|
+
<svg
|
|
218
|
+
width="18"
|
|
219
|
+
height="18"
|
|
220
|
+
viewBox="3 3 18 18"
|
|
221
|
+
fill="none"
|
|
222
|
+
stroke="currentColor"
|
|
223
|
+
stroke-width="2"
|
|
224
|
+
stroke-linecap="round"
|
|
225
|
+
stroke-linejoin="round"
|
|
226
|
+
>
|
|
227
|
+
<path d="M4 11a9 9 0 0 1 9 9"></path>
|
|
228
|
+
<path d="M4 4a16 16 0 0 1 16 16"></path>
|
|
229
|
+
<circle cx="5" cy="19" r="1"></circle>
|
|
230
|
+
</svg>
|
|
231
|
+
</a>
|
|
232
|
+
) : null}
|
|
208
233
|
</div>
|
|
209
234
|
</aside>
|
|
210
235
|
<main class="main-content" data-pagefind-body={pagefindEnabled ? '' : null}>
|