solid-ui 3.0.4-31cdaaf → 3.0.4-37fd944

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/solid-ui.js CHANGED
@@ -4091,7 +4091,7 @@ function attachmentList(dom, subject, div) {
4091
4091
  var attachmentRight = attachmentOne.appendChild(dom.createElement('td'));
4092
4092
  var attachmentTable = attachmentRight.appendChild(dom.createElement('table'));
4093
4093
  attachmentTable.appendChild(dom.createElement('tr')) // attachmentTableTop
4094
- ;
4094
+ ;
4095
4095
  attachmentOuter.refresh = refresh; // Participate in downstream changes
4096
4096
  // ;(attachmentTable as any).refresh = refresh <- outer should be best?
4097
4097
 
@@ -4936,7 +4936,7 @@ function basicField(dom, container, already, subject, form, doc, callbackFunctio
4936
4936
  }
4937
4937
  if (!kb.updater.editable(doc.uri)) {
4938
4938
  field.readOnly = true // was: disabled. readOnly is better
4939
- ;
4939
+ ;
4940
4940
  field.style = style.textInputStyleUneditable + paramStyle;
4941
4941
  if (suppressEmptyUneditable && field.value === '') {
4942
4942
  box.style.display = 'none'; // clutter
@@ -9522,13 +9522,150 @@ var _solidLogicSingleton$2 = external_SolidLogic_.solidLogicSingleton.typeIndex,
9522
9522
  loadAllTypeIndexes = _solidLogicSingleton$2.loadAllTypeIndexes,
9523
9523
  getScopedAppsFromIndex = _solidLogicSingleton$2.getScopedAppsFromIndex,
9524
9524
  deleteTypeIndexRegistration = _solidLogicSingleton$2.deleteTypeIndexRegistration;
9525
-
9525
+ function formatDynamicError(error, contextLabel) {
9526
+ var e = error;
9527
+ var name = (e === null || e === void 0 ? void 0 : e.name) || 'Error';
9528
+ var status = typeof (e === null || e === void 0 ? void 0 : e.status) === 'number' ? " (HTTP ".concat(e.status, ")") : '';
9529
+ var message = e !== null && e !== void 0 && e.message ? String(e.message) : typeof error === 'string' ? error : 'No additional details provided';
9530
+ return "".concat(contextLabel, ": ").concat(name).concat(status, " - ").concat(message);
9531
+ }
9532
+ function guessPreferencesFileUri(me) {
9533
+ return me.uri.replace('/profile/', '/').replace('/public/', '/').split('/').slice(0, -1).join('/') + '/settings/prefs.ttl';
9534
+ }
9535
+ function getMissingPreferencesFileUri(context, err) {
9536
+ var _response;
9537
+ var responseUrl = err === null || err === void 0 || (_response = err.response) === null || _response === void 0 ? void 0 : _response.url;
9538
+ if (typeof responseUrl === 'string' && responseUrl) {
9539
+ return responseUrl;
9540
+ }
9541
+ if (context.me) {
9542
+ var pointer = login_store.any(context.me, src_ns.space('preferencesFile'), undefined, context.me.doc ? context.me.doc() : undefined);
9543
+ if (pointer !== null && pointer !== void 0 && pointer.uri) {
9544
+ return pointer.uri;
9545
+ }
9546
+ return guessPreferencesFileUri(context.me);
9547
+ }
9548
+ return null;
9549
+ }
9550
+ function ensurePreferencesFileRowInProfile(_x, _x2, _x3) {
9551
+ return _ensurePreferencesFileRowInProfile.apply(this, arguments);
9552
+ }
9553
+ function _ensurePreferencesFileRowInProfile() {
9554
+ _ensurePreferencesFileRowInProfile = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee4(me, prefsNode, profileDoc) {
9555
+ var existingPreferencesFile, deletions, insertions;
9556
+ return regenerator_default().wrap(function (_context4) {
9557
+ while (1) switch (_context4.prev = _context4.next) {
9558
+ case 0:
9559
+ existingPreferencesFile = login_store.any(me, src_ns.space('preferencesFile'), undefined, profileDoc);
9560
+ if (!(existingPreferencesFile && existingPreferencesFile.equals(prefsNode))) {
9561
+ _context4.next = 1;
9562
+ break;
9563
+ }
9564
+ return _context4.abrupt("return");
9565
+ case 1:
9566
+ if (login_store.updater) {
9567
+ _context4.next = 2;
9568
+ break;
9569
+ }
9570
+ throw new Error('Cannot create preferences file: store has no updater');
9571
+ case 2:
9572
+ deletions = existingPreferencesFile ? [(0,external_$rdf_.st)(me, src_ns.space('preferencesFile'), existingPreferencesFile, profileDoc)] : [];
9573
+ insertions = [(0,external_$rdf_.st)(me, src_ns.space('preferencesFile'), prefsNode, profileDoc)];
9574
+ _context4.next = 3;
9575
+ return new Promise(function (resolve, reject) {
9576
+ login_store.updater.update(deletions, insertions, function (_uri, ok, body) {
9577
+ if (ok) {
9578
+ resolve();
9579
+ } else {
9580
+ reject(new Error(body || 'Unable to update preferencesFile in WebID profile'));
9581
+ }
9582
+ });
9583
+ });
9584
+ case 3:
9585
+ case "end":
9586
+ return _context4.stop();
9587
+ }
9588
+ }, _callee4);
9589
+ }));
9590
+ return _ensurePreferencesFileRowInProfile.apply(this, arguments);
9591
+ }
9592
+ function buildPreferencesFileTurtle(me) {
9593
+ var mbox = login_store.any(me, src_ns.foaf('mbox'));
9594
+ var mboxLine = mbox ? "\n<".concat(me.uri, "> foaf:mbox <").concat(mbox.value, "> .\n") : '\n';
9595
+ return '@prefix dct: <http://purl.org/dc/terms/>.\n' + '@prefix pim: <http://www.w3.org/ns/pim/space#>.\n' + '@prefix foaf: <http://xmlns.com/foaf/0.1/>.\n' + '@prefix solid: <http://www.w3.org/ns/solid/terms#>.\n\n' + '<>\n' + ' a pim:ConfigurationFile;\n\n' + ' dct:title "Preferences file" .\n' + mboxLine + "<".concat(me.uri, ">\n") + ' solid:publicTypeIndex <publicTypeIndex.ttl> ;\n' + ' solid:privateTypeIndex <privateTypeIndex.ttl> .\n';
9596
+ }
9597
+ function writePreferencesFileDocument(_x4, _x5) {
9598
+ return _writePreferencesFileDocument.apply(this, arguments);
9599
+ }
9600
+ function _writePreferencesFileDocument() {
9601
+ _writePreferencesFileDocument = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee5(uri, data) {
9602
+ return regenerator_default().wrap(function (_context5) {
9603
+ while (1) switch (_context5.prev = _context5.next) {
9604
+ case 0:
9605
+ if (login_store.fetcher) {
9606
+ _context5.next = 1;
9607
+ break;
9608
+ }
9609
+ throw new Error('Cannot create preferences file: store has no fetcher');
9610
+ case 1:
9611
+ _context5.next = 2;
9612
+ return login_store.fetcher.webOperation('PUT', uri, {
9613
+ data: data,
9614
+ contentType: 'text/turtle'
9615
+ });
9616
+ case 2:
9617
+ case "end":
9618
+ return _context5.stop();
9619
+ }
9620
+ }, _callee5);
9621
+ }));
9622
+ return _writePreferencesFileDocument.apply(this, arguments);
9623
+ }
9624
+ function createPreferencesFile(_x6, _x7) {
9625
+ return _createPreferencesFile.apply(this, arguments);
9626
+ }
9526
9627
  /**
9527
9628
  * Resolves with the logged in user's WebID
9528
9629
  *
9529
9630
  * @param context
9530
9631
  */
