solid-ui 3.0.4-aea68a1 → 3.0.4-c7330d3

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
@@ -4913,8 +4913,6 @@ function basicField(dom, container, already, subject, form, doc, callbackFunctio
4913
4913
  field.style = inputStyle;
4914
4914
  rhs.appendChild(field);
4915
4915
  field.setAttribute('type', params.type ? params.type : 'text');
4916
- var fieldType = (field.getAttribute('type') || '').toLowerCase();
4917
- var deferWhileFocused = fieldType === 'date' || fieldType === 'datetime-local';
4918
4916
  var size = kb.anyJS(form, src_ns.ui('size')) || styleConstants.textInputSize || 20;
4919
4917
  field.setAttribute('size', size);
4920
4918
  var maxLength = kb.any(form, src_ns.ui('maxLength'));
@@ -4953,13 +4951,9 @@ function basicField(dom, container, already, subject, form, doc, callbackFunctio
4953
4951
  }
4954
4952
  }, true);
4955
4953
  field.addEventListener('change', function (_e) {
4956
- if (deferWhileFocused && dom.activeElement === field) return;
4957
4954
  // i.e. lose focus with changed data
4958
4955
  if (params.pattern && !field.value.match(params.pattern)) return;
4959
- var disabledForSave = !deferWhileFocused;
4960
- if (disabledForSave) {
4961
- field.disabled = true; // See if this stops getting two dates from fumbling e.g the chrome datepicker.
4962
- }
4956
+ field.disabled = true; // See if this stops getting two dates from fumbling e.g the chrome datepicker.
4963
4957
  field.setAttribute('style', inputStyle + 'color: gray;'); // pending
4964
4958
  var ds = kb.statementsMatching(subject, property); // remove any multiple values
4965
4959
  var result;
@@ -5027,9 +5021,7 @@ function basicField(dom, container, already, subject, form, doc, callbackFunctio
5027
5021
  updateMany(ds, is, function (uri, ok, body) {
5028
5022
  // kb.updater.update(ds, is, function (uri, ok, body) {
5029
5023
  if (ok) {
5030
- if (disabledForSave) {
5031
- field.disabled = false;
5032
- }
5024
+ field.disabled = false;
5033
5025
  field.setAttribute('style', inputStyle);
5034
5026
  } else {
5035
5027
  box.appendChild(errorMessageBlock(dom, body));
@@ -9585,7 +9577,7 @@ function ensureLoadedPreferences(_x) {
9585
9577
  // used to be logInLoadProfile
9586
9578
  function _ensureLoadedPreferences() {
9587
9579
  _ensureLoadedPreferences = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee4(context) {
9588
- var progressDisplay, preferencesFile, m2, _t4;
9580
+ var progressDisplay, preferencesFile, m2, errorMessage, _t4;
9589
9581
  return regenerator_default().wrap(function (_context4) {
9590
9582
  while (1) switch (_context4.prev = _context4.next) {
9591
9583
  case 0:
@@ -9613,14 +9605,15 @@ function _ensureLoadedPreferences() {
9613
9605
  case 4:
9614
9606
  _context4.prev = 4;
9615
9607
  _t4 = _context4["catch"](1);
9616
- if (!(_t4 instanceof external_SolidLogic_.UnauthorizedError)) {
9608
+ errorMessage = _t4 instanceof Error ? _t4.message : "".concat(_t4);
9609
+ if (!(_t4 instanceof external_SolidLogic_.UnauthorizedError || /status:\s*401|unauthorized/i.test(errorMessage))) {
9617
9610
  _context4.next = 5;
9618
9611
  break;
9619
9612
  }
9620
- m2 = 'Oops — you are not authenticated (properly logged in), so SolidOS cannot read your preferences file. Try logging out and then logging back in.';
9621
- log_alert(m2);
9622
- _context4.next = 11;
9623
- break;
9613
+ m2 = 'Not logged in, so preferences were not loaded.';
9614
+ context.preferencesFileError = m2;
9615
+ src_debug/* warn */.R8(m2);
9616
+ return _context4.abrupt("return", context);
9624
9617
  case 5:
9625
9618
  if (!(_t4 instanceof external_SolidLogic_.CrossOriginForbiddenError)) {
9626
9619
  _context4.next = 6;
@@ -9686,7 +9679,7 @@ function ensureLoadedProfile(_x2) {
9686
9679
  */
9687
9680
  function _ensureLoadedProfile() {
9688
9681
  _ensureLoadedProfile = asyncToGenerator_asyncToGenerator(/*#__PURE__*/regenerator_default().mark(function _callee5(context) {
9689
- var logInContext, _t5;
9682
+ var logInContext, notLoggedInMessage, message, _notLoggedInMessage, loggedInUser, isNonFatalProfileSideLoadFailure, _t5;
9690
9683
  return regenerator_default().wrap(function (_context5) {
9691
9684
  while (1) switch (_context5.prev = _context5.next) {
9692
9685
  case 0:
@@ -9705,24 +9698,51 @@ function _ensureLoadedProfile() {
9705
9698
  _context5.next = 3;
9706
9699
  break;
9707
9700
  }
9708
- throw new Error('Could not log in');
9701
+ notLoggedInMessage = 'Not logged in, so profile was not loaded.';
9702
+ src_debug/* log */.Rm(notLoggedInMessage);
9703
+ if (context.div && context.dom) {
9704
+ context.div.appendChild(errorMessageBlock(context.dom, notLoggedInMessage));
9705
+ }
9706
+ return _context5.abrupt("return", context);
9709
9707
  case 3:
9710
9708
  _context5.next = 4;
9711
9709
  return loadProfile(logInContext.me);
9712
9710
  case 4:
9713
9711
  context.publicProfile = _context5.sent;
9714
- _context5.next = 6;
9712
+ _context5.next = 8;
9715
9713
  break;
9716
9714
  case 5:
9717
9715
  _context5.prev = 5;
9718
9716
  _t5 = _context5["catch"](1);
9717
+ message = _t5 instanceof Error ? _t5.message : "".concat(_t5);
9718
+ if (!/status:\s*401|unauthorized/i.test(message)) {
9719
+ _context5.next = 6;
9720
+ break;
9721
+ }
9722
+ _notLoggedInMessage = 'Not logged in, so profile was not loaded.';
9723
+ src_debug/* warn */.R8(_notLoggedInMessage);
9719
9724
  if (context.div && context.dom) {
9720
- context.div.appendChild(errorMessageBlock(context.dom, _t5.message));
9725
+ context.div.appendChild(errorMessageBlock(context.dom, _notLoggedInMessage));
9721
9726
  }
9722
- throw new Error("Can't log in: ".concat(_t5));
9727
+ return _context5.abrupt("return", context);
9723
9728
  case 6:
9729
+ loggedInUser = logInContext && logInContext.me;
9730
+ isNonFatalProfileSideLoadFailure = !!loggedInUser && (_t5 instanceof external_SolidLogic_.CrossOriginForbiddenError || _t5 instanceof external_SolidLogic_.SameOriginForbiddenError || /status:\s*403\b|forbidden/i.test(message) || /cancel/i.test(message));
9731
+ if (!isNonFatalProfileSideLoadFailure) {
9732
+ _context5.next = 7;
9733
+ break;
9734
+ }
9735
+ src_debug/* warn */.R8("Unable to load all profile-linked resources; continuing as logged in user: ".concat(message));
9736
+ context.publicProfile = loggedInUser.doc();
9724
9737
  return _context5.abrupt("return", context);
9725
9738
  case 7:
9739
+ if (context.div && context.dom) {
9740
+ context.div.appendChild(errorMessageBlock(context.dom, message));
9741
+ }
9742
+ throw new Error("Can't log in: ".concat(_t5));
9743
+ case 8:
9744
+ return _context5.abrupt("return", context);
9745
+ case 9:
9726
9746
  case "end":
9727
9747
  return _context5.stop();
9728
9748
  }