solid-ui 2.4.27-8924ae81 → 2.4.27-92bc931a

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.
Files changed (51) hide show
  1. package/dist/805.solid-ui.min.js +1 -1
  2. package/dist/805.solid-ui.min.js.map +1 -1
  3. package/dist/solid-ui.js +1853 -1078
  4. package/dist/solid-ui.js.map +1 -1
  5. package/dist/solid-ui.min.js +1 -1
  6. package/dist/solid-ui.min.js.map +1 -1
  7. package/dist/vendors-node_modules_jsonld_lib_jsonld_js.solid-ui.js +1938 -1938
  8. package/dist/vendors-node_modules_jsonld_lib_jsonld_js.solid-ui.js.map +1 -1
  9. package/lib/chat/bookmarks.js +6 -7
  10. package/lib/chat/bookmarks.js.map +1 -1
  11. package/lib/chat/chatLogic.js +250 -61
  12. package/lib/chat/chatLogic.js.map +1 -1
  13. package/lib/chat/dateFolder.js +129 -126
  14. package/lib/chat/dateFolder.js.map +1 -1
  15. package/lib/chat/infinite.js +633 -423
  16. package/lib/chat/infinite.js.map +1 -1
  17. package/lib/chat/message.js +290 -160
  18. package/lib/chat/message.js.map +1 -1
  19. package/lib/chat/messageTools.js +463 -277
  20. package/lib/chat/messageTools.js.map +1 -1
  21. package/lib/chat/thread.js +166 -144
  22. package/lib/chat/thread.js.map +1 -1
  23. package/lib/header/index.js +5 -0
  24. package/lib/header/index.js.map +1 -1
  25. package/lib/log.js +5 -5
  26. package/lib/log.js.map +1 -1
  27. package/lib/login/login.js +24 -1
  28. package/lib/login/login.js.map +1 -1
  29. package/lib/pad.js +4 -1
  30. package/lib/pad.js.map +1 -1
  31. package/lib/participation.js +2 -1
  32. package/lib/participation.js.map +1 -1
  33. package/lib/preferences.js +4 -0
  34. package/lib/preferences.js.map +1 -1
  35. package/lib/utils/headerFooterHelpers.js +2 -0
  36. package/lib/utils/headerFooterHelpers.js.map +1 -1
  37. package/lib/versionInfo.js +2 -2
  38. package/lib/versionInfo.js.map +1 -1
  39. package/lib/widgets/buttons.js +0 -2
  40. package/lib/widgets/buttons.js.map +1 -1
  41. package/lib/widgets/forms/autocomplete/autocompleteBar.js +8 -1
  42. package/lib/widgets/forms/autocomplete/autocompleteBar.js.map +1 -1
  43. package/lib/widgets/forms/autocomplete/autocompletePicker.js +8 -3
  44. package/lib/widgets/forms/autocomplete/autocompletePicker.js.map +1 -1
  45. package/lib/widgets/forms/autocomplete/language.js +5 -0
  46. package/lib/widgets/forms/autocomplete/language.js.map +1 -1
  47. package/lib/widgets/forms.js +4 -1
  48. package/lib/widgets/forms.js.map +1 -1
  49. package/lib/widgets/peoplePicker.js +11 -0
  50. package/lib/widgets/peoplePicker.js.map +1 -1
  51. package/package.json +5 -4
package/dist/solid-ui.js CHANGED
@@ -2249,8 +2249,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
2249
2249
  * @packageDocumentation
2250
2250
  */
2251
2251
 
2252
- /* global alert confirm */
2253
-
2254
2252
  // pull in first avoid cross-refs
2255
2253
 
2256
2254
  var UI = {
@@ -2343,7 +2341,8 @@ function _findBookmarkDocument() {
2343
2341
  }
2344
2342
  userContext.bookmarkDocument = userContext.instances[0];
2345
2343
  if (userContext.instances.length > 1) {
2346
- alert('More than one bookmark file! ' + userContext.instances);
2344
+ debug.warn('More than one bookmark file! ' + userContext.instances); // @@ todo - deal with > 1
2345
+ // Note: should pick up community bookmarks as well
2347
2346
  }
2348
2347
  _context.next = 28;
2349
2348
  break;
@@ -2364,7 +2363,7 @@ function _findBookmarkDocument() {
2364
2363
  case 18:
2365
2364
  _context.prev = 18;
2366
2365
  _context.t0 = _context["catch"](12);
2367
- alert.error("Can't make fresh bookmark file:" + _context.t0);
2366
+ debug.warn("Can't make fresh bookmark file:" + _context.t0);
2368
2367
  return _context.abrupt("return", userContext);
2369
2368
  case 22:
2370
2369
  _context.next = 24;
@@ -2374,7 +2373,7 @@ function _findBookmarkDocument() {
2374
2373
  _context.next = 28;
2375
2374
  break;
2376
2375
  case 27:
2377
- alert('You seem to have no bookmark file and not even a profile file.');
2376
+ debug.warn('You seem to have no bookmark file, nor even a profile file!');
2378
2377
  case 28:
2379
2378
  return _context.abrupt("return", userContext);
2380
2379
  case 29:
@@ -2429,7 +2428,7 @@ function _addBookmark() {
2429
2428
  _context2.prev = 14;
2430
2429
  _context2.t0 = _context2["catch"](9);
2431
2430
  msg = 'Making bookmark: ' + _context2.t0;
2432
- alert.error(msg);
2431
+ debug.warn(msg);
2433
2432
  return _context2.abrupt("return", null);
2434
2433
  case 19:
2435
2434
  return _context2.abrupt("return", bookmark);
@@ -2482,7 +2481,7 @@ function _toggleBookmark() {
2482
2481
  _context3.prev = 15;
2483
2482
  _context3.t0 = _context3["catch"](8);
2484
2483
  debug.error('Cant delete bookmark:' + _context3.t0);
2485
- alert('Cant delete bookmark:' + _context3.t0);
2484
+ debug.warn('Cannot delete bookmark:' + _context3.t0);
2486
2485
  case 19:
2487
2486
  i++;
2488
2487
  _context3.next = 7;
@@ -2577,6 +2576,7 @@ Object.defineProperty(exports, "__esModule", ({
2577
2576
  }));
2578
2577
  exports.ChatChannel = void 0;
2579
2578
  exports._createIfNotExists = _createIfNotExists;
2579
+ exports.allVersions = allVersions;
2580
2580
  exports.isDeleted = isDeleted;
2581
2581
  exports.isHidden = isHidden;
2582
2582
  exports.isReplaced = isReplaced;
@@ -2652,6 +2652,7 @@ var ChatChannel = /*#__PURE__*/function () {
2652
2652
  var _this = this;
2653
2653
  var oldMsg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
2654
2654
  var deleteIt = arguments.length > 2 ? arguments[2] : undefined;
2655
+ var thread = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
2655
2656
  return /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
2656
2657
  var sts, now, timestamp, dateStamp, chatDocument, message, me, msg;
2657
2658
  return _regenerator["default"].wrap(function _callee2$(_context2) {
@@ -2664,41 +2665,61 @@ var ChatChannel = /*#__PURE__*/function () {
2664
2665
  chatDocument = oldMsg ? oldMsg.doc() : _this.dateFolder.leafDocumentFromDate(now);
2665
2666
  message = _solidLogic.store.sym(chatDocument.uri + '#' + 'Msg' + timestamp); // const content = store.literal(text)
2666
2667
  me = _solidLogic.authn.currentUser(); // If already logged on
2667
- if (oldMsg) {
2668
- // edit message replaces old one
2669
- sts.push($rdf.st(mostRecentVersion(oldMsg), ns.dct('isReplacedBy'), message, chatDocument));
2670
- if (deleteIt) {
2671
- sts.push($rdf.st(message, ns.schema('dateDeleted'), dateStamp, chatDocument));
2672
- }
2673
- } else {
2674
- // link new message to channel
2675
- sts.push($rdf.st(_this.channel, ns.wf('message'), message, chatDocument));
2668
+ if (!oldMsg) {
2669
+ _context2.next = 21;
2670
+ break;
2676
2671
  }
2672
+ _context2.t0 = sts;
2673
+ _context2.t1 = $rdf;
2674
+ _context2.next = 12;
2675
+ return mostRecentVersion(oldMsg);
2676
+ case 12:
2677
+ _context2.t2 = _context2.sent;
2678
+ _context2.t3 = ns.dct('isReplacedBy');
2679
+ _context2.t4 = message;
2680
+ _context2.t5 = chatDocument;
2681
+ _context2.t6 = _context2.t1.st.call(_context2.t1, _context2.t2, _context2.t3, _context2.t4, _context2.t5);
2682
+ _context2.t0.push.call(_context2.t0, _context2.t6);
2683
+ if (deleteIt) {
2684
+ sts.push($rdf.st(message, ns.schema('dateDeleted'), dateStamp, chatDocument));
2685
+ }
2686
+ _context2.next = 22;
2687
+ break;
2688
+ case 21:
2689
+ // link new message to channel
2690
+ sts.push($rdf.st(_this.channel, ns.wf('message'), message, chatDocument));
2691
+ case 22:
2677
2692
  sts.push($rdf.st(message, ns.sioc('content'), _solidLogic.store.literal(text), chatDocument));
2678
2693
  sts.push($rdf.st(message, ns.dct('created'), dateStamp, chatDocument));
2679
2694
  if (me) {
2680
2695
  sts.push($rdf.st(message, ns.foaf('maker'), me, chatDocument));
2681
2696
  }
2682
- _context2.prev = 11;
2683
- _context2.next = 14;
2684
- return _solidLogic.store.updater.update([], sts);
2685
- case 14:
2686
- _context2.next = 22;
2697
+ if (thread) {
2698
+ sts.push($rdf.st(thread, ns.sioc('has_member'), message, chatDocument));
2699
+ if (!thread.doc().sameTerm(message.doc())) {
2700
+ sts.push($rdf.st(thread, ns.sioc('has_member'), message, thread.doc()));
2701
+ }
2702
+ }
2703
+ _context2.prev = 26;
2704
+ _context2.next = 29;
2705
+ return _solidLogic.store.updater.updateMany([], sts);
2706
+ case 29:
2707
+ _context2.next = 37;
2687
2708
  break;
2688
- case 16:
2689
- _context2.prev = 16;
2690
- _context2.t0 = _context2["catch"](11);
2691
- msg = 'Error saving chat message: ' + _context2.t0;
2709
+ case 31:
2710
+ _context2.prev = 31;
2711
+ _context2.t7 = _context2["catch"](26);
2712
+ msg = 'Error saving chat message: ' + _context2.t7;
2692
2713
  debug.warn(msg);
2693
2714
  alert(msg);
2694
2715
  throw new Error(msg);
2695
- case 22:
2716
+ case 37:
2696
2717
  return _context2.abrupt("return", message);
2697
- case 23:
2718
+ case 38:
2698
2719
  case "end":
2699
2720
  return _context2.stop();
2700
2721
  }
2701
- }, _callee2, null, [[11, 16]]);
2722
+ }, _callee2, null, [[26, 31]]);
2702
2723
  })();
2703
2724
  });
2704
2725
  function updateMessage(_x2) {
@@ -2728,26 +2749,187 @@ var ChatChannel = /*#__PURE__*/function () {
2728
2749
  return _deleteMessage.apply(this, arguments);
2729
2750
  }
2730
2751
  return deleteMessage;
2752
+ }() // Create a new thread of replies to the thread root message
2753
+ // or return one which already exists
2754
+ }, {
2755
+ key: "createThread",
2756
+ value: function () {
2757
+ var _createThread = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(threadRoot) {
2758
+ var already, thread, insert;
2759
+ return _regenerator["default"].wrap(function _callee4$(_context4) {
2760
+ while (1) switch (_context4.prev = _context4.next) {
2761
+ case 0:
2762
+ already = _solidLogic.store.each(threadRoot, ns.sioc('has_reply'), null, threadRoot.doc()).filter(function (thread) {
2763
+ return _solidLogic.store.holds(thread, ns.rdf('type'), ns.sioc('Thread'), thread.doc());
2764
+ });
2765
+ if (!(already.length > 0)) {
2766
+ _context4.next = 3;
2767
+ break;
2768
+ }
2769
+ return _context4.abrupt("return", already[0]);
2770
+ case 3:
2771
+ thread = $rdf.sym(threadRoot.uri + '-thread');
2772
+ insert = [$rdf.st(thread, ns.rdf('type'), ns.sioc('Thread'), thread.doc()), $rdf.st(threadRoot, ns.sioc('has_reply'), thread, thread.doc())];
2773
+ _context4.next = 7;
2774
+ return _solidLogic.store.updater.update([], insert);
2775
+ case 7:
2776
+ return _context4.abrupt("return", thread);
2777
+ case 8:
2778
+ case "end":
2779
+ return _context4.stop();
2780
+ }
2781
+ }, _callee4);
2782
+ }));
2783
+ function createThread(_x4) {
2784
+ return _createThread.apply(this, arguments);
2785
+ }
2786
+ return createThread;
2731
2787
  }()
2732
2788
  }]);
2733
2789
  return ChatChannel;
2734
2790
  }(); // class ChatChannel
2791
+ // ////////// Utility functions
2792
+ // Have to not loop forever if fed loops
2735
2793
  exports.ChatChannel = ChatChannel;
2736
- function originalVersion(message) {
2737
- var msg = message;
2738
- while (msg) {
2739
- message = msg;
2740
- msg = _solidLogic.store.any(null, ns.dct('isReplacedBy'), message, message.doc());
2741
- }
2742
- return message;
2794
+ function allVersions(_x5) {
2795
+ return _allVersions.apply(this, arguments);
2743
2796
  }
2744
- function mostRecentVersion(message) {
2745
- var msg = message;
2746
- while (msg) {
2747
- message = msg;
2748
- msg = _solidLogic.store.any(message, ns.dct('isReplacedBy'), null, message.doc());
2749
- }
2750
- return message;
2797
+ function _allVersions() {
2798
+ _allVersions = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(message) {
2799
+ var versions, done, m, prev, next;
2800
+ return _regenerator["default"].wrap(function _callee5$(_context5) {
2801
+ while (1) switch (_context5.prev = _context5.next) {
2802
+ case 0:
2803
+ versions = [message];
2804
+ done = {};
2805
+ done[message.ur] = true;
2806
+ m = message;
2807
+ case 4:
2808
+ if (false) {}
2809
+ // earlier?
2810
+ prev = _solidLogic.store.any(null, ns.dct('isReplacedBy'), m, m.doc());
2811
+ if (!(!prev || done[prev.uri])) {
2812
+ _context5.next = 8;
2813
+ break;
2814
+ }
2815
+ return _context5.abrupt("break", 15);
2816
+ case 8:
2817
+ _context5.next = 10;
2818
+ return _solidLogic.store.fetcher.load(prev);
2819
+ case 10:
2820
+ versions.unshift(prev);
2821
+ done[prev.uri] = true;
2822
+ m = prev;
2823
+ _context5.next = 4;
2824
+ break;
2825
+ case 15:
2826
+ m = message;
2827
+ case 16:
2828
+ if (false) {}
2829
+ // later?
2830
+ next = _solidLogic.store.any(m, ns.dct('isReplacedBy'), null, m.doc());
2831
+ if (!(!next || done[next.uri])) {
2832
+ _context5.next = 20;
2833
+ break;
2834
+ }
2835
+ return _context5.abrupt("break", 25);
2836
+ case 20:
2837
+ versions.push(next);
2838
+ done[next.uri] = true;
2839
+ m = next;
2840
+ _context5.next = 16;
2841
+ break;
2842
+ case 25:
2843
+ return _context5.abrupt("return", versions);
2844
+ case 26:
2845
+ case "end":
2846
+ return _context5.stop();
2847
+ }
2848
+ }, _callee5);
2849
+ }));
2850
+ return _allVersions.apply(this, arguments);
2851
+ }
2852
+ function originalVersion(_x6) {
2853
+ return _originalVersion.apply(this, arguments);
2854
+ }
2855
+ function _originalVersion() {
2856
+ _originalVersion = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(message) {
2857
+ var msg, done;
2858
+ return _regenerator["default"].wrap(function _callee6$(_context6) {
2859
+ while (1) switch (_context6.prev = _context6.next) {
2860
+ case 0:
2861
+ msg = message;
2862
+ done = {}; // done[message.ur] = true
2863
+ case 2:
2864
+ if (!msg) {
2865
+ _context6.next = 13;
2866
+ break;
2867
+ }
2868
+ if (!done[msg.uri]) {
2869
+ _context6.next = 6;
2870
+ break;
2871
+ }
2872
+ debug.error('originalVersion: verion loop' + message);
2873
+ return _context6.abrupt("return", message);
2874
+ case 6:
2875
+ done[msg.uri] = true;
2876
+ message = msg;
2877
+ _context6.next = 10;
2878
+ return _solidLogic.store.fetcher.load(message);
2879
+ case 10:
2880
+ msg = _solidLogic.store.any(null, ns.dct('isReplacedBy'), message, message.doc());
2881
+ _context6.next = 2;
2882
+ break;
2883
+ case 13:
2884
+ return _context6.abrupt("return", message);
2885
+ case 14:
2886
+ case "end":
2887
+ return _context6.stop();
2888
+ }
2889
+ }, _callee6);
2890
+ }));
2891
+ return _originalVersion.apply(this, arguments);
2892
+ }
2893
+ function mostRecentVersion(_x7) {
2894
+ return _mostRecentVersion.apply(this, arguments);
2895
+ }
2896
+ function _mostRecentVersion() {
2897
+ _mostRecentVersion = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(message) {
2898
+ var msg, done;
2899
+ return _regenerator["default"].wrap(function _callee7$(_context7) {
2900
+ while (1) switch (_context7.prev = _context7.next) {
2901
+ case 0:
2902
+ msg = message;
2903
+ done = {};
2904
+ case 2:
2905
+ if (!msg) {
2906
+ _context7.next = 13;
2907
+ break;
2908
+ }
2909
+ if (!done[msg.uri]) {
2910
+ _context7.next = 6;
2911
+ break;
2912
+ }
2913
+ debug.error('mostRecentVersion: verion loop' + message);
2914
+ return _context7.abrupt("return", message);
2915
+ case 6:
2916
+ done[msg.uri] = true;
2917
+ message = msg;
2918
+ _context7.next = 10;
2919
+ return _solidLogic.store.fetcher.load(message);
2920
+ case 10:
2921
+ msg = _solidLogic.store.any(message, ns.dct('isReplacedBy'), null, message.doc());
2922
+ _context7.next = 2;
2923
+ break;
2924
+ case 13:
2925
+ return _context7.abrupt("return", message);
2926
+ case 14:
2927
+ case "end":
2928
+ return _context7.stop();
2929
+ }
2930
+ }, _callee7);
2931
+ }));
2932
+ return _mostRecentVersion.apply(this, arguments);
2751
2933
  }
