@ovnonvo/abc-editor 0.1.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/LICENSE +21 -0
- package/README.md +213 -0
- package/dist/abc-editor.cjs.js +16 -0
- package/dist/abc-editor.es.js +924 -0
- package/dist/lib/index.d.ts +13 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/src/components/AbcEditor.d.ts +7 -0
- package/dist/src/components/AbcEditor.d.ts.map +1 -0
- package/dist/src/components/AbcPreview.d.ts +4 -0
- package/dist/src/components/AbcPreview.d.ts.map +1 -0
- package/dist/src/components/SuggestionList.d.ts +14 -0
- package/dist/src/components/SuggestionList.d.ts.map +1 -0
- package/dist/src/data/abcCommands.d.ts +4 -0
- package/dist/src/data/abcCommands.d.ts.map +1 -0
- package/dist/src/data/abcSuggestions.d.ts +9 -0
- package/dist/src/data/abcSuggestions.d.ts.map +1 -0
- package/dist/src/hooks/useAbcAutoComplete.d.ts +21 -0
- package/dist/src/hooks/useAbcAutoComplete.d.ts.map +1 -0
- package/dist/src/hooks/useLineNumbers.d.ts +2 -0
- package/dist/src/hooks/useLineNumbers.d.ts.map +1 -0
- package/dist/src/types/abc.d.ts +26 -0
- package/dist/src/types/abc.d.ts.map +1 -0
- package/dist/src/utils/highlightAbc.d.ts +24 -0
- package/dist/src/utils/highlightAbc.d.ts.map +1 -0
- package/dist/src/utils/validateAbc.d.ts +14 -0
- package/dist/src/utils/validateAbc.d.ts.map +1 -0
- package/package.json +83 -0
|
@@ -0,0 +1,924 @@
|
|
|
1
|
+
import { jsx as h, jsxs as T } from "react/jsx-runtime";
|
|
2
|
+
import { useState as M, useCallback as N, useEffect as B, useRef as I, useMemo as F } from "react";
|
|
3
|
+
import K from "abcjs";
|
|
4
|
+
const j = (t) => t.split(`
|
|
5
|
+
`).map((s, r) => r + 1).join(`
|
|
6
|
+
`), y = /^([ABCDFGHIKLMmNOPQRrSsTUVWwXZ]:)(.*)$/, E = /[A-Ga-g]/, H = /[\^_=]/, V = /[',]/, G = /\|[:|\]]?|:?\|/, Q = /[\\[\]]/, z = /[()]/, Y = /^\(\d+$/, P = /^\/?\d+(\/\d+)?$/, k = /[zZx]/, $ = /^\.?-$/, J = /[.~HLMOPSTuv]/, X = /^"[^"]*"$/, O = /^"[\^_<>@][^"]*"$/, Z = /^![^!]+!$/, q = /^\{[^}]+\}$/, tt = /^\[\d+$/, et = /^\[([ABCDFGHIKLMmNOPQRrSsTUVWwXZ]):([^\]]*)\]$/, nt = /^[<>]+$/, st = /^%.*$/, d = (t) => t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"), rt = (t, e) => {
|
|
7
|
+
const s = t[e];
|
|
8
|
+
if (s !== "|" && s !== ":")
|
|
9
|
+
return null;
|
|
10
|
+
let r = s, l = e + 1;
|
|
11
|
+
for (; l < t.length && (t[l] === "|" || t[l] === ":" || t[l] === "]"); )
|
|
12
|
+
r += t[l], l++;
|
|
13
|
+
return G.test(r) ? {
|
|
14
|
+
html: `<span class="${r === "||" ? "abc-bar-double" : "abc-bar"}">${d(r)}</span>`,
|
|
15
|
+
nextIndex: l
|
|
16
|
+
} : null;
|
|
17
|
+
}, lt = (t, e) => {
|
|
18
|
+
const s = t[e];
|
|
19
|
+
return H.test(s) ? {
|
|
20
|
+
html: `<span class="abc-accidental">${d(s)}</span>`,
|
|
21
|
+
nextIndex: e + 1
|
|
22
|
+
} : null;
|
|
23
|
+
}, at = (t, e, s) => {
|
|
24
|
+
const r = t[e];
|
|
25
|
+
if (!z.test(r))
|
|
26
|
+
return null;
|
|
27
|
+
if (r === "(") {
|
|
28
|
+
if (e + 1 < t.length && /\d/.test(t[e + 1])) {
|
|
29
|
+
let l = r, n = e + 1;
|
|
30
|
+
for (; n < t.length && /\d/.test(t[n]); )
|
|
31
|
+
l += t[n], n++;
|
|
32
|
+
if (Y.test(l))
|
|
33
|
+
return {
|
|
34
|
+
html: `<span class="abc-tuplet">${d(l)}</span>`,
|
|
35
|
+
nextIndex: n,
|
|
36
|
+
slurLevelDelta: 0
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
html: `<span class="abc-slur abc-slur-level-${s % 5}">${d(r)}</span>`,
|
|
41
|
+
nextIndex: e + 1,
|
|
42
|
+
slurLevelDelta: 1
|
|
43
|
+
};
|
|
44
|
+
} else if (r === ")")
|
|
45
|
+
return {
|
|
46
|
+
html: `<span class="abc-slur abc-slur-level-${Math.max(0, s - 1) % 5}">${d(r)}</span>`,
|
|
47
|
+
nextIndex: e + 1,
|
|
48
|
+
slurLevelDelta: -1
|
|
49
|
+
};
|
|
50
|
+
return null;
|
|
51
|
+
}, ot = (t, e) => {
|
|
52
|
+
const s = t[e];
|
|
53
|
+
if (!E.test(s))
|
|
54
|
+
return null;
|
|
55
|
+
let r = `<span class="abc-note">${d(s)}</span>`, l = e + 1, n = "";
|
|
56
|
+
for (; l < t.length && V.test(t[l]); )
|
|
57
|
+
n += t[l], l++;
|
|
58
|
+
if (n) {
|
|
59
|
+
const c = n[0] === "'" ? "abc-octave-high" : "abc-octave-low";
|
|
60
|
+
r += `<span class="${c}">${d(n)}</span>`;
|
|
61
|
+
}
|
|
62
|
+
let a = "";
|
|
63
|
+
if (l < t.length && (t[l] === "/" || /\d/.test(t[l]))) {
|
|
64
|
+
for (t[l] === "/" && (a += t[l], l++); l < t.length && /\d/.test(t[l]); )
|
|
65
|
+
a += t[l], l++;
|
|
66
|
+
if (l < t.length && t[l] === "/")
|
|
67
|
+
for (a += t[l], l++; l < t.length && /\d/.test(t[l]); )
|
|
68
|
+
a += t[l], l++;
|
|
69
|
+
if (a && P.test(a)) {
|
|
70
|
+
let c = "abc-duration";
|
|
71
|
+
a.startsWith("/") ? c += " abc-duration-short" : a.includes("/") ? c += " abc-duration-fraction" : c += " abc-duration-long", r += `<span class="${c}">${d(a)}</span>`;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
html: r,
|
|
76
|
+
nextIndex: l
|
|
77
|
+
};
|
|
78
|
+
}, ct = (t, e) => {
|
|
79
|
+
const s = t[e];
|
|
80
|
+
return Q.test(s) ? {
|
|
81
|
+
html: `<span class="abc-chord">${d(s)}</span>`,
|
|
82
|
+
nextIndex: e + 1
|
|
83
|
+
} : null;
|
|
84
|
+
}, it = (t, e) => {
|
|
85
|
+
const s = t[e];
|
|
86
|
+
if (!k.test(s))
|
|
87
|
+
return null;
|
|
88
|
+
let l = `<span class="${s === "x" ? "abc-rest-invisible" : "abc-rest"}">${d(s)}</span>`, n = e + 1, a = "";
|
|
89
|
+
if (n < t.length && (t[n] === "/" || /\d/.test(t[n]))) {
|
|
90
|
+
for (t[n] === "/" && (a += t[n], n++); n < t.length && /\d/.test(t[n]); )
|
|
91
|
+
a += t[n], n++;
|
|
92
|
+
if (n < t.length && t[n] === "/")
|
|
93
|
+
for (a += t[n], n++; n < t.length && /\d/.test(t[n]); )
|
|
94
|
+
a += t[n], n++;
|
|
95
|
+
if (a && P.test(a)) {
|
|
96
|
+
let c = "abc-duration";
|
|
97
|
+
a.startsWith("/") ? c += " abc-duration-short" : a.includes("/") ? c += " abc-duration-fraction" : c += " abc-duration-long", l += `<span class="${c}">${d(a)}</span>`;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
html: l,
|
|
102
|
+
nextIndex: n
|
|
103
|
+
};
|
|
104
|
+
}, ut = (t, e) => {
|
|
105
|
+
const s = t[e];
|
|
106
|
+
return s === "." && e + 1 < t.length && t[e + 1] === "-" && $.test(".-") ? {
|
|
107
|
+
html: `<span class="abc-tie abc-tie-dotted">${d(".-")}</span>`,
|
|
108
|
+
nextIndex: e + 2
|
|
109
|
+
} : s === "-" && $.test(s) ? {
|
|
110
|
+
html: `<span class="abc-tie">${d(s)}</span>`,
|
|
111
|
+
nextIndex: e + 1
|
|
112
|
+
} : null;
|
|
113
|
+
}, dt = (t, e) => {
|
|
114
|
+
const s = t[e];
|
|
115
|
+
return !J.test(s) || s === "." && e + 1 < t.length && t[e + 1] === "-" ? null : {
|
|
116
|
+
html: `<span class="abc-ornament">${d(s)}</span>`,
|
|
117
|
+
nextIndex: e + 1
|
|
118
|
+
};
|
|
119
|
+
}, pt = (t, e) => {
|
|
120
|
+
if (t[e] !== '"')
|
|
121
|
+
return null;
|
|
122
|
+
let r = e + 1;
|
|
123
|
+
for (; r < t.length && t[r] !== '"'; )
|
|
124
|
+
r++;
|
|
125
|
+
if (r >= t.length)
|
|
126
|
+
return null;
|
|
127
|
+
const l = t.substring(e, r + 1);
|
|
128
|
+
return O.test(l) ? {
|
|
129
|
+
html: `<span class="abc-annotation">${d(l)}</span>`,
|
|
130
|
+
nextIndex: r + 1
|
|
131
|
+
} : null;
|
|
132
|
+
}, ht = (t, e) => {
|
|
133
|
+
if (t[e] !== '"')
|
|
134
|
+
return null;
|
|
135
|
+
let r = e + 1;
|
|
136
|
+
for (; r < t.length && t[r] !== '"'; )
|
|
137
|
+
r++;
|
|
138
|
+
if (r >= t.length)
|
|
139
|
+
return null;
|
|
140
|
+
const l = t.substring(e, r + 1);
|
|
141
|
+
return O.test(l) || !X.test(l) ? null : {
|
|
142
|
+
html: `<span class="abc-chord-symbol">${d(l)}</span>`,
|
|
143
|
+
nextIndex: r + 1
|
|
144
|
+
};
|
|
145
|
+
}, ft = (t, e) => {
|
|
146
|
+
if (t[e] !== "!")
|
|
147
|
+
return null;
|
|
148
|
+
let r = e + 1;
|
|
149
|
+
for (; r < t.length && t[r] !== "!"; )
|
|
150
|
+
r++;
|
|
151
|
+
if (r >= t.length)
|
|
152
|
+
return null;
|
|
153
|
+
const l = t.substring(e, r + 1);
|
|
154
|
+
return Z.test(l) ? {
|
|
155
|
+
html: `<span class="abc-decoration">${d(l)}</span>`,
|
|
156
|
+
nextIndex: r + 1
|
|
157
|
+
} : null;
|
|
158
|
+
}, mt = (t, e) => {
|
|
159
|
+
if (t[e] !== "{")
|
|
160
|
+
return null;
|
|
161
|
+
let r = e + 1;
|
|
162
|
+
for (; r < t.length && t[r] !== "}"; )
|
|
163
|
+
r++;
|
|
164
|
+
if (r >= t.length)
|
|
165
|
+
return null;
|
|
166
|
+
const l = t.substring(e, r + 1);
|
|
167
|
+
return q.test(l) ? {
|
|
168
|
+
html: `<span class="abc-grace-note">${d(l)}</span>`,
|
|
169
|
+
nextIndex: r + 1
|
|
170
|
+
} : null;
|
|
171
|
+
}, gt = (t, e) => {
|
|
172
|
+
if (t[e] !== "[")
|
|
173
|
+
return null;
|
|
174
|
+
let r = e + 1;
|
|
175
|
+
for (; r < t.length && t[r] !== "]"; )
|
|
176
|
+
r++;
|
|
177
|
+
if (r >= t.length)
|
|
178
|
+
return null;
|
|
179
|
+
const n = t.substring(e, r + 1).match(et);
|
|
180
|
+
if (!n)
|
|
181
|
+
return null;
|
|
182
|
+
const [, a, c] = n;
|
|
183
|
+
return {
|
|
184
|
+
html: `<span class="abc-inline-field-bracket">[</span><span class="abc-inline-field-key">${d(a)}:</span><span class="abc-inline-field-value">${d(c)}</span><span class="abc-inline-field-bracket">]</span>`,
|
|
185
|
+
nextIndex: r + 1
|
|
186
|
+
};
|
|
187
|
+
}, bt = (t, e) => {
|
|
188
|
+
if (t[e] !== "[" || e + 1 >= t.length || !/\d/.test(t[e + 1]))
|
|
189
|
+
return null;
|
|
190
|
+
let r = e + 1;
|
|
191
|
+
for (; r < t.length && /\d/.test(t[r]); )
|
|
192
|
+
r++;
|
|
193
|
+
const l = t.substring(e, r);
|
|
194
|
+
return tt.test(l) ? {
|
|
195
|
+
html: `<span class="abc-volta-bracket">${d(l)}</span>`,
|
|
196
|
+
nextIndex: r
|
|
197
|
+
} : null;
|
|
198
|
+
}, vt = (t, e) => {
|
|
199
|
+
const s = t[e];
|
|
200
|
+
if (s !== ">" && s !== "<")
|
|
201
|
+
return null;
|
|
202
|
+
let r = e + 1;
|
|
203
|
+
for (; r < t.length && t[r] === s; )
|
|
204
|
+
r++;
|
|
205
|
+
const l = t.substring(e, r);
|
|
206
|
+
return nt.test(l) ? {
|
|
207
|
+
html: `<span class="abc-broken-rhythm">${d(l)}</span>`,
|
|
208
|
+
nextIndex: r
|
|
209
|
+
} : null;
|
|
210
|
+
}, xt = (t) => {
|
|
211
|
+
let e = "", s = 0, r = 0;
|
|
212
|
+
for (; s < t.length; ) {
|
|
213
|
+
const l = rt(t, s);
|
|
214
|
+
if (l) {
|
|
215
|
+
e += l.html, s = l.nextIndex;
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
218
|
+
const n = ft(t, s);
|
|
219
|
+
if (n) {
|
|
220
|
+
e += n.html, s = n.nextIndex;
|
|
221
|
+
continue;
|
|
222
|
+
}
|
|
223
|
+
const a = mt(t, s);
|
|
224
|
+
if (a) {
|
|
225
|
+
e += a.html, s = a.nextIndex;
|
|
226
|
+
continue;
|
|
227
|
+
}
|
|
228
|
+
const c = lt(t, s);
|
|
229
|
+
if (c) {
|
|
230
|
+
e += c.html, s = c.nextIndex;
|
|
231
|
+
continue;
|
|
232
|
+
}
|
|
233
|
+
const v = dt(t, s);
|
|
234
|
+
if (v) {
|
|
235
|
+
e += v.html, s = v.nextIndex;
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
238
|
+
const f = pt(t, s);
|
|
239
|
+
if (f) {
|
|
240
|
+
e += f.html, s = f.nextIndex;
|
|
241
|
+
continue;
|
|
242
|
+
}
|
|
243
|
+
const i = ht(t, s);
|
|
244
|
+
if (i) {
|
|
245
|
+
e += i.html, s = i.nextIndex;
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
const o = at(t, s, r);
|
|
249
|
+
if (o) {
|
|
250
|
+
e += o.html, s = o.nextIndex, o.slurLevelDelta && (r += o.slurLevelDelta);
|
|
251
|
+
continue;
|
|
252
|
+
}
|
|
253
|
+
const u = it(t, s);
|
|
254
|
+
if (u) {
|
|
255
|
+
e += u.html, s = u.nextIndex;
|
|
256
|
+
continue;
|
|
257
|
+
}
|
|
258
|
+
const p = ot(t, s);
|
|
259
|
+
if (p) {
|
|
260
|
+
e += p.html, s = p.nextIndex;
|
|
261
|
+
continue;
|
|
262
|
+
}
|
|
263
|
+
const x = vt(t, s);
|
|
264
|
+
if (x) {
|
|
265
|
+
e += x.html, s = x.nextIndex;
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
const m = gt(t, s);
|
|
269
|
+
if (m) {
|
|
270
|
+
e += m.html, s = m.nextIndex;
|
|
271
|
+
continue;
|
|
272
|
+
}
|
|
273
|
+
const g = bt(t, s);
|
|
274
|
+
if (g) {
|
|
275
|
+
e += g.html, s = g.nextIndex;
|
|
276
|
+
continue;
|
|
277
|
+
}
|
|
278
|
+
const A = ct(t, s);
|
|
279
|
+
if (A) {
|
|
280
|
+
e += A.html, s = A.nextIndex;
|
|
281
|
+
continue;
|
|
282
|
+
}
|
|
283
|
+
const b = ut(t, s);
|
|
284
|
+
if (b) {
|
|
285
|
+
e += b.html, s = b.nextIndex;
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
e += `<span class="abc-text">${d(t[s])}</span>`, s++;
|
|
289
|
+
}
|
|
290
|
+
return e;
|
|
291
|
+
}, _ = (t) => t.split(`
|
|
292
|
+
`).map((s) => {
|
|
293
|
+
if (st.test(s))
|
|
294
|
+
return `<span class="abc-comment">${d(s)}</span>`;
|
|
295
|
+
const r = s.match(y);
|
|
296
|
+
if (r) {
|
|
297
|
+
const [, l, n] = r;
|
|
298
|
+
return l === "w:" || l === "W:" ? `<span class="abc-lyrics-key">${d(l)}</span><span class="abc-lyrics-value">${d(n)}</span>` : `<span class="abc-meta-key">${d(l)}</span><span class="abc-meta-value">${d(n)}</span>`;
|
|
299
|
+
}
|
|
300
|
+
return xt(s);
|
|
301
|
+
}).join(`
|
|
302
|
+
`), At = {
|
|
303
|
+
"X:": [
|
|
304
|
+
{ value: "1", description: "Reference number 1" },
|
|
305
|
+
{ value: "2", description: "Reference number 2" }
|
|
306
|
+
],
|
|
307
|
+
"T:": [
|
|
308
|
+
{ value: "タイトル", description: "Japanese title template" },
|
|
309
|
+
{ value: "Untitled", description: "Default title" }
|
|
310
|
+
],
|
|
311
|
+
"M:": [
|
|
312
|
+
{ value: "4/4", description: "Common time" },
|
|
313
|
+
{ value: "3/4", description: "Waltz time" },
|
|
314
|
+
{ value: "2/4", description: "March time" },
|
|
315
|
+
{ value: "6/8", description: "Compound duple" },
|
|
316
|
+
{ value: "9/8", description: "Compound triple" },
|
|
317
|
+
{ value: "12/8", description: "Compound quadruple" },
|
|
318
|
+
{ value: "5/4", description: "Quintuple meter" },
|
|
319
|
+
{ value: "7/8", description: "Septuple meter" },
|
|
320
|
+
{ value: "C", description: "Common time (4/4)" },
|
|
321
|
+
{ value: "C|", description: "Cut time (2/2)" }
|
|
322
|
+
],
|
|
323
|
+
"L:": [
|
|
324
|
+
{ value: "1/4", description: "Quarter note" },
|
|
325
|
+
{ value: "1/8", description: "Eighth note" },
|
|
326
|
+
{ value: "1/16", description: "Sixteenth note" }
|
|
327
|
+
],
|
|
328
|
+
"Q:": [
|
|
329
|
+
{ value: "1/4=120", description: "Quarter note = 120 BPM" },
|
|
330
|
+
{ value: "1/4=100", description: "Quarter note = 100 BPM" },
|
|
331
|
+
{ value: "1/4=80", description: "Quarter note = 80 BPM" },
|
|
332
|
+
{ value: "1/8=180", description: "Eighth note = 180 BPM" }
|
|
333
|
+
],
|
|
334
|
+
"K:": [
|
|
335
|
+
{ value: "C" },
|
|
336
|
+
{ value: "G" },
|
|
337
|
+
{ value: "D" },
|
|
338
|
+
{ value: "A" },
|
|
339
|
+
{ value: "E" },
|
|
340
|
+
{ value: "B" },
|
|
341
|
+
{ value: "F#" },
|
|
342
|
+
{ value: "C#" },
|
|
343
|
+
{ value: "F" },
|
|
344
|
+
{ value: "Bb" },
|
|
345
|
+
{ value: "Eb" },
|
|
346
|
+
{ value: "Ab" },
|
|
347
|
+
{ value: "Db" },
|
|
348
|
+
{ value: "Gb" },
|
|
349
|
+
{ value: "Cb" },
|
|
350
|
+
{ value: "Am" },
|
|
351
|
+
{ value: "Em" },
|
|
352
|
+
{ value: "Bm" },
|
|
353
|
+
{ value: "F#m" },
|
|
354
|
+
{ value: "C#m" },
|
|
355
|
+
{ value: "G#m" },
|
|
356
|
+
{ value: "D#m" },
|
|
357
|
+
{ value: "Dm" },
|
|
358
|
+
{ value: "Gm" },
|
|
359
|
+
{ value: "Cm" },
|
|
360
|
+
{ value: "Fm" },
|
|
361
|
+
{ value: "Bbm" },
|
|
362
|
+
{ value: "Ebm" },
|
|
363
|
+
{ value: "Abm" }
|
|
364
|
+
],
|
|
365
|
+
"C:": [
|
|
366
|
+
{ value: "Traditional", description: "Traditional composer" },
|
|
367
|
+
{ value: "Unknown", description: "Unknown composer" }
|
|
368
|
+
],
|
|
369
|
+
"R:": [
|
|
370
|
+
{ value: "reel", description: "Reel rhythm" },
|
|
371
|
+
{ value: "jig", description: "Jig rhythm" },
|
|
372
|
+
{ value: "hornpipe", description: "Hornpipe rhythm" },
|
|
373
|
+
{ value: "waltz", description: "Waltz rhythm" },
|
|
374
|
+
{ value: "march", description: "March rhythm" }
|
|
375
|
+
],
|
|
376
|
+
"A:": [
|
|
377
|
+
{ value: "Ireland", description: "Area: Ireland" },
|
|
378
|
+
{ value: "Scotland", description: "Area: Scotland" },
|
|
379
|
+
{ value: "England", description: "Area: England" },
|
|
380
|
+
{ value: "USA", description: "Area: USA" },
|
|
381
|
+
{ value: "Japan", description: "Area: Japan" }
|
|
382
|
+
],
|
|
383
|
+
"B:": [
|
|
384
|
+
{ value: "The Session", description: "Book: The Session" },
|
|
385
|
+
{ value: "O'Neill's Music of Ireland", description: "Book: O'Neill's Music of Ireland" }
|
|
386
|
+
],
|
|
387
|
+
"D:": [
|
|
388
|
+
{ value: "Album Name (Year)", description: "Discography template" }
|
|
389
|
+
],
|
|
390
|
+
"F:": [
|
|
391
|
+
{ value: "https://thesession.org/", description: "File URL template" }
|
|
392
|
+
],
|
|
393
|
+
"G:": [
|
|
394
|
+
{ value: "Group name", description: "Group template" }
|
|
395
|
+
],
|
|
396
|
+
"H:": [
|
|
397
|
+
{ value: "History note", description: "History template" }
|
|
398
|
+
],
|
|
399
|
+
"I:": [
|
|
400
|
+
{ value: "abc-charset utf-8", description: "Character set: UTF-8" }
|
|
401
|
+
],
|
|
402
|
+
"m:": [
|
|
403
|
+
{ value: "~g2 = {a}g{f}g", description: "Macro definition template" }
|
|
404
|
+
],
|
|
405
|
+
"N:": [
|
|
406
|
+
{ value: "Note text", description: "Notes template" }
|
|
407
|
+
],
|
|
408
|
+
"O:": [
|
|
409
|
+
{ value: "Traditional", description: "Origin: Traditional" },
|
|
410
|
+
{ value: "Ireland", description: "Origin: Ireland" },
|
|
411
|
+
{ value: "Scotland", description: "Origin: Scotland" }
|
|
412
|
+
],
|
|
413
|
+
"P:": [
|
|
414
|
+
{ value: "AABB", description: "Parts: AABB" },
|
|
415
|
+
{ value: "ABCD", description: "Parts: ABCD" },
|
|
416
|
+
{ value: "A", description: "Part: A" },
|
|
417
|
+
{ value: "B", description: "Part: B" }
|
|
418
|
+
],
|
|
419
|
+
"r:": [
|
|
420
|
+
{ value: "Remark text", description: "Remark template" }
|
|
421
|
+
],
|
|
422
|
+
"S:": [
|
|
423
|
+
{ value: "Session tune", description: "Source: Session" },
|
|
424
|
+
{ value: "Traditional", description: "Source: Traditional" }
|
|
425
|
+
],
|
|
426
|
+
"s:": [
|
|
427
|
+
{ value: "Symbol line", description: "Symbol line template" }
|
|
428
|
+
],
|
|
429
|
+
"U:": [
|
|
430
|
+
{ value: "u = !trill!", description: "User defined: trill" }
|
|
431
|
+
],
|
|
432
|
+
"V:": [
|
|
433
|
+
{ value: "1", description: "Voice 1" },
|
|
434
|
+
{ value: "2", description: "Voice 2" },
|
|
435
|
+
{ value: "T", description: "Tenor voice" },
|
|
436
|
+
{ value: "B", description: "Bass voice" }
|
|
437
|
+
],
|
|
438
|
+
"W:": [
|
|
439
|
+
{ value: "Lyrics line", description: "Words (multi-line)" }
|
|
440
|
+
],
|
|
441
|
+
"w:": [
|
|
442
|
+
{ value: "Lyrics for this line", description: "Words (aligned)" }
|
|
443
|
+
],
|
|
444
|
+
"Z:": [
|
|
445
|
+
{ value: "Your Name", description: "Transcriber name" },
|
|
446
|
+
{ value: "ABC transcription", description: "Transcription note" }
|
|
447
|
+
]
|
|
448
|
+
}, Tt = (t) => At[t] || [], Nt = [
|
|
449
|
+
{
|
|
450
|
+
value: "/header",
|
|
451
|
+
description: "Insert basic ABC header template",
|
|
452
|
+
template: `X:1
|
|
453
|
+
T:Untitled
|
|
454
|
+
M:4/4
|
|
455
|
+
L:1/4
|
|
456
|
+
K:C
|
|
457
|
+
`
|
|
458
|
+
}
|
|
459
|
+
], It = (t) => t.startsWith("/") ? Nt.filter(
|
|
460
|
+
(e) => e.value.toLowerCase().startsWith(t.toLowerCase())
|
|
461
|
+
) : [], yt = ({
|
|
462
|
+
value: t,
|
|
463
|
+
textareaRef: e,
|
|
464
|
+
onChange: s
|
|
465
|
+
}) => {
|
|
466
|
+
const [r, l] = M({
|
|
467
|
+
isOpen: !1,
|
|
468
|
+
suggestions: [],
|
|
469
|
+
selectedIndex: 0,
|
|
470
|
+
position: { top: 0, left: 0 },
|
|
471
|
+
fieldKey: null,
|
|
472
|
+
inputValue: "",
|
|
473
|
+
isCommand: !1
|
|
474
|
+
}), n = N(() => {
|
|
475
|
+
if (!e.current)
|
|
476
|
+
return null;
|
|
477
|
+
const i = e.current.selectionStart, o = t.substring(0, i).split(`
|
|
478
|
+
`), u = o[o.length - 1];
|
|
479
|
+
if (u.startsWith("/"))
|
|
480
|
+
return {
|
|
481
|
+
fieldKey: null,
|
|
482
|
+
inputValue: u,
|
|
483
|
+
line: u,
|
|
484
|
+
lineStartPos: i - u.length,
|
|
485
|
+
isCommand: !0
|
|
486
|
+
};
|
|
487
|
+
const p = u.match(y);
|
|
488
|
+
if (p) {
|
|
489
|
+
const [, x, m] = p;
|
|
490
|
+
return {
|
|
491
|
+
fieldKey: x,
|
|
492
|
+
inputValue: m,
|
|
493
|
+
line: u,
|
|
494
|
+
lineStartPos: i - u.length,
|
|
495
|
+
isCommand: !1
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
return null;
|
|
499
|
+
}, [t, e]), a = N(() => {
|
|
500
|
+
if (!e.current)
|
|
501
|
+
return { top: 0, left: 0 };
|
|
502
|
+
const i = e.current, o = i.selectionStart, p = t.substring(0, o).split(`
|
|
503
|
+
`).length - 1, x = parseFloat(getComputedStyle(i).lineHeight) || 24;
|
|
504
|
+
return { top: (parseFloat(getComputedStyle(i).paddingTop) || 16) + (p + 1) * x - i.scrollTop, left: 60 };
|
|
505
|
+
}, [t, e]);
|
|
506
|
+
B(() => {
|
|
507
|
+
const i = n();
|
|
508
|
+
if (!i) {
|
|
509
|
+
l((u) => ({ ...u, isOpen: !1 }));
|
|
510
|
+
return;
|
|
511
|
+
}
|
|
512
|
+
let o = [];
|
|
513
|
+
if (i.isCommand ? o = It(i.inputValue) : i.fieldKey && (o = Tt(i.fieldKey).filter(
|
|
514
|
+
(p) => p.value.toLowerCase().startsWith(i.inputValue.toLowerCase())
|
|
515
|
+
)), o.length > 0) {
|
|
516
|
+
const u = a();
|
|
517
|
+
l({
|
|
518
|
+
isOpen: !0,
|
|
519
|
+
suggestions: o,
|
|
520
|
+
selectedIndex: 0,
|
|
521
|
+
position: u,
|
|
522
|
+
fieldKey: i.fieldKey,
|
|
523
|
+
inputValue: i.inputValue,
|
|
524
|
+
isCommand: i.isCommand
|
|
525
|
+
});
|
|
526
|
+
} else
|
|
527
|
+
l((u) => ({ ...u, isOpen: !1 }));
|
|
528
|
+
}, [t, n, a]);
|
|
529
|
+
const c = N(
|
|
530
|
+
(i) => {
|
|
531
|
+
if (!e.current)
|
|
532
|
+
return;
|
|
533
|
+
const o = e.current.selectionStart, u = t.substring(0, o).split(`
|
|
534
|
+
`), p = u[u.length - 1];
|
|
535
|
+
let x, m;
|
|
536
|
+
if (r.isCommand && i.template) {
|
|
537
|
+
const g = t.substring(0, o - p.length), A = t.substring(o);
|
|
538
|
+
x = g + i.template + A, m = g.length + i.template.length;
|
|
539
|
+
} else if (r.fieldKey) {
|
|
540
|
+
const g = r.fieldKey + i.value, A = t.substring(0, o - p.length), b = t.substring(o);
|
|
541
|
+
x = A + g + b, m = A.length + g.length;
|
|
542
|
+
} else
|
|
543
|
+
return;
|
|
544
|
+
s(x), setTimeout(() => {
|
|
545
|
+
e.current && (e.current.selectionStart = m, e.current.selectionEnd = m, e.current.focus());
|
|
546
|
+
}, 0), l((g) => ({ ...g, isOpen: !1 }));
|
|
547
|
+
},
|
|
548
|
+
[e, r.fieldKey, r.isCommand, t, s]
|
|
549
|
+
), v = N(
|
|
550
|
+
(i) => {
|
|
551
|
+
if (r.isOpen)
|
|
552
|
+
switch (i.key) {
|
|
553
|
+
case "ArrowDown":
|
|
554
|
+
i.preventDefault(), l((o) => ({
|
|
555
|
+
...o,
|
|
556
|
+
selectedIndex: Math.min(o.selectedIndex + 1, o.suggestions.length - 1)
|
|
557
|
+
}));
|
|
558
|
+
break;
|
|
559
|
+
case "ArrowUp":
|
|
560
|
+
i.preventDefault(), l((o) => ({
|
|
561
|
+
...o,
|
|
562
|
+
selectedIndex: Math.max(o.selectedIndex - 1, 0)
|
|
563
|
+
}));
|
|
564
|
+
break;
|
|
565
|
+
case "Enter":
|
|
566
|
+
r.suggestions.length > 0 && (i.preventDefault(), c(r.suggestions[r.selectedIndex]));
|
|
567
|
+
break;
|
|
568
|
+
case "Escape":
|
|
569
|
+
i.preventDefault(), l((o) => ({ ...o, isOpen: !1 }));
|
|
570
|
+
break;
|
|
571
|
+
}
|
|
572
|
+
},
|
|
573
|
+
[r.isOpen, r.suggestions, r.selectedIndex, c]
|
|
574
|
+
), f = N((i) => {
|
|
575
|
+
l((o) => ({ ...o, selectedIndex: i }));
|
|
576
|
+
}, []);
|
|
577
|
+
return {
|
|
578
|
+
isOpen: r.isOpen,
|
|
579
|
+
suggestions: r.suggestions,
|
|
580
|
+
selectedIndex: r.selectedIndex,
|
|
581
|
+
position: r.position,
|
|
582
|
+
handleKeyDown: v,
|
|
583
|
+
selectSuggestion: c,
|
|
584
|
+
handleMouseEnter: f
|
|
585
|
+
};
|
|
586
|
+
}, Ct = ({
|
|
587
|
+
suggestions: t,
|
|
588
|
+
selectedIndex: e,
|
|
589
|
+
position: s,
|
|
590
|
+
onSelect: r,
|
|
591
|
+
onMouseEnter: l
|
|
592
|
+
}) => {
|
|
593
|
+
const n = I(null);
|
|
594
|
+
return B(() => {
|
|
595
|
+
n.current?.scrollIntoView({
|
|
596
|
+
block: "nearest",
|
|
597
|
+
behavior: "smooth"
|
|
598
|
+
});
|
|
599
|
+
}, [e]), t.length === 0 ? null : /* @__PURE__ */ h(
|
|
600
|
+
"div",
|
|
601
|
+
{
|
|
602
|
+
className: "absolute z-50 bg-slate-800 border border-slate-600 rounded-md shadow-lg overflow-hidden",
|
|
603
|
+
style: {
|
|
604
|
+
top: `${s.top}px`,
|
|
605
|
+
left: `${s.left}px`,
|
|
606
|
+
minWidth: "200px",
|
|
607
|
+
maxWidth: "400px",
|
|
608
|
+
maxHeight: "300px",
|
|
609
|
+
overflowY: "auto"
|
|
610
|
+
},
|
|
611
|
+
children: t.map((a, c) => /* @__PURE__ */ T(
|
|
612
|
+
"div",
|
|
613
|
+
{
|
|
614
|
+
ref: c === e ? n : null,
|
|
615
|
+
className: `px-3 py-2 cursor-pointer ${c === e ? "bg-blue-600 text-white" : "text-slate-200 hover:bg-slate-700"}`,
|
|
616
|
+
onClick: () => r(a),
|
|
617
|
+
onMouseEnter: () => l(c),
|
|
618
|
+
children: [
|
|
619
|
+
/* @__PURE__ */ h("div", { className: "font-mono text-sm", children: a.value }),
|
|
620
|
+
a.description && /* @__PURE__ */ h("div", { className: "text-xs opacity-75 mt-1", children: a.description })
|
|
621
|
+
]
|
|
622
|
+
},
|
|
623
|
+
`${a.value}-${c}`
|
|
624
|
+
))
|
|
625
|
+
}
|
|
626
|
+
);
|
|
627
|
+
}, wt = (t) => {
|
|
628
|
+
const e = t.trim();
|
|
629
|
+
if (e === "C")
|
|
630
|
+
return { beatsPerMeasure: 4, beatUnit: 4 };
|
|
631
|
+
if (e === "C|")
|
|
632
|
+
return { beatsPerMeasure: 2, beatUnit: 2 };
|
|
633
|
+
const s = e.match(/^(\d+)\/(\d+)$/);
|
|
634
|
+
return s ? {
|
|
635
|
+
beatsPerMeasure: parseInt(s[1], 10),
|
|
636
|
+
beatUnit: parseInt(s[2], 10)
|
|
637
|
+
} : { beatsPerMeasure: 4, beatUnit: 4 };
|
|
638
|
+
}, Et = (t) => {
|
|
639
|
+
const s = t.trim().match(/^(\d+)\/(\d+)$/);
|
|
640
|
+
return s ? parseInt(s[1], 10) / parseInt(s[2], 10) : 1 / 8;
|
|
641
|
+
}, Bt = (t) => {
|
|
642
|
+
const e = t.split(`
|
|
643
|
+
`);
|
|
644
|
+
let s = { beatsPerMeasure: 4, beatUnit: 4 }, r = 1 / 8;
|
|
645
|
+
for (const l of e) {
|
|
646
|
+
const n = l.match(y);
|
|
647
|
+
if (n) {
|
|
648
|
+
const [, a, c] = n;
|
|
649
|
+
a === "M:" ? s = wt(c) : a === "L:" && (r = Et(c));
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
return { meter: s, unitNoteLength: r };
|
|
653
|
+
}, L = (t) => {
|
|
654
|
+
if (!t)
|
|
655
|
+
return 1;
|
|
656
|
+
if (t.startsWith("/"))
|
|
657
|
+
return 1 / parseInt(t.substring(1), 10);
|
|
658
|
+
if (t.includes("/")) {
|
|
659
|
+
const [e, s] = t.split("/");
|
|
660
|
+
return parseInt(e, 10) / parseInt(s, 10);
|
|
661
|
+
}
|
|
662
|
+
return parseInt(t, 10);
|
|
663
|
+
}, St = (t, e) => {
|
|
664
|
+
let s = 0, r = 0;
|
|
665
|
+
for (; r < t.length; ) {
|
|
666
|
+
const l = t[r];
|
|
667
|
+
if (E.test(l) || k.test(l)) {
|
|
668
|
+
let n = r + 1;
|
|
669
|
+
for (; n < t.length && (t[n] === "'" || t[n] === ","); )
|
|
670
|
+
n++;
|
|
671
|
+
let a = "";
|
|
672
|
+
if (n < t.length && (t[n] === "/" || /\d/.test(t[n]))) {
|
|
673
|
+
const o = n;
|
|
674
|
+
for (t[n] === "/" && n++; n < t.length && /\d/.test(t[n]); )
|
|
675
|
+
n++;
|
|
676
|
+
if (n < t.length && t[n] === "/")
|
|
677
|
+
for (n++; n < t.length && /\d/.test(t[n]); )
|
|
678
|
+
n++;
|
|
679
|
+
a = t.substring(o, n);
|
|
680
|
+
}
|
|
681
|
+
const c = L(a), v = e.unitNoteLength * c, f = 1 / e.meter.beatUnit, i = v / f;
|
|
682
|
+
s += i, r = n;
|
|
683
|
+
} else if (l === "[") {
|
|
684
|
+
let n = r + 1;
|
|
685
|
+
for (; n < t.length && t[n] !== "]"; ) {
|
|
686
|
+
const a = t[n];
|
|
687
|
+
if (E.test(a)) {
|
|
688
|
+
let c = n + 1;
|
|
689
|
+
for (; c < t.length && (t[c] === "'" || t[c] === ","); )
|
|
690
|
+
c++;
|
|
691
|
+
n = c;
|
|
692
|
+
} else
|
|
693
|
+
n++;
|
|
694
|
+
}
|
|
695
|
+
if (n < t.length && t[n] === "]") {
|
|
696
|
+
n++;
|
|
697
|
+
let a = "";
|
|
698
|
+
if (n < t.length && (t[n] === "/" || /\d/.test(t[n]))) {
|
|
699
|
+
const o = n;
|
|
700
|
+
for (t[n] === "/" && n++; n < t.length && /\d/.test(t[n]); )
|
|
701
|
+
n++;
|
|
702
|
+
if (n < t.length && t[n] === "/")
|
|
703
|
+
for (n++; n < t.length && /\d/.test(t[n]); )
|
|
704
|
+
n++;
|
|
705
|
+
a = t.substring(o, n);
|
|
706
|
+
}
|
|
707
|
+
const c = L(a), v = e.unitNoteLength * c, f = 1 / e.meter.beatUnit, i = v / f;
|
|
708
|
+
s += i;
|
|
709
|
+
}
|
|
710
|
+
r = n;
|
|
711
|
+
} else
|
|
712
|
+
r++;
|
|
713
|
+
}
|
|
714
|
+
return s;
|
|
715
|
+
}, $t = (t) => {
|
|
716
|
+
const e = [], s = t.split(`
|
|
717
|
+
`), r = Bt(t);
|
|
718
|
+
return s.forEach((l, n) => {
|
|
719
|
+
if (!(l.trim().startsWith("%") || y.test(l)) && l.includes("|")) {
|
|
720
|
+
let a = 0;
|
|
721
|
+
const c = l.split("|");
|
|
722
|
+
let v = 0;
|
|
723
|
+
c.forEach((f, i) => {
|
|
724
|
+
if (i === c.length - 1 && f.trim() === "")
|
|
725
|
+
return;
|
|
726
|
+
const o = f.trim();
|
|
727
|
+
if (o.startsWith(":") || o.startsWith("[") || o === "") {
|
|
728
|
+
a += f.length + 1;
|
|
729
|
+
return;
|
|
730
|
+
}
|
|
731
|
+
const u = St(o, r), p = r.meter.beatsPerMeasure;
|
|
732
|
+
if (Math.abs(u - p) > 0.01) {
|
|
733
|
+
const m = l.indexOf(o, a), g = m + o.length;
|
|
734
|
+
e.push({
|
|
735
|
+
line: n,
|
|
736
|
+
measureIndex: v,
|
|
737
|
+
startCol: m,
|
|
738
|
+
endCol: g,
|
|
739
|
+
expected: p,
|
|
740
|
+
actual: u,
|
|
741
|
+
message: `Expected ${p} beats, got ${u.toFixed(2)}`
|
|
742
|
+
});
|
|
743
|
+
}
|
|
744
|
+
v++, a += f.length + 1;
|
|
745
|
+
});
|
|
746
|
+
}
|
|
747
|
+
}), e;
|
|
748
|
+
}, Pt = ({ value: t, onChange: e }) => {
|
|
749
|
+
const s = I(null), r = I(null), l = I(null), [n, a] = M(null), c = j(t), v = _(t), f = F(() => $t(t), [t]), {
|
|
750
|
+
isOpen: i,
|
|
751
|
+
suggestions: o,
|
|
752
|
+
selectedIndex: u,
|
|
753
|
+
position: p,
|
|
754
|
+
handleKeyDown: x,
|
|
755
|
+
selectSuggestion: m,
|
|
756
|
+
handleMouseEnter: g
|
|
757
|
+
} = yt({ value: t, textareaRef: s, onChange: e }), A = () => {
|
|
758
|
+
s.current && r.current && l.current && (r.current.scrollTop = s.current.scrollTop, l.current.scrollTop = s.current.scrollTop);
|
|
759
|
+
};
|
|
760
|
+
return /* @__PURE__ */ h("div", { className: "w-full md:w-1/2 h-2/3 md:h-full flex flex-col p-4", style: { backgroundColor: "#161616" }, children: /* @__PURE__ */ T("div", { className: "w-full flex-1 flex flex-col rounded-lg border border-slate-600 overflow-hidden", style: { backgroundColor: "#1a1a1a" }, children: [
|
|
761
|
+
/* @__PURE__ */ T("div", { className: "flex-1 flex overflow-hidden", children: [
|
|
762
|
+
/* @__PURE__ */ h(
|
|
763
|
+
"div",
|
|
764
|
+
{
|
|
765
|
+
ref: r,
|
|
766
|
+
className: "overflow-hidden text-right text-sm font-mono leading-relaxed text-slate-500 select-none",
|
|
767
|
+
style: { backgroundColor: "#0f0f0f", minWidth: "2.5rem" },
|
|
768
|
+
children: /* @__PURE__ */ h("pre", { className: "m-0 pl-1 pr-3 py-4", children: c })
|
|
769
|
+
}
|
|
770
|
+
),
|
|
771
|
+
/* @__PURE__ */ T("div", { className: "flex-1 relative", children: [
|
|
772
|
+
/* @__PURE__ */ h(
|
|
773
|
+
"div",
|
|
774
|
+
{
|
|
775
|
+
ref: l,
|
|
776
|
+
className: "absolute inset-0 overflow-hidden px-4 py-4 text-sm font-mono leading-relaxed pointer-events-none",
|
|
777
|
+
style: {
|
|
778
|
+
backgroundColor: "#1a1a1a",
|
|
779
|
+
opacity: n ? 0.3 : 1,
|
|
780
|
+
transition: "opacity 0.2s"
|
|
781
|
+
},
|
|
782
|
+
children: /* @__PURE__ */ h(
|
|
783
|
+
"pre",
|
|
784
|
+
{
|
|
785
|
+
className: "m-0",
|
|
786
|
+
dangerouslySetInnerHTML: { __html: v }
|
|
787
|
+
}
|
|
788
|
+
)
|
|
789
|
+
}
|
|
790
|
+
),
|
|
791
|
+
n && (() => {
|
|
792
|
+
const b = t.split(`
|
|
793
|
+
`), R = (b[n.line] || "").substring(n.startCol, n.endCol), D = _(R);
|
|
794
|
+
return /* @__PURE__ */ h(
|
|
795
|
+
"div",
|
|
796
|
+
{
|
|
797
|
+
className: "absolute inset-0 overflow-hidden px-4 py-4 text-sm font-mono leading-relaxed pointer-events-none",
|
|
798
|
+
style: { backgroundColor: "transparent" },
|
|
799
|
+
children: /* @__PURE__ */ h("pre", { className: "m-0", children: b.map((C, w) => {
|
|
800
|
+
if (w === n.line) {
|
|
801
|
+
const U = C.substring(0, n.startCol), W = C.substring(n.endCol);
|
|
802
|
+
return /* @__PURE__ */ T("div", { children: [
|
|
803
|
+
/* @__PURE__ */ h("span", { style: { opacity: 0 }, children: U }),
|
|
804
|
+
/* @__PURE__ */ h(
|
|
805
|
+
"span",
|
|
806
|
+
{
|
|
807
|
+
className: "bg-amber-500/20 px-1 rounded",
|
|
808
|
+
dangerouslySetInnerHTML: { __html: D }
|
|
809
|
+
}
|
|
810
|
+
),
|
|
811
|
+
/* @__PURE__ */ h("span", { style: { opacity: 0 }, children: W })
|
|
812
|
+
] }, w);
|
|
813
|
+
}
|
|
814
|
+
return /* @__PURE__ */ h("div", { style: { opacity: 0 }, children: C }, w);
|
|
815
|
+
}) })
|
|
816
|
+
}
|
|
817
|
+
);
|
|
818
|
+
})(),
|
|
819
|
+
/* @__PURE__ */ h(
|
|
820
|
+
"textarea",
|
|
821
|
+
{
|
|
822
|
+
ref: s,
|
|
823
|
+
className: "absolute inset-0 w-full h-full resize-none px-4 py-4 text-sm font-mono leading-relaxed outline-none border-0",
|
|
824
|
+
style: { backgroundColor: "transparent", color: "transparent", caretColor: "#fff" },
|
|
825
|
+
value: t,
|
|
826
|
+
onChange: (b) => e(b.target.value),
|
|
827
|
+
onScroll: A,
|
|
828
|
+
onKeyDown: x,
|
|
829
|
+
spellCheck: !1,
|
|
830
|
+
placeholder: "Type /header to insert template..."
|
|
831
|
+
}
|
|
832
|
+
),
|
|
833
|
+
i && /* @__PURE__ */ h(
|
|
834
|
+
Ct,
|
|
835
|
+
{
|
|
836
|
+
suggestions: o,
|
|
837
|
+
selectedIndex: u,
|
|
838
|
+
position: p,
|
|
839
|
+
onSelect: m,
|
|
840
|
+
onMouseEnter: g
|
|
841
|
+
}
|
|
842
|
+
)
|
|
843
|
+
] })
|
|
844
|
+
] }),
|
|
845
|
+
f.length > 0 && /* @__PURE__ */ T(
|
|
846
|
+
"div",
|
|
847
|
+
{
|
|
848
|
+
className: "border-t border-slate-600 px-4 py-3 text-xs font-mono overflow-auto",
|
|
849
|
+
style: { backgroundColor: "#0f0f0f", maxHeight: "8rem" },
|
|
850
|
+
children: [
|
|
851
|
+
/* @__PURE__ */ T("div", { className: "text-slate-500 mb-2 text-[10px] uppercase tracking-wide", children: [
|
|
852
|
+
"Validation Errors (",
|
|
853
|
+
f.length,
|
|
854
|
+
")"
|
|
855
|
+
] }),
|
|
856
|
+
f.map((b, S) => /* @__PURE__ */ T(
|
|
857
|
+
"div",
|
|
858
|
+
{
|
|
859
|
+
className: "flex items-start gap-3 mb-2 last:mb-0 hover:bg-slate-800/30 px-2 py-1 rounded transition-colors cursor-pointer",
|
|
860
|
+
onMouseEnter: () => a(b),
|
|
861
|
+
onMouseLeave: () => a(null),
|
|
862
|
+
children: [
|
|
863
|
+
/* @__PURE__ */ h("span", { className: "text-amber-500 shrink-0 mt-0.5", children: "⚠️" }),
|
|
864
|
+
/* @__PURE__ */ T("div", { className: "flex-1 flex gap-2", children: [
|
|
865
|
+
/* @__PURE__ */ T("span", { className: "text-cyan-400 shrink-0", children: [
|
|
866
|
+
"Ln ",
|
|
867
|
+
b.line + 1,
|
|
868
|
+
", M",
|
|
869
|
+
b.measureIndex + 1,
|
|
870
|
+
":"
|
|
871
|
+
] }),
|
|
872
|
+
/* @__PURE__ */ h("span", { className: "text-amber-300", children: b.message })
|
|
873
|
+
] })
|
|
874
|
+
]
|
|
875
|
+
},
|
|
876
|
+
S
|
|
877
|
+
))
|
|
878
|
+
]
|
|
879
|
+
}
|
|
880
|
+
)
|
|
881
|
+
] }) });
|
|
882
|
+
}, kt = ({ abc: t }) => {
|
|
883
|
+
const e = I(null);
|
|
884
|
+
return B(() => {
|
|
885
|
+
e.current && K.renderAbc(e.current, t, {
|
|
886
|
+
responsive: "resize",
|
|
887
|
+
foregroundColor: "#ffffff",
|
|
888
|
+
format: {
|
|
889
|
+
titlefont: "serif 20"
|
|
890
|
+
}
|
|
891
|
+
});
|
|
892
|
+
}, [t]), /* @__PURE__ */ h("div", { ref: e, className: "w-full abc-preview" });
|
|
893
|
+
};
|
|
894
|
+
export {
|
|
895
|
+
H as ABC_ACCIDENTAL_PATTERN,
|
|
896
|
+
O as ABC_ANNOTATION_PATTERN,
|
|
897
|
+
G as ABC_BAR_PATTERN,
|
|
898
|
+
nt as ABC_BROKEN_RHYTHM_PATTERN,
|
|
899
|
+
Q as ABC_CHORD_BRACKET_PATTERN,
|
|
900
|
+
X as ABC_CHORD_SYMBOL_PATTERN,
|
|
901
|
+
Nt as ABC_COMMANDS,
|
|
902
|
+
st as ABC_COMMENT_PATTERN,
|
|
903
|
+
Z as ABC_DECORATION_PATTERN,
|
|
904
|
+
P as ABC_DURATION_PATTERN,
|
|
905
|
+
y as ABC_FIELD_PATTERN,
|
|
906
|
+
q as ABC_GRACE_NOTE_PATTERN,
|
|
907
|
+
et as ABC_INLINE_FIELD_PATTERN,
|
|
908
|
+
E as ABC_NOTE_PATTERN,
|
|
909
|
+
V as ABC_OCTAVE_PATTERN,
|
|
910
|
+
J as ABC_ORNAMENT_PATTERN,
|
|
911
|
+
k as ABC_REST_PATTERN,
|
|
912
|
+
z as ABC_SLUR_PATTERN,
|
|
913
|
+
At as ABC_SUGGESTIONS,
|
|
914
|
+
$ as ABC_TIE_PATTERN,
|
|
915
|
+
Y as ABC_TUPLET_PATTERN,
|
|
916
|
+
tt as ABC_VOLTA_BRACKET_PATTERN,
|
|
917
|
+
Pt as AbcEditor,
|
|
918
|
+
kt as AbcPreview,
|
|
919
|
+
Ct as SuggestionList,
|
|
920
|
+
_ as highlightAbc,
|
|
921
|
+
yt as useAbcAutoComplete,
|
|
922
|
+
j as useLineNumbers,
|
|
923
|
+
$t as validateAbc
|
|
924
|
+
};
|