nuxt-musicfyplayer 2.1.2 → 2.1.4
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 +4 -4
- package/dist/module.d.mts +2 -1
- package/dist/module.json +4 -4
- package/dist/module.mjs +2 -6
- package/dist/runtime/components/MusicfyPlayer.vue +52 -62
- package/dist/runtime/components/MusicfyPlayer.vue.d.ts +22 -0
- package/dist/runtime/composables/musicfyplayer.d.ts +2 -2
- package/dist/runtime/types/mediaelement.d.ts +6 -0
- package/dist/runtime/utils/mediaelement.d.ts +1 -6
- package/dist/types.d.mts +3 -1
- package/package.json +21 -30
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -7
- package/dist/runtime/types/colorthief.d.ts +0 -9
- package/dist/types.d.ts +0 -1
package/README.md
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
[![License][license-src]][license-href]
|
8
8
|
[![Nuxt][nuxt-src]][nuxt-href]
|
9
9
|
|
10
|
-
Embed a simple HTML music player from local or hosted audio on your Nuxt app using MediaElement.js and
|
10
|
+
Embed a simple HTML music player from local or hosted audio on your Nuxt app using MediaElement.js and fast-average-color
|
11
11
|
|
12
12
|
- [✨ Release Notes](https://github.com/Yizack/nuxt-musicfyplayer/blob/main/CHANGELOG.md)
|
13
13
|
- [🏀 Online playground](https://stackblitz.com/github/yizack/nuxt-musicfyplayer?file=playground%2Fapp.vue)
|
@@ -49,7 +49,7 @@ In the project, use the component `<MusicfyPlayer :config="" />`, where `config`
|
|
49
49
|
|
50
50
|
| Property | Description | Default value |
|
51
51
|
|---------------------------------------|--------------------------|---------------|
|
52
|
-
| [`config`](#musicfyplayer-
|
52
|
+
| [`config`](#musicfyplayer-composable) | MusicfyPlayer composable | |
|
53
53
|
| `width` | Music player width | `100%` |
|
54
54
|
| `height` | Music player height | `450px` |
|
55
55
|
|
@@ -120,7 +120,7 @@ const config = useMusicfyPlayer({
|
|
120
120
|
rlkey: "g7sqo9y5zl3f69oxftzo5auc5"
|
121
121
|
},
|
122
122
|
image: {
|
123
|
-
src: "https://dimatis.
|
123
|
+
src: "https://dimatis.music/images/reminiscences.jpg",
|
124
124
|
alt: "Dimatis - Reminiscences"
|
125
125
|
},
|
126
126
|
color: {
|
@@ -146,7 +146,7 @@ Check out the [🏀 Online playground](https://stackblitz.com/github/yizack/nuxt
|
|
146
146
|
|
147
147
|
## Credits
|
148
148
|
|
149
|
-
- Detect
|
149
|
+
- Detect average color with [fast-average-color](https://github.com/fast-average-color/fast-average-color)
|
150
150
|
- Music player controls by [MediaElement.js](https://www.mediaelementjs.com/)
|
151
151
|
- [Nuxt](https://github.com/nuxt/nuxt), the JavaScript framework for creating SSR Vue applications and its [Module Author Guide](https://nuxt.com/docs/guide/going-further/modules)
|
152
152
|
|
package/dist/module.d.mts
CHANGED
package/dist/module.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "nuxt-musicfyplayer",
|
3
|
-
"configKey": "
|
3
|
+
"configKey": "musicfyplayer",
|
4
4
|
"compatibility": {
|
5
5
|
"nuxt": ">=3.0.0"
|
6
6
|
},
|
7
|
-
"version": "2.1.
|
7
|
+
"version": "2.1.4",
|
8
8
|
"builder": {
|
9
|
-
"@nuxt/module-builder": "0.
|
10
|
-
"unbuild": "
|
9
|
+
"@nuxt/module-builder": "1.0.0",
|
10
|
+
"unbuild": "3.5.0"
|
11
11
|
}
|
12
12
|
}
|
package/dist/module.mjs
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
import { defineNuxtModule, createResolver, addComponent, addImportsDir
|
1
|
+
import { defineNuxtModule, createResolver, addComponent, addImportsDir } from '@nuxt/kit';
|
2
2
|
|
3
3
|
const module = defineNuxtModule({
|
4
4
|
meta: {
|
5
5
|
name: "nuxt-musicfyplayer",
|
6
|
-
configKey: "
|
6
|
+
configKey: "musicfyplayer",
|
7
7
|
compatibility: {
|
8
8
|
nuxt: ">=3.0.0"
|
9
9
|
}
|
@@ -16,10 +16,6 @@ const module = defineNuxtModule({
|
|
16
16
|
filePath: resolve("./runtime/components/MusicfyPlayer.vue")
|
17
17
|
});
|
18
18
|
addImportsDir(resolve("./runtime/composables"));
|
19
|
-
addTypeTemplate({
|
20
|
-
filename: "types/colorthief.d.ts",
|
21
|
-
src: resolve("./runtime/types/colorthief.d.ts")
|
22
|
-
});
|
23
19
|
}
|
24
20
|
});
|
25
21
|
|
@@ -1,62 +1,52 @@
|
|
1
|
-
<script setup
|
2
|
-
import
|
3
|
-
import
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
const
|
29
|
-
const
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
alwaysShowControls: true,
|
51
|
-
timeAndDurationSeparator: '<span></span>',
|
52
|
-
iPadUseNativeControls: false,
|
53
|
-
iPhoneUseNativeControls: false,
|
54
|
-
AndroidUseNativeControls: false,
|
55
|
-
})
|
56
|
-
})
|
57
|
-
</script>
|
58
|
-
|
59
|
-
<template>
|
1
|
+
<script setup>
|
2
|
+
import { FastAverageColor } from "fast-average-color";
|
3
|
+
import { onMounted, ref, useTemplateRef } from "#imports";
|
4
|
+
const props = defineProps({
|
5
|
+
config: {
|
6
|
+
type: Object,
|
7
|
+
required: true
|
8
|
+
},
|
9
|
+
width: {
|
10
|
+
type: String,
|
11
|
+
required: false,
|
12
|
+
default: "100%"
|
13
|
+
},
|
14
|
+
height: {
|
15
|
+
type: String,
|
16
|
+
required: false,
|
17
|
+
default: "450px"
|
18
|
+
}
|
19
|
+
});
|
20
|
+
const audio = useTemplateRef("audio");
|
21
|
+
const size = ref({ width: props.width, height: props.height });
|
22
|
+
const backgroundColor = ref();
|
23
|
+
if (import.meta.client && props.config.colorDetect) {
|
24
|
+
const img = new Image();
|
25
|
+
img.crossOrigin = "Anonymous";
|
26
|
+
img.src = props.config.imageSrc;
|
27
|
+
img.onload = () => {
|
28
|
+
const fac = new FastAverageColor();
|
29
|
+
const color = fac.getColor(img);
|
30
|
+
backgroundColor.value = color ? color.rgba : void 0;
|
31
|
+
};
|
32
|
+
}
|
33
|
+
onMounted(async () => {
|
34
|
+
if (!audio.value) return;
|
35
|
+
const { mediaElementPlayer } = await import("./../utils/mediaelement");
|
36
|
+
mediaElementPlayer(audio.value, {
|
37
|
+
iconSprite: "",
|
38
|
+
audioHeight: 40,
|
39
|
+
features: ["playpause", "current", "duration", "progress", "volume", "tracks", "fullscreen"],
|
40
|
+
alwaysShowControls: true,
|
41
|
+
timeAndDurationSeparator: "<span></span>",
|
42
|
+
iPadUseNativeControls: false,
|
43
|
+
iPhoneUseNativeControls: false,
|
44
|
+
AndroidUseNativeControls: false
|
45
|
+
});
|
46
|
+
});
|
47
|
+
</script>
|
48
|
+
|
49
|
+
<template>
|
60
50
|
<div class="musicfyplayer" :class="{ [`${config.colorClass}`]: config.colorClass }" :style="{ ...size, backgroundColor }">
|
61
51
|
<div class="mp__box">
|
62
52
|
<div class="mp__controls">
|
@@ -75,8 +65,8 @@ onMounted(async () => {
|
|
75
65
|
</div>
|
76
66
|
</div>
|
77
67
|
</div>
|
78
|
-
</template>
|
79
|
-
|
68
|
+
</template>
|
69
|
+
|
80
70
|
<style>
|
81
71
|
@import "./../assets/css/musicfyplayer.css";
|
82
|
-
</style>
|
72
|
+
</style>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import type { MusicfyPlayerConfig } from './../types/musicfyplayer.js';
|
2
|
+
type __VLS_Props = {
|
3
|
+
/**
|
4
|
+
* The configuration of the player
|
5
|
+
*/
|
6
|
+
config: MusicfyPlayerConfig;
|
7
|
+
/**
|
8
|
+
* The width and height of the player
|
9
|
+
* @default '100%'
|
10
|
+
*/
|
11
|
+
width?: string;
|
12
|
+
/**
|
13
|
+
* The height of the player
|
14
|
+
* @default '450px'
|
15
|
+
*/
|
16
|
+
height?: string;
|
17
|
+
};
|
18
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
19
|
+
width: string;
|
20
|
+
height: string;
|
21
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
22
|
+
export default _default;
|
@@ -5,5 +5,5 @@ import type { MusicfyPlayerConfig, MusicfyPlayerComposableConfig } from './../ty
|
|
5
5
|
* @param config - Musicfy Player composable configuration
|
6
6
|
* @returns Musicfy Player configuration
|
7
7
|
*/
|
8
|
-
export declare const useMusicfyPlayer: <T extends keyof Providers>(config: MusicfyPlayerComposableConfig<T>) => MusicfyPlayerConfig;
|
9
|
-
export declare const defineMusicfyPlayer: <T extends keyof Providers>(config: MusicfyPlayerComposableConfig<T>) => MusicfyPlayerConfig;
|
8
|
+
export declare const useMusicfyPlayer: <T extends keyof Providers = "local">(config: MusicfyPlayerComposableConfig<T>) => MusicfyPlayerConfig;
|
9
|
+
export declare const defineMusicfyPlayer: <T extends keyof Providers = "local">(config: MusicfyPlayerComposableConfig<T>) => MusicfyPlayerConfig;
|
@@ -1,8 +1,3 @@
|
|
1
1
|
import 'mediaelement/build/mediaelement-and-player.js';
|
2
|
-
import type {
|
3
|
-
declare global {
|
4
|
-
interface Window {
|
5
|
-
MediaElementPlayer: MediaElementPlayer | undefined;
|
6
|
-
}
|
7
|
-
}
|
2
|
+
import type { MediaElementPlayerOptions } from '../types/mediaelement.js';
|
8
3
|
export declare const mediaElementPlayer: (element: HTMLAudioElement, options: MediaElementPlayerOptions) => void;
|
package/dist/types.d.mts
CHANGED
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "nuxt-musicfyplayer",
|
3
|
-
"version": "2.1.
|
4
|
-
"description": "Embed a simple and beautiful HTML music player from local or hosted audio on your website using MediaElement.js and
|
3
|
+
"version": "2.1.4",
|
4
|
+
"description": "Embed a simple and beautiful HTML music player from local or hosted audio on your website using MediaElement.js and fast-average-color",
|
5
5
|
"keywords": [
|
6
6
|
"nuxt",
|
7
7
|
"nuxt3",
|
@@ -16,19 +16,17 @@
|
|
16
16
|
"author": {
|
17
17
|
"name": "Yizack Rangel",
|
18
18
|
"email": "yizackr@gmail.com",
|
19
|
-
"url": "https://yizack.com
|
19
|
+
"url": "https://yizack.com"
|
20
20
|
},
|
21
21
|
"license": "MIT",
|
22
22
|
"type": "module",
|
23
23
|
"exports": {
|
24
24
|
".": {
|
25
|
-
"types": "./dist/types.d.
|
26
|
-
"import": "./dist/module.mjs"
|
27
|
-
"require": "./dist/module.cjs"
|
25
|
+
"types": "./dist/types.d.mts",
|
26
|
+
"import": "./dist/module.mjs"
|
28
27
|
}
|
29
28
|
},
|
30
|
-
"main": "./dist/module.
|
31
|
-
"types": "./dist/types.d.ts",
|
29
|
+
"main": "./dist/module.mjs",
|
32
30
|
"files": [
|
33
31
|
"dist"
|
34
32
|
],
|
@@ -45,29 +43,22 @@
|
|
45
43
|
"test:watch": "vitest watch"
|
46
44
|
},
|
47
45
|
"dependencies": {
|
48
|
-
"@nuxt/kit": "^3.
|
49
|
-
"
|
46
|
+
"@nuxt/kit": "^3.16.2",
|
47
|
+
"fast-average-color": "^9.5.0",
|
50
48
|
"mediaelement": "^7.0.7"
|
51
49
|
},
|
52
50
|
"devDependencies": {
|
53
|
-
"@nuxt/devtools": "^2.
|
54
|
-
"@nuxt/eslint-config": "^1.0
|
55
|
-
"@nuxt/module-builder": "^0.
|
56
|
-
"@nuxt/schema": "^3.
|
57
|
-
"@nuxt/test-utils": "^3.
|
58
|
-
"@types/node": "^22.
|
59
|
-
"changelogen": "^0.
|
60
|
-
"eslint": "^9.
|
61
|
-
"nuxt": "^3.
|
62
|
-
"vitest": "^3.
|
63
|
-
"vue-tsc": "^2.2.
|
51
|
+
"@nuxt/devtools": "^2.3.2",
|
52
|
+
"@nuxt/eslint-config": "^1.3.0",
|
53
|
+
"@nuxt/module-builder": "^1.0.0",
|
54
|
+
"@nuxt/schema": "^3.16.2",
|
55
|
+
"@nuxt/test-utils": "^3.17.2",
|
56
|
+
"@types/node": "^22.14.0",
|
57
|
+
"changelogen": "^0.6.1",
|
58
|
+
"eslint": "^9.24.0",
|
59
|
+
"nuxt": "^3.16.2",
|
60
|
+
"vitest": "^3.1.1",
|
61
|
+
"vue-tsc": "^2.2.8"
|
64
62
|
},
|
65
|
-
"
|
66
|
-
|
67
|
-
"repo": "Yizack/nuxt-musicfyplayer",
|
68
|
-
"provider": "github",
|
69
|
-
"domain": "github.com"
|
70
|
-
}
|
71
|
-
},
|
72
|
-
"packageManager": "pnpm@10.2.1"
|
73
|
-
}
|
63
|
+
"packageManager": "pnpm@10.7.1"
|
64
|
+
}
|
package/dist/module.cjs
DELETED
package/dist/module.d.ts
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
declare module 'colorthief' {
|
2
|
-
type Palette = [red: number, green: number, blue: number]
|
3
|
-
export default class ColorThief {
|
4
|
-
getColor(sourceImage: HTMLImageElement, quality?: number): Palette
|
5
|
-
static getColor(sourceImage: string, quality?: number): Promise<Palette>
|
6
|
-
getPaletteFromURL(URL: string, colorCount?: number, quality?: number): Promise<Palette[]>
|
7
|
-
getColorFromURL(imageURL: string, quality?: number): Promise<Palette>
|
8
|
-
}
|
9
|
-
}
|
package/dist/types.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export { type ModuleOptions, default } from './module'
|