UNPKG

@extenshi/mcp

Version:

Extenshi MCP server — bring the extension catalog (search, security, market research) and pre-publish scanning into your AI tools

103 lines • 4.66 kB
/** * Pin guide — the templated "find the extension and pin it to the toolbar" * illustration sequence. * * This is the single highest-value thing a welcome page can teach: a new user * who never finds the toolbar button churns silently. The steps are the same * for every Chromium extension on earth, so they are TEMPLATES, not something * an author (or a model) should redraw each time — the only per-extension part * is the icon, which rides in as an overlay. * * Output is `WelcomeBlock[]`, i.e. the same block model the constructor, the * renderer and the agent brief already speak. That is what lets this generator * be BOTH a standalone tool and a section inside the welcome-page builder * without a second implementation. * * The SVG is written to survive `scrubSvgMarkup` untouched: flat shapes, no * script/style/animation, no external or `data:` references. Anything that * would be stripped is deliberately absent rather than "sanitized later". * * Fidelity matters here more than it looks. The guide's whole job is that a * user recognises the drawing as their own toolbar, so the browser chrome is * modelled (tab strip, back/forward/reload/home, omnibox with lock and star, * app menu) and the extensions button uses the real jigsaw glyph rather than a * hand-rolled approximation. The per-row control differs by browser and is * drawn as what that browser actually shows: a filled pushpin in Chrome, an * outlined, tilted pushpin followed by a ⋯ button in Edge, and a ⋯ overflow * button in Firefox whose opened menu holds "Pin to Toolbar". * * SELF-CONTAINED ON PURPOSE — its only import is the sibling captions file, so * the pair (plus pin-guide-kit.ts) can be copied into the published `@extenshi/mcp` * and `@extenshi/cli` packages. The copy procedure and the drift * tests are described at the top of ./pin-guide-strings.ts. The block types * below are structural stand-ins for `WelcomeBlock` (shared-types/onboarding-page.ts): * every value this file returns is assignable to it, which the welcome builder * and the BFF tests rely on. */ import type { PinGuideLocale } from './pin-guide-strings.js'; export type PinGuideBrowser = 'chrome' | 'edge' | 'firefox'; /** Same value as WELCOME_DEFAULT_ACCENT (shared-types/welcome-agent-brief.ts), pinned by a test. */ export declare const PIN_GUIDE_DEFAULT_ACCENT = "#5e5ce6"; /** The extension's icon drawn over an illustration, in percent of the frame. */ export interface PinGuideIconOverlay { url: string; x: number; y: number; size: number; } /** A numbered badge, in percent of the frame. */ export interface PinGuideMarker { x: number; y: number; kind: 'number'; n: number; label: null; } export interface PinGuideBlock { kind: 'step'; id: string; title: string; body: string | null; media: { source: 'svg'; svg: string; alt: string; annotations: PinGuideMarker[]; icon: PinGuideIconOverlay | null; }; } export declare const PIN_GUIDE_BROWSER_LABELS: Record<PinGuideBrowser, string>; export interface PinGuideInput { extensionName: string; browser: PinGuideBrowser; /** Accent used for highlight rings, matching the page's accent. */ accentColor: string; /** * The extension's icon. When absent the illustration falls back to a neutral * placeholder tile — still useful, just less recognisable. */ iconUrl?: string | null; /** Light/dark chrome, so the mock matches the page it sits on. */ theme?: 'light' | 'dark'; /** * Caption language. Unknown tags fall back to English, which is also the * default — and the English output is what hosted pages have always shown. */ locale?: PinGuideLocale | string; } /** * Build the four-step pin sequence. * * Step 3 (the pin toggle) is the one users actually miss, so it gets its own * frame rather than being folded into step 2 — the whole point of the guide is * that clicking the row is not the same as pinning it — and that frame is a * zoom of the row, because at toolbar scale the control is 18px wide and the * numbered badge that points at it is larger than the thing it points at. * * Badges are deliberately placed OFF the target with a short accent leader * running back to the ring. The badge is a fixed-pixel HTML overlay while the * illustration scales with the column, so a badge centred on its target covers * it outright at every width the preview is ever rendered at. */ export declare function buildPinGuideBlocks(input: PinGuideInput): PinGuideBlock[]; //# sourceMappingURL=pin-guide.d.ts.map