solid-panes 3.5.25-991cd384 → 3.5.25-c1b7ed9f

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.
Files changed (45) hide show
  1. package/lib/dashboard/basicPreferences.js +12 -8
  2. package/lib/dashboard/basicPreferences.js.map +1 -1
  3. package/lib/dashboard/dashboardPane.js.map +1 -1
  4. package/lib/dashboard/homepage.js +8 -4
  5. package/lib/dashboard/homepage.js.map +1 -1
  6. package/lib/form/pane.js.map +1 -1
  7. package/lib/home/homePane.js +6 -2
  8. package/lib/home/homePane.js.map +1 -1
  9. package/lib/humanReadablePane.js.map +1 -1
  10. package/lib/index.js.map +1 -1
  11. package/lib/internal/internalPane.js.map +1 -1
  12. package/lib/mainPage/footer.js.map +1 -1
  13. package/lib/mainPage/header.js +12 -8
  14. package/lib/mainPage/header.js.map +1 -1
  15. package/lib/mainPage/index.js +6 -2
  16. package/lib/mainPage/index.js.map +1 -1
  17. package/lib/microblogPane/microblogPane.js.map +1 -1
  18. package/lib/outline/licenseOptions.js.map +1 -1
  19. package/lib/outline/manager.js +26 -24
  20. package/lib/outline/manager.js.map +1 -1
  21. package/lib/outline/manager.test.js +6 -2
  22. package/lib/outline/manager.test.js.map +1 -1
  23. package/lib/outline/propertyViews.d.ts +1 -1
  24. package/lib/outline/propertyViews.d.ts.map +1 -1
  25. package/lib/outline/propertyViews.js.map +1 -1
  26. package/lib/outline/propertyViews.test.js.map +1 -1
  27. package/lib/outline/queryByExample.js.map +1 -1
  28. package/lib/outline/userInput.js.map +1 -1
  29. package/lib/pad/padPane.js.map +1 -1
  30. package/lib/profile/editProfile.view.js.map +1 -1
  31. package/lib/schedule/schedulePane.js.map +1 -1
  32. package/lib/sharing/sharingPane.js.map +1 -1
  33. package/lib/socialPane.js.map +1 -1
  34. package/lib/tabbed/tabbedPane.js +6 -2
  35. package/lib/tabbed/tabbedPane.js.map +1 -1
  36. package/lib/trustedApplications/trustedApplications.dom.js.map +1 -1
  37. package/lib/trustedApplications/trustedApplications.test.js.map +1 -1
  38. package/lib/trustedApplications/trustedApplications.utils.js.map +1 -1
  39. package/lib/trustedApplications/trustedApplications.view.js +6 -2
  40. package/lib/trustedApplications/trustedApplications.view.js.map +1 -1
  41. package/lib/versionInfo.d.ts +9 -9
  42. package/lib/versionInfo.js +14 -14
  43. package/lib/versionInfo.js.map +1 -1
  44. package/package.json +12 -12
  45. package/src/versionInfo.ts +14 -14
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
@@ -9,6 +11,8 @@ var _rdflib = require("rdflib");
9
11
 
10
12
  var _solidUi = require("solid-ui");
11
13
 
14
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
15
+
12
16
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
13
17
 
14
18
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
@@ -58,9 +62,9 @@ var basicPreferencesPane = {
58
62
  }
59
63
 
