@freestylejs/ani-core 1.2.0 → 1.2.1

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.cjs CHANGED
@@ -879,7 +879,8 @@ var RafAniTimeline = class extends TimelineBase {
879
879
  if (this._status === "PLAYING" && !canBeIntercepted) return;
880
880
  const isRepeating = (this._currentConfig?.repeat ?? 0) >= 1;
881
881
  const savedRepeatCount = isRepeating ? this._repeatCount : 0;
882
- this.reset(false);
882
+ const isPlaying = this._status === "PLAYING";
883
+ this.reset(false, !isPlaying);
883
884
  this._repeatCount = savedRepeatCount;
884
885
  if (isRepeating && this._repeatCount >= config.repeat) {
885
886
  this._repeatCount = 0;
@@ -910,7 +911,7 @@ var RafAniTimeline = class extends TimelineBase {
910
911
  this._status = "PLAYING";
911
912
  this._clock.subscribe(this);
912
913
  }
913
- reset(notify = true) {
914
+ reset(notify = true, unsubscribeClock = true) {
914
915
  this._status = "IDLE";
915
916
  this._currentConfig = null;
916
917
  this._masterTime = 0;
@@ -919,7 +920,9 @@ var RafAniTimeline = class extends TimelineBase {
919
920
  this._initialState = [];
920
921
  this._propertyKeyMap = null;
921
922
  this._currentExecutionPlan = null;
922
- this._clock.unsubscribe(this);
923
+ if (unsubscribeClock) {
924
+ this._clock.unsubscribe(this);
925
+ }
923
926
  this._repeatCount = 0;
924
927
  if (notify) this.notify();
925
928
  }
package/dist/index.d.cts CHANGED
@@ -580,7 +580,7 @@ declare class RafAniTimeline<G extends Groupable, Ctx = any> extends TimelineBas
580
580
  play(config: RafTimelineConfig<G, Ctx>, canBeIntercepted?: boolean): void;
581
581
  pause(): void;
582
582
  resume(): void;
583
- reset(notify?: boolean): void;
583
+ reset(notify?: boolean, unsubscribeClock?: boolean): void;
584
584
  seek(targetTime: number): void;
585
585
  /**
586
586
  * When timeline updates, subscribes on update callback.
package/dist/index.d.ts CHANGED
@@ -580,7 +580,7 @@ declare class RafAniTimeline<G extends Groupable, Ctx = any> extends TimelineBas
580
580
  play(config: RafTimelineConfig<G, Ctx>, canBeIntercepted?: boolean): void;
581
581
  pause(): void;
582
582
  resume(): void;
583
- reset(notify?: boolean): void;
583
+ reset(notify?: boolean, unsubscribeClock?: boolean): void;
584
584
  seek(targetTime: number): void;
585
585
  /**
586
586
  * When timeline updates, subscribes on update callback.
package/dist/index.js CHANGED
@@ -838,7 +838,8 @@ var RafAniTimeline = class extends TimelineBase {
838
838
  if (this._status === "PLAYING" && !canBeIntercepted) return;
839
839
  const isRepeating = (this._currentConfig?.repeat ?? 0) >= 1;
840
840
  const savedRepeatCount = isRepeating ? this._repeatCount : 0;
841
- this.reset(false);
841
+ const isPlaying = this._status === "PLAYING";
842
+ this.reset(false, !isPlaying);
842
843
  this._repeatCount = savedRepeatCount;
843
844
  if (isRepeating && this._repeatCount >= config.repeat) {
844
845
  this._repeatCount = 0;
@@ -869,7 +870,7 @@ var RafAniTimeline = class extends TimelineBase {
869
870
  this._status = "PLAYING";
870
871
  this._clock.subscribe(this);
871
872
  }
872
- reset(notify = true) {
873
+ reset(notify = true, unsubscribeClock = true) {
873
874
  this._status = "IDLE";
874
875
  this._currentConfig = null;
875
876
  this._masterTime = 0;
@@ -878,7 +879,9 @@ var RafAniTimeline = class extends TimelineBase {
878
879
  this._initialState = [];
879
880
  this._propertyKeyMap = null;
880
881
  this._currentExecutionPlan = null;
881
- this._clock.unsubscribe(this);
882
+ if (unsubscribeClock) {
883
+ this._clock.unsubscribe(this);
884
+ }
882
885
  this._repeatCount = 0;
883
886
  if (notify) this.notify();
884
887
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@freestylejs/ani-core",
3
3
  "author": "freestyle",
4
- "version": "1.2.0",
4
+ "version": "1.2.1",
5
5
  "description": "Core functionality for the Ani animation library.",
6
6
  "license": "MIT",
7
7
  "type": "module",