导航

v2.1.0
排版

命令片段

显示一条可复制的命令及其提示符,并提供复制该命令的按钮。

本页内容

命令片段用于复制一条命令,包含要在终端运行的命令行、提示符和复制按钮。它与代码块一样,采用等宽字体和凹槽样式,高度与按钮一致,可以并排摆放。提示符无法选中,命令始终保持单行。复制按钮距末端 4px,平时低调,指针悬停时才突出显示。

命令片段

<div class="snippet max-w(360) mx-auto">  <span class="snippet-prompt" aria-hidden="true">$</span>  <code class="snippet-command" tabindex="0">npm install @master/ui</code>  <button type="button" class="btn btn-quiet btn-square" aria-label="Copy command">    <svg class="icon snippet-icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">      <path d="M3 1.5H9A1.4999 1.4999 0 0 1 10.5 3V4.25H9.5V3A0.5002 0.5002 0 0 0 9 2.5H3A0.5002 0.5002 0 0 0 2.5 3V9A0.5002 0.5002 0 0 0 3 9.5H4.25V10.5H3A1.4999 1.4999 0 0 1 1.5 9V3A1.4999 1.4999 0 0 1 3 1.5Z" fill="currentColor" stroke="none" fill-rule="evenodd" /><rect x="5.5" y="5.5" width="8.5" height="8.5" rx="1" />    </svg>    <svg class="icon snippet-check" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">      <path d="M3 8L6.3532 11.3532A0.2 0.2 0 0 0 6.6412 11.3479L13 4.5" />    </svg>  </button>  <output class="snippet-status"></output></div><script>document.querySelectorAll('.snippet').forEach(function (snippet) {var status = snippet.querySelector('.snippet-status')var timer = 0snippet.querySelector('.btn').addEventListener('click', function () {  var command = Array.prototype.find.call(snippet.querySelectorAll('.snippet-command'), function (line) {    return line.checkVisibility()  })  navigator.clipboard.writeText(command.textContent).then(function () {    status.textContent = 'Copied'    clearTimeout(timer)    timer = setTimeout(function () { status.textContent = '' }, 2000)  })})})</script>
复制命令后,图标会变成对勾,持续两秒。

#命令行

snippet 分三列容纳三个元素。snippet-prompt 是终端显示在命令前的提示符,例如 $ 或 >,使用较淡的墨色。提示符无法选中,手动选择时只会选中命令。用 aria-hidden 标记提示符,屏幕阅读器就会跳过它。snippet-command 是命令,放在 <code> 上。最后是一枚低调的方形按钮,高度和圆角由命令片段设置,按钮高度为命令行高度减去上下各 4px。

命令超出行宽时保持单行,可横向滚动,滚动条隐藏,仍有内容的边缘呈渐隐效果。渐隐随滚动位置变化,起始边缘在滚动前保持清晰。为命令添加 tabindex="0",即可用方向键滚动,聚焦时整行会显示焦点环。

长命令

<div class="snippet max-w(360) mx-auto">  <span class="snippet-prompt" aria-hidden="true">$</span>  <code class="snippet-command" tabindex="0">    curl -fsSL https://ui.master.co/install.sh | sh -s -- --yes --prefix ~/.local  </code>  <button type="button" class="btn btn-quiet btn-square" aria-label="Copy command">    <svg class="icon snippet-icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">      <path d="M3 1.5H9A1.4999 1.4999 0 0 1 10.5 3V4.25H9.5V3A0.5002 0.5002 0 0 0 9 2.5H3A0.5002 0.5002 0 0 0 2.5 3V9A0.5002 0.5002 0 0 0 3 9.5H4.25V10.5H3A1.4999 1.4999 0 0 1 1.5 9V3A1.4999 1.4999 0 0 1 3 1.5Z" fill="currentColor" stroke="none" fill-rule="evenodd" /><rect x="5.5" y="5.5" width="8.5" height="8.5" rx="1" />    </svg>    <svg class="icon snippet-check" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">      <path d="M3 8L6.3532 11.3532A0.2 0.2 0 0 0 6.6412 11.3479L13 4.5" />    </svg>  </button>  <output class="snippet-status"></output></div><script>document.querySelectorAll('.snippet').forEach(function (snippet) {var status = snippet.querySelector('.snippet-status')var timer = 0snippet.querySelector('.btn').addEventListener('click', function () {  var command = Array.prototype.find.call(snippet.querySelectorAll('.snippet-command'), function (line) {    return line.checkVisibility()  })  navigator.clipboard.writeText(command.textContent).then(function () {    status.textContent = 'Copied'    clearTimeout(timer)    timer = setTimeout(function () { status.textContent = '' }, 2000)  })})})</script>
横向滚动命令时,哪一侧还有内容,哪一侧的边缘就会渐隐。

