solid-ui 2.4.27-80358ddf → 2.4.27-94bb2a59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.html +1 -9
- package/dist/{main.js → solid-ui.js} +1860 -1061
- package/dist/solid-ui.js.map +1 -0
- package/dist/solid-ui.min.js +3 -0
- package/dist/solid-ui.min.js.LICENSE.txt +109 -0
- package/dist/solid-ui.min.js.map +1 -0
- package/lib/chat/bookmarks.js +6 -7
- package/lib/chat/bookmarks.js.map +1 -1
- package/lib/chat/chatLogic.js +250 -61
- package/lib/chat/chatLogic.js.map +1 -1
- package/lib/chat/infinite.js +604 -426
- package/lib/chat/infinite.js.map +1 -1
- package/lib/chat/message.js +286 -158
- package/lib/chat/message.js.map +1 -1
- package/lib/chat/messageTools.js +464 -276
- package/lib/chat/messageTools.js.map +1 -1
- package/lib/chat/thread.js +166 -144
- package/lib/chat/thread.js.map +1 -1
- package/lib/header/index.d.ts.map +1 -1
- package/lib/header/index.js +13 -5
- package/lib/header/index.js.map +1 -1
- package/lib/login/login.d.ts.map +1 -1
- package/lib/login/login.js +28 -26
- package/lib/login/login.js.map +1 -1
- package/lib/preferences.js +4 -0
- package/lib/preferences.js.map +1 -1
- package/lib/style.js +30 -27
- package/lib/style.js.map +1 -1
- package/lib/versionInfo.js +5 -5
- package/lib/versionInfo.js.map +1 -1
- package/lib/widgets/forms.js +8 -4
- package/lib/widgets/forms.js.map +1 -1
- package/package.json +8 -6
- package/dist/main.js.map +0 -1
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
|
2
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
|
3
|
+
module.exports = factory();
|
|
4
|
+
else if(typeof define === 'function' && define.amd)
|
|
5
|
+
define([], factory);
|
|
6
|
+
else if(typeof exports === 'object')
|
|
7
|
+
exports["solid-ui"] = factory();
|
|
8
|
+
else
|
|
9
|
+
root["solid-ui"] = factory();
|
|
10
|
+
})(self, () => {
|
|
11
|
+
return /******/ (() => { // webpackBootstrap
|
|
2
12
|
/******/ var __webpack_modules__ = ({
|
|
3
13
|
|
|
4
14
|
/***/ "./lib/acl/access-controller.js":
|
|
@@ -2239,8 +2249,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
2239
2249
|
* @packageDocumentation
|
|
2240
2250
|
*/
|
|
2241
2251
|
|
|
2242
|
-
/* global alert confirm */
|
|
2243
|
-
|
|
2244
2252
|
// pull in first avoid cross-refs
|
|
2245
2253
|
|
|
2246
2254
|
var UI = {
|
|
@@ -2333,7 +2341,8 @@ function _findBookmarkDocument() {
|
|
|
2333
2341
|
}
|
|
2334
2342
|
userContext.bookmarkDocument = userContext.instances[0];
|
|
2335
2343
|
if (userContext.instances.length > 1) {
|
|
2336
|
-
|
|
2344
|
+
debug.warn('More than one bookmark file! ' + userContext.instances); // @@ todo - deal with > 1
|
|
2345
|
+
// Note: should pick up community bookmarks as well
|
|
2337
2346
|
}
|
|
2338
2347
|
_context.next = 28;
|
|
2339
2348
|
break;
|
|
@@ -2354,7 +2363,7 @@ function _findBookmarkDocument() {
|
|
|
2354
2363
|
case 18:
|
|
2355
2364
|
_context.prev = 18;
|
|
2356
2365
|
_context.t0 = _context["catch"](12);
|
|
2357
|
-
|
|
2366
|
+
debug.warn("Can't make fresh bookmark file:" + _context.t0);
|
|
2358
2367
|
return _context.abrupt("return", userContext);
|
|
2359
2368
|
case 22:
|
|
2360
2369
|
_context.next = 24;
|
|
@@ -2364,7 +2373,7 @@ function _findBookmarkDocument() {
|
|
|
2364
2373
|
_context.next = 28;
|
|
2365
2374
|
break;
|
|
2366
2375
|
case 27:
|
|
2367
|
-
|
|
2376
|
+
debug.warn('You seem to have no bookmark file, nor even a profile file!');
|
|
2368
2377
|
case 28:
|
|
2369
2378
|
return _context.abrupt("return", userContext);
|
|
2370
2379
|
case 29:
|
|
@@ -2419,7 +2428,7 @@ function _addBookmark() {
|
|
|
2419
2428
|
_context2.prev = 14;
|
|
2420
2429
|
_context2.t0 = _context2["catch"](9);
|
|
2421
2430
|
msg = 'Making bookmark: ' + _context2.t0;
|
|
2422
|
-
|
|
2431
|
+
debug.warn(msg);
|
|
2423
2432
|
return _context2.abrupt("return", null);
|
|
2424
2433
|
case 19:
|
|
2425
2434
|
return _context2.abrupt("return", bookmark);
|
|
@@ -2472,7 +2481,7 @@ function _toggleBookmark() {
|
|
|
2472
2481
|
_context3.prev = 15;
|
|
2473
2482
|
_context3.t0 = _context3["catch"](8);
|
|
2474
2483
|
debug.error('Cant delete bookmark:' + _context3.t0);
|
|
2475
|
-
|
|
2484
|
+
debug.warn('Cannot delete bookmark:' + _context3.t0);
|
|
2476
2485
|
case 19:
|
|
2477
2486
|
i++;
|
|
2478
2487
|
_context3.next = 7;
|
|
@@ -2567,6 +2576,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
2567
2576
|
}));
|
|
2568
2577
|
exports.ChatChannel = void 0;
|
|
2569
2578
|
exports._createIfNotExists = _createIfNotExists;
|
|
2579
|
+
exports.allVersions = allVersions;
|
|
2570
2580
|
exports.isDeleted = isDeleted;
|
|
2571
2581
|
exports.isHidden = isHidden;
|
|
2572
2582
|
exports.isReplaced = isReplaced;
|
|
@@ -2642,6 +2652,7 @@ var ChatChannel = /*#__PURE__*/function () {
|
|
|
2642
2652
|
var _this = this;
|
|
2643
2653
|
var oldMsg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
2644
2654
|
var deleteIt = arguments.length > 2 ? arguments[2] : undefined;
|
|
2655
|
+
var thread = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
2645
2656
|
return /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
2646
2657
|
var sts, now, timestamp, dateStamp, chatDocument, message, me, msg;
|
|
2647
2658
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
@@ -2654,41 +2665,61 @@ var ChatChannel = /*#__PURE__*/function () {
|
|
|
2654
2665
|
chatDocument = oldMsg ? oldMsg.doc() : _this.dateFolder.leafDocumentFromDate(now);
|
|
2655
2666
|
message = _solidLogic.store.sym(chatDocument.uri + '#' + 'Msg' + timestamp); // const content = store.literal(text)
|
|
2656
2667
|
me = _solidLogic.authn.currentUser(); // If already logged on
|
|
2657
|
-
if (oldMsg) {
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2668
|
+
if (!oldMsg) {
|
|
2669
|
+
_context2.next = 21;
|
|
2670
|
+
break;
|
|
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));
|
|
2666
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:
|
|
2667
2692
|
sts.push($rdf.st(message, ns.sioc('content'), _solidLogic.store.literal(text), chatDocument));
|
|
2668
2693
|
sts.push($rdf.st(message, ns.dct('created'), dateStamp, chatDocument));
|
|
2669
2694
|
if (me) {
|
|
2670
2695
|
sts.push($rdf.st(message, ns.foaf('maker'), me, chatDocument));
|
|
2671
2696
|
}
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
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;
|
|
2677
2708
|
break;
|
|
2678
|
-
case
|
|
2679
|
-
_context2.prev =
|
|
2680
|
-
_context2.
|
|
2681
|
-
msg = 'Error saving chat message: ' + _context2.
|
|
2709
|
+
case 31:
|
|
2710
|
+
_context2.prev = 31;
|
|
2711
|
+
_context2.t7 = _context2["catch"](26);
|
|
2712
|
+
msg = 'Error saving chat message: ' + _context2.t7;
|
|
2682
2713
|
debug.warn(msg);
|
|
2683
2714
|
alert(msg);
|
|
2684
2715
|
throw new Error(msg);
|
|
2685
|
-
case
|
|
2716
|
+
case 37:
|
|
2686
2717
|
return _context2.abrupt("return", message);
|
|
2687
|
-
case
|
|
2718
|
+
case 38:
|
|
2688
2719
|
case "end":
|
|
2689
2720
|
return _context2.stop();
|
|
2690
2721
|
}
|
|
2691
|
-
}, _callee2, null, [[
|
|
2722
|
+
}, _callee2, null, [[26, 31]]);
|
|
2692
2723
|
})();
|
|
2693
2724
|
});
|
|
2694
2725
|
function updateMessage(_x2) {
|
|
@@ -2718,26 +2749,187 @@ var ChatChannel = /*#__PURE__*/function () {
|
|
|
2718
2749
|
return _deleteMessage.apply(this, arguments);
|
|
2719
2750
|
}
|
|
2720
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;
|
|
2721
2787
|
}()
|
|
2722
2788
|
}]);
|
|
2723
2789
|
return ChatChannel;
|
|
2724
2790
|
}(); // class ChatChannel
|
|
2791
|
+
// ////////// Utility functions
|
|
2792
|
+
// Have to not loop forever if fed loops
|
|
2725
2793
|
exports.ChatChannel = ChatChannel;
|
|
2726
|
-
function
|
|
2727
|
-
|
|
2728
|
-
while (msg) {
|
|
2729
|
-
message = msg;
|
|
2730
|
-
msg = _solidLogic.store.any(null, ns.dct('isReplacedBy'), message, message.doc());
|
|
2731
|
-
}
|
|
2732
|
-
return message;
|
|
2794
|
+
function allVersions(_x5) {
|
|
2795
|
+
return _allVersions.apply(this, arguments);
|
|
2733
2796
|
}
|
|
2734
|
-
function
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
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);
|
|
2741
2933
|
}
|
|
2742
2934
|
function isDeleted(message) {
|
|
2743
2935
|
return _solidLogic.store.holds(message, ns.schema('dateDeleted'), null, message.doc());
|
|
@@ -2756,62 +2948,62 @@ function nick(person) {
|
|
|
2756
2948
|
if (s) return '' + s.value;
|
|
2757
2949
|
return '' + utils.label(person);
|
|
2758
2950
|
}
|
|
2759
|
-
function _createIfNotExists(
|
|
2951
|
+
function _createIfNotExists(_x8) {
|
|
2760
2952
|
return _createIfNotExists2.apply(this, arguments);
|
|
2761
2953
|
} // ends
|
|
2762
2954
|
function _createIfNotExists2() {
|
|
2763
2955
|
_createIfNotExists2 = (0, _asyncToGenerator2["default"])(function (doc) {
|
|
2764
2956
|
var contentType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'text/turtle';
|
|
2765
2957
|
var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
2766
|
-
return /*#__PURE__*/_regenerator["default"].mark(function
|
|
2958
|
+
return /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
|
|
2767
2959
|
var response;
|
|
2768
|
-
return _regenerator["default"].wrap(function
|
|
2769
|
-
while (1) switch (
|
|
2960
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
2961
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
2770
2962
|
case 0:
|
|
2771
|
-
|
|
2772
|
-
|
|
2963
|
+
_context8.prev = 0;
|
|
2964
|
+
_context8.next = 3;
|
|
2773
2965
|
return _solidLogic.store.fetcher.load(doc);
|
|
2774
2966
|
case 3:
|
|
2775
|
-
response =
|
|
2776
|
-
|
|
2967
|
+
response = _context8.sent;
|
|
2968
|
+
_context8.next = 26;
|
|
2777
2969
|
break;
|
|
2778
2970
|
case 6:
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
if (!(
|
|
2782
|
-
|
|
2971
|
+
_context8.prev = 6;
|
|
2972
|
+
_context8.t0 = _context8["catch"](0);
|
|
2973
|
+
if (!(_context8.t0.response.status === 404)) {
|
|
2974
|
+
_context8.next = 24;
|
|
2783
2975
|
break;
|
|
2784
2976
|
}
|
|
2785
2977
|
debug.log('createIfNotExists: doc does NOT exist, will create... ' + doc);
|
|
2786
|
-
|
|
2787
|
-
|
|
2978
|
+
_context8.prev = 10;
|
|
2979
|
+
_context8.next = 13;
|
|
2788
2980
|
return _solidLogic.store.fetcher.webOperation('PUT', doc.uri, {
|
|
2789
2981
|
data: data,
|
|
2790
2982
|
contentType: contentType
|
|
2791
2983
|
});
|
|
2792
2984
|
case 13:
|
|
2793
|
-
response =
|
|
2794
|
-
|
|
2985
|
+
response = _context8.sent;
|
|
2986
|
+
_context8.next = 20;
|
|
2795
2987
|
break;
|
|
2796
2988
|
case 16:
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
debug.log('createIfNotExists doc FAILED: ' + doc + ': ' +
|
|
2800
|
-
throw
|
|
2989
|
+
_context8.prev = 16;
|
|
2990
|
+
_context8.t1 = _context8["catch"](10);
|
|
2991
|
+
debug.log('createIfNotExists doc FAILED: ' + doc + ': ' + _context8.t1);
|
|
2992
|
+
throw _context8.t1;
|
|
2801
2993
|
case 20:
|
|
2802
2994
|
delete _solidLogic.store.fetcher.requested[doc.uri]; // delete cached 404 error
|
|
2803
2995
|
// debug.log('createIfNotExists doc created ok ' + doc)
|
|
2804
|
-
return
|
|
2996
|
+
return _context8.abrupt("return", response);
|
|
2805
2997
|
case 24:
|
|
2806
|
-
debug.log('createIfNotExists doc load error NOT 404: ' + doc + ': ' +
|
|
2807
|
-
throw
|
|
2998
|
+
debug.log('createIfNotExists doc load error NOT 404: ' + doc + ': ' + _context8.t0);
|
|
2999
|
+
throw _context8.t0;
|
|
2808
3000
|
case 26:
|
|
2809
|
-
return
|
|
3001
|
+
return _context8.abrupt("return", response);
|
|
2810
3002
|
case 27:
|
|
2811
3003
|
case "end":
|
|
2812
|
-
return
|
|
3004
|
+
return _context8.stop();
|
|
2813
3005
|
}
|
|
2814
|
-
},
|
|
3006
|
+
}, _callee8, null, [[0, 6], [10, 16]]);
|
|
2815
3007
|
})();
|
|
2816
3008
|
});
|
|
2817
3009
|
return _createIfNotExists2.apply(this, arguments);
|
|
@@ -3189,19 +3381,9 @@ var _chatLogic = __webpack_require__(/*! ./chatLogic */ "./lib/chat/chatLogic.js
|
|
|
3189
3381
|
var _message = __webpack_require__(/*! ./message */ "./lib/chat/message.js");
|
|
3190
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); }
|
|
3191
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; }
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
*/
|
|
3196
|
-
// import { findBookmarkDocument } from './bookmarks'
|
|
3197
|
-
// pull in first avoid cross-refs
|
|
3198
|
-
|
|
3199
|
-
// import * as style from '../style'
|
|
3200
|
-
// import * as utils from '../utils'
|
|
3201
|
-
|
|
3202
|
-
// import * as pad from '../pad'
|
|
3203
|
-
// import { DateFolder } from './dateFolder'
|
|
3204
|
-
|
|
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; }
|
|
3205
3387
|
// const UI = { authn, icons, ns, media, pad, $rdf, store, style, utils, widgets }
|
|
3206
3388
|
|
|
3207
3389
|
function desktopNotification(str) {
|
|
@@ -3229,34 +3411,9 @@ function desktopNotification(str) {
|
|
|
3229
3411
|
/**
|
|
3230
3412
|
* Renders a chat message inside a `messageTable`
|
|
3231
3413
|
*/
|
|
3232
|
-
function insertMessageIntoTable(
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
// const message = messageRow.AJAR_subject
|
|
3236
|
-
if (options.selectedMessage && options.selectedMessage.sameTerm(message)) {
|
|
3237
|
-
messageRow.style.backgroundColor = 'yellow';
|
|
3238
|
-
options.selectedElement = messageRow;
|
|
3239
|
-
messageTable.selectedElement = messageRow;
|
|
3240
|
-
}
|
|
3241
|
-
var done = false;
|
|
3242
|
-
for (var ele = messageTable.firstChild;; ele = ele.nextSibling) {
|
|
3243
|
-
if (!ele) {
|
|
3244
|
-
// empty
|
|
3245
|
-
break;
|
|
3246
|
-
}
|
|
3247
|
-
var newestFirst = options.newestfirst === true;
|
|
3248
|
-
var dateString = messageRow.AJAR_date;
|
|
3249
|
-
if (dateString > ele.AJAR_date && newestFirst || dateString < ele.AJAR_date && !newestFirst) {
|
|
3250
|
-
messageTable.insertBefore(messageRow, ele);
|
|
3251
|
-
done = true;
|
|
3252
|
-
break;
|
|
3253
|
-
}
|
|
3254
|
-
}
|
|
3255
|
-
if (!done) {
|
|
3256
|
-
messageTable.appendChild(messageRow);
|
|
3257
|
-
}
|
|
3414
|
+
function insertMessageIntoTable(_x, _x2, _x3, _x4, _x5, _x6) {
|
|
3415
|
+
return _insertMessageIntoTable.apply(this, arguments);
|
|
3258
3416
|
}
|
|
3259
|
-
|
|
3260
3417
|
/**
|
|
3261
3418
|
* Common code for a chat (discussion area of messages about something)
|
|
3262
3419
|
* This version runs over a series of files for different time periods
|
|
@@ -3279,20 +3436,70 @@ function insertMessageIntoTable(channelObject, messageTable, message, fresh, opt
|
|
|
3279
3436
|
- inlineImageHeightEms: The height (in ems) of images expaned from their URIs in the chat.
|
|
3280
3437
|
|
|
3281
3438
|
*/
|
|
3282
|
-
function
|
|
3439
|
+
function _insertMessageIntoTable() {
|
|
3440
|
+
_insertMessageIntoTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(channelObject, messageTable, message, fresh, options, userContext) {
|
|
3441
|
+
var messageRow, done, ele, newestFirst, dateString;
|
|
3442
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
3443
|
+
while (1) switch (_context.prev = _context.next) {
|
|
3444
|
+
case 0:
|
|
3445
|
+
_context.next = 2;
|
|
3446
|
+
return (0, _message.renderMessageRow)(channelObject, message, fresh, options, userContext);
|
|
3447
|
+
case 2:
|
|
3448
|
+
messageRow = _context.sent;
|
|
3449
|
+
// const message = messageRow.AJAR_subject
|
|
3450
|
+
if (options.selectedMessage && options.selectedMessage.sameTerm(message)) {
|
|
3451
|
+
messageRow.style.backgroundColor = 'yellow';
|
|
3452
|
+
options.selectedElement = messageRow;
|
|
3453
|
+
messageTable.selectedElement = messageRow;
|
|
3454
|
+
}
|
|
3455
|
+
done = false;
|
|
3456
|
+
ele = messageTable.firstChild;
|
|
3457
|
+
case 6:
|
|
3458
|
+
if (ele) {
|
|
3459
|
+
_context.next = 8;
|
|
3460
|
+
break;
|
|
3461
|
+
}
|
|
3462
|
+
return _context.abrupt("break", 17);
|
|
3463
|
+
case 8:
|
|
3464
|
+
newestFirst = options.newestfirst === true;
|
|
3465
|
+
dateString = messageRow.AJAR_date;
|
|
3466
|
+
if (!(dateString > ele.AJAR_date && newestFirst || dateString < ele.AJAR_date && !newestFirst)) {
|
|
3467
|
+
_context.next = 14;
|
|
3468
|
+
break;
|
|
3469
|
+
}
|
|
3470
|
+
messageTable.insertBefore(messageRow, ele);
|
|
3471
|
+
done = true;
|
|
3472
|
+
return _context.abrupt("break", 17);
|
|
3473
|
+
case 14:
|
|
3474
|
+
ele = ele.nextSibling;
|
|
3475
|
+
_context.next = 6;
|
|
3476
|
+
break;
|
|
3477
|
+
case 17:
|
|
3478
|
+
if (!done) {
|
|
3479
|
+
messageTable.appendChild(messageRow);
|
|
3480
|
+
}
|
|
3481
|
+
case 18:
|
|
3482
|
+
case "end":
|
|
3483
|
+
return _context.stop();
|
|
3484
|
+
}
|
|
3485
|
+
}, _callee);
|
|
3486
|
+
}));
|
|
3487
|
+
return _insertMessageIntoTable.apply(this, arguments);
|
|
3488
|
+
}
|
|
3489
|
+
function infiniteMessageArea(_x7, _x8, _x9, _x10) {
|
|
3283
3490
|
return _infiniteMessageArea.apply(this, arguments);
|
|
3284
3491
|
}
|
|
3285
3492
|
function _infiniteMessageArea() {
|
|
3286
|
-
_infiniteMessageArea = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3287
|
-
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;
|
|
3288
|
-
return _regenerator["default"].wrap(function
|
|
3289
|
-
while (1) switch (
|
|
3493
|
+
_infiniteMessageArea = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee15(dom, wasStore, chatChannel, options) {
|
|
3494
|
+
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;
|
|
3495
|
+
return _regenerator["default"].wrap(function _callee15$(_context15) {
|
|
3496
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
3290
3497
|
case 0:
|
|
3291
3498
|
_loadInitialContent = function _loadInitialContent3() {
|
|
3292
|
-
_loadInitialContent = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3293
|
-
var yank, fixScroll, live, selectedDocument, now, todayDocument, selectedMessageTable, selectedDate;
|
|
3294
|
-
return _regenerator["default"].wrap(function
|
|
3295
|
-
while (1) switch (
|
|
3499
|
+
_loadInitialContent = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14() {
|
|
3500
|
+
var yank, fixScroll, live, selectedDocument, threadRootDocument, initialDocment, now, todayDocument, selectedMessageTable, selectedDate;
|
|
3501
|
+
return _regenerator["default"].wrap(function _callee14$(_context14) {
|
|
3502
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
3296
3503
|
case 0:
|
|
3297
3504
|
fixScroll = function _fixScroll() {
|
|
3298
3505
|
if (options.selectedElement) {
|
|
@@ -3306,51 +3513,59 @@ function _infiniteMessageArea() {
|
|
|
3306
3513
|
}
|
|
3307
3514
|
};
|
|
3308
3515
|
yank = function _yank() {
|
|
3309
|
-
selectedMessageTable.selectedElement
|
|
3310
|
-
|
|
3311
|
-
|
|
3516
|
+
if (selectedMessageTable && selectedMessageTable.selectedElement) {
|
|
3517
|
+
selectedMessageTable.selectedElement.scrollIntoView({
|
|
3518
|
+
block: 'center'
|
|
3519
|
+
});
|
|
3520
|
+
}
|
|
3312
3521
|
};
|
|
3313
3522
|
if (options.selectedMessage) {
|
|
3314
3523
|
selectedDocument = options.selectedMessage.doc();
|
|
3524
|
+
}
|
|
3525
|
+
if (threadRootMessage) {
|
|
3526
|
+
threadRootDocument = threadRootMessage.doc();
|
|
3527
|
+
}
|
|
3528
|
+
initialDocment = selectedDocument || threadRootDocument;
|
|
3529
|
+
if (initialDocment) {
|
|
3315
3530
|
now = new Date();
|
|
3316
3531
|
todayDocument = dateFolder.leafDocumentFromDate(now);
|
|
3317
|
-
live = todayDocument.sameTerm(
|
|
3532
|
+
live = todayDocument.sameTerm(initialDocment);
|
|
3318
3533
|
}
|
|
3319
|
-
if (!(
|
|
3320
|
-
|
|
3534
|
+
if (!(initialDocment && !live)) {
|
|
3535
|
+
_context14.next = 18;
|
|
3321
3536
|
break;
|
|
3322
3537
|
}
|
|
3323
|
-
selectedDate = dateFolder.dateFromLeafDocument(
|
|
3324
|
-
|
|
3538
|
+
selectedDate = dateFolder.dateFromLeafDocument(initialDocment);
|
|
3539
|
+
_context14.next = 10;
|
|
3325
3540
|
return createMessageTable(selectedDate, live);
|
|
3326
|
-
case
|
|
3327
|
-
selectedMessageTable =
|
|
3541
|
+
case 10:
|
|
3542
|
+
selectedMessageTable = _context14.sent;
|
|
3328
3543
|
div.appendChild(selectedMessageTable);
|
|
3329
3544
|
earliest.messageTable = selectedMessageTable;
|
|
3330
3545
|
latest.messageTable = selectedMessageTable;
|
|
3331
3546
|
yank();
|
|
3332
3547
|
setTimeout(yank, 1000); // @@ kludge - restore position distubed by other cHANGES
|
|
3333
|
-
|
|
3548
|
+
_context14.next = 22;
|
|
3334
3549
|
break;
|
|
3335
|
-
case
|
|
3336
|
-
|
|
3550
|
+
case 18:
|
|
3551
|
+
_context14.next = 20;
|
|
3337
3552
|
return appendCurrentMessages();
|
|
3338
|
-
case
|
|
3553
|
+
case 20:
|
|
3339
3554
|
earliest.messageTable = liveMessageTable;
|
|
3340
3555
|
latest.messageTable = liveMessageTable;
|
|
3341
|
-
case
|
|
3342
|
-
|
|
3556
|
+
case 22:
|
|
3557
|
+
_context14.next = 24;
|
|
3343
3558
|
return loadMoreWhereNeeded(null, fixScroll);
|
|
3344
|
-
case
|
|
3559
|
+
case 24:
|
|
3345
3560
|
div.addEventListener('scroll', loadMoreWhereNeeded);
|
|
3346
3561
|
if (options.solo) {
|
|
3347
3562
|
document.body.addEventListener('scroll', loadMoreWhereNeeded);
|
|
3348
3563
|
}
|
|
3349
|
-
case
|
|
3564
|
+
case 26:
|
|
3350
3565
|
case "end":
|
|
3351
|
-
return
|
|
3566
|
+
return _context14.stop();
|
|
3352
3567
|
}
|
|
3353
|
-
},
|
|
3568
|
+
}, _callee14);
|
|
3354
3569
|
}));
|
|
3355
3570
|
return _loadInitialContent.apply(this, arguments);
|
|
3356
3571
|
};
|
|
@@ -3358,16 +3573,16 @@ function _infiniteMessageArea() {
|
|
|
3358
3573
|
return _loadInitialContent.apply(this, arguments);
|
|
3359
3574
|
};
|
|
3360
3575
|
_loadMoreWhereNeeded = function _loadMoreWhereNeeded3() {
|
|
3361
|
-
_loadMoreWhereNeeded = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3576
|
+
_loadMoreWhereNeeded = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13(event, fixScroll) {
|
|
3362
3577
|
var freeze, magicZone, done, scrollBottom, scrollTop;
|
|
3363
|
-
return _regenerator["default"].wrap(function
|
|
3364
|
-
while (1) switch (
|
|
3578
|
+
return _regenerator["default"].wrap(function _callee13$(_context13) {
|
|
3579
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
3365
3580
|
case 0:
|
|
3366
3581
|
if (!lock) {
|
|
3367
|
-
|
|
3582
|
+
_context13.next = 2;
|
|
3368
3583
|
break;
|
|
3369
3584
|
}
|
|
3370
|
-
return
|
|
3585
|
+
return _context13.abrupt("return");
|
|
3371
3586
|
case 2:
|
|
3372
3587
|
lock = true;
|
|
3373
3588
|
freeze = !fixScroll;
|
|
@@ -3375,36 +3590,36 @@ function _infiniteMessageArea() {
|
|
|
3375
3590
|
// const bottom = div.scrollHeight - top - div.clientHeight
|
|
3376
3591
|
case 5:
|
|
3377
3592
|
if (!(div.scrollTop < magicZone && earliest.messageTable && !earliest.messageTable.initial && earliest.messageTable.extendBackwards)) {
|
|
3378
|
-
|
|
3593
|
+
_context13.next = 21;
|
|
3379
3594
|
break;
|
|
3380
3595
|
}
|
|
3381
3596
|
if (!(div.scrollHeight === 0)) {
|
|
3382
|
-
|
|
3597
|
+
_context13.next = 10;
|
|
3383
3598
|
break;
|
|
3384
3599
|
}
|
|
3385
|
-
//
|
|
3600
|
+
// debug.log(' chat/loadMoreWhereNeeded: trying later...')
|
|
3386
3601
|
setTimeout(loadMoreWhereNeeded, 2000); // couple be less
|
|
3387
3602
|
lock = false;
|
|
3388
|
-
return
|
|
3603
|
+
return _context13.abrupt("return");
|
|
3389
3604
|
case 10:
|
|
3390
|
-
//
|
|
3605
|
+
// debug.log(' chat/loadMoreWhereNeeded: Going now')
|
|
3391
3606
|
scrollBottom = div.scrollHeight - div.scrollTop;
|
|
3392
3607
|
debug.log('infinite scroll: adding above: top ' + div.scrollTop);
|
|
3393
|
-
|
|
3608
|
+
_context13.next = 14;
|
|
3394
3609
|
return earliest.messageTable.extendBackwards();
|
|
3395
3610
|
case 14:
|
|
3396
|
-
done =
|
|
3611
|
+
done = _context13.sent;
|
|
3397
3612
|
if (freeze) {
|
|
3398
3613
|
div.scrollTop = div.scrollHeight - scrollBottom;
|
|
3399
3614
|
}
|
|
3400
3615
|
if (fixScroll) fixScroll();
|
|
3401
3616
|
if (!done) {
|
|
3402
|
-
|
|
3617
|
+
_context13.next = 19;
|
|
3403
3618
|
break;
|
|
3404
3619
|
}
|
|
3405
|
-
return
|
|
3620
|
+
return _context13.abrupt("break", 21);
|
|
3406
3621
|
case 19:
|
|
3407
|
-
|
|
3622
|
+
_context13.next = 5;
|
|
3408
3623
|
break;
|
|
3409
3624
|
case 21:
|
|
3410
3625
|
if (!(options.selectedMessage &&
|
|
@@ -3414,15 +3629,15 @@ function _infiniteMessageArea() {
|
|
|
3414
3629
|
latest.messageTable && !latest.messageTable["final"] &&
|
|
3415
3630
|
// there is more data to come
|
|
3416
3631
|
latest.messageTable.extendForwards)) {
|
|
3417
|
-
|
|
3632
|
+
_context13.next = 33;
|
|
3418
3633
|
break;
|
|
3419
3634
|
}
|
|
3420
3635
|
scrollTop = div.scrollTop;
|
|
3421
3636
|
debug.log('infinite scroll: adding below: bottom: ' + (div.scrollHeight - div.scrollTop - div.clientHeight));
|
|
3422
|
-
|
|
3637
|
+
_context13.next = 26;
|
|
3423
3638
|
return latest.messageTable.extendForwards();
|
|
3424
3639
|
case 26:
|
|
3425
|
-
done =
|
|
3640
|
+
done = _context13.sent;
|
|
3426
3641
|
// then add more data on the bottom
|
|
3427
3642
|
if (freeze) {
|
|
3428
3643
|
div.scrollTop = scrollTop; // while adding below keep same things in view
|
|
@@ -3430,63 +3645,66 @@ function _infiniteMessageArea() {
|
|
|
3430
3645
|
|
|
3431
3646
|
if (fixScroll) fixScroll();
|
|
3432
3647
|
if (!done) {
|
|
3433
|
-
|
|
3648
|
+
_context13.next = 31;
|
|
3434
3649
|
break;
|
|
3435
3650
|
}
|
|
3436
|
-
return
|
|
3651
|
+
return _context13.abrupt("break", 33);
|
|
3437
3652
|
case 31:
|
|
3438
|
-
|
|
3653
|
+
_context13.next = 21;
|
|
3439
3654
|
break;
|
|
3440
3655
|
case 33:
|
|
3441
3656
|
lock = false;
|
|
3442
3657
|
case 34:
|
|
3443
3658
|
case "end":
|
|
3444
|
-
return
|
|
3659
|
+
return _context13.stop();
|
|
3445
3660
|
}
|
|
3446
|
-
},
|
|
3661
|
+
}, _callee13);
|
|
3447
3662
|
}));
|
|
3448
3663
|
return _loadMoreWhereNeeded.apply(this, arguments);
|
|
3449
3664
|
};
|
|
3450
|
-
loadMoreWhereNeeded = function _loadMoreWhereNeeded2(
|
|
3665
|
+
loadMoreWhereNeeded = function _loadMoreWhereNeeded2(_x20, _x21) {
|
|
3451
3666
|
return _loadMoreWhereNeeded.apply(this, arguments);
|
|
3452
3667
|
};
|
|
3453
3668
|
_appendCurrentMessages = function _appendCurrentMessage2() {
|
|
3454
|
-
_appendCurrentMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3669
|
+
_appendCurrentMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12() {
|
|
3455
3670
|
var now, chatDocument, messageTable;
|
|
3456
|
-
return _regenerator["default"].wrap(function
|
|
3457
|
-
while (1) switch (
|
|
3671
|
+
return _regenerator["default"].wrap(function _callee12$(_context12) {
|
|
3672
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
3458
3673
|
case 0:
|
|
3459
3674
|
now = new Date();
|
|
3460
3675
|
chatDocument = dateFolder.leafDocumentFromDate(now); /// ///////////////////////////////////////////////////////////
|
|
3461
|
-
|
|
3676
|
+
_context12.next = 4;
|
|
3462
3677
|
return createMessageTable(now, true);
|
|
3463
3678
|
case 4:
|
|
3464
|
-
messageTable =
|
|
3679
|
+
messageTable = _context12.sent;
|
|
3465
3680
|
div.appendChild(messageTable);
|
|
3466
|
-
div.refresh = /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3467
|
-
return _regenerator["default"].wrap(function
|
|
3468
|
-
while (1) switch (
|
|
3681
|
+
div.refresh = /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11() {
|
|
3682
|
+
return _regenerator["default"].wrap(function _callee11$(_context11) {
|
|
3683
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
3469
3684
|
case 0:
|
|
3470
|
-
|
|
3685
|
+
_context11.next = 2;
|
|
3471
3686
|
return addNewChatDocumentIfNewDay(new Date());
|
|
3472
3687
|
case 2:
|
|
3473
|
-
|
|
3474
|
-
|
|
3688
|
+
_context11.next = 4;
|
|
3689
|
+
return syncMessages(chatChannel, messageTable);
|
|
3475
3690
|
case 4:
|
|
3691
|
+
// @@ livemessagetable??
|
|
3692
|
+
desktopNotification(chatChannel);
|
|
3693
|
+
case 5:
|
|
3476
3694
|
case "end":
|
|
3477
|
-
return
|
|
3695
|
+
return _context11.stop();
|
|
3478
3696
|
}
|
|
3479
|
-
},
|
|
3697
|
+
}, _callee11);
|
|
3480
3698
|
})); // The short chat version the live update listening is done in the pane but we do it in the widget @@
|
|
3481
3699
|
_solidLogic.store.updater.addDownstreamChangeListener(chatDocument, div.refresh); // Live update
|
|
3482
3700
|
liveMessageTable = messageTable;
|
|
3483
3701
|
latest.messageTable = liveMessageTable;
|
|
3484
|
-
return
|
|
3702
|
+
return _context12.abrupt("return", messageTable);
|
|
3485
3703
|
case 11:
|
|
3486
3704
|
case "end":
|
|
3487
|
-
return
|
|
3705
|
+
return _context12.stop();
|
|
3488
3706
|
}
|
|
3489
|
-
},
|
|
3707
|
+
}, _callee12);
|
|
3490
3708
|
}));
|
|
3491
3709
|
return _appendCurrentMessages.apply(this, arguments);
|
|
3492
3710
|
};
|
|
@@ -3494,15 +3712,15 @@ function _infiniteMessageArea() {
|
|
|
3494
3712
|
return _appendCurrentMessages.apply(this, arguments);
|
|
3495
3713
|
};
|
|
3496
3714
|
_addNewChatDocumentIfNewDay = function _addNewChatDocumentIf2() {
|
|
3497
|
-
_addNewChatDocumentIfNewDay = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3715
|
+
_addNewChatDocumentIfNewDay = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10() {
|
|
3498
3716
|
var newChatDocument, oldChatDocument, sts;
|
|
3499
|
-
return _regenerator["default"].wrap(function
|
|
3500
|
-
while (1) switch (
|
|
3717
|
+
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
|
3718
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
3501
3719
|
case 0:
|
|
3502
3720
|
// @@ Remove listener from previous table as it is now static
|
|
3503
3721
|
newChatDocument = dateFolder.leafDocumentFromDate(new Date());
|
|
3504
3722
|
if (newChatDocument.sameTerm(latest.messageTable.chatDocument)) {
|
|
3505
|
-
|
|
3723
|
+
_context10.next = 7;
|
|
3506
3724
|
break;
|
|
3507
3725
|
}
|
|
3508
3726
|
// It is a new day
|
|
@@ -3511,7 +3729,7 @@ function _infiniteMessageArea() {
|
|
|
3511
3729
|
delete liveMessageTable.inputRow;
|
|
3512
3730
|
}
|
|
3513
3731
|
oldChatDocument = latest.messageTable.chatDocument;
|
|
3514
|
-
|
|
3732
|
+
_context10.next = 6;
|
|
3515
3733
|
return appendCurrentMessages();
|
|
3516
3734
|
case 6:
|
|
3517
3735
|
// Adding a link in the document will ping listeners to add the new block too
|
|
@@ -3525,286 +3743,322 @@ function _infiniteMessageArea() {
|
|
|
3525
3743
|
}
|
|
3526
3744
|
case 7:
|
|
3527
3745
|
case "end":
|
|
3528
|
-
return
|
|
3746
|
+
return _context10.stop();
|
|
3529
3747
|
}
|
|
3530
|
-
},
|
|
3748
|
+
}, _callee10);
|
|
3531
3749
|
}));
|
|
3532
3750
|
return _addNewChatDocumentIfNewDay.apply(this, arguments);
|
|
3533
3751
|
};
|
|
3534
3752
|
addNewChatDocumentIfNewDay = function _addNewChatDocumentIf() {
|
|
3535
3753
|
return _addNewChatDocumentIfNewDay.apply(this, arguments);
|
|
3536
3754
|
};
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3755
|
+
_renderMessageTable = function _renderMessageTable3() {
|
|
3756
|
+
_renderMessageTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(date, live) {
|
|
3757
|
+
var scrollBackbutton, scrollForwardButton, extendBackwards, _extendBackwards, setScrollBackbuttonIcon, extendForwards, _extendForwards, setScrollForwardButtonIcon, scrollForwardButtonHandler, _scrollForwardButtonHandler, messageTable, chatDocument, tr, test, titleTR, scrollBackbuttonCell, dateCell, scrollForwardButtonCell, sts, _iterator2, _step2, st;
|
|
3758
|
+
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
|
3759
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
3760
|
+
case 0:
|
|
3761
|
+
_scrollForwardButtonHandler = function _scrollForwardButtonH2() {
|
|
3762
|
+
_scrollForwardButtonHandler = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(_event) {
|
|
3763
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
3764
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
3765
|
+
case 0:
|
|
3766
|
+
if (!messageTable.extendedForwards) {
|
|
3767
|
+
_context8.next = 6;
|
|
3768
|
+
break;
|
|
3769
|
+
}
|
|
3770
|
+
removePreviousMessages(false, messageTable);
|
|
3771
|
+
messageTable.extendedForwards = false;
|
|
3772
|
+
setScrollForwardButtonIcon();
|
|
3773
|
+
_context8.next = 9;
|
|
3774
|
+
break;
|
|
3775
|
+
case 6:
|
|
3776
|
+
_context8.next = 8;
|
|
3777
|
+
return extendForwards();
|
|
3778
|
+
case 8:
|
|
3779
|
+
// async
|
|
3780
|
+
latest.messageTable.scrollIntoView(newestFirst);
|
|
3781
|
+
case 9:
|
|
3782
|
+
case "end":
|
|
3783
|
+
return _context8.stop();
|
|
3784
|
+
}
|
|
3785
|
+
}, _callee8);
|
|
3786
|
+
}));
|
|
3787
|
+
return _scrollForwardButtonHandler.apply(this, arguments);
|
|
3788
|
+
};
|
|
3789
|
+
scrollForwardButtonHandler = function _scrollForwardButtonH(_x22) {
|
|
3790
|
+
return _scrollForwardButtonHandler.apply(this, arguments);
|
|
3791
|
+
};
|
|
3792
|
+
setScrollForwardButtonIcon = function _setScrollForwardButt() {
|
|
3793
|
+
if (!scrollForwardButton) return;
|
|
3794
|
+
var sense = messageTable.extendedForwards ? !newestFirst : newestFirst; // noun_T-Block_1114657_000000.svg
|
|
3795
|
+
var scrollForwardIcon = messageTable["final"] ? 'noun_T-Block_1114657_000000.svg' : getScrollForwardButtonIcon(sense);
|
|
3796
|
+
scrollForwardButton.firstChild.setAttribute('src', _iconBase.icons.iconBase + scrollForwardIcon);
|
|
3797
|
+
function getScrollForwardButtonIcon(sense) {
|
|
3798
|
+
return !sense ? 'noun_1369241.svg' : 'noun_1369237.svg';
|
|
3563
3799
|
}
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
3591
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
3592
|
-
case 0:
|
|
3593
|
-
if (!messageTable.extendedBack) {
|
|
3594
|
-
_context2.next = 6;
|
|
3595
|
-
break;
|
|
3800
|
+
};
|
|
3801
|
+
_extendForwards = function _extendForwards3() {
|
|
3802
|
+
_extendForwards = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7() {
|
|
3803
|
+
var done;
|
|
3804
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
3805
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
3806
|
+
case 0:
|
|
3807
|
+
_context7.next = 2;
|
|
3808
|
+
return insertPreviousMessages(false);
|
|
3809
|
+
case 2:
|
|
3810
|
+
done = _context7.sent;
|
|
3811
|
+
return _context7.abrupt("return", done);
|
|
3812
|
+
case 4:
|
|
3813
|
+
case "end":
|
|
3814
|
+
return _context7.stop();
|
|
3815
|
+
}
|
|
3816
|
+
}, _callee7);
|
|
3817
|
+
}));
|
|
3818
|
+
return _extendForwards.apply(this, arguments);
|
|
3819
|
+
};
|
|
3820
|
+
extendForwards = function _extendForwards2() {
|
|
3821
|
+
return _extendForwards.apply(this, arguments);
|
|
3822
|
+
};
|
|
3823
|
+
setScrollBackbuttonIcon = function _setScrollBackbuttonI() {
|
|
3824
|
+
if (!scrollBackbutton) {
|
|
3825
|
+
return;
|
|
3596
3826
|
}
|
|
3597
|
-
|
|
3598
|
-
messageTable.
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3827
|
+
var sense = messageTable.extendedBack ? !newestFirst : newestFirst;
|
|
3828
|
+
var scrollBackIcon = messageTable.initial ? 'noun_T-Block_1114655_000000.svg' : getScrollbackIcon(sense);
|
|
3829
|
+
scrollBackbutton.firstChild.setAttribute('src', _iconBase.icons.iconBase + scrollBackIcon);
|
|
3830
|
+
function getScrollbackIcon(sense) {
|
|
3831
|
+
return sense ? 'noun_1369241.svg' : 'noun_1369237.svg';
|
|
3832
|
+
}
|
|
3833
|
+
};
|
|
3834
|
+
_extendBackwards = function _extendBackwards3() {
|
|
3835
|
+
_extendBackwards = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
|
|
3836
|
+
var done;
|
|
3837
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
3838
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
3839
|
+
case 0:
|
|
3840
|
+
_context6.next = 2;
|
|
3841
|
+
return insertPreviousMessages(true);
|
|
3842
|
+
case 2:
|
|
3843
|
+
done = _context6.sent;
|
|
3844
|
+
if (done) {
|
|
3845
|
+
if (scrollBackbutton) {
|
|
3846
|
+
scrollBackbutton.firstChild.setAttribute('src', _iconBase.icons.iconBase + 'noun_T-Block_1114655_000000.svg'); // T
|
|
3847
|
+
scrollBackbutton.disabled = true;
|
|
3848
|
+
}
|
|
3849
|
+
messageTable.initial = true;
|
|
3850
|
+
} else {
|
|
3851
|
+
messageTable.extendedBack = true;
|
|
3852
|
+
}
|
|
3853
|
+
setScrollBackbuttonIcon();
|
|
3854
|
+
return _context6.abrupt("return", done);
|
|
3855
|
+
case 6:
|
|
3856
|
+
case "end":
|
|
3857
|
+
return _context6.stop();
|
|
3858
|
+
}
|
|
3859
|
+
}, _callee6);
|
|
3860
|
+
}));
|
|
3861
|
+
return _extendBackwards.apply(this, arguments);
|
|
3862
|
+
};
|
|
3863
|
+
extendBackwards = function _extendBackwards2() {
|
|
3864
|
+
return _extendBackwards.apply(this, arguments);
|
|
3865
|
+
};
|
|
3866
|
+
scrollBackbutton = null; // was let
|
|
3867
|
+
scrollForwardButton = null; // was let
|
|
3868
|
+
/// ///////////////// Scroll down adding more above
|
|
3869
|
+
/// ///////////////////////
|
|
3870
|
+
/*
|
|
3871
|
+
options = options || {}
|
|
3872
|
+
options.authorDateOnLeft = true
|
|
3873
|
+
const newestFirst = options.newestFirst === '1' || options.newestFirst === true // hack for now
|
|
3874
|
+
const channelObject = new ChatChannel(chatChannel, options)
|
|
3875
|
+
const dateFolder = channelObject.dateFolder
|
|
3876
|
+
const div = dom.createElement('div')
|
|
3877
|
+
const statusArea = div.appendChild(dom.createElement('div'))
|
|
3878
|
+
const userContext = { dom, statusArea, div: statusArea } // logged on state, pointers to user's stuff
|
|
3879
|
+
*/
|
|
3880
|
+
debug.log('Options for called message Area', options);
|
|
3881
|
+
messageTable = dom.createElement('table');
|
|
3882
|
+
messageTable.style.width = '100%'; // fill the pane div
|
|
3883
|
+
messageTable.extendBackwards = extendBackwards; // Make function available to scroll stuff
|
|
3884
|
+
messageTable.extendForwards = extendForwards; // Make function available to scroll stuff
|
|
3885
|
+
|
|
3886
|
+
messageTable.date = date;
|
|
3887
|
+
chatDocument = dateFolder.leafDocumentFromDate(date);
|
|
3888
|
+
messageTable.chatDocument = chatDocument;
|
|
3889
|
+
messageTable.fresh = false;
|
|
3890
|
+
messageTable.setAttribute('style', 'width: 100%;'); // fill that div!
|
|
3891
|
+
if (live) {
|
|
3892
|
+
messageTable["final"] = true;
|
|
3893
|
+
liveMessageTable = messageTable;
|
|
3894
|
+
latest.messageTable = messageTable;
|
|
3895
|
+
tr = (0, _message.renderMessageEditor)(channelObject, messageTable, userContext, options);
|
|
3896
|
+
if (newestFirst) {
|
|
3897
|
+
messageTable.insertBefore(tr, messageTable.firstChild); // If newestFirst
|
|
3630
3898
|
} else {
|
|
3631
|
-
messageTable.
|
|
3899
|
+
messageTable.appendChild(tr); // not newestFirst
|
|
3632
3900
|
}
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
break;
|
|
3901
|
+
|
|
3902
|
+
messageTable.inputRow = tr;
|
|
3903
|
+
}
|
|
3904
|
+
|
|
3905
|
+
/// ///// Infinite scroll
|
|
3906
|
+
//
|
|
3907
|
+
// @@ listen for swipe past end event not just button
|
|
3908
|
+
test = true;
|
|
3909
|
+
if (test) {
|
|
3910
|
+
// ws options.infinite but need for non-infinite
|
|
3911
|
+
titleTR = dom.createElement('tr');
|
|
3912
|
+
scrollBackbuttonCell = titleTR.appendChild(dom.createElement('td')); // up traingles: noun_1369237.svg
|
|
3913
|
+
// down triangles: noun_1369241.svg
|
|
3914
|
+
/*
|
|
3915
|
+
const scrollBackIcon = newestFirst
|
|
3916
|
+
? 'noun_1369241.svg'
|
|
3917
|
+
: 'noun_1369237.svg' // down and up arrows respoctively
|
|
3918
|
+
scrollBackbutton = widgets.button(
|
|
3919
|
+
dom,
|
|
3920
|
+
icons.iconBase + scrollBackIcon,
|
|
3921
|
+
'Previous messages ...'
|
|
3922
|
+
)
|
|
3923
|
+
scrollBackbuttonCell.style = 'width:3em; height:3em;'
|
|
3924
|
+
scrollBackbutton.addEventListener('click', scrollBackbuttonHandler, false)
|
|
3925
|
+
messageTable.extendedBack = false
|
|
3926
|
+
scrollBackbuttonCell.appendChild(scrollBackbutton)
|
|
3927
|
+
setScrollBackbuttonIcon()
|
|
3928
|
+
*/
|
|
3929
|
+
dateCell = titleTR.appendChild(dom.createElement('td'));
|
|
3930
|
+
dateCell.style = 'text-align: center; vertical-align: middle; color: #888; font-style: italic;';
|
|
3931
|
+
dateCell.textContent = widgets.shortDate(date.toISOString(), true); // no time, only date
|
|
3932
|
+
|
|
3933
|
+
// @@@@@@@@@@@ todo move this button to other end of message cell, o
|
|
3934
|
+
scrollForwardButtonCell = titleTR.appendChild(dom.createElement('td'));
|
|
3935
|
+
if (options.includeRemoveButton) {
|
|
3936
|
+
scrollForwardButtonCell.appendChild(widgets.cancelButton(dom, function (_e) {
|
|
3937
|
+
div.parentNode.removeChild(div);
|
|
3938
|
+
}));
|
|
3672
3939
|
}
|
|
3673
|
-
|
|
3940
|
+
/*
|
|
3941
|
+
const scrollForwardIcon = newestFirst
|
|
3942
|
+
? 'noun_1369241.svg'
|
|
3943
|
+
: 'noun_1369237.svg' // down and up arrows respoctively
|
|
3944
|
+
scrollForwardButton = widgets.button(
|
|
3945
|
+
dom,
|
|
3946
|
+
icons.iconBase + scrollForwardIcon,
|
|
3947
|
+
'Later messages ...'
|
|
3948
|
+
)
|
|
3949
|
+
scrollForwardButtonCell.appendChild(scrollForwardButton)
|
|
3950
|
+
scrollForwardButtonCell.style = 'width:3em; height:3em;'
|
|
3951
|
+
scrollForwardButton.addEventListener(
|
|
3952
|
+
'click',
|
|
3953
|
+
scrollForwardButtonHandler,
|
|
3954
|
+
false
|
|
3955
|
+
)
|
|
3956
|
+
messageTable.extendedForward = false
|
|
3957
|
+
setScrollForwardButtonIcon()
|
|
3958
|
+
*/
|
|
3674
3959
|
messageTable.extendedForwards = false;
|
|
3675
|
-
|
|
3676
|
-
|
|
3960
|
+
if (!newestFirst) {
|
|
3961
|
+
// opposite end from the entry field
|
|
3962
|
+
messageTable.insertBefore(titleTR, messageTable.firstChild); // If not newestFirst
|
|
3963
|
+
} else {
|
|
3964
|
+
messageTable.appendChild(titleTR); // newestFirst
|
|
3965
|
+
}
|
|
3966
|
+
}
|
|
3967
|
+
sts = _solidLogic.store.statementsMatching(null, ns.wf('message'), null, chatDocument);
|
|
3968
|
+
if (!live && sts.length === 0) {
|
|
3969
|
+
// not todays
|
|
3970
|
+
// no need buttomns at the moment
|
|
3971
|
+
// messageTable.style.visibility = 'collapse' // Hide files with no messages
|
|
3972
|
+
}
|
|
3973
|
+
_iterator2 = _createForOfIteratorHelper(sts);
|
|
3974
|
+
_context9.prev = 26;
|
|
3975
|
+
_iterator2.s();
|
|
3976
|
+
case 28:
|
|
3977
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
3978
|
+
_context9.next = 34;
|
|
3677
3979
|
break;
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
messageTable.inputRow = tr;
|
|
3713
|
-
}
|
|
3714
|
-
|
|
3715
|
-
/// ///// Infinite scroll
|
|
3716
|
-
//
|
|
3717
|
-
// @@ listen for swipe past end event not just button
|
|
3718
|
-
if (options.infinite) {
|
|
3719
|
-
var scrollBackbuttonTR = dom.createElement('tr');
|
|
3720
|
-
var scrollBackbuttonCell = scrollBackbuttonTR.appendChild(dom.createElement('td'));
|
|
3721
|
-
// up traingles: noun_1369237.svg
|
|
3722
|
-
// down triangles: noun_1369241.svg
|
|
3723
|
-
var scrollBackIcon = newestFirst ? 'noun_1369241.svg' : 'noun_1369237.svg'; // down and up arrows respoctively
|
|
3724
|
-
scrollBackbutton = widgets.button(dom, _iconBase.icons.iconBase + scrollBackIcon, 'Previous messages ...');
|
|
3725
|
-
scrollBackbuttonCell.style = 'width:3em; height:3em;';
|
|
3726
|
-
scrollBackbutton.addEventListener('click', scrollBackbuttonHandler, false);
|
|
3727
|
-
messageTable.extendedBack = false;
|
|
3728
|
-
scrollBackbuttonCell.appendChild(scrollBackbutton);
|
|
3729
|
-
setScrollBackbuttonIcon();
|
|
3730
|
-
var dateCell = scrollBackbuttonTR.appendChild(dom.createElement('td'));
|
|
3731
|
-
dateCell.style = 'text-align: center; vertical-align: middle; color: #888; font-style: italic;';
|
|
3732
|
-
dateCell.textContent = widgets.shortDate(date.toISOString(), true); // no time, only date
|
|
3733
|
-
|
|
3734
|
-
// @@@@@@@@@@@ todo move this button to other end of message cell, o
|
|
3735
|
-
var scrollForwardButtonCell = scrollBackbuttonTR.appendChild(dom.createElement('td'));
|
|
3736
|
-
var scrollForwardIcon = newestFirst ? 'noun_1369241.svg' : 'noun_1369237.svg'; // down and up arrows respoctively
|
|
3737
|
-
scrollForwardButton = widgets.button(dom, _iconBase.icons.iconBase + scrollForwardIcon, 'Later messages ...');
|
|
3738
|
-
scrollForwardButtonCell.appendChild(scrollForwardButton);
|
|
3739
|
-
scrollForwardButtonCell.style = 'width:3em; height:3em;';
|
|
3740
|
-
scrollForwardButton.addEventListener('click', scrollForwardButtonHandler, false);
|
|
3741
|
-
messageTable.extendedForward = false;
|
|
3742
|
-
setScrollForwardButtonIcon();
|
|
3743
|
-
messageTable.extendedForwards = false;
|
|
3744
|
-
if (!newestFirst) {
|
|
3745
|
-
// opposite end from the entry field
|
|
3746
|
-
messageTable.insertBefore(scrollBackbuttonTR, messageTable.firstChild); // If not newestFirst
|
|
3747
|
-
} else {
|
|
3748
|
-
messageTable.appendChild(scrollBackbuttonTR); // newestFirst
|
|
3749
|
-
}
|
|
3750
|
-
}
|
|
3751
|
-
|
|
3752
|
-
var sts = _solidLogic.store.statementsMatching(null, ns.wf('message'), null, chatDocument);
|
|
3753
|
-
if (!live && sts.length === 0) {
|
|
3754
|
-
// not todays
|
|
3755
|
-
// no need buttomns at the moment
|
|
3756
|
-
// messageTable.style.visibility = 'collapse' // Hide files with no messages
|
|
3757
|
-
}
|
|
3758
|
-
sts.forEach(function (st) {
|
|
3759
|
-
addMessage(st.object, messageTable);
|
|
3760
|
-
});
|
|
3761
|
-
messageTable.fresh = true;
|
|
3762
|
-
|
|
3763
|
-
// loadMessageTable(messageTable, chatDocument)
|
|
3764
|
-
messageTable.fresh = false;
|
|
3765
|
-
return messageTable;
|
|
3980
|
+
}
|
|
3981
|
+
st = _step2.value;
|
|
3982
|
+
_context9.next = 32;
|
|
3983
|
+
return addMessage(st.object, messageTable);
|
|
3984
|
+
case 32:
|
|
3985
|
+
_context9.next = 28;
|
|
3986
|
+
break;
|
|
3987
|
+
case 34:
|
|
3988
|
+
_context9.next = 39;
|
|
3989
|
+
break;
|
|
3990
|
+
case 36:
|
|
3991
|
+
_context9.prev = 36;
|
|
3992
|
+
_context9.t0 = _context9["catch"](26);
|
|
3993
|
+
_iterator2.e(_context9.t0);
|
|
3994
|
+
case 39:
|
|
3995
|
+
_context9.prev = 39;
|
|
3996
|
+
_iterator2.f();
|
|
3997
|
+
return _context9.finish(39);
|
|
3998
|
+
case 42:
|
|
3999
|
+
messageTable.fresh = true;
|
|
4000
|
+
|
|
4001
|
+
// loadMessageTable(messageTable, chatDocument)
|
|
4002
|
+
messageTable.fresh = false;
|
|
4003
|
+
return _context9.abrupt("return", messageTable);
|
|
4004
|
+
case 45:
|
|
4005
|
+
case "end":
|
|
4006
|
+
return _context9.stop();
|
|
4007
|
+
}
|
|
4008
|
+
}, _callee9, null, [[26, 36, 39, 42]]);
|
|
4009
|
+
}));
|
|
4010
|
+
return _renderMessageTable.apply(this, arguments);
|
|
4011
|
+
};
|
|
4012
|
+
renderMessageTable = function _renderMessageTable2(_x18, _x19) {
|
|
4013
|
+
return _renderMessageTable.apply(this, arguments);
|
|
3766
4014
|
};
|
|
3767
4015
|
_createMessageTable = function _createMessageTable3() {
|
|
3768
|
-
_createMessageTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
4016
|
+
_createMessageTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(date, live) {
|
|
3769
4017
|
var chatDocument, messageTable, statusTR;
|
|
3770
|
-
return _regenerator["default"].wrap(function
|
|
3771
|
-
while (1) switch (
|
|
4018
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
4019
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
3772
4020
|
case 0:
|
|
3773
4021
|
debug.log(' createMessageTable for ' + date);
|
|
3774
4022
|
chatDocument = dateFolder.leafDocumentFromDate(date);
|
|
3775
|
-
|
|
3776
|
-
|
|
4023
|
+
_context5.prev = 2;
|
|
4024
|
+
_context5.next = 5;
|
|
3777
4025
|
return _solidLogic.store.fetcher.load(chatDocument);
|
|
3778
4026
|
case 5:
|
|
3779
|
-
|
|
4027
|
+
_context5.next = 21;
|
|
3780
4028
|
break;
|
|
3781
4029
|
case 7:
|
|
3782
|
-
|
|
3783
|
-
|
|
4030
|
+
_context5.prev = 7;
|
|
4031
|
+
_context5.t0 = _context5["catch"](2);
|
|
3784
4032
|
messageTable = dom.createElement('table');
|
|
3785
4033
|
statusTR = messageTable.appendChild(dom.createElement('tr')); // ### find status in exception
|
|
3786
|
-
if (!(
|
|
3787
|
-
|
|
4034
|
+
if (!(_context5.t0.response && _context5.t0.response.status && _context5.t0.response.status === 404)) {
|
|
4035
|
+
_context5.next = 18;
|
|
3788
4036
|
break;
|
|
3789
4037
|
}
|
|
3790
4038
|
debug.log('Error 404 for chat file ' + chatDocument);
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
4039
|
+
_context5.next = 15;
|
|
4040
|
+
return renderMessageTable(date, live);
|
|
4041
|
+
case 15:
|
|
4042
|
+
return _context5.abrupt("return", _context5.sent);
|
|
3795
4043
|
case 18:
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
return _context6.abrupt("return", renderMessageTable(date, live));
|
|
4044
|
+
debug.log('*** Error NON 404 for chat file ' + chatDocument);
|
|
4045
|
+
statusTR.appendChild(widgets.errorMessageBlock(dom, _context5.t0, 'pink'));
|
|
3799
4046
|
case 20:
|
|
4047
|
+
return _context5.abrupt("return", statusTR);
|
|
4048
|
+
case 21:
|
|
4049
|
+
_context5.next = 23;
|
|
4050
|
+
return renderMessageTable(date, live);
|
|
4051
|
+
case 23:
|
|
4052
|
+
return _context5.abrupt("return", _context5.sent);
|
|
4053
|
+
case 24:
|
|
3800
4054
|
case "end":
|
|
3801
|
-
return
|
|
4055
|
+
return _context5.stop();
|
|
3802
4056
|
}
|
|
3803
|
-
},
|
|
4057
|
+
}, _callee5, null, [[2, 7]]);
|
|
3804
4058
|
}));
|
|
3805
4059
|
return _createMessageTable.apply(this, arguments);
|
|
3806
4060
|
};
|
|
3807
|
-
createMessageTable = function _createMessageTable2(
|
|
4061
|
+
createMessageTable = function _createMessageTable2(_x16, _x17) {
|
|
3808
4062
|
return _createMessageTable.apply(this, arguments);
|
|
3809
4063
|
};
|
|
3810
4064
|
removePreviousMessages = function _removePreviousMessag(backwards, messageTable) {
|
|
@@ -3823,32 +4077,40 @@ function _infiniteMessageArea() {
|
|
|
3823
4077
|
extr.messageTable = messageTable;
|
|
3824
4078
|
};
|
|
3825
4079
|
_insertPreviousMessages = function _insertPreviousMessag2() {
|
|
3826
|
-
_insertPreviousMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
4080
|
+
_insertPreviousMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(backwards) {
|
|
3827
4081
|
var extremity, date, live, todayDoc, doc, newMessageTable;
|
|
3828
|
-
return _regenerator["default"].wrap(function
|
|
3829
|
-
while (1) switch (
|
|
4082
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
4083
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
3830
4084
|
case 0:
|
|
3831
4085
|
extremity = backwards ? earliest : latest;
|
|
3832
4086
|
date = extremity.messageTable.date; // day in mssecs
|
|
3833
|
-
|
|
3834
|
-
|
|
4087
|
+
// Are we at the top of a thread?
|
|
4088
|
+
if (!(backwards && earliest.limit && date <= earliest.limit)) {
|
|
4089
|
+
_context4.next = 4;
|
|
4090
|
+
break;
|
|
4091
|
+
}
|
|
4092
|
+
return _context4.abrupt("return", true);
|
|
3835
4093
|
case 4:
|
|
3836
|
-
|
|
4094
|
+
_context4.next = 6;
|
|
4095
|
+
return dateFolder.loadPrevious(date, backwards);
|
|
4096
|
+
case 6:
|
|
4097
|
+
date = _context4.sent;
|
|
3837
4098
|
// backwards
|
|
4099
|
+
|
|
3838
4100
|
debug.log("insertPreviousMessages: from ".concat(backwards ? 'backwards' : 'forwards', " loadPrevious: ").concat(date));
|
|
3839
4101
|
if (!(!date && !backwards && !liveMessageTable)) {
|
|
3840
|
-
|
|
4102
|
+
_context4.next = 11;
|
|
3841
4103
|
break;
|
|
3842
4104
|
}
|
|
3843
|
-
|
|
4105
|
+
_context4.next = 11;
|
|
3844
4106
|
return appendCurrentMessages();
|
|
3845
|
-
case
|
|
4107
|
+
case 11:
|
|
3846
4108
|
if (date) {
|
|
3847
|
-
|
|
4109
|
+
_context4.next = 13;
|
|
3848
4110
|
break;
|
|
3849
4111
|
}
|
|
3850
|
-
return
|
|
3851
|
-
case
|
|
4112
|
+
return _context4.abrupt("return", true);
|
|
4113
|
+
case 13:
|
|
3852
4114
|
// done
|
|
3853
4115
|
live = false;
|
|
3854
4116
|
if (!backwards) {
|
|
@@ -3856,10 +4118,10 @@ function _infiniteMessageArea() {
|
|
|
3856
4118
|
doc = dateFolder.leafDocumentFromDate(date);
|
|
3857
4119
|
live = doc.sameTerm(todayDoc); // Is this todays?
|
|
3858
4120
|
}
|
|
3859
|
-
|
|
4121
|
+
_context4.next = 17;
|
|
3860
4122
|
return createMessageTable(date, live);
|
|
3861
|
-
case
|
|
3862
|
-
newMessageTable =
|
|
4123
|
+
case 17:
|
|
4124
|
+
newMessageTable = _context4.sent;
|
|
3863
4125
|
extremity.messageTable = newMessageTable; // move pointer to earliest
|
|
3864
4126
|
if (backwards ? newestFirst : !newestFirst) {
|
|
3865
4127
|
// put on bottom or top
|
|
@@ -3868,62 +4130,160 @@ function _infiniteMessageArea() {
|
|
|
3868
4130
|
// put on top as we scroll back
|
|
3869
4131
|
div.insertBefore(newMessageTable, div.firstChild);
|
|
3870
4132
|
}
|
|
3871
|
-
return
|
|
3872
|
-
case
|
|
4133
|
+
return _context4.abrupt("return", live);
|
|
4134
|
+
case 21:
|
|
3873
4135
|
case "end":
|
|
3874
|
-
return
|
|
4136
|
+
return _context4.stop();
|
|
3875
4137
|
}
|
|
3876
|
-
},
|
|
4138
|
+
}, _callee4);
|
|
3877
4139
|
}));
|
|
3878
4140
|
return _insertPreviousMessages.apply(this, arguments);
|
|
3879
4141
|
};
|
|
3880
|
-
insertPreviousMessages = function _insertPreviousMessag(
|
|
4142
|
+
insertPreviousMessages = function _insertPreviousMessag(_x15) {
|
|
3881
4143
|
return _insertPreviousMessages.apply(this, arguments);
|
|
3882
4144
|
};
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
4145
|
+
_addMessage = function _addMessage3() {
|
|
4146
|
+
_addMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(message, messageTable) {
|
|
4147
|
+
var thread, id;
|
|
4148
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
4149
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
4150
|
+
case 0:
|
|
4151
|
+
if (!((0, _chatLogic.isDeleted)(message) && !options.showDeletedMessages)) {
|
|
4152
|
+
_context3.next = 2;
|
|
4153
|
+
break;
|
|
4154
|
+
}
|
|
4155
|
+
return _context3.abrupt("return");
|
|
4156
|
+
case 2:
|
|
4157
|
+
if (!(0, _chatLogic.isReplaced)(message)) {
|
|
4158
|
+
_context3.next = 4;
|
|
4159
|
+
break;
|
|
4160
|
+
}
|
|
4161
|
+
return _context3.abrupt("return");
|
|
4162
|
+
case 4:
|
|
4163
|
+
thread = _solidLogic.store.any(null, ns.sioc('has_member'), message, message.doc());
|
|
4164
|
+
id = _solidLogic.store.any(message, ns.sioc('id'), null, message.doc());
|
|
4165
|
+
if (id && !thread) {
|
|
4166
|
+
thread = _solidLogic.store.any(null, ns.sioc('has_member'), id, message.doc());
|
|
4167
|
+
}
|
|
4168
|
+
if (!options.thread) {
|
|
4169
|
+
_context3.next = 20;
|
|
4170
|
+
break;
|
|
4171
|
+
}
|
|
4172
|
+
if (!_solidLogic.store.holds(message, ns.sioc('has_reply'), options.thread)) {
|
|
4173
|
+
_context3.next = 12;
|
|
4174
|
+
break;
|
|
4175
|
+
}
|
|
4176
|
+
// root of thread
|
|
4177
|
+
debug.log(' addMessage: displaying root of thread ' + thread);
|
|
4178
|
+
_context3.next = 18;
|
|
4179
|
+
break;
|
|
4180
|
+
case 12:
|
|
4181
|
+
if (!(thread && thread.sameTerm(options.thread))) {
|
|
4182
|
+
_context3.next = 16;
|
|
4183
|
+
break;
|
|
4184
|
+
}
|
|
4185
|
+
debug.log(' addMessage: Displaying body of thread ' + message.uri.slice(-10));
|
|
4186
|
+
_context3.next = 18;
|
|
4187
|
+
break;
|
|
4188
|
+
case 16:
|
|
4189
|
+
debug.log(' addMessage: Suppress non-thread message in thread table ' + message.uri.slice(-10));
|
|
4190
|
+
return _context3.abrupt("return");
|
|
4191
|
+
case 18:
|
|
4192
|
+
_context3.next = 26;
|
|
4193
|
+
break;
|
|
4194
|
+
case 20:
|
|
4195
|
+
if (!thread) {
|
|
4196
|
+
_context3.next = 25;
|
|
4197
|
+
break;
|
|
4198
|
+
}
|
|
4199
|
+
debug.log(' addMessage: Suppress thread message in non-thread table ' + message.uri.slice(-10));
|
|
4200
|
+
return _context3.abrupt("return");
|
|
4201
|
+
case 25:
|
|
4202
|
+
debug.log(' addMessage: Normal non-thread message in non-thread table ' + message.uri.slice(-10));
|
|
4203
|
+
case 26:
|
|
4204
|
+
_context3.next = 28;
|
|
4205
|
+
return insertMessageIntoTable(channelObject, messageTable, message, messageTable.fresh, options, userContext);
|
|
4206
|
+
case 28:
|
|
4207
|
+
case "end":
|
|
4208
|
+
return _context3.stop();
|
|
4209
|
+
}
|
|
4210
|
+
}, _callee3);
|
|
4211
|
+
}));
|
|
4212
|
+
return _addMessage.apply(this, arguments);
|
|
3891
4213
|
};
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
4214
|
+
addMessage = function _addMessage2(_x13, _x14) {
|
|
4215
|
+
return _addMessage.apply(this, arguments);
|
|
4216
|
+
};
|
|
4217
|
+
_syncMessages = function _syncMessages3() {
|
|
4218
|
+
_syncMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(chatChannel, messageTable) {
|
|
4219
|
+
var displayed, ele, ele2, messages, stored, _iterator, _step, m;
|
|
4220
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
4221
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
4222
|
+
case 0:
|
|
4223
|
+
displayed = {};
|
|
4224
|
+
for (ele = messageTable.firstChild; ele; ele = ele.nextSibling) {
|
|
4225
|
+
if (ele.AJAR_subject) {
|
|
4226
|
+
displayed[ele.AJAR_subject.uri] = true;
|
|
4227
|
+
}
|
|
4228
|
+
}
|
|
4229
|
+
messages = _solidLogic.store.each(chatChannel, ns.wf('message'), null, messageTable.chatDocument);
|
|
4230
|
+
stored = {};
|
|
4231
|
+
_iterator = _createForOfIteratorHelper(messages);
|
|
4232
|
+
_context2.prev = 5;
|
|
4233
|
+
_iterator.s();
|
|
4234
|
+
case 7:
|
|
4235
|
+
if ((_step = _iterator.n()).done) {
|
|
4236
|
+
_context2.next = 15;
|
|
4237
|
+
break;
|
|
4238
|
+
}
|
|
4239
|
+
m = _step.value;
|
|
4240
|
+
stored[m.uri] = true;
|
|
4241
|
+
if (displayed[m.uri]) {
|
|
4242
|
+
_context2.next = 13;
|
|
4243
|
+
break;
|
|
4244
|
+
}
|
|
4245
|
+
_context2.next = 13;
|
|
4246
|
+
return addMessage(m, messageTable);
|
|
4247
|
+
case 13:
|
|
4248
|
+
_context2.next = 7;
|
|
4249
|
+
break;
|
|
4250
|
+
case 15:
|
|
4251
|
+
_context2.next = 20;
|
|
4252
|
+
break;
|
|
4253
|
+
case 17:
|
|
4254
|
+
_context2.prev = 17;
|
|
4255
|
+
_context2.t0 = _context2["catch"](5);
|
|
4256
|
+
_iterator.e(_context2.t0);
|
|
4257
|
+
case 20:
|
|
4258
|
+
_context2.prev = 20;
|
|
4259
|
+
_iterator.f();
|
|
4260
|
+
return _context2.finish(20);
|
|
4261
|
+
case 23:
|
|
4262
|
+
// eslint-disable-next-line space-in-parens
|
|
4263
|
+
for (ele = messageTable.firstChild; ele;) {
|
|
4264
|
+
ele2 = ele.nextSibling;
|
|
4265
|
+
if (ele.AJAR_subject && !stored[ele.AJAR_subject.uri]) {
|
|
4266
|
+
messageTable.removeChild(ele);
|
|
4267
|
+
}
|
|
4268
|
+
ele = ele2;
|
|
4269
|
+
}
|
|
4270
|
+
for (ele = messageTable.firstChild; ele; ele = ele.nextSibling) {
|
|
4271
|
+
if (ele.AJAR_subject) {
|
|
4272
|
+
// Refresh thumbs up etc
|
|
4273
|
+
widgets.refreshTree(ele); // Things inside may have changed too
|
|
4274
|
+
}
|
|
4275
|
+
}
|
|
4276
|
+
case 25:
|
|
4277
|
+
case "end":
|
|
4278
|
+
return _context2.stop();
|
|
4279
|
+
}
|
|
4280
|
+
}, _callee2, null, [[5, 17, 20, 23]]);
|
|
4281
|
+
}));
|
|
4282
|
+
return _syncMessages.apply(this, arguments);
|
|
4283
|
+
};
|
|
4284
|
+
syncMessages = function _syncMessages2(_x11, _x12) {
|
|
4285
|
+
return _syncMessages.apply(this, arguments);
|
|
3925
4286
|
};
|
|
3926
|
-
|
|
3927
4287
|
// Body of main function
|
|
3928
4288
|
|
|
3929
4289
|
options = options || {};
|
|
@@ -3939,23 +4299,33 @@ function _infiniteMessageArea() {
|
|
|
3939
4299
|
statusArea: statusArea,
|
|
3940
4300
|
div: statusArea
|
|
3941
4301
|
}; // logged on state, pointers to user's stuff
|
|
3942
|
-
// const messageTable = dom.createElement('table') // @@ check does this go in renderMessageTable
|
|
3943
4302
|
earliest = {
|
|
3944
4303
|
messageTable: null
|
|
3945
4304
|
}; // Stuff about each end of the loaded days
|
|
3946
4305
|
latest = {
|
|
3947
4306
|
messageTable: null
|
|
3948
4307
|
};
|
|
4308
|
+
if (options.thread) {
|
|
4309
|
+
thread = options.thread;
|
|
4310
|
+
threadRootMessage = _solidLogic.store.any(null, ns.sioc('has_reply'), thread, thread.doc());
|
|
4311
|
+
if (threadRootMessage) {
|
|
4312
|
+
threadTime = _solidLogic.store.any(threadRootMessage, ns.dct('created'), null, threadRootMessage.doc());
|
|
4313
|
+
if (threadTime) {
|
|
4314
|
+
earliest.limit = new Date(threadTime.value);
|
|
4315
|
+
debug.log(' inifinite: thread start at ' + earliest.limit);
|
|
4316
|
+
}
|
|
4317
|
+
}
|
|
4318
|
+
}
|
|
3949
4319
|
lock = false;
|
|
3950
|
-
|
|
4320
|
+
_context15.next = 34;
|
|
3951
4321
|
return loadInitialContent();
|
|
3952
|
-
case
|
|
3953
|
-
return
|
|
3954
|
-
case
|
|
4322
|
+
case 34:
|
|
4323
|
+
return _context15.abrupt("return", div);
|
|
4324
|
+
case 35:
|
|
3955
4325
|
case "end":
|
|
3956
|
-
return
|
|
4326
|
+
return _context15.stop();
|
|
3957
4327
|
}
|
|
3958
|
-
},
|
|
4328
|
+
}, _callee15);
|
|
3959
4329
|
}));
|
|
3960
4330
|
return _infiniteMessageArea.apply(this, arguments);
|
|
3961
4331
|
}
|
|
@@ -3984,6 +4354,7 @@ exports.renderMessageEditor = renderMessageEditor;
|
|
|
3984
4354
|
exports.renderMessageRow = renderMessageRow;
|
|
3985
4355
|
exports.switchToEditor = switchToEditor;
|
|
3986
4356
|
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
|
|
4357
|
+
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js"));
|
|
3987
4358
|
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
3988
4359
|
var _infinite = __webpack_require__(/*! ./infinite */ "./lib/chat/infinite.js");
|
|
3989
4360
|
var _messageTools = __webpack_require__(/*! ./messageTools */ "./lib/chat/messageTools.js");
|
|
@@ -4001,7 +4372,9 @@ var utils = _interopRequireWildcard(__webpack_require__(/*! ../utils */ "./lib/u
|
|
|
4001
4372
|
var widgets = _interopRequireWildcard(__webpack_require__(/*! ../widgets */ "./lib/widgets/index.js"));
|
|
4002
4373
|
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); }
|
|
4003
4374
|
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; }
|
|
4004
|
-
function
|
|
4375
|
+
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; }
|
|
4376
|
+
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; }
|
|
4377
|
+
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; } } }; }
|
|
4005
4378
|
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); }
|
|
4006
4379
|
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; }
|
|
4007
4380
|
var dom = window.document;
|
|
@@ -4080,122 +4453,232 @@ function creatorAndDateHorizontal(td1, creator, date, message) {
|
|
|
4080
4453
|
/**
|
|
4081
4454
|
* Renders a chat message, read-only mode
|
|
4082
4455
|
*/
|
|
4083
|
-
function renderMessageRow(
|
|
4084
|
-
|
|
4085
|
-
var creator = _solidLogic.store.any(message, ns.foaf('maker'));
|
|
4086
|
-
var date = _solidLogic.store.any(message, ns.dct('created'));
|
|
4087
|
-
var latestVersion = (0, _chatLogic.mostRecentVersion)(message);
|
|
4088
|
-
var content = _solidLogic.store.any(latestVersion, ns.sioc('content'));
|
|
4089
|
-
var originalMessage = (0, _chatLogic.originalVersion)(message);
|
|
4090
|
-
var edited = !message.sameTerm(originalMessage);
|
|
4091
|
-
var sortDate = _solidLogic.store.the(originalMessage, ns.dct('created'), null, originalMessage.doc()); // In message
|
|
4092
|
-
|
|
4093
|
-
var messageRow = dom.createElement('tr');
|
|
4094
|
-
messageRow.AJAR_date = sortDate.value;
|
|
4095
|
-
messageRow.AJAR_subject = message;
|
|
4096
|
-
var td1 = dom.createElement('td');
|
|
4097
|
-
messageRow.appendChild(td1);
|
|
4098
|
-
if (!options.authorDateOnLeft) {
|
|
4099
|
-
var img = dom.createElement('img');
|
|
4100
|
-
img.setAttribute('style', 'max-height: 2.5em; max-width: 2.5em; border-radius: 0.5em; margin: auto;');
|
|
4101
|
-
widgets.setImage(img, creator);
|
|
4102
|
-
td1.appendChild(img);
|
|
4103
|
-
} else {
|
|
4104
|
-
creatorAndDate(td1, creator, widgets.shortDate(sortDate.value), message);
|
|
4105
|
-
}
|
|
4106
|
-
var bothDates = widgets.shortDate(sortDate.value);
|
|
4107
|
-
if (edited) {
|
|
4108
|
-
bothDates += ' ... ' + widgets.shortDate(date.value);
|
|
4109
|
-
}
|
|
4110
|
-
|
|
4111
|
-
// Render the content ot the message itself
|
|
4112
|
-
var td2 = messageRow.appendChild(dom.createElement('td'));
|
|
4113
|
-
if (!options.authorDateOnLeft) {
|
|
4114
|
-
creatorAndDateHorizontal(td2, creator, bothDates,
|
|
4115
|
-
// widgets.shortDate(dateString)
|
|
4116
|
-
message);
|
|
4117
|
-
}
|
|
4118
|
-
var text = content.value.trim();
|
|
4119
|
-
var isURI = /^https?:\/[^ <>]*$/i.test(text);
|
|
4120
|
-
var para = null;
|
|
4121
|
-
if (isURI) {
|
|
4122
|
-
var isImage = /\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(text); // @@ Should use content-type not URI
|
|
4123
|
-
if (isImage && options.expandImagesInline) {
|
|
4124
|
-
var _img = elementForImageURI(text, options);
|
|
4125
|
-
td2.appendChild(_img);
|
|
4126
|
-
} else {
|
|
4127
|
-
// Link but not Image
|
|
4128
|
-
var anc = td2.appendChild(dom.createElement('a'));
|
|
4129
|
-
para = anc.appendChild(dom.createElement('p'));
|
|
4130
|
-
anc.href = text;
|
|
4131
|
-
para.textContent = text;
|
|
4132
|
-
td2.appendChild(anc);
|
|
4133
|
-
}
|
|
4134
|
-
} else {
|
|
4135
|
-
// text
|
|
4136
|
-
para = dom.createElement('p');
|
|
4137
|
-
td2.appendChild(para);
|
|
4138
|
-
para.textContent = text;
|
|
4139
|
-
}
|
|
4140
|
-
if (para) {
|
|
4141
|
-
var bgcolor = colorizeByAuthor ? pad.lightColorHash(creator) : getBgColor(fresh);
|
|
4142
|
-
para.setAttribute('style', messageBodyStyle + 'background-color: ' + bgcolor + ';');
|
|
4143
|
-
}
|
|
4144
|
-
function getBgColor(fresh) {
|
|
4145
|
-
return fresh ? '#e8ffe8' : 'white';
|
|
4146
|
-
}
|
|
4147
|
-
|
|
4148
|
-
// Sentiment strip
|
|
4149
|
-
var strip = (0, _messageTools.sentimentStripLinked)(message, message.doc());
|
|
4150
|
-
if (strip.children.length) {
|
|
4151
|
-
td2.appendChild(dom.createElement('br'));
|
|
4152
|
-
td2.appendChild(strip);
|
|
4153
|
-
}
|
|
4154
|
-
|
|
4155
|
-
// Message tool bar button
|
|
4156
|
-
var td3 = dom.createElement('td');
|
|
4157
|
-
messageRow.appendChild(td3);
|
|
4158
|
-
var toolsButton = widgets.button(dom, _iconBase.icons.iconBase + 'noun_243787.svg', '...');
|
|
4159
|
-
td3.appendChild(toolsButton);
|
|
4160
|
-
toolsButton.addEventListener('click', function (_event) {
|
|
4161
|
-
if (messageRow.toolTR) {
|
|
4162
|
-
// already got a toolbar? Toogle
|
|
4163
|
-
messageRow.parentNode.removeChild(messageRow.toolTR);
|
|
4164
|
-
delete messageRow.toolTR;
|
|
4165
|
-
return;
|
|
4166
|
-
}
|
|
4167
|
-
var toolsTR = dom.createElement('tr');
|
|
4168
|
-
var tools = (0, _messageTools.messageToolbar)(message, messageRow, userContext, channelObject);
|
|
4169
|
-
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
|
|
4170
|
-
if (messageRow.nextSibling) {
|
|
4171
|
-
messageRow.parentElement.insertBefore(toolsTR, messageRow.nextSibling);
|
|
4172
|
-
} else {
|
|
4173
|
-
messageRow.parentElement.appendChild(toolsTR);
|
|
4174
|
-
}
|
|
4175
|
-
messageRow.toolTR = toolsTR;
|
|
4176
|
-
toolsTR.appendChild(dom.createElement('td')); // left
|
|
4177
|
-
var toolsTD = toolsTR.appendChild(dom.createElement('td'));
|
|
4178
|
-
toolsTR.appendChild(dom.createElement('td')); // right
|
|
4179
|
-
toolsTD.appendChild(tools);
|
|
4180
|
-
});
|
|
4181
|
-
return messageRow;
|
|
4456
|
+
function renderMessageRow(_x, _x2, _x3, _x4, _x5) {
|
|
4457
|
+
return _renderMessageRow.apply(this, arguments);
|
|
4182
4458
|
}
|
|
4183
|
-
function
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4459
|
+
function _renderMessageRow() {
|
|
4460
|
+
_renderMessageRow = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(channelObject, message, fresh, options, userContext) {
|
|
4461
|
+
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;
|
|
4462
|
+
return _regenerator["default"].wrap(function _callee9$(_context10) {
|
|
4463
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
4464
|
+
case 0:
|
|
4465
|
+
getBgColor = function _getBgColor(fresh) {
|
|
4466
|
+
return fresh ? '#e8ffe8' : 'white';
|
|
4467
|
+
};
|
|
4468
|
+
colorizeByAuthor = options.colorizeByAuthor === '1' || options.colorizeByAuthor === true;
|
|
4469
|
+
creator = _solidLogic.store.any(message, ns.foaf('maker'));
|
|
4470
|
+
date = _solidLogic.store.any(message, ns.dct('created'));
|
|
4471
|
+
_context10.next = 6;
|
|
4472
|
+
return (0, _chatLogic.mostRecentVersion)(message);
|
|
4473
|
+
case 6:
|
|
4474
|
+
latestVersion = _context10.sent;
|
|
4475
|
+
content = _solidLogic.store.any(latestVersion, ns.sioc('content')); // const id = store.any(latestVersion, ns.sioc('id'))
|
|
4476
|
+
// const replies = store.each(latestVersion, ns.sioc('has_reply'))
|
|
4477
|
+
_context10.next = 10;
|
|
4478
|
+
return (0, _chatLogic.allVersions)(message);
|
|
4479
|
+
case 10:
|
|
4480
|
+
versions = _context10.sent;
|
|
4481
|
+
if (versions.length > 1) {
|
|
4482
|
+
debug.log('renderMessageRow versions: ', versions.join(', '));
|
|
4483
|
+
}
|
|
4484
|
+
// be tolerant in accepting replies on any version of a message
|
|
4485
|
+
replies = versions.map(function (version) {
|
|
4486
|
+
return _solidLogic.store.each(version, ns.sioc('has_reply'));
|
|
4487
|
+
}).flat();
|
|
4488
|
+
thread = null;
|
|
4489
|
+
straightReplies = [];
|
|
4490
|
+
_iterator2 = _createForOfIteratorHelper(replies);
|
|
4491
|
+
try {
|
|
4492
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
4493
|
+
reply = _step2.value;
|
|
4494
|
+
if (_solidLogic.store.holds(reply, ns.rdf('type'), ns.sioc('Thread'))) {
|
|
4495
|
+
thread = reply;
|
|
4496
|
+
debug.log('renderMessageRow: found thread: ' + thread);
|
|
4497
|
+
} else {
|
|
4498
|
+
straightReplies.push(reply);
|
|
4499
|
+
}
|
|
4500
|
+
}
|
|
4501
|
+
} catch (err) {
|
|
4502
|
+
_iterator2.e(err);
|
|
4503
|
+
} finally {
|
|
4504
|
+
_iterator2.f();
|
|
4505
|
+
}
|
|
4506
|
+
if (straightReplies.length > 1) {
|
|
4507
|
+
debug.log('renderMessageRow: found normal replies: ', straightReplies);
|
|
4508
|
+
}
|
|
4509
|
+
_context10.next = 20;
|
|
4510
|
+
return (0, _chatLogic.originalVersion)(message);
|
|
4511
|
+
case 20:
|
|
4512
|
+
originalMessage = _context10.sent;
|
|
4513
|
+
edited = !message.sameTerm(originalMessage); // @@ load it first @@ Or display the new data at the old date.
|
|
4514
|
+
// @@@ kludge!
|
|
4515
|
+
sortDate = _solidLogic.store.the(originalMessage, ns.dct('created'), null, originalMessage.doc()) || _solidLogic.store.the(message, ns.dct('created'), null, message.doc()); // In message
|
|
4516
|
+
messageRow = dom.createElement('tr');
|
|
4517
|
+
messageRow.AJAR_date = sortDate.value;
|
|
4518
|
+
messageRow.AJAR_subject = message;
|
|
4519
|
+
td1 = dom.createElement('td');
|
|
4520
|
+
messageRow.appendChild(td1);
|
|
4521
|
+
if (!options.authorDateOnLeft) {
|
|
4522
|
+
img = dom.createElement('img');
|
|
4523
|
+
img.setAttribute('style', 'max-height: 2.5em; max-width: 2.5em; border-radius: 0.5em; margin: auto;');
|
|
4524
|
+
widgets.setImage(img, creator);
|
|
4525
|
+
td1.appendChild(img);
|
|
4526
|
+
} else {
|
|
4527
|
+
creatorAndDate(td1, creator, widgets.shortDate(sortDate.value), message);
|
|
4528
|
+
}
|
|
4529
|
+
bothDates = widgets.shortDate(sortDate.value);
|
|
4530
|
+
if (edited) {
|
|
4531
|
+
bothDates += ' ... ' + widgets.shortDate(date.value);
|
|
4532
|
+
}
|
|
4533
|
+
|
|
4534
|
+
// Render the content ot the message itself
|
|
4535
|
+
td2 = messageRow.appendChild(dom.createElement('td'));
|
|
4536
|
+
if (!options.authorDateOnLeft) {
|
|
4537
|
+
creatorAndDateHorizontal(td2, creator, bothDates,
|
|
4538
|
+
// widgets.shortDate(dateString)
|
|
4539
|
+
message);
|
|
4540
|
+
}
|
|
4541
|
+
text = content ? content.value.trim() : '??? no content?';
|
|
4542
|
+
isURI = /^https?:\/[^ <>]*$/i.test(text);
|
|
4543
|
+
para = null;
|
|
4544
|
+
if (isURI) {
|
|
4545
|
+
isImage = /\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(text); // @@ Should use content-type not URI
|
|
4546
|
+
if (isImage && options.expandImagesInline) {
|
|
4547
|
+
_img = elementForImageURI(text, options);
|
|
4548
|
+
td2.appendChild(_img);
|
|
4549
|
+
} else {
|
|
4550
|
+
// Link but not Image
|
|
4551
|
+
anc = td2.appendChild(dom.createElement('a'));
|
|
4552
|
+
para = anc.appendChild(dom.createElement('p'));
|
|
4553
|
+
anc.href = text;
|
|
4554
|
+
para.textContent = text;
|
|
4555
|
+
td2.appendChild(anc);
|
|
4556
|
+
}
|
|
4557
|
+
} else {
|
|
4558
|
+
// text
|
|
4559
|
+
para = dom.createElement('p');
|
|
4560
|
+
td2.appendChild(para);
|
|
4561
|
+
para.textContent = text;
|
|
4562
|
+
}
|
|
4563
|
+
if (para) {
|
|
4564
|
+
bgcolor = colorizeByAuthor ? pad.lightColorHash(creator) : getBgColor(fresh);
|
|
4565
|
+
para.setAttribute('style', messageBodyStyle + 'background-color: ' + bgcolor + ';');
|
|
4566
|
+
}
|
|
4567
|
+
_context10.next = 40;
|
|
4568
|
+
return (0, _messageTools.sentimentStripLinked)(message, message.doc());
|
|
4569
|
+
case 40:
|
|
4570
|
+
strip = _context10.sent;
|
|
4571
|
+
if (strip.children.length) {
|
|
4572
|
+
td2.appendChild(dom.createElement('br'));
|
|
4573
|
+
td2.appendChild(strip);
|
|
4574
|
+
}
|
|
4575
|
+
|
|
4576
|
+
// Message tool bar button
|
|
4577
|
+
td3 = dom.createElement('td');
|
|
4578
|
+
messageRow.appendChild(td3);
|
|
4579
|
+
toolsButton = widgets.button(dom, _iconBase.icons.iconBase + 'noun_243787.svg', '...');
|
|
4580
|
+
td3.appendChild(toolsButton);
|
|
4581
|
+
toolsButton.addEventListener('click', /*#__PURE__*/function () {
|
|
4582
|
+
var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(_event) {
|
|
4583
|
+
var toolsTR, tools, toolsTD;
|
|
4584
|
+
return _regenerator["default"].wrap(function _callee8$(_context9) {
|
|
4585
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
4586
|
+
case 0:
|
|
4587
|
+
if (!messageRow.toolTR) {
|
|
4588
|
+
_context9.next = 4;
|
|
4589
|
+
break;
|
|
4590
|
+
}
|
|
4591
|
+
// already got a toolbar? Toogle
|
|
4592
|
+
messageRow.parentNode.removeChild(messageRow.toolTR);
|
|
4593
|
+
delete messageRow.toolTR;
|
|
4594
|
+
return _context9.abrupt("return");
|
|
4595
|
+
case 4:
|
|
4596
|
+
toolsTR = dom.createElement('tr');
|
|
4597
|
+
_context9.next = 7;
|
|
4598
|
+
return (0, _messageTools.messageToolbar)(message, messageRow, _objectSpread(_objectSpread({}, userContext), {}, {
|
|
4599
|
+
chatOptions: options
|
|
4600
|
+
}), channelObject);
|
|
4601
|
+
case 7:
|
|
4602
|
+
tools = _context9.sent;
|
|
4603
|
+
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
|
|
4604
|
+
if (messageRow.nextSibling) {
|
|
4605
|
+
messageRow.parentElement.insertBefore(toolsTR, messageRow.nextSibling);
|
|
4606
|
+
} else {
|
|
4607
|
+
messageRow.parentElement.appendChild(toolsTR);
|
|
4608
|
+
}
|
|
4609
|
+
messageRow.toolTR = toolsTR;
|
|
4610
|
+
toolsTR.appendChild(dom.createElement('td')); // left
|
|
4611
|
+
toolsTD = toolsTR.appendChild(dom.createElement('td'));
|
|
4612
|
+
toolsTR.appendChild(dom.createElement('td')); // right
|
|
4613
|
+
toolsTD.appendChild(tools);
|
|
4614
|
+
case 15:
|
|
4615
|
+
case "end":
|
|
4616
|
+
return _context9.stop();
|
|
4617
|
+
}
|
|
4618
|
+
}, _callee8);
|
|
4619
|
+
}));
|
|
4620
|
+
return function (_x20) {
|
|
4621
|
+
return _ref4.apply(this, arguments);
|
|
4622
|
+
};
|
|
4623
|
+
}());
|
|
4624
|
+
if (thread && options.showThread) {
|
|
4625
|
+
debug.log(' message has thread ' + thread);
|
|
4626
|
+
td3.appendChild(widgets.button(dom, _iconBase.icons.iconBase + 'noun_1180164.svg',
|
|
4627
|
+
// right arrow .. @@ think of stg better
|
|
4628
|
+
'see thread', function (_e) {
|
|
4629
|
+
debug.log('@@@@ Calling showThread thread ' + thread);
|
|
4630
|
+
options.showThread(thread, options);
|
|
4631
|
+
}));
|
|
4632
|
+
}
|
|
4633
|
+
return _context10.abrupt("return", messageRow);
|
|
4634
|
+
case 49:
|
|
4635
|
+
case "end":
|
|
4636
|
+
return _context10.stop();
|
|
4637
|
+
}
|
|
4638
|
+
}, _callee9);
|
|
4639
|
+
}));
|
|
4640
|
+
return _renderMessageRow.apply(this, arguments);
|
|
4641
|
+
}
|
|
4642
|
+
function switchToEditor(_x6, _x7, _x8, _x9) {
|
|
4643
|
+
return _switchToEditor.apply(this, arguments);
|
|
4189
4644
|
}
|
|
4190
4645
|
/* Control for a new message -- or editing an old message ***************
|
|
4191
4646
|
*
|
|
4192
4647
|
*/
|
|
4648
|
+
function _switchToEditor() {
|
|
4649
|
+
_switchToEditor = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(messageRow, message, channelObject, userContext) {
|
|
4650
|
+
var messageTable, editRow;
|
|
4651
|
+
return _regenerator["default"].wrap(function _callee10$(_context11) {
|
|
4652
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
4653
|
+
case 0:
|
|
4654
|
+
messageTable = messageRow.parentNode;
|
|
4655
|
+
_context11.t0 = renderMessageEditor;
|
|
4656
|
+
_context11.t1 = channelObject;
|
|
4657
|
+
_context11.t2 = messageTable;
|
|
4658
|
+
_context11.t3 = userContext;
|
|
4659
|
+
_context11.t4 = channelObject.options;
|
|
4660
|
+
_context11.next = 8;
|
|
4661
|
+
return (0, _chatLogic.mostRecentVersion)(message);
|
|
4662
|
+
case 8:
|
|
4663
|
+
_context11.t5 = _context11.sent;
|
|
4664
|
+
editRow = (0, _context11.t0)(_context11.t1, _context11.t2, _context11.t3, _context11.t4, _context11.t5);
|
|
4665
|
+
messageTable.insertBefore(editRow, messageRow);
|
|
4666
|
+
editRow.originalRow = messageRow;
|
|
4667
|
+
messageRow.style.visibility = 'hidden'; // Hide the original message. unhide if user cancels edit
|
|
4668
|
+
case 13:
|
|
4669
|
+
case "end":
|
|
4670
|
+
return _context11.stop();
|
|
4671
|
+
}
|
|
4672
|
+
}, _callee10);
|
|
4673
|
+
}));
|
|
4674
|
+
return _switchToEditor.apply(this, arguments);
|
|
4675
|
+
}
|
|
4193
4676
|
function renderMessageEditor(channelObject, messageTable, userContext, options, originalMessage) {
|
|
4194
4677
|
function revertEditing(messageEditor) {
|
|
4195
4678
|
messageEditor.originalRow.style.visibility = 'visible'; // restore read-only version
|
|
4196
4679
|
messageEditor.parentNode.removeChild(messageEditor);
|
|
4197
4680
|
}
|
|
4198
|
-
function handleFieldInput(
|
|
4681
|
+
function handleFieldInput(_x10) {
|
|
4199
4682
|
return _handleFieldInput.apply(this, arguments);
|
|
4200
4683
|
}
|
|
4201
4684
|
function _handleFieldInput() {
|
|
@@ -4213,72 +4696,87 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4213
4696
|
}));
|
|
4214
4697
|
return _handleFieldInput.apply(this, arguments);
|
|
4215
4698
|
}
|
|
4216
|
-
function sendMessage(
|
|
4699
|
+
function sendMessage(_x11, _x12) {
|
|
4217
4700
|
return _sendMessage.apply(this, arguments);
|
|
4218
4701
|
} // sendMessage
|
|
4219
4702
|
// DRAG AND DROP
|
|
4220
4703
|
function _sendMessage() {
|
|
4221
|
-
_sendMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
4222
|
-
var sendComplete, message, statusArea;
|
|
4223
|
-
return _regenerator["default"].wrap(function
|
|
4224
|
-
while (1) switch (
|
|
4704
|
+
_sendMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(text, fromMainField) {
|
|
4705
|
+
var sendComplete, _sendComplete, message, statusArea;
|
|
4706
|
+
return _regenerator["default"].wrap(function _callee7$(_context8) {
|
|
4707
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
4225
4708
|
case 0:
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
oldRow.parentNode.removeChild(oldRow); // No longer needed old version
|
|
4237
|
-
} else {
|
|
4238
|
-
debug.warn('No parentNode on old message ' + oldRow.textContent);
|
|
4239
|
-
oldRow.style.backgroundColor = '#fee';
|
|
4240
|
-
oldRow.style.visibility = 'hidden'; // @@ FIX THIS AND REMOVE FROM DOM INSTEAD
|
|
4241
|
-
}
|
|
4709
|
+
_sendComplete = function _sendComplete3() {
|
|
4710
|
+
_sendComplete = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(message, _text2) {
|
|
4711
|
+
var oldRow;
|
|
4712
|
+
return _regenerator["default"].wrap(function _callee6$(_context7) {
|
|
4713
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
4714
|
+
case 0:
|
|
4715
|
+
_context7.next = 2;
|
|
4716
|
+
return (0, _infinite.insertMessageIntoTable)(channelObject, messageTable, message, false, options, userContext);
|
|
4717
|
+
case 2:
|
|
4718
|
+
// not green
|
|
4242
4719
|
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
}
|
|
4254
|
-
// await channelObject.div.refresh() // Add new day if nec @@ add back
|
|
4255
|
-
};
|
|
4720
|
+
if (originalMessage) {
|
|
4721
|
+
// editing another message
|
|
4722
|
+
oldRow = messageEditor.originalRow; // oldRow.style.display = '' // restore read-only version, re-attack
|
|
4723
|
+
if (oldRow.parentNode) {
|
|
4724
|
+
oldRow.parentNode.removeChild(oldRow); // No longer needed old version
|
|
4725
|
+
} else {
|
|
4726
|
+
debug.warn('No parentNode on old message ' + oldRow.textContent);
|
|
4727
|
+
oldRow.style.backgroundColor = '#fee';
|
|
4728
|
+
oldRow.style.visibility = 'hidden'; // @@ FIX THIS AND REMOVE FROM DOM INSTEAD
|
|
4729
|
+
}
|
|
4256
4730
|
|
|
4731
|
+
messageEditor.parentNode.removeChild(messageEditor); // no longer need editor
|
|
4732
|
+
} else {
|
|
4733
|
+
if (fromMainField) {
|
|
4734
|
+
field.value = ''; // clear from out for reuse
|
|
4735
|
+
field.setAttribute('style', messageBodyStyle);
|
|
4736
|
+
field.disabled = false;
|
|
4737
|
+
field.scrollIntoView(options.newestFirst); // allign bottom (top)
|
|
4738
|
+
field.focus(); // Start typing next line immediately
|
|
4739
|
+
field.select();
|
|
4740
|
+
}
|
|
4741
|
+
}
|
|
4742
|
+
// await channelObject.div.refresh() // Add new day if nec @@ add back
|
|
4743
|
+
case 3:
|
|
4744
|
+
case "end":
|
|
4745
|
+
return _context7.stop();
|
|
4746
|
+
}
|
|
4747
|
+
}, _callee6);
|
|
4748
|
+
}));
|
|
4749
|
+
return _sendComplete.apply(this, arguments);
|
|
4750
|
+
};
|
|
4751
|
+
sendComplete = function _sendComplete2(_x18, _x19) {
|
|
4752
|
+
return _sendComplete.apply(this, arguments);
|
|
4753
|
+
};
|
|
4257
4754
|
// const me = authn.currentUser() // Must be logged on or wuld have got login button
|
|
4258
4755
|
if (fromMainField) {
|
|
4259
4756
|
field.setAttribute('style', messageBodyStyle + 'color: #bbb;'); // pendingedit
|
|
4260
4757
|
field.disabled = true;
|
|
4261
4758
|
}
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
return channelObject.updateMessage(text, originalMessage);
|
|
4265
|
-
case
|
|
4266
|
-
message =
|
|
4267
|
-
|
|
4759
|
+
_context8.prev = 3;
|
|
4760
|
+
_context8.next = 6;
|
|
4761
|
+
return channelObject.updateMessage(text, originalMessage, null, options.thread);
|
|
4762
|
+
case 6:
|
|
4763
|
+
message = _context8.sent;
|
|
4764
|
+
_context8.next = 14;
|
|
4268
4765
|
break;
|
|
4269
|
-
case
|
|
4270
|
-
|
|
4271
|
-
|
|
4766
|
+
case 9:
|
|
4767
|
+
_context8.prev = 9;
|
|
4768
|
+
_context8.t0 = _context8["catch"](3);
|
|
4272
4769
|
statusArea = userContext.statusArea || messageEditor;
|
|
4273
|
-
statusArea.appendChild(widgets.errorMessageBlock(dom, 'Error writing message: ' +
|
|
4274
|
-
return
|
|
4275
|
-
case 13:
|
|
4276
|
-
sendComplete(message, text);
|
|
4770
|
+
statusArea.appendChild(widgets.errorMessageBlock(dom, 'Error writing message: ' + _context8.t0));
|
|
4771
|
+
return _context8.abrupt("return");
|
|
4277
4772
|
case 14:
|
|
4773
|
+
_context8.next = 16;
|
|
4774
|
+
return sendComplete(message, text);
|
|
4775
|
+
case 16:
|
|
4278
4776
|
case "end":
|
|
4279
|
-
return
|
|
4777
|
+
return _context8.stop();
|
|
4280
4778
|
}
|
|
4281
|
-
},
|
|
4779
|
+
}, _callee7, null, [[3, 9]]);
|
|
4282
4780
|
}));
|
|
4283
4781
|
return _sendMessage.apply(this, arguments);
|
|
4284
4782
|
}
|
|
@@ -4297,7 +4795,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4297
4795
|
}
|
|
4298
4796
|
}, _callee);
|
|
4299
4797
|
}));
|
|
4300
|
-
return function (
|
|
4798
|
+
return function (_x13, _x14) {
|
|
4301
4799
|
return _ref.apply(this, arguments);
|
|
4302
4800
|
};
|
|
4303
4801
|
}());
|
|
@@ -4341,7 +4839,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4341
4839
|
}
|
|
4342
4840
|
}, _callee2, null, [[1, 11, 14, 17]]);
|
|
4343
4841
|
}));
|
|
4344
|
-
return function droppedURIHandler(
|
|
4842
|
+
return function droppedURIHandler(_x15) {
|
|
4345
4843
|
return _ref2.apply(this, arguments);
|
|
4346
4844
|
};
|
|
4347
4845
|
}();
|
|
@@ -4352,7 +4850,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4352
4850
|
imageDoc = $rdf.sym(chatDocument.dir().uri + 'Image_' + Date.now() + '.png');
|
|
4353
4851
|
return imageDoc;
|
|
4354
4852
|
}
|
|
4355
|
-
function tookPicture(
|
|
4853
|
+
function tookPicture(_x16) {
|
|
4356
4854
|
return _tookPicture.apply(this, arguments);
|
|
4357
4855
|
} // Body of turnOnInput
|
|
4358
4856
|
function _tookPicture() {
|
|
@@ -4429,7 +4927,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4429
4927
|
}
|
|
4430
4928
|
}, _callee3);
|
|
4431
4929
|
}));
|
|
4432
|
-
return function (
|
|
4930
|
+
return function (_x17) {
|
|
4433
4931
|
return _ref3.apply(this, arguments);
|
|
4434
4932
|
};
|
|
4435
4933
|
}(), false);
|
|
@@ -4491,7 +4989,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4491
4989
|
turnOnInput();
|
|
4492
4990
|
Object.assign(context, userContext);
|
|
4493
4991
|
(0, _bookmarks.findBookmarkDocument)(context).then(function (_context) {
|
|
4494
|
-
//
|
|
4992
|
+
// debug.log('Bookmark file: ' + context.bookmarkDocument)
|
|
4495
4993
|
});
|
|
4496
4994
|
});
|
|
4497
4995
|
return messageEditor;
|
|
@@ -4514,12 +5012,15 @@ var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_m
|
|
|
4514
5012
|
Object.defineProperty(exports, "__esModule", ({
|
|
4515
5013
|
value: true
|
|
4516
5014
|
}));
|
|
5015
|
+
exports.ActionClassFromEmoji = ActionClassFromEmoji;
|
|
5016
|
+
exports.emojiFromAction = emojiFromAction;
|
|
5017
|
+
exports.emojiFromActionClass = emojiFromActionClass;
|
|
4517
5018
|
exports.messageToolbar = messageToolbar;
|
|
4518
5019
|
exports.sentimentStrip = sentimentStrip;
|
|
4519
5020
|
exports.sentimentStripLinked = sentimentStripLinked;
|
|
4520
5021
|
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
|
|
4521
|
-
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
4522
5022
|
var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "./node_modules/@babel/runtime/helpers/slicedToArray.js"));
|
|
5023
|
+
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
4523
5024
|
var debug = _interopRequireWildcard(__webpack_require__(/*! ../debug */ "./lib/debug.js"));
|
|
4524
5025
|
var _iconBase = __webpack_require__(/*! ../iconBase */ "./lib/iconBase.js");
|
|
4525
5026
|
var ns = _interopRequireWildcard(__webpack_require__(/*! ../ns */ "./lib/ns.js"));
|
|
@@ -4560,30 +5061,46 @@ var PENCIL_ICON = 'noun_253504.svg'; // edit a message
|
|
|
4560
5061
|
// const SPANNER_ICON = 'noun_344563.svg' -> settings
|
|
4561
5062
|
var THUMBS_UP_ICON = 'noun_1384132.svg';
|
|
4562
5063
|
var THUMBS_DOWN_ICON = 'noun_1384135.svg';
|
|
5064
|
+
var REPLY_ICON = 'noun-reply-5506924.svg';
|
|
4563
5065
|
/**
|
|
4564
5066
|
* Emoji in Unicode
|
|
4565
5067
|
*/
|
|
4566
|
-
var
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
5068
|
+
var emojiMap = {};
|
|
5069
|
+
emojiMap[ns.schema('AgreeAction')] = '👍';
|
|
5070
|
+
emojiMap[ns.schema('DisagreeAction')] = '👎';
|
|
5071
|
+
emojiMap[ns.schema('EndorseAction')] = '⭐️';
|
|
5072
|
+
emojiMap[ns.schema('LikeAction')] = '❤️';
|
|
5073
|
+
function emojiFromActionClass(action) {
|
|
5074
|
+
return emojiMap[action] || null;
|
|
5075
|
+
}
|
|
5076
|
+
function ActionClassFromEmoji(emoji) {
|
|
5077
|
+
for (var a in emojiMap) {
|
|
5078
|
+
if (emojiMap[a] === emoji) {
|
|
5079
|
+
return rdf.sym(a.slice(1, -1)); // remove < >
|
|
5080
|
+
}
|
|
5081
|
+
}
|
|
5082
|
+
|
|
5083
|
+
return null;
|
|
5084
|
+
}
|
|
5085
|
+
|
|
5086
|
+
// Allow the action to give its own emoji as content,
|
|
5087
|
+
// or get the emoji from the class of action.
|
|
5088
|
+
function emojiFromAction(action) {
|
|
5089
|
+
var content = _solidLogic.store.any(action, ns.sioc('content'), null, action.doc());
|
|
5090
|
+
if (content) return content;
|
|
5091
|
+
var klass = _solidLogic.store.any(action, ns.rdf('type'), null, action.doc());
|
|
5092
|
+
if (klass) {
|
|
5093
|
+
var em = emojiFromActionClass(klass);
|
|
5094
|
+
if (em) return em;
|
|
5095
|
+
}
|
|
5096
|
+
return '⬜️';
|
|
5097
|
+
}
|
|
4571
5098
|
|
|
4572
5099
|
/**
|
|
4573
5100
|
* Create strip of sentiments expressed
|
|
4574
5101
|
*/
|
|
4575
|
-
function sentimentStrip(
|
|
4576
|
-
|
|
4577
|
-
var latest = (0, _chatLogic.mostRecentVersion)(target);
|
|
4578
|
-
var actions = _solidLogic.store.holds(latest, ns.schema('dateDeleted').value, null, latest.doc()) ? _solidLogic.store.each(null, ns.schema('target'), target, doc) : [];
|
|
4579
|
-
var sentiments = actions.map(function (a) {
|
|
4580
|
-
return _solidLogic.store.any(a, ns.rdf('type'), null, doc);
|
|
4581
|
-
});
|
|
4582
|
-
sentiments.sort();
|
|
4583
|
-
var strings = sentiments.map(function (x) {
|
|
4584
|
-
return emoji[x] || '';
|
|
4585
|
-
});
|
|
4586
|
-
return dom.createTextNode(strings.join(' '));
|
|
5102
|
+
function sentimentStrip(_x, _x2) {
|
|
5103
|
+
return _sentimentStrip.apply(this, arguments);
|
|
4587
5104
|
}
|
|
4588
5105
|
/**
|
|
4589
5106
|
* Create strip of sentiments expressed, with hyperlinks
|
|
@@ -4591,276 +5108,445 @@ function sentimentStrip(target, doc) {
|
|
|
4591
5108
|
* @param target {NamedNode} - The thing about which they are expressed
|
|
4592
5109
|
* @param doc {NamedNode} - The document in which they are expressed
|
|
4593
5110
|
*/
|
|
4594
|
-
function
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
5111
|
+
function _sentimentStrip() {
|
|
5112
|
+
_sentimentStrip = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(target, doc) {
|
|
5113
|
+
var versions, actions, strings;
|
|
5114
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
5115
|
+
while (1) switch (_context.prev = _context.next) {
|
|
5116
|
+
case 0:
|
|
5117
|
+
_context.next = 2;
|
|
5118
|
+
return (0, _chatLogic.allVersions)(target);
|
|
5119
|
+
case 2:
|
|
5120
|
+
versions = _context.sent;
|
|
5121
|
+
debug.log('sentimentStrip Versions for ' + target, versions);
|
|
5122
|
+
actions = versions.map(function (version) {
|
|
5123
|
+
return _solidLogic.store.each(null, ns.schema('target'), version, doc);
|
|
5124
|
+
}).flat();
|
|
5125
|
+
debug.log('sentimentStrip: Actions for ' + target, actions);
|
|
5126
|
+
strings = actions.map(function (action) {
|
|
5127
|
+
return emojiFromAction(action) || '';
|
|
5128
|
+
});
|
|
5129
|
+
return _context.abrupt("return", dom.createTextNode(strings.join(' ')));
|
|
5130
|
+
case 8:
|
|
5131
|
+
case "end":
|
|
5132
|
+
return _context.stop();
|
|
4613
5133
|
}
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
return strip;
|
|
5134
|
+
}, _callee);
|
|
5135
|
+
}));
|
|
5136
|
+
return _sentimentStrip.apply(this, arguments);
|
|
5137
|
+
}
|
|
5138
|
+
function sentimentStripLinked(_x3, _x4) {
|
|
5139
|
+
return _sentimentStripLinked.apply(this, arguments);
|
|
4621
5140
|
}
|
|
4622
5141
|
/**
|
|
4623
5142
|
* Creates a message toolbar component
|
|
4624
5143
|
*/
|
|
4625
|
-
function
|
|
4626
|
-
function
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
5144
|
+
function _sentimentStripLinked() {
|
|
5145
|
+
_sentimentStripLinked = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(target, doc) {
|
|
5146
|
+
var strip, refresh, _refresh;
|
|
5147
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
5148
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
5149
|
+
case 0:
|
|
5150
|
+
_refresh = function _refresh3() {
|
|
5151
|
+
_refresh = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
5152
|
+
var versions, actions, sentiments;
|
|
5153
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
5154
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
5155
|
+
case 0:
|
|
5156
|
+
strip.innerHTML = '';
|
|
5157
|
+
if (!(0, _chatLogic.isDeleted)(target)) {
|
|
5158
|
+
_context2.next = 3;
|
|
5159
|
+
break;
|
|
5160
|
+
}
|
|
5161
|
+
return _context2.abrupt("return", strip);
|
|
5162
|
+
case 3:
|
|
5163
|
+
_context2.next = 5;
|
|
5164
|
+
return (0, _chatLogic.allVersions)(target);
|
|
5165
|
+
case 5:
|
|
5166
|
+
versions = _context2.sent;
|
|
5167
|
+
debug.log('sentimentStripLinked: Versions for ' + target, versions);
|
|
5168
|
+
actions = versions.map(function (version) {
|
|
5169
|
+
return _solidLogic.store.each(null, ns.schema('target'), version, doc);
|
|
5170
|
+
}).flat();
|
|
5171
|
+
debug.log('sentimentStripLinked: Actions for ' + target, actions);
|
|
5172
|
+
if (!(actions.length === 0)) {
|
|
5173
|
+
_context2.next = 11;
|
|
5174
|
+
break;
|
|
5175
|
+
}
|
|
5176
|
+
return _context2.abrupt("return", strip);
|
|
5177
|
+
case 11:
|
|
5178
|
+
sentiments = actions.map(function (a) {
|
|
5179
|
+
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)];
|
|
5180
|
+
});
|
|
5181
|
+
debug.log(' Actions sentiments ', sentiments);
|
|
5182
|
+
sentiments.sort();
|
|
5183
|
+
sentiments.forEach(function (ss) {
|
|
5184
|
+
var _ss = (0, _slicedToArray2["default"])(ss, 3),
|
|
5185
|
+
theClass = _ss[0],
|
|
5186
|
+
content = _ss[1],
|
|
5187
|
+
agent = _ss[2];
|
|
5188
|
+
var res;
|
|
5189
|
+
if (agent) {
|
|
5190
|
+
res = dom.createElement('a');
|
|
5191
|
+
res.setAttribute('href', agent.uri);
|
|
5192
|
+
} else {
|
|
5193
|
+
res = dom.createTextNode('');
|
|
5194
|
+
}
|
|
5195
|
+
res.textContent = content || emojiMap[theClass] || '⬜️';
|
|
5196
|
+
strip.appendChild(res);
|
|
5197
|
+
});
|
|
5198
|
+
debug.log(' Actions strip ', strip);
|
|
5199
|
+
case 16:
|
|
5200
|
+
case "end":
|
|
5201
|
+
return _context2.stop();
|
|
5202
|
+
}
|
|
5203
|
+
}, _callee2);
|
|
5204
|
+
}));
|
|
5205
|
+
return _refresh.apply(this, arguments);
|
|
5206
|
+
};
|
|
5207
|
+
refresh = function _refresh2() {
|
|
5208
|
+
return _refresh.apply(this, arguments);
|
|
5209
|
+
};
|
|
5210
|
+
strip = dom.createElement('span');
|
|
5211
|
+
refresh().then(debug.log('sentimentStripLinked: sentimentStripLinked async refreshed'));
|
|
5212
|
+
strip.refresh = refresh;
|
|
5213
|
+
return _context3.abrupt("return", strip);
|
|
5214
|
+
case 6:
|
|
5215
|
+
case "end":
|
|
5216
|
+
return _context3.stop();
|
|
5217
|
+
}
|
|
5218
|
+
}, _callee3);
|
|
5219
|
+
}));
|
|
5220
|
+
return _sentimentStripLinked.apply(this, arguments);
|
|
5221
|
+
}
|
|
5222
|
+
function messageToolbar(_x5, _x6, _x7, _x8) {
|
|
5223
|
+
return _messageToolbar.apply(this, arguments);
|
|
5224
|
+
}
|
|
5225
|
+
function _messageToolbar() {
|
|
5226
|
+
_messageToolbar = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(message, messageRow, userContext, channelObject) {
|
|
5227
|
+
var deleteMessage, _deleteMessage, editMessage, _editMessage, replyInThread, _replyInThread, div, closeToolbar, deleteThingThen, _deleteThingThen, me, sentimentButton, context1, cancelButton;
|
|
5228
|
+
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
|
5229
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
5230
|
+
case 0:
|
|
5231
|
+
sentimentButton = function _sentimentButton(context, target, icon, actionClass, doc, mutuallyExclusive) {
|
|
5232
|
+
function setColor() {
|
|
5233
|
+
button.style.backgroundColor = action ? 'yellow' : 'white';
|
|
4639
5234
|
}
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
5235
|
+
var button = widgets.button(dom, icon, utils.label(actionClass), /*#__PURE__*/function () {
|
|
5236
|
+
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(_event) {
|
|
5237
|
+
var insertMe, dirty, i, a;
|
|
5238
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
5239
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
5240
|
+
case 0:
|
|
5241
|
+
if (!action) {
|
|
5242
|
+
_context4.next = 7;
|
|
5243
|
+
break;
|
|
5244
|
+
}
|
|
5245
|
+
_context4.next = 3;
|
|
5246
|
+
return deleteThingThen(action);
|
|
5247
|
+
case 3:
|
|
5248
|
+
action = null;
|
|
5249
|
+
setColor();
|
|
5250
|
+
_context4.next = 25;
|
|
5251
|
+
break;
|
|
5252
|
+
case 7:
|
|
5253
|
+
// no action
|
|
5254
|
+
action = widgets.newThing(doc);
|
|
5255
|
+
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)];
|
|
5256
|
+
_context4.next = 11;
|
|
5257
|
+
return _solidLogic.store.updater.update([], insertMe);
|
|
5258
|
+
case 11:
|
|
5259
|
+
setColor();
|
|
5260
|
+
if (!mutuallyExclusive) {
|
|
5261
|
+
_context4.next = 25;
|
|
5262
|
+
break;
|
|
5263
|
+
}
|
|
5264
|
+
// Delete incompative sentiments
|
|
5265
|
+
dirty = false;
|
|
5266
|
+
i = 0;
|
|
5267
|
+
case 15:
|
|
5268
|
+
if (!(i < mutuallyExclusive.length)) {
|
|
5269
|
+
_context4.next = 24;
|
|
5270
|
+
break;
|
|
5271
|
+
}
|
|
5272
|
+
a = existingAction(mutuallyExclusive[i]);
|
|
5273
|
+
if (!a) {
|
|
5274
|
+
_context4.next = 21;
|
|
5275
|
+
break;
|
|
5276
|
+
}
|
|
5277
|
+
_context4.next = 20;
|
|
5278
|
+
return deleteThingThen(a);
|
|
5279
|
+
case 20:
|
|
5280
|
+
// but how refresh? refreshTree the parent?
|
|
5281
|
+
dirty = true;
|
|
5282
|
+
case 21:
|
|
5283
|
+
i++;
|
|
5284
|
+
_context4.next = 15;
|
|
5285
|
+
break;
|
|
5286
|
+
case 24:
|
|
5287
|
+
if (dirty) {
|
|
5288
|
+
// widgets.refreshTree(button.parentNode) // requires them all to be immediate siblings
|
|
5289
|
+
widgets.refreshTree(messageRow); // requires them all to be immediate siblings
|
|
5290
|
+
}
|
|
5291
|
+
case 25:
|
|
5292
|
+
case "end":
|
|
5293
|
+
return _context4.stop();
|
|
5294
|
+
}
|
|
5295
|
+
}, _callee4);
|
|
5296
|
+
}));
|
|
5297
|
+
return function (_x11) {
|
|
5298
|
+
return _ref.apply(this, arguments);
|
|
5299
|
+
};
|
|
5300
|
+
}());
|
|
5301
|
+
function existingAction(actionClass) {
|
|
5302
|
+
var actions = _solidLogic.store.each(null, ns.schema('agent'), context.me, doc).filter(function (x) {
|
|
5303
|
+
return _solidLogic.store.holds(x, ns.rdf('type'), actionClass, doc);
|
|
5304
|
+
}).filter(function (x) {
|
|
5305
|
+
return _solidLogic.store.holds(x, ns.schema('target'), target, doc);
|
|
5306
|
+
});
|
|
5307
|
+
return actions.length ? actions[0] : null;
|
|
4647
5308
|
}
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
case 9:
|
|
4652
|
-
_context2.next = 18;
|
|
4653
|
-
break;
|
|
4654
|
-
case 11:
|
|
4655
|
-
_context2.prev = 11;
|
|
4656
|
-
_context2.t0 = _context2["catch"](6);
|
|
4657
|
-
msg = 'Error deleting messaage ' + _context2.t0;
|
|
4658
|
-
debug.warn(msg);
|
|
4659
|
-
alert(msg);
|
|
4660
|
-
area = userContext.statusArea || messageRow.parentNode;
|
|
4661
|
-
area.appendChild(widgets.errorMessageBlock(dom, msg));
|
|
4662
|
-
case 18:
|
|
4663
|
-
messageRow.parentNode.removeChild(messageRow);
|
|
4664
|
-
_context2.next = 22;
|
|
4665
|
-
break;
|
|
4666
|
-
case 21:
|
|
4667
|
-
alert('You can\'t delete the message, you are not logged in as the author, ' + author);
|
|
4668
|
-
case 22:
|
|
4669
|
-
closeToolbar();
|
|
4670
|
-
case 23:
|
|
4671
|
-
case "end":
|
|
4672
|
-
return _context2.stop();
|
|
4673
|
-
}
|
|
4674
|
-
}, _callee2, null, [[6, 11]]);
|
|
4675
|
-
}));
|
|
4676
|
-
return _deleteMessage.apply(this, arguments);
|
|
4677
|
-
}
|
|
4678
|
-
function editMessage(_x) {
|
|
4679
|
-
return _editMessage.apply(this, arguments);
|
|
4680
|
-
} // alain TODO allow chat owner to fully delete message + sentiments and replacing messages
|
|
4681
|
-
function _editMessage() {
|
|
4682
|
-
_editMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(messageRow) {
|
|
4683
|
-
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
4684
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
4685
|
-
case 0:
|
|
4686
|
-
if (me.value === _solidLogic.store.any(message, ns.foaf('maker')).value) {
|
|
4687
|
-
closeToolbar(); // edit is a one-off action
|
|
4688
|
-
(0, _message.switchToEditor)(messageRow, message, channelObject, userContext);
|
|
5309
|
+
function refresh() {
|
|
5310
|
+
action = existingAction(actionClass);
|
|
5311
|
+
setColor();
|
|
4689
5312
|
}
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
5313
|
+
var action;
|
|
5314
|
+
button.refresh = refresh; // If the file changes, refresh live
|
|
5315
|
+
refresh();
|
|
5316
|
+
return button;
|
|
5317
|
+
};
|
|
5318
|
+
_deleteThingThen = function _deleteThingThen3() {
|
|
5319
|
+
_deleteThingThen = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(x) {
|
|
5320
|
+
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
|
5321
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
5322
|
+
case 0:
|
|
5323
|
+
_context9.next = 2;
|
|
5324
|
+
return _solidLogic.store.updater.update(_solidLogic.store.connectedStatements(x), []);
|
|
5325
|
+
case 2:
|
|
5326
|
+
case "end":
|
|
5327
|
+
return _context9.stop();
|
|
5328
|
+
}
|
|
5329
|
+
}, _callee9);
|
|
5330
|
+
}));
|
|
5331
|
+
return _deleteThingThen.apply(this, arguments);
|
|
5332
|
+
};
|
|
5333
|
+
deleteThingThen = function _deleteThingThen2(_x10) {
|
|
5334
|
+
return _deleteThingThen.apply(this, arguments);
|
|
5335
|
+
};
|
|
5336
|
+
closeToolbar = function _closeToolbar() {
|
|
5337
|
+
div.parentElement.parentElement.removeChild(div.parentElement); // remive the TR
|
|
5338
|
+
};
|
|
5339
|
+
_replyInThread = function _replyInThread3() {
|
|
5340
|
+
_replyInThread = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
|
|
5341
|
+
var thread, options;
|
|
5342
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
5343
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
5344
|
+
case 0:
|
|
5345
|
+
_context8.next = 2;
|
|
5346
|
+
return channelObject.createThread(message);
|
|
5347
|
+
case 2:
|
|
5348
|
+
thread = _context8.sent;
|
|
5349
|
+
options = userContext.chatOptions;
|
|
5350
|
+
if (options) {
|
|
5351
|
+
_context8.next = 6;
|
|
5352
|
+
break;
|
|
5353
|
+
}
|
|
5354
|
+
throw new Error('replyInThread: missing options');
|
|
5355
|
+
case 6:
|
|
5356
|
+
options.showThread(thread, options);
|
|
5357
|
+
closeToolbar(); // a one-off action
|
|
5358
|
+
case 8:
|
|
5359
|
+
case "end":
|
|
5360
|
+
return _context8.stop();
|
|
5361
|
+
}
|
|
5362
|
+
}, _callee8);
|
|
5363
|
+
}));
|
|
5364
|
+
return _replyInThread.apply(this, arguments);
|
|
5365
|
+
};
|
|
5366
|
+
replyInThread = function _replyInThread2() {
|
|
5367
|
+
return _replyInThread.apply(this, arguments);
|
|
5368
|
+
};
|
|
5369
|
+
_editMessage = function _editMessage3() {
|
|
5370
|
+
_editMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(messageRow) {
|
|
5371
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
5372
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
5373
|
+
case 0:
|
|
5374
|
+
if (!(me.value === _solidLogic.store.any(message, ns.foaf('maker')).value)) {
|
|
5375
|
+
_context7.next = 4;
|
|
5376
|
+
break;
|
|
5377
|
+
}
|
|
5378
|
+
closeToolbar(); // edit is a one-off action
|
|
5379
|
+
_context7.next = 4;
|
|
5380
|
+
return (0, _message.switchToEditor)(messageRow, message, channelObject, userContext);
|
|
5381
|
+
case 4:
|
|
5382
|
+
case "end":
|
|
5383
|
+
return _context7.stop();
|
|
5384
|
+
}
|
|
5385
|
+
}, _callee7);
|
|
5386
|
+
}));
|
|
5387
|
+
return _editMessage.apply(this, arguments);
|
|
5388
|
+
};
|
|
5389
|
+
editMessage = function _editMessage2(_x9) {
|
|
5390
|
+
return _editMessage.apply(this, arguments);
|
|
5391
|
+
};
|
|
5392
|
+
_deleteMessage = function _deleteMessage3() {
|
|
5393
|
+
_deleteMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
|
|
5394
|
+
var author, msg, area;
|
|
5395
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
5396
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
5397
|
+
case 0:
|
|
5398
|
+
author = _solidLogic.store.any(message, ns.foaf('maker'));
|
|
5399
|
+
if (me) {
|
|
5400
|
+
_context6.next = 5;
|
|
5401
|
+
break;
|
|
5402
|
+
}
|
|
5403
|
+
alert('You can\'t delete the message, you are not logged in.');
|
|
5404
|
+
_context6.next = 22;
|
|
5405
|
+
break;
|
|
5406
|
+
case 5:
|
|
5407
|
+
if (!me.sameTerm(author)) {
|
|
5408
|
+
_context6.next = 21;
|
|
5409
|
+
break;
|
|
5410
|
+
}
|
|
5411
|
+
_context6.prev = 6;
|
|
5412
|
+
_context6.next = 9;
|
|
5413
|
+
return channelObject.deleteMessage(message);
|
|
5414
|
+
case 9:
|
|
5415
|
+
_context6.next = 18;
|
|
5416
|
+
break;
|
|
5417
|
+
case 11:
|
|
5418
|
+
_context6.prev = 11;
|
|
5419
|
+
_context6.t0 = _context6["catch"](6);
|
|
5420
|
+
msg = 'Error deleting messaage ' + _context6.t0;
|
|
5421
|
+
debug.warn(msg);
|
|
5422
|
+
alert(msg);
|
|
5423
|
+
area = userContext.statusArea || messageRow.parentNode;
|
|
5424
|
+
area.appendChild(widgets.errorMessageBlock(dom, msg));
|
|
5425
|
+
case 18:
|
|
5426
|
+
messageRow.parentNode.removeChild(messageRow);
|
|
5427
|
+
_context6.next = 22;
|
|
5428
|
+
break;
|
|
5429
|
+
case 21:
|
|
5430
|
+
alert('You can\'t delete the message, you are not logged in as the author, ' + author);
|
|
5431
|
+
case 22:
|
|
5432
|
+
closeToolbar();
|
|
5433
|
+
case 23:
|
|
5434
|
+
case "end":
|
|
5435
|
+
return _context6.stop();
|
|
5436
|
+
}
|
|
5437
|
+
}, _callee6, null, [[6, 11]]);
|
|
5438
|
+
}));
|
|
5439
|
+
return _deleteMessage.apply(this, arguments);
|
|
5440
|
+
};
|
|
5441
|
+
deleteMessage = function _deleteMessage2() {
|
|
5442
|
+
return _deleteMessage.apply(this, arguments);
|
|
5443
|
+
};
|
|
5444
|
+
// alain: TODO allow chat owner to fully delete message + sentiments and replacing messages
|
|
5445
|
+
div = dom.createElement('div'); // is message deleted ?
|
|
5446
|
+
_context10.next = 13;
|
|
5447
|
+
return (0, _chatLogic.mostRecentVersion)(message).value;
|
|
5448
|
+
case 13:
|
|
5449
|
+
_context10.t0 = _context10.sent;
|
|
5450
|
+
_context10.t1 = ns.schema('dateDeleted').value;
|
|
5451
|
+
if (!(_context10.t0 === _context10.t1)) {
|
|
5452
|
+
_context10.next = 17;
|
|
5453
|
+
break;
|
|
5454
|
+
}
|
|
5455
|
+
return _context10.abrupt("return", div);
|
|
5456
|
+
case 17:
|
|
5457
|
+
// Things only the original author can do
|
|
5458
|
+
me = _solidLogic.authn.currentUser(); // If already logged on
|
|
5459
|
+
if (me && _solidLogic.store.holds(message, ns.foaf('maker'), me)) {
|
|
5460
|
+
// button to delete the message
|
|
5461
|
+
div.appendChild(widgets.deleteButtonWithCheck(dom, div, 'message', deleteMessage));
|
|
5462
|
+
// button to edit the message
|
|
5463
|
+
div.appendChild(widgets.button(dom, _iconBase.icons.iconBase + PENCIL_ICON, 'edit', function () {
|
|
5464
|
+
return editMessage(messageRow);
|
|
5465
|
+
}));
|
|
5466
|
+
} // if mine
|
|
5467
|
+
// Things anyone can do if they have a bookmark list async
|
|
5468
|
+
/*
|
|
5469
|
+
var bookmarkButton = await bookmarks.renderBookmarksButton(userContext)
|
|
5470
|
+
if (bookmarkButton) {
|
|
5471
|
+
div.appendChild(bookmarkButton)
|
|
5472
|
+
}
|
|
5473
|
+
*/
|
|
5474
|
+
// Things anyone can do if they have a bookmark list
|
|
4739
5475
|
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
5476
|
+
(0, _bookmarks.renderBookmarksButton)(userContext).then(function (bookmarkButton) {
|
|
5477
|
+
if (bookmarkButton) div.appendChild(bookmarkButton);
|
|
5478
|
+
});
|
|
4743
5479
|
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
while (1) switch (_context.prev = _context.next) {
|
|
4762
|
-
case 0:
|
|
4763
|
-
if (!action) {
|
|
4764
|
-
_context.next = 7;
|
|
4765
|
-
break;
|
|
4766
|
-
}
|
|
4767
|
-
_context.next = 3;
|
|
4768
|
-
return deleteThingThen(action);
|
|
4769
|
-
case 3:
|
|
4770
|
-
action = null;
|
|
4771
|
-
setColor();
|
|
4772
|
-
_context.next = 25;
|
|
4773
|
-
break;
|
|
4774
|
-
case 7:
|
|
4775
|
-
// no action
|
|
4776
|
-
action = widgets.newThing(doc);
|
|
4777
|
-
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)];
|
|
4778
|
-
_context.next = 11;
|
|
4779
|
-
return _solidLogic.store.updater.update([], insertMe);
|
|
4780
|
-
case 11:
|
|
4781
|
-
setColor();
|
|
4782
|
-
if (!mutuallyExclusive) {
|
|
4783
|
-
_context.next = 25;
|
|
4784
|
-
break;
|
|
4785
|
-
}
|
|
4786
|
-
// Delete incompative sentiments
|
|
4787
|
-
dirty = false;
|
|
4788
|
-
i = 0;
|
|
4789
|
-
case 15:
|
|
4790
|
-
if (!(i < mutuallyExclusive.length)) {
|
|
4791
|
-
_context.next = 24;
|
|
4792
|
-
break;
|
|
4793
|
-
}
|
|
4794
|
-
a = existingAction(mutuallyExclusive[i]);
|
|
4795
|
-
if (!a) {
|
|
4796
|
-
_context.next = 21;
|
|
4797
|
-
break;
|
|
4798
|
-
}
|
|
4799
|
-
_context.next = 20;
|
|
4800
|
-
return deleteThingThen(a);
|
|
4801
|
-
case 20:
|
|
4802
|
-
// but how refresh? refreshTree the parent?
|
|
4803
|
-
dirty = true;
|
|
4804
|
-
case 21:
|
|
4805
|
-
i++;
|
|
4806
|
-
_context.next = 15;
|
|
4807
|
-
break;
|
|
4808
|
-
case 24:
|
|
4809
|
-
if (dirty) {
|
|
4810
|
-
// widgets.refreshTree(button.parentNode) // requires them all to be immediate siblings
|
|
4811
|
-
widgets.refreshTree(messageRow); // requires them all to be immediate siblings
|
|
4812
|
-
}
|
|
4813
|
-
case 25:
|
|
4814
|
-
case "end":
|
|
4815
|
-
return _context.stop();
|
|
5480
|
+
/** Button to allow user to express a sentiment (like, endorse, etc) about a target
|
|
5481
|
+
*
|
|
5482
|
+
* @param context {Object} - Provide dom and me
|
|
5483
|
+
* @param target {NamedNode} - The thing the user expresses an opnion about
|
|
5484
|
+
* @param icon {uristring} - The icon to be used for the button
|
|
5485
|
+
* @param actionClass {NamedNode} - The RDF class - typically a subclass of schema:Action
|
|
5486
|
+
* @param doc - {NamedNode} - the Solid document iunto which the data should be written
|
|
5487
|
+
* @param mutuallyExclusive {Array<NamedNode>} - Any RDF classes of sentimentswhich are mutiually exclusive
|
|
5488
|
+
*/
|
|
5489
|
+
|
|
5490
|
+
// THUMBS_UP_ICON
|
|
5491
|
+
// https://schema.org/AgreeAction
|
|
5492
|
+
me = _solidLogic.authn.currentUser(); // If already logged on
|
|
5493
|
+
_context10.t2 = me;
|
|
5494
|
+
if (!_context10.t2) {
|
|
5495
|
+
_context10.next = 28;
|
|
5496
|
+
break;
|
|
4816
5497
|
}
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
// THUMBS_UP_ICON
|
|
4842
|
-
// https://schema.org/AgreeAction
|
|
4843
|
-
me = _solidLogic.authn.currentUser(); // If already logged on
|
|
4844
|
-
// debug.log('Actions 3' + mostRecentVersion(message).value + ' ' + ns.schema('dateDeleted').value + ' ' + (mostRecentVersion(message).value !== ns.schema('dateDeleted').value))
|
|
5498
|
+
_context10.next = 25;
|
|
5499
|
+
return (0, _chatLogic.mostRecentVersion)(message).value;
|
|
5500
|
+
case 25:
|
|
5501
|
+
_context10.t3 = _context10.sent;
|
|
5502
|
+
_context10.t4 = ns.schema('dateDeleted').value;
|
|
5503
|
+
_context10.t2 = _context10.t3 !== _context10.t4;
|
|
5504
|
+
case 28:
|
|
5505
|
+
if (!_context10.t2) {
|
|
5506
|
+
_context10.next = 32;
|
|
5507
|
+
break;
|
|
5508
|
+
}
|
|
5509
|
+
context1 = {
|
|
5510
|
+
me: me,
|
|
5511
|
+
dom: dom,
|
|
5512
|
+
div: div
|
|
5513
|
+
};
|
|
5514
|
+
div.appendChild(sentimentButton(context1, message,
|
|
5515
|
+
// @@ TODO use widgets.sentimentButton
|
|
5516
|
+
_iconBase.icons.iconBase + THUMBS_UP_ICON, ns.schema('AgreeAction'), message.doc(), [ns.schema('DisagreeAction')]));
|
|
5517
|
+
// Thumbs down
|
|
5518
|
+
div.appendChild(sentimentButton(context1, message, _iconBase.icons.iconBase + THUMBS_DOWN_ICON, ns.schema('DisagreeAction'), message.doc(), [ns.schema('AgreeAction')]));
|
|
5519
|
+
case 32:
|
|
5520
|
+
// Reply buttton
|
|
4845
5521
|
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
5522
|
+
if (_solidLogic.store.any(message, ns.dct('created'))) {
|
|
5523
|
+
// Looks like a messsage? Bar can be used for other things
|
|
5524
|
+
div.appendChild(widgets.button(dom, _iconBase.icons.iconBase + REPLY_ICON, 'Reply in thread', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
|
|
5525
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
5526
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
5527
|
+
case 0:
|
|
5528
|
+
_context5.next = 2;
|
|
5529
|
+
return replyInThread();
|
|
5530
|
+
case 2:
|
|
5531
|
+
case "end":
|
|
5532
|
+
return _context5.stop();
|
|
5533
|
+
}
|
|
5534
|
+
}, _callee5);
|
|
5535
|
+
}))));
|
|
5536
|
+
}
|
|
5537
|
+
// X button to remove the tool UI itself
|
|
5538
|
+
cancelButton = div.appendChild(widgets.cancelButton(dom));
|
|
5539
|
+
cancelButton.style["float"] = 'right';
|
|
5540
|
+
cancelButton.firstChild.style.opacity = '0.3';
|
|
5541
|
+
cancelButton.addEventListener('click', closeToolbar);
|
|
5542
|
+
return _context10.abrupt("return", div);
|
|
5543
|
+
case 38:
|
|
5544
|
+
case "end":
|
|
5545
|
+
return _context10.stop();
|
|
5546
|
+
}
|
|
5547
|
+
}, _callee10);
|
|
5548
|
+
}));
|
|
5549
|
+
return _messageToolbar.apply(this, arguments);
|
|
4864
5550
|
}
|
|
4865
5551
|
//# sourceMappingURL=messageTools.js.map
|
|
4866
5552
|
|
|
@@ -5531,12 +6217,12 @@ function createHelpMenu(options, helpMenuItems) {
|
|
|
5531
6217
|
}
|
|
5532
6218
|
});
|
|
5533
6219
|
var helpMenu = document.createElement('nav');
|
|
5534
|
-
helpMenu.setAttribute('style', style.
|
|
6220
|
+
helpMenu.setAttribute('style', style.headerUserMenuNavigationMenuNotDisplayed);
|
|
5535
6221
|
helpMenu.setAttribute('aria-hidden', 'true');
|
|
6222
|
+
helpMenu.setAttribute('id', 'helperNav');
|
|
5536
6223
|
helpMenu.appendChild(helpMenuList);
|
|
5537
6224
|
var helpMenuContainer = document.createElement('div');
|
|
5538
6225
|
helpMenuContainer.setAttribute('style', style.headerBannerUserMenu);
|
|
5539
|
-
helpMenuContainer.setAttribute('style', style.headerUserMenu);
|
|
5540
6226
|
helpMenuContainer.appendChild(helpMenu);
|
|
5541
6227
|
var helpMenuTrigger = document.createElement('button');
|
|
5542
6228
|
helpMenuTrigger.setAttribute('style', style.headerUserMenuTrigger);
|
|
@@ -5556,11 +6242,15 @@ function createHelpMenu(options, helpMenuItems) {
|
|
|
5556
6242
|
helpMenuContainer.addEventListener('mouseover', function (event) {
|
|
5557
6243
|
clearTimeout(timer);
|
|
5558
6244
|
throttledMenuToggle(event);
|
|
6245
|
+
var nav = document.getElementById('helperNav');
|
|
6246
|
+
nav === null || nav === void 0 ? void 0 : nav.setAttribute('style', style.headerUserMenuNavigationMenu);
|
|
5559
6247
|
});
|
|
5560
6248
|
helpMenuContainer.addEventListener('mouseout', function (event) {
|
|
5561
6249
|
timer = setTimeout(function () {
|
|
5562
6250
|
return throttledMenuToggle(event);
|
|
5563
6251
|
}, 200);
|
|
6252
|
+
var nav = document.getElementById('helperNav');
|
|
6253
|
+
nav === null || nav === void 0 ? void 0 : nav.setAttribute('style', style.headerUserMenuNavigationMenuNotDisplayed);
|
|
5564
6254
|
});
|
|
5565
6255
|
return helpMenuContainer;
|
|
5566
6256
|
}
|
|
@@ -5643,8 +6333,9 @@ function _createUserMenu() {
|
|
|
5643
6333
|
});
|
|
5644
6334
|
}
|
|
5645
6335
|
loggedInMenu = document.createElement('nav');
|
|
5646
|
-
loggedInMenu.setAttribute('style', style.
|
|
6336
|
+
loggedInMenu.setAttribute('style', style.headerUserMenuNavigationMenuNotDisplayed);
|
|
5647
6337
|
loggedInMenu.setAttribute('aria-hidden', 'true');
|
|
6338
|
+
loggedInMenu.setAttribute('id', 'loggedInNav');
|
|
5648
6339
|
loggedInMenu.appendChild(loggedInMenuList);
|
|
5649
6340
|
loggedInMenuTrigger = document.createElement('button');
|
|
5650
6341
|
loggedInMenuTrigger.setAttribute('style', style.headerUserMenuTrigger);
|
|
@@ -5656,8 +6347,7 @@ function _createUserMenu() {
|
|
|
5656
6347
|
loggedInMenuTrigger.appendChild(profileImg);
|
|
5657
6348
|
}
|
|
5658
6349
|
loggedInMenuContainer = document.createElement('div');
|
|
5659
|
-
loggedInMenuContainer.setAttribute('style', style.
|
|
5660
|
-
loggedInMenuContainer.setAttribute('style', style.headerUserMenu);
|
|
6350
|
+
loggedInMenuContainer.setAttribute('style', style.headerBannerUserMenuNotDisplayed);
|
|
5661
6351
|
loggedInMenuContainer.appendChild(loggedInMenuTrigger);
|
|
5662
6352
|
loggedInMenuContainer.appendChild(loggedInMenu);
|
|
5663
6353
|
throttledMenuToggle = (0, _headerFooterHelpers.throttle)(function (event) {
|
|
@@ -5670,11 +6360,15 @@ function _createUserMenu() {
|
|
|
5670
6360
|
loggedInMenuContainer.addEventListener('mouseover', function (event) {
|
|
5671
6361
|
clearTimeout(timer);
|
|
5672
6362
|
throttledMenuToggle(event);
|
|
6363
|
+
var nav = document.getElementById('loggedInNav');
|
|
6364
|
+
nav === null || nav === void 0 ? void 0 : nav.setAttribute('style', style.headerUserMenuNavigationMenu);
|
|
5673
6365
|
});
|
|
5674
6366
|
loggedInMenuContainer.addEventListener('mouseout', function (event) {
|
|
5675
6367
|
timer = setTimeout(function () {
|
|
5676
6368
|
return throttledMenuToggle(event);
|
|
5677
6369
|
}, 200);
|
|
6370
|
+
var nav = document.getElementById('loggedInNav');
|
|
6371
|
+
nav === null || nav === void 0 ? void 0 : nav.setAttribute('style', style.headerUserMenuNavigationMenuNotDisplayed);
|
|
5678
6372
|
});
|
|
5679
6373
|
return _context4.abrupt("return", loggedInMenuContainer);
|
|
5680
6374
|
case 27:
|
|
@@ -6814,14 +7508,12 @@ function signInOrSignUpBox(dom, setUserCallback) {
|
|
|
6814
7508
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
6815
7509
|
options = options || {};
|
|
6816
7510
|
var signInButtonStyle = options.buttonStyle || getDefaultSignInButtonStyle();
|
|
6817
|
-
|
|
6818
|
-
// @@ TODO Remove the need to cast HTML element to any
|
|
6819
7511
|
var box = dom.createElement('div');
|
|
6820
7512
|
var magicClassName = 'SolidSignInOrSignUpBox';
|
|
6821
7513
|
debug.log('widgets.signInOrSignUpBox');
|
|
6822
7514
|
box.setUserCallback = setUserCallback;
|
|
6823
7515
|
box.setAttribute('class', magicClassName);
|
|
6824
|
-
box.style
|
|
7516
|
+
box.setAttribute('style', 'display:flex;');
|
|
6825
7517
|
|
|
6826
7518
|
// Sign in button with PopUP
|
|
6827
7519
|
var signInPopUpButton = dom.createElement('input'); // multi
|
|
@@ -6869,7 +7561,7 @@ function signInOrSignUpBox(dom, setUserCallback) {
|
|
|
6869
7561
|
box.appendChild(signupButton);
|
|
6870
7562
|
signupButton.setAttribute('type', 'button');
|
|
6871
7563
|
signupButton.setAttribute('value', 'Sign Up for Solid');
|
|
6872
|
-
signupButton.setAttribute('style', "".concat(signInButtonStyle, "background-color: #efe;"));
|
|
7564
|
+
signupButton.setAttribute('style', "".concat(signInButtonStyle, "background-color: #efe;").concat(style.headerBannerLoginInput));
|
|
6873
7565
|
signupButton.addEventListener('click', function (_event) {
|
|
6874
7566
|
var signupMgr = new _signup.Signup();
|
|
6875
7567
|
signupMgr.signup().then(function (uri) {
|
|
@@ -6910,6 +7602,8 @@ function renderSignInPopup(dom) {
|
|
|
6910
7602
|
while (1) switch (_context.prev = _context.next) {
|
|
6911
7603
|
case 0:
|
|
6912
7604
|
_context.prev = 0;
|
|
7605
|
+
// clear authorization metadata from store
|
|
7606
|
+
_solidLogic.solidLogicSingleton.store.updater.flagAuthorizationMetadata();
|
|
6913
7607
|
// Save hash
|
|
6914
7608
|
preLoginRedirectHash = new URL(window.location.href).hash;
|
|
6915
7609
|
if (preLoginRedirectHash) {
|
|
@@ -6919,23 +7613,23 @@ function renderSignInPopup(dom) {
|
|
|
6919
7613
|
// Login
|
|
6920
7614
|
locationUrl = new URL(window.location.href);
|
|
6921
7615
|
locationUrl.hash = ''; // remove hash part
|
|
6922
|
-
_context.next =
|
|
7616
|
+
_context.next = 9;
|
|
6923
7617
|
return _solidLogic.authSession.login({
|
|
6924
7618
|
redirectUrl: locationUrl.href,
|
|
6925
7619
|
oidcIssuer: issuerUri
|
|
6926
7620
|
});
|
|
6927
|
-
case
|
|
6928
|
-
_context.next =
|
|
7621
|
+
case 9:
|
|
7622
|
+
_context.next = 14;
|
|
6929
7623
|
break;
|
|
6930
|
-
case
|
|
6931
|
-
_context.prev =
|
|
7624
|
+
case 11:
|
|
7625
|
+
_context.prev = 11;
|
|
6932
7626
|
_context.t0 = _context["catch"](0);
|
|
6933
7627
|
(0, _log.alert)(_context.t0.message);
|
|
6934
|
-
case
|
|
7628
|
+
case 14:
|
|
6935
7629
|
case "end":
|
|
6936
7630
|
return _context.stop();
|
|
6937
7631
|
}
|
|
6938
|
-
}, _callee, null, [[0,
|
|
7632
|
+
}, _callee, null, [[0, 11]]);
|
|
6939
7633
|
}));
|
|
6940
7634
|
return function loginToIssuer(_x11) {
|
|
6941
7635
|
return _ref.apply(this, arguments);
|
|
@@ -7087,45 +7781,47 @@ _solidLogic.authSession.onLogout( /*#__PURE__*/(0, _asyncToGenerator2["default"]
|
|
|
7087
7781
|
case 0:
|
|
7088
7782
|
issuer = window.localStorage.getItem('loginIssuer');
|
|
7089
7783
|
if (!issuer) {
|
|
7090
|
-
_context2.next =
|
|
7784
|
+
_context2.next = 20;
|
|
7091
7785
|
break;
|
|
7092
7786
|
}
|
|
7093
7787
|
_context2.prev = 2;
|
|
7788
|
+
// clear authorization metadata from store
|
|
7789
|
+
_solidLogic.solidLogicSingleton.store.updater.flagAuthorizationMetadata();
|
|
7094
7790
|
wellKnownUri = new URL(issuer);
|
|
7095
7791
|
wellKnownUri.pathname = '/.well-known/openid-configuration';
|
|
7096
|
-
_context2.next =
|
|
7792
|
+
_context2.next = 8;
|
|
7097
7793
|
return fetch(wellKnownUri.toString());
|
|
7098
|
-
case
|
|
7794
|
+
case 8:
|
|
7099
7795
|
wellKnownResult = _context2.sent;
|
|
7100
7796
|
if (!(wellKnownResult.status === 200)) {
|
|
7101
|
-
_context2.next =
|
|
7797
|
+
_context2.next = 16;
|
|
7102
7798
|
break;
|
|
7103
7799
|
}
|
|
7104
|
-
_context2.next =
|
|
7800
|
+
_context2.next = 12;
|
|
7105
7801
|
return wellKnownResult.json();
|
|
7106
|
-
case
|
|
7802
|
+
case 12:
|
|
7107
7803
|
openidConfiguration = _context2.sent;
|
|
7108
7804
|
if (!(openidConfiguration && openidConfiguration.end_session_endpoint)) {
|
|
7109
|
-
_context2.next =
|
|
7805
|
+
_context2.next = 16;
|
|
7110
7806
|
break;
|
|
7111
7807
|
}
|
|
7112
|
-
_context2.next =
|
|
7808
|
+
_context2.next = 16;
|
|
7113
7809
|
return fetch(openidConfiguration.end_session_endpoint, {
|
|
7114
7810
|
credentials: 'include'
|
|
7115
7811
|
});
|
|
7116
|
-
case
|
|
7117
|
-
_context2.next =
|
|
7812
|
+
case 16:
|
|
7813
|
+
_context2.next = 20;
|
|
7118
7814
|
break;
|
|
7119
|
-
case
|
|
7120
|
-
_context2.prev =
|
|
7815
|
+
case 18:
|
|
7816
|
+
_context2.prev = 18;
|
|
7121
7817
|
_context2.t0 = _context2["catch"](2);
|
|
7122
|
-
case 19:
|
|
7123
|
-
window.location.reload();
|
|
7124
7818
|
case 20:
|
|
7819
|
+
window.location.reload();
|
|
7820
|
+
case 21:
|
|
7125
7821
|
case "end":
|
|
7126
7822
|
return _context2.stop();
|
|
7127
7823
|
}
|
|
7128
|
-
}, _callee2, null, [[2,
|
|
7824
|
+
}, _callee2, null, [[2, 18]]);
|
|
7129
7825
|
})));
|
|
7130
7826
|
|
|
7131
7827
|
/**
|
|
@@ -9482,6 +10178,10 @@ function recordSharedPreferences(subject, context) {
|
|
|
9482
10178
|
return new Promise(function (resolve, reject) {
|
|
9483
10179
|
var sharedPreferences = kb.any(subject, ns.ui('sharedPreferences'));
|
|
9484
10180
|
if (!sharedPreferences) {
|
|
10181
|
+
if (!kb.updater.editable(subject.doc())) {
|
|
10182
|
+
debug.log(" Cant make shared preferences, may not change ".concat(subject.doc));
|
|
10183
|
+
resolve(context);
|
|
10184
|
+
}
|
|
9485
10185
|
var sp = $rdf.sym(subject.doc().uri + '#SharedPreferences');
|
|
9486
10186
|
var ins = [$rdf.st(subject, ns.ui('sharedPreferences'), sp, subject.doc())];
|
|
9487
10187
|
debug.log('Creating shared preferences ' + sp);
|
|
@@ -9870,15 +10570,15 @@ var style = {
|
|
|
9870
10570
|
linkDivStyle: 'width:2em; padding:0.5em; height: 4em;',
|
|
9871
10571
|
// ACL
|
|
9872
10572
|
aclControlBoxContainer: 'margin: 1em',
|
|
9873
|
-
aclControlBoxHeader: '
|
|
9874
|
-
aclControlBoxStatus: 'display: none
|
|
10573
|
+
aclControlBoxHeader: 'font-size: 120%; margin: 0 0 1rem',
|
|
10574
|
+
aclControlBoxStatus: 'display: none; margin: 1rem 0',
|
|
9875
10575
|
aclControlBoxStatusRevealed: 'display: block',
|
|
9876
10576
|
aclGroupContent: 'maxWidth: 650',
|
|
9877
|
-
accessGroupList: 'display: grid
|
|
9878
|
-
accessGroupListItem: 'display: grid
|
|
10577
|
+
accessGroupList: 'display: grid; grid-template-columns: 1fr; margin: 1em; width: 100%',
|
|
10578
|
+
accessGroupListItem: 'display: grid; grid-template-columns: 100px auto 30%',
|
|
9879
10579
|
defaultsController: 'display: flex',
|
|
9880
|
-
defaultsControllerNotice: 'color: #888
|
|
9881
|
-
bigButton: '
|
|
10580
|
+
defaultsControllerNotice: 'color: #888; flexGrow: 1; fontSize: 80%',
|
|
10581
|
+
bigButton: 'background-color: white; border: 0.1em solid #888; border-radius: 0.3em; max-width: 50%; padding-bottom: 1em; padding-top: 1em',
|
|
9882
10582
|
group: 'color: #888',
|
|
9883
10583
|
group1: 'color: green',
|
|
9884
10584
|
group2: 'color: #cc0',
|
|
@@ -9886,36 +10586,39 @@ var style = {
|
|
|
9886
10586
|
group5: 'color: red',
|
|
9887
10587
|
group9: 'color: blue',
|
|
9888
10588
|
group13: 'color: purple',
|
|
9889
|
-
trustedAppAddApplicationsTable: '
|
|
10589
|
+
trustedAppAddApplicationsTable: 'background-color: #eee',
|
|
9890
10590
|
trustedAppCancelButton: 'float: right',
|
|
9891
|
-
trustedAppControllerI: '
|
|
10591
|
+
trustedAppControllerI: 'border-color: orange; borderRadius: 1em; borderWidth: 0.1em',
|
|
9892
10592
|
temporaryStatusInit: 'background: green',
|
|
9893
|
-
temporaryStatusEnd: 'background: transparent
|
|
10593
|
+
temporaryStatusEnd: 'background: transparent; transition: background 5s linear',
|
|
9894
10594
|
// header
|
|
9895
|
-
headerUserMenuLink: 'background: none
|
|
9896
|
-
headerUserMenuLinkHover: '
|
|
9897
|
-
headerUserMenuTrigger: 'background: none
|
|
9898
|
-
headerUserMenuTriggerImg: '
|
|
9899
|
-
headerUserMenuButton: 'background: none
|
|
9900
|
-
headerUserMenuButtonHover: '
|
|
9901
|
-
headerUserMenuList: '
|
|
9902
|
-
|
|
9903
|
-
|
|
9904
|
-
|
|
9905
|
-
|
|
10595
|
+
headerUserMenuLink: 'background: none; border: 0; color: black; cursor: pointer; display: block; font-family: Arial; font-size: 1em; text-align: left; padding: 1em; width: 100%; text-decoration: none',
|
|
10596
|
+
headerUserMenuLinkHover: 'background: none; border: 0; color: black; cursor: pointer; display: block; font-family: Arial; font-size: 1em; text-align: left; padding: 1em; width: 100%; text-decoration: none; background-image: linear-gradient(to right, #7C4DFF 0%, #18A9E6 50%, #01C9EA 100%)',
|
|
10597
|
+
headerUserMenuTrigger: 'background: none; border: 0; cursor: pointer; width: 60px; height: 60px',
|
|
10598
|
+
headerUserMenuTriggerImg: 'border-radius: 50%; height: 56px; width: 28px !important',
|
|
10599
|
+
headerUserMenuButton: 'background: none; border: 0; color: black; cursor: pointer; display: block; font-family: Arial; font-size: 1em; text-align: left; padding: 1em; width: 100%',
|
|
10600
|
+
headerUserMenuButtonHover: 'background: none; border: 0; color: black; cursor: pointer; display: block; font-family: Arial; font-size: 1em; text-align: left; padding: 1em; width: 100%; background-image: linear-gradient(to right, #7C4DFF 0%, #18A9E6 50%, #01C9EA 100%)',
|
|
10601
|
+
headerUserMenuList: 'list-style: none; margin: 0; padding: 0',
|
|
10602
|
+
headerUserMenuListDisplay: 'list-style: none; margin: 0; padding: 0; display:true',
|
|
10603
|
+
headerUserMenuNavigationMenu: 'background: white; border: solid 1px #000000; border-right: 0; position: absolute; right: 0; top: 60px; width: 200px; z-index: 1; display: true',
|
|
10604
|
+
headerUserMenuNavigationMenuNotDisplayed: 'background: white; border: solid 1px #000000; border-right: 0; position: absolute; right: 0; top: 60px; width: 200px; z-index: 1; display: none',
|
|
10605
|
+
headerUserMenuListItem: 'border-bottom: solid 1px #000000',
|
|
10606
|
+
headerUserMenuPhoto: 'border-radius: 50%; background-position: center; background-repeat: no-repeat; background-size: cover; height: 50px; width: 50px',
|
|
10607
|
+
headerBanner: 'box-shadow: 0px 1px 4px #000000; display: flex; justify-content: space-between; padding: 0 1.5em; margin-bottom: 4px',
|
|
9906
10608
|
headerBannerLink: 'display: block',
|
|
9907
10609
|
headerBannerRightMenu: 'display: flex',
|
|
9908
|
-
headerBannerLogin: '
|
|
9909
|
-
|
|
9910
|
-
|
|
9911
|
-
|
|
9912
|
-
|
|
10610
|
+
headerBannerLogin: 'margin-left: auto',
|
|
10611
|
+
allChildrenVisible: 'display:true',
|
|
10612
|
+
headerBannerLoginInput: 'margin: 0.75em 0 0.75em 0.5em !important; padding: 0.5em !important',
|
|
10613
|
+
headerBannerUserMenu: 'border-left: solid 1px #000000; margin-left: auto',
|
|
10614
|
+
headerBannerHelpMenu: 'border-left: solid 1px #000000; margin.left: auto',
|
|
10615
|
+
headerBannerIcon: 'background-size: 65px 60px !important; height: 60px !important; width: 65px !important',
|
|
9913
10616
|
// may just be 65px round($icon-size * 352 / 322);
|
|
9914
10617
|
|
|
9915
10618
|
// footer
|
|
9916
|
-
footer: '
|
|
10619
|
+
footer: 'border-top: solid 1px $divider-color; font-size: 0.9em; padding: 0.5em 1.5em',
|
|
9917
10620
|
// buttons
|
|
9918
|
-
primaryButton: 'background-color: #7c4dff; color: #ffffff; font-family: Raleway, Roboto, sans-serif;border-radius: 0.25em; border-color: #7c4dff; border: 1px solid; cursor: pointer; font-size: .8em;text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none',
|
|
10621
|
+
primaryButton: 'background-color: #7c4dff; color: #ffffff; font-family: Raleway, Roboto, sans-serif; border-radius: 0.25em; border-color: #7c4dff; border: 1px solid; cursor: pointer; font-size: .8em;text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none',
|
|
9919
10622
|
primaryButtonHover: 'background-color: #9f7dff; color: #ffffff; font-family: Raleway, Roboto, sans-serif;border-radius: 0.25em; border-color: #7c4dff; border: 1px solid; cursor: pointer; font-size: .8em;text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none; transition: 0.25s all ease-in-out',
|
|
9920
10623
|
primaryButtonNoBorder: 'background-color: #ffffff; color: #7c4dff; font-family: Raleway, Roboto, sans-serif;border-radius: 0.25em; border-color: #7c4dff; border: 1px solid; cursor: pointer; font-size: .8em;text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none',
|
|
9921
10624
|
primaryButtonNoBorderHover: 'background-color: #7c4dff; color: #ffffff; font-family: Raleway, Roboto, sans-serif; border-radius: 0.25em; border-color: #7c4dff; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none; transition: 0.25s all ease-in-out',
|
|
@@ -12899,17 +13602,17 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
12899
13602
|
}));
|
|
12900
13603
|
exports.versionInfo = void 0;
|
|
12901
13604
|
var versionInfo = {
|
|
12902
|
-
buildTime: '2023-
|
|
12903
|
-
commit: '
|
|
13605
|
+
buildTime: '2023-04-12T09:08:49Z',
|
|
13606
|
+
commit: '94bb2a592dc8567c291363cd7b778413a560656b',
|
|
12904
13607
|
npmInfo: {
|
|
12905
13608
|
'solid-ui': '2.4.27',
|
|
12906
13609
|
npm: '8.19.4',
|
|
12907
|
-
node: '16.
|
|
12908
|
-
v8: '9.4.146.26-node.
|
|
13610
|
+
node: '16.20.0',
|
|
13611
|
+
v8: '9.4.146.26-node.26',
|
|
12909
13612
|
uv: '1.43.0',
|
|
12910
13613
|
zlib: '1.2.11',
|
|
12911
13614
|
brotli: '1.0.9',
|
|
12912
|
-
ares: '1.
|
|
13615
|
+
ares: '1.19.0',
|
|
12913
13616
|
modules: '93',
|
|
12914
13617
|
nghttp2: '1.47.0',
|
|
12915
13618
|
napi: '8',
|
|
@@ -15445,7 +16148,7 @@ _fieldFunction.field[ns.ui('Classifier').uri] = function (dom, container, alread
|
|
|
15445
16148
|
** <select id=dropDownSelect>
|
|
15446
16149
|
** <option> ....
|
|
15447
16150
|
** <subForm>
|
|
15448
|
-
** Alternative implementatons
|
|
16151
|
+
** Alternative implementatons could be:
|
|
15449
16152
|
** -- pop-up menu (as here)
|
|
15450
16153
|
** -- radio buttons
|
|
15451
16154
|
** -- auto-complete typing
|
|
@@ -15486,11 +16189,11 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
15486
16189
|
subForm: subForm,
|
|
15487
16190
|
disambiguate: false
|
|
15488
16191
|
};
|
|
15489
|
-
function getSelectorOptions() {
|
|
16192
|
+
function getSelectorOptions(dataSource) {
|
|
15490
16193
|
var possible = [];
|
|
15491
16194
|
var possibleProperties;
|
|
15492
16195
|
possible = kb.each(undefined, ns.rdf('type'), uiFrom, formDoc);
|
|
15493
|
-
for (var x in findMembersNT(kb, uiFrom,
|
|
16196
|
+
for (var x in findMembersNT(kb, uiFrom, dataSource)) {
|
|
15494
16197
|
possible.push(kb.fromNT(x));
|
|
15495
16198
|
} // Use rdfs
|
|
15496
16199
|
|
|
@@ -15522,6 +16225,10 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
15522
16225
|
|
|
15523
16226
|
var multiSelect = kb.any(form, ui('multiselect')); // Optional
|
|
15524
16227
|
if (multiSelect) opts.multiSelect = true;
|
|
16228
|
+
|
|
16229
|
+
// by default searches the dataDoc graph or optionally the full store
|
|
16230
|
+
var dataSource = kb.any(form, ui('search-full-store')).length ? null : dataDoc; // optional
|
|
16231
|
+
|
|
15525
16232
|
var selector;
|
|
15526
16233
|
rhs.refresh = function () {
|
|
15527
16234
|
// from ui:property
|
|
@@ -15529,7 +16236,7 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
15529
16236
|
return object.value;
|
|
15530
16237
|
});
|
|
15531
16238
|
// from ui:from + ui:property
|
|
15532
|
-
var possibleOptions = getSelectorOptions();
|
|
16239
|
+
var possibleOptions = getSelectorOptions(dataSource);
|
|
15533
16240
|
possibleOptions.push(selectedOptions);
|
|
15534
16241
|
possibleOptions = sortByLabel(possibleOptions);
|
|
15535
16242
|
selector = makeSelectForChoice(dom, rhs, kb, subject, property, possibleOptions, selectedOptions, uiFrom, opts, dataDoc, callbackFunction);
|
|
@@ -48705,7 +49412,9 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
48705
49412
|
if (!this._fetch) {
|
|
48706
49413
|
throw new Error('No _fetch function available for Fetcher');
|
|
48707
49414
|
}
|
|
48708
|
-
|
|
49415
|
+
// This is the name of the graph we store all the HTTP metadata in
|
|
49416
|
+
this.appNode = this.store.sym('chrome://TheCurrentSession');
|
|
49417
|
+
// this.appNode = this.store.rdfFactory.blankNode() // Needs to have a URI in tests
|
|
48709
49418
|
this.store.fetcher = this; // Bi-linked
|
|
48710
49419
|
this.requested = {};
|
|
48711
49420
|
this.timeouts = {};
|
|
@@ -49537,17 +50246,19 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
49537
50246
|
var _this10 = this;
|
|
49538
50247
|
var kb = this.store;
|
|
49539
50248
|
var responseNode = kb.bnode();
|
|
49540
|
-
kb.add(options.req, this.ns.link('response'), responseNode,
|
|
49541
|
-
kb.add(responseNode, this.ns.http('status'), kb.rdfFactory.literal(response.status),
|
|
49542
|
-
kb.add(responseNode, this.ns.http('statusText'), kb.rdfFactory.literal(response.statusText),
|
|
50249
|
+
kb.add(options.req, this.ns.link('response'), responseNode, this.appNode);
|
|
50250
|
+
kb.add(responseNode, this.ns.http('status'), kb.rdfFactory.literal(response.status), this.appNode);
|
|
50251
|
+
kb.add(responseNode, this.ns.http('statusText'), kb.rdfFactory.literal(response.statusText), this.appNode);
|
|
49543
50252
|
|
|
49544
50253
|
// Save the response headers
|
|
49545
50254
|
response.headers.forEach(function (value, header) {
|
|
49546
|
-
kb.add(responseNode, _this10.ns.httph(header), _this10.store.rdfFactory.literal(value),
|
|
50255
|
+
kb.add(responseNode, _this10.ns.httph(header), _this10.store.rdfFactory.literal(value), _this10.appNode);
|
|
49547
50256
|
if (header === 'content-type') {
|
|
49548
|
-
kb.add(options.resource, _this10.ns.rdf('type'), kb.rdfFactory.namedNode(_utils_js__WEBPACK_IMPORTED_MODULE_11__.mediaTypeClass(value).value), responseNode
|
|
50257
|
+
kb.add(options.resource, _this10.ns.rdf('type'), kb.rdfFactory.namedNode(_utils_js__WEBPACK_IMPORTED_MODULE_11__.mediaTypeClass(value).value), _this10.appNode // responseNode
|
|
50258
|
+
);
|
|
49549
50259
|
}
|
|
49550
50260
|
});
|
|
50261
|
+
|
|
49551
50262
|
return responseNode;
|
|
49552
50263
|
}
|
|
49553
50264
|
}, {
|
|
@@ -59346,17 +60057,22 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
59346
60057
|
/* harmony export */ "default": () => (/* binding */ UpdateManager)
|
|
59347
60058
|
/* harmony export */ });
|
|
59348
60059
|
/* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/esm/typeof.js");
|
|
59349
|
-
/* harmony import */ var
|
|
59350
|
-
/* harmony import */ var
|
|
59351
|
-
/* harmony import */ var
|
|
59352
|
-
/* harmony import */ var
|
|
59353
|
-
/* harmony import */ var
|
|
59354
|
-
/* harmony import */ var
|
|
59355
|
-
/* harmony import */ var
|
|
59356
|
-
/* harmony import */ var
|
|
59357
|
-
/* harmony import */ var
|
|
59358
|
-
/* harmony import */ var
|
|
59359
|
-
/* harmony import */ var
|
|
60060
|
+
/* harmony import */ var _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js");
|
|
60061
|
+
/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/esm/classCallCheck.js");
|
|
60062
|
+
/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/esm/createClass.js");
|
|
60063
|
+
/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js");
|
|
60064
|
+
/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js");
|
|
60065
|
+
/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5__);
|
|
60066
|
+
/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./store */ "./node_modules/rdflib/esm/store.js");
|
|
60067
|
+
/* harmony import */ var _uri__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./uri */ "./node_modules/rdflib/esm/uri.js");
|
|
60068
|
+
/* harmony import */ var _fetcher__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./fetcher */ "./node_modules/rdflib/esm/fetcher.js");
|
|
60069
|
+
/* harmony import */ var _namespace__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./namespace */ "./node_modules/rdflib/esm/namespace.js");
|
|
60070
|
+
/* harmony import */ var _serializer__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./serializer */ "./node_modules/rdflib/esm/serializer.js");
|
|
60071
|
+
/* harmony import */ var _utils_terms__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./utils/terms */ "./node_modules/rdflib/esm/utils/terms.js");
|
|
60072
|
+
/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./utils-js */ "./node_modules/rdflib/esm/utils-js.js");
|
|
60073
|
+
/* harmony import */ var _utils_termValue__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./utils/termValue */ "./node_modules/rdflib/esm/utils/termValue.js");
|
|
60074
|
+
|
|
60075
|
+
|
|
59360
60076
|
|
|
59361
60077
|
|
|
59362
60078
|
|
|
@@ -59393,35 +60109,35 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
59393
60109
|
* @param store - The quadstore to store data and metadata. Created if not passed.
|
|
59394
60110
|
*/
|
|
59395
60111
|
function UpdateManager(store) {
|
|
59396
|
-
(0,
|
|
59397
|
-
(0,
|
|
59398
|
-
(0,
|
|
59399
|
-
(0,
|
|
59400
|
-
(0,
|
|
59401
|
-
(0,
|
|
59402
|
-
store = store || new
|
|
60112
|
+
(0,_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__["default"])(this, UpdateManager);
|
|
60113
|
+
(0,_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_4__["default"])(this, "store", void 0);
|
|
60114
|
+
(0,_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_4__["default"])(this, "ifps", void 0);
|
|
60115
|
+
(0,_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_4__["default"])(this, "fps", void 0);
|
|
60116
|
+
(0,_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_4__["default"])(this, "patchControl", void 0);
|
|
60117
|
+
(0,_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_4__["default"])(this, "ns", void 0);
|
|
60118
|
+
store = store || new _store__WEBPACK_IMPORTED_MODULE_6__["default"]();
|
|
59403
60119
|
if (store.updater) {
|
|
59404
60120
|
throw new Error("You can't have two UpdateManagers for the same store");
|
|
59405
60121
|
}
|
|
59406
60122
|
if (!store.fetcher) {
|
|
59407
|
-
store.fetcher = new
|
|
60123
|
+
store.fetcher = new _fetcher__WEBPACK_IMPORTED_MODULE_7__["default"](store);
|
|
59408
60124
|
}
|
|
59409
60125
|
this.store = store;
|
|
59410
60126
|
store.updater = this;
|
|
59411
60127
|
this.ifps = {};
|
|
59412
60128
|
this.fps = {};
|
|
59413
60129
|
this.ns = {};
|
|
59414
|
-
this.ns.link = (0,
|
|
59415
|
-
this.ns.http = (0,
|
|
59416
|
-
this.ns.httph = (0,
|
|
59417
|
-
this.ns.ldp = (0,
|
|
59418
|
-
this.ns.rdf = (0,
|
|
59419
|
-
this.ns.rdfs = (0,
|
|
59420
|
-
this.ns.rdf = (0,
|
|
59421
|
-
this.ns.owl = (0,
|
|
60130
|
+
this.ns.link = (0,_namespace__WEBPACK_IMPORTED_MODULE_8__["default"])('http://www.w3.org/2007/ont/link#');
|
|
60131
|
+
this.ns.http = (0,_namespace__WEBPACK_IMPORTED_MODULE_8__["default"])('http://www.w3.org/2007/ont/http#');
|
|
60132
|
+
this.ns.httph = (0,_namespace__WEBPACK_IMPORTED_MODULE_8__["default"])('http://www.w3.org/2007/ont/httph#');
|
|
60133
|
+
this.ns.ldp = (0,_namespace__WEBPACK_IMPORTED_MODULE_8__["default"])('http://www.w3.org/ns/ldp#');
|
|
60134
|
+
this.ns.rdf = (0,_namespace__WEBPACK_IMPORTED_MODULE_8__["default"])('http://www.w3.org/1999/02/22-rdf-syntax-ns#');
|
|
60135
|
+
this.ns.rdfs = (0,_namespace__WEBPACK_IMPORTED_MODULE_8__["default"])('http://www.w3.org/2000/01/rdf-schema#');
|
|
60136
|
+
this.ns.rdf = (0,_namespace__WEBPACK_IMPORTED_MODULE_8__["default"])('http://www.w3.org/1999/02/22-rdf-syntax-ns#');
|
|
60137
|
+
this.ns.owl = (0,_namespace__WEBPACK_IMPORTED_MODULE_8__["default"])('http://www.w3.org/2002/07/owl#');
|
|
59422
60138
|
this.patchControl = [];
|
|
59423
60139
|
}
|
|
59424
|
-
(0,
|
|
60140
|
+
(0,_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__["default"])(UpdateManager, [{
|
|
59425
60141
|
key: "patchControlFor",
|
|
59426
60142
|
value: function patchControlFor(doc) {
|
|
59427
60143
|
if (!this.patchControl[doc.value]) {
|
|
@@ -59435,13 +60151,87 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
59435
60151
|
return uri.slice(0, 4) === 'http';
|
|
59436
60152
|
}
|
|
59437
60153
|
|
|
60154
|
+
/** Remove from the store HTTP authorization metadata
|
|
60155
|
+
* The editble function below relies on copies we have in the store
|
|
60156
|
+
* of the results of previous HTTP transactions. Howver, when
|
|
60157
|
+
* the user logs in, then that data misrepresents what would happen
|
|
60158
|
+
* if the user tried again.
|
|
60159
|
+
*/
|
|
60160
|
+
}, {
|
|
60161
|
+
key: "flagAuthorizationMetadata",
|
|
60162
|
+
value: function flagAuthorizationMetadata() {
|
|
60163
|
+
var kb = this.store;
|
|
60164
|
+
var meta = kb.fetcher.appNode;
|
|
60165
|
+
var requests = kb.statementsMatching(undefined, this.ns.link('requestedURI'), undefined, meta).map(function (st) {
|
|
60166
|
+
return st.subject;
|
|
60167
|
+
});
|
|
60168
|
+
var _iterator = _createForOfIteratorHelper(requests),
|
|
60169
|
+
_step;
|
|
60170
|
+
try {
|
|
60171
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
60172
|
+
var request = _step.value;
|
|
60173
|
+
var _response = kb.any(request, this.ns.link('response'), null, meta);
|
|
60174
|
+
if (_response !== undefined) {
|
|
60175
|
+
// ts
|
|
60176
|
+
this.store.add(_response, this.ns.link('outOfDate'), true, meta); // @@ Boolean is fine - fix types
|
|
60177
|
+
}
|
|
60178
|
+
}
|
|
60179
|
+
} catch (err) {
|
|
60180
|
+
_iterator.e(err);
|
|
60181
|
+
} finally {
|
|
60182
|
+
_iterator.f();
|
|
60183
|
+
}
|
|
60184
|
+
}
|
|
60185
|
+
|
|
60186
|
+
/**
|
|
60187
|
+
* Tests whether a file is editable.
|
|
60188
|
+
* If the file has a specific annotation that it is machine written,
|
|
60189
|
+
* for safety, it is editable (this doesn't actually check for write access)
|
|
60190
|
+
* If the file has wac-allow and accept patch headers, those are respected.
|
|
60191
|
+
* and local write access is determined by those headers.
|
|
60192
|
+
* This async version not only looks at past HTTP requests, it also makes new ones if necessary.
|
|
60193
|
+
*
|
|
60194
|
+
* @returns The method string SPARQL or DAV or
|
|
60195
|
+
* LOCALFILE or false if known, undefined if not known.
|
|
60196
|
+
*/
|
|
60197
|
+
}, {
|
|
60198
|
+
key: "checkEditable",
|
|
60199
|
+
value: function () {
|
|
60200
|
+
var _checkEditable = (0,_babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__["default"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default().mark(function _callee(uri, kb) {
|
|
60201
|
+
var initial, final;
|
|
60202
|
+
return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default().wrap(function _callee$(_context) {
|
|
60203
|
+
while (1) switch (_context.prev = _context.next) {
|
|
60204
|
+
case 0:
|
|
60205
|
+
initial = this.editable(uri, kb);
|
|
60206
|
+
if (!(initial !== undefined)) {
|
|
60207
|
+
_context.next = 3;
|
|
60208
|
+
break;
|
|
60209
|
+
}
|
|
60210
|
+
return _context.abrupt("return", initial);
|
|
60211
|
+
case 3:
|
|
60212
|
+
_context.next = 5;
|
|
60213
|
+
return this.store.fetcher.load(uri);
|
|
60214
|
+
case 5:
|
|
60215
|
+
final = this.editable(uri, kb); // console.log(`Loaded ${uri} just to check editable, result: ${final}.`)
|
|
60216
|
+
return _context.abrupt("return", final);
|
|
60217
|
+
case 7:
|
|
60218
|
+
case "end":
|
|
60219
|
+
return _context.stop();
|
|
60220
|
+
}
|
|
60221
|
+
}, _callee, this);
|
|
60222
|
+
}));
|
|
60223
|
+
function checkEditable(_x, _x2) {
|
|
60224
|
+
return _checkEditable.apply(this, arguments);
|
|
60225
|
+
}
|
|
60226
|
+
return checkEditable;
|
|
60227
|
+
}()
|
|
59438
60228
|
/**
|
|
59439
60229
|
* Tests whether a file is editable.
|
|
59440
60230
|
* If the file has a specific annotation that it is machine written,
|
|
59441
60231
|
* for safety, it is editable (this doesn't actually check for write access)
|
|
59442
60232
|
* If the file has wac-allow and accept patch headers, those are respected.
|
|
59443
60233
|
* and local write access is determined by those headers.
|
|
59444
|
-
* This version only looks at past HTTP requests, does not make new ones.
|
|
60234
|
+
* This synchronous version only looks at past HTTP requests, does not make new ones.
|
|
59445
60235
|
*
|
|
59446
60236
|
* @returns The method string SPARQL or DAV or
|
|
59447
60237
|
* LOCALFILE or false if known, undefined if not known.
|
|
@@ -59456,29 +60246,36 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
59456
60246
|
if (!kb) {
|
|
59457
60247
|
kb = this.store;
|
|
59458
60248
|
}
|
|
59459
|
-
uri = (0,
|
|
60249
|
+
uri = (0,_utils_termValue__WEBPACK_IMPORTED_MODULE_9__.termValue)(uri);
|
|
59460
60250
|
if (!this.isHttpUri(uri)) {
|
|
59461
|
-
if (
|
|
60251
|
+
if (this.store.holds(this.store.rdfFactory.namedNode(uri), this.store.rdfFactory.namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), this.store.rdfFactory.namedNode('http://www.w3.org/2007/ont/link#MachineEditableDocument'))) {
|
|
59462
60252
|
return 'LOCALFILE';
|
|
59463
60253
|
}
|
|
59464
60254
|
}
|
|
59465
60255
|
var request;
|
|
59466
60256
|
var definitive = false;
|
|
60257
|
+
var meta = this.store.fetcher.appNode;
|
|
60258
|
+
// const kb = s
|
|
60259
|
+
|
|
59467
60260
|
// @ts-ignore passes a string to kb.each, which expects a term. Should this work?
|
|
59468
|
-
var requests = kb.each(undefined, this.ns.link('requestedURI'), (0,
|
|
60261
|
+
var requests = kb.each(undefined, this.ns.link('requestedURI'), (0,_uri__WEBPACK_IMPORTED_MODULE_10__.docpart)(uri), meta);
|
|
59469
60262
|
var method;
|
|
59470
60263
|
for (var r = 0; r < requests.length; r++) {
|
|
59471
60264
|
request = requests[r];
|
|
59472
60265
|
if (request !== undefined) {
|
|
59473
|
-
var
|
|
59474
|
-
if (
|
|
59475
|
-
|
|
60266
|
+
var _response2 = kb.any(request, this.ns.link('response'), null, meta);
|
|
60267
|
+
if (_response2 !== undefined) {
|
|
60268
|
+
// ts
|
|
60269
|
+
|
|
60270
|
+
var outOfDate = kb.anyJS(_response2, this.ns.link('outOfDate'), null, meta);
|
|
60271
|
+
if (outOfDate) continue;
|
|
60272
|
+
var wacAllow = kb.anyValue(_response2, this.ns.httph('wac-allow'));
|
|
59476
60273
|
if (wacAllow) {
|
|
59477
|
-
var
|
|
59478
|
-
|
|
60274
|
+
var _iterator2 = _createForOfIteratorHelper(wacAllow.split(',')),
|
|
60275
|
+
_step2;
|
|
59479
60276
|
try {
|
|
59480
|
-
for (
|
|
59481
|
-
var bit =
|
|
60277
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
60278
|
+
var bit = _step2.value;
|
|
59482
60279
|
var lr = bit.split('=');
|
|
59483
60280
|
if (lr[0].includes('user') && !lr[1].includes('write') && !lr[1].includes('append')) {
|
|
59484
60281
|
// console.log(' editable? excluded by WAC-Allow: ', wacAllow)
|
|
@@ -59486,12 +60283,12 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
59486
60283
|
}
|
|
59487
60284
|
}
|
|
59488
60285
|
} catch (err) {
|
|
59489
|
-
|
|
60286
|
+
_iterator2.e(err);
|
|
59490
60287
|
} finally {
|
|
59491
|
-
|
|
60288
|
+
_iterator2.f();
|
|
59492
60289
|
}
|
|
59493
60290
|
}
|
|
59494
|
-
var acceptPatch = kb.each(
|
|
60291
|
+
var acceptPatch = kb.each(_response2, this.ns.httph('accept-patch'));
|
|
59495
60292
|
if (acceptPatch.length) {
|
|
59496
60293
|
for (var i = 0; i < acceptPatch.length; i++) {
|
|
59497
60294
|
method = acceptPatch[i].value.trim();
|
|
@@ -59499,7 +60296,7 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
59499
60296
|
if (method.indexOf('application/sparql-update-single-match') >= 0) return 'SPARQL';
|
|
59500
60297
|
}
|
|
59501
60298
|
}
|
|
59502
|
-
var authorVia = kb.each(
|
|
60299
|
+
var authorVia = kb.each(_response2, this.ns.httph('ms-author-via'));
|
|
59503
60300
|
if (authorVia.length) {
|
|
59504
60301
|
for (var _i = 0; _i < authorVia.length; _i++) {
|
|
59505
60302
|
method = authorVia[_i].value.trim();
|
|
@@ -59514,7 +60311,7 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
59514
60311
|
if (!this.isHttpUri(uri)) {
|
|
59515
60312
|
if (!wacAllow) return false;else return 'LOCALFILE';
|
|
59516
60313
|
}
|
|
59517
|
-
var status = kb.each(
|
|
60314
|
+
var status = kb.each(_response2, this.ns.http('status'));
|
|
59518
60315
|
if (status.length) {
|
|
59519
60316
|
for (var _i2 = 0; _i2 < status.length; _i2++) {
|
|
59520
60317
|
// @ts-ignore since statuses should be TFTerms, this should always be false
|
|
@@ -59563,7 +60360,7 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
59563
60360
|
key: "statementBnodes",
|
|
59564
60361
|
value: function statementBnodes(st) {
|
|
59565
60362
|
return [st.subject, st.predicate, st.object].filter(function (x) {
|
|
59566
|
-
return (0,
|
|
60363
|
+
return (0,_utils_terms__WEBPACK_IMPORTED_MODULE_11__.isBlankNode)(x);
|
|
59567
60364
|
});
|
|
59568
60365
|
}
|
|
59569
60366
|
|
|
@@ -59958,7 +60755,7 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
59958
60755
|
// console.log('Server does not support live updates through Updates-Via :-(')
|
|
59959
60756
|
return false;
|
|
59960
60757
|
}
|
|
59961
|
-
wssURI = (0,
|
|
60758
|
+
wssURI = (0,_uri__WEBPACK_IMPORTED_MODULE_10__.join)(wssURI, doc.value);
|
|
59962
60759
|
var validWssURI = wssURI.replace(/^http:/, 'ws:').replace(/^https:/, 'wss:');
|
|
59963
60760
|
// console.log('Web socket URI ' + wssURI)
|
|
59964
60761
|
|
|
@@ -60098,8 +60895,8 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
60098
60895
|
|
|
60099
60896
|
try {
|
|
60100
60897
|
var kb = this.store;
|
|
60101
|
-
var ds = !deletions ? [] : (0,
|
|
60102
|
-
var is = !insertions ? [] : (0,
|
|
60898
|
+
var ds = !deletions ? [] : (0,_utils_terms__WEBPACK_IMPORTED_MODULE_11__.isStore)(deletions) ? deletions.statements : deletions instanceof Array ? deletions : [deletions];
|
|
60899
|
+
var is = !insertions ? [] : (0,_utils_terms__WEBPACK_IMPORTED_MODULE_11__.isStore)(insertions) ? insertions.statements : insertions instanceof Array ? insertions : [insertions];
|
|
60103
60900
|
if (!(ds instanceof Array)) {
|
|
60104
60901
|
throw new Error('Type Error ' + (0,_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__["default"])(ds) + ': ' + ds);
|
|
60105
60902
|
}
|
|
@@ -60256,7 +61053,7 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
60256
61053
|
}
|
|
60257
61054
|
}
|
|
60258
61055
|
} catch (e) {
|
|
60259
|
-
callback(undefined, false, 'Exception in update: ' + e + '\n' +
|
|
61056
|
+
callback(undefined, false, 'Exception in update: ' + e + '\n' + _utils_js__WEBPACK_IMPORTED_MODULE_12__.stackString(e));
|
|
60260
61057
|
}
|
|
60261
61058
|
}
|
|
60262
61059
|
}, {
|
|
@@ -60279,7 +61076,7 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
60279
61076
|
// prepare contents of revised document
|
|
60280
61077
|
var newSts = kb.statementsMatching(undefined, undefined, undefined, doc).slice(); // copy!
|
|
60281
61078
|
for (var i = 0; i < ds.length; i++) {
|
|
60282
|
-
|
|
61079
|
+
_utils_js__WEBPACK_IMPORTED_MODULE_12__.RDFArrayRemove(newSts, ds[i]);
|
|
60283
61080
|
}
|
|
60284
61081
|
for (var _i9 = 0; _i9 < is.length; _i9++) {
|
|
60285
61082
|
newSts.push(is[_i9]);
|
|
@@ -60290,7 +61087,7 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
60290
61087
|
var candidateTarget = kb.the(response, this.ns.httph('content-location'));
|
|
60291
61088
|
var targetURI;
|
|
60292
61089
|
if (candidateTarget) {
|
|
60293
|
-
targetURI = (0,
|
|
61090
|
+
targetURI = (0,_uri__WEBPACK_IMPORTED_MODULE_10__.join)(candidateTarget.value, targetURI);
|
|
60294
61091
|
}
|
|
60295
61092
|
options.contentType = contentType;
|
|
60296
61093
|
options.noMeta = true;
|
|
@@ -60331,7 +61128,7 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
60331
61128
|
var newSts = kb.statementsMatching(undefined, undefined, undefined, doc).slice(); // copy!
|
|
60332
61129
|
|
|
60333
61130
|
for (var i = 0; i < ds.length; i++) {
|
|
60334
|
-
|
|
61131
|
+
_utils_js__WEBPACK_IMPORTED_MODULE_12__.RDFArrayRemove(newSts, ds[i]);
|
|
60335
61132
|
}
|
|
60336
61133
|
for (var _i12 = 0; _i12 < is.length; _i12++) {
|
|
60337
61134
|
newSts.push(is[_i12]);
|
|
@@ -60342,7 +61139,7 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
60342
61139
|
throw new Error('Rewriting file: No filename extension: ' + doc.value);
|
|
60343
61140
|
}
|
|
60344
61141
|
var ext = doc.value.slice(dot + 1);
|
|
60345
|
-
var contentType =
|
|
61142
|
+
var contentType = _fetcher__WEBPACK_IMPORTED_MODULE_7__["default"].CONTENT_TYPE_BY_EXT[ext];
|
|
60346
61143
|
if (!contentType) {
|
|
60347
61144
|
throw new Error('File extension .' + ext + ' not supported for data write');
|
|
60348
61145
|
}
|
|
@@ -60375,7 +61172,7 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
60375
61172
|
}
|
|
60376
61173
|
|
|
60377
61174
|
// serialize to the appropriate format
|
|
60378
|
-
var sz = (0,
|
|
61175
|
+
var sz = (0,_serializer__WEBPACK_IMPORTED_MODULE_13__["default"])(kb);
|
|
60379
61176
|
sz.suggestNamespaces(kb.namespaces);
|
|
60380
61177
|
sz.setBase(uri);
|
|
60381
61178
|
switch (contentType) {
|
|
@@ -74020,6 +74817,8 @@ module.exports = JSON.parse('{"application/1d-interleaved-parityfec":{"source":"
|
|
|
74020
74817
|
/******/ // This entry module is referenced by other modules so it can't be inlined
|
|
74021
74818
|
/******/ var __webpack_exports__ = __webpack_require__("./lib/index.js");
|
|
74022
74819
|
/******/
|
|
74820
|
+
/******/ return __webpack_exports__;
|
|
74023
74821
|
/******/ })()
|
|
74024
74822
|
;
|
|
74025
|
-
|
|
74823
|
+
});
|
|
74824
|
+
//# sourceMappingURL=solid-ui.js.map
|