2752
2934
  function isDeleted(message) {
2753
2935
  return _solidLogic.store.holds(message, ns.schema('dateDeleted'), null, message.doc());
@@ -2766,62 +2948,62 @@ function nick(person) {
2766
2948
  if (s) return '' + s.value;
2767
2949
  return '' + utils.label(person);
2768
2950
  }
2769
- function _createIfNotExists(_x4) {
2951
+ function _createIfNotExists(_x8) {
2770
2952
  return _createIfNotExists2.apply(this, arguments);
2771
2953
  } // ends
2772
2954
  function _createIfNotExists2() {
2773
2955
  _createIfNotExists2 = (0, _asyncToGenerator2["default"])(function (doc) {
2774
2956
  var contentType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'text/turtle';
2775
2957
  var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
2776
- return /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
2958
+ return /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
2777
2959
  var response;
2778
- return _regenerator["default"].wrap(function _callee4$(_context4) {
2779
- while (1) switch (_context4.prev = _context4.next) {
2960
+ return _regenerator["default"].wrap(function _callee8$(_context8) {
2961
+ while (1) switch (_context8.prev = _context8.next) {
2780
2962
  case 0:
2781
- _context4.prev = 0;
2782
- _context4.next = 3;
2963
+ _context8.prev = 0;
2964
+ _context8.next = 3;
2783
2965
  return _solidLogic.store.fetcher.load(doc);
2784
2966
  case 3:
2785
- response = _context4.sent;
2786
- _context4.next = 26;
2967
+ response = _context8.sent;
2968
+ _context8.next = 26;
2787
2969
  break;
2788
2970
  case 6:
2789
- _context4.prev = 6;
2790
- _context4.t0 = _context4["catch"](0);
2791
- if (!(_context4.t0.response.status === 404)) {
2792
- _context4.next = 24;
2971
+ _context8.prev = 6;
2972
+ _context8.t0 = _context8["catch"](0);
2973
+ if (!(_context8.t0.response.status === 404)) {
2974
+ _context8.next = 24;
2793
2975
  break;
2794
2976
  }
2795
2977
  debug.log('createIfNotExists: doc does NOT exist, will create... ' + doc);
2796
- _context4.prev = 10;
2797
- _context4.next = 13;
2978
+ _context8.prev = 10;
2979
+ _context8.next = 13;
2798
2980
  return _solidLogic.store.fetcher.webOperation('PUT', doc.uri, {
2799
2981
  data: data,
2800
2982
  contentType: contentType
2801
2983
  });
2802
2984
  case 13:
2803
- response = _context4.sent;
2804
- _context4.next = 20;
2985
+ response = _context8.sent;
2986
+ _context8.next = 20;
2805
2987
  break;
2806
2988
  case 16:
2807
- _context4.prev = 16;
2808
- _context4.t1 = _context4["catch"](10);
2809
- debug.log('createIfNotExists doc FAILED: ' + doc + ': ' + _context4.t1);
2810
- throw _context4.t1;
2989
+ _context8.prev = 16;
2990
+ _context8.t1 = _context8["catch"](10);
2991
+ debug.log('createIfNotExists doc FAILED: ' + doc + ': ' + _context8.t1);
2992
+ throw _context8.t1;
2811
2993
  case 20:
2812
2994
  delete _solidLogic.store.fetcher.requested[doc.uri]; // delete cached 404 error
2813
2995
  // debug.log('createIfNotExists doc created ok ' + doc)
2814
- return _context4.abrupt("return", response);
2996
+ return _context8.abrupt("return", response);
2815
2997
  case 24:
2816
- debug.log('createIfNotExists doc load error NOT 404: ' + doc + ': ' + _context4.t0);
2817
- throw _context4.t0;
2998
+ debug.log('createIfNotExists doc load error NOT 404: ' + doc + ': ' + _context8.t0);
2999
+ throw _context8.t0;
2818
3000
  case 26:
2819
- return _context4.abrupt("return", response);
3001
+ return _context8.abrupt("return", response);
2820
3002
  case 27:
2821
3003
  case "end":
2822
- return _context4.stop();
3004
+ return _context8.stop();
2823
3005
  }
2824
- }, _callee4, null, [[0, 6], [10, 16]]);
3006
+ }, _callee8, null, [[0, 6], [10, 16]]);
2825
3007
  })();
2826
3008
  });
2827
3009
  return _createIfNotExists2.apply(this, arguments);
@@ -2845,10 +3027,11 @@ Object.defineProperty(exports, "__esModule", ({
2845
3027
  value: true
2846
3028
  }));
2847
3029
  exports.DateFolder = void 0;
3030
+ exports.emptyLeaf = emptyLeaf;
2848
3031
  var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
2849
- var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
2850
3032
  var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"));
2851
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"));
2852
3035
  var debug = _interopRequireWildcard(__webpack_require__(/*! ../debug */ "./lib/debug.js"));
2853
3036
  var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
2854
3037
  var ns = _interopRequireWildcard(__webpack_require__(/*! ../ns */ "./lib/ns.js"));
@@ -2861,9 +3044,29 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
2861
3044
  *
2862
3045
  */
2863
3046
  // pull in first avoid cross-refs
3047
+ function emptyLeaf(_x) {
3048
+ return _emptyLeaf.apply(this, arguments);
3049
+ }
2864
3050
  /**
2865
3051
  * Track back through the YYYY/MM/DD tree to find the previous/next day
2866
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
+ }
2867
3070
  var DateFolder = /*#__PURE__*/function () {
2868
3071
  function DateFolder(rootThing, leafFileName, membershipProperty) {
2869
3072
  (0, _classCallCheck2["default"])(this, DateFolder);
@@ -2902,61 +3105,22 @@ var DateFolder = /*#__PURE__*/function () {
2902
3105
  }, {
2903
3106
  key: "loadPrevious",
2904
3107
  value: function () {
2905
- var _loadPrevious = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(date, backwards) {
2906
- var thisDateFolder, previousPeriod, _previousPeriod, folder, found, doc;
2907
- return _regenerator["default"].wrap(function _callee3$(_context3) {
2908
- 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) {
2909
3112
  case 0:
2910
3113
  _previousPeriod = function _previousPeriod3() {
2911
- _previousPeriod = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(file, level) {
2912
- var younger, suitable, lastNonEmpty, _lastNonEmpty, parent, siblings, _folder, uncle, cousins, result;
2913
- return _regenerator["default"].wrap(function _callee2$(_context2) {
2914
- 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) {
2915
3118
  case 0:
2916
- _lastNonEmpty = function _lastNonEmpty3() {
2917
- _lastNonEmpty = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(siblings) {
2918
- var _folder2, leafDocument;
2919
- return _regenerator["default"].wrap(function _callee$(_context) {
2920
- while (1) switch (_context.prev = _context.next) {
2921
- case 0:
2922
- siblings = siblings.filter(suitable);
2923
- siblings.sort(); // chronological order
2924
- if (!backwards) siblings.reverse();
2925
- if (!(level !== 3)) {
2926
- _context.next = 5;
2927
- break;
2928
- }
2929
- return _context.abrupt("return", siblings.pop());
2930
- case 5:
2931
- if (!siblings.length) {
2932
- _context.next = 14;
2933
- break;
2934
- }
2935
- _folder2 = siblings.pop();
2936
- leafDocument = _solidLogic.store.sym(_folder2.uri + thisDateFolder.leafFileName);
2937
- _context.next = 10;
2938
- return _solidLogic.store.fetcher.load(leafDocument);
2939
- case 10:
2940
- if (!(_solidLogic.store.statementsMatching(null, ns.dct('created'), null, leafDocument).length > 0)) {
2941
- _context.next = 12;
2942
- break;
2943
- }
2944
- return _context.abrupt("return", _folder2);
2945
- case 12:
2946
- _context.next = 5;
2947
- break;
2948
- case 14:
2949
- return _context.abrupt("return", null);
2950
- case 15:
2951
- case "end":
2952
- return _context.stop();
2953
- }
2954
- }, _callee);
2955
- }));
2956
- return _lastNonEmpty.apply(this, arguments);
2957
- };
2958
- lastNonEmpty = function _lastNonEmpty2(_x5) {
2959
- 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
2960
3124
  };
2961
3125
  suitable = function _suitable(x) {
2962
3126
  var tail = x.uri.slice(0, -1).split('/').slice(-1)[0];
@@ -2969,97 +3133,115 @@ var DateFolder = /*#__PURE__*/function () {
2969
3133
  };
2970
3134
  // debug.log(' previousPeriod level' + level + ' file ' + file)
2971
3135
  parent = file.dir();
2972
- _context2.prev = 5;
2973
- _context2.next = 8;
3136
+ _context.prev = 4;
3137
+ _context.next = 7;
2974
3138
  return _solidLogic.store.fetcher.load(parent);
2975
- case 8:
3139
+ case 7:
2976
3140
  siblings = _solidLogic.store.each(parent, ns.ldp('contains'));
2977
3141
  siblings = siblings.filter(younger);
2978
- _context2.next = 12;
2979
- return lastNonEmpty(siblings);
2980
- case 12:
2981
- _folder = _context2.sent;
3142
+ _folder = lastOrFirst(siblings);
2982
3143
  if (!_folder) {
2983
- _context2.next = 15;
3144
+ _context.next = 12;
2984
3145
  break;
2985
3146
  }
2986
- return _context2.abrupt("return", _folder);
2987
- case 15:
2988
- _context2.next = 25;
3147
+ return _context.abrupt("return", _folder);
3148
+ case 12:
3149
+ debug.log(' parent no suitable offspring ' + parent);
3150
+ _context.next = 23;
2989
3151
  break;
2990
- case 17:
2991
- _context2.prev = 17;
2992
- _context2.t0 = _context2["catch"](5);
2993
- if (!(_context2.t0.response && _context2.t0.response.status && _context2.t0.response.status === 404)) {
2994
- _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;
2995
3157
  break;
2996
3158
  }
2997
3159
  debug.log('Error 404 for chat parent file ' + parent);
2998
- _context2.next = 25;
3160
+ _context.next = 23;
2999
3161
  break;
3000
- case 23:
3162
+ case 21:
3001
3163
  debug.log('*** Error NON 404 for chat parent file ' + parent);
3002
3164
  // statusTR.appendChild(widgets.errorMessageBlock(dom, err, 'pink'))
3003
- throw new Error("*** ".concat(_context2.t0.message, " for chat folder ").concat(parent));
3004
- case 25:
3165
+ throw new Error("*** ".concat(_context.t0.message, " for chat folder ").concat(parent));
3166
+ case 23:
3005
3167
  if (!(level === 0)) {
3006
- _context2.next = 27;
3168
+ _context.next = 26;
3007
3169
  break;
3008
3170
  }
3009
- return _context2.abrupt("return", null);
3010
- case 27:
3011
- _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;
3012
3175
  return previousPeriod(parent, level - 1);
3013
- case 29:
3014
- uncle = _context2.sent;
3176
+ case 28:
3177
+ uncle = _context.sent;
3015
3178
  if (uncle) {
3016
- _context2.next = 32;
3179
+ _context.next = 32;
3017
3180
  break;
3018
3181
  }
3019
- return _context2.abrupt("return", null);
3182
+ debug.log(' previousPeriod: nothing left before. ', parent);
3183
+ return _context.abrupt("return", null);
3020
3184
  case 32:
3021
- _context2.next = 34;
3185
+ _context.next = 34;
3022
3186
  return _solidLogic.store.fetcher.load(uncle);
3023
3187
  case 34:
3024
3188
  cousins = _solidLogic.store.each(uncle, ns.ldp('contains'));
3025
- _context2.next = 37;
3026
- return lastNonEmpty(cousins);
3027
- case 37:
3028
- result = _context2.sent;
3029
- 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);
3030
3193
  case 39:
3031
3194
  case "end":
3032
- return _context2.stop();
3195
+ return _context.stop();
3033
3196
  }
3034
- }, _callee2, null, [[5, 17]]);
3197
+ }, _callee, null, [[4, 15]]);
3035
3198
  }));
3036
3199
  return _previousPeriod.apply(this, arguments);
3037
3200
  };
3038
- previousPeriod = function _previousPeriod2(_x3, _x4) {
3201
+ previousPeriod = function _previousPeriod2(_x4, _x5) {
3039
3202
  return _previousPeriod.apply(this, arguments);
3040
- };
3041
- thisDateFolder = this;
3042
- // previousPeriod
3203
+ }; // previousPeriod
3043
3204
  folder = this.leafDocumentFromDate(date).dir();
3044
- _context3.next = 6;
3205
+ case 3:
3206
+ if (false) {}
3207
+ _context2.next = 6;
3045
3208
  return previousPeriod(folder, 3);
3046
3209
  case 6:
3047
- found = _context3.sent;
3210
+ found = _context2.sent;
3048
3211
  if (!found) {
3049
- _context3.next = 10;
3212
+ _context2.next = 22;
3050
3213
  break;
3051
3214
  }
3052
- doc = _solidLogic.store.sym(found.uri + this.leafFileName);
3053
- return _context3.abrupt("return", this.dateFromLeafDocument(doc));
3054
- case 10:
3055
- return _context3.abrupt("return", null);
3056
- case 11:
3215
+ leafDocument = _solidLogic.store.sym(found.uri + this.leafFileName);
3216
+ nextDate = this.dateFromLeafDocument(leafDocument);
3217
+ _context2.next = 12;
3218
+ return emptyLeaf(leafDocument);
3219
+ case 12:
3220
+ if (_context2.sent) {
3221
+ _context2.next = 16;
3222
+ break;
3223
+ }
3224
+ return _context2.abrupt("return", nextDate);
3225
+ case 16:
3226
+ debug.log(' loadPrevious: skipping empty ' + leafDocument);
3227
+ date = nextDate;
3228
+ folder = this.leafDocumentFromDate(date).dir();
3229
+ debug.log(' loadPrevious: moved back to ' + folder);
3230
+ case 20:
3231
+ _context2.next = 23;
3232
+ break;
3233
+ case 22:
3234
+ return _context2.abrupt("return", null);
3235
+ case 23:
3236
+ _context2.next = 3;
3237
+ break;
3238
+ case 25:
3057
3239
  case "end":
3058
- return _context3.stop();
3240
+ return _context2.stop();
3059
3241
  }
3060
- }, _callee3, this);
3242
+ }, _callee2, this);
3061
3243
  }));
