solid-ui 2.4.25 → 2.4.26-029ae1f9
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 +1778 -1134
- 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 +227 -61
- package/lib/chat/chatLogic.js.map +1 -1
- package/lib/chat/dateFolder.js.map +1 -1
- package/lib/chat/infinite.js +585 -408
- 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 +423 -271
- 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.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 +16 -14
- 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,164 @@ 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
|
|
2761
2818
|
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;
|
|
2819
|
+
function allVersions(_x5) {
|
|
2820
|
+
return _allVersions.apply(this, arguments);
|
|
2769
2821
|
}
|
|
2770
|
-
function
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2822
|
+
function _allVersions() {
|
|
2823
|
+
_allVersions = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(message) {
|
|
2824
|
+
var versions, m, prev, next;
|
|
2825
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
2826
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
2827
|
+
case 0:
|
|
2828
|
+
versions = [message];
|
|
2829
|
+
m = message;
|
|
2830
|
+
case 2:
|
|
2831
|
+
if (false) {}
|
|
2832
|
+
// earlier?
|
|
2833
|
+
prev = _solidLogic.store.any(null, ns.dct('isReplacedBy'), m, m.doc());
|
|
2834
|
+
if (prev) {
|
|
2835
|
+
_context5.next = 6;
|
|
2836
|
+
break;
|
|
2837
|
+
}
|
|
2838
|
+
return _context5.abrupt("break", 12);
|
|
2839
|
+
case 6:
|
|
2840
|
+
_context5.next = 8;
|
|
2841
|
+
return _solidLogic.store.fetcher.load(prev);
|
|
2842
|
+
case 8:
|
|
2843
|
+
versions.unshift(prev);
|
|
2844
|
+
m = prev;
|
|
2845
|
+
_context5.next = 2;
|
|
2846
|
+
break;
|
|
2847
|
+
case 12:
|
|
2848
|
+
m = message;
|
|
2849
|
+
case 13:
|
|
2850
|
+
if (false) {}
|
|
2851
|
+
// later?
|
|
2852
|
+
next = _solidLogic.store.any(m, ns.dct('isReplacedBy'), null, m.doc());
|
|
2853
|
+
if (next) {
|
|
2854
|
+
_context5.next = 17;
|
|
2855
|
+
break;
|
|
2856
|
+
}
|
|
2857
|
+
return _context5.abrupt("break", 21);
|
|
2858
|
+
case 17:
|
|
2859
|
+
versions.push(next);
|
|
2860
|
+
m = next;
|
|
2861
|
+
_context5.next = 13;
|
|
2862
|
+
break;
|
|
2863
|
+
case 21:
|
|
2864
|
+
return _context5.abrupt("return", versions);
|
|
2865
|
+
case 22:
|
|
2866
|
+
case "end":
|
|
2867
|
+
return _context5.stop();
|
|
2868
|
+
}
|
|
2869
|
+
}, _callee5);
|
|
2870
|
+
}));
|
|
2871
|
+
return _allVersions.apply(this, arguments);
|
|
2872
|
+
}
|
|
2873
|
+
function originalVersion(_x6) {
|
|
2874
|
+
return _originalVersion.apply(this, arguments);
|
|
2875
|
+
}
|
|
2876
|
+
function _originalVersion() {
|
|
2877
|
+
_originalVersion = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(message) {
|
|
2878
|
+
var msg;
|
|
2879
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
2880
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
2881
|
+
case 0:
|
|
2882
|
+
msg = message;
|
|
2883
|
+
case 1:
|
|
2884
|
+
if (!msg) {
|
|
2885
|
+
_context6.next = 8;
|
|
2886
|
+
break;
|
|
2887
|
+
}
|
|
2888
|
+
message = msg;
|
|
2889
|
+
_context6.next = 5;
|
|
2890
|
+
return _solidLogic.store.fetcher.load(message);
|
|
2891
|
+
case 5:
|
|
2892
|
+
msg = _solidLogic.store.any(null, ns.dct('isReplacedBy'), message, message.doc()); // @@@ may need to load doc
|
|
2893
|
+
_context6.next = 1;
|
|
2894
|
+
break;
|
|
2895
|
+
case 8:
|
|
2896
|
+
return _context6.abrupt("return", message);
|
|
2897
|
+
case 9:
|
|
2898
|
+
case "end":
|
|
2899
|
+
return _context6.stop();
|
|
2900
|
+
}
|
|
2901
|
+
}, _callee6);
|
|
2902
|
+
}));
|
|
2903
|
+
return _originalVersion.apply(this, arguments);
|
|
2904
|
+
}
|
|
2905
|
+
function mostRecentVersion(_x7) {
|
|
2906
|
+
return _mostRecentVersion.apply(this, arguments);
|
|
2907
|
+
}
|
|
2908
|
+
function _mostRecentVersion() {
|
|
2909
|
+
_mostRecentVersion = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(message) {
|
|
2910
|
+
var msg;
|
|
2911
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
2912
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
2913
|
+
case 0:
|
|
2914
|
+
msg = message;
|
|
2915
|
+
case 1:
|
|
2916
|
+
if (!msg) {
|
|
2917
|
+
_context7.next = 8;
|
|
2918
|
+
break;
|
|
2919
|
+
}
|
|
2920
|
+
message = msg;
|
|
2921
|
+
_context7.next = 5;
|
|
2922
|
+
return _solidLogic.store.fetcher.load(message);
|
|
2923
|
+
case 5:
|
|
2924
|
+
msg = _solidLogic.store.any(message, ns.dct('isReplacedBy'), null, message.doc());
|
|
2925
|
+
_context7.next = 1;
|
|
2926
|
+
break;
|
|
2927
|
+
case 8:
|
|
2928
|
+
return _context7.abrupt("return", message);
|
|
2929
|
+
case 9:
|
|
2930
|
+
case "end":
|
|
2931
|
+
return _context7.stop();
|
|
2932
|
+
}
|
|
2933
|
+
}, _callee7);
|
|
2934
|
+
}));
|
|
2935
|
+
return _mostRecentVersion.apply(this, arguments);
|
|
2777
2936
|
}
|
|
2778
2937
|
function isDeleted(message) {
|
|
2779
2938
|
return _solidLogic.store.holds(message, ns.schema('dateDeleted'), null, message.doc());
|
|
@@ -2792,62 +2951,62 @@ function nick(person) {
|
|
|
2792
2951
|
if (s) return '' + s.value;
|
|
2793
2952
|
return '' + utils.label(person);
|
|
2794
2953
|
}
|
|
2795
|
-
function _createIfNotExists(
|
|
2954
|
+
function _createIfNotExists(_x8) {
|
|
2796
2955
|
return _createIfNotExists2.apply(this, arguments);
|
|
2797
2956
|
} // ends
|
|
2798
2957
|
function _createIfNotExists2() {
|
|
2799
2958
|
_createIfNotExists2 = (0, _asyncToGenerator2["default"])(function (doc) {
|
|
2800
2959
|
var contentType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'text/turtle';
|
|
2801
2960
|
var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
2802
|
-
return /*#__PURE__*/_regenerator["default"].mark(function
|
|
2961
|
+
return /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
|
|
2803
2962
|
var response;
|
|
2804
|
-
return _regenerator["default"].wrap(function
|
|
2805
|
-
while (1) switch (
|
|
2963
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
2964
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
2806
2965
|
case 0:
|
|
2807
|
-
|
|
2808
|
-
|
|
2966
|
+
_context8.prev = 0;
|
|
2967
|
+
_context8.next = 3;
|
|
2809
2968
|
return _solidLogic.store.fetcher.load(doc);
|
|
2810
2969
|
case 3:
|
|
2811
|
-
response =
|
|
2812
|
-
|
|
2970
|
+
response = _context8.sent;
|
|
2971
|
+
_context8.next = 26;
|
|
2813
2972
|
break;
|
|
2814
2973
|
case 6:
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
if (!(
|
|
2818
|
-
|
|
2974
|
+
_context8.prev = 6;
|
|
2975
|
+
_context8.t0 = _context8["catch"](0);
|
|
2976
|
+
if (!(_context8.t0.response.status === 404)) {
|
|
2977
|
+
_context8.next = 24;
|
|
2819
2978
|
break;
|
|
2820
2979
|
}
|
|
2821
2980
|
debug.log('createIfNotExists: doc does NOT exist, will create... ' + doc);
|
|
2822
|
-
|
|
2823
|
-
|
|
2981
|
+
_context8.prev = 10;
|
|
2982
|
+
_context8.next = 13;
|
|
2824
2983
|
return _solidLogic.store.fetcher.webOperation('PUT', doc.uri, {
|
|
2825
2984
|
data: data,
|
|
2826
2985
|
contentType: contentType
|
|
2827
2986
|
});
|
|
2828
2987
|
case 13:
|
|
2829
|
-
response =
|
|
2830
|
-
|
|
2988
|
+
response = _context8.sent;
|
|
2989
|
+
_context8.next = 20;
|
|
2831
2990
|
break;
|
|
2832
2991
|
case 16:
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
debug.log('createIfNotExists doc FAILED: ' + doc + ': ' +
|
|
2836
|
-
throw
|
|
2992
|
+
_context8.prev = 16;
|
|
2993
|
+
_context8.t1 = _context8["catch"](10);
|
|
2994
|
+
debug.log('createIfNotExists doc FAILED: ' + doc + ': ' + _context8.t1);
|
|
2995
|
+
throw _context8.t1;
|
|
2837
2996
|
case 20:
|
|
2838
2997
|
delete _solidLogic.store.fetcher.requested[doc.uri]; // delete cached 404 error
|
|
2839
2998
|
// debug.log('createIfNotExists doc created ok ' + doc)
|
|
2840
|
-
return
|
|
2999
|
+
return _context8.abrupt("return", response);
|
|
2841
3000
|
case 24:
|
|
2842
|
-
debug.log('createIfNotExists doc load error NOT 404: ' + doc + ': ' +
|
|
2843
|
-
throw
|
|
3001
|
+
debug.log('createIfNotExists doc load error NOT 404: ' + doc + ': ' + _context8.t0);
|
|
3002
|
+
throw _context8.t0;
|
|
2844
3003
|
case 26:
|
|
2845
|
-
return
|
|
3004
|
+
return _context8.abrupt("return", response);
|
|
2846
3005
|
case 27:
|
|
2847
3006
|
case "end":
|
|
2848
|
-
return
|
|
3007
|
+
return _context8.stop();
|
|
2849
3008
|
}
|
|
2850
|
-
},
|
|
3009
|
+
}, _callee8, null, [[0, 6], [10, 16]]);
|
|
2851
3010
|
})();
|
|
2852
3011
|
});
|
|
2853
3012
|
return _createIfNotExists2.apply(this, arguments);
|
|
@@ -3225,19 +3384,9 @@ var _chatLogic = __webpack_require__(/*! ./chatLogic */ "./lib/chat/chatLogic.js
|
|
|
3225
3384
|
var _message = __webpack_require__(/*! ./message */ "./lib/chat/message.js");
|
|
3226
3385
|
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
3386
|
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
|
-
|
|
3387
|
+
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; } } }; }
|
|
3388
|
+
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); }
|
|
3389
|
+
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
3390
|
// const UI = { authn, icons, ns, media, pad, $rdf, store, style, utils, widgets }
|
|
3242
3391
|
|
|
3243
3392
|
function desktopNotification(str) {
|
|
@@ -3265,34 +3414,9 @@ function desktopNotification(str) {
|
|
|
3265
3414
|
/**
|
|
3266
3415
|
* Renders a chat message inside a `messageTable`
|
|
3267
3416
|
*/
|
|
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
|
-
}
|
|
3417
|
+
function insertMessageIntoTable(_x, _x2, _x3, _x4, _x5, _x6) {
|
|
3418
|
+
return _insertMessageIntoTable.apply(this, arguments);
|
|
3294
3419
|
}
|
|
3295
|
-
|
|
3296
3420
|
/**
|
|
3297
3421
|
* Common code for a chat (discussion area of messages about something)
|
|
3298
3422
|
* This version runs over a series of files for different time periods
|
|
@@ -3315,20 +3439,70 @@ function insertMessageIntoTable(channelObject, messageTable, message, fresh, opt
|
|
|
3315
3439
|
- inlineImageHeightEms: The height (in ems) of images expaned from their URIs in the chat.
|
|
3316
3440
|
|
|
3317
3441
|
*/
|
|
3318
|
-
function
|
|
3442
|
+
function _insertMessageIntoTable() {
|
|
3443
|
+
_insertMessageIntoTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(channelObject, messageTable, message, fresh, options, userContext) {
|
|
3444
|
+
var messageRow, done, ele, newestFirst, dateString;
|
|
3445
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
3446
|
+
while (1) switch (_context.prev = _context.next) {
|
|
3447
|
+
case 0:
|
|
3448
|
+
_context.next = 2;
|
|
3449
|
+
return (0, _message.renderMessageRow)(channelObject, message, fresh, options, userContext);
|
|
3450
|
+
case 2:
|
|
3451
|
+
messageRow = _context.sent;
|
|
3452
|
+
// const message = messageRow.AJAR_subject
|
|
3453
|
+
if (options.selectedMessage && options.selectedMessage.sameTerm(message)) {
|
|
3454
|
+
messageRow.style.backgroundColor = 'yellow';
|
|
3455
|
+
options.selectedElement = messageRow;
|
|
3456
|
+
messageTable.selectedElement = messageRow;
|
|
3457
|
+
}
|
|
3458
|
+
done = false;
|
|
3459
|
+
ele = messageTable.firstChild;
|
|
3460
|
+
case 6:
|
|
3461
|
+
if (ele) {
|
|
3462
|
+
_context.next = 8;
|
|
3463
|
+
break;
|
|
3464
|
+
}
|
|
3465
|
+
return _context.abrupt("break", 17);
|
|
3466
|
+
case 8:
|
|
3467
|
+
newestFirst = options.newestfirst === true;
|
|
3468
|
+
dateString = messageRow.AJAR_date;
|
|
3469
|
+
if (!(dateString > ele.AJAR_date && newestFirst || dateString < ele.AJAR_date && !newestFirst)) {
|
|
3470
|
+
_context.next = 14;
|
|
3471
|
+
break;
|
|
3472
|
+
}
|
|
3473
|
+
messageTable.insertBefore(messageRow, ele);
|
|
3474
|
+
done = true;
|
|
3475
|
+
return _context.abrupt("break", 17);
|
|
3476
|
+
case 14:
|
|
3477
|
+
ele = ele.nextSibling;
|
|
3478
|
+
_context.next = 6;
|
|
3479
|
+
break;
|
|
3480
|
+
case 17:
|
|
3481
|
+
if (!done) {
|
|
3482
|
+
messageTable.appendChild(messageRow);
|
|
3483
|
+
}
|
|
3484
|
+
case 18:
|
|
3485
|
+
case "end":
|
|
3486
|
+
return _context.stop();
|
|
3487
|
+
}
|
|
3488
|
+
}, _callee);
|
|
3489
|
+
}));
|
|
3490
|
+
return _insertMessageIntoTable.apply(this, arguments);
|
|
3491
|
+
}
|
|
3492
|
+
function infiniteMessageArea(_x7, _x8, _x9, _x10) {
|
|
3319
3493
|
return _infiniteMessageArea.apply(this, arguments);
|
|
3320
3494
|
}
|
|
3321
3495
|
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 (
|
|
3496
|
+
_infiniteMessageArea = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee16(dom, wasStore, chatChannel, options) {
|
|
3497
|
+
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, earliest, latest, lock;
|
|
3498
|
+
return _regenerator["default"].wrap(function _callee16$(_context16) {
|
|
3499
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
3326
3500
|
case 0:
|
|
3327
3501
|
_loadInitialContent = function _loadInitialContent3() {
|
|
3328
|
-
_loadInitialContent = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3502
|
+
_loadInitialContent = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee15() {
|
|
3329
3503
|
var yank, fixScroll, live, selectedDocument, now, todayDocument, selectedMessageTable, selectedDate;
|
|
3330
|
-
return _regenerator["default"].wrap(function
|
|
3331
|
-
while (1) switch (
|
|
3504
|
+
return _regenerator["default"].wrap(function _callee15$(_context15) {
|
|
3505
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
3332
3506
|
case 0:
|
|
3333
3507
|
fixScroll = function _fixScroll() {
|
|
3334
3508
|
if (options.selectedElement) {
|
|
@@ -3353,29 +3527,29 @@ function _infiniteMessageArea() {
|
|
|
3353
3527
|
live = todayDocument.sameTerm(selectedDocument);
|
|
3354
3528
|
}
|
|
3355
3529
|
if (!(options.selectedMessage && !live)) {
|
|
3356
|
-
|
|
3530
|
+
_context15.next = 15;
|
|
3357
3531
|
break;
|
|
3358
3532
|
}
|
|
3359
3533
|
selectedDate = dateFolder.dateFromLeafDocument(selectedDocument);
|
|
3360
|
-
|
|
3534
|
+
_context15.next = 7;
|
|
3361
3535
|
return createMessageTable(selectedDate, live);
|
|
3362
3536
|
case 7:
|
|
3363
|
-
selectedMessageTable =
|
|
3537
|
+
selectedMessageTable = _context15.sent;
|
|
3364
3538
|
div.appendChild(selectedMessageTable);
|
|
3365
3539
|
earliest.messageTable = selectedMessageTable;
|
|
3366
3540
|
latest.messageTable = selectedMessageTable;
|
|
3367
3541
|
yank();
|
|
3368
3542
|
setTimeout(yank, 1000); // @@ kludge - restore position distubed by other cHANGES
|
|
3369
|
-
|
|
3543
|
+
_context15.next = 19;
|
|
3370
3544
|
break;
|
|
3371
3545
|
case 15:
|
|
3372
|
-
|
|
3546
|
+
_context15.next = 17;
|
|
3373
3547
|
return appendCurrentMessages();
|
|
3374
3548
|
case 17:
|
|
3375
3549
|
earliest.messageTable = liveMessageTable;
|
|
3376
3550
|
latest.messageTable = liveMessageTable;
|
|
3377
3551
|
case 19:
|
|
3378
|
-
|
|
3552
|
+
_context15.next = 21;
|
|
3379
3553
|
return loadMoreWhereNeeded(null, fixScroll);
|
|
3380
3554
|
case 21:
|
|
3381
3555
|
div.addEventListener('scroll', loadMoreWhereNeeded);
|
|
@@ -3384,9 +3558,9 @@ function _infiniteMessageArea() {
|
|
|
3384
3558
|
}
|
|
3385
3559
|
case 23:
|
|
3386
3560
|
case "end":
|
|
3387
|
-
return
|
|
3561
|
+
return _context15.stop();
|
|
3388
3562
|
}
|
|
3389
|
-
},
|
|
3563
|
+
}, _callee15);
|
|
3390
3564
|
}));
|
|
3391
3565
|
return _loadInitialContent.apply(this, arguments);
|
|
3392
3566
|
};
|
|
@@ -3394,16 +3568,16 @@ function _infiniteMessageArea() {
|
|
|
3394
3568
|
return _loadInitialContent.apply(this, arguments);
|
|
3395
3569
|
};
|
|
3396
3570
|
_loadMoreWhereNeeded = function _loadMoreWhereNeeded3() {
|
|
3397
|
-
_loadMoreWhereNeeded = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3571
|
+
_loadMoreWhereNeeded = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14(event, fixScroll) {
|
|
3398
3572
|
var freeze, magicZone, done, scrollBottom, scrollTop;
|
|
3399
|
-
return _regenerator["default"].wrap(function
|
|
3400
|
-
while (1) switch (
|
|
3573
|
+
return _regenerator["default"].wrap(function _callee14$(_context14) {
|
|
3574
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
3401
3575
|
case 0:
|
|
3402
3576
|
if (!lock) {
|
|
3403
|
-
|
|
3577
|
+
_context14.next = 2;
|
|
3404
3578
|
break;
|
|
3405
3579
|
}
|
|
3406
|
-
return
|
|
3580
|
+
return _context14.abrupt("return");
|
|
3407
3581
|
case 2:
|
|
3408
3582
|
lock = true;
|
|
3409
3583
|
freeze = !fixScroll;
|
|
@@ -3411,36 +3585,36 @@ function _infiniteMessageArea() {
|
|
|
3411
3585
|
// const bottom = div.scrollHeight - top - div.clientHeight
|
|
3412
3586
|
case 5:
|
|
3413
3587
|
if (!(div.scrollTop < magicZone && earliest.messageTable && !earliest.messageTable.initial && earliest.messageTable.extendBackwards)) {
|
|
3414
|
-
|
|
3588
|
+
_context14.next = 21;
|
|
3415
3589
|
break;
|
|
3416
3590
|
}
|
|
3417
3591
|
if (!(div.scrollHeight === 0)) {
|
|
3418
|
-
|
|
3592
|
+
_context14.next = 10;
|
|
3419
3593
|
break;
|
|
3420
3594
|
}
|
|
3421
|
-
//
|
|
3595
|
+
// debug.log(' chat/loadMoreWhereNeeded: trying later...')
|
|
3422
3596
|
setTimeout(loadMoreWhereNeeded, 2000); // couple be less
|
|
3423
3597
|
lock = false;
|
|
3424
|
-
return
|
|
3598
|
+
return _context14.abrupt("return");
|
|
3425
3599
|
case 10:
|
|
3426
|
-
//
|
|
3600
|
+
// debug.log(' chat/loadMoreWhereNeeded: Going now')
|
|
3427
3601
|
scrollBottom = div.scrollHeight - div.scrollTop;
|
|
3428
3602
|
debug.log('infinite scroll: adding above: top ' + div.scrollTop);
|
|
3429
|
-
|
|
3603
|
+
_context14.next = 14;
|
|
3430
3604
|
return earliest.messageTable.extendBackwards();
|
|
3431
3605
|
case 14:
|
|
3432
|
-
done =
|
|
3606
|
+
done = _context14.sent;
|
|
3433
3607
|
if (freeze) {
|
|
3434
3608
|
div.scrollTop = div.scrollHeight - scrollBottom;
|
|
3435
3609
|
}
|
|
3436
3610
|
if (fixScroll) fixScroll();
|
|
3437
3611
|
if (!done) {
|
|
3438
|
-
|
|
3612
|
+
_context14.next = 19;
|
|
3439
3613
|
break;
|
|
3440
3614
|
}
|
|
3441
|
-
return
|
|
3615
|
+
return _context14.abrupt("break", 21);
|
|
3442
3616
|
case 19:
|
|
3443
|
-
|
|
3617
|
+
_context14.next = 5;
|
|
3444
3618
|
break;
|
|
3445
3619
|
case 21:
|
|
3446
3620
|
if (!(options.selectedMessage &&
|
|
@@ -3450,15 +3624,15 @@ function _infiniteMessageArea() {
|
|
|
3450
3624
|
latest.messageTable && !latest.messageTable["final"] &&
|
|
3451
3625
|
// there is more data to come
|
|
3452
3626
|
latest.messageTable.extendForwards)) {
|
|
3453
|
-
|
|
3627
|
+
_context14.next = 33;
|
|
3454
3628
|
break;
|
|
3455
3629
|
}
|
|
3456
3630
|
scrollTop = div.scrollTop;
|
|
3457
3631
|
debug.log('infinite scroll: adding below: bottom: ' + (div.scrollHeight - div.scrollTop - div.clientHeight));
|
|
3458
|
-
|
|
3632
|
+
_context14.next = 26;
|
|
3459
3633
|
return latest.messageTable.extendForwards();
|
|
3460
3634
|
case 26:
|
|
3461
|
-
done =
|
|
3635
|
+
done = _context14.sent;
|
|
3462
3636
|
// then add more data on the bottom
|
|
3463
3637
|
if (freeze) {
|
|
3464
3638
|
div.scrollTop = scrollTop; // while adding below keep same things in view
|
|
@@ -3466,63 +3640,66 @@ function _infiniteMessageArea() {
|
|
|
3466
3640
|
|
|
3467
3641
|
if (fixScroll) fixScroll();
|
|
3468
3642
|
if (!done) {
|
|
3469
|
-
|
|
3643
|
+
_context14.next = 31;
|
|
3470
3644
|
break;
|
|
3471
3645
|
}
|
|
3472
|
-
return
|
|
3646
|
+
return _context14.abrupt("break", 33);
|
|
3473
3647
|
case 31:
|
|
3474
|
-
|
|
3648
|
+
_context14.next = 21;
|
|
3475
3649
|
break;
|
|
3476
3650
|
case 33:
|
|
3477
3651
|
lock = false;
|
|
3478
3652
|
case 34:
|
|
3479
3653
|
case "end":
|
|
3480
|
-
return
|
|
3654
|
+
return _context14.stop();
|
|
3481
3655
|
}
|
|
3482
|
-
},
|
|
3656
|
+
}, _callee14);
|
|
3483
3657
|
}));
|
|
3484
3658
|
return _loadMoreWhereNeeded.apply(this, arguments);
|
|
3485
3659
|
};
|
|
3486
|
-
loadMoreWhereNeeded = function _loadMoreWhereNeeded2(
|
|
3660
|
+
loadMoreWhereNeeded = function _loadMoreWhereNeeded2(_x20, _x21) {
|
|
3487
3661
|
return _loadMoreWhereNeeded.apply(this, arguments);
|
|
3488
3662
|
};
|
|
3489
3663
|
_appendCurrentMessages = function _appendCurrentMessage2() {
|
|
3490
|
-
_appendCurrentMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3664
|
+
_appendCurrentMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13() {
|
|
3491
3665
|
var now, chatDocument, messageTable;
|
|
3492
|
-
return _regenerator["default"].wrap(function
|
|
3493
|
-
while (1) switch (
|
|
3666
|
+
return _regenerator["default"].wrap(function _callee13$(_context13) {
|
|
3667
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
3494
3668
|
case 0:
|
|
3495
3669
|
now = new Date();
|
|
3496
3670
|
chatDocument = dateFolder.leafDocumentFromDate(now); /// ///////////////////////////////////////////////////////////
|
|
3497
|
-
|
|
3671
|
+
_context13.next = 4;
|
|
3498
3672
|
return createMessageTable(now, true);
|
|
3499
3673
|
case 4:
|
|
3500
|
-
messageTable =
|
|
3674
|
+
messageTable = _context13.sent;
|
|
3501
3675
|
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 (
|
|
3676
|
+
div.refresh = /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12() {
|
|
3677
|
+
return _regenerator["default"].wrap(function _callee12$(_context12) {
|
|
3678
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
3505
3679
|
case 0:
|
|
3506
|
-
|
|
3680
|
+
_context12.next = 2;
|
|
3507
3681
|
return addNewChatDocumentIfNewDay(new Date());
|
|
3508
3682
|
case 2:
|
|
3509
|
-
|
|
3510
|
-
|
|
3683
|
+
_context12.next = 4;
|
|
3684
|
+
return syncMessages(chatChannel, messageTable);
|
|
3511
3685
|
case 4:
|
|
3686
|
+
// @@ livemessagetable??
|
|
3687
|
+
desktopNotification(chatChannel);
|
|
3688
|
+
case 5:
|
|
3512
3689
|
case "end":
|
|
3513
|
-
return
|
|
3690
|
+
return _context12.stop();
|
|
3514
3691
|
}
|
|
3515
|
-
},
|
|
3692
|
+
}, _callee12);
|
|
3516
3693
|
})); // The short chat version the live update listening is done in the pane but we do it in the widget @@
|
|
3517
3694
|
_solidLogic.store.updater.addDownstreamChangeListener(chatDocument, div.refresh); // Live update
|
|
3518
3695
|
liveMessageTable = messageTable;
|
|
3519
3696
|
latest.messageTable = liveMessageTable;
|
|
3520
|
-
return
|
|
3697
|
+
return _context13.abrupt("return", messageTable);
|
|
3521
3698
|
case 11:
|
|
3522
3699
|
case "end":
|
|
3523
|
-
return
|
|
3700
|
+
return _context13.stop();
|
|
3524
3701
|
}
|
|
3525
|
-
},
|
|
3702
|
+
}, _callee13);
|
|
3526
3703
|
}));
|
|
3527
3704
|
return _appendCurrentMessages.apply(this, arguments);
|
|
3528
3705
|
};
|
|
@@ -3530,15 +3707,15 @@ function _infiniteMessageArea() {
|
|
|
3530
3707
|
return _appendCurrentMessages.apply(this, arguments);
|
|
3531
3708
|
};
|
|
3532
3709
|
_addNewChatDocumentIfNewDay = function _addNewChatDocumentIf2() {
|
|
3533
|
-
_addNewChatDocumentIfNewDay = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3710
|
+
_addNewChatDocumentIfNewDay = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11() {
|
|
3534
3711
|
var newChatDocument, oldChatDocument, sts;
|
|
3535
|
-
return _regenerator["default"].wrap(function
|
|
3536
|
-
while (1) switch (
|
|
3712
|
+
return _regenerator["default"].wrap(function _callee11$(_context11) {
|
|
3713
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
3537
3714
|
case 0:
|
|
3538
3715
|
// @@ Remove listener from previous table as it is now static
|
|
3539
3716
|
newChatDocument = dateFolder.leafDocumentFromDate(new Date());
|
|
3540
3717
|
if (newChatDocument.sameTerm(latest.messageTable.chatDocument)) {
|
|
3541
|
-
|
|
3718
|
+
_context11.next = 7;
|
|
3542
3719
|
break;
|
|
3543
3720
|
}
|
|
3544
3721
|
// It is a new day
|
|
@@ -3547,7 +3724,7 @@ function _infiniteMessageArea() {
|
|
|
3547
3724
|
delete liveMessageTable.inputRow;
|
|
3548
3725
|
}
|
|
3549
3726
|
oldChatDocument = latest.messageTable.chatDocument;
|
|
3550
|
-
|
|
3727
|
+
_context11.next = 6;
|
|
3551
3728
|
return appendCurrentMessages();
|
|
3552
3729
|
case 6:
|
|
3553
3730
|
// Adding a link in the document will ping listeners to add the new block too
|
|
@@ -3561,286 +3738,350 @@ function _infiniteMessageArea() {
|
|
|
3561
3738
|
}
|
|
3562
3739
|
case 7:
|
|
3563
3740
|
case "end":
|
|
3564
|
-
return
|
|
3741
|
+
return _context11.stop();
|
|
3565
3742
|
}
|
|
3566
|
-
},
|
|
3743
|
+
}, _callee11);
|
|
3567
3744
|
}));
|
|
3568
3745
|
return _addNewChatDocumentIfNewDay.apply(this, arguments);
|
|
3569
3746
|
};
|
|
3570
3747
|
addNewChatDocumentIfNewDay = function _addNewChatDocumentIf() {
|
|
3571
3748
|
return _addNewChatDocumentIfNewDay.apply(this, arguments);
|
|
3572
3749
|
};
|
|
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
|
-
|
|
3750
|
+
_renderMessageTable = function _renderMessageTable3() {
|
|
3751
|
+
_renderMessageTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(date, live) {
|
|
3752
|
+
var scrollBackbutton, scrollForwardButton, extendBackwards, _extendBackwards, setScrollBackbuttonIcon, scrollBackbuttonHandler, _scrollBackbuttonHandler, extendForwards, _extendForwards, setScrollForwardButtonIcon, scrollForwardButtonHandler, _scrollForwardButtonHandler, messageTable, chatDocument, tr, test, titleTR, scrollBackbuttonCell, dateCell, scrollForwardButtonCell, sts, _iterator2, _step2, st;
|
|
3753
|
+
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
|
3754
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
3755
|
+
case 0:
|
|
3756
|
+
_scrollForwardButtonHandler = function _scrollForwardButtonH2() {
|
|
3757
|
+
_scrollForwardButtonHandler = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(_event) {
|
|
3758
|
+
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
|
3759
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
3760
|
+
case 0:
|
|
3761
|
+
if (!messageTable.extendedForwards) {
|
|
3762
|
+
_context9.next = 6;
|
|
3763
|
+
break;
|
|
3764
|
+
}
|
|
3765
|
+
removePreviousMessages(false, messageTable);
|
|
3766
|
+
messageTable.extendedForwards = false;
|
|
3767
|
+
setScrollForwardButtonIcon();
|
|
3768
|
+
_context9.next = 9;
|
|
3769
|
+
break;
|
|
3770
|
+
case 6:
|
|
3771
|
+
_context9.next = 8;
|
|
3772
|
+
return extendForwards();
|
|
3773
|
+
case 8:
|
|
3774
|
+
// async
|
|
3775
|
+
latest.messageTable.scrollIntoView(newestFirst);
|
|
3776
|
+
case 9:
|
|
3777
|
+
case "end":
|
|
3778
|
+
return _context9.stop();
|
|
3779
|
+
}
|
|
3780
|
+
}, _callee9);
|
|
3781
|
+
}));
|
|
3782
|
+
return _scrollForwardButtonHandler.apply(this, arguments);
|
|
3783
|
+
};
|
|
3784
|
+
scrollForwardButtonHandler = function _scrollForwardButtonH(_x23) {
|
|
3785
|
+
return _scrollForwardButtonHandler.apply(this, arguments);
|
|
3786
|
+
};
|
|
3787
|
+
setScrollForwardButtonIcon = function _setScrollForwardButt() {
|
|
3788
|
+
if (!scrollForwardButton) return;
|
|
3789
|
+
var sense = messageTable.extendedForwards ? !newestFirst : newestFirst; // noun_T-Block_1114657_000000.svg
|
|
3790
|
+
var scrollForwardIcon = messageTable["final"] ? 'noun_T-Block_1114657_000000.svg' : getScrollForwardButtonIcon(sense);
|
|
3791
|
+
scrollForwardButton.firstChild.setAttribute('src', _iconBase.icons.iconBase + scrollForwardIcon);
|
|
3792
|
+
function getScrollForwardButtonIcon(sense) {
|
|
3793
|
+
return !sense ? 'noun_1369241.svg' : 'noun_1369237.svg';
|
|
3599
3794
|
}
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3795
|
+
};
|
|
3796
|
+
_extendForwards = function _extendForwards3() {
|
|
3797
|
+
_extendForwards = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
|
|
3798
|
+
var done;
|
|
3799
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
3800
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
3801
|
+
case 0:
|
|
3802
|
+
_context8.next = 2;
|
|
3803
|
+
return insertPreviousMessages(false);
|
|
3804
|
+
case 2:
|
|
3805
|
+
done = _context8.sent;
|
|
3806
|
+
return _context8.abrupt("return", done);
|
|
3807
|
+
case 4:
|
|
3808
|
+
case "end":
|
|
3809
|
+
return _context8.stop();
|
|
3810
|
+
}
|
|
3811
|
+
}, _callee8);
|
|
3812
|
+
}));
|
|
3813
|
+
return _extendForwards.apply(this, arguments);
|
|
3814
|
+
};
|
|
3815
|
+
extendForwards = function _extendForwards2() {
|
|
3816
|
+
return _extendForwards.apply(this, arguments);
|
|
3817
|
+
};
|
|
3818
|
+
_scrollBackbuttonHandler = function _scrollBackbuttonHand2() {
|
|
3819
|
+
_scrollBackbuttonHandler = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(_event) {
|
|
3820
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
3821
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
3822
|
+
case 0:
|
|
3823
|
+
if (!messageTable.extendedBack) {
|
|
3824
|
+
_context7.next = 6;
|
|
3825
|
+
break;
|
|
3826
|
+
}
|
|
3827
|
+
removePreviousMessages(true, messageTable);
|
|
3828
|
+
messageTable.extendedBack = false;
|
|
3829
|
+
setScrollBackbuttonIcon();
|
|
3830
|
+
_context7.next = 8;
|
|
3831
|
+
break;
|
|
3832
|
+
case 6:
|
|
3833
|
+
_context7.next = 8;
|
|
3834
|
+
return extendBackwards();
|
|
3835
|
+
case 8:
|
|
3836
|
+
case "end":
|
|
3837
|
+
return _context7.stop();
|
|
3838
|
+
}
|
|
3839
|
+
}, _callee7);
|
|
3840
|
+
}));
|
|
3841
|
+
return _scrollBackbuttonHandler.apply(this, arguments);
|
|
3842
|
+
};
|
|
3843
|
+
scrollBackbuttonHandler = function _scrollBackbuttonHand(_x22) {
|
|
3844
|
+
return _scrollBackbuttonHandler.apply(this, arguments);
|
|
3845
|
+
};
|
|
3846
|
+
setScrollBackbuttonIcon = function _setScrollBackbuttonI() {
|
|
3847
|
+
if (!scrollBackbutton) {
|
|
3848
|
+
return;
|
|
3632
3849
|
}
|
|
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
|
-
|
|
3850
|
+
var sense = messageTable.extendedBack ? !newestFirst : newestFirst;
|
|
3851
|
+
var scrollBackIcon = messageTable.initial ? 'noun_T-Block_1114655_000000.svg' : getScrollbackIcon(sense);
|
|
3852
|
+
scrollBackbutton.firstChild.setAttribute('src', _iconBase.icons.iconBase + scrollBackIcon);
|
|
3853
|
+
function getScrollbackIcon(sense) {
|
|
3854
|
+
return sense ? 'noun_1369241.svg' : 'noun_1369237.svg';
|
|
3855
|
+
}
|
|
3856
|
+
};
|
|
3857
|
+
_extendBackwards = function _extendBackwards3() {
|
|
3858
|
+
_extendBackwards = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
|
|
3859
|
+
var done;
|
|
3860
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
3861
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
3862
|
+
case 0:
|
|
3863
|
+
_context6.next = 2;
|
|
3864
|
+
return insertPreviousMessages(true);
|
|
3865
|
+
case 2:
|
|
3866
|
+
done = _context6.sent;
|
|
3867
|
+
if (done) {
|
|
3868
|
+
if (scrollBackbutton) {
|
|
3869
|
+
scrollBackbutton.firstChild.setAttribute('src', _iconBase.icons.iconBase + 'noun_T-Block_1114655_000000.svg'); // T
|
|
3870
|
+
scrollBackbutton.disabled = true;
|
|
3871
|
+
}
|
|
3872
|
+
messageTable.initial = true;
|
|
3873
|
+
} else {
|
|
3874
|
+
messageTable.extendedBack = true;
|
|
3875
|
+
}
|
|
3876
|
+
setScrollBackbuttonIcon();
|
|
3877
|
+
return _context6.abrupt("return", done);
|
|
3878
|
+
case 6:
|
|
3879
|
+
case "end":
|
|
3880
|
+
return _context6.stop();
|
|
3881
|
+
}
|
|
3882
|
+
}, _callee6);
|
|
3883
|
+
}));
|
|
3884
|
+
return _extendBackwards.apply(this, arguments);
|
|
3885
|
+
};
|
|
3886
|
+
extendBackwards = function _extendBackwards2() {
|
|
3887
|
+
return _extendBackwards.apply(this, arguments);
|
|
3888
|
+
};
|
|
3889
|
+
scrollBackbutton = null; // was let
|
|
3890
|
+
scrollForwardButton = null; // was let
|
|
3891
|
+
/// ///////////////// Scroll down adding more above
|
|
3892
|
+
/// ///////////////////////
|
|
3893
|
+
/*
|
|
3894
|
+
options = options || {}
|
|
3895
|
+
options.authorDateOnLeft = true
|
|
3896
|
+
const newestFirst = options.newestFirst === '1' || options.newestFirst === true // hack for now
|
|
3897
|
+
const channelObject = new ChatChannel(chatChannel, options)
|
|
3898
|
+
const dateFolder = channelObject.dateFolder
|
|
3899
|
+
const div = dom.createElement('div')
|
|
3900
|
+
const statusArea = div.appendChild(dom.createElement('div'))
|
|
3901
|
+
const userContext = { dom, statusArea, div: statusArea } // logged on state, pointers to user's stuff
|
|
3902
|
+
*/
|
|
3903
|
+
debug.log('Options for called message Area', options);
|
|
3904
|
+
messageTable = dom.createElement('table');
|
|
3905
|
+
messageTable.style.width = '100%'; // fill the pane div
|
|
3906
|
+
messageTable.extendBackwards = extendBackwards; // Make function available to scroll stuff
|
|
3907
|
+
messageTable.extendForwards = extendForwards; // Make function available to scroll stuff
|
|
3908
|
+
|
|
3909
|
+
messageTable.date = date;
|
|
3910
|
+
chatDocument = dateFolder.leafDocumentFromDate(date);
|
|
3911
|
+
messageTable.chatDocument = chatDocument;
|
|
3912
|
+
messageTable.fresh = false;
|
|
3913
|
+
messageTable.setAttribute('style', 'width: 100%;'); // fill that div!
|
|
3914
|
+
if (live) {
|
|
3915
|
+
messageTable["final"] = true;
|
|
3916
|
+
liveMessageTable = messageTable;
|
|
3917
|
+
latest.messageTable = messageTable;
|
|
3918
|
+
tr = (0, _message.renderMessageEditor)(channelObject, messageTable, userContext, options);
|
|
3919
|
+
if (newestFirst) {
|
|
3920
|
+
messageTable.insertBefore(tr, messageTable.firstChild); // If newestFirst
|
|
3666
3921
|
} else {
|
|
3667
|
-
messageTable.
|
|
3922
|
+
messageTable.appendChild(tr); // not newestFirst
|
|
3668
3923
|
}
|
|
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;
|
|
3924
|
+
|
|
3925
|
+
messageTable.inputRow = tr;
|
|
3926
|
+
}
|
|
3927
|
+
|
|
3928
|
+
/// ///// Infinite scroll
|
|
3929
|
+
//
|
|
3930
|
+
// @@ listen for swipe past end event not just button
|
|
3931
|
+
test = true;
|
|
3932
|
+
if (test) {
|
|
3933
|
+
// ws options.infinite but need for non-infinite
|
|
3934
|
+
titleTR = dom.createElement('tr');
|
|
3935
|
+
scrollBackbuttonCell = titleTR.appendChild(dom.createElement('td')); // up traingles: noun_1369237.svg
|
|
3936
|
+
// down triangles: noun_1369241.svg
|
|
3937
|
+
/*
|
|
3938
|
+
const scrollBackIcon = newestFirst
|
|
3939
|
+
? 'noun_1369241.svg'
|
|
3940
|
+
: 'noun_1369237.svg' // down and up arrows respoctively
|
|
3941
|
+
scrollBackbutton = widgets.button(
|
|
3942
|
+
dom,
|
|
3943
|
+
icons.iconBase + scrollBackIcon,
|
|
3944
|
+
'Previous messages ...'
|
|
3945
|
+
)
|
|
3946
|
+
scrollBackbuttonCell.style = 'width:3em; height:3em;'
|
|
3947
|
+
scrollBackbutton.addEventListener('click', scrollBackbuttonHandler, false)
|
|
3948
|
+
messageTable.extendedBack = false
|
|
3949
|
+
scrollBackbuttonCell.appendChild(scrollBackbutton)
|
|
3950
|
+
setScrollBackbuttonIcon()
|
|
3951
|
+
*/
|
|
3952
|
+
dateCell = titleTR.appendChild(dom.createElement('td'));
|
|
3953
|
+
dateCell.style = 'text-align: center; vertical-align: middle; color: #888; font-style: italic;';
|
|
3954
|
+
dateCell.textContent = widgets.shortDate(date.toISOString(), true); // no time, only date
|
|
3955
|
+
|
|
3956
|
+
// @@@@@@@@@@@ todo move this button to other end of message cell, o
|
|
3957
|
+
scrollForwardButtonCell = titleTR.appendChild(dom.createElement('td'));
|
|
3958
|
+
if (options.includeRemoveButton) {
|
|
3959
|
+
scrollForwardButtonCell.appendChild(widgets.cancelButton(dom, function (_e) {
|
|
3960
|
+
div.parentNode.removeChild(div);
|
|
3961
|
+
}));
|
|
3708
3962
|
}
|
|
3709
|
-
|
|
3963
|
+
/*
|
|
3964
|
+
const scrollForwardIcon = newestFirst
|
|
3965
|
+
? 'noun_1369241.svg'
|
|
3966
|
+
: 'noun_1369237.svg' // down and up arrows respoctively
|
|
3967
|
+
scrollForwardButton = widgets.button(
|
|
3968
|
+
dom,
|
|
3969
|
+
icons.iconBase + scrollForwardIcon,
|
|
3970
|
+
'Later messages ...'
|
|
3971
|
+
)
|
|
3972
|
+
scrollForwardButtonCell.appendChild(scrollForwardButton)
|
|
3973
|
+
scrollForwardButtonCell.style = 'width:3em; height:3em;'
|
|
3974
|
+
scrollForwardButton.addEventListener(
|
|
3975
|
+
'click',
|
|
3976
|
+
scrollForwardButtonHandler,
|
|
3977
|
+
false
|
|
3978
|
+
)
|
|
3979
|
+
messageTable.extendedForward = false
|
|
3980
|
+
setScrollForwardButtonIcon()
|
|
3981
|
+
*/
|
|
3710
3982
|
messageTable.extendedForwards = false;
|
|
3711
|
-
|
|
3712
|
-
|
|
3983
|
+
if (!newestFirst) {
|
|
3984
|
+
// opposite end from the entry field
|
|
3985
|
+
messageTable.insertBefore(titleTR, messageTable.firstChild); // If not newestFirst
|
|
3986
|
+
} else {
|
|
3987
|
+
messageTable.appendChild(titleTR); // newestFirst
|
|
3988
|
+
}
|
|
3989
|
+
}
|
|
3990
|
+
sts = _solidLogic.store.statementsMatching(null, ns.wf('message'), null, chatDocument);
|
|
3991
|
+
if (!live && sts.length === 0) {
|
|
3992
|
+
// not todays
|
|
3993
|
+
// no need buttomns at the moment
|
|
3994
|
+
// messageTable.style.visibility = 'collapse' // Hide files with no messages
|
|
3995
|
+
}
|
|
3996
|
+
_iterator2 = _createForOfIteratorHelper(sts);
|
|
3997
|
+
_context10.prev = 28;
|
|
3998
|
+
_iterator2.s();
|
|
3999
|
+
case 30:
|
|
4000
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
4001
|
+
_context10.next = 36;
|
|
3713
4002
|
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;
|
|
4003
|
+
}
|
|
4004
|
+
st = _step2.value;
|
|
4005
|
+
_context10.next = 34;
|
|
4006
|
+
return addMessage(st.object, messageTable);
|
|
4007
|
+
case 34:
|
|
4008
|
+
_context10.next = 30;
|
|
4009
|
+
break;
|
|
4010
|
+
case 36:
|
|
4011
|
+
_context10.next = 41;
|
|
4012
|
+
break;
|
|
4013
|
+
case 38:
|
|
4014
|
+
_context10.prev = 38;
|
|
4015
|
+
_context10.t0 = _context10["catch"](28);
|
|
4016
|
+
_iterator2.e(_context10.t0);
|
|
4017
|
+
case 41:
|
|
4018
|
+
_context10.prev = 41;
|
|
4019
|
+
_iterator2.f();
|
|
4020
|
+
return _context10.finish(41);
|
|
4021
|
+
case 44:
|
|
4022
|
+
messageTable.fresh = true;
|
|
4023
|
+
|
|
4024
|
+
// loadMessageTable(messageTable, chatDocument)
|
|
4025
|
+
messageTable.fresh = false;
|
|
4026
|
+
return _context10.abrupt("return", messageTable);
|
|
4027
|
+
case 47:
|
|
4028
|
+
case "end":
|
|
4029
|
+
return _context10.stop();
|
|
4030
|
+
}
|
|
4031
|
+
}, _callee10, null, [[28, 38, 41, 44]]);
|
|
4032
|
+
}));
|
|
4033
|
+
return _renderMessageTable.apply(this, arguments);
|
|
4034
|
+
};
|
|
4035
|
+
renderMessageTable = function _renderMessageTable2(_x18, _x19) {
|
|
4036
|
+
return _renderMessageTable.apply(this, arguments);
|
|
3802
4037
|
};
|
|
3803
4038
|
_createMessageTable = function _createMessageTable3() {
|
|
3804
|
-
_createMessageTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
4039
|
+
_createMessageTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(date, live) {
|
|
3805
4040
|
var chatDocument, messageTable, statusTR;
|
|
3806
|
-
return _regenerator["default"].wrap(function
|
|
3807
|
-
while (1) switch (
|
|
4041
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
4042
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
3808
4043
|
case 0:
|
|
3809
4044
|
debug.log(' createMessageTable for ' + date);
|
|
3810
4045
|
chatDocument = dateFolder.leafDocumentFromDate(date);
|
|
3811
|
-
|
|
3812
|
-
|
|
4046
|
+
_context5.prev = 2;
|
|
4047
|
+
_context5.next = 5;
|
|
3813
4048
|
return _solidLogic.store.fetcher.load(chatDocument);
|
|
3814
4049
|
case 5:
|
|
3815
|
-
|
|
4050
|
+
_context5.next = 21;
|
|
3816
4051
|
break;
|
|
3817
4052
|
case 7:
|
|
3818
|
-
|
|
3819
|
-
|
|
4053
|
+
_context5.prev = 7;
|
|
4054
|
+
_context5.t0 = _context5["catch"](2);
|
|
3820
4055
|
messageTable = dom.createElement('table');
|
|
3821
4056
|
statusTR = messageTable.appendChild(dom.createElement('tr')); // ### find status in exception
|
|
3822
|
-
if (!(
|
|
3823
|
-
|
|
4057
|
+
if (!(_context5.t0.response && _context5.t0.response.status && _context5.t0.response.status === 404)) {
|
|
4058
|
+
_context5.next = 18;
|
|
3824
4059
|
break;
|
|
3825
4060
|
}
|
|
3826
4061
|
debug.log('Error 404 for chat file ' + chatDocument);
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
4062
|
+
_context5.next = 15;
|
|
4063
|
+
return renderMessageTable(date, live);
|
|
4064
|
+
case 15:
|
|
4065
|
+
return _context5.abrupt("return", _context5.sent);
|
|
3831
4066
|
case 18:
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
return _context6.abrupt("return", renderMessageTable(date, live));
|
|
4067
|
+
debug.log('*** Error NON 404 for chat file ' + chatDocument);
|
|
4068
|
+
statusTR.appendChild(widgets.errorMessageBlock(dom, _context5.t0, 'pink'));
|
|
3835
4069
|
case 20:
|
|
4070
|
+
return _context5.abrupt("return", statusTR);
|
|
4071
|
+
case 21:
|
|
4072
|
+
_context5.next = 23;
|
|
4073
|
+
return renderMessageTable(date, live);
|
|
4074
|
+
case 23:
|
|
4075
|
+
return _context5.abrupt("return", _context5.sent);
|
|
4076
|
+
case 24:
|
|
3836
4077
|
case "end":
|
|
3837
|
-
return
|
|
4078
|
+
return _context5.stop();
|
|
3838
4079
|
}
|
|
3839
|
-
},
|
|
4080
|
+
}, _callee5, null, [[2, 7]]);
|
|
3840
4081
|
}));
|
|
3841
4082
|
return _createMessageTable.apply(this, arguments);
|
|
3842
4083
|
};
|
|
3843
|
-
createMessageTable = function _createMessageTable2(
|
|
4084
|
+
createMessageTable = function _createMessageTable2(_x16, _x17) {
|
|
3844
4085
|
return _createMessageTable.apply(this, arguments);
|
|
3845
4086
|
};
|
|
3846
4087
|
removePreviousMessages = function _removePreviousMessag(backwards, messageTable) {
|
|
@@ -3859,31 +4100,31 @@ function _infiniteMessageArea() {
|
|
|
3859
4100
|
extr.messageTable = messageTable;
|
|
3860
4101
|
};
|
|
3861
4102
|
_insertPreviousMessages = function _insertPreviousMessag2() {
|
|
3862
|
-
_insertPreviousMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
4103
|
+
_insertPreviousMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(backwards) {
|
|
3863
4104
|
var extremity, date, live, todayDoc, doc, newMessageTable;
|
|
3864
|
-
return _regenerator["default"].wrap(function
|
|
3865
|
-
while (1) switch (
|
|
4105
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
4106
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
3866
4107
|
case 0:
|
|
3867
4108
|
extremity = backwards ? earliest : latest;
|
|
3868
4109
|
date = extremity.messageTable.date; // day in mssecs
|
|
3869
|
-
|
|
4110
|
+
_context4.next = 4;
|
|
3870
4111
|
return dateFolder.loadPrevious(date, backwards);
|
|
3871
4112
|
case 4:
|
|
3872
|
-
date =
|
|
4113
|
+
date = _context4.sent;
|
|
3873
4114
|
// backwards
|
|
3874
4115
|
debug.log("insertPreviousMessages: from ".concat(backwards ? 'backwards' : 'forwards', " loadPrevious: ").concat(date));
|
|
3875
4116
|
if (!(!date && !backwards && !liveMessageTable)) {
|
|
3876
|
-
|
|
4117
|
+
_context4.next = 9;
|
|
3877
4118
|
break;
|
|
3878
4119
|
}
|
|
3879
|
-
|
|
4120
|
+
_context4.next = 9;
|
|
3880
4121
|
return appendCurrentMessages();
|
|
3881
4122
|
case 9:
|
|
3882
4123
|
if (date) {
|
|
3883
|
-
|
|
4124
|
+
_context4.next = 11;
|
|
3884
4125
|
break;
|
|
3885
4126
|
}
|
|
3886
|
-
return
|
|
4127
|
+
return _context4.abrupt("return", true);
|
|
3887
4128
|
case 11:
|
|
3888
4129
|
// done
|
|
3889
4130
|
live = false;
|
|
@@ -3892,10 +4133,10 @@ function _infiniteMessageArea() {
|
|
|
3892
4133
|
doc = dateFolder.leafDocumentFromDate(date);
|
|
3893
4134
|
live = doc.sameTerm(todayDoc); // Is this todays?
|
|
3894
4135
|
}
|
|
3895
|
-
|
|
4136
|
+
_context4.next = 15;
|
|
3896
4137
|
return createMessageTable(date, live);
|
|
3897
4138
|
case 15:
|
|
3898
|
-
newMessageTable =
|
|
4139
|
+
newMessageTable = _context4.sent;
|
|
3899
4140
|
extremity.messageTable = newMessageTable; // move pointer to earliest
|
|
3900
4141
|
if (backwards ? newestFirst : !newestFirst) {
|
|
3901
4142
|
// put on bottom or top
|
|
@@ -3904,62 +4145,158 @@ function _infiniteMessageArea() {
|
|
|
3904
4145
|
// put on top as we scroll back
|
|
3905
4146
|
div.insertBefore(newMessageTable, div.firstChild);
|
|
3906
4147
|
}
|
|
3907
|
-
return
|
|
4148
|
+
return _context4.abrupt("return", live);
|
|
3908
4149
|
case 19:
|
|
3909
4150
|
case "end":
|
|
3910
|
-
return
|
|
4151
|
+
return _context4.stop();
|
|
3911
4152
|
}
|
|
3912
|
-
},
|
|
4153
|
+
}, _callee4);
|
|
3913
4154
|
}));
|
|
3914
4155
|
return _insertPreviousMessages.apply(this, arguments);
|
|
3915
4156
|
};
|
|
3916
|
-
insertPreviousMessages = function _insertPreviousMessag(
|
|
4157
|
+
insertPreviousMessages = function _insertPreviousMessag(_x15) {
|
|
3917
4158
|
return _insertPreviousMessages.apply(this, arguments);
|
|
3918
4159
|
};
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
4160
|
+
_addMessage = function _addMessage3() {
|
|
4161
|
+
_addMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(message, messageTable) {
|
|
4162
|
+
var latest, thread, id;
|
|
4163
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
4164
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
4165
|
+
case 0:
|
|
4166
|
+
_context3.next = 2;
|
|
4167
|
+
return (0, _chatLogic.mostRecentVersion)(message);
|
|
4168
|
+
case 2:
|
|
4169
|
+
latest = _context3.sent;
|
|
4170
|
+
if (!((0, _chatLogic.isDeleted)(latest) && !options.showDeletedMessages)) {
|
|
4171
|
+
_context3.next = 5;
|
|
4172
|
+
break;
|
|
4173
|
+
}
|
|
4174
|
+
return _context3.abrupt("return");
|
|
4175
|
+
case 5:
|
|
4176
|
+
thread = _solidLogic.store.any(null, ns.sioc('has_member'), message, message.doc());
|
|
4177
|
+
id = _solidLogic.store.any(message, ns.sioc('id'), null, message.doc());
|
|
4178
|
+
if (id && !thread) {
|
|
4179
|
+
thread = _solidLogic.store.any(null, ns.sioc('has_member'), id, message.doc());
|
|
4180
|
+
}
|
|
4181
|
+
if (!options.thread) {
|
|
4182
|
+
_context3.next = 21;
|
|
4183
|
+
break;
|
|
4184
|
+
}
|
|
4185
|
+
if (!_solidLogic.store.holds(message, ns.sioc('has_reply'), options.thread)) {
|
|
4186
|
+
_context3.next = 13;
|
|
4187
|
+
break;
|
|
4188
|
+
}
|
|
4189
|
+
// root of thread
|
|
4190
|
+
debug.log(' addMessage: displaying root of thread ' + thread);
|
|
4191
|
+
_context3.next = 19;
|
|
4192
|
+
break;
|
|
4193
|
+
case 13:
|
|
4194
|
+
if (!(thread && thread.sameTerm(options.thread))) {
|
|
4195
|
+
_context3.next = 17;
|
|
4196
|
+
break;
|
|
4197
|
+
}
|
|
4198
|
+
debug.log(' addMessage: Displaying body of thread ' + message.uri.slice(-10));
|
|
4199
|
+
_context3.next = 19;
|
|
4200
|
+
break;
|
|
4201
|
+
case 17:
|
|
4202
|
+
debug.log(' addMessage: Suppress non-thread message in thread table ' + message.uri.slice(-10));
|
|
4203
|
+
return _context3.abrupt("return");
|
|
4204
|
+
case 19:
|
|
4205
|
+
_context3.next = 27;
|
|
4206
|
+
break;
|
|
4207
|
+
case 21:
|
|
4208
|
+
if (!thread) {
|
|
4209
|
+
_context3.next = 26;
|
|
4210
|
+
break;
|
|
4211
|
+
}
|
|
4212
|
+
debug.log(' addMessage: Suppress thread message in non-thread table ' + message.uri.slice(-10));
|
|
4213
|
+
return _context3.abrupt("return");
|
|
4214
|
+
case 26:
|
|
4215
|
+
debug.log(' addMessage: Normal non-thread message in non-thread table ' + message.uri.slice(-10));
|
|
4216
|
+
case 27:
|
|
4217
|
+
_context3.next = 29;
|
|
4218
|
+
return insertMessageIntoTable(channelObject, messageTable, message, messageTable.fresh, options, userContext);
|
|
4219
|
+
case 29:
|
|
4220
|
+
case "end":
|
|
4221
|
+
return _context3.stop();
|
|
4222
|
+
}
|
|
4223
|
+
}, _callee3);
|
|
4224
|
+
}));
|
|
4225
|
+
return _addMessage.apply(this, arguments);
|
|
3927
4226
|
};
|
|
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
|
-
|
|
4227
|
+
addMessage = function _addMessage2(_x13, _x14) {
|
|
4228
|
+
return _addMessage.apply(this, arguments);
|
|
4229
|
+
};
|
|
4230
|
+
_syncMessages = function _syncMessages3() {
|
|
4231
|
+
_syncMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(chatChannel, messageTable) {
|
|
4232
|
+
var displayed, ele, ele2, messages, stored, _iterator, _step, m;
|
|
4233
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
4234
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
4235
|
+
case 0:
|
|
4236
|
+
displayed = {};
|
|
4237
|
+
for (ele = messageTable.firstChild; ele; ele = ele.nextSibling) {
|
|
4238
|
+
if (ele.AJAR_subject) {
|
|
4239
|
+
displayed[ele.AJAR_subject.uri] = true;
|
|
4240
|
+
}
|
|
4241
|
+
}
|
|
4242
|
+
messages = _solidLogic.store.each(chatChannel, ns.wf('message'), null, messageTable.chatDocument);
|
|
4243
|
+
stored = {};
|
|
4244
|
+
_iterator = _createForOfIteratorHelper(messages);
|
|
4245
|
+
_context2.prev = 5;
|
|
4246
|
+
_iterator.s();
|
|
4247
|
+
case 7:
|
|
4248
|
+
if ((_step = _iterator.n()).done) {
|
|
4249
|
+
_context2.next = 15;
|
|
4250
|
+
break;
|
|
4251
|
+
}
|
|
4252
|
+
m = _step.value;
|
|
4253
|
+
stored[m.uri] = true;
|
|
4254
|
+
if (displayed[m.uri]) {
|
|
4255
|
+
_context2.next = 13;
|
|
4256
|
+
break;
|
|
4257
|
+
}
|
|
4258
|
+
_context2.next = 13;
|
|
4259
|
+
return addMessage(m, messageTable);
|
|
4260
|
+
case 13:
|
|
4261
|
+
_context2.next = 7;
|
|
4262
|
+
break;
|
|
4263
|
+
case 15:
|
|
4264
|
+
_context2.next = 20;
|
|
4265
|
+
break;
|
|
4266
|
+
case 17:
|
|
4267
|
+
_context2.prev = 17;
|
|
4268
|
+
_context2.t0 = _context2["catch"](5);
|
|
4269
|
+
_iterator.e(_context2.t0);
|
|
4270
|
+
case 20:
|
|
4271
|
+
_context2.prev = 20;
|
|
4272
|
+
_iterator.f();
|
|
4273
|
+
return _context2.finish(20);
|
|
4274
|
+
case 23:
|
|
4275
|
+
// eslint-disable-next-line space-in-parens
|
|
4276
|
+
for (ele = messageTable.firstChild; ele;) {
|
|
4277
|
+
ele2 = ele.nextSibling;
|
|
4278
|
+
if (ele.AJAR_subject && !stored[ele.AJAR_subject.uri]) {
|
|
4279
|
+
messageTable.removeChild(ele);
|
|
4280
|
+
}
|
|
4281
|
+
ele = ele2;
|
|
4282
|
+
}
|
|
4283
|
+
for (ele = messageTable.firstChild; ele; ele = ele.nextSibling) {
|
|
4284
|
+
if (ele.AJAR_subject) {
|
|
4285
|
+
// Refresh thumbs up etc
|
|
4286
|
+
widgets.refreshTree(ele); // Things inside may have changed too
|
|
4287
|
+
}
|
|
4288
|
+
}
|
|
4289
|
+
case 25:
|
|
4290
|
+
case "end":
|
|
4291
|
+
return _context2.stop();
|
|
4292
|
+
}
|
|
4293
|
+
}, _callee2, null, [[5, 17, 20, 23]]);
|
|
4294
|
+
}));
|
|
4295
|
+
return _syncMessages.apply(this, arguments);
|
|
4296
|
+
};
|
|
4297
|
+
syncMessages = function _syncMessages2(_x11, _x12) {
|
|
4298
|
+
return _syncMessages.apply(this, arguments);
|
|
3961
4299
|
};
|
|
3962
|
-
|
|
3963
4300
|
// Body of main function
|
|
3964
4301
|
|
|
3965
4302
|
options = options || {};
|
|
@@ -3975,7 +4312,6 @@ function _infiniteMessageArea() {
|
|
|
3975
4312
|
statusArea: statusArea,
|
|
3976
4313
|
div: statusArea
|
|
3977
4314
|
}; // logged on state, pointers to user's stuff
|
|
3978
|
-
// const messageTable = dom.createElement('table') // @@ check does this go in renderMessageTable
|
|
3979
4315
|
earliest = {
|
|
3980
4316
|
messageTable: null
|
|
3981
4317
|
}; // Stuff about each end of the loaded days
|
|
@@ -3983,15 +4319,15 @@ function _infiniteMessageArea() {
|
|
|
3983
4319
|
messageTable: null
|
|
3984
4320
|
};
|
|
3985
4321
|
lock = false;
|
|
3986
|
-
|
|
4322
|
+
_context16.next = 33;
|
|
3987
4323
|
return loadInitialContent();
|
|
3988
|
-
case
|
|
3989
|
-
return
|
|
3990
|
-
case
|
|
4324
|
+
case 33:
|
|
4325
|
+
return _context16.abrupt("return", div);
|
|
4326
|
+
case 34:
|
|
3991
4327
|
case "end":
|
|
3992
|
-
return
|
|
4328
|
+
return _context16.stop();
|
|
3993
4329
|
}
|
|
3994
|
-
},
|
|
4330
|
+
}, _callee16);
|
|
3995
4331
|
}));
|
|
3996
4332
|
return _infiniteMessageArea.apply(this, arguments);
|
|
3997
4333
|
}
|
|
@@ -4020,6 +4356,7 @@ exports.renderMessageEditor = renderMessageEditor;
|
|
|
4020
4356
|
exports.renderMessageRow = renderMessageRow;
|
|
4021
4357
|
exports.switchToEditor = switchToEditor;
|
|
4022
4358
|
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
|
|
4359
|
+
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js"));
|
|
4023
4360
|
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
4024
4361
|
var _infinite = __webpack_require__(/*! ./infinite */ "./lib/chat/infinite.js");
|
|
4025
4362
|
var _messageTools = __webpack_require__(/*! ./messageTools */ "./lib/chat/messageTools.js");
|
|
@@ -4037,7 +4374,9 @@ var utils = _interopRequireWildcard(__webpack_require__(/*! ../utils */ "./lib/u
|
|
|
4037
4374
|
var widgets = _interopRequireWildcard(__webpack_require__(/*! ../widgets */ "./lib/widgets/index.js"));
|
|
4038
4375
|
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
4376
|
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
|
|
4377
|
+
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; }
|
|
4378
|
+
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; }
|
|
4379
|
+
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
4380
|
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
4381
|
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
4382
|
var dom = window.document;
|
|
@@ -4116,122 +4455,232 @@ function creatorAndDateHorizontal(td1, creator, date, message) {
|
|
|
4116
4455
|
/**
|
|
4117
4456
|
* Renders a chat message, read-only mode
|
|
4118
4457
|
*/
|
|
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
|
-
|
|
4458
|
+
function renderMessageRow(_x, _x2, _x3, _x4, _x5) {
|
|
4459
|
+
return _renderMessageRow.apply(this, arguments);
|
|
4460
|
+
}
|
|
4461
|
+
function _renderMessageRow() {
|
|
4462
|
+
_renderMessageRow = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(channelObject, message, fresh, options, userContext) {
|
|
4463
|
+
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;
|
|
4464
|
+
return _regenerator["default"].wrap(function _callee9$(_context10) {
|
|
4465
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
4466
|
+
case 0:
|
|
4467
|
+
getBgColor = function _getBgColor(fresh) {
|
|
4468
|
+
return fresh ? '#e8ffe8' : 'white';
|
|
4469
|
+
};
|
|
4470
|
+
colorizeByAuthor = options.colorizeByAuthor === '1' || options.colorizeByAuthor === true;
|
|
4471
|
+
creator = _solidLogic.store.any(message, ns.foaf('maker'));
|
|
4472
|
+
date = _solidLogic.store.any(message, ns.dct('created'));
|
|
4473
|
+
_context10.next = 6;
|
|
4474
|
+
return (0, _chatLogic.mostRecentVersion)(message);
|
|
4475
|
+
case 6:
|
|
4476
|
+
latestVersion = _context10.sent;
|
|
4477
|
+
content = _solidLogic.store.any(latestVersion, ns.sioc('content')); // const id = store.any(latestVersion, ns.sioc('id'))
|
|
4478
|
+
// const replies = store.each(latestVersion, ns.sioc('has_reply'))
|
|
4479
|
+
_context10.next = 10;
|
|
4480
|
+
return (0, _chatLogic.allVersions)(message);
|
|
4481
|
+
case 10:
|
|
4482
|
+
versions = _context10.sent;
|
|
4483
|
+
if (versions.length > 1) {
|
|
4484
|
+
debug.log('renderMessageRow versions: ', versions.join(', '));
|
|
4485
|
+
}
|
|
4486
|
+
// be tolerant in accepting replies on any version of a message
|
|
4487
|
+
replies = versions.map(function (version) {
|
|
4488
|
+
return _solidLogic.store.each(version, ns.sioc('has_reply'));
|
|
4489
|
+
}).flat();
|
|
4490
|
+
thread = null;
|
|
4491
|
+
straightReplies = [];
|
|
4492
|
+
_iterator2 = _createForOfIteratorHelper(replies);
|
|
4493
|
+
try {
|
|
4494
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
4495
|
+
reply = _step2.value;
|
|
4496
|
+
if (_solidLogic.store.holds(reply, ns.rdf('type'), ns.sioc('Thread'))) {
|
|
4497
|
+
thread = reply;
|
|
4498
|
+
debug.log('renderMessageRow: found thread: ' + thread);
|
|
4499
|
+
} else {
|
|
4500
|
+
straightReplies.push(reply);
|
|
4501
|
+
}
|
|
4502
|
+
}
|
|
4503
|
+
} catch (err) {
|
|
4504
|
+
_iterator2.e(err);
|
|
4505
|
+
} finally {
|
|
4506
|
+
_iterator2.f();
|
|
4507
|
+
}
|
|
4508
|
+
if (straightReplies.length > 1) {
|
|
4509
|
+
debug.log('renderMessageRow: found normal replies: ', straightReplies);
|
|
4510
|
+
}
|
|
4511
|
+
_context10.next = 20;
|
|
4512
|
+
return (0, _chatLogic.originalVersion)(message);
|
|
4513
|
+
case 20:
|
|
4514
|
+
originalMessage = _context10.sent;
|
|
4515
|
+
edited = !message.sameTerm(originalMessage); // @@ load it first @@ Or display the new data at the old date.
|
|
4516
|
+
// @@@ kludge!
|
|
4517
|
+
sortDate = _solidLogic.store.the(originalMessage, ns.dct('created'), null, originalMessage.doc()) || _solidLogic.store.the(message, ns.dct('created'), null, message.doc()); // In message
|
|
4518
|
+
messageRow = dom.createElement('tr');
|
|
4519
|
+
messageRow.AJAR_date = sortDate.value;
|
|
4520
|
+
messageRow.AJAR_subject = message;
|
|
4521
|
+
td1 = dom.createElement('td');
|
|
4522
|
+
messageRow.appendChild(td1);
|
|
4523
|
+
if (!options.authorDateOnLeft) {
|
|
4524
|
+
img = dom.createElement('img');
|
|
4525
|
+
img.setAttribute('style', 'max-height: 2.5em; max-width: 2.5em; border-radius: 0.5em; margin: auto;');
|
|
4526
|
+
widgets.setImage(img, creator);
|
|
4527
|
+
td1.appendChild(img);
|
|
4528
|
+
} else {
|
|
4529
|
+
creatorAndDate(td1, creator, widgets.shortDate(sortDate.value), message);
|
|
4530
|
+
}
|
|
4531
|
+
bothDates = widgets.shortDate(sortDate.value);
|
|
4532
|
+
if (edited) {
|
|
4533
|
+
bothDates += ' ... ' + widgets.shortDate(date.value);
|
|
4534
|
+
}
|
|
4535
|
+
|
|
4536
|
+
// Render the content ot the message itself
|
|
4537
|
+
td2 = messageRow.appendChild(dom.createElement('td'));
|
|
4538
|
+
if (!options.authorDateOnLeft) {
|
|
4539
|
+
creatorAndDateHorizontal(td2, creator, bothDates,
|
|
4540
|
+
// widgets.shortDate(dateString)
|
|
4541
|
+
message);
|
|
4542
|
+
}
|
|
4543
|
+
text = content ? content.value.trim() : '??? no content?';
|
|
4544
|
+
isURI = /^https?:\/[^ <>]*$/i.test(text);
|
|
4545
|
+
para = null;
|
|
4546
|
+
if (isURI) {
|
|
4547
|
+
isImage = /\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(text); // @@ Should use content-type not URI
|
|
4548
|
+
if (isImage && options.expandImagesInline) {
|
|
4549
|
+
_img = elementForImageURI(text, options);
|
|
4550
|
+
td2.appendChild(_img);
|
|
4551
|
+
} else {
|
|
4552
|
+
// Link but not Image
|
|
4553
|
+
anc = td2.appendChild(dom.createElement('a'));
|
|
4554
|
+
para = anc.appendChild(dom.createElement('p'));
|
|
4555
|
+
anc.href = text;
|
|
4556
|
+
para.textContent = text;
|
|
4557
|
+
td2.appendChild(anc);
|
|
4558
|
+
}
|
|
4559
|
+
} else {
|
|
4560
|
+
// text
|
|
4561
|
+
para = dom.createElement('p');
|
|
4562
|
+
td2.appendChild(para);
|
|
4563
|
+
para.textContent = text;
|
|
4564
|
+
}
|
|
4565
|
+
if (para) {
|
|
4566
|
+
bgcolor = colorizeByAuthor ? pad.lightColorHash(creator) : getBgColor(fresh);
|
|
4567
|
+
para.setAttribute('style', messageBodyStyle + 'background-color: ' + bgcolor + ';');
|
|
4568
|
+
}
|
|
4569
|
+
_context10.next = 40;
|
|
4570
|
+
return (0, _messageTools.sentimentStripLinked)(message, message.doc());
|
|
4571
|
+
case 40:
|
|
4572
|
+
strip = _context10.sent;
|
|
4573
|
+
if (strip.children.length) {
|
|
4574
|
+
td2.appendChild(dom.createElement('br'));
|
|
4575
|
+
td2.appendChild(strip);
|
|
4576
|
+
}
|
|
4577
|
+
|
|
4578
|
+
// Message tool bar button
|
|
4579
|
+
td3 = dom.createElement('td');
|
|
4580
|
+
messageRow.appendChild(td3);
|
|
4581
|
+
toolsButton = widgets.button(dom, _iconBase.icons.iconBase + 'noun_243787.svg', '...');
|
|
4582
|
+
td3.appendChild(toolsButton);
|
|
4583
|
+
toolsButton.addEventListener('click', /*#__PURE__*/function () {
|
|
4584
|
+
var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(_event) {
|
|
4585
|
+
var toolsTR, tools, toolsTD;
|
|
4586
|
+
return _regenerator["default"].wrap(function _callee8$(_context9) {
|
|
4587
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
4588
|
+
case 0:
|
|
4589
|
+
if (!messageRow.toolTR) {
|
|
4590
|
+
_context9.next = 4;
|
|
4591
|
+
break;
|
|
4592
|
+
}
|
|
4593
|
+
// already got a toolbar? Toogle
|
|
4594
|
+
messageRow.parentNode.removeChild(messageRow.toolTR);
|
|
4595
|
+
delete messageRow.toolTR;
|
|
4596
|
+
return _context9.abrupt("return");
|
|
4597
|
+
case 4:
|
|
4598
|
+
toolsTR = dom.createElement('tr');
|
|
4599
|
+
_context9.next = 7;
|
|
4600
|
+
return (0, _messageTools.messageToolbar)(message, messageRow, _objectSpread(_objectSpread({}, userContext), {}, {
|
|
4601
|
+
chatOptions: options
|
|
4602
|
+
}), channelObject);
|
|
4603
|
+
case 7:
|
|
4604
|
+
tools = _context9.sent;
|
|
4605
|
+
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
|
|
4606
|
+
if (messageRow.nextSibling) {
|
|
4607
|
+
messageRow.parentElement.insertBefore(toolsTR, messageRow.nextSibling);
|
|
4608
|
+
} else {
|
|
4609
|
+
messageRow.parentElement.appendChild(toolsTR);
|
|
4610
|
+
}
|
|
4611
|
+
messageRow.toolTR = toolsTR;
|
|
4612
|
+
toolsTR.appendChild(dom.createElement('td')); // left
|
|
4613
|
+
toolsTD = toolsTR.appendChild(dom.createElement('td'));
|
|
4614
|
+
toolsTR.appendChild(dom.createElement('td')); // right
|
|
4615
|
+
toolsTD.appendChild(tools);
|
|
4616
|
+
case 15:
|
|
4617
|
+
case "end":
|
|
4618
|
+
return _context9.stop();
|
|
4619
|
+
}
|
|
4620
|
+
}, _callee8);
|
|
4621
|
+
}));
|
|
4622
|
+
return function (_x20) {
|
|
4623
|
+
return _ref4.apply(this, arguments);
|
|
4624
|
+
};
|
|
4625
|
+
}());
|
|
4626
|
+
if (thread && options.showThread) {
|
|
4627
|
+
debug.log(' message has thread ' + thread);
|
|
4628
|
+
td3.appendChild(widgets.button(dom, _iconBase.icons.iconBase + 'noun_1180164.svg',
|
|
4629
|
+
// right arrow .. @@ think of stg better
|
|
4630
|
+
'see thread', function (_e) {
|
|
4631
|
+
debug.log('@@@@ Calling showThread thread ' + thread);
|
|
4632
|
+
options.showThread(thread, options);
|
|
4633
|
+
}));
|
|
4634
|
+
}
|
|
4635
|
+
return _context10.abrupt("return", messageRow);
|
|
4636
|
+
case 49:
|
|
4637
|
+
case "end":
|
|
4638
|
+
return _context10.stop();
|
|
4639
|
+
}
|
|
4640
|
+
}, _callee9);
|
|
4641
|
+
}));
|
|
4642
|
+
return _renderMessageRow.apply(this, arguments);
|
|
4218
4643
|
}
|
|
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
|
|
4644
|
+
function switchToEditor(_x6, _x7, _x8, _x9) {
|
|
4645
|
+
return _switchToEditor.apply(this, arguments);
|
|
4225
4646
|
}
|
|
4226
4647
|
/* Control for a new message -- or editing an old message ***************
|
|
4227
4648
|
*
|
|
4228
4649
|
*/
|
|
4650
|
+
function _switchToEditor() {
|
|
4651
|
+
_switchToEditor = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(messageRow, message, channelObject, userContext) {
|
|
4652
|
+
var messageTable, editRow;
|
|
4653
|
+
return _regenerator["default"].wrap(function _callee10$(_context11) {
|
|
4654
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
4655
|
+
case 0:
|
|
4656
|
+
messageTable = messageRow.parentNode;
|
|
4657
|
+
_context11.t0 = renderMessageEditor;
|
|
4658
|
+
_context11.t1 = channelObject;
|
|
4659
|
+
_context11.t2 = messageTable;
|
|
4660
|
+
_context11.t3 = userContext;
|
|
4661
|
+
_context11.t4 = channelObject.options;
|
|
4662
|
+
_context11.next = 8;
|
|
4663
|
+
return (0, _chatLogic.mostRecentVersion)(message);
|
|
4664
|
+
case 8:
|
|
4665
|
+
_context11.t5 = _context11.sent;
|
|
4666
|
+
editRow = (0, _context11.t0)(_context11.t1, _context11.t2, _context11.t3, _context11.t4, _context11.t5);
|
|
4667
|
+
messageTable.insertBefore(editRow, messageRow);
|
|
4668
|
+
editRow.originalRow = messageRow;
|
|
4669
|
+
messageRow.style.visibility = 'hidden'; // Hide the original message. unhide if user cancels edit
|
|
4670
|
+
case 13:
|
|
4671
|
+
case "end":
|
|
4672
|
+
return _context11.stop();
|
|
4673
|
+
}
|
|
4674
|
+
}, _callee10);
|
|
4675
|
+
}));
|
|
4676
|
+
return _switchToEditor.apply(this, arguments);
|
|
4677
|
+
}
|
|
4229
4678
|
function renderMessageEditor(channelObject, messageTable, userContext, options, originalMessage) {
|
|
4230
4679
|
function revertEditing(messageEditor) {
|
|
4231
4680
|
messageEditor.originalRow.style.visibility = 'visible'; // restore read-only version
|
|
4232
4681
|
messageEditor.parentNode.removeChild(messageEditor);
|
|
4233
4682
|
}
|
|
4234
|
-
function handleFieldInput(
|
|
4683
|
+
function handleFieldInput(_x10) {
|
|
4235
4684
|
return _handleFieldInput.apply(this, arguments);
|
|
4236
4685
|
}
|
|
4237
4686
|
function _handleFieldInput() {
|
|
@@ -4249,72 +4698,87 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4249
4698
|
}));
|
|
4250
4699
|
return _handleFieldInput.apply(this, arguments);
|
|
4251
4700
|
}
|
|
4252
|
-
function sendMessage(
|
|
4701
|
+
function sendMessage(_x11, _x12) {
|
|
4253
4702
|
return _sendMessage.apply(this, arguments);
|
|
4254
4703
|
} // sendMessage
|
|
4255
4704
|
// DRAG AND DROP
|
|
4256
4705
|
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 (
|
|
4706
|
+
_sendMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(text, fromMainField) {
|
|
4707
|
+
var sendComplete, _sendComplete, message, statusArea;
|
|
4708
|
+
return _regenerator["default"].wrap(function _callee7$(_context8) {
|
|
4709
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
4261
4710
|
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
|
-
}
|
|
4711
|
+
_sendComplete = function _sendComplete3() {
|
|
4712
|
+
_sendComplete = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(message, _text2) {
|
|
4713
|
+
var oldRow;
|
|
4714
|
+
return _regenerator["default"].wrap(function _callee6$(_context7) {
|
|
4715
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
4716
|
+
case 0:
|
|
4717
|
+
_context7.next = 2;
|
|
4718
|
+
return (0, _infinite.insertMessageIntoTable)(channelObject, messageTable, message, false, options, userContext);
|
|
4719
|
+
case 2:
|
|
4720
|
+
// not green
|
|
4278
4721
|
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
}
|
|
4290
|
-
// await channelObject.div.refresh() // Add new day if nec @@ add back
|
|
4291
|
-
};
|
|
4722
|
+
if (originalMessage) {
|
|
4723
|
+
// editing another message
|
|
4724
|
+
oldRow = messageEditor.originalRow; // oldRow.style.display = '' // restore read-only version, re-attack
|
|
4725
|
+
if (oldRow.parentNode) {
|
|
4726
|
+
oldRow.parentNode.removeChild(oldRow); // No longer needed old version
|
|
4727
|
+
} else {
|
|
4728
|
+
debug.warn('No parentNode on old message ' + oldRow.textContent);
|
|
4729
|
+
oldRow.style.backgroundColor = '#fee';
|
|
4730
|
+
oldRow.style.visibility = 'hidden'; // @@ FIX THIS AND REMOVE FROM DOM INSTEAD
|
|
4731
|
+
}
|
|
4292
4732
|
|
|
4733
|
+
messageEditor.parentNode.removeChild(messageEditor); // no longer need editor
|
|
4734
|
+
} else {
|
|
4735
|
+
if (fromMainField) {
|
|
4736
|
+
field.value = ''; // clear from out for reuse
|
|
4737
|
+
field.setAttribute('style', messageBodyStyle);
|
|
4738
|
+
field.disabled = false;
|
|
4739
|
+
field.scrollIntoView(options.newestFirst); // allign bottom (top)
|
|
4740
|
+
field.focus(); // Start typing next line immediately
|
|
4741
|
+
field.select();
|
|
4742
|
+
}
|
|
4743
|
+
}
|
|
4744
|
+
// await channelObject.div.refresh() // Add new day if nec @@ add back
|
|
4745
|
+
case 3:
|
|
4746
|
+
case "end":
|
|
4747
|
+
return _context7.stop();
|
|
4748
|
+
}
|
|
4749
|
+
}, _callee6);
|
|
4750
|
+
}));
|
|
4751
|
+
return _sendComplete.apply(this, arguments);
|
|
4752
|
+
};
|
|
4753
|
+
sendComplete = function _sendComplete2(_x18, _x19) {
|
|
4754
|
+
return _sendComplete.apply(this, arguments);
|
|
4755
|
+
};
|
|
4293
4756
|
// const me = authn.currentUser() // Must be logged on or wuld have got login button
|
|
4294
4757
|
if (fromMainField) {
|
|
4295
4758
|
field.setAttribute('style', messageBodyStyle + 'color: #bbb;'); // pendingedit
|
|
4296
4759
|
field.disabled = true;
|
|
4297
4760
|
}
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
return channelObject.updateMessage(text, originalMessage);
|
|
4301
|
-
case
|
|
4302
|
-
message =
|
|
4303
|
-
|
|
4761
|
+
_context8.prev = 3;
|
|
4762
|
+
_context8.next = 6;
|
|
4763
|
+
return channelObject.updateMessage(text, originalMessage, null, options.thread);
|
|
4764
|
+
case 6:
|
|
4765
|
+
message = _context8.sent;
|
|
4766
|
+
_context8.next = 14;
|
|
4304
4767
|
break;
|
|
4305
|
-
case
|
|
4306
|
-
|
|
4307
|
-
|
|
4768
|
+
case 9:
|
|
4769
|
+
_context8.prev = 9;
|
|
4770
|
+
_context8.t0 = _context8["catch"](3);
|
|
4308
4771
|
statusArea = userContext.statusArea || messageEditor;
|
|
4309
|
-
statusArea.appendChild(widgets.errorMessageBlock(dom, 'Error writing message: ' +
|
|
4310
|
-
return
|
|
4311
|
-
case 13:
|
|
4312
|
-
sendComplete(message, text);
|
|
4772
|
+
statusArea.appendChild(widgets.errorMessageBlock(dom, 'Error writing message: ' + _context8.t0));
|
|
4773
|
+
return _context8.abrupt("return");
|
|
4313
4774
|
case 14:
|
|
4775
|
+
_context8.next = 16;
|
|
4776
|
+
return sendComplete(message, text);
|
|
4777
|
+
case 16:
|
|
4314
4778
|
case "end":
|
|
4315
|
-
return
|
|
4779
|
+
return _context8.stop();
|
|
4316
4780
|
}
|
|
4317
|
-
},
|
|
4781
|
+
}, _callee7, null, [[3, 9]]);
|
|
4318
4782
|
}));
|
|
4319
4783
|
return _sendMessage.apply(this, arguments);
|
|
4320
4784
|
}
|
|
@@ -4333,7 +4797,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4333
4797
|
}
|
|
4334
4798
|
}, _callee);
|
|
4335
4799
|
}));
|
|
4336
|
-
return function (
|
|
4800
|
+
return function (_x13, _x14) {
|
|
4337
4801
|
return _ref.apply(this, arguments);
|
|
4338
4802
|
};
|
|
4339
4803
|
}());
|
|
@@ -4377,7 +4841,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4377
4841
|
}
|
|
4378
4842
|
}, _callee2, null, [[1, 11, 14, 17]]);
|
|
4379
4843
|
}));
|
|
4380
|
-
return function droppedURIHandler(
|
|
4844
|
+
return function droppedURIHandler(_x15) {
|
|
4381
4845
|
return _ref2.apply(this, arguments);
|
|
4382
4846
|
};
|
|
4383
4847
|
}();
|
|
@@ -4388,7 +4852,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4388
4852
|
imageDoc = $rdf.sym(chatDocument.dir().uri + 'Image_' + Date.now() + '.png');
|
|
4389
4853
|
return imageDoc;
|
|
4390
4854
|
}
|
|
4391
|
-
function tookPicture(
|
|
4855
|
+
function tookPicture(_x16) {
|
|
4392
4856
|
return _tookPicture.apply(this, arguments);
|
|
4393
4857
|
} // Body of turnOnInput
|
|
4394
4858
|
function _tookPicture() {
|
|
@@ -4465,7 +4929,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4465
4929
|
}
|
|
4466
4930
|
}, _callee3);
|
|
4467
4931
|
}));
|
|
4468
|
-
return function (
|
|
4932
|
+
return function (_x17) {
|
|
4469
4933
|
return _ref3.apply(this, arguments);
|
|
4470
4934
|
};
|
|
4471
4935
|
}(), false);
|
|
@@ -4527,7 +4991,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4527
4991
|
turnOnInput();
|
|
4528
4992
|
Object.assign(context, userContext);
|
|
4529
4993
|
(0, _bookmarks.findBookmarkDocument)(context).then(function (_context) {
|
|
4530
|
-
//
|
|
4994
|
+
// debug.log('Bookmark file: ' + context.bookmarkDocument)
|
|
4531
4995
|
});
|
|
4532
4996
|
});
|
|
4533
4997
|
return messageEditor;
|
|
@@ -4554,8 +5018,8 @@ exports.messageToolbar = messageToolbar;
|
|
|
4554
5018
|
exports.sentimentStrip = sentimentStrip;
|
|
4555
5019
|
exports.sentimentStripLinked = sentimentStripLinked;
|
|
4556
5020
|
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
5021
|
var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "./node_modules/@babel/runtime/helpers/slicedToArray.js"));
|
|
5022
|
+
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
4559
5023
|
var debug = _interopRequireWildcard(__webpack_require__(/*! ../debug */ "./lib/debug.js"));
|
|
4560
5024
|
var _iconBase = __webpack_require__(/*! ../iconBase */ "./lib/iconBase.js");
|
|
4561
5025
|
var ns = _interopRequireWildcard(__webpack_require__(/*! ../ns */ "./lib/ns.js"));
|
|
@@ -4596,6 +5060,7 @@ var PENCIL_ICON = 'noun_253504.svg'; // edit a message
|
|
|
4596
5060
|
// const SPANNER_ICON = 'noun_344563.svg' -> settings
|
|
4597
5061
|
var THUMBS_UP_ICON = 'noun_1384132.svg';
|
|
4598
5062
|
var THUMBS_DOWN_ICON = 'noun_1384135.svg';
|
|
5063
|
+
var REPLY_ICON = 'noun-reply-5506924.svg';
|
|
4599
5064
|
/**
|
|
4600
5065
|
* Emoji in Unicode
|
|
4601
5066
|
*/
|
|
@@ -4608,18 +5073,8 @@ emoji[ns.schema('LikeAction')] = '❤️';
|
|
|
4608
5073
|
/**
|
|
4609
5074
|
* Create strip of sentiments expressed
|
|
4610
5075
|
*/
|
|
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(' '));
|
|
5076
|
+
function sentimentStrip(_x, _x2) {
|
|
5077
|
+
return _sentimentStrip.apply(this, arguments);
|
|
4623
5078
|
}
|
|
4624
5079
|
/**
|
|
4625
5080
|
* Create strip of sentiments expressed, with hyperlinks
|
|
@@ -4627,276 +5082,437 @@ function sentimentStrip(target, doc) {
|
|
|
4627
5082
|
* @param target {NamedNode} - The thing about which they are expressed
|
|
4628
5083
|
* @param doc {NamedNode} - The document in which they are expressed
|
|
4629
5084
|
*/
|
|
4630
|
-
function
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
5085
|
+
function _sentimentStrip() {
|
|
5086
|
+
_sentimentStrip = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(target, doc) {
|
|
5087
|
+
var latest, actions, sentiments, strings;
|
|
5088
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
5089
|
+
while (1) switch (_context.prev = _context.next) {
|
|
5090
|
+
case 0:
|
|
5091
|
+
_context.next = 2;
|
|
5092
|
+
return (0, _chatLogic.mostRecentVersion)(target);
|
|
5093
|
+
case 2:
|
|
5094
|
+
latest = _context.sent;
|
|
5095
|
+
actions = _solidLogic.store.holds(latest, ns.schema('dateDeleted').value, null, latest.doc()) ? _solidLogic.store.each(null, ns.schema('target'), target, doc) : [];
|
|
5096
|
+
sentiments = actions.map(function (a) {
|
|
5097
|
+
return _solidLogic.store.any(a, ns.rdf('type'), null, doc);
|
|
5098
|
+
});
|
|
5099
|
+
sentiments.sort();
|
|
5100
|
+
strings = sentiments.map(function (x) {
|
|
5101
|
+
return emoji[x] || '';
|
|
5102
|
+
});
|
|
5103
|
+
return _context.abrupt("return", dom.createTextNode(strings.join(' ')));
|
|
5104
|
+
case 8:
|
|
5105
|
+
case "end":
|
|
5106
|
+
return _context.stop();
|
|
4649
5107
|
}
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
return strip;
|
|
5108
|
+
}, _callee);
|
|
5109
|
+
}));
|
|
5110
|
+
return _sentimentStrip.apply(this, arguments);
|
|
5111
|
+
}
|
|
5112
|
+
function sentimentStripLinked(_x3, _x4) {
|
|
5113
|
+
return _sentimentStripLinked.apply(this, arguments);
|
|
4657
5114
|
}
|
|
4658
5115
|
/**
|
|
4659
5116
|
* Creates a message toolbar component
|
|
4660
5117
|
*/
|
|
4661
|
-
function
|
|
4662
|
-
function
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
5118
|
+
function _sentimentStripLinked() {
|
|
5119
|
+
_sentimentStripLinked = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(target, doc) {
|
|
5120
|
+
var strip, refresh, _refresh;
|
|
5121
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
5122
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
5123
|
+
case 0:
|
|
5124
|
+
_refresh = function _refresh3() {
|
|
5125
|
+
_refresh = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
5126
|
+
var actions, sentiments;
|
|
5127
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
5128
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
5129
|
+
case 0:
|
|
5130
|
+
strip.innerHTML = '';
|
|
5131
|
+
_context2.next = 3;
|
|
5132
|
+
return (0, _chatLogic.mostRecentVersion)(target).uri;
|
|
5133
|
+
case 3:
|
|
5134
|
+
_context2.t0 = _context2.sent;
|
|
5135
|
+
_context2.t1 = ns.schema('dateDeleted').uri;
|
|
5136
|
+
if (!(_context2.t0 !== _context2.t1)) {
|
|
5137
|
+
_context2.next = 9;
|
|
5138
|
+
break;
|
|
5139
|
+
}
|
|
5140
|
+
_context2.t2 = _solidLogic.store.each(null, ns.schema('target'), target, doc);
|
|
5141
|
+
_context2.next = 10;
|
|
5142
|
+
break;
|
|
5143
|
+
case 9:
|
|
5144
|
+
_context2.t2 = [];
|
|
5145
|
+
case 10:
|
|
5146
|
+
actions = _context2.t2;
|
|
5147
|
+
sentiments = actions.map(function (a) {
|
|
5148
|
+
return [_solidLogic.store.any(a, ns.rdf('type'), null, doc), _solidLogic.store.any(a, ns.schema('agent'), null, doc)];
|
|
5149
|
+
});
|
|
5150
|
+
sentiments.sort();
|
|
5151
|
+
sentiments.forEach(function (ss) {
|
|
5152
|
+
var _ss = (0, _slicedToArray2["default"])(ss, 2),
|
|
5153
|
+
theClass = _ss[0],
|
|
5154
|
+
agent = _ss[1];
|
|
5155
|
+
var res;
|
|
5156
|
+
if (agent) {
|
|
5157
|
+
res = dom.createElement('a');
|
|
5158
|
+
res.setAttribute('href', agent.uri);
|
|
5159
|
+
} else {
|
|
5160
|
+
res = dom.createTextNode('');
|
|
5161
|
+
}
|
|
5162
|
+
res.textContent = emoji[theClass] || '*';
|
|
5163
|
+
strip.appendChild(res);
|
|
5164
|
+
});
|
|
5165
|
+
case 14:
|
|
5166
|
+
case "end":
|
|
5167
|
+
return _context2.stop();
|
|
5168
|
+
}
|
|
5169
|
+
}, _callee2);
|
|
5170
|
+
}));
|
|
5171
|
+
return _refresh.apply(this, arguments);
|
|
5172
|
+
};
|
|
5173
|
+
refresh = function _refresh2() {
|
|
5174
|
+
return _refresh.apply(this, arguments);
|
|
5175
|
+
};
|
|
5176
|
+
strip = dom.createElement('span');
|
|
5177
|
+
refresh().then(debug.log('sentimentStripLinked async refreshed'));
|
|
5178
|
+
strip.refresh = refresh;
|
|
5179
|
+
return _context3.abrupt("return", strip);
|
|
5180
|
+
case 6:
|
|
5181
|
+
case "end":
|
|
5182
|
+
return _context3.stop();
|
|
5183
|
+
}
|
|
5184
|
+
}, _callee3);
|
|
5185
|
+
}));
|
|
5186
|
+
return _sentimentStripLinked.apply(this, arguments);
|
|
5187
|
+
}
|
|
5188
|
+
function messageToolbar(_x5, _x6, _x7, _x8) {
|
|
5189
|
+
return _messageToolbar.apply(this, arguments);
|
|
5190
|
+
}
|
|
5191
|
+
function _messageToolbar() {
|
|
5192
|
+
_messageToolbar = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(message, messageRow, userContext, channelObject) {
|
|
5193
|
+
var deleteMessage, _deleteMessage, editMessage, _editMessage, replyInThread, _replyInThread, div, closeToolbar, deleteThingThen, _deleteThingThen, me, sentimentButton, context1, cancelButton;
|
|
5194
|
+
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
|
5195
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
5196
|
+
case 0:
|
|
5197
|
+
sentimentButton = function _sentimentButton(context, target, icon, actionClass, doc, mutuallyExclusive) {
|
|
5198
|
+
function setColor() {
|
|
5199
|
+
button.style.backgroundColor = action ? 'yellow' : 'white';
|
|
4675
5200
|
}
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
5201
|
+
var button = widgets.button(dom, icon, utils.label(actionClass), /*#__PURE__*/function () {
|
|
5202
|
+
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(_event) {
|
|
5203
|
+
var insertMe, dirty, i, a;
|
|
5204
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
5205
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
5206
|
+
case 0:
|
|
5207
|
+
if (!action) {
|
|
5208
|
+
_context4.next = 7;
|
|
5209
|
+
break;
|
|
5210
|
+
}
|
|
5211
|
+
_context4.next = 3;
|
|
5212
|
+
return deleteThingThen(action);
|
|
5213
|
+
case 3:
|
|
5214
|
+
action = null;
|
|
5215
|
+
setColor();
|
|
5216
|
+
_context4.next = 25;
|
|
5217
|
+
break;
|
|
5218
|
+
case 7:
|
|
5219
|
+
// no action
|
|
5220
|
+
action = widgets.newThing(doc);
|
|
5221
|
+
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)];
|
|
5222
|
+
_context4.next = 11;
|
|
5223
|
+
return _solidLogic.store.updater.update([], insertMe);
|
|
5224
|
+
case 11:
|
|
5225
|
+
setColor();
|
|
5226
|
+
if (!mutuallyExclusive) {
|
|
5227
|
+
_context4.next = 25;
|
|
5228
|
+
break;
|
|
5229
|
+
}
|
|
5230
|
+
// Delete incompative sentiments
|
|
5231
|
+
dirty = false;
|
|
5232
|
+
i = 0;
|
|
5233
|
+
case 15:
|
|
5234
|
+
if (!(i < mutuallyExclusive.length)) {
|
|
5235
|
+
_context4.next = 24;
|
|
5236
|
+
break;
|
|
5237
|
+
}
|
|
5238
|
+
a = existingAction(mutuallyExclusive[i]);
|
|
5239
|
+
if (!a) {
|
|
5240
|
+
_context4.next = 21;
|
|
5241
|
+
break;
|
|
5242
|
+
}
|
|
5243
|
+
_context4.next = 20;
|
|
5244
|
+
return deleteThingThen(a);
|
|
5245
|
+
case 20:
|
|
5246
|
+
// but how refresh? refreshTree the parent?
|
|
5247
|
+
dirty = true;
|
|
5248
|
+
case 21:
|
|
5249
|
+
i++;
|
|
5250
|
+
_context4.next = 15;
|
|
5251
|
+
break;
|
|
5252
|
+
case 24:
|
|
5253
|
+
if (dirty) {
|
|
5254
|
+
// widgets.refreshTree(button.parentNode) // requires them all to be immediate siblings
|
|
5255
|
+
widgets.refreshTree(messageRow); // requires them all to be immediate siblings
|
|
5256
|
+
}
|
|
5257
|
+
case 25:
|
|
5258
|
+
case "end":
|
|
5259
|
+
return _context4.stop();
|
|
5260
|
+
}
|
|
5261
|
+
}, _callee4);
|
|
5262
|
+
}));
|
|
5263
|
+
return function (_x11) {
|
|
5264
|
+
return _ref.apply(this, arguments);
|
|
5265
|
+
};
|
|
5266
|
+
}());
|
|
5267
|
+
function existingAction(actionClass) {
|
|
5268
|
+
var actions = _solidLogic.store.each(null, ns.schema('agent'), context.me, doc).filter(function (x) {
|
|
5269
|
+
return _solidLogic.store.holds(x, ns.rdf('type'), actionClass, doc);
|
|
5270
|
+
}).filter(function (x) {
|
|
5271
|
+
return _solidLogic.store.holds(x, ns.schema('target'), target, doc);
|
|
5272
|
+
});
|
|
5273
|
+
return actions.length ? actions[0] : null;
|
|
4683
5274
|
}
|
|
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);
|
|
5275
|
+
function refresh() {
|
|
5276
|
+
action = existingAction(actionClass);
|
|
5277
|
+
setColor();
|
|
4725
5278
|
}
|
|
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
|
-
|
|
5279
|
+
var action;
|
|
5280
|
+
button.refresh = refresh; // If the file changes, refresh live
|
|
5281
|
+
refresh();
|
|
5282
|
+
return button;
|
|
5283
|
+
};
|
|
5284
|
+
_deleteThingThen = function _deleteThingThen3() {
|
|
5285
|
+
_deleteThingThen = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(x) {
|
|
5286
|
+
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
|
5287
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
5288
|
+
case 0:
|
|
5289
|
+
_context9.next = 2;
|
|
5290
|
+
return _solidLogic.store.updater.update(_solidLogic.store.connectedStatements(x), []);
|
|
5291
|
+
case 2:
|
|
5292
|
+
case "end":
|
|
5293
|
+
return _context9.stop();
|
|
5294
|
+
}
|
|
5295
|
+
}, _callee9);
|
|
5296
|
+
}));
|
|
5297
|
+
return _deleteThingThen.apply(this, arguments);
|
|
5298
|
+
};
|
|
5299
|
+
deleteThingThen = function _deleteThingThen2(_x10) {
|
|
5300
|
+
return _deleteThingThen.apply(this, arguments);
|
|
5301
|
+
};
|
|
5302
|
+
closeToolbar = function _closeToolbar() {
|
|
5303
|
+
div.parentElement.parentElement.removeChild(div.parentElement); // remive the TR
|
|
5304
|
+
};
|
|
5305
|
+
_replyInThread = function _replyInThread3() {
|
|
5306
|
+
_replyInThread = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
|
|
5307
|
+
var thread, options;
|
|
5308
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
5309
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
5310
|
+
case 0:
|
|
5311
|
+
_context8.next = 2;
|
|
5312
|
+
return channelObject.createThread(message);
|
|
5313
|
+
case 2:
|
|
5314
|
+
thread = _context8.sent;
|
|
5315
|
+
options = userContext.chatOptions;
|
|
5316
|
+
if (options) {
|
|
5317
|
+
_context8.next = 6;
|
|
5318
|
+
break;
|
|
5319
|
+
}
|
|
5320
|
+
throw new Error('replyInThread: missing options');
|
|
5321
|
+
case 6:
|
|
5322
|
+
options.showThread(thread, options);
|
|
5323
|
+
closeToolbar(); // a one-off action
|
|
5324
|
+
case 8:
|
|
5325
|
+
case "end":
|
|
5326
|
+
return _context8.stop();
|
|
5327
|
+
}
|
|
5328
|
+
}, _callee8);
|
|
5329
|
+
}));
|
|
5330
|
+
return _replyInThread.apply(this, arguments);
|
|
5331
|
+
};
|
|
5332
|
+
replyInThread = function _replyInThread2() {
|
|
5333
|
+
return _replyInThread.apply(this, arguments);
|
|
5334
|
+
};
|
|
5335
|
+
_editMessage = function _editMessage3() {
|
|
5336
|
+
_editMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(messageRow) {
|
|
5337
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
5338
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
5339
|
+
case 0:
|
|
5340
|
+
if (!(me.value === _solidLogic.store.any(message, ns.foaf('maker')).value)) {
|
|
5341
|
+
_context7.next = 4;
|
|
5342
|
+
break;
|
|
5343
|
+
}
|
|
5344
|
+
closeToolbar(); // edit is a one-off action
|
|
5345
|
+
_context7.next = 4;
|
|
5346
|
+
return (0, _message.switchToEditor)(messageRow, message, channelObject, userContext);
|
|
5347
|
+
case 4:
|
|
5348
|
+
case "end":
|
|
5349
|
+
return _context7.stop();
|
|
5350
|
+
}
|
|
5351
|
+
}, _callee7);
|
|
5352
|
+
}));
|
|
5353
|
+
return _editMessage.apply(this, arguments);
|
|
5354
|
+
};
|
|
5355
|
+
editMessage = function _editMessage2(_x9) {
|
|
5356
|
+
return _editMessage.apply(this, arguments);
|
|
5357
|
+
};
|
|
5358
|
+
_deleteMessage = function _deleteMessage3() {
|
|
5359
|
+
_deleteMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
|
|
5360
|
+
var author, msg, area;
|
|
5361
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
5362
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
5363
|
+
case 0:
|
|
5364
|
+
author = _solidLogic.store.any(message, ns.foaf('maker'));
|
|
5365
|
+
if (me) {
|
|
5366
|
+
_context6.next = 5;
|
|
5367
|
+
break;
|
|
5368
|
+
}
|
|
5369
|
+
alert('You can\'t delete the message, you are not logged in.');
|
|
5370
|
+
_context6.next = 22;
|
|
5371
|
+
break;
|
|
5372
|
+
case 5:
|
|
5373
|
+
if (!me.sameTerm(author)) {
|
|
5374
|
+
_context6.next = 21;
|
|
5375
|
+
break;
|
|
5376
|
+
}
|
|
5377
|
+
_context6.prev = 6;
|
|
5378
|
+
_context6.next = 9;
|
|
5379
|
+
return channelObject.deleteMessage(message);
|
|
5380
|
+
case 9:
|
|
5381
|
+
_context6.next = 18;
|
|
5382
|
+
break;
|
|
5383
|
+
case 11:
|
|
5384
|
+
_context6.prev = 11;
|
|
5385
|
+
_context6.t0 = _context6["catch"](6);
|
|
5386
|
+
msg = 'Error deleting messaage ' + _context6.t0;
|
|
5387
|
+
debug.warn(msg);
|
|
5388
|
+
alert(msg);
|
|
5389
|
+
area = userContext.statusArea || messageRow.parentNode;
|
|
5390
|
+
area.appendChild(widgets.errorMessageBlock(dom, msg));
|
|
5391
|
+
case 18:
|
|
5392
|
+
messageRow.parentNode.removeChild(messageRow);
|
|
5393
|
+
_context6.next = 22;
|
|
5394
|
+
break;
|
|
5395
|
+
case 21:
|
|
5396
|
+
alert('You can\'t delete the message, you are not logged in as the author, ' + author);
|
|
5397
|
+
case 22:
|
|
5398
|
+
closeToolbar();
|
|
5399
|
+
case 23:
|
|
5400
|
+
case "end":
|
|
5401
|
+
return _context6.stop();
|
|
5402
|
+
}
|
|
5403
|
+
}, _callee6, null, [[6, 11]]);
|
|
5404
|
+
}));
|
|
5405
|
+
return _deleteMessage.apply(this, arguments);
|
|
5406
|
+
};
|
|
5407
|
+
deleteMessage = function _deleteMessage2() {
|
|
5408
|
+
return _deleteMessage.apply(this, arguments);
|
|
5409
|
+
};
|
|
5410
|
+
// alain: TODO allow chat owner to fully delete message + sentiments and replacing messages
|
|
5411
|
+
div = dom.createElement('div'); // is message deleted ?
|
|
5412
|
+
_context10.next = 13;
|
|
5413
|
+
return (0, _chatLogic.mostRecentVersion)(message).value;
|
|
5414
|
+
case 13:
|
|
5415
|
+
_context10.t0 = _context10.sent;
|
|
5416
|
+
_context10.t1 = ns.schema('dateDeleted').value;
|
|
5417
|
+
if (!(_context10.t0 === _context10.t1)) {
|
|
5418
|
+
_context10.next = 17;
|
|
5419
|
+
break;
|
|
5420
|
+
}
|
|
5421
|
+
return _context10.abrupt("return", div);
|
|
5422
|
+
case 17:
|
|
5423
|
+
// Things only the original author can do
|
|
5424
|
+
me = _solidLogic.authn.currentUser(); // If already logged on
|
|
5425
|
+
if (me && _solidLogic.store.holds(message, ns.foaf('maker'), me)) {
|
|
5426
|
+
// button to delete the message
|
|
5427
|
+
div.appendChild(widgets.deleteButtonWithCheck(dom, div, 'message', deleteMessage));
|
|
5428
|
+
// button to edit the message
|
|
5429
|
+
div.appendChild(widgets.button(dom, _iconBase.icons.iconBase + PENCIL_ICON, 'edit', function () {
|
|
5430
|
+
return editMessage(messageRow);
|
|
5431
|
+
}));
|
|
5432
|
+
} // if mine
|
|
5433
|
+
// Things anyone can do if they have a bookmark list async
|
|
5434
|
+
/*
|
|
5435
|
+
var bookmarkButton = await bookmarks.renderBookmarksButton(userContext)
|
|
5436
|
+
if (bookmarkButton) {
|
|
5437
|
+
div.appendChild(bookmarkButton)
|
|
5438
|
+
}
|
|
5439
|
+
*/
|
|
5440
|
+
// Things anyone can do if they have a bookmark list
|
|
4775
5441
|
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
5442
|
+
(0, _bookmarks.renderBookmarksButton)(userContext).then(function (bookmarkButton) {
|
|
5443
|
+
if (bookmarkButton) div.appendChild(bookmarkButton);
|
|
5444
|
+
});
|
|
4779
5445
|
|
|
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();
|
|
5446
|
+
/** Button to allow user to express a sentiment (like, endorse, etc) about a target
|
|
5447
|
+
*
|
|
5448
|
+
* @param context {Object} - Provide dom and me
|
|
5449
|
+
* @param target {NamedNode} - The thing the user expresses an opnion about
|
|
5450
|
+
* @param icon {uristring} - The icon to be used for the button
|
|
5451
|
+
* @param actionClass {NamedNode} - The RDF class - typically a subclass of schema:Action
|
|
5452
|
+
* @param doc - {NamedNode} - the Solid document iunto which the data should be written
|
|
5453
|
+
* @param mutuallyExclusive {Array<NamedNode>} - Any RDF classes of sentimentswhich are mutiually exclusive
|
|
5454
|
+
*/
|
|
5455
|
+
|
|
5456
|
+
// THUMBS_UP_ICON
|
|
5457
|
+
// https://schema.org/AgreeAction
|
|
5458
|
+
me = _solidLogic.authn.currentUser(); // If already logged on
|
|
5459
|
+
_context10.t2 = me;
|
|
5460
|
+
if (!_context10.t2) {
|
|
5461
|
+
_context10.next = 28;
|
|
5462
|
+
break;
|
|
4852
5463
|
}
|
|
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))
|
|
5464
|
+
_context10.next = 25;
|
|
5465
|
+
return (0, _chatLogic.mostRecentVersion)(message).value;
|
|
5466
|
+
case 25:
|
|
5467
|
+
_context10.t3 = _context10.sent;
|
|
5468
|
+
_context10.t4 = ns.schema('dateDeleted').value;
|
|
5469
|
+
_context10.t2 = _context10.t3 !== _context10.t4;
|
|
5470
|
+
case 28:
|
|
5471
|
+
if (!_context10.t2) {
|
|
5472
|
+
_context10.next = 32;
|
|
5473
|
+
break;
|
|
5474
|
+
}
|
|
5475
|
+
context1 = {
|
|
5476
|
+
me: me,
|
|
5477
|
+
dom: dom,
|
|
5478
|
+
div: div
|
|
5479
|
+
};
|
|
5480
|
+
div.appendChild(sentimentButton(context1, message,
|
|
5481
|
+
// @@ TODO use widgets.sentimentButton
|
|
5482
|
+
_iconBase.icons.iconBase + THUMBS_UP_ICON, ns.schema('AgreeAction'), message.doc(), [ns.schema('DisagreeAction')]));
|
|
5483
|
+
// Thumbs down
|
|
5484
|
+
div.appendChild(sentimentButton(context1, message, _iconBase.icons.iconBase + THUMBS_DOWN_ICON, ns.schema('DisagreeAction'), message.doc(), [ns.schema('AgreeAction')]));
|
|
5485
|
+
case 32:
|
|
5486
|
+
// Reply buttton
|
|
4881
5487
|
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
5488
|
+
if (_solidLogic.store.any(message, ns.dct('created'))) {
|
|
5489
|
+
// Looks like a messsage? Bar can be used for other things
|
|
5490
|
+
div.appendChild(widgets.button(dom, _iconBase.icons.iconBase + REPLY_ICON, 'Reply in thread', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
|
|
5491
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
5492
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
5493
|
+
case 0:
|
|
5494
|
+
_context5.next = 2;
|
|
5495
|
+
return replyInThread();
|
|
5496
|
+
case 2:
|
|
5497
|
+
case "end":
|
|
5498
|
+
return _context5.stop();
|
|
5499
|
+
}
|
|
5500
|
+
}, _callee5);
|
|
5501
|
+
}))));
|
|
5502
|
+
}
|
|
5503
|
+
// X button to remove the tool UI itself
|
|
5504
|
+
cancelButton = div.appendChild(widgets.cancelButton(dom));
|
|
5505
|
+
cancelButton.style["float"] = 'right';
|
|
5506
|
+
cancelButton.firstChild.style.opacity = '0.3';
|
|
5507
|
+
cancelButton.addEventListener('click', closeToolbar);
|
|
5508
|
+
return _context10.abrupt("return", div);
|
|
5509
|
+
case 38:
|
|
5510
|
+
case "end":
|
|
5511
|
+
return _context10.stop();
|
|
5512
|
+
}
|
|
5513
|
+
}, _callee10);
|
|
5514
|
+
}));
|
|
5515
|
+
return _messageToolbar.apply(this, arguments);
|
|
4900
5516
|
}
|
|
4901
5517
|
//# sourceMappingURL=messageTools.js.map
|
|
4902
5518
|
|
|
@@ -6320,13 +6936,13 @@ var LogLevel;
|
|
|
6320
6936
|
/** @internal */
|
|
6321
6937
|
exports.LogLevel = LogLevel;
|
|
6322
6938
|
(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"] =
|
|
6939
|
+
LogLevel[LogLevel["Error"] = 1] = "Error";
|
|
6940
|
+
LogLevel[LogLevel["Warning"] = 2] = "Warning";
|
|
6941
|
+
LogLevel[LogLevel["Message"] = 4] = "Message";
|
|
6942
|
+
LogLevel[LogLevel["Success"] = 8] = "Success";
|
|
6943
|
+
LogLevel[LogLevel["Info"] = 16] = "Info";
|
|
6944
|
+
LogLevel[LogLevel["Debug"] = 32] = "Debug";
|
|
6945
|
+
LogLevel[LogLevel["All"] = 63] = "All";
|
|
6330
6946
|
})(LogLevel || (exports.LogLevel = LogLevel = {}));
|
|
6331
6947
|
var _level = TERROR + TWARN + TMESG;
|
|
6332
6948
|
/** @internal */
|
|
@@ -13119,26 +13735,28 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
13119
13735
|
}));
|
|
13120
13736
|
exports.versionInfo = void 0;
|
|
13121
13737
|
var versionInfo = {
|
|
13122
|
-
buildTime: '2023-
|
|
13123
|
-
commit: '
|
|
13738
|
+
buildTime: '2023-03-09T18:20:37Z',
|
|
13739
|
+
commit: '029ae1f959316f7b8e6b4b4bef82bce7f0d8e438',
|
|
13124
13740
|
npmInfo: {
|
|
13125
|
-
'solid-ui': '2.4.
|
|
13126
|
-
npm: '8.19.
|
|
13127
|
-
node: '
|
|
13128
|
-
v8: '
|
|
13129
|
-
uv: '1.
|
|
13741
|
+
'solid-ui': '2.4.26',
|
|
13742
|
+
npm: '8.19.4',
|
|
13743
|
+
node: '16.19.1',
|
|
13744
|
+
v8: '9.4.146.26-node.24',
|
|
13745
|
+
uv: '1.43.0',
|
|
13130
13746
|
zlib: '1.2.11',
|
|
13131
13747
|
brotli: '1.0.9',
|
|
13132
13748
|
ares: '1.18.1',
|
|
13133
|
-
modules: '
|
|
13134
|
-
nghttp2: '1.
|
|
13749
|
+
modules: '93',
|
|
13750
|
+
nghttp2: '1.47.0',
|
|
13135
13751
|
napi: '8',
|
|
13136
|
-
llhttp: '
|
|
13137
|
-
openssl: '1.1.
|
|
13138
|
-
cldr: '
|
|
13139
|
-
icu: '
|
|
13752
|
+
llhttp: '6.0.10',
|
|
13753
|
+
openssl: '1.1.1t+quic',
|
|
13754
|
+
cldr: '41.0',
|
|
13755
|
+
icu: '71.1',
|
|
13140
13756
|
tz: '2022f',
|
|
13141
|
-
unicode: '14.0'
|
|
13757
|
+
unicode: '14.0',
|
|
13758
|
+
ngtcp2: '0.8.1',
|
|
13759
|
+
nghttp3: '0.7.0'
|
|
13142
13760
|
}
|
|
13143
13761
|
};
|
|
13144
13762
|
exports.versionInfo = versionInfo;
|
|
@@ -25644,7 +26262,10 @@ class ClientAuthentication {
|
|
|
25644
26262
|
this.login = async (options, eventEmitter) => {
|
|
25645
26263
|
var _a, _b;
|
|
25646
26264
|
await this.sessionInfoManager.clear(options.sessionId);
|
|
25647
|
-
const redirectUrl = (
|
|
26265
|
+
const redirectUrl = (_a = options.redirectUrl) !== null && _a !== void 0 ? _a : (0, oidc_client_ext_1.removeOidcQueryParam)(window.location.href);
|
|
26266
|
+
if (!(0, solid_client_authn_core_1.isValidRedirectUrl)(redirectUrl)) {
|
|
26267
|
+
throw new Error(`${redirectUrl} is not a valid redirect URL, it is either a malformed IRI or it includes a hash fragment.`);
|
|
26268
|
+
}
|
|
25648
26269
|
await this.loginHandler.handle({
|
|
25649
26270
|
...options,
|
|
25650
26271
|
redirectUrl,
|
|
@@ -26115,7 +26736,6 @@ exports["default"] = ClientRegistrar;
|
|
|
26115
26736
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
26116
26737
|
exports.WELL_KNOWN_OPENID_CONFIG = void 0;
|
|
26117
26738
|
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
26739
|
exports.WELL_KNOWN_OPENID_CONFIG = ".well-known/openid-configuration";
|
|
26120
26740
|
const issuerConfigKeyMap = {
|
|
26121
26741
|
issuer: {
|
|
@@ -26221,7 +26841,7 @@ class IssuerConfigFetcher {
|
|
|
26221
26841
|
}
|
|
26222
26842
|
async fetchConfig(issuer) {
|
|
26223
26843
|
let issuerConfig;
|
|
26224
|
-
const openIdConfigUrl =
|
|
26844
|
+
const openIdConfigUrl = new URL(exports.WELL_KNOWN_OPENID_CONFIG, issuer).href;
|
|
26225
26845
|
const issuerConfigRequestBody = await window.fetch(openIdConfigUrl);
|
|
26226
26846
|
try {
|
|
26227
26847
|
issuerConfig = processConfig(await issuerConfigRequestBody.json());
|
|
@@ -26772,27 +27392,6 @@ exports["default"] = StorageUtilityBrowser;
|
|
|
26772
27392
|
|
|
26773
27393
|
/***/ }),
|
|
26774
27394
|
|
|
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
27395
|
/***/ "./node_modules/@inrupt/solid-client-authn-browser/node_modules/uuid/dist/commonjs-browser/index.js":
|
|
26797
27396
|
/*!**********************************************************************************************************!*\
|
|
26798
27397
|
!*** ./node_modules/@inrupt/solid-client-authn-browser/node_modules/uuid/dist/commonjs-browser/index.js ***!
|
|
@@ -27907,6 +28506,16 @@ async function getWebidFromTokenPayload(idToken, jwksIri, issuerIri, clientId) {
|
|
|
27907
28506
|
}
|
|
27908
28507
|
}
|
|
27909
28508
|
|
|
28509
|
+
function isValidRedirectUrl(redirectUrl) {
|
|
28510
|
+
try {
|
|
28511
|
+
const urlObject = new URL(redirectUrl);
|
|
28512
|
+
return urlObject.hash === "";
|
|
28513
|
+
}
|
|
28514
|
+
catch (e) {
|
|
28515
|
+
return false;
|
|
28516
|
+
}
|
|
28517
|
+
}
|
|
28518
|
+
|
|
27910
28519
|
function isSupportedTokenType(token) {
|
|
27911
28520
|
return typeof token === "string" && ["DPoP", "Bearer"].includes(token);
|
|
27912
28521
|
}
|
|
@@ -28322,6 +28931,7 @@ exports.getSessionIdFromOauthState = getSessionIdFromOauthState;
|
|
|
28322
28931
|
exports.getWebidFromTokenPayload = getWebidFromTokenPayload;
|
|
28323
28932
|
exports.handleRegistration = handleRegistration;
|
|
28324
28933
|
exports.isSupportedTokenType = isSupportedTokenType;
|
|
28934
|
+
exports.isValidRedirectUrl = isValidRedirectUrl;
|
|
28325
28935
|
exports.loadOidcContextFromStorage = loadOidcContextFromStorage;
|
|
28326
28936
|
exports.mockStorage = mockStorage;
|
|
28327
28937
|
exports.mockStorageUtility = mockStorageUtility;
|
|
@@ -45273,7 +45883,7 @@ function () {
|
|
|
45273
45883
|
|
|
45274
45884
|
return ConditionalRule;
|
|
45275
45885
|
}();
|
|
45276
|
-
var keyRegExp = /@media|@supports\s+/;
|
|
45886
|
+
var keyRegExp = /@container|@media|@supports\s+/;
|
|
45277
45887
|
var pluginConditionalRule = {
|
|
45278
45888
|
onCreateRule: function onCreateRule(key, styles, options) {
|
|
45279
45889
|
return keyRegExp.test(key) ? new ConditionalRule(key, styles, options) : null;
|
|
@@ -46837,7 +47447,7 @@ var Jss =
|
|
|
46837
47447
|
function () {
|
|
46838
47448
|
function Jss(options) {
|
|
46839
47449
|
this.id = instanceCounter++;
|
|
46840
|
-
this.version = "10.
|
|
47450
|
+
this.version = "10.10.0";
|
|
46841
47451
|
this.plugins = new PluginsRegistry();
|
|
46842
47452
|
this.options = {
|
|
46843
47453
|
id: {
|
|
@@ -54278,16 +54888,17 @@ var Fetcher = /*#__PURE__*/function () {
|
|
|
54278
54888
|
var fetcher = this;
|
|
54279
54889
|
// @ts-ignore
|
|
54280
54890
|
if (fetcher.fetchQueue && fetcher.fetchQueue[uri]) {
|
|
54281
|
-
console.log('Internal error - fetchQueue exists ' + uri)
|
|
54891
|
+
// console.log('Internal error - fetchQueue exists ' + uri)
|
|
54282
54892
|
var promise = fetcher.fetchQueue[uri];
|
|
54283
54893
|
if (promise['PromiseStatus'] === 'resolved') {
|
|
54284
54894
|
delete fetcher.fetchQueue[uri];
|
|
54285
54895
|
} else {
|
|
54286
54896
|
// pending
|
|
54287
54897
|
delete fetcher.fetchQueue[uri];
|
|
54288
|
-
console.log('*** Fetcher: pending fetchQueue deleted ' + uri)
|
|
54898
|
+
// console.log('*** Fetcher: pending fetchQueue deleted ' + uri)
|
|
54289
54899
|
}
|
|
54290
54900
|
}
|
|
54901
|
+
|
|
54291
54902
|
if (fetcher.requested[uri] && fetcher.requested[uri] !== 'done' && fetcher.requested[uri] !== 'failed' && fetcher.requested[uri] !== 404) {
|
|
54292
54903
|
var msg = "Rdflib: fetcher: Destructive operation on <".concat(fetcher.requested[uri], "> file being fetched! ") + uri;
|
|
54293
54904
|
console.error(msg);
|
|
@@ -61239,7 +61850,7 @@ contentType, callback, options) {
|
|
|
61239
61850
|
documentString = sz.statementsToNTriples(newSts);
|
|
61240
61851
|
return executeCallback(null, documentString);
|
|
61241
61852
|
case _types__WEBPACK_IMPORTED_MODULE_0__.JSONLDContentType:
|
|
61242
|
-
sz.setFlags('si'); //
|
|
61853
|
+
sz.setFlags('si dr'); // turtle + dr (means no default, no relative prefix)
|
|
61243
61854
|
documentString = sz.statementsToJsonld(newSts); // convert via turtle
|
|
61244
61855
|
return executeCallback(null, documentString);
|
|
61245
61856
|
case _types__WEBPACK_IMPORTED_MODULE_0__.NQuadsContentType:
|
|
@@ -61311,7 +61922,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
61311
61922
|
|
|
61312
61923
|
|
|
61313
61924
|
|
|
61314
|
-
// import * as jsonld from 'jsonld'
|
|
61315
61925
|
|
|
61316
61926
|
function createSerializer(store) {
|
|
61317
61927
|
return new Serializer(store);
|
|
@@ -61818,7 +62428,7 @@ var Serializer = /*#__PURE__*/function () {
|
|
|
61818
62428
|
var termToN3 = termToN3Method.bind(this);
|
|
61819
62429
|
function prefixDirectivesMethod() {
|
|
61820
62430
|
var str = '';
|
|
61821
|
-
if (this.defaultNamespace) {
|
|
62431
|
+
if (this.flags.indexOf('d') < 0 && this.defaultNamespace) {
|
|
61822
62432
|
str += '@prefix : ' + this.explicitURI(this.defaultNamespace) + '.\n';
|
|
61823
62433
|
}
|
|
61824
62434
|
for (var ns in this.prefixes) {
|
|
@@ -62303,20 +62913,19 @@ var Serializer = /*#__PURE__*/function () {
|
|
|
62303
62913
|
key: "statementsToJsonld",
|
|
62304
62914
|
value: function statementsToJsonld(sts) {
|
|
62305
62915
|
// ttl2jsonld creates context keys for all ttl prefix
|
|
62306
|
-
// context keys must be
|
|
62307
|
-
function findId(itemObj) {
|
|
62916
|
+
// context keys must be absolute IRI ttl2jsonld@0.0.8
|
|
62917
|
+
/* function findId (itemObj) {
|
|
62308
62918
|
if (itemObj['@id']) {
|
|
62309
|
-
|
|
62310
|
-
if (keys[item[0]]) itemObj['@id'] = jsonldObj['@context'][item[0]] + item[1]
|
|
62919
|
+
const item = itemObj['@id'].split(':')
|
|
62920
|
+
if (keys[item[0]]) itemObj['@id'] = jsonldObj['@context'][item[0]] + item[1]
|
|
62311
62921
|
}
|
|
62312
|
-
|
|
62313
|
-
for (
|
|
62314
|
-
if (typeof itemValues[i] !== 'string') {
|
|
62315
|
-
|
|
62316
|
-
findId(itemValues[i]);
|
|
62922
|
+
const itemValues = Object.values(itemObj)
|
|
62923
|
+
for (const i in itemValues) {
|
|
62924
|
+
if (typeof itemValues[i] !== 'string') { // @list contains array
|
|
62925
|
+
findId(itemValues[i])
|
|
62317
62926
|
}
|
|
62318
62927
|
}
|
|
62319
|
-
}
|
|
62928
|
+
} */
|
|
62320
62929
|
var turtleDoc = this.statementsToN3(sts);
|
|
62321
62930
|
var jsonldObj = _frogcat_ttl2jsonld__WEBPACK_IMPORTED_MODULE_4__.parse(turtleDoc);
|
|
62322
62931
|
return JSON.stringify(jsonldObj, null, 2);
|
|
@@ -66818,15 +67427,13 @@ function createAclLogic(store) {
|
|
|
66818
67427
|
var ns = ns_1.ns;
|
|
66819
67428
|
function findAclDocUrl(url) {
|
|
66820
67429
|
return __awaiter(this, void 0, void 0, function () {
|
|
66821
|
-
var
|
|
67430
|
+
var docNode;
|
|
66822
67431
|
return __generator(this, function (_a) {
|
|
66823
67432
|
switch (_a.label) {
|
|
66824
|
-
case 0:
|
|
66825
|
-
doc = store.sym(url);
|
|
66826
|
-
return [4 /*yield*/, store.fetcher.load(doc)];
|
|
67433
|
+
case 0: return [4 /*yield*/, store.fetcher.load(url)];
|
|
66827
67434
|
case 1:
|
|
66828
67435
|
_a.sent();
|
|
66829
|
-
docNode = store.any(
|
|
67436
|
+
docNode = store.any(url, exports.ACL_LINK);
|
|
66830
67437
|
if (!docNode) {
|
|
66831
67438
|
throw new Error("No ACL link discovered for ".concat(url));
|
|
66832
67439
|
}
|
|
@@ -67634,7 +68241,7 @@ function createInboxLogic(store, profileLogic, utilityLogic, containerLogic, acl
|
|
|
67634
68241
|
case 2: return [4 /*yield*/, profileLogic.getMainInbox(user)];
|
|
67635
68242
|
case 3:
|
|
67636
68243
|
inbox = _a.sent();
|
|
67637
|
-
return [4 /*yield*/, containerLogic.getContainerMembers(inbox
|
|
68244
|
+
return [4 /*yield*/, containerLogic.getContainerMembers(inbox)];
|
|
67638
68245
|
case 4:
|
|
67639
68246
|
urls = _a.sent();
|
|
67640
68247
|
return [2 /*return*/, urls.filter(function (url) { return !containerLogic.isContainer(url); })];
|
|
@@ -68790,19 +69397,21 @@ var rdflib_1 = __webpack_require__(/*! rdflib */ "./node_modules/rdflib/esm/inde
|
|
|
68790
69397
|
function createContainerLogic(store) {
|
|
68791
69398
|
function getContainerElements(containerNode) {
|
|
68792
69399
|
return store
|
|
68793
|
-
.statementsMatching(containerNode, (0, rdflib_1.sym)("http://www.w3.org/ns/ldp#contains"), undefined
|
|
69400
|
+
.statementsMatching(containerNode, (0, rdflib_1.sym)("http://www.w3.org/ns/ldp#contains"), undefined)
|
|
68794
69401
|
.map(function (st) { return st.object; });
|
|
68795
69402
|
}
|
|
68796
69403
|
function isContainer(url) {
|
|
68797
|
-
|
|
69404
|
+
var nodeToString = url.value;
|
|
69405
|
+
return nodeToString.charAt(nodeToString.length - 1) === "/";
|
|
68798
69406
|
}
|
|
68799
69407
|
function createContainer(url) {
|
|
68800
69408
|
return __awaiter(this, void 0, void 0, function () {
|
|
68801
|
-
var result;
|
|
69409
|
+
var stringToNode, result;
|
|
68802
69410
|
return __generator(this, function (_a) {
|
|
68803
69411
|
switch (_a.label) {
|
|
68804
69412
|
case 0:
|
|
68805
|
-
|
|
69413
|
+
stringToNode = (0, rdflib_1.sym)(url);
|
|
69414
|
+
if (!isContainer(stringToNode)) {
|
|
68806
69415
|
throw new Error("Not a container URL ".concat(url));
|
|
68807
69416
|
}
|
|
68808
69417
|
return [4 /*yield*/, store.fetcher._fetch(url, {
|
|
@@ -68826,16 +69435,12 @@ function createContainerLogic(store) {
|
|
|
68826
69435
|
}
|
|
68827
69436
|
function getContainerMembers(containerUrl) {
|
|
68828
69437
|
return __awaiter(this, void 0, void 0, function () {
|
|
68829
|
-
var containerNode, nodes;
|
|
68830
69438
|
return __generator(this, function (_a) {
|
|
68831
69439
|
switch (_a.label) {
|
|
68832
|
-
case 0:
|
|
68833
|
-
containerNode = store.sym(containerUrl);
|
|
68834
|
-
return [4 /*yield*/, store.fetcher.load(containerNode)];
|
|
69440
|
+
case 0: return [4 /*yield*/, store.fetcher.load(containerUrl)];
|
|
68835
69441
|
case 1:
|
|
68836
69442
|
_a.sent();
|
|
68837
|
-
|
|
68838
|
-
return [2 /*return*/, nodes.map(function (node) { return node.value; })];
|
|
69443
|
+
return [2 /*return*/, getContainerElements(containerUrl)];
|
|
68839
69444
|
}
|
|
68840
69445
|
});
|
|
68841
69446
|
});
|
|
@@ -69021,28 +69626,30 @@ var CustomError_1 = __webpack_require__(/*! ../logic/CustomError */ "./node_modu
|
|
|
69021
69626
|
var debug = __importStar(__webpack_require__(/*! ../util/debug */ "./node_modules/solid-logic/lib/util/debug.js"));
|
|
69022
69627
|
var utils_1 = __webpack_require__(/*! ./utils */ "./node_modules/solid-logic/lib/util/utils.js");
|
|
69023
69628
|
function createUtilityLogic(store, aclLogic, containerLogic) {
|
|
69024
|
-
function recursiveDelete(
|
|
69629
|
+
function recursiveDelete(containerNode) {
|
|
69025
69630
|
return __awaiter(this, void 0, void 0, function () {
|
|
69026
|
-
var aclDocUrl, containerMembers, e_1;
|
|
69631
|
+
var aclDocUrl, containerMembers, nodeToStringHere, e_1;
|
|
69027
69632
|
return __generator(this, function (_a) {
|
|
69028
69633
|
switch (_a.label) {
|
|
69029
69634
|
case 0:
|
|
69030
69635
|
_a.trys.push([0, 6, , 7]);
|
|
69031
|
-
if (!containerLogic.isContainer(
|
|
69032
|
-
return [4 /*yield*/, aclLogic.findAclDocUrl(
|
|
69636
|
+
if (!containerLogic.isContainer(containerNode)) return [3 /*break*/, 5];
|
|
69637
|
+
return [4 /*yield*/, aclLogic.findAclDocUrl(containerNode)];
|
|
69033
69638
|
case 1:
|
|
69034
69639
|
aclDocUrl = _a.sent();
|
|
69035
69640
|
return [4 /*yield*/, store.fetcher._fetch(aclDocUrl, { method: "DELETE" })];
|
|
69036
69641
|
case 2:
|
|
69037
69642
|
_a.sent();
|
|
69038
|
-
return [4 /*yield*/, containerLogic.getContainerMembers(
|
|
69643
|
+
return [4 /*yield*/, containerLogic.getContainerMembers(containerNode)];
|
|
69039
69644
|
case 3:
|
|
69040
69645
|
containerMembers = _a.sent();
|
|
69041
69646
|
return [4 /*yield*/, Promise.all(containerMembers.map(function (url) { return recursiveDelete(url); }))];
|
|
69042
69647
|
case 4:
|
|
69043
69648
|
_a.sent();
|
|
69044
69649
|
_a.label = 5;
|
|
69045
|
-
case 5:
|
|
69650
|
+
case 5:
|
|
69651
|
+
nodeToStringHere = containerNode.value;
|
|
69652
|
+
return [2 /*return*/, store.fetcher._fetch(nodeToStringHere, { method: "DELETE" })];
|
|
69046
69653
|
case 6:
|
|
69047
69654
|
e_1 = _a.sent();
|
|
69048
69655
|
return [3 /*break*/, 7];
|
|
@@ -69187,7 +69794,7 @@ function createUtilityLogic(store, aclLogic, containerLogic) {
|
|
|
69187
69794
|
''
|
|
69188
69795
|
].join('\n');
|
|
69189
69796
|
}
|
|
69190
|
-
return [4 /*yield*/, aclLogic.findAclDocUrl(options.target)];
|
|
69797
|
+
return [4 /*yield*/, aclLogic.findAclDocUrl((0, rdflib_1.sym)(options.target))];
|
|
69191
69798
|
case 1:
|
|
69192
69799
|
aclDocUrl = _a.sent();
|
|
69193
69800
|
return [2 /*return*/, store.fetcher._fetch(aclDocUrl, {
|
|
@@ -73559,6 +74166,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
73559
74166
|
/* harmony export */ "getWebidFromTokenPayload": () => (/* binding */ getWebidFromTokenPayload),
|
|
73560
74167
|
/* harmony export */ "handleRegistration": () => (/* binding */ handleRegistration),
|
|
73561
74168
|
/* harmony export */ "isSupportedTokenType": () => (/* binding */ isSupportedTokenType),
|
|
74169
|
+
/* harmony export */ "isValidRedirectUrl": () => (/* binding */ isValidRedirectUrl),
|
|
73562
74170
|
/* harmony export */ "loadOidcContextFromStorage": () => (/* binding */ loadOidcContextFromStorage),
|
|
73563
74171
|
/* harmony export */ "mockStorage": () => (/* binding */ mockStorage),
|
|
73564
74172
|
/* harmony export */ "mockStorageUtility": () => (/* binding */ mockStorageUtility),
|
|
@@ -73665,6 +74273,16 @@ async function getWebidFromTokenPayload(idToken, jwksIri, issuerIri, clientId) {
|
|
|
73665
74273
|
}
|
|
73666
74274
|
}
|
|
73667
74275
|
|
|
74276
|
+
function isValidRedirectUrl(redirectUrl) {
|
|
74277
|
+
try {
|
|
74278
|
+
const urlObject = new URL(redirectUrl);
|
|
74279
|
+
return urlObject.hash === "";
|
|
74280
|
+
}
|
|
74281
|
+
catch (e) {
|
|
74282
|
+
return false;
|
|
74283
|
+
}
|
|
74284
|
+
}
|
|
74285
|
+
|
|
73668
74286
|
function isSupportedTokenType(token) {
|
|
73669
74287
|
return typeof token === "string" && ["DPoP", "Bearer"].includes(token);
|
|
73670
74288
|
}
|
|
@@ -74889,7 +75507,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
74889
75507
|
async function EmbeddedJWK(protectedHeader, token) {
|
|
74890
75508
|
const joseHeader = {
|
|
74891
75509
|
...protectedHeader,
|
|
74892
|
-
...token.header,
|
|
75510
|
+
...token === null || token === void 0 ? void 0 : token.header,
|
|
74893
75511
|
};
|
|
74894
75512
|
if (!(0,_lib_is_object_js__WEBPACK_IMPORTED_MODULE_1__["default"])(joseHeader.jwk)) {
|
|
74895
75513
|
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JWSInvalid('"jwk" (JSON Web Key) Header Parameter must be a JSON object');
|
|
@@ -75034,7 +75652,7 @@ class LocalJWKSet {
|
|
|
75034
75652
|
this._jwks = clone(jwks);
|
|
75035
75653
|
}
|
|
75036
75654
|
async getKey(protectedHeader, token) {
|
|
75037
|
-
const { alg, kid } = { ...protectedHeader, ...token.header };
|
|
75655
|
+
const { alg, kid } = { ...protectedHeader, ...token === null || token === void 0 ? void 0 : token.header };
|
|
75038
75656
|
const kty = getKtyFromAlg(alg);
|
|
75039
75657
|
const candidates = this._jwks.keys.filter((jwk) => {
|
|
75040
75658
|
let candidate = kty === jwk.kty;
|
|
@@ -75076,21 +75694,39 @@ class LocalJWKSet {
|
|
|
75076
75694
|
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWKSNoMatchingKey();
|
|
75077
75695
|
}
|
|
75078
75696
|
else if (length !== 1) {
|
|
75079
|
-
|
|
75697
|
+
const error = new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWKSMultipleMatchingKeys();
|
|
75698
|
+
const { _cached } = this;
|
|
75699
|
+
error[Symbol.asyncIterator] = async function* () {
|
|
75700
|
+
for (const jwk of candidates) {
|
|
75701
|
+
try {
|
|
75702
|
+
yield await importWithAlgCache(_cached, jwk, alg);
|
|
75703
|
+
}
|
|
75704
|
+
catch (_a) {
|
|
75705
|
+
continue;
|
|
75706
|
+
}
|
|
75707
|
+
}
|
|
75708
|
+
};
|
|
75709
|
+
throw error;
|
|
75080
75710
|
}
|
|
75081
|
-
|
|
75082
|
-
|
|
75083
|
-
|
|
75084
|
-
|
|
75085
|
-
|
|
75086
|
-
|
|
75087
|
-
|
|
75711
|
+
return importWithAlgCache(this._cached, jwk, alg);
|
|
75712
|
+
}
|
|
75713
|
+
}
|
|
75714
|
+
async function importWithAlgCache(cache, jwk, alg) {
|
|
75715
|
+
const cached = cache.get(jwk) || cache.set(jwk, {}).get(jwk);
|
|
75716
|
+
if (cached[alg] === undefined) {
|
|
75717
|
+
const key = await (0,_key_import_js__WEBPACK_IMPORTED_MODULE_0__.importJWK)({ ...jwk, ext: true }, alg);
|
|
75718
|
+
if (key instanceof Uint8Array || key.type !== 'public') {
|
|
75719
|
+
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWKSInvalid('JSON Web Key Set members must be public keys');
|
|
75088
75720
|
}
|
|
75089
|
-
|
|
75721
|
+
cached[alg] = key;
|
|
75090
75722
|
}
|
|
75723
|
+
return cached[alg];
|
|
75091
75724
|
}
|
|
75092
75725
|
function createLocalJWKSet(jwks) {
|
|
75093
|
-
|
|
75726
|
+
const set = new LocalJWKSet(jwks);
|
|
75727
|
+
return async function (protectedHeader, token) {
|
|
75728
|
+
return set.getKey(protectedHeader, token);
|
|
75729
|
+
};
|
|
75094
75730
|
}
|
|
75095
75731
|
|
|
75096
75732
|
|
|
@@ -75190,7 +75826,10 @@ class RemoteJWKSet extends _local_js__WEBPACK_IMPORTED_MODULE_3__.LocalJWKSet {
|
|
|
75190
75826
|
}
|
|
75191
75827
|
}
|
|
75192
75828
|
function createRemoteJWKSet(url, options) {
|
|
75193
|
-
|
|
75829
|
+
const set = new RemoteJWKSet(url, options);
|
|
75830
|
+
return async function (protectedHeader, token) {
|
|
75831
|
+
return set.getKey(protectedHeader, token);
|
|
75832
|
+
};
|
|
75194
75833
|
}
|
|
75195
75834
|
|
|
75196
75835
|
|
|
@@ -76039,83 +76678,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
76039
76678
|
/* harmony import */ var _runtime_asn1_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../runtime/asn1.js */ "./node_modules/jose/dist/browser/runtime/asn1.js");
|
|
76040
76679
|
/* 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
76680
|
/* 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
|
-
|
|
76681
|
+
/* 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
76682
|
|
|
76047
76683
|
|
|
76048
76684
|
|
|
76049
76685
|
|
|
76050
76686
|
|
|
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
76687
|
async function importSPKI(spki, alg, options) {
|
|
76120
76688
|
if (typeof spki !== 'string' || spki.indexOf('-----BEGIN PUBLIC KEY-----') !== 0) {
|
|
76121
76689
|
throw new TypeError('"spki" must be SPKI formatted string');
|
|
@@ -76126,14 +76694,7 @@ async function importX509(x509, alg, options) {
|
|
|
76126
76694
|
if (typeof x509 !== 'string' || x509.indexOf('-----BEGIN CERTIFICATE-----') !== 0) {
|
|
76127
76695
|
throw new TypeError('"x509" must be X.509 formatted string');
|
|
76128
76696
|
}
|
|
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);
|
|
76697
|
+
return (0,_runtime_asn1_js__WEBPACK_IMPORTED_MODULE_1__.fromX509)(x509, alg, options);
|
|
76137
76698
|
}
|
|
76138
76699
|
async function importPKCS8(pkcs8, alg, options) {
|
|
76139
76700
|
if (typeof pkcs8 !== 'string' || pkcs8.indexOf('-----BEGIN PRIVATE KEY-----') !== 0) {
|
|
@@ -76143,13 +76704,10 @@ async function importPKCS8(pkcs8, alg, options) {
|
|
|
76143
76704
|
}
|
|
76144
76705
|
async function importJWK(jwk, alg, octAsKeyObject) {
|
|
76145
76706
|
var _a;
|
|
76146
|
-
if (!(0,
|
|
76707
|
+
if (!(0,_lib_is_object_js__WEBPACK_IMPORTED_MODULE_4__["default"])(jwk)) {
|
|
76147
76708
|
throw new TypeError('JWK must be an object');
|
|
76148
76709
|
}
|
|
76149
76710
|
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
76711
|
switch (jwk.kty) {
|
|
76154
76712
|
case 'oct':
|
|
76155
76713
|
if (typeof jwk.k !== 'string' || !jwk.k) {
|
|
@@ -76516,13 +77074,13 @@ function checkSigCryptoKey(key, alg, ...usages) {
|
|
|
76516
77074
|
throw unusable(`SHA-${expected}`, 'algorithm.hash');
|
|
76517
77075
|
break;
|
|
76518
77076
|
}
|
|
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
77077
|
case 'EdDSA': {
|
|
76525
77078
|
if (key.algorithm.name !== 'Ed25519' && key.algorithm.name !== 'Ed448') {
|
|
77079
|
+
if ((0,_runtime_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)()) {
|
|
77080
|
+
if (isAlgorithm(key.algorithm, 'NODE-ED25519'))
|
|
77081
|
+
break;
|
|
77082
|
+
throw unusable('Ed25519, Ed448, or NODE-ED25519');
|
|
77083
|
+
}
|
|
76526
77084
|
throw unusable('Ed25519 or Ed448');
|
|
76527
77085
|
}
|
|
76528
77086
|
break;
|
|
@@ -77338,6 +77896,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
77338
77896
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
77339
77897
|
/* harmony export */ "fromPKCS8": () => (/* binding */ fromPKCS8),
|
|
77340
77898
|
/* harmony export */ "fromSPKI": () => (/* binding */ fromSPKI),
|
|
77899
|
+
/* harmony export */ "fromX509": () => (/* binding */ fromX509),
|
|
77341
77900
|
/* harmony export */ "toPKCS8": () => (/* binding */ toPKCS8),
|
|
77342
77901
|
/* harmony export */ "toSPKI": () => (/* binding */ toSPKI)
|
|
77343
77902
|
/* harmony export */ });
|
|
@@ -77407,7 +77966,7 @@ const getNamedCurve = (keyData) => {
|
|
|
77407
77966
|
}
|
|
77408
77967
|
};
|
|
77409
77968
|
const genericImport = async (replace, keyFormat, pem, alg, options) => {
|
|
77410
|
-
var _a;
|
|
77969
|
+
var _a, _b;
|
|
77411
77970
|
let algorithm;
|
|
77412
77971
|
let keyUsages;
|
|
77413
77972
|
const keyData = new Uint8Array(atob(pem.replace(replace, ''))
|
|
@@ -77458,12 +78017,6 @@ const genericImport = async (replace, keyFormat, pem, alg, options) => {
|
|
|
77458
78017
|
keyUsages = isPublic ? [] : ['deriveBits'];
|
|
77459
78018
|
break;
|
|
77460
78019
|
}
|
|
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
78020
|
case 'EdDSA':
|
|
77468
78021
|
algorithm = { name: getNamedCurve(keyData) };
|
|
77469
78022
|
keyUsages = isPublic ? ['verify'] : ['sign'];
|
|
@@ -77471,7 +78024,18 @@ const genericImport = async (replace, keyFormat, pem, alg, options) => {
|
|
|
77471
78024
|
default:
|
|
77472
78025
|
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_5__.JOSENotSupported('Invalid or unsupported "alg" (Algorithm) value');
|
|
77473
78026
|
}
|
|
77474
|
-
|
|
78027
|
+
try {
|
|
78028
|
+
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);
|
|
78029
|
+
}
|
|
78030
|
+
catch (err) {
|
|
78031
|
+
if (algorithm.name === 'Ed25519' &&
|
|
78032
|
+
(err === null || err === void 0 ? void 0 : err.name) === 'NotSupportedError' &&
|
|
78033
|
+
(0,_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)()) {
|
|
78034
|
+
algorithm = { name: 'NODE-ED25519', namedCurve: 'NODE-ED25519' };
|
|
78035
|
+
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);
|
|
78036
|
+
}
|
|
78037
|
+
throw err;
|
|
78038
|
+
}
|
|
77475
78039
|
};
|
|
77476
78040
|
const fromPKCS8 = (pem, alg, options) => {
|
|
77477
78041
|
return genericImport(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g, 'pkcs8', pem, alg, options);
|
|
@@ -77479,6 +78043,84 @@ const fromPKCS8 = (pem, alg, options) => {
|
|
|
77479
78043
|
const fromSPKI = (pem, alg, options) => {
|
|
77480
78044
|
return genericImport(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, 'spki', pem, alg, options);
|
|
77481
78045
|
};
|
|
78046
|
+
function getElement(seq) {
|
|
78047
|
+
let result = [];
|
|
78048
|
+
let next = 0;
|
|
78049
|
+
while (next < seq.length) {
|
|
78050
|
+
let nextPart = parseElement(seq.subarray(next));
|
|
78051
|
+
result.push(nextPart);
|
|
78052
|
+
next += nextPart.byteLength;
|
|
78053
|
+
}
|
|
78054
|
+
return result;
|
|
78055
|
+
}
|
|
78056
|
+
function parseElement(bytes) {
|
|
78057
|
+
let position = 0;
|
|
78058
|
+
let tag = bytes[0] & 0x1f;
|
|
78059
|
+
position++;
|
|
78060
|
+
if (tag === 0x1f) {
|
|
78061
|
+
tag = 0;
|
|
78062
|
+
while (bytes[position] >= 0x80) {
|
|
78063
|
+
tag = tag * 128 + bytes[position] - 0x80;
|
|
78064
|
+
position++;
|
|
78065
|
+
}
|
|
78066
|
+
tag = tag * 128 + bytes[position] - 0x80;
|
|
78067
|
+
position++;
|
|
78068
|
+
}
|
|
78069
|
+
let length = 0;
|
|
78070
|
+
if (bytes[position] < 0x80) {
|
|
78071
|
+
length = bytes[position];
|
|
78072
|
+
position++;
|
|
78073
|
+
}
|
|
78074
|
+
else if (length === 0x80) {
|
|
78075
|
+
length = 0;
|
|
78076
|
+
while (bytes[position + length] !== 0 || bytes[position + length + 1] !== 0) {
|
|
78077
|
+
if (length > bytes.byteLength) {
|
|
78078
|
+
throw new TypeError('invalid indefinite form length');
|
|
78079
|
+
}
|
|
78080
|
+
length++;
|
|
78081
|
+
}
|
|
78082
|
+
const byteLength = position + length + 2;
|
|
78083
|
+
return {
|
|
78084
|
+
byteLength,
|
|
78085
|
+
contents: bytes.subarray(position, position + length),
|
|
78086
|
+
raw: bytes.subarray(0, byteLength),
|
|
78087
|
+
};
|
|
78088
|
+
}
|
|
78089
|
+
else {
|
|
78090
|
+
let numberOfDigits = bytes[position] & 0x7f;
|
|
78091
|
+
position++;
|
|
78092
|
+
length = 0;
|
|
78093
|
+
for (let i = 0; i < numberOfDigits; i++) {
|
|
78094
|
+
length = length * 256 + bytes[position];
|
|
78095
|
+
position++;
|
|
78096
|
+
}
|
|
78097
|
+
}
|
|
78098
|
+
const byteLength = position + length;
|
|
78099
|
+
return {
|
|
78100
|
+
byteLength,
|
|
78101
|
+
contents: bytes.subarray(position, byteLength),
|
|
78102
|
+
raw: bytes.subarray(0, byteLength),
|
|
78103
|
+
};
|
|
78104
|
+
}
|
|
78105
|
+
function spkiFromX509(buf) {
|
|
78106
|
+
const tbsCertificate = getElement(getElement(parseElement(buf).contents)[0].contents);
|
|
78107
|
+
return (0,_base64url_js__WEBPACK_IMPORTED_MODULE_3__.encodeBase64)(tbsCertificate[tbsCertificate[0].raw[0] === 0xa0 ? 6 : 5].raw);
|
|
78108
|
+
}
|
|
78109
|
+
function getSPKI(x509) {
|
|
78110
|
+
const pem = x509.replace(/(?:-----(?:BEGIN|END) CERTIFICATE-----|\s)/g, '');
|
|
78111
|
+
const raw = (0,_base64url_js__WEBPACK_IMPORTED_MODULE_3__.decodeBase64)(pem);
|
|
78112
|
+
return (0,_lib_format_pem_js__WEBPACK_IMPORTED_MODULE_4__["default"])(spkiFromX509(raw), 'PUBLIC KEY');
|
|
78113
|
+
}
|
|
78114
|
+
const fromX509 = (pem, alg, options) => {
|
|
78115
|
+
let spki;
|
|
78116
|
+
try {
|
|
78117
|
+
spki = getSPKI(pem);
|
|
78118
|
+
}
|
|
78119
|
+
catch (cause) {
|
|
78120
|
+
throw new TypeError('failed to parse the X.509 certificate', { cause });
|
|
78121
|
+
}
|
|
78122
|
+
return fromSPKI(spki, alg, options);
|
|
78123
|
+
};
|
|
77482
78124
|
|
|
77483
78125
|
|
|
77484
78126
|
/***/ }),
|
|
@@ -78036,7 +78678,7 @@ function getModulusLengthOption(options) {
|
|
|
78036
78678
|
return modulusLength;
|
|
78037
78679
|
}
|
|
78038
78680
|
async function generateKeyPair(alg, options) {
|
|
78039
|
-
var _a, _b, _c;
|
|
78681
|
+
var _a, _b, _c, _d;
|
|
78040
78682
|
let algorithm;
|
|
78041
78683
|
let keyUsages;
|
|
78042
78684
|
switch (alg) {
|
|
@@ -78086,17 +78728,6 @@ async function generateKeyPair(alg, options) {
|
|
|
78086
78728
|
algorithm = { name: 'ECDSA', namedCurve: 'P-521' };
|
|
78087
78729
|
keyUsages = ['sign', 'verify'];
|
|
78088
78730
|
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
78731
|
case 'EdDSA':
|
|
78101
78732
|
keyUsages = ['sign', 'verify'];
|
|
78102
78733
|
const crv = (_a = options === null || options === void 0 ? void 0 : options.crv) !== null && _a !== void 0 ? _a : 'Ed25519';
|
|
@@ -78134,7 +78765,18 @@ async function generateKeyPair(alg, options) {
|
|
|
78134
78765
|
default:
|
|
78135
78766
|
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
78136
78767
|
}
|
|
78137
|
-
|
|
78768
|
+
try {
|
|
78769
|
+
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));
|
|
78770
|
+
}
|
|
78771
|
+
catch (err) {
|
|
78772
|
+
if (algorithm.name === 'Ed25519' &&
|
|
78773
|
+
(err === null || err === void 0 ? void 0 : err.name) === 'NotSupportedError' &&
|
|
78774
|
+
(0,_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)()) {
|
|
78775
|
+
algorithm = { name: 'NODE-ED25519', namedCurve: 'NODE-ED25519' };
|
|
78776
|
+
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));
|
|
78777
|
+
}
|
|
78778
|
+
throw err;
|
|
78779
|
+
}
|
|
78138
78780
|
}
|
|
78139
78781
|
|
|
78140
78782
|
|
|
@@ -78314,19 +78956,6 @@ function subtleMapping(jwk) {
|
|
|
78314
78956
|
}
|
|
78315
78957
|
break;
|
|
78316
78958
|
}
|
|
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
78959
|
case 'OKP': {
|
|
78331
78960
|
switch (jwk.alg) {
|
|
78332
78961
|
case 'EdDSA':
|
|
@@ -78352,6 +78981,9 @@ function subtleMapping(jwk) {
|
|
|
78352
78981
|
}
|
|
78353
78982
|
const parse = async (jwk) => {
|
|
78354
78983
|
var _a, _b;
|
|
78984
|
+
if (!jwk.alg) {
|
|
78985
|
+
throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
|
|
78986
|
+
}
|
|
78355
78987
|
const { algorithm, keyUsages } = subtleMapping(jwk);
|
|
78356
78988
|
const rest = [
|
|
78357
78989
|
algorithm,
|
|
@@ -78364,7 +78996,18 @@ const parse = async (jwk) => {
|
|
|
78364
78996
|
const keyData = { ...jwk };
|
|
78365
78997
|
delete keyData.alg;
|
|
78366
78998
|
delete keyData.use;
|
|
78367
|
-
|
|
78999
|
+
try {
|
|
79000
|
+
return await _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.importKey('jwk', keyData, ...rest);
|
|
79001
|
+
}
|
|
79002
|
+
catch (err) {
|
|
79003
|
+
if (algorithm.name === 'Ed25519' &&
|
|
79004
|
+
(err === null || err === void 0 ? void 0 : err.name) === 'NotSupportedError' &&
|
|
79005
|
+
(0,_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)()) {
|
|
79006
|
+
rest[0] = { name: 'NODE-ED25519', namedCurve: 'NODE-ED25519' };
|
|
79007
|
+
return await _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.importKey('jwk', keyData, ...rest);
|
|
79008
|
+
}
|
|
79009
|
+
throw err;
|
|
79010
|
+
}
|
|
78368
79011
|
};
|
|
78369
79012
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (parse);
|
|
78370
79013
|
|
|
@@ -78629,10 +79272,10 @@ function subtleDsa(alg, algorithm) {
|
|
|
78629
79272
|
case 'ES384':
|
|
78630
79273
|
case 'ES512':
|
|
78631
79274
|
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
79275
|
case 'EdDSA':
|
|
79276
|
+
if ((0,_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)() && algorithm.name === 'NODE-ED25519') {
|
|
79277
|
+
return { name: 'NODE-ED25519', namedCurve: 'NODE-ED25519' };
|
|
79278
|
+
}
|
|
78636
79279
|
return { name: algorithm.name };
|
|
78637
79280
|
default:
|
|
78638
79281
|
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
|
|
@@ -79056,6 +79699,7 @@ class JWKSMultipleMatchingKeys extends JOSEError {
|
|
|
79056
79699
|
return 'ERR_JWKS_MULTIPLE_MATCHING_KEYS';
|
|
79057
79700
|
}
|
|
79058
79701
|
}
|
|
79702
|
+
Symbol.asyncIterator;
|
|
79059
79703
|
class JWKSTimeout extends JOSEError {
|
|
79060
79704
|
constructor() {
|
|
79061
79705
|
super(...arguments);
|