Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(ui): toasts, settings (#3283)

Fake-User7809e721c62d
diff --git a/js/app/packages/app/component/Root.tsx b/js/app/packages/app/component/Root.tsx
index 6930ca5fff..b6bffaf09f 100644
--- a/js/app/packages/app/component/Root.tsx
+++ b/js/app/packages/app/component/Root.tsx
@@ -5,6 +5,7 @@ import { globalSplitManager } from '@app/signal/splitLayout';
import { ChatAttachmentsInit } from '@core/component/AI/signal/globalAttachments';
import { toast } from '@core/component/Toast/Toast';
import { ToastRegion } from '@core/component/Toast/ToastRegion';
+import { ENABLE_MOBILE_TOAST } from '@core/constant/featureFlags';
import { ChannelsContextProvider } from '@core/context/channels';
import {
UserContextProvider,
@@ -12,6 +13,7 @@ import {
useUserInfo,
} from '@core/context/user';
import { IosPushNotificationModal } from '@core/mobile/IosPushNotificationModal';
+import { isMobile } from '@core/mobile/isMobile';
import { isNativeMobilePlatform } from '@core/mobile/isNativeMobilePlatform';
import { createBlockOrchestrator } from '@core/orchestrator';
import { formatTabTitle, tabTitleSignal } from '@core/signal/tabTitle';
@@ -66,6 +68,7 @@ import {
onCleanup,
onMount,
type ParentProps,
+ Show,
Suspense,
Switch,
} from 'solid-js';
@@ -504,7 +507,9 @@ export function Root() {
}}
</IsomorphicRouter>
</Suspense>
- <ToastRegion />
+ <Show when={!isMobile() || ENABLE_MOBILE_TOAST}>
+ <ToastRegion />
+ </Show>
</SearchProvider>
</QuickAccessProvider>
</CallProvider>
diff --git a/js/app/packages/app/component/settings/Appearance.tsx b/js/app/packages/app/component/settings/Appearance.tsx
index faf9f0f00b..e82ebc108d 100644
--- a/js/app/packages/app/component/settings/Appearance.tsx
+++ b/js/app/packages/app/component/settings/Appearance.tsx
@@ -15,18 +15,18 @@ function UserInterface() {
return (
<div class="grid gap-px bg-edge-muted border-b border-edge-muted">
<div class="bg-surface flex items-center justify-between h-15.25 px-6">
- <div class="text-sm">Show tooltips</div>
+ <div class="text-sm">Monochrome Icons</div>
<ToggleSwitch
- onChange={setTooltipsEnabled}
- checked={tooltipsEnabled()}
+ onChange={setMonochromeIcons}
+ checked={monochromeIcons()}
/>
</div>
<div class="bg-surface flex items-center justify-between h-15.25 px-6">
- <div class="text-sm">Monochrome icons</div>
+ <div class="text-sm">Show Tooltips</div>
<ToggleSwitch
- onChange={setMonochromeIcons}
- checked={monochromeIcons()}
+ onChange={setTooltipsEnabled}
+ checked={tooltipsEnabled()}
/>
</div>
</div>
diff --git a/js/app/packages/app/component/settings/Shortcuts.tsx b/js/app/packages/app/component/settings/Shortcuts.tsx
index 630813dbe8..bfe61a72ea 100644
--- a/js/app/packages/app/component/settings/Shortcuts.tsx
+++ b/js/app/packages/app/component/settings/Shortcuts.tsx
@@ -1,18 +1,13 @@
+import { createSignal, For, Index, createMemo, type JSX } from 'solid-js';
import { IS_MAC } from '@core/constant/isMac';
import { Hotkey } from '@ui';
-import { Keyboard, Panel } from '@ui';
+import { Panel } from '@ui';
import { cn } from '@ui';
-import { createSignal, For, Index, type JSX } from 'solid-js';
-
-const cmdOrCtrl = IS_MAC ? 'cmd' : 'ctrl';
-const CmdOrCtrl = IS_MAC ? 'MetaLeft' : 'ControlLeft';
interface ShortcutItem {
- /** Display strings for `<Hotkey>`, e.g. ['cmd+k']. Multiple = "any of these works". */
- keys: string[];
- /** `e.code` values to light up on the keyboard when this row is hovered. */
- codes: string[];
description: JSX.Element;
+ codes: string[];
+ keys: string[];
}
interface ShortcutSection {
@@ -20,6 +15,165 @@ interface ShortcutSection {
items: ShortcutItem[];
}
+interface KeyDef {
+ height: number;
+ labelX: number;
+ labelY: number;
+ label: string;
+ width: number;
+ name: string;
+ x: number;
+ y: number;
+}
+
+const cmdOrCtrl = IS_MAC ? 'cmd' : 'ctrl';
+const CmdOrCtrl = IS_MAC ? 'MetaLeft' : 'ControlLeft';
+
+const KEYS: KeyDef[] = [
+ // Row 1: Function keys
+ { name: 'Escape', label: 'esc', x: 0.0763, y: 0.0763, width: 2.8473, height: 1.8473, labelX: 1.50, labelY: 1.0228 },
+ { name: 'F1', label: 'F1', x: 3.0763, y: 0.0763, width: 1.8473, height: 1.8473, labelX: 4.00, labelY: 1.0228 },
+ { name: 'F2', label: 'F2', x: 5.0763, y: 0.0763, width: 1.8473, height: 1.8473, labelX: 6.00, labelY: 1.0228 },
+ { name: 'F3', label: 'F3', x: 7.0763, y: 0.0763, width: 1.8473, height: 1.8473, labelX: 8.00, labelY: 1.0228 },
+ { name: 'F4', label: 'F4', x: 9.0763, y: 0.0763, width: 1.8473, height: 1.8473, labelX: 10.00, labelY: 1.0228 },
+ { name: 'F5', label: 'F5', x: 11.0763, y: 0.0763, width: 1.8473, height: 1.8473, labelX: 12.00, labelY: 1.0228 },
+ { name: 'F6', label: 'F6', x: 13.0763, y: 0.0763, width: 1.8473, height: 1.8473, labelX: 14.00, labelY: 1.0228 },
+ { name: 'F7', label: 'F7', x: 15.0763, y: 0.0763, width: 1.8473, height: 1.8473, labelX: 16.00, labelY: 1.0228 },
+ { name: 'F8', label: 'F8', x: 17.0763, y: 0.0763, width: 1.8473, height: 1.8473, labelX: 18.00, labelY: 1.0228 },
+ { name: 'F9', label: 'F9', x: 19.0763, y: 0.0763, width: 1.8473, height: 1.8473, labelX: 20.00, labelY: 1.0228 },
+ { name: 'F10', label: 'F10', x: 21.0763, y: 0.0763, width: 1.8473, height: 1.8473, labelX: 22.00, labelY: 1.0228 },
+ { name: 'F11', label: 'F11', x: 23.0763, y: 0.0763, width: 1.8473, height: 1.8473, labelX: 24.00, labelY: 1.0228 },
+ { name: 'F12', label: 'F12', x: 25.0763, y: 0.0763, width: 1.8473, height: 1.8473, labelX: 26.00, labelY: 1.0228 },
+ { name: 'F13', label: 'F13', x: 27.0763, y: 0.0763, width: 1.8473, height: 1.8473, labelX: 28.00, labelY: 1.0228 },
+ // Row 2: Number row
+ { name: 'Backquote', label: '`', x: 0.0763, y: 2.0763, width: 1.8473, height: 1.8473, labelX: 1.00, labelY: 3.0228 },
+ { name: 'Digit1', label: '1', x: 2.0763, y: 2.0763, width: 1.8473, height: 1.8473, labelX: 3.00, labelY: 3.0228 },
+ { name: 'Digit2', label: '2', x: 4.0763, y: 2.0763, width: 1.8473, height: 1.8473, labelX: 5.00, labelY: 3.0228 },
+ { name: 'Digit3', label: '3', x: 6.0763, y: 2.0763, width: 1.8473, height: 1.8473, labelX: 7.00, labelY: 3.0228 },
+ { name: 'Digit4', label: '4', x: 8.0763, y: 2.0763, width: 1.8473, height: 1.8473, labelX: 9.00, labelY: 3.0228 },
+ { name: 'Digit5', label: '5', x: 10.0763, y: 2.0763, width: 1.8473, height: 1.8473, labelX: 11.00, labelY: 3.0228 },
+ { name: 'Digit6', label: '6', x: 12.0763, y: 2.0763, width: 1.8473, height: 1.8473, labelX: 13.00, labelY: 3.0228 },
+ { name: 'Digit7', label: '7', x: 14.0763, y: 2.0763, width: 1.8473, height: 1.8473, labelX: 15.00, labelY: 3.0228 },
+ { name: 'Digit8', label: '8', x: 16.0763, y: 2.0763, width: 1.8473, height: 1.8473, labelX: 17.00, labelY: 3.0228 },
+ { name: 'Digit9', label: '9', x: 18.0763, y: 2.0763, width: 1.8473, height: 1.8473, labelX: 19.00, labelY: 3.0228 },
+ { name: 'Digit0', label: '0', x: 20.0763, y: 2.0763, width: 1.8473, height: 1.8473, labelX: 21.00, labelY: 3.0228 },
+ { name: 'Minus', label: '-', x: 22.0763, y: 2.0763, width: 1.8473, height: 1.8473, labelX: 23.00, labelY: 3.0228 },
+ { name: 'Equal', label: '=', x: 24.0763, y: 2.0763, width: 1.8473, height: 1.8473, labelX: 25.00, labelY: 3.0228 },
+ { name: 'Backspace', label: 'del', x: 26.0763, y: 2.0763, width: 2.8473, height: 1.8473, labelX: 27.50, labelY: 3.0228 },
+ // Row 3: QWERTY row
+ { name: 'Tab', label: 'tab', x: 0.0763, y: 4.0763, width: 2.8473, height: 1.8473, labelX: 1.50, labelY: 5.0228 },
+ { name: 'KeyQ', label: 'Q', x: 3.0763, y: 4.0763, width: 1.8473, height: 1.8473, labelX: 4.00, labelY: 5.0228 },
+ { name: 'KeyW', label: 'W', x: 5.0763, y: 4.0763, width: 1.8473, height: 1.8473, labelX: 6.00, labelY: 5.0228 },
+ { name: 'KeyE', label: 'E', x: 7.0763, y: 4.0763, width: 1.8473, height: 1.8473, labelX: 8.00, labelY: 5.0228 },
+ { name: 'KeyR', label: 'R', x: 9.0763, y: 4.0763, width: 1.8473, height: 1.8473, labelX: 10.00, labelY: 5.0228 },
+ { name: 'KeyT', label: 'T', x: 11.0763, y: 4.0763, width: 1.8473, height: 1.8473, labelX: 12.00, labelY: 5.0228 },
+ { name: 'KeyY', label: 'Y', x: 13.0763, y: 4.0763, width: 1.8473, height: 1.8473, labelX: 14.00, labelY: 5.0228 },
+ { name: 'KeyU', label: 'U', x: 15.0763, y: 4.0763, width: 1.8473, height: 1.8473, labelX: 16.00, labelY: 5.0228 },
+ { name: 'KeyI', label: 'I', x: 17.0763, y: 4.0763, width: 1.8473, height: 1.8473, labelX: 18.00, labelY: 5.0228 },
+ { name: 'KeyO', label: 'O', x: 19.0763, y: 4.0763, width: 1.8473, height: 1.8473, labelX: 20.00, labelY: 5.0228 },
+ { name: 'KeyP', label: 'P', x: 21.0763, y: 4.0763, width: 1.8473, height: 1.8473, labelX: 22.00, labelY: 5.0228 },
+ { name: 'BracketLeft', label: '[', x: 23.0763, y: 4.0763, width: 1.8473, height: 1.8473, labelX: 24.00, labelY: 5.0228 },
+ { name: 'BracketRight', label: ']', x: 25.0763, y: 4.0763, width: 1.8473, height: 1.8473, labelX: 26.00, labelY: 5.0228 },
+ { name: 'Backslash', label: '\\', x: 27.0763, y: 4.0763, width: 1.8473, height: 1.8473, labelX: 28.00, labelY: 5.0228 },
+ // Row 4: Home row
+ { name: 'CapsLock', label: 'caps', x: 0.0763, y: 6.0763, width: 3.3473, height: 1.8473, labelX: 1.75, labelY: 7.0228 },
+ { name: 'KeyA', label: 'A', x: 3.5763, y: 6.0763, width: 1.8473, height: 1.8473, labelX: 4.50, labelY: 7.0228 },
+ { name: 'KeyS', label: 'S', x: 5.5763, y: 6.0763, width: 1.8473, height: 1.8473, labelX: 6.50, labelY: 7.0228 },
+ { name: 'KeyD', label: 'D', x: 7.5763, y: 6.0763, width: 1.8473, height: 1.8473, labelX: 8.50, labelY: 7.0228 },
+ { name: 'KeyF', label: 'F', x: 9.5763, y: 6.0763, width: 1.8473, height: 1.8473, labelX: 10.50, labelY: 7.0228 },
+ { name: 'KeyG', label: 'G', x: 11.5763, y: 6.0763, width: 1.8473, height: 1.8473, labelX: 12.50, labelY: 7.0228 },
+ { name: 'KeyH', label: 'H', x: 13.5763, y: 6.0763, width: 1.8473, height: 1.8473, labelX: 14.50, labelY: 7.0228 },
+ { name: 'KeyJ', label: 'J', x: 15.5763, y: 6.0763, width: 1.8473, height: 1.8473, labelX: 16.50, labelY: 7.0228 },
+ { name: 'KeyK', label: 'K', x: 17.5763, y: 6.0763, width: 1.8473, height: 1.8473, labelX: 18.50, labelY: 7.0228 },
+ { name: 'KeyL', label: 'L', x: 19.5763, y: 6.0763, width: 1.8473, height: 1.8473, labelX: 20.50, labelY: 7.0228 },
+ { name: 'Semicolon', label: ';', x: 21.5763, y: 6.0763, width: 1.8473, height: 1.8473, labelX: 22.50, labelY: 7.0228 },
+ { name: 'Quote', label: "'", x: 23.5763, y: 6.0763, width: 1.8473, height: 1.8473, labelX: 24.50, labelY: 7.0228 },
+ { name: 'Enter', label: 'enter', x: 25.5763, y: 6.0763, width: 3.3473, height: 1.8473, labelX: 27.25, labelY: 7.0228 },
+ // Row 5: Bottom letter row
+ { name: 'ShiftLeft', label: 'shift', x: 0.0763, y: 8.0763, width: 4.3473, height: 1.8473, labelX: 2.25, labelY: 9.0228 },
+ { name: 'KeyZ', label: 'Z', x: 4.5763, y: 8.0763, width: 1.8473, height: 1.8473, labelX: 5.50, labelY: 9.0228 },
+ { name: 'KeyX', label: 'X', x: 6.5763, y: 8.0763, width: 1.8473, height: 1.8473, labelX: 7.50, labelY: 9.0228 },
+ { name: 'KeyC', label: 'C', x: 8.5763, y: 8.0763, width: 1.8473, height: 1.8473, labelX: 9.50, labelY: 9.0228 },
+ { name: 'KeyV', label: 'V', x: 10.5763, y: 8.0763, width: 1.8473, height: 1.8473, labelX: 11.50, labelY: 9.0228 },
+ { name: 'KeyB', label: 'B', x: 12.5763, y: 8.0763, width: 1.8473, height: 1.8473, labelX: 13.50, labelY: 9.0228 },
+ { name: 'KeyN', label: 'N', x: 14.5763, y: 8.0763, width: 1.8473, height: 1.8473, labelX: 15.50, labelY: 9.0228 },
+ { name: 'KeyM', label: 'M', x: 16.5763, y: 8.0763, width: 1.8473, height: 1.8473, labelX: 17.50, labelY: 9.0228 },
+ { name: 'Comma', label: ',', x: 18.5763, y: 8.0763, width: 1.8473, height: 1.8473, labelX: 19.50, labelY: 9.0228 },
+ { name: 'Period', label: '.', x: 20.5763, y: 8.0763, width: 1.8473, height: 1.8473, labelX: 21.50, labelY: 9.0228 },
+ { name: 'Slash', label: '/', x: 22.5763, y: 8.0763, width: 1.8473, height: 1.8473, labelX: 23.50, labelY: 9.0228 },
+ { name: 'ShiftRight', label: 'shift', x: 24.5763, y: 8.0763, width: 4.3473, height: 1.8473, labelX: 26.75, labelY: 9.0228 },
+ // Row 6: Bottom row
+ { name: 'Fn', label: 'fn', x: 0.0763, y: 10.0763, width: 1.8473, height: 1.8473, labelX: 1.00, labelY: 11.0228 },
+ { name: 'ControlLeft', label: 'ctrl', x: 2.0763, y: 10.0763, width: 1.8473, height: 1.8473, labelX: 3.00, labelY: 11.0228 },
+ { name: 'AltLeft', label: 'opt', x: 4.0763, y: 10.0763, width: 1.8473, height: 1.8473, labelX: 5.00, labelY: 11.0228 },
+ { name: 'MetaLeft', label: 'cmd', x: 6.0763, y: 10.0763, width: 2.3473, height: 1.8473, labelX: 7.25, labelY: 11.0228 },
+ { name: 'Space', label: 'space', x: 8.5763, y: 10.0763, width: 9.8473, height: 1.8473, labelX: 13.50, labelY: 11.0228 },
+ { name: 'MetaRight', label: 'cmd', x: 18.5763, y: 10.0763, width: 2.3473, height: 1.8473, labelX: 19.75, labelY: 11.0228 },
+ { name: 'AltRight', label: 'opt', x: 21.0763, y: 10.0763, width: 1.8473, height: 1.8473, labelX: 22.00, labelY: 11.0228 },
+ { name: 'ArrowLeft', label: '◂', x: 23.0763, y: 10.0763, width: 1.8473, height: 1.8473, labelX: 24.00, labelY: 11.0228 },
+ { name: 'ArrowUp', label: '▴', x: 25.0763, y: 10.0763, width: 1.8473, height: 0.8473, labelX: 26.00, labelY: 10.5000 },
+ { name: 'ArrowDown', label: '▾', x: 25.0763, y: 11.0763, width: 1.8473, height: 0.8473, labelX: 26.00, labelY: 11.5000 },
+ { name: 'ArrowRight', label: '▸', x: 27.0763, y: 10.0763, width: 1.8473, height: 1.8473, labelX: 28.00, labelY: 11.0228 },
+];
+
+function KeyRect(props: { def: KeyDef; active: boolean }) {
+ const stroke = () => (props.active ? 'var(--a0)' : 'var(--b4)');
+ const fill = () =>
+ props.active ? 'oklch(from var(--a0) l c h / 0.1)' : 'oklch(from var(--b2) l c h / 0.1)';
+
+ return (
+ <>
+ <rect
+ style={{ fill: fill(), stroke: stroke() }}
+ height={props.def.height}
+ width={props.def.width}
+ x={props.def.x}
+ y={props.def.y}
+ ry="0.2"
+ />
+ <text
+ style={{
+ 'font-family': 'var(--font-mono)',
+ 'dominant-baseline': 'central',
+ 'text-anchor': 'middle',
+ 'font-size': '0.4',
+ 'stroke': 'none',
+ 'fill': stroke(),
+ }}
+ x={props.def.labelX}
+ y={props.def.labelY}
+ >
+ {props.def.label}
+ </text>
+ </>
+ );
+}
+
+function Keyboard(props: { keys?: string[] }): JSX.Element {
+ const active = createMemo(() => new Set(props.keys ?? []));
+
+ return (
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ style={{
+ 'stroke-linejoin': 'round',
+ 'box-sizing': 'border-box',
+ 'stroke-linecap': 'round',
+ 'stroke-width': '0.0572',
+ 'display': 'block',
+ 'width': '100%',
+ 'fill': 'none',
+ }}
+ viewBox="0 0 29 12"
+ >
+ <For each={KEYS}>
+ {(key) => <KeyRect def={key} active={active().has(key.name)} />}
+ </For>
+ </svg>
+ );
+}
+
+
const shortcutSections: ShortcutSection[] = [
{
title: 'Core',
@@ -56,10 +210,14 @@ const shortcutSections: ShortcutSection[] = [
{ keys: ['x'] , codes: ['KeyX'] , description: 'Select items' },
{ keys: ['arrowleft'] , codes: ['ArrowLeft'] , description: 'Collapse item' },
{ keys: ['arrowdown'] , codes: ['ArrowDown'] , description: 'Move down' },
+
+ { keys: ['arrowright'] , codes: ['ArrowRight'] , description: 'Expand item' },
+
+
{ keys: ['e'] , codes: ['KeyE'] , description: 'Mark done' },
{ keys: ['arrowup'] , codes: ['ArrowUp'] , description: 'Move up' },
{ keys: ['shift+arrowup'] , codes: ['ShiftLeft', 'ArrowUp'] , description: 'Select up' },
- { keys: ['arrowright'] , codes: ['ArrowRight'] , description: 'Expand item' },
+
],
},
];
@@ -165,8 +323,8 @@ export function Shortcuts() {
<div class="h-full overflow-hidden flex justify-center p-2">
<div class="max-w-200 size-full">
<Panel depth={2} class="h-full overflow-hidden text-ink">
- <ShortcutsContent />
- </Panel>
+ <ShortcutsContent />
+ </Panel>
</div>
</div>
);
diff --git a/js/app/packages/core/constant/SettingsState.tsx b/js/app/packages/core/constant/SettingsState.tsx
index 25d1442833..e9b7b21b83 100644
--- a/js/app/packages/core/constant/SettingsState.tsx
+++ b/js/app/packages/core/constant/SettingsState.tsx
@@ -19,7 +19,7 @@ export const [activeTabId, setActiveTabId] =
createSignal<SettingsTab>('Appearance');
export const useSettingsState = () => {
- const { replaceOrInsertSplit } = useSplitLayout();
+ const { insertSplit } = useSplitLayout();
const getSettingsSplit = () => {
const splitManager = globalSplitManager();
@@ -37,7 +37,7 @@ export const useSettingsState = () => {
const openSettings = (activeTabId?: SettingsTab) => {
if (activeTabId) setActiveTabId(activeTabId);
if (isOpen()) return; // Already open
- replaceOrInsertSplit({ type: 'component', id: 'settings' });
+ insertSplit({ type: 'component', id: 'settings' });
};
const closeSettings = () => {
diff --git a/js/app/packages/core/constant/featureFlags.ts b/js/app/packages/core/constant/featureFlags.ts
index f1df0a5543..41015bdef4 100644
--- a/js/app/packages/core/constant/featureFlags.ts
+++ b/js/app/packages/core/constant/featureFlags.ts
@@ -349,3 +349,8 @@ export const ENABLE_MARKDOWN_SIDE_PANEL = resolveFeatureFlag(
'ENABLE_MARKDOWN_SIDE_PANEL',
true
);
+
+export const ENABLE_MOBILE_TOAST = resolveFeatureFlag(
+ 'ENABLE_MOBILE_TOAST',
+ false
+);
diff --git a/js/app/packages/ui/components/Keyboard.tsx b/js/app/packages/ui/components/Keyboard.tsx
deleted file mode 100644
index dfe25e8cad..0000000000
--- a/js/app/packages/ui/components/Keyboard.tsx
+++ /dev/null
@@ -1,156 +0,0 @@
-import { createMemo, For, type JSX } from 'solid-js';
-
-interface KeyDef {
- height: number;
- labelX: number;
- labelY: number;
- label: string;
- width: number;
- name: string;
- x: number;
- y: number;
-}
-
-const KEYS: KeyDef[] = [
- // Row 1: Function keys
- { name: 'Escape', label: 'esc', x: 0.0763, y: 0.0763, width: 2.8473, height: 1.8473, labelX: 1.50, labelY: 1.0228 },
- { name: 'F1', label: 'F1', x: 3.0763, y: 0.0763, width: 1.8473, height: 1.8473, labelX: 4.00, labelY: 1.0228 },
- { name: 'F2', label: 'F2', x: 5.0763, y: 0.0763, width: 1.8473, height: 1.8473, labelX: 6.00, labelY: 1.0228 },
- { name: 'F3', label: 'F3', x: 7.0763, y: 0.0763, width: 1.8473, height: 1.8473, labelX: 8.00, labelY: 1.0228 },
- { name: 'F4', label: 'F4', x: 9.0763, y: 0.0763, width: 1.8473, height: 1.8473, labelX: 10.00, labelY: 1.0228 },
- { name: 'F5', label: 'F5', x: 11.0763, y: 0.0763, width: 1.8473, height: 1.8473, labelX: 12.00, labelY: 1.0228 },
- { name: 'F6', label: 'F6', x: 13.0763, y: 0.0763, width: 1.8473, height: 1.8473, labelX: 14.00, labelY: 1.0228 },
- { name: 'F7', label: 'F7', x: 15.0763, y: 0.0763, width: 1.8473, height: 1.8473, labelX: 16.00, labelY: 1.0228 },
- { name: 'F8', label: 'F8', x: 17.0763, y: 0.0763, width: 1.8473, height: 1.8473, labelX: 18.00, labelY: 1.0228 },
- { name: 'F9', label: 'F9', x: 19.0763, y: 0.0763, width: 1.8473, height: 1.8473, labelX: 20.00, labelY: 1.0228 },
- { name: 'F10', label: 'F10', x: 21.0763, y: 0.0763, width: 1.8473, height: 1.8473, labelX: 22.00, labelY: 1.0228 },
- { name: 'F11', label: 'F11', x: 23.0763, y: 0.0763, width: 1.8473, height: 1.8473, labelX: 24.00, labelY: 1.0228 },
- { name: 'F12', label: 'F12', x: 25.0763, y: 0.0763, width: 1.8473, height: 1.8473, labelX: 26.00, labelY: 1.0228 },
- { name: 'F13', label: 'F13', x: 27.0763, y: 0.0763, width: 1.8473, height: 1.8473, labelX: 28.00, labelY: 1.0228 },
- // Row 2: Number row
- { name: 'Backquote', label: '`', x: 0.0763, y: 2.0763, width: 1.8473, height: 1.8473, labelX: 1.00, labelY: 3.0228 },
- { name: 'Digit1', label: '1', x: 2.0763, y: 2.0763, width: 1.8473, height: 1.8473, labelX: 3.00, labelY: 3.0228 },
- { name: 'Digit2', label: '2', x: 4.0763, y: 2.0763, width: 1.8473, height: 1.8473, labelX: 5.00, labelY: 3.0228 },
- { name: 'Digit3', label: '3', x: 6.0763, y: 2.0763, width: 1.8473, height: 1.8473, labelX: 7.00, labelY: 3.0228 },
- { name: 'Digit4', label: '4', x: 8.0763, y: 2.0763, width: 1.8473, height: 1.8473, labelX: 9.00, labelY: 3.0228 },
- { name: 'Digit5', label: '5', x: 10.0763, y: 2.0763, width: 1.8473, height: 1.8473, labelX: 11.00, labelY: 3.0228 },
- { name: 'Digit6', label: '6', x: 12.0763, y: 2.0763, width: 1.8473, height: 1.8473, labelX: 13.00, labelY: 3.0228 },
- { name: 'Digit7', label: '7', x: 14.0763, y: 2.0763, width: 1.8473, height: 1.8473, labelX: 15.00, labelY: 3.0228 },
- { name: 'Digit8', label: '8', x: 16.0763, y: 2.0763, width: 1.8473, height: 1.8473, labelX: 17.00, labelY: 3.0228 },
- { name: 'Digit9', label: '9', x: 18.0763, y: 2.0763, width: 1.8473, height: 1.8473, labelX: 19.00, labelY: 3.0228 },
- { name: 'Digit0', label: '0', x: 20.0763, y: 2.0763, width: 1.8473, height: 1.8473, labelX: 21.00, labelY: 3.0228 },
- { name: 'Minus', label: '-', x: 22.0763, y: 2.0763, width: 1.8473, height: 1.8473, labelX: 23.00, labelY: 3.0228 },
- { name: 'Equal', label: '=', x: 24.0763, y: 2.0763, width: 1.8473, height: 1.8473, labelX: 25.00, labelY: 3.0228 },
- { name: 'Backspace', label: 'del', x: 26.0763, y: 2.0763, width: 2.8473, height: 1.8473, labelX: 27.50, labelY: 3.0228 },
- // Row 3: QWERTY row
- { name: 'Tab', label: 'tab', x: 0.0763, y: 4.0763, width: 2.8473, height: 1.8473, labelX: 1.50, labelY: 5.0228 },
- { name: 'KeyQ', label: 'Q', x: 3.0763, y: 4.0763, width: 1.8473, height: 1.8473, labelX: 4.00, labelY: 5.0228 },
- { name: 'KeyW', label: 'W', x: 5.0763, y: 4.0763, width: 1.8473, height: 1.8473, labelX: 6.00, labelY: 5.0228 },
- { name: 'KeyE', label: 'E', x: 7.0763, y: 4.0763, width: 1.8473, height: 1.8473, labelX: 8.00, labelY: 5.0228 },
- { name: 'KeyR', label: 'R', x: 9.0763, y: 4.0763, width: 1.8473, height: 1.8473, labelX: 10.00, labelY: 5.0228 },
- { name: 'KeyT', label: 'T', x: 11.0763, y: 4.0763, width: 1.8473, height: 1.8473, labelX: 12.00, labelY: 5.0228 },
- { name: 'KeyY', label: 'Y', x: 13.0763, y: 4.0763, width: 1.8473, height: 1.8473, labelX: 14.00, labelY: 5.0228 },
- { name: 'KeyU', label: 'U', x: 15.0763, y: 4.0763, width: 1.8473, height: 1.8473, labelX: 16.00, labelY: 5.0228 },
- { name: 'KeyI', label: 'I', x: 17.0763, y: 4.0763, width: 1.8473, height: 1.8473, labelX: 18.00, labelY: 5.0228 },
- { name: 'KeyO', label: 'O', x: 19.0763, y: 4.0763, width: 1.8473, height: 1.8473, labelX: 20.00, labelY: 5.0228 },
- { name: 'KeyP', label: 'P', x: 21.0763, y: 4.0763, width: 1.8473, height: 1.8473, labelX: 22.00, labelY: 5.0228 },
- { name: 'BracketLeft', label: '[', x: 23.0763, y: 4.0763, width: 1.8473, height: 1.8473, labelX: 24.00, labelY: 5.0228 },
- { name: 'BracketRight', label: ']', x: 25.0763, y: 4.0763, width: 1.8473, height: 1.8473, labelX: 26.00, labelY: 5.0228 },
- { name: 'Backslash', label: '\\', x: 27.0763, y: 4.0763, width: 1.8473, height: 1.8473, labelX: 28.00, labelY: 5.0228 },
- // Row 4: Home row
- { name: 'CapsLock', label: 'caps', x: 0.0763, y: 6.0763, width: 3.3473, height: 1.8473, labelX: 1.75, labelY: 7.0228 },
- { name: 'KeyA', label: 'A', x: 3.5763, y: 6.0763, width: 1.8473, height: 1.8473, labelX: 4.50, labelY: 7.0228 },
- { name: 'KeyS', label: 'S', x: 5.5763, y: 6.0763, width: 1.8473, height: 1.8473, labelX: 6.50, labelY: 7.0228 },
- { name: 'KeyD', label: 'D', x: 7.5763, y: 6.0763, width: 1.8473, height: 1.8473, labelX: 8.50, labelY: 7.0228 },
- { name: 'KeyF', label: 'F', x: 9.5763, y: 6.0763, width: 1.8473, height: 1.8473, labelX: 10.50, labelY: 7.0228 },
- { name: 'KeyG', label: 'G', x: 11.5763, y: 6.0763, width: 1.8473, height: 1.8473, labelX: 12.50, labelY: 7.0228 },
- { name: 'KeyH', label: 'H', x: 13.5763, y: 6.0763, width: 1.8473, height: 1.8473, labelX: 14.50, labelY: 7.0228 },
- { name: 'KeyJ', label: 'J', x: 15.5763, y: 6.0763, width: 1.8473, height: 1.8473, labelX: 16.50, labelY: 7.0228 },
- { name: 'KeyK', label: 'K', x: 17.5763, y: 6.0763, width: 1.8473, height: 1.8473, labelX: 18.50, labelY: 7.0228 },
- { name: 'KeyL', label: 'L', x: 19.5763, y: 6.0763, width: 1.8473, height: 1.8473, labelX: 20.50, labelY: 7.0228 },
- { name: 'Semicolon', label: ';', x: 21.5763, y: 6.0763, width: 1.8473, height: 1.8473, labelX: 22.50, labelY: 7.0228 },
- { name: 'Quote', label: "'", x: 23.5763, y: 6.0763, width: 1.8473, height: 1.8473, labelX: 24.50, labelY: 7.0228 },
- { name: 'Enter', label: 'enter', x: 25.5763, y: 6.0763, width: 3.3473, height: 1.8473, labelX: 27.25, labelY: 7.0228 },
- // Row 5: Bottom letter row
- { name: 'ShiftLeft', label: 'shift', x: 0.0763, y: 8.0763, width: 4.3473, height: 1.8473, labelX: 2.25, labelY: 9.0228 },
- { name: 'KeyZ', label: 'Z', x: 4.5763, y: 8.0763, width: 1.8473, height: 1.8473, labelX: 5.50, labelY: 9.0228 },
- { name: 'KeyX', label: 'X', x: 6.5763, y: 8.0763, width: 1.8473, height: 1.8473, labelX: 7.50, labelY: 9.0228 },
- { name: 'KeyC', label: 'C', x: 8.5763, y: 8.0763, width: 1.8473, height: 1.8473, labelX: 9.50, labelY: 9.0228 },
- { name: 'KeyV', label: 'V', x: 10.5763, y: 8.0763, width: 1.8473, height: 1.8473, labelX: 11.50, labelY: 9.0228 },
- { name: 'KeyB', label: 'B', x: 12.5763, y: 8.0763, width: 1.8473, height: 1.8473, labelX: 13.50, labelY: 9.0228 },
- { name: 'KeyN', label: 'N', x: 14.5763, y: 8.0763, width: 1.8473, height: 1.8473, labelX: 15.50, labelY: 9.0228 },
- { name: 'KeyM', label: 'M', x: 16.5763, y: 8.0763, width: 1.8473, height: 1.8473, labelX: 17.50, labelY: 9.0228 },
- { name: 'Comma', label: ',', x: 18.5763, y: 8.0763, width: 1.8473, height: 1.8473, labelX: 19.50, labelY: 9.0228 },
- { name: 'Period', label: '.', x: 20.5763, y: 8.0763, width: 1.8473, height: 1.8473, labelX: 21.50, labelY: 9.0228 },
- { name: 'Slash', label: '/', x: 22.5763, y: 8.0763, width: 1.8473, height: 1.8473, labelX: 23.50, labelY: 9.0228 },
- { name: 'ShiftRight', label: 'shift', x: 24.5763, y: 8.0763, width: 4.3473, height: 1.8473, labelX: 26.75, labelY: 9.0228 },
- // Row 6: Bottom row
- { name: 'Fn', label: 'fn', x: 0.0763, y: 10.0763, width: 1.8473, height: 1.8473, labelX: 1.00, labelY: 11.0228 },
- { name: 'ControlLeft', label: 'ctrl', x: 2.0763, y: 10.0763, width: 1.8473, height: 1.8473, labelX: 3.00, labelY: 11.0228 },
- { name: 'AltLeft', label: 'opt', x: 4.0763, y: 10.0763, width: 1.8473, height: 1.8473, labelX: 5.00, labelY: 11.0228 },
- { name: 'MetaLeft', label: 'cmd', x: 6.0763, y: 10.0763, width: 2.3473, height: 1.8473, labelX: 7.25, labelY: 11.0228 },
- { name: 'Space', label: 'space', x: 8.5763, y: 10.0763, width: 9.8473, height: 1.8473, labelX: 13.50, labelY: 11.0228 },
- { name: 'MetaRight', label: 'cmd', x: 18.5763, y: 10.0763, width: 2.3473, height: 1.8473, labelX: 19.75, labelY: 11.0228 },
- { name: 'AltRight', label: 'opt', x: 21.0763, y: 10.0763, width: 1.8473, height: 1.8473, labelX: 22.00, labelY: 11.0228 },
- { name: 'ArrowLeft', label: '◂', x: 23.0763, y: 10.0763, width: 1.8473, height: 1.8473, labelX: 24.00, labelY: 11.0228 },
- { name: 'ArrowUp', label: '▴', x: 25.0763, y: 10.0763, width: 1.8473, height: 0.8473, labelX: 26.00, labelY: 10.5000 },
- { name: 'ArrowDown', label: '▾', x: 25.0763, y: 11.0763, width: 1.8473, height: 0.8473, labelX: 26.00, labelY: 11.5000 },
- { name: 'ArrowRight', label: '▸', x: 27.0763, y: 10.0763, width: 1.8473, height: 1.8473, labelX: 28.00, labelY: 11.0228 },
-];
-
-function KeyRect(props: { def: KeyDef; active: boolean }) {
- const stroke = () => (props.active ? 'var(--a0)' : 'var(--b4)');
- const fill = () =>
- props.active ? 'oklch(from var(--a0) l c h / 0.1)' : 'oklch(from var(--b2) l c h / 0.1)';
-
- return (
- <>
- <rect
- style={{ fill: fill(), stroke: stroke() }}
- height={props.def.height}
- width={props.def.width}
- x={props.def.x}
- y={props.def.y}
- ry="0.2"
- />
- <text
- style={{
- 'font-family': 'var(--font-mono)',
- 'dominant-baseline': 'central',
- 'text-anchor': 'middle',
- 'font-size': '0.4',
- 'stroke': 'none',
- 'fill': stroke(),
- }}
- x={props.def.labelX}
- y={props.def.labelY}
- >
- {props.def.label}
- </text>
- </>
- );
-}
-
-export function Keyboard(props: { keys?: string[] }): JSX.Element {
- const active = createMemo(() => new Set(props.keys ?? []));
-
- return (
- <svg
- xmlns="http://www.w3.org/2000/svg"
- style={{
- 'stroke-linejoin': 'round',
- 'box-sizing': 'border-box',
- 'stroke-linecap': 'round',
- 'stroke-width': '0.0572',
- 'display': 'block',
- 'width': '100%',
- 'fill': 'none',
- }}
- viewBox="0 0 29 12"
- >
- <For each={KEYS}>
- {(key) => <KeyRect def={key} active={active().has(key.name)} />}
- </For>
- </svg>
- );
-}
diff --git a/js/app/packages/ui/index.ts b/js/app/packages/ui/index.ts
index 3578b11ca1..632c4eb034 100644
--- a/js/app/packages/ui/index.ts
+++ b/js/app/packages/ui/index.ts
@@ -2,25 +2,24 @@
export { SegmentedControl } from './components/SegmentedControl';
export { TabbedControl } from './components/TabbedControl';
export { Avatar, AvatarGroup } from './components/Avatar';
+export { ToggleSwitch } from './components/ToggleSwitch';
export { ButtonGroup } from './components/ButtonGroup';
export { HoverCard } from './components/HoverCard';
export { Dropdown } from './components/Dropdown';
-export { Keyboard } from './components/Keyboard';
export { Surface } from './components/Surface';
export { Tooltip } from './components/Tooltip';
export { Dialog } from './components/Dialog';
export { Button } from './components/Button';
export { Hotkey } from './components/Hotkey';
export { Scroll } from './components/Scroll';
-export { ToggleSwitch } from './components/ToggleSwitch';
export { Panel } from './components/Panel';
export { Layer } from './components/Layer';
/* types */
export type { AvatarSize, AvatarProps, AvatarGroupSize, AvatarGroupProps } from './components/Avatar';
+export type { ToggleSwitchProps } from './components/ToggleSwitch';
export type { ButtonProps } from './components/Button';
export type { DialogProps } from './components/Dialog';
-export type { ToggleSwitchProps } from './components/ToggleSwitch';
/* utils */
export { cn } from './utils/classname';