3062
- function loadPrevious(_x, _x2) {
3244
+ function loadPrevious(_x2, _x3) {
3063
3245
  return _loadPrevious.apply(this, arguments);
3064
3246
  }
3065
3247
  return loadPrevious;
@@ -3067,16 +3249,16 @@ var DateFolder = /*#__PURE__*/function () {
3067
3249
  }, {
3068
3250
  key: "firstLeaf",
3069
3251
  value: function () {
3070
- var _firstLeaf = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(backwards) {
3252
+ var _firstLeaf = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(backwards) {
3071
3253
  var folderStore, folderFetcher, earliestSubfolder, _earliestSubfolder, y, month, d, leafDocument, leafObjects, msg, sortMe;
3072
- return _regenerator["default"].wrap(function _callee5$(_context5) {
3073
- while (1) switch (_context5.prev = _context5.next) {
3254
+ return _regenerator["default"].wrap(function _callee4$(_context4) {
3255
+ while (1) switch (_context4.prev = _context4.next) {
3074
3256
  case 0:
3075
3257
  _earliestSubfolder = function _earliestSubfolder3() {
3076
- _earliestSubfolder = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(parent) {
3258
+ _earliestSubfolder = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(parent) {
3077
3259
  var suitable, kids;
3078
- return _regenerator["default"].wrap(function _callee4$(_context4) {
3079
- while (1) switch (_context4.prev = _context4.next) {
3260
+ return _regenerator["default"].wrap(function _callee3$(_context3) {
3261
+ while (1) switch (_context3.prev = _context3.next) {
3080
3262
  case 0:
3081
3263
  suitable = function _suitable2(x) {
3082
3264
  var tail = x.uri.slice(0, -1).split('/').slice(-1)[0];
@@ -3086,7 +3268,7 @@ var DateFolder = /*#__PURE__*/function () {
3086
3268
  debug.log(' parent ' + parent);
3087
3269
  delete folderFetcher.requested[parent.uri];
3088
3270
  // try {
3089
- _context4.next = 5;
3271
+ _context3.next = 5;
3090
3272
  return folderFetcher.load(parent, {
3091
3273
  force: true
3092
3274
  });
@@ -3097,19 +3279,19 @@ var DateFolder = /*#__PURE__*/function () {
3097
3279
  kids = folderStore.each(parent, ns.ldp('contains'));
3098
3280
  kids = kids.filter(suitable);
3099
3281
  if (!(kids.length === 0)) {
3100
- _context4.next = 9;
3282
+ _context3.next = 9;
3101
3283
  break;
3102
3284
  }
3103
3285
  throw new Error(' @@@ No children to parent2 ' + parent);
3104
3286
  case 9:
3105
3287
  kids.sort();
3106
3288
  if (backwards) kids.reverse();
3107
- return _context4.abrupt("return", kids[0]);
3289
+ return _context3.abrupt("return", kids[0]);
3108
3290
  case 12:
3109
3291
  case "end":
3110
- return _context4.stop();
3292
+ return _context3.stop();
3111
3293
  }
3112
- }, _callee4);
3294
+ }, _callee3);
3113
3295
  }));
3114
3296
  return _earliestSubfolder.apply(this, arguments);
3115
3297
  };
@@ -3119,25 +3301,25 @@ var DateFolder = /*#__PURE__*/function () {
3119
3301
  // backwards -> last leafObject
3120
3302
  folderStore = $rdf.graph();
3121
3303
  folderFetcher = new $rdf.Fetcher(folderStore);
3122
- _context5.next = 6;
3304
+ _context4.next = 6;
3123
3305
  return earliestSubfolder(this.root.dir());
3124
3306
  case 6:
3125
- y = _context5.sent;
3126
- _context5.next = 9;
3307
+ y = _context4.sent;
3308
+ _context4.next = 9;
3127
3309
  return earliestSubfolder(y);
3128
3310
  case 9:
3129
- month = _context5.sent;
3130
- _context5.next = 12;
3311
+ month = _context4.sent;
3312
+ _context4.next = 12;
3131
3313
  return earliestSubfolder(month);
3132
3314
  case 12:
3133
- d = _context5.sent;
3315
+ d = _context4.sent;
3134
3316
  leafDocument = $rdf.sym(d.uri + 'chat.ttl');
3135
- _context5.next = 16;
3317
+ _context4.next = 16;
3136
3318
  return folderFetcher.load(leafDocument);
3137
3319
  case 16:
3138
3320
  leafObjects = folderStore.each(this.root, this.membershipProperty, null, leafDocument);
3139
3321
  if (!(leafObjects.length === 0)) {
3140
- _context5.next = 21;
3322
+ _context4.next = 21;
3141
3323
  break;
3142
3324
  }
3143
3325
  msg = ' INCONSISTENCY -- no chat leafObject in file ' + leafDocument;
@@ -3150,12 +3332,12 @@ var DateFolder = /*#__PURE__*/function () {
3150
3332
  sortMe.sort();
3151
3333
  if (backwards) sortMe.reverse();
3152
3334
  debug.log((backwards ? 'Latest' : 'Earliest') + ' leafObject is ' + sortMe[0][1]);
3153
- return _context5.abrupt("return", sortMe[0][1]);
3335
+ return _context4.abrupt("return", sortMe[0][1]);
3154
3336
  case 26:
3155
3337
  case "end":
3156
- return _context5.stop();
3338
+ return _context4.stop();
3157
3339
  }
3158
- }, _callee5, this);
3340
+ }, _callee4, this);
3159
3341
  }));
3160
3342
  function firstLeaf(_x6) {
3161
3343
  return _firstLeaf.apply(this, arguments);
@@ -3199,19 +3381,17 @@ var _chatLogic = __webpack_require__(/*! ./chatLogic */ "./lib/chat/chatLogic.js
3199
3381
  var _message = __webpack_require__(/*! ./message */ "./lib/chat/message.js");
3200
3382
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
3201
3383
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
3202
- /**
3203
- * Contains the [[infiniteMessageArea]] class
3204
- * @packageDocumentation
3205
- */
3206
- // import { findBookmarkDocument } from './bookmarks'
3384
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
3385
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
3386
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } /**
3387
+ * Contains the [[infiniteMessageArea]] class
3388
+ * @packageDocumentation
3389
+ */ // import { findBookmarkDocument } from './bookmarks'
3207
3390
  // pull in first avoid cross-refs
3208
-
3209
3391
  // import * as style from '../style'
3210
3392
  // import * as utils from '../utils'
3211
-
3212
3393
  // import * as pad from '../pad'
3213
3394
  // import { DateFolder } from './dateFolder'
3214
-
3215
3395
  // const UI = { authn, icons, ns, media, pad, $rdf, store, style, utils, widgets }
3216
3396
 
3217
3397
  function desktopNotification(str) {
@@ -3239,34 +3419,9 @@ function desktopNotification(str) {
3239
3419
  /**
3240
3420
  * Renders a chat message inside a `messageTable`
3241
3421
  */
3242
- function insertMessageIntoTable(channelObject, messageTable, message, fresh, options, userContext) {
3243
- var messageRow = (0, _message.renderMessageRow)(channelObject, message, fresh, options, userContext);
3244
-
3245
- // const message = messageRow.AJAR_subject
3246
- if (options.selectedMessage && options.selectedMessage.sameTerm(message)) {
3247
- messageRow.style.backgroundColor = 'yellow';
3248
- options.selectedElement = messageRow;
3249
- messageTable.selectedElement = messageRow;
3250
- }
3251
- var done = false;
3252
- for (var ele = messageTable.firstChild;; ele = ele.nextSibling) {
3253
- if (!ele) {
3254
- // empty
3255
- break;
3256
- }
3257
- var newestFirst = options.newestfirst === true;
3258
- var dateString = messageRow.AJAR_date;
3259
- if (dateString > ele.AJAR_date && newestFirst || dateString < ele.AJAR_date && !newestFirst) {
3260
- messageTable.insertBefore(messageRow, ele);
3261
- done = true;
3262
- break;
3263
- }
3264
- }
3265
- if (!done) {
3266
- messageTable.appendChild(messageRow);
3267
- }
3422
+ function insertMessageIntoTable(_x, _x2, _x3, _x4, _x5, _x6) {
3423
+ return _insertMessageIntoTable.apply(this, arguments);
3268
3424
  }
3269
-
3270
3425
  /**
3271
3426
  * Common code for a chat (discussion area of messages about something)
3272
3427
  * This version runs over a series of files for different time periods
@@ -3289,20 +3444,70 @@ function insertMessageIntoTable(channelObject, messageTable, message, fresh, opt
3289
3444
  - inlineImageHeightEms: The height (in ems) of images expaned from their URIs in the chat.
3290
3445
 
3291
3446
  */
3292
- function infiniteMessageArea(_x, _x2, _x3, _x4) {
3447
+ function _insertMessageIntoTable() {
3448
+ _insertMessageIntoTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(channelObject, messageTable, message, fresh, options, userContext) {
3449
+ var messageRow, done, ele, newestFirst, dateString;
3450
+ return _regenerator["default"].wrap(function _callee$(_context) {
3451
+ while (1) switch (_context.prev = _context.next) {
3452
+ case 0:
3453
+ _context.next = 2;
3454
+ return (0, _message.renderMessageRow)(channelObject, message, fresh, options, userContext);
3455
+ case 2:
3456
+ messageRow = _context.sent;
3457
+ // const message = messageRow.AJAR_subject
3458
+ if (options.selectedMessage && options.selectedMessage.sameTerm(message)) {
3459
+ messageRow.style.backgroundColor = 'yellow';
3460
+ options.selectedElement = messageRow;
3461
+ messageTable.selectedElement = messageRow;
3462
+ }
3463
+ done = false;
3464
+ ele = messageTable.firstChild;
3465
+ case 6:
3466
+ if (ele) {
3467
+ _context.next = 8;
3468
+ break;
3469
+ }
3470
+ return _context.abrupt("break", 17);
3471
+ case 8:
3472
+ newestFirst = options.newestfirst === true;
3473
+ dateString = messageRow.AJAR_date;
3474
+ if (!(dateString > ele.AJAR_date && newestFirst || dateString < ele.AJAR_date && !newestFirst)) {
3475
+ _context.next = 14;
3476
+ break;
3477
+ }
3478
+ messageTable.insertBefore(messageRow, ele);
3479
+ done = true;
3480
+ return _context.abrupt("break", 17);
3481
+ case 14:
3482
+ ele = ele.nextSibling;
3483
+ _context.next = 6;
3484
+ break;
3485
+ case 17:
3486
+ if (!done) {
3487
+ messageTable.appendChild(messageRow);
3488
+ }
3489
+ case 18:
3490
+ case "end":
3491
+ return _context.stop();
3492
+ }
3493
+ }, _callee);
3494
+ }));
3495
+ return _insertMessageIntoTable.apply(this, arguments);
3496
+ }
3497
+ function infiniteMessageArea(_x7, _x8, _x9, _x10) {
3293
3498
  return _infiniteMessageArea.apply(this, arguments);
3294
3499
  }
3295
3500
  function _infiniteMessageArea() {
3296
- _infiniteMessageArea = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12(dom, wasStore, chatChannel, options) {
3297
- var syncMessages, addMessage, insertPreviousMessages, _insertPreviousMessages, removePreviousMessages, createMessageTable, _createMessageTable, renderMessageTable, addNewChatDocumentIfNewDay, _addNewChatDocumentIfNewDay, appendCurrentMessages, _appendCurrentMessages, loadMoreWhereNeeded, _loadMoreWhereNeeded, loadInitialContent, _loadInitialContent, newestFirst, channelObject, dateFolder, div, statusArea, userContext, liveMessageTable, earliest, latest, lock;
3298
- return _regenerator["default"].wrap(function _callee12$(_context12) {
3299
- while (1) switch (_context12.prev = _context12.next) {
3501
+ _infiniteMessageArea = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee15(dom, wasStore, chatChannel, options) {
3502
+ 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;
3503
+ return _regenerator["default"].wrap(function _callee15$(_context15) {
3504
+ while (1) switch (_context15.prev = _context15.next) {
3300
3505
  case 0:
3301
3506
  _loadInitialContent = function _loadInitialContent3() {
3302
- _loadInitialContent = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11() {
3303
- var yank, fixScroll, live, selectedDocument, now, todayDocument, selectedMessageTable, selectedDate;
3304
- return _regenerator["default"].wrap(function _callee11$(_context11) {
3305
- while (1) switch (_context11.prev = _context11.next) {
3507
+ _loadInitialContent = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14() {
3508
+ var yank, fixScroll, live, selectedDocument, threadRootDocument, initialDocment, now, todayDocument, selectedMessageTable, selectedDate;
3509
+ return _regenerator["default"].wrap(function _callee14$(_context14) {
3510
+ while (1) switch (_context14.prev = _context14.next) {
3306
3511
  case 0:
3307
3512
  fixScroll = function _fixScroll() {
3308
3513
  if (options.selectedElement) {
@@ -3316,51 +3521,59 @@ function _infiniteMessageArea() {
3316
3521
  }
3317
3522
  };
3318
3523
  yank = function _yank() {
3319
- selectedMessageTable.selectedElement.scrollIntoView({
3320
- block: 'center'
3321
- });
3322
- };
3524
+ if (selectedMessageTable && selectedMessageTable.selectedElement) {
3525
+ selectedMessageTable.selectedElement.scrollIntoView({
3526
+ block: 'center'
3527
+ });
3528
+ }
3529
+ }; // During initial load ONLY keep scroll to selected thing or bottom
3323
3530
  if (options.selectedMessage) {
3324
3531
  selectedDocument = options.selectedMessage.doc();
3532
+ }
3533
+ if (threadRootMessage) {
3534
+ threadRootDocument = threadRootMessage.doc();
3535
+ }
3536
+ initialDocment = selectedDocument || threadRootDocument;
3537
+ if (initialDocment) {
3325
3538
  now = new Date();
3326
3539
  todayDocument = dateFolder.leafDocumentFromDate(now);
3327
- live = todayDocument.sameTerm(selectedDocument);
3540
+ live = todayDocument.sameTerm(initialDocment);
3328
3541
  }
3329
- if (!(options.selectedMessage && !live)) {
3330
- _context11.next = 15;
3542
+ if (!(initialDocment && !live)) {
3543
+ _context14.next = 18;
3331
3544
  break;
3332
3545
  }
3333
- selectedDate = dateFolder.dateFromLeafDocument(selectedDocument);
3334
- _context11.next = 7;
3546
+ selectedDate = dateFolder.dateFromLeafDocument(initialDocment);
3547
+ _context14.next = 10;
3335
3548
  return createMessageTable(selectedDate, live);
3336
- case 7:
3337
- selectedMessageTable = _context11.sent;
3549
+ case 10:
3550
+ selectedMessageTable = _context14.sent;
3338
3551
  div.appendChild(selectedMessageTable);
3339
3552
  earliest.messageTable = selectedMessageTable;
3340
3553
  latest.messageTable = selectedMessageTable;
3341
3554
  yank();
3342
3555
  setTimeout(yank, 1000); // @@ kludge - restore position distubed by other cHANGES
3343
- _context11.next = 19;
3556
+ _context14.next = 22;
3344
3557
  break;
3345
- case 15:
3346
- _context11.next = 17;
3558
+ case 18:
3559
+ _context14.next = 20;
3347
3560
  return appendCurrentMessages();
3348
- case 17:
3561
+ case 20:
3349
3562
  earliest.messageTable = liveMessageTable;
3350
3563
  latest.messageTable = liveMessageTable;
3351
- case 19:
3352
- _context11.next = 21;
3564
+ case 22:
3565
+ _context14.next = 24;
3353
3566
  return loadMoreWhereNeeded(null, fixScroll);
3354
- case 21:
3567
+ case 24:
3355
3568
  div.addEventListener('scroll', loadMoreWhereNeeded);
3356
3569
  if (options.solo) {
3357
3570
  document.body.addEventListener('scroll', loadMoreWhereNeeded);
3358
3571
  }
3359
- case 23:
3572
+ case 26:
3360
3573
  case "end":
3361
- return _context11.stop();
3574
+ return _context14.stop();
3362
3575
  }
3363
- }, _callee11);
3576
+ }, _callee14);
3364
3577
  }));
3365
3578
  return _loadInitialContent.apply(this, arguments);
3366
3579
  };
@@ -3368,16 +3581,16 @@ function _infiniteMessageArea() {
3368
3581
  return _loadInitialContent.apply(this, arguments);
3369
3582
  };
3370
3583
  _loadMoreWhereNeeded = function _loadMoreWhereNeeded3() {
3371
- _loadMoreWhereNeeded = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(event, fixScroll) {
3584
+ _loadMoreWhereNeeded = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13(event, fixScroll) {
3372
3585
  var freeze, magicZone, done, scrollBottom, scrollTop;
3373
- return _regenerator["default"].wrap(function _callee10$(_context10) {
3374
- while (1) switch (_context10.prev = _context10.next) {
3586
+ return _regenerator["default"].wrap(function _callee13$(_context13) {
3587
+ while (1) switch (_context13.prev = _context13.next) {
3375
3588
  case 0:
3376
3589
  if (!lock) {
3377
- _context10.next = 2;
3590
+ _context13.next = 2;
3378
3591
  break;
3379
3592
  }
3380
- return _context10.abrupt("return");
3593
+ return _context13.abrupt("return");
3381
3594
  case 2:
3382
3595
  lock = true;
3383
3596
  freeze = !fixScroll;
@@ -3385,36 +3598,36 @@ function _infiniteMessageArea() {
3385
3598
  // const bottom = div.scrollHeight - top - div.clientHeight
3386
3599
  case 5:
3387
3600
  if (!(div.scrollTop < magicZone && earliest.messageTable && !earliest.messageTable.initial && earliest.messageTable.extendBackwards)) {
3388
- _context10.next = 21;
3601
+ _context13.next = 21;
3389
3602
  break;
3390
3603
  }
3391
3604
  if (!(div.scrollHeight === 0)) {
3392
- _context10.next = 10;
3605
+ _context13.next = 10;
3393
3606
  break;
3394
3607
  }
3395
- // console.log(' chat/loadMoreWhereNeeded: trying later...')
3608
+ // debug.log(' chat/loadMoreWhereNeeded: trying later...')
3396
3609
  setTimeout(loadMoreWhereNeeded, 2000); // couple be less
3397
3610
  lock = false;
3398
- return _context10.abrupt("return");
3611
+ return _context13.abrupt("return");
3399
3612
  case 10:
3400
- // console.log(' chat/loadMoreWhereNeeded: Going now')
3613
+ // debug.log(' chat/loadMoreWhereNeeded: Going now')
3401
3614
  scrollBottom = div.scrollHeight - div.scrollTop;
3402
3615
  debug.log('infinite scroll: adding above: top ' + div.scrollTop);
3403
- _context10.next = 14;
3616
+ _context13.next = 14;
3404
3617
  return earliest.messageTable.extendBackwards();
3405
3618
  case 14:
3406
- done = _context10.sent;
3619
+ done = _context13.sent;
3407
3620
  if (freeze) {
3408
3621
  div.scrollTop = div.scrollHeight - scrollBottom;
3409
3622
  }
3410
3623
  if (fixScroll) fixScroll();
3411
3624
  if (!done) {
3412
- _context10.next = 19;
3625
+ _context13.next = 19;
3413
3626
  break;
3414
3627
  }
3415
- return _context10.abrupt("break", 21);
3628
+ return _context13.abrupt("break", 21);
3416
3629
  case 19:
3417
- _context10.next = 5;
3630
+ _context13.next = 5;
3418
3631
  break;
3419
3632
  case 21:
3420
3633
  if (!(options.selectedMessage &&
@@ -3424,15 +3637,15 @@ function _infiniteMessageArea() {
3424
3637
  latest.messageTable && !latest.messageTable["final"] &&
3425
3638
  // there is more data to come
3426
3639
  latest.messageTable.extendForwards)) {
3427
- _context10.next = 33;
3640
+ _context13.next = 33;
3428
3641
  break;
3429
3642
  }
3430
3643
  scrollTop = div.scrollTop;
3431
3644
  debug.log('infinite scroll: adding below: bottom: ' + (div.scrollHeight - div.scrollTop - div.clientHeight));
3432
- _context10.next = 26;
3645
+ _context13.next = 26;
3433
3646
  return latest.messageTable.extendForwards();
3434
3647
  case 26:
3435
- done = _context10.sent;
3648
+ done = _context13.sent;
3436
3649
  // then add more data on the bottom
3437
3650
  if (freeze) {
3438
3651
  div.scrollTop = scrollTop; // while adding below keep same things in view
@@ -3440,63 +3653,66 @@ function _infiniteMessageArea() {
3440
3653
 
3441
3654
  if (fixScroll) fixScroll();
3442
3655
  if (!done) {
3443
- _context10.next = 31;
3656
+ _context13.next = 31;
3444
3657
  break;
3445
3658
  }
3446
- return _context10.abrupt("break", 33);
3659
+ return _context13.abrupt("break", 33);
3447
3660
  case 31:
3448
- _context10.next = 21;
3661
+ _context13.next = 21;
3449
3662
  break;
3450
3663
  case 33:
3451
3664
  lock = false;
3452
3665
  case 34:
3453
3666
  case "end":
3454
- return _context10.stop();
3667
+ return _context13.stop();
3455
3668
  }
3456
- }, _callee10);
3669
+ }, _callee13);
3457
3670
  }));
3458
3671
  return _loadMoreWhereNeeded.apply(this, arguments);
3459
3672
  };
3460
- loadMoreWhereNeeded = function _loadMoreWhereNeeded2(_x10, _x11) {
3673
+ loadMoreWhereNeeded = function _loadMoreWhereNeeded2(_x20, _x21) {
3461
3674
  return _loadMoreWhereNeeded.apply(this, arguments);
3462
3675
  };
3463
3676
  _appendCurrentMessages = function _appendCurrentMessage2() {
3464
- _appendCurrentMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9() {
3677
+ _appendCurrentMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12() {
3465
3678
  var now, chatDocument, messageTable;
3466
- return _regenerator["default"].wrap(function _callee9$(_context9) {
3467
- while (1) switch (_context9.prev = _context9.next) {
3679
+ return _regenerator["default"].wrap(function _callee12$(_context12) {
3680
+ while (1) switch (_context12.prev = _context12.next) {
3468
3681
  case 0:
3469
3682
  now = new Date();
3470
3683
  chatDocument = dateFolder.leafDocumentFromDate(now); /// ///////////////////////////////////////////////////////////
3471
- _context9.next = 4;
3684
+ _context12.next = 4;
3472
3685
  return createMessageTable(now, true);
3473
3686
  case 4:
3474
- messageTable = _context9.sent;
3687
+ messageTable = _context12.sent;
3475
3688
  div.appendChild(messageTable);
3476
- div.refresh = /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
3477
- return _regenerator["default"].wrap(function _callee8$(_context8) {
3478
- while (1) switch (_context8.prev = _context8.next) {
3689
+ div.refresh = /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11() {
3690
+ return _regenerator["default"].wrap(function _callee11$(_context11) {
3691
+ while (1) switch (_context11.prev = _context11.next) {
3479
3692
  case 0:
3480
- _context8.next = 2;
3693
+ _context11.next = 2;
3481
3694
  return addNewChatDocumentIfNewDay(new Date());
3482
3695
  case 2:
3483
- syncMessages(chatChannel, messageTable); // @@ livemessagetable??
3484
- desktopNotification(chatChannel);
3696
+ _context11.next = 4;
3697
+ return syncMessages(chatChannel, messageTable);
3485
3698
  case 4:
3699
+ // @@ livemessagetable??
3700
+ desktopNotification(chatChannel);
3701
+ case 5:
3486
3702
  case "end":
3487
- return _context8.stop();
3703
+ return _context11.stop();
3488
3704
  }
3489
- }, _callee8);
3705
+ }, _callee11);
3490
3706
  })); // The short chat version the live update listening is done in the pane but we do it in the widget @@
3491
3707
  _solidLogic.store.updater.addDownstreamChangeListener(chatDocument, div.refresh); // Live update
3492
3708
  liveMessageTable = messageTable;
3493
3709
  latest.messageTable = liveMessageTable;
3494
- return _context9.abrupt("return", messageTable);
3710
+ return _context12.abrupt("return", messageTable);
3495
3711
  case 11:
3496
3712
  case "end":
3497
- return _context9.stop();
3713
+ return _context12.stop();
3498
3714
  }
3499
- }, _callee9);
3715
+ }, _callee12);
3500
3716
  }));
3501
3717
  return _appendCurrentMessages.apply(this, arguments);
3502
3718
  };
@@ -3504,15 +3720,15 @@ function _infiniteMessageArea() {
3504
3720
  return _appendCurrentMessages.apply(this, arguments);
3505
3721
  };
3506
3722
  _addNewChatDocumentIfNewDay = function _addNewChatDocumentIf2() {
3507
- _addNewChatDocumentIfNewDay = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7() {
3723
+ _addNewChatDocumentIfNewDay = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10() {
3508
3724
  var newChatDocument, oldChatDocument, sts;
3509
- return _regenerator["default"].wrap(function _callee7$(_context7) {
3510
- while (1) switch (_context7.prev = _context7.next) {
3725
+ return _regenerator["default"].wrap(function _callee10$(_context10) {
3726
+ while (1) switch (_context10.prev = _context10.next) {
3511
3727
  case 0:
3512
3728
  // @@ Remove listener from previous table as it is now static
3513
3729
  newChatDocument = dateFolder.leafDocumentFromDate(new Date());
3514
3730
  if (newChatDocument.sameTerm(latest.messageTable.chatDocument)) {
3515
- _context7.next = 7;
3731
+ _context10.next = 7;
3516
3732
  break;
3517
3733
  }
3518
3734
  // It is a new day
@@ -3521,7 +3737,7 @@ function _infiniteMessageArea() {
3521
3737
  delete liveMessageTable.inputRow;
3522
3738
  }
3523
3739
  oldChatDocument = latest.messageTable.chatDocument;
3524
- _context7.next = 6;
3740
+ _context10.next = 6;
3525
3741
  return appendCurrentMessages();
3526
3742
  case 6:
3527
3743
  // Adding a link in the document will ping listeners to add the new block too
@@ -3535,286 +3751,323 @@ function _infiniteMessageArea() {
3535
3751
  }
3536
3752
  case 7:
3537
3753
  case "end":
3538
- return _context7.stop();
3754
+ return _context10.stop();
3539
3755
  }
3540
- }, _callee7);
3756
+ }, _callee10);
3541
3757
  }));
3542
3758
  return _addNewChatDocumentIfNewDay.apply(this, arguments);
3543
3759
  };
3544
3760
  addNewChatDocumentIfNewDay = function _addNewChatDocumentIf() {
3545
3761
  return _addNewChatDocumentIfNewDay.apply(this, arguments);
3546
3762
  };
3547
- renderMessageTable = function _renderMessageTable(date, live) {
3548
- var scrollBackbutton;
3549
- var scrollForwardButton;
3550
-
3551
- /// ///////////////// Scroll down adding more above
3552
- function extendBackwards() {
3553
- return _extendBackwards.apply(this, arguments);
3554
- }
3555
- function _extendBackwards() {
3556
- _extendBackwards = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
3557
- var done;
3558
- return _regenerator["default"].wrap(function _callee$(_context) {
3559
- while (1) switch (_context.prev = _context.next) {
3560
- case 0:
3561
- _context.next = 2;
3562
- return insertPreviousMessages(true);
3563
- case 2:
3564
- done = _context.sent;
3565
- if (done) {
3566
- if (scrollBackbutton) {
3567
- scrollBackbutton.firstChild.setAttribute('src', _iconBase.icons.iconBase + 'noun_T-Block_1114655_000000.svg'); // T
3568
- scrollBackbutton.disabled = true;
3569
- }
3570
- messageTable.initial = true;
3571
- } else {
3572
- messageTable.extendedBack = true;
3763
+ _renderMessageTable = function _renderMessageTable3() {
3764
+ _renderMessageTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(date, live) {
3765
+ var scrollBackbutton, scrollForwardButton, extendBackwards, _extendBackwards, setScrollBackbuttonIcon, extendForwards, _extendForwards, setScrollForwardButtonIcon, scrollForwardButtonHandler, _scrollForwardButtonHandler, messageTable, chatDocument, tr, test, titleTR, scrollBackbuttonCell, dateCell, scrollForwardButtonCell, sts, _iterator2, _step2, st;
3766
+ return _regenerator["default"].wrap(function _callee9$(_context9) {
3767
+ while (1) switch (_context9.prev = _context9.next) {
3768
+ case 0:
3769
+ _scrollForwardButtonHandler = function _scrollForwardButtonH2() {
3770
+ _scrollForwardButtonHandler = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(_event) {
3771
+ return _regenerator["default"].wrap(function _callee8$(_context8) {
3772
+ while (1) switch (_context8.prev = _context8.next) {
3773
+ case 0:
3774
+ if (!messageTable.extendedForwards) {
3775
+ _context8.next = 6;
3776
+ break;
3777
+ }
3778
+ removePreviousMessages(false, messageTable);
3779
+ messageTable.extendedForwards = false;
3780
+ setScrollForwardButtonIcon();
3781
+ _context8.next = 9;
3782
+ break;
3783
+ case 6:
3784
+ _context8.next = 8;
3785
+ return extendForwards();
3786
+ case 8:
3787
+ // async
3788
+ latest.messageTable.scrollIntoView(newestFirst);
3789
+ case 9:
3790
+ case "end":
3791
+ return _context8.stop();
3792
+ }
3793
+ }, _callee8);
3794
+ }));
3795
+ return _scrollForwardButtonHandler.apply(this, arguments);
3796
+ };
3797
+ scrollForwardButtonHandler = function _scrollForwardButtonH(_x22) {
3798
+ return _scrollForwardButtonHandler.apply(this, arguments);
3799
+ };
3800
+ setScrollForwardButtonIcon = function _setScrollForwardButt() {
3801
+ if (!scrollForwardButton) return;
3802
+ var sense = messageTable.extendedForwards ? !newestFirst : newestFirst; // noun_T-Block_1114657_000000.svg
3803
+ var scrollForwardIcon = messageTable["final"] ? 'noun_T-Block_1114657_000000.svg' : getScrollForwardButtonIcon(sense);
3804
+ scrollForwardButton.firstChild.setAttribute('src', _iconBase.icons.iconBase + scrollForwardIcon);
3805
+ function getScrollForwardButtonIcon(sense) {
3806
+ return !sense ? 'noun_1369241.svg' : 'noun_1369237.svg';
3573
3807
  }
3574
- setScrollBackbuttonIcon();
3575
- return _context.abrupt("return", done);
3576
- case 6:
3577
- case "end":
3578
- return _context.stop();
3579
- }
3580
- }, _callee);
3581
- }));
3582
- return _extendBackwards.apply(this, arguments);
3583
- }
3584
- function setScrollBackbuttonIcon() {
3585
- if (!scrollBackbutton) {
3586
- return;
3587
- }
3588
- var sense = messageTable.extendedBack ? !newestFirst : newestFirst;
3589
- var scrollBackIcon = messageTable.initial ? 'noun_T-Block_1114655_000000.svg' : getScrollbackIcon(sense);
3590
- scrollBackbutton.firstChild.setAttribute('src', _iconBase.icons.iconBase + scrollBackIcon);
3591
- function getScrollbackIcon(sense) {
3592
- return sense ? 'noun_1369241.svg' : 'noun_1369237.svg';
3593
- }
3594
- }
3595
- function scrollBackbuttonHandler(_x8) {
3596
- return _scrollBackbuttonHandler.apply(this, arguments);
3597
- } /// ////////////// Scroll up adding more below
3598
- function _scrollBackbuttonHandler() {
3599
- _scrollBackbuttonHandler = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(_event) {
3600
- return _regenerator["default"].wrap(function _callee2$(_context2) {
3601
- while (1) switch (_context2.prev = _context2.next) {
3602
- case 0:
3603
- if (!messageTable.extendedBack) {
3604
- _context2.next = 6;
3605
- break;
3808
+ };
3809
+ _extendForwards = function _extendForwards3() {
3810
+ _extendForwards = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7() {
3811
+ var done;
3812
+ return _regenerator["default"].wrap(function _callee7$(_context7) {
3813
+ while (1) switch (_context7.prev = _context7.next) {
3814
+ case 0:
3815
+ _context7.next = 2;
3816
+ return insertPreviousMessages(false);
3817
+ case 2:
3818
+ done = _context7.sent;
3819
+ return _context7.abrupt("return", done);
3820
+ case 4:
3821
+ case "end":
3822
+ return _context7.stop();
3823
+ }
3824
+ }, _callee7);
3825
+ }));
3826
+ return _extendForwards.apply(this, arguments);
3827
+ };
3828
+ extendForwards = function _extendForwards2() {
3829
+ return _extendForwards.apply(this, arguments);
3830
+ };
3831
+ setScrollBackbuttonIcon = function _setScrollBackbuttonI() {
3832
+ if (!scrollBackbutton) {
3833
+ return;
3606
3834
  }
3607
- removePreviousMessages(true, messageTable);
3608
- messageTable.extendedBack = false;
3609
- setScrollBackbuttonIcon();
3610
- _context2.next = 8;
3611
- break;
3612
- case 6:
3613
- _context2.next = 8;
3614
- return extendBackwards();
3615
- case 8:
3616
- case "end":
3617
- return _context2.stop();
3618
- }
3619
- }, _callee2);
3620
- }));
3621
- return _scrollBackbuttonHandler.apply(this, arguments);
3622
- }
3623
- function extendForwards() {
3624
- return _extendForwards.apply(this, arguments);
3625
- }
3626
- function _extendForwards() {
3627
- _extendForwards = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
3628
- var done;
3629
- return _regenerator["default"].wrap(function _callee3$(_context3) {
3630
- while (1) switch (_context3.prev = _context3.next) {
3631
- case 0:
3632
- _context3.next = 2;
3633
- return insertPreviousMessages(false);
3634
- case 2:
3635
- done = _context3.sent;
3636
- if (done) {
3637
- scrollForwardButton.firstChild.setAttribute('src', _iconBase.icons.iconBase + 'noun_T-Block_1114655_000000.svg');
3638
- scrollForwardButton.disabled = true;
3639
- messageTable["final"] = true;
3835
+ var sense = messageTable.extendedBack ? !newestFirst : newestFirst;
3836
+ var scrollBackIcon = messageTable.initial ? 'noun_T-Block_1114655_000000.svg' : getScrollbackIcon(sense);
3837
+ scrollBackbutton.firstChild.setAttribute('src', _iconBase.icons.iconBase + scrollBackIcon);
3838
+ function getScrollbackIcon(sense) {
3839
+ return sense ? 'noun_1369241.svg' : 'noun_1369237.svg';
3840
+ }
3841
+ };
3842
+ _extendBackwards = function _extendBackwards3() {
3843
+ _extendBackwards = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
3844
+ var done;
3845
+ return _regenerator["default"].wrap(function _callee6$(_context6) {
3846
+ while (1) switch (_context6.prev = _context6.next) {
3847
+ case 0:
3848
+ _context6.next = 2;
3849
+ return insertPreviousMessages(true);
3850
+ case 2:
3851
+ done = _context6.sent;
3852
+ if (done) {
3853
+ if (scrollBackbutton) {
3854
+ scrollBackbutton.firstChild.setAttribute('src', _iconBase.icons.iconBase + 'noun_T-Block_1114655_000000.svg'); // T
3855
+ scrollBackbutton.disabled = true;
3856
+ }
3857
+ messageTable.initial = true;
3858
+ } else {
3859
+ messageTable.extendedBack = true;
3860
+ }
3861
+ setScrollBackbuttonIcon();
3862
+ return _context6.abrupt("return", done);
3863
+ case 6:
3864
+ case "end":
3865
+ return _context6.stop();
3866
+ }
3867
+ }, _callee6);
3868
+ }));
3869
+ return _extendBackwards.apply(this, arguments);
3870
+ };
3871
+ extendBackwards = function _extendBackwards2() {
3872
+ return _extendBackwards.apply(this, arguments);
3873
+ };
3874
+ scrollBackbutton = null; // was let
3875
+ scrollForwardButton = null; // was let
3876
+ /// ///////////////// Scroll down adding more above
3877
+ /// ////////////// Scroll up adding more below
3878
+ /// ///////////////////////
3879
+ /*
3880
+ options = options || {}
3881
+ options.authorDateOnLeft = true
3882
+ const newestFirst = options.newestFirst === '1' || options.newestFirst === true // hack for now
3883
+ const channelObject = new ChatChannel(chatChannel, options)
3884
+ const dateFolder = channelObject.dateFolder
3885
+ const div = dom.createElement('div')
3886
+ const statusArea = div.appendChild(dom.createElement('div'))
3887
+ const userContext = { dom, statusArea, div: statusArea } // logged on state, pointers to user's stuff
3888
+ */
3889
+ debug.log('Options for called message Area', options);
3890
+ messageTable = dom.createElement('table');
3891
+ messageTable.style.width = '100%'; // fill the pane div
3892
+ messageTable.extendBackwards = extendBackwards; // Make function available to scroll stuff
3893
+ messageTable.extendForwards = extendForwards; // Make function available to scroll stuff
3894
+
3895
+ messageTable.date = date;
3896
+ chatDocument = dateFolder.leafDocumentFromDate(date);
3897
+ messageTable.chatDocument = chatDocument;
3898
+ messageTable.fresh = false;
3899
+ messageTable.setAttribute('style', 'width: 100%;'); // fill that div!
3900
+ if (live) {
3901
+ messageTable["final"] = true;
3902
+ liveMessageTable = messageTable;
3903
+ latest.messageTable = messageTable;
3904
+ tr = (0, _message.renderMessageEditor)(channelObject, messageTable, userContext, options);
3905
+ if (newestFirst) {
3906
+ messageTable.insertBefore(tr, messageTable.firstChild); // If newestFirst
3640
3907
  } else {
3641
- messageTable.extendedForwards = true;
3908
+ messageTable.appendChild(tr); // not newestFirst
3642
3909
  }
3643
- setScrollForwardButtonIcon();
3644
- return _context3.abrupt("return", done);
3645
- case 6:
3646
- case "end":
3647
- return _context3.stop();
3648
- }
3649
- }, _callee3);
3650
- }));
3651
- return _extendForwards.apply(this, arguments);
3652
- }
3653
- function setScrollForwardButtonIcon() {
3654
- var sense = messageTable.extendedForwards ? !newestFirst : newestFirst; // noun_T-Block_1114657_000000.svg
3655
- var scrollForwardIcon = messageTable["final"] ? 'noun_T-Block_1114657_000000.svg' : getScrollForwardButtonIcon(sense);
3656
- scrollForwardButton.firstChild.setAttribute('src', _iconBase.icons.iconBase + scrollForwardIcon);
3657
- function getScrollForwardButtonIcon(sense) {
3658
- return !sense ? 'noun_1369241.svg' : 'noun_1369237.svg';
3659
- }
3660
- }
3661
- function scrollForwardButtonHandler(_x9) {
3662
- return _scrollForwardButtonHandler.apply(this, arguments);
3663
- } /// ///////////////////////
3664
- /*
3665
- options = options || {}
3666
- options.authorDateOnLeft = true
3667
- const newestFirst = options.newestFirst === '1' || options.newestFirst === true // hack for now
3668
- const channelObject = new ChatChannel(chatChannel, options)
3669
- const dateFolder = channelObject.dateFolder
3670
- const div = dom.createElement('div')
3671
- const statusArea = div.appendChild(dom.createElement('div'))
3672
- const userContext = { dom, statusArea, div: statusArea } // logged on state, pointers to user's stuff
3673
- */
3674
- function _scrollForwardButtonHandler() {
3675
- _scrollForwardButtonHandler = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(_event) {
3676
- return _regenerator["default"].wrap(function _callee4$(_context4) {
3677
- while (1) switch (_context4.prev = _context4.next) {
3678
- case 0:
3679
- if (!messageTable.extendedForwards) {
3680
- _context4.next = 6;
3681
- break;
3910
+
3911
+ messageTable.inputRow = tr;
3912
+ }
3913
+
3914
+ /// ///// Infinite scroll
3915
+ //
3916
+ // @@ listen for swipe past end event not just button
3917
+ test = true;
3918
+ if (test) {
3919
+ // ws options.infinite but need for non-infinite
3920
+ titleTR = dom.createElement('tr');
3921
+ scrollBackbuttonCell = titleTR.appendChild(dom.createElement('td')); // up traingles: noun_1369237.svg
3922
+ // down triangles: noun_1369241.svg
3923
+ /*
3924
+ const scrollBackIcon = newestFirst
3925
+ ? 'noun_1369241.svg'
3926
+ : 'noun_1369237.svg' // down and up arrows respoctively
3927
+ scrollBackbutton = widgets.button(
3928
+ dom,
3929
+ icons.iconBase + scrollBackIcon,
3930
+ 'Previous messages ...'
3931
+ )
3932
+ scrollBackbuttonCell.style = 'width:3em; height:3em;'
3933
+ scrollBackbutton.addEventListener('click', scrollBackbuttonHandler, false)
3934
+ messageTable.extendedBack = false
3935
+ scrollBackbuttonCell.appendChild(scrollBackbutton)
3936
+ setScrollBackbuttonIcon()
3937
+ */
3938
+ dateCell = titleTR.appendChild(dom.createElement('td'));
3939
+ dateCell.style = 'text-align: center; vertical-align: middle; color: #888; font-style: italic;';
3940
+ dateCell.textContent = widgets.shortDate(date.toISOString(), true); // no time, only date
3941
+
3942
+ // @@@@@@@@@@@ todo move this button to other end of message cell, o
3943
+ scrollForwardButtonCell = titleTR.appendChild(dom.createElement('td'));
3944
+ if (options.includeRemoveButton) {
3945
+ scrollForwardButtonCell.appendChild(widgets.cancelButton(dom, function (_e) {
3946
+ div.parentNode.removeChild(div);
3947
+ }));
3682
3948
  }
3683
- removePreviousMessages(false, messageTable);
3949
+ /*
3950
+ const scrollForwardIcon = newestFirst
3951
+ ? 'noun_1369241.svg'
3952
+ : 'noun_1369237.svg' // down and up arrows respoctively
3953
+ scrollForwardButton = widgets.button(
3954
+ dom,
3955
+ icons.iconBase + scrollForwardIcon,
3956
+ 'Later messages ...'
3957
+ )
3958
+ scrollForwardButtonCell.appendChild(scrollForwardButton)
3959
+ scrollForwardButtonCell.style = 'width:3em; height:3em;'
3960
+ scrollForwardButton.addEventListener(
3961
+ 'click',
3962
+ scrollForwardButtonHandler,
3963
+ false
3964
+ )
3965
+ messageTable.extendedForward = false
3966
+ setScrollForwardButtonIcon()
3967
+ */
3684
3968
  messageTable.extendedForwards = false;
3685
- setScrollForwardButtonIcon();
3686
- _context4.next = 9;
3969
+ if (!newestFirst) {
3970
+ // opposite end from the entry field
3971
+ messageTable.insertBefore(titleTR, messageTable.firstChild); // If not newestFirst
3972
+ } else {
3973
+ messageTable.appendChild(titleTR); // newestFirst
3974
+ }
3975
+ }
3976
+ sts = _solidLogic.store.statementsMatching(null, ns.wf('message'), null, chatDocument);
3977
+ if (!live && sts.length === 0) {
3978
+ // not todays
3979
+ // no need buttomns at the moment
3980
+ // messageTable.style.visibility = 'collapse' // Hide files with no messages
3981
+ }
3982
+ _iterator2 = _createForOfIteratorHelper(sts);
3983
+ _context9.prev = 26;
3984
+ _iterator2.s();
3985
+ case 28:
3986
+ if ((_step2 = _iterator2.n()).done) {
3987
+ _context9.next = 34;
3687
3988
  break;
3688
- case 6:
3689
- _context4.next = 8;
3690
- return extendForwards();
3691
- case 8:
3692
- // async
3693
- latest.messageTable.scrollIntoView(newestFirst);
3694
- case 9:
3695
- case "end":
3696
- return _context4.stop();
3697
- }
3698
- }, _callee4);
3699
- }));
3700
- return _scrollForwardButtonHandler.apply(this, arguments);
3701
- }
3702
- var messageTable = dom.createElement('table');
3703
- messageTable.extendBackwards = extendBackwards; // Make function available to scroll stuff
3704
- messageTable.extendForwards = extendForwards; // Make function available to scroll stuff
3705
-
3706
- messageTable.date = date;
3707
- var chatDocument = dateFolder.leafDocumentFromDate(date);
3708
- messageTable.chatDocument = chatDocument;
3709
- messageTable.fresh = false;
3710
- messageTable.setAttribute('style', 'width: 100%;'); // fill that div!
3711
- if (live) {
3712
- messageTable["final"] = true;
3713
- liveMessageTable = messageTable;
3714
- latest.messageTable = messageTable;
3715
- var tr = (0, _message.renderMessageEditor)(channelObject, messageTable, userContext, options);
3716
- if (newestFirst) {
3717
- messageTable.insertBefore(tr, messageTable.firstChild); // If newestFirst
3718
- } else {
3719
- messageTable.appendChild(tr); // not newestFirst
3720
- }
3721
-
3722
- messageTable.inputRow = tr;
3723
- }
3724
-
3725
- /// ///// Infinite scroll
3726
- //
3727
- // @@ listen for swipe past end event not just button
3728
- if (options.infinite) {
3729
- var scrollBackbuttonTR = dom.createElement('tr');
3730
- var scrollBackbuttonCell = scrollBackbuttonTR.appendChild(dom.createElement('td'));
3731
- // up traingles: noun_1369237.svg
3732
- // down triangles: noun_1369241.svg
3733
- var scrollBackIcon = newestFirst ? 'noun_1369241.svg' : 'noun_1369237.svg'; // down and up arrows respoctively
3734
- scrollBackbutton = widgets.button(dom, _iconBase.icons.iconBase + scrollBackIcon, 'Previous messages ...');
3735
- scrollBackbuttonCell.style = 'width:3em; height:3em;';
3736
- scrollBackbutton.addEventListener('click', scrollBackbuttonHandler, false);
3737
- messageTable.extendedBack = false;
3738
- scrollBackbuttonCell.appendChild(scrollBackbutton);
3739
- setScrollBackbuttonIcon();
3740
- var dateCell = scrollBackbuttonTR.appendChild(dom.createElement('td'));
3741
- dateCell.style = 'text-align: center; vertical-align: middle; color: #888; font-style: italic;';
3742
- dateCell.textContent = widgets.shortDate(date.toISOString(), true); // no time, only date
3743
-
3744
- // @@@@@@@@@@@ todo move this button to other end of message cell, o
3745
- var scrollForwardButtonCell = scrollBackbuttonTR.appendChild(dom.createElement('td'));
3746
- var scrollForwardIcon = newestFirst ? 'noun_1369241.svg' : 'noun_1369237.svg'; // down and up arrows respoctively
3747
- scrollForwardButton = widgets.button(dom, _iconBase.icons.iconBase + scrollForwardIcon, 'Later messages ...');
3748
- scrollForwardButtonCell.appendChild(scrollForwardButton);
3749
- scrollForwardButtonCell.style = 'width:3em; height:3em;';
3750
- scrollForwardButton.addEventListener('click', scrollForwardButtonHandler, false);
3751
- messageTable.extendedForward = false;
3752
- setScrollForwardButtonIcon();
3753
- messageTable.extendedForwards = false;
3754
- if (!newestFirst) {
3755
- // opposite end from the entry field
3756
- messageTable.insertBefore(scrollBackbuttonTR, messageTable.firstChild); // If not newestFirst
3757
- } else {
3758
- messageTable.appendChild(scrollBackbuttonTR); // newestFirst
3759
- }
3760
- }
3761
-
3762
- var sts = _solidLogic.store.statementsMatching(null, ns.wf('message'), null, chatDocument);
3763
- if (!live && sts.length === 0) {
3764
- // not todays
3765
- // no need buttomns at the moment
3766
- // messageTable.style.visibility = 'collapse' // Hide files with no messages
3767
- }
3768
- sts.forEach(function (st) {
3769
- addMessage(st.object, messageTable);
3770
- });
3771
- messageTable.fresh = true;
3772
-
3773
- // loadMessageTable(messageTable, chatDocument)
3774
- messageTable.fresh = false;
3775
- return messageTable;
3989
+ }
3990
+ st = _step2.value;
3991
+ _context9.next = 32;
3992
+ return addMessage(st.object, messageTable);
3993
+ case 32:
3994
+ _context9.next = 28;
3995
+ break;
3996
+ case 34:
3997
+ _context9.next = 39;
3998
+ break;
3999
+ case 36:
4000
+ _context9.prev = 36;
4001
+ _context9.t0 = _context9["catch"](26);
4002
+ _iterator2.e(_context9.t0);
4003
+ case 39:
4004
+ _context9.prev = 39;
4005
+ _iterator2.f();
4006
+ return _context9.finish(39);
4007
+ case 42:
4008
+ messageTable.fresh = true;
4009
+
4010
+ // loadMessageTable(messageTable, chatDocument)
4011
+ messageTable.fresh = false;
4012
+ return _context9.abrupt("return", messageTable);
4013
+ case 45:
4014
+ case "end":
4015
+ return _context9.stop();
4016
+ }
4017
+ }, _callee9, null, [[26, 36, 39, 42]]);
4018
+ }));
4019
+ return _renderMessageTable.apply(this, arguments);
4020
+ };
4021
+ renderMessageTable = function _renderMessageTable2(_x18, _x19) {
4022
+ return _renderMessageTable.apply(this, arguments);
3776
4023
  };
3777
4024
  _createMessageTable = function _createMessageTable3() {
3778
- _createMessageTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(date, live) {
4025
+ _createMessageTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(date, live) {
3779
4026
  var chatDocument, messageTable, statusTR;
3780
- return _regenerator["default"].wrap(function _callee6$(_context6) {
3781
- while (1) switch (_context6.prev = _context6.next) {
4027
+ return _regenerator["default"].wrap(function _callee5$(_context5) {
4028
+ while (1) switch (_context5.prev = _context5.next) {
3782
4029
  case 0:
3783
4030
  debug.log(' createMessageTable for ' + date);
3784
4031
  chatDocument = dateFolder.leafDocumentFromDate(date);
3785
- _context6.prev = 2;
3786
- _context6.next = 5;
4032
+ _context5.prev = 2;
4033
+ _context5.next = 5;
3787
4034
  return _solidLogic.store.fetcher.load(chatDocument);
3788
4035
  case 5:
3789
- _context6.next = 19;
4036
+ _context5.next = 21;
3790
4037
  break;
3791
4038
  case 7:
3792
- _context6.prev = 7;
3793
- _context6.t0 = _context6["catch"](2);
4039
+ _context5.prev = 7;
4040
+ _context5.t0 = _context5["catch"](2);
3794
4041
  messageTable = dom.createElement('table');
3795
4042
  statusTR = messageTable.appendChild(dom.createElement('tr')); // ### find status in exception
3796
- if (!(_context6.t0.response && _context6.t0.response.status && _context6.t0.response.status === 404)) {
3797
- _context6.next = 16;
4043
+ if (!(_context5.t0.response && _context5.t0.response.status && _context5.t0.response.status === 404)) {
4044
+ _context5.next = 18;
3798
4045
  break;
3799
4046
  }
3800
4047
  debug.log('Error 404 for chat file ' + chatDocument);
3801
- return _context6.abrupt("return", renderMessageTable(date, live));
3802
- case 16:
3803
- debug.log('*** Error NON 404 for chat file ' + chatDocument);
3804
- statusTR.appendChild(widgets.errorMessageBlock(dom, _context6.t0, 'pink'));
4048
+ _context5.next = 15;
4049
+ return renderMessageTable(date, live);
4050
+ case 15:
4051
+ return _context5.abrupt("return", _context5.sent);
3805
4052
  case 18:
3806
- return _context6.abrupt("return", statusTR);
3807
- case 19:
3808
- return _context6.abrupt("return", renderMessageTable(date, live));
4053
+ debug.log('*** Error NON 404 for chat file ' + chatDocument);
4054
+ statusTR.appendChild(widgets.errorMessageBlock(dom, _context5.t0, 'pink'));
3809
4055
  case 20:
4056
+ return _context5.abrupt("return", statusTR);
4057
+ case 21:
4058
+ _context5.next = 23;
4059
+ return renderMessageTable(date, live);
4060
+ case 23:
4061
+ return _context5.abrupt("return", _context5.sent);
4062
+ case 24:
3810
4063
  case "end":
3811
- return _context6.stop();
4064
+ return _context5.stop();
3812
4065
  }
3813
- }, _callee6, null, [[2, 7]]);
4066
+ }, _callee5, null, [[2, 7]]);
3814
4067
  }));
3815
4068
  return _createMessageTable.apply(this, arguments);
3816
4069
  };
3817
- createMessageTable = function _createMessageTable2(_x6, _x7) {
4070
+ createMessageTable = function _createMessageTable2(_x16, _x17) {
3818
4071
  return _createMessageTable.apply(this, arguments);
3819
4072
  };
3820
4073
  removePreviousMessages = function _removePreviousMessag(backwards, messageTable) {
@@ -3833,32 +4086,41 @@ function _infiniteMessageArea() {
3833
4086
  extr.messageTable = messageTable;
3834
4087
  };
3835
4088
  _insertPreviousMessages = function _insertPreviousMessag2() {
3836
- _insertPreviousMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(backwards) {
4089
+ _insertPreviousMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(backwards) {
3837
4090
  var extremity, date, live, todayDoc, doc, newMessageTable;
3838
- return _regenerator["default"].wrap(function _callee5$(_context5) {
3839
- while (1) switch (_context5.prev = _context5.next) {
4091
+ return _regenerator["default"].wrap(function _callee4$(_context4) {
4092
+ while (1) switch (_context4.prev = _context4.next) {
3840
4093
  case 0:
3841
4094
  extremity = backwards ? earliest : latest;
3842
4095
  date = extremity.messageTable.date; // day in mssecs
3843
- _context5.next = 4;
3844
- return dateFolder.loadPrevious(date, backwards);
4096
+ // Are we at the top of a thread?
4097
+ if (!(backwards && earliest.limit && date <= earliest.limit)) {
4098
+ _context4.next = 4;
4099
+ break;
4100
+ }
4101
+ return _context4.abrupt("return", true);
3845
4102
  case 4:
3846
- date = _context5.sent;
4103
+ debug.log(' insertPreviousMessages: loadPrevious given date ' + date);
4104
+ _context4.next = 7;
4105
+ return dateFolder.loadPrevious(date, backwards);
4106
+ case 7:
4107
+ date = _context4.sent;
3847
4108
  // backwards
4109
+ debug.log(' insertPreviousMessages: loadPrevious returns date ' + date);
3848
4110
  debug.log("insertPreviousMessages: from ".concat(backwards ? 'backwards' : 'forwards', " loadPrevious: ").concat(date));
3849
4111
  if (!(!date && !backwards && !liveMessageTable)) {
3850
- _context5.next = 9;
4112
+ _context4.next = 13;
3851
4113
  break;
3852
4114
  }
3853
- _context5.next = 9;
4115
+ _context4.next = 13;
3854
4116
  return appendCurrentMessages();
3855
- case 9:
4117
+ case 13:
3856
4118
  if (date) {
3857
- _context5.next = 11;
4119
+ _context4.next = 15;
3858
4120
  break;
3859
4121
  }
3860
- return _context5.abrupt("return", true);
3861
- case 11:
4122
+ return _context4.abrupt("return", true);
4123
+ case 15:
3862
4124
  // done
3863
4125
  live = false;
3864
4126
  if (!backwards) {
@@ -3866,10 +4128,10 @@ function _infiniteMessageArea() {
3866
4128
  doc = dateFolder.leafDocumentFromDate(date);
3867
4129
  live = doc.sameTerm(todayDoc); // Is this todays?
3868
4130
  }
3869
- _context5.next = 15;
4131
+ _context4.next = 19;
3870
4132
  return createMessageTable(date, live);
3871
- case 15:
3872
- newMessageTable = _context5.sent;
4133
+ case 19:
4134
+ newMessageTable = _context4.sent;
3873
4135
  extremity.messageTable = newMessageTable; // move pointer to earliest
3874
4136
  if (backwards ? newestFirst : !newestFirst) {
3875
4137
  // put on bottom or top
@@ -3878,64 +4140,184 @@ function _infiniteMessageArea() {
3878
4140
  // put on top as we scroll back
3879
4141
  div.insertBefore(newMessageTable, div.firstChild);
3880
4142
  }
3881
- return _context5.abrupt("return", live);
3882
- case 19:
4143
+ return _context4.abrupt("return", live);
4144
+ case 23:
3883
4145
  case "end":
3884
- return _context5.stop();
4146
+ return _context4.stop();
3885
4147
  }
3886
- }, _callee5);
4148
+ }, _callee4);
3887
4149
  }));
3888
4150
  return _insertPreviousMessages.apply(this, arguments);
3889
4151
  };
3890
- insertPreviousMessages = function _insertPreviousMessag(_x5) {
4152
+ insertPreviousMessages = function _insertPreviousMessag(_x15) {
3891
4153
  return _insertPreviousMessages.apply(this, arguments);
3892
4154
  };
3893
- addMessage = function _addMessage(message, messageTable) {
3894
- var latest = (0, _chatLogic.mostRecentVersion)(message);
3895
- // const content = store.any(latest, ns.sioc('content'))
3896
- if ((0, _chatLogic.isDeleted)(latest) && !options.showDeletedMessages) {
3897
- return; // ignore deleted messaged -- @@ could also leave a placeholder
3898
- }
3899
-
3900
- insertMessageIntoTable(channelObject, messageTable, message, messageTable.fresh, options, userContext); // fresh from elsewhere
4155
+ _addMessage = function _addMessage3() {
4156
+ _addMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(message, messageTable) {
4157
+ var thread, id;
4158
+ return _regenerator["default"].wrap(function _callee3$(_context3) {
4159
+ while (1) switch (_context3.prev = _context3.next) {
4160
+ case 0:
4161
+ if (!((0, _chatLogic.isDeleted)(message) && !options.showDeletedMessages)) {
4162
+ _context3.next = 2;
4163
+ break;
4164
+ }
4165
+ return _context3.abrupt("return");
4166
+ case 2:
4167
+ if (!(0, _chatLogic.isReplaced)(message)) {
4168
+ _context3.next = 4;
4169
+ break;
4170
+ }
4171
+ return _context3.abrupt("return");
4172
+ case 4:
4173
+ thread = _solidLogic.store.any(null, ns.sioc('has_member'), message, message.doc());
4174
+ id = _solidLogic.store.any(message, ns.sioc('id'), null, message.doc());
4175
+ if (id && !thread) {
4176
+ thread = _solidLogic.store.any(null, ns.sioc('has_member'), id, message.doc());
4177
+ }
4178
+ if (!options.thread) {
4179
+ _context3.next = 20;
4180
+ break;
4181
+ }
4182
+ if (!_solidLogic.store.holds(message, ns.sioc('has_reply'), options.thread)) {
4183
+ _context3.next = 12;
4184
+ break;
4185
+ }
4186
+ // root of thread
4187
+ debug.log(' addMessage: displaying root of thread ' + thread);
4188
+ _context3.next = 18;
4189
+ break;
4190
+ case 12:
4191
+ if (!(thread && thread.sameTerm(options.thread))) {
4192
+ _context3.next = 16;
4193
+ break;
4194
+ }
4195
+ debug.log(' addMessage: Displaying body of thread ' + message.uri.slice(-10));
4196
+ _context3.next = 18;
4197
+ break;
4198
+ case 16:
4199
+ debug.log(' addMessage: Suppress non-thread message in thread table ' + message.uri.slice(-10));
4200
+ return _context3.abrupt("return");
4201
+ case 18:
4202
+ _context3.next = 26;
4203
+ break;
4204
+ case 20:
4205
+ if (!thread) {
4206
+ _context3.next = 25;
4207
+ break;
4208
+ }
4209
+ debug.log(' addMessage: Suppress thread message in non-thread table ' + message.uri.slice(-10));
4210
+ return _context3.abrupt("return");
4211
+ case 25:
4212
+ debug.log(' addMessage: Normal non-thread message in non-thread table ' + message.uri.slice(-10));
4213
+ case 26:
4214
+ _context3.next = 28;
4215
+ return insertMessageIntoTable(channelObject, messageTable, message, messageTable.fresh, options, userContext);
4216
+ case 28:
4217
+ case "end":
4218
+ return _context3.stop();
4219
+ }
4220
+ }, _callee3);
4221
+ }));
4222
+ return _addMessage.apply(this, arguments);
3901
4223
  };
3902
- syncMessages = function _syncMessages(about, messageTable) {
3903
- var displayed = {};
3904
- var ele, ele2;
3905
- for (ele = messageTable.firstChild; ele; ele = ele.nextSibling) {
3906
- if (ele.AJAR_subject) {
3907
- displayed[ele.AJAR_subject.uri] = true;
3908
- }
3909
- }
3910
- var messages = _solidLogic.store.statementsMatching(about, ns.wf('message'), null, messageTable.chatDocument).map(function (st) {
3911
- return st.object;
3912
- });
3913
- var stored = {};
3914
- messages.forEach(function (m) {
3915
- stored[m.uri] = true;
3916
- if (!displayed[m.uri]) {
3917
- addMessage(m, messageTable);
3918
- }
3919
- });
3920
-
3921
- // eslint-disable-next-line space-in-parens
3922
- for (ele = messageTable.firstChild; ele;) {
3923
- ele2 = ele.nextSibling;
3924
- if (ele.AJAR_subject && !stored[ele.AJAR_subject.uri]) {
3925
- messageTable.removeChild(ele);
3926
- }
3927
- ele = ele2;
3928
- }
3929
- for (ele = messageTable.firstChild; ele; ele = ele.nextSibling) {
3930
- if (ele.AJAR_subject) {
3931
- // Refresh thumbs up etc
3932
- widgets.refreshTree(ele); // Things inside may have changed too
3933
- }
3934
- }
4224
+ addMessage = function _addMessage2(_x13, _x14) {
4225
+ return _addMessage.apply(this, arguments);
3935
4226
  };
3936
-
4227
+ _syncMessages = function _syncMessages3() {
4228
+ _syncMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(chatChannel, messageTable) {
4229
+ var displayed, ele, ele2, messages, stored, _iterator, _step, m;
4230
+ return _regenerator["default"].wrap(function _callee2$(_context2) {
4231
+ while (1) switch (_context2.prev = _context2.next) {
4232
+ case 0:
4233
+ displayed = {};
4234
+ for (ele = messageTable.firstChild; ele; ele = ele.nextSibling) {
4235
+ if (ele.AJAR_subject) {
4236
+ displayed[ele.AJAR_subject.uri] = true;
4237
+ }
4238
+ }
4239
+ messages = _solidLogic.store.each(chatChannel, ns.wf('message'), null, messageTable.chatDocument);
4240
+ stored = {};
4241
+ _iterator = _createForOfIteratorHelper(messages);
4242
+ _context2.prev = 5;
4243
+ _iterator.s();
4244
+ case 7:
4245
+ if ((_step = _iterator.n()).done) {
4246
+ _context2.next = 15;
4247
+ break;
4248
+ }
4249
+ m = _step.value;
4250
+ stored[m.uri] = true;
4251
+ if (displayed[m.uri]) {
4252
+ _context2.next = 13;
4253
+ break;
4254
+ }
4255
+ _context2.next = 13;
4256
+ return addMessage(m, messageTable);
4257
+ case 13:
4258
+ _context2.next = 7;
4259
+ break;
4260
+ case 15:
4261
+ _context2.next = 20;
4262
+ break;
4263
+ case 17:
4264
+ _context2.prev = 17;
4265
+ _context2.t0 = _context2["catch"](5);
4266
+ _iterator.e(_context2.t0);
4267
+ case 20:
4268
+ _context2.prev = 20;
4269
+ _iterator.f();
4270
+ return _context2.finish(20);
4271
+ case 23:
4272
+ // eslint-disable-next-line space-in-parens
4273
+ for (ele = messageTable.firstChild; ele;) {
4274
+ ele2 = ele.nextSibling;
4275
+ if (ele.AJAR_subject && !stored[ele.AJAR_subject.uri]) {
4276
+ messageTable.removeChild(ele);
4277
+ }
4278
+ ele = ele2;
4279
+ }
4280
+ for (ele = messageTable.firstChild; ele; ele = ele.nextSibling) {
4281
+ if (ele.AJAR_subject) {
4282
+ // Refresh thumbs up etc
4283
+ widgets.refreshTree(ele); // Things inside may have changed too
4284
+ }
4285
+ }
4286
+ case 25:
4287
+ case "end":
4288
+ return _context2.stop();
4289
+ }
4290
+ }, _callee2, null, [[5, 17, 20, 23]]);
4291
+ }));
4292
+ return _syncMessages.apply(this, arguments);
4293
+ };
4294
+ syncMessages = function _syncMessages2(_x11, _x12) {
4295
+ return _syncMessages.apply(this, arguments);
4296
+ }; // ///////////////////////////////////////////////////////////////////////
4297
+ // syncMessages
4298
+ // Called once per original message displayed
4299
+ /* Add a new messageTable at the top/bottom
4300
+ */
4301
+ /* Remove message tables earlier than this one
4302
+ */
4303
+ /* Load and render message table
4304
+ ** @returns DOM element generates
4305
+ */
4306
+ // renderMessageTable
4307
+ /*
4308
+ function messageCount () {
4309
+ var n = 0
4310
+ const tables = div.children
4311
+ for (let i = 0; i < tables.length; i++) {
4312
+ n += tables[i].children.length - 1
4313
+ // debug.log(' table length:' + tables[i].children.length)
4314
+ }
4315
+ return n
4316
+ }
4317
+ */
4318
+ /* Add the live message block with entry field for today
4319
+ */
3937
4320
  // Body of main function
3938
-
3939
4321
  options = options || {};
3940
4322
  options.authorDateOnLeft = false; // @@ make a user optiosn
3941
4323
  newestFirst = options.newestFirst === '1' || options.newestFirst === true; // hack for now
@@ -3949,23 +4331,33 @@ function _infiniteMessageArea() {
3949
4331
  statusArea: statusArea,
3950
4332
  div: statusArea
3951
4333
  }; // logged on state, pointers to user's stuff
3952
- // const messageTable = dom.createElement('table') // @@ check does this go in renderMessageTable
3953
4334
  earliest = {
3954
4335
  messageTable: null
3955
4336
  }; // Stuff about each end of the loaded days
3956
4337
  latest = {
3957
4338
  messageTable: null
3958
4339
  };
4340
+ if (options.thread) {
4341
+ thread = options.thread;
4342
+ threadRootMessage = _solidLogic.store.any(null, ns.sioc('has_reply'), thread, thread.doc());
4343
+ if (threadRootMessage) {
4344
+ threadTime = _solidLogic.store.any(threadRootMessage, ns.dct('created'), null, threadRootMessage.doc());
4345
+ if (threadTime) {
4346
+ earliest.limit = new Date(threadTime.value);
4347
+ debug.log(' inifinite: thread start at ' + earliest.limit);
4348
+ }
4349
+ }
4350
+ }
3959
4351
  lock = false;
3960
- _context12.next = 30;
4352
+ _context15.next = 34;
3961
4353
  return loadInitialContent();
3962
- case 30:
3963
- return _context12.abrupt("return", div);
3964
- case 31:
4354
+ case 34:
4355
+ return _context15.abrupt("return", div);
4356
+ case 35:
3965
4357
  case "end":
3966
- return _context12.stop();
4358
+ return _context15.stop();
3967
4359
  }
3968
- }, _callee12);
4360
+ }, _callee15);
3969
4361
  }));
3970
4362
  return _infiniteMessageArea.apply(this, arguments);
3971
4363
  }
@@ -3994,6 +4386,7 @@ exports.renderMessageEditor = renderMessageEditor;
3994
4386
  exports.renderMessageRow = renderMessageRow;
3995
4387
  exports.switchToEditor = switchToEditor;
3996
4388
  var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
4389
+ var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js"));
3997
4390
  var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
3998
4391
  var _infinite = __webpack_require__(/*! ./infinite */ "./lib/chat/infinite.js");
3999
4392
  var _messageTools = __webpack_require__(/*! ./messageTools */ "./lib/chat/messageTools.js");
@@ -4011,9 +4404,14 @@ var utils = _interopRequireWildcard(__webpack_require__(/*! ../utils */ "./lib/u
4011
4404
  var widgets = _interopRequireWildcard(__webpack_require__(/*! ../widgets */ "./lib/widgets/index.js"));
4012
4405
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
4013
4406
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
4014
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
4407
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4408
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4409
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
4015
4410
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4016
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
4411
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } /** UI code for individual messages: display them, edit them
4412
+ *
4413
+ * @packageDocumentation
4414
+ */ /* global $rdf */
4017
4415
  var dom = window.document;
4018
4416
  var messageBodyStyle = style.messageBodyStyle;
4019
4417
  var label = utils.label;
@@ -4090,122 +4488,232 @@ function creatorAndDateHorizontal(td1, creator, date, message) {
4090
4488
  /**
4091
4489
  * Renders a chat message, read-only mode
4092
4490
  */
4093
- function renderMessageRow(channelObject, message, fresh, options, userContext) {
4094
- var colorizeByAuthor = options.colorizeByAuthor === '1' || options.colorizeByAuthor === true;
4095
- var creator = _solidLogic.store.any(message, ns.foaf('maker'));
4096
- var date = _solidLogic.store.any(message, ns.dct('created'));
4097
- var latestVersion = (0, _chatLogic.mostRecentVersion)(message);
4098
- var content = _solidLogic.store.any(latestVersion, ns.sioc('content'));
4099
- var originalMessage = (0, _chatLogic.originalVersion)(message);
4100
- var edited = !message.sameTerm(originalMessage);
4101
- var sortDate = _solidLogic.store.the(originalMessage, ns.dct('created'), null, originalMessage.doc()); // In message
4102
-
4103
- var messageRow = dom.createElement('tr');
4104
- messageRow.AJAR_date = sortDate.value;
4105
- messageRow.AJAR_subject = message;
4106
- var td1 = dom.createElement('td');
4107
- messageRow.appendChild(td1);
4108
- if (!options.authorDateOnLeft) {
4109
- var img = dom.createElement('img');
4110
- img.setAttribute('style', 'max-height: 2.5em; max-width: 2.5em; border-radius: 0.5em; margin: auto;');
4111
- widgets.setImage(img, creator);
4112
- td1.appendChild(img);
4113
- } else {
4114
- creatorAndDate(td1, creator, widgets.shortDate(sortDate.value), message);
4115
- }
4116
- var bothDates = widgets.shortDate(sortDate.value);
4117
- if (edited) {
4118
- bothDates += ' ... ' + widgets.shortDate(date.value);
4119
- }
4120
-
4121
- // Render the content ot the message itself
4122
- var td2 = messageRow.appendChild(dom.createElement('td'));
4123
- if (!options.authorDateOnLeft) {
4124
- creatorAndDateHorizontal(td2, creator, bothDates,
4125
- // widgets.shortDate(dateString)
4126
- message);
4127
- }
4128
- var text = content.value.trim();
4129
- var isURI = /^https?:\/[^ <>]*$/i.test(text);
4130
- var para = null;
4131
- if (isURI) {
4132
- var isImage = /\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(text); // @@ Should use content-type not URI
4133
- if (isImage && options.expandImagesInline) {
4134
- var _img = elementForImageURI(text, options);
4135
- td2.appendChild(_img);
4136
- } else {
4137
- // Link but not Image
4138
- var anc = td2.appendChild(dom.createElement('a'));
4139
- para = anc.appendChild(dom.createElement('p'));
4140
- anc.href = text;
4141
- para.textContent = text;
4142
- td2.appendChild(anc);
4143
- }
4144
- } else {
4145
- // text
4146
- para = dom.createElement('p');
4147
- td2.appendChild(para);
4148
- para.textContent = text;
4149
- }
4150
- if (para) {
4151
- var bgcolor = colorizeByAuthor ? pad.lightColorHash(creator) : getBgColor(fresh);
4152
- para.setAttribute('style', messageBodyStyle + 'background-color: ' + bgcolor + ';');
4153
- }
4154
- function getBgColor(fresh) {
4155
- return fresh ? '#e8ffe8' : 'white';
4156
- }
4157
-
4158
- // Sentiment strip
4159
- var strip = (0, _messageTools.sentimentStripLinked)(message, message.doc());
4160
- if (strip.children.length) {
4161
- td2.appendChild(dom.createElement('br'));
4162
- td2.appendChild(strip);
4163
- }
4164
-
4165
- // Message tool bar button
4166
- var td3 = dom.createElement('td');
4167
- messageRow.appendChild(td3);
4168
- var toolsButton = widgets.button(dom, _iconBase.icons.iconBase + 'noun_243787.svg', '...');
4169
- td3.appendChild(toolsButton);
4170
- toolsButton.addEventListener('click', function (_event) {
4171
- if (messageRow.toolTR) {
4172
- // already got a toolbar? Toogle
4173
- messageRow.parentNode.removeChild(messageRow.toolTR);
4174
- delete messageRow.toolTR;
4175
- return;
4176
- }
4177
- var toolsTR = dom.createElement('tr');
4178
- var tools = (0, _messageTools.messageToolbar)(message, messageRow, userContext, channelObject);
4179
- tools.style = 'border: 0.05em solid #888; border-radius: 0 0 0.7em 0.7em; border-top: 0; height:3.5em; background-color: #fff;'; // @@ fix
4180
- if (messageRow.nextSibling) {
4181
- messageRow.parentElement.insertBefore(toolsTR, messageRow.nextSibling);
4182
- } else {
4183
- messageRow.parentElement.appendChild(toolsTR);
4184
- }
4185
- messageRow.toolTR = toolsTR;
4186
- toolsTR.appendChild(dom.createElement('td')); // left
4187
- var toolsTD = toolsTR.appendChild(dom.createElement('td'));
4188
- toolsTR.appendChild(dom.createElement('td')); // right
4189
- toolsTD.appendChild(tools);
4190
- });
4191
- return messageRow;
4491
+ function renderMessageRow(_x, _x2, _x3, _x4, _x5) {
4492
+ return _renderMessageRow.apply(this, arguments);
4192
4493
  }
4193
- function switchToEditor(messageRow, message, channelObject, userContext) {
4194
- var messageTable = messageRow.parentNode;
4195
- var editRow = renderMessageEditor(channelObject, messageTable, userContext, channelObject.options, (0, _chatLogic.mostRecentVersion)(message));
4196
- messageTable.insertBefore(editRow, messageRow);
4197
- editRow.originalRow = messageRow;
4198
- messageRow.style.visibility = 'hidden'; // Hide the original message. unhide if user cancels edit
4494
+ function _renderMessageRow() {
4495
+ _renderMessageRow = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(channelObject, message, fresh, options, userContext) {
4496
+ var colorizeByAuthor, creator, date, latestVersion, content, versions, replies, thread, straightReplies, _iterator2, _step2, reply, originalMessage, edited, sortDate, messageRow, td1, img, bothDates, td2, text, isURI, para, isImage, _img, anc, bgcolor, getBgColor, strip, td3, toolsButton;
4497
+ return _regenerator["default"].wrap(function _callee9$(_context10) {
4498
+ while (1) switch (_context10.prev = _context10.next) {
4499
+ case 0:
4500
+ getBgColor = function _getBgColor(fresh) {
4501
+ return fresh ? '#e8ffe8' : 'white';
4502
+ };
4503
+ colorizeByAuthor = options.colorizeByAuthor === '1' || options.colorizeByAuthor === true;
4504
+ creator = _solidLogic.store.any(message, ns.foaf('maker'));
4505
+ date = _solidLogic.store.any(message, ns.dct('created'));
4506
+ _context10.next = 6;
4507
+ return (0, _chatLogic.mostRecentVersion)(message);
4508
+ case 6:
4509
+ latestVersion = _context10.sent;
4510
+ content = _solidLogic.store.any(latestVersion, ns.sioc('content')); // const id = store.any(latestVersion, ns.sioc('id'))
4511
+ // const replies = store.each(latestVersion, ns.sioc('has_reply'))
4512
+ _context10.next = 10;
4513
+ return (0, _chatLogic.allVersions)(message);
4514
+ case 10:
4515
+ versions = _context10.sent;
4516
+ if (versions.length > 1) {
4517
+ debug.log('renderMessageRow versions: ', versions.join(', '));
4518
+ }
4519
+ // be tolerant in accepting replies on any version of a message
4520
+ replies = versions.map(function (version) {
4521
+ return _solidLogic.store.each(version, ns.sioc('has_reply'));
4522
+ }).flat();
4523
+ thread = null;
4524
+ straightReplies = [];
4525
+ _iterator2 = _createForOfIteratorHelper(replies);
4526
+ try {
4527
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
4528
+ reply = _step2.value;
4529
+ if (_solidLogic.store.holds(reply, ns.rdf('type'), ns.sioc('Thread'))) {
4530
+ thread = reply;
4531
+ debug.log('renderMessageRow: found thread: ' + thread);
4532
+ } else {
4533
+ straightReplies.push(reply);
4534
+ }
4535
+ }
4536
+ } catch (err) {
4537
+ _iterator2.e(err);
4538
+ } finally {
4539
+ _iterator2.f();
4540
+ }
4541
+ if (straightReplies.length > 1) {
4542
+ debug.log('renderMessageRow: found normal replies: ', straightReplies);
4543
+ }
4544
+ _context10.next = 20;
4545
+ return (0, _chatLogic.originalVersion)(message);
4546
+ case 20:
4547
+ originalMessage = _context10.sent;
4548
+ edited = !message.sameTerm(originalMessage); // @@ load it first @@ Or display the new data at the old date.
4549
+ // @@@ kludge!
4550
+ sortDate = _solidLogic.store.the(originalMessage, ns.dct('created'), null, originalMessage.doc()) || _solidLogic.store.the(message, ns.dct('created'), null, message.doc()); // In message
4551
+ messageRow = dom.createElement('tr');
4552
+ messageRow.AJAR_date = sortDate.value;
4553
+ messageRow.AJAR_subject = message;
4554
+ td1 = dom.createElement('td');
4555
+ messageRow.appendChild(td1);
4556
+ if (!options.authorDateOnLeft) {
4557
+ img = dom.createElement('img');
4558
+ img.setAttribute('style', 'max-height: 2.5em; max-width: 2.5em; border-radius: 0.5em; margin: auto;');
4559
+ widgets.setImage(img, creator);
4560
+ td1.appendChild(img);
4561
+ } else {
4562
+ creatorAndDate(td1, creator, widgets.shortDate(sortDate.value), message);
4563
+ }
4564
+ bothDates = widgets.shortDate(sortDate.value);
4565
+ if (edited) {
4566
+ bothDates += ' ... ' + widgets.shortDate(date.value);
4567
+ }
4568
+
4569
+ // Render the content ot the message itself
4570
+ td2 = messageRow.appendChild(dom.createElement('td'));
4571
+ if (!options.authorDateOnLeft) {
4572
+ creatorAndDateHorizontal(td2, creator, bothDates,
4573
+ // widgets.shortDate(dateString)
4574
+ message);
4575
+ }
4576
+ text = content ? content.value.trim() : '??? no content?';
4577
+ isURI = /^https?:\/[^ <>]*$/i.test(text);
4578
+ para = null;
4579
+ if (isURI) {
4580
+ isImage = /\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(text); // @@ Should use content-type not URI
4581
+ if (isImage && options.expandImagesInline) {
4582
+ _img = elementForImageURI(text, options);
4583
+ td2.appendChild(_img);
4584
+ } else {
4585
+ // Link but not Image
4586
+ anc = td2.appendChild(dom.createElement('a'));
4587
+ para = anc.appendChild(dom.createElement('p'));
4588
+ anc.href = text;
4589
+ para.textContent = text;
4590
+ td2.appendChild(anc);
4591
+ }
4592
+ } else {
4593
+ // text
4594
+ para = dom.createElement('p');
4595
+ td2.appendChild(para);
4596
+ para.textContent = text;
4597
+ }
4598
+ if (para) {
4599
+ bgcolor = colorizeByAuthor ? pad.lightColorHash(creator) : getBgColor(fresh);
4600
+ para.setAttribute('style', messageBodyStyle + 'background-color: ' + bgcolor + ';');
4601
+ }
4602
+ _context10.next = 40;
4603
+ return (0, _messageTools.sentimentStripLinked)(message, message.doc());
4604
+ case 40:
4605
+ strip = _context10.sent;
4606
+ if (strip.children.length) {
4607
+ td2.appendChild(dom.createElement('br'));
4608
+ td2.appendChild(strip);
4609
+ }
4610
+
4611
+ // Message tool bar button
4612
+ td3 = dom.createElement('td');
4613
+ messageRow.appendChild(td3);
4614
+ toolsButton = widgets.button(dom, _iconBase.icons.iconBase + 'noun_243787.svg', '...');
4615
+ td3.appendChild(toolsButton);
4616
+ toolsButton.addEventListener('click', /*#__PURE__*/function () {
4617
+ var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(_event) {
4618
+ var toolsTR, tools, toolsTD;
4619
+ return _regenerator["default"].wrap(function _callee8$(_context9) {
4620
+ while (1) switch (_context9.prev = _context9.next) {
4621
+ case 0:
4622
+ if (!messageRow.toolTR) {
4623
+ _context9.next = 4;
4624
+ break;
4625
+ }
4626
+ // already got a toolbar? Toogle
4627
+ messageRow.parentNode.removeChild(messageRow.toolTR);
4628
+ delete messageRow.toolTR;
4629
+ return _context9.abrupt("return");
4630
+ case 4:
4631
+ toolsTR = dom.createElement('tr');
4632
+ _context9.next = 7;
4633
+ return (0, _messageTools.messageToolbar)(message, messageRow, _objectSpread(_objectSpread({}, userContext), {}, {
4634
+ chatOptions: options
4635
+ }), channelObject);
4636
+ case 7:
4637
+ tools = _context9.sent;
4638
+ tools.style = 'border: 0.05em solid #888; border-radius: 0 0 0.7em 0.7em; border-top: 0; height:3.5em; background-color: #fff;'; // @@ fix
4639
+ if (messageRow.nextSibling) {
4640
+ messageRow.parentElement.insertBefore(toolsTR, messageRow.nextSibling);
4641
+ } else {
4642
+ messageRow.parentElement.appendChild(toolsTR);
4643
+ }
4644
+ messageRow.toolTR = toolsTR;
4645
+ toolsTR.appendChild(dom.createElement('td')); // left
4646
+ toolsTD = toolsTR.appendChild(dom.createElement('td'));
4647
+ toolsTR.appendChild(dom.createElement('td')); // right
4648
+ toolsTD.appendChild(tools);
4649
+ case 15:
4650
+ case "end":
4651
+ return _context9.stop();
4652
+ }
4653
+ }, _callee8);
4654
+ }));
4655
+ return function (_x20) {
4656
+ return _ref4.apply(this, arguments);
4657
+ };
4658
+ }());
4659
+ if (thread && options.showThread) {
4660
+ debug.log(' message has thread ' + thread);
4661
+ td3.appendChild(widgets.button(dom, _iconBase.icons.iconBase + 'noun_1180164.svg',
4662
+ // right arrow .. @@ think of stg better
4663
+ 'see thread', function (_e) {
4664
+ debug.log('@@@@ Calling showThread thread ' + thread);
4665
+ options.showThread(thread, options);
4666
+ }));
4667
+ }
4668
+ return _context10.abrupt("return", messageRow);
4669
+ case 49:
4670
+ case "end":
4671
+ return _context10.stop();
4672
+ }
4673
+ }, _callee9);
4674
+ }));
4675
+ return _renderMessageRow.apply(this, arguments);
4676
+ }
4677
+ function switchToEditor(_x6, _x7, _x8, _x9) {
4678
+ return _switchToEditor.apply(this, arguments);
4199
4679
  }
4200
4680
  /* Control for a new message -- or editing an old message ***************
4201
4681
  *
4202
4682
  */
4683
+ function _switchToEditor() {
4684
+ _switchToEditor = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(messageRow, message, channelObject, userContext) {
4685
+ var messageTable, editRow;
4686
+ return _regenerator["default"].wrap(function _callee10$(_context11) {
4687
+ while (1) switch (_context11.prev = _context11.next) {
4688
+ case 0:
4689
+ messageTable = messageRow.parentNode;
4690
+ _context11.t0 = renderMessageEditor;
4691
+ _context11.t1 = channelObject;
4692
+ _context11.t2 = messageTable;
4693
+ _context11.t3 = userContext;
4694
+ _context11.t4 = channelObject.options;
4695
+ _context11.next = 8;
4696
+ return (0, _chatLogic.mostRecentVersion)(message);
4697
+ case 8:
4698
+ _context11.t5 = _context11.sent;
4699
+ editRow = (0, _context11.t0)(_context11.t1, _context11.t2, _context11.t3, _context11.t4, _context11.t5);
4700
+ messageTable.insertBefore(editRow, messageRow);
4701
+ editRow.originalRow = messageRow;
4702
+ messageRow.style.visibility = 'hidden'; // Hide the original message. unhide if user cancels edit
4703
+ case 13:
4704
+ case "end":
4705
+ return _context11.stop();
4706
+ }
4707
+ }, _callee10);
4708
+ }));
4709
+ return _switchToEditor.apply(this, arguments);
4710
+ }
4203
4711
  function renderMessageEditor(channelObject, messageTable, userContext, options, originalMessage) {
4204
4712
  function revertEditing(messageEditor) {
4205
4713
  messageEditor.originalRow.style.visibility = 'visible'; // restore read-only version
4206
4714
  messageEditor.parentNode.removeChild(messageEditor);
4207
4715
  }
4208
- function handleFieldInput(_x) {
4716
+ function handleFieldInput(_x10) {
4209
4717
  return _handleFieldInput.apply(this, arguments);
4210
4718
  }
4211
4719
  function _handleFieldInput() {
@@ -4223,72 +4731,86 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
4223
4731
  }));
4224
4732
  return _handleFieldInput.apply(this, arguments);
4225
4733
  }
4226
- function sendMessage(_x2, _x3) {
4734
+ function sendMessage(_x11, _x12) {
4227
4735
  return _sendMessage.apply(this, arguments);
4228
4736
  } // sendMessage
4229
4737
  // DRAG AND DROP
4230
4738
  function _sendMessage() {
4231
- _sendMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(text, fromMainField) {
4232
- var sendComplete, message, statusArea;
4233
- return _regenerator["default"].wrap(function _callee6$(_context7) {
4234
- while (1) switch (_context7.prev = _context7.next) {
4739
+ _sendMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(text, fromMainField) {
4740
+ var sendComplete, _sendComplete, message, statusArea;
4741
+ return _regenerator["default"].wrap(function _callee7$(_context8) {
4742
+ while (1) switch (_context8.prev = _context8.next) {
4235
4743
  case 0:
4236
- sendComplete = function _sendComplete(message, _text2) {
4237
- // const dateStamp = store.any(message, ns.dct('created'), null, message.doc())
4238
- // const content = $rdf.literal(text2)
4239
- (0, _infinite.insertMessageIntoTable)(channelObject, messageTable, message, false, options, userContext); // not green
4240
-
4241
- if (originalMessage) {
4242
- // editing another message
4243
- var oldRow = messageEditor.originalRow;
4244
- // oldRow.style.display = '' // restore read-only version, re-attack
4245
- if (oldRow.parentNode) {
4246
- oldRow.parentNode.removeChild(oldRow); // No longer needed old version
4247
- } else {
4248
- debug.warn('No parentNode on old message ' + oldRow.textContent);
4249
- oldRow.style.backgroundColor = '#fee';
4250
- oldRow.style.visibility = 'hidden'; // @@ FIX THIS AND REMOVE FROM DOM INSTEAD
4251
- }
4744
+ _sendComplete = function _sendComplete3() {
4745
+ _sendComplete = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(message, _text2) {
4746
+ var oldRow;
4747
+ return _regenerator["default"].wrap(function _callee6$(_context7) {
4748
+ while (1) switch (_context7.prev = _context7.next) {
4749
+ case 0:
4750
+ _context7.next = 2;
4751
+ return (0, _infinite.insertMessageIntoTable)(channelObject, messageTable, message, false, options, userContext);
4752
+ case 2:
4753
+ // not green
4252
4754
 
4253
- messageEditor.parentNode.removeChild(messageEditor); // no longer need editor
4254
- } else {
4255
- if (fromMainField) {
4256
- field.value = ''; // clear from out for reuse
4257
- field.setAttribute('style', messageBodyStyle);
4258
- field.disabled = false;
4259
- field.scrollIntoView(options.newestFirst); // allign bottom (top)
4260
- field.focus(); // Start typing next line immediately
4261
- field.select();
4262
- }
4263
- }
4264
- // await channelObject.div.refresh() // Add new day if nec @@ add back
4265
- };
4755
+ if (originalMessage) {
4756
+ // editing another message
4757
+ oldRow = messageEditor.originalRow; // oldRow.style.display = '' // restore read-only version, re-attack
4758
+ if (oldRow.parentNode) {
4759
+ oldRow.parentNode.removeChild(oldRow); // No longer needed old version
4760
+ } else {
4761
+ debug.warn('No parentNode on old message ' + oldRow.textContent);
4762
+ oldRow.style.backgroundColor = '#fee';
4763
+ oldRow.style.visibility = 'hidden'; // @@ FIX THIS AND REMOVE FROM DOM INSTEAD
4764
+ }
4266
4765
 
4267
- // const me = authn.currentUser() // Must be logged on or wuld have got login button
4766
+ messageEditor.parentNode.removeChild(messageEditor); // no longer need editor
4767
+ } else {
4768
+ if (fromMainField) {
4769
+ field.value = ''; // clear from out for reuse
4770
+ field.setAttribute('style', messageBodyStyle);
4771
+ field.disabled = false;
4772
+ field.scrollIntoView(options.newestFirst); // allign bottom (top)
4773
+ field.focus(); // Start typing next line immediately
4774
+ field.select();
4775
+ }
4776
+ }
4777
+ // await channelObject.div.refresh() // Add new day if nec @@ add back
4778
+ case 3:
4779
+ case "end":
4780
+ return _context7.stop();
4781
+ }
4782
+ }, _callee6);
4783
+ }));
4784
+ return _sendComplete.apply(this, arguments);
4785
+ };
4786
+ sendComplete = function _sendComplete2(_x18, _x19) {
4787
+ return _sendComplete.apply(this, arguments);
4788
+ }; // const me = authn.currentUser() // Must be logged on or wuld have got login button
4268
4789
  if (fromMainField) {
4269
4790
  field.setAttribute('style', messageBodyStyle + 'color: #bbb;'); // pendingedit
4270
4791
  field.disabled = true;
4271
4792
  }
4272
- _context7.prev = 2;
4273
- _context7.next = 5;
4274
- return channelObject.updateMessage(text, originalMessage);
4275
- case 5:
4276
- message = _context7.sent;
4277
- _context7.next = 13;
4793
+ _context8.prev = 3;
4794
+ _context8.next = 6;
4795
+ return channelObject.updateMessage(text, originalMessage, null, options.thread);
4796
+ case 6:
4797
+ message = _context8.sent;
4798
+ _context8.next = 14;
4278
4799
  break;
4279
- case 8:
4280
- _context7.prev = 8;
4281
- _context7.t0 = _context7["catch"](2);
4800
+ case 9:
4801
+ _context8.prev = 9;
4802
+ _context8.t0 = _context8["catch"](3);
4282
4803
  statusArea = userContext.statusArea || messageEditor;
4283
- statusArea.appendChild(widgets.errorMessageBlock(dom, 'Error writing message: ' + _context7.t0));
4284
- return _context7.abrupt("return");
4285
- case 13:
4286
- sendComplete(message, text);
4804
+ statusArea.appendChild(widgets.errorMessageBlock(dom, 'Error writing message: ' + _context8.t0));
4805
+ return _context8.abrupt("return");
4287
4806
  case 14:
4807
+ _context8.next = 16;
4808
+ return sendComplete(message, text);
4809
+ case 16:
4288
4810
  case "end":
4289
- return _context7.stop();
4811
+ return _context8.stop();
4290
4812
  }
4291
- }, _callee6, null, [[2, 8]]);
4813
+ }, _callee7, null, [[3, 9]]);
4292
4814
  }));
4293
4815
  return _sendMessage.apply(this, arguments);
4294
4816
  }
@@ -4307,7 +4829,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
4307
4829
  }
