solid-ui 2.4.27-2fde6df4 → 2.4.27-36cc321d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/solid-ui.js +1801 -1023
- package/dist/solid-ui.js.map +1 -1
- package/dist/solid-ui.min.js +1 -1
- package/dist/solid-ui.min.js.map +1 -1
- 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/login/login.d.ts.map +1 -1
- package/lib/login/login.js +26 -22
- package/lib/login/login.js.map +1 -1
- package/lib/preferences.js +4 -0
- package/lib/preferences.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 +3 -2
package/dist/solid-ui.js
CHANGED
|
@@ -2285,8 +2285,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
2285
2285
|
* @packageDocumentation
|
|
2286
2286
|
*/
|
|
2287
2287
|
|
|
2288
|
-
/* global alert confirm */
|
|
2289
|
-
|
|
2290
2288
|
// pull in first avoid cross-refs
|
|
2291
2289
|
|
|
2292
2290
|
var UI = {
|
|
@@ -2379,7 +2377,8 @@ function _findBookmarkDocument() {
|
|
|
2379
2377
|
}
|
|
2380
2378
|
userContext.bookmarkDocument = userContext.instances[0];
|
|
2381
2379
|
if (userContext.instances.length > 1) {
|
|
2382
|
-
|
|
2380
|
+
debug.warn('More than one bookmark file! ' + userContext.instances); // @@ todo - deal with > 1
|
|
2381
|
+
// Note: should pick up community bookmarks as well
|
|
2383
2382
|
}
|
|
2384
2383
|
_context.next = 28;
|
|
2385
2384
|
break;
|
|
@@ -2400,7 +2399,7 @@ function _findBookmarkDocument() {
|
|
|
2400
2399
|
case 18:
|
|
2401
2400
|
_context.prev = 18;
|
|
2402
2401
|
_context.t0 = _context["catch"](12);
|
|
2403
|
-
|
|
2402
|
+
debug.warn("Can't make fresh bookmark file:" + _context.t0);
|
|
2404
2403
|
return _context.abrupt("return", userContext);
|
|
2405
2404
|
case 22:
|
|
2406
2405
|
_context.next = 24;
|
|
@@ -2410,7 +2409,7 @@ function _findBookmarkDocument() {
|
|
|
2410
2409
|
_context.next = 28;
|
|
2411
2410
|
break;
|
|
2412
2411
|
case 27:
|
|
2413
|
-
|
|
2412
|
+
debug.warn('You seem to have no bookmark file and not even a profile file.');
|
|
2414
2413
|
case 28:
|
|
2415
2414
|
return _context.abrupt("return", userContext);
|
|
2416
2415
|
case 29:
|
|
@@ -2465,7 +2464,7 @@ function _addBookmark() {
|
|
|
2465
2464
|
_context2.prev = 14;
|
|
2466
2465
|
_context2.t0 = _context2["catch"](9);
|
|
2467
2466
|
msg = 'Making bookmark: ' + _context2.t0;
|
|
2468
|
-
|
|
2467
|
+
debug.warn(msg);
|
|
2469
2468
|
return _context2.abrupt("return", null);
|
|
2470
2469
|
case 19:
|
|
2471
2470
|
return _context2.abrupt("return", bookmark);
|
|
@@ -2518,7 +2517,7 @@ function _toggleBookmark() {
|
|
|
2518
2517
|
_context3.prev = 15;
|
|
2519
2518
|
_context3.t0 = _context3["catch"](8);
|
|
2520
2519
|
debug.error('Cant delete bookmark:' + _context3.t0);
|
|
2521
|
-
|
|
2520
|
+
debug.warn('Cant delete bookmark:' + _context3.t0);
|
|
2522
2521
|
case 19:
|
|
2523
2522
|
i++;
|
|
2524
2523
|
_context3.next = 7;
|
|
@@ -2613,6 +2612,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
2613
2612
|
}));
|
|
2614
2613
|
exports.ChatChannel = void 0;
|
|
2615
2614
|
exports._createIfNotExists = _createIfNotExists;
|
|
2615
|
+
exports.allVersions = allVersions;
|
|
2616
2616
|
exports.isDeleted = isDeleted;
|
|
2617
2617
|
exports.isHidden = isHidden;
|
|
2618
2618
|
exports.isReplaced = isReplaced;
|
|
@@ -2688,6 +2688,7 @@ var ChatChannel = /*#__PURE__*/function () {
|
|
|
2688
2688
|
var _this = this;
|
|
2689
2689
|
var oldMsg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
2690
2690
|
var deleteIt = arguments.length > 2 ? arguments[2] : undefined;
|
|
2691
|
+
var thread = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
2691
2692
|
return /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
2692
2693
|
var sts, now, timestamp, dateStamp, chatDocument, message, me, msg;
|
|
2693
2694
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
@@ -2700,41 +2701,61 @@ var ChatChannel = /*#__PURE__*/function () {
|
|
|
2700
2701
|
chatDocument = oldMsg ? oldMsg.doc() : _this.dateFolder.leafDocumentFromDate(now);
|
|
2701
2702
|
message = _solidLogic.store.sym(chatDocument.uri + '#' + 'Msg' + timestamp); // const content = store.literal(text)
|
|
2702
2703
|
me = _solidLogic.authn.currentUser(); // If already logged on
|
|
2703
|
-
if (oldMsg) {
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2704
|
+
if (!oldMsg) {
|
|
2705
|
+
_context2.next = 21;
|
|
2706
|
+
break;
|
|
2707
|
+
}
|
|
2708
|
+
_context2.t0 = sts;
|
|
2709
|
+
_context2.t1 = $rdf;
|
|
2710
|
+
_context2.next = 12;
|
|
2711
|
+
return mostRecentVersion(oldMsg);
|
|
2712
|
+
case 12:
|
|
2713
|
+
_context2.t2 = _context2.sent;
|
|
2714
|
+
_context2.t3 = ns.dct('isReplacedBy');
|
|
2715
|
+
_context2.t4 = message;
|
|
2716
|
+
_context2.t5 = chatDocument;
|
|
2717
|
+
_context2.t6 = _context2.t1.st.call(_context2.t1, _context2.t2, _context2.t3, _context2.t4, _context2.t5);
|
|
2718
|
+
_context2.t0.push.call(_context2.t0, _context2.t6);
|
|
2719
|
+
if (deleteIt) {
|
|
2720
|
+
sts.push($rdf.st(message, ns.schema('dateDeleted'), dateStamp, chatDocument));
|
|
2712
2721
|
}
|
|
2722
|
+
_context2.next = 22;
|
|
2723
|
+
break;
|
|
2724
|
+
case 21:
|
|
2725
|
+
// link new message to channel
|
|
2726
|
+
sts.push($rdf.st(_this.channel, ns.wf('message'), message, chatDocument));
|
|
2727
|
+
case 22:
|
|
2713
2728
|
sts.push($rdf.st(message, ns.sioc('content'), _solidLogic.store.literal(text), chatDocument));
|
|
2714
2729
|
sts.push($rdf.st(message, ns.dct('created'), dateStamp, chatDocument));
|
|
2715
2730
|
if (me) {
|
|
2716
2731
|
sts.push($rdf.st(message, ns.foaf('maker'), me, chatDocument));
|
|
2717
2732
|
}
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2733
|
+
if (thread) {
|
|
2734
|
+
sts.push($rdf.st(thread, ns.sioc('has_member'), message, chatDocument));
|
|
2735
|
+
if (!thread.doc().sameTerm(message.doc())) {
|
|
2736
|
+
sts.push($rdf.st(thread, ns.sioc('has_member'), message, thread.doc()));
|
|
2737
|
+
}
|
|
2738
|
+
}
|
|
2739
|
+
_context2.prev = 26;
|
|
2740
|
+
_context2.next = 29;
|
|
2741
|
+
return _solidLogic.store.updater.updateMany([], sts);
|
|
2742
|
+
case 29:
|
|
2743
|
+
_context2.next = 37;
|
|
2723
2744
|
break;
|
|
2724
|
-
case
|
|
2725
|
-
_context2.prev =
|
|
2726
|
-
_context2.
|
|
2727
|
-
msg = 'Error saving chat message: ' + _context2.
|
|
2745
|
+
case 31:
|
|
2746
|
+
_context2.prev = 31;
|
|
2747
|
+
_context2.t7 = _context2["catch"](26);
|
|
2748
|
+
msg = 'Error saving chat message: ' + _context2.t7;
|
|
2728
2749
|
debug.warn(msg);
|
|
2729
2750
|
alert(msg);
|
|
2730
2751
|
throw new Error(msg);
|
|
2731
|
-
case
|
|
2752
|
+
case 37:
|
|
2732
2753
|
return _context2.abrupt("return", message);
|
|
2733
|
-
case
|
|
2754
|
+
case 38:
|
|
2734
2755
|
case "end":
|
|
2735
2756
|
return _context2.stop();
|
|
2736
2757
|
}
|
|
2737
|
-
}, _callee2, null, [[
|
|
2758
|
+
}, _callee2, null, [[26, 31]]);
|
|
2738
2759
|
})();
|
|
2739
2760
|
});
|
|
2740
2761
|
function updateMessage(_x2) {
|
|
@@ -2764,26 +2785,187 @@ var ChatChannel = /*#__PURE__*/function () {
|
|
|
2764
2785
|
return _deleteMessage.apply(this, arguments);
|
|
2765
2786
|
}
|
|
2766
2787
|
return deleteMessage;
|
|
2788
|
+
}() // Create a new thread of replies to the thread root message
|
|
2789
|
+
// or returns one which already exists
|
|
2790
|
+
}, {
|
|
2791
|
+
key: "createThread",
|
|
2792
|
+
value: function () {
|
|
2793
|
+
var _createThread = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(threadRoot) {
|
|
2794
|
+
var already, thread, insert;
|
|
2795
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
2796
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
2797
|
+
case 0:
|
|
2798
|
+
already = _solidLogic.store.each(threadRoot, ns.sioc('has_reply'), null, threadRoot.doc()).filter(function (thread) {
|
|
2799
|
+
return _solidLogic.store.holds(thread, ns.rdf('type'), ns.sioc('Thread'), thread.doc());
|
|
2800
|
+
});
|
|
2801
|
+
if (!(already.length > 0)) {
|
|
2802
|
+
_context4.next = 3;
|
|
2803
|
+
break;
|
|
2804
|
+
}
|
|
2805
|
+
return _context4.abrupt("return", already[0]);
|
|
2806
|
+
case 3:
|
|
2807
|
+
thread = $rdf.sym(threadRoot.uri + '-thread');
|
|
2808
|
+
insert = [$rdf.st(thread, ns.rdf('type'), ns.sioc('Thread'), thread.doc()), $rdf.st(threadRoot, ns.sioc('has_reply'), thread, thread.doc())];
|
|
2809
|
+
_context4.next = 7;
|
|
2810
|
+
return _solidLogic.store.updater.update([], insert);
|
|
2811
|
+
case 7:
|
|
2812
|
+
return _context4.abrupt("return", thread);
|
|
2813
|
+
case 8:
|
|
2814
|
+
case "end":
|
|
2815
|
+
return _context4.stop();
|
|
2816
|
+
}
|
|
2817
|
+
}, _callee4);
|
|
2818
|
+
}));
|
|
2819
|
+
function createThread(_x4) {
|
|
2820
|
+
return _createThread.apply(this, arguments);
|
|
2821
|
+
}
|
|
2822
|
+
return createThread;
|
|
2767
2823
|
}()
|
|
2768
2824
|
}]);
|
|
2769
2825
|
return ChatChannel;
|
|
2770
2826
|
}(); // class ChatChannel
|
|
2827
|
+
// ////////// Utility functions
|
|
2828
|
+
// Have to not loop forever if fed loops
|
|
2771
2829
|
exports.ChatChannel = ChatChannel;
|
|
2772
|
-
function
|
|
2773
|
-
|
|
2774
|
-
while (msg) {
|
|
2775
|
-
message = msg;
|
|
2776
|
-
msg = _solidLogic.store.any(null, ns.dct('isReplacedBy'), message, message.doc());
|
|
2777
|
-
}
|
|
2778
|
-
return message;
|
|
2830
|
+
function allVersions(_x5) {
|
|
2831
|
+
return _allVersions.apply(this, arguments);
|
|
2779
2832
|
}
|
|
2780
|
-
function
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2833
|
+
function _allVersions() {
|
|
2834
|
+
_allVersions = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(message) {
|
|
2835
|
+
var versions, done, m, prev, next;
|
|
2836
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
2837
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
2838
|
+
case 0:
|
|
2839
|
+
versions = [message];
|
|
2840
|
+
done = {};
|
|
2841
|
+
done[message.ur] = true;
|
|
2842
|
+
m = message;
|
|
2843
|
+
case 4:
|
|
2844
|
+
if (false) {}
|
|
2845
|
+
// earlier?
|
|
2846
|
+
prev = _solidLogic.store.any(null, ns.dct('isReplacedBy'), m, m.doc());
|
|
2847
|
+
if (!(!prev || done[prev.uri])) {
|
|
2848
|
+
_context5.next = 8;
|
|
2849
|
+
break;
|
|
2850
|
+
}
|
|
2851
|
+
return _context5.abrupt("break", 15);
|
|
2852
|
+
case 8:
|
|
2853
|
+
_context5.next = 10;
|
|
2854
|
+
return _solidLogic.store.fetcher.load(prev);
|
|
2855
|
+
case 10:
|
|
2856
|
+
versions.unshift(prev);
|
|
2857
|
+
done[prev.uri] = true;
|
|
2858
|
+
m = prev;
|
|
2859
|
+
_context5.next = 4;
|
|
2860
|
+
break;
|
|
2861
|
+
case 15:
|
|
2862
|
+
m = message;
|
|
2863
|
+
case 16:
|
|
2864
|
+
if (false) {}
|
|
2865
|
+
// later?
|
|
2866
|
+
next = _solidLogic.store.any(m, ns.dct('isReplacedBy'), null, m.doc());
|
|
2867
|
+
if (!(!next || done[next.uri])) {
|
|
2868
|
+
_context5.next = 20;
|
|
2869
|
+
break;
|
|
2870
|
+
}
|
|
2871
|
+
return _context5.abrupt("break", 25);
|
|
2872
|
+
case 20:
|
|
2873
|
+
versions.push(next);
|
|
2874
|
+
done[next.uri] = true;
|
|
2875
|
+
m = next;
|
|
2876
|
+
_context5.next = 16;
|
|
2877
|
+
break;
|
|
2878
|
+
case 25:
|
|
2879
|
+
return _context5.abrupt("return", versions);
|
|
2880
|
+
case 26:
|
|
2881
|
+
case "end":
|
|
2882
|
+
return _context5.stop();
|
|
2883
|
+
}
|
|
2884
|
+
}, _callee5);
|
|
2885
|
+
}));
|
|
2886
|
+
return _allVersions.apply(this, arguments);
|
|
2887
|
+
}
|
|
2888
|
+
function originalVersion(_x6) {
|
|
2889
|
+
return _originalVersion.apply(this, arguments);
|
|
2890
|
+
}
|
|
2891
|
+
function _originalVersion() {
|
|
2892
|
+
_originalVersion = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(message) {
|
|
2893
|
+
var msg, done;
|
|
2894
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
2895
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
2896
|
+
case 0:
|
|
2897
|
+
msg = message;
|
|
2898
|
+
done = {}; // done[message.ur] = true
|
|
2899
|
+
case 2:
|
|
2900
|
+
if (!msg) {
|
|
2901
|
+
_context6.next = 13;
|
|
2902
|
+
break;
|
|
2903
|
+
}
|
|
2904
|
+
if (!done[msg.uri]) {
|
|
2905
|
+
_context6.next = 6;
|
|
2906
|
+
break;
|
|
2907
|
+
}
|
|
2908
|
+
debug.error('originalVersion: verion loop' + message);
|
|
2909
|
+
return _context6.abrupt("return", message);
|
|
2910
|
+
case 6:
|
|
2911
|
+
done[msg.uri] = true;
|
|
2912
|
+
message = msg;
|
|
2913
|
+
_context6.next = 10;
|
|
2914
|
+
return _solidLogic.store.fetcher.load(message);
|
|
2915
|
+
case 10:
|
|
2916
|
+
msg = _solidLogic.store.any(null, ns.dct('isReplacedBy'), message, message.doc());
|
|
2917
|
+
_context6.next = 2;
|
|
2918
|
+
break;
|
|
2919
|
+
case 13:
|
|
2920
|
+
return _context6.abrupt("return", message);
|
|
2921
|
+
case 14:
|
|
2922
|
+
case "end":
|
|
2923
|
+
return _context6.stop();
|
|
2924
|
+
}
|
|
2925
|
+
}, _callee6);
|
|
2926
|
+
}));
|
|
2927
|
+
return _originalVersion.apply(this, arguments);
|
|
2928
|
+
}
|
|
2929
|
+
function mostRecentVersion(_x7) {
|
|
2930
|
+
return _mostRecentVersion.apply(this, arguments);
|
|
2931
|
+
}
|
|
2932
|
+
function _mostRecentVersion() {
|
|
2933
|
+
_mostRecentVersion = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(message) {
|
|
2934
|
+
var msg, done;
|
|
2935
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
2936
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
2937
|
+
case 0:
|
|
2938
|
+
msg = message;
|
|
2939
|
+
done = {};
|
|
2940
|
+
case 2:
|
|
2941
|
+
if (!msg) {
|
|
2942
|
+
_context7.next = 13;
|
|
2943
|
+
break;
|
|
2944
|
+
}
|
|
2945
|
+
if (!done[msg.uri]) {
|
|
2946
|
+
_context7.next = 6;
|
|
2947
|
+
break;
|
|
2948
|
+
}
|
|
2949
|
+
debug.error('mostRecentVersion: verion loop' + message);
|
|
2950
|
+
return _context7.abrupt("return", message);
|
|
2951
|
+
case 6:
|
|
2952
|
+
done[msg.uri] = true;
|
|
2953
|
+
message = msg;
|
|
2954
|
+
_context7.next = 10;
|
|
2955
|
+
return _solidLogic.store.fetcher.load(message);
|
|
2956
|
+
case 10:
|
|
2957
|
+
msg = _solidLogic.store.any(message, ns.dct('isReplacedBy'), null, message.doc());
|
|
2958
|
+
_context7.next = 2;
|
|
2959
|
+
break;
|
|
2960
|
+
case 13:
|
|
2961
|
+
return _context7.abrupt("return", message);
|
|
2962
|
+
case 14:
|
|
2963
|
+
case "end":
|
|
2964
|
+
return _context7.stop();
|
|
2965
|
+
}
|
|
2966
|
+
}, _callee7);
|
|
2967
|
+
}));
|
|
2968
|
+
return _mostRecentVersion.apply(this, arguments);
|
|
2787
2969
|
}
|
|
2788
2970
|
function isDeleted(message) {
|
|
2789
2971
|
return _solidLogic.store.holds(message, ns.schema('dateDeleted'), null, message.doc());
|
|
@@ -2802,62 +2984,62 @@ function nick(person) {
|
|
|
2802
2984
|
if (s) return '' + s.value;
|
|
2803
2985
|
return '' + utils.label(person);
|
|
2804
2986
|
}
|
|
2805
|
-
function _createIfNotExists(
|
|
2987
|
+
function _createIfNotExists(_x8) {
|
|
2806
2988
|
return _createIfNotExists2.apply(this, arguments);
|
|
2807
2989
|
} // ends
|
|
2808
2990
|
function _createIfNotExists2() {
|
|
2809
2991
|
_createIfNotExists2 = (0, _asyncToGenerator2["default"])(function (doc) {
|
|
2810
2992
|
var contentType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'text/turtle';
|
|
2811
2993
|
var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
2812
|
-
return /*#__PURE__*/_regenerator["default"].mark(function
|
|
2994
|
+
return /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
|
|
2813
2995
|
var response;
|
|
2814
|
-
return _regenerator["default"].wrap(function
|
|
2815
|
-
while (1) switch (
|
|
2996
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
2997
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
2816
2998
|
case 0:
|
|
2817
|
-
|
|
2818
|
-
|
|
2999
|
+
_context8.prev = 0;
|
|
3000
|
+
_context8.next = 3;
|
|
2819
3001
|
return _solidLogic.store.fetcher.load(doc);
|
|
2820
3002
|
case 3:
|
|
2821
|
-
response =
|
|
2822
|
-
|
|
3003
|
+
response = _context8.sent;
|
|
3004
|
+
_context8.next = 26;
|
|
2823
3005
|
break;
|
|
2824
3006
|
case 6:
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
if (!(
|
|
2828
|
-
|
|
3007
|
+
_context8.prev = 6;
|
|
3008
|
+
_context8.t0 = _context8["catch"](0);
|
|
3009
|
+
if (!(_context8.t0.response.status === 404)) {
|
|
3010
|
+
_context8.next = 24;
|
|
2829
3011
|
break;
|
|
2830
3012
|
}
|
|
2831
3013
|
debug.log('createIfNotExists: doc does NOT exist, will create... ' + doc);
|
|
2832
|
-
|
|
2833
|
-
|
|
3014
|
+
_context8.prev = 10;
|
|
3015
|
+
_context8.next = 13;
|
|
2834
3016
|
return _solidLogic.store.fetcher.webOperation('PUT', doc.uri, {
|
|
2835
3017
|
data: data,
|
|
2836
3018
|
contentType: contentType
|
|
2837
3019
|
});
|
|
2838
3020
|
case 13:
|
|
2839
|
-
response =
|
|
2840
|
-
|
|
3021
|
+
response = _context8.sent;
|
|
3022
|
+
_context8.next = 20;
|
|
2841
3023
|
break;
|
|
2842
3024
|
case 16:
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
debug.log('createIfNotExists doc FAILED: ' + doc + ': ' +
|
|
2846
|
-
throw
|
|
3025
|
+
_context8.prev = 16;
|
|
3026
|
+
_context8.t1 = _context8["catch"](10);
|
|
3027
|
+
debug.log('createIfNotExists doc FAILED: ' + doc + ': ' + _context8.t1);
|
|
3028
|
+
throw _context8.t1;
|
|
2847
3029
|
case 20:
|
|
2848
3030
|
delete _solidLogic.store.fetcher.requested[doc.uri]; // delete cached 404 error
|
|
2849
3031
|
// debug.log('createIfNotExists doc created ok ' + doc)
|
|
2850
|
-
return
|
|
3032
|
+
return _context8.abrupt("return", response);
|
|
2851
3033
|
case 24:
|
|
2852
|
-
debug.log('createIfNotExists doc load error NOT 404: ' + doc + ': ' +
|
|
2853
|
-
throw
|
|
3034
|
+
debug.log('createIfNotExists doc load error NOT 404: ' + doc + ': ' + _context8.t0);
|
|
3035
|
+
throw _context8.t0;
|
|
2854
3036
|
case 26:
|
|
2855
|
-
return
|
|
3037
|
+
return _context8.abrupt("return", response);
|
|
2856
3038
|
case 27:
|
|
2857
3039
|
case "end":
|
|
2858
|
-
return
|
|
3040
|
+
return _context8.stop();
|
|
2859
3041
|
}
|
|
2860
|
-
},
|
|
3042
|
+
}, _callee8, null, [[0, 6], [10, 16]]);
|
|
2861
3043
|
})();
|
|
2862
3044
|
});
|
|
2863
3045
|
return _createIfNotExists2.apply(this, arguments);
|
|
@@ -3235,19 +3417,9 @@ var _chatLogic = __webpack_require__(/*! ./chatLogic */ "./lib/chat/chatLogic.js
|
|
|
3235
3417
|
var _message = __webpack_require__(/*! ./message */ "./lib/chat/message.js");
|
|
3236
3418
|
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); }
|
|
3237
3419
|
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; }
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
*/
|
|
3242
|
-
// import { findBookmarkDocument } from './bookmarks'
|
|
3243
|
-
// pull in first avoid cross-refs
|
|
3244
|
-
|
|
3245
|
-
// import * as style from '../style'
|
|
3246
|
-
// import * as utils from '../utils'
|
|
3247
|
-
|
|
3248
|
-
// import * as pad from '../pad'
|
|
3249
|
-
// import { DateFolder } from './dateFolder'
|
|
3250
|
-
|
|
3420
|
+
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; } } }; }
|
|
3421
|
+
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); }
|
|
3422
|
+
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; }
|
|
3251
3423
|
// const UI = { authn, icons, ns, media, pad, $rdf, store, style, utils, widgets }
|
|
3252
3424
|
|
|
3253
3425
|
function desktopNotification(str) {
|
|
@@ -3275,34 +3447,9 @@ function desktopNotification(str) {
|
|
|
3275
3447
|
/**
|
|
3276
3448
|
* Renders a chat message inside a `messageTable`
|
|
3277
3449
|
*/
|
|
3278
|
-
function insertMessageIntoTable(
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
// const message = messageRow.AJAR_subject
|
|
3282
|
-
if (options.selectedMessage && options.selectedMessage.sameTerm(message)) {
|
|
3283
|
-
messageRow.style.backgroundColor = 'yellow';
|
|
3284
|
-
options.selectedElement = messageRow;
|
|
3285
|
-
messageTable.selectedElement = messageRow;
|
|
3286
|
-
}
|
|
3287
|
-
var done = false;
|
|
3288
|
-
for (var ele = messageTable.firstChild;; ele = ele.nextSibling) {
|
|
3289
|
-
if (!ele) {
|
|
3290
|
-
// empty
|
|
3291
|
-
break;
|
|
3292
|
-
}
|
|
3293
|
-
var newestFirst = options.newestfirst === true;
|
|
3294
|
-
var dateString = messageRow.AJAR_date;
|
|
3295
|
-
if (dateString > ele.AJAR_date && newestFirst || dateString < ele.AJAR_date && !newestFirst) {
|
|
3296
|
-
messageTable.insertBefore(messageRow, ele);
|
|
3297
|
-
done = true;
|
|
3298
|
-
break;
|
|
3299
|
-
}
|
|
3300
|
-
}
|
|
3301
|
-
if (!done) {
|
|
3302
|
-
messageTable.appendChild(messageRow);
|
|
3303
|
-
}
|
|
3450
|
+
function insertMessageIntoTable(_x, _x2, _x3, _x4, _x5, _x6) {
|
|
3451
|
+
return _insertMessageIntoTable.apply(this, arguments);
|
|
3304
3452
|
}
|
|
3305
|
-
|
|
3306
3453
|
/**
|
|
3307
3454
|
* Common code for a chat (discussion area of messages about something)
|
|
3308
3455
|
* This version runs over a series of files for different time periods
|
|
@@ -3325,20 +3472,70 @@ function insertMessageIntoTable(channelObject, messageTable, message, fresh, opt
|
|
|
3325
3472
|
- inlineImageHeightEms: The height (in ems) of images expaned from their URIs in the chat.
|
|
3326
3473
|
|
|
3327
3474
|
*/
|
|
3328
|
-
function
|
|
3475
|
+
function _insertMessageIntoTable() {
|
|
3476
|
+
_insertMessageIntoTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(channelObject, messageTable, message, fresh, options, userContext) {
|
|
3477
|
+
var messageRow, done, ele, newestFirst, dateString;
|
|
3478
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
3479
|
+
while (1) switch (_context.prev = _context.next) {
|
|
3480
|
+
case 0:
|
|
3481
|
+
_context.next = 2;
|
|
3482
|
+
return (0, _message.renderMessageRow)(channelObject, message, fresh, options, userContext);
|
|
3483
|
+
case 2:
|
|
3484
|
+
messageRow = _context.sent;
|
|
3485
|
+
// const message = messageRow.AJAR_subject
|
|
3486
|
+
if (options.selectedMessage && options.selectedMessage.sameTerm(message)) {
|
|
3487
|
+
messageRow.style.backgroundColor = 'yellow';
|
|
3488
|
+
options.selectedElement = messageRow;
|
|
3489
|
+
messageTable.selectedElement = messageRow;
|
|
3490
|
+
}
|
|
3491
|
+
done = false;
|
|
3492
|
+
ele = messageTable.firstChild;
|
|
3493
|
+
case 6:
|
|
3494
|
+
if (ele) {
|
|
3495
|
+
_context.next = 8;
|
|
3496
|
+
break;
|
|
3497
|
+
}
|
|
3498
|
+
return _context.abrupt("break", 17);
|
|
3499
|
+
case 8:
|
|
3500
|
+
newestFirst = options.newestfirst === true;
|
|
3501
|
+
dateString = messageRow.AJAR_date;
|
|
3502
|
+
if (!(dateString > ele.AJAR_date && newestFirst || dateString < ele.AJAR_date && !newestFirst)) {
|
|
3503
|
+
_context.next = 14;
|
|
3504
|
+
break;
|
|
3505
|
+
}
|
|
3506
|
+
messageTable.insertBefore(messageRow, ele);
|
|
3507
|
+
done = true;
|
|
3508
|
+
return _context.abrupt("break", 17);
|
|
3509
|
+
case 14:
|
|
3510
|
+
ele = ele.nextSibling;
|
|
3511
|
+
_context.next = 6;
|
|
3512
|
+
break;
|
|
3513
|
+
case 17:
|
|
3514
|
+
if (!done) {
|
|
3515
|
+
messageTable.appendChild(messageRow);
|
|
3516
|
+
}
|
|
3517
|
+
case 18:
|
|
3518
|
+
case "end":
|
|
3519
|
+
return _context.stop();
|
|
3520
|
+
}
|
|
3521
|
+
}, _callee);
|
|
3522
|
+
}));
|
|
3523
|
+
return _insertMessageIntoTable.apply(this, arguments);
|
|
3524
|
+
}
|
|
3525
|
+
function infiniteMessageArea(_x7, _x8, _x9, _x10) {
|
|
3329
3526
|
return _infiniteMessageArea.apply(this, arguments);
|
|
3330
3527
|
}
|
|
3331
3528
|
function _infiniteMessageArea() {
|
|
3332
|
-
_infiniteMessageArea = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3333
|
-
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;
|
|
3334
|
-
return _regenerator["default"].wrap(function
|
|
3335
|
-
while (1) switch (
|
|
3529
|
+
_infiniteMessageArea = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee15(dom, wasStore, chatChannel, options) {
|
|
3530
|
+
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;
|
|
3531
|
+
return _regenerator["default"].wrap(function _callee15$(_context15) {
|
|
3532
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
3336
3533
|
case 0:
|
|
3337
3534
|
_loadInitialContent = function _loadInitialContent3() {
|
|
3338
|
-
_loadInitialContent = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3339
|
-
var yank, fixScroll, live, selectedDocument, now, todayDocument, selectedMessageTable, selectedDate;
|
|
3340
|
-
return _regenerator["default"].wrap(function
|
|
3341
|
-
while (1) switch (
|
|
3535
|
+
_loadInitialContent = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14() {
|
|
3536
|
+
var yank, fixScroll, live, selectedDocument, threadRootDocument, initialDocment, now, todayDocument, selectedMessageTable, selectedDate;
|
|
3537
|
+
return _regenerator["default"].wrap(function _callee14$(_context14) {
|
|
3538
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
3342
3539
|
case 0:
|
|
3343
3540
|
fixScroll = function _fixScroll() {
|
|
3344
3541
|
if (options.selectedElement) {
|
|
@@ -3352,51 +3549,59 @@ function _infiniteMessageArea() {
|
|
|
3352
3549
|
}
|
|
3353
3550
|
};
|
|
3354
3551
|
yank = function _yank() {
|
|
3355
|
-
selectedMessageTable.selectedElement
|
|
3356
|
-
|
|
3357
|
-
|
|
3552
|
+
if (selectedMessageTable && selectedMessageTable.selectedElement) {
|
|
3553
|
+
selectedMessageTable.selectedElement.scrollIntoView({
|
|
3554
|
+
block: 'center'
|
|
3555
|
+
});
|
|
3556
|
+
}
|
|
3358
3557
|
};
|
|
3359
3558
|
if (options.selectedMessage) {
|
|
3360
3559
|
selectedDocument = options.selectedMessage.doc();
|
|
3560
|
+
}
|
|
3561
|
+
if (threadRootMessage) {
|
|
3562
|
+
threadRootDocument = threadRootMessage.doc();
|
|
3563
|
+
}
|
|
3564
|
+
initialDocment = selectedDocument || threadRootDocument;
|
|
3565
|
+
if (initialDocment) {
|
|
3361
3566
|
now = new Date();
|
|
3362
3567
|
todayDocument = dateFolder.leafDocumentFromDate(now);
|
|
3363
|
-
live = todayDocument.sameTerm(
|
|
3568
|
+
live = todayDocument.sameTerm(initialDocment);
|
|
3364
3569
|
}
|
|
3365
|
-
if (!(
|
|
3366
|
-
|
|
3570
|
+
if (!(initialDocment && !live)) {
|
|
3571
|
+
_context14.next = 18;
|
|
3367
3572
|
break;
|
|
3368
3573
|
}
|
|
3369
|
-
selectedDate = dateFolder.dateFromLeafDocument(
|
|
3370
|
-
|
|
3574
|
+
selectedDate = dateFolder.dateFromLeafDocument(initialDocment);
|
|
3575
|
+
_context14.next = 10;
|
|
3371
3576
|
return createMessageTable(selectedDate, live);
|
|
3372
|
-
case
|
|
3373
|
-
selectedMessageTable =
|
|
3577
|
+
case 10:
|
|
3578
|
+
selectedMessageTable = _context14.sent;
|
|
3374
3579
|
div.appendChild(selectedMessageTable);
|
|
3375
3580
|
earliest.messageTable = selectedMessageTable;
|
|
3376
3581
|
latest.messageTable = selectedMessageTable;
|
|
3377
3582
|
yank();
|
|
3378
3583
|
setTimeout(yank, 1000); // @@ kludge - restore position distubed by other cHANGES
|
|
3379
|
-
|
|
3584
|
+
_context14.next = 22;
|
|
3380
3585
|
break;
|
|
3381
|
-
case
|
|
3382
|
-
|
|
3586
|
+
case 18:
|
|
3587
|
+
_context14.next = 20;
|
|
3383
3588
|
return appendCurrentMessages();
|
|
3384
|
-
case
|
|
3589
|
+
case 20:
|
|
3385
3590
|
earliest.messageTable = liveMessageTable;
|
|
3386
3591
|
latest.messageTable = liveMessageTable;
|
|
3387
|
-
case
|
|
3388
|
-
|
|
3592
|
+
case 22:
|
|
3593
|
+
_context14.next = 24;
|
|
3389
3594
|
return loadMoreWhereNeeded(null, fixScroll);
|
|
3390
|
-
case
|
|
3595
|
+
case 24:
|
|
3391
3596
|
div.addEventListener('scroll', loadMoreWhereNeeded);
|
|
3392
3597
|
if (options.solo) {
|
|
3393
3598
|
document.body.addEventListener('scroll', loadMoreWhereNeeded);
|
|
3394
3599
|
}
|
|
3395
|
-
case
|
|
3600
|
+
case 26:
|
|
3396
3601
|
case "end":
|
|
3397
|
-
return
|
|
3602
|
+
return _context14.stop();
|
|
3398
3603
|
}
|
|
3399
|
-
},
|
|
3604
|
+
}, _callee14);
|
|
3400
3605
|
}));
|
|
3401
3606
|
return _loadInitialContent.apply(this, arguments);
|
|
3402
3607
|
};
|
|
@@ -3404,16 +3609,16 @@ function _infiniteMessageArea() {
|
|
|
3404
3609
|
return _loadInitialContent.apply(this, arguments);
|
|
3405
3610
|
};
|
|
3406
3611
|
_loadMoreWhereNeeded = function _loadMoreWhereNeeded3() {
|
|
3407
|
-
_loadMoreWhereNeeded = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3612
|
+
_loadMoreWhereNeeded = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13(event, fixScroll) {
|
|
3408
3613
|
var freeze, magicZone, done, scrollBottom, scrollTop;
|
|
3409
|
-
return _regenerator["default"].wrap(function
|
|
3410
|
-
while (1) switch (
|
|
3614
|
+
return _regenerator["default"].wrap(function _callee13$(_context13) {
|
|
3615
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
3411
3616
|
case 0:
|
|
3412
3617
|
if (!lock) {
|
|
3413
|
-
|
|
3618
|
+
_context13.next = 2;
|
|
3414
3619
|
break;
|
|
3415
3620
|
}
|
|
3416
|
-
return
|
|
3621
|
+
return _context13.abrupt("return");
|
|
3417
3622
|
case 2:
|
|
3418
3623
|
lock = true;
|
|
3419
3624
|
freeze = !fixScroll;
|
|
@@ -3421,36 +3626,36 @@ function _infiniteMessageArea() {
|
|
|
3421
3626
|
// const bottom = div.scrollHeight - top - div.clientHeight
|
|
3422
3627
|
case 5:
|
|
3423
3628
|
if (!(div.scrollTop < magicZone && earliest.messageTable && !earliest.messageTable.initial && earliest.messageTable.extendBackwards)) {
|
|
3424
|
-
|
|
3629
|
+
_context13.next = 21;
|
|
3425
3630
|
break;
|
|
3426
3631
|
}
|
|
3427
3632
|
if (!(div.scrollHeight === 0)) {
|
|
3428
|
-
|
|
3633
|
+
_context13.next = 10;
|
|
3429
3634
|
break;
|
|
3430
3635
|
}
|
|
3431
|
-
//
|
|
3636
|
+
// debug.log(' chat/loadMoreWhereNeeded: trying later...')
|
|
3432
3637
|
setTimeout(loadMoreWhereNeeded, 2000); // couple be less
|
|
3433
3638
|
lock = false;
|
|
3434
|
-
return
|
|
3639
|
+
return _context13.abrupt("return");
|
|
3435
3640
|
case 10:
|
|
3436
|
-
//
|
|
3641
|
+
// debug.log(' chat/loadMoreWhereNeeded: Going now')
|
|
3437
3642
|
scrollBottom = div.scrollHeight - div.scrollTop;
|
|
3438
3643
|
debug.log('infinite scroll: adding above: top ' + div.scrollTop);
|
|
3439
|
-
|
|
3644
|
+
_context13.next = 14;
|
|
3440
3645
|
return earliest.messageTable.extendBackwards();
|
|
3441
3646
|
case 14:
|
|
3442
|
-
done =
|
|
3647
|
+
done = _context13.sent;
|
|
3443
3648
|
if (freeze) {
|
|
3444
3649
|
div.scrollTop = div.scrollHeight - scrollBottom;
|
|
3445
3650
|
}
|
|
3446
3651
|
if (fixScroll) fixScroll();
|
|
3447
3652
|
if (!done) {
|
|
3448
|
-
|
|
3653
|
+
_context13.next = 19;
|
|
3449
3654
|
break;
|
|
3450
3655
|
}
|
|
3451
|
-
return
|
|
3656
|
+
return _context13.abrupt("break", 21);
|
|
3452
3657
|
case 19:
|
|
3453
|
-
|
|
3658
|
+
_context13.next = 5;
|
|
3454
3659
|
break;
|
|
3455
3660
|
case 21:
|
|
3456
3661
|
if (!(options.selectedMessage &&
|
|
@@ -3460,15 +3665,15 @@ function _infiniteMessageArea() {
|
|
|
3460
3665
|
latest.messageTable && !latest.messageTable["final"] &&
|
|
3461
3666
|
// there is more data to come
|
|
3462
3667
|
latest.messageTable.extendForwards)) {
|
|
3463
|
-
|
|
3668
|
+
_context13.next = 33;
|
|
3464
3669
|
break;
|
|
3465
3670
|
}
|
|
3466
3671
|
scrollTop = div.scrollTop;
|
|
3467
3672
|
debug.log('infinite scroll: adding below: bottom: ' + (div.scrollHeight - div.scrollTop - div.clientHeight));
|
|
3468
|
-
|
|
3673
|
+
_context13.next = 26;
|
|
3469
3674
|
return latest.messageTable.extendForwards();
|
|
3470
3675
|
case 26:
|
|
3471
|
-
done =
|
|
3676
|
+
done = _context13.sent;
|
|
3472
3677
|
// then add more data on the bottom
|
|
3473
3678
|
if (freeze) {
|
|
3474
3679
|
div.scrollTop = scrollTop; // while adding below keep same things in view
|
|
@@ -3476,63 +3681,66 @@ function _infiniteMessageArea() {
|
|
|
3476
3681
|
|
|
3477
3682
|
if (fixScroll) fixScroll();
|
|
3478
3683
|
if (!done) {
|
|
3479
|
-
|
|
3684
|
+
_context13.next = 31;
|
|
3480
3685
|
break;
|
|
3481
3686
|
}
|
|
3482
|
-
return
|
|
3687
|
+
return _context13.abrupt("break", 33);
|
|
3483
3688
|
case 31:
|
|
3484
|
-
|
|
3689
|
+
_context13.next = 21;
|
|
3485
3690
|
break;
|
|
3486
3691
|
case 33:
|
|
3487
3692
|
lock = false;
|
|
3488
3693
|
case 34:
|
|
3489
3694
|
case "end":
|
|
3490
|
-
return
|
|
3695
|
+
return _context13.stop();
|
|
3491
3696
|
}
|
|
3492
|
-
},
|
|
3697
|
+
}, _callee13);
|
|
3493
3698
|
}));
|
|
3494
3699
|
return _loadMoreWhereNeeded.apply(this, arguments);
|
|
3495
3700
|
};
|
|
3496
|
-
loadMoreWhereNeeded = function _loadMoreWhereNeeded2(
|
|
3701
|
+
loadMoreWhereNeeded = function _loadMoreWhereNeeded2(_x20, _x21) {
|
|
3497
3702
|
return _loadMoreWhereNeeded.apply(this, arguments);
|
|
3498
3703
|
};
|
|
3499
3704
|
_appendCurrentMessages = function _appendCurrentMessage2() {
|
|
3500
|
-
_appendCurrentMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3705
|
+
_appendCurrentMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12() {
|
|
3501
3706
|
var now, chatDocument, messageTable;
|
|
3502
|
-
return _regenerator["default"].wrap(function
|
|
3503
|
-
while (1) switch (
|
|
3707
|
+
return _regenerator["default"].wrap(function _callee12$(_context12) {
|
|
3708
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
3504
3709
|
case 0:
|
|
3505
3710
|
now = new Date();
|
|
3506
3711
|
chatDocument = dateFolder.leafDocumentFromDate(now); /// ///////////////////////////////////////////////////////////
|
|
3507
|
-
|
|
3712
|
+
_context12.next = 4;
|
|
3508
3713
|
return createMessageTable(now, true);
|
|
3509
3714
|
case 4:
|
|
3510
|
-
messageTable =
|
|
3715
|
+
messageTable = _context12.sent;
|
|
3511
3716
|
div.appendChild(messageTable);
|
|
3512
|
-
div.refresh = /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3513
|
-
return _regenerator["default"].wrap(function
|
|
3514
|
-
while (1) switch (
|
|
3717
|
+
div.refresh = /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11() {
|
|
3718
|
+
return _regenerator["default"].wrap(function _callee11$(_context11) {
|
|
3719
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
3515
3720
|
case 0:
|
|
3516
|
-
|
|
3721
|
+
_context11.next = 2;
|
|
3517
3722
|
return addNewChatDocumentIfNewDay(new Date());
|
|
3518
3723
|
case 2:
|
|
3519
|
-
|
|
3520
|
-
|
|
3724
|
+
_context11.next = 4;
|
|
3725
|
+
return syncMessages(chatChannel, messageTable);
|
|
3521
3726
|
case 4:
|
|
3727
|
+
// @@ livemessagetable??
|
|
3728
|
+
desktopNotification(chatChannel);
|
|
3729
|
+
case 5:
|
|
3522
3730
|
case "end":
|
|
3523
|
-
return
|
|
3731
|
+
return _context11.stop();
|
|
3524
3732
|
}
|
|
3525
|
-
},
|
|
3733
|
+
}, _callee11);
|
|
3526
3734
|
})); // The short chat version the live update listening is done in the pane but we do it in the widget @@
|
|
3527
3735
|
_solidLogic.store.updater.addDownstreamChangeListener(chatDocument, div.refresh); // Live update
|
|
3528
3736
|
liveMessageTable = messageTable;
|
|
3529
3737
|
latest.messageTable = liveMessageTable;
|
|
3530
|
-
return
|
|
3738
|
+
return _context12.abrupt("return", messageTable);
|
|
3531
3739
|
case 11:
|
|
3532
3740
|
case "end":
|
|
3533
|
-
return
|
|
3741
|
+
return _context12.stop();
|
|
3534
3742
|
}
|
|
3535
|
-
},
|
|
3743
|
+
}, _callee12);
|
|
3536
3744
|
}));
|
|
3537
3745
|
return _appendCurrentMessages.apply(this, arguments);
|
|
3538
3746
|
};
|
|
@@ -3540,15 +3748,15 @@ function _infiniteMessageArea() {
|
|
|
3540
3748
|
return _appendCurrentMessages.apply(this, arguments);
|
|
3541
3749
|
};
|
|
3542
3750
|
_addNewChatDocumentIfNewDay = function _addNewChatDocumentIf2() {
|
|
3543
|
-
_addNewChatDocumentIfNewDay = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3751
|
+
_addNewChatDocumentIfNewDay = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10() {
|
|
3544
3752
|
var newChatDocument, oldChatDocument, sts;
|
|
3545
|
-
return _regenerator["default"].wrap(function
|
|
3546
|
-
while (1) switch (
|
|
3753
|
+
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
|
3754
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
3547
3755
|
case 0:
|
|
3548
3756
|
// @@ Remove listener from previous table as it is now static
|
|
3549
3757
|
newChatDocument = dateFolder.leafDocumentFromDate(new Date());
|
|
3550
3758
|
if (newChatDocument.sameTerm(latest.messageTable.chatDocument)) {
|
|
3551
|
-
|
|
3759
|
+
_context10.next = 7;
|
|
3552
3760
|
break;
|
|
3553
3761
|
}
|
|
3554
3762
|
// It is a new day
|
|
@@ -3557,7 +3765,7 @@ function _infiniteMessageArea() {
|
|
|
3557
3765
|
delete liveMessageTable.inputRow;
|
|
3558
3766
|
}
|
|
3559
3767
|
oldChatDocument = latest.messageTable.chatDocument;
|
|
3560
|
-
|
|
3768
|
+
_context10.next = 6;
|
|
3561
3769
|
return appendCurrentMessages();
|
|
3562
3770
|
case 6:
|
|
3563
3771
|
// Adding a link in the document will ping listeners to add the new block too
|
|
@@ -3571,286 +3779,322 @@ function _infiniteMessageArea() {
|
|
|
3571
3779
|
}
|
|
3572
3780
|
case 7:
|
|
3573
3781
|
case "end":
|
|
3574
|
-
return
|
|
3782
|
+
return _context10.stop();
|
|
3575
3783
|
}
|
|
3576
|
-
},
|
|
3784
|
+
}, _callee10);
|
|
3577
3785
|
}));
|
|
3578
3786
|
return _addNewChatDocumentIfNewDay.apply(this, arguments);
|
|
3579
3787
|
};
|
|
3580
3788
|
addNewChatDocumentIfNewDay = function _addNewChatDocumentIf() {
|
|
3581
3789
|
return _addNewChatDocumentIfNewDay.apply(this, arguments);
|
|
3582
3790
|
};
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3791
|
+
_renderMessageTable = function _renderMessageTable3() {
|
|
3792
|
+
_renderMessageTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(date, live) {
|
|
3793
|
+
var scrollBackbutton, scrollForwardButton, extendBackwards, _extendBackwards, setScrollBackbuttonIcon, extendForwards, _extendForwards, setScrollForwardButtonIcon, scrollForwardButtonHandler, _scrollForwardButtonHandler, messageTable, chatDocument, tr, test, titleTR, scrollBackbuttonCell, dateCell, scrollForwardButtonCell, sts, _iterator2, _step2, st;
|
|
3794
|
+
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
|
3795
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
3796
|
+
case 0:
|
|
3797
|
+
_scrollForwardButtonHandler = function _scrollForwardButtonH2() {
|
|
3798
|
+
_scrollForwardButtonHandler = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(_event) {
|
|
3799
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
3800
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
3801
|
+
case 0:
|
|
3802
|
+
if (!messageTable.extendedForwards) {
|
|
3803
|
+
_context8.next = 6;
|
|
3804
|
+
break;
|
|
3805
|
+
}
|
|
3806
|
+
removePreviousMessages(false, messageTable);
|
|
3807
|
+
messageTable.extendedForwards = false;
|
|
3808
|
+
setScrollForwardButtonIcon();
|
|
3809
|
+
_context8.next = 9;
|
|
3810
|
+
break;
|
|
3811
|
+
case 6:
|
|
3812
|
+
_context8.next = 8;
|
|
3813
|
+
return extendForwards();
|
|
3814
|
+
case 8:
|
|
3815
|
+
// async
|
|
3816
|
+
latest.messageTable.scrollIntoView(newestFirst);
|
|
3817
|
+
case 9:
|
|
3818
|
+
case "end":
|
|
3819
|
+
return _context8.stop();
|
|
3820
|
+
}
|
|
3821
|
+
}, _callee8);
|
|
3822
|
+
}));
|
|
3823
|
+
return _scrollForwardButtonHandler.apply(this, arguments);
|
|
3824
|
+
};
|
|
3825
|
+
scrollForwardButtonHandler = function _scrollForwardButtonH(_x22) {
|
|
3826
|
+
return _scrollForwardButtonHandler.apply(this, arguments);
|
|
3827
|
+
};
|
|
3828
|
+
setScrollForwardButtonIcon = function _setScrollForwardButt() {
|
|
3829
|
+
if (!scrollForwardButton) return;
|
|
3830
|
+
var sense = messageTable.extendedForwards ? !newestFirst : newestFirst; // noun_T-Block_1114657_000000.svg
|
|
3831
|
+
var scrollForwardIcon = messageTable["final"] ? 'noun_T-Block_1114657_000000.svg' : getScrollForwardButtonIcon(sense);
|
|
3832
|
+
scrollForwardButton.firstChild.setAttribute('src', _iconBase.icons.iconBase + scrollForwardIcon);
|
|
3833
|
+
function getScrollForwardButtonIcon(sense) {
|
|
3834
|
+
return !sense ? 'noun_1369241.svg' : 'noun_1369237.svg';
|
|
3609
3835
|
}
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
3637
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
3638
|
-
case 0:
|
|
3639
|
-
if (!messageTable.extendedBack) {
|
|
3640
|
-
_context2.next = 6;
|
|
3641
|
-
break;
|
|
3836
|
+
};
|
|
3837
|
+
_extendForwards = function _extendForwards3() {
|
|
3838
|
+
_extendForwards = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7() {
|
|
3839
|
+
var done;
|
|
3840
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
3841
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
3842
|
+
case 0:
|
|
3843
|
+
_context7.next = 2;
|
|
3844
|
+
return insertPreviousMessages(false);
|
|
3845
|
+
case 2:
|
|
3846
|
+
done = _context7.sent;
|
|
3847
|
+
return _context7.abrupt("return", done);
|
|
3848
|
+
case 4:
|
|
3849
|
+
case "end":
|
|
3850
|
+
return _context7.stop();
|
|
3851
|
+
}
|
|
3852
|
+
}, _callee7);
|
|
3853
|
+
}));
|
|
3854
|
+
return _extendForwards.apply(this, arguments);
|
|
3855
|
+
};
|
|
3856
|
+
extendForwards = function _extendForwards2() {
|
|
3857
|
+
return _extendForwards.apply(this, arguments);
|
|
3858
|
+
};
|
|
3859
|
+
setScrollBackbuttonIcon = function _setScrollBackbuttonI() {
|
|
3860
|
+
if (!scrollBackbutton) {
|
|
3861
|
+
return;
|
|
3642
3862
|
}
|
|
3643
|
-
|
|
3644
|
-
messageTable.
|
|
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
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3863
|
+
var sense = messageTable.extendedBack ? !newestFirst : newestFirst;
|
|
3864
|
+
var scrollBackIcon = messageTable.initial ? 'noun_T-Block_1114655_000000.svg' : getScrollbackIcon(sense);
|
|
3865
|
+
scrollBackbutton.firstChild.setAttribute('src', _iconBase.icons.iconBase + scrollBackIcon);
|
|
3866
|
+
function getScrollbackIcon(sense) {
|
|
3867
|
+
return sense ? 'noun_1369241.svg' : 'noun_1369237.svg';
|
|
3868
|
+
}
|
|
3869
|
+
};
|
|
3870
|
+
_extendBackwards = function _extendBackwards3() {
|
|
3871
|
+
_extendBackwards = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
|
|
3872
|
+
var done;
|
|
3873
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
3874
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
3875
|
+
case 0:
|
|
3876
|
+
_context6.next = 2;
|
|
3877
|
+
return insertPreviousMessages(true);
|
|
3878
|
+
case 2:
|
|
3879
|
+
done = _context6.sent;
|
|
3880
|
+
if (done) {
|
|
3881
|
+
if (scrollBackbutton) {
|
|
3882
|
+
scrollBackbutton.firstChild.setAttribute('src', _iconBase.icons.iconBase + 'noun_T-Block_1114655_000000.svg'); // T
|
|
3883
|
+
scrollBackbutton.disabled = true;
|
|
3884
|
+
}
|
|
3885
|
+
messageTable.initial = true;
|
|
3886
|
+
} else {
|
|
3887
|
+
messageTable.extendedBack = true;
|
|
3888
|
+
}
|
|
3889
|
+
setScrollBackbuttonIcon();
|
|
3890
|
+
return _context6.abrupt("return", done);
|
|
3891
|
+
case 6:
|
|
3892
|
+
case "end":
|
|
3893
|
+
return _context6.stop();
|
|
3894
|
+
}
|
|
3895
|
+
}, _callee6);
|
|
3896
|
+
}));
|
|
3897
|
+
return _extendBackwards.apply(this, arguments);
|
|
3898
|
+
};
|
|
3899
|
+
extendBackwards = function _extendBackwards2() {
|
|
3900
|
+
return _extendBackwards.apply(this, arguments);
|
|
3901
|
+
};
|
|
3902
|
+
scrollBackbutton = null; // was let
|
|
3903
|
+
scrollForwardButton = null; // was let
|
|
3904
|
+
/// ///////////////// Scroll down adding more above
|
|
3905
|
+
/// ///////////////////////
|
|
3906
|
+
/*
|
|
3907
|
+
options = options || {}
|
|
3908
|
+
options.authorDateOnLeft = true
|
|
3909
|
+
const newestFirst = options.newestFirst === '1' || options.newestFirst === true // hack for now
|
|
3910
|
+
const channelObject = new ChatChannel(chatChannel, options)
|
|
3911
|
+
const dateFolder = channelObject.dateFolder
|
|
3912
|
+
const div = dom.createElement('div')
|
|
3913
|
+
const statusArea = div.appendChild(dom.createElement('div'))
|
|
3914
|
+
const userContext = { dom, statusArea, div: statusArea } // logged on state, pointers to user's stuff
|
|
3915
|
+
*/
|
|
3916
|
+
debug.log('Options for called message Area', options);
|
|
3917
|
+
messageTable = dom.createElement('table');
|
|
3918
|
+
messageTable.style.width = '100%'; // fill the pane div
|
|
3919
|
+
messageTable.extendBackwards = extendBackwards; // Make function available to scroll stuff
|
|
3920
|
+
messageTable.extendForwards = extendForwards; // Make function available to scroll stuff
|
|
3921
|
+
|
|
3922
|
+
messageTable.date = date;
|
|
3923
|
+
chatDocument = dateFolder.leafDocumentFromDate(date);
|
|
3924
|
+
messageTable.chatDocument = chatDocument;
|
|
3925
|
+
messageTable.fresh = false;
|
|
3926
|
+
messageTable.setAttribute('style', 'width: 100%;'); // fill that div!
|
|
3927
|
+
if (live) {
|
|
3928
|
+
messageTable["final"] = true;
|
|
3929
|
+
liveMessageTable = messageTable;
|
|
3930
|
+
latest.messageTable = messageTable;
|
|
3931
|
+
tr = (0, _message.renderMessageEditor)(channelObject, messageTable, userContext, options);
|
|
3932
|
+
if (newestFirst) {
|
|
3933
|
+
messageTable.insertBefore(tr, messageTable.firstChild); // If newestFirst
|
|
3676
3934
|
} else {
|
|
3677
|
-
messageTable.
|
|
3935
|
+
messageTable.appendChild(tr); // not newestFirst
|
|
3678
3936
|
}
|
|
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
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
break;
|
|
3937
|
+
|
|
3938
|
+
messageTable.inputRow = tr;
|
|
3939
|
+
}
|
|
3940
|
+
|
|
3941
|
+
/// ///// Infinite scroll
|
|
3942
|
+
//
|
|
3943
|
+
// @@ listen for swipe past end event not just button
|
|
3944
|
+
test = true;
|
|
3945
|
+
if (test) {
|
|
3946
|
+
// ws options.infinite but need for non-infinite
|
|
3947
|
+
titleTR = dom.createElement('tr');
|
|
3948
|
+
scrollBackbuttonCell = titleTR.appendChild(dom.createElement('td')); // up traingles: noun_1369237.svg
|
|
3949
|
+
// down triangles: noun_1369241.svg
|
|
3950
|
+
/*
|
|
3951
|
+
const scrollBackIcon = newestFirst
|
|
3952
|
+
? 'noun_1369241.svg'
|
|
3953
|
+
: 'noun_1369237.svg' // down and up arrows respoctively
|
|
3954
|
+
scrollBackbutton = widgets.button(
|
|
3955
|
+
dom,
|
|
3956
|
+
icons.iconBase + scrollBackIcon,
|
|
3957
|
+
'Previous messages ...'
|
|
3958
|
+
)
|
|
3959
|
+
scrollBackbuttonCell.style = 'width:3em; height:3em;'
|
|
3960
|
+
scrollBackbutton.addEventListener('click', scrollBackbuttonHandler, false)
|
|
3961
|
+
messageTable.extendedBack = false
|
|
3962
|
+
scrollBackbuttonCell.appendChild(scrollBackbutton)
|
|
3963
|
+
setScrollBackbuttonIcon()
|
|
3964
|
+
*/
|
|
3965
|
+
dateCell = titleTR.appendChild(dom.createElement('td'));
|
|
3966
|
+
dateCell.style = 'text-align: center; vertical-align: middle; color: #888; font-style: italic;';
|
|
3967
|
+
dateCell.textContent = widgets.shortDate(date.toISOString(), true); // no time, only date
|
|
3968
|
+
|
|
3969
|
+
// @@@@@@@@@@@ todo move this button to other end of message cell, o
|
|
3970
|
+
scrollForwardButtonCell = titleTR.appendChild(dom.createElement('td'));
|
|
3971
|
+
if (options.includeRemoveButton) {
|
|
3972
|
+
scrollForwardButtonCell.appendChild(widgets.cancelButton(dom, function (_e) {
|
|
3973
|
+
div.parentNode.removeChild(div);
|
|
3974
|
+
}));
|
|
3718
3975
|
}
|
|
3719
|
-
|
|
3976
|
+
/*
|
|
3977
|
+
const scrollForwardIcon = newestFirst
|
|
3978
|
+
? 'noun_1369241.svg'
|
|
3979
|
+
: 'noun_1369237.svg' // down and up arrows respoctively
|
|
3980
|
+
scrollForwardButton = widgets.button(
|
|
3981
|
+
dom,
|
|
3982
|
+
icons.iconBase + scrollForwardIcon,
|
|
3983
|
+
'Later messages ...'
|
|
3984
|
+
)
|
|
3985
|
+
scrollForwardButtonCell.appendChild(scrollForwardButton)
|
|
3986
|
+
scrollForwardButtonCell.style = 'width:3em; height:3em;'
|
|
3987
|
+
scrollForwardButton.addEventListener(
|
|
3988
|
+
'click',
|
|
3989
|
+
scrollForwardButtonHandler,
|
|
3990
|
+
false
|
|
3991
|
+
)
|
|
3992
|
+
messageTable.extendedForward = false
|
|
3993
|
+
setScrollForwardButtonIcon()
|
|
3994
|
+
*/
|
|
3720
3995
|
messageTable.extendedForwards = false;
|
|
3721
|
-
|
|
3722
|
-
|
|
3996
|
+
if (!newestFirst) {
|
|
3997
|
+
// opposite end from the entry field
|
|
3998
|
+
messageTable.insertBefore(titleTR, messageTable.firstChild); // If not newestFirst
|
|
3999
|
+
} else {
|
|
4000
|
+
messageTable.appendChild(titleTR); // newestFirst
|
|
4001
|
+
}
|
|
4002
|
+
}
|
|
4003
|
+
sts = _solidLogic.store.statementsMatching(null, ns.wf('message'), null, chatDocument);
|
|
4004
|
+
if (!live && sts.length === 0) {
|
|
4005
|
+
// not todays
|
|
4006
|
+
// no need buttomns at the moment
|
|
4007
|
+
// messageTable.style.visibility = 'collapse' // Hide files with no messages
|
|
4008
|
+
}
|
|
4009
|
+
_iterator2 = _createForOfIteratorHelper(sts);
|
|
4010
|
+
_context9.prev = 26;
|
|
4011
|
+
_iterator2.s();
|
|
4012
|
+
case 28:
|
|
4013
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
4014
|
+
_context9.next = 34;
|
|
3723
4015
|
break;
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
messageTable.inputRow = tr;
|
|
3759
|
-
}
|
|
3760
|
-
|
|
3761
|
-
/// ///// Infinite scroll
|
|
3762
|
-
//
|
|
3763
|
-
// @@ listen for swipe past end event not just button
|
|
3764
|
-
if (options.infinite) {
|
|
3765
|
-
var scrollBackbuttonTR = dom.createElement('tr');
|
|
3766
|
-
var scrollBackbuttonCell = scrollBackbuttonTR.appendChild(dom.createElement('td'));
|
|
3767
|
-
// up traingles: noun_1369237.svg
|
|
3768
|
-
// down triangles: noun_1369241.svg
|
|
3769
|
-
var scrollBackIcon = newestFirst ? 'noun_1369241.svg' : 'noun_1369237.svg'; // down and up arrows respoctively
|
|
3770
|
-
scrollBackbutton = widgets.button(dom, _iconBase.icons.iconBase + scrollBackIcon, 'Previous messages ...');
|
|
3771
|
-
scrollBackbuttonCell.style = 'width:3em; height:3em;';
|
|
3772
|
-
scrollBackbutton.addEventListener('click', scrollBackbuttonHandler, false);
|
|
3773
|
-
messageTable.extendedBack = false;
|
|
3774
|
-
scrollBackbuttonCell.appendChild(scrollBackbutton);
|
|
3775
|
-
setScrollBackbuttonIcon();
|
|
3776
|
-
var dateCell = scrollBackbuttonTR.appendChild(dom.createElement('td'));
|
|
3777
|
-
dateCell.style = 'text-align: center; vertical-align: middle; color: #888; font-style: italic;';
|
|
3778
|
-
dateCell.textContent = widgets.shortDate(date.toISOString(), true); // no time, only date
|
|
3779
|
-
|
|
3780
|
-
// @@@@@@@@@@@ todo move this button to other end of message cell, o
|
|
3781
|
-
var scrollForwardButtonCell = scrollBackbuttonTR.appendChild(dom.createElement('td'));
|
|
3782
|
-
var scrollForwardIcon = newestFirst ? 'noun_1369241.svg' : 'noun_1369237.svg'; // down and up arrows respoctively
|
|
3783
|
-
scrollForwardButton = widgets.button(dom, _iconBase.icons.iconBase + scrollForwardIcon, 'Later messages ...');
|
|
3784
|
-
scrollForwardButtonCell.appendChild(scrollForwardButton);
|
|
3785
|
-
scrollForwardButtonCell.style = 'width:3em; height:3em;';
|
|
3786
|
-
scrollForwardButton.addEventListener('click', scrollForwardButtonHandler, false);
|
|
3787
|
-
messageTable.extendedForward = false;
|
|
3788
|
-
setScrollForwardButtonIcon();
|
|
3789
|
-
messageTable.extendedForwards = false;
|
|
3790
|
-
if (!newestFirst) {
|
|
3791
|
-
// opposite end from the entry field
|
|
3792
|
-
messageTable.insertBefore(scrollBackbuttonTR, messageTable.firstChild); // If not newestFirst
|
|
3793
|
-
} else {
|
|
3794
|
-
messageTable.appendChild(scrollBackbuttonTR); // newestFirst
|
|
3795
|
-
}
|
|
3796
|
-
}
|
|
3797
|
-
|
|
3798
|
-
var sts = _solidLogic.store.statementsMatching(null, ns.wf('message'), null, chatDocument);
|
|
3799
|
-
if (!live && sts.length === 0) {
|
|
3800
|
-
// not todays
|
|
3801
|
-
// no need buttomns at the moment
|
|
3802
|
-
// messageTable.style.visibility = 'collapse' // Hide files with no messages
|
|
3803
|
-
}
|
|
3804
|
-
sts.forEach(function (st) {
|
|
3805
|
-
addMessage(st.object, messageTable);
|
|
3806
|
-
});
|
|
3807
|
-
messageTable.fresh = true;
|
|
3808
|
-
|
|
3809
|
-
// loadMessageTable(messageTable, chatDocument)
|
|
3810
|
-
messageTable.fresh = false;
|
|
3811
|
-
return messageTable;
|
|
4016
|
+
}
|
|
4017
|
+
st = _step2.value;
|
|
4018
|
+
_context9.next = 32;
|
|
4019
|
+
return addMessage(st.object, messageTable);
|
|
4020
|
+
case 32:
|
|
4021
|
+
_context9.next = 28;
|
|
4022
|
+
break;
|
|
4023
|
+
case 34:
|
|
4024
|
+
_context9.next = 39;
|
|
4025
|
+
break;
|
|
4026
|
+
case 36:
|
|
4027
|
+
_context9.prev = 36;
|
|
4028
|
+
_context9.t0 = _context9["catch"](26);
|
|
4029
|
+
_iterator2.e(_context9.t0);
|
|
4030
|
+
case 39:
|
|
4031
|
+
_context9.prev = 39;
|
|
4032
|
+
_iterator2.f();
|
|
4033
|
+
return _context9.finish(39);
|
|
4034
|
+
case 42:
|
|
4035
|
+
messageTable.fresh = true;
|
|
4036
|
+
|
|
4037
|
+
// loadMessageTable(messageTable, chatDocument)
|
|
4038
|
+
messageTable.fresh = false;
|
|
4039
|
+
return _context9.abrupt("return", messageTable);
|
|
4040
|
+
case 45:
|
|
4041
|
+
case "end":
|
|
4042
|
+
return _context9.stop();
|
|
4043
|
+
}
|
|
4044
|
+
}, _callee9, null, [[26, 36, 39, 42]]);
|
|
4045
|
+
}));
|
|
4046
|
+
return _renderMessageTable.apply(this, arguments);
|
|
4047
|
+
};
|
|
4048
|
+
renderMessageTable = function _renderMessageTable2(_x18, _x19) {
|
|
4049
|
+
return _renderMessageTable.apply(this, arguments);
|
|
3812
4050
|
};
|
|
3813
4051
|
_createMessageTable = function _createMessageTable3() {
|
|
3814
|
-
_createMessageTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
4052
|
+
_createMessageTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(date, live) {
|
|
3815
4053
|
var chatDocument, messageTable, statusTR;
|
|
3816
|
-
return _regenerator["default"].wrap(function
|
|
3817
|
-
while (1) switch (
|
|
4054
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
4055
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
3818
4056
|
case 0:
|
|
3819
4057
|
debug.log(' createMessageTable for ' + date);
|
|
3820
4058
|
chatDocument = dateFolder.leafDocumentFromDate(date);
|
|
3821
|
-
|
|
3822
|
-
|
|
4059
|
+
_context5.prev = 2;
|
|
4060
|
+
_context5.next = 5;
|
|
3823
4061
|
return _solidLogic.store.fetcher.load(chatDocument);
|
|
3824
4062
|
case 5:
|
|
3825
|
-
|
|
4063
|
+
_context5.next = 21;
|
|
3826
4064
|
break;
|
|
3827
4065
|
case 7:
|
|
3828
|
-
|
|
3829
|
-
|
|
4066
|
+
_context5.prev = 7;
|
|
4067
|
+
_context5.t0 = _context5["catch"](2);
|
|
3830
4068
|
messageTable = dom.createElement('table');
|
|
3831
4069
|
statusTR = messageTable.appendChild(dom.createElement('tr')); // ### find status in exception
|
|
3832
|
-
if (!(
|
|
3833
|
-
|
|
4070
|
+
if (!(_context5.t0.response && _context5.t0.response.status && _context5.t0.response.status === 404)) {
|
|
4071
|
+
_context5.next = 18;
|
|
3834
4072
|
break;
|
|
3835
4073
|
}
|
|
3836
4074
|
debug.log('Error 404 for chat file ' + chatDocument);
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
4075
|
+
_context5.next = 15;
|
|
4076
|
+
return renderMessageTable(date, live);
|
|
4077
|
+
case 15:
|
|
4078
|
+
return _context5.abrupt("return", _context5.sent);
|
|
3841
4079
|
case 18:
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
return _context6.abrupt("return", renderMessageTable(date, live));
|
|
4080
|
+
debug.log('*** Error NON 404 for chat file ' + chatDocument);
|
|
4081
|
+
statusTR.appendChild(widgets.errorMessageBlock(dom, _context5.t0, 'pink'));
|
|
3845
4082
|
case 20:
|
|
4083
|
+
return _context5.abrupt("return", statusTR);
|
|
4084
|
+
case 21:
|
|
4085
|
+
_context5.next = 23;
|
|
4086
|
+
return renderMessageTable(date, live);
|
|
4087
|
+
case 23:
|
|
4088
|
+
return _context5.abrupt("return", _context5.sent);
|
|
4089
|
+
case 24:
|
|
3846
4090
|
case "end":
|
|
3847
|
-
return
|
|
4091
|
+
return _context5.stop();
|
|
3848
4092
|
}
|
|
3849
|
-
},
|
|
4093
|
+
}, _callee5, null, [[2, 7]]);
|
|
3850
4094
|
}));
|
|
3851
4095
|
return _createMessageTable.apply(this, arguments);
|
|
3852
4096
|
};
|
|
3853
|
-
createMessageTable = function _createMessageTable2(
|
|
4097
|
+
createMessageTable = function _createMessageTable2(_x16, _x17) {
|
|
3854
4098
|
return _createMessageTable.apply(this, arguments);
|
|
3855
4099
|
};
|
|
3856
4100
|
removePreviousMessages = function _removePreviousMessag(backwards, messageTable) {
|
|
@@ -3869,32 +4113,40 @@ function _infiniteMessageArea() {
|
|
|
3869
4113
|
extr.messageTable = messageTable;
|
|
3870
4114
|
};
|
|
3871
4115
|
_insertPreviousMessages = function _insertPreviousMessag2() {
|
|
3872
|
-
_insertPreviousMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
4116
|
+
_insertPreviousMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(backwards) {
|
|
3873
4117
|
var extremity, date, live, todayDoc, doc, newMessageTable;
|
|
3874
|
-
return _regenerator["default"].wrap(function
|
|
3875
|
-
while (1) switch (
|
|
4118
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
4119
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
3876
4120
|
case 0:
|
|
3877
4121
|
extremity = backwards ? earliest : latest;
|
|
3878
4122
|
date = extremity.messageTable.date; // day in mssecs
|
|
3879
|
-
|
|
3880
|
-
|
|
4123
|
+
// Are we at the top of a thread?
|
|
4124
|
+
if (!(backwards && earliest.limit && date <= earliest.limit)) {
|
|
4125
|
+
_context4.next = 4;
|
|
4126
|
+
break;
|
|
4127
|
+
}
|
|
4128
|
+
return _context4.abrupt("return", true);
|
|
3881
4129
|
case 4:
|
|
3882
|
-
|
|
4130
|
+
_context4.next = 6;
|
|
4131
|
+
return dateFolder.loadPrevious(date, backwards);
|
|
4132
|
+
case 6:
|
|
4133
|
+
date = _context4.sent;
|
|
3883
4134
|
// backwards
|
|
4135
|
+
|
|
3884
4136
|
debug.log("insertPreviousMessages: from ".concat(backwards ? 'backwards' : 'forwards', " loadPrevious: ").concat(date));
|
|
3885
4137
|
if (!(!date && !backwards && !liveMessageTable)) {
|
|
3886
|
-
|
|
4138
|
+
_context4.next = 11;
|
|
3887
4139
|
break;
|
|
3888
4140
|
}
|
|
3889
|
-
|
|
4141
|
+
_context4.next = 11;
|
|
3890
4142
|
return appendCurrentMessages();
|
|
3891
|
-
case
|
|
4143
|
+
case 11:
|
|
3892
4144
|
if (date) {
|
|
3893
|
-
|
|
4145
|
+
_context4.next = 13;
|
|
3894
4146
|
break;
|
|
3895
4147
|
}
|
|
3896
|
-
return
|
|
3897
|
-
case
|
|
4148
|
+
return _context4.abrupt("return", true);
|
|
4149
|
+
case 13:
|
|
3898
4150
|
// done
|
|
3899
4151
|
live = false;
|
|
3900
4152
|
if (!backwards) {
|
|
@@ -3902,10 +4154,10 @@ function _infiniteMessageArea() {
|
|
|
3902
4154
|
doc = dateFolder.leafDocumentFromDate(date);
|
|
3903
4155
|
live = doc.sameTerm(todayDoc); // Is this todays?
|
|
3904
4156
|
}
|
|
3905
|
-
|
|
4157
|
+
_context4.next = 17;
|
|
3906
4158
|
return createMessageTable(date, live);
|
|
3907
|
-
case
|
|
3908
|
-
newMessageTable =
|
|
4159
|
+
case 17:
|
|
4160
|
+
newMessageTable = _context4.sent;
|
|
3909
4161
|
extremity.messageTable = newMessageTable; // move pointer to earliest
|
|
3910
4162
|
if (backwards ? newestFirst : !newestFirst) {
|
|
3911
4163
|
// put on bottom or top
|
|
@@ -3914,62 +4166,160 @@ function _infiniteMessageArea() {
|
|
|
3914
4166
|
// put on top as we scroll back
|
|
3915
4167
|
div.insertBefore(newMessageTable, div.firstChild);
|
|
3916
4168
|
}
|
|
3917
|
-
return
|
|
3918
|
-
case
|
|
4169
|
+
return _context4.abrupt("return", live);
|
|
4170
|
+
case 21:
|
|
3919
4171
|
case "end":
|
|
3920
|
-
return
|
|
4172
|
+
return _context4.stop();
|
|
3921
4173
|
}
|
|
3922
|
-
},
|
|
4174
|
+
}, _callee4);
|
|
3923
4175
|
}));
|
|
3924
4176
|
return _insertPreviousMessages.apply(this, arguments);
|
|
3925
4177
|
};
|
|
3926
|
-
insertPreviousMessages = function _insertPreviousMessag(
|
|
4178
|
+
insertPreviousMessages = function _insertPreviousMessag(_x15) {
|
|
3927
4179
|
return _insertPreviousMessages.apply(this, arguments);
|
|
3928
4180
|
};
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
4181
|
+
_addMessage = function _addMessage3() {
|
|
4182
|
+
_addMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(message, messageTable) {
|
|
4183
|
+
var thread, id;
|
|
4184
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
4185
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
4186
|
+
case 0:
|
|
4187
|
+
if (!((0, _chatLogic.isDeleted)(message) && !options.showDeletedMessages)) {
|
|
4188
|
+
_context3.next = 2;
|
|
4189
|
+
break;
|
|
4190
|
+
}
|
|
4191
|
+
return _context3.abrupt("return");
|
|
4192
|
+
case 2:
|
|
4193
|
+
if (!(0, _chatLogic.isReplaced)(message)) {
|
|
4194
|
+
_context3.next = 4;
|
|
4195
|
+
break;
|
|
4196
|
+
}
|
|
4197
|
+
return _context3.abrupt("return");
|
|
4198
|
+
case 4:
|
|
4199
|
+
thread = _solidLogic.store.any(null, ns.sioc('has_member'), message, message.doc());
|
|
4200
|
+
id = _solidLogic.store.any(message, ns.sioc('id'), null, message.doc());
|
|
4201
|
+
if (id && !thread) {
|
|
4202
|
+
thread = _solidLogic.store.any(null, ns.sioc('has_member'), id, message.doc());
|
|
4203
|
+
}
|
|
4204
|
+
if (!options.thread) {
|
|
4205
|
+
_context3.next = 20;
|
|
4206
|
+
break;
|
|
4207
|
+
}
|
|
4208
|
+
if (!_solidLogic.store.holds(message, ns.sioc('has_reply'), options.thread)) {
|
|
4209
|
+
_context3.next = 12;
|
|
4210
|
+
break;
|
|
4211
|
+
}
|
|
4212
|
+
// root of thread
|
|
4213
|
+
debug.log(' addMessage: displaying root of thread ' + thread);
|
|
4214
|
+
_context3.next = 18;
|
|
4215
|
+
break;
|
|
4216
|
+
case 12:
|
|
4217
|
+
if (!(thread && thread.sameTerm(options.thread))) {
|
|
4218
|
+
_context3.next = 16;
|
|
4219
|
+
break;
|
|
4220
|
+
}
|
|
4221
|
+
debug.log(' addMessage: Displaying body of thread ' + message.uri.slice(-10));
|
|
4222
|
+
_context3.next = 18;
|
|
4223
|
+
break;
|
|
4224
|
+
case 16:
|
|
4225
|
+
debug.log(' addMessage: Suppress non-thread message in thread table ' + message.uri.slice(-10));
|
|
4226
|
+
return _context3.abrupt("return");
|
|
4227
|
+
case 18:
|
|
4228
|
+
_context3.next = 26;
|
|
4229
|
+
break;
|
|
4230
|
+
case 20:
|
|
4231
|
+
if (!thread) {
|
|
4232
|
+
_context3.next = 25;
|
|
4233
|
+
break;
|
|
4234
|
+
}
|
|
4235
|
+
debug.log(' addMessage: Suppress thread message in non-thread table ' + message.uri.slice(-10));
|
|
4236
|
+
return _context3.abrupt("return");
|
|
4237
|
+
case 25:
|
|
4238
|
+
debug.log(' addMessage: Normal non-thread message in non-thread table ' + message.uri.slice(-10));
|
|
4239
|
+
case 26:
|
|
4240
|
+
_context3.next = 28;
|
|
4241
|
+
return insertMessageIntoTable(channelObject, messageTable, message, messageTable.fresh, options, userContext);
|
|
4242
|
+
case 28:
|
|
4243
|
+
case "end":
|
|
4244
|
+
return _context3.stop();
|
|
4245
|
+
}
|
|
4246
|
+
}, _callee3);
|
|
4247
|
+
}));
|
|
4248
|
+
return _addMessage.apply(this, arguments);
|
|
3937
4249
|
};
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
4250
|
+
addMessage = function _addMessage2(_x13, _x14) {
|
|
4251
|
+
return _addMessage.apply(this, arguments);
|
|
4252
|
+
};
|
|
4253
|
+
_syncMessages = function _syncMessages3() {
|
|
4254
|
+
_syncMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(chatChannel, messageTable) {
|
|
4255
|
+
var displayed, ele, ele2, messages, stored, _iterator, _step, m;
|
|
4256
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
4257
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
4258
|
+
case 0:
|
|
4259
|
+
displayed = {};
|
|
4260
|
+
for (ele = messageTable.firstChild; ele; ele = ele.nextSibling) {
|
|
4261
|
+
if (ele.AJAR_subject) {
|
|
4262
|
+
displayed[ele.AJAR_subject.uri] = true;
|
|
4263
|
+
}
|
|
4264
|
+
}
|
|
4265
|
+
messages = _solidLogic.store.each(chatChannel, ns.wf('message'), null, messageTable.chatDocument);
|
|
4266
|
+
stored = {};
|
|
4267
|
+
_iterator = _createForOfIteratorHelper(messages);
|
|
4268
|
+
_context2.prev = 5;
|
|
4269
|
+
_iterator.s();
|
|
4270
|
+
case 7:
|
|
4271
|
+
if ((_step = _iterator.n()).done) {
|
|
4272
|
+
_context2.next = 15;
|
|
4273
|
+
break;
|
|
4274
|
+
}
|
|
4275
|
+
m = _step.value;
|
|
4276
|
+
stored[m.uri] = true;
|
|
4277
|
+
if (displayed[m.uri]) {
|
|
4278
|
+
_context2.next = 13;
|
|
4279
|
+
break;
|
|
4280
|
+
}
|
|
4281
|
+
_context2.next = 13;
|
|
4282
|
+
return addMessage(m, messageTable);
|
|
4283
|
+
case 13:
|
|
4284
|
+
_context2.next = 7;
|
|
4285
|
+
break;
|
|
4286
|
+
case 15:
|
|
4287
|
+
_context2.next = 20;
|
|
4288
|
+
break;
|
|
4289
|
+
case 17:
|
|
4290
|
+
_context2.prev = 17;
|
|
4291
|
+
_context2.t0 = _context2["catch"](5);
|
|
4292
|
+
_iterator.e(_context2.t0);
|
|
4293
|
+
case 20:
|
|
4294
|
+
_context2.prev = 20;
|
|
4295
|
+
_iterator.f();
|
|
4296
|
+
return _context2.finish(20);
|
|
4297
|
+
case 23:
|
|
4298
|
+
// eslint-disable-next-line space-in-parens
|
|
4299
|
+
for (ele = messageTable.firstChild; ele;) {
|
|
4300
|
+
ele2 = ele.nextSibling;
|
|
4301
|
+
if (ele.AJAR_subject && !stored[ele.AJAR_subject.uri]) {
|
|
4302
|
+
messageTable.removeChild(ele);
|
|
4303
|
+
}
|
|
4304
|
+
ele = ele2;
|
|
4305
|
+
}
|
|
4306
|
+
for (ele = messageTable.firstChild; ele; ele = ele.nextSibling) {
|
|
4307
|
+
if (ele.AJAR_subject) {
|
|
4308
|
+
// Refresh thumbs up etc
|
|
4309
|
+
widgets.refreshTree(ele); // Things inside may have changed too
|
|
4310
|
+
}
|
|
4311
|
+
}
|
|
4312
|
+
case 25:
|
|
4313
|
+
case "end":
|
|
4314
|
+
return _context2.stop();
|
|
4315
|
+
}
|
|
4316
|
+
}, _callee2, null, [[5, 17, 20, 23]]);
|
|
4317
|
+
}));
|
|
4318
|
+
return _syncMessages.apply(this, arguments);
|
|
4319
|
+
};
|
|
4320
|
+
syncMessages = function _syncMessages2(_x11, _x12) {
|
|
4321
|
+
return _syncMessages.apply(this, arguments);
|
|
3971
4322
|
};
|
|
3972
|
-
|
|
3973
4323
|
// Body of main function
|
|
3974
4324
|
|
|
3975
4325
|
options = options || {};
|
|
@@ -3985,23 +4335,33 @@ function _infiniteMessageArea() {
|
|
|
3985
4335
|
statusArea: statusArea,
|
|
3986
4336
|
div: statusArea
|
|
3987
4337
|
}; // logged on state, pointers to user's stuff
|
|
3988
|
-
// const messageTable = dom.createElement('table') // @@ check does this go in renderMessageTable
|
|
3989
4338
|
earliest = {
|
|
3990
4339
|
messageTable: null
|
|
3991
4340
|
}; // Stuff about each end of the loaded days
|
|
3992
4341
|
latest = {
|
|
3993
4342
|
messageTable: null
|
|
3994
4343
|
};
|
|
4344
|
+
if (options.thread) {
|
|
4345
|
+
thread = options.thread;
|
|
4346
|
+
threadRootMessage = _solidLogic.store.any(null, ns.sioc('has_reply'), thread, thread.doc());
|
|
4347
|
+
if (threadRootMessage) {
|
|
4348
|
+
threadTime = _solidLogic.store.any(threadRootMessage, ns.dct('created'), null, threadRootMessage.doc());
|
|
4349
|
+
if (threadTime) {
|
|
4350
|
+
earliest.limit = new Date(threadTime.value);
|
|
4351
|
+
debug.log(' inifinite: thread start at ' + earliest.limit);
|
|
4352
|
+
}
|
|
4353
|
+
}
|
|
4354
|
+
}
|
|
3995
4355
|
lock = false;
|
|
3996
|
-
|
|
4356
|
+
_context15.next = 34;
|
|
3997
4357
|
return loadInitialContent();
|
|
3998
|
-
case
|
|
3999
|
-
return
|
|
4000
|
-
case
|
|
4358
|
+
case 34:
|
|
4359
|
+
return _context15.abrupt("return", div);
|
|
4360
|
+
case 35:
|
|
4001
4361
|
case "end":
|
|
4002
|
-
return
|
|
4362
|
+
return _context15.stop();
|
|
4003
4363
|
}
|
|
4004
|
-
},
|
|
4364
|
+
}, _callee15);
|
|
4005
4365
|
}));
|
|
4006
4366
|
return _infiniteMessageArea.apply(this, arguments);
|
|
4007
4367
|
}
|
|
@@ -4030,6 +4390,7 @@ exports.renderMessageEditor = renderMessageEditor;
|
|
|
4030
4390
|
exports.renderMessageRow = renderMessageRow;
|
|
4031
4391
|
exports.switchToEditor = switchToEditor;
|
|
4032
4392
|
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
|
|
4393
|
+
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js"));
|
|
4033
4394
|
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
4034
4395
|
var _infinite = __webpack_require__(/*! ./infinite */ "./lib/chat/infinite.js");
|
|
4035
4396
|
var _messageTools = __webpack_require__(/*! ./messageTools */ "./lib/chat/messageTools.js");
|
|
@@ -4047,7 +4408,9 @@ var utils = _interopRequireWildcard(__webpack_require__(/*! ../utils */ "./lib/u
|
|
|
4047
4408
|
var widgets = _interopRequireWildcard(__webpack_require__(/*! ../widgets */ "./lib/widgets/index.js"));
|
|
4048
4409
|
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); }
|
|
4049
4410
|
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; }
|
|
4050
|
-
function
|
|
4411
|
+
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; }
|
|
4412
|
+
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; }
|
|
4413
|
+
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; } } }; }
|
|
4051
4414
|
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); }
|
|
4052
4415
|
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; }
|
|
4053
4416
|
var dom = window.document;
|
|
@@ -4126,122 +4489,232 @@ function creatorAndDateHorizontal(td1, creator, date, message) {
|
|
|
4126
4489
|
/**
|
|
4127
4490
|
* Renders a chat message, read-only mode
|
|
4128
4491
|
*/
|
|
4129
|
-
function renderMessageRow(
|
|
4130
|
-
|
|
4131
|
-
var creator = _solidLogic.store.any(message, ns.foaf('maker'));
|
|
4132
|
-
var date = _solidLogic.store.any(message, ns.dct('created'));
|
|
4133
|
-
var latestVersion = (0, _chatLogic.mostRecentVersion)(message);
|
|
4134
|
-
var content = _solidLogic.store.any(latestVersion, ns.sioc('content'));
|
|
4135
|
-
var originalMessage = (0, _chatLogic.originalVersion)(message);
|
|
4136
|
-
var edited = !message.sameTerm(originalMessage);
|
|
4137
|
-
var sortDate = _solidLogic.store.the(originalMessage, ns.dct('created'), null, originalMessage.doc()); // In message
|
|
4138
|
-
|
|
4139
|
-
var messageRow = dom.createElement('tr');
|
|
4140
|
-
messageRow.AJAR_date = sortDate.value;
|
|
4141
|
-
messageRow.AJAR_subject = message;
|
|
4142
|
-
var td1 = dom.createElement('td');
|
|
4143
|
-
messageRow.appendChild(td1);
|
|
4144
|
-
if (!options.authorDateOnLeft) {
|
|
4145
|
-
var img = dom.createElement('img');
|
|
4146
|
-
img.setAttribute('style', 'max-height: 2.5em; max-width: 2.5em; border-radius: 0.5em; margin: auto;');
|
|
4147
|
-
widgets.setImage(img, creator);
|
|
4148
|
-
td1.appendChild(img);
|
|
4149
|
-
} else {
|
|
4150
|
-
creatorAndDate(td1, creator, widgets.shortDate(sortDate.value), message);
|
|
4151
|
-
}
|
|
4152
|
-
var bothDates = widgets.shortDate(sortDate.value);
|
|
4153
|
-
if (edited) {
|
|
4154
|
-
bothDates += ' ... ' + widgets.shortDate(date.value);
|
|
4155
|
-
}
|
|
4156
|
-
|
|
4157
|
-
// Render the content ot the message itself
|
|
4158
|
-
var td2 = messageRow.appendChild(dom.createElement('td'));
|
|
4159
|
-
if (!options.authorDateOnLeft) {
|
|
4160
|
-
creatorAndDateHorizontal(td2, creator, bothDates,
|
|
4161
|
-
// widgets.shortDate(dateString)
|
|
4162
|
-
message);
|
|
4163
|
-
}
|
|
4164
|
-
var text = content.value.trim();
|
|
4165
|
-
var isURI = /^https?:\/[^ <>]*$/i.test(text);
|
|
4166
|
-
var para = null;
|
|
4167
|
-
if (isURI) {
|
|
4168
|
-
var isImage = /\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(text); // @@ Should use content-type not URI
|
|
4169
|
-
if (isImage && options.expandImagesInline) {
|
|
4170
|
-
var _img = elementForImageURI(text, options);
|
|
4171
|
-
td2.appendChild(_img);
|
|
4172
|
-
} else {
|
|
4173
|
-
// Link but not Image
|
|
4174
|
-
var anc = td2.appendChild(dom.createElement('a'));
|
|
4175
|
-
para = anc.appendChild(dom.createElement('p'));
|
|
4176
|
-
anc.href = text;
|
|
4177
|
-
para.textContent = text;
|
|
4178
|
-
td2.appendChild(anc);
|
|
4179
|
-
}
|
|
4180
|
-
} else {
|
|
4181
|
-
// text
|
|
4182
|
-
para = dom.createElement('p');
|
|
4183
|
-
td2.appendChild(para);
|
|
4184
|
-
para.textContent = text;
|
|
4185
|
-
}
|
|
4186
|
-
if (para) {
|
|
4187
|
-
var bgcolor = colorizeByAuthor ? pad.lightColorHash(creator) : getBgColor(fresh);
|
|
4188
|
-
para.setAttribute('style', messageBodyStyle + 'background-color: ' + bgcolor + ';');
|
|
4189
|
-
}
|
|
4190
|
-
function getBgColor(fresh) {
|
|
4191
|
-
return fresh ? '#e8ffe8' : 'white';
|
|
4192
|
-
}
|
|
4193
|
-
|
|
4194
|
-
// Sentiment strip
|
|
4195
|
-
var strip = (0, _messageTools.sentimentStripLinked)(message, message.doc());
|
|
4196
|
-
if (strip.children.length) {
|
|
4197
|
-
td2.appendChild(dom.createElement('br'));
|
|
4198
|
-
td2.appendChild(strip);
|
|
4199
|
-
}
|
|
4200
|
-
|
|
4201
|
-
// Message tool bar button
|
|
4202
|
-
var td3 = dom.createElement('td');
|
|
4203
|
-
messageRow.appendChild(td3);
|
|
4204
|
-
var toolsButton = widgets.button(dom, _iconBase.icons.iconBase + 'noun_243787.svg', '...');
|
|
4205
|
-
td3.appendChild(toolsButton);
|
|
4206
|
-
toolsButton.addEventListener('click', function (_event) {
|
|
4207
|
-
if (messageRow.toolTR) {
|
|
4208
|
-
// already got a toolbar? Toogle
|
|
4209
|
-
messageRow.parentNode.removeChild(messageRow.toolTR);
|
|
4210
|
-
delete messageRow.toolTR;
|
|
4211
|
-
return;
|
|
4212
|
-
}
|
|
4213
|
-
var toolsTR = dom.createElement('tr');
|
|
4214
|
-
var tools = (0, _messageTools.messageToolbar)(message, messageRow, userContext, channelObject);
|
|
4215
|
-
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
|
|
4216
|
-
if (messageRow.nextSibling) {
|
|
4217
|
-
messageRow.parentElement.insertBefore(toolsTR, messageRow.nextSibling);
|
|
4218
|
-
} else {
|
|
4219
|
-
messageRow.parentElement.appendChild(toolsTR);
|
|
4220
|
-
}
|
|
4221
|
-
messageRow.toolTR = toolsTR;
|
|
4222
|
-
toolsTR.appendChild(dom.createElement('td')); // left
|
|
4223
|
-
var toolsTD = toolsTR.appendChild(dom.createElement('td'));
|
|
4224
|
-
toolsTR.appendChild(dom.createElement('td')); // right
|
|
4225
|
-
toolsTD.appendChild(tools);
|
|
4226
|
-
});
|
|
4227
|
-
return messageRow;
|
|
4492
|
+
function renderMessageRow(_x, _x2, _x3, _x4, _x5) {
|
|
4493
|
+
return _renderMessageRow.apply(this, arguments);
|
|
4228
4494
|
}
|
|
4229
|
-
function
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4495
|
+
function _renderMessageRow() {
|
|
4496
|
+
_renderMessageRow = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(channelObject, message, fresh, options, userContext) {
|
|
4497
|
+
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;
|
|
4498
|
+
return _regenerator["default"].wrap(function _callee9$(_context10) {
|
|
4499
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
4500
|
+
case 0:
|
|
4501
|
+
getBgColor = function _getBgColor(fresh) {
|
|
4502
|
+
return fresh ? '#e8ffe8' : 'white';
|
|
4503
|
+
};
|
|
4504
|
+
colorizeByAuthor = options.colorizeByAuthor === '1' || options.colorizeByAuthor === true;
|
|
4505
|
+
creator = _solidLogic.store.any(message, ns.foaf('maker'));
|
|
4506
|
+
date = _solidLogic.store.any(message, ns.dct('created'));
|
|
4507
|
+
_context10.next = 6;
|
|
4508
|
+
return (0, _chatLogic.mostRecentVersion)(message);
|
|
4509
|
+
case 6:
|
|
4510
|
+
latestVersion = _context10.sent;
|
|
4511
|
+
content = _solidLogic.store.any(latestVersion, ns.sioc('content')); // const id = store.any(latestVersion, ns.sioc('id'))
|
|
4512
|
+
// const replies = store.each(latestVersion, ns.sioc('has_reply'))
|
|
4513
|
+
_context10.next = 10;
|
|
4514
|
+
return (0, _chatLogic.allVersions)(message);
|
|
4515
|
+
case 10:
|
|
4516
|
+
versions = _context10.sent;
|
|
4517
|
+
if (versions.length > 1) {
|
|
4518
|
+
debug.log('renderMessageRow versions: ', versions.join(', '));
|
|
4519
|
+
}
|
|
4520
|
+
// be tolerant in accepting replies on any version of a message
|
|
4521
|
+
replies = versions.map(function (version) {
|
|
4522
|
+
return _solidLogic.store.each(version, ns.sioc('has_reply'));
|
|
4523
|
+
}).flat();
|
|
4524
|
+
thread = null;
|
|
4525
|
+
straightReplies = [];
|
|
4526
|
+
_iterator2 = _createForOfIteratorHelper(replies);
|
|
4527
|
+
try {
|
|
4528
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
4529
|
+
reply = _step2.value;
|
|
4530
|
+
if (_solidLogic.store.holds(reply, ns.rdf('type'), ns.sioc('Thread'))) {
|
|
4531
|
+
thread = reply;
|
|
4532
|
+
debug.log('renderMessageRow: found thread: ' + thread);
|
|
4533
|
+
} else {
|
|
4534
|
+
straightReplies.push(reply);
|
|
4535
|
+
}
|
|
4536
|
+
}
|
|
4537
|
+
} catch (err) {
|
|
4538
|
+
_iterator2.e(err);
|
|
4539
|
+
} finally {
|
|
4540
|
+
_iterator2.f();
|
|
4541
|
+
}
|
|
4542
|
+
if (straightReplies.length > 1) {
|
|
4543
|
+
debug.log('renderMessageRow: found normal replies: ', straightReplies);
|
|
4544
|
+
}
|
|
4545
|
+
_context10.next = 20;
|
|
4546
|
+
return (0, _chatLogic.originalVersion)(message);
|
|
4547
|
+
case 20:
|
|
4548
|
+
originalMessage = _context10.sent;
|
|
4549
|
+
edited = !message.sameTerm(originalMessage); // @@ load it first @@ Or display the new data at the old date.
|
|
4550
|
+
// @@@ kludge!
|
|
4551
|
+
sortDate = _solidLogic.store.the(originalMessage, ns.dct('created'), null, originalMessage.doc()) || _solidLogic.store.the(message, ns.dct('created'), null, message.doc()); // In message
|
|
4552
|
+
messageRow = dom.createElement('tr');
|
|
4553
|
+
messageRow.AJAR_date = sortDate.value;
|
|
4554
|
+
messageRow.AJAR_subject = message;
|
|
4555
|
+
td1 = dom.createElement('td');
|
|
4556
|
+
messageRow.appendChild(td1);
|
|
4557
|
+
if (!options.authorDateOnLeft) {
|
|
4558
|
+
img = dom.createElement('img');
|
|
4559
|
+
img.setAttribute('style', 'max-height: 2.5em; max-width: 2.5em; border-radius: 0.5em; margin: auto;');
|
|
4560
|
+
widgets.setImage(img, creator);
|
|
4561
|
+
td1.appendChild(img);
|
|
4562
|
+
} else {
|
|
4563
|
+
creatorAndDate(td1, creator, widgets.shortDate(sortDate.value), message);
|
|
4564
|
+
}
|
|
4565
|
+
bothDates = widgets.shortDate(sortDate.value);
|
|
4566
|
+
if (edited) {
|
|
4567
|
+
bothDates += ' ... ' + widgets.shortDate(date.value);
|
|
4568
|
+
}
|
|
4569
|
+
|
|
4570
|
+
// Render the content ot the message itself
|
|
4571
|
+
td2 = messageRow.appendChild(dom.createElement('td'));
|
|
4572
|
+
if (!options.authorDateOnLeft) {
|
|
4573
|
+
creatorAndDateHorizontal(td2, creator, bothDates,
|
|
4574
|
+
// widgets.shortDate(dateString)
|
|
4575
|
+
message);
|
|
4576
|
+
}
|
|
4577
|
+
text = content ? content.value.trim() : '??? no content?';
|
|
4578
|
+
isURI = /^https?:\/[^ <>]*$/i.test(text);
|
|
4579
|
+
para = null;
|
|
4580
|
+
if (isURI) {
|
|
4581
|
+
isImage = /\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(text); // @@ Should use content-type not URI
|
|
4582
|
+
if (isImage && options.expandImagesInline) {
|
|
4583
|
+
_img = elementForImageURI(text, options);
|
|
4584
|
+
td2.appendChild(_img);
|
|
4585
|
+
} else {
|
|
4586
|
+
// Link but not Image
|
|
4587
|
+
anc = td2.appendChild(dom.createElement('a'));
|
|
4588
|
+
para = anc.appendChild(dom.createElement('p'));
|
|
4589
|
+
anc.href = text;
|
|
4590
|
+
para.textContent = text;
|
|
4591
|
+
td2.appendChild(anc);
|
|
4592
|
+
}
|
|
4593
|
+
} else {
|
|
4594
|
+
// text
|
|
4595
|
+
para = dom.createElement('p');
|
|
4596
|
+
td2.appendChild(para);
|
|
4597
|
+
para.textContent = text;
|
|
4598
|
+
}
|
|
4599
|
+
if (para) {
|
|
4600
|
+
bgcolor = colorizeByAuthor ? pad.lightColorHash(creator) : getBgColor(fresh);
|
|
4601
|
+
para.setAttribute('style', messageBodyStyle + 'background-color: ' + bgcolor + ';');
|
|
4602
|
+
}
|
|
4603
|
+
_context10.next = 40;
|
|
4604
|
+
return (0, _messageTools.sentimentStripLinked)(message, message.doc());
|
|
4605
|
+
case 40:
|
|
4606
|
+
strip = _context10.sent;
|
|
4607
|
+
if (strip.children.length) {
|
|
4608
|
+
td2.appendChild(dom.createElement('br'));
|
|
4609
|
+
td2.appendChild(strip);
|
|
4610
|
+
}
|
|
4611
|
+
|
|
4612
|
+
// Message tool bar button
|
|
4613
|
+
td3 = dom.createElement('td');
|
|
4614
|
+
messageRow.appendChild(td3);
|
|
4615
|
+
toolsButton = widgets.button(dom, _iconBase.icons.iconBase + 'noun_243787.svg', '...');
|
|
4616
|
+
td3.appendChild(toolsButton);
|
|
4617
|
+
toolsButton.addEventListener('click', /*#__PURE__*/function () {
|
|
4618
|
+
var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(_event) {
|
|
4619
|
+
var toolsTR, tools, toolsTD;
|
|
4620
|
+
return _regenerator["default"].wrap(function _callee8$(_context9) {
|
|
4621
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
4622
|
+
case 0:
|
|
4623
|
+
if (!messageRow.toolTR) {
|
|
4624
|
+
_context9.next = 4;
|
|
4625
|
+
break;
|
|
4626
|
+
}
|
|
4627
|
+
// already got a toolbar? Toogle
|
|
4628
|
+
messageRow.parentNode.removeChild(messageRow.toolTR);
|
|
4629
|
+
delete messageRow.toolTR;
|
|
4630
|
+
return _context9.abrupt("return");
|
|
4631
|
+
case 4:
|
|
4632
|
+
toolsTR = dom.createElement('tr');
|
|
4633
|
+
_context9.next = 7;
|
|
4634
|
+
return (0, _messageTools.messageToolbar)(message, messageRow, _objectSpread(_objectSpread({}, userContext), {}, {
|
|
4635
|
+
chatOptions: options
|
|
4636
|
+
}), channelObject);
|
|
4637
|
+
case 7:
|
|
4638
|
+
tools = _context9.sent;
|
|
4639
|
+
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
|
|
4640
|
+
if (messageRow.nextSibling) {
|
|
4641
|
+
messageRow.parentElement.insertBefore(toolsTR, messageRow.nextSibling);
|
|
4642
|
+
} else {
|
|
4643
|
+
messageRow.parentElement.appendChild(toolsTR);
|
|
4644
|
+
}
|
|
4645
|
+
messageRow.toolTR = toolsTR;
|
|
4646
|
+
toolsTR.appendChild(dom.createElement('td')); // left
|
|
4647
|
+
toolsTD = toolsTR.appendChild(dom.createElement('td'));
|
|
4648
|
+
toolsTR.appendChild(dom.createElement('td')); // right
|
|
4649
|
+
toolsTD.appendChild(tools);
|
|
4650
|
+
case 15:
|
|
4651
|
+
case "end":
|
|
4652
|
+
return _context9.stop();
|
|
4653
|
+
}
|
|
4654
|
+
}, _callee8);
|
|
4655
|
+
}));
|
|
4656
|
+
return function (_x20) {
|
|
4657
|
+
return _ref4.apply(this, arguments);
|
|
4658
|
+
};
|
|
4659
|
+
}());
|
|
4660
|
+
if (thread && options.showThread) {
|
|
4661
|
+
debug.log(' message has thread ' + thread);
|
|
4662
|
+
td3.appendChild(widgets.button(dom, _iconBase.icons.iconBase + 'noun_1180164.svg',
|
|
4663
|
+
// right arrow .. @@ think of stg better
|
|
4664
|
+
'see thread', function (_e) {
|
|
4665
|
+
debug.log('@@@@ Calling showThread thread ' + thread);
|
|
4666
|
+
options.showThread(thread, options);
|
|
4667
|
+
}));
|
|
4668
|
+
}
|
|
4669
|
+
return _context10.abrupt("return", messageRow);
|
|
4670
|
+
case 49:
|
|
4671
|
+
case "end":
|
|
4672
|
+
return _context10.stop();
|
|
4673
|
+
}
|
|
4674
|
+
}, _callee9);
|
|
4675
|
+
}));
|
|
4676
|
+
return _renderMessageRow.apply(this, arguments);
|
|
4677
|
+
}
|
|
4678
|
+
function switchToEditor(_x6, _x7, _x8, _x9) {
|
|
4679
|
+
return _switchToEditor.apply(this, arguments);
|
|
4235
4680
|
}
|
|
4236
4681
|
/* Control for a new message -- or editing an old message ***************
|
|
4237
4682
|
*
|
|
4238
4683
|
*/
|
|
4684
|
+
function _switchToEditor() {
|
|
4685
|
+
_switchToEditor = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(messageRow, message, channelObject, userContext) {
|
|
4686
|
+
var messageTable, editRow;
|
|
4687
|
+
return _regenerator["default"].wrap(function _callee10$(_context11) {
|
|
4688
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
4689
|
+
case 0:
|
|
4690
|
+
messageTable = messageRow.parentNode;
|
|
4691
|
+
_context11.t0 = renderMessageEditor;
|
|
4692
|
+
_context11.t1 = channelObject;
|
|
4693
|
+
_context11.t2 = messageTable;
|
|
4694
|
+
_context11.t3 = userContext;
|
|
4695
|
+
_context11.t4 = channelObject.options;
|
|
4696
|
+
_context11.next = 8;
|
|
4697
|
+
return (0, _chatLogic.mostRecentVersion)(message);
|
|
4698
|
+
case 8:
|
|
4699
|
+
_context11.t5 = _context11.sent;
|
|
4700
|
+
editRow = (0, _context11.t0)(_context11.t1, _context11.t2, _context11.t3, _context11.t4, _context11.t5);
|
|
4701
|
+
messageTable.insertBefore(editRow, messageRow);
|
|
4702
|
+
editRow.originalRow = messageRow;
|
|
4703
|
+
messageRow.style.visibility = 'hidden'; // Hide the original message. unhide if user cancels edit
|
|
4704
|
+
case 13:
|
|
4705
|
+
case "end":
|
|
4706
|
+
return _context11.stop();
|
|
4707
|
+
}
|
|
4708
|
+
}, _callee10);
|
|
4709
|
+
}));
|
|
4710
|
+
return _switchToEditor.apply(this, arguments);
|
|
4711
|
+
}
|
|
4239
4712
|
function renderMessageEditor(channelObject, messageTable, userContext, options, originalMessage) {
|
|
4240
4713
|
function revertEditing(messageEditor) {
|
|
4241
4714
|
messageEditor.originalRow.style.visibility = 'visible'; // restore read-only version
|
|
4242
4715
|
messageEditor.parentNode.removeChild(messageEditor);
|
|
4243
4716
|
}
|
|
4244
|
-
function handleFieldInput(
|
|
4717
|
+
function handleFieldInput(_x10) {
|
|
4245
4718
|
return _handleFieldInput.apply(this, arguments);
|
|
4246
4719
|
}
|
|
4247
4720
|
function _handleFieldInput() {
|
|
@@ -4259,72 +4732,87 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4259
4732
|
}));
|
|
4260
4733
|
return _handleFieldInput.apply(this, arguments);
|
|
4261
4734
|
}
|
|
4262
|
-
function sendMessage(
|
|
4735
|
+
function sendMessage(_x11, _x12) {
|
|
4263
4736
|
return _sendMessage.apply(this, arguments);
|
|
4264
4737
|
} // sendMessage
|
|
4265
4738
|
// DRAG AND DROP
|
|
4266
4739
|
function _sendMessage() {
|
|
4267
|
-
_sendMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
4268
|
-
var sendComplete, message, statusArea;
|
|
4269
|
-
return _regenerator["default"].wrap(function
|
|
4270
|
-
while (1) switch (
|
|
4740
|
+
_sendMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(text, fromMainField) {
|
|
4741
|
+
var sendComplete, _sendComplete, message, statusArea;
|
|
4742
|
+
return _regenerator["default"].wrap(function _callee7$(_context8) {
|
|
4743
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
4271
4744
|
case 0:
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
oldRow.parentNode.removeChild(oldRow); // No longer needed old version
|
|
4283
|
-
} else {
|
|
4284
|
-
debug.warn('No parentNode on old message ' + oldRow.textContent);
|
|
4285
|
-
oldRow.style.backgroundColor = '#fee';
|
|
4286
|
-
oldRow.style.visibility = 'hidden'; // @@ FIX THIS AND REMOVE FROM DOM INSTEAD
|
|
4287
|
-
}
|
|
4745
|
+
_sendComplete = function _sendComplete3() {
|
|
4746
|
+
_sendComplete = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(message, _text2) {
|
|
4747
|
+
var oldRow;
|
|
4748
|
+
return _regenerator["default"].wrap(function _callee6$(_context7) {
|
|
4749
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
4750
|
+
case 0:
|
|
4751
|
+
_context7.next = 2;
|
|
4752
|
+
return (0, _infinite.insertMessageIntoTable)(channelObject, messageTable, message, false, options, userContext);
|
|
4753
|
+
case 2:
|
|
4754
|
+
// not green
|
|
4288
4755
|
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
}
|
|
4300
|
-
// await channelObject.div.refresh() // Add new day if nec @@ add back
|
|
4301
|
-
};
|
|
4756
|
+
if (originalMessage) {
|
|
4757
|
+
// editing another message
|
|
4758
|
+
oldRow = messageEditor.originalRow; // oldRow.style.display = '' // restore read-only version, re-attack
|
|
4759
|
+
if (oldRow.parentNode) {
|
|
4760
|
+
oldRow.parentNode.removeChild(oldRow); // No longer needed old version
|
|
4761
|
+
} else {
|
|
4762
|
+
debug.warn('No parentNode on old message ' + oldRow.textContent);
|
|
4763
|
+
oldRow.style.backgroundColor = '#fee';
|
|
4764
|
+
oldRow.style.visibility = 'hidden'; // @@ FIX THIS AND REMOVE FROM DOM INSTEAD
|
|
4765
|
+
}
|
|
4302
4766
|
|
|
4767
|
+
messageEditor.parentNode.removeChild(messageEditor); // no longer need editor
|
|
4768
|
+
} else {
|
|
4769
|
+
if (fromMainField) {
|
|
4770
|
+
field.value = ''; // clear from out for reuse
|
|
4771
|
+
field.setAttribute('style', messageBodyStyle);
|
|
4772
|
+
field.disabled = false;
|
|
4773
|
+
field.scrollIntoView(options.newestFirst); // allign bottom (top)
|
|
4774
|
+
field.focus(); // Start typing next line immediately
|
|
4775
|
+
field.select();
|
|
4776
|
+
}
|
|
4777
|
+
}
|
|
4778
|
+
// await channelObject.div.refresh() // Add new day if nec @@ add back
|
|
4779
|
+
case 3:
|
|
4780
|
+
case "end":
|
|
4781
|
+
return _context7.stop();
|
|
4782
|
+
}
|
|
4783
|
+
}, _callee6);
|
|
4784
|
+
}));
|
|
4785
|
+
return _sendComplete.apply(this, arguments);
|
|
4786
|
+
};
|
|
4787
|
+
sendComplete = function _sendComplete2(_x18, _x19) {
|
|
4788
|
+
return _sendComplete.apply(this, arguments);
|
|
4789
|
+
};
|
|
4303
4790
|
// const me = authn.currentUser() // Must be logged on or wuld have got login button
|
|
4304
4791
|
if (fromMainField) {
|
|
4305
4792
|
field.setAttribute('style', messageBodyStyle + 'color: #bbb;'); // pendingedit
|
|
4306
4793
|
field.disabled = true;
|
|
4307
4794
|
}
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
return channelObject.updateMessage(text, originalMessage);
|
|
4311
|
-
case
|
|
4312
|
-
message =
|
|
4313
|
-
|
|
4795
|
+
_context8.prev = 3;
|
|
4796
|
+
_context8.next = 6;
|
|
4797
|
+
return channelObject.updateMessage(text, originalMessage, null, options.thread);
|
|
4798
|
+
case 6:
|
|
4799
|
+
message = _context8.sent;
|
|
4800
|
+
_context8.next = 14;
|
|
4314
4801
|
break;
|
|
4315
|
-
case
|
|
4316
|
-
|
|
4317
|
-
|
|
4802
|
+
case 9:
|
|
4803
|
+
_context8.prev = 9;
|
|
4804
|
+
_context8.t0 = _context8["catch"](3);
|
|
4318
4805
|
statusArea = userContext.statusArea || messageEditor;
|
|
4319
|
-
statusArea.appendChild(widgets.errorMessageBlock(dom, 'Error writing message: ' +
|
|
4320
|
-
return
|
|
4321
|
-
case 13:
|
|
4322
|
-
sendComplete(message, text);
|
|
4806
|
+
statusArea.appendChild(widgets.errorMessageBlock(dom, 'Error writing message: ' + _context8.t0));
|
|
4807
|
+
return _context8.abrupt("return");
|
|
4323
4808
|
case 14:
|
|
4809
|
+
_context8.next = 16;
|
|
4810
|
+
return sendComplete(message, text);
|
|
4811
|
+
case 16:
|
|
4324
4812
|
case "end":
|
|
4325
|
-
return
|
|
4813
|
+
return _context8.stop();
|
|
4326
4814
|
}
|
|
4327
|
-
},
|
|
4815
|
+
}, _callee7, null, [[3, 9]]);
|
|
4328
4816
|
}));
|
|
4329
4817
|
return _sendMessage.apply(this, arguments);
|
|
4330
4818
|
}
|
|
@@ -4343,7 +4831,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4343
4831
|
}
|
|
4344
4832
|
}, _callee);
|
|
4345
4833
|
}));
|
|
4346
|
-
return function (
|
|
4834
|
+
return function (_x13, _x14) {
|
|
4347
4835
|
return _ref.apply(this, arguments);
|
|
4348
4836
|
};
|
|
4349
4837
|
}());
|
|
@@ -4387,7 +4875,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4387
4875
|
}
|
|
4388
4876
|
}, _callee2, null, [[1, 11, 14, 17]]);
|
|
4389
4877
|
}));
|
|
4390
|
-
return function droppedURIHandler(
|
|
4878
|
+
return function droppedURIHandler(_x15) {
|
|
4391
4879
|
return _ref2.apply(this, arguments);
|
|
4392
4880
|
};
|
|
4393
4881
|
}();
|
|
@@ -4398,7 +4886,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4398
4886
|
imageDoc = $rdf.sym(chatDocument.dir().uri + 'Image_' + Date.now() + '.png');
|
|
4399
4887
|
return imageDoc;
|
|
4400
4888
|
}
|
|
4401
|
-
function tookPicture(
|
|
4889
|
+
function tookPicture(_x16) {
|
|
4402
4890
|
return _tookPicture.apply(this, arguments);
|
|
4403
4891
|
} // Body of turnOnInput
|
|
4404
4892
|
function _tookPicture() {
|
|
@@ -4475,7 +4963,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4475
4963
|
}
|
|
4476
4964
|
}, _callee3);
|
|
4477
4965
|
}));
|
|
4478
|
-
return function (
|
|
4966
|
+
return function (_x17) {
|
|
4479
4967
|
return _ref3.apply(this, arguments);
|
|
4480
4968
|
};
|
|
4481
4969
|
}(), false);
|
|
@@ -4537,7 +5025,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4537
5025
|
turnOnInput();
|
|
4538
5026
|
Object.assign(context, userContext);
|
|
4539
5027
|
(0, _bookmarks.findBookmarkDocument)(context).then(function (_context) {
|
|
4540
|
-
//
|
|
5028
|
+
// debug.log('Bookmark file: ' + context.bookmarkDocument)
|
|
4541
5029
|
});
|
|
4542
5030
|
});
|
|
4543
5031
|
return messageEditor;
|
|
@@ -4560,12 +5048,15 @@ var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_m
|
|
|
4560
5048
|
Object.defineProperty(exports, "__esModule", ({
|
|
4561
5049
|
value: true
|
|
4562
5050
|
}));
|
|
5051
|
+
exports.ActionClassFromEmoji = ActionClassFromEmoji;
|
|
5052
|
+
exports.emojiFromAction = emojiFromAction;
|
|
5053
|
+
exports.emojiFromActionClass = emojiFromActionClass;
|
|
4563
5054
|
exports.messageToolbar = messageToolbar;
|
|
4564
5055
|
exports.sentimentStrip = sentimentStrip;
|
|
4565
5056
|
exports.sentimentStripLinked = sentimentStripLinked;
|
|
4566
5057
|
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
|
|
4567
|
-
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
4568
5058
|
var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "./node_modules/@babel/runtime/helpers/slicedToArray.js"));
|
|
5059
|
+
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
4569
5060
|
var debug = _interopRequireWildcard(__webpack_require__(/*! ../debug */ "./lib/debug.js"));
|
|
4570
5061
|
var _iconBase = __webpack_require__(/*! ../iconBase */ "./lib/iconBase.js");
|
|
4571
5062
|
var ns = _interopRequireWildcard(__webpack_require__(/*! ../ns */ "./lib/ns.js"));
|
|
@@ -4606,30 +5097,46 @@ var PENCIL_ICON = 'noun_253504.svg'; // edit a message
|
|
|
4606
5097
|
// const SPANNER_ICON = 'noun_344563.svg' -> settings
|
|
4607
5098
|
var THUMBS_UP_ICON = 'noun_1384132.svg';
|
|
4608
5099
|
var THUMBS_DOWN_ICON = 'noun_1384135.svg';
|
|
5100
|
+
var REPLY_ICON = 'noun-reply-5506924.svg';
|
|
4609
5101
|
/**
|
|
4610
5102
|
* Emoji in Unicode
|
|
4611
5103
|
*/
|
|
4612
|
-
var
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
|
|
5104
|
+
var emojiMap = {};
|
|
5105
|
+
emojiMap[ns.schema('AgreeAction')] = '👍';
|
|
5106
|
+
emojiMap[ns.schema('DisagreeAction')] = '👎';
|
|
5107
|
+
emojiMap[ns.schema('EndorseAction')] = '⭐️';
|
|
5108
|
+
emojiMap[ns.schema('LikeAction')] = '❤️';
|
|
5109
|
+
function emojiFromActionClass(action) {
|
|
5110
|
+
return emojiMap[action] || null;
|
|
5111
|
+
}
|
|
5112
|
+
function ActionClassFromEmoji(emoji) {
|
|
5113
|
+
for (var a in emojiMap) {
|
|
5114
|
+
if (emojiMap[a] === emoji) {
|
|
5115
|
+
return rdf.sym(a.slice(1, -1)); // remove < >
|
|
5116
|
+
}
|
|
5117
|
+
}
|
|
5118
|
+
|
|
5119
|
+
return null;
|
|
5120
|
+
}
|
|
5121
|
+
|
|
5122
|
+
// Allow the qction to give its own emoji as content,
|
|
5123
|
+
// or get the emoji from the class lof action.
|
|
5124
|
+
function emojiFromAction(action) {
|
|
5125
|
+
var content = _solidLogic.store.any(action, ns.sioc('content'), null, action.doc());
|
|
5126
|
+
if (content) return content;
|
|
5127
|
+
var klass = _solidLogic.store.any(action, ns.rdf('type'), null, action.doc());
|
|
5128
|
+
if (klass) {
|
|
5129
|
+
var em = emojiFromActionClass(klass);
|
|
5130
|
+
if (em) return em;
|
|
5131
|
+
}
|
|
5132
|
+
return '⬜️';
|
|
5133
|
+
}
|
|
4617
5134
|
|
|
4618
5135
|
/**
|
|
4619
5136
|
* Create strip of sentiments expressed
|
|
4620
5137
|
*/
|
|
4621
|
-
function sentimentStrip(
|
|
4622
|
-
|
|
4623
|
-
var latest = (0, _chatLogic.mostRecentVersion)(target);
|
|
4624
|
-
var actions = _solidLogic.store.holds(latest, ns.schema('dateDeleted').value, null, latest.doc()) ? _solidLogic.store.each(null, ns.schema('target'), target, doc) : [];
|
|
4625
|
-
var sentiments = actions.map(function (a) {
|
|
4626
|
-
return _solidLogic.store.any(a, ns.rdf('type'), null, doc);
|
|
4627
|
-
});
|
|
4628
|
-
sentiments.sort();
|
|
4629
|
-
var strings = sentiments.map(function (x) {
|
|
4630
|
-
return emoji[x] || '';
|
|
4631
|
-
});
|
|
4632
|
-
return dom.createTextNode(strings.join(' '));
|
|
5138
|
+
function sentimentStrip(_x, _x2) {
|
|
5139
|
+
return _sentimentStrip.apply(this, arguments);
|
|
4633
5140
|
}
|
|
4634
5141
|
/**
|
|
4635
5142
|
* Create strip of sentiments expressed, with hyperlinks
|
|
@@ -4637,276 +5144,445 @@ function sentimentStrip(target, doc) {
|
|
|
4637
5144
|
* @param target {NamedNode} - The thing about which they are expressed
|
|
4638
5145
|
* @param doc {NamedNode} - The document in which they are expressed
|
|
4639
5146
|
*/
|
|
4640
|
-
function
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
5147
|
+
function _sentimentStrip() {
|
|
5148
|
+
_sentimentStrip = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(target, doc) {
|
|
5149
|
+
var versions, actions, strings;
|
|
5150
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
5151
|
+
while (1) switch (_context.prev = _context.next) {
|
|
5152
|
+
case 0:
|
|
5153
|
+
_context.next = 2;
|
|
5154
|
+
return (0, _chatLogic.allVersions)(target);
|
|
5155
|
+
case 2:
|
|
5156
|
+
versions = _context.sent;
|
|
5157
|
+
debug.log('sentimentStrip Versions for ' + target, versions);
|
|
5158
|
+
actions = versions.map(function (version) {
|
|
5159
|
+
return _solidLogic.store.each(null, ns.schema('target'), version, doc);
|
|
5160
|
+
}).flat();
|
|
5161
|
+
debug.log('sentimentStrip: Actions for ' + target, actions);
|
|
5162
|
+
strings = actions.map(function (action) {
|
|
5163
|
+
return emojiFromAction(action) || '';
|
|
5164
|
+
});
|
|
5165
|
+
return _context.abrupt("return", dom.createTextNode(strings.join(' ')));
|
|
5166
|
+
case 8:
|
|
5167
|
+
case "end":
|
|
5168
|
+
return _context.stop();
|
|
4659
5169
|
}
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
return strip;
|
|
5170
|
+
}, _callee);
|
|
5171
|
+
}));
|
|
5172
|
+
return _sentimentStrip.apply(this, arguments);
|
|
5173
|
+
}
|
|
5174
|
+
function sentimentStripLinked(_x3, _x4) {
|
|
5175
|
+
return _sentimentStripLinked.apply(this, arguments);
|
|
4667
5176
|
}
|
|
4668
5177
|
/**
|
|
4669
5178
|
* Creates a message toolbar component
|
|
4670
5179
|
*/
|
|
4671
|
-
function
|
|
4672
|
-
function
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
5180
|
+
function _sentimentStripLinked() {
|
|
5181
|
+
_sentimentStripLinked = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(target, doc) {
|
|
5182
|
+
var strip, refresh, _refresh;
|
|
5183
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
5184
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
5185
|
+
case 0:
|
|
5186
|
+
_refresh = function _refresh3() {
|
|
5187
|
+
_refresh = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
5188
|
+
var versions, actions, sentiments;
|
|
5189
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
5190
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
5191
|
+
case 0:
|
|
5192
|
+
strip.innerHTML = '';
|
|
5193
|
+
if (!(0, _chatLogic.isDeleted)(target)) {
|
|
5194
|
+
_context2.next = 3;
|
|
5195
|
+
break;
|
|
5196
|
+
}
|
|
5197
|
+
return _context2.abrupt("return", strip);
|
|
5198
|
+
case 3:
|
|
5199
|
+
_context2.next = 5;
|
|
5200
|
+
return (0, _chatLogic.allVersions)(target);
|
|
5201
|
+
case 5:
|
|
5202
|
+
versions = _context2.sent;
|
|
5203
|
+
debug.log('sentimentStripLinked: Versions for ' + target, versions);
|
|
5204
|
+
actions = versions.map(function (version) {
|
|
5205
|
+
return _solidLogic.store.each(null, ns.schema('target'), version, doc);
|
|
5206
|
+
}).flat();
|
|
5207
|
+
debug.log('sentimentStripLinked: Actions for ' + target, actions);
|
|
5208
|
+
if (!(actions.length === 0)) {
|
|
5209
|
+
_context2.next = 11;
|
|
5210
|
+
break;
|
|
5211
|
+
}
|
|
5212
|
+
return _context2.abrupt("return", strip);
|
|
5213
|
+
case 11:
|
|
5214
|
+
sentiments = actions.map(function (a) {
|
|
5215
|
+
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)];
|
|
5216
|
+
});
|
|
5217
|
+
debug.log(' Actions sentiments ', sentiments);
|
|
5218
|
+
sentiments.sort();
|
|
5219
|
+
sentiments.forEach(function (ss) {
|
|
5220
|
+
var _ss = (0, _slicedToArray2["default"])(ss, 3),
|
|
5221
|
+
theClass = _ss[0],
|
|
5222
|
+
content = _ss[1],
|
|
5223
|
+
agent = _ss[2];
|
|
5224
|
+
var res;
|
|
5225
|
+
if (agent) {
|
|
5226
|
+
res = dom.createElement('a');
|
|
5227
|
+
res.setAttribute('href', agent.uri);
|
|
5228
|
+
} else {
|
|
5229
|
+
res = dom.createTextNode('');
|
|
5230
|
+
}
|
|
5231
|
+
res.textContent = content || emojiMap[theClass] || '⬜️';
|
|
5232
|
+
strip.appendChild(res);
|
|
5233
|
+
});
|
|
5234
|
+
debug.log(' Actions strip ', strip);
|
|
5235
|
+
case 16:
|
|
5236
|
+
case "end":
|
|
5237
|
+
return _context2.stop();
|
|
5238
|
+
}
|
|
5239
|
+
}, _callee2);
|
|
5240
|
+
}));
|
|
5241
|
+
return _refresh.apply(this, arguments);
|
|
5242
|
+
};
|
|
5243
|
+
refresh = function _refresh2() {
|
|
5244
|
+
return _refresh.apply(this, arguments);
|
|
5245
|
+
};
|
|
5246
|
+
strip = dom.createElement('span');
|
|
5247
|
+
refresh().then(debug.log('sentimentStripLinked: sentimentStripLinked async refreshed'));
|
|
5248
|
+
strip.refresh = refresh;
|
|
5249
|
+
return _context3.abrupt("return", strip);
|
|
5250
|
+
case 6:
|
|
5251
|
+
case "end":
|
|
5252
|
+
return _context3.stop();
|
|
5253
|
+
}
|
|
5254
|
+
}, _callee3);
|
|
5255
|
+
}));
|
|
5256
|
+
return _sentimentStripLinked.apply(this, arguments);
|
|
5257
|
+
}
|
|
5258
|
+
function messageToolbar(_x5, _x6, _x7, _x8) {
|
|
5259
|
+
return _messageToolbar.apply(this, arguments);
|
|
5260
|
+
}
|
|
5261
|
+
function _messageToolbar() {
|
|
5262
|
+
_messageToolbar = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(message, messageRow, userContext, channelObject) {
|
|
5263
|
+
var deleteMessage, _deleteMessage, editMessage, _editMessage, replyInThread, _replyInThread, div, closeToolbar, deleteThingThen, _deleteThingThen, me, sentimentButton, context1, cancelButton;
|
|
5264
|
+
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
|
5265
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
5266
|
+
case 0:
|
|
5267
|
+
sentimentButton = function _sentimentButton(context, target, icon, actionClass, doc, mutuallyExclusive) {
|
|
5268
|
+
function setColor() {
|
|
5269
|
+
button.style.backgroundColor = action ? 'yellow' : 'white';
|
|
4685
5270
|
}
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
5271
|
+
var button = widgets.button(dom, icon, utils.label(actionClass), /*#__PURE__*/function () {
|
|
5272
|
+
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(_event) {
|
|
5273
|
+
var insertMe, dirty, i, a;
|
|
5274
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
5275
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
5276
|
+
case 0:
|
|
5277
|
+
if (!action) {
|
|
5278
|
+
_context4.next = 7;
|
|
5279
|
+
break;
|
|
5280
|
+
}
|
|
5281
|
+
_context4.next = 3;
|
|
5282
|
+
return deleteThingThen(action);
|
|
5283
|
+
case 3:
|
|
5284
|
+
action = null;
|
|
5285
|
+
setColor();
|
|
5286
|
+
_context4.next = 25;
|
|
5287
|
+
break;
|
|
5288
|
+
case 7:
|
|
5289
|
+
// no action
|
|
5290
|
+
action = widgets.newThing(doc);
|
|
5291
|
+
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)];
|
|
5292
|
+
_context4.next = 11;
|
|
5293
|
+
return _solidLogic.store.updater.update([], insertMe);
|
|
5294
|
+
case 11:
|
|
5295
|
+
setColor();
|
|
5296
|
+
if (!mutuallyExclusive) {
|
|
5297
|
+
_context4.next = 25;
|
|
5298
|
+
break;
|
|
5299
|
+
}
|
|
5300
|
+
// Delete incompative sentiments
|
|
5301
|
+
dirty = false;
|
|
5302
|
+
i = 0;
|
|
5303
|
+
case 15:
|
|
5304
|
+
if (!(i < mutuallyExclusive.length)) {
|
|
5305
|
+
_context4.next = 24;
|
|
5306
|
+
break;
|
|
5307
|
+
}
|
|
5308
|
+
a = existingAction(mutuallyExclusive[i]);
|
|
5309
|
+
if (!a) {
|
|
5310
|
+
_context4.next = 21;
|
|
5311
|
+
break;
|
|
5312
|
+
}
|
|
5313
|
+
_context4.next = 20;
|
|
5314
|
+
return deleteThingThen(a);
|
|
5315
|
+
case 20:
|
|
5316
|
+
// but how refresh? refreshTree the parent?
|
|
5317
|
+
dirty = true;
|
|
5318
|
+
case 21:
|
|
5319
|
+
i++;
|
|
5320
|
+
_context4.next = 15;
|
|
5321
|
+
break;
|
|
5322
|
+
case 24:
|
|
5323
|
+
if (dirty) {
|
|
5324
|
+
// widgets.refreshTree(button.parentNode) // requires them all to be immediate siblings
|
|
5325
|
+
widgets.refreshTree(messageRow); // requires them all to be immediate siblings
|
|
5326
|
+
}
|
|
5327
|
+
case 25:
|
|
5328
|
+
case "end":
|
|
5329
|
+
return _context4.stop();
|
|
5330
|
+
}
|
|
5331
|
+
}, _callee4);
|
|
5332
|
+
}));
|
|
5333
|
+
return function (_x11) {
|
|
5334
|
+
return _ref.apply(this, arguments);
|
|
5335
|
+
};
|
|
5336
|
+
}());
|
|
5337
|
+
function existingAction(actionClass) {
|
|
5338
|
+
var actions = _solidLogic.store.each(null, ns.schema('agent'), context.me, doc).filter(function (x) {
|
|
5339
|
+
return _solidLogic.store.holds(x, ns.rdf('type'), actionClass, doc);
|
|
5340
|
+
}).filter(function (x) {
|
|
5341
|
+
return _solidLogic.store.holds(x, ns.schema('target'), target, doc);
|
|
5342
|
+
});
|
|
5343
|
+
return actions.length ? actions[0] : null;
|
|
4693
5344
|
}
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
case 9:
|
|
4698
|
-
_context2.next = 18;
|
|
4699
|
-
break;
|
|
4700
|
-
case 11:
|
|
4701
|
-
_context2.prev = 11;
|
|
4702
|
-
_context2.t0 = _context2["catch"](6);
|
|
4703
|
-
msg = 'Error deleting messaage ' + _context2.t0;
|
|
4704
|
-
debug.warn(msg);
|
|
4705
|
-
alert(msg);
|
|
4706
|
-
area = userContext.statusArea || messageRow.parentNode;
|
|
4707
|
-
area.appendChild(widgets.errorMessageBlock(dom, msg));
|
|
4708
|
-
case 18:
|
|
4709
|
-
messageRow.parentNode.removeChild(messageRow);
|
|
4710
|
-
_context2.next = 22;
|
|
4711
|
-
break;
|
|
4712
|
-
case 21:
|
|
4713
|
-
alert('You can\'t delete the message, you are not logged in as the author, ' + author);
|
|
4714
|
-
case 22:
|
|
4715
|
-
closeToolbar();
|
|
4716
|
-
case 23:
|
|
4717
|
-
case "end":
|
|
4718
|
-
return _context2.stop();
|
|
4719
|
-
}
|
|
4720
|
-
}, _callee2, null, [[6, 11]]);
|
|
4721
|
-
}));
|
|
4722
|
-
return _deleteMessage.apply(this, arguments);
|
|
4723
|
-
}
|
|
4724
|
-
function editMessage(_x) {
|
|
4725
|
-
return _editMessage.apply(this, arguments);
|
|
4726
|
-
} // alain TODO allow chat owner to fully delete message + sentiments and replacing messages
|
|
4727
|
-
function _editMessage() {
|
|
4728
|
-
_editMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(messageRow) {
|
|
4729
|
-
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
4730
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
4731
|
-
case 0:
|
|
4732
|
-
if (me.value === _solidLogic.store.any(message, ns.foaf('maker')).value) {
|
|
4733
|
-
closeToolbar(); // edit is a one-off action
|
|
4734
|
-
(0, _message.switchToEditor)(messageRow, message, channelObject, userContext);
|
|
5345
|
+
function refresh() {
|
|
5346
|
+
action = existingAction(actionClass);
|
|
5347
|
+
setColor();
|
|
4735
5348
|
}
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
5349
|
+
var action;
|
|
5350
|
+
button.refresh = refresh; // If the file changes, refresh live
|
|
5351
|
+
refresh();
|
|
5352
|
+
return button;
|
|
5353
|
+
};
|
|
5354
|
+
_deleteThingThen = function _deleteThingThen3() {
|
|
5355
|
+
_deleteThingThen = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(x) {
|
|
5356
|
+
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
|
5357
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
5358
|
+
case 0:
|
|
5359
|
+
_context9.next = 2;
|
|
5360
|
+
return _solidLogic.store.updater.update(_solidLogic.store.connectedStatements(x), []);
|
|
5361
|
+
case 2:
|
|
5362
|
+
case "end":
|
|
5363
|
+
return _context9.stop();
|
|
5364
|
+
}
|
|
5365
|
+
}, _callee9);
|
|
5366
|
+
}));
|
|
5367
|
+
return _deleteThingThen.apply(this, arguments);
|
|
5368
|
+
};
|
|
5369
|
+
deleteThingThen = function _deleteThingThen2(_x10) {
|
|
5370
|
+
return _deleteThingThen.apply(this, arguments);
|
|
5371
|
+
};
|
|
5372
|
+
closeToolbar = function _closeToolbar() {
|
|
5373
|
+
div.parentElement.parentElement.removeChild(div.parentElement); // remive the TR
|
|
5374
|
+
};
|
|
5375
|
+
_replyInThread = function _replyInThread3() {
|
|
5376
|
+
_replyInThread = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
|
|
5377
|
+
var thread, options;
|
|
5378
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
5379
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
5380
|
+
case 0:
|
|
5381
|
+
_context8.next = 2;
|
|
5382
|
+
return channelObject.createThread(message);
|
|
5383
|
+
case 2:
|
|
5384
|
+
thread = _context8.sent;
|
|
5385
|
+
options = userContext.chatOptions;
|
|
5386
|
+
if (options) {
|
|
5387
|
+
_context8.next = 6;
|
|
5388
|
+
break;
|
|
5389
|
+
}
|
|
5390
|
+
throw new Error('replyInThread: missing options');
|
|
5391
|
+
case 6:
|
|
5392
|
+
options.showThread(thread, options);
|
|
5393
|
+
closeToolbar(); // a one-off action
|
|
5394
|
+
case 8:
|
|
5395
|
+
case "end":
|
|
5396
|
+
return _context8.stop();
|
|
5397
|
+
}
|
|
5398
|
+
}, _callee8);
|
|
5399
|
+
}));
|
|
5400
|
+
return _replyInThread.apply(this, arguments);
|
|
5401
|
+
};
|
|
5402
|
+
replyInThread = function _replyInThread2() {
|
|
5403
|
+
return _replyInThread.apply(this, arguments);
|
|
5404
|
+
};
|
|
5405
|
+
_editMessage = function _editMessage3() {
|
|
5406
|
+
_editMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(messageRow) {
|
|
5407
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
5408
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
5409
|
+
case 0:
|
|
5410
|
+
if (!(me.value === _solidLogic.store.any(message, ns.foaf('maker')).value)) {
|
|
5411
|
+
_context7.next = 4;
|
|
5412
|
+
break;
|
|
5413
|
+
}
|
|
5414
|
+
closeToolbar(); // edit is a one-off action
|
|
5415
|
+
_context7.next = 4;
|
|
5416
|
+
return (0, _message.switchToEditor)(messageRow, message, channelObject, userContext);
|
|
5417
|
+
case 4:
|
|
5418
|
+
case "end":
|
|
5419
|
+
return _context7.stop();
|
|
5420
|
+
}
|
|
5421
|
+
}, _callee7);
|
|
5422
|
+
}));
|
|
5423
|
+
return _editMessage.apply(this, arguments);
|
|
5424
|
+
};
|
|
5425
|
+
editMessage = function _editMessage2(_x9) {
|
|
5426
|
+
return _editMessage.apply(this, arguments);
|
|
5427
|
+
};
|
|
5428
|
+
_deleteMessage = function _deleteMessage3() {
|
|
5429
|
+
_deleteMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
|
|
5430
|
+
var author, msg, area;
|
|
5431
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
5432
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
5433
|
+
case 0:
|
|
5434
|
+
author = _solidLogic.store.any(message, ns.foaf('maker'));
|
|
5435
|
+
if (me) {
|
|
5436
|
+
_context6.next = 5;
|
|
5437
|
+
break;
|
|
5438
|
+
}
|
|
5439
|
+
alert('You can\'t delete the message, you are not logged in.');
|
|
5440
|
+
_context6.next = 22;
|
|
5441
|
+
break;
|
|
5442
|
+
case 5:
|
|
5443
|
+
if (!me.sameTerm(author)) {
|
|
5444
|
+
_context6.next = 21;
|
|
5445
|
+
break;
|
|
5446
|
+
}
|
|
5447
|
+
_context6.prev = 6;
|
|
5448
|
+
_context6.next = 9;
|
|
5449
|
+
return channelObject.deleteMessage(message);
|
|
5450
|
+
case 9:
|
|
5451
|
+
_context6.next = 18;
|
|
5452
|
+
break;
|
|
5453
|
+
case 11:
|
|
5454
|
+
_context6.prev = 11;
|
|
5455
|
+
_context6.t0 = _context6["catch"](6);
|
|
5456
|
+
msg = 'Error deleting messaage ' + _context6.t0;
|
|
5457
|
+
debug.warn(msg);
|
|
5458
|
+
alert(msg);
|
|
5459
|
+
area = userContext.statusArea || messageRow.parentNode;
|
|
5460
|
+
area.appendChild(widgets.errorMessageBlock(dom, msg));
|
|
5461
|
+
case 18:
|
|
5462
|
+
messageRow.parentNode.removeChild(messageRow);
|
|
5463
|
+
_context6.next = 22;
|
|
5464
|
+
break;
|
|
5465
|
+
case 21:
|
|
5466
|
+
alert('You can\'t delete the message, you are not logged in as the author, ' + author);
|
|
5467
|
+
case 22:
|
|
5468
|
+
closeToolbar();
|
|
5469
|
+
case 23:
|
|
5470
|
+
case "end":
|
|
5471
|
+
return _context6.stop();
|
|
5472
|
+
}
|
|
5473
|
+
}, _callee6, null, [[6, 11]]);
|
|
5474
|
+
}));
|
|
5475
|
+
return _deleteMessage.apply(this, arguments);
|
|
5476
|
+
};
|
|
5477
|
+
deleteMessage = function _deleteMessage2() {
|
|
5478
|
+
return _deleteMessage.apply(this, arguments);
|
|
5479
|
+
};
|
|
5480
|
+
// alain: TODO allow chat owner to fully delete message + sentiments and replacing messages
|
|
5481
|
+
div = dom.createElement('div'); // is message deleted ?
|
|
5482
|
+
_context10.next = 13;
|
|
5483
|
+
return (0, _chatLogic.mostRecentVersion)(message).value;
|
|
5484
|
+
case 13:
|
|
5485
|
+
_context10.t0 = _context10.sent;
|
|
5486
|
+
_context10.t1 = ns.schema('dateDeleted').value;
|
|
5487
|
+
if (!(_context10.t0 === _context10.t1)) {
|
|
5488
|
+
_context10.next = 17;
|
|
5489
|
+
break;
|
|
5490
|
+
}
|
|
5491
|
+
return _context10.abrupt("return", div);
|
|
5492
|
+
case 17:
|
|
5493
|
+
// Things only the original author can do
|
|
5494
|
+
me = _solidLogic.authn.currentUser(); // If already logged on
|
|
5495
|
+
if (me && _solidLogic.store.holds(message, ns.foaf('maker'), me)) {
|
|
5496
|
+
// button to delete the message
|
|
5497
|
+
div.appendChild(widgets.deleteButtonWithCheck(dom, div, 'message', deleteMessage));
|
|
5498
|
+
// button to edit the message
|
|
5499
|
+
div.appendChild(widgets.button(dom, _iconBase.icons.iconBase + PENCIL_ICON, 'edit', function () {
|
|
5500
|
+
return editMessage(messageRow);
|
|
5501
|
+
}));
|
|
5502
|
+
} // if mine
|
|
5503
|
+
// Things anyone can do if they have a bookmark list async
|
|
5504
|
+
/*
|
|
5505
|
+
var bookmarkButton = await bookmarks.renderBookmarksButton(userContext)
|
|
5506
|
+
if (bookmarkButton) {
|
|
5507
|
+
div.appendChild(bookmarkButton)
|
|
5508
|
+
}
|
|
5509
|
+
*/
|
|
5510
|
+
// Things anyone can do if they have a bookmark list
|
|
4785
5511
|
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
5512
|
+
(0, _bookmarks.renderBookmarksButton)(userContext).then(function (bookmarkButton) {
|
|
5513
|
+
if (bookmarkButton) div.appendChild(bookmarkButton);
|
|
5514
|
+
});
|
|
4789
5515
|
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
while (1) switch (_context.prev = _context.next) {
|
|
4808
|
-
case 0:
|
|
4809
|
-
if (!action) {
|
|
4810
|
-
_context.next = 7;
|
|
4811
|
-
break;
|
|
4812
|
-
}
|
|
4813
|
-
_context.next = 3;
|
|
4814
|
-
return deleteThingThen(action);
|
|
4815
|
-
case 3:
|
|
4816
|
-
action = null;
|
|
4817
|
-
setColor();
|
|
4818
|
-
_context.next = 25;
|
|
4819
|
-
break;
|
|
4820
|
-
case 7:
|
|
4821
|
-
// no action
|
|
4822
|
-
action = widgets.newThing(doc);
|
|
4823
|
-
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)];
|
|
4824
|
-
_context.next = 11;
|
|
4825
|
-
return _solidLogic.store.updater.update([], insertMe);
|
|
4826
|
-
case 11:
|
|
4827
|
-
setColor();
|
|
4828
|
-
if (!mutuallyExclusive) {
|
|
4829
|
-
_context.next = 25;
|
|
4830
|
-
break;
|
|
4831
|
-
}
|
|
4832
|
-
// Delete incompative sentiments
|
|
4833
|
-
dirty = false;
|
|
4834
|
-
i = 0;
|
|
4835
|
-
case 15:
|
|
4836
|
-
if (!(i < mutuallyExclusive.length)) {
|
|
4837
|
-
_context.next = 24;
|
|
4838
|
-
break;
|
|
4839
|
-
}
|
|
4840
|
-
a = existingAction(mutuallyExclusive[i]);
|
|
4841
|
-
if (!a) {
|
|
4842
|
-
_context.next = 21;
|
|
4843
|
-
break;
|
|
4844
|
-
}
|
|
4845
|
-
_context.next = 20;
|
|
4846
|
-
return deleteThingThen(a);
|
|
4847
|
-
case 20:
|
|
4848
|
-
// but how refresh? refreshTree the parent?
|
|
4849
|
-
dirty = true;
|
|
4850
|
-
case 21:
|
|
4851
|
-
i++;
|
|
4852
|
-
_context.next = 15;
|
|
4853
|
-
break;
|
|
4854
|
-
case 24:
|
|
4855
|
-
if (dirty) {
|
|
4856
|
-
// widgets.refreshTree(button.parentNode) // requires them all to be immediate siblings
|
|
4857
|
-
widgets.refreshTree(messageRow); // requires them all to be immediate siblings
|
|
4858
|
-
}
|
|
4859
|
-
case 25:
|
|
4860
|
-
case "end":
|
|
4861
|
-
return _context.stop();
|
|
5516
|
+
/** Button to allow user to express a sentiment (like, endorse, etc) about a target
|
|
5517
|
+
*
|
|
5518
|
+
* @param context {Object} - Provide dom and me
|
|
5519
|
+
* @param target {NamedNode} - The thing the user expresses an opnion about
|
|
5520
|
+
* @param icon {uristring} - The icon to be used for the button
|
|
5521
|
+
* @param actionClass {NamedNode} - The RDF class - typically a subclass of schema:Action
|
|
5522
|
+
* @param doc - {NamedNode} - the Solid document iunto which the data should be written
|
|
5523
|
+
* @param mutuallyExclusive {Array<NamedNode>} - Any RDF classes of sentimentswhich are mutiually exclusive
|
|
5524
|
+
*/
|
|
5525
|
+
|
|
5526
|
+
// THUMBS_UP_ICON
|
|
5527
|
+
// https://schema.org/AgreeAction
|
|
5528
|
+
me = _solidLogic.authn.currentUser(); // If already logged on
|
|
5529
|
+
_context10.t2 = me;
|
|
5530
|
+
if (!_context10.t2) {
|
|
5531
|
+
_context10.next = 28;
|
|
5532
|
+
break;
|
|
4862
5533
|
}
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
// THUMBS_UP_ICON
|
|
4888
|
-
// https://schema.org/AgreeAction
|
|
4889
|
-
me = _solidLogic.authn.currentUser(); // If already logged on
|
|
4890
|
-
// debug.log('Actions 3' + mostRecentVersion(message).value + ' ' + ns.schema('dateDeleted').value + ' ' + (mostRecentVersion(message).value !== ns.schema('dateDeleted').value))
|
|
5534
|
+
_context10.next = 25;
|
|
5535
|
+
return (0, _chatLogic.mostRecentVersion)(message).value;
|
|
5536
|
+
case 25:
|
|
5537
|
+
_context10.t3 = _context10.sent;
|
|
5538
|
+
_context10.t4 = ns.schema('dateDeleted').value;
|
|
5539
|
+
_context10.t2 = _context10.t3 !== _context10.t4;
|
|
5540
|
+
case 28:
|
|
5541
|
+
if (!_context10.t2) {
|
|
5542
|
+
_context10.next = 32;
|
|
5543
|
+
break;
|
|
5544
|
+
}
|
|
5545
|
+
context1 = {
|
|
5546
|
+
me: me,
|
|
5547
|
+
dom: dom,
|
|
5548
|
+
div: div
|
|
5549
|
+
};
|
|
5550
|
+
div.appendChild(sentimentButton(context1, message,
|
|
5551
|
+
// @@ TODO use widgets.sentimentButton
|
|
5552
|
+
_iconBase.icons.iconBase + THUMBS_UP_ICON, ns.schema('AgreeAction'), message.doc(), [ns.schema('DisagreeAction')]));
|
|
5553
|
+
// Thumbs down
|
|
5554
|
+
div.appendChild(sentimentButton(context1, message, _iconBase.icons.iconBase + THUMBS_DOWN_ICON, ns.schema('DisagreeAction'), message.doc(), [ns.schema('AgreeAction')]));
|
|
5555
|
+
case 32:
|
|
5556
|
+
// Reply buttton
|
|
4891
5557
|
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
5558
|
+
if (_solidLogic.store.any(message, ns.dct('created'))) {
|
|
5559
|
+
// Looks like a messsage? Bar can be used for other things
|
|
5560
|
+
div.appendChild(widgets.button(dom, _iconBase.icons.iconBase + REPLY_ICON, 'Reply in thread', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
|
|
5561
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
5562
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
5563
|
+
case 0:
|
|
5564
|
+
_context5.next = 2;
|
|
5565
|
+
return replyInThread();
|
|
5566
|
+
case 2:
|
|
5567
|
+
case "end":
|
|
5568
|
+
return _context5.stop();
|
|
5569
|
+
}
|
|
5570
|
+
}, _callee5);
|
|
5571
|
+
}))));
|
|
5572
|
+
}
|
|
5573
|
+
// X button to remove the tool UI itself
|
|
5574
|
+
cancelButton = div.appendChild(widgets.cancelButton(dom));
|
|
5575
|
+
cancelButton.style["float"] = 'right';
|
|
5576
|
+
cancelButton.firstChild.style.opacity = '0.3';
|
|
5577
|
+
cancelButton.addEventListener('click', closeToolbar);
|
|
5578
|
+
return _context10.abrupt("return", div);
|
|
5579
|
+
case 38:
|
|
5580
|
+
case "end":
|
|
5581
|
+
return _context10.stop();
|
|
5582
|
+
}
|
|
5583
|
+
}, _callee10);
|
|
5584
|
+
}));
|
|
5585
|
+
return _messageToolbar.apply(this, arguments);
|
|
4910
5586
|
}
|
|
4911
5587
|
//# sourceMappingURL=messageTools.js.map
|
|
4912
5588
|
|
|
@@ -7170,6 +7846,8 @@ function renderSignInPopup(dom) {
|
|
|
7170
7846
|
while (1) switch (_context.prev = _context.next) {
|
|
7171
7847
|
case 0:
|
|
7172
7848
|
_context.prev = 0;
|
|
7849
|
+
// clear authorization metadata from store
|
|
7850
|
+
_solidLogic.solidLogicSingleton.store.updater.flagAuthorizationMetadata();
|
|
7173
7851
|
// Save hash
|
|
7174
7852
|
preLoginRedirectHash = new URL(window.location.href).hash;
|
|
7175
7853
|
if (preLoginRedirectHash) {
|
|
@@ -7179,23 +7857,23 @@ function renderSignInPopup(dom) {
|
|
|
7179
7857
|
// Login
|
|
7180
7858
|
locationUrl = new URL(window.location.href);
|
|
7181
7859
|
locationUrl.hash = ''; // remove hash part
|
|
7182
|
-
_context.next =
|
|
7860
|
+
_context.next = 9;
|
|
7183
7861
|
return _solidLogic.authSession.login({
|
|
7184
7862
|
redirectUrl: locationUrl.href,
|
|
7185
7863
|
oidcIssuer: issuerUri
|
|
7186
7864
|
});
|
|
7187
|
-
case
|
|
7188
|
-
_context.next =
|
|
7865
|
+
case 9:
|
|
7866
|
+
_context.next = 14;
|
|
7189
7867
|
break;
|
|
7190
|
-
case
|
|
7191
|
-
_context.prev =
|
|
7868
|
+
case 11:
|
|
7869
|
+
_context.prev = 11;
|
|
7192
7870
|
_context.t0 = _context["catch"](0);
|
|
7193
7871
|
(0, _log.alert)(_context.t0.message);
|
|
7194
|
-
case
|
|
7872
|
+
case 14:
|
|
7195
7873
|
case "end":
|
|
7196
7874
|
return _context.stop();
|
|
7197
7875
|
}
|
|
7198
|
-
}, _callee, null, [[0,
|
|
7876
|
+
}, _callee, null, [[0, 11]]);
|
|
7199
7877
|
}));
|
|
7200
7878
|
return function loginToIssuer(_x11) {
|
|
7201
7879
|
return _ref.apply(this, arguments);
|
|
@@ -7347,45 +8025,47 @@ _solidLogic.authSession.onLogout( /*#__PURE__*/(0, _asyncToGenerator2["default"]
|
|
|
7347
8025
|
case 0:
|
|
7348
8026
|
issuer = window.localStorage.getItem('loginIssuer');
|
|
7349
8027
|
if (!issuer) {
|
|
7350
|
-
_context2.next =
|
|
8028
|
+
_context2.next = 20;
|
|
7351
8029
|
break;
|
|
7352
8030
|
}
|
|
7353
8031
|
_context2.prev = 2;
|
|
8032
|
+
// clear authorization metadata from store
|
|
8033
|
+
_solidLogic.solidLogicSingleton.store.updater.flagAuthorizationMetadata();
|
|
7354
8034
|
wellKnownUri = new URL(issuer);
|
|
7355
8035
|
wellKnownUri.pathname = '/.well-known/openid-configuration';
|
|
7356
|
-
_context2.next =
|
|
8036
|
+
_context2.next = 8;
|
|
7357
8037
|
return fetch(wellKnownUri.toString());
|
|
7358
|
-
case
|
|
8038
|
+
case 8:
|
|
7359
8039
|
wellKnownResult = _context2.sent;
|
|
7360
8040
|
if (!(wellKnownResult.status === 200)) {
|
|
7361
|
-
_context2.next =
|
|
8041
|
+
_context2.next = 16;
|
|
7362
8042
|
break;
|
|
7363
8043
|
}
|
|
7364
|
-
_context2.next =
|
|
8044
|
+
_context2.next = 12;
|
|
7365
8045
|
return wellKnownResult.json();
|
|
7366
|
-
case
|
|
8046
|
+
case 12:
|
|
7367
8047
|
openidConfiguration = _context2.sent;
|
|
7368
8048
|
if (!(openidConfiguration && openidConfiguration.end_session_endpoint)) {
|
|
7369
|
-
_context2.next =
|
|
8049
|
+
_context2.next = 16;
|
|
7370
8050
|
break;
|
|
7371
8051
|
}
|
|
7372
|
-
_context2.next =
|
|
8052
|
+
_context2.next = 16;
|
|
7373
8053
|
return fetch(openidConfiguration.end_session_endpoint, {
|
|
7374
8054
|
credentials: 'include'
|
|
7375
8055
|
});
|
|
7376
|
-
case
|
|
7377
|
-
_context2.next =
|
|
8056
|
+
case 16:
|
|
8057
|
+
_context2.next = 20;
|
|
7378
8058
|
break;
|
|
7379
|
-
case
|
|
7380
|
-
_context2.prev =
|
|
8059
|
+
case 18:
|
|
8060
|
+
_context2.prev = 18;
|
|
7381
8061
|
_context2.t0 = _context2["catch"](2);
|
|
7382
|
-
case 19:
|
|
7383
|
-
window.location.reload();
|
|
7384
8062
|
case 20:
|
|
8063
|
+
window.location.reload();
|
|
8064
|
+
case 21:
|
|
7385
8065
|
case "end":
|
|
7386
8066
|
return _context2.stop();
|
|
7387
8067
|
}
|
|
7388
|
-
}, _callee2, null, [[2,
|
|
8068
|
+
}, _callee2, null, [[2, 18]]);
|
|
7389
8069
|
})));
|
|
7390
8070
|
|
|
7391
8071
|
/**
|
|
@@ -9742,6 +10422,10 @@ function recordSharedPreferences(subject, context) {
|
|
|
9742
10422
|
return new Promise(function (resolve, reject) {
|
|
9743
10423
|
var sharedPreferences = kb.any(subject, ns.ui('sharedPreferences'));
|
|
9744
10424
|
if (!sharedPreferences) {
|
|
10425
|
+
if (!kb.updater.editable(subject.doc())) {
|
|
10426
|
+
debug.log(" Cant make shared preferences, may not change ".concat(subject.doc));
|
|
10427
|
+
resolve(context);
|
|
10428
|
+
}
|
|
9745
10429
|
var sp = $rdf.sym(subject.doc().uri + '#SharedPreferences');
|
|
9746
10430
|
var ins = [$rdf.st(subject, ns.ui('sharedPreferences'), sp, subject.doc())];
|
|
9747
10431
|
debug.log('Creating shared preferences ' + sp);
|
|
@@ -13131,17 +13815,17 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
13131
13815
|
}));
|
|
13132
13816
|
exports.versionInfo = void 0;
|
|
13133
13817
|
var versionInfo = {
|
|
13134
|
-
buildTime: '2023-
|
|
13135
|
-
commit: '
|
|
13818
|
+
buildTime: '2023-04-10T18:29:52Z',
|
|
13819
|
+
commit: '36cc321da5a04039f89414499f819c15590438d4',
|
|
13136
13820
|
npmInfo: {
|
|
13137
13821
|
'solid-ui': '2.4.27',
|
|
13138
13822
|
npm: '8.19.4',
|
|
13139
|
-
node: '16.
|
|
13140
|
-
v8: '9.4.146.26-node.
|
|
13823
|
+
node: '16.20.0',
|
|
13824
|
+
v8: '9.4.146.26-node.26',
|
|
13141
13825
|
uv: '1.43.0',
|
|
13142
13826
|
zlib: '1.2.11',
|
|
13143
13827
|
brotli: '1.0.9',
|
|
13144
|
-
ares: '1.
|
|
13828
|
+
ares: '1.19.0',
|
|
13145
13829
|
modules: '93',
|
|
13146
13830
|
nghttp2: '1.47.0',
|
|
13147
13831
|
napi: '8',
|
|
@@ -15683,7 +16367,7 @@ _fieldFunction.field[ns.ui('Classifier').uri] = function (dom, container, alread
|
|
|
15683
16367
|
** <select id=dropDownSelect>
|
|
15684
16368
|
** <option> ....
|
|
15685
16369
|
** <subForm>
|
|
15686
|
-
** Alternative implementatons
|
|
16370
|
+
** Alternative implementatons could be:
|
|
15687
16371
|
** -- pop-up menu (as here)
|
|
15688
16372
|
** -- radio buttons
|
|
15689
16373
|
** -- auto-complete typing
|
|
@@ -15724,11 +16408,11 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
15724
16408
|
subForm: subForm,
|
|
15725
16409
|
disambiguate: false
|
|
15726
16410
|
};
|
|
15727
|
-
function getSelectorOptions() {
|
|
16411
|
+
function getSelectorOptions(dataSource) {
|
|
15728
16412
|
var possible = [];
|
|
15729
16413
|
var possibleProperties;
|
|
15730
16414
|
possible = kb.each(undefined, ns.rdf('type'), uiFrom, formDoc);
|
|
15731
|
-
for (var x in findMembersNT(kb, uiFrom,
|
|
16415
|
+
for (var x in findMembersNT(kb, uiFrom, dataSource)) {
|
|
15732
16416
|
possible.push(kb.fromNT(x));
|
|
15733
16417
|
} // Use rdfs
|
|
15734
16418
|
|
|
@@ -15760,6 +16444,10 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
15760
16444
|
|
|
15761
16445
|
var multiSelect = kb.any(form, ui('multiselect')); // Optional
|
|
15762
16446
|
if (multiSelect) opts.multiSelect = true;
|
|
16447
|
+
|
|
16448
|
+
// by default searches the dataDoc graph or optionally the full store
|
|
16449
|
+
var dataSource = kb.any(form, ui('search-full-store')).length ? null : dataDoc; // optional
|
|
16450
|
+
|
|
15763
16451
|
var selector;
|
|
15764
16452
|
rhs.refresh = function () {
|
|
15765
16453
|
// from ui:property
|
|
@@ -15767,7 +16455,7 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
15767
16455
|
return object.value;
|
|
15768
16456
|
});
|
|
15769
16457
|
// from ui:from + ui:property
|
|
15770
|
-
var possibleOptions = getSelectorOptions();
|
|
16458
|
+
var possibleOptions = getSelectorOptions(dataSource);
|
|
15771
16459
|
possibleOptions.push(selectedOptions);
|
|
15772
16460
|
possibleOptions = sortByLabel(possibleOptions);
|
|
15773
16461
|
selector = makeSelectForChoice(dom, rhs, kb, subject, property, possibleOptions, selectedOptions, uiFrom, opts, dataDoc, callbackFunction);
|
|
@@ -53604,7 +54292,9 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
53604
54292
|
if (!this._fetch) {
|
|
53605
54293
|
throw new Error('No _fetch function available for Fetcher');
|
|
53606
54294
|
}
|
|
53607
|
-
|
|
54295
|
+
// This is the name of the graph we store all the HTTP metadata in
|
|
54296
|
+
this.appNode = this.store.sym('chrome://TheCurrentSession');
|
|
54297
|
+
// this.appNode = this.store.rdfFactory.blankNode() // Needs to have a URI in tests
|
|
53608
54298
|
this.store.fetcher = this; // Bi-linked
|
|
53609
54299
|
this.requested = {};
|
|
53610
54300
|
this.timeouts = {};
|
|
@@ -54436,17 +55126,19 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
54436
55126
|
var _this10 = this;
|
|
54437
55127
|
var kb = this.store;
|
|
54438
55128
|
var responseNode = kb.bnode();
|
|
54439
|
-
kb.add(options.req, this.ns.link('response'), responseNode,
|
|
54440
|
-
kb.add(responseNode, this.ns.http('status'), kb.rdfFactory.literal(response.status),
|
|
54441
|
-
kb.add(responseNode, this.ns.http('statusText'), kb.rdfFactory.literal(response.statusText),
|
|
55129
|
+
kb.add(options.req, this.ns.link('response'), responseNode, this.appNode);
|
|
55130
|
+
kb.add(responseNode, this.ns.http('status'), kb.rdfFactory.literal(response.status), this.appNode);
|
|
55131
|
+
kb.add(responseNode, this.ns.http('statusText'), kb.rdfFactory.literal(response.statusText), this.appNode);
|
|
54442
55132
|
|
|
54443
55133
|
// Save the response headers
|
|
54444
55134
|
response.headers.forEach(function (value, header) {
|
|
54445
|
-
kb.add(responseNode, _this10.ns.httph(header), _this10.store.rdfFactory.literal(value),
|
|
55135
|
+
kb.add(responseNode, _this10.ns.httph(header), _this10.store.rdfFactory.literal(value), _this10.appNode);
|
|
54446
55136
|
if (header === 'content-type') {
|
|
54447
|
-
kb.add(options.resource, _this10.ns.rdf('type'), kb.rdfFactory.namedNode(_utils_js__WEBPACK_IMPORTED_MODULE_11__.mediaTypeClass(value).value), responseNode
|
|
55137
|
+
kb.add(options.resource, _this10.ns.rdf('type'), kb.rdfFactory.namedNode(_utils_js__WEBPACK_IMPORTED_MODULE_11__.mediaTypeClass(value).value), _this10.appNode // responseNode
|
|
55138
|
+
);
|
|
54448
55139
|
}
|
|
54449
55140
|
});
|
|
55141
|
+
|
|
54450
55142
|
return responseNode;
|
|
54451
55143
|
}
|
|
54452
55144
|
}, {
|
|
@@ -64245,17 +64937,22 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
64245
64937
|
/* harmony export */ "default": () => (/* binding */ UpdateManager)
|
|
64246
64938
|
/* harmony export */ });
|
|
64247
64939
|
/* 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");
|
|
64248
|
-
/* harmony import */ var
|
|
64249
|
-
/* harmony import */ var
|
|
64250
|
-
/* harmony import */ var
|
|
64251
|
-
/* harmony import */ var
|
|
64252
|
-
/* harmony import */ var
|
|
64253
|
-
/* harmony import */ var
|
|
64254
|
-
/* harmony import */ var
|
|
64255
|
-
/* harmony import */ var
|
|
64256
|
-
/* harmony import */ var
|
|
64257
|
-
/* harmony import */ var
|
|
64258
|
-
/* harmony import */ var
|
|
64940
|
+
/* 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");
|
|
64941
|
+
/* 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");
|
|
64942
|
+
/* 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");
|
|
64943
|
+
/* 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");
|
|
64944
|
+
/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js");
|
|
64945
|
+
/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5__);
|
|
64946
|
+
/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./store */ "./node_modules/rdflib/esm/store.js");
|
|
64947
|
+
/* harmony import */ var _uri__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./uri */ "./node_modules/rdflib/esm/uri.js");
|
|
64948
|
+
/* harmony import */ var _fetcher__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./fetcher */ "./node_modules/rdflib/esm/fetcher.js");
|
|
64949
|
+
/* harmony import */ var _namespace__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./namespace */ "./node_modules/rdflib/esm/namespace.js");
|
|
64950
|
+
/* harmony import */ var _serializer__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./serializer */ "./node_modules/rdflib/esm/serializer.js");
|
|
64951
|
+
/* harmony import */ var _utils_terms__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./utils/terms */ "./node_modules/rdflib/esm/utils/terms.js");
|
|
64952
|
+
/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./utils-js */ "./node_modules/rdflib/esm/utils-js.js");
|
|
64953
|
+
/* harmony import */ var _utils_termValue__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./utils/termValue */ "./node_modules/rdflib/esm/utils/termValue.js");
|
|
64954
|
+
|
|
64955
|
+
|
|
64259
64956
|
|
|
64260
64957
|
|
|
64261
64958
|
|
|
@@ -64292,35 +64989,35 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
64292
64989
|
* @param store - The quadstore to store data and metadata. Created if not passed.
|
|
64293
64990
|
*/
|
|
64294
64991
|
function UpdateManager(store) {
|
|
64295
|
-
(0,
|
|
64296
|
-
(0,
|
|
64297
|
-
(0,
|
|
64298
|
-
(0,
|
|
64299
|
-
(0,
|
|
64300
|
-
(0,
|
|
64301
|
-
store = store || new
|
|
64992
|
+
(0,_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_2__["default"])(this, UpdateManager);
|
|
64993
|
+
(0,_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_4__["default"])(this, "store", void 0);
|
|
64994
|
+
(0,_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_4__["default"])(this, "ifps", void 0);
|
|
64995
|
+
(0,_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_4__["default"])(this, "fps", void 0);
|
|
64996
|
+
(0,_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_4__["default"])(this, "patchControl", void 0);
|
|
64997
|
+
(0,_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_4__["default"])(this, "ns", void 0);
|
|
64998
|
+
store = store || new _store__WEBPACK_IMPORTED_MODULE_6__["default"]();
|
|
64302
64999
|
if (store.updater) {
|
|
64303
65000
|
throw new Error("You can't have two UpdateManagers for the same store");
|
|
64304
65001
|
}
|
|
64305
65002
|
if (!store.fetcher) {
|
|
64306
|
-
store.fetcher = new
|
|
65003
|
+
store.fetcher = new _fetcher__WEBPACK_IMPORTED_MODULE_7__["default"](store);
|
|
64307
65004
|
}
|
|
64308
65005
|
this.store = store;
|
|
64309
65006
|
store.updater = this;
|
|
64310
65007
|
this.ifps = {};
|
|
64311
65008
|
this.fps = {};
|
|
64312
65009
|
this.ns = {};
|
|
64313
|
-
this.ns.link = (0,
|
|
64314
|
-
this.ns.http = (0,
|
|
64315
|
-
this.ns.httph = (0,
|
|
64316
|
-
this.ns.ldp = (0,
|
|
64317
|
-
this.ns.rdf = (0,
|
|
64318
|
-
this.ns.rdfs = (0,
|
|
64319
|
-
this.ns.rdf = (0,
|
|
64320
|
-
this.ns.owl = (0,
|
|
65010
|
+
this.ns.link = (0,_namespace__WEBPACK_IMPORTED_MODULE_8__["default"])('http://www.w3.org/2007/ont/link#');
|
|
65011
|
+
this.ns.http = (0,_namespace__WEBPACK_IMPORTED_MODULE_8__["default"])('http://www.w3.org/2007/ont/http#');
|
|
65012
|
+
this.ns.httph = (0,_namespace__WEBPACK_IMPORTED_MODULE_8__["default"])('http://www.w3.org/2007/ont/httph#');
|
|
65013
|
+
this.ns.ldp = (0,_namespace__WEBPACK_IMPORTED_MODULE_8__["default"])('http://www.w3.org/ns/ldp#');
|
|
65014
|
+
this.ns.rdf = (0,_namespace__WEBPACK_IMPORTED_MODULE_8__["default"])('http://www.w3.org/1999/02/22-rdf-syntax-ns#');
|
|
65015
|
+
this.ns.rdfs = (0,_namespace__WEBPACK_IMPORTED_MODULE_8__["default"])('http://www.w3.org/2000/01/rdf-schema#');
|
|
65016
|
+
this.ns.rdf = (0,_namespace__WEBPACK_IMPORTED_MODULE_8__["default"])('http://www.w3.org/1999/02/22-rdf-syntax-ns#');
|
|
65017
|
+
this.ns.owl = (0,_namespace__WEBPACK_IMPORTED_MODULE_8__["default"])('http://www.w3.org/2002/07/owl#');
|
|
64321
65018
|
this.patchControl = [];
|
|
64322
65019
|
}
|
|
64323
|
-
(0,
|
|
65020
|
+
(0,_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_3__["default"])(UpdateManager, [{
|
|
64324
65021
|
key: "patchControlFor",
|
|
64325
65022
|
value: function patchControlFor(doc) {
|
|
64326
65023
|
if (!this.patchControl[doc.value]) {
|
|
@@ -64334,13 +65031,87 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
64334
65031
|
return uri.slice(0, 4) === 'http';
|
|
64335
65032
|
}
|
|
64336
65033
|
|
|
65034
|
+
/** Remove from the store HTTP authorization metadata
|
|
65035
|
+
* The editble function below relies on copies we have in the store
|
|
65036
|
+
* of the results of previous HTTP transactions. Howver, when
|
|
65037
|
+
* the user logs in, then that data misrepresents what would happen
|
|
65038
|
+
* if the user tried again.
|
|
65039
|
+
*/
|
|
65040
|
+
}, {
|
|
65041
|
+
key: "flagAuthorizationMetadata",
|
|
65042
|
+
value: function flagAuthorizationMetadata() {
|
|
65043
|
+
var kb = this.store;
|
|
65044
|
+
var meta = kb.fetcher.appNode;
|
|
65045
|
+
var requests = kb.statementsMatching(undefined, this.ns.link('requestedURI'), undefined, meta).map(function (st) {
|
|
65046
|
+
return st.subject;
|
|
65047
|
+
});
|
|
65048
|
+
var _iterator = _createForOfIteratorHelper(requests),
|
|
65049
|
+
_step;
|
|
65050
|
+
try {
|
|
65051
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
65052
|
+
var request = _step.value;
|
|
65053
|
+
var _response = kb.any(request, this.ns.link('response'), null, meta);
|
|
65054
|
+
if (_response !== undefined) {
|
|
65055
|
+
// ts
|
|
65056
|
+
this.store.add(_response, this.ns.link('outOfDate'), true, meta); // @@ Boolean is fine - fix types
|
|
65057
|
+
}
|
|
65058
|
+
}
|
|
65059
|
+
} catch (err) {
|
|
65060
|
+
_iterator.e(err);
|
|
65061
|
+
} finally {
|
|
65062
|
+
_iterator.f();
|
|
65063
|
+
}
|
|
65064
|
+
}
|
|
65065
|
+
|
|
65066
|
+
/**
|
|
65067
|
+
* Tests whether a file is editable.
|
|
65068
|
+
* If the file has a specific annotation that it is machine written,
|
|
65069
|
+
* for safety, it is editable (this doesn't actually check for write access)
|
|
65070
|
+
* If the file has wac-allow and accept patch headers, those are respected.
|
|
65071
|
+
* and local write access is determined by those headers.
|
|
65072
|
+
* This async version not only looks at past HTTP requests, it also makes new ones if necessary.
|
|
65073
|
+
*
|
|
65074
|
+
* @returns The method string SPARQL or DAV or
|
|
65075
|
+
* LOCALFILE or false if known, undefined if not known.
|
|
65076
|
+
*/
|
|
65077
|
+
}, {
|
|
65078
|
+
key: "checkEditable",
|
|
65079
|
+
value: function () {
|
|
65080
|
+
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) {
|
|
65081
|
+
var initial, final;
|
|
65082
|
+
return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_5___default().wrap(function _callee$(_context) {
|
|
65083
|
+
while (1) switch (_context.prev = _context.next) {
|
|
65084
|
+
case 0:
|
|
65085
|
+
initial = this.editable(uri, kb);
|
|
65086
|
+
if (!(initial !== undefined)) {
|
|
65087
|
+
_context.next = 3;
|
|
65088
|
+
break;
|
|
65089
|
+
}
|
|
65090
|
+
return _context.abrupt("return", initial);
|
|
65091
|
+
case 3:
|
|
65092
|
+
_context.next = 5;
|
|
65093
|
+
return this.store.fetcher.load(uri);
|
|
65094
|
+
case 5:
|
|
65095
|
+
final = this.editable(uri, kb); // console.log(`Loaded ${uri} just to check editable, result: ${final}.`)
|
|
65096
|
+
return _context.abrupt("return", final);
|
|
65097
|
+
case 7:
|
|
65098
|
+
case "end":
|
|
65099
|
+
return _context.stop();
|
|
65100
|
+
}
|
|
65101
|
+
}, _callee, this);
|
|
65102
|
+
}));
|
|
65103
|
+
function checkEditable(_x, _x2) {
|
|
65104
|
+
return _checkEditable.apply(this, arguments);
|
|
65105
|
+
}
|
|
65106
|
+
return checkEditable;
|
|
65107
|
+
}()
|
|
64337
65108
|
/**
|
|
64338
65109
|
* Tests whether a file is editable.
|
|
64339
65110
|
* If the file has a specific annotation that it is machine written,
|
|
64340
65111
|
* for safety, it is editable (this doesn't actually check for write access)
|
|
64341
65112
|
* If the file has wac-allow and accept patch headers, those are respected.
|
|
64342
65113
|
* and local write access is determined by those headers.
|
|
64343
|
-
* This version only looks at past HTTP requests, does not make new ones.
|
|
65114
|
+
* This synchronous version only looks at past HTTP requests, does not make new ones.
|
|
64344
65115
|
*
|
|
64345
65116
|
* @returns The method string SPARQL or DAV or
|
|
64346
65117
|
* LOCALFILE or false if known, undefined if not known.
|
|
@@ -64355,29 +65126,36 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
64355
65126
|
if (!kb) {
|
|
64356
65127
|
kb = this.store;
|
|
64357
65128
|
}
|
|
64358
|
-
uri = (0,
|
|
65129
|
+
uri = (0,_utils_termValue__WEBPACK_IMPORTED_MODULE_9__.termValue)(uri);
|
|
64359
65130
|
if (!this.isHttpUri(uri)) {
|
|
64360
|
-
if (
|
|
65131
|
+
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'))) {
|
|
64361
65132
|
return 'LOCALFILE';
|
|
64362
65133
|
}
|
|
64363
65134
|
}
|
|
64364
65135
|
var request;
|
|
64365
65136
|
var definitive = false;
|
|
65137
|
+
var meta = this.store.fetcher.appNode;
|
|
65138
|
+
// const kb = s
|
|
65139
|
+
|
|
64366
65140
|
// @ts-ignore passes a string to kb.each, which expects a term. Should this work?
|
|
64367
|
-
var requests = kb.each(undefined, this.ns.link('requestedURI'), (0,
|
|
65141
|
+
var requests = kb.each(undefined, this.ns.link('requestedURI'), (0,_uri__WEBPACK_IMPORTED_MODULE_10__.docpart)(uri), meta);
|
|
64368
65142
|
var method;
|
|
64369
65143
|
for (var r = 0; r < requests.length; r++) {
|
|
64370
65144
|
request = requests[r];
|
|
64371
65145
|
if (request !== undefined) {
|
|
64372
|
-
var
|
|
64373
|
-
if (
|
|
64374
|
-
|
|
65146
|
+
var _response2 = kb.any(request, this.ns.link('response'), null, meta);
|
|
65147
|
+
if (_response2 !== undefined) {
|
|
65148
|
+
// ts
|
|
65149
|
+
|
|
65150
|
+
var outOfDate = kb.anyJS(_response2, this.ns.link('outOfDate'), null, meta);
|
|
65151
|
+
if (outOfDate) continue;
|
|
65152
|
+
var wacAllow = kb.anyValue(_response2, this.ns.httph('wac-allow'));
|
|
64375
65153
|
if (wacAllow) {
|
|
64376
|
-
var
|
|
64377
|
-
|
|
65154
|
+
var _iterator2 = _createForOfIteratorHelper(wacAllow.split(',')),
|
|
65155
|
+
_step2;
|
|
64378
65156
|
try {
|
|
64379
|
-
for (
|
|
64380
|
-
var bit =
|
|
65157
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
65158
|
+
var bit = _step2.value;
|
|
64381
65159
|
var lr = bit.split('=');
|
|
64382
65160
|
if (lr[0].includes('user') && !lr[1].includes('write') && !lr[1].includes('append')) {
|
|
64383
65161
|
// console.log(' editable? excluded by WAC-Allow: ', wacAllow)
|
|
@@ -64385,12 +65163,12 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
64385
65163
|
}
|
|
64386
65164
|
}
|
|
64387
65165
|
} catch (err) {
|
|
64388
|
-
|
|
65166
|
+
_iterator2.e(err);
|
|
64389
65167
|
} finally {
|
|
64390
|
-
|
|
65168
|
+
_iterator2.f();
|
|
64391
65169
|
}
|
|
64392
65170
|
}
|
|
64393
|
-
var acceptPatch = kb.each(
|
|
65171
|
+
var acceptPatch = kb.each(_response2, this.ns.httph('accept-patch'));
|
|
64394
65172
|
if (acceptPatch.length) {
|
|
64395
65173
|
for (var i = 0; i < acceptPatch.length; i++) {
|
|
64396
65174
|
method = acceptPatch[i].value.trim();
|
|
@@ -64398,7 +65176,7 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
64398
65176
|
if (method.indexOf('application/sparql-update-single-match') >= 0) return 'SPARQL';
|
|
64399
65177
|
}
|
|
64400
65178
|
}
|
|
64401
|
-
var authorVia = kb.each(
|
|
65179
|
+
var authorVia = kb.each(_response2, this.ns.httph('ms-author-via'));
|
|
64402
65180
|
if (authorVia.length) {
|
|
64403
65181
|
for (var _i = 0; _i < authorVia.length; _i++) {
|
|
64404
65182
|
method = authorVia[_i].value.trim();
|
|
@@ -64413,7 +65191,7 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
64413
65191
|
if (!this.isHttpUri(uri)) {
|
|
64414
65192
|
if (!wacAllow) return false;else return 'LOCALFILE';
|
|
64415
65193
|
}
|
|
64416
|
-
var status = kb.each(
|
|
65194
|
+
var status = kb.each(_response2, this.ns.http('status'));
|
|
64417
65195
|
if (status.length) {
|
|
64418
65196
|
for (var _i2 = 0; _i2 < status.length; _i2++) {
|
|
64419
65197
|
// @ts-ignore since statuses should be TFTerms, this should always be false
|
|
@@ -64462,7 +65240,7 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
64462
65240
|
key: "statementBnodes",
|
|
64463
65241
|
value: function statementBnodes(st) {
|
|
64464
65242
|
return [st.subject, st.predicate, st.object].filter(function (x) {
|
|
64465
|
-
return (0,
|
|
65243
|
+
return (0,_utils_terms__WEBPACK_IMPORTED_MODULE_11__.isBlankNode)(x);
|
|
64466
65244
|
});
|
|
64467
65245
|
}
|
|
64468
65246
|
|
|
@@ -64857,7 +65635,7 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
64857
65635
|
// console.log('Server does not support live updates through Updates-Via :-(')
|
|
64858
65636
|
return false;
|
|
64859
65637
|
}
|
|
64860
|
-
wssURI = (0,
|
|
65638
|
+
wssURI = (0,_uri__WEBPACK_IMPORTED_MODULE_10__.join)(wssURI, doc.value);
|
|
64861
65639
|
var validWssURI = wssURI.replace(/^http:/, 'ws:').replace(/^https:/, 'wss:');
|
|
64862
65640
|
// console.log('Web socket URI ' + wssURI)
|
|
64863
65641
|
|
|
@@ -64997,8 +65775,8 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
64997
65775
|
|
|
64998
65776
|
try {
|
|
64999
65777
|
var kb = this.store;
|
|
65000
|
-
var ds = !deletions ? [] : (0,
|
|
65001
|
-
var is = !insertions ? [] : (0,
|
|
65778
|
+
var ds = !deletions ? [] : (0,_utils_terms__WEBPACK_IMPORTED_MODULE_11__.isStore)(deletions) ? deletions.statements : deletions instanceof Array ? deletions : [deletions];
|
|
65779
|
+
var is = !insertions ? [] : (0,_utils_terms__WEBPACK_IMPORTED_MODULE_11__.isStore)(insertions) ? insertions.statements : insertions instanceof Array ? insertions : [insertions];
|
|
65002
65780
|
if (!(ds instanceof Array)) {
|
|
65003
65781
|
throw new Error('Type Error ' + (0,_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__["default"])(ds) + ': ' + ds);
|
|
65004
65782
|
}
|
|
@@ -65155,7 +65933,7 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
65155
65933
|
}
|
|
65156
65934
|
}
|
|
65157
65935
|
} catch (e) {
|
|
65158
|
-
callback(undefined, false, 'Exception in update: ' + e + '\n' +
|
|
65936
|
+
callback(undefined, false, 'Exception in update: ' + e + '\n' + _utils_js__WEBPACK_IMPORTED_MODULE_12__.stackString(e));
|
|
65159
65937
|
}
|
|
65160
65938
|
}
|
|
65161
65939
|
}, {
|
|
@@ -65178,7 +65956,7 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
65178
65956
|
// prepare contents of revised document
|
|
65179
65957
|
var newSts = kb.statementsMatching(undefined, undefined, undefined, doc).slice(); // copy!
|
|
65180
65958
|
for (var i = 0; i < ds.length; i++) {
|
|
65181
|
-
|
|
65959
|
+
_utils_js__WEBPACK_IMPORTED_MODULE_12__.RDFArrayRemove(newSts, ds[i]);
|
|
65182
65960
|
}
|
|
65183
65961
|
for (var _i9 = 0; _i9 < is.length; _i9++) {
|
|
65184
65962
|
newSts.push(is[_i9]);
|
|
@@ -65189,7 +65967,7 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
65189
65967
|
var candidateTarget = kb.the(response, this.ns.httph('content-location'));
|
|
65190
65968
|
var targetURI;
|
|
65191
65969
|
if (candidateTarget) {
|
|
65192
|
-
targetURI = (0,
|
|
65970
|
+
targetURI = (0,_uri__WEBPACK_IMPORTED_MODULE_10__.join)(candidateTarget.value, targetURI);
|
|
65193
65971
|
}
|
|
65194
65972
|
options.contentType = contentType;
|
|
65195
65973
|
options.noMeta = true;
|
|
@@ -65230,7 +66008,7 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
65230
66008
|
var newSts = kb.statementsMatching(undefined, undefined, undefined, doc).slice(); // copy!
|
|
65231
66009
|
|
|
65232
66010
|
for (var i = 0; i < ds.length; i++) {
|
|
65233
|
-
|
|
66011
|
+
_utils_js__WEBPACK_IMPORTED_MODULE_12__.RDFArrayRemove(newSts, ds[i]);
|
|
65234
66012
|
}
|
|
65235
66013
|
for (var _i12 = 0; _i12 < is.length; _i12++) {
|
|
65236
66014
|
newSts.push(is[_i12]);
|
|
@@ -65241,7 +66019,7 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
65241
66019
|
throw new Error('Rewriting file: No filename extension: ' + doc.value);
|
|
65242
66020
|
}
|
|
65243
66021
|
var ext = doc.value.slice(dot + 1);
|
|
65244
|
-
var contentType =
|
|
66022
|
+
var contentType = _fetcher__WEBPACK_IMPORTED_MODULE_7__["default"].CONTENT_TYPE_BY_EXT[ext];
|
|
65245
66023
|
if (!contentType) {
|
|
65246
66024
|
throw new Error('File extension .' + ext + ' not supported for data write');
|
|
65247
66025
|
}
|
|
@@ -65274,7 +66052,7 @@ var UpdateManager = /*#__PURE__*/function () {
|
|
|
65274
66052
|
}
|
|
65275
66053
|
|
|
65276
66054
|
// serialize to the appropriate format
|
|
65277
|
-
var sz = (0,
|
|
66055
|
+
var sz = (0,_serializer__WEBPACK_IMPORTED_MODULE_13__["default"])(kb);
|
|
65278
66056
|
sz.suggestNamespaces(kb.namespaces);
|
|
65279
66057
|
sz.setBase(uri);
|
|
65280
66058
|
switch (contentType) {
|