@gui-chat-plugin/music 0.0.2 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +135 -126
- package/package.json +22 -17
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-green-600:oklch(62.7% .194 149.214);--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-green-600{background-color:var(--color-green-600)}.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(`@isamu/osmd-audio-player`);d=s(d);let f=require(`jspdf`),p=require(`svg2pdf.js`);var m={class:`w-full h-full overflow-y-auto`},h={class:`min-h-full flex flex-col p-4`},g={key:0,class:`mb-4 text-center`},_={class:`text-2xl font-bold text-gray-900`},v={class:`mb-4 flex gap-2 items-center justify-center`},y=[`disabled`],b={class:`text-xl`},x=[`disabled`],S={class:`flex items-center gap-2`},C=(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)(!1),c=(0,l.ref)(200),C=(0,l.ref)(!1),w=(0,l.ref)(!1),T=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&&(c.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>`)}},E=async()=>{if(!n.value||!a.value)return;let e=n.value.querySelector(`svg`);if(e){s.value=!0;try{let n=e.viewBox.baseVal.width||e.clientWidth,r=e.viewBox.baseVal.height||e.clientHeight,i=new f.jsPDF({orientation:n>r?`landscape`:`portrait`,unit:`pt`,format:`a4`}),a=i.internal.pageSize.getWidth(),o=i.internal.pageSize.getHeight(),s=Math.min(a/n,o/r),c=n*s,l=r*s;await(0,p.svg2pdf)(e,i,{x:(a-c)/2,y:(o-l)/2,width:c,height:l});let u=`${(t.selectedResult.title||`sheet-music`).replace(/[^a-zA-Z0-9]/g,`_`)}.pdf`;i.save(u)}catch(e){console.error(`Error exporting PDF:`,e)}finally{s.value=!1}}},D=async()=>{!i||!a.value||(i.setBpm(Math.max(30,Math.min(300,c.value))),i.metronomeVolume=w.value?.7:0,i.isLooping=C.value,await i.play(),o.value=!0)},O=()=>{i&&(i.stop(),o.value=!1)};return(0,l.watch)(c,()=>{i&&i.setBpm(Math.max(30,Math.min(300,c.value)))}),(0,l.watch)(C,()=>{i&&(i.isLooping=C.value)}),(0,l.watch)(w,()=>{i&&(i.metronomeVolume=w.value?.7:0)}),(0,l.onMounted)(()=>{T()}),(0,l.watch)(()=>t.selectedResult.data?.musicXML,()=>{T()}),(0,l.onUnmounted)(()=>{i&&i.stop()}),(t,r)=>((0,l.openBlock)(),(0,l.createElementBlock)(`div`,m,[(0,l.createElementVNode)(`div`,h,[e.selectedResult.title?((0,l.openBlock)(),(0,l.createElementBlock)(`div`,g,[(0,l.createElementVNode)(`h2`,_,(0,l.toDisplayString)(e.selectedResult.title),1)])):(0,l.createCommentVNode)(``,!0),(0,l.createElementVNode)(`div`,v,[(0,l.createElementVNode)(`button`,{onClick:r[0]||=e=>o.value?O():D(),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`,b,(0,l.toDisplayString)(o.value?`⏹`:`▶`),1),(0,l.createTextVNode)(` `+(0,l.toDisplayString)(o.value?`Stop`:`Play`),1)],10,y),(0,l.createElementVNode)(`button`,{onClick:E,disabled:!a.value||s.value,class:`px-4 py-2 text-white bg-green-600 rounded disabled:bg-gray-300 disabled:cursor-not-allowed flex items-center gap-1`},[r[2]||=(0,l.createElementVNode)(`span`,{class:`text-xl`},`⬇`,-1),(0,l.createTextVNode)(` `+(0,l.toDisplayString)(s.value?`Exporting...`:`PDF`),1)],8,x),(0,l.createElementVNode)(`label`,S,[r[3]||=(0,l.createTextVNode)(` Tempo `,-1),(0,l.withDirectives)((0,l.createElementVNode)(`input`,{"onUpdate:modelValue":r[1]||=e=>c.value=e,type:`number`,min:`30`,max:`300`,class:`w-20 px-2 py-1 border border-gray-300 rounded`},null,512),[[l.vModelText,c.value,void 0,{number:!0}]]),r[4]||=(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)])]))}}),w={class:`text-center p-4 bg-purple-50 rounded`},T={key:0,class:`text-xs text-gray-600 mt-1 truncate`},E=(0,l.defineComponent)({__name:`Preview`,props:{result:{}},setup(e){return(t,n)=>((0,l.openBlock)(),(0,l.createElementBlock)(`div`,w,[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`,T,(0,l.toDisplayString)(e.result.title),1)):(0,l.createCommentVNode)(``,!0)]))}}),D={toolDefinition:c.r,execute:c.n,generatingMessage:`Rendering sheet music...`,isEnabled:()=>!0,viewComponent:C,previewComponent:E,samples:c.t},O={plugin:D};exports.TOOL_DEFINITION=c.r,exports.default=O,exports.executeMusic=c.n,exports.plugin=D;
|
package/dist/vue.js
CHANGED
|
@@ -1,126 +1,135 @@
|
|
|
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
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
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 "@isamu/osmd-audio-player";
|
|
5
|
+
import { jsPDF as y } from "jspdf";
|
|
6
|
+
import { svg2pdf as b } from "svg2pdf.js";
|
|
7
|
+
//#region src/vue/View.vue?vue&type=script&setup=true&lang.ts
|
|
8
|
+
var x = { class: "w-full h-full overflow-y-auto" }, S = { class: "min-h-full flex flex-col p-4" }, C = {
|
|
9
|
+
key: 0,
|
|
10
|
+
class: "mb-4 text-center"
|
|
11
|
+
}, w = { class: "text-2xl font-bold text-gray-900" }, T = { class: "mb-4 flex gap-2 items-center justify-center" }, E = ["disabled"], D = { class: "text-xl" }, O = ["disabled"], k = { class: "flex items-center gap-2" }, A = /* @__PURE__ */ s({
|
|
12
|
+
__name: "View",
|
|
13
|
+
props: {
|
|
14
|
+
selectedResult: {},
|
|
15
|
+
sendTextMessage: { type: Function }
|
|
16
|
+
},
|
|
17
|
+
setup(e) {
|
|
18
|
+
let t = e, n = f(null), s = null, A = null, j = f(!1), M = f(!1), N = f(!1), P = f(200), F = f(!1), I = f(!1), L = async () => {
|
|
19
|
+
if (!(!n.value || !t.selectedResult.data?.musicXML)) try {
|
|
20
|
+
n.value.innerHTML = "", j.value = !1, M.value = !1, s = new _(n.value, {
|
|
21
|
+
autoResize: !0,
|
|
22
|
+
backend: "svg",
|
|
23
|
+
drawTitle: !1,
|
|
24
|
+
followCursor: !0
|
|
25
|
+
}), await s.load(t.selectedResult.data.musicXML), await s.render(), A ||= new v(), await A.loadScore(s);
|
|
26
|
+
let e = s.Sheet?.SourceMeasures?.[0]?.TempoExpressions;
|
|
27
|
+
if (e && e.length > 0) {
|
|
28
|
+
let t = e[0], n = t.TempoInBpm || t.tempoInBpm;
|
|
29
|
+
n && (P.value = n);
|
|
30
|
+
}
|
|
31
|
+
A.on("iteration", (e) => {
|
|
32
|
+
!F.value && e && e.length === 0 && (A.stop(), M.value = !1);
|
|
33
|
+
}), j.value = !0;
|
|
34
|
+
} catch (e) {
|
|
35
|
+
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>`);
|
|
36
|
+
}
|
|
37
|
+
}, R = async () => {
|
|
38
|
+
if (!n.value || !j.value) return;
|
|
39
|
+
let e = n.value.querySelector("svg");
|
|
40
|
+
if (e) {
|
|
41
|
+
N.value = !0;
|
|
42
|
+
try {
|
|
43
|
+
let n = e.viewBox.baseVal.width || e.clientWidth, r = e.viewBox.baseVal.height || e.clientHeight, i = new y({
|
|
44
|
+
orientation: n > r ? "landscape" : "portrait",
|
|
45
|
+
unit: "pt",
|
|
46
|
+
format: "a4"
|
|
47
|
+
}), a = i.internal.pageSize.getWidth(), o = i.internal.pageSize.getHeight(), s = Math.min(a / n, o / r), c = n * s, l = r * s;
|
|
48
|
+
await b(e, i, {
|
|
49
|
+
x: (a - c) / 2,
|
|
50
|
+
y: (o - l) / 2,
|
|
51
|
+
width: c,
|
|
52
|
+
height: l
|
|
53
|
+
});
|
|
54
|
+
let u = `${(t.selectedResult.title || "sheet-music").replace(/[^a-zA-Z0-9]/g, "_")}.pdf`;
|
|
55
|
+
i.save(u);
|
|
56
|
+
} catch (e) {
|
|
57
|
+
console.error("Error exporting PDF:", e);
|
|
58
|
+
} finally {
|
|
59
|
+
N.value = !1;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}, z = async () => {
|
|
63
|
+
!A || !j.value || (A.setBpm(Math.max(30, Math.min(300, P.value))), A.metronomeVolume = I.value ? .7 : 0, A.isLooping = F.value, await A.play(), M.value = !0);
|
|
64
|
+
}, B = () => {
|
|
65
|
+
A && (A.stop(), M.value = !1);
|
|
66
|
+
};
|
|
67
|
+
return h(P, () => {
|
|
68
|
+
A && A.setBpm(Math.max(30, Math.min(300, P.value)));
|
|
69
|
+
}), h(F, () => {
|
|
70
|
+
A && (A.isLooping = F.value);
|
|
71
|
+
}), h(I, () => {
|
|
72
|
+
A && (A.metronomeVolume = I.value ? .7 : 0);
|
|
73
|
+
}), l(() => {
|
|
74
|
+
L();
|
|
75
|
+
}), h(() => t.selectedResult.data?.musicXML, () => {
|
|
76
|
+
L();
|
|
77
|
+
}), u(() => {
|
|
78
|
+
A && A.stop();
|
|
79
|
+
}), (t, s) => (d(), i("div", x, [a("div", S, [
|
|
80
|
+
e.selectedResult.title ? (d(), i("div", C, [a("h2", w, p(e.selectedResult.title), 1)])) : r("", !0),
|
|
81
|
+
a("div", T, [
|
|
82
|
+
a("button", {
|
|
83
|
+
onClick: s[0] ||= (e) => M.value ? B() : z(),
|
|
84
|
+
disabled: !j.value,
|
|
85
|
+
class: c(["px-4 py-2 text-white rounded disabled:bg-gray-300 disabled:cursor-not-allowed flex items-center gap-1", M.value ? "bg-red-500" : "bg-blue-500"])
|
|
86
|
+
}, [a("span", D, p(M.value ? "⏹" : "▶"), 1), o(" " + p(M.value ? "Stop" : "Play"), 1)], 10, E),
|
|
87
|
+
a("button", {
|
|
88
|
+
onClick: R,
|
|
89
|
+
disabled: !j.value || N.value,
|
|
90
|
+
class: "px-4 py-2 text-white bg-green-600 rounded disabled:bg-gray-300 disabled:cursor-not-allowed flex items-center gap-1"
|
|
91
|
+
}, [s[2] ||= a("span", { class: "text-xl" }, "⬇", -1), o(" " + p(N.value ? "Exporting..." : "PDF"), 1)], 8, O),
|
|
92
|
+
a("label", k, [
|
|
93
|
+
s[3] ||= o(" Tempo ", -1),
|
|
94
|
+
g(a("input", {
|
|
95
|
+
"onUpdate:modelValue": s[1] ||= (e) => P.value = e,
|
|
96
|
+
type: "number",
|
|
97
|
+
min: "30",
|
|
98
|
+
max: "300",
|
|
99
|
+
class: "w-20 px-2 py-1 border border-gray-300 rounded"
|
|
100
|
+
}, null, 512), [[
|
|
101
|
+
m,
|
|
102
|
+
P.value,
|
|
103
|
+
void 0,
|
|
104
|
+
{ number: !0 }
|
|
105
|
+
]]),
|
|
106
|
+
s[4] ||= o(" bpm ", -1)
|
|
107
|
+
])
|
|
108
|
+
]),
|
|
109
|
+
a("div", {
|
|
110
|
+
ref_key: "musicContainer",
|
|
111
|
+
ref: n,
|
|
112
|
+
class: "flex-1 flex items-center justify-center bg-white rounded-lg p-4"
|
|
113
|
+
}, null, 512)
|
|
114
|
+
])]));
|
|
115
|
+
}
|
|
116
|
+
}), j = { class: "text-center p-4 bg-purple-50 rounded" }, M = {
|
|
117
|
+
key: 0,
|
|
118
|
+
class: "text-xs text-gray-600 mt-1 truncate"
|
|
119
|
+
}, N = {
|
|
120
|
+
toolDefinition: t,
|
|
121
|
+
execute: e,
|
|
122
|
+
generatingMessage: "Rendering sheet music...",
|
|
123
|
+
isEnabled: () => !0,
|
|
124
|
+
viewComponent: A,
|
|
125
|
+
previewComponent: /* @__PURE__ */ s({
|
|
126
|
+
__name: "Preview",
|
|
127
|
+
props: { result: {} },
|
|
128
|
+
setup(e) {
|
|
129
|
+
return (t, n) => (d(), i("div", j, [n[0] ||= a("div", { class: "text-purple-600 font-medium" }, "🎵 Sheet Music", -1), e.result.title ? (d(), i("div", M, p(e.result.title), 1)) : r("", !0)]));
|
|
130
|
+
}
|
|
131
|
+
}),
|
|
132
|
+
samples: n
|
|
133
|
+
}, P = { plugin: N };
|
|
134
|
+
//#endregion
|
|
135
|
+
export { t as TOOL_DEFINITION, P as default, e as executeMusic, N 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": "1.0.0",
|
|
4
4
|
"description": "MusicXML sheet music plugin for GUI Chat",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -33,28 +33,33 @@
|
|
|
33
33
|
"typecheck": "vue-tsc --noEmit",
|
|
34
34
|
"lint": "eslint src demo"
|
|
35
35
|
},
|
|
36
|
+
"resolutions": {
|
|
37
|
+
"tar": ">=7.5.7"
|
|
38
|
+
},
|
|
36
39
|
"peerDependencies": {
|
|
37
40
|
"vue": "^3.5.0"
|
|
38
41
|
},
|
|
39
42
|
"dependencies": {
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
+
"@isamu/osmd-audio-player": "^1.0.0",
|
|
44
|
+
"gui-chat-protocol": "^0.0.4",
|
|
45
|
+
"jspdf": "^4.2.1",
|
|
46
|
+
"svg2pdf.js": "^2.7.0"
|
|
43
47
|
},
|
|
44
48
|
"devDependencies": {
|
|
45
|
-
"@
|
|
46
|
-
"@
|
|
47
|
-
"@typescript-eslint/
|
|
48
|
-
"@
|
|
49
|
-
"
|
|
50
|
-
"eslint
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"vue
|
|
57
|
-
"vue-
|
|
49
|
+
"@eslint/js": "^10.0.1",
|
|
50
|
+
"@tailwindcss/vite": "^4.2.2",
|
|
51
|
+
"@typescript-eslint/eslint-plugin": "^8.58.0",
|
|
52
|
+
"@typescript-eslint/parser": "^8.58.0",
|
|
53
|
+
"@vitejs/plugin-vue": "^6.0.5",
|
|
54
|
+
"eslint": "^10.2.0",
|
|
55
|
+
"eslint-plugin-vue": "^10.8.0",
|
|
56
|
+
"globals": "^17.4.0",
|
|
57
|
+
"tailwindcss": "^4.2.2",
|
|
58
|
+
"typescript": "~6.0.2",
|
|
59
|
+
"vite": "^8.0.3",
|
|
60
|
+
"vue": "^3.5.31",
|
|
61
|
+
"vue-eslint-parser": "^10.4.0",
|
|
62
|
+
"vue-tsc": "^3.2.6"
|
|
58
63
|
},
|
|
59
64
|
"keywords": [
|
|
60
65
|
"guichat",
|