4308
4830
  }, _callee);
4309
4831
  }));
4310
- return function (_x4, _x5) {
4832
+ return function (_x13, _x14) {
4311
4833
  return _ref.apply(this, arguments);
4312
4834
  };
4313
4835
  }());
@@ -4351,7 +4873,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
4351
4873
  }
4352
4874
  }, _callee2, null, [[1, 11, 14, 17]]);
4353
4875
  }));
4354
- return function droppedURIHandler(_x6) {
4876
+ return function droppedURIHandler(_x15) {
4355
4877
  return _ref2.apply(this, arguments);
4356
4878
  };
4357
4879
  }();
@@ -4362,7 +4884,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
4362
4884
  imageDoc = $rdf.sym(chatDocument.dir().uri + 'Image_' + Date.now() + '.png');
4363
4885
  return imageDoc;
4364
4886
  }
4365
- function tookPicture(_x7) {
4887
+ function tookPicture(_x16) {
4366
4888
  return _tookPicture.apply(this, arguments);
4367
4889
  } // Body of turnOnInput
4368
4890
  function _tookPicture() {
@@ -4439,7 +4961,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
4439
4961
  }
4440
4962
  }, _callee3);
4441
4963
  }));
4442
- return function (_x8) {
4964
+ return function (_x17) {
4443
4965
  return _ref3.apply(this, arguments);
4444
4966
  };
4445
4967
  }(), false);
