@waveform-playlist/core 13.0.0-next.2 → 13.0.0-next.4
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.d.mts +42 -2
- package/dist/index.d.ts +42 -2
- package/dist/index.js +65 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +64 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -999,14 +999,17 @@ function keyBelongsToFocusedControl(event) {
|
|
|
999
999
|
if (ownsAllKeys(focused)) return true;
|
|
1000
1000
|
return activates(focused, event.key);
|
|
1001
1001
|
}
|
|
1002
|
+
var preventedByShortcut = /* @__PURE__ */ new WeakSet();
|
|
1002
1003
|
function handleKeyboardEvent(event, shortcuts, enabled) {
|
|
1003
1004
|
if (!enabled) return;
|
|
1004
1005
|
if (event.repeat) return;
|
|
1006
|
+
if (event.key === "Escape" && event.defaultPrevented && !preventedByShortcut.has(event)) return;
|
|
1005
1007
|
if (keyBelongsToFocusedControl(event)) return;
|
|
1006
1008
|
const matchingShortcut = shortcuts.find((shortcut) => matchesKeyBinding(event, shortcut));
|
|
1007
1009
|
if (matchingShortcut) {
|
|
1008
1010
|
if (matchingShortcut.preventDefault !== false) {
|
|
1009
1011
|
event.preventDefault();
|
|
1012
|
+
preventedByShortcut.add(event);
|
|
1010
1013
|
}
|
|
1011
1014
|
matchingShortcut.action();
|
|
1012
1015
|
}
|
|
@@ -1604,6 +1607,66 @@ function audioTrack(options) {
|
|
|
1604
1607
|
return track;
|
|
1605
1608
|
}
|
|
1606
1609
|
|
|
1610
|
+
// src/mixerGesture.ts
|
|
1611
|
+
var RANGE_KEYS = /* @__PURE__ */ new Set([
|
|
1612
|
+
"ArrowUp",
|
|
1613
|
+
"ArrowDown",
|
|
1614
|
+
"ArrowLeft",
|
|
1615
|
+
"ArrowRight",
|
|
1616
|
+
"PageUp",
|
|
1617
|
+
"PageDown",
|
|
1618
|
+
"Home",
|
|
1619
|
+
"End"
|
|
1620
|
+
]);
|
|
1621
|
+
var ID_PREFIX = Math.random().toString(36).slice(2, 10);
|
|
1622
|
+
var idCount = 0;
|
|
1623
|
+
function nextId() {
|
|
1624
|
+
idCount += 1;
|
|
1625
|
+
return `mg-${ID_PREFIX}-${idCount}`;
|
|
1626
|
+
}
|
|
1627
|
+
function createMixerGesture() {
|
|
1628
|
+
let id = nextId();
|
|
1629
|
+
const end = () => {
|
|
1630
|
+
id = nextId();
|
|
1631
|
+
};
|
|
1632
|
+
const attach = (input) => {
|
|
1633
|
+
let heldKey = null;
|
|
1634
|
+
const onKeyDown = (event) => {
|
|
1635
|
+
const { key } = event;
|
|
1636
|
+
if (RANGE_KEYS.has(key)) heldKey = key;
|
|
1637
|
+
};
|
|
1638
|
+
const onKeyUp = (event) => {
|
|
1639
|
+
if (event.key !== heldKey) return;
|
|
1640
|
+
heldKey = null;
|
|
1641
|
+
end();
|
|
1642
|
+
};
|
|
1643
|
+
const onChange = () => {
|
|
1644
|
+
if (heldKey === null) end();
|
|
1645
|
+
};
|
|
1646
|
+
const onBlur = () => {
|
|
1647
|
+
heldKey = null;
|
|
1648
|
+
end();
|
|
1649
|
+
};
|
|
1650
|
+
input.addEventListener("keydown", onKeyDown);
|
|
1651
|
+
input.addEventListener("keyup", onKeyUp);
|
|
1652
|
+
input.addEventListener("change", onChange);
|
|
1653
|
+
input.addEventListener("blur", onBlur);
|
|
1654
|
+
return () => {
|
|
1655
|
+
input.removeEventListener("keydown", onKeyDown);
|
|
1656
|
+
input.removeEventListener("keyup", onKeyUp);
|
|
1657
|
+
input.removeEventListener("change", onChange);
|
|
1658
|
+
input.removeEventListener("blur", onBlur);
|
|
1659
|
+
};
|
|
1660
|
+
};
|
|
1661
|
+
return {
|
|
1662
|
+
get id() {
|
|
1663
|
+
return id;
|
|
1664
|
+
},
|
|
1665
|
+
end,
|
|
1666
|
+
attach
|
|
1667
|
+
};
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1607
1670
|
// src/effects/registry.ts
|
|
1608
1671
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("@waveform-playlist/core/effect-registry/v1");
|
|
1609
1672
|
function registryState() {
|
|
@@ -1745,6 +1808,7 @@ export {
|
|
|
1745
1808
|
createClipFromSeconds,
|
|
1746
1809
|
createClipFromTicks,
|
|
1747
1810
|
createEffectInstance,
|
|
1811
|
+
createMixerGesture,
|
|
1748
1812
|
createPanStage,
|
|
1749
1813
|
createSourceLoader,
|
|
1750
1814
|
createTimeline,
|