Files
Docwell/Packages/ui/src/DwSlashMenu.vue
T
tajniak81andClaude Opus 5.5 ba394b8fac Finish Phase 0: lint, codegen, contributor docs and the two remaining spikes
Repository basics:
- CONTRIBUTING.md and CODE_OF_CONDUCT.md (Contributor Covenant 2.1)
- SPDX AGPL-3.0-or-later headers on all hand-written sources, checked in CI
- golangci-lint (shared .golangci.yml), ESLint and Prettier, all run in CI

API codegen from api/openapi.yaml (npm run generate, drift fails CI):
- Go types via oapi-codegen in Server/internal/api
- a contract test that the router and the spec list the same routes
- Dart models via Phone-App/tool/generate_api.dart; the app uses them

Spike: shared Tiptap editor in a Flutter WebView (ADR-4)
- @docwell/editor-bridge builds the editor into one HTML page with a
  versioned JSON protocol; Phone-App hosts it with webview_flutter and a
  native toolbar. Integration test passes on an Android API 35 emulator.
- flutter_inappwebview dropped: its Android plugin fails on AGP 9.

Spike: Wails v3 desktop (ADR-11)
- system tray, docwell:// deep links (page and space only) with
  single-instance hand-off, and the built-in updater with a required
  ed25519 signing key. Verified on Windows.
- regenerated build assets register the scheme and drop template
  placeholders.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 16:11:07 +01:00

50 lines
1.8 KiB
Vue

<!-- SPDX-License-Identifier: AGPL-3.0-or-later -->
<script setup lang="ts">
import DwIcon from "./DwIcon.vue";
import type { IconName } from "./icons";
export interface SlashMenuItem {
label: string;
description?: string;
icon?: IconName;
shortcut?: string;
}
// The block inserter the editor opens on "/". The editor owns the keyboard
// (Up/Down move activeIndex, Enter selects, Escape closes); items select on
// mousedown so the editor keeps focus.
withDefaults(defineProps<{ items: SlashMenuItem[]; activeIndex?: number; query?: string; label?: string }>(), {
activeIndex: 0,
label: "Insert block",
});
const emit = defineEmits<{ select: [item: SlashMenuItem, index: number] }>();
</script>
<template>
<div
class="w-80 max-w-full rounded-md border border-line bg-surface-raised p-1 shadow-menu"
role="listbox"
:aria-label="label"
>
<div v-if="query != null" class="px-2 pt-2 pb-1 font-mono text-ui-xs text-ink-muted">/{{ query }}</div>
<div
v-for="(it, i) in items"
:key="it.label"
role="option"
:aria-selected="i === activeIndex"
class="flex cursor-pointer items-center gap-3 rounded-sm px-2 py-1.5"
:class="{ 'bg-surface-hover': i === activeIndex }"
@mousedown.prevent="emit('select', it, i)"
>
<span class="grid size-9 shrink-0 place-items-center rounded-sm border border-line bg-surface text-ink-muted">
<DwIcon :name="it.icon ?? 'text'" :size="18" />
</span>
<span class="flex min-w-0 flex-1 flex-col">
<span class="text-ui-md font-medium text-ink">{{ it.label }}</span>
<span v-if="it.description" class="truncate text-ui-xs font-normal text-ink-muted">{{ it.description }}</span>
</span>
<kbd v-if="it.shortcut" class="font-mono text-[11px] leading-4 text-ink-muted">{{ it.shortcut }}</kbd>
</div>
</div>
</template>