Skip to content

Commit 1bf1353

Browse files
authored
fix: upstream changes from jsr (#712)
1 parent 6a3cf3b commit 1bf1353

File tree

87 files changed

+282
-249
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+282
-249
lines changed

src/html/comrak.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ impl SyntaxHighlighterAdapter for ComrakHighlightWrapperAdapter {
229229
write!(output, "</code>")?;
230230
write!(
231231
output,
232-
r#"<button class="context_button" data-copy="{}">{}{}</button>"#,
232+
r#"<button class="copyButton" data-copy="{}">{}{}</button>"#,
233233
html_escape::encode_double_quoted_attribute(code),
234234
include_str!("./templates/icons/copy.svg"),
235235
include_str!("./templates/icons/check.svg"),

src/html/templates/comrak.css

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
@apply inline text-stone-600 dark:text-stone-400;
1717

1818
p {
19-
@apply inline-block line-clamp-4;
19+
max-width: 100%;
20+
21+
@apply inline-block line-clamp-4 leading-normal;
2022
}
2123

2224
:not(pre) > code {
@@ -25,10 +27,7 @@
2527
}
2628
}
2729

28-
.context_button {
29-
@apply absolute top-3 right-4 opacity-60 hover:opacity-100 active:opacity-100
30-
transition duration-75;
31-
30+
.copyButton {
3231
svg.check {
3332
@apply hidden;
3433
}
@@ -45,7 +44,7 @@
4544
}
4645

4746
.markdown {
48-
@apply space-y-3 shrink min-w-0 max-w-[40ch] sm:max-w-screen-sm
47+
@apply space-y-3 shrink min-w-0 max-w-prose sm:max-w-screen-sm
4948
md:max-w-screen-md lg:max-w-[75ch];
5049

5150
h1 {
@@ -195,13 +194,17 @@
195194
@apply text-red-600 stroke-red-600 dark:text-red-600 dark:stroke-red-600;
196195
}
197196
}
198-
}
199197

200-
.markdown .highlight {
201-
@apply relative text-black bg-gray-50 dark:bg-gray-800 dark:text-white;
198+
code {
199+
@apply w-full;
200+
}
201+
202+
.highlight {
203+
@apply relative text-black bg-gray-50 dark:bg-gray-800 dark:text-white;
202204

203-
.lineNumbers {
204-
@apply border-r-2 border-gray-300 pr-1 text-right flex-none
205-
dark:border-gray-600;
205+
.lineNumbers {
206+
@apply border-r-2 border-gray-300 pr-1 text-right flex-none
207+
dark:border-gray-600;
208+
}
206209
}
207210
}

src/html/templates/comrak.gen.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/html/templates/pages/darkmode_toggle.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ function setTheme(theme, themeToggle) {
2121

2222
window.addEventListener("load", () => {
2323
const themeToggle = document.getElementById("theme-toggle");
24+
themeToggle.removeAttribute("style");
2425

2526
const storedTheme = localStorage.getItem("theme");
2627
const systemPrefersDark =
@@ -40,8 +41,6 @@ window.addEventListener("load", () => {
4041
}
4142
});
4243

43-
document.getElementById("theme-toggle").removeAttribute("style");
44-
4544
// prevent flash
4645
const theme = localStorage.getItem("theme") ||
4746
(window.matchMedia("(prefers-color-scheme: dark)").matches

src/html/templates/pages/search.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ function renderResults(results) {
117117

118118
for (const result of results) {
119119
const kind = result.kind.map((kind) => {
120-
return `<div class="text-${kind.kind} bg-${kind.kind}/15 text-${kind.kind}Dark bg-${kind.kind}Dark/15" title="${kind.title}">${kind.char}</div>`;
120+
return `<div class="text-${kind.kind} bg-${kind.kind}/15 dark:text-${kind.kind}Dark dark:bg-${kind.kind}Dark/15" title="${kind.title}">${kind.char}</div>`;
121121
}).join("");
122122

123123
html += `<li class="block">
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<a
2-
class="context_button relative mr-2"
2+
class="sourceButton"
33
href="{{this}}">
44
{{~> icons/source ~}}
55
</a>

src/html/templates/styles.css

Lines changed: 52 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ a {
1515
--ddoc-selection-selected-border-color: #2564eb;
1616
--ddoc-selection-selected-bg: #056cf00c;
1717
--ddoc-selection-padding: 9px 15px;
18+
--ddoc-usage-active-bg: #ebf6ff;
19+
20+
&:is(.dark *) {
21+
--ddoc-usage-active-bg: theme("colors.stone.800");
22+
}
1823
}
1924

2025
.link {
@@ -63,6 +68,10 @@ a {
6368
.docEntry {
6469
@apply mb-4 space-y-2;
6570

71+
&:hover .sourceButton {
72+
@apply flex;
73+
}
74+
6675
.docEntryHeader {
6776
@apply flex justify-between items-start md:text-base;
6877

@@ -79,7 +88,7 @@ a {
7988
@apply space-y-2;
8089

8190
> h2 {
82-
@apply text-xl leading-6 font-semibold py-1 mb-0;
91+
@apply text-xl leading-6 font-semibold py-1 mb-4;
8392
}
8493

8594
/* markdown */
@@ -90,7 +99,7 @@ a {
9099
}
91100

92101
.namespaceSection {
93-
@apply space-y-4 mt-4 max-w-prose;
102+
@apply space-y-3 mt-4 max-w-prose;
94103

95104
.namespaceItem {
96105
@apply flex gap-x-2.5 md:min-h-[4rem] lg:pr-4 min-h-0;
@@ -112,12 +121,12 @@ a {
112121
}
113122

114123
.namespaceItemContent {
115-
> a, .namespaceItemContentSubItems a {
116-
@apply underline decoration-stone-300 dark:decoration-stone-500;
124+
flex: 1;
125+
width: 0;
117126

118-
&:hover {
119-
@apply no-underline;
120-
}
127+
> a, .namespaceItemContentSubItems a {
128+
@apply underline decoration-stone-300 dark:decoration-stone-500
129+
hover:no-underline;
121130
}
122131

123132
> a {
@@ -146,9 +155,13 @@ a {
146155
article {
147156
@apply space-y-5;
148157

149-
> div:first-child {
158+
.symbolTitle {
150159
@apply flex justify-between items-start;
151160

161+
&:hover .sourceButton {
162+
@apply flex;
163+
}
164+
152165
> div:first-child {
153166
@apply font-medium space-y-1;
154167
}
@@ -160,7 +173,7 @@ a {
160173
@apply inline-flex justify-end shrink-0;
161174

162175
div {
163-
@apply rounded-full size-5 font-medium text-xs leading-5 text-center
176+
@apply rounded-full size-4 font-medium text-xs leading-4 text-center
164177
align-middle shrink-0 select-none font-mono;
165178
}
166179

@@ -295,20 +308,30 @@ a {
295308
dark:border-gray-600 dark:bg-gray-800;
296309

297310
> code:first-child {
298-
@apply py-2 px-3;
311+
@apply pt-2 pr-10 pb-2 pl-2;
299312
scrollbar-width: thin;
300313
}
301314

302-
.context_button {
303-
@apply top-1 right-2 opacity-0 hidden;
315+
.copyButton {
316+
@apply top-1 right-2 opacity-0;
304317
}
305318

306-
&:hover .context_button {
307-
@apply opacity-100 block;
319+
&:hover .copyButton {
320+
@apply opacity-100;
308321
}
309322
}
310323
}
311324

325+
pre.highlight {
326+
.copyButton {
327+
@apply absolute opacity-0 top-3 right-4;
328+
}
329+
330+
&:hover .copyButton {
331+
@apply opacity-60 hover:opacity-100;
332+
}
333+
}
334+
312335
#categoryPanel {
313336
@apply pt-3 text-sm;
314337

@@ -346,15 +369,25 @@ a {
346369
}
347370
}
348371

349-
.context_button {
350-
@apply z-10 rounded p-1.5 cursor-pointer border bg-inherit hover:bg-stone-200
351-
leading-[0] dark:bg-inherit dark:hover:bg-stone-800;
352-
}
353-
354372
.see {
355373
@apply list-disc list-inside;
356374

357375
> li * {
358376
display: inline-block;
359377
}
360378
}
379+
380+
.sourceButton, .copyButton {
381+
@apply z-10 rounded no-underline p-1.5 cursor-pointer bg-inherit
382+
hover:bg-stone-200 leading-[0] dark:hover:bg-stone-800 transition
383+
duration-75;
384+
}
385+
386+
.sourceButton {
387+
@apply flex-row gap-2 items-center relative mr-2 hidden;
388+
389+
&:before {
390+
content: "View code";
391+
@apply hidden md:block text-xs leading-none;
392+
}
393+
}

src/html/templates/styles.gen.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/html/templates/symbol_group.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<main class="symbolGroup" id="symbol_{{name}}">
22
{{~#each symbols~}}
33
<article>
4-
<div>
4+
<div class="symbolTitle">
55
<div>
66
<div class="text-2xl leading-none break-all">
77
<span class="text-{{this.kind.kind}}">{{this.kind.title_lowercase}}</span>&nbsp;<span class="font-bold">{{../name}}</span>

src/html/usage.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ fn render_css_for_usage(name: &str) -> String {
3535
}}
3636
#{name}:checked ~ nav label[for='{name}'] {{
3737
cursor: unset;
38-
background-color: #EBF6FF;
38+
background-color: var(--ddoc-usage-active-bg);
3939
}}
4040
"#
4141
)

0 commit comments

Comments
 (0)