@casoon/pages-theme 0.0.0-stage → 0.12.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 (62) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +279 -2
  3. package/assets/casoon-logo-dark.svg +70 -0
  4. package/assets/casoon-logo.svg +71 -0
  5. package/assets/favicon.svg +1 -0
  6. package/components/AnchorGrid.astro +135 -0
  7. package/components/ApiEntry.astro +136 -0
  8. package/components/Badge.astro +31 -0
  9. package/components/Badges.astro +10 -0
  10. package/components/BuildOutput.astro +84 -0
  11. package/components/Button.astro +55 -0
  12. package/components/CallToAction.astro +64 -0
  13. package/components/Callout.astro +66 -0
  14. package/components/CodeBlock.astro +84 -0
  15. package/components/Demo.astro +80 -0
  16. package/components/ExamplePanel.astro +153 -0
  17. package/components/Facts.astro +112 -0
  18. package/components/Faq.astro +123 -0
  19. package/components/Features.astro +139 -0
  20. package/components/FileSet.astro +258 -0
  21. package/components/Footer.astro +160 -0
  22. package/components/Header.astro +278 -0
  23. package/components/Hero.astro +318 -0
  24. package/components/Install.astro +154 -0
  25. package/components/Integrations.astro +125 -0
  26. package/components/Keymap.astro +102 -0
  27. package/components/Quickstart.astro +95 -0
  28. package/components/ReleaseHighlights.astro +115 -0
  29. package/components/Spotlight.astro +177 -0
  30. package/components/Swatch.astro +45 -0
  31. package/components/Tabs.astro +90 -0
  32. package/components/Terminal.astro +79 -0
  33. package/components/index.ts +25 -0
  34. package/content.ts +23 -0
  35. package/fonts/OFL.txt +95 -0
  36. package/fonts/inter-latin-400-normal.woff2 +0 -0
  37. package/fonts/inter-latin-500-normal.woff2 +0 -0
  38. package/fonts/inter-latin-600-normal.woff2 +0 -0
  39. package/fonts/jetbrains-mono-latin-400-normal.woff2 +0 -0
  40. package/fonts/jetbrains-mono-latin-500-normal.woff2 +0 -0
  41. package/fonts/onest-latin-wght-normal.woff2 +0 -0
  42. package/index.ts +204 -0
  43. package/layouts/Base.astro +131 -0
  44. package/layouts/Docs.astro +286 -0
  45. package/lib/ansi.ts +168 -0
  46. package/lib/changelog.ts +85 -0
  47. package/lib/docs.ts +54 -0
  48. package/lib/i18n.ts +136 -0
  49. package/lib/og.ts +91 -0
  50. package/lib/showcase.ts +48 -0
  51. package/lib/url.ts +16 -0
  52. package/lib/version.ts +50 -0
  53. package/package.json +71 -4
  54. package/routes/404.astro +49 -0
  55. package/routes/changelog.astro +129 -0
  56. package/routes/docs/[...slug].astro +39 -0
  57. package/routes/showcase/[slug].astro +108 -0
  58. package/routes/showcase/index.astro +195 -0
  59. package/styles/base.css +307 -0
  60. package/styles/fonts.css +52 -0
  61. package/styles/tokens.css +136 -0
  62. package/virtual.d.ts +12 -0
