@compiiile/compiiile 2.4.1 → 2.5.0

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.
@@ -145,7 +145,8 @@
145
145
  }
146
146
 
147
147
  p code,
148
- li code {
148
+ li code,
149
+ table code {
149
150
  padding: 2px 4px;
150
151
  border-radius: 3px;
151
152
  background-color: var(--code-background-color);
@@ -177,12 +178,16 @@
177
178
  border: solid 1px var(--blockquote-border-color);
178
179
  border-radius: 8px;
179
180
  padding: 0.5em 1em;
180
- color: #babfc4;
181
+ color: var(--blockquote-color);
181
182
  margin: 20px 0;
182
183
 
183
184
  p {
184
185
  margin-bottom: 0;
185
186
  }
187
+
188
+ code {
189
+ background-color: rgb(169 156 231 / 22%);
190
+ }
186
191
  }
187
192
 
188
193
  img {
@@ -278,6 +283,11 @@
278
283
 
279
284
  .sibling-link {
280
285
  text-decoration: none;
286
+ border-radius: 2px;
287
+
288
+ &:focus-visible {
289
+ outline: solid 1px var(--separator-color);
290
+ }
281
291
  }
282
292
 
283
293
  .sibling-link--next {
@@ -0,0 +1,95 @@
1
+ <template>
2
+ <button class="theme-switcher" @click="toggleTheme">
3
+ <!-- sun-dim -->
4
+ <svg
5
+ class="theme-icon theme-icon--light"
6
+ xmlns="http://www.w3.org/2000/svg"
7
+ width="18"
8
+ height="18"
9
+ viewBox="0 0 256 256"
10
+ >
11
+ <path
12
+ d="M120,40V32a8,8,0,0,1,16,0v8a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-8-8A8,8,0,0,0,50.34,61.66Zm0,116.68-8,8a8,8,0,0,0,11.32,11.32l8-8a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l8-8a8,8,0,0,0-11.32-11.32l-8,8A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l8,8a8,8,0,0,0,11.32-11.32ZM40,120H32a8,8,0,0,0,0,16h8a8,8,0,0,0,0-16Zm88,88a8,8,0,0,0-8,8v8a8,8,0,0,0,16,0v-8A8,8,0,0,0,128,208Zm96-88h-8a8,8,0,0,0,0,16h8a8,8,0,0,0,0-16Z"
13
+ ></path>
14
+ </svg>
15
+ <!-- moon -->
16
+ <svg
17
+ class="theme-icon theme-icon--dark"
18
+ xmlns="http://www.w3.org/2000/svg"
19
+ width="18"
20
+ height="18"
21
+ viewBox="0 0 256 256"
22
+ >
23
+ <path
24
+ d="M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z"
25
+ ></path>
26
+ </svg>
27
+ </button>
28
+ </template>
29
+
30
+ <script>
31
+ const THEME_DARK = "dark"
32
+ const THEME_LIGHT = "light"
33
+ export default {
34
+ name: "ThemeSwitcher",
35
+ methods: {
36
+ toggleTheme() {
37
+ const isLight = document.documentElement.classList.contains(`theme--${THEME_LIGHT}`)
38
+
39
+ if (isLight) {
40
+ document.documentElement.classList.remove(`theme--${THEME_LIGHT}`)
41
+ document.documentElement.classList.add(`theme--${THEME_DARK}`)
42
+ localStorage.setItem("COMPIIILE_THEME", THEME_DARK)
43
+ } else {
44
+ document.documentElement.classList.remove(`theme--${THEME_DARK}`)
45
+ document.documentElement.classList.add(`theme--${THEME_LIGHT}`)
46
+ localStorage.setItem("COMPIIILE_THEME", THEME_LIGHT)
47
+ }
48
+ }
49
+ }
50
+ }
51
+ </script>
52
+
53
+ <style lang="scss" scoped>
54
+ .theme-switcher {
55
+ position: relative;
56
+ margin-left: 6px;
57
+ padding: 16px;
58
+ appearance: none;
59
+ outline: none;
60
+ border: none;
61
+ cursor: pointer;
62
+ background-color: var(--layout-background-color);
63
+ z-index: 0;
64
+ border-radius: 2px;
65
+
66
+ &:focus-visible {
67
+ outline: solid 1px var(--separator-color);
68
+ }
69
+ }
70
+
71
+ .theme-icon {
72
+ position: absolute;
73
+ top: 50%;
74
+ left: 50%;
75
+ transform: translate(-50%, -50%);
76
+ fill: var(--dimmed-text-color);
77
+ will-change: opacity, transform;
78
+ transform-origin: center;
79
+ transition:
80
+ 0.2s opacity,
81
+ 0.2s transform var(--ease-in-out-quart);
82
+ }
83
+
84
+ :global(html.theme--light .theme-icon--light),
85
+ :global(html.theme--dark .theme-icon--dark) {
86
+ opacity: 1;
87
+ transform: translate(-50%, -50%) scale(1);
88
+ }
89
+
90
+ :global(html.theme--light .theme-icon--dark),
91
+ :global(html.theme--dark .theme-icon--light) {
92
+ opacity: 0;
93
+ transform: translate(-50%, -50%) scale(0.8);
94
+ }
95
+ </style>
@@ -20,6 +20,7 @@
20
20
  </a>
21
21
  </span>
22
22
  <search-bar />
23
+ <theme-switcher />
23
24
  </div>
24
25
  </div>
25
26
  </div>
@@ -29,10 +30,11 @@
29
30
  import SearchBar from "../searchBar/SearchBar.vue"
30
31
  import HamburgerButton from "./HamburgerButton.vue"
31
32
  import { site } from "virtual:compiiile"
33
+ import ThemeSwitcher from "./ThemeSwitcher.vue"
32
34
 
33
35
  export default {
34
36
  name: "TopBar",
35
- components: { HamburgerButton, SearchBar },
37
+ components: { ThemeSwitcher, HamburgerButton, SearchBar },
36
38
  computed: {
37
39
  title() {
38
40
  return site.title
@@ -86,7 +88,7 @@
86
88
  }
87
89
 
88
90
  .title {
89
- margin: 0;
91
+ margin: 0 6px 0 0;
90
92
  font-size: 1.5rem;
91
93
  max-width: 100%;
92
94
  display: inline-block;
@@ -272,6 +272,7 @@
272
272
  display: flex;
273
273
  align-items: center;
274
274
  justify-content: center;
275
+ z-index: 1;
275
276
  }
276
277
 
277
278
  .search-overlay {
@@ -336,13 +337,13 @@
336
337
  background-color: var(--darker-background-color);
337
338
  padding: 10px 20px 10px 40px;
338
339
  font-size: var(--text-md);
339
- color: var(--text-color-light);
340
- border: none;
340
+ color: var(--text-color-base);
341
+ border: solid 1px var(--search-input-border-color);
341
342
  display: block;
342
343
  outline: none;
343
344
 
344
345
  &:focus {
345
- box-shadow: inset 0 0 2px 2px rgb(153 133 254 / 80%);
346
+ box-shadow: inset 0 0 1px 1px rgba(153, 133, 254, 0.6);
346
347
  }
347
348
  }
348
349
 
@@ -48,7 +48,7 @@
48
48
  }
49
49
 
50
50
  &:focus {
51
- box-shadow: inset 0 0 2px 2px rgb(153 133 254 / 80%);
51
+ box-shadow: inset 0 0 1px 1px rgba(153, 133, 254, 0.6);
52
52
  outline: none;
53
53
  }
54
54
  }
@@ -1,4 +1,5 @@
1
1
  ---
2
+ import ThemeLoader from "./ThemeLoader.astro";
2
3
  import '../utils/styles.js'
3
4
  import {SEO} from "astro-seo"
4
5
  const {title, description, isNotFoundPage} = Astro.props
@@ -13,6 +14,8 @@ const faviconBaseUrl = `${ siteBase }favicon.png`
13
14
  const faviconAbsoluteUrl = `${ siteUrl }/${ faviconBaseUrl }`
14
15
 
15
16
  const metaDescription = description || site.description
17
+
18
+ const defaultTheme = site.theme
16
19
  ---
17
20
 
18
21
  <html lang="en">
@@ -33,6 +36,7 @@ const metaDescription = description || site.description
33
36
  }
34
37
  }}
