탐색

v2.1.0
오버레이

플로팅 패널

사용자가 옮기고, 크기를 바꾸고, 헤더만 남도록 접고, 닫을 수 있는 떠 있는 표면입니다.

이 페이지의 내용

플로팅 패널은 작업 화면 옆에 열린 채로 머무르면서도 그 아래의 페이지를 계속 사용할 수 있게 하는 떠 있는 표면입니다. 캔버스의 레이어, 색상 선택기, 속성 검사기, 채팅 등에 사용합니다. 사용자는 헤더를 잡아 패널을 드래그하고, 모서리에서 크기를 바꾸고, 헤더만 남도록 접고, 닫을 수 있습니다. 플로팅 패널은 role="dialog"가 있는 popover="manual"이므로, 브라우저가 버튼에서 패널을 열고 최상위 레이어(top layer)로 올려 페이지의 모든 요소 위에 표시합니다. 순서를 관리할 z-index가 필요 없습니다. 나머지인 이동, 크기 조절, 접기, Escape 키, 포커스, 어느 패널이 앞에 오는지는 panel 동작이 처리합니다.

플로팅 패널

<button type="button" class="btn btn-sm" commandfor="layers" command="toggle-popover">  Layers</button><button type="button" class="btn btn-sm" commandfor="comments" command="toggle-popover">  Comments</button><div id="layers" popover="manual" role="dialog" class="panel" aria-labelledby="layers-title" style="--panel-x: 24px; --panel-y: 24px; --panel-width: 232px">  <div class="panel-header">    <button type="button" class="panel-handle" aria-label="Move the Layers panel with the arrow keys"></button>    <h2 class="panel-title" id="layers-title">Layers</h2>    <div class="panel-actions">      <button type="button" class="btn btn-quiet btn-sm btn-square panel-minimize" aria-pressed="false" aria-label="Minimize">        <svg class="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 8L13 8" />        </svg>      </button>      <button type="button" class="btn btn-quiet btn-sm btn-square" commandfor="layers" command="hide-popover" aria-label="Close">        <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">          <path d="M4 4L12 12" /><path d="M4 12L12 4" />        </svg>      </button>    </div>  </div>  <div class="panel-body">    <ol class="list">      <li class="list-row">        <span class="list-body"><span class="list-title">Header</span></span>      </li>      <li class="list-row">        <span class="list-body"><span class="list-title">Hero image</span></span>      </li>      <li class="list-row">        <span class="list-body"><span class="list-title">Pricing table</span></span>      </li>      <li class="list-row">        <span class="list-body"><span class="list-title">Footer</span></span>      </li>    </ol>  </div>  <span class="panel-resize" aria-hidden="true"></span></div><div id="comments" popover="manual" role="dialog" class="panel" aria-labelledby="comments-title" style="--panel-x: 296px; --panel-y: 64px; --panel-width: 272px">  <div class="panel-header">    <button type="button" class="panel-handle" aria-label="Move the Comments panel with the arrow keys"></button>    <h2 class="panel-title" id="comments-title">Comments</h2>    <div class="panel-actions">      <button type="button" class="btn btn-quiet btn-sm btn-square panel-minimize" aria-pressed="false" aria-label="Minimize">        <svg class="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 8L13 8" />        </svg>      </button>      <button type="button" class="btn btn-quiet btn-sm btn-square" commandfor="comments" command="hide-popover" aria-label="Close">        <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">          <path d="M4 4L12 12" /><path d="M4 12L12 4" />        </svg>      </button>    </div>  </div>  <div class="panel-body">    <div class="flex flex-col gap-sm">      <p class="m(0)">        <span class="fg-text-strong">Mira</span> The hero image crops the product on narrow screens.      </p>      <p class="m(0)">        <span class="fg-text-strong">Jun</span> Fixed in the next build: it keeps the middle third.      </p>      <input class="input input-sm" type="text" placeholder="Reply" aria-label="Reply">    </div>  </div>  <span class="panel-resize" aria-hidden="true"></span></div><script>document.getElementById('layers').showPopover()document.getElementById('comments').showPopover()</script><script type="module">  import { attach } from '@master/ui/behaviors'  attach()</script>
헤더나 패널의 아래쪽 끝 모서리를 드래그해 보세요. 뒤에 있는 패널 안을 누르면 그 패널이 앞으로 옵니다. Tab 키로 헤더로 이동해 방향키를 사용하세요. Shift 키와 방향키를 함께 누르면 더 멀리 이동하고, Alt 키와 방향키를 함께 누르면 크기가 바뀝니다. Escape 키를 누르면 패널이 닫힙니다.

#스타일시트가 그리는 요소

  • 시트. 팝오버와 같은 떠 있는 면에 플로팅 그림자가 적용됩니다. 헤더나 모서리를 잡고 있는 동안에는 오버레이 그림자로 솟아오르며, 드래그해도 텍스트가 선택되지 않습니다. 모서리 반경은 작은 버튼의 모서리 반경에 헤더가 버튼 주위에 두는 6px 여백을 더한 14px입니다.
  • 헤더는 가는 구분선 위에 놓인 같은 시트의 막대로, 시작 쪽에 제목이, 끝쪽에 동작 버튼이 있습니다. 둘 아래에는 막대 크기의 버튼인 핸들이 깔려 있으므로, 헤더에서 컨트롤이 아닌 곳 어디를 눌러도 패널을 집어 들 수 있으며, 커서는 편 손에서 쥔 손으로 바뀝니다. 제목은 포인터 입력을 받지 않으므로 제목을 눌러도 핸들이 입력을 받습니다.
  • 핸들에 포커스가 있으면 패널 전체에 포커스 링이 표시됩니다. 키로 움직이는 대상이 패널 전체이기 때문입니다.
  • 접힌 상태. 최소화 버튼을 누르면 패널에는 헤더만 남습니다. 본문과 모서리는 숨겨지고, 버튼은 오목한 영역 안에 놓입니다.
  • 본문은 주어진 공간보다 길면 아래 페이지를 움직이지 않고 패널 안에서 스크롤됩니다.
  • 모서리는 끝쪽 아래에 있는 두 개의 짧은 대각선으로, 조작 영역은 16px이고 터치 화면에서는 44px입니다. 터치 화면에서도 헤더의 버튼은 크기를 유지하며, 버튼의 조작 영역이 헤더 가장자리까지 넓어집니다.

