hematite 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/_sass/_nav.scss +29 -2
- data/_sass/_sizes.scss +1 -0
- data/assets/html/settings.html +10 -1
- data/assets/js/Settings.mjs +48 -4
- data/assets/js/main.mjs +3 -3
- data/assets/js/sidebar.mjs +2 -2
- data/assets/string_data/en.mjs +1 -0
- data/assets/string_data/es.mjs +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5f6a0cdf074d0025f0cf3031037a4dc365af38f99aa811578f3d88f0c356175
|
4
|
+
data.tar.gz: 533d5d2c8897c2985977971c5a6ca66552df1edee4bae22c9184750e97478007
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be650d2182b5d2dccdc6bccc3837691246f94bf8271bda4343cd923e7da5eb2c9fa3ddc960f35d2711c13cf51b574f3b27eddd47f31afc3c8688e231ab22afe7
|
7
|
+
data.tar.gz: 7ebc7f1a7902040eb224a1adb08da8115207303e028e4bad22d608f061e11a3f5450da65c2e572da68a10317c835ba73469d1ebef1c7a9f2a182a5567eb4f80f
|
data/_sass/_nav.scss
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
$header-z-index: 100;
|
4
4
|
|
5
|
-
header {
|
5
|
+
body > header {
|
6
6
|
position: sticky;
|
7
7
|
top: 0;
|
8
8
|
z-index: $header-z-index;
|
@@ -41,6 +41,33 @@ header {
|
|
41
41
|
}
|
42
42
|
}
|
43
43
|
|
44
|
+
:root.minimizedNavHeader body > header {
|
45
|
+
> *:not(#toggle_sidebar_btn) {
|
46
|
+
opacity: 0;
|
47
|
+
display: inline-block;
|
48
|
+
transition: opacity 0.5s ease;
|
49
|
+
}
|
50
|
+
|
51
|
+
word-wrap: break-word;
|
52
|
+
width: var(--header-height);
|
53
|
+
padding: 0;
|
54
|
+
transition: width 0.5s ease;
|
55
|
+
|
56
|
+
position: fixed;
|
57
|
+
|
58
|
+
// The minimizedNavHeader class is added after page load. Make the
|
59
|
+
// transition less jarring.
|
60
|
+
animation: fade-in 0.5s ease 1;
|
61
|
+
}
|
62
|
+
|
63
|
+
:root.minimizedNavHeader.hasOpenSidebar body > header {
|
64
|
+
> *:not(#toggle_sidebar_btn) {
|
65
|
+
opacity: 1;
|
66
|
+
}
|
67
|
+
|
68
|
+
width: calc(var(--nav-width) + #{2 * $navbar-padding});
|
69
|
+
}
|
70
|
+
|
44
71
|
nav.sidebar {
|
45
72
|
position: fixed;
|
46
73
|
top: var(--header-height);
|
@@ -58,7 +85,7 @@ nav.sidebar {
|
|
58
85
|
color: var(--primary-text-color);
|
59
86
|
background-color: var(--primary-background-color);
|
60
87
|
box-shadow: 0 0 2px var(--shadow-color-light);
|
61
|
-
padding:
|
88
|
+
padding: $navbar-padding;
|
62
89
|
|
63
90
|
z-index: $header-z-index - 1;
|
64
91
|
|
data/_sass/_sizes.scss
CHANGED
data/assets/html/settings.html
CHANGED
@@ -30,6 +30,9 @@ noindex: true
|
|
30
30
|
<label id="page_theme_lbl" for="page_theme">settings_theme_label</label>
|
31
31
|
<select id="page_theme"></select>
|
32
32
|
</div>
|
33
|
+
<div>
|
34
|
+
<label id="page_minimize_header_lbl" for="minimize_page_hdr">settings_minimize_header</label>
|
35
|
+
<input type="checkbox" id="minimize_page_hdr"/>
|
33
36
|
</fieldset>
|
34
37
|
|
35
38
|
<script type="module">
|
@@ -39,7 +42,7 @@ import { stringLookup } from "{{ 'assets/js/strings.mjs' | relative_url }}";
|
|
39
42
|
let settingsTextElemIDs = [
|
40
43
|
`settings_header`, `settings_description`, `font_legend`,
|
41
44
|
`font_family_lbl`, `font_size_lbl`, `theme_legend`,
|
42
|
-
`page_theme_lbl`,
|
45
|
+
`page_theme_lbl`, `page_minimize_header_lbl`,
|
43
46
|
];
|
44
47
|
|
45
48
|
// Localize all descriptive settings elements (each should contian the
|
@@ -52,6 +55,7 @@ for (const id of settingsTextElemIDs) {
|
|
52
55
|
let fontSizeSelect = document.querySelector("#font_size");
|
53
56
|
let fontFamilySelect = document.querySelector("#font_family");
|
54
57
|
let pageThemeSelect = document.querySelector("#page_theme");
|
58
|
+
let minimizeHeaderCheckbox = document.querySelector("#minimize_page_hdr");
|
55
59
|
|
56
60
|
pageThemeSelect.innerHTML =
|
57
61
|
`
|
@@ -87,8 +91,13 @@ pageThemeSelect.oninput = () => {
|
|
87
91
|
Settings.setTheme(pageThemeSelect.value);
|
88
92
|
};
|
89
93
|
|
94
|
+
minimizeHeaderCheckbox.oninput = () => {
|
95
|
+
Settings.setHeaderMinimized(minimizeHeaderCheckbox.checked);
|
96
|
+
};
|
97
|
+
|
90
98
|
pageThemeSelect.value = Settings.getTheme();
|
91
99
|
fontFamilySelect.value = Settings.getFontFamily();
|
92
100
|
fontSizeSelect.value = Settings.getFontSize();
|
101
|
+
minimizeHeaderCheckbox.checked = Settings.getHeaderMinimized();
|
93
102
|
|
94
103
|
</script>
|
data/assets/js/Settings.mjs
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
---
|
2
2
|
---
|
3
|
+
import AsyncUtil from "./AsyncUtil.mjs";
|
4
|
+
import AnimationUtil from "./AnimationUtil.mjs";
|
5
|
+
|
6
|
+
const THEME_TRANSITION_TIME = 500; // ms
|
3
7
|
|
4
8
|
class Settings {
|
5
9
|
THEME_AUTO = 'auto';
|
@@ -18,6 +22,7 @@ class Settings {
|
|
18
22
|
FONT_SIZE_KEY_ = 'hematite-setting-font-size';
|
19
23
|
FONT_FAMILY_KEY_ = 'hematite-setting-font-family';
|
20
24
|
THEME_KEY_ = 'hematite-setting-theme';
|
25
|
+
HEADER_MINIMIZED_KEY_ = 'hematite-setting-minimize-header';
|
21
26
|
|
22
27
|
constructor() {
|
23
28
|
}
|
@@ -43,6 +48,11 @@ class Settings {
|
|
43
48
|
return this.getSetting_(this.FONT_SIZE_KEY_) ?? this.FONT_SIZE_DEFAULT;
|
44
49
|
}
|
45
50
|
|
51
|
+
getHeaderMinimized() {
|
52
|
+
let minimizedStr = this.getSetting_(this.HEADER_MINIMIZED_KEY_) ?? {{ site.hematite.minimize_header | default: "false" | jsonify }};
|
53
|
+
return minimizedStr == "true";
|
54
|
+
}
|
55
|
+
|
46
56
|
setFontSize(sizeOption) {
|
47
57
|
this.setSetting_(this.FONT_SIZE_KEY_, sizeOption);
|
48
58
|
}
|
@@ -55,6 +65,10 @@ class Settings {
|
|
55
65
|
this.setSetting_(this.THEME_KEY_, themeOption);
|
56
66
|
}
|
57
67
|
|
68
|
+
setHeaderMinimized(minimize) {
|
69
|
+
this.setSetting_(this.HEADER_MINIMIZED_KEY_, `${minimize}`);
|
70
|
+
}
|
71
|
+
|
58
72
|
getFontSizePt_() {
|
59
73
|
let fontSizeOption = this.getFontSize();
|
60
74
|
|
@@ -87,7 +101,9 @@ class Settings {
|
|
87
101
|
return this.getTheme() == this.THEME_LIGHT;
|
88
102
|
}
|
89
103
|
|
90
|
-
applySettings() {
|
104
|
+
async applySettings() {
|
105
|
+
document.documentElement.classList.add("changingTheme");
|
106
|
+
|
91
107
|
// Clean up previous changes. We might be re-applying styles.
|
92
108
|
document.documentElement.classList.remove("lightTheme");
|
93
109
|
document.documentElement.classList.remove("darkTheme");
|
@@ -99,7 +115,12 @@ class Settings {
|
|
99
115
|
}
|
100
116
|
|
101
117
|
|
102
|
-
let styleHTML =
|
118
|
+
let styleHTML =
|
119
|
+
`
|
120
|
+
:root.changingTheme * {
|
121
|
+
transition: ${THEME_TRANSITION_TIME}ms ease all;
|
122
|
+
}
|
123
|
+
`;
|
103
124
|
|
104
125
|
// Font family
|
105
126
|
if (this.usingNonDefaultFontFamily_()) {
|
@@ -121,6 +142,9 @@ class Settings {
|
|
121
142
|
`;
|
122
143
|
}
|
123
144
|
|
145
|
+
this.style_.innerHTML = styleHTML;
|
146
|
+
document.documentElement.appendChild(this.style_);
|
147
|
+
|
124
148
|
// Theme
|
125
149
|
if (this.forcingDarkTheme_()) {
|
126
150
|
document.documentElement.classList.add("darkTheme");
|
@@ -129,8 +153,28 @@ class Settings {
|
|
129
153
|
document.documentElement.classList.add("lightTheme");
|
130
154
|
}
|
131
155
|
|
132
|
-
this.
|
133
|
-
|
156
|
+
if (this.getHeaderMinimized()) {
|
157
|
+
// Run roughly in parallel
|
158
|
+
(async () => {
|
159
|
+
let header = document.querySelector("body > header");
|
160
|
+
if (header) {
|
161
|
+
await AnimationUtil.collapseOutVert(header, THEME_TRANSITION_TIME / 2);
|
162
|
+
}
|
163
|
+
|
164
|
+
document.documentElement.classList.add("minimizedNavHeader");
|
165
|
+
|
166
|
+
// Animate the header.
|
167
|
+
if (header) {
|
168
|
+
await AnimationUtil.expandInVert(header, THEME_TRANSITION_TIME / 2);
|
169
|
+
}
|
170
|
+
})();
|
171
|
+
}
|
172
|
+
else {
|
173
|
+
document.documentElement.classList.remove("minimizedNavHeader");
|
174
|
+
}
|
175
|
+
|
176
|
+
await AsyncUtil.waitMillis(THEME_TRANSITION_TIME);
|
177
|
+
document.documentElement.classList.remove("changingTheme");
|
134
178
|
}
|
135
179
|
}
|
136
180
|
|
data/assets/js/main.mjs
CHANGED
@@ -17,7 +17,7 @@ addEventListener("load", () => {
|
|
17
17
|
// After loading elements, but before loading elements like images.
|
18
18
|
addEventListener("DOMContentLoaded", () => {
|
19
19
|
handleSidebar();
|
20
|
-
|
21
|
-
// Apply user-specified settings
|
22
|
-
Settings.applySettings();
|
23
20
|
});
|
21
|
+
|
22
|
+
// Apply user-specified settings
|
23
|
+
Settings.applySettings();
|
data/assets/js/sidebar.mjs
CHANGED
@@ -17,11 +17,11 @@ function handleSidebar() {
|
|
17
17
|
const setSidebarOpen = (open) => {
|
18
18
|
if (!open) {
|
19
19
|
sidebar.classList.remove(`open`);
|
20
|
-
document.
|
20
|
+
document.documentElement.classList.remove(`hasOpenSidebar`);
|
21
21
|
}
|
22
22
|
else {
|
23
23
|
sidebar.classList.add(`open`);
|
24
|
-
document.
|
24
|
+
document.documentElement.classList.add(`hasOpenSidebar`);
|
25
25
|
}
|
26
26
|
};
|
27
27
|
|
data/assets/string_data/en.mjs
CHANGED
data/assets/string_data/es.mjs
CHANGED