60
64
  function _doRender() {
61
- _doRender = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
65
+ _doRender = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
62
66
  var renderContext, appendedForm, trustedApplicationsView;
63
- return regeneratorRuntime.wrap(function _callee$(_context) {
67
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
64
68
  while (1) {
65
69
  switch (_context.prev = _context.next) {
66
70
  case 0:
@@ -133,9 +137,9 @@ function addDeleteSection(container, store, profile, dom) {
133
137
  });
134
138
  var list = section.appendChild(dom.createElement('ul'));
135
139
  podServers.forEach( /*#__PURE__*/function () {
136
- var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(server) {
140
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(server) {
137
141
  var deletionLink, listItem;
138
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
142
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
139
143
  while (1) {
140
144
  switch (_context2.prev = _context2.next) {
141
145
  case 0:
@@ -185,9 +189,9 @@ function generateDeletionLink(_x2, _x3) {
185
189
 
186
190
 
187
191
  function _generateDeletionLink() {
188
- _generateDeletionLink = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(podServer, dom) {
192
+ _generateDeletionLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(podServer, dom) {
189
193
  var link, deletionUrl;
190
- return regeneratorRuntime.wrap(function _callee3$(_context3) {
194
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
191
195
  while (1) {
192
196
  switch (_context3.prev = _context3.next) {
193
197
  case 0:
@@ -225,9 +229,9 @@ function getDeletionUrlForServer(_x4) {
225
229
  }
226
230
 
227
231
  function _getDeletionUrlForServer() {
228
- _getDeletionUrlForServer = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(server) {
232
+ _getDeletionUrlForServer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(server) {
229
233
  var singleUserUrl, multiUserUrl, hostnameParts, multiUserNssResponse, singleUserNssResponse;
230
- return regeneratorRuntime.wrap(function _callee4$(_context4) {
234
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
231
235
  while (1) {
232
236
  switch (_context4.prev = _context4.next) {
233
237
  case 0:
@@ -1 +1 @@
1
- {"version":3,"file":"basicPreferences.js","names":["basicPreferencesPane","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","preferencesFormText","ontologyExtra","ontologyData","doRender","login","ensureLoadedPreferences","div","renderContext","preferencesFile","console","log","preferencesFileError","appendedForm","appendForm","me","style","borderStyle","trustedApplicationsView","paneRegistry","byName","addDeleteSection","formContainer","createSection","description","innerText","userTypesLink","href","profile","section","podServerNodes","each","ns","space","podServers","map","node","value","list","forEach","server","generateDeletionLink","deletionLink","listItem","podServer","link","textContent","getDeletionUrlForServer","deletionUrl","singleUserUrl","URL","multiUserUrl","pathname","hostnameParts","hostname","split","slice","join","fetch","method","multiUserNssResponse","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;;AACA;;;;;;;;;;;AAIO,IAAMA,oBAAoC,GAAG;EAClDC,IAAI,EAAEC,eAAMC,QAAN,GAAiB,gCAD2B;EAElDC,IAAI,EAAE,kBAF4C;EAGlDC,KAAK,EAAE,eAAAC,QAAQ,EAAI;IACjB,OAAO,IAAP;EACD,CALiD;EAOlD;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A,OAkBsC+B,KAAK,CAACT,aAAa,CAACtB,IAAf,EAAqB;cAC5DgC,MAAM,EAAE;YADoD,CAArB,CAlB3C;;UAAA;YAkBQE,qBAlBR;;YAAA,KAqBMA,qBAAqB,CAAC9E,EArB5B;cAAA;cAAA;YAAA;;YAAA,kCAsBWkE,aAAa,CAACtB,IAtBzB;;UAAA;YAAA,kCAwBS,IAxBT;;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,C;;;;AA2BA,SAASJ,aAAT,CACEtC,SADF,EAEEN,GAFF,EAGEmF,KAHF,EAIW;EACT,IAAMjC,OAAO,GAAG5C,SAAS,CAACC,WAAV,CAAsBP,GAAG,CAACU,aAAJ,CAAkB,KAAlB,CAAtB,CAAhB;EACAwC,OAAO,CAACb,KAAR,CAAc+C,MAAd,GAAuB,qBAAvB;EACAlC,OAAO,CAACb,KAAR,CAAcgD,YAAd,GAA6B,OAA7B;EACAnC,OAAO,CAACb,KAAR,CAAciD,OAAd,GAAwB,OAAxB;EACApC,OAAO,CAACb,KAAR,CAAckD,SAAd,GAA0B,OAA1B;EAEA,IAAMC,YAAY,GAAGtC,OAAO,CAAC3C,WAAR,CAAoBP,GAAG,CAACU,aAAJ,CAAkB,IAAlB,CAApB,CAArB;EACA8E,YAAY,CAAC1C,SAAb,GAAyBqC,KAAzB;EAEA,OAAOjC,OAAP;AACD"}
1
+ {"version":3,"file":"basicPreferences.js","names":["basicPreferencesPane","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","preferencesFormText","ontologyExtra","ontologyData","doRender","login","ensureLoadedPreferences","div","renderContext","preferencesFile","console","log","preferencesFileError","appendedForm","appendForm","me","style","borderStyle","trustedApplicationsView","paneRegistry","byName","addDeleteSection","formContainer","createSection","description","innerText","userTypesLink","href","profile","section","podServerNodes","each","ns","space","podServers","map","node","value","list","forEach","server","generateDeletionLink","deletionLink","listItem","podServer","link","textContent","getDeletionUrlForServer","deletionUrl","singleUserUrl","URL","multiUserUrl","pathname","hostnameParts","hostname","split","slice","join","fetch","method","multiUserNssResponse","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;;AACA;;+CADA,oJ;;;;;;;;;;;AAKO,IAAMA,oBAAoC,GAAG;EAClDC,IAAI,EAAEC,cAAA,CAAMC,QAAN,GAAiB,gCAD2B;EAElDC,IAAI,EAAE,kBAF4C;EAGlDC,KAAK,EAAE,eAAAC,QAAQ,EAAI;IACjB,OAAO,IAAP;EACD,CALiD;EAOlD;EACA;EACAC,MAAM,EAAE,gBAACC,OAAD,EAAUC,OAAV,EAAsB;IAC5B,IAAMC,GAAG,GAAGD,OAAO,CAACC,GAApB;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,CAArB,CAlB3C;;UAAA;YAkBQE,qBAlBR;;YAAA,KAqBMA,qBAAqB,CAAC9E,EArB5B;cAAA;cAAA;YAAA;;YAAA,kCAsBWkE,aAAa,CAACtB,IAtBzB;;UAAA;YAAA,kCAwBS,IAxBT;;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,C;;;;AA2BA,SAASJ,aAAT,CACEtC,SADF,EAEEN,GAFF,EAGEmF,KAHF,EAIW;EACT,IAAMjC,OAAO,GAAG5C,SAAS,CAACC,WAAV,CAAsBP,GAAG,CAACU,aAAJ,CAAkB,KAAlB,CAAtB,CAAhB;EACAwC,OAAO,CAACb,KAAR,CAAc+C,MAAd,GAAuB,qBAAvB;EACAlC,OAAO,CAACb,KAAR,CAAcgD,YAAd,GAA6B,OAA7B;EACAnC,OAAO,CAACb,KAAR,CAAciD,OAAd,GAAwB,OAAxB;EACApC,OAAO,CAACb,KAAR,CAAckD,SAAd,GAA0B,OAA1B;EAEA,IAAMC,YAAY,GAAGtC,OAAO,CAAC3C,WAAR,CAAoBP,GAAG,CAACU,aAAJ,CAAkB,IAAlB,CAApB,CAArB;EACA8E,YAAY,CAAC1C,SAAb,GAAyBqC,KAAzB;EAEA,OAAOjC,OAAP;AACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"dashboardPane.js","names":["dashboardPane","icon","icons","iconBase","name","label","subject","console","log","uri","site","render","context","dom","container","createElement","runBuildPage","innerHTML","buildPage","authn","currentUser","authSession","onLogin","onSessionRestore","webId","URL","window","location","href","searchParams","get","buildDashboard","buildHomePage","outliner","getOutliner","getDashboard","then","dashboard","appendChild","wrapper","document","shadow","attachShadow","mode","link","rel","store","fetcher","homepage"],"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.onLogin(() => {\n // console.log('On Login')\n runBuildPage()\n })\n authSession.onSessionRestore(() => {\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;;AACA;;AAEA;;AAGO,IAAMA,aAA6B,GAAG;EAC3CC,IAAI,EAAEC,eAAMC,QAAN,GAAiB,iBADoB;EAE3CC,IAAI,EAAE,WAFqC;EAG3CC,KAAK,EAAE,eAAAC,OAAO,EAAI;IA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B,cAAT,CAAyBjB,SAAzB,EAAiDF,OAAjD,EAA8E;EAC5E;EACA;EACA,IAAMqB,QAAa,GAAGrB,OAAO,CAACsB,WAAR,CAAoBtB,OAAO,CAACC,GAA5B,CAAtB;EACAoB,QAAQ,CACLE,YADH,GAEGC,IAFH,CAEQ,UAACC,SAAD;IAAA,OAA4BvB,SAAS,CAACwB,WAAV,CAAsBD,SAAtB,CAA5B;EAAA,CAFR;AAGD;;AAED,SAASL,aAAT,CAAwBlB,SAAxB,EAAgDR,OAAhD,EAAoE;EAClE;EACA,IAAMiC,OAAO,GAAGC,QAAQ,CAACzB,aAAT,CAAuB,KAAvB,CAAhB;EACAD,SAAS,CAACwB,WAAV,CAAsBC,OAAtB;EACA,IAAME,MAAM,GAAGF,OAAO,CAACG,YAAR,CAAqB;IAAEC,IAAI,EAAE;EAAR,CAArB,CAAf;EACA,IAAMC,IAAI,GAAGJ,QAAQ,CAACzB,aAAT,CAAuB,MAAvB,CAAb;EACA6B,IAAI,CAACC,GAAL,GAAW,YAAX;EACAD,IAAI,CAAChB,IAAL,GAAY,+BAAZ;EACAa,MAAM,CAACH,WAAP,CAAmBM,IAAnB;EACA,gCAAiBtC,OAAjB,EAA0BwC,iBAA1B,EAAiCA,kBAAMC,OAAvC,EAA2DX,IAA3D,CAAgE,UAAAY,QAAQ;IAAA,OACtEP,MAAM,CAACH,WAAP,CAAmBU,QAAnB,CADsE;EAAA,CAAxE;AAGD;;eAEchD,a"}
1
+ {"version":3,"file":"dashboardPane.js","names":["dashboardPane","icon","icons","iconBase","name","label","subject","console","log","uri","site","render","context","dom","container","createElement","runBuildPage","innerHTML","buildPage","authn","currentUser","authSession","onLogin","onSessionRestore","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"],"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.onLogin(() => {\n // console.log('On Login')\n runBuildPage()\n })\n authSession.onSessionRestore(() => {\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;;AACA;;AAEA;;AAGO,IAAMA,a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AeD,GAAhD,CAAT,EAA+D;IAC7D,OAAOsB,cAAc,CAACjB,SAAD,EAAYF,OAAZ,CAArB;EACD;;EACD,OAAOoB,aAAa,CAAClB,SAAD,EAAYR,OAAZ,CAApB;AACD;;AAED,SAASyB,cAAT,CAAyBjB,SAAzB,EAAiDF,OAAjD,EAA8E;EAC5E;EACA;EACA,IAAMqB,QAAa,GAAGrB,OAAO,CAACsB,WAAR,CAAoBtB,OAAO,CAACC,GAA5B,CAAtB;EACAoB,QAAQ,CACLE,YADH,GAEGC,IAFH,CAEQ,UAACC,SAAD;IAAA,OAA4BvB,SAAS,CAACwB,WAAV,CAAsBD,SAAtB,CAA5B;EAAA,CAFR;AAGD;;AAED,SAASL,aAAT,CAAwBlB,SAAxB,EAAgDR,OAAhD,EAAoE;EAClE;EACA,IAAMiC,OAAO,GAAGC,QAAQ,CAACzB,aAAT,CAAuB,KAAvB,CAAhB;EACAD,SAAS,CAACwB,WAAV,CAAsBC,OAAtB;EACA,IAAME,MAAM,GAAGF,OAAO,CAACG,YAAR,CAAqB;IAAEC,IAAI,EAAE;EAAR,CAArB,CAAf;EACA,IAAMC,IAAI,GAAGJ,QAAQ,CAACzB,aAAT,CAAuB,MAAvB,CAAb;EACA6B,IAAI,CAACC,GAAL,GAAW,YAAX;EACAD,IAAI,CAAChB,IAAL,GAAY,+BAAZ;EACAa,MAAM,CAACH,WAAP,CAAmBM,IAAnB;EACA,IAAAE,0BAAA,EAAiBxC,OAAjB,EAA0ByC,iBAA1B,EAAiCA,iBAAA,CAAMC,OAAvC,EAA2DZ,IAA3D,CAAgE,UAAAa,QAAQ;IAAA,OACtER,MAAM,CAACH,WAAP,CAAmBW,QAAnB,CADsE;EAAA,CAAxE;AAGD;;eAEcjD,a"}
@@ -9,6 +9,10 @@ var _rdflib = require("rdflib");
9
9
 
10
10
  var _solidUi = require("solid-ui");
11
11
 
12
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
13
+
14
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
15
+
12
16
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
13
17
 
14
18
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
@@ -18,9 +22,9 @@ function generateHomepage(_x, _x2, _x3) {
18
22
  }
19
23
 
20
24
  function _generateHomepage() {
21
- _generateHomepage = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(subject, store, fetcher) {
25
+ _generateHomepage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(subject, store, fetcher) {
22
26
  var ownersProfile, name, wrapper;
23
- return regeneratorRuntime.wrap(function _callee$(_context) {
27
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
24
28
  while (1) {
25
29
  switch (_context.prev = _context.next) {
26
30
  case 0:
@@ -79,9 +83,9 @@ function loadProfile(_x4, _x5) {
79
83
  }
80
84
 
81
85
  function _loadProfile() {
82
- _loadProfile = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(subject, fetcher) {
86
+ _loadProfile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(subject, fetcher) {
83
87
  var pod, webId;
84
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
88
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
85
89
  while (1) {
86
90
  switch (_context2.prev = _context2.next) {
87
91
  case 0:
@@ -1 +1 @@
1
- {"version":3,"file":"homepage.js","names":["generateHomepage","subject","store","fetcher","loadProfile","ownersProfile","name","getName","wrapper","document","createElement","classList","add","appendChild","createTitle","uri","createDataSection","dataSection","title","innerText","listGroup","publicDataLink","href","window","location","profileLink","profileLinkPost","pod","site","webId","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;;AACA;;;;;;SAEsBA,gB;;;;;8EAAf,iBACLC,OADK,EAELC,KAFK,EAGLC,OAHK;IAAA;IAAA;MAAA;QAAA;UAAA;YAAA;YAAA,OAKuBC,WAAW,CAACH,OAA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js","names":["generateHomepage","subject","store","fetcher","loadProfile","ownersProfile","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;;AACA;;;;+CAAA,oJ;;;;;;SAEsBA,gB;;;;;iFAAf,iBACLC,OADK,EAELC,KAFK,EAGLC,OAHK;IAAA;IAAA;MAAA;QAAA;UAAA;YAAA;YAAA,OAKuBC,WAAW,CAACH,OAAD,EAAUE,OAAV,CALlC;;UAAA;YAKCE,aALD;YAMCC,IAND,GAMQC,OAAO,CAACL,KAAD,EAAQG,aAAR,CANf;YAQCG,OARD,GAQWC,QAAQ,CAACC,aAAT,CAAuB,KAAvB,CARX;YASLF,OAAO,CAACG,SAAR,CAAkBC,GAAlB,CAAsB,WAAtB;YACAJ,OAAO,CAACK,WAAR,CAAoBC,WAAW,CAACT,aAAa,CAACU,GAAf,EAAoBT,IAApB,CAA/B;YACAE,OAAO,CAACK,WAAR,CAAoBG,iBAAiB,CAACV,IAAD,CAArC;YAXK,iCAaEE,OAbF;;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,C;;;;AAgBP,SAASQ,iBAAT,CAA4BV,IAA5B,EAAuD;EACrD,IAAMW,WAAW,GAAGR,QAAQ,CAACC,aAAT,CAAuB,SAAvB,CAApB;EAEA,IAAMQ,KAAK,GAAGT,QAAQ,CAACC,aAAT,CAAuB,IAAvB,CAAd;EACAQ,KAAK,CAACC,SAAN,GAAkB,MAAlB;EACAF,WAAW,CAACJ,WAAZ,CAAwBK,KAAxB;EAEA,IAAME,SAAS,GAAGX,QAAQ,CAACC,aAAT,CAAuB,KAAvB,CAAlB;EACAU,SAAS,CAACT,SAAV,CAAoBC,GAApB,CAAwB,YAAxB;EACAK,WAAW,CAACJ,WAAZ,CAAwBO,SAAxB;EAEA,IAAMC,cAAc,GAAGZ,QAAQ,CAACC,aAAT,CAAuB,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,IAAT,CAA9B,EAA8C,IAA9C,EAAoD7B,aAAa,CAAC8B,GAAd,EAApD,KACAjC,KAAK,CAAC8B,QAAN,CAAe3B,aAAf,EAA8B4B,WAAA,CAAGG,IAAH,CAAQ,MAAR,CAA9B,EAA+C,IAA/C,EAAqD/B,aAAa,CAAC8B,GAAd,EAArD,CADA,IAEA,IAAIE,GAAJ,CAAQhC,aAAa,CAACU,GAAtB,EAA2BuB,IAA3B,CAAgCC,KAAhC,CAAsC,GAAtC,EAA2C,CAA3C,CAHF;AAKD"}
@@ -1 +1 @@
1
- {"version":3,"file":"pane.js","names":["ns","UI","module","exports","icon","icons","iconBase","name","audience","solid","label","subject","n","widgets","formsFor","length","log","debug","render","context","kb","session","store","dom","mention","complain","message","style","pre","createElement","setAttribute","box","appendChild","textContent","complainIfBad","ok","body","me","authn","currentUser","ws","each","ui","renderFormsFor","fetcher","nowOrWhenFetched","uri","forms","i","form","heading","formStore","$rdf","Util","document","e","editFormButton","anchor","utils","appendForm","docuri","docpart","updater","editable","doc","any","sym","link","docs","docList","statementsMatching","forEach","st","why","undefined","d","push","sort","_followeach","path","oo","res","concat","slice","date","foobarbaz","login","selectWorkspace","activities","space","j","act","subjectDoc2","start","cal","value","end"],"sources":["../../src/form/pane.js"],"sourcesContent":["/*\n ** Pane for running existing forms for any object\n **\n */\n\nimport * as UI from 'solid-ui'\nimport { authn } from 'solid-logic'\nimport * as $rdf from 'rdflib'\nconst ns = UI.ns\n\nmodule.exports = {\n icon: UI.icons.iconBase + 'noun_122196.svg',\n\n name: 'form',\n\n audience: [ns.solid('PowerUser')],\n\n // Does the subject deserve this pane?\n label: function (subject) {\n const n = UI.widgets.formsFor(subject).length\n UI.log.debug('Form pane: forms for ' + subject + ': ' + n)\n if (!n) return null\n return '' + n + ' forms'\n },\n\n render: function (subject, context) {\n const kb = context.session.store\n const dom = context.dom\n\n const mention = function complain (message, style) {\n const pre = dom.createElement('p')\n pre.setAttribute('style', style || 'color: grey; background-color: white')\n box.appendChild(pre).textContent = message\n return pre\n }\n\n const complain = function complain (message, style) {\n mention(message, 'style', style || 'color: grey; background-color: #fdd;')\n }\n\n const complainIfBad = function (ok, body) {\n if (ok) {\n // setModifiedDate(store, kb, store);\n // rerender(box); // Deleted forms at the moment\n } else complain('Sorry, failed to save your change:\\n' + body)\n }\n\n // The question of where to store this data about subject\n // This in general needs a whole lot more thought\n // and it connects to the discoverbility through links\n\n // const t = kb.findTypeURIs(subject)\n\n const me = authn.currentUser()\n\n const box = dom.createElement('div')\n box.setAttribute('class', 'formPane')\n\n if (!me) {\n mention(\n 'You are not logged in. If you log in and have ' +\n 'workspaces then you would be able to select workspace in which ' +\n 'to put this new information'\n )\n } else {\n const ws = kb.each(me, ns.ui('workspace'))\n if (ws.length === 0) {\n mention(\n \"You don't seem to have any workspaces defined. \" +\n 'A workspace is a place on the web (http://..) or in ' +\n 'the file system (file:///) to store application data.\\n'\n )\n } else {\n // @@\n }\n }\n\n // Render forms using a given store\n\n const renderFormsFor = function (store, subject) {\n kb.fetcher.nowOrWhenFetched(store.uri, subject, function (ok, body) {\n if (!ok) return complain('Cannot load store ' + store.uri + ': ' + body)\n\n // Render the forms\n\n const forms = UI.widgets.formsFor(subject)\n\n // complain('Form for editing this form:');\n for (let i = 0; i < forms.length; i++) {\n const form = forms[i]\n const heading = dom.createElement('h4')\n box.appendChild(heading)\n if (form.uri) {\n const formStore = $rdf.Util.uri.document(form.uri)\n if (formStore.uri !== form.uri) {\n // The form is a hash-type URI\n const e = box.appendChild(\n UI.widgets.editFormButton(\n dom,\n box,\n form,\n formStore,\n complainIfBad\n )\n )\n e.setAttribute('style', 'float: right;')\n }\n }\n const anchor = dom.createElement('a')\n anchor.setAttribute('href', form.uri)\n heading.appendChild(anchor)\n anchor.textContent = UI.utils.label(form, true)\n\n /* Keep tis as a reminder to let a New one have its URI given by user\n mention(\"Where will this information be stored?\")\n const ele = dom.createElement('input');\n box.appendChild(ele);\n ele.setAttribute('type', 'text');\n ele.setAttribute('size', '72');\n ele.setAttribute('maxlength', '1024');\n ele.setAttribute('style', 'font-size: 80%; color:#222;');\n ele.value = store.uri\n */\n\n UI.widgets.appendForm(\n dom,\n box,\n {},\n subject,\n form,\n store,\n complainIfBad\n )\n }\n }) // end: when store loded\n } // renderFormsFor\n\n // Figure out what store\n\n // Which places are editable and have stuff about the subject?\n\n let store = null\n\n // 1. The document URI of the subject itself\n const docuri = $rdf.Util.uri.docpart(subject.uri)\n if (subject.uri !== docuri && kb.updater.editable(docuri, kb)) {\n store = subject.doc()\n } // an editable data file with hash\n\n store = store || kb.any(kb.sym(docuri), ns.link('annotationStore'))\n\n // 2. where stuff is already stored\n if (!store) {\n const docs = {}\n const docList = []\n store.statementsMatching(subject).forEach(function (st) {\n docs[st.why.uri] = 1\n })\n store\n .statementsMatching(undefined, undefined, subject)\n .forEach(function (st) {\n docs[st.why.uri] = 2\n })\n for (const d in docs) docList.push(docs[d], d)\n docList.sort()\n for (let i = 0; i < docList.length; i++) {\n const uri = docList[i][1]\n if (uri && store.updater.editable(uri)) {\n store = store.sym(uri)\n break\n }\n }\n }\n\n // 3. In a workspace store\n // @@ TODO: Can probably remove _followeach (not done this time because the commit is a very safe refactor)\n const _followeach = function (kb, subject, path) {\n if (path.length === 0) return [subject]\n const oo = kb.each(subject, path[0])\n let res = []\n for (let i = 0; i < oo.length; i++) {\n res = res.concat(_followeach(kb, oo[i], path.slice(1)))\n }\n return res\n }\n\n const date = '2014' // @@@@@@@@@@@@ pass as parameter\n\n if (store) {\n // mention(\"@@ Ok, we have a store <\" + store.uri + \">.\");\n renderFormsFor(store, subject)\n } else {\n complain('No suitable store is known, to edit <' + subject.uri + '>.')\n const foobarbaz = UI.login.selectWorkspace(dom, function (ws) {\n mention('Workspace selected OK: ' + ws)\n\n const activities = store.each(undefined, ns.space('workspace'), ws)\n for (let j = 0; j < activities.length; j++) {\n const act = activities[j]\n\n const subjectDoc2 = store.any(ws, ns.space('store'))\n const start = store.any(ws, ns.cal('dtstart')).value()\n const end = store.any(ws, ns.cal('dtend')).value()\n if (subjectDoc2 && start && end && start <= date && end > date) {\n renderFormsFor(subjectDoc2, subject)\n break\n } else {\n complain('Note no suitable annotation store in activity: ' + act)\n }\n }\n })\n box.appendChild(foobarbaz)\n }\n\n return box\n }\n}\n"],"mappings":";;;;AAKA;;AACA;;AACA;;;;;;AAPA;AACA;AACA;AACA;AAKA,IAAMA,EAAE,GAAGC,EAAE,CAACD,EAAd;AAEAE,MAAM,CAACC,OAAP,GAAiB;EACfC,IAAI,EAAEH,EAAE,CAACI,KAAH,CAASC,QAAT,GAAoB,iBADX;EAGfC,IAAI,EAAE,MAHS;EAKfC,QAAQ,EAAE,CAACR,EAAE,CAACS,KAAH,CAAS,WAAT,CAAD,CALK;EAOf;EACAC,KAAK,EAAE,eAAUC,OAAV,EAAmB;IACxB,IAAMC,CAAC,GAAGX,EAAE,CAACY,OAAH,CAAWC,QAAX,CAAoBH,OAApB,EAA6BI,MAAvC;IACAd,EAAE,CAACe,GAAH,CAAOC,KAAP,CAAa,0BAA0BN,OAA1B,GAAoC,IAApC,GAA2CC,CAAxD;IACA,IAAI,CAACA,CAAL,EAAQ,OAAO,IAAP;IACR,OAAO,KAAKA,CAAL,GAAS,QAAhB;EACD,CAbc;EAefM,MAAM,EAAE,gBAAUP,OAAV,EAAmBQ,OAAnB,EAA4B;IAClC,IAAMC,EAAE,GAAGD,OAAO,CAACE,OAAR,CAAgBC,KAA3B;IACA,IAAMC,GAAG,GAAGJ,OAAO,CAACI,GAApB;;IAEA,IAAMC,OAAO,GAAG,SAASC,QAAT,CAAmBC,OAAnB,EAA4BC,KAA5B,EAAmC;MACjD,IAAMC,GAAG,GAAGL,GAAG,CAACM,aAAJ,CAAkB,GAAlB,CAAZ;MACAD,GAAG,CAACE,YAAJ,CAAiB,OAAjB,EAA0BH,KAAK,IAAI,sCAAnC;MACAI,GAAG,CAACC,WAAJ,CAAgBJ,GAAhB,EAAqBK,WAArB,GAAmCP,OAAnC;MACA,O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":3,"file":"pane.js","names":["ns","UI","module","exports","icon","icons","iconBase","name","audience","solid","label","subject","n","widgets","formsFor","length","log","debug","render","context","kb","session","store","dom","mention","complain","message","style","pre","createElement","setAttribute","box","appendChild","textContent","complainIfBad","ok","body","me","authn","currentUser","ws","each","ui","renderFormsFor","fetcher","nowOrWhenFetched","uri","forms","i","form","heading","formStore","$rdf","Util","document","e","editFormButton","anchor","utils","appendForm","docuri","docpart","updater","editable","doc","any","sym","link","docs","docList","statementsMatching","forEach","st","why","undefined","d","push","sort","_followeach","path","oo","res","concat","slice","date","foobarbaz","login","selectWorkspace","activities","space","j","act","subjectDoc2","start","cal","value","end"],"sources":["../../src/form/pane.js"],"sourcesContent":["/*\n ** Pane for running existing forms for any object\n **\n */\n\nimport * as UI from 'solid-ui'\nimport { authn } from 'solid-logic'\nimport * as $rdf from 'rdflib'\nconst ns = UI.ns\n\nmodule.exports = {\n icon: UI.icons.iconBase + 'noun_122196.svg',\n\n name: 'form',\n\n audience: [ns.solid('PowerUser')],\n\n // Does the subject deserve this pane?\n label: function (subject) {\n const n = UI.widgets.formsFor(subject).length\n UI.log.debug('Form pane: forms for ' + subject + ': ' + n)\n if (!n) return null\n return '' + n + ' forms'\n },\n\n render: function (subject, context) {\n const kb = context.session.store\n const dom = context.dom\n\n const mention = function complain (message, style) {\n const pre = dom.createElement('p')\n pre.setAttribute('style', style || 'color: grey; background-color: white')\n box.appendChild(pre).textContent = message\n return pre\n }\n\n const complain = function complain (message, style) {\n mention(message, 'style', style || 'color: grey; background-color: #fdd;')\n }\n\n const complainIfBad = function (ok, body) {\n if (ok) {\n // setModifiedDate(store, kb, store);\n // rerender(box); // Deleted forms at the moment\n } else complain('Sorry, failed to save your change:\\n' + body)\n }\n\n // The question of where to store this data about subject\n // This in general needs a whole lot more thought\n // and it connects to the discoverbility through links\n\n // const t = kb.findTypeURIs(subject)\n\n const me = authn.currentUser()\n\n const box = dom.createElement('div')\n box.setAttribute('class', 'formPane')\n\n if (!me) {\n mention(\n 'You are not logged in. If you log in and have ' +\n 'workspaces then you would be able to select workspace in which ' +\n 'to put this new information'\n )\n } else {\n const ws = kb.each(me, ns.ui('workspace'))\n if (ws.length === 0) {\n mention(\n \"You don't seem to have any workspaces defined. \" +\n 'A workspace is a place on the web (http://..) or in ' +\n 'the file system (file:///) to store application data.\\n'\n )\n } else {\n // @@\n }\n }\n\n // Render forms using a given store\n\n const renderFormsFor = function (store, subject) {\n kb.fetcher.nowOrWhenFetched(store.uri, subject, function (ok, body) {\n if (!ok) return complain('Cannot load store ' + store.uri + ': ' + body)\n\n // Render the forms\n\n const forms = UI.widgets.formsFor(subject)\n\n // complain('Form for editing this form:');\n for (let i = 0; i < forms.length; i++) {\n const form = forms[i]\n const heading = dom.createElement('h4')\n box.appendChild(heading)\n if (form.uri) {\n const formStore = $rdf.Util.uri.document(form.uri)\n if (formStore.uri !== form.uri) {\n // The form is a hash-type URI\n const e = box.appendChild(\n UI.widgets.editFormButton(\n dom,\n box,\n form,\n formStore,\n complainIfBad\n )\n )\n e.setAttribute('style', 'float: right;')\n }\n }\n const anchor = dom.createElement('a')\n anchor.setAttribute('href', form.uri)\n heading.appendChild(anchor)\n anchor.textContent = UI.utils.label(form, true)\n\n /* Keep tis as a reminder to let a New one have its URI given by user\n mention(\"Where will this information be stored?\")\n const ele = dom.createElement('input');\n box.appendChild(ele);\n ele.setAttribute('type', 'text');\n ele.setAttribute('size', '72');\n ele.setAttribute('maxlength', '1024');\n ele.setAttribute('style', 'font-size: 80%; color:#222;');\n ele.value = store.uri\n */\n\n UI.widgets.appendForm(\n dom,\n box,\n {},\n subject,\n form,\n store,\n complainIfBad\n )\n }\n }) // end: when store loded\n } // renderFormsFor\n\n // Figure out what store\n\n // Which places are editable and have stuff about the subject?\n\n let store = null\n\n // 1. The document URI of the subject itself\n const docuri = $rdf.Util.uri.docpart(subject.uri)\n if (subject.uri !== docuri && kb.updater.editable(docuri, kb)) {\n store = subject.doc()\n } // an editable data file with hash\n\n store = store || kb.any(kb.sym(docuri), ns.link('annotationStore'))\n\n // 2. where stuff is already stored\n if (!store) {\n const docs = {}\n const docList = []\n store.statementsMatching(subject).forEach(function (st) {\n docs[st.why.uri] = 1\n })\n store\n .statementsMatching(undefined, undefined, subject)\n .forEach(function (st) {\n docs[st.why.uri] = 2\n })\n for (const d in docs) docList.push(docs[d], d)\n docList.sort()\n for (let i = 0; i < docList.length; i++) {\n const uri = docList[i][1]\n if (uri && store.updater.editable(uri)) {\n store = store.sym(uri)\n break\n }\n }\n }\n\n // 3. In a workspace store\n // @@ TODO: Can probably remove _followeach (not done this time because the commit is a very safe refactor)\n const _followeach = function (kb, subject, path) {\n if (path.length === 0) return [subject]\n const oo = kb.each(subject, path[0])\n let res = []\n for (let i = 0; i < oo.length; i++) {\n res = res.concat(_followeach(kb, oo[i], path.slice(1)))\n }\n return res\n }\n\n const date = '2014' // @@@@@@@@@@@@ pass as parameter\n\n if (store) {\n // mention(\"@@ Ok, we have a store <\" + store.uri + \">.\");\n renderFormsFor(store, subject)\n } else {\n complain('No suitable store is known, to edit <' + subject.uri + '>.')\n const foobarbaz = UI.login.selectWorkspace(dom, function (ws) {\n mention('Workspace selected OK: ' + ws)\n\n const activities = store.each(undefined, ns.space('workspace'), ws)\n for (let j = 0; j < activities.length; j++) {\n const act = activities[j]\n\n const subjectDoc2 = store.any(ws, ns.space('store'))\n const start = store.any(ws, ns.cal('dtstart')).value()\n const end = store.any(ws, ns.cal('dtend')).value()\n if (subjectDoc2 && start && end && start <= date && end > date) {\n renderFormsFor(subjectDoc2, subject)\n break\n } else {\n complain('Note no suitable annotation store in activity: ' + act)\n }\n }\n })\n box.appendChild(foobarbaz)\n }\n\n return box\n }\n}\n"],"mappings":";;;;AAKA;;AACA;;AACA;;;;;;AAPA;AACA;AACA;AACA;AAKA,IAAMA,EAAE,GAAGC,EAAE,CAACD,EAAd;AAEAE,MAAM,CAACC,OAAP,GAAiB;EACfC,IAAI,EAAEH,EAAE,CAACI,KAAH,CAASC,Q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kD,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGF,UAAU,CAACzE,MAA/B,EAAuC2E,CAAC,EAAxC,EAA4C;UAC1C,IAAMC,GAAG,GAAGH,UAAU,CAACE,CAAD,CAAtB;UAEA,IAAME,WAAW,GAAGtE,KAAK,CAAC2C,GAAN,CAAUzB,EAAV,EAAcxC,EAAE,CAACyF,KAAH,CAAS,OAAT,CAAd,CAApB;UACA,IAAMI,KAAK,GAAGvE,KAAK,CAAC2C,GAAN,CAAUzB,EAAV,EAAcxC,EAAE,CAAC8F,GAAH,CAAO,SAAP,CAAd,EAAiCC,KAAjC,EAAd;UACA,IAAMC,GAAG,GAAG1E,KAAK,CAAC2C,GAAN,CAAUzB,EAAV,EAAcxC,EAAE,CAAC8F,GAAH,CAAO,OAAP,CAAd,EAA+BC,KAA/B,EAAZ;;UACA,IAAIH,WAAW,IAAIC,KAAf,IAAwBG,GAAxB,IAA+BH,KAAK,IAAIT,IAAxC,IAAgDY,GAAG,GAAGZ,IAA1D,EAAgE;YAC9DzC,cAAc,CAACiD,WAAD,EAAcjF,OAAd,CAAd;YACA;UACD,CAHD,MAGO;YACLc,QAAQ,CAAC,oDAAoDkE,GAArD,CAAR;UACD;QACF;MACF,CAjBiB,CAAlB;MAkBA5D,GAAG,CAACC,WAAJ,CAAgBqD,SAAhB;IACD;;IAED,OAAOtD,GAAP;EACD;AA7Mc,CAAjB"}
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
@@ -9,6 +11,8 @@ var _solidLogic = require("solid-logic");
9
11
 
10
12
  var _solidUi = require("solid-ui");
11
13
 
14
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
15
+
12
16
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
13
17
 
14
18
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
@@ -29,9 +33,9 @@ var HomePaneSource = {
29
33
  var dom = context.dom;
30
34
 
31
35
  var showContent = /*#__PURE__*/function () {
32
- var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
36
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
33
37
  var homePaneContext, creationDiv, creationContext, relevantPanes;
34
- return regeneratorRuntime.wrap(function _callee$(_context) {
38
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
35
39
  while (1) {
36
40
  switch (_context.prev = _context.next) {
37
41
  case 0:
@@ -1 +1 @@
1
- {"version":3,"file":"homePane.js","names":["HomePaneSource","icon","icons","iconBase","global","name","label","render","subject","context","dom","showContent","homePaneContext","div","statusArea","me","appendChild","createElement","textContent","creationDiv","creationContext","login","filterAvailablePanes","session","paneRegistry","list","relevantPanes","create","newThingUI","registrationList","then","authContext","authn","currentUser"],"sources":["../../src/home/homePane.ts"],"sourcesContent":["/* Home Pane\n **\n ** The home pane is avaiable everywhere and allows a user\n ** to\n ** - keep track of their stuff\n ** - make new things, and possibly\n ** - keep track of accounts and workspaces etc\n **\n */\n\nimport { PaneDefinition } from 'pane-registry'\nimport { NamedNode } from 'rdflib'\nimport { authn } from 'solid-logic'\nimport { create, icons, login } from 'solid-ui'\nimport { CreateContext } from 'solid-ui/lib/create/types'\n\nconst HomePaneSource: PaneDefinition = {\n icon: icons.iconBase + 'noun_547570.svg', // noun_25830\n\n global: true,\n\n name: 'home',\n\n // Does the subject deserve an home pane?\n //\n // yes, always!\n //\n label: function () {\n return 'home'\n },\n\n render: function (subject, context) {\n const dom = context.dom\n const showContent = async function () {\n const homePaneContext = { div: div, dom: dom, statusArea: div, me: me }\n /*\n div.appendChild(dom.createElement('h4')).textContent = 'Login status'\n var loginStatusDiv = div.appendChild(context.dom.createElement('div'))\n // TODO: Find out what the actual type is:\n type UriType = unknown;\n loginStatusDiv.appendChild(UI.login.loginStatusBox(context.dom, () => {\n // Here we know new log in status\n }))\n */\n div.appendChild(dom.createElement('h4')).textContent =\n 'Create new thing somewhere'\n const creationDiv = div.appendChild(dom.createElement('div'))\n const creationContext: CreateContext = {\n div: creationDiv,\n dom: dom,\n statusArea: div,\n me: me\n }\n const relevantPanes = await login.filterAvailablePanes(\n context.session.paneRegistry.list\n )\n create.newThingUI(creationContext, context, relevantPanes) // newUI Have to pass panes down\n\n div.appendChild(dom.createElement('h4')).textContent = 'Private things'\n // TODO: Replace by a common, representative interface\n login\n .registrationList(homePaneContext, { private: true })\n .then(function (authContext) {\n div.appendChild(dom.createElement('h4')).textContent = 'Public things'\n div.appendChild(dom.createElement('p')).textContent =\n 'Things in this list are visible to others.'\n login\n .registrationList(authContext, { public: true })\n .then(function () {\n // done\n })\n })\n }\n\n const div = dom.createElement('div')\n const me: NamedNode = authn.currentUser() as NamedNode // this will be incorrect if not logged in\n\n showContent()\n\n return div\n }\n} // pane object\n\n// ends\nexport default HomePaneSource\n"],"mappings":";;;;;;;AAYA;;AACA;;;;;;AAGA,IAAMA,cAA8B,GAAG;EACrCC,IAAI,EAAEC,eAAMC,QAAN,GAAiB,iBADc;EACK;EAE1CC,MAAM,EAAE,IAH6B;EAKrCC,IAAI,EAAE,MAL+B;EAOrC;EACA;EACA;EACA;EACAC,KAAK,EAAE,iBAAY;IACjB,OAAO,MAAP;EACD,CAboC;EAerCC,MAAM,EAAE,gBAAUC,OAAV,EAAmBC,OAAnB,EAA4B;IAClC,IAAMC,GAAG,GAAGD,OAAO,CAACC,GAApB;;IACA,IAAMC,WAAW;MAAA,mEAAG;QAAA;QAAA;UAAA;YAAA;cAAA;gBACZC,eADY,GACM;kBAAEC,GAAG,EAAEA,GAAP;kBAAYH,GAAG,EAAEA,GAAjB;kBAAsBI,UAAU,EAAED,GAAlC;kBAAuCE,EAAE,EAAEA;gBAA3C,CADN;gBAElB;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;gBACMF,GAAG,CAACG,WAA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G,GAAGH,GAAG,CAACO,aAAJ,CAAkB,KAAlB,CAAZ;;IACA,IAAMF,EAAa,GAAGiB,kBAAMC,WAAN,EAAtB,CA5CkC,CA4CqB;;;IAEvDtB,WAAW;IAEX,OAAOE,GAAP;EACD;AAhEoC,CAAvC,C,CAiEE;AAEF;;eACeb,c"}
1
+ {"version":3,"file":"homePane.js","names":["HomePaneSource","icon","icons","iconBase","global","name","label","render","subject","context","dom","showContent","homePaneContext","div","statusArea","me","appendChild","createElement","textContent","creationDiv","creationContext","login","filterAvailablePanes","session","paneRegistry","list","relevantPanes","create","newThingUI","registrationList","then","authContext","authn","currentUser"],"sources":["../../src/home/homePane.ts"],"sourcesContent":["/* Home Pane\n **\n ** The home pane is avaiable everywhere and allows a user\n ** to\n ** - keep track of their stuff\n ** - make new things, and possibly\n ** - keep track of accounts and workspaces etc\n **\n */\n\nimport { PaneDefinition } from 'pane-registry'\nimport { NamedNode } from 'rdflib'\nimport { authn } from 'solid-logic'\nimport { create, icons, login } from 'solid-ui'\nimport { CreateContext } from 'solid-ui/lib/create/types'\n\nconst HomePaneSource: PaneDefinition = {\n icon: icons.iconBase + 'noun_547570.svg', // noun_25830\n\n global: true,\n\n name: 'home',\n\n // Does the subject deserve an home pane?\n //\n // yes, always!\n //\n label: function () {\n return 'home'\n },\n\n render: function (subject, context) {\n const dom = context.dom\n const showContent = async function () {\n const homePaneContext = { div: div, dom: dom, statusArea: div, me: me }\n /*\n div.appendChild(dom.createElement('h4')).textContent = 'Login status'\n var loginStatusDiv = div.appendChild(context.dom.createElement('div'))\n // TODO: Find out what the actual type is:\n type UriType = unknown;\n loginStatusDiv.appendChild(UI.login.loginStatusBox(context.dom, () => {\n // Here we know new log in status\n }))\n */\n div.appendChild(dom.createElement('h4')).textContent =\n 'Create new thing somewhere'\n const creationDiv = div.appendChild(dom.createElement('div'))\n const creationContext: CreateContext = {\n div: creationDiv,\n dom: dom,\n statusArea: div,\n me: me\n }\n const relevantPanes = await login.filterAvailablePanes(\n context.session.paneRegistry.list\n )\n create.newThingUI(creationContext, context, relevantPanes) // newUI Have to pass panes down\n\n div.appendChild(dom.createElement('h4')).textContent = 'Private things'\n // TODO: Replace by a common, representative interface\n login\n .registrationList(homePaneContext, { private: true })\n .then(function (authContext) {\n div.appendChild(dom.createElement('h4')).textContent = 'Public things'\n div.appendChild(dom.createElement('p')).textContent =\n 'Things in this list are visible to others.'\n login\n .registrationList(authContext, { public: true })\n .then(function () {\n // done\n })\n })\n }\n\n const div = dom.createElement('div')\n const me: NamedNode = authn.currentUser() as NamedNode // this will be incorrect if not logged in\n\n showContent()\n\n return div\n }\n} // pane object\n\n// ends\nexport default HomePaneSource\n"],"mappings":";;;;;;;;;AAYA;;AACA;;+CAZA,oJ;;;;;;AAeA,IAAMA,cAA8B,GAAG;EACrCC,IAAI,EAAEC,cAAA,CAAMC,QAAN,GAAiB,iBADc;EACK;EAE1CC,MAAM,EAAE,IAH6B;EAKrCC,IAAI,EAAE,MAL+B;EAOrC;EACA;EACA;EACA;EACAC,KAAK,EAAE,iBAAY;IACjB,OAAO,MAAP;EACD,CAboC;EAerCC,MAAM,EAAE,gBAAUC,OAAV,EAAmBC,OAAnB,EAA4B;IAClC,IAAMC,GAAG,GAAGD,OAAO,CAACC,GAApB;;IACA,IAAMC,WAAW;MAAA,sEAAG;QAAA;QAAA;UAAA;YAAA;cAAA;gBACZC,eADY,GACM;kBAAEC,GAAG,EAAEA,GAAP;kBAAYH,GAAG,EAAEA,GAAjB;kBAAsBI,UAAU,EAAED,GAAlC;kBAAuCE,EAAE,EAAEA;gBAA3C,CADN;gBAElB;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;gBACMF,GAAG,CAACG,WAAJ,CAAgBN,GAAG,CAACO,aAAJ,CAAkB,IAAlB,CAAhB,EAAyCC,WAAzC,GACE,4BADF;gBAEMC,WAbY,GAaEN,GAAG,CAACG,WAAJ,CAAgBN,GAAG,CAACO,aAAJ,CAAkB,KAAlB,CAAhB,CAbF;g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GAAP;EACD;AAhEoC,CAAvC,C,CAiEE;AAEF;;eACeb,c"}
@@ -1 +1 @@
1
- {"version":3,"file":"humanReadablePane.js","names":["humanReadablePane","icon","icons","originalIconBase","name","label","subject","context","kb","session","store","allowed","hasContentTypeIn","x","displayables","cts","fetcher","getHeader","j","length","k","indexOf","hasContentTypeIn2","t","findTypeURIs","Util","mediaTypeClass","uri","ns","link","render","myDocument","dom","div","createElement","doc","ct","console","log","setAttribute","element","frame","markdownHtml","webOperation","then","response","markdownText","responseText","lines","Math","min","split","res","marked","parse","innerHTML","_fetch","blob","objectURL","URL","createObjectURL","tr","appendChild"],"sources":["../src/humanReadablePane.js"],"sourcesContent":["/* Human-readable Pane\n **\n ** This outline pane contains the document contents for an HTML document\n ** This is for peeking at a page, because the user might not want to leave the data browser.\n */\nimport { icons, ns } from 'solid-ui'\nimport { Util } from 'rdflib'\nimport { marked } from 'marked'\n\nconst humanReadablePane = {\n icon: icons.originalIconBase + 'tango/22-text-x-generic.png',\n\n name: 'humanReadable',\n\n label: function (subject, context) {\n const kb = context.session.store\n\n // See also the source pane, which has lower precedence.\n\n const allowed = [\n 'text/plain',\n 'text/html',\n 'text/markdown',\n 'application/xhtml+xml',\n 'image/png',\n 'image/jpeg',\n 'application/pdf',\n 'video/mp4'\n ]\n\n const hasContentTypeIn = function (kb, x, displayables) {\n const cts = kb.fetcher.getHeader(x, 'content-type')\n if (cts) {\n for (let j = 0; j < cts.length; j++) {\n for (let k = 0; k < displayables.length; k++) {\n if (cts[j].indexOf(displayables[k]) >= 0) {\n return true\n }\n }\n }\n }\n return false\n }\n\n // This data could come from a fetch OR from ldp container\n const hasContentTypeIn2 = function (kb, x, displayables) {\n const t = kb.findTypeURIs(subject)\n for (let k = 0; k < displayables.length; k++) {\n if (Util.mediaTypeClass(displayables[k]).uri in t) {\n return true\n }\n }\n return false\n }\n\n if (!subject.uri) return null // no bnodes\n\n const t = kb.findTypeURIs(subject)\n if (t[ns.link('WebPage').uri]) return 'view'\n\n if (\n hasContentTypeIn(kb, subject, allowed) ||\n hasContentTypeIn2(kb, subject, allowed)\n ) {\n return 'View'\n }\n\n return null\n },\n\n render: function (subject, context) {\n const myDocument = context.dom\n const div = myDocument.createElement('div')\n const kb = context.session.store\n\n const cts = kb.fetcher.getHeader(subject.doc(), 'content-type')\n const ct = cts ? cts[0] : null\n if (ct) {\n console.log('humanReadablePane: c-t:' + ct)\n } else {\n console.log('humanReadablePane: unknown content-type?')\n }\n\n // @@ When we can, use CSP to turn off scripts within the iframe\n div.setAttribute('class', 'docView')\n const element = ct === 'text/markdown' ? 'DIV' : 'IFRAME'\n const frame = myDocument.createElement(element)\n\n // render markdown to html\n const markdownHtml = function () {\n kb.fetcher.webOperation('GET', subject.uri).then(response => {\n const markdownText = response.responseText\n const lines = Math.min(30, markdownText.split(/\\n/).length + 5)\n const res = marked.parse(markdownText)\n frame.innerHTML = res\n frame.setAttribute('class', 'doc')\n frame.setAttribute('style', `border: 1px solid; padding: 1em; height: ${lines}em; width: 800px; resize: both; overflow: auto;`)\n })\n }\n\n if (ct === 'text/markdown') {\n markdownHtml()\n } else if (ct !== 'text/html') {\n // get with authenticated fetch\n kb.fetcher._fetch(subject.uri)\n .then(function(response) {\n return response.blob()\n })\n .then(function(blob) {\n const objectURL = URL.createObjectURL(blob)\n frame.setAttribute('src', objectURL) // w640 h480 //\n frame.setAttribute('class', 'doc')\n frame.setAttribute('style', `border: 1px solid; padding: 1em; height:120em; width:80em; resize: both; overflow: auto;`)\n })\n } else {\n frame.setAttribute('src', subject.uri) // allow-same-origin\n frame.setAttribute('class', 'doc')\n frame.setAttribute('style', 'resize = both; height:120em; width:80em;')\n }\n // @@ Note below - if we set ANY sandbox, then Chrome and Safari won't display it if it is PDF.\n // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe\n // You can't have any sandbox and allow plugins.\n // We could sandbox only HTML files I suppose.\n // HTML5 bug: https://lists.w3.org/Archives/Public/public-html/2011Jun/0330.html\n\n // iframe.setAttribute('sandbox', 'allow-same-origin allow-forms'); // allow-scripts ?? no documents should be static\n\n // iframe.setAttribute('height', '480')\n // iframe.setAttribute('width', '640')\n const tr = myDocument.createElement('TR')\n tr.appendChild(frame)\n div.appendChild(tr)\n return div\n }\n}\n\nexport default humanReadablePane\n// ends\n"],"mappings":";;;;;;;AAKA;;AACA;;AACA;;AAPA;AACA;AACA;AACA;AACA;AAKA,IAAMA,iBAAiB,GAAG;EACxBC,IAAI,EAAEC,eAAMC,gBAAN,GAAyB,6BADP;EAGxBC,IAAI,EAAE,eAHkB;EAKxBC,KAAK,EAAE,eAAUC,OAAV,EAAmBC,OAAnB,EAA4B;IACjC,IAAMC,EAAE,GAAGD,OAAO,CAACE,OAAR,CAAgBC,KAA3B,CADiC,CAGjC;;IAEA,IAAMC,OAAO,GAAG,CACd,YADc,EAEd,WAFc,EAGd,eAHc,EAId,uBAJc,EAKd,WALc,EAMd,YANc,EAOd,iBAPc,EAQd,WARc,CAAhB;;IAWA,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAmB,CAAUJ,EAAV,EAAcK,CAAd,EAAiBC,YAAjB,EAA+B;MACtD,IAAMC,GAAG,GAAGP,EAAE,CAACQ,OAAH,CAAWC,SAAX,CAAqBJ,CAArB,EAAwB,cAAxB,CAAZ;;MACA,IAAIE,GAAJ,EAAS;QACP,KAAK,IAAIG,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGH,GAAG,CAACI,MAAxB,EAAgCD,CAAC,EAAjC,EAAqC;UACnC,KAAK,IAAIE,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGN,YAAY,CAACK,MAAjC,EAAyCC,CAAC,EAA1C,EAA8C;YAC5C,IAAIL,GAAG,CAACG,CAAD,CAAH,CAAOG,OAAP,CAAeP,YAAY,CAACM,CAAD,CAA3B,KAAmC,CAAvC,EAA0C;cACxC,OAAO,IAAP;YACD;UACF;QACF;MACF;;MACD,OAAO,KAAP;IACD,CAZD,CAhBiC,CA8BjC;;;IACA,IA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IAAT,EAAP;MACD,CAHH,EAIGb,IAJH,CAIQ,UAASa,IAAT,EAAe;QACnB,IAAMC,SAAS,GAAGC,GAAG,CAACC,eAAJ,CAAoBH,IAApB,CAAlB;QACAhB,KAAK,CAACF,YAAN,CAAmB,KAAnB,EAA0BmB,SAA1B,EAFmB,CAEkB;;QACrCjB,KAAK,CAACF,YAAN,CAAmB,OAAnB,EAA4B,KAA5B;QACAE,KAAK,CAACF,YAAN,CAAmB,OAAnB;MACD,CATH;IAUD,CAZM,MAYA;MACLE,KAAK,CAACF,YAAN,CAAmB,KAAnB,EAA0BjC,OAAO,CAACqB,GAAlC,EADK,CACkC;;MACvCc,KAAK,CAACF,YAAN,CAAmB,OAAnB,EAA4B,KAA5B;MACAE,KAAK,CAACF,YAAN,CAAmB,OAAnB,EAA4B,0CAA5B;IACD,CAhDiC,CAiDlC;IACA;IACA;IACA;IACA;IAEA;IAEA;IACA;;;IACA,IAAMsB,EAAE,GAAG9B,UAAU,CAACG,aAAX,CAAyB,IAAzB,CAAX;IACA2B,EAAE,CAACC,WAAH,CAAerB,KAAf;IACAR,GAAG,CAAC6B,WAAJ,CAAgBD,EAAhB;IACA,OAAO5B,GAAP;EACD;AA5HuB,CAA1B;eA+HejC,iB,EACf"}
1
+ {"version":3,"file":"humanReadablePane.js","names":["humanReadablePane","icon","icons","originalIconBase","name","label","subject","context","kb","session","store","allowed","hasContentTypeIn","x","displayables","cts","fetcher","getHeader","j","length","k","indexOf","hasContentTypeIn2","t","findTypeURIs","Util","mediaTypeClass","uri","ns","link","render","myDocument","dom","div","createElement","doc","ct","console","log","setAttribute","element","frame","markdownHtml","webOperation","then","response","markdownText","responseText","lines","Math","min","split","res","marked","parse","innerHTML","_fetch","blob","objectURL","URL","createObjectURL","tr","appendChild"],"sources":["../src/humanReadablePane.js"],"sourcesContent":["/* Human-readable Pane\n **\n ** This outline pane contains the document contents for an HTML document\n ** This is for peeking at a page, because the user might not want to leave the data browser.\n */\nimport { icons, ns } from 'solid-ui'\nimport { Util } from 'rdflib'\nimport { marked } from 'marked'\n\nconst humanReadablePane = {\n icon: icons.originalIconBase + 'tango/22-text-x-generic.png',\n\n name: 'humanReadable',\n\n label: function (subject, context) {\n const kb = context.session.store\n\n // See also the source pane, which has lower precedence.\n\n const allowed = [\n 'text/plain',\n 'text/html',\n 'text/markdown',\n 'application/xhtml+xml',\n 'image/png',\n 'image/jpeg',\n 'application/pdf',\n 'video/mp4'\n ]\n\n const hasContentTypeIn = function (kb, x, displayables) {\n const cts = kb.fetcher.getHeader(x, 'content-type')\n if (cts) {\n for (let j = 0; j < cts.length; j++) {\n for (let k = 0; k < displayables.length; k++) {\n if (cts[j].indexOf(displayables[k]) >= 0) {\n return true\n }\n }\n }\n }\n return false\n }\n\n // This data could come from a fetch OR from ldp container\n const hasContentTypeIn2 = function (kb, x, displayables) {\n const t = kb.findTypeURIs(subject)\n for (let k = 0; k < displayables.length; k++) {\n if (Util.mediaTypeClass(displayables[k]).uri in t) {\n return true\n }\n }\n return false\n }\n\n if (!subject.uri) return null // no bnodes\n\n const t = kb.findTypeURIs(subject)\n if (t[ns.link('WebPage').uri]) return 'view'\n\n if (\n hasContentTypeIn(kb, subject, allowed) ||\n hasContentTypeIn2(kb, subject, allowed)\n ) {\n return 'View'\n }\n\n return null\n },\n\n render: function (subject, context) {\n const myDocument = context.dom\n const div = myDocument.createElement('div')\n const kb = context.session.store\n\n const cts = kb.fetcher.getHeader(subject.doc(), 'content-type')\n const ct = cts ? cts[0] : null\n if (ct) {\n console.log('humanReadablePane: c-t:' + ct)\n } else {\n console.log('humanReadablePane: unknown content-type?')\n }\n\n // @@ When we can, use CSP to turn off scripts within the iframe\n div.setAttribute('class', 'docView')\n const element = ct === 'text/markdown' ? 'DIV' : 'IFRAME'\n const frame = myDocument.createElement(element)\n\n // render markdown to html\n const markdownHtml = function () {\n kb.fetcher.webOperation('GET', subject.uri).then(response => {\n const markdownText = response.responseText\n const lines = Math.min(30, markdownText.split(/\\n/).length + 5)\n const res = marked.parse(markdownText)\n frame.innerHTML = res\n frame.setAttribute('class', 'doc')\n frame.setAttribute('style', `border: 1px solid; padding: 1em; height: ${lines}em; width: 800px; resize: both; overflow: auto;`)\n })\n }\n\n if (ct === 'text/markdown') {\n markdownHtml()\n } else if (ct !== 'text/html') {\n // get with authenticated fetch\n kb.fetcher._fetch(subject.uri)\n .then(function(response) {\n return response.blob()\n })\n .then(function(blob) {\n const objectURL = URL.createObjectURL(blob)\n frame.setAttribute('src', objectURL) // w640 h480 //\n frame.setAttribute('class', 'doc')\n frame.setAttribute('style', `border: 1px solid; padding: 1em; height:120em; width:80em; resize: both; overflow: auto;`)\n })\n } else {\n frame.setAttribute('src', subject.uri) // allow-same-origin\n frame.setAttribute('class', 'doc')\n frame.setAttribute('style', 'resize = both; height:120em; width:80em;')\n }\n // @@ Note below - if we set ANY sandbox, then Chrome and Safari won't display it if it is PDF.\n // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe\n // You can't have any sandbox and allow plugins.\n // We could sandbox only HTML files I suppose.\n // HTML5 bug: https://lists.w3.org/Archives/Public/public-html/2011Jun/0330.html\n\n // iframe.setAttribute('sandbox', 'allow-same-origin allow-forms'); // allow-scripts ?? no documents should be static\n\n // iframe.setAttribute('height', '480')\n // iframe.setAttribute('width', '640')\n const tr = myDocument.createElement('TR')\n tr.appendChild(frame)\n div.appendChild(tr)\n return div\n }\n}\n\nexport default humanReadablePane\n// ends\n"],"mappings":";;;;;;;AAKA;;AACA;;AACA;;AAPA;AACA;AACA;AACA;AACA;AAKA,IAAMA,iBAAiB,GAAG;EACxBC,IAAI,EAAEC,cAAA,CAAMC,gBAAN,GAAyB,6BADP;EAGxBC,IAAI,EAAE,eAHkB;EAKxBC,KAAK,EAAE,eAAUC,OAAV,EAAmBC,OAAnB,EAA4B;IACjC,IAAMC,EAAE,GAAGD,OAAO,CAACE,OAAR,CAAgBC,KAA3B,CADiC,CAGjC;;IAEA,IAAMC,OAAO,GAAG,CACd,YADc,EA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AA4B,0CAA5B;IACD,CAhDiC,CAiDlC;IACA;IACA;IACA;IACA;IAEA;IAEA;IACA;;;IACA,IAAMsB,EAAE,GAAG9B,UAAU,CAACG,aAAX,CAAyB,IAAzB,CAAX;IACA2B,EAAE,CAACC,WAAH,CAAerB,KAAf;IACAR,GAAG,CAAC6B,WAAJ,CAAgBD,EAAhB;IACA,OAAO5B,GAAP;EACD;AA5HuB,CAA1B;eA+HejC,iB,EACf"}
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["getOutliner","dom","outlineManager","context","list","paneForIcon","paneForPredicate","register","byName","store","solidLogicSingleton","OutlineManager","window","document","cjsOrEsModule","panes"],"sources":["../src/index.ts"],"sourcesContent":["/* SOLID PANES\n **\n ** Panes are regions of the outline view in which a particular subject is\n ** displayed in a particular way.\n ** Different panes about the same subject are typically stacked vertically.\n ** Panes may be used naked or with a pane selection header.\n **\n ** The label() method has two functions: it determines whether the pane is\n ** relevant to a given subject, returning null if not.\n ** If it is relevant, then it returns a suitable tooltip for a control which selects the pane\n */\n\nimport versionInfo from './versionInfo'\nimport * as UI from 'solid-ui'\nimport { LiveStore } from 'rdflib'\nimport { solidLogicSingleton, store } from 'solid-logic'\nimport OutlineManager from './outline/manager.js'\nimport registerPanes from './registerPanes.js'\nimport {\n list,\n paneForIcon,\n paneForPredicate,\n register,\n byName\n} from 'pane-registry'\nimport { createContext } from './outline/context'\nimport initMainPage from './mainPage'\n\nfunction getOutliner (dom) {\n if (!dom.outlineManager) {\n const context = createContext(\n dom,\n { list, paneForIcon, paneForPredicate, register, byName },\n store as LiveStore,\n solidLogicSingleton\n )\n dom.outlineManager = new OutlineManager(context)\n }\n return dom.outlineManager\n}\n\nif (typeof window !== 'undefined') {\n getOutliner(window.document)\n}\n\nregisterPanes((cjsOrEsModule: any) => register(cjsOrEsModule.default || cjsOrEsModule))\n\n// This has common outline mode functionality for the default and other other panes\n// A separate outline manager is required per DOM in cases like a browser extension\n// where there are many occurrences of window and of window.document\n// But each DOM should have just one outline manager.\n\nexport {\n OutlineManager,\n getOutliner,\n UI,\n versionInfo,\n initMainPage,\n list, // from paneRegistry\n paneForIcon, // from paneRegistry\n paneForPredicate, // from paneRegistry\n register, // from paneRegistry\n byName // from paneRegistry\n}\n\n// export for simpler access by non-node scripts\nif (typeof window !== 'undefined') {\n ;(<any>window).panes = {\n getOutliner\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA;;AACA;;;;AAEA;;AACA;;AACA;;AACA;;AAOA;;AACA;;;;;;;;AA1BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAkBA,SAASA,WAAT,CAAsBC,GAAtB,EAA2B;EACzB,IAAI,CAACA,GAAG,CAACC,cAAT,EAAyB;IACvB,IAAMC,OAAO,GAAG,4BACdF,GADc,EAEd;MAAEG,IAAI,EAAJA,kBAAF;MAAQC,WAAW,EAAXA,yBAAR;MAAqBC,gBAAgB,EAAhBA,8BAArB;MAAuCC,QAAQ,EAARA,sBAAvC;MAAiDC,MAAM,EAANA;IAAjD,CAFc,EAGRC,iBAHQ,EAIRC,+BAJQ,CAAhB;IAMAT,GAAG,CAACC,cAAJ,GAAqB,IAAIS,mBAAJ,CAAmBR,OAAnB,CAArB;EACD;;EACD,OAAOF,GAAG,CAACC,cAAX;AACD;;AAED,IAAI,OAAOU,MAAP,KAAkB,WAAtB,EAAmC;EACjCZ,WAAW,CAACY,MAAM,CAACC,QAAR,CAAX;AACD;;AAED,+BAAc,UAACC,aAAD;EAAA,OAAwB,4BAASA,aAAa,WAAb,IAAyBA,aAAlC,CAAxB;AAAA,CAAd,E,CAEA;AACA;AACA;AACA;;AAeA;AACA,IAAI,OAAOF,MAAP,KAAkB,WAAtB,EAAmC;EACjC;EAAOA,MAAN,CAAcG,KAAd,GAAsB;IACrBf,WAAW,EAAXA;EADqB,CAAtB;AAGF"}
1
+ {"version":3,"file":"index.js","names":["getOutliner","dom","outlineManager","context","createContext","list","paneForIcon","paneForPredicate","register","byName","store","solidLogicSingleton","OutlineManager","window","document","registerPanes","cjsOrEsModule","panes"],"sources":["../src/index.ts"],"sourcesContent":["/* SOLID PANES\n **\n ** Panes are regions of the outline view in which a particular subject is\n ** displayed in a particular way.\n ** Different panes about the same subject are typically stacked vertically.\n ** Panes may be used naked or with a pane selection header.\n **\n ** The label() method has two functions: it determines whether the pane is\n ** relevant to a given subject, returning null if not.\n ** If it is relevant, then it returns a suitable tooltip for a control which selects the pane\n */\n\nimport versionInfo from './versionInfo'\nimport * as UI from 'solid-ui'\nimport { LiveStore } from 'rdflib'\nimport { solidLogicSingleton, store } from 'solid-logic'\nimport OutlineManager from './outline/manager.js'\nimport registerPanes from './registerPanes.js'\nimport {\n list,\n paneForIcon,\n paneForPredicate,\n register,\n byName\n} from 'pane-registry'\nimport { createContext } from './outline/context'\nimport initMainPage from './mainPage'\n\nfunction getOutliner (dom) {\n if (!dom.outlineManager) {\n const context = createContext(\n dom,\n { list, paneForIcon, paneForPredicate, register, byName },\n store as LiveStore,\n solidLogicSingleton\n )\n dom.outlineManager = new OutlineManager(context)\n }\n return dom.outlineManager\n}\n\nif (typeof window !== 'undefined') {\n getOutliner(window.document)\n}\n\nregisterPanes((cjsOrEsModule: any) => register(cjsOrEsModule.default || cjsOrEsModule))\n\n// This has common outline mode functionality for the default and other other panes\n// A separate outline manager is required per DOM in cases like a browser extension\n// where there are many occurrences of window and of window.document\n// But each DOM should have just one outline manager.\n\nexport {\n OutlineManager,\n getOutliner,\n UI,\n versionInfo,\n initMainPage,\n list, // from paneRegistry\n paneForIcon, // from paneRegistry\n paneForPredicate, // from paneRegistry\n register, // from paneRegistry\n byName // from paneRegistry\n}\n\n// export for simpler access by non-node scripts\nif (typeof window !== 'undefined') {\n ;(<any>window).panes = {\n getOutliner\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA;;AACA;;;;AAEA;;AACA;;AACA;;AACA;;AAOA;;AACA;;;;;;;;AA1BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAkBA,SAASA,WAAT,CAAsBC,GAAtB,EAA2B;EACzB,IAAI,CAACA,GAAG,CAACC,cAAT,EAAyB;IACvB,IAAMC,OAAO,GAAG,IAAAC,sBAAA,EACdH,GADc,EAEd;MAAEI,IAAI,EAAJA,kBAAF;MAAQC,WAAW,EAAXA,yBAAR;MAAqBC,gBAAgB,EAAhBA,8BAArB;MAAuCC,QAAQ,EAARA,sBAAvC;MAAiDC,MAAM,EAANA;IAAjD,CAFc,EAGRC,iBAHQ,EAIRC,+BAJQ,CAAhB;IAMAV,GAAG,CAACC,cAAJ,GAAqB,IAAIU,mBAAJ,CAAmBT,OAAnB,CAArB;EACD;;EACD,OAAOF,GAAG,CAACC,cAAX;AACD;;AAED,IAAI,OAAOW,MAAP,KAAkB,WAAtB,EAAmC;EACjCb,WAAW,CAACa,MAAM,CAACC,QAAR,CAAX;AACD;;AAED,IAAAC,yBAAA,EAAc,UAACC,aAAD;EAAA,OAAwB,IAAAR,sBAAA,EAASQ,aAAa,WAAb,IAAyBA,aAAlC,CAAxB;AAAA,CAAd,E,CAEA;AACA;AACA;AACA;;AAeA;AACA,IAAI,OAAOH,MAAP,KAAkB,WAAtB,EAAmC;EACjC;EAAOA,MAAN,CAAcI,KAAd,GAAsB;IACrBjB,WAAW,EAAXA;EADqB,CAAtB;AAGF"}