solid-panes 3.7.3-3425a37d → 3.7.3-34392762
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/RDFXMLPane.js +58 -0
- package/dist/RDFXMLPane.js.map +1 -0
- package/dist/argument/argumentPane.js +61 -0
- package/dist/argument/argumentPane.js.map +1 -0
- package/dist/attach/attachPane.js +394 -0
- package/dist/attach/attachPane.js.map +1 -0
- package/dist/audio/audioPane.js +182 -0
- package/dist/audio/audioPane.js.map +1 -0
- package/dist/classInstancePane.js +92 -0
- package/dist/classInstancePane.js.map +1 -0
- package/dist/dashboard/basicPreferences.js +121 -129
- package/dist/dashboard/basicPreferences.js.map +1 -1
- package/dist/dashboard/dashboardPane.js +60 -54
- package/dist/dashboard/dashboardPane.js.map +1 -1
- package/dist/dashboard/homepage.js +45 -54
- package/dist/dashboard/homepage.js.map +1 -1
- package/dist/dataContentPane.js +259 -0
- package/dist/dataContentPane.js.map +1 -0
- package/dist/defaultPane.js +75 -0
- package/dist/defaultPane.js.map +1 -0
- package/dist/dokieli/dokieliPane.js +169 -0
- package/dist/dokieli/dokieliPane.js.map +1 -0
- package/dist/dokieli/new.js +28 -0
- package/dist/dokieli/new.js.map +1 -0
- package/dist/form/pane.js +185 -0
- package/dist/form/pane.js.map +1 -0
- package/dist/home/homePane.js +60 -55
- package/dist/home/homePane.js.map +1 -1
- package/dist/humanReadablePane.js +135 -0
- package/dist/humanReadablePane.js.map +1 -0
- package/dist/imagePane.js +70 -0
- package/dist/imagePane.js.map +1 -0
- package/dist/index.js +86 -25
- package/dist/index.js.map +1 -1
- package/dist/internal/internalPane.js +168 -179
- package/dist/internal/internalPane.js.map +1 -1
- package/dist/mainPage/footer.js +13 -7
- package/dist/mainPage/footer.js.map +1 -1
- package/dist/mainPage/header.js +59 -58
- package/dist/mainPage/header.js.map +1 -1
- package/dist/mainPage/index.js +19 -24
- package/dist/mainPage/index.js.map +1 -1
- package/dist/microblogPane/microblogPane.js +1031 -0
- package/dist/microblogPane/microblogPane.js.map +1 -0
- package/dist/n3Pane.js +56 -0
- package/dist/n3Pane.js.map +1 -0
- package/dist/outline/context.js +17 -11
- package/dist/outline/context.js.map +1 -1
- package/dist/outline/manager.js +1997 -0
- package/dist/outline/manager.js.map +1 -0
- package/dist/outline/outlineIcons.js +127 -0
- package/dist/outline/outlineIcons.js.map +1 -0
- package/dist/outline/propertyViews.js +39 -28
- package/dist/outline/propertyViews.js.map +1 -1
- package/dist/outline/queryByExample.js +285 -0
- package/dist/outline/queryByExample.js.map +1 -0
- package/dist/outline/userInput.js +1819 -0
- package/dist/outline/userInput.js.map +1 -0
- package/dist/outline/viewAsImage.js +13 -5
- package/dist/outline/viewAsImage.js.map +1 -1
- package/dist/outline/viewAsMbox.js +20 -11
- package/dist/outline/viewAsMbox.js.map +1 -1
- package/dist/pad/padPane.js +395 -404
- package/dist/pad/padPane.js.map +1 -1
- package/dist/playlist/playlistPane.js +124 -0
- package/dist/playlist/playlistPane.js.map +1 -0
- package/dist/registerPanes.js +146 -0
- package/dist/registerPanes.js.map +1 -0
- package/dist/schedule/schedulePane.js +888 -0
- package/dist/schedule/schedulePane.js.map +1 -0
- package/dist/sharing/sharingPane.js +36 -32
- package/dist/sharing/sharingPane.js.map +1 -1
- package/dist/slideshow/slideshowPane.js +80 -0
- package/dist/slideshow/slideshowPane.js.map +1 -0
- package/dist/socialPane.js +430 -0
- package/dist/socialPane.js.map +1 -0
- package/dist/tabbed/tabbedPane.js +54 -51
- package/dist/tabbed/tabbedPane.js.map +1 -1
- package/dist/tableViewPane.js +57 -0
- package/dist/tableViewPane.js.map +1 -0
- package/dist/transaction/pane.js +478 -0
- package/dist/transaction/pane.js.map +1 -0
- package/dist/transaction/period.js +324 -0
- package/dist/transaction/period.js.map +1 -0
- package/dist/trip/tripPane.js +175 -0
- package/dist/trip/tripPane.js.map +1 -0
- package/dist/trustedApplications/trustedApplications.dom.js +134 -146
- package/dist/trustedApplications/trustedApplications.dom.js.map +1 -1
- package/dist/trustedApplications/trustedApplications.utils.js +20 -20
- package/dist/trustedApplications/trustedApplications.utils.js.map +1 -1
- package/dist/trustedApplications/trustedApplications.view.js +51 -57
- package/dist/trustedApplications/trustedApplications.view.js.map +1 -1
- package/dist/ui/pane.js +147 -0
- package/dist/ui/pane.js.map +1 -0
- package/dist/versionInfo.js +35 -29
- package/dist/versionInfo.js.map +1 -1
- package/dist/video/videoPane.js +43 -0
- package/dist/video/videoPane.js.map +1 -0
- package/package.json +8 -6
- package/dist/types.d.ts +0 -30
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basicPreferences.js","sourceRoot":"","sources":["../../src/dashboard/basicPreferences.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAA6B,KAAK,EAAS,MAAM,QAAQ,CAAA;AAChE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AACpD,OAAO,YAAY,MAAM,oBAAoB,CAAA;AAC7C,OAAO,mBAAmB,MAAM,2BAA2B,CAAA;AAE3D,MAAM,CAAC,MAAM,oBAAoB,GAAmB;IAClD,IAAI,EAAE,KAAK,CAAC,QAAQ,GAAG,gCAAgC;IACvD,IAAI,EAAE,kBAAkB;IACxB,KAAK,EAAE,QAAQ,CAAC,EAAE;QAChB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,kBAAkB;IAClB,4CAA4C;IAC5C,MAAM,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE;QAC3B,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;QACvB,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,KAAc,CAAA;QAE5C,SAAS,aAAa,CAAE,EAAW,EAAE,IAAS;YAC5C,IAAI,EAAE;gBAAE,OAAM;YACd,SAAS,CAAC,WAAW,CAAC,OAAO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AG,OAAO,CAAA;IAEjC,MAAM,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAA;IACjE,YAAY,CAAC,SAAS,GAAG,KAAK,CAAA;IAE9B,OAAO,OAAO,CAAA;AAChB,CAAC"}
|
|
1
|
+
{"version":3,"file":"basicPreferences.js","names":["_rdflib","require","_solidUi","ontologyData","preferencesFormText","basicPreferencesPane","exports","icon","icons","iconBase","name","label","_subject","render","subject","context","dom","store","session","complainIfBad","ok","mess","container","appendChild","widgets","errorMessageBlock","createElement","formArea","setupUserTypesSection","loadData","doc","turtle","holds","undefined","parse","uri","preferencesForm","sym","ontologyExtra","doRender","renderContext","login","ensureLoadedPreferences","div","preferencesFile","console","log","preferencesFileError","appendedForm","appendForm","me","style","borderStyle","trustedApplicationsView","paneRegistry","byName","addDeleteSection","formContainer","createSection","description","innerText","userTypesLink","href","_default","default","profile","section","podServerNodes","each","ns","space","podServers","map","node","value","list","forEach","server","deletionLink","generateDeletionLink","listItem","podServer","link","textContent","deletionUrl","getDeletionUrlForServer","singleUserUrl","URL","multiUserUrl","pathname","hostnameParts","hostname","split","slice","join","multiUserNssResponse","fetch","method","singleUserNssResponse","title","border","borderRadius","padding","marginTop","titleElement"],"sources":["../../src/dashboard/basicPreferences.ts"],"sourcesContent":["import { PaneDefinition } from 'pane-registry'\nimport { IndexedFormula, NamedNode, parse, Store } from 'rdflib'\nimport { icons, login, ns, widgets } from 'solid-ui'\nimport ontologyData from './ontologyData.ttl'\nimport preferencesFormText from './preferencesFormText.ttl'\n\nexport const basicPreferencesPane: PaneDefinition = {\n icon: icons.iconBase + 'noun_Sliders_341315_000000.svg',\n name: 'basicPreferences',\n label: _subject => {\n return null\n },\n\n // Render the pane\n // The subject should be the logged in user.\n render: (subject, context) => {\n const dom = context.dom\n const store = context.session.store as Store\n\n function complainIfBad (ok: Boolean, mess: any) {\n if (ok) return\n container.appendChild(widgets.errorMessageBlock(dom, mess, '#fee'))\n }\n\n const container = dom.createElement('div')\n\n const formArea = setupUserTypesSection(container, dom)\n\n function loadData (doc: NamedNode, turtle: String) {\n doc = doc.doc() // remove # from URI if nec\n if (!store.holds(undefined, undefined, undefined, doc)) {\n // If not loaded already\n ;(parse as any)(turtle, store, doc.uri, 'text/turtle', null) // Load form directly\n }\n }\n\n const preferencesForm = store.sym(\n 'urn:uuid:93774ba1-d3b6-41f2-85b6-4ae27ffd2597#this'\n )\n loadData(preferencesForm, preferencesFormText)\n\n const ontologyExtra = store.sym(\n 'urn:uuid:93774ba1-d3b6-41f2-85b6-4ae27ffd2597-ONT'\n )\n loadData(ontologyExtra, ontologyData)\n\n async function doRender () {\n const renderContext = await login.ensureLoadedPreferences({\n dom,\n div: container\n })\n if (!renderContext.preferencesFile) {\n // Could be CORS\n console.log(\n 'Not doing private class preferences as no access to preferences file. ' +\n renderContext.preferencesFileError\n )\n return\n }\n const appendedForm = widgets.appendForm(\n dom,\n formArea,\n {},\n renderContext.me,\n preferencesForm,\n renderContext.preferencesFile,\n complainIfBad\n )\n appendedForm.style.borderStyle = 'none'\n\n const trustedApplicationsView = context.session.paneRegistry.byName('trustedApplications')\n if (trustedApplicationsView) {\n container.appendChild(trustedApplicationsView.render(null, context))\n }\n\n // @@ TODO Remove need for casting as any and bang (!) syntax\n addDeleteSection(container, store, renderContext.me!, dom)\n }\n\n doRender()\n\n return container\n }\n}\n\nfunction setupUserTypesSection (\n container: Element,\n dom: HTMLDocument\n): Element {\n const formContainer = createSection(container, dom, 'User types')\n\n const description = formContainer.appendChild(dom.createElement('p'))\n description.innerText = 'Here you can self-assign user types to help the data browser know which views you would like to access.'\n\n const userTypesLink = formContainer.appendChild(dom.createElement('a'))\n userTypesLink.href = 'https://github.com/solidos/userguide/#role'\n userTypesLink.innerText = 'Read more'\n\n const formArea = formContainer.appendChild(dom.createElement('div'))\n\n return formArea\n}\n\nexport default basicPreferencesPane\n\n// ends\n\nfunction addDeleteSection (\n container: HTMLElement,\n store: IndexedFormula,\n profile: NamedNode,\n dom: HTMLDocument\n): void {\n const section = createSection(container, dom, 'Delete account')\n\n const podServerNodes = store.each(profile, ns.space('storage'), null, profile.doc())\n const podServers = podServerNodes.map(node => node.value)\n\n const list = section.appendChild(dom.createElement('ul'))\n\n podServers.forEach(async server => {\n const deletionLink = await generateDeletionLink(server, dom)\n if (deletionLink) {\n const listItem = list.appendChild(dom.createElement('li'))\n listItem.appendChild(deletionLink)\n }\n })\n}\n\nasync function generateDeletionLink (\n podServer: string,\n dom: HTMLDocument\n): Promise<HTMLElement | null> {\n const link = dom.createElement('a')\n link.textContent = `Delete your account at ${podServer}`\n const deletionUrl = await getDeletionUrlForServer(podServer)\n if (typeof deletionUrl !== 'string') {\n return null\n }\n link.href = deletionUrl\n return link\n}\n\n/**\n * Hacky way to get the deletion link to a Pod\n *\n * This function infers the deletion link by assuming the URL structure of Node Solid server.\n * In the future, Solid will hopefully provide a standardised way of discovering the deletion link:\n * https://github.com/solidos/data-interoperability-panel/issues/18\n *\n * If NSS is in multi-user mode (the case on inrupt.net and solid.community), the deletion URL for\n * vincent.dev.inrupt.net would be at dev.inrupt.net/account/delete. In single-user mode, the\n * deletion URL would be at vincent.dev.inrupt.net/account/delete.\n *\n * @param server Pod server containing the user's account.\n * @returns URL of the page that Node Solid Server would offer to delete the account, or null if\n * the URLs we tried give invalid responses.\n */\nasync function getDeletionUrlForServer (\n server: string\n): Promise<string | null> {\n const singleUserUrl = new URL(server)\n const multiUserUrl = new URL(server)\n multiUserUrl.pathname = singleUserUrl.pathname = '/account/delete'\n\n const hostnameParts = multiUserUrl.hostname.split('.')\n // Remove `vincent.` from `vincent.dev.inrupt.net`, for example:\n multiUserUrl.hostname = hostnameParts.slice(1).join('.')\n\n const multiUserNssResponse = await fetch(multiUserUrl.href, {\n method: 'HEAD'\n })\n if (multiUserNssResponse.ok) {\n return multiUserUrl.href\n }\n\n const singleUserNssResponse = await fetch(singleUserUrl.href, {\n method: 'HEAD'\n })\n if (singleUserNssResponse.ok) {\n return singleUserUrl.href\n }\n return null\n}\n\nfunction createSection (\n container: Element,\n dom: HTMLDocument,\n title: string\n): Element {\n const section = container.appendChild(dom.createElement('div'))\n section.style.border = '0.3em solid #418d99'\n section.style.borderRadius = '0.5em'\n section.style.padding = '0.7em'\n section.style.marginTop = '0.7em'\n\n const titleElement = section.appendChild(dom.createElement('h3'))\n titleElement.innerText = title\n\n return section\n}\n"],"mappings":";;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAAoD;AAAA,MAAAE,YAAA;AAAA;AAAA,MAAAC,mBAAA;AAI7C,MAAMC,oBAAoC,GAAAC,OAAA,CAAAD,oBAAA,GAAG;EAClDE,IAAI,EAAEC,cAAK,CAACC,QAAQ,GAAG,gCAAgC;EACvDC,IAAI,EAAE,kBAAkB;EACxBC,KAAK,EAAEC,QAAQ,IAAI;IACjB,OAAO,IAAI;EACb,CAAC;EAED;EACA;EACAC,MAAM,EAAEA,CAACC,OAAO,EAAEC,OAAO,KAAK;IAC5B,MAAMC,GAAG,GAAGD,OAAO,CAACC,GAAG;IACvB,MAAMC,KAAK,GAAGF,OAAO,CAACG,OAAO,CAACD,KAAc;IAE5C,SAASE,aAAaA,CAAEC,EAAW,EAAEC,IAAS,EAAE;MAC9C,IAAID,EAAE,EAAE;MACRE,SAAS,CAACC,WAAW,CAACC,gBAAO,CAACC,iBAAiB,CAACT,GAAG,EAAEK,IAAI,EAAE,MAAM,CAAC,CAAC;IACrE;IAEA,MAAMC,SAAS,GAAGN,GAAG,CAACU,aAAa,CAAC,KAAK,CAAC;IAE1C,MAAMC,QAAQ,GAAGC,qBAAqB,CAACN,SAAS,EAAEN,GAAG,CAAC;IAEtD,SAASa,QAAQA,CAAEC,GAAc,EAAEC,MAAc,EAAE;MACjDD,GAAG,GAAGA,GAAG,CAACA,GAAG,CAAC,CAAC,EAAC;MAChB,IAAI,CAACb,KAAK,CAACe,KAAK,CAACC,SAA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AAE;IAC1DmC,MAAM,EAAE;EACV,CAAC,CAAC;EACF,IAAIF,oBAAoB,CAAC3E,EAAE,EAAE;IAC3B,OAAOoE,YAAY,CAAC1B,IAAI;EAC1B;EAEA,MAAMoC,qBAAqB,GAAG,MAAMF,KAAK,CAACV,aAAa,CAACxB,IAAI,EAAE;IAC5DmC,MAAM,EAAE;EACV,CAAC,CAAC;EACF,IAAIC,qBAAqB,CAAC9E,EAAE,EAAE;IAC5B,OAAOkE,aAAa,CAACxB,IAAI;EAC3B;EACA,OAAO,IAAI;AACb;AAEA,SAASJ,aAAaA,CACpBpC,SAAkB,EAClBN,GAAiB,EACjBmF,KAAa,EACJ;EACT,MAAMjC,OAAO,GAAG5C,SAAS,CAACC,WAAW,CAACP,GAAG,CAACU,aAAa,CAAC,KAAK,CAAC,CAAC;EAC/DwC,OAAO,CAACf,KAAK,CAACiD,MAAM,GAAG,qBAAqB;EAC5ClC,OAAO,CAACf,KAAK,CAACkD,YAAY,GAAG,OAAO;EACpCnC,OAAO,CAACf,KAAK,CAACmD,OAAO,GAAG,OAAO;EAC/BpC,OAAO,CAACf,KAAK,CAACoD,SAAS,GAAG,OAAO;EAEjC,MAAMC,YAAY,GAAGtC,OAAO,CAAC3C,WAAW,CAACP,GAAG,CAACU,aAAa,CAAC,IAAI,CAAC,CAAC;EACjE8E,YAAY,CAAC5C,SAAS,GAAGuC,KAAK;EAE9B,OAAOjC,OAAO;AAChB","ignoreList":[]}
|
|
@@ -1,63 +1,69 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const container = dom.createElement('div');
|
|
18
|
-
const runBuildPage = () => {
|
|
19
|
-
container.innerHTML = '';
|
|
20
|
-
buildPage(container, authn.currentUser() || null, context, subject);
|
|
21
|
-
};
|
|
22
|
-
authSession.events.on('login', () => {
|
|
23
|
-
// console.log('On Login')
|
|
24
|
-
runBuildPage();
|
|
25
|
-
});
|
|
26
|
-
authSession.events.on('sessionRestore', () => {
|
|
27
|
-
// console.log('On Session Restore')
|
|
28
|
-
runBuildPage();
|
|
29
|
-
});
|
|
30
|
-
// console.log('Initial Load')
|
|
31
|
-
runBuildPage();
|
|
32
|
-
return container;
|
|
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
|
+
console.log();
|
|
15
|
+
if (subject.uri === subject.site().uri) {
|
|
16
|
+
return 'Dashboard';
|
|
33
17
|
}
|
|
18
|
+
return null;
|
|
19
|
+
},
|
|
20
|
+
render: (subject, context) => {
|
|
21
|
+
console.log('Dashboard Pane Render');
|
|
22
|
+
const dom = context.dom;
|
|
23
|
+
const container = dom.createElement('div');
|
|
24
|
+
const runBuildPage = () => {
|
|
25
|
+
container.innerHTML = '';
|
|
26
|
+
buildPage(container, _solidLogic.authn.currentUser() || null, context, subject);
|
|
27
|
+
};
|
|
28
|
+
_solidLogic.authSession.events.on('login', () => {
|
|
29
|
+
// console.log('On Login')
|
|
30
|
+
runBuildPage();
|
|
31
|
+
});
|
|
32
|
+
_solidLogic.authSession.events.on('sessionRestore', () => {
|
|
33
|
+
// console.log('On Session Restore')
|
|
34
|
+
runBuildPage();
|
|
35
|
+
});
|
|
36
|
+
// console.log('Initial Load')
|
|
37
|
+
runBuildPage();
|
|
38
|
+
return container;
|
|
39
|
+
}
|
|
34
40
|
};
|
|
35
41
|
function buildPage(container, webId, context, subject) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
// if uri then SolidOS is a browse.html web app
|
|
43
|
+
const uri = new URL(window.location.href).searchParams.get('uri');
|
|
44
|
+
if (webId && (uri || webId.site().uri === subject.site().uri)) {
|
|
45
|
+
return buildDashboard(container, context);
|
|
46
|
+
}
|
|
47
|
+
return buildHomePage(container, subject);
|
|
42
48
|
}
|
|
43
49
|
function buildDashboard(container, context) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
.getDashboard()
|
|
49
|
-
.then((dashboard) => container.appendChild(dashboard));
|
|
50
|
+
// console.log('build dashboard')
|
|
51
|
+
// @@ TODO get a proper type
|
|
52
|
+
const outliner = context.getOutliner(context.dom);
|
|
53
|
+
outliner.getDashboard().then(dashboard => container.appendChild(dashboard));
|
|
50
54
|
}
|
|
51
55
|
function buildHomePage(container, subject) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
// console.log('build home page')
|
|
57
|
+
const wrapper = document.createElement('div');
|
|
58
|
+
container.appendChild(wrapper);
|
|
59
|
+
const shadow = wrapper.attachShadow({
|
|
60
|
+
mode: 'open'
|
|
61
|
+
});
|
|
62
|
+
const link = document.createElement('link');
|
|
63
|
+
link.rel = 'stylesheet';
|
|
64
|
+
link.href = '/common/css/bootstrap.min.css';
|
|
65
|
+
shadow.appendChild(link);
|
|
66
|
+
(0, _homepage.generateHomepage)(subject, _solidLogic.store, _solidLogic.store.fetcher).then(homepage => shadow.appendChild(homepage));
|
|
61
67
|
}
|
|
62
|
-
|
|
68
|
+
var _default = exports.default = dashboardPane;
|
|
63
69
|
//# sourceMappingURL=dashboardPane.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboardPane.js","
|
|
1
|
+
{"version":3,"file":"dashboardPane.js","names":["_solidUi","require","_solidLogic","_homepage","dashboardPane","exports","icon","icons","iconBase","name","label","subject","console","log","uri","site","render","context","dom","container","createElement","runBuildPage","innerHTML","buildPage","authn","currentUser","authSession","events","on","webId","URL","window","location","href","searchParams","get","buildDashboard","buildHomePage","outliner","getOutliner","getDashboard","then","dashboard","appendChild","wrapper","document","shadow","attachShadow","mode","link","rel","generateHomepage","store","fetcher","homepage","_default","default"],"sources":["../../src/dashboard/dashboardPane.ts"],"sourcesContent":["import { icons } from 'solid-ui'\nimport { authn, authSession, store } from 'solid-logic'\nimport { Fetcher, NamedNode } from 'rdflib'\nimport { generateHomepage } from './homepage'\nimport { DataBrowserContext, PaneDefinition } from 'pane-registry'\n\nexport const dashboardPane: PaneDefinition = {\n icon: icons.iconBase + 'noun_547570.svg',\n name: 'dashboard',\n label: subject => {\n console.log()\n if (subject.uri === subject.site().uri) {\n return 'Dashboard'\n }\n return null\n },\n render: (subject, context) => {\n console.log('Dashboard Pane Render')\n const dom = context.dom\n const container = dom.createElement('div')\n const runBuildPage = () => {\n container.innerHTML = ''\n buildPage(\n container,\n authn.currentUser() || null,\n context,\n subject\n )\n }\n\n authSession.events.on('login', () => {\n // console.log('On Login')\n runBuildPage()\n })\n authSession.events.on('sessionRestore', () => {\n // console.log('On Session Restore')\n runBuildPage()\n })\n // console.log('Initial Load')\n runBuildPage()\n\n return container\n }\n}\n\nfunction buildPage (\n container: HTMLElement,\n webId: NamedNode | null,\n context: DataBrowserContext,\n subject: NamedNode\n) {\n // if uri then SolidOS is a browse.html web app\n const uri = (new URL(window.location.href)).searchParams.get('uri')\n if (webId && (uri || webId.site().uri === subject.site().uri)) {\n return buildDashboard(container, context)\n }\n return buildHomePage(container, subject)\n}\n\nfunction buildDashboard (container: HTMLElement, context: DataBrowserContext) {\n // console.log('build dashboard')\n // @@ TODO get a proper type\n const outliner: any = context.getOutliner(context.dom)\n outliner\n .getDashboard()\n .then((dashboard: HTMLElement) => container.appendChild(dashboard))\n}\n\nfunction buildHomePage (container: HTMLElement, subject: NamedNode) {\n // console.log('build home page')\n const wrapper = document.createElement('div')\n container.appendChild(wrapper)\n const shadow = wrapper.attachShadow({ mode: 'open' })\n const link = document.createElement('link')\n link.rel = 'stylesheet'\n link.href = '/common/css/bootstrap.min.css'\n shadow.appendChild(link)\n generateHomepage(subject, store, store.fetcher as Fetcher).then(homepage =>\n shadow.appendChild(homepage)\n )\n}\n\nexport default dashboardPane\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAF,OAAA;AAGO,MAAMG,aAA6B,GAAAC,OAAA,CAAAD,aAAA,GAAG;EAC3CE,IAAI,EAAEC,cAAK,CAACC,QAAQ,GAAG,iBAAiB;EACxCC,IAAI,EAAE,WAAW;EACjBC,KAAK,EAAEC,OAAO,IAAI;IAChBC,OAAO,CAACC,GAAG,CAAC,CAAC;IACb,IAAIF,OAAO,CAACG,GAAG,KAAKH,OAAO,CAACI,IAAI,CAAC,CAAC,CAACD,GAAG,EAAE;MACtC,OAAO,WAAW;IACpB;IACA,OAAO,IAAI;EACb,CAAC;EACDE,MAAM,EAAEA,CAACL,OAAO,EAAEM,OAAO,KAAK;IAC5BL,OAAO,CAACC,GAAG,CAAC,uBAAuB,CAAC;IACpC,MAAMK,GAAG,GAAGD,OAAO,CAACC,GAAG;IACvB,MAAMC,SAAS,GAAGD,GAAG,CAACE,aAAa,CAAC,KAAK,CAAC;IAC1C,MAAMC,YAAY,GAAGA,CAAA,KAAM;MACzBF,SAAS,CAACG,SAAS,GAAG,EAAE;MACxBC,SAAS,CACPJ,SAAS,EACTK,iBAAK,CAACC,WAAW,CAAC,CAAC,IAAI,IAAI,EAC3BR,OAAO,EACPN,OACF,CAAC;IACH,CAAC;IAEDe,uB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G,YAAY,CAAC;IAAEC,IAAI,EAAE;EAAO,CAAC,CAAC;EACrD,MAAMC,IAAI,GAAGJ,QAAQ,CAACzB,aAAa,CAAC,MAAM,CAAC;EAC3C6B,IAAI,CAACC,GAAG,GAAG,YAAY;EACvBD,IAAI,CAAChB,IAAI,GAAG,+BAA+B;EAC3Ca,MAAM,CAACH,WAAW,CAACM,IAAI,CAAC;EACxB,IAAAE,0BAAgB,EAACxC,OAAO,EAAEyC,iBAAK,EAAEA,iBAAK,CAACC,OAAkB,CAAC,CAACZ,IAAI,CAACa,QAAQ,IACtER,MAAM,CAACH,WAAW,CAACW,QAAQ,CAC7B,CAAC;AACH;AAAC,IAAAC,QAAA,GAAAlD,OAAA,CAAAmD,OAAA,GAEcpD,aAAa","ignoreList":[]}
|
|
@@ -1,63 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
wrapper.classList.add('container');
|
|
18
|
-
wrapper.appendChild(createTitle(ownersProfile.uri, name));
|
|
19
|
-
wrapper.appendChild(createDataSection(name));
|
|
20
|
-
return wrapper;
|
|
21
|
-
});
|
|
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, 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;
|
|
22
17
|
}
|
|
23
18
|
function createDataSection(name) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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;
|
|
37
32
|
}
|
|
38
33
|
function createTitle(uri, name) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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;
|
|
48
43
|
}
|
|
49
|
-
function loadProfile(subject, fetcher) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return webId;
|
|
56
|
-
});
|
|
44
|
+
async function loadProfile(subject, 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
|
+
await fetcher.load(webId);
|
|
49
|
+
return webId;
|
|
57
50
|
}
|
|
58
51
|
function getName(store, ownersProfile) {
|
|
59
|
-
|
|
60
|
-
store.anyValue(ownersProfile, ns.foaf('name'), null, ownersProfile.doc()) ||
|
|
61
|
-
new URL(ownersProfile.uri).host.split('.')[0]);
|
|
52
|
+
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];
|
|
62
53
|
}
|
|
63
54
|
//# sourceMappingURL=homepage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"homepage.js","
|
|
1
|
+
{"version":3,"file":"homepage.js","names":["_rdflib","require","_solidUi","generateHomepage","subject","store","fetcher","ownersProfile","loadProfile","name","getName","wrapper","document","createElement","classList","add","appendChild","createTitle","uri","createDataSection","dataSection","title","innerText","listGroup","publicDataLink","href","window","location","profileLink","profileLinkPost","pod","site","webId","sym","load","anyValue","ns","vcard","doc","foaf","URL","host","split"],"sources":["../../src/dashboard/homepage.ts"],"sourcesContent":["import { Fetcher, IndexedFormula, NamedNode, sym } from 'rdflib'\nimport { ns } from 'solid-ui'\n\nexport async function generateHomepage (\n subject: NamedNode,\n store: IndexedFormula,\n fetcher: Fetcher\n): Promise<HTMLElement> {\n const ownersProfile = await loadProfile(subject, fetcher)\n const name = getName(store, ownersProfile)\n\n const wrapper = document.createElement('div')\n wrapper.classList.add('container')\n wrapper.appendChild(createTitle(ownersProfile.uri, name))\n wrapper.appendChild(createDataSection(name))\n\n return wrapper\n}\n\nfunction createDataSection (name: string): HTMLElement {\n const dataSection = document.createElement('section')\n\n const title = document.createElement('h2')\n title.innerText = 'Data'\n dataSection.appendChild(title)\n\n const listGroup = document.createElement('div')\n listGroup.classList.add('list-group')\n dataSection.appendChild(listGroup)\n\n const publicDataLink = document.createElement('a')\n publicDataLink.classList.add('list-group-item')\n publicDataLink.href = window.document.location.href + 'public/'\n publicDataLink.innerText = `View ${name}'s files`\n listGroup.appendChild(publicDataLink)\n\n return dataSection\n}\n\nfunction createTitle (uri: string, name: string): HTMLElement {\n const profileLink = document.createElement('a')\n profileLink.href = uri\n profileLink.innerText = name\n\n const profileLinkPost = document.createElement('span')\n profileLinkPost.innerText = '\\'s Pod'\n\n const title = document.createElement('h1')\n title.appendChild(profileLink)\n title.appendChild(profileLinkPost)\n\n return title\n}\n\nasync function loadProfile (\n subject: NamedNode,\n fetcher: Fetcher\n): Promise<NamedNode> {\n const pod = subject.site().uri\n // TODO: This is a hack - we cannot assume that the profile is at this document, but we will live with it for now\n const webId = sym(`${pod}profile/card#me`)\n await fetcher.load(webId)\n return webId\n}\n\nfunction getName (store: IndexedFormula, ownersProfile: NamedNode): string {\n return (\n store.anyValue(ownersProfile, ns.vcard('fn'), null, ownersProfile.doc()) ||\n store.anyValue(ownersProfile, ns.foaf('name'), null, ownersProfile.doc()) ||\n new URL(ownersProfile.uri).host.split('.')[0]\n )\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAEO,eAAeE,gBAAgBA,CACpCC,OAAkB,EAClBC,KAAqB,EACrBC,OAAgB,EACM;EACtB,MAAMC,aAAa,GAAG,MAAMC,WAAW,CAACJ,OAAO,EAAEE,OAAO,CAAC;EACzD,MAAMG,IAAI,GAAGC,OAAO,CAACL,KAAK,EAAEE,aAAa,CAAC;EAE1C,MAAMI,OAAO,GAAGC,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;EAC7CF,OAAO,CAACG,SAAS,CAACC,GAAG,CAAC,WAAW,CAAC;EAClCJ,OA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AAMD,KAAK,GAAGT,QAAQ,CAACC,aAAa,CAAC,IAAI,CAAC;EAC1CQ,KAAK,CAACL,WAAW,CAACY,WAAW,CAAC;EAC9BP,KAAK,CAACL,WAAW,CAACa,eAAe,CAAC;EAElC,OAAOR,KAAK;AACd;AAEA,eAAeb,WAAWA,CACxBJ,OAAkB,EAClBE,OAAgB,EACI;EACpB,MAAMwB,GAAG,GAAG1B,OAAO,CAAC2B,IAAI,CAAC,CAAC,CAACb,GAAG;EAC9B;EACA,MAAMc,KAAK,GAAG,IAAAC,WAAG,EAAC,GAAGH,GAAG,iBAAiB,CAAC;EAC1C,MAAMxB,OAAO,CAAC4B,IAAI,CAACF,KAAK,CAAC;EACzB,OAAOA,KAAK;AACd;AAEA,SAAStB,OAAOA,CAAEL,KAAqB,EAAEE,aAAwB,EAAU;EACzE,OACEF,KAAK,CAAC8B,QAAQ,CAAC5B,aAAa,EAAE6B,WAAE,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE9B,aAAa,CAAC+B,GAAG,CAAC,CAAC,CAAC,IACxEjC,KAAK,CAAC8B,QAAQ,CAAC5B,aAAa,EAAE6B,WAAE,CAACG,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,EAAEhC,aAAa,CAAC+B,GAAG,CAAC,CAAC,CAAC,IACzE,IAAIE,GAAG,CAACjC,aAAa,CAACW,GAAG,CAAC,CAACuB,IAAI,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAEjD","ignoreList":[]}
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.dataContentPane = void 0;
|
|
7
|
+
var UI = _interopRequireWildcard(require("solid-ui"));
|
|
8
|
+
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); }
|
|
9
|
+
/* Data content Pane
|
|
10
|
+
**
|
|
11
|
+
** This pane shows the content of a particular RDF resource
|
|
12
|
+
** or at least the RDF semantics we attribute to that resource.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
// To do: - Only take data from one graph
|
|
16
|
+
// - Only do forwards not backward?
|
|
17
|
+
// - Expand automatically all the way down
|
|
18
|
+
// - original source view? Use ffox view source
|
|
19
|
+
|
|
20
|
+
const ns = UI.ns;
|
|
21
|
+
const dataContentPane = exports.dataContentPane = {
|
|
22
|
+
icon: UI.icons.originalIconBase + 'rdf_flyer.24.gif',
|
|
23
|
+
name: 'dataContents',
|
|
24
|
+
audience: [ns.solid('Developer')],
|
|
25
|
+
label: function (subject, context) {
|
|
26
|
+
if ('http://www.w3.org/2007/ont/link#ProtocolEvent' in context.session.store.findTypeURIs(subject)) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
const n = context.session.store.statementsMatching(undefined, undefined, undefined, subject).length;
|
|
30
|
+
if (n === 0) return null;
|
|
31
|
+
return 'Data (' + n + ')';
|
|
32
|
+
},
|
|
33
|
+
/*
|
|
34
|
+
shouldGetFocus: function(subject) {
|
|
35
|
+
return store.whether(subject, UI.ns.rdf('type'), UI.ns.link('RDFDocument'))
|
|
36
|
+
},
|
|
37
|
+
*/
|
|
38
|
+
statementsAsTables: function statementsAsTables(sts, context, initialRoots) {
|
|
39
|
+
const myDocument = context.dom;
|
|
40
|
+
// const outliner = context.getOutliner(myDocument)
|
|
41
|
+
const rep = myDocument.createElement('table');
|
|
42
|
+
const sz = UI.rdf.Serializer(context.session.store);
|
|
43
|
+
const res = sz.rootSubjects(sts);
|
|
44
|
+
let roots = res.roots;
|
|
45
|
+
const subjects = res.subjects;
|
|
46
|
+
const loopBreakers = res.loopBreakers;
|
|
47
|
+
for (const x in loopBreakers) {
|
|
48
|
+
console.log('\tdataContentPane: loopbreaker:' + x);
|
|
49
|
+
}
|
|
50
|
+
const doneBnodes = {}; // For preventing looping
|
|
51
|
+
const referencedBnodes = {}; // Bnodes which need to be named alas
|
|
52
|
+
|
|
53
|
+
// The property tree for a single subject or anonymous node
|
|
54
|
+
function propertyTree(subject) {
|
|
55
|
+
// print('Proprty tree for '+subject)
|
|
56
|
+
const rep = myDocument.createElement('table');
|
|
57
|
+
let lastPred = null;
|
|
58
|
+
const sts = subjects[sz.toStr(subject)]; // relevant statements
|
|
59
|
+
if (!sts) {
|
|
60
|
+
// No statements in tree
|
|
61
|
+
rep.appendChild(myDocument.createTextNode('...')); // just empty bnode as object
|
|
62
|
+
return rep;
|
|
63
|
+
}
|
|
64
|
+
sts.sort();
|
|
65
|
+
let same = 0;
|
|
66
|
+
let predicateTD; // The cell which holds the predicate
|
|
67
|
+
for (let i = 0; i < sts.length; i++) {
|
|
68
|
+
const st = sts[i];
|
|
69
|
+
const tr = myDocument.createElement('tr');
|
|
70
|
+
if (st.predicate.uri !== lastPred) {
|
|
71
|
+
if (lastPred && same > 1) {
|
|
72
|
+
predicateTD.setAttribute('rowspan', '' + same);
|
|
73
|
+
}
|
|
74
|
+
predicateTD = myDocument.createElement('td');
|
|
75
|
+
predicateTD.setAttribute('class', 'pred');
|
|
76
|
+
const anchor = myDocument.createElement('a');
|
|
77
|
+
anchor.setAttribute('href', st.predicate.uri);
|
|
78
|
+
anchor.addEventListener('click', UI.widgets.openHrefInOutlineMode, true);
|
|
79
|
+
anchor.appendChild(myDocument.createTextNode(UI.utils.predicateLabelForXML(st.predicate)));
|
|
80
|
+
predicateTD.appendChild(anchor);
|
|
81
|
+
tr.appendChild(predicateTD);
|
|
82
|
+
lastPred = st.predicate.uri;
|
|
83
|
+
same = 0;
|
|
84
|
+
}
|
|
85
|
+
same++;
|
|
86
|
+
const objectTD = myDocument.createElement('td');
|
|
87
|
+
objectTD.appendChild(objectTree(st.object));
|
|
88
|
+
tr.appendChild(objectTD);
|
|
89
|
+
rep.appendChild(tr);
|
|
90
|
+
}
|
|
91
|
+
if (lastPred && same > 1) predicateTD.setAttribute('rowspan', '' + same);
|
|
92
|
+
return rep;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Convert a set of statements into a nested tree of tables
|
|
96
|
+
function objectTree(obj) {
|
|
97
|
+
let res, anchor;
|
|
98
|
+
switch (obj.termType) {
|
|
99
|
+
case 'NamedNode':
|
|
100
|
+
anchor = myDocument.createElement('a');
|
|
101
|
+
anchor.setAttribute('href', obj.uri);
|
|
102
|
+
anchor.addEventListener('click', UI.widgets.openHrefInOutlineMode, true);
|
|
103
|
+
anchor.appendChild(myDocument.createTextNode(UI.utils.label(obj)));
|
|
104
|
+
return anchor;
|
|
105
|
+
case 'Literal':
|
|
106
|
+
if (!obj.datatype || !obj.datatype.uri) {
|
|
107
|
+
res = myDocument.createElement('div');
|
|
108
|
+
res.setAttribute('style', 'white-space: pre-wrap;');
|
|
109
|
+
res.textContent = obj.value;
|
|
110
|
+
return res;
|
|
111
|
+
} else if (obj.datatype.uri === 'http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral') {
|
|
112
|
+
res = myDocument.createElement('div');
|
|
113
|
+
res.setAttribute('class', 'embeddedXHTML');
|
|
114
|
+
res.innerHTML = obj.value; // Try that @@@ beware embedded dangerous code
|
|
115
|
+
return res;
|
|
116
|
+
}
|
|
117
|
+
return myDocument.createTextNode(obj.value);
|
|
118
|
+
// placeholder - could be smarter,
|
|
119
|
+
|
|
120
|
+
case 'BlankNode':
|
|
121
|
+
{
|
|
122
|
+
if (obj.toNT() in doneBnodes) {
|
|
123
|
+
// Break infinite recursion
|
|
124
|
+
referencedBnodes[obj.toNT()] = true;
|
|
125
|
+
const anchor = myDocument.createElement('a');
|
|
126
|
+
anchor.setAttribute('href', '#' + obj.toNT().slice(2));
|
|
127
|
+
anchor.setAttribute('class', 'bnodeRef');
|
|
128
|
+
anchor.textContent = '*' + obj.toNT().slice(3);
|
|
129
|
+
return anchor;
|
|
130
|
+
}
|
|
131
|
+
doneBnodes[obj.toNT()] = true; // Flag to prevent infinite recursion in propertyTree
|
|
132
|
+
const newTable = propertyTree(obj);
|
|
133
|
+
doneBnodes[obj.toNT()] = newTable; // Track where we mentioned it first
|
|
134
|
+
if (UI.utils.ancestor(newTable, 'TABLE') && UI.utils.ancestor(newTable, 'TABLE').style.backgroundColor === 'white') {
|
|
135
|
+
newTable.style.backgroundColor = '#eee';
|
|
136
|
+
} else {
|
|
137
|
+
newTable.style.backgroundColor = 'white';
|
|
138
|
+
}
|
|
139
|
+
return newTable;
|
|
140
|
+
}
|
|
141
|
+
case 'Collection':
|
|
142
|
+
res = myDocument.createElement('table');
|
|
143
|
+
res.setAttribute('class', 'collectionAsTables');
|
|
144
|
+
for (let i = 0; i < obj.elements.length; i++) {
|
|
145
|
+
const tr = myDocument.createElement('tr');
|
|
146
|
+
res.appendChild(tr);
|
|
147
|
+
tr.appendChild(objectTree(obj.elements[i]));
|
|
148
|
+
}
|
|
149
|
+
return res;
|
|
150
|
+
case 'Graph':
|
|
151
|
+
res = context.session.paneRegistry.byName('dataContents').statementsAsTables(obj.statements, context);
|
|
152
|
+
res.setAttribute('class', 'nestedFormula');
|
|
153
|
+
return res;
|
|
154
|
+
case 'Variable':
|
|
155
|
+
res = myDocument.createTextNode('?' + obj.uri);
|
|
156
|
+
return res;
|
|
157
|
+
}
|
|
158
|
+
throw new Error('Unhandled node type: ' + obj.termType);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// roots.sort()
|
|
162
|
+
|
|
163
|
+
if (initialRoots) {
|
|
164
|
+
roots = initialRoots.concat(roots.filter(function (x) {
|
|
165
|
+
for (let i = 0; i < initialRoots.length; i++) {
|
|
166
|
+
// Max 2
|
|
167
|
+
if (x.sameTerm(initialRoots[i])) return false;
|
|
168
|
+
}
|
|
169
|
+
return true;
|
|
170
|
+
}));
|
|
171
|
+
}
|
|
172
|
+
for (let i = 0; i < roots.length; i++) {
|
|
173
|
+
const tr = myDocument.createElement('tr');
|
|
174
|
+
tr.setAttribute('style', `background-color: ${i % 2 === 0 ? '#f0f0f0' : 'white'};`);
|
|
175
|
+
rep.appendChild(tr);
|
|
176
|
+
const subjectTD = myDocument.createElement('td');
|
|
177
|
+
tr.appendChild(subjectTD);
|
|
178
|
+
const TDTree = myDocument.createElement('td');
|
|
179
|
+
tr.appendChild(TDTree);
|
|
180
|
+
const root = roots[i];
|
|
181
|
+
if (root.termType === 'BlankNode') {
|
|
182
|
+
subjectTD.appendChild(myDocument.createTextNode(UI.utils.label(root))); // Don't recurse!
|
|
183
|
+
} else {
|
|
184
|
+
subjectTD.appendChild(objectTree(root)); // won't have tree
|
|
185
|
+
}
|
|
186
|
+
TDTree.appendChild(propertyTree(root));
|
|
187
|
+
}
|
|
188
|
+
for (const bNT in referencedBnodes) {
|
|
189
|
+
// Add number to refer to
|
|
190
|
+
const table = doneBnodes[bNT];
|
|
191
|
+
// let tr = myDocument.createElement('tr')
|
|
192
|
+
const anchor = myDocument.createElement('a');
|
|
193
|
+
anchor.setAttribute('id', bNT.slice(2));
|
|
194
|
+
anchor.setAttribute('class', 'bnodeDef');
|
|
195
|
+
anchor.textContent = bNT.slice(3) + ')';
|
|
196
|
+
table.insertBefore(anchor, table.firstChild);
|
|
197
|
+
}
|
|
198
|
+
return rep;
|
|
199
|
+
},
|
|
200
|
+
// statementsAsTables
|
|
201
|
+
// View the data in a file in user-friendly way
|
|
202
|
+
render: function (subject, context) {
|
|
203
|
+
const myDocument = context.dom;
|
|
204
|
+
function alternativeRendering() {
|
|
205
|
+
const sz = UI.rdf.Serializer(context.session.store);
|
|
206
|
+
const res = sz.rootSubjects(sts);
|
|
207
|
+
const roots = res.roots;
|
|
208
|
+
const p = {};
|
|
209
|
+
p.render = function (s2) {
|
|
210
|
+
const div = myDocument.createElement('div');
|
|
211
|
+
div.setAttribute('class', 'withinDocumentPane');
|
|
212
|
+
const plist = kb.statementsMatching(s2, undefined, undefined, subject);
|
|
213
|
+
outliner.appendPropertyTRs(div, plist, false, function (_pred, _inverse) {
|
|
214
|
+
return true;
|
|
215
|
+
});
|
|
216
|
+
return div;
|
|
217
|
+
};
|
|
218
|
+
for (let i = 0; i < roots.length; i++) {
|
|
219
|
+
const tr = myDocument.createElement('TR');
|
|
220
|
+
const root = roots[i];
|
|
221
|
+
tr.style.verticalAlign = 'top';
|
|
222
|
+
const td = outliner.outlineObjectTD(root, undefined, tr);
|
|
223
|
+
tr.appendChild(td);
|
|
224
|
+
div.appendChild(tr);
|
|
225
|
+
outliner.outlineExpand(td, root, {
|
|
226
|
+
pane: p
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
function mainRendering() {
|
|
231
|
+
const initialRoots = []; // Ordering: start with stuff about this doc
|
|
232
|
+
if (kb.holds(subject, undefined, undefined, subject)) {
|
|
233
|
+
initialRoots.push(subject);
|
|
234
|
+
}
|
|
235
|
+
// Then about the primary topic of the document if any
|
|
236
|
+
const ps = kb.any(subject, UI.ns.foaf('primaryTopic'), undefined, subject);
|
|
237
|
+
if (ps) initialRoots.push(ps);
|
|
238
|
+
div.appendChild(context.session.paneRegistry.byName('dataContents').statementsAsTables(sts, context, initialRoots));
|
|
239
|
+
}
|
|
240
|
+
const outliner = context.getOutliner(myDocument);
|
|
241
|
+
const kb = context.session.store;
|
|
242
|
+
const div = myDocument.createElement('div');
|
|
243
|
+
div.setAttribute('class', 'dataContentPane');
|
|
244
|
+
// Because of smushing etc, this will not be a copy of the original source
|
|
245
|
+
// We could instead either fetch and re-parse the source,
|
|
246
|
+
// or we could keep all the pre-smushed triples.
|
|
247
|
+
const sts = kb.statementsMatching(undefined, undefined, undefined, subject); // @@ slow with current store!
|
|
248
|
+
|
|
249
|
+
// eslint-disable-next-line no-constant-condition
|
|
250
|
+
if (false) {
|
|
251
|
+
// keep code
|
|
252
|
+
alternativeRendering();
|
|
253
|
+
} else {
|
|
254
|
+
mainRendering();
|
|
255
|
+
}
|
|
256
|
+
return div;
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
//# sourceMappingURL=dataContentPane.js.map
|