solid-ui 3.0.4-355237d → 3.0.4-55ce599

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
@@ -8264,31 +8264,9 @@ field[src_ns.ui('Classifier').uri] = function (dom, container, already, subject,
8264
8264
  if (!ok) return callbackFunction(ok, body);
8265
8265
  return callbackFunction(ok, body);
8266
8266
  };
8267
- // Create container for label and select
8268
- var outerBox = dom.createElement('div');
8269
- outerBox.setAttribute('class', 'classifierBox');
8270
- // Render label
8271
- var labelDiv = dom.createElement('div');
8272
- labelDiv.setAttribute('class', 'formFieldName classifierBox-label');
8273
- // Use fieldLabel to render ui:label if present
8274
- labelDiv.appendChild(fieldLabel(dom, category, form));
8275
- outerBox.appendChild(labelDiv);
8276
- // Render select
8277
- var selectBox = dom.createElement('div');
8278
- selectBox.setAttribute('class', 'formFieldValue classifierBox-selectBox');
8279
- var selectElement = makeSelectForNestedCategory(dom, kb, subject, category, dataDoc, checkOptions);
8280
- // Set readonly if not editable
8281
- if (selectElement && selectElement.querySelector && selectElement.querySelector('select')) {
8282
- var select = selectElement.querySelector('select');
8283
- if (select && !kb.updater.editable(dataDoc.uri)) {
8284
- select.readOnly = true;
8285
- select.style = style.textInputStyleUneditable;
8286
- }
8287
- }
8288
- selectBox.appendChild(selectElement);
8289
- outerBox.appendChild(selectBox);
8290
- if (container) container.appendChild(outerBox);
8291
- return outerBox;
8267
+ var box = makeSelectForNestedCategory(dom, kb, subject, category, dataDoc, checkOptions);
8268
+ if (container) container.appendChild(box);
8269
+ return box;
8292
8270
  };
8293
8271
 
8294
8272
  /** Choice field
@@ -9544,6 +9522,13 @@ var _solidLogicSingleton$2 = external_SolidLogic_.solidLogicSingleton.typeIndex,
9544
9522
  loadAllTypeIndexes = _solidLogicSingleton$2.loadAllTypeIndexes,
9545
9523
  getScopedAppsFromIndex = _solidLogicSingleton$2.getScopedAppsFromIndex,
9546
9524
  deleteTypeIndexRegistration = _solidLogicSingleton$2.deleteTypeIndexRegistration;
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
+ }
9547
9532
 
9548
9533
  /**
9549
9534
  * Resolves with the logged in user's WebID
@@ -9614,78 +9599,100 @@ function _ensureLoadedPreferences() {
9614
9599
  return ensureLoadedProfile(context);
9615
9600
  case 2:
9616
9601
  context = _context4.sent;
9617
- _context4.next = 3;
9618
- return loadPreferences(context.me);
9602
+ if (context.me) {
9603
+ _context4.next = 3;
9604
+ break;
9605
+ }
9606
+ context.preferencesFileError = 'Not logged in, so preferences were not loaded.';
9607
+ return _context4.abrupt("return", context);
9619
9608
  case 3:
9609
+ _context4.next = 4;
9610
+ return loadPreferences(context.me);
9611
+ case 4:
9620
9612
  preferencesFile = _context4.sent;
9621
9613
  if (progressDisplay) {
9622
9614
  progressDisplay.parentNode.removeChild(progressDisplay);
9623
9615
  }
9624
9616
  context.preferencesFile = preferencesFile;
9625
- _context4.next = 11;
9617
+ _context4.next = 13;
9626
9618
  break;
9627
- case 4:
9628
- _context4.prev = 4;
9619
+ case 5:
9620
+ _context4.prev = 5;
9629
9621
  _t4 = _context4["catch"](1);
9630
9622
  if (!(_t4 instanceof external_SolidLogic_.UnauthorizedError)) {
9631
- _context4.next = 5;
9632
- break;
9633
- }
9634
- m2 = 'Oops — you are not authenticated (properly logged in), so SolidOS cannot read your preferences file. Try logging out and then logging back in.';
9635
- log_alert(m2);
9636
- _context4.next = 11;
9637
- break;
9638
- case 5:
9639
- if (!(_t4 instanceof external_SolidLogic_.CrossOriginForbiddenError)) {
9640
9623
  _context4.next = 6;
9641
9624
  break;
9642
9625
  }
9643
- m2 = "Unauthorized: Assuming preference file blocked for origin ".concat(window.location.origin);
9626
+ m2 = 'Oops you are not authenticated (properly logged in), so SolidOS cannot read your preferences file. Try logging out and then logging back in.';
9644
9627
  context.preferencesFileError = m2;
9628
+ log_alert(m2);
9645
9629
  return _context4.abrupt("return", context);
9646
9630
  case 6:
9647
- if (!(_t4 instanceof external_SolidLogic_.SameOriginForbiddenError)) {
9631
+ if (!(_t4 instanceof external_SolidLogic_.CrossOriginForbiddenError)) {
9648
9632
  _context4.next = 7;
9649
9633
  break;
9650
9634
  }
9651
- m2 = 'You are not authorized to read your preference file. This may be because you are using an untrusted web app.';
9652
- src_debug/* warn */.R8(m2);
9635
+ 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.");
9636
+ context.preferencesFileError = m2;
9653
9637
  return _context4.abrupt("return", context);
