@checksub_team/peaks_timeline 1.4.48 → 1.4.50

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checksub_team/peaks_timeline",
3
- "version": "1.4.48",
3
+ "version": "1.4.50",
4
4
  "description": "JavaScript UI component for displaying audio waveforms",
5
5
  "main": "./peaks.js",
6
6
  "types": "./peaks.js.d.ts",
package/peaks.js CHANGED
@@ -16882,7 +16882,7 @@ module.exports = function (Utils) {
16882
16882
  indicators: this.indicators
16883
16883
  };
16884
16884
  Utils.extend(opts, options);
16885
- validateSegment(this._peaks, opts, 'update()');
16885
+ var shouldNotifyUpdate = validateSegment(this._peaks, opts, 'update()');
16886
16886
  this._startTime = opts.startTime;
16887
16887
  this._endTime = opts.endTime;
16888
16888
  this._labelText = opts.labelText;
@@ -16896,6 +16896,9 @@ module.exports = function (Utils) {
16896
16896
  this._line = opts.line;
16897
16897
  this._indicators = opts.indicators;
16898
16898
  this._peaks.emit('segment.updated', this);
16899
+ if (shouldNotifyUpdate) {
16900
+ this._peaks.emit('segments.updated', [this]);
16901
+ }
16899
16902
  };
16900
16903
  Segment.prototype.isVisible = function (startTime, endTime) {
16901
16904
  return this.startTime < endTime && startTime < this.endTime;
@@ -17461,6 +17464,7 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
17461
17464
  this._group.on('dragend', this._onSourceGroupDragEnd.bind(this));
17462
17465
  this._addWrap(true);
17463
17466
  this._addUnwrap(true);
17467
+ this._addTitle(true);
17464
17468
  this._addHandles(true);
17465
17469
  this.setWrapping(source.wrapped);
17466
17470
  }
@@ -17513,12 +17517,7 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
17513
17517
  this._width = newWidth;
17514
17518
  this._rightHandle.x(newWidth - HANDLE_WIDTH);
17515
17519
  this.updatePreviews();
17516
- var title = this._wrap.getChildren(function (node) {
17517
- return node.getClassName() === 'Text';
17518
- });
17519
- if (title) {
17520
- title.width(newWidth - 10);
17521
- }
17520
+ this._title.width(newWidth - 10);
17522
17521
  }
17523
17522
  };
17524
17523
  SourceGroup.prototype.setWrapping = function (wrap) {
@@ -17745,10 +17744,20 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
17745
17744
  }
17746
17745
  });
17747
17746
  }
