Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
feat: hotkey debugger (#3403)
Eric Hayesd83ab8627dc3
diff --git a/js/app/package.json b/js/app/package.jsonindex 63af494566..640b241947 100644--- a/js/app/package.json+++ b/js/app/package.json@@ -10,7 +10,8 @@"local:e2e:ui": "LOCAL_E2E=true bunx playwright test --ui","gen-api": "bun scripts/generate-api-schema.ts","gen-tools": "bun scripts/generate-dcs-tools.ts",- "check": "tsc --noEmit --skipLibCheck --project packages/app/tsconfig.json",+ "type-check": "tsc --noEmit --skipLibCheck --project packages/app/tsconfig.json",+ "check": "bun type-check && bun biome check","preview": "cd packages/app && bun run --bun preview:dev","lint": "bunx --bun biome lint --skip=suspicious/noImportCycles","format": "bunx --bun biome format --write",diff --git a/js/app/packages/app/component/Layout.tsx b/js/app/packages/app/component/Layout.tsxindex f3d7772b59..ac954a9274 100644--- a/js/app/packages/app/component/Layout.tsx+++ b/js/app/packages/app/component/Layout.tsx@@ -17,6 +17,7 @@ import { updateCookie } from '@core/util/cookies';import { makePersisted } from '@solid-primitives/storage';import { type RouteSectionProps, useLocation } from '@solidjs/router';import { cn, Layer } from '@ui';+import { ScreencastHotkeys } from '@ui/components/ScreencastHotkeys';import { attachGlobalDOMScope } from 'core/hotkey/hotkeys';import {createEffect,@@ -212,6 +213,7 @@ function LayoutInner(props: RouteSectionProps) {</Show></Suspense><DevStatusBar />+ <ScreencastHotkeys /></div>);}diff --git a/js/app/packages/app/component/settings/Appearance.tsx b/js/app/packages/app/component/settings/Appearance.tsxindex 7b0258df48..067a95cdcf 100644--- a/js/app/packages/app/component/settings/Appearance.tsx+++ b/js/app/packages/app/component/settings/Appearance.tsx@@ -29,6 +29,7 @@ function UserInterface() {checked={tooltipsEnabled()}/></div>+</div>);}diff --git a/js/app/packages/app/component/settings/Shortcuts.tsx b/js/app/packages/app/component/settings/Shortcuts.tsxindex bfe61a72ea..52e56dd222 100644--- a/js/app/packages/app/component/settings/Shortcuts.tsx+++ b/js/app/packages/app/component/settings/Shortcuts.tsx@@ -1,6 +1,7 @@import { createSignal, For, Index, createMemo, type JSX } from 'solid-js';import { IS_MAC } from '@core/constant/isMac';-import { Hotkey } from '@ui';+import { enableScreencastHotkeys, setEnableScreencastHotkeys } from '@ui/components/ScreencastHotkeys';+import { Hotkey, ToggleSwitch } from '@ui';import { Panel } from '@ui';import { cn } from '@ui';@@ -285,6 +286,13 @@ function ShortcutsContent() {<><Panel.Header class="px-6"><div class="text-sm font-semibold">Keyboard Shortcuts</div>+ <div class="flex items-center gap-2 ml-auto">+ <span class="text-sm text-ink-muted">Screencast Keys</span>+ <ToggleSwitch+ onChange={setEnableScreencastHotkeys}+ checked={enableScreencastHotkeys()}+ />+ </div></Panel.Header><Panel.Toolbar class="h-full px-6 py-2">diff --git a/js/app/packages/ui/components/ScreencastHotkeys.tsx b/js/app/packages/ui/components/ScreencastHotkeys.tsxnew file mode 100644index 0000000000..b0b49ab0d9--- /dev/null+++ b/js/app/packages/ui/components/ScreencastHotkeys.tsx@@ -0,0 +1,84 @@+import { useSubscribeToKeypress } from "@app/signal/hotkeyRoot";+import { makePersisted } from "@solid-primitives/storage";+import { createSignal, For, Show } from "solid-js";+import { Portal } from "solid-js/web";+import { Hotkey } from "./Hotkey";++export const [enableScreencastHotkeys, setEnableScreencastHotkeys] =+ makePersisted(createSignal(false), { name: "enableHotkeyScreencast" });++type ScreencastEntry = {+ id: number;+ shortcut: string;+ label?: string;+ count: number;+ timeout: number;+};++let entryId = 0;+const ENTRY_TTL = 3000;++export function ScreencastHotkeys() {+ const [entries, setEntries] = createSignal<ScreencastEntry[]>([]);++ useSubscribeToKeypress((ctx) => {+ if (ctx.eventType !== "keydown" || !ctx.isNonModifierKeypress) return;+ if (!ctx.commandCaptured && !ctx.pressedKeys.has("cmd")) return;+ const cmd = ctx.commandCaptured;+ const shortcut = cmd?.hotkeys?.[0] ?? ctx.pressedKeysString;+ const label = cmd+ ? typeof cmd.description === "function"+ ? cmd.description()+ : cmd.description+ : undefined;++ setEntries((prev) => {+ const last = prev[prev.length - 1];+ if (last && last.shortcut === shortcut) {+ window.clearTimeout(last.timeout);+ const updated = {+ ...last,+ count: last.count + 1,+ timeout: window.setTimeout(() => {+ setEntries((p) => p.filter((e) => e.id !== last.id));+ }, ENTRY_TTL),+ };+ return [...prev.slice(0, -1), updated];+ }+ const id = entryId++;+ const timeout = window.setTimeout(() => {+ setEntries((p) => p.filter((e) => e.id !== id));+ }, ENTRY_TTL);+ const next = [...prev, { id, shortcut, label, count: 1, timeout }];+ if (next.length > 5) {+ const oldest = next[0];++ window.clearTimeout(oldest.timeout);+ return next.slice(-5);+ }+ return next;+ });+ });++ return (+ <Show when={enableScreencastHotkeys() && entries().length > 0}>+ <Portal>+ <div class="fixed left-3 bottom-3 z-2147483647 flex flex-col gap-1 pointer-events-none text-xs">+ <For each={entries()}>+ {(entry) => (+ <div class="flex items-center gap-2 bg-surface p-1 border border-edge rounded-md">+ <Hotkey shortcut={entry.shortcut} theme="accent" />+ <Show when={entry.count > 1}>+ <span class="text-xs font-medium text-accent">+ x{entry.count}+ </span>+ </Show>+ <span class="text-xs text-ink-muted">{entry.label}</span>+ </div>+ )}+ </For>+ </div>+ </Portal>+ </Show>+ );+}diff --git a/js/package.json b/js/package.jsonindex 09f0069c1e..da01317424 100644--- a/js/package.json+++ b/js/package.json@@ -1,45 +1,45 @@{- "name": "@coparse/js",- "private": true,- "workspaces": [- "app",- "app/packages/*",- "app/infra/*",- "loro-mirror",- "lexical-core",- "lexical-service"- ],- "packageManager": "[email protected]",- "scripts": {- "fix": "cd app && bunx --bun @biomejs/biome check --write",- "lint:ci": "cd app && bunx --bun @biomejs/biome ci --changed --no-errors-on-unmatched --error-on-warnings",- "check": "cd app && tsc --noEmit --skipLibCheck --project packages/app/tsconfig.json",- "lint": "cd app && bunx --bun @biomejs/biome lint --skip=suspicious/noImportCycles",- "format": "cd app && bunx --bun @biomejs/biome format --write"- },- "trustedDependencies": [- "@pulumi/aws-native",- "@pulumi/awsx",- "@pulumi/command",- "@pulumi/synced-folder",- "aws-sdk",- "docker-classic",- "esbuild"- ],- "patchedDependencies": {- "[email protected]": "app/patches/[email protected]",- "@thisbeyond/[email protected]": "app/patches/@thisbeyond%[email protected]",- "@lexical/[email protected]": "app/patches/@lexical%[email protected]",- "@kobalte/[email protected]": "app/patches/@kobalte%[email protected]",- "[email protected]": "app/patches/[email protected]",- "@tanstack/[email protected]": "app/patches/@tanstack%[email protected]"- },- "overrides": {- "cross-spawn": "7.0.6",- "undici": ">=6.24.0",- "flatted": ">=3.4.0",- "minimatch": ">=3.1.4",- "rollup": ">=4.59.0",- "ajv": ">=6.14.0"- }+ "name": "@coparse/js",+ "private": true,+ "workspaces": [+ "app",+ "app/packages/*",+ "app/infra/*",+ "loro-mirror",+ "lexical-core",+ "lexical-service"+ ],+ "packageManager": "[email protected]",+ "scripts": {+ "fix": "cd app && bunx --bun @biomejs/biome check --write",+ "lint:ci": "cd app && bunx --bun @biomejs/biome ci --changed --no-errors-on-unmatched --error-on-warnings",+ "check": "cd app && tsc --noEmit --skipLibCheck --project packages/app/tsconfig.json",+ "lint": "cd app && bunx --bun @biomejs/biome lint --skip=suspicious/noImportCycles",+ "format": "cd app && bunx --bun @biomejs/biome format --write"+ },+ "trustedDependencies": [+ "@pulumi/aws-native",+ "@pulumi/awsx",+ "@pulumi/command",+ "@pulumi/synced-folder",+ "aws-sdk",+ "docker-classic",+ "esbuild"+ ],+ "patchedDependencies": {+ "[email protected]": "app/patches/[email protected]",+ "@thisbeyond/[email protected]": "app/patches/@thisbeyond%[email protected]",+ "@lexical/[email protected]": "app/patches/@lexical%[email protected]",+ "@kobalte/[email protected]": "app/patches/@kobalte%[email protected]",+ "[email protected]": "app/patches/[email protected]",+ "@tanstack/[email protected]": "app/patches/@tanstack%[email protected]"+ },+ "overrides": {+ "cross-spawn": "7.0.6",+ "undici": ">=6.24.0",+ "flatted": ">=3.4.0",+ "minimatch": ">=3.1.4",+ "rollup": ">=4.59.0",+ "ajv": ">=6.14.0"+ }}