#위치

위치와 크기는 사용자 지정 속성입니다. 뷰포트의 왼쪽 위 모서리를 기준으로 패널의 왼쪽 위 모서리까지의 거리를 픽셀 단위로 나타내는 --panel-x와 --panel-y, 그리고 --panel-width와 --panel-height입니다. 이 값은 이벤트만 알 수 있으므로 동작이 포인터와 키 입력에 따라 작성합니다. 미리보기에서 각 패널의 시작 위치를 정하듯이 페이지에서 직접 작성할 수도 있습니다.

배치와 제한은 스타일시트가 clamp()로 처리하며, 기준은 고정 위치 요소의 백분율이 참조하는 뷰포트로, 스크롤바는 제외됩니다.

  • 패널은 뷰포트보다 넓어지지 않고 --panel-min-width(12rem)보다 좁아지지 않으며, 너비 전체가 뷰포트 안에 머무릅니다.
  • 헤더는 뷰포트를 벗어나지 않으므로 패널을 언제든 찾아 다시 드래그해 올 수 있습니다. 패널은 뷰포트보다 높아지지 않으며, 들어가지 않는 본문은 스크롤됩니다.
  • 창이 좁아지면 패널이 안쪽으로 밀려 들어옵니다. 창이 넓어지면 패널은 지정받았던 위치로 돌아갈 수 있습니다. 패널이 보관하는 위치는 clamp()로 바뀌지 않기 때문입니다.
  • 위치를 지정하지 않으면 패널은 끝쪽 위 모서리에서 8px(--panel-gutter) 안쪽에 열립니다.

이동과 크기 조절이 끝날 때마다 동작은 스타일시트가 패널을 그린 위치를 읽어 그 값을 보관합니다. 따라서 애플리케이션이 저장하는 값은 사용자가 실제로 본 위치입니다.

#여러 패널

패널은 표시된 순서대로 최상위 레이어에 놓이며, 마지막에 표시된 패널이 맨 앞에 옵니다. 다른 패널 뒤에 있는 패널 안을 누르거나 그 안에 포커스가 가면 그 패널이 앞으로 옵니다. 동작이 패널을 다시 표시해 최상위 레이어의 마지막에 두기 때문입니다. 브라우저가 그리기 전에 한 작업 안에서 숨겼다가 다시 표시하므로, 패널이 사라지는 모습은 보이지 않고 등장 애니메이션도 재생되지 않으며, 브라우저는 열림에서 열림으로 가는 toggle 이벤트를 한 번 보고합니다. 포커스는 사용자가 둔 곳에 그대로 있습니다.

#동작

panel은 panel 클래스가 있는 루트 요소를 받아, 연결한 동작을 해제하는 함수를 반환합니다. 이 함수의 value는 패널의 위치, 크기, 접힘 여부를 나타내는 { x, y, width, height, minimized }입니다. 네 숫자는 픽셀 단위이며, 스타일시트의 기본값이 적용되는 경우에는 null입니다. 이 값을 보관했다가 페이지를 불러올 때 다시 설정하세요.

app.js
import { panel } from '@master/ui/behaviors/panel.js'const root = document.querySelector('#layers')const layers = panel(root)const saved = localStorage.getItem('layers-panel')if (saved) layers.value = JSON.parse(saved)root.addEventListener('change', (event) => {  if (event.target === root) localStorage.setItem('layers-panel', JSON.stringify(layers.value))})
  • 이동. 핸들을 드래그하면 --panel-x와 --panel-y를 작성하며, 패널을 집어 든 지점이 포인터 아래에 머무릅니다. 핸들에서 방향키를 누르면 16px씩, Shift 키와 함께 누르면 네 배만큼 이동합니다.
  • 크기 조절. 모서리를 드래그하면 --panel-width와 --panel-height를 작성합니다. 핸들에서 Alt 키와 방향키를 누르면 한 단계씩 같은 일을 합니다. 오른쪽에서 왼쪽으로 쓰는 언어에서는 모서리가 왼쪽 아래에 있으므로 패널이 왼쪽으로 넓어지며, Alt+ArrowLeft를 누르면 넓어집니다.
  • 접기. 최소화 버튼을 클릭하면 버튼의 aria-pressed가 전환됩니다.
  • 닫기. 패널 안에 포커스가 있을 때 Escape 키를 누르면 패널이 닫힙니다. 단, 먼저 닫히는 메뉴처럼 패널 안의 컨트롤이 그 키를 처리한 경우는 예외입니다. 닫기 버튼은 command="hide-popover"이므로 스크립트가 필요 없습니다.
  • 포커스. 컨트롤에서 연 패널은 포커스를 핸들로 옮기며, 포커스가 패널 안에 있는 상태로 닫히면 포커스를 그 컨트롤로 돌려줍니다. 페이지를 불러올 때 열린 패널은 포커스를 현재 위치에 그대로 둡니다.
  • 이벤트. 루트는 패널이 이동하거나 크기가 바뀌는 동안 input을 발생시키고, 드래그가 끝나거나 키로 이동했거나 접혔을 때 change를 발생시킵니다. 두 이벤트 모두 버블링되므로 본문의 필드에서 발생한 이벤트도 루트에 전달됩니다. event.target을 루트와 비교하세요.
옵션설정하는 내용
step방향키 한 번으로 패널을 이동하거나 크기를 바꾸는 거리로, 픽셀 단위입니다. 기본값은 16입니다

동작을 연결하지 않아도 패널은 버튼에서 페이지 위 최상위 레이어로 열리고 닫기 버튼으로 닫힙니다. 패널은 사용자 지정 속성이 정한 위치에 머무릅니다.

#버튼으로 열기

commandfor와 command="toggle-popover"가 있는 버튼으로 패널을 열고 닫습니다. popovertarget도 같은 일을 합니다. 탭 순서에서 패널은 버튼 바로 다음에 오며, 패널이 열리면 포커스가 핸들로 이동하므로 곧바로 방향키로 패널을 옮길 수 있습니다. 버튼, 닫기 버튼, Escape 키 중 하나로 패널을 닫으면 포커스가 버튼으로 돌아갑니다.

