@viritura/score-engine 0.2.1-next.37 → 0.2.1-next.38
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/index.js +25 -8
- package/dist/index.js.map +2 -2
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -485,7 +485,24 @@ function parseRoot(step, accidental) {
|
|
|
485
485
|
let normalized = accidental.replaceAll("\u266D", "b").replaceAll("\u266F", "#"), alter = normalized === "x" || normalized === "\u{1D12A}" ? 2 : normalized === "\u{1D12B}" ? -2 : [...normalized].reduce((sum, token) => sum + (token === "#" ? 1 : -1), 0);
|
|
486
486
|
return alter === 0 ? { step: step.toUpperCase() } : { step: step.toUpperCase(), alter };
|
|
487
487
|
}
|
|
488
|
-
var
|
|
488
|
+
var ROOT_PREFIX_PATTERN = /^([A-Ga-g])((?:#+|b+|♯+|♭+|x|𝄪|𝄫)?)/u;
|
|
489
|
+
function splitChordSymbolText(input) {
|
|
490
|
+
let withoutLeadingWhitespace = input.trimStart(), content = withoutLeadingWhitespace.trimEnd(), slash = content.indexOf("/"), head = slash < 0 ? content : content.slice(0, slash), root = ROOT_PREFIX_PATTERN.exec(head);
|
|
491
|
+
if (!root) return;
|
|
492
|
+
let bass;
|
|
493
|
+
if (slash >= 0) {
|
|
494
|
+
let bassText = content.slice(slash + 1), bassMatch = ROOT_PREFIX_PATTERN.exec(bassText);
|
|
495
|
+
if (!bassMatch || bassMatch[0].length !== bassText.length) return;
|
|
496
|
+
bass = parseRoot(bassMatch[1], bassMatch[2] ?? "");
|
|
497
|
+
}
|
|
498
|
+
return {
|
|
499
|
+
leadingWhitespace: input.slice(0, input.length - withoutLeadingWhitespace.length),
|
|
500
|
+
root: parseRoot(root[1], root[2] ?? ""),
|
|
501
|
+
suffix: head.slice(root[0].length),
|
|
502
|
+
bass,
|
|
503
|
+
trailingWhitespace: withoutLeadingWhitespace.slice(content.length)
|
|
504
|
+
};
|
|
505
|
+
}
|
|
489
506
|
function isNoChordText(text) {
|
|
490
507
|
return /^(?:NC|N\.C\.?)$/i.test(text.trim());
|
|
491
508
|
}
|
|
@@ -572,15 +589,15 @@ function parseQuality(text) {
|
|
|
572
589
|
return base.quality === "major" && base.extension === void 0 && modifiers.added.length === 1 && modifiers.added[0] === 6 && modifiers.omitted.length === 0 ? { quality: "major", extension: 6 } : { ...base, modifiers };
|
|
573
590
|
}
|
|
574
591
|
function parseChordSymbolText(input, position) {
|
|
575
|
-
let
|
|
576
|
-
if (!
|
|
577
|
-
let
|
|
592
|
+
let parts = splitChordSymbolText(input);
|
|
593
|
+
if (!parts) return { position, rawText: input };
|
|
594
|
+
let parsedQuality = parseQuality(parts.suffix), chord = {
|
|
578
595
|
position,
|
|
579
596
|
rawText: input,
|
|
580
|
-
root,
|
|
597
|
+
root: parts.root,
|
|
581
598
|
quality: parsedQuality?.quality ?? "other"
|
|
582
599
|
};
|
|
583
|
-
return (!parsedQuality || parsedQuality.modifiers) && (chord.kindText =
|
|
600
|
+
return (!parsedQuality || parsedQuality.modifiers) && (chord.kindText = parts.suffix), parsedQuality?.extension !== void 0 && (chord.extension = parsedQuality.extension), parts.bass && (chord.bass = parts.bass), chord;
|
|
584
601
|
}
|
|
585
602
|
|
|
586
603
|
// packages/core/src/operations/lyricExtenders.ts
|
|
@@ -2214,9 +2231,9 @@ function interpolateBeatAnchors(bounds, beat, endX) {
|
|
|
2214
2231
|
|
|
2215
2232
|
// packages/score-engine/src/buildInfo.ts
|
|
2216
2233
|
init_define_import_meta_env();
|
|
2217
|
-
var PACKAGE_VERSION = "0.2.1-next.
|
|
2234
|
+
var PACKAGE_VERSION = "0.2.1-next.38", BUNDLE_WORKER_FILE = "score-engine.worker.js";
|
|
2218
2235
|
function buildCommit() {
|
|
2219
|
-
return "
|
|
2236
|
+
return "c86711b1e69702ccabce35a06741343697305fdc";
|
|
2220
2237
|
}
|
|
2221
2238
|
function bundledAssetBase() {
|
|
2222
2239
|
let moduleUrl = import.meta.url;
|