@linker-design-plus/timeline-track 2.0.6 → 2.0.7

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/index.es.js CHANGED
@@ -52,7 +52,7 @@ const Pe = {
52
52
  mode: "auto-first-added-video",
53
53
  width: 16,
54
54
  height: 9
55
- }, lh = [
55
+ }, hh = [
56
56
  {
57
57
  key: "default",
58
58
  label: "默认",
@@ -92,7 +92,7 @@ function Ye(a) {
92
92
  height: typeof (a == null ? void 0 : a.height) == "number" && a.height > 0 ? a.height : Pe.height
93
93
  };
94
94
  }
95
- const hh = {
95
+ const ch = {
96
96
  DEFAULT: 1,
97
97
  // 默认层级
98
98
  ACTIVE: 2
@@ -108,7 +108,7 @@ const hh = {
108
108
  // 动画持续时间(毫秒)
109
109
  EASING: "easeOutCubic"
110
110
  // 缓动函数
111
- }, ch = {
111
+ }, dh = {
112
112
  DEFAULT_HEIGHT: 40,
113
113
  // 默认时间刻度高度
114
114
  MIN_HEIGHT: 20,
@@ -8808,7 +8808,7 @@ function At(a) {
8808
8808
  function Et(a) {
8809
8809
  typeof window < "u" && (window.removeEventListener("mousemove", a.onPointerMove), window.removeEventListener("mouseup", a.onPointerEnd), window.removeEventListener("blur", a.onWindowBlur || a.onPointerEnd)), typeof document < "u" && document.removeEventListener("visibilitychange", a.onVisibilityChange);
8810
8810
  }
8811
- class dh {
8811
+ class uh {
8812
8812
  constructor(e, t, i, n, s, r) {
8813
8813
  g(this, "stage");
8814
8814
  g(this, "gridLayer");
@@ -10588,7 +10588,7 @@ const Se = class Se {
10588
10588
  };
10589
10589
  g(Se, "DEFAULT_DRAG_ACTIVATION_THRESHOLD", 4), g(Se, "DEFAULT_CLIP_SNAP_THRESHOLD", 8), g(Se, "AUTO_SCROLL_EDGE_THRESHOLD", 48), g(Se, "AUTO_SCROLL_MAX_SPEED", 18);
10590
10590
  let Mi = Se;
10591
- class uh {
10591
+ class gh {
10592
10592
  constructor(e, t, i, n, s, r) {
10593
10593
  g(this, "layer");
10594
10594
  g(this, "playheadGroup");
@@ -13170,17 +13170,18 @@ class Bl {
13170
13170
  };
13171
13171
  }
13172
13172
  }
13173
- const Gl = 8e3;
13174
- class Hl {
13173
+ const Gl = 8e3, Hl = 1e3;
13174
+ class Nl {
13175
13175
  constructor(e) {
13176
13176
  g(this, "callbacks");
13177
13177
  g(this, "pendingTimeoutMs");
13178
+ g(this, "failedOverlayDelayMs");
13178
13179
  g(this, "_previewSourceLoadingCount", 0);
13179
13180
  g(this, "_previewBuffering", !1);
13180
13181
  g(this, "_previewAwaitingMedia", !1);
13181
13182
  g(this, "_pendingPreviewState", null);
13182
13183
  g(this, "_nextPendingPreviewSyncRequestId", 0);
13183
- this.callbacks = e.callbacks, this.pendingTimeoutMs = e.pendingTimeoutMs ?? Gl;
13184
+ this.callbacks = e.callbacks, this.pendingTimeoutMs = e.pendingTimeoutMs ?? Gl, this.failedOverlayDelayMs = e.failedOverlayDelayMs ?? Hl;
13184
13185
  }
13185
13186
  get previewSourceLoadingCount() {
13186
13187
  return this._previewSourceLoadingCount;
@@ -13214,7 +13215,7 @@ class Hl {
13214
13215
  }
13215
13216
  handleRuntimeStateChange(e) {
13216
13217
  const t = Math.max(0, e.loadingCount), i = this._previewBuffering !== e.isBuffering, n = this._previewSourceLoadingCount !== t;
13217
- this._previewAwaitingMedia = e.phase === "awaiting-media", this._previewBuffering = e.isBuffering, this._previewSourceLoadingCount = t, this._pendingPreviewState && e.syncRequestId === this._pendingPreviewState.syncRequestId && ((e.phase === "awaiting-media" || e.phase === "ready" || e.phase === "failed") && (this._pendingPreviewState.awaitingSync = !1), e.phase === "failed" ? this._pendingPreviewState.errorMessage = e.errorMessage || "资源加载异常,请刷新重试" : this._pendingPreviewState.errorMessage = null), i && this.callbacks.emitBufferingStateChange(e.isBuffering), n && this.callbacks.emitSourceLoadingStateChange(), this.updatePendingPreviewState();
13218
+ this._previewAwaitingMedia = e.phase === "awaiting-media", this._previewBuffering = e.isBuffering, this._previewSourceLoadingCount = t, this._pendingPreviewState && e.syncRequestId === this._pendingPreviewState.syncRequestId && ((e.phase === "awaiting-media" || e.phase === "ready" || e.phase === "failed") && (this._pendingPreviewState.awaitingSync = !1), e.phase === "failed" ? this.scheduleFailedOverlay(e.errorMessage || "资源加载异常,请刷新重试") : (this.clearFailedOverlayTimeout(), this._pendingPreviewState.pendingFailedMessage = null, this._pendingPreviewState.errorMessage = null)), i && this.callbacks.emitBufferingStateChange(e.isBuffering), n && this.callbacks.emitSourceLoadingStateChange(), this.updatePendingPreviewState();
13218
13219
  }
13219
13220
  markSyncProcessed(e) {
13220
13221
  this._pendingPreviewState && e === this._pendingPreviewState.syncRequestId && (this._pendingPreviewState.awaitingSync = !1), this.updatePendingPreviewState();
@@ -13226,6 +13227,8 @@ class Hl {
13226
13227
  resumePlayOnReady: i,
13227
13228
  errorMessage: null,
13228
13229
  timeoutId: null,
13230
+ failedTimeoutId: null,
13231
+ pendingFailedMessage: null,
13229
13232
  awaitingSync: !0,
13230
13233
  syncRequestId: ++this._nextPendingPreviewSyncRequestId
13231
13234
  };
@@ -13249,6 +13252,10 @@ class Hl {
13249
13252
  this.callbacks.applyPendingState(this.buildPreviewPendingState());
13250
13253
  return;
13251
13254
  }
13255
+ if (this._pendingPreviewState.pendingFailedMessage) {
13256
+ this.callbacks.applyPendingState(this.buildPreviewPendingState());
13257
+ return;
13258
+ }
13252
13259
  if (this._pendingPreviewState.awaitingSync) {
13253
13260
  this.callbacks.applyPendingState(this.buildPreviewPendingState());
13254
13261
  return;
@@ -13261,10 +13268,10 @@ class Hl {
13261
13268
  this.clearPendingPreviewState(), t && this.callbacks.resumePlayback();
13262
13269
  }
13263
13270
  retryPendingPreview() {
13264
- this._pendingPreviewState && (this._pendingPreviewState.errorMessage = null, this._pendingPreviewState.awaitingSync = !0, this._pendingPreviewState.syncRequestId = ++this._nextPendingPreviewSyncRequestId, this.clearPendingPreviewTimeout(), this.callbacks.requestPreviewSync());
13271
+ this._pendingPreviewState && (this._pendingPreviewState.errorMessage = null, this._pendingPreviewState.pendingFailedMessage = null, this._pendingPreviewState.awaitingSync = !0, this._pendingPreviewState.syncRequestId = ++this._nextPendingPreviewSyncRequestId, this.clearPendingPreviewTimeout(), this.clearFailedOverlayTimeout(), this.callbacks.requestPreviewSync());
13265
13272
  }
13266
13273
  clearPendingPreviewState() {
13267
- this.clearPendingPreviewTimeout(), this._pendingPreviewState = null, this.callbacks.applyPendingState(null);
13274
+ this.clearPendingPreviewTimeout(), this.clearFailedOverlayTimeout(), this._pendingPreviewState = null, this.callbacks.applyPendingState(null);
13268
13275
  }
13269
13276
  resetPreviewRuntimeState() {
13270
13277
  const e = this._previewBuffering, t = this._previewSourceLoadingCount !== 0;
@@ -13282,8 +13289,21 @@ class Hl {
13282
13289
  var e;
13283
13290
  (e = this._pendingPreviewState) != null && e.timeoutId && (clearTimeout(this._pendingPreviewState.timeoutId), this._pendingPreviewState.timeoutId = null);
13284
13291
  }
13292
+ scheduleFailedOverlay(e) {
13293
+ if (!this._pendingPreviewState || this._pendingPreviewState.errorMessage === e || this._pendingPreviewState.pendingFailedMessage === e && this._pendingPreviewState.failedTimeoutId)
13294
+ return;
13295
+ this.clearFailedOverlayTimeout(), this._pendingPreviewState.pendingFailedMessage = e;
13296
+ const t = this._pendingPreviewState.syncRequestId;
13297
+ this._pendingPreviewState.failedTimeoutId = setTimeout(() => {
13298
+ !this._pendingPreviewState || this._pendingPreviewState.syncRequestId !== t || (this._pendingPreviewState.errorMessage = e, this._pendingPreviewState.pendingFailedMessage = null, this._pendingPreviewState.failedTimeoutId = null, this.callbacks.applyPendingState(this.buildPreviewPendingState()));
13299
+ }, this.failedOverlayDelayMs);
13300
+ }
13301
+ clearFailedOverlayTimeout() {
13302
+ var e;
13303
+ (e = this._pendingPreviewState) != null && e.failedTimeoutId && (clearTimeout(this._pendingPreviewState.failedTimeoutId), this._pendingPreviewState.failedTimeoutId = null);
13304
+ }
13285
13305
  }
13286
- function Nl(a) {
13306
+ function zl(a) {
13287
13307
  var t;
13288
13308
  const e = a.getPrimarySelectedClip() || ((t = a.findFallbackSelectedClip) == null ? void 0 : t.call(a)) || null;
13289
13309
  return {
@@ -13291,7 +13311,7 @@ function Nl(a) {
13291
13311
  hasSelectedClip: !!e
13292
13312
  };
13293
13313
  }
13294
- function zl(a) {
13314
+ function Fl(a) {
13295
13315
  var i;
13296
13316
  const e = a.resolveSelectedClip(), t = ((i = e.clip) == null ? void 0 : i.id) || null;
13297
13317
  return t === a.lastSelectedClipId ? a.lastSelectedClipId : (a.emitSelectedClipChange(e), t);
@@ -13300,7 +13320,7 @@ function Rs(a, e) {
13300
13320
  var t, i, n, s;
13301
13321
  return ((i = (t = a.findById(e)) == null ? void 0 : t.getId) == null ? void 0 : i.call(t)) || ((s = (n = a.getLastTrack()) == null ? void 0 : n.getId) == null ? void 0 : s.call(n)) || e;
13302
13322
  }
13303
- function Fl(a) {
13323
+ function Vl(a) {
13304
13324
  if (a.placement.status === "use_existing_track")
13305
13325
  return a.trackCollection.addClipToTrack(a.placement.trackId, a.clip);
13306
13326
  const e = a.createTrack(a.placement.trackType, a.placement.suggestedTrackName), t = Rs(a.trackCollection, e);
@@ -13309,14 +13329,14 @@ function Fl(a) {
13309
13329
  function On(a, e, t) {
13310
13330
  return e.trackId ? a.removeClipFromTrack(e.trackId, t) : !1;
13311
13331
  }
13312
- function Vl(a) {
13332
+ function Yl(a) {
13313
13333
  return a.trackCollection.moveClipToTrack(
13314
13334
  a.command.clip,
13315
13335
  a.command.sourceTrackId,
13316
13336
  a.command.targetTrackId
13317
13337
  );
13318
13338
  }
13319
- function Yl(a) {
13339
+ function Wl(a) {
13320
13340
  const e = a.createTrack(a.trackType, a.trackName), t = Rs(a.trackCollection, e);
13321
13341
  return t ? a.trackCollection.moveClipToTrack(a.clip, a.currentTrackId, t) : !1;
13322
13342
  }
@@ -13324,11 +13344,11 @@ function Ee(a) {
13324
13344
  var e, t, i, n, s;
13325
13345
  (e = a.checkTrackDurationChange) == null || e.call(a), (t = a.updateCanPlayState) == null || t.call(a), (i = a.updateTrackInfoPanel) == null || i.call(a), (n = a.handleClipChange) == null || n.call(a), (s = a.cleanupEmptyTracks) == null || s.call(a);
13326
13346
  }
13327
- function Wl(a) {
13347
+ function Xl(a) {
13328
13348
  var e, t;
13329
13349
  a.notifySelectionChange(), (e = a.cleanupEmptyTracks) == null || e.call(a), a.updateTrackInfoPanel(), (t = a.batchDraw) == null || t.call(a), a.syncPreviewSession();
13330
13350
  }
13331
- class Xl {
13351
+ class Ul {
13332
13352
  constructor() {
13333
13353
  g(this, "panel", null);
13334
13354
  }
@@ -13428,7 +13448,7 @@ class Gn {
13428
13448
  );
13429
13449
  }
13430
13450
  }
13431
- class Ul {
13451
+ class $l {
13432
13452
  constructor(e) {
13433
13453
  this.tracks = e;
13434
13454
  }
@@ -13565,7 +13585,7 @@ class Ul {
13565
13585
  return typeof e.getId == "function" ? e.getId() : typeof e.id == "string" ? e.id : null;
13566
13586
  }
13567
13587
  }
13568
- class $l {
13588
+ class ql {
13569
13589
  constructor(e = []) {
13570
13590
  g(this, "tracks", []);
13571
13591
  g(this, "trackCounter", 0);
@@ -13671,7 +13691,7 @@ function ut(a, e, t) {
13671
13691
  function Hn(a, e) {
13672
13692
  return a.reduce((t, i) => t + Xe(i.type), e);
13673
13693
  }
13674
- function ql(a, e) {
13694
+ function Kl(a, e) {
13675
13695
  let t = e;
13676
13696
  return a.map((i) => {
13677
13697
  const n = Xe(i.type), s = {
@@ -13683,7 +13703,7 @@ function ql(a, e) {
13683
13703
  });
13684
13704
  }
13685
13705
  const Ds = 200, Os = 8, Nn = "timeline-manager-managed-layout-styles";
13686
- function Kl() {
13706
+ function jl() {
13687
13707
  if (typeof document > "u" || document.getElementById(Nn))
13688
13708
  return;
13689
13709
  const a = document.createElement("style");
@@ -13715,8 +13735,8 @@ function Kl() {
13715
13735
  }
13716
13736
  `, document.head.appendChild(a);
13717
13737
  }
13718
- function jl(a, e) {
13719
- Kl();
13738
+ function Zl(a, e) {
13739
+ jl();
13720
13740
  const t = e.leftPanelWidth ?? Ds, i = e.scrollbarSize ?? Os;
13721
13741
  a.innerHTML = "", a.classList.add("timeline-manager-root"), a.style.gridTemplateColumns = `${t}px minmax(0, 1fr)`, a.style.gridTemplateRows = `${e.timeScaleHeight}px minmax(0, 1fr)`, a.style.background = e.theme.background;
13722
13742
  const n = we("div");
@@ -13754,7 +13774,7 @@ function we(a) {
13754
13774
  function Xt(a, e) {
13755
13775
  a.style.position = "relative", a.style.minWidth = "0", a.style.minHeight = "0", a.style.maxWidth = "100%", a.style.boxSizing = "border-box", a.style.background = e.background, a.style.color = e.clipName;
13756
13776
  }
13757
- class Zl {
13777
+ class Jl {
13758
13778
  constructor(e) {
13759
13779
  g(this, "currentTime");
13760
13780
  g(this, "playState");
@@ -13824,7 +13844,7 @@ class Bs {
13824
13844
  return this.selectedClipIds.size;
13825
13845
  }
13826
13846
  }
13827
- class Jl {
13847
+ class Ql {
13828
13848
  constructor(e) {
13829
13849
  g(this, "zoom");
13830
13850
  g(this, "duration");
@@ -13883,11 +13903,11 @@ class zn {
13883
13903
  g(this, "selectionStore");
13884
13904
  g(this, "playbackStore");
13885
13905
  g(this, "viewportStore");
13886
- this.selectionStore = new Bs(), this.playbackStore = new Zl({
13906
+ this.selectionStore = new Bs(), this.playbackStore = new Jl({
13887
13907
  currentTime: e.currentTime,
13888
13908
  playState: e.playState,
13889
13909
  speed: e.speed
13890
- }), this.viewportStore = new Jl({
13910
+ }), this.viewportStore = new Ql({
13891
13911
  zoom: e.zoom,
13892
13912
  duration: e.duration,
13893
13913
  scrollLeft: e.scrollLeft,
@@ -13982,7 +14002,7 @@ class zn {
13982
14002
  this.viewportStore.setContentHeight(e);
13983
14003
  }
13984
14004
  }
13985
- class Ql {
14005
+ class eh {
13986
14006
  constructor(e, t, i, n, s) {
13987
14007
  g(this, "stage");
13988
14008
  g(this, "layer");
@@ -14424,7 +14444,7 @@ class Fn {
14424
14444
  return this.scrollOffset / i * n;
14425
14445
  }
14426
14446
  }
14427
- class eh {
14447
+ class th {
14428
14448
  constructor() {
14429
14449
  g(this, "entries", /* @__PURE__ */ new Map());
14430
14450
  }
@@ -14440,7 +14460,7 @@ class eh {
14440
14460
  this.entries.clear();
14441
14461
  }
14442
14462
  }
14443
- class th {
14463
+ class ih {
14444
14464
  constructor() {
14445
14465
  g(this, "panel", null);
14446
14466
  g(this, "config", null);
@@ -14487,10 +14507,10 @@ class th {
14487
14507
  };
14488
14508
  }
14489
14509
  }
14490
- const ih = "2.0.6", nh = {
14491
- version: ih
14492
- }, sh = 1, rh = 2, ah = 120;
14493
- class gh {
14510
+ const nh = "2.0.6", sh = {
14511
+ version: nh
14512
+ }, rh = 1, ah = 2, oh = 120;
14513
+ class ph {
14494
14514
  constructor(e = {}) {
14495
14515
  g(this, "timeline", null);
14496
14516
  g(this, "tracks", []);
@@ -14554,7 +14574,7 @@ class gh {
14554
14574
  g(this, "rootWheelListener", (e) => {
14555
14575
  this.handleUnifiedWheel(e);
14556
14576
  });
14557
- g(this, "mountManager", new eh());
14577
+ g(this, "mountManager", new th());
14558
14578
  g(this, "pendingDraftData", null);
14559
14579
  g(this, "selectionStore", new Bs());
14560
14580
  g(this, "multiDragSession", null);
@@ -14575,7 +14595,7 @@ class gh {
14575
14595
  thumbnailProvider: e.thumbnailProvider,
14576
14596
  previewBackend: e.previewBackend ?? "dom",
14577
14597
  previewSourceResolver: e.previewSourceResolver
14578
- }, L.setConfig(this.config.logConfig), L.debug("TimelineManager", "日志系统初始化完成", { logConfig: this.config.logConfig }), this.thumbnailProvider = e.thumbnailProvider || null, this.trackInfoPanelController = new Xl(), this.eventDispatcher = new Dn({
14598
+ }, L.setConfig(this.config.logConfig), L.debug("TimelineManager", "日志系统初始化完成", { logConfig: this.config.logConfig }), this.thumbnailProvider = e.thumbnailProvider || null, this.trackInfoPanelController = new Ul(), this.eventDispatcher = new Dn({
14579
14599
  can_play_change: () => ({ canPlay: this.canPlay }),
14580
14600
  selected_clip_change: () => this.resolveSelectedClipSnapshot(),
14581
14601
  source_loading_change: () => this.getSourceLoadingState(),
@@ -14600,7 +14620,7 @@ class gh {
14600
14620
  findTrackByClipId: this.findTrackByClipId.bind(this),
14601
14621
  getDefaultTrack: () => this.getDefaultTrackForHistory(),
14602
14622
  loadClipThumbnails: this.loadClipThumbnails.bind(this)
14603
- }), this.trackManager = new $l(), this.timelineStore = new zn({
14623
+ }), this.trackManager = new ql(), this.timelineStore = new zn({
14604
14624
  currentTime: this.config.currentTime,
14605
14625
  playState: this.config.playState,
14606
14626
  speed: this.config.speed || 1,
@@ -14645,7 +14665,7 @@ class gh {
14645
14665
  return this.timelineCommands || (this.timelineCommands = new wn(this.getTimelineStore())), this.timelineCommands;
14646
14666
  }
14647
14667
  getTrackCollection() {
14648
- return new Ul(this.tracks);
14668
+ return new $l(this.tracks);
14649
14669
  }
14650
14670
  getTimelinePresentationAdapter() {
14651
14671
  return this.timelinePresentationAdapter || (this.timelinePresentationAdapter = new Bn()), this.timelinePresentationAdapter;
@@ -14729,7 +14749,7 @@ class gh {
14729
14749
  this.getPreviewStateController().nextPendingPreviewSyncRequestId = e;
14730
14750
  }
14731
14751
  getPreviewStateController() {
14732
- return this.previewStateController || (this.previewStateController = new Hl({
14752
+ return this.previewStateController || (this.previewStateController = new Nl({
14733
14753
  callbacks: {
14734
14754
  applyPendingState: (e) => {
14735
14755
  var t, i;
@@ -15070,7 +15090,7 @@ class gh {
15070
15090
  L.warn("TimelineManager", "TimelineManager has already been initialized");
15071
15091
  return;
15072
15092
  }
15073
- this.rootContainer = e, this.layout = jl(e, {
15093
+ this.rootContainer = e, this.layout = Zl(e, {
15074
15094
  theme: this.config.theme,
15075
15095
  timeScaleHeight: this.getTimeScaleHeight(),
15076
15096
  leftPanelWidth: Ds,
@@ -15085,7 +15105,7 @@ class gh {
15085
15105
  height: 0
15086
15106
  }), this.backgroundLayer = new U.Layer({ name: "trackBackgroundLayer" }), this.trackLayer = new U.Layer({ name: "trackLayer" }), this.dragOverlayLayer = new U.Layer({ name: "trackDragOverlayLayer", listening: !1 }), this.snapGuideLayer = new U.Layer({ name: "trackSnapGuideLayer", listening: !1 }), this.selectionBoxLayer = new U.Layer({ name: "selectionBoxLayer", listening: !1 }), this.stage.add(this.backgroundLayer), this.stage.add(this.trackLayer), this.stage.add(this.dragOverlayLayer), this.stage.add(this.snapGuideLayer), this.stage.add(this.selectionBoxLayer);
15087
15107
  const t = (l = (o = this.stage) == null ? void 0 : o.container) == null ? void 0 : l.call(o);
15088
- if (t && t.addEventListener("mousedown", this.handleStageMouseDown.bind(this)), this.timeline = new Ql(
15108
+ if (t && t.addEventListener("mousedown", this.handleStageMouseDown.bind(this)), this.timeline = new eh(
15089
15109
  this.headerStage,
15090
15110
  this.headerLayer,
15091
15111
  this.config,
@@ -15192,7 +15212,7 @@ class gh {
15192
15212
  }
15193
15213
  updateAllTrackPositions() {
15194
15214
  var t, i;
15195
- const e = ql(this.trackManager.getTracks(), this.getTrackContentTopOffset());
15215
+ const e = Kl(this.trackManager.getTracks(), this.getTrackContentTopOffset());
15196
15216
  for (const n of e) {
15197
15217
  const s = this.getTrackCollection().findById(n.trackId);
15198
15218
  s && ((t = s.setTrackY) == null || t.call(s, n.y), (i = s.setTrackHeight) == null || i.call(s, n.height));
@@ -15385,9 +15405,9 @@ class gh {
15385
15405
  normalizeWheelDelta(e, t, i) {
15386
15406
  if (!Number.isFinite(e) || e === 0)
15387
15407
  return 0;
15388
- if (t === sh)
15408
+ if (t === rh)
15389
15409
  return e * 16;
15390
- if (t === rh) {
15410
+ if (t === ah) {
15391
15411
  const n = i === "x" ? this.getViewportWidth() : this.getViewportHeight();
15392
15412
  return e * (n || 1);
15393
15413
  }
@@ -15454,7 +15474,7 @@ class gh {
15454
15474
  return;
15455
15475
  this.previewBufferingSuspendTimeoutId = setTimeout(() => {
15456
15476
  this.previewBufferingSuspendTimeoutId = null, !(this.getPlayStateState() !== "playing" || !this.previewBuffering || this.previewPlaybackSuspendedByBuffering) && (this.previewPlaybackSuspendedByBuffering = !0, this.animationFrameId && (cancelAnimationFrame(this.animationFrameId), this.animationFrameId = null));
15457
- }, ah);
15477
+ }, oh);
15458
15478
  return;
15459
15479
  }
15460
15480
  if (this.clearPreviewBufferingSuspendTimeout(), !this.previewPlaybackSuspendedByBuffering)
@@ -15717,7 +15737,7 @@ class gh {
15717
15737
  return c.id;
15718
15738
  }
15719
15739
  }
15720
- const d = this.getTimelineCommands().planTrackPlacement(c, this.tracks), u = this.getTrackCollection(), f = Fl({
15740
+ const d = this.getTimelineCommands().planTrackPlacement(c, this.tracks), u = this.getTrackCollection(), f = Vl({
15721
15741
  clip: c,
15722
15742
  placement: d,
15723
15743
  trackCollection: u,
@@ -15828,40 +15848,37 @@ class gh {
15828
15848
  };
15829
15849
  }
15830
15850
  exportTimeline() {
15831
- var i, n, s;
15832
- const e = this.getResolvedTracksSnapshot().slice().sort((r, o) => r.order - o.order).map((r) => {
15833
- const o = r.clips.map((l) => ({
15834
- id: l.id,
15835
- type: l.type,
15836
- externalId: l.externalId,
15837
- src: l.src,
15838
- name: l.name,
15839
- isMuted: l.isMuted ?? !1,
15840
- startTime: Math.round(l.startTime),
15841
- duration: Math.round(l.duration),
15842
- endTime: Math.round(l.endTime),
15843
- startTimeAtSource: Math.round(l.startTimeAtSource),
15844
- endTimeAtSource: Math.round(l.endTimeAtSource),
15845
- sourceDuration: Math.round(l.sourceDuration),
15846
- thumbnails: l.thumbnails,
15847
- visualTransform: l.type === "video" ? fe(l.visualTransform) : void 0,
15848
- separatedAudioClipId: l.separatedAudioClipId,
15849
- separatedFromVideoClipId: l.separatedFromVideoClipId,
15850
- volume: l.volume ?? 1
15851
- })).sort((l, h) => l.startTime - h.startTime);
15851
+ const e = this.getResolvedTracksSnapshot().slice().sort((t, i) => t.order - i.order).map((t) => {
15852
+ const i = t.clips.map((n) => ({
15853
+ id: n.id,
15854
+ type: n.type,
15855
+ externalId: n.externalId,
15856
+ src: n.src,
15857
+ name: n.name,
15858
+ isMuted: n.isMuted ?? !1,
15859
+ startTime: Math.round(n.startTime),
15860
+ duration: Math.round(n.duration),
15861
+ endTime: Math.round(n.endTime),
15862
+ startTimeAtSource: Math.round(n.startTimeAtSource),
15863
+ endTimeAtSource: Math.round(n.endTimeAtSource),
15864
+ sourceDuration: Math.round(n.sourceDuration),
15865
+ visualTransform: n.type === "video" ? fe(n.visualTransform) : void 0,
15866
+ separatedAudioClipId: n.separatedAudioClipId,
15867
+ separatedFromVideoClipId: n.separatedFromVideoClipId,
15868
+ volume: n.volume ?? 1
15869
+ })).sort((n, s) => n.startTime - s.startTime);
15852
15870
  return {
15853
- id: r.id,
15854
- type: r.type,
15855
- name: r.name || "未命名轨道",
15856
- order: r.order,
15857
- isMuted: r.isMuted ?? !1,
15858
- clips: o
15871
+ id: t.id,
15872
+ type: t.type,
15873
+ name: t.name || "未命名轨道",
15874
+ order: t.order,
15875
+ isMuted: t.isMuted ?? !1,
15876
+ clips: i
15859
15877
  };
15860
- }), t = ((s = (n = (i = e[0].clips) == null ? void 0 : i[0]) == null ? void 0 : n.thumbnails) == null ? void 0 : s[0]) || "";
15878
+ });
15861
15879
  return {
15862
15880
  version: this.getVersion(),
15863
15881
  exportTime: Date.now(),
15864
- coverUrl: t,
15865
15882
  composition: this.getExportComposition(),
15866
15883
  tracks: e
15867
15884
  };
@@ -15930,7 +15947,7 @@ class gh {
15930
15947
  * 获取插件版本号
15931
15948
  */
15932
15949
  getVersion() {
15933
- return nh.version;
15950
+ return sh.version;
15934
15951
  }
15935
15952
  undo() {
15936
15953
  return this.history.undo();
@@ -16060,7 +16077,7 @@ class gh {
16060
16077
  this.getEventDispatcher().emit(e, t);
16061
16078
  }
16062
16079
  emitSelectedClipChangeIfNeeded() {
16063
- this.lastSelectedClipId = zl({
16080
+ this.lastSelectedClipId = Fl({
16064
16081
  lastSelectedClipId: this.lastSelectedClipId,
16065
16082
  resolveSelectedClip: () => this.resolveSelectedClipSnapshot(),
16066
16083
  emitSelectedClipChange: (e) => this.emitEvent("selected_clip_change", e)
@@ -16083,7 +16100,7 @@ class gh {
16083
16100
  const i = this.getTrackCollection();
16084
16101
  if (!i.findById(t)) return;
16085
16102
  const n = e.type, s = this.trackManager.getTracksByType(n).length + 1, r = n === "video" ? `视频轨道 ${s}` : `音频轨道 ${s}`;
16086
- Yl({
16103
+ Wl({
16087
16104
  clip: e,
16088
16105
  currentTrackId: t,
16089
16106
  trackType: n,
@@ -16306,7 +16323,7 @@ class gh {
16306
16323
  this.getPreviewRuntimeController().detachPreviewSession() && (this.clearPendingPreviewState(), this.resetPreviewRuntimeState(), L.debugLazy("TimelineManager", () => "TimelineManager detached from preview container"));
16307
16324
  }
16308
16325
  attachClipConfig(e) {
16309
- const t = new th();
16326
+ const t = new ih();
16310
16327
  t.init({
16311
16328
  container: e,
16312
16329
  theme: this.config.theme,
@@ -16517,7 +16534,7 @@ class gh {
16517
16534
  }), !1;
16518
16535
  if (s.status !== "ready")
16519
16536
  return !1;
16520
- const { sourceTrackId: r, targetTrackId: o } = s, l = i ? { ...i } : { ...s.clip }, h = n ? { ...n } : { ...s.clip }, c = this.cloneTrackSnapshot(r), d = this.cloneTrackSnapshot(o), u = Vl({
16537
+ const { sourceTrackId: r, targetTrackId: o } = s, l = i ? { ...i } : { ...s.clip }, h = n ? { ...n } : { ...s.clip }, c = this.cloneTrackSnapshot(r), d = this.cloneTrackSnapshot(o), u = Yl({
16521
16538
  command: {
16522
16539
  ...s,
16523
16540
  clip: h
@@ -16535,7 +16552,7 @@ class gh {
16535
16552
  targetTrackSnapshot: d,
16536
16553
  isExecutingHistoryAction: this.isExecutingHistoryAction,
16537
16554
  recordMoveClipBetweenTracks: this.getTimelineHistoryRecorder().recordMoveClipBetweenTracks.bind(this.getTimelineHistoryRecorder()),
16538
- applyEffects: () => Wl({
16555
+ applyEffects: () => Xl({
16539
16556
  notifySelectionChange: this.notifySelectionChange.bind(this),
16540
16557
  cleanupEmptyTracks: this.cleanupEmptyTracks.bind(this),
16541
16558
  updateTrackInfoPanel: this.updateTrackInfoPanel.bind(this),
@@ -17121,7 +17138,7 @@ class gh {
17121
17138
  );
17122
17139
  }
17123
17140
  resolveSelectedClipSnapshot() {
17124
- return Nl({
17141
+ return zl({
17125
17142
  getPrimarySelectedClip: () => {
17126
17143
  var e;
17127
17144
  return ((e = this.getPrimarySelectedClip) == null ? void 0 : e.call(this)) || null;
@@ -17157,24 +17174,24 @@ class gh {
17157
17174
  }
17158
17175
  }
17159
17176
  export {
17160
- hh as CLIP_LAYER,
17177
+ ch as CLIP_LAYER,
17161
17178
  di as Clip,
17162
17179
  Jo as ClipConfigPanel,
17163
17180
  Ns as DEFAULT_CLIP_VIEW_STATE,
17164
17181
  Pe as DEFAULT_PREVIEW_ASPECT_RATIO,
17165
17182
  kn as HistoryManager,
17166
17183
  jt as MIN_CLIP_LINE_WIDTH,
17167
- lh as PREVIEW_ASPECT_RATIO_PRESETS,
17168
- uh as Playhead,
17184
+ hh as PREVIEW_ASPECT_RATIO_PRESETS,
17185
+ gh as Playhead,
17169
17186
  le as TIMELINE_LEFT_PADDING,
17170
- ch as TIME_SCALE,
17187
+ dh as TIME_SCALE,
17171
17188
  De as TRACK_HEIGHT,
17172
17189
  N as TimeUtils,
17173
- dh as Timeline,
17174
- gh as TimelineManager,
17190
+ uh as Timeline,
17191
+ ph as TimelineManager,
17175
17192
  Mi as Track,
17176
17193
  Ko as TrackInfoPanel,
17177
- $l as TrackManager,
17194
+ ql as TrackManager,
17178
17195
  zs as ZOOM_ANIMATION,
17179
17196
  ge as ZOOM_PRESETS,
17180
17197
  Fs as createClipViewState,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linker-design-plus/timeline-track",
3
- "version": "2.0.6",
3
+ "version": "2.0.7",
4
4
  "description": "A TypeScript-based video editing library with timeline and track functionality",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.es.js",