# 분할 패널 조절 (Split Resizer)

경계를 움직여 교정 원고와 조판 기록이 차지하는 너비를 조절합니다.

## 체험 방법

가운데 손잡이를 끌거나 ‘반반 보기’를 눌러 판면과 기록의 비율을 조절하세요.

## 재현 기준

판면 비율을 25~75% 안에서 조절합니다. 방향키는 2%씩 이동하며 Home과 End는 양 끝값, ‘반반 보기’는 50%로 맞춥니다.

## 기기별 조작

- iOS · 가운데 손잡이를 좌우로 끌어 판면 또는 기록 쪽을 넓혀 보세요.
- Android · 가운데 손잡이를 좌우로 끌어 판면 또는 기록 쪽을 넓혀 보세요.
- PC · 손잡이를 끌거나 Tab으로 선택해 좌우 방향키·Home·End를 사용하세요.

## 적용할 때

편집기에서 미리보기와 작업 정보를 동시에 볼 때.

## 그대로 보낼 요청

> 두 패널이 공간을 나눠 갖고 경계를 끌거나 키보드로 폭을 조절하게 해줘.

## 참고한 동작

[W3C WAI · Window Splitter](https://www.w3.org/WAI/ARIA/apg/patterns/windowsplitter/)

## 독립 실행 코드

아래 전체 코드를 HTML로 저장해 브라우저에서 엽니다.

```html
<!doctype html>
<html lang="ko"><head><script>if(new URLSearchParams(location.search).get('reduce')==='1')document.documentElement.classList.add('motion-reduced');</script><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>분할 패널 조절 · Motion Lab</title>
<style>
*{box-sizing:border-box}body{margin:0;font-family:system-ui,-apple-system,"Malgun Gothic",sans-serif;word-break:keep-all}button,input{font:inherit}button{cursor:pointer}button:focus-visible,input:focus-visible,[tabindex]:focus-visible{outline:3px solid #ef7c30;outline-offset:2px}button:disabled{cursor:default}button{touch-action:manipulation}.sr-only{position:absolute;inline-size:1px;block-size:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
body{background:#deded3;padding:16px;min-height:100svh;display:grid;place-items:center;color:#252a26}
main{width:min(100%,740px)}header,footer{display:flex;align-items:center;justify-content:space-between;gap:8px}header{margin-bottom:12px}h1{margin:0;font:700 clamp(21px,4vw,32px)/1.2 system-ui;letter-spacing:-.055em}header span,output{font:12px/1.4 monospace}
#panes{display:grid;grid-template-columns:minmax(0,var(--left,1fr)) 24px minmax(0,var(--right,1fr));height:clamp(238px,61svh,335px);background:#f8f5e9;border:1px solid #939489}
#preview,#record{min-width:0;container-type:inline-size}.print{height:100%;position:relative;display:grid;align-content:space-between;padding:clamp(8px,4cqw,20px);overflow:hidden;background:#e1ad4b;color:#292922}
.print small,.print label{position:relative;z-index:1;font:600 11px/1.2 monospace}.glyph{position:absolute;top:12%;bottom:1%;left:14%;display:flex;align-items:center;font:italic 700 clamp(100px,86cqw,263px)/1 Georgia,serif;color:#232920;transform:rotate(-12deg);text-shadow:4px 2px #c34329}.print .stripes{position:absolute;inset:auto 0 0;height:24%;background:repeating-linear-gradient(170deg,transparent 0 5px,#913922 5px 6px)}
#split{cursor:col-resize;position:relative;border:0;border-inline:1px solid #747a71;background:#e4e4d8;touch-action:none;z-index:2;display:grid;place-items:center}#split::before{content:"";position:absolute;top:0;bottom:0;left:50%;width:44px;transform:translateX(-50%)}#split span{width:7px;height:32px;border-inline:2px solid #777b71;pointer-events:none}#split:focus-visible{outline-offset:-3px}
#record{padding:0;background:#f9f7ef;overflow:auto}.record-body{padding:clamp(8px,5cqw,22px);overflow-wrap:anywhere}.record-body h2{margin:0 0 12px;font:italic 700 clamp(20px,14cqw,42px)/1.05 Georgia,serif;letter-spacing:-.055em}.record-body dl{margin:0}.record-body dl>div{display:flex;justify-content:space-between;gap:4px;flex-wrap:wrap;border-top:1px solid #cecdbd;padding:8px 0;color:#353831;font-size:13px}.record-body dt{color:#53594d}.record-body dd{margin:0;font-weight:650}
footer{min-height:55px}footer button{background:#f2f1e7;border:1px solid #8d9081;color:#23271f;padding:7px 11px;border-radius:3px;min-height:44px;font-size:13px}
@media(max-width:400px){body{padding:10px}#panes{grid-template-columns:minmax(0,var(--left,1fr)) 20px minmax(0,var(--right,1fr))}header span{font-size:10px}.record-body dl>div{font-size:12px}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:.001ms!important;transition-duration:.001ms!important;scroll-behavior:auto!important}}.motion-reduced *,.motion-reduced *::before,.motion-reduced *::after{animation-duration:.001ms!important;transition-duration:.001ms!important;scroll-behavior:auto!important}
</style></head><body>
<main><header><h1>활자 교정실</h1><span>견본 / 조판 기록</span></header>
<div id="panes"><section id="preview" aria-label="판면 미리보기"><div class="print"><small>TYPE PROOF</small><span class="glyph" aria-hidden="true">Rr</span><i class="stripes" aria-hidden="true"></i><small>R / 로만 이탤릭</small></div></section>
<div id="split" tabindex="0" role="separator" aria-label="판면 미리보기" aria-controls="preview" aria-orientation="vertical" aria-valuemin="25" aria-valuemax="75" aria-valuenow="50"><span aria-hidden="true"></span></div>
<section id="record" aria-label="조판 기록"><div class="record-body"><h2 lang="en">Type notes</h2><dl><div><dt>서체</dt><dd>로만 이탤릭</dd></div><div><dt>표본</dt><dd>R / r</dd></div><div><dt>자간</dt><dd>−24</dd></div><div><dt>잉크</dt><dd>먹·주홍 2도</dd></div><div><dt>용지</dt><dd>황색 비도공</dd></div></dl></div></section></div>
<footer><output id="ratio">판면 50% · 기록 50%</output><button id="reset" type="button">반반 보기</button></footer></main>
<script>
const panes=document.querySelector('#panes'),handle=document.querySelector('#split'),readout=document.querySelector('#ratio');
let value=50,drag=null;
function resize(next){
  value=Math.round(Math.max(25,Math.min(75,next)));
  panes.style.setProperty('--left',value+'fr');panes.style.setProperty('--right',(100-value)+'fr');
  handle.setAttribute('aria-valuenow',value);handle.setAttribute('aria-valuetext','판면 '+value+'퍼센트');
  readout.textContent='판면 '+value+'% · 기록 '+(100-value)+'%';
}
handle.addEventListener('pointerdown',e=>{
  if(!e.isPrimary||e.button!==0)return;
  const available=panes.clientWidth-handle.offsetWidth;
  drag={id:e.pointerId,start:e.clientX,value,available};handle.setPointerCapture(e.pointerId);handle.focus({preventScroll:true});
});
handle.addEventListener('pointermove',e=>{if(drag?.id===e.pointerId)resize(drag.value+(e.clientX-drag.start)*100/drag.available);});
function release(e){if(drag?.id!==e.pointerId)return;drag=null;if(handle.hasPointerCapture(e.pointerId))handle.releasePointerCapture(e.pointerId);}
handle.addEventListener('pointerup',release);handle.addEventListener('pointercancel',release);handle.addEventListener('lostpointercapture',release);
handle.addEventListener('keydown',e=>{
  const target={ArrowLeft:value-2,ArrowRight:value+2,Home:25,End:75};
  if(Object.hasOwn(target,e.key)){e.preventDefault();resize(target[e.key]);}
});
document.querySelector('#reset').onclick=()=>resize(50);resize(50);
</script></body></html>
```

