solid-ui 2.4.13 → 2.4.14-6a9e81a9
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/lib/acl/access-groups.d.ts +1 -1
- package/lib/acl/access-groups.d.ts.map +1 -1
- package/lib/acl/access-groups.js.map +1 -1
- package/lib/acl/acl.d.ts +1 -1
- package/lib/acl/acl.d.ts.map +1 -1
- package/lib/acl/acl.js.map +1 -1
- package/lib/footer/index.d.ts +20 -0
- package/lib/footer/index.d.ts.map +1 -0
- package/lib/footer/index.js +147 -0
- package/lib/footer/index.js.map +1 -0
- package/lib/footer/styleMap.d.ts +8 -0
- package/lib/footer/styleMap.d.ts.map +1 -0
- package/lib/footer/styleMap.js +15 -0
- package/lib/footer/styleMap.js.map +1 -0
- package/lib/header/index.d.ts +11 -8
- package/lib/header/index.d.ts.map +1 -1
- package/lib/header/index.js +78 -66
- package/lib/header/index.js.map +1 -1
- package/lib/header/styleMap.d.ts +0 -2
- package/lib/header/styleMap.d.ts.map +1 -1
- package/lib/header/styleMap.js +1 -5
- package/lib/header/styleMap.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +10 -1
- package/lib/index.js.map +1 -1
- package/lib/{header/headerHelpers.d.ts → utils/headerFooterHelpers.d.ts} +11 -3
- package/lib/utils/headerFooterHelpers.d.ts.map +1 -0
- package/lib/utils/headerFooterHelpers.js +189 -0
- package/lib/utils/headerFooterHelpers.js.map +1 -0
- package/lib/versionInfo.js +3 -3
- package/lib/versionInfo.js.map +1 -1
- package/lib/webpack-bundle.js +3456 -174
- package/lib/webpack-bundle.js.map +1 -1
- package/package.json +6 -5
- package/lib/header/headerHelpers.d.ts.map +0 -1
- package/lib/header/headerHelpers.js +0 -96
- package/lib/header/headerHelpers.js.map +0 -1
package/lib/header/index.d.ts
CHANGED
|
@@ -2,35 +2,38 @@ import { IndexedFormula, NamedNode } from 'rdflib';
|
|
|
2
2
|
export declare type MenuItemLink = {
|
|
3
3
|
label: string;
|
|
4
4
|
url: string;
|
|
5
|
+
target?: string;
|
|
5
6
|
};
|
|
6
7
|
export declare type MenuItemButton = {
|
|
7
8
|
label: string;
|
|
8
|
-
onclick: () =>
|
|
9
|
+
onclick: () => void;
|
|
9
10
|
};
|
|
10
11
|
export declare type MenuItems = MenuItemLink | MenuItemButton;
|
|
11
12
|
export declare type HeaderOptions = {
|
|
12
13
|
logo?: string;
|
|
13
|
-
|
|
14
|
+
helpIcon?: string;
|
|
15
|
+
helpMenuList?: MenuItems[];
|
|
14
16
|
};
|
|
15
17
|
/**
|
|
16
18
|
* Initialize header component, the header object returned depends on whether the user is authenticated.
|
|
17
19
|
* @param store the data store
|
|
18
|
-
* @param
|
|
20
|
+
* @param userMenuList a list of menu items when the user is logged in
|
|
21
|
+
* @param options allow the header to be customized with a personalized logo, help icon and a help menu list of links or buttons.
|
|
19
22
|
* @returns a header for an authenticated user with menu items given or a login screen
|
|
20
23
|
*/
|
|
21
|
-
export declare function initHeader(store: IndexedFormula, options?: HeaderOptions): Promise<void>;
|
|
24
|
+
export declare function initHeader(store: IndexedFormula, userMenuList: MenuItems[], options?: HeaderOptions): Promise<void>;
|
|
22
25
|
/**
|
|
23
26
|
* @ignore exporting this only for the unit test
|
|
24
27
|
*/
|
|
25
|
-
export declare function rebuildHeader(header: HTMLElement, store: IndexedFormula, pod: NamedNode, options?: HeaderOptions): () => Promise<void>;
|
|
28
|
+
export declare function rebuildHeader(header: HTMLElement, store: IndexedFormula, pod: NamedNode, userMenuList: MenuItems[], options?: HeaderOptions): () => Promise<void>;
|
|
26
29
|
/**
|
|
27
30
|
* @ignore exporting this only for the unit test
|
|
28
31
|
*/
|
|
29
|
-
export declare function createBanner(store: IndexedFormula, pod: NamedNode, user: NamedNode | null, options?: HeaderOptions): Promise<HTMLElement>;
|
|
32
|
+
export declare function createBanner(store: IndexedFormula, pod: NamedNode, user: NamedNode | null, userMenuList: MenuItems[], options?: HeaderOptions): Promise<HTMLElement>;
|
|
30
33
|
/**
|
|
31
34
|
* @ignore exporting this only for the unit test
|
|
32
35
|
*/
|
|
33
|
-
export declare function createHelpMenu(): HTMLDivElement;
|
|
36
|
+
export declare function createHelpMenu(options: HeaderOptions, helpMenuItems: MenuItems[]): HTMLDivElement | undefined;
|
|
34
37
|
/**
|
|
35
38
|
* @ignore exporting this only for the unit test
|
|
36
39
|
*/
|
|
@@ -46,7 +49,7 @@ export declare function createUserMenuLink(label: string, href: string, target?:
|
|
|
46
49
|
/**
|
|
47
50
|
* @ignore exporting this only for the unit test
|
|
48
51
|
*/
|
|
49
|
-
export declare function createUserMenu(store: IndexedFormula, user: NamedNode,
|
|
52
|
+
export declare function createUserMenu(store: IndexedFormula, user: NamedNode, userMenuList: MenuItems[]): Promise<HTMLElement>;
|
|
50
53
|
/**
|
|
51
54
|
* @ignore exporting this only for the unit test
|
|
52
55
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/header/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/header/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAalD,oBAAY,YAAY,GAAG;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,oBAAY,cAAc,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB,CAAA;AAED,oBAAY,SAAS,GAAG,YAAY,GAAG,cAAc,CAAA;AAMrD,oBAAY,aAAa,GAAG;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,E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,cAAc,EAAE,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,WAAW,CAe3F"}
|
package/lib/header/index.js
CHANGED
|
@@ -22,7 +22,7 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
|
22
22
|
|
|
23
23
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
24
24
|
|
|
25
|
-
var
|
|
25
|
+
var _iconBase = require("../iconBase");
|
|
26
26
|
|
|
27
27
|
var _authn = require("../authn/authn");
|
|
28
28
|
|
|
@@ -30,7 +30,7 @@ var widgets = _interopRequireWildcard(require("../widgets"));
|
|
|
30
30
|
|
|
31
31
|
var _emptyProfile = require("./empty-profile");
|
|
32
32
|
|
|
33
|
-
var
|
|
33
|
+
var _headerFooterHelpers = require("../utils/headerFooterHelpers");
|
|
34
34
|
|
|
35
35
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
36
36
|
|
|
@@ -43,13 +43,20 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
43
43
|
work in solid-ui by adjusting where imported functions are found.
|
|
44
44
|
*/
|
|
45
45
|
|
|
46
|
+
/**
|
|
47
|
+
* menu icons
|
|
48
|
+
*/
|
|
49
|
+
var DEFAULT_HELP_MENU_ICON = _iconBase.icons.iconBase + 'noun_help.svg';
|
|
50
|
+
var DEFAUL_SOLID_ICON_URL = 'https://solidproject.org/assets/img/solid-emblem.svg';
|
|
51
|
+
|
|
46
52
|
/**
|
|
47
53
|
* Initialize header component, the header object returned depends on whether the user is authenticated.
|
|
48
54
|
* @param store the data store
|
|
49
|
-
* @param
|
|
55
|
+
* @param userMenuList a list of menu items when the user is logged in
|
|
56
|
+
* @param options allow the header to be customized with a personalized logo, help icon and a help menu list of links or buttons.
|
|
50
57
|
* @returns a header for an authenticated user with menu items given or a login screen
|
|
51
58
|
*/
|
|
52
|
-
function initHeader(_x, _x2) {
|
|
59
|
+
function initHeader(_x, _x2, _x3) {
|
|
53
60
|
return _initHeader.apply(this, arguments);
|
|
54
61
|
}
|
|
55
62
|
/**
|
|
@@ -58,7 +65,7 @@ function initHeader(_x, _x2) {
|
|
|
58
65
|
|
|
59
66
|
|
|
60
67
|
function _initHeader() {
|
|
61
|
-
_initHeader = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(store, options) {
|
|
68
|
+
_initHeader = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(store, userMenuList, options) {
|
|
62
69
|
var header, pod;
|
|
63
70
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
64
71
|
while (1) {
|
|
@@ -74,12 +81,12 @@ function _initHeader() {
|
|
|
74
81
|
return _context2.abrupt("return");
|
|
75
82
|
|
|
76
83
|
case 3:
|
|
77
|
-
pod = (0,
|
|
78
|
-
rebuildHeader(header, store, pod, options)();
|
|
84
|
+
pod = (0, _headerFooterHelpers.getPod)();
|
|
85
|
+
rebuildHeader(header, store, pod, userMenuList, options)();
|
|
79
86
|
|
|
80
|
-
_authn.authSession.onLogout(rebuildHeader(header, store, pod, options));
|
|
87
|
+
_authn.authSession.onLogout(rebuildHeader(header, store, pod, userMenuList, options));
|
|
81
88
|
|
|
82
|
-
_authn.authSession.onLogin(rebuildHeader(header, store, pod, options));
|
|
89
|
+
_authn.authSession.onLogin(rebuildHeader(header, store, pod, userMenuList, options));
|
|
83
90
|
|
|
84
91
|
case 7:
|
|
85
92
|
case "end":
|
|
@@ -91,7 +98,7 @@ function _initHeader() {
|
|
|
91
98
|
return _initHeader.apply(this, arguments);
|
|
92
99
|
}
|
|
93
100
|
|
|
94
|
-
function rebuildHeader(header, store, pod, options) {
|
|
101
|
+
function rebuildHeader(header, store, pod, userMenuList, options) {
|
|
95
102
|
return /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
96
103
|
var user;
|
|
97
104
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
@@ -102,7 +109,7 @@ function rebuildHeader(header, store, pod, options) {
|
|
|
102
109
|
header.innerHTML = '';
|
|
103
110
|
_context.t0 = header;
|
|
104
111
|
_context.next = 5;
|
|
105
|
-
return createBanner(store, pod, user, options);
|
|
112
|
+
return createBanner(store, pod, user, userMenuList, options);
|
|
106
113
|
|
|
107
114
|
case 5:
|
|
108
115
|
_context.t1 = _context.sent;
|
|
@@ -122,7 +129,7 @@ function rebuildHeader(header, store, pod, options) {
|
|
|
122
129
|
*/
|
|
123
130
|
|
|
124
131
|
|
|
125
|
-
function createBanner(
|
|
132
|
+
function createBanner(_x4, _x5, _x6, _x7, _x8) {
|
|
126
133
|
return _createBanner.apply(this, arguments);
|
|
127
134
|
}
|
|
128
135
|
/**
|
|
@@ -131,22 +138,22 @@ function createBanner(_x3, _x4, _x5, _x6) {
|
|
|
131
138
|
|
|
132
139
|
|
|
133
140
|
function _createBanner() {
|
|
134
|
-
_createBanner = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(store, pod, user, options) {
|
|
135
|
-
var podLink, image, userMenu,
|
|
141
|
+
_createBanner = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(store, pod, user, userMenuList, options) {
|
|
142
|
+
var podLink, image, userMenu, banner, leftSideOfHeader, helpMenu;
|
|
136
143
|
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
137
144
|
while (1) {
|
|
138
145
|
switch (_context3.prev = _context3.next) {
|
|
139
146
|
case 0:
|
|
140
147
|
podLink = document.createElement('a');
|
|
141
148
|
podLink.href = pod.uri;
|
|
142
|
-
(0,
|
|
149
|
+
(0, _headerFooterHelpers.addStyleClassToElement)(podLink, ['header-banner__link']);
|
|
143
150
|
image = document.createElement('img');
|
|
144
151
|
|
|
145
152
|
if (options) {
|
|
146
|
-
image.src = options.logo ? options.logo :
|
|
153
|
+
image.src = options.logo ? options.logo : DEFAUL_SOLID_ICON_URL;
|
|
147
154
|
}
|
|
148
155
|
|
|
149
|
-
(0,
|
|
156
|
+
(0, _headerFooterHelpers.addStyleClassToElement)(image, ['header-banner__icon']);
|
|
150
157
|
podLink.appendChild(image);
|
|
151
158
|
|
|
152
159
|
if (!user) {
|
|
@@ -155,7 +162,7 @@ function _createBanner() {
|
|
|
155
162
|
}
|
|
156
163
|
|
|
157
164
|
_context3.next = 10;
|
|
158
|
-
return createUserMenu(store, user,
|
|
165
|
+
return createUserMenu(store, user, userMenuList);
|
|
159
166
|
|
|
160
167
|
case 10:
|
|
161
168
|
_context3.t0 = _context3.sent;
|
|
@@ -167,18 +174,22 @@ function _createBanner() {
|
|
|
167
174
|
|
|
168
175
|
case 14:
|
|
169
176
|
userMenu = _context3.t0;
|
|
170
|
-
helpMenu = createHelpMenu();
|
|
171
177
|
banner = document.createElement('div');
|
|
172
|
-
(0,
|
|
178
|
+
(0, _headerFooterHelpers.addStyleClassToElement)(banner, ['header-banner']);
|
|
173
179
|
banner.appendChild(podLink);
|
|
174
180
|
leftSideOfHeader = document.createElement('div');
|
|
175
|
-
(0,
|
|
181
|
+
(0, _headerFooterHelpers.addStyleClassToElement)(leftSideOfHeader, ['header-banner__right-menu']);
|
|
176
182
|
leftSideOfHeader.appendChild(userMenu);
|
|
177
|
-
|
|
183
|
+
|
|
184
|
+
if (options && options.helpMenuList) {
|
|
185
|
+
helpMenu = createHelpMenu(options, options.helpMenuList);
|
|
186
|
+
leftSideOfHeader.appendChild(helpMenu);
|
|
187
|
+
}
|
|
188
|
+
|
|
178
189
|
banner.appendChild(leftSideOfHeader);
|
|
179
190
|
return _context3.abrupt("return", banner);
|
|
180
191
|
|
|
181
|
-
case
|
|
192
|
+
case 24:
|
|
182
193
|
case "end":
|
|
183
194
|
return _context3.stop();
|
|
184
195
|
}
|
|
@@ -188,29 +199,36 @@ function _createBanner() {
|
|
|
188
199
|
return _createBanner.apply(this, arguments);
|
|
189
200
|
}
|
|
190
201
|
|
|
191
|
-
function createHelpMenu() {
|
|
202
|
+
function createHelpMenu(options, helpMenuItems) {
|
|
203
|
+
if (!helpMenuItems) return;
|
|
192
204
|
var helpMenuList = document.createElement('ul');
|
|
193
|
-
(0,
|
|
194
|
-
|
|
195
|
-
|
|
205
|
+
(0, _headerFooterHelpers.addStyleClassToElement)(helpMenuList, ['header-user-menu__list']);
|
|
206
|
+
helpMenuItems.forEach(function (menuItem) {
|
|
207
|
+
var menuItemType = menuItem.url ? 'url' : 'onclick';
|
|
208
|
+
|
|
209
|
+
if (menuItemType === 'url') {
|
|
210
|
+
helpMenuList.appendChild(createUserMenuItem(createUserMenuLink(menuItem.label, menuItem.url, menuItem.target)));
|
|
211
|
+
} else {
|
|
212
|
+
helpMenuList.appendChild(createUserMenuItem(createUserMenuButton(menuItem.label, menuItem.onclick)));
|
|
213
|
+
}
|
|
214
|
+
});
|
|
196
215
|
var helpMenu = document.createElement('nav');
|
|
197
|
-
(0,
|
|
216
|
+
(0, _headerFooterHelpers.addStyleClassToElement)(helpMenu, ['header-user-menu__navigation-menu']);
|
|
198
217
|
helpMenu.setAttribute('aria-hidden', 'true');
|
|
199
218
|
helpMenu.appendChild(helpMenuList);
|
|
200
|
-
var helpIcon = _.icons.iconBase + 'noun_144.svg';
|
|
201
219
|
var helpMenuContainer = document.createElement('div');
|
|
202
|
-
(0,
|
|
203
|
-
(0,
|
|
220
|
+
(0, _headerFooterHelpers.addStyleClassToElement)(helpMenuContainer, ['header-banner__user-menu']);
|
|
221
|
+
(0, _headerFooterHelpers.addStyleClassToElement)(helpMenuContainer, ['header-user-menu']);
|
|
204
222
|
helpMenuContainer.appendChild(helpMenu);
|
|
205
223
|
var helpMenuTrigger = document.createElement('button');
|
|
206
|
-
(0,
|
|
224
|
+
(0, _headerFooterHelpers.addStyleClassToElement)(helpMenuTrigger, ['header-user-menu__trigger']);
|
|
207
225
|
helpMenuTrigger.type = 'button';
|
|
208
226
|
var helpMenuIcon = document.createElement('img');
|
|
209
|
-
helpMenuIcon.src = helpIcon;
|
|
210
|
-
(0,
|
|
227
|
+
helpMenuIcon.src = options && options.helpIcon ? options.helpIcon : _iconBase.icons.iconBase + DEFAULT_HELP_MENU_ICON;
|
|
228
|
+
(0, _headerFooterHelpers.addStyleClassToElement)(helpMenuIcon, ['header-banner__help-icon']);
|
|
211
229
|
helpMenuContainer.appendChild(helpMenuTrigger);
|
|
212
230
|
helpMenuTrigger.appendChild(helpMenuIcon);
|
|
213
|
-
var throttledMenuToggle = (0,
|
|
231
|
+
var throttledMenuToggle = (0, _headerFooterHelpers.throttle)(function (event) {
|
|
214
232
|
return toggleMenu(event, helpMenuTrigger, helpMenu);
|
|
215
233
|
}, 50);
|
|
216
234
|
helpMenuTrigger.addEventListener('click', throttledMenuToggle);
|
|
@@ -235,7 +253,7 @@ function createHelpMenu() {
|
|
|
235
253
|
|
|
236
254
|
function createLoginSignUpButtons() {
|
|
237
255
|
var profileLoginButtonPre = document.createElement('div');
|
|
238
|
-
(0,
|
|
256
|
+
(0, _headerFooterHelpers.addStyleClassToElement)(profileLoginButtonPre, ['header-banner__login']);
|
|
239
257
|
profileLoginButtonPre.appendChild((0, _authn.loginStatusBox)(document, null, {}));
|
|
240
258
|
return profileLoginButtonPre;
|
|
241
259
|
}
|
|
@@ -246,7 +264,7 @@ function createLoginSignUpButtons() {
|
|
|
246
264
|
|
|
247
265
|
function createUserMenuButton(label, onClick) {
|
|
248
266
|
var button = document.createElement('button');
|
|
249
|
-
(0,
|
|
267
|
+
(0, _headerFooterHelpers.addStyleClassToElement)(button, ['header-user-menu__button']);
|
|
250
268
|
button.addEventListener('click', onClick);
|
|
251
269
|
button.innerText = label;
|
|
252
270
|
return button;
|
|
@@ -258,7 +276,7 @@ function createUserMenuButton(label, onClick) {
|
|
|
258
276
|
|
|
259
277
|
function createUserMenuLink(label, href, target) {
|
|
260
278
|
var link = document.createElement('a');
|
|
261
|
-
(0,
|
|
279
|
+
(0, _headerFooterHelpers.addStyleClassToElement)(link, ['header-user-menu__link']);
|
|
262
280
|
link.href = href;
|
|
263
281
|
link.innerText = label;
|
|
264
282
|
if (target) link.target = target;
|
|
@@ -269,7 +287,7 @@ function createUserMenuLink(label, href, target) {
|
|
|
269
287
|
*/
|
|
270
288
|
|
|
271
289
|
|
|
272
|
-
function createUserMenu(
|
|
290
|
+
function createUserMenu(_x9, _x10, _x11) {
|
|
273
291
|
return _createUserMenu.apply(this, arguments);
|
|
274
292
|
}
|
|
275
293
|
/**
|
|
@@ -278,7 +296,7 @@ function createUserMenu(_x7, _x8, _x9) {
|
|
|
278
296
|
|
|
279
297
|
|
|
280
298
|
function _createUserMenu() {
|
|
281
|
-
_createUserMenu = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(store, user,
|
|
299
|
+
_createUserMenu = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(store, user, userMenuList) {
|
|
282
300
|
var fetcher, loggedInMenuList, loggedInMenu, loggedInMenuTrigger, profileImg, loggedInMenuContainer, throttledMenuToggle, timer;
|
|
283
301
|
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
284
302
|
while (1) {
|
|
@@ -296,32 +314,26 @@ function _createUserMenu() {
|
|
|
296
314
|
|
|
297
315
|
case 4:
|
|
298
316
|
loggedInMenuList = document.createElement('ul');
|
|
299
|
-
(0,
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
}
|
|
312
|
-
});
|
|
313
|
-
}
|
|
317
|
+
(0, _headerFooterHelpers.addStyleClassToElement)(loggedInMenuList, ['header-user-menu__list']);
|
|
318
|
+
|
|
319
|
+
if (userMenuList) {
|
|
320
|
+
userMenuList.forEach(function (menuItem) {
|
|
321
|
+
var menuItemType = menuItem.url ? 'url' : 'onclick';
|
|
322
|
+
|
|
323
|
+
if (menuItemType === 'url') {
|
|
324
|
+
loggedInMenuList.appendChild(createUserMenuItem(createUserMenuLink(menuItem.label, menuItem.url, menuItem.target)));
|
|
325
|
+
} else {
|
|
326
|
+
loggedInMenuList.appendChild(createUserMenuItem(createUserMenuButton(menuItem.label, menuItem.onclick)));
|
|
327
|
+
}
|
|
328
|
+
});
|
|
314
329
|
}
|
|
315
330
|
|
|
316
|
-
loggedInMenuList.appendChild(createUserMenuItem(createUserMenuButton('Log out', function () {
|
|
317
|
-
return _authn.authSession.logout();
|
|
318
|
-
})));
|
|
319
331
|
loggedInMenu = document.createElement('nav');
|
|
320
|
-
(0,
|
|
332
|
+
(0, _headerFooterHelpers.addStyleClassToElement)(loggedInMenu, ['header-user-menu__navigation-menu']);
|
|
321
333
|
loggedInMenu.setAttribute('aria-hidden', 'true');
|
|
322
334
|
loggedInMenu.appendChild(loggedInMenuList);
|
|
323
335
|
loggedInMenuTrigger = document.createElement('button');
|
|
324
|
-
(0,
|
|
336
|
+
(0, _headerFooterHelpers.addStyleClassToElement)(loggedInMenuTrigger, ['header-user-menu__trigger']);
|
|
325
337
|
loggedInMenuTrigger.type = 'button';
|
|
326
338
|
profileImg = getProfileImg(store, user);
|
|
327
339
|
|
|
@@ -332,11 +344,11 @@ function _createUserMenu() {
|
|
|
332
344
|
}
|
|
333
345
|
|
|
334
346
|
loggedInMenuContainer = document.createElement('div');
|
|
335
|
-
(0,
|
|
336
|
-
(0,
|
|
347
|
+
(0, _headerFooterHelpers.addStyleClassToElement)(loggedInMenuContainer, ['header-banner__user-menu']);
|
|
348
|
+
(0, _headerFooterHelpers.addStyleClassToElement)(loggedInMenuContainer, ['header-user-menu']);
|
|
337
349
|
loggedInMenuContainer.appendChild(loggedInMenuTrigger);
|
|
338
350
|
loggedInMenuContainer.appendChild(loggedInMenu);
|
|
339
|
-
throttledMenuToggle = (0,
|
|
351
|
+
throttledMenuToggle = (0, _headerFooterHelpers.throttle)(function (event) {
|
|
340
352
|
return toggleMenu(event, loggedInMenuTrigger, loggedInMenu);
|
|
341
353
|
}, 50);
|
|
342
354
|
loggedInMenuTrigger.addEventListener('click', throttledMenuToggle);
|
|
@@ -354,7 +366,7 @@ function _createUserMenu() {
|
|
|
354
366
|
});
|
|
355
367
|
return _context4.abrupt("return", loggedInMenuContainer);
|
|
356
368
|
|
|
357
|
-
case
|
|
369
|
+
case 27:
|
|
358
370
|
case "end":
|
|
359
371
|
return _context4.stop();
|
|
360
372
|
}
|
|
@@ -366,7 +378,7 @@ function _createUserMenu() {
|
|
|
366
378
|
|
|
367
379
|
function createUserMenuItem(child) {
|
|
368
380
|
var menuProfileItem = document.createElement('li');
|
|
369
|
-
(0,
|
|
381
|
+
(0, _headerFooterHelpers.addStyleClassToElement)(menuProfileItem, ['header-user-menu__list-item']);
|
|
370
382
|
menuProfileItem.appendChild(child);
|
|
371
383
|
return menuProfileItem;
|
|
372
384
|
}
|
|
@@ -389,7 +401,7 @@ function getProfileImg(store, user) {
|
|
|
389
401
|
}
|
|
390
402
|
|
|
391
403
|
var profileImage = document.createElement('div');
|
|
392
|
-
(0,
|
|
404
|
+
(0, _headerFooterHelpers.addStyleClassToElement)(profileImage, ['header-user-menu__photo']);
|
|
393
405
|
profileImage.style.backgroundImage = "url(\"".concat(profileUrl, "\")");
|
|
394
406
|
return profileImage;
|
|
395
407
|
}
|
package/lib/header/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/header/index.ts"],"names":["initHeader","store","options","header","document","getElementById","pod","rebuildHeader","authSession","onLogout","onLogin","user","innerHTML","createBanner","appendChild","podLink","createElement","href","uri","image","src","logo","createUserMenu","createLoginSignUpButtons","userMenu","helpMenu","createHelpMenu","banner","leftSideOfHeader","helpMenuList","createUserMenuItem","createUserMenuLink","setAttribute","helpIcon","icons","iconBase","helpMenuContainer","helpMenuTrigger","type","helpMenuIcon","throttledMenuToggle","event","toggleMenu","addEventListener","timer","setTimeout","clearTimeout","profileLoginButtonPre","createUserMenuButton","label","onClick","button","innerText","target","link","fetcher","load","loggedInMenuList","menuList","forEach","menuItem","menuItemType","url","logout","loggedInMenu","loggedInMenuTrigger","profileImg","getProfileImg","loggedInMenuContainer","child","menuProfileItem","profileUrl","widgets","findImage","emptyProfile","profileImage","style","backgroundImage","trigger","menu","isExpanded","getAttribute","expand","close","toString"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAMA;;AACA;;AACA;;AACA;;AACA;;;;;;AAVA;;AACA;AACA;AACA;AACA;;AA6BA;AACA;AACA;AACA;AACA;AACA;SACsBA,U;;;AAWtB;AACA;AACA;;;;8FAbO,kBAA2BC,KAA3B,EAAkDC,OAAlD;AAAA;AAAA;AAAA;AAAA;AAAA;AACCC,YAAAA,MADD,GACUC,QAAQ,CAACC,cAAT,CAAwB,YAAxB,CADV;;AAAA,gBAEAF,MAFA;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAMCG,YAAAA,GAND,GAMO,4BANP;AAOLC,YAAAA,aAAa,CAACJ,MAAD,EAASF,KAAT,EAAgBK,GAAhB,EAAqBJ,OAArB,CAAb;;AACAM,+BAAYC,QAAZ,CAAqBF,aAAa,CAACJ,MAAD,EAASF,KAAT,EAAgBK,GAAhB,EAAqBJ,OAArB,CAAlC;;AACAM,+BAAYE,OAAZ,CAAoBH,aAAa,CAACJ,MAAD,EAASF,KAAT,EAAgBK,GAAhB,EAAqBJ,OAArB,CAAjC;;AATK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G;;;;AAcA,SAASK,aAAT,CAAwBJ,MAAxB,EAA6CF,KAA7C,EAAoEK,GAApE,EAAoFJ,OAApF,EAA6G;AAClH,oGAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AACCS,YAAAA,IADD,GACQ,yBADR;AA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CAACH,IAAN,KAAe,WAA9B;AACA,MAAM6C,KAAK,GAAG1C,KAAK,CAACH,IAAN,KAAe,UAA7B;;AACA,MAAK0C,UAAU,IAAIE,MAAf,IAA2B,CAACF,UAAD,IAAeG,KAA9C,EAAsD;AACpD;AACD;;AACDL,EAAAA,OAAO,CAAC9C,YAAR,CAAqB,eAArB,EAAsC,CAAC,CAACgD,UAAF,EAAcI,QAAd,EAAtC;AACAL,EAAAA,IAAI,CAAC/C,YAAL,CAAkB,aAAlB,EAAiCgD,UAAU,CAACI,QAAX,EAAjC;AACD","sourcesContent":["/* global EventListenerOrEventListenerObject */\n/*\n This file was copied from mashlib/src/global/header.ts file. It is modified to\n work in solid-ui by adjusting where imported functions are found.\n */\nimport { IndexedFormula, NamedNode } from 'rdflib'\nimport { icons } from '..'\nimport { loginStatusBox, authSession, currentUser } from '../authn/authn'\nimport * as widgets from '../widgets'\nimport { emptyProfile } from './empty-profile'\nimport { addStyleClassToElement, getPod, throttle } from './headerHelpers'\n\nexport type MenuItemLink = {\n label: string,\n url: string\n}\n\nexport type MenuItemButton = {\n label: string,\n onclick: () => {}\n}\n\nexport type MenuItems = MenuItemLink | MenuItemButton\n\n/*\nHeaderOptions allow for customizing the logo and menu list. If a logo is not provided the default\n is solid. Menulist will always show a link to logout and to the users profile.\n */\nexport type HeaderOptions = {\n logo?: string,\n menuList?: MenuItems[]\n}\n\n/**\n * Initialize header component, the header object returned depends on whether the user is authenticated.\n * @param store the data store\n * @param options allow the header to be customized with a personalized logo and a menu list of links or buttons.\n * @returns a header for an authenticated user with menu items given or a login screen\n */\nexport async function initHeader (store: IndexedFormula, options?: HeaderOptions) {\n const header = document.getElementById('PageHeader')\n if (!header) {\n return\n }\n\n const pod = getPod()\n rebuildHeader(header, store, pod, options)()\n authSession.onLogout(rebuildHeader(header, store, pod, options))\n authSession.onLogin(rebuildHeader(header, store, pod, options))\n}\n/**\n * @ignore exporting this only for the unit test\n */\nexport function rebuildHeader (header: HTMLElement, store: IndexedFormula, pod: NamedNode, options?: HeaderOptions) {\n return async () => {\n const user = currentUser()\n header.innerHTML = ''\n header.appendChild(await createBanner(store, pod, user, options))\n }\n}\n/**\n * @ignore exporting this only for the unit test\n */\nexport async function createBanner (store: IndexedFormula, pod: NamedNode, user: NamedNode | null, options?: HeaderOptions): Promise<HTMLElement> {\n const podLink = document.createElement('a')\n podLink.href = pod.uri\n addStyleClassToElement(podLink, ['header-banner__link'])\n const image = document.createElement('img')\n if (options) {\n image.src = options.logo ? options.logo : 'https://solidproject.org/assets/img/solid-emblem.svg'\n }\n addStyleClassToElement(image, ['header-banner__icon'])\n podLink.appendChild(image)\n\n const userMenu = user\n ? await createUserMenu(store, user, options)\n : createLoginSignUpButtons()\n\n const helpMenu = createHelpMenu()\n\n const banner = document.createElement('div')\n addStyleClassToElement(banner, ['header-banner'])\n banner.appendChild(podLink)\n\n const leftSideOfHeader = document.createElement('div')\n addStyleClassToElement(leftSideOfHeader, ['header-banner__right-menu'])\n leftSideOfHeader.appendChild(userMenu)\n leftSideOfHeader.appendChild(helpMenu)\n\n banner.appendChild(leftSideOfHeader)\n\n return banner\n}\n/**\n * @ignore exporting this only for the unit test\n */\nexport function createHelpMenu () {\n const helpMenuList = document.createElement('ul')\n addStyleClassToElement(helpMenuList, ['header-user-menu__list'])\n helpMenuList.appendChild(createUserMenuItem(createUserMenuLink('User guide', 'https://github.com/solid/userguide', '_blank')))\n helpMenuList.appendChild(createUserMenuItem(createUserMenuLink('Report a problem', 'https://github.com/solid/solidos/issues', '_blank')))\n\n const helpMenu = document.createElement('nav')\n\n addStyleClassToElement(helpMenu, ['header-user-menu__navigation-menu'])\n helpMenu.setAttribute('aria-hidden', 'true')\n helpMenu.appendChild(helpMenuList)\n\n const helpIcon = icons.iconBase + 'noun_144.svg'\n\n const helpMenuContainer = document.createElement('div')\n addStyleClassToElement(helpMenuContainer, ['header-banner__user-menu'])\n addStyleClassToElement(helpMenuContainer, ['header-user-menu'])\n helpMenuContainer.appendChild(helpMenu)\n\n const helpMenuTrigger = document.createElement('button')\n addStyleClassToElement(helpMenuTrigger, ['header-user-menu__trigger'])\n helpMenuTrigger.type = 'button'\n\n const helpMenuIcon = document.createElement('img')\n helpMenuIcon.src = helpIcon\n addStyleClassToElement(helpMenuIcon, ['header-banner__help-icon'])\n helpMenuContainer.appendChild(helpMenuTrigger)\n helpMenuTrigger.appendChild(helpMenuIcon)\n\n const throttledMenuToggle = throttle((event: Event) => toggleMenu(event, helpMenuTrigger, helpMenu), 50)\n helpMenuTrigger.addEventListener('click', throttledMenuToggle)\n let timer = setTimeout(() => null, 0)\n helpMenuContainer.addEventListener('mouseover', event => {\n clearTimeout(timer)\n throttledMenuToggle(event)\n })\n helpMenuContainer.addEventListener('mouseout', event => {\n timer = setTimeout(() => throttledMenuToggle(event), 200)\n })\n\n return helpMenuContainer\n}\n/**\n * @ignore exporting this only for the unit test\n */\nexport function createLoginSignUpButtons () {\n const profileLoginButtonPre = document.createElement('div')\n addStyleClassToElement(profileLoginButtonPre, ['header-banner__login'])\n profileLoginButtonPre.appendChild(loginStatusBox(document, null, {}))\n return profileLoginButtonPre\n}\n/**\n * @ignore exporting this only for the unit test\n */\nexport function createUserMenuButton (label: string, onClick: EventListenerOrEventListenerObject): HTMLElement {\n const button = document.createElement('button')\n addStyleClassToElement(button, ['header-user-menu__button'])\n button.addEventListener('click', onClick)\n button.innerText = label\n return button\n}\n/**\n * @ignore exporting this only for the unit test\n */\nexport function createUserMenuLink (label: string, href: string, target?:string): HTMLElement {\n const link = document.createElement('a')\n addStyleClassToElement(link, ['header-user-menu__link'])\n link.href = href\n link.innerText = label\n if (target) link.target = target\n return link\n}\n\n/**\n * @ignore exporting this only for the unit test\n */\nexport async function createUserMenu (store: IndexedFormula, user: NamedNode, options?: HeaderOptions): Promise<HTMLElement> {\n const fetcher = (<any>store).fetcher\n if (fetcher) {\n // Making sure that Profile is loaded before building menu\n await fetcher.load(user)\n }\n const loggedInMenuList = document.createElement('ul')\n addStyleClassToElement(loggedInMenuList, ['header-user-menu__list'])\n loggedInMenuList.appendChild(createUserMenuItem(createUserMenuLink('Show your profile', user.uri)))\n if (options) {\n if (options.menuList) {\n options.menuList.forEach(function (menuItem) {\n const menuItemType: string = (menuItem as MenuItemLink).url ? 'url' : 'onclick'\n if (menuItemType === 'url') {\n loggedInMenuList.appendChild(createUserMenuItem(createUserMenuLink(menuItem.label, menuItem[menuItemType])))\n } else {\n loggedInMenuList.appendChild(createUserMenuItem(createUserMenuButton(menuItem.label, menuItem[menuItemType])))\n }\n })\n }\n }\n\n loggedInMenuList.appendChild(createUserMenuItem(createUserMenuButton('Log out', () => authSession.logout())))\n\n const loggedInMenu = document.createElement('nav')\n\n addStyleClassToElement(loggedInMenu, ['header-user-menu__navigation-menu'])\n loggedInMenu.setAttribute('aria-hidden', 'true')\n loggedInMenu.appendChild(loggedInMenuList)\n\n const loggedInMenuTrigger = document.createElement('button')\n addStyleClassToElement(loggedInMenuTrigger, ['header-user-menu__trigger'])\n loggedInMenuTrigger.type = 'button'\n const profileImg = getProfileImg(store, user)\n if (typeof profileImg === 'string') {\n loggedInMenuTrigger.innerHTML = profileImg\n } else {\n loggedInMenuTrigger.appendChild(profileImg)\n }\n\n const loggedInMenuContainer = document.createElement('div')\n addStyleClassToElement(loggedInMenuContainer, ['header-banner__user-menu'])\n addStyleClassToElement(loggedInMenuContainer, ['header-user-menu'])\n loggedInMenuContainer.appendChild(loggedInMenuTrigger)\n loggedInMenuContainer.appendChild(loggedInMenu)\n\n const throttledMenuToggle = throttle((event: Event) => toggleMenu(event, loggedInMenuTrigger, loggedInMenu), 50)\n loggedInMenuTrigger.addEventListener('click', throttledMenuToggle)\n let timer = setTimeout(() => null, 0)\n loggedInMenuContainer.addEventListener('mouseover', event => {\n clearTimeout(timer)\n throttledMenuToggle(event)\n })\n loggedInMenuContainer.addEventListener('mouseout', event => {\n timer = setTimeout(() => throttledMenuToggle(event), 200)\n })\n\n return loggedInMenuContainer\n}\n\n/**\n * @ignore exporting this only for the unit test\n */\nexport function createUserMenuItem (child: HTMLElement): HTMLElement {\n const menuProfileItem = document.createElement('li')\n addStyleClassToElement(menuProfileItem, ['header-user-menu__list-item'])\n menuProfileItem.appendChild(child)\n return menuProfileItem\n}\n/**\n * @ignore exporting this only for the unit test\n */\nexport function getProfileImg (store: IndexedFormula, user: NamedNode): string | HTMLElement {\n const profileUrl = null\n try {\n const profileUrl = widgets.findImage(user)\n if (!profileUrl) {\n return emptyProfile\n }\n } catch {\n return emptyProfile\n }\n\n const profileImage = document.createElement('div')\n addStyleClassToElement(profileImage, ['header-user-menu__photo'])\n profileImage.style.backgroundImage = `url(\"${profileUrl}\")`\n return profileImage\n}\n\n/**\n * @internal\n */\nfunction toggleMenu (event: Event, trigger: HTMLButtonElement, menu: HTMLElement): void {\n const isExpanded = trigger.getAttribute('aria-expanded') === 'true'\n const expand = event.type === 'mouseover'\n const close = event.type === 'mouseout'\n if ((isExpanded && expand) || (!isExpanded && close)) {\n return\n }\n trigger.setAttribute('aria-expanded', (!isExpanded).toString())\n menu.setAttribute('aria-hidden', isExpanded.toString())\n}\n"],"file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/header/index.ts"],"names":["DEFAULT_HELP_MENU_ICON","icons","iconBase","DEFAUL_SOLID_ICON_URL","initHeader","store","userMenuList","options","header","document","getElementById","pod","rebuildHeader","authSession","onLogout","onLogin","user","innerHTML","createBanner","appendChild","podLink","createElement","href","uri","image","src","logo","createUserMenu","createLoginSignUpButtons","userMenu","banner","leftSideOfHeader","helpMenuList","helpMenu","createHelpMenu","helpMenuItems","forEach","menuItem","menuItemType","url","createUserMenuItem","createUserMenuLink","label","target","createUserMenuButton","onclick","setAttribute","helpMenuContainer","helpMenuTrigger","type","helpMenuIcon","helpIcon","throttledMenuToggle","event","toggleMenu","addEventListener","timer","setTimeout","clearTimeout","profileLoginButtonPre","onClick","button","innerText","link","fetcher","load","loggedInMenuList","loggedInMenu","loggedInMenuTrigger","profileImg","getProfileImg","loggedInMenuContainer","child","menuProfileItem","profileUrl","widgets","findImage","emptyProfile","profileImage","style","backgroundImage","trigger","menu","isExpanded","getAttribute","expand","close","toString"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAMA;;AACA;;AACA;;AACA;;AACA;;;;;;AAVA;;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA,IAAMA,sBAAsB,GAAGC,gBAAMC,QAAN,GAAiB,eAAhD;AACA,IAAMC,qBAAqB,GAAG,sDAA9B;;AAyBA;AACA;AACA;AACA;AACA;AACA;AACA;SACsBC,U;;;AAWtB;AACA;AACA;;;;8FAbO,kBAA2BC,KAA3B,EAAkDC,YAAlD,EAA6EC,OAA7E;AAAA;AAAA;AAAA;AAAA;AAAA;AACCC,YAAAA,MADD,GACUC,QAAQ,CAACC,cAAT,CAAwB,YAAxB,CADV;;AAAA,gBAEAF,MAFA;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAMCG,YAAAA,GAND,GAMO,kCANP;AAOLC,YAAAA,aAAa,CAACJ,MAAD,EAASH,KAAT,EAAgBM,GAAhB,EAAqBL,YAArB,EAAmCC,OAAnC,CAAb;;AACAM,+BAAYC,QAAZ,CAAqBF,aAAa,CAACJ,MAAD,EAASH,KAAT,EAAgBM,GAAhB,EAAqBL,YAArB,EAAmCC,OAAnC,CAAlC;;AACAM,+BAAYE,OAAZ,CAAoBH,aAAa,CAACJ,MAAD,EAASH,KAAT,EAAgBM,GAAhB,EAAqBL,YAArB,EAAmCC,OAAnC,CAAjC;;AATK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G;;;;AAcA,SAASK,aAAT,CAAwBJ,MAAxB,EAA6CH,KAA7C,EAAoEM,GAApE,EAAoFL,YAApF,EAA+GC,OAA/G,EAAwI;AAC7I,oGAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AACCS,YAAAA,IADD,GACQ,yBADR;AAELR,YAAAA,MAAM,CAACS,SAAP,GAAmB,EAAnB;AAFK,0BAGLT,MAHK;AAA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,OAAnC,EAA+DC,IAA/D,EAAwF;AACtF,MAAMC,UAAU,GAAGF,OAAO,CAACG,YAAR,CAAqB,eAArB,MAA0C,MAA7D;AACA,MAAMC,MAAM,GAAGhC,KAAK,CAACJ,IAAN,KAAe,WAA9B;AACA,MAAMqC,KAAK,GAAGjC,KAAK,CAACJ,IAAN,KAAe,UAA7B;;AACA,MAAKkC,UAAU,IAAIE,MAAf,IAA2B,CAACF,UAAD,IAAeG,KAA9C,EAAsD;AACpD;AACD;;AACDL,EAAAA,OAAO,CAACnC,YAAR,CAAqB,eAArB,EAAsC,CAAC,CAACqC,UAAF,EAAcI,QAAd,EAAtC;AACAL,EAAAA,IAAI,CAACpC,YAAL,CAAkB,aAAlB,EAAiCqC,UAAU,CAACI,QAAX,EAAjC;AACD","sourcesContent":["/* global EventListenerOrEventListenerObject */\n/*\n This file was copied from mashlib/src/global/header.ts file. It is modified to\n work in solid-ui by adjusting where imported functions are found.\n */\nimport { IndexedFormula, NamedNode } from 'rdflib'\nimport { icons } from '../iconBase'\nimport { loginStatusBox, authSession, currentUser } from '../authn/authn'\nimport * as widgets from '../widgets'\nimport { emptyProfile } from './empty-profile'\nimport { addStyleClassToElement, getPod, throttle } from '../utils/headerFooterHelpers'\n\n/**\n * menu icons\n*/\nconst DEFAULT_HELP_MENU_ICON = icons.iconBase + 'noun_help.svg'\nconst DEFAUL_SOLID_ICON_URL = 'https://solidproject.org/assets/img/solid-emblem.svg'\n\nexport type MenuItemLink = {\n label: string,\n url: string,\n target?: string\n}\n\nexport type MenuItemButton = {\n label: string,\n onclick: () => void\n}\n\nexport type MenuItems = MenuItemLink | MenuItemButton\n\n/*\n HeaderOptions allow for customizing the logo and menu list. If a logo is not provided the default\n is solid. Menulist will always show a link to logout and to the users profile.\n */\nexport type HeaderOptions = {\n logo?: string,\n helpIcon?: string,\n helpMenuList?: MenuItems[]\n}\n\n/**\n * Initialize header component, the header object returned depends on whether the user is authenticated.\n * @param store the data store\n * @param userMenuList a list of menu items when the user is logged in\n * @param options allow the header to be customized with a personalized logo, help icon and a help menu list of links or buttons.\n * @returns a header for an authenticated user with menu items given or a login screen\n */\nexport async function initHeader (store: IndexedFormula, userMenuList: MenuItems[], options?: HeaderOptions) {\n const header = document.getElementById('PageHeader')\n if (!header) {\n return\n }\n\n const pod = getPod()\n rebuildHeader(header, store, pod, userMenuList, options)()\n authSession.onLogout(rebuildHeader(header, store, pod, userMenuList, options))\n authSession.onLogin(rebuildHeader(header, store, pod, userMenuList, options))\n}\n/**\n * @ignore exporting this only for the unit test\n */\nexport function rebuildHeader (header: HTMLElement, store: IndexedFormula, pod: NamedNode, userMenuList: MenuItems[], options?: HeaderOptions) {\n return async () => {\n const user = currentUser()\n header.innerHTML = ''\n header.appendChild(await createBanner(store, pod, user, userMenuList, options))\n }\n}\n/**\n * @ignore exporting this only for the unit test\n */\nexport async function createBanner (store: IndexedFormula, pod: NamedNode, user: NamedNode | null, userMenuList: MenuItems[], options?: HeaderOptions): Promise<HTMLElement> {\n const podLink = document.createElement('a')\n podLink.href = pod.uri\n addStyleClassToElement(podLink, ['header-banner__link'])\n const image = document.createElement('img')\n if (options) {\n image.src = options.logo ? options.logo : DEFAUL_SOLID_ICON_URL\n }\n addStyleClassToElement(image, ['header-banner__icon'])\n podLink.appendChild(image)\n\n const userMenu = user\n ? await createUserMenu(store, user, userMenuList)\n : createLoginSignUpButtons()\n\n const banner = document.createElement('div')\n addStyleClassToElement(banner, ['header-banner'])\n banner.appendChild(podLink)\n\n const leftSideOfHeader = document.createElement('div')\n addStyleClassToElement(leftSideOfHeader, ['header-banner__right-menu'])\n leftSideOfHeader.appendChild(userMenu)\n\n if (options && options.helpMenuList) {\n const helpMenu = createHelpMenu(options, options.helpMenuList)\n leftSideOfHeader.appendChild(helpMenu as HTMLDivElement)\n }\n\n banner.appendChild(leftSideOfHeader)\n\n return banner\n}\n/**\n * @ignore exporting this only for the unit test\n */\nexport function createHelpMenu (options: HeaderOptions, helpMenuItems: MenuItems[]) {\n if (!helpMenuItems) return\n const helpMenuList = document.createElement('ul')\n addStyleClassToElement(helpMenuList, ['header-user-menu__list'])\n helpMenuItems.forEach(function (menuItem) {\n const menuItemType: string = (menuItem as MenuItemLink).url ? 'url' : 'onclick'\n if (menuItemType === 'url') {\n helpMenuList.appendChild(createUserMenuItem(createUserMenuLink(menuItem.label, (menuItem as MenuItemLink).url, (menuItem as MenuItemLink).target)))\n } else {\n helpMenuList.appendChild(createUserMenuItem(createUserMenuButton(menuItem.label, (menuItem as MenuItemButton).onclick)))\n }\n })\n\n const helpMenu = document.createElement('nav')\n\n addStyleClassToElement(helpMenu, ['header-user-menu__navigation-menu'])\n helpMenu.setAttribute('aria-hidden', 'true')\n helpMenu.appendChild(helpMenuList)\n\n const helpMenuContainer = document.createElement('div')\n addStyleClassToElement(helpMenuContainer, ['header-banner__user-menu'])\n addStyleClassToElement(helpMenuContainer, ['header-user-menu'])\n helpMenuContainer.appendChild(helpMenu)\n\n const helpMenuTrigger = document.createElement('button')\n addStyleClassToElement(helpMenuTrigger, ['header-user-menu__trigger'])\n helpMenuTrigger.type = 'button'\n\n const helpMenuIcon = document.createElement('img')\n helpMenuIcon.src = (options && options.helpIcon) ? options.helpIcon : icons.iconBase + DEFAULT_HELP_MENU_ICON\n addStyleClassToElement(helpMenuIcon, ['header-banner__help-icon'])\n helpMenuContainer.appendChild(helpMenuTrigger)\n helpMenuTrigger.appendChild(helpMenuIcon)\n\n const throttledMenuToggle = throttle((event: Event) => toggleMenu(event, helpMenuTrigger, helpMenu), 50)\n helpMenuTrigger.addEventListener('click', throttledMenuToggle)\n let timer = setTimeout(() => null, 0)\n helpMenuContainer.addEventListener('mouseover', event => {\n clearTimeout(timer)\n throttledMenuToggle(event)\n })\n helpMenuContainer.addEventListener('mouseout', event => {\n timer = setTimeout(() => throttledMenuToggle(event), 200)\n })\n\n return helpMenuContainer\n}\n/**\n * @ignore exporting this only for the unit test\n */\nexport function createLoginSignUpButtons () {\n const profileLoginButtonPre = document.createElement('div')\n addStyleClassToElement(profileLoginButtonPre, ['header-banner__login'])\n profileLoginButtonPre.appendChild(loginStatusBox(document, null, {}))\n return profileLoginButtonPre\n}\n/**\n * @ignore exporting this only for the unit test\n */\nexport function createUserMenuButton (label: string, onClick: EventListenerOrEventListenerObject): HTMLElement {\n const button = document.createElement('button')\n addStyleClassToElement(button, ['header-user-menu__button'])\n button.addEventListener('click', onClick)\n button.innerText = label\n return button\n}\n/**\n * @ignore exporting this only for the unit test\n */\nexport function createUserMenuLink (label: string, href: string, target?: string): HTMLElement {\n const link = document.createElement('a')\n addStyleClassToElement(link, ['header-user-menu__link'])\n link.href = href\n link.innerText = label\n if (target) link.target = target\n return link\n}\n\n/**\n * @ignore exporting this only for the unit test\n */\nexport async function createUserMenu (store: IndexedFormula, user: NamedNode, userMenuList: MenuItems[]): Promise<HTMLElement> {\n const fetcher = (<any>store).fetcher\n if (fetcher) {\n // Making sure that Profile is loaded before building menu\n await fetcher.load(user)\n }\n\n const loggedInMenuList = document.createElement('ul')\n addStyleClassToElement(loggedInMenuList, ['header-user-menu__list'])\n if (userMenuList) {\n userMenuList.forEach(function (menuItem) {\n const menuItemType: string = (menuItem as MenuItemLink).url ? 'url' : 'onclick'\n if (menuItemType === 'url') {\n loggedInMenuList.appendChild(createUserMenuItem(createUserMenuLink(menuItem.label, (menuItem as MenuItemLink).url, (menuItem as MenuItemLink).target)))\n } else {\n loggedInMenuList.appendChild(createUserMenuItem(createUserMenuButton(menuItem.label, (menuItem as MenuItemButton).onclick)))\n }\n })\n }\n const loggedInMenu = document.createElement('nav')\n\n addStyleClassToElement(loggedInMenu, ['header-user-menu__navigation-menu'])\n loggedInMenu.setAttribute('aria-hidden', 'true')\n loggedInMenu.appendChild(loggedInMenuList)\n\n const loggedInMenuTrigger = document.createElement('button')\n addStyleClassToElement(loggedInMenuTrigger, ['header-user-menu__trigger'])\n loggedInMenuTrigger.type = 'button'\n const profileImg = getProfileImg(store, user)\n if (typeof profileImg === 'string') {\n loggedInMenuTrigger.innerHTML = profileImg\n } else {\n loggedInMenuTrigger.appendChild(profileImg)\n }\n\n const loggedInMenuContainer = document.createElement('div')\n addStyleClassToElement(loggedInMenuContainer, ['header-banner__user-menu'])\n addStyleClassToElement(loggedInMenuContainer, ['header-user-menu'])\n loggedInMenuContainer.appendChild(loggedInMenuTrigger)\n loggedInMenuContainer.appendChild(loggedInMenu)\n\n const throttledMenuToggle = throttle((event: Event) => toggleMenu(event, loggedInMenuTrigger, loggedInMenu), 50)\n loggedInMenuTrigger.addEventListener('click', throttledMenuToggle)\n let timer = setTimeout(() => null, 0)\n loggedInMenuContainer.addEventListener('mouseover', event => {\n clearTimeout(timer)\n throttledMenuToggle(event)\n })\n loggedInMenuContainer.addEventListener('mouseout', event => {\n timer = setTimeout(() => throttledMenuToggle(event), 200)\n })\n\n return loggedInMenuContainer\n}\n\n/**\n * @ignore exporting this only for the unit test\n */\nexport function createUserMenuItem (child: HTMLElement): HTMLElement {\n const menuProfileItem = document.createElement('li')\n addStyleClassToElement(menuProfileItem, ['header-user-menu__list-item'])\n menuProfileItem.appendChild(child)\n return menuProfileItem\n}\n/**\n * @ignore exporting this only for the unit test\n */\nexport function getProfileImg (store: IndexedFormula, user: NamedNode): string | HTMLElement {\n const profileUrl = null\n try {\n const profileUrl = widgets.findImage(user)\n if (!profileUrl) {\n return emptyProfile\n }\n } catch {\n return emptyProfile\n }\n\n const profileImage = document.createElement('div')\n addStyleClassToElement(profileImage, ['header-user-menu__photo'])\n profileImage.style.backgroundImage = `url(\"${profileUrl}\")`\n return profileImage\n}\n\n/**\n * @internal\n */\nfunction toggleMenu (event: Event, trigger: HTMLButtonElement, menu: HTMLElement): void {\n const isExpanded = trigger.getAttribute('aria-expanded') === 'true'\n const expand = event.type === 'mouseover'\n const close = event.type === 'mouseout'\n if ((isExpanded && expand) || (!isExpanded && close)) {\n return\n }\n trigger.setAttribute('aria-expanded', (!isExpanded).toString())\n menu.setAttribute('aria-hidden', isExpanded.toString())\n}\n"],"file":"index.js"}
|
package/lib/header/styleMap.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styleMap.d.ts","sourceRoot":"","sources":["../../src/header/styleMap.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ
|
|
1
|
+
{"version":3,"file":"styleMap.d.ts","sourceRoot":"","sources":["../../src/header/styleMap.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsHpB,CAAA"}
|
package/lib/header/styleMap.js
CHANGED
|
@@ -131,11 +131,7 @@ var styleMap = {
|
|
|
131
131
|
|
|
132
132
|
},
|
|
133
133
|
'header-banner__help-icon': {
|
|
134
|
-
|
|
135
|
-
height: '50px !important',
|
|
136
|
-
// this is the icon size
|
|
137
|
-
width: '55px !important' // may just be 65px round($icon-size * 352 / 430);
|
|
138
|
-
|
|
134
|
+
width: '28px !important'
|
|
139
135
|
}
|
|
140
136
|
};
|
|
141
137
|
exports.styleMap = styleMap;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/header/styleMap.ts"],"names":["styleMap","background","border","color","cursor","display","fontFamily","fontSize","textAlign","padding","width","backgroundColor","a","textDecoration","height","img","borderRadius","listStyle","margin","borderRight","position","right","top","borderBottom","backgroundPosition","backgroundRepeat","backgroundSize","boxShadow","justifyContent","marginBottom","marginLeft","input","borderLeft"],"mappings":";;;;;;AAAO,IAAMA,QAAQ,GAAG;AACtB,sBAAoB,EADE;AAGtB,4BAA0B;AACxBC,IAAAA,UAAU,EAAE,MADY;AAExBC,IAAAA,MAAM,EAAE,GAFgB;AAGxBC,IAAAA,KAAK,EAAE,OAHiB;AAIxBC,IAAAA,MAAM,EAAE,SAJgB;AAKxBC,IAAAA,OAAO,EAAE,OALe;AA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8BAA4B;AAC1BE,IAAAA,UAAU,EAAE,mBADc;AACO;AACjCF,IAAAA,UAAU,EAAE;AAFc,GA1GN;AA8GtB,yBAAuB;AACrBJ,IAAAA,cAAc,EAAE,WADK;AAErBZ,IAAAA,MAAM,EAAE,iBAFa;AAEM;AAC3BJ,IAAAA,KAAK,EAAE,iBAHc,CAGI;;AAHJ,GA9GD;AAmHtB,8BAA4B;
|
|
1
|
+
{"version":3,"sources":["../../src/header/styleMap.ts"],"names":["styleMap","background","border","color","cursor","display","fontFamily","fontSize","textAlign","padding","width","backgroundColor","a","textDecoration","height","img","borderRadius","listStyle","margin","borderRight","position","right","top","borderBottom","backgroundPosition","backgroundRepeat","backgroundSize","boxShadow","justifyContent","marginBottom","marginLeft","input","borderLeft"],"mappings":";;;;;;AAAO,IAAMA,QAAQ,GAAG;AACtB,sBAAoB,EADE;AAGtB,4BAA0B;AACxBC,IAAAA,UAAU,EAAE,MADY;AAExBC,IAAAA,MAAM,EAAE,GAFgB;AAGxBC,IAAAA,KAAK,EAAE,OAHiB;AAIxBC,IAAAA,MAAM,EAAE,SAJgB;AAKxBC,IAAAA,OAAO,EAAE,OALe;AAMxBC,IAAAA,UAAU,EAAE,OANY;AAOxBC,IAAAA,QAAQ,EAAE,KAPc;AAQxBC,IAAAA,SAAS,EAAE,MARa;AASxBC,IAAAA,OAAO,EAAE,KATe;AAUxBC,IAAAA,KAAK,EAAE,MAViB;AAWxB,wBAAoB;AAClBC,MAAAA,eAAe,EAAE,kEADC,CAElB;;AAFkB,KAXI;AAexBC,IAAAA,CAAC,EAAE;AACDC,MAAAA,cAAc,EAAE;AADf;AAfqB,GAHJ;AAsBtB,+BAA6B;AAC3BZ,IAAAA,UAAU,EAAE,MADe;AAE3BC,IAAAA,MAAM,EAAE,GAFmB;AAG3BE,IAAAA,MAAM,EAAE,SAHmB;AAI3BM,IAAAA,KAAK,EAAE,MAJoB;AAIZ;AACfI,IAAAA,MAAM,EAAE,MALmB;AAKX;AAChBC,IAA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,IAAAA,gBAAgB,EAAE,WAHO;AAIzBC,IAAAA,cAAc,EAAE,OAJS;AAKzBZ,IAAAA,MAAM,EAAE,MALiB;AAKT;AAChBJ,IAAAA,KAAK,EAAE;AANkB,GAzEL;AAiFtB,mBAAiB;AACfiB,IAAAA,SAAS,EAAE,qBADI;AACmB;AAClCtB,IAAAA,OAAO,EAAE,MAFM;AAGfuB,IAAAA,cAAc,EAAE,eAHD;AAIfnB,IAAAA,OAAO,EAAE,SAJM;AAKfoB,IAAAA,YAAY,EAAE;AALC,GAjFK;AAwFtB,yBAAuB;AACrBxB,IAAAA,OAAO,EAAE;AADY,GAxFD;AA2FtB,+BAA6B;AAC3BA,IAAAA,OAAO,EAAE;AADkB,GA3FP;AA8FtB,0BAAwB;AACtByB,IAAAA,UAAU,EAAE,MADU;AAEtBC,IAAAA,KAAK,EAAE;AACL;AACAb,MAAAA,MAAM,EAAE,kCAFH;AAGLT,MAAAA,OAAO,EAAE;AAHJ;AAFe,GA9FF;AAsGtB,8BAA4B;AAC1BuB,IAAAA,UAAU,EAAE,mBADc;AACO;AACjCF,IAAAA,UAAU,EAAE;AAFc,GAtGN;AA0GtB,8BAA4B;AAC1BE,IAAAA,UAAU,EAAE,mBADc;AACO;AACjCF,IAAAA,UAAU,EAAE;AAFc,GA1GN;AA8GtB,yBAAuB;AACrBJ,IAAAA,cAAc,EAAE,WADK;AAErBZ,IAAAA,MAAM,EAAE,iBAFa;AAEM;AAC3BJ,IAAAA,KAAK,EAAE,iBAHc,CAGI;;AAHJ,GA9GD;AAmHtB,8BAA4B;AAC1BA,IAAAA,KAAK,EAAE;AADmB;AAnHN,CAAjB","sourcesContent":["export const styleMap = {\n 'header-user-menu': {\n },\n 'header-user-menu__link': {\n background: 'none',\n border: '0',\n color: 'black',\n cursor: 'pointer',\n display: 'block',\n fontFamily: 'Arial',\n fontSize: '1em',\n textAlign: 'left',\n padding: '1em',\n width: '100%',\n '&:focus, &:hover': {\n backgroundColor: 'linear-gradient(to right, #7C4DFF 0%, #18A9E6 50%, #01C9EA 100%)'\n // backgroundColor: '#eee'\n },\n a: {\n textDecoration: 'none'\n }\n },\n 'header-user-menu__trigger': {\n background: 'none',\n border: '0',\n cursor: 'pointer',\n width: '60px', // defined in mashlib as a SASS variable $icon_size\n height: '60px', // defined in mashlib as a SASS variable $icon_size\n img: {\n borderRadius: '50%',\n height: '56px', // defined in mashlib as a SASS variable $icon_size - 4px\n width: '56px'\n }\n },\n 'header-user-menu__button': {\n background: 'none',\n border: '0',\n color: 'black',\n cursor: 'pointer',\n display: 'block',\n fontFamily: 'Arial',\n fontSize: '1em',\n textAlign: 'left',\n padding: '1em',\n width: '100%',\n '&:focus, &:hover': {\n backgroundColor: 'linear-gradient(to right, #7C4DFF 0%, #18A9E6 50%, #01C9EA 100%)'\n }\n },\n 'header-user-menu__list': {\n listStyle: 'none',\n margin: '0',\n padding: '0'\n },\n 'header-user-menu__navigation-menu': {\n background: 'white',\n border: 'solid 1px #000000', // the color was defined in mashlib as a SASS variable $divider_color\n borderRight: '0',\n position: 'absolute',\n right: '0',\n top: '60px', // defined in mashlib as a SASS variable $icon_size\n width: '200px',\n 'z-index': '1',\n '&[aria-hidden = true]': {\n display: 'none'\n }\n },\n 'header-user-menu__list-item': {\n borderBottom: 'solid 1px #000000', // the color was defined in mashlib as a SASS variable $divider_color\n '&:last-child': {\n border: '0'\n }\n },\n 'header-user-menu__photo': {\n borderRadius: '50%',\n backgroundPosition: 'center',\n backgroundRepeat: 'no-repeat',\n backgroundSize: 'cover',\n height: '50px', // $icon-size - $image-margin * 2 image-margin was 5px in mashlib and icon size 60px\n width: '50px'\n },\n 'header-banner': {\n boxShadow: '0px 1px 4px #000000', // the color was defined in mashlib as a SASS variable $divider_color\n display: 'flex',\n justifyContent: 'space-between',\n padding: '0 1.5em',\n marginBottom: '4px'\n },\n 'header-banner__link': {\n display: 'block'\n },\n 'header-banner__right-menu': {\n display: 'flex'\n },\n 'header-banner__login': {\n marginLeft: 'auto',\n input: {\n // hacks to override the default style of login and signup button from solid-ui\n margin: '0.75em 0 0.75em 0.5em !important',\n padding: '0.5em !important'\n }\n },\n 'header-banner__user-menu': {\n borderLeft: 'solid 1px #000000', // the color was defined in mashlib as a SASS variable $divider_color\n marginLeft: 'auto'\n },\n 'header-banner__help-menu': {\n borderLeft: 'solid 1px #000000', // the color was defined in mashlib as a SASS variable $divider_color\n marginLeft: 'auto'\n },\n 'header-banner__icon': {\n backgroundSize: '65px 60px',\n height: '60px !important', // this is the icon size\n width: '65px !important' // may just be 65px round($icon-size * 352 / 322);\n },\n 'header-banner__help-icon': {\n width: '28px !important'\n }\n}\n"],"file":"styleMap.js"}
|
package/lib/index.d.ts
CHANGED
|
@@ -30,7 +30,8 @@ import * as utils from './utils';
|
|
|
30
30
|
import * as widgets from './widgets/index';
|
|
31
31
|
import versionInfo from './versionInfo';
|
|
32
32
|
import { initHeader } from './header';
|
|
33
|
+
import { initFooter } from './footer';
|
|
33
34
|
declare const dom: Document | null;
|
|
34
35
|
declare const store: import("solid-logic").LiveStore;
|
|
35
|
-
export { ns, rdf, acl, aclControl, authn, create, dom, icons, language, log, matrix, media, messageArea, infiniteMessageArea, pad, participation, preferences, solidLogicSingleton, store, style, table, tabs, utils, widgets, versionInfo, initHeader };
|
|
36
|
+
export { ns, rdf, acl, aclControl, authn, create, dom, icons, language, log, matrix, media, messageArea, infiniteMessageArea, pad, participation, preferences, solidLogicSingleton, store, style, table, tabs, utils, widgets, versionInfo, initHeader, initFooter };
|
|
36
37
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA2BA;;;;GAIG;AAEH;;;GAGG;AAGH,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAA;AAE7B,OAAO,KAAK,EAAE,MAAM,MAAM,CAAA;AAC1B,OAAO,EAAE,GAAG,EAAE,UAA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