solid-ui 3.0.5-test.7 → 3.0.5

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.
@@ -3205,6 +3205,8 @@ var AccessGroups = /*#__PURE__*/function () {
3205
3205
  thing,
3206
3206
  _this$_store,
3207
3207
  message,
3208
+ detectedTypes,
3209
+ typeDetails,
3208
3210
  error,
3209
3211
  _args4 = arguments,
3210
3212
  _t2;
@@ -3238,7 +3240,9 @@ var AccessGroups = /*#__PURE__*/function () {
3238
3240
  _context4.next = 6;
3239
3241
  break;
3240
3242
  }
3241
- error = " Error: Drop fails to drop appropriate thing! ".concat(uri);
3243
+ detectedTypes = Object.keys(this.store.findTypeURIs(thing));
3244
+ typeDetails = detectedTypes.length > 0 ? "Detected RDF types: ".concat(detectedTypes.join(', ')) : 'No RDF type was detected for this URI.';
3245
+ error = "Error: Failed to add access target: ".concat(uri, " is not a recognized ACL target type.") + " Expected one of: vcard:WebID, vcard:Group, foaf:Person, foaf:Agent, solid:AppProvider, solid:AppProviderClass, or recognized ACL classes." + ' Hint: try dropping a WebID profile URI, a vcard:Group URI, or a web app origin.' + typeDetails;
3242
3246
  _debug__WEBPACK_IMPORTED_MODULE_11__/* .error */ .z3(error);
3243
3247
  return _context4.abrupt("return", Promise.reject(new Error(error)));
3244
3248
  case 6:
@@ -18409,6 +18413,8 @@ function basicField(dom, container, already, subject, form, doc, callbackFunctio
18409
18413
  field.style = inputStyle;
18410
18414
  rhs.appendChild(field);
18411
18415
  field.setAttribute('type', params.type ? params.type : 'text');
18416
+ var fieldType = (field.getAttribute('type') || '').toLowerCase();
18417
+ var deferWhileFocused = fieldType === 'date' || fieldType === 'datetime-local';
18412
18418
  var size = kb.anyJS(form, _ns__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .A.ui('size')) || _styleConstants__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .A.textInputSize || 20;
18413
18419
  field.setAttribute('size', size);
18414
18420
  var maxLength = kb.any(form, _ns__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .A.ui('maxLength'));
@@ -18447,9 +18453,18 @@ function basicField(dom, container, already, subject, form, doc, callbackFunctio
18447
18453
  }
18448
18454
  }, true);