9531
9632
  // used to be logIn
9633
+ function _createPreferencesFile() {
9634
+ _createPreferencesFile = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee6(context, uri) {
9635
+ var me, profileDoc, prefsNode, prefsTurtle;
9636
+ return regenerator_default().wrap(function (_context6) {
9637
+ while (1) switch (_context6.prev = _context6.next) {
9638
+ case 0:
9639
+ me = context.me || external_SolidLogic_.authn.currentUser();
9640
+ if (me) {
9641
+ _context6.next = 1;
9642
+ break;
9643
+ }
9644
+ throw new Error('Cannot create preferences file: no logged-in WebID');
9645
+ case 1:
9646
+ context.me = me;
9647
+ profileDoc = me.doc();
9648
+ prefsNode = login_store.sym(uri);
9649
+ _context6.next = 2;
9650
+ return ensurePreferencesFileRowInProfile(me, prefsNode, profileDoc);
9651
+ case 2:
9652
+ prefsTurtle = buildPreferencesFileTurtle(me);
9653
+ _context6.next = 3;
9654
+ return writePreferencesFileDocument(uri, prefsTurtle);
9655
+ case 3:
9656
+ _context6.next = 4;
9657
+ return loadPreferences(me);
9658
+ case 4:
9659
+ context.preferencesFile = _context6.sent;
9660
+ context.preferencesFileError = undefined;
9661
+ case 5:
9662
+ case "end":
9663
+ return _context6.stop();
9664
+ }
9665
+ }, _callee6);
9666
+ }));
9667
+ return _createPreferencesFile.apply(this, arguments);
9668
+ }
9532
9669
  function ensureLoggedIn(context) {
9533
9670
  var me = external_SolidLogic_.authn.currentUser();
9534
9671
  if (me) {
@@ -9563,7 +9700,7 @@ function ensureLoggedIn(context) {
9563
9700
  * @param context
9564
9701
  */
9565
9702
  // used to be logInLoadPreferences
9566
- function ensureLoadedPreferences(_x) {
9703
+ function ensureLoadedPreferences(_x8) {
9567
9704
  return _ensureLoadedPreferences.apply(this, arguments);
9568
9705
  }
9569
9706
 
@@ -9576,98 +9713,143 @@ function ensureLoadedPreferences(_x) {
9576
9713
  */
9577
9714
  // used to be logInLoadProfile
9578
9715
  function _ensureLoadedPreferences() {
9579
- _ensureLoadedPreferences = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee4(context) {
9580
- var progressDisplay, preferencesFile, m2, _t4;
9581
- return regenerator_default().wrap(function (_context4) {
9582
- while (1) switch (_context4.prev = _context4.next) {
9716
+ _ensureLoadedPreferences = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee7(context) {
9717
+ var progressDisplay, preferencesFile, m2, missingPreferencesFileUri, message, _t4, _t5;
9718
+ return regenerator_default().wrap(function (_context7) {
9719
+ while (1) switch (_context7.prev = _context7.next) {
9583
9720
  case 0:
9584
9721
  if (!context.preferencesFile) {
9585
- _context4.next = 1;
9722
+ _context7.next = 1;
9586
9723
  break;
9587
9724
  }
9588
- return _context4.abrupt("return", Promise.resolve(context));
9725
+ return _context7.abrupt("return", Promise.resolve(context));
9589
9726
  case 1:
9590
- _context4.prev = 1;
9591
- _context4.next = 2;
9727
+ _context7.prev = 1;
9728
+ _context7.next = 2;
9592
9729
  return ensureLoadedProfile(context);
9593
9730
  case 2:
9594
- context = _context4.sent;
9595
- _context4.next = 3;
9596
- return loadPreferences(context.me);
9731
+ context = _context7.sent;
9732
+ if (context.me) {
9733
+ _context7.next = 3;
9734
+ break;
9735
+ }
9736
+ context.preferencesFileError = 'Not logged in, so preferences were not loaded.';
9737
+ src_debug/* log */.Rm('not logged in, no preferences loaded');
9738
+ return _context7.abrupt("return", context);
9597
9739
  case 3:
9598
- preferencesFile = _context4.sent;
9740
+ _context7.next = 4;
9741
+ return loadPreferences(context.me);
9742
+ case 4:
9743
+ preferencesFile = _context7.sent;
9599
9744
  if (progressDisplay) {
9600
9745
  progressDisplay.parentNode.removeChild(progressDisplay);
9601
9746
  }
9602
9747
  context.preferencesFile = preferencesFile;
9603
- _context4.next = 11;
9748
+ _context7.next = 17;
9604
9749
  break;
9605
- case 4:
9606
- _context4.prev = 4;
9607
- _t4 = _context4["catch"](1);
9750
+ case 5:
9751
+ _context7.prev = 5;
9752
+ _t4 = _context7["catch"](1);
9608
9753
  if (!(_t4 instanceof external_SolidLogic_.UnauthorizedError)) {
9609
- _context4.next = 5;
9754
+ _context7.next = 6;
9610
9755
  break;
9611
9756
  }
9612
9757
  m2 = 'Oops — you are not authenticated (properly logged in), so SolidOS cannot read your preferences file. Try logging out and then logging back in.';
9758
+ context.preferencesFileError = m2;
9613
9759
  log_alert(m2);
9614
- _context4.next = 11;
9615
- break;
9616
- case 5:
9760
+ return _context7.abrupt("return", context);
9761
+ case 6:
9617
9762
  if (!(_t4 instanceof external_SolidLogic_.CrossOriginForbiddenError)) {
9618
- _context4.next = 6;
9763
+ _context7.next = 7;
9619
9764
  break;
9620
9765
  }
9621
- m2 = "Unauthorized: Assuming preference file blocked for origin ".concat(window.location.origin);
9766
+ m2 = "Blocked by origin: preference file request from ".concat(window.location.origin, " was forbidden. Ensure this app origin is trusted/allowed for your preferences file.");
9622
9767
  context.preferencesFileError = m2;
9623
- return _context4.abrupt("return", context);
9624
- case 6:
9768
+ return _context7.abrupt("return", context);
9769
+ case 7:
9625
9770
  if (!(_t4 instanceof external_SolidLogic_.SameOriginForbiddenError)) {
9626
- _context4.next = 7;
9771
+ _context7.next = 8;
9627
9772
  break;
9628
9773
  }
9629
- m2 = 'You are not authorized to read your preference file. This may be because you are using an untrusted web app.';
9774
+ m2 = 'You are not authorized to read your preference file from this app context.';
9775
+ context.preferencesFileError = m2;
9630
9776
  src_debug/* warn */.R8(m2);
9631
- return _context4.abrupt("return", context);
9632
- case 7:
9777
+ return _context7.abrupt("return", context);
9778
+ case 8:
9633
9779
  if (!(_t4 instanceof external_SolidLogic_.NotEditableError)) {
9634
- _context4.next = 8;
9780
+ _context7.next = 9;
9635
9781
  break;
9636
9782
  }
9637
- m2 = 'You are not authorized to edit your preference file. This may be because you are using an untrusted web app.';
9783
+ m2 = 'You are not authorized to edit your preference file from this app context.';
9784
+ context.preferencesFileError = m2;
9638
9785
  src_debug/* warn */.R8(m2);
9639
- return _context4.abrupt("return", context);
9640
- case 8:
9786
+ return _context7.abrupt("return", context);
9787
+ case 9:
9641
9788
  if (!(_t4 instanceof external_SolidLogic_.WebOperationError)) {
9642
- _context4.next = 9;
9789
+ _context7.next = 10;
9643
9790
  break;
9644
9791
  }
9645
- m2 = 'You are not authorized to edit your preference file. This may be because you are using an untrusted web app.';
9792
+ m2 = formatDynamicError(_t4, 'Preference file web operation failed');
9793
+ context.preferencesFileError = m2;
9646
9794
  src_debug/* warn */.R8(m2);
9647
- _context4.next = 11;
9648
- break;
9649
- case 9:
9795
+ return _context7.abrupt("return", context);
9796
+ case 10:
9650
9797
  if (!(_t4 instanceof external_SolidLogic_.FetchError)) {
9651
- _context4.next = 10;
9798
+ _context7.next = 16;
9652
9799
  break;
9653
9800
  }
9654
- m2 = "Strange: Error ".concat(_t4.status, " trying to read your preference file.").concat(_t4.message);
9655
- log_alert(m2);
9656
- _context4.next = 11;
9657
- break;
9658
- case 10:
9659
- throw new Error("(via loadPrefs) ".concat(_t4));
9660
- case 11:
9661
- return _context4.abrupt("return", context);
9801
+ if (!(_t4.status === 404)) {
9802
+ _context7.next = 15;
9803
+ break;
9804
+ }
9805
+ m2 = 'Your preferences file was not found (404). It may not exist yet.';
9806
+ src_debug/* warn */.R8(m2);
9807
+ missingPreferencesFileUri = getMissingPreferencesFileUri(context, _t4);
9808
+ if (!missingPreferencesFileUri) {
9809
+ _context7.next = 14;
9810
+ break;
9811
+ }
9812
+ _context7.prev = 11;
9813
+ _context7.next = 12;
9814
+ return createPreferencesFile(context, missingPreferencesFileUri);
9662
9815
  case 12:
9816
+ src_debug/* log */.Rm("Preferences file created automatically: ".concat(missingPreferencesFileUri));
9817
+ return _context7.abrupt("return", context);
9818
+ case 13:
9819
+ _context7.prev = 13;
9820
+ _t5 = _context7["catch"](11);
9821
+ message = formatDynamicError(_t5, 'Failed to create preferences file automatically');
9822
+ context.preferencesFileError = message;
9823
+ src_debug/* error */.z3(message);
9824
+ if (context.div && context.dom) {
9825
+ context.div.appendChild(errorMessageBlock(context.dom, message));
9826
+ }
9827
+ return _context7.abrupt("return", context);
9828
+ case 14:
9829
+ context.preferencesFileError = m2;
9830
+ return _context7.abrupt("return", context);
9831
+ case 15:
9832
+ m2 = formatDynamicError(_t4, 'Error reading your preferences file');
9833
+ context.preferencesFileError = m2;
9834
+ src_debug/* warn */.R8(m2);
9835
+ log_alert(m2);
9836
+ return _context7.abrupt("return", context);
9837
+ case 16:
9838
+ m2 = formatDynamicError(_t4, 'Unexpected error while loading preferences');
9839
+ context.preferencesFileError = m2;
9840
+ src_debug/* error */.z3(m2);
9841
+ return _context7.abrupt("return", context);
9842
+ case 17:
9843
+ return _context7.abrupt("return", context);
9844
+ case 18:
9663
9845
  case "end":
9664
- return _context4.stop();
9846
+ return _context7.stop();
9665
9847
  }
9666
- }, _callee4, null, [[1, 4]]);
9848
+ }, _callee7, null, [[1, 5], [11, 13]]);
9667
9849
  }));
9668
9850
  return _ensureLoadedPreferences.apply(this, arguments);
9669
9851
  }
9670
- function ensureLoadedProfile(_x2) {
9852
+ function ensureLoadedProfile(_x9) {
9671
9853
  return _ensureLoadedProfile.apply(this, arguments);
9672
9854
  }
9673
9855
 
@@ -9677,74 +9859,77 @@ function ensureLoadedProfile(_x2) {
9677
9859
  * leaving the `isPublic` param undefined will bring in community index things, too
9678
9860
  */
9679
9861
  function _ensureLoadedProfile() {
9680
- _ensureLoadedProfile = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee5(context) {
9681
- var logInContext, _t5;
9682
- return regenerator_default().wrap(function (_context5) {
9683
- while (1) switch (_context5.prev = _context5.next) {
9862
+ _ensureLoadedProfile = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee8(context) {
9863
+ var logInContext, message, _message, _t6;
9864
+ return regenerator_default().wrap(function (_context8) {
9865
+ while (1) switch (_context8.prev = _context8.next) {
9684
9866
  case 0:
9685
9867
  if (!context.publicProfile) {
9686
- _context5.next = 1;
9868
+ _context8.next = 1;
9687
9869
  break;
9688
9870
  }
9689
- return _context5.abrupt("return", context);
9871
+ return _context8.abrupt("return", context);
9690
9872
  case 1:
9691
- _context5.prev = 1;
9692
- _context5.next = 2;
9873
+ _context8.prev = 1;
9874
+ _context8.next = 2;
9693
9875
  return ensureLoggedIn(context);
9694
9876
  case 2:
9695
- logInContext = _context5.sent;
9877
+ logInContext = _context8.sent;
9696
9878
  if (logInContext.me) {
9697
- _context5.next = 3;
9879
+ _context8.next = 3;
9698
9880
  break;
9699
9881
  }
9700
- throw new Error('Could not log in');
9882
+ message = 'Could not log in; skipping profile load.';
9883
+ src_debug/* log */.Rm(message);
9884
+ throw new Error(message);
9701
9885
  case 3:
9702
- _context5.next = 4;
9886
+ _context8.next = 4;
9703
9887
  return loadProfile(logInContext.me);
9704
9888
  case 4:
9705
- context.publicProfile = _context5.sent;
9706
- _context5.next = 6;
9889
+ context.publicProfile = _context8.sent;
9890
+ _context8.next = 6;
9707
9891
  break;
9708
9892
  case 5:
9709
- _context5.prev = 5;
9710
- _t5 = _context5["catch"](1);
9893
+ _context8.prev = 5;
9894
+ _t6 = _context8["catch"](1);
9895
+ _message = formatDynamicError(_t6, 'Unable to load your profile');
9711
9896
  if (context.div && context.dom) {
9712
- context.div.appendChild(errorMessageBlock(context.dom, _t5.message));
9897
+ context.div.appendChild(errorMessageBlock(context.dom, _message));
9713
9898
  }
9714
- throw new Error("Can't log in: ".concat(_t5));
9899
+ throw new Error(_message);
9715
9900
  case 6:
9716
- return _context5.abrupt("return", context);
9901
+ return _context8.abrupt("return", context);
9717
9902
  case 7:
9718
9903
  case "end":
9719
- return _context5.stop();
9904
+ return _context8.stop();
9720
9905
  }
9721
- }, _callee5, null, [[1, 5]]);
9906
+ }, _callee8, null, [[1, 5]]);
9722
9907
  }));
9723
9908
  return _ensureLoadedProfile.apply(this, arguments);
9724
9909
  }
9725
- function findAppInstances(_x3, _x4, _x5) {
9910
+ function findAppInstances(_x0, _x1, _x10) {
9726
9911
  return _findAppInstances.apply(this, arguments);
9727
9912
  }
9728
9913
  function _findAppInstances() {
9729
- _findAppInstances = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee6(context, theClass, isPublic) {
9730
- var items, _t6;
9731
- return regenerator_default().wrap(function (_context6) {
9732
- while (1) switch (_context6.prev = _context6.next) {
9914
+ _findAppInstances = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee9(context, theClass, isPublic) {
9915
+ var items, _t7;
9916
+ return regenerator_default().wrap(function (_context9) {
9917
+ while (1) switch (_context9.prev = _context9.next) {
9733
9918
  case 0:
9734
9919
  if (!context.me) {
9735
- _context6.next = 2;
9920
+ _context9.next = 2;
9736
9921
  break;
9737
9922
  }
9738
- _context6.next = 1;
9923
+ _context9.next = 1;
9739
9924
  return getScopedAppInstances(theClass, context.me);
9740
9925
  case 1:
9741
- _t6 = _context6.sent;
9742
- _context6.next = 3;
9926
+ _t7 = _context9.sent;
9927
+ _context9.next = 3;
9743
9928
  break;
9744
9929
  case 2:
9745
- _t6 = [];
9930
+ _t7 = [];
9746
9931
  case 3:
9747
- items = _t6;
9932
+ items = _t7;
9748
9933
  if (isPublic === true) {
9749
9934
  // old API - not recommended!
9750
9935
  items = items.filter(function (item) {
@@ -9758,12 +9943,12 @@ function _findAppInstances() {
9758
9943
  context.instances = items.map(function (item) {
9759
9944
  return item.instance;
9760
9945
  });
9761
- return _context6.abrupt("return", context);
9946
+ return _context9.abrupt("return", context);
9762
9947
  case 4:
9763
9948
  case "end":
9764
- return _context6.stop();
9949
+ return _context9.stop();
9765
9950
  }
9766
- }, _callee6);
9951
+ }, _callee9);
9767
9952
  }));
9768
9953
  return _findAppInstances.apply(this, arguments);
9769
9954
  }
@@ -9775,14 +9960,14 @@ function scopeLabel(context, scope) {
9775
9960
  /**
9776
9961
  * UI to control registration of instance
9777
9962
  */
9778
- function registrationControl(_x6, _x7, _x8) {
9963
+ function registrationControl(_x11, _x12, _x13) {
9779
9964
  return _registrationControl.apply(this, arguments);
9780
9965
  }
9781
9966
  function _registrationControl() {
9782
- _registrationControl = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee7(context, instance, theClass) {
9783
- var registrationStatements, renderScopeCheckbox, dom, box, me, scopes, msg, tbody, form, _iterator, _step, scope, row, _t7;
9784
- return regenerator_default().wrap(function (_context7) {
9785
- while (1) switch (_context7.prev = _context7.next) {
9967
+ _registrationControl = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee0(context, instance, theClass) {
9968
+ var registrationStatements, renderScopeCheckbox, dom, box, me, scopes, msg, tbody, form, _iterator, _step, scope, row, _t8;
9969
+ return regenerator_default().wrap(function (_context0) {
9970
+ while (1) switch (_context0.prev = _context0.next) {
9786
9971
  case 0:
9787
9972
  renderScopeCheckbox = function _renderScopeCheckbox(scope) {
9788
9973
  var statements = registrationStatements(scope.index);
@@ -9798,7 +9983,7 @@ function _registrationControl() {
9798
9983
  /// / body of registrationControl
9799
9984
  dom = context.dom;
9800
9985
  if (!(!dom || !context.div)) {
9801
- _context7.next = 1;
9986
+ _context0.next = 1;
9802
9987
  break;
9803
9988
  }
9804
9989
  throw new Error('registrationControl: need dom and div');
@@ -9808,31 +9993,31 @@ function _registrationControl() {
9808
9993
  context.me = external_SolidLogic_.authn.currentUser(); // @@
9809
9994
  me = context.me;
9810
9995
  if (me) {
9811
- _context7.next = 2;
9996
+ _context0.next = 2;
9812
9997
  break;
9813
9998
  }
9814
9999
  box.innerHTML = '<p style="margin:2em;">(Log in to save a link to this)</p>';
9815
- return _context7.abrupt("return", context);
10000
+ return _context0.abrupt("return", context);
9816
10001
  case 2:
9817
- _context7.prev = 2;
9818
- _context7.next = 3;
10002
+ _context0.prev = 2;
10003
+ _context0.next = 3;
9819
10004
  return loadAllTypeIndexes(me);
9820
10005
  case 3:
9821
- scopes = _context7.sent;
9822
- _context7.next = 5;
10006
+ scopes = _context0.sent;
10007
+ _context0.next = 5;
9823
10008
  break;
9824
10009
  case 4:
9825
- _context7.prev = 4;
9826
- _t7 = _context7["catch"](2);
10010
+ _context0.prev = 4;
10011
+ _t8 = _context0["catch"](2);
9827
10012
  if (context.div && context.preferencesFileError) {
9828
10013
  msg = '(Lists of stuff not available)';
9829
10014
  context.div.appendChild(dom.createElement('p')).textContent = msg;
9830
10015
  } else if (context.div) {
9831
- msg = "registrationControl: Type indexes not available: ".concat(_t7);
9832
- context.div.appendChild(errorMessageBlock(context.dom, _t7));
10016
+ msg = "registrationControl: Type indexes not available: ".concat(_t8);
10017
+ context.div.appendChild(errorMessageBlock(context.dom, _t8));
9833
10018
  }
9834
10019
  src_debug/* log */.Rm(msg);
9835
- return _context7.abrupt("return", context);
10020
+ return _context0.abrupt("return", context);
9836
10021
  case 5:
9837
10022
  box.innerHTML = '<table><tbody></tbody></table>'; // tbody will be inserted anyway
9838
10023
  box.setAttribute('style', 'font-size: 120%; text-align: right; padding: 1em; border: solid gray 0.05em;');
@@ -9850,12 +10035,12 @@ function _registrationControl() {
9850
10035
  } finally {
9851
10036
  _iterator.f();
9852
10037
  }
9853
- return _context7.abrupt("return", context);
10038
+ return _context0.abrupt("return", context);
9854
10039
  case 6:
9855
10040
  case "end":
9856
- return _context7.stop();
10041
+ return _context0.stop();
9857
10042
  }
9858
- }, _callee7, null, [[2, 4]]);
10043
+ }, _callee0, null, [[2, 4]]);
9859
10044
  }));
9860
10045
  return _registrationControl.apply(this, arguments);
9861
10046
  }
@@ -9878,7 +10063,7 @@ function renderScopeHeadingRow(context, store, scope) {
9878
10063
  /**
9879
10064
  * UI to List at all registered things
9880
10065
  */
9881
- function registrationList(_x9, _x0) {
10066
+ function registrationList(_x14, _x15) {
9882
10067
  return _registrationList.apply(this, arguments);
9883
10068
  } // registrationList
9884
10069
 
@@ -9892,10 +10077,10 @@ function registrationList(_x9, _x0) {
9892
10077
  * @returns
9893
10078
  */
9894
10079
  function _registrationList() {
9895
- _registrationList = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee9(context, options) {
9896
- var dom, div, box, scopes, table, tbody, _iterator2, _step2, scope, headingRow, items, _iterator3, _step3, _loop, _t8, _t9;
9897
- return regenerator_default().wrap(function (_context0) {
9898
- while (1) switch (_context0.prev = _context0.next) {
10080
+ _registrationList = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee10(context, options) {
10081
+ var dom, div, box, scopes, table, tbody, _iterator2, _step2, scope, headingRow, items, _iterator3, _step3, _loop, _t9, _t0;
10082
+ return regenerator_default().wrap(function (_context11) {
10083
+ while (1) switch (_context11.prev = _context11.next) {
9899
10084
  case 0:
9900
10085
  dom = context.dom;
9901
10086
  div = context.div;
@@ -9903,16 +10088,16 @@ function _registrationList() {
9903
10088
  div.appendChild(box);
9904
10089
  context.me = external_SolidLogic_.authn.currentUser(); // @@
9905
10090
  if (context.me) {
9906
- _context0.next = 1;
10091
+ _context11.next = 1;
9907
10092
  break;
9908
10093
  }
9909
10094
  box.innerHTML = '<p style="margin:2em;">(Log in list your stuff)</p>';
9910
- return _context0.abrupt("return", context);
10095
+ return _context11.abrupt("return", context);
9911
10096
  case 1:
9912
- _context0.next = 2;
10097
+ _context11.next = 2;
9913
10098
  return loadAllTypeIndexes(context.me);
9914
10099
  case 2:
9915
- scopes = _context0.sent;
10100
+ scopes = _context11.sent;
9916
10101
  // includes community indexes
9917
10102
 
9918
10103
  // console.log('@@ registrationList ', scopes)
@@ -9921,47 +10106,47 @@ function _registrationList() {
9921
10106
  table = box.firstChild;
9922
10107
  tbody = table.firstChild;
9923
10108
  _iterator2 = login_createForOfIteratorHelper(scopes);
9924
- _context0.prev = 3;
10109
+ _context11.prev = 3;
9925
10110
  _iterator2.s();
9926
10111
  case 4:
9927
10112
  if ((_step2 = _iterator2.n()).done) {
9928
- _context0.next = 13;
10113
+ _context11.next = 13;
9929
10114
  break;
9930
10115
  }
9931
10116
  scope = _step2.value;
9932
10117
  // need some predicate for listing/adding agents
9933
10118
  headingRow = renderScopeHeadingRow(context, login_store, scope);
9934
10119
  tbody.appendChild(headingRow);
9935
- _context0.next = 5;
10120
+ _context11.next = 5;
9936
10121
  return getScopedAppsFromIndex(scope, options.type || null);
9937
10122
  case 5:
9938
- items = _context0.sent;
10123
+ items = _context11.sent;
9939
10124
  // any class
9940
10125
  if (items.length === 0) headingRow.style.display = 'none';
9941
10126
  // console.log(`registrationList: @@ instance items for class ${options.type || 'undefined' }:`, items)
9942
10127
  _iterator3 = login_createForOfIteratorHelper(items);
9943
- _context0.prev = 6;
10128
+ _context11.prev = 6;
9944
10129
  _loop = /*#__PURE__*/regenerator_default().mark(function _loop() {
9945
10130
  var item, row;
9946
- return regenerator_default().wrap(function (_context9) {
9947
- while (1) switch (_context9.prev = _context9.next) {
10131
+ return regenerator_default().wrap(function (_context10) {
10132
+ while (1) switch (_context10.prev = _context10.next) {
9948
10133
  case 0:
9949
10134
  item = _step3.value;
9950
10135
  row = personTR(dom, src_ns.solid('instance'), item.instance, {
9951
10136
  deleteFunction: function () {
9952
- var _deleteFunction = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee8() {
9953
- return regenerator_default().wrap(function (_context8) {
9954
- while (1) switch (_context8.prev = _context8.next) {
10137
+ var _deleteFunction = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee1() {
10138
+ return regenerator_default().wrap(function (_context1) {
10139
+ while (1) switch (_context1.prev = _context1.next) {
9955
10140
  case 0:
9956
- _context8.next = 1;
10141
+ _context1.next = 1;
9957
10142
  return deleteTypeIndexRegistration(item);
9958
10143
  case 1:
9959
10144
  tbody.removeChild(row);
9960
10145
  case 2:
9961
10146
  case "end":
9962
- return _context8.stop();
10147
+ return _context1.stop();
9963
10148
  }
9964
- }, _callee8);
10149
+ }, _callee1);
9965
10150
  }));
9966
10151
  function deleteFunction() {
9967
10152
  return _deleteFunction.apply(this, arguments);
@@ -9973,52 +10158,52 @@ function _registrationList() {
9973
10158
  tbody.appendChild(row);
9974
10159
  case 1:
9975
10160
  case "end":
9976
- return _context9.stop();
10161
+ return _context10.stop();
9977
10162
  }
9978
10163
  }, _loop);
9979
10164
  });
9980
10165
  _iterator3.s();
9981
10166
  case 7:
9982
10167
  if ((_step3 = _iterator3.n()).done) {
9983
- _context0.next = 9;
10168
+ _context11.next = 9;
9984
10169
  break;
9985
10170
  }
9986
- return _context0.delegateYield(_loop(), "t0", 8);
10171
+ return _context11.delegateYield(_loop(), "t0", 8);
9987
10172
  case 8:
9988
- _context0.next = 7;
10173
+ _context11.next = 7;
9989
10174
  break;
9990
10175
  case 9:
9991
- _context0.next = 11;
10176
+ _context11.next = 11;
9992
10177
  break;
9993
10178
  case 10:
9994
- _context0.prev = 10;
9995
- _t8 = _context0["catch"](6);
9996
- _iterator3.e(_t8);
10179
+ _context11.prev = 10;
10180
+ _t9 = _context11["catch"](6);
10181
+ _iterator3.e(_t9);
9997
10182
  case 11:
9998
- _context0.prev = 11;
10183
+ _context11.prev = 11;
9999
10184
  _iterator3.f();
10000
- return _context0.finish(11);
10185
+ return _context11.finish(11);
10001
10186
  case 12:
10002
- _context0.next = 4;
10187
+ _context11.next = 4;
10003
10188
  break;
10004
10189
  case 13:
10005
- _context0.next = 15;
10190
+ _context11.next = 15;
10006
10191
  break;
10007
10192
  case 14:
10008
- _context0.prev = 14;
10009
- _t9 = _context0["catch"](3);
10010
- _iterator2.e(_t9);
10193
+ _context11.prev = 14;
10194
+ _t0 = _context11["catch"](3);
10195
+ _iterator2.e(_t0);
10011
10196
  case 15:
10012
- _context0.prev = 15;
10197
+ _context11.prev = 15;
10013
10198
  _iterator2.f();
10014
- return _context0.finish(15);
10199
+ return _context11.finish(15);
10015
10200
  case 16:
10016
- return _context0.abrupt("return", context);
10201
+ return _context11.abrupt("return", context);
10017
10202
  case 17:
10018
10203
  case "end":
10019
- return _context0.stop();
10204
+ return _context11.stop();
10020
10205
  }
10021
- }, _callee9, null, [[3, 14, 15, 16], [6, 10, 11, 12]]);
10206
+ }, _callee10, null, [[3, 14, 15, 16], [6, 10, 11, 12]]);
10022
10207
  }));
10023
10208
  return _registrationList.apply(this, arguments);
10024
10209
  }
@@ -10149,7 +10334,7 @@ function renderSignInPopup(dom) {
10149
10334
  }
10150
10335
  }, _callee, null, [[0, 2]]);
10151
10336
  }));
10152
- return function loginToIssuer(_x1) {
10337
+ return function loginToIssuer(_x16) {
10153
10338
  return _ref.apply(this, arguments);
10154
10339
  };
10155
10340
  }();
@@ -10396,7 +10581,7 @@ function selectWorkspace(dom, appDetails, callbackWS) {
10396
10581
  }
10397
10582
  function displayOptions(context) {
10398
10583
  // console.log('displayOptions!', context)
10399
- function makeNewWorkspace(_x10) {
10584
+ function makeNewWorkspace(_x17) {
10400
10585
  return _makeNewWorkspace.apply(this, arguments);
10401
10586
  } // const status = ''
10402
10587
  function _makeNewWorkspace() {
@@ -10632,60 +10817,67 @@ function getUserRoles() {
10632
10817
  * Filters which panes should be available, based on the result of [[getUserRoles]]
10633
10818
  */
10634
10819
  function _getUserRoles() {
10635
- _getUserRoles = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee0() {
10636
- var _yield$ensureLoadedPr, me, preferencesFile, preferencesFileError, _t0;
10637
- return regenerator_default().wrap(function (_context1) {
10638
- while (1) switch (_context1.prev = _context1.next) {
10820
+ _getUserRoles = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee11() {
10821
+ var _yield$ensureLoadedPr, me, preferencesFile, preferencesFileError, authState, _t1;
10822
+ return regenerator_default().wrap(function (_context12) {
10823
+ while (1) switch (_context12.prev = _context12.next) {
10639
10824
  case 0:
10640
- _context1.prev = 0;
10641
- _context1.next = 1;
10825
+ _context12.prev = 0;
10826
+ _context12.next = 1;
10642
10827
  return ensureLoadedPreferences({});
10643
10828
  case 1:
10644
- _yield$ensureLoadedPr = _context1.sent;
10829
+ _yield$ensureLoadedPr = _context12.sent;
10645
10830
  me = _yield$ensureLoadedPr.me;
10646
10831
  preferencesFile = _yield$ensureLoadedPr.preferencesFile;
10647
10832
  preferencesFileError = _yield$ensureLoadedPr.preferencesFileError;
10648
- if (!(!preferencesFile || preferencesFileError)) {
10649
- _context1.next = 2;
10833
+ if (!preferencesFileError) {
10834
+ _context12.next = 2;
10650
10835
  break;
10651
10836
  }
10652
10837
  throw new Error(preferencesFileError);
10653
10838
  case 2:
10654
- return _context1.abrupt("return", external_SolidLogic_.solidLogicSingleton.store.each(me, src_ns.rdf('type'), null, preferencesFile.doc()));
10839
+ if (preferencesFile) {
10840
+ _context12.next = 3;
10841
+ break;
10842
+ }
10843
+ authState = me ? "logged in as ".concat(me.value || me.uri) : 'not logged in';
10844
+ throw new Error("Preferences file unavailable (".concat(authState, ")"));
10655
10845
  case 3:
10656
- _context1.prev = 3;
10657
- _t0 = _context1["catch"](0);
10658
- src_debug/* warn */.R8('Unable to fetch your preferences - this was the error: ', _t0);
10659
- return _context1.abrupt("return", []);
10846
+ return _context12.abrupt("return", external_SolidLogic_.solidLogicSingleton.store.each(me, src_ns.rdf('type'), null, preferencesFile.doc()));
10660
10847
  case 4:
10848
+ _context12.prev = 4;
10849
+ _t1 = _context12["catch"](0);
10850
+ src_debug/* warn */.R8(formatDynamicError(_t1, 'Unable to fetch your preferences'));
10851
+ return _context12.abrupt("return", []);
10852
+ case 5:
10661
10853
  case "end":
10662
- return _context1.stop();
10854
+ return _context12.stop();
10663
10855
  }
10664
- }, _callee0, null, [[0, 3]]);
10856
+ }, _callee11, null, [[0, 4]]);
10665
10857
  }));
10666
10858
  return _getUserRoles.apply(this, arguments);
10667
10859
  }
10668
- function filterAvailablePanes(_x11) {
10860
+ function filterAvailablePanes(_x18) {
10669
10861
  return _filterAvailablePanes.apply(this, arguments);
10670
10862
  }
10671
10863
  function _filterAvailablePanes() {
10672
- _filterAvailablePanes = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee1(panes) {
10864
+ _filterAvailablePanes = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee12(panes) {
10673
10865
  var userRoles;
10674
- return regenerator_default().wrap(function (_context10) {
10675
- while (1) switch (_context10.prev = _context10.next) {
10866
+ return regenerator_default().wrap(function (_context13) {
10867
+ while (1) switch (_context13.prev = _context13.next) {
10676
10868
  case 0:
10677
- _context10.next = 1;
10869
+ _context13.next = 1;
10678
10870
  return getUserRoles();
10679
10871
  case 1:
10680
- userRoles = _context10.sent;
10681
- return _context10.abrupt("return", panes.filter(function (pane) {
10872
+ userRoles = _context13.sent;
10873
+ return _context13.abrupt("return", panes.filter(function (pane) {
10682
10874
  return isMatchingAudience(pane, userRoles);
10683
10875
  }));
10684
10876
  case 2:
10685
10877
  case "end":
10686
- return _context10.stop();
10878
+ return _context13.stop();
10687
10879
  }
10688
- }, _callee1);
10880
+ }, _callee12);
10689
10881
  }));
10690
10882
  return _filterAvailablePanes.apply(this, arguments);
10691
10883
  }
@@ -12826,7 +13018,7 @@ function cameraCaptureControl(dom, store, getImageDoc, doneCallback) {
12826
13018
  // if (!confirm('Save picture to ' + destination + ' ?')) return
12827
13019
  src_debug/* log */.Rm('Putting ' + blob.size + ' bytes of ' + contentType + ' to ' + destination)
12828
13020
  // @@ TODO Remove casting
12829
- ;
13021
+ ;
12830
13022
  store.fetcher.webOperation('PUT', destination.uri, {
12831
13023
  data: blob,
12832
13024
  contentType: contentType