@music-lyric-player/base 0.3.0 → 0.4.0

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.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("lodash-es");const r=require("@music-lyric-player/utils"),d={},u="0.5.1";class l{get version(){return u}type="Incorrect";metas=[];lines=[];agents=[];toJSON(){return{version:this.version,type:this.type,metas:this.metas,lines:this.lines,agents:this.agents}}}class o{config=new r.ConfigManager(d);event=new r.Event;state;active;time;info;constructor(){this.state={playing:!1,frameId:null,scanIndex:0},this.active={lines:[],index:[]},this.time={start:0,seek:0},this.info=new l}handleGetCurrentTime(){return this.state.playing?this.time.seek+(performance.now()-this.time.start):this.time.seek}handleGetLineTime(e){if(e<0||e>=this.info.lines.length)return 0;if(e===this.info.lines.length-1)return 1/0;const n=this.info.lines[e],s=this.info.lines[e+1];return Math.max(n.time.end,s.time.start)}handleGetActiveIndex(){return this.active.index.length>0?this.active.index[0]:-1}handleSyncTime(e){const n=[],s=[];let i=this.info.lines.length;for(let t=0;t<this.info.lines.length;t++){const a=this.info.lines[t];if(a.time.start>e){i=t;break}this.handleGetLineTime(t)>e&&(n.push(a),s.push(t))}this.state.scanIndex=i,this.active.lines=n,this.active.index=s,this.event.emit("linesUpdate",[...this.active.lines],[...this.active.index],this.handleGetActiveIndex())}handleUpdateActiveLines(e){let n=!1;const s=[],i=[];for(let t=0;t<this.active.lines.length;t++){const a=this.active.lines[t],h=this.active.index[t];e>=this.handleGetLineTime(h)?n=!0:(s.push(a),i.push(h))}for(;this.state.scanIndex<this.info.lines.length;){const t=this.info.lines[this.state.scanIndex];if(e>=t.time.start)e<this.handleGetLineTime(this.state.scanIndex)&&(s.push(t),i.push(this.state.scanIndex),n=!0),this.state.scanIndex++;else break}n&&(this.active.lines=s,this.active.index=i,this.event.emit("linesUpdate",[...this.active.lines],[...this.active.index],this.handleGetActiveIndex()))}onTick=()=>{if(!this.state.playing)return;const e=this.handleGetCurrentTime();this.handleUpdateActiveLines(e),this.state.frameId=requestAnimationFrame(this.onTick)};updateLyric(e){e&&(this.pause(),this.info=e,this.active.lines=[],this.active.index=[],this.state.scanIndex=0,this.time.seek=0,this.event.emit("lyricUpdate",e),this.event.emit("linesUpdate",[],[],-1))}play(e){this.pause(),typeof e=="number"&&!Number.isNaN(e)&&(this.time.seek=e,this.handleSyncTime(e)),this.time.start=performance.now(),this.state.playing=!0,this.onTick(),this.event.emit("play",this.handleGetCurrentTime())}pause(){this.state.playing&&(this.time.seek=this.handleGetCurrentTime(),this.state.playing=!1),this.state.frameId!==null&&(cancelAnimationFrame(this.state.frameId),this.state.frameId=null),this.event.emit("pause",this.handleGetCurrentTime())}dispose(){this.pause(),this.event.clear(),this.active.lines=[],this.active.index=[],this.info=new l}matchLinesWithTime(e){const n=[],s=[];for(let i=0;i<this.info.lines.length;i++){const t=this.info.lines[i];if(t.time.start>e)break;this.handleGetLineTime(i)>e&&(n.push(t),s.push(i))}return{lines:n,index:s}}get currentPlaying(){return this.state.playing}get currentLines(){return[...this.active.lines]}get currentIndex(){return[...this.active.index]}get currentActive(){return this.handleGetActiveIndex()}get currentInfo(){return this.info}get currentTime(){return this.handleGetCurrentTime()}}exports.BaseLyricPlayer=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("lodash-es");const r=require("@music-lyric-player/utils"),d={},u="0.5.1";class l{get version(){return u}type="Incorrect";metas=[];lines=[];agents=[];toJSON(){return{version:this.version,type:this.type,metas:this.metas,lines:this.lines,agents:this.agents}}}class o{config=new r.ConfigManager(d);event=new r.Event;state;active;time;info;constructor(){this.state={playing:!1,frameId:null,scanIndex:0},this.active={lines:[],index:[]},this.time={start:0,seek:0},this.info=new l}handleGetCurrentTime(){return this.state.playing?this.time.seek+(performance.now()-this.time.start):this.time.seek}handleGetLineTime(e){if(e<0||e>=this.info.lines.length)return 0;if(e===this.info.lines.length-1)return 1/0;const s=this.info.lines[e],n=this.info.lines[e+1];return Math.max(s.time.end,n.time.start)}handleGetActiveIndex(){return this.active.index.length>0?this.active.index[0]:-1}handleSyncTime(e){const s=[],n=[];let i=this.info.lines.length;for(let t=0;t<this.info.lines.length;t++){const a=this.info.lines[t];if(a.time.start>e){i=t;break}this.handleGetLineTime(t)>e&&(s.push(a),n.push(t))}this.state.scanIndex=i,this.active.lines=s,this.active.index=n,this.event.emit("linesUpdate",[...this.active.lines],[...this.active.index],this.handleGetActiveIndex(),!0)}handleUpdateActiveLines(e){let s=!1;const n=[],i=[];for(let t=0;t<this.active.lines.length;t++){const a=this.active.lines[t],h=this.active.index[t];e>=this.handleGetLineTime(h)?s=!0:(n.push(a),i.push(h))}for(;this.state.scanIndex<this.info.lines.length;){const t=this.info.lines[this.state.scanIndex];if(e>=t.time.start)e<this.handleGetLineTime(this.state.scanIndex)&&(n.push(t),i.push(this.state.scanIndex),s=!0),this.state.scanIndex++;else break}s&&(this.active.lines=n,this.active.index=i,this.event.emit("linesUpdate",[...this.active.lines],[...this.active.index],this.handleGetActiveIndex(),!1))}onTick=()=>{if(!this.state.playing)return;const e=this.handleGetCurrentTime();this.handleUpdateActiveLines(e),this.state.frameId=requestAnimationFrame(this.onTick)};updateLyric(e){e&&(this.pause(),this.info=e,this.active.lines=[],this.active.index=[],this.state.scanIndex=0,this.time.seek=0,this.event.emit("lyricUpdate",e),this.event.emit("linesUpdate",[],[],-1,!1))}play(e){this.pause(),typeof e=="number"&&!Number.isNaN(e)&&(this.time.seek=e,this.handleSyncTime(e)),this.time.start=performance.now(),this.state.playing=!0,this.onTick(),this.event.emit("play",this.handleGetCurrentTime())}pause(){this.state.playing&&(this.time.seek=this.handleGetCurrentTime(),this.state.playing=!1),this.state.frameId!==null&&(cancelAnimationFrame(this.state.frameId),this.state.frameId=null),this.event.emit("pause",this.handleGetCurrentTime())}dispose(){this.pause(),this.event.clear(),this.active.lines=[],this.active.index=[],this.info=new l}matchLinesWithTime(e){const s=[],n=[];for(let i=0;i<this.info.lines.length;i++){const t=this.info.lines[i];if(t.time.start>e)break;this.handleGetLineTime(i)>e&&(s.push(t),n.push(i))}return{lines:s,index:n}}get currentPlaying(){return this.state.playing}get currentLines(){return[...this.active.lines]}get currentIndex(){return[...this.active.index]}get currentActive(){return this.handleGetActiveIndex()}get currentInfo(){return this.info}get currentTime(){return this.handleGetCurrentTime()}}exports.BaseLyricPlayer=o;
2
2
  //# sourceMappingURL=index.comm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.comm.js","sources":["../src/options.ts","../../../node_modules/.pnpm/@music-lyric-kit+lyric@0.4.0/node_modules/@music-lyric-kit/lyric/dist/index.ecma.js","../src/index.ts"],"sourcesContent":["export interface Options {}\n\nexport const DEFAULT_OPTIONS: Options = {}\n","import { createRandomHex as r } from \"@music-lyric-kit/utils\";\nclass s {\n start = 0;\n end = 0;\n get duration() {\n return this.end - this.start;\n }\n toJSON() {\n return {\n start: this.start,\n end: this.end,\n duration: this.duration\n };\n }\n}\nvar o = /* @__PURE__ */ ((t) => (t.Normal = \"Normal\", t.Space = \"Space\", t))(o || {});\nclass i {\n stress = !1;\n toJSON() {\n return {\n stress: this.stress\n };\n }\n}\nclass p {\n get type() {\n return \"Normal\";\n }\n time = new s();\n content = \"\";\n extended = [];\n config = new i();\n toJSON() {\n return {\n type: this.type,\n time: this.time,\n content: this.content,\n extended: this.extended,\n config: this.config\n };\n }\n}\nclass N {\n get type() {\n return \"Space\";\n }\n count = 1;\n toJSON() {\n return {\n type: this.type,\n count: this.count\n };\n }\n}\nvar a = /* @__PURE__ */ ((t) => (t.UnKnown = \"UnKnown\", t.Translate = \"Translate\", t.Roman = \"Roman\", t))(a || {});\nclass S {\n type = \"UnKnown\";\n content = \"\";\n toJSON() {\n return {\n type: this.type,\n content: this.content\n };\n }\n}\nvar l = /* @__PURE__ */ ((t) => (t.Normal = \"Normal\", t.Interlude = \"Interlude\", t))(l || {});\nclass x {\n get type() {\n return \"Interlude\";\n }\n id = r(4).toUpperCase();\n time = new s();\n toJSON() {\n return {\n id: this.id,\n type: this.type,\n time: this.time\n };\n }\n}\nclass c {\n words = [];\n extended = [];\n get original() {\n return this.words.map((n) => n.type === o.Normal ? n.content : new Array(n.count).fill(\" \").join(\"\")).join(\"\");\n }\n toJSON() {\n return {\n words: this.words,\n extended: this.extended,\n original: this.original\n };\n }\n}\nclass y {\n get type() {\n return \"Normal\";\n }\n id = r(4).toUpperCase();\n time = new s();\n content = new c();\n agent;\n background;\n toJSON() {\n return {\n id: this.id,\n type: this.type,\n time: this.time,\n content: this.content,\n agent: this.agent,\n background: this.background\n };\n }\n}\nvar u = /* @__PURE__ */ ((t) => (t.Offset = \"Offset\", t.Duration = \"Duration\", t.Title = \"Title\", t.Singer = \"Singer\", t.Album = \"Album\", t.Creator = \"Creator\", t.UnKnown = \"UnKnown\", t))(u || {});\nclass e {\n id = r(4).toUpperCase();\n toJSON() {\n return {\n id: this.id,\n type: this.type,\n content: this.content\n };\n }\n}\nclass f extends e {\n get type() {\n return \"Offset\";\n }\n content = 0;\n}\nclass w extends e {\n get type() {\n return \"Duration\";\n }\n content = 0;\n}\nclass O extends e {\n get type() {\n return \"Title\";\n }\n content = \"\";\n}\nclass b extends e {\n get type() {\n return \"Singer\";\n }\n content = \"\";\n}\nclass J extends e {\n get type() {\n return \"Album\";\n }\n content = \"\";\n}\nclass U extends e {\n get type() {\n return \"Creator\";\n }\n content = {\n role: \"\",\n name: []\n };\n}\nclass C extends e {\n get type() {\n return \"UnKnown\";\n }\n content = \"\";\n}\nclass I {\n id = \"\";\n name = \"\";\n count = 0;\n}\nclass d {\n // index in global\n global = 0;\n // index in block\n block = 0;\n toJSON() {\n return {\n global: this.global,\n block: this.block\n };\n }\n}\nclass v {\n id = \"\";\n index = new d();\n toJSON() {\n return {\n id: this.id,\n index: this.index\n };\n }\n}\nconst m = \"0.5.1\";\nvar g = /* @__PURE__ */ ((t) => (t.Incorrect = \"Incorrect\", t.Normal = \"Normal\", t.Syllable = \"Syllable\", t.Pure = \"Pure\", t.Empty = \"Empty\", t.NoTime = \"NoTime\", t))(g || {});\nclass A {\n get version() {\n return m;\n }\n type = \"Incorrect\";\n metas = [];\n lines = [];\n agents = [];\n toJSON() {\n return {\n version: this.version,\n type: this.type,\n metas: this.metas,\n lines: this.lines,\n agents: this.agents\n };\n }\n}\nexport {\n I as Agent,\n v as AgentLine,\n d as AgentLineIndex,\n S as Extended,\n a as ExtendedType,\n A as Info,\n x as LineInterlude,\n y as LineNormal,\n c as LineNormalContent,\n l as LineType,\n J as MetaAlbum,\n U as MetaCreator,\n w as MetaDuration,\n f as MetaOffset,\n b as MetaSinger,\n O as MetaTitle,\n u as MetaType,\n C as MetaUnKnown,\n s as Time,\n g as Type,\n m as Version,\n p as WordNormal,\n N as WordSpace,\n o as WordType\n};\n//# sourceMappingURL=index.ecma.js.map\n","import type { Line } from '@music-lyric-kit/lyric'\nimport type { DeepPartial } from '@music-lyric-player/utils'\nimport type { Options } from './options'\n\nimport { DEFAULT_OPTIONS } from './options'\n\nimport { Info } from '@music-lyric-kit/lyric'\nimport { ConfigManager, Event } from '@music-lyric-player/utils'\n\nexport interface BaseLyricPlayerEventMap {\n /**\n * When the player starts or resumes playback.\n * @param currentTime The current playback time.\n */\n play: (currentTime: number) => void\n\n /**\n * When the player pauses playback.\n * @param currentTime The current playback time.\n */\n pause: (currentTime: number) => void\n\n /**\n * When the entire lyric information is updated (e.g., loading a new lyric/song).\n * @param info The newly loaded lyric information object.\n */\n lyricUpdate: (info: Info) => void\n\n /**\n * When the currently active lyric lines change during playback.\n * @param lines An array of the currently active lyric lines.\n * @param indexs An array of the currently active lyric lines' indexes.\n * @param firstIndex The index of the first currently active lyric line (-1 if none).\n */\n linesUpdate: (lines: Line[], indexs: number[], index: number) => void\n}\n\nexport class BaseLyricPlayer {\n readonly config = new ConfigManager<Options, DeepPartial<Options>>(DEFAULT_OPTIONS)\n\n readonly event: Event<BaseLyricPlayerEventMap> = new Event()\n\n private state: {\n playing: boolean\n frameId: number | null\n scanIndex: number\n }\n private active: {\n lines: Line[]\n index: number[]\n }\n private time: {\n start: number\n seek: number\n }\n private info: Info\n\n constructor() {\n this.state = {\n playing: false,\n frameId: null,\n scanIndex: 0,\n }\n this.active = {\n lines: [],\n index: [],\n }\n this.time = {\n start: 0,\n seek: 0,\n }\n this.info = new Info()\n }\n\n private handleGetCurrentTime() {\n if (!this.state.playing) {\n return this.time.seek\n }\n return this.time.seek + (performance.now() - this.time.start)\n }\n\n private handleGetLineTime(index: number): number {\n if (index < 0 || index >= this.info.lines.length) {\n return 0\n }\n\n if (index === this.info.lines.length - 1) {\n return Infinity\n }\n\n const line = this.info.lines[index]\n const nextLine = this.info.lines[index + 1]\n return Math.max(line.time.end, nextLine.time.start)\n }\n\n private handleGetActiveIndex() {\n return this.active.index.length > 0 ? this.active.index[0] : -1\n }\n\n private handleSyncTime(time: number) {\n const lines: Line[] = []\n const index: number[] = []\n\n let firstIndex = this.info.lines.length\n for (let i = 0; i < this.info.lines.length; i++) {\n const line = this.info.lines[i]\n if (line.time.start > time) {\n firstIndex = i\n break\n }\n\n if (this.handleGetLineTime(i) > time) {\n lines.push(line)\n index.push(i)\n }\n }\n\n this.state.scanIndex = firstIndex\n\n this.active.lines = lines\n this.active.index = index\n\n this.event.emit('linesUpdate', [...this.active.lines], [...this.active.index], this.handleGetActiveIndex())\n }\n\n private handleUpdateActiveLines(now: number) {\n let hasChanged = false\n\n const newActiveLines: Line[] = []\n const newActiveIndex: number[] = []\n\n for (let i = 0; i < this.active.lines.length; i++) {\n const line = this.active.lines[i]\n const infoIndex = this.active.index[i]\n\n if (now >= this.handleGetLineTime(infoIndex)) {\n hasChanged = true\n } else {\n newActiveLines.push(line)\n newActiveIndex.push(infoIndex)\n }\n }\n\n while (this.state.scanIndex < this.info.lines.length) {\n const nextLine = this.info.lines[this.state.scanIndex]\n if (now >= nextLine.time.start) {\n if (now < this.handleGetLineTime(this.state.scanIndex)) {\n newActiveLines.push(nextLine)\n newActiveIndex.push(this.state.scanIndex)\n hasChanged = true\n }\n this.state.scanIndex++\n } else {\n break\n }\n }\n\n if (!hasChanged) {\n return\n }\n\n this.active.lines = newActiveLines\n this.active.index = newActiveIndex\n this.event.emit('linesUpdate', [...this.active.lines], [...this.active.index], this.handleGetActiveIndex())\n }\n\n private onTick = () => {\n if (!this.state.playing) {\n return\n }\n\n const now = this.handleGetCurrentTime()\n this.handleUpdateActiveLines(now)\n\n this.state.frameId = requestAnimationFrame(this.onTick)\n }\n\n updateLyric(info: Info) {\n if (!info) {\n return\n }\n\n this.pause()\n this.info = info\n\n this.active.lines = []\n this.active.index = []\n\n this.state.scanIndex = 0\n this.time.seek = 0\n\n this.event.emit('lyricUpdate', info)\n this.event.emit('linesUpdate', [], [], -1)\n }\n\n /**\n * Start playback\n * @param time Optional time in ms to seek to before starting playback. If not provided, playback will start from the current position.\n */\n play(time?: number) {\n this.pause()\n\n if (typeof time === 'number' && !Number.isNaN(time)) {\n this.time.seek = time\n this.handleSyncTime(time)\n }\n\n this.time.start = performance.now()\n this.state.playing = true\n this.onTick()\n\n this.event.emit('play', this.handleGetCurrentTime())\n }\n\n /**\n * Pause playback\n */\n pause() {\n if (this.state.playing) {\n this.time.seek = this.handleGetCurrentTime()\n this.state.playing = false\n }\n if (this.state.frameId !== null) {\n cancelAnimationFrame(this.state.frameId)\n this.state.frameId = null\n }\n\n this.event.emit('pause', this.handleGetCurrentTime())\n }\n\n /**\n * Stop playback\n */\n dispose() {\n this.pause()\n this.event.clear()\n\n this.active.lines = []\n this.active.index = []\n\n this.info = new Info()\n }\n\n /**\n * Find all active lines at the given time (ms). Does not mutate internal state.\n * @param time time in ms to find active lines for.\n */\n matchLinesWithTime(time: number): { lines: Line[]; index: number[] } {\n const lines: Line[] = []\n const index: number[] = []\n for (let i = 0; i < this.info.lines.length; i++) {\n const line = this.info.lines[i]\n if (line.time.start > time) {\n break\n }\n if (this.handleGetLineTime(i) > time) {\n lines.push(line)\n index.push(i)\n }\n }\n return { lines, index }\n }\n\n /**\n * Whether the player is currently playing.\n */\n get currentPlaying() {\n return this.state.playing\n }\n\n /**\n * Current active lines.\n */\n get currentLines() {\n return [...this.active.lines]\n }\n\n /**\n * Indices of currently active lines.\n */\n get currentIndex() {\n return [...this.active.index]\n }\n\n /**\n * The index of the primary active line, or -1 if none.\n */\n get currentActive() {\n return this.handleGetActiveIndex()\n }\n\n /**\n * The current lyric info object.\n */\n get currentInfo() {\n return this.info\n }\n\n /**\n * The current playback time in ms.\n */\n get currentTime() {\n return this.handleGetCurrentTime()\n }\n}\n"],"names":["DEFAULT_OPTIONS","m","A","BaseLyricPlayer","ConfigManager","Event","Info","index","line","nextLine","time","lines","firstIndex","i","now","hasChanged","newActiveLines","newActiveIndex","infoIndex","info"],"mappings":"kJAEaA,EAA2B,CAAA,ECmMlCC,EAAI,QAEV,MAAMC,CAAE,CACN,IAAI,SAAU,CACZ,OAAOD,CACT,CACA,KAAO,YACP,MAAQ,CAAA,EACR,MAAQ,CAAA,EACR,OAAS,CAAA,EACT,QAAS,CACP,MAAO,CACL,QAAS,KAAK,QACd,KAAM,KAAK,KACX,MAAO,KAAK,MACZ,MAAO,KAAK,MACZ,OAAQ,KAAK,MACnB,CACE,CACF,CCnLO,MAAME,CAAgB,CAClB,OAAS,IAAIC,EAAAA,cAA6CJ,CAAe,EAEzE,MAAwC,IAAIK,EAAAA,MAE7C,MAKA,OAIA,KAIA,KAER,aAAc,CACZ,KAAK,MAAQ,CACX,QAAS,GACT,QAAS,KACT,UAAW,CAAA,EAEb,KAAK,OAAS,CACZ,MAAO,CAAA,EACP,MAAO,CAAA,CAAC,EAEV,KAAK,KAAO,CACV,MAAO,EACP,KAAM,CAAA,EAER,KAAK,KAAO,IAAIC,CAClB,CAEQ,sBAAuB,CAC7B,OAAK,KAAK,MAAM,QAGT,KAAK,KAAK,MAAQ,YAAY,MAAQ,KAAK,KAAK,OAF9C,KAAK,KAAK,IAGrB,CAEQ,kBAAkBC,EAA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AK,MAAM,KAAK,OAAQ,KAAK,sBAAsB,CACrD,CAKA,OAAQ,CACF,KAAK,MAAM,UACb,KAAK,KAAK,KAAO,KAAK,qBAAA,EACtB,KAAK,MAAM,QAAU,IAEnB,KAAK,MAAM,UAAY,OACzB,qBAAqB,KAAK,MAAM,OAAO,EACvC,KAAK,MAAM,QAAU,MAGvB,KAAK,MAAM,KAAK,QAAS,KAAK,sBAAsB,CACtD,CAKA,SAAU,CACR,KAAK,MAAA,EACL,KAAK,MAAM,MAAA,EAEX,KAAK,OAAO,MAAQ,CAAA,EACpB,KAAK,OAAO,MAAQ,CAAA,EAEpB,KAAK,KAAO,IAAIJ,CAClB,CAMA,mBAAmBI,EAAkD,CACnE,MAAMC,EAAgB,CAAA,EAChBJ,EAAkB,CAAA,EACxB,QAAS,EAAI,EAAG,EAAI,KAAK,KAAK,MAAM,OAAQ,IAAK,CAC/C,MAAMC,EAAO,KAAK,KAAK,MAAM,CAAC,EAC9B,GAAIA,EAAK,KAAK,MAAQE,EACpB,MAEE,KAAK,kBAAkB,CAAC,EAAIA,IAC9BC,EAAM,KAAKH,CAAI,EACfD,EAAM,KAAK,CAAC,EAEhB,CACA,MAAO,CAAE,MAAAI,EAAO,MAAAJ,CAAA,CAClB,CAKA,IAAI,gBAAiB,CACnB,OAAO,KAAK,MAAM,OACpB,CAKA,IAAI,cAAe,CACjB,MAAO,CAAC,GAAG,KAAK,OAAO,KAAK,CAC9B,CAKA,IAAI,cAAe,CACjB,MAAO,CAAC,GAAG,KAAK,OAAO,KAAK,CAC9B,CAKA,IAAI,eAAgB,CAClB,OAAO,KAAK,qBAAA,CACd,CAKA,IAAI,aAAc,CAChB,OAAO,KAAK,IACd,CAKA,IAAI,aAAc,CAChB,OAAO,KAAK,qBAAA,CACd,CACF","x_google_ignoreList":[1]}