18449
18455
  field.addEventListener('change', function (_e) {
18456
+ if (deferWhileFocused && dom.activeElement === field) {
18457
+ if (field.dataset) {
18458
+ field.dataset.deferredChange = 'true';
18459
+ }
18460
+ return;
18461
+ }
18450
18462
  // i.e. lose focus with changed data
18451
18463
  if (params.pattern && !field.value.match(params.pattern)) return;
18452
- field.disabled = true; // See if this stops getting two dates from fumbling e.g the chrome datepicker.
18464
+ var disabledForSave = !deferWhileFocused;
18465
+ if (disabledForSave) {
18466
+ field.disabled = true; // See if this stops getting two dates from fumbling, e.g., the chrome datepicker.
18467
+ }
18453
18468
  field.setAttribute('style', inputStyle + 'color: gray;'); // pending
18454
18469
  var ds = kb.statementsMatching(subject, property); // remove any multiple values
18455
18470
  var result;
@@ -18517,7 +18532,9 @@ function basicField(dom, container, already, subject, form, doc, callbackFunctio
18517
18532
  updateMany(ds, is, function (uri, ok, body) {
18518
18533
  // kb.updater.update(ds, is, function (uri, ok, body) {
18519
18534
  if (ok) {
18520
- field.disabled = false;
18535
+ if (disabledForSave) {
18536
+ field.disabled = false;
18537
+ }
18521
18538
  field.setAttribute('style', inputStyle);
18522
18539
  } else {
18523
18540
  box.appendChild((0,_error__WEBPACK_IMPORTED_MODULE_6__/* .errorMessageBlock */ .F)(dom, body));
@@ -18525,6 +18542,15 @@ function basicField(dom, container, already, subject, form, doc, callbackFunctio
18525
18542
  callbackFunction(ok, body);
18526
18543
  });
18527
18544
  }, true);
18545
+ field.addEventListener('blur', function (_e) {
18546
+ if (deferWhileFocused && field.dataset && field.dataset.deferredChange === 'true') {
18547
+ delete field.dataset.deferredChange;
18548
+ var event = new Event('change', {
18549
+ bubbles: true
18550
+ });
18551
+ field.dispatchEvent(event);
18552
+ }
18553
+ }, true);
18528
18554
  return box;
18529
18555
  }
18530
18556
 
@@ -21957,8 +21983,8 @@ function notepad(dom, padDoc, subject, me, options) {
21957
21983
  }
21958
21984
  }
21959
21985
  /* @@ TODO want to look into this, it seems upstream should be a boolean and default to false ?
21960
- *
21961
- */
21986
+ *
21987
+ */
21962
21988
  var complain = function complain(message) {
21963
21989
  var upstream = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
21964
21990
  (0,_debug__WEBPACK_IMPORTED_MODULE_5__/* .log */ .Rm)(message);
@@ -21970,6 +21996,7 @@ function notepad(dom, padDoc, subject, me, options) {
21970
21996
  // @@ TODO need to refactor so that we don't have to type cast
21971
21997
  var clearStatus = function clearStatus(_upsteam) {
21972
21998
  if (options.statusArea) {
21999
+ ;
21973
22000
  options.statusArea.innerHTML = '';
21974
22001
  }
21975
22002
  };
@@ -22001,7 +22028,7 @@ function notepad(dom, padDoc, subject, me, options) {
22001
22028
  var next = kb.any(chunk, PAD('next'));
22002
22029
  if (prev.sameTerm(subject) && next.sameTerm(subject)) {
22003
22030
  // Last one
22004
- (0,_debug__WEBPACK_IMPORTED_MODULE_5__/* .log */ .Rm)('You can\'t delete the only line.');
22031
+ (0,_debug__WEBPACK_IMPORTED_MODULE_5__/* .log */ .Rm)("You can't delete the only line.");
22005
22032
  return;
22006
22033
  }
22007
22034
  var del = kb.statementsMatching(chunk, undefined, undefined, padDoc).concat(kb.statementsMatching(undefined, undefined, chunk, padDoc));
@@ -22043,10 +22070,10 @@ function notepad(dom, padDoc, subject, me, options) {
22043
22070
  }, 1000);
22044
22071
  } else {
22045
22072
  (0,_debug__WEBPACK_IMPORTED_MODULE_5__/* .log */ .Rm)(' removePart FAILED ' + chunk + ': ' + errorMessage);
22046
- (0,_debug__WEBPACK_IMPORTED_MODULE_5__/* .log */ .Rm)(' removePart was deleteing :\'' + del);
22073
+ (0,_debug__WEBPACK_IMPORTED_MODULE_5__/* .log */ .Rm)(" removePart was deleting :'" + del);
22047
22074
  setPartStyle(part, 'color: black; background-color: #fdd;'); // failed
22048
22075
  var res = response ? response.status : ' [no response field] ';
22049
- complain('Error ' + res + ' saving changes: ' + errorMessage["true"]); // upstream,
22076
+ complain('Error ' + res + ' saving changes: ' + String(errorMessage)); // upstream,
22050
22077
  // updater.requestDownstreamAction(padDoc, reloadAndSync);
22051
22078
  }
22052
22079
  });
@@ -22063,7 +22090,7 @@ function notepad(dom, padDoc, subject, me, options) {
22063
22090
  }