#复制命令

复制需要脚本,将命令文本传给 navigator.clipboard。复制状态不通过类名记录。按钮旁有一个初始为空、读者看不见的 <output>(snippet-status),用来表示复制状态。脚本写入「已复制」,屏幕阅读器会播报这条消息,两秒后脚本将其清空。状态元素有内容时,样式表会将复制图标换成对勾,使视觉反馈和语音反馈一致。

预览中的脚本包含完整流程:找到当前显示的命令,将其写入剪贴板,然后写入并清空状态消息。只有通过 HTTPS 提供或由 localhost 提供的页面才能访问剪贴板。脚本禁用时,复制按钮会隐藏,命令仍可作为文本手动选中和复制。

#包管理器

要为 npm、pnpm、bun 和 yarn 提供同一操作的命令,请在命令片段开头放置一个由原生单选按钮组成的分段控件,再按选项顺序为每个选项编写一个 snippet-command。控件省去自身的凹槽,沿命令片段顶部排列,下方有一条细线。选中项呈凸起面板,切换时面板会滑到新选中的选项。命令行显示与选中项位置对应的命令,无需脚本,最多支持六个选项。

包管理器

<div class="snippet max-w(360) mx-auto">  <div class="segmented" role="radiogroup" aria-label="Package manager">    <label class="segmented-item">      <input class="segmented-input" type="radio" name="manager" checked>npm    </label>    <label class="segmented-item">      <input class="segmented-input" type="radio" name="manager">pnpm    </label>    <label class="segmented-item">      <input class="segmented-input" type="radio" name="manager">bun    </label>    <label class="segmented-item">      <input class="segmented-input" type="radio" name="manager">yarn    </label>  </div>  <span class="snippet-prompt" aria-hidden="true">$</span>  <code class="snippet-command" tabindex="0">npm install @master/ui</code>  <code class="snippet-command" tabindex="0">pnpm add @master/ui</code>  <code class="snippet-command" tabindex="0">bun add @master/ui</code>  <code class="snippet-command" tabindex="0">yarn add @master/ui</code>  <button type="button" class="btn btn-quiet btn-square" aria-label="Copy command">    <svg class="icon snippet-icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">      <path d="M3 1.5H9A1.4999 1.4999 0 0 1 10.5 3V4.25H9.5V3A0.5002 0.5002 0 0 0 9 2.5H3A0.5002 0.5002 0 0 0 2.5 3V9A0.5002 0.5002 0 0 0 3 9.5H4.25V10.5H3A1.4999 1.4999 0 0 1 1.5 9V3A1.4999 1.4999 0 0 1 3 1.5Z" fill="currentColor" stroke="none" fill-rule="evenodd" /><rect x="5.5" y="5.5" width="8.5" height="8.5" rx="1" />    </svg>    <svg class="icon snippet-check" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">      <path d="M3 8L6.3532 11.3532A0.2 0.2 0 0 0 6.6412 11.3479L13 4.5" />    </svg>  </button>  <output class="snippet-status"></output></div><script>document.querySelectorAll('.snippet').forEach(function (snippet) {var status = snippet.querySelector('.snippet-status')var timer = 0snippet.querySelector('.btn').addEventListener('click', function () {  var command = Array.prototype.find.call(snippet.querySelectorAll('.snippet-command'), function (line) {    return line.checkVisibility()  })  navigator.clipboard.writeText(command.textContent).then(function () {    status.textContent = 'Copied'    clearTimeout(timer)    timer = setTimeout(function () { status.textContent = '' }, 2000)  })})})</script>
选择包管理器,命令行就会显示对应的命令。

