@polyv/vue-components 1.5.0 → 1.5.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.
@@ -14,7 +14,7 @@ export interface AnimationImplement {
14
14
  /**
15
15
  * 播放一次动画
16
16
  */
17
- playSingleAnimation: () => Promise<void>;
17
+ playSingleAnimation: (options?: PlayAnimationOptions) => Promise<void>;
18
18
  }
19
19
  export declare const useCommonAnimation: (hookOptions: AnimationControllerOptions, implement: AnimationImplement) => {
20
20
  wrapRef: import('vue').Ref<HTMLDivElement | undefined>;
@@ -26,6 +26,11 @@ export interface PlayAnimationOptions extends AnimationCallback {
26
26
  * 循环间隔时间
27
27
  */
28
28
  loopTimeInterval?: number;
29
+ /**
30
+ * 是否强制刷新图片资源(添加时间戳参数避免缓存)
31
+ * @default false
32
+ */
33
+ forceRefresh?: boolean;
29
34
  }
30
35
  export interface AnimationControllerOptions extends AnimationCallback {
31
36
  /**
@@ -0,0 +1,26 @@
1
+ /**
2
+ * 判断是否为 GIF 图片 URL
3
+ * 使用正则表达式匹配 .gif 扩展名(可包含查询参数)
4
+ */
5
+ export declare function isGifUrl(url: string): boolean;
6
+ export interface UseGifHandlerOptions {
7
+ /** 最大缓存数量,默认20 */
8
+ maxCacheSize?: number;
9
+ }
10
+ export interface GifHandler {
11
+ /** 判断URL是否为GIF图片 */
12
+ isGifUrl: (url: string) => boolean;
13
+ /** 获取GIF动画时长(毫秒) */
14
+ getGifDuration: (url: string, defaultDuration?: number) => Promise<number>;
15
+ /** 获取GIF图片的object URL(用于播放) */
16
+ getGifObjectUrl: (url: string) => Promise<string | null>;
17
+ /** 回收GIF object URL */
18
+ revokeGifUrl: (url: string) => void;
19
+ /** 清理所有资源 */
20
+ cleanupGifCache: () => void;
21
+ }
22
+ /**
23
+ * GIF图片处理hook
24
+ * 负责GIF图片的检测、时长解析、blob缓存和object URL管理
25
+ */
26
+ export declare const useGifHandler: (options?: UseGifHandlerOptions) => GifHandler;
@@ -18,13 +18,17 @@ export interface UseSpecialEffectOptions {
18
18
  disabled?: MaybeResponsive<boolean>;
19
19
  }
20
20
  export interface AnimationQueueItem {
21
- url: string;
22
- }
23
- export interface PushAnimationQueueOptions {
24
21
  /**
25
22
  * 动画文件地址
26
23
  */
27
24
  url: string;
25
+ /**
26
+ * 是否强制刷新图片资源(添加时间戳参数避免缓存)
27
+ * @default false
28
+ */
29
+ forceRefresh?: boolean;
30
+ }
31
+ export interface PushAnimationQueueOptions extends AnimationQueueItem {
28
32
  /**
29
33
  * 是否从头部插入
30
34
  * @default false
@@ -42,12 +46,13 @@ export interface PushAnimationQueueOptions {
42
46
  filterRepeat?: boolean;
43
47
  }
44
48
  /**
45
- * 特殊播放器
49
+ * 特效播放器
46
50
  */
47
51
  export declare const useSpecialEffect: (options?: UseSpecialEffectOptions) => {
48
52
  wrapRef: Ref<HTMLDivElement | undefined>;
49
53
  animationQueue: Ref<{
50
54
  url: string;
55
+ forceRefresh?: boolean | undefined;
51
56
  }[]>;
52
57
  currentAnimationItem: Ref<AnimationQueueItem | undefined>;
53
58
  pushAnimationQueue: (options: PushAnimationQueueOptions) => void;
@@ -1,3 +1,4 @@
1
+ export * from './animation/use-gif-handler';
1
2
  export * from './animation/use-image-animation';
2
3
  export * from './animation/use-special-effect';
3
4
  export * from './animation/use-svga-animation';