methanol 0.0.6 → 0.0.7
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/package.json
CHANGED
package/src/pages.js
CHANGED
|
@@ -273,7 +273,10 @@ const buildPagesTree = (pages, options = {}) => {
|
|
|
273
273
|
const shouldExposeHidden =
|
|
274
274
|
!isHidden404 &&
|
|
275
275
|
page.hiddenByFrontmatter === true &&
|
|
276
|
-
(
|
|
276
|
+
(
|
|
277
|
+
page.routePath === currentRoutePath ||
|
|
278
|
+
(page.isIndex && page.dir && isUnderExposedHiddenDir(page.dir))
|
|
279
|
+
)
|
|
277
280
|
if (!shouldExposeHidden) {
|
|
278
281
|
continue
|
|
279
282
|
}
|
package/src/public-assets.js
CHANGED
|
@@ -48,7 +48,7 @@ const linkOrCopyFile = async (src, dest) => {
|
|
|
48
48
|
|
|
49
49
|
try {
|
|
50
50
|
await ensureDir(dirname(dest))
|
|
51
|
-
|
|
51
|
+
|
|
52
52
|
if (isWindows) {
|
|
53
53
|
// Windows: Check for different drives first
|
|
54
54
|
if (parse(src).root.toLowerCase() !== parse(dest).root.toLowerCase()) {
|
|
@@ -85,7 +85,7 @@ const processDir = async (sourceDir, targetDir, accumulated = new Set()) => {
|
|
|
85
85
|
const sourcePath = resolve(sourceDir, entry)
|
|
86
86
|
const targetPath = resolve(targetDir, entry)
|
|
87
87
|
const stats = await stat(sourcePath)
|
|
88
|
-
|
|
88
|
+
|
|
89
89
|
if (stats.isDirectory()) {
|
|
90
90
|
await processDir(sourcePath, targetPath, accumulated)
|
|
91
91
|
} else {
|
|
@@ -104,7 +104,7 @@ export const preparePublicAssets = async ({ themeDir, userDir, targetDir }) => {
|
|
|
104
104
|
if (themeDir) {
|
|
105
105
|
await processDir(themeDir, targetDir)
|
|
106
106
|
}
|
|
107
|
-
|
|
107
|
+
|
|
108
108
|
if (userDir) {
|
|
109
109
|
await processDir(userDir, targetDir)
|
|
110
110
|
}
|
|
@@ -112,7 +112,7 @@ export const preparePublicAssets = async ({ themeDir, userDir, targetDir }) => {
|
|
|
112
112
|
|
|
113
113
|
export const updateAsset = async ({ type, filePath, themeDir, userDir, targetDir, relPath }) => {
|
|
114
114
|
const targetPath = resolve(targetDir, relPath)
|
|
115
|
-
|
|
115
|
+
|
|
116
116
|
if (type === 'unlink') {
|
|
117
117
|
try {
|
|
118
118
|
try {
|
|
@@ -122,7 +122,7 @@ export const updateAsset = async ({ type, filePath, themeDir, userDir, targetDir
|
|
|
122
122
|
await rm(targetPath, { recursive: true, force: true })
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
|
|
125
|
+
|
|
126
126
|
if (themeDir) {
|
|
127
127
|
const themePath = resolve(themeDir, relPath)
|
|
128
128
|
if (existsSync(themePath)) {
|
|
@@ -141,4 +141,4 @@ export const updateAsset = async ({ type, filePath, themeDir, userDir, targetDir
|
|
|
141
141
|
return 'updated'
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
-
}
|
|
144
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/* Copyright Yukino Song, SudoMaker Ltd.
|
|
2
|
+
*
|
|
3
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
|
4
|
+
* or more contributor license agreements. See the NOTICE file
|
|
5
|
+
* distributed with this work for additional information
|
|
6
|
+
* regarding copyright ownership. The ASF licenses this file
|
|
7
|
+
* to you under the Apache License, Version 2.0 (the
|
|
8
|
+
* "License"); you may not use this file except in compliance
|
|
9
|
+
* with the License. You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing,
|
|
14
|
+
* software distributed under the License is distributed on an
|
|
15
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
+
* KIND, either express or implied. See the License for the
|
|
17
|
+
* specific language governing permissions and limitations
|
|
18
|
+
* under the License.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
export default function ButtonGroup({
|
|
22
|
+
children,
|
|
23
|
+
className = '',
|
|
24
|
+
align = 'left', // left, center, right
|
|
25
|
+
...props
|
|
26
|
+
}) {
|
|
27
|
+
const classes = [
|
|
28
|
+
'button-group',
|
|
29
|
+
`button-group--${align}`,
|
|
30
|
+
className
|
|
31
|
+
].filter(Boolean).join(' ')
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<div class={classes} {...props}>
|
|
35
|
+
{children}
|
|
36
|
+
</div>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/* Copyright Yukino Song, SudoMaker Ltd.
|
|
2
|
+
*
|
|
3
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
|
4
|
+
* or more contributor license agreements. See the NOTICE file
|
|
5
|
+
* distributed with this work for additional information
|
|
6
|
+
* regarding copyright ownership. The ASF licenses this file
|
|
7
|
+
* to you under the Apache License, Version 2.0 (the
|
|
8
|
+
* "License"); you may not use this file except in compliance
|
|
9
|
+
* with the License. You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing,
|
|
14
|
+
* software distributed under the License is distributed on an
|
|
15
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
+
* KIND, either express or implied. See the License for the
|
|
17
|
+
* specific language governing permissions and limitations
|
|
18
|
+
* under the License.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
export default function LinkButton({
|
|
22
|
+
children,
|
|
23
|
+
variant = 'primary', // primary, secondary, outline, ghost
|
|
24
|
+
size = 'md', // sm, md, lg
|
|
25
|
+
class: className = '',
|
|
26
|
+
...props
|
|
27
|
+
}) {
|
|
28
|
+
const classes = ['link-button', `link-button--${variant}`, `link-button--${size}`, className]
|
|
29
|
+
.filter(Boolean)
|
|
30
|
+
.join(' ')
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<a class={classes} {...props}>
|
|
34
|
+
{children}
|
|
35
|
+
</a>
|
|
36
|
+
)
|
|
37
|
+
}
|
package/themes/default/page.jsx
CHANGED
|
@@ -89,8 +89,9 @@ const PAGE_TEMPLATE = ({ Page, ExtraHead, components, ctx }) => {
|
|
|
89
89
|
const logo = pageFrontmatter.logo ?? rootFrontmatter.logo ?? ctx.site?.logo ?? themeLogo
|
|
90
90
|
const favicon = pageFrontmatter.favicon ?? rootFrontmatter.favicon ?? ctx.site?.favicon ?? themeFavIcon
|
|
91
91
|
const excerpt = pageFrontmatter.excerpt ?? `${title} | ${siteName} - Powered by Methanol`
|
|
92
|
-
const
|
|
93
|
-
const
|
|
92
|
+
const _ogTitle = pageFrontmatter.ogTitle ?? title ?? null
|
|
93
|
+
const ogTitle = _ogTitle ? `${_ogTitle} | ${siteName}` : null
|
|
94
|
+
const ogDescription = pageFrontmatter.ogDescription ?? excerpt ?? null
|
|
94
95
|
const ogImage = pageFrontmatter.ogImage ?? null
|
|
95
96
|
const ogUrl = pageFrontmatter.ogUrl ?? null
|
|
96
97
|
const twitterTitle = pageFrontmatter.twitterTitle ?? ogTitle
|
|
@@ -1627,6 +1627,110 @@ a {
|
|
|
1627
1627
|
}
|
|
1628
1628
|
}
|
|
1629
1629
|
|
|
1630
|
+
/* --- Components --- */
|
|
1631
|
+
|
|
1632
|
+
.link-button {
|
|
1633
|
+
display: inline-flex;
|
|
1634
|
+
align-items: center;
|
|
1635
|
+
justify-content: center;
|
|
1636
|
+
font-weight: 600;
|
|
1637
|
+
border-radius: 999px;
|
|
1638
|
+
text-decoration: none !important;
|
|
1639
|
+
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
|
1640
|
+
cursor: pointer;
|
|
1641
|
+
line-height: 1;
|
|
1642
|
+
gap: 0.5rem;
|
|
1643
|
+
white-space: nowrap;
|
|
1644
|
+
}
|
|
1645
|
+
|
|
1646
|
+
.link-button:active {
|
|
1647
|
+
transform: scale(0.96);
|
|
1648
|
+
}
|
|
1649
|
+
|
|
1650
|
+
/* Variants */
|
|
1651
|
+
.link-button--primary {
|
|
1652
|
+
background-color: var(--accent);
|
|
1653
|
+
color: var(--accent-foreground);
|
|
1654
|
+
border: 1px solid transparent;
|
|
1655
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
1656
|
+
|
|
1657
|
+
&:hover {
|
|
1658
|
+
opacity: 0.9;
|
|
1659
|
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
|
|
1660
|
+
transform: translateY(-1px);
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1664
|
+
.link-button--secondary {
|
|
1665
|
+
background-color: var(--surface-elevated);
|
|
1666
|
+
color: var(--text);
|
|
1667
|
+
border: 1px solid var(--border);
|
|
1668
|
+
|
|
1669
|
+
&:hover {
|
|
1670
|
+
background-color: var(--surface-muted);
|
|
1671
|
+
border-color: var(--muted);
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
|
|
1675
|
+
.link-button--outline {
|
|
1676
|
+
background-color: transparent;
|
|
1677
|
+
color: var(--text);
|
|
1678
|
+
border: 1px solid var(--border);
|
|
1679
|
+
|
|
1680
|
+
&:hover {
|
|
1681
|
+
border-color: var(--accent);
|
|
1682
|
+
color: var(--accent);
|
|
1683
|
+
background-color: var(--accent-soft);
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1686
|
+
|
|
1687
|
+
.link-button--ghost {
|
|
1688
|
+
background-color: transparent;
|
|
1689
|
+
color: var(--muted);
|
|
1690
|
+
border: 1px solid transparent;
|
|
1691
|
+
|
|
1692
|
+
&:hover {
|
|
1693
|
+
color: var(--accent);
|
|
1694
|
+
background-color: var(--accent-soft);
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
/* Sizes */
|
|
1699
|
+
.link-button--sm {
|
|
1700
|
+
padding: 0.375rem 0.75rem;
|
|
1701
|
+
font-size: 0.85rem;
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1704
|
+
.link-button--md {
|
|
1705
|
+
padding: 0.625rem 1.25rem;
|
|
1706
|
+
font-size: 0.95rem;
|
|
1707
|
+
}
|
|
1708
|
+
|
|
1709
|
+
.link-button--lg {
|
|
1710
|
+
padding: 0.875rem 1.75rem;
|
|
1711
|
+
font-size: 1.1rem;
|
|
1712
|
+
}
|
|
1713
|
+
|
|
1714
|
+
.button-group {
|
|
1715
|
+
display: flex;
|
|
1716
|
+
flex-wrap: wrap;
|
|
1717
|
+
gap: 1rem;
|
|
1718
|
+
margin: 1.5rem 0;
|
|
1719
|
+
align-items: center;
|
|
1720
|
+
}
|
|
1721
|
+
|
|
1722
|
+
.button-group--left {
|
|
1723
|
+
justify-content: flex-start;
|
|
1724
|
+
}
|
|
1725
|
+
|
|
1726
|
+
.button-group--center {
|
|
1727
|
+
justify-content: center;
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1730
|
+
.button-group--right {
|
|
1731
|
+
justify-content: flex-end;
|
|
1732
|
+
}
|
|
1733
|
+
|
|
1630
1734
|
/* --- View Transitions --- */
|
|
1631
1735
|
|
|
1632
1736
|
@view-transition {
|