solid-ui 2.4.26-029ae1f9 → 2.4.26-068520ea

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.
@@ -129,16 +129,16 @@ function infiniteMessageArea(_x7, _x8, _x9, _x10) {
129
129
  return _infiniteMessageArea.apply(this, arguments);
130
130
  }
131
131
  function _infiniteMessageArea() {
132
- _infiniteMessageArea = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee16(dom, wasStore, chatChannel, options) {
133
- var syncMessages, _syncMessages, addMessage, _addMessage, insertPreviousMessages, _insertPreviousMessages, removePreviousMessages, createMessageTable, _createMessageTable, renderMessageTable, _renderMessageTable, addNewChatDocumentIfNewDay, _addNewChatDocumentIfNewDay, appendCurrentMessages, _appendCurrentMessages, loadMoreWhereNeeded, _loadMoreWhereNeeded, loadInitialContent, _loadInitialContent, newestFirst, channelObject, dateFolder, div, statusArea, userContext, liveMessageTable, earliest, latest, lock;
134
- return _regenerator["default"].wrap(function _callee16$(_context16) {
135
- while (1) switch (_context16.prev = _context16.next) {
132
+ _infiniteMessageArea = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee15(dom, wasStore, chatChannel, options) {
133
+ var syncMessages, _syncMessages, addMessage, _addMessage, insertPreviousMessages, _insertPreviousMessages, removePreviousMessages, createMessageTable, _createMessageTable, renderMessageTable, _renderMessageTable, addNewChatDocumentIfNewDay, _addNewChatDocumentIfNewDay, appendCurrentMessages, _appendCurrentMessages, loadMoreWhereNeeded, _loadMoreWhereNeeded, loadInitialContent, _loadInitialContent, newestFirst, channelObject, dateFolder, div, statusArea, userContext, liveMessageTable, threadRootMessage, earliest, latest, thread, threadTime, lock;
134
+ return _regenerator["default"].wrap(function _callee15$(_context15) {
135
+ while (1) switch (_context15.prev = _context15.next) {
136
136
  case 0:
137
137
  _loadInitialContent = function _loadInitialContent3() {
138
- _loadInitialContent = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee15() {
139
- var yank, fixScroll, live, selectedDocument, now, todayDocument, selectedMessageTable, selectedDate;
140
- return _regenerator["default"].wrap(function _callee15$(_context15) {
141
- while (1) switch (_context15.prev = _context15.next) {
138
+ _loadInitialContent = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14() {
139
+ var yank, fixScroll, live, selectedDocument, threadRootDocument, initialDocment, now, todayDocument, selectedMessageTable, selectedDate;
140
+ return _regenerator["default"].wrap(function _callee14$(_context14) {
141
+ while (1) switch (_context14.prev = _context14.next) {
142
142
  case 0:
143
143
  fixScroll = function _fixScroll() {
144
144
  if (options.selectedElement) {
@@ -152,51 +152,59 @@ function _infiniteMessageArea() {
152
152
  }
153
153
  };
154
154
  yank = function _yank() {
155
- selectedMessageTable.selectedElement.scrollIntoView({
156
- block: 'center'
157
- });
155
+ if (selectedMessageTable && selectedMessageTable.selectedElement) {
156
+ selectedMessageTable.selectedElement.scrollIntoView({
157
+ block: 'center'
158
+ });
159
+ }
158
160
  };
159
161
  if (options.selectedMessage) {
160
162
  selectedDocument = options.selectedMessage.doc();
163
+ }
164
+ if (threadRootMessage) {
165
+ threadRootDocument = threadRootMessage.doc();
166
+ }
167
+ initialDocment = selectedDocument || threadRootDocument;
168
+ if (initialDocment) {
161
169
  now = new Date();
162
170
  todayDocument = dateFolder.leafDocumentFromDate(now);
163
- live = todayDocument.sameTerm(selectedDocument);
171
+ live = todayDocument.sameTerm(initialDocment);
164
172
  }
165
- if (!(options.selectedMessage && !live)) {
166
- _context15.next = 15;
173
+ if (!(initialDocment && !live)) {
174
+ _context14.next = 18;
167
175
  break;
168
176
  }
169
- selectedDate = dateFolder.dateFromLeafDocument(selectedDocument);
170
- _context15.next = 7;
177
+ selectedDate = dateFolder.dateFromLeafDocument(initialDocment);
178
+ _context14.next = 10;
171
179
  return createMessageTable(selectedDate, live);
172
- case 7:
173
- selectedMessageTable = _context15.sent;
180
+ case 10:
181
+ selectedMessageTable = _context14.sent;
174
182
  div.appendChild(selectedMessageTable);
175
183
  earliest.messageTable = selectedMessageTable;
176
184
  latest.messageTable = selectedMessageTable;
177
185
  yank();
178
186
  setTimeout(yank, 1000); // @@ kludge - restore position distubed by other cHANGES
179
- _context15.next = 19;
187
+ _context14.next = 22;
180
188
  break;
181
- case 15:
182
- _context15.next = 17;
189
+ case 18:
190
+ _context14.next = 20;
183
191
  return appendCurrentMessages();
184
- case 17:
192
+ case 20:
185
193
  earliest.messageTable = liveMessageTable;
186
194
  latest.messageTable = liveMessageTable;
187
- case 19:
188
- _context15.next = 21;
195
+ case 22:
196
+ _context14.next = 24;
189
197
  return loadMoreWhereNeeded(null, fixScroll);
190
- case 21:
198
+ case 24:
191
199
  div.addEventListener('scroll', loadMoreWhereNeeded);
192
200
  if (options.solo) {
193
201
  document.body.addEventListener('scroll', loadMoreWhereNeeded);
194
202
  }
195
- case 23:
203
+ case 26:
196
204
  case "end":
197
- return _context15.stop();
205
+ return _context14.stop();
198
206
  }
199
- }, _callee15);
207
+ }, _callee14);
200
208
  }));
201
209
  return _loadInitialContent.apply(this, arguments);
202
210
  };
@@ -204,16 +212,16 @@ function _infiniteMessageArea() {
204
212
  return _loadInitialContent.apply(this, arguments);
205
213
  };
206
214
  _loadMoreWhereNeeded = function _loadMoreWhereNeeded3() {
207
- _loadMoreWhereNeeded = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14(event, fixScroll) {
215
+ _loadMoreWhereNeeded = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13(event, fixScroll) {
208
216
  var freeze, magicZone, done, scrollBottom, scrollTop;
209
- return _regenerator["default"].wrap(function _callee14$(_context14) {
210
- while (1) switch (_context14.prev = _context14.next) {
217
+ return _regenerator["default"].wrap(function _callee13$(_context13) {
218
+ while (1) switch (_context13.prev = _context13.next) {
211
219
  case 0:
212
220
  if (!lock) {
213
- _context14.next = 2;
221
+ _context13.next = 2;
214
222
  break;
215
223
  }
216
- return _context14.abrupt("return");
224
+ return _context13.abrupt("return");
217
225
  case 2:
218
226
  lock = true;
219
227
  freeze = !fixScroll;
@@ -221,36 +229,36 @@ function _infiniteMessageArea() {
221
229
  // const bottom = div.scrollHeight - top - div.clientHeight
222
230
  case 5:
223
231
  if (!(div.scrollTop < magicZone && earliest.messageTable && !earliest.messageTable.initial && earliest.messageTable.extendBackwards)) {
224
- _context14.next = 21;
232
+ _context13.next = 21;
225
233
  break;
226
234
  }
227
235
  if (!(div.scrollHeight === 0)) {
228
- _context14.next = 10;
236
+ _context13.next = 10;
229
237
  break;
230
238
  }
231
239
  // debug.log(' chat/loadMoreWhereNeeded: trying later...')
232
240
  setTimeout(loadMoreWhereNeeded, 2000); // couple be less
233
241
  lock = false;
234
- return _context14.abrupt("return");
242
+ return _context13.abrupt("return");
235
243
  case 10:
236
244
  // debug.log(' chat/loadMoreWhereNeeded: Going now')
237
245
  scrollBottom = div.scrollHeight - div.scrollTop;
238
246
  debug.log('infinite scroll: adding above: top ' + div.scrollTop);
239
- _context14.next = 14;
247
+ _context13.next = 14;
240
248
  return earliest.messageTable.extendBackwards();
241
249
  case 14:
242
- done = _context14.sent;
250
+ done = _context13.sent;
243
251
  if (freeze) {
244
252
  div.scrollTop = div.scrollHeight - scrollBottom;
245
253
  }
246
254
  if (fixScroll) fixScroll();
247
255
  if (!done) {
248
- _context14.next = 19;
256
+ _context13.next = 19;
249
257
  break;
250
258
  }
251
- return _context14.abrupt("break", 21);
259
+ return _context13.abrupt("break", 21);
252
260
  case 19:
253
- _context14.next = 5;
261
+ _context13.next = 5;
254
262
  break;
255
263
  case 21:
256
264
  if (!(options.selectedMessage &&
@@ -260,15 +268,15 @@ function _infiniteMessageArea() {
260
268
  latest.messageTable && !latest.messageTable["final"] &&
261
269
  // there is more data to come
262
270
  latest.messageTable.extendForwards)) {
263
- _context14.next = 33;
271
+ _context13.next = 33;
264
272
  break;
265
273
  }
266
274
  scrollTop = div.scrollTop;
267
275
  debug.log('infinite scroll: adding below: bottom: ' + (div.scrollHeight - div.scrollTop - div.clientHeight));
268
- _context14.next = 26;
276
+ _context13.next = 26;
269
277
  return latest.messageTable.extendForwards();
270
278
  case 26:
271
- done = _context14.sent;
279
+ done = _context13.sent;
272
280
  // then add more data on the bottom
273
281
  if (freeze) {
274
282
  div.scrollTop = scrollTop; // while adding below keep same things in view
@@ -276,20 +284,20 @@ function _infiniteMessageArea() {
276
284
 
277
285
  if (fixScroll) fixScroll();
278
286
  if (!done) {
279
- _context14.next = 31;
287
+ _context13.next = 31;
280
288
  break;
281
289
  }
282
- return _context14.abrupt("break", 33);
290
+ return _context13.abrupt("break", 33);
283
291
  case 31:
284
- _context14.next = 21;
292
+ _context13.next = 21;
285
293
  break;
286
294
  case 33:
287
295
  lock = false;
288
296
  case 34:
289
297
  case "end":
290
- return _context14.stop();
298
+ return _context13.stop();
291
299
  }
292
- }, _callee14);
300
+ }, _callee13);
293
301
  }));
294
302
  return _loadMoreWhereNeeded.apply(this, arguments);
295
303
  };
@@ -297,45 +305,45 @@ function _infiniteMessageArea() {
297
305
  return _loadMoreWhereNeeded.apply(this, arguments);
298
306
  };
299
307
  _appendCurrentMessages = function _appendCurrentMessage2() {
300
- _appendCurrentMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13() {
308
+ _appendCurrentMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12() {
301
309
  var now, chatDocument, messageTable;
302
- return _regenerator["default"].wrap(function _callee13$(_context13) {
303
- while (1) switch (_context13.prev = _context13.next) {
310
+ return _regenerator["default"].wrap(function _callee12$(_context12) {
311
+ while (1) switch (_context12.prev = _context12.next) {
304
312
  case 0:
305
313
  now = new Date();
306
314
  chatDocument = dateFolder.leafDocumentFromDate(now); /// ///////////////////////////////////////////////////////////
307
- _context13.next = 4;
315
+ _context12.next = 4;
308
316
  return createMessageTable(now, true);
309
317
  case 4:
310
- messageTable = _context13.sent;
318
+ messageTable = _context12.sent;
311
319
  div.appendChild(messageTable);
312
- div.refresh = /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12() {
313
- return _regenerator["default"].wrap(function _callee12$(_context12) {
314
- while (1) switch (_context12.prev = _context12.next) {
320
+ div.refresh = /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11() {
321
+ return _regenerator["default"].wrap(function _callee11$(_context11) {
322
+ while (1) switch (_context11.prev = _context11.next) {
315
323
  case 0:
316
- _context12.next = 2;
324
+ _context11.next = 2;
317
325
  return addNewChatDocumentIfNewDay(new Date());
318
326
  case 2:
319
- _context12.next = 4;
327
+ _context11.next = 4;
320
328
  return syncMessages(chatChannel, messageTable);
321
329
  case 4:
322
330
  // @@ livemessagetable??
323
331
  desktopNotification(chatChannel);
324
332
  case 5:
325
333
  case "end":
326
- return _context12.stop();
334
+ return _context11.stop();
327
335
  }
328
- }, _callee12);
336
+ }, _callee11);
329
337
  })); // The short chat version the live update listening is done in the pane but we do it in the widget @@
330
338
  _solidLogic.store.updater.addDownstreamChangeListener(chatDocument, div.refresh); // Live update
331
339
  liveMessageTable = messageTable;
332
340
  latest.messageTable = liveMessageTable;
333
- return _context13.abrupt("return", messageTable);
341
+ return _context12.abrupt("return", messageTable);
334
342
  case 11:
335
343
  case "end":
336
- return _context13.stop();
344
+ return _context12.stop();
337
345
  }
338
- }, _callee13);
346
+ }, _callee12);
339
347
  }));
340
348
  return _appendCurrentMessages.apply(this, arguments);
341
349
  };
@@ -343,15 +351,15 @@ function _infiniteMessageArea() {
343
351
  return _appendCurrentMessages.apply(this, arguments);
344
352
  };
345
353
  _addNewChatDocumentIfNewDay = function _addNewChatDocumentIf2() {
346
- _addNewChatDocumentIfNewDay = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11() {
354
+ _addNewChatDocumentIfNewDay = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10() {
347
355
  var newChatDocument, oldChatDocument, sts;
348
- return _regenerator["default"].wrap(function _callee11$(_context11) {
349
- while (1) switch (_context11.prev = _context11.next) {
356
+ return _regenerator["default"].wrap(function _callee10$(_context10) {
357
+ while (1) switch (_context10.prev = _context10.next) {
350
358
  case 0:
351
359
  // @@ Remove listener from previous table as it is now static
352
360
  newChatDocument = dateFolder.leafDocumentFromDate(new Date());
353
361
  if (newChatDocument.sameTerm(latest.messageTable.chatDocument)) {
354
- _context11.next = 7;
362
+ _context10.next = 7;
355
363
  break;
356
364
  }
357
365
  // It is a new day
@@ -360,7 +368,7 @@ function _infiniteMessageArea() {
360
368
  delete liveMessageTable.inputRow;
361
369
  }
362
370
  oldChatDocument = latest.messageTable.chatDocument;
363
- _context11.next = 6;
371
+ _context10.next = 6;
364
372
  return appendCurrentMessages();
365
373
  case 6:
366
374
  // Adding a link in the document will ping listeners to add the new block too
@@ -374,9 +382,9 @@ function _infiniteMessageArea() {
374
382
  }
375
383
  case 7:
376
384
  case "end":
377
- return _context11.stop();
385
+ return _context10.stop();
378
386
  }
379
- }, _callee11);
387
+ }, _callee10);
380
388
  }));
381
389
  return _addNewChatDocumentIfNewDay.apply(this, arguments);
382
390
  };
@@ -384,40 +392,40 @@ function _infiniteMessageArea() {
384
392
  return _addNewChatDocumentIfNewDay.apply(this, arguments);
385
393
  };
386
394
  _renderMessageTable = function _renderMessageTable3() {
387
- _renderMessageTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(date, live) {
388
- var scrollBackbutton, scrollForwardButton, extendBackwards, _extendBackwards, setScrollBackbuttonIcon, scrollBackbuttonHandler, _scrollBackbuttonHandler, extendForwards, _extendForwards, setScrollForwardButtonIcon, scrollForwardButtonHandler, _scrollForwardButtonHandler, messageTable, chatDocument, tr, test, titleTR, scrollBackbuttonCell, dateCell, scrollForwardButtonCell, sts, _iterator2, _step2, st;
389
- return _regenerator["default"].wrap(function _callee10$(_context10) {
390
- while (1) switch (_context10.prev = _context10.next) {
395
+ _renderMessageTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(date, live) {
396
+ var scrollBackbutton, scrollForwardButton, extendBackwards, _extendBackwards, setScrollBackbuttonIcon, extendForwards, _extendForwards, setScrollForwardButtonIcon, scrollForwardButtonHandler, _scrollForwardButtonHandler, messageTable, chatDocument, tr, test, titleTR, scrollBackbuttonCell, dateCell, scrollForwardButtonCell, sts, _iterator2, _step2, st;
397
+ return _regenerator["default"].wrap(function _callee9$(_context9) {
398
+ while (1) switch (_context9.prev = _context9.next) {
391
399
  case 0:
392
400
  _scrollForwardButtonHandler = function _scrollForwardButtonH2() {
393
- _scrollForwardButtonHandler = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(_event) {
394
- return _regenerator["default"].wrap(function _callee9$(_context9) {
395
- while (1) switch (_context9.prev = _context9.next) {
401
+ _scrollForwardButtonHandler = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(_event) {
402
+ return _regenerator["default"].wrap(function _callee8$(_context8) {
403
+ while (1) switch (_context8.prev = _context8.next) {
396
404
  case 0:
397
405
  if (!messageTable.extendedForwards) {
398
- _context9.next = 6;
406
+ _context8.next = 6;
399
407
  break;
400
408
  }
401
409
  removePreviousMessages(false, messageTable);
402
410
  messageTable.extendedForwards = false;
403
411
  setScrollForwardButtonIcon();
404
- _context9.next = 9;
412
+ _context8.next = 9;
405
413
  break;
406
414
  case 6:
407
- _context9.next = 8;
415
+ _context8.next = 8;
408
416
  return extendForwards();
409
417
  case 8:
410
418
  // async
411
419
  latest.messageTable.scrollIntoView(newestFirst);
412
420
  case 9:
413
421
  case "end":
414
- return _context9.stop();
422
+ return _context8.stop();
415
423
  }
416
- }, _callee9);
424
+ }, _callee8);
417
425
  }));
418
426
  return _scrollForwardButtonHandler.apply(this, arguments);
419
427
  };
420
- scrollForwardButtonHandler = function _scrollForwardButtonH(_x23) {
428
+ scrollForwardButtonHandler = function _scrollForwardButtonH(_x22) {
421
429
  return _scrollForwardButtonHandler.apply(this, arguments);
422
430
  };
423
431
  setScrollForwardButtonIcon = function _setScrollForwardButt() {
@@ -430,55 +438,27 @@ function _infiniteMessageArea() {
430
438
  }
431
439
  };
432
440
  _extendForwards = function _extendForwards3() {
433
- _extendForwards = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
441
+ _extendForwards = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7() {
434
442
  var done;
435
- return _regenerator["default"].wrap(function _callee8$(_context8) {
436
- while (1) switch (_context8.prev = _context8.next) {
443
+ return _regenerator["default"].wrap(function _callee7$(_context7) {
444
+ while (1) switch (_context7.prev = _context7.next) {
437
445
  case 0:
438
- _context8.next = 2;
446
+ _context7.next = 2;
439
447
  return insertPreviousMessages(false);
440
448
  case 2:
441
- done = _context8.sent;
442
- return _context8.abrupt("return", done);
449
+ done = _context7.sent;
450
+ return _context7.abrupt("return", done);
443
451
  case 4:
444
452
  case "end":
445
- return _context8.stop();
453
+ return _context7.stop();
446
454
  }
447
- }, _callee8);
455
+ }, _callee7);
448
456
  }));
449
457
  return _extendForwards.apply(this, arguments);
450
458
  };
451
459
  extendForwards = function _extendForwards2() {
452
460
  return _extendForwards.apply(this, arguments);
453
461
  };
454
- _scrollBackbuttonHandler = function _scrollBackbuttonHand2() {
455
- _scrollBackbuttonHandler = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(_event) {
456
- return _regenerator["default"].wrap(function _callee7$(_context7) {
457
- while (1) switch (_context7.prev = _context7.next) {
458
- case 0:
459
- if (!messageTable.extendedBack) {
460
- _context7.next = 6;
461
- break;
462
- }
463
- removePreviousMessages(true, messageTable);
464
- messageTable.extendedBack = false;
465
- setScrollBackbuttonIcon();
466
- _context7.next = 8;
467
- break;
468
- case 6:
469
- _context7.next = 8;
470
- return extendBackwards();
471
- case 8:
472
- case "end":
473
- return _context7.stop();
474
- }
475
- }, _callee7);
476
- }));
477
- return _scrollBackbuttonHandler.apply(this, arguments);
478
- };
479
- scrollBackbuttonHandler = function _scrollBackbuttonHand(_x22) {
480
- return _scrollBackbuttonHandler.apply(this, arguments);
481
- };
482
462
  setScrollBackbuttonIcon = function _setScrollBackbuttonI() {
483
463
  if (!scrollBackbutton) {
484
464
  return;
@@ -630,41 +610,41 @@ function _infiniteMessageArea() {
630
610
  // messageTable.style.visibility = 'collapse' // Hide files with no messages
631
611
  }
632
612
  _iterator2 = _createForOfIteratorHelper(sts);
633
- _context10.prev = 28;
613
+ _context9.prev = 26;
634
614
  _iterator2.s();
635
- case 30:
615
+ case 28:
636
616
  if ((_step2 = _iterator2.n()).done) {
637
- _context10.next = 36;
617
+ _context9.next = 34;
638
618
  break;
639
619
  }
640
620
  st = _step2.value;
641
- _context10.next = 34;
621
+ _context9.next = 32;
642
622
  return addMessage(st.object, messageTable);
623
+ case 32:
624
+ _context9.next = 28;
625
+ break;
643
626
  case 34:
644
- _context10.next = 30;
627
+ _context9.next = 39;
645
628
  break;
646
629
  case 36:
647
- _context10.next = 41;
648
- break;
649
- case 38:
650
- _context10.prev = 38;
651
- _context10.t0 = _context10["catch"](28);
652
- _iterator2.e(_context10.t0);
653
- case 41:
654
- _context10.prev = 41;
630
+ _context9.prev = 36;
631
+ _context9.t0 = _context9["catch"](26);
632
+ _iterator2.e(_context9.t0);
633
+ case 39:
634
+ _context9.prev = 39;
655
635
  _iterator2.f();
656
- return _context10.finish(41);
657
- case 44:
636
+ return _context9.finish(39);
637
+ case 42:
658
638
  messageTable.fresh = true;
659
639
 
660
640
  // loadMessageTable(messageTable, chatDocument)
661
641
  messageTable.fresh = false;
662
- return _context10.abrupt("return", messageTable);
663
- case 47:
642
+ return _context9.abrupt("return", messageTable);
643
+ case 45:
664
644
  case "end":
665
- return _context10.stop();
645
+ return _context9.stop();
666
646
  }
667
- }, _callee10, null, [[28, 38, 41, 44]]);
647
+ }, _callee9, null, [[26, 36, 39, 42]]);
668
648
  }));
669
649
  return _renderMessageTable.apply(this, arguments);
670
650
  };
@@ -743,25 +723,33 @@ function _infiniteMessageArea() {
743
723
  case 0:
744
724
  extremity = backwards ? earliest : latest;
745
725
  date = extremity.messageTable.date; // day in mssecs
746
- _context4.next = 4;
747
- return dateFolder.loadPrevious(date, backwards);
726
+ // Are we at the top of a thread?
727
+ if (!(backwards && earliest.limit && date <= earliest.limit)) {
728
+ _context4.next = 4;
729
+ break;
730
+ }
731
+ return _context4.abrupt("return", true);
748
732
  case 4:
733
+ _context4.next = 6;
734
+ return dateFolder.loadPrevious(date, backwards);
735
+ case 6:
749
736
  date = _context4.sent;
750
737
  // backwards
738
+
751
739
  debug.log("insertPreviousMessages: from ".concat(backwards ? 'backwards' : 'forwards', " loadPrevious: ").concat(date));
752
740
  if (!(!date && !backwards && !liveMessageTable)) {
753
- _context4.next = 9;
741
+ _context4.next = 11;
754
742
  break;
755
743
  }
756
- _context4.next = 9;
744
+ _context4.next = 11;
757
745
  return appendCurrentMessages();
758
- case 9:
746
+ case 11:
759
747
  if (date) {
760
- _context4.next = 11;
748
+ _context4.next = 13;
761
749
  break;
762
750
  }
763
751
  return _context4.abrupt("return", true);
764
- case 11:
752
+ case 13:
765
753
  // done
766
754
  live = false;
767
755
  if (!backwards) {
@@ -769,9 +757,9 @@ function _infiniteMessageArea() {
769
757
  doc = dateFolder.leafDocumentFromDate(date);
770
758
  live = doc.sameTerm(todayDoc); // Is this todays?
771
759
  }
772
- _context4.next = 15;
760
+ _context4.next = 17;
773
761
  return createMessageTable(date, live);
774
- case 15:
762
+ case 17:
775
763
  newMessageTable = _context4.sent;
776
764
  extremity.messageTable = newMessageTable; // move pointer to earliest
777
765
  if (backwards ? newestFirst : !newestFirst) {
@@ -782,7 +770,7 @@ function _infiniteMessageArea() {
782
770
  div.insertBefore(newMessageTable, div.firstChild);
783
771
  }
784
772
  return _context4.abrupt("return", live);
785
- case 19:
773
+ case 21:
786
774
  case "end":
787
775
  return _context4.stop();
788
776
  }
@@ -795,64 +783,66 @@ function _infiniteMessageArea() {
795
783
  };
796
784
  _addMessage = function _addMessage3() {
797
785
  _addMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(message, messageTable) {
798
- var latest, thread, id;
786
+ var thread, id;
799
787
  return _regenerator["default"].wrap(function _callee3$(_context3) {
800
788
  while (1) switch (_context3.prev = _context3.next) {
801
789
  case 0:
802
- _context3.next = 2;
803
- return (0, _chatLogic.mostRecentVersion)(message);
790
+ if (!((0, _chatLogic.isDeleted)(message) && !options.showDeletedMessages)) {
791
+ _context3.next = 2;
792
+ break;
793
+ }
794
+ return _context3.abrupt("return");
804
795
  case 2:
805
- latest = _context3.sent;
806
- if (!((0, _chatLogic.isDeleted)(latest) && !options.showDeletedMessages)) {
807
- _context3.next = 5;
796
+ if (!(0, _chatLogic.isReplaced)(message)) {
797
+ _context3.next = 4;
808
798
  break;
809
799
  }
810
800
  return _context3.abrupt("return");
811
- case 5:
801
+ case 4:
812
802
  thread = _solidLogic.store.any(null, ns.sioc('has_member'), message, message.doc());
813
803
  id = _solidLogic.store.any(message, ns.sioc('id'), null, message.doc());
814
804
  if (id && !thread) {
815
805
  thread = _solidLogic.store.any(null, ns.sioc('has_member'), id, message.doc());
816
806
  }
817
807
  if (!options.thread) {
818
- _context3.next = 21;
808
+ _context3.next = 20;
819
809
  break;
820
810
  }
821
811
  if (!_solidLogic.store.holds(message, ns.sioc('has_reply'), options.thread)) {
822
- _context3.next = 13;
812
+ _context3.next = 12;
823
813
  break;
824
814
  }
825
815
  // root of thread
826
816
  debug.log(' addMessage: displaying root of thread ' + thread);
827
- _context3.next = 19;
817
+ _context3.next = 18;
828
818
  break;
829
- case 13:
819
+ case 12:
830
820
  if (!(thread && thread.sameTerm(options.thread))) {
831
- _context3.next = 17;
821
+ _context3.next = 16;
832
822
  break;
833
823
  }
834
824
  debug.log(' addMessage: Displaying body of thread ' + message.uri.slice(-10));
835
- _context3.next = 19;
825
+ _context3.next = 18;
836
826
  break;
837
- case 17:
827
+ case 16:
838
828
  debug.log(' addMessage: Suppress non-thread message in thread table ' + message.uri.slice(-10));
839
829
  return _context3.abrupt("return");
840
- case 19:
841
- _context3.next = 27;
830
+ case 18:
831
+ _context3.next = 26;
842
832
  break;
843
- case 21:
833
+ case 20:
844
834
  if (!thread) {
845
- _context3.next = 26;
835
+ _context3.next = 25;
846
836
  break;
847
837
  }
848
838
  debug.log(' addMessage: Suppress thread message in non-thread table ' + message.uri.slice(-10));
849
839
  return _context3.abrupt("return");
850
- case 26:
840
+ case 25:
851
841
  debug.log(' addMessage: Normal non-thread message in non-thread table ' + message.uri.slice(-10));
852
- case 27:
853
- _context3.next = 29;
842
+ case 26:
843
+ _context3.next = 28;
854
844
  return insertMessageIntoTable(channelObject, messageTable, message, messageTable.fresh, options, userContext);
855
- case 29:
845
+ case 28:
856
846
  case "end":
857
847
  return _context3.stop();
858
848
  }
@@ -954,16 +944,27 @@ function _infiniteMessageArea() {
954
944
  latest = {
955
945
  messageTable: null
956
946
  };
947
+ if (options.thread) {
948
+ thread = options.thread;
949
+ threadRootMessage = _solidLogic.store.any(null, ns.sioc('has_reply'), thread, thread.doc());
950
+ if (threadRootMessage) {
951
+ threadTime = _solidLogic.store.any(threadRootMessage, ns.dct('created'), null, threadRootMessage.doc());
952
+ if (threadTime) {
953
+ earliest.limit = new Date(threadTime.value);
954
+ debug.log(' inifinite: thread start at ' + earliest.limit);
955
+ }
956
+ }
957
+ }
957
958
  lock = false;
958
- _context16.next = 33;
959
+ _context15.next = 34;
959
960
  return loadInitialContent();
960
- case 33:
961
- return _context16.abrupt("return", div);
962
961
  case 34:
962
+ return _context15.abrupt("return", div);
963
+ case 35:
963
964
  case "end":
964
- return _context16.stop();
965
+ return _context15.stop();
965
966
  }
966
- }, _callee16);
967
+ }, _callee15);
967
968
  }));
968
969
  return _infiniteMessageArea.apply(this, arguments);
969
970
  }