17747
+ wrap.add(background);
17748
+ return wrap;
17749
+ };
17750
+ SourceGroup.prototype._addTitle = function (forceCreate) {
17751
+ if (!this._title || forceCreate) {
17752
+ this._title = this._createTitle();
17753
+ }
17754
+ this._group.add(this._title);
17755
+ };
17756
+ SourceGroup.prototype._createTitle = function () {
17748
17757
  var title = new Konva.Text({
17749
17758
  x: 5,
17759
+ y: 5,
17750
17760
  width: this._width - 10,
17751
- height: this._wrappedHeight,
17752
17761
  text: Utils.removeLineBreaks(this._source.title),
17753
17762
  textAlign: 'left',
17754
17763
  verticalAlign: 'middle',
@@ -17759,9 +17768,7 @@ module.exports = function (WaveformBuilder, WaveformShape, Utils, Konva) {
17759
17768
  ellipsis: true,
17760
17769
  listening: false
17761
17770
  });
17762
- wrap.add(background);
17763
- wrap.add(title);
17764
- return wrap;
17771
+ return title;
17765
17772
  };
17766
17773
  SourceGroup.prototype.getWidth = function () {
17767
17774
  return this._width;
@@ -18253,13 +18260,14 @@ module.exports = function (Utils) {
18253
18260
  options.wrapped = false;
18254
18261
  }
18255
18262
  }
18256
- function Source(peaks, id, originId, elementId, title, url, previewUrl, binaryUrl, kind, duration, startTime, endTime, mediaStartTime, mediaEndTime, color, borderColor, selectedColor, textColor, borderWidth, wrapped, position, draggable, resizable, wrapping, previewHeight, binaryHeight) {
18263
+ function Source(peaks, id, originId, elementId, title, url, previewUrl, binaryUrl, kind, subkind, duration, startTime, endTime, mediaStartTime, mediaEndTime, color, borderColor, selectedColor, textColor, borderWidth, wrapped, position, draggable, resizable, wrapping, previewHeight, binaryHeight) {
18257
18264
  var opts = {
18258
18265
  title: title,
18259
18266
  url: url,
18260
18267
  previewUrl: previewUrl,
18261
18268
  binaryUrl: binaryUrl,
18262
18269
  kind: kind,
18270
+ subkind: subkind,
18263
18271
  duration: duration,
18264
18272
  startTime: startTime,
18265
18273
  endTime: endTime,
@@ -18288,6 +18296,7 @@ module.exports = function (Utils) {
18288
18296
  this._previewUrl = opts.previewUrl;
18289
18297
  this._binaryUrl = opts.binaryUrl;
18290
18298
  this._kind = opts.kind;
18299
+ this._subkind = opts.subkind;
18291
18300
  this._duration = opts.duration;
18292
18301
  this._startTime = opts.startTime;
18293
18302
  this._endTime = opts.endTime;
@@ -18362,6 +18371,15 @@ module.exports = function (Utils) {
18362
18371
  this._kind = kind;
18363
18372
  }
18364
18373
  },
18374
+ subkind: {
18375
+ enumerable: true,
18376
+ get: function () {
18377
+ return this._subkind;
18378
+ },
18379
+ set: function (subkind) {
18380
+ this._subkind = subkind;
18381
+ }
18382
+ },
18365
18383
  duration: {
18366
18384
  enumerable: true,
18367
18385
  get: function () {
@@ -18604,6 +18622,7 @@ module.exports = function (Utils) {
18604
18622
  previewUrl: this.previewUrl,
18605
18623
  binaryUrl: this.binaryUrl,
18606
18624
  kind: this.kind,
18625
+ subkind: this.subkind,
18607
18626
  duration: this.duration,
18608
18627
  startTime: this.startTime,
18609
18628
  endTime: this.endTime,
@@ -18629,6 +18648,7 @@ module.exports = function (Utils) {
18629
18648
  this._previewUrl = opts.previewUrl;
18630
18649
  this._binaryUrl = opts.binaryUrl;
18631
18650
  this._kind = opts.kind;
18651
+ this._subkind = opts.subkind;
18632
18652
  this._duration = opts.duration;
18633
18653
  this._startTime = opts.startTime;
18634
18654
  this._endTime = opts.endTime;
@@ -19322,6 +19342,7 @@ module.exports = function (Source, Utils) {
19322
19342
  previewUrl: sourceToCut.previewUrl,
19323
19343
  binaryUrl: sourceToCut.binaryUrl,
19324
19344
  kind: sourceToCut.kind,
19345
+ subkind: sourceToCut.subkind,
19325
19346
  duration: sourceToCut.duration,
19326
19347
  startTime: sourceToCut.endTime,
19327
19348
  endTime: originalEndTime,
@@ -19353,7 +19374,7 @@ module.exports = function (Source, Utils) {
19353
19374
  if (!Utils.isObject(options)) {
19354
19375
  throw new TypeError('peaks.sources.add(): expected a Source object parameter');
19355
19376
  }
19356
- var source = new Source(this._peaks, options.id || this._getNextSourceId(), options.originId, options.elementId, options.title, options.url, options.previewUrl, options.binaryUrl, options.kind, options.duration, options.startTime, options.endTime, options.mediaStartTime, options.mediaEndTime, options.color, options.borderColor, options.selectedColor, options.textColor, options.borderWidth, options.wrapped, options.position, options.draggable, options.resizable, options.wrapping, options.previewHeight, options.binaryHeight);
19377
+ var source = new Source(this._peaks, options.id || this._getNextSourceId(), options.originId, options.elementId, options.title, options.url, options.previewUrl, options.binaryUrl, options.kind, options.subkind, options.duration, options.startTime, options.endTime, options.mediaStartTime, options.mediaEndTime, options.color, options.borderColor, options.selectedColor, options.textColor, options.borderWidth, options.wrapped, options.position, options.draggable, options.resizable, options.wrapping, options.previewHeight, options.binaryHeight);
19357
19378
  return source;
19358
19379
  };
19359
19380
  TimelineSources.prototype.getSources = function () {
package/src/segment.js CHANGED
@@ -250,7 +250,7 @@ define([
250
250
 
251
251
  Utils.extend(opts, options);
252
252
 
253
- validateSegment(this._peaks, opts, 'update()');
253
+ var shouldNotifyUpdate = validateSegment(this._peaks, opts, 'update()');
254
254
 
255
255
  this._startTime = opts.startTime;
256
256
  this._endTime = opts.endTime;
@@ -266,6 +266,10 @@ define([
266
266
  this._indicators = opts.indicators;
267
267
 
268
268
  this._peaks.emit('segment.updated', this);
269
+
270
+ if (shouldNotifyUpdate) {
271
+ this._peaks.emit('segments.updated', [this]);
272
+ }
269
273
  };
270
274
 
271
275
  /**
@@ -86,6 +86,7 @@ define([
86
86
 
87
87
  this._addWrap(true);
88
88
  this._addUnwrap(true);
89
+ this._addTitle(true);
89
90
  this._addHandles(true);
90
91
 
91
92
  this.setWrapping(source.wrapped);
@@ -205,13 +206,7 @@ define([
205
206
  this.updatePreviews();
206
207
 
207
208
  // update wrap
208
- var title = this._wrap.getChildren(function(node) {
209
- return node.getClassName() === 'Text';
210
- });
211
-
212
- if (title) {
213
- title.width(newWidth - 10);
214
- }
209
+ this._title.width(newWidth - 10);
215
210
  }
216
211
  };
217
212
 
@@ -498,10 +493,24 @@ define([
498
493
  });
499
494
  }
500
495
 
496
+ wrap.add(background);
497
+
498
+ return wrap;
499
+ };
500
+
501
+ SourceGroup.prototype._addTitle = function(forceCreate) {
502
+ if (!this._title || forceCreate) {
503
+ this._title = this._createTitle();
504
+ }
505
+
506
+ this._group.add(this._title);
507
+ };
508
+
509
+ SourceGroup.prototype._createTitle = function() {
501
510
  var title = new Konva.Text({
502
511
  x: 5,
512
+ y: 5,
503
513
  width: this._width - 10,
504
- height: this._wrappedHeight,
505
514
  text: Utils.removeLineBreaks(this._source.title),
506
515
  textAlign: 'left',
507
516
  verticalAlign: 'middle',
@@ -513,10 +522,7 @@ define([
513
522
  listening: false
514
523
  });
515
524
 
516
- wrap.add(background);
517
- wrap.add(title);
518
-
519
- return wrap;
525
+ return title;
520
526
  };
521
527
 
522
528
  SourceGroup.prototype.getWidth = function() {
package/src/source.js CHANGED
@@ -220,7 +220,7 @@ define([
220
220
  */
221
221
 
222
222
  function Source(peaks, id, originId, elementId, title, url, previewUrl, binaryUrl, kind,
223
- duration, startTime, endTime, mediaStartTime, mediaEndTime, color, borderColor,
223
+ subkind, duration, startTime, endTime, mediaStartTime, mediaEndTime, color, borderColor,
224
224
  selectedColor, textColor, borderWidth, wrapped, position, draggable, resizable, wrapping,
225
225
  previewHeight, binaryHeight) {
226
226
  var opts = {
@@ -229,6 +229,7 @@ define([
229
229
  previewUrl: previewUrl,
230
230
  binaryUrl: binaryUrl,
231
231
  kind: kind,
232
+ subkind: subkind,
232
233
  duration: duration,
233
234
  startTime: startTime,
234
235
  endTime: endTime,
@@ -259,6 +260,7 @@ define([
259
260
  this._previewUrl = opts.previewUrl;
260
261
  this._binaryUrl = opts.binaryUrl;
261
262
  this._kind = opts.kind;
263
+ this._subkind = opts.subkind;
262
264
  this._duration = opts.duration;
263
265
  this._startTime = opts.startTime;
264
266
  this._endTime = opts.endTime;
@@ -336,6 +338,16 @@ define([
336
338
  this._kind = kind;
337
339
  }
338
340
  },
341
+ subkind: {
342
+ enumerable: true,
343
+ get: function() {
344
+ return this._subkind;
345
+ },
346
+
347
+ set: function(subkind) {
348
+ this._subkind = subkind;
349
+ }
350
+ },
339
351
  duration: {
340
352
  enumerable: true,
341
353
  get: function() {
@@ -622,6 +634,7 @@ define([
622
634
  previewUrl: this.previewUrl,
623
635
  binaryUrl: this.binaryUrl,
624
636
  kind: this.kind,
637
+ subkind: this.subkind,
625
638
  duration: this.duration,
626
639
  startTime: this.startTime,
627
640
  endTime: this.endTime,
@@ -650,6 +663,7 @@ define([
650
663
  this._previewUrl = opts.previewUrl;
651
664
  this._binaryUrl = opts.binaryUrl;
652
665
  this._kind = opts.kind;
666
+ this._subkind = opts.subkind;
653
667
  this._duration = opts.duration;
654
668
  this._startTime = opts.startTime;
655
669
  this._endTime = opts.endTime;
@@ -71,6 +71,7 @@ define([
71
71
  previewUrl: sourceToCut.previewUrl,
72
72
  binaryUrl: sourceToCut.binaryUrl,
73
73
  kind: sourceToCut.kind,
74
+ subkind: sourceToCut.subkind,
74
75
  duration: sourceToCut.duration,
75
76
  startTime: sourceToCut.endTime,
76
77
  endTime: originalEndTime,
@@ -143,6 +144,7 @@ define([
143
144
  options.previewUrl,
144
145
  options.binaryUrl,
145
146
  options.kind,
147
+ options.subkind,
146
148
  options.duration,
147
149
  options.startTime,
148
150
  options.endTime,