solid-ui 2.4.26 → 2.4.27-13192548
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.html +1 -9
- package/dist/{main.js → solid-ui.js} +1865 -1101
- package/dist/solid-ui.js.map +1 -0
- package/dist/solid-ui.min.js +3 -0
- package/dist/solid-ui.min.js.LICENSE.txt +117 -0
- package/dist/solid-ui.min.js.map +1 -0
- package/lib/chat/bookmarks.js +6 -7
- package/lib/chat/bookmarks.js.map +1 -1
- package/lib/chat/chatLogic.js +250 -61
- package/lib/chat/chatLogic.js.map +1 -1
- package/lib/chat/infinite.js +604 -426
- package/lib/chat/infinite.js.map +1 -1
- package/lib/chat/message.js +286 -158
- package/lib/chat/message.js.map +1 -1
- package/lib/chat/messageTools.js +464 -276
- package/lib/chat/messageTools.js.map +1 -1
- package/lib/chat/thread.js +166 -144
- package/lib/chat/thread.js.map +1 -1
- package/lib/login/login.d.ts.map +1 -1
- package/lib/login/login.js +30 -24
- 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 +6 -6
- 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 +16 -14
- package/dist/main.js.map +0 -1
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
|
2
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
|
3
|
+
module.exports = factory();
|
|
4
|
+
else if(typeof define === 'function' && define.amd)
|
|
5
|
+
define([], factory);
|
|
6
|
+
else if(typeof exports === 'object')
|
|
7
|
+
exports["solid-ui"] = factory();
|
|
8
|
+
else
|
|
9
|
+
root["solid-ui"] = factory();
|
|
10
|
+
})(self, () => {
|
|
11
|
+
return /******/ (() => { // webpackBootstrap
|
|
2
12
|
/******/ var __webpack_modules__ = ({
|
|
3
13
|
|
|
4
14
|
/***/ "./lib/acl/access-controller.js":
|
|
@@ -2275,8 +2285,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
2275
2285
|
* @packageDocumentation
|
|
2276
2286
|
*/
|
|
2277
2287
|
|
|
2278
|
-
/* global alert confirm */
|
|
2279
|
-
|
|
2280
2288
|
// pull in first avoid cross-refs
|
|
2281
2289
|
|
|
2282
2290
|
var UI = {
|
|
@@ -2369,7 +2377,8 @@ function _findBookmarkDocument() {
|
|
|
2369
2377
|
}
|
|
2370
2378
|
userContext.bookmarkDocument = userContext.instances[0];
|
|
2371
2379
|
if (userContext.instances.length > 1) {
|
|
2372
|
-
|
|
2380
|
+
debug.warn('More than one bookmark file! ' + userContext.instances); // @@ todo - deal with > 1
|
|
2381
|
+
// Note: should pick up community bookmarks as well
|
|
2373
2382
|
}
|
|
2374
2383
|
_context.next = 28;
|
|
2375
2384
|
break;
|
|
@@ -2390,7 +2399,7 @@ function _findBookmarkDocument() {
|
|
|
2390
2399
|
case 18:
|
|
2391
2400
|
_context.prev = 18;
|
|
2392
2401
|
_context.t0 = _context["catch"](12);
|
|
2393
|
-
|
|
2402
|
+
debug.warn("Can't make fresh bookmark file:" + _context.t0);
|
|
2394
2403
|
return _context.abrupt("return", userContext);
|
|
2395
2404
|
case 22:
|
|
2396
2405
|
_context.next = 24;
|
|
@@ -2400,7 +2409,7 @@ function _findBookmarkDocument() {
|
|
|
2400
2409
|
_context.next = 28;
|
|
2401
2410
|
break;
|
|
2402
2411
|
case 27:
|
|
2403
|
-
|
|
2412
|
+
debug.warn('You seem to have no bookmark file and not even a profile file.');
|
|
2404
2413
|
case 28:
|
|
2405
2414
|
return _context.abrupt("return", userContext);
|
|
2406
2415
|
case 29:
|
|
@@ -2455,7 +2464,7 @@ function _addBookmark() {
|
|
|
2455
2464
|
_context2.prev = 14;
|
|
2456
2465
|
_context2.t0 = _context2["catch"](9);
|
|
2457
2466
|
msg = 'Making bookmark: ' + _context2.t0;
|
|
2458
|
-
|
|
2467
|
+
debug.warn(msg);
|
|
2459
2468
|
return _context2.abrupt("return", null);
|
|
2460
2469
|
case 19:
|
|
2461
2470
|
return _context2.abrupt("return", bookmark);
|
|
@@ -2508,7 +2517,7 @@ function _toggleBookmark() {
|
|
|
2508
2517
|
_context3.prev = 15;
|
|
2509
2518
|
_context3.t0 = _context3["catch"](8);
|
|
2510
2519
|
debug.error('Cant delete bookmark:' + _context3.t0);
|
|
2511
|
-
|
|
2520
|
+
debug.warn('Cant delete bookmark:' + _context3.t0);
|
|
2512
2521
|
case 19:
|
|
2513
2522
|
i++;
|
|
2514
2523
|
_context3.next = 7;
|
|
@@ -2603,6 +2612,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
2603
2612
|
}));
|
|
2604
2613
|
exports.ChatChannel = void 0;
|
|
2605
2614
|
exports._createIfNotExists = _createIfNotExists;
|
|
2615
|
+
exports.allVersions = allVersions;
|
|
2606
2616
|
exports.isDeleted = isDeleted;
|
|
2607
2617
|
exports.isHidden = isHidden;
|
|
2608
2618
|
exports.isReplaced = isReplaced;
|
|
@@ -2678,6 +2688,7 @@ var ChatChannel = /*#__PURE__*/function () {
|
|
|
2678
2688
|
var _this = this;
|
|
2679
2689
|
var oldMsg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
2680
2690
|
var deleteIt = arguments.length > 2 ? arguments[2] : undefined;
|
|
2691
|
+
var thread = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
2681
2692
|
return /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
2682
2693
|
var sts, now, timestamp, dateStamp, chatDocument, message, me, msg;
|
|
2683
2694
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
@@ -2690,41 +2701,61 @@ var ChatChannel = /*#__PURE__*/function () {
|
|
|
2690
2701
|
chatDocument = oldMsg ? oldMsg.doc() : _this.dateFolder.leafDocumentFromDate(now);
|
|
2691
2702
|
message = _solidLogic.store.sym(chatDocument.uri + '#' + 'Msg' + timestamp); // const content = store.literal(text)
|
|
2692
2703
|
me = _solidLogic.authn.currentUser(); // If already logged on
|
|
2693
|
-
if (oldMsg) {
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
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));
|
|
2702
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:
|
|
2703
2728
|
sts.push($rdf.st(message, ns.sioc('content'), _solidLogic.store.literal(text), chatDocument));
|
|
2704
2729
|
sts.push($rdf.st(message, ns.dct('created'), dateStamp, chatDocument));
|
|
2705
2730
|
if (me) {
|
|
2706
2731
|
sts.push($rdf.st(message, ns.foaf('maker'), me, chatDocument));
|
|
2707
2732
|
}
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
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;
|
|
2713
2744
|
break;
|
|
2714
|
-
case
|
|
2715
|
-
_context2.prev =
|
|
2716
|
-
_context2.
|
|
2717
|
-
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;
|
|
2718
2749
|
debug.warn(msg);
|
|
2719
2750
|
alert(msg);
|
|
2720
2751
|
throw new Error(msg);
|
|
2721
|
-
case
|
|
2752
|
+
case 37:
|
|
2722
2753
|
return _context2.abrupt("return", message);
|
|
2723
|
-
case
|
|
2754
|
+
case 38:
|
|
2724
2755
|
case "end":
|
|
2725
2756
|
return _context2.stop();
|
|
2726
2757
|
}
|
|
2727
|
-
}, _callee2, null, [[
|
|
2758
|
+
}, _callee2, null, [[26, 31]]);
|
|
2728
2759
|
})();
|
|
2729
2760
|
});
|
|
2730
2761
|
function updateMessage(_x2) {
|
|
@@ -2754,26 +2785,187 @@ var ChatChannel = /*#__PURE__*/function () {
|
|
|
2754
2785
|
return _deleteMessage.apply(this, arguments);
|
|
2755
2786
|
}
|
|
2756
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;
|
|
2757
2823
|
}()
|
|
2758
2824
|
}]);
|
|
2759
2825
|
return ChatChannel;
|
|
2760
2826
|
}(); // class ChatChannel
|
|
2827
|
+
// ////////// Utility functions
|
|
2828
|
+
// Have to not loop forever if fed loops
|
|
2761
2829
|
exports.ChatChannel = ChatChannel;
|
|
2762
|
-
function
|
|
2763
|
-
|
|
2764
|
-
while (msg) {
|
|
2765
|
-
message = msg;
|
|
2766
|
-
msg = _solidLogic.store.any(null, ns.dct('isReplacedBy'), message, message.doc());
|
|
2767
|
-
}
|
|
2768
|
-
return message;
|
|
2830
|
+
function allVersions(_x5) {
|
|
2831
|
+
return _allVersions.apply(this, arguments);
|
|
2769
2832
|
}
|
|
2770
|
-
function
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
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);
|
|
2777
2969
|
}
|
|
2778
2970
|
function isDeleted(message) {
|
|
2779
2971
|
return _solidLogic.store.holds(message, ns.schema('dateDeleted'), null, message.doc());
|
|
@@ -2792,62 +2984,62 @@ function nick(person) {
|
|
|
2792
2984
|
if (s) return '' + s.value;
|
|
2793
2985
|
return '' + utils.label(person);
|
|
2794
2986
|
}
|
|
2795
|
-
function _createIfNotExists(
|
|
2987
|
+
function _createIfNotExists(_x8) {
|
|
2796
2988
|
return _createIfNotExists2.apply(this, arguments);
|
|
2797
2989
|
} // ends
|
|
2798
2990
|
function _createIfNotExists2() {
|
|
2799
2991
|
_createIfNotExists2 = (0, _asyncToGenerator2["default"])(function (doc) {
|
|
2800
2992
|
var contentType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'text/turtle';
|
|
2801
2993
|
var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
2802
|
-
return /*#__PURE__*/_regenerator["default"].mark(function
|
|
2994
|
+
return /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
|
|
2803
2995
|
var response;
|
|
2804
|
-
return _regenerator["default"].wrap(function
|
|
2805
|
-
while (1) switch (
|
|
2996
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
2997
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
2806
2998
|
case 0:
|
|
2807
|
-
|
|
2808
|
-
|
|
2999
|
+
_context8.prev = 0;
|
|
3000
|
+
_context8.next = 3;
|
|
2809
3001
|
return _solidLogic.store.fetcher.load(doc);
|
|
2810
3002
|
case 3:
|
|
2811
|
-
response =
|
|
2812
|
-
|
|
3003
|
+
response = _context8.sent;
|
|
3004
|
+
_context8.next = 26;
|
|
2813
3005
|
break;
|
|
2814
3006
|
case 6:
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
if (!(
|
|
2818
|
-
|
|
3007
|
+
_context8.prev = 6;
|
|
3008
|
+
_context8.t0 = _context8["catch"](0);
|
|
3009
|
+
if (!(_context8.t0.response.status === 404)) {
|
|
3010
|
+
_context8.next = 24;
|
|
2819
3011
|
break;
|
|
2820
3012
|
}
|
|
2821
3013
|
debug.log('createIfNotExists: doc does NOT exist, will create... ' + doc);
|
|
2822
|
-
|
|
2823
|
-
|
|
3014
|
+
_context8.prev = 10;
|
|
3015
|
+
_context8.next = 13;
|
|
2824
3016
|
return _solidLogic.store.fetcher.webOperation('PUT', doc.uri, {
|
|
2825
3017
|
data: data,
|
|
2826
3018
|
contentType: contentType
|
|
2827
3019
|
});
|
|
2828
3020
|
case 13:
|
|
2829
|
-
response =
|
|
2830
|
-
|
|
3021
|
+
response = _context8.sent;
|
|
3022
|
+
_context8.next = 20;
|
|
2831
3023
|
break;
|
|
2832
3024
|
case 16:
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
debug.log('createIfNotExists doc FAILED: ' + doc + ': ' +
|
|
2836
|
-
throw
|
|
3025
|
+
_context8.prev = 16;
|
|
3026
|
+
_context8.t1 = _context8["catch"](10);
|
|
3027
|
+
debug.log('createIfNotExists doc FAILED: ' + doc + ': ' + _context8.t1);
|
|
3028
|
+
throw _context8.t1;
|
|
2837
3029
|
case 20:
|
|
2838
3030
|
delete _solidLogic.store.fetcher.requested[doc.uri]; // delete cached 404 error
|
|
2839
3031
|
// debug.log('createIfNotExists doc created ok ' + doc)
|
|
2840
|
-
return
|
|
3032
|
+
return _context8.abrupt("return", response);
|
|
2841
3033
|
case 24:
|
|
2842
|
-
debug.log('createIfNotExists doc load error NOT 404: ' + doc + ': ' +
|
|
2843
|
-
throw
|
|
3034
|
+
debug.log('createIfNotExists doc load error NOT 404: ' + doc + ': ' + _context8.t0);
|
|
3035
|
+
throw _context8.t0;
|
|
2844
3036
|
case 26:
|
|
2845
|
-
return
|
|
3037
|
+
return _context8.abrupt("return", response);
|
|
2846
3038
|
case 27:
|
|
2847
3039
|
case "end":
|
|
2848
|
-
return
|
|
3040
|
+
return _context8.stop();
|
|
2849
3041
|
}
|
|
2850
|
-
},
|
|
3042
|
+
}, _callee8, null, [[0, 6], [10, 16]]);
|
|
2851
3043
|
})();
|
|
2852
3044
|
});
|
|
2853
3045
|
return _createIfNotExists2.apply(this, arguments);
|
|
@@ -3225,19 +3417,9 @@ var _chatLogic = __webpack_require__(/*! ./chatLogic */ "./lib/chat/chatLogic.js
|
|
|
3225
3417
|
var _message = __webpack_require__(/*! ./message */ "./lib/chat/message.js");
|
|
3226
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); }
|
|
3227
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; }
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
*/
|
|
3232
|
-
// import { findBookmarkDocument } from './bookmarks'
|
|
3233
|
-
// pull in first avoid cross-refs
|
|
3234
|
-
|
|
3235
|
-
// import * as style from '../style'
|
|
3236
|
-
// import * as utils from '../utils'
|
|
3237
|
-
|
|
3238
|
-
// import * as pad from '../pad'
|
|
3239
|
-
// import { DateFolder } from './dateFolder'
|
|
3240
|
-
|
|
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; }
|
|
3241
3423
|
// const UI = { authn, icons, ns, media, pad, $rdf, store, style, utils, widgets }
|
|
3242
3424
|
|
|
3243
3425
|
function desktopNotification(str) {
|
|
@@ -3265,34 +3447,9 @@ function desktopNotification(str) {
|
|
|
3265
3447
|
/**
|
|
3266
3448
|
* Renders a chat message inside a `messageTable`
|
|
3267
3449
|
*/
|
|
3268
|
-
function insertMessageIntoTable(
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
// const message = messageRow.AJAR_subject
|
|
3272
|
-
if (options.selectedMessage && options.selectedMessage.sameTerm(message)) {
|
|
3273
|
-
messageRow.style.backgroundColor = 'yellow';
|
|
3274
|
-
options.selectedElement = messageRow;
|
|
3275
|
-
messageTable.selectedElement = messageRow;
|
|
3276
|
-
}
|
|
3277
|
-
var done = false;
|
|
3278
|
-
for (var ele = messageTable.firstChild;; ele = ele.nextSibling) {
|
|
3279
|
-
if (!ele) {
|
|
3280
|
-
// empty
|
|
3281
|
-
break;
|
|
3282
|
-
}
|
|
3283
|
-
var newestFirst = options.newestfirst === true;
|
|
3284
|
-
var dateString = messageRow.AJAR_date;
|
|
3285
|
-
if (dateString > ele.AJAR_date && newestFirst || dateString < ele.AJAR_date && !newestFirst) {
|
|
3286
|
-
messageTable.insertBefore(messageRow, ele);
|
|
3287
|
-
done = true;
|
|
3288
|
-
break;
|
|
3289
|
-
}
|
|
3290
|
-
}
|
|
3291
|
-
if (!done) {
|
|
3292
|
-
messageTable.appendChild(messageRow);
|
|
3293
|
-
}
|
|
3450
|
+
function insertMessageIntoTable(_x, _x2, _x3, _x4, _x5, _x6) {
|
|
3451
|
+
return _insertMessageIntoTable.apply(this, arguments);
|
|
3294
3452
|
}
|
|
3295
|
-
|
|
3296
3453
|
/**
|
|
3297
3454
|
* Common code for a chat (discussion area of messages about something)
|
|
3298
3455
|
* This version runs over a series of files for different time periods
|
|
@@ -3315,20 +3472,70 @@ function insertMessageIntoTable(channelObject, messageTable, message, fresh, opt
|
|
|
3315
3472
|
- inlineImageHeightEms: The height (in ems) of images expaned from their URIs in the chat.
|
|
3316
3473
|
|
|
3317
3474
|
*/
|
|
3318
|
-
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) {
|
|
3319
3526
|
return _infiniteMessageArea.apply(this, arguments);
|
|
3320
3527
|
}
|
|
3321
3528
|
function _infiniteMessageArea() {
|
|
3322
|
-
_infiniteMessageArea = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3323
|
-
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;
|
|
3324
|
-
return _regenerator["default"].wrap(function
|
|
3325
|
-
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) {
|
|
3326
3533
|
case 0:
|
|
3327
3534
|
_loadInitialContent = function _loadInitialContent3() {
|
|
3328
|
-
_loadInitialContent = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3329
|
-
var yank, fixScroll, live, selectedDocument, now, todayDocument, selectedMessageTable, selectedDate;
|
|
3330
|
-
return _regenerator["default"].wrap(function
|
|
3331
|
-
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) {
|
|
3332
3539
|
case 0:
|
|
3333
3540
|
fixScroll = function _fixScroll() {
|
|
3334
3541
|
if (options.selectedElement) {
|
|
@@ -3342,51 +3549,59 @@ function _infiniteMessageArea() {
|
|
|
3342
3549
|
}
|
|
3343
3550
|
};
|
|
3344
3551
|
yank = function _yank() {
|
|
3345
|
-
selectedMessageTable.selectedElement
|
|
3346
|
-
|
|
3347
|
-
|
|
3552
|
+
if (selectedMessageTable && selectedMessageTable.selectedElement) {
|
|
3553
|
+
selectedMessageTable.selectedElement.scrollIntoView({
|
|
3554
|
+
block: 'center'
|
|
3555
|
+
});
|
|
3556
|
+
}
|
|
3348
3557
|
};
|
|
3349
3558
|
if (options.selectedMessage) {
|
|
3350
3559
|
selectedDocument = options.selectedMessage.doc();
|
|
3560
|
+
}
|
|
3561
|
+
if (threadRootMessage) {
|
|
3562
|
+
threadRootDocument = threadRootMessage.doc();
|
|
3563
|
+
}
|
|
3564
|
+
initialDocment = selectedDocument || threadRootDocument;
|
|
3565
|
+
if (initialDocment) {
|
|
3351
3566
|
now = new Date();
|
|
3352
3567
|
todayDocument = dateFolder.leafDocumentFromDate(now);
|
|
3353
|
-
live = todayDocument.sameTerm(
|
|
3568
|
+
live = todayDocument.sameTerm(initialDocment);
|
|
3354
3569
|
}
|
|
3355
|
-
if (!(
|
|
3356
|
-
|
|
3570
|
+
if (!(initialDocment && !live)) {
|
|
3571
|
+
_context14.next = 18;
|
|
3357
3572
|
break;
|
|
3358
3573
|
}
|
|
3359
|
-
selectedDate = dateFolder.dateFromLeafDocument(
|
|
3360
|
-
|
|
3574
|
+
selectedDate = dateFolder.dateFromLeafDocument(initialDocment);
|
|
3575
|
+
_context14.next = 10;
|
|
3361
3576
|
return createMessageTable(selectedDate, live);
|
|
3362
|
-
case
|
|
3363
|
-
selectedMessageTable =
|
|
3577
|
+
case 10:
|
|
3578
|
+
selectedMessageTable = _context14.sent;
|
|
3364
3579
|
div.appendChild(selectedMessageTable);
|
|
3365
3580
|
earliest.messageTable = selectedMessageTable;
|
|
3366
3581
|
latest.messageTable = selectedMessageTable;
|
|
3367
3582
|
yank();
|
|
3368
3583
|
setTimeout(yank, 1000); // @@ kludge - restore position distubed by other cHANGES
|
|
3369
|
-
|
|
3584
|
+
_context14.next = 22;
|
|
3370
3585
|
break;
|
|
3371
|
-
case
|
|
3372
|
-
|
|
3586
|
+
case 18:
|
|
3587
|
+
_context14.next = 20;
|
|
3373
3588
|
return appendCurrentMessages();
|
|
3374
|
-
case
|
|
3589
|
+
case 20:
|
|
3375
3590
|
earliest.messageTable = liveMessageTable;
|
|
3376
3591
|
latest.messageTable = liveMessageTable;
|
|
3377
|
-
case
|
|
3378
|
-
|
|
3592
|
+
case 22:
|
|
3593
|
+
_context14.next = 24;
|
|
3379
3594
|
return loadMoreWhereNeeded(null, fixScroll);
|
|
3380
|
-
case
|
|
3595
|
+
case 24:
|
|
3381
3596
|
div.addEventListener('scroll', loadMoreWhereNeeded);
|
|
3382
3597
|
if (options.solo) {
|
|
3383
3598
|
document.body.addEventListener('scroll', loadMoreWhereNeeded);
|
|
3384
3599
|
}
|
|
3385
|
-
case
|
|
3600
|
+
case 26:
|
|
3386
3601
|
case "end":
|
|
3387
|
-
return
|
|
3602
|
+
return _context14.stop();
|
|
3388
3603
|
}
|
|
3389
|
-
},
|
|
3604
|
+
}, _callee14);
|
|
3390
3605
|
}));
|
|
3391
3606
|
return _loadInitialContent.apply(this, arguments);
|
|
3392
3607
|
};
|
|
@@ -3394,16 +3609,16 @@ function _infiniteMessageArea() {
|
|
|
3394
3609
|
return _loadInitialContent.apply(this, arguments);
|
|
3395
3610
|
};
|
|
3396
3611
|
_loadMoreWhereNeeded = function _loadMoreWhereNeeded3() {
|
|
3397
|
-
_loadMoreWhereNeeded = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3612
|
+
_loadMoreWhereNeeded = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13(event, fixScroll) {
|
|
3398
3613
|
var freeze, magicZone, done, scrollBottom, scrollTop;
|
|
3399
|
-
return _regenerator["default"].wrap(function
|
|
3400
|
-
while (1) switch (
|
|
3614
|
+
return _regenerator["default"].wrap(function _callee13$(_context13) {
|
|
3615
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
3401
3616
|
case 0:
|
|
3402
3617
|
if (!lock) {
|
|
3403
|
-
|
|
3618
|
+
_context13.next = 2;
|
|
3404
3619
|
break;
|
|
3405
3620
|
}
|
|
3406
|
-
return
|
|
3621
|
+
return _context13.abrupt("return");
|
|
3407
3622
|
case 2:
|
|
3408
3623
|
lock = true;
|
|
3409
3624
|
freeze = !fixScroll;
|
|
@@ -3411,36 +3626,36 @@ function _infiniteMessageArea() {
|
|
|
3411
3626
|
// const bottom = div.scrollHeight - top - div.clientHeight
|
|
3412
3627
|
case 5:
|
|
3413
3628
|
if (!(div.scrollTop < magicZone && earliest.messageTable && !earliest.messageTable.initial && earliest.messageTable.extendBackwards)) {
|
|
3414
|
-
|
|
3629
|
+
_context13.next = 21;
|
|
3415
3630
|
break;
|
|
3416
3631
|
}
|
|
3417
3632
|
if (!(div.scrollHeight === 0)) {
|
|
3418
|
-
|
|
3633
|
+
_context13.next = 10;
|
|
3419
3634
|
break;
|
|
3420
3635
|
}
|
|
3421
|
-
//
|
|
3636
|
+
// debug.log(' chat/loadMoreWhereNeeded: trying later...')
|
|
3422
3637
|
setTimeout(loadMoreWhereNeeded, 2000); // couple be less
|
|
3423
3638
|
lock = false;
|
|
3424
|
-
return
|
|
3639
|
+
return _context13.abrupt("return");
|
|
3425
3640
|
case 10:
|
|
3426
|
-
//
|
|
3641
|
+
// debug.log(' chat/loadMoreWhereNeeded: Going now')
|
|
3427
3642
|
scrollBottom = div.scrollHeight - div.scrollTop;
|
|
3428
3643
|
debug.log('infinite scroll: adding above: top ' + div.scrollTop);
|
|
3429
|
-
|
|
3644
|
+
_context13.next = 14;
|
|
3430
3645
|
return earliest.messageTable.extendBackwards();
|
|
3431
3646
|
case 14:
|
|
3432
|
-
done =
|
|
3647
|
+
done = _context13.sent;
|
|
3433
3648
|
if (freeze) {
|
|
3434
3649
|
div.scrollTop = div.scrollHeight - scrollBottom;
|
|
3435
3650
|
}
|
|
3436
3651
|
if (fixScroll) fixScroll();
|
|
3437
3652
|
if (!done) {
|
|
3438
|
-
|
|
3653
|
+
_context13.next = 19;
|
|
3439
3654
|
break;
|
|
3440
3655
|
}
|
|
3441
|
-
return
|
|
3656
|
+
return _context13.abrupt("break", 21);
|
|
3442
3657
|
case 19:
|
|
3443
|
-
|
|
3658
|
+
_context13.next = 5;
|
|
3444
3659
|
break;
|
|
3445
3660
|
case 21:
|
|
3446
3661
|
if (!(options.selectedMessage &&
|
|
@@ -3450,15 +3665,15 @@ function _infiniteMessageArea() {
|
|
|
3450
3665
|
latest.messageTable && !latest.messageTable["final"] &&
|
|
3451
3666
|
// there is more data to come
|
|
3452
3667
|
latest.messageTable.extendForwards)) {
|
|
3453
|
-
|
|
3668
|
+
_context13.next = 33;
|
|
3454
3669
|
break;
|
|
3455
3670
|
}
|
|
3456
3671
|
scrollTop = div.scrollTop;
|
|
3457
3672
|
debug.log('infinite scroll: adding below: bottom: ' + (div.scrollHeight - div.scrollTop - div.clientHeight));
|
|
3458
|
-
|
|
3673
|
+
_context13.next = 26;
|
|
3459
3674
|
return latest.messageTable.extendForwards();
|
|
3460
3675
|
case 26:
|
|
3461
|
-
done =
|
|
3676
|
+
done = _context13.sent;
|
|
3462
3677
|
// then add more data on the bottom
|
|
3463
3678
|
if (freeze) {
|
|
3464
3679
|
div.scrollTop = scrollTop; // while adding below keep same things in view
|
|
@@ -3466,63 +3681,66 @@ function _infiniteMessageArea() {
|
|
|
3466
3681
|
|
|
3467
3682
|
if (fixScroll) fixScroll();
|
|
3468
3683
|
if (!done) {
|
|
3469
|
-
|
|
3684
|
+
_context13.next = 31;
|
|
3470
3685
|
break;
|
|
3471
3686
|
}
|
|
3472
|
-
return
|
|
3687
|
+
return _context13.abrupt("break", 33);
|
|
3473
3688
|
case 31:
|
|
3474
|
-
|
|
3689
|
+
_context13.next = 21;
|
|
3475
3690
|
break;
|
|
3476
3691
|
case 33:
|
|
3477
3692
|
lock = false;
|
|
3478
3693
|
case 34:
|
|
3479
3694
|
case "end":
|
|
3480
|
-
return
|
|
3695
|
+
return _context13.stop();
|
|
3481
3696
|
}
|
|
3482
|
-
},
|
|
3697
|
+
}, _callee13);
|
|
3483
3698
|
}));
|
|
3484
3699
|
return _loadMoreWhereNeeded.apply(this, arguments);
|
|
3485
3700
|
};
|
|
3486
|
-
loadMoreWhereNeeded = function _loadMoreWhereNeeded2(
|
|
3701
|
+
loadMoreWhereNeeded = function _loadMoreWhereNeeded2(_x20, _x21) {
|
|
3487
3702
|
return _loadMoreWhereNeeded.apply(this, arguments);
|
|
3488
3703
|
};
|
|
3489
3704
|
_appendCurrentMessages = function _appendCurrentMessage2() {
|
|
3490
|
-
_appendCurrentMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3705
|
+
_appendCurrentMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12() {
|
|
3491
3706
|
var now, chatDocument, messageTable;
|
|
3492
|
-
return _regenerator["default"].wrap(function
|
|
3493
|
-
while (1) switch (
|
|
3707
|
+
return _regenerator["default"].wrap(function _callee12$(_context12) {
|
|
3708
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
3494
3709
|
case 0:
|
|
3495
3710
|
now = new Date();
|
|
3496
3711
|
chatDocument = dateFolder.leafDocumentFromDate(now); /// ///////////////////////////////////////////////////////////
|
|
3497
|
-
|
|
3712
|
+
_context12.next = 4;
|
|
3498
3713
|
return createMessageTable(now, true);
|
|
3499
3714
|
case 4:
|
|
3500
|
-
messageTable =
|
|
3715
|
+
messageTable = _context12.sent;
|
|
3501
3716
|
div.appendChild(messageTable);
|
|
3502
|
-
div.refresh = /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3503
|
-
return _regenerator["default"].wrap(function
|
|
3504
|
-
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) {
|
|
3505
3720
|
case 0:
|
|
3506
|
-
|
|
3721
|
+
_context11.next = 2;
|
|
3507
3722
|
return addNewChatDocumentIfNewDay(new Date());
|
|
3508
3723
|
case 2:
|
|
3509
|
-
|
|
3510
|
-
|
|
3724
|
+
_context11.next = 4;
|
|
3725
|
+
return syncMessages(chatChannel, messageTable);
|
|
3511
3726
|
case 4:
|
|
3727
|
+
// @@ livemessagetable??
|
|
3728
|
+
desktopNotification(chatChannel);
|
|
3729
|
+
case 5:
|
|
3512
3730
|
case "end":
|
|
3513
|
-
return
|
|
3731
|
+
return _context11.stop();
|
|
3514
3732
|
}
|
|
3515
|
-
},
|
|
3733
|
+
}, _callee11);
|
|
3516
3734
|
})); // The short chat version the live update listening is done in the pane but we do it in the widget @@
|
|
3517
3735
|
_solidLogic.store.updater.addDownstreamChangeListener(chatDocument, div.refresh); // Live update
|
|
3518
3736
|
liveMessageTable = messageTable;
|
|
3519
3737
|
latest.messageTable = liveMessageTable;
|
|
3520
|
-
return
|
|
3738
|
+
return _context12.abrupt("return", messageTable);
|
|
3521
3739
|
case 11:
|
|
3522
3740
|
case "end":
|
|
3523
|
-
return
|
|
3741
|
+
return _context12.stop();
|
|
3524
3742
|
}
|
|
3525
|
-
},
|
|
3743
|
+
}, _callee12);
|
|
3526
3744
|
}));
|
|
3527
3745
|
return _appendCurrentMessages.apply(this, arguments);
|
|
3528
3746
|
};
|
|
@@ -3530,15 +3748,15 @@ function _infiniteMessageArea() {
|
|
|
3530
3748
|
return _appendCurrentMessages.apply(this, arguments);
|
|
3531
3749
|
};
|
|
3532
3750
|
_addNewChatDocumentIfNewDay = function _addNewChatDocumentIf2() {
|
|
3533
|
-
_addNewChatDocumentIfNewDay = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3751
|
+
_addNewChatDocumentIfNewDay = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10() {
|
|
3534
3752
|
var newChatDocument, oldChatDocument, sts;
|
|
3535
|
-
return _regenerator["default"].wrap(function
|
|
3536
|
-
while (1) switch (
|
|
3753
|
+
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
|
3754
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
3537
3755
|
case 0:
|
|
3538
3756
|
// @@ Remove listener from previous table as it is now static
|
|
3539
3757
|
newChatDocument = dateFolder.leafDocumentFromDate(new Date());
|
|
3540
3758
|
if (newChatDocument.sameTerm(latest.messageTable.chatDocument)) {
|
|
3541
|
-
|
|
3759
|
+
_context10.next = 7;
|
|
3542
3760
|
break;
|
|
3543
3761
|
}
|
|
3544
3762
|
// It is a new day
|
|
@@ -3547,7 +3765,7 @@ function _infiniteMessageArea() {
|
|
|
3547
3765
|
delete liveMessageTable.inputRow;
|
|
3548
3766
|
}
|
|
3549
3767
|
oldChatDocument = latest.messageTable.chatDocument;
|
|
3550
|
-
|
|
3768
|
+
_context10.next = 6;
|
|
3551
3769
|
return appendCurrentMessages();
|
|
3552
3770
|
case 6:
|
|
3553
3771
|
// Adding a link in the document will ping listeners to add the new block too
|
|
@@ -3561,286 +3779,322 @@ function _infiniteMessageArea() {
|
|
|
3561
3779
|
}
|
|
3562
3780
|
case 7:
|
|
3563
3781
|
case "end":
|
|
3564
|
-
return
|
|
3782
|
+
return _context10.stop();
|
|
3565
3783
|
}
|
|
3566
|
-
},
|
|
3784
|
+
}, _callee10);
|
|
3567
3785
|
}));
|
|
3568
3786
|
return _addNewChatDocumentIfNewDay.apply(this, arguments);
|
|
3569
3787
|
};
|
|
3570
3788
|
addNewChatDocumentIfNewDay = function _addNewChatDocumentIf() {
|
|
3571
3789
|
return _addNewChatDocumentIfNewDay.apply(this, arguments);
|
|
3572
3790
|
};
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
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';
|
|
3599
3835
|
}
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
3627
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
3628
|
-
case 0:
|
|
3629
|
-
if (!messageTable.extendedBack) {
|
|
3630
|
-
_context2.next = 6;
|
|
3631
|
-
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;
|
|
3632
3862
|
}
|
|
3633
|
-
|
|
3634
|
-
messageTable.
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
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
|
|
3666
3934
|
} else {
|
|
3667
|
-
messageTable.
|
|
3935
|
+
messageTable.appendChild(tr); // not newestFirst
|
|
3668
3936
|
}
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
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
|
+
}));
|
|
3708
3975
|
}
|
|
3709
|
-
|
|
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
|
+
*/
|
|
3710
3995
|
messageTable.extendedForwards = false;
|
|
3711
|
-
|
|
3712
|
-
|
|
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;
|
|
3713
4015
|
break;
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
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
|
-
messageTable.inputRow = tr;
|
|
3749
|
-
}
|
|
3750
|
-
|
|
3751
|
-
/// ///// Infinite scroll
|
|
3752
|
-
//
|
|
3753
|
-
// @@ listen for swipe past end event not just button
|
|
3754
|
-
if (options.infinite) {
|
|
3755
|
-
var scrollBackbuttonTR = dom.createElement('tr');
|
|
3756
|
-
var scrollBackbuttonCell = scrollBackbuttonTR.appendChild(dom.createElement('td'));
|
|
3757
|
-
// up traingles: noun_1369237.svg
|
|
3758
|
-
// down triangles: noun_1369241.svg
|
|
3759
|
-
var scrollBackIcon = newestFirst ? 'noun_1369241.svg' : 'noun_1369237.svg'; // down and up arrows respoctively
|
|
3760
|
-
scrollBackbutton = widgets.button(dom, _iconBase.icons.iconBase + scrollBackIcon, 'Previous messages ...');
|
|
3761
|
-
scrollBackbuttonCell.style = 'width:3em; height:3em;';
|
|
3762
|
-
scrollBackbutton.addEventListener('click', scrollBackbuttonHandler, false);
|
|
3763
|
-
messageTable.extendedBack = false;
|
|
3764
|
-
scrollBackbuttonCell.appendChild(scrollBackbutton);
|
|
3765
|
-
setScrollBackbuttonIcon();
|
|
3766
|
-
var dateCell = scrollBackbuttonTR.appendChild(dom.createElement('td'));
|
|
3767
|
-
dateCell.style = 'text-align: center; vertical-align: middle; color: #888; font-style: italic;';
|
|
3768
|
-
dateCell.textContent = widgets.shortDate(date.toISOString(), true); // no time, only date
|
|
3769
|
-
|
|
3770
|
-
// @@@@@@@@@@@ todo move this button to other end of message cell, o
|
|
3771
|
-
var scrollForwardButtonCell = scrollBackbuttonTR.appendChild(dom.createElement('td'));
|
|
3772
|
-
var scrollForwardIcon = newestFirst ? 'noun_1369241.svg' : 'noun_1369237.svg'; // down and up arrows respoctively
|
|
3773
|
-
scrollForwardButton = widgets.button(dom, _iconBase.icons.iconBase + scrollForwardIcon, 'Later messages ...');
|
|
3774
|
-
scrollForwardButtonCell.appendChild(scrollForwardButton);
|
|
3775
|
-
scrollForwardButtonCell.style = 'width:3em; height:3em;';
|
|
3776
|
-
scrollForwardButton.addEventListener('click', scrollForwardButtonHandler, false);
|
|
3777
|
-
messageTable.extendedForward = false;
|
|
3778
|
-
setScrollForwardButtonIcon();
|
|
3779
|
-
messageTable.extendedForwards = false;
|
|
3780
|
-
if (!newestFirst) {
|
|
3781
|
-
// opposite end from the entry field
|
|
3782
|
-
messageTable.insertBefore(scrollBackbuttonTR, messageTable.firstChild); // If not newestFirst
|
|
3783
|
-
} else {
|
|
3784
|
-
messageTable.appendChild(scrollBackbuttonTR); // newestFirst
|
|
3785
|
-
}
|
|
3786
|
-
}
|
|
3787
|
-
|
|
3788
|
-
var sts = _solidLogic.store.statementsMatching(null, ns.wf('message'), null, chatDocument);
|
|
3789
|
-
if (!live && sts.length === 0) {
|
|
3790
|
-
// not todays
|
|
3791
|
-
// no need buttomns at the moment
|
|
3792
|
-
// messageTable.style.visibility = 'collapse' // Hide files with no messages
|
|
3793
|
-
}
|
|
3794
|
-
sts.forEach(function (st) {
|
|
3795
|
-
addMessage(st.object, messageTable);
|
|
3796
|
-
});
|
|
3797
|
-
messageTable.fresh = true;
|
|
3798
|
-
|
|
3799
|
-
// loadMessageTable(messageTable, chatDocument)
|
|
3800
|
-
messageTable.fresh = false;
|
|
3801
|
-
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);
|
|
3802
4050
|
};
|
|
3803
4051
|
_createMessageTable = function _createMessageTable3() {
|
|
3804
|
-
_createMessageTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
4052
|
+
_createMessageTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(date, live) {
|
|
3805
4053
|
var chatDocument, messageTable, statusTR;
|
|
3806
|
-
return _regenerator["default"].wrap(function
|
|
3807
|
-
while (1) switch (
|
|
4054
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
4055
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
3808
4056
|
case 0:
|
|
3809
4057
|
debug.log(' createMessageTable for ' + date);
|
|
3810
4058
|
chatDocument = dateFolder.leafDocumentFromDate(date);
|
|
3811
|
-
|
|
3812
|
-
|
|
4059
|
+
_context5.prev = 2;
|
|
4060
|
+
_context5.next = 5;
|
|
3813
4061
|
return _solidLogic.store.fetcher.load(chatDocument);
|
|
3814
4062
|
case 5:
|
|
3815
|
-
|
|
4063
|
+
_context5.next = 21;
|
|
3816
4064
|
break;
|
|
3817
4065
|
case 7:
|
|
3818
|
-
|
|
3819
|
-
|
|
4066
|
+
_context5.prev = 7;
|
|
4067
|
+
_context5.t0 = _context5["catch"](2);
|
|
3820
4068
|
messageTable = dom.createElement('table');
|
|
3821
4069
|
statusTR = messageTable.appendChild(dom.createElement('tr')); // ### find status in exception
|
|
3822
|
-
if (!(
|
|
3823
|
-
|
|
4070
|
+
if (!(_context5.t0.response && _context5.t0.response.status && _context5.t0.response.status === 404)) {
|
|
4071
|
+
_context5.next = 18;
|
|
3824
4072
|
break;
|
|
3825
4073
|
}
|
|
3826
4074
|
debug.log('Error 404 for chat file ' + chatDocument);
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
4075
|
+
_context5.next = 15;
|
|
4076
|
+
return renderMessageTable(date, live);
|
|
4077
|
+
case 15:
|
|
4078
|
+
return _context5.abrupt("return", _context5.sent);
|
|
3831
4079
|
case 18:
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
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'));
|
|
3835
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:
|
|
3836
4090
|
case "end":
|
|
3837
|
-
return
|
|
4091
|
+
return _context5.stop();
|
|
3838
4092
|
}
|
|
3839
|
-
},
|
|
4093
|
+
}, _callee5, null, [[2, 7]]);
|
|
3840
4094
|
}));
|
|
3841
4095
|
return _createMessageTable.apply(this, arguments);
|
|
3842
4096
|
};
|
|
3843
|
-
createMessageTable = function _createMessageTable2(
|
|
4097
|
+
createMessageTable = function _createMessageTable2(_x16, _x17) {
|
|
3844
4098
|
return _createMessageTable.apply(this, arguments);
|
|
3845
4099
|
};
|
|
3846
4100
|
removePreviousMessages = function _removePreviousMessag(backwards, messageTable) {
|
|
@@ -3859,32 +4113,40 @@ function _infiniteMessageArea() {
|
|
|
3859
4113
|
extr.messageTable = messageTable;
|
|
3860
4114
|
};
|
|
3861
4115
|
_insertPreviousMessages = function _insertPreviousMessag2() {
|
|
3862
|
-
_insertPreviousMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
4116
|
+
_insertPreviousMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(backwards) {
|
|
3863
4117
|
var extremity, date, live, todayDoc, doc, newMessageTable;
|
|
3864
|
-
return _regenerator["default"].wrap(function
|
|
3865
|
-
while (1) switch (
|
|
4118
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
4119
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
3866
4120
|
case 0:
|
|
3867
4121
|
extremity = backwards ? earliest : latest;
|
|
3868
4122
|
date = extremity.messageTable.date; // day in mssecs
|
|
3869
|
-
|
|
3870
|
-
|
|
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);
|
|
3871
4129
|
case 4:
|
|
3872
|
-
|
|
4130
|
+
_context4.next = 6;
|
|
4131
|
+
return dateFolder.loadPrevious(date, backwards);
|
|
4132
|
+
case 6:
|
|
4133
|
+
date = _context4.sent;
|
|
3873
4134
|
// backwards
|
|
4135
|
+
|
|
3874
4136
|
debug.log("insertPreviousMessages: from ".concat(backwards ? 'backwards' : 'forwards', " loadPrevious: ").concat(date));
|
|
3875
4137
|
if (!(!date && !backwards && !liveMessageTable)) {
|
|
3876
|
-
|
|
4138
|
+
_context4.next = 11;
|
|
3877
4139
|
break;
|
|
3878
4140
|
}
|
|
3879
|
-
|
|
4141
|
+
_context4.next = 11;
|
|
3880
4142
|
return appendCurrentMessages();
|
|
3881
|
-
case
|
|
4143
|
+
case 11:
|
|
3882
4144
|
if (date) {
|
|
3883
|
-
|
|
4145
|
+
_context4.next = 13;
|
|
3884
4146
|
break;
|
|
3885
4147
|
}
|
|
3886
|
-
return
|
|
3887
|
-
case
|
|
4148
|
+
return _context4.abrupt("return", true);
|
|
4149
|
+
case 13:
|
|
3888
4150
|
// done
|
|
3889
4151
|
live = false;
|
|
3890
4152
|
if (!backwards) {
|
|
@@ -3892,10 +4154,10 @@ function _infiniteMessageArea() {
|
|
|
3892
4154
|
doc = dateFolder.leafDocumentFromDate(date);
|
|
3893
4155
|
live = doc.sameTerm(todayDoc); // Is this todays?
|
|
3894
4156
|
}
|
|
3895
|
-
|
|
4157
|
+
_context4.next = 17;
|
|
3896
4158
|
return createMessageTable(date, live);
|
|
3897
|
-
case
|
|
3898
|
-
newMessageTable =
|
|
4159
|
+
case 17:
|
|
4160
|
+
newMessageTable = _context4.sent;
|
|
3899
4161
|
extremity.messageTable = newMessageTable; // move pointer to earliest
|
|
3900
4162
|
if (backwards ? newestFirst : !newestFirst) {
|
|
3901
4163
|
// put on bottom or top
|
|
@@ -3904,62 +4166,160 @@ function _infiniteMessageArea() {
|
|
|
3904
4166
|
// put on top as we scroll back
|
|
3905
4167
|
div.insertBefore(newMessageTable, div.firstChild);
|
|
3906
4168
|
}
|
|
3907
|
-
return
|
|
3908
|
-
case
|
|
4169
|
+
return _context4.abrupt("return", live);
|
|
4170
|
+
case 21:
|
|
3909
4171
|
case "end":
|
|
3910
|
-
return
|
|
4172
|
+
return _context4.stop();
|
|
3911
4173
|
}
|
|
3912
|
-
},
|
|
4174
|
+
}, _callee4);
|
|
3913
4175
|
}));
|
|
3914
4176
|
return _insertPreviousMessages.apply(this, arguments);
|
|
3915
4177
|
};
|
|
3916
|
-
insertPreviousMessages = function _insertPreviousMessag(
|
|
4178
|
+
insertPreviousMessages = function _insertPreviousMessag(_x15) {
|
|
3917
4179
|
return _insertPreviousMessages.apply(this, arguments);
|
|
3918
4180
|
};
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
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);
|
|
3927
4249
|
};
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
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);
|
|
3961
4322
|
};
|
|
3962
|
-
|
|
3963
4323
|
// Body of main function
|
|
3964
4324
|
|
|
3965
4325
|
options = options || {};
|
|
@@ -3975,23 +4335,33 @@ function _infiniteMessageArea() {
|
|
|
3975
4335
|
statusArea: statusArea,
|
|
3976
4336
|
div: statusArea
|
|
3977
4337
|
}; // logged on state, pointers to user's stuff
|
|
3978
|
-
// const messageTable = dom.createElement('table') // @@ check does this go in renderMessageTable
|
|
3979
4338
|
earliest = {
|
|
3980
4339
|
messageTable: null
|
|
3981
4340
|
}; // Stuff about each end of the loaded days
|
|
3982
4341
|
latest = {
|
|
3983
4342
|
messageTable: null
|
|
3984
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
|
+
}
|
|
3985
4355
|
lock = false;
|
|
3986
|
-
|
|
4356
|
+
_context15.next = 34;
|
|
3987
4357
|
return loadInitialContent();
|
|
3988
|
-
case
|
|
3989
|
-
return
|
|
3990
|
-
case
|
|
4358
|
+
case 34:
|
|
4359
|
+
return _context15.abrupt("return", div);
|
|
4360
|
+
case 35:
|
|
3991
4361
|
case "end":
|
|
3992
|
-
return
|
|
4362
|
+
return _context15.stop();
|
|
3993
4363
|
}
|
|
3994
|
-
},
|
|
4364
|
+
}, _callee15);
|
|
3995
4365
|
}));
|
|
3996
4366
|
return _infiniteMessageArea.apply(this, arguments);
|
|
3997
4367
|
}
|
|
@@ -4020,6 +4390,7 @@ exports.renderMessageEditor = renderMessageEditor;
|
|
|
4020
4390
|
exports.renderMessageRow = renderMessageRow;
|
|
4021
4391
|
exports.switchToEditor = switchToEditor;
|
|
4022
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"));
|
|
4023
4394
|
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
4024
4395
|
var _infinite = __webpack_require__(/*! ./infinite */ "./lib/chat/infinite.js");
|
|
4025
4396
|
var _messageTools = __webpack_require__(/*! ./messageTools */ "./lib/chat/messageTools.js");
|
|
@@ -4037,7 +4408,9 @@ var utils = _interopRequireWildcard(__webpack_require__(/*! ../utils */ "./lib/u
|
|
|
4037
4408
|
var widgets = _interopRequireWildcard(__webpack_require__(/*! ../widgets */ "./lib/widgets/index.js"));
|
|
4038
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); }
|
|
4039
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; }
|
|
4040
|
-
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; } } }; }
|
|
4041
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); }
|
|
4042
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; }
|
|
4043
4416
|
var dom = window.document;
|
|
@@ -4116,122 +4489,232 @@ function creatorAndDateHorizontal(td1, creator, date, message) {
|
|
|
4116
4489
|
/**
|
|
4117
4490
|
* Renders a chat message, read-only mode
|
|
4118
4491
|
*/
|
|
4119
|
-
function renderMessageRow(
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4492
|
+
function renderMessageRow(_x, _x2, _x3, _x4, _x5) {
|
|
4493
|
+
return _renderMessageRow.apply(this, arguments);
|
|
4494
|
+
}
|
|
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);
|
|
4218
4677
|
}
|
|
4219
|
-
function switchToEditor(
|
|
4220
|
-
|
|
4221
|
-
var editRow = renderMessageEditor(channelObject, messageTable, userContext, channelObject.options, (0, _chatLogic.mostRecentVersion)(message));
|
|
4222
|
-
messageTable.insertBefore(editRow, messageRow);
|
|
4223
|
-
editRow.originalRow = messageRow;
|
|
4224
|
-
messageRow.style.visibility = 'hidden'; // Hide the original message. unhide if user cancels edit
|
|
4678
|
+
function switchToEditor(_x6, _x7, _x8, _x9) {
|
|
4679
|
+
return _switchToEditor.apply(this, arguments);
|
|
4225
4680
|
}
|
|
4226
4681
|
/* Control for a new message -- or editing an old message ***************
|
|
4227
4682
|
*
|
|
4228
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
|
+
}
|
|
4229
4712
|
function renderMessageEditor(channelObject, messageTable, userContext, options, originalMessage) {
|
|
4230
4713
|
function revertEditing(messageEditor) {
|
|
4231
4714
|
messageEditor.originalRow.style.visibility = 'visible'; // restore read-only version
|
|
4232
4715
|
messageEditor.parentNode.removeChild(messageEditor);
|
|
4233
4716
|
}
|
|
4234
|
-
function handleFieldInput(
|
|
4717
|
+
function handleFieldInput(_x10) {
|
|
4235
4718
|
return _handleFieldInput.apply(this, arguments);
|
|
4236
4719
|
}
|
|
4237
4720
|
function _handleFieldInput() {
|
|
@@ -4249,72 +4732,87 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4249
4732
|
}));
|
|
4250
4733
|
return _handleFieldInput.apply(this, arguments);
|
|
4251
4734
|
}
|
|
4252
|
-
function sendMessage(
|
|
4735
|
+
function sendMessage(_x11, _x12) {
|
|
4253
4736
|
return _sendMessage.apply(this, arguments);
|
|
4254
4737
|
} // sendMessage
|
|
4255
4738
|
// DRAG AND DROP
|
|
4256
4739
|
function _sendMessage() {
|
|
4257
|
-
_sendMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
4258
|
-
var sendComplete, message, statusArea;
|
|
4259
|
-
return _regenerator["default"].wrap(function
|
|
4260
|
-
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) {
|
|
4261
4744
|
case 0:
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
oldRow.parentNode.removeChild(oldRow); // No longer needed old version
|
|
4273
|
-
} else {
|
|
4274
|
-
debug.warn('No parentNode on old message ' + oldRow.textContent);
|
|
4275
|
-
oldRow.style.backgroundColor = '#fee';
|
|
4276
|
-
oldRow.style.visibility = 'hidden'; // @@ FIX THIS AND REMOVE FROM DOM INSTEAD
|
|
4277
|
-
}
|
|
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
|
|
4278
4755
|
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
}
|
|
4290
|
-
// await channelObject.div.refresh() // Add new day if nec @@ add back
|
|
4291
|
-
};
|
|
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
|
+
}
|
|
4292
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
|
+
};
|
|
4293
4790
|
// const me = authn.currentUser() // Must be logged on or wuld have got login button
|
|
4294
4791
|
if (fromMainField) {
|
|
4295
4792
|
field.setAttribute('style', messageBodyStyle + 'color: #bbb;'); // pendingedit
|
|
4296
4793
|
field.disabled = true;
|
|
4297
4794
|
}
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
return channelObject.updateMessage(text, originalMessage);
|
|
4301
|
-
case
|
|
4302
|
-
message =
|
|
4303
|
-
|
|
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;
|
|
4304
4801
|
break;
|
|
4305
|
-
case
|
|
4306
|
-
|
|
4307
|
-
|
|
4802
|
+
case 9:
|
|
4803
|
+
_context8.prev = 9;
|
|
4804
|
+
_context8.t0 = _context8["catch"](3);
|
|
4308
4805
|
statusArea = userContext.statusArea || messageEditor;
|
|
4309
|
-
statusArea.appendChild(widgets.errorMessageBlock(dom, 'Error writing message: ' +
|
|
4310
|
-
return
|
|
4311
|
-
case 13:
|
|
4312
|
-
sendComplete(message, text);
|
|
4806
|
+
statusArea.appendChild(widgets.errorMessageBlock(dom, 'Error writing message: ' + _context8.t0));
|
|
4807
|
+
return _context8.abrupt("return");
|
|
4313
4808
|
case 14:
|
|
4809
|
+
_context8.next = 16;
|
|
4810
|
+
return sendComplete(message, text);
|
|
4811
|
+
case 16:
|
|
4314
4812
|
case "end":
|
|
4315
|
-
return
|
|
4813
|
+
return _context8.stop();
|
|
4316
4814
|
}
|
|
4317
|
-
},
|
|
4815
|
+
}, _callee7, null, [[3, 9]]);
|
|
4318
4816
|
}));
|
|
4319
4817
|
return _sendMessage.apply(this, arguments);
|
|
4320
4818
|
}
|
|
@@ -4333,7 +4831,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4333
4831
|
}
|
|
4334
4832
|
}, _callee);
|
|
4335
4833
|
}));
|
|
4336
|
-
return function (
|
|
4834
|
+
return function (_x13, _x14) {
|
|
4337
4835
|
return _ref.apply(this, arguments);
|
|
4338
4836
|
};
|
|
4339
4837
|
}());
|
|
@@ -4377,7 +4875,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4377
4875
|
}
|
|
4378
4876
|
}, _callee2, null, [[1, 11, 14, 17]]);
|
|
4379
4877
|
}));
|
|
4380
|
-
return function droppedURIHandler(
|
|
4878
|
+
return function droppedURIHandler(_x15) {
|
|
4381
4879
|
return _ref2.apply(this, arguments);
|
|
4382
4880
|
};
|
|
4383
4881
|
}();
|
|
@@ -4388,7 +4886,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4388
4886
|
imageDoc = $rdf.sym(chatDocument.dir().uri + 'Image_' + Date.now() + '.png');
|
|
4389
4887
|
return imageDoc;
|
|
4390
4888
|
}
|
|
4391
|
-
function tookPicture(
|
|
4889
|
+
function tookPicture(_x16) {
|
|
4392
4890
|
return _tookPicture.apply(this, arguments);
|
|
4393
4891
|
} // Body of turnOnInput
|
|
4394
4892
|
function _tookPicture() {
|
|
@@ -4465,7 +4963,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4465
4963
|
}
|
|
4466
4964
|
}, _callee3);
|
|
4467
4965
|
}));
|
|
4468
|
-
return function (
|
|
4966
|
+
return function (_x17) {
|
|
4469
4967
|
return _ref3.apply(this, arguments);
|
|
4470
4968
|
};
|
|
4471
4969
|
}(), false);
|
|
@@ -4527,7 +5025,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4527
5025
|
turnOnInput();
|
|
4528
5026
|
Object.assign(context, userContext);
|
|
4529
5027
|
(0, _bookmarks.findBookmarkDocument)(context).then(function (_context) {
|
|
4530
|
-
//
|
|
5028
|
+
// debug.log('Bookmark file: ' + context.bookmarkDocument)
|
|
4531
5029
|
});
|
|
4532
5030
|
});
|
|
4533
5031
|
return messageEditor;
|
|
@@ -4550,12 +5048,15 @@ var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_m
|
|
|
4550
5048
|
Object.defineProperty(exports, "__esModule", ({
|
|
4551
5049
|
value: true
|
|
4552
5050
|
}));
|
|
5051
|
+
exports.ActionClassFromEmoji = ActionClassFromEmoji;
|
|
5052
|
+
exports.emojiFromAction = emojiFromAction;
|
|
5053
|
+
exports.emojiFromActionClass = emojiFromActionClass;
|
|
4553
5054
|
exports.messageToolbar = messageToolbar;
|
|
4554
5055
|
exports.sentimentStrip = sentimentStrip;
|
|
4555
5056
|
exports.sentimentStripLinked = sentimentStripLinked;
|
|
4556
5057
|
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
|
|
4557
|
-
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
4558
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"));
|
|
4559
5060
|
var debug = _interopRequireWildcard(__webpack_require__(/*! ../debug */ "./lib/debug.js"));
|
|
4560
5061
|
var _iconBase = __webpack_require__(/*! ../iconBase */ "./lib/iconBase.js");
|
|
4561
5062
|
var ns = _interopRequireWildcard(__webpack_require__(/*! ../ns */ "./lib/ns.js"));
|
|
@@ -4596,30 +5097,46 @@ var PENCIL_ICON = 'noun_253504.svg'; // edit a message
|
|
|
4596
5097
|
// const SPANNER_ICON = 'noun_344563.svg' -> settings
|
|
4597
5098
|
var THUMBS_UP_ICON = 'noun_1384132.svg';
|
|
4598
5099
|
var THUMBS_DOWN_ICON = 'noun_1384135.svg';
|
|
5100
|
+
var REPLY_ICON = 'noun-reply-5506924.svg';
|
|
4599
5101
|
/**
|
|
4600
5102
|
* Emoji in Unicode
|
|
4601
5103
|
*/
|
|
4602
|
-
var
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
|
|
4606
|
-
|
|
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
|
+
}
|
|
4607
5134
|
|
|
4608
5135
|
/**
|
|
4609
5136
|
* Create strip of sentiments expressed
|
|
4610
5137
|
*/
|
|
4611
|
-
function sentimentStrip(
|
|
4612
|
-
|
|
4613
|
-
var latest = (0, _chatLogic.mostRecentVersion)(target);
|
|
4614
|
-
var actions = _solidLogic.store.holds(latest, ns.schema('dateDeleted').value, null, latest.doc()) ? _solidLogic.store.each(null, ns.schema('target'), target, doc) : [];
|
|
4615
|
-
var sentiments = actions.map(function (a) {
|
|
4616
|
-
return _solidLogic.store.any(a, ns.rdf('type'), null, doc);
|
|
4617
|
-
});
|
|
4618
|
-
sentiments.sort();
|
|
4619
|
-
var strings = sentiments.map(function (x) {
|
|
4620
|
-
return emoji[x] || '';
|
|
4621
|
-
});
|
|
4622
|
-
return dom.createTextNode(strings.join(' '));
|
|
5138
|
+
function sentimentStrip(_x, _x2) {
|
|
5139
|
+
return _sentimentStrip.apply(this, arguments);
|
|
4623
5140
|
}
|
|
4624
5141
|
/**
|
|
4625
5142
|
* Create strip of sentiments expressed, with hyperlinks
|
|
@@ -4627,276 +5144,445 @@ function sentimentStrip(target, doc) {
|
|
|
4627
5144
|
* @param target {NamedNode} - The thing about which they are expressed
|
|
4628
5145
|
* @param doc {NamedNode} - The document in which they are expressed
|
|
4629
5146
|
*/
|
|
4630
|
-
function
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
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();
|
|
4649
5169
|
}
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
return strip;
|
|
5170
|
+
}, _callee);
|
|
5171
|
+
}));
|
|
5172
|
+
return _sentimentStrip.apply(this, arguments);
|
|
5173
|
+
}
|
|
5174
|
+
function sentimentStripLinked(_x3, _x4) {
|
|
5175
|
+
return _sentimentStripLinked.apply(this, arguments);
|
|
4657
5176
|
}
|
|
4658
5177
|
/**
|
|
4659
5178
|
* Creates a message toolbar component
|
|
4660
5179
|
*/
|
|
4661
|
-
function
|
|
4662
|
-
function
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
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';
|
|
4675
5270
|
}
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
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;
|
|
4683
5344
|
}
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
case 9:
|
|
4688
|
-
_context2.next = 18;
|
|
4689
|
-
break;
|
|
4690
|
-
case 11:
|
|
4691
|
-
_context2.prev = 11;
|
|
4692
|
-
_context2.t0 = _context2["catch"](6);
|
|
4693
|
-
msg = 'Error deleting messaage ' + _context2.t0;
|
|
4694
|
-
debug.warn(msg);
|
|
4695
|
-
alert(msg);
|
|
4696
|
-
area = userContext.statusArea || messageRow.parentNode;
|
|
4697
|
-
area.appendChild(widgets.errorMessageBlock(dom, msg));
|
|
4698
|
-
case 18:
|
|
4699
|
-
messageRow.parentNode.removeChild(messageRow);
|
|
4700
|
-
_context2.next = 22;
|
|
4701
|
-
break;
|
|
4702
|
-
case 21:
|
|
4703
|
-
alert('You can\'t delete the message, you are not logged in as the author, ' + author);
|
|
4704
|
-
case 22:
|
|
4705
|
-
closeToolbar();
|
|
4706
|
-
case 23:
|
|
4707
|
-
case "end":
|
|
4708
|
-
return _context2.stop();
|
|
4709
|
-
}
|
|
4710
|
-
}, _callee2, null, [[6, 11]]);
|
|
4711
|
-
}));
|
|
4712
|
-
return _deleteMessage.apply(this, arguments);
|
|
4713
|
-
}
|
|
4714
|
-
function editMessage(_x) {
|
|
4715
|
-
return _editMessage.apply(this, arguments);
|
|
4716
|
-
} // alain TODO allow chat owner to fully delete message + sentiments and replacing messages
|
|
4717
|
-
function _editMessage() {
|
|
4718
|
-
_editMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(messageRow) {
|
|
4719
|
-
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
4720
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
4721
|
-
case 0:
|
|
4722
|
-
if (me.value === _solidLogic.store.any(message, ns.foaf('maker')).value) {
|
|
4723
|
-
closeToolbar(); // edit is a one-off action
|
|
4724
|
-
(0, _message.switchToEditor)(messageRow, message, channelObject, userContext);
|
|
5345
|
+
function refresh() {
|
|
5346
|
+
action = existingAction(actionClass);
|
|
5347
|
+
setColor();
|
|
4725
5348
|
}
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
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
|
-
|
|
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
|
|
4775
5511
|
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
5512
|
+
(0, _bookmarks.renderBookmarksButton)(userContext).then(function (bookmarkButton) {
|
|
5513
|
+
if (bookmarkButton) div.appendChild(bookmarkButton);
|
|
5514
|
+
});
|
|
4779
5515
|
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
while (1) switch (_context.prev = _context.next) {
|
|
4798
|
-
case 0:
|
|
4799
|
-
if (!action) {
|
|
4800
|
-
_context.next = 7;
|
|
4801
|
-
break;
|
|
4802
|
-
}
|
|
4803
|
-
_context.next = 3;
|
|
4804
|
-
return deleteThingThen(action);
|
|
4805
|
-
case 3:
|
|
4806
|
-
action = null;
|
|
4807
|
-
setColor();
|
|
4808
|
-
_context.next = 25;
|
|
4809
|
-
break;
|
|
4810
|
-
case 7:
|
|
4811
|
-
// no action
|
|
4812
|
-
action = widgets.newThing(doc);
|
|
4813
|
-
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)];
|
|
4814
|
-
_context.next = 11;
|
|
4815
|
-
return _solidLogic.store.updater.update([], insertMe);
|
|
4816
|
-
case 11:
|
|
4817
|
-
setColor();
|
|
4818
|
-
if (!mutuallyExclusive) {
|
|
4819
|
-
_context.next = 25;
|
|
4820
|
-
break;
|
|
4821
|
-
}
|
|
4822
|
-
// Delete incompative sentiments
|
|
4823
|
-
dirty = false;
|
|
4824
|
-
i = 0;
|
|
4825
|
-
case 15:
|
|
4826
|
-
if (!(i < mutuallyExclusive.length)) {
|
|
4827
|
-
_context.next = 24;
|
|
4828
|
-
break;
|
|
4829
|
-
}
|
|
4830
|
-
a = existingAction(mutuallyExclusive[i]);
|
|
4831
|
-
if (!a) {
|
|
4832
|
-
_context.next = 21;
|
|
4833
|
-
break;
|
|
4834
|
-
}
|
|
4835
|
-
_context.next = 20;
|
|
4836
|
-
return deleteThingThen(a);
|
|
4837
|
-
case 20:
|
|
4838
|
-
// but how refresh? refreshTree the parent?
|
|
4839
|
-
dirty = true;
|
|
4840
|
-
case 21:
|
|
4841
|
-
i++;
|
|
4842
|
-
_context.next = 15;
|
|
4843
|
-
break;
|
|
4844
|
-
case 24:
|
|
4845
|
-
if (dirty) {
|
|
4846
|
-
// widgets.refreshTree(button.parentNode) // requires them all to be immediate siblings
|
|
4847
|
-
widgets.refreshTree(messageRow); // requires them all to be immediate siblings
|
|
4848
|
-
}
|
|
4849
|
-
case 25:
|
|
4850
|
-
case "end":
|
|
4851
|
-
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;
|
|
4852
5533
|
}
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
// THUMBS_UP_ICON
|
|
4878
|
-
// https://schema.org/AgreeAction
|
|
4879
|
-
me = _solidLogic.authn.currentUser(); // If already logged on
|
|
4880
|
-
// 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
|
|
4881
5557
|
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
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);
|
|
4900
5586
|
}
|
|
4901
5587
|
//# sourceMappingURL=messageTools.js.map
|
|
4902
5588
|
|
|
@@ -7155,11 +7841,13 @@ function renderSignInPopup(dom) {
|
|
|
7155
7841
|
issuerPopupBoxTopMenu.appendChild(issuerPopupBoxCloseButton);
|
|
7156
7842
|
var loginToIssuer = /*#__PURE__*/function () {
|
|
7157
7843
|
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(issuerUri) {
|
|
7158
|
-
var preLoginRedirectHash;
|
|
7844
|
+
var preLoginRedirectHash, locationUrl;
|
|
7159
7845
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
7160
7846
|
while (1) switch (_context.prev = _context.next) {
|
|
7161
7847
|
case 0:
|
|
7162
7848
|
_context.prev = 0;
|
|
7849
|
+
// clear authorization metadata from store
|
|
7850
|
+
_solidLogic.solidLogicSingleton.store.updater.flagAuthorizationMetadata();
|
|
7163
7851
|
// Save hash
|
|
7164
7852
|
preLoginRedirectHash = new URL(window.location.href).hash;
|
|
7165
7853
|
if (preLoginRedirectHash) {
|
|
@@ -7167,23 +7855,25 @@ function renderSignInPopup(dom) {
|
|
|
7167
7855
|
}
|
|
7168
7856
|
window.localStorage.setItem('loginIssuer', issuerUri);
|
|
7169
7857
|
// Login
|
|
7170
|
-
|
|
7858
|
+
locationUrl = new URL(window.location.href);
|
|
7859
|
+
locationUrl.hash = ''; // remove hash part
|
|
7860
|
+
_context.next = 9;
|
|
7171
7861
|
return _solidLogic.authSession.login({
|
|
7172
|
-
redirectUrl:
|
|
7862
|
+
redirectUrl: locationUrl.href,
|
|
7173
7863
|
oidcIssuer: issuerUri
|
|
7174
7864
|
});
|
|
7175
|
-
case
|
|
7176
|
-
_context.next =
|
|
7865
|
+
case 9:
|
|
7866
|
+
_context.next = 14;
|
|
7177
7867
|
break;
|
|
7178
|
-
case
|
|
7179
|
-
_context.prev =
|
|
7868
|
+
case 11:
|
|
7869
|
+
_context.prev = 11;
|
|
7180
7870
|
_context.t0 = _context["catch"](0);
|
|
7181
7871
|
(0, _log.alert)(_context.t0.message);
|
|
7182
|
-
case
|
|
7872
|
+
case 14:
|
|
7183
7873
|
case "end":
|
|
7184
7874
|
return _context.stop();
|
|
7185
7875
|
}
|
|
7186
|
-
}, _callee, null, [[0,
|
|
7876
|
+
}, _callee, null, [[0, 11]]);
|
|
7187
7877
|
}));
|
|
7188
7878
|
return function loginToIssuer(_x11) {
|
|
7189
7879
|
return _ref.apply(this, arguments);
|
|
@@ -7335,45 +8025,47 @@ _solidLogic.authSession.onLogout( /*#__PURE__*/(0, _asyncToGenerator2["default"]
|
|
|
7335
8025
|
case 0:
|
|
7336
8026
|
issuer = window.localStorage.getItem('loginIssuer');
|
|
7337
8027
|
if (!issuer) {
|
|
7338
|
-
_context2.next =
|
|
8028
|
+
_context2.next = 20;
|
|
7339
8029
|
break;
|
|
7340
8030
|
}
|
|
7341
8031
|
_context2.prev = 2;
|
|
8032
|
+
// clear authorization metadata from store
|
|
8033
|
+
_solidLogic.solidLogicSingleton.store.updater.flagAuthorizationMetadata();
|
|
7342
8034
|
wellKnownUri = new URL(issuer);
|
|
7343
8035
|
wellKnownUri.pathname = '/.well-known/openid-configuration';
|
|
7344
|
-
_context2.next =
|
|
8036
|
+
_context2.next = 8;
|
|
7345
8037
|
return fetch(wellKnownUri.toString());
|
|
7346
|
-
case
|
|
8038
|
+
case 8:
|
|
7347
8039
|
wellKnownResult = _context2.sent;
|
|
7348
8040
|
if (!(wellKnownResult.status === 200)) {
|
|
7349
|
-
_context2.next =
|
|
8041
|
+
_context2.next = 16;
|
|
7350
8042
|
break;
|
|
7351
8043
|
}
|
|
7352
|
-
_context2.next =
|
|
8044
|
+
_context2.next = 12;
|
|
7353
8045
|
return wellKnownResult.json();
|
|
7354
|
-
case
|
|
8046
|
+
case 12:
|
|
7355
8047
|
openidConfiguration = _context2.sent;
|
|
7356
8048
|
if (!(openidConfiguration && openidConfiguration.end_session_endpoint)) {
|
|
7357
|
-
_context2.next =
|
|
8049
|
+
_context2.next = 16;
|
|
7358
8050
|
break;
|
|
7359
8051
|
}
|
|
7360
|
-
_context2.next =
|
|
8052
|
+
_context2.next = 16;
|
|
7361
8053
|
return fetch(openidConfiguration.end_session_endpoint, {
|
|
7362
8054
|
credentials: 'include'
|
|
7363
8055
|
});
|
|
7364
|
-
case
|
|
7365
|
-
_context2.next =
|
|
8056
|
+
case 16:
|
|
8057
|
+
_context2.next = 20;
|
|
7366
8058
|
break;
|
|
7367
|
-
case
|
|
7368
|
-
_context2.prev =
|
|
8059
|
+
case 18:
|
|
8060
|
+
_context2.prev = 18;
|
|
7369
8061
|
_context2.t0 = _context2["catch"](2);
|
|
7370
|
-
case 19:
|
|
7371
|
-
window.location.reload();
|
|
7372
8062
|
case 20:
|
|
8063
|
+
window.location.reload();
|
|
8064
|
+
case 21:
|
|
7373
8065
|
case "end":
|
|
7374
8066
|
return _context2.stop();
|
|
7375
8067
|
}
|
|
7376
|
-
}, _callee2, null, [[2,
|
|
8068
|
+
}, _callee2, null, [[2, 18]]);
|
|
7377
8069
|
})));
|
|
7378
8070
|
|
|
7379
8071
|
/**
|
|
@@ -9730,6 +10422,10 @@ function recordSharedPreferences(subject, context) {
|
|
|
9730
10422
|
return new Promise(function (resolve, reject) {
|
|
9731
10423
|
var sharedPreferences = kb.any(subject, ns.ui('sharedPreferences'));
|
|
9732
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
|
+
}
|
|
9733
10429
|
var sp = $rdf.sym(subject.doc().uri + '#SharedPreferences');
|
|
9734
10430
|
var ins = [$rdf.st(subject, ns.ui('sharedPreferences'), sp, subject.doc())];
|
|
9735
10431
|
debug.log('Creating shared preferences ' + sp);
|
|
@@ -13119,17 +13815,17 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
13119
13815
|
}));
|
|
13120
13816
|
exports.versionInfo = void 0;
|
|
13121
13817
|
var versionInfo = {
|
|
13122
|
-
buildTime: '2023-
|
|
13123
|
-
commit: '
|
|
13818
|
+
buildTime: '2023-04-10T18:30:00Z',
|
|
13819
|
+
commit: '1319254891bf034d192639f541c3f12896636397',
|
|
13124
13820
|
npmInfo: {
|
|
13125
|
-
'solid-ui': '2.4.
|
|
13821
|
+
'solid-ui': '2.4.27',
|
|
13126
13822
|
npm: '8.19.4',
|
|
13127
|
-
node: '16.
|
|
13128
|
-
v8: '9.4.146.26-node.
|
|
13823
|
+
node: '16.20.0',
|
|
13824
|
+
v8: '9.4.146.26-node.26',
|
|
13129
13825
|
uv: '1.43.0',
|
|
13130
13826
|
zlib: '1.2.11',
|
|
13131
13827
|
brotli: '1.0.9',
|
|
13132
|
-
ares: '1.
|
|
13828
|
+
ares: '1.19.0',
|
|
13133
13829
|
modules: '93',
|
|
13134
13830
|
nghttp2: '1.47.0',
|
|
13135
13831
|
napi: '8',
|
|
@@ -15671,7 +16367,7 @@ _fieldFunction.field[ns.ui('Classifier').uri] = function (dom, container, alread
|
|
|
15671
16367
|
** <select id=dropDownSelect>
|
|
15672
16368
|
** <option> ....
|
|
15673
16369
|
** <subForm>
|
|
15674
|
-
** Alternative implementatons
|
|
16370
|
+
** Alternative implementatons could be:
|
|
15675
16371
|
** -- pop-up menu (as here)
|
|
15676
16372
|
** -- radio buttons
|
|
15677
16373
|
** -- auto-complete typing
|
|
@@ -15712,11 +16408,11 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
15712
16408
|
subForm: subForm,
|
|
15713
16409
|
disambiguate: false
|
|
15714
16410
|
};
|
|
15715
|
-
function getSelectorOptions() {
|
|
16411
|
+
function getSelectorOptions(dataSource) {
|
|
15716
16412
|
var possible = [];
|
|
15717
16413
|
var possibleProperties;
|
|
15718
16414
|
possible = kb.each(undefined, ns.rdf('type'), uiFrom, formDoc);
|
|
15719
|
-
for (var x in findMembersNT(kb, uiFrom,
|
|
16415
|
+
for (var x in findMembersNT(kb, uiFrom, dataSource)) {
|
|
15720
16416
|
possible.push(kb.fromNT(x));
|
|
15721
16417
|
} // Use rdfs
|
|
15722
16418
|
|
|
@@ -15748,6 +16444,10 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
15748
16444
|
|
|
15749
16445
|
var multiSelect = kb.any(form, ui('multiselect')); // Optional
|
|
15750
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
|
+
|
|
15751
16451
|
var selector;
|
|
15752
16452
|
rhs.refresh = function () {
|
|
15753
16453
|
// from ui:property
|
|
@@ -15755,7 +16455,7 @@ _fieldFunction.field[ns.ui('Choice').uri] = function (dom, container, already, s
|
|
|
15755
16455
|
return object.value;
|
|
15756
16456
|
});
|
|
15757
16457
|
// from ui:from + ui:property
|
|
15758
|
-
var possibleOptions = getSelectorOptions();
|
|
16458
|
+
var possibleOptions = getSelectorOptions(dataSource);
|
|
15759
16459
|
possibleOptions.push(selectedOptions);
|
|
15760
16460
|
possibleOptions = sortByLabel(possibleOptions);
|
|
15761
16461
|
selector = makeSelectForChoice(dom, rhs, kb, subject, property, possibleOptions, selectedOptions, uiFrom, opts, dataDoc, callbackFunction);
|
|
@@ -25557,7 +26257,10 @@ function removeOidcQueryParam(redirectUrl) {
|
|
|
25557
26257
|
cleanedUrl.searchParams.delete("code");
|
|
25558
26258
|
cleanedUrl.searchParams.delete("state");
|
|
25559
26259
|
cleanedUrl.hash = "";
|
|
25560
|
-
|
|
26260
|
+
if (redirectUrl.includes(`${cleanedUrl.origin}/`)) {
|
|
26261
|
+
return cleanedUrl.href;
|
|
26262
|
+
}
|
|
26263
|
+
return `${cleanedUrl.origin}${cleanedUrl.href.substring(cleanedUrl.origin.length + 1)}`;
|
|
25561
26264
|
}
|
|
25562
26265
|
async function clearOidcPersistentStorage() {
|
|
25563
26266
|
const client = new _inrupt_oidc_client__WEBPACK_IMPORTED_MODULE_0__.OidcClient({
|
|
@@ -26225,7 +26928,7 @@ class IssuerConfigFetcher {
|
|
|
26225
26928
|
}
|
|
26226
26929
|
async fetchConfig(issuer) {
|
|
26227
26930
|
let issuerConfig;
|
|
26228
|
-
const openIdConfigUrl = new URL(exports.WELL_KNOWN_OPENID_CONFIG, issuer).href;
|
|
26931
|
+
const openIdConfigUrl = new URL(exports.WELL_KNOWN_OPENID_CONFIG, issuer.endsWith("/") ? issuer : `${issuer}/`).href;
|
|
26229
26932
|
const issuerConfigRequestBody = await window.fetch(openIdConfigUrl);
|
|
26230
26933
|
try {
|
|
26231
26934
|
issuerConfig = processConfig(await issuerConfigRequestBody.json());
|
|
@@ -26402,12 +27105,6 @@ class AuthCodeRedirectHandler {
|
|
|
26402
27105
|
webId: tokens.webId,
|
|
26403
27106
|
isLoggedIn: "true",
|
|
26404
27107
|
}, { secure: true });
|
|
26405
|
-
url.searchParams.delete("code");
|
|
26406
|
-
await this.storageUtility.setForUser(storedSessionId, {
|
|
26407
|
-
redirectUrl: url.toString(),
|
|
26408
|
-
}, {
|
|
26409
|
-
secure: false,
|
|
26410
|
-
});
|
|
26411
27108
|
const sessionInfo = await this.sessionInfoManager.get(storedSessionId);
|
|
26412
27109
|
if (!sessionInfo) {
|
|
26413
27110
|
throw new Error(`Could not retrieve session: [${storedSessionId}].`);
|
|
@@ -52249,7 +52946,6 @@ var BlankNode = /*#__PURE__*/function (_Node) {
|
|
|
52249
52946
|
function getId(id) {
|
|
52250
52947
|
if (id) {
|
|
52251
52948
|
if (typeof id !== 'string') {
|
|
52252
|
-
console.log('Bad blank id:', id);
|
|
52253
52949
|
throw new Error('Bad id argument to new blank node: ' + id);
|
|
52254
52950
|
}
|
|
52255
52951
|
if (id.includes('#')) {
|
|
@@ -53596,7 +54292,9 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
53596
54292
|
if (!this._fetch) {
|
|
53597
54293
|
throw new Error('No _fetch function available for Fetcher');
|
|
53598
54294
|
}
|
|
53599
|
-
|
|
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
|
|
53600
54298
|
this.store.fetcher = this; // Bi-linked
|
|
53601
54299
|
this.requested = {};
|
|
53602
54300
|
this.timeouts = {};
|
|
@@ -53876,7 +54574,7 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
53876
54574
|
size: 0,
|
|
53877
54575
|
timeout: 0
|
|
53878
54576
|
};
|
|
53879
|
-
console.log('Fetcher: <' + actualProxyURI + '> Non-HTTP fetch exception: ' + error)
|
|
54577
|
+
// console.log('Fetcher: <' + actualProxyURI + '> Non-HTTP fetch exception: ' + error)
|
|
53880
54578
|
return _this5.handleError(dummyResponse, docuri, options); // possible credentials retry
|
|
53881
54579
|
// return this.failFetch(options, 'fetch failed: ' + error, 999, dummyResponse) // Fake status code: fetch exception
|
|
53882
54580
|
|
|
@@ -53937,25 +54635,21 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
53937
54635
|
if (fetchResponse.ok) {
|
|
53938
54636
|
userCallback(true, 'OK', fetchResponse);
|
|
53939
54637
|
} else {
|
|
53940
|
-
// console.log('@@@ fetcher.js Should not take this path !!!!!!!!!!!!')
|
|
53941
54638
|
var oops = 'HTTP error: Status ' + fetchResponse.status + ' (' + fetchResponse.statusText + ')';
|
|
53942
54639
|
if (fetchResponse.responseText) {
|
|
53943
54640
|
oops += ' ' + fetchResponse.responseText; // not in 404, dns error, nock failure
|
|
53944
54641
|
}
|
|
53945
54642
|
|
|
53946
|
-
console.log(oops + ' fetching ' + uri);
|
|
53947
54643
|
userCallback(false, oops, fetchResponse);
|
|
53948
54644
|
}
|
|
53949
54645
|
} else {
|
|
53950
54646
|
var _oops = '@@ nowOrWhenFetched: no response object!';
|
|
53951
|
-
console.log(_oops);
|
|
53952
54647
|
userCallback(false, _oops);
|
|
53953
54648
|
}
|
|
53954
54649
|
}
|
|
53955
54650
|
}, function (err) {
|
|
53956
54651
|
var message = err.message || err.statusText;
|
|
53957
54652
|
message = 'Failed to load <' + uri + '> ' + message;
|
|
53958
|
-
console.log(message);
|
|
53959
54653
|
if (err.response && err.response.status) {
|
|
53960
54654
|
message += ' status: ' + err.response.status;
|
|
53961
54655
|
}
|
|
@@ -54194,45 +54888,42 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
54194
54888
|
return fetcher.load(doc);
|
|
54195
54889
|
case 6:
|
|
54196
54890
|
response = _context2.sent;
|
|
54197
|
-
_context2.next =
|
|
54891
|
+
_context2.next = 26;
|
|
54198
54892
|
break;
|
|
54199
54893
|
case 9:
|
|
54200
54894
|
_context2.prev = 9;
|
|
54201
54895
|
_context2.t0 = _context2["catch"](3);
|
|
54202
54896
|
if (!(_context2.t0.response.status === 404)) {
|
|
54203
|
-
_context2.next =
|
|
54897
|
+
_context2.next = 25;
|
|
54204
54898
|
break;
|
|
54205
54899
|
}
|
|
54206
|
-
|
|
54207
|
-
_context2.
|
|
54208
|
-
_context2.next = 16;
|
|
54900
|
+
_context2.prev = 12;
|
|
54901
|
+
_context2.next = 15;
|
|
54209
54902
|
return fetcher.webOperation('PUT', doc.value, {
|
|
54210
54903
|
data: data,
|
|
54211
54904
|
contentType: contentType
|
|
54212
54905
|
});
|
|
54213
|
-
case
|
|
54906
|
+
case 15:
|
|
54214
54907
|
response = _context2.sent;
|
|
54215
|
-
_context2.next =
|
|
54908
|
+
_context2.next = 21;
|
|
54216
54909
|
break;
|
|
54217
|
-
case
|
|
54218
|
-
_context2.prev =
|
|
54219
|
-
_context2.t1 = _context2["catch"](
|
|
54220
|
-
console.log('createIfNotExists doc FAILED: ' + doc + ': ' + _context2.t1);
|
|
54910
|
+
case 18:
|
|
54911
|
+
_context2.prev = 18;
|
|
54912
|
+
_context2.t1 = _context2["catch"](12);
|
|
54221
54913
|
throw _context2.t1;
|
|
54222
|
-
case
|
|
54914
|
+
case 21:
|
|
54223
54915
|
delete fetcher.requested[doc.value]; // delete cached 404 error
|
|
54224
54916
|
// console.log('createIfNotExists doc created ok ' + doc)
|
|
54225
54917
|
return _context2.abrupt("return", response);
|
|
54226
|
-
case
|
|
54227
|
-
console.log('createIfNotExists doc load error NOT 404: ' + doc + ': ' + _context2.t0);
|
|
54918
|
+
case 25:
|
|
54228
54919
|
throw _context2.t0;
|
|
54229
|
-
case
|
|
54920
|
+
case 26:
|
|
54230
54921
|
return _context2.abrupt("return", response);
|
|
54231
|
-
case
|
|
54922
|
+
case 27:
|
|
54232
54923
|
case "end":
|
|
54233
54924
|
return _context2.stop();
|
|
54234
54925
|
}
|
|
54235
|
-
}, _callee2, this, [[3, 9], [
|
|
54926
|
+
}, _callee2, this, [[3, 9], [12, 18]]);
|
|
54236
54927
|
}));
|
|
54237
54928
|
function createIfNotExists(_x4) {
|
|
54238
54929
|
return _createIfNotExists.apply(this, arguments);
|
|
@@ -54435,17 +55126,19 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
54435
55126
|
var _this10 = this;
|
|
54436
55127
|
var kb = this.store;
|
|
54437
55128
|
var responseNode = kb.bnode();
|
|
54438
|
-
kb.add(options.req, this.ns.link('response'), responseNode,
|
|
54439
|
-
kb.add(responseNode, this.ns.http('status'), kb.rdfFactory.literal(response.status),
|
|
54440
|
-
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);
|
|
54441
55132
|
|
|
54442
55133
|
// Save the response headers
|
|
54443
55134
|
response.headers.forEach(function (value, header) {
|
|
54444
|
-
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);
|
|
54445
55136
|
if (header === 'content-type') {
|
|
54446
|
-
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
|
+
);
|
|
54447
55139
|
}
|
|
54448
55140
|
});
|
|
55141
|
+
|
|
54449
55142
|
return responseNode;
|
|
54450
55143
|
}
|
|
54451
55144
|
}, {
|
|
@@ -54541,7 +55234,8 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
54541
55234
|
}, {
|
|
54542
55235
|
key: "retryNoCredentials",
|
|
54543
55236
|
value: function retryNoCredentials(docuri, options) {
|
|
54544
|
-
console.log('Fetcher: CORS: RETRYING with NO CREDENTIALS for ' + options.resource)
|
|
55237
|
+
// console.log('Fetcher: CORS: RETRYING with NO CREDENTIALS for ' + options.resource)
|
|
55238
|
+
|
|
54545
55239
|
options.retriedWithNoCredentials = true; // protect against being called twice
|
|
54546
55240
|
|
|
54547
55241
|
delete this.requested[docuri]; // forget the original request happened
|
|
@@ -54586,7 +55280,7 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
54586
55280
|
// Now attempt retry via proxy
|
|
54587
55281
|
var proxyUri = Fetcher.crossSiteProxy(docuri);
|
|
54588
55282
|
if (proxyUri && !options.proxyUsed) {
|
|
54589
|
-
console.log('web: Direct failed so trying proxy ' + proxyUri)
|
|
55283
|
+
// console.log('web: Direct failed so trying proxy ' + proxyUri)
|
|
54590
55284
|
return this.redirectToProxy(proxyUri, options);
|
|
54591
55285
|
}
|
|
54592
55286
|
}
|
|
@@ -54659,7 +55353,7 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
54659
55353
|
|
|
54660
55354
|
// Check for masked errors (CORS, etc)
|
|
54661
55355
|
if (response.status === 0) {
|
|
54662
|
-
console.log('Masked error - status 0 for ' + docuri)
|
|
55356
|
+
// console.log('Masked error - status 0 for ' + docuri)
|
|
54663
55357
|
return this.handleError(response, docuri, options);
|
|
54664
55358
|
}
|
|
54665
55359
|
if (response.status >= 400) {
|
|
@@ -55546,7 +56240,6 @@ var Formula = /*#__PURE__*/function (_Node) {
|
|
|
55546
56240
|
while (todo.length) {
|
|
55547
56241
|
follow(todo.shift());
|
|
55548
56242
|
}
|
|
55549
|
-
// console.log('' + result.length + ' statements about ' + subject)
|
|
55550
56243
|
return result;
|
|
55551
56244
|
}
|
|
55552
56245
|
|
|
@@ -55703,10 +56396,10 @@ var Formula = /*#__PURE__*/function (_Node) {
|
|
|
55703
56396
|
var statementsCopy = this.statements.map(function (ea) {
|
|
55704
56397
|
return ea.substitute(bindings);
|
|
55705
56398
|
});
|
|
55706
|
-
console.log('Formula subs statmnts:' + statementsCopy)
|
|
56399
|
+
// console.log('Formula subs statmnts:' + statementsCopy)
|
|
55707
56400
|
var y = new Formula();
|
|
55708
56401
|
y.addAll(statementsCopy);
|
|
55709
|
-
console.log('indexed-form subs formula:' + y)
|
|
56402
|
+
// console.log('indexed-form subs formula:' + y)
|
|
55710
56403
|
return y;
|
|
55711
56404
|
}
|
|
55712
56405
|
}, {
|
|
@@ -58518,7 +59211,6 @@ var Node = /*#__PURE__*/function () {
|
|
|
58518
59211
|
(0,_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__["default"])(Node, [{
|
|
58519
59212
|
key: "substitute",
|
|
58520
59213
|
value: function substitute(bindings) {
|
|
58521
|
-
console.log('@@@ node substitute' + this);
|
|
58522
59214
|
return this;
|
|
58523
59215
|
}
|
|
58524
59216
|
|
|
@@ -62929,7 +63621,7 @@ var Statement = /*#__PURE__*/function () {
|
|
|
62929
63621
|
key: "substitute",
|
|
62930
63622
|
value: function substitute(bindings) {
|
|
62931
63623
|
var y = new Statement(this.subject.substitute(bindings), this.predicate.substitute(bindings), this.object.substitute(bindings), (0,_default_graph__WEBPACK_IMPORTED_MODULE_3__.isDefaultGraph)(this.graph) ? this.graph : this.graph.substitute(bindings)); // 2016
|
|
62932
|
-
console.log('@@@ statement substitute:' + y)
|
|
63624
|
+
// console.log('@@@ statement substitute:' + y)
|
|
62933
63625
|
return y;
|
|
62934
63626
|
}
|
|
62935
63627
|
|
|
@@ -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) {
|
|
@@ -67054,7 +67832,7 @@ var SolidAuthnLogic = /** @class */ (function () {
|
|
|
67054
67832
|
*/
|
|
67055
67833
|
SolidAuthnLogic.prototype.checkUser = function (setUserCallback) {
|
|
67056
67834
|
return __awaiter(this, void 0, void 0, function () {
|
|
67057
|
-
var preLoginRedirectHash, postLoginRedirectHash, curUrl, me, webId;
|
|
67835
|
+
var preLoginRedirectHash, redirectUrl, postLoginRedirectHash, curUrl, me, webId;
|
|
67058
67836
|
return __generator(this, function (_a) {
|
|
67059
67837
|
switch (_a.label) {
|
|
67060
67838
|
case 0:
|
|
@@ -67066,20 +67844,16 @@ var SolidAuthnLogic = /** @class */ (function () {
|
|
|
67066
67844
|
if (document.location.toString() !== url)
|
|
67067
67845
|
history.replaceState(null, '', url);
|
|
67068
67846
|
});
|
|
67069
|
-
|
|
67070
|
-
|
|
67071
|
-
*/
|
|
67847
|
+
redirectUrl = new URL(window.location.href);
|
|
67848
|
+
redirectUrl.hash = '';
|
|
67072
67849
|
return [4 /*yield*/, this.session
|
|
67073
67850
|
.handleIncomingRedirect({
|
|
67074
67851
|
restorePreviousSession: true,
|
|
67075
|
-
url:
|
|
67852
|
+
url: redirectUrl.href
|
|
67076
67853
|
})
|
|
67077
67854
|
// Check to see if a hash was stored in local storage
|
|
67078
67855
|
];
|
|
67079
67856
|
case 1:
|
|
67080
|
-
/**
|
|
67081
|
-
* Handle a successful authentication redirect
|
|
67082
|
-
*/
|
|
67083
67857
|
_a.sent();
|
|
67084
67858
|
postLoginRedirectHash = window.localStorage.getItem('preLoginRedirectHash');
|
|
67085
67859
|
if (postLoginRedirectHash) {
|
|
@@ -75179,33 +75953,21 @@ class RemoteJWKSet extends _local_js__WEBPACK_IMPORTED_MODULE_3__.LocalJWKSet {
|
|
|
75179
75953
|
}
|
|
75180
75954
|
async reload() {
|
|
75181
75955
|
if (this._pendingFetch && (0,_runtime_env_js__WEBPACK_IMPORTED_MODULE_1__.isCloudflareWorkers)()) {
|
|
75182
|
-
|
|
75183
|
-
const isDone = () => {
|
|
75184
|
-
if (this._pendingFetch === undefined) {
|
|
75185
|
-
resolve();
|
|
75186
|
-
}
|
|
75187
|
-
else {
|
|
75188
|
-
setTimeout(isDone, 5);
|
|
75189
|
-
}
|
|
75190
|
-
};
|
|
75191
|
-
isDone();
|
|
75192
|
-
});
|
|
75193
|
-
}
|
|
75194
|
-
if (!this._pendingFetch) {
|
|
75195
|
-
this._pendingFetch = (0,_runtime_fetch_jwks_js__WEBPACK_IMPORTED_MODULE_0__["default"])(this._url, this._timeoutDuration, this._options)
|
|
75196
|
-
.then((json) => {
|
|
75197
|
-
if (!(0,_local_js__WEBPACK_IMPORTED_MODULE_3__.isJWKSLike)(json)) {
|
|
75198
|
-
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JWKSInvalid('JSON Web Key Set malformed');
|
|
75199
|
-
}
|
|
75200
|
-
this._jwks = { keys: json.keys };
|
|
75201
|
-
this._jwksTimestamp = Date.now();
|
|
75202
|
-
this._pendingFetch = undefined;
|
|
75203
|
-
})
|
|
75204
|
-
.catch((err) => {
|
|
75205
|
-
this._pendingFetch = undefined;
|
|
75206
|
-
throw err;
|
|
75207
|
-
});
|
|
75956
|
+
this._pendingFetch = undefined;
|
|
75208
75957
|
}
|
|
75958
|
+
this._pendingFetch || (this._pendingFetch = (0,_runtime_fetch_jwks_js__WEBPACK_IMPORTED_MODULE_0__["default"])(this._url, this._timeoutDuration, this._options)
|
|
75959
|
+
.then((json) => {
|
|
75960
|
+
if (!(0,_local_js__WEBPACK_IMPORTED_MODULE_3__.isJWKSLike)(json)) {
|
|
75961
|
+
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JWKSInvalid('JSON Web Key Set malformed');
|
|
75962
|
+
}
|
|
75963
|
+
this._jwks = { keys: json.keys };
|
|
75964
|
+
this._jwksTimestamp = Date.now();
|
|
75965
|
+
this._pendingFetch = undefined;
|
|
75966
|
+
})
|
|
75967
|
+
.catch((err) => {
|
|
75968
|
+
this._pendingFetch = undefined;
|
|
75969
|
+
throw err;
|
|
75970
|
+
}));
|
|
75209
75971
|
await this._pendingFetch;
|
|
75210
75972
|
}
|
|
75211
75973
|
}
|
|
@@ -79232,6 +79994,8 @@ module.exports = JSON.parse('{"application/1d-interleaved-parityfec":{"source":"
|
|
|
79232
79994
|
/******/ // This entry module is referenced by other modules so it can't be inlined
|
|
79233
79995
|
/******/ var __webpack_exports__ = __webpack_require__("./lib/index.js");
|
|
79234
79996
|
/******/
|
|
79997
|
+
/******/ return __webpack_exports__;
|
|
79235
79998
|
/******/ })()
|
|
79236
79999
|
;
|
|
79237
|
-
|
|
80000
|
+
});
|
|
80001
|
+
//# sourceMappingURL=solid-ui.js.map
|