solid-ui 2.4.25 → 2.4.26-068520ea
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +1866 -1158
- package/dist/main.js.map +1 -1
- package/lib/acl/access-controller.js.map +1 -1
- package/lib/acl/access-groups.js.map +1 -1
- package/lib/acl/acl-control.js.map +1 -1
- package/lib/acl/acl.js.map +1 -1
- package/lib/acl/add-agent-buttons.js.map +1 -1
- package/lib/acl/index.js.map +1 -1
- package/lib/acl/styles.js.map +1 -1
- package/lib/chat/bookmarks.js +6 -7
- package/lib/chat/bookmarks.js.map +1 -1
- package/lib/chat/chatLogic.js +250 -61
- package/lib/chat/chatLogic.js.map +1 -1
- package/lib/chat/dateFolder.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/create/create.js.map +1 -1
- package/lib/create/index.js.map +1 -1
- package/lib/debug.js.map +1 -1
- package/lib/folders.js.map +1 -1
- package/lib/footer/index.js.map +1 -1
- package/lib/footer/styleMap.js.map +1 -1
- package/lib/header/empty-profile.js.map +1 -1
- package/lib/header/index.js.map +1 -1
- package/lib/header/styleMap.js.map +1 -1
- package/lib/iconBase.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/jss/index.js.map +1 -1
- package/lib/log.js +7 -7
- package/lib/log.js.map +1 -1
- package/lib/login/login.js.map +1 -1
- package/lib/matrix/index.js.map +1 -1
- package/lib/matrix/matrix.js.map +1 -1
- package/lib/media/index.js.map +1 -1
- package/lib/media/media-capture.js.map +1 -1
- package/lib/messageArea.js.map +1 -1
- package/lib/noun_Camera_1618446_000000.js.map +1 -1
- package/lib/ns.js.map +1 -1
- package/lib/pad.js.map +1 -1
- package/lib/participation.js.map +1 -1
- package/lib/preferences.js +4 -0
- package/lib/preferences.js.map +1 -1
- package/lib/signup/config-default.js.map +1 -1
- package/lib/signup/signup.js.map +1 -1
- package/lib/stories/decorators.js.map +1 -1
- package/lib/style.js.map +1 -1
- package/lib/style_multiSelect.js.map +1 -1
- package/lib/table.js.map +1 -1
- package/lib/tabs.js.map +1 -1
- package/lib/utils/headerFooterHelpers.js.map +1 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/label.js.map +1 -1
- package/lib/versionInfo.d.ts +2 -0
- package/lib/versionInfo.d.ts.map +1 -1
- package/lib/versionInfo.js +17 -15
- package/lib/versionInfo.js.map +1 -1
- package/lib/widgets/buttons/iconLinks.js.map +1 -1
- package/lib/widgets/buttons.js.map +1 -1
- package/lib/widgets/dragAndDrop.js.map +1 -1
- package/lib/widgets/error.js.map +1 -1
- package/lib/widgets/forms/autocomplete/autocompleteBar.js.map +1 -1
- package/lib/widgets/forms/autocomplete/autocompleteField.js.map +1 -1
- package/lib/widgets/forms/autocomplete/autocompletePicker.js.map +1 -1
- package/lib/widgets/forms/autocomplete/language.js.map +1 -1
- package/lib/widgets/forms/autocomplete/publicData.js.map +1 -1
- package/lib/widgets/forms/basic.js.map +1 -1
- package/lib/widgets/forms/comment.js.map +1 -1
- package/lib/widgets/forms/fieldFunction.js.map +1 -1
- package/lib/widgets/forms/fieldParams.js.map +1 -1
- package/lib/widgets/forms/formStyle.js.map +1 -1
- package/lib/widgets/forms.js.map +1 -1
- package/lib/widgets/index.js.map +1 -1
- package/lib/widgets/multiSelect.js.map +1 -1
- package/lib/widgets/peoplePicker.js.map +1 -1
- package/lib/widgets/widgetHelpers.js.map +1 -1
- package/package.json +20 -19
package/dist/main.js
CHANGED
|
@@ -2275,8 +2275,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
2275
2275
|
* @packageDocumentation
|
|
2276
2276
|
*/
|
|
2277
2277
|
|
|
2278
|
-
/* global alert confirm */
|
|
2279
|
-
|
|
2280
2278
|
// pull in first avoid cross-refs
|
|
2281
2279
|
|
|
2282
2280
|
var UI = {
|
|
@@ -2369,7 +2367,8 @@ function _findBookmarkDocument() {
|
|
|
2369
2367
|
}
|
|
2370
2368
|
userContext.bookmarkDocument = userContext.instances[0];
|
|
2371
2369
|
if (userContext.instances.length > 1) {
|
|
2372
|
-
|
|
2370
|
+
debug.warn('More than one bookmark file! ' + userContext.instances); // @@ todo - deal with > 1
|
|
2371
|
+
// Note should pick up community bookmarks as well
|
|
2373
2372
|
}
|
|
2374
2373
|
_context.next = 28;
|
|
2375
2374
|
break;
|
|
@@ -2390,7 +2389,7 @@ function _findBookmarkDocument() {
|
|
|
2390
2389
|
case 18:
|
|
2391
2390
|
_context.prev = 18;
|
|
2392
2391
|
_context.t0 = _context["catch"](12);
|
|
2393
|
-
|
|
2392
|
+
debug.warn("Can't make fresh bookmark file:" + _context.t0);
|
|
2394
2393
|
return _context.abrupt("return", userContext);
|
|
2395
2394
|
case 22:
|
|
2396
2395
|
_context.next = 24;
|
|
@@ -2400,7 +2399,7 @@ function _findBookmarkDocument() {
|
|
|
2400
2399
|
_context.next = 28;
|
|
2401
2400
|
break;
|
|
2402
2401
|
case 27:
|
|
2403
|
-
|
|
2402
|
+
debug.warn('You seem to have no bookmark file and not even a profile file.');
|
|
2404
2403
|
case 28:
|
|
2405
2404
|
return _context.abrupt("return", userContext);
|
|
2406
2405
|
case 29:
|
|
@@ -2455,7 +2454,7 @@ function _addBookmark() {
|
|
|
2455
2454
|
_context2.prev = 14;
|
|
2456
2455
|
_context2.t0 = _context2["catch"](9);
|
|
2457
2456
|
msg = 'Making bookmark: ' + _context2.t0;
|
|
2458
|
-
|
|
2457
|
+
debug.warn(msg);
|
|
2459
2458
|
return _context2.abrupt("return", null);
|
|
2460
2459
|
case 19:
|
|
2461
2460
|
return _context2.abrupt("return", bookmark);
|
|
@@ -2508,7 +2507,7 @@ function _toggleBookmark() {
|
|
|
2508
2507
|
_context3.prev = 15;
|
|
2509
2508
|
_context3.t0 = _context3["catch"](8);
|
|
2510
2509
|
debug.error('Cant delete bookmark:' + _context3.t0);
|
|
2511
|
-
|
|
2510
|
+
debug.warn('Cant delete bookmark:' + _context3.t0);
|
|
2512
2511
|
case 19:
|
|
2513
2512
|
i++;
|
|
2514
2513
|
_context3.next = 7;
|
|
@@ -2603,6 +2602,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
2603
2602
|
}));
|
|
2604
2603
|
exports.ChatChannel = void 0;
|
|
2605
2604
|
exports._createIfNotExists = _createIfNotExists;
|
|
2605
|
+
exports.allVersions = allVersions;
|
|
2606
2606
|
exports.isDeleted = isDeleted;
|
|
2607
2607
|
exports.isHidden = isHidden;
|
|
2608
2608
|
exports.isReplaced = isReplaced;
|
|
@@ -2678,6 +2678,7 @@ var ChatChannel = /*#__PURE__*/function () {
|
|
|
2678
2678
|
var _this = this;
|
|
2679
2679
|
var oldMsg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
2680
2680
|
var deleteIt = arguments.length > 2 ? arguments[2] : undefined;
|
|
2681
|
+
var thread = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
2681
2682
|
return /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
2682
2683
|
var sts, now, timestamp, dateStamp, chatDocument, message, me, msg;
|
|
2683
2684
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
@@ -2690,41 +2691,61 @@ var ChatChannel = /*#__PURE__*/function () {
|
|
|
2690
2691
|
chatDocument = oldMsg ? oldMsg.doc() : _this.dateFolder.leafDocumentFromDate(now);
|
|
2691
2692
|
message = _solidLogic.store.sym(chatDocument.uri + '#' + 'Msg' + timestamp); // const content = store.literal(text)
|
|
2692
2693
|
me = _solidLogic.authn.currentUser(); // If already logged on
|
|
2693
|
-
if (oldMsg) {
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2694
|
+
if (!oldMsg) {
|
|
2695
|
+
_context2.next = 21;
|
|
2696
|
+
break;
|
|
2697
|
+
}
|
|
2698
|
+
_context2.t0 = sts;
|
|
2699
|
+
_context2.t1 = $rdf;
|
|
2700
|
+
_context2.next = 12;
|
|
2701
|
+
return mostRecentVersion(oldMsg);
|
|
2702
|
+
case 12:
|
|
2703
|
+
_context2.t2 = _context2.sent;
|
|
2704
|
+
_context2.t3 = ns.dct('isReplacedBy');
|
|
2705
|
+
_context2.t4 = message;
|
|
2706
|
+
_context2.t5 = chatDocument;
|
|
2707
|
+
_context2.t6 = _context2.t1.st.call(_context2.t1, _context2.t2, _context2.t3, _context2.t4, _context2.t5);
|
|
2708
|
+
_context2.t0.push.call(_context2.t0, _context2.t6);
|
|
2709
|
+
if (deleteIt) {
|
|
2710
|
+
sts.push($rdf.st(message, ns.schema('dateDeleted'), dateStamp, chatDocument));
|
|
2702
2711
|
}
|
|
2712
|
+
_context2.next = 22;
|
|
2713
|
+
break;
|
|
2714
|
+
case 21:
|
|
2715
|
+
// link new message to channel
|
|
2716
|
+
sts.push($rdf.st(_this.channel, ns.wf('message'), message, chatDocument));
|
|
2717
|
+
case 22:
|
|
2703
2718
|
sts.push($rdf.st(message, ns.sioc('content'), _solidLogic.store.literal(text), chatDocument));
|
|
2704
2719
|
sts.push($rdf.st(message, ns.dct('created'), dateStamp, chatDocument));
|
|
2705
2720
|
if (me) {
|
|
2706
2721
|
sts.push($rdf.st(message, ns.foaf('maker'), me, chatDocument));
|
|
2707
2722
|
}
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2723
|
+
if (thread) {
|
|
2724
|
+
sts.push($rdf.st(thread, ns.sioc('has_member'), message, chatDocument));
|
|
2725
|
+
if (!thread.doc().sameTerm(message.doc())) {
|
|
2726
|
+
sts.push($rdf.st(thread, ns.sioc('has_member'), message, thread.doc()));
|
|
2727
|
+
}
|
|
2728
|
+
}
|
|
2729
|
+
_context2.prev = 26;
|
|
2730
|
+
_context2.next = 29;
|
|
2731
|
+
return _solidLogic.store.updater.updateMany([], sts);
|
|
2732
|
+
case 29:
|
|
2733
|
+
_context2.next = 37;
|
|
2713
2734
|
break;
|
|
2714
|
-
case
|
|
2715
|
-
_context2.prev =
|
|
2716
|
-
_context2.
|
|
2717
|
-
msg = 'Error saving chat message: ' + _context2.
|
|
2735
|
+
case 31:
|
|
2736
|
+
_context2.prev = 31;
|
|
2737
|
+
_context2.t7 = _context2["catch"](26);
|
|
2738
|
+
msg = 'Error saving chat message: ' + _context2.t7;
|
|
2718
2739
|
debug.warn(msg);
|
|
2719
2740
|
alert(msg);
|
|
2720
2741
|
throw new Error(msg);
|
|
2721
|
-
case
|
|
2742
|
+
case 37:
|
|
2722
2743
|
return _context2.abrupt("return", message);
|
|
2723
|
-
case
|
|
2744
|
+
case 38:
|
|
2724
2745
|
case "end":
|
|
2725
2746
|
return _context2.stop();
|
|
2726
2747
|
}
|
|
2727
|
-
}, _callee2, null, [[
|
|
2748
|
+
}, _callee2, null, [[26, 31]]);
|
|
2728
2749
|
})();
|
|
2729
2750
|
});
|
|
2730
2751
|
function updateMessage(_x2) {
|
|
@@ -2754,26 +2775,187 @@ var ChatChannel = /*#__PURE__*/function () {
|
|
|
2754
2775
|
return _deleteMessage.apply(this, arguments);
|
|
2755
2776
|
}
|
|
2756
2777
|
return deleteMessage;
|
|
2778
|
+
}() // Create a new thread of replies to the thread root message
|
|
2779
|
+
// or returns one which already exists
|
|
2780
|
+
}, {
|
|
2781
|
+
key: "createThread",
|
|
2782
|
+
value: function () {
|
|
2783
|
+
var _createThread = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(threadRoot) {
|
|
2784
|
+
var already, thread, insert;
|
|
2785
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
2786
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
2787
|
+
case 0:
|
|
2788
|
+
already = _solidLogic.store.each(threadRoot, ns.sioc('has_reply'), null, threadRoot.doc()).filter(function (thread) {
|
|
2789
|
+
return _solidLogic.store.holds(thread, ns.rdf('type'), ns.sioc('Thread'), thread.doc());
|
|
2790
|
+
});
|
|
2791
|
+
if (!(already.length > 0)) {
|
|
2792
|
+
_context4.next = 3;
|
|
2793
|
+
break;
|
|
2794
|
+
}
|
|
2795
|
+
return _context4.abrupt("return", already[0]);
|
|
2796
|
+
case 3:
|
|
2797
|
+
thread = $rdf.sym(threadRoot.uri + '-thread');
|
|
2798
|
+
insert = [$rdf.st(thread, ns.rdf('type'), ns.sioc('Thread'), thread.doc()), $rdf.st(threadRoot, ns.sioc('has_reply'), thread, thread.doc())];
|
|
2799
|
+
_context4.next = 7;
|
|
2800
|
+
return _solidLogic.store.updater.update([], insert);
|
|
2801
|
+
case 7:
|
|
2802
|
+
return _context4.abrupt("return", thread);
|
|
2803
|
+
case 8:
|
|
2804
|
+
case "end":
|
|
2805
|
+
return _context4.stop();
|
|
2806
|
+
}
|
|
2807
|
+
}, _callee4);
|
|
2808
|
+
}));
|
|
2809
|
+
function createThread(_x4) {
|
|
2810
|
+
return _createThread.apply(this, arguments);
|
|
2811
|
+
}
|
|
2812
|
+
return createThread;
|
|
2757
2813
|
}()
|
|
2758
2814
|
}]);
|
|
2759
2815
|
return ChatChannel;
|
|
2760
2816
|
}(); // class ChatChannel
|
|
2817
|
+
// ////////// Utility functions
|
|
2818
|
+
// Have to not loop forever if fed loops
|
|
2761
2819
|
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;
|
|
2820
|
+
function allVersions(_x5) {
|
|
2821
|
+
return _allVersions.apply(this, arguments);
|
|
2769
2822
|
}
|
|
2770
|
-
function
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2823
|
+
function _allVersions() {
|
|
2824
|
+
_allVersions = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(message) {
|
|
2825
|
+
var versions, done, m, prev, next;
|
|
2826
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
2827
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
2828
|
+
case 0:
|
|
2829
|
+
versions = [message];
|
|
2830
|
+
done = {};
|
|
2831
|
+
done[message.ur] = true;
|
|
2832
|
+
m = message;
|
|
2833
|
+
case 4:
|
|
2834
|
+
if (false) {}
|
|
2835
|
+
// earlier?
|
|
2836
|
+
prev = _solidLogic.store.any(null, ns.dct('isReplacedBy'), m, m.doc());
|
|
2837
|
+
if (!(!prev || done[prev.uri])) {
|
|
2838
|
+
_context5.next = 8;
|
|
2839
|
+
break;
|
|
2840
|
+
}
|
|
2841
|
+
return _context5.abrupt("break", 15);
|
|
2842
|
+
case 8:
|
|
2843
|
+
_context5.next = 10;
|
|
2844
|
+
return _solidLogic.store.fetcher.load(prev);
|
|
2845
|
+
case 10:
|
|
2846
|
+
versions.unshift(prev);
|
|
2847
|
+
done[prev.uri] = true;
|
|
2848
|
+
m = prev;
|
|
2849
|
+
_context5.next = 4;
|
|
2850
|
+
break;
|
|
2851
|
+
case 15:
|
|
2852
|
+
m = message;
|
|
2853
|
+
case 16:
|
|
2854
|
+
if (false) {}
|
|
2855
|
+
// later?
|
|
2856
|
+
next = _solidLogic.store.any(m, ns.dct('isReplacedBy'), null, m.doc());
|
|
2857
|
+
if (!(!next || done[next.uri])) {
|
|
2858
|
+
_context5.next = 20;
|
|
2859
|
+
break;
|
|
2860
|
+
}
|
|
2861
|
+
return _context5.abrupt("break", 25);
|
|
2862
|
+
case 20:
|
|
2863
|
+
versions.push(next);
|
|
2864
|
+
done[next.uri] = true;
|
|
2865
|
+
m = next;
|
|
2866
|
+
_context5.next = 16;
|
|
2867
|
+
break;
|
|
2868
|
+
case 25:
|
|
2869
|
+
return _context5.abrupt("return", versions);
|
|
2870
|
+
case 26:
|
|
2871
|
+
case "end":
|
|
2872
|
+
return _context5.stop();
|
|
2873
|
+
}
|
|
2874
|
+
}, _callee5);
|
|
2875
|
+
}));
|
|
2876
|
+
return _allVersions.apply(this, arguments);
|
|
2877
|
+
}
|
|
2878
|
+
function originalVersion(_x6) {
|
|
2879
|
+
return _originalVersion.apply(this, arguments);
|
|
2880
|
+
}
|
|
2881
|
+
function _originalVersion() {
|
|
2882
|
+
_originalVersion = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(message) {
|
|
2883
|
+
var msg, done;
|
|
2884
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
2885
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
2886
|
+
case 0:
|
|
2887
|
+
msg = message;
|
|
2888
|
+
done = {}; // done[message.ur] = true
|
|
2889
|
+
case 2:
|
|
2890
|
+
if (!msg) {
|
|
2891
|
+
_context6.next = 13;
|
|
2892
|
+
break;
|
|
2893
|
+
}
|
|
2894
|
+
if (!done[msg.uri]) {
|
|
2895
|
+
_context6.next = 6;
|
|
2896
|
+
break;
|
|
2897
|
+
}
|
|
2898
|
+
debug.error('originalVersion: verion loop' + message);
|
|
2899
|
+
return _context6.abrupt("return", message);
|
|
2900
|
+
case 6:
|
|
2901
|
+
done[msg.uri] = true;
|
|
2902
|
+
message = msg;
|
|
2903
|
+
_context6.next = 10;
|
|
2904
|
+
return _solidLogic.store.fetcher.load(message);
|
|
2905
|
+
case 10:
|
|
2906
|
+
msg = _solidLogic.store.any(null, ns.dct('isReplacedBy'), message, message.doc());
|
|
2907
|
+
_context6.next = 2;
|
|
2908
|
+
break;
|
|
2909
|
+
case 13:
|
|
2910
|
+
return _context6.abrupt("return", message);
|
|
2911
|
+
case 14:
|
|
2912
|
+
case "end":
|
|
2913
|
+
return _context6.stop();
|
|
2914
|
+
}
|
|
2915
|
+
}, _callee6);
|
|
2916
|
+
}));
|
|
2917
|
+
return _originalVersion.apply(this, arguments);
|
|
2918
|
+
}
|
|
2919
|
+
function mostRecentVersion(_x7) {
|
|
2920
|
+
return _mostRecentVersion.apply(this, arguments);
|
|
2921
|
+
}
|
|
2922
|
+
function _mostRecentVersion() {
|
|
2923
|
+
_mostRecentVersion = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(message) {
|
|
2924
|
+
var msg, done;
|
|
2925
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
2926
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
2927
|
+
case 0:
|
|
2928
|
+
msg = message;
|
|
2929
|
+
done = {};
|
|
2930
|
+
case 2:
|
|
2931
|
+
if (!msg) {
|
|
2932
|
+
_context7.next = 13;
|
|
2933
|
+
break;
|
|
2934
|
+
}
|
|
2935
|
+
if (!done[msg.uri]) {
|
|
2936
|
+
_context7.next = 6;
|
|
2937
|
+
break;
|
|
2938
|
+
}
|
|
2939
|
+
debug.error('mostRecentVersion: verion loop' + message);
|
|
2940
|
+
return _context7.abrupt("return", message);
|
|
2941
|
+
case 6:
|
|
2942
|
+
done[msg.uri] = true;
|
|
2943
|
+
message = msg;
|
|
2944
|
+
_context7.next = 10;
|
|
2945
|
+
return _solidLogic.store.fetcher.load(message);
|
|
2946
|
+
case 10:
|
|
2947
|
+
msg = _solidLogic.store.any(message, ns.dct('isReplacedBy'), null, message.doc());
|
|
2948
|
+
_context7.next = 2;
|
|
2949
|
+
break;
|
|
2950
|
+
case 13:
|
|
2951
|
+
return _context7.abrupt("return", message);
|
|
2952
|
+
case 14:
|
|
2953
|
+
case "end":
|
|
2954
|
+
return _context7.stop();
|
|
2955
|
+
}
|
|
2956
|
+
}, _callee7);
|
|
2957
|
+
}));
|
|
2958
|
+
return _mostRecentVersion.apply(this, arguments);
|
|
2777
2959
|
}
|
|
2778
2960
|
function isDeleted(message) {
|
|
2779
2961
|
return _solidLogic.store.holds(message, ns.schema('dateDeleted'), null, message.doc());
|
|
@@ -2792,62 +2974,62 @@ function nick(person) {
|
|
|
2792
2974
|
if (s) return '' + s.value;
|
|
2793
2975
|
return '' + utils.label(person);
|
|
2794
2976
|
}
|
|
2795
|
-
function _createIfNotExists(
|
|
2977
|
+
function _createIfNotExists(_x8) {
|
|
2796
2978
|
return _createIfNotExists2.apply(this, arguments);
|
|
2797
2979
|
} // ends
|
|
2798
2980
|
function _createIfNotExists2() {
|
|
2799
2981
|
_createIfNotExists2 = (0, _asyncToGenerator2["default"])(function (doc) {
|
|
2800
2982
|
var contentType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'text/turtle';
|
|
2801
2983
|
var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
2802
|
-
return /*#__PURE__*/_regenerator["default"].mark(function
|
|
2984
|
+
return /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
|
|
2803
2985
|
var response;
|
|
2804
|
-
return _regenerator["default"].wrap(function
|
|
2805
|
-
while (1) switch (
|
|
2986
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
2987
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
2806
2988
|
case 0:
|
|
2807
|
-
|
|
2808
|
-
|
|
2989
|
+
_context8.prev = 0;
|
|
2990
|
+
_context8.next = 3;
|
|
2809
2991
|
return _solidLogic.store.fetcher.load(doc);
|
|
2810
2992
|
case 3:
|
|
2811
|
-
response =
|
|
2812
|
-
|
|
2993
|
+
response = _context8.sent;
|
|
2994
|
+
_context8.next = 26;
|
|
2813
2995
|
break;
|
|
2814
2996
|
case 6:
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
if (!(
|
|
2818
|
-
|
|
2997
|
+
_context8.prev = 6;
|
|
2998
|
+
_context8.t0 = _context8["catch"](0);
|
|
2999
|
+
if (!(_context8.t0.response.status === 404)) {
|
|
3000
|
+
_context8.next = 24;
|
|
2819
3001
|
break;
|
|
2820
3002
|
}
|
|
2821
3003
|
debug.log('createIfNotExists: doc does NOT exist, will create... ' + doc);
|
|
2822
|
-
|
|
2823
|
-
|
|
3004
|
+
_context8.prev = 10;
|
|
3005
|
+
_context8.next = 13;
|
|
2824
3006
|
return _solidLogic.store.fetcher.webOperation('PUT', doc.uri, {
|
|
2825
3007
|
data: data,
|
|
2826
3008
|
contentType: contentType
|
|
2827
3009
|
});
|
|
2828
3010
|
case 13:
|
|
2829
|
-
response =
|
|
2830
|
-
|
|
3011
|
+
response = _context8.sent;
|
|
3012
|
+
_context8.next = 20;
|
|
2831
3013
|
break;
|
|
2832
3014
|
case 16:
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
debug.log('createIfNotExists doc FAILED: ' + doc + ': ' +
|
|
2836
|
-
throw
|
|
3015
|
+
_context8.prev = 16;
|
|
3016
|
+
_context8.t1 = _context8["catch"](10);
|
|
3017
|
+
debug.log('createIfNotExists doc FAILED: ' + doc + ': ' + _context8.t1);
|
|
3018
|
+
throw _context8.t1;
|
|
2837
3019
|
case 20:
|
|
2838
3020
|
delete _solidLogic.store.fetcher.requested[doc.uri]; // delete cached 404 error
|
|
2839
3021
|
// debug.log('createIfNotExists doc created ok ' + doc)
|
|
2840
|
-
return
|
|
3022
|
+
return _context8.abrupt("return", response);
|
|
2841
3023
|
case 24:
|
|
2842
|
-
debug.log('createIfNotExists doc load error NOT 404: ' + doc + ': ' +
|
|
2843
|
-
throw
|
|
3024
|
+
debug.log('createIfNotExists doc load error NOT 404: ' + doc + ': ' + _context8.t0);
|
|
3025
|
+
throw _context8.t0;
|
|
2844
3026
|
case 26:
|
|
2845
|
-
return
|
|
3027
|
+
return _context8.abrupt("return", response);
|
|
2846
3028
|
case 27:
|
|
2847
3029
|
case "end":
|
|
2848
|
-
return
|
|
3030
|
+
return _context8.stop();
|
|
2849
3031
|
}
|
|
2850
|
-
},
|
|
3032
|
+
}, _callee8, null, [[0, 6], [10, 16]]);
|
|
2851
3033
|
})();
|
|
2852
3034
|
});
|
|
2853
3035
|
return _createIfNotExists2.apply(this, arguments);
|
|
@@ -3225,19 +3407,9 @@ var _chatLogic = __webpack_require__(/*! ./chatLogic */ "./lib/chat/chatLogic.js
|
|
|
3225
3407
|
var _message = __webpack_require__(/*! ./message */ "./lib/chat/message.js");
|
|
3226
3408
|
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
3409
|
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
|
-
|
|
3410
|
+
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; } } }; }
|
|
3411
|
+
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); }
|
|
3412
|
+
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
3413
|
// const UI = { authn, icons, ns, media, pad, $rdf, store, style, utils, widgets }
|
|
3242
3414
|
|
|
3243
3415
|
function desktopNotification(str) {
|
|
@@ -3265,34 +3437,9 @@ function desktopNotification(str) {
|
|
|
3265
3437
|
/**
|
|
3266
3438
|
* Renders a chat message inside a `messageTable`
|
|
3267
3439
|
*/
|
|
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
|
-
}
|
|
3440
|
+
function insertMessageIntoTable(_x, _x2, _x3, _x4, _x5, _x6) {
|
|
3441
|
+
return _insertMessageIntoTable.apply(this, arguments);
|
|
3294
3442
|
}
|
|
3295
|
-
|
|
3296
3443
|
/**
|
|
3297
3444
|
* Common code for a chat (discussion area of messages about something)
|
|
3298
3445
|
* This version runs over a series of files for different time periods
|
|
@@ -3315,20 +3462,70 @@ function insertMessageIntoTable(channelObject, messageTable, message, fresh, opt
|
|
|
3315
3462
|
- inlineImageHeightEms: The height (in ems) of images expaned from their URIs in the chat.
|
|
3316
3463
|
|
|
3317
3464
|
*/
|
|
3318
|
-
function
|
|
3465
|
+
function _insertMessageIntoTable() {
|
|
3466
|
+
_insertMessageIntoTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(channelObject, messageTable, message, fresh, options, userContext) {
|
|
3467
|
+
var messageRow, done, ele, newestFirst, dateString;
|
|
3468
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
3469
|
+
while (1) switch (_context.prev = _context.next) {
|
|
3470
|
+
case 0:
|
|
3471
|
+
_context.next = 2;
|
|
3472
|
+
return (0, _message.renderMessageRow)(channelObject, message, fresh, options, userContext);
|
|
3473
|
+
case 2:
|
|
3474
|
+
messageRow = _context.sent;
|
|
3475
|
+
// const message = messageRow.AJAR_subject
|
|
3476
|
+
if (options.selectedMessage && options.selectedMessage.sameTerm(message)) {
|
|
3477
|
+
messageRow.style.backgroundColor = 'yellow';
|
|
3478
|
+
options.selectedElement = messageRow;
|
|
3479
|
+
messageTable.selectedElement = messageRow;
|
|
3480
|
+
}
|
|
3481
|
+
done = false;
|
|
3482
|
+
ele = messageTable.firstChild;
|
|
3483
|
+
case 6:
|
|
3484
|
+
if (ele) {
|
|
3485
|
+
_context.next = 8;
|
|
3486
|
+
break;
|
|
3487
|
+
}
|
|
3488
|
+
return _context.abrupt("break", 17);
|
|
3489
|
+
case 8:
|
|
3490
|
+
newestFirst = options.newestfirst === true;
|
|
3491
|
+
dateString = messageRow.AJAR_date;
|
|
3492
|
+
if (!(dateString > ele.AJAR_date && newestFirst || dateString < ele.AJAR_date && !newestFirst)) {
|
|
3493
|
+
_context.next = 14;
|
|
3494
|
+
break;
|
|
3495
|
+
}
|
|
3496
|
+
messageTable.insertBefore(messageRow, ele);
|
|
3497
|
+
done = true;
|
|
3498
|
+
return _context.abrupt("break", 17);
|
|
3499
|
+
case 14:
|
|
3500
|
+
ele = ele.nextSibling;
|
|
3501
|
+
_context.next = 6;
|
|
3502
|
+
break;
|
|
3503
|
+
case 17:
|
|
3504
|
+
if (!done) {
|
|
3505
|
+
messageTable.appendChild(messageRow);
|
|
3506
|
+
}
|
|
3507
|
+
case 18:
|
|
3508
|
+
case "end":
|
|
3509
|
+
return _context.stop();
|
|
3510
|
+
}
|
|
3511
|
+
}, _callee);
|
|
3512
|
+
}));
|
|
3513
|
+
return _insertMessageIntoTable.apply(this, arguments);
|
|
3514
|
+
}
|
|
3515
|
+
function infiniteMessageArea(_x7, _x8, _x9, _x10) {
|
|
3319
3516
|
return _infiniteMessageArea.apply(this, arguments);
|
|
3320
3517
|
}
|
|
3321
3518
|
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 (
|
|
3519
|
+
_infiniteMessageArea = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee15(dom, wasStore, chatChannel, options) {
|
|
3520
|
+
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;
|
|
3521
|
+
return _regenerator["default"].wrap(function _callee15$(_context15) {
|
|
3522
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
3326
3523
|
case 0:
|
|
3327
3524
|
_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 (
|
|
3525
|
+
_loadInitialContent = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14() {
|
|
3526
|
+
var yank, fixScroll, live, selectedDocument, threadRootDocument, initialDocment, now, todayDocument, selectedMessageTable, selectedDate;
|
|
3527
|
+
return _regenerator["default"].wrap(function _callee14$(_context14) {
|
|
3528
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
3332
3529
|
case 0:
|
|
3333
3530
|
fixScroll = function _fixScroll() {
|
|
3334
3531
|
if (options.selectedElement) {
|
|
@@ -3342,51 +3539,59 @@ function _infiniteMessageArea() {
|
|
|
3342
3539
|
}
|
|
3343
3540
|
};
|
|
3344
3541
|
yank = function _yank() {
|
|
3345
|
-
selectedMessageTable.selectedElement
|
|
3346
|
-
|
|
3347
|
-
|
|
3542
|
+
if (selectedMessageTable && selectedMessageTable.selectedElement) {
|
|
3543
|
+
selectedMessageTable.selectedElement.scrollIntoView({
|
|
3544
|
+
block: 'center'
|
|
3545
|
+
});
|
|
3546
|
+
}
|
|
3348
3547
|
};
|
|
3349
3548
|
if (options.selectedMessage) {
|
|
3350
3549
|
selectedDocument = options.selectedMessage.doc();
|
|
3550
|
+
}
|
|
3551
|
+
if (threadRootMessage) {
|
|
3552
|
+
threadRootDocument = threadRootMessage.doc();
|
|
3553
|
+
}
|
|
3554
|
+
initialDocment = selectedDocument || threadRootDocument;
|
|
3555
|
+
if (initialDocment) {
|
|
3351
3556
|
now = new Date();
|
|
3352
3557
|
todayDocument = dateFolder.leafDocumentFromDate(now);
|
|
3353
|
-
live = todayDocument.sameTerm(
|
|
3558
|
+
live = todayDocument.sameTerm(initialDocment);
|
|
3354
3559
|
}
|
|
3355
|
-
if (!(
|
|
3356
|
-
|
|
3560
|
+
if (!(initialDocment && !live)) {
|
|
3561
|
+
_context14.next = 18;
|
|
3357
3562
|
break;
|
|
3358
3563
|
}
|
|
3359
|
-
selectedDate = dateFolder.dateFromLeafDocument(
|
|
3360
|
-
|
|
3564
|
+
selectedDate = dateFolder.dateFromLeafDocument(initialDocment);
|
|
3565
|
+
_context14.next = 10;
|
|
3361
3566
|
return createMessageTable(selectedDate, live);
|
|
3362
|
-
case
|
|
3363
|
-
selectedMessageTable =
|
|
3567
|
+
case 10:
|
|
3568
|
+
selectedMessageTable = _context14.sent;
|
|
3364
3569
|
div.appendChild(selectedMessageTable);
|
|
3365
3570
|
earliest.messageTable = selectedMessageTable;
|
|
3366
3571
|
latest.messageTable = selectedMessageTable;
|
|
3367
3572
|
yank();
|
|
3368
3573
|
setTimeout(yank, 1000); // @@ kludge - restore position distubed by other cHANGES
|
|
3369
|
-
|
|
3574
|
+
_context14.next = 22;
|
|
3370
3575
|
break;
|
|
3371
|
-
case
|
|
3372
|
-
|
|
3576
|
+
case 18:
|
|
3577
|
+
_context14.next = 20;
|
|
3373
3578
|
return appendCurrentMessages();
|
|
3374
|
-
case
|
|
3579
|
+
case 20:
|
|
3375
3580
|
earliest.messageTable = liveMessageTable;
|
|
3376
3581
|
latest.messageTable = liveMessageTable;
|
|
3377
|
-
case
|
|
3378
|
-
|
|
3582
|
+
case 22:
|
|
3583
|
+
_context14.next = 24;
|
|
3379
3584
|
return loadMoreWhereNeeded(null, fixScroll);
|
|
3380
|
-
case
|
|
3585
|
+
case 24:
|
|
3381
3586
|
div.addEventListener('scroll', loadMoreWhereNeeded);
|
|
3382
3587
|
if (options.solo) {
|
|
3383
3588
|
document.body.addEventListener('scroll', loadMoreWhereNeeded);
|
|
3384
3589
|
}
|
|
3385
|
-
case
|
|
3590
|
+
case 26:
|
|
3386
3591
|
case "end":
|
|
3387
|
-
return
|
|
3592
|
+
return _context14.stop();
|
|
3388
3593
|
}
|
|
3389
|
-
},
|
|
3594
|
+
}, _callee14);
|
|
3390
3595
|
}));
|
|
3391
3596
|
return _loadInitialContent.apply(this, arguments);
|
|
3392
3597
|
};
|
|
@@ -3394,16 +3599,16 @@ function _infiniteMessageArea() {
|
|
|
3394
3599
|
return _loadInitialContent.apply(this, arguments);
|
|
3395
3600
|
};
|
|
3396
3601
|
_loadMoreWhereNeeded = function _loadMoreWhereNeeded3() {
|
|
3397
|
-
_loadMoreWhereNeeded = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3602
|
+
_loadMoreWhereNeeded = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13(event, fixScroll) {
|
|
3398
3603
|
var freeze, magicZone, done, scrollBottom, scrollTop;
|
|
3399
|
-
return _regenerator["default"].wrap(function
|
|
3400
|
-
while (1) switch (
|
|
3604
|
+
return _regenerator["default"].wrap(function _callee13$(_context13) {
|
|
3605
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
3401
3606
|
case 0:
|
|
3402
3607
|
if (!lock) {
|
|
3403
|
-
|
|
3608
|
+
_context13.next = 2;
|
|
3404
3609
|
break;
|
|
3405
3610
|
}
|
|
3406
|
-
return
|
|
3611
|
+
return _context13.abrupt("return");
|
|
3407
3612
|
case 2:
|
|
3408
3613
|
lock = true;
|
|
3409
3614
|
freeze = !fixScroll;
|
|
@@ -3411,36 +3616,36 @@ function _infiniteMessageArea() {
|
|
|
3411
3616
|
// const bottom = div.scrollHeight - top - div.clientHeight
|
|
3412
3617
|
case 5:
|
|
3413
3618
|
if (!(div.scrollTop < magicZone && earliest.messageTable && !earliest.messageTable.initial && earliest.messageTable.extendBackwards)) {
|
|
3414
|
-
|
|
3619
|
+
_context13.next = 21;
|
|
3415
3620
|
break;
|
|
3416
3621
|
}
|
|
3417
3622
|
if (!(div.scrollHeight === 0)) {
|
|
3418
|
-
|
|
3623
|
+
_context13.next = 10;
|
|
3419
3624
|
break;
|
|
3420
3625
|
}
|
|
3421
|
-
//
|
|
3626
|
+
// debug.log(' chat/loadMoreWhereNeeded: trying later...')
|
|
3422
3627
|
setTimeout(loadMoreWhereNeeded, 2000); // couple be less
|
|
3423
3628
|
lock = false;
|
|
3424
|
-
return
|
|
3629
|
+
return _context13.abrupt("return");
|
|
3425
3630
|
case 10:
|
|
3426
|
-
//
|
|
3631
|
+
// debug.log(' chat/loadMoreWhereNeeded: Going now')
|
|
3427
3632
|
scrollBottom = div.scrollHeight - div.scrollTop;
|
|
3428
3633
|
debug.log('infinite scroll: adding above: top ' + div.scrollTop);
|
|
3429
|
-
|
|
3634
|
+
_context13.next = 14;
|
|
3430
3635
|
return earliest.messageTable.extendBackwards();
|
|
3431
3636
|
case 14:
|
|
3432
|
-
done =
|
|
3637
|
+
done = _context13.sent;
|
|
3433
3638
|
if (freeze) {
|
|
3434
3639
|
div.scrollTop = div.scrollHeight - scrollBottom;
|
|
3435
3640
|
}
|
|
3436
3641
|
if (fixScroll) fixScroll();
|
|
3437
3642
|
if (!done) {
|
|
3438
|
-
|
|
3643
|
+
_context13.next = 19;
|
|
3439
3644
|
break;
|
|
3440
3645
|
}
|
|
3441
|
-
return
|
|
3646
|
+
return _context13.abrupt("break", 21);
|
|
3442
3647
|
case 19:
|
|
3443
|
-
|
|
3648
|
+
_context13.next = 5;
|
|
3444
3649
|
break;
|
|
3445
3650
|
case 21:
|
|
3446
3651
|
if (!(options.selectedMessage &&
|
|
@@ -3450,15 +3655,15 @@ function _infiniteMessageArea() {
|
|
|
3450
3655
|
latest.messageTable && !latest.messageTable["final"] &&
|
|
3451
3656
|
// there is more data to come
|
|
3452
3657
|
latest.messageTable.extendForwards)) {
|
|
3453
|
-
|
|
3658
|
+
_context13.next = 33;
|
|
3454
3659
|
break;
|
|
3455
3660
|
}
|
|
3456
3661
|
scrollTop = div.scrollTop;
|
|
3457
3662
|
debug.log('infinite scroll: adding below: bottom: ' + (div.scrollHeight - div.scrollTop - div.clientHeight));
|
|
3458
|
-
|
|
3663
|
+
_context13.next = 26;
|
|
3459
3664
|
return latest.messageTable.extendForwards();
|
|
3460
3665
|
case 26:
|
|
3461
|
-
done =
|
|
3666
|
+
done = _context13.sent;
|
|
3462
3667
|
// then add more data on the bottom
|
|
3463
3668
|
if (freeze) {
|
|
3464
3669
|
div.scrollTop = scrollTop; // while adding below keep same things in view
|
|
@@ -3466,63 +3671,66 @@ function _infiniteMessageArea() {
|
|
|
3466
3671
|
|
|
3467
3672
|
if (fixScroll) fixScroll();
|
|
3468
3673
|
if (!done) {
|
|
3469
|
-
|
|
3674
|
+
_context13.next = 31;
|
|
3470
3675
|
break;
|
|
3471
3676
|
}
|
|
3472
|
-
return
|
|
3677
|
+
return _context13.abrupt("break", 33);
|
|
3473
3678
|
case 31:
|
|
3474
|
-
|
|
3679
|
+
_context13.next = 21;
|
|
3475
3680
|
break;
|
|
3476
3681
|
case 33:
|
|
3477
3682
|
lock = false;
|
|
3478
3683
|
case 34:
|
|
3479
3684
|
case "end":
|
|
3480
|
-
return
|
|
3685
|
+
return _context13.stop();
|
|
3481
3686
|
}
|
|
3482
|
-
},
|
|
3687
|
+
}, _callee13);
|
|
3483
3688
|
}));
|
|
3484
3689
|
return _loadMoreWhereNeeded.apply(this, arguments);
|
|
3485
3690
|
};
|
|
3486
|
-
loadMoreWhereNeeded = function _loadMoreWhereNeeded2(
|
|
3691
|
+
loadMoreWhereNeeded = function _loadMoreWhereNeeded2(_x20, _x21) {
|
|
3487
3692
|
return _loadMoreWhereNeeded.apply(this, arguments);
|
|
3488
3693
|
};
|
|
3489
3694
|
_appendCurrentMessages = function _appendCurrentMessage2() {
|
|
3490
|
-
_appendCurrentMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3695
|
+
_appendCurrentMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12() {
|
|
3491
3696
|
var now, chatDocument, messageTable;
|
|
3492
|
-
return _regenerator["default"].wrap(function
|
|
3493
|
-
while (1) switch (
|
|
3697
|
+
return _regenerator["default"].wrap(function _callee12$(_context12) {
|
|
3698
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
3494
3699
|
case 0:
|
|
3495
3700
|
now = new Date();
|
|
3496
3701
|
chatDocument = dateFolder.leafDocumentFromDate(now); /// ///////////////////////////////////////////////////////////
|
|
3497
|
-
|
|
3702
|
+
_context12.next = 4;
|
|
3498
3703
|
return createMessageTable(now, true);
|
|
3499
3704
|
case 4:
|
|
3500
|
-
messageTable =
|
|
3705
|
+
messageTable = _context12.sent;
|
|
3501
3706
|
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 (
|
|
3707
|
+
div.refresh = /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11() {
|
|
3708
|
+
return _regenerator["default"].wrap(function _callee11$(_context11) {
|
|
3709
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
3505
3710
|
case 0:
|
|
3506
|
-
|
|
3711
|
+
_context11.next = 2;
|
|
3507
3712
|
return addNewChatDocumentIfNewDay(new Date());
|
|
3508
3713
|
case 2:
|
|
3509
|
-
|
|
3510
|
-
|
|
3714
|
+
_context11.next = 4;
|
|
3715
|
+
return syncMessages(chatChannel, messageTable);
|
|
3511
3716
|
case 4:
|
|
3717
|
+
// @@ livemessagetable??
|
|
3718
|
+
desktopNotification(chatChannel);
|
|
3719
|
+
case 5:
|
|
3512
3720
|
case "end":
|
|
3513
|
-
return
|
|
3721
|
+
return _context11.stop();
|
|
3514
3722
|
}
|
|
3515
|
-
},
|
|
3723
|
+
}, _callee11);
|
|
3516
3724
|
})); // The short chat version the live update listening is done in the pane but we do it in the widget @@
|
|
3517
3725
|
_solidLogic.store.updater.addDownstreamChangeListener(chatDocument, div.refresh); // Live update
|
|
3518
3726
|
liveMessageTable = messageTable;
|
|
3519
3727
|
latest.messageTable = liveMessageTable;
|
|
3520
|
-
return
|
|
3728
|
+
return _context12.abrupt("return", messageTable);
|
|
3521
3729
|
case 11:
|
|
3522
3730
|
case "end":
|
|
3523
|
-
return
|
|
3731
|
+
return _context12.stop();
|
|
3524
3732
|
}
|
|
3525
|
-
},
|
|
3733
|
+
}, _callee12);
|
|
3526
3734
|
}));
|
|
3527
3735
|
return _appendCurrentMessages.apply(this, arguments);
|
|
3528
3736
|
};
|
|
@@ -3530,15 +3738,15 @@ function _infiniteMessageArea() {
|
|
|
3530
3738
|
return _appendCurrentMessages.apply(this, arguments);
|
|
3531
3739
|
};
|
|
3532
3740
|
_addNewChatDocumentIfNewDay = function _addNewChatDocumentIf2() {
|
|
3533
|
-
_addNewChatDocumentIfNewDay = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3741
|
+
_addNewChatDocumentIfNewDay = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10() {
|
|
3534
3742
|
var newChatDocument, oldChatDocument, sts;
|
|
3535
|
-
return _regenerator["default"].wrap(function
|
|
3536
|
-
while (1) switch (
|
|
3743
|
+
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
|
3744
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
3537
3745
|
case 0:
|
|
3538
3746
|
// @@ Remove listener from previous table as it is now static
|
|
3539
3747
|
newChatDocument = dateFolder.leafDocumentFromDate(new Date());
|
|
3540
3748
|
if (newChatDocument.sameTerm(latest.messageTable.chatDocument)) {
|
|
3541
|
-
|
|
3749
|
+
_context10.next = 7;
|
|
3542
3750
|
break;
|
|
3543
3751
|
}
|
|
3544
3752
|
// It is a new day
|
|
@@ -3547,7 +3755,7 @@ function _infiniteMessageArea() {
|
|
|
3547
3755
|
delete liveMessageTable.inputRow;
|
|
3548
3756
|
}
|
|
3549
3757
|
oldChatDocument = latest.messageTable.chatDocument;
|
|
3550
|
-
|
|
3758
|
+
_context10.next = 6;
|
|
3551
3759
|
return appendCurrentMessages();
|
|
3552
3760
|
case 6:
|
|
3553
3761
|
// Adding a link in the document will ping listeners to add the new block too
|
|
@@ -3561,286 +3769,322 @@ function _infiniteMessageArea() {
|
|
|
3561
3769
|
}
|
|
3562
3770
|
case 7:
|
|
3563
3771
|
case "end":
|
|
3564
|
-
return
|
|
3772
|
+
return _context10.stop();
|
|
3565
3773
|
}
|
|
3566
|
-
},
|
|
3774
|
+
}, _callee10);
|
|
3567
3775
|
}));
|
|
3568
3776
|
return _addNewChatDocumentIfNewDay.apply(this, arguments);
|
|
3569
3777
|
};
|
|
3570
3778
|
addNewChatDocumentIfNewDay = function _addNewChatDocumentIf() {
|
|
3571
3779
|
return _addNewChatDocumentIfNewDay.apply(this, arguments);
|
|
3572
3780
|
};
|
|
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
|
-
|
|
3781
|
+
_renderMessageTable = function _renderMessageTable3() {
|
|
3782
|
+
_renderMessageTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(date, live) {
|
|
3783
|
+
var scrollBackbutton, scrollForwardButton, extendBackwards, _extendBackwards, setScrollBackbuttonIcon, extendForwards, _extendForwards, setScrollForwardButtonIcon, scrollForwardButtonHandler, _scrollForwardButtonHandler, messageTable, chatDocument, tr, test, titleTR, scrollBackbuttonCell, dateCell, scrollForwardButtonCell, sts, _iterator2, _step2, st;
|
|
3784
|
+
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
|
3785
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
3786
|
+
case 0:
|
|
3787
|
+
_scrollForwardButtonHandler = function _scrollForwardButtonH2() {
|
|
3788
|
+
_scrollForwardButtonHandler = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(_event) {
|
|
3789
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
3790
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
3791
|
+
case 0:
|
|
3792
|
+
if (!messageTable.extendedForwards) {
|
|
3793
|
+
_context8.next = 6;
|
|
3794
|
+
break;
|
|
3795
|
+
}
|
|
3796
|
+
removePreviousMessages(false, messageTable);
|
|
3797
|
+
messageTable.extendedForwards = false;
|
|
3798
|
+
setScrollForwardButtonIcon();
|
|
3799
|
+
_context8.next = 9;
|
|
3800
|
+
break;
|
|
3801
|
+
case 6:
|
|
3802
|
+
_context8.next = 8;
|
|
3803
|
+
return extendForwards();
|
|
3804
|
+
case 8:
|
|
3805
|
+
// async
|
|
3806
|
+
latest.messageTable.scrollIntoView(newestFirst);
|
|
3807
|
+
case 9:
|
|
3808
|
+
case "end":
|
|
3809
|
+
return _context8.stop();
|
|
3810
|
+
}
|
|
3811
|
+
}, _callee8);
|
|
3812
|
+
}));
|
|
3813
|
+
return _scrollForwardButtonHandler.apply(this, arguments);
|
|
3814
|
+
};
|
|
3815
|
+
scrollForwardButtonHandler = function _scrollForwardButtonH(_x22) {
|
|
3816
|
+
return _scrollForwardButtonHandler.apply(this, arguments);
|
|
3817
|
+
};
|
|
3818
|
+
setScrollForwardButtonIcon = function _setScrollForwardButt() {
|
|
3819
|
+
if (!scrollForwardButton) return;
|
|
3820
|
+
var sense = messageTable.extendedForwards ? !newestFirst : newestFirst; // noun_T-Block_1114657_000000.svg
|
|
3821
|
+
var scrollForwardIcon = messageTable["final"] ? 'noun_T-Block_1114657_000000.svg' : getScrollForwardButtonIcon(sense);
|
|
3822
|
+
scrollForwardButton.firstChild.setAttribute('src', _iconBase.icons.iconBase + scrollForwardIcon);
|
|
3823
|
+
function getScrollForwardButtonIcon(sense) {
|
|
3824
|
+
return !sense ? 'noun_1369241.svg' : 'noun_1369237.svg';
|
|
3599
3825
|
}
|
|
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;
|
|
3826
|
+
};
|
|
3827
|
+
_extendForwards = function _extendForwards3() {
|
|
3828
|
+
_extendForwards = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7() {
|
|
3829
|
+
var done;
|
|
3830
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
3831
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
3832
|
+
case 0:
|
|
3833
|
+
_context7.next = 2;
|
|
3834
|
+
return insertPreviousMessages(false);
|
|
3835
|
+
case 2:
|
|
3836
|
+
done = _context7.sent;
|
|
3837
|
+
return _context7.abrupt("return", done);
|
|
3838
|
+
case 4:
|
|
3839
|
+
case "end":
|
|
3840
|
+
return _context7.stop();
|
|
3841
|
+
}
|
|
3842
|
+
}, _callee7);
|
|
3843
|
+
}));
|
|
3844
|
+
return _extendForwards.apply(this, arguments);
|
|
3845
|
+
};
|
|
3846
|
+
extendForwards = function _extendForwards2() {
|
|
3847
|
+
return _extendForwards.apply(this, arguments);
|
|
3848
|
+
};
|
|
3849
|
+
setScrollBackbuttonIcon = function _setScrollBackbuttonI() {
|
|
3850
|
+
if (!scrollBackbutton) {
|
|
3851
|
+
return;
|
|
3632
3852
|
}
|
|
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
|
-
|
|
3853
|
+
var sense = messageTable.extendedBack ? !newestFirst : newestFirst;
|
|
3854
|
+
var scrollBackIcon = messageTable.initial ? 'noun_T-Block_1114655_000000.svg' : getScrollbackIcon(sense);
|
|
3855
|
+
scrollBackbutton.firstChild.setAttribute('src', _iconBase.icons.iconBase + scrollBackIcon);
|
|
3856
|
+
function getScrollbackIcon(sense) {
|
|
3857
|
+
return sense ? 'noun_1369241.svg' : 'noun_1369237.svg';
|
|
3858
|
+
}
|
|
3859
|
+
};
|
|
3860
|
+
_extendBackwards = function _extendBackwards3() {
|
|
3861
|
+
_extendBackwards = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
|
|
3862
|
+
var done;
|
|
3863
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
3864
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
3865
|
+
case 0:
|
|
3866
|
+
_context6.next = 2;
|
|
3867
|
+
return insertPreviousMessages(true);
|
|
3868
|
+
case 2:
|
|
3869
|
+
done = _context6.sent;
|
|
3870
|
+
if (done) {
|
|
3871
|
+
if (scrollBackbutton) {
|
|
3872
|
+
scrollBackbutton.firstChild.setAttribute('src', _iconBase.icons.iconBase + 'noun_T-Block_1114655_000000.svg'); // T
|
|
3873
|
+
scrollBackbutton.disabled = true;
|
|
3874
|
+
}
|
|
3875
|
+
messageTable.initial = true;
|
|
3876
|
+
} else {
|
|
3877
|
+
messageTable.extendedBack = true;
|
|
3878
|
+
}
|
|
3879
|
+
setScrollBackbuttonIcon();
|
|
3880
|
+
return _context6.abrupt("return", done);
|
|
3881
|
+
case 6:
|
|
3882
|
+
case "end":
|
|
3883
|
+
return _context6.stop();
|
|
3884
|
+
}
|
|
3885
|
+
}, _callee6);
|
|
3886
|
+
}));
|
|
3887
|
+
return _extendBackwards.apply(this, arguments);
|
|
3888
|
+
};
|
|
3889
|
+
extendBackwards = function _extendBackwards2() {
|
|
3890
|
+
return _extendBackwards.apply(this, arguments);
|
|
3891
|
+
};
|
|
3892
|
+
scrollBackbutton = null; // was let
|
|
3893
|
+
scrollForwardButton = null; // was let
|
|
3894
|
+
/// ///////////////// Scroll down adding more above
|
|
3895
|
+
/// ///////////////////////
|
|
3896
|
+
/*
|
|
3897
|
+
options = options || {}
|
|
3898
|
+
options.authorDateOnLeft = true
|
|
3899
|
+
const newestFirst = options.newestFirst === '1' || options.newestFirst === true // hack for now
|
|
3900
|
+
const channelObject = new ChatChannel(chatChannel, options)
|
|
3901
|
+
const dateFolder = channelObject.dateFolder
|
|
3902
|
+
const div = dom.createElement('div')
|
|
3903
|
+
const statusArea = div.appendChild(dom.createElement('div'))
|
|
3904
|
+
const userContext = { dom, statusArea, div: statusArea } // logged on state, pointers to user's stuff
|
|
3905
|
+
*/
|
|
3906
|
+
debug.log('Options for called message Area', options);
|
|
3907
|
+
messageTable = dom.createElement('table');
|
|
3908
|
+
messageTable.style.width = '100%'; // fill the pane div
|
|
3909
|
+
messageTable.extendBackwards = extendBackwards; // Make function available to scroll stuff
|
|
3910
|
+
messageTable.extendForwards = extendForwards; // Make function available to scroll stuff
|
|
3911
|
+
|
|
3912
|
+
messageTable.date = date;
|
|
3913
|
+
chatDocument = dateFolder.leafDocumentFromDate(date);
|
|
3914
|
+
messageTable.chatDocument = chatDocument;
|
|
3915
|
+
messageTable.fresh = false;
|
|
3916
|
+
messageTable.setAttribute('style', 'width: 100%;'); // fill that div!
|
|
3917
|
+
if (live) {
|
|
3918
|
+
messageTable["final"] = true;
|
|
3919
|
+
liveMessageTable = messageTable;
|
|
3920
|
+
latest.messageTable = messageTable;
|
|
3921
|
+
tr = (0, _message.renderMessageEditor)(channelObject, messageTable, userContext, options);
|
|
3922
|
+
if (newestFirst) {
|
|
3923
|
+
messageTable.insertBefore(tr, messageTable.firstChild); // If newestFirst
|
|
3666
3924
|
} else {
|
|
3667
|
-
messageTable.
|
|
3925
|
+
messageTable.appendChild(tr); // not newestFirst
|
|
3668
3926
|
}
|
|
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;
|
|
3927
|
+
|
|
3928
|
+
messageTable.inputRow = tr;
|
|
3929
|
+
}
|
|
3930
|
+
|
|
3931
|
+
/// ///// Infinite scroll
|
|
3932
|
+
//
|
|
3933
|
+
// @@ listen for swipe past end event not just button
|
|
3934
|
+
test = true;
|
|
3935
|
+
if (test) {
|
|
3936
|
+
// ws options.infinite but need for non-infinite
|
|
3937
|
+
titleTR = dom.createElement('tr');
|
|
3938
|
+
scrollBackbuttonCell = titleTR.appendChild(dom.createElement('td')); // up traingles: noun_1369237.svg
|
|
3939
|
+
// down triangles: noun_1369241.svg
|
|
3940
|
+
/*
|
|
3941
|
+
const scrollBackIcon = newestFirst
|
|
3942
|
+
? 'noun_1369241.svg'
|
|
3943
|
+
: 'noun_1369237.svg' // down and up arrows respoctively
|
|
3944
|
+
scrollBackbutton = widgets.button(
|
|
3945
|
+
dom,
|
|
3946
|
+
icons.iconBase + scrollBackIcon,
|
|
3947
|
+
'Previous messages ...'
|
|
3948
|
+
)
|
|
3949
|
+
scrollBackbuttonCell.style = 'width:3em; height:3em;'
|
|
3950
|
+
scrollBackbutton.addEventListener('click', scrollBackbuttonHandler, false)
|
|
3951
|
+
messageTable.extendedBack = false
|
|
3952
|
+
scrollBackbuttonCell.appendChild(scrollBackbutton)
|
|
3953
|
+
setScrollBackbuttonIcon()
|
|
3954
|
+
*/
|
|
3955
|
+
dateCell = titleTR.appendChild(dom.createElement('td'));
|
|
3956
|
+
dateCell.style = 'text-align: center; vertical-align: middle; color: #888; font-style: italic;';
|
|
3957
|
+
dateCell.textContent = widgets.shortDate(date.toISOString(), true); // no time, only date
|
|
3958
|
+
|
|
3959
|
+
// @@@@@@@@@@@ todo move this button to other end of message cell, o
|
|
3960
|
+
scrollForwardButtonCell = titleTR.appendChild(dom.createElement('td'));
|
|
3961
|
+
if (options.includeRemoveButton) {
|
|
3962
|
+
scrollForwardButtonCell.appendChild(widgets.cancelButton(dom, function (_e) {
|
|
3963
|
+
div.parentNode.removeChild(div);
|
|
3964
|
+
}));
|
|
3708
3965
|
}
|
|
3709
|
-
|
|
3966
|
+
/*
|
|
3967
|
+
const scrollForwardIcon = newestFirst
|
|
3968
|
+
? 'noun_1369241.svg'
|
|
3969
|
+
: 'noun_1369237.svg' // down and up arrows respoctively
|
|
3970
|
+
scrollForwardButton = widgets.button(
|
|
3971
|
+
dom,
|
|
3972
|
+
icons.iconBase + scrollForwardIcon,
|
|
3973
|
+
'Later messages ...'
|
|
3974
|
+
)
|
|
3975
|
+
scrollForwardButtonCell.appendChild(scrollForwardButton)
|
|
3976
|
+
scrollForwardButtonCell.style = 'width:3em; height:3em;'
|
|
3977
|
+
scrollForwardButton.addEventListener(
|
|
3978
|
+
'click',
|
|
3979
|
+
scrollForwardButtonHandler,
|
|
3980
|
+
false
|
|
3981
|
+
)
|
|
3982
|
+
messageTable.extendedForward = false
|
|
3983
|
+
setScrollForwardButtonIcon()
|
|
3984
|
+
*/
|
|
3710
3985
|
messageTable.extendedForwards = false;
|
|
3711
|
-
|
|
3712
|
-
|
|
3986
|
+
if (!newestFirst) {
|
|
3987
|
+
// opposite end from the entry field
|
|
3988
|
+
messageTable.insertBefore(titleTR, messageTable.firstChild); // If not newestFirst
|
|
3989
|
+
} else {
|
|
3990
|
+
messageTable.appendChild(titleTR); // newestFirst
|
|
3991
|
+
}
|
|
3992
|
+
}
|
|
3993
|
+
sts = _solidLogic.store.statementsMatching(null, ns.wf('message'), null, chatDocument);
|
|
3994
|
+
if (!live && sts.length === 0) {
|
|
3995
|
+
// not todays
|
|
3996
|
+
// no need buttomns at the moment
|
|
3997
|
+
// messageTable.style.visibility = 'collapse' // Hide files with no messages
|
|
3998
|
+
}
|
|
3999
|
+
_iterator2 = _createForOfIteratorHelper(sts);
|
|
4000
|
+
_context9.prev = 26;
|
|
4001
|
+
_iterator2.s();
|
|
4002
|
+
case 28:
|
|
4003
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
4004
|
+
_context9.next = 34;
|
|
3713
4005
|
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;
|
|
4006
|
+
}
|
|
4007
|
+
st = _step2.value;
|
|
4008
|
+
_context9.next = 32;
|
|
4009
|
+
return addMessage(st.object, messageTable);
|
|
4010
|
+
case 32:
|
|
4011
|
+
_context9.next = 28;
|
|
4012
|
+
break;
|
|
4013
|
+
case 34:
|
|
4014
|
+
_context9.next = 39;
|
|
4015
|
+
break;
|
|
4016
|
+
case 36:
|
|
4017
|
+
_context9.prev = 36;
|
|
4018
|
+
_context9.t0 = _context9["catch"](26);
|
|
4019
|
+
_iterator2.e(_context9.t0);
|
|
4020
|
+
case 39:
|
|
4021
|
+
_context9.prev = 39;
|
|
4022
|
+
_iterator2.f();
|
|
4023
|
+
return _context9.finish(39);
|
|
4024
|
+
case 42:
|
|
4025
|
+
messageTable.fresh = true;
|
|
4026
|
+
|
|
4027
|
+
// loadMessageTable(messageTable, chatDocument)
|
|
4028
|
+
messageTable.fresh = false;
|
|
4029
|
+
return _context9.abrupt("return", messageTable);
|
|
4030
|
+
case 45:
|
|
4031
|
+
case "end":
|
|
4032
|
+
return _context9.stop();
|
|
4033
|
+
}
|
|
4034
|
+
}, _callee9, null, [[26, 36, 39, 42]]);
|
|
4035
|
+
}));
|
|
4036
|
+
return _renderMessageTable.apply(this, arguments);
|
|
4037
|
+
};
|
|
4038
|
+
renderMessageTable = function _renderMessageTable2(_x18, _x19) {
|
|
4039
|
+
return _renderMessageTable.apply(this, arguments);
|
|
3802
4040
|
};
|
|
3803
4041
|
_createMessageTable = function _createMessageTable3() {
|
|
3804
|
-
_createMessageTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
4042
|
+
_createMessageTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(date, live) {
|
|
3805
4043
|
var chatDocument, messageTable, statusTR;
|
|
3806
|
-
return _regenerator["default"].wrap(function
|
|
3807
|
-
while (1) switch (
|
|
4044
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
4045
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
3808
4046
|
case 0:
|
|
3809
4047
|
debug.log(' createMessageTable for ' + date);
|
|
3810
4048
|
chatDocument = dateFolder.leafDocumentFromDate(date);
|
|
3811
|
-
|
|
3812
|
-
|
|
4049
|
+
_context5.prev = 2;
|
|
4050
|
+
_context5.next = 5;
|
|
3813
4051
|
return _solidLogic.store.fetcher.load(chatDocument);
|
|
3814
4052
|
case 5:
|
|
3815
|
-
|
|
4053
|
+
_context5.next = 21;
|
|
3816
4054
|
break;
|
|
3817
4055
|
case 7:
|
|
3818
|
-
|
|
3819
|
-
|
|
4056
|
+
_context5.prev = 7;
|
|
4057
|
+
_context5.t0 = _context5["catch"](2);
|
|
3820
4058
|
messageTable = dom.createElement('table');
|
|
3821
4059
|
statusTR = messageTable.appendChild(dom.createElement('tr')); // ### find status in exception
|
|
3822
|
-
if (!(
|
|
3823
|
-
|
|
4060
|
+
if (!(_context5.t0.response && _context5.t0.response.status && _context5.t0.response.status === 404)) {
|
|
4061
|
+
_context5.next = 18;
|
|
3824
4062
|
break;
|
|
3825
4063
|
}
|
|
3826
4064
|
debug.log('Error 404 for chat file ' + chatDocument);
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
4065
|
+
_context5.next = 15;
|
|
4066
|
+
return renderMessageTable(date, live);
|
|
4067
|
+
case 15:
|
|
4068
|
+
return _context5.abrupt("return", _context5.sent);
|
|
3831
4069
|
case 18:
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
return _context6.abrupt("return", renderMessageTable(date, live));
|
|
4070
|
+
debug.log('*** Error NON 404 for chat file ' + chatDocument);
|
|
4071
|
+
statusTR.appendChild(widgets.errorMessageBlock(dom, _context5.t0, 'pink'));
|
|
3835
4072
|
case 20:
|
|
4073
|
+
return _context5.abrupt("return", statusTR);
|
|
4074
|
+
case 21:
|
|
4075
|
+
_context5.next = 23;
|
|
4076
|
+
return renderMessageTable(date, live);
|
|
4077
|
+
case 23:
|
|
4078
|
+
return _context5.abrupt("return", _context5.sent);
|
|
4079
|
+
case 24:
|
|
3836
4080
|
case "end":
|
|
3837
|
-
return
|
|
4081
|
+
return _context5.stop();
|
|
3838
4082
|
}
|
|
3839
|
-
},
|
|
4083
|
+
}, _callee5, null, [[2, 7]]);
|
|
3840
4084
|
}));
|
|
3841
4085
|
return _createMessageTable.apply(this, arguments);
|
|
3842
4086
|
};
|
|
3843
|
-
createMessageTable = function _createMessageTable2(
|
|
4087
|
+
createMessageTable = function _createMessageTable2(_x16, _x17) {
|
|
3844
4088
|
return _createMessageTable.apply(this, arguments);
|
|
3845
4089
|
};
|
|
3846
4090
|
removePreviousMessages = function _removePreviousMessag(backwards, messageTable) {
|
|
@@ -3859,32 +4103,40 @@ function _infiniteMessageArea() {
|
|
|
3859
4103
|
extr.messageTable = messageTable;
|
|
3860
4104
|
};
|
|
3861
4105
|
_insertPreviousMessages = function _insertPreviousMessag2() {
|
|
3862
|
-
_insertPreviousMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
4106
|
+
_insertPreviousMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(backwards) {
|
|
3863
4107
|
var extremity, date, live, todayDoc, doc, newMessageTable;
|
|
3864
|
-
return _regenerator["default"].wrap(function
|
|
3865
|
-
while (1) switch (
|
|
4108
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
4109
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
3866
4110
|
case 0:
|
|
3867
4111
|
extremity = backwards ? earliest : latest;
|
|
3868
4112
|
date = extremity.messageTable.date; // day in mssecs
|
|
3869
|
-
|
|
3870
|
-
|
|
4113
|
+
// Are we at the top of a thread?
|
|
4114
|
+
if (!(backwards && earliest.limit && date <= earliest.limit)) {
|
|
4115
|
+
_context4.next = 4;
|
|
4116
|
+
break;
|
|
4117
|
+
}
|
|
4118
|
+
return _context4.abrupt("return", true);
|
|
3871
4119
|
case 4:
|
|
3872
|
-
|
|
4120
|
+
_context4.next = 6;
|
|
4121
|
+
return dateFolder.loadPrevious(date, backwards);
|
|
4122
|
+
case 6:
|
|
4123
|
+
date = _context4.sent;
|
|
3873
4124
|
// backwards
|
|
4125
|
+
|
|
3874
4126
|
debug.log("insertPreviousMessages: from ".concat(backwards ? 'backwards' : 'forwards', " loadPrevious: ").concat(date));
|
|
3875
4127
|
if (!(!date && !backwards && !liveMessageTable)) {
|
|
3876
|
-
|
|
4128
|
+
_context4.next = 11;
|
|
3877
4129
|
break;
|
|
3878
4130
|
}
|
|
3879
|
-
|
|
4131
|
+
_context4.next = 11;
|
|
3880
4132
|
return appendCurrentMessages();
|
|
3881
|
-
case
|
|
4133
|
+
case 11:
|
|
3882
4134
|
if (date) {
|
|
3883
|
-
|
|
4135
|
+
_context4.next = 13;
|
|
3884
4136
|
break;
|
|
3885
4137
|
}
|
|
3886
|
-
return
|
|
3887
|
-
case
|
|
4138
|
+
return _context4.abrupt("return", true);
|
|
4139
|
+
case 13:
|
|
3888
4140
|
// done
|
|
3889
4141
|
live = false;
|
|
3890
4142
|
if (!backwards) {
|
|
@@ -3892,10 +4144,10 @@ function _infiniteMessageArea() {
|
|
|
3892
4144
|
doc = dateFolder.leafDocumentFromDate(date);
|
|
3893
4145
|
live = doc.sameTerm(todayDoc); // Is this todays?
|
|
3894
4146
|
}
|
|
3895
|
-
|
|
4147
|
+
_context4.next = 17;
|
|
3896
4148
|
return createMessageTable(date, live);
|
|
3897
|
-
case
|
|
3898
|
-
newMessageTable =
|
|
4149
|
+
case 17:
|
|
4150
|
+
newMessageTable = _context4.sent;
|
|
3899
4151
|
extremity.messageTable = newMessageTable; // move pointer to earliest
|
|
3900
4152
|
if (backwards ? newestFirst : !newestFirst) {
|
|
3901
4153
|
// put on bottom or top
|
|
@@ -3904,62 +4156,160 @@ function _infiniteMessageArea() {
|
|
|
3904
4156
|
// put on top as we scroll back
|
|
3905
4157
|
div.insertBefore(newMessageTable, div.firstChild);
|
|
3906
4158
|
}
|
|
3907
|
-
return
|
|
3908
|
-
case
|
|
4159
|
+
return _context4.abrupt("return", live);
|
|
4160
|
+
case 21:
|
|
3909
4161
|
case "end":
|
|
3910
|
-
return
|
|
4162
|
+
return _context4.stop();
|
|
3911
4163
|
}
|
|
3912
|
-
},
|
|
4164
|
+
}, _callee4);
|
|
3913
4165
|
}));
|
|
3914
4166
|
return _insertPreviousMessages.apply(this, arguments);
|
|
3915
4167
|
};
|
|
3916
|
-
insertPreviousMessages = function _insertPreviousMessag(
|
|
4168
|
+
insertPreviousMessages = function _insertPreviousMessag(_x15) {
|
|
3917
4169
|
return _insertPreviousMessages.apply(this, arguments);
|
|
3918
4170
|
};
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
4171
|
+
_addMessage = function _addMessage3() {
|
|
4172
|
+
_addMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(message, messageTable) {
|
|
4173
|
+
var thread, id;
|
|
4174
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
4175
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
4176
|
+
case 0:
|
|
4177
|
+
if (!((0, _chatLogic.isDeleted)(message) && !options.showDeletedMessages)) {
|
|
4178
|
+
_context3.next = 2;
|
|
4179
|
+
break;
|
|
4180
|
+
}
|
|
4181
|
+
return _context3.abrupt("return");
|
|
4182
|
+
case 2:
|
|
4183
|
+
if (!(0, _chatLogic.isReplaced)(message)) {
|
|
4184
|
+
_context3.next = 4;
|
|
4185
|
+
break;
|
|
4186
|
+
}
|
|
4187
|
+
return _context3.abrupt("return");
|
|
4188
|
+
case 4:
|
|
4189
|
+
thread = _solidLogic.store.any(null, ns.sioc('has_member'), message, message.doc());
|
|
4190
|
+
id = _solidLogic.store.any(message, ns.sioc('id'), null, message.doc());
|
|
4191
|
+
if (id && !thread) {
|
|
4192
|
+
thread = _solidLogic.store.any(null, ns.sioc('has_member'), id, message.doc());
|
|
4193
|
+
}
|
|
4194
|
+
if (!options.thread) {
|
|
4195
|
+
_context3.next = 20;
|
|
4196
|
+
break;
|
|
4197
|
+
}
|
|
4198
|
+
if (!_solidLogic.store.holds(message, ns.sioc('has_reply'), options.thread)) {
|
|
4199
|
+
_context3.next = 12;
|
|
4200
|
+
break;
|
|
4201
|
+
}
|
|
4202
|
+
// root of thread
|
|
4203
|
+
debug.log(' addMessage: displaying root of thread ' + thread);
|
|
4204
|
+
_context3.next = 18;
|
|
4205
|
+
break;
|
|
4206
|
+
case 12:
|
|
4207
|
+
if (!(thread && thread.sameTerm(options.thread))) {
|
|
4208
|
+
_context3.next = 16;
|
|
4209
|
+
break;
|
|
4210
|
+
}
|
|
4211
|
+
debug.log(' addMessage: Displaying body of thread ' + message.uri.slice(-10));
|
|
4212
|
+
_context3.next = 18;
|
|
4213
|
+
break;
|
|
4214
|
+
case 16:
|
|
4215
|
+
debug.log(' addMessage: Suppress non-thread message in thread table ' + message.uri.slice(-10));
|
|
4216
|
+
return _context3.abrupt("return");
|
|
4217
|
+
case 18:
|
|
4218
|
+
_context3.next = 26;
|
|
4219
|
+
break;
|
|
4220
|
+
case 20:
|
|
4221
|
+
if (!thread) {
|
|
4222
|
+
_context3.next = 25;
|
|
4223
|
+
break;
|
|
4224
|
+
}
|
|
4225
|
+
debug.log(' addMessage: Suppress thread message in non-thread table ' + message.uri.slice(-10));
|
|
4226
|
+
return _context3.abrupt("return");
|
|
4227
|
+
case 25:
|
|
4228
|
+
debug.log(' addMessage: Normal non-thread message in non-thread table ' + message.uri.slice(-10));
|
|
4229
|
+
case 26:
|
|
4230
|
+
_context3.next = 28;
|
|
4231
|
+
return insertMessageIntoTable(channelObject, messageTable, message, messageTable.fresh, options, userContext);
|
|
4232
|
+
case 28:
|
|
4233
|
+
case "end":
|
|
4234
|
+
return _context3.stop();
|
|
4235
|
+
}
|
|
4236
|
+
}, _callee3);
|
|
4237
|
+
}));
|
|
4238
|
+
return _addMessage.apply(this, arguments);
|
|
3927
4239
|
};
|
|
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
|
-
|
|
4240
|
+
addMessage = function _addMessage2(_x13, _x14) {
|
|
4241
|
+
return _addMessage.apply(this, arguments);
|
|
4242
|
+
};
|
|
4243
|
+
_syncMessages = function _syncMessages3() {
|
|
4244
|
+
_syncMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(chatChannel, messageTable) {
|
|
4245
|
+
var displayed, ele, ele2, messages, stored, _iterator, _step, m;
|
|
4246
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
4247
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
4248
|
+
case 0:
|
|
4249
|
+
displayed = {};
|
|
4250
|
+
for (ele = messageTable.firstChild; ele; ele = ele.nextSibling) {
|
|
4251
|
+
if (ele.AJAR_subject) {
|
|
4252
|
+
displayed[ele.AJAR_subject.uri] = true;
|
|
4253
|
+
}
|
|
4254
|
+
}
|
|
4255
|
+
messages = _solidLogic.store.each(chatChannel, ns.wf('message'), null, messageTable.chatDocument);
|
|
4256
|
+
stored = {};
|
|
4257
|
+
_iterator = _createForOfIteratorHelper(messages);
|
|
4258
|
+
_context2.prev = 5;
|
|
4259
|
+
_iterator.s();
|
|
4260
|
+
case 7:
|
|
4261
|
+
if ((_step = _iterator.n()).done) {
|
|
4262
|
+
_context2.next = 15;
|
|
4263
|
+
break;
|
|
4264
|
+
}
|
|
4265
|
+
m = _step.value;
|
|
4266
|
+
stored[m.uri] = true;
|
|
4267
|
+
if (displayed[m.uri]) {
|
|
4268
|
+
_context2.next = 13;
|
|
4269
|
+
break;
|
|
4270
|
+
}
|
|
4271
|
+
_context2.next = 13;
|
|
4272
|
+
return addMessage(m, messageTable);
|
|
4273
|
+
case 13:
|
|
4274
|
+
_context2.next = 7;
|
|
4275
|
+
break;
|
|
4276
|
+
case 15:
|
|
4277
|
+
_context2.next = 20;
|
|
4278
|
+
break;
|
|
4279
|
+
case 17:
|
|
4280
|
+
_context2.prev = 17;
|
|
4281
|
+
_context2.t0 = _context2["catch"](5);
|
|
4282
|
+
_iterator.e(_context2.t0);
|
|
4283
|
+
case 20:
|
|
4284
|
+
_context2.prev = 20;
|
|
4285
|
+
_iterator.f();
|
|
4286
|
+
return _context2.finish(20);
|
|
4287
|
+
case 23:
|
|
4288
|
+
// eslint-disable-next-line space-in-parens
|
|
4289
|
+
for (ele = messageTable.firstChild; ele;) {
|
|
4290
|
+
ele2 = ele.nextSibling;
|
|
4291
|
+
if (ele.AJAR_subject && !stored[ele.AJAR_subject.uri]) {
|
|
4292
|
+
messageTable.removeChild(ele);
|
|
4293
|
+
}
|
|
4294
|
+
ele = ele2;
|
|
4295
|
+
}
|
|
4296
|
+
for (ele = messageTable.firstChild; ele; ele = ele.nextSibling) {
|
|
4297
|
+
if (ele.AJAR_subject) {
|
|
4298
|
+
// Refresh thumbs up etc
|
|
4299
|
+
widgets.refreshTree(ele); // Things inside may have changed too
|
|
4300
|
+
}
|
|
4301
|
+
}
|
|
4302
|
+
case 25:
|
|
4303
|
+
case "end":
|
|
4304
|
+
return _context2.stop();
|
|
4305
|
+
}
|
|
4306
|
+
}, _callee2, null, [[5, 17, 20, 23]]);
|
|
4307
|
+
}));
|
|
4308
|
+
return _syncMessages.apply(this, arguments);
|
|
4309
|
+
};
|
|
4310
|
+
syncMessages = function _syncMessages2(_x11, _x12) {
|
|
4311
|
+
return _syncMessages.apply(this, arguments);
|
|
3961
4312
|
};
|
|
3962
|
-
|
|
3963
4313
|
// Body of main function
|
|
3964
4314
|
|
|
3965
4315
|
options = options || {};
|
|
@@ -3975,23 +4325,33 @@ function _infiniteMessageArea() {
|
|
|
3975
4325
|
statusArea: statusArea,
|
|
3976
4326
|
div: statusArea
|
|
3977
4327
|
}; // logged on state, pointers to user's stuff
|
|
3978
|
-
// const messageTable = dom.createElement('table') // @@ check does this go in renderMessageTable
|
|
3979
4328
|
earliest = {
|
|
3980
4329
|
messageTable: null
|
|
3981
4330
|
}; // Stuff about each end of the loaded days
|
|
3982
4331
|
latest = {
|
|
3983
4332
|
messageTable: null
|
|
3984
4333
|
};
|
|
4334
|
+
if (options.thread) {
|
|
4335
|
+
thread = options.thread;
|
|
4336
|
+
threadRootMessage = _solidLogic.store.any(null, ns.sioc('has_reply'), thread, thread.doc());
|
|
4337
|
+
if (threadRootMessage) {
|
|
4338
|
+
threadTime = _solidLogic.store.any(threadRootMessage, ns.dct('created'), null, threadRootMessage.doc());
|
|
4339
|
+
if (threadTime) {
|
|
4340
|
+
earliest.limit = new Date(threadTime.value);
|
|
4341
|
+
debug.log(' inifinite: thread start at ' + earliest.limit);
|
|
4342
|
+
}
|
|
4343
|
+
}
|
|
4344
|
+
}
|
|
3985
4345
|
lock = false;
|
|
3986
|
-
|
|
4346
|
+
_context15.next = 34;
|
|
3987
4347
|
return loadInitialContent();
|
|
3988
|
-
case
|
|
3989
|
-
return
|
|
3990
|
-
case
|
|
4348
|
+
case 34:
|
|
4349
|
+
return _context15.abrupt("return", div);
|
|
4350
|
+
case 35:
|
|
3991
4351
|
case "end":
|
|
3992
|
-
return
|
|
4352
|
+
return _context15.stop();
|
|
3993
4353
|
}
|
|
3994
|
-
},
|
|
4354
|
+
}, _callee15);
|
|
3995
4355
|
}));
|
|
3996
4356
|
return _infiniteMessageArea.apply(this, arguments);
|
|
3997
4357
|
}
|
|
@@ -4020,6 +4380,7 @@ exports.renderMessageEditor = renderMessageEditor;
|
|
|
4020
4380
|
exports.renderMessageRow = renderMessageRow;
|
|
4021
4381
|
exports.switchToEditor = switchToEditor;
|
|
4022
4382
|
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
|
|
4383
|
+
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js"));
|
|
4023
4384
|
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
4024
4385
|
var _infinite = __webpack_require__(/*! ./infinite */ "./lib/chat/infinite.js");
|
|
4025
4386
|
var _messageTools = __webpack_require__(/*! ./messageTools */ "./lib/chat/messageTools.js");
|
|
@@ -4037,7 +4398,9 @@ var utils = _interopRequireWildcard(__webpack_require__(/*! ../utils */ "./lib/u
|
|
|
4037
4398
|
var widgets = _interopRequireWildcard(__webpack_require__(/*! ../widgets */ "./lib/widgets/index.js"));
|
|
4038
4399
|
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
4400
|
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
|
|
4401
|
+
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; }
|
|
4402
|
+
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; }
|
|
4403
|
+
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
4404
|
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
4405
|
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
4406
|
var dom = window.document;
|
|
@@ -4116,122 +4479,232 @@ function creatorAndDateHorizontal(td1, creator, date, message) {
|
|
|
4116
4479
|
/**
|
|
4117
4480
|
* Renders a chat message, read-only mode
|
|
4118
4481
|
*/
|
|
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
|
-
|
|
4482
|
+
function renderMessageRow(_x, _x2, _x3, _x4, _x5) {
|
|
4483
|
+
return _renderMessageRow.apply(this, arguments);
|
|
4484
|
+
}
|
|
4485
|
+
function _renderMessageRow() {
|
|
4486
|
+
_renderMessageRow = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(channelObject, message, fresh, options, userContext) {
|
|
4487
|
+
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;
|
|
4488
|
+
return _regenerator["default"].wrap(function _callee9$(_context10) {
|
|
4489
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
4490
|
+
case 0:
|
|
4491
|
+
getBgColor = function _getBgColor(fresh) {
|
|
4492
|
+
return fresh ? '#e8ffe8' : 'white';
|
|
4493
|
+
};
|
|
4494
|
+
colorizeByAuthor = options.colorizeByAuthor === '1' || options.colorizeByAuthor === true;
|
|
4495
|
+
creator = _solidLogic.store.any(message, ns.foaf('maker'));
|
|
4496
|
+
date = _solidLogic.store.any(message, ns.dct('created'));
|
|
4497
|
+
_context10.next = 6;
|
|
4498
|
+
return (0, _chatLogic.mostRecentVersion)(message);
|
|
4499
|
+
case 6:
|
|
4500
|
+
latestVersion = _context10.sent;
|
|
4501
|
+
content = _solidLogic.store.any(latestVersion, ns.sioc('content')); // const id = store.any(latestVersion, ns.sioc('id'))
|
|
4502
|
+
// const replies = store.each(latestVersion, ns.sioc('has_reply'))
|
|
4503
|
+
_context10.next = 10;
|
|
4504
|
+
return (0, _chatLogic.allVersions)(message);
|
|
4505
|
+
case 10:
|
|
4506
|
+
versions = _context10.sent;
|
|
4507
|
+
if (versions.length > 1) {
|
|
4508
|
+
debug.log('renderMessageRow versions: ', versions.join(', '));
|
|
4509
|
+
}
|
|
4510
|
+
// be tolerant in accepting replies on any version of a message
|
|
4511
|
+
replies = versions.map(function (version) {
|
|
4512
|
+
return _solidLogic.store.each(version, ns.sioc('has_reply'));
|
|
4513
|
+
}).flat();
|
|
4514
|
+
thread = null;
|
|
4515
|
+
straightReplies = [];
|
|
4516
|
+
_iterator2 = _createForOfIteratorHelper(replies);
|
|
4517
|
+
try {
|
|
4518
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
4519
|
+
reply = _step2.value;
|
|
4520
|
+
if (_solidLogic.store.holds(reply, ns.rdf('type'), ns.sioc('Thread'))) {
|
|
4521
|
+
thread = reply;
|
|
4522
|
+
debug.log('renderMessageRow: found thread: ' + thread);
|
|
4523
|
+
} else {
|
|
4524
|
+
straightReplies.push(reply);
|
|
4525
|
+
}
|
|
4526
|
+
}
|
|
4527
|
+
} catch (err) {
|
|
4528
|
+
_iterator2.e(err);
|
|
4529
|
+
} finally {
|
|
4530
|
+
_iterator2.f();
|
|
4531
|
+
}
|
|
4532
|
+
if (straightReplies.length > 1) {
|
|
4533
|
+
debug.log('renderMessageRow: found normal replies: ', straightReplies);
|
|
4534
|
+
}
|
|
4535
|
+
_context10.next = 20;
|
|
4536
|
+
return (0, _chatLogic.originalVersion)(message);
|
|
4537
|
+
case 20:
|
|
4538
|
+
originalMessage = _context10.sent;
|
|
4539
|
+
edited = !message.sameTerm(originalMessage); // @@ load it first @@ Or display the new data at the old date.
|
|
4540
|
+
// @@@ kludge!
|
|
4541
|
+
sortDate = _solidLogic.store.the(originalMessage, ns.dct('created'), null, originalMessage.doc()) || _solidLogic.store.the(message, ns.dct('created'), null, message.doc()); // In message
|
|
4542
|
+
messageRow = dom.createElement('tr');
|
|
4543
|
+
messageRow.AJAR_date = sortDate.value;
|
|
4544
|
+
messageRow.AJAR_subject = message;
|
|
4545
|
+
td1 = dom.createElement('td');
|
|
4546
|
+
messageRow.appendChild(td1);
|
|
4547
|
+
if (!options.authorDateOnLeft) {
|
|
4548
|
+
img = dom.createElement('img');
|
|
4549
|
+
img.setAttribute('style', 'max-height: 2.5em; max-width: 2.5em; border-radius: 0.5em; margin: auto;');
|
|
4550
|
+
widgets.setImage(img, creator);
|
|
4551
|
+
td1.appendChild(img);
|
|
4552
|
+
} else {
|
|
4553
|
+
creatorAndDate(td1, creator, widgets.shortDate(sortDate.value), message);
|
|
4554
|
+
}
|
|
4555
|
+
bothDates = widgets.shortDate(sortDate.value);
|
|
4556
|
+
if (edited) {
|
|
4557
|
+
bothDates += ' ... ' + widgets.shortDate(date.value);
|
|
4558
|
+
}
|
|
4559
|
+
|
|
4560
|
+
// Render the content ot the message itself
|
|
4561
|
+
td2 = messageRow.appendChild(dom.createElement('td'));
|
|
4562
|
+
if (!options.authorDateOnLeft) {
|
|
4563
|
+
creatorAndDateHorizontal(td2, creator, bothDates,
|
|
4564
|
+
// widgets.shortDate(dateString)
|
|
4565
|
+
message);
|
|
4566
|
+
}
|
|
4567
|
+
text = content ? content.value.trim() : '??? no content?';
|
|
4568
|
+
isURI = /^https?:\/[^ <>]*$/i.test(text);
|
|
4569
|
+
para = null;
|
|
4570
|
+
if (isURI) {
|
|
4571
|
+
isImage = /\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(text); // @@ Should use content-type not URI
|
|
4572
|
+
if (isImage && options.expandImagesInline) {
|
|
4573
|
+
_img = elementForImageURI(text, options);
|
|
4574
|
+
td2.appendChild(_img);
|
|
4575
|
+
} else {
|
|
4576
|
+
// Link but not Image
|
|
4577
|
+
anc = td2.appendChild(dom.createElement('a'));
|
|
4578
|
+
para = anc.appendChild(dom.createElement('p'));
|
|
4579
|
+
anc.href = text;
|
|
4580
|
+
para.textContent = text;
|
|
4581
|
+
td2.appendChild(anc);
|
|
4582
|
+
}
|
|
4583
|
+
} else {
|
|
4584
|
+
// text
|
|
4585
|
+
para = dom.createElement('p');
|
|
4586
|
+
td2.appendChild(para);
|
|
4587
|
+
para.textContent = text;
|
|
4588
|
+
}
|
|
4589
|
+
if (para) {
|
|
4590
|
+
bgcolor = colorizeByAuthor ? pad.lightColorHash(creator) : getBgColor(fresh);
|
|
4591
|
+
para.setAttribute('style', messageBodyStyle + 'background-color: ' + bgcolor + ';');
|
|
4592
|
+
}
|
|
4593
|
+
_context10.next = 40;
|
|
4594
|
+
return (0, _messageTools.sentimentStripLinked)(message, message.doc());
|
|
4595
|
+
case 40:
|
|
4596
|
+
strip = _context10.sent;
|
|
4597
|
+
if (strip.children.length) {
|
|
4598
|
+
td2.appendChild(dom.createElement('br'));
|
|
4599
|
+
td2.appendChild(strip);
|
|
4600
|
+
}
|
|
4601
|
+
|
|
4602
|
+
// Message tool bar button
|
|
4603
|
+
td3 = dom.createElement('td');
|
|
4604
|
+
messageRow.appendChild(td3);
|
|
4605
|
+
toolsButton = widgets.button(dom, _iconBase.icons.iconBase + 'noun_243787.svg', '...');
|
|
4606
|
+
td3.appendChild(toolsButton);
|
|
4607
|
+
toolsButton.addEventListener('click', /*#__PURE__*/function () {
|
|
4608
|
+
var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(_event) {
|
|
4609
|
+
var toolsTR, tools, toolsTD;
|
|
4610
|
+
return _regenerator["default"].wrap(function _callee8$(_context9) {
|
|
4611
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
4612
|
+
case 0:
|
|
4613
|
+
if (!messageRow.toolTR) {
|
|
4614
|
+
_context9.next = 4;
|
|
4615
|
+
break;
|
|
4616
|
+
}
|
|
4617
|
+
// already got a toolbar? Toogle
|
|
4618
|
+
messageRow.parentNode.removeChild(messageRow.toolTR);
|
|
4619
|
+
delete messageRow.toolTR;
|
|
4620
|
+
return _context9.abrupt("return");
|
|
4621
|
+
case 4:
|
|
4622
|
+
toolsTR = dom.createElement('tr');
|
|
4623
|
+
_context9.next = 7;
|
|
4624
|
+
return (0, _messageTools.messageToolbar)(message, messageRow, _objectSpread(_objectSpread({}, userContext), {}, {
|
|
4625
|
+
chatOptions: options
|
|
4626
|
+
}), channelObject);
|
|
4627
|
+
case 7:
|
|
4628
|
+
tools = _context9.sent;
|
|
4629
|
+
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
|
|
4630
|
+
if (messageRow.nextSibling) {
|
|
4631
|
+
messageRow.parentElement.insertBefore(toolsTR, messageRow.nextSibling);
|
|
4632
|
+
} else {
|
|
4633
|
+
messageRow.parentElement.appendChild(toolsTR);
|
|
4634
|
+
}
|
|
4635
|
+
messageRow.toolTR = toolsTR;
|
|
4636
|
+
toolsTR.appendChild(dom.createElement('td')); // left
|
|
4637
|
+
toolsTD = toolsTR.appendChild(dom.createElement('td'));
|
|
4638
|
+
toolsTR.appendChild(dom.createElement('td')); // right
|
|
4639
|
+
toolsTD.appendChild(tools);
|
|
4640
|
+
case 15:
|
|
4641
|
+
case "end":
|
|
4642
|
+
return _context9.stop();
|
|
4643
|
+
}
|
|
4644
|
+
}, _callee8);
|
|
4645
|
+
}));
|
|
4646
|
+
return function (_x20) {
|
|
4647
|
+
return _ref4.apply(this, arguments);
|
|
4648
|
+
};
|
|
4649
|
+
}());
|
|
4650
|
+
if (thread && options.showThread) {
|
|
4651
|
+
debug.log(' message has thread ' + thread);
|
|
4652
|
+
td3.appendChild(widgets.button(dom, _iconBase.icons.iconBase + 'noun_1180164.svg',
|
|
4653
|
+
// right arrow .. @@ think of stg better
|
|
4654
|
+
'see thread', function (_e) {
|
|
4655
|
+
debug.log('@@@@ Calling showThread thread ' + thread);
|
|
4656
|
+
options.showThread(thread, options);
|
|
4657
|
+
}));
|
|
4658
|
+
}
|
|
4659
|
+
return _context10.abrupt("return", messageRow);
|
|
4660
|
+
case 49:
|
|
4661
|
+
case "end":
|
|
4662
|
+
return _context10.stop();
|
|
4663
|
+
}
|
|
4664
|
+
}, _callee9);
|
|
4665
|
+
}));
|
|
4666
|
+
return _renderMessageRow.apply(this, arguments);
|
|
4218
4667
|
}
|
|
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
|
|
4668
|
+
function switchToEditor(_x6, _x7, _x8, _x9) {
|
|
4669
|
+
return _switchToEditor.apply(this, arguments);
|
|
4225
4670
|
}
|
|
4226
4671
|
/* Control for a new message -- or editing an old message ***************
|
|
4227
4672
|
*
|
|
4228
4673
|
*/
|
|
4674
|
+
function _switchToEditor() {
|
|
4675
|
+
_switchToEditor = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(messageRow, message, channelObject, userContext) {
|
|
4676
|
+
var messageTable, editRow;
|
|
4677
|
+
return _regenerator["default"].wrap(function _callee10$(_context11) {
|
|
4678
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
4679
|
+
case 0:
|
|
4680
|
+
messageTable = messageRow.parentNode;
|
|
4681
|
+
_context11.t0 = renderMessageEditor;
|
|
4682
|
+
_context11.t1 = channelObject;
|
|
4683
|
+
_context11.t2 = messageTable;
|
|
4684
|
+
_context11.t3 = userContext;
|
|
4685
|
+
_context11.t4 = channelObject.options;
|
|
4686
|
+
_context11.next = 8;
|
|
4687
|
+
return (0, _chatLogic.mostRecentVersion)(message);
|
|
4688
|
+
case 8:
|
|
4689
|
+
_context11.t5 = _context11.sent;
|
|
4690
|
+
editRow = (0, _context11.t0)(_context11.t1, _context11.t2, _context11.t3, _context11.t4, _context11.t5);
|
|
4691
|
+
messageTable.insertBefore(editRow, messageRow);
|
|
4692
|
+
editRow.originalRow = messageRow;
|
|
4693
|
+
messageRow.style.visibility = 'hidden'; // Hide the original message. unhide if user cancels edit
|
|
4694
|
+
case 13:
|
|
4695
|
+
case "end":
|
|
4696
|
+
return _context11.stop();
|
|
4697
|
+
}
|
|
4698
|
+
}, _callee10);
|
|
4699
|
+
}));
|
|
4700
|
+
return _switchToEditor.apply(this, arguments);
|
|
4701
|
+
}
|
|
4229
4702
|
function renderMessageEditor(channelObject, messageTable, userContext, options, originalMessage) {
|
|
4230
4703
|
function revertEditing(messageEditor) {
|
|
4231
4704
|
messageEditor.originalRow.style.visibility = 'visible'; // restore read-only version
|
|
4232
4705
|
messageEditor.parentNode.removeChild(messageEditor);
|
|
4233
4706
|
}
|
|
4234
|
-
function handleFieldInput(
|
|
4707
|
+
function handleFieldInput(_x10) {
|
|
4235
4708
|
return _handleFieldInput.apply(this, arguments);
|
|
4236
4709
|
}
|
|
4237
4710
|
function _handleFieldInput() {
|
|
@@ -4249,72 +4722,87 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4249
4722
|
}));
|
|
4250
4723
|
return _handleFieldInput.apply(this, arguments);
|
|
4251
4724
|
}
|
|
4252
|
-
function sendMessage(
|
|
4725
|
+
function sendMessage(_x11, _x12) {
|
|
4253
4726
|
return _sendMessage.apply(this, arguments);
|
|
4254
4727
|
} // sendMessage
|
|
4255
4728
|
// DRAG AND DROP
|
|
4256
4729
|
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 (
|
|
4730
|
+
_sendMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(text, fromMainField) {
|
|
4731
|
+
var sendComplete, _sendComplete, message, statusArea;
|
|
4732
|
+
return _regenerator["default"].wrap(function _callee7$(_context8) {
|
|
4733
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
4261
4734
|
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
|
-
}
|
|
4735
|
+
_sendComplete = function _sendComplete3() {
|
|
4736
|
+
_sendComplete = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(message, _text2) {
|
|
4737
|
+
var oldRow;
|
|
4738
|
+
return _regenerator["default"].wrap(function _callee6$(_context7) {
|
|
4739
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
4740
|
+
case 0:
|
|
4741
|
+
_context7.next = 2;
|
|
4742
|
+
return (0, _infinite.insertMessageIntoTable)(channelObject, messageTable, message, false, options, userContext);
|
|
4743
|
+
case 2:
|
|
4744
|
+
// not green
|
|
4278
4745
|
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
}
|
|
4290
|
-
// await channelObject.div.refresh() // Add new day if nec @@ add back
|
|
4291
|
-
};
|
|
4746
|
+
if (originalMessage) {
|
|
4747
|
+
// editing another message
|
|
4748
|
+
oldRow = messageEditor.originalRow; // oldRow.style.display = '' // restore read-only version, re-attack
|
|
4749
|
+
if (oldRow.parentNode) {
|
|
4750
|
+
oldRow.parentNode.removeChild(oldRow); // No longer needed old version
|
|
4751
|
+
} else {
|
|
4752
|
+
debug.warn('No parentNode on old message ' + oldRow.textContent);
|
|
4753
|
+
oldRow.style.backgroundColor = '#fee';
|
|
4754
|
+
oldRow.style.visibility = 'hidden'; // @@ FIX THIS AND REMOVE FROM DOM INSTEAD
|
|
4755
|
+
}
|
|
4292
4756
|
|
|
4757
|
+
messageEditor.parentNode.removeChild(messageEditor); // no longer need editor
|
|
4758
|
+
} else {
|
|
4759
|
+
if (fromMainField) {
|
|
4760
|
+
field.value = ''; // clear from out for reuse
|
|
4761
|
+
field.setAttribute('style', messageBodyStyle);
|
|
4762
|
+
field.disabled = false;
|
|
4763
|
+
field.scrollIntoView(options.newestFirst); // allign bottom (top)
|
|
4764
|
+
field.focus(); // Start typing next line immediately
|
|
4765
|
+
field.select();
|
|
4766
|
+
}
|
|
4767
|
+
}
|
|
4768
|
+
// await channelObject.div.refresh() // Add new day if nec @@ add back
|
|
4769
|
+
case 3:
|
|
4770
|
+
case "end":
|
|
4771
|
+
return _context7.stop();
|
|
4772
|
+
}
|
|
4773
|
+
}, _callee6);
|
|
4774
|
+
}));
|
|
4775
|
+
return _sendComplete.apply(this, arguments);
|
|
4776
|
+
};
|
|
4777
|
+
sendComplete = function _sendComplete2(_x18, _x19) {
|
|
4778
|
+
return _sendComplete.apply(this, arguments);
|
|
4779
|
+
};
|
|
4293
4780
|
// const me = authn.currentUser() // Must be logged on or wuld have got login button
|
|
4294
4781
|
if (fromMainField) {
|
|
4295
4782
|
field.setAttribute('style', messageBodyStyle + 'color: #bbb;'); // pendingedit
|
|
4296
4783
|
field.disabled = true;
|
|
4297
4784
|
}
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
return channelObject.updateMessage(text, originalMessage);
|
|
4301
|
-
case
|
|
4302
|
-
message =
|
|
4303
|
-
|
|
4785
|
+
_context8.prev = 3;
|
|
4786
|
+
_context8.next = 6;
|
|
4787
|
+
return channelObject.updateMessage(text, originalMessage, null, options.thread);
|
|
4788
|
+
case 6:
|
|
4789
|
+
message = _context8.sent;
|
|
4790
|
+
_context8.next = 14;
|
|
4304
4791
|
break;
|
|
4305
|
-
case
|
|
4306
|
-
|
|
4307
|
-
|
|
4792
|
+
case 9:
|
|
4793
|
+
_context8.prev = 9;
|
|
4794
|
+
_context8.t0 = _context8["catch"](3);
|
|
4308
4795
|
statusArea = userContext.statusArea || messageEditor;
|
|
4309
|
-
statusArea.appendChild(widgets.errorMessageBlock(dom, 'Error writing message: ' +
|
|
4310
|
-
return
|
|
4311
|
-
case 13:
|
|
4312
|
-
sendComplete(message, text);
|
|
4796
|
+
statusArea.appendChild(widgets.errorMessageBlock(dom, 'Error writing message: ' + _context8.t0));
|
|
4797
|
+
return _context8.abrupt("return");
|
|
4313
4798
|
case 14:
|
|
4799
|
+
_context8.next = 16;
|
|
4800
|
+
return sendComplete(message, text);
|
|
4801
|
+
case 16:
|
|
4314
4802
|
case "end":
|
|
4315
|
-
return
|
|
4803
|
+
return _context8.stop();
|
|
4316
4804
|
}
|
|
4317
|
-
},
|
|
4805
|
+
}, _callee7, null, [[3, 9]]);
|
|
4318
4806
|
}));
|
|
4319
4807
|
return _sendMessage.apply(this, arguments);
|
|
4320
4808
|
}
|
|
@@ -4333,7 +4821,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4333
4821
|
}
|
|
4334
4822
|
}, _callee);
|
|
4335
4823
|
}));
|
|
4336
|
-
return function (
|
|
4824
|
+
return function (_x13, _x14) {
|
|
4337
4825
|
return _ref.apply(this, arguments);
|
|
4338
4826
|
};
|
|
4339
4827
|
}());
|
|
@@ -4377,7 +4865,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4377
4865
|
}
|
|
4378
4866
|
}, _callee2, null, [[1, 11, 14, 17]]);
|
|
4379
4867
|
}));
|
|
4380
|
-
return function droppedURIHandler(
|
|
4868
|
+
return function droppedURIHandler(_x15) {
|
|
4381
4869
|
return _ref2.apply(this, arguments);
|
|
4382
4870
|
};
|
|
4383
4871
|
}();
|
|
@@ -4388,7 +4876,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4388
4876
|
imageDoc = $rdf.sym(chatDocument.dir().uri + 'Image_' + Date.now() + '.png');
|
|
4389
4877
|
return imageDoc;
|
|
4390
4878
|
}
|
|
4391
|
-
function tookPicture(
|
|
4879
|
+
function tookPicture(_x16) {
|
|
4392
4880
|
return _tookPicture.apply(this, arguments);
|
|
4393
4881
|
} // Body of turnOnInput
|
|
4394
4882
|
function _tookPicture() {
|
|
@@ -4465,7 +4953,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4465
4953
|
}
|
|
4466
4954
|
}, _callee3);
|
|
4467
4955
|
}));
|
|
4468
|
-
return function (
|
|
4956
|
+
return function (_x17) {
|
|
4469
4957
|
return _ref3.apply(this, arguments);
|
|
4470
4958
|
};
|
|
4471
4959
|
}(), false);
|
|
@@ -4527,7 +5015,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4527
5015
|
turnOnInput();
|
|
4528
5016
|
Object.assign(context, userContext);
|
|
4529
5017
|
(0, _bookmarks.findBookmarkDocument)(context).then(function (_context) {
|
|
4530
|
-
//
|
|
5018
|
+
// debug.log('Bookmark file: ' + context.bookmarkDocument)
|
|
4531
5019
|
});
|
|
4532
5020
|
});
|
|
4533
5021
|
return messageEditor;
|
|
@@ -4550,12 +5038,15 @@ var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_m
|
|
|
4550
5038
|
Object.defineProperty(exports, "__esModule", ({
|
|
4551
5039
|
value: true
|
|
4552
5040
|
}));
|
|
5041
|
+
exports.ActionClassFromEmoji = ActionClassFromEmoji;
|
|
5042
|
+
exports.emojiFromAction = emojiFromAction;
|
|
5043
|
+
exports.emojiFromActionClass = emojiFromActionClass;
|
|
4553
5044
|
exports.messageToolbar = messageToolbar;
|
|
4554
5045
|
exports.sentimentStrip = sentimentStrip;
|
|
4555
5046
|
exports.sentimentStripLinked = sentimentStripLinked;
|
|
4556
5047
|
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
5048
|
var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "./node_modules/@babel/runtime/helpers/slicedToArray.js"));
|
|
5049
|
+
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
4559
5050
|
var debug = _interopRequireWildcard(__webpack_require__(/*! ../debug */ "./lib/debug.js"));
|
|
4560
5051
|
var _iconBase = __webpack_require__(/*! ../iconBase */ "./lib/iconBase.js");
|
|
4561
5052
|
var ns = _interopRequireWildcard(__webpack_require__(/*! ../ns */ "./lib/ns.js"));
|
|
@@ -4596,30 +5087,46 @@ var PENCIL_ICON = 'noun_253504.svg'; // edit a message
|
|
|
4596
5087
|
// const SPANNER_ICON = 'noun_344563.svg' -> settings
|
|
4597
5088
|
var THUMBS_UP_ICON = 'noun_1384132.svg';
|
|
4598
5089
|
var THUMBS_DOWN_ICON = 'noun_1384135.svg';
|
|
5090
|
+
var REPLY_ICON = 'noun-reply-5506924.svg';
|
|
4599
5091
|
/**
|
|
4600
5092
|
* Emoji in Unicode
|
|
4601
5093
|
*/
|
|
4602
|
-
var
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
|
|
4606
|
-
|
|
5094
|
+
var emojiMap = {};
|
|
5095
|
+
emojiMap[ns.schema('AgreeAction')] = '👍';
|
|
5096
|
+
emojiMap[ns.schema('DisagreeAction')] = '👎';
|
|
5097
|
+
emojiMap[ns.schema('EndorseAction')] = '⭐️';
|
|
5098
|
+
emojiMap[ns.schema('LikeAction')] = '❤️';
|
|
5099
|
+
function emojiFromActionClass(action) {
|
|
5100
|
+
return emojiMap[action] || null;
|
|
5101
|
+
}
|
|
5102
|
+
function ActionClassFromEmoji(emoji) {
|
|
5103
|
+
for (var a in emojiMap) {
|
|
5104
|
+
if (emojiMap[a] === emoji) {
|
|
5105
|
+
return rdf.sym(a.slice(1, -1)); // remove < >
|
|
5106
|
+
}
|
|
5107
|
+
}
|
|
5108
|
+
|
|
5109
|
+
return null;
|
|
5110
|
+
}
|
|
5111
|
+
|
|
5112
|
+
// Allow the qction to give its own emoji as content,
|
|
5113
|
+
// or get the emoji from the class lof action.
|
|
5114
|
+
function emojiFromAction(action) {
|
|
5115
|
+
var content = _solidLogic.store.any(action, ns.sioc('content'), null, action.doc());
|
|
5116
|
+
if (content) return content;
|
|
5117
|
+
var klass = _solidLogic.store.any(action, ns.rdf('type'), null, action.doc());
|
|
5118
|
+
if (klass) {
|
|
5119
|
+
var em = emojiFromActionClass(klass);
|
|
5120
|
+
if (em) return em;
|
|
5121
|
+
}
|
|
5122
|
+
return '⬜️';
|
|
5123
|
+
}
|
|
4607
5124
|
|
|
4608
5125
|
/**
|
|
4609
5126
|
* Create strip of sentiments expressed
|
|
4610
5127
|
*/
|
|
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(' '));
|
|
5128
|
+
function sentimentStrip(_x, _x2) {
|
|
5129
|
+
return _sentimentStrip.apply(this, arguments);
|
|
4623
5130
|
}
|
|
4624
5131
|
/**
|
|
4625
5132
|
* Create strip of sentiments expressed, with hyperlinks
|
|
@@ -4627,276 +5134,445 @@ function sentimentStrip(target, doc) {
|
|
|
4627
5134
|
* @param target {NamedNode} - The thing about which they are expressed
|
|
4628
5135
|
* @param doc {NamedNode} - The document in which they are expressed
|
|
4629
5136
|
*/
|
|
4630
|
-
function
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
5137
|
+
function _sentimentStrip() {
|
|
5138
|
+
_sentimentStrip = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(target, doc) {
|
|
5139
|
+
var versions, actions, strings;
|
|
5140
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
5141
|
+
while (1) switch (_context.prev = _context.next) {
|
|
5142
|
+
case 0:
|
|
5143
|
+
_context.next = 2;
|
|
5144
|
+
return (0, _chatLogic.allVersions)(target);
|
|
5145
|
+
case 2:
|
|
5146
|
+
versions = _context.sent;
|
|
5147
|
+
debug.log('sentimentStrip Versions for ' + target, versions);
|
|
5148
|
+
actions = versions.map(function (version) {
|
|
5149
|
+
return _solidLogic.store.each(null, ns.schema('target'), version, doc);
|
|
5150
|
+
}).flat();
|
|
5151
|
+
debug.log('sentimentStrip: Actions for ' + target, actions);
|
|
5152
|
+
strings = actions.map(function (action) {
|
|
5153
|
+
return emojiFromAction(action) || '';
|
|
5154
|
+
});
|
|
5155
|
+
return _context.abrupt("return", dom.createTextNode(strings.join(' ')));
|
|
5156
|
+
case 8:
|
|
5157
|
+
case "end":
|
|
5158
|
+
return _context.stop();
|
|
4649
5159
|
}
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
return strip;
|
|
5160
|
+
}, _callee);
|
|
5161
|
+
}));
|
|
5162
|
+
return _sentimentStrip.apply(this, arguments);
|
|
5163
|
+
}
|
|
5164
|
+
function sentimentStripLinked(_x3, _x4) {
|
|
5165
|
+
return _sentimentStripLinked.apply(this, arguments);
|
|
4657
5166
|
}
|
|
4658
5167
|
/**
|
|
4659
5168
|
* Creates a message toolbar component
|
|
4660
5169
|
*/
|
|
4661
|
-
function
|
|
4662
|
-
function
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
5170
|
+
function _sentimentStripLinked() {
|
|
5171
|
+
_sentimentStripLinked = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(target, doc) {
|
|
5172
|
+
var strip, refresh, _refresh;
|
|
5173
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
5174
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
5175
|
+
case 0:
|
|
5176
|
+
_refresh = function _refresh3() {
|
|
5177
|
+
_refresh = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
5178
|
+
var versions, actions, sentiments;
|
|
5179
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
5180
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
5181
|
+
case 0:
|
|
5182
|
+
strip.innerHTML = '';
|
|
5183
|
+
if (!(0, _chatLogic.isDeleted)(target)) {
|
|
5184
|
+
_context2.next = 3;
|
|
5185
|
+
break;
|
|
5186
|
+
}
|
|
5187
|
+
return _context2.abrupt("return", strip);
|
|
5188
|
+
case 3:
|
|
5189
|
+
_context2.next = 5;
|
|
5190
|
+
return (0, _chatLogic.allVersions)(target);
|
|
5191
|
+
case 5:
|
|
5192
|
+
versions = _context2.sent;
|
|
5193
|
+
debug.log('sentimentStripLinked: Versions for ' + target, versions);
|
|
5194
|
+
actions = versions.map(function (version) {
|
|
5195
|
+
return _solidLogic.store.each(null, ns.schema('target'), version, doc);
|
|
5196
|
+
}).flat();
|
|
5197
|
+
debug.log('sentimentStripLinked: Actions for ' + target, actions);
|
|
5198
|
+
if (!(actions.length === 0)) {
|
|
5199
|
+
_context2.next = 11;
|
|
5200
|
+
break;
|
|
5201
|
+
}
|
|
5202
|
+
return _context2.abrupt("return", strip);
|
|
5203
|
+
case 11:
|
|
5204
|
+
sentiments = actions.map(function (a) {
|
|
5205
|
+
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)];
|
|
5206
|
+
});
|
|
5207
|
+
debug.log(' Actions sentiments ', sentiments);
|
|
5208
|
+
sentiments.sort();
|
|
5209
|
+
sentiments.forEach(function (ss) {
|
|
5210
|
+
var _ss = (0, _slicedToArray2["default"])(ss, 3),
|
|
5211
|
+
theClass = _ss[0],
|
|
5212
|
+
content = _ss[1],
|
|
5213
|
+
agent = _ss[2];
|
|
5214
|
+
var res;
|
|
5215
|
+
if (agent) {
|
|
5216
|
+
res = dom.createElement('a');
|
|
5217
|
+
res.setAttribute('href', agent.uri);
|
|
5218
|
+
} else {
|
|
5219
|
+
res = dom.createTextNode('');
|
|
5220
|
+
}
|
|
5221
|
+
res.textContent = content || emojiMap[theClass] || '⬜️';
|
|
5222
|
+
strip.appendChild(res);
|
|
5223
|
+
});
|
|
5224
|
+
debug.log(' Actions strip ', strip);
|
|
5225
|
+
case 16:
|
|
5226
|
+
case "end":
|
|
5227
|
+
return _context2.stop();
|
|
5228
|
+
}
|
|
5229
|
+
}, _callee2);
|
|
5230
|
+
}));
|
|
5231
|
+
return _refresh.apply(this, arguments);
|
|
5232
|
+
};
|
|
5233
|
+
refresh = function _refresh2() {
|
|
5234
|
+
return _refresh.apply(this, arguments);
|
|
5235
|
+
};
|
|
5236
|
+
strip = dom.createElement('span');
|
|
5237
|
+
refresh().then(debug.log('sentimentStripLinked: sentimentStripLinked async refreshed'));
|
|
5238
|
+
strip.refresh = refresh;
|
|
5239
|
+
return _context3.abrupt("return", strip);
|
|
5240
|
+
case 6:
|
|
5241
|
+
case "end":
|
|
5242
|
+
return _context3.stop();
|
|
5243
|
+
}
|
|
5244
|
+
}, _callee3);
|
|
5245
|
+
}));
|
|
5246
|
+
return _sentimentStripLinked.apply(this, arguments);
|
|
5247
|
+
}
|
|
5248
|
+
function messageToolbar(_x5, _x6, _x7, _x8) {
|
|
5249
|
+
return _messageToolbar.apply(this, arguments);
|
|
5250
|
+
}
|
|
5251
|
+
function _messageToolbar() {
|
|
5252
|
+
_messageToolbar = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(message, messageRow, userContext, channelObject) {
|
|
5253
|
+
var deleteMessage, _deleteMessage, editMessage, _editMessage, replyInThread, _replyInThread, div, closeToolbar, deleteThingThen, _deleteThingThen, me, sentimentButton, context1, cancelButton;
|
|
5254
|
+
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
|
5255
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
5256
|
+
case 0:
|
|
5257
|
+
sentimentButton = function _sentimentButton(context, target, icon, actionClass, doc, mutuallyExclusive) {
|
|
5258
|
+
function setColor() {
|
|
5259
|
+
button.style.backgroundColor = action ? 'yellow' : 'white';
|
|
4675
5260
|
}
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
5261
|
+
var button = widgets.button(dom, icon, utils.label(actionClass), /*#__PURE__*/function () {
|
|
5262
|
+
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(_event) {
|
|
5263
|
+
var insertMe, dirty, i, a;
|
|
5264
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
5265
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
5266
|
+
case 0:
|
|
5267
|
+
if (!action) {
|
|
5268
|
+
_context4.next = 7;
|
|
5269
|
+
break;
|
|
5270
|
+
}
|
|
5271
|
+
_context4.next = 3;
|
|
5272
|
+
return deleteThingThen(action);
|
|
5273
|
+
case 3:
|
|
5274
|
+
action = null;
|
|
5275
|
+
setColor();
|
|
5276
|
+
_context4.next = 25;
|
|
5277
|
+
break;
|
|
5278
|
+
case 7:
|
|
5279
|
+
// no action
|
|
5280
|
+
action = widgets.newThing(doc);
|
|
5281
|
+
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)];
|
|
5282
|
+
_context4.next = 11;
|
|
5283
|
+
return _solidLogic.store.updater.update([], insertMe);
|
|
5284
|
+
case 11:
|
|
5285
|
+
setColor();
|
|
5286
|
+
if (!mutuallyExclusive) {
|
|
5287
|
+
_context4.next = 25;
|
|
5288
|
+
break;
|
|
5289
|
+
}
|
|
5290
|
+
// Delete incompative sentiments
|
|
5291
|
+
dirty = false;
|
|
5292
|
+
i = 0;
|
|
5293
|
+
case 15:
|
|
5294
|
+
if (!(i < mutuallyExclusive.length)) {
|
|
5295
|
+
_context4.next = 24;
|
|
5296
|
+
break;
|
|
5297
|
+
}
|
|
5298
|
+
a = existingAction(mutuallyExclusive[i]);
|
|
5299
|
+
if (!a) {
|
|
5300
|
+
_context4.next = 21;
|
|
5301
|
+
break;
|
|
5302
|
+
}
|
|
5303
|
+
_context4.next = 20;
|
|
5304
|
+
return deleteThingThen(a);
|
|
5305
|
+
case 20:
|
|
5306
|
+
// but how refresh? refreshTree the parent?
|
|
5307
|
+
dirty = true;
|
|
5308
|
+
case 21:
|
|
5309
|
+
i++;
|
|
5310
|
+
_context4.next = 15;
|
|
5311
|
+
break;
|
|
5312
|
+
case 24:
|
|
5313
|
+
if (dirty) {
|
|
5314
|
+
// widgets.refreshTree(button.parentNode) // requires them all to be immediate siblings
|
|
5315
|
+
widgets.refreshTree(messageRow); // requires them all to be immediate siblings
|
|
5316
|
+
}
|
|
5317
|
+
case 25:
|
|
5318
|
+
case "end":
|
|
5319
|
+
return _context4.stop();
|
|
5320
|
+
}
|
|
5321
|
+
}, _callee4);
|
|
5322
|
+
}));
|
|
5323
|
+
return function (_x11) {
|
|
5324
|
+
return _ref.apply(this, arguments);
|
|
5325
|
+
};
|
|
5326
|
+
}());
|
|
5327
|
+
function existingAction(actionClass) {
|
|
5328
|
+
var actions = _solidLogic.store.each(null, ns.schema('agent'), context.me, doc).filter(function (x) {
|
|
5329
|
+
return _solidLogic.store.holds(x, ns.rdf('type'), actionClass, doc);
|
|
5330
|
+
}).filter(function (x) {
|
|
5331
|
+
return _solidLogic.store.holds(x, ns.schema('target'), target, doc);
|
|
5332
|
+
});
|
|
5333
|
+
return actions.length ? actions[0] : null;
|
|
4683
5334
|
}
|
|
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);
|
|
5335
|
+
function refresh() {
|
|
5336
|
+
action = existingAction(actionClass);
|
|
5337
|
+
setColor();
|
|
4725
5338
|
}
|
|
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
|
-
|
|
5339
|
+
var action;
|
|
5340
|
+
button.refresh = refresh; // If the file changes, refresh live
|
|
5341
|
+
refresh();
|
|
5342
|
+
return button;
|
|
5343
|
+
};
|
|
5344
|
+
_deleteThingThen = function _deleteThingThen3() {
|
|
5345
|
+
_deleteThingThen = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(x) {
|
|
5346
|
+
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
|
5347
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
5348
|
+
case 0:
|
|
5349
|
+
_context9.next = 2;
|
|
5350
|
+
return _solidLogic.store.updater.update(_solidLogic.store.connectedStatements(x), []);
|
|
5351
|
+
case 2:
|
|
5352
|
+
case "end":
|
|
5353
|
+
return _context9.stop();
|
|
5354
|
+
}
|
|
5355
|
+
}, _callee9);
|
|
5356
|
+
}));
|
|
5357
|
+
return _deleteThingThen.apply(this, arguments);
|
|
5358
|
+
};
|
|
5359
|
+
deleteThingThen = function _deleteThingThen2(_x10) {
|
|
5360
|
+
return _deleteThingThen.apply(this, arguments);
|
|
5361
|
+
};
|
|
5362
|
+
closeToolbar = function _closeToolbar() {
|
|
5363
|
+
div.parentElement.parentElement.removeChild(div.parentElement); // remive the TR
|
|
5364
|
+
};
|
|
5365
|
+
_replyInThread = function _replyInThread3() {
|
|
5366
|
+
_replyInThread = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
|
|
5367
|
+
var thread, options;
|
|
5368
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
5369
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
5370
|
+
case 0:
|
|
5371
|
+
_context8.next = 2;
|
|
5372
|
+
return channelObject.createThread(message);
|
|
5373
|
+
case 2:
|
|
5374
|
+
thread = _context8.sent;
|
|
5375
|
+
options = userContext.chatOptions;
|
|
5376
|
+
if (options) {
|
|
5377
|
+
_context8.next = 6;
|
|
5378
|
+
break;
|
|
5379
|
+
}
|
|
5380
|
+
throw new Error('replyInThread: missing options');
|
|
5381
|
+
case 6:
|
|
5382
|
+
options.showThread(thread, options);
|
|
5383
|
+
closeToolbar(); // a one-off action
|
|
5384
|
+
case 8:
|
|
5385
|
+
case "end":
|
|
5386
|
+
return _context8.stop();
|
|
5387
|
+
}
|
|
5388
|
+
}, _callee8);
|
|
5389
|
+
}));
|
|
5390
|
+
return _replyInThread.apply(this, arguments);
|
|
5391
|
+
};
|
|
5392
|
+
replyInThread = function _replyInThread2() {
|
|
5393
|
+
return _replyInThread.apply(this, arguments);
|
|
5394
|
+
};
|
|
5395
|
+
_editMessage = function _editMessage3() {
|
|
5396
|
+
_editMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(messageRow) {
|
|
5397
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
5398
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
5399
|
+
case 0:
|
|
5400
|
+
if (!(me.value === _solidLogic.store.any(message, ns.foaf('maker')).value)) {
|
|
5401
|
+
_context7.next = 4;
|
|
5402
|
+
break;
|
|
5403
|
+
}
|
|
5404
|
+
closeToolbar(); // edit is a one-off action
|
|
5405
|
+
_context7.next = 4;
|
|
5406
|
+
return (0, _message.switchToEditor)(messageRow, message, channelObject, userContext);
|
|
5407
|
+
case 4:
|
|
5408
|
+
case "end":
|
|
5409
|
+
return _context7.stop();
|
|
5410
|
+
}
|
|
5411
|
+
}, _callee7);
|
|
5412
|
+
}));
|
|
5413
|
+
return _editMessage.apply(this, arguments);
|
|
5414
|
+
};
|
|
5415
|
+
editMessage = function _editMessage2(_x9) {
|
|
5416
|
+
return _editMessage.apply(this, arguments);
|
|
5417
|
+
};
|
|
5418
|
+
_deleteMessage = function _deleteMessage3() {
|
|
5419
|
+
_deleteMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
|
|
5420
|
+
var author, msg, area;
|
|
5421
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
5422
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
5423
|
+
case 0:
|
|
5424
|
+
author = _solidLogic.store.any(message, ns.foaf('maker'));
|
|
5425
|
+
if (me) {
|
|
5426
|
+
_context6.next = 5;
|
|
5427
|
+
break;
|
|
5428
|
+
}
|
|
5429
|
+
alert('You can\'t delete the message, you are not logged in.');
|
|
5430
|
+
_context6.next = 22;
|
|
5431
|
+
break;
|
|
5432
|
+
case 5:
|
|
5433
|
+
if (!me.sameTerm(author)) {
|
|
5434
|
+
_context6.next = 21;
|
|
5435
|
+
break;
|
|
5436
|
+
}
|
|
5437
|
+
_context6.prev = 6;
|
|
5438
|
+
_context6.next = 9;
|
|
5439
|
+
return channelObject.deleteMessage(message);
|
|
5440
|
+
case 9:
|
|
5441
|
+
_context6.next = 18;
|
|
5442
|
+
break;
|
|
5443
|
+
case 11:
|
|
5444
|
+
_context6.prev = 11;
|
|
5445
|
+
_context6.t0 = _context6["catch"](6);
|
|
5446
|
+
msg = 'Error deleting messaage ' + _context6.t0;
|
|
5447
|
+
debug.warn(msg);
|
|
5448
|
+
alert(msg);
|
|
5449
|
+
area = userContext.statusArea || messageRow.parentNode;
|
|
5450
|
+
area.appendChild(widgets.errorMessageBlock(dom, msg));
|
|
5451
|
+
case 18:
|
|
5452
|
+
messageRow.parentNode.removeChild(messageRow);
|
|
5453
|
+
_context6.next = 22;
|
|
5454
|
+
break;
|
|
5455
|
+
case 21:
|
|
5456
|
+
alert('You can\'t delete the message, you are not logged in as the author, ' + author);
|
|
5457
|
+
case 22:
|
|
5458
|
+
closeToolbar();
|
|
5459
|
+
case 23:
|
|
5460
|
+
case "end":
|
|
5461
|
+
return _context6.stop();
|
|
5462
|
+
}
|
|
5463
|
+
}, _callee6, null, [[6, 11]]);
|
|
5464
|
+
}));
|
|
5465
|
+
return _deleteMessage.apply(this, arguments);
|
|
5466
|
+
};
|
|
5467
|
+
deleteMessage = function _deleteMessage2() {
|
|
5468
|
+
return _deleteMessage.apply(this, arguments);
|
|
5469
|
+
};
|
|
5470
|
+
// alain: TODO allow chat owner to fully delete message + sentiments and replacing messages
|
|
5471
|
+
div = dom.createElement('div'); // is message deleted ?
|
|
5472
|
+
_context10.next = 13;
|
|
5473
|
+
return (0, _chatLogic.mostRecentVersion)(message).value;
|
|
5474
|
+
case 13:
|
|
5475
|
+
_context10.t0 = _context10.sent;
|
|
5476
|
+
_context10.t1 = ns.schema('dateDeleted').value;
|
|
5477
|
+
if (!(_context10.t0 === _context10.t1)) {
|
|
5478
|
+
_context10.next = 17;
|
|
5479
|
+
break;
|
|
5480
|
+
}
|
|
5481
|
+
return _context10.abrupt("return", div);
|
|
5482
|
+
case 17:
|
|
5483
|
+
// Things only the original author can do
|
|
5484
|
+
me = _solidLogic.authn.currentUser(); // If already logged on
|
|
5485
|
+
if (me && _solidLogic.store.holds(message, ns.foaf('maker'), me)) {
|
|
5486
|
+
// button to delete the message
|
|
5487
|
+
div.appendChild(widgets.deleteButtonWithCheck(dom, div, 'message', deleteMessage));
|
|
5488
|
+
// button to edit the message
|
|
5489
|
+
div.appendChild(widgets.button(dom, _iconBase.icons.iconBase + PENCIL_ICON, 'edit', function () {
|
|
5490
|
+
return editMessage(messageRow);
|
|
5491
|
+
}));
|
|
5492
|
+
} // if mine
|
|
5493
|
+
// Things anyone can do if they have a bookmark list async
|
|
5494
|
+
/*
|
|
5495
|
+
var bookmarkButton = await bookmarks.renderBookmarksButton(userContext)
|
|
5496
|
+
if (bookmarkButton) {
|
|
5497
|
+
div.appendChild(bookmarkButton)
|
|
5498
|
+
}
|
|
5499
|
+
*/
|
|
5500
|
+
// Things anyone can do if they have a bookmark list
|
|
4775
5501
|
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
5502
|
+
(0, _bookmarks.renderBookmarksButton)(userContext).then(function (bookmarkButton) {
|
|
5503
|
+
if (bookmarkButton) div.appendChild(bookmarkButton);
|
|
5504
|
+
});
|
|
4779
5505
|
|
|
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();
|
|
5506
|
+
/** Button to allow user to express a sentiment (like, endorse, etc) about a target
|
|
5507
|
+
*
|
|
5508
|
+
* @param context {Object} - Provide dom and me
|
|
5509
|
+
* @param target {NamedNode} - The thing the user expresses an opnion about
|
|
5510
|
+
* @param icon {uristring} - The icon to be used for the button
|
|
5511
|
+
* @param actionClass {NamedNode} - The RDF class - typically a subclass of schema:Action
|
|
5512
|
+
* @param doc - {NamedNode} - the Solid document iunto which the data should be written
|
|
5513
|
+
* @param mutuallyExclusive {Array<NamedNode>} - Any RDF classes of sentimentswhich are mutiually exclusive
|
|
5514
|
+
*/
|
|
5515
|
+
|
|
5516
|
+
// THUMBS_UP_ICON
|
|
5517
|
+
// https://schema.org/AgreeAction
|
|
5518
|
+
me = _solidLogic.authn.currentUser(); // If already logged on
|
|
5519
|
+
_context10.t2 = me;
|
|
5520
|
+
if (!_context10.t2) {
|
|
5521
|
+
_context10.next = 28;
|
|
5522
|
+
break;
|
|
4852
5523
|
}
|
|
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))
|
|
5524
|
+
_context10.next = 25;
|
|
5525
|
+
return (0, _chatLogic.mostRecentVersion)(message).value;
|
|
5526
|
+
case 25:
|
|
5527
|
+
_context10.t3 = _context10.sent;
|
|
5528
|
+
_context10.t4 = ns.schema('dateDeleted').value;
|
|
5529
|
+
_context10.t2 = _context10.t3 !== _context10.t4;
|
|
5530
|
+
case 28:
|
|
5531
|
+
if (!_context10.t2) {
|
|
5532
|
+
_context10.next = 32;
|
|
5533
|
+
break;
|
|
5534
|
+
}
|
|
5535
|
+
context1 = {
|
|
5536
|
+
me: me,
|
|
5537
|
+
dom: dom,
|
|
5538
|
+
div: div
|
|
5539
|
+
};
|
|
5540
|
+
div.appendChild(sentimentButton(context1, message,
|
|
5541
|
+
// @@ TODO use widgets.sentimentButton
|
|
5542
|
+
_iconBase.icons.iconBase + THUMBS_UP_ICON, ns.schema('AgreeAction'), message.doc(), [ns.schema('DisagreeAction')]));
|
|
5543
|
+
// Thumbs down
|
|
5544
|
+
div.appendChild(sentimentButton(context1, message, _iconBase.icons.iconBase + THUMBS_DOWN_ICON, ns.schema('DisagreeAction'), message.doc(), [ns.schema('AgreeAction')]));
|
|
5545
|
+
case 32:
|
|
5546
|
+
// Reply buttton
|
|
4881
5547
|
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
5548
|
+
if (_solidLogic.store.any(message, ns.dct('created'))) {
|
|
5549
|
+
// Looks like a messsage? Bar can be used for other things
|
|
5550
|
+
div.appendChild(widgets.button(dom, _iconBase.icons.iconBase + REPLY_ICON, 'Reply in thread', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
|
|
5551
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
5552
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
5553
|
+
case 0:
|
|
5554
|
+
_context5.next = 2;
|
|
5555
|
+
return replyInThread();
|
|
5556
|
+
case 2:
|
|
5557
|
+
case "end":
|
|
5558
|
+
return _context5.stop();
|
|
5559
|
+
}
|
|
5560
|
+
}, _callee5);
|
|
5561
|
+
}))));
|
|
5562
|
+
}
|
|
5563
|
+
// X button to remove the tool UI itself
|
|
5564
|
+
cancelButton = div.appendChild(widgets.cancelButton(dom));
|
|
5565
|
+
cancelButton.style["float"] = 'right';
|
|
5566
|
+
cancelButton.firstChild.style.opacity = '0.3';
|
|
5567
|
+
cancelButton.addEventListener('click', closeToolbar);
|
|
5568
|
+
return _context10.abrupt("return", div);
|
|
5569
|
+
case 38:
|
|
5570
|
+
case "end":
|
|
5571
|
+
return _context10.stop();
|
|
5572
|
+
}
|
|
5573
|
+
}, _callee10);
|
|
5574
|
+
}));
|
|
5575
|
+
return _messageToolbar.apply(this, arguments);
|
|
4900
5576
|
}
|
|
4901
5577
|
//# sourceMappingURL=messageTools.js.map
|
|
4902
5578
|
|
|
@@ -6320,13 +6996,13 @@ var LogLevel;
|
|
|
6320
6996
|
/** @internal */
|
|
6321
6997
|
exports.LogLevel = LogLevel;
|
|
6322
6998
|
(function (LogLevel) {
|
|
6323
|
-
LogLevel[LogLevel["Error"] =
|
|
6324
|
-
LogLevel[LogLevel["Warning"] =
|
|
6325
|
-
LogLevel[LogLevel["Message"] =
|
|
6326
|
-
LogLevel[LogLevel["Success"] =
|
|
6327
|
-
LogLevel[LogLevel["Info"] =
|
|
6328
|
-
LogLevel[LogLevel["Debug"] =
|
|
6329
|
-
LogLevel[LogLevel["All"] =
|
|
6999
|
+
LogLevel[LogLevel["Error"] = 1] = "Error";
|
|
7000
|
+
LogLevel[LogLevel["Warning"] = 2] = "Warning";
|
|
7001
|
+
LogLevel[LogLevel["Message"] = 4] = "Message";
|
|
7002
|
+
LogLevel[LogLevel["Success"] = 8] = "Success";
|
|
7003
|
+
LogLevel[LogLevel["Info"] = 16] = "Info";
|
|
7004
|
+
LogLevel[LogLevel["Debug"] = 32] = "Debug";
|
|
7005
|
+
LogLevel[LogLevel["All"] = 63] = "All";
|
|
6330
7006
|
})(LogLevel || (exports.LogLevel = LogLevel = {}));
|
|
6331
7007
|
var _level = TERROR + TWARN + TMESG;
|
|
6332
7008
|
/** @internal */
|
|
@@ -9730,6 +10406,10 @@ function recordSharedPreferences(subject, context) {
|
|
|
9730
10406
|
return new Promise(function (resolve, reject) {
|
|
9731
10407
|
var sharedPreferences = kb.any(subject, ns.ui('sharedPreferences'));
|
|
9732
10408
|
if (!sharedPreferences) {
|
|
10409
|
+
if (!kb.updater.editable(subject.doc())) {
|
|
10410
|
+
debug.log(" Cant make shared preferences, may not change ".concat(subject.doc));
|
|
10411
|
+
resolve(context);
|
|
10412
|
+
}
|
|
9733
10413
|
var sp = $rdf.sym(subject.doc().uri + '#SharedPreferences');
|
|
9734
10414
|
var ins = [$rdf.st(subject, ns.ui('sharedPreferences'), sp, subject.doc())];
|
|
9735
10415
|
debug.log('Creating shared preferences ' + sp);
|
|
@@ -13119,26 +13799,28 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
13119
13799
|
}));
|
|
13120
13800
|
exports.versionInfo = void 0;
|
|
13121
13801
|
var versionInfo = {
|
|
13122
|
-
buildTime: '2023-
|
|
13123
|
-
commit: '
|
|
13802
|
+
buildTime: '2023-04-08T06:36:47Z',
|
|
13803
|
+
commit: '068520eaaba7887dcdfeb64ba44cbe253b7de882',
|
|
13124
13804
|
npmInfo: {
|
|
13125
|
-
'solid-ui': '2.4.
|
|
13126
|
-
npm: '8.19.
|
|
13127
|
-
node: '
|
|
13128
|
-
v8: '
|
|
13129
|
-
uv: '1.
|
|
13805
|
+
'solid-ui': '2.4.26',
|
|
13806
|
+
npm: '8.19.4',
|
|
13807
|
+
node: '16.20.0',
|
|
13808
|
+
v8: '9.4.146.26-node.26',
|
|
13809
|
+
uv: '1.43.0',
|
|
13130
13810
|
zlib: '1.2.11',
|
|
13131
13811
|
brotli: '1.0.9',
|
|
13132
|
-
ares: '1.
|
|
13133
|
-
modules: '
|
|
13134
|
-
nghttp2: '1.
|
|
13812
|
+
ares: '1.19.0',
|
|
13813
|
+
modules: '93',
|
|
13814
|
+
nghttp2: '1.47.0',
|
|
13135
13815
|
napi: '8',
|
|
13136
|
-
llhttp: '
|
|
13137
|
-
openssl: '1.1.
|
|
13138
|
-
cldr: '
|
|
13139
|
-
icu: '
|
|
13816
|
+
llhttp: '6.0.10',
|
|
13817
|
+
openssl: '1.1.1t+quic',
|
|
13818
|
+
cldr: '41.0',
|
|
13819
|
+
icu: '71.1',
|
|
13140
13820
|
tz: '2022f',
|
|
13141
|
-
unicode: '14.0'
|
|
13821
|
+
unicode: '14.0',
|
|
13822
|
+
ngtcp2: '0.8.1',
|
|
13823
|
+
nghttp3: '0.7.0'
|
|
13142
13824
|
}
|
|
13143
13825
|
};
|
|
13144
13826
|
exports.versionInfo = versionInfo;
|
|
@@ -25644,7 +26326,10 @@ class ClientAuthentication {
|
|
|
25644
26326
|
this.login = async (options, eventEmitter) => {
|
|
25645
26327
|
var _a, _b;
|
|
25646
26328
|
await this.sessionInfoManager.clear(options.sessionId);
|
|
25647
|
-
const redirectUrl = (
|
|
26329
|
+
const redirectUrl = (_a = options.redirectUrl) !== null && _a !== void 0 ? _a : (0, oidc_client_ext_1.removeOidcQueryParam)(window.location.href);
|
|
26330
|
+
if (!(0, solid_client_authn_core_1.isValidRedirectUrl)(redirectUrl)) {
|
|
26331
|
+
throw new Error(`${redirectUrl} is not a valid redirect URL, it is either a malformed IRI or it includes a hash fragment.`);
|
|
26332
|
+
}
|
|
25648
26333
|
await this.loginHandler.handle({
|
|
25649
26334
|
...options,
|
|
25650
26335
|
redirectUrl,
|
|
@@ -26115,7 +26800,6 @@ exports["default"] = ClientRegistrar;
|
|
|
26115
26800
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
26116
26801
|
exports.WELL_KNOWN_OPENID_CONFIG = void 0;
|
|
26117
26802
|
const solid_client_authn_core_1 = __webpack_require__(/*! @inrupt/solid-client-authn-core */ "./node_modules/@inrupt/solid-client-authn-core/dist/index.js");
|
|
26118
|
-
const urlPath_1 = __webpack_require__(/*! ../../util/urlPath */ "./node_modules/@inrupt/solid-client-authn-browser/dist/util/urlPath.js");
|
|
26119
26803
|
exports.WELL_KNOWN_OPENID_CONFIG = ".well-known/openid-configuration";
|
|
26120
26804
|
const issuerConfigKeyMap = {
|
|
26121
26805
|
issuer: {
|
|
@@ -26221,7 +26905,7 @@ class IssuerConfigFetcher {
|
|
|
26221
26905
|
}
|
|
26222
26906
|
async fetchConfig(issuer) {
|
|
26223
26907
|
let issuerConfig;
|
|
26224
|
-
const openIdConfigUrl =
|
|
26908
|
+
const openIdConfigUrl = new URL(exports.WELL_KNOWN_OPENID_CONFIG, issuer).href;
|
|
26225
26909
|
const issuerConfigRequestBody = await window.fetch(openIdConfigUrl);
|
|
26226
26910
|
try {
|
|
26227
26911
|
issuerConfig = processConfig(await issuerConfigRequestBody.json());
|
|
@@ -26772,27 +27456,6 @@ exports["default"] = StorageUtilityBrowser;
|
|
|
26772
27456
|
|
|
26773
27457
|
/***/ }),
|
|
26774
27458
|
|
|
26775
|
-
/***/ "./node_modules/@inrupt/solid-client-authn-browser/dist/util/urlPath.js":
|
|
26776
|
-
/*!******************************************************************************!*\
|
|
26777
|
-
!*** ./node_modules/@inrupt/solid-client-authn-browser/dist/util/urlPath.js ***!
|
|
26778
|
-
\******************************************************************************/
|
|
26779
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
26780
|
-
|
|
26781
|
-
"use strict";
|
|
26782
|
-
|
|
26783
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
26784
|
-
exports.appendToUrlPathname = void 0;
|
|
26785
|
-
function appendToUrlPathname(url, append) {
|
|
26786
|
-
const parsedUrl = new URL(url);
|
|
26787
|
-
const path = parsedUrl.pathname;
|
|
26788
|
-
parsedUrl.pathname = `${path}${path.endsWith("/") ? "" : "/"}${append.startsWith("/") ? append.substring(1) : append}`;
|
|
26789
|
-
return parsedUrl.toString();
|
|
26790
|
-
}
|
|
26791
|
-
exports.appendToUrlPathname = appendToUrlPathname;
|
|
26792
|
-
//# sourceMappingURL=urlPath.js.map
|
|
26793
|
-
|
|
26794
|
-
/***/ }),
|
|
26795
|
-
|
|
26796
27459
|
/***/ "./node_modules/@inrupt/solid-client-authn-browser/node_modules/uuid/dist/commonjs-browser/index.js":
|
|
26797
27460
|
/*!**********************************************************************************************************!*\
|
|
26798
27461
|
!*** ./node_modules/@inrupt/solid-client-authn-browser/node_modules/uuid/dist/commonjs-browser/index.js ***!
|
|
@@ -27907,6 +28570,16 @@ async function getWebidFromTokenPayload(idToken, jwksIri, issuerIri, clientId) {
|
|
|
27907
28570
|
}
|
|
27908
28571
|
}
|
|
27909
28572
|
|
|
28573
|
+
function isValidRedirectUrl(redirectUrl) {
|
|
28574
|
+
try {
|
|
28575
|
+
const urlObject = new URL(redirectUrl);
|
|
28576
|
+
return urlObject.hash === "";
|
|
28577
|
+
}
|
|
28578
|
+
catch (e) {
|
|
28579
|
+
return false;
|
|
28580
|
+
}
|
|
28581
|
+
}
|
|
28582
|
+
|
|
27910
28583
|
function isSupportedTokenType(token) {
|
|
27911
28584
|
return typeof token === "string" && ["DPoP", "Bearer"].includes(token);
|
|
27912
28585
|
}
|
|
@@ -28322,6 +28995,7 @@ exports.getSessionIdFromOauthState = getSessionIdFromOauthState;
|
|
|
28322
28995
|
exports.getWebidFromTokenPayload = getWebidFromTokenPayload;
|
|
28323
28996
|
exports.handleRegistration = handleRegistration;
|
|
28324
28997
|
exports.isSupportedTokenType = isSupportedTokenType;
|
|
28998
|
+
exports.isValidRedirectUrl = isValidRedirectUrl;
|
|
28325
28999
|
exports.loadOidcContextFromStorage = loadOidcContextFromStorage;
|
|
28326
29000
|
exports.mockStorage = mockStorage;
|
|
28327
29001
|
exports.mockStorageUtility = mockStorageUtility;
|
|
@@ -45273,7 +45947,7 @@ function () {
|
|
|
45273
45947
|
|
|
45274
45948
|
return ConditionalRule;
|
|
45275
45949
|
}();
|
|
45276
|
-
var keyRegExp = /@media|@supports\s+/;
|
|
45950
|
+
var keyRegExp = /@container|@media|@supports\s+/;
|
|
45277
45951
|
var pluginConditionalRule = {
|
|
45278
45952
|
onCreateRule: function onCreateRule(key, styles, options) {
|
|
45279
45953
|
return keyRegExp.test(key) ? new ConditionalRule(key, styles, options) : null;
|
|
@@ -46837,7 +47511,7 @@ var Jss =
|
|
|
46837
47511
|
function () {
|
|
46838
47512
|
function Jss(options) {
|
|
46839
47513
|
this.id = instanceCounter++;
|
|
46840
|
-
this.version = "10.
|
|
47514
|
+
this.version = "10.10.0";
|
|
46841
47515
|
this.plugins = new PluginsRegistry();
|
|
46842
47516
|
this.options = {
|
|
46843
47517
|
id: {
|
|
@@ -54278,16 +54952,17 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
54278
54952
|
var fetcher = this;
|
|
54279
54953
|
// @ts-ignore
|
|
54280
54954
|
if (fetcher.fetchQueue && fetcher.fetchQueue[uri]) {
|
|
54281
|
-
console.log('Internal error - fetchQueue exists ' + uri)
|
|
54955
|
+
// console.log('Internal error - fetchQueue exists ' + uri)
|
|
54282
54956
|
var promise = fetcher.fetchQueue[uri];
|
|
54283
54957
|
if (promise['PromiseStatus'] === 'resolved') {
|
|
54284
54958
|
delete fetcher.fetchQueue[uri];
|
|
54285
54959
|
} else {
|
|
54286
54960
|
// pending
|
|
54287
54961
|
delete fetcher.fetchQueue[uri];
|
|
54288
|
-
console.log('*** Fetcher: pending fetchQueue deleted ' + uri)
|
|
54962
|
+
// console.log('*** Fetcher: pending fetchQueue deleted ' + uri)
|
|
54289
54963
|
}
|
|
54290
54964
|
}
|
|
54965
|
+
|
|
54291
54966
|
if (fetcher.requested[uri] && fetcher.requested[uri] !== 'done' && fetcher.requested[uri] !== 'failed' && fetcher.requested[uri] !== 404) {
|
|
54292
54967
|
var msg = "Rdflib: fetcher: Destructive operation on <".concat(fetcher.requested[uri], "> file being fetched! ") + uri;
|
|
54293
54968
|
console.error(msg);
|
|
@@ -61239,7 +61914,7 @@ contentType, callback, options) {
|
|
|
61239
61914
|
documentString = sz.statementsToNTriples(newSts);
|
|
61240
61915
|
return executeCallback(null, documentString);
|
|
61241
61916
|
case _types__WEBPACK_IMPORTED_MODULE_0__.JSONLDContentType:
|
|
61242
|
-
sz.setFlags('si'); //
|
|
61917
|
+
sz.setFlags('si dr'); // turtle + dr (means no default, no relative prefix)
|
|
61243
61918
|
documentString = sz.statementsToJsonld(newSts); // convert via turtle
|
|
61244
61919
|
return executeCallback(null, documentString);
|
|
61245
61920
|
case _types__WEBPACK_IMPORTED_MODULE_0__.NQuadsContentType:
|
|
@@ -61311,7 +61986,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
61311
61986
|
|
|
61312
61987
|
|
|
61313
61988
|
|
|
61314
|
-
// import * as jsonld from 'jsonld'
|
|
61315
61989
|
|
|
61316
61990
|
function createSerializer(store) {
|
|
61317
61991
|
return new Serializer(store);
|
|
@@ -61818,7 +62492,7 @@ var Serializer = /*#__PURE__*/function () {
|
|
|
61818
62492
|
var termToN3 = termToN3Method.bind(this);
|
|
61819
62493
|
function prefixDirectivesMethod() {
|
|
61820
62494
|
var str = '';
|
|
61821
|
-
if (this.defaultNamespace) {
|
|
62495
|
+
if (this.flags.indexOf('d') < 0 && this.defaultNamespace) {
|
|
61822
62496
|
str += '@prefix : ' + this.explicitURI(this.defaultNamespace) + '.\n';
|
|
61823
62497
|
}
|
|
61824
62498
|
for (var ns in this.prefixes) {
|
|
@@ -62303,20 +62977,19 @@ var Serializer = /*#__PURE__*/function () {
|
|
|
62303
62977
|
key: "statementsToJsonld",
|
|
62304
62978
|
value: function statementsToJsonld(sts) {
|
|
62305
62979
|
// ttl2jsonld creates context keys for all ttl prefix
|
|
62306
|
-
// context keys must be
|
|
62307
|
-
function findId(itemObj) {
|
|
62980
|
+
// context keys must be absolute IRI ttl2jsonld@0.0.8
|
|
62981
|
+
/* function findId (itemObj) {
|
|
62308
62982
|
if (itemObj['@id']) {
|
|
62309
|
-
|
|
62310
|
-
if (keys[item[0]]) itemObj['@id'] = jsonldObj['@context'][item[0]] + item[1]
|
|
62983
|
+
const item = itemObj['@id'].split(':')
|
|
62984
|
+
if (keys[item[0]]) itemObj['@id'] = jsonldObj['@context'][item[0]] + item[1]
|
|
62311
62985
|
}
|
|
62312
|
-
|
|
62313
|
-
for (
|
|
62314
|
-
if (typeof itemValues[i] !== 'string') {
|
|
62315
|
-
|
|
62316
|
-
findId(itemValues[i]);
|
|
62986
|
+
const itemValues = Object.values(itemObj)
|
|
62987
|
+
for (const i in itemValues) {
|
|
62988
|
+
if (typeof itemValues[i] !== 'string') { // @list contains array
|
|
62989
|
+
findId(itemValues[i])
|
|
62317
62990
|
}
|
|
62318
62991
|
}
|
|
62319
|
-
}
|
|
62992
|
+
} */
|
|
62320
62993
|
var turtleDoc = this.statementsToN3(sts);
|
|
62321
62994
|
var jsonldObj = _frogcat_ttl2jsonld__WEBPACK_IMPORTED_MODULE_4__.parse(turtleDoc);
|
|
62322
62995
|
return JSON.stringify(jsonldObj, null, 2);
|
|
@@ -66818,15 +67491,13 @@ function createAclLogic(store) {
|
|
|
66818
67491
|
var ns = ns_1.ns;
|
|
66819
67492
|
function findAclDocUrl(url) {
|
|
66820
67493
|
return __awaiter(this, void 0, void 0, function () {
|
|
66821
|
-
var
|
|
67494
|
+
var docNode;
|
|
66822
67495
|
return __generator(this, function (_a) {
|
|
66823
67496
|
switch (_a.label) {
|
|
66824
|
-
case 0:
|
|
66825
|
-
doc = store.sym(url);
|
|
66826
|
-
return [4 /*yield*/, store.fetcher.load(doc)];
|
|
67497
|
+
case 0: return [4 /*yield*/, store.fetcher.load(url)];
|
|
66827
67498
|
case 1:
|
|
66828
67499
|
_a.sent();
|
|
66829
|
-
docNode = store.any(
|
|
67500
|
+
docNode = store.any(url, exports.ACL_LINK);
|
|
66830
67501
|
if (!docNode) {
|
|
66831
67502
|
throw new Error("No ACL link discovered for ".concat(url));
|
|
66832
67503
|
}
|
|
@@ -67634,7 +68305,7 @@ function createInboxLogic(store, profileLogic, utilityLogic, containerLogic, acl
|
|
|
67634
68305
|
case 2: return [4 /*yield*/, profileLogic.getMainInbox(user)];
|
|
67635
68306
|
case 3:
|
|
67636
68307
|
inbox = _a.sent();
|
|
67637
|
-
return [4 /*yield*/, containerLogic.getContainerMembers(inbox
|
|
68308
|
+
return [4 /*yield*/, containerLogic.getContainerMembers(inbox)];
|
|
67638
68309
|
case 4:
|
|
67639
68310
|
urls = _a.sent();
|
|
67640
68311
|
return [2 /*return*/, urls.filter(function (url) { return !containerLogic.isContainer(url); })];
|
|
@@ -68790,19 +69461,21 @@ var rdflib_1 = __webpack_require__(/*! rdflib */ "./node_modules/rdflib/esm/inde
|
|
|
68790
69461
|
function createContainerLogic(store) {
|
|
68791
69462
|
function getContainerElements(containerNode) {
|
|
68792
69463
|
return store
|
|
68793
|
-
.statementsMatching(containerNode, (0, rdflib_1.sym)("http://www.w3.org/ns/ldp#contains"), undefined
|
|
69464
|
+
.statementsMatching(containerNode, (0, rdflib_1.sym)("http://www.w3.org/ns/ldp#contains"), undefined)
|
|
68794
69465
|
.map(function (st) { return st.object; });
|
|
68795
69466
|
}
|
|
68796
69467
|
function isContainer(url) {
|
|
68797
|
-
|
|
69468
|
+
var nodeToString = url.value;
|
|
69469
|
+
return nodeToString.charAt(nodeToString.length - 1) === "/";
|
|
68798
69470
|
}
|
|
68799
69471
|
function createContainer(url) {
|
|
68800
69472
|
return __awaiter(this, void 0, void 0, function () {
|
|
68801
|
-
var result;
|
|
69473
|
+
var stringToNode, result;
|
|
68802
69474
|
return __generator(this, function (_a) {
|
|
68803
69475
|
switch (_a.label) {
|
|
68804
69476
|
case 0:
|
|
68805
|
-
|
|
69477
|
+
stringToNode = (0, rdflib_1.sym)(url);
|
|
69478
|
+
if (!isContainer(stringToNode)) {
|
|
68806
69479
|
throw new Error("Not a container URL ".concat(url));
|
|
68807
69480
|
}
|
|
68808
69481
|
return [4 /*yield*/, store.fetcher._fetch(url, {
|
|
@@ -68826,16 +69499,12 @@ function createContainerLogic(store) {
|
|
|
68826
69499
|
}
|
|
68827
69500
|
function getContainerMembers(containerUrl) {
|
|
68828
69501
|
return __awaiter(this, void 0, void 0, function () {
|
|
68829
|
-
var containerNode, nodes;
|
|
68830
69502
|
return __generator(this, function (_a) {
|
|
68831
69503
|
switch (_a.label) {
|
|
68832
|
-
case 0:
|
|
68833
|
-
containerNode = store.sym(containerUrl);
|
|
68834
|
-
return [4 /*yield*/, store.fetcher.load(containerNode)];
|
|
69504
|
+
case 0: return [4 /*yield*/, store.fetcher.load(containerUrl)];
|
|
68835
69505
|
case 1:
|
|
68836
69506
|
_a.sent();
|
|
68837
|
-
|
|
68838
|
-
return [2 /*return*/, nodes.map(function (node) { return node.value; })];
|
|
69507
|
+
return [2 /*return*/, getContainerElements(containerUrl)];
|
|
68839
69508
|
}
|
|
68840
69509
|
});
|
|
68841
69510
|
});
|
|
@@ -69021,28 +69690,30 @@ var CustomError_1 = __webpack_require__(/*! ../logic/CustomError */ "./node_modu
|
|
|
69021
69690
|
var debug = __importStar(__webpack_require__(/*! ../util/debug */ "./node_modules/solid-logic/lib/util/debug.js"));
|
|
69022
69691
|
var utils_1 = __webpack_require__(/*! ./utils */ "./node_modules/solid-logic/lib/util/utils.js");
|
|
69023
69692
|
function createUtilityLogic(store, aclLogic, containerLogic) {
|
|
69024
|
-
function recursiveDelete(
|
|
69693
|
+
function recursiveDelete(containerNode) {
|
|
69025
69694
|
return __awaiter(this, void 0, void 0, function () {
|
|
69026
|
-
var aclDocUrl, containerMembers, e_1;
|
|
69695
|
+
var aclDocUrl, containerMembers, nodeToStringHere, e_1;
|
|
69027
69696
|
return __generator(this, function (_a) {
|
|
69028
69697
|
switch (_a.label) {
|
|
69029
69698
|
case 0:
|
|
69030
69699
|
_a.trys.push([0, 6, , 7]);
|
|
69031
|
-
if (!containerLogic.isContainer(
|
|
69032
|
-
return [4 /*yield*/, aclLogic.findAclDocUrl(
|
|
69700
|
+
if (!containerLogic.isContainer(containerNode)) return [3 /*break*/, 5];
|
|
69701
|
+
return [4 /*yield*/, aclLogic.findAclDocUrl(containerNode)];
|
|
69033
69702
|
case 1:
|
|
69034
69703
|
aclDocUrl = _a.sent();
|
|
69035
69704
|
return [4 /*yield*/, store.fetcher._fetch(aclDocUrl, { method: "DELETE" })];
|
|
69036
69705
|
case 2:
|
|
69037
69706
|
_a.sent();
|
|
69038
|
-
return [4 /*yield*/, containerLogic.getContainerMembers(
|
|
69707
|
+
return [4 /*yield*/, containerLogic.getContainerMembers(containerNode)];
|
|
69039
69708
|
case 3:
|
|
69040
69709
|
containerMembers = _a.sent();
|
|
69041
69710
|
return [4 /*yield*/, Promise.all(containerMembers.map(function (url) { return recursiveDelete(url); }))];
|
|
69042
69711
|
case 4:
|
|
69043
69712
|
_a.sent();
|
|
69044
69713
|
_a.label = 5;
|
|
69045
|
-
case 5:
|
|
69714
|
+
case 5:
|
|
69715
|
+
nodeToStringHere = containerNode.value;
|
|
69716
|
+
return [2 /*return*/, store.fetcher._fetch(nodeToStringHere, { method: "DELETE" })];
|
|
69046
69717
|
case 6:
|
|
69047
69718
|
e_1 = _a.sent();
|
|
69048
69719
|
return [3 /*break*/, 7];
|
|
@@ -69187,7 +69858,7 @@ function createUtilityLogic(store, aclLogic, containerLogic) {
|
|
|
69187
69858
|
''
|
|
69188
69859
|
].join('\n');
|
|
69189
69860
|
}
|
|
69190
|
-
return [4 /*yield*/, aclLogic.findAclDocUrl(options.target)];
|
|
69861
|
+
return [4 /*yield*/, aclLogic.findAclDocUrl((0, rdflib_1.sym)(options.target))];
|
|
69191
69862
|
case 1:
|
|
69192
69863
|
aclDocUrl = _a.sent();
|
|
69193
69864
|
return [2 /*return*/, store.fetcher._fetch(aclDocUrl, {
|
|
@@ -73559,6 +74230,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
73559
74230
|
/* harmony export */ "getWebidFromTokenPayload": () => (/* binding */ getWebidFromTokenPayload),
|
|
73560
74231
|
/* harmony export */ "handleRegistration": () => (/* binding */ handleRegistration),
|
|
73561
74232
|
/* harmony export */ "isSupportedTokenType": () => (/* binding */ isSupportedTokenType),
|
|
74233
|
+
/* harmony export */ "isValidRedirectUrl": () => (/* binding */ isValidRedirectUrl),
|
|
73562
74234
|
/* harmony export */ "loadOidcContextFromStorage": () => (/* binding */ loadOidcContextFromStorage),
|
|
73563
74235
|
/* harmony export */ "mockStorage": () => (/* binding */ mockStorage),
|
|
73564
74236
|
/* harmony export */ "mockStorageUtility": () => (/* binding */ mockStorageUtility),
|
|
@@ -73665,6 +74337,16 @@ async function getWebidFromTokenPayload(idToken, jwksIri, issuerIri, clientId) {
|
|
|
73665
74337
|
}
|
|
73666
74338
|
}
|
|
73667
74339
|
|
|
74340
|
+
function isValidRedirectUrl(redirectUrl) {
|
|
74341
|
+
try {
|
|
74342
|
+
const urlObject = new URL(redirectUrl);
|
|
74343
|
+
return urlObject.hash === "";
|
|
74344
|
+
}
|
|
74345
|
+
catch (e) {
|
|
74346
|
+
return false;
|
|
74347
|
+
}
|
|
74348
|
+
}
|
|
74349
|
+
|
|
73668
74350
|
function isSupportedTokenType(token) {
|
|
73669
74351
|
return typeof token === "string" && ["DPoP", "Bearer"].includes(token);
|
|
73670
74352
|
}
|
|
@@ -74889,7 +75571,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
74889
75571
|
async function EmbeddedJWK(protectedHeader, token) {
|
|
74890
75572
|
const joseHeader = {
|
|
74891
75573
|
...protectedHeader,
|
|
74892
|
-
...token.header,
|
|
75574
|
+
...token === null || token === void 0 ? void 0 : token.header,
|
|
74893
75575
|
};
|
|
74894
75576
|
if (!(0,_lib_is_object_js__WEBPACK_IMPORTED_MODULE_1__["default"])(joseHeader.jwk)) {
|
|
74895
75577
|
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JWSInvalid('"jwk" (JSON Web Key) Header Parameter must be a JSON object');
|
|
@@ -75034,7 +75716,7 @@ class LocalJWKSet {
|
|
|
75034
75716
|
this._jwks = clone(jwks);
|
|
75035
75717
|
}
|
|
75036
75718
|
async getKey(protectedHeader, token) {
|
|
75037
|
-
const { alg, kid } = { ...protectedHeader, ...token.header };
|
|
75719
|
+
const { alg, kid } = { ...protectedHeader, ...token === null || token === void 0 ? void 0 : token.header };
|
|
75038
75720
|
const kty = getKtyFromAlg(alg);
|
|
75039
75721
|
const candidates = this._jwks.keys.filter((jwk) => {
|
|
75040
75722
|
let candidate = kty === jwk.kty;
|
|
@@ -75076,21 +75758,39 @@ class LocalJWKSet {
|
|
|
75076
75758
|
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWKSNoMatchingKey();
|
|
75077
75759
|
}
|
|
75078
75760
|
else if (length !== 1) {
|
|
75079
|
-
|
|
75761
|
+
const error = new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWKSMultipleMatchingKeys();
|
|
75762
|
+
const { _cached } = this;
|
|
75763
|
+
error[Symbol.asyncIterator] = async function* () {
|
|
75764
|
+
for (const jwk of candidates) {
|
|
75765
|
+
try {
|
|
75766
|
+
yield await importWithAlgCache(_cached, jwk, alg);
|
|
75767
|
+
}
|
|
75768
|
+
catch (_a) {
|
|
75769
|
+
continue;
|
|
75770
|
+
}
|
|
75771
|
+
}
|
|
75772
|
+
};
|
|
75773
|
+
throw error;
|
|
75080
75774
|
}
|
|
75081
|
-
|
|
75082
|
-
|
|
75083
|
-
|
|
75084
|
-
|
|
75085
|
-
|
|
75086
|
-
|
|
75087
|
-
|
|
75775
|
+
return importWithAlgCache(this._cached, jwk, alg);
|
|
75776
|
+
}
|
|
75777
|
+
}
|
|
75778
|
+
async function importWithAlgCache(cache, jwk, alg) {
|
|
75779
|
+
const cached = cache.get(jwk) || cache.set(jwk, {}).get(jwk);
|
|
75780
|
+
if (cached[alg] === undefined) {
|
|
75781
|
+
const key = await (0,_key_import_js__WEBPACK_IMPORTED_MODULE_0__.importJWK)({ ...jwk, ext: true }, alg);
|
|
75782
|
+
if (key instanceof Uint8Array || key.type !== 'public') {
|
|
75783
|
+
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWKSInvalid('JSON Web Key Set members must be public keys');
|
|
75088
75784
|
}
|
|
75089
|
-
|
|
75785
|
+
cached[alg] = key;
|
|
75090
75786
|
}
|
|
75787
|
+
return cached[alg];
|
|
75091
75788
|
}
|
|
75092
75789
|
function createLocalJWKSet(jwks) {
|
|
75093
|
-
|
|
75790
|
+
const set = new LocalJWKSet(jwks);
|
|
75791
|
+
return async function (protectedHeader, token) {
|
|
75792
|
+
return set.getKey(protectedHeader, token);
|
|
75793
|
+
};
|
|
75094
75794
|
}
|
|
75095
75795
|
|
|
75096
75796
|
|
|
@@ -75190,7 +75890,10 @@ class RemoteJWKSet extends _local_js__WEBPACK_IMPORTED_MODULE_3__.LocalJWKSet {
|
|
|
75190
75890
|
}
|
|
75191
75891
|
}
|
|
75192
75892
|
function createRemoteJWKSet(url, options) {
|
|
75193
|
-
|
|
75893
|
+
const set = new RemoteJWKSet(url, options);
|
|
75894
|
+
return async function (protectedHeader, token) {
|
|
75895
|
+
return set.getKey(protectedHeader, token);
|
|
75896
|
+
};
|
|
75194
75897
|
}
|
|
75195
75898
|
|
|
75196
75899
|
|
|
@@ -76039,83 +76742,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
76039
76742
|
/* harmony import */ var _runtime_asn1_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../runtime/asn1.js */ "./node_modules/jose/dist/browser/runtime/asn1.js");
|
|
76040
76743
|
/* harmony import */ var _runtime_jwk_to_key_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../runtime/jwk_to_key.js */ "./node_modules/jose/dist/browser/runtime/jwk_to_key.js");
|
|
76041
76744
|
/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js");
|
|
76042
|
-
/* harmony import */ var
|
|
76043
|
-
/* harmony import */ var _lib_is_object_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../lib/is_object.js */ "./node_modules/jose/dist/browser/lib/is_object.js");
|
|
76044
|
-
|
|
76045
|
-
|
|
76745
|
+
/* harmony import */ var _lib_is_object_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../lib/is_object.js */ "./node_modules/jose/dist/browser/lib/is_object.js");
|
|
76046
76746
|
|
|
76047
76747
|
|
|
76048
76748
|
|
|
76049
76749
|
|
|
76050
76750
|
|
|
76051
|
-
function getElement(seq) {
|
|
76052
|
-
let result = [];
|
|
76053
|
-
let next = 0;
|
|
76054
|
-
while (next < seq.length) {
|
|
76055
|
-
let nextPart = parseElement(seq.subarray(next));
|
|
76056
|
-
result.push(nextPart);
|
|
76057
|
-
next += nextPart.byteLength;
|
|
76058
|
-
}
|
|
76059
|
-
return result;
|
|
76060
|
-
}
|
|
76061
|
-
function parseElement(bytes) {
|
|
76062
|
-
let position = 0;
|
|
76063
|
-
let tag = bytes[0] & 0x1f;
|
|
76064
|
-
position++;
|
|
76065
|
-
if (tag === 0x1f) {
|
|
76066
|
-
tag = 0;
|
|
76067
|
-
while (bytes[position] >= 0x80) {
|
|
76068
|
-
tag = tag * 128 + bytes[position] - 0x80;
|
|
76069
|
-
position++;
|
|
76070
|
-
}
|
|
76071
|
-
tag = tag * 128 + bytes[position] - 0x80;
|
|
76072
|
-
position++;
|
|
76073
|
-
}
|
|
76074
|
-
let length = 0;
|
|
76075
|
-
if (bytes[position] < 0x80) {
|
|
76076
|
-
length = bytes[position];
|
|
76077
|
-
position++;
|
|
76078
|
-
}
|
|
76079
|
-
else if (length === 0x80) {
|
|
76080
|
-
length = 0;
|
|
76081
|
-
while (bytes[position + length] !== 0 || bytes[position + length + 1] !== 0) {
|
|
76082
|
-
if (length > bytes.byteLength) {
|
|
76083
|
-
throw new TypeError('invalid indefinite form length');
|
|
76084
|
-
}
|
|
76085
|
-
length++;
|
|
76086
|
-
}
|
|
76087
|
-
const byteLength = position + length + 2;
|
|
76088
|
-
return {
|
|
76089
|
-
byteLength,
|
|
76090
|
-
contents: bytes.subarray(position, position + length),
|
|
76091
|
-
raw: bytes.subarray(0, byteLength),
|
|
76092
|
-
};
|
|
76093
|
-
}
|
|
76094
|
-
else {
|
|
76095
|
-
let numberOfDigits = bytes[position] & 0x7f;
|
|
76096
|
-
position++;
|
|
76097
|
-
length = 0;
|
|
76098
|
-
for (let i = 0; i < numberOfDigits; i++) {
|
|
76099
|
-
length = length * 256 + bytes[position];
|
|
76100
|
-
position++;
|
|
76101
|
-
}
|
|
76102
|
-
}
|
|
76103
|
-
const byteLength = position + length;
|
|
76104
|
-
return {
|
|
76105
|
-
byteLength,
|
|
76106
|
-
contents: bytes.subarray(position, byteLength),
|
|
76107
|
-
raw: bytes.subarray(0, byteLength),
|
|
76108
|
-
};
|
|
76109
|
-
}
|
|
76110
|
-
function spkiFromX509(buf) {
|
|
76111
|
-
const tbsCertificate = getElement(getElement(parseElement(buf).contents)[0].contents);
|
|
76112
|
-
return (0,_runtime_base64url_js__WEBPACK_IMPORTED_MODULE_0__.encodeBase64)(tbsCertificate[tbsCertificate[0].raw[0] === 0xa0 ? 6 : 5].raw);
|
|
76113
|
-
}
|
|
76114
|
-
function getSPKI(x509) {
|
|
76115
|
-
const pem = x509.replace(/(?:-----(?:BEGIN|END) CERTIFICATE-----|\s)/g, '');
|
|
76116
|
-
const raw = (0,_runtime_base64url_js__WEBPACK_IMPORTED_MODULE_0__.decodeBase64)(pem);
|
|
76117
|
-
return (0,_lib_format_pem_js__WEBPACK_IMPORTED_MODULE_4__["default"])(spkiFromX509(raw), 'PUBLIC KEY');
|
|
76118
|
-
}
|
|
76119
76751
|
async function importSPKI(spki, alg, options) {
|
|
76120
76752
|
if (typeof spki !== 'string' || spki.indexOf('-----BEGIN PUBLIC KEY-----') !== 0) {
|
|
76121
76753
|
throw new TypeError('"spki" must be SPKI formatted string');
|
|
@@ -76126,14 +76758,7 @@ async function importX509(x509, alg, options) {
|
|
|
76126
76758
|
if (typeof x509 !== 'string' || x509.indexOf('-----BEGIN CERTIFICATE-----') !== 0) {
|
|
76127
76759
|
throw new TypeError('"x509" must be X.509 formatted string');
|
|
76128
76760
|
}
|
|
76129
|
-
|
|
76130
|
-
try {
|
|
76131
|
-
spki = getSPKI(x509);
|
|
76132
|
-
}
|
|
76133
|
-
catch (cause) {
|
|
76134
|
-
throw new TypeError('failed to parse the X.509 certificate', { cause });
|
|
76135
|
-
}
|
|
76136
|
-
return (0,_runtime_asn1_js__WEBPACK_IMPORTED_MODULE_1__.fromSPKI)(spki, alg, options);
|
|
76761
|
+
return (0,_runtime_asn1_js__WEBPACK_IMPORTED_MODULE_1__.fromX509)(x509, alg, options);
|
|
76137
76762
|
}
|
|
76138
76763
|
async function importPKCS8(pkcs8, alg, options) {
|
|
76139
76764
|
if (typeof pkcs8 !== 'string' || pkcs8.indexOf('-----BEGIN PRIVATE KEY-----') !== 0) {
|
|
@@ -76143,13 +76768,10 @@ async function importPKCS8(pkcs8, alg, options) {
|
|
|
76143
76768
|
}
|
|
76144
76769
|
async function importJWK(jwk, alg, octAsKeyObject) {
|
|
76145
76770
|
var _a;
|
|
76146
|
-
if (!(0,
|
|
76771
|
+
if (!(0,_lib_is_object_js__WEBPACK_IMPORTED_MODULE_4__["default"])(jwk)) {
|
|
76147
76772
|
throw new TypeError('JWK must be an object');
|
|
76148
76773
|
}
|
|
76149
76774
|
alg || (alg = jwk.alg);
|
|
76150
|
-
if (typeof alg !== 'string' || !alg) {
|
|
76151
|
-
throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
|
|
76152
|
-
}
|
|
76153
76775
|
switch (jwk.kty) {
|
|
76154
76776
|
case 'oct':
|
|
76155
76777
|
if (typeof jwk.k !== 'string' || !jwk.k) {
|
|
@@ -76516,13 +77138,13 @@ function checkSigCryptoKey(key, alg, ...usages) {
|
|
|
76516
77138
|
throw unusable(`SHA-${expected}`, 'algorithm.hash');
|
|
76517
77139
|
break;
|
|
76518
77140
|
}
|
|
76519
|
-
case (0,_runtime_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)() && 'EdDSA': {
|
|
76520
|
-
if (!isAlgorithm(key.algorithm, 'NODE-ED25519'))
|
|
76521
|
-
throw unusable('NODE-ED25519');
|
|
76522
|
-
break;
|
|
76523
|
-
}
|
|
76524
77141
|
case 'EdDSA': {
|
|
76525
77142
|
if (key.algorithm.name !== 'Ed25519' && key.algorithm.name !== 'Ed448') {
|
|
77143
|
+
if ((0,_runtime_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)()) {
|
|
77144
|
+
if (isAlgorithm(key.algorithm, 'NODE-ED25519'))
|
|
77145
|
+
break;
|
|
77146
|
+
throw unusable('Ed25519, Ed448, or NODE-ED25519');
|
|
77147
|
+
}
|
|
76526
77148
|
throw unusable('Ed25519 or Ed448');
|
|
76527
77149
|
}
|
|
76528
77150
|
break;
|
|
@@ -77338,6 +77960,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
77338
77960
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
77339
77961
|
/* harmony export */ "fromPKCS8": () => (/* binding */ fromPKCS8),
|
|
77340
77962
|
/* harmony export */ "fromSPKI": () => (/* binding */ fromSPKI),
|
|
77963
|
+
/* harmony export */ "fromX509": () => (/* binding */ fromX509),
|
|
77341
77964
|
/* harmony export */ "toPKCS8": () => (/* binding */ toPKCS8),
|
|
77342
77965
|
/* harmony export */ "toSPKI": () => (/* binding */ toSPKI)
|
|
77343
77966
|
/* harmony export */ });
|
|
@@ -77407,7 +78030,7 @@ const getNamedCurve = (keyData) => {
|
|
|
77407
78030
|
}
|
|
77408
78031
|
};
|
|
77409
78032
|
const genericImport = async (replace, keyFormat, pem, alg, options) => {
|
|
77410
|
-
var _a;
|
|
78033
|
+
var _a, _b;
|
|
77411
78034
|
let algorithm;
|
|
77412
78035
|
let keyUsages;
|
|
77413
78036
|
const keyData = new Uint8Array(atob(pem.replace(replace, ''))
|
|
@@ -77458,12 +78081,6 @@ const genericImport = async (replace, keyFormat, pem, alg, options) => {
|
|
|
77458
78081
|
keyUsages = isPublic ? [] : ['deriveBits'];
|
|
77459
78082
|
break;
|
|
77460
78083
|
}
|
|
77461
|
-
case (0,_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)() && 'EdDSA': {
|
|
77462
|
-
const namedCurve = getNamedCurve(keyData).toUpperCase();
|
|
77463
|
-
algorithm = { name: `NODE-${namedCurve}`, namedCurve: `NODE-${namedCurve}` };
|
|
77464
|
-
keyUsages = isPublic ? ['verify'] : ['sign'];
|
|
77465
|
-
break;
|
|
77466
|
-
}
|
|
77467
78084
|
case 'EdDSA':
|
|
77468
78085
|
algorithm = { name: getNamedCurve(keyData) };
|
|
77469
78086
|
keyUsages = isPublic ? ['verify'] : ['sign'];
|
|
@@ -77471,7 +78088,18 @@ const genericImport = async (replace, keyFormat, pem, alg, options) => {
|
|
|
77471
78088
|
default:
|
|
77472
78089
|
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_5__.JOSENotSupported('Invalid or unsupported "alg" (Algorithm) value');
|
|
77473
78090
|
}
|
|
77474
|
-
|
|
78091
|
+
try {
|
|
78092
|
+
return await _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.importKey(keyFormat, keyData, algorithm, (_a = options === null || options === void 0 ? void 0 : options.extractable) !== null && _a !== void 0 ? _a : false, keyUsages);
|
|
78093
|
+
}
|
|
78094
|
+
catch (err) {
|
|
78095
|
+
if (algorithm.name === 'Ed25519' &&
|
|
78096
|
+
(err === null || err === void 0 ? void 0 : err.name) === 'NotSupportedError' &&
|
|
78097
|
+
(0,_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)()) {
|
|
78098
|
+
algorithm = { name: 'NODE-ED25519', namedCurve: 'NODE-ED25519' };
|
|
78099
|
+
return await _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.importKey(keyFormat, keyData, algorithm, (_b = options === null || options === void 0 ? void 0 : options.extractable) !== null && _b !== void 0 ? _b : false, keyUsages);
|
|
78100
|
+
}
|
|
78101
|
+
throw err;
|
|
78102
|
+
}
|
|
77475
78103
|
};
|
|
77476
78104
|
const fromPKCS8 = (pem, alg, options) => {
|
|
77477
78105
|
return genericImport(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g, 'pkcs8', pem, alg, options);
|
|
@@ -77479,6 +78107,84 @@ const fromPKCS8 = (pem, alg, options) => {
|
|
|
77479
78107
|
const fromSPKI = (pem, alg, options) => {
|
|
77480
78108
|
return genericImport(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, 'spki', pem, alg, options);
|
|
77481
78109
|
};
|
|
78110
|
+
function getElement(seq) {
|
|
78111
|
+
let result = [];
|
|
78112
|
+
let next = 0;
|
|
78113
|
+
while (next < seq.length) {
|
|
78114
|
+
let nextPart = parseElement(seq.subarray(next));
|
|
78115
|
+
result.push(nextPart);
|
|
78116
|
+
next += nextPart.byteLength;
|
|
78117
|
+
}
|
|
78118
|
+
return result;
|
|
78119
|
+
}
|
|
78120
|
+
function parseElement(bytes) {
|
|
78121
|
+
let position = 0;
|
|
78122
|
+
let tag = bytes[0] & 0x1f;
|
|
78123
|
+
position++;
|
|
78124
|
+
if (tag === 0x1f) {
|
|
78125
|
+
tag = 0;
|
|
78126
|
+
while (bytes[position] >= 0x80) {
|
|
78127
|
+
tag = tag * 128 + bytes[position] - 0x80;
|
|
78128
|
+
position++;
|
|
78129
|
+
}
|
|
78130
|
+
tag = tag * 128 + bytes[position] - 0x80;
|
|
78131
|
+
position++;
|
|
78132
|
+
}
|
|
78133
|
+
let length = 0;
|
|
78134
|
+
if (bytes[position] < 0x80) {
|
|
78135
|
+
length = bytes[position];
|
|
78136
|
+
position++;
|
|
78137
|
+
}
|
|
78138
|
+
else if (length === 0x80) {
|
|
78139
|
+
length = 0;
|
|
78140
|
+
while (bytes[position + length] !== 0 || bytes[position + length + 1] !== 0) {
|
|
78141
|
+
if (length > bytes.byteLength) {
|
|
78142
|
+
throw new TypeError('invalid indefinite form length');
|
|
78143
|
+
}
|
|
78144
|
+
length++;
|
|
78145
|
+
}
|
|
78146
|
+
const byteLength = position + length + 2;
|
|
78147
|
+
return {
|
|
78148
|
+
byteLength,
|
|
78149
|
+
contents: bytes.subarray(position, position + length),
|
|
78150
|
+
raw: bytes.subarray(0, byteLength),
|
|
78151
|
+
};
|
|
78152
|
+
}
|
|
78153
|
+
else {
|
|
78154
|
+
let numberOfDigits = bytes[position] & 0x7f;
|
|
78155
|
+
position++;
|
|
78156
|
+
length = 0;
|
|
78157
|
+
for (let i = 0; i < numberOfDigits; i++) {
|
|
78158
|
+
length = length * 256 + bytes[position];
|
|
78159
|
+
position++;
|
|
78160
|
+
}
|
|
78161
|
+
}
|
|
78162
|
+
const byteLength = position + length;
|
|
78163
|
+
return {
|
|
78164
|
+
byteLength,
|
|
78165
|
+
contents: bytes.subarray(position, byteLength),
|
|
78166
|
+
raw: bytes.subarray(0, byteLength),
|
|
78167
|
+
};
|
|
78168
|
+
}
|
|
78169
|
+
function spkiFromX509(buf) {
|
|
78170
|
+
const tbsCertificate = getElement(getElement(parseElement(buf).contents)[0].contents);
|
|
78171
|
+
return (0,_base64url_js__WEBPACK_IMPORTED_MODULE_3__.encodeBase64)(tbsCertificate[tbsCertificate[0].raw[0] === 0xa0 ? 6 : 5].raw);
|
|
78172
|
+
}
|
|
78173
|
+
function getSPKI(x509) {
|
|
78174
|
+
const pem = x509.replace(/(?:-----(?:BEGIN|END) CERTIFICATE-----|\s)/g, '');
|
|
78175
|
+
const raw = (0,_base64url_js__WEBPACK_IMPORTED_MODULE_3__.decodeBase64)(pem);
|
|
78176
|
+
return (0,_lib_format_pem_js__WEBPACK_IMPORTED_MODULE_4__["default"])(spkiFromX509(raw), 'PUBLIC KEY');
|
|
78177
|
+
}
|
|
78178
|
+
const fromX509 = (pem, alg, options) => {
|
|
78179
|
+
let spki;
|
|
78180
|
+
try {
|
|
78181
|
+
spki = getSPKI(pem);
|
|
78182
|
+
}
|
|
78183
|
+
catch (cause) {
|
|
78184
|
+
throw new TypeError('failed to parse the X.509 certificate', { cause });
|
|
78185
|
+
}
|
|
78186
|
+
return fromSPKI(spki, alg, options);
|
|
78187
|
+
};
|
|
77482
78188
|
|
|
77483
78189
|
|
|
77484
78190
|
/***/ }),
|
|
@@ -78036,7 +78742,7 @@ function getModulusLengthOption(options) {
|
|
|
78036
78742
|
return modulusLength;
|
|
78037
78743
|
}
|
|
78038
78744
|
async function generateKeyPair(alg, options) {
|
|
78039
|
-
var _a, _b, _c;
|
|
78745
|
+
var _a, _b, _c, _d;
|
|
78040
78746
|
let algorithm;
|
|
78041
78747
|
let keyUsages;
|
|
78042
78748
|
switch (alg) {
|
|
@@ -78086,17 +78792,6 @@ async function generateKeyPair(alg, options) {
|
|
|
78086
78792
|
algorithm = { name: 'ECDSA', namedCurve: 'P-521' };
|
|
78087
78793
|
keyUsages = ['sign', 'verify'];
|
|
78088
78794
|
break;
|
|
78089
|
-
case (0,_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)() && 'EdDSA':
|
|
78090
|
-
switch (options === null || options === void 0 ? void 0 : options.crv) {
|
|
78091
|
-
case undefined:
|
|
78092
|
-
case 'Ed25519':
|
|
78093
|
-
algorithm = { name: 'NODE-ED25519', namedCurve: 'NODE-ED25519' };
|
|
78094
|
-
keyUsages = ['sign', 'verify'];
|
|
78095
|
-
break;
|
|
78096
|
-
default:
|
|
78097
|
-
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JOSENotSupported('Invalid or unsupported crv option provided');
|
|
78098
|
-
}
|
|
78099
|
-
break;
|
|
78100
78795
|
case 'EdDSA':
|
|
78101
78796
|
keyUsages = ['sign', 'verify'];
|
|
78102
78797
|
const crv = (_a = options === null || options === void 0 ? void 0 : options.crv) !== null && _a !== void 0 ? _a : 'Ed25519';
|
|
@@ -78134,7 +78829,18 @@ async function generateKeyPair(alg, options) {
|
|
|
78134
78829
|
default:
|
|
78135
78830
|
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
78136
78831
|
}
|
|
78137
|
-
|
|
78832
|
+
try {
|
|
78833
|
+
return (await _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.generateKey(algorithm, (_c = options === null || options === void 0 ? void 0 : options.extractable) !== null && _c !== void 0 ? _c : false, keyUsages));
|
|
78834
|
+
}
|
|
78835
|
+
catch (err) {
|
|
78836
|
+
if (algorithm.name === 'Ed25519' &&
|
|
78837
|
+
(err === null || err === void 0 ? void 0 : err.name) === 'NotSupportedError' &&
|
|
78838
|
+
(0,_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)()) {
|
|
78839
|
+
algorithm = { name: 'NODE-ED25519', namedCurve: 'NODE-ED25519' };
|
|
78840
|
+
return (await _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.generateKey(algorithm, (_d = options === null || options === void 0 ? void 0 : options.extractable) !== null && _d !== void 0 ? _d : false, keyUsages));
|
|
78841
|
+
}
|
|
78842
|
+
throw err;
|
|
78843
|
+
}
|
|
78138
78844
|
}
|
|
78139
78845
|
|
|
78140
78846
|
|
|
@@ -78314,19 +79020,6 @@ function subtleMapping(jwk) {
|
|
|
78314
79020
|
}
|
|
78315
79021
|
break;
|
|
78316
79022
|
}
|
|
78317
|
-
case (0,_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)() && 'OKP':
|
|
78318
|
-
if (jwk.alg !== 'EdDSA') {
|
|
78319
|
-
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
78320
|
-
}
|
|
78321
|
-
switch (jwk.crv) {
|
|
78322
|
-
case 'Ed25519':
|
|
78323
|
-
algorithm = { name: 'NODE-ED25519', namedCurve: 'NODE-ED25519' };
|
|
78324
|
-
keyUsages = jwk.d ? ['sign'] : ['verify'];
|
|
78325
|
-
break;
|
|
78326
|
-
default:
|
|
78327
|
-
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
78328
|
-
}
|
|
78329
|
-
break;
|
|
78330
79023
|
case 'OKP': {
|
|
78331
79024
|
switch (jwk.alg) {
|
|
78332
79025
|
case 'EdDSA':
|
|
@@ -78352,6 +79045,9 @@ function subtleMapping(jwk) {
|
|
|
78352
79045
|
}
|
|
78353
79046
|
const parse = async (jwk) => {
|
|
78354
79047
|
var _a, _b;
|
|
79048
|
+
if (!jwk.alg) {
|
|
79049
|
+
throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
|
|
79050
|
+
}
|
|
78355
79051
|
const { algorithm, keyUsages } = subtleMapping(jwk);
|
|
78356
79052
|
const rest = [
|
|
78357
79053
|
algorithm,
|
|
@@ -78364,7 +79060,18 @@ const parse = async (jwk) => {
|
|
|
78364
79060
|
const keyData = { ...jwk };
|
|
78365
79061
|
delete keyData.alg;
|
|
78366
79062
|
delete keyData.use;
|
|
78367
|
-
|
|
79063
|
+
try {
|
|
79064
|
+
return await _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.importKey('jwk', keyData, ...rest);
|
|
79065
|
+
}
|
|
79066
|
+
catch (err) {
|
|
79067
|
+
if (algorithm.name === 'Ed25519' &&
|
|
79068
|
+
(err === null || err === void 0 ? void 0 : err.name) === 'NotSupportedError' &&
|
|
79069
|
+
(0,_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)()) {
|
|
79070
|
+
rest[0] = { name: 'NODE-ED25519', namedCurve: 'NODE-ED25519' };
|
|
79071
|
+
return await _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.importKey('jwk', keyData, ...rest);
|
|
79072
|
+
}
|
|
79073
|
+
throw err;
|
|
79074
|
+
}
|
|
78368
79075
|
};
|
|
78369
79076
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (parse);
|
|
78370
79077
|
|
|
@@ -78629,10 +79336,10 @@ function subtleDsa(alg, algorithm) {
|
|
|
78629
79336
|
case 'ES384':
|
|
78630
79337
|
case 'ES512':
|
|
78631
79338
|
return { hash, name: 'ECDSA', namedCurve: algorithm.namedCurve };
|
|
78632
|
-
case (0,_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)() && 'EdDSA':
|
|
78633
|
-
const { namedCurve } = algorithm;
|
|
78634
|
-
return { name: namedCurve, namedCurve };
|
|
78635
79339
|
case 'EdDSA':
|
|
79340
|
+
if ((0,_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)() && algorithm.name === 'NODE-ED25519') {
|
|
79341
|
+
return { name: 'NODE-ED25519', namedCurve: 'NODE-ED25519' };
|
|
79342
|
+
}
|
|
78636
79343
|
return { name: algorithm.name };
|
|
78637
79344
|
default:
|
|
78638
79345
|
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
|
|
@@ -79056,6 +79763,7 @@ class JWKSMultipleMatchingKeys extends JOSEError {
|
|
|
79056
79763
|
return 'ERR_JWKS_MULTIPLE_MATCHING_KEYS';
|
|
79057
79764
|
}
|
|
79058
79765
|
}
|
|
79766
|
+
Symbol.asyncIterator;
|
|
79059
79767
|
class JWKSTimeout extends JOSEError {
|
|
79060
79768
|
constructor() {
|
|
79061
79769
|
super(...arguments);
|