Repository navigation
Expand file tree
/
Copy pathrocket-config.js
More file actions
112 lines (108 loc) · 3.37 KB
/
Copy pathrocket-config.js
File metadata and controls
112 lines (108 loc) · 3.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import { readFileSync } from 'node:fs';
const logoMark = readFileSync(
new URL('./public/open-wc-components-mark.svg', import.meta.url),
'utf8',
).replace('<svg ', '<svg class="mark" ');
/**
* @param {string} value
*/
function escapeHtml(value) {
return value
.replaceAll('&', '&')
.replaceAll('"', '"')
.replaceAll("'", ''')
.replaceAll('<', '<')
.replaceAll('>', '>');
}
/**
* The image link previews show when a page is shared (1200×630).
*
* @type {import('@rocket/js/types.js').SocialPreviewTemplate}
*/
function socialPreviewTemplate({ site, page }) {
const url = page.canonicalUrl.replace(/^https?:\/\//, '').replace(/\/$/, '');
return `<!doctype html>
<html lang="${escapeHtml(site.language)}">
<head>
<meta charset="utf-8">
<style>
* { box-sizing: border-box; }
html, body { width: 1200px; height: 630px; margin: 0; }
body {
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 72px 80px 64px;
color: #0b1220;
font-family: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
background:
radial-gradient(circle at 92% 8%, rgba(155, 0, 255, 0.2), transparent 42%),
radial-gradient(circle at 70% 105%, rgba(0, 119, 255, 0.2), transparent 46%),
#ffffff;
}
header { display: flex; align-items: center; gap: 22px; }
.mark { width: 84px; height: 84px; }
.name { font-size: 38px; letter-spacing: -0.01em; }
.name span { color: #64748b; font-weight: 500; }
.name b { font-weight: 800; }
h1 {
max-width: 980px;
margin: 0;
font-size: 82px;
font-weight: 800;
line-height: 1.04;
letter-spacing: -0.03em;
}
h1.long { font-size: 64px; }
.description {
display: -webkit-box;
max-width: 960px;
margin: 26px 0 0;
overflow: hidden;
color: #475569;
font-size: 32px;
line-height: 1.32;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
footer { display: flex; align-items: center; gap: 18px; color: #64748b; font-size: 26px; }
footer i {
width: 64px;
height: 8px;
border-radius: 4px;
background: linear-gradient(90deg, #9b00ff, #0077ff);
}
</style>
</head>
<body>
<header>
${logoMark}
<div class="name"><span>@open-wc/</span><b>components</b></div>
</header>
<main>
<h1 class="${page.title.length > 28 ? 'long' : ''}">${escapeHtml(page.title)}</h1>
<p class="description">${escapeHtml(page.description)}</p>
</main>
<footer><i></i>${escapeHtml(url)}</footer>
</body>
</html>`;
}
/** @type {import('@rocket/js/types.js').RocketConfig} */
export default {
includeGlobs: ['*.rocket.{md,js}', 'src/**/*.rocket.{md,js}', 'docs/**/*.rocket.{md,js}'],
siteHeadMetadata: {
language: 'en-US',
siteName: '@open-wc/components',
defaultDescription:
'Web components for data-heavy interfaces: tables, forms, and workflow UI as framework-agnostic Lit components.',
icons: {
svg: '/open-wc-components-mark.svg',
},
themeColor: '#4f3bf6',
socialPreview: {
delivery: 'static',
template: socialPreviewTemplate,
},
},
siteOrigin: 'https://components.open-wc.org/',
};