@@ -0,0 +1,108 @@
1
+ ---
2
+ import config from 'virtual:casoon-pages/config';
3
+ import { examples } from 'virtual:casoon-pages/showcase';
4
+ import ExamplePanel from '../../components/ExamplePanel.astro';
5
+ import Base from '../../layouts/Base.astro';
6
+ import { t } from '../../lib/i18n';
7
+ import { descriptionHtml, descriptionText, type ShowcaseExample } from '../../lib/showcase';
8
+ import { url } from '../../lib/url';
9
+
10
+ export function getStaticPaths() {
11
+ return examples.map((example, i) => ({
12
+ params: { slug: example.slug },
13
+ props: { example, prev: examples[i - 1], next: examples[i + 1] },
14
+ }));
15
+ }
16
+
17
+ interface Props {
18
+ example: ShowcaseExample;
19
+ prev?: ShowcaseExample;
20
+ next?: ShowcaseExample;
21
+ }
22
+
23
+ const { example, prev, next } = Astro.props;
24
+ const s = t(config.lang);
25
+ ---
26
+
27
+ <Base title={example.title} description={example.description && descriptionText(example.description)}>
28
+ <div class="page">
29
+ <p class="back"><a href={url('showcase/')}>← {s.allExamples}</a></p>
30
+ <h1>{example.title}</h1>
31
+ {example.description && <p class="lead cp-inline-code" set:html={descriptionHtml(example.description)} />}
32
+ <ExamplePanel example={example} headingLevel={2} detailLink={false} />
33
+ <nav class="pager" aria-label={s.pagerShowcase}>
34
+ {
35
+ prev ? (
36
+ <a href={url(`showcase/${prev.slug}/`)}>
37
+ <span class="dir">{s.previous}</span>
38
+ <span class="label">{prev.title}</span>
39
+ </a>
40
+ ) : (
41
+ <span />
42
+ )
43
+ }
44
+ {
45
+ next && (
46
+ <a class="next" href={url(`showcase/${next.slug}/`)}>
47
+ <span class="dir">{s.next}</span>
48
+ <span class="label">{next.title}</span>
49
+ </a>
50
+ )
51
+ }
52
+ </nav>
53
+ </div>
54
+ </Base>
55
+
56
+ <style>
57
+ .page {
58
+ max-width: var(--max);
59
+ margin: 0 auto;
60
+ padding: 48px 24px 96px;
61
+ }
62
+ .back {
63
+ margin: 0 0 18px;
64
+ font-size: 14px;
65
+ }
66
+ h1 {
67
+ margin: 0 0 12px;
68
+ color: var(--heading);
69
+ font-size: 38px;
70
+ font-weight: 600;
71
+ letter-spacing: -0.025em;
72
+ }
73
+ .lead {
74
+ max-width: 62ch;
75
+ margin: 0 0 32px;
76
+ font-size: 17.5px;
77
+ }
78
+ .pager {
79
+ display: grid;
80
+ grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
81
+ gap: 14px;
82
+ margin-top: 40px;
83
+ }
84
+ .pager a {
85
+ display: block;
86
+ padding: 14px 18px;
87
+ border: 1px solid var(--border);
88
+ border-radius: 12px;
89
+ background: var(--surface);
90
+ }
91
+ .pager a:hover {
92
+ border-color: var(--border-strong);
93
+ }
94
+ .pager .next {
95
+ text-align: right;
96
+ }
97
+ .dir {
98
+ display: block;
99
+ margin-bottom: 3px;
100
+ color: var(--muted);
101
+ font-size: 12px;
102
+ }
103
+ .label {
104
+ color: var(--heading);
105
+ font-size: 15px;
106
+ font-weight: 500;
107
+ }
108
+ </style>
@@ -0,0 +1,195 @@
1
+ ---
2
+ import config from 'virtual:casoon-pages/config';
3
+ import { examples } from 'virtual:casoon-pages/showcase';
4
+ import ExamplePanel from '../../components/ExamplePanel.astro';
5
+ import Base from '../../layouts/Base.astro';
6
+ import { t } from '../../lib/i18n';
7
+ import { descriptionHtml, type ShowcaseExample } from '../../lib/showcase';
8
+ import { url } from '../../lib/url';
9
+
10
+ const s = t(config.lang);
11
+
12
+ // Examples in groups (in the order of each group's first example); without groups one list.
13
+ const groups: { label: string; id: string; items: ShowcaseExample[] }[] = [];
14
+ for (const example of examples as ShowcaseExample[]) {
15
+ const label = example.group ?? '';
16
+ let group = groups.find((g) => g.label === label);
17
+ if (!group) {
18
+ const id = `group-${
19
+ label
20
+ .toLowerCase()
21
+ .replace(/[^a-z0-9]+/g, '-')
22
+ .replace(/^-|-$/g, '') || 'all'
23
+ }`;
24
+ group = { label, id, items: [] };
25
+ groups.push(group);
26
+ }
27
+ group.items.push(example);
28
+ }
29
+ const grouped = groups.some((g) => g.label !== '');
30
+ ---
31
+
32
+ <Base title={s.showcase} description={s.showcaseDescription(config.name)}>
33
+ <div class="page">
34
+ <h1>{s.showcase}</h1>
35
+ <p class="lead">{config.showcaseLead || s.showcaseLead(config.name)}</p>
36
+ {
37
+ grouped && (
38
+ <nav class="jump" aria-label={s.showcase}>
39
+ <ul>
40
+ {groups.map((g) => (
41
+ <li>
42
+ <a href={`#${g.id}`}>
43
+ {g.label || s.showcase} <span class="count">{g.items.length}</span>
44
+ </a>
45
+ </li>
46
+ ))}
47
+ </ul>
48
+ </nav>
49
+ )
50
+ }
51
+ {
52
+ groups.map((group) => (
53
+ <section class="group" id={grouped ? group.id : undefined}>
54
+ {grouped && group.label && <h2>{group.label}</h2>}
55
+ <div class="list">
56
+ {group.items
57
+ .filter((example) => !example.preview)
58
+ .map((example) => (
59
+ <ExamplePanel example={example} />
60
+ ))}
61
+ </div>
62
+ {group.items.some((example) => example.preview) && (
63
+ <ul class="cards">
64
+ {group.items
65
+ .filter((example) => example.preview)
66
+ .map((example) => (
67
+ <li class="card">
68
+ <a href={url(`showcase/${example.slug}/`)}>
69
+ <span class="preview" set:html={example.preview!.html} />
70
+ <span class="name">{example.title}</span>
71
+ {example.description && (
72
+ <span class="text cp-inline-code" set:html={descriptionHtml(example.description)} />
73
+ )}
74
+ </a>
75
+ </li>
76
+ ))}
77
+ </ul>
78
+ )}
79
+ </section>
80
+ ))
81
+ }
82
+ </div>
83
+ </Base>
84
+
85
+ <style>
86
+ .page {
87
+ max-width: var(--max);
88
+ margin: 0 auto;
89
+ padding: 56px 24px 96px;
90
+ }
91
+ h1 {
92
+ margin: 0 0 12px;
93
+ color: var(--heading);
94
+ font-size: 38px;
95
+ font-weight: 600;
96
+ letter-spacing: -0.025em;
97
+ }
98
+ h2 {
99
+ margin: 0 0 16px;
100
+ color: var(--heading);
101
+ font-size: 24px;
102
+ font-weight: 600;
103
+ letter-spacing: -0.015em;
104
+ }
105
+ .lead {
106
+ max-width: 62ch;
107
+ margin: 0 0 32px;
108
+ font-size: 17.5px;
109
+ }
110
+ .jump ul {
111
+ display: flex;
112
+ flex-wrap: wrap;
113
+ gap: 8px;
114
+ margin: 0 0 40px;
115
+ padding: 0;
116
+ list-style: none;
117
+ }
118
+ .jump a {
119
+ display: inline-block;
120
+ padding: 6px 12px;
121
+ border: 1px solid var(--border);
122
+ border-radius: 999px;
123
+ color: var(--text);
124
+ font-size: 14px;
125
+ text-decoration: none;
126
+ }
127
+ .jump a:hover,
128
+ .jump a:focus-visible {
129
+ border-color: var(--accent);
130
+ color: var(--heading);
131
+ }
132
+ .count {
133
+ color: var(--muted);
134
+ }
135
+ .group + .group {
136
+ margin-top: 56px;
137
+ }
138
+ .group {
139
+ scroll-margin-top: 80px;
140
+ }
141
+ .list {
142
+ display: flex;
143
+ flex-direction: column;
144
+ gap: 20px;
145
+ }
146
+ .list:not(:empty) + .cards {
147
+ margin-top: 20px;
148
+ }
149
+ .cards {
150
+ display: grid;
151
+ grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
152
+ gap: 16px;
153
+ margin: 0;
154
+ padding: 0;
155
+ list-style: none;
156
+ }
157
+ .card a {
158
+ display: flex;
159
+ flex-direction: column;
160
+ gap: 8px;
161
+ height: 100%;
162
+ padding: 12px;
163
+ border: 1px solid var(--border);
164
+ border-radius: 14px;
165
+ background: var(--surface);
166
+ color: var(--text);
167
+ text-decoration: none;
168
+ }
169
+ .card a:hover,
170
+ .card a:focus-visible {
171
+ border-color: var(--accent);
172
+ }
173
+ .preview {
174
+ display: block;
175
+ line-height: 0;
176
+ }
177
+ .preview :global(img) {
178
+ width: 100%;
179
+ height: auto;
180
+ }
181
+ .name {
182
+ color: var(--heading);
183
+ font-family: var(--font-mono);
184
+ font-size: 15px;
185
+ font-weight: 600;
186
+ }
187
+ .text {
188
+ color: var(--muted);
189
+ font-size: 13.5px;
190
+ line-height: 1.45;
191
+ }
192
+ .text :global(code) {
193
+ font-size: 0.9em;
194
+ }
195
+ </style>
@@ -0,0 +1,307 @@
1
+ *,
2
+ *::before,
3
+ *::after {
4
+ box-sizing: border-box;
5
+ }
6
+
7
+ html {
8
+ overflow-x: clip;
9
+ }
10
+
11
+ body {
12
+ margin: 0;
13
+ min-height: 100vh;
14
+ display: flex;
15
+ flex-direction: column;
16
+ background: var(--bg);
17
+ color: var(--text);
18
+ font-family: var(--font-sans);
19
+ font-size: 16px;
20
+ line-height: 1.65;
21
+ -webkit-font-smoothing: antialiased;
22
+ text-wrap: pretty;
23
+ }
24
+
25
+ main {
26
+ flex: 1;
27
+ }
28
+
29
+ a {
30
+ color: var(--accent);
31
+ text-decoration: none;
32
+ }
33
+
34
+ a:hover {
35
+ color: var(--brand);
36
+ }
37
+
38
+ button {
39
+ font: inherit;
40
+ }
41
+
42
+ img,
43
+ svg {
44
+ max-width: 100%;
45
+ }
46
+
47
+ figure {
48
+ margin: 0;
49
+ }
50
+
51
+ h1,
52
+ h2,
53
+ h3 {
54
+ text-wrap: balance;
55
+ }
56
+
57
+ code,
58
+ kbd,
59
+ pre,
60
+ samp {
61
+ font-family: var(--font-mono);
62
+ }
63
+
64
+ ::selection {
65
+ background: var(--accent-soft);
66
+ }
67
+
68
+ :focus-visible {
69
+ outline: 2px solid var(--accent);
70
+ outline-offset: 2px;
71
+ border-radius: 4px;
72
+ }
73
+
74
+ .visually-hidden {
75
+ position: absolute !important;
76
+ width: 1px;
77
+ height: 1px;
78
+ padding: 0;
79
+ margin: -1px;
80
+ overflow: hidden;
81
+ clip: rect(0 0 0 0);
82
+ white-space: nowrap;
83
+ border: 0;
84
+ }
85
+
86
+ .skip-link {
87
+ position: absolute;
88
+ left: 12px;
89
+ top: -100px;
90
+ z-index: 100;
91
+ padding: 8px 14px;
92
+ border-radius: 8px;
93
+ background: var(--heading);
94
+ color: var(--bg);
95
+ }
96
+
97
+ .skip-link:focus {
98
+ top: 12px;
99
+ }
100
+
101
+ @media (prefers-reduced-motion: reduce) {
102
+ * {
103
+ transition: none !important;
104
+ animation: none !important;
105
+ scroll-behavior: auto !important;
106
+ }
107
+ }
108
+
109
+ /* Highlighted code (Shiki) */
110
+ pre.astro-code {
111
+ margin: 0;
112
+ padding: 18px;
113
+ font-size: 13px;
114
+ line-height: 1.8;
115
+ overflow: auto;
116
+ }
117
+
118
+ /* ANSI output (lib/ansi.ts) */
119
+ .ansi-bold {
120
+ font-weight: 500;
121
+ color: var(--ansi-15);
122
+ }
123
+ .ansi-dim {
124
+ color: var(--term-dim);
125
+ }
126
+ .ansi-italic {
127
+ font-style: italic;
128
+ }
129
+ .ansi-underline {
130
+ text-decoration: underline;
131
+ }
132
+ .ansi-fg-0 {
133
+ color: var(--ansi-0);
134
+ }
135
+ .ansi-fg-1 {
136
+ color: var(--ansi-1);
137
+ }
138
+ .ansi-fg-2 {
139
+ color: var(--ansi-2);
140
+ }
141
+ .ansi-fg-3 {
142
+ color: var(--ansi-3);
143
+ }
144
+ .ansi-fg-4 {
145
+ color: var(--ansi-4);
146
+ }
147
+ .ansi-fg-5 {
148
+ color: var(--ansi-5);
149
+ }
150
+ .ansi-fg-6 {
151
+ color: var(--ansi-6);
152
+ }
153
+ .ansi-fg-7 {
154
+ color: var(--ansi-7);
155
+ }
156
+ .ansi-fg-8 {
157
+ color: var(--ansi-8);
158
+ }
159
+ .ansi-fg-9 {
160
+ color: var(--ansi-9);
161
+ }
162
+ .ansi-fg-10 {
163
+ color: var(--ansi-10);
164
+ }
165
+ .ansi-fg-11 {
166
+ color: var(--ansi-11);
167
+ }
168
+ .ansi-fg-12 {
169
+ color: var(--ansi-12);
170
+ }
171
+ .ansi-fg-13 {
172
+ color: var(--ansi-13);
173
+ }
174
+ .ansi-fg-14 {
175
+ color: var(--ansi-14);
176
+ }
177
+ .ansi-fg-15 {
178
+ color: var(--ansi-15);
179
+ }
180
+
181
+ /* Section label used above home sections and in the docs kit */
182
+ /* Section labels: an eyebrow with an orange dot, and as h2 a large
183
+ section heading. */
184
+ .cp-label {
185
+ display: flex;
186
+ align-items: center;
187
+ gap: 10px;
188
+ margin: 0 0 28px;
189
+ font-size: 14px;
190
+ font-weight: 400;
191
+ line-height: 1.6;
192
+ text-transform: uppercase;
193
+ color: var(--heading);
194
+ }
195
+ .cp-label::before {
196
+ content: "";
197
+ flex: none;
198
+ width: 6px;
199
+ height: 6px;
200
+ border-radius: 50%;
201
+ background: var(--accent-fill);
202
+ }
203
+ h2.cp-label {
204
+ display: block;
205
+ margin: 0 0 40px;
206
+ font-size: clamp(34px, 4.4vw, 50px);
207
+ font-weight: 600;
208
+ letter-spacing: -0.02em;
209
+ line-height: 1.1;
210
+ text-transform: none;
211
+ }
212
+ h2.cp-label::before {
213
+ content: none;
214
+ }
215
+
216
+ /* Rendered Markdown / MDX */
217
+ .cp-prose > :first-child {
218
+ margin-top: 0;
219
+ }
220
+ .cp-prose h2 {
221
+ margin: 44px 0 14px;
222
+ font-size: 25px;
223
+ font-weight: 600;
224
+ letter-spacing: -0.02em;
225
+ line-height: 1.25;
226
+ color: var(--heading);
227
+ scroll-margin-top: calc(var(--header-h) + 16px);
228
+ }
229
+ .cp-prose h3 {
230
+ margin: 32px 0 10px;
231
+ font-size: 19px;
232
+ font-weight: 600;
233
+ letter-spacing: -0.01em;
234
+ color: var(--heading);
235
+ scroll-margin-top: calc(var(--header-h) + 16px);
236
+ }
237
+ .cp-prose p,
238
+ .cp-prose ul,
239
+ .cp-prose ol {
240
+ margin: 0 0 18px;
241
+ }
242
+ .cp-prose li + li {
243
+ margin-top: 6px;
244
+ }
245
+ .cp-prose a {
246
+ text-decoration: underline;
247
+ text-underline-offset: 2px;
248
+ text-decoration-thickness: 1px;
249
+ }
250
+ .cp-inline-code code,
251
+ .cp-prose :not(pre) > code {
252
+ padding: 1px 5px;
253
+ border-radius: 5px;
254
+ background: var(--code-bg);
255
+ color: var(--heading);
256
+ font-size: 0.86em;
257
+ }
258
+ .cp-prose > figure,
259
+ .cp-prose > .tabs {
260
+ margin-bottom: 22px;
261
+ }
262
+ .cp-prose > pre,
263
+ .cp-prose > .astro-code {
264
+ margin: 0 0 22px;
265
+ border: 1px solid var(--border);
266
+ border-radius: 12px;
267
+ }
268
+ .cp-prose table {
269
+ width: 100%;
270
+ margin: 0 0 22px;
271
+ border: 1px solid var(--border);
272
+ border-radius: 12px;
273
+ border-collapse: separate;
274
+ border-spacing: 0;
275
+ overflow: hidden;
276
+ font-size: 14.5px;
277
+ }
278
+ /* Narrow screens: a wide table scrolls inside itself instead of widening the page. */
279
+ @media (max-width: 900px) {
280
+ .cp-prose table {
281
+ display: block;
282
+ overflow-x: auto;
283
+ }
284
+ }
285
+ .cp-prose th {
286
+ padding: 11px 16px;
287
+ background: var(--bg-deep);
288
+ color: var(--heading);
289
+ font-size: 13px;
290
+ font-weight: 600;
291
+ text-align: left;
292
+ }
293
+ .cp-prose td {
294
+ padding: 11px 16px;
295
+ border-top: 1px solid var(--border);
296
+ }
297
+ .cp-prose blockquote {
298
+ margin: 0 0 18px;
299
+ padding-left: 16px;
300
+ border-left: 1px solid var(--border-strong);
301
+ color: var(--muted);
302
+ }
303
+ .cp-prose hr {
304
+ margin: 40px 0;
305
+ border: 0;
306
+ border-top: 1px solid var(--border);
307
+ }
@@ -0,0 +1,52 @@
1
+ /* Self-hosted, Latin subset. No font CDN: the sites load no external resources. */
2
+
3
+ @font-face {
4
+ font-family: "Inter";
5
+ font-style: normal;
6
+ font-display: swap;
7
+ font-weight: 400;
8
+ src: url("../fonts/inter-latin-400-normal.woff2") format("woff2");
9
+ }
10
+
11
+ @font-face {
12
+ font-family: "Inter";
13
+ font-style: normal;
14
+ font-display: swap;
15
+ font-weight: 500;
16
+ src: url("../fonts/inter-latin-500-normal.woff2") format("woff2");
17
+ }
18
+
19
+ @font-face {
20
+ font-family: "Inter";
21
+ font-style: normal;
22
+ font-display: swap;
23
+ font-weight: 600;
24
+ src: url("../fonts/inter-latin-600-normal.woff2") format("woff2");
25
+ }
26
+
27
+ @font-face {
28
+ font-family: "Onest";
29
+ font-style: normal;
30
+ font-display: swap;
31
+ font-weight: 100 900;
32
+ src: url("../fonts/onest-latin-wght-normal.woff2") format("woff2");
33
+ unicode-range:
34
+ U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
35
+ U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
36
+ }
37
+
38
+ @font-face {
39
+ font-family: "JetBrains Mono";
40
+ font-style: normal;
41
+ font-display: swap;
42
+ font-weight: 400;
43
+ src: url("../fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2");
44
+ }
45
+
46
+ @font-face {
47
+ font-family: "JetBrains Mono";
48
+ font-style: normal;
49
+ font-display: swap;
50
+ font-weight: 500;
51
+ src: url("../fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2");
52
+ }