vowel 0.1.18 → 0.1.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.
@@ -0,0 +1,128 @@
1
+ <svelte:head>
2
+ <style>
3
+ html {
4
+ -webkit-text-size-adjust: 100%;
5
+ margin: 0;
6
+ font-size: 62.5%;
7
+ }
8
+
9
+ body {
10
+ font-size: 1.6rem;
11
+ line-height: 1.5;
12
+ -webkit-font-smoothing: antialiased;
13
+ font-weight: 400;
14
+ margin: 0;
15
+ }
16
+
17
+ .container {
18
+ height: 100vh;
19
+ overflow-y: scroll;
20
+ }
21
+
22
+ .page {
23
+ min-height: 100vh;
24
+ overflow-x: hidden;
25
+ }
26
+
27
+ *,
28
+ *::before,
29
+ *::after {
30
+ box-sizing: border-box;
31
+ }
32
+
33
+ * {
34
+ margin: 0;
35
+ }
36
+
37
+ img,
38
+ details,
39
+ picture,
40
+ video,
41
+ canvas,
42
+ svg,
43
+ object {
44
+ display: block;
45
+ max-width: 100%;
46
+ }
47
+
48
+ summary {
49
+ display: list-item;
50
+ }
51
+
52
+ hr {
53
+ box-sizing: content-box;
54
+ height: 0;
55
+ overflow: visible;
56
+ }
57
+
58
+ pre {
59
+ font-family: monospace, monospace;
60
+ font-size: 1em;
61
+ }
62
+
63
+ a {
64
+ background-color: transparent;
65
+ }
66
+
67
+ abbr[title] {
68
+ border-bottom: none;
69
+ text-decoration: underline;
70
+ text-decoration: underline dotted;
71
+ }
72
+
73
+ b,
74
+ strong {
75
+ font-weight: bolder;
76
+ }
77
+
78
+ code,
79
+ kbd,
80
+ samp {
81
+ font-family: monospace, monospace;
82
+ font-size: 1em;
83
+ }
84
+
85
+ small {
86
+ font-size: 80%;
87
+ }
88
+
89
+ sub,
90
+ sup {
91
+ font-size: 75%;
92
+ line-height: 0;
93
+ position: relative;
94
+ vertical-align: baseline;
95
+ }
96
+
97
+ sub {
98
+ bottom: -0.25em;
99
+ }
100
+
101
+ sup {
102
+ top: -0.5em;
103
+ }
104
+
105
+ img {
106
+ border-style: none;
107
+ height: auto;
108
+ border-radius: 5px;
109
+ overflow: hidden;
110
+ }
111
+
112
+ p,
113
+ h1,
114
+ h2,
115
+ h3,
116
+ h4,
117
+ h5,
118
+ h6 {
119
+ overflow-wrap: break-word;
120
+ }
121
+
122
+ code,
123
+ mark {
124
+ -webkit-box-decoration-break: clone;
125
+ box-decoration-break: clone;
126
+ }
127
+ </style>
128
+ </svelte:head>
@@ -0,0 +1,265 @@
1
+ <script>
2
+ import ResetStyles from './ResetStyles.svelte';
3
+ </script>
4
+
5
+ <ResetStyles />
6
+
7
+ <svelte:head>
8
+ <style>
9
+ html {
10
+ font-family:
11
+ -apple-system,
12
+ BlinkMacSystemFont,
13
+ avenir next,
14
+ avenir,
15
+ segoe ui,
16
+ helvetica neue,
17
+ helvetica,
18
+ Cantarell,
19
+ Ubuntu,
20
+ roboto,
21
+ noto,
22
+ arial,
23
+ sans-serif;
24
+ }
25
+
26
+ h1,
27
+ h2,
28
+ h3,
29
+ h4,
30
+ h5,
31
+ h6 {
32
+ margin-top: 0.5rem;
33
+ margin-bottom: 1rem;
34
+ text-rendering: optimizeLegibility;
35
+ font-weight: 600;
36
+ line-height: 1.1;
37
+ }
38
+
39
+ h1 {
40
+ font-size: 3rem;
41
+ line-height: 1.2;
42
+ font-weight: 800;
43
+ }
44
+
45
+ h2 {
46
+ font-size: 2.6rem;
47
+ margin-top: 3rem;
48
+ }
49
+
50
+ h3 {
51
+ font-size: 2rem;
52
+ margin-top: 3rem;
53
+ }
54
+
55
+ h4 {
56
+ font-size: 1.44rem;
57
+ }
58
+
59
+ h5 {
60
+ font-size: 1.15rem;
61
+ }
62
+
63
+ h6 {
64
+ font-size: 0.96rem;
65
+ }
66
+
67
+ article h1 {
68
+ font-weight: 600;
69
+ font-size: 2rem;
70
+ }
71
+
72
+ @media only screen and (max-width: 720px) {
73
+ h1 {
74
+ font-size: 2.5rem;
75
+ }
76
+
77
+ h2 {
78
+ font-size: 2.1rem;
79
+ }
80
+
81
+ h3 {
82
+ font-size: 1.75rem;
83
+ }
84
+
85
+ h4 {
86
+ font-size: 1.25rem;
87
+ }
88
+ }
89
+
90
+ p {
91
+ margin-top: 0;
92
+ }
93
+
94
+ ol,
95
+ ul {
96
+ /* padding-left: 0; */
97
+ margin-top: 0;
98
+ }
99
+
100
+ ul ul,
101
+ ul ol,
102
+ ol ol,
103
+ ol ul {
104
+ font-size: 100%;
105
+ /* margin: 1rem 0 1rem 3rem; */
106
+ }
107
+
108
+ li {
109
+ margin-bottom: 0.5rem;
110
+ }
111
+
112
+ /* Extra selector for specificity, see below */
113
+ li > p:not(:last-child) {
114
+ margin: 0;
115
+ padding: 0;
116
+ }
117
+
118
+ pre,
119
+ code {
120
+ font-family:
121
+ Menlo,
122
+ Consolas,
123
+ Monaco,
124
+ Liberation Mono,
125
+ Lucida Console,
126
+ monospace;
127
+ }
128
+
129
+ code {
130
+ font-size: 0.9em;
131
+ margin-inline: 0px;
132
+ padding: 3px 4px;
133
+ border-radius: 5px;
134
+ }
135
+
136
+ pre {
137
+ padding: 1rem 1.5rem;
138
+ border-radius: 5px;
139
+ overflow-x: auto;
140
+ }
141
+
142
+ blockquote {
143
+ margin: 1.5em 0;
144
+ padding: 0 1.6em 0 1.6em;
145
+ }
146
+
147
+ a {
148
+ text-decoration: none;
149
+ }
150
+
151
+ li.checked,
152
+ li.unchecked {
153
+ padding-left: 0.8rem;
154
+ }
155
+
156
+ figcaption {
157
+ margin-top: 0.5rem;
158
+ font-style: italic;
159
+ }
160
+
161
+ article + article {
162
+ margin-top: 1rem;
163
+ }
164
+
165
+ article a {
166
+ color: unset;
167
+ }
168
+
169
+ article a:hover {
170
+ color: unset;
171
+ }
172
+
173
+ article h2 {
174
+ margin-top: 2rem;
175
+ }
176
+
177
+ th,
178
+ td {
179
+ padding: 12px 15px;
180
+ text-align: left;
181
+ }
182
+
183
+ th:first-child,
184
+ td:first-child {
185
+ padding-left: 0;
186
+ }
187
+ th:last-child,
188
+ td:last-child {
189
+ padding-right: 0;
190
+ }
191
+
192
+ :where(
193
+ pre,
194
+ blockquote,
195
+ dl,
196
+ figure,
197
+ table,
198
+ p,
199
+ ul,
200
+ ol,
201
+ form,
202
+ article,
203
+ section,
204
+ aside,
205
+ time,
206
+ dl
207
+ ):not(:last-child) {
208
+ margin-bottom: 2.5rem;
209
+ }
210
+
211
+ hr {
212
+ margin-top: 3rem;
213
+ margin-bottom: 3.5rem;
214
+ border-width: 0px;
215
+ }
216
+
217
+ dt {
218
+ font-weight: 500;
219
+ }
220
+
221
+ time {
222
+ display: block;
223
+ }
224
+
225
+ time a {
226
+ color: unset;
227
+ }
228
+
229
+ .breadcrumbs a {
230
+ font-size: 0.9em;
231
+ color: unset;
232
+ }
233
+
234
+ .breadcrumbs .separator:after {
235
+ margin-inline: 0.2em;
236
+ content: '/';
237
+ }
238
+
239
+ nav > a {
240
+ text-wrap: nowrap;
241
+ }
242
+
243
+ header a.site-title {
244
+ color: unset;
245
+ font-weight: 900;
246
+ font-size: 2.8em;
247
+ }
248
+
249
+ header .slogan {
250
+ font-weight: 500;
251
+ }
252
+
253
+ nav a:where([aria-current='page'], [aria-current='true']),
254
+ nav a:where([aria-current='page'], [aria-current='true']):hover {
255
+ text-decoration: none;
256
+ color: unset;
257
+ cursor: default;
258
+ }
259
+
260
+ aside h2 {
261
+ margin: 0 0 0.5em 0;
262
+ font-size: 1.1em;
263
+ }
264
+ </style>
265
+ </svelte:head>
@@ -6,4 +6,7 @@ export { default as Page } from './Page.svelte';
6
6
  export { default as Sitemap } from './Sitemap.svelte';