#尺寸

命令片段默认高 38px,与按钮等高。snippet-sm 高 32px,字号为 12px,适合内容紧凑的页面或表格。snippet-lg 高 44px,字号为 14px,适合放在页面顶部,与大号按钮等高。在触摸屏上,各尺寸都保持原有高度;复制按钮的触控区域在其周围扩展至 44px。

尺寸

<div class="flex flex-col items-center gap-lg">  <div class="snippet snippet-sm">    <span class="snippet-prompt" aria-hidden="true">$</span>    <code class="snippet-command" tabindex="0">npx master-ui add button</code>    <button type="button" class="btn btn-quiet btn-square" aria-label="Copy command">      <svg class="icon snippet-icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">        <path d="M3 1.5H9A1.4999 1.4999 0 0 1 10.5 3V4.25H9.5V3A0.5002 0.5002 0 0 0 9 2.5H3A0.5002 0.5002 0 0 0 2.5 3V9A0.5002 0.5002 0 0 0 3 9.5H4.25V10.5H3A1.4999 1.4999 0 0 1 1.5 9V3A1.4999 1.4999 0 0 1 3 1.5Z" fill="currentColor" stroke="none" fill-rule="evenodd" /><rect x="5.5" y="5.5" width="8.5" height="8.5" rx="1" />      </svg>      <svg class="icon snippet-check" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">        <path d="M3 8L6.3532 11.3532A0.2 0.2 0 0 0 6.6412 11.3479L13 4.5" />      </svg>    </button>    <output class="snippet-status"></output>  </div>  <div class="snippet">    <span class="snippet-prompt" aria-hidden="true">$</span>    <code class="snippet-command" tabindex="0">npx master-ui add button</code>    <button type="button" class="btn btn-quiet btn-square" aria-label="Copy command">      <svg class="icon snippet-icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">        <path d="M3 1.5H9A1.4999 1.4999 0 0 1 10.5 3V4.25H9.5V3A0.5002 0.5002 0 0 0 9 2.5H3A0.5002 0.5002 0 0 0 2.5 3V9A0.5002 0.5002 0 0 0 3 9.5H4.25V10.5H3A1.4999 1.4999 0 0 1 1.5 9V3A1.4999 1.4999 0 0 1 3 1.5Z" fill="currentColor" stroke="none" fill-rule="evenodd" /><rect x="5.5" y="5.5" width="8.5" height="8.5" rx="1" />      </svg>      <svg class="icon snippet-check" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">        <path d="M3 8L6.3532 11.3532A0.2 0.2 0 0 0 6.6412 11.3479L13 4.5" />      </svg>    </button>    <output class="snippet-status"></output>  </div>  <div class="flex flex-wrap items-center justify-center gap-sm">    <a class="btn btn-primary btn-lg" href="#">Get started</a>    <div class="snippet snippet-lg">      <span class="snippet-prompt" aria-hidden="true">$</span>      <code class="snippet-command" tabindex="0">npm install @master/ui</code>      <button type="button" class="btn btn-quiet btn-square" aria-label="Copy command">        <svg class="icon snippet-icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">          <path d="M3 1.5H9A1.4999 1.4999 0 0 1 10.5 3V4.25H9.5V3A0.5002 0.5002 0 0 0 9 2.5H3A0.5002 0.5002 0 0 0 2.5 3V9A0.5002 0.5002 0 0 0 3 9.5H4.25V10.5H3A1.4999 1.4999 0 0 1 1.5 9V3A1.4999 1.4999 0 0 1 3 1.5Z" fill="currentColor" stroke="none" fill-rule="evenodd" /><rect x="5.5" y="5.5" width="8.5" height="8.5" rx="1" />        </svg>        <svg class="icon snippet-check" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">          <path d="M3 8L6.3532 11.3532A0.2 0.2 0 0 0 6.6412 11.3479L13 4.5" />        </svg>      </button>      <output class="snippet-status"></output>    </div>  </div></div><script>document.querySelectorAll('.snippet').forEach(function (snippet) {var status = snippet.querySelector('.snippet-status')var timer = 0snippet.querySelector('.btn').addEventListener('click', function () {  var command = Array.prototype.find.call(snippet.querySelectorAll('.snippet-command'), function (line) {    return line.checkVisibility()  })  navigator.clipboard.writeText(command.textContent).then(function () {    status.textContent = 'Copied'    clearTimeout(timer)    timer = setTimeout(function () { status.textContent = '' }, 2000)  })})})</script>

