- Vendor ArkScope decorative layers (ScrambleTitle / IsometricWave) with provenance notes; decorative-only per AGENTS.md red lines - Migrate theme tokens to Arco, register the Arco theme, and add hook adapter composables (useMessage / useDialog / useNotification) with matching signatures - Sample pages: LoginView and AppSidebar on the new baseline; docs/arco-mapping.md and docs/ui-baseline.md land - agent-bridge: prefer the PM-selected venv from facts.json over legacy in-tree venvs (legacy lacks the mcp extra, so every MCP server showed 0 tools / not connected) - agent-bridge python (vendored, deliberate deviation): MCP discovery import fallback and pyyaml -> hermes_yaml so plugins and MCP work under the PM env; install the mcp extra via `hermes pm install --extra mcp` - Chat-chain fragment: docs/chat-chain-changes/2026-10-17-phase005-arkscope-baseline.md Verified: harness:check, test (2020 passed), test:e2e (30 passed), build all green; manual: plugins 100/0 warnings, MCP 6/6 servers connected with 104 tools.
63 lines
2.3 KiB
TypeScript
63 lines
2.3 KiB
TypeScript
import { Modal } from '@arco-design/web-vue'
|
|
import type { VNodeChild } from 'vue'
|
|
|
|
// Frozen API (Phase 005). Mirrors the Naive `useDialog` option names used in
|
|
// this repo (positiveText/onPositiveClick/...) and maps them onto Arco Modal.
|
|
// Extend this adapter instead of importing Arco's Modal directly in views.
|
|
|
|
export interface AppDialogOptions {
|
|
title?: string
|
|
content?: string | (() => VNodeChild)
|
|
positiveText?: string
|
|
negativeText?: string
|
|
// Naive semantics: resolving false (or rejecting) keeps the dialog open
|
|
// and shows no success close; anything else closes it.
|
|
onPositiveClick?: () => unknown | Promise<unknown>
|
|
onNegativeClick?: () => unknown | Promise<unknown>
|
|
onClose?: () => void
|
|
closable?: boolean
|
|
}
|
|
|
|
function normalize(options: AppDialogOptions) {
|
|
return {
|
|
title: options.title,
|
|
// RenderContent = string | (() => VNodeChild) — pass functions through;
|
|
// Arco invokes them itself.
|
|
content: options.content ?? '',
|
|
okText: options.positiveText,
|
|
cancelText: options.negativeText,
|
|
// Map naive's "resolve false / reject → keep open" onto Arco's onBeforeOk
|
|
// (async result false keeps the modal open; it also drives ok-button
|
|
// loading while pending, matching naive).
|
|
onBeforeOk: options.onPositiveClick
|
|
? async (): Promise<boolean> => {
|
|
try {
|
|
const result = await options.onPositiveClick!()
|
|
return result !== false
|
|
} catch {
|
|
return false
|
|
}
|
|
}
|
|
: undefined,
|
|
// Arco's onBeforeCancel is sync-only; a returned promise (naive async
|
|
// style with no explicit false) counts as "proceed".
|
|
onBeforeCancel: options.onNegativeClick
|
|
? (): boolean => options.onNegativeClick!() !== false
|
|
: undefined,
|
|
onClose: options.onClose,
|
|
closable: options.closable,
|
|
}
|
|
}
|
|
|
|
export function useDialog() {
|
|
return {
|
|
confirm: (options: AppDialogOptions) => Modal.confirm(normalize(options)),
|
|
info: (options: AppDialogOptions) => Modal.info(normalize(options)),
|
|
success: (options: AppDialogOptions) => Modal.success(normalize(options)),
|
|
error: (options: AppDialogOptions) => Modal.error(normalize(options)),
|
|
warning: (options: AppDialogOptions) => Modal.warning(normalize(options)),
|
|
}
|
|
}
|
|
|
|
export type AppDialog = ReturnType<typeof useDialog>
|