1
+ {"version":3,"file":"index.comm.js","sources":["../src/options.ts","../../../node_modules/.pnpm/@music-lyric-kit+lyric@0.4.0/node_modules/@music-lyric-kit/lyric/dist/index.ecma.js","../src/index.ts"],"sourcesContent":["export interface Options {}\n\nexport const DEFAULT_OPTIONS: Options = {}\n","import { createRandomHex as r } from \"@music-lyric-kit/utils\";\nclass s {\n start = 0;\n end = 0;\n get duration() {\n return this.end - this.start;\n }\n toJSON() {\n return {\n start: this.start,\n end: this.end,\n duration: this.duration\n };\n }\n}\nvar o = /* @__PURE__ */ ((t) => (t.Normal = \"Normal\", t.Space = \"Space\", t))(o || {});\nclass i {\n stress = !1;\n toJSON() {\n return {\n stress: this.stress\n };\n }\n}\nclass p {\n get type() {\n return \"Normal\";\n }\n time = new s();\n content = \"\";\n extended = [];\n config = new i();\n toJSON() {\n return {\n type: this.type,\n time: this.time,\n content: this.content,\n extended: this.extended,\n config: this.config\n };\n }\n}\nclass N {\n get type() {\n return \"Space\";\n }\n count = 1;\n toJSON() {\n return {\n type: this.type,\n count: this.count\n };\n }\n}\nvar a = /* @__PURE__ */ ((t) => (t.UnKnown = \"UnKnown\", t.Translate = \"Translate\", t.Roman = \"Roman\", t))(a || {});\nclass S {\n type = \"UnKnown\";\n content = \"\";\n toJSON() {\n return {\n type: this.type,\n content: this.content\n };\n }\n}\nvar l = /* @__PURE__ */ ((t) => (t.Normal = \"Normal\", t.Interlude = \"Interlude\", t))(l || {});\nclass x {\n get type() {\n return \"Interlude\";\n }\n id = r(4).toUpperCase();\n time = new s();\n toJSON() {\n return {\n id: this.id,\n type: this.type,\n time: this.time\n };\n }\n}\nclass c {\n words = [];\n extended = [];\n get original() {\n return this.words.map((n) => n.type === o.Normal ? n.content : new Array(n.count).fill(\" \").join(\"\")).join(\"\");\n }\n toJSON() {\n return {\n words: this.words,\n extended: this.extended,\n original: this.original\n };\n }\n}\nclass y {\n get type() {\n return \"Normal\";\n }\n id = r(4).toUpperCase();\n time = new s();\n content = new c();\n agent;\n background;\n toJSON() {\n return {\n id: this.id,\n type: this.type,\n time: this.time,\n content: this.content,\n agent: this.agent,\n background: this.background\n };\n }\n}\nvar u = /* @__PURE__ */ ((t) => (t.Offset = \"Offset\", t.Duration = \"Duration\", t.Title = \"Title\", t.Singer = \"Singer\", t.Album = \"Album\", t.Creator = \"Creator\", t.UnKnown = \"UnKnown\", t))(u || {});\nclass e {\n id = r(4).toUpperCase();\n toJSON() {\n return {\n id: this.id,\n type: this.type,\n content: this.content\n };\n }\n}\nclass f extends e {\n get type() {\n return \"Offset\";\n }\n content = 0;\n}\nclass w extends e {\n get type() {\n return \"Duration\";\n }\n content = 0;\n}\nclass O extends e {\n get type() {\n return \"Title\";\n }\n content = \"\";\n}\nclass b extends e {\n get type() {\n return \"Singer\";\n }\n content = \"\";\n}\nclass J extends e {\n get type() {\n return \"Album\";\n }\n content = \"\";\n}\nclass U extends e {\n get type() {\n return \"Creator\";\n }\n content = {\n role: \"\",\n name: []\n };\n}\nclass C extends e {\n get type() {\n return \"UnKnown\";\n }\n content = \"\";\n}\nclass I {\n id = \"\";\n name = \"\";\n count = 0;\n}\nclass d {\n // index in global\n global = 0;\n // index in block\n block = 0;\n toJSON() {\n return {\n global: this.global,\n block: this.block\n };\n }\n}\nclass v {\n id = \"\";\n index = new d();\n toJSON() {\n return {\n id: this.id,\n index: this.index\n };\n }\n}\nconst m = \"0.5.1\";\nvar g = /* @__PURE__ */ ((t) => (t.Incorrect = \"Incorrect\", t.Normal = \"Normal\", t.Syllable = \"Syllable\", t.Pure = \"Pure\", t.Empty = \"Empty\", t.NoTime = \"NoTime\", t))(g || {});\nclass A {\n get version() {\n return m;\n }\n type = \"Incorrect\";\n metas = [];\n lines = [];\n agents = [];\n toJSON() {\n return {\n version: this.version,\n type: this.type,\n metas: this.metas,\n lines: this.lines,\n agents: this.agents\n };\n }\n}\nexport {\n I as Agent,\n v as AgentLine,\n d as AgentLineIndex,\n S as Extended,\n a as ExtendedType,\n A as Info,\n x as LineInterlude,\n y as LineNormal,\n c as LineNormalContent,\n l as LineType,\n J as MetaAlbum,\n U as MetaCreator,\n w as MetaDuration,\n f as MetaOffset,\n b as MetaSinger,\n O as MetaTitle,\n u as MetaType,\n C as MetaUnKnown,\n s as Time,\n g as Type,\n m as Version,\n p as WordNormal,\n N as WordSpace,\n o as WordType\n};\n//# sourceMappingURL=index.ecma.js.map\n","import type { Line } from '@music-lyric-kit/lyric'\nimport type { DeepPartial } from '@music-lyric-player/utils'\nimport type { Options } from './options'\n\nimport { DEFAULT_OPTIONS } from './options'\n\nimport { Info } from '@music-lyric-kit/lyric'\nimport { ConfigManager, Event } from '@music-lyric-player/utils'\n\nexport interface BaseLyricPlayerEventMap {\n /**\n * When the player starts or resumes playback.\n * @param currentTime The current playback time.\n */\n play: (currentTime: number) => void\n\n /**\n * When the player pauses playback.\n * @param currentTime The current playback time.\n */\n pause: (currentTime: number) => void\n\n /**\n * When the entire lyric information is updated (e.g., loading a new lyric/song).\n * @param info The newly loaded lyric information object.\n */\n lyricUpdate: (info: Info) => void\n\n /**\n * When the currently active lyric lines change during playback.\n * @param lines An array of the currently active lyric lines.\n * @param indexs An array of the currently active lyric lines' indexes.\n * @param firstIndex The index of the first currently active lyric line (-1 if none).\n * @param isSeek Is seek.\n */\n linesUpdate: (lines: Line[], indexs: number[], index: number, isSeek: boolean) => void\n}\n\nexport class BaseLyricPlayer {\n readonly config = new ConfigManager<Options, DeepPartial<Options>>(DEFAULT_OPTIONS)\n\n readonly event: Event<BaseLyricPlayerEventMap> = new Event()\n\n private state: {\n playing: boolean\n frameId: number | null\n scanIndex: number\n }\n private active: {\n lines: Line[]\n index: number[]\n }\n private time: {\n start: number\n seek: number\n }\n private info: Info\n\n constructor() {\n this.state = {\n playing: false,\n frameId: null,\n scanIndex: 0,\n }\n this.active = {\n lines: [],\n index: [],\n }\n this.time = {\n start: 0,\n seek: 0,\n }\n this.info = new Info()\n }\n\n private handleGetCurrentTime() {\n if (!this.state.playing) {\n return this.time.seek\n }\n return this.time.seek + (performance.now() - this.time.start)\n }\n\n private handleGetLineTime(index: number): number {\n if (index < 0 || index >= this.info.lines.length) {\n return 0\n }\n\n if (index === this.info.lines.length - 1) {\n return Infinity\n }\n\n const line = this.info.lines[index]\n const nextLine = this.info.lines[index + 1]\n return Math.max(line.time.end, nextLine.time.start)\n }\n\n private handleGetActiveIndex() {\n return this.active.index.length > 0 ? this.active.index[0] : -1\n }\n\n private handleSyncTime(time: number) {\n const lines: Line[] = []\n const index: number[] = []\n\n let firstIndex = this.info.lines.length\n for (let i = 0; i < this.info.lines.length; i++) {\n const line = this.info.lines[i]\n if (line.time.start > time) {\n firstIndex = i\n break\n }\n\n if (this.handleGetLineTime(i) > time) {\n lines.push(line)\n index.push(i)\n }\n }\n\n this.state.scanIndex = firstIndex\n\n this.active.lines = lines\n this.active.index = index\n\n this.event.emit('linesUpdate', [...this.active.lines], [...this.active.index], this.handleGetActiveIndex(), true)\n }\n\n private handleUpdateActiveLines(now: number) {\n let hasChanged = false\n\n const newActiveLines: Line[] = []\n const newActiveIndex: number[] = []\n\n for (let i = 0; i < this.active.lines.length; i++) {\n const line = this.active.lines[i]\n const infoIndex = this.active.index[i]\n\n if (now >= this.handleGetLineTime(infoIndex)) {\n hasChanged = true\n } else {\n newActiveLines.push(line)\n newActiveIndex.push(infoIndex)\n }\n }\n\n while (this.state.scanIndex < this.info.lines.length) {\n const nextLine = this.info.lines[this.state.scanIndex]\n if (now >= nextLine.time.start) {\n if (now < this.handleGetLineTime(this.state.scanIndex)) {\n newActiveLines.push(nextLine)\n newActiveIndex.push(this.state.scanIndex)\n hasChanged = true\n }\n this.state.scanIndex++\n } else {\n break\n }\n }\n\n if (!hasChanged) {\n return\n }\n\n this.active.lines = newActiveLines\n this.active.index = newActiveIndex\n this.event.emit('linesUpdate', [...this.active.lines], [...this.active.index], this.handleGetActiveIndex(), false)\n }\n\n private onTick = () => {\n if (!this.state.playing) {\n return\n }\n\n const now = this.handleGetCurrentTime()\n this.handleUpdateActiveLines(now)\n\n this.state.frameId = requestAnimationFrame(this.onTick)\n }\n\n updateLyric(info: Info) {\n if (!info) {\n return\n }\n\n this.pause()\n this.info = info\n\n this.active.lines = []\n this.active.index = []\n\n this.state.scanIndex = 0\n this.time.seek = 0\n\n this.event.emit('lyricUpdate', info)\n this.event.emit('linesUpdate', [], [], -1, false)\n }\n\n /**\n * Start playback\n * @param time Optional time in ms to seek to before starting playback. If not provided, playback will start from the current position.\n */\n play(time?: number) {\n this.pause()\n\n if (typeof time === 'number' && !Number.isNaN(time)) {\n this.time.seek = time\n this.handleSyncTime(time)\n }\n\n this.time.start = performance.now()\n this.state.playing = true\n this.onTick()\n\n this.event.emit('play', this.handleGetCurrentTime())\n }\n\n /**\n * Pause playback\n */\n pause() {\n if (this.state.playing) {\n this.time.seek = this.handleGetCurrentTime()\n this.state.playing = false\n }\n if (this.state.frameId !== null) {\n cancelAnimationFrame(this.state.frameId)\n this.state.frameId = null\n }\n\n this.event.emit('pause', this.handleGetCurrentTime())\n }\n\n /**\n * Stop playback\n */\n dispose() {\n this.pause()\n this.event.clear()\n\n this.active.lines = []\n this.active.index = []\n\n this.info = new Info()\n }\n\n /**\n * Find all active lines at the given time (ms). Does not mutate internal state.\n * @param time time in ms to find active lines for.\n */\n matchLinesWithTime(time: number): { lines: Line[]; index: number[] } {\n const lines: Line[] = []\n const index: number[] = []\n for (let i = 0; i < this.info.lines.length; i++) {\n const line = this.info.lines[i]\n if (line.time.start > time) {\n break\n }\n if (this.handleGetLineTime(i) > time) {\n lines.push(line)\n index.push(i)\n }\n }\n return { lines, index }\n }\n\n /**\n * Whether the player is currently playing.\n */\n get currentPlaying() {\n return this.state.playing\n }\n\n /**\n * Current active lines.\n */\n get currentLines() {\n return [...this.active.lines]\n }\n\n /**\n * Indices of currently active lines.\n */\n get currentIndex() {\n return [...this.active.index]\n }\n\n /**\n * The index of the primary active line, or -1 if none.\n */\n get currentActive() {\n return this.handleGetActiveIndex()\n }\n\n /**\n * The current lyric info object.\n */\n get currentInfo() {\n return this.info\n }\n\n /**\n * The current playback time in ms.\n */\n get currentTime() {\n return this.handleGetCurrentTime()\n }\n}\n"],"names":["DEFAULT_OPTIONS","m","A","BaseLyricPlayer","ConfigManager","Event","Info","index","line","nextLine","time","lines","firstIndex","i","now","hasChanged","newActiveLines","newActiveIndex","infoIndex","info"],"mappings":"kJAEaA,EAA2B,CAAA,ECmMlCC,EAAI,QAEV,MAAMC,CAAE,CACN,IAAI,SAAU,CACZ,OAAOD,CACT,CACA,KAAO,YACP,MAAQ,CAAA,EACR,MAAQ,CAAA,EACR,OAAS,CAAA,EACT,QAAS,CACP,MAAO,CACL,QAAS,KAAK,QACd,KAAM,KAAK,KACX,MAAO,KAAK,MACZ,MAAO,KAAK,MACZ,OAAQ,KAAK,MACnB,CACE,CACF,CClLO,MAAME,CAAgB,CAClB,OAAS,IAAIC,EAAAA,cAA6CJ,CAAe,EAEzE,MAAwC,IAAIK,EAAAA,MAE7C,MAKA,OAIA,KAIA,KAER,aAAc,CACZ,KAAK,MAAQ,CACX,QAAS,GACT,QAAS,KACT,UAAW,CAAA,EAEb,KAAK,OAAS,CACZ,MAAO,CAAA,EACP,MAAO,CAAA,CAAC,EAEV,KAAK,KAAO,CACV,MAAO,EACP,KAAM,CAAA,EAER,KAAK,KAAO,IAAIC,CAClB,CAEQ,sBAAuB,CAC7B,OAAK,KAAK,MAAM,QAGT,KAAK,KAAK,MAAQ,YAAY,MAAQ,KAAK,KAAK,OAF9C,KAAK,KAAK,IAGrB,CAEQ,kBAAkBC,EAAuB,CAC/C,GAAIA,EAAQ,GAAKA,GAAS,KAAK,KAAK,MAAM,OACxC,MAAO,GAGT,GAAIA,IAAU,KAAK,KAAK,MAAM,OAAS,EACrC,MAAO,KAGT,MAAMC,EAAO,KAAK,KAAK,MAAMD,CAAK,EAC5BE,EAAW,KAAK,KAAK,MAAMF,EAAQ,CAAC,EAC1C,OAAO,KAAK,IAAIC,EAAK,KAAK,IAAKC,EAAS,KAAK,KAAK,CACpD,CAEQ,sBAAuB,CAC7B,OAAO,KAAK,OAAO,MAAM,OAAS,EAAI,KAAK,OAAO,MAAM,CAAC,EAAI,EAC/D,CA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AAK,OAAO,MAAQ,CAAA,EAEpB,KAAK,KAAO,IAAIJ,CAClB,CAMA,mBAAmBI,EAAkD,CACnE,MAAMC,EAAgB,CAAA,EAChBJ,EAAkB,CAAA,EACxB,QAAS,EAAI,EAAG,EAAI,KAAK,KAAK,MAAM,OAAQ,IAAK,CAC/C,MAAMC,EAAO,KAAK,KAAK,MAAM,CAAC,EAC9B,GAAIA,EAAK,KAAK,MAAQE,EACpB,MAEE,KAAK,kBAAkB,CAAC,EAAIA,IAC9BC,EAAM,KAAKH,CAAI,EACfD,EAAM,KAAK,CAAC,EAEhB,CACA,MAAO,CAAE,MAAAI,EAAO,MAAAJ,CAAA,CAClB,CAKA,IAAI,gBAAiB,CACnB,OAAO,KAAK,MAAM,OACpB,CAKA,IAAI,cAAe,CACjB,MAAO,CAAC,GAAG,KAAK,OAAO,KAAK,CAC9B,CAKA,IAAI,cAAe,CACjB,MAAO,CAAC,GAAG,KAAK,OAAO,KAAK,CAC9B,CAKA,IAAI,eAAgB,CAClB,OAAO,KAAK,qBAAA,CACd,CAKA,IAAI,aAAc,CAChB,OAAO,KAAK,IACd,CAKA,IAAI,aAAc,CAChB,OAAO,KAAK,qBAAA,CACd,CACF","x_google_ignoreList":[1]}
@@ -86,8 +86,9 @@ export declare interface BaseLyricPlayerEventMap {
86
86
  * @param lines An array of the currently active lyric lines.
87
87
  * @param indexs An array of the currently active lyric lines' indexes.
88
88
  * @param firstIndex The index of the first currently active lyric line (-1 if none).
89
+ * @param isSeek Is seek.
89
90
  */
90
- linesUpdate: (lines: Line[], indexs: number[], index: number) => void;
91
+ linesUpdate: (lines: Line[], indexs: number[], index: number, isSeek: boolean) => void;
91
92
  }
