solid-panes 4.2.3-583c15bd → 4.2.3-6c548ee8
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/dist/dashboard/basicPreferences.js +146 -0
- package/dist/dashboard/dashboardPane.js +67 -0
- package/dist/dashboard/homepage.js +72 -0
- package/dist/dataContentPane.js +8 -11
- package/dist/home/homePane.js +72 -0
- package/dist/humanReadablePane.js +8 -11
- package/dist/index.js +108 -0
- package/dist/internal/internalPane.d.ts +0 -1
- package/dist/internal/internalPane.d.ts.map +1 -1
- package/dist/internal/internalPane.js +183 -0
- package/dist/mainPage/footer.js +21 -0
- package/dist/mainPage/header.js +85 -0
- package/dist/mainPage/index.js +24 -0
- package/dist/outline/context.js +18 -0
- package/dist/outline/propertyViews.js +43 -0
- package/dist/outline/viewAsImage.js +14 -0
- package/dist/outline/viewAsMbox.js +21 -0
- package/dist/pad/padPane.d.ts +0 -1
- package/dist/pad/padPane.d.ts.map +1 -1
- package/dist/pad/padPane.js +410 -0
- package/dist/schedule/schedulePane.js +1 -26
- package/dist/sharing/sharingPane.js +48 -0
- package/dist/solid-panes.js +39 -352
- package/dist/solid-panes.js.map +1 -1
- package/dist/solid-panes.min.js +2 -2
- package/dist/solid-panes.min.js.map +1 -1
- package/dist/tabbed/tabbedPane.js +57 -0
- package/dist/trustedApplications/trustedApplications.dom.js +145 -0
- package/dist/trustedApplications/trustedApplications.utils.js +23 -0
- package/dist/trustedApplications/trustedApplications.view.js +55 -0
- package/dist/versionInfo.js +35 -0
- package/package.json +2 -2
- package/dist/styles/dataContentPane.css +0 -23
- package/dist/styles/humanReadablePane.css +0 -8
- package/dist/styles/internalPane.css +0 -12
- package/dist/styles/padPane.css +0 -13
- /package/dist/{styles → style}/tabbedtab.css +0 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.basicPreferencesPane = void 0;
|
|
7
|
+
var _rdflib = require("rdflib");
|
|
8
|
+
var _solidUi = require("solid-ui");
|
|
9
|
+
/* babel-plugin-inline-import './ontologyData.ttl' */
|
|
10
|
+
const ontologyData = "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.\n@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.\n@prefix solid: <http://www.w3.org/ns/solid/terms#>.\n@prefix foaf: <http://xmlns.com/foaf/0.1/>.\n@prefix schema: <http:/schema.org/>.\n@prefix ui: <http://www.w3.org/ns/ui#>.\n@prefix vcard: <http://www.w3.org/2006/vcard/ns#>.\n@prefix : <#>.\n\nsolid:User a rdfs:Class;\n rdfs:label \"user\"@en, \"utilisateur\"@fr;\n rdfs:comment \"\"\"Any person who might use a Solid-based system\"\"\";\n rdfs:subClassOf foaf:Person, schema:Person, vcard:Individual.\n\n# Since these options are opt-in, it is a bit strange to have new users opt in\n# That they are new users - also we do not use this class for anything specific\n# yet\n# solid:NewUser a rdfs:Class;\n# rdfs:label \"new user\"@en;\n# rdfs:comment \"\"\"A person who might use a Solid-based system who has a low\n# level of familiarity with technical details.\"\"\";\n# rdfs:subClassOf solid:User.\n\nsolid:PowerUser a rdfs:Class;\n rdfs:label \"power user\"@en;\n rdfs:comment \"\"\"A person who might use a Solid-based system\n who is prepared to be given a more complex interface in order\n to be provided with more pwerful features.\"\"\";\n rdfs:subClassOf solid:User.\n\n solid:Developer a rdfs:Class;\n rdfs:label \"Developer\";\n rdfs:comment \"\"\"Any person who might use a Solid-based system,\n who has software development skills.\"\"\";\n rdfs:subClassOf solid:User.\n";
|
|
11
|
+
/* babel-plugin-inline-import './preferencesFormText.ttl' */
|
|
12
|
+
const preferencesFormText = "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.\n@prefix solid: <http://www.w3.org/ns/solid/terms#>.\n@prefix ui: <http://www.w3.org/ns/ui#>.\n@prefix : <#>.\n\n:this <http://purl.org/dc/elements/1.1/title> \"Basic preferences\" ;\n a ui:Form ;\n ui:part :categorizeUser, :privateComment, :personalInformationHeading;\n ui:parts ( :personalInformationHeading :privateComment :categorizeUser ).\n\n:personalInformationHeading a ui:Heading;\n ui:contents \"Personal information\".\n\n:privateComment a ui:Comment;\n ui:contents \"This information is private.\".\n\n:categorizeUser a ui:Classifier;\n ui:label \"Level of user\"; ui:property rdf:type ; ui:category solid:User.\n";
|
|
13
|
+
const basicPreferencesPane = exports.basicPreferencesPane = {
|
|
14
|
+
icon: _solidUi.icons.iconBase + 'noun_Sliders_341315_000000.svg',
|
|
15
|
+
name: 'basicPreferences',
|
|
16
|
+
label: _subject => {
|
|
17
|
+
return null;
|
|
18
|
+
},
|
|
19
|
+
// Render the pane
|
|
20
|
+
// The subject should be the logged in user.
|
|
21
|
+
render: (subject, context) => {
|
|
22
|
+
const dom = context.dom;
|
|
23
|
+
const store = context.session.store;
|
|
24
|
+
function complainIfBad(ok, mess) {
|
|
25
|
+
if (ok) return;
|
|
26
|
+
container.appendChild(_solidUi.widgets.errorMessageBlock(dom, mess, '#fee'));
|
|
27
|
+
}
|
|
28
|
+
const container = dom.createElement('div');
|
|
29
|
+
const formArea = setupUserTypesSection(container, dom);
|
|
30
|
+
function loadData(doc, turtle) {
|
|
31
|
+
doc = doc.doc(); // remove # from URI if nec
|
|
32
|
+
if (!store.holds(undefined, undefined, undefined, doc)) {
|
|
33
|
+
// If not loaded already
|
|
34
|
+
;
|
|
35
|
+
(0, _rdflib.parse)(turtle, store, doc.uri, 'text/turtle', null); // Load form directly
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const preferencesForm = store.sym('urn:uuid:93774ba1-d3b6-41f2-85b6-4ae27ffd2597#this');
|
|
39
|
+
loadData(preferencesForm, preferencesFormText);
|
|
40
|
+
const ontologyExtra = store.sym('urn:uuid:93774ba1-d3b6-41f2-85b6-4ae27ffd2597-ONT');
|
|
41
|
+
loadData(ontologyExtra, ontologyData);
|
|
42
|
+
async function doRender() {
|
|
43
|
+
const renderContext = await _solidUi.login.ensureLoadedPreferences({
|
|
44
|
+
dom,
|
|
45
|
+
div: container
|
|
46
|
+
});
|
|
47
|
+
if (!renderContext.preferencesFile) {
|
|
48
|
+
// Could be CORS
|
|
49
|
+
console.log('Not doing private class preferences as no access to preferences file. ' + renderContext.preferencesFileError);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const appendedForm = _solidUi.widgets.appendForm(dom, formArea, {}, renderContext.me, preferencesForm, renderContext.preferencesFile, complainIfBad);
|
|
53
|
+
appendedForm.style.borderStyle = 'none';
|
|
54
|
+
const trustedApplicationsView = context.session.paneRegistry.byName('trustedApplications');
|
|
55
|
+
if (trustedApplicationsView) {
|
|
56
|
+
container.appendChild(trustedApplicationsView.render(null, context));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// @@ TODO Remove need for casting as any and bang (!) syntax
|
|
60
|
+
addDeleteSection(container, store, renderContext.me, dom);
|
|
61
|
+
}
|
|
62
|
+
doRender();
|
|
63
|
+
return container;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
function setupUserTypesSection(container, dom) {
|
|
67
|
+
const formContainer = createSection(container, dom, 'User types');
|
|
68
|
+
const description = formContainer.appendChild(dom.createElement('p'));
|
|
69
|
+
description.innerText = 'Here you can self-assign user types to help the data browser know which views you would like to access.';
|
|
70
|
+
const userTypesLink = formContainer.appendChild(dom.createElement('a'));
|
|
71
|
+
userTypesLink.href = 'https://github.com/solidos/userguide/#role';
|
|
72
|
+
userTypesLink.innerText = 'Read more';
|
|
73
|
+
const formArea = formContainer.appendChild(dom.createElement('div'));
|
|
74
|
+
return formArea;
|
|
75
|
+
}
|
|
76
|
+
var _default = exports.default = basicPreferencesPane; // ends
|
|
77
|
+
function addDeleteSection(container, store, profile, dom) {
|
|
78
|
+
const section = createSection(container, dom, 'Delete account');
|
|
79
|
+
const podServerNodes = store.each(profile, _solidUi.ns.space('storage'), null, profile.doc());
|
|
80
|
+
const podServers = podServerNodes.map(node => node.value);
|
|
81
|
+
const list = section.appendChild(dom.createElement('ul'));
|
|
82
|
+
podServers.forEach(async server => {
|
|
83
|
+
const deletionLink = await generateDeletionLink(server, dom);
|
|
84
|
+
if (deletionLink) {
|
|
85
|
+
const listItem = list.appendChild(dom.createElement('li'));
|
|
86
|
+
listItem.appendChild(deletionLink);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
async function generateDeletionLink(podServer, dom) {
|
|
91
|
+
const link = dom.createElement('a');
|
|
92
|
+
link.textContent = `Delete your account at ${podServer}`;
|
|
93
|
+
const deletionUrl = await getDeletionUrlForServer(podServer);
|
|
94
|
+
if (typeof deletionUrl !== 'string') {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
link.href = deletionUrl;
|
|
98
|
+
return link;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Hacky way to get the deletion link to a Pod
|
|
103
|
+
*
|
|
104
|
+
* This function infers the deletion link by assuming the URL structure of Node Solid server.
|
|
105
|
+
* In the future, Solid will hopefully provide a standardised way of discovering the deletion link:
|
|
106
|
+
* https://github.com/solidos/data-interoperability-panel/issues/18
|
|
107
|
+
*
|
|
108
|
+
* If NSS is in multi-user mode (the case on inrupt.net and solid.community), the deletion URL for
|
|
109
|
+
* vincent.dev.inrupt.net would be at dev.inrupt.net/account/delete. In single-user mode, the
|
|
110
|
+
* deletion URL would be at vincent.dev.inrupt.net/account/delete.
|
|
111
|
+
*
|
|
112
|
+
* @param server Pod server containing the user's account.
|
|
113
|
+
* @returns URL of the page that Node Solid Server would offer to delete the account, or null if
|
|
114
|
+
* the URLs we tried give invalid responses.
|
|
115
|
+
*/
|
|
116
|
+
async function getDeletionUrlForServer(server) {
|
|
117
|
+
const singleUserUrl = new URL(server);
|
|
118
|
+
const multiUserUrl = new URL(server);
|
|
119
|
+
multiUserUrl.pathname = singleUserUrl.pathname = '/account/delete';
|
|
120
|
+
const hostnameParts = multiUserUrl.hostname.split('.');
|
|
121
|
+
// Remove `vincent.` from `vincent.dev.inrupt.net`, for example:
|
|
122
|
+
multiUserUrl.hostname = hostnameParts.slice(1).join('.');
|
|
123
|
+
const multiUserNssResponse = await fetch(multiUserUrl.href, {
|
|
124
|
+
method: 'HEAD'
|
|
125
|
+
});
|
|
126
|
+
if (multiUserNssResponse.ok) {
|
|
127
|
+
return multiUserUrl.href;
|
|
128
|
+
}
|
|
129
|
+
const singleUserNssResponse = await fetch(singleUserUrl.href, {
|
|
130
|
+
method: 'HEAD'
|
|
131
|
+
});
|
|
132
|
+
if (singleUserNssResponse.ok) {
|
|
133
|
+
return singleUserUrl.href;
|
|
134
|
+
}
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
function createSection(container, dom, title) {
|
|
138
|
+
const section = container.appendChild(dom.createElement('div'));
|
|
139
|
+
section.style.border = '0.3em solid #418d99';
|
|
140
|
+
section.style.borderRadius = '0.5em';
|
|
141
|
+
section.style.padding = '0.7em';
|
|
142
|
+
section.style.marginTop = '0.7em';
|
|
143
|
+
const titleElement = section.appendChild(dom.createElement('h3'));
|
|
144
|
+
titleElement.innerText = title;
|
|
145
|
+
return section;
|
|
146
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.dashboardPane = void 0;
|
|
7
|
+
var _solidUi = require("solid-ui");
|
|
8
|
+
var _solidLogic = require("solid-logic");
|
|
9
|
+
var _homepage = require("./homepage");
|
|
10
|
+
const dashboardPane = exports.dashboardPane = {
|
|
11
|
+
icon: _solidUi.icons.iconBase + 'noun_547570.svg',
|
|
12
|
+
name: 'dashboard',
|
|
13
|
+
label: subject => {
|
|
14
|
+
if (subject.termType === 'NamedNode' && subject.uri === subject.site().uri) {
|
|
15
|
+
return 'Dashboard';
|
|
16
|
+
}
|
|
17
|
+
return null;
|
|
18
|
+
},
|
|
19
|
+
render: (subject, context) => {
|
|
20
|
+
console.log('Dashboard Pane Render');
|
|
21
|
+
const dom = context.dom;
|
|
22
|
+
const container = dom.createElement('div');
|
|
23
|
+
const runBuildPage = () => {
|
|
24
|
+
container.innerHTML = '';
|
|
25
|
+
buildPage(container, _solidLogic.authn.currentUser() || null, context, subject);
|
|
26
|
+
};
|
|
27
|
+
_solidLogic.authSession.events.on('login', () => {
|
|
28
|
+
// console.log('On Login')
|
|
29
|
+
runBuildPage();
|
|
30
|
+
});
|
|
31
|
+
_solidLogic.authSession.events.on('sessionRestore', () => {
|
|
32
|
+
// console.log('On Session Restore')
|
|
33
|
+
runBuildPage();
|
|
34
|
+
});
|
|
35
|
+
// console.log('Initial Load')
|
|
36
|
+
runBuildPage();
|
|
37
|
+
return container;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
function buildPage(container, webId, context, subject) {
|
|
41
|
+
// if uri then SolidOS is a browse.html web app
|
|
42
|
+
const uri = new URL(window.location.href).searchParams.get('uri');
|
|
43
|
+
if (webId && (uri || webId.site().uri === subject.site().uri)) {
|
|
44
|
+
return buildDashboard(container, context);
|
|
45
|
+
}
|
|
46
|
+
return buildHomePage(container, subject);
|
|
47
|
+
}
|
|
48
|
+
function buildDashboard(container, context) {
|
|
49
|
+
// console.log('build dashboard')
|
|
50
|
+
// @@ TODO get a proper type
|
|
51
|
+
const outliner = context.getOutliner(context.dom);
|
|
52
|
+
outliner.getDashboard().then(dashboard => container.appendChild(dashboard));
|
|
53
|
+
}
|
|
54
|
+
function buildHomePage(container, subject) {
|
|
55
|
+
// console.log('build home page')
|
|
56
|
+
const wrapper = document.createElement('div');
|
|
57
|
+
container.appendChild(wrapper);
|
|
58
|
+
const shadow = wrapper.attachShadow({
|
|
59
|
+
mode: 'open'
|
|
60
|
+
});
|
|
61
|
+
const link = document.createElement('link');
|
|
62
|
+
link.rel = 'stylesheet';
|
|
63
|
+
link.href = '/common/css/bootstrap.min.css';
|
|
64
|
+
shadow.appendChild(link);
|
|
65
|
+
(0, _homepage.generateHomepage)(subject, _solidLogic.store, _solidLogic.store.fetcher).then(homepage => shadow.appendChild(homepage));
|
|
66
|
+
}
|
|
67
|
+
var _default = exports.default = dashboardPane;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.generateHomepage = generateHomepage;
|
|
7
|
+
var _rdflib = require("rdflib");
|
|
8
|
+
var _solidUi = require("solid-ui");
|
|
9
|
+
async function generateHomepage(subject, store, fetcher) {
|
|
10
|
+
const ownersProfile = await loadProfile(subject, store, fetcher);
|
|
11
|
+
const name = getName(store, ownersProfile);
|
|
12
|
+
const wrapper = document.createElement('div');
|
|
13
|
+
wrapper.classList.add('container');
|
|
14
|
+
wrapper.appendChild(createTitle(ownersProfile.uri, name));
|
|
15
|
+
wrapper.appendChild(createDataSection(name));
|
|
16
|
+
return wrapper;
|
|
17
|
+
}
|
|
18
|
+
function createDataSection(name) {
|
|
19
|
+
const dataSection = document.createElement('section');
|
|
20
|
+
const title = document.createElement('h2');
|
|
21
|
+
title.innerText = 'Data';
|
|
22
|
+
dataSection.appendChild(title);
|
|
23
|
+
const listGroup = document.createElement('div');
|
|
24
|
+
listGroup.classList.add('list-group');
|
|
25
|
+
dataSection.appendChild(listGroup);
|
|
26
|
+
const publicDataLink = document.createElement('a');
|
|
27
|
+
publicDataLink.classList.add('list-group-item');
|
|
28
|
+
publicDataLink.href = window.document.location.href + 'public/';
|
|
29
|
+
publicDataLink.innerText = `View ${name}'s files`;
|
|
30
|
+
listGroup.appendChild(publicDataLink);
|
|
31
|
+
return dataSection;
|
|
32
|
+
}
|
|
33
|
+
function createTitle(uri, name) {
|
|
34
|
+
const profileLink = document.createElement('a');
|
|
35
|
+
profileLink.href = uri;
|
|
36
|
+
profileLink.innerText = name;
|
|
37
|
+
const profileLinkPost = document.createElement('span');
|
|
38
|
+
profileLinkPost.innerText = '\'s Pod';
|
|
39
|
+
const title = document.createElement('h1');
|
|
40
|
+
title.appendChild(profileLink);
|
|
41
|
+
title.appendChild(profileLinkPost);
|
|
42
|
+
return title;
|
|
43
|
+
}
|
|
44
|
+
async function loadProfile(subject, store, fetcher) {
|
|
45
|
+
const pod = subject.site().uri;
|
|
46
|
+
// TODO: This is a hack - we cannot assume that the profile is at this document, but we will live with it for now
|
|
47
|
+
const webId = (0, _rdflib.sym)(`${pod}profile/card#me`);
|
|
48
|
+
try {
|
|
49
|
+
await fetcher.load(webId);
|
|
50
|
+
return webId;
|
|
51
|
+
} catch (err) {
|
|
52
|
+
// Fall back to pod root and any discovered profile links.
|
|
53
|
+
}
|
|
54
|
+
try {
|
|
55
|
+
await fetcher.load(subject);
|
|
56
|
+
} catch (err) {
|
|
57
|
+
return subject;
|
|
58
|
+
}
|
|
59
|
+
const primaryTopic = store.any(subject, _solidUi.ns.foaf('primaryTopic'), null, subject.doc());
|
|
60
|
+
if (primaryTopic && primaryTopic.termType === 'NamedNode') {
|
|
61
|
+
try {
|
|
62
|
+
await fetcher.load(primaryTopic);
|
|
63
|
+
return primaryTopic;
|
|
64
|
+
} catch (err) {
|
|
65
|
+
return subject;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return subject;
|
|
69
|
+
}
|
|
70
|
+
function getName(store, ownersProfile) {
|
|
71
|
+
return store.anyValue(ownersProfile, _solidUi.ns.vcard('fn'), null, ownersProfile.doc()) || store.anyValue(ownersProfile, _solidUi.ns.foaf('name'), null, ownersProfile.doc()) || new URL(ownersProfile.uri).host.split('.')[0];
|
|
72
|
+
}
|
package/dist/dataContentPane.js
CHANGED
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.dataContentPane = void 0;
|
|
7
7
|
var UI = _interopRequireWildcard(require("solid-ui"));
|
|
8
8
|
var $rdf = _interopRequireWildcard(require("rdflib"));
|
|
9
|
-
require("./styles/dataContentPane.css");
|
|
10
9
|
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); }
|
|
11
10
|
/* Data content Pane
|
|
12
11
|
**
|
|
@@ -69,7 +68,6 @@ const dataContentPane = exports.dataContentPane = {
|
|
|
69
68
|
for (let i = 0; i < sts.length; i++) {
|
|
70
69
|
const st = sts[i];
|
|
71
70
|
const tr = myDocument.createElement('tr');
|
|
72
|
-
tr.classList.add('dataContentPaneTopAlignedRow');
|
|
73
71
|
if (st.predicate.uri !== lastPred) {
|
|
74
72
|
if (lastPred && same > 1) {
|
|
75
73
|
predicateTD.setAttribute('rowspan', '' + same);
|
|
@@ -108,12 +106,12 @@ const dataContentPane = exports.dataContentPane = {
|
|
|
108
106
|
case 'Literal':
|
|
109
107
|
if (!obj.datatype || !obj.datatype.uri) {
|
|
110
108
|
res = myDocument.createElement('div');
|
|
111
|
-
res.
|
|
109
|
+
res.setAttribute('style', 'white-space: pre-wrap;');
|
|
112
110
|
res.textContent = obj.value;
|
|
113
111
|
return res;
|
|
114
112
|
} else if (obj.datatype.uri === 'http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral') {
|
|
115
113
|
res = myDocument.createElement('div');
|
|
116
|
-
res.
|
|
114
|
+
res.setAttribute('class', 'embeddedXHTML');
|
|
117
115
|
res.innerHTML = obj.value; // Try that @@@ beware embedded dangerous code
|
|
118
116
|
return res;
|
|
119
117
|
}
|
|
@@ -134,11 +132,10 @@ const dataContentPane = exports.dataContentPane = {
|
|
|
134
132
|
doneBnodes[obj.toNT()] = true; // Flag to prevent infinite recursion in propertyTree
|
|
135
133
|
const newTable = propertyTree(obj);
|
|
136
134
|
doneBnodes[obj.toNT()] = newTable; // Track where we mentioned it first
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
newTable.classList.add('dataContentPaneNestedDark');
|
|
135
|
+
if (UI.utils.ancestor(newTable, 'TABLE') && UI.utils.ancestor(newTable, 'TABLE').style.backgroundColor === 'white') {
|
|
136
|
+
newTable.style.backgroundColor = '#eee';
|
|
140
137
|
} else {
|
|
141
|
-
newTable.
|
|
138
|
+
newTable.style.backgroundColor = 'white';
|
|
142
139
|
}
|
|
143
140
|
return newTable;
|
|
144
141
|
}
|
|
@@ -175,7 +172,7 @@ const dataContentPane = exports.dataContentPane = {
|
|
|
175
172
|
}
|
|
176
173
|
for (let i = 0; i < roots.length; i++) {
|
|
177
174
|
const tr = myDocument.createElement('tr');
|
|
178
|
-
tr.
|
|
175
|
+
tr.setAttribute('style', `background-color: ${i % 2 === 0 ? '#f0f0f0' : 'white'};`);
|
|
179
176
|
rep.appendChild(tr);
|
|
180
177
|
const subjectTD = myDocument.createElement('td');
|
|
181
178
|
tr.appendChild(subjectTD);
|
|
@@ -220,9 +217,9 @@ const dataContentPane = exports.dataContentPane = {
|
|
|
220
217
|
return div;
|
|
221
218
|
};
|
|
222
219
|
for (let i = 0; i < roots.length; i++) {
|
|
223
|
-
const tr = myDocument.createElement('
|
|
224
|
-
tr.classList.add('dataContentPaneTopAlignedRow');
|
|
220
|
+
const tr = myDocument.createElement('TR');
|
|
225
221
|
const root = roots[i];
|
|
222
|
+
tr.style.verticalAlign = 'top';
|
|
226
223
|
const td = outliner.outlineObjectTD(root, undefined, tr);
|
|
227
224
|
tr.appendChild(td);
|
|
228
225
|
div.appendChild(tr);
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _solidLogic = require("solid-logic");
|
|
8
|
+
var _solidUi = require("solid-ui");
|
|
9
|
+
/* Home Pane
|
|
10
|
+
**
|
|
11
|
+
** The home pane is avaiable everywhere and allows a user
|
|
12
|
+
** to
|
|
13
|
+
** - keep track of their stuff
|
|
14
|
+
** - make new things, and possibly
|
|
15
|
+
** - keep track of accounts and workspaces etc
|
|
16
|
+
**
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const HomePaneSource = {
|
|
20
|
+
icon: _solidUi.icons.iconBase + 'noun_547570.svg',
|
|
21
|
+
// noun_25830
|
|
22
|
+
|
|
23
|
+
global: true,
|
|
24
|
+
name: 'home',
|
|
25
|
+
// Does the subject deserve an home pane?
|
|
26
|
+
//
|
|
27
|
+
// yes, always!
|
|
28
|
+
//
|
|
29
|
+
label: function () {
|
|
30
|
+
return 'home';
|
|
31
|
+
},
|
|
32
|
+
render: function (subject, context) {
|
|
33
|
+
const dom = context.dom;
|
|
34
|
+
const showContent = async function () {
|
|
35
|
+
const homePaneContext = {
|
|
36
|
+
div,
|
|
37
|
+
dom,
|
|
38
|
+
statusArea: div,
|
|
39
|
+
me
|
|
40
|
+
};
|
|
41
|
+
/*
|
|
42
|
+
div.appendChild(dom.createElement('h4')).textContent = 'Login status'
|
|
43
|
+
var loginStatusDiv = div.appendChild(context.dom.createElement('div'))
|
|
44
|
+
// TODO: Find out what the actual type is:
|
|
45
|
+
type UriType = unknown;
|
|
46
|
+
loginStatusDiv.appendChild(UI.login.loginStatusBox(context.dom, () => {
|
|
47
|
+
// Here we know new log in status
|
|
48
|
+
}))
|
|
49
|
+
*/
|
|
50
|
+
div.appendChild(dom.createElement('h4')).textContent = 'Create new thing somewhere';
|
|
51
|
+
const creationDiv = div.appendChild(dom.createElement('div'));
|
|
52
|
+
const creationContext = {
|
|
53
|
+
div: creationDiv,
|
|
54
|
+
dom,
|
|
55
|
+
statusArea: div,
|
|
56
|
+
me
|
|
57
|
+
};
|
|
58
|
+
const relevantPanes = await _solidUi.login.filterAvailablePanes(context.session.paneRegistry.list);
|
|
59
|
+
_solidUi.create.newThingUI(creationContext, context, relevantPanes); // newUI Have to pass panes down
|
|
60
|
+
|
|
61
|
+
_solidUi.login.registrationList(homePaneContext, {}).then(function () {});
|
|
62
|
+
};
|
|
63
|
+
const div = dom.createElement('div');
|
|
64
|
+
const me = _solidLogic.authn.currentUser(); // this will be incorrect if not logged in
|
|
65
|
+
|
|
66
|
+
showContent();
|
|
67
|
+
return div;
|
|
68
|
+
}
|
|
69
|
+
}; // pane object
|
|
70
|
+
|
|
71
|
+
// ends
|
|
72
|
+
var _default = exports.default = HomePaneSource;
|
|
@@ -8,7 +8,6 @@ var _solidUi = require("solid-ui");
|
|
|
8
8
|
var _rdflib = require("rdflib");
|
|
9
9
|
var _marked = require("marked");
|
|
10
10
|
var _dompurify = _interopRequireDefault(require("dompurify"));
|
|
11
|
-
require("./styles/humanReadablePane.css");
|
|
12
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
12
|
/* Human-readable Pane
|
|
14
13
|
**
|
|
@@ -145,10 +144,6 @@ const humanReadablePane = {
|
|
|
145
144
|
|
|
146
145
|
// @@ When we can, use CSP to turn off scripts within the iframe
|
|
147
146
|
div.setAttribute('class', 'docView');
|
|
148
|
-
const setFrameDisplayStyles = function (frame, lines) {
|
|
149
|
-
frame.classList.add('doc', 'humanReadableFrame');
|
|
150
|
-
frame.style.setProperty('--human-readable-height', `${lines}em`);
|
|
151
|
-
};
|
|
152
147
|
|
|
153
148
|
// render markdown to html in a DIV element
|
|
154
149
|
const renderMarkdownContent = function (frame) {
|
|
@@ -158,7 +153,8 @@ const humanReadablePane = {
|
|
|
158
153
|
const res = _marked.marked.parse(markdownText);
|
|
159
154
|
const clean = _dompurify.default.sanitize(res);
|
|
160
155
|
frame.innerHTML = clean;
|
|
161
|
-
|
|
156
|
+
frame.setAttribute('class', 'doc');
|
|
157
|
+
frame.setAttribute('style', `border: 1px solid; padding: 1em; height: ${lines}em; width: 800px; resize: both; overflow: auto;`);
|
|
162
158
|
}).catch(error => {
|
|
163
159
|
console.error('Error fetching markdown content:', error);
|
|
164
160
|
frame.innerHTML = '<p>Error loading content</p>';
|
|
@@ -166,18 +162,19 @@ const humanReadablePane = {
|
|
|
166
162
|
};
|
|
167
163
|
const setIframeAttributes = (frame, lines) => {
|
|
168
164
|
frame.setAttribute('src', subject.uri);
|
|
169
|
-
|
|
165
|
+
frame.setAttribute('class', 'doc');
|
|
166
|
+
frame.setAttribute('style', `border: 1px solid; padding: 1em; height: ${lines}em; width: 800px; resize: both; overflow: auto;`);
|
|
170
167
|
};
|
|
171
168
|
if (isMarkdown) {
|
|
172
169
|
// For markdown, use a DIV element and render the content
|
|
173
|
-
const frame = myDocument.createElement('
|
|
170
|
+
const frame = myDocument.createElement('DIV');
|
|
174
171
|
renderMarkdownContent(frame);
|
|
175
|
-
const tr = myDocument.createElement('
|
|
172
|
+
const tr = myDocument.createElement('TR');
|
|
176
173
|
tr.appendChild(frame);
|
|
177
174
|
div.appendChild(tr);
|
|
178
175
|
} else {
|
|
179
176
|
// For other content types, use IFRAME
|
|
180
|
-
const frame = myDocument.createElement('
|
|
177
|
+
const frame = myDocument.createElement('IFRAME');
|
|
181
178
|
|
|
182
179
|
// Apply sandbox for HTML/XHTML
|
|
183
180
|
if (ct === 'text/html' || ct === 'application/xhtml+xml') {
|
|
@@ -199,7 +196,7 @@ const humanReadablePane = {
|
|
|
199
196
|
// Fallback to default height
|
|
200
197
|
setIframeAttributes(frame, 30);
|
|
201
198
|
});
|
|
202
|
-
const tr = myDocument.createElement('
|
|
199
|
+
const tr = myDocument.createElement('TR');
|
|
203
200
|
tr.appendChild(frame);
|
|
204
201
|
div.appendChild(tr);
|
|
205
202
|
}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "OutlineManager", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _manager.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
exports.UI = void 0;
|
|
13
|
+
Object.defineProperty(exports, "byName", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () {
|
|
16
|
+
return _paneRegistry.byName;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
exports.getOutliner = getOutliner;
|
|
20
|
+
Object.defineProperty(exports, "initMainPage", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () {
|
|
23
|
+
return _mainPage.default;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
Object.defineProperty(exports, "list", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function () {
|
|
29
|
+
return _paneRegistry.list;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(exports, "paneForIcon", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _paneRegistry.paneForIcon;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
Object.defineProperty(exports, "paneForPredicate", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function () {
|
|
41
|
+
return _paneRegistry.paneForPredicate;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
Object.defineProperty(exports, "register", {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function () {
|
|
47
|
+
return _paneRegistry.register;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
Object.defineProperty(exports, "versionInfo", {
|
|
51
|
+
enumerable: true,
|
|
52
|
+
get: function () {
|
|
53
|
+
return _versionInfo.default;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
var _versionInfo = _interopRequireDefault(require("./versionInfo"));
|
|
57
|
+
var UI = _interopRequireWildcard(require("solid-ui"));
|
|
58
|
+
exports.UI = UI;
|
|
59
|
+
var _solidLogic = require("solid-logic");
|
|
60
|
+
var _manager = _interopRequireDefault(require("./outline/manager.js"));
|
|
61
|
+
var _registerPanes = require("./registerPanes.js");
|
|
62
|
+
var _paneRegistry = require("pane-registry");
|
|
63
|
+
var _context = require("./outline/context");
|
|
64
|
+
var _mainPage = _interopRequireDefault(require("./mainPage"));
|
|
65
|
+
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
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
67
|
+
/* SOLID PANES
|
|
68
|
+
**
|
|
69
|
+
** Panes are regions of the outline view in which a particular subject is
|
|
70
|
+
** displayed in a particular way.
|
|
71
|
+
** Different panes about the same subject are typically stacked vertically.
|
|
72
|
+
** Panes may be used naked or with a pane selection header.
|
|
73
|
+
**
|
|
74
|
+
** The label() method has two functions: it determines whether the pane is
|
|
75
|
+
** relevant to a given subject, returning null if not.
|
|
76
|
+
** If it is relevant, then it returns a suitable tooltip for a control which selects the pane
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
function getOutliner(dom) {
|
|
80
|
+
if (!dom.outlineManager) {
|
|
81
|
+
const context = (0, _context.createContext)(dom, {
|
|
82
|
+
list: _paneRegistry.list,
|
|
83
|
+
paneForIcon: _paneRegistry.paneForIcon,
|
|
84
|
+
paneForPredicate: _paneRegistry.paneForPredicate,
|
|
85
|
+
register: _paneRegistry.register,
|
|
86
|
+
byName: _paneRegistry.byName
|
|
87
|
+
}, _solidLogic.store, _solidLogic.solidLogicSingleton);
|
|
88
|
+
dom.outlineManager = new _manager.default(context);
|
|
89
|
+
}
|
|
90
|
+
return dom.outlineManager;
|
|
91
|
+
}
|
|
92
|
+
if (typeof window !== 'undefined') {
|
|
93
|
+
getOutliner(window.document);
|
|
94
|
+
}
|
|
95
|
+
(0, _registerPanes.registerPanes)(cjsOrEsModule => (0, _paneRegistry.register)(cjsOrEsModule.default || cjsOrEsModule));
|
|
96
|
+
|
|
97
|
+
// This has common outline mode functionality for the default and other other panes
|
|
98
|
+
// A separate outline manager is required per DOM in cases like a browser extension
|
|
99
|
+
// where there are many occurrences of window and of window.document
|
|
100
|
+
// But each DOM should have just one outline manager.
|
|
101
|
+
|
|
102
|
+
// export for simpler access by non-node scripts
|
|
103
|
+
if (typeof window !== 'undefined') {
|
|
104
|
+
;
|
|
105
|
+
window.panes = {
|
|
106
|
+
getOutliner
|
|
107
|
+
};
|
|
108
|
+
}
|
|
@@ -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;
|
|
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,cAwOX,CAAA;AAiBD,eAAe,IAAI,CAAA"}
|