7
7
  export { default as FrontmatterProperty } from './FrontmatterProperty.svelte';
8
8
  export { default as FrontmatterTaxonomy } from './FrontMatterTaxonomy.svelte';
9
- // export { default as DefaultStyles } from './DefaultStyles.svelte';
9
+ export { default as ResetStyles } from './ResetStyles.svelte';
10
+ export { default as TypographyStyles } from './TypographyStyles.svelte';
11
+ export { default as DefaultStyles } from './DefaultStyles.svelte';
12
+ export { default as NoStyles } from './NoStyles.svelte';
@@ -1,6 +1,6 @@
1
- export default function createPageClass(url, type = 'page', theme) {
1
+ export default function createPageClass(url, type = 'page') {
2
2
  if (!url) return 'item';
3
- if (url === '/') return `page home${theme ? ` theme-${theme}` : ''}`;
4
- if (type === 'page') return `page ${url.split('/').join(' ')}${theme ? ` theme-${theme}` : ''}`;
3
+ if (url === '/') return `page home`;
4
+ if (type === 'page') return `page ${url.split('/').join(' ')}`;
5
5
  return type + url.split('/').join(' ');
6
6
  }
@@ -22,9 +22,10 @@ export default function getFileLabel(page, shorter = false, date = true) {
22
22
  : false;
23
23
 
24
24
  return (
25
- page?.breadcrumb ||
25
+ (shorter && page?.breadcrumb) ||
26
26
  page?.title ||
27
27
  page?.imputedProperties?.title ||
28
+ page?.breadcrumb ||
28
29
  formattedDate ||
29
30
  (shorter && fileName) ||
30
31
  description ||
@@ -0,0 +1,110 @@
1
+ <script>
2
+ import { page } from '$app/stores';
3
+ import {
4
+ Nav,
5
+ Page,
6
+ Breadcrumbs,
7
+ Sitemap,
8
+ ResetStyles,
9
+ DefaultStyles,
10
+ TypographyStyles,
11
+ NoStyles
12
+ } from '$lib/components/index.js';
13
+ import { invalidateAll } from '$app/navigation';
14
+
15
+ const themes = {
16
+ none: NoStyles,
17
+ reset: ResetStyles,
18
+ typography: TypographyStyles,
19
+ default: DefaultStyles
20
+ };
21
+
22
+ let { error: data } = $page;
23
+
24
+ const { website } = $derived(data);
25
+
26
+ const { slogan, theme } = $derived(website?._);
27
+
28
+ // Import CSS for HMR in dev mode
29
+ if (data.dev && data.files.css.exists) {
30
+ import(/* @vite-ignore */ data.files.css.path);
31
+ }
32
+
33
+ const siteTitle = website._.title;
34
+
35
+ function makePageMetaTitle() {
36
+ if (siteTitle) return `Page not found = ${siteTitle}`;
37
+ return `Page not found`;
38
+ }
39
+
40
+ function getFavicon() {
41
+ if (website._?.icon)
42
+ return `data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 20 90 60%22><text y=%22.9em%22 font-size=%2290%22>${website._.icon}</text></svg>`;
43
+ if (data.files.favicon.exists) return '/favicon.png';
44
+ return false;
45
+ }
46
+
47
+ const favicon = getFavicon();
48
+
49
+ $effect(() => {
50
+ // Update website on file change
51
+ if (import.meta.hot) {
52
+ import.meta.hot.on('vowel:update', ({ path, file }) => {
53
+ invalidateAll().then(() => {
54
+ window.location.reload();
55
+ });
56
+ });
57
+ import.meta.hot.on('vowel:refresh', () => {
58
+ console.log('Refresh');
59
+ invalidateAll().then(() => {
60
+ window.location.reload();
61
+ });
62
+ });
63
+ }
64
+ });
65
+ </script>
66
+
67
+ <svelte:component this={themes[theme || 'default']} />
68
+
69
+ <svelte:head>
70
+ <title>{makePageMetaTitle()}</title>
71
+ <meta property="og:site_name" content={website._.title} />
72
+ {#if favicon}
73
+ <link rel="icon" href={favicon} />
74
+ {/if}
75
+ {#if !data.dev && data.files.css.exists}
76
+ <link rel="stylesheet" href="/styles.css" />
77
+ {/if}
78
+ </svelte:head>
79
+
80
+ <div data-sveltekit-preload-data="hover" class="page 404">
81
+ <header>
82
+ {#if website._.logo}
83
+ <a href="/" class="site-logo">
84
+ {#if website._.logo.endsWith('.svg')}
85
+ <object type="image/svg+xml" data={website._.logo} title={website._.title || undefined}
86
+ ></object>
87
+ {:else}
88
+ <img alt="website logo" src={website._.logo} />
89
+ {/if}
90
+ </a>
91
+ {/if}
92
+ {#if siteTitle}
93
+ <a href="/" class="site-title">{siteTitle}</a>
94
+ {/if}
95
+ {#if website._.slogan}
96
+ <p class="slogan">{website._.slogan}</p>
97
+ {/if}
98
+ <Nav folder={website} segments={['']} />
99
+ </header>
100
+ <main>
101
+ <h1>Page Not Found</h1>
102
+ </main>
103
+ <nav class="sidebar">
104
+ <Sitemap section={website} segments={['']} root />
105
+ </nav>
106
+ <footer>
107
+ © {website._.author ? website._.author + ' ' : ''}
108
+ {new Date().getFullYear()}
109
+ </footer>
110
+ </div>
@@ -4,16 +4,17 @@ import { constants } from 'fs';
4
4
  import { normalize, join, basename } from 'path';
5
5
  import { dev } from '$app/environment';
6
6
  import mri from 'mri';
7
+ import { getPage } from '../../lib/utilities';
8
+ import { error } from '@sveltejs/kit';
7
9
 
8
10
  const args = mri(process.argv);
9
11
  const isBuild = args._.includes('build');
10
12
 
11
13
  export const prerender = true;
12
14
  export const csr = dev;
13
- // export const ssr = true;
14
15
 
15
- let contentCache;
16
- let contentCacheTime;
16
+ let contentCache = false;
17
+ // let contentCacheTime = $build[0] ? 600000 : 0;
17
18
 
18
19
  async function checkFileExists(filePath, homeDir) {
19
20
  try {
@@ -27,8 +28,7 @@ async function checkFileExists(filePath, homeDir) {
27
28
  /** @type {import('./$types').PageLoad} */
28
29
  export async function load() {
29
30
  // const startLoad = performance.now();
30
- const now = Date.now();
31
- const contentCacheDuration = isBuild ? 60000 : 0; // Cache for 1 second
31
+
32
32
  const initialURLCache = await loadCache($home[0]);
33
33
 
34
34
  const cssExists = await checkFileExists(normalize('/assets/styles.css'), $home[0]);
@@ -51,14 +51,13 @@ export async function load() {
51
51
 
52
52
  let data = {};
53
53
 
54
- if (contentCache && now - contentCacheTime < contentCacheDuration) {
54
+ if (contentCache) {
55
55
  console.log('Using content cache');
56
56
  data = contentCache;
57
57
  } else {
58
- // console.log('Not using content cache');
58
+ console.log('Not using content cache');
59
59
  data = await processMarkdownFiles(initialURLCache);
60
- contentCache = data;
61
- contentCacheTime = now;
60
+ if ($build[0]) contentCache = data;
62
61
  }
63
62
 
64
63
  // const { folder: website, finalCache } = await processMarkdownFiles(initialCache);
@@ -1,14 +1,15 @@
1
1
  import { getPagesByFolder, processMarkdownFiles, loadCache } from '../../lib/utilities';
2
2
 
3
+ export const prerender = true;
4
+
3
5
  /** @type {import('./$types').PageLoad} */
4
6
  export async function load({ params }) {
5
7
  const { path } = params;
6
8
  const segments = path ? params.path.split('/') : [];
9
+
7
10
  return { path, segments };
8
11
  }
9
12
 
10
- export const prerender = true;
11
-
12
13
  export async function entries() {
13
14
  const initialCache = await loadCache($home[0]);
14
15