This commit is contained in:
Timothy Jaeryang Baek committed 2026-06-06 09:53:17 +01:00
1 parent 768a19649b
commit b9137781d4
7 files changed
+20 -23

No files matched your search

+2
View File
@@ -1,5 +1,7 @@
# cptr
![Cptr Demo](./demo.png)
The computer used to be a room. Then a desk. Then a bag. Now it's a URL.
Your phone goes everywhere with you. You run your life from it. Your computer used to stay home. Now it can come along.
@@ -1,6 +1,7 @@
<script lang="ts">
import { onMount, type Snippet } from 'svelte';
import Icon from './Icon.svelte';
import KeyPill from './KeyPill.svelte';
interface MenuItem {
label: string;
@@ -142,7 +143,7 @@
{/if}
<span class="flex-1 text-left truncate">{item.label}</span>
{#if item.shortcut}
<kbd class="ml-auto shrink-0 inline-flex items-center h-[18px] px-[5px] rounded-full text-[9px] font-medium leading-none bg-[#e8e8e8] text-[#555] dark:bg-[#1e1e1e] dark:text-[#999]">{item.shortcut}</kbd>
<KeyPill text={item.shortcut} class="ml-auto shrink-0" />
{/if}
{#if item.check && item.active}
<svg class="w-3 h-3 shrink-0 text-gray-400 dark:text-gray-500" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
@@ -336,7 +336,7 @@
</div>
{#if showPlusMenu && plusBtnEl}
<DropdownMenu items={plusMenuItems} anchor={plusBtnEl} onclose={() => showPlusMenu = false} />
<DropdownMenu items={plusMenuItems} anchor={plusBtnEl} onclose={() => showPlusMenu = false} className="min-w-52" />
{/if}
{#if contextMenu}
@@ -0,0 +1,11 @@
<script lang="ts">
interface Props {
/** The formatted shortcut text to display (e.g. "⌘N", "⌃`"). */
text: string;
/** Additional CSS classes (e.g. layout utilities from the parent). */
class?: string;
}
let { text, class: className = '' }: Props = $props();
</script>
<span class="inline-flex items-center justify-center h-[18px] px-[5px] rounded-full text-[10px] font-medium leading-none bg-[#e8e8e8] text-[#555] dark:bg-[#1e1e1e] dark:text-[#999] {className}">{text}</span>
@@ -1,6 +1,7 @@
<script lang="ts">
import { keybindings, ACTION_IDS, ACTION_LABELS, DEFAULT_KEYBINDINGS, formatChord, eventToChord, resetKeybindings } from '$lib/stores/keybindings';
import type { ActionId } from '$lib/stores/keybindings';
import KeyPill from '../KeyPill.svelte';
/** Action descriptions for the second line. */
const ACTION_DESCRIPTIONS: Record<ActionId, string> = {
@@ -98,11 +99,11 @@
<span class="recording-indicator">Press keys…</span>
{:else if chord}
<button
class="key-pill cursor-pointer"
class="cursor-pointer"
onclick={() => startRecording(actionId)}
title="Click to rebind"
>
{formatChord(chord)}
<KeyPill text={formatChord(chord)} />
</button>
{:else}
<button
@@ -136,24 +137,6 @@
border-bottom: none;
}
.key-pill {
display: inline-flex;
align-items: center;
justify-content: center;
height: 22px;
padding: 0 6px;
border-radius: 9999px;
font-size: 10px;
font-weight: 500;
line-height: 1;
background: #e8e8e8;
color: #555;
}
:global(.dark) .key-pill {
background: #1e1e1e;
color: #999;
}
.recording-indicator {
display: inline-flex;
@@ -60,7 +60,7 @@
{@const fileName = filePath.split('/').pop() || filePath}
<!-- svelte-ignore a11y_no_static_element_interactions -->
<button
class="inline-flex items-center gap-1 px-1.5 py-px rounded-md text-[13px] leading-snug font-medium cursor-pointer border-none bg-blue-500/10 text-blue-500 dark:text-blue-400 hover:bg-blue-500/12 transition-colors align-baseline"
class="inline-flex items-center gap-1 px-1 py-px rounded text-[13px] leading-snug font-medium cursor-pointer border-none text-blue-500 dark:text-blue-400 hover:bg-blue-500/8 transition-colors align-baseline"
title={filePath}
onclick={(e) => { e.preventDefault(); openFileTab(filePath); }}
>
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 630 KiB