22064
22091
  updater.update(del, ins, function (uri, ok, errorBody) {
22065
22092
  if (!ok) {
22066
- (0,_debug__WEBPACK_IMPORTED_MODULE_5__/* .log */ .Rm)('Indent change FAILED \'' + newIndent + '\' for ' + padDoc + ': ' + errorBody);
22093
+ (0,_debug__WEBPACK_IMPORTED_MODULE_5__/* .log */ .Rm)("Indent change FAILED '" + newIndent + "' for " + padDoc + ': ' + errorBody);
22067
22094
  setPartStyle(part, 'color: black; background-color: #fdd;'); // failed
22068
22095
  updater.requestDownstreamAction(padDoc, reloadAndSync);
22069
22096
  } else {
@@ -22072,6 +22099,7 @@ function notepad(dom, padDoc, subject, me, options) {
22072
22099
  });
22073
22100
  };
22074
22101
  var addListeners = function addListeners(part, chunk) {
22102
+ var inputDebounceTimer = null;
22075
22103
  part.addEventListener('keydown', function (event) {
22076
22104
  if (!updater) {
22077
22105
  throw new Error('no updater');
@@ -22080,8 +22108,8 @@ function notepad(dom, padDoc, subject, me, options) {
22080
22108
  // up 38; down 40; left 37; right 39 tab 9; shift 16; escape 27
22081
22109
  switch (event.keyCode) {
22082
22110
  case 13:
22083
- // Return
22084
22111
  {
22112
+ // Return
22085
22113
  var before = event.shiftKey;
22086
22114
  (0,_debug__WEBPACK_IMPORTED_MODULE_5__/* .log */ .Rm)('enter'); // Shift-return inserts before -- only way to add to top of pad.
22087
22115
  if (before) {
@@ -22128,8 +22156,8 @@ function notepad(dom, padDoc, subject, me, options) {
22128
22156
  }
22129
22157
  break;
22130
22158
  case 9:
22131
- // Tab
22132
22159
  {
22160
+ // Tab
22133
22161
  var delta = event.shiftKey ? -1 : 1;
22134
22162
  changeIndent(part, chunk, delta);
22135
22163
  event.preventDefault(); // default is to highlight next field
@@ -22172,7 +22200,8 @@ function notepad(dom, padDoc, subject, me, options) {
22172
22200
  // DEBUGGING ONLY
22173
22201
  if (part.lastSent) {
22174
22202
  if (old !== part.lastSent) {
22175
- throw new Error('Out of order, last sent expected \'' + old + '\' but found \'' + part.lastSent + '\'');
22203
+ // Non-fatal: log a warning instead of throwing, to avoid crashing the pad UI.
22204
+ console.warn("Out of order, last sent expected '" + old + "' but found '" + part.lastSent + "'");
22176
22205
  }
22177
22206
  }
22178
22207
  part.lastSent = newOne;
@@ -22192,7 +22221,7 @@ function notepad(dom, padDoc, subject, me, options) {
22192
22221
  updater.update(del, ins, function (uri, ok, errorBody, xhr) {
22193
22222
  if (!ok) {
22194
22223
  // alert("clash " + errorBody);
22195
- (0,_debug__WEBPACK_IMPORTED_MODULE_5__/* .log */ .Rm)(' patch FAILED ' + xhr.status + ' for \'' + old + '\' -> \'' + newOne + '\': ' + errorBody);
22224
+ (0,_debug__WEBPACK_IMPORTED_MODULE_5__/* .log */ .Rm)(' patch FAILED ' + xhr.status + " for '" + old + "' -> '" + newOne + "': " + errorBody);
22196
22225
  if (xhr.status === 409) {
22197
22226
  // Conflict - @@ we assume someone else
22198
22227
  setPartStyle(part, 'color: black; background-color: #fdd;');
@@ -22203,15 +22232,28 @@ function notepad(dom, padDoc, subject, me, options) {
22203
22232
  }, 1000);
22204
22233
  } else {
22205
22234
  setPartStyle(part, 'color: black; background-color: #fdd;'); // failed pink
22206
- part.state = 0;
22207
- complain(' Error ' + xhr.status + ' sending data: ' + errorBody, true);
22208
- (0,_utils__WEBPACK_IMPORTED_MODULE_4__.beep)(1.0, 128); // Other
22209
- // @@@ Do soemthing more serious with other errors eg auth, etc
22235
+ var status = xhr === null || xhr === void 0 ? void 0 : xhr.status;
22236
+ if (!status || status === 502 || status === 503) {
22237
+ // Transient server error – retry after a short delay
22238
+ part.lastSent = undefined;
22239
+ part.state = 0;
22240
+ setTimeout(function () {
22241
+ if (part.state === 0 || part.state === undefined) {
22242
+ part.state = 1;
22243
+ _updateStore(part);
22244
+ }
22245
+ }, 2000);
22246
+ } else {
22247
+ part.state = 0;
22248
+ complain(' Error ' + status + ' sending data: ' + errorBody, true);
22249
+ (0,_utils__WEBPACK_IMPORTED_MODULE_4__.beep)(1.0, 128); // Other
22250
+ // @@@ Do something more serious with other errors eg auth, etc
22251
+ }
22210
22252
  }
22211
22253
  } else {
22212
22254
  clearStatus(true); // upstream
22213
22255
  setPartStyle(part); // synced
22214
- (0,_debug__WEBPACK_IMPORTED_MODULE_5__/* .log */ .Rm)(' Patch ok \'' + old + '\' -> \'' + newOne + '\' ');
22256
+ (0,_debug__WEBPACK_IMPORTED_MODULE_5__/* .log */ .Rm)(" Patch ok '" + old + "' -> '" + newOne + "' ");
22215
22257
  if (part.state === 4) {
22216
22258
  // delete me
22217
22259
  part.state = 3;
@@ -22231,7 +22273,7 @@ function notepad(dom, padDoc, subject, me, options) {
22231
22273
  part.addEventListener('input', function inputChangeListener(_event) {
22232
22274
  // debug.log("input changed "+part.value);
22233
22275
  setPartStyle(part, undefined, true); // grey out - not synced
22234
- (0,_debug__WEBPACK_IMPORTED_MODULE_5__/* .log */ .Rm)('Input event state ' + part.state + ' value \'' + part.value + '\'');
22276
+ (0,_debug__WEBPACK_IMPORTED_MODULE_5__/* .log */ .Rm)('Input event state ' + part.state + " value '" + part.value + "'");
22235
22277
  switch (part.state) {
22236
22278
  case 3:
22237
22279
  // being deleted
@@ -22247,8 +22289,15 @@ function notepad(dom, padDoc, subject, me, options) {
22247
22289
  return;
22248
22290
  case 0:
22249
22291
  case undefined:
22250
- part.state = 1; // being upadted
22251
- _updateStore(part);
22292
+ // Debounce: wait for a pause in typing before sending PATCH
22293
+ if (inputDebounceTimer !== null) clearTimeout(inputDebounceTimer);
22294
+ inputDebounceTimer = setTimeout(function () {
22295
+ inputDebounceTimer = null;
22296
+ if (part.state === 0 || part.state === undefined) {
22297
+ part.state = 1; // being updated
22298
+ _updateStore(part);
22299
+ }
22300
+ }, 400);
22252
22301
  }
22253
22302
  }); // listener
22254
22303
  }; // addlisteners
@@ -22278,13 +22327,13 @@ function notepad(dom, padDoc, subject, me, options) {
22278
22327
  addListeners(part, chunk);
22279
22328
  } else {
22280
22329
  setPartStyle(part, 'color: #222; background-color: #fff');
22281
- (0,_debug__WEBPACK_IMPORTED_MODULE_5__/* .log */ .Rm)('Note can\'t add listeners - not logged in');
22330
+ (0,_debug__WEBPACK_IMPORTED_MODULE_5__/* .log */ .Rm)("Note can't add listeners - not logged in");
22282
22331
  }
22283
22332
  return part;
22284
22333
  };
22285
22334
 
22286
22335
  /* @@ TODO we need to look at indent, it can be a Number or an Object this doesn't seem correct.
22287
- */
22336
+ */
22288
22337
  var _newChunk = function newChunk(ele, before) {
22289
22338
  // element of chunk being split
22290
22339
  var kb = store;
@@ -22409,6 +22458,7 @@ function notepad(dom, padDoc, subject, me, options) {
22409
22458
  var msg = 'Pad: Inconsistent data - NEXT pointers: ' + kb.each(subject, PAD('next')).length;
22410
22459
  (0,_debug__WEBPACK_IMPORTED_MODULE_5__/* .log */ .Rm)(msg);
22411
22460
  if (options.statusArea) {
22461
+ ;
22412
22462
  options.statusArea.textContent += msg;
22413
22463
  }
22414
22464
  return;