#命令片段与代码

命令片段用于运行单行命令。多行内容、供阅读的文件或输出放在代码块中,句子中提到的命令用行内代码标记。要按下的键用 kbd 标记。

#无障碍

  • 用 aria-hidden="true" 标记提示符。提示符仅作装饰,屏幕阅读器只需读出命令。
  • 为复制按钮设置 aria-label,例如「复制命令」。用 aria-hidden 标记按钮的图标。
  • 在标记中将 snippet-status 留空,内部也不要保留空白字符。脚本写入「已复制」后,屏幕阅读器会播报该消息。<output> 自带实时区域语义,会在合适的时机播报更新。
  • 为命令添加 tabindex="0",以便用键盘滚动超出行宽的命令。
  • 在强制颜色模式下,渐隐效果会移除,凹槽以轮廓线勾勒,提示符使用系统灰色文本颜色。

#类名

类名说明
snippet命令条采用凹槽样式,高 38px,使用等宽字体,分三列放置提示符、命令和按钮。
snippet-sm命令条高 32px,字号为 12px。默认高度为 38px。与 snippet 一同使用
snippet-lg命令条高 44px,字号为 14px,用于页面顶部。与 snippet 一同使用
snippet-prompt提示符 $ 或 > 使用较低对比度的墨色,不可选中。为其设置 aria-hidden="true"
snippet-command将命令放在 <code> 上,保持单行不换行,允许横向滚动,并在仍有内容的边缘渐隐。设置 tabindex="0"。搭配分段控件时,按选项顺序各写一条命令,最多六条。
snippet-icon按钮内的复制图标,使用 icon 类。状态显示命令已复制后,该图标让出位置。
snippet-check按钮内的对勾图标使用 icon 类,放在复制图标之后。复制完成后,对勾取代复制图标。
snippet-status一个不可见的空 <output>,用于播报脚本写入的内容。写入内容后,复制图标变为对勾,清空后恢复。

#自定义属性

属性默认值说明
--snippet-height2.375rem命令条的整体高度。按钮比命令条矮 8px,上下各内缩 4px。在 snippet 上设置
--snippet-radiusvar(--radius-control)凹槽在应用圆角缩放系数前的圆形半径;按钮和各选项的半径为此值减去各自的内缩量 4px在 snippet 上设置
--snippet-fade1.5rem长命令在边缘仍有后续内容时的渐隐长度在 snippet 上设置

#源码

