@onjmin/dtm 0.1.75 → 0.1.77
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 +3 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +147 -116
- package/dist/index.mjs +147 -116
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4713,6 +4713,7 @@ var DAW_CSS = `
|
|
|
4713
4713
|
gap: 8px;
|
|
4714
4714
|
}
|
|
4715
4715
|
.dtm-player-seek {
|
|
4716
|
+
--fill: 0%;
|
|
4716
4717
|
flex: 1 1 auto;
|
|
4717
4718
|
min-width: 0;
|
|
4718
4719
|
height: 12px;
|
|
@@ -4723,9 +4724,14 @@ var DAW_CSS = `
|
|
|
4723
4724
|
appearance: none;
|
|
4724
4725
|
}
|
|
4725
4726
|
.dtm-player-seek:disabled { cursor: default; opacity: 0.4; }
|
|
4727
|
+
/* \u518D\u751F\u6E08\u307F\u533A\u9593\u3092YouTube\u98A8\u306B\u8272\u5857\u308A\u3059\u308B\uFF08--fill \u306F\u518D\u751F\u4F4D\u7F6E\u306B\u5FDC\u3058\u3066JS\u304B\u3089\u8A2D\u5B9A\uFF09 */
|
|
4726
4728
|
.dtm-player-seek::-webkit-slider-runnable-track {
|
|
4727
4729
|
height: 6px;
|
|
4728
|
-
background:
|
|
4730
|
+
background: linear-gradient(
|
|
4731
|
+
to right,
|
|
4732
|
+
var(--dtm-primary) var(--fill),
|
|
4733
|
+
var(--dtm-border2) var(--fill)
|
|
4734
|
+
);
|
|
4729
4735
|
border: 2px solid var(--c-black);
|
|
4730
4736
|
}
|
|
4731
4737
|
.dtm-player-seek::-moz-range-track {
|
|
@@ -4733,6 +4739,12 @@ var DAW_CSS = `
|
|
|
4733
4739
|
background: var(--dtm-border2);
|
|
4734
4740
|
border: 2px solid var(--c-black);
|
|
4735
4741
|
}
|
|
4742
|
+
.dtm-player-seek::-moz-range-progress {
|
|
4743
|
+
height: 6px;
|
|
4744
|
+
background: var(--dtm-primary);
|
|
4745
|
+
border: 2px solid var(--c-black);
|
|
4746
|
+
border-right: none;
|
|
4747
|
+
}
|
|
4736
4748
|
.dtm-player-seek::-webkit-slider-thumb {
|
|
4737
4749
|
-webkit-appearance: none;
|
|
4738
4750
|
width: 12px;
|
|
@@ -5030,18 +5042,19 @@ var DAW_CSS = `
|
|
|
5030
5042
|
}
|
|
5031
5043
|
|
|
5032
5044
|
/* \u2500\u2500\u2500 \u30B3\u30FC\u30C9\u9032\u884C\u30D7\u30EC\u30A4\u30E4\u30FC \u2500\u2500\u2500 */
|
|
5045
|
+
/* MML\u518D\u751F\u5C02\u7528\u30D7\u30EC\u30A4\u30E4\u30FC\uFF08.dtm-player\uFF09\u3068\u67A0\u30C7\u30B6\u30A4\u30F3\u3092\u63C3\u3048\u308B */
|
|
5033
5046
|
.dtm-chord-player {
|
|
5047
|
+
display: flex;
|
|
5048
|
+
flex-direction: column;
|
|
5049
|
+
gap: var(--dtm-gap);
|
|
5050
|
+
padding: var(--dtm-gap);
|
|
5034
5051
|
font-family: var(--dtm-font);
|
|
5035
5052
|
font-size: 13px;
|
|
5036
5053
|
letter-spacing: .06em;
|
|
5037
5054
|
color: var(--dtm-text);
|
|
5038
|
-
background: var(--dtm-
|
|
5039
|
-
border: 2px solid var(--
|
|
5040
|
-
box-shadow:
|
|
5041
|
-
inset 0 0 0 2px var(--c-black),
|
|
5042
|
-
0 0 0 2px var(--dtm-border),
|
|
5043
|
-
4px 4px 0 var(--c-black);
|
|
5044
|
-
overflow: hidden;
|
|
5055
|
+
background: var(--dtm-deep);
|
|
5056
|
+
border: 2px solid var(--dtm-border2);
|
|
5057
|
+
box-shadow: 4px 4px 0 var(--c-black);
|
|
5045
5058
|
image-rendering: pixelated;
|
|
5046
5059
|
-webkit-font-smoothing: none;
|
|
5047
5060
|
}
|
|
@@ -5049,14 +5062,12 @@ var DAW_CSS = `
|
|
|
5049
5062
|
.dtm-chord-player *::before,
|
|
5050
5063
|
.dtm-chord-player *::after { box-sizing: border-box; }
|
|
5051
5064
|
|
|
5052
|
-
/* \u30B3\u30F3\u30C8\u30ED\u30FC\u30EB\u30D0\u30FC */
|
|
5065
|
+
/* \u30B3\u30F3\u30C8\u30ED\u30FC\u30EB\u30D0\u30FC \u2014 MML\u518D\u751F\u5C02\u7528\u30D7\u30EC\u30A4\u30E4\u30FC\u306E .dtm-player-head \u3068\u63C3\u3048\u308B */
|
|
5053
5066
|
.dtm-cp-ctrl {
|
|
5054
5067
|
display: flex;
|
|
5055
5068
|
align-items: center;
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
background: var(--dtm-deep);
|
|
5059
|
-
border-bottom: 2px solid var(--c-black);
|
|
5069
|
+
flex-wrap: wrap;
|
|
5070
|
+
gap: 8px;
|
|
5060
5071
|
}
|
|
5061
5072
|
|
|
5062
5073
|
/* \u30EB\u30FC\u30D7\u5207\u66FF\u30DC\u30BF\u30F3 */
|
|
@@ -5081,38 +5092,13 @@ var DAW_CSS = `
|
|
|
5081
5092
|
box-shadow: 2px 2px 0 var(--c-black);
|
|
5082
5093
|
}
|
|
5083
5094
|
|
|
5084
|
-
/* \u30E1\u30BF\u60C5\u5831 (BPM
|
|
5095
|
+
/* \u30E1\u30BF\u60C5\u5831 (BPM) */
|
|
5085
5096
|
.dtm-cp-meta {
|
|
5086
5097
|
font-size: 11px;
|
|
5087
5098
|
text-transform: uppercase;
|
|
5088
5099
|
letter-spacing: .12em;
|
|
5089
5100
|
color: var(--dtm-muted);
|
|
5090
5101
|
}
|
|
5091
|
-
.dtm-cp-time {
|
|
5092
|
-
margin-left: auto;
|
|
5093
|
-
font-size: 11px;
|
|
5094
|
-
font-family: var(--dtm-font);
|
|
5095
|
-
color: var(--dtm-muted);
|
|
5096
|
-
letter-spacing: .1em;
|
|
5097
|
-
}
|
|
5098
|
-
|
|
5099
|
-
/* \u30D7\u30ED\u30B0\u30EC\u30B9\u30D0\u30FC \u2014 \u30C9\u30C3\u30C8\u7D75\u98A8\u306E\u30BB\u30B0\u30E1\u30F3\u30C8\u5857\u308A\u3002\u30AF\u30EA\u30C3\u30AF\u3067\u30B7\u30FC\u30AF */
|
|
5100
|
-
.dtm-cp-progress {
|
|
5101
|
-
height: 14px;
|
|
5102
|
-
background: var(--dtm-deep);
|
|
5103
|
-
border-bottom: 2px solid var(--c-black);
|
|
5104
|
-
cursor: pointer;
|
|
5105
|
-
}
|
|
5106
|
-
.dtm-cp-progress-fill {
|
|
5107
|
-
height: 100%;
|
|
5108
|
-
width: 0%;
|
|
5109
|
-
background: repeating-linear-gradient(
|
|
5110
|
-
90deg,
|
|
5111
|
-
var(--dtm-primary) 0, var(--dtm-primary) 6px,
|
|
5112
|
-
var(--c-navy) 6px, var(--c-navy) 8px
|
|
5113
|
-
);
|
|
5114
|
-
}
|
|
5115
|
-
.dtm-cp-progress-fill--on { border-right: 2px solid var(--c-white); }
|
|
5116
5102
|
|
|
5117
5103
|
/* \u30B9\u30AF\u30ED\u30FC\u30EB\u30A8\u30EA\u30A2 */
|
|
5118
5104
|
.dtm-cp-scroll {
|
|
@@ -6050,6 +6036,12 @@ var mountMmlPlayer = (target, mml, options = {}) => {
|
|
|
6050
6036
|
timeEl.textContent = "0:00 / 0:00";
|
|
6051
6037
|
seekRow.append(seekInput, timeEl);
|
|
6052
6038
|
root.appendChild(seekRow);
|
|
6039
|
+
const syncSeekFill = () => {
|
|
6040
|
+
const max = Number(seekInput.max) || 1;
|
|
6041
|
+
const pct = Number(seekInput.value) / max * 100;
|
|
6042
|
+
seekInput.style.setProperty("--fill", `${pct}%`);
|
|
6043
|
+
};
|
|
6044
|
+
syncSeekFill();
|
|
6053
6045
|
const formatTime = (step) => {
|
|
6054
6046
|
const totalSec = Math.max(0, step * secondsPerStep);
|
|
6055
6047
|
const m = Math.floor(totalSec / 60);
|
|
@@ -6286,6 +6278,7 @@ var mountMmlPlayer = (target, mml, options = {}) => {
|
|
|
6286
6278
|
if (!isSeeking) {
|
|
6287
6279
|
seekInput.value = String(Math.min(maxStep, Math.max(0, intStep)));
|
|
6288
6280
|
updateTimeLabel(intStep);
|
|
6281
|
+
syncSeekFill();
|
|
6289
6282
|
}
|
|
6290
6283
|
const chordName = stepChords[intStep] ?? "";
|
|
6291
6284
|
if (chordEl.textContent !== chordName) {
|
|
@@ -6313,6 +6306,7 @@ var mountMmlPlayer = (target, mml, options = {}) => {
|
|
|
6313
6306
|
chordEl.textContent = "";
|
|
6314
6307
|
seekInput.value = "0";
|
|
6315
6308
|
updateTimeLabel(0);
|
|
6309
|
+
syncSeekFill();
|
|
6316
6310
|
for (const view of laneViews) {
|
|
6317
6311
|
for (const t of view.tokens) t.el.classList.remove("is-active");
|
|
6318
6312
|
view.lane.scrollLeft = 0;
|
|
@@ -6503,6 +6497,7 @@ var mountMmlPlayer = (target, mml, options = {}) => {
|
|
|
6503
6497
|
});
|
|
6504
6498
|
seekInput.addEventListener("input", () => {
|
|
6505
6499
|
renderPlayhead(Number(seekInput.value));
|
|
6500
|
+
syncSeekFill();
|
|
6506
6501
|
});
|
|
6507
6502
|
seekInput.addEventListener("change", () => {
|
|
6508
6503
|
isSeeking = false;
|
|
@@ -6863,6 +6858,13 @@ var parseToneMeta = (chords) => {
|
|
|
6863
6858
|
var parseMetronomeMeta = (chords) => {
|
|
6864
6859
|
return !/^#\s*metronome\s*=\s*off\s*$/im.test(chords);
|
|
6865
6860
|
};
|
|
6861
|
+
var parseBpmMeta = (chords) => {
|
|
6862
|
+
const m = chords.match(/^#\s*bpm\s*=\s*(\d+)\s*$/im);
|
|
6863
|
+
if (!m) return null;
|
|
6864
|
+
const val = Number.parseInt(m[1], 10);
|
|
6865
|
+
if (Number.isNaN(val)) return null;
|
|
6866
|
+
return Math.max(40, Math.min(240, val));
|
|
6867
|
+
};
|
|
6866
6868
|
var _nameToKeyCache = null;
|
|
6867
6869
|
var getNameToKey = async () => {
|
|
6868
6870
|
if (!_nameToKeyCache) _nameToKeyCache = await buildNameToKeyMapping();
|
|
@@ -7025,8 +7027,9 @@ var buildDisplayLines = (chords, eventsCount) => {
|
|
|
7025
7027
|
var mountChordPlayer = (target, chords, options = {}) => {
|
|
7026
7028
|
const doc = target.ownerDocument;
|
|
7027
7029
|
injectStyles(doc);
|
|
7028
|
-
let bpm = options.bpm ?? 120;
|
|
7030
|
+
let bpm = options.bpm ?? parseBpmMeta(chords) ?? 120;
|
|
7029
7031
|
let activeIndex = -1;
|
|
7032
|
+
let isSeeking = false;
|
|
7030
7033
|
let activePlayback = null;
|
|
7031
7034
|
let isPlaying = false;
|
|
7032
7035
|
let masterVolume = options.volume ?? 80;
|
|
@@ -7083,8 +7086,8 @@ var mountChordPlayer = (target, chords, options = {}) => {
|
|
|
7083
7086
|
const setPlayBtnStyle = (playing) => {
|
|
7084
7087
|
if (playing) {
|
|
7085
7088
|
playBtn.classList.add("dtm-play--stop");
|
|
7086
|
-
playBtn.innerHTML = icon("
|
|
7087
|
-
playBtn.title = "
|
|
7089
|
+
playBtn.innerHTML = icon("pause", 14);
|
|
7090
|
+
playBtn.title = "PAUSE";
|
|
7088
7091
|
} else {
|
|
7089
7092
|
playBtn.classList.remove("dtm-play--stop");
|
|
7090
7093
|
playBtn.innerHTML = icon("play", 14);
|
|
@@ -7161,17 +7164,9 @@ var mountChordPlayer = (target, chords, options = {}) => {
|
|
|
7161
7164
|
{ key: "guitar", label: "Guitar", emoji: "\u{1F3B8}" },
|
|
7162
7165
|
{ key: "strings", label: "Strings", emoji: "\u{1F3BB}" }
|
|
7163
7166
|
];
|
|
7164
|
-
const instrGroup = doc.createElement("
|
|
7165
|
-
instrGroup.className = "dtm-cp-instr-
|
|
7166
|
-
|
|
7167
|
-
const updateInstrButtons = () => {
|
|
7168
|
-
for (const { key } of INSTRUMENT_DEFS) {
|
|
7169
|
-
instrBtns.get(key)?.classList.toggle(
|
|
7170
|
-
"dtm-cp-instr-btn--active",
|
|
7171
|
-
key === activeInstrumentKey
|
|
7172
|
-
);
|
|
7173
|
-
}
|
|
7174
|
-
};
|
|
7167
|
+
const instrGroup = doc.createElement("select");
|
|
7168
|
+
instrGroup.className = "dtm-cp-instr-select";
|
|
7169
|
+
instrGroup.title = "\u697D\u5668";
|
|
7175
7170
|
const switchInstrument = (key) => {
|
|
7176
7171
|
if (activeInstrumentKey === key) return;
|
|
7177
7172
|
activeInstrumentKey = key;
|
|
@@ -7182,34 +7177,61 @@ var mountChordPlayer = (target, chords, options = {}) => {
|
|
|
7182
7177
|
if (ctx) loadWafFont(ctx, activeGmName);
|
|
7183
7178
|
}
|
|
7184
7179
|
};
|
|
7185
|
-
|
|
7186
|
-
|
|
7187
|
-
|
|
7188
|
-
|
|
7189
|
-
|
|
7190
|
-
|
|
7191
|
-
|
|
7192
|
-
instrGroup.appendChild(
|
|
7193
|
-
instrBtns.set(key, btn);
|
|
7180
|
+
const updateInstrButtons = () => {
|
|
7181
|
+
instrGroup.value = activeInstrumentKey;
|
|
7182
|
+
};
|
|
7183
|
+
for (const { key, label } of INSTRUMENT_DEFS) {
|
|
7184
|
+
const opt = doc.createElement("option");
|
|
7185
|
+
opt.value = key;
|
|
7186
|
+
opt.textContent = label;
|
|
7187
|
+
instrGroup.appendChild(opt);
|
|
7194
7188
|
}
|
|
7189
|
+
instrGroup.addEventListener("change", () => {
|
|
7190
|
+
const key = instrGroup.value;
|
|
7191
|
+
switchInstrument(key);
|
|
7192
|
+
});
|
|
7195
7193
|
updateInstrButtons();
|
|
7196
|
-
|
|
7197
|
-
|
|
7194
|
+
ctrlBar.appendChild(playBtn);
|
|
7195
|
+
ctrlBar.appendChild(loopBtn);
|
|
7196
|
+
ctrlBar.appendChild(metroBtn);
|
|
7197
|
+
ctrlBar.appendChild(bpmGroup);
|
|
7198
|
+
ctrlBar.appendChild(instrGroup);
|
|
7199
|
+
const seekRow = doc.createElement("div");
|
|
7200
|
+
seekRow.className = "dtm-player-seek-row";
|
|
7201
|
+
const seekInput = doc.createElement("input");
|
|
7202
|
+
seekInput.type = "range";
|
|
7203
|
+
seekInput.className = "dtm-player-seek";
|
|
7204
|
+
seekInput.min = "0";
|
|
7205
|
+
seekInput.max = String(Math.max(0.01, totalSec));
|
|
7206
|
+
seekInput.step = "0.01";
|
|
7207
|
+
seekInput.value = "0";
|
|
7208
|
+
seekInput.disabled = chordEvents.length === 0;
|
|
7209
|
+
const timeEl = doc.createElement("span");
|
|
7210
|
+
timeEl.className = "dtm-player-time";
|
|
7211
|
+
timeEl.textContent = "0:00 / 0:00";
|
|
7212
|
+
seekRow.append(seekInput, timeEl);
|
|
7198
7213
|
const formatTime = (sec) => {
|
|
7199
7214
|
const m = Math.floor(sec / 60);
|
|
7200
7215
|
const s = Math.floor(sec % 60);
|
|
7201
7216
|
return `${String(m).padStart(2, "0")}:${String(s).padStart(2, "0")}`;
|
|
7202
7217
|
};
|
|
7203
7218
|
const updateTimeDisplay = (currentSec) => {
|
|
7204
|
-
|
|
7219
|
+
timeEl.textContent = `${formatTime(currentSec)} / ${formatTime(totalSec)}`;
|
|
7205
7220
|
};
|
|
7206
7221
|
updateTimeDisplay(0);
|
|
7207
|
-
|
|
7208
|
-
|
|
7209
|
-
|
|
7210
|
-
|
|
7211
|
-
|
|
7212
|
-
|
|
7222
|
+
const syncSeekFill = () => {
|
|
7223
|
+
const max = Number(seekInput.max) || 1;
|
|
7224
|
+
const pct = Number(seekInput.value) / max * 100;
|
|
7225
|
+
seekInput.style.setProperty("--fill", `${pct}%`);
|
|
7226
|
+
};
|
|
7227
|
+
syncSeekFill();
|
|
7228
|
+
const updateSeekUI = (sec) => {
|
|
7229
|
+
updateTimeDisplay(sec);
|
|
7230
|
+
if (!isSeeking) {
|
|
7231
|
+
seekInput.value = String(Math.max(0, Math.min(totalSec, sec)));
|
|
7232
|
+
syncSeekFill();
|
|
7233
|
+
}
|
|
7234
|
+
};
|
|
7213
7235
|
const menuContainer = doc.createElement("div");
|
|
7214
7236
|
menuContainer.className = "dtm-player-more-container";
|
|
7215
7237
|
const moreBtn = doc.createElement("button");
|
|
@@ -7241,6 +7263,7 @@ var mountChordPlayer = (target, chords, options = {}) => {
|
|
|
7241
7263
|
menuContainer.appendChild(menuDropdown);
|
|
7242
7264
|
ctrlBar.appendChild(menuContainer);
|
|
7243
7265
|
container.appendChild(ctrlBar);
|
|
7266
|
+
container.appendChild(seekRow);
|
|
7244
7267
|
const toggleMenu = (show) => {
|
|
7245
7268
|
const visible = show !== void 0 ? show : menuDropdown.style.display === "none";
|
|
7246
7269
|
menuDropdown.style.display = visible ? "flex" : "none";
|
|
@@ -7488,7 +7511,9 @@ var mountChordPlayer = (target, chords, options = {}) => {
|
|
|
7488
7511
|
secondsPerBeat = 60 / bpm;
|
|
7489
7512
|
totalSec = chordEvents.length > 0 ? chordEvents[chordEvents.length - 1].when + chordEvents[chordEvents.length - 1].duration : 0;
|
|
7490
7513
|
bpmInput.value = String(bpm);
|
|
7491
|
-
|
|
7514
|
+
seekInput.max = String(Math.max(0.01, totalSec));
|
|
7515
|
+
seekInput.disabled = chordEvents.length === 0;
|
|
7516
|
+
updateSeekUI(isPlaying ? playOffsetSec : 0);
|
|
7492
7517
|
if (isPlaying) seekTo(Math.max(0, activeIndex));
|
|
7493
7518
|
};
|
|
7494
7519
|
const changeBpm = (delta) => {
|
|
@@ -7535,18 +7560,6 @@ var mountChordPlayer = (target, chords, options = {}) => {
|
|
|
7535
7560
|
if (gmName) loadWafFont(ctx, gmName);
|
|
7536
7561
|
}
|
|
7537
7562
|
};
|
|
7538
|
-
const progress = doc.createElement("div");
|
|
7539
|
-
progress.className = "dtm-cp-progress";
|
|
7540
|
-
progress.title = "\u30AF\u30EA\u30C3\u30AF\u3067\u30B7\u30FC\u30AF";
|
|
7541
|
-
const progressFill = doc.createElement("div");
|
|
7542
|
-
progressFill.className = "dtm-cp-progress-fill";
|
|
7543
|
-
progress.appendChild(progressFill);
|
|
7544
|
-
container.appendChild(progress);
|
|
7545
|
-
const setProgress = (ratio) => {
|
|
7546
|
-
const clamped = Math.max(0, Math.min(1, ratio));
|
|
7547
|
-
progressFill.style.width = `${clamped * 100}%`;
|
|
7548
|
-
progressFill.classList.toggle("dtm-cp-progress-fill--on", clamped > 0);
|
|
7549
|
-
};
|
|
7550
7563
|
const scrollArea = doc.createElement("div");
|
|
7551
7564
|
scrollArea.className = "dtm-cp-scroll";
|
|
7552
7565
|
const chordSpans = [];
|
|
@@ -7780,8 +7793,7 @@ var mountChordPlayer = (target, chords, options = {}) => {
|
|
|
7780
7793
|
const currentSec = playOffsetSec + rel;
|
|
7781
7794
|
currentPlaySec = currentSec;
|
|
7782
7795
|
updateActiveIndex(getActiveIndexBySec(currentSec));
|
|
7783
|
-
|
|
7784
|
-
setProgress(totalSec > 0 ? currentSec / totalSec : 0);
|
|
7796
|
+
updateSeekUI(Math.min(currentSec, totalSec));
|
|
7785
7797
|
},
|
|
7786
7798
|
onStop: () => {
|
|
7787
7799
|
handlePlaybackStop();
|
|
@@ -7805,8 +7817,7 @@ var mountChordPlayer = (target, chords, options = {}) => {
|
|
|
7805
7817
|
isPlaying = true;
|
|
7806
7818
|
setPlayBtnStyle(true);
|
|
7807
7819
|
updateActiveIndex(startIdx);
|
|
7808
|
-
|
|
7809
|
-
setProgress(totalSec > 0 ? playOffsetSec / totalSec : 0);
|
|
7820
|
+
updateSeekUI(playOffsetSec);
|
|
7810
7821
|
playInternal(startIdx, ctx, cutGain);
|
|
7811
7822
|
};
|
|
7812
7823
|
const myAbortId = ++loadAbortId;
|
|
@@ -7833,13 +7844,19 @@ var mountChordPlayer = (target, chords, options = {}) => {
|
|
|
7833
7844
|
}
|
|
7834
7845
|
play(idx);
|
|
7835
7846
|
};
|
|
7836
|
-
|
|
7847
|
+
seekInput.addEventListener("pointerdown", () => {
|
|
7848
|
+
isSeeking = true;
|
|
7849
|
+
});
|
|
7850
|
+
seekInput.addEventListener("input", () => {
|
|
7851
|
+
updateTimeDisplay(Number(seekInput.value));
|
|
7852
|
+
syncSeekFill();
|
|
7853
|
+
});
|
|
7854
|
+
seekInput.addEventListener("change", () => {
|
|
7855
|
+
isSeeking = false;
|
|
7837
7856
|
if (totalSec <= 0) return;
|
|
7838
|
-
const
|
|
7839
|
-
if (rect.width <= 0) return;
|
|
7840
|
-
const sec = (ev.clientX - rect.left) / rect.width * totalSec;
|
|
7857
|
+
const sec = Number(seekInput.value);
|
|
7841
7858
|
const idx = getActiveIndexBySec(sec);
|
|
7842
|
-
seekTo(idx >= 0 ? idx : 0);
|
|
7859
|
+
seekTo(idx >= 0 ? idx : Math.max(0, chordEvents.length - 1));
|
|
7843
7860
|
});
|
|
7844
7861
|
const stop = () => {
|
|
7845
7862
|
if (isLoading) {
|
|
@@ -7859,15 +7876,30 @@ var mountChordPlayer = (target, chords, options = {}) => {
|
|
|
7859
7876
|
isPlaying = false;
|
|
7860
7877
|
setPlayBtnStyle(false);
|
|
7861
7878
|
updateActiveIndex(-1);
|
|
7862
|
-
|
|
7863
|
-
|
|
7879
|
+
updateSeekUI(0);
|
|
7880
|
+
options.onStop?.();
|
|
7881
|
+
};
|
|
7882
|
+
const pause = () => {
|
|
7883
|
+
if (isLoading) {
|
|
7884
|
+
++loadAbortId;
|
|
7885
|
+
setLoadingUI(false);
|
|
7886
|
+
killSound();
|
|
7887
|
+
return;
|
|
7888
|
+
}
|
|
7889
|
+
if (!isPlaying) return;
|
|
7890
|
+
activePlayback?.destroy();
|
|
7891
|
+
activePlayback = null;
|
|
7892
|
+
stopMetronome();
|
|
7893
|
+
killSound();
|
|
7894
|
+
isPlaying = false;
|
|
7895
|
+
setPlayBtnStyle(false);
|
|
7864
7896
|
options.onStop?.();
|
|
7865
7897
|
};
|
|
7866
7898
|
playBtn.addEventListener("click", () => {
|
|
7867
7899
|
if (isPlaying) {
|
|
7868
|
-
|
|
7900
|
+
pause();
|
|
7869
7901
|
} else {
|
|
7870
|
-
play();
|
|
7902
|
+
play(Math.max(0, activeIndex));
|
|
7871
7903
|
}
|
|
7872
7904
|
});
|
|
7873
7905
|
const toggleMetronome = () => {
|
|
@@ -7929,32 +7961,31 @@ var mountChordPlayer = (target, chords, options = {}) => {
|
|
|
7929
7961
|
animation: dtm-cp-spin 0.7s linear infinite;
|
|
7930
7962
|
vertical-align: middle;
|
|
7931
7963
|
}
|
|
7932
|
-
/* \
|
|
7933
|
-
.dtm-cp-
|
|
7934
|
-
|
|
7935
|
-
|
|
7936
|
-
border: 1px solid rgba(255,255,255,0.15);
|
|
7937
|
-
border-radius: 4px;
|
|
7938
|
-
overflow: hidden;
|
|
7964
|
+
/* \u30B3\u30FC\u30C9\u9032\u884C\u30D7\u30EC\u30A4\u30E4\u30FC\u306EPLAY\u30DC\u30BF\u30F3\u306F\u901A\u5E38\u306EDAW\u3088\u308A\u5C0F\u3055\u3081\u3067\u3088\u3044 */
|
|
7965
|
+
.dtm-cp-ctrl .dtm-play {
|
|
7966
|
+
width: 24px;
|
|
7967
|
+
height: 24px;
|
|
7939
7968
|
}
|
|
7940
|
-
|
|
7969
|
+
/* \u697D\u5668\u9078\u629E\u30D7\u30EB\u30C0\u30A6\u30F3\uFF08\u7701\u30B9\u30DA\u30FC\u30B9\u3067\u30B9\u30DE\u30DB\u3067\u3082\u96A0\u308C\u306A\u3044\uFF09 */
|
|
7970
|
+
.dtm-cp-instr-select {
|
|
7941
7971
|
background: rgba(255,255,255,0.06);
|
|
7942
|
-
border:
|
|
7943
|
-
|
|
7972
|
+
border: 1px solid rgba(255,255,255,0.15);
|
|
7973
|
+
border-radius: 4px;
|
|
7974
|
+
color: rgba(255,255,255,0.85);
|
|
7944
7975
|
font-size: 11px;
|
|
7945
|
-
|
|
7976
|
+
font-family: inherit;
|
|
7977
|
+
padding: 2px 4px;
|
|
7946
7978
|
cursor: pointer;
|
|
7947
|
-
|
|
7948
|
-
|
|
7979
|
+
max-width: 62px;
|
|
7980
|
+
flex-shrink: 1;
|
|
7981
|
+
min-width: 0;
|
|
7949
7982
|
}
|
|
7950
|
-
.dtm-cp-instr-
|
|
7983
|
+
.dtm-cp-instr-select:hover {
|
|
7951
7984
|
background: rgba(255,255,255,0.14);
|
|
7952
|
-
color: rgba(255,255,255,0.85);
|
|
7953
7985
|
}
|
|
7954
|
-
.dtm-cp-instr-
|
|
7955
|
-
background:
|
|
7956
|
-
color: #
|
|
7957
|
-
font-weight: bold;
|
|
7986
|
+
.dtm-cp-instr-select option {
|
|
7987
|
+
background: #1a1a2e;
|
|
7988
|
+
color: #fff;
|
|
7958
7989
|
}
|
|
7959
7990
|
/* BPM widget styles */
|
|
7960
7991
|
.dtm-cp-bpm-group {
|
package/package.json
CHANGED