@banta/sdk 3.2.2 → 3.3.0

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.
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('rxjs'), require('rxjs/operators'), require('@angular/core'), require('@angular/common'), require('@angular/platform-browser'), require('@angular/material/icon'), require('@angular/material/button'), require('@angular/material/form-field'), require('@angular/material/input'), require('@angular/forms'), require('subsink'), require('@angular/material/dialog'), require('@angular/material/menu'), require('@angular/material/progress-spinner'), require('@angular/cdk/text-field'), require('@angular/material/tooltip')) :
3
- typeof define === 'function' && define.amd ? define('@banta/sdk', ['exports', 'rxjs', 'rxjs/operators', '@angular/core', '@angular/common', '@angular/platform-browser', '@angular/material/icon', '@angular/material/button', '@angular/material/form-field', '@angular/material/input', '@angular/forms', 'subsink', '@angular/material/dialog', '@angular/material/menu', '@angular/material/progress-spinner', '@angular/cdk/text-field', '@angular/material/tooltip'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.banta = global.banta || {}, global.banta.sdk = {}), global.rxjs, global.rxjs.operators, global.ng.core, global.ng.common, global.ng.platformBrowser, global.ng.material.icon, global.ng.material.button, global.ng.material.formField, global.ng.material.input, global.ng.forms, global.subsink, global.ng.material.dialog, global.ng.material.menu, global.ng.material.progressSpinner, global.ng.cdk.textField, global.ng.material.tooltip));
5
- }(this, (function (exports, rxjs, operators, core, common, platformBrowser, icon, button, formField, input, forms, subsink, dialog, menu, progressSpinner, textField, tooltip) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('rxjs'), require('rxjs/operators'), require('@angular/core'), require('@angular/common'), require('@angular/platform-browser'), require('@angular/material/icon'), require('@angular/material/button'), require('@angular/material/form-field'), require('@angular/material/input'), require('@angular/forms'), require('@angular/material/dialog'), require('@angular/router'), require('@angular/material/menu'), require('@angular/material/progress-spinner'), require('@angular/cdk/text-field'), require('@angular/material/tooltip'), require('@banta/common'), require('@angular/material/select')) :
3
+ typeof define === 'function' && define.amd ? define('@banta/sdk', ['exports', 'rxjs', 'rxjs/operators', '@angular/core', '@angular/common', '@angular/platform-browser', '@angular/material/icon', '@angular/material/button', '@angular/material/form-field', '@angular/material/input', '@angular/forms', '@angular/material/dialog', '@angular/router', '@angular/material/menu', '@angular/material/progress-spinner', '@angular/cdk/text-field', '@angular/material/tooltip', '@banta/common', '@angular/material/select'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.banta = global.banta || {}, global.banta.sdk = {}), global.rxjs, global.rxjs.operators, global.ng.core, global.ng.common, global.ng.platformBrowser, global.ng.material.icon, global.ng.material.button, global.ng.material.formField, global.ng.material.input, global.ng.forms, global.ng.material.dialog, global.ng.router, global.ng.material.menu, global.ng.material.progressSpinner, global.ng.cdk.textField, global.ng.material.tooltip, global.common$1, global.ng.material.select));
5
+ }(this, (function (exports, rxjs, operators, core, common, platformBrowser, icon, button, formField, input, forms, dialog, router, menu, progressSpinner, textField, tooltip, common$1, select) { 'use strict';
6
6
 
7
7
  function lazyConnection(options) {
8
8
  var obs = new rxjs.Observable(function (observer) {
@@ -7219,7 +7219,7 @@
7219
7219
  this.banta = banta;
7220
7220
  this.backend = backend;
7221
7221
  this.matDialog = matDialog;
7222
- this._subs = new subsink.SubSink();
7222
+ this._subs = new rxjs.Subscription();
7223
7223
  this.auxOpen = false;
7224
7224
  this.auxTitle = 'Notifications';
7225
7225
  this.auxMode = 'notifications';
@@ -7235,7 +7235,9 @@
7235
7235
  }
7236
7236
  BantaComponent.prototype.ngOnInit = function () {
7237
7237
  var _this = this;
7238
- this._subs.add(this.banta.userChanged.subscribe(function (user) { return _this.currentUser = user; }), this.backend.notificationsChanged.subscribe(function (notifs) { return _this.notifications = notifs; }), this.backend.newNotification.subscribe(function (notif) {
7238
+ this._subs.add(this.banta.userChanged.subscribe(function (user) { return _this.currentUser = user; }));
7239
+ this._subs.add(this.backend.notificationsChanged.subscribe(function (notifs) { return _this.notifications = notifs; }));
7240
+ this._subs.add(this.backend.newNotification.subscribe(function (notif) {
7239
7241
  _this.newNotifications = true;
7240
7242
  }));
7241
7243
  };
@@ -7632,7 +7634,7 @@
7632
7634
  var ChatViewComponent = /** @class */ (function () {
7633
7635
  function ChatViewComponent(elementRef) {
7634
7636
  this.elementRef = elementRef;
7635
- this._sourceSubs = new subsink.SubSink();
7637
+ this._sourceSubs = new rxjs.Subscription();
7636
7638
  this._selected = new rxjs.Subject();
7637
7639
  this._reported = new rxjs.Subject();
7638
7640
  this._upvoted = new rxjs.Subject();
@@ -7653,15 +7655,14 @@
7653
7655
  this._source = value;
7654
7656
  this.messages = [];
7655
7657
  if (value) {
7656
- this._sourceSubs = new subsink.SubSink();
7658
+ this._sourceSubs = new rxjs.Subscription();
7657
7659
  this.messages = value.messages.slice();
7658
7660
  console.log("Source set:");
7659
7661
  console.dir(value);
7660
7662
  console.log("Messages loaded:");
7661
7663
  console.dir(this.messages);
7662
- this._sourceSubs.add(this._source.messageReceived
7663
- .subscribe(function (msg) { return _this.messageReceived(msg); }), this._source.messageSent
7664
- .subscribe(function (msg) { return _this.messageSent(msg); }));
7664
+ this._sourceSubs.add(this._source.messageReceived.subscribe(function (msg) { return _this.messageReceived(msg); }));
7665
+ this._sourceSubs.add(this._source.messageSent.subscribe(function (msg) { return _this.messageSent(msg); }));
7665
7666
  if (this._source.currentUserChanged) {
7666
7667
  this._sourceSubs.add(this._source.currentUserChanged
7667
7668
  .subscribe(function (user) { return _this.currentUser = user; }));
@@ -7805,7 +7806,7 @@
7805
7806
  this.banta = banta;
7806
7807
  this.backend = backend;
7807
7808
  this.elementRef = elementRef;
7808
- this._subs = new subsink.SubSink();
7809
+ this._subs = new rxjs.Subscription();
7809
7810
  this.user = null;
7810
7811
  this.signInLabel = 'Sign In';
7811
7812
  this.sendLabel = 'Send';
@@ -8115,7 +8116,10 @@
8115
8116
  this._reported = new rxjs.Subject();
8116
8117
  this._selected = new rxjs.Subject();
8117
8118
  this._upvoted = new rxjs.Subject();
8119
+ this._shared = new rxjs.Subject();
8118
8120
  this._userSelected = new rxjs.Subject();
8121
+ this._avatarSelected = new rxjs.Subject();
8122
+ this._usernameSelected = new rxjs.Subject();
8119
8123
  this.isNew = false;
8120
8124
  this.visible = false;
8121
8125
  this.showReplyAction = true;
@@ -8133,28 +8137,42 @@
8133
8137
  };
8134
8138
  Object.defineProperty(CommentComponent.prototype, "userSelected", {
8135
8139
  get: function () {
8136
- return this._userSelected;
8140
+ return this._userSelected.asObservable();
8141
+ },
8142
+ enumerable: false,
8143
+ configurable: true
8144
+ });
8145
+ Object.defineProperty(CommentComponent.prototype, "usernameSelected", {
8146
+ get: function () {
8147
+ return this._usernameSelected.asObservable();
8148
+ },
8149
+ enumerable: false,
8150
+ configurable: true
8151
+ });
8152
+ Object.defineProperty(CommentComponent.prototype, "avatarSelected", {
8153
+ get: function () {
8154
+ return this._avatarSelected.asObservable();
8137
8155
  },
8138
8156
  enumerable: false,
8139
8157
  configurable: true
8140
8158
  });
8141
8159
  Object.defineProperty(CommentComponent.prototype, "reported", {
8142
8160
  get: function () {
8143
- return this._reported;
8161
+ return this._reported.asObservable();
8144
8162
  },
8145
8163
  enumerable: false,
8146
8164
  configurable: true
8147
8165
  });
8148
8166
  Object.defineProperty(CommentComponent.prototype, "upvoted", {
8149
8167
  get: function () {
8150
- return this._upvoted;
8168
+ return this._upvoted.asObservable();
8151
8169
  },
8152
8170
  enumerable: false,
8153
8171
  configurable: true
8154
8172
  });
8155
8173
  Object.defineProperty(CommentComponent.prototype, "selected", {
8156
8174
  get: function () {
8157
- return this._selected;
8175
+ return this._selected.asObservable();
8158
8176
  },
8159
8177
  enumerable: false,
8160
8178
  configurable: true
@@ -8167,17 +8185,35 @@
8167
8185
  enumerable: false,
8168
8186
  configurable: true
8169
8187
  });
8188
+ Object.defineProperty(CommentComponent.prototype, "shared", {
8189
+ get: function () {
8190
+ return this._shared.asObservable();
8191
+ },
8192
+ enumerable: false,
8193
+ configurable: true
8194
+ });
8170
8195
  CommentComponent.prototype.report = function () {
8171
8196
  this._reported.next();
8172
8197
  };
8173
8198
  CommentComponent.prototype.upvote = function () {
8174
8199
  this._upvoted.next();
8175
8200
  };
8201
+ CommentComponent.prototype.share = function () {
8202
+ this._shared.next(this.message);
8203
+ };
8176
8204
  CommentComponent.prototype.select = function () {
8177
8205
  this._selected.next();
8178
8206
  };
8179
8207
  CommentComponent.prototype.selectUser = function () {
8180
- return this._userSelected.next();
8208
+ this._userSelected.next();
8209
+ };
8210
+ CommentComponent.prototype.selectUsername = function (user) {
8211
+ this._usernameSelected.next(user);
8212
+ this.selectUser();
8213
+ };
8214
+ CommentComponent.prototype.selectAvatar = function (user) {
8215
+ this._avatarSelected.next(user);
8216
+ this.selectUser();
8181
8217
  };
8182
8218
  CommentComponent.prototype.avatarForUser = function (user) {
8183
8219
  if (user && user.avatarUrl) {
@@ -8191,7 +8227,7 @@
8191
8227
  CommentComponent.decorators = [
8192
8228
  { type: core.Component, args: [{
8193
8229
  selector: 'banta-comment',
8194
- template: "\r\n<mat-menu #pointItemMenu=\"matMenu\">\r\n <button mat-menu-item (click)=\"report()\">Report</button>\r\n <button mat-menu-item>Help</button>\r\n</mat-menu>\r\n\r\n<div class=\"message-content\">\r\n <div class=\"user\">\r\n <a \r\n href=\"javascript:;\"\r\n class=\"avatar\"\r\n (click)=\"selectUser()\"\r\n [style.background-image]=\"avatarForUser(message.user)\"></a>\r\n <a href=\"javascript:;\" class=\"display-name\" (click)=\"selectUser()\">{{message.user.displayName}}</a>\r\n <a href=\"javascript:;\" class=\"username\" (click)=\"selectUser()\">@{{message.user.username}}</a>\r\n </div>\r\n <div class=\"content\">\r\n {{message.message}}\r\n </div>\r\n \r\n <div class=\"actions\">\r\n <banta-timestamp [value]=\"message.sentAt\"></banta-timestamp>\r\n <div class=\"spacer\"></div>\r\n <div class=\"counted-action\" *ngIf=\"showReplyAction\">\r\n <div class=\"count-indicator\">\r\n {{message.submessages?.length || 0}}\r\n </div>\r\n <button mat-icon-button matTooltip=\"Comment\" matTooltipPosition=\"below\" (click)=\"select()\">\r\n <mat-icon [inline]=\"true\">comment</mat-icon>\r\n </button>\r\n </div>\r\n <div class=\"counted-action\">\r\n <div class=\"count-indicator\"> \r\n {{message.upvotes}}\r\n </div>\r\n <button mat-icon-button matTooltip=\"Upvote\" matTooltipPosition=\"below\" (click)=\"upvote()\">\r\n <mat-icon [inline]=\"true\">thumb_up</mat-icon>\r\n </button>\r\n </div>\r\n \r\n <button mat-icon-button [matMenuTriggerFor]=\"pointItemMenu\">\r\n <mat-icon [inline]=\"true\">more_vert</mat-icon>\r\n </button>\r\n </div>\r\n</div>\r\n",
8230
+ template: "\r\n<mat-menu #pointItemMenu=\"matMenu\">\r\n <button mat-menu-item (click)=\"report()\">Report</button>\r\n <button mat-menu-item>Help</button>\r\n</mat-menu>\r\n\r\n<div class=\"message-content\">\r\n <div class=\"user\">\r\n <a\r\n href=\"javascript:;\"\r\n class=\"avatar\"\r\n (click)=\"selectAvatar(message.user)\"\r\n [style.background-image]=\"avatarForUser(message.user)\"></a>\r\n <a href=\"javascript:;\" class=\"display-name\" (click)=\"selectUser()\">{{message.user.displayName}}</a>\r\n <a href=\"javascript:;\" class=\"username\" (click)=\"selectUsername(message.user)\">@{{message.user.username}}</a>\r\n </div>\r\n <div class=\"content\">\r\n {{message.message}}\r\n </div>\r\n\r\n <div class=\"actions\">\r\n <banta-timestamp [value]=\"message.sentAt\"></banta-timestamp>\r\n <div class=\"spacer\"></div>\r\n <div class=\"counted-action\" *ngIf=\"showReplyAction\">\r\n <div class=\"count-indicator\">\r\n {{message.submessages?.length || 0}}\r\n </div>\r\n <button mat-icon-button matTooltip=\"Comment\" matTooltipPosition=\"below\" (click)=\"select()\">\r\n <mat-icon [inline]=\"true\">comment</mat-icon>\r\n </button>\r\n </div>\r\n <div class=\"counted-action\">\r\n <div class=\"count-indicator\">\r\n {{message.upvotes}}\r\n </div>\r\n <button mat-icon-button matTooltip=\"Upvote\" matTooltipPosition=\"below\" (click)=\"upvote()\">\r\n <mat-icon [inline]=\"true\">thumb_up</mat-icon>\r\n </button>\r\n </div>\r\n\r\n <div class=\"counted-action\">\r\n <button mat-icon-button matTooltip=\"Share this comment\" matTooltipPosition=\"below\" (click)=\"share()\">\r\n <mat-icon [inline]=\"true\" >share</mat-icon>\r\n </button>\r\n </div>\r\n\r\n <button mat-icon-button [matMenuTriggerFor]=\"pointItemMenu\">\r\n <mat-icon [inline]=\"true\">more_vert</mat-icon>\r\n </button>\r\n </div>\r\n</div>\r\n",
8195
8231
  styles: ["@-webkit-keyframes comment-appear{0%{transform:translate(100vw)}to{transform:translate(0)}}@keyframes comment-appear{0%{transform:translate(100vw)}to{transform:translate(0)}}:host{display:flex;flex-direction:column;padding:.5em;position:relative;visibility:hidden}:host.new{-webkit-animation-duration:.4s;-webkit-animation-fill-mode:both;-webkit-animation-name:comment-appear;animation-duration:.4s;animation-fill-mode:both;animation-name:comment-appear}:host.new,:host.visible{visibility:visible}:host:hover{background:#eee}:host .message-content .content{margin-left:60px;margin-right:.5em}:host.abbreviated .message-content .content{max-height:8.5em;overflow-y:hidden;text-overflow:ellipsis}:host .actions{align-items:center;display:flex;margin-left:60px;padding-right:10px}:host .actions button{color:#666}:host .actions banta-timestamp{color:#666;font-size:10pt}.user{align-items:center;display:flex;margin:1em 0 0;position:relative}.user .display-name,.user .username{color:#000;display:block;flex-grow:0;flex-shrink:1;font-size:10pt;margin:0 auto 0 0;max-width:100%;overflow:hidden;padding:0 0 0 1em;position:relative;text-overflow:ellipsis;white-space:nowrap;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;z-index:1}.user .display-name.username,.user .username.username{color:#666;flex-grow:1;flex-shrink:0}.avatar{background-color:#333;background-position:50%;background-size:cover;border-radius:100%;flex-grow:0;flex-shrink:0;height:48px;width:48px}.counted-action{align-items:center;display:flex}.count-indicator{color:#666;font-size:9pt;padding:0 0 0 3px}:host-context(.mat-dark-theme) .count-indicator{border-color:#333}:host-context(.mat-dark-theme):hover{background:#060606}:host-context(.mat-dark-theme) .user .display-name,:host-context(.mat-dark-theme) .user .username{color:#fff}@media (max-width:400px){.avatar{height:32px;width:32px}:host .actions{margin-left:44px}:host .message-content .content{margin-left:44px;margin-right:.5em}}"]
8196
8232
  },] }
8197
8233
  ];
@@ -8201,20 +8237,26 @@
8201
8237
  message: [{ type: core.Input }],
8202
8238
  showReplyAction: [{ type: core.Input }],
8203
8239
  userSelected: [{ type: core.Output }],
8240
+ usernameSelected: [{ type: core.Output }],
8241
+ avatarSelected: [{ type: core.Output }],
8204
8242
  reported: [{ type: core.Output }],
8205
8243
  upvoted: [{ type: core.Output }],
8206
8244
  selected: [{ type: core.Output }],
8207
- commentId: [{ type: core.HostBinding, args: ['attr.data-comment-id',] }]
8245
+ commentId: [{ type: core.HostBinding, args: ['attr.data-comment-id',] }],
8246
+ shared: [{ type: core.Output }]
8208
8247
  };
8209
8248
 
8210
8249
  var CommentViewComponent = /** @class */ (function () {
8211
8250
  function CommentViewComponent(backend) {
8212
8251
  this.backend = backend;
8213
- this._sourceSubs = new subsink.SubSink();
8252
+ this._sourceSubs = new rxjs.Subscription();
8214
8253
  this._selected = new rxjs.Subject();
8215
8254
  this._upvoted = new rxjs.Subject();
8216
8255
  this._reported = new rxjs.Subject();
8217
8256
  this._userSelected = new rxjs.Subject();
8257
+ this._usernameSelected = new rxjs.Subject();
8258
+ this._avatarSelected = new rxjs.Subject();
8259
+ this._shared = new rxjs.Subject();
8218
8260
  this.showEmptyState = true;
8219
8261
  this.allowReplies = true;
8220
8262
  this.menuMessage = null;
@@ -8256,6 +8298,27 @@
8256
8298
  enumerable: false,
8257
8299
  configurable: true
8258
8300
  });
8301
+ Object.defineProperty(CommentViewComponent.prototype, "usernameSelected", {
8302
+ get: function () {
8303
+ return this._usernameSelected;
8304
+ },
8305
+ enumerable: false,
8306
+ configurable: true
8307
+ });
8308
+ Object.defineProperty(CommentViewComponent.prototype, "avatarSelected", {
8309
+ get: function () {
8310
+ return this._avatarSelected;
8311
+ },
8312
+ enumerable: false,
8313
+ configurable: true
8314
+ });
8315
+ Object.defineProperty(CommentViewComponent.prototype, "shared", {
8316
+ get: function () {
8317
+ return this._shared;
8318
+ },
8319
+ enumerable: false,
8320
+ configurable: true
8321
+ });
8259
8322
  Object.defineProperty(CommentViewComponent.prototype, "source", {
8260
8323
  get: function () {
8261
8324
  return this._source;
@@ -8268,14 +8331,14 @@
8268
8331
  }
8269
8332
  this._source = value;
8270
8333
  if (value) {
8334
+ console.log("[banta-comment-view] Subscribing to source...");
8271
8335
  var messages = (value.messages || []).slice();
8272
8336
  this.messages = messages;
8273
8337
  this.olderMessages = messages.splice(this.maxVisibleMessages, messages.length);
8274
8338
  this.hasMore = this.olderMessages.length > 0;
8275
- this._sourceSubs = new subsink.SubSink();
8276
- this._sourceSubs.add(this._source.messageReceived
8277
- .subscribe(function (msg) { return _this.messageReceived(msg); }), this._source.messageSent
8278
- .subscribe(function (msg) { return _this.messageSent(msg); }));
8339
+ this._sourceSubs = new rxjs.Subscription();
8340
+ this._sourceSubs.add(this._source.messageReceived.subscribe(function (msg) { return _this.messageReceived(msg); }));
8341
+ this._sourceSubs.add(this._source.messageSent.subscribe(function (msg) { return _this.messageSent(msg); }));
8279
8342
  if (this._source.currentUserChanged) {
8280
8343
  this._sourceSubs.add(this._source.currentUserChanged.subscribe(function (user) { return _this.currentUser = user; }));
8281
8344
  }
@@ -8291,16 +8354,20 @@
8291
8354
  this._reported.next(message);
8292
8355
  };
8293
8356
  CommentViewComponent.prototype.selectMessage = function (message) {
8294
- return __awaiter(this, void 0, void 0, function () {
8295
- return __generator(this, function (_a) {
8296
- this._selected.next(message);
8297
- return [2 /*return*/];
8298
- });
8299
- });
8357
+ this._selected.next(message);
8300
8358
  };
8301
8359
  CommentViewComponent.prototype.selectMessageUser = function (message) {
8302
8360
  this._userSelected.next(message);
8303
8361
  };
8362
+ CommentViewComponent.prototype.selectUsername = function (user) {
8363
+ this._usernameSelected.next(user);
8364
+ };
8365
+ CommentViewComponent.prototype.selectAvatar = function (user) {
8366
+ this._avatarSelected.next(user);
8367
+ };
8368
+ CommentViewComponent.prototype.sharedMessage = function (message) {
8369
+ this._shared.next(message);
8370
+ };
8304
8371
  CommentViewComponent.prototype.messageIdentity = function (index, chatMessage) {
8305
8372
  return chatMessage.id;
8306
8373
  };
@@ -8412,7 +8479,7 @@
8412
8479
  CommentViewComponent.decorators = [
8413
8480
  { type: core.Component, args: [{
8414
8481
  selector: 'banta-comment-view',
8415
- template: "<div class=\"message-container\">\r\n <ng-content select=\"[data-before]\"></ng-content>\r\n \r\n <a mat-button class=\"nav\" [class.visible]=\"isViewingMore\" href=\"javascript:;\" (click)=\"showNew()\">\r\n <mat-icon>file_upload</mat-icon>\r\n New\r\n <ng-container *ngIf=\"newMessages.length >= 1\">\r\n ({{newMessages.length}})\r\n </ng-container>\r\n </a>\r\n\r\n <ng-container *ngIf=\"messages.length === 0\">\r\n <div class=\"empty-state\" *ngIf=\"showEmptyState\">\r\n Be the first to comment!\r\n </div>\r\n </ng-container>\r\n <banta-comment \r\n *ngFor=\"let message of messages; trackBy: messageIdentity\"\r\n class=\"abbreviated\"\r\n [message]=\"message\"\r\n (click)=\"isViewingMore = true\"\r\n [showReplyAction]=\"allowReplies\"\r\n (userSelected)=\"selectMessageUser(message)\"\r\n (upvoted)=\"upvoteMessage(message)\"\r\n (reported)=\"reportMessage(message)\"\r\n (selected)=\"selectMessage(message)\"\r\n ></banta-comment>\r\n\r\n <a mat-button class=\"nav\" [class.visible]=\"hasMore && !isLoadingMore\" href=\"javascript:;\" (click)=\"showMore()\">Show more</a>\r\n\r\n <div class=\"loading-more\" *ngIf=\"isLoadingMore\">\r\n <mat-spinner></mat-spinner>\r\n </div>\r\n\r\n <!-- <div style=\"color: #666\">\r\n n={{newMessages.length}}, m={{messages.length}}, o={{olderMessages.length}},\r\n v={{maxVisibleMessages}}, M={{maxMessages}}\r\n </div> -->\r\n\r\n <ng-content select=\":not([data-before])\"></ng-content>\r\n</div>",
8482
+ template: "<div class=\"message-container\">\r\n <ng-content select=\"[data-before]\"></ng-content>\r\n\r\n <a mat-button class=\"nav\" [class.visible]=\"isViewingMore\" href=\"javascript:;\" (click)=\"showNew()\">\r\n <mat-icon>file_upload</mat-icon>\r\n New\r\n <ng-container *ngIf=\"newMessages.length >= 1\">\r\n ({{newMessages.length}})\r\n </ng-container>\r\n </a>\r\n\r\n <ng-container *ngIf=\"messages.length === 0\">\r\n <div class=\"empty-state\" *ngIf=\"showEmptyState\">\r\n Be the first to comment!\r\n </div>\r\n </ng-container>\r\n <banta-comment\r\n *ngFor=\"let message of messages; trackBy: messageIdentity\"\r\n class=\"abbreviated\"\r\n [message]=\"message\"\r\n (click)=\"isViewingMore = true\"\r\n [showReplyAction]=\"allowReplies\"\r\n\t\t(userSelected)=\"selectMessageUser(message)\"\r\n (avatarSelected)=\"selectAvatar($event)\"\r\n\t\t(usernameSelected)=\"selectUsername($event)\"\r\n (upvoted)=\"upvoteMessage(message)\"\r\n (reported)=\"reportMessage(message)\"\r\n (selected)=\"selectMessage(message)\"\r\n (shared)=\"sharedMessage($event)\"\r\n ></banta-comment>\r\n\r\n <a mat-button class=\"nav\" [class.visible]=\"hasMore && !isLoadingMore\" href=\"javascript:;\" (click)=\"showMore()\">Show more</a>\r\n\r\n <div class=\"loading-more\" *ngIf=\"isLoadingMore\">\r\n <mat-spinner></mat-spinner>\r\n </div>\r\n\r\n <!-- <div style=\"color: #666\">\r\n n={{newMessages.length}}, m={{messages.length}}, o={{olderMessages.length}},\r\n v={{maxVisibleMessages}}, M={{maxMessages}}\r\n </div> -->\r\n\r\n <ng-content select=\":not([data-before])\"></ng-content>\r\n</div>\r\n",
8416
8483
  styles: [":host{display:flex;flex-direction:column;flex-grow:1;opacity:1;transition:opacity .2s ease-in}.message-container{background:#fff;color:#111;flex-grow:1;opacity:1;overflow-x:hidden;padding:.5em 1em 3em .5em;position:relative;transition:opacity .5s ease-in-out}.message-container.no-scroll{height:auto;overflow-y:visible}.message-container.faded{opacity:.25}.message-container .overlay{bottom:0;left:0;position:absolute;right:0;top:0;z-index:10}:host.fixed-height .message-container{overflow-y:auto}:host-context(.mat-dark-theme) .message-container{background:#111;color:#fff}.empty-state{color:#666;margin:3em;text-align:center}:host-context(.mat-dark-theme) .empty-state{color:#666}a.nav{background:#222;border-radius:2em;opacity:0;pointer-events:none;position:absolute;right:.5em;text-align:center;transition:opacity .4s ease-in-out;z-index:10}a.nav.visible{opacity:1;pointer-events:auto}.loading-more{margin:0 auto;padding:2em;text-align:center;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}@media (max-width:400px){.message-container{padding:0 0 3em}}"]
8417
8484
  },] }
8418
8485
  ];
@@ -8427,6 +8494,9 @@
8427
8494
  userSelected: [{ type: core.Output }],
8428
8495
  reported: [{ type: core.Output }],
8429
8496
  upvoted: [{ type: core.Output }],
8497
+ usernameSelected: [{ type: core.Output }],
8498
+ avatarSelected: [{ type: core.Output }],
8499
+ shared: [{ type: core.Output }],
8430
8500
  source: [{ type: core.Input }],
8431
8501
  genericAvatarUrl: [{ type: core.Input }],
8432
8502
  messageContainer: [{ type: core.ViewChild, args: ['messageContainer',] }],
@@ -8439,15 +8509,19 @@
8439
8509
  * Comments component
8440
8510
  */
8441
8511
  var BantaCommentsComponent = /** @class */ (function () {
8442
- function BantaCommentsComponent(banta, backend, elementRef) {
8512
+ function BantaCommentsComponent(banta, backend, elementRef, activatedRoute) {
8443
8513
  this.banta = banta;
8444
8514
  this.backend = backend;
8445
8515
  this.elementRef = elementRef;
8516
+ this.activatedRoute = activatedRoute;
8446
8517
  this._upvoted = new rxjs.Subject();
8447
8518
  this._reported = new rxjs.Subject();
8448
8519
  this._selected = new rxjs.Subject();
8449
8520
  this._userSelected = new rxjs.Subject();
8450
- this._subs = new subsink.SubSink();
8521
+ this._shared = new rxjs.Subject();
8522
+ this._usernameSelected = new rxjs.Subject();
8523
+ this._avatarSelected = new rxjs.Subject();
8524
+ this._subs = new rxjs.Subscription();
8451
8525
  this.hashtags = [
8452
8526
  { hashtag: 'error', description: 'Cause an error' },
8453
8527
  { hashtag: 'timeout', description: 'Cause a slow timeout error' },
@@ -8468,10 +8542,45 @@
8468
8542
  this.expandError = false;
8469
8543
  this.selectedMessageVisible = false;
8470
8544
  }
8545
+ Object.defineProperty(BantaCommentsComponent.prototype, "sortOrder", {
8546
+ get: function () {
8547
+ return this._sortOrder;
8548
+ },
8549
+ set: function (value) {
8550
+ var _this = this;
8551
+ if (this._sortOrder !== value) {
8552
+ this._sortOrder = value;
8553
+ setTimeout(function () {
8554
+ _this.setSourceFromTopicID(_this.topicID);
8555
+ });
8556
+ }
8557
+ },
8558
+ enumerable: false,
8559
+ configurable: true
8560
+ });
8471
8561
  BantaCommentsComponent.prototype.ngOnInit = function () {
8472
8562
  var _this = this;
8473
8563
  this._subs.add(this.banta.userChanged.subscribe(function (user) { return _this.user = user; }));
8474
8564
  };
8565
+ BantaCommentsComponent.prototype.ngAfterViewInit = function () {
8566
+ if (typeof window !== 'undefined')
8567
+ this.checkForSharedComment();
8568
+ };
8569
+ BantaCommentsComponent.prototype.scrollToComment = function (commentId) {
8570
+ setTimeout(function () {
8571
+ var comment = document.querySelectorAll("[data-comment-id=\"" + commentId + "\"]");
8572
+ console.log(comment);
8573
+ if (comment.length > 0) {
8574
+ // comment.item(0).scroll({behavior: 'smooth'});
8575
+ comment.item(0).scrollIntoView();
8576
+ }
8577
+ }, 1000);
8578
+ };
8579
+ BantaCommentsComponent.prototype.checkForSharedComment = function () {
8580
+ var commentID = this.activatedRoute.snapshot.queryParamMap.get('comment');
8581
+ if (commentID)
8582
+ this.scrollToComment(commentID);
8583
+ };
8475
8584
  BantaCommentsComponent.prototype.ngOnDestroy = function () {
8476
8585
  this._subs.unsubscribe();
8477
8586
  };
@@ -8487,33 +8596,44 @@
8487
8596
  });
8488
8597
  Object.defineProperty(BantaCommentsComponent.prototype, "topicID", {
8489
8598
  get: function () {
8490
- return this._source.identifier;
8599
+ return this._topicID;
8491
8600
  },
8492
8601
  set: function (value) {
8493
- this.setSourceFromTopicID(value);
8602
+ var _this = this;
8603
+ if (this._topicID !== value) {
8604
+ this._topicID = value;
8605
+ setTimeout(function () { return _this.setSourceFromTopicID(value); });
8606
+ }
8494
8607
  },
8495
8608
  enumerable: false,
8496
8609
  configurable: true
8497
8610
  });
8498
8611
  BantaCommentsComponent.prototype.setSourceFromTopicID = function (topicID) {
8612
+ var _a, _b;
8499
8613
  return __awaiter(this, void 0, void 0, function () {
8500
- var _b;
8501
8614
  var _this = this;
8502
8615
  return __generator(this, function (_c) {
8503
- switch (_c.label) {
8504
- case 0:
8505
- if (this._source && this._source.close)
8506
- this._source.close();
8507
- this._source = null;
8508
- _b = this;
8509
- return [4 /*yield*/, this.backend.getSourceForTopic(topicID)];
8510
- case 1:
8511
- _b._source = _c.sent();
8512
- this._source.messageReceived.subscribe(function (m) { return _this.addParticipant(m); });
8513
- this._source.messageSent.subscribe(function (m) { return _this.addParticipant(m); });
8514
- this._source.messages.forEach(function (m) { return _this.addParticipant(m); });
8515
- return [2 /*return*/];
8516
- }
8616
+ (_b = (_a = this._source) === null || _a === void 0 ? void 0 : _a.close) === null || _b === void 0 ? void 0 : _b.call(_a);
8617
+ this._source = null;
8618
+ setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {
8619
+ var _c;
8620
+ var _this = this;
8621
+ return __generator(this, function (_d) {
8622
+ switch (_d.label) {
8623
+ case 0:
8624
+ _c = this;
8625
+ return [4 /*yield*/, this.backend.getSourceForTopic(topicID, { sortOrder: this.sortOrder })];
8626
+ case 1:
8627
+ _c._source = _d.sent();
8628
+ console.log("[banta-comments] Subscribing to source for topic '" + topicID + "'");
8629
+ this._source.messageReceived.subscribe(function (m) { return _this.addParticipant(m); });
8630
+ this._source.messageSent.subscribe(function (m) { return _this.addParticipant(m); });
8631
+ this._source.messages.forEach(function (m) { return _this.addParticipant(m); });
8632
+ return [2 /*return*/];
8633
+ }
8634
+ });
8635
+ }); });
8636
+ return [2 /*return*/];
8517
8637
  });
8518
8638
  });
8519
8639
  };
@@ -8584,28 +8704,49 @@
8584
8704
  });
8585
8705
  Object.defineProperty(BantaCommentsComponent.prototype, "upvoted", {
8586
8706
  get: function () {
8587
- return this._upvoted;
8707
+ return this._upvoted.asObservable();
8588
8708
  },
8589
8709
  enumerable: false,
8590
8710
  configurable: true
8591
8711
  });
8592
8712
  Object.defineProperty(BantaCommentsComponent.prototype, "reported", {
8593
8713
  get: function () {
8594
- return this._reported;
8714
+ return this._reported.asObservable();
8595
8715
  },
8596
8716
  enumerable: false,
8597
8717
  configurable: true
8598
8718
  });
8599
8719
  Object.defineProperty(BantaCommentsComponent.prototype, "selected", {
8600
8720
  get: function () {
8601
- return this._selected;
8721
+ return this._selected.asObservable();
8602
8722
  },
8603
8723
  enumerable: false,
8604
8724
  configurable: true
8605
8725
  });
8606
8726
  Object.defineProperty(BantaCommentsComponent.prototype, "userSelected", {
8607
8727
  get: function () {
8608
- return this._userSelected;
8728
+ return this._userSelected.asObservable();
8729
+ },
8730
+ enumerable: false,
8731
+ configurable: true
8732
+ });
8733
+ Object.defineProperty(BantaCommentsComponent.prototype, "usernameSelected", {
8734
+ get: function () {
8735
+ return this._usernameSelected.asObservable();
8736
+ },
8737
+ enumerable: false,
8738
+ configurable: true
8739
+ });
8740
+ Object.defineProperty(BantaCommentsComponent.prototype, "avatarSelected", {
8741
+ get: function () {
8742
+ return this._avatarSelected.asObservable();
8743
+ },
8744
+ enumerable: false,
8745
+ configurable: true
8746
+ });
8747
+ Object.defineProperty(BantaCommentsComponent.prototype, "shared", {
8748
+ get: function () {
8749
+ return this._shared.asObservable();
8609
8750
  },
8610
8751
  enumerable: false,
8611
8752
  configurable: true
@@ -8632,13 +8773,13 @@
8632
8773
  };
8633
8774
  BantaCommentsComponent.prototype.upvoteMessage = function (message) {
8634
8775
  return __awaiter(this, void 0, void 0, function () {
8635
- return __generator(this, function (_b) {
8636
- switch (_b.label) {
8776
+ return __generator(this, function (_c) {
8777
+ switch (_c.label) {
8637
8778
  case 0:
8638
8779
  this._upvoted.next(message);
8639
8780
  return [4 /*yield*/, this.backend.upvoteMessage(message.topicId, message.parentMessageId ? message.parentMessageId : message.id, message.parentMessageId ? message.id : undefined)];
8640
8781
  case 1:
8641
- _b.sent();
8782
+ _c.sent();
8642
8783
  return [2 /*return*/];
8643
8784
  }
8644
8785
  });
@@ -8651,7 +8792,7 @@
8651
8792
  return __awaiter(this, void 0, void 0, function () {
8652
8793
  var message;
8653
8794
  var _this = this;
8654
- return __generator(this, function (_b) {
8795
+ return __generator(this, function (_c) {
8655
8796
  message = this.selectedMessage;
8656
8797
  this._selected.next(null);
8657
8798
  this.selectedMessage = null;
@@ -8669,19 +8810,19 @@
8669
8810
  BantaCommentsComponent.prototype.selectMessage = function (message) {
8670
8811
  return __awaiter(this, void 0, void 0, function () {
8671
8812
  var _this = this;
8672
- return __generator(this, function (_b) {
8813
+ return __generator(this, function (_c) {
8673
8814
  this._selected.next(message);
8674
8815
  this.selectedMessage = message;
8675
8816
  setTimeout(function () { return _this.selectedMessageVisible = true; });
8676
8817
  setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {
8677
- var _b;
8678
- return __generator(this, function (_c) {
8679
- switch (_c.label) {
8818
+ var _c;
8819
+ return __generator(this, function (_d) {
8820
+ switch (_d.label) {
8680
8821
  case 0:
8681
- _b = this;
8822
+ _c = this;
8682
8823
  return [4 /*yield*/, this.backend.getSourceForThread(this.topicID, message.id)];
8683
8824
  case 1:
8684
- _b.selectedMessageThread = _c.sent();
8825
+ _c.selectedMessageThread = _d.sent();
8685
8826
  return [2 /*return*/];
8686
8827
  }
8687
8828
  });
@@ -8693,10 +8834,19 @@
8693
8834
  BantaCommentsComponent.prototype.selectMessageUser = function (message) {
8694
8835
  this._userSelected.next(message);
8695
8836
  };
8837
+ BantaCommentsComponent.prototype.selectUsername = function (user) {
8838
+ this._usernameSelected.next(user);
8839
+ };
8840
+ BantaCommentsComponent.prototype.selectAvatar = function (user) {
8841
+ this._avatarSelected.next(user);
8842
+ };
8843
+ BantaCommentsComponent.prototype.shareMessage = function (message) {
8844
+ this._shared.next(message);
8845
+ };
8696
8846
  BantaCommentsComponent.prototype.sendReply = function () {
8697
8847
  return __awaiter(this, void 0, void 0, function () {
8698
- return __generator(this, function (_b) {
8699
- switch (_b.label) {
8848
+ return __generator(this, function (_c) {
8849
+ switch (_c.label) {
8700
8850
  case 0: return [4 /*yield*/, this.selectedMessageThread.send({
8701
8851
  message: this.replyMessage,
8702
8852
  parentMessageId: this.selectedMessage.id,
@@ -8708,7 +8858,7 @@
8708
8858
  updatedAt: Date.now()
8709
8859
  })];
8710
8860
  case 1:
8711
- _b.sent();
8861
+ _c.sent();
8712
8862
  this.replyMessage = '';
8713
8863
  return [2 /*return*/];
8714
8864
  }
@@ -8726,14 +8876,15 @@
8726
8876
  BantaCommentsComponent.decorators = [
8727
8877
  { type: core.Component, args: [{
8728
8878
  selector: 'banta-comments',
8729
- template: "\r\n<div class=\"focused\" [class.visible]=\"selectedMessageVisible\" *ngIf=\"selectedMessage\">\r\n\r\n <div>\r\n <a mat-button href=\"javascript:;\" (click)=\"unselectMessage()\">\r\n <mat-icon>arrow_back</mat-icon>\r\n Latest Comments\r\n </a>\r\n </div>\r\n\r\n <banta-comment \r\n [message]=\"selectedMessage\"\r\n ></banta-comment>\r\n\r\n <div class=\"replies\">\r\n\r\n <ng-container *ngIf=\"!selectedMessageThread\">\r\n <div class=\"loading\">\r\n <mat-spinner></mat-spinner>\r\n </div>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"selectedMessageThread\">\r\n <banta-comment-view \r\n [source]=\"selectedMessageThread\"\r\n [allowReplies]=\"false\"\r\n [fixedHeight]=\"false\"\r\n [showEmptyState]=\"false\"\r\n [newestLast]=\"true\"\r\n ></banta-comment-view>\r\n\r\n <banta-comment-field\r\n [sendLabel]=\"replyLabel\"\r\n [sendingLabel]=\"sendingLabel\"\r\n [hashtags]=\"hashtags\"\r\n [participants]=\"participants\"\r\n (signInSelected)=\"showSignIn()\"\r\n (editAvatarSelected)=\"showEditAvatar()\"\r\n [source]=\"selectedMessageThread\"\r\n [canComment]=\"canComment\"\r\n [signInLabel]=\"signInLabel\"\r\n [permissionDeniedLabel]=\"permissionDeniedLabel\"\r\n (permissionDeniedError)=\"showPermissionDenied()\"\r\n [user]=\"user\"\r\n [label]=\"postReplyLabel\"\r\n ></banta-comment-field>\r\n </ng-container>\r\n </div>\r\n</div>\r\n\r\n<div class=\"main\" [class.hidden]=\"selectedMessage\">\r\n <banta-comment-field\r\n [source]=\"source\"\r\n [user]=\"user\"\r\n [sendLabel]=\"sendLabel\"\r\n [sendingLabel]=\"sendingLabel\"\r\n [signInLabel]=\"signInLabel\"\r\n [canComment]=\"canComment\"\r\n [hashtags]=\"hashtags\"\r\n [participants]=\"participants\"\r\n [label]=\"postCommentLabel\"\r\n (editAvatarSelected)=\"showEditAvatar()\"\r\n (signInSelected)=\"showSignIn()\"\r\n [permissionDeniedLabel]=\"permissionDeniedLabel\"\r\n (permissionDeniedError)=\"showPermissionDenied()\"\r\n ></banta-comment-field>\r\n\r\n <banta-comment-view \r\n [class.faded]=\"selectedMessage\"\r\n [source]=\"source\"\r\n [fixedHeight]=\"fixedHeight\"\r\n [maxMessages]=\"maxMessages\"\r\n [maxVisibleMessages]=\"maxVisibleMessages\"\r\n [genericAvatarUrl]=\"genericAvatarUrl\"\r\n (userSelected)=\"selectMessageUser($event)\"\r\n (selected)=\"selectMessage($event)\"\r\n (upvoted)=\"upvoteMessage($event)\"\r\n (reported)=\"reportMessage($event)\"\r\n ></banta-comment-view>\r\n</div>",
8879
+ template: "\r\n<div class=\"focused\" [class.visible]=\"selectedMessageVisible\" *ngIf=\"selectedMessage\">\r\n\r\n <div>\r\n <a mat-button href=\"javascript:;\" (click)=\"unselectMessage()\">\r\n <mat-icon>arrow_back</mat-icon>\r\n Latest Comments\r\n </a>\r\n </div>\r\n\r\n <banta-comment\r\n [message]=\"selectedMessage\"\r\n ></banta-comment>\r\n\r\n <div class=\"replies\">\r\n\r\n <ng-container *ngIf=\"!selectedMessageThread\">\r\n <div class=\"loading\">\r\n <mat-spinner></mat-spinner>\r\n </div>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"selectedMessageThread\">\r\n <banta-comment-view\r\n [source]=\"selectedMessageThread\"\r\n [allowReplies]=\"false\"\r\n [fixedHeight]=\"false\"\r\n [showEmptyState]=\"false\"\r\n [newestLast]=\"true\"\r\n ></banta-comment-view>\r\n\r\n <banta-comment-field\r\n [sendLabel]=\"replyLabel\"\r\n [sendingLabel]=\"sendingLabel\"\r\n [hashtags]=\"hashtags\"\r\n [participants]=\"participants\"\r\n (signInSelected)=\"showSignIn()\"\r\n (editAvatarSelected)=\"showEditAvatar()\"\r\n [source]=\"selectedMessageThread\"\r\n [canComment]=\"canComment\"\r\n [signInLabel]=\"signInLabel\"\r\n [permissionDeniedLabel]=\"permissionDeniedLabel\"\r\n (permissionDeniedError)=\"showPermissionDenied()\"\r\n [user]=\"user\"\r\n [label]=\"postReplyLabel\"\r\n ></banta-comment-field>\r\n </ng-container>\r\n </div>\r\n</div>\r\n\r\n<div class=\"main\" [class.hidden]=\"selectedMessage\">\r\n <banta-comment-field\r\n [source]=\"source\"\r\n [user]=\"user\"\r\n [sendLabel]=\"sendLabel\"\r\n [sendingLabel]=\"sendingLabel\"\r\n [signInLabel]=\"signInLabel\"\r\n [canComment]=\"canComment\"\r\n [hashtags]=\"hashtags\"\r\n [participants]=\"participants\"\r\n [label]=\"postCommentLabel\"\r\n (editAvatarSelected)=\"showEditAvatar()\"\r\n (signInSelected)=\"showSignIn()\"\r\n [permissionDeniedLabel]=\"permissionDeniedLabel\"\r\n (permissionDeniedError)=\"showPermissionDenied()\"\r\n ></banta-comment-field>\r\n\r\n <banta-comment-sort\r\n [(sort)]=\"sortOrder\"></banta-comment-sort>\r\n\r\n <banta-comment-view\r\n [class.faded]=\"selectedMessage\"\r\n [source]=\"source\"\r\n [fixedHeight]=\"fixedHeight\"\r\n [maxMessages]=\"maxMessages\"\r\n [maxVisibleMessages]=\"maxVisibleMessages\"\r\n [genericAvatarUrl]=\"genericAvatarUrl\"\r\n (userSelected)=\"selectMessageUser($event)\"\r\n (selected)=\"selectMessage($event)\"\r\n (upvoted)=\"upvoteMessage($event)\"\r\n (reported)=\"reportMessage($event)\"\r\n (usernameSelected)=\"selectUsername($event)\"\r\n (avatarSelected)=\"selectAvatar($event)\"\r\n (shared)=\"shareMessage($event)\"\r\n ></banta-comment-view>\r\n</div>\r\n",
8730
8880
  styles: [":host{display:flex;flex-direction:column}@-webkit-keyframes select-comment{0%{transform:scale(1.15)}to{transform:scale(1)}}@keyframes select-comment{0%{transform:scale(1.15)}to{transform:scale(1)}}.focused{-webkit-animation-duration:.4s;-webkit-animation-fill-mode:both;-webkit-animation-name:select-comment;animation-duration:.4s;animation-fill-mode:both;animation-name:select-comment}.focused .replies{margin-left:4em;margin-top:1em}banta-comment-view{opacity:1;transition:opacity .4s ease-in-out}banta-comment-view.faded{opacity:.25}.loading{display:block;margin:0 auto;min-height:16em;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}.main.hidden{display:none}@media (max-width:500px){.focused .replies{margin-left:0}}"]
8731
8881
  },] }
8732
8882
  ];
8733
8883
  BantaCommentsComponent.ctorParameters = function () { return [
8734
8884
  { type: BantaService },
8735
8885
  { type: ChatBackendService },
8736
- { type: core.ElementRef }
8886
+ { type: core.ElementRef },
8887
+ { type: router.ActivatedRoute }
8737
8888
  ]; };
8738
8889
  BantaCommentsComponent.propDecorators = {
8739
8890
  hashtags: [{ type: core.Input }],
@@ -8757,7 +8908,10 @@
8757
8908
  upvoted: [{ type: core.Output }],
8758
8909
  reported: [{ type: core.Output }],
8759
8910
  selected: [{ type: core.Output }],
8760
- userSelected: [{ type: core.Output }]
8911
+ userSelected: [{ type: core.Output }],
8912
+ usernameSelected: [{ type: core.Output }],
8913
+ avatarSelected: [{ type: core.Output }],
8914
+ shared: [{ type: core.Output }]
8761
8915
  };
8762
8916
 
8763
8917
  var LiveCommentComponent = /** @class */ (function () {
@@ -9118,12 +9272,54 @@
9118
9272
  permissionDeniedError: [{ type: core.Output }]
9119
9273
  };
9120
9274
 
9275
+ var CommentSortComponent = /** @class */ (function () {
9276
+ function CommentSortComponent() {
9277
+ this.commentsOrder = common$1.CommentsOrder;
9278
+ this._sortChange = new rxjs.Subject();
9279
+ this._sort = common$1.CommentsOrder.LIKES;
9280
+ }
9281
+ Object.defineProperty(CommentSortComponent.prototype, "sort", {
9282
+ get: function () {
9283
+ return this._sort;
9284
+ },
9285
+ set: function (value) {
9286
+ var _this = this;
9287
+ if (this._sort !== value) {
9288
+ this._sort = value;
9289
+ setTimeout(function () { return _this._sortChange.next(value); });
9290
+ }
9291
+ },
9292
+ enumerable: false,
9293
+ configurable: true
9294
+ });
9295
+ Object.defineProperty(CommentSortComponent.prototype, "sortChange", {
9296
+ get: function () {
9297
+ return this._sortChange.asObservable();
9298
+ },
9299
+ enumerable: false,
9300
+ configurable: true
9301
+ });
9302
+ return CommentSortComponent;
9303
+ }());
9304
+ CommentSortComponent.decorators = [
9305
+ { type: core.Component, args: [{
9306
+ selector: 'banta-comment-sort',
9307
+ template: "<div class=\"sort-row\">\r\n <mat-form-field>\r\n <mat-label>Sort by</mat-label>\r\n <mat-select [(value)]=\"sort\" >\r\n <mat-option [value]=\"commentsOrder.NEWEST\">Newest</mat-option>\r\n <mat-option [value]=\"commentsOrder.OLDEST\">Oldest</mat-option>\r\n <mat-option [value]=\"commentsOrder.LIKES\">Likes</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n</div>\r\n",
9308
+ styles: [".sort-row{display:flex;justify-content:end;padding-right:3em}"]
9309
+ },] }
9310
+ ];
9311
+ CommentSortComponent.propDecorators = {
9312
+ sort: [{ type: core.Input }],
9313
+ sortChange: [{ type: core.Output }]
9314
+ };
9315
+
9121
9316
  var COMPONENTS$3 = [
9122
9317
  CommentComponent,
9123
9318
  CommentViewComponent,
9124
9319
  BantaCommentsComponent,
9125
9320
  LiveCommentComponent,
9126
- CommentFieldComponent
9321
+ CommentFieldComponent,
9322
+ CommentSortComponent
9127
9323
  ];
9128
9324
  var CommentsModule = /** @class */ (function () {
9129
9325
  function CommentsModule() {
@@ -9144,7 +9340,9 @@
9144
9340
  menu.MatMenuModule,
9145
9341
  progressSpinner.MatProgressSpinnerModule,
9146
9342
  BantaCommonModule,
9147
- EmojiModule
9343
+ EmojiModule,
9344
+ tooltip.MatTooltipModule,
9345
+ select.MatSelectModule
9148
9346
  ],
9149
9347
  exports: COMPONENTS$3
9150
9348
  },] }