Export mastering
Tune output gain and passband filter before rendering the stem.
Package: @ghostvue/themes. Status: experimental (stability policy).
Themed wrapper around headless GhostSlider. Same behavioral props plus tone and size. Importing it loads the default stylesheet and scopes track, range, and thumb recipes to this instance.
Generated from the component manifest. Edit the manifest or Vue source, then rebuild the docs.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
tone | 'accent' | 'neutral' | 'danger' | "accent" | No | Semantic color intent for the range fill and thumb ring. |
size | 'sm' | 'md' | 'lg' | "md" | No | Track thickness and thumb diameter. |
None declared.
| Prop | Event | Type | Description |
|---|---|---|---|
modelValue | update:modelValue | GhostSliderValue | Forwarded v-model binding. |
None declared.
| Name | Type | Description |
|---|---|---|
element | HTMLElement | null | Unstyled root inside the themed scope. |
value | GhostSliderValue | Current slider value. |
| Attribute | Value | Description |
|---|---|---|
data-part | root | ghost-themed-scope wrapper; display contents. |
data-part | track | Muted track background. |
data-part | range | Accent fill between thumbs or from min. |
data-part | thumb | Circular handle with focus ring. |
| Name | Description |
|---|---|
--ghost-surface-muted-bg | Track background. |
--ghost-action-primary-bg | Default range fill and thumb ring. |
--ghost-track-thickness-sm | Track and range thickness for size sm. Density-independent. |
--ghost-track-thickness-md | Track and range thickness for size md. Density-independent. |
--ghost-track-thickness-lg | Track and range thickness for size lg. Density-independent. |
--ghost-track-thumb-sm | Thumb diameter for size sm. |
--ghost-track-thumb-md | Thumb diameter for size md. |
--ghost-track-thumb-lg | Thumb diameter for size lg. |
--ghost-track-target | Minimum pointer hit size around the track cross axis and the thumb. |
Role: slider. APG pattern: https://www.w3.org/WAI/ARIA/apg/patterns/slider/.
Required ARIA attributes: none.
None declared.
Each category is reviewed separately. Automated keyboard and axe results do not attest manual or assistive-technology review.
| Category | Status | Evidence |
|---|---|---|
| Automated keyboard | Not reviewed | No declared key is mapped to a browser test yet. |
| Manual interaction | Not reviewed | No review recorded. |
| Assistive technology | Not reviewed | No review recorded. |
Single, range, and disabled GhostSlider controls with live value readouts.
Tune output gain and passband filter before rendering the stem.
<script setup lang="ts">
import { computed, ref } from 'vue'
import { GhostButton, GhostCard, GhostSlider } from '@ghostvue/themes'
const masterGain = ref(72)
const bandRange = ref<[number, number]>([250, 1400])
const limiter = ref(90)
const status = ref('')
const rangeLabel = computed(
() => `${String(bandRange.value[0])} Hz – ${String(bandRange.value[1])} Hz`,
)
function resetMixer(): void {
masterGain.value = 72
bandRange.value = [250, 1400]
status.value = 'Audio levels reset to defaults.'
}
</script>
<template>
<section class="mixer" aria-labelledby="mixer-title">
<GhostCard>
<template #header>
<div class="mixer__header">
<h2 id="mixer-title" class="mixer__title">Export mastering</h2>
<p class="mixer__lead">
Tune output gain and passband filter before rendering the stem.
</p>
</div>
</template>
<div class="mixer__controls">
<div class="mixer__row">
<div class="mixer__row-head">
<span id="mixer-gain-label" class="mixer__label">
Master output
</span>
<span class="mixer__value">{{ masterGain }}%</span>
</div>
<GhostSlider
v-model="masterGain"
:min="0"
:max="100"
:step="1"
aria-labelledby="mixer-gain-label"
:style="{ inlineSize: '100%' }"
:value-text="`${masterGain} percent`"
@update:model-value="status = ''"
/>
</div>
<div class="mixer__row">
<div class="mixer__row-head">
<!--
aria-valuetext applies to single-thumb sliders only, so the
label carries the unit for both range thumbs.
-->
<span id="mixer-band-label" class="mixer__label">
Passband frequency (Hz)
</span>
<span class="mixer__value">{{ rangeLabel }}</span>
</div>
<GhostSlider
v-model="bandRange"
range
:min="100"
:max="2000"
:step="50"
aria-labelledby="mixer-band-label"
:style="{ inlineSize: '100%' }"
@update:model-value="status = ''"
/>
</div>
<div class="mixer__row">
<div class="mixer__row-head">
<span id="mixer-limiter-label" class="mixer__label">
Safety limiter (locked)
</span>
<span class="mixer__value">{{ limiter }}%</span>
</div>
<GhostSlider
v-model="limiter"
disabled
:min="0"
:max="100"
tone="neutral"
aria-labelledby="mixer-limiter-label"
:style="{ inlineSize: '100%' }"
:value-text="`${limiter} percent`"
/>
</div>
</div>
<template #footer>
<div class="mixer__actions">
<p class="mixer__status" role="status">{{ status }}</p>
<GhostButton
type="button"
variant="ghost"
tone="neutral"
class="mixer__action"
@click="resetMixer"
>
Reset levels
</GhostButton>
</div>
</template>
</GhostCard>
</section>
</template>
<style scoped>
.mixer {
max-inline-size: 34rem;
}
.mixer__header {
display: grid;
gap: var(--ghost-space-gap-xs);
padding-block-end: var(--ghost-space-stack-sm);
}
.mixer__title {
color: var(--ghost-text-default);
font-size: var(--ghost-type-size-lg);
font-weight: var(--ghost-type-weight-semibold);
line-height: var(--ghost-type-line-tight);
margin: 0;
}
.mixer__lead,
.mixer__status {
color: var(--ghost-text-muted);
font-size: var(--ghost-type-size-sm);
line-height: var(--ghost-type-line-snug);
margin: 0;
overflow-wrap: anywhere;
}
.mixer__controls {
display: grid;
gap: var(--ghost-space-stack-lg);
}
.mixer__row {
display: grid;
gap: var(--ghost-space-gap-sm);
}
.mixer__row-head {
align-items: baseline;
display: flex;
flex-wrap: wrap;
gap: var(--ghost-space-gap-sm);
justify-content: space-between;
}
.mixer__label {
color: var(--ghost-text-default);
font-size: var(--ghost-type-size-sm);
font-weight: var(--ghost-type-weight-medium);
line-height: var(--ghost-type-line-snug);
}
.mixer__value {
color: var(--ghost-text-muted);
font-size: var(--ghost-type-size-xs);
font-variant-numeric: tabular-nums;
line-height: var(--ghost-type-line-snug);
}
.mixer__actions {
display: grid;
gap: var(--ghost-space-gap-sm) var(--ghost-space-gap-md);
}
.mixer :deep(.mixer__action) {
inline-size: 100%;
}
@container ghost-demo (min-width: 30rem) {
.mixer__actions {
align-items: center;
display: flex;
justify-content: flex-end;
}
.mixer__status {
flex: 1 1 auto;
}
.mixer :deep(.mixer__action) {
inline-size: auto;
}
}
</style>
Two-thumb nightly price range in USD with a live count of matching stays.
5 of 8 stays match
<script setup lang="ts">
import { computed, ref } from 'vue'
import { GhostButton, GhostCard, GhostSlider } from '@ghostvue/themes'
const MIN_PRICE = 40
const MAX_PRICE = 400
const stays = [
{ name: 'Harbor loft', price: 65 },
{ name: 'Garden studio', price: 90 },
{ name: 'Old town flat', price: 120 },
{ name: 'Canal house', price: 155 },
{ name: 'Hillside cabin', price: 180 },
{ name: 'Rooftop suite', price: 240 },
{ name: 'Lakeside villa', price: 320 },
{ name: 'Vineyard estate', price: 395 },
] as const
const price = ref<[number, number]>([80, 240])
const usd = new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'USD',
maximumFractionDigits: 0,
})
const priceLabel = computed(
() =>
`${usd.format(price.value[0])} – ${usd.format(price.value[1])} per night`,
)
const matches = computed(() =>
stays.filter(
(stay) => stay.price >= price.value[0] && stay.price <= price.value[1],
),
)
const isFullRange = computed(
() => price.value[0] === MIN_PRICE && price.value[1] === MAX_PRICE,
)
function showAnyPrice(): void {
price.value = [MIN_PRICE, MAX_PRICE]
}
</script>
<template>
<section class="price-filter" aria-labelledby="price-filter-title">
<GhostCard>
<template #header>
<h2 id="price-filter-title" class="price-filter__title">
Filter stays
</h2>
</template>
<div class="price-filter__row">
<div class="price-filter__row-head">
<!--
Range thumbs take their names from this label plus "minimum" and
"maximum". aria-valuetext is single-thumb only, so the label
carries the unit and the visible readout spells out the range.
-->
<span id="price-filter-label" class="price-filter__label">
Nightly price (USD)
</span>
<span class="price-filter__value">{{ priceLabel }}</span>
</div>
<!-- The root defaults to 12rem; an inline style object widens it to the card. -->
<GhostSlider
v-model="price"
range
:min="MIN_PRICE"
:max="MAX_PRICE"
:step="10"
name="price-min"
name-max="price-max"
aria-labelledby="price-filter-label"
:style="{ inlineSize: '100%' }"
/>
<div class="price-filter__scale" aria-hidden="true">
<span>{{ usd.format(MIN_PRICE) }}</span>
<span>{{ usd.format(MAX_PRICE) }}</span>
</div>
</div>
<template #footer>
<div class="price-filter__footer">
<p class="price-filter__count" role="status">
{{ matches.length }} of {{ stays.length }} stays match
</p>
<GhostButton
type="button"
variant="ghost"
tone="neutral"
size="sm"
:disabled="isFullRange"
@click="showAnyPrice"
>
Any price
</GhostButton>
</div>
</template>
</GhostCard>
</section>
</template>
<style scoped>
.price-filter {
max-inline-size: 30rem;
}
.price-filter__title {
color: var(--ghost-text-default);
font-size: var(--ghost-type-size-lg);
font-weight: var(--ghost-type-weight-semibold);
line-height: var(--ghost-type-line-tight);
margin: 0;
}
.price-filter__row {
display: grid;
gap: var(--ghost-space-gap-sm);
}
.price-filter__row-head,
.price-filter__footer {
align-items: center;
display: flex;
flex-wrap: wrap;
gap: var(--ghost-space-gap-sm);
justify-content: space-between;
}
.price-filter__label {
color: var(--ghost-text-default);
font-size: var(--ghost-type-size-sm);
font-weight: var(--ghost-type-weight-medium);
line-height: var(--ghost-type-line-snug);
}
.price-filter__value {
color: var(--ghost-text-default);
font-size: var(--ghost-type-size-sm);
font-variant-numeric: tabular-nums;
line-height: var(--ghost-type-line-snug);
}
.price-filter__scale {
color: var(--ghost-text-muted);
display: flex;
font-size: var(--ghost-type-size-xs);
font-variant-numeric: tabular-nums;
justify-content: space-between;
line-height: var(--ghost-type-line-snug);
}
.price-filter__count {
color: var(--ghost-text-muted);
font-size: var(--ghost-type-size-sm);
line-height: var(--ghost-type-line-snug);
margin: 0;
}
</style>
Themed vertical orientation and tokens.
Gain 60%
<script setup lang="ts">
import { ref } from 'vue'
import { GhostSlider } from '@ghostvue/themes'
const level = ref(60)
</script>
<template>
<GhostSlider
v-model="level"
orientation="vertical"
aria-label="Channel gain"
:min="0"
:max="100"
:value-text="`${level} percent`"
/>
<!-- Fixed line-height avoids subpixel line-box drift in visual snapshots. -->
<p style="margin: 0; line-height: var(--ghost-font-line-body, 1.25rem)">
Gain {{ level }}%
</p>
</template>
A test-signal slider drives a pausable level meter with a hysteresis status that respects reduced motion and motion intensity.
A seeded test signal sends 20 samples a second. Move the slider to change it.
Signal detected
<script setup lang="ts">
import { computed, onBeforeUnmount, onMounted, ref, shallowRef } from 'vue'
import { GhostButton, GhostSlider } from '@ghostvue/themes'
type SignalStatus = 'quiet' | 'signal'
interface Reading {
level: number
status: SignalStatus
}
/** One sample every 50 ms: 20 samples per second. */
const SAMPLE_INTERVAL_MS = 50
/** Largest fluctuation the test source adds around the slider level. */
const FLUCTUATION = 6
/*
* Hysteresis: a quiet input must reach 30 to count as a signal, and a signal
* must drop below 15 to count as quiet again. The gap is wider than the
* source's ±6 fluctuation, so an input that stays near one level never flips
* the status (or the polite announcement) back and forth.
*/
const SIGNAL_ON = 30
const SIGNAL_OFF = 15
const statusText: Record<SignalStatus, string> = {
quiet: 'Quiet',
signal: 'Signal detected',
}
function nextStatus(previous: SignalStatus, level: number): SignalStatus {
if (previous === 'quiet') return level >= SIGNAL_ON ? 'signal' : 'quiet'
return level < SIGNAL_OFF ? 'quiet' : 'signal'
}
/*
* Seeded fluctuation (mulberry32) instead of Math.random, so every run, test,
* and screenshot sees the same sequence of samples for the same inputs.
*/
function seededFluctuation(seed: number): () => number {
let state = seed >>> 0
return () => {
state = (state + 0x6d2b79f5) >>> 0
let t = state
t = Math.imul(t ^ (t >>> 15), t | 1)
t ^= t + Math.imul(t ^ (t >>> 7), t | 61)
const unit = ((t ^ (t >>> 14)) >>> 0) / 4294967296
return (unit * 2 - 1) * FLUCTUATION
}
}
/*
* The app supplies the samples. Here a test source turns the slider level
* into a sample stream; a real app would forward readings from its own audio
* pipeline through the same subscribe/unsubscribe shape. Subscribing emits
* the current level at once, so a view that comes back on screen does not
* wait a sample period for its first reading.
*/
function createTestSignal(level: () => number, seed: number) {
const fluctuate = seededFluctuation(seed)
return {
subscribe(listener: (sample: number) => void): () => void {
const emit = () => {
const sample = Math.round(level() + fluctuate())
listener(Math.min(100, Math.max(0, sample)))
}
emit()
const timer = setInterval(emit, SAMPLE_INTERVAL_MS)
return () => {
clearInterval(timer)
}
},
}
}
const sourceLevel = ref(64)
const source = createTestSignal(() => sourceLevel.value, 0x5eed)
/*
* The first paint comes from the slider default, not from a sample, so the
* server render and the hydrated client agree on the level and status.
*/
const initialStatus: SignalStatus =
sourceLevel.value >= SIGNAL_ON ? 'signal' : 'quiet'
const reading = shallowRef<Reading>({
level: sourceLevel.value,
status: initialStatus,
})
const paused = ref(false)
const meter = ref<HTMLElement | null>(null)
/*
* The live input and its status keep updating while the view is paused, so
* Resume can show the current input at once. They are plain variables: only
* `reading` drives the template, at most once per animation frame.
*/
let liveLevel = reading.value.level
let liveStatus = reading.value.status
let frame: number | undefined
let unsubscribe: (() => void) | undefined
let pageVisible = true
let onScreen = true
let reducedMotion = false
let releaseListeners: (() => void) | undefined
const readingText = computed(() => {
const status = statusText[reading.value.status]
return paused.value ? `Paused: ${status}` : status
})
const valueText = computed(() => {
const status = statusText[reading.value.status].toLowerCase()
const level = `${String(reading.value.level)}%`
return paused.value ? `${level}, ${status}, paused` : `${level}, ${status}`
})
/*
* Reduced motion, or `--ghost-motion-intensity: 0` on any ancestor, keeps
* the bar still: it moves only when the status changes. Intensity is read
* from the meter's computed style so a subtree setting applies here too.
*/
function keepsStill(): boolean {
if (reducedMotion) return true
if (!meter.value) return false
const intensity = Number.parseFloat(
getComputedStyle(meter.value).getPropertyValue('--ghost-motion-intensity'),
)
return intensity === 0
}
function paint(): void {
frame = undefined
reading.value = { level: liveLevel, status: liveStatus }
}
function cancelPaint(): void {
if (frame === undefined) return
cancelAnimationFrame(frame)
frame = undefined
}
function onSample(level: number): void {
const status = nextStatus(liveStatus, level)
const changed = status !== liveStatus
liveLevel = level
liveStatus = status
if (paused.value) return
if (!changed && keepsStill()) return
// Coalesce samples: several can arrive between frames, one paint wins.
frame ??= requestAnimationFrame(paint)
}
/*
* Offscreen or in a hidden tab nobody can read the meter, so the sample
* subscription and any pending paint are released and restored on return.
* This is separate from `paused`, which only the user changes.
*/
function syncSubscription(): void {
const active = pageVisible && onScreen
if (active && !unsubscribe) {
unsubscribe = source.subscribe(onSample)
} else if (!active && unsubscribe) {
unsubscribe()
unsubscribe = undefined
cancelPaint()
}
}
function togglePause(): void {
if (paused.value) {
paused.value = false
// Show the current input immediately rather than on the next sample.
cancelPaint()
paint()
} else {
// Drop a paint that is already queued so the held reading is the one
// on screen when Pause was pressed.
cancelPaint()
paused.value = true
}
}
// Browser APIs are read only after mount, so server markup never depends on
// them and hydration starts from the same reading.
onMounted(() => {
const cleanups: (() => void)[] = []
const onVisibility = () => {
pageVisible = document.visibilityState !== 'hidden'
syncSubscription()
}
pageVisible = document.visibilityState !== 'hidden'
document.addEventListener('visibilitychange', onVisibility)
cleanups.push(() => {
document.removeEventListener('visibilitychange', onVisibility)
})
if (typeof window.matchMedia === 'function') {
const query = window.matchMedia('(prefers-reduced-motion: reduce)')
const onMotion = () => {
reducedMotion = query.matches
}
reducedMotion = query.matches
query.addEventListener('change', onMotion)
cleanups.push(() => {
query.removeEventListener('change', onMotion)
})
}
if (typeof IntersectionObserver === 'function' && meter.value) {
// Wait for the first intersection report before sampling.
onScreen = false
const observer = new IntersectionObserver((entries) => {
const entry = entries.at(-1)
if (!entry) return
onScreen = entry.isIntersecting
syncSubscription()
})
observer.observe(meter.value)
cleanups.push(() => {
observer.disconnect()
})
}
releaseListeners = () => {
for (const cleanup of cleanups) cleanup()
}
syncSubscription()
})
onBeforeUnmount(() => {
releaseListeners?.()
unsubscribe?.()
unsubscribe = undefined
cancelPaint()
})
</script>
<template>
<section class="level-check" aria-labelledby="level-check-title">
<div class="level-check__header">
<h2 id="level-check-title" class="level-check__title">Input check</h2>
<p class="level-check__lead">
A seeded test signal sends 20 samples a second. Move the slider to
change it.
</p>
</div>
<div class="level-check__reading">
<div class="level-check__row">
<span id="level-check-meter-label" class="level-check__label">
Input level
</span>
<span class="level-check__value" aria-hidden="true">
{{ reading.level }}%
</span>
</div>
<!--
role="meter": this is a live measurement, not task progress, so
GhostProgress (a progressbar) does not fit. aria-valuetext carries
the status, so the reading makes sense without the bar.
-->
<div
ref="meter"
class="level-check__meter"
role="meter"
aria-labelledby="level-check-meter-label"
aria-describedby="level-check-status"
aria-valuemin="0"
aria-valuemax="100"
:aria-valuenow="reading.level"
:aria-valuetext="valueText"
:data-status="reading.status"
:data-paused="paused ? '' : undefined"
>
<div
class="level-check__fill"
:style="{ transform: `scaleX(${String(reading.level / 100)})` }"
/>
</div>
<!--
Polite status: hysteresis keeps it to real changes, so it is not
announced on every sample.
-->
<p
id="level-check-status"
class="level-check__status"
role="status"
:data-status="reading.status"
:data-paused="paused ? '' : undefined"
>
{{ readingText }}
</p>
</div>
<div class="level-check__controls">
<div class="level-check__row">
<span id="level-check-source-label" class="level-check__label">
Test signal level
</span>
<span class="level-check__value">{{ sourceLevel }}%</span>
</div>
<GhostSlider
v-model="sourceLevel"
:min="0"
:max="100"
:step="1"
aria-labelledby="level-check-source-label"
:value-text="`${String(sourceLevel)} percent`"
:style="{ inlineSize: '100%' }"
/>
<!--
One button whose name says the next action. Focus stays on it when
the name changes, so Enter or Space toggles back from the same place.
-->
<GhostButton
class="level-check__toggle"
variant="outline"
tone="neutral"
@click="togglePause"
>
{{ paused ? 'Resume' : 'Pause' }}
</GhostButton>
</div>
</section>
</template>
<style scoped>
.level-check {
display: grid;
gap: var(--ghost-space-stack-lg);
max-inline-size: 30rem;
}
.level-check__header,
.level-check__reading,
.level-check__controls {
display: grid;
gap: var(--ghost-space-gap-sm);
}
.level-check__title {
color: var(--ghost-text-default);
font-size: var(--ghost-type-size-lg);
font-weight: var(--ghost-type-weight-semibold);
line-height: var(--ghost-type-line-tight);
margin: 0;
}
.level-check__lead {
color: var(--ghost-text-muted);
font-size: var(--ghost-type-size-sm);
line-height: var(--ghost-type-line-snug);
margin: 0;
}
.level-check__row {
align-items: baseline;
display: flex;
gap: var(--ghost-space-gap-sm);
justify-content: space-between;
}
.level-check__label {
color: var(--ghost-text-default);
font-size: var(--ghost-type-size-sm);
font-weight: var(--ghost-type-weight-medium);
line-height: var(--ghost-type-line-snug);
}
.level-check__value {
color: var(--ghost-text-muted);
font-size: var(--ghost-type-size-xs);
font-variant-numeric: tabular-nums;
line-height: var(--ghost-type-line-snug);
}
.level-check__meter {
background-color: var(--ghost-border-default);
block-size: var(--ghost-track-thickness-lg);
border-radius: var(--ghost-radius-pill);
overflow: hidden;
}
/*
* The fill scales instead of resizing, so each sample is a compositor-only
* change with no layout. Its transition uses the shared fast duration and
* standard easing; both follow --ghost-motion-intensity on any ancestor.
*/
.level-check__fill {
background-color: var(--ghost-text-muted);
block-size: 100%;
transform-origin: left center;
transition: transform var(--ghost-motion-duration-fast)
var(--ghost-motion-easing-standard);
}
.level-check__fill:dir(rtl) {
transform-origin: right center;
}
.level-check__meter[data-status='signal'] .level-check__fill {
background-color: var(--ghost-status-success-fg);
}
.level-check__meter[data-paused] .level-check__fill {
background-color: var(--ghost-border-strong);
}
.level-check__status {
color: var(--ghost-text-default);
font-size: var(--ghost-type-size-sm);
font-weight: var(--ghost-type-weight-medium);
line-height: var(--ghost-type-line-snug);
margin: 0;
}
.level-check__status[data-status='signal']:not([data-paused]) {
color: var(--ghost-text-success);
}
.level-check :deep(.level-check__toggle) {
justify-self: start;
min-inline-size: 6.5rem;
}
/* Under reduced motion the bar jumps to a new status; it never travels. */
@media (prefers-reduced-motion: reduce) {
.level-check__fill {
transition: none;
}
}
@media (forced-colors: active) {
.level-check__meter {
background-color: Canvas;
border: 1px solid CanvasText;
}
.level-check__fill,
.level-check__meter[data-status='signal'] .level-check__fill,
.level-check__meter[data-paused] .level-check__fill {
background-color: Highlight;
}
}
</style>