35
38
  />}
39
+ <ThemeLoader defaultTheme={defaultTheme}/>
36
40
  </head>
37
41
  <body>
38
42
  <slot></slot>
@@ -0,0 +1,26 @@
1
+ ---
2
+ const { defaultTheme } = Astro.props
3
+ ---
4
+
5
+ <script is:inline define:vars={{ defaultTheme }}>
6
+ const theme = (() => {
7
+ if (typeof localStorage !== 'undefined' && localStorage.getItem('COMPIIILE_THEME')) {
8
+ return localStorage.getItem('COMPIIILE_THEME');
9
+ }
10
+ if (["auto", "dark"].includes(defaultTheme) && window.matchMedia('(prefers-color-scheme: dark)').matches) {
11
+ return 'dark';
12
+ }
13
+ return 'light';
14
+ })();
15
+
16
+ if (theme === 'light') {
17
+ document.documentElement.classList.remove('theme--dark');
18
+ document.documentElement.classList.add('theme--light');
19
+ } else {
20
+ document.documentElement.classList.remove('theme--light');
21
+ document.documentElement.classList.add('theme--dark');
22
+ }
23
+
24
+ window.localStorage.setItem('COMPIIILE_THEME', theme);
25
+
26
+ </script>
@@ -1,22 +1,32 @@
1
1
  :root {
2
2
  --astro-code-color-text: #eeeeee;
3
- --astro-code-color-background: var(--code-background-color);
3
+ --astro-code-color-background: var(--pre-background-color);
4
4
  --astro-code-token-constant: #ec6875;
5
- --astro-code-token-string: var(--code-color);
5
+ --astro-code-token-string: var(--pre-color);
6
6
  --astro-code-token-comment: #8999a9;
7
- --astro-code-token-keyword: var(--code-color);
7
+ --astro-code-token-keyword: var(--pre-color);
8
8
  --astro-code-token-parameter: #ffb36f;
9
9
  --astro-code-token-function: #ffb36f;
10
10
  --astro-code-token-string-expression: #9bea93;
11
- --astro-code-token-punctuation: var(--code-color);
11
+ --astro-code-token-punctuation: var(--pre-color);
12
12
  --astro-code-token-link: #9a84ff;
13
13
  }
