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
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var UI = _interopRequireWildcard(require("solid-ui"));
|
|
8
|
+
var $rdf = _interopRequireWildcard(require("rdflib"));
|
|
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); }
|
|
10
|
+
/* Single audio play Pane
|
|
11
|
+
**
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const ns = UI.ns;
|
|
15
|
+
var _default = exports.default = {
|
|
16
|
+
icon: UI.icons.iconBase + 'noun_534313.svg',
|
|
17
|
+
name: 'audio',
|
|
18
|
+
// Does the subject deserve an audio play pane?
|
|
19
|
+
label: function (subject, context) {
|
|
20
|
+
const kb = context.session.store;
|
|
21
|
+
const typeURIs = kb.findTypeURIs(subject);
|
|
22
|
+
const prefix = $rdf.Util.mediaTypeClass('audio/*').uri.split('*')[0];
|
|
23
|
+
for (const t in typeURIs) {
|
|
24
|
+
if (t.startsWith(prefix)) return 'Play audio';
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
27
|
+
},
|
|
28
|
+
render: function (subject, context) {
|
|
29
|
+
const kb = context.session.store;
|
|
30
|
+
const dom = context.dom;
|
|
31
|
+
const options = {
|
|
32
|
+
autoplay: false,
|
|
33
|
+
chain: true,
|
|
34
|
+
chainAlbums: true,
|
|
35
|
+
loop: false
|
|
36
|
+
};
|
|
37
|
+
const removeExtension = function (str) {
|
|
38
|
+
const dot = str.lastIndexOf('.');
|
|
39
|
+
if (dot < 0) return str; // if any
|
|
40
|
+
const slash = str.lastIndexOf('/');
|
|
41
|
+
if (dot < slash) return str;
|
|
42
|
+
return str.slice(0, dot);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// True if there is another file like song.mp3 when this is "song 1.mp3"
|
|
46
|
+
// or this is song.m4a
|
|
47
|
+
//
|
|
48
|
+
const looksRedundant = function (x) {
|
|
49
|
+
const folder = kb.any(undefined, ns.ldp('contains'), x);
|
|
50
|
+
if (!folder) return false;
|
|
51
|
+
const contents = kb.each(folder, ns.ldp('contains'));
|
|
52
|
+
if (contents.length < 2) return false;
|
|
53
|
+
const thisName = x.uri;
|
|
54
|
+
for (let k = 0; k < contents.length; k++) {
|
|
55
|
+
const otherName = contents[k].uri;
|
|
56
|
+
if (thisName.length > otherName.length && thisName.startsWith(removeExtension(otherName))) {
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
if (thisName.endsWith('.m4a') && otherName.endsWith('.mp3') && removeExtension(thisName) === removeExtension(otherName)) {
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return false;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// Alternative methods could include:
|
|
67
|
+
// Accesing metadata in the audio contol, or paring the audio file
|
|
68
|
+
const guessNames = function (x) {
|
|
69
|
+
const a = x.uri.split('/').slice(-3); // Hope artist, album, track
|
|
70
|
+
const decode = function (str) {
|
|
71
|
+
try {
|
|
72
|
+
return decodeURIComponent(str);
|
|
73
|
+
} catch (e) {
|
|
74
|
+
return str;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
artistRow.textContent = decode(a[0]);
|
|
78
|
+
albumRow.textContent = decode(a[1]);
|
|
79
|
+
trackRow.textContent = decode(removeExtension(a[2]));
|
|
80
|
+
};
|
|
81
|
+
const moveOn = function (current, level) {
|
|
82
|
+
return new Promise(function (resolve) {
|
|
83
|
+
level = level || 0;
|
|
84
|
+
if (!options.chain) return resolve(null);
|
|
85
|
+
// Ideally navigate graph else cheat with URI munging:
|
|
86
|
+
const folder = kb.any(undefined, ns.ldp('contains'), current) || current.dir();
|
|
87
|
+
if (!folder) return resolve(null);
|
|
88
|
+
kb.fetcher.load(folder).then(function (_xhr) {
|
|
89
|
+
const contents = kb.each(folder, ns.ldp('contains')); // @@ load if not loaded
|
|
90
|
+
// if (contents.length < 2) return resolve(null) NO might move on from 1-track album
|
|
91
|
+
let j;
|
|
92
|
+
contents.sort(); // sort by URI which hopefully will get tracks in order
|
|
93
|
+
for (let i = 0; i < contents.length; i++) {
|
|
94
|
+
if (current.uri === contents[i].uri) {
|
|
95
|
+
j = (i + 1) % contents.length;
|
|
96
|
+
if (j === 0) {
|
|
97
|
+
if (!options.chainAlbums) {
|
|
98
|
+
if (options.loop) {
|
|
99
|
+
return resolve(contents[j]);
|
|
100
|
+
}
|
|
101
|
+
return resolve(null); // No more music needed
|
|
102
|
+
} else {
|
|
103
|
+
// chain albums
|
|
104
|
+
if (level === 1 || !options.chainAlbums) return resolve(null); // limit of navigating treee
|
|
105
|
+
moveOn(folder, level + 1).then(function (folder2) {
|
|
106
|
+
if (folder2) {
|
|
107
|
+
kb.fetcher.load(folder2).then(function (_xhr) {
|
|
108
|
+
const contents = kb.each(folder2, ns.ldp('contains'));
|
|
109
|
+
if (contents.length === 0) return resolve(null);
|
|
110
|
+
contents.sort();
|
|
111
|
+
console.log('New Album: ' + folder2);
|
|
112
|
+
return resolve(contents[0]); // Start off new album
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
} else {
|
|
118
|
+
return resolve(contents[j]);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
} // for
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
const endedListener = function (event) {
|
|
126
|
+
const current = kb.sym(event.target.getAttribute('src'));
|
|
127
|
+
if (!options.chain) return;
|
|
128
|
+
const tryNext = function (cur) {
|
|
129
|
+
const current = cur;
|
|
130
|
+
moveOn(current).then(function (next) {
|
|
131
|
+
if (!next) {
|
|
132
|
+
console.log('No successor to ' + current);
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
if (!looksRedundant(next)) {
|
|
136
|
+
console.log('Moving on to ' + next);
|
|
137
|
+
guessNames(next);
|
|
138
|
+
controlRow.appendChild(audioControl(next, true)); // Force autoplay
|
|
139
|
+
controlRow.removeChild(event.target);
|
|
140
|
+
} else {
|
|
141
|
+
console.log('Ignoring redundant ' + next);
|
|
142
|
+
tryNext(next);
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
tryNext(current);
|
|
147
|
+
};
|
|
148
|
+
const audioControl = function (song, autoplay) {
|
|
149
|
+
const audio = dom.createElement('audio');
|
|
150
|
+
audio.setAttribute('controls', 'yes');
|
|
151
|
+
// get audio with authenticated fetch
|
|
152
|
+
kb.fetcher._fetch(song.uri).then(function (response) {
|
|
153
|
+
return response.blob();
|
|
154
|
+
}).then(function (myBlob) {
|
|
155
|
+
const objectURL = URL.createObjectURL(myBlob);
|
|
156
|
+
audio.setAttribute('src', objectURL); // w640 h480 //
|
|
157
|
+
});
|
|
158
|
+
if (autoplay) {
|
|
159
|
+
audio.setAttribute('autoplay', 'autoplay'); // Make this a personal preference
|
|
160
|
+
}
|
|
161
|
+
audio.addEventListener('ended', endedListener, false);
|
|
162
|
+
return audio;
|
|
163
|
+
};
|
|
164
|
+
const div = dom.createElement('div');
|
|
165
|
+
const table = div.appendChild(dom.createElement('table'));
|
|
166
|
+
const labelStyle = 'padding: 0.3em; color:white; background-color: black;';
|
|
167
|
+
const artistRow = table.appendChild(dom.createElement('tr'));
|
|
168
|
+
artistRow.style.cssText = labelStyle;
|
|
169
|
+
const albumRow = table.appendChild(dom.createElement('tr'));
|
|
170
|
+
albumRow.style.cssText = labelStyle;
|
|
171
|
+
const trackRow = table.appendChild(dom.createElement('tr'));
|
|
172
|
+
trackRow.style.cssText = labelStyle;
|
|
173
|
+
const controlRow = table.appendChild(dom.createElement('tr'));
|
|
174
|
+
guessNames(subject);
|
|
175
|
+
controlRow.appendChild(audioControl(subject, options.autoplay));
|
|
176
|
+
if (!kb.holds(undefined, ns.ldp('contains'), subject) && subject.dir()) {
|
|
177
|
+
kb.fetcher.load(subject.dir()); // Prefetch enclosing @@ or playlist
|
|
178
|
+
}
|
|
179
|
+
return div;
|
|
180
|
+
}
|
|
181
|
+
}; // ends
|
|
182
|
+
//# sourceMappingURL=audioPane.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audioPane.js","names":["UI","_interopRequireWildcard","require","$rdf","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ns","_default","exports","icon","icons","iconBase","name","label","subject","context","kb","session","store","typeURIs","findTypeURIs","prefix","Util","mediaTypeClass","uri","split","startsWith","render","dom","options","autoplay","chain","chainAlbums","loop","removeExtension","str","dot","lastIndexOf","slash","slice","looksRedundant","x","folder","any","undefined","ldp","contents","each","length","thisName","k","otherName","endsWith","guessNames","a","decode","decodeURIComponent","artistRow","textContent","albumRow","trackRow","moveOn","current","level","Promise","resolve","dir","fetcher","load","then","_xhr","j","sort","folder2","console","log","endedListener","event","sym","target","getAttribute","tryNext","cur","next","controlRow","appendChild","audioControl","removeChild","song","audio","createElement","setAttribute","_fetch","response","blob","myBlob","objectURL","URL","createObjectURL","addEventListener","div","table","labelStyle","style","cssText","holds"],"sources":["../../src/audio/audioPane.js"],"sourcesContent":["/* Single audio play Pane\n **\n */\nimport * as UI from 'solid-ui'\nimport * as $rdf from 'rdflib'\nconst ns = UI.ns\n\nexport default {\n icon: UI.icons.iconBase + 'noun_534313.svg',\n\n name: 'audio',\n\n // Does the subject deserve an audio play pane?\n label: function (subject, context) {\n const kb = context.session.store\n const typeURIs = kb.findTypeURIs(subject)\n\n const prefix = $rdf.Util.mediaTypeClass('audio/*').uri.split('*')[0]\n for (const t in typeURIs) {\n if (t.startsWith(prefix)) return 'Play audio'\n }\n return null\n },\n\n render: function (subject, context) {\n const kb = context.session.store\n const dom = context.dom\n const options = {\n autoplay: false,\n chain: true,\n chainAlbums: true,\n loop: false\n }\n\n const removeExtension = function (str) {\n const dot = str.lastIndexOf('.')\n if (dot < 0) return str // if any\n const slash = str.lastIndexOf('/')\n if (dot < slash) return str\n return str.slice(0, dot)\n }\n\n // True if there is another file like song.mp3 when this is \"song 1.mp3\"\n // or this is song.m4a\n //\n const looksRedundant = function (x) {\n const folder = kb.any(undefined, ns.ldp('contains'), x)\n if (!folder) return false\n const contents = kb.each(folder, ns.ldp('contains'))\n if (contents.length < 2) return false\n const thisName = x.uri\n for (let k = 0; k < contents.length; k++) {\n const otherName = contents[k].uri\n if (\n thisName.length > otherName.length &&\n thisName.startsWith(removeExtension(otherName))\n ) {\n return true\n }\n if (\n thisName.endsWith('.m4a') &&\n otherName.endsWith('.mp3') &&\n removeExtension(thisName) === removeExtension(otherName)\n ) {\n return true\n }\n }\n return false\n }\n\n // Alternative methods could include:\n // Accesing metadata in the audio contol, or paring the audio file\n const guessNames = function (x) {\n const a = x.uri.split('/').slice(-3) // Hope artist, album, track\n const decode = function (str) {\n try {\n return decodeURIComponent(str)\n } catch (e) {\n return str\n }\n }\n artistRow.textContent = decode(a[0])\n albumRow.textContent = decode(a[1])\n trackRow.textContent = decode(removeExtension(a[2]))\n }\n\n const moveOn = function (current, level) {\n return new Promise(function (resolve) {\n level = level || 0\n if (!options.chain) return resolve(null)\n // Ideally navigate graph else cheat with URI munging:\n const folder =\n kb.any(undefined, ns.ldp('contains'), current) || current.dir()\n if (!folder) return resolve(null)\n kb.fetcher.load(folder).then(function (_xhr) {\n const contents = kb.each(folder, ns.ldp('contains')) // @@ load if not loaded\n // if (contents.length < 2) return resolve(null) NO might move on from 1-track album\n let j\n contents.sort() // sort by URI which hopefully will get tracks in order\n for (let i = 0; i < contents.length; i++) {\n if (current.uri === contents[i].uri) {\n j = (i + 1) % contents.length\n if (j === 0) {\n if (!options.chainAlbums) {\n if (options.loop) {\n return resolve(contents[j])\n }\n return resolve(null) // No more music needed\n } else {\n // chain albums\n if (level === 1 || !options.chainAlbums) return resolve(null) // limit of navigating treee\n moveOn(folder, level + 1).then(function (folder2) {\n if (folder2) {\n kb.fetcher.load(folder2).then(function (_xhr) {\n const contents = kb.each(folder2, ns.ldp('contains'))\n if (contents.length === 0) return resolve(null)\n contents.sort()\n console.log('New Album: ' + folder2)\n return resolve(contents[0]) // Start off new album\n })\n }\n })\n }\n } else {\n return resolve(contents[j])\n }\n }\n } // for\n })\n })\n }\n const endedListener = function (event) {\n const current = kb.sym(event.target.getAttribute('src'))\n if (!options.chain) return\n const tryNext = function (cur) {\n const current = cur\n moveOn(current).then(function (next) {\n if (!next) {\n console.log('No successor to ' + current)\n return\n }\n if (!looksRedundant(next)) {\n console.log('Moving on to ' + next)\n guessNames(next)\n controlRow.appendChild(audioControl(next, true)) // Force autoplay\n controlRow.removeChild(event.target)\n } else {\n console.log('Ignoring redundant ' + next)\n tryNext(next)\n }\n })\n }\n tryNext(current)\n }\n\n const audioControl = function (song, autoplay) {\n const audio = dom.createElement('audio')\n audio.setAttribute('controls', 'yes')\n // get audio with authenticated fetch\n kb.fetcher._fetch(song.uri)\n .then(function (response) {\n return response.blob()\n })\n .then(function (myBlob) {\n const objectURL = URL.createObjectURL(myBlob)\n audio.setAttribute('src', objectURL) // w640 h480 //\n })\n\n if (autoplay) {\n audio.setAttribute('autoplay', 'autoplay') // Make this a personal preference\n }\n audio.addEventListener('ended', endedListener, false)\n return audio\n }\n\n const div = dom.createElement('div')\n const table = div.appendChild(dom.createElement('table'))\n const labelStyle = 'padding: 0.3em; color:white; background-color: black;'\n const artistRow = table.appendChild(dom.createElement('tr'))\n artistRow.style.cssText = labelStyle\n const albumRow = table.appendChild(dom.createElement('tr'))\n albumRow.style.cssText = labelStyle\n const trackRow = table.appendChild(dom.createElement('tr'))\n trackRow.style.cssText = labelStyle\n const controlRow = table.appendChild(dom.createElement('tr'))\n guessNames(subject)\n controlRow.appendChild(audioControl(subject, options.autoplay))\n\n if (!kb.holds(undefined, ns.ldp('contains'), subject) && subject.dir()) {\n kb.fetcher.load(subject.dir()) // Prefetch enclosing @@ or playlist\n }\n\n return div\n }\n}\n\n// ends\n"],"mappings":";;;;;;AAGA,IAAAA,EAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAF,uBAAA,CAAAC,OAAA;AAA8B,SAAAD,wBAAAG,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAL,uBAAA,YAAAA,CAAAG,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GA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ict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.classInstancePane = void 0;
|
|
7
|
+
var UI = _interopRequireWildcard(require("solid-ui"));
|
|
8
|
+
var $rdf = _interopRequireWildcard(require("rdflib"));
|
|
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); }
|
|
10
|
+
/* Class member Pane
|
|
11
|
+
**
|
|
12
|
+
** This outline pane lists the members of a class
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const ns = UI.ns;
|
|
16
|
+
const classInstancePane = exports.classInstancePane = {
|
|
17
|
+
icon: UI.icons.originalIconBase + 'tango/22-folder-open.png',
|
|
18
|
+
name: 'classInstance',
|
|
19
|
+
// Create a new folder in a Solid system,
|
|
20
|
+
|
|
21
|
+
audience: [ns.solid('PowerUser')],
|
|
22
|
+
label: function (subject, context) {
|
|
23
|
+
const kb = context.session.store;
|
|
24
|
+
const n = kb.each(undefined, ns.rdf('type'), subject).length;
|
|
25
|
+
if (n > 0) return 'List (' + n + ')'; // Show how many in hover text
|
|
26
|
+
return null; // Suppress pane otherwise
|
|
27
|
+
},
|
|
28
|
+
render: function (subject, context) {
|
|
29
|
+
const dom = context.dom;
|
|
30
|
+
const outliner = context.getOutliner(dom);
|
|
31
|
+
const kb = context.session.store;
|
|
32
|
+
const complain = function complain(message, color) {
|
|
33
|
+
const pre = dom.createElement('pre');
|
|
34
|
+
pre.setAttribute('style', 'background-color: ' + color || '#eed' + ';');
|
|
35
|
+
div.appendChild(pre);
|
|
36
|
+
pre.appendChild(dom.createTextNode(message));
|
|
37
|
+
};
|
|
38
|
+
const div = dom.createElement('div');
|
|
39
|
+
div.setAttribute('class', 'instancePane');
|
|
40
|
+
div.setAttribute('style', ' border-top: solid 1px #777; border-bottom: solid 1px #777; margin-top: 0.5em; margin-bottom: 0.5em ');
|
|
41
|
+
|
|
42
|
+
// If this is a class, look for all both explicit and implicit
|
|
43
|
+
const sts = kb.statementsMatching(undefined, ns.rdf('type'), subject);
|
|
44
|
+
if (sts.length > 0) {
|
|
45
|
+
const already = {};
|
|
46
|
+
const more = [];
|
|
47
|
+
sts.forEach(st => {
|
|
48
|
+
already[st.subject.toNT()] = st;
|
|
49
|
+
});
|
|
50
|
+
for (const nt in kb.findMembersNT(subject)) {
|
|
51
|
+
if (!already[nt]) {
|
|
52
|
+
more.push($rdf.st(kb.fromNT(nt), ns.rdf('type'), subject)); // @@ no provenance
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (more.length) {
|
|
56
|
+
complain('There are ' + sts.length + ' explicit and ' + more.length + ' implicit members of ' + UI.utils.label(subject));
|
|
57
|
+
}
|
|
58
|
+
if (subject.sameTerm(ns.rdf('Property'))) {
|
|
59
|
+
// / Do not find all properties used as properties .. unless look at kb index
|
|
60
|
+
} else if (subject.sameTerm(ns.rdfs('Class'))) {
|
|
61
|
+
const uses = kb.statementsMatching(undefined, ns.rdf('type'), undefined);
|
|
62
|
+
const usedTypes = {};
|
|
63
|
+
uses.forEach(function (st) {
|
|
64
|
+
usedTypes[st.object] = st;
|
|
65
|
+
}); // Get unique
|
|
66
|
+
const used = [];
|
|
67
|
+
for (const i in usedTypes) {
|
|
68
|
+
used.push($rdf.st($rdf.sym(i), ns.rdf('type'), ns.rdfs('Class')));
|
|
69
|
+
}
|
|
70
|
+
complain('Total of ' + uses.length + ' type statements and ' + used.length + ' unique types.');
|
|
71
|
+
}
|
|
72
|
+
if (sts.length > 10) {
|
|
73
|
+
const tr = dom.createElement('TR');
|
|
74
|
+
tr.appendChild(dom.createTextNode('' + sts.length));
|
|
75
|
+
// tr.AJAR_statement=sts[i]
|
|
76
|
+
div.appendChild(tr);
|
|
77
|
+
}
|
|
78
|
+
outliner.appendPropertyTRs(div, sts, true, function (_pred) {
|
|
79
|
+
return true;
|
|
80
|
+
});
|
|
81
|
+
if (more.length) {
|
|
82
|
+
complain('Implicit:');
|
|
83
|
+
outliner.appendPropertyTRs(div, more, true, function (_pred) {
|
|
84
|
+
return true;
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return div;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
// ends
|
|
92
|
+
//# sourceMappingURL=classInstancePane.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classInstancePane.js","names":["UI","_interopRequireWildcard","require","$rdf","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ns","classInstancePane","exports","icon","icons","originalIconBase","name","audience","solid","label","subject","context","kb","session","store","each","undefined","rdf","length","render","dom","outliner","getOutliner","complain","message","color","pre","createElement","setAttribute","div","appendChild","createTextNode","sts","statementsMatching","already","more","forEach","st","toNT","nt","findMembersNT","push","fromNT","utils","sameTerm","rdfs","uses","usedTypes","object","used","sym","tr","appendPropertyTRs","_pred"],"sources":["../src/classInstancePane.js"],"sourcesContent":["/* Class member Pane\n **\n ** This outline pane lists the members of a class\n */\n\nimport * as UI from 'solid-ui'\nimport * as $rdf from 'rdflib'\n\nconst ns = UI.ns\n\nexport const classInstancePane = {\n icon: UI.icons.originalIconBase + 'tango/22-folder-open.png',\n\n name: 'classInstance',\n\n // Create a new folder in a Solid system,\n\n audience: [ns.solid('PowerUser')],\n\n label: function (subject, context) {\n const kb = context.session.store\n const n = kb.each(undefined, ns.rdf('type'), subject).length\n if (n > 0) return 'List (' + n + ')' // Show how many in hover text\n return null // Suppress pane otherwise\n },\n\n render: function (subject, context) {\n const dom = context.dom\n const outliner = context.getOutliner(dom)\n const kb = context.session.store\n const complain = function complain (message, color) {\n const pre = dom.createElement('pre')\n pre.setAttribute('style', 'background-color: ' + color || '#eed' + ';')\n div.appendChild(pre)\n pre.appendChild(dom.createTextNode(message))\n }\n const div = dom.createElement('div')\n div.setAttribute('class', 'instancePane')\n div.setAttribute(\n 'style',\n ' border-top: solid 1px #777; border-bottom: solid 1px #777; margin-top: 0.5em; margin-bottom: 0.5em '\n )\n\n // If this is a class, look for all both explicit and implicit\n const sts = kb.statementsMatching(undefined, ns.rdf('type'), subject)\n if (sts.length > 0) {\n const already = {}\n const more = []\n sts.forEach(st => {\n already[st.subject.toNT()] = st\n })\n for (const nt in kb.findMembersNT(subject)) {\n if (!already[nt]) {\n more.push($rdf.st(kb.fromNT(nt), ns.rdf('type'), subject)) // @@ no provenance\n }\n }\n if (more.length) {\n complain(\n 'There are ' +\n sts.length +\n ' explicit and ' +\n more.length +\n ' implicit members of ' +\n UI.utils.label(subject)\n )\n }\n if (subject.sameTerm(ns.rdf('Property'))) {\n // / Do not find all properties used as properties .. unless look at kb index\n } else if (subject.sameTerm(ns.rdfs('Class'))) {\n const uses = kb.statementsMatching(undefined, ns.rdf('type'), undefined)\n const usedTypes = {}\n uses.forEach(function (st) {\n usedTypes[st.object] = st\n }) // Get unique\n const used = []\n for (const i in usedTypes) {\n used.push($rdf.st($rdf.sym(i), ns.rdf('type'), ns.rdfs('Class')))\n }\n complain(\n 'Total of ' +\n uses.length +\n ' type statements and ' +\n used.length +\n ' unique types.'\n )\n }\n\n if (sts.length > 10) {\n const tr = dom.createElement('TR')\n tr.appendChild(dom.createTextNode('' + sts.length))\n // tr.AJAR_statement=sts[i]\n div.appendChild(tr)\n }\n\n outliner.appendPropertyTRs(div, sts, true, function (_pred) {\n return true\n })\n\n if (more.length) {\n complain('Implicit:')\n outliner.appendProperty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AAUkB,KAAK,EAAE;UAC3D,OAAO,IAAI;QACb,CAAC,CAAC;MACJ;IACF;IAEA,OAAOxB,GAAG;EACZ;AACF,CAAC;AACD","ignoreList":[]}
|
|
@@ -1,109 +1,103 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
parse(turtle, store, doc.uri, 'text/turtle', null); // Load form directly
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
const preferencesForm = store.sym('urn:uuid:93774ba1-d3b6-41f2-85b6-4ae27ffd2597#this');
|
|
41
|
-
loadData(preferencesForm, preferencesFormText);
|
|
42
|
-
const ontologyExtra = store.sym('urn:uuid:93774ba1-d3b6-41f2-85b6-4ae27ffd2597-ONT');
|
|
43
|
-
loadData(ontologyExtra, ontologyData);
|
|
44
|
-
function doRender() {
|
|
45
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
-
const renderContext = yield login.ensureLoadedPreferences({
|
|
47
|
-
dom,
|
|
48
|
-
div: container
|
|
49
|
-
});
|
|
50
|
-
if (!renderContext.preferencesFile) {
|
|
51
|
-
// Could be CORS
|
|
52
|
-
console.log('Not doing private class preferences as no access to preferences file. ' +
|
|
53
|
-
renderContext.preferencesFileError);
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
const appendedForm = widgets.appendForm(dom, formArea, {}, renderContext.me, preferencesForm, renderContext.preferencesFile, complainIfBad);
|
|
57
|
-
appendedForm.style.borderStyle = 'none';
|
|
58
|
-
const trustedApplicationsView = context.session.paneRegistry.byName('trustedApplications');
|
|
59
|
-
if (trustedApplicationsView) {
|
|
60
|
-
container.appendChild(trustedApplicationsView.render(null, context));
|
|
61
|
-
}
|
|
62
|
-
// @@ TODO Remove need for casting as any and bang (!) syntax
|
|
63
|
-
addDeleteSection(container, store, renderContext.me, dom);
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
doRender();
|
|
67
|
-
return container;
|
|
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
|
+
}
|
|
68
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
|
+
}
|
|
69
65
|
};
|
|
70
66
|
function setupUserTypesSection(container, dom) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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;
|
|
79
75
|
}
|
|
80
|
-
|
|
81
|
-
// ends
|
|
76
|
+
var _default = exports.default = basicPreferencesPane; // ends
|
|
82
77
|
function addDeleteSection(container, store, profile, dom) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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
|
+
});
|
|
94
89
|
}
|
|
95
|
-
function generateDeletionLink(podServer, dom) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
return link;
|
|
105
|
-
});
|
|
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;
|
|
106
99
|
}
|
|
100
|
+
|
|
107
101
|
/**
|
|
108
102
|
* Hacky way to get the deletion link to a Pod
|
|
109
103
|
*
|
|
@@ -119,37 +113,35 @@ function generateDeletionLink(podServer, dom) {
|
|
|
119
113
|
* @returns URL of the page that Node Solid Server would offer to delete the account, or null if
|
|
120
114
|
* the URLs we tried give invalid responses.
|
|
121
115
|
*/
|
|
122
|
-
function getDeletionUrlForServer(server) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
return null;
|
|
143
|
-
});
|
|
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;
|
|
144
136
|
}
|
|
145
137
|
function createSection(container, dom, title) {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
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;
|
|
154
146
|
}
|
|
155
147
|
//# sourceMappingURL=basicPreferences.js.map
|