버튼으로 열기

<button type="button" class="btn" commandfor="inspector" command="toggle-popover">Inspect</button><div id="inspector" popover="manual" role="dialog" class="panel" aria-labelledby="inspector-title" style="--panel-x: 24px; --panel-y: 24px; --panel-width: 264px">  <div class="panel-header">    <button type="button" class="panel-handle" aria-label="Move the Inspector panel with the arrow keys"></button>    <h2 class="panel-title" id="inspector-title">Inspector</h2>    <div class="panel-actions">      <button type="button" class="btn btn-quiet btn-sm btn-square panel-minimize" aria-pressed="false" aria-label="Minimize">        <svg class="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 8L13 8" />        </svg>      </button>      <button type="button" class="btn btn-quiet btn-sm btn-square" commandfor="inspector" command="hide-popover" aria-label="Close">        <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">          <path d="M4 4L12 12" /><path d="M4 12L12 4" />        </svg>      </button>    </div>  </div>  <div class="panel-body">    <dl class="data-list">      <div class="data-list-item">        <dt class="data-list-term">Element</dt>        <dd class="data-list-value">Hero image</dd>      </div>      <div class="data-list-item">        <dt class="data-list-term">Size</dt>        <dd class="data-list-value">1280 × 720</dd>      </div>      <div class="data-list-item">        <dt class="data-list-term">Format</dt>        <dd class="data-list-value">AVIF</dd>      </div>    </dl>  </div>  <span class="panel-resize" aria-hidden="true"></span></div><script type="module">  import { attach } from '@master/ui/behaviors'  attach()</script>
import { useEffect, useRef } from 'react'import { attach } from '@master/ui/behaviors'import MinusIcon from '@master/icons-react/native/16/soft/minus'import XIcon from '@master/icons-react/native/16/soft/x'export function Example() {  const root = useRef<HTMLDivElement>(null)  useEffect(() => attach(root.current!), [])  return (    <div ref={root}>      <button type="button" className="btn" {...{ commandfor: 'inspector', command: 'toggle-popover' }}>        Inspect      </button>      <div id="inspector" popover="manual" role="dialog" className="panel" aria-labelledby="inspector-title" style={{ '--panel-x': '24px', '--panel-y': '24px', '--panel-width': '264px' } as React.CSSProperties}>        <div className="panel-header">          <button type="button" className="panel-handle" aria-label="Move the Inspector panel with the arrow keys"></button>          <h2 className="panel-title" id="inspector-title">Inspector</h2>          <div className="panel-actions">            <button type="button" className="btn btn-quiet btn-sm btn-square panel-minimize" aria-pressed="false" aria-label="Minimize">              <MinusIcon className="icon" />            </button>            <button type="button" className="btn btn-quiet btn-sm btn-square" {...{ commandfor: 'inspector', command: 'hide-popover' }} aria-label="Close">              <XIcon className="icon" />            </button>          </div>        </div>        <div className="panel-body">          <dl className="data-list">            <div className="data-list-item">              <dt className="data-list-term">Element</dt>              <dd className="data-list-value">Hero image</dd>            </div>            <div className="data-list-item">              <dt className="data-list-term">Size</dt>              <dd className="data-list-value">1280 × 720</dd>            </div>            <div className="data-list-item">              <dt className="data-list-term">Format</dt>              <dd className="data-list-value">AVIF</dd>            </div>          </dl>        </div>        <span className="panel-resize" aria-hidden="true"></span>      </div>    </div>  )}
<script>  import { attach } from '@master/ui/behaviors'  import MinusIcon from '@master/icons-svelte/native/16/soft/minus'  import XIcon from '@master/icons-svelte/native/16/soft/x'</script><div {@attach attach}>  <button type="button" class="btn" commandfor="inspector" command="toggle-popover">Inspect</button>  <div id="inspector" popover="manual" role="dialog" class="panel" aria-labelledby="inspector-title" style="--panel-x: 24px; --panel-y: 24px; --panel-width: 264px">    <div class="panel-header">      <button type="button" class="panel-handle" aria-label="Move the Inspector panel with the arrow keys"></button>      <h2 class="panel-title" id="inspector-title">Inspector</h2>      <div class="panel-actions">        <button type="button" class="btn btn-quiet btn-sm btn-square panel-minimize" aria-pressed="false" aria-label="Minimize">          <MinusIcon class="icon" />        </button>        <button type="button" class="btn btn-quiet btn-sm btn-square" commandfor="inspector" command="hide-popover" aria-label="Close">          <XIcon class="icon" />        </button>      </div>    </div>    <div class="panel-body">      <dl class="data-list">        <div class="data-list-item">          <dt class="data-list-term">Element</dt>          <dd class="data-list-value">Hero image</dd>        </div>        <div class="data-list-item">          <dt class="data-list-term">Size</dt>          <dd class="data-list-value">1280 × 720</dd>        </div>        <div class="data-list-item">          <dt class="data-list-term">Format</dt>          <dd class="data-list-value">AVIF</dd>        </div>      </dl>    </div>    <span class="panel-resize" aria-hidden="true"></span>  </div></div>
<script setup>import { onMounted, onUnmounted, ref } from 'vue'import { attach } from '@master/ui/behaviors'import MinusIcon from '@master/icons-vue/native/16/soft/minus'import XIcon from '@master/icons-vue/native/16/soft/x'const root = ref(null)let detachonMounted(() => { detach = attach(root.value) })onUnmounted(() => detach?.())</script><template>  <div ref="root">    <button type="button" class="btn" commandfor="inspector" command="toggle-popover">      Inspect    </button>    <div id="inspector" popover="manual" role="dialog" class="panel" aria-labelledby="inspector-title" style="--panel-x: 24px; --panel-y: 24px; --panel-width: 264px">      <div class="panel-header">        <button type="button" class="panel-handle" aria-label="Move the Inspector panel with the arrow keys"></button>        <h2 class="panel-title" id="inspector-title">Inspector</h2>        <div class="panel-actions">          <button type="button" class="btn btn-quiet btn-sm btn-square panel-minimize" aria-pressed="false" aria-label="Minimize">            <MinusIcon class="icon" />          </button>          <button type="button" class="btn btn-quiet btn-sm btn-square" commandfor="inspector" command="hide-popover" aria-label="Close">            <XIcon class="icon" />          </button>        </div>      </div>      <div class="panel-body">        <dl class="data-list">          <div class="data-list-item">            <dt class="data-list-term">Element</dt>            <dd class="data-list-value">Hero image</dd>          </div>          <div class="data-list-item">            <dt class="data-list-term">Size</dt>            <dd class="data-list-value">1280 × 720</dd>          </div>          <div class="data-list-item">            <dt class="data-list-term">Format</dt>            <dd class="data-list-value">AVIF</dd>          </div>        </dl>      </div>      <span class="panel-resize" aria-hidden="true"></span>    </div>  </div></template>
패널을 열어 보세요. 포커스가 헤더로 이동합니다. Escape 키로 닫으면 포커스가 버튼으로 돌아갑니다.

