@dsebastien/music-notation 0.5.0 → 0.5.1
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 +18 -13
- package/dist/index.js +12 -4
- package/dist/index.js.map +3 -3
- package/dist/music-notation.css +10 -2
- package/dist/music-notation.publish.min.js +14 -6
- package/dist/music-notation.tab.min.js +14 -6
- package/dist/playback/controls.d.ts +3 -2
- package/dist/publish/index.js +2 -2
- package/dist/publish/index.js.map +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -117,24 +117,29 @@ if (!result.ok) console.warn(result.error)
|
|
|
117
117
|
|
|
118
118
|
## Obsidian Publish
|
|
119
119
|
|
|
120
|
-
Add this to your site's `publish.js`. It loads the bundle only on pages that have notation blocks:
|
|
120
|
+
Add this to your site's `publish.js`. It loads the bundle only on pages that have notation blocks, and the tab bundle (with alphaTab) only on pages with tabs or scores:
|
|
121
121
|
|
|
122
122
|
```js
|
|
123
123
|
;(() => {
|
|
124
|
-
const VERSION = '0.
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
requested
|
|
124
|
+
const VERSION = '0.5.0'
|
|
125
|
+
const CDN = `https://cdn.jsdelivr.net/npm/@dsebastien/music-notation@${VERSION}/dist`
|
|
126
|
+
const selector = (languages) => languages.map((l) => `pre > code.language-${l}`).join(', ')
|
|
127
|
+
const BLOCKS = selector(['chord', 'chords', 'keyboard', 'fretboard'])
|
|
128
|
+
const TABS = selector(['tab', 'score'])
|
|
129
|
+
const requested = new Set()
|
|
130
|
+
const load = (file) => {
|
|
131
|
+
if (requested.has(file)) return
|
|
132
|
+
requested.add(file)
|
|
132
133
|
const script = document.createElement('script')
|
|
133
|
-
script.src =
|
|
134
|
+
script.src = `${CDN}/${file}`
|
|
134
135
|
document.head.appendChild(script)
|
|
135
136
|
}
|
|
136
|
-
|
|
137
|
-
|
|
137
|
+
const check = () => {
|
|
138
|
+
if (document.querySelector(BLOCKS)) load('music-notation.publish.min.js')
|
|
139
|
+
if (document.querySelector(TABS)) load('music-notation.tab.min.js')
|
|
140
|
+
}
|
|
141
|
+
check()
|
|
142
|
+
new MutationObserver(check).observe(document.body, { childList: true, subtree: true })
|
|
138
143
|
})()
|
|
139
144
|
```
|
|
140
145
|
|
|
@@ -142,7 +147,7 @@ The bundle renders every block, now and as you navigate, and hides a block's sou
|
|
|
142
147
|
|
|
143
148
|
## Credits and licenses
|
|
144
149
|
|
|
145
|
-
MIT. Built on [tonal](https://github.com/tonaljs/tonal) (MIT) for music theory and [chords-db](https://github.com/tombatossals/chords-db) (MIT) for guitar voicings.
|
|
150
|
+
MIT. Built on [tonal](https://github.com/tonaljs/tonal) (MIT) for music theory and [chords-db](https://github.com/tombatossals/chords-db) (MIT) for guitar voicings. Tabs and scores use [alphaTab](https://alphatab.net) (MPL-2.0), which the app passes in; the tab bundle loads it from jsDelivr.
|
|
146
151
|
|
|
147
152
|
## News & support
|
|
148
153
|
|
package/dist/index.js
CHANGED
|
@@ -1972,7 +1972,7 @@ function lightFor(win) {
|
|
|
1972
1972
|
return player;
|
|
1973
1973
|
}
|
|
1974
1974
|
function playerFor(win, options) {
|
|
1975
|
-
const given = typeof options.player === "function" ? options.player() : options.player;
|
|
1975
|
+
const given = typeof options.player === "function" ? options.player(win) : options.player;
|
|
1976
1976
|
return given ?? lightFor(win);
|
|
1977
1977
|
}
|
|
1978
1978
|
function dataOf(diagram) {
|
|
@@ -3666,7 +3666,7 @@ var styles_default = `/* Music notation. Colors follow Obsidian's theme variable
|
|
|
3666
3666
|
all: unset;
|
|
3667
3667
|
appearance: none;
|
|
3668
3668
|
width: 44px;
|
|
3669
|
-
/* The input is the track
|
|
3669
|
+
/* The input is the track (3px); the thumb is pulled up to its middle below. */
|
|
3670
3670
|
height: 3px;
|
|
3671
3671
|
margin: 0;
|
|
3672
3672
|
border-radius: 2px;
|
|
@@ -3684,13 +3684,21 @@ var styles_default = `/* Music notation. Colors follow Obsidian's theme variable
|
|
|
3684
3684
|
appearance: none;
|
|
3685
3685
|
width: 9px;
|
|
3686
3686
|
height: 9px;
|
|
3687
|
-
|
|
3687
|
+
/* Centered on the 3px track. Hosts may move thumbs (Obsidian: relative, top -6px). */
|
|
3688
|
+
position: static;
|
|
3689
|
+
top: 0;
|
|
3690
|
+
margin-top: -3px;
|
|
3688
3691
|
border: none;
|
|
3689
3692
|
border-radius: 50%;
|
|
3690
3693
|
background: var(--mn-accent);
|
|
3691
3694
|
box-shadow: none;
|
|
3692
3695
|
}
|
|
3693
3696
|
|
|
3697
|
+
/* Hosts ring a focused thumb (Obsidian): only for keyboard focus here, not after a click. */
|
|
3698
|
+
.mn-play input[type='range']:focus:not(:focus-visible)::-webkit-slider-thumb {
|
|
3699
|
+
box-shadow: none;
|
|
3700
|
+
}
|
|
3701
|
+
|
|
3694
3702
|
.mn-play input[type='range']::-moz-range-track {
|
|
3695
3703
|
height: 3px;
|
|
3696
3704
|
border: none;
|
|
@@ -4277,5 +4285,5 @@ export {
|
|
|
4277
4285
|
voicingShape
|
|
4278
4286
|
};
|
|
4279
4287
|
|
|
4280
|
-
//# debugId=
|
|
4288
|
+
//# debugId=2791EC7C679EEE4064756E2164756E21
|
|
4281
4289
|
//# sourceMappingURL=index.js.map
|