@appartmint/mint 1.2.12 → 1.3.0
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.
- package/package.json +4 -3
- package/src/scss/imports/_index.scss +0 -10
- package/src/scss/imports/components/_backgrounds.scss +0 -38
- package/src/scss/imports/components/_buttons.scss +0 -243
- package/src/scss/imports/components/_cards.scss +0 -259
- package/src/scss/imports/components/_embed.scss +0 -75
- package/src/scss/imports/components/_footer.scss +0 -134
- package/src/scss/imports/components/_header.scss +0 -512
- package/src/scss/imports/components/_image.scss +0 -37
- package/src/scss/imports/components/_index.scss +0 -16
- package/src/scss/imports/components/_recaptcha.scss +0 -17
- package/src/scss/imports/components/_tables.scss +0 -29
- package/src/scss/imports/global/_animations.scss +0 -79
- package/src/scss/imports/global/_aspect.scss +0 -54
- package/src/scss/imports/global/_flex.scss +0 -7
- package/src/scss/imports/global/_global.scss +0 -208
- package/src/scss/imports/global/_grid.scss +0 -153
- package/src/scss/imports/global/_icons.scss +0 -6
- package/src/scss/imports/global/_index.scss +0 -12
- package/src/scss/imports/global/_inputs.scss +0 -135
- package/src/scss/imports/global/_structure.scss +0 -89
- package/src/scss/imports/global/_text.scss +0 -62
- package/src/scss/imports/global/_texture.scss +0 -124
- package/src/scss/imports/global/_themes.scss +0 -174
- package/src/scss/imports/overrides/_amplify.scss +0 -48
- package/src/scss/imports/overrides/_full-calendar.scss +0 -46
- package/src/scss/imports/overrides/_index.scss +0 -11
- package/src/scss/imports/overrides/_material.scss +0 -24
- package/src/scss/imports/overrides/_swiper.scss +0 -55
- package/src/scss/imports/util/_index.scss +0 -9
- package/src/scss/imports/util/_util.scss +0 -1034
- package/src/scss/imports/util/_vars.scss +0 -262
- package/src/scss/mint.scss +0 -7
- package/src/scss/noscript.scss +0 -14
- package/src/ts/imports/components/header.ts +0 -408
- package/src/ts/imports/components/index.ts +0 -4
- package/src/ts/imports/enums/index.ts +0 -4
- package/src/ts/imports/enums/side.ts +0 -9
- package/src/ts/imports/index.ts +0 -7
- package/src/ts/imports/models/color.ts +0 -96
- package/src/ts/imports/models/file.ts +0 -16
- package/src/ts/imports/models/index.ts +0 -9
- package/src/ts/imports/models/item.ts +0 -72
- package/src/ts/imports/models/minify.ts +0 -11
- package/src/ts/imports/models/page.ts +0 -19
- package/src/ts/imports/models/recaptcha.ts +0 -8
- package/src/ts/imports/util/async.ts +0 -12
- package/src/ts/imports/util/display.ts +0 -72
- package/src/ts/imports/util/event.ts +0 -93
- package/src/ts/imports/util/icon.ts +0 -67
- package/src/ts/imports/util/index.ts +0 -15
- package/src/ts/imports/util/list.ts +0 -39
- package/src/ts/imports/util/math.ts +0 -17
- package/src/ts/imports/util/object.ts +0 -234
- package/src/ts/imports/util/scroll.ts +0 -53
- package/src/ts/imports/util/selectors.ts +0 -185
- package/src/ts/imports/util/settings.ts +0 -85
- package/src/ts/imports/util/text.ts +0 -151
- package/src/ts/imports/util/window.ts +0 -14
- package/src/ts/index.ts +0 -10
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
/// _vars.scss - Global variables
|
|
2
|
-
/// @author App Art Mint LLC
|
|
3
|
-
///
|
|
4
|
-
/// @group Vars
|
|
5
|
-
@charset 'utf-8';
|
|
6
|
-
|
|
7
|
-
/// Global Colors
|
|
8
|
-
$bitcoin: #FF9900;
|
|
9
|
-
$ethereum: #3C3C3D;
|
|
10
|
-
$venmo: #008CFF;
|
|
11
|
-
$facebook: #3b5998;
|
|
12
|
-
$twitter: #1da1f2;
|
|
13
|
-
$youtube: #F00;
|
|
14
|
-
$apple: #DDD;
|
|
15
|
-
$apple-music: #fc3c44;
|
|
16
|
-
$spotify: #84bd00;
|
|
17
|
-
$soundcloud: #f26f23;
|
|
18
|
-
$bandcamp: #629aa9;
|
|
19
|
-
$amazon-0: #F90;
|
|
20
|
-
$amazon-1: #146eb4;
|
|
21
|
-
$napster-0: #2ca6de;
|
|
22
|
-
$napster-1: #fdb813;
|
|
23
|
-
$google-play-0: #f55a34;
|
|
24
|
-
$google-play-1: #ffd119;
|
|
25
|
-
$google-play-2: #ff8c00;
|
|
26
|
-
$instagram-0: #8a3ab9;
|
|
27
|
-
$instagram-1: #4c68d7;
|
|
28
|
-
$instagram-2: #cd486b;
|
|
29
|
-
$instagram-3: #fbad50;
|
|
30
|
-
$instagram-4: #fccc63;
|
|
31
|
-
$instagram-5: #bc2a8d;
|
|
32
|
-
$instagram-6: #e95950;
|
|
33
|
-
|
|
34
|
-
/// Application Colors
|
|
35
|
-
$black: #000 !default;
|
|
36
|
-
$white: #fff !default;
|
|
37
|
-
$grey: #888 !default;
|
|
38
|
-
$trans-light: rgba(255, 255, 255, 0) !default;
|
|
39
|
-
$trans-dark: rgba(0, 0, 0, 0) !default;
|
|
40
|
-
|
|
41
|
-
$brand: #bada55 !default;
|
|
42
|
-
$accent: #483d8b !default;
|
|
43
|
-
$success: #208a20 !default;
|
|
44
|
-
$danger: #ff4d4d !default;
|
|
45
|
-
$warning: #ffaa22 !default;
|
|
46
|
-
$info: $brand !default;
|
|
47
|
-
|
|
48
|
-
$fore: lighten($black, 10%) !default;
|
|
49
|
-
$back: darken($white, 10%) !default;
|
|
50
|
-
|
|
51
|
-
/// Fonts
|
|
52
|
-
$font-primary: sans-serif !default;
|
|
53
|
-
$font-secondary: serif !default;
|
|
54
|
-
$font-backups: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji' !default;
|
|
55
|
-
$font-secondary-backups: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji' !default;
|
|
56
|
-
$font-height: 1.25 !default;
|
|
57
|
-
|
|
58
|
-
/// Font Sizes
|
|
59
|
-
$font-size-tiny: (
|
|
60
|
-
h1: 15vw,
|
|
61
|
-
h2: 12vw,
|
|
62
|
-
h3: 10vw,
|
|
63
|
-
h4: 8vw,
|
|
64
|
-
h5: 7vw,
|
|
65
|
-
h6: 6vw,
|
|
66
|
-
p: 1rem,
|
|
67
|
-
) !default;
|
|
68
|
-
$font-size-mobile: (
|
|
69
|
-
h1: 2.5rem,
|
|
70
|
-
h2: 2rem,
|
|
71
|
-
h3: 1.75rem,
|
|
72
|
-
h4: 1.5rem,
|
|
73
|
-
h5: 1.25rem,
|
|
74
|
-
h6: 1.125rem,
|
|
75
|
-
p: 1rem,
|
|
76
|
-
) !default;
|
|
77
|
-
$font-size-desktop: (
|
|
78
|
-
h1: 3rem,
|
|
79
|
-
h2: 2.5rem,
|
|
80
|
-
h3: 2rem,
|
|
81
|
-
h4: 1.75rem,
|
|
82
|
-
h5: 1.5rem,
|
|
83
|
-
h6: 1.25rem,
|
|
84
|
-
p: 1.125rem,
|
|
85
|
-
) !default;
|
|
86
|
-
|
|
87
|
-
/// Structure
|
|
88
|
-
$grid-gap: 2rem !default;
|
|
89
|
-
|
|
90
|
-
/// Outline width
|
|
91
|
-
$border-width: 0.125rem !default;
|
|
92
|
-
$border-radius: 1rem !default;
|
|
93
|
-
|
|
94
|
-
/// Root
|
|
95
|
-
$root-bg-image: null !default;
|
|
96
|
-
$root-bg-filter: null !default;
|
|
97
|
-
$root-bg-size: null !default;
|
|
98
|
-
$root-bg-position: null !default;
|
|
99
|
-
|
|
100
|
-
/// Header
|
|
101
|
-
$header-height: 4rem !default;
|
|
102
|
-
$header-break: sm !default;
|
|
103
|
-
$header-link-border-radius: $border-radius !default;
|
|
104
|
-
|
|
105
|
-
/// Footer
|
|
106
|
-
$footer-back: back !default;
|
|
107
|
-
$footer-heel-back: brand-6 !default;
|
|
108
|
-
$footer-shadow: null !default;
|
|
109
|
-
|
|
110
|
-
/// Default Shadows
|
|
111
|
-
$shadow-color: glow-2 !default;
|
|
112
|
-
$shadow-size: 0 0 2rem -0.5rem !default;
|
|
113
|
-
|
|
114
|
-
/// Images
|
|
115
|
-
$image-shadow-size: 0.5rem !default;
|
|
116
|
-
|
|
117
|
-
/// Buttons
|
|
118
|
-
$link-color: brand-4 !default;
|
|
119
|
-
$link-color-hover: accent-2 !default;
|
|
120
|
-
|
|
121
|
-
$menu-bar-height: 0.4rem !default;
|
|
122
|
-
$menu-bar-width: $menu-bar-height * 8 !default;
|
|
123
|
-
$menu-btn-height: $menu-bar-height * 8 !default;
|
|
124
|
-
$menu-btn-padding: $menu-bar-height * 1.5 !default;
|
|
125
|
-
$menu-bar-color: fore !default;
|
|
126
|
-
$menu-btn-color: shadow-6 !default;
|
|
127
|
-
$menu-btn-shadow-color: $shadow-color !default;
|
|
128
|
-
$menu-btn-shadow-size: $shadow-size !default;
|
|
129
|
-
|
|
130
|
-
$btn-radius: $border-radius !default;
|
|
131
|
-
$btn-fore: fore !default;
|
|
132
|
-
$btn-fore-alt: $btn-fore !default;
|
|
133
|
-
$btn-fore-hover: back !default;
|
|
134
|
-
$btn-fore-alt-hover: $btn-fore-hover !default;
|
|
135
|
-
$btn-back-alt: trans !default;
|
|
136
|
-
$btn-back-alt-hover: accent-2 !default;
|
|
137
|
-
|
|
138
|
-
$btn-padding-v: 0.5rem !default;
|
|
139
|
-
$btn-padding-h: 1rem !default;
|
|
140
|
-
$btn-padding-adjust: 0.75rem !default;
|
|
141
|
-
|
|
142
|
-
$pill-radius: $border-radius !default;
|
|
143
|
-
|
|
144
|
-
/// Cards
|
|
145
|
-
$card-bg-color: back !default;
|
|
146
|
-
$card-padding: 1.5rem !default;
|
|
147
|
-
$card-radius: $border-radius !default;
|
|
148
|
-
$card-shadow-color: $shadow-color !default;
|
|
149
|
-
$card-shadow-size: $shadow-size !default;
|
|
150
|
-
$card-logo-size: 4rem !default;
|
|
151
|
-
|
|
152
|
-
/// Texture
|
|
153
|
-
$texture-padding: 1rem !default;
|
|
154
|
-
|
|
155
|
-
$texture-bg: null !default;
|
|
156
|
-
$texture-bg-size: cover !default;
|
|
157
|
-
$texture-bg-position: top !default;
|
|
158
|
-
$texture-blend: null !default;
|
|
159
|
-
$texture-filter: null !default;
|
|
160
|
-
$texture-opacity: 1 !default;
|
|
161
|
-
|
|
162
|
-
$texture-alt-bg: null !default;
|
|
163
|
-
$texture-alt-num: 0 !default;
|
|
164
|
-
$texture-alt-opacity: 1 !default;
|
|
165
|
-
$texture-alt-bg-size: cover !default;
|
|
166
|
-
$texture-alt-bg-position: center !default;
|
|
167
|
-
$texture-alt-mask: null !default;
|
|
168
|
-
$texture-alt-blend: null !default;
|
|
169
|
-
|
|
170
|
-
$texture-border-width: 1.25rem !default;
|
|
171
|
-
$texture-border-type: solid !default;
|
|
172
|
-
$texture-border-color: null !default;
|
|
173
|
-
$texture-border-image: null !default;
|
|
174
|
-
$texture-border-slice: 42 42 !default;
|
|
175
|
-
$texture-border-repeat: round !default;
|
|
176
|
-
|
|
177
|
-
/// Backgrounds
|
|
178
|
-
$back-bg-blur: 0.15vw !default;
|
|
179
|
-
|
|
180
|
-
/// Material
|
|
181
|
-
$mat-table-bg: back !default;
|
|
182
|
-
$mat-table-fore: fore !default;
|
|
183
|
-
$mat-select-bg: brand-4 !default;
|
|
184
|
-
|
|
185
|
-
/// Amplify
|
|
186
|
-
$amp-font-primary: fore !default;
|
|
187
|
-
$amp-background-error: glow-0 !default;
|
|
188
|
-
$amp-font-warning: warning !default;
|
|
189
|
-
$amp-font-success: success !default;
|
|
190
|
-
$amp-font-info: info !default;
|
|
191
|
-
$amp-border-width: $border-width !default;
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
/// Themes
|
|
195
|
-
$theme-default: light !default;
|
|
196
|
-
|
|
197
|
-
/// Default Theme (light)
|
|
198
|
-
/// Buttons
|
|
199
|
-
$btn-back-default: brand-2;
|
|
200
|
-
$btn-back: $btn-back-default !default;
|
|
201
|
-
|
|
202
|
-
$btn-border-default: brand-4;
|
|
203
|
-
$btn-border: $btn-border-default !default;
|
|
204
|
-
|
|
205
|
-
/// Header
|
|
206
|
-
$header-back-default: brand-2;
|
|
207
|
-
$header-back: $header-back-default !default;
|
|
208
|
-
|
|
209
|
-
$header-fore-default: fore;
|
|
210
|
-
$header-fore: $header-fore-default !default;
|
|
211
|
-
|
|
212
|
-
$header-link-back-hover-default: shadow-5;
|
|
213
|
-
$header-link-back-hover: $header-link-back-hover-default !default;
|
|
214
|
-
|
|
215
|
-
$header-link-fore-default: fore;
|
|
216
|
-
$header-link-fore: $header-link-fore-default !default;
|
|
217
|
-
|
|
218
|
-
$header-link-fore-hover-default: back;
|
|
219
|
-
$header-link-fore-hover: $header-link-fore-hover-default !default;
|
|
220
|
-
|
|
221
|
-
/// Footer
|
|
222
|
-
$footer-heel-fore-default: back;
|
|
223
|
-
$footer-heel-fore: $footer-heel-fore-default !default;
|
|
224
|
-
|
|
225
|
-
/// Amplify
|
|
226
|
-
$amp-border-primary-default: brand-5;
|
|
227
|
-
$amp-border-primary: $amp-border-primary-default !default;
|
|
228
|
-
$amp-border-focus-default: brand-4;
|
|
229
|
-
$amp-border-focus: $amp-border-focus-default !default;
|
|
230
|
-
$amp-font-hover-default: brand-3;
|
|
231
|
-
$amp-font-hover: $amp-font-hover-default !default;
|
|
232
|
-
$amp-font-interactive-default: brand-5;
|
|
233
|
-
$amp-font-interactive: $amp-font-interactive-default !default;
|
|
234
|
-
$amp-font-secondary-default: brand-6;
|
|
235
|
-
$amp-font-secondary: $amp-font-secondary-default !default;
|
|
236
|
-
$amp-font-error-default: danger-5 !default;
|
|
237
|
-
$amp-font-error: $amp-font-error-default !default;
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
/// Dark Theme
|
|
241
|
-
@if ($theme-default == dark) {
|
|
242
|
-
|
|
243
|
-
/// Buttons
|
|
244
|
-
$btn-back: if($btn-back != $btn-back-default, $btn-back, brand-5);
|
|
245
|
-
$btn-border: if($btn-border != $btn-border-default, $btn-border, brand-2);
|
|
246
|
-
|
|
247
|
-
/// Header
|
|
248
|
-
$header-back: if($header-back != $header-back-default, $header-back, brand-4);
|
|
249
|
-
$header-fore: if($header-fore != $header-fore-default, $header-fore, back);
|
|
250
|
-
$header-link-back-hover: if($header-link-back-hover != $header-link-back-hover-default, $header-link-back-hover, glow-5);
|
|
251
|
-
|
|
252
|
-
/// Footer
|
|
253
|
-
$footer-heel-fore: if($footer-heel-fore != $footer-heel-fore-default, $footer-heel-fore, fore);
|
|
254
|
-
|
|
255
|
-
/// Amplify
|
|
256
|
-
$amp-border-primary: if($amp-border-primary != $amp-border-primary-default, $amp-border-primary, brand-1);
|
|
257
|
-
$amp-border-focus: if($amp-border-focus != $amp-border-focus-default, $amp-border-focus, brand-3);
|
|
258
|
-
$amp-font-hover: if($amp-font-hover != $amp-font-hover-default, $amp-font-hover, brand-0);
|
|
259
|
-
$amp-font-interactive: if($amp-font-interactive != $amp-font-interactive-default, $amp-font-interactive, brand-1);
|
|
260
|
-
$amp-font-secondary: if($amp-font-secondary != $amp-font-secondary-default, $amp-font-secondary, brand-0);
|
|
261
|
-
$amp-font-error: if($amp-font-error != $amp-font-error-default, $amp-font-error, danger-4);
|
|
262
|
-
}
|
package/src/scss/mint.scss
DELETED
package/src/scss/noscript.scss
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/// noscript.scss - Styles for when JavaScript is disabled
|
|
2
|
-
/// @author App Art Mint LLC
|
|
3
|
-
///
|
|
4
|
-
/// @group Main
|
|
5
|
-
@charset 'utf-8';
|
|
6
|
-
|
|
7
|
-
/// Imports
|
|
8
|
-
@use './imports/util' as *;
|
|
9
|
-
|
|
10
|
-
#{id(header)} {
|
|
11
|
-
#{id(wrapper)} {
|
|
12
|
-
position: unset !important;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,408 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Imports
|
|
3
|
-
*/
|
|
4
|
-
import { EMintSide } from '../enums';
|
|
5
|
-
import {
|
|
6
|
-
MintDisplay,
|
|
7
|
-
MintEvent,
|
|
8
|
-
MintSelectors,
|
|
9
|
-
MintSettings,
|
|
10
|
-
MintWindow
|
|
11
|
-
} from '../util';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Main header functionality
|
|
16
|
-
* @public
|
|
17
|
-
*/
|
|
18
|
-
export class MintHeader {
|
|
19
|
-
/**
|
|
20
|
-
* Navbar settings
|
|
21
|
-
*/
|
|
22
|
-
settings: {[key: string]: any} = {
|
|
23
|
-
from: EMintSide.Top,
|
|
24
|
-
fixed: true
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Frequently-referenced elements
|
|
29
|
-
*/
|
|
30
|
-
el: {[key: string]: HTMLElement | null} = {};
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Initializes and closes the menu
|
|
34
|
-
*/
|
|
35
|
-
constructor (settings?: {[key: string]: any}) {
|
|
36
|
-
this.settings = {...this.settings, ...settings};
|
|
37
|
-
|
|
38
|
-
this.attachElements();
|
|
39
|
-
this.attachEvents();
|
|
40
|
-
this.addClasses();
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Adds elements to {@link el | `this.el`}
|
|
45
|
-
*/
|
|
46
|
-
attachElements () : void {
|
|
47
|
-
this.el.html = document.querySelector('html');
|
|
48
|
-
this.el.body = document.querySelector('body');
|
|
49
|
-
this.el.header = document.getElementById('mint-header');
|
|
50
|
-
this.el.mobileButton = this.el.header?.querySelector(MintSelectors.controls('mint-wrapper')) || null;
|
|
51
|
-
this.el.wrapper = document.getElementById('mint-wrapper');
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Adds events to the dom
|
|
56
|
-
*/
|
|
57
|
-
attachEvents () : void {
|
|
58
|
-
window.addEventListener('resize', MintEvent.throttleEvent(this.eHandleResize.bind(this), MintSettings.delay.default));
|
|
59
|
-
window.addEventListener('scroll', MintEvent.throttleEvent(this.eHandleScroll.bind(this), MintSettings.delay.default, { trailing: false }));
|
|
60
|
-
|
|
61
|
-
let focusables = this.el.header?.querySelectorAll(MintSelectors.focusable),
|
|
62
|
-
lastFocusable = focusables?.[focusables?.length - 1];
|
|
63
|
-
lastFocusable?.addEventListener('keydown', MintEvent.throttleEvent(this.eWrapTab.bind(this)));
|
|
64
|
-
focusables?.forEach((focusable) => {
|
|
65
|
-
focusable.addEventListener('keydown', MintEvent.throttleEvent(this.eHandleKeypress.bind(this)));
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
let menuButtons = this.el.wrapper?.querySelectorAll(MintSelectors.controls());
|
|
69
|
-
menuButtons?.forEach((menuButton) => {
|
|
70
|
-
menuButton.addEventListener('click', MintEvent.throttleEvent(this.eToggleMenu.bind(this), MintSettings.delay.slow, { trailing: false }));
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
this.el.mobileButton?.addEventListener('click', MintEvent.throttleEvent(this.eToggleMobileMenu.bind(this), MintSettings.delay.slow, { trailing: false }));
|
|
74
|
-
this.el.wrapper?.addEventListener('transitionend', this.eTransitionEnd.bind(this));
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Adds classes that inform the styles based on settings
|
|
79
|
-
*/
|
|
80
|
-
addClasses () : void {
|
|
81
|
-
this.el.header?.classList.remove('mint-top', 'mint-right', 'mint-bottom', 'mint-left');
|
|
82
|
-
this.el.header?.classList.add(`mint-${EMintSide[this.settings.from ?? 0].toLowerCase()}`);
|
|
83
|
-
|
|
84
|
-
if (this.settings.fixed) {
|
|
85
|
-
this.el.body?.classList.add('mint-fixed');
|
|
86
|
-
}
|
|
87
|
-
if (this.settings.tray) {
|
|
88
|
-
this.el.header?.classList.add('mint-tray');
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Sets the state of the mobile menu
|
|
94
|
-
* @param open - `true` to open the menu or `false` to close it
|
|
95
|
-
*/
|
|
96
|
-
setMobileMenu (open: boolean = false) : void {
|
|
97
|
-
let ariaExpanded: string = open ? 'true' : 'false',
|
|
98
|
-
ariaLabel: string = open ? 'close menu' : 'open menu';
|
|
99
|
-
|
|
100
|
-
this.el.mobileButton?.setAttribute('aria-expanded', ariaExpanded);
|
|
101
|
-
setTimeout(() => {
|
|
102
|
-
this.el.mobileButton?.setAttribute('aria-label', ariaLabel);
|
|
103
|
-
}, MintSettings.delay.fast);
|
|
104
|
-
|
|
105
|
-
if (open) {
|
|
106
|
-
if (this.settings.fixed !== true) {
|
|
107
|
-
window.scroll({
|
|
108
|
-
top: 0,
|
|
109
|
-
left: 0,
|
|
110
|
-
behavior: 'smooth'
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
setTimeout(() => {
|
|
115
|
-
if (this.el.html) {
|
|
116
|
-
let isMobile = MintWindow.width() <= MintSettings.break.sm,
|
|
117
|
-
overflow = 'auto';
|
|
118
|
-
|
|
119
|
-
if (this.settings.tray) {
|
|
120
|
-
if (isMobile) {
|
|
121
|
-
overflow = 'hidden';
|
|
122
|
-
}
|
|
123
|
-
} else {
|
|
124
|
-
overflow = 'hidden';
|
|
125
|
-
}
|
|
126
|
-
this.el.html.style.overflow = overflow;
|
|
127
|
-
}
|
|
128
|
-
}, this.settings.from === EMintSide.Left ? MintSettings.delay.default : MintSettings.delay.instant);
|
|
129
|
-
|
|
130
|
-
if (this.el.wrapper) {
|
|
131
|
-
this.el.wrapper.style.display = 'flex';
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
requestAnimationFrame(() => {
|
|
135
|
-
this.el.wrapper?.classList.add('mint-open');
|
|
136
|
-
});
|
|
137
|
-
} else {
|
|
138
|
-
if (this.el.html) {
|
|
139
|
-
this.el.html.style.overflow = 'auto';
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
requestAnimationFrame(() => {
|
|
143
|
-
this.el.wrapper?.classList.remove('mint-open');
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
this.closeAllMenus();
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Toggles the state of the mobile menu
|
|
152
|
-
*/
|
|
153
|
-
toggleMobileMenu () : void {
|
|
154
|
-
this.setMobileMenu(this.el.mobileButton?.getAttribute('aria-expanded')?.toLowerCase() === 'false');
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Sets the state of the provided button's menu
|
|
159
|
-
* @param button - Button element to set
|
|
160
|
-
* @param open - `true` to open the menu or `false` to close it
|
|
161
|
-
*/
|
|
162
|
-
setMenu (button?: HTMLElement | null,
|
|
163
|
-
open: boolean = false) : void {
|
|
164
|
-
let ariaExpanded: string = open ? 'true' : 'false',
|
|
165
|
-
menu: HTMLElement | null = button?.nextElementSibling as HTMLElement | null;
|
|
166
|
-
if (button && menu) {
|
|
167
|
-
button.setAttribute('aria-expanded', ariaExpanded);
|
|
168
|
-
if (open) {
|
|
169
|
-
MintDisplay.show(menu);
|
|
170
|
-
} else {
|
|
171
|
-
MintDisplay.hide(menu);
|
|
172
|
-
this.closeSubMenus(button);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Toggles the state of the provided button's menu
|
|
179
|
-
* @param button - Button element to toggle
|
|
180
|
-
*/
|
|
181
|
-
toggleMenu (button?: HTMLElement | null) : void {
|
|
182
|
-
this.setMenu(button, button?.getAttribute('aria-expanded')?.toLowerCase() !== 'true');
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* Closes all submenus of the provided button's menu
|
|
187
|
-
* @param button - Button element of the parent menu
|
|
188
|
-
*/
|
|
189
|
-
closeSubMenus (button?: HTMLElement | null) : void {
|
|
190
|
-
let menu: HTMLElement | null | undefined = button?.nextElementSibling as HTMLElement,
|
|
191
|
-
subMenus: NodeListOf<HTMLElement> = menu?.querySelectorAll(MintSelectors.subMenuButtons) as NodeListOf<HTMLElement>;
|
|
192
|
-
subMenus.forEach((child: HTMLElement) => {
|
|
193
|
-
// setMenu calls this function, so ignore subsub menus
|
|
194
|
-
if (child.parentElement?.parentElement === menu) {
|
|
195
|
-
this.setMenu(child);
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Closes all sibling menus of the provided button's menu
|
|
202
|
-
* @param button - Button element of the sibling menus
|
|
203
|
-
*/
|
|
204
|
-
closeSiblingMenus (button?: HTMLElement | null) : void {
|
|
205
|
-
let menu: HTMLElement | null | undefined = button?.parentElement as HTMLElement,
|
|
206
|
-
siblingMenus: NodeListOf<HTMLElement> = menu?.parentElement?.querySelectorAll(MintSelectors.subMenuButtons) as NodeListOf<HTMLElement>;
|
|
207
|
-
siblingMenus.forEach((child: HTMLElement) => {
|
|
208
|
-
if (child !== button) {
|
|
209
|
-
this.setMenu(child);
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* Closes all submenus of the n4vbar
|
|
216
|
-
*/
|
|
217
|
-
closeAllMenus () : void {
|
|
218
|
-
let menuButtons: NodeListOf<HTMLElement> | undefined = this.el.wrapper?.querySelectorAll(MintSelectors.subMenuButtons);
|
|
219
|
-
menuButtons?.forEach((menuButton: HTMLElement) => {
|
|
220
|
-
this.setMenu(menuButton);
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* Opens the menu closest to the document's focus
|
|
226
|
-
*/
|
|
227
|
-
openClosestMenu () : void {
|
|
228
|
-
let activeButton: HTMLElement | null = document.activeElement as HTMLElement | null,
|
|
229
|
-
activeMenu: HTMLElement | null = activeButton?.nextElementSibling as HTMLElement | null,
|
|
230
|
-
showing: boolean = activeButton?.getAttribute('aria-expanded')?.toLowerCase() === 'true';
|
|
231
|
-
if (activeButton?.getAttribute('aria-controls') === 'mint-wrapper') {
|
|
232
|
-
activeMenu = this.el.wrapper;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
if (activeButton?.getAttribute('aria-controls') && activeMenu && !showing) {
|
|
236
|
-
activeButton.click();
|
|
237
|
-
let firstFocusable: HTMLElement | null = activeMenu.querySelector(MintSelectors.focusable);
|
|
238
|
-
firstFocusable?.focus();
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* Closes the menu closest to the document's focus
|
|
244
|
-
*/
|
|
245
|
-
closeClosestMenu () : void {
|
|
246
|
-
let activeElement: HTMLElement | null = document.activeElement as HTMLElement | null,
|
|
247
|
-
activeMenu: HTMLElement | null = activeElement?.closest(MintSelectors.subMenu) as HTMLElement | null,
|
|
248
|
-
activeButton: HTMLElement | null = activeMenu?.previousElementSibling ? activeMenu.previousElementSibling as HTMLElement : this.el.mobileButton;
|
|
249
|
-
if (activeElement?.getAttribute('aria-controls') && activeElement?.getAttribute('aria-expanded')?.toLowerCase() === 'true') {
|
|
250
|
-
activeButton = activeElement;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
if (activeButton?.getAttribute('aria-expanded')?.toLowerCase() === 'true') {
|
|
254
|
-
activeButton?.click();
|
|
255
|
-
activeButton?.focus();
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
/**
|
|
260
|
-
* Toggles the menu closest to the document's focus
|
|
261
|
-
*/
|
|
262
|
-
toggleClosestMenu () : void {
|
|
263
|
-
if (document.activeElement?.getAttribute('aria-expanded')?.toLowerCase() === 'true') {
|
|
264
|
-
this.closeClosestMenu();
|
|
265
|
-
} else {
|
|
266
|
-
this.openClosestMenu();
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* Closes the mobile menu when the window resizes
|
|
272
|
-
*/
|
|
273
|
-
eHandleResize () : void {
|
|
274
|
-
let isOpen = this.el.mobileButton?.getAttribute('aria-expanded')?.toLowerCase() === 'true',
|
|
275
|
-
isMobile = MintWindow.width() <= MintSettings.break.sm,
|
|
276
|
-
overflow = 'auto';
|
|
277
|
-
|
|
278
|
-
if (isOpen) {
|
|
279
|
-
if (this.settings.tray) {
|
|
280
|
-
if (isMobile) {
|
|
281
|
-
overflow = 'hidden';
|
|
282
|
-
}
|
|
283
|
-
} else {
|
|
284
|
-
overflow = 'hidden';
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
if (this.el.html) {
|
|
289
|
-
this.el.html.style.overflow = overflow;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
* Closes all submenus when the page is scrolled
|
|
295
|
-
*/
|
|
296
|
-
eHandleScroll () : void {
|
|
297
|
-
this.closeAllMenus();
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
* Sends the focus to the menu button after tabbing past the last menu item
|
|
302
|
-
* @param e - Keyboard event
|
|
303
|
-
*/
|
|
304
|
-
eWrapTab (e: KeyboardEvent) : void {
|
|
305
|
-
if (e.key.toLowerCase() === 'tab' && !e.shiftKey) {
|
|
306
|
-
this.el.mobileButton?.focus();
|
|
307
|
-
if (document.activeElement === this.el.mobileButton) {
|
|
308
|
-
e.preventDefault();
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
/**
|
|
314
|
-
* Handles keypresses on n4vbar buttons
|
|
315
|
-
* @param e - Keyboard event
|
|
316
|
-
*/
|
|
317
|
-
eHandleButtonKeypress (e: KeyboardEvent) : void {
|
|
318
|
-
let target = e.target as HTMLElement | null,
|
|
319
|
-
subMenu = target?.closest('li');
|
|
320
|
-
switch (e.key.toLowerCase()) {
|
|
321
|
-
case 'escape':
|
|
322
|
-
if (subMenu?.classList.contains('mint-open')) {
|
|
323
|
-
this.setMenu(subMenu);
|
|
324
|
-
} else {
|
|
325
|
-
this.setMobileMenu();
|
|
326
|
-
this.el.menuButton?.focus();
|
|
327
|
-
}
|
|
328
|
-
break;
|
|
329
|
-
case 'arrowleft':
|
|
330
|
-
this.closeClosestMenu();
|
|
331
|
-
break;
|
|
332
|
-
case 'arrowright':
|
|
333
|
-
this.openClosestMenu();
|
|
334
|
-
break;
|
|
335
|
-
case 'enter':
|
|
336
|
-
case 'space':
|
|
337
|
-
target?.click();
|
|
338
|
-
break;
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
/**
|
|
343
|
-
* Handles keypresses on n4vbar links
|
|
344
|
-
* @param e - Keyboard event
|
|
345
|
-
*/
|
|
346
|
-
eHandleLinkKeypress (e: KeyboardEvent) : void {
|
|
347
|
-
let target = e.target as HTMLElement | null;
|
|
348
|
-
switch (e.key.toLowerCase()) {
|
|
349
|
-
case 'escape':
|
|
350
|
-
case 'arrowleft':
|
|
351
|
-
this.closeClosestMenu();
|
|
352
|
-
break;
|
|
353
|
-
case 'arrowright':
|
|
354
|
-
this.openClosestMenu();
|
|
355
|
-
break;
|
|
356
|
-
case 'enter':
|
|
357
|
-
case 'space':
|
|
358
|
-
target?.click();
|
|
359
|
-
break;
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
/**
|
|
364
|
-
* Handles keypresses on the n4vbar
|
|
365
|
-
* @param e - Keyboard event
|
|
366
|
-
*/
|
|
367
|
-
eHandleKeypress (e: KeyboardEvent) : void {
|
|
368
|
-
if (e.key.toLowerCase() !== 'tab') {
|
|
369
|
-
e.preventDefault();
|
|
370
|
-
}
|
|
371
|
-
const target = e.target as HTMLElement | null;
|
|
372
|
-
switch (target?.tagName.toLowerCase()) {
|
|
373
|
-
case 'a':
|
|
374
|
-
this.eHandleLinkKeypress(e);
|
|
375
|
-
break;
|
|
376
|
-
case 'button':
|
|
377
|
-
this.eHandleButtonKeypress(e);
|
|
378
|
-
break;
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
/**
|
|
383
|
-
* Toggles the mobile menu
|
|
384
|
-
*/
|
|
385
|
-
eToggleMobileMenu () : void {
|
|
386
|
-
this.toggleMobileMenu();
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
/**
|
|
390
|
-
* Toggles the clicked submenu
|
|
391
|
-
* @param e - Mouse event
|
|
392
|
-
*/
|
|
393
|
-
eToggleMenu (e: MouseEvent) : void {
|
|
394
|
-
let target = e.target as HTMLElement | null;
|
|
395
|
-
this.closeSiblingMenus(target);
|
|
396
|
-
this.toggleMenu(target);
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
/**
|
|
400
|
-
* Runs after the mobile menu transitions
|
|
401
|
-
*/
|
|
402
|
-
eTransitionEnd () : void {
|
|
403
|
-
if (this.el.wrapper?.classList.contains('mint-open') === false ) {
|
|
404
|
-
this.el.wrapper.style.display = 'none';
|
|
405
|
-
}
|
|
406
|
-
};
|
|
407
|
-
};
|
|
408
|
-
export default MintHeader;
|