14
14
 
15
+ .theme--light {
16
+ --astro-code-color-text: var(--pre-color);
17
+ --astro-code-token-constant: #b56959;
18
+ --astro-code-token-comment: #667566;
19
+ --astro-code-token-parameter: #b07d48;
20
+ --astro-code-token-function: #b07d48;
21
+ --astro-code-token-string-expression: #1e754f;
22
+ --astro-code-token-link: #481eff;
23
+ }
24
+
15
25
  .astro-code {
16
26
  display: block;
17
27
  overflow-x: auto;
18
- background: var(--code-background-color);
19
- border: solid 1px var(--code-background-color); /* same color, useful when printing without background graphics */
28
+ background: var(--pre-background-color);
29
+ border: solid 1px var(--pre-background-color); /* same color, useful when printing without background graphics */
20
30
  color: var(--code-color);
21
31
  padding: 20px;
22
32
  border-radius: 8px;
@@ -67,7 +67,6 @@
67
67
  li,
68
68
  td,
69
69
  th {
70
- color: white !important;
71
70
  -webkit-print-color-adjust: economy;
72
71
  }
73
72
 
@@ -2,6 +2,8 @@
2
2
  --r-code-font: "JetBrains Mono Variable", monospace;
3
3
  --slide-padding-vertical: 40px;
4
4
  --slide-padding-horizontal: 80px;
5
+ --r-main-color: var(--text-color-base);
6
+ --r-heading-color: var(--text-color-base);
5
7
  }
6
8
 
7
9
  .reveal {
@@ -26,6 +28,8 @@
26
28
  width: 100%;
27
29
  margin: 0 auto;
28
30
  max-width: 1200px;
31
+ box-shadow: none;
32
+ background-color: var(--layout-background-color) !important;
29
33
  }
30
34
 
31
35
  h1,
@@ -63,16 +67,19 @@
63
67
  font-size: 2vmin !important;
64
68
  }
65
69
 
66
- p code {
67
- background-color: var(--layout-background-color);
70
+ p code,
71
+ li code,
72
+ table code {
73
+ background-color: var(--code-background-color);
68
74
  padding: 2px 4px;
69
75
  border-radius: 3px;
70
- font-size: 2vmin;
76
+ color: var(--code-color);
71
77
  }
72
78
 
73
79
  blockquote {
74
80
  background-color: var(--blockquote-background-color);
75
81
  border: solid 1px var(--blockquote-border-color);
82
+ color: var(--blockquote-color);
76
83
  border-radius: 8px;
77
84
  padding: 0.5em 1em;
78
85
  width: 100%;
@@ -81,6 +88,10 @@
81
88
  margin: 0 auto;
82
89
  }
83
90
 
91
+ blockquote code {
92
+ background-color: var(--blockquote-background-color) !important;
93
+ }
94
+
84
95
  ul {
85
96
  margin-left: 0;
86
97
  }
@@ -97,16 +108,42 @@
97
108
  img {
98
109
  object-fit: contain;
99
110
  }
111
+
112
+ table {
113
+ font-size: 2vmin;
114
+ }
115
+ table tr {
116
+ border: 1px solid var(--table-border-color);
117
+ background-color: var(--table-odd-lines-background-color);
118
+ margin: 0;
119
+ padding: 0;
120
+ }
121
+
122
+ table tr:nth-child(2n) {
123
+ background-color: var(--table-even-lines-background-color);
124
+ }
125
+
126
+ table tr th {
127
+ font-weight: bold;
128
+ border: 1px solid var(--table-border-color);
129
+ text-align: left;
130
+ margin: 0;
131
+ padding: 6px 13px;
132
+ }
133
+
134
+ table tr td {
135
+ border: 1px solid var(--table-border-color);
136
+ text-align: left;
137
+ margin: 0;
138
+ padding: 6px 13px;
139
+ }
100
140
  }
