vue-micro-router 1.0.26 → 1.0.29

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/audio.d.ts CHANGED
@@ -14,6 +14,11 @@ export declare interface AudioAdapter {
14
14
  loop?: boolean;
15
15
  volume?: number;
16
16
  }): Promise<void>;
17
+ /** Synchronous play — must work without await for user gesture context. Optional — falls back to play(). */
18
+ playSync?(src: string, options: {
19
+ loop?: boolean;
20
+ volume?: number;
21
+ }): void;
17
22
  /** Stop and unload the current sound */
18
23
  stop(): void;
19
24
  /** Pause playback (preserves position) */
@@ -35,29 +40,35 @@ export declare interface AudioManagerConfig {
35
40
  volumeRef?: Ref<number>;
36
41
  /** Default BGM track name — played on mount and used as fallback. Defaults to 'default'. */
37
42
  defaultBgm?: string;
38
- /** Resolve a sound name to a full URL. Defaults to identity (name returned as-is). */
39
- urlResolver?: (name: string) => string;
40
43
  /** Custom audio adapter. Defaults to HowlerAdapter (requires howler peer dep). */
41
44
  adapter?: AudioAdapter;
42
45
  }
43
46
 
44
47
  export declare interface AudioManagerState {
45
48
  playSound: (soundSrc: string, loop?: boolean) => Promise<void>;
49
+ /** Synchronous play — no async gaps, safe in user gesture context for autoplay policy */
50
+ playSoundSync: (soundSrc: string, loop?: boolean) => void;
46
51
  stopSound: () => void;
47
52
  updateBackgroundMusic: (route: string, routes?: Map<string, MicroRoute>) => Promise<void>;
48
53
  handleVisibilityChange: () => void;
54
+ /** Whether audio has successfully started playing at least once */
55
+ isStarted: () => boolean;
49
56
  cleanup: () => void;
50
57
  }
51
58
 
52
59
  export declare class HowlerAdapter implements AudioAdapter {
53
60
  private sound;
54
- private howlCtorPromise;
55
- /** Lazy-load Howler.js — only imported when first sound is played */
56
- private getHowlCtor;
61
+ private HowlCtor;
62
+ constructor();
57
63
  play(src: string, options?: {
58
64
  loop?: boolean;
59
65
  volume?: number;
60
66
  }): Promise<void>;
67
+ /** Fully synchronous play — uses preloaded HowlCtor. No-op if not preloaded yet. */
68
+ playSync(src: string, options?: {
69
+ loop?: boolean;
70
+ volume?: number;
71
+ }): void;
61
72
  stop(): void;
62
73
  pause(): void;
63
74
  resume(): void;
package/dist/index.d.ts CHANGED
@@ -415,10 +415,10 @@ export declare interface MicroRouterConfig {
415
415
  tracker?: PageTrackerHooks;
416
416
  /** Reactive volume ref (0-100) for audio manager. Enables built-in BGM when provided. */
417
417
  volumeRef?: Ref<number>;
418
- /** Default BGM track name — used as initial track and fallback when route has no bgm field */
418
+ /** Default BGM audio path — used as initial track and fallback when route has no bgm field. Example: '/audios/default.mp3' */
419
419
  defaultBgm?: string;
420
- /** Resolve audio name to URL. Defaults to identity. Example: (name) => `/audios/${name}.mp3` */
421
- audioUrlResolver?: (name: string) => string;
420
+ /** Set to true (in a user gesture handler) to start default BGM. Watched with flush:'sync' to preserve gesture context for autoplay policy. */
421
+ bgmStartRef?: Ref<boolean>;
422
422
  }
423
423
 
424
424
  /**