9654
9638
  case 7:
9655
- if (!(_t4 instanceof external_SolidLogic_.NotEditableError)) {
9639
+ if (!(_t4 instanceof external_SolidLogic_.SameOriginForbiddenError)) {
9656
9640
  _context4.next = 8;
9657
9641
  break;
9658
9642
  }
9659
- m2 = 'You are not authorized to edit your preference file. This may be because you are using an untrusted web app.';
9643
+ m2 = 'You are not authorized to read your preference file from this app context.';
9644
+ context.preferencesFileError = m2;
9660
9645
  src_debug/* warn */.R8(m2);
9661
9646
  return _context4.abrupt("return", context);
9662
9647
  case 8:
9663
- if (!(_t4 instanceof external_SolidLogic_.WebOperationError)) {
9648
+ if (!(_t4 instanceof external_SolidLogic_.NotEditableError)) {
9664
9649
  _context4.next = 9;
9665
9650
  break;
9666
9651
  }
9667
- m2 = 'You are not authorized to edit your preference file. This may be because you are using an untrusted web app.';
9652
+ m2 = 'You are not authorized to edit your preference file from this app context.';
9653
+ context.preferencesFileError = m2;
9668
9654
  src_debug/* warn */.R8(m2);
9669
- _context4.next = 11;
9670
- break;
9655
+ return _context4.abrupt("return", context);
9671
9656
  case 9:
9672
- if (!(_t4 instanceof external_SolidLogic_.FetchError)) {
9657
+ if (!(_t4 instanceof external_SolidLogic_.WebOperationError)) {
9673
9658
  _context4.next = 10;
9674
9659
  break;
9675
9660
  }
9676
- m2 = "Strange: Error ".concat(_t4.status, " trying to read your preference file.").concat(_t4.message);
9677
- log_alert(m2);
9678
- _context4.next = 11;
9679
- break;
9661
+ m2 = formatDynamicError(_t4, 'Preference file web operation failed');
9662
+ context.preferencesFileError = m2;
9663
+ src_debug/* warn */.R8(m2);
9664
+ return _context4.abrupt("return", context);
9680
9665
  case 10:
9681
- throw new Error("(via loadPrefs) ".concat(_t4));
9666
+ if (!(_t4 instanceof external_SolidLogic_.FetchError)) {
9667
+ _context4.next = 12;
9668
+ break;
9669
+ }
9670
+ if (!(_t4.status === 404)) {
9671
+ _context4.next = 11;
9672
+ break;
9673
+ }
9674
+ m2 = 'Your preferences file was not found (404). It may not exist yet.';
9675
+ context.preferencesFileError = m2;
9676
+ src_debug/* warn */.R8(m2);
9677
+ return _context4.abrupt("return", context);
9682
9678
  case 11:
9679
+ m2 = formatDynamicError(_t4, 'Error reading your preferences file');
9680
+ context.preferencesFileError = m2;
9681
+ src_debug/* warn */.R8(m2);
9682
+ log_alert(m2);
9683
9683
  return _context4.abrupt("return", context);
9684
9684
  case 12:
9685
+ m2 = formatDynamicError(_t4, 'Unexpected error while loading preferences');
9686
+ context.preferencesFileError = m2;
9687
+ src_debug/* error */.z3(m2);
9688
+ return _context4.abrupt("return", context);
9689
+ case 13:
9690
+ return _context4.abrupt("return", context);
9691
+ case 14:
9685
9692
  case "end":
9686
9693
  return _context4.stop();
9687
9694
  }
9688
- }, _callee4, null, [[1, 4]]);
9695
+ }, _callee4, null, [[1, 5]]);
9689
9696
  }));
9690
9697
  return _ensureLoadedPreferences.apply(this, arguments);
9691
9698
  }
