hyperbook 0.39.1 → 0.40.1

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.
@@ -134,33 +134,9 @@ pre button.rehype-pretty-copy {
134
134
  font-weight: 700;
135
135
  }
136
136
 
137
- [data-chars-id="r"] {
138
- color: #9f123980 !important;
139
- background-color: rgb(249, 168, 212) !important;
140
- }
141
-
142
- [data-chars-id="y"] {
143
- color: #854d0e80 !important;
144
- background-color: rgb(253, 224, 71) !important;
145
- }
146
-
147
- [data-chars-id="l"] {
148
- color: #6b21a880 !important;
149
- background-color: rgb(233, 213, 255) !important;
150
- }
151
-
152
-
153
- figure[data-rehype-pretty-code-figure] pre,
154
- code[data-theme*=" "],
155
- code[data-theme*=" "] span {
156
- color: var(--shiki-light);
157
- background-color: var(--shiki-light-bg);
158
- }
159
-
160
137
  [data-rehype-pretty-code-title] {
161
138
  border-top-left-radius: .5rem;
162
139
  border-top-right-radius: .5rem;
163
- border-color: var(--color-spacer);
164
140
  border-style: solid;
165
141
  border-width: 1px;
166
142
  border-bottom: none;
@@ -168,17 +144,6 @@ code[data-theme*=" "] span {
168
144
  font-size: .875rem;
169
145
  line-height: 1.25rem;
170
146
  font-weight: 600;
171
- color: var(--color-text);
172
- }
173
-
174
- [data-rehype-pretty-code-title] {
175
- color: var(--color-text);
176
- background-color: var(--color-nav);
177
- border-color: var(--color-spacer);
178
- }
179
-
180
- [data-highlighted-line] {
181
- background: var(--color-nav) !important;
182
147
  }
183
148
 
184
149
  figure[data-rehype-pretty-code-figure]:has(>[data-rehype-pretty-code-title]) pre {
@@ -213,47 +178,3 @@ code[data-line-numbers-max-digits="3"]>[data-line]::before {
213
178
  code[data-line-numbers-max-digits="4"]>[data-line]::before {
214
179
  width: 2.25rem;
215
180
  }
216
-
217
- @media (prefers-color-scheme: dark) {
218
-
219
- figure[data-rehype-pretty-code-figure] pre,
220
- code[data-theme*=" "],
221
- code[data-theme*=" "] span {
222
- color: var(--shiki-dark);
223
- background-color: var(--shiki-dark-bg);
224
- }
225
-
226
- [data-highlighted-chars] {
227
- background-color: var(--color-spacer) !important;
228
- }
229
-
230
- [data-rehype-pretty-code-title] {
231
- color: var(--color-text);
232
- background-color: var(--color-spacer);
233
- border-color: var(--color-spacer);
234
- }
235
-
236
- [data-highlighted-line] {
237
- background: var(--color-spacer) !important;
238
- }
239
-
240
- [data-char-id] {
241
- background-color: var(--color-spacer);
242
- }
243
-
244
- [data-chars-id="r"] {
245
- background-color: #9f123980 !important;
246
- color: rgb(249, 168, 212) !important;
247
- }
248
-
249
- [data-chars-id="y"] {
250
- background-color: #854d0e80 !important;
251
- color: rgb(253, 224, 71) !important;
252
- }
253
-
254
- [data-chars-id="l"] {
255
- background-color: #6b21a880 !important;
256
- color: rgb(233, 213, 255) !important;
257
- }
258
-
259
- }
@@ -378,19 +378,16 @@ figure {
378
378
  }
379
379
 
380
380
  #search-toggle {
381
- background-color: var(--color-text);
381
+ background-color: var(--color-brand-text);
382
382
  width: 24px;
383
383
  height: 24px;
384
384
  cursor: pointer;
385
385
  margin-right: 16px;
386
386
  mask-repeat: no-repeat;
387
+ cursor: pointer;
387
388
  mask-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxzdmcgY2xhc3M9ImZlYXRoZXIgZmVhdGhlci1zZWFyY2giIGZpbGw9Im5vbmUiIGhlaWdodD0iMjQiIHN0cm9rZT0iY3VycmVudENvbG9yIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHN0cm9rZS13aWR0aD0iMiIgdmlld0JveD0iMCAwIDI0IDI0IiB3aWR0aD0iMjQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGNpcmNsZSBjeD0iMTEiIGN5PSIxMSIgcj0iOCIvPjxsaW5lIHgxPSIyMSIgeDI9IjE2LjY1IiB5MT0iMjEiIHkyPSIxNi42NSIvPjwvc3ZnPg==')
388
389
  }
389
390
 
390
- #search-toggle:hover {
391
- background-color: var(--color-brand);
392
- }
393
-
394
391
  #search-drawer {
395
392
  overflow-y: auto;
396
393
  background: var(--color-nav);
@@ -448,7 +445,9 @@ figure {
448
445
  color: var(--color-text);
449
446
  font-size: 1rem;
450
447
  border-radius: 8px;
451
- background-color: var(--color-nav-border);
448
+ border-color: var(--color-nav-border);
449
+ border-style: solid;
450
+ border-width: 1px;
452
451
  padding: 8px;
453
452
  }
454
453
 
@@ -474,7 +473,7 @@ figure {
474
473
  display: flex;
475
474
  flex-direction: column;
476
475
  padding: 8px;
477
- height: calc(var(--app-height));
476
+ height: 100%;
478
477
  overflow-y: auto;
479
478
  gap: 8px;
480
479
  }
@@ -487,7 +486,7 @@ figure {
487
486
  .toc-drawer-content {
488
487
  display: flex;
489
488
  flex-direction: column;
490
- height: calc(var(--app-height));
489
+ height: 100%;
491
490
  }
492
491
 
493
492
  .toc-drawer-content>nav {
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Copyright 2024 Google LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ // @license © 2024 Google LLC. Licensed under the Apache License, Version 2.0.
18
+ (() => {
19
+ const ELEMENT_ID = 'dark-mode-toggle-stylesheets';
20
+ const STORAGE_NAME = 'dark-mode-toggle';
21
+ const LIGHT = 'light';
22
+ const DARK = 'dark';
23
+
24
+ let stylesheets = document.getElementById(ELEMENT_ID).textContent;
25
+
26
+ let mode = null;
27
+ try {
28
+ mode = localStorage.getItem(STORAGE_NAME);
29
+ } catch (e) {}
30
+
31
+ const lightCSSMediaRegex = /\(\s*prefers-color-scheme\s*:\s*light\s*\)/gi;
32
+ const darkCSSMediaRegex = /\(\s*prefers-color-scheme\s*:\s*dark\s*\)/gi;
33
+
34
+ switch (mode) {
35
+ case LIGHT:
36
+ stylesheets = stylesheets
37
+ .replace(lightCSSMediaRegex, '$&, all')
38
+ .replace(darkCSSMediaRegex, '$& and not all');
39
+ break;
40
+
41
+ case DARK:
42
+ stylesheets = stylesheets
43
+ .replace(darkCSSMediaRegex, '$&, all')
44
+ .replace(lightCSSMediaRegex, '$& and not all');
45
+ break;
46
+ }
47
+
48
+ document.write(stylesheets);
49
+ })();