solid-ui 2.4.27-e1d1a020 → 2.4.27-eede06e9

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
@@ -3027,10 +3027,11 @@ Object.defineProperty(exports, "__esModule", ({
3027
3027
  value: true
3028
3028
  }));
3029
3029
  exports.DateFolder = void 0;
3030
+ exports.emptyLeaf = emptyLeaf;
3030
3031
  var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
3031
- var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
3032
3032
  var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"));
3033
3033
  var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"));
3034
+ var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
3034
3035
  var debug = _interopRequireWildcard(__webpack_require__(/*! ../debug */ "./lib/debug.js"));
3035
3036
  var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
3036
3037
  var ns = _interopRequireWildcard(__webpack_require__(/*! ../ns */ "./lib/ns.js"));
@@ -3043,9 +3044,29 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
3043
3044
  *
3044
3045
  */
3045
3046
  // pull in first avoid cross-refs
3047
+ function emptyLeaf(_x) {
3048
+ return _emptyLeaf.apply(this, arguments);
3049
+ }
3046
3050
  /**
3047
3051
  * Track back through the YYYY/MM/DD tree to find the previous/next day
3048
3052
  */
3053
+ function _emptyLeaf() {
3054
+ _emptyLeaf = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(leafDocument) {
3055
+ return _regenerator["default"].wrap(function _callee5$(_context5) {
3056
+ while (1) switch (_context5.prev = _context5.next) {
3057
+ case 0:
3058
+ _context5.next = 2;
3059
+ return _solidLogic.store.fetcher.load(leafDocument);
3060
+ case 2:
3061
+ return _context5.abrupt("return", !(_solidLogic.store.statementsMatching(null, ns.dct('created'), null, leafDocument).length > 0));
3062
+ case 3:
3063
+ case "end":
3064
+ return _context5.stop();
3065
+ }
3066
+ }, _callee5);
3067
+ }));
3068
+ return _emptyLeaf.apply(this, arguments);
3069
+ }
3049
3070
  var DateFolder = /*#__PURE__*/function () {
3050
3071
  function DateFolder(rootThing, leafFileName, membershipProperty) {
3051
3072
  (0, _classCallCheck2["default"])(this, DateFolder);
@@ -3084,61 +3105,22 @@ var DateFolder = /*#__PURE__*/function () {
3084
3105
  }, {
3085
3106
  key: "loadPrevious",
3086
3107
  value: function () {
3087
- var _loadPrevious = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(date, backwards) {
3088
- var thisDateFolder, previousPeriod, _previousPeriod, folder, found, doc;
3089
- return _regenerator["default"].wrap(function _callee3$(_context3) {
3090
- while (1) switch (_context3.prev = _context3.next) {
3108
+ var _loadPrevious = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(date, backwards) {
3109
+ var previousPeriod, _previousPeriod, folder, found, leafDocument, nextDate;
3110
+ return _regenerator["default"].wrap(function _callee2$(_context2) {
3111
+ while (1) switch (_context2.prev = _context2.next) {
3091
3112
  case 0:
3092
3113
  _previousPeriod = function _previousPeriod3() {
3093
- _previousPeriod = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(file, level) {
3094
- var younger, suitable, lastNonEmpty, _lastNonEmpty, parent, siblings, _folder, uncle, cousins, result;
3095
- return _regenerator["default"].wrap(function _callee2$(_context2) {
3096
- while (1) switch (_context2.prev = _context2.next) {
3114
+ _previousPeriod = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(file, level) {
3115
+ var younger, suitable, lastOrFirst, parent, siblings, _folder, uncle, cousins, result;
3116
+ return _regenerator["default"].wrap(function _callee$(_context) {
3117
+ while (1) switch (_context.prev = _context.next) {
3097
3118
  case 0:
3098
- _lastNonEmpty = function _lastNonEmpty3() {
3099
- _lastNonEmpty = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(siblings) {
3100
- var _folder2, leafDocument;
3101
- return _regenerator["default"].wrap(function _callee$(_context) {
3102
- while (1) switch (_context.prev = _context.next) {
3103
- case 0:
3104
- siblings = siblings.filter(suitable);
3105
- siblings.sort(); // chronological order
3106
- if (!backwards) siblings.reverse();
3107
- if (!(level !== 3)) {
3108
- _context.next = 5;
3109
- break;
3110
- }
3111
- return _context.abrupt("return", siblings.pop());
3112
- case 5:
3113
- if (!siblings.length) {
3114
- _context.next = 14;
3115
- break;
3116
- }
3117
- _folder2 = siblings.pop();
3118
- leafDocument = _solidLogic.store.sym(_folder2.uri + thisDateFolder.leafFileName);
3119
- _context.next = 10;
3120
- return _solidLogic.store.fetcher.load(leafDocument);
3121
- case 10:
3122
- if (!(_solidLogic.store.statementsMatching(null, ns.dct('created'), null, leafDocument).length > 0)) {
3123
- _context.next = 12;
3124
- break;
3125
- }
3126
- return _context.abrupt("return", _folder2);
3127
- case 12:
3128
- _context.next = 5;
3129
- break;
3130
- case 14:
3131
- return _context.abrupt("return", null);
3132
- case 15:
3133
- case "end":
3134
- return _context.stop();
3135
- }
3136
- }, _callee);
3137
- }));
3138
- return _lastNonEmpty.apply(this, arguments);
3139
- };
3140
- lastNonEmpty = function _lastNonEmpty2(_x5) {
3141
- return _lastNonEmpty.apply(this, arguments);
3119
+ lastOrFirst = function _lastOrFirst(siblings) {
3120
+ siblings = siblings.filter(suitable);
3121
+ siblings.sort(); // chronological order
3122
+ if (!backwards) siblings.reverse();
3123
+ return siblings.pop(); // date folder
3142
3124
  };
3143
3125
  suitable = function _suitable(x) {
3144
3126
  var tail = x.uri.slice(0, -1).split('/').slice(-1)[0];
@@ -3151,97 +3133,116 @@ var DateFolder = /*#__PURE__*/function () {
3151
3133
  };
3152
3134
  // debug.log(' previousPeriod level' + level + ' file ' + file)
3153
3135
  parent = file.dir();
3154
- _context2.prev = 5;
3155
- _context2.next = 8;
3136
+ _context.prev = 4;
3137
+ _context.next = 7;
3156
3138
  return _solidLogic.store.fetcher.load(parent);
3157
- case 8:
3139
+ case 7:
3158
3140
  siblings = _solidLogic.store.each(parent, ns.ldp('contains'));
3159
3141
  siblings = siblings.filter(younger);
3160
- _context2.next = 12;
3161
- return lastNonEmpty(siblings);
3162
- case 12:
3163
- _folder = _context2.sent;
3142
+ _folder = lastOrFirst(siblings);
3164
3143
  if (!_folder) {
3165
- _context2.next = 15;
3144
+ _context.next = 12;
3166
3145
  break;
3167
3146
  }
3168
- return _context2.abrupt("return", _folder);
3169
- case 15:
3170
- _context2.next = 25;
3147
+ return _context.abrupt("return", _folder);
3148
+ case 12:
3149
+ debug.log(' parent no suitable offspring ' + parent);
3150
+ _context.next = 23;
3171
3151
  break;
3172
- case 17:
3173
- _context2.prev = 17;
3174
- _context2.t0 = _context2["catch"](5);
3175
- if (!(_context2.t0.response && _context2.t0.response.status && _context2.t0.response.status === 404)) {
3176
- _context2.next = 23;
3152
+ case 15:
3153
+ _context.prev = 15;
3154
+ _context.t0 = _context["catch"](4);
3155
+ if (!(_context.t0.response && _context.t0.response.status && _context.t0.response.status === 404)) {
3156
+ _context.next = 21;
3177
3157
  break;
3178
3158
  }
3179
3159
  debug.log('Error 404 for chat parent file ' + parent);
3180
- _context2.next = 25;
3160
+ _context.next = 23;
3181
3161
  break;
3182
- case 23:
3162
+ case 21:
3183
3163
  debug.log('*** Error NON 404 for chat parent file ' + parent);
3184
3164
  // statusTR.appendChild(widgets.errorMessageBlock(dom, err, 'pink'))
3185
- throw new Error("*** ".concat(_context2.t0.message, " for chat folder ").concat(parent));
3186
- case 25:
3165
+ throw new Error("*** ".concat(_context.t0.message, " for chat folder ").concat(parent));
3166
+ case 23:
3187
3167
  if (!(level === 0)) {
3188
- _context2.next = 27;
3168
+ _context.next = 26;
3189
3169
  break;
3190
3170
  }
3191
- return _context2.abrupt("return", null);
3192
- case 27:
3193
- _context2.next = 29;
3171
+ debug.log('loadPrevious: returning as level is zero');
3172
+ return _context.abrupt("return", null);
3173
+ case 26:
3174
+ _context.next = 28;
3194
3175
  return previousPeriod(parent, level - 1);
3195
- case 29:
3196
- uncle = _context2.sent;
3176
+ case 28:
3177
+ uncle = _context.sent;
3197
3178
  if (uncle) {
3198
- _context2.next = 32;
3179
+ _context.next = 32;
3199
3180
  break;
3200
3181
  }
3201
- return _context2.abrupt("return", null);
3182
+ debug.log(' previousPeriod: nothing left before. ', parent);
3183
+ return _context.abrupt("return", null);
3202
3184
  case 32:
3203
- _context2.next = 34;
3185
+ _context.next = 34;
3204
3186
  return _solidLogic.store.fetcher.load(uncle);
3205
3187
  case 34:
3206
3188
  cousins = _solidLogic.store.each(uncle, ns.ldp('contains'));
3207
- _context2.next = 37;
3208
- return lastNonEmpty(cousins);
3209
- case 37:
3210
- result = _context2.sent;
3211
- return _context2.abrupt("return", result);
3189
+ result = lastOrFirst(cousins);
3190
+ debug.log(' previousPeriod: returning cousins at level ' + level, cousins);
3191
+ debug.log(' previousPeriod: returning result at level ' + level, result);
3192
+ return _context.abrupt("return", result);
3212
3193
  case 39:
3213
3194
  case "end":
3214
- return _context2.stop();
3195
+ return _context.stop();
3215
3196
  }
3216
- }, _callee2, null, [[5, 17]]);
3197
+ }, _callee, null, [[4, 15]]);
3217
3198
  }));
3218
3199
  return _previousPeriod.apply(this, arguments);
3219
3200
  };
3220
- previousPeriod = function _previousPeriod2(_x3, _x4) {
3201
+ previousPeriod = function _previousPeriod2(_x4, _x5) {
3221
3202
  return _previousPeriod.apply(this, arguments);
3222
3203
  };
3223
- thisDateFolder = this;
3224
3204
  // previousPeriod
3225
3205
  folder = this.leafDocumentFromDate(date).dir();
3226
- _context3.next = 6;
3206
+ case 3:
3207
+ if (false) {}
3208
+ _context2.next = 6;
3227
3209
  return previousPeriod(folder, 3);
3228
3210
  case 6:
3229
- found = _context3.sent;
3211
+ found = _context2.sent;
3230
3212
  if (!found) {
3231
- _context3.next = 10;
3213
+ _context2.next = 22;
3232
3214
  break;
3233
3215
  }
3234
- doc = _solidLogic.store.sym(found.uri + this.leafFileName);
3235
- return _context3.abrupt("return", this.dateFromLeafDocument(doc));
3236
- case 10:
3237
- return _context3.abrupt("return", null);
3238
- case 11:
3216
+ leafDocument = _solidLogic.store.sym(found.uri + this.leafFileName);
3217
+ nextDate = this.dateFromLeafDocument(leafDocument);
3218
+ _context2.next = 12;
3219
+ return emptyLeaf(leafDocument);
3220
+ case 12:
3221
+ if (_context2.sent) {
3222
+ _context2.next = 16;
3223
+ break;
3224
+ }
3225
+ return _context2.abrupt("return", nextDate);
3226
+ case 16:
3227
+ debug.log(' loadPrevious: skipping empty ' + leafDocument);
3228
+ date = nextDate;
3229
+ folder = this.leafDocumentFromDate(date).dir();
3230
+ debug.log(' loadPrevious: moved back to ' + folder);
3231
+ case 20:
3232
+ _context2.next = 23;
3233
+ break;
3234
+ case 22:
3235
+ return _context2.abrupt("return", null);
3236
+ case 23:
3237
+ _context2.next = 3;
3238
+ break;
3239
+ case 25:
3239
3240
  case "end":
3240
- return _context3.stop();
3241
+ return _context2.stop();
3241
3242
  }
3242
- }, _callee3, this);
3243
+ }, _callee2, this);
3243
3244
  }));
3244
- function loadPrevious(_x, _x2) {
3245
+ function loadPrevious(_x2, _x3) {
3245
3246
  return _loadPrevious.apply(this, arguments);
3246
3247
  }
3247
3248
  return loadPrevious;
@@ -3249,16 +3250,16 @@ var DateFolder = /*#__PURE__*/function () {
3249
3250
  }, {
3250
3251
  key: "firstLeaf",
3251
3252
  value: function () {
3252
- var _firstLeaf = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(backwards) {
3253
+ var _firstLeaf = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(backwards) {
3253
3254
  var folderStore, folderFetcher, earliestSubfolder, _earliestSubfolder, y, month, d, leafDocument, leafObjects, msg, sortMe;
3254
- return _regenerator["default"].wrap(function _callee5$(_context5) {
3255
- while (1) switch (_context5.prev = _context5.next) {
3255
+ return _regenerator["default"].wrap(function _callee4$(_context4) {
3256
+ while (1) switch (_context4.prev = _context4.next) {
3256
3257
  case 0:
3257
3258
  _earliestSubfolder = function _earliestSubfolder3() {
3258
- _earliestSubfolder = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(parent) {
3259
+ _earliestSubfolder = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(parent) {
3259
3260
  var suitable, kids;
3260
- return _regenerator["default"].wrap(function _callee4$(_context4) {
3261
- while (1) switch (_context4.prev = _context4.next) {
3261
+ return _regenerator["default"].wrap(function _callee3$(_context3) {
3262
+ while (1) switch (_context3.prev = _context3.next) {
3262
3263
  case 0:
3263
3264
  suitable = function _suitable2(x) {
3264
3265
  var tail = x.uri.slice(0, -1).split('/').slice(-1)[0];
@@ -3268,7 +3269,7 @@ var DateFolder = /*#__PURE__*/function () {
3268
3269
  debug.log(' parent ' + parent);
3269
3270
  delete folderFetcher.requested[parent.uri];
3270
3271
  // try {
3271
- _context4.next = 5;
3272
+ _context3.next = 5;
3272
3273
  return folderFetcher.load(parent, {
3273
3274
  force: true
3274
3275
  });
@@ -3279,19 +3280,19 @@ var DateFolder = /*#__PURE__*/function () {
3279
3280
  kids = folderStore.each(parent, ns.ldp('contains'));
3280
3281
  kids = kids.filter(suitable);
3281
3282
  if (!(kids.length === 0)) {
3282
- _context4.next = 9;
3283
+ _context3.next = 9;
3283
3284
  break;
3284
3285
  }
3285
3286
  throw new Error(' @@@ No children to parent2 ' + parent);
3286
3287
  case 9:
3287
3288
  kids.sort();
3288
3289
  if (backwards) kids.reverse();
3289
- return _context4.abrupt("return", kids[0]);
3290
+ return _context3.abrupt("return", kids[0]);
3290
3291
  case 12:
3291
3292
  case "end":
3292
- return _context4.stop();
3293
+ return _context3.stop();
3293
3294
  }
3294
- }, _callee4);
3295
+ }, _callee3);
3295
3296
  }));
3296
3297
  return _earliestSubfolder.apply(this, arguments);
3297
3298
  };
@@ -3301,25 +3302,25 @@ var DateFolder = /*#__PURE__*/function () {
3301
3302
  // backwards -> last leafObject
3302
3303
  folderStore = $rdf.graph();
3303
3304
  folderFetcher = new $rdf.Fetcher(folderStore);
3304
- _context5.next = 6;
3305
+ _context4.next = 6;
3305
3306
  return earliestSubfolder(this.root.dir());
3306
3307
  case 6:
3307
- y = _context5.sent;
3308
- _context5.next = 9;
3308
+ y = _context4.sent;
3309
+ _context4.next = 9;
3309
3310
  return earliestSubfolder(y);
3310
3311
  case 9:
3311
- month = _context5.sent;
3312
- _context5.next = 12;
3312
+ month = _context4.sent;
3313
+ _context4.next = 12;
3313
3314
  return earliestSubfolder(month);
3314
3315
  case 12:
3315
- d = _context5.sent;
3316
+ d = _context4.sent;
3316
3317
  leafDocument = $rdf.sym(d.uri + 'chat.ttl');
3317
- _context5.next = 16;
3318
+ _context4.next = 16;
3318
3319
  return folderFetcher.load(leafDocument);
3319
3320
  case 16:
3320
3321
  leafObjects = folderStore.each(this.root, this.membershipProperty, null, leafDocument);
3321
3322
  if (!(leafObjects.length === 0)) {
3322
- _context5.next = 21;
3323
+ _context4.next = 21;
3323
3324
  break;
3324
3325
  }
3325
3326
  msg = ' INCONSISTENCY -- no chat leafObject in file ' + leafDocument;
@@ -3332,12 +3333,12 @@ var DateFolder = /*#__PURE__*/function () {
3332
3333
  sortMe.sort();
3333
3334
  if (backwards) sortMe.reverse();
3334
3335
  debug.log((backwards ? 'Latest' : 'Earliest') + ' leafObject is ' + sortMe[0][1]);
3335
- return _context5.abrupt("return", sortMe[0][1]);
3336
+ return _context4.abrupt("return", sortMe[0][1]);
3336
3337
  case 26:
3337
3338
  case "end":
3338
- return _context5.stop();
3339
+ return _context4.stop();
3339
3340
  }
3340
- }, _callee5, this);
3341
+ }, _callee4, this);
3341
3342
  }));
3342
3343
  function firstLeaf(_x6) {
3343
3344
  return _firstLeaf.apply(this, arguments);
@@ -4091,26 +4092,27 @@ function _infiniteMessageArea() {
4091
4092
  }
4092
4093
  return _context4.abrupt("return", true);
4093
4094
  case 4:
4094
- _context4.next = 6;
4095
+ debug.log(' insertPreviousMessages: loadPrevious given date ' + date);
4096
+ _context4.next = 7;
4095
4097
  return dateFolder.loadPrevious(date, backwards);
4096
- case 6:
4098
+ case 7:
4097
4099
  date = _context4.sent;
4098
4100
  // backwards
4099
-
4101
+ debug.log(' insertPreviousMessages: loadPrevious returns date ' + date);
4100
4102
  debug.log("insertPreviousMessages: from ".concat(backwards ? 'backwards' : 'forwards', " loadPrevious: ").concat(date));
4101
4103
  if (!(!date && !backwards && !liveMessageTable)) {
4102
- _context4.next = 11;
4104
+ _context4.next = 13;
4103
4105
  break;
4104
4106
  }
4105
- _context4.next = 11;
4107
+ _context4.next = 13;
4106
4108
  return appendCurrentMessages();
4107
- case 11:
4109
+ case 13:
4108
4110
  if (date) {
4109
- _context4.next = 13;
4111
+ _context4.next = 15;
4110
4112
  break;
4111
4113
  }
4112
4114
  return _context4.abrupt("return", true);
4113
- case 13:
4115
+ case 15:
4114
4116
  // done
4115
4117
  live = false;
4116
4118
  if (!backwards) {
@@ -4118,9 +4120,9 @@ function _infiniteMessageArea() {
4118
4120
  doc = dateFolder.leafDocumentFromDate(date);
4119
4121
  live = doc.sameTerm(todayDoc); // Is this todays?
4120
4122
  }
4121
- _context4.next = 17;
4123
+ _context4.next = 19;
4122
4124
  return createMessageTable(date, live);
4123
- case 17:
4125
+ case 19:
4124
4126
  newMessageTable = _context4.sent;
4125
4127
  extremity.messageTable = newMessageTable; // move pointer to earliest
4126
4128
  if (backwards ? newestFirst : !newestFirst) {
@@ -4131,7 +4133,7 @@ function _infiniteMessageArea() {
4131
4133
  div.insertBefore(newMessageTable, div.firstChild);
4132
4134
  }
4133
4135
  return _context4.abrupt("return", live);
4134
- case 21:
4136
+ case 23:
4135
4137
  case "end":
4136
4138
  return _context4.stop();
4137
4139
  }
@@ -13602,8 +13604,8 @@ Object.defineProperty(exports, "__esModule", ({
13602
13604
  }));
13603
13605
  exports.versionInfo = void 0;
13604
13606
  var versionInfo = {
13605
- buildTime: '2023-04-11T07:16:22Z',
13606
- commit: 'e1d1a0208ca2a794beee1d50b841c2923d5efea1',
13607
+ buildTime: '2023-04-14T17:56:13Z',
13608
+ commit: 'eede06e96a65619e98ea10eee4a71dfa624803f2',
13607
13609
  npmInfo: {
13608
13610
  'solid-ui': '2.4.27',
13609
13611
  npm: '8.19.4',