@@ -4501,7 +5023,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
4501
5023
  turnOnInput();
4502
5024
  Object.assign(context, userContext);
4503
5025
  (0, _bookmarks.findBookmarkDocument)(context).then(function (_context) {
4504
- // console.log('Bookmark file: ' + context.bookmarkDocument)
5026
+ // debug.log('Bookmark file: ' + context.bookmarkDocument)
4505
5027
  });
4506
5028
  });
4507
5029
  return messageEditor;
@@ -4524,12 +5046,15 @@ var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_m
4524
5046
  Object.defineProperty(exports, "__esModule", ({
4525
5047
  value: true
4526
5048
  }));
5049
+ exports.ActionClassFromEmoji = ActionClassFromEmoji;
5050
+ exports.emojiFromAction = emojiFromAction;
5051
+ exports.emojiFromActionClass = emojiFromActionClass;
4527
5052
  exports.messageToolbar = messageToolbar;
4528
5053
  exports.sentimentStrip = sentimentStrip;
4529
5054
  exports.sentimentStripLinked = sentimentStripLinked;
4530
5055
  var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
4531
- var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
4532
5056
  var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "./node_modules/@babel/runtime/helpers/slicedToArray.js"));
5057
+ var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
4533
5058
  var debug = _interopRequireWildcard(__webpack_require__(/*! ../debug */ "./lib/debug.js"));
