solid-ui 2.4.14 → 2.4.15-2b5b280a
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 -2
- package/lib/acl/access-groups.d.ts.map +1 -1
- package/lib/acl/access-groups.js +4 -1
- package/lib/acl/access-groups.js.map +1 -1
- package/lib/acl/acl.d.ts +1 -2
- package/lib/acl/acl.d.ts.map +1 -1
- package/lib/acl/acl.js +6 -2
- package/lib/acl/acl.js.map +1 -1
- package/lib/chat/bookmarks.js +14 -13
- package/lib/chat/bookmarks.js.map +1 -1
- package/lib/chat/chatLogic.js +340 -0
- package/lib/chat/chatLogic.js.map +1 -0
- package/lib/chat/dateFolder.js +12 -12
- package/lib/chat/dateFolder.js.map +1 -1
- package/lib/chat/infinite.js +285 -665
- package/lib/chat/infinite.js.map +1 -1
- package/lib/chat/message.js +445 -71
- package/lib/chat/message.js.map +1 -1
- package/lib/chat/messageTools.js +165 -103
- package/lib/chat/messageTools.js.map +1 -1
- package/lib/chat/thread.js +162 -32
- package/lib/chat/thread.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 +81 -69
- 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 +3 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +10 -1
- package/lib/index.js.map +1 -1
- package/lib/logic.d.ts +2 -2
- package/lib/logic.d.ts.map +1 -1
- package/lib/logic.js +16 -12
- package/lib/logic.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 +4 -4
- package/lib/versionInfo.js.map +1 -1
- package/lib/webpack-bundle.js +18277 -1190
- package/lib/webpack-bundle.js.map +1 -1
- package/lib/widgets/buttons.d.ts.map +1 -1
- package/lib/widgets/buttons.js +8 -1
- package/lib/widgets/buttons.js.map +1 -1
- package/lib/widgets/forms/autocomplete/autocompleteField.js +9 -5
- package/lib/widgets/forms/autocomplete/autocompleteField.js.map +1 -1
- package/lib/widgets/forms/autocomplete/language.js +3 -1
- package/lib/widgets/forms/autocomplete/language.js.map +1 -1
- package/lib/widgets/forms/autocomplete/publicData.js +15 -8
- package/lib/widgets/forms/autocomplete/publicData.js.map +1 -1
- package/package.json +5 -4
- package/lib/header/headerHelpers.d.ts.map +0 -1
- package/lib/header/headerHelpers.js +0 -96
- package/lib/header/headerHelpers.js.map +0 -1
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.createControllerInfoBlock = createControllerInfoBlock;
|
|
9
|
+
exports.initFooter = initFooter;
|
|
10
|
+
exports.rebuildFooter = rebuildFooter;
|
|
11
|
+
|
|
12
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
13
|
+
|
|
14
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
15
|
+
|
|
16
|
+
var _authn = require("../authn/authn");
|
|
17
|
+
|
|
18
|
+
var _headerFooterHelpers = require("../utils/headerFooterHelpers");
|
|
19
|
+
|
|
20
|
+
/*
|
|
21
|
+
This file was copied from mashlib/src/global/footer.ts file. It is modified to
|
|
22
|
+
work in solid-ui by adjusting where imported functions are found.
|
|
23
|
+
*/
|
|
24
|
+
var DEFAULT_SOLID_PROJECT_URL = 'https://solidproject.org';
|
|
25
|
+
var DEFAULT_SOLID_PROJECT_NAME = 'solidproject.org';
|
|
26
|
+
/*
|
|
27
|
+
FooterOptions allow for customizing the link and name of the link part of the footer.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Initialize footer component, the footer object returned depends on whether the user is authenticated.
|
|
32
|
+
* @param store the data store
|
|
33
|
+
* @returns the footer
|
|
34
|
+
*/
|
|
35
|
+
function initFooter(_x, _x2) {
|
|
36
|
+
return _initFooter.apply(this, arguments);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @ignore exporting this only for the unit test
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
function _initFooter() {
|
|
44
|
+
_initFooter = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(store, options) {
|
|
45
|
+
var footer, pod, podOwner;
|
|
46
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
47
|
+
while (1) {
|
|
48
|
+
switch (_context2.prev = _context2.next) {
|
|
49
|
+
case 0:
|
|
50
|
+
footer = document.getElementById('PageFooter');
|
|
51
|
+
|
|
52
|
+
if (footer) {
|
|
53
|
+
_context2.next = 3;
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return _context2.abrupt("return");
|
|
58
|
+
|
|
59
|
+
case 3:
|
|
60
|
+
pod = (0, _headerFooterHelpers.getPod)();
|
|
61
|
+
_context2.next = 6;
|
|
62
|
+
return (0, _headerFooterHelpers.getPodOwner)(pod, store);
|
|
63
|
+
|
|
64
|
+
case 6:
|
|
65
|
+
podOwner = _context2.sent;
|
|
66
|
+
rebuildFooter(footer, store, pod, podOwner, options)();
|
|
67
|
+
|
|
68
|
+
_authn.authSession.onLogin(rebuildFooter(footer, store, pod, podOwner, options));
|
|
69
|
+
|
|
70
|
+
_authn.authSession.onLogout(rebuildFooter(footer, store, pod, podOwner, options));
|
|
71
|
+
|
|
72
|
+
case 10:
|
|
73
|
+
case "end":
|
|
74
|
+
return _context2.stop();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}, _callee2);
|
|
78
|
+
}));
|
|
79
|
+
return _initFooter.apply(this, arguments);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function rebuildFooter(footer, store, pod, podOwner, options) {
|
|
83
|
+
return /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
84
|
+
var user;
|
|
85
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
86
|
+
while (1) {
|
|
87
|
+
switch (_context.prev = _context.next) {
|
|
88
|
+
case 0:
|
|
89
|
+
user = (0, _authn.currentUser)();
|
|
90
|
+
footer.innerHTML = '';
|
|
91
|
+
_context.t0 = footer;
|
|
92
|
+
_context.next = 5;
|
|
93
|
+
return createControllerInfoBlock(store, user, pod, podOwner, options);
|
|
94
|
+
|
|
95
|
+
case 5:
|
|
96
|
+
_context.t1 = _context.sent;
|
|
97
|
+
|
|
98
|
+
_context.t0.appendChild.call(_context.t0, _context.t1);
|
|
99
|
+
|
|
100
|
+
case 7:
|
|
101
|
+
case "end":
|
|
102
|
+
return _context.stop();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}, _callee);
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* @ignore exporting this only for the unit test
|
|
110
|
+
*/
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
function createControllerInfoBlock(store, user, pod, podOwner, options) {
|
|
114
|
+
var profileLinkContainer = document.createElement('div');
|
|
115
|
+
|
|
116
|
+
if (!pod || !podOwner || user && user.equals(podOwner)) {
|
|
117
|
+
return profileLinkContainer;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
(0, _headerFooterHelpers.addStyleClassToElement)(profileLinkContainer, ['footer-pod-info', 'footer'], 'footer');
|
|
121
|
+
var podLinkPre = document.createElement('span');
|
|
122
|
+
podLinkPre.innerText = "You're visiting ";
|
|
123
|
+
var podLink = document.createElement('a');
|
|
124
|
+
podLink.href = pod.uri;
|
|
125
|
+
podLink.innerText = 'the Pod';
|
|
126
|
+
var profileLinkPre = document.createElement('span');
|
|
127
|
+
profileLinkPre.innerText = ' controlled by ';
|
|
128
|
+
var profileLink = document.createElement('a');
|
|
129
|
+
profileLink.href = podOwner.uri;
|
|
130
|
+
profileLink.innerText = (0, _headerFooterHelpers.getName)(store, podOwner);
|
|
131
|
+
var solidProjectLinkPre = document.createElement('span');
|
|
132
|
+
solidProjectLinkPre.innerText = '. For more info, check out ';
|
|
133
|
+
var solidProjectLink = document.createElement('a');
|
|
134
|
+
solidProjectLink.href = options && options.solidProjectUrl ? options.solidProjectUrl : DEFAULT_SOLID_PROJECT_URL;
|
|
135
|
+
solidProjectLink.innerText = options && options.solidProjectName ? options.solidProjectName : DEFAULT_SOLID_PROJECT_NAME;
|
|
136
|
+
var solidProjectLinkPost = document.createElement('span');
|
|
137
|
+
solidProjectLinkPost.innerText = '.';
|
|
138
|
+
profileLinkContainer.appendChild(podLinkPre);
|
|
139
|
+
profileLinkContainer.appendChild(podLink);
|
|
140
|
+
profileLinkContainer.appendChild(profileLinkPre);
|
|
141
|
+
profileLinkContainer.appendChild(profileLink);
|
|
142
|
+
profileLinkContainer.appendChild(solidProjectLinkPre);
|
|
143
|
+
profileLinkContainer.appendChild(solidProjectLink);
|
|
144
|
+
profileLinkContainer.appendChild(solidProjectLinkPost);
|
|
145
|
+
return profileLinkContainer;
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/footer/index.ts"],"names":["DEFAULT_SOLID_PROJECT_URL","DEFAULT_SOLID_PROJECT_NAME","initFooter","store","options","footer","document","getElementById","pod","podOwner","rebuildFooter","authSession","onLogin","onLogout","user","innerHTML","createControllerInfoBlock","appendChild","profileLinkContainer","createElement","equals","podLinkPre","innerText","podLink","href","uri","profileLinkPre","profileLink","solidProjectLinkPre","solidProjectLink","solidProjectUrl","solidProjectName","solidProjectLinkPost"],"mappings":";;;;;;;;;;;;;;;AAKA;;AACA;;AANA;AACA;AACA;AACA;AAKA,IAAMA,yBAAyB,GAAG,0BAAlC;AACA,IAAMC,0BAA0B,GAAG,kBAAnC;AAEA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;SACsBC,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;AAKCG,YAAAA,GALD,GAKO,kCALP;AAAA;AAAA,mBAMkB,sCAAYA,GAAZ,EAAiBL,KAAjB,CANlB;;AAAA;AAMCM,YAAAA,QAND;AAOLC,YAAAA,aAAa,CAACL,MAAD,EAASF,KAAT,EAAgBK,GAAhB,EAAqBC,QAArB,EAA+BL,OAA/B,CAAb;;AACAO,+BAAYC,OAAZ,CAAoBF,aAAa,CAACL,MAAD,EAASF,KAAT,EAAgBK,GAAhB,EAAqBC,QAArB,EAA+BL,OAA/B,CAAjC;;AACAO,+BAAYE,QAAZ,CAAqBH,aAAa,CAACL,MAAD,EAASF,KAAT,EAAgBK,GAAhB,EAAqBC,QAArB,EAA+BL,OAA/B,CAAlC;;AATK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G;;;;AAcA,SAASM,aAAT,CAAwBL,MAAxB,EAA6CF,KAA7C,EAAoEK,GAApE,EAA2FC,QAA3F,EAAuHL,OAAvH,EAAgJ;AACrJ,oGAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AACCU,YAAAA,IADD,GACQ,yBADR;AAELT,YAAAA,MAAM,CAACU,SAAP,GAAmB,EAAnB;AAFK,0BAGLV,MAHK;AAAA;AAAA,mBAGoBW,yBAAyB,CAACb,KAAD,EAAQW,IAAR,EAAcN,GAAd,EAAmBC,QAAnB,EAA6BL,OAA7B,CAH7C;;AAAA;AAAA;;AAAA,wBAGEa,WAHF;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAAP;AAKD;AACD;AACA;AACA;;;AACO,SAASD,yBAAT,CAAoCb,KAApC,EAA2DW,IAA3D,EAAmFN,GAAnF,EAA0GC,QAA1G,EAAsIL,OAAtI,EAA4K;AACjL,MAAMc,oBAAoB,GAAGZ,QAAQ,CAACa,aAAT,CAAuB,KAAvB,CAA7B;;AACA,MAAI,CAACX,GAAD,IAAQ,CAACC,QAAT,IAAsBK,IAAI,IAAIA,IAAI,CAACM,MAAL,CAAYX,QAAZ,CAAlC,EAA0D;AACxD,WAAOS,oBAAP;AACD;;AAED,mDAAuBA,oBAAvB,EAA6C,CAAC,iBAAD,EAAoB,QAApB,CAA7C,EAA4E,QAA5E;AAEA,MAAMG,UAAU,GAAGf,QAAQ,CAACa,aAAT,CAAuB,MAAvB,CAAnB;AACAE,EAAAA,UAAU,CAACC,SAAX,GAAuB,kBAAvB;AAEA,MAAMC,OAAO,GAAGjB,QAAQ,CAACa,aAAT,CAAuB,GAAvB,CAAhB;AACAI,EAAAA,OAAO,CAACC,IAAR,GAAehB,GAAG,CAACiB,GAAnB;AACAF,EAAAA,OAAO,CAACD,SAAR,GAAoB,SAApB;AAEA,MAAMI,cAAc,GAAGpB,QAAQ,CAACa,aAAT,CAAuB,MAAvB,CAAvB;AACAO,EAAAA,cAAc,CAACJ,SAAf,GAA2B,iBAA3B;AAEA,MAAMK,WAAW,GAAGrB,QAAQ,CAACa,aAAT,CAAuB,GAAvB,CAApB;AACAQ,EAAAA,WAAW,CAACH,IAAZ,GAAmBf,QAAQ,CAACgB,GAA5B;AACAE,EAAAA,WAAW,CAACL,SAAZ,GAAwB,kCAAQnB,KAAR,EAAeM,QAAf,CAAxB;AAEA,MAAMmB,mBAAmB,GAAGtB,QAAQ,CAACa,aAAT,CAAuB,MAAvB,CAA5B;AACAS,EAAAA,mBAAmB,CAACN,SAApB,GAAgC,6BAAhC;AAEA,MAAMO,gBAAgB,GAAGvB,QAAQ,CAACa,aAAT,CAAuB,GAAvB,CAAzB;AACAU,EAAAA,gBAAgB,CAACL,IAAjB,GAAwBpB,OAAO,IAAIA,OAAO,CAAC0B,eAAnB,GAAqC1B,OAAO,CAAC0B,eAA7C,GAA+D9B,yBAAvF;AACA6B,EAAAA,gBAAgB,CAACP,SAAjB,GAA6BlB,OAAO,IAAIA,OAAO,CAAC2B,gBAAnB,GAAsC3B,OAAO,CAAC2B,gBAA9C,GAAiE9B,0BAA9F;AAEA,MAAM+B,oBAAoB,GAAG1B,QAAQ,CAACa,aAAT,CAAuB,MAAvB,CAA7B;AACAa,EAAAA,oBAAoB,CAACV,SAArB,GAAiC,GAAjC;AAEAJ,EAAAA,oBAAoB,CAACD,WAArB,CAAiCI,UAAjC;AACAH,EAAAA,oBAAoB,CAACD,WAArB,CAAiCM,OAAjC;AACAL,EAAAA,oBAAoB,CAACD,WAArB,CAAiCS,cAAjC;AACAR,EAAAA,oBAAoB,CAACD,WAArB,CAAiCU,WAAjC;AACAT,EAAAA,oBAAoB,CAACD,WAArB,CAAiCW,mBAAjC;AACAV,EAAAA,oBAAoB,CAACD,WAArB,CAAiCY,gBAAjC;AACAX,EAAAA,oBAAoB,CAACD,WAArB,CAAiCe,oBAAjC;AAEA,SAAOd,oBAAP;AACD","sourcesContent":["/*\n This file was copied from mashlib/src/global/footer.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 { authSession, currentUser } from '../authn/authn'\nimport { addStyleClassToElement, getName, getPod, getPodOwner } from '../utils/headerFooterHelpers'\n\nconst DEFAULT_SOLID_PROJECT_URL = 'https://solidproject.org'\nconst DEFAULT_SOLID_PROJECT_NAME = 'solidproject.org'\n\n/*\n FooterOptions allow for customizing the link and name of the link part of the footer.\n */\nexport type FooterOptions = {\n solidProjectUrl?: string,\n solidProjectName?: string\n }\n\n/**\n * Initialize footer component, the footer object returned depends on whether the user is authenticated.\n * @param store the data store\n * @returns the footer\n */\nexport async function initFooter (store: IndexedFormula, options?: FooterOptions) {\n const footer = document.getElementById('PageFooter')\n if (!footer) {\n return\n }\n const pod = getPod()\n const podOwner = await getPodOwner(pod, store)\n rebuildFooter(footer, store, pod, podOwner, options)()\n authSession.onLogin(rebuildFooter(footer, store, pod, podOwner, options))\n authSession.onLogout(rebuildFooter(footer, store, pod, podOwner, options))\n}\n/**\n * @ignore exporting this only for the unit test\n */\nexport function rebuildFooter (footer: HTMLElement, store: IndexedFormula, pod: NamedNode | null, podOwner: NamedNode | null, options?: FooterOptions) {\n return async () => {\n const user = currentUser()\n footer.innerHTML = ''\n footer.appendChild(await createControllerInfoBlock(store, user, pod, podOwner, options))\n }\n}\n/**\n * @ignore exporting this only for the unit test\n */\nexport function createControllerInfoBlock (store: IndexedFormula, user: NamedNode | null, pod: NamedNode | null, podOwner: NamedNode | null, options?: FooterOptions): HTMLElement {\n const profileLinkContainer = document.createElement('div')\n if (!pod || !podOwner || (user && user.equals(podOwner))) {\n return profileLinkContainer\n }\n\n addStyleClassToElement(profileLinkContainer, ['footer-pod-info', 'footer'], 'footer')\n\n const podLinkPre = document.createElement('span')\n podLinkPre.innerText = \"You're visiting \"\n\n const podLink = document.createElement('a')\n podLink.href = pod.uri\n podLink.innerText = 'the Pod'\n\n const profileLinkPre = document.createElement('span')\n profileLinkPre.innerText = ' controlled by '\n\n const profileLink = document.createElement('a')\n profileLink.href = podOwner.uri\n profileLink.innerText = getName(store, podOwner)\n\n const solidProjectLinkPre = document.createElement('span')\n solidProjectLinkPre.innerText = '. For more info, check out '\n\n const solidProjectLink = document.createElement('a')\n solidProjectLink.href = options && options.solidProjectUrl ? options.solidProjectUrl : DEFAULT_SOLID_PROJECT_URL\n solidProjectLink.innerText = options && options.solidProjectName ? options.solidProjectName : DEFAULT_SOLID_PROJECT_NAME\n\n const solidProjectLinkPost = document.createElement('span')\n solidProjectLinkPost.innerText = '.'\n\n profileLinkContainer.appendChild(podLinkPre)\n profileLinkContainer.appendChild(podLink)\n profileLinkContainer.appendChild(profileLinkPre)\n profileLinkContainer.appendChild(profileLink)\n profileLinkContainer.appendChild(solidProjectLinkPre)\n profileLinkContainer.appendChild(solidProjectLink)\n profileLinkContainer.appendChild(solidProjectLinkPost)\n\n return profileLinkContainer\n}\n"],"file":"index.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styleMap.d.ts","sourceRoot":"","sources":["../../src/footer/styleMap.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ;;;;;;CAMpB,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.styleMap = void 0;
|
|
7
|
+
var styleMap = {
|
|
8
|
+
footer: {
|
|
9
|
+
borderTop: 'solid 1px $divider-color',
|
|
10
|
+
fontSize: '0.9em',
|
|
11
|
+
padding: '0.5em 1.5em'
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
exports.styleMap = styleMap;
|
|
15
|
+
//# sourceMappingURL=styleMap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/footer/styleMap.ts"],"names":["styleMap","footer","borderTop","fontSize","padding"],"mappings":";;;;;;AAAO,IAAMA,QAAQ,GAAG;AACtBC,EAAAA,MAAM,EAAE;AACNC,IAAAA,SAAS,EAAE,0BADL;AAENC,IAAAA,QAAQ,EAAE,OAFJ;AAGNC,IAAAA,OAAO,EAAE;AAHH;AADc,CAAjB","sourcesContent":["export const styleMap = {\n footer: {\n borderTop: 'solid 1px $divider-color',\n fontSize: '0.9em',\n padding: '0.5em 1.5em'\n }\n}\n"],"file":"styleMap.js"}
|
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,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,SAAS,EAAE,CAAA;CAC3B,CAAA;AAED;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAE,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,OAAO,CAAC,EAAE,aAAa,iBAU1G;AACD;;GAEG;AACH,wBAAgB,aAAa,CAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,OAAO,CAAC,EAAE,aAAa,uBAM5I;AACD;;GAEG;AACH,wBAAsB,YAAY,CAAE,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,GAAG,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,WAAW,CAAC,CA+B3K;AACD;;GAEG;AACH,wBAAgB,cAAc,CAAE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,8BA8CjF;AACD;;GAEG;AACH,wBAAgB,wBAAwB,mBAKvC;AACD;;GAEG;AACH,wBAAgB,oBAAoB,CAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,kCAAkC,GAAG,WAAW,CAM7G;AACD;;GAEG;AACH,wBAAgB,kBAAkB,CAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,WAAW,CAO7F;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAqD7H;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAE,KAAK,EAAE,WAAW,GAAG,WAAW,CAKnE;AACD;;GAEG;AACH,wBAAgB,aAAa,CAAE,KAAK,EAAE,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
|
}
|
|
@@ -379,9 +391,9 @@ function getProfileImg(store, user) {
|
|
|
379
391
|
var profileUrl = null;
|
|
380
392
|
|
|
381
393
|
try {
|
|
382
|
-
|
|
394
|
+
profileUrl = widgets.findImage(user);
|
|
383
395
|
|
|
384
|
-
if (!
|
|
396
|
+
if (!profileUrl) {
|
|
385
397
|
return _emptyProfile.emptyProfile;
|
|
386
398
|
}
|
|
387
399
|
} catch (_unused) {
|
|
@@ -389,8 +401,8 @@ function getProfileImg(store, user) {
|
|
|
389
401
|
}
|
|
390
402
|
|
|
391
403
|
var profileImage = document.createElement('div');
|
|
392
|
-
(0,
|
|
393
|
-
profileImage.style.backgroundImage = "url(
|
|
404
|
+
(0, _headerFooterHelpers.addStyleClassToElement)(profileImage, ['header-user-menu__photo']);
|
|
405
|
+
profileImage.style.backgroundImage = "url(".concat(profileUrl, ")");
|
|
394
406
|
return profileImage;
|
|
395
407
|
}
|
|
396
408
|
/**
|