@@ -9700,7 +9707,7 @@ function ensureLoadedProfile(_x2) {
9700
9707
  */
9701
9708
  function _ensureLoadedProfile() {
9702
9709
  _ensureLoadedProfile = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee5(context) {
9703
- var logInContext, _t5;
9710
+ var logInContext, message, _message, _t5;
9704
9711
  return regenerator_default().wrap(function (_context5) {
9705
9712
  while (1) switch (_context5.prev = _context5.next) {
9706
9713
  case 0:
@@ -9719,7 +9726,9 @@ function _ensureLoadedProfile() {
9719
9726
  _context5.next = 3;
9720
9727
  break;
9721
9728
  }
9722
- throw new Error('Could not log in');
9729
+ message = 'Could not log in; skipping profile load.';
9730
+ src_debug/* log */.Rm(message);
9731
+ throw new Error(message);
9723
9732
  case 3:
9724
9733
  _context5.next = 4;
9725
9734
  return loadProfile(logInContext.me);
@@ -9730,10 +9739,11 @@ function _ensureLoadedProfile() {
9730
9739
  case 5:
9731
9740
  _context5.prev = 5;
9732
9741
  _t5 = _context5["catch"](1);
9742
+ _message = formatDynamicError(_t5, 'Unable to load your profile');
9733
9743
  if (context.div && context.dom) {
9734
- context.div.appendChild(errorMessageBlock(context.dom, _t5.message));
9744
+ context.div.appendChild(errorMessageBlock(context.dom, _message));
9735
9745
  }
9736
- throw new Error("Can't log in: ".concat(_t5));
9746
+ throw new Error(_message);
9737
9747
  case 6:
9738
9748
  return _context5.abrupt("return", context);
9739
9749
  case 7:
@@ -10655,7 +10665,7 @@ function getUserRoles() {
10655
10665
  */
10656
10666
  function _getUserRoles() {
10657
10667
  _getUserRoles = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee0() {
10658
- var _yield$ensureLoadedPr, me, preferencesFile, preferencesFileError, _t0;
10668
+ var _yield$ensureLoadedPr, me, preferencesFile, preferencesFileError, authState, _t0;
10659
10669
  return regenerator_default().wrap(function (_context1) {
10660
10670
  while (1) switch (_context1.prev = _context1.next) {
10661
10671
  case 0:
@@ -10667,23 +10677,30 @@ function _getUserRoles() {
10667
10677
  me = _yield$ensureLoadedPr.me;
10668
10678
  preferencesFile = _yield$ensureLoadedPr.preferencesFile;
10669
10679
  preferencesFileError = _yield$ensureLoadedPr.preferencesFileError;
10670
- if (!(!preferencesFile || preferencesFileError)) {
10680
+ if (!preferencesFileError) {
10671
10681
  _context1.next = 2;
10672
10682
  break;
10673
10683
  }
10674
10684
  throw new Error(preferencesFileError);
10675
10685
  case 2:
10676
- return _context1.abrupt("return", external_SolidLogic_.solidLogicSingleton.store.each(me, src_ns.rdf('type'), null, preferencesFile.doc()));
10686
+ if (preferencesFile) {
10687
+ _context1.next = 3;
10688
+ break;
10689
+ }
10690
+ authState = me ? "logged in as ".concat(me.value || me.uri) : 'not logged in';
10691
+ throw new Error("Preferences file unavailable (".concat(authState, ")"));
10677
10692
  case 3:
10678
- _context1.prev = 3;
10693
+ return _context1.abrupt("return", external_SolidLogic_.solidLogicSingleton.store.each(me, src_ns.rdf('type'), null, preferencesFile.doc()));
10694
+ case 4:
10695
+ _context1.prev = 4;
10679
10696
  _t0 = _context1["catch"](0);
10680
- src_debug/* warn */.R8('Unable to fetch your preferences - this was the error: ', _t0);
10697
+ src_debug/* warn */.R8(formatDynamicError(_t0, 'Unable to fetch your preferences'));
10681
10698
  return _context1.abrupt("return", []);
10682
- case 4:
10699
+ case 5:
10683
10700
  case "end":
10684
10701
  return _context1.stop();
10685
10702
  }
10686
- }, _callee0, null, [[0, 3]]);
10703
+ }, _callee0, null, [[0, 4]]);
10687
10704
  }));
10688
10705
  return _getUserRoles.apply(this, arguments);
10689
10706
  }
@@ -24226,7 +24243,7 @@ function tabWidget(options) {
24226
24243
  _getColors2 = _slicedToArray(_getColors, 2),
24227
24244
  selectedColor = _getColors2[0],
24228
24245
  color = _getColors2[1];
24229
- var bodyMainStyle = "display: grid; width: auto; height: 100%; border: 0.1em; border-style: solid; border-color: ".concat(selectedColor, "; padding: 1em;");
24246
+ var bodyMainStyle = "flex: 2; width: auto; height: 100%; border: 0.1em; border-style: solid; border-color: ".concat(selectedColor, "; padding: 1em;");
24230
24247
  var rootElement = dom.createElement('div'); // 20200117a
24231
24248
 
24232
24249
  rootElement.setAttribute('style', style.tabsRootElement);