@dsebastien/music-notation 0.21.1 → 0.21.2
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 +1 -1
- package/dist/blocks/properties.d.ts +4 -0
- package/dist/index.js +12 -3
- package/dist/index.js.map +3 -3
- package/dist/music-notation.publish.min.js +30 -30
- package/dist/music-notation.tab.min.js +1 -1
- package/dist/publish/index.js +12 -3
- package/dist/publish/index.js.map +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -191,7 +191,7 @@ Add this to your site's `publish.js`. It loads the bundle only on pages that hav
|
|
|
191
191
|
|
|
192
192
|
```js
|
|
193
193
|
;(() => {
|
|
194
|
-
const VERSION = '0.21.
|
|
194
|
+
const VERSION = '0.21.1'
|
|
195
195
|
const CDN = `https://cdn.jsdelivr.net/npm/@dsebastien/music-notation@${VERSION}/dist`
|
|
196
196
|
const selector = (languages) => languages.map((l) => `pre > code.language-${l}`).join(', ')
|
|
197
197
|
const BLOCKS = selector([
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/** Property names, as Music Practice and the Obsidian Starter Kit write them by default. */
|
|
2
2
|
export interface PropertyNames {
|
|
3
3
|
chordSymbol: string;
|
|
4
|
+
/** The chord's root ("A", "C#"), read with the quality when the note has no chord symbol (#132). */
|
|
5
|
+
chordRoot: string;
|
|
6
|
+
/** The chord's quality ("Minor 7", "5 (Power)"), read with the root (#132). */
|
|
7
|
+
chordQuality: string;
|
|
4
8
|
frets: string;
|
|
5
9
|
fingers: string;
|
|
6
10
|
/** First fret shown (guitar); 0 or empty means computed. */
|
package/dist/index.js
CHANGED
|
@@ -12369,6 +12369,8 @@ var RENDERERS = {
|
|
|
12369
12369
|
// src/blocks/properties.ts
|
|
12370
12370
|
var DEFAULT_PROPERTY_NAMES = {
|
|
12371
12371
|
chordSymbol: "chord_symbol",
|
|
12372
|
+
chordRoot: "chord_root",
|
|
12373
|
+
chordQuality: "chord_quality",
|
|
12372
12374
|
frets: "frets",
|
|
12373
12375
|
fingers: "fingers",
|
|
12374
12376
|
position: "position",
|
|
@@ -12436,9 +12438,16 @@ function cagedShape(value) {
|
|
|
12436
12438
|
return m ? m[1].toUpperCase() : null;
|
|
12437
12439
|
}
|
|
12438
12440
|
function chordOf2(properties, names) {
|
|
12439
|
-
const value = first(properties[names.chordSymbol]);
|
|
12441
|
+
const value = first(properties[names.chordSymbol]) || rootAndQuality(properties, names);
|
|
12440
12442
|
return value ? readChord(value)?.symbol ?? null : null;
|
|
12441
12443
|
}
|
|
12444
|
+
function rootAndQuality(properties, names) {
|
|
12445
|
+
const root = first(properties[names.chordRoot]);
|
|
12446
|
+
if (!root)
|
|
12447
|
+
return "";
|
|
12448
|
+
const quality = first(properties[names.chordQuality]).replace(/\([^)]*\)/g, "").trim();
|
|
12449
|
+
return quality ? `${root} ${quality}` : root;
|
|
12450
|
+
}
|
|
12442
12451
|
function arpeggioSource(language, properties, names, instrument) {
|
|
12443
12452
|
const kind = kindOf(properties, names);
|
|
12444
12453
|
const guitar = instrument !== "piano";
|
|
@@ -12505,7 +12514,7 @@ function blockFromProperties(language, properties, options = {}) {
|
|
|
12505
12514
|
if (language === "picking")
|
|
12506
12515
|
return pickingSource(properties, names);
|
|
12507
12516
|
if (language === "chord") {
|
|
12508
|
-
const symbol = get(names.chordSymbol);
|
|
12517
|
+
const symbol = get(names.chordSymbol) ?? chordOf2(properties, names) ?? undefined;
|
|
12509
12518
|
if (symbol)
|
|
12510
12519
|
lines.push(`symbol: ${symbol}`);
|
|
12511
12520
|
if (instrument === "piano") {
|
|
@@ -16435,5 +16444,5 @@ export {
|
|
|
16435
16444
|
withTonicizations
|
|
16436
16445
|
};
|
|
16437
16446
|
|
|
16438
|
-
//# debugId=
|
|
16447
|
+
//# debugId=0445A74304ED6A3164756E2164756E21
|
|
16439
16448
|
//# sourceMappingURL=index.js.map
|