@meersagor/wavesurfer-vue 0.0.3 → 0.0.5

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/README.md CHANGED
@@ -46,7 +46,6 @@ const options = ref({
46
46
  barWidth: 5,
47
47
  barRadius: 8,
48
48
  duration: 80,
49
- // cursorWidth: 0,
50
49
  url: "https://revews-bucket.s3.ap-southeast-1.amazonaws.com/a06mmMU3sgnzuUkH4OiHvyuUgCFdLSnJaDLBao7y.webm",
51
50
  })
52
51
 
@@ -123,7 +122,57 @@ const formatTime = (seconds: number):string => [seconds / 60, seconds % 60].map(
123
122
 
124
123
 
125
124
 
126
- ## useUseWaveSurferRecorder: composeable method Return Types
125
+ ## useWaveSurferRecorder: composable method Return Types
126
+
127
+ ```vue
128
+ <script lang="ts" setup>
129
+ import { computed, ref } from 'vue'
130
+ import { useWaveSurferRecorder } from '@meersagor/wavesurfer-vue'
131
+ const showAudioRecordButton = ref<boolean>(true)
132
+ const containerRef = ref<HTMLDivElement | null>(null)
133
+
134
+ const options = computed(() => ({
135
+ height: 48,
136
+ waveColor: "#66667D",
137
+ progressColor: "#6A24FF",
138
+ barGap: 5,
139
+ barWidth: 5,
140
+ barRadius: 8,
141
+ cursorWidth: 0,
142
+ url: "https://revews-bucket.s3.ap-southeast-1.amazonaws.com/a06mmMU3sgnzuUkH4OiHvyuUgCFdLSnJaDLBao7y.webm",
143
+ }))
144
+
145
+ const { pauseRecording, startRecording, stopRecording, currentTime, isPauseResume } = useWaveSurferRecorder({
146
+ containerRef,
147
+ options: options.value,
148
+ })
149
+
150
+ const startAudioRecordHandler = () => {
151
+ startRecording()
152
+ showAudioRecordButton.value = false
153
+ }
154
+
155
+ const stopHandler = async () => {
156
+ const blob = await stopRecording()
157
+ console.log('blob =====', blob);
158
+ showAudioRecordButton.value = true
159
+ }
160
+ </script>
161
+
162
+ <template>
163
+ <div>
164
+ <div>
165
+ <div ref="containerRef"></div>
166
+ </div>
167
+ <p>{{ currentTime }}</p>
168
+ <button v-if="showAudioRecordButton" @click="startAudioRecordHandler"> Start Recording </button>
169
+ <div v-else>
170
+ <button @click="pauseRecording">{{ isPauseResume ? 'pause' : 'resume' }}</button>
171
+ <button @click="stopHandler">Stop</button>
172
+ </div>
173
+ </div>
174
+ </template>
175
+ ```
127
176
 
128
177
  ### `waveSurfer`
129
178
 
@@ -1,73 +1,331 @@
1
- import { ref as r, onMounted as c, onUnmounted as i, defineComponent as m, getCurrentInstance as y, openBlock as S, createElementBlock as h } from "vue";
2
- import W from "wavesurfer.js";
3
- const g = ({ containerRef: e, options: l }) => {
4
- const a = r(null), t = () => {
5
- e.value && (a.value = W.create({
6
- container: e.value,
7
- ...l
1
+ import { ref as v, onMounted as g, onUnmounted as b, defineComponent as T, getCurrentInstance as O, openBlock as k, createElementBlock as E, computed as P } from "vue";
2
+ import I from "wavesurfer.js";
3
+ const A = ({ containerRef: n, options: e }) => {
4
+ const t = v(null), i = () => {
5
+ n.value && (t.value = I.create({
6
+ container: n.value,
7
+ ...e
8
8
  }));
9
- }, n = () => {
10
- a.value && (a.value.destroy(), a.value = null);
11
- };
12
- return c(() => {
13
- t();
14
- }), i(() => {
15
- n();
16
- }), { waveSurfer: a };
17
- }, _ = (e) => {
18
- const l = r(!1), a = r(!1), t = r(0), n = r(0), o = () => {
19
- l.value = !1, a.value = !1, t.value = 0;
20
- }, u = (p) => {
21
- l.value = !0, a.value = !1, t.value = 0, n.value = p;
22
9
  }, s = () => {
23
- a.value = !0;
24
- }, v = () => {
25
- a.value = !1;
10
+ t.value && (t.value.destroy(), t.value = null);
11
+ };
12
+ return g(() => {
13
+ i();
14
+ }), b(() => {
15
+ s();
16
+ }), { waveSurfer: t };
17
+ }, x = (n) => {
18
+ const e = v(!1), t = v(!1), i = v(0), s = v(0), r = () => {
19
+ e.value = !1, t.value = !1, i.value = 0;
20
+ }, o = (p) => {
21
+ e.value = !0, t.value = !1, i.value = 0, s.value = p;
22
+ }, u = () => {
23
+ t.value = !0;
26
24
  }, d = () => {
27
- e.value && (t.value = e.value.getCurrentTime());
28
- }, f = () => {
29
- l.value = !1, a.value = !1;
25
+ t.value = !1;
26
+ }, l = () => {
27
+ n.value && (i.value = n.value.getCurrentTime());
28
+ }, c = () => {
29
+ e.value = !1, t.value = !1;
30
30
  };
31
- return c(() => {
32
- e.value && (e.value.on("load", o), e.value.on("ready", u), e.value.on("play", s), e.value.on("pause", v), e.value.on("timeupdate", d), e.value.on("destroy", f));
33
- }), i(() => {
34
- e.value && e.value.unAll();
31
+ return g(() => {
32
+ n.value && (n.value.on("load", r), n.value.on("ready", o), n.value.on("play", u), n.value.on("pause", d), n.value.on("timeupdate", l), n.value.on("destroy", c));
33
+ }), b(() => {
34
+ n.value && n.value.unAll();
35
35
  }), {
36
- isReady: l,
37
- isPlaying: a,
38
- currentTime: t,
39
- totalDuration: n
36
+ isReady: e,
37
+ isPlaying: t,
38
+ currentTime: i,
39
+ totalDuration: s
40
40
  };
41
- }, k = ({ containerRef: e, options: l }) => {
42
- const { waveSurfer: a } = g({ containerRef: e, options: l }), { isReady: t, totalDuration: n, isPlaying: o, currentTime: u } = _(a);
41
+ }, B = ({ containerRef: n, options: e }) => {
42
+ const { waveSurfer: t } = A({ containerRef: n, options: e }), { isReady: i, totalDuration: s, isPlaying: r, currentTime: o } = x(t);
43
43
  return {
44
- waveSurfer: a,
45
- isReady: t,
46
- totalDuration: n,
47
- isPlaying: o,
48
- currentTime: u
44
+ waveSurfer: t,
45
+ isReady: i,
46
+ totalDuration: s,
47
+ isPlaying: r,
48
+ currentTime: o
49
49
  };
50
- }, P = ["audioprocess", "click", "dblclick", "decode", "drag", "finish", "init", "interaction", "load", "loading", "pause", "play", "ready", "redraw", "redrawcomplete", "scroll", "seeking", "timeupdate", "zoom"], T = /* @__PURE__ */ m({
50
+ }, F = ["audioprocess", "click", "dblclick", "decode", "drag", "finish", "init", "interaction", "load", "loading", "pause", "play", "ready", "redraw", "redrawcomplete", "scroll", "seeking", "timeupdate", "zoom"], L = /* @__PURE__ */ T({
51
51
  __name: "WaveSurferPlayer",
52
52
  props: {
53
53
  options: {}
54
54
  },
55
- setup(e) {
56
- const l = e, a = r(null), { waveSurfer: t } = k({ containerRef: a, options: l.options }), n = y();
57
- return c(() => {
58
- P.forEach((o) => {
59
- var u;
60
- (u = t.value) == null || u.on(o, (...s) => {
61
- n == null || n.emit(o, ...s);
55
+ setup(n) {
56
+ const e = n, t = v(null), { waveSurfer: i } = B({ containerRef: t, options: e.options }), s = O();
57
+ return g(() => {
58
+ F.forEach((r) => {
59
+ var o;
60
+ (o = i.value) == null || o.on(r, (...u) => {
61
+ s == null || s.emit(r, ...u);
62
62
  });
63
- }), n == null || n.emit("waveSurfer", t.value);
64
- }), (o, u) => (S(), h("div", {
63
+ }), s == null || s.emit("waveSurfer", i.value);
64
+ }), (r, o) => (k(), E("div", {
65
65
  ref_key: "containerRef",
66
- ref: a
66
+ ref: t
67
67
  }, null, 512));
68
68
  }
69
69
  });
70
+ /*! *****************************************************************************
71
+ Copyright (c) Microsoft Corporation.
72
+
73
+ Permission to use, copy, modify, and/or distribute this software for any
74
+ purpose with or without fee is hereby granted.
75
+
76
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
77
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
78
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
79
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
80
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
81
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
82
+ PERFORMANCE OF THIS SOFTWARE.
83
+ ***************************************************************************** */
84
+ function w(n, e, t, i) {
85
+ return new (t || (t = Promise))(function(s, r) {
86
+ function o(l) {
87
+ try {
88
+ d(i.next(l));
89
+ } catch (c) {
90
+ r(c);
91
+ }
92
+ }
93
+ function u(l) {
94
+ try {
95
+ d(i.throw(l));
96
+ } catch (c) {
97
+ r(c);
98
+ }
99
+ }
100
+ function d(l) {
101
+ var c;
102
+ l.done ? s(l.value) : (c = l.value, c instanceof t ? c : new t(function(p) {
103
+ p(c);
104
+ })).then(o, u);
105
+ }
106
+ d((i = i.apply(n, e || [])).next());
107
+ });
108
+ }
109
+ class D {
110
+ constructor() {
111
+ this.listeners = {};
112
+ }
113
+ on(e, t, i) {
114
+ if (this.listeners[e] || (this.listeners[e] = /* @__PURE__ */ new Set()), this.listeners[e].add(t), i == null ? void 0 : i.once) {
115
+ const s = () => {
116
+ this.un(e, s), this.un(e, t);
117
+ };
118
+ return this.on(e, s), s;
119
+ }
120
+ return () => this.un(e, t);
121
+ }
122
+ un(e, t) {
123
+ var i;
124
+ (i = this.listeners[e]) === null || i === void 0 || i.delete(t);
125
+ }
126
+ once(e, t) {
127
+ return this.on(e, t, { once: !0 });
128
+ }
129
+ unAll() {
130
+ this.listeners = {};
131
+ }
132
+ emit(e, ...t) {
133
+ this.listeners[e] && this.listeners[e].forEach((i) => i(...t));
134
+ }
135
+ }
136
+ class _ extends D {
137
+ constructor(e) {
138
+ super(), this.subscriptions = [], this.options = e;
139
+ }
140
+ onInit() {
141
+ }
142
+ _init(e) {
143
+ this.wavesurfer = e, this.onInit();
144
+ }
145
+ destroy() {
146
+ this.emit("destroy"), this.subscriptions.forEach((e) => e());
147
+ }
148
+ }
149
+ class q extends D {
150
+ constructor() {
151
+ super(...arguments), this.unsubscribe = () => {
152
+ };
153
+ }
154
+ start() {
155
+ this.unsubscribe = this.on("tick", () => {
156
+ requestAnimationFrame(() => {
157
+ this.emit("tick");
158
+ });
159
+ }), this.emit("tick");
160
+ }
161
+ stop() {
162
+ this.unsubscribe();
163
+ }
164
+ destroy() {
165
+ this.unsubscribe();
166
+ }
167
+ }
168
+ const C = ["audio/webm", "audio/wav", "audio/mpeg", "audio/mp4", "audio/mp3"];
169
+ class y extends _ {
170
+ constructor(e) {
171
+ var t, i, s, r;
172
+ super(Object.assign(Object.assign({}, e), { audioBitsPerSecond: (t = e.audioBitsPerSecond) !== null && t !== void 0 ? t : 128e3, scrollingWaveform: (i = e.scrollingWaveform) !== null && i !== void 0 && i, scrollingWaveformWindow: (s = e.scrollingWaveformWindow) !== null && s !== void 0 ? s : 5, renderRecordedAudio: (r = e.renderRecordedAudio) === null || r === void 0 || r })), this.stream = null, this.mediaRecorder = null, this.dataWindow = null, this.isWaveformPaused = !1, this.lastStartTime = 0, this.lastDuration = 0, this.duration = 0, this.timer = new q(), this.subscriptions.push(this.timer.on("tick", () => {
173
+ const o = performance.now() - this.lastStartTime;
174
+ this.duration = this.isPaused() ? this.duration : this.lastDuration + o, this.emit("record-progress", this.duration);
175
+ }));
176
+ }
177
+ static create(e) {
178
+ return new y(e || {});
179
+ }
180
+ renderMicStream(e) {
181
+ const t = new AudioContext(), i = t.createMediaStreamSource(e), s = t.createAnalyser();
182
+ i.connect(s);
183
+ const r = s.frequencyBinCount, o = new Float32Array(r);
184
+ let u;
185
+ const d = Math.floor((this.options.scrollingWaveformWindow || 0) * t.sampleRate), l = () => {
186
+ var c;
187
+ if (this.isWaveformPaused)
188
+ return void (u = requestAnimationFrame(l));
189
+ if (s.getFloatTimeDomainData(o), this.options.scrollingWaveform) {
190
+ const R = Math.min(d, this.dataWindow ? this.dataWindow.length + r : r), a = new Float32Array(d);
191
+ if (this.dataWindow) {
192
+ const h = Math.max(0, d - this.dataWindow.length);
193
+ a.set(this.dataWindow.slice(-R + r), h);
194
+ }
195
+ a.set(o, d - r), this.dataWindow = a;
196
+ } else
197
+ this.dataWindow = o;
198
+ const p = this.options.scrollingWaveformWindow;
199
+ this.wavesurfer && ((c = this.originalOptions) !== null && c !== void 0 || (this.originalOptions = { cursorWidth: this.wavesurfer.options.cursorWidth, interact: this.wavesurfer.options.interact }), this.wavesurfer.options.cursorWidth = 0, this.wavesurfer.options.interact = !1, this.wavesurfer.load("", [this.dataWindow], p)), u = requestAnimationFrame(l);
200
+ };
201
+ return l(), { onDestroy: () => {
202
+ cancelAnimationFrame(u), i == null || i.disconnect(), t == null || t.close();
203
+ }, onEnd: () => {
204
+ this.isWaveformPaused = !0, cancelAnimationFrame(u), this.stopMic();
205
+ } };
206
+ }
207
+ startMic(e) {
208
+ return w(this, void 0, void 0, function* () {
209
+ let t;
210
+ try {
211
+ t = yield navigator.mediaDevices.getUserMedia({ audio: !(e != null && e.deviceId) || { deviceId: e.deviceId } });
212
+ } catch (r) {
213
+ throw new Error("Error accessing the microphone: " + r.message);
214
+ }
215
+ const { onDestroy: i, onEnd: s } = this.renderMicStream(t);
216
+ return this.subscriptions.push(this.once("destroy", i)), this.subscriptions.push(this.once("record-end", s)), this.stream = t, t;
217
+ });
218
+ }
219
+ stopMic() {
220
+ this.stream && (this.stream.getTracks().forEach((e) => e.stop()), this.stream = null, this.mediaRecorder = null);
221
+ }
222
+ startRecording(e) {
223
+ return w(this, void 0, void 0, function* () {
224
+ const t = this.stream || (yield this.startMic(e));
225
+ this.dataWindow = null;
226
+ const i = this.mediaRecorder || new MediaRecorder(t, { mimeType: this.options.mimeType || C.find((o) => MediaRecorder.isTypeSupported(o)), audioBitsPerSecond: this.options.audioBitsPerSecond });
227
+ this.mediaRecorder = i, this.stopRecording();
228
+ const s = [];
229
+ i.ondataavailable = (o) => {
230
+ o.data.size > 0 && s.push(o.data);
231
+ };
232
+ const r = (o) => {
233
+ var u;
234
+ const d = new Blob(s, { type: i.mimeType });
235
+ this.emit(o, d), this.options.renderRecordedAudio && (this.applyOriginalOptionsIfNeeded(), (u = this.wavesurfer) === null || u === void 0 || u.load(URL.createObjectURL(d)));
236
+ };
237
+ i.onpause = () => r("record-pause"), i.onstop = () => r("record-end"), i.start(), this.lastStartTime = performance.now(), this.lastDuration = 0, this.duration = 0, this.isWaveformPaused = !1, this.timer.start(), this.emit("record-start");
238
+ });
239
+ }
240
+ getDuration() {
241
+ return this.duration;
242
+ }
243
+ isRecording() {
244
+ var e;
245
+ return ((e = this.mediaRecorder) === null || e === void 0 ? void 0 : e.state) === "recording";
246
+ }
247
+ isPaused() {
248
+ var e;
249
+ return ((e = this.mediaRecorder) === null || e === void 0 ? void 0 : e.state) === "paused";
250
+ }
251
+ isActive() {
252
+ var e;
253
+ return ((e = this.mediaRecorder) === null || e === void 0 ? void 0 : e.state) !== "inactive";
254
+ }
255
+ stopRecording() {
256
+ var e;
257
+ this.isActive() && ((e = this.mediaRecorder) === null || e === void 0 || e.stop(), this.timer.stop());
258
+ }
259
+ pauseRecording() {
260
+ var e, t;
261
+ this.isRecording() && (this.isWaveformPaused = !0, (e = this.mediaRecorder) === null || e === void 0 || e.requestData(), (t = this.mediaRecorder) === null || t === void 0 || t.pause(), this.timer.stop(), this.lastDuration = this.duration);
262
+ }
263
+ resumeRecording() {
264
+ var e;
265
+ this.isPaused() && (this.isWaveformPaused = !1, (e = this.mediaRecorder) === null || e === void 0 || e.resume(), this.timer.start(), this.lastStartTime = performance.now(), this.emit("record-resume"));
266
+ }
267
+ static getAvailableAudioDevices() {
268
+ return w(this, void 0, void 0, function* () {
269
+ return navigator.mediaDevices.enumerateDevices().then((e) => e.filter((t) => t.kind === "audioinput"));
270
+ });
271
+ }
272
+ destroy() {
273
+ this.applyOriginalOptionsIfNeeded(), super.destroy(), this.stopRecording(), this.stopMic();
274
+ }
275
+ applyOriginalOptionsIfNeeded() {
276
+ this.wavesurfer && this.originalOptions && (this.wavesurfer.options.cursorWidth = this.originalOptions.cursorWidth, this.wavesurfer.options.interact = this.originalOptions.interact, delete this.originalOptions);
277
+ }
278
+ }
279
+ const z = ({ containerRef: n, options: e }) => {
280
+ const { waveSurfer: t } = A({ containerRef: n, options: e }), i = v(null), s = v(0), r = v(!1), o = v(!1), u = P(() => [
281
+ Math.floor(s.value % 36e5 / 6e4),
282
+ // minutes
283
+ Math.floor(s.value % 6e4 / 1e3)
284
+ // seconds
285
+ ].map((a) => a < 10 ? "0" + a : a).join(":")), d = P(() => r.value || !o.value), l = () => {
286
+ var a;
287
+ i.value && ((a = i.value) == null || a.on("record-progress", (h) => {
288
+ s.value = h;
289
+ }));
290
+ }, c = () => {
291
+ var a, h, m, f;
292
+ if ((a = i.value) != null && a.isRecording() || (h = i.value) != null && h.isPaused()) {
293
+ (m = i.value) == null || m.stopRecording(), r.value = !1, o.value = !0;
294
+ return;
295
+ }
296
+ (f = i.value) == null || f.startRecording(), r.value = !0, o.value = !1, l();
297
+ }, p = () => new Promise((a) => {
298
+ var m, f, W, S;
299
+ let h;
300
+ ((m = i.value) != null && m.isRecording() || (f = i.value) != null && f.isPaused()) && ((W = i.value) == null || W.stopRecording(), r.value = !1, o.value = !1), (S = i.value) == null || S.on("record-end", (M) => {
301
+ h = M, a(h);
302
+ });
303
+ }), R = () => {
304
+ var a, h, m;
305
+ if ((a = i.value) != null && a.isPaused()) {
306
+ (h = i.value) == null || h.resumeRecording(), r.value = !0, o.value = !1;
307
+ return;
308
+ }
309
+ r.value = !1, o.value = !0, (m = i.value) == null || m.pauseRecording();
310
+ };
311
+ return g(() => {
312
+ var h;
313
+ const a = (h = t.value) == null ? void 0 : h.registerPlugin(y.create({ renderRecordedAudio: !1 }));
314
+ a && (i.value = a);
315
+ }), {
316
+ waveSurfer: t,
317
+ waveSurferRecorder: i,
318
+ currentTime: u,
319
+ startRecording: c,
320
+ stopRecording: p,
321
+ pauseRecording: R,
322
+ isRecording: r,
323
+ isPaused: o,
324
+ isPauseResume: d
325
+ };
326
+ };
70
327
  export {
71
- T as WaveSurferPlayer,
72
- k as useWaveSurfer
328
+ L as WaveSurferPlayer,
329
+ B as useWaveSurfer,
330
+ z as useWaveSurferRecorder
73
331
  };
@@ -1 +1,14 @@
1
- (function(l,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("wavesurfer.js")):typeof define=="function"&&define.amd?define(["exports","vue","wavesurfer.js"],e):(l=typeof globalThis<"u"?globalThis:l||self,e(l["@meersagor/wavesurfer-vue"]={},l.Vue,l.WaveSurfer))})(this,function(l,e,d){"use strict";const f=({containerRef:n,options:r})=>{const t=e.ref(null),o=()=>{n.value&&(t.value=d.create({container:n.value,...r}))},a=()=>{t.value&&(t.value.destroy(),t.value=null)};return e.onMounted(()=>{o()}),e.onUnmounted(()=>{a()}),{waveSurfer:t}},v=n=>{const r=e.ref(!1),t=e.ref(!1),o=e.ref(0),a=e.ref(0),u=()=>{r.value=!1,t.value=!1,o.value=0},s=W=>{r.value=!0,t.value=!1,o.value=0,a.value=W},i=()=>{t.value=!0},m=()=>{t.value=!1},S=()=>{n.value&&(o.value=n.value.getCurrentTime())},h=()=>{r.value=!1,t.value=!1};return e.onMounted(()=>{n.value&&(n.value.on("load",u),n.value.on("ready",s),n.value.on("play",i),n.value.on("pause",m),n.value.on("timeupdate",S),n.value.on("destroy",h))}),e.onUnmounted(()=>{n.value&&n.value.unAll()}),{isReady:r,isPlaying:t,currentTime:o,totalDuration:a}},c=({containerRef:n,options:r})=>{const{waveSurfer:t}=f({containerRef:n,options:r}),{isReady:o,totalDuration:a,isPlaying:u,currentTime:s}=v(t);return{waveSurfer:t,isReady:o,totalDuration:a,isPlaying:u,currentTime:s}},p=["audioprocess","click","dblclick","decode","drag","finish","init","interaction","load","loading","pause","play","ready","redraw","redrawcomplete","scroll","seeking","timeupdate","zoom"],y=e.defineComponent({__name:"WaveSurferPlayer",props:{options:{}},setup(n){const r=n,t=e.ref(null),{waveSurfer:o}=c({containerRef:t,options:r.options}),a=e.getCurrentInstance();return e.onMounted(()=>{p.forEach(u=>{var s;(s=o.value)==null||s.on(u,(...i)=>{a==null||a.emit(u,...i)})}),a==null||a.emit("waveSurfer",o.value)}),(u,s)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"containerRef",ref:t},null,512))}});l.WaveSurferPlayer=y,l.useWaveSurfer=c,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
1
+ (function(f,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue"),require("wavesurfer.js")):typeof define=="function"&&define.amd?define(["exports","vue","wavesurfer.js"],n):(f=typeof globalThis<"u"?globalThis:f||self,n(f["@meersagor/wavesurfer-vue"]={},f.Vue,f.WaveSurfer))})(this,function(f,n,A){"use strict";const W=({containerRef:a,options:e})=>{const t=n.ref(null),i=()=>{a.value&&(t.value=A.create({container:a.value,...e}))},s=()=>{t.value&&(t.value.destroy(),t.value=null)};return n.onMounted(()=>{i()}),n.onUnmounted(()=>{s()}),{waveSurfer:t}},T=a=>{const e=n.ref(!1),t=n.ref(!1),i=n.ref(0),s=n.ref(0),r=()=>{e.value=!1,t.value=!1,i.value=0},o=p=>{e.value=!0,t.value=!1,i.value=0,s.value=p},d=()=>{t.value=!0},c=()=>{t.value=!1},l=()=>{a.value&&(i.value=a.value.getCurrentTime())},h=()=>{e.value=!1,t.value=!1};return n.onMounted(()=>{a.value&&(a.value.on("load",r),a.value.on("ready",o),a.value.on("play",d),a.value.on("pause",c),a.value.on("timeupdate",l),a.value.on("destroy",h))}),n.onUnmounted(()=>{a.value&&a.value.unAll()}),{isReady:e,isPlaying:t,currentTime:i,totalDuration:s}},S=({containerRef:a,options:e})=>{const{waveSurfer:t}=W({containerRef:a,options:e}),{isReady:i,totalDuration:s,isPlaying:r,currentTime:o}=T(t);return{waveSurfer:t,isReady:i,totalDuration:s,isPlaying:r,currentTime:o}},D=["audioprocess","click","dblclick","decode","drag","finish","init","interaction","load","loading","pause","play","ready","redraw","redrawcomplete","scroll","seeking","timeupdate","zoom"],O=n.defineComponent({__name:"WaveSurferPlayer",props:{options:{}},setup(a){const e=a,t=n.ref(null),{waveSurfer:i}=S({containerRef:t,options:e.options}),s=n.getCurrentInstance();return n.onMounted(()=>{D.forEach(r=>{var o;(o=i.value)==null||o.on(r,(...d)=>{s==null||s.emit(r,...d)})}),s==null||s.emit("waveSurfer",i.value)}),(r,o)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"containerRef",ref:t},null,512))}});/*! *****************************************************************************
2
+ Copyright (c) Microsoft Corporation.
3
+
4
+ Permission to use, copy, modify, and/or distribute this software for any
5
+ purpose with or without fee is hereby granted.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
9
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
+ PERFORMANCE OF THIS SOFTWARE.
14
+ ***************************************************************************** */function y(a,e,t,i){return new(t||(t=Promise))(function(s,r){function o(l){try{c(i.next(l))}catch(h){r(h)}}function d(l){try{c(i.throw(l))}catch(h){r(h)}}function c(l){var h;l.done?s(l.value):(h=l.value,h instanceof t?h:new t(function(p){p(h)})).then(o,d)}c((i=i.apply(a,e||[])).next())})}class P{constructor(){this.listeners={}}on(e,t,i){if(this.listeners[e]||(this.listeners[e]=new Set),this.listeners[e].add(t),i==null?void 0:i.once){const s=()=>{this.un(e,s),this.un(e,t)};return this.on(e,s),s}return()=>this.un(e,t)}un(e,t){var i;(i=this.listeners[e])===null||i===void 0||i.delete(t)}once(e,t){return this.on(e,t,{once:!0})}unAll(){this.listeners={}}emit(e,...t){this.listeners[e]&&this.listeners[e].forEach(i=>i(...t))}}class k extends P{constructor(e){super(),this.subscriptions=[],this.options=e}onInit(){}_init(e){this.wavesurfer=e,this.onInit()}destroy(){this.emit("destroy"),this.subscriptions.forEach(e=>e())}}class E extends P{constructor(){super(...arguments),this.unsubscribe=()=>{}}start(){this.unsubscribe=this.on("tick",()=>{requestAnimationFrame(()=>{this.emit("tick")})}),this.emit("tick")}stop(){this.unsubscribe()}destroy(){this.unsubscribe()}}const I=["audio/webm","audio/wav","audio/mpeg","audio/mp4","audio/mp3"];class R extends k{constructor(e){var t,i,s,r;super(Object.assign(Object.assign({},e),{audioBitsPerSecond:(t=e.audioBitsPerSecond)!==null&&t!==void 0?t:128e3,scrollingWaveform:(i=e.scrollingWaveform)!==null&&i!==void 0&&i,scrollingWaveformWindow:(s=e.scrollingWaveformWindow)!==null&&s!==void 0?s:5,renderRecordedAudio:(r=e.renderRecordedAudio)===null||r===void 0||r})),this.stream=null,this.mediaRecorder=null,this.dataWindow=null,this.isWaveformPaused=!1,this.lastStartTime=0,this.lastDuration=0,this.duration=0,this.timer=new E,this.subscriptions.push(this.timer.on("tick",()=>{const o=performance.now()-this.lastStartTime;this.duration=this.isPaused()?this.duration:this.lastDuration+o,this.emit("record-progress",this.duration)}))}static create(e){return new R(e||{})}renderMicStream(e){const t=new AudioContext,i=t.createMediaStreamSource(e),s=t.createAnalyser();i.connect(s);const r=s.frequencyBinCount,o=new Float32Array(r);let d;const c=Math.floor((this.options.scrollingWaveformWindow||0)*t.sampleRate),l=()=>{var h;if(this.isWaveformPaused)return void(d=requestAnimationFrame(l));if(s.getFloatTimeDomainData(o),this.options.scrollingWaveform){const w=Math.min(c,this.dataWindow?this.dataWindow.length+r:r),u=new Float32Array(c);if(this.dataWindow){const v=Math.max(0,c-this.dataWindow.length);u.set(this.dataWindow.slice(-w+r),v)}u.set(o,c-r),this.dataWindow=u}else this.dataWindow=o;const p=this.options.scrollingWaveformWindow;this.wavesurfer&&((h=this.originalOptions)!==null&&h!==void 0||(this.originalOptions={cursorWidth:this.wavesurfer.options.cursorWidth,interact:this.wavesurfer.options.interact}),this.wavesurfer.options.cursorWidth=0,this.wavesurfer.options.interact=!1,this.wavesurfer.load("",[this.dataWindow],p)),d=requestAnimationFrame(l)};return l(),{onDestroy:()=>{cancelAnimationFrame(d),i==null||i.disconnect(),t==null||t.close()},onEnd:()=>{this.isWaveformPaused=!0,cancelAnimationFrame(d),this.stopMic()}}}startMic(e){return y(this,void 0,void 0,function*(){let t;try{t=yield navigator.mediaDevices.getUserMedia({audio:!(e!=null&&e.deviceId)||{deviceId:e.deviceId}})}catch(r){throw new Error("Error accessing the microphone: "+r.message)}const{onDestroy:i,onEnd:s}=this.renderMicStream(t);return this.subscriptions.push(this.once("destroy",i)),this.subscriptions.push(this.once("record-end",s)),this.stream=t,t})}stopMic(){this.stream&&(this.stream.getTracks().forEach(e=>e.stop()),this.stream=null,this.mediaRecorder=null)}startRecording(e){return y(this,void 0,void 0,function*(){const t=this.stream||(yield this.startMic(e));this.dataWindow=null;const i=this.mediaRecorder||new MediaRecorder(t,{mimeType:this.options.mimeType||I.find(o=>MediaRecorder.isTypeSupported(o)),audioBitsPerSecond:this.options.audioBitsPerSecond});this.mediaRecorder=i,this.stopRecording();const s=[];i.ondataavailable=o=>{o.data.size>0&&s.push(o.data)};const r=o=>{var d;const c=new Blob(s,{type:i.mimeType});this.emit(o,c),this.options.renderRecordedAudio&&(this.applyOriginalOptionsIfNeeded(),(d=this.wavesurfer)===null||d===void 0||d.load(URL.createObjectURL(c)))};i.onpause=()=>r("record-pause"),i.onstop=()=>r("record-end"),i.start(),this.lastStartTime=performance.now(),this.lastDuration=0,this.duration=0,this.isWaveformPaused=!1,this.timer.start(),this.emit("record-start")})}getDuration(){return this.duration}isRecording(){var e;return((e=this.mediaRecorder)===null||e===void 0?void 0:e.state)==="recording"}isPaused(){var e;return((e=this.mediaRecorder)===null||e===void 0?void 0:e.state)==="paused"}isActive(){var e;return((e=this.mediaRecorder)===null||e===void 0?void 0:e.state)!=="inactive"}stopRecording(){var e;this.isActive()&&((e=this.mediaRecorder)===null||e===void 0||e.stop(),this.timer.stop())}pauseRecording(){var e,t;this.isRecording()&&(this.isWaveformPaused=!0,(e=this.mediaRecorder)===null||e===void 0||e.requestData(),(t=this.mediaRecorder)===null||t===void 0||t.pause(),this.timer.stop(),this.lastDuration=this.duration)}resumeRecording(){var e;this.isPaused()&&(this.isWaveformPaused=!1,(e=this.mediaRecorder)===null||e===void 0||e.resume(),this.timer.start(),this.lastStartTime=performance.now(),this.emit("record-resume"))}static getAvailableAudioDevices(){return y(this,void 0,void 0,function*(){return navigator.mediaDevices.enumerateDevices().then(e=>e.filter(t=>t.kind==="audioinput"))})}destroy(){this.applyOriginalOptionsIfNeeded(),super.destroy(),this.stopRecording(),this.stopMic()}applyOriginalOptionsIfNeeded(){this.wavesurfer&&this.originalOptions&&(this.wavesurfer.options.cursorWidth=this.originalOptions.cursorWidth,this.wavesurfer.options.interact=this.originalOptions.interact,delete this.originalOptions)}}const j=({containerRef:a,options:e})=>{const{waveSurfer:t}=W({containerRef:a,options:e}),i=n.ref(null),s=n.ref(0),r=n.ref(!1),o=n.ref(!1),d=n.computed(()=>[Math.floor(s.value%36e5/6e4),Math.floor(s.value%6e4/1e3)].map(u=>u<10?"0"+u:u).join(":")),c=n.computed(()=>r.value||!o.value),l=()=>{var u;i.value&&((u=i.value)==null||u.on("record-progress",v=>{s.value=v}))},h=()=>{var u,v,m,g;if((u=i.value)!=null&&u.isRecording()||(v=i.value)!=null&&v.isPaused()){(m=i.value)==null||m.stopRecording(),r.value=!1,o.value=!0;return}(g=i.value)==null||g.startRecording(),r.value=!0,o.value=!1,l()},p=()=>new Promise(u=>{var m,g,b,M;let v;((m=i.value)!=null&&m.isRecording()||(g=i.value)!=null&&g.isPaused())&&((b=i.value)==null||b.stopRecording(),r.value=!1,o.value=!1),(M=i.value)==null||M.on("record-end",x=>{v=x,u(v)})}),w=()=>{var u,v,m;if((u=i.value)!=null&&u.isPaused()){(v=i.value)==null||v.resumeRecording(),r.value=!0,o.value=!1;return}r.value=!1,o.value=!0,(m=i.value)==null||m.pauseRecording()};return n.onMounted(()=>{var v;const u=(v=t.value)==null?void 0:v.registerPlugin(R.create({renderRecordedAudio:!1}));u&&(i.value=u)}),{waveSurfer:t,waveSurferRecorder:i,currentTime:d,startRecording:h,stopRecording:p,pauseRecording:w,isRecording:r,isPaused:o,isPauseResume:c}};f.WaveSurferPlayer=O,f.useWaveSurfer=S,f.useWaveSurferRecorder=j,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export declare const useWaveSurfer: ({ containerRef, options }: WaveSurferIns) => UseWaveSurfer;
@@ -0,0 +1,3 @@
1
+ export declare const useWaveSurferInstance: ({ containerRef, options }: WaveSurferIns) => {
2
+ waveSurfer: any;
3
+ };
@@ -0,0 +1,11 @@
1
+ export declare const useWaveSurferRecorder: ({ containerRef, options }: WaveSurferIns) => {
2
+ waveSurfer: any;
3
+ waveSurferRecorder: any;
4
+ currentTime: any;
5
+ startRecording: () => void;
6
+ stopRecording: () => Promise<Blob>;
7
+ pauseRecording: () => void;
8
+ isRecording: any;
9
+ isPaused: any;
10
+ isPauseResume: any;
11
+ };
@@ -0,0 +1,6 @@
1
+ export declare const useWaveSurferState: (wavesurfer: Ref<any>) => {
2
+ isReady: any;
3
+ isPlaying: any;
4
+ currentTime: any;
5
+ totalDuration: any;
6
+ };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  import WaveSurferPlayer from './components/WaveSurferPlayer.vue';
2
2
  import { useWaveSurfer } from './composables/useWaveSurfer';
3
- export { WaveSurferPlayer, useWaveSurfer };
3
+ import { useWaveSurferRecorder } from './composables/useWaveSurferRecorder';
4
+ export { WaveSurferPlayer, useWaveSurfer, useWaveSurferRecorder };
@@ -1 +1 @@
1
- {"program":{"fileNames":["../node_modules/typescript/lib/lib.es5.d.ts","../node_modules/typescript/lib/lib.es2015.d.ts","../node_modules/typescript/lib/lib.es2016.d.ts","../node_modules/typescript/lib/lib.es2017.d.ts","../node_modules/typescript/lib/lib.es2018.d.ts","../node_modules/typescript/lib/lib.es2019.d.ts","../node_modules/typescript/lib/lib.es2020.d.ts","../node_modules/typescript/lib/lib.dom.d.ts","../node_modules/typescript/lib/lib.dom.iterable.d.ts","../node_modules/typescript/lib/lib.es2015.core.d.ts","../node_modules/typescript/lib/lib.es2015.collection.d.ts","../node_modules/typescript/lib/lib.es2015.generator.d.ts","../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../node_modules/typescript/lib/lib.es2015.promise.d.ts","../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../node_modules/typescript/lib/lib.es2017.date.d.ts","../node_modules/typescript/lib/lib.es2017.object.d.ts","../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2017.string.d.ts","../node_modules/typescript/lib/lib.es2017.intl.d.ts","../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../node_modules/typescript/lib/lib.es2018.intl.d.ts","../node_modules/typescript/lib/lib.es2018.promise.d.ts","../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../node_modules/typescript/lib/lib.es2019.array.d.ts","../node_modules/typescript/lib/lib.es2019.object.d.ts","../node_modules/typescript/lib/lib.es2019.string.d.ts","../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../node_modules/typescript/lib/lib.es2019.intl.d.ts","../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../node_modules/typescript/lib/lib.es2020.date.d.ts","../node_modules/typescript/lib/lib.es2020.promise.d.ts","../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2020.string.d.ts","../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2020.intl.d.ts","../node_modules/typescript/lib/lib.es2020.number.d.ts","../node_modules/typescript/lib/lib.decorators.d.ts","../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../node_modules/@vue/shared/dist/shared.d.ts","../node_modules/@vue/reactivity/dist/reactivity.d.ts","../node_modules/@vue/runtime-core/dist/runtime-core.d.ts","../node_modules/csstype/index.d.ts","../node_modules/@vue/runtime-dom/dist/runtime-dom.d.ts","../node_modules/vue/jsx-runtime/index.d.ts","../node_modules/@babel/parser/typings/babel-parser.d.ts","../node_modules/source-map-js/source-map.d.ts","../node_modules/@vue/compiler-core/dist/compiler-core.d.ts","../node_modules/@vue/compiler-dom/dist/compiler-dom.d.ts","../node_modules/vue/dist/vue.d.mts","../node_modules/wavesurfer.js/dist/event-emitter.d.ts","../node_modules/wavesurfer.js/dist/base-plugin.d.ts","../node_modules/wavesurfer.js/dist/player.d.ts","../node_modules/wavesurfer.js/dist/wavesurfer.d.ts","../src/composables/useWaveSurferInstance.ts","../src/composables/useWaveSurferState.ts","../src/types/index.ts","../src/composables/useWaveSurfer.ts","../src/eventsEmitter/index.ts","../src/components/WaveSurferPlayer.vue.ts","../__VLS_types.d.ts","../node_modules/vite/types/hmrPayload.d.ts","../node_modules/vite/types/customEvent.d.ts","../node_modules/vite/types/hot.d.ts","../node_modules/vite/types/importGlob.d.ts","../node_modules/vite/types/importMeta.d.ts","../node_modules/vite/client.d.ts","../env.d.ts","../src/index.ts","../node_modules/wavesurfer.js/dist/plugins/record.d.ts","../src/composables/useWaveSurferRecorder.ts"],"fileInfos":[{"version":"1","affectsGlobalScope":true},"1","1","1","1","1","1",{"version":"0","affectsGlobalScope":true},{"version":"0","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},"1","1",{"version":"1","affectsGlobalScope":true},"1","1","1","1","1","1","1","1","0","0","0","0","0","0","0","0","0","0",{"version":"1","affectsGlobalScope":true},"1","1","0","1",{"version":"0","affectsGlobalScope":true},{"version":"0","affectsGlobalScope":true},"0","0","0","0"],"root":[[61,67],74,75,77],"options":{"composite":true,"declaration":true,"declarationDir":"./","esModuleInterop":true,"jsx":1,"jsxImportSource":"vue","module":99,"noImplicitThis":true,"outDir":"./","skipLibCheck":true,"strict":true,"target":99,"useDefineForClassFields":true},"fileIdsList":[[48,50,51,56],[73],[46,52,53],[54],[46],[46,47,48,50],[47,48,49],[53],[72],[68],[69],[70,71],[50,55],[50],[57,60],[57],[58],[58,59],[51,56,63,64,65],[51,56,60,61,62,63],[51,56,60,63],[51,56,61,63,76],[51,56,60],[51,60],[51,64,66],[51,56,60,61,62]],"referencedMap":[[67,1],[74,2],[54,3],[55,4],[47,5],[48,6],[50,7],[53,8],[73,9],[69,10],[70,11],[72,12],[56,13],[51,14],[58,15],[59,16],[76,17],[60,18],[66,19],[64,20],[61,21],[77,22],[62,23],[65,24],[75,25],[63,26]],"exportedModulesMap":[[67,1],[74,2],[54,3],[55,4],[47,5],[48,6],[50,7],[53,8],[73,9],[69,10],[70,11],[72,12],[56,13],[51,14],[58,15],[59,16],[76,17],[60,18],[66,19],[64,20],[61,21],[77,22],[62,23],[65,24],[75,25],[63,26]],"semanticDiagnosticsPerFile":[67,74,52,54,55,47,48,50,46,49,53,44,45,8,9,11,10,2,12,13,14,15,16,17,18,19,3,4,20,24,21,22,23,25,26,27,5,28,29,30,31,6,35,32,33,34,36,7,37,42,43,38,39,40,41,1,73,69,68,70,71,72,56,51,58,57,59,76,60,66,64,61,77,62,65,75,63],"affectedFilesPendingEmit":[66,64,61,77,62,65,75,63],"emitSignatures":[61,62,63,64,65,66,75,77]},"version":"5.3.3"}
1
+ {"program":{"fileNames":["../node_modules/typescript/lib/lib.es5.d.ts","../node_modules/typescript/lib/lib.es2015.d.ts","../node_modules/typescript/lib/lib.es2016.d.ts","../node_modules/typescript/lib/lib.es2017.d.ts","../node_modules/typescript/lib/lib.es2018.d.ts","../node_modules/typescript/lib/lib.es2019.d.ts","../node_modules/typescript/lib/lib.es2020.d.ts","../node_modules/typescript/lib/lib.dom.d.ts","../node_modules/typescript/lib/lib.dom.iterable.d.ts","../node_modules/typescript/lib/lib.es2015.core.d.ts","../node_modules/typescript/lib/lib.es2015.collection.d.ts","../node_modules/typescript/lib/lib.es2015.generator.d.ts","../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../node_modules/typescript/lib/lib.es2015.promise.d.ts","../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../node_modules/typescript/lib/lib.es2017.date.d.ts","../node_modules/typescript/lib/lib.es2017.object.d.ts","../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2017.string.d.ts","../node_modules/typescript/lib/lib.es2017.intl.d.ts","../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../node_modules/typescript/lib/lib.es2018.intl.d.ts","../node_modules/typescript/lib/lib.es2018.promise.d.ts","../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../node_modules/typescript/lib/lib.es2019.array.d.ts","../node_modules/typescript/lib/lib.es2019.object.d.ts","../node_modules/typescript/lib/lib.es2019.string.d.ts","../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../node_modules/typescript/lib/lib.es2019.intl.d.ts","../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../node_modules/typescript/lib/lib.es2020.date.d.ts","../node_modules/typescript/lib/lib.es2020.promise.d.ts","../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2020.string.d.ts","../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2020.intl.d.ts","../node_modules/typescript/lib/lib.es2020.number.d.ts","../node_modules/typescript/lib/lib.decorators.d.ts","../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../node_modules/@vue/shared/dist/shared.d.ts","../node_modules/@vue/reactivity/dist/reactivity.d.ts","../node_modules/@vue/runtime-core/dist/runtime-core.d.ts","../node_modules/csstype/index.d.ts","../node_modules/@vue/runtime-dom/dist/runtime-dom.d.ts","../node_modules/vue/jsx-runtime/index.d.ts","../node_modules/@babel/parser/typings/babel-parser.d.ts","../node_modules/source-map-js/source-map.d.ts","../node_modules/@vue/compiler-core/dist/compiler-core.d.ts","../node_modules/@vue/compiler-dom/dist/compiler-dom.d.ts","../node_modules/vue/dist/vue.d.mts","../node_modules/wavesurfer.js/dist/event-emitter.d.ts","../node_modules/wavesurfer.js/dist/base-plugin.d.ts","../node_modules/wavesurfer.js/dist/dom.d.ts","../node_modules/wavesurfer.js/dist/player.d.ts","../node_modules/wavesurfer.js/dist/wavesurfer.d.ts","../src/composables/useWaveSurferInstance.ts","../src/composables/useWaveSurferState.ts","../src/types/index.ts","../src/composables/useWaveSurfer.ts","../src/eventsEmitter/index.ts","../src/components/WaveSurferPlayer.vue.ts","../__VLS_types.d.ts","../node_modules/vite/types/hmrPayload.d.ts","../node_modules/vite/types/customEvent.d.ts","../node_modules/vite/types/hot.d.ts","../node_modules/vite/types/importGlob.d.ts","../node_modules/vite/types/importMeta.d.ts","../node_modules/vite/client.d.ts","../env.d.ts","../node_modules/wavesurfer.js/dist/plugins/record.d.ts","../src/composables/useWaveSurferRecorder.ts","../src/index.ts"],"fileInfos":[{"version":"1","affectsGlobalScope":true},"1","1","1","1","1","1",{"version":"0","affectsGlobalScope":true},{"version":"0","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},{"version":"1","affectsGlobalScope":true},"1","1",{"version":"1","affectsGlobalScope":true},"1","1","1","1","1","1","1","1","0","0","0","0","0","0","0","0","0","0","0",{"version":"1","affectsGlobalScope":true},"1","1","0","1",{"version":"0","affectsGlobalScope":true},{"version":"0","affectsGlobalScope":true},"0","0","0","0"],"root":[[62,68],75,77,78],"options":{"composite":true,"declaration":true,"declarationDir":"./","esModuleInterop":true,"jsx":1,"jsxImportSource":"vue","module":99,"noImplicitThis":true,"outDir":"./","skipLibCheck":true,"strict":true,"target":99,"useDefineForClassFields":true},"fileIdsList":[[48,50,51,56],[74],[46,52,53],[54],[46],[46,47,48,50],[47,48,49],[53],[73],[69],[70],[71,72],[50,55],[50],[57,61],[57],[58],[58,59,60],[51,56,64,65,66],[51,56,61,62,63,64],[51,56,61,64],[51,56,62,64,76],[51,56,61],[51,61],[51,65,67,77],[51,56,61,62,63]],"referencedMap":[[68,1],[75,2],[54,3],[55,4],[47,5],[48,6],[50,7],[53,8],[74,9],[70,10],[71,11],[73,12],[56,13],[51,14],[58,15],[60,16],[76,17],[61,18],[67,19],[65,20],[62,21],[77,22],[63,23],[66,24],[78,25],[64,26]],"exportedModulesMap":[[68,1],[75,2],[54,3],[55,4],[47,5],[48,6],[50,7],[53,8],[74,9],[70,10],[71,11],[73,12],[56,13],[51,14],[58,15],[60,16],[76,17],[61,18],[67,19],[65,20],[62,21],[77,22],[63,23],[66,24],[78,25],[64,26]],"semanticDiagnosticsPerFile":[68,75,52,54,55,47,48,50,46,49,53,44,45,8,9,11,10,2,12,13,14,15,16,17,18,19,3,4,20,24,21,22,23,25,26,27,5,28,29,30,31,6,35,32,33,34,36,7,37,42,43,38,39,40,41,1,74,70,69,71,72,73,56,51,58,59,57,60,76,61,67,65,62,77,63,66,78,64],"affectedFilesPendingEmit":[67,65,62,77,63,66,78,64],"emitSignatures":[62,63,64,65,66,67,77,78]},"version":"5.3.3"}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "author": "Meer Sagor",
3
3
  "name": "@meersagor/wavesurfer-vue",
4
- "version": "0.0.3",
4
+ "version": "0.0.5",
5
5
  "description": "Vue3 component for wavesurfer.js",
6
6
  "private": false,
7
7
  "type": "module",
8
- "license": "GPL-2.0",
8
+ "license": "MIT",
9
9
  "files": [
10
10
  "dist"
11
11
  ],
@@ -49,9 +49,10 @@
49
49
  },
50
50
  "dependencies": {
51
51
  "vue": "^3.3.11",
52
- "wavesurfer.js": "^7.6.4"
52
+ "wavesurfer.js": "^7.7.3"
53
53
  },
54
54
  "devDependencies": {
55
+ "@changesets/cli": "^2.27.1",
55
56
  "@rushstack/eslint-patch": "^1.3.3",
56
57
  "@tsconfig/node18": "^18.2.2",
57
58
  "@types/node": "^18.19.3",