4534
5059
  var _iconBase = __webpack_require__(/*! ../iconBase */ "./lib/iconBase.js");
4535
5060
  var ns = _interopRequireWildcard(__webpack_require__(/*! ../ns */ "./lib/ns.js"));
@@ -4557,7 +5082,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
4557
5082
  // import * as pad from '../pad'
4558
5083
  // pull in first avoid cross-refs
4559
5084
  // import * as style from '../style'
4560
-
4561
5085
  var dom = window.document;
4562
5086
 
4563
5087
  // THE UNUSED ICONS are here as reminders for possible future functionality
@@ -4570,30 +5094,46 @@ var PENCIL_ICON = 'noun_253504.svg'; // edit a message
4570
5094
  // const SPANNER_ICON = 'noun_344563.svg' -> settings
4571
5095
  var THUMBS_UP_ICON = 'noun_1384132.svg';
4572
5096
  var THUMBS_DOWN_ICON = 'noun_1384135.svg';
5097
+ var REPLY_ICON = 'noun-reply-5506924.svg';
4573
5098
  /**
4574
5099
  * Emoji in Unicode
4575
5100
  */
4576
- var emoji = {};
4577
- emoji[ns.schema('AgreeAction')] = '👍';
4578
- emoji[ns.schema('DisagreeAction')] = '👎';
4579
- emoji[ns.schema('EndorseAction')] = '⭐️';
4580
- emoji[ns.schema('LikeAction')] = '❤️';
5101
+ var emojiMap = {};
5102
+ emojiMap[ns.schema('AgreeAction')] = '👍';
5103
+ emojiMap[ns.schema('DisagreeAction')] = '👎';
5104
+ emojiMap[ns.schema('EndorseAction')] = '⭐️';
5105
+ emojiMap[ns.schema('LikeAction')] = '❤️';
5106
+ function emojiFromActionClass(action) {
5107
+ return emojiMap[action] || null;
5108
+ }
5109
+ function ActionClassFromEmoji(emoji) {
5110
+ for (var a in emojiMap) {
5111
+ if (emojiMap[a] === emoji) {
5112
+ return rdf.sym(a.slice(1, -1)); // remove < >
5113
+ }
5114
+ }
5115
+
5116
+ return null;
5117
+ }
5118
+
5119
+ // Allow the action to give its own emoji as content,
5120
+ // or get the emoji from the class of action.
5121
+ function emojiFromAction(action) {
5122
+ var content = _solidLogic.store.any(action, ns.sioc('content'), null, action.doc());
5123
+ if (content) return content;
5124
+ var klass = _solidLogic.store.any(action, ns.rdf('type'), null, action.doc());
5125
+ if (klass) {
5126
+ var em = emojiFromActionClass(klass);
5127
+ if (em) return em;
5128
+ }
5129
+ return '⬜️';
5130
+ }
4581
5131
 