#키보드

키동작
Enter, Spacecommandfor와 command="toggle-popover"가 설정된 버튼에서 패널을 열고 핸들로 포커스를 옮깁니다. 다시 누르면 패널을 닫습니다.
ArrowLeft, ArrowRight, ArrowUp, ArrowDown핸들에서 패널을 해당 방향으로 한 단계(16px) 옮깁니다. 뷰포트 가장자리에서 멈춥니다.
Shift+Arrow keys핸들에서 패널을 네 단계 옮깁니다.
Alt+ArrowRight, Alt+ArrowLeft핸들에서 패널을 한 단계 넓히거나 좁히며, Shift를 누르면 네 단계씩 조절합니다. 오른쪽에서 왼쪽으로 읽는 환경에서는 크기 조절 모서리가 왼쪽에 있으므로 방향이 반대입니다.
Alt+ArrowDown, Alt+ArrowUp핸들에서 패널을 한 단계 높이거나 낮추며, Shift를 누르면 네 단계씩 조절합니다. 접힌 패널은 높이를 유지합니다.
Enter, Space최소화 버튼에서 패널을 헤더만 남도록 접거나 다시 펼칩니다.
Escape패널 안에 포커스가 있으면 패널을 닫고 패널을 연 컨트롤로 포커스를 돌려보냅니다. 열린 메뉴처럼 Escape를 처리하는 컨트롤이 안에 있으면 그 컨트롤이 Escape를 처리합니다.
Tab, Shift+Tab핸들, 동작 버튼, 본문 사이를 이동하고 이어서 페이지로 넘어갑니다. 패널은 모달이 아닙니다.

#접근성

  • 패널은 aria-labelledby로 제목을 이름으로 삼는 role="dialog"입니다. 모달이 아니므로 aria-modal이 없고, 페이지를 계속 사용할 수 있으며, Tab 키로 패널을 벗어날 수 있습니다. 작업을 먼저 끝내야 한다면 대화 상자를 사용하세요.
  • 핸들은 실제 버튼이므로 버튼으로 안내되고 버튼처럼 접근할 수 있습니다. 핸들의 이름에는 옮길 대상과 조작 방법을 담으세요. 예를 들어 "방향키로 레이어 패널 이동"이라고 지정할 수 있습니다. 크기 조절은 핸들에서 키로 할 수 있으므로 모서리는 보조 기술에서 숨겨집니다.
  • 모든 드래그에는 대응하는 키가 있습니다. 방향키로 이동하고, Alt 키와 방향키로 크기를 바꿉니다. 포인터를 사용하지만 드래그할 수 없는 사용자를 위해서는 한 번 누르는 방법도 제공하세요. "왼쪽에 고정"처럼 값을 설정하는 항목이 있는 메뉴를 헤더에 두면 충분합니다.
  • 최소화 버튼은 이름을 유지하며 aria-pressed로 상태를 알립니다.
  • 터치 화면에서도 헤더는 높이를 유지합니다. 헤더 버튼의 조작 영역은 헤더 가장자리까지 44px로 넓어지고, 모서리의 조작 영역은 44px입니다.
  • 강제 색상 모드에서는 패널의 윤곽선을 시스템 텍스트 색으로, 핸들의 포커스 표시를 시스템 강조색으로 그립니다.

#React, Svelte, Vue

panel 컴포넌트는 헤더, 핸들, 버튼을 렌더링하고, open에 따라 패널을 열고 닫으며, 값을 받아 외부로 전달합니다. 이동하는 동안에는 onValueChange를, 이동이 끝나면 onValueCommit을 호출하며, 이때가 값을 저장할 시점입니다. 트리거와 본문은 페이지 자체의 마크업으로 남습니다. npx master-ui add panel 명령을 실행해 프로젝트에 복사하세요. 컴포넌트의 구성과 사용 방법은 React, Svelte, Vue에서 확인할 수 있습니다.

