initial commit
This commit is contained in:
17
mne/html_templates/repr/static/_channels.html.jinja
Normal file
17
mne/html_templates/repr/static/_channels.html.jinja
Normal file
@@ -0,0 +1,17 @@
|
||||
{% set channel_names_good = channels["good"] | map(attribute='name_html') | join(', ') %}
|
||||
<tr class="repr-element {{ section_class_name }} {{ collapsed_row_class }}">
|
||||
<td class="mne-repr-section-toggle"></td>
|
||||
<td>{{ channel_type }}</td>
|
||||
<td>
|
||||
<button class="mne-ch-names-btn sd-sphinx-override sd-btn sd-btn-info sd-text-wrap sd-shadow-sm" onclick="alert('Good {{ channel_type}}:\n\n{{ channel_names_good | safe }}')" title="(Click to open in popup) {{ channel_names_good | safe }}">
|
||||
{{ channels["good"] | length}}
|
||||
</button>
|
||||
|
||||
{% if channels["bad"] %}
|
||||
{% set channel_names_bad = channels["bad"] | map(attribute='name_html') | join(', ') %}
|
||||
and <button class="mne-ch-names-btn sd-sphinx-override sd-btn sd-btn-info sd-text-wrap sd-shadow-sm" onclick="alert('Bad {{ channel_type}}:\n\n{{ channel_names_bad | safe }}')" title="(Click to open in popup) {{ channel_names_bad | safe }}">
|
||||
{{ channels["bad"] | length}} bad
|
||||
</button>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
@@ -0,0 +1,12 @@
|
||||
<tr class="mne-repr-section-header {{ section_class_name }}"
|
||||
{% if collapsed %} title="Show section" {% else %} title="Hide section" {% endif %}
|
||||
onclick="toggleVisibility('{{ section_class_name }}')">
|
||||
<th class="mne-repr-section-toggle">
|
||||
<button {% if collapsed %}class="collapsed"{% endif %}>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z"/></svg>
|
||||
</button>
|
||||
</th>
|
||||
<th colspan="2">
|
||||
<strong>{{ section }}</strong>
|
||||
</th>
|
||||
</tr>
|
||||
107
mne/html_templates/repr/static/repr.css
Normal file
107
mne/html_templates/repr/static/repr.css
Normal file
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
Styles in this section apply both to the sphinx-built website docs and to notebooks
|
||||
rendered in an IDE or in Jupyter. In our web docs, styles here are complemented by
|
||||
doc/_static/styles.css and other CSS files (e.g. from the sphinx theme, sphinx-gallery,
|
||||
or bootstrap). In IDEs/Jupyter, those style files are unavailable, so only the rules in
|
||||
this file apply (plus whatever default styling the IDE applies).
|
||||
*/
|
||||
.mne-repr-table {
|
||||
display: inline; /* prevent using full container width */
|
||||
}
|
||||
.mne-repr-table tr.mne-repr-section-header > th {
|
||||
padding-top: 1rem;
|
||||
text-align: left;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.mne-repr-section-toggle > button {
|
||||
all: unset;
|
||||
display: block;
|
||||
height: 1rem;
|
||||
width: 1rem;
|
||||
}
|
||||
.mne-repr-section-toggle > button > svg {
|
||||
height: 60%;
|
||||
}
|
||||
|
||||
/* transition (rotation) effects on the collapser button */
|
||||
.mne-repr-section-toggle > button.collapsed > svg {
|
||||
transition: 0.1s ease-out;
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
.mne-repr-section-toggle > button:not(.collapsed) > svg {
|
||||
transition: 0.1s ease-out;
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
/* hide collapsed table rows */
|
||||
.mne-repr-collapsed {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
@layer {
|
||||
/*
|
||||
Selectors in a `@layer` will always be lower-precedence than selectors outside the
|
||||
layer. So even though e.g. `div.output_html` is present in the sphinx-rendered
|
||||
website docs, the styles here won't take effect there as long as some other rule
|
||||
somewhere in the page's CSS targets the same element.
|
||||
|
||||
In IDEs or Jupyter notebooks, though, the CSS files from the sphinx theme,
|
||||
sphinx-gallery, and bootstrap are unavailable, so these styles will apply.
|
||||
|
||||
Notes:
|
||||
|
||||
- the selector `.accordion-body` is for MNE Reports
|
||||
- the selector `.output_html` is for VSCode's notebook interface
|
||||
- the selector `.jp-RenderedHTML` is for Jupyter notebook
|
||||
- variables starting with `--theme-` are VSCode-specific.
|
||||
- variables starting with `--jp-` are Jupyter styles, *some of which* are also
|
||||
available in VSCode. Here we try the `--theme-` variable first, then fall back to
|
||||
the `--jp-` ones.
|
||||
*/
|
||||
.mne-repr-table {
|
||||
--mne-toggle-color: var(--theme-foreground, var(--jp-ui-font-color1));
|
||||
--mne-button-bg-color: var(--theme-button-background, var(--jp-info-color0, var(--jp-content-link-color)));
|
||||
--mne-button-fg-color: var(--theme-button-foreground, var(--jp-ui-inverse-font-color0, var(--jp-editor-background)));
|
||||
--mne-button-hover-bg-color: var(--theme-button-hover-background, var(--jp-info-color1));
|
||||
--mne-button-radius: var(--jp-border-radius, 0.25rem);
|
||||
}
|
||||
/* chevron position/alignment; in VSCode it looks ok without adjusting */
|
||||
.accordion-body .mne-repr-section-toggle > button,
|
||||
.jp-RenderedHTML .mne-repr-section-toggle > button {
|
||||
padding: 0 0 45% 25% !important;
|
||||
}
|
||||
/* chevron color; MNE Report doesn't have light/dark mode */
|
||||
div.output_html .mne-repr-section-toggle > button > svg > path,
|
||||
.jp-RenderedHTML .mne-repr-section-toggle > button > svg > path {
|
||||
fill: var(--mne-toggle-color);
|
||||
}
|
||||
.accordion-body .mne-ch-names-btn,
|
||||
div.output_html .mne-ch-names-btn,
|
||||
.jp-RenderedHTML .mne-ch-names-btn {
|
||||
-webkit-border-radius: var(--mne-button-radius);
|
||||
-moz-border-radius: var(--mne-button-radius);
|
||||
border-radius: var(--mne-button-radius);
|
||||
border: none;
|
||||
background-image: none;
|
||||
background-color: var(--mne-button-bg-color);
|
||||
color: var(--mne-button-fg-color);
|
||||
font-size: inherit;
|
||||
min-width: 1.5rem;
|
||||
padding: 0.25rem;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
}
|
||||
.accordion-body .mne-ch-names-btn:hover,
|
||||
div.output_html .mne.ch-names-btn:hover,
|
||||
.jp-RenderedHTML .mne-ch-names-btn:hover {
|
||||
background-color: var(--mne-button-hover-bg-color);
|
||||
text-decoration: underline;
|
||||
}
|
||||
.accordion-body .mne-ch-names-btn:focus-visible,
|
||||
div.output_html .mne-ch-names-btn:focus-visible,
|
||||
.jp-RenderedHTML .mne-ch-names-btn:focus-visible {
|
||||
outline: 0.1875rem solid var(--mne-button-bg-color) !important;
|
||||
outline-offset: 0.1875rem !important;
|
||||
}
|
||||
}
|
||||
23
mne/html_templates/repr/static/repr.js
Normal file
23
mne/html_templates/repr/static/repr.js
Normal file
@@ -0,0 +1,23 @@
|
||||
// must be `var` (not `const`) because this can get embedded multiple times on a page
|
||||
var toggleVisibility = (className) => {
|
||||
|
||||
const elements = document.querySelectorAll(`.${className}`);
|
||||
|
||||
elements.forEach(element => {
|
||||
if (element.classList.contains("mne-repr-section-header")) {
|
||||
return // Don't collapse the section header row
|
||||
}
|
||||
element.classList.toggle("mne-repr-collapsed");
|
||||
});
|
||||
|
||||
// trigger caret to rotate
|
||||
var sel = `.mne-repr-section-header.${className} > th.mne-repr-section-toggle > button`;
|
||||
const button = document.querySelector(sel);
|
||||
button.classList.toggle("collapsed");
|
||||
|
||||
// adjust tooltip
|
||||
sel = `tr.mne-repr-section-header.${className}`;
|
||||
const secHeadRow = document.querySelector(sel);
|
||||
secHeadRow.classList.toggle("collapsed");
|
||||
secHeadRow.title = secHeadRow.title === "Hide section" ? "Show section" : "Hide section";
|
||||
}
|
||||
Reference in New Issue
Block a user