@gui-chat-plugin/music 0.0.1 → 0.0.3
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 +10 -0
- package/dist/core.cjs +1 -94
- package/dist/core.js +2 -143
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -7
- package/dist/samples-C8a37dDP.js +44 -0
- package/dist/samples-msJuWhn1.cjs +94 -0
- package/dist/style.css +3 -1
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +100 -126
- package/package.json +25 -16
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# @gui-chat-plugin/music
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@gui-chat-plugin/music)
|
|
4
|
+
|
|
3
5
|
MusicXML sheet music plugin for GUI Chat applications. Displays and plays sheet music from MusicXML format.
|
|
4
6
|
|
|
5
7
|
## Features
|
|
@@ -85,6 +87,14 @@ yarn build
|
|
|
85
87
|
yarn lint
|
|
86
88
|
```
|
|
87
89
|
|
|
90
|
+
## Test Prompts
|
|
91
|
+
|
|
92
|
+
Try these prompts to test the plugin:
|
|
93
|
+
|
|
94
|
+
1. "Create sheet music for a simple C major scale"
|
|
95
|
+
2. "Write a short melody in G major"
|
|
96
|
+
3. "Generate sheet music for Twinkle Twinkle Little Star"
|
|
97
|
+
|
|
88
98
|
## License
|
|
89
99
|
|
|
90
100
|
MIT
|
package/dist/core.cjs
CHANGED
|
@@ -1,94 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Music rendering failed`,t),{message:`Music rendering failed: ${t instanceof Error?t.message:"Unknown error"}`,instructions:"Acknowledge that the music rendering failed."}}},a=`<?xml version="1.0" encoding="UTF-8"?>
|
|
3
|
-
<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 3.1 Partwise//EN" "http://www.musicxml.org/dtds/partwise.dtd">
|
|
4
|
-
<score-partwise version="3.1">
|
|
5
|
-
<part-list>
|
|
6
|
-
<score-part id="P1">
|
|
7
|
-
<part-name>Piano</part-name>
|
|
8
|
-
</score-part>
|
|
9
|
-
</part-list>
|
|
10
|
-
<part id="P1">
|
|
11
|
-
<measure number="1">
|
|
12
|
-
<attributes>
|
|
13
|
-
<divisions>1</divisions>
|
|
14
|
-
<key>
|
|
15
|
-
<fifths>0</fifths>
|
|
16
|
-
</key>
|
|
17
|
-
<time>
|
|
18
|
-
<beats>4</beats>
|
|
19
|
-
<beat-type>4</beat-type>
|
|
20
|
-
</time>
|
|
21
|
-
<clef>
|
|
22
|
-
<sign>G</sign>
|
|
23
|
-
<line>2</line>
|
|
24
|
-
</clef>
|
|
25
|
-
</attributes>
|
|
26
|
-
<note>
|
|
27
|
-
<pitch>
|
|
28
|
-
<step>C</step>
|
|
29
|
-
<octave>4</octave>
|
|
30
|
-
</pitch>
|
|
31
|
-
<duration>1</duration>
|
|
32
|
-
<type>quarter</type>
|
|
33
|
-
</note>
|
|
34
|
-
<note>
|
|
35
|
-
<pitch>
|
|
36
|
-
<step>D</step>
|
|
37
|
-
<octave>4</octave>
|
|
38
|
-
</pitch>
|
|
39
|
-
<duration>1</duration>
|
|
40
|
-
<type>quarter</type>
|
|
41
|
-
</note>
|
|
42
|
-
<note>
|
|
43
|
-
<pitch>
|
|
44
|
-
<step>E</step>
|
|
45
|
-
<octave>4</octave>
|
|
46
|
-
</pitch>
|
|
47
|
-
<duration>1</duration>
|
|
48
|
-
<type>quarter</type>
|
|
49
|
-
</note>
|
|
50
|
-
<note>
|
|
51
|
-
<pitch>
|
|
52
|
-
<step>F</step>
|
|
53
|
-
<octave>4</octave>
|
|
54
|
-
</pitch>
|
|
55
|
-
<duration>1</duration>
|
|
56
|
-
<type>quarter</type>
|
|
57
|
-
</note>
|
|
58
|
-
</measure>
|
|
59
|
-
<measure number="2">
|
|
60
|
-
<note>
|
|
61
|
-
<pitch>
|
|
62
|
-
<step>G</step>
|
|
63
|
-
<octave>4</octave>
|
|
64
|
-
</pitch>
|
|
65
|
-
<duration>1</duration>
|
|
66
|
-
<type>quarter</type>
|
|
67
|
-
</note>
|
|
68
|
-
<note>
|
|
69
|
-
<pitch>
|
|
70
|
-
<step>A</step>
|
|
71
|
-
<octave>4</octave>
|
|
72
|
-
</pitch>
|
|
73
|
-
<duration>1</duration>
|
|
74
|
-
<type>quarter</type>
|
|
75
|
-
</note>
|
|
76
|
-
<note>
|
|
77
|
-
<pitch>
|
|
78
|
-
<step>B</step>
|
|
79
|
-
<octave>4</octave>
|
|
80
|
-
</pitch>
|
|
81
|
-
<duration>1</duration>
|
|
82
|
-
<type>quarter</type>
|
|
83
|
-
</note>
|
|
84
|
-
<note>
|
|
85
|
-
<pitch>
|
|
86
|
-
<step>C</step>
|
|
87
|
-
<octave>5</octave>
|
|
88
|
-
</pitch>
|
|
89
|
-
<duration>1</duration>
|
|
90
|
-
<type>quarter</type>
|
|
91
|
-
</note>
|
|
92
|
-
</measure>
|
|
93
|
-
</part>
|
|
94
|
-
</score-partwise>`,n=[{name:"C Major Scale",args:{musicXML:a,title:"C Major Scale"}}];exports.TOOL_DEFINITION=s;exports.TOOL_NAME=e;exports.samples=n;exports.showMusic=o;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./samples-msJuWhn1.cjs`);exports.TOOL_DEFINITION=e.r,exports.TOOL_NAME=e.i,exports.samples=e.t,exports.showMusic=e.n;
|
package/dist/core.js
CHANGED
|
@@ -1,143 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
name: r,
|
|
4
|
-
description: "Display sheet music from MusicXML format.",
|
|
5
|
-
parameters: {
|
|
6
|
-
type: "object",
|
|
7
|
-
properties: {
|
|
8
|
-
musicXML: {
|
|
9
|
-
type: "string",
|
|
10
|
-
description: "The music in MusicXML format"
|
|
11
|
-
},
|
|
12
|
-
title: {
|
|
13
|
-
type: "string",
|
|
14
|
-
description: "Optional title for the music piece"
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
required: ["musicXML"]
|
|
18
|
-
}
|
|
19
|
-
}, n = async (a, e) => {
|
|
20
|
-
try {
|
|
21
|
-
const { musicXML: t, title: i } = e;
|
|
22
|
-
if (!t || typeof t != "string")
|
|
23
|
-
throw new Error("musicXML parameter is required and must be a string");
|
|
24
|
-
return {
|
|
25
|
-
message: "Sheet music displayed",
|
|
26
|
-
title: i || "Sheet Music",
|
|
27
|
-
data: { musicXML: t },
|
|
28
|
-
instructions: "Acknowledge that the sheet music has been displayed to the user."
|
|
29
|
-
};
|
|
30
|
-
} catch (t) {
|
|
31
|
-
return console.error(`ERR: exception
|
|
32
|
-
Music rendering failed`, t), {
|
|
33
|
-
message: `Music rendering failed: ${t instanceof Error ? t.message : "Unknown error"}`,
|
|
34
|
-
instructions: "Acknowledge that the music rendering failed."
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
}, s = `<?xml version="1.0" encoding="UTF-8"?>
|
|
38
|
-
<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 3.1 Partwise//EN" "http://www.musicxml.org/dtds/partwise.dtd">
|
|
39
|
-
<score-partwise version="3.1">
|
|
40
|
-
<part-list>
|
|
41
|
-
<score-part id="P1">
|
|
42
|
-
<part-name>Piano</part-name>
|
|
43
|
-
</score-part>
|
|
44
|
-
</part-list>
|
|
45
|
-
<part id="P1">
|
|
46
|
-
<measure number="1">
|
|
47
|
-
<attributes>
|
|
48
|
-
<divisions>1</divisions>
|
|
49
|
-
<key>
|
|
50
|
-
<fifths>0</fifths>
|
|
51
|
-
</key>
|
|
52
|
-
<time>
|
|
53
|
-
<beats>4</beats>
|
|
54
|
-
<beat-type>4</beat-type>
|
|
55
|
-
</time>
|
|
56
|
-
<clef>
|
|
57
|
-
<sign>G</sign>
|
|
58
|
-
<line>2</line>
|
|
59
|
-
</clef>
|
|
60
|
-
</attributes>
|
|
61
|
-
<note>
|
|
62
|
-
<pitch>
|
|
63
|
-
<step>C</step>
|
|
64
|
-
<octave>4</octave>
|
|
65
|
-
</pitch>
|
|
66
|
-
<duration>1</duration>
|
|
67
|
-
<type>quarter</type>
|
|
68
|
-
</note>
|
|
69
|
-
<note>
|
|
70
|
-
<pitch>
|
|
71
|
-
<step>D</step>
|
|
72
|
-
<octave>4</octave>
|
|
73
|
-
</pitch>
|
|
74
|
-
<duration>1</duration>
|
|
75
|
-
<type>quarter</type>
|
|
76
|
-
</note>
|
|
77
|
-
<note>
|
|
78
|
-
<pitch>
|
|
79
|
-
<step>E</step>
|
|
80
|
-
<octave>4</octave>
|
|
81
|
-
</pitch>
|
|
82
|
-
<duration>1</duration>
|
|
83
|
-
<type>quarter</type>
|
|
84
|
-
</note>
|
|
85
|
-
<note>
|
|
86
|
-
<pitch>
|
|
87
|
-
<step>F</step>
|
|
88
|
-
<octave>4</octave>
|
|
89
|
-
</pitch>
|
|
90
|
-
<duration>1</duration>
|
|
91
|
-
<type>quarter</type>
|
|
92
|
-
</note>
|
|
93
|
-
</measure>
|
|
94
|
-
<measure number="2">
|
|
95
|
-
<note>
|
|
96
|
-
<pitch>
|
|
97
|
-
<step>G</step>
|
|
98
|
-
<octave>4</octave>
|
|
99
|
-
</pitch>
|
|
100
|
-
<duration>1</duration>
|
|
101
|
-
<type>quarter</type>
|
|
102
|
-
</note>
|
|
103
|
-
<note>
|
|
104
|
-
<pitch>
|
|
105
|
-
<step>A</step>
|
|
106
|
-
<octave>4</octave>
|
|
107
|
-
</pitch>
|
|
108
|
-
<duration>1</duration>
|
|
109
|
-
<type>quarter</type>
|
|
110
|
-
</note>
|
|
111
|
-
<note>
|
|
112
|
-
<pitch>
|
|
113
|
-
<step>B</step>
|
|
114
|
-
<octave>4</octave>
|
|
115
|
-
</pitch>
|
|
116
|
-
<duration>1</duration>
|
|
117
|
-
<type>quarter</type>
|
|
118
|
-
</note>
|
|
119
|
-
<note>
|
|
120
|
-
<pitch>
|
|
121
|
-
<step>C</step>
|
|
122
|
-
<octave>5</octave>
|
|
123
|
-
</pitch>
|
|
124
|
-
<duration>1</duration>
|
|
125
|
-
<type>quarter</type>
|
|
126
|
-
</note>
|
|
127
|
-
</measure>
|
|
128
|
-
</part>
|
|
129
|
-
</score-partwise>`, c = [
|
|
130
|
-
{
|
|
131
|
-
name: "C Major Scale",
|
|
132
|
-
args: {
|
|
133
|
-
musicXML: s,
|
|
134
|
-
title: "C Major Scale"
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
];
|
|
138
|
-
export {
|
|
139
|
-
o as TOOL_DEFINITION,
|
|
140
|
-
r as TOOL_NAME,
|
|
141
|
-
c as samples,
|
|
142
|
-
n as showMusic
|
|
143
|
-
};
|
|
1
|
+
import { i as e, n as t, r as n, t as r } from "./samples-C8a37dDP.js";
|
|
2
|
+
export { n as TOOL_DEFINITION, e as TOOL_NAME, r as samples, t as showMusic };
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./samples-msJuWhn1.cjs`);require(`./core.cjs`),exports.TOOL_DEFINITION=e.r,exports.TOOL_NAME=e.i,exports.samples=e.t,exports.showMusic=e.n;
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./core";
|
|
1
|
+
export * from "./core/index";
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
I as TOOL_NAME,
|
|
5
|
-
N as samples,
|
|
6
|
-
T as showMusic
|
|
7
|
-
};
|
|
1
|
+
import { i as e, n as t, r as n, t as r } from "./samples-C8a37dDP.js";
|
|
2
|
+
import "./core.js";
|
|
3
|
+
export { n as TOOL_DEFINITION, e as TOOL_NAME, r as samples, t as showMusic };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
//#region src/core/definition.ts
|
|
2
|
+
var e = "showMusic", t = {
|
|
3
|
+
type: "function",
|
|
4
|
+
name: e,
|
|
5
|
+
description: "Display sheet music from MusicXML format.",
|
|
6
|
+
parameters: {
|
|
7
|
+
type: "object",
|
|
8
|
+
properties: {
|
|
9
|
+
musicXML: {
|
|
10
|
+
type: "string",
|
|
11
|
+
description: "The music in MusicXML format"
|
|
12
|
+
},
|
|
13
|
+
title: {
|
|
14
|
+
type: "string",
|
|
15
|
+
description: "Optional title for the music piece"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
required: ["musicXML"]
|
|
19
|
+
}
|
|
20
|
+
}, n = async (e, t) => {
|
|
21
|
+
try {
|
|
22
|
+
let { musicXML: e, title: n } = t;
|
|
23
|
+
if (!e || typeof e != "string") throw Error("musicXML parameter is required and must be a string");
|
|
24
|
+
return {
|
|
25
|
+
message: "Sheet music displayed",
|
|
26
|
+
title: n || "Sheet Music",
|
|
27
|
+
data: { musicXML: e },
|
|
28
|
+
instructions: "Acknowledge that the sheet music has been displayed to the user."
|
|
29
|
+
};
|
|
30
|
+
} catch (e) {
|
|
31
|
+
return console.error("ERR: exception\n Music rendering failed", e), {
|
|
32
|
+
message: `Music rendering failed: ${e instanceof Error ? e.message : "Unknown error"}`,
|
|
33
|
+
instructions: "Acknowledge that the music rendering failed."
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}, r = [{
|
|
37
|
+
name: "C Major Scale",
|
|
38
|
+
args: {
|
|
39
|
+
musicXML: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE score-partwise PUBLIC \"-//Recordare//DTD MusicXML 3.1 Partwise//EN\" \"http://www.musicxml.org/dtds/partwise.dtd\">\n<score-partwise version=\"3.1\">\n <part-list>\n <score-part id=\"P1\">\n <part-name>Piano</part-name>\n </score-part>\n </part-list>\n <part id=\"P1\">\n <measure number=\"1\">\n <attributes>\n <divisions>1</divisions>\n <key>\n <fifths>0</fifths>\n </key>\n <time>\n <beats>4</beats>\n <beat-type>4</beat-type>\n </time>\n <clef>\n <sign>G</sign>\n <line>2</line>\n </clef>\n </attributes>\n <note>\n <pitch>\n <step>C</step>\n <octave>4</octave>\n </pitch>\n <duration>1</duration>\n <type>quarter</type>\n </note>\n <note>\n <pitch>\n <step>D</step>\n <octave>4</octave>\n </pitch>\n <duration>1</duration>\n <type>quarter</type>\n </note>\n <note>\n <pitch>\n <step>E</step>\n <octave>4</octave>\n </pitch>\n <duration>1</duration>\n <type>quarter</type>\n </note>\n <note>\n <pitch>\n <step>F</step>\n <octave>4</octave>\n </pitch>\n <duration>1</duration>\n <type>quarter</type>\n </note>\n </measure>\n <measure number=\"2\">\n <note>\n <pitch>\n <step>G</step>\n <octave>4</octave>\n </pitch>\n <duration>1</duration>\n <type>quarter</type>\n </note>\n <note>\n <pitch>\n <step>A</step>\n <octave>4</octave>\n </pitch>\n <duration>1</duration>\n <type>quarter</type>\n </note>\n <note>\n <pitch>\n <step>B</step>\n <octave>4</octave>\n </pitch>\n <duration>1</duration>\n <type>quarter</type>\n </note>\n <note>\n <pitch>\n <step>C</step>\n <octave>5</octave>\n </pitch>\n <duration>1</duration>\n <type>quarter</type>\n </note>\n </measure>\n </part>\n</score-partwise>",
|
|
40
|
+
title: "C Major Scale"
|
|
41
|
+
}
|
|
42
|
+
}];
|
|
43
|
+
//#endregion
|
|
44
|
+
export { e as i, n, t as r, r as t };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
var e=`showMusic`,t={type:`function`,name:e,description:`Display sheet music from MusicXML format.`,parameters:{type:`object`,properties:{musicXML:{type:`string`,description:`The music in MusicXML format`},title:{type:`string`,description:`Optional title for the music piece`}},required:[`musicXML`]}},n=async(e,t)=>{try{let{musicXML:e,title:n}=t;if(!e||typeof e!=`string`)throw Error(`musicXML parameter is required and must be a string`);return{message:`Sheet music displayed`,title:n||`Sheet Music`,data:{musicXML:e},instructions:`Acknowledge that the sheet music has been displayed to the user.`}}catch(e){return console.error(`ERR: exception
|
|
2
|
+
Music rendering failed`,e),{message:`Music rendering failed: ${e instanceof Error?e.message:`Unknown error`}`,instructions:`Acknowledge that the music rendering failed.`}}},r=[{name:`C Major Scale`,args:{musicXML:`<?xml version="1.0" encoding="UTF-8"?>
|
|
3
|
+
<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 3.1 Partwise//EN" "http://www.musicxml.org/dtds/partwise.dtd">
|
|
4
|
+
<score-partwise version="3.1">
|
|
5
|
+
<part-list>
|
|
6
|
+
<score-part id="P1">
|
|
7
|
+
<part-name>Piano</part-name>
|
|
8
|
+
</score-part>
|
|
9
|
+
</part-list>
|
|
10
|
+
<part id="P1">
|
|
11
|
+
<measure number="1">
|
|
12
|
+
<attributes>
|
|
13
|
+
<divisions>1</divisions>
|
|
14
|
+
<key>
|
|
15
|
+
<fifths>0</fifths>
|
|
16
|
+
</key>
|
|
17
|
+
<time>
|
|
18
|
+
<beats>4</beats>
|
|
19
|
+
<beat-type>4</beat-type>
|
|
20
|
+
</time>
|
|
21
|
+
<clef>
|
|
22
|
+
<sign>G</sign>
|
|
23
|
+
<line>2</line>
|
|
24
|
+
</clef>
|
|
25
|
+
</attributes>
|
|
26
|
+
<note>
|
|
27
|
+
<pitch>
|
|
28
|
+
<step>C</step>
|
|
29
|
+
<octave>4</octave>
|
|
30
|
+
</pitch>
|
|
31
|
+
<duration>1</duration>
|
|
32
|
+
<type>quarter</type>
|
|
33
|
+
</note>
|
|
34
|
+
<note>
|
|
35
|
+
<pitch>
|
|
36
|
+
<step>D</step>
|
|
37
|
+
<octave>4</octave>
|
|
38
|
+
</pitch>
|
|
39
|
+
<duration>1</duration>
|
|
40
|
+
<type>quarter</type>
|
|
41
|
+
</note>
|
|
42
|
+
<note>
|
|
43
|
+
<pitch>
|
|
44
|
+
<step>E</step>
|
|
45
|
+
<octave>4</octave>
|
|
46
|
+
</pitch>
|
|
47
|
+
<duration>1</duration>
|
|
48
|
+
<type>quarter</type>
|
|
49
|
+
</note>
|
|
50
|
+
<note>
|
|
51
|
+
<pitch>
|
|
52
|
+
<step>F</step>
|
|
53
|
+
<octave>4</octave>
|
|
54
|
+
</pitch>
|
|
55
|
+
<duration>1</duration>
|
|
56
|
+
<type>quarter</type>
|
|
57
|
+
</note>
|
|
58
|
+
</measure>
|
|
59
|
+
<measure number="2">
|
|
60
|
+
<note>
|
|
61
|
+
<pitch>
|
|
62
|
+
<step>G</step>
|
|
63
|
+
<octave>4</octave>
|
|
64
|
+
</pitch>
|
|
65
|
+
<duration>1</duration>
|
|
66
|
+
<type>quarter</type>
|
|
67
|
+
</note>
|
|
68
|
+
<note>
|
|
69
|
+
<pitch>
|
|
70
|
+
<step>A</step>
|
|
71
|
+
<octave>4</octave>
|
|
72
|
+
</pitch>
|
|
73
|
+
<duration>1</duration>
|
|
74
|
+
<type>quarter</type>
|
|
75
|
+
</note>
|
|
76
|
+
<note>
|
|
77
|
+
<pitch>
|
|
78
|
+
<step>B</step>
|
|
79
|
+
<octave>4</octave>
|
|
80
|
+
</pitch>
|
|
81
|
+
<duration>1</duration>
|
|
82
|
+
<type>quarter</type>
|
|
83
|
+
</note>
|
|
84
|
+
<note>
|
|
85
|
+
<pitch>
|
|
86
|
+
<step>C</step>
|
|
87
|
+
<octave>5</octave>
|
|
88
|
+
</pitch>
|
|
89
|
+
<duration>1</duration>
|
|
90
|
+
<type>quarter</type>
|
|
91
|
+
</note>
|
|
92
|
+
</measure>
|
|
93
|
+
</part>
|
|
94
|
+
</score-partwise>`,title:`C Major Scale`}}];Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return r}});
|
package/dist/style.css
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */
|
|
2
|
+
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-500:oklch(63.7% .237 25.331);--color-blue-500:oklch(62.3% .214 259.815);--color-indigo-100:oklch(93% .034 272.788);--color-indigo-200:oklch(87% .065 274.039);--color-indigo-700:oklch(45.7% .24 277.023);--color-purple-50:oklch(97.7% .014 308.299);--color-purple-600:oklch(55.8% .288 302.321);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-white:#fff;--spacing:.25rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--font-weight-medium:500;--font-weight-bold:700;--radius-md:.375rem;--radius-lg:.5rem;--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.end{inset-inline-end:var(--spacing)}.mx-auto{margin-inline:auto}.mt-1{margin-top:calc(var(--spacing) * 1)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-5{margin-bottom:calc(var(--spacing) * 5)}.mb-8{margin-bottom:calc(var(--spacing) * 8)}.contents{display:contents}.flex{display:flex}.h-\[600px\]{height:600px}.h-full{height:100%}.min-h-full{min-height:100%}.w-20{width:calc(var(--spacing) * 20)}.w-full{width:100%}.max-w-3xl{max-width:var(--container-3xl)}.max-w-\[200px\]{max-width:200px}.flex-1{flex:1}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-center{justify-content:center}.gap-1{gap:calc(var(--spacing) * 1)}.gap-2{gap:calc(var(--spacing) * 2)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-gray-300{border-color:var(--color-gray-300)}.border-gray-600{border-color:var(--color-gray-600)}.border-indigo-200{border-color:var(--color-indigo-200)}.bg-blue-500{background-color:var(--color-blue-500)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-800{background-color:var(--color-gray-800)}.bg-indigo-100{background-color:var(--color-indigo-100)}.bg-purple-50{background-color:var(--color-purple-50)}.bg-red-500{background-color:var(--color-red-500)}.bg-white{background-color:var(--color-white)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-8{padding:calc(var(--spacing) * 8)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-4{padding-inline:calc(var(--spacing) * 4)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-2{padding-block:calc(var(--spacing) * 2)}.text-center{text-align:center}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.text-gray-200{color:var(--color-gray-200)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-800{color:var(--color-gray-800)}.text-gray-900{color:var(--color-gray-900)}.text-indigo-700{color:var(--color-indigo-700)}.text-purple-600{color:var(--color-purple-600)}.text-red-500{color:var(--color-red-500)}.text-white{color:var(--color-white)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}@media (hover:hover){.hover\:bg-indigo-200:hover{background-color:var(--color-indigo-200)}}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:bg-gray-300:disabled{background-color:var(--color-gray-300)}}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}
|
|
3
|
+
/*$vite$:1*/
|
package/dist/vue.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));const c=require(`./samples-msJuWhn1.cjs`);let l=require(`vue`),u=require(`opensheetmusicdisplay`),d=require(`osmd-audio-player`);d=s(d);var f={class:`w-full h-full overflow-y-auto`},p={class:`min-h-full flex flex-col p-4`},m={key:0,class:`mb-4 text-center`},h={class:`text-2xl font-bold text-gray-900`},g={class:`mb-4 flex gap-2 items-center justify-center`},_=[`disabled`],v={class:`text-xl`},y={class:`flex items-center gap-2`},b=(0,l.defineComponent)({__name:`View`,props:{selectedResult:{},sendTextMessage:{type:Function}},setup(e){let t=e,n=(0,l.ref)(null),r=null,i=null,a=(0,l.ref)(!1),o=(0,l.ref)(!1),s=(0,l.ref)(200),c=(0,l.ref)(!1),b=(0,l.ref)(!1),x=async()=>{if(!(!n.value||!t.selectedResult.data?.musicXML))try{n.value.innerHTML=``,a.value=!1,o.value=!1,r=new u.OpenSheetMusicDisplay(n.value,{autoResize:!0,backend:`svg`,drawTitle:!1,followCursor:!0}),await r.load(t.selectedResult.data.musicXML),await r.render(),i||=new d.default,await i.loadScore(r);let e=r.Sheet?.SourceMeasures?.[0]?.TempoExpressions;if(e&&e.length>0){let t=e[0],n=t.TempoInBpm||t.tempoInBpm;n&&(s.value=n)}i.on(`iteration`,e=>{!c.value&&e&&e.length===0&&(i.stop(),o.value=!1)}),a.value=!0}catch(e){console.error(`Error rendering music:`,e),n.value&&(n.value.innerHTML=`<div class="text-red-500">Error rendering sheet music: ${e instanceof Error?e.message:`Unknown error`}</div>`)}},S=async()=>{!i||!a.value||(i.setBpm(Math.max(30,Math.min(300,s.value))),i.metronomeVolume=b.value?.7:0,i.isLooping=c.value,await i.play(),o.value=!0)},C=()=>{i&&(i.stop(),o.value=!1)};return(0,l.watch)(s,()=>{i&&i.setBpm(Math.max(30,Math.min(300,s.value)))}),(0,l.watch)(c,()=>{i&&(i.isLooping=c.value)}),(0,l.watch)(b,()=>{i&&(i.metronomeVolume=b.value?.7:0)}),(0,l.onMounted)(()=>{x()}),(0,l.watch)(()=>t.selectedResult.data?.musicXML,()=>{x()}),(0,l.onUnmounted)(()=>{i&&i.stop()}),(t,r)=>((0,l.openBlock)(),(0,l.createElementBlock)(`div`,f,[(0,l.createElementVNode)(`div`,p,[e.selectedResult.title?((0,l.openBlock)(),(0,l.createElementBlock)(`div`,m,[(0,l.createElementVNode)(`h2`,h,(0,l.toDisplayString)(e.selectedResult.title),1)])):(0,l.createCommentVNode)(``,!0),(0,l.createElementVNode)(`div`,g,[(0,l.createElementVNode)(`button`,{onClick:r[0]||=e=>o.value?C():S(),disabled:!a.value,class:(0,l.normalizeClass)([`px-4 py-2 text-white rounded disabled:bg-gray-300 disabled:cursor-not-allowed flex items-center gap-1`,o.value?`bg-red-500`:`bg-blue-500`])},[(0,l.createElementVNode)(`span`,v,(0,l.toDisplayString)(o.value?`⏹`:`▶`),1),(0,l.createTextVNode)(` `+(0,l.toDisplayString)(o.value?`Stop`:`Play`),1)],10,_),(0,l.createElementVNode)(`label`,y,[r[2]||=(0,l.createTextVNode)(` Tempo `,-1),(0,l.withDirectives)((0,l.createElementVNode)(`input`,{"onUpdate:modelValue":r[1]||=e=>s.value=e,type:`number`,min:`30`,max:`300`,class:`w-20 px-2 py-1 border border-gray-300 rounded`},null,512),[[l.vModelText,s.value,void 0,{number:!0}]]),r[3]||=(0,l.createTextVNode)(` bpm `,-1)])]),(0,l.createElementVNode)(`div`,{ref_key:`musicContainer`,ref:n,class:`flex-1 flex items-center justify-center bg-white rounded-lg p-4`},null,512)])]))}}),x={class:`text-center p-4 bg-purple-50 rounded`},S={key:0,class:`text-xs text-gray-600 mt-1 truncate`},C=(0,l.defineComponent)({__name:`Preview`,props:{result:{}},setup(e){return(t,n)=>((0,l.openBlock)(),(0,l.createElementBlock)(`div`,x,[n[0]||=(0,l.createElementVNode)(`div`,{class:`text-purple-600 font-medium`},`🎵 Sheet Music`,-1),e.result.title?((0,l.openBlock)(),(0,l.createElementBlock)(`div`,S,(0,l.toDisplayString)(e.result.title),1)):(0,l.createCommentVNode)(``,!0)]))}}),w={toolDefinition:c.r,execute:c.n,generatingMessage:`Rendering sheet music...`,isEnabled:()=>!0,viewComponent:b,previewComponent:C,samples:c.t},T={plugin:w};exports.TOOL_DEFINITION=c.r,exports.default=T,exports.executeMusic=c.n,exports.plugin=w;
|
package/dist/vue.js
CHANGED
|
@@ -1,126 +1,100 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { OpenSheetMusicDisplay as
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}, A = /* @__PURE__ */ w({
|
|
102
|
-
__name: "Preview",
|
|
103
|
-
props: {
|
|
104
|
-
result: {}
|
|
105
|
-
},
|
|
106
|
-
setup(a) {
|
|
107
|
-
return (d, s) => (g(), x("div", H, [
|
|
108
|
-
s[0] || (s[0] = l("div", { class: "text-purple-600 font-medium" }, "🎵 Sheet Music", -1)),
|
|
109
|
-
a.result.title ? (g(), x("div", q, v(a.result.title), 1)) : M("", !0)
|
|
110
|
-
]));
|
|
111
|
-
}
|
|
112
|
-
}), G = {
|
|
113
|
-
toolDefinition: E,
|
|
114
|
-
execute: C,
|
|
115
|
-
generatingMessage: "Rendering sheet music...",
|
|
116
|
-
isEnabled: () => !0,
|
|
117
|
-
viewComponent: F,
|
|
118
|
-
previewComponent: A,
|
|
119
|
-
samples: k
|
|
120
|
-
}, Y = { plugin: G };
|
|
121
|
-
export {
|
|
122
|
-
E as TOOL_DEFINITION,
|
|
123
|
-
Y as default,
|
|
124
|
-
C as executeMusic,
|
|
125
|
-
G as plugin
|
|
126
|
-
};
|
|
1
|
+
import { n as e, r as t, t as n } from "./samples-C8a37dDP.js";
|
|
2
|
+
import { createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, defineComponent as s, normalizeClass as c, onMounted as l, onUnmounted as u, openBlock as d, ref as f, toDisplayString as p, vModelText as m, watch as h, withDirectives as g } from "vue";
|
|
3
|
+
import { OpenSheetMusicDisplay as _ } from "opensheetmusicdisplay";
|
|
4
|
+
import v from "osmd-audio-player";
|
|
5
|
+
//#region src/vue/View.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
+
var y = { class: "w-full h-full overflow-y-auto" }, b = { class: "min-h-full flex flex-col p-4" }, x = {
|
|
7
|
+
key: 0,
|
|
8
|
+
class: "mb-4 text-center"
|
|
9
|
+
}, S = { class: "text-2xl font-bold text-gray-900" }, C = { class: "mb-4 flex gap-2 items-center justify-center" }, w = ["disabled"], T = { class: "text-xl" }, E = { class: "flex items-center gap-2" }, D = /* @__PURE__ */ s({
|
|
10
|
+
__name: "View",
|
|
11
|
+
props: {
|
|
12
|
+
selectedResult: {},
|
|
13
|
+
sendTextMessage: { type: Function }
|
|
14
|
+
},
|
|
15
|
+
setup(e) {
|
|
16
|
+
let t = e, n = f(null), s = null, D = null, O = f(!1), k = f(!1), A = f(200), j = f(!1), M = f(!1), N = async () => {
|
|
17
|
+
if (!(!n.value || !t.selectedResult.data?.musicXML)) try {
|
|
18
|
+
n.value.innerHTML = "", O.value = !1, k.value = !1, s = new _(n.value, {
|
|
19
|
+
autoResize: !0,
|
|
20
|
+
backend: "svg",
|
|
21
|
+
drawTitle: !1,
|
|
22
|
+
followCursor: !0
|
|
23
|
+
}), await s.load(t.selectedResult.data.musicXML), await s.render(), D ||= new v(), await D.loadScore(s);
|
|
24
|
+
let e = s.Sheet?.SourceMeasures?.[0]?.TempoExpressions;
|
|
25
|
+
if (e && e.length > 0) {
|
|
26
|
+
let t = e[0], n = t.TempoInBpm || t.tempoInBpm;
|
|
27
|
+
n && (A.value = n);
|
|
28
|
+
}
|
|
29
|
+
D.on("iteration", (e) => {
|
|
30
|
+
!j.value && e && e.length === 0 && (D.stop(), k.value = !1);
|
|
31
|
+
}), O.value = !0;
|
|
32
|
+
} catch (e) {
|
|
33
|
+
console.error("Error rendering music:", e), n.value && (n.value.innerHTML = `<div class="text-red-500">Error rendering sheet music: ${e instanceof Error ? e.message : "Unknown error"}</div>`);
|
|
34
|
+
}
|
|
35
|
+
}, P = async () => {
|
|
36
|
+
!D || !O.value || (D.setBpm(Math.max(30, Math.min(300, A.value))), D.metronomeVolume = M.value ? .7 : 0, D.isLooping = j.value, await D.play(), k.value = !0);
|
|
37
|
+
}, F = () => {
|
|
38
|
+
D && (D.stop(), k.value = !1);
|
|
39
|
+
};
|
|
40
|
+
return h(A, () => {
|
|
41
|
+
D && D.setBpm(Math.max(30, Math.min(300, A.value)));
|
|
42
|
+
}), h(j, () => {
|
|
43
|
+
D && (D.isLooping = j.value);
|
|
44
|
+
}), h(M, () => {
|
|
45
|
+
D && (D.metronomeVolume = M.value ? .7 : 0);
|
|
46
|
+
}), l(() => {
|
|
47
|
+
N();
|
|
48
|
+
}), h(() => t.selectedResult.data?.musicXML, () => {
|
|
49
|
+
N();
|
|
50
|
+
}), u(() => {
|
|
51
|
+
D && D.stop();
|
|
52
|
+
}), (t, s) => (d(), i("div", y, [a("div", b, [
|
|
53
|
+
e.selectedResult.title ? (d(), i("div", x, [a("h2", S, p(e.selectedResult.title), 1)])) : r("", !0),
|
|
54
|
+
a("div", C, [a("button", {
|
|
55
|
+
onClick: s[0] ||= (e) => k.value ? F() : P(),
|
|
56
|
+
disabled: !O.value,
|
|
57
|
+
class: c(["px-4 py-2 text-white rounded disabled:bg-gray-300 disabled:cursor-not-allowed flex items-center gap-1", k.value ? "bg-red-500" : "bg-blue-500"])
|
|
58
|
+
}, [a("span", T, p(k.value ? "⏹" : "▶"), 1), o(" " + p(k.value ? "Stop" : "Play"), 1)], 10, w), a("label", E, [
|
|
59
|
+
s[2] ||= o(" Tempo ", -1),
|
|
60
|
+
g(a("input", {
|
|
61
|
+
"onUpdate:modelValue": s[1] ||= (e) => A.value = e,
|
|
62
|
+
type: "number",
|
|
63
|
+
min: "30",
|
|
64
|
+
max: "300",
|
|
65
|
+
class: "w-20 px-2 py-1 border border-gray-300 rounded"
|
|
66
|
+
}, null, 512), [[
|
|
67
|
+
m,
|
|
68
|
+
A.value,
|
|
69
|
+
void 0,
|
|
70
|
+
{ number: !0 }
|
|
71
|
+
]]),
|
|
72
|
+
s[3] ||= o(" bpm ", -1)
|
|
73
|
+
])]),
|
|
74
|
+
a("div", {
|
|
75
|
+
ref_key: "musicContainer",
|
|
76
|
+
ref: n,
|
|
77
|
+
class: "flex-1 flex items-center justify-center bg-white rounded-lg p-4"
|
|
78
|
+
}, null, 512)
|
|
79
|
+
])]));
|
|
80
|
+
}
|
|
81
|
+
}), O = { class: "text-center p-4 bg-purple-50 rounded" }, k = {
|
|
82
|
+
key: 0,
|
|
83
|
+
class: "text-xs text-gray-600 mt-1 truncate"
|
|
84
|
+
}, A = {
|
|
85
|
+
toolDefinition: t,
|
|
86
|
+
execute: e,
|
|
87
|
+
generatingMessage: "Rendering sheet music...",
|
|
88
|
+
isEnabled: () => !0,
|
|
89
|
+
viewComponent: D,
|
|
90
|
+
previewComponent: /* @__PURE__ */ s({
|
|
91
|
+
__name: "Preview",
|
|
92
|
+
props: { result: {} },
|
|
93
|
+
setup(e) {
|
|
94
|
+
return (t, n) => (d(), i("div", O, [n[0] ||= a("div", { class: "text-purple-600 font-medium" }, "🎵 Sheet Music", -1), e.result.title ? (d(), i("div", k, p(e.result.title), 1)) : r("", !0)]));
|
|
95
|
+
}
|
|
96
|
+
}),
|
|
97
|
+
samples: n
|
|
98
|
+
}, j = { plugin: A };
|
|
99
|
+
//#endregion
|
|
100
|
+
export { t as TOOL_DEFINITION, j as default, e as executeMusic, A as plugin };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gui-chat-plugin/music",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "MusicXML sheet music plugin for GUI Chat",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -24,7 +24,9 @@
|
|
|
24
24
|
},
|
|
25
25
|
"./style.css": "./dist/style.css"
|
|
26
26
|
},
|
|
27
|
-
"files": [
|
|
27
|
+
"files": [
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
28
30
|
"scripts": {
|
|
29
31
|
"dev": "vite",
|
|
30
32
|
"build": "vite build && vue-tsc -p tsconfig.build.json --emitDeclarationOnly",
|
|
@@ -35,25 +37,32 @@
|
|
|
35
37
|
"vue": "^3.5.0"
|
|
36
38
|
},
|
|
37
39
|
"dependencies": {
|
|
38
|
-
"gui-chat-protocol": "^0.0.
|
|
40
|
+
"gui-chat-protocol": "^0.0.4",
|
|
39
41
|
"opensheetmusicdisplay": "^1.9.3",
|
|
40
42
|
"osmd-audio-player": "^0.7.0"
|
|
41
43
|
},
|
|
42
44
|
"devDependencies": {
|
|
43
|
-
"@
|
|
44
|
-
"@
|
|
45
|
-
"@typescript-eslint/
|
|
46
|
-
"@
|
|
47
|
-
"
|
|
48
|
-
"eslint
|
|
49
|
-
"
|
|
50
|
-
"
|
|
45
|
+
"@eslint/js": "^10.0.1",
|
|
46
|
+
"@tailwindcss/vite": "^4.2.2",
|
|
47
|
+
"@typescript-eslint/eslint-plugin": "^8.58.0",
|
|
48
|
+
"@typescript-eslint/parser": "^8.58.0",
|
|
49
|
+
"@vitejs/plugin-vue": "^6.0.5",
|
|
50
|
+
"eslint": "^10.1.0",
|
|
51
|
+
"eslint-plugin-vue": "^10.8.0",
|
|
52
|
+
"globals": "^17.4.0",
|
|
53
|
+
"tailwindcss": "^4.2.2",
|
|
51
54
|
"typescript": "~5.9.3",
|
|
52
|
-
"vite": "^
|
|
53
|
-
"vue": "^3.5.
|
|
54
|
-
"vue-eslint-parser": "^10.
|
|
55
|
-
"vue-tsc": "^3.2.
|
|
55
|
+
"vite": "^8.0.3",
|
|
56
|
+
"vue": "^3.5.31",
|
|
57
|
+
"vue-eslint-parser": "^10.4.0",
|
|
58
|
+
"vue-tsc": "^3.2.6"
|
|
56
59
|
},
|
|
57
|
-
"keywords": [
|
|
60
|
+
"keywords": [
|
|
61
|
+
"guichat",
|
|
62
|
+
"plugin",
|
|
63
|
+
"music",
|
|
64
|
+
"musicxml",
|
|
65
|
+
"sheet-music"
|
|
66
|
+
],
|
|
58
67
|
"license": "MIT"
|
|
59
68
|
}
|