101
141
 
102
142
  .reveal-viewport {
103
143
  background-color: var(--darker-background-color) !important;
104
144
  }
105
145
 
106
- .reveal .controls {
107
- color: var(--slides-controls) !important;
108
- }
109
-
146
+ .reveal .controls,
110
147
  .reveal .progress {
111
148
  color: var(--slides-controls) !important;
112
149
  }
@@ -126,6 +163,12 @@
126
163
  }
127
164
  }
128
165
 
166
+ html.theme--light p code,
167
+ html.theme--light li code,
168
+ html.theme--light td code {
169
+ background-color: #ececee;
170
+ }
171
+
129
172
  html.reveal-print .reveal .slides section {
130
173
  padding: var(--slide-padding-vertical) var(--slide-padding-horizontal) !important;
131
174
  }
@@ -10,38 +10,44 @@
10
10
  --r-code-font: "JetBrains Mono Variable", monospace;
11
11
 
12
12
  /* Dark theme by default */
13
+ --layout-background-color: #1b1b1f;
14
+ --darker-background-color: #161618;
15
+ --code-background-color: #2b2b31;
16
+ --blockquote-background-color: rgba(153, 133, 254, 0.1);
17
+ --blockquote-border-color: hsl(247, 26%, 25%);
18
+ --blockquote-color: hsl(236 60% 93% / 1);
13
19
  --text-color-base: #f7fafc;
14
20
  --text-color-light: #9ca6b3;
15
- --layout-background-color: #1a1b25;
16
- --darker-background-color: #16161d;
17
- --search-background-color: #1a1b25;
18
- --separator-color: #101014;
19
21
  --dimmed-text-color: #8e989e;
20
- --code-background-color: #2a2c3c;
21
- --code-color: #d2d7e0;
22
+ --table-even-lines-background-color: #232329;
23
+ --pre-background-color: var(--darker-background-color);
24
+ --pre-color: #d2d7e0;
22
25
  --highlight-color: #9985fe;
26
+ --slides-controls: #eeaa6f;
27
+ /* ----------------------- */
28
+
29
+ --search-background-color: var(--layout-background-color);
30
+ --search-input-border-color: #88888812;
23
31
  --link-color: var(--highlight-color);
24
- --blockquote-background-color: rgba(153, 133, 254, 0.1);
25
- --blockquote-border-color: hsl(247, 26%, 30%);
32
+ --separator-color: #8883;
26
33
  --table-border-color: var(--separator-color);
27
- --table-odd-lines-background-color: var(--code-background-color);
28
- --table-even-lines-background-color: #262a33;
29
-
30
- --slides-controls: #eeaa6f;
34
+ --code-color: var(--blockquote-color);
35
+ --table-odd-lines-background-color: var(--layout-background-color);
31
36
  }
32
37
 
33
38
  .theme--light {
39
+ --layout-background-color: #ffffff;
40
+ --darker-background-color: #f9f9fa;
41
+ --code-background-color: #f6f6f7;
42
+ --blockquote-background-color: rgba(169, 156, 231, 0.12);
43
+ --blockquote-border-color: rgba(169, 156, 231, 0.05);
44
+ --blockquote-color: hsl(247 41% 50% / 1);
34
45
  --text-color-base: #37342f;
35
46
  --text-color-light: #a3a29f;
36
- --navbar-background-color: #f8f8f8;
37
- --layout-background-color: #ffffff;
38
- --separator-color: #e2e2e2;
39
47
  --dimmed-text-color: #625f57;
40
- --code-background-color: #eeeeee;
41
- --blockquote-background-color: #f7f6f6;
42
- --blockquote-border-color: #dfe2e5;
48
+ --table-even-lines-background-color: #fafafa;
49
+ --pre-background-color: #f6f6f7;
50
+ --pre-color: #393a34;
43
51
  --highlight-color: #564ce0;
44
- --table-border-color: #cccccc;
45
- --table-odd-lines-background-color: white;
46
- --table-even-lines-background-color: #f8f8f8;
52
+ --slides-controls: #ea9448;
47
53
  }
package/CONTRIBUTING.md CHANGED
@@ -12,9 +12,6 @@ Here is the current roadmap and feature ideas for incoming releases:
12
12
 
13
13
  - [ ] being able to resize the navbar
14
14
  - [ ] tag files with frontmatter and search files having specific tags
15
- - [ ] Make a theme switcher and make custom themes available to others (load external CSS)
16
- - [ ] rewrite the whole thing in TypeScript and use Tailwind if I am ever motivated
17
- - [ ] add some remark plugins (Mermaid ? Any ideas from you ?)
18
15
 
19
16
  If a fix needs to be done or your contributing idea is part of this roadmap, it will most likely be taken into account.
20
17