ui/panel.tsx
'use client'import { useCallback, useEffect, useId, useReducer, useRef, useState, type ComponentProps, type CSSProperties, type ReactNode } from 'react'import { panel, type PanelValue } from '@master/ui/behaviors/panel.js'import { useBehavior } from './use-behavior'export type { PanelValue }export interface PanelProps extends Omit<ComponentProps<'div'>, 'title' | 'defaultValue' | 'popover' | 'role' | 'ref'> {  /** The title in the header, which names the panel. */  title: ReactNode  /** The name of the handle: what it moves and how, such as "Move the Layers panel with the arrow keys". */  handleLabel: string  /** Whether the panel is open, when this component is told. Leave it out and the trigger opens it. */  open?: boolean  onOpenChange?: (open: boolean) => void  /** Where the panel is, how large and whether it is folded. Keep it to put the panel back where it was. */  value?: PanelValue  defaultValue?: PanelValue  /** Called as the panel moves, resizes or folds. */  onValueChange?: (value: PanelValue) => void  /** Called once a drag ends, a key moved it or it was folded: the moment to keep the value. */  onValueCommit?: (value: PanelValue) => void  /** The button that opens the panel: spread what it is given on a button of your own. */  trigger?: (attributes: { commandfor: string, command: 'toggle-popover' }) => ReactNode  /** More controls in the header, before the minimize and close buttons. */  actions?: ReactNode  minimizeLabel?: string  closeLabel?: string  /** Leave out the corner that resizes it. */  resizable?: boolean  /** How far an arrow key moves or resizes the panel, in pixels. */  step?: number}const measures = ['x', 'y', 'width', 'height'] as const/** * A floating panel. The browser opens it from the trigger and puts it in the top layer; the behavior moves, * resizes, folds and stacks it. This component opens and closes it from `open`, and passes its place in and out. */export function Panel({ title, handleLabel, open, onOpenChange, value, defaultValue, onValueChange, onValueCommit, trigger, actions, minimizeLabel = 'Minimize', closeLabel = 'Close', resizable = true, step = 16, className, id, style, children, ...root }: PanelProps) {  const generated = useId()  const name = id ?? generated  const [first] = useState(value ?? defaultValue)  const latest = useRef(first)  const ref = useBehavior(panel, { step }, {    value,    defaultValue,    onValueChange: (next: PanelValue) => { latest.current = next; onValueChange?.(next) },    // The panel says change once a move ends. A field in its body says change too.    on: { change: (event) => { if (event.target === event.currentTarget) onValueCommit?.(latest.current!) } },  })  const element = useRef<HTMLDivElement | null>(null)  const heard = useRef(onOpenChange)  /** What the owner knows: the last state it set or was told. */  const known = useRef(false)  const [tick, again] = useReducer((count: number) => count + 1, 0)  useEffect(() => { heard.current = onOpenChange })  useEffect(() => {    const popover = element.current    if (!popover || open === undefined) return    const shown = popover.matches(':popover-open')    known.current = open    if (open && !shown) popover.showPopover()    else if (!open && shown) popover.hidePopover()  }, [open, tick])  useEffect(() => {    const popover = element.current    if (!popover) return    const report = () => {      const shown = popover.matches(':popover-open')      if (shown !== known.current) heard.current?.(known.current = shown)      // An `open` this component is told wins: if its owner did not take the change, the panel goes back.      again()    }    popover.addEventListener('toggle', report)    return () => popover.removeEventListener('toggle', report)  }, [])  // The first place and size are drawn into the first render; after that the behavior writes them.  const place = Object.fromEntries(measures.filter(measure => typeof first?.[measure] === 'number').map(measure => [`--panel-${measure}`, `${first![measure]}px`]))  const attach = useCallback((node: HTMLDivElement | null) => {    element.current = node    return ref(node)  }, [ref])  return (    <>      {trigger?.({ commandfor: name, command: 'toggle-popover' })}      <div id={name} popover="manual" role="dialog" aria-labelledby={`${name}-title`} className={className ? `panel ${className}` : 'panel'} style={{ ...place, ...style } as CSSProperties} ref={attach} {...root}>        <div className="panel-header">          <button type="button" className="panel-handle" aria-label={handleLabel} />          <h2 className="panel-title" id={`${name}-title`}>{title}</h2>          <div className="panel-actions">            {actions}            <button type="button" className="btn btn-quiet btn-sm btn-square panel-minimize" aria-pressed={first?.minimized ?? false} aria-label={minimizeLabel}>              <svg className="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="1" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M3 8L13 8" /></svg>            </button>            <button type="button" className="btn btn-quiet btn-sm btn-square" {...{ commandfor: name, command: 'hide-popover' }} aria-label={closeLabel}>              <svg className="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="1" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M4 4L12 12" /><path d="M4 12L12 4" /></svg>            </button>          </div>        </div>        <div className="panel-body">{children}</div>        {resizable && <span className="panel-resize" aria-hidden="true" />}      </div>    </>  )}
ui/Panel.svelte
<script lang="ts" module>  import type { Snippet } from 'svelte'  import type { HTMLAttributes } from 'svelte/elements'  import type { PanelValue } from '@master/ui/behaviors/panel.js'  export type { PanelValue }  export interface PanelProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'popover' | 'role'> {    /** The title in the header, which names the panel. */    title: string    /** The name of the handle: what it moves and how, such as "Move the Layers panel with the arrow keys". */    handleLabel: string    /** Whether the panel is open. Bind it, or leave it out and the trigger opens it. */    open?: boolean    onOpenChange?: (open: boolean) => void    /** Where the panel is, how large and whether it is folded. Bind it to put the panel back where it was. */    value?: PanelValue    /** Called as the panel moves, resizes or folds. */    onValueChange?: (value: PanelValue) => void    /** Called once a drag ends, a key moved it or it was folded: the moment to keep the value. */    onValueCommit?: (value: PanelValue) => void    /** The button that opens the panel: spread what it is given on a button of your own. */    trigger?: Snippet<[{ commandfor: string, command: 'toggle-popover' }]>    /** More controls in the header, before the minimize and close buttons. */    actions?: Snippet    minimizeLabel?: string    closeLabel?: string    /** Leave out the corner that resizes it. */    resizable?: boolean    /** How far an arrow key moves or resizes the panel, in pixels. */    step?: number  }</script><script lang="ts">  import { untrack } from 'svelte'  import type { Attachment } from 'svelte/attachments'  import { panel } from '@master/ui/behaviors/panel.js'  import { behavior } from './behavior.svelte.js'  let { title, handleLabel, open = $bindable(), onOpenChange, value = $bindable(), onValueChange, onValueCommit, trigger, actions, minimizeLabel = 'Minimize', closeLabel = 'Close', resizable = true, step = 16, class: className, id, children, ...root }: PanelProps = $props()  const generated = $props.id()  const name = $derived(id ?? generated)  const first = untrack(() => value)  // Svelte writes a style again whenever its owner changes it, so it writes the place the behavior holds.  let held = $state(first)  const px = (measure: number | null | undefined) => typeof measure === 'number' ? `${measure}px` : undefined  const attach = behavior(panel, () => ({ step }), {    value: () => value,    change: (next) => { value = held = next; onValueChange?.(next) },    settled: (kept) => { held = kept },    // The panel says change once a move ends. A field in its body says change too.    on: { change: (event) => { if (event.target === event.currentTarget && held) onValueCommit?.(held) } },  })  /** What the owner knows: the last state it set or was told. */  let known = false  const presence: Attachment<HTMLDivElement> = (popover) => {    const report = () => {      const shown = popover.matches(':popover-open')      if (shown === known) return      open = known = shown      onOpenChange?.(known)    }    popover.addEventListener('toggle', report)    $effect(() => {      if (open === undefined) return      const shown = popover.matches(':popover-open')      known = open      if (open && !shown) popover.showPopover()      else if (!open && shown) popover.hidePopover()    })    return () => popover.removeEventListener('toggle', report)  }</script><!--  @component  A floating panel. The browser opens it from the trigger and puts it in the top layer; the behavior moves,  resizes, folds and stacks it. This component opens and closes it from `open`, and passes its place in and out.-->{@render trigger?.({ commandfor: name, command: 'toggle-popover' })}<div id={name} popover="manual" role="dialog" aria-labelledby="{name}-title" class={['panel', className]} style:--panel-x={px(held?.x)} style:--panel-y={px(held?.y)} style:--panel-width={px(held?.width)} style:--panel-height={px(held?.height)} {@attach attach} {@attach presence} {...root}>  <div class="panel-header">    <button type="button" class="panel-handle" aria-label={handleLabel}></button>    <h2 class="panel-title" id="{name}-title">{title}</h2>    <div class="panel-actions">      {@render actions?.()}      <button type="button" class="btn btn-quiet btn-sm btn-square panel-minimize" aria-pressed={first?.minimized ?? false} aria-label={minimizeLabel}>        <svg class="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 8L13 8" /></svg>      </button>      <button type="button" class="btn btn-quiet btn-sm btn-square" commandfor={name} command="hide-popover" aria-label={closeLabel}>        <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 4L12 12" /><path d="M4 12L12 4" /></svg>      </button>    </div>  </div>  <div class="panel-body">{@render children?.()}</div>  {#if resizable}    <span class="panel-resize" aria-hidden="true"></span>  {/if}</div>
ui/Panel.vue
<script setup lang="ts">import { computed, nextTick, onMounted, useId, useTemplateRef, watch } from 'vue'import { panel, type PanelValue } from '@master/ui/behaviors/panel.js'import { useBehavior } from './use-behavior'defineOptions({ inheritAttrs: false })const { id, title, handleLabel, minimizeLabel = 'Minimize', closeLabel = 'Close', resizable = true, step = 16 } = defineProps<{  id?: string  /** The title in the header, which names the panel. */  title: string  /** The name of the handle: what it moves and how, such as "Move the Layers panel with the arrow keys". */  handleLabel: string  minimizeLabel?: string  closeLabel?: string  /** Leave out the corner that resizes it. */  resizable?: boolean  /** How far an arrow key moves or resizes the panel, in pixels. */  step?: number}>()/** Where the panel is, how large and whether it is folded: `v-model`. Keep it to put the panel back where it was. */const model = defineModel<PanelValue>()/** Whether the panel is open: `v-model:open`. Leave it out and the trigger opens it. */const open = defineModel<boolean>('open')const emit = defineEmits<{  /** The value, once a drag ends, a key moved it or it was folded: the moment to keep it. */  valueCommit: [value: PanelValue]}>()defineSlots<{  /** The button that opens the panel: bind what it is given on a button of your own. */  trigger?: (attributes: { commandfor: string, command: 'toggle-popover' }) => unknown  /** More controls in the header, before the minimize and close buttons. */  actions?: () => unknown  default?: () => unknown}>()/* * A floating panel. The browser opens it from the trigger and puts it in the top layer; the behavior moves, * resizes, folds and stacks it. This component opens and closes it from `open`, and passes its place in and out. */const generated = useId()const name = computed(() => id ?? generated)const first = model.valueconst root = useTemplateRef<HTMLDivElement>('root')const current = useBehavior(root, panel, () => ({ step }), model, {  // The panel says change once a move ends. A field in its body says change too.  change: (event) => {    const held = current()    if (event.target === root.value && held) emit('valueCommit', held)  },})// Vue writes a style again each time it renders, so it writes the place the behavior holds, not the first one.const place = () => {  const held = current() ?? first  const px = (measure: number | null | undefined) => typeof measure === 'number' ? `${measure}px` : undefined  return { '--panel-x': px(held?.x), '--panel-y': px(held?.y), '--panel-width': px(held?.width), '--panel-height': px(held?.height) }}/** What the owner knows: the last state it set or was told. */let known = falseconst sync = () => {  const popover = root.value  if (!popover || open.value === undefined) return  const shown = popover.matches(':popover-open')  known = open.value  if (open.value && !shown) popover.showPopover()  else if (!open.value && shown) popover.hidePopover()}const report = () => {  const popover = root.value  if (!popover) return  const shown = popover.matches(':popover-open')  if (shown !== known) open.value = known = shown  // An `open` this component is told wins: if its owner did not take the change, the panel goes back.  void nextTick(sync)}onMounted(sync)watch(open, sync, { flush: 'post' })</script><template>  <slot name="trigger" v-bind="{ commandfor: name, command: 'toggle-popover' as const }" />  <div :id="name" popover="manual" role="dialog" :aria-labelledby="`${name}-title`" class="panel" :style="place()" ref="root" v-bind="$attrs" @toggle="report">    <div class="panel-header">      <button type="button" class="panel-handle" :aria-label="handleLabel" />      <h2 class="panel-title" :id="`${name}-title`">{{ title }}</h2>      <div class="panel-actions">        <slot name="actions" />        <button type="button" class="btn btn-quiet btn-sm btn-square panel-minimize" :aria-pressed="first?.minimized ?? false" :aria-label="minimizeLabel">          <svg class="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 8L13 8" /></svg>        </button>        <button type="button" class="btn btn-quiet btn-sm btn-square" :commandfor="name" command="hide-popover" :aria-label="closeLabel">          <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 4L12 12" /><path d="M4 12L12 4" /></svg>        </button>      </div>    </div>    <div class="panel-body"><slot /></div>    <span v-if="resizable" class="panel-resize" aria-hidden="true" />  </div></template>

#클래스

클래스설명
panel떠 있는 시트로, role="dialog"를 지정한 popover="manual" 요소이며 aria-labelledby로 제목을 이름으로 지정합니다. --panel-x와 --panel-y가 가리키는 위치에 뷰포트를 벗어나지 않도록 놓이며, 따로 지정하지 않으면 너비는 20rem입니다. 위치를 지정하지 않으면 위쪽 끝 모서리에 놓입니다.
panel-header위쪽의 막대로, 시작 쪽에 제목을, 끝 쪽에 동작 버튼을 두고 둘 아래에 핸들을 깝니다. 뷰포트를 절대 벗어나지 않는 부분입니다.
panel-handle헤더 크기의 버튼으로, 헤더의 첫 번째 요소이며 패널을 옮깁니다. 막대에서 컨트롤이 아닌 곳을 끌면 패널이 움직이고, 이 버튼에 포커스가 있으면 방향키로 패널을 옮길 수 있습니다. "방향키로 레이어 패널 옮기기"처럼 무엇을 어떻게 옮기는지 이름을 지정하세요. 포커스를 받으면 패널 전체에 링이 표시됩니다.
panel-title한 줄로 표시하는 제목입니다. 패널의 aria-labelledby가 이 요소를 가리키게 하세요. 포인터 입력을 받지 않으므로 제목을 누르면 핸들에 전달됩니다.
panel-actions헤더 끝 쪽, 핸들 위에 놓이는 컨트롤로, 작고 강조를 줄인 정사각형 버튼입니다.
panel-minimize패널을 헤더만 남도록 접는 버튼입니다. 누르면 오목한 영역 안에 들어간 모양이 되며, 본문과 모서리가 숨겨집니다.
panel-body패널의 내용으로, 가는 구분선 아래에 놓이고 둘레에 --panel-padding만큼 여백을 둡니다. 본문이 길면 패널 안에서 스크롤됩니다. 패널을 접으면 본문이 숨겨지므로 내용의 레이아웃은 본문 안의 요소에서 잡으세요.
panel-resize포인터로 패널 크기를 조절하는 아래쪽 끝 모서리입니다. 조작 영역은 16px이며 터치 화면에서는 44px입니다. 키보드로는 핸들에서 크기를 조절하므로 보조 기술에서는 숨기세요.

#사용자 지정 속성

속성기본값설명
--panel-x100%뷰포트 왼쪽 가장자리로부터의 왼쪽 변 위치로, 스크립트가 픽셀 단위로 기록합니다. 너비 전체가 뷰포트 안에 머물도록 유지되며, 기본값은 오른쪽 가장자리이고 오른쪽에서 왼쪽으로 읽는 환경에서는 왼쪽 가장자리입니다.
--panel-y0px뷰포트 위쪽 가장자리로부터의 위쪽 변 위치로, 스크립트가 픽셀 단위로 기록합니다. 헤더가 뷰포트 안에 머물도록 유지됩니다.
--panel-width20rem너비로, 스크립트가 픽셀 단위로 기록합니다. --panel-min-width와 뷰포트 너비 사이로 유지됩니다.
--panel-heightauto높이로, 기본값은 콘텐츠 높이이며 스크립트가 픽셀 단위로 기록합니다. 뷰포트 높이를 넘지 않습니다.
--panel-min-width12rem크기를 조절할 때의 최소 너비
--panel-gutter.5rem패널과 뷰포트 가장자리 사이에 확보하는 최소 여백입니다.
--panel-padding1rem본문 둘레의 패딩
--panel-radiuscalc(var(--radius-control-sm) + var(--panel-inset) / var(--corner-scale))모서리 반경입니다. 작은 버튼의 모서리 반경에 헤더가 버튼 둘레에 두는 6px을 더한 값입니다.

#소스

@master/ui/components/panel.css
/* * Panel: a floating surface the reader moves, resizes, folds to its header and closes, while the page under it * stays usable: layers beside a canvas, a color picker, an inspector, a chat. It is a popover="manual" in the * top layer, so it floats over everything without a z-index; panels stack in the order they were shown, and the * behavior brings the one the reader reaches into to the front. * * Material: the floating sheet of a popover, with the floating shadow, and the overlay shadow while it is held, * so a panel being dragged rises a step. The header is a bar of the same sheet over a hairline; its whole face is * one button, the handle, so a press anywhere on the bar that is not a control picks the panel up, and focus on * the handle rings the panel the keys move. * * Geometry: the header holds small (32px) buttons 6px from its edges, so the panel's corner is a small control's * corner plus that inset, 14px. On touch a button's 44px target reaches those 6px, to the header's edge. The panel is 20rem wide unless told otherwise, never narrower than 12rem. * * Placement is the stylesheet's. A script writes what only an event knows, the place and the size asked for * (--panel-x, --panel-y, --panel-width, --panel-height); the stylesheet clamps them to the viewport, the box a * fixed element's percentages are read from, so a panel is never wider or taller than the window, the whole of * its width stays in it and its header can never leave it. The window narrowing pushes a panel in; widening it * again lets the panel go back to the place it was given. Without a place, a panel opens at the top end corner. */@layer components.ui {  .panel {    --panel-x: 100%;    --panel-y: 0px;    --panel-width: 20rem;    --panel-height: auto;    --panel-min-width: 12rem;    --panel-gutter: .5rem;    --panel-inset: .375rem;    /* The inset is added after the corner scale, so it is passed divided by it. */    --panel-radius: calc(var(--radius-control-sm) + var(--panel-inset) / var(--corner-scale));    --panel-padding: 1rem;    /* The header's height: a small button and the inset around it. The part of the panel that never leaves the viewport. */    --panel-bar: calc(2rem + 2 * var(--panel-inset));    /* The width it is drawn at: the width asked for, no less than the least, no more than the viewport gives. */    --panel-drawn-width: min(max(var(--panel-min-width), var(--panel-width)), 100% - 2 * var(--panel-gutter));    --surface-color: var(--color-surface-floating);    position: fixed;    inset: auto;    top: clamp(var(--panel-gutter), var(--panel-y), 100% - var(--panel-bar) - var(--panel-gutter));    left: clamp(var(--panel-gutter), var(--panel-x), 100% - var(--panel-drawn-width) - var(--panel-gutter));    flex-direction: column;    width: var(--panel-drawn-width);    height: var(--panel-height);    min-height: var(--panel-bar);    max-height: calc(100% - 2 * var(--panel-gutter));    margin: 0;    padding: 0;    border: 0;    border-radius: calc(var(--panel-radius) * var(--corner-scale));    corner-shape: var(--corner-shape);    /* The header's tone and the body's scroll are finished by the panel's corner. */    overflow: clip;    background: var(--color-surface-floating);    color: var(--color-text-body);    box-shadow: var(--shadow-floating);    font-size: .875rem;    line-height: 1.5;    transform-origin: top;    @apply --pop;    transition-property: opacity, scale, box-shadow, overlay, display;    /* With no place given, a panel from right to left opens at the top left. */    &:dir(rtl) {      --panel-x: 0px;    }    &:popover-open {      display: flex;    }    /* Held by its handle or its corner: it rises to the overlay shadow, and the drag selects nothing. */    &:has(.panel-handle:active:not(:disabled, [aria-disabled="true"]), .panel-resize:active:not([aria-disabled="true"])) {      box-shadow: var(--shadow-overlay);      user-select: none;      -webkit-user-select: none;    }    /* The keys move the whole panel, so focus on its handle rings the whole panel. */    &:has(.panel-handle:focus-visible) {      @apply --focus-ring;    }    /*     * Folded to its header: only as tall as the header, with no body and no corner to resize from. The body is     * hidden from sight, focus and assistive technology even where a utility gives it a display of its own.     */    &:has(.panel-minimize[aria-pressed="true"]) {      height: var(--panel-bar);      .panel-body,      .panel-resize {        display: none;        visibility: hidden;      }    }    @media (forced-colors: active) {      outline: 1px solid CanvasText;      outline-offset: -1px;      &:has(.panel-handle:focus-visible) {        outline: 2px solid Highlight;        outline-offset: 2px;      }    }  }  /* The header: the title at the start, the actions at the end, and the handle under both. */  .panel-header {    position: relative;    display: flex;    flex: none;    align-items: center;    gap: .25rem;    min-height: var(--panel-bar);    padding: var(--panel-inset);    padding-inline-start: .875rem;  }  /*   * The handle: a button the size of the header, under the title and the actions, so the bar is what the hand   * grabs. It draws nothing of its own; its focus is drawn on the panel.   */  .panel-handle {    position: absolute;    inset: 0;    margin: 0;    padding: 0;    border: 0;    border-radius: 0;    outline: none;    background: transparent;    color: inherit;    appearance: none;    cursor: grab;    touch-action: none;    user-select: none;    -webkit-user-select: none;    -webkit-tap-highlight-color: transparent;    &:active:not(:disabled, [aria-disabled="true"]) {      cursor: grabbing;    }    /* A handle the page turned off carries nothing, so it does not offer the hand. */    &:is(:disabled, [aria-disabled="true"]) {      cursor: default;    }  }  /* The title takes no pointer, so a press on it reaches the handle under it. */  .panel-title {    flex: 1 1 auto;    min-width: 0;    margin: 0;    overflow: hidden;    color: var(--color-text-strong);    font: var(--font-weight-control) .875rem/1.25 var(--font-family-sans);    font-feature-settings: inherit;    text-overflow: ellipsis;    white-space: nowrap;    pointer-events: none;  }  /* The controls at the end of the header, over the handle. */  .panel-actions {    position: relative;    display: inline-flex;    flex: none;    align-items: center;    gap: 2px;    margin-inline-start: auto;  }  /* The two stand 2px apart: on touch each target grows above and below only, so Close does not answer for Minimize. */  @media (pointer: coarse) {    .panel-actions .btn::after {      @apply --touch-target-block;    }  }  /* The minimize button is a quiet toggle: pressed, it sits in a well, and the panel is folded to its header. */  .panel-minimize {    flex: none;  }  /* What the panel holds, under a hairline. A long body scrolls inside the panel. */  .panel-body {    flex: 1 1 auto;    min-height: 0;    padding: var(--panel-padding);    border-block-start: 1px solid var(--color-line-hair);    overflow: auto;    overscroll-behavior: contain;    scrollbar-width: thin;    scrollbar-color: var(--color-line-strong) transparent;  }  /*   * The corner a pointer resizes from, at the bottom end: two short diagonal lines in the ink of a firm line,   * on a 16px target, 44px on touch screens. The keys resize from the handle.   */  .panel-resize {    position: absolute;    inset-block-end: 0;    inset-inline-end: 0;    width: 1rem;    height: 1rem;    color: var(--color-line-mark);    cursor: nwse-resize;    touch-action: none;    user-select: none;    -webkit-user-select: none;    -webkit-tap-highlight-color: transparent;    transition: color var(--duration-quick) var(--easing-glide);    &::before {      content: '';      position: absolute;      inset-block-end: .3125rem;      inset-inline-end: .3125rem;      width: .5rem;      height: .5rem;      background: linear-gradient(135deg, transparent 38%, currentColor 38% 50%, transparent 50% 70%, currentColor 70% 82%, transparent 82%);    }    &:dir(rtl) {      cursor: nesw-resize;      &::before {        scale: -1 1;      }    }    @media (hover: hover) {      &:hover {        color: var(--color-text-muted);      }    }    &:active {      color: var(--color-text-strong);    }    @media (pointer: coarse) {      width: 2.75rem;      height: 2.75rem;      color: var(--color-text-muted);    }    /* A corner the page turned off resizes nothing: it keeps its place in disabled ink and offers no resize. */    &[aria-disabled="true"] {      color: var(--color-text-disabled);      cursor: default;    }    /* The two lines are a gradient, which forced colors would drop: kept out of them, in the system's text color. */    @media (forced-colors: active) {      forced-color-adjust: none;      color: CanvasText;    }  }}