@fiduswriter/frontend 0.1.70 → 0.1.72
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/css/colors.css +0 -17
- package/css/feedback.css +67 -29
- package/css/fonts.css +0 -11
- package/css/header_menu.css +120 -41
- package/css/two_factor.css +20 -20
- package/dist/common/templates.d.ts.map +1 -1
- package/dist/common/templates.js +3 -2
- package/dist/common/templates.js.map +1 -1
- package/dist/css/colors.css +0 -17
- package/dist/css/feedback.css +67 -29
- package/dist/css/fonts.css +0 -11
- package/dist/css/fwtoolkit/data_table.css +71 -24
- package/dist/css/fwtoolkit/fwtoolkit.css +129 -57
- package/dist/css/fwtoolkit/navigation_list.css +36 -0
- package/dist/css/fwtoolkit/overview_menu.css +20 -25
- package/dist/css/fwtoolkit/text.css +0 -8
- package/dist/css/header_menu.css +120 -41
- package/dist/css/manifest.json +1 -0
- package/dist/css/two_factor.css +20 -20
- package/dist/feedback/index.d.ts.map +1 -1
- package/dist/feedback/index.js +19 -11
- package/dist/feedback/index.js.map +1 -1
- package/dist/menu/index.d.ts +4 -0
- package/dist/menu/index.d.ts.map +1 -1
- package/dist/menu/index.js +66 -82
- package/dist/menu/index.js.map +1 -1
- package/dist/menu/templates.d.ts +1 -1
- package/dist/menu/templates.d.ts.map +1 -1
- package/dist/menu/templates.js +4 -6
- package/dist/menu/templates.js.map +1 -1
- package/package.json +2 -2
- package/src/common/templates.ts +3 -2
- package/src/feedback/index.ts +31 -18
- package/src/menu/index.ts +74 -93
- package/src/menu/templates.ts +8 -8
package/dist/menu/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { keyName } from "w3c-keyname";
|
|
2
|
-
import { dropdownSelect, whenReady } from "fwtoolkit";
|
|
3
|
-
import {
|
|
4
|
-
//
|
|
2
|
+
import { dropdownSelect, ensureCSS, NavigationDrawer, whenReady } from "fwtoolkit";
|
|
3
|
+
import { siteMenuDrawerTemplate } from "./templates.js";
|
|
4
|
+
// Site navigation on overview pages (Design 5): a menu button in the header
|
|
5
|
+
// opens a drawer listing the site sections instead of the old horizontal
|
|
6
|
+
// header menu.
|
|
5
7
|
export class SiteMenu {
|
|
6
8
|
app;
|
|
7
9
|
activeItem;
|
|
@@ -9,6 +11,8 @@ export class SiteMenu {
|
|
|
9
11
|
listeners;
|
|
10
12
|
keyboardShortcuts;
|
|
11
13
|
plugins;
|
|
14
|
+
drawer;
|
|
15
|
+
menuButton;
|
|
12
16
|
constructor(app, activeItem) {
|
|
13
17
|
this.app = app;
|
|
14
18
|
this.activeItem = activeItem;
|
|
@@ -50,6 +54,7 @@ export class SiteMenu {
|
|
|
50
54
|
}
|
|
51
55
|
whenReady().then(() => {
|
|
52
56
|
this.sortMenu();
|
|
57
|
+
this.renderPageTitle();
|
|
53
58
|
this.renderMenu();
|
|
54
59
|
this.bindPreferencePullDown();
|
|
55
60
|
this.bindKeyboardNavigation();
|
|
@@ -67,96 +72,71 @@ export class SiteMenu {
|
|
|
67
72
|
document.body.addEventListener("keydown", this.listeners.onKeydown);
|
|
68
73
|
}
|
|
69
74
|
onKeydown(event) {
|
|
70
|
-
|
|
71
|
-
if (event.altKey) {
|
|
72
|
-
const shortcut = "alt-" + name.toLowerCase();
|
|
73
|
-
const navItem = this.keyboardShortcuts.get(shortcut);
|
|
74
|
-
if (navItem) {
|
|
75
|
-
event.preventDefault();
|
|
76
|
-
event.stopPropagation();
|
|
77
|
-
this.app.goTo(navItem.url);
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
const headerNav = document.getElementById("header-nav");
|
|
82
|
-
const siteMenuItems = Array.from(headerNav.querySelectorAll(".fw-nav-item a"));
|
|
83
|
-
const currentFocus = document.activeElement;
|
|
84
|
-
const overviewMenu = document.getElementById("fw-overview-menu");
|
|
85
|
-
const isInSiteMenu = headerNav.contains(currentFocus);
|
|
86
|
-
const isInOverviewDropdown = overviewMenu
|
|
87
|
-
?.querySelector(".fw-pulldown.fw-left")
|
|
88
|
-
?.contains(currentFocus);
|
|
89
|
-
if (!isInSiteMenu && !overviewMenu?.contains(currentFocus)) {
|
|
75
|
+
if (!event.altKey) {
|
|
90
76
|
return;
|
|
91
77
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
event.preventDefault();
|
|
100
|
-
const prevIndex = currentIndex > 0
|
|
101
|
-
? currentIndex - 1
|
|
102
|
-
: siteMenuItems.length - 1;
|
|
103
|
-
siteMenuItems[prevIndex].focus();
|
|
104
|
-
}
|
|
105
|
-
break;
|
|
106
|
-
}
|
|
107
|
-
case "ArrowRight": {
|
|
108
|
-
if (isInSiteMenu) {
|
|
109
|
-
event.preventDefault();
|
|
110
|
-
const nextIndex = currentIndex < siteMenuItems.length - 1
|
|
111
|
-
? currentIndex + 1
|
|
112
|
-
: 0;
|
|
113
|
-
siteMenuItems[nextIndex].focus();
|
|
114
|
-
}
|
|
115
|
-
break;
|
|
116
|
-
}
|
|
117
|
-
case "ArrowDown": {
|
|
118
|
-
if (isInSiteMenu && overviewMenu) {
|
|
119
|
-
event.preventDefault();
|
|
120
|
-
// Focus first overview menu item
|
|
121
|
-
const firstOverviewItem = overviewMenu.querySelector("button, div.dropdown");
|
|
122
|
-
if (firstOverviewItem) {
|
|
123
|
-
;
|
|
124
|
-
firstOverviewItem.focus();
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
break;
|
|
128
|
-
}
|
|
129
|
-
case "ArrowUp": {
|
|
130
|
-
if (overviewMenu?.contains(currentFocus) &&
|
|
131
|
-
!isInOverviewDropdown) {
|
|
132
|
-
event.preventDefault();
|
|
133
|
-
// Focus the site menu item that's above the current overview menu item
|
|
134
|
-
const siteMenuItem = siteMenuItems[0];
|
|
135
|
-
if (siteMenuItem) {
|
|
136
|
-
siteMenuItem.focus();
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
break;
|
|
140
|
-
}
|
|
141
|
-
case "Enter":
|
|
142
|
-
case " ": {
|
|
143
|
-
if (isInSiteMenu) {
|
|
144
|
-
event.preventDefault();
|
|
145
|
-
currentFocus.click();
|
|
146
|
-
}
|
|
147
|
-
break;
|
|
148
|
-
}
|
|
78
|
+
const name = keyName(event);
|
|
79
|
+
const shortcut = "alt-" + name.toLowerCase();
|
|
80
|
+
const navItem = this.keyboardShortcuts.get(shortcut);
|
|
81
|
+
if (navItem) {
|
|
82
|
+
event.preventDefault();
|
|
83
|
+
event.stopPropagation();
|
|
84
|
+
this.app.goTo(navItem.url);
|
|
149
85
|
}
|
|
150
86
|
}
|
|
151
87
|
sortMenu() {
|
|
152
88
|
this.navItems.sort((a, b) => a.order - b.order);
|
|
153
89
|
}
|
|
90
|
+
renderPageTitle() {
|
|
91
|
+
const titleEl = document.querySelector(".fw-header .fw-page-title");
|
|
92
|
+
const active = this.navItems.find(item => item.active);
|
|
93
|
+
if (titleEl) {
|
|
94
|
+
titleEl.textContent = active ? active.text : "";
|
|
95
|
+
}
|
|
96
|
+
}
|
|
154
97
|
renderMenu() {
|
|
155
|
-
const
|
|
156
|
-
|
|
98
|
+
const container = document.querySelector(".fw-header .fw-container");
|
|
99
|
+
if (!container) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
ensureCSS(staticUrl("css/fwtoolkit/navigation_list.css"));
|
|
103
|
+
const button = document.createElement("button");
|
|
104
|
+
button.type = "button";
|
|
105
|
+
button.id = "fw-site-menu-btn";
|
|
106
|
+
button.className = "fw-site-menu-btn";
|
|
107
|
+
button.title = gettext("Menu");
|
|
108
|
+
button.setAttribute("aria-label", gettext("Menu"));
|
|
109
|
+
button.setAttribute("aria-haspopup", "dialog");
|
|
110
|
+
button.setAttribute("aria-expanded", "false");
|
|
111
|
+
button.setAttribute("aria-controls", "fw-site-menu-drawer");
|
|
112
|
+
button.innerHTML =
|
|
113
|
+
'<i class="fa-solid fa-ellipsis-vertical" aria-hidden="true"></i>';
|
|
114
|
+
container.prepend(button);
|
|
115
|
+
this.menuButton = button;
|
|
116
|
+
const content = document.createElement("nav");
|
|
117
|
+
content.setAttribute("aria-label", gettext("Site navigation"));
|
|
118
|
+
content.innerHTML = siteMenuDrawerTemplate({
|
|
157
119
|
navItems: this.navItems,
|
|
158
120
|
getAccessKeyHTML: (text, keys) => this.getAccessKeyHTML(text, keys)
|
|
159
121
|
});
|
|
122
|
+
this.drawer = new NavigationDrawer({
|
|
123
|
+
id: "fw-site-menu-drawer",
|
|
124
|
+
label: gettext("Site navigation"),
|
|
125
|
+
content,
|
|
126
|
+
modal: true,
|
|
127
|
+
onOpenChange: ({ open }) => {
|
|
128
|
+
button.setAttribute("aria-expanded", String(open));
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
this.drawer.element.classList.add("fw-site-menu-drawer");
|
|
132
|
+
button.addEventListener("click", () => {
|
|
133
|
+
if (this.drawer?.isOpen()) {
|
|
134
|
+
this.drawer.close();
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
this.drawer?.open();
|
|
138
|
+
}
|
|
139
|
+
});
|
|
160
140
|
}
|
|
161
141
|
bindPreferencePullDown() {
|
|
162
142
|
const pulldown = document.getElementById("user-preferences-pulldown");
|
|
@@ -215,6 +195,10 @@ export class SiteMenu {
|
|
|
215
195
|
destroy() {
|
|
216
196
|
document.body.removeEventListener("keydown", this.listeners.onKeydown);
|
|
217
197
|
this.listeners = {};
|
|
198
|
+
this.drawer?.destroy();
|
|
199
|
+
this.drawer = undefined;
|
|
200
|
+
this.menuButton?.remove();
|
|
201
|
+
this.menuButton = undefined;
|
|
218
202
|
}
|
|
219
203
|
getAccessKeyHTML(text, accessKey) {
|
|
220
204
|
if (!accessKey) {
|
package/dist/menu/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/menu/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAA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C,CAAC;YACL,CAAC,CAAC,CAAA;QACN,CAAC,CAAC,CAAA;IACN,CAAC;IAED,OAAO;QACH,QAAQ,CAAC,IAAI,CAAC,mBAAmB,CAC7B,SAAS,EACT,IAAI,CAAC,SAAS,CAAC,SAA0B,CAC5C,CAAA;QACD,IAAI,CAAC,SAAS,GAAG,EAAE,CAAA;QACnB,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,CAAA;QACtB,IAAI,CAAC,MAAM,GAAG,SAAS,CAAA;QACvB,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,CAAA;QACzB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAA;IAC/B,CAAC;IAED,gBAAgB,CAAC,IAAY,EAAE,SAAkB;QAC7C,IAAI,CAAC,SAAS,EAAE,CAAC;YACb,OAAO,IAAI,CAAA;QACf,CAAC;QACD,MAAM,GAAG,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA,CAAC,gCAAgC;QACpE,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAA;QAC3D,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;YACf,OAAO,IAAI,CAAA;QACf,CAAC;QACD,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,+BAA+B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,IAAI,CAAC,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE,CAAA;IAC5H,CAAC;CACJ"}
|
package/dist/menu/templates.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { NavItem } from "../types.js";
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const siteMenuDrawerTemplate: ({ navItems, getAccessKeyHTML }: {
|
|
3
3
|
navItems: NavItem[];
|
|
4
4
|
getAccessKeyHTML: (text: string, keys?: string) => string;
|
|
5
5
|
}) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/menu/templates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,aAAa,CAAA;AAExC,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/menu/templates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,aAAa,CAAA;AAExC,eAAO,MAAM,sBAAsB,mCAGhC;IACC,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;CAC5D,KAAG,MAYM,CAAA"}
|
package/dist/menu/templates.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const siteMenuDrawerTemplate = ({ navItems, getAccessKeyHTML }) => `<ul class="fw-navigation-list">
|
|
2
2
|
${navItems
|
|
3
|
-
.map(
|
|
4
|
-
<a class="fw-header-navigation-text" href="${navItem.url}" title="${navItem.title}" role="menuitem" data-index=${index}>
|
|
3
|
+
.map(navItem => `<li><a href="${navItem.url}" title="${navItem.title}"${navItem.active ? ' aria-current="page"' : ""}>
|
|
5
4
|
${getAccessKeyHTML(navItem.text, navItem.keys)}
|
|
6
|
-
</a
|
|
7
|
-
</p>`)
|
|
5
|
+
</a></li>`)
|
|
8
6
|
.join("")}
|
|
9
|
-
</
|
|
7
|
+
</ul>`;
|
|
10
8
|
//# sourceMappingURL=templates.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/menu/templates.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/menu/templates.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,EACnC,QAAQ,EACR,gBAAgB,EAInB,EAAU,EAAE,CACT;MACE,QAAQ;KACL,GAAG,CACA,OAAO,CAAC,EAAE,CACN,gBAAgB,OAAO,CAAC,GAAG,YAAY,OAAO,CAAC,KAAK,IAChD,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,EAC9C;sBACM,gBAAgB,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC;0BACxC,CACjB;KACA,IAAI,CAAC,EAAE,CAAC;UACP,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiduswriter/frontend",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.72",
|
|
4
4
|
"description": "Fidus Writer-specific shared utilities and UI chrome",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fiduswriter",
|
|
@@ -216,7 +216,7 @@
|
|
|
216
216
|
"@fiduswriter/image-manager": "^0.1.31",
|
|
217
217
|
"downloadjs": "^1.4.7",
|
|
218
218
|
"fast-deep-equal": "^3.1.3",
|
|
219
|
-
"fwtoolkit": "^1.0.
|
|
219
|
+
"fwtoolkit": "^1.0.4",
|
|
220
220
|
"jszip": "^3.10.1",
|
|
221
221
|
"prosemirror-history": "^1.3.2",
|
|
222
222
|
"prosemirror-keymap": "^1.2.2",
|
package/src/common/templates.ts
CHANGED
|
@@ -20,7 +20,8 @@ export const baseBodyTemplate = ({
|
|
|
20
20
|
<img src="${staticUrl("svg/icon.svg")}" alt="Logo" />
|
|
21
21
|
</h1>
|
|
22
22
|
</a>
|
|
23
|
-
<
|
|
23
|
+
<span class="fw-page-title"></span>
|
|
24
|
+
${hasOverview ? '<div class="fw-overview-menu-wrapper"><ul id="fw-overview-menu"></ul></div>' : ""}
|
|
24
25
|
<div id="user-preferences" class="fw-user-preferences fw-header-text">
|
|
25
26
|
<div id="preferences-btn" class="fw-button">
|
|
26
27
|
${avatarTemplate({user})}
|
|
@@ -42,7 +43,7 @@ export const baseBodyTemplate = ({
|
|
|
42
43
|
</div><!-- end container -->
|
|
43
44
|
</header>
|
|
44
45
|
<div class="fw-contents-outer">
|
|
45
|
-
${hasOverview ? '<div class="fw-overview-
|
|
46
|
+
${hasOverview ? '<div class="fw-overview-search-wrapper"><ul id="fw-overview-search"></ul></div>' : ""}
|
|
46
47
|
<div class="fw-contents">
|
|
47
48
|
${contents}
|
|
48
49
|
</div>
|
package/src/feedback/index.ts
CHANGED
|
@@ -23,7 +23,7 @@ export class FeedbackTab {
|
|
|
23
23
|
render(): void {
|
|
24
24
|
document.body.insertAdjacentHTML(
|
|
25
25
|
"beforeend",
|
|
26
|
-
`<div class="feedback-panel"
|
|
26
|
+
`<div class="feedback-panel" role="dialog" aria-modal="true" aria-labelledby="feedback-title">
|
|
27
27
|
<div id="feedback-wrapper">
|
|
28
28
|
<div id="feedback-title">${gettext("Tech support")}</div>
|
|
29
29
|
<p>${gettext("Did you encounter an error or bug?")}<br>
|
|
@@ -42,33 +42,46 @@ export class FeedbackTab {
|
|
|
42
42
|
</div>`
|
|
43
43
|
)
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
// Design 5: on overview pages the feedback opener is a blue circle
|
|
46
|
+
// button in the header, left of the user preferences.
|
|
47
|
+
const userPreferences = document.querySelector(
|
|
48
|
+
".fw-header:not(.prelogin) #user-preferences"
|
|
47
49
|
)
|
|
48
50
|
|
|
49
|
-
if (
|
|
50
|
-
|
|
51
|
-
"
|
|
51
|
+
if (userPreferences) {
|
|
52
|
+
userPreferences.insertAdjacentHTML(
|
|
53
|
+
"beforebegin",
|
|
54
|
+
`<button type="button" class="feedback-btn feedback-open" aria-label="${gettext("Technical support")}" title="${gettext("Technical support")}"></button>`
|
|
55
|
+
)
|
|
56
|
+
} else {
|
|
57
|
+
let headerNavWrapper = document.querySelector(
|
|
58
|
+
"#footer-menu.prelogin .fw-container"
|
|
52
59
|
)
|
|
53
|
-
}
|
|
54
60
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
61
|
+
if (null === headerNavWrapper) {
|
|
62
|
+
headerNavWrapper = document.querySelector(
|
|
63
|
+
".fw-header .fw-container"
|
|
64
|
+
)
|
|
65
|
+
}
|
|
58
66
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
67
|
+
if (null === headerNavWrapper) {
|
|
68
|
+
headerNavWrapper = document.querySelector("#headerbar")
|
|
69
|
+
}
|
|
62
70
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
71
|
+
if (null === headerNavWrapper) {
|
|
72
|
+
headerNavWrapper = document.body
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
headerNavWrapper.insertAdjacentHTML(
|
|
76
|
+
"beforeend",
|
|
77
|
+
`<a class="feedback-tab feedback-open" aria-label="${gettext("Technical support")}" href="#"></a>`
|
|
78
|
+
)
|
|
79
|
+
}
|
|
67
80
|
ensureCSS(staticUrl("css/feedback.css"))
|
|
68
81
|
}
|
|
69
82
|
|
|
70
83
|
bind(): void {
|
|
71
|
-
;(document.querySelector("
|
|
84
|
+
;(document.querySelector(".feedback-open") as HTMLElement).addEventListener(
|
|
72
85
|
"click",
|
|
73
86
|
event => {
|
|
74
87
|
event.preventDefault()
|
package/src/menu/index.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import {keyName} from "w3c-keyname"
|
|
2
2
|
|
|
3
|
-
import {dropdownSelect, whenReady} from "fwtoolkit"
|
|
4
|
-
import {
|
|
3
|
+
import {dropdownSelect, ensureCSS, NavigationDrawer, whenReady} from "fwtoolkit"
|
|
4
|
+
import {siteMenuDrawerTemplate} from "./templates.js"
|
|
5
5
|
import type {FrontendApp, MenuPlugins, NavItem, SiteMenuLike} from "../types.js"
|
|
6
6
|
|
|
7
|
-
//
|
|
7
|
+
// Site navigation on overview pages (Design 5): a menu button in the header
|
|
8
|
+
// opens a drawer listing the site sections instead of the old horizontal
|
|
9
|
+
// header menu.
|
|
8
10
|
|
|
9
11
|
export class SiteMenu implements SiteMenuLike {
|
|
10
12
|
app: FrontendApp
|
|
@@ -13,6 +15,8 @@ export class SiteMenu implements SiteMenuLike {
|
|
|
13
15
|
listeners: {onKeydown?: (event: KeyboardEvent) => void}
|
|
14
16
|
keyboardShortcuts: Map<string, NavItem>
|
|
15
17
|
plugins?: Record<string, {init(): void}>
|
|
18
|
+
drawer?: NavigationDrawer
|
|
19
|
+
menuButton?: HTMLButtonElement
|
|
16
20
|
|
|
17
21
|
constructor(app: FrontendApp, activeItem?: string) {
|
|
18
22
|
this.app = app
|
|
@@ -59,6 +63,7 @@ export class SiteMenu implements SiteMenuLike {
|
|
|
59
63
|
|
|
60
64
|
whenReady().then(() => {
|
|
61
65
|
this.sortMenu()
|
|
66
|
+
this.renderPageTitle()
|
|
62
67
|
this.renderMenu()
|
|
63
68
|
this.bindPreferencePullDown()
|
|
64
69
|
this.bindKeyboardNavigation()
|
|
@@ -79,96 +84,16 @@ export class SiteMenu implements SiteMenuLike {
|
|
|
79
84
|
}
|
|
80
85
|
|
|
81
86
|
onKeydown(event: KeyboardEvent): void {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if (event.altKey) {
|
|
85
|
-
const shortcut = "alt-" + name.toLowerCase()
|
|
86
|
-
const navItem = this.keyboardShortcuts.get(shortcut)
|
|
87
|
-
if (navItem) {
|
|
88
|
-
event.preventDefault()
|
|
89
|
-
event.stopPropagation()
|
|
90
|
-
this.app.goTo(navItem.url)
|
|
91
|
-
return
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
const headerNav = document.getElementById("header-nav") as HTMLElement
|
|
95
|
-
const siteMenuItems: HTMLElement[] = Array.from(
|
|
96
|
-
headerNav.querySelectorAll(".fw-nav-item a")
|
|
97
|
-
)
|
|
98
|
-
const currentFocus = document.activeElement as HTMLElement
|
|
99
|
-
const overviewMenu = document.getElementById("fw-overview-menu")
|
|
100
|
-
const isInSiteMenu = headerNav.contains(currentFocus)
|
|
101
|
-
const isInOverviewDropdown = overviewMenu
|
|
102
|
-
?.querySelector(".fw-pulldown.fw-left")
|
|
103
|
-
?.contains(currentFocus)
|
|
104
|
-
|
|
105
|
-
if (!isInSiteMenu && !overviewMenu?.contains(currentFocus)) {
|
|
87
|
+
if (!event.altKey) {
|
|
106
88
|
return
|
|
107
89
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
if (isInSiteMenu) {
|
|
116
|
-
event.preventDefault()
|
|
117
|
-
const prevIndex =
|
|
118
|
-
currentIndex > 0
|
|
119
|
-
? currentIndex - 1
|
|
120
|
-
: siteMenuItems.length - 1
|
|
121
|
-
siteMenuItems[prevIndex].focus()
|
|
122
|
-
}
|
|
123
|
-
break
|
|
124
|
-
}
|
|
125
|
-
case "ArrowRight": {
|
|
126
|
-
if (isInSiteMenu) {
|
|
127
|
-
event.preventDefault()
|
|
128
|
-
const nextIndex =
|
|
129
|
-
currentIndex < siteMenuItems.length - 1
|
|
130
|
-
? currentIndex + 1
|
|
131
|
-
: 0
|
|
132
|
-
siteMenuItems[nextIndex].focus()
|
|
133
|
-
}
|
|
134
|
-
break
|
|
135
|
-
}
|
|
136
|
-
case "ArrowDown": {
|
|
137
|
-
if (isInSiteMenu && overviewMenu) {
|
|
138
|
-
event.preventDefault()
|
|
139
|
-
// Focus first overview menu item
|
|
140
|
-
const firstOverviewItem = overviewMenu.querySelector(
|
|
141
|
-
"button, div.dropdown"
|
|
142
|
-
)
|
|
143
|
-
|
|
144
|
-
if (firstOverviewItem) {
|
|
145
|
-
;(firstOverviewItem as HTMLElement).focus()
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
break
|
|
149
|
-
}
|
|
150
|
-
case "ArrowUp": {
|
|
151
|
-
if (
|
|
152
|
-
overviewMenu?.contains(currentFocus) &&
|
|
153
|
-
!isInOverviewDropdown
|
|
154
|
-
) {
|
|
155
|
-
event.preventDefault()
|
|
156
|
-
// Focus the site menu item that's above the current overview menu item
|
|
157
|
-
const siteMenuItem = siteMenuItems[0]
|
|
158
|
-
if (siteMenuItem) {
|
|
159
|
-
siteMenuItem.focus()
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
break
|
|
163
|
-
}
|
|
164
|
-
case "Enter":
|
|
165
|
-
case " ": {
|
|
166
|
-
if (isInSiteMenu) {
|
|
167
|
-
event.preventDefault()
|
|
168
|
-
;(currentFocus as HTMLElement).click()
|
|
169
|
-
}
|
|
170
|
-
break
|
|
171
|
-
}
|
|
90
|
+
const name = keyName(event)
|
|
91
|
+
const shortcut = "alt-" + name.toLowerCase()
|
|
92
|
+
const navItem = this.keyboardShortcuts.get(shortcut)
|
|
93
|
+
if (navItem) {
|
|
94
|
+
event.preventDefault()
|
|
95
|
+
event.stopPropagation()
|
|
96
|
+
this.app.goTo(navItem.url)
|
|
172
97
|
}
|
|
173
98
|
}
|
|
174
99
|
|
|
@@ -176,12 +101,64 @@ export class SiteMenu implements SiteMenuLike {
|
|
|
176
101
|
this.navItems.sort((a, b) => a.order - b.order)
|
|
177
102
|
}
|
|
178
103
|
|
|
104
|
+
renderPageTitle(): void {
|
|
105
|
+
const titleEl = document.querySelector(
|
|
106
|
+
".fw-header .fw-page-title"
|
|
107
|
+
) as HTMLElement | null
|
|
108
|
+
const active = this.navItems.find(item => item.active)
|
|
109
|
+
if (titleEl) {
|
|
110
|
+
titleEl.textContent = active ? active.text : ""
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
179
114
|
renderMenu(): void {
|
|
180
|
-
const
|
|
181
|
-
|
|
115
|
+
const container = document.querySelector(
|
|
116
|
+
".fw-header .fw-container"
|
|
117
|
+
) as HTMLElement | null
|
|
118
|
+
if (!container) {
|
|
119
|
+
return
|
|
120
|
+
}
|
|
121
|
+
ensureCSS(staticUrl("css/fwtoolkit/navigation_list.css"))
|
|
122
|
+
|
|
123
|
+
const button = document.createElement("button")
|
|
124
|
+
button.type = "button"
|
|
125
|
+
button.id = "fw-site-menu-btn"
|
|
126
|
+
button.className = "fw-site-menu-btn"
|
|
127
|
+
button.title = gettext("Menu")
|
|
128
|
+
button.setAttribute("aria-label", gettext("Menu"))
|
|
129
|
+
button.setAttribute("aria-haspopup", "dialog")
|
|
130
|
+
button.setAttribute("aria-expanded", "false")
|
|
131
|
+
button.setAttribute("aria-controls", "fw-site-menu-drawer")
|
|
132
|
+
button.innerHTML =
|
|
133
|
+
'<i class="fa-solid fa-ellipsis-vertical" aria-hidden="true"></i>'
|
|
134
|
+
container.prepend(button)
|
|
135
|
+
this.menuButton = button
|
|
136
|
+
|
|
137
|
+
const content = document.createElement("nav")
|
|
138
|
+
content.setAttribute("aria-label", gettext("Site navigation"))
|
|
139
|
+
content.innerHTML = siteMenuDrawerTemplate({
|
|
182
140
|
navItems: this.navItems,
|
|
183
141
|
getAccessKeyHTML: (text, keys) => this.getAccessKeyHTML(text, keys)
|
|
184
142
|
})
|
|
143
|
+
|
|
144
|
+
this.drawer = new NavigationDrawer({
|
|
145
|
+
id: "fw-site-menu-drawer",
|
|
146
|
+
label: gettext("Site navigation"),
|
|
147
|
+
content,
|
|
148
|
+
modal: true,
|
|
149
|
+
onOpenChange: ({open}) => {
|
|
150
|
+
button.setAttribute("aria-expanded", String(open))
|
|
151
|
+
}
|
|
152
|
+
})
|
|
153
|
+
this.drawer.element.classList.add("fw-site-menu-drawer")
|
|
154
|
+
|
|
155
|
+
button.addEventListener("click", () => {
|
|
156
|
+
if (this.drawer?.isOpen()) {
|
|
157
|
+
this.drawer.close()
|
|
158
|
+
} else {
|
|
159
|
+
this.drawer?.open()
|
|
160
|
+
}
|
|
161
|
+
})
|
|
185
162
|
}
|
|
186
163
|
|
|
187
164
|
bindPreferencePullDown(): void {
|
|
@@ -251,6 +228,10 @@ export class SiteMenu implements SiteMenuLike {
|
|
|
251
228
|
this.listeners.onKeydown as EventListener
|
|
252
229
|
)
|
|
253
230
|
this.listeners = {}
|
|
231
|
+
this.drawer?.destroy()
|
|
232
|
+
this.drawer = undefined
|
|
233
|
+
this.menuButton?.remove()
|
|
234
|
+
this.menuButton = undefined
|
|
254
235
|
}
|
|
255
236
|
|
|
256
237
|
getAccessKeyHTML(text: string, accessKey?: string): string {
|
package/src/menu/templates.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import type {NavItem} from "../types.js"
|
|
2
2
|
|
|
3
|
-
export const
|
|
3
|
+
export const siteMenuDrawerTemplate = ({
|
|
4
4
|
navItems,
|
|
5
5
|
getAccessKeyHTML
|
|
6
6
|
}: {
|
|
7
7
|
navItems: NavItem[]
|
|
8
8
|
getAccessKeyHTML: (text: string, keys?: string) => string
|
|
9
9
|
}): string =>
|
|
10
|
-
`<
|
|
10
|
+
`<ul class="fw-navigation-list">
|
|
11
11
|
${navItems
|
|
12
12
|
.map(
|
|
13
|
-
|
|
14
|
-
`<
|
|
15
|
-
|
|
13
|
+
navItem =>
|
|
14
|
+
`<li><a href="${navItem.url}" title="${navItem.title}"${
|
|
15
|
+
navItem.active ? ' aria-current="page"' : ""
|
|
16
|
+
}>
|
|
16
17
|
${getAccessKeyHTML(navItem.text, navItem.keys)}
|
|
17
|
-
</a
|
|
18
|
-
</p>`
|
|
18
|
+
</a></li>`
|
|
19
19
|
)
|
|
20
20
|
.join("")}
|
|
21
|
-
</
|
|
21
|
+
</ul>`
|