4582
5132
  /**
4583
5133
  * Create strip of sentiments expressed
4584
5134
  */
4585
- function sentimentStrip(target, doc) {
4586
- // alain seems not used
4587
- var latest = (0, _chatLogic.mostRecentVersion)(target);
4588
- var actions = _solidLogic.store.holds(latest, ns.schema('dateDeleted').value, null, latest.doc()) ? _solidLogic.store.each(null, ns.schema('target'), target, doc) : [];
4589
- var sentiments = actions.map(function (a) {
4590
- return _solidLogic.store.any(a, ns.rdf('type'), null, doc);
4591
- });
4592
- sentiments.sort();
4593
- var strings = sentiments.map(function (x) {
4594
- return emoji[x] || '';
4595
- });
4596
- return dom.createTextNode(strings.join(' '));
5135
+ function sentimentStrip(_x, _x2) {
5136
+ return _sentimentStrip.apply(this, arguments);
4597
5137
  }
4598
5138
  /**
4599
5139
  * Create strip of sentiments expressed, with hyperlinks
@@ -4601,276 +5141,444 @@ function sentimentStrip(target, doc) {
4601
5141
  * @param target {NamedNode} - The thing about which they are expressed
4602
5142
  * @param doc {NamedNode} - The document in which they are expressed
4603
5143
  */
4604
- function sentimentStripLinked(target, doc) {
4605
- var strip = dom.createElement('span');
4606
- function refresh() {
4607
- strip.innerHTML = '';
4608
- var actions = (0, _chatLogic.mostRecentVersion)(target).uri !== ns.schema('dateDeleted').uri ? _solidLogic.store.each(null, ns.schema('target'), target, doc) : [];
4609
- var sentiments = actions.map(function (a) {
4610
- return [_solidLogic.store.any(a, ns.rdf('type'), null, doc), _solidLogic.store.any(a, ns.schema('agent'), null, doc)];
4611
- });
4612
- sentiments.sort();
4613
- sentiments.forEach(function (ss) {
4614
- var _ss = (0, _slicedToArray2["default"])(ss, 2),
4615
- theClass = _ss[0],
4616
- agent = _ss[1];
4617
- var res;
4618
- if (agent) {
4619
- res = dom.createElement('a');
4620
- res.setAttribute('href', agent.uri);
4621
- } else {
4622
- res = dom.createTextNode('');
5144
+ function _sentimentStrip() {
5145
+ _sentimentStrip = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(target, doc) {
5146
+ var versions, actions, strings;
5147
+ return _regenerator["default"].wrap(function _callee$(_context) {
5148
+ while (1) switch (_context.prev = _context.next) {
5149
+ case 0:
5150
+ _context.next = 2;
5151
+ return (0, _chatLogic.allVersions)(target);
5152
+ case 2:
5153
+ versions = _context.sent;
5154
+ debug.log('sentimentStrip Versions for ' + target, versions);
5155
+ actions = versions.map(function (version) {
5156
+ return _solidLogic.store.each(null, ns.schema('target'), version, doc);
5157
+ }).flat();
5158
+ debug.log('sentimentStrip: Actions for ' + target, actions);
5159
+ strings = actions.map(function (action) {
5160
+ return emojiFromAction(action) || '';
5161
+ });
5162
+ return _context.abrupt("return", dom.createTextNode(strings.join(' ')));
5163
+ case 8:
5164
+ case "end":
5165
+ return _context.stop();
5166
+ }
5167
+ }, _callee);
5168
+ }));
5169
+ return _sentimentStrip.apply(this, arguments);
5170
+ }
5171
+ function sentimentStripLinked(_x3, _x4) {
5172
+ return _sentimentStripLinked.apply(this, arguments);
5173
+ }
5174
+ /**
5175
+ * Creates a message toolbar component
5176
+ */
5177
+ function _sentimentStripLinked() {
5178
+ _sentimentStripLinked = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(target, doc) {
5179
+ var strip, refresh, _refresh;
5180
+ return _regenerator["default"].wrap(function _callee3$(_context3) {
5181
+ while (1) switch (_context3.prev = _context3.next) {
5182
+ case 0:
5183
+ _refresh = function _refresh3() {
5184
+ _refresh = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
5185
+ var versions, actions, sentiments;
5186
+ return _regenerator["default"].wrap(function _callee2$(_context2) {
5187
+ while (1) switch (_context2.prev = _context2.next) {
5188
+ case 0:
5189
+ strip.innerHTML = '';
5190
+ if (!(0, _chatLogic.isDeleted)(target)) {
5191
+ _context2.next = 3;
5192
+ break;
5193
+ }
5194
+ return _context2.abrupt("return", strip);
5195
+ case 3:
5196
+ _context2.next = 5;
5197
+ return (0, _chatLogic.allVersions)(target);
5198
+ case 5:
5199
+ versions = _context2.sent;
5200
+ debug.log('sentimentStripLinked: Versions for ' + target, versions);
5201
+ actions = versions.map(function (version) {
5202
+ return _solidLogic.store.each(null, ns.schema('target'), version, doc);
5203
+ }).flat();
5204
+ debug.log('sentimentStripLinked: Actions for ' + target, actions);
5205
+ if (!(actions.length === 0)) {
5206
+ _context2.next = 11;
5207
+ break;
5208
+ }
5209
+ return _context2.abrupt("return", strip);
5210
+ case 11:
5211
+ sentiments = actions.map(function (a) {
5212
+ return [_solidLogic.store.any(a, ns.rdf('type'), null, doc), _solidLogic.store.any(a, ns.sioc('content'), null, doc), _solidLogic.store.any(a, ns.schema('agent'), null, doc)];
5213
+ });
5214
+ debug.log(' Actions sentiments ', sentiments);
5215
+ sentiments.sort();
5216
+ sentiments.forEach(function (ss) {
5217
+ var _ss = (0, _slicedToArray2["default"])(ss, 3),
5218
+ theClass = _ss[0],
5219
+ content = _ss[1],
5220
+ agent = _ss[2];
5221
+ var res;
5222
+ if (agent) {
5223
+ res = dom.createElement('a');
5224
+ res.setAttribute('href', agent.uri);
5225
+ } else {
5226
+ res = dom.createTextNode('');
5227
+ }
5228
+ res.textContent = content || emojiMap[theClass] || '⬜️';
5229
+ strip.appendChild(res);
5230
+ });
5231
+ debug.log(' Actions strip ', strip);
5232
+ case 16:
5233
+ case "end":
5234
+ return _context2.stop();
5235
+ }
5236
+ }, _callee2);
5237
+ }));
5238
+ return _refresh.apply(this, arguments);
5239
+ };
5240
+ refresh = function _refresh2() {
5241
+ return _refresh.apply(this, arguments);
5242
+ };
5243
+ strip = dom.createElement('span');
5244
+ refresh().then(debug.log('sentimentStripLinked: sentimentStripLinked async refreshed'));
5245
+ strip.refresh = refresh;
5246
+ return _context3.abrupt("return", strip);
5247
+ case 6:
5248
+ case "end":
5249
+ return _context3.stop();
4623
5250
  }
4624
- res.textContent = emoji[theClass] || '*';
4625
- strip.appendChild(res);
4626
- });
4627
- }
4628
- refresh();
4629
- strip.refresh = refresh;
4630
- return strip;
5251
+ }, _callee3);
5252
+ }));
5253
+ return _sentimentStripLinked.apply(this, arguments);
4631
5254
  }
4632
- /**
4633
- * Creates a message toolbar component
4634
- */
4635
- function messageToolbar(message, messageRow, userContext, channelObject) {
4636
- function deleteMessage() {
4637
- return _deleteMessage.apply(this, arguments);
4638
- }
4639
- function _deleteMessage() {
4640
- _deleteMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
4641
- var author, msg, area;
4642
- return _regenerator["default"].wrap(function _callee2$(_context2) {
4643
- while (1) switch (_context2.prev = _context2.next) {
4644
- case 0:
4645
- author = _solidLogic.store.any(message, ns.foaf('maker'));
4646
- if (me) {
4647
- _context2.next = 5;
4648
- break;
5255
+ function messageToolbar(_x5, _x6, _x7, _x8) {
5256
+ return _messageToolbar.apply(this, arguments);
5257
+ }
5258
+ function _messageToolbar() {
5259
+ _messageToolbar = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(message, messageRow, userContext, channelObject) {
5260
+ var deleteMessage, _deleteMessage, editMessage, _editMessage, replyInThread, _replyInThread, div, closeToolbar, deleteThingThen, _deleteThingThen, me, sentimentButton, context1, cancelButton;
5261
+ return _regenerator["default"].wrap(function _callee10$(_context10) {
5262
+ while (1) switch (_context10.prev = _context10.next) {
5263
+ case 0:
5264
+ sentimentButton = function _sentimentButton(context, target, icon, actionClass, doc, mutuallyExclusive) {
5265
+ function setColor() {
5266
+ button.style.backgroundColor = action ? 'yellow' : 'white';
4649
5267
  }
4650
- alert('You can\'t delete the message, you are not logged in.');
4651
- _context2.next = 22;
4652
- break;
4653
- case 5:
4654
- if (!me.sameTerm(author)) {
4655
- _context2.next = 21;
4656
- break;
5268
+ var button = widgets.button(dom, icon, utils.label(actionClass), /*#__PURE__*/function () {
5269
+ var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(_event) {
5270
+ var insertMe, dirty, i, a;
5271
+ return _regenerator["default"].wrap(function _callee4$(_context4) {
5272
+ while (1) switch (_context4.prev = _context4.next) {
5273
+ case 0:
5274
+ if (!action) {
5275
+ _context4.next = 7;
5276
+ break;
5277
+ }
5278
+ _context4.next = 3;
5279
+ return deleteThingThen(action);
5280
+ case 3:
5281
+ action = null;
5282
+ setColor();
5283
+ _context4.next = 25;
5284
+ break;
5285
+ case 7:
5286
+ // no action
5287
+ action = widgets.newThing(doc);
5288
+ insertMe = [rdf.st(action, ns.schema('agent'), context.me, doc), rdf.st(action, ns.rdf('type'), actionClass, doc), rdf.st(action, ns.schema('target'), target, doc)];
5289
+ _context4.next = 11;
5290
+ return _solidLogic.store.updater.update([], insertMe);
5291
+ case 11:
5292
+ setColor();
5293
+ if (!mutuallyExclusive) {
5294
+ _context4.next = 25;
5295
+ break;
5296
+ }
5297
+ // Delete incompative sentiments
5298
+ dirty = false;
5299
+ i = 0;
5300
+ case 15:
5301
+ if (!(i < mutuallyExclusive.length)) {
5302
+ _context4.next = 24;
5303
+ break;
5304
+ }
5305
+ a = existingAction(mutuallyExclusive[i]);
5306
+ if (!a) {
5307
+ _context4.next = 21;
5308
+ break;
5309
+ }
5310
+ _context4.next = 20;
5311
+ return deleteThingThen(a);
5312
+ case 20:
5313
+ // but how refresh? refreshTree the parent?
5314
+ dirty = true;
5315
+ case 21:
5316
+ i++;
5317
+ _context4.next = 15;
5318
+ break;
5319
+ case 24:
5320
+ if (dirty) {
5321
+ // widgets.refreshTree(button.parentNode) // requires them all to be immediate siblings
5322
+ widgets.refreshTree(messageRow); // requires them all to be immediate siblings
5323
+ }
5324
+ case 25:
5325
+ case "end":
5326
+ return _context4.stop();
5327
+ }
5328
+ }, _callee4);
5329
+ }));
5330
+ return function (_x11) {
5331
+ return _ref.apply(this, arguments);
5332
+ };
5333
+ }());
5334
+ function existingAction(actionClass) {
5335
+ var actions = _solidLogic.store.each(null, ns.schema('agent'), context.me, doc).filter(function (x) {
5336
+ return _solidLogic.store.holds(x, ns.rdf('type'), actionClass, doc);
5337
+ }).filter(function (x) {
5338
+ return _solidLogic.store.holds(x, ns.schema('target'), target, doc);
5339
+ });
5340
+ return actions.length ? actions[0] : null;
4657
5341
  }
4658
- _context2.prev = 6;
4659
- _context2.next = 9;
4660
- return channelObject.deleteMessage(message);
4661
- case 9:
4662
- _context2.next = 18;
4663
- break;
4664
- case 11:
4665
- _context2.prev = 11;
4666
- _context2.t0 = _context2["catch"](6);
4667
- msg = 'Error deleting messaage ' + _context2.t0;
4668
- debug.warn(msg);
4669
- alert(msg);
4670
- area = userContext.statusArea || messageRow.parentNode;
4671
- area.appendChild(widgets.errorMessageBlock(dom, msg));
4672
- case 18:
4673
- messageRow.parentNode.removeChild(messageRow);
4674
- _context2.next = 22;
4675
- break;
4676
- case 21:
4677
- alert('You can\'t delete the message, you are not logged in as the author, ' + author);
4678
- case 22:
4679
- closeToolbar();
4680
- case 23:
4681
- case "end":
4682
- return _context2.stop();
4683
- }
4684
- }, _callee2, null, [[6, 11]]);
4685
- }));
4686
- return _deleteMessage.apply(this, arguments);
4687
- }
4688
- function editMessage(_x) {
4689
- return _editMessage.apply(this, arguments);
4690
- } // alain TODO allow chat owner to fully delete message + sentiments and replacing messages
4691
- function _editMessage() {
4692
- _editMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(messageRow) {
4693
- return _regenerator["default"].wrap(function _callee3$(_context3) {
4694
- while (1) switch (_context3.prev = _context3.next) {
4695
- case 0:
4696
- if (me.value === _solidLogic.store.any(message, ns.foaf('maker')).value) {
4697
- closeToolbar(); // edit is a one-off action
4698
- (0, _message.switchToEditor)(messageRow, message, channelObject, userContext);
5342
+ function refresh() {
5343
+ action = existingAction(actionClass);
5344
+ setColor();
4699
5345
  }
4700
- case 1:
4701
- case "end":
4702
- return _context3.stop();
4703
- }
4704
- }, _callee3);
4705
- }));
4706
- return _editMessage.apply(this, arguments);
4707
- }
4708
- var div = dom.createElement('div');
4709
- // is message deleted ?
4710
- if ((0, _chatLogic.mostRecentVersion)(message).value === ns.schema('dateDeleted').value) return div;
4711
- function closeToolbar() {
4712
- div.parentElement.parentElement.removeChild(div.parentElement); // remive the TR
4713
- }
4714
- function deleteThingThen(_x2) {
4715
- return _deleteThingThen.apply(this, arguments);
4716
- } // Things only the original author can do
4717
- function _deleteThingThen() {
4718
- _deleteThingThen = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(x) {
4719
- return _regenerator["default"].wrap(function _callee4$(_context4) {
4720
- while (1) switch (_context4.prev = _context4.next) {
4721
- case 0:
4722
- _context4.next = 2;
4723
- return _solidLogic.store.updater.update(_solidLogic.store.connectedStatements(x), []);
4724
- case 2:
4725
- case "end":
4726
- return _context4.stop();
4727
- }
4728
- }, _callee4);
4729
- }));
4730
- return _deleteThingThen.apply(this, arguments);
4731
- }
4732
- var me = _solidLogic.authn.currentUser(); // If already logged on
4733
- if (me && _solidLogic.store.holds(message, ns.foaf('maker'), me)) {
4734
- // button to delete the message
4735
- div.appendChild(widgets.deleteButtonWithCheck(dom, div, 'message', deleteMessage));
4736
- // button to edit the message
4737
- div.appendChild(widgets.button(dom, _iconBase.icons.iconBase + PENCIL_ICON, 'edit', function () {
4738
- return editMessage(messageRow);
4739
- }));
4740
- } // if mine
4741
- // Things anyone can do if they have a bookmark list async
4742
- /*
4743
- var bookmarkButton = await bookmarks.renderBookmarksButton(userContext)
4744
- if (bookmarkButton) {
4745
- div.appendChild(bookmarkButton)
4746
- }
4747
- */
4748
- // Things anyone can do if they have a bookmark list
5346
+ var action;
5347
+ button.refresh = refresh; // If the file changes, refresh live
5348
+ refresh();
5349
+ return button;
5350
+ };
5351
+ _deleteThingThen = function _deleteThingThen3() {
5352
+ _deleteThingThen = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(x) {
5353
+ return _regenerator["default"].wrap(function _callee9$(_context9) {
5354
+ while (1) switch (_context9.prev = _context9.next) {
5355
+ case 0:
5356
+ _context9.next = 2;
5357
+ return _solidLogic.store.updater.update(_solidLogic.store.connectedStatements(x), []);
5358
+ case 2:
5359
+ case "end":
5360
+ return _context9.stop();
5361
+ }
5362
+ }, _callee9);
5363
+ }));
5364
+ return _deleteThingThen.apply(this, arguments);
5365
+ };
5366
+ deleteThingThen = function _deleteThingThen2(_x10) {
5367
+ return _deleteThingThen.apply(this, arguments);
5368
+ };
5369
+ closeToolbar = function _closeToolbar() {
5370
+ div.parentElement.parentElement.removeChild(div.parentElement); // remive the TR
5371
+ };
5372
+ _replyInThread = function _replyInThread3() {
5373
+ _replyInThread = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
5374
+ var thread, options;
5375
+ return _regenerator["default"].wrap(function _callee8$(_context8) {
5376
+ while (1) switch (_context8.prev = _context8.next) {
5377
+ case 0:
5378
+ _context8.next = 2;
5379
+ return channelObject.createThread(message);
5380
+ case 2:
5381
+ thread = _context8.sent;
5382
+ options = userContext.chatOptions;
5383
+ if (options) {
5384
+ _context8.next = 6;
5385
+ break;
5386
+ }
5387
+ throw new Error('replyInThread: missing options');
5388
+ case 6:
5389
+ options.showThread(thread, options);
5390
+ closeToolbar(); // a one-off action
5391
+ case 8:
5392
+ case "end":
5393
+ return _context8.stop();
5394
+ }
5395
+ }, _callee8);
5396
+ }));
5397
+ return _replyInThread.apply(this, arguments);
5398
+ };
5399
+ replyInThread = function _replyInThread2() {
5400
+ return _replyInThread.apply(this, arguments);
5401
+ };
5402
+ _editMessage = function _editMessage3() {
5403
+ _editMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(messageRow) {
5404
+ return _regenerator["default"].wrap(function _callee7$(_context7) {
5405
+ while (1) switch (_context7.prev = _context7.next) {
5406
+ case 0:
5407
+ if (!(me.value === _solidLogic.store.any(message, ns.foaf('maker')).value)) {
5408
+ _context7.next = 4;
5409
+ break;
5410
+ }
5411
+ closeToolbar(); // edit is a one-off action
5412
+ _context7.next = 4;
5413
+ return (0, _message.switchToEditor)(messageRow, message, channelObject, userContext);
5414
+ case 4:
5415
+ case "end":
5416
+ return _context7.stop();
5417
+ }
5418
+ }, _callee7);
5419
+ }));
5420
+ return _editMessage.apply(this, arguments);
5421
+ };
5422
+ editMessage = function _editMessage2(_x9) {
5423
+ return _editMessage.apply(this, arguments);
5424
+ };
5425
+ _deleteMessage = function _deleteMessage3() {
5426
+ _deleteMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
5427
+ var author, msg, area;
5428
+ return _regenerator["default"].wrap(function _callee6$(_context6) {
5429
+ while (1) switch (_context6.prev = _context6.next) {
5430
+ case 0:
5431
+ author = _solidLogic.store.any(message, ns.foaf('maker'));
5432
+ if (me) {
5433
+ _context6.next = 5;
5434
+ break;
5435
+ }
5436
+ alert('You can\'t delete the message, you are not logged in.');
5437
+ _context6.next = 22;
5438
+ break;
5439
+ case 5:
5440
+ if (!me.sameTerm(author)) {
5441
+ _context6.next = 21;
5442
+ break;
5443
+ }
5444
+ _context6.prev = 6;
5445
+ _context6.next = 9;
5446
+ return channelObject.deleteMessage(message);
5447
+ case 9:
5448
+ _context6.next = 18;
5449
+ break;
5450
+ case 11:
5451
+ _context6.prev = 11;
5452
+ _context6.t0 = _context6["catch"](6);
5453
+ msg = 'Error deleting messaage ' + _context6.t0;
5454
+ debug.warn(msg);
5455
+ alert(msg);
5456
+ area = userContext.statusArea || messageRow.parentNode;
5457
+ area.appendChild(widgets.errorMessageBlock(dom, msg));
5458
+ case 18:
5459
+ messageRow.parentNode.removeChild(messageRow);
5460
+ _context6.next = 22;
5461
+ break;
5462
+ case 21:
5463
+ alert('You can\'t delete the message, you are not logged in as the author, ' + author);
5464
+ case 22:
5465
+ closeToolbar();
5466
+ case 23:
5467
+ case "end":
5468
+ return _context6.stop();
5469
+ }
5470
+ }, _callee6, null, [[6, 11]]);
5471
+ }));
5472
+ return _deleteMessage.apply(this, arguments);
5473
+ };
5474
+ deleteMessage = function _deleteMessage2() {
5475
+ return _deleteMessage.apply(this, arguments);
5476
+ }; // alain: TODO allow chat owner to fully delete message + sentiments and replacing messages
5477
+ div = dom.createElement('div'); // is message deleted ?
5478
+ _context10.next = 13;
5479
+ return (0, _chatLogic.mostRecentVersion)(message).value;
5480
+ case 13:
5481
+ _context10.t0 = _context10.sent;
5482
+ _context10.t1 = ns.schema('dateDeleted').value;
5483
+ if (!(_context10.t0 === _context10.t1)) {
5484
+ _context10.next = 17;
5485
+ break;
5486
+ }
5487
+ return _context10.abrupt("return", div);
5488
+ case 17:
5489
+ // Things only the original author can do
5490
+ me = _solidLogic.authn.currentUser(); // If already logged on
5491
+ if (me && _solidLogic.store.holds(message, ns.foaf('maker'), me)) {
5492
+ // button to delete the message
5493
+ div.appendChild(widgets.deleteButtonWithCheck(dom, div, 'message', deleteMessage));
5494
+ // button to edit the message
5495
+ div.appendChild(widgets.button(dom, _iconBase.icons.iconBase + PENCIL_ICON, 'edit', function () {
5496
+ return editMessage(messageRow);
5497
+ }));
5498
+ } // if mine
5499
+ // Things anyone can do if they have a bookmark list async
5500
+ /*
5501
+ var bookmarkButton = await bookmarks.renderBookmarksButton(userContext)
5502
+ if (bookmarkButton) {
5503
+ div.appendChild(bookmarkButton)
5504
+ }
5505
+ */
5506
+ // Things anyone can do if they have a bookmark list
4749
5507
 
