GhostCodeBlock, clipboard helper, and prose styles specification
Important
Status: Approved on 2026-12-01 by zprue743 for 0.4.0 (see Approval). This specification covers three related pieces for documentation-style sites, which ship as two builds:
useGhostClipboardandwriteClipboardText, a copy-to-clipboard helper with a status announcement and a defined failure path (Clipboard helper).GhostCodeBlock, a headless code block shell around consumer-highlighted markup, with a header, a copy action, horizontal scroll, and an optional fold (Public API)..ghost-prose, a themed style scope for long-form content: headings, lists, inline code, tables, and the rest of an article (Prose styles).
The design decisions D1–D12 are listed under Design decisions and folded into the sections below.
Purpose and user problems
App builders who write documentation sites, changelogs, and help centers on GhostVue hand-assemble every code sample today: a GhostCard, a file name in a GhostBadge, a <pre> inside a horizontal GhostScrollArea, a GhostCollapsible fold, and a copy button that raises a toast. There is no clipboard primitive, so each app writes its own navigator.clipboard wrapper and usually forgets the failure path (insecure origins, denied permission, embedded frames). There is no style scope for article content, so each page carries its own CSS for headings, lists, inline code, and tables.
The GhostVue docs site solves the same problems locally. Its markdown fences and example source strips share one clipboard helper, a constant button name, a polite role="status" region, an out-of-order guard for overlapping writes, a select-the-code fallback when the write fails, and a visible failure message. None of it is exported.
This specification makes those solutions public:
- A consumer copies text with one call and gets a state they can render, a status message for assistive technology, and a failure they can recover from.
- A consumer renders a code sample from markup their own highlighter produced (Shiki, Prism, highlight.js, or none), with a header, a copy action, a horizontally scrolling body, and an optional fold for long samples, without GhostVue bundling a highlighter.
- A consumer adds one class to an article and gets themed typography that follows color mode and density.
Non-goals
- Syntax highlighting. GhostVue does not bundle, wrap, or pick a highlighter, and adds no runtime dependency (dependency policy).
GhostCodeBlockrenders whatever markup the consumer puts in its default slot. It never callsv-html; a consumer who renders highlighter HTML makes that trust decision in their own template (D3). - Highlighter themes. Token colors come from the consumer's highlighter (inline styles or classes). The recipe paints the surface, border, header, and default text color only. The documentation shows a dual-theme Shiki setup that follows
data-ghost-mode, as an example, not a contract. - Line numbers, line highlighting, diff markers, and word wrap. Each depends on per-line markup that differs between highlighters. The stable hooks let a consumer add them with CSS; the documentation shows a line-number counter for Shiki's
.linespans. A later spec can add them. - Tabs between several files or languages. Compose
GhostTabsaround several code blocks. - Editing. A code block is read-only. Code editors are out of scope.
- A rich-text editor or a markdown renderer. Prose styles apply to HTML the consumer already has.
- Print styles. Tracked separately as app-builder feedback item G15.
- A copy-on-select or copy-anything directive. The helper is a composable; a consumer binds it to any control.
- A
document.execCommand('copy')fallback (D2). - Prose size variants (
sm/lg). Density already tightens or loosens rhythm. A size modifier can be added later without breaking the scope. - Changing the docs site's markdown fences to
GhostCodeBlock. VitePress owns that markup; see Docs site adoption.
Public API
Exports
From @ghostvue/vue:
GhostCodeBlock(headless component)useGhostCodeBlock(composable behind the component, for fully custom markup)useGhostClipboard(clipboard state, announcement, and failure handling)writeClipboardText(stateless write; resolves a boolean, never throws)- Types:
GhostCodeBlockProps,GhostCodeBlockEmits,GhostCodeBlockSlots,GhostCodeBlockExposed,GhostCodeBlockMessages,GhostCodeBlockCopySettledEvent,UseGhostCodeBlockOptions,UseGhostCodeBlockReturn,GhostClipboardState,GhostClipboardMessages,GhostClipboardAnnouncement,UseGhostClipboardOptions,UseGhostClipboardReturn
From @ghostvue/themes:
GhostCodeBlock(themed wrapper, same props, events, slots, and exposed members as the headless component)recipes/code-block.cssandrecipes/prose.css(both also indefault.css)- The
.ghost-proseand.ghost-not-proseclasses and the--ghost-prose-scroll-margincustom property (Prose styles) - The semantic token
--ghost-type-family-mono(D10)
Clipboard helper
writeClipboardText(text)
function writeClipboardText(text: string): Promise<boolean>Writes text with navigator.clipboard.writeText. The call to writeText happens synchronously inside writeClipboardText, before any await, so the write stays inside the user gesture that triggered it (Safari rejects writes that start after the gesture). Resolves true when the write succeeds. Resolves false, and never rejects or throws, when:
- it runs outside a browser (no
navigator, as during SSR); - the Clipboard API is missing (insecure origins hide
navigator.clipboard; some embedded webviews omit it); - the write is rejected: permission denied, the document is not focused, the call came after the user gesture ended, or a cross-origin frame lacks the
clipboard-writepermission policy.
It has no state, timers, or Vue dependency, so non-component code (the docs site's markdown fence enhancer) can call it. An empty string is written as an empty string.
useGhostClipboard(options?)
type GhostClipboardState = 'idle' | 'copied' | 'failed'
interface GhostClipboardMessages {
/** Announced after a successful write. */
copied: string
/** Announced after a failed write. */
failed: string
}
interface GhostClipboardAnnouncement {
/** Changes on every announcement, so equal consecutive texts re-announce. */
key: number
text: string
}
interface UseGhostClipboardOptions {
/**
* How long `copied` lasts before `state` returns to `idle`, in ms.
* Default 2000. `0`, a negative number, or a non-finite number keeps
* `copied` until the next `copy()` or `reset()`.
*/
copiedDuration?: MaybeRefOrGetter<number>
/** Overrides for the announced texts. Read when each write settles. */
messages?: MaybeRefOrGetter<Partial<GhostClipboardMessages> | undefined>
}
interface UseGhostClipboardReturn {
state: Readonly<Ref<GhostClipboardState>>
announcement: Readonly<Ref<GhostClipboardAnnouncement>>
/** Spread on the element that renders `announcement.text`. */
liveRegionProps: ComputedRef<{
role: 'status'
'aria-live': 'polite'
'aria-atomic': 'true'
}>
/** Writes `text`; resolves the write result. Never rejects. */
copy: (text: string) => Promise<boolean>
/** Returns to `idle`, clears the timer and the announcement text. */
reset: () => void
}Default messages: copied is 'Copied'; failed is 'Copy failed.'. The code block passes a longer failure message that tells the reader the code is selected (Copy action); a bare helper cannot promise a selection, so its default does not.
aria-live and aria-atomic repeat what role="status" implies. They are kept on purpose, as in useGhostFileUpload, for screen readers that only honor the explicit attributes.
Contract:
copy(text)synchronously setsstatetoidle, emptiesannouncement.text, clears any timer, and callswriteClipboardText(text)in the same tick, with noawaitbefore the write. A consumer who callscopy()from their own control (for example in the code block'sactionsslot) must call it directly from the event handler, not after their ownawait.- When the write settles, and only if this call is still the latest
copy()and the scope is not disposed:- success sets
statetocopied, announcesmessages.copied, and starts thecopiedDurationtimer. When the timer fires,statereturns toidleandannouncement.textempties (emptying is silent). - failure sets
statetofailedand announcesmessages.failed.failedstays until the nextcopy()orreset(), so the failure text stays readable.
- success sets
- A call that is no longer the latest still resolves its own boolean, but it changes no state and announces nothing. A permission prompt can hold one write back; an older write that settles late must not replace a newer result (D4).
- Each announcement increments
announcement.key. A consumer renders the text in a keyed child of the live region (<span :key="announcement.key">) so that two equal texts in a row are announced twice. This is theuseGhostFileUploadannouncer pattern, and it needs no tick between clearing and announcing. - On scope disposal the timer is cleared and pending writes are ignored when they settle.
- The composable works in any effect scope. It does not require a component instance, and it touches no browser API until
copy()runs.
The helper does not render, select text, or show a toast. Those belong to the caller. GhostCodeBlock uses it and adds the selection fallback.
Props and configuration
GhostCodeBlock props (headless and themed are identical):
| Prop | Type | Default | Contract |
|---|---|---|---|
code | string | required | The raw source text. It is what Copy writes (unless copyText is set), what the line count is taken from, and what renders as escaped text when the default slot is empty. |
copyText | string | undefined | undefined | Text Copy writes instead of code, for example a shell sample without its $ prompts. The failure fallback also puts this text on the clipboard (Copy action). |
title | string | undefined | undefined | Header title, usually a file name. It also names the copy button and, through the title element, the code region (Semantics). |
language | string | undefined | undefined | Language label rendered in the header (for example ts). Also set as data-language on the root and as the class language-<language> on <code>. |
copyable | boolean | true | Renders the copy button. false removes it; the status region stays whenever the header renders, so a custom copy control in actions is still announced. |
foldLines | number | undefined | undefined | Enables the fold when the sample has more lines than this. Must be a positive integer; any other value logs a development warning and disables the fold. |
expanded | boolean | undefined | undefined | Controlled fold state (v-model:expanded). Ignored, with no warning, when the fold is not active. |
defaultExpanded | boolean | false | Initial fold state in uncontrolled mode. |
copiedDuration | number | 2000 | Passed to useGhostClipboard. |
messages | Partial<GhostCodeBlockMessages> | {} | Text overrides, merged over the defaults below. Read at render and when a write settles, so a reactive object updates later output. |
The title prop takes the place of the native title attribute on this component; a tooltip title on the root is not supported. Other native attributes and listeners fall through to the root element. The component owns data-part, data-language, and data-fold on the root.
interface GhostCodeBlockMessages {
/** Visible copy button text, in every state. */
copy: string
/** Announcement after a successful copy. */
copied: string
/** Announcement and visible status text after a failed copy. */
failed: string
/** Accessible name of the copy button, from the `title` prop. */
copyLabel: (title: string | undefined) => string
/** Accessible name of the code region when no title element renders. */
regionLabel: (language: string | undefined) => string
/** Fold toggle text while collapsed. */
expand: (lineCount: number) => string
/** Fold toggle text while expanded. */
collapse: string
}| Message | Default |
|---|---|
copy | 'Copy' |
copied | 'Copied' |
failed | 'Copy failed. The code is now selected; copy it with Ctrl+C, ⌘C, or your device's Copy menu.' |
copyLabel | title ? \Copy ${title}` : 'Copy code'` |
regionLabel | language ? \${language} code` : 'Code'` |
expand | `Show all ${lineCount} lines` |
collapse | 'Show fewer lines' |
The copy button's visible text is messages.copy in every state, and its accessible name starts with that word, so voice control users can say "click Copy" at any time (label in name, D7). Success shows through data-state="copied" and the announcement, not a text change.
Line count. Remove one trailing line break (\n or \r\n) from code. If the result is empty, the count is 0. Otherwise the count is the number of line breaks plus one, where \r\n counts once. So '' and '\n' are 0, 'a' and 'a\n' are 1, and 'a\n\nb' is 3. The count is computed from code, not from the slot markup, so the consumer must render the same lines they pass in code.
Fold active. The fold is active when foldLines is a positive integer and the line count is greater than foldLines. A sample that fits renders no fold toggle and no fold hooks, even when foldLines is set.
v-model contracts
expanded follows useControllableState, as GhostCollapsible's open does:
- With
expandedomitted, internal state starts atdefaultExpandedand the toggle updates it, still emittingupdate:expanded. - With
expandedbound, the toggle emitsupdate:expandedand the consumer owns the update. defaultExpandedis read once at setup.- Focus entering clipped content requests expansion through the same path (Fold).
- When
codechanges so that the fold becomes inactive, the toggle unmounts; the stored state is kept and applies again if the fold becomes active.
Events, callbacks, slots, and exposed methods
Events:
| Event | Payload | Timing |
|---|---|---|
update:expanded | [expanded: boolean] | On fold toggle activation, or when focus enters clipped content while collapsed. |
copySettled | [event: GhostCodeBlockCopySettledEvent] | After a write settles, only for the latest request (the rule in the clipboard contract, item 3). |
interface GhostCodeBlockCopySettledEvent {
/** The text that was written (`copyText ?? code` at activation time). */
text: string
ok: boolean
}The event is named copySettled, not copy, so that @copy on the component keeps meaning the native DOM copy event on the root, and because it fires on failure as well as success. It lets an app add its own feedback (a toast, analytics). The component already announces the result, so a toast is optional.
Slots:
| Slot | Slot props | Renders inside | Contract |
|---|---|---|---|
default | none | <code data-part="code"> | The highlighted markup, following the content model. When the slot is empty, code renders as escaped text. |
title | none | [data-part="title"] | Replaces the title text, for example a file icon plus name. The region is named by this element. The copy button name still comes from the title prop, so pass both. |
actions | { copy: () => Promise<boolean>, state: GhostClipboardState } | the header, before the copy button | Extra header controls (an "Open in playground" link, or a custom copy button with copyable set to false). Consumers own their names. copy must be called directly from the event handler. |
copy | { state: GhostClipboardState } | <button data-part="copy"> | Replaces the copy button's visible content, for example an icon. The button keeps its aria-label, so icon-only content stays named (ADR 0013). |
Exposed (template ref):
interface GhostCodeBlockExposed {
element: HTMLElement | null
/** Runs the same copy as the button, including the failure fallback. */
copy: () => Promise<boolean>
}element is null before mount and after unmount, as in GhostCollapsible.
Slot content model
The default slot is phrasing content placed inside the component's <pre><code>. It must not contain a <pre> or <code> element of its own. The supported recipe for each common highlighter, used verbatim as test fixtures:
| Highlighter | Supported output |
|---|---|
| Shiki | codeToHtml(code, { …, structure: 'inline' }) rendered with v-html on a <span>, or codeToTokens / codeToHast rendered as Vue nodes. Not the default codeToHtml output, which brings its own <pre><code>. |
| Prism | Prism.highlight(code, grammar, language) rendered with v-html on a <span>. Prism theme selectors such as code[class*='language-'] match because <code> carries language-<language>. |
| highlight.js | hljs.highlight(code, { language }).value rendered with v-html on a <span>. Token classes (.hljs-keyword) work anywhere; the recipe paints the container instead of .hljs. |
The slot is empty when it is not provided, or when it renders only comments and whitespace text (for example a v-if that is still false while an async highlighter loads). An empty slot renders code as escaped text.
In development, after mount and after each slot update, the component logs a warning (a new code in dev-codes.ts) when it finds a <pre> inside <code data-part="code">.
useGhostCodeBlock
function useGhostCodeBlock(
options: UseGhostCodeBlockOptions,
): UseGhostCodeBlockReturnUseGhostCodeBlockOptions takes the component props as MaybeRefOrGetter values, plus onUpdateExpanded and onCopySettled callbacks. The return value holds everything the component renders, so a consumer can build their own markup with identical behavior:
- state:
lineCount,foldActive,expanded,clipboardState,announcement,viewportOverflow - actions:
copy(),toggle() - template refs:
rootRef,titleRef,viewportRef,codeRef,foldToggleRef - prop bags to spread:
rootProps,headerProps,titleProps,languageProps,copyButtonProps,statusProps,viewportProps,codeProps,foldToggleProps
Each prop bag carries the ids, ARIA attributes, data-* hooks, inline styles, and listeners listed under Semantics and Rendering and customization. The component is a thin template over this composable, as with the other useGhost* composables. The region name rule needs to know whether a title element rendered; the composable reads that from titleRef.
State model
Three independent pieces of state:
| State | Values | Owner |
|---|---|---|
| Clipboard | idle, copied, failed | Internal (useGhostClipboard), read via slots |
| Fold | collapsed, expanded | Controlled or uncontrolled (expanded) |
| Viewport overflow | none, horizontal | Measured after mount (Composition) |
Clipboard transitions: idle → idle (a new copy() resets first) → copied → idle (timer) or → failed. copied or failed → idle on the next copy() or reset().
Fold transitions: collapsed ↔ expanded on the toggle, on a controlled prop change, or collapsed → expanded when focus enters clipped content. A collapsed fold clips the code visually (Fold); it does not remove lines from the DOM.
Loading, empty, disabled, read-only, and error states
- Empty code.
code === ''renders an empty<pre>. The line count is 0, so the fold is inactive. Copy stays enabled and writes an empty string; an app that does not want that setscopyabletofalse. - Copy failed. See Copy action. The failure is not an error state of the component; nothing else changes.
- Disabled and read-only. Not applicable. A code block is always read-only. There is no
disabledprop;copyableremoves the action instead of disabling it, so no dead control stays in the tab order. - Loading. Not applicable as a state. A consumer that highlights asynchronously keeps the default slot empty (as defined in the content model) until the highlighter resolves, so the plain
codeshows first. Line count and copy work fromcodethe whole time, so nothing moves except token colors.
Async behavior
The only async work is the clipboard write. Races, staleness, and disposal follow the clipboard contract (items 2, 3, 5). The selection fallback runs only for the latest failed write and only while the component is mounted.
Consumer data
code,copyText,title, andlanguageare strings read on render. They are never mutated or retained beyond the current render.- The default slot is consumer markup. The component never parses, sanitizes, or rewrites it. When the consumer renders highlighter output with
v-html, they are responsible for that HTML being safe; highlighters escape the source they tokenize, and the documentation says so next to the example. - The component does not read the slot's text to decide what to copy. Copy writes the string props, so ignored markup (diff removal lines, prompts the slot renders with
user-select: none) never leaks into the clipboard by accident (D5). It does inspect the slot's DOM for tabbable descendants and nested<pre>elements (Performance).
Accessibility contract
Semantics and relationships
Rendered structure (headless, all parts present, collapsed, overflowing):
<div data-part="root" data-language="ts" data-fold="collapsed">
<div data-part="header">
<span data-part="title" id="t">app.ts</span>
<span data-part="language">ts</span>
<!-- actions slot -->
<button
type="button"
data-part="copy"
data-state="idle"
aria-label="Copy app.ts"
>
Copy
</button>
<span
data-part="status"
data-state="idle"
role="status"
aria-live="polite"
aria-atomic="true"
style="/* visually hidden while idle or copied */"
></span>
</div>
<pre
data-part="viewport"
dir="ltr"
aria-labelledby="t"
data-overflow="horizontal"
tabindex="0"
role="region"
><code
data-part="code"
class="language-ts"
translate="no"
data-state="collapsed"
style="display: block; --ghost-code-block-fold-lines: 12; …"
>…</code></pre>
<button type="button" data-part="fold-toggle" data-state="collapsed">
Show all 42 lines
</button>
</div>- Root is a
<div>with no role. A code block is content, not a landmark (D6). - Header renders when any of
title, thetitleslot,language, theactionsslot, orcopyableapplies. It has no role. - Title is plain text. A consumer who wants it to be a heading puts a heading in the
titleslot. - Language label is plain text and stays exposed to assistive technology even when a title is present, because a title such as "Terminal" does not say which language follows.
- Viewport is the
<pre>, and it is the horizontal scroll container. It carriesdir="ltr"so code keeps its reading order on right-to-left pages; the header follows the page direction. It follows theGhostScrollAreatab-stop rule: it getstabindex="0"only after mount, only while its content overflows horizontally, and only when it holds no tabbable descendants. While it is a tab stop it hasrole="region"and a name:aria-labelledbythe title element whenever one renders (from thetitleprop or thetitleslot), otherwisearia-labelfrommessages.regionLabel(language). When it is not a tab stop it has no role and no name, so screen readers do not announce an empty region around short samples. This keeps the existingGhostScrollArearule; including the language in the fallback name keeps a page of untitled samples from listing many regions all named "Code". - Code is a
<code>element inside the<pre>, withtranslate="no"so page translation does not rewrite identifiers, andclass="language-<language>"whenlanguageis set. The slot markup inside it is left as is. - Copy button is a native
<button type="button">. Its accessible name ismessages.copyLabel(title)and never changes with state. Its visible text ismessages.copyin every state (D7). It carriesdata-state; it does not usearia-pressed, because copy is an action, not a toggle. - Status region renders whenever the header renders, independent of
copyable, and it is in the server markup, so it exists before its first message (screen readers ignore live regions inserted at the same moment as their text). It carriesdata-state(idle,copied,failed). Whileidleorcopiedthe headless component hides it visually with theGhostVisuallyHiddeninline styles. Whilefailedit drops those inline styles, so the failure message is visible in headless and themed use alike, and the recipe styles it. - Fold toggle is a native
<button type="button">after the viewport. It has noaria-expandedoraria-controls: a collapsed fold hides nothing from assistive technology, so announcing "collapsed" would misstate the content (D8). Its text says what activating it does (Show all 42 lines/Show fewer lines) anddata-statecarries the state for styling.
Keyboard interaction
No custom key handlers. Native behavior only:
| Key | Target | Behavior |
|---|---|---|
Tab / Shift+Tab | whole block | Header actions, copy button, viewport (when a tab stop) or tabbables inside it, fold toggle. |
Enter, Space | copy button | Copies. |
Enter, Space | fold toggle | Toggles the fold. |
Arrow keys, Home/End | viewport | Native scrolling of the focused <pre>. |
Ctrl+C / ⌘C | anywhere | Native copy of the current selection, which is how the failure fallback completes. |
Focus behavior
- Copying never moves focus. The status region announces the result.
- On failure the component selects the contents of
<code>with the Selection API. Focus stays on the copy button. Browsers copy the document selection onCtrl+C/⌘Cwhile a button has focus, so the reader can complete the copy without moving. - When focus enters any element inside
<code>while the fold is collapsed (a link or a popover trigger in the slot markup), the component requests expansion throughupdate:expanded, so focus never lands in clipped, invisible content. In uncontrolled mode it expands. In controlled mode it emits only; the consumer is expected to apply it. - Toggling the fold keeps focus on the toggle. After collapsing, if the toggle has moved out of the viewport, it is scrolled back into view with
scrollIntoView({ block: 'nearest' }), so a keyboard user does not lose their place under a long sample. - Visible focus uses the theme focus ring on the copy button, the fold toggle, and the viewport (when it is a tab stop).
Assistive technology expectations
- Success: "Copied" is announced politely. The button name stays "Copy app.ts" and its visible text stays "Copy".
- Failure: the full failure message is announced, shown below the header, and the code is selected.
- Copying the same sample twice announces "Copied" twice (keyed announcement).
- The fold toggle reads as "Show all 42 lines, button".
- A collapsed fold clips the code visually only. Screen readers reach every line, and the failure fallback copies the full text. Known limitation: find-in-page counts matches in clipped lines but cannot reveal them until the reader expands the sample. The documentation says so.
- Forced colors: the copy button and fold toggle keep a visible border (
ButtonText); the fold fade is removed so clipped text ends at a hard edge.
Rendering and customization
Layers, from simplest to most custom:
- Themed
GhostCodeBlockfrom@ghostvue/themeswithcode,title, and a highlighted default slot. - Messages and slots:
messagesfor wording,titleandcopyslots for icons,actionsfor extra controls. - Headless
GhostCodeBlockwith the consumer's own CSS on the hooks below. useGhostCodeBlockwith fully custom markup.useGhostClipboardalone for copy buttons that are not code blocks.
Stable styling hooks (recorded in the manifest's styling block):
| Hook | Values |
|---|---|
data-part | root, header, title, language, copy, status, viewport, code, fold-toggle |
root data-language | the language prop, when set |
root data-fold | collapsed, expanded; absent when the fold is inactive |
copy and status data-state | idle, copied, failed |
code and fold toggle data-state | collapsed, expanded; absent on code when the fold is inactive |
viewport data-overflow | none, horizontal |
code class language-<language> | when language is set |
--ghost-code-block-fold-lines (custom property on code) | the foldLines value while the fold is active |
Internal wrapper nesting and other class names are not part of the contract. A consumer styles the code element through the root (.my-sample [data-part='code']) or the language class.
Fold
While the fold is active, the headless component sets display: block and --ghost-code-block-fold-lines on <code data-part="code"> in both fold states, so the box does not change type on toggle. While collapsed it also sets:
max-block-size: calc(var(--ghost-code-block-fold-lines) * 1lh);
overflow-y: clip;overflow-y: clip clips vertically without making <code> a scroll container, so the <pre> keeps scrolling horizontally. The clip is part of headless behavior, so an unthemed block still folds. Expanded, the two collapsed styles are removed. When the fold is inactive, no inline styles are set and the consumer's display applies.
Guarantee: the code element is clipped at foldLines × 1lh of its own line height. That shows exactly foldLines lines when the line height is a number or a length and every line box shares it. The themed recipe sets a numeric line height, so themed blocks show exactly foldLines lines. Headless use with line-height: normal, or lines with taller fallback glyphs (emoji, CJK), can show a partial line. Browser floor for the fold: 1lh (Chrome 109, Safari 16.4, Firefox 120) and overflow: clip (Chrome 90, Safari 16, Firefox 81).
Focus entering clipped content expands the fold (see Focus behavior).
The themed recipe adds a fade over the last visible line while collapsed. The fade is on by default and removed under (prefers-reduced-transparency: reduce) and (forced-colors: active). It stays pinned to the viewport's visible inline extent during horizontal scroll and never covers the horizontal scrollbar.
Copy action
Activating the copy button (or calling the exposed copy()):
- calls
useGhostClipboard().copy(copyText ?? code)synchronously from the activation handler; - on success, sets the button's and the status region's
data-statetocopiedand announcesmessages.copied. The visible button text does not change; the themed recipe paints a check mark fromdata-statewith CSS (ADR 0013); - on failure, sets
data-state="failed", announces and showsmessages.failed, and selects the rendered contents of<code>. While that fallback selection is active, the component listens for the nativecopyevent on the owning document (element.ownerDocument), not on the code element: in a non-editable context the event targets the focused element, which is still the copy button, so it never passes through<code>. When the document selection still covers exactly the code contents, the listener sets the clipboard data tocopyText ?? code(plain text) and prevents the default; otherwise it does nothing. SoCtrl+Cafter a failure copies the same text the button would have, without prompts, even on insecure origins whereclipboardDatais still writable. The listener is removed on the nextcopy(), when the selection changes away from the code, and on unmount; - emits
copySettledwith{ text, ok }.
The button stays enabled while a write is pending. A second activation supersedes the first (D4).
Themed recipe
recipes/code-block.css, in the zero-specificity ghostvue-theme layer:
- Surface
--ghost-surface-subtle-bg, text--ghost-text-default, border--ghost-border-hairline-width--ghost-border-default, radius--ghost-radius-md. - Code text
--ghost-type-family-monoat--ghost-type-size-smwith the numeric--ghost-type-line-normal;tab-size: 2. - Header: muted text (
--ghost-text-muted),--ghost-type-size-sm, a hairline separator, inset from--ghost-space-inset-*so density applies. - Copy button and fold toggle: quiet text buttons sized from
--ghost-control-size-sm-*tokens (with the coarse-pointer floor), focus ring from--ghost-focus-ring-*. No default icon artwork; the copied state adds a CSS-painted check glyph beside the constant "Copy" text. - Status region while
failed: visible text in--ghost-text-dangerat--ghost-type-size-sm, laid out under the header. - Viewport padding from
--ghost-space-inset-md; scrollbar clearance per theGhostScrollArearecipe. - Collapsed fade from
--ghost-surface-subtle-bgto transparent. - Both color modes come from tokens; the recipe never branches on mode.
The themed wrapper uses the block div.ghost-themed-scope strategy documented in themed wrapper roots (the same strategy as GhostTable), and the build adds it to that table in docs/themes/default.md.
Prose styles
Scope
.ghost-prose is a class that styles the long-form HTML inside it. It ships in @ghostvue/themes as recipes/prose.css and in default.css. There is no component and no @ghostvue/vue export: prose is pure styling of the consumer's own elements (D9).
<article class="ghost-prose">
<h1>Release notes</h1>
<p>Install with <code>pnpm add @ghostvue/vue</code>.</p>
</article>Scoping rules:
- Every rule sits in
@layer ghostvue-theme, and every complete selector is wrapped in:where()(including compound parts such as:where(code:not(pre code))), so it has zero specificity and any consumer rule, even a bare element selector, wins. - Element rules use
@scope (.ghost-prose) to (.ghost-not-prose, [data-part]). Styling stops at any element with.ghost-not-proseand at any element carryingdata-part, so aGhostCodeBlock,GhostTable,GhostLink, orGhostKbdinside an article keeps its own recipe instead of picking up prose rules. Every GhostVue component root carriesdata-part, and the build adds a test that enforces this for all exported components. Consumer or third-party markup with its owndata-partattributes (other headless libraries, icon opt-ins) also stops prose; the documentation says so. - Scoping limits are not in scope themselves, so the element rules never reach an embedded component. Block spacing around embedded components comes from a separate, unscoped rule (see the table below).
- A scoping root that itself matches a limit stays in scope. Putting
.ghost-prosedirectly on a component part (for example<GhostCollapsibleContent class="ghost-prose">) or on an element inside that part restores prose there. This is the same behavior the generated token sheet relies on for@scope ([data-ghost-mode='light']) to ([data-ghost-mode]), and the build tests it. @scopeproximity ranks before source order in the cascade, so a scoped prose rule beats an unscoped zero-specificity recipe rule on any element it reaches. That is why the limit is needed at every component part (D11).- The scope sets no
max-inline-size. Line length is the app's layout decision; the documentation showsmax-inline-size: 70chas a recipe.
Covered elements
| Elements | Treatment |
|---|---|
| Scope root | --ghost-type-family-sans, body size --ghost-type-size-lg, --ghost-type-line-normal, --ghost-text-default. First child has no block-start margin; last child has no block-end margin. |
h1–h6 | Sizes 3xl, 2xl, xl, lg, lg, md; weight --ghost-type-weight-semibold; h1–h3 use --ghost-type-letter-tight and --ghost-type-line-tight; h4–h6 use --ghost-type-letter-normal and --ghost-type-line-snug; h6 in --ghost-text-muted. Block-start margin larger than block-end, so a heading binds to the text after it. scroll-margin-block-start: var(--ghost-prose-scroll-margin, 0) so an app with a sticky header sets one custom property. |
p, ul, ol, dl, blockquote, pre, table, figure, hr | Vertical rhythm from --ghost-space-stack-*. Adjacent flow content is separated by --ghost-space-stack-md. |
| Embedded components | Direct children of the prose root that are component roots ([data-part]) or block div.ghost-themed-scope wrappers, and component roots that are direct children of a display: contents span.ghost-themed-scope child, get the same --ghost-space-stack-md block spacing through a separate rule outside the @scope block. No other prose styling reaches them. |
ul, ol, li, li::marker | Logical-property indentation; nested lists tighten their spacing; markers in --ghost-text-muted; ol keeps native numbering and start / reversed. Task-list checkboxes (li > input[type=checkbox]) align with the first line. |
dl, dt, dd | dt in --ghost-type-weight-semibold; dd indented by a logical inset. |
a | --ghost-text-primary, underlined with an offset, focus ring from --ghost-focus-ring-*. Visited links are not restyled. |
strong, b, em, i, small, mark, abbr[title], sub, sup, del, ins | Token weights and colors only. mark uses --ghost-status-warning-bg with --ghost-status-warning-fg. abbr[title] keeps a dotted underline. |
Inline code (not inside pre) | --ghost-type-family-mono at 0.875em, --ghost-surface-muted-bg, --ghost-radius-sm, small inline padding, overflow-wrap: anywhere so long identifiers do not overflow narrow screens. |
kbd | Matches the themed GhostKbd look at sm size, for markdown output that cannot render the component. |
Bare pre (and pre > code) | The same surface, border, radius, padding, and mono type as the code block recipe, with overflow-x: auto and direction: ltr. No header, copy, or fold. A GhostCodeBlock inside prose is excluded by the [data-part] limit and keeps its own recipe. |
blockquote | Inline-start border in --ghost-border-strong, --ghost-text-muted, no quotation marks added. |
hr | Hairline in --ghost-border-default with stack spacing. |
table, thead, tbody, tfoot, tr, th, td, caption | Full width of the content box, collapsed borders, row hairlines in --ghost-border-default, th in --ghost-type-weight-semibold with text-align: start, cell padding from --ghost-space-inset-sm, numeric columns not guessed, caption muted and at the block start. A wide table scrolls only if the consumer wraps it; the documentation shows a GhostScrollArea wrapper. |
img, video, svg, figure, figcaption | Media capped at max-inline-size: 100% with block-size: auto; figcaption muted at --ghost-type-size-sm. |
The body size is --ghost-type-size-lg (15px by default), one step above the 14px component text, because long-form reading needs a larger size than dense controls; inline code at 0.875em is then about 13px.
Density and color modes
- All spacing reads
--ghost-space-stack-*and--ghost-space-inset-*, sodata-ghost-densitytightens or loosens the rhythm with no prose-specific switch. Dependency: app-builder feedback item B2 reports thatdata-ghost-densityon a nested element currently has no effect (it works on<html>). Until that bug is fixed, density applies to prose only when set on<html>. The prose build tests density on<html>, and adds tests for density on the.ghost-proseelement itself and on an intermediate ancestor that are marked as expected failures until the B2 fix lands, then turned on with it. - Body and heading sizes read
--ghost-type-size-*and do not change with density, matching how density treats text elsewhere. - Colors read semantic tokens only, so
data-ghost-mode, the system color scheme, and every theme fromdefineThemeapply without mode branches. - Forced colors: the token mapping already yields distinct system colors for text, links, and borders. No forced-colors block is added; inline code keeps its mono family as the distinguishing cue.
- Right to left: every inset, indent, and border uses logical properties; bare
prestays left to right.
Token addition
--ghost-type-family-mono is a new semantic token (DTCG type.family.mono), default ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace. The code block recipe, prose inline code, bare pre, and prose kbd read it. defineTheme's fontFamily does not set it, because a theme that changes its text face rarely wants to change its code face; a consumer overrides the token on the palette host. The token reference and define-theme docs list it, and say that it is unrelated to the mono flagship theme (@ghostvue/themes/mono.css). Whichever build lands first adds the token; the other build rebases on it.
Environment behavior
SSR and hydration
- Server markup is complete and deterministic: header, title, language, copy button with its text and name, an empty visually hidden status region,
<pre>,<code>with the slot or escapedcode, and the fold toggle with the fold styles when the fold is active andexpandedresolves tofalse. Ids come fromuseGhostId, so they match on hydration. - The viewport renders without
tabindexorroleon the server and gets them after mount if it overflows, exactly asGhostScrollAreadoes. No hydration mismatch, because those attributes are added after hydration. - Whether the default slot is empty is decided from the rendered vnodes, the same way on the server and the client.
- The copy button renders on the server even though the clipboard is unknown there, and stays visible on insecure origins. Hiding it after hydration would shift layout and remove the selection fallback, which is still useful (D2).
useGhostClipboardandwriteClipboardTexttouch no browser API at setup.- Prose is CSS only. It renders identically on the server.
Mobile and touch
- The viewport scrolls horizontally with touch; the page does not.
- Copy and fold buttons meet the coarse-pointer minimum target through the
--ghost-control-size-sm-*tokens and the@media (pointer: coarse)floor. - Long inline code in prose wraps with
overflow-wrap: anywhere, so a phone never scrolls the page sideways for an identifier. - iOS Safari and Android Chrome support
navigator.clipboard.writeTextfrom a tap on a secure origin. The failure message names the device Copy menu, not only keyboard shortcuts. How an embedded webview presents the programmatic selection (handles, Copy menu) is a planned manual check, not a promise.
Performance
- Expected scale: samples up to a few thousand lines, tens of blocks per page.
- Line count is one pass over
code, recomputed only whencodechanges. - Overflow measurement and the tab-stop rule use one
ResizeObserveron the viewport and a subtreeMutationObserverthat re-runshasTabbableDescendantsover the slot markup when it changes, asGhostScrollAreadoes. Aloadingdonelistener on the document'sFontFaceSet(where one exists, added after mount and removed on unmount) remeasures when a web font changes glyph widths without resizing either observed box. The development-only nested-<pre>check runs at the same moments and is removed from production builds. Nothing else walks the slot's DOM. - No highlighter, no worker, no virtualization. A consumer with very large samples folds them, or highlights only on demand.
- Prose adds one stylesheet of zero-specificity rules and no JavaScript.
- Bundle size: the build adds
GhostCodeBlockto the bundle size budgets inscripts/bundle-size-budgets.json.
Composition
- Viewport.
useGhostScrollAreacannot be reused as is: its root props hard-code theghost-scroll-areaclass,data-part="root", and anaria-label-only name, which would pull the scroll-area recipe onto the<pre>and drop thearia-labelledbyrule. The code block reuses the internal helpersmeasureScrollOverflowandhasTabbableDescendantswith the same observer setup, and builds its ownviewportProps(data-partviewport,data-overflow, the tab-stop rule, and the naming rule above). If the build extracts a shared internal helper fromuseGhostScrollArea,GhostScrollArea's public output must not change. useControllableStateownsexpanded.useGhostIdowns ids.useGhostClipboardis used by the code block and is public for any other copy control (a "copy invite link" button, a token field).- The
GhostVisuallyHiddeninline styles hide the status region while it is idle or copied. GhostCollapsibleis not reused for the fold. A collapsible hides its whole panel; the fold clips part of one, keeps all of it available to assistive technology, and its toggle sits after the content it affects (D8).GhostButtonis not rendered inside the headless component, which stays dependency-free in markup. The themed recipe matches the quiet button look through shared tokens.
Docs site adoption
The docs site adopts the clipboard helper in the code block build:
DemoPreview.vuereplaces its local copy state, request counter, andcopyToClipboardwithuseGhostClipboard, keeping its own selection fallback and its visible failure text.enhance-code-fences.tsreplacescopyToClipboardwithwriteClipboardText. VitePress keeps rendering markdown fences, so the fences do not becomeGhostCodeBlock.- The local
copyToClipboardhelper is deleted.
The example source strip in DemoPreview is a candidate for GhostCodeBlock later. It is not part of this contract. The docs site does not adopt .ghost-prose: VitePress's .vp-doc styles own its articles, and swapping them would be a docs redesign.
Test plan
Unit tests (framework-neutral and composable)
writeClipboardText: resolvestrueon success;falsewith nonavigator, with nonavigator.clipboard, and whenwriteTextrejects; never rejects; callswriteTextsynchronously (before the returned promise is awaited); passes the text through unchanged, including''.useGhostClipboard:copiedthenidleaftercopiedDuration(fake timers);failedpersists;reset()clears state, timer, and text; non-positive and non-finitecopiedDurationkeepcopied; announcement key increments on equal consecutive texts; a slow first write that settles after a fast second write changes nothing; disposal clears the timer and ignores late settles; messages are read at settle time;writeTextis called in the same tick ascopy(); works inside a bareeffectScopewith no component.- Line counting:
''and'\n'are 0,'a'and'a\n'are 1,'a\n\nb'is 3,'a\r\nb'is 2, and'a\n\n'is 2.
Vue component tests
- Renders the plain
codeescaped when the default slot is absent, and when it renders only a comment (v-iffalse) or whitespace (an HTML string incodeappears as text). - Renders slot markup inside
<code data-part="code">unchanged;<code>hastranslate="no"andlanguage-<language>whenlanguageis set. - Development warning when the slot contains a
<pre>. - Header presence matrix: renders when any of
title,titleslot,language,actions, orcopyable; absent when none apply. - Language label is exposed with and without a title.
- Copy button name follows
copyLabel(title)and visible text staysmessages.copyacrossidle,copied, andfailed; the name contains the visible text in every state (label in name); thecopyslot replaces the visible content and keeps the name. - Status region renders whenever the header renders, including with
copyableset tofalse; carriesdata-state; has the visually hidden inline styles while idle or copied and none while failed. copyable=falsewith a custom copy button inactionscalling the slot'scopy()announces success and failure.copyTextoverrides what is written;copySettledemits{ text, ok }for the latest request only;@copyon the component still receives the native DOM event.- Region naming:
aria-labelledbythe title element with thetitleprop, with only thetitleslot, andaria-labelfromregionLabel(language)without either. - Fold: inactive when
foldLinesis unset, when the sample fits, or whenfoldLinesis invalid (with the development warning);display: blockand the custom property in both states while active; collapsed styles only when collapsed; no inline styles when inactive; noaria-expandedoraria-controlson the toggle; controlled and uncontrolledexpanded;defaultExpanded; state kept whencodeshrinks below the fold and grows back. - Focus entering a link inside
<code>while collapsed expands in uncontrolled mode and only emits in controlled mode. - Failure path selects the contents of
<code>; a nativecopyevent dispatched on the copy button (where focus stays) while that selection is active receivescopyText ?? code; acopyevent with a different selection is left alone; the document listener is gone after the selection changes, after the next copy, and after unmount. - Exposed
copy()matches the button;elementisnullbefore mount. - Viewport carries
dir="ltr"; attribute fallthrough to the root; ids are stable and unique per instance. - SSR:
renderToStringoutput contains the status region, notabindexon the viewport, and the fold styles; hydration produces no mismatch warnings for an empty slot, a filled slot, and an active fold.
Browser tests (Playwright, tests/e2e/ghost-code-block.spec.ts)
- Chromium: copy with clipboard permission granted writes the text (read back with
navigator.clipboard.readText), announces through the status region, keeps "Copy" as the visible text, and returns to idle. - WebKit and Firefox: an init script replaces
navigator.clipboard.writeTextwith a recording stub; tests assert the call arguments, that the call happened inside the click handler, and the resulting states. A rejecting stub covers the denied-permission and cross-origin-frame failures. - Copy with the Clipboard API removed (init script) announces and shows the failure, selects the code, keeps focus on the button, and
Ctrl+C/⌘Cthen putscopyText ?? codeon the clipboard (Chromium read-back). - A cross-origin
<iframe>withoutallow="clipboard-write"hosting a code block reaches the failure path. - Two rapid copies with a delayed first write end in the second result.
- A long-line sample: the viewport becomes a named tab stop, arrow keys scroll it, the page does not scroll horizontally at 320 px wide.
- A sample with a link in the slot: the viewport is not a tab stop; with the fold collapsed and the link on a clipped line, tabbing to the link expands the fold and the link is visible.
- Fold: themed collapsed height equals
foldLineslines; toggle expands and collapses; after collapsing a tall sample the toggle is in view; horizontal scroll still works while collapsed and the fade stays in place; clipped lines are present in the DOM. - RTL: on a
dir="rtl"page, code renders left to right and the header follows the page. - Prose: a fixture article with every covered element renders the specified tokens in light and dark mode and at compact, comfortable, and spacious density on
<html>(nested density tests per Density and color modes); aGhostCodeBlock,GhostTable, and.ghost-not-proseblock inside the article do not receive prose rules but do get block spacing from the paragraphs around them;.ghost-proseplaced directly on a component part, and on an element inside one, restores prose; a consumer's bare element selector (h2 { … }) overrides the prose rule; long inline code wraps at 320 px; logical properties mirror on adir="rtl"article. - Every exported component root renders a
data-partattribute (the prerequisite for the prose limit).
Accessibility and keyboard tests
- Axe passes on collapsed, expanded, overflowing, copied, and failed states, in both color modes, and on the prose fixture.
- Tab order matches the keyboard table.
- Forced colors: copy and fold buttons keep a visible boundary; the fold fade is removed (extend
tests/e2e/forced-colors-visual.spec.ts). - Keyboard evidence recorded per
pnpm keyboard:evidenceconventions for the copy button, viewport, and fold toggle.
Planned manual assistive-technology checks
Recorded before the manifest is promoted past experimental, per the assistive-technology review process:
- NVDA + Firefox and VoiceOver + Safari: "Copied" re-announces on a repeated copy; the failure message is read once; the fold toggle reads as a plain button; the named region is announced only for overflowing samples.
- One voice-control pass (Voice Control on macOS or Dragon): "click Copy" works in every state.
- iOS Safari and one Android webview: the failure fallback's selection is visible and copyable from the system menu.
Type tests
GhostCodeBlockrequirescode;expandedisboolean | undefined;messagesaccepts a partial object with function-valuedcopyLabel,regionLabel, andexpand; slot props are typed (stateisGhostClipboardState); thecopySettledpayload isGhostCodeBlockCopySettledEvent.useGhostClipboardaccepts refs and getters for its options;stateandannouncementare readonly.- Themed and headless
GhostCodeBlockprops are assignable to each other.
Regression fixtures
- The three supported highlighter outputs from the content model (Shiki
structure: 'inline', Prism, highlight.js), so a recipe change cannot break any of them.
Documentation plan
docs/components/code-block.md: purpose, the plain and highlighted examples, the supported recipe for each highlighter (and why Shiki's defaultcodeToHtmloutput does not fit), a Shiki dual-theme example that followsdata-ghost-mode, a shell sample withcopyText, a folded sample with the find-in-page limitation, an icon copy button through thecopyslot, anactionsslot link and a custom copy button, the generated props, events, slots, and hooks tables, accessibility notes (the fold is visual only; the failure fallback; copy must run inside the user's click), and thev-htmltrust note.- A clipboard section on the same page for
useGhostClipboardandwriteClipboardText, with a standalone "copy invite link" example that renders the announcement inGhostVisuallyHidden. - A prose page under
docs/themes/(the prose build names it): the class, the covered elements,.ghost-not-prose, the[data-part]limit (including third-partydata-part), nesting on and inside component parts, spacing around embedded components, density and modes (with the current B2 limitation), line length,--ghost-prose-scroll-margin, the--ghost-type-family-monooverride, and a wide-tableGhostScrollAreawrapper. - Token reference and
define-themedocs list--ghost-type-family-monoand distinguish it from themonotheme. - The themed wrapper strategy table in
docs/themes/default.mdlistsGhostCodeBlockunder the blockdivstrategy. - Typed executable examples under
examples/code-block/and the prose example directory, rendered with<GhostExample>, plus playground coverage.
Compatibility and release impact
- All additive: new exports in
@ghostvue/vueand@ghostvue/themes, two new recipe files, two new classes, one documented custom property, and one new semantic token. Nothing existing changes behavior. default.cssgrows by the two recipes. Apps on the opt-in recipe path are unaffected until they importrecipes/code-block.cssorrecipes/prose.css..ghost-prosestyles only descendants of an element that carries the class, plus block spacing on its direct children, so no existing page changes.- If the build extracts a shared helper from
useGhostScrollArea,GhostScrollAreaoutput stays identical; its existing tests must pass unchanged. - The new manifests start at
experimental. - Changesets: minor for
@ghostvue/vueand@ghostvue/themesin each build. - Docs site: deleting its local
copyToClipboardis internal to the docs app.
Design decisions
- D1. Ship all three together, as two builds. The clipboard helper and the code block ship in one build because the code block is the helper's first consumer and the docs site adopts both. Prose ships in a parallel build because it is CSS only and shares nothing but the mono token. None of the three stays a recipe-only documentation page: the feedback shows each app rebuilding all three.
- D2. No
execCommandfallback.document.execCommand('copy')is deprecated, needs a temporary focused textarea that steals focus and can scroll the page, and fails in the same embedded contexts where the Clipboard API is missing. Selecting the code, showing a visible message, and supplying the right text to the nativecopyevent keeps the reader in control and works everywhere. The copy button stays visible on insecure origins for the same reason. - D3. Highlighted markup goes in the default slot; no
htmlprop. A string-HTML prop would putv-htmlinside the library and make every consumer's highlighter output an XSS surface GhostVue appears to own. The slot keeps the trust decision visible in the consumer's template, and it accepts token-based renderers (ShikicodeToTokens) as well as HTML strings. The content model says exactly what fits. - D4. Latest request wins. Overlapping writes settle in any order. Only the latest one changes state, announces, emits, or selects text. Matches the docs site's current behavior.
- D5. Copy writes props, not DOM text. Reading
textContentfrom the slot would copy diff markers, prompts, and line-number gutters a highlighter renders.code(orcopyText) is the single source of truth, including for the nativecopyevent after a failure. - D6. The root is a
<div>, not a<figure>. A figure would need a figcaption to be named, and the only caption candidate is the title, which already names the scrollable region where a name is useful. A code sample is not a figure the article refers to, so the extra grouping adds noise. - D7. Constant copy button name and constant visible text. Changing the name to "Copied" under the pointer or focus is announced inconsistently and breaks voice control. Changing only the visible text would break label in name for the copied period. So both stay; success is shown with
data-stateand announced through the live region. - D8. The fold clips visually, has no disclosure state, and does not reuse
GhostCollapsible. A collapsed sample still shows its first lines, so hiding the panel is wrong. Removing lines from the DOM would require parsing consumer markup. Clipping keeps every line available to screen readers and the failure fallback, soaria-expandedwould misstate the content. Focus entering clipped content expands the fold. - D9. Prose is a class, not a
data-ghost-*attribute. The existingdata-ghost-theme,data-ghost-mode, anddata-ghost-densityattributes set token values that nest and inherit. Prose instead applies element styles to a subtree, which is what the existing.ghost-themeclass does. A class also matches what consumers expect from other prose utilities, and it is easy to add from markdown renderers. - D10. A mono family token. Components consume semantic tokens only, and there is no monospace token today. One token serves the code block, inline code, bare
pre, andkbdin prose.defineThemedoes not set it in this release. - D11. Prose stops at component parts.
@scopeproximity would otherwise let prose rules beat component recipes on every element inside an article, regardless of source order. The[data-part]limit keeps components on their own recipes, a separate rule gives them block spacing, and putting the class on or inside a part restores prose where it is wanted. - D12.
writeClipboardTextis public. Non-component code (the docs site's fence enhancer, a consumer's directive) needs the same failure contract without a Vue scope. It is the one non-useGhost*function in this spec, following the precedent ofdefineDataTableColumns.
Open architectural questions
None. D1–D12 are approved with the rest of the specification.
Approval
zprue743 approved this specification on 2026-12-01, on condition that every change recommended by an independent review of the first draft was applied. All recommended changes were applied before approval, including the two choices the review left open: the prose body uses --ghost-type-size-lg, and untitled overflowing samples keep the GhostScrollArea region rule with the language in the fallback name. Recorded in PR #705.
This is design approval only. It is not merge approval of any implementation or a release inclusion decision.