solid-panes 4.2.6 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -0
- package/dist/0314353e28ce6e5539af.svg +9 -0
- package/dist/04567ff683933c35c465.png +0 -0
- package/dist/10163fd9b5a0e00d63a0.png +0 -0
- package/dist/1234dcb2eec2e45f252b.png +0 -0
- package/dist/20899934157df4db56cb.png +0 -0
- package/dist/33760bf79f097f449da5.png +0 -0
- package/dist/4cceba29ab33b1ddd9bb.svg +6 -0
- package/dist/578d2b6ed32e7624164e.png +0 -0
- package/dist/5f62a5b2b7e99b9640c7.png +0 -0
- package/dist/6525766ecd288ec60129.png +0 -0
- package/dist/7800be6f6c4b5b0f4f20.png +0 -0
- package/dist/7b7538c6f6b317968009.svg +9 -0
- package/dist/92d03142abe6efc0b42d.svg +6 -0
- package/dist/976473cf5fe24d657d4b.png +0 -0
- package/dist/RDFXMLPane.js +1 -0
- package/dist/bda84f59e7216675a208.png +0 -0
- package/dist/cd68e8f3990ba8b2139e.png +0 -0
- package/dist/dashboard/basicPreferences.d.ts.map +1 -1
- package/dist/dashboard/basicPreferences.js +1 -0
- package/dist/dashboard/dashboardPane.d.ts.map +1 -1
- package/dist/dashboard/dashboardPane.js +9 -3
- package/dist/dashboard/homepage.d.ts +1 -1
- package/dist/dashboard/homepage.d.ts.map +1 -1
- package/dist/dashboard/homepage.js +5 -35
- package/dist/e7074a7e2cb69e51cfd3.png +0 -0
- package/dist/f3772696fb7ee53c23d8.png +0 -0
- package/dist/form/pane.js +1 -1
- package/dist/home/homePane.d.ts.map +1 -1
- package/dist/home/homePane.js +2 -0
- package/dist/humanReadablePane.js +34 -8
- package/dist/icons/clock.svg +7 -0
- package/dist/icons/comment.svg +6 -0
- package/dist/icons/dashboard.svg +9 -0
- package/dist/icons/downArrow.svg +6 -0
- package/dist/icons/folder.svg +6 -0
- package/dist/icons/friends.svg +9 -0
- package/dist/icons/help.svg +8 -0
- package/dist/icons/iconHelper.d.ts +2 -0
- package/dist/icons/iconHelper.d.ts.map +1 -0
- package/dist/icons/iconHelper.js +23 -0
- package/dist/icons/menu.svg +8 -0
- package/dist/icons/person.svg +6 -0
- package/dist/icons/personInCircle.svg +8 -0
- package/dist/icons/sharing.svg +10 -0
- package/dist/icons/signOut.svg +8 -0
- package/dist/icons/signup.png +0 -0
- package/dist/icons/star.svg +3 -0
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -4
- package/dist/internal/internalPane.d.ts.map +1 -1
- package/dist/internal/internalPane.js +1 -0
- package/dist/mainPage/footer.d.ts +14 -2
- package/dist/mainPage/footer.d.ts.map +1 -1
- package/dist/mainPage/footer.js +21 -13
- package/dist/mainPage/header.d.ts +16 -1
- package/dist/mainPage/header.d.ts.map +1 -1
- package/dist/mainPage/header.js +179 -61
- package/dist/mainPage/index.d.ts +15 -1
- package/dist/mainPage/index.d.ts.map +1 -1
- package/dist/mainPage/index.js +38 -7
- package/dist/mainPage/menu.css +243 -0
- package/dist/mainPage/menu.d.ts +7 -0
- package/dist/mainPage/menu.d.ts.map +1 -0
- package/dist/mainPage/menu.js +409 -0
- package/dist/n3Pane.js +1 -0
- package/dist/outline/context.d.ts +2 -2
- package/dist/outline/context.d.ts.map +1 -1
- package/dist/outline/context.js +5 -2
- package/dist/outline/manager.css +12 -14
- package/dist/outline/manager.js +152 -81
- package/dist/outline/userInput.js +6 -3
- package/dist/pad/padPane.css +36 -0
- package/dist/pad/padPane.d.ts +1 -0
- package/dist/pad/padPane.d.ts.map +1 -1
- package/dist/pad/padPane.js +32 -21
- package/dist/playlist/playlistPane.js +2 -6
- package/dist/profileUtils/ownerProfile.d.ts +5 -0
- package/dist/profileUtils/ownerProfile.d.ts.map +1 -0
- package/dist/profileUtils/ownerProfile.js +84 -0
- package/dist/registerPanes.js +4 -4
- package/dist/slideshow/slideshowPane.js +1 -1
- package/dist/social/editProfileDetails.d.ts +19 -0
- package/dist/social/editProfileDetails.d.ts.map +1 -0
- package/dist/social/editProfileDetails.js +267 -0
- package/dist/social/icons.d.ts +5 -0
- package/dist/social/icons.d.ts.map +1 -0
- package/dist/social/icons.js +60 -0
- package/dist/social/socialPane.css +804 -0
- package/dist/social/socialPane.d.ts +30 -0
- package/dist/social/socialPane.d.ts.map +1 -0
- package/dist/social/socialPane.js +558 -0
- package/dist/social/socialSections.d.ts +66 -0
- package/dist/social/socialSections.d.ts.map +1 -0
- package/dist/social/socialSections.js +317 -0
- package/dist/solid-panes.js +29050 -13866
- package/dist/solid-panes.js.map +1 -1
- package/dist/solid-panes.min.js +2235 -247
- package/dist/solid-panes.min.js.map +1 -1
- package/dist/style/tabbedtab.css +0 -124
- package/dist/tabbed/tabbedPane.d.ts.map +1 -1
- package/dist/tabbed/tabbedPane.js +2 -0
- package/dist/versionInfo.js +3 -3
- package/package.json +13 -8
- package/dist/socialPane.js +0 -430
package/dist/index.js
CHANGED
|
@@ -20,7 +20,7 @@ exports.getOutliner = getOutliner;
|
|
|
20
20
|
Object.defineProperty(exports, "initMainPage", {
|
|
21
21
|
enumerable: true,
|
|
22
22
|
get: function () {
|
|
23
|
-
return _mainPage.
|
|
23
|
+
return _mainPage.initMainPage;
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
26
|
Object.defineProperty(exports, "list", {
|
|
@@ -41,12 +41,19 @@ Object.defineProperty(exports, "paneForPredicate", {
|
|
|
41
41
|
return _paneRegistry.paneForPredicate;
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
|
+
Object.defineProperty(exports, "refreshUI", {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function () {
|
|
47
|
+
return _mainPage.refreshUI;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
44
50
|
Object.defineProperty(exports, "register", {
|
|
45
51
|
enumerable: true,
|
|
46
52
|
get: function () {
|
|
47
53
|
return _paneRegistry.register;
|
|
48
54
|
}
|
|
49
55
|
});
|
|
56
|
+
exports.updateEnvironment = updateEnvironment;
|
|
50
57
|
Object.defineProperty(exports, "versionInfo", {
|
|
51
58
|
enumerable: true,
|
|
52
59
|
get: function () {
|
|
@@ -61,7 +68,7 @@ var _manager = _interopRequireDefault(require("./outline/manager.js"));
|
|
|
61
68
|
var _registerPanes = require("./registerPanes.js");
|
|
62
69
|
var _paneRegistry = require("pane-registry");
|
|
63
70
|
var _context = require("./outline/context");
|
|
64
|
-
var _mainPage =
|
|
71
|
+
var _mainPage = require("./mainPage");
|
|
65
72
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
66
73
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
67
74
|
/* SOLID PANES
|
|
@@ -76,7 +83,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
76
83
|
** If it is relevant, then it returns a suitable tooltip for a control which selects the pane
|
|
77
84
|
*/
|
|
78
85
|
|
|
79
|
-
function getOutliner(dom) {
|
|
86
|
+
function getOutliner(dom, environment) {
|
|
80
87
|
if (!dom.outlineManager) {
|
|
81
88
|
const context = (0, _context.createContext)(dom, {
|
|
82
89
|
list: _paneRegistry.list,
|
|
@@ -84,11 +91,19 @@ function getOutliner(dom) {
|
|
|
84
91
|
paneForPredicate: _paneRegistry.paneForPredicate,
|
|
85
92
|
register: _paneRegistry.register,
|
|
86
93
|
byName: _paneRegistry.byName
|
|
87
|
-
}, _solidLogic.store, _solidLogic.solidLogicSingleton);
|
|
94
|
+
}, _solidLogic.store, _solidLogic.solidLogicSingleton, environment);
|
|
88
95
|
dom.outlineManager = new _manager.default(context);
|
|
96
|
+
} else if (environment) {
|
|
97
|
+
dom.outlineManager.context = dom.outlineManager.context || {};
|
|
98
|
+
dom.outlineManager.context.environment = environment;
|
|
89
99
|
}
|
|
90
100
|
return dom.outlineManager;
|
|
91
101
|
}
|
|
102
|
+
function updateEnvironment(outliner, environment) {
|
|
103
|
+
if (!outliner) return;
|
|
104
|
+
outliner.context = outliner.context || {};
|
|
105
|
+
outliner.context.environment = environment;
|
|
106
|
+
}
|
|
92
107
|
if (typeof window !== 'undefined') {
|
|
93
108
|
getOutliner(window.document);
|
|
94
109
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internalPane.d.ts","sourceRoot":"","sources":["../../src/internal/internalPane.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAE9C,QAAA,MAAM,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"internalPane.d.ts","sourceRoot":"","sources":["../../src/internal/internalPane.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAE9C,QAAA,MAAM,IAAI,EAAE,cAyOX,CAAA;AAiBD,eAAe,IAAI,CAAA"}
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import 'solid-ui/components/footer';
|
|
2
|
+
import type { LiveStore } from 'rdflib';
|
|
3
|
+
declare module 'solid-ui/components/footer';
|
|
4
|
+
import 'solid-ui/components/footer';
|
|
5
|
+
type FooterElement = HTMLElement & {
|
|
6
|
+
store?: LiveStore | null;
|
|
7
|
+
position?: 'static' | 'absolute' | 'relative' | 'fixed' | 'sticky';
|
|
8
|
+
top?: string;
|
|
9
|
+
right?: string;
|
|
10
|
+
bottom?: string;
|
|
11
|
+
left?: string;
|
|
12
|
+
};
|
|
13
|
+
export declare function createFooter(store: LiveStore): FooterElement;
|
|
14
|
+
export {};
|
|
3
15
|
//# sourceMappingURL=footer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"footer.d.ts","sourceRoot":"","sources":["../../src/mainPage/footer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"footer.d.ts","sourceRoot":"","sources":["../../src/mainPage/footer.ts"],"names":[],"mappings":"AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAEvC,OAAO,QAAQ,4BAA4B,CAAA;AAC3C,OAAO,4BAA4B,CAAA;AAEnC,KAAK,aAAa,GAAG,WAAW,GAAG;IACjC,KAAK,CAAC,EAAE,SAAS,GAAG,IAAI,CAAA;IACxB,QAAQ,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,UAAU,GAAG,OAAO,GAAG,QAAQ,CAAA;IAClE,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAED,wBAAgB,YAAY,CAAE,KAAK,EAAE,SAAS,iBAuB7C"}
|
package/dist/mainPage/footer.js
CHANGED
|
@@ -4,18 +4,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.createFooter = createFooter;
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* links in the footer
|
|
10
|
-
*/
|
|
11
|
-
const SOLID_PROJECT_URL = 'https://solidproject.org';
|
|
12
|
-
const SOLID_PROJECT_NAME = 'solidproject.org';
|
|
7
|
+
require("solid-ui/components/footer");
|
|
13
8
|
function createFooter(store) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
9
|
+
let footer = document.querySelector('solid-ui-footer');
|
|
10
|
+
if (!footer) {
|
|
11
|
+
footer = document.createElement('solid-ui-footer');
|
|
12
|
+
footer.className = 'menu-footer';
|
|
13
|
+
footer.style.position = 'static';
|
|
14
|
+
footer.style.width = '100%';
|
|
15
|
+
const navMenu = document.getElementById('NavMenu');
|
|
16
|
+
if (navMenu) {
|
|
17
|
+
navMenu.appendChild(footer);
|
|
18
|
+
} else {
|
|
19
|
+
document.body.appendChild(footer);
|
|
20
|
+
}
|
|
21
|
+
} else {
|
|
22
|
+
const navMenu = document.getElementById('NavMenu');
|
|
23
|
+
if (navMenu && footer.parentElement !== navMenu) {
|
|
24
|
+
navMenu.appendChild(footer);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
footer.store = store;
|
|
28
|
+
return footer;
|
|
21
29
|
}
|
|
@@ -1,2 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
import 'solid-ui/components/header';
|
|
2
|
+
import { Header } from 'solid-ui/components/header';
|
|
3
|
+
import { OutlineManager } from '../outline/manager';
|
|
4
|
+
import { LiveStore } from 'rdflib';
|
|
5
|
+
export declare const HELP_MENU_LIST: {
|
|
6
|
+
label: string;
|
|
7
|
+
url: string;
|
|
8
|
+
target: string;
|
|
9
|
+
}[];
|
|
10
|
+
type ManagedHeader = Header & {
|
|
11
|
+
__solidPanesListenersAttached?: boolean;
|
|
12
|
+
__solidPanesOutliner?: OutlineManager;
|
|
13
|
+
};
|
|
14
|
+
export declare function createHeader(store: LiveStore, outliner: OutlineManager): Promise<ManagedHeader>;
|
|
15
|
+
export declare function refreshHeader(outliner: OutlineManager, headerElement?: Header): Promise<Header | null>;
|
|
16
|
+
export {};
|
|
2
17
|
//# sourceMappingURL=header.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../src/mainPage/header.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../src/mainPage/header.ts"],"names":[],"mappings":"AAEA,OAAO,4BAA4B,CAAA;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAEnD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AA4BlC,eAAO,MAAM,cAAc;;;;GAG1B,CAAA;AAID,KAAK,aAAa,GAAG,MAAM,GAAG;IAC5B,6BAA6B,CAAC,EAAE,OAAO,CAAA;IACvC,oBAAoB,CAAC,EAAE,cAAc,CAAA;CACtC,CAAA;AAcD,wBAAsB,YAAY,CAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,0BA6B7E;AAoDD,wBAAsB,aAAa,CAAE,QAAQ,EAAE,cAAc,EAAE,aAAa,CAAC,EAAE,MAAM,0BAyBpF"}
|
package/dist/mainPage/header.js
CHANGED
|
@@ -3,83 +3,201 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.HELP_MENU_LIST = void 0;
|
|
6
7
|
exports.createHeader = createHeader;
|
|
8
|
+
exports.refreshHeader = refreshHeader;
|
|
7
9
|
var _solidLogic = require("solid-logic");
|
|
8
10
|
var _solidUi = require("solid-ui");
|
|
11
|
+
require("solid-ui/components/header");
|
|
12
|
+
var _help = _interopRequireDefault(require("../icons/help.svg?raw"));
|
|
13
|
+
var _person = _interopRequireDefault(require("../icons/person.svg?raw"));
|
|
14
|
+
var _signOut = _interopRequireDefault(require("../icons/signOut.svg?raw"));
|
|
15
|
+
var _personInCircle = _interopRequireDefault(require("../icons/personInCircle.svg?raw"));
|
|
16
|
+
var _downArrow = _interopRequireDefault(require("../icons/downArrow.svg?raw"));
|
|
17
|
+
var _signup = _interopRequireDefault(require("../icons/signup.png"));
|
|
18
|
+
var _iconHelper = require("../icons/iconHelper");
|
|
19
|
+
var _menu = require("./menu");
|
|
20
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
21
|
/**
|
|
10
22
|
* menu icons
|
|
11
23
|
*/
|
|
12
|
-
const HELP_MENU_ICON =
|
|
24
|
+
const HELP_MENU_ICON = (0, _iconHelper.createUiIcon)(_help.default, 'Help Icon', '#ffffff');
|
|
25
|
+
const LOGIN_ICON = (0, _iconHelper.createUiIcon)(_person.default, 'LogIn Icon', '#ffffff');
|
|
26
|
+
const SIGNUP_ICON = _signup.default;
|
|
27
|
+
const LOGOUT_ICON = (0, _iconHelper.createUiIcon)(_signOut.default, 'LogOut Icon', '#000000');
|
|
28
|
+
const DEFAULT_AVATAR_ICON = (0, _iconHelper.createUiIcon)(_personInCircle.default, 'Default Avatar Icon', '#6A7282');
|
|
29
|
+
const DOWN_ARROW_ICON = (0, _iconHelper.createUiIcon)(_downArrow.default, 'Down Arrow Icon', '#ffffff');
|
|
13
30
|
const SOLID_ICON_URL = 'https://solidproject.org/assets/img/solid-emblem.svg';
|
|
14
|
-
|
|
15
31
|
/**
|
|
16
32
|
* menu elements
|
|
17
33
|
*/
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
34
|
+
const SIGN_IN_MENU_ITEM = 'Log In';
|
|
35
|
+
const SIGN_OUT_MENU_ITEM = 'Log Out';
|
|
36
|
+
const SIGN_UP_MENU_ITEM = 'Sign Up';
|
|
37
|
+
const SIGN_UP__MENU_LINK = 'https://solidproject.org/get_a_pod';
|
|
38
|
+
|
|
39
|
+
// data structure extracted for solid-ui-header binding
|
|
40
|
+
const HELP_MENU_LIST = exports.HELP_MENU_LIST = [{
|
|
41
|
+
label: 'User guide',
|
|
42
|
+
url: 'https://solidos.github.io/userguide/',
|
|
43
|
+
target: '_blank'
|
|
44
|
+
}, {
|
|
45
|
+
label: 'Report a problem',
|
|
46
|
+
url: 'https://github.com/solidos/solidos/issues',
|
|
47
|
+
target: '_blank'
|
|
48
|
+
}];
|
|
49
|
+
const HEADER_MOBILE_STYLE_ID = 'solid-ui-header-mobile-style';
|
|
50
|
+
function ensureMobileHeaderStyles() {
|
|
51
|
+
if (document.getElementById(HEADER_MOBILE_STYLE_ID)) return;
|
|
52
|
+
const style = document.createElement('style');
|
|
53
|
+
style.id = HEADER_MOBILE_STYLE_ID;
|
|
54
|
+
style.textContent = `
|
|
55
|
+
solid-ui-header[layout="mobile"]::part(logo) {
|
|
56
|
+
display: none !important;
|
|
57
|
+
}
|
|
58
|
+
`;
|
|
59
|
+
document.head.appendChild(style);
|
|
60
|
+
}
|
|
27
61
|
async function createHeader(store, outliner) {
|
|
28
|
-
(
|
|
62
|
+
ensureMobileHeaderStyles();
|
|
63
|
+
const header = document.querySelector('solid-ui-header') || document.createElement('solid-ui-header');
|
|
64
|
+
const isNewHeader = !header.isConnected;
|
|
65
|
+
if (!header.id) {
|
|
66
|
+
header.id = 'mainSolidUiHeader';
|
|
67
|
+
}
|
|
68
|
+
header.__solidPanesOutliner = outliner;
|
|
69
|
+
|
|
70
|
+
// ensure it is in DOM (before MainContent for consistency)
|
|
71
|
+
const main = document.getElementById('MainContent');
|
|
72
|
+
if (!header.isConnected) {
|
|
73
|
+
if (main && main.parentNode) {
|
|
74
|
+
main.parentNode.insertBefore(header, main);
|
|
75
|
+
} else {
|
|
76
|
+
document.body.prepend(header);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
await refreshHeader(outliner, header);
|
|
80
|
+
if (isNewHeader) {
|
|
81
|
+
header.__solidPanesListenersAttached = false;
|
|
82
|
+
}
|
|
83
|
+
attachHeaderListeners(header);
|
|
84
|
+
return header;
|
|
29
85
|
}
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
86
|
+
function attachHeaderListeners(header) {
|
|
87
|
+
if (header.__solidPanesListenersAttached) return;
|
|
88
|
+
const refreshCurrentHeader = async () => {
|
|
89
|
+
const outliner = header.__solidPanesOutliner;
|
|
90
|
+
if (!outliner) return;
|
|
91
|
+
await refreshHeader(outliner, header);
|
|
92
|
+
};
|
|
93
|
+
_solidLogic.authSession.events.on('login', refreshCurrentHeader);
|
|
94
|
+
_solidLogic.authSession.events.on('logout', refreshCurrentHeader);
|
|
95
|
+
_solidLogic.authSession.events.on('sessionRestore', refreshCurrentHeader);
|
|
96
|
+
header.addEventListener('auth-action-select', async e => {
|
|
97
|
+
const outliner = header.__solidPanesOutliner;
|
|
98
|
+
if (!outliner) return;
|
|
99
|
+
const detail = e.detail;
|
|
100
|
+
if (detail?.role === 'login') {
|
|
101
|
+
await refreshCurrentHeader();
|
|
102
|
+
// Do not auto-open the profile pane after login.
|
|
103
|
+
// outliner.showDashboard({ pane: 'profile' })
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
header.addEventListener('signup-success', async () => {
|
|
107
|
+
// do nothing
|
|
108
|
+
});
|
|
109
|
+
header.addEventListener('account-menu-select', async e => {
|
|
110
|
+
const outliner = header.__solidPanesOutliner;
|
|
111
|
+
if (!outliner) return;
|
|
112
|
+
const detail = e.detail;
|
|
113
|
+
if (detail?.action === 'logout') {
|
|
114
|
+
await refreshCurrentHeader();
|
|
115
|
+
// Do not navigate to the profile after logout.
|
|
116
|
+
} else if (detail?.action === 'show-profile') {
|
|
117
|
+
// TODO see if this can be consolidated
|
|
118
|
+
const currentUser = _solidLogic.authn.currentUser();
|
|
119
|
+
if (currentUser) {
|
|
120
|
+
outliner.showDashboard(currentUser, {
|
|
121
|
+
pane: 'profile'
|
|
122
|
+
});
|
|
123
|
+
(0, _menu.setActiveMenuPane)('profile');
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
header.__solidPanesListenersAttached = true;
|
|
128
|
+
}
|
|
129
|
+
async function refreshHeader(outliner, headerElement) {
|
|
130
|
+
ensureMobileHeaderStyles();
|
|
131
|
+
const headerOptions = setHeaderOptions(outliner);
|
|
132
|
+
const header = headerElement || document.querySelector('solid-ui-header');
|
|
133
|
+
if (!header) return null;
|
|
134
|
+
header.theme = headerOptions.theme;
|
|
135
|
+
header.layout = headerOptions.layout;
|
|
136
|
+
header.brandLink = headerOptions.brandLink;
|
|
137
|
+
header.logo = headerOptions.layout === 'desktop' ? headerOptions.logo : '';
|
|
138
|
+
header.helpIcon = headerOptions.helpIcon;
|
|
139
|
+
header.helpMenuList = headerOptions.helpMenuList;
|
|
140
|
+
header.authState = headerOptions.authState;
|
|
141
|
+
header.loginAction = headerOptions.loginAction;
|
|
142
|
+
header.signUpAction = headerOptions.signUpAction;
|
|
143
|
+
header.accountMenu = await setUserMenu();
|
|
144
|
+
header.logoutLabel = headerOptions.logoutLabel;
|
|
145
|
+
header.accountIcon = headerOptions.accountIcon;
|
|
146
|
+
header.accountAvatar = headerOptions.accountAvatar;
|
|
147
|
+
header.accountAvatarFallback = headerOptions.accountAvatarFallback;
|
|
148
|
+
header.loginIcon = headerOptions.loginIcon;
|
|
149
|
+
header.signUpIcon = headerOptions.signUpIcon;
|
|
150
|
+
header.logoutIcon = headerOptions.logoutIcon;
|
|
151
|
+
return header;
|
|
152
|
+
}
|
|
153
|
+
function setHeaderOptions(outliner) {
|
|
154
|
+
const currentUser = _solidLogic.authn.currentUser();
|
|
155
|
+
const isAuthenticated = !!currentUser;
|
|
156
|
+
const authState = isAuthenticated ? 'logged-in' : 'logged-out';
|
|
157
|
+
const layout = outliner.context?.environment?.layout === 'mobile' ? 'mobile' : 'desktop';
|
|
158
|
+
const theme = outliner.context?.environment?.theme === 'dark' ? 'dark' : 'light';
|
|
40
159
|
const headerOptions = {
|
|
41
160
|
logo: SOLID_ICON_URL,
|
|
42
161
|
helpIcon: HELP_MENU_ICON,
|
|
43
|
-
helpMenuList
|
|
162
|
+
helpMenuList: HELP_MENU_LIST,
|
|
163
|
+
layout,
|
|
164
|
+
theme,
|
|
165
|
+
brandLink: '/',
|
|
166
|
+
authState,
|
|
167
|
+
loginAction: {
|
|
168
|
+
label: SIGN_IN_MENU_ITEM
|
|
169
|
+
},
|
|
170
|
+
signUpAction: {
|
|
171
|
+
label: SIGN_UP_MENU_ITEM,
|
|
172
|
+
url: SIGN_UP__MENU_LINK
|
|
173
|
+
},
|
|
174
|
+
logoutLabel: SIGN_OUT_MENU_ITEM,
|
|
175
|
+
accountIcon: isAuthenticated ? DOWN_ARROW_ICON : '',
|
|
176
|
+
accountAvatar: isAuthenticated ? _solidUi.widgets.findImage(currentUser) : undefined,
|
|
177
|
+
accountAvatarFallback: DEFAULT_AVATAR_ICON,
|
|
178
|
+
loginIcon: LOGIN_ICON,
|
|
179
|
+
signUpIcon: SIGNUP_ICON,
|
|
180
|
+
logoutIcon: LOGOUT_ICON
|
|
44
181
|
};
|
|
45
182
|
return headerOptions;
|
|
46
183
|
}
|
|
47
|
-
async function setUserMenu(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
// Does not work to jump to user profile,
|
|
68
|
-
function openUserProfile(outliner) {
|
|
69
|
-
outliner.GotoSubject(_solidLogic.authn.currentUser(), true, undefined, true, undefined);
|
|
70
|
-
location.reload();
|
|
71
|
-
}
|
|
72
|
-
async function getMenuItems(outliner) {
|
|
73
|
-
const items = await outliner.getDashboardItems();
|
|
74
|
-
return items.map(element => {
|
|
75
|
-
return {
|
|
76
|
-
label: element.label,
|
|
77
|
-
onclick: () => openDashboardPane(outliner, element.tabName || element.paneName)
|
|
78
|
-
};
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
async function openDashboardPane(outliner, pane) {
|
|
82
|
-
outliner.showDashboard({
|
|
83
|
-
pane
|
|
84
|
-
});
|
|
184
|
+
async function setUserMenu() {
|
|
185
|
+
const me = _solidLogic.authn.currentUser();
|
|
186
|
+
if (!me) {
|
|
187
|
+
return [];
|
|
188
|
+
}
|
|
189
|
+
try {
|
|
190
|
+
await _solidLogic.store.fetcher.load(me.doc());
|
|
191
|
+
} catch (err) {
|
|
192
|
+
console.error('Unable to load user profile', err);
|
|
193
|
+
}
|
|
194
|
+
const accountMenu = [{
|
|
195
|
+
label: _solidUi.utils.label(me),
|
|
196
|
+
avatar: _solidUi.widgets.findImage(me),
|
|
197
|
+
webid: me.value,
|
|
198
|
+
action: 'show-profile'
|
|
199
|
+
}
|
|
200
|
+
// TODO add all my available accounts
|
|
201
|
+
];
|
|
202
|
+
return accountMenu;
|
|
85
203
|
}
|
package/dist/mainPage/index.d.ts
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
1
|
import { LiveStore, NamedNode } from 'rdflib';
|
|
2
|
-
|
|
2
|
+
import { OutlineManager } from '../index';
|
|
3
|
+
export { refreshMenu as updateMenuLayout } from './menu';
|
|
4
|
+
export { refreshHeader } from './header';
|
|
5
|
+
export declare function initMainPage(store: LiveStore, uri?: string | NamedNode | null, environment?: any): Promise<[import("solid-ui/components/header").Header & {
|
|
6
|
+
__solidPanesListenersAttached?: boolean;
|
|
7
|
+
__solidPanesOutliner?: OutlineManager;
|
|
8
|
+
}, void, HTMLElement & {
|
|
9
|
+
store?: LiveStore | null;
|
|
10
|
+
position?: "static" | "absolute" | "relative" | "fixed" | "sticky";
|
|
11
|
+
top?: string;
|
|
12
|
+
right?: string;
|
|
13
|
+
bottom?: string;
|
|
14
|
+
left?: string;
|
|
15
|
+
}]>;
|
|
16
|
+
export declare function refreshUI(outliner: OutlineManager): Promise<void>;
|
|
3
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mainPage/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mainPage/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAe,cAAc,EAAE,MAAM,UAAU,CAAA;AAKtD,OAAO,EAAE,WAAW,IAAI,gBAAgB,EAAE,MAAM,QAAQ,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAexC,wBAAsB,YAAY,CAChC,KAAK,EAAE,SAAS,EAChB,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,EAC/B,WAAW,CAAC,EAAE,GAAG;;;;;;;;;;IAYlB;AAED,wBAAsB,SAAS,CAAE,QAAQ,EAAE,cAAc,iBAGxD"}
|
package/dist/mainPage/index.js
CHANGED
|
@@ -3,22 +3,53 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.initMainPage = initMainPage;
|
|
7
|
+
Object.defineProperty(exports, "refreshHeader", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _header.refreshHeader;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
exports.refreshUI = refreshUI;
|
|
14
|
+
Object.defineProperty(exports, "updateMenuLayout", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () {
|
|
17
|
+
return _menu.refreshMenu;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
7
20
|
var _index = require("../index");
|
|
8
21
|
var _header = require("./header");
|
|
9
22
|
var _footer = require("./footer");
|
|
23
|
+
var _menu = require("./menu");
|
|
10
24
|
/* Main Page
|
|
11
25
|
**
|
|
12
26
|
** This code is called in mashlib and renders the header and footer of the Databrowser.
|
|
13
27
|
*/
|
|
14
28
|
|
|
15
|
-
|
|
16
|
-
|
|
29
|
+
function ensureMainContent() {
|
|
30
|
+
let main = document.getElementById('MainContent');
|
|
31
|
+
if (!main) {
|
|
32
|
+
main = document.createElement('main');
|
|
33
|
+
main.id = 'MainContent';
|
|
34
|
+
main.setAttribute('role', 'main');
|
|
35
|
+
main.setAttribute('tabindex', '-1');
|
|
36
|
+
main.setAttribute('aria-live', 'polite');
|
|
37
|
+
document.body.appendChild(main);
|
|
38
|
+
}
|
|
39
|
+
return main;
|
|
40
|
+
}
|
|
41
|
+
async function initMainPage(store, uri, environment) {
|
|
42
|
+
ensureMainContent();
|
|
43
|
+
const outliner = (0, _index.getOutliner)(document, environment);
|
|
17
44
|
uri = uri || window.location.href;
|
|
18
|
-
|
|
19
|
-
if (typeof uri === 'string') subject = store.sym(uri);
|
|
45
|
+
const subject = typeof uri === 'string' ? store.sym(uri) : uri;
|
|
20
46
|
outliner.GotoSubject(subject, true, undefined, true, undefined);
|
|
21
47
|
const header = await (0, _header.createHeader)(store, outliner);
|
|
22
|
-
const
|
|
23
|
-
|
|
48
|
+
const menu = (0, _menu.createLeftSideMenu)(subject, outliner);
|
|
49
|
+
const footer = menu.then(() => (0, _footer.createFooter)(store));
|
|
50
|
+
return Promise.all([header, menu, footer]);
|
|
51
|
+
}
|
|
52
|
+
async function refreshUI(outliner) {
|
|
53
|
+
await (0, _header.refreshHeader)(outliner);
|
|
54
|
+
(0, _menu.refreshMenu)(outliner.context.environment?.layout === 'mobile' ? 'mobile' : 'desktop');
|
|
24
55
|
}
|