@master/ui/components/snippet.css
/* * Snippet: a command to copy, on one line: the prompt, the command and a button that copies it. * The line is a well, as a code block is: literal text is cut into the page, and the button that takes it is a * quiet control 4px in from the end, which rises as a sheet under the pointer as it does in a code panel. The * well is as tall as a button (32, 38 and 44px), so a snippet can stand in a row beside one, as an install line * stands beside the main action of a hero. * The prompt is a glyph in the mono face, quieter than the command; it cannot be selected and is not read aloud, * so selecting the line by hand takes the command alone. The command never wraps: a long one scrolls sideways * and fades at the edge where it goes on, read from its own scroll position. Without scroll-driven animations * it scrolls the same, with clean edges. * Copied is not a class: the script writes "Copied" into an <output> beside the button, which announces it, and * the stylesheet reads that the output is no longer empty and turns the copy icon into a check. Emptying it turns * it back. Without scripting the button is not drawn, and the command is still text to select. * With a segmented control in it, the snippet holds one command per package manager: the control gives up its * own well and lies along the top over a hairline, and the command whose place matches the checked option is * the one shown, for up to six, with no script. */@property --snippet-fade-start {  syntax: '<length>';  inherits: false;  initial-value: 0px;}@property --snippet-fade-end {  syntax: '<length>';  inherits: false;  initial-value: 0px;}@layer components.ui {  .snippet {    --snippet-height: 2.375rem;    --snippet-radius: var(--radius-control);    --snippet-padding-x: .875rem;    --snippet-font-size: .8125rem;    --snippet-fade: 1.5rem;    position: relative;    /* Three columns: the prompt, the command and the button. A row of options takes a row of its own above. */    display: grid;    grid-template-columns: auto minmax(0, 1fr) auto;    grid-auto-rows: minmax(var(--snippet-height), auto);    align-items: center;    min-width: 0;    margin: 0;    padding-block: 0;    padding-inline: var(--snippet-padding-x) 4px;    border-radius: calc(var(--snippet-radius) * var(--corner-scale));    corner-shape: var(--corner-shape);    background: var(--color-surface-inset);    color: var(--color-text-strong);    box-shadow: var(--shadow-pressed);    font: 400 var(--snippet-font-size)/1.5 var(--font-family-mono);    font-variant-ligatures: none;    /* A command is literal: no space the page adds between scripts and no trimmed punctuation in it. */    text-autospace: no-autospace;    text-spacing-trim: space-all;    &.snippet-sm {      --snippet-height: 2rem;      --snippet-radius: var(--radius-control-sm);      --snippet-padding-x: .75rem;      --snippet-font-size: .75rem;    }    &.snippet-lg {      --snippet-height: 2.75rem;      --snippet-radius: var(--radius-control-lg);      --snippet-padding-x: 1rem;      --snippet-font-size: .875rem;      .btn {        --icon-size: 1rem;      }    }    /* Focus on the command, which scrolls with the arrow keys, rings the whole line. */    &:has(.snippet-command:focus-visible) {      @apply --focus-ring;    }    /*     * The button in the well sits 4px in, so its corner is the well's corner minus that inset. It does not lift:     * it rises out of the well instead.     */    .btn {      --btn-height: calc(var(--snippet-height) - 8px);      --btn-radius: calc(var(--snippet-radius) - 4px / var(--corner-scale));      --btn-lift: 0px;      --icon-size: .875rem;      --icon-offset: 0px;      grid-column: 3;      min-height: var(--btn-height);      margin-inline-start: .375rem;      /* A square one stays square on touch, where a button alone would widen to 44px. */      &.btn-square {        min-width: var(--btn-height);      }    }    /*     * Package managers: the segmented control lies along the top of the well, over a hairline, and gives up its     * own well; its options rise out of the snippet's, 4px in, as tall and as round as the button below.     */    .segmented {      --segmented-inset: 4px;      --segmented-item-height: calc(var(--snippet-height) - 8px);      --segmented-item-radius: calc(var(--snippet-radius) - 4px / var(--corner-scale));      --segmented-font-size: .75rem;      display: flex;      grid-column: 1 / -1;      align-self: stretch;      gap: 2px;      max-width: none;      margin-inline: calc(-1 * var(--snippet-padding-x)) -4px;      border-radius: 0;      border-block-end: 1px solid var(--color-line-hair);      background: none;      box-shadow: none;    }    .segmented-item {      flex: none;      min-width: 0;      padding-inline: .625rem;    }    /* Each option shows the command in its place; the others step aside. */    &:has(.segmented) .snippet-command {      display: none;    }    &:has(.segmented-item:nth-child(1 of .segmented-item) .segmented-input:checked) .snippet-command:nth-child(1 of .snippet-command),    &:has(.segmented-item:nth-child(2 of .segmented-item) .segmented-input:checked) .snippet-command:nth-child(2 of .snippet-command),    &:has(.segmented-item:nth-child(3 of .segmented-item) .segmented-input:checked) .snippet-command:nth-child(3 of .snippet-command),    &:has(.segmented-item:nth-child(4 of .segmented-item) .segmented-input:checked) .snippet-command:nth-child(4 of .snippet-command),    &:has(.segmented-item:nth-child(5 of .segmented-item) .segmented-input:checked) .snippet-command:nth-child(5 of .snippet-command),    &:has(.segmented-item:nth-child(6 of .segmented-item) .segmented-input:checked) .snippet-command:nth-child(6 of .snippet-command) {      display: block;    }    /* Copying needs a script; without one the button would do nothing, so it is not drawn. */    @media (scripting: none) {      .btn {        display: none;      }    }    @media (forced-colors: active) {      outline: 1px solid CanvasText;      outline-offset: -1px;      /* The control gave up its own well, so it gives up the outline that draws one too; the hairline stays. */      .segmented {        outline: none;      }      &:has(.snippet-command:focus-visible) {        outline: 2px solid Highlight;        outline-offset: 2px;      }    }  }  /* The prompt: a glyph such as $ or >, quieter than the command. Mark it aria-hidden. */  .snippet-prompt {    grid-column: 1;    margin: 0;    margin-inline-end: 1ch;    color: var(--color-text-muted);    font: inherit;    user-select: none;    -webkit-user-select: none;    @media (forced-colors: active) {      color: GrayText;    }  }  /*   * The command: one line that scrolls sideways and never wraps, with no scrollbar. Give it tabindex="0" so the   * keys can scroll it. Where it goes on past an edge, that edge fades.   */  .snippet-command {    display: block;    grid-column: 2;    min-width: 0;    margin: 0;    padding: 0;    overflow: auto hidden;    background: none;    color: inherit;    font: inherit;    white-space: pre;    outline: none;    scrollbar-width: none;    overscroll-behavior-inline: contain;    &::-webkit-scrollbar {      display: none;    }    @supports (animation-timeline: scroll()) {      /* From the start edge to the end edge: right to left, the start edge is on the right. */      --snippet-run: to right;      mask-image: linear-gradient(var(--snippet-run), transparent, black var(--snippet-fade-start), black calc(100% - var(--snippet-fade-end)), transparent);      /* Longhands: tools that fold the timeline into the shorthand write a value no browser reads. */      animation-name: snippet-fade-start, snippet-fade-end;      animation-timing-function: linear;      animation-fill-mode: both;      animation-timeline: scroll(self inline), scroll(self inline);      animation-range: 0 var(--snippet-fade), calc(100% - var(--snippet-fade)) 100%;      &:dir(rtl) {        --snippet-run: to left;      }    }    @media (forced-colors: active) {      mask-image: none;    }  }  /*   * The copy icon, and the check that takes its place once copied, in the strong ink. Both sit in the button, one   * over the other; the swap is a quick cross-fade, and with motion the check grows into place as the icon shrinks.   */  .snippet-icon, .snippet-check {    transition-property: opacity, scale;    transition-duration: var(--duration-quick);    transition-timing-function: var(--easing-glide);  }  .snippet-check {    position: absolute;    inset: 0;    margin: auto;    color: var(--color-text-strong);    opacity: 0;  }  .snippet:has(.snippet-status:not(:empty)) {    .snippet-icon {      opacity: 0;    }    .snippet-check {      opacity: 1;    }  }  @media (prefers-reduced-motion: no-preference) {    .snippet-check {      scale: .6;    }    .snippet:has(.snippet-status:not(:empty)) {      .snippet-icon {        scale: .6;      }      .snippet-check {        scale: 1;      }    }  }  /* An <output> the script writes "Copied" into: announced, never seen. The icon says it to the eye. */  .snippet-status {    position: absolute;    width: 1px;    height: 1px;    margin: 0;    overflow: hidden;    clip-path: inset(50%);    white-space: nowrap;  }}@keyframes snippet-fade-start {  from {    --snippet-fade-start: 0px;  }  to {    --snippet-fade-start: var(--snippet-fade);  }}@keyframes snippet-fade-end {  from {    --snippet-fade-end: var(--snippet-fade);  }  to {    --snippet-fade-end: 0px;  }}