4750
- (0, _bookmarks.renderBookmarksButton)(userContext).then(function (bookmarkButton) {
4751
- if (bookmarkButton) div.appendChild(bookmarkButton);
4752
- });
5508
+ (0, _bookmarks.renderBookmarksButton)(userContext).then(function (bookmarkButton) {
5509
+ if (bookmarkButton) div.appendChild(bookmarkButton);
5510
+ });
4753
5511
 
4754
- /** Button to allow user to express a sentiment (like, endorse, etc) about a target
4755
- *
4756
- * @param context {Object} - Provide dom and me
4757
- * @param target {NamedNode} - The thing the user expresses an opnion about
4758
- * @param icon {uristring} - The icon to be used for the button
4759
- * @param actionClass {NamedNode} - The RDF class - typically a subclass of schema:Action
4760
- * @param doc - {NamedNode} - the Solid document iunto which the data should be written
4761
- * @param mutuallyExclusive {Array<NamedNode>} - Any RDF classes of sentimentswhich are mutiually exclusive
4762
- */
4763
- function sentimentButton(context, target, icon, actionClass, doc, mutuallyExclusive) {
4764
- function setColor() {
4765
- button.style.backgroundColor = action ? 'yellow' : 'white';
4766
- }
4767
- var button = widgets.button(dom, icon, utils.label(actionClass), /*#__PURE__*/function () {
4768
- var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(_event) {
4769
- var insertMe, dirty, i, a;
4770
- return _regenerator["default"].wrap(function _callee$(_context) {
4771
- while (1) switch (_context.prev = _context.next) {
4772
- case 0:
4773
- if (!action) {
4774
- _context.next = 7;
4775
- break;
4776
- }
4777
- _context.next = 3;
4778
- return deleteThingThen(action);
4779
- case 3:
4780
- action = null;
4781
- setColor();
4782
- _context.next = 25;
4783
- break;
4784
- case 7:
4785
- // no action
4786
- action = widgets.newThing(doc);
4787
- insertMe = [rdf.st(action, ns.schema('agent'), context.me, doc), rdf.st(action, ns.rdf('type'), actionClass, doc), rdf.st(action, ns.schema('target'), target, doc)];
4788
- _context.next = 11;
4789
- return _solidLogic.store.updater.update([], insertMe);
4790
- case 11:
4791
- setColor();
4792
- if (!mutuallyExclusive) {
4793
- _context.next = 25;
4794
- break;
4795
- }
4796
- // Delete incompative sentiments
4797
- dirty = false;
4798
- i = 0;
4799
- case 15:
4800
- if (!(i < mutuallyExclusive.length)) {
4801
- _context.next = 24;
4802
- break;
4803
- }
4804
- a = existingAction(mutuallyExclusive[i]);
4805
- if (!a) {
4806
- _context.next = 21;
4807
- break;
4808
- }
4809
- _context.next = 20;
4810
- return deleteThingThen(a);
4811
- case 20:
4812
- // but how refresh? refreshTree the parent?
4813
- dirty = true;
4814
- case 21:
4815
- i++;
4816
- _context.next = 15;
4817
- break;
4818
- case 24:
4819
- if (dirty) {
4820
- // widgets.refreshTree(button.parentNode) // requires them all to be immediate siblings
4821
- widgets.refreshTree(messageRow); // requires them all to be immediate siblings
4822
- }
4823
- case 25:
4824
- case "end":
4825
- return _context.stop();
5512
+ /** Button to allow user to express a sentiment (like, endorse, etc) about a target
5513
+ *
5514
+ * @param context {Object} - Provide dom and me
5515
+ * @param target {NamedNode} - The thing the user expresses an opnion about
5516
+ * @param icon {uristring} - The icon to be used for the button
5517
+ * @param actionClass {NamedNode} - The RDF class - typically a subclass of schema:Action
5518
+ * @param doc - {NamedNode} - the Solid document iunto which the data should be written
5519
+ * @param mutuallyExclusive {Array<NamedNode>} - Any RDF classes of sentimentswhich are mutiually exclusive
5520
+ */
5521
+
5522
+ // THUMBS_UP_ICON
5523
+ // https://schema.org/AgreeAction
5524
+ me = _solidLogic.authn.currentUser(); // If already logged on
5525
+ _context10.t2 = me;
5526
+ if (!_context10.t2) {
5527
+ _context10.next = 28;
5528
+ break;
4826
5529
  }
4827
- }, _callee);
4828
- }));
4829
- return function (_x3) {
4830
- return _ref.apply(this, arguments);
4831
- };
4832
- }());
4833
- function existingAction(actionClass) {
4834
- var actions = _solidLogic.store.each(null, ns.schema('agent'), context.me, doc).filter(function (x) {
4835
- return _solidLogic.store.holds(x, ns.rdf('type'), actionClass, doc);
4836
- }).filter(function (x) {
4837
- return _solidLogic.store.holds(x, ns.schema('target'), target, doc);
4838
- });
4839
- return actions.length ? actions[0] : null;
4840
- }
4841
- function refresh() {
4842
- action = existingAction(actionClass);
4843
- setColor();
4844
- }
4845
- var action;
4846
- button.refresh = refresh; // If the file changes, refresh live
4847
- refresh();
4848
- return button;
4849
- }
4850
-
4851
- // THUMBS_UP_ICON
4852
- // https://schema.org/AgreeAction
4853
- me = _solidLogic.authn.currentUser(); // If already logged on
4854
- // debug.log('Actions 3' + mostRecentVersion(message).value + ' ' + ns.schema('dateDeleted').value + ' ' + (mostRecentVersion(message).value !== ns.schema('dateDeleted').value))
5530
+ _context10.next = 25;
5531
+ return (0, _chatLogic.mostRecentVersion)(message).value;
5532
+ case 25:
5533
+ _context10.t3 = _context10.sent;
5534
+ _context10.t4 = ns.schema('dateDeleted').value;
5535
+ _context10.t2 = _context10.t3 !== _context10.t4;
5536
+ case 28:
5537
+ if (!_context10.t2) {
5538
+ _context10.next = 32;
5539
+ break;
5540
+ }
5541
+ context1 = {
5542
+ me: me,
5543
+ dom: dom,
5544
+ div: div
5545
+ };
5546
+ div.appendChild(sentimentButton(context1, message,
5547
+ // @@ TODO use widgets.sentimentButton
5548
+ _iconBase.icons.iconBase + THUMBS_UP_ICON, ns.schema('AgreeAction'), message.doc(), [ns.schema('DisagreeAction')]));
5549
+ // Thumbs down
5550
+ div.appendChild(sentimentButton(context1, message, _iconBase.icons.iconBase + THUMBS_DOWN_ICON, ns.schema('DisagreeAction'), message.doc(), [ns.schema('AgreeAction')]));
5551
+ case 32:
5552
+ // Reply buttton
4855
5553
 
4856
- if (me && (0, _chatLogic.mostRecentVersion)(message).value !== ns.schema('dateDeleted').value) {
4857
- var context1 = {
4858
- me: me,
4859
- dom: dom,
4860
- div: div
4861
- };
4862
- div.appendChild(sentimentButton(context1, message,
4863
- // @@ TODO use widgets.sentimentButton
4864
- _iconBase.icons.iconBase + THUMBS_UP_ICON, ns.schema('AgreeAction'), message.doc(), [ns.schema('DisagreeAction')]));
4865
- // Thumbs down
4866
- div.appendChild(sentimentButton(context1, message, _iconBase.icons.iconBase + THUMBS_DOWN_ICON, ns.schema('DisagreeAction'), message.doc(), [ns.schema('AgreeAction')]));
4867
- }
4868
- // X button to remove the tool UI itself
4869
- var cancelButton = div.appendChild(widgets.cancelButton(dom));
4870
- cancelButton.style["float"] = 'right';
4871
- cancelButton.firstChild.style.opacity = '0.3';
4872
- cancelButton.addEventListener('click', closeToolbar);
4873
- return div;
5554
+ if (_solidLogic.store.any(message, ns.dct('created'))) {
5555
+ // Looks like a messsage? Bar can be used for other things
5556
+ div.appendChild(widgets.button(dom, _iconBase.icons.iconBase + REPLY_ICON, 'Reply in thread', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
5557
+ return _regenerator["default"].wrap(function _callee5$(_context5) {
5558
+ while (1) switch (_context5.prev = _context5.next) {
5559
+ case 0:
5560
+ _context5.next = 2;
5561
+ return replyInThread();
5562
+ case 2:
5563
+ case "end":
5564
+ return _context5.stop();
5565
+ }
5566
+ }, _callee5);
5567
+ }))));
5568
+ }
5569
+ // X button to remove the tool UI itself
5570
+ cancelButton = div.appendChild(widgets.cancelButton(dom));
5571
+ cancelButton.style["float"] = 'right';
5572
+ cancelButton.firstChild.style.opacity = '0.3';
5573
+ cancelButton.addEventListener('click', closeToolbar);
5574
+ return _context10.abrupt("return", div);
5575
+ case 38:
5576
+ case "end":
5577
+ return _context10.stop();
5578
+ }
5579
+ }, _callee10);
5580
+ }));
5581
+ return _messageToolbar.apply(this, arguments);
4874
5582
  }
4875
5583
  //# sourceMappingURL=messageTools.js.map
4876
5584
 
@@ -5411,6 +6119,11 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
5411
6119
  */
5412
6120
  var DEFAULT_HELP_MENU_ICON = _index.icons.iconBase + 'noun_help.svg';
5413
6121
  var DEFAUL_SOLID_ICON_URL = 'https://solidproject.org/assets/img/solid-emblem.svg';
6122
+
6123
+ /*
6124
+ HeaderOptions allow for customizing the logo and menu list. If a logo is not provided the default
6125
+ is solid. Menulist will always show a link to logout and to the users profile.
6126
+ */
5414
6127
  /**
5415
6128
  * Initialize header component, the header object returned depends on whether the user is authenticated.
5416
6129
  * @param store the data store
@@ -6084,10 +6797,7 @@ var TDEBUG = 32;
6084
6797
  var TALL = 63;
6085
6798
 
6086
6799
  /** @internal */
6087
- var LogLevel;
6088
- /** @internal */
6089
- exports.LogLevel = LogLevel;
6090
- (function (LogLevel) {
6800
+ var LogLevel = /*#__PURE__*/function (LogLevel) {
6091
6801
  LogLevel[LogLevel["Error"] = 1] = "Error";
6092
6802
  LogLevel[LogLevel["Warning"] = 2] = "Warning";
6093
6803
  LogLevel[LogLevel["Message"] = 4] = "Message";
@@ -6095,7 +6805,10 @@ exports.LogLevel = LogLevel;
6095
6805
  LogLevel[LogLevel["Info"] = 16] = "Info";
6096
6806
  LogLevel[LogLevel["Debug"] = 32] = "Debug";
6097
6807
  LogLevel[LogLevel["All"] = 63] = "All";
6098
- })(LogLevel || (exports.LogLevel = LogLevel = {}));
6808
+ return LogLevel;
6809
+ }({});
6810
+ /** @internal */
6811
+ exports.LogLevel = LogLevel;
6099
6812
  var _level = TERROR + TWARN + TMESG;
6100
6813
  /** @internal */
6101
6814
  var _ascending = false;
@@ -6304,7 +7017,30 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
6304
7017
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
6305
7018
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
6306
7019
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6307
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
7020
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } /* eslint-disable camelcase */ /**
7021
+ * Signing in, signing up, profile and preferences reloading
7022
+ * Type index management
7023
+ *
7024
+ * Many functions in this module take a context object which
7025
+ * holds various RDF symbols, add to it, and return a promise of it.
7026
+ *
7027
+ * * `me` RDF symbol for the user's WebID
7028
+ * * `publicProfile` The user's public profile, iff loaded
7029
+ * * `preferencesFile` The user's personal preference file, iff loaded
7030
+ * * `index.public` The user's public type index file
7031
+ * * `index.private` The user's private type index file
7032
+ *
7033
+ * Not RDF symbols:
7034
+ * * `noun` A string in english for the type of thing -- like "address book"
7035
+ * * `instance` An array of nodes which are existing instances
7036
+ * * `containers` An array of nodes of containers of instances
7037
+ * * `div` A DOM element where UI can be displayed
7038
+ * * `statusArea` A DOM element (opt) progress stuff can be displayed, or error messages
7039
+ * *
7040
+ * * Vocabulary: "load" loads a file if it exists;
7041
+ * * 'Ensure" CREATES the file if it does not exist (if it can) and then loads it.
7042
+ * @packageDocumentation
7043
+ */ // eslint-disable-next-line camelcase
6308
7044
  var store = _solidLogic.solidLogicSingleton.store;
6309
7045
  var _solidLogicSingleton$ = _solidLogic.solidLogicSingleton.profile,
6310
7046
  loadPreferences = _solidLogicSingleton$.loadPreferences,
@@ -8421,7 +9157,10 @@ var _participation = __webpack_require__(/*! ./participation */ "./lib/participa
8421
9157
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
8422
9158
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
8423
9159
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
8424
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
9160
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /** **************
9161
+ * Notepad Widget
9162
+ */ /** @module pad
9163
+ */
8425
9164
  var store = _solidLogic.solidLogicSingleton.store;
8426
9165
  var PAD = (0, _rdflib.Namespace)('http://www.w3.org/ns/pim/pad#');
8427
9166
  /**
@@ -9242,7 +9981,8 @@ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol
9242
9981
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
9243
9982
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
9244
9983
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
9245
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
9984
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /* Manage a UI for the particpation of a person in any thing
9985
+ */ // import { currentUser } from './authn/authn'
9246
9986
  var ParticipationTableElement = /*#__PURE__*/function (_HTMLTableElement) {
9247
9987
  (0, _inherits2["default"])(ParticipationTableElement, _HTMLTableElement);
9248
9988
  var _super = _createSuper(ParticipationTableElement);
@@ -9502,6 +10242,10 @@ function recordSharedPreferences(subject, context) {
9502
10242
  return new Promise(function (resolve, reject) {
9503
10243
  var sharedPreferences = kb.any(subject, ns.ui('sharedPreferences'));
9504
10244
  if (!sharedPreferences) {
10245
+ if (!kb.updater.editable(subject.doc())) {
10246
+ debug.log(" Cant make shared preferences, may not change ".concat(subject.doc));
10247
+ resolve(context);
10248
+ }
9505
10249
  var sp = $rdf.sym(subject.doc().uri + '#SharedPreferences');
9506
10250
  var ins = [$rdf.st(subject, ns.ui('sharedPreferences'), sp, subject.doc())];
9507
10251
  debug.log('Creating shared preferences ' + sp);
@@ -12101,6 +12845,8 @@ var _ = __webpack_require__(/*! .. */ "./lib/index.js");
12101
12845
  Copied from mashlib/src/global/metadata.ts
12102
12846
  */
12103
12847
 
12848
+ /* @ts-ignore no-console */
12849
+
12104
12850
  /**
12105
12851
  * @ignore exporting this only for the unit test
12106
12852
  */
@@ -12922,8 +13668,8 @@ Object.defineProperty(exports, "__esModule", ({
12922
13668
  }));
12923
13669
  exports.versionInfo = void 0;
12924
13670
  var versionInfo = {
12925
- buildTime: '2023-04-16T11:32:07Z',
12926
- commit: '8924ae81610399e968faf5b83a2f5669db70c87c',
13671
+ buildTime: '2023-04-16T15:04:15Z',
13672
+ commit: '92bc931ab923bdefb1f82e0d892aad974fd6e1e2',
12927
13673
  npmInfo: {
12928
13674
  'solid-ui': '2.4.27',
12929
13675
  npm: '8.19.4',
@@ -13025,9 +13771,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
13025
13771
  * UI Widgets such as buttons
13026
13772
  * @packageDocumentation
13027
13773
  */
13028
-
13029
13774
  /* global alert */
13030
-
13031
13775
  var iconBase = _iconBase.icons.iconBase;
13032
13776
  var cancelIconURI = iconBase + 'noun_1180156.svg'; // black X
13033
13777
  var checkIconURI = iconBase + 'noun_1180158.svg'; // green checkmark; Continue
@@ -14710,7 +15454,10 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
14710
15454
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
14711
15455
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
14712
15456
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
14713
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
15457
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } /* F O R M S
15458
+ *
15459
+ * A Vanilla Dom implementation of the form language
15460
+ */ /* eslint-disable multiline-ternary */ /* global alert */ // Note default export
14714
15461
  var checkMarkCharacter = "\u2713";
14715
15462
  var cancelCharacter = "\u2715";
14716
15463
  var dashCharacter = '-';
@@ -16706,7 +17453,14 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
16706
17453
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
16707
17454
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
16708
17455
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
16709
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
17456
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } /* The Autocomplete Control with decorations
17457
+
17458
+ This control has the buttons which control the state between editing, viewing, searching, accepting
17459
+ and so on. See the state diagram in the documentation. The AUtocomplete Picker does the main work.
17460
+
17461
+ */
17462
+ // dbpediaParameters
17463
+
16710
17464
  var WEBID_NOUN = 'Solid ID';
16711
17465
  var GREEN_PLUS = _iconBase.icons.iconBase + 'noun_34653_green.svg';
16712
17466
  var SEARCH_ICON = _iconBase.icons.iconBase + 'noun_Search_875351.svg';
@@ -17252,7 +18006,11 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
17252
18006
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17253
18007
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
17254
18008
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
17255
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
18009
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } /* Autocomplete Picker: Create and edit data using public data
18010
+ **
18011
+ ** As the data source is passed as a parameter, all kinds of APIa and query services can be used
18012
+ **
18013
+ */
17256
18014
  var AUTOCOMPLETE_THRESHOLD = 4; // don't check until this many characters typed
17257
18015
  var AUTOCOMPLETE_ROWS = 20; // 20?
17258
18016
  var AUTOCOMPLETE_ROWS_STRETCH = 40;
@@ -17352,7 +18110,8 @@ function _renderAutoComplete() {
17352
18110
  };
17353
18111
  }());
17354
18112
  return row;
17355
- };
18113
+ }; // console.log('@@ refreshList called')
18114
+ // rowForBinding
17356
18115
  if (!inputEventHandlerLock) {
17357
18116
  _context7.next = 5;
17358
18117
  break;
@@ -17605,7 +18364,7 @@ function _renderAutoComplete() {
17605
18364
  // errorMessageBlock will log the stack to the console
17606
18365
  style.setStyle(errorRow, 'autocompleteRowStyle');
17607
18366
  errorRow.style.padding = '1em';
17608
- };
18367
+ }; // refreshList
17609
18368
  // initialiize
17610
18369
  // const queryParams: QueryParameters = acOptions.queryParams
17611
18370
  targetClass = acOptions.targetClass;
@@ -17705,6 +18464,11 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
17705
18464
  // import * as logic from '../index'
17706
18465
  // import { authn } from '../../../authn/index'
17707
18466
 
18467
+ // import { Binding } from '../widgets/forms/autocomplete/publicData'
18468
+ // import { nativeNameForLanguageCode, englishNameForLanguageCode } from './nativeNameForLanguageCode'
18469
+
18470
+ // const { currentUser } = logic.authn
18471
+
17708
18472
  var languageCodeURIBase = 'https://www.w3.org/ns/iana/language-code/'; /// @@ unsupported on the web (2021)
17709
18473
  exports.languageCodeURIBase = languageCodeURIBase;
17710
18474
  var defaultPreferredLanguages = ['en', 'fr', 'de', 'it', 'ar'];
@@ -19815,6 +20579,17 @@ var _iconBase = __webpack_require__(/*! ../iconBase */ "./lib/iconBase.js");
19815
20579
  var ns = _interopRequireWildcard(__webpack_require__(/*! ../ns */ "./lib/ns.js"));
19816
20580
  var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
19817
20581
  var _templateObject;
20582
+ /**
20583
+ *
20584
+ * People Picker Pane
20585
+ *
20586
+ * This pane offers a mechanism for selecting a set of individuals, groups, or
20587
+ * organizations to take some action on.
20588
+ *
20589
+ * Assumptions
20590
+ * - Assumes that the user has a type index entry for vcard:AddressBook. @@ bad assuption
20591
+ *
20592
+ */
19818
20593
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19819
20594
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19820
20595
  var kb = _solidLogic.solidLogicSingleton.store;