solid-ui 2.4.28-e3ba3633 → 2.4.28-e5cde855
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/805.solid-ui.min.js +1 -1
- package/dist/805.solid-ui.min.js.map +1 -1
- package/dist/solid-ui.js +2080 -1330
- package/dist/solid-ui.js.map +1 -1
- package/dist/solid-ui.min.js +1 -1
- package/dist/solid-ui.min.js.map +1 -1
- package/dist/vendors-node_modules_jsonld_lib_jsonld_js.solid-ui.js +1938 -1938
- package/dist/vendors-node_modules_jsonld_lib_jsonld_js.solid-ui.js.map +1 -1
- package/lib/chat/bookmarks.js +6 -7
- package/lib/chat/bookmarks.js.map +1 -1
- package/lib/chat/chatLogic.js +249 -65
- package/lib/chat/chatLogic.js.map +1 -1
- package/lib/chat/dateFolder.js +129 -126
- package/lib/chat/dateFolder.js.map +1 -1
- package/lib/chat/infinite.js +637 -423
- package/lib/chat/infinite.js.map +1 -1
- package/lib/chat/message.js +332 -193
- package/lib/chat/message.js.map +1 -1
- package/lib/chat/messageTools.js +463 -277
- package/lib/chat/messageTools.js.map +1 -1
- package/lib/chat/thread.js +299 -209
- package/lib/chat/thread.js.map +1 -1
- package/lib/header/index.js +5 -0
- package/lib/header/index.js.map +1 -1
- package/lib/log.js +5 -5
- package/lib/log.js.map +1 -1
- package/lib/login/login.js +24 -1
- package/lib/login/login.js.map +1 -1
- package/lib/media/media-capture.d.ts +2 -2
- package/lib/media/media-capture.d.ts.map +1 -1
- package/lib/media/media-capture.js +15 -11
- package/lib/media/media-capture.js.map +1 -1
- package/lib/pad.d.ts +2 -2
- package/lib/pad.d.ts.map +1 -1
- package/lib/pad.js +41 -15
- package/lib/pad.js.map +1 -1
- package/lib/participation.d.ts +5 -5
- package/lib/participation.d.ts.map +1 -1
- package/lib/participation.js +23 -22
- package/lib/participation.js.map +1 -1
- package/lib/preferences.js +4 -0
- package/lib/preferences.js.map +1 -1
- package/lib/style.js +28 -35
- package/lib/style.js.map +1 -1
- package/lib/tabs.d.ts +125 -0
- package/lib/tabs.d.ts.map +1 -1
- package/lib/tabs.js +8 -15
- package/lib/tabs.js.map +1 -1
- package/lib/utils/headerFooterHelpers.js +2 -0
- package/lib/utils/headerFooterHelpers.js.map +1 -1
- package/lib/versionInfo.js +2 -2
- package/lib/versionInfo.js.map +1 -1
- package/lib/widgets/buttons.js +0 -2
- package/lib/widgets/buttons.js.map +1 -1
- package/lib/widgets/dragAndDrop.js +18 -10
- package/lib/widgets/dragAndDrop.js.map +1 -1
- package/lib/widgets/error.d.ts.map +1 -1
- package/lib/widgets/error.js +2 -9
- package/lib/widgets/error.js.map +1 -1
- package/lib/widgets/forms/autocomplete/autocompleteBar.js +8 -1
- package/lib/widgets/forms/autocomplete/autocompleteBar.js.map +1 -1
- package/lib/widgets/forms/autocomplete/autocompletePicker.d.ts.map +1 -1
- package/lib/widgets/forms/autocomplete/autocompletePicker.js +9 -5
- package/lib/widgets/forms/autocomplete/autocompletePicker.js.map +1 -1
- package/lib/widgets/forms/autocomplete/language.js +5 -0
- package/lib/widgets/forms/autocomplete/language.js.map +1 -1
- package/lib/widgets/forms/basic.d.ts.map +1 -1
- package/lib/widgets/forms/basic.js +3 -4
- package/lib/widgets/forms/basic.js.map +1 -1
- package/lib/widgets/forms/fieldParams.js +2 -2
- package/lib/widgets/forms/fieldParams.js.map +1 -1
- package/lib/widgets/forms.js +12 -10
- package/lib/widgets/forms.js.map +1 -1
- package/lib/widgets/peoplePicker.js +11 -0
- package/lib/widgets/peoplePicker.js.map +1 -1
- package/package.json +3 -2
- package/lib/styleConstants.js +0 -34
- package/lib/styleConstants.js.map +0 -1
package/dist/solid-ui.js
CHANGED
|
@@ -2249,8 +2249,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
2249
2249
|
* @packageDocumentation
|
|
2250
2250
|
*/
|
|
2251
2251
|
|
|
2252
|
-
/* global alert confirm */
|
|
2253
|
-
|
|
2254
2252
|
// pull in first avoid cross-refs
|
|
2255
2253
|
|
|
2256
2254
|
var UI = {
|
|
@@ -2343,7 +2341,8 @@ function _findBookmarkDocument() {
|
|
|
2343
2341
|
}
|
|
2344
2342
|
userContext.bookmarkDocument = userContext.instances[0];
|
|
2345
2343
|
if (userContext.instances.length > 1) {
|
|
2346
|
-
|
|
2344
|
+
debug.warn('More than one bookmark file! ' + userContext.instances); // @@ todo - deal with > 1
|
|
2345
|
+
// Note: should pick up community bookmarks as well
|
|
2347
2346
|
}
|
|
2348
2347
|
_context.next = 28;
|
|
2349
2348
|
break;
|
|
@@ -2364,7 +2363,7 @@ function _findBookmarkDocument() {
|
|
|
2364
2363
|
case 18:
|
|
2365
2364
|
_context.prev = 18;
|
|
2366
2365
|
_context.t0 = _context["catch"](12);
|
|
2367
|
-
|
|
2366
|
+
debug.warn("Can't make fresh bookmark file:" + _context.t0);
|
|
2368
2367
|
return _context.abrupt("return", userContext);
|
|
2369
2368
|
case 22:
|
|
2370
2369
|
_context.next = 24;
|
|
@@ -2374,7 +2373,7 @@ function _findBookmarkDocument() {
|
|
|
2374
2373
|
_context.next = 28;
|
|
2375
2374
|
break;
|
|
2376
2375
|
case 27:
|
|
2377
|
-
|
|
2376
|
+
debug.warn('You seem to have no bookmark file, nor even a profile file!');
|
|
2378
2377
|
case 28:
|
|
2379
2378
|
return _context.abrupt("return", userContext);
|
|
2380
2379
|
case 29:
|
|
@@ -2429,7 +2428,7 @@ function _addBookmark() {
|
|
|
2429
2428
|
_context2.prev = 14;
|
|
2430
2429
|
_context2.t0 = _context2["catch"](9);
|
|
2431
2430
|
msg = 'Making bookmark: ' + _context2.t0;
|
|
2432
|
-
|
|
2431
|
+
debug.warn(msg);
|
|
2433
2432
|
return _context2.abrupt("return", null);
|
|
2434
2433
|
case 19:
|
|
2435
2434
|
return _context2.abrupt("return", bookmark);
|
|
@@ -2482,7 +2481,7 @@ function _toggleBookmark() {
|
|
|
2482
2481
|
_context3.prev = 15;
|
|
2483
2482
|
_context3.t0 = _context3["catch"](8);
|
|
2484
2483
|
debug.error('Cant delete bookmark:' + _context3.t0);
|
|
2485
|
-
|
|
2484
|
+
debug.warn('Cannot delete bookmark:' + _context3.t0);
|
|
2486
2485
|
case 19:
|
|
2487
2486
|
i++;
|
|
2488
2487
|
_context3.next = 7;
|
|
@@ -2577,6 +2576,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
2577
2576
|
}));
|
|
2578
2577
|
exports.ChatChannel = void 0;
|
|
2579
2578
|
exports._createIfNotExists = _createIfNotExists;
|
|
2579
|
+
exports.allVersions = allVersions;
|
|
2580
2580
|
exports.isDeleted = isDeleted;
|
|
2581
2581
|
exports.isHidden = isHidden;
|
|
2582
2582
|
exports.isReplaced = isReplaced;
|
|
@@ -2654,8 +2654,9 @@ var ChatChannel = /*#__PURE__*/function () {
|
|
|
2654
2654
|
var _this = this;
|
|
2655
2655
|
var oldMsg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
2656
2656
|
var deleteIt = arguments.length > 2 ? arguments[2] : undefined;
|
|
2657
|
+
var thread = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
2657
2658
|
return /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
2658
|
-
var sts, now, timestamp, dateStamp, chatDocument, message, me, msg, oldMsgMaker, errMsg, privateKey, sig, _errMsg;
|
|
2659
|
+
var sts, now, timestamp, dateStamp, chatDocument, message, me, msg, oldMsgMaker, oldMsgMostRecentVersion, oldMsgThread, errMsg, privateKey, sig, _errMsg;
|
|
2659
2660
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
2660
2661
|
while (1) switch (_context2.prev = _context2.next) {
|
|
2661
2662
|
case 0:
|
|
@@ -2669,73 +2670,88 @@ var ChatChannel = /*#__PURE__*/function () {
|
|
|
2669
2670
|
msg = (0, _signature.getBlankMsg)();
|
|
2670
2671
|
msg.id = message.uri;
|
|
2671
2672
|
if (!oldMsg) {
|
|
2672
|
-
_context2.next =
|
|
2673
|
+
_context2.next = 27;
|
|
2673
2674
|
break;
|
|
2674
2675
|
}
|
|
2675
2676
|
// edit message replaces old one
|
|
2676
2677
|
oldMsgMaker = _solidLogic.store.any(oldMsg, ns.foaf('maker')); // may not be needed here, but needed on READ
|
|
2677
2678
|
if (!(oldMsgMaker.uri === me.uri)) {
|
|
2678
|
-
_context2.next =
|
|
2679
|
+
_context2.next = 21;
|
|
2679
2680
|
break;
|
|
2680
2681
|
}
|
|
2681
|
-
|
|
2682
|
+
_context2.next = 14;
|
|
2683
|
+
return mostRecentVersion(oldMsg);
|
|
2684
|
+
case 14:
|
|
2685
|
+
oldMsgMostRecentVersion = _context2.sent;
|
|
2686
|
+
sts.push($rdf.st(oldMsgMostRecentVersion, ns.dct('isReplacedBy'), message, chatDocument));
|
|
2687
|
+
// if oldMsg has_reply => add has_reply to message
|
|
2688
|
+
oldMsgThread = _solidLogic.store.any(oldMsgMostRecentVersion, ns.sioc('has_reply'));
|
|
2689
|
+
if (oldMsgThread) {
|
|
2690
|
+
sts.push($rdf.st(message, ns.sioc('has_reply'), oldMsgThread, chatDocument));
|
|
2691
|
+
}
|
|
2682
2692
|
if (deleteIt) {
|
|
2683
2693
|
// we need to add a specific signature, else anyone can delete a msg ?
|
|
2684
2694
|
sts.push($rdf.st(message, ns.schema('dateDeleted'), dateStamp, chatDocument));
|
|
2685
2695
|
}
|
|
2686
|
-
_context2.next =
|
|
2696
|
+
_context2.next = 25;
|
|
2687
2697
|
break;
|
|
2688
|
-
case
|
|
2698
|
+
case 21:
|
|
2689
2699
|
errMsg = 'Error you cannot delete/edit a message from someone else : \n' + oldMsgMaker.uri;
|
|
2690
2700
|
debug.warn(errMsg);
|
|
2691
2701
|
alert(errMsg);
|
|
2692
2702
|
throw new Error(errMsg);
|
|
2693
|
-
case
|
|
2694
|
-
_context2.next =
|
|
2703
|
+
case 25:
|
|
2704
|
+
_context2.next = 28;
|
|
2695
2705
|
break;
|
|
2696
|
-
case
|
|
2706
|
+
case 27:
|
|
2697
2707
|
// link new message to channel
|
|
2698
2708
|
sts.push($rdf.st(_this.channel, ns.wf('message'), message, chatDocument));
|
|
2699
|
-
case
|
|
2709
|
+
case 28:
|
|
2700
2710
|
sts.push($rdf.st(message, ns.sioc('content'), _solidLogic.store.literal(text), chatDocument));
|
|
2701
2711
|
msg.content = text;
|
|
2702
2712
|
sts.push($rdf.st(message, ns.dct('created'), dateStamp, chatDocument));
|
|
2703
2713
|
msg.created = dateStamp.value;
|
|
2704
2714
|
if (!me) {
|
|
2705
|
-
_context2.next =
|
|
2715
|
+
_context2.next = 40;
|
|
2706
2716
|
break;
|
|
2707
2717
|
}
|
|
2708
2718
|
sts.push($rdf.st(message, ns.foaf('maker'), me, chatDocument));
|
|
2709
2719
|
msg.maker = me.uri;
|
|
2710
2720
|
// privateKey the cached private key of me, cached in store
|
|
2711
|
-
_context2.next =
|
|
2721
|
+
_context2.next = 37;
|
|
2712
2722
|
return (0, _keys.getPrivateKey)(me);
|
|
2713
|
-
case
|
|
2723
|
+
case 37:
|
|
2714
2724
|
privateKey = _context2.sent;
|
|
2715
2725
|
// me.uri)
|
|
2716
2726
|
sig = (0, _signature.signMsg)(msg, privateKey);
|
|
2717
2727
|
sts.push($rdf.st(message, $rdf.sym("".concat(_signature.SEC, "proofValue")), $rdf.lit(sig), chatDocument));
|
|
2718
|
-
case 35:
|
|
2719
|
-
_context2.prev = 35;
|
|
2720
|
-
_context2.next = 38;
|
|
2721
|
-
return _solidLogic.store.updater.update([], sts);
|
|
2722
|
-
case 38:
|
|
2723
|
-
_context2.next = 46;
|
|
2724
|
-
break;
|
|
2725
2728
|
case 40:
|
|
2726
|
-
|
|
2727
|
-
|
|
2729
|
+
if (thread) {
|
|
2730
|
+
sts.push($rdf.st(thread, ns.sioc('has_member'), message, chatDocument));
|
|
2731
|
+
if (!thread.doc().sameTerm(message.doc())) {
|
|
2732
|
+
sts.push($rdf.st(thread, ns.sioc('has_member'), message, thread.doc()));
|
|
2733
|
+
}
|
|
2734
|
+
}
|
|
2735
|
+
_context2.prev = 41;
|
|
2736
|
+
_context2.next = 44;
|
|
2737
|
+
return _solidLogic.store.updater.updateMany([], sts);
|
|
2738
|
+
case 44:
|
|
2739
|
+
_context2.next = 52;
|
|
2740
|
+
break;
|
|
2741
|
+
case 46:
|
|
2742
|
+
_context2.prev = 46;
|
|
2743
|
+
_context2.t0 = _context2["catch"](41);
|
|
2728
2744
|
_errMsg = 'Error saving chat message: ' + _context2.t0;
|
|
2729
2745
|
debug.warn(_errMsg);
|
|
2730
2746
|
alert(_errMsg);
|
|
2731
2747
|
throw new Error(_errMsg);
|
|
2732
|
-
case
|
|
2748
|
+
case 52:
|
|
2733
2749
|
return _context2.abrupt("return", message);
|
|
2734
|
-
case
|
|
2750
|
+
case 53:
|
|
2735
2751
|
case "end":
|
|
2736
2752
|
return _context2.stop();
|
|
2737
2753
|
}
|
|
2738
|
-
}, _callee2, null, [[
|
|
2754
|
+
}, _callee2, null, [[41, 46]]);
|
|
2739
2755
|
})();
|
|
2740
2756
|
});
|
|
2741
2757
|
function updateMessage(_x2) {
|
|
@@ -2765,26 +2781,187 @@ var ChatChannel = /*#__PURE__*/function () {
|
|
|
2765
2781
|
return _deleteMessage.apply(this, arguments);
|
|
2766
2782
|
}
|
|
2767
2783
|
return deleteMessage;
|
|
2784
|
+
}() // Create a new thread of replies to the thread root message
|
|
2785
|
+
// or return one which already exists
|
|
2786
|
+
}, {
|
|
2787
|
+
key: "createThread",
|
|
2788
|
+
value: function () {
|
|
2789
|
+
var _createThread = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(threadRoot) {
|
|
2790
|
+
var already, thread, insert;
|
|
2791
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
2792
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
2793
|
+
case 0:
|
|
2794
|
+
already = _solidLogic.store.each(threadRoot, ns.sioc('has_reply'), null, threadRoot.doc()).filter(function (thread) {
|
|
2795
|
+
return _solidLogic.store.holds(thread, ns.rdf('type'), ns.sioc('Thread'), thread.doc());
|
|
2796
|
+
});
|
|
2797
|
+
if (!(already.length > 0)) {
|
|
2798
|
+
_context4.next = 3;
|
|
2799
|
+
break;
|
|
2800
|
+
}
|
|
2801
|
+
return _context4.abrupt("return", already[0]);
|
|
2802
|
+
case 3:
|
|
2803
|
+
thread = $rdf.sym(threadRoot.uri + '-thread');
|
|
2804
|
+
insert = [$rdf.st(thread, ns.rdf('type'), ns.sioc('Thread'), thread.doc()), $rdf.st(threadRoot, ns.sioc('has_reply'), thread, thread.doc())];
|
|
2805
|
+
_context4.next = 7;
|
|
2806
|
+
return _solidLogic.store.updater.update([], insert);
|
|
2807
|
+
case 7:
|
|
2808
|
+
return _context4.abrupt("return", thread);
|
|
2809
|
+
case 8:
|
|
2810
|
+
case "end":
|
|
2811
|
+
return _context4.stop();
|
|
2812
|
+
}
|
|
2813
|
+
}, _callee4);
|
|
2814
|
+
}));
|
|
2815
|
+
function createThread(_x4) {
|
|
2816
|
+
return _createThread.apply(this, arguments);
|
|
2817
|
+
}
|
|
2818
|
+
return createThread;
|
|
2768
2819
|
}()
|
|
2769
2820
|
}]);
|
|
2770
2821
|
return ChatChannel;
|
|
2771
2822
|
}(); // class ChatChannel
|
|
2823
|
+
// ////////// Utility functions
|
|
2824
|
+
// Have to not loop forever if fed loops
|
|
2772
2825
|
exports.ChatChannel = ChatChannel;
|
|
2773
|
-
function
|
|
2774
|
-
|
|
2775
|
-
while (msg) {
|
|
2776
|
-
message = msg;
|
|
2777
|
-
msg = _solidLogic.store.any(null, ns.dct('isReplacedBy'), message, message.doc());
|
|
2778
|
-
}
|
|
2779
|
-
return message;
|
|
2826
|
+
function allVersions(_x5) {
|
|
2827
|
+
return _allVersions.apply(this, arguments);
|
|
2780
2828
|
}
|
|
2781
|
-
function
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2829
|
+
function _allVersions() {
|
|
2830
|
+
_allVersions = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(message) {
|
|
2831
|
+
var versions, done, m, prev, next;
|
|
2832
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
2833
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
2834
|
+
case 0:
|
|
2835
|
+
versions = [message];
|
|
2836
|
+
done = {};
|
|
2837
|
+
done[message.uri] = true;
|
|
2838
|
+
m = message;
|
|
2839
|
+
case 4:
|
|
2840
|
+
if (false) {}
|
|
2841
|
+
// earlier?
|
|
2842
|
+
prev = _solidLogic.store.any(null, ns.dct('isReplacedBy'), m, m.doc());
|
|
2843
|
+
if (!(!prev || done[prev.uri])) {
|
|
2844
|
+
_context5.next = 8;
|
|
2845
|
+
break;
|
|
2846
|
+
}
|
|
2847
|
+
return _context5.abrupt("break", 15);
|
|
2848
|
+
case 8:
|
|
2849
|
+
_context5.next = 10;
|
|
2850
|
+
return _solidLogic.store.fetcher.load(prev);
|
|
2851
|
+
case 10:
|
|
2852
|
+
versions.unshift(prev);
|
|
2853
|
+
done[prev.uri] = true;
|
|
2854
|
+
m = prev;
|
|
2855
|
+
_context5.next = 4;
|
|
2856
|
+
break;
|
|
2857
|
+
case 15:
|
|
2858
|
+
m = message;
|
|
2859
|
+
case 16:
|
|
2860
|
+
if (false) {}
|
|
2861
|
+
// later?
|
|
2862
|
+
next = _solidLogic.store.any(m, ns.dct('isReplacedBy'), null, m.doc());
|
|
2863
|
+
if (!(!next || done[next.uri])) {
|
|
2864
|
+
_context5.next = 20;
|
|
2865
|
+
break;
|
|
2866
|
+
}
|
|
2867
|
+
return _context5.abrupt("break", 25);
|
|
2868
|
+
case 20:
|
|
2869
|
+
versions.push(next);
|
|
2870
|
+
done[next.uri] = true;
|
|
2871
|
+
m = next;
|
|
2872
|
+
_context5.next = 16;
|
|
2873
|
+
break;
|
|
2874
|
+
case 25:
|
|
2875
|
+
return _context5.abrupt("return", versions);
|
|
2876
|
+
case 26:
|
|
2877
|
+
case "end":
|
|
2878
|
+
return _context5.stop();
|
|
2879
|
+
}
|
|
2880
|
+
}, _callee5);
|
|
2881
|
+
}));
|
|
2882
|
+
return _allVersions.apply(this, arguments);
|
|
2883
|
+
}
|
|
2884
|
+
function originalVersion(_x6) {
|
|
2885
|
+
return _originalVersion.apply(this, arguments);
|
|
2886
|
+
}
|
|
2887
|
+
function _originalVersion() {
|
|
2888
|
+
_originalVersion = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(message) {
|
|
2889
|
+
var msg, done;
|
|
2890
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
2891
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
2892
|
+
case 0:
|
|
2893
|
+
msg = message;
|
|
2894
|
+
done = {}; // done[message.uri] = true
|
|
2895
|
+
case 2:
|
|
2896
|
+
if (!msg) {
|
|
2897
|
+
_context6.next = 13;
|
|
2898
|
+
break;
|
|
2899
|
+
}
|
|
2900
|
+
if (!done[msg.uri]) {
|
|
2901
|
+
_context6.next = 6;
|
|
2902
|
+
break;
|
|
2903
|
+
}
|
|
2904
|
+
debug.error('originalVersion: verion loop' + message);
|
|
2905
|
+
return _context6.abrupt("return", message);
|
|
2906
|
+
case 6:
|
|
2907
|
+
done[msg.uri] = true;
|
|
2908
|
+
message = msg;
|
|
2909
|
+
_context6.next = 10;
|
|
2910
|
+
return _solidLogic.store.fetcher.load(message);
|
|
2911
|
+
case 10:
|
|
2912
|
+
msg = _solidLogic.store.any(null, ns.dct('isReplacedBy'), message, message.doc());
|
|
2913
|
+
_context6.next = 2;
|
|
2914
|
+
break;
|
|
2915
|
+
case 13:
|
|
2916
|
+
return _context6.abrupt("return", message);
|
|
2917
|
+
case 14:
|
|
2918
|
+
case "end":
|
|
2919
|
+
return _context6.stop();
|
|
2920
|
+
}
|
|
2921
|
+
}, _callee6);
|
|
2922
|
+
}));
|
|
2923
|
+
return _originalVersion.apply(this, arguments);
|
|
2924
|
+
}
|
|
2925
|
+
function mostRecentVersion(_x7) {
|
|
2926
|
+
return _mostRecentVersion.apply(this, arguments);
|
|
2927
|
+
}
|
|
2928
|
+
function _mostRecentVersion() {
|
|
2929
|
+
_mostRecentVersion = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(message) {
|
|
2930
|
+
var msg, done;
|
|
2931
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
2932
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
2933
|
+
case 0:
|
|
2934
|
+
msg = message;
|
|
2935
|
+
done = {};
|
|
2936
|
+
case 2:
|
|
2937
|
+
if (!msg) {
|
|
2938
|
+
_context7.next = 13;
|
|
2939
|
+
break;
|
|
2940
|
+
}
|
|
2941
|
+
if (!done[msg.uri]) {
|
|
2942
|
+
_context7.next = 6;
|
|
2943
|
+
break;
|
|
2944
|
+
}
|
|
2945
|
+
debug.error('mostRecentVersion: verion loop' + message);
|
|
2946
|
+
return _context7.abrupt("return", message);
|
|
2947
|
+
case 6:
|
|
2948
|
+
done[msg.uri] = true;
|
|
2949
|
+
message = msg;
|
|
2950
|
+
_context7.next = 10;
|
|
2951
|
+
return _solidLogic.store.fetcher.load(message);
|
|
2952
|
+
case 10:
|
|
2953
|
+
msg = _solidLogic.store.any(message, ns.dct('isReplacedBy'), null, message.doc());
|
|
2954
|
+
_context7.next = 2;
|
|
2955
|
+
break;
|
|
2956
|
+
case 13:
|
|
2957
|
+
return _context7.abrupt("return", message);
|
|
2958
|
+
case 14:
|
|
2959
|
+
case "end":
|
|
2960
|
+
return _context7.stop();
|
|
2961
|
+
}
|
|
2962
|
+
}, _callee7);
|
|
2963
|
+
}));
|
|
2964
|
+
return _mostRecentVersion.apply(this, arguments);
|
|
2788
2965
|
}
|
|
2789
2966
|
function isDeleted(message) {
|
|
2790
2967
|
return _solidLogic.store.holds(message, ns.schema('dateDeleted'), null, message.doc());
|
|
@@ -2803,62 +2980,62 @@ function nick(person) {
|
|
|
2803
2980
|
if (s) return '' + s.value;
|
|
2804
2981
|
return '' + utils.label(person);
|
|
2805
2982
|
}
|
|
2806
|
-
function _createIfNotExists(
|
|
2983
|
+
function _createIfNotExists(_x8) {
|
|
2807
2984
|
return _createIfNotExists2.apply(this, arguments);
|
|
2808
2985
|
} // ends
|
|
2809
2986
|
function _createIfNotExists2() {
|
|
2810
2987
|
_createIfNotExists2 = (0, _asyncToGenerator2["default"])(function (doc) {
|
|
2811
2988
|
var contentType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'text/turtle';
|
|
2812
2989
|
var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
2813
|
-
return /*#__PURE__*/_regenerator["default"].mark(function
|
|
2990
|
+
return /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
|
|
2814
2991
|
var response;
|
|
2815
|
-
return _regenerator["default"].wrap(function
|
|
2816
|
-
while (1) switch (
|
|
2992
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
2993
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
2817
2994
|
case 0:
|
|
2818
|
-
|
|
2819
|
-
|
|
2995
|
+
_context8.prev = 0;
|
|
2996
|
+
_context8.next = 3;
|
|
2820
2997
|
return _solidLogic.store.fetcher.load(doc);
|
|
2821
2998
|
case 3:
|
|
2822
|
-
response =
|
|
2823
|
-
|
|
2999
|
+
response = _context8.sent;
|
|
3000
|
+
_context8.next = 26;
|
|
2824
3001
|
break;
|
|
2825
3002
|
case 6:
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
if (!(
|
|
2829
|
-
|
|
3003
|
+
_context8.prev = 6;
|
|
3004
|
+
_context8.t0 = _context8["catch"](0);
|
|
3005
|
+
if (!(_context8.t0.response.status === 404)) {
|
|
3006
|
+
_context8.next = 24;
|
|
2830
3007
|
break;
|
|
2831
3008
|
}
|
|
2832
3009
|
debug.log('createIfNotExists: doc does NOT exist, will create... ' + doc);
|
|
2833
|
-
|
|
2834
|
-
|
|
3010
|
+
_context8.prev = 10;
|
|
3011
|
+
_context8.next = 13;
|
|
2835
3012
|
return _solidLogic.store.fetcher.webOperation('PUT', doc.uri, {
|
|
2836
3013
|
data: data,
|
|
2837
3014
|
contentType: contentType
|
|
2838
3015
|
});
|
|
2839
3016
|
case 13:
|
|
2840
|
-
response =
|
|
2841
|
-
|
|
3017
|
+
response = _context8.sent;
|
|
3018
|
+
_context8.next = 20;
|
|
2842
3019
|
break;
|
|
2843
3020
|
case 16:
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
debug.log('createIfNotExists doc FAILED: ' + doc + ': ' +
|
|
2847
|
-
throw
|
|
3021
|
+
_context8.prev = 16;
|
|
3022
|
+
_context8.t1 = _context8["catch"](10);
|
|
3023
|
+
debug.log('createIfNotExists doc FAILED: ' + doc + ': ' + _context8.t1);
|
|
3024
|
+
throw _context8.t1;
|
|
2848
3025
|
case 20:
|
|
2849
3026
|
delete _solidLogic.store.fetcher.requested[doc.uri]; // delete cached 404 error
|
|
2850
3027
|
// debug.log('createIfNotExists doc created ok ' + doc)
|
|
2851
|
-
return
|
|
3028
|
+
return _context8.abrupt("return", response);
|
|
2852
3029
|
case 24:
|
|
2853
|
-
debug.log('createIfNotExists doc load error NOT 404: ' + doc + ': ' +
|
|
2854
|
-
throw
|
|
3030
|
+
debug.log('createIfNotExists doc load error NOT 404: ' + doc + ': ' + _context8.t0);
|
|
3031
|
+
throw _context8.t0;
|
|
2855
3032
|
case 26:
|
|
2856
|
-
return
|
|
3033
|
+
return _context8.abrupt("return", response);
|
|
2857
3034
|
case 27:
|
|
2858
3035
|
case "end":
|
|
2859
|
-
return
|
|
3036
|
+
return _context8.stop();
|
|
2860
3037
|
}
|
|
2861
|
-
},
|
|
3038
|
+
}, _callee8, null, [[0, 6], [10, 16]]);
|
|
2862
3039
|
})();
|
|
2863
3040
|
});
|
|
2864
3041
|
return _createIfNotExists2.apply(this, arguments);
|
|
@@ -2882,10 +3059,11 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
2882
3059
|
value: true
|
|
2883
3060
|
}));
|
|
2884
3061
|
exports.DateFolder = void 0;
|
|
3062
|
+
exports.emptyLeaf = emptyLeaf;
|
|
2885
3063
|
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
|
|
2886
|
-
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
2887
3064
|
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"));
|
|
2888
3065
|
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"));
|
|
3066
|
+
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
2889
3067
|
var debug = _interopRequireWildcard(__webpack_require__(/*! ../debug */ "./lib/debug.js"));
|
|
2890
3068
|
var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
|
|
2891
3069
|
var ns = _interopRequireWildcard(__webpack_require__(/*! ../ns */ "./lib/ns.js"));
|
|
@@ -2898,9 +3076,29 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
2898
3076
|
*
|
|
2899
3077
|
*/
|
|
2900
3078
|
// pull in first avoid cross-refs
|
|
3079
|
+
function emptyLeaf(_x) {
|
|
3080
|
+
return _emptyLeaf.apply(this, arguments);
|
|
3081
|
+
}
|
|
2901
3082
|
/**
|
|
2902
3083
|
* Track back through the YYYY/MM/DD tree to find the previous/next day
|
|
2903
3084
|
*/
|
|
3085
|
+
function _emptyLeaf() {
|
|
3086
|
+
_emptyLeaf = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(leafDocument) {
|
|
3087
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
3088
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
3089
|
+
case 0:
|
|
3090
|
+
_context5.next = 2;
|
|
3091
|
+
return _solidLogic.store.fetcher.load(leafDocument);
|
|
3092
|
+
case 2:
|
|
3093
|
+
return _context5.abrupt("return", !(_solidLogic.store.statementsMatching(null, ns.dct('created'), null, leafDocument).length > 0));
|
|
3094
|
+
case 3:
|
|
3095
|
+
case "end":
|
|
3096
|
+
return _context5.stop();
|
|
3097
|
+
}
|
|
3098
|
+
}, _callee5);
|
|
3099
|
+
}));
|
|
3100
|
+
return _emptyLeaf.apply(this, arguments);
|
|
3101
|
+
}
|
|
2904
3102
|
var DateFolder = /*#__PURE__*/function () {
|
|
2905
3103
|
function DateFolder(rootThing, leafFileName, membershipProperty) {
|
|
2906
3104
|
(0, _classCallCheck2["default"])(this, DateFolder);
|
|
@@ -2939,61 +3137,22 @@ var DateFolder = /*#__PURE__*/function () {
|
|
|
2939
3137
|
}, {
|
|
2940
3138
|
key: "loadPrevious",
|
|
2941
3139
|
value: function () {
|
|
2942
|
-
var _loadPrevious = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
2943
|
-
var
|
|
2944
|
-
return _regenerator["default"].wrap(function
|
|
2945
|
-
while (1) switch (
|
|
3140
|
+
var _loadPrevious = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(date, backwards) {
|
|
3141
|
+
var previousPeriod, _previousPeriod, folder, found, leafDocument, nextDate;
|
|
3142
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
3143
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
2946
3144
|
case 0:
|
|
2947
3145
|
_previousPeriod = function _previousPeriod3() {
|
|
2948
|
-
_previousPeriod = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
2949
|
-
var younger, suitable,
|
|
2950
|
-
return _regenerator["default"].wrap(function
|
|
2951
|
-
while (1) switch (
|
|
3146
|
+
_previousPeriod = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(file, level) {
|
|
3147
|
+
var younger, suitable, lastOrFirst, parent, siblings, _folder, uncle, cousins, result;
|
|
3148
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
3149
|
+
while (1) switch (_context.prev = _context.next) {
|
|
2952
3150
|
case 0:
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
case 0:
|
|
2959
|
-
siblings = siblings.filter(suitable);
|
|
2960
|
-
siblings.sort(); // chronological order
|
|
2961
|
-
if (!backwards) siblings.reverse();
|
|
2962
|
-
if (!(level !== 3)) {
|
|
2963
|
-
_context.next = 5;
|
|
2964
|
-
break;
|
|
2965
|
-
}
|
|
2966
|
-
return _context.abrupt("return", siblings.pop());
|
|
2967
|
-
case 5:
|
|
2968
|
-
if (!siblings.length) {
|
|
2969
|
-
_context.next = 14;
|
|
2970
|
-
break;
|
|
2971
|
-
}
|
|
2972
|
-
_folder2 = siblings.pop();
|
|
2973
|
-
leafDocument = _solidLogic.store.sym(_folder2.uri + thisDateFolder.leafFileName);
|
|
2974
|
-
_context.next = 10;
|
|
2975
|
-
return _solidLogic.store.fetcher.load(leafDocument);
|
|
2976
|
-
case 10:
|
|
2977
|
-
if (!(_solidLogic.store.statementsMatching(null, ns.dct('created'), null, leafDocument).length > 0)) {
|
|
2978
|
-
_context.next = 12;
|
|
2979
|
-
break;
|
|
2980
|
-
}
|
|
2981
|
-
return _context.abrupt("return", _folder2);
|
|
2982
|
-
case 12:
|
|
2983
|
-
_context.next = 5;
|
|
2984
|
-
break;
|
|
2985
|
-
case 14:
|
|
2986
|
-
return _context.abrupt("return", null);
|
|
2987
|
-
case 15:
|
|
2988
|
-
case "end":
|
|
2989
|
-
return _context.stop();
|
|
2990
|
-
}
|
|
2991
|
-
}, _callee);
|
|
2992
|
-
}));
|
|
2993
|
-
return _lastNonEmpty.apply(this, arguments);
|
|
2994
|
-
};
|
|
2995
|
-
lastNonEmpty = function _lastNonEmpty2(_x5) {
|
|
2996
|
-
return _lastNonEmpty.apply(this, arguments);
|
|
3151
|
+
lastOrFirst = function _lastOrFirst(siblings) {
|
|
3152
|
+
siblings = siblings.filter(suitable);
|
|
3153
|
+
siblings.sort(); // chronological order
|
|
3154
|
+
if (!backwards) siblings.reverse();
|
|
3155
|
+
return siblings.pop(); // date folder
|
|
2997
3156
|
};
|
|
2998
3157
|
suitable = function _suitable(x) {
|
|
2999
3158
|
var tail = x.uri.slice(0, -1).split('/').slice(-1)[0];
|
|
@@ -3006,97 +3165,115 @@ var DateFolder = /*#__PURE__*/function () {
|
|
|
3006
3165
|
};
|
|
3007
3166
|
// debug.log(' previousPeriod level' + level + ' file ' + file)
|
|
3008
3167
|
parent = file.dir();
|
|
3009
|
-
|
|
3010
|
-
|
|
3168
|
+
_context.prev = 4;
|
|
3169
|
+
_context.next = 7;
|
|
3011
3170
|
return _solidLogic.store.fetcher.load(parent);
|
|
3012
|
-
case
|
|
3171
|
+
case 7:
|
|
3013
3172
|
siblings = _solidLogic.store.each(parent, ns.ldp('contains'));
|
|
3014
3173
|
siblings = siblings.filter(younger);
|
|
3015
|
-
|
|
3016
|
-
return lastNonEmpty(siblings);
|
|
3017
|
-
case 12:
|
|
3018
|
-
_folder = _context2.sent;
|
|
3174
|
+
_folder = lastOrFirst(siblings);
|
|
3019
3175
|
if (!_folder) {
|
|
3020
|
-
|
|
3176
|
+
_context.next = 12;
|
|
3021
3177
|
break;
|
|
3022
3178
|
}
|
|
3023
|
-
return
|
|
3024
|
-
case
|
|
3025
|
-
|
|
3179
|
+
return _context.abrupt("return", _folder);
|
|
3180
|
+
case 12:
|
|
3181
|
+
debug.log(' parent no suitable offspring ' + parent);
|
|
3182
|
+
_context.next = 23;
|
|
3026
3183
|
break;
|
|
3027
|
-
case
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
if (!(
|
|
3031
|
-
|
|
3184
|
+
case 15:
|
|
3185
|
+
_context.prev = 15;
|
|
3186
|
+
_context.t0 = _context["catch"](4);
|
|
3187
|
+
if (!(_context.t0.response && _context.t0.response.status && _context.t0.response.status === 404)) {
|
|
3188
|
+
_context.next = 21;
|
|
3032
3189
|
break;
|
|
3033
3190
|
}
|
|
3034
3191
|
debug.log('Error 404 for chat parent file ' + parent);
|
|
3035
|
-
|
|
3192
|
+
_context.next = 23;
|
|
3036
3193
|
break;
|
|
3037
|
-
case
|
|
3194
|
+
case 21:
|
|
3038
3195
|
debug.log('*** Error NON 404 for chat parent file ' + parent);
|
|
3039
3196
|
// statusTR.appendChild(widgets.errorMessageBlock(dom, err, 'pink'))
|
|
3040
|
-
throw new Error("*** ".concat(
|
|
3041
|
-
case
|
|
3197
|
+
throw new Error("*** ".concat(_context.t0.message, " for chat folder ").concat(parent));
|
|
3198
|
+
case 23:
|
|
3042
3199
|
if (!(level === 0)) {
|
|
3043
|
-
|
|
3200
|
+
_context.next = 26;
|
|
3044
3201
|
break;
|
|
3045
3202
|
}
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3203
|
+
debug.log('loadPrevious: returning as level is zero');
|
|
3204
|
+
return _context.abrupt("return", null);
|
|
3205
|
+
case 26:
|
|
3206
|
+
_context.next = 28;
|
|
3049
3207
|
return previousPeriod(parent, level - 1);
|
|
3050
|
-
case
|
|
3051
|
-
uncle =
|
|
3208
|
+
case 28:
|
|
3209
|
+
uncle = _context.sent;
|
|
3052
3210
|
if (uncle) {
|
|
3053
|
-
|
|
3211
|
+
_context.next = 32;
|
|
3054
3212
|
break;
|
|
3055
3213
|
}
|
|
3056
|
-
|
|
3214
|
+
debug.log(' previousPeriod: nothing left before. ', parent);
|
|
3215
|
+
return _context.abrupt("return", null);
|
|
3057
3216
|
case 32:
|
|
3058
|
-
|
|
3217
|
+
_context.next = 34;
|
|
3059
3218
|
return _solidLogic.store.fetcher.load(uncle);
|
|
3060
3219
|
case 34:
|
|
3061
3220
|
cousins = _solidLogic.store.each(uncle, ns.ldp('contains'));
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
return _context2.abrupt("return", result);
|
|
3221
|
+
result = lastOrFirst(cousins);
|
|
3222
|
+
debug.log(' previousPeriod: returning cousins at level ' + level, cousins);
|
|
3223
|
+
debug.log(' previousPeriod: returning result at level ' + level, result);
|
|
3224
|
+
return _context.abrupt("return", result);
|
|
3067
3225
|
case 39:
|
|
3068
3226
|
case "end":
|
|
3069
|
-
return
|
|
3227
|
+
return _context.stop();
|
|
3070
3228
|
}
|
|
3071
|
-
},
|
|
3229
|
+
}, _callee, null, [[4, 15]]);
|
|
3072
3230
|
}));
|
|
3073
3231
|
return _previousPeriod.apply(this, arguments);
|
|
3074
3232
|
};
|
|
3075
|
-
previousPeriod = function _previousPeriod2(
|
|
3233
|
+
previousPeriod = function _previousPeriod2(_x4, _x5) {
|
|
3076
3234
|
return _previousPeriod.apply(this, arguments);
|
|
3077
|
-
};
|
|
3078
|
-
thisDateFolder = this;
|
|
3079
|
-
// previousPeriod
|
|
3235
|
+
}; // previousPeriod
|
|
3080
3236
|
folder = this.leafDocumentFromDate(date).dir();
|
|
3081
|
-
|
|
3237
|
+
case 3:
|
|
3238
|
+
if (false) {}
|
|
3239
|
+
_context2.next = 6;
|
|
3082
3240
|
return previousPeriod(folder, 3);
|
|
3083
3241
|
case 6:
|
|
3084
|
-
found =
|
|
3242
|
+
found = _context2.sent;
|
|
3085
3243
|
if (!found) {
|
|
3086
|
-
|
|
3244
|
+
_context2.next = 22;
|
|
3087
3245
|
break;
|
|
3088
3246
|
}
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
return
|
|
3093
|
-
case
|
|
3247
|
+
leafDocument = _solidLogic.store.sym(found.uri + this.leafFileName);
|
|
3248
|
+
nextDate = this.dateFromLeafDocument(leafDocument);
|
|
3249
|
+
_context2.next = 12;
|
|
3250
|
+
return emptyLeaf(leafDocument);
|
|
3251
|
+
case 12:
|
|
3252
|
+
if (_context2.sent) {
|
|
3253
|
+
_context2.next = 16;
|
|
3254
|
+
break;
|
|
3255
|
+
}
|
|
3256
|
+
return _context2.abrupt("return", nextDate);
|
|
3257
|
+
case 16:
|
|
3258
|
+
debug.log(' loadPrevious: skipping empty ' + leafDocument);
|
|
3259
|
+
date = nextDate;
|
|
3260
|
+
folder = this.leafDocumentFromDate(date).dir();
|
|
3261
|
+
debug.log(' loadPrevious: moved back to ' + folder);
|
|
3262
|
+
case 20:
|
|
3263
|
+
_context2.next = 23;
|
|
3264
|
+
break;
|
|
3265
|
+
case 22:
|
|
3266
|
+
return _context2.abrupt("return", null);
|
|
3267
|
+
case 23:
|
|
3268
|
+
_context2.next = 3;
|
|
3269
|
+
break;
|
|
3270
|
+
case 25:
|
|
3094
3271
|
case "end":
|
|
3095
|
-
return
|
|
3272
|
+
return _context2.stop();
|
|
3096
3273
|
}
|
|
3097
|
-
},
|
|
3274
|
+
}, _callee2, this);
|
|
3098
3275
|
}));
|
|
3099
|
-
function loadPrevious(
|
|
3276
|
+
function loadPrevious(_x2, _x3) {
|
|
3100
3277
|
return _loadPrevious.apply(this, arguments);
|
|
3101
3278
|
}
|
|
3102
3279
|
return loadPrevious;
|
|
@@ -3104,16 +3281,16 @@ var DateFolder = /*#__PURE__*/function () {
|
|
|
3104
3281
|
}, {
|
|
3105
3282
|
key: "firstLeaf",
|
|
3106
3283
|
value: function () {
|
|
3107
|
-
var _firstLeaf = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3284
|
+
var _firstLeaf = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(backwards) {
|
|
3108
3285
|
var folderStore, folderFetcher, earliestSubfolder, _earliestSubfolder, y, month, d, leafDocument, leafObjects, msg, sortMe;
|
|
3109
|
-
return _regenerator["default"].wrap(function
|
|
3110
|
-
while (1) switch (
|
|
3286
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
3287
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
3111
3288
|
case 0:
|
|
3112
3289
|
_earliestSubfolder = function _earliestSubfolder3() {
|
|
3113
|
-
_earliestSubfolder = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3290
|
+
_earliestSubfolder = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(parent) {
|
|
3114
3291
|
var suitable, kids;
|
|
3115
|
-
return _regenerator["default"].wrap(function
|
|
3116
|
-
while (1) switch (
|
|
3292
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
3293
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
3117
3294
|
case 0:
|
|
3118
3295
|
suitable = function _suitable2(x) {
|
|
3119
3296
|
var tail = x.uri.slice(0, -1).split('/').slice(-1)[0];
|
|
@@ -3123,7 +3300,7 @@ var DateFolder = /*#__PURE__*/function () {
|
|
|
3123
3300
|
debug.log(' parent ' + parent);
|
|
3124
3301
|
delete folderFetcher.requested[parent.uri];
|
|
3125
3302
|
// try {
|
|
3126
|
-
|
|
3303
|
+
_context3.next = 5;
|
|
3127
3304
|
return folderFetcher.load(parent, {
|
|
3128
3305
|
force: true
|
|
3129
3306
|
});
|
|
@@ -3134,19 +3311,19 @@ var DateFolder = /*#__PURE__*/function () {
|
|
|
3134
3311
|
kids = folderStore.each(parent, ns.ldp('contains'));
|
|
3135
3312
|
kids = kids.filter(suitable);
|
|
3136
3313
|
if (!(kids.length === 0)) {
|
|
3137
|
-
|
|
3314
|
+
_context3.next = 9;
|
|
3138
3315
|
break;
|
|
3139
3316
|
}
|
|
3140
3317
|
throw new Error(' @@@ No children to parent2 ' + parent);
|
|
3141
3318
|
case 9:
|
|
3142
3319
|
kids.sort();
|
|
3143
3320
|
if (backwards) kids.reverse();
|
|
3144
|
-
return
|
|
3321
|
+
return _context3.abrupt("return", kids[0]);
|
|
3145
3322
|
case 12:
|
|
3146
3323
|
case "end":
|
|
3147
|
-
return
|
|
3324
|
+
return _context3.stop();
|
|
3148
3325
|
}
|
|
3149
|
-
},
|
|
3326
|
+
}, _callee3);
|
|
3150
3327
|
}));
|
|
3151
3328
|
return _earliestSubfolder.apply(this, arguments);
|
|
3152
3329
|
};
|
|
@@ -3156,25 +3333,25 @@ var DateFolder = /*#__PURE__*/function () {
|
|
|
3156
3333
|
// backwards -> last leafObject
|
|
3157
3334
|
folderStore = $rdf.graph();
|
|
3158
3335
|
folderFetcher = new $rdf.Fetcher(folderStore);
|
|
3159
|
-
|
|
3336
|
+
_context4.next = 6;
|
|
3160
3337
|
return earliestSubfolder(this.root.dir());
|
|
3161
3338
|
case 6:
|
|
3162
|
-
y =
|
|
3163
|
-
|
|
3339
|
+
y = _context4.sent;
|
|
3340
|
+
_context4.next = 9;
|
|
3164
3341
|
return earliestSubfolder(y);
|
|
3165
3342
|
case 9:
|
|
3166
|
-
month =
|
|
3167
|
-
|
|
3343
|
+
month = _context4.sent;
|
|
3344
|
+
_context4.next = 12;
|
|
3168
3345
|
return earliestSubfolder(month);
|
|
3169
3346
|
case 12:
|
|
3170
|
-
d =
|
|
3347
|
+
d = _context4.sent;
|
|
3171
3348
|
leafDocument = $rdf.sym(d.uri + 'chat.ttl');
|
|
3172
|
-
|
|
3349
|
+
_context4.next = 16;
|
|
3173
3350
|
return folderFetcher.load(leafDocument);
|
|
3174
3351
|
case 16:
|
|
3175
3352
|
leafObjects = folderStore.each(this.root, this.membershipProperty, null, leafDocument);
|
|
3176
3353
|
if (!(leafObjects.length === 0)) {
|
|
3177
|
-
|
|
3354
|
+
_context4.next = 21;
|
|
3178
3355
|
break;
|
|
3179
3356
|
}
|
|
3180
3357
|
msg = ' INCONSISTENCY -- no chat leafObject in file ' + leafDocument;
|
|
@@ -3187,12 +3364,12 @@ var DateFolder = /*#__PURE__*/function () {
|
|
|
3187
3364
|
sortMe.sort();
|
|
3188
3365
|
if (backwards) sortMe.reverse();
|
|
3189
3366
|
debug.log((backwards ? 'Latest' : 'Earliest') + ' leafObject is ' + sortMe[0][1]);
|
|
3190
|
-
return
|
|
3367
|
+
return _context4.abrupt("return", sortMe[0][1]);
|
|
3191
3368
|
case 26:
|
|
3192
3369
|
case "end":
|
|
3193
|
-
return
|
|
3370
|
+
return _context4.stop();
|
|
3194
3371
|
}
|
|
3195
|
-
},
|
|
3372
|
+
}, _callee4, this);
|
|
3196
3373
|
}));
|
|
3197
3374
|
function firstLeaf(_x6) {
|
|
3198
3375
|
return _firstLeaf.apply(this, arguments);
|
|
@@ -3236,19 +3413,17 @@ var _chatLogic = __webpack_require__(/*! ./chatLogic */ "./lib/chat/chatLogic.js
|
|
|
3236
3413
|
var _message = __webpack_require__(/*! ./message */ "./lib/chat/message.js");
|
|
3237
3414
|
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); }
|
|
3238
3415
|
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; }
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3416
|
+
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; } } }; }
|
|
3417
|
+
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); }
|
|
3418
|
+
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; } /**
|
|
3419
|
+
* Contains the [[infiniteMessageArea]] class
|
|
3420
|
+
* @packageDocumentation
|
|
3421
|
+
*/ // import { findBookmarkDocument } from './bookmarks'
|
|
3244
3422
|
// pull in first avoid cross-refs
|
|
3245
|
-
|
|
3246
3423
|
// import * as style from '../style'
|
|
3247
3424
|
// import * as utils from '../utils'
|
|
3248
|
-
|
|
3249
3425
|
// import * as pad from '../pad'
|
|
3250
3426
|
// import { DateFolder } from './dateFolder'
|
|
3251
|
-
|
|
3252
3427
|
// const UI = { authn, icons, ns, media, pad, $rdf, store, style, utils, widgets }
|
|
3253
3428
|
|
|
3254
3429
|
function desktopNotification(str) {
|
|
@@ -3276,34 +3451,9 @@ function desktopNotification(str) {
|
|
|
3276
3451
|
/**
|
|
3277
3452
|
* Renders a chat message inside a `messageTable`
|
|
3278
3453
|
*/
|
|
3279
|
-
function insertMessageIntoTable(
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
// const message = messageRow.AJAR_subject
|
|
3283
|
-
if (options.selectedMessage && options.selectedMessage.sameTerm(message)) {
|
|
3284
|
-
messageRow.style.backgroundColor = 'yellow';
|
|
3285
|
-
options.selectedElement = messageRow;
|
|
3286
|
-
messageTable.selectedElement = messageRow;
|
|
3287
|
-
}
|
|
3288
|
-
var done = false;
|
|
3289
|
-
for (var ele = messageTable.firstChild;; ele = ele.nextSibling) {
|
|
3290
|
-
if (!ele) {
|
|
3291
|
-
// empty
|
|
3292
|
-
break;
|
|
3293
|
-
}
|
|
3294
|
-
var newestFirst = options.newestfirst === true;
|
|
3295
|
-
var dateString = messageRow.AJAR_date;
|
|
3296
|
-
if (dateString > ele.AJAR_date && newestFirst || dateString < ele.AJAR_date && !newestFirst) {
|
|
3297
|
-
messageTable.insertBefore(messageRow, ele);
|
|
3298
|
-
done = true;
|
|
3299
|
-
break;
|
|
3300
|
-
}
|
|
3301
|
-
}
|
|
3302
|
-
if (!done) {
|
|
3303
|
-
messageTable.appendChild(messageRow);
|
|
3304
|
-
}
|
|
3454
|
+
function insertMessageIntoTable(_x, _x2, _x3, _x4, _x5, _x6) {
|
|
3455
|
+
return _insertMessageIntoTable.apply(this, arguments);
|
|
3305
3456
|
}
|
|
3306
|
-
|
|
3307
3457
|
/**
|
|
3308
3458
|
* Common code for a chat (discussion area of messages about something)
|
|
3309
3459
|
* This version runs over a series of files for different time periods
|
|
@@ -3326,20 +3476,70 @@ function insertMessageIntoTable(channelObject, messageTable, message, fresh, opt
|
|
|
3326
3476
|
- inlineImageHeightEms: The height (in ems) of images expaned from their URIs in the chat.
|
|
3327
3477
|
|
|
3328
3478
|
*/
|
|
3329
|
-
function
|
|
3479
|
+
function _insertMessageIntoTable() {
|
|
3480
|
+
_insertMessageIntoTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(channelObject, messageTable, message, fresh, options, userContext) {
|
|
3481
|
+
var messageRow, done, ele, newestFirst, dateString;
|
|
3482
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
3483
|
+
while (1) switch (_context.prev = _context.next) {
|
|
3484
|
+
case 0:
|
|
3485
|
+
_context.next = 2;
|
|
3486
|
+
return (0, _message.renderMessageRow)(channelObject, message, fresh, options, userContext);
|
|
3487
|
+
case 2:
|
|
3488
|
+
messageRow = _context.sent;
|
|
3489
|
+
// const message = messageRow.AJAR_subject
|
|
3490
|
+
if (options.selectedMessage && options.selectedMessage.sameTerm(message)) {
|
|
3491
|
+
messageRow.style.backgroundColor = 'yellow';
|
|
3492
|
+
options.selectedElement = messageRow;
|
|
3493
|
+
messageTable.selectedElement = messageRow;
|
|
3494
|
+
}
|
|
3495
|
+
done = false;
|
|
3496
|
+
ele = messageTable.firstChild;
|
|
3497
|
+
case 6:
|
|
3498
|
+
if (ele) {
|
|
3499
|
+
_context.next = 8;
|
|
3500
|
+
break;
|
|
3501
|
+
}
|
|
3502
|
+
return _context.abrupt("break", 17);
|
|
3503
|
+
case 8:
|
|
3504
|
+
newestFirst = options.newestfirst === true;
|
|
3505
|
+
dateString = messageRow.AJAR_date;
|
|
3506
|
+
if (!(dateString > ele.AJAR_date && newestFirst || dateString < ele.AJAR_date && !newestFirst)) {
|
|
3507
|
+
_context.next = 14;
|
|
3508
|
+
break;
|
|
3509
|
+
}
|
|
3510
|
+
messageTable.insertBefore(messageRow, ele);
|
|
3511
|
+
done = true;
|
|
3512
|
+
return _context.abrupt("break", 17);
|
|
3513
|
+
case 14:
|
|
3514
|
+
ele = ele.nextSibling;
|
|
3515
|
+
_context.next = 6;
|
|
3516
|
+
break;
|
|
3517
|
+
case 17:
|
|
3518
|
+
if (!done) {
|
|
3519
|
+
messageTable.appendChild(messageRow);
|
|
3520
|
+
}
|
|
3521
|
+
case 18:
|
|
3522
|
+
case "end":
|
|
3523
|
+
return _context.stop();
|
|
3524
|
+
}
|
|
3525
|
+
}, _callee);
|
|
3526
|
+
}));
|
|
3527
|
+
return _insertMessageIntoTable.apply(this, arguments);
|
|
3528
|
+
}
|
|
3529
|
+
function infiniteMessageArea(_x7, _x8, _x9, _x10) {
|
|
3330
3530
|
return _infiniteMessageArea.apply(this, arguments);
|
|
3331
3531
|
}
|
|
3332
3532
|
function _infiniteMessageArea() {
|
|
3333
|
-
_infiniteMessageArea = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3334
|
-
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;
|
|
3335
|
-
return _regenerator["default"].wrap(function
|
|
3336
|
-
while (1) switch (
|
|
3533
|
+
_infiniteMessageArea = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee15(dom, wasStore, chatChannel, options) {
|
|
3534
|
+
var syncMessages, _syncMessages, addMessage, _addMessage, insertPreviousMessages, _insertPreviousMessages, removePreviousMessages, createMessageTable, _createMessageTable, renderMessageTable, _renderMessageTable, addNewChatDocumentIfNewDay, _addNewChatDocumentIfNewDay, appendCurrentMessages, _appendCurrentMessages, loadMoreWhereNeeded, _loadMoreWhereNeeded, loadInitialContent, _loadInitialContent, newestFirst, channelObject, dateFolder, div, statusArea, userContext, liveMessageTable, threadRootMessage, earliest, latest, thread, threadTime, lock;
|
|
3535
|
+
return _regenerator["default"].wrap(function _callee15$(_context15) {
|
|
3536
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
3337
3537
|
case 0:
|
|
3338
3538
|
_loadInitialContent = function _loadInitialContent3() {
|
|
3339
|
-
_loadInitialContent = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3340
|
-
var yank, fixScroll, live, selectedDocument, now, todayDocument, selectedMessageTable, selectedDate;
|
|
3341
|
-
return _regenerator["default"].wrap(function
|
|
3342
|
-
while (1) switch (
|
|
3539
|
+
_loadInitialContent = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14() {
|
|
3540
|
+
var yank, fixScroll, live, selectedDocument, threadRootDocument, initialDocment, now, todayDocument, selectedMessageTable, selectedDate;
|
|
3541
|
+
return _regenerator["default"].wrap(function _callee14$(_context14) {
|
|
3542
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
3343
3543
|
case 0:
|
|
3344
3544
|
fixScroll = function _fixScroll() {
|
|
3345
3545
|
if (options.selectedElement) {
|
|
@@ -3353,51 +3553,59 @@ function _infiniteMessageArea() {
|
|
|
3353
3553
|
}
|
|
3354
3554
|
};
|
|
3355
3555
|
yank = function _yank() {
|
|
3356
|
-
selectedMessageTable.selectedElement
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3556
|
+
if (selectedMessageTable && selectedMessageTable.selectedElement) {
|
|
3557
|
+
selectedMessageTable.selectedElement.scrollIntoView({
|
|
3558
|
+
block: 'center'
|
|
3559
|
+
});
|
|
3560
|
+
}
|
|
3561
|
+
}; // During initial load ONLY keep scroll to selected thing or bottom
|
|
3360
3562
|
if (options.selectedMessage) {
|
|
3361
3563
|
selectedDocument = options.selectedMessage.doc();
|
|
3564
|
+
}
|
|
3565
|
+
if (threadRootMessage) {
|
|
3566
|
+
threadRootDocument = threadRootMessage.doc();
|
|
3567
|
+
}
|
|
3568
|
+
initialDocment = selectedDocument || threadRootDocument;
|
|
3569
|
+
if (initialDocment) {
|
|
3362
3570
|
now = new Date();
|
|
3363
3571
|
todayDocument = dateFolder.leafDocumentFromDate(now);
|
|
3364
|
-
live = todayDocument.sameTerm(
|
|
3572
|
+
live = todayDocument.sameTerm(initialDocment);
|
|
3365
3573
|
}
|
|
3366
|
-
if (!(
|
|
3367
|
-
|
|
3574
|
+
if (!(initialDocment && !live)) {
|
|
3575
|
+
_context14.next = 18;
|
|
3368
3576
|
break;
|
|
3369
3577
|
}
|
|
3370
|
-
selectedDate = dateFolder.dateFromLeafDocument(
|
|
3371
|
-
|
|
3578
|
+
selectedDate = dateFolder.dateFromLeafDocument(initialDocment);
|
|
3579
|
+
_context14.next = 10;
|
|
3372
3580
|
return createMessageTable(selectedDate, live);
|
|
3373
|
-
case
|
|
3374
|
-
selectedMessageTable =
|
|
3581
|
+
case 10:
|
|
3582
|
+
selectedMessageTable = _context14.sent;
|
|
3375
3583
|
div.appendChild(selectedMessageTable);
|
|
3376
3584
|
earliest.messageTable = selectedMessageTable;
|
|
3377
3585
|
latest.messageTable = selectedMessageTable;
|
|
3378
3586
|
yank();
|
|
3379
3587
|
setTimeout(yank, 1000); // @@ kludge - restore position distubed by other cHANGES
|
|
3380
|
-
|
|
3588
|
+
_context14.next = 22;
|
|
3381
3589
|
break;
|
|
3382
|
-
case
|
|
3383
|
-
|
|
3590
|
+
case 18:
|
|
3591
|
+
_context14.next = 20;
|
|
3384
3592
|
return appendCurrentMessages();
|
|
3385
|
-
case
|
|
3593
|
+
case 20:
|
|
3386
3594
|
earliest.messageTable = liveMessageTable;
|
|
3387
3595
|
latest.messageTable = liveMessageTable;
|
|
3388
|
-
case
|
|
3389
|
-
|
|
3596
|
+
case 22:
|
|
3597
|
+
_context14.next = 24;
|
|
3390
3598
|
return loadMoreWhereNeeded(null, fixScroll);
|
|
3391
|
-
case
|
|
3599
|
+
case 24:
|
|
3392
3600
|
div.addEventListener('scroll', loadMoreWhereNeeded);
|
|
3393
3601
|
if (options.solo) {
|
|
3394
3602
|
document.body.addEventListener('scroll', loadMoreWhereNeeded);
|
|
3395
3603
|
}
|
|
3396
|
-
case
|
|
3604
|
+
case 26:
|
|
3397
3605
|
case "end":
|
|
3398
|
-
return
|
|
3606
|
+
return _context14.stop();
|
|
3399
3607
|
}
|
|
3400
|
-
},
|
|
3608
|
+
}, _callee14);
|
|
3401
3609
|
}));
|
|
3402
3610
|
return _loadInitialContent.apply(this, arguments);
|
|
3403
3611
|
};
|
|
@@ -3405,16 +3613,16 @@ function _infiniteMessageArea() {
|
|
|
3405
3613
|
return _loadInitialContent.apply(this, arguments);
|
|
3406
3614
|
};
|
|
3407
3615
|
_loadMoreWhereNeeded = function _loadMoreWhereNeeded3() {
|
|
3408
|
-
_loadMoreWhereNeeded = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3616
|
+
_loadMoreWhereNeeded = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13(event, fixScroll) {
|
|
3409
3617
|
var freeze, magicZone, done, scrollBottom, scrollTop;
|
|
3410
|
-
return _regenerator["default"].wrap(function
|
|
3411
|
-
while (1) switch (
|
|
3618
|
+
return _regenerator["default"].wrap(function _callee13$(_context13) {
|
|
3619
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
3412
3620
|
case 0:
|
|
3413
3621
|
if (!lock) {
|
|
3414
|
-
|
|
3622
|
+
_context13.next = 2;
|
|
3415
3623
|
break;
|
|
3416
3624
|
}
|
|
3417
|
-
return
|
|
3625
|
+
return _context13.abrupt("return");
|
|
3418
3626
|
case 2:
|
|
3419
3627
|
lock = true;
|
|
3420
3628
|
freeze = !fixScroll;
|
|
@@ -3422,36 +3630,36 @@ function _infiniteMessageArea() {
|
|
|
3422
3630
|
// const bottom = div.scrollHeight - top - div.clientHeight
|
|
3423
3631
|
case 5:
|
|
3424
3632
|
if (!(div.scrollTop < magicZone && earliest.messageTable && !earliest.messageTable.initial && earliest.messageTable.extendBackwards)) {
|
|
3425
|
-
|
|
3633
|
+
_context13.next = 21;
|
|
3426
3634
|
break;
|
|
3427
3635
|
}
|
|
3428
3636
|
if (!(div.scrollHeight === 0)) {
|
|
3429
|
-
|
|
3637
|
+
_context13.next = 10;
|
|
3430
3638
|
break;
|
|
3431
3639
|
}
|
|
3432
|
-
//
|
|
3640
|
+
// debug.log(' chat/loadMoreWhereNeeded: trying later...')
|
|
3433
3641
|
setTimeout(loadMoreWhereNeeded, 2000); // couple be less
|
|
3434
3642
|
lock = false;
|
|
3435
|
-
return
|
|
3643
|
+
return _context13.abrupt("return");
|
|
3436
3644
|
case 10:
|
|
3437
|
-
//
|
|
3645
|
+
// debug.log(' chat/loadMoreWhereNeeded: Going now')
|
|
3438
3646
|
scrollBottom = div.scrollHeight - div.scrollTop;
|
|
3439
3647
|
debug.log('infinite scroll: adding above: top ' + div.scrollTop);
|
|
3440
|
-
|
|
3648
|
+
_context13.next = 14;
|
|
3441
3649
|
return earliest.messageTable.extendBackwards();
|
|
3442
3650
|
case 14:
|
|
3443
|
-
done =
|
|
3651
|
+
done = _context13.sent;
|
|
3444
3652
|
if (freeze) {
|
|
3445
3653
|
div.scrollTop = div.scrollHeight - scrollBottom;
|
|
3446
3654
|
}
|
|
3447
3655
|
if (fixScroll) fixScroll();
|
|
3448
3656
|
if (!done) {
|
|
3449
|
-
|
|
3657
|
+
_context13.next = 19;
|
|
3450
3658
|
break;
|
|
3451
3659
|
}
|
|
3452
|
-
return
|
|
3660
|
+
return _context13.abrupt("break", 21);
|
|
3453
3661
|
case 19:
|
|
3454
|
-
|
|
3662
|
+
_context13.next = 5;
|
|
3455
3663
|
break;
|
|
3456
3664
|
case 21:
|
|
3457
3665
|
if (!(options.selectedMessage &&
|
|
@@ -3461,15 +3669,15 @@ function _infiniteMessageArea() {
|
|
|
3461
3669
|
latest.messageTable && !latest.messageTable["final"] &&
|
|
3462
3670
|
// there is more data to come
|
|
3463
3671
|
latest.messageTable.extendForwards)) {
|
|
3464
|
-
|
|
3672
|
+
_context13.next = 33;
|
|
3465
3673
|
break;
|
|
3466
3674
|
}
|
|
3467
3675
|
scrollTop = div.scrollTop;
|
|
3468
3676
|
debug.log('infinite scroll: adding below: bottom: ' + (div.scrollHeight - div.scrollTop - div.clientHeight));
|
|
3469
|
-
|
|
3677
|
+
_context13.next = 26;
|
|
3470
3678
|
return latest.messageTable.extendForwards();
|
|
3471
3679
|
case 26:
|
|
3472
|
-
done =
|
|
3680
|
+
done = _context13.sent;
|
|
3473
3681
|
// then add more data on the bottom
|
|
3474
3682
|
if (freeze) {
|
|
3475
3683
|
div.scrollTop = scrollTop; // while adding below keep same things in view
|
|
@@ -3477,63 +3685,66 @@ function _infiniteMessageArea() {
|
|
|
3477
3685
|
|
|
3478
3686
|
if (fixScroll) fixScroll();
|
|
3479
3687
|
if (!done) {
|
|
3480
|
-
|
|
3688
|
+
_context13.next = 31;
|
|
3481
3689
|
break;
|
|
3482
3690
|
}
|
|
3483
|
-
return
|
|
3691
|
+
return _context13.abrupt("break", 33);
|
|
3484
3692
|
case 31:
|
|
3485
|
-
|
|
3693
|
+
_context13.next = 21;
|
|
3486
3694
|
break;
|
|
3487
3695
|
case 33:
|
|
3488
3696
|
lock = false;
|
|
3489
3697
|
case 34:
|
|
3490
3698
|
case "end":
|
|
3491
|
-
return
|
|
3699
|
+
return _context13.stop();
|
|
3492
3700
|
}
|
|
3493
|
-
},
|
|
3701
|
+
}, _callee13);
|
|
3494
3702
|
}));
|
|
3495
3703
|
return _loadMoreWhereNeeded.apply(this, arguments);
|
|
3496
3704
|
};
|
|
3497
|
-
loadMoreWhereNeeded = function _loadMoreWhereNeeded2(
|
|
3705
|
+
loadMoreWhereNeeded = function _loadMoreWhereNeeded2(_x20, _x21) {
|
|
3498
3706
|
return _loadMoreWhereNeeded.apply(this, arguments);
|
|
3499
3707
|
};
|
|
3500
3708
|
_appendCurrentMessages = function _appendCurrentMessage2() {
|
|
3501
|
-
_appendCurrentMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3709
|
+
_appendCurrentMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12() {
|
|
3502
3710
|
var now, chatDocument, messageTable;
|
|
3503
|
-
return _regenerator["default"].wrap(function
|
|
3504
|
-
while (1) switch (
|
|
3711
|
+
return _regenerator["default"].wrap(function _callee12$(_context12) {
|
|
3712
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
3505
3713
|
case 0:
|
|
3506
3714
|
now = new Date();
|
|
3507
3715
|
chatDocument = dateFolder.leafDocumentFromDate(now); /// ///////////////////////////////////////////////////////////
|
|
3508
|
-
|
|
3716
|
+
_context12.next = 4;
|
|
3509
3717
|
return createMessageTable(now, true);
|
|
3510
3718
|
case 4:
|
|
3511
|
-
messageTable =
|
|
3719
|
+
messageTable = _context12.sent;
|
|
3512
3720
|
div.appendChild(messageTable);
|
|
3513
|
-
div.refresh = /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3514
|
-
return _regenerator["default"].wrap(function
|
|
3515
|
-
while (1) switch (
|
|
3721
|
+
div.refresh = /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11() {
|
|
3722
|
+
return _regenerator["default"].wrap(function _callee11$(_context11) {
|
|
3723
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
3516
3724
|
case 0:
|
|
3517
|
-
|
|
3725
|
+
_context11.next = 2;
|
|
3518
3726
|
return addNewChatDocumentIfNewDay(new Date());
|
|
3519
3727
|
case 2:
|
|
3520
|
-
|
|
3521
|
-
|
|
3728
|
+
_context11.next = 4;
|
|
3729
|
+
return syncMessages(chatChannel, messageTable);
|
|
3522
3730
|
case 4:
|
|
3731
|
+
// @@ livemessagetable??
|
|
3732
|
+
desktopNotification(chatChannel);
|
|
3733
|
+
case 5:
|
|
3523
3734
|
case "end":
|
|
3524
|
-
return
|
|
3735
|
+
return _context11.stop();
|
|
3525
3736
|
}
|
|
3526
|
-
},
|
|
3737
|
+
}, _callee11);
|
|
3527
3738
|
})); // The short chat version the live update listening is done in the pane but we do it in the widget @@
|
|
3528
3739
|
_solidLogic.store.updater.addDownstreamChangeListener(chatDocument, div.refresh); // Live update
|
|
3529
3740
|
liveMessageTable = messageTable;
|
|
3530
3741
|
latest.messageTable = liveMessageTable;
|
|
3531
|
-
return
|
|
3742
|
+
return _context12.abrupt("return", messageTable);
|
|
3532
3743
|
case 11:
|
|
3533
3744
|
case "end":
|
|
3534
|
-
return
|
|
3745
|
+
return _context12.stop();
|
|
3535
3746
|
}
|
|
3536
|
-
},
|
|
3747
|
+
}, _callee12);
|
|
3537
3748
|
}));
|
|
3538
3749
|
return _appendCurrentMessages.apply(this, arguments);
|
|
3539
3750
|
};
|
|
@@ -3541,15 +3752,15 @@ function _infiniteMessageArea() {
|
|
|
3541
3752
|
return _appendCurrentMessages.apply(this, arguments);
|
|
3542
3753
|
};
|
|
3543
3754
|
_addNewChatDocumentIfNewDay = function _addNewChatDocumentIf2() {
|
|
3544
|
-
_addNewChatDocumentIfNewDay = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
3755
|
+
_addNewChatDocumentIfNewDay = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10() {
|
|
3545
3756
|
var newChatDocument, oldChatDocument, sts;
|
|
3546
|
-
return _regenerator["default"].wrap(function
|
|
3547
|
-
while (1) switch (
|
|
3757
|
+
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
|
3758
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
3548
3759
|
case 0:
|
|
3549
3760
|
// @@ Remove listener from previous table as it is now static
|
|
3550
3761
|
newChatDocument = dateFolder.leafDocumentFromDate(new Date());
|
|
3551
3762
|
if (newChatDocument.sameTerm(latest.messageTable.chatDocument)) {
|
|
3552
|
-
|
|
3763
|
+
_context10.next = 7;
|
|
3553
3764
|
break;
|
|
3554
3765
|
}
|
|
3555
3766
|
// It is a new day
|
|
@@ -3558,7 +3769,7 @@ function _infiniteMessageArea() {
|
|
|
3558
3769
|
delete liveMessageTable.inputRow;
|
|
3559
3770
|
}
|
|
3560
3771
|
oldChatDocument = latest.messageTable.chatDocument;
|
|
3561
|
-
|
|
3772
|
+
_context10.next = 6;
|
|
3562
3773
|
return appendCurrentMessages();
|
|
3563
3774
|
case 6:
|
|
3564
3775
|
// Adding a link in the document will ping listeners to add the new block too
|
|
@@ -3572,286 +3783,323 @@ function _infiniteMessageArea() {
|
|
|
3572
3783
|
}
|
|
3573
3784
|
case 7:
|
|
3574
3785
|
case "end":
|
|
3575
|
-
return
|
|
3786
|
+
return _context10.stop();
|
|
3576
3787
|
}
|
|
3577
|
-
},
|
|
3788
|
+
}, _callee10);
|
|
3578
3789
|
}));
|
|
3579
3790
|
return _addNewChatDocumentIfNewDay.apply(this, arguments);
|
|
3580
3791
|
};
|
|
3581
3792
|
addNewChatDocumentIfNewDay = function _addNewChatDocumentIf() {
|
|
3582
3793
|
return _addNewChatDocumentIfNewDay.apply(this, arguments);
|
|
3583
3794
|
};
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
function getScrollbackIcon(sense) {
|
|
3629
|
-
return sense ? 'noun_1369241.svg' : 'noun_1369237.svg';
|
|
3630
|
-
}
|
|
3631
|
-
}
|
|
3632
|
-
function scrollBackbuttonHandler(_x8) {
|
|
3633
|
-
return _scrollBackbuttonHandler.apply(this, arguments);
|
|
3634
|
-
} /// ////////////// Scroll up adding more below
|
|
3635
|
-
function _scrollBackbuttonHandler() {
|
|
3636
|
-
_scrollBackbuttonHandler = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(_event) {
|
|
3637
|
-
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
3638
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
3639
|
-
case 0:
|
|
3640
|
-
if (!messageTable.extendedBack) {
|
|
3641
|
-
_context2.next = 6;
|
|
3642
|
-
break;
|
|
3795
|
+
_renderMessageTable = function _renderMessageTable3() {
|
|
3796
|
+
_renderMessageTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(date, live) {
|
|
3797
|
+
var scrollBackbutton, scrollForwardButton, extendBackwards, _extendBackwards, setScrollBackbuttonIcon, extendForwards, _extendForwards, setScrollForwardButtonIcon, scrollForwardButtonHandler, _scrollForwardButtonHandler, messageTable, chatDocument, tr, test, titleTR, scrollBackbuttonCell, dateCell, scrollForwardButtonCell, sts, _iterator2, _step2, st;
|
|
3798
|
+
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
|
3799
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
3800
|
+
case 0:
|
|
3801
|
+
_scrollForwardButtonHandler = function _scrollForwardButtonH2() {
|
|
3802
|
+
_scrollForwardButtonHandler = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(_event) {
|
|
3803
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
3804
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
3805
|
+
case 0:
|
|
3806
|
+
if (!messageTable.extendedForwards) {
|
|
3807
|
+
_context8.next = 6;
|
|
3808
|
+
break;
|
|
3809
|
+
}
|
|
3810
|
+
removePreviousMessages(false, messageTable);
|
|
3811
|
+
messageTable.extendedForwards = false;
|
|
3812
|
+
setScrollForwardButtonIcon();
|
|
3813
|
+
_context8.next = 9;
|
|
3814
|
+
break;
|
|
3815
|
+
case 6:
|
|
3816
|
+
_context8.next = 8;
|
|
3817
|
+
return extendForwards();
|
|
3818
|
+
case 8:
|
|
3819
|
+
// async
|
|
3820
|
+
latest.messageTable.scrollIntoView(newestFirst);
|
|
3821
|
+
case 9:
|
|
3822
|
+
case "end":
|
|
3823
|
+
return _context8.stop();
|
|
3824
|
+
}
|
|
3825
|
+
}, _callee8);
|
|
3826
|
+
}));
|
|
3827
|
+
return _scrollForwardButtonHandler.apply(this, arguments);
|
|
3828
|
+
};
|
|
3829
|
+
scrollForwardButtonHandler = function _scrollForwardButtonH(_x22) {
|
|
3830
|
+
return _scrollForwardButtonHandler.apply(this, arguments);
|
|
3831
|
+
};
|
|
3832
|
+
setScrollForwardButtonIcon = function _setScrollForwardButt() {
|
|
3833
|
+
if (!scrollForwardButton) return;
|
|
3834
|
+
var sense = messageTable.extendedForwards ? !newestFirst : newestFirst; // noun_T-Block_1114657_000000.svg
|
|
3835
|
+
var scrollForwardIcon = messageTable["final"] ? 'noun_T-Block_1114657_000000.svg' : getScrollForwardButtonIcon(sense);
|
|
3836
|
+
scrollForwardButton.firstChild.setAttribute('src', _iconBase.icons.iconBase + scrollForwardIcon);
|
|
3837
|
+
function getScrollForwardButtonIcon(sense) {
|
|
3838
|
+
return !sense ? 'noun_1369241.svg' : 'noun_1369237.svg';
|
|
3643
3839
|
}
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
return insertPreviousMessages(false);
|
|
3671
|
-
case 2:
|
|
3672
|
-
done = _context3.sent;
|
|
3673
|
-
if (done) {
|
|
3674
|
-
scrollForwardButton.firstChild.setAttribute('src', _iconBase.icons.iconBase + 'noun_T-Block_1114655_000000.svg');
|
|
3675
|
-
scrollForwardButton.disabled = true;
|
|
3676
|
-
messageTable["final"] = true;
|
|
3677
|
-
} else {
|
|
3678
|
-
messageTable.extendedForwards = true;
|
|
3840
|
+
};
|
|
3841
|
+
_extendForwards = function _extendForwards3() {
|
|
3842
|
+
_extendForwards = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7() {
|
|
3843
|
+
var done;
|
|
3844
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
3845
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
3846
|
+
case 0:
|
|
3847
|
+
_context7.next = 2;
|
|
3848
|
+
return insertPreviousMessages(false);
|
|
3849
|
+
case 2:
|
|
3850
|
+
done = _context7.sent;
|
|
3851
|
+
return _context7.abrupt("return", done);
|
|
3852
|
+
case 4:
|
|
3853
|
+
case "end":
|
|
3854
|
+
return _context7.stop();
|
|
3855
|
+
}
|
|
3856
|
+
}, _callee7);
|
|
3857
|
+
}));
|
|
3858
|
+
return _extendForwards.apply(this, arguments);
|
|
3859
|
+
};
|
|
3860
|
+
extendForwards = function _extendForwards2() {
|
|
3861
|
+
return _extendForwards.apply(this, arguments);
|
|
3862
|
+
};
|
|
3863
|
+
setScrollBackbuttonIcon = function _setScrollBackbuttonI() {
|
|
3864
|
+
if (!scrollBackbutton) {
|
|
3865
|
+
return;
|
|
3679
3866
|
}
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
}
|
|
3686
|
-
}, _callee3);
|
|
3687
|
-
}));
|
|
3688
|
-
return _extendForwards.apply(this, arguments);
|
|
3689
|
-
}
|
|
3690
|
-
function setScrollForwardButtonIcon() {
|
|
3691
|
-
var sense = messageTable.extendedForwards ? !newestFirst : newestFirst; // noun_T-Block_1114657_000000.svg
|
|
3692
|
-
var scrollForwardIcon = messageTable["final"] ? 'noun_T-Block_1114657_000000.svg' : getScrollForwardButtonIcon(sense);
|
|
3693
|
-
scrollForwardButton.firstChild.setAttribute('src', _iconBase.icons.iconBase + scrollForwardIcon);
|
|
3694
|
-
function getScrollForwardButtonIcon(sense) {
|
|
3695
|
-
return !sense ? 'noun_1369241.svg' : 'noun_1369237.svg';
|
|
3696
|
-
}
|
|
3697
|
-
}
|
|
3698
|
-
function scrollForwardButtonHandler(_x9) {
|
|
3699
|
-
return _scrollForwardButtonHandler.apply(this, arguments);
|
|
3700
|
-
} /// ///////////////////////
|
|
3701
|
-
/*
|
|
3702
|
-
options = options || {}
|
|
3703
|
-
options.authorDateOnLeft = true
|
|
3704
|
-
const newestFirst = options.newestFirst === '1' || options.newestFirst === true // hack for now
|
|
3705
|
-
const channelObject = new ChatChannel(chatChannel, options)
|
|
3706
|
-
const dateFolder = channelObject.dateFolder
|
|
3707
|
-
const div = dom.createElement('div')
|
|
3708
|
-
const statusArea = div.appendChild(dom.createElement('div'))
|
|
3709
|
-
const userContext = { dom, statusArea, div: statusArea } // logged on state, pointers to user's stuff
|
|
3710
|
-
*/
|
|
3711
|
-
function _scrollForwardButtonHandler() {
|
|
3712
|
-
_scrollForwardButtonHandler = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(_event) {
|
|
3713
|
-
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
3714
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
3715
|
-
case 0:
|
|
3716
|
-
if (!messageTable.extendedForwards) {
|
|
3717
|
-
_context4.next = 6;
|
|
3718
|
-
break;
|
|
3867
|
+
var sense = messageTable.extendedBack ? !newestFirst : newestFirst;
|
|
3868
|
+
var scrollBackIcon = messageTable.initial ? 'noun_T-Block_1114655_000000.svg' : getScrollbackIcon(sense);
|
|
3869
|
+
scrollBackbutton.firstChild.setAttribute('src', _iconBase.icons.iconBase + scrollBackIcon);
|
|
3870
|
+
function getScrollbackIcon(sense) {
|
|
3871
|
+
return sense ? 'noun_1369241.svg' : 'noun_1369237.svg';
|
|
3719
3872
|
}
|
|
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
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3873
|
+
};
|
|
3874
|
+
_extendBackwards = function _extendBackwards3() {
|
|
3875
|
+
_extendBackwards = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
|
|
3876
|
+
var done;
|
|
3877
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
3878
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
3879
|
+
case 0:
|
|
3880
|
+
_context6.next = 2;
|
|
3881
|
+
return insertPreviousMessages(true);
|
|
3882
|
+
case 2:
|
|
3883
|
+
done = _context6.sent;
|
|
3884
|
+
if (done) {
|
|
3885
|
+
if (scrollBackbutton) {
|
|
3886
|
+
scrollBackbutton.firstChild.setAttribute('src', _iconBase.icons.iconBase + 'noun_T-Block_1114655_000000.svg'); // T
|
|
3887
|
+
scrollBackbutton.disabled = true;
|
|
3888
|
+
}
|
|
3889
|
+
messageTable.initial = true;
|
|
3890
|
+
} else {
|
|
3891
|
+
messageTable.extendedBack = true;
|
|
3892
|
+
}
|
|
3893
|
+
setScrollBackbuttonIcon();
|
|
3894
|
+
return _context6.abrupt("return", done);
|
|
3895
|
+
case 6:
|
|
3896
|
+
case "end":
|
|
3897
|
+
return _context6.stop();
|
|
3898
|
+
}
|
|
3899
|
+
}, _callee6);
|
|
3900
|
+
}));
|
|
3901
|
+
return _extendBackwards.apply(this, arguments);
|
|
3902
|
+
};
|
|
3903
|
+
extendBackwards = function _extendBackwards2() {
|
|
3904
|
+
return _extendBackwards.apply(this, arguments);
|
|
3905
|
+
};
|
|
3906
|
+
scrollBackbutton = null; // was let
|
|
3907
|
+
scrollForwardButton = null; // was let
|
|
3908
|
+
/// ///////////////// Scroll down adding more above
|
|
3909
|
+
/// ////////////// Scroll up adding more below
|
|
3910
|
+
/// ///////////////////////
|
|
3911
|
+
/*
|
|
3912
|
+
options = options || {}
|
|
3913
|
+
options.authorDateOnLeft = true
|
|
3914
|
+
const newestFirst = options.newestFirst === '1' || options.newestFirst === true // hack for now
|
|
3915
|
+
const channelObject = new ChatChannel(chatChannel, options)
|
|
3916
|
+
const dateFolder = channelObject.dateFolder
|
|
3917
|
+
const div = dom.createElement('div')
|
|
3918
|
+
const statusArea = div.appendChild(dom.createElement('div'))
|
|
3919
|
+
const userContext = { dom, statusArea, div: statusArea } // logged on state, pointers to user's stuff
|
|
3920
|
+
*/
|
|
3921
|
+
debug.log('Options for called message Area', options);
|
|
3922
|
+
messageTable = dom.createElement('table');
|
|
3923
|
+
messageTable.style.width = '100%'; // fill the pane div
|
|
3924
|
+
messageTable.extendBackwards = extendBackwards; // Make function available to scroll stuff
|
|
3925
|
+
messageTable.extendForwards = extendForwards; // Make function available to scroll stuff
|
|
3761
3926
|
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
var dateCell = scrollBackbuttonTR.appendChild(dom.createElement('td'));
|
|
3778
|
-
dateCell.style = 'text-align: center; vertical-align: middle; color: #888; font-style: italic;';
|
|
3779
|
-
dateCell.textContent = widgets.shortDate(date.toISOString(), true); // no time, only date
|
|
3780
|
-
|
|
3781
|
-
// @@@@@@@@@@@ todo move this button to other end of message cell, o
|
|
3782
|
-
var scrollForwardButtonCell = scrollBackbuttonTR.appendChild(dom.createElement('td'));
|
|
3783
|
-
var scrollForwardIcon = newestFirst ? 'noun_1369241.svg' : 'noun_1369237.svg'; // down and up arrows respoctively
|
|
3784
|
-
scrollForwardButton = widgets.button(dom, _iconBase.icons.iconBase + scrollForwardIcon, 'Later messages ...');
|
|
3785
|
-
scrollForwardButtonCell.appendChild(scrollForwardButton);
|
|
3786
|
-
scrollForwardButtonCell.style = 'width:3em; height:3em;';
|
|
3787
|
-
scrollForwardButton.addEventListener('click', scrollForwardButtonHandler, false);
|
|
3788
|
-
messageTable.extendedForward = false;
|
|
3789
|
-
setScrollForwardButtonIcon();
|
|
3790
|
-
messageTable.extendedForwards = false;
|
|
3791
|
-
if (!newestFirst) {
|
|
3792
|
-
// opposite end from the entry field
|
|
3793
|
-
messageTable.insertBefore(scrollBackbuttonTR, messageTable.firstChild); // If not newestFirst
|
|
3794
|
-
} else {
|
|
3795
|
-
messageTable.appendChild(scrollBackbuttonTR); // newestFirst
|
|
3796
|
-
}
|
|
3797
|
-
}
|
|
3927
|
+
messageTable.date = date;
|
|
3928
|
+
chatDocument = dateFolder.leafDocumentFromDate(date);
|
|
3929
|
+
messageTable.chatDocument = chatDocument;
|
|
3930
|
+
messageTable.fresh = false;
|
|
3931
|
+
messageTable.setAttribute('style', 'width: 100%;'); // fill that div!
|
|
3932
|
+
if (live) {
|
|
3933
|
+
messageTable["final"] = true;
|
|
3934
|
+
liveMessageTable = messageTable;
|
|
3935
|
+
latest.messageTable = messageTable;
|
|
3936
|
+
tr = (0, _message.renderMessageEditor)(channelObject, messageTable, userContext, options);
|
|
3937
|
+
if (newestFirst) {
|
|
3938
|
+
messageTable.insertBefore(tr, messageTable.firstChild); // If newestFirst
|
|
3939
|
+
} else {
|
|
3940
|
+
messageTable.appendChild(tr); // not newestFirst
|
|
3941
|
+
}
|
|
3798
3942
|
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
// not todays
|
|
3802
|
-
// no need buttomns at the moment
|
|
3803
|
-
// messageTable.style.visibility = 'collapse' // Hide files with no messages
|
|
3804
|
-
}
|
|
3805
|
-
sts.forEach(function (st) {
|
|
3806
|
-
addMessage(st.object, messageTable);
|
|
3807
|
-
});
|
|
3808
|
-
messageTable.fresh = true;
|
|
3943
|
+
messageTable.inputRow = tr;
|
|
3944
|
+
}
|
|
3809
3945
|
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3946
|
+
/// ///// Infinite scroll
|
|
3947
|
+
//
|
|
3948
|
+
// @@ listen for swipe past end event not just button
|
|
3949
|
+
test = true;
|
|
3950
|
+
if (test) {
|
|
3951
|
+
// ws options.infinite but need for non-infinite
|
|
3952
|
+
titleTR = dom.createElement('tr');
|
|
3953
|
+
scrollBackbuttonCell = titleTR.appendChild(dom.createElement('td')); // up traingles: noun_1369237.svg
|
|
3954
|
+
// down triangles: noun_1369241.svg
|
|
3955
|
+
/*
|
|
3956
|
+
const scrollBackIcon = newestFirst
|
|
3957
|
+
? 'noun_1369241.svg'
|
|
3958
|
+
: 'noun_1369237.svg' // down and up arrows respoctively
|
|
3959
|
+
scrollBackbutton = widgets.button(
|
|
3960
|
+
dom,
|
|
3961
|
+
icons.iconBase + scrollBackIcon,
|
|
3962
|
+
'Previous messages ...'
|
|
3963
|
+
)
|
|
3964
|
+
scrollBackbuttonCell.style = 'width:3em; height:3em;'
|
|
3965
|
+
scrollBackbutton.addEventListener('click', scrollBackbuttonHandler, false)
|
|
3966
|
+
messageTable.extendedBack = false
|
|
3967
|
+
scrollBackbuttonCell.appendChild(scrollBackbutton)
|
|
3968
|
+
setScrollBackbuttonIcon()
|
|
3969
|
+
*/
|
|
3970
|
+
dateCell = titleTR.appendChild(dom.createElement('td'));
|
|
3971
|
+
dateCell.style = 'text-align: center; vertical-align: middle; color: #888; font-style: italic;';
|
|
3972
|
+
dateCell.textContent = widgets.shortDate(date.toISOString(), true); // no time, only date
|
|
3973
|
+
|
|
3974
|
+
// @@@@@@@@@@@ todo move this button to other end of message cell, o
|
|
3975
|
+
scrollForwardButtonCell = titleTR.appendChild(dom.createElement('td'));
|
|
3976
|
+
if (options.includeRemoveButton) {
|
|
3977
|
+
scrollForwardButtonCell.appendChild(widgets.cancelButton(dom, function (_e) {
|
|
3978
|
+
div.parentNode.removeChild(div);
|
|
3979
|
+
}));
|
|
3980
|
+
}
|
|
3981
|
+
/*
|
|
3982
|
+
const scrollForwardIcon = newestFirst
|
|
3983
|
+
? 'noun_1369241.svg'
|
|
3984
|
+
: 'noun_1369237.svg' // down and up arrows respoctively
|
|
3985
|
+
scrollForwardButton = widgets.button(
|
|
3986
|
+
dom,
|
|
3987
|
+
icons.iconBase + scrollForwardIcon,
|
|
3988
|
+
'Later messages ...'
|
|
3989
|
+
)
|
|
3990
|
+
scrollForwardButtonCell.appendChild(scrollForwardButton)
|
|
3991
|
+
scrollForwardButtonCell.style = 'width:3em; height:3em;'
|
|
3992
|
+
scrollForwardButton.addEventListener(
|
|
3993
|
+
'click',
|
|
3994
|
+
scrollForwardButtonHandler,
|
|
3995
|
+
false
|
|
3996
|
+
)
|
|
3997
|
+
messageTable.extendedForward = false
|
|
3998
|
+
setScrollForwardButtonIcon()
|
|
3999
|
+
*/
|
|
4000
|
+
messageTable.extendedForwards = false;
|
|
4001
|
+
if (!newestFirst) {
|
|
4002
|
+
// opposite end from the entry field
|
|
4003
|
+
messageTable.insertBefore(titleTR, messageTable.firstChild); // If not newestFirst
|
|
4004
|
+
} else {
|
|
4005
|
+
messageTable.appendChild(titleTR); // newestFirst
|
|
4006
|
+
}
|
|
4007
|
+
}
|
|
4008
|
+
sts = _solidLogic.store.statementsMatching(null, ns.wf('message'), null, chatDocument);
|
|
4009
|
+
if (!live && sts.length === 0) {
|
|
4010
|
+
// not todays
|
|
4011
|
+
// no need buttomns at the moment
|
|
4012
|
+
// messageTable.style.visibility = 'collapse' // Hide files with no messages
|
|
4013
|
+
}
|
|
4014
|
+
_iterator2 = _createForOfIteratorHelper(sts);
|
|
4015
|
+
_context9.prev = 26;
|
|
4016
|
+
_iterator2.s();
|
|
4017
|
+
case 28:
|
|
4018
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
4019
|
+
_context9.next = 34;
|
|
4020
|
+
break;
|
|
4021
|
+
}
|
|
4022
|
+
st = _step2.value;
|
|
4023
|
+
_context9.next = 32;
|
|
4024
|
+
return addMessage(st.object, messageTable);
|
|
4025
|
+
case 32:
|
|
4026
|
+
_context9.next = 28;
|
|
4027
|
+
break;
|
|
4028
|
+
case 34:
|
|
4029
|
+
_context9.next = 39;
|
|
4030
|
+
break;
|
|
4031
|
+
case 36:
|
|
4032
|
+
_context9.prev = 36;
|
|
4033
|
+
_context9.t0 = _context9["catch"](26);
|
|
4034
|
+
_iterator2.e(_context9.t0);
|
|
4035
|
+
case 39:
|
|
4036
|
+
_context9.prev = 39;
|
|
4037
|
+
_iterator2.f();
|
|
4038
|
+
return _context9.finish(39);
|
|
4039
|
+
case 42:
|
|
4040
|
+
messageTable.fresh = true;
|
|
4041
|
+
|
|
4042
|
+
// loadMessageTable(messageTable, chatDocument)
|
|
4043
|
+
messageTable.fresh = false;
|
|
4044
|
+
return _context9.abrupt("return", messageTable);
|
|
4045
|
+
case 45:
|
|
4046
|
+
case "end":
|
|
4047
|
+
return _context9.stop();
|
|
4048
|
+
}
|
|
4049
|
+
}, _callee9, null, [[26, 36, 39, 42]]);
|
|
4050
|
+
}));
|
|
4051
|
+
return _renderMessageTable.apply(this, arguments);
|
|
4052
|
+
};
|
|
4053
|
+
renderMessageTable = function _renderMessageTable2(_x18, _x19) {
|
|
4054
|
+
return _renderMessageTable.apply(this, arguments);
|
|
3813
4055
|
};
|
|
3814
4056
|
_createMessageTable = function _createMessageTable3() {
|
|
3815
|
-
_createMessageTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
4057
|
+
_createMessageTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(date, live) {
|
|
3816
4058
|
var chatDocument, messageTable, statusTR;
|
|
3817
|
-
return _regenerator["default"].wrap(function
|
|
3818
|
-
while (1) switch (
|
|
4059
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
4060
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
3819
4061
|
case 0:
|
|
3820
4062
|
debug.log(' createMessageTable for ' + date);
|
|
3821
4063
|
chatDocument = dateFolder.leafDocumentFromDate(date);
|
|
3822
|
-
|
|
3823
|
-
|
|
4064
|
+
_context5.prev = 2;
|
|
4065
|
+
_context5.next = 5;
|
|
3824
4066
|
return _solidLogic.store.fetcher.load(chatDocument);
|
|
3825
4067
|
case 5:
|
|
3826
|
-
|
|
4068
|
+
_context5.next = 21;
|
|
3827
4069
|
break;
|
|
3828
4070
|
case 7:
|
|
3829
|
-
|
|
3830
|
-
|
|
4071
|
+
_context5.prev = 7;
|
|
4072
|
+
_context5.t0 = _context5["catch"](2);
|
|
3831
4073
|
messageTable = dom.createElement('table');
|
|
3832
4074
|
statusTR = messageTable.appendChild(dom.createElement('tr')); // ### find status in exception
|
|
3833
|
-
if (!(
|
|
3834
|
-
|
|
4075
|
+
if (!(_context5.t0.response && _context5.t0.response.status && _context5.t0.response.status === 404)) {
|
|
4076
|
+
_context5.next = 18;
|
|
3835
4077
|
break;
|
|
3836
4078
|
}
|
|
3837
4079
|
debug.log('Error 404 for chat file ' + chatDocument);
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
4080
|
+
_context5.next = 15;
|
|
4081
|
+
return renderMessageTable(date, live);
|
|
4082
|
+
case 15:
|
|
4083
|
+
return _context5.abrupt("return", _context5.sent);
|
|
3842
4084
|
case 18:
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
return _context6.abrupt("return", renderMessageTable(date, live));
|
|
4085
|
+
debug.log('*** Error NON 404 for chat file ' + chatDocument);
|
|
4086
|
+
statusTR.appendChild(widgets.errorMessageBlock(dom, _context5.t0, 'pink'));
|
|
3846
4087
|
case 20:
|
|
4088
|
+
return _context5.abrupt("return", statusTR);
|
|
4089
|
+
case 21:
|
|
4090
|
+
_context5.next = 23;
|
|
4091
|
+
return renderMessageTable(date, live);
|
|
4092
|
+
case 23:
|
|
4093
|
+
return _context5.abrupt("return", _context5.sent);
|
|
4094
|
+
case 24:
|
|
3847
4095
|
case "end":
|
|
3848
|
-
return
|
|
4096
|
+
return _context5.stop();
|
|
3849
4097
|
}
|
|
3850
|
-
},
|
|
4098
|
+
}, _callee5, null, [[2, 7]]);
|
|
3851
4099
|
}));
|
|
3852
4100
|
return _createMessageTable.apply(this, arguments);
|
|
3853
4101
|
};
|
|
3854
|
-
createMessageTable = function _createMessageTable2(
|
|
4102
|
+
createMessageTable = function _createMessageTable2(_x16, _x17) {
|
|
3855
4103
|
return _createMessageTable.apply(this, arguments);
|
|
3856
4104
|
};
|
|
3857
4105
|
removePreviousMessages = function _removePreviousMessag(backwards, messageTable) {
|
|
@@ -3870,32 +4118,48 @@ function _infiniteMessageArea() {
|
|
|
3870
4118
|
extr.messageTable = messageTable;
|
|
3871
4119
|
};
|
|
3872
4120
|
_insertPreviousMessages = function _insertPreviousMessag2() {
|
|
3873
|
-
_insertPreviousMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
4121
|
+
_insertPreviousMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(backwards) {
|
|
3874
4122
|
var extremity, date, live, todayDoc, doc, newMessageTable;
|
|
3875
|
-
return _regenerator["default"].wrap(function
|
|
3876
|
-
while (1) switch (
|
|
4123
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
4124
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
3877
4125
|
case 0:
|
|
3878
4126
|
extremity = backwards ? earliest : latest;
|
|
3879
4127
|
date = extremity.messageTable.date; // day in mssecs
|
|
3880
|
-
|
|
4128
|
+
// Are we at the top of a thread?
|
|
4129
|
+
if (!(backwards && earliest.limit && date <= earliest.limit)) {
|
|
4130
|
+
_context4.next = 7;
|
|
4131
|
+
break;
|
|
4132
|
+
}
|
|
4133
|
+
if (liveMessageTable) {
|
|
4134
|
+
_context4.next = 6;
|
|
4135
|
+
break;
|
|
4136
|
+
}
|
|
4137
|
+
_context4.next = 6;
|
|
4138
|
+
return appendCurrentMessages();
|
|
4139
|
+
case 6:
|
|
4140
|
+
return _context4.abrupt("return", true);
|
|
4141
|
+
case 7:
|
|
4142
|
+
debug.log(' insertPreviousMessages: loadPrevious given date ' + date);
|
|
4143
|
+
_context4.next = 10;
|
|
3881
4144
|
return dateFolder.loadPrevious(date, backwards);
|
|
3882
|
-
case
|
|
3883
|
-
date =
|
|
4145
|
+
case 10:
|
|
4146
|
+
date = _context4.sent;
|
|
3884
4147
|
// backwards
|
|
4148
|
+
debug.log(' insertPreviousMessages: loadPrevious returns date ' + date);
|
|
3885
4149
|
debug.log("insertPreviousMessages: from ".concat(backwards ? 'backwards' : 'forwards', " loadPrevious: ").concat(date));
|
|
3886
4150
|
if (!(!date && !backwards && !liveMessageTable)) {
|
|
3887
|
-
|
|
4151
|
+
_context4.next = 16;
|
|
3888
4152
|
break;
|
|
3889
4153
|
}
|
|
3890
|
-
|
|
4154
|
+
_context4.next = 16;
|
|
3891
4155
|
return appendCurrentMessages();
|
|
3892
|
-
case
|
|
4156
|
+
case 16:
|
|
3893
4157
|
if (date) {
|
|
3894
|
-
|
|
4158
|
+
_context4.next = 18;
|
|
3895
4159
|
break;
|
|
3896
4160
|
}
|
|
3897
|
-
return
|
|
3898
|
-
case
|
|
4161
|
+
return _context4.abrupt("return", true);
|
|
4162
|
+
case 18:
|
|
3899
4163
|
// done
|
|
3900
4164
|
live = false;
|
|
3901
4165
|
if (!backwards) {
|
|
@@ -3903,10 +4167,10 @@ function _infiniteMessageArea() {
|
|
|
3903
4167
|
doc = dateFolder.leafDocumentFromDate(date);
|
|
3904
4168
|
live = doc.sameTerm(todayDoc); // Is this todays?
|
|
3905
4169
|
}
|
|
3906
|
-
|
|
4170
|
+
_context4.next = 22;
|
|
3907
4171
|
return createMessageTable(date, live);
|
|
3908
|
-
case
|
|
3909
|
-
newMessageTable =
|
|
4172
|
+
case 22:
|
|
4173
|
+
newMessageTable = _context4.sent;
|
|
3910
4174
|
extremity.messageTable = newMessageTable; // move pointer to earliest
|
|
3911
4175
|
if (backwards ? newestFirst : !newestFirst) {
|
|
3912
4176
|
// put on bottom or top
|
|
@@ -3915,64 +4179,181 @@ function _infiniteMessageArea() {
|
|
|
3915
4179
|
// put on top as we scroll back
|
|
3916
4180
|
div.insertBefore(newMessageTable, div.firstChild);
|
|
3917
4181
|
}
|
|
3918
|
-
return
|
|
3919
|
-
case
|
|
4182
|
+
return _context4.abrupt("return", live);
|
|
4183
|
+
case 26:
|
|
3920
4184
|
case "end":
|
|
3921
|
-
return
|
|
4185
|
+
return _context4.stop();
|
|
3922
4186
|
}
|
|
3923
|
-
},
|
|
4187
|
+
}, _callee4);
|
|
3924
4188
|
}));
|
|
3925
4189
|
return _insertPreviousMessages.apply(this, arguments);
|
|
3926
4190
|
};
|
|
3927
|
-
insertPreviousMessages = function _insertPreviousMessag(
|
|
4191
|
+
insertPreviousMessages = function _insertPreviousMessag(_x15) {
|
|
3928
4192
|
return _insertPreviousMessages.apply(this, arguments);
|
|
3929
4193
|
};
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
4194
|
+
_addMessage = function _addMessage3() {
|
|
4195
|
+
_addMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(message, messageTable) {
|
|
4196
|
+
var thread, id;
|
|
4197
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
4198
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
4199
|
+
case 0:
|
|
4200
|
+
if (!((0, _chatLogic.isDeleted)(message) && !options.showDeletedMessages)) {
|
|
4201
|
+
_context3.next = 2;
|
|
4202
|
+
break;
|
|
4203
|
+
}
|
|
4204
|
+
return _context3.abrupt("return");
|
|
4205
|
+
case 2:
|
|
4206
|
+
/* if (isReplaced(message)) { //
|
|
4207
|
+
return // this is old version
|
|
4208
|
+
} */
|
|
4209
|
+
thread = _solidLogic.store.any(null, ns.sioc('has_member'), message, message.doc());
|
|
4210
|
+
id = _solidLogic.store.any(message, ns.sioc('id'), null, message.doc());
|
|
4211
|
+
if (id && !thread) {
|
|
4212
|
+
thread = _solidLogic.store.any(null, ns.sioc('has_member'), id, message.doc());
|
|
4213
|
+
}
|
|
4214
|
+
if (!options.thread) {
|
|
4215
|
+
_context3.next = 18;
|
|
4216
|
+
break;
|
|
4217
|
+
}
|
|
4218
|
+
if (!_solidLogic.store.holds(message, ns.sioc('has_reply'), options.thread)) {
|
|
4219
|
+
_context3.next = 10;
|
|
4220
|
+
break;
|
|
4221
|
+
}
|
|
4222
|
+
// root of thread
|
|
4223
|
+
debug.log(' addMessage: displaying root of thread ' + thread);
|
|
4224
|
+
_context3.next = 16;
|
|
4225
|
+
break;
|
|
4226
|
+
case 10:
|
|
4227
|
+
if (!(thread && thread.sameTerm(options.thread))) {
|
|
4228
|
+
_context3.next = 14;
|
|
4229
|
+
break;
|
|
4230
|
+
}
|
|
4231
|
+
debug.log(' addMessage: Displaying body of thread ' + message.uri.slice(-10));
|
|
4232
|
+
_context3.next = 16;
|
|
4233
|
+
break;
|
|
4234
|
+
case 14:
|
|
4235
|
+
debug.log(' addMessage: Suppress non-thread message in thread table ' + message.uri.slice(-10));
|
|
4236
|
+
return _context3.abrupt("return");
|
|
4237
|
+
case 16:
|
|
4238
|
+
_context3.next = 24;
|
|
4239
|
+
break;
|
|
4240
|
+
case 18:
|
|
4241
|
+
if (!thread) {
|
|
4242
|
+
_context3.next = 23;
|
|
4243
|
+
break;
|
|
4244
|
+
}
|
|
4245
|
+
debug.log(' addMessage: Suppress thread message in non-thread table ' + message.uri.slice(-10));
|
|
4246
|
+
return _context3.abrupt("return");
|
|
4247
|
+
case 23:
|
|
4248
|
+
debug.log(' addMessage: Normal non-thread message in non-thread table ' + message.uri.slice(-10));
|
|
4249
|
+
case 24:
|
|
4250
|
+
_context3.next = 26;
|
|
4251
|
+
return insertMessageIntoTable(channelObject, messageTable, message, messageTable.fresh, options, userContext);
|
|
4252
|
+
case 26:
|
|
4253
|
+
case "end":
|
|
4254
|
+
return _context3.stop();
|
|
4255
|
+
}
|
|
4256
|
+
}, _callee3);
|
|
4257
|
+
}));
|
|
4258
|
+
return _addMessage.apply(this, arguments);
|
|
3938
4259
|
};
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
var ele, ele2;
|
|
3942
|
-
for (ele = messageTable.firstChild; ele; ele = ele.nextSibling) {
|
|
3943
|
-
if (ele.AJAR_subject) {
|
|
3944
|
-
displayed[ele.AJAR_subject.uri] = true;
|
|
3945
|
-
}
|
|
3946
|
-
}
|
|
3947
|
-
var messages = _solidLogic.store.statementsMatching(about, ns.wf('message'), null, messageTable.chatDocument).map(function (st) {
|
|
3948
|
-
return st.object;
|
|
3949
|
-
});
|
|
3950
|
-
var stored = {};
|
|
3951
|
-
messages.forEach(function (m) {
|
|
3952
|
-
stored[m.uri] = true;
|
|
3953
|
-
if (!displayed[m.uri]) {
|
|
3954
|
-
addMessage(m, messageTable);
|
|
3955
|
-
}
|
|
3956
|
-
});
|
|
3957
|
-
|
|
3958
|
-
// eslint-disable-next-line space-in-parens
|
|
3959
|
-
for (ele = messageTable.firstChild; ele;) {
|
|
3960
|
-
ele2 = ele.nextSibling;
|
|
3961
|
-
if (ele.AJAR_subject && !stored[ele.AJAR_subject.uri]) {
|
|
3962
|
-
messageTable.removeChild(ele);
|
|
3963
|
-
}
|
|
3964
|
-
ele = ele2;
|
|
3965
|
-
}
|
|
3966
|
-
for (ele = messageTable.firstChild; ele; ele = ele.nextSibling) {
|
|
3967
|
-
if (ele.AJAR_subject) {
|
|
3968
|
-
// Refresh thumbs up etc
|
|
3969
|
-
widgets.refreshTree(ele); // Things inside may have changed too
|
|
3970
|
-
}
|
|
3971
|
-
}
|
|
4260
|
+
addMessage = function _addMessage2(_x13, _x14) {
|
|
4261
|
+
return _addMessage.apply(this, arguments);
|
|
3972
4262
|
};
|
|
3973
|
-
|
|
4263
|
+
_syncMessages = function _syncMessages3() {
|
|
4264
|
+
_syncMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(chatChannel, messageTable) {
|
|
4265
|
+
var displayed, ele, ele2, messages, stored, _iterator, _step, m;
|
|
4266
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
4267
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
4268
|
+
case 0:
|
|
4269
|
+
displayed = {};
|
|
4270
|
+
for (ele = messageTable.firstChild; ele; ele = ele.nextSibling) {
|
|
4271
|
+
if (ele.AJAR_subject) {
|
|
4272
|
+
displayed[ele.AJAR_subject.uri] = true;
|
|
4273
|
+
}
|
|
4274
|
+
}
|
|
4275
|
+
messages = _solidLogic.store.each(chatChannel, ns.wf('message'), null, messageTable.chatDocument);
|
|
4276
|
+
stored = {};
|
|
4277
|
+
_iterator = _createForOfIteratorHelper(messages);
|
|
4278
|
+
_context2.prev = 5;
|
|
4279
|
+
_iterator.s();
|
|
4280
|
+
case 7:
|
|
4281
|
+
if ((_step = _iterator.n()).done) {
|
|
4282
|
+
_context2.next = 15;
|
|
4283
|
+
break;
|
|
4284
|
+
}
|
|
4285
|
+
m = _step.value;
|
|
4286
|
+
stored[m.uri] = true;
|
|
4287
|
+
if (displayed[m.uri]) {
|
|
4288
|
+
_context2.next = 13;
|
|
4289
|
+
break;
|
|
4290
|
+
}
|
|
4291
|
+
_context2.next = 13;
|
|
4292
|
+
return addMessage(m, messageTable);
|
|
4293
|
+
case 13:
|
|
4294
|
+
_context2.next = 7;
|
|
4295
|
+
break;
|
|
4296
|
+
case 15:
|
|
4297
|
+
_context2.next = 20;
|
|
4298
|
+
break;
|
|
4299
|
+
case 17:
|
|
4300
|
+
_context2.prev = 17;
|
|
4301
|
+
_context2.t0 = _context2["catch"](5);
|
|
4302
|
+
_iterator.e(_context2.t0);
|
|
4303
|
+
case 20:
|
|
4304
|
+
_context2.prev = 20;
|
|
4305
|
+
_iterator.f();
|
|
4306
|
+
return _context2.finish(20);
|
|
4307
|
+
case 23:
|
|
4308
|
+
// eslint-disable-next-line space-in-parens
|
|
4309
|
+
for (ele = messageTable.firstChild; ele;) {
|
|
4310
|
+
ele2 = ele.nextSibling;
|
|
4311
|
+
if (ele.AJAR_subject && !stored[ele.AJAR_subject.uri]) {
|
|
4312
|
+
messageTable.removeChild(ele);
|
|
4313
|
+
}
|
|
4314
|
+
ele = ele2;
|
|
4315
|
+
}
|
|
4316
|
+
for (ele = messageTable.firstChild; ele; ele = ele.nextSibling) {
|
|
4317
|
+
if (ele.AJAR_subject) {
|
|
4318
|
+
// Refresh thumbs up etc
|
|
4319
|
+
widgets.refreshTree(ele); // Things inside may have changed too
|
|
4320
|
+
}
|
|
4321
|
+
}
|
|
4322
|
+
case 25:
|
|
4323
|
+
case "end":
|
|
4324
|
+
return _context2.stop();
|
|
4325
|
+
}
|
|
4326
|
+
}, _callee2, null, [[5, 17, 20, 23]]);
|
|
4327
|
+
}));
|
|
4328
|
+
return _syncMessages.apply(this, arguments);
|
|
4329
|
+
};
|
|
4330
|
+
syncMessages = function _syncMessages2(_x11, _x12) {
|
|
4331
|
+
return _syncMessages.apply(this, arguments);
|
|
4332
|
+
}; // ///////////////////////////////////////////////////////////////////////
|
|
4333
|
+
// syncMessages
|
|
4334
|
+
// Called once per original message displayed
|
|
4335
|
+
/* Add a new messageTable at the top/bottom
|
|
4336
|
+
*/
|
|
4337
|
+
/* Remove message tables earlier than this one
|
|
4338
|
+
*/
|
|
4339
|
+
/* Load and render message table
|
|
4340
|
+
** @returns DOM element generates
|
|
4341
|
+
*/
|
|
4342
|
+
// renderMessageTable
|
|
4343
|
+
/*
|
|
4344
|
+
function messageCount () {
|
|
4345
|
+
var n = 0
|
|
4346
|
+
const tables = div.children
|
|
4347
|
+
for (let i = 0; i < tables.length; i++) {
|
|
4348
|
+
n += tables[i].children.length - 1
|
|
4349
|
+
// debug.log(' table length:' + tables[i].children.length)
|
|
4350
|
+
}
|
|
4351
|
+
return n
|
|
4352
|
+
}
|
|
4353
|
+
*/
|
|
4354
|
+
/* Add the live message block with entry field for today
|
|
4355
|
+
*/
|
|
3974
4356
|
// Body of main function
|
|
3975
|
-
|
|
3976
4357
|
options = options || {};
|
|
3977
4358
|
options.authorDateOnLeft = false; // @@ make a user optiosn
|
|
3978
4359
|
newestFirst = options.newestFirst === '1' || options.newestFirst === true; // hack for now
|
|
@@ -3986,23 +4367,33 @@ function _infiniteMessageArea() {
|
|
|
3986
4367
|
statusArea: statusArea,
|
|
3987
4368
|
div: statusArea
|
|
3988
4369
|
}; // logged on state, pointers to user's stuff
|
|
3989
|
-
// const messageTable = dom.createElement('table') // @@ check does this go in renderMessageTable
|
|
3990
4370
|
earliest = {
|
|
3991
4371
|
messageTable: null
|
|
3992
4372
|
}; // Stuff about each end of the loaded days
|
|
3993
4373
|
latest = {
|
|
3994
4374
|
messageTable: null
|
|
3995
4375
|
};
|
|
4376
|
+
if (options.thread) {
|
|
4377
|
+
thread = options.thread;
|
|
4378
|
+
threadRootMessage = _solidLogic.store.any(null, ns.sioc('has_reply'), thread, thread.doc());
|
|
4379
|
+
if (threadRootMessage) {
|
|
4380
|
+
threadTime = _solidLogic.store.any(threadRootMessage, ns.dct('created'), null, threadRootMessage.doc());
|
|
4381
|
+
if (threadTime) {
|
|
4382
|
+
earliest.limit = new Date(threadTime.value);
|
|
4383
|
+
debug.log(' inifinite: thread start at ' + earliest.limit);
|
|
4384
|
+
}
|
|
4385
|
+
}
|
|
4386
|
+
}
|
|
3996
4387
|
lock = false;
|
|
3997
|
-
|
|
4388
|
+
_context15.next = 34;
|
|
3998
4389
|
return loadInitialContent();
|
|
3999
|
-
case
|
|
4000
|
-
return
|
|
4001
|
-
case
|
|
4390
|
+
case 34:
|
|
4391
|
+
return _context15.abrupt("return", div);
|
|
4392
|
+
case 35:
|
|
4002
4393
|
case "end":
|
|
4003
|
-
return
|
|
4394
|
+
return _context15.stop();
|
|
4004
4395
|
}
|
|
4005
|
-
},
|
|
4396
|
+
}, _callee15);
|
|
4006
4397
|
}));
|
|
4007
4398
|
return _infiniteMessageArea.apply(this, arguments);
|
|
4008
4399
|
}
|
|
@@ -4274,6 +4665,7 @@ exports.renderMessageEditor = renderMessageEditor;
|
|
|
4274
4665
|
exports.renderMessageRow = renderMessageRow;
|
|
4275
4666
|
exports.switchToEditor = switchToEditor;
|
|
4276
4667
|
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
|
|
4668
|
+
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js"));
|
|
4277
4669
|
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
4278
4670
|
var _infinite = __webpack_require__(/*! ./infinite */ "./lib/chat/infinite.js");
|
|
4279
4671
|
var _messageTools = __webpack_require__(/*! ./messageTools */ "./lib/chat/messageTools.js");
|
|
@@ -4293,9 +4685,14 @@ var _signature = __webpack_require__(/*! ./signature */ "./lib/chat/signature.js
|
|
|
4293
4685
|
var _keys = __webpack_require__(/*! ./keys */ "./lib/chat/keys.js");
|
|
4294
4686
|
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); }
|
|
4295
4687
|
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; }
|
|
4296
|
-
function
|
|
4688
|
+
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; }
|
|
4689
|
+
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; }
|
|
4690
|
+
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; } } }; }
|
|
4297
4691
|
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); }
|
|
4298
|
-
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; }
|
|
4692
|
+
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; } /** UI code for individual messages: display them, edit them
|
|
4693
|
+
*
|
|
4694
|
+
* @packageDocumentation
|
|
4695
|
+
*/ /* global $rdf */
|
|
4299
4696
|
var dom = window.document;
|
|
4300
4697
|
var messageBodyStyle = style.messageBodyStyle;
|
|
4301
4698
|
var label = utils.label;
|
|
@@ -4395,158 +4792,275 @@ function creatorAndDateHorizontal(td1, creator, date, message) {
|
|
|
4395
4792
|
* @param userContext
|
|
4396
4793
|
* @returns Message Row HTML Table Element
|
|
4397
4794
|
*/
|
|
4398
|
-
function renderMessageRow(
|
|
4399
|
-
|
|
4400
|
-
var colorizeByAuthor = options.colorizeByAuthor === '1' || options.colorizeByAuthor === true;
|
|
4401
|
-
var creator = _solidLogic.store.any(message, ns.foaf('maker'));
|
|
4402
|
-
var date = _solidLogic.store.any(message, ns.dct('created'));
|
|
4403
|
-
var latestVersion = (0, _chatLogic.mostRecentVersion)(message);
|
|
4404
|
-
var latestVersionCreator = _solidLogic.store.any(latestVersion, ns.foaf('maker'));
|
|
4405
|
-
|
|
4406
|
-
// use latest content if same owner, else use original
|
|
4407
|
-
var msgId = creator.uri === latestVersionCreator.uri ? latestVersion : message;
|
|
4408
|
-
var content = _solidLogic.store.any(msgId, ns.sioc('content'));
|
|
4409
|
-
var signature = _solidLogic.store.any(msgId, $rdf.sym("".concat(_signature.SEC, "proofValue")));
|
|
4410
|
-
|
|
4411
|
-
// set message object
|
|
4412
|
-
var msg = (0, _signature.getBlankMsg)();
|
|
4413
|
-
msg.id = msgId.uri;
|
|
4414
|
-
msg.created = _solidLogic.store.any(msgId, ns.dct('created')).value;
|
|
4415
|
-
msg.content = content.value;
|
|
4416
|
-
msg.maker = creator.uri;
|
|
4417
|
-
|
|
4418
|
-
// unsigned message
|
|
4419
|
-
if (!(signature !== null && signature !== void 0 && signature.value)) {
|
|
4420
|
-
unsignedMessage = true;
|
|
4421
|
-
debug.warn(msgId.uri + ' is unsigned'); // TODO replace with UI (colored message ?)
|
|
4422
|
-
} else {
|
|
4423
|
-
// signed message, get public key and check signature
|
|
4424
|
-
(0, _keys.getPublicKey)(creator).then(function (publicKey) {
|
|
4425
|
-
debug.log(creator.uri + '\n' + msg.created + '\n' + msg.id + '\n' + publicKey);
|
|
4426
|
-
if (!publicKey) {
|
|
4427
|
-
// TODO try to recreate the publicKey
|
|
4428
|
-
// if(me.uri === creator.uri) await getPrivateKey(creator)
|
|
4429
|
-
debug.warn('message is signed but ' + creator.uri + ' is missing publicKey');
|
|
4430
|
-
}
|
|
4431
|
-
// check that publicKey is a valid hex string
|
|
4432
|
-
var regex = /[0-9A-Fa-f]{6}/g;
|
|
4433
|
-
if (!(publicKey !== null && publicKey !== void 0 && publicKey.match(regex))) debug.warn('invalid publicKey hex string\n' + creator.uri + '\n' + publicKey);
|
|
4434
|
-
// verify signature
|
|
4435
|
-
else if (signature !== null && signature !== void 0 && signature.value && !(0, _signature.verifySignature)(signature === null || signature === void 0 ? void 0 : signature.value, msg, publicKey)) debug.warn('invalid signature\n' + msg.id);
|
|
4436
|
-
});
|
|
4437
|
-
}
|
|
4438
|
-
var originalMessage = (0, _chatLogic.originalVersion)(message);
|
|
4439
|
-
var edited = !message.sameTerm(originalMessage);
|
|
4440
|
-
var sortDate = _solidLogic.store.the(originalMessage, ns.dct('created'), null, originalMessage.doc()); // In message
|
|
4441
|
-
|
|
4442
|
-
var messageRow = dom.createElement('tr');
|
|
4443
|
-
if (unsignedMessage) messageRow.setAttribute('style', 'background-color: red');
|
|
4444
|
-
messageRow.AJAR_date = sortDate.value;
|
|
4445
|
-
messageRow.AJAR_subject = message;
|
|
4446
|
-
var td1 = dom.createElement('td');
|
|
4447
|
-
messageRow.appendChild(td1);
|
|
4448
|
-
if (!options.authorDateOnLeft) {
|
|
4449
|
-
var img = dom.createElement('img');
|
|
4450
|
-
img.setAttribute('style', 'max-height: 2.5em; max-width: 2.5em; border-radius: 0.5em; margin: auto;');
|
|
4451
|
-
widgets.setImage(img, creator);
|
|
4452
|
-
td1.appendChild(img);
|
|
4453
|
-
} else {
|
|
4454
|
-
creatorAndDate(td1, creator, widgets.shortDate(sortDate.value), message);
|
|
4455
|
-
}
|
|
4456
|
-
var bothDates = widgets.shortDate(sortDate.value);
|
|
4457
|
-
if (edited) {
|
|
4458
|
-
bothDates += ' ... ' + widgets.shortDate(date.value);
|
|
4459
|
-
}
|
|
4460
|
-
|
|
4461
|
-
// Render the content ot the message itself
|
|
4462
|
-
var td2 = messageRow.appendChild(dom.createElement('td'));
|
|
4463
|
-
if (!options.authorDateOnLeft) {
|
|
4464
|
-
creatorAndDateHorizontal(td2, creator, bothDates,
|
|
4465
|
-
// widgets.shortDate(dateString)
|
|
4466
|
-
message);
|
|
4467
|
-
}
|
|
4468
|
-
var text = content.value.trim();
|
|
4469
|
-
var isURI = /^https?:\/[^ <>]*$/i.test(text);
|
|
4470
|
-
var para = null;
|
|
4471
|
-
if (isURI) {
|
|
4472
|
-
var isImage = /\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(text); // @@ Should use content-type not URI
|
|
4473
|
-
if (isImage && options.expandImagesInline) {
|
|
4474
|
-
var _img = elementForImageURI(text, options);
|
|
4475
|
-
td2.appendChild(_img);
|
|
4476
|
-
} else {
|
|
4477
|
-
// Link but not Image
|
|
4478
|
-
var anc = td2.appendChild(dom.createElement('a'));
|
|
4479
|
-
para = anc.appendChild(dom.createElement('p'));
|
|
4480
|
-
anc.href = text;
|
|
4481
|
-
para.textContent = text;
|
|
4482
|
-
td2.appendChild(anc);
|
|
4483
|
-
}
|
|
4484
|
-
} else {
|
|
4485
|
-
// text
|
|
4486
|
-
para = dom.createElement('p');
|
|
4487
|
-
td2.appendChild(para);
|
|
4488
|
-
para.textContent = text;
|
|
4489
|
-
}
|
|
4490
|
-
if (para) {
|
|
4491
|
-
var bgcolor = colorizeByAuthor ? pad.lightColorHash(creator) : getBgColor(fresh);
|
|
4492
|
-
para.setAttribute('style', messageBodyStyle + 'background-color: ' + bgcolor + ';');
|
|
4493
|
-
}
|
|
4494
|
-
function getBgColor(fresh) {
|
|
4495
|
-
return fresh ? '#e8ffe8' : 'white';
|
|
4496
|
-
}
|
|
4497
|
-
|
|
4498
|
-
// Sentiment strip
|
|
4499
|
-
var strip = (0, _messageTools.sentimentStripLinked)(message, message.doc());
|
|
4500
|
-
if (strip.children.length) {
|
|
4501
|
-
td2.appendChild(dom.createElement('br'));
|
|
4502
|
-
td2.appendChild(strip);
|
|
4503
|
-
}
|
|
4504
|
-
|
|
4505
|
-
// Message tool bar button
|
|
4506
|
-
var td3 = dom.createElement('td');
|
|
4507
|
-
messageRow.appendChild(td3);
|
|
4508
|
-
var toolsButton = widgets.button(dom, _iconBase.icons.iconBase + 'noun_243787.svg', '...');
|
|
4509
|
-
td3.appendChild(toolsButton);
|
|
4510
|
-
toolsButton.addEventListener('click', function (_event) {
|
|
4511
|
-
if (messageRow.toolTR) {
|
|
4512
|
-
// already got a toolbar? Toogle
|
|
4513
|
-
messageRow.parentNode.removeChild(messageRow.toolTR);
|
|
4514
|
-
delete messageRow.toolTR;
|
|
4515
|
-
return;
|
|
4516
|
-
}
|
|
4517
|
-
var toolsTR = dom.createElement('tr');
|
|
4518
|
-
var tools = (0, _messageTools.messageToolbar)(message, messageRow, userContext, channelObject);
|
|
4519
|
-
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
|
|
4520
|
-
if (messageRow.nextSibling) {
|
|
4521
|
-
messageRow.parentElement.insertBefore(toolsTR, messageRow.nextSibling);
|
|
4522
|
-
} else {
|
|
4523
|
-
messageRow.parentElement.appendChild(toolsTR);
|
|
4524
|
-
}
|
|
4525
|
-
messageRow.toolTR = toolsTR;
|
|
4526
|
-
toolsTR.appendChild(dom.createElement('td')); // left
|
|
4527
|
-
var toolsTD = toolsTR.appendChild(dom.createElement('td'));
|
|
4528
|
-
toolsTR.appendChild(dom.createElement('td')); // right
|
|
4529
|
-
toolsTD.appendChild(tools);
|
|
4530
|
-
});
|
|
4531
|
-
return messageRow;
|
|
4795
|
+
function renderMessageRow(_x, _x2, _x3, _x4, _x5) {
|
|
4796
|
+
return _renderMessageRow.apply(this, arguments);
|
|
4532
4797
|
} // END OF RENDERMESSAGE
|
|
4533
|
-
|
|
4534
|
-
function
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4798
|
+
function _renderMessageRow() {
|
|
4799
|
+
_renderMessageRow = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(channelObject, message, fresh, options, userContext) {
|
|
4800
|
+
var unsignedMessage, colorizeByAuthor, creator, date, latestVersion, latestVersionCreator, msgId, content, versions, replies, thread, straightReplies, _iterator2, _step2, reply, signature, msg, originalMessage, edited, sortDate, messageRow, td1, img, bothDates, td2, text, isURI, para, isImage, _img, anc, bgcolor, getBgColor, strip, td3, toolsButton;
|
|
4801
|
+
return _regenerator["default"].wrap(function _callee9$(_context10) {
|
|
4802
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
4803
|
+
case 0:
|
|
4804
|
+
getBgColor = function _getBgColor(fresh) {
|
|
4805
|
+
return fresh ? '#e8ffe8' : 'white';
|
|
4806
|
+
};
|
|
4807
|
+
unsignedMessage = false;
|
|
4808
|
+
colorizeByAuthor = options.colorizeByAuthor === '1' || options.colorizeByAuthor === true; // const id = store.any(latestVersion, ns.sioc('id'))
|
|
4809
|
+
// const replies = store.each(latestVersion, ns.sioc('has_reply'))
|
|
4810
|
+
creator = _solidLogic.store.any(message, ns.foaf('maker'));
|
|
4811
|
+
date = _solidLogic.store.any(message, ns.dct('created'));
|
|
4812
|
+
_context10.next = 7;
|
|
4813
|
+
return (0, _chatLogic.mostRecentVersion)(message);
|
|
4814
|
+
case 7:
|
|
4815
|
+
latestVersion = _context10.sent;
|
|
4816
|
+
debug.log('@@@@ alain mostRecentVersion');
|
|
4817
|
+
debug.log(message);
|
|
4818
|
+
debug.log(latestVersion);
|
|
4819
|
+
latestVersionCreator = _solidLogic.store.any(latestVersion, ns.foaf('maker')); // use latest content if same owner, else use original
|
|
4820
|
+
// this is may be too strict. Should we find latest valid version if any ?
|
|
4821
|
+
debug.log('@@@@ alain creator');
|
|
4822
|
+
debug.log(creator);
|
|
4823
|
+
debug.log(latestVersionCreator);
|
|
4824
|
+
msgId = creator.uri === (latestVersionCreator === null || latestVersionCreator === void 0 ? void 0 : latestVersionCreator.uri) ? latestVersion : message;
|
|
4825
|
+
content = _solidLogic.store.any(msgId, ns.sioc('content'));
|
|
4826
|
+
_context10.next = 19;
|
|
4827
|
+
return (0, _chatLogic.allVersions)(msgId);
|
|
4828
|
+
case 19:
|
|
4829
|
+
versions = _context10.sent;
|
|
4830
|
+
if (versions.length > 1) {
|
|
4831
|
+
debug.log('renderMessageRow versions: ', versions.join(', '));
|
|
4832
|
+
}
|
|
4833
|
+
// be tolerant in accepting replies on any version of a message
|
|
4834
|
+
replies = versions.map(function (version) {
|
|
4835
|
+
return _solidLogic.store.each(version, ns.sioc('has_reply'));
|
|
4836
|
+
}).flat();
|
|
4837
|
+
thread = null;
|
|
4838
|
+
straightReplies = [];
|
|
4839
|
+
_iterator2 = _createForOfIteratorHelper(replies);
|
|
4840
|
+
try {
|
|
4841
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
4842
|
+
reply = _step2.value;
|
|
4843
|
+
if (_solidLogic.store.holds(reply, ns.rdf('type'), ns.sioc('Thread'))) {
|
|
4844
|
+
thread = reply;
|
|
4845
|
+
debug.log('renderMessageRow: found thread: ' + thread);
|
|
4846
|
+
} else {
|
|
4847
|
+
straightReplies.push(reply);
|
|
4848
|
+
}
|
|
4849
|
+
}
|
|
4850
|
+
} catch (err) {
|
|
4851
|
+
_iterator2.e(err);
|
|
4852
|
+
} finally {
|
|
4853
|
+
_iterator2.f();
|
|
4854
|
+
}
|
|
4855
|
+
if (straightReplies.length > 1) {
|
|
4856
|
+
debug.log('renderMessageRow: found normal replies: ', straightReplies);
|
|
4857
|
+
}
|
|
4858
|
+
debug.log('@@@@ is thread');
|
|
4859
|
+
if (!thread) {
|
|
4860
|
+
// thread = store.any(message, ns.sioc('has_reply'))
|
|
4861
|
+
thread = _solidLogic.store.any(null, ns.sioc('has_member'), message);
|
|
4862
|
+
}
|
|
4863
|
+
// get signature
|
|
4864
|
+
signature = _solidLogic.store.any(msgId, $rdf.sym("".concat(_signature.SEC, "proofValue"))); // set proof message object
|
|
4865
|
+
msg = (0, _signature.getBlankMsg)();
|
|
4866
|
+
msg.id = msgId.uri;
|
|
4867
|
+
msg.created = _solidLogic.store.any(msgId, ns.dct('created')).value;
|
|
4868
|
+
msg.content = content.value;
|
|
4869
|
+
msg.maker = creator.uri;
|
|
4870
|
+
|
|
4871
|
+
// verify signature
|
|
4872
|
+
if (!(signature !== null && signature !== void 0 && signature.value)) {
|
|
4873
|
+
// unsigned message
|
|
4874
|
+
unsignedMessage = true;
|
|
4875
|
+
debug.warn(msgId.uri + ' is unsigned'); // TODO replace with UI (colored message ?)
|
|
4876
|
+
} else {
|
|
4877
|
+
// signed message, get public key and check signature
|
|
4878
|
+
(0, _keys.getPublicKey)(creator).then(function (publicKey) {
|
|
4879
|
+
debug.log(creator.uri + '\n' + msg.created + '\n' + msg.id + '\n' + publicKey);
|
|
4880
|
+
if (!publicKey) {
|
|
4881
|
+
debug.warn('message is signed but ' + creator.uri + ' is missing publicKey');
|
|
4882
|
+
}
|
|
4883
|
+
// check that publicKey is a valid hex string
|
|
4884
|
+
var regex = /[0-9A-Fa-f]{6}/g;
|
|
4885
|
+
if (!(publicKey !== null && publicKey !== void 0 && publicKey.match(regex))) debug.warn('invalid publicKey hex string\n' + creator.uri + '\n' + publicKey);
|
|
4886
|
+
// verify signature
|
|
4887
|
+
else if (signature !== null && signature !== void 0 && signature.value && !(0, _signature.verifySignature)(signature === null || signature === void 0 ? void 0 : signature.value, msg, publicKey)) debug.warn('invalid signature\n' + msg.id);
|
|
4888
|
+
});
|
|
4889
|
+
}
|
|
4890
|
+
_context10.next = 38;
|
|
4891
|
+
return (0, _chatLogic.originalVersion)(message);
|
|
4892
|
+
case 38:
|
|
4893
|
+
originalMessage = _context10.sent;
|
|
4894
|
+
edited = !message.sameTerm(originalMessage); // @@ load it first @@ Or display the new data at the old date.
|
|
4895
|
+
// @@@ kludge!
|
|
4896
|
+
sortDate = _solidLogic.store.the(originalMessage, ns.dct('created'), null, originalMessage.doc()) || _solidLogic.store.the(message, ns.dct('created'), null, message.doc()); // In message
|
|
4897
|
+
messageRow = dom.createElement('tr');
|
|
4898
|
+
if (unsignedMessage) messageRow.setAttribute('style', 'background-color: red');
|
|
4899
|
+
messageRow.AJAR_date = sortDate.value;
|
|
4900
|
+
messageRow.AJAR_subject = message;
|
|
4901
|
+
td1 = dom.createElement('td');
|
|
4902
|
+
messageRow.appendChild(td1);
|
|
4903
|
+
if (!options.authorDateOnLeft) {
|
|
4904
|
+
img = dom.createElement('img');
|
|
4905
|
+
img.setAttribute('style', 'max-height: 2.5em; max-width: 2.5em; border-radius: 0.5em; margin: auto;');
|
|
4906
|
+
widgets.setImage(img, creator);
|
|
4907
|
+
td1.appendChild(img);
|
|
4908
|
+
} else {
|
|
4909
|
+
creatorAndDate(td1, creator, widgets.shortDate(sortDate.value), message);
|
|
4910
|
+
}
|
|
4911
|
+
bothDates = widgets.shortDate(sortDate.value);
|
|
4912
|
+
if (edited) {
|
|
4913
|
+
bothDates += ' ... ' + widgets.shortDate(date.value);
|
|
4914
|
+
}
|
|
4915
|
+
|
|
4916
|
+
// Render the content ot the message itself
|
|
4917
|
+
td2 = messageRow.appendChild(dom.createElement('td'));
|
|
4918
|
+
if (!options.authorDateOnLeft) {
|
|
4919
|
+
creatorAndDateHorizontal(td2, creator, bothDates,
|
|
4920
|
+
// widgets.shortDate(dateString)
|
|
4921
|
+
message);
|
|
4922
|
+
}
|
|
4923
|
+
text = content ? content.value.trim() : '??? no content?';
|
|
4924
|
+
isURI = /^https?:\/[^ <>]*$/i.test(text);
|
|
4925
|
+
para = null;
|
|
4926
|
+
if (isURI) {
|
|
4927
|
+
isImage = /\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(text); // @@ Should use content-type not URI
|
|
4928
|
+
if (isImage && options.expandImagesInline) {
|
|
4929
|
+
_img = elementForImageURI(text, options);
|
|
4930
|
+
td2.appendChild(_img);
|
|
4931
|
+
} else {
|
|
4932
|
+
// Link but not Image
|
|
4933
|
+
anc = td2.appendChild(dom.createElement('a'));
|
|
4934
|
+
para = anc.appendChild(dom.createElement('p'));
|
|
4935
|
+
anc.href = text;
|
|
4936
|
+
para.textContent = text;
|
|
4937
|
+
td2.appendChild(anc);
|
|
4938
|
+
}
|
|
4939
|
+
} else {
|
|
4940
|
+
// text
|
|
4941
|
+
para = dom.createElement('p');
|
|
4942
|
+
td2.appendChild(para);
|
|
4943
|
+
para.textContent = text;
|
|
4944
|
+
}
|
|
4945
|
+
if (para) {
|
|
4946
|
+
bgcolor = colorizeByAuthor ? pad.lightColorHash(creator) : getBgColor(fresh);
|
|
4947
|
+
para.setAttribute('style', messageBodyStyle + 'background-color: ' + bgcolor + ';');
|
|
4948
|
+
}
|
|
4949
|
+
_context10.next = 59;
|
|
4950
|
+
return (0, _messageTools.sentimentStripLinked)(message, message.doc());
|
|
4951
|
+
case 59:
|
|
4952
|
+
strip = _context10.sent;
|
|
4953
|
+
if (strip.children.length) {
|
|
4954
|
+
td2.appendChild(dom.createElement('br'));
|
|
4955
|
+
td2.appendChild(strip);
|
|
4956
|
+
}
|
|
4957
|
+
|
|
4958
|
+
// Message tool bar button
|
|
4959
|
+
td3 = dom.createElement('td');
|
|
4960
|
+
messageRow.appendChild(td3);
|
|
4961
|
+
toolsButton = widgets.button(dom, _iconBase.icons.iconBase + 'noun_243787.svg', '...');
|
|
4962
|
+
td3.appendChild(toolsButton);
|
|
4963
|
+
toolsButton.addEventListener('click', /*#__PURE__*/function () {
|
|
4964
|
+
var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(_event) {
|
|
4965
|
+
var toolsTR, tools, toolsTD;
|
|
4966
|
+
return _regenerator["default"].wrap(function _callee8$(_context9) {
|
|
4967
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
4968
|
+
case 0:
|
|
4969
|
+
if (!messageRow.toolTR) {
|
|
4970
|
+
_context9.next = 4;
|
|
4971
|
+
break;
|
|
4972
|
+
}
|
|
4973
|
+
// already got a toolbar? Toogle
|
|
4974
|
+
messageRow.parentNode.removeChild(messageRow.toolTR);
|
|
4975
|
+
delete messageRow.toolTR;
|
|
4976
|
+
return _context9.abrupt("return");
|
|
4977
|
+
case 4:
|
|
4978
|
+
toolsTR = dom.createElement('tr');
|
|
4979
|
+
_context9.next = 7;
|
|
4980
|
+
return (0, _messageTools.messageToolbar)(message, messageRow, _objectSpread(_objectSpread({}, userContext), {}, {
|
|
4981
|
+
chatOptions: options
|
|
4982
|
+
}), channelObject);
|
|
4983
|
+
case 7:
|
|
4984
|
+
tools = _context9.sent;
|
|
4985
|
+
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
|
|
4986
|
+
if (messageRow.nextSibling) {
|
|
4987
|
+
messageRow.parentElement.insertBefore(toolsTR, messageRow.nextSibling);
|
|
4988
|
+
} else {
|
|
4989
|
+
messageRow.parentElement.appendChild(toolsTR);
|
|
4990
|
+
}
|
|
4991
|
+
messageRow.toolTR = toolsTR;
|
|
4992
|
+
toolsTR.appendChild(dom.createElement('td')); // left
|
|
4993
|
+
toolsTD = toolsTR.appendChild(dom.createElement('td'));
|
|
4994
|
+
toolsTR.appendChild(dom.createElement('td')); // right
|
|
4995
|
+
toolsTD.appendChild(tools);
|
|
4996
|
+
case 15:
|
|
4997
|
+
case "end":
|
|
4998
|
+
return _context9.stop();
|
|
4999
|
+
}
|
|
5000
|
+
}, _callee8);
|
|
5001
|
+
}));
|
|
5002
|
+
return function (_x20) {
|
|
5003
|
+
return _ref4.apply(this, arguments);
|
|
5004
|
+
};
|
|
5005
|
+
}());
|
|
5006
|
+
if (thread && options.showThread) {
|
|
5007
|
+
debug.log(' message has thread ' + thread);
|
|
5008
|
+
td3.appendChild(widgets.button(dom, _iconBase.icons.iconBase + 'noun_1180164.svg',
|
|
5009
|
+
// right arrow .. @@ think of stg better
|
|
5010
|
+
'see thread', function (_e) {
|
|
5011
|
+
debug.log('@@@@ Calling showThread thread ' + thread);
|
|
5012
|
+
options.showThread(thread, options);
|
|
5013
|
+
}));
|
|
5014
|
+
}
|
|
5015
|
+
return _context10.abrupt("return", messageRow);
|
|
5016
|
+
case 68:
|
|
5017
|
+
case "end":
|
|
5018
|
+
return _context10.stop();
|
|
5019
|
+
}
|
|
5020
|
+
}, _callee9);
|
|
5021
|
+
}));
|
|
5022
|
+
return _renderMessageRow.apply(this, arguments);
|
|
5023
|
+
}
|
|
5024
|
+
function switchToEditor(_x6, _x7, _x8, _x9) {
|
|
5025
|
+
return _switchToEditor.apply(this, arguments);
|
|
5026
|
+
}
|
|
5027
|
+
/* Control for a new message -- or editing an old message ***************
|
|
5028
|
+
*
|
|
5029
|
+
*/
|
|
5030
|
+
function _switchToEditor() {
|
|
5031
|
+
_switchToEditor = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(messageRow, message, channelObject, userContext) {
|
|
5032
|
+
var messageTable, editRow;
|
|
5033
|
+
return _regenerator["default"].wrap(function _callee10$(_context11) {
|
|
5034
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
5035
|
+
case 0:
|
|
5036
|
+
messageTable = messageRow.parentNode;
|
|
5037
|
+
_context11.t0 = renderMessageEditor;
|
|
5038
|
+
_context11.t1 = channelObject;
|
|
5039
|
+
_context11.t2 = messageTable;
|
|
5040
|
+
_context11.t3 = userContext;
|
|
5041
|
+
_context11.t4 = channelObject.options;
|
|
5042
|
+
_context11.next = 8;
|
|
5043
|
+
return (0, _chatLogic.mostRecentVersion)(message);
|
|
5044
|
+
case 8:
|
|
5045
|
+
_context11.t5 = _context11.sent;
|
|
5046
|
+
editRow = (0, _context11.t0)(_context11.t1, _context11.t2, _context11.t3, _context11.t4, _context11.t5);
|
|
5047
|
+
messageTable.insertBefore(editRow, messageRow);
|
|
5048
|
+
editRow.originalRow = messageRow;
|
|
5049
|
+
messageRow.style.visibility = 'hidden'; // Hide the original message. unhide if user cancels edit
|
|
5050
|
+
case 13:
|
|
5051
|
+
case "end":
|
|
5052
|
+
return _context11.stop();
|
|
5053
|
+
}
|
|
5054
|
+
}, _callee10);
|
|
5055
|
+
}));
|
|
5056
|
+
return _switchToEditor.apply(this, arguments);
|
|
5057
|
+
}
|
|
5058
|
+
function renderMessageEditor(channelObject, messageTable, userContext, options, originalMessage) {
|
|
5059
|
+
function revertEditing(messageEditor) {
|
|
5060
|
+
messageEditor.originalRow.style.visibility = 'visible'; // restore read-only version
|
|
5061
|
+
messageEditor.parentNode.removeChild(messageEditor);
|
|
4548
5062
|
}
|
|
4549
|
-
function handleFieldInput(
|
|
5063
|
+
function handleFieldInput(_x10) {
|
|
4550
5064
|
return _handleFieldInput.apply(this, arguments);
|
|
4551
5065
|
}
|
|
4552
5066
|
function _handleFieldInput() {
|
|
@@ -4564,70 +5078,86 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4564
5078
|
}));
|
|
4565
5079
|
return _handleFieldInput.apply(this, arguments);
|
|
4566
5080
|
}
|
|
4567
|
-
function sendMessage(
|
|
5081
|
+
function sendMessage(_x11, _x12) {
|
|
4568
5082
|
return _sendMessage.apply(this, arguments);
|
|
4569
5083
|
} // sendMessage
|
|
4570
5084
|
// DRAG AND DROP
|
|
4571
5085
|
function _sendMessage() {
|
|
4572
|
-
_sendMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
4573
|
-
var sendComplete, message, statusArea;
|
|
4574
|
-
return _regenerator["default"].wrap(function
|
|
4575
|
-
while (1) switch (
|
|
5086
|
+
_sendMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(text, fromMainField) {
|
|
5087
|
+
var sendComplete, _sendComplete, message, statusArea;
|
|
5088
|
+
return _regenerator["default"].wrap(function _callee7$(_context8) {
|
|
5089
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
4576
5090
|
case 0:
|
|
4577
|
-
|
|
4578
|
-
(0,
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
debug.warn('No parentNode on old message ' + oldRow.textContent);
|
|
4588
|
-
oldRow.style.backgroundColor = '#fee';
|
|
4589
|
-
oldRow.style.visibility = 'hidden'; // @@ FIX THIS AND REMOVE FROM DOM INSTEAD
|
|
4590
|
-
}
|
|
5091
|
+
_sendComplete = function _sendComplete3() {
|
|
5092
|
+
_sendComplete = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(message, _text2) {
|
|
5093
|
+
var oldRow;
|
|
5094
|
+
return _regenerator["default"].wrap(function _callee6$(_context7) {
|
|
5095
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
5096
|
+
case 0:
|
|
5097
|
+
_context7.next = 2;
|
|
5098
|
+
return (0, _infinite.insertMessageIntoTable)(channelObject, messageTable, message, false, options, userContext);
|
|
5099
|
+
case 2:
|
|
5100
|
+
// not green
|
|
4591
5101
|
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
}
|
|
4603
|
-
// await channelObject.div.refresh() // Add new day if nec @@ add back
|
|
4604
|
-
};
|
|
5102
|
+
if (originalMessage) {
|
|
5103
|
+
// editing another message
|
|
5104
|
+
oldRow = messageEditor.originalRow; // oldRow.style.display = '' // restore read-only version, re-attack
|
|
5105
|
+
if (oldRow.parentNode) {
|
|
5106
|
+
oldRow.parentNode.removeChild(oldRow); // No longer needed old version
|
|
5107
|
+
} else {
|
|
5108
|
+
debug.warn('No parentNode on old message ' + oldRow.textContent);
|
|
5109
|
+
oldRow.style.backgroundColor = '#fee';
|
|
5110
|
+
oldRow.style.visibility = 'hidden'; // @@ FIX THIS AND REMOVE FROM DOM INSTEAD
|
|
5111
|
+
}
|
|
4605
5112
|
|
|
4606
|
-
|
|
5113
|
+
messageEditor.parentNode.removeChild(messageEditor); // no longer need editor
|
|
5114
|
+
} else {
|
|
5115
|
+
if (fromMainField) {
|
|
5116
|
+
field.value = ''; // clear from out for reuse
|
|
5117
|
+
field.setAttribute('style', messageBodyStyle);
|
|
5118
|
+
field.disabled = false;
|
|
5119
|
+
field.scrollIntoView(options.newestFirst); // allign bottom (top)
|
|
5120
|
+
field.focus(); // Start typing next line immediately
|
|
5121
|
+
field.select();
|
|
5122
|
+
}
|
|
5123
|
+
}
|
|
5124
|
+
// await channelObject.div.refresh() // Add new day if nec @@ add back
|
|
5125
|
+
case 3:
|
|
5126
|
+
case "end":
|
|
5127
|
+
return _context7.stop();
|
|
5128
|
+
}
|
|
5129
|
+
}, _callee6);
|
|
5130
|
+
}));
|
|
5131
|
+
return _sendComplete.apply(this, arguments);
|
|
5132
|
+
};
|
|
5133
|
+
sendComplete = function _sendComplete2(_x18, _x19) {
|
|
5134
|
+
return _sendComplete.apply(this, arguments);
|
|
5135
|
+
}; // const me = authn.currentUser() // Must be logged on or wuld have got login button
|
|
4607
5136
|
if (fromMainField) {
|
|
4608
5137
|
field.setAttribute('style', messageBodyStyle + 'color: #bbb;'); // pendingedit
|
|
4609
5138
|
field.disabled = true;
|
|
4610
5139
|
}
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
return channelObject.updateMessage(text, originalMessage);
|
|
4614
|
-
case
|
|
4615
|
-
message =
|
|
4616
|
-
|
|
5140
|
+
_context8.prev = 3;
|
|
5141
|
+
_context8.next = 6;
|
|
5142
|
+
return channelObject.updateMessage(text, originalMessage, null, options.thread);
|
|
5143
|
+
case 6:
|
|
5144
|
+
message = _context8.sent;
|
|
5145
|
+
_context8.next = 14;
|
|
4617
5146
|
break;
|
|
4618
|
-
case
|
|
4619
|
-
|
|
4620
|
-
|
|
5147
|
+
case 9:
|
|
5148
|
+
_context8.prev = 9;
|
|
5149
|
+
_context8.t0 = _context8["catch"](3);
|
|
4621
5150
|
statusArea = userContext.statusArea || messageEditor;
|
|
4622
|
-
statusArea.appendChild(widgets.errorMessageBlock(dom, 'Error writing message: ' +
|
|
4623
|
-
return
|
|
4624
|
-
case 13:
|
|
4625
|
-
sendComplete(message, text);
|
|
5151
|
+
statusArea.appendChild(widgets.errorMessageBlock(dom, 'Error writing message: ' + _context8.t0));
|
|
5152
|
+
return _context8.abrupt("return");
|
|
4626
5153
|
case 14:
|
|
5154
|
+
_context8.next = 16;
|
|
5155
|
+
return sendComplete(message, text);
|
|
5156
|
+
case 16:
|
|
4627
5157
|
case "end":
|
|
4628
|
-
return
|
|
5158
|
+
return _context8.stop();
|
|
4629
5159
|
}
|
|
4630
|
-
},
|
|
5160
|
+
}, _callee7, null, [[3, 9]]);
|
|
4631
5161
|
}));
|
|
4632
5162
|
return _sendMessage.apply(this, arguments);
|
|
4633
5163
|
}
|
|
@@ -4646,7 +5176,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4646
5176
|
}
|
|
4647
5177
|
}, _callee);
|
|
4648
5178
|
}));
|
|
4649
|
-
return function (
|
|
5179
|
+
return function (_x13, _x14) {
|
|
4650
5180
|
return _ref.apply(this, arguments);
|
|
4651
5181
|
};
|
|
4652
5182
|
}());
|
|
@@ -4690,7 +5220,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4690
5220
|
}
|
|
4691
5221
|
}, _callee2, null, [[1, 11, 14, 17]]);
|
|
4692
5222
|
}));
|
|
4693
|
-
return function droppedURIHandler(
|
|
5223
|
+
return function droppedURIHandler(_x15) {
|
|
4694
5224
|
return _ref2.apply(this, arguments);
|
|
4695
5225
|
};
|
|
4696
5226
|
}();
|
|
@@ -4701,7 +5231,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4701
5231
|
imageDoc = $rdf.sym(chatDocument.dir().uri + 'Image_' + Date.now() + '.png');
|
|
4702
5232
|
return imageDoc;
|
|
4703
5233
|
}
|
|
4704
|
-
function tookPicture(
|
|
5234
|
+
function tookPicture(_x16) {
|
|
4705
5235
|
return _tookPicture.apply(this, arguments);
|
|
4706
5236
|
} // Body of turnOnInput
|
|
4707
5237
|
function _tookPicture() {
|
|
@@ -4778,7 +5308,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4778
5308
|
}
|
|
4779
5309
|
}, _callee3);
|
|
4780
5310
|
}));
|
|
4781
|
-
return function (
|
|
5311
|
+
return function (_x17) {
|
|
4782
5312
|
return _ref3.apply(this, arguments);
|
|
4783
5313
|
};
|
|
4784
5314
|
}(), false);
|
|
@@ -4840,7 +5370,7 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4840
5370
|
turnOnInput();
|
|
4841
5371
|
Object.assign(context, userContext);
|
|
4842
5372
|
(0, _bookmarks.findBookmarkDocument)(context).then(function (_context) {
|
|
4843
|
-
//
|
|
5373
|
+
// debug.log('Bookmark file: ' + context.bookmarkDocument)
|
|
4844
5374
|
});
|
|
4845
5375
|
});
|
|
4846
5376
|
return messageEditor;
|
|
@@ -4863,12 +5393,15 @@ var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_m
|
|
|
4863
5393
|
Object.defineProperty(exports, "__esModule", ({
|
|
4864
5394
|
value: true
|
|
4865
5395
|
}));
|
|
5396
|
+
exports.ActionClassFromEmoji = ActionClassFromEmoji;
|
|
5397
|
+
exports.emojiFromAction = emojiFromAction;
|
|
5398
|
+
exports.emojiFromActionClass = emojiFromActionClass;
|
|
4866
5399
|
exports.messageToolbar = messageToolbar;
|
|
4867
5400
|
exports.sentimentStrip = sentimentStrip;
|
|
4868
5401
|
exports.sentimentStripLinked = sentimentStripLinked;
|
|
4869
5402
|
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
|
|
4870
|
-
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
4871
5403
|
var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "./node_modules/@babel/runtime/helpers/slicedToArray.js"));
|
|
5404
|
+
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
4872
5405
|
var debug = _interopRequireWildcard(__webpack_require__(/*! ../debug */ "./lib/debug.js"));
|
|
4873
5406
|
var _iconBase = __webpack_require__(/*! ../iconBase */ "./lib/iconBase.js");
|
|
4874
5407
|
var ns = _interopRequireWildcard(__webpack_require__(/*! ../ns */ "./lib/ns.js"));
|
|
@@ -4896,320 +5429,503 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
4896
5429
|
// import * as pad from '../pad'
|
|
4897
5430
|
// pull in first avoid cross-refs
|
|
4898
5431
|
// import * as style from '../style'
|
|
4899
|
-
|
|
4900
5432
|
var dom = window.document;
|
|
4901
5433
|
|
|
4902
|
-
// THE UNUSED ICONS are here as reminders for possible future functionality
|
|
4903
|
-
// const BOOKMARK_ICON = 'noun_45961.svg'
|
|
4904
|
-
// const HEART_ICON = 'noun_130259.svg' -> Add this to my (private) favorites
|
|
4905
|
-
// const MENU_ICON = 'noun_897914.svg'
|
|
4906
|
-
// const PAPERCLIP_ICON = 'noun_25830.svg' -> add attachments to this message
|
|
4907
|
-
// const PIN_ICON = 'noun_562340.svg' -> pin this message permanently in the chat UI
|
|
4908
|
-
var PENCIL_ICON = 'noun_253504.svg'; // edit a message
|
|
4909
|
-
// const SPANNER_ICON = 'noun_344563.svg' -> settings
|
|
4910
|
-
var THUMBS_UP_ICON = 'noun_1384132.svg';
|
|
4911
|
-
var THUMBS_DOWN_ICON = 'noun_1384135.svg';
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
5434
|
+
// THE UNUSED ICONS are here as reminders for possible future functionality
|
|
5435
|
+
// const BOOKMARK_ICON = 'noun_45961.svg'
|
|
5436
|
+
// const HEART_ICON = 'noun_130259.svg' -> Add this to my (private) favorites
|
|
5437
|
+
// const MENU_ICON = 'noun_897914.svg'
|
|
5438
|
+
// const PAPERCLIP_ICON = 'noun_25830.svg' -> add attachments to this message
|
|
5439
|
+
// const PIN_ICON = 'noun_562340.svg' -> pin this message permanently in the chat UI
|
|
5440
|
+
var PENCIL_ICON = 'noun_253504.svg'; // edit a message
|
|
5441
|
+
// const SPANNER_ICON = 'noun_344563.svg' -> settings
|
|
5442
|
+
var THUMBS_UP_ICON = 'noun_1384132.svg';
|
|
5443
|
+
var THUMBS_DOWN_ICON = 'noun_1384135.svg';
|
|
5444
|
+
var REPLY_ICON = 'noun-reply-5506924.svg';
|
|
5445
|
+
/**
|
|
5446
|
+
* Emoji in Unicode
|
|
5447
|
+
*/
|
|
5448
|
+
var emojiMap = {};
|
|
5449
|
+
emojiMap[ns.schema('AgreeAction')] = '👍';
|
|
5450
|
+
emojiMap[ns.schema('DisagreeAction')] = '👎';
|
|
5451
|
+
emojiMap[ns.schema('EndorseAction')] = '⭐️';
|
|
5452
|
+
emojiMap[ns.schema('LikeAction')] = '❤️';
|
|
5453
|
+
function emojiFromActionClass(action) {
|
|
5454
|
+
return emojiMap[action] || null;
|
|
5455
|
+
}
|
|
5456
|
+
function ActionClassFromEmoji(emoji) {
|
|
5457
|
+
for (var a in emojiMap) {
|
|
5458
|
+
if (emojiMap[a] === emoji) {
|
|
5459
|
+
return rdf.sym(a.slice(1, -1)); // remove < >
|
|
5460
|
+
}
|
|
5461
|
+
}
|
|
5462
|
+
|
|
5463
|
+
return null;
|
|
5464
|
+
}
|
|
5465
|
+
|
|
5466
|
+
// Allow the action to give its own emoji as content,
|
|
5467
|
+
// or get the emoji from the class of action.
|
|
5468
|
+
function emojiFromAction(action) {
|
|
5469
|
+
var content = _solidLogic.store.any(action, ns.sioc('content'), null, action.doc());
|
|
5470
|
+
if (content) return content;
|
|
5471
|
+
var klass = _solidLogic.store.any(action, ns.rdf('type'), null, action.doc());
|
|
5472
|
+
if (klass) {
|
|
5473
|
+
var em = emojiFromActionClass(klass);
|
|
5474
|
+
if (em) return em;
|
|
5475
|
+
}
|
|
5476
|
+
return '⬜️';
|
|
5477
|
+
}
|
|
5478
|
+
|
|
5479
|
+
/**
|
|
5480
|
+
* Create strip of sentiments expressed
|
|
5481
|
+
*/
|
|
5482
|
+
function sentimentStrip(_x, _x2) {
|
|
5483
|
+
return _sentimentStrip.apply(this, arguments);
|
|
5484
|
+
}
|
|
5485
|
+
/**
|
|
5486
|
+
* Create strip of sentiments expressed, with hyperlinks
|
|
5487
|
+
*
|
|
5488
|
+
* @param target {NamedNode} - The thing about which they are expressed
|
|
5489
|
+
* @param doc {NamedNode} - The document in which they are expressed
|
|
5490
|
+
*/
|
|
5491
|
+
function _sentimentStrip() {
|
|
5492
|
+
_sentimentStrip = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(target, doc) {
|
|
5493
|
+
var versions, actions, strings;
|
|
5494
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
5495
|
+
while (1) switch (_context.prev = _context.next) {
|
|
5496
|
+
case 0:
|
|
5497
|
+
_context.next = 2;
|
|
5498
|
+
return (0, _chatLogic.allVersions)(target);
|
|
5499
|
+
case 2:
|
|
5500
|
+
versions = _context.sent;
|
|
5501
|
+
debug.log('sentimentStrip Versions for ' + target, versions);
|
|
5502
|
+
actions = versions.map(function (version) {
|
|
5503
|
+
return _solidLogic.store.each(null, ns.schema('target'), version, doc);
|
|
5504
|
+
}).flat();
|
|
5505
|
+
debug.log('sentimentStrip: Actions for ' + target, actions);
|
|
5506
|
+
strings = actions.map(function (action) {
|
|
5507
|
+
return emojiFromAction(action) || '';
|
|
5508
|
+
});
|
|
5509
|
+
return _context.abrupt("return", dom.createTextNode(strings.join(' ')));
|
|
5510
|
+
case 8:
|
|
5511
|
+
case "end":
|
|
5512
|
+
return _context.stop();
|
|
5513
|
+
}
|
|
5514
|
+
}, _callee);
|
|
5515
|
+
}));
|
|
5516
|
+
return _sentimentStrip.apply(this, arguments);
|
|
5517
|
+
}
|
|
5518
|
+
function sentimentStripLinked(_x3, _x4) {
|
|
5519
|
+
return _sentimentStripLinked.apply(this, arguments);
|
|
5520
|
+
}
|
|
5521
|
+
/**
|
|
5522
|
+
* Creates a message toolbar component
|
|
5523
|
+
*/
|
|
5524
|
+
function _sentimentStripLinked() {
|
|
5525
|
+
_sentimentStripLinked = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(target, doc) {
|
|
5526
|
+
var strip, refresh, _refresh;
|
|
5527
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
5528
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
5529
|
+
case 0:
|
|
5530
|
+
_refresh = function _refresh3() {
|
|
5531
|
+
_refresh = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
5532
|
+
var versions, actions, sentiments;
|
|
5533
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
5534
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
5535
|
+
case 0:
|
|
5536
|
+
strip.innerHTML = '';
|
|
5537
|
+
if (!(0, _chatLogic.isDeleted)(target)) {
|
|
5538
|
+
_context2.next = 3;
|
|
5539
|
+
break;
|
|
5540
|
+
}
|
|
5541
|
+
return _context2.abrupt("return", strip);
|
|
5542
|
+
case 3:
|
|
5543
|
+
_context2.next = 5;
|
|
5544
|
+
return (0, _chatLogic.allVersions)(target);
|
|
5545
|
+
case 5:
|
|
5546
|
+
versions = _context2.sent;
|
|
5547
|
+
debug.log('sentimentStripLinked: Versions for ' + target, versions);
|
|
5548
|
+
actions = versions.map(function (version) {
|
|
5549
|
+
return _solidLogic.store.each(null, ns.schema('target'), version, doc);
|
|
5550
|
+
}).flat();
|
|
5551
|
+
debug.log('sentimentStripLinked: Actions for ' + target, actions);
|
|
5552
|
+
if (!(actions.length === 0)) {
|
|
5553
|
+
_context2.next = 11;
|
|
5554
|
+
break;
|
|
5555
|
+
}
|
|
5556
|
+
return _context2.abrupt("return", strip);
|
|
5557
|
+
case 11:
|
|
5558
|
+
sentiments = actions.map(function (a) {
|
|
5559
|
+
return [_solidLogic.store.any(a, ns.rdf('type'), null, doc), _solidLogic.store.any(a, ns.sioc('content'), null, doc), _solidLogic.store.any(a, ns.schema('agent'), null, doc)];
|
|
5560
|
+
});
|
|
5561
|
+
debug.log(' Actions sentiments ', sentiments);
|
|
5562
|
+
sentiments.sort();
|
|
5563
|
+
sentiments.forEach(function (ss) {
|
|
5564
|
+
var _ss = (0, _slicedToArray2["default"])(ss, 3),
|
|
5565
|
+
theClass = _ss[0],
|
|
5566
|
+
content = _ss[1],
|
|
5567
|
+
agent = _ss[2];
|
|
5568
|
+
var res;
|
|
5569
|
+
if (agent) {
|
|
5570
|
+
res = dom.createElement('a');
|
|
5571
|
+
res.setAttribute('href', agent.uri);
|
|
5572
|
+
} else {
|
|
5573
|
+
res = dom.createTextNode('');
|
|
5574
|
+
}
|
|
5575
|
+
res.textContent = content || emojiMap[theClass] || '⬜️';
|
|
5576
|
+
strip.appendChild(res);
|
|
5577
|
+
});
|
|
5578
|
+
debug.log(' Actions strip ', strip);
|
|
5579
|
+
case 16:
|
|
5580
|
+
case "end":
|
|
5581
|
+
return _context2.stop();
|
|
5582
|
+
}
|
|
5583
|
+
}, _callee2);
|
|
5584
|
+
}));
|
|
5585
|
+
return _refresh.apply(this, arguments);
|
|
5586
|
+
};
|
|
5587
|
+
refresh = function _refresh2() {
|
|
5588
|
+
return _refresh.apply(this, arguments);
|
|
5589
|
+
};
|
|
5590
|
+
strip = dom.createElement('span');
|
|
5591
|
+
refresh().then(debug.log('sentimentStripLinked: sentimentStripLinked async refreshed'));
|
|
5592
|
+
strip.refresh = refresh;
|
|
5593
|
+
return _context3.abrupt("return", strip);
|
|
5594
|
+
case 6:
|
|
5595
|
+
case "end":
|
|
5596
|
+
return _context3.stop();
|
|
5597
|
+
}
|
|
5598
|
+
}, _callee3);
|
|
5599
|
+
}));
|
|
5600
|
+
return _sentimentStripLinked.apply(this, arguments);
|
|
5601
|
+
}
|
|
5602
|
+
function messageToolbar(_x5, _x6, _x7, _x8) {
|
|
5603
|
+
return _messageToolbar.apply(this, arguments);
|
|
5604
|
+
}
|
|
5605
|
+
function _messageToolbar() {
|
|
5606
|
+
_messageToolbar = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(message, messageRow, userContext, channelObject) {
|
|
5607
|
+
var deleteMessage, _deleteMessage, editMessage, _editMessage, replyInThread, _replyInThread, div, closeToolbar, deleteThingThen, _deleteThingThen, me, sentimentButton, context1, cancelButton;
|
|
5608
|
+
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
|
5609
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
5610
|
+
case 0:
|
|
5611
|
+
sentimentButton = function _sentimentButton(context, target, icon, actionClass, doc, mutuallyExclusive) {
|
|
5612
|
+
function setColor() {
|
|
5613
|
+
button.style.backgroundColor = action ? 'yellow' : 'white';
|
|
5614
|
+
}
|
|
5615
|
+
var button = widgets.button(dom, icon, utils.label(actionClass), /*#__PURE__*/function () {
|
|
5616
|
+
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(_event) {
|
|
5617
|
+
var insertMe, dirty, i, a;
|
|
5618
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
5619
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
5620
|
+
case 0:
|
|
5621
|
+
if (!action) {
|
|
5622
|
+
_context4.next = 7;
|
|
5623
|
+
break;
|
|
5624
|
+
}
|
|
5625
|
+
_context4.next = 3;
|
|
5626
|
+
return deleteThingThen(action);
|
|
5627
|
+
case 3:
|
|
5628
|
+
action = null;
|
|
5629
|
+
setColor();
|
|
5630
|
+
_context4.next = 25;
|
|
5631
|
+
break;
|
|
5632
|
+
case 7:
|
|
5633
|
+
// no action
|
|
5634
|
+
action = widgets.newThing(doc);
|
|
5635
|
+
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)];
|
|
5636
|
+
_context4.next = 11;
|
|
5637
|
+
return _solidLogic.store.updater.update([], insertMe);
|
|
5638
|
+
case 11:
|
|
5639
|
+
setColor();
|
|
5640
|
+
if (!mutuallyExclusive) {
|
|
5641
|
+
_context4.next = 25;
|
|
5642
|
+
break;
|
|
5643
|
+
}
|
|
5644
|
+
// Delete incompative sentiments
|
|
5645
|
+
dirty = false;
|
|
5646
|
+
i = 0;
|
|
5647
|
+
case 15:
|
|
5648
|
+
if (!(i < mutuallyExclusive.length)) {
|
|
5649
|
+
_context4.next = 24;
|
|
5650
|
+
break;
|
|
5651
|
+
}
|
|
5652
|
+
a = existingAction(mutuallyExclusive[i]);
|
|
5653
|
+
if (!a) {
|
|
5654
|
+
_context4.next = 21;
|
|
5655
|
+
break;
|
|
5656
|
+
}
|
|
5657
|
+
_context4.next = 20;
|
|
5658
|
+
return deleteThingThen(a);
|
|
5659
|
+
case 20:
|
|
5660
|
+
// but how refresh? refreshTree the parent?
|
|
5661
|
+
dirty = true;
|
|
5662
|
+
case 21:
|
|
5663
|
+
i++;
|
|
5664
|
+
_context4.next = 15;
|
|
5665
|
+
break;
|
|
5666
|
+
case 24:
|
|
5667
|
+
if (dirty) {
|
|
5668
|
+
// widgets.refreshTree(button.parentNode) // requires them all to be immediate siblings
|
|
5669
|
+
widgets.refreshTree(messageRow); // requires them all to be immediate siblings
|
|
5670
|
+
}
|
|
5671
|
+
case 25:
|
|
5672
|
+
case "end":
|
|
5673
|
+
return _context4.stop();
|
|
5674
|
+
}
|
|
5675
|
+
}, _callee4);
|
|
5676
|
+
}));
|
|
5677
|
+
return function (_x11) {
|
|
5678
|
+
return _ref.apply(this, arguments);
|
|
5679
|
+
};
|
|
5680
|
+
}());
|
|
5681
|
+
function existingAction(actionClass) {
|
|
5682
|
+
var actions = _solidLogic.store.each(null, ns.schema('agent'), context.me, doc).filter(function (x) {
|
|
5683
|
+
return _solidLogic.store.holds(x, ns.rdf('type'), actionClass, doc);
|
|
5684
|
+
}).filter(function (x) {
|
|
5685
|
+
return _solidLogic.store.holds(x, ns.schema('target'), target, doc);
|
|
5686
|
+
});
|
|
5687
|
+
return actions.length ? actions[0] : null;
|
|
5688
|
+
}
|
|
5689
|
+
function refresh() {
|
|
5690
|
+
action = existingAction(actionClass);
|
|
5691
|
+
setColor();
|
|
5692
|
+
}
|
|
5693
|
+
var action;
|
|
5694
|
+
button.refresh = refresh; // If the file changes, refresh live
|
|
5695
|
+
refresh();
|
|
5696
|
+
return button;
|
|
5697
|
+
};
|
|
5698
|
+
_deleteThingThen = function _deleteThingThen3() {
|
|
5699
|
+
_deleteThingThen = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(x) {
|
|
5700
|
+
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
|
5701
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
5702
|
+
case 0:
|
|
5703
|
+
_context9.next = 2;
|
|
5704
|
+
return _solidLogic.store.updater.update(_solidLogic.store.connectedStatements(x), []);
|
|
5705
|
+
case 2:
|
|
5706
|
+
case "end":
|
|
5707
|
+
return _context9.stop();
|
|
5708
|
+
}
|
|
5709
|
+
}, _callee9);
|
|
5710
|
+
}));
|
|
5711
|
+
return _deleteThingThen.apply(this, arguments);
|
|
5712
|
+
};
|
|
5713
|
+
deleteThingThen = function _deleteThingThen2(_x10) {
|
|
5714
|
+
return _deleteThingThen.apply(this, arguments);
|
|
5715
|
+
};
|
|
5716
|
+
closeToolbar = function _closeToolbar() {
|
|
5717
|
+
div.parentElement.parentElement.removeChild(div.parentElement); // remive the TR
|
|
5718
|
+
};
|
|
5719
|
+
_replyInThread = function _replyInThread3() {
|
|
5720
|
+
_replyInThread = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
|
|
5721
|
+
var thread, options;
|
|
5722
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
5723
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
5724
|
+
case 0:
|
|
5725
|
+
_context8.next = 2;
|
|
5726
|
+
return channelObject.createThread(message);
|
|
5727
|
+
case 2:
|
|
5728
|
+
thread = _context8.sent;
|
|
5729
|
+
options = userContext.chatOptions;
|
|
5730
|
+
if (options) {
|
|
5731
|
+
_context8.next = 6;
|
|
5732
|
+
break;
|
|
5733
|
+
}
|
|
5734
|
+
throw new Error('replyInThread: missing options');
|
|
5735
|
+
case 6:
|
|
5736
|
+
options.showThread(thread, options);
|
|
5737
|
+
closeToolbar(); // a one-off action
|
|
5738
|
+
case 8:
|
|
5739
|
+
case "end":
|
|
5740
|
+
return _context8.stop();
|
|
5741
|
+
}
|
|
5742
|
+
}, _callee8);
|
|
5743
|
+
}));
|
|
5744
|
+
return _replyInThread.apply(this, arguments);
|
|
5745
|
+
};
|
|
5746
|
+
replyInThread = function _replyInThread2() {
|
|
5747
|
+
return _replyInThread.apply(this, arguments);
|
|
5748
|
+
};
|
|
5749
|
+
_editMessage = function _editMessage3() {
|
|
5750
|
+
_editMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(messageRow) {
|
|
5751
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
5752
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
5753
|
+
case 0:
|
|
5754
|
+
if (!(me.value === _solidLogic.store.any(message, ns.foaf('maker')).value)) {
|
|
5755
|
+
_context7.next = 4;
|
|
5756
|
+
break;
|
|
5757
|
+
}
|
|
5758
|
+
closeToolbar(); // edit is a one-off action
|
|
5759
|
+
_context7.next = 4;
|
|
5760
|
+
return (0, _message.switchToEditor)(messageRow, message, channelObject, userContext);
|
|
5761
|
+
case 4:
|
|
5762
|
+
case "end":
|
|
5763
|
+
return _context7.stop();
|
|
5764
|
+
}
|
|
5765
|
+
}, _callee7);
|
|
5766
|
+
}));
|
|
5767
|
+
return _editMessage.apply(this, arguments);
|
|
5768
|
+
};
|
|
5769
|
+
editMessage = function _editMessage2(_x9) {
|
|
5770
|
+
return _editMessage.apply(this, arguments);
|
|
5771
|
+
};
|
|
5772
|
+
_deleteMessage = function _deleteMessage3() {
|
|
5773
|
+
_deleteMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
|
|
5774
|
+
var author, msg, area;
|
|
5775
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
5776
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
5777
|
+
case 0:
|
|
5778
|
+
author = _solidLogic.store.any(message, ns.foaf('maker'));
|
|
5779
|
+
if (me) {
|
|
5780
|
+
_context6.next = 5;
|
|
5781
|
+
break;
|
|
5782
|
+
}
|
|
5783
|
+
alert('You can\'t delete the message, you are not logged in.');
|
|
5784
|
+
_context6.next = 22;
|
|
5785
|
+
break;
|
|
5786
|
+
case 5:
|
|
5787
|
+
if (!me.sameTerm(author)) {
|
|
5788
|
+
_context6.next = 21;
|
|
5789
|
+
break;
|
|
5790
|
+
}
|
|
5791
|
+
_context6.prev = 6;
|
|
5792
|
+
_context6.next = 9;
|
|
5793
|
+
return channelObject.deleteMessage(message);
|
|
5794
|
+
case 9:
|
|
5795
|
+
_context6.next = 18;
|
|
5796
|
+
break;
|
|
5797
|
+
case 11:
|
|
5798
|
+
_context6.prev = 11;
|
|
5799
|
+
_context6.t0 = _context6["catch"](6);
|
|
5800
|
+
msg = 'Error deleting messaage ' + _context6.t0;
|
|
5801
|
+
debug.warn(msg);
|
|
5802
|
+
alert(msg);
|
|
5803
|
+
area = userContext.statusArea || messageRow.parentNode;
|
|
5804
|
+
area.appendChild(widgets.errorMessageBlock(dom, msg));
|
|
5805
|
+
case 18:
|
|
5806
|
+
messageRow.parentNode.removeChild(messageRow);
|
|
5807
|
+
_context6.next = 22;
|
|
5808
|
+
break;
|
|
5809
|
+
case 21:
|
|
5810
|
+
alert('You can\'t delete the message, you are not logged in as the author, ' + author);
|
|
5811
|
+
case 22:
|
|
5812
|
+
closeToolbar();
|
|
5813
|
+
case 23:
|
|
5814
|
+
case "end":
|
|
5815
|
+
return _context6.stop();
|
|
5816
|
+
}
|
|
5817
|
+
}, _callee6, null, [[6, 11]]);
|
|
5818
|
+
}));
|
|
5819
|
+
return _deleteMessage.apply(this, arguments);
|
|
5820
|
+
};
|
|
5821
|
+
deleteMessage = function _deleteMessage2() {
|
|
5822
|
+
return _deleteMessage.apply(this, arguments);
|
|
5823
|
+
}; // alain: TODO allow chat owner to fully delete message + sentiments and replacing messages
|
|
5824
|
+
div = dom.createElement('div'); // is message deleted ?
|
|
5825
|
+
_context10.next = 13;
|
|
5826
|
+
return (0, _chatLogic.mostRecentVersion)(message).value;
|
|
5827
|
+
case 13:
|
|
5828
|
+
_context10.t0 = _context10.sent;
|
|
5829
|
+
_context10.t1 = ns.schema('dateDeleted').value;
|
|
5830
|
+
if (!(_context10.t0 === _context10.t1)) {
|
|
5831
|
+
_context10.next = 17;
|
|
5832
|
+
break;
|
|
5833
|
+
}
|
|
5834
|
+
return _context10.abrupt("return", div);
|
|
5835
|
+
case 17:
|
|
5836
|
+
// Things only the original author can do
|
|
5837
|
+
me = _solidLogic.authn.currentUser(); // If already logged on
|
|
5838
|
+
if (me && _solidLogic.store.holds(message, ns.foaf('maker'), me)) {
|
|
5839
|
+
// button to delete the message
|
|
5840
|
+
div.appendChild(widgets.deleteButtonWithCheck(dom, div, 'message', deleteMessage));
|
|
5841
|
+
// button to edit the message
|
|
5842
|
+
div.appendChild(widgets.button(dom, _iconBase.icons.iconBase + PENCIL_ICON, 'edit', function () {
|
|
5843
|
+
return editMessage(messageRow);
|
|
5844
|
+
}));
|
|
5845
|
+
} // if mine
|
|
5846
|
+
// Things anyone can do if they have a bookmark list async
|
|
5847
|
+
/*
|
|
5848
|
+
var bookmarkButton = await bookmarks.renderBookmarksButton(userContext)
|
|
5849
|
+
if (bookmarkButton) {
|
|
5850
|
+
div.appendChild(bookmarkButton)
|
|
5851
|
+
}
|
|
5852
|
+
*/
|
|
5853
|
+
// Things anyone can do if they have a bookmark list
|
|
5854
|
+
|
|
5855
|
+
(0, _bookmarks.renderBookmarksButton)(userContext).then(function (bookmarkButton) {
|
|
5856
|
+
if (bookmarkButton) div.appendChild(bookmarkButton);
|
|
5857
|
+
});
|
|
4920
5858
|
|
|
4921
|
-
/**
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
/**
|
|
4938
|
-
* Create strip of sentiments expressed, with hyperlinks
|
|
4939
|
-
*
|
|
4940
|
-
* @param target {NamedNode} - The thing about which they are expressed
|
|
4941
|
-
* @param doc {NamedNode} - The document in which they are expressed
|
|
4942
|
-
*/
|
|
4943
|
-
function sentimentStripLinked(target, doc) {
|
|
4944
|
-
var strip = dom.createElement('span');
|
|
4945
|
-
function refresh() {
|
|
4946
|
-
strip.innerHTML = '';
|
|
4947
|
-
var actions = (0, _chatLogic.mostRecentVersion)(target).uri !== ns.schema('dateDeleted').uri ? _solidLogic.store.each(null, ns.schema('target'), target, doc) : [];
|
|
4948
|
-
var sentiments = actions.map(function (a) {
|
|
4949
|
-
return [_solidLogic.store.any(a, ns.rdf('type'), null, doc), _solidLogic.store.any(a, ns.schema('agent'), null, doc)];
|
|
4950
|
-
});
|
|
4951
|
-
sentiments.sort();
|
|
4952
|
-
sentiments.forEach(function (ss) {
|
|
4953
|
-
var _ss = (0, _slicedToArray2["default"])(ss, 2),
|
|
4954
|
-
theClass = _ss[0],
|
|
4955
|
-
agent = _ss[1];
|
|
4956
|
-
var res;
|
|
4957
|
-
if (agent) {
|
|
4958
|
-
res = dom.createElement('a');
|
|
4959
|
-
res.setAttribute('href', agent.uri);
|
|
4960
|
-
} else {
|
|
4961
|
-
res = dom.createTextNode('');
|
|
4962
|
-
}
|
|
4963
|
-
res.textContent = emoji[theClass] || '*';
|
|
4964
|
-
strip.appendChild(res);
|
|
4965
|
-
});
|
|
4966
|
-
}
|
|
4967
|
-
refresh();
|
|
4968
|
-
strip.refresh = refresh;
|
|
4969
|
-
return strip;
|
|
4970
|
-
}
|
|
4971
|
-
/**
|
|
4972
|
-
* Creates a message toolbar component
|
|
4973
|
-
*/
|
|
4974
|
-
function messageToolbar(message, messageRow, userContext, channelObject) {
|
|
4975
|
-
function deleteMessage() {
|
|
4976
|
-
return _deleteMessage.apply(this, arguments);
|
|
4977
|
-
}
|
|
4978
|
-
function _deleteMessage() {
|
|
4979
|
-
_deleteMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
4980
|
-
var author, msg, area;
|
|
4981
|
-
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
4982
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
4983
|
-
case 0:
|
|
4984
|
-
author = _solidLogic.store.any(message, ns.foaf('maker'));
|
|
4985
|
-
if (me) {
|
|
4986
|
-
_context2.next = 5;
|
|
4987
|
-
break;
|
|
4988
|
-
}
|
|
4989
|
-
alert('You can\'t delete the message, you are not logged in.');
|
|
4990
|
-
_context2.next = 22;
|
|
4991
|
-
break;
|
|
4992
|
-
case 5:
|
|
4993
|
-
if (!me.sameTerm(author)) {
|
|
4994
|
-
_context2.next = 21;
|
|
4995
|
-
break;
|
|
4996
|
-
}
|
|
4997
|
-
_context2.prev = 6;
|
|
4998
|
-
_context2.next = 9;
|
|
4999
|
-
return channelObject.deleteMessage(message);
|
|
5000
|
-
case 9:
|
|
5001
|
-
_context2.next = 18;
|
|
5859
|
+
/** Button to allow user to express a sentiment (like, endorse, etc) about a target
|
|
5860
|
+
*
|
|
5861
|
+
* @param context {Object} - Provide dom and me
|
|
5862
|
+
* @param target {NamedNode} - The thing the user expresses an opnion about
|
|
5863
|
+
* @param icon {uristring} - The icon to be used for the button
|
|
5864
|
+
* @param actionClass {NamedNode} - The RDF class - typically a subclass of schema:Action
|
|
5865
|
+
* @param doc - {NamedNode} - the Solid document iunto which the data should be written
|
|
5866
|
+
* @param mutuallyExclusive {Array<NamedNode>} - Any RDF classes of sentimentswhich are mutiually exclusive
|
|
5867
|
+
*/
|
|
5868
|
+
|
|
5869
|
+
// THUMBS_UP_ICON
|
|
5870
|
+
// https://schema.org/AgreeAction
|
|
5871
|
+
me = _solidLogic.authn.currentUser(); // If already logged on
|
|
5872
|
+
_context10.t2 = me;
|
|
5873
|
+
if (!_context10.t2) {
|
|
5874
|
+
_context10.next = 28;
|
|
5002
5875
|
break;
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
_context2.next = 22;
|
|
5876
|
+
}
|
|
5877
|
+
_context10.next = 25;
|
|
5878
|
+
return (0, _chatLogic.mostRecentVersion)(message).value;
|
|
5879
|
+
case 25:
|
|
5880
|
+
_context10.t3 = _context10.sent;
|
|
5881
|
+
_context10.t4 = ns.schema('dateDeleted').value;
|
|
5882
|
+
_context10.t2 = _context10.t3 !== _context10.t4;
|
|
5883
|
+
case 28:
|
|
5884
|
+
if (!_context10.t2) {
|
|
5885
|
+
_context10.next = 32;
|
|
5014
5886
|
break;
|
|
5015
|
-
case 21:
|
|
5016
|
-
alert('You can\'t delete the message, you are not logged in as the author, ' + author);
|
|
5017
|
-
case 22:
|
|
5018
|
-
closeToolbar();
|
|
5019
|
-
case 23:
|
|
5020
|
-
case "end":
|
|
5021
|
-
return _context2.stop();
|
|
5022
|
-
}
|
|
5023
|
-
}, _callee2, null, [[6, 11]]);
|
|
5024
|
-
}));
|
|
5025
|
-
return _deleteMessage.apply(this, arguments);
|
|
5026
|
-
}
|
|
5027
|
-
function editMessage(_x) {
|
|
5028
|
-
return _editMessage.apply(this, arguments);
|
|
5029
|
-
} // alain TODO allow chat owner to fully delete message + sentiments and replacing messages
|
|
5030
|
-
function _editMessage() {
|
|
5031
|
-
_editMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(messageRow) {
|
|
5032
|
-
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
5033
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
5034
|
-
case 0:
|
|
5035
|
-
if (me.value === _solidLogic.store.any(message, ns.foaf('maker')).value) {
|
|
5036
|
-
closeToolbar(); // edit is a one-off action
|
|
5037
|
-
(0, _message.switchToEditor)(messageRow, message, channelObject, userContext);
|
|
5038
|
-
}
|
|
5039
|
-
case 1:
|
|
5040
|
-
case "end":
|
|
5041
|
-
return _context3.stop();
|
|
5042
|
-
}
|
|
5043
|
-
}, _callee3);
|
|
5044
|
-
}));
|
|
5045
|
-
return _editMessage.apply(this, arguments);
|
|
5046
|
-
}
|
|
5047
|
-
var div = dom.createElement('div');
|
|
5048
|
-
// is message deleted ?
|
|
5049
|
-
if ((0, _chatLogic.mostRecentVersion)(message).value === ns.schema('dateDeleted').value) return div;
|
|
5050
|
-
function closeToolbar() {
|
|
5051
|
-
div.parentElement.parentElement.removeChild(div.parentElement); // remive the TR
|
|
5052
|
-
}
|
|
5053
|
-
function deleteThingThen(_x2) {
|
|
5054
|
-
return _deleteThingThen.apply(this, arguments);
|
|
5055
|
-
} // Things only the original author can do
|
|
5056
|
-
function _deleteThingThen() {
|
|
5057
|
-
_deleteThingThen = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(x) {
|
|
5058
|
-
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
5059
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
5060
|
-
case 0:
|
|
5061
|
-
_context4.next = 2;
|
|
5062
|
-
return _solidLogic.store.updater.update(_solidLogic.store.connectedStatements(x), []);
|
|
5063
|
-
case 2:
|
|
5064
|
-
case "end":
|
|
5065
|
-
return _context4.stop();
|
|
5066
|
-
}
|
|
5067
|
-
}, _callee4);
|
|
5068
|
-
}));
|
|
5069
|
-
return _deleteThingThen.apply(this, arguments);
|
|
5070
|
-
}
|
|
5071
|
-
var me = _solidLogic.authn.currentUser(); // If already logged on
|
|
5072
|
-
if (me && _solidLogic.store.holds(message, ns.foaf('maker'), me)) {
|
|
5073
|
-
// button to delete the message
|
|
5074
|
-
div.appendChild(widgets.deleteButtonWithCheck(dom, div, 'message', deleteMessage));
|
|
5075
|
-
// button to edit the message
|
|
5076
|
-
div.appendChild(widgets.button(dom, _iconBase.icons.iconBase + PENCIL_ICON, 'edit', function () {
|
|
5077
|
-
return editMessage(messageRow);
|
|
5078
|
-
}));
|
|
5079
|
-
} // if mine
|
|
5080
|
-
// Things anyone can do if they have a bookmark list async
|
|
5081
|
-
/*
|
|
5082
|
-
var bookmarkButton = await bookmarks.renderBookmarksButton(userContext)
|
|
5083
|
-
if (bookmarkButton) {
|
|
5084
|
-
div.appendChild(bookmarkButton)
|
|
5085
|
-
}
|
|
5086
|
-
*/
|
|
5087
|
-
// Things anyone can do if they have a bookmark list
|
|
5088
|
-
|
|
5089
|
-
(0, _bookmarks.renderBookmarksButton)(userContext).then(function (bookmarkButton) {
|
|
5090
|
-
if (bookmarkButton) div.appendChild(bookmarkButton);
|
|
5091
|
-
});
|
|
5092
|
-
|
|
5093
|
-
/** Button to allow user to express a sentiment (like, endorse, etc) about a target
|
|
5094
|
-
*
|
|
5095
|
-
* @param context {Object} - Provide dom and me
|
|
5096
|
-
* @param target {NamedNode} - The thing the user expresses an opnion about
|
|
5097
|
-
* @param icon {uristring} - The icon to be used for the button
|
|
5098
|
-
* @param actionClass {NamedNode} - The RDF class - typically a subclass of schema:Action
|
|
5099
|
-
* @param doc - {NamedNode} - the Solid document iunto which the data should be written
|
|
5100
|
-
* @param mutuallyExclusive {Array<NamedNode>} - Any RDF classes of sentimentswhich are mutiually exclusive
|
|
5101
|
-
*/
|
|
5102
|
-
function sentimentButton(context, target, icon, actionClass, doc, mutuallyExclusive) {
|
|
5103
|
-
function setColor() {
|
|
5104
|
-
button.style.backgroundColor = action ? 'yellow' : 'white';
|
|
5105
|
-
}
|
|
5106
|
-
var button = widgets.button(dom, icon, utils.label(actionClass), /*#__PURE__*/function () {
|
|
5107
|
-
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(_event) {
|
|
5108
|
-
var insertMe, dirty, i, a;
|
|
5109
|
-
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
5110
|
-
while (1) switch (_context.prev = _context.next) {
|
|
5111
|
-
case 0:
|
|
5112
|
-
if (!action) {
|
|
5113
|
-
_context.next = 7;
|
|
5114
|
-
break;
|
|
5115
|
-
}
|
|
5116
|
-
_context.next = 3;
|
|
5117
|
-
return deleteThingThen(action);
|
|
5118
|
-
case 3:
|
|
5119
|
-
action = null;
|
|
5120
|
-
setColor();
|
|
5121
|
-
_context.next = 25;
|
|
5122
|
-
break;
|
|
5123
|
-
case 7:
|
|
5124
|
-
// no action
|
|
5125
|
-
action = widgets.newThing(doc);
|
|
5126
|
-
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)];
|
|
5127
|
-
_context.next = 11;
|
|
5128
|
-
return _solidLogic.store.updater.update([], insertMe);
|
|
5129
|
-
case 11:
|
|
5130
|
-
setColor();
|
|
5131
|
-
if (!mutuallyExclusive) {
|
|
5132
|
-
_context.next = 25;
|
|
5133
|
-
break;
|
|
5134
|
-
}
|
|
5135
|
-
// Delete incompative sentiments
|
|
5136
|
-
dirty = false;
|
|
5137
|
-
i = 0;
|
|
5138
|
-
case 15:
|
|
5139
|
-
if (!(i < mutuallyExclusive.length)) {
|
|
5140
|
-
_context.next = 24;
|
|
5141
|
-
break;
|
|
5142
|
-
}
|
|
5143
|
-
a = existingAction(mutuallyExclusive[i]);
|
|
5144
|
-
if (!a) {
|
|
5145
|
-
_context.next = 21;
|
|
5146
|
-
break;
|
|
5147
|
-
}
|
|
5148
|
-
_context.next = 20;
|
|
5149
|
-
return deleteThingThen(a);
|
|
5150
|
-
case 20:
|
|
5151
|
-
// but how refresh? refreshTree the parent?
|
|
5152
|
-
dirty = true;
|
|
5153
|
-
case 21:
|
|
5154
|
-
i++;
|
|
5155
|
-
_context.next = 15;
|
|
5156
|
-
break;
|
|
5157
|
-
case 24:
|
|
5158
|
-
if (dirty) {
|
|
5159
|
-
// widgets.refreshTree(button.parentNode) // requires them all to be immediate siblings
|
|
5160
|
-
widgets.refreshTree(messageRow); // requires them all to be immediate siblings
|
|
5161
|
-
}
|
|
5162
|
-
case 25:
|
|
5163
|
-
case "end":
|
|
5164
|
-
return _context.stop();
|
|
5165
5887
|
}
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
return actions.length ? actions[0] : null;
|
|
5179
|
-
}
|
|
5180
|
-
function refresh() {
|
|
5181
|
-
action = existingAction(actionClass);
|
|
5182
|
-
setColor();
|
|
5183
|
-
}
|
|
5184
|
-
var action;
|
|
5185
|
-
button.refresh = refresh; // If the file changes, refresh live
|
|
5186
|
-
refresh();
|
|
5187
|
-
return button;
|
|
5188
|
-
}
|
|
5189
|
-
|
|
5190
|
-
// THUMBS_UP_ICON
|
|
5191
|
-
// https://schema.org/AgreeAction
|
|
5192
|
-
me = _solidLogic.authn.currentUser(); // If already logged on
|
|
5193
|
-
// debug.log('Actions 3' + mostRecentVersion(message).value + ' ' + ns.schema('dateDeleted').value + ' ' + (mostRecentVersion(message).value !== ns.schema('dateDeleted').value))
|
|
5888
|
+
context1 = {
|
|
5889
|
+
me: me,
|
|
5890
|
+
dom: dom,
|
|
5891
|
+
div: div
|
|
5892
|
+
};
|
|
5893
|
+
div.appendChild(sentimentButton(context1, message,
|
|
5894
|
+
// @@ TODO use widgets.sentimentButton
|
|
5895
|
+
_iconBase.icons.iconBase + THUMBS_UP_ICON, ns.schema('AgreeAction'), message.doc(), [ns.schema('DisagreeAction')]));
|
|
5896
|
+
// Thumbs down
|
|
5897
|
+
div.appendChild(sentimentButton(context1, message, _iconBase.icons.iconBase + THUMBS_DOWN_ICON, ns.schema('DisagreeAction'), message.doc(), [ns.schema('AgreeAction')]));
|
|
5898
|
+
case 32:
|
|
5899
|
+
// Reply buttton
|
|
5194
5900
|
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5901
|
+
if (_solidLogic.store.any(message, ns.dct('created'))) {
|
|
5902
|
+
// Looks like a messsage? Bar can be used for other things
|
|
5903
|
+
div.appendChild(widgets.button(dom, _iconBase.icons.iconBase + REPLY_ICON, 'Reply in thread', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
|
|
5904
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
5905
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
5906
|
+
case 0:
|
|
5907
|
+
_context5.next = 2;
|
|
5908
|
+
return replyInThread();
|
|
5909
|
+
case 2:
|
|
5910
|
+
case "end":
|
|
5911
|
+
return _context5.stop();
|
|
5912
|
+
}
|
|
5913
|
+
}, _callee5);
|
|
5914
|
+
}))));
|
|
5915
|
+
}
|
|
5916
|
+
// X button to remove the tool UI itself
|
|
5917
|
+
cancelButton = div.appendChild(widgets.cancelButton(dom));
|
|
5918
|
+
cancelButton.style["float"] = 'right';
|
|
5919
|
+
cancelButton.firstChild.style.opacity = '0.3';
|
|
5920
|
+
cancelButton.addEventListener('click', closeToolbar);
|
|
5921
|
+
return _context10.abrupt("return", div);
|
|
5922
|
+
case 38:
|
|
5923
|
+
case "end":
|
|
5924
|
+
return _context10.stop();
|
|
5925
|
+
}
|
|
5926
|
+
}, _callee10);
|
|
5927
|
+
}));
|
|
5928
|
+
return _messageToolbar.apply(this, arguments);
|
|
5213
5929
|
}
|
|
5214
5930
|
//# sourceMappingURL=messageTools.js.map
|
|
5215
5931
|
|
|
@@ -5872,6 +6588,11 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
5872
6588
|
*/
|
|
5873
6589
|
var DEFAULT_HELP_MENU_ICON = _index.icons.iconBase + 'noun_help.svg';
|
|
5874
6590
|
var DEFAUL_SOLID_ICON_URL = 'https://solidproject.org/assets/img/solid-emblem.svg';
|
|
6591
|
+
|
|
6592
|
+
/*
|
|
6593
|
+
HeaderOptions allow for customizing the logo and menu list. If a logo is not provided the default
|
|
6594
|
+
is solid. Menulist will always show a link to logout and to the users profile.
|
|
6595
|
+
*/
|
|
5875
6596
|
/**
|
|
5876
6597
|
* Initialize header component, the header object returned depends on whether the user is authenticated.
|
|
5877
6598
|
* @param store the data store
|
|
@@ -6545,10 +7266,7 @@ var TDEBUG = 32;
|
|
|
6545
7266
|
var TALL = 63;
|
|
6546
7267
|
|
|
6547
7268
|
/** @internal */
|
|
6548
|
-
var LogLevel
|
|
6549
|
-
/** @internal */
|
|
6550
|
-
exports.LogLevel = LogLevel;
|
|
6551
|
-
(function (LogLevel) {
|
|
7269
|
+
var LogLevel = /*#__PURE__*/function (LogLevel) {
|
|
6552
7270
|
LogLevel[LogLevel["Error"] = 1] = "Error";
|
|
6553
7271
|
LogLevel[LogLevel["Warning"] = 2] = "Warning";
|
|
6554
7272
|
LogLevel[LogLevel["Message"] = 4] = "Message";
|
|
@@ -6556,7 +7274,10 @@ exports.LogLevel = LogLevel;
|
|
|
6556
7274
|
LogLevel[LogLevel["Info"] = 16] = "Info";
|
|
6557
7275
|
LogLevel[LogLevel["Debug"] = 32] = "Debug";
|
|
6558
7276
|
LogLevel[LogLevel["All"] = 63] = "All";
|
|
6559
|
-
|
|
7277
|
+
return LogLevel;
|
|
7278
|
+
}({});
|
|
7279
|
+
/** @internal */
|
|
7280
|
+
exports.LogLevel = LogLevel;
|
|
6560
7281
|
var _level = TERROR + TWARN + TMESG;
|
|
6561
7282
|
/** @internal */
|
|
6562
7283
|
var _ascending = false;
|
|
@@ -6765,7 +7486,30 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
6765
7486
|
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; }
|
|
6766
7487
|
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(_e) { throw _e; }, 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(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
6767
7488
|
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); }
|
|
6768
|
-
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; }
|
|
7489
|
+
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; } /* eslint-disable camelcase */ /**
|
|
7490
|
+
* Signing in, signing up, profile and preferences reloading
|
|
7491
|
+
* Type index management
|
|
7492
|
+
*
|
|
7493
|
+
* Many functions in this module take a context object which
|
|
7494
|
+
* holds various RDF symbols, add to it, and return a promise of it.
|
|
7495
|
+
*
|
|
7496
|
+
* * `me` RDF symbol for the user's WebID
|
|
7497
|
+
* * `publicProfile` The user's public profile, iff loaded
|
|
7498
|
+
* * `preferencesFile` The user's personal preference file, iff loaded
|
|
7499
|
+
* * `index.public` The user's public type index file
|
|
7500
|
+
* * `index.private` The user's private type index file
|
|
7501
|
+
*
|
|
7502
|
+
* Not RDF symbols:
|
|
7503
|
+
* * `noun` A string in english for the type of thing -- like "address book"
|
|
7504
|
+
* * `instance` An array of nodes which are existing instances
|
|
7505
|
+
* * `containers` An array of nodes of containers of instances
|
|
7506
|
+
* * `div` A DOM element where UI can be displayed
|
|
7507
|
+
* * `statusArea` A DOM element (opt) progress stuff can be displayed, or error messages
|
|
7508
|
+
* *
|
|
7509
|
+
* * Vocabulary: "load" loads a file if it exists;
|
|
7510
|
+
* * 'Ensure" CREATES the file if it does not exist (if it can) and then loads it.
|
|
7511
|
+
* @packageDocumentation
|
|
7512
|
+
*/ // eslint-disable-next-line camelcase
|
|
6769
7513
|
var store = _solidLogic.solidLogicSingleton.store;
|
|
6770
7514
|
var _solidLogicSingleton$ = _solidLogic.solidLogicSingleton.profile,
|
|
6771
7515
|
loadPreferences = _solidLogicSingleton$.loadPreferences,
|
|
@@ -8254,21 +8998,21 @@ var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime
|
|
|
8254
8998
|
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
8255
8999
|
var debug = _interopRequireWildcard(__webpack_require__(/*! ../debug */ "./lib/debug.js"));
|
|
8256
9000
|
var _iconBase = __webpack_require__(/*! ../iconBase */ "./lib/iconBase.js");
|
|
8257
|
-
var style = _interopRequireWildcard(__webpack_require__(/*! ../style */ "./lib/style.js"));
|
|
8258
9001
|
var widgets = _interopRequireWildcard(__webpack_require__(/*! ../widgets */ "./lib/widgets/index.js"));
|
|
8259
9002
|
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); }
|
|
8260
9003
|
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; }
|
|
9004
|
+
/// /////////////////////////////////////////////
|
|
8261
9005
|
//
|
|
8262
9006
|
// Media input widget
|
|
8263
9007
|
//
|
|
8264
9008
|
//
|
|
8265
9009
|
// Workflow:
|
|
8266
|
-
// The HTML5 functionality (on
|
|
8267
|
-
// a realtime camera capture, OR a selection from images already
|
|
9010
|
+
// The HTML5 functionality (on mobille) is to prompt for either
|
|
9011
|
+
// a realtime camera capture , OR a selection from images already ont the device
|
|
8268
9012
|
// (eg camera roll).
|
|
8269
9013
|
//
|
|
8270
|
-
// The solid alternative is to either take a
|
|
8271
|
-
// or access
|
|
9014
|
+
// The solid alternative is to either take a phtoto
|
|
9015
|
+
// or access cemra roll (etc) OR to access solid cloud storage of favorite photo almbums.
|
|
8272
9016
|
// (Especially latest taken ones)
|
|
8273
9017
|
//
|
|
8274
9018
|
|
|
@@ -8277,6 +9021,10 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
8277
9021
|
var cameraIcon = _iconBase.icons.iconBase + 'noun_Camera_1618446_000000.svg'; // Get it from github
|
|
8278
9022
|
var retakeIcon = _iconBase.icons.iconBase + 'noun_479395.svg'; // Get it from github
|
|
8279
9023
|
|
|
9024
|
+
var canvasWidth = '640';
|
|
9025
|
+
var canvasHeight = '480';
|
|
9026
|
+
var controlStyle = "border-radius: 0.5em; margin: 0.8em; width: ".concat(canvasWidth, "; height:").concat(canvasHeight, ";");
|
|
9027
|
+
// const controlStyle = 'border-radius: 0.5em; margin: 0.8em; width: 320; height:240;'
|
|
8280
9028
|
var contentType = 'image/png';
|
|
8281
9029
|
|
|
8282
9030
|
/** A control to capture a picture using camera
|
|
@@ -8321,7 +9069,7 @@ function cameraCaptureControl(dom, store, getImageDoc, doneCallback) {
|
|
|
8321
9069
|
player = main.appendChild(dom.createElement('video'));
|
|
8322
9070
|
player.setAttribute('controls', '1');
|
|
8323
9071
|
player.setAttribute('autoplay', '1');
|
|
8324
|
-
player.setAttribute('style',
|
|
9072
|
+
player.setAttribute('style', controlStyle);
|
|
8325
9073
|
if (!navigator.mediaDevices) {
|
|
8326
9074
|
throw new Error('navigator.mediaDevices not available');
|
|
8327
9075
|
}
|
|
@@ -8343,9 +9091,9 @@ function cameraCaptureControl(dom, store, getImageDoc, doneCallback) {
|
|
|
8343
9091
|
function grabCanvas() {
|
|
8344
9092
|
// Draw the video frame to the canvas.
|
|
8345
9093
|
canvas = dom.createElement('canvas');
|
|
8346
|
-
canvas.setAttribute('width',
|
|
8347
|
-
canvas.setAttribute('height',
|
|
8348
|
-
canvas.setAttribute('style',
|
|
9094
|
+
canvas.setAttribute('width', canvasWidth);
|
|
9095
|
+
canvas.setAttribute('height', canvasHeight);
|
|
9096
|
+
canvas.setAttribute('style', controlStyle);
|
|
8349
9097
|
main.appendChild(canvas);
|
|
8350
9098
|
var context = canvas.getContext('2d');
|
|
8351
9099
|
context.drawImage(player, 0, 0, canvas.width, canvas.height);
|
|
@@ -8402,9 +9150,9 @@ function cameraCaptureControl(dom, store, getImageDoc, doneCallback) {
|
|
|
8402
9150
|
* @param {IndexedForumla} store - The quadstore to store data in
|
|
8403
9151
|
* @param {fuunction} getImageDoc - returns NN of the image file to be created
|
|
8404
9152
|
* @param {function<Node>} doneCallback - called with the image taken
|
|
8405
|
-
* @returns {DomElement} - A div element with the
|
|
9153
|
+
* @returns {DomElement} - A div element with the buton in it
|
|
8406
9154
|
*
|
|
8407
|
-
* This
|
|
9155
|
+
* This expacts the buttton to a large control when it is pressed
|
|
8408
9156
|
*/
|
|
8409
9157
|
|
|
8410
9158
|
function cameraButton(dom, store, getImageDoc, doneCallback) {
|
|
@@ -8842,10 +9590,10 @@ Object.defineProperty(exports, "recordParticipation", ({
|
|
|
8842
9590
|
return _participation.recordParticipation;
|
|
8843
9591
|
}
|
|
8844
9592
|
}));
|
|
8845
|
-
Object.defineProperty(exports, "
|
|
9593
|
+
Object.defineProperty(exports, "renderPartipants", ({
|
|
8846
9594
|
enumerable: true,
|
|
8847
9595
|
get: function get() {
|
|
8848
|
-
return _participation.
|
|
9596
|
+
return _participation.renderPartipants;
|
|
8849
9597
|
}
|
|
8850
9598
|
}));
|
|
8851
9599
|
exports.xmlEncode = xmlEncode;
|
|
@@ -8863,12 +9611,14 @@ var _widgets = __webpack_require__(/*! ./widgets */ "./lib/widgets/index.js");
|
|
|
8863
9611
|
var _utils = __webpack_require__(/*! ./utils */ "./lib/utils/index.js");
|
|
8864
9612
|
var _debug = __webpack_require__(/*! ./debug */ "./lib/debug.js");
|
|
8865
9613
|
var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
|
|
8866
|
-
var style = _interopRequireWildcard(__webpack_require__(/*! ./style */ "./lib/style.js"));
|
|
8867
9614
|
var _participation = __webpack_require__(/*! ./participation */ "./lib/participation.js");
|
|
8868
9615
|
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); }
|
|
8869
9616
|
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; }
|
|
8870
9617
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
8871
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
9618
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /** **************
|
|
9619
|
+
* Notepad Widget
|
|
9620
|
+
*/ /** @module pad
|
|
9621
|
+
*/
|
|
8872
9622
|
var store = _solidLogic.solidLogicSingleton.store;
|
|
8873
9623
|
var PAD = (0, _rdflib.Namespace)('http://www.w3.org/ns/pim/pad#');
|
|
8874
9624
|
/**
|
|
@@ -8928,7 +9678,7 @@ function lightColorHash(author) {
|
|
|
8928
9678
|
/** notepad
|
|
8929
9679
|
*
|
|
8930
9680
|
* @param {HTMLDocument} dom - the web page of the browser
|
|
8931
|
-
* @param {NamedNode} padDoc - the document into which the
|
|
9681
|
+
* @param {NamedNode} padDoc - the document into which the particpation should be shown
|
|
8932
9682
|
* @param {NamedNode} subject - the thing in which participation is happening
|
|
8933
9683
|
* @param {NamedNode} me - person who is logged into the pod
|
|
8934
9684
|
* @param {notepadOptions} options - the options that can be passed in consist of statusArea, exists
|
|
@@ -8941,7 +9691,7 @@ function notepad(dom, padDoc, subject, me, options) {
|
|
|
8941
9691
|
if (me && !me.uri) throw new Error('UI.pad.notepad: Invalid userid');
|
|
8942
9692
|
var updater = store.updater;
|
|
8943
9693
|
var PAD = (0, _rdflib.Namespace)('http://www.w3.org/ns/pim/pad#');
|
|
8944
|
-
table.setAttribute('style',
|
|
9694
|
+
table.setAttribute('style', 'padding: 1em; overflow: auto; resize: horizontal; min-width: 40em;');
|
|
8945
9695
|
var upstreamStatus = null;
|
|
8946
9696
|
var downstreamStatus = null;
|
|
8947
9697
|
if (options.statusArea) {
|
|
@@ -8950,10 +9700,10 @@ function notepad(dom, padDoc, subject, me, options) {
|
|
|
8950
9700
|
upstreamStatus = tr.appendChild(dom.createElement('td'));
|
|
8951
9701
|
downstreamStatus = tr.appendChild(dom.createElement('td'));
|
|
8952
9702
|
if (upstreamStatus) {
|
|
8953
|
-
upstreamStatus.setAttribute('style',
|
|
9703
|
+
upstreamStatus.setAttribute('style', 'width:50%');
|
|
8954
9704
|
}
|
|
8955
9705
|
if (downstreamStatus) {
|
|
8956
|
-
downstreamStatus.setAttribute('style',
|
|
9706
|
+
downstreamStatus.setAttribute('style', 'width:50%');
|
|
8957
9707
|
}
|
|
8958
9708
|
}
|
|
8959
9709
|
/* @@ TODO want to look into this, it seems upstream should be a boolean and default to false ?
|
|
@@ -8976,9 +9726,9 @@ function notepad(dom, padDoc, subject, me, options) {
|
|
|
8976
9726
|
var setPartStyle = function setPartStyle(part, colors, pending) {
|
|
8977
9727
|
var chunk = part.subject;
|
|
8978
9728
|
colors = colors || '';
|
|
8979
|
-
var baseStyle =
|
|
8980
|
-
var headingCore =
|
|
8981
|
-
var headingStyle =
|
|
9729
|
+
var baseStyle = 'font-size: 100%; font-family: monospace; width: 100%; border: none; white-space: pre-wrap;';
|
|
9730
|
+
var headingCore = 'font-family: sans-serif; font-weight: bold; border: none;';
|
|
9731
|
+
var headingStyle = ['font-size: 110%; padding-top: 0.5em; padding-bottom: 0.5em; width: 100%;', 'font-size: 120%; padding-top: 1em; padding-bottom: 1em; width: 100%;', 'font-size: 150%; padding-top: 1em; padding-bottom: 1em; width: 100%;'];
|
|
8982
9732
|
var author = kb.any(chunk, ns.dc('author'));
|
|
8983
9733
|
if (!colors && author) {
|
|
8984
9734
|
// Hash the user webid for now -- later allow user selection!
|
|
@@ -8990,9 +9740,9 @@ function notepad(dom, padDoc, subject, me, options) {
|
|
|
8990
9740
|
// and when the indent is stored as a Number itself, not in an object.
|
|
8991
9741
|
var indent = kb.any(chunk, PAD('indent'));
|
|
8992
9742
|
indent = indent ? indent.value : 0;
|
|
8993
|
-
var
|
|
9743
|
+
var style = indent >= 0 ? baseStyle + 'text-indent: ' + indent * 3 + 'em;' : headingCore + headingStyle[-1 - indent];
|
|
8994
9744
|
// ? baseStyle + 'padding-left: ' + (indent * 3) + 'em;'
|
|
8995
|
-
part.setAttribute('style',
|
|
9745
|
+
part.setAttribute('style', style + colors);
|
|
8996
9746
|
};
|
|
8997
9747
|
var removePart = function removePart(part) {
|
|
8998
9748
|
var chunk = part.subject;
|
|
@@ -9072,6 +9822,28 @@ function notepad(dom, padDoc, subject, me, options) {
|
|
|
9072
9822
|
});
|
|
9073
9823
|
};
|
|
9074
9824
|
|
|
9825
|
+
// Use this sort of code to split the line when return pressed in the middle @@
|
|
9826
|
+
/*
|
|
9827
|
+
function doGetCaretPosition doGetCaretPosition (oField) {
|
|
9828
|
+
var iCaretPos = 0
|
|
9829
|
+
// IE Support
|
|
9830
|
+
if (document.selection) {
|
|
9831
|
+
// Set focus on the element to avoid IE bug
|
|
9832
|
+
oField.focus()
|
|
9833
|
+
// To get cursor position, get empty selection range
|
|
9834
|
+
var oSel = document.selection.createRange()
|
|
9835
|
+
// Move selection start to 0 position
|
|
9836
|
+
oSel.moveStart('character', -oField.value.length)
|
|
9837
|
+
// The caret position is selection length
|
|
9838
|
+
iCaretPos = oSel.text.length
|
|
9839
|
+
// Firefox suppor
|
|
9840
|
+
} else if (oField.selectionStart || oField.selectionStart === '0') {
|
|
9841
|
+
iCaretPos = oField.selectionStart
|
|
9842
|
+
}
|
|
9843
|
+
// Return results
|
|
9844
|
+
return (iCaretPos)
|
|
9845
|
+
}
|
|
9846
|
+
*/
|
|
9075
9847
|
var addListeners = function addListeners(part, chunk) {
|
|
9076
9848
|
part.addEventListener('keydown', function (event) {
|
|
9077
9849
|
if (!updater) {
|
|
@@ -9114,7 +9886,7 @@ function notepad(dom, padDoc, subject, me, options) {
|
|
|
9114
9886
|
return;
|
|
9115
9887
|
case 3: // being deleted already
|
|
9116
9888
|
case 4:
|
|
9117
|
-
// already
|
|
9889
|
+
// already deleme state
|
|
9118
9890
|
return;
|
|
9119
9891
|
case undefined:
|
|
9120
9892
|
case 0:
|
|
@@ -9415,6 +10187,8 @@ function notepad(dom, padDoc, subject, me, options) {
|
|
|
9415
10187
|
}
|
|
9416
10188
|
return;
|
|
9417
10189
|
}
|
|
10190
|
+
// var last = kb.the(undefined, PAD('previous'), subject)
|
|
10191
|
+
// var chunk = first // = kb.the(subject, PAD('next'));
|
|
9418
10192
|
var row;
|
|
9419
10193
|
|
|
9420
10194
|
// First see which of the logical chunks have existing physical manifestations
|
|
@@ -9476,7 +10250,7 @@ function notepad(dom, padDoc, subject, me, options) {
|
|
|
9476
10250
|
(0, _debug.log)(' reloaded OK');
|
|
9477
10251
|
clearStatus();
|
|
9478
10252
|
if (!consistencyCheck()) {
|
|
9479
|
-
complain('
|
|
10253
|
+
complain('CONSITENCY CHECK FAILED');
|
|
9480
10254
|
} else {
|
|
9481
10255
|
refreshTree(table);
|
|
9482
10256
|
}
|
|
@@ -9643,7 +10417,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
9643
10417
|
exports.manageParticipation = manageParticipation;
|
|
9644
10418
|
exports.participationObject = participationObject;
|
|
9645
10419
|
exports.recordParticipation = recordParticipation;
|
|
9646
|
-
exports.
|
|
10420
|
+
exports.renderPartipants = renderPartipants;
|
|
9647
10421
|
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"));
|
|
9648
10422
|
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"));
|
|
9649
10423
|
var _assertThisInitialized2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js"));
|
|
@@ -9658,7 +10432,6 @@ var ns = _interopRequireWildcard(__webpack_require__(/*! ./ns */ "./lib/ns.js"))
|
|
|
9658
10432
|
var _widgets = __webpack_require__(/*! ./widgets */ "./lib/widgets/index.js");
|
|
9659
10433
|
var _utils = __webpack_require__(/*! ./utils */ "./lib/utils/index.js");
|
|
9660
10434
|
var _pad = __webpack_require__(/*! ./pad */ "./lib/pad.js");
|
|
9661
|
-
var style = _interopRequireWildcard(__webpack_require__(/*! ./style */ "./lib/style.js"));
|
|
9662
10435
|
var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
|
|
9663
10436
|
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); }
|
|
9664
10437
|
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; }
|
|
@@ -9666,7 +10439,8 @@ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol
|
|
|
9666
10439
|
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); }
|
|
9667
10440
|
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; }
|
|
9668
10441
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
9669
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
10442
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /* Manage a UI for the particpation of a person in any thing
|
|
10443
|
+
*/ // import { currentUser } from './authn/authn'
|
|
9670
10444
|
var ParticipationTableElement = /*#__PURE__*/function (_HTMLTableElement) {
|
|
9671
10445
|
(0, _inherits2["default"])(ParticipationTableElement, _HTMLTableElement);
|
|
9672
10446
|
var _super = _createSuper(ParticipationTableElement);
|
|
@@ -9693,9 +10467,9 @@ var store = _solidLogic.solidLogicSingleton.store;
|
|
|
9693
10467
|
* @param {NamedNode} unused2/me - user that is logged into the pod (this argument is no longer used, but left in for backwards compatibility)
|
|
9694
10468
|
* @param {ParticipationOptions} options - the options that can be passed in are deleteFunction, link, and draggable these are used by the personTR button
|
|
9695
10469
|
*/
|
|
9696
|
-
function
|
|
9697
|
-
table.setAttribute('style',
|
|
9698
|
-
var
|
|
10470
|
+
function renderPartipants(dom, table, unused1, subject, unused2, options) {
|
|
10471
|
+
table.setAttribute('style', 'margin: 0.8em;');
|
|
10472
|
+
var newRowForParticpation = function newRowForParticpation(parp) {
|
|
9699
10473
|
var person = store.any(parp, ns.wf('participant'));
|
|
9700
10474
|
var tr;
|
|
9701
10475
|
if (!person) {
|
|
@@ -9705,12 +10479,11 @@ function renderParticipants(dom, table, unused1, subject, unused2, options) {
|
|
|
9705
10479
|
}
|
|
9706
10480
|
var bg = store.anyValue(parp, ns.ui('backgroundColor')) || 'white';
|
|
9707
10481
|
var block = dom.createElement('div');
|
|
9708
|
-
block.setAttribute('style',
|
|
9709
|
-
block.style.backgroundColor = bg;
|
|
10482
|
+
block.setAttribute('style', 'height: 1.5em; width: 1.5em; margin: 0.3em; border 0.01em solid #888; background-color: ' + bg);
|
|
9710
10483
|
tr = (0, _widgets.personTR)(dom, null, person, options);
|
|
9711
10484
|
table.appendChild(tr);
|
|
9712
10485
|
var td = dom.createElement('td');
|
|
9713
|
-
td.setAttribute('style',
|
|
10486
|
+
td.setAttribute('style', 'vertical-align: middle;');
|
|
9714
10487
|
td.appendChild(block);
|
|
9715
10488
|
tr.insertBefore(td, tr.firstChild);
|
|
9716
10489
|
return tr;
|
|
@@ -9724,16 +10497,16 @@ function renderParticipants(dom, table, unused1, subject, unused2, options) {
|
|
|
9724
10497
|
var participations = parps.map(function (p) {
|
|
9725
10498
|
return p[1];
|
|
9726
10499
|
});
|
|
9727
|
-
(0, _utils.syncTableToArray)(table, participations,
|
|
10500
|
+
(0, _utils.syncTableToArray)(table, participations, newRowForParticpation);
|
|
9728
10501
|
};
|
|
9729
10502
|
table.refresh = syncTable;
|
|
9730
10503
|
syncTable();
|
|
9731
10504
|
return table;
|
|
9732
10505
|
}
|
|
9733
10506
|
|
|
9734
|
-
/** Record, or find old,
|
|
10507
|
+
/** Record, or find old, Particpation object
|
|
9735
10508
|
*
|
|
9736
|
-
* A
|
|
10509
|
+
* A particpaption object is a place to record things specifically about
|
|
9737
10510
|
* subject and the user, such as preferences, start of membership, etc
|
|
9738
10511
|
* @param {NamedNode} subject - the thing in which the participation is happening
|
|
9739
10512
|
* @param {NamedNode} document - where to record the data
|
|
@@ -9768,20 +10541,20 @@ function participationObject(subject, padDoc, me) {
|
|
|
9768
10541
|
}
|
|
9769
10542
|
candidates.sort(); // Pick the earliest
|
|
9770
10543
|
// @@ Possibly, for extra credit, delete the others, if we have write access
|
|
9771
|
-
debug.warn('Multiple
|
|
10544
|
+
debug.warn('Multiple particpation objects, picking earliest, in ' + padDoc);
|
|
9772
10545
|
resolve(candidates[0][1]);
|
|
9773
10546
|
// throw new Error('Multiple records of your participation')
|
|
9774
10547
|
}
|
|
9775
10548
|
|
|
9776
10549
|
if (parps.length) {
|
|
9777
10550
|
// If I am not already recorded
|
|
9778
|
-
resolve(parps[0]); // returns the
|
|
10551
|
+
resolve(parps[0]); // returns the particpation object
|
|
9779
10552
|
} else {
|
|
9780
10553
|
var _participation2 = (0, _widgets.newThing)(padDoc);
|
|
9781
10554
|
var ins = [(0, _rdflib.st)(subject, ns.wf('participation'), _participation2, padDoc), (0, _rdflib.st)(_participation2, ns.wf('participant'), me, padDoc), (0, _rdflib.st)(_participation2, ns.cal('dtstart'), new Date(), padDoc), (0, _rdflib.st)(_participation2, ns.ui('backgroundColor'), (0, _pad.lightColorHash)(me), padDoc)];
|
|
9782
10555
|
store.updater.update([], ins, function (uri, ok, errorMessage) {
|
|
9783
10556
|
if (!ok) {
|
|
9784
|
-
reject(new Error('Error recording your
|
|
10557
|
+
reject(new Error('Error recording your partipation: ' + errorMessage));
|
|
9785
10558
|
} else {
|
|
9786
10559
|
resolve(_participation2);
|
|
9787
10560
|
}
|
|
@@ -9794,7 +10567,7 @@ function participationObject(subject, padDoc, me) {
|
|
|
9794
10567
|
/** Record my participation and display participants
|
|
9795
10568
|
*
|
|
9796
10569
|
* @param {NamedNode} subject - the thing in which participation is happening
|
|
9797
|
-
* @param {NamedNode} padDoc - the document into which the
|
|
10570
|
+
* @param {NamedNode} padDoc - the document into which the particpation should be recorded
|
|
9798
10571
|
* @param {DOMNode} refreshable - a DOM element whose refresh() is to be called if the change works
|
|
9799
10572
|
*
|
|
9800
10573
|
*/
|
|
@@ -9810,22 +10583,24 @@ function recordParticipation(subject, padDoc, refreshable) {
|
|
|
9810
10583
|
}
|
|
9811
10584
|
if (parps.length) {
|
|
9812
10585
|
// If I am not already recorded
|
|
9813
|
-
return parps[0]; // returns the
|
|
10586
|
+
return parps[0]; // returns the particpation object
|
|
9814
10587
|
} else {
|
|
9815
10588
|
if (!store.updater.editable(padDoc)) {
|
|
9816
|
-
debug.log('Not recording participation, as no write
|
|
10589
|
+
debug.log('Not recording participation, as no write acesss as ' + me + ' to ' + padDoc);
|
|
9817
10590
|
return null;
|
|
9818
10591
|
}
|
|
9819
10592
|
var participation = (0, _widgets.newThing)(padDoc);
|
|
9820
10593
|
var ins = [(0, _rdflib.st)(subject, ns.wf('participation'), participation, padDoc), (0, _rdflib.st)(participation, ns.wf('participant'), me, padDoc), (0, _rdflib.st)(participation, ns.cal('dtstart'), new Date(), padDoc), (0, _rdflib.st)(participation, ns.ui('backgroundColor'), (0, _pad.lightColorHash)(me), padDoc)];
|
|
9821
10594
|
store.updater.update([], ins, function (uri, ok, errorMessage) {
|
|
9822
10595
|
if (!ok) {
|
|
9823
|
-
throw new Error('Error recording your
|
|
10596
|
+
throw new Error('Error recording your partipation: ' + errorMessage);
|
|
9824
10597
|
}
|
|
9825
10598
|
if (refreshable && refreshable.refresh) {
|
|
9826
10599
|
refreshable.refresh();
|
|
9827
10600
|
}
|
|
10601
|
+
// UI.pad.renderPartipants(dom, table, padDoc, subject, me, options)
|
|
9828
10602
|
});
|
|
10603
|
+
|
|
9829
10604
|
return participation;
|
|
9830
10605
|
}
|
|
9831
10606
|
}
|
|
@@ -9834,7 +10609,7 @@ function recordParticipation(subject, padDoc, refreshable) {
|
|
|
9834
10609
|
*
|
|
9835
10610
|
* @param {Document} dom - the web page loaded into the browser
|
|
9836
10611
|
* @param {HTMLDivElement} container - the container element where the participants should be displayed
|
|
9837
|
-
* @param {NamedNode} document - the document into which the
|
|
10612
|
+
* @param {NamedNode} document - the document into which the particpation should be shown
|
|
9838
10613
|
* @param {NamedNode} subject - the thing in which participation is happening
|
|
9839
10614
|
* @param {NamedNode} me - the logged in user
|
|
9840
10615
|
* @param {ParticipationOptions} options - the options that can be passed in are deleteFunction, link, and draggable these are used by the personTR button
|
|
@@ -9843,12 +10618,12 @@ function recordParticipation(subject, padDoc, refreshable) {
|
|
|
9843
10618
|
function manageParticipation(dom, container, padDoc, subject, me, options) {
|
|
9844
10619
|
var table = dom.createElement('table');
|
|
9845
10620
|
container.appendChild(table);
|
|
9846
|
-
|
|
10621
|
+
renderPartipants(dom, table, padDoc, subject, me, options);
|
|
9847
10622
|
var _participation;
|
|
9848
10623
|
try {
|
|
9849
10624
|
_participation = recordParticipation(subject, padDoc, table);
|
|
9850
10625
|
} catch (e) {
|
|
9851
|
-
container.appendChild((0, _widgets.errorMessageBlock)(dom, 'Error recording your
|
|
10626
|
+
container.appendChild((0, _widgets.errorMessageBlock)(dom, 'Error recording your partipation: ' + e)); // Clean up?
|
|
9852
10627
|
}
|
|
9853
10628
|
|
|
9854
10629
|
return table;
|
|
@@ -9925,6 +10700,10 @@ function recordSharedPreferences(subject, context) {
|
|
|
9925
10700
|
return new Promise(function (resolve, reject) {
|
|
9926
10701
|
var sharedPreferences = kb.any(subject, ns.ui('sharedPreferences'));
|
|
9927
10702
|
if (!sharedPreferences) {
|
|
10703
|
+
if (!kb.updater.editable(subject.doc())) {
|
|
10704
|
+
debug.log(" Cant make shared preferences, may not change ".concat(subject.doc));
|
|
10705
|
+
resolve(context);
|
|
10706
|
+
}
|
|
9928
10707
|
var sp = $rdf.sym(subject.doc().uri + '#SharedPreferences');
|
|
9929
10708
|
var ins = [$rdf.st(subject, ns.ui('sharedPreferences'), sp, subject.doc())];
|
|
9930
10709
|
debug.log('Creating shared preferences ' + sp);
|
|
@@ -10222,33 +11001,40 @@ Signup.prototype.signup = function signup(signupUrl) {
|
|
|
10222
11001
|
/*!**********************!*\
|
|
10223
11002
|
!*** ./lib/style.js ***!
|
|
10224
11003
|
\**********************/
|
|
10225
|
-
/***/ ((module, exports
|
|
11004
|
+
/***/ ((module, exports) => {
|
|
10226
11005
|
|
|
10227
11006
|
"use strict";
|
|
10228
11007
|
|
|
10229
11008
|
|
|
10230
|
-
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
|
|
10231
11009
|
Object.defineProperty(exports, "__esModule", ({
|
|
10232
11010
|
value: true
|
|
10233
11011
|
}));
|
|
10234
11012
|
exports.style = void 0;
|
|
10235
|
-
var _styleConstants = _interopRequireDefault(__webpack_require__(/*! ./styleConstants */ "./lib/styleConstants.js"));
|
|
10236
11013
|
// Common readable consistent stylesheet
|
|
10237
11014
|
// to avoid using style sheets which are document-global
|
|
10238
11015
|
// and make programmable style toggling with selection, drag over, etc easier
|
|
11016
|
+
|
|
10239
11017
|
// These must all end with semicolon so they can be appended to.
|
|
10240
11018
|
|
|
11019
|
+
var formBorderColor = '#888888'; // Mid-grey
|
|
11020
|
+
var lowProfileLinkColor = '#3B5998'; // Grey-blue, e.g., for field labels linking to ontology
|
|
11021
|
+
var formFieldNameBoxWidth = '8em'; // The fixed amount to get form fields to line up
|
|
11022
|
+
// The latter we put in when switching awy from using tables. Getting allignment between
|
|
11023
|
+
// fields in different groups though is hard problem.
|
|
11024
|
+
|
|
10241
11025
|
var style = {
|
|
10242
11026
|
// styleModule
|
|
10243
11027
|
|
|
10244
11028
|
checkboxStyle: 'color: black; font-size: 100%; padding-left: 0.5 em; padding-right: 0.5 em;',
|
|
10245
11029
|
checkboxInputStyle: 'font-size: 150%; height: 1.2em; width: 1.2em; background-color: #eef; border-radius:0.2em; margin: 0.1em',
|
|
10246
11030
|
fieldLabelStyle: 'color: #3B5998; text-decoration: none;',
|
|
10247
|
-
|
|
11031
|
+
formSelectSTyle: 'background-color: #eef; padding: 0.5em; border: .05em solid #88c; border-radius:0.2em; font-size: 100%; margin:0.4em;',
|
|
10248
11032
|
textInputStyle: 'background-color: #eef; padding: 0.5em; border: .05em solid #88c; border-radius:0.2em; font-size: 100%; margin:0.4em;',
|
|
10249
11033
|
textInputStyleUneditable:
|
|
10250
11034
|
// Color difference only
|
|
10251
11035
|
'background-color: white; padding: 0.5em; border: .05em solid white; border-radius:0.2em; font-size: 100%; margin:0.4em;',
|
|
11036
|
+
textInputSize: 20,
|
|
11037
|
+
// Default text input size in characters roughly
|
|
10252
11038
|
buttonStyle: 'background-color: #fff; padding: 0.7em; border: .01em solid white; border-radius:0.2em; font-size: 100%; margin: 0.3em;',
|
|
10253
11039
|
// 'background-color: #eef;
|
|
10254
11040
|
commentStyle: 'padding: 0.7em; border: none; font-size: 100%; white-space: pre-wrap;',
|
|
@@ -10257,8 +11043,12 @@ var style = {
|
|
|
10257
11043
|
classIconStyle: 'width: 3em; height: 3em; margin: 0.1em; border-radius: 0.2em; border: 0.1em solid green; padding: 0.2em; background-color: #efe;',
|
|
10258
11044
|
// combine with buttonStyle
|
|
10259
11045
|
confirmPopupStyle: 'padding: 0.7em; border-radius: 0.2em; border: 0.1em solid orange; background-color: white; box-shadow: 0.5em 0.9em #888;',
|
|
11046
|
+
tabBorderRadius: '0.2em',
|
|
10260
11047
|
messageBodyStyle: 'white-space: pre-wrap; width: 99%; font-size:100%; border: 0.07em solid #eee; border-radius:0.2em; padding: .3em 0.5em; margin: 0.1em;',
|
|
10261
11048
|
pendingeditModifier: 'color: #bbb;',
|
|
11049
|
+
highlightColor: '#7C4DFF',
|
|
11050
|
+
// Solid lavendar https://design.inrupt.com/atomic-core/?cat=Core
|
|
11051
|
+
|
|
10262
11052
|
// Contacts
|
|
10263
11053
|
personaBarStyle: 'width: 100%; height: 4em; background-color: #eee; vertical-align: middle;',
|
|
10264
11054
|
searchInputStyle: 'border: 0.1em solid #444; border-radius: 0.2em; width: 100%; font-size: 100%; padding: 0.1em 0.6em; margin 0.2em;',
|
|
@@ -10277,15 +11067,24 @@ var style = {
|
|
|
10277
11067
|
heading4Style: 'font-size: 110%; font-weight: bold; color: #888888; padding: 0.2em; margin: 0.7em 0.0em;',
|
|
10278
11068
|
// Lowest level used by default in small things
|
|
10279
11069
|
|
|
11070
|
+
formBorderColor: formBorderColor,
|
|
11071
|
+
// originally was brown; now grey
|
|
11072
|
+
formHeadingColor: '#888888',
|
|
11073
|
+
// originally was brown; now grey
|
|
10280
11074
|
formHeadingStyle: 'font-size: 110%; font-weight: bold; color: #888888; padding: 0.2em; margin: 0.7em 0.0em;',
|
|
10281
11075
|
// originally was brown; now grey
|
|
10282
11076
|
formTextInput: 'font-size: 100%; margin: 0.1em; padding: 0.1em;',
|
|
10283
11077
|
// originally used this
|
|
10284
|
-
formGroupStyle: ["padding-left: 0em; border: 0.0em solid ".concat(
|
|
10285
|
-
"padding-left: 2em; border: 0.05em solid ".concat(
|
|
11078
|
+
formGroupStyle: ["padding-left: 0em; border: 0.0em solid ".concat(formBorderColor, "; border-radius: 0.2em;"), // weight 0
|
|
11079
|
+
"padding-left: 2em; border: 0.05em solid ".concat(formBorderColor, "; border-radius: 0.2em;"), "padding-left: 2em; border: 0.1em solid ".concat(formBorderColor, "; border-radius: 0.2em;"), "padding-left: 2em; border: 0.2em solid ".concat(formBorderColor, "; border-radius: 0.2em;") // @@ pink
|
|
10286
11080
|
],
|
|
10287
|
-
formFieldLabelStyle: "'color: ".concat(
|
|
10288
|
-
|
|
11081
|
+
formFieldLabelStyle: "'color: ".concat(lowProfileLinkColor, "; text-decoration: none;'"),
|
|
11082
|
+
formFieldNameBoxWidth: formFieldNameBoxWidth,
|
|
11083
|
+
formFieldNameBoxStyle: "padding: 0.3em; vertical-align: middle; width:".concat(formFieldNameBoxWidth, ";"),
|
|
11084
|
+
textInputBackgroundColor: '#eef',
|
|
11085
|
+
textInputBackgroundColorUneditable: '#fff',
|
|
11086
|
+
textInputColor: '#000',
|
|
11087
|
+
textInputColorPending: '#888',
|
|
10289
11088
|
multilineTextInputStyle: 'font-size:100%; white-space: pre-wrap; background-color: #eef;' + ' border: 0.07em solid gray; padding: 1em 0.5em; margin: 1em 1em;',
|
|
10290
11089
|
// Buttons
|
|
10291
11090
|
renderAsDivStyle: 'display: flex; align-items: center; justify-content: space-between; height: 2.5em; padding: 1em;',
|
|
@@ -10348,34 +11147,7 @@ var style = {
|
|
|
10348
11147
|
secondaryButton: 'background-color: #01c9ea; color: #ffffff; font-family: Raleway, Roboto, sans-serif;border-radius: 0.25em; border-color: #01c9ea; border: 1px solid; cursor: pointer; font-size: .8em;text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none',
|
|
10349
11148
|
secondaryButtonHover: 'background-color: #37cde6; color: #ffffff; font-family: Raleway, Roboto, sans-serif;border-radius: 0.25em; border-color: #7c4dff; border: 1px solid; cursor: pointer; font-size: .8em;text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none; transition: 0.25s all ease-in-out',
|
|
10350
11149
|
secondaryButtonNoBorder: 'background-color: #ffffff; color: #01c9ea; font-family: Raleway, Roboto, sans-serif; border-radius: 0.25em; border-color: #01c9ea; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none',
|
|
10351
|
-
secondaryButtonNoBorderHover: 'background-color: #01c9ea; color: #ffffff; font-family: Raleway, Roboto, sans-serif; border-radius: 0.25em; border-color: #01c9ea; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none; transition: 0.25s all ease-in-out'
|
|
10352
|
-
// media
|
|
10353
|
-
controlStyle: "border-radius: 0.5em; margin: 0.8em; width:".concat(_styleConstants["default"].mediaModuleCanvasWidth, "; height:").concat(_styleConstants["default"].mediaModuleCanvasHeight, ";"),
|
|
10354
|
-
// dragAndDrop
|
|
10355
|
-
dragEvent: 'background-color: #ccc; border: 0.25em dashed black; border-radius: 0.3em;',
|
|
10356
|
-
dropEvent: 'background-color: white; border: 0em solid black;',
|
|
10357
|
-
restoreStyle: 'background-color: white;',
|
|
10358
|
-
// errors
|
|
10359
|
-
errorCancelButton: 'width: 2em; height: 2em; align: right;',
|
|
10360
|
-
errorMessageBlockStyle: 'margin: 0.1em; padding: 0.5em; border: 0.05em solid gray; color:black;',
|
|
10361
|
-
// pad
|
|
10362
|
-
notepadStyle: 'padding: 1em; overflow: auto; resize: horizontal; min-width: 40em;',
|
|
10363
|
-
upstreamStatus: 'width:50%',
|
|
10364
|
-
downstreamStatus: 'width:50%',
|
|
10365
|
-
baseStyle: 'font-size: 100%; font-family: monospace; width: 100%; border: none; white-space: pre-wrap;',
|
|
10366
|
-
headingCore: 'font-family: sans-serif; font-weight: bold; border: none;',
|
|
10367
|
-
headingStyle: ['font-size: 110%; padding-top: 0.5em; padding-bottom: 0.5em; width: 100%;', 'font-size: 120%; padding-top: 1em; padding-bottom: 1em; width: 100%;', 'font-size: 150%; padding-top: 1em; padding-bottom: 1em; width: 100%;'],
|
|
10368
|
-
// participation
|
|
10369
|
-
participantsStyle: 'margin: 0.8em;',
|
|
10370
|
-
participantsBlock: 'height: 1.5em; width: 1.5em; margin: 0.3em; border 0.01em solid #888;',
|
|
10371
|
-
personTableTD: 'vertical-align: middle;',
|
|
10372
|
-
// tabs
|
|
10373
|
-
tabsNavElement: 'margin: 0;',
|
|
10374
|
-
tabsRootElement: 'display: flex; height: 100%; width: 100%;',
|
|
10375
|
-
tabsMainElement: 'margin: 0; width:100%; height: 100%;',
|
|
10376
|
-
tabContainer: 'list-style-type: none; display: flex; height: 100%; width: 100%; margin: 0; padding: 0;',
|
|
10377
|
-
makeNewSlot: 'background: none; border: none; font: inherit; cursor: pointer',
|
|
10378
|
-
ellipsis: 'position: absolute; right: 0; bottom: 0; width: 20%; background: none; color: inherit; border: none; padding: 0; font: inherit; cursor: pointer; outline: inherit;'
|
|
11150
|
+
secondaryButtonNoBorderHover: 'background-color: #01c9ea; color: #ffffff; font-family: Raleway, Roboto, sans-serif; border-radius: 0.25em; border-color: #01c9ea; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none; transition: 0.25s all ease-in-out'
|
|
10379
11151
|
};
|
|
10380
11152
|
exports.style = style;
|
|
10381
11153
|
style.setStyle = function setStyle(ele, styleName) {
|
|
@@ -10386,50 +11158,6 @@ module.exports = style; // @@ No way to do this in ESM
|
|
|
10386
11158
|
|
|
10387
11159
|
/***/ }),
|
|
10388
11160
|
|
|
10389
|
-
/***/ "./lib/styleConstants.js":
|
|
10390
|
-
/*!*******************************!*\
|
|
10391
|
-
!*** ./lib/styleConstants.js ***!
|
|
10392
|
-
\*******************************/
|
|
10393
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
10394
|
-
|
|
10395
|
-
"use strict";
|
|
10396
|
-
|
|
10397
|
-
|
|
10398
|
-
Object.defineProperty(exports, "__esModule", ({
|
|
10399
|
-
value: true
|
|
10400
|
-
}));
|
|
10401
|
-
exports["default"] = void 0;
|
|
10402
|
-
var _default = {
|
|
10403
|
-
highlightColor: '#7C4DFF',
|
|
10404
|
-
// Solid lavender https://design.inrupt.com/atomic-core/?cat=Core
|
|
10405
|
-
|
|
10406
|
-
formBorderColor: '#888888',
|
|
10407
|
-
// Mid-grey
|
|
10408
|
-
formHeadingColor: '#888888',
|
|
10409
|
-
// originally was brown; now grey
|
|
10410
|
-
lowProfileLinkColor: '#3B5998',
|
|
10411
|
-
// Grey-blue, e.g., for field labels linking to ontology
|
|
10412
|
-
formFieldNameBoxWidth: '8em',
|
|
10413
|
-
// The fixed amount to get form fields to line up
|
|
10414
|
-
// The latter we put in when switching awy from using tables. Getting alignment between
|
|
10415
|
-
// fields in different groups though is hard problem.
|
|
10416
|
-
|
|
10417
|
-
mediaModuleCanvasWidth: '640',
|
|
10418
|
-
mediaModuleCanvasHeight: '480',
|
|
10419
|
-
textInputSize: 20,
|
|
10420
|
-
// Default text input size in characters roughly
|
|
10421
|
-
tabBorderRadius: '0.2em',
|
|
10422
|
-
textInputBackgroundColor: '#eef',
|
|
10423
|
-
textInputBackgroundColorUneditable: '#fff',
|
|
10424
|
-
textInputColor: '#000',
|
|
10425
|
-
textInputColorPending: '#888',
|
|
10426
|
-
defaultErrorBackgroundColor: '#fee'
|
|
10427
|
-
};
|
|
10428
|
-
exports["default"] = _default;
|
|
10429
|
-
//# sourceMappingURL=styleConstants.js.map
|
|
10430
|
-
|
|
10431
|
-
/***/ }),
|
|
10432
|
-
|
|
10433
11161
|
/***/ "./lib/style_multiSelect.js":
|
|
10434
11162
|
/*!**********************************!*\
|
|
10435
11163
|
!*** ./lib/style_multiSelect.js ***!
|
|
@@ -12101,7 +12829,6 @@ function renderTableViewPane(doc, options) {
|
|
|
12101
12829
|
|
|
12102
12830
|
|
|
12103
12831
|
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
|
|
12104
|
-
var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
|
|
12105
12832
|
Object.defineProperty(exports, "__esModule", ({
|
|
12106
12833
|
value: true
|
|
12107
12834
|
}));
|
|
@@ -12118,10 +12845,7 @@ var _wrapNativeSuper2 = _interopRequireDefault(__webpack_require__(/*! @babel/ru
|
|
|
12118
12845
|
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js"));
|
|
12119
12846
|
var _widgets = __webpack_require__(/*! ./widgets */ "./lib/widgets/index.js");
|
|
12120
12847
|
var _utils = __webpack_require__(/*! ./utils */ "./lib/utils/index.js");
|
|
12121
|
-
var style = _interopRequireWildcard(__webpack_require__(/*! ./style */ "./lib/style.js"));
|
|
12122
12848
|
var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
|
|
12123
|
-
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); }
|
|
12124
|
-
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; }
|
|
12125
12849
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
12126
12850
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
12127
12851
|
/**
|
|
@@ -12304,12 +13028,11 @@ var TabElement = /*#__PURE__*/function (_HTMLElement3) {
|
|
|
12304
13028
|
*
|
|
12305
13029
|
* @param options
|
|
12306
13030
|
*/
|
|
12307
|
-
var tabsDefaultBackgroundColor = '#ddddcc';
|
|
12308
13031
|
function tabWidget(options) {
|
|
12309
13032
|
var subject = options.subject;
|
|
12310
13033
|
var dom = options.dom || document;
|
|
12311
13034
|
var orientation = parseInt(options.orientation || '0');
|
|
12312
|
-
var backgroundColor = options.backgroundColor ||
|
|
13035
|
+
var backgroundColor = options.backgroundColor || '#ddddcc';
|
|
12313
13036
|
var flipped = orientation & 2;
|
|
12314
13037
|
var vertical = orientation & 1;
|
|
12315
13038
|
var onClose = options.onClose;
|
|
@@ -12320,15 +13043,13 @@ function tabWidget(options) {
|
|
|
12320
13043
|
var bodyMainStyle = "flex: 2; width: auto; height: 100%; border: 0.1em; border-style: solid; border-color: ".concat(selectedColor, "; padding: 1em;");
|
|
12321
13044
|
var rootElement = dom.createElement('div'); // 20200117a
|
|
12322
13045
|
|
|
12323
|
-
rootElement.setAttribute('style',
|
|
12324
|
-
rootElement.style.flexDirection = (vertical ? 'row' : 'column') + (flipped ? '-reverse;' : ';');
|
|
13046
|
+
rootElement.setAttribute('style', 'display: flex; height: 100%; width: 100%; flex-direction: ' + (vertical ? 'row' : 'column') + (flipped ? '-reverse;' : ';'));
|
|
12325
13047
|
var navElement = rootElement.appendChild(dom.createElement('nav'));
|
|
12326
|
-
navElement.setAttribute('style',
|
|
13048
|
+
navElement.setAttribute('style', 'margin: 0;');
|
|
12327
13049
|
var mainElement = rootElement.appendChild(dom.createElement('main'));
|
|
12328
|
-
mainElement.setAttribute('style',
|
|
13050
|
+
mainElement.setAttribute('style', 'margin: 0; width:100%; height: 100%;'); // override tabbedtab.css
|
|
12329
13051
|
var tabContainer = navElement.appendChild(dom.createElement('ul'));
|
|
12330
|
-
tabContainer.setAttribute('style', style.
|
|
12331
|
-
tabContainer.style.flexDirection = "".concat(vertical ? 'column' : 'row');
|
|
13052
|
+
tabContainer.setAttribute('style', "\n list-style-type: none;\n display: flex;\n height: 100%;\n width: 100%;\n margin: 0;\n padding: 0;\n flex-direction: ".concat(vertical ? 'column' : 'row', "\n "));
|
|
12332
13053
|
var tabElement = 'li';
|
|
12333
13054
|
var bodyContainer = mainElement;
|
|
12334
13055
|
rootElement.tabContainer = tabContainer;
|
|
@@ -12348,7 +13069,7 @@ function tabWidget(options) {
|
|
|
12348
13069
|
rootElement.refresh = orderedSync;
|
|
12349
13070
|
orderedSync();
|
|
12350
13071
|
if (!options.startEmpty && tabContainer.children.length && options.selectedTab) {
|
|
12351
|
-
var selectedTab0 = Array.from(tabContainer.children) // Version left for
|
|
13072
|
+
var selectedTab0 = Array.from(tabContainer.children) // Version left for compatability with ??
|
|
12352
13073
|
.map(function (tab) {
|
|
12353
13074
|
return tab.firstChild;
|
|
12354
13075
|
}).find(function (tab) {
|
|
@@ -12402,7 +13123,7 @@ function tabWidget(options) {
|
|
|
12402
13123
|
ele.setAttribute('style', unselectedStyle);
|
|
12403
13124
|
ele.subject = item;
|
|
12404
13125
|
var div = ele.appendChild(dom.createElement('button'));
|
|
12405
|
-
div.setAttribute('style',
|
|
13126
|
+
div.setAttribute('style', 'background: none; border: none; font: inherit; cursor: pointer');
|
|
12406
13127
|
div.onclick = function () {
|
|
12407
13128
|
resetTabStyle();
|
|
12408
13129
|
resetBodyStyle();
|
|
@@ -12419,7 +13140,7 @@ function tabWidget(options) {
|
|
|
12419
13140
|
if (options.renderTabSettings && ele.subject) {
|
|
12420
13141
|
var ellipsis = dom.createElement('button');
|
|
12421
13142
|
ellipsis.textContent = '...';
|
|
12422
|
-
ellipsis.setAttribute('style',
|
|
13143
|
+
ellipsis.setAttribute('style', 'position: absolute; right: 0; bottom: 0; width: 20%; background: none; color: inherit; border: none; padding: 0; font: inherit; cursor: pointer; outline: inherit;');
|
|
12423
13144
|
ellipsis.onclick = function () {
|
|
12424
13145
|
resetTabStyle();
|
|
12425
13146
|
resetBodyStyle();
|
|
@@ -12582,6 +13303,8 @@ var _ = __webpack_require__(/*! .. */ "./lib/index.js");
|
|
|
12582
13303
|
Copied from mashlib/src/global/metadata.ts
|
|
12583
13304
|
*/
|
|
12584
13305
|
|
|
13306
|
+
/* @ts-ignore no-console */
|
|
13307
|
+
|
|
12585
13308
|
/**
|
|
12586
13309
|
* @ignore exporting this only for the unit test
|
|
12587
13310
|
*/
|
|
@@ -13706,8 +14429,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
13706
14429
|
}));
|
|
13707
14430
|
exports.versionInfo = void 0;
|
|
13708
14431
|
var versionInfo = {
|
|
13709
|
-
buildTime: '2023-07-
|
|
13710
|
-
commit: '
|
|
14432
|
+
buildTime: '2023-07-05T09:52:09Z',
|
|
14433
|
+
commit: 'e5cde85544413439f617ecc892e656b288a5f4e4',
|
|
13711
14434
|
npmInfo: {
|
|
13712
14435
|
'solid-ui': '2.4.28',
|
|
13713
14436
|
npm: '8.19.4',
|
|
@@ -13809,9 +14532,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
13809
14532
|
* UI Widgets such as buttons
|
|
13810
14533
|
* @packageDocumentation
|
|
13811
14534
|
*/
|
|
13812
|
-
|
|
13813
14535
|
/* global alert */
|
|
13814
|
-
|
|
13815
14536
|
var iconBase = _iconBase.icons.iconBase;
|
|
13816
14537
|
var cancelIconURI = iconBase + 'noun_1180156.svg'; // black X
|
|
13817
14538
|
var checkIconURI = iconBase + 'noun_1180158.svg'; // green checkmark; Continue
|
|
@@ -15146,17 +15867,16 @@ exports.makeDropTarget = makeDropTarget;
|
|
|
15146
15867
|
exports.uploadFiles = uploadFiles;
|
|
15147
15868
|
var debug = _interopRequireWildcard(__webpack_require__(/*! ../debug */ "./lib/debug.js"));
|
|
15148
15869
|
var mime = _interopRequireWildcard(__webpack_require__(/*! mime-types */ "./node_modules/mime-types/index.js"));
|
|
15149
|
-
var style = _interopRequireWildcard(__webpack_require__(/*! ../style */ "./lib/style.js"));
|
|
15150
15870
|
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); }
|
|
15151
15871
|
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; }
|
|
15152
15872
|
/* Drag and drop common functionality
|
|
15153
15873
|
*
|
|
15154
15874
|
* It is easy to make something draggable, or to make it a drag target!
|
|
15155
|
-
* Just call the functions below.
|
|
15156
|
-
* represent one thing which has a
|
|
15875
|
+
* Just call the functions below. In a solid world, any part of the UI which
|
|
15876
|
+
* represent one thing which has a UR, should be made draggable using makeDraggable
|
|
15157
15877
|
* Any list of things should typically allow you to drag new members of the list
|
|
15158
15878
|
* onto it.
|
|
15159
|
-
* The file upload function uploadFiles is provided as often
|
|
15879
|
+
* The file upload function uploadFiles is provided as often of someone drags a file from the computer
|
|
15160
15880
|
* desktop, you may want to upload it into the pod.
|
|
15161
15881
|
*/
|
|
15162
15882
|
|
|
@@ -15164,16 +15884,22 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
15164
15884
|
|
|
15165
15885
|
function makeDropTarget(ele, droppedURIHandler, droppedFileHandler) {
|
|
15166
15886
|
var dragoverListener = function dragoverListener(e) {
|
|
15167
|
-
e.preventDefault(); //
|
|
15887
|
+
e.preventDefault(); // Neeed else drop does not work [sic]
|
|
15168
15888
|
e.dataTransfer.dropEffect = 'copy';
|
|
15169
15889
|
};
|
|
15170
15890
|
var dragenterListener = function dragenterListener(e) {
|
|
15171
15891
|
debug.log('dragenter event dropEffect: ' + e.dataTransfer.dropEffect);
|
|
15172
|
-
if (this.
|
|
15892
|
+
if (this.style) {
|
|
15173
15893
|
// necessary not sure when
|
|
15174
15894
|
if (!this.savedStyle) {
|
|
15175
|
-
this.savedStyle =
|
|
15895
|
+
this.savedStyle = {};
|
|
15896
|
+
this.savedStyle.border = this.style.border;
|
|
15897
|
+
this.savedStyle.backgroundColor = this.style.backgroundColor;
|
|
15898
|
+
this.savedStyle.borderRadius = this.style.borderRadius;
|
|
15176
15899
|
}
|
|
15900
|
+
this.style.backgroundColor = '#ccc';
|
|
15901
|
+
this.style.border = '0.25em dashed black';
|
|
15902
|
+
this.style.borderRadius = '0.3em';
|
|
15177
15903
|
}
|
|
15178
15904
|
e.dataTransfer.dropEffect = 'link';
|
|
15179
15905
|
debug.log('dragenter event dropEffect 2: ' + e.dataTransfer.dropEffect);
|
|
@@ -15181,9 +15907,12 @@ function makeDropTarget(ele, droppedURIHandler, droppedFileHandler) {
|
|
|
15181
15907
|
var dragleaveListener = function dragleaveListener(e) {
|
|
15182
15908
|
debug.log('dragleave event dropEffect: ' + e.dataTransfer.dropEffect);
|
|
15183
15909
|
if (this.savedStyle) {
|
|
15184
|
-
this.
|
|
15910
|
+
this.style.border = this.savedStyle.border;
|
|
15911
|
+
this.style.backgroundColor = this.savedStyle.backgroundColor;
|
|
15912
|
+
this.style.borderRadius = this.savedStyle.borderRadius;
|
|
15185
15913
|
} else {
|
|
15186
|
-
this.
|
|
15914
|
+
this.style.backgroundColor = 'white';
|
|
15915
|
+
this.style.border = '0em solid black';
|
|
15187
15916
|
}
|
|
15188
15917
|
};
|
|
15189
15918
|
var dropListener = function dropListener(e) {
|
|
@@ -15222,7 +15951,7 @@ function makeDropTarget(ele, droppedURIHandler, droppedFileHandler) {
|
|
|
15222
15951
|
if (uris) {
|
|
15223
15952
|
droppedURIHandler(uris);
|
|
15224
15953
|
}
|
|
15225
|
-
this.
|
|
15954
|
+
this.style.backgroundColor = 'white'; // restore style
|
|
15226
15955
|
return false;
|
|
15227
15956
|
}; // dropListener
|
|
15228
15957
|
|
|
@@ -15343,17 +16072,11 @@ function uploadFiles(fetcher, files, fileBase, imageBase, successHandler) {
|
|
|
15343
16072
|
"use strict";
|
|
15344
16073
|
|
|
15345
16074
|
|
|
15346
|
-
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
|
|
15347
|
-
var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
|
|
15348
16075
|
Object.defineProperty(exports, "__esModule", ({
|
|
15349
16076
|
value: true
|
|
15350
16077
|
}));
|
|
15351
16078
|
exports.errorMessageBlock = errorMessageBlock;
|
|
15352
16079
|
var _widgets = __webpack_require__(/*! ../widgets */ "./lib/widgets/index.js");
|
|
15353
|
-
var style = _interopRequireWildcard(__webpack_require__(/*! ../style */ "./lib/style.js"));
|
|
15354
|
-
var _styleConstants = _interopRequireDefault(__webpack_require__(/*! ../styleConstants */ "./lib/styleConstants.js"));
|
|
15355
|
-
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); }
|
|
15356
|
-
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; }
|
|
15357
16080
|
/**
|
|
15358
16081
|
* Create an error message block
|
|
15359
16082
|
* @param dom The DOM on which dom.createElement will be called
|
|
@@ -15382,9 +16105,8 @@ function errorMessageBlock(dom, err, backgroundColor, err2) {
|
|
|
15382
16105
|
}
|
|
15383
16106
|
div.appendChild((0, _widgets.cancelButton)(dom, function () {
|
|
15384
16107
|
if (div.parentNode) div.parentNode.removeChild(div);
|
|
15385
|
-
})).style =
|
|
15386
|
-
div.setAttribute('style',
|
|
15387
|
-
div.style.backgroundColor = backgroundColor || _styleConstants["default"].defaultErrorBackgroundColor;
|
|
16108
|
+
})).style = 'width: 2em; height: 2em; align: right;';
|
|
16109
|
+
div.setAttribute('style', 'margin: 0.1em; padding: 0.5em; border: 0.05em solid gray; background-color: ' + (backgroundColor || '#fee') + '; color:black;');
|
|
15388
16110
|
return div;
|
|
15389
16111
|
}
|
|
15390
16112
|
//# sourceMappingURL=error.js.map
|
|
@@ -15481,7 +16203,6 @@ var _error = __webpack_require__(/*! ./error */ "./lib/widgets/error.js");
|
|
|
15481
16203
|
var _basic = __webpack_require__(/*! ./forms/basic */ "./lib/widgets/forms/basic.js");
|
|
15482
16204
|
var _autocompleteField = __webpack_require__(/*! ./forms/autocomplete/autocompleteField */ "./lib/widgets/forms/autocomplete/autocompleteField.js");
|
|
15483
16205
|
var style = _interopRequireWildcard(__webpack_require__(/*! ../style */ "./lib/style.js"));
|
|
15484
|
-
var _styleConstants = _interopRequireDefault(__webpack_require__(/*! ../styleConstants */ "./lib/styleConstants.js"));
|
|
15485
16206
|
var _iconBase = __webpack_require__(/*! ../iconBase */ "./lib/iconBase.js");
|
|
15486
16207
|
var log = _interopRequireWildcard(__webpack_require__(/*! ../log */ "./lib/log.js"));
|
|
15487
16208
|
var ns = _interopRequireWildcard(__webpack_require__(/*! ../ns */ "./lib/ns.js"));
|
|
@@ -15494,7 +16215,10 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
15494
16215
|
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; }
|
|
15495
16216
|
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; } } }; }
|
|
15496
16217
|
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); }
|
|
15497
|
-
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; }
|
|
16218
|
+
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; } /* F O R M S
|
|
16219
|
+
*
|
|
16220
|
+
* A Vanilla Dom implementation of the form language
|
|
16221
|
+
*/ /* eslint-disable multiline-ternary */ /* global alert */ // Note default export
|
|
15498
16222
|
var checkMarkCharacter = "\u2713";
|
|
15499
16223
|
var cancelCharacter = "\u2715";
|
|
15500
16224
|
var dashCharacter = '-';
|
|
@@ -16167,7 +16891,7 @@ _fieldFunction.field[ns.ui('MultiLineTextField').uri] = function (dom, container
|
|
|
16167
16891
|
box.style.display = 'flex';
|
|
16168
16892
|
box.style.flexDirection = 'row';
|
|
16169
16893
|
var left = box.appendChild(dom.createElement('div'));
|
|
16170
|
-
left.style.width =
|
|
16894
|
+
left.style.width = style.formFieldNameBoxWidth;
|
|
16171
16895
|
var right = box.appendChild(dom.createElement('div'));
|
|
16172
16896
|
left.appendChild((0, _basic.fieldLabel)(dom, property, form));
|
|
16173
16897
|
dataDoc = (0, _basic.fieldStore)(subject, property, dataDoc);
|
|
@@ -16594,7 +17318,7 @@ function promptForNew(dom, kb, subject, predicate, theClass, form, dataDoc, call
|
|
|
16594
17318
|
}
|
|
16595
17319
|
|
|
16596
17320
|
log.debug('form is ' + form);
|
|
16597
|
-
box.setAttribute('style', "border: 0.05em solid ".concat(
|
|
17321
|
+
box.setAttribute('style', "border: 0.05em solid ".concat(style.formBorderColor, "; color: ").concat(style.formBorderColor)); // @@color?
|
|
16598
17322
|
box.innerHTML = '<h3>New ' + utils.label(theClass) + '</h3>';
|
|
16599
17323
|
var formFunction = (0, _fieldFunction.fieldFunction)(dom, form);
|
|
16600
17324
|
var object = newThing(dataDoc);
|
|
@@ -16655,12 +17379,12 @@ function makeDescription(dom, kb, subject, predicate, dataDoc, callbackFunction)
|
|
|
16655
17379
|
submit.disabled = true;
|
|
16656
17380
|
submit.setAttribute('style', 'visibility: hidden; float: right;'); // Keep UI clean
|
|
16657
17381
|
field.disabled = true;
|
|
16658
|
-
field.style.color =
|
|
17382
|
+
field.style.color = style.textInputColorPending; // setAttribute('style', style + 'color: gray;') // pending
|
|
16659
17383
|
var ds = kb.statementsMatching(subject, predicate, null, dataDoc);
|
|
16660
17384
|
var is = $rdf.st(subject, predicate, field.value, dataDoc);
|
|
16661
17385
|
kb.updater.update(ds, is, function (uri, ok, body) {
|
|
16662
17386
|
if (ok) {
|
|
16663
|
-
field.style.color =
|
|
17387
|
+
field.style.color = style.textInputColor;
|
|
16664
17388
|
field.disabled = false;
|
|
16665
17389
|
} else {
|
|
16666
17390
|
group.appendChild((0, _error.errorMessageBlock)(dom, 'Error (while saving change to ' + dataDoc.uri + '): ' + body));
|
|
@@ -16689,7 +17413,7 @@ function makeDescription(dom, kb, subject, predicate, dataDoc, callbackFunction)
|
|
|
16689
17413
|
field.addEventListener('change', saveChange, true);
|
|
16690
17414
|
} else {
|
|
16691
17415
|
field.disabled = true; // @@ change color too
|
|
16692
|
-
field.style.backgroundColor =
|
|
17416
|
+
field.style.backgroundColor = style.textInputBackgroundColorUneditable;
|
|
16693
17417
|
}
|
|
16694
17418
|
return group;
|
|
16695
17419
|
}
|
|
@@ -16814,7 +17538,7 @@ function makeSelectForClassifierOptions(dom, kb, subject, predicate, possible, o
|
|
|
16814
17538
|
});
|
|
16815
17539
|
};
|
|
16816
17540
|
var select = dom.createElement('select');
|
|
16817
|
-
select.setAttribute('style', style.
|
|
17541
|
+
select.setAttribute('style', style.formSelectSTyle);
|
|
16818
17542
|
if (options.multiple) select.setAttribute('multiple', 'true');
|
|
16819
17543
|
select.currentURI = null;
|
|
16820
17544
|
select.refresh = function () {
|
|
@@ -16957,7 +17681,7 @@ function makeSelectForOptions(dom, kb, subject, predicate, possible, options, da
|
|
|
16957
17681
|
});
|
|
16958
17682
|
};
|
|
16959
17683
|
var select = dom.createElement('select');
|
|
16960
|
-
select.setAttribute('style', style.
|
|
17684
|
+
select.setAttribute('style', style.formSelectSTyle);
|
|
16961
17685
|
select.currentURI = null;
|
|
16962
17686
|
select.refresh = function () {
|
|
16963
17687
|
actual = getActual(); // refresh
|
|
@@ -17243,7 +17967,7 @@ function makeSelectForChoice(dom, container, kb, subject, predicate, inputPossib
|
|
|
17243
17967
|
select.refresh();
|
|
17244
17968
|
};
|
|
17245
17969
|
var select = dom.createElement('select');
|
|
17246
|
-
select.setAttribute('style', style.
|
|
17970
|
+
select.setAttribute('style', style.formSelectSTyle);
|
|
17247
17971
|
select.setAttribute('id', 'formSelect');
|
|
17248
17972
|
select.currentURI = null;
|
|
17249
17973
|
for (var uri in optionsFromClassUIfrom) {
|
|
@@ -17490,7 +18214,14 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
17490
18214
|
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; }
|
|
17491
18215
|
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(_e) { throw _e; }, 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(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
17492
18216
|
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); }
|
|
17493
|
-
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; }
|
|
18217
|
+
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; } /* The Autocomplete Control with decorations
|
|
18218
|
+
|
|
18219
|
+
This control has the buttons which control the state between editing, viewing, searching, accepting
|
|
18220
|
+
and so on. See the state diagram in the documentation. The AUtocomplete Picker does the main work.
|
|
18221
|
+
|
|
18222
|
+
*/
|
|
18223
|
+
// dbpediaParameters
|
|
18224
|
+
|
|
17494
18225
|
var WEBID_NOUN = 'Solid ID';
|
|
17495
18226
|
var GREEN_PLUS = _iconBase.icons.iconBase + 'noun_34653_green.svg';
|
|
17496
18227
|
var SEARCH_ICON = _iconBase.icons.iconBase + 'noun_Search_875351.svg';
|
|
@@ -18028,7 +18759,6 @@ var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime
|
|
|
18028
18759
|
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
18029
18760
|
var debug = _interopRequireWildcard(__webpack_require__(/*! ../../../debug */ "./lib/debug.js"));
|
|
18030
18761
|
var style = _interopRequireWildcard(__webpack_require__(/*! ../../../style */ "./lib/style.js"));
|
|
18031
|
-
var _styleConstants = _interopRequireDefault(__webpack_require__(/*! ../../../styleConstants */ "./lib/styleConstants.js"));
|
|
18032
18762
|
var widgets = _interopRequireWildcard(__webpack_require__(/*! ../../../widgets */ "./lib/widgets/index.js"));
|
|
18033
18763
|
var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
|
|
18034
18764
|
var _publicData = __webpack_require__(/*! ./publicData */ "./lib/widgets/forms/autocomplete/publicData.js");
|
|
@@ -18037,7 +18767,11 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
18037
18767
|
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; }
|
|
18038
18768
|
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(_e) { throw _e; }, 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(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
18039
18769
|
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); }
|
|
18040
|
-
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; }
|
|
18770
|
+
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; } /* Autocomplete Picker: Create and edit data using public data
|
|
18771
|
+
**
|
|
18772
|
+
** As the data source is passed as a parameter, all kinds of APIa and query services can be used
|
|
18773
|
+
**
|
|
18774
|
+
*/
|
|
18041
18775
|
var AUTOCOMPLETE_THRESHOLD = 4; // don't check until this many characters typed
|
|
18042
18776
|
var AUTOCOMPLETE_ROWS = 20; // 20?
|
|
18043
18777
|
var AUTOCOMPLETE_ROWS_STRETCH = 40;
|
|
@@ -18137,7 +18871,8 @@ function _renderAutoComplete() {
|
|
|
18137
18871
|
};
|
|
18138
18872
|
}());
|
|
18139
18873
|
return row;
|
|
18140
|
-
};
|
|
18874
|
+
}; // console.log('@@ refreshList called')
|
|
18875
|
+
// rowForBinding
|
|
18141
18876
|
if (!inputEventHandlerLock) {
|
|
18142
18877
|
_context7.next = 5;
|
|
18143
18878
|
break;
|
|
@@ -18390,7 +19125,7 @@ function _renderAutoComplete() {
|
|
|
18390
19125
|
// errorMessageBlock will log the stack to the console
|
|
18391
19126
|
style.setStyle(errorRow, 'autocompleteRowStyle');
|
|
18392
19127
|
errorRow.style.padding = '1em';
|
|
18393
|
-
};
|
|
19128
|
+
}; // refreshList
|
|
18394
19129
|
// initialiize
|
|
18395
19130
|
// const queryParams: QueryParameters = acOptions.queryParams
|
|
18396
19131
|
targetClass = acOptions.targetClass;
|
|
@@ -18426,7 +19161,7 @@ function _renderAutoComplete() {
|
|
|
18426
19161
|
searchInput = cell.appendChild(dom.createElement('input'));
|
|
18427
19162
|
searchInput.setAttribute('type', 'text');
|
|
18428
19163
|
initialize();
|
|
18429
|
-
size = acOptions.size ||
|
|
19164
|
+
size = acOptions.size || style.textInputSize || 20;
|
|
18430
19165
|
searchInput.setAttribute('size', size);
|
|
18431
19166
|
searchInput.setAttribute('data-testid', 'autocomplete-input');
|
|
18432
19167
|
searchInputStyle = style.textInputStyle ||
|
|
@@ -18490,6 +19225,11 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
18490
19225
|
// import * as logic from '../index'
|
|
18491
19226
|
// import { authn } from '../../../authn/index'
|
|
18492
19227
|
|
|
19228
|
+
// import { Binding } from '../widgets/forms/autocomplete/publicData'
|
|
19229
|
+
// import { nativeNameForLanguageCode, englishNameForLanguageCode } from './nativeNameForLanguageCode'
|
|
19230
|
+
|
|
19231
|
+
// const { currentUser } = logic.authn
|
|
19232
|
+
|
|
18493
19233
|
var languageCodeURIBase = 'https://www.w3.org/ns/iana/language-code/'; /// @@ unsupported on the web (2021)
|
|
18494
19234
|
exports.languageCodeURIBase = languageCodeURIBase;
|
|
18495
19235
|
var defaultPreferredLanguages = ['en', 'fr', 'de', 'it', 'ar'];
|
|
@@ -19317,7 +20057,6 @@ function _getDbpediaDetails() {
|
|
|
19317
20057
|
"use strict";
|
|
19318
20058
|
|
|
19319
20059
|
|
|
19320
|
-
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
|
|
19321
20060
|
var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
|
|
19322
20061
|
Object.defineProperty(exports, "__esModule", ({
|
|
19323
20062
|
value: true
|
|
@@ -19330,7 +20069,6 @@ var _rdflib = __webpack_require__(/*! rdflib */ "./node_modules/rdflib/esm/index
|
|
|
19330
20069
|
var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
|
|
19331
20070
|
var ns = _interopRequireWildcard(__webpack_require__(/*! ../../ns */ "./lib/ns.js"));
|
|
19332
20071
|
var _style = __webpack_require__(/*! ../../style */ "./lib/style.js");
|
|
19333
|
-
var _styleConstants = _interopRequireDefault(__webpack_require__(/*! ../../styleConstants */ "./lib/styleConstants.js"));
|
|
19334
20072
|
var _utils = __webpack_require__(/*! ../../utils */ "./lib/utils/index.js");
|
|
19335
20073
|
var _error = __webpack_require__(/*! ../error */ "./lib/widgets/error.js");
|
|
19336
20074
|
var _fieldFunction = __webpack_require__(/*! ./fieldFunction */ "./lib/widgets/forms/fieldFunction.js");
|
|
@@ -19346,7 +20084,7 @@ function renderNameValuePair(dom, kb, box, form, label) {
|
|
|
19346
20084
|
box.style.display = 'flex';
|
|
19347
20085
|
box.style.flexDirection = 'row';
|
|
19348
20086
|
var lhs = box.appendChild(dom.createElement('div'));
|
|
19349
|
-
lhs.style.width =
|
|
20087
|
+
lhs.style.width = _style.formFieldNameBoxWidth;
|
|
19350
20088
|
var rhs = box.appendChild(dom.createElement('div'));
|
|
19351
20089
|
lhs.setAttribute('class', 'formFieldName');
|
|
19352
20090
|
lhs.setAttribute('style', _style.formFieldNameBoxStyle);
|
|
@@ -19451,7 +20189,7 @@ function basicField(dom, container, already, subject, form, doc, callbackFunctio
|
|
|
19451
20189
|
field.style = style;
|
|
19452
20190
|
rhs.appendChild(field);
|
|
19453
20191
|
field.setAttribute('type', params.type ? params.type : 'text');
|
|
19454
|
-
var size = kb.anyJS(form, ns.ui('size')) ||
|
|
20192
|
+
var size = kb.anyJS(form, ns.ui('size')) || _style.textInputSize || 20;
|
|
19455
20193
|
field.setAttribute('size', size);
|
|
19456
20194
|
var maxLength = kb.any(form, ns.ui('maxLength'));
|
|
19457
20195
|
field.setAttribute('maxLength', maxLength ? '' + maxLength : '4096');
|
|
@@ -19476,6 +20214,7 @@ function basicField(dom, container, already, subject, form, doc, callbackFunctio
|
|
|
19476
20214
|
field.readOnly = true // was: disabled. readOnly is better
|
|
19477
20215
|
;
|
|
19478
20216
|
field.style = _style.textInputStyleUneditable + paramStyle;
|
|
20217
|
+
// backgroundColor = textInputBackgroundColorUneditable
|
|
19479
20218
|
if (suppressEmptyUneditable && field.value === '') {
|
|
19480
20219
|
box.style.display = 'none'; // clutter
|
|
19481
20220
|
}
|
|
@@ -19716,10 +20455,10 @@ var fieldParams = (_fieldParams = {}, (0, _defineProperty2["default"])(_fieldPar
|
|
|
19716
20455
|
style: _style.formGroupStyle
|
|
19717
20456
|
}), (0, _defineProperty2["default"])(_fieldParams, ns.ui('Comment').uri, {
|
|
19718
20457
|
element: 'p',
|
|
19719
|
-
style: _style.commentStyle
|
|
20458
|
+
style: _style.commentStyle // was `padding: 0.1em 1.5em; color: ${formHeadingColor}; white-space: pre-wrap;`
|
|
19720
20459
|
}), (0, _defineProperty2["default"])(_fieldParams, ns.ui('Heading').uri, {
|
|
19721
20460
|
element: 'h3',
|
|
19722
|
-
style: _style.formHeadingStyle
|
|
20461
|
+
style: _style.formHeadingStyle // was: `font-size: 110%; font-weight: bold; color: ${formHeadingColor}; padding: 0.2em;`
|
|
19723
20462
|
}), _fieldParams);
|
|
19724
20463
|
exports.fieldParams = fieldParams;
|
|
19725
20464
|
//# sourceMappingURL=fieldParams.js.map
|
|
@@ -20601,6 +21340,17 @@ var _iconBase = __webpack_require__(/*! ../iconBase */ "./lib/iconBase.js");
|
|
|
20601
21340
|
var ns = _interopRequireWildcard(__webpack_require__(/*! ../ns */ "./lib/ns.js"));
|
|
20602
21341
|
var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
|
|
20603
21342
|
var _templateObject;
|
|
21343
|
+
/**
|
|
21344
|
+
*
|
|
21345
|
+
* People Picker Pane
|
|
21346
|
+
*
|
|
21347
|
+
* This pane offers a mechanism for selecting a set of individuals, groups, or
|
|
21348
|
+
* organizations to take some action on.
|
|
21349
|
+
*
|
|
21350
|
+
* Assumptions
|
|
21351
|
+
* - Assumes that the user has a type index entry for vcard:AddressBook. @@ bad assuption
|
|
21352
|
+
*
|
|
21353
|
+
*/
|
|
20604
21354
|
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); }
|
|
20605
21355
|
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; }
|
|
20606
21356
|
var kb = _solidLogic.solidLogicSingleton.store;
|