feat: add scoped shortcuts

This commit is contained in:
Max Koon
2025-12-12 18:44:18 -05:00
parent 27f6e627d4
commit c6dd174376
13 changed files with 451 additions and 138 deletions

View File

@@ -1,6 +1,6 @@
import { useSyncExternalStore } from "react";
import { View, Text } from "react-native";
import { keysStore } from "./store";
import { keysStore, type ScopeKeys } from "./store";
export function ShortcutDebug() {
const entries = useSyncExternalStore(
@@ -19,14 +19,23 @@ export function ShortcutDebug() {
padding: 10,
}}
>
<Text style={{ color: "red", fontFamily: "mono" }}>Registered:</Text>
<Text style={{ color: "red", fontFamily: "mono", textAlign: "right" }}>
{entries
.values()
.map(([key, _]) => key)
.toArray()
.join(",")}
</Text>
<Text style={{ color: "red", fontFamily: "mono" }}>Scopes:</Text>
{entries.map(([scope, keys]) => (
<ScopeView key={scope} scope={scope} keys={keys} />
))}
</View>
);
}
function ScopeView({ scope, keys }: { scope: string; keys: ScopeKeys }) {
return (
<Text style={{ color: "red", fontFamily: "mono", textAlign: "right" }}>
{scope}:
{keys
.entries()
.map(([key, _]) => key)
.toArray()
.join(",")}
</Text>
);
}