92
93
 
93
94
  declare interface Options {
@@ -64,7 +64,7 @@ class v {
64
64
  }
65
65
  this.handleGetLineTime(t) > e && (n.push(a), s.push(t));
66
66
  }
67
- this.state.scanIndex = i, this.active.lines = n, this.active.index = s, this.event.emit("linesUpdate", [...this.active.lines], [...this.active.index], this.handleGetActiveIndex());
67
+ this.state.scanIndex = i, this.active.lines = n, this.active.index = s, this.event.emit("linesUpdate", [...this.active.lines], [...this.active.index], this.handleGetActiveIndex(), !0);
68
68
  }
69
69
  handleUpdateActiveLines(e) {
70
70
  let n = !1;
@@ -80,7 +80,7 @@ class v {
80
80
  else
81
81
  break;
82
82
  }
83
- n && (this.active.lines = s, this.active.index = i, this.event.emit("linesUpdate", [...this.active.lines], [...this.active.index], this.handleGetActiveIndex()));
83
+ n && (this.active.lines = s, this.active.index = i, this.event.emit("linesUpdate", [...this.active.lines], [...this.active.index], this.handleGetActiveIndex(), !1));
84
84
  }
85
85
  onTick = () => {
86
86
  if (!this.state.playing)
@@ -89,7 +89,7 @@ class v {
89
89
  this.handleUpdateActiveLines(e), this.state.frameId = requestAnimationFrame(this.onTick);
90
90
  };
91
91
  updateLyric(e) {
92
- e && (this.pause(), this.info = e, this.active.lines = [], this.active.index = [], this.state.scanIndex = 0, this.time.seek = 0, this.event.emit("lyricUpdate", e), this.event.emit("linesUpdate", [], [], -1));
92
+ e && (this.pause(), this.info = e, this.active.lines = [], this.active.index = [], this.state.scanIndex = 0, this.time.seek = 0, this.event.emit("lyricUpdate", e), this.event.emit("linesUpdate", [], [], -1, !1));
93
93
  }
94
94
  /**
95
95
  * Start playback
@@ -1 +1 @@
1
- {"version":3,"file":"index.ecma.js","sources":["../src/options.ts","../../../node_modules/.pnpm/@music-lyric-kit+lyric@0.4.0/node_modules/@music-lyric-kit/lyric/dist/index.ecma.js","../src/index.ts"],"sourcesContent":["export interface Options {}\n\nexport const DEFAULT_OPTIONS: Options = {}\n","import { createRandomHex as r } from \"@music-lyric-kit/utils\";\nclass s {\n start = 0;\n end = 0;\n get duration() {\n return this.end - this.start;\n }\n toJSON() {\n return {\n start: this.start,\n end: this.end,\n duration: this.duration\n };\n }\n}\nvar o = /* @__PURE__ */ ((t) => (t.Normal = \"Normal\", t.Space = \"Space\", t))(o || {});\nclass i {\n stress = !1;\n toJSON() {\n return {\n stress: this.stress\n };\n }\n}\nclass p {\n get type() {\n return \"Normal\";\n }\n time = new s();\n content = \"\";\n extended = [];\n config = new i();\n toJSON() {\n return {\n type: this.type,\n time: this.time,\n content: this.content,\n extended: this.extended,\n config: this.config\n };\n }\n}\nclass N {\n get type() {\n return \"Space\";\n }\n count = 1;\n toJSON() {\n return {\n type: this.type,\n count: this.count\n };\n }\n}\nvar a = /* @__PURE__ */ ((t) => (t.UnKnown = \"UnKnown\", t.Translate = \"Translate\", t.Roman = \"Roman\", t))(a || {});\nclass S {\n type = \"UnKnown\";\n content = \"\";\n toJSON() {\n return {\n type: this.type,\n content: this.content\n };\n }\n}\nvar l = /* @__PURE__ */ ((t) => (t.Normal = \"Normal\", t.Interlude = \"Interlude\", t))(l || {});\nclass x {\n get type() {\n return \"Interlude\";\n }\n id = r(4).toUpperCase();\n time = new s();\n toJSON() {\n return {\n id: this.id,\n type: this.type,\n time: this.time\n };\n }\n}\nclass c {\n words = [];\n extended = [];\n get original() {\n return this.words.map((n) => n.type === o.Normal ? n.content : new Array(n.count).fill(\" \").join(\"\")).join(\"\");\n }\n toJSON() {\n return {\n words: this.words,\n extended: this.extended,\n original: this.original\n };\n }\n}\nclass y {\n get type() {\n return \"Normal\";\n }\n id = r(4).toUpperCase();\n time = new s();\n content = new c();\n agent;\n background;\n toJSON() {\n return {\n id: this.id,\n type: this.type,\n time: this.time,\n content: this.content,\n agent: this.agent,\n background: this.background\n };\n }\n}\nvar u = /* @__PURE__ */ ((t) => (t.Offset = \"Offset\", t.Duration = \"Duration\", t.Title = \"Title\", t.Singer = \"Singer\", t.Album = \"Album\", t.Creator = \"Creator\", t.UnKnown = \"UnKnown\", t))(u || {});\nclass e {\n id = r(4).toUpperCase();\n toJSON() {\n return {\n id: this.id,\n type: this.type,\n content: this.content\n };\n }\n}\nclass f extends e {\n get type() {\n return \"Offset\";\n }\n content = 0;\n}\nclass w extends e {\n get type() {\n return \"Duration\";\n }\n content = 0;\n}\nclass O extends e {\n get type() {\n return \"Title\";\n }\n content = \"\";\n}\nclass b extends e {\n get type() {\n return \"Singer\";\n }\n content = \"\";\n}\nclass J extends e {\n get type() {\n return \"Album\";\n }\n content = \"\";\n}\nclass U extends e {\n get type() {\n return \"Creator\";\n }\n content = {\n role: \"\",\n name: []\n };\n}\nclass C extends e {\n get type() {\n return \"UnKnown\";\n }\n content = \"\";\n}\nclass I {\n id = \"\";\n name = \"\";\n count = 0;\n}\nclass d {\n // index in global\n global = 0;\n // index in block\n block = 0;\n toJSON() {\n return {\n global: this.global,\n block: this.block\n };\n }\n}\nclass v {\n id = \"\";\n index = new d();\n toJSON() {\n return {\n id: this.id,\n index: this.index\n };\n }\n}\nconst m = \"0.5.1\";\nvar g = /* @__PURE__ */ ((t) => (t.Incorrect = \"Incorrect\", t.Normal = \"Normal\", t.Syllable = \"Syllable\", t.Pure = \"Pure\", t.Empty = \"Empty\", t.NoTime = \"NoTime\", t))(g || {});\nclass A {\n get version() {\n return m;\n }\n type = \"Incorrect\";\n metas = [];\n lines = [];\n agents = [];\n toJSON() {\n return {\n version: this.version,\n type: this.type,\n metas: this.metas,\n lines: this.lines,\n agents: this.agents\n };\n }\n}\nexport {\n I as Agent,\n v as AgentLine,\n d as AgentLineIndex,\n S as Extended,\n a as ExtendedType,\n A as Info,\n x as LineInterlude,\n y as LineNormal,\n c as LineNormalContent,\n l as LineType,\n J as MetaAlbum,\n U as MetaCreator,\n w as MetaDuration,\n f as MetaOffset,\n b as MetaSinger,\n O as MetaTitle,\n u as MetaType,\n C as MetaUnKnown,\n s as Time,\n g as Type,\n m as Version,\n p as WordNormal,\n N as WordSpace,\n o as WordType\n};\n//# sourceMappingURL=index.ecma.js.map\n","import type { Line } from '@music-lyric-kit/lyric'\nimport type { DeepPartial } from '@music-lyric-player/utils'\nimport type { Options } from './options'\n\nimport { DEFAULT_OPTIONS } from './options'\n\nimport { Info } from '@music-lyric-kit/lyric'\nimport { ConfigManager, Event } from '@music-lyric-player/utils'\n\nexport interface BaseLyricPlayerEventMap {\n /**\n * When the player starts or resumes playback.\n * @param currentTime The current playback time.\n */\n play: (currentTime: number) => void\n\n /**\n * When the player pauses playback.\n * @param currentTime The current playback time.\n */\n pause: (currentTime: number) => void\n\n /**\n * When the entire lyric information is updated (e.g., loading a new lyric/song).\n * @param info The newly loaded lyric information object.\n */\n lyricUpdate: (info: Info) => void\n\n /**\n * When the currently active lyric lines change during playback.\n * @param lines An array of the currently active lyric lines.\n * @param indexs An array of the currently active lyric lines' indexes.\n * @param firstIndex The index of the first currently active lyric line (-1 if none).\n */\n linesUpdate: (lines: Line[], indexs: number[], index: number) => void\n}\n\nexport class BaseLyricPlayer {\n readonly config = new ConfigManager<Options, DeepPartial<Options>>(DEFAULT_OPTIONS)\n\n readonly event: Event<BaseLyricPlayerEventMap> = new Event()\n\n private state: {\n playing: boolean\n frameId: number | null\n scanIndex: number\n }\n private active: {\n lines: Line[]\n index: number[]\n }\n private time: {\n start: number\n seek: number\n }\n private info: Info\n\n constructor() {\n this.state = {\n playing: false,\n frameId: null,\n scanIndex: 0,\n }\n this.active = {\n lines: [],\n index: [],\n }\n this.time = {\n start: 0,\n seek: 0,\n }\n this.info = new Info()\n }\n\n private handleGetCurrentTime() {\n if (!this.state.playing) {\n return this.time.seek\n }\n return this.time.seek + (performance.now() - this.time.start)\n }\n\n private handleGetLineTime(index: number): number {\n if (index < 0 || index >= this.info.lines.length) {\n return 0\n }\n\n if (index === this.info.lines.length - 1) {\n return Infinity\n }\n\n const line = this.info.lines[index]\n const nextLine = this.info.lines[index + 1]\n return Math.max(line.time.end, nextLine.time.start)\n }\n\n private handleGetActiveIndex() {\n return this.active.index.length > 0 ? this.active.index[0] : -1\n }\n\n private handleSyncTime(time: number) {\n const lines: Line[] = []\n const index: number[] = []\n\n let firstIndex = this.info.lines.length\n for (let i = 0; i < this.info.lines.length; i++) {\n const line = this.info.lines[i]\n if (line.time.start > time) {\n firstIndex = i\n break\n }\n\n if (this.handleGetLineTime(i) > time) {\n lines.push(line)\n index.push(i)\n }\n }\n\n this.state.scanIndex = firstIndex\n\n this.active.lines = lines\n this.active.index = index\n\n this.event.emit('linesUpdate', [...this.active.lines], [...this.active.index], this.handleGetActiveIndex())\n }\n\n private handleUpdateActiveLines(now: number) {\n let hasChanged = false\n\n const newActiveLines: Line[] = []\n const newActiveIndex: number[] = []\n\n for (let i = 0; i < this.active.lines.length; i++) {\n const line = this.active.lines[i]\n const infoIndex = this.active.index[i]\n\n if (now >= this.handleGetLineTime(infoIndex)) {\n hasChanged = true\n } else {\n newActiveLines.push(line)\n newActiveIndex.push(infoIndex)\n }\n }\n\n while (this.state.scanIndex < this.info.lines.length) {\n const nextLine = this.info.lines[this.state.scanIndex]\n if (now >= nextLine.time.start) {\n if (now < this.handleGetLineTime(this.state.scanIndex)) {\n newActiveLines.push(nextLine)\n newActiveIndex.push(this.state.scanIndex)\n hasChanged = true\n }\n this.state.scanIndex++\n } else {\n break\n }\n }\n\n if (!hasChanged) {\n return\n }\n\n this.active.lines = newActiveLines\n this.active.index = newActiveIndex\n this.event.emit('linesUpdate', [...this.active.lines], [...this.active.index], this.handleGetActiveIndex())\n }\n\n private onTick = () => {\n if (!this.state.playing) {\n return\n }\n\n const now = this.handleGetCurrentTime()\n this.handleUpdateActiveLines(now)\n\n this.state.frameId = requestAnimationFrame(this.onTick)\n }\n\n updateLyric(info: Info) {\n if (!info) {\n return\n }\n\n this.pause()\n this.info = info\n\n this.active.lines = []\n this.active.index = []\n\n this.state.scanIndex = 0\n this.time.seek = 0\n\n this.event.emit('lyricUpdate', info)\n this.event.emit('linesUpdate', [], [], -1)\n }\n\n /**\n * Start playback\n * @param time Optional time in ms to seek to before starting playback. If not provided, playback will start from the current position.\n */\n play(time?: number) {\n this.pause()\n\n if (typeof time === 'number' && !Number.isNaN(time)) {\n this.time.seek = time\n this.handleSyncTime(time)\n }\n\n this.time.start = performance.now()\n this.state.playing = true\n this.onTick()\n\n this.event.emit('play', this.handleGetCurrentTime())\n }\n\n /**\n * Pause playback\n */\n pause() {\n if (this.state.playing) {\n this.time.seek = this.handleGetCurrentTime()\n this.state.playing = false\n }\n if (this.state.frameId !== null) {\n cancelAnimationFrame(this.state.frameId)\n this.state.frameId = null\n }\n\n this.event.emit('pause', this.handleGetCurrentTime())\n }\n\n /**\n * Stop playback\n */\n dispose() {\n this.pause()\n this.event.clear()\n\n this.active.lines = []\n this.active.index = []\n\n this.info = new Info()\n }\n\n /**\n * Find all active lines at the given time (ms). Does not mutate internal state.\n * @param time time in ms to find active lines for.\n */\n matchLinesWithTime(time: number): { lines: Line[]; index: number[] } {\n const lines: Line[] = []\n const index: number[] = []\n for (let i = 0; i < this.info.lines.length; i++) {\n const line = this.info.lines[i]\n if (line.time.start > time) {\n break\n }\n if (this.handleGetLineTime(i) > time) {\n lines.push(line)\n index.push(i)\n }\n }\n return { lines, index }\n }\n\n /**\n * Whether the player is currently playing.\n */\n get currentPlaying() {\n return this.state.playing\n }\n\n /**\n * Current active lines.\n */\n get currentLines() {\n return [...this.active.lines]\n }\n\n /**\n * Indices of currently active lines.\n */\n get currentIndex() {\n return [...this.active.index]\n }\n\n /**\n * The index of the primary active line, or -1 if none.\n */\n get currentActive() {\n return this.handleGetActiveIndex()\n }\n\n /**\n * The current lyric info object.\n */\n get currentInfo() {\n return this.info\n }\n\n /**\n * The current playback time in ms.\n */\n get currentTime() {\n return this.handleGetCurrentTime()\n }\n}\n"],"names":["DEFAULT_OPTIONS","m","A","BaseLyricPlayer","ConfigManager","Event","Info","index","line","nextLine","time","lines","firstIndex","i","now","hasChanged","newActiveLines","newActiveIndex","infoIndex","info"],"mappings":";;AAEO,MAAMA,IAA2B,CAAA,GCmMlCC,IAAI;AAEV,MAAMC,EAAE;AAAA,EACN,IAAI,UAAU;AACZ,WAAOD;AAAA,EACT;AAAA,EACA,OAAO;AAAA,EACP,QAAQ,CAAA;AAAA,EACR,QAAQ,CAAA;AAAA,EACR,SAAS,CAAA;AAAA,EACT,SAAS;AACP,WAAO;AAAA,MACL,SAA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AA,GACL,KAAK,MAAM,MAAA,GAEX,KAAK,OAAO,QAAQ,CAAA,GACpB,KAAK,OAAO,QAAQ,CAAA,GAEpB,KAAK,OAAO,IAAIJ,EAAA;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,mBAAmBI,GAAkD;AACnE,UAAMC,IAAgB,CAAA,GAChBJ,IAAkB,CAAA;AACxB,aAAS,IAAI,GAAG,IAAI,KAAK,KAAK,MAAM,QAAQ,KAAK;AAC/C,YAAMC,IAAO,KAAK,KAAK,MAAM,CAAC;AAC9B,UAAIA,EAAK,KAAK,QAAQE;AACpB;AAEF,MAAI,KAAK,kBAAkB,CAAC,IAAIA,MAC9BC,EAAM,KAAKH,CAAI,GACfD,EAAM,KAAK,CAAC;AAAA,IAEhB;AACA,WAAO,EAAE,OAAAI,GAAO,OAAAJ,EAAA;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,iBAAiB;AACnB,WAAO,KAAK,MAAM;AAAA,EACpB;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,eAAe;AACjB,WAAO,CAAC,GAAG,KAAK,OAAO,KAAK;AAAA,EAC9B;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,eAAe;AACjB,WAAO,CAAC,GAAG,KAAK,OAAO,KAAK;AAAA,EAC9B;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,gBAAgB;AAClB,WAAO,KAAK,qBAAA;AAAA,EACd;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,cAAc;AAChB,WAAO,KAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,cAAc;AAChB,WAAO,KAAK,qBAAA;AAAA,EACd;AACF;","x_google_ignoreList":[1]}
1
+ {"version":3,"file":"index.ecma.js","sources":["../src/options.ts","../../../node_modules/.pnpm/@music-lyric-kit+lyric@0.4.0/node_modules/@music-lyric-kit/lyric/dist/index.ecma.js","../src/index.ts"],"sourcesContent":["export interface Options {}\n\nexport const DEFAULT_OPTIONS: Options = {}\n","import { createRandomHex as r } from \"@music-lyric-kit/utils\";\nclass s {\n start = 0;\n end = 0;\n get duration() {\n return this.end - this.start;\n }\n toJSON() {\n return {\n start: this.start,\n end: this.end,\n duration: this.duration\n };\n }\n}\nvar o = /* @__PURE__ */ ((t) => (t.Normal = \"Normal\", t.Space = \"Space\", t))(o || {});\nclass i {\n stress = !1;\n toJSON() {\n return {\n stress: this.stress\n };\n }\n}\nclass p {\n get type() {\n return \"Normal\";\n }\n time = new s();\n content = \"\";\n extended = [];\n config = new i();\n toJSON() {\n return {\n type: this.type,\n time: this.time,\n content: this.content,\n extended: this.extended,\n config: this.config\n };\n }\n}\nclass N {\n get type() {\n return \"Space\";\n }\n count = 1;\n toJSON() {\n return {\n type: this.type,\n count: this.count\n };\n }\n}\nvar a = /* @__PURE__ */ ((t) => (t.UnKnown = \"UnKnown\", t.Translate = \"Translate\", t.Roman = \"Roman\", t))(a || {});\nclass S {\n type = \"UnKnown\";\n content = \"\";\n toJSON() {\n return {\n type: this.type,\n content: this.content\n };\n }\n}\nvar l = /* @__PURE__ */ ((t) => (t.Normal = \"Normal\", t.Interlude = \"Interlude\", t))(l || {});\nclass x {\n get type() {\n return \"Interlude\";\n }\n id = r(4).toUpperCase();\n time = new s();\n toJSON() {\n return {\n id: this.id,\n type: this.type,\n time: this.time\n };\n }\n}\nclass c {\n words = [];\n extended = [];\n get original() {\n return this.words.map((n) => n.type === o.Normal ? n.content : new Array(n.count).fill(\" \").join(\"\")).join(\"\");\n }\n toJSON() {\n return {\n words: this.words,\n extended: this.extended,\n original: this.original\n };\n }\n}\nclass y {\n get type() {\n return \"Normal\";\n }\n id = r(4).toUpperCase();\n time = new s();\n content = new c();\n agent;\n background;\n toJSON() {\n return {\n id: this.id,\n type: this.type,\n time: this.time,\n content: this.content,\n agent: this.agent,\n background: this.background\n };\n }\n}\nvar u = /* @__PURE__ */ ((t) => (t.Offset = \"Offset\", t.Duration = \"Duration\", t.Title = \"Title\", t.Singer = \"Singer\", t.Album = \"Album\", t.Creator = \"Creator\", t.UnKnown = \"UnKnown\", t))(u || {});\nclass e {\n id = r(4).toUpperCase();\n toJSON() {\n return {\n id: this.id,\n type: this.type,\n content: this.content\n };\n }\n}\nclass f extends e {\n get type() {\n return \"Offset\";\n }\n content = 0;\n}\nclass w extends e {\n get type() {\n return \"Duration\";\n }\n content = 0;\n}\nclass O extends e {\n get type() {\n return \"Title\";\n }\n content = \"\";\n}\nclass b extends e {\n get type() {\n return \"Singer\";\n }\n content = \"\";\n}\nclass J extends e {\n get type() {\n return \"Album\";\n }\n content = \"\";\n}\nclass U extends e {\n get type() {\n return \"Creator\";\n }\n content = {\n role: \"\",\n name: []\n };\n}\nclass C extends e {\n get type() {\n return \"UnKnown\";\n }\n content = \"\";\n}\nclass I {\n id = \"\";\n name = \"\";\n count = 0;\n}\nclass d {\n // index in global\n global = 0;\n // index in block\n block = 0;\n toJSON() {\n return {\n global: this.global,\n block: this.block\n };\n }\n}\nclass v {\n id = \"\";\n index = new d();\n toJSON() {\n return {\n id: this.id,\n index: this.index\n };\n }\n}\nconst m = \"0.5.1\";\nvar g = /* @__PURE__ */ ((t) => (t.Incorrect = \"Incorrect\", t.Normal = \"Normal\", t.Syllable = \"Syllable\", t.Pure = \"Pure\", t.Empty = \"Empty\", t.NoTime = \"NoTime\", t))(g || {});\nclass A {\n get version() {\n return m;\n }\n type = \"Incorrect\";\n metas = [];\n lines = [];\n agents = [];\n toJSON() {\n return {\n version: this.version,\n type: this.type,\n metas: this.metas,\n lines: this.lines,\n agents: this.agents\n };\n }\n}\nexport {\n I as Agent,\n v as AgentLine,\n d as AgentLineIndex,\n S as Extended,\n a as ExtendedType,\n A as Info,\n x as LineInterlude,\n y as LineNormal,\n c as LineNormalContent,\n l as LineType,\n J as MetaAlbum,\n U as MetaCreator,\n w as MetaDuration,\n f as MetaOffset,\n b as MetaSinger,\n O as MetaTitle,\n u as MetaType,\n C as MetaUnKnown,\n s as Time,\n g as Type,\n m as Version,\n p as WordNormal,\n N as WordSpace,\n o as WordType\n};\n//# sourceMappingURL=index.ecma.js.map\n","import type { Line } from '@music-lyric-kit/lyric'\nimport type { DeepPartial } from '@music-lyric-player/utils'\nimport type { Options } from './options'\n\nimport { DEFAULT_OPTIONS } from './options'\n\nimport { Info } from '@music-lyric-kit/lyric'\nimport { ConfigManager, Event } from '@music-lyric-player/utils'\n\nexport interface BaseLyricPlayerEventMap {\n /**\n * When the player starts or resumes playback.\n * @param currentTime The current playback time.\n */\n play: (currentTime: number) => void\n\n /**\n * When the player pauses playback.\n * @param currentTime The current playback time.\n */\n pause: (currentTime: number) => void\n\n /**\n * When the entire lyric information is updated (e.g., loading a new lyric/song).\n * @param info The newly loaded lyric information object.\n */\n lyricUpdate: (info: Info) => void\n\n /**\n * When the currently active lyric lines change during playback.\n * @param lines An array of the currently active lyric lines.\n * @param indexs An array of the currently active lyric lines' indexes.\n * @param firstIndex The index of the first currently active lyric line (-1 if none).\n * @param isSeek Is seek.\n */\n linesUpdate: (lines: Line[], indexs: number[], index: number, isSeek: boolean) => void\n}\n\nexport class BaseLyricPlayer {\n readonly config = new ConfigManager<Options, DeepPartial<Options>>(DEFAULT_OPTIONS)\n\n readonly event: Event<BaseLyricPlayerEventMap> = new Event()\n\n private state: {\n playing: boolean\n frameId: number | null\n scanIndex: number\n }\n private active: {\n lines: Line[]\n index: number[]\n }\n private time: {\n start: number\n seek: number\n }\n private info: Info\n\n constructor() {\n this.state = {\n playing: false,\n frameId: null,\n scanIndex: 0,\n }\n this.active = {\n lines: [],\n index: [],\n }\n this.time = {\n start: 0,\n seek: 0,\n }\n this.info = new Info()\n }\n\n private handleGetCurrentTime() {\n if (!this.state.playing) {\n return this.time.seek\n }\n return this.time.seek + (performance.now() - this.time.start)\n }\n\n private handleGetLineTime(index: number): number {\n if (index < 0 || index >= this.info.lines.length) {\n return 0\n }\n\n if (index === this.info.lines.length - 1) {\n return Infinity\n }\n\n const line = this.info.lines[index]\n const nextLine = this.info.lines[index + 1]\n return Math.max(line.time.end, nextLine.time.start)\n }\n\n private handleGetActiveIndex() {\n return this.active.index.length > 0 ? this.active.index[0] : -1\n }\n\n private handleSyncTime(time: number) {\n const lines: Line[] = []\n const index: number[] = []\n\n let firstIndex = this.info.lines.length\n for (let i = 0; i < this.info.lines.length; i++) {\n const line = this.info.lines[i]\n if (line.time.start > time) {\n firstIndex = i\n break\n }\n\n if (this.handleGetLineTime(i) > time) {\n lines.push(line)\n index.push(i)\n }\n }\n\n this.state.scanIndex = firstIndex\n\n this.active.lines = lines\n this.active.index = index\n\n this.event.emit('linesUpdate', [...this.active.lines], [...this.active.index], this.handleGetActiveIndex(), true)\n }\n\n private handleUpdateActiveLines(now: number) {\n let hasChanged = false\n\n const newActiveLines: Line[] = []\n const newActiveIndex: number[] = []\n\n for (let i = 0; i < this.active.lines.length; i++) {\n const line = this.active.lines[i]\n const infoIndex = this.active.index[i]\n\n if (now >= this.handleGetLineTime(infoIndex)) {\n hasChanged = true\n } else {\n newActiveLines.push(line)\n newActiveIndex.push(infoIndex)\n }\n }\n\n while (this.state.scanIndex < this.info.lines.length) {\n const nextLine = this.info.lines[this.state.scanIndex]\n if (now >= nextLine.time.start) {\n if (now < this.handleGetLineTime(this.state.scanIndex)) {\n newActiveLines.push(nextLine)\n newActiveIndex.push(this.state.scanIndex)\n hasChanged = true\n }\n this.state.scanIndex++\n } else {\n break\n }\n }\n\n if (!hasChanged) {\n return\n }\n\n this.active.lines = newActiveLines\n this.active.index = newActiveIndex\n this.event.emit('linesUpdate', [...this.active.lines], [...this.active.index], this.handleGetActiveIndex(), false)\n }\n\n private onTick = () => {\n if (!this.state.playing) {\n return\n }\n\n const now = this.handleGetCurrentTime()\n this.handleUpdateActiveLines(now)\n\n this.state.frameId = requestAnimationFrame(this.onTick)\n }\n\n updateLyric(info: Info) {\n if (!info) {\n return\n }\n\n this.pause()\n this.info = info\n\n this.active.lines = []\n this.active.index = []\n\n this.state.scanIndex = 0\n this.time.seek = 0\n\n this.event.emit('lyricUpdate', info)\n this.event.emit('linesUpdate', [], [], -1, false)\n }\n\n /**\n * Start playback\n * @param time Optional time in ms to seek to before starting playback. If not provided, playback will start from the current position.\n */\n play(time?: number) {\n this.pause()\n\n if (typeof time === 'number' && !Number.isNaN(time)) {\n this.time.seek = time\n this.handleSyncTime(time)\n }\n\n this.time.start = performance.now()\n this.state.playing = true\n this.onTick()\n\n this.event.emit('play', this.handleGetCurrentTime())\n }\n\n /**\n * Pause playback\n */\n pause() {\n if (this.state.playing) {\n this.time.seek = this.handleGetCurrentTime()\n this.state.playing = false\n }\n if (this.state.frameId !== null) {\n cancelAnimationFrame(this.state.frameId)\n this.state.frameId = null\n }\n\n this.event.emit('pause', this.handleGetCurrentTime())\n }\n\n /**\n * Stop playback\n */\n dispose() {\n this.pause()\n this.event.clear()\n\n this.active.lines = []\n this.active.index = []\n\n this.info = new Info()\n }\n\n /**\n * Find all active lines at the given time (ms). Does not mutate internal state.\n * @param time time in ms to find active lines for.\n */\n matchLinesWithTime(time: number): { lines: Line[]; index: number[] } {\n const lines: Line[] = []\n const index: number[] = []\n for (let i = 0; i < this.info.lines.length; i++) {\n const line = this.info.lines[i]\n if (line.time.start > time) {\n break\n }\n if (this.handleGetLineTime(i) > time) {\n lines.push(line)\n index.push(i)\n }\n }\n return { lines, index }\n }\n\n /**\n * Whether the player is currently playing.\n */\n get currentPlaying() {\n return this.state.playing\n }\n\n /**\n * Current active lines.\n */\n get currentLines() {\n return [...this.active.lines]\n }\n\n /**\n * Indices of currently active lines.\n */\n get currentIndex() {\n return [...this.active.index]\n }\n\n /**\n * The index of the primary active line, or -1 if none.\n */\n get currentActive() {\n return this.handleGetActiveIndex()\n }\n\n /**\n * The current lyric info object.\n */\n get currentInfo() {\n return this.info\n }\n\n /**\n * The current playback time in ms.\n */\n get currentTime() {\n return this.handleGetCurrentTime()\n }\n}\n"],"names":["DEFAULT_OPTIONS","m","A","BaseLyricPlayer","ConfigManager","Event","Info","index","line","nextLine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AAAA;AAAA;AAAA,EAKA,IAAI,cAAc;AAChB,WAAO,KAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,cAAc;AAChB,WAAO,KAAK,qBAAA;AAAA,EACd;AACF;","x_google_ignoreList":[1]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@music-lyric-player/base",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "author": "folltoshe",
5
5
  "type": "module",
6
6
  "description": "Music Lyric Player - Base Player",
@@ -32,7 +32,7 @@
32
32
  "@music-lyric-kit/lyric": "^0.4.0"
33
33
  },
34
34
  "dependencies": {
35
- "@music-lyric-player/utils": "^0.3.0"
35
+ "@music-lyric-player/utils": "^0.4.0"
36
36
  },
37
37
  "scripts": {
38
38
  "build": "vite build"