Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Details improvements #917

Merged
merged 7 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 20.0.1 - 2024-05-31
* Details improvements. [#917](https://github.com/fsprojects/FSharp.Formatting/pull/917)

## 20.0.0 - 2024-02-14

Stable release
Expand Down
75 changes: 30 additions & 45 deletions docs/content/fsdocs-default.css
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
--main-grid-row: 2;
--main-grid-column: 2;
--dialog-width: 500px;
--api-docs-first-column-min-width: 320px;
--api-docs-second-column-min-width: 240px;

/* light theme */
--primary: #1e8bc3;
Expand Down Expand Up @@ -1013,37 +1015,40 @@ span[onmouseout] {
padding: var(--spacing-400) 0;
}

& tbody td {
border-top: 1px solid var(--header-border);
padding: var(--spacing-300) 0;
padding-right: var(--spacing-300);
& tr {
display: flex;
flex-flow: row wrap;
column-gap: var(--spacing-300);

&:first-child a {
& td:first-of-type {
flex: 25 0 0;
min-width: var(--api-docs-first-column-min-width);
overflow-x: hidden;
text-overflow: ellipsis;
width: 100%;
display: block;
overflow-wrap: break-word;

& p {
margin: unset;
}
}

&:last-child {
padding-right: 0;
& td:nth-of-type(2) {
flex: 75 0 0;
min-width: var(--api-docs-second-column-min-width);
}
}

& thead tr td:first-child, & td.fsdocs-entity-name, & td.fsdocs-member-usage {
width: 25%;

& p {
margin: 0;
}
& tbody td {
border-top: 1px solid var(--header-border);
padding: var(--spacing-300) 0;
}

.fsdocs-entity-xmldoc {
> div {
display: flex;
flex-direction: row-reverse;
justify-content: flex-start;
align-items: center;
align-items: flex-start;

& p.fsdocs-summary {
margin: 0;
Expand All @@ -1061,12 +1066,17 @@ span[onmouseout] {

.fsdocs-member-xmldoc {
& summary {
list-style: none;
display: list-item;
counter-increment: list-item 0;
list-style: disclosure-closed outside;
cursor: pointer;
margin-left: var(--spacing-300);

> .fsdocs-summary {
display: flex;
align-items: center;
flex-direction: row-reverse;
justify-content: flex-start;
align-items: flex-start;

& p.fsdocs-summary {
margin: 0;
Expand All @@ -1080,23 +1090,15 @@ span[onmouseout] {
overflow-x: auto;
}
}

&::after {
content: '▶';
cursor: pointer;
}
}

& details[open] summary {
list-style-type: disclosure-open;
margin-bottom: var(--spacing-200);
}

& details[open] summary::after {
content: "▼";
}

.fsdocs-returns, .fsdocs-params {
margin: var(--spacing-200) 0;
margin: var(--spacing-200);

&:first-child {
margin-top: 0;
Expand All @@ -1110,23 +1112,6 @@ span[onmouseout] {
.fsdocs-return-name, .fsdocs-param-name {
font-weight: 500;
}

/* hide the browser mark and display one after the summary */

& ::marker {
display: none;
}

> div.fsdocs-summary {
display: flex;
flex-direction: row-reverse;
justify-content: space-between;
align-items: center;

> p {
margin: 0;
}
}
}
}

Expand Down
13 changes: 10 additions & 3 deletions docs/content/fsdocs-theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,18 @@ if (activeItem && mainMenu) {
scrollToActiveItem(activeItem);
}

if(location.hash) {
const header = document.querySelector(`a[href='${location.hash}']`);
header.scrollIntoView({ behavior: 'instant'});
function scrollToAndExpandSelectedMember() {
if (location.hash) {
const details = document.querySelector(`tr > td.fsdocs-member-usage:has(a[href='${location.hash}']) ~ td.fsdocs-member-xmldoc > details`);
details?.setAttribute('open', 'true');
const header = document.querySelector(`a[href='${location.hash}']`);
header?.scrollIntoView({ behavior: 'instant'});
}
}

scrollToAndExpandSelectedMember();
addEventListener('hashchange', scrollToAndExpandSelectedMember);

if(location.pathname.startsWith('/reference/')) {
// Scroll to API Reference header
const navHeaders = document.querySelectorAll(".nav-header");
Expand Down
Loading