diff --git a/packages/background/src/Background.vue b/packages/background/src/Background.vue index 9f42cfb1..e709d916 100644 --- a/packages/background/src/Background.vue +++ b/packages/background/src/Background.vue @@ -66,7 +66,6 @@ export default { width: `${width > 100 ? 100 : width}%`, }" > - ): Key }) } +/** + * Reactive key press state + * + * @param keyFilter - Can be a boolean, a string or an array of strings. If it's a boolean, it will always return that value. If it's a string, it will return true if the key is pressed. If it's an array of strings, it will return true if any of the keys are pressed, or a combination is pressed (e.g. ['ctrl+a', 'ctrl+b']) + * @param onChange - Callback function that will be called when the key state changes + */ export default (keyFilter: MaybeRef, onChange?: (keyPressed: boolean) => void): Ref => { const window = useWindow() @@ -42,7 +48,9 @@ export default (keyFilter: MaybeRef, onChange?: (keyPressed: b const pressedKeys = $ref>(new Set()) watch($$(isPressed), () => { - if (onChange && typeof onChange === 'function') onChange(isPressed) + if (onChange && typeof onChange === 'function') { + onChange(isPressed) + } }) watchEffect(() => { diff --git a/packages/core/src/utils/graph.ts b/packages/core/src/utils/graph.ts index 7c7dea6b..39555b5b 100644 --- a/packages/core/src/utils/graph.ts +++ b/packages/core/src/utils/graph.ts @@ -131,7 +131,7 @@ const getConnectedElements = (node: GraphNode, elements: Elements, dir: 'source' if (!isNode(node)) return [] const origin = dir === 'source' ? 'target' : 'source' const ids = elements.filter((e) => isEdge(e) && e[origin] === node.id).map((e) => isEdge(e) && e[dir]) - return elements.filter((e) => ids.includes(e.id)) + return elements.filter((e) => ids.includes(e.id)) as GraphEdge[] } export const getOutgoers = (node: GraphNode, elements: Elements) => getConnectedElements(node, elements, 'target')