Files
minecraft_launcher/public/styles.css
claude-bot 7316477e23 Inline edit, URL-driven meta refresh, drag gap animation, copy-from-music
Music list tab:
- Title + artist are now contenteditable in-place. Typing updates state on
  every input event; Enter blurs (no embedded newlines), and on Save the
  current DOM text is re-synced into state.music[i].title/.artist before
  the JSON POST so a quick-save right after typing doesn't drop the last
  keystroke. While focused, the field is highlighted with the accent
  outline and unclamped so long titles wrap. Empty cells show a muted
  placeholder via :empty::before { content: attr(data-placeholder) }.
- Edit modal "save" now POSTs the new URL to /op/list/<pack>/video-meta
  (new endpoint backed by yt-dlp --dump-json --no-playlist) and patches
  state.music[i] with the returned title/channel/durationSec. If yt-dlp
  is unavailable or the lookup fails, the modal asks the user whether to
  apply just the URL change without metadata.
- Drag-and-drop UX: replaced the simple "highlight target" feedback with a
  "gap opens above the target" animation. The hovered row gets a
  .dropAbove class that animates margin-top to 64px via CSS transition,
  visually carving out the slot the dragged item will land in. Insertion
  math is now strictly "drop before the hover target" (with the
  srcIdx<dstIdx → dstIdx-1 adjustment after the splice removal), matching
  what the gap implies. Contenteditable spans no longer hijack drag start
  — on focus the parent <li>.draggable is flipped off so the user can
  freely select text, and back on at blur.

Image list tab:
- New "음악목록에서 가져오기" button. Copies state.music[*].url into
  state.images, which (via the existing thumbUrl() helper) renders each
  song's YouTube thumbnail as the image. Behind a confirm prompt because
  it replaces the entire image list.
- Same drag gap animation (.dropAbove → margin-left 80px) applied to the
  grid cards for consistency.

Server:
- youtube.ts: add fetchVideoMeta(url) using the same ensureYtDlp() path
  (auto-installed binary under %appdata%/.mc_custom). Returns one
  YtPlaylistEntry or null.
- routes/op.ts: POST /op/list/:packName/video-meta. 400 on missing URL,
  503 NO_YTDLP if the auto-install failed, 500 on other yt-dlp errors,
  200 { ok: true, entry } otherwise.

Smoke test (Rick Astley URL) returns
title=Rick Astley - Never Gonna..., channel=Rick Astley, durationSec=213.
2026-05-12 13:38:29 +09:00

527 lines
13 KiB
CSS

:root {
color-scheme: dark;
--bg: #0d1117;
--bg-alt: #161b22;
--bg-card: #1f242c;
--border: #30363d;
--text: #e6edf3;
--text-muted: #8b949e;
--accent: #2f81f7;
--accent-hover: #1f6feb;
--danger: #f85149;
--success: #3fb950;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.siteBody {
font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background: var(--bg);
color: var(--text);
min-height: 100vh;
}
body.siteBody.centerLayout {
display: flex;
align-items: center;
justify-content: center;
}
.pageWrap {
max-width: 1200px;
margin: 0 auto;
padding: 32px 24px 80px;
}
.topNav {
display: flex;
align-items: center;
justify-content: space-between;
padding: 16px 32px;
background: var(--bg-alt);
border-bottom: 1px solid var(--border);
}
.navBrand {
display: inline-flex;
align-items: center;
gap: 10px;
text-decoration: none;
color: inherit;
font-weight: 600;
}
.navLogo { font-size: 22px; }
.navTitle { font-size: 16px; }
.navUser { position: relative; }
.navUserButton {
background: transparent;
border: 1px solid var(--border);
color: var(--text);
padding: 8px 14px;
border-radius: 8px;
cursor: pointer;
font-size: 14px;
}
.navUserButton:hover { background: var(--bg-card); }
.navUserMenu {
position: absolute;
right: 0;
top: calc(100% + 6px);
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 10px;
padding: 8px;
min-width: 160px;
box-shadow: 0 12px 24px rgba(0,0,0,0.4);
z-index: 10;
}
.navUserMenu form { margin: 0; }
.dangerLink {
background: transparent;
border: none;
color: var(--danger);
cursor: pointer;
padding: 6px 8px;
font-size: 14px;
width: 100%;
text-align: left;
}
.dangerLink:hover { background: rgba(248, 81, 73, 0.1); border-radius: 6px; }
.hero h1 { margin: 0 0 8px; font-size: 30px; }
.hero p { color: var(--text-muted); margin: 0 0 32px; }
.muted { color: var(--text-muted); font-size: 13px; }
.cardRow {
display: flex;
gap: 16px;
flex-wrap: nowrap;
align-items: stretch;
}
.horizontalScroll {
overflow-x: auto;
padding-bottom: 12px;
}
.packCard {
flex: 0 0 280px;
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 14px;
padding: 18px;
display: flex;
flex-direction: column;
gap: 8px;
position: relative;
}
.packCard h2 { margin: 0; font-size: 18px; }
.metaList {
list-style: none;
padding: 0;
margin: 8px 0 0;
font-size: 13px;
color: var(--text-muted);
display: grid;
gap: 4px;
}
.cardLink {
text-decoration: none;
color: inherit;
display: flex;
flex-direction: column;
gap: 8px;
}
.cardLink[data-disabled="true"] { pointer-events: none; opacity: 0.85; }
.cardCheckbox {
position: absolute;
top: 12px;
right: 12px;
display: inline-flex;
align-items: center;
gap: 6px;
background: rgba(0,0,0,0.4);
padding: 4px 8px;
border-radius: 8px;
font-size: 12px;
}
.dashboardHeader {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 24px;
flex-wrap: wrap;
gap: 12px;
}
.dashboardHeader > div { min-width: 0; }
.dashboardHeader h1 { margin: 0; font-size: 24px; }
.dashboardActions {
display: flex;
gap: 8px;
flex-wrap: wrap;
margin-left: auto;
align-items: center;
}
.inlineForm { margin: 0; }
.deleteConfirmRow {
display: flex;
justify-content: flex-end;
gap: 8px;
margin-top: 12px;
}
.primaryButton {
background: var(--accent);
color: white;
border: none;
padding: 10px 18px;
border-radius: 8px;
cursor: pointer;
font-size: 14px;
font-weight: 600;
text-decoration: none;
display: inline-flex;
align-items: center;
justify-content: center;
}
.primaryButton:hover { background: var(--accent-hover); }
.secondaryButton {
background: var(--bg-card);
color: var(--text);
border: 1px solid var(--border);
padding: 10px 18px;
border-radius: 8px;
cursor: pointer;
font-size: 14px;
text-decoration: none;
display: inline-flex;
align-items: center;
justify-content: center;
}
.secondaryButton:hover { border-color: var(--accent); }
.dangerButton {
background: var(--danger);
color: white;
border: none;
padding: 10px 18px;
border-radius: 8px;
cursor: pointer;
font-size: 14px;
font-weight: 600;
text-decoration: none;
display: inline-flex;
align-items: center;
justify-content: center;
}
.dangerButton:hover { background: #d73a48; }
.ghostLink {
color: var(--text-muted);
text-decoration: none;
border: 1px solid var(--border);
padding: 8px 14px;
border-radius: 8px;
font-size: 13px;
}
.ghostLink:hover { color: var(--text); border-color: var(--accent); }
.editorHeader {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 24px;
}
.eyebrow {
text-transform: uppercase;
letter-spacing: 0.16em;
font-size: 11px;
color: var(--accent);
margin: 0 0 4px;
}
.editorHeader h1 { margin: 0; font-size: 24px; }
.editorForm {
display: flex;
flex-direction: column;
gap: 24px;
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 14px;
padding: 24px;
}
.gridTwo {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 16px;
}
.gridTwo > .fullSpan { grid-column: span 2; }
.editorForm label {
display: flex;
flex-direction: column;
gap: 6px;
font-size: 14px;
}
.editorForm input,
.editorForm select,
.editorForm textarea {
background: var(--bg);
color: var(--text);
border: 1px solid var(--border);
padding: 10px 12px;
border-radius: 8px;
font-size: 14px;
}
.editorForm input:focus,
.editorForm select:focus,
.editorForm textarea:focus {
outline: none;
border-color: var(--accent);
}
.dynamicListFieldset {
border: 1px dashed var(--border);
border-radius: 12px;
padding: 16px;
}
.dynamicListFieldset legend { padding: 0 8px; color: var(--text-muted); }
.dynamicList {
display: flex;
flex-direction: column;
gap: 8px;
margin-bottom: 12px;
}
.dynamicRow {
display: grid;
grid-template-columns: 1fr 2fr auto;
gap: 8px;
align-items: center;
}
.loginCard {
width: 360px;
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 16px;
padding: 32px;
box-shadow: 0 20px 60px rgba(0,0,0,0.45);
}
.loginCard h1 { margin: 0 0 16px; font-size: 22px; }
.loginForm {
display: flex;
flex-direction: column;
gap: 14px;
}
.loginForm label {
display: flex;
flex-direction: column;
gap: 6px;
font-size: 13px;
}
.loginForm input {
background: var(--bg);
color: var(--text);
border: 1px solid var(--border);
padding: 10px 12px;
border-radius: 8px;
font-size: 14px;
}
.errorBanner {
background: rgba(248, 81, 73, 0.15);
color: var(--danger);
border: 1px solid rgba(248, 81, 73, 0.4);
padding: 10px 12px;
border-radius: 8px;
font-size: 13px;
margin: 0 0 14px;
}
/* ── /op/list, /op/list/:pack, /op/datapack ────────────── */
.tabBar { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tabBtn {
background: transparent; border: none; color: var(--text-muted);
padding: 10px 18px; cursor: pointer; font-size: 14px;
border-bottom: 2px solid transparent;
}
.tabBtn:hover { color: var(--text); }
.tabBtn.active { color: var(--text); border-bottom-color: var(--accent); }
.tabPanel { display: block; }
.tabPanel[hidden] { display: none !important; }
.listActionsRow { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.statusText { font-size: 13px; color: var(--text-muted); margin-left: 8px; }
.statusText.error { color: var(--danger); }
.playlistRow { display: flex; gap: 8px; margin-bottom: 16px; }
.textInput {
flex: 1; background: var(--bg); color: var(--text);
border: 1px solid var(--border); padding: 10px 12px; border-radius: 8px;
font-size: 14px;
}
.textInput:focus { outline: none; border-color: var(--accent); }
/* 음악 행 */
.trackList { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.trackRow {
display: grid;
grid-template-columns: 36px 80px 1fr auto;
gap: 12px; align-items: center;
padding: 8px 12px; background: var(--bg-card);
border: 1px solid var(--border); border-radius: 8px;
cursor: grab; user-select: none;
transition: margin-top 0.18s ease, border-color 0.12s ease;
}
.trackRow.dragging { opacity: 0.5; }
/* 드래그 중 hover 표시: 위쪽으로 64px 공간이 벌어지며 "여기 끼울 수 있다" 를 표현 */
.trackRow.dropAbove { margin-top: 64px; border-color: var(--accent); }
.rowNum { color: var(--text-muted); font-size: 14px; text-align: center; }
.rowThumb { width: 80px; height: 45px; object-fit: cover; border-radius: 4px; background: #000; }
.rowMeta { min-width: 0; }
.rowTitle {
font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
outline: none; border-radius: 4px; padding: 2px 4px; margin: -2px -4px;
}
.rowSub {
font-size: 12px; color: var(--text-muted); margin-top: 2px;
outline: none; border-radius: 4px; padding: 2px 4px;
}
.rowTitle[contenteditable="true"]:hover,
.rowSub[contenteditable="true"]:hover { background: rgba(255,255,255,0.04); }
.rowTitle[contenteditable="true"]:focus,
.rowSub[contenteditable="true"]:focus {
background: var(--bg);
box-shadow: 0 0 0 1px var(--accent);
white-space: normal; cursor: text;
}
/* placeholder 효과: 비어 있을 때 회색 안내 텍스트 */
.rowTitle[contenteditable="true"]:empty::before,
.rowSub[contenteditable="true"]:empty::before {
content: attr(data-placeholder);
color: var(--text-muted);
opacity: 0.6;
}
.rowDur { color: var(--text-muted); font-size: 13px; }
/* 사진 그리드 */
.imageGrid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
gap: 12px;
}
.imageCard {
position: relative; aspect-ratio: 1 / 1; background: var(--bg-card);
border: 1px solid var(--border); border-radius: 10px;
overflow: hidden; cursor: grab; user-select: none;
transition: margin-left 0.18s ease, border-color 0.12s ease;
}
.imageCard.dragging { opacity: 0.5; }
/* 사진 그리드도 동일하게 "옆이 벌어진다" 표현 */
.imageCard.dropAbove { margin-left: 80px; border-color: var(--accent); }
.imageCard img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cardNum {
position: absolute; top: 6px; left: 6px;
background: rgba(0,0,0,0.7); color: #fff;
padding: 2px 8px; border-radius: 999px;
font-size: 12px; font-weight: 600;
}
/* 컨텍스트 메뉴 */
.ctxMenu {
position: absolute; z-index: 200;
background: var(--bg-card); border: 1px solid var(--border);
border-radius: 8px; padding: 4px; min-width: 120px;
box-shadow: 0 12px 24px rgba(0,0,0,0.5);
}
.ctxMenu button {
display: block; width: 100%; text-align: left;
background: transparent; border: none; color: var(--text);
padding: 8px 12px; cursor: pointer; font-size: 13px; border-radius: 4px;
}
.ctxMenu button:hover { background: var(--bg); }
/* 모달 (음악퀴즈 인스톨러의 modalOverlay 와 호환) */
.modalOverlay {
position: fixed; inset: 0; background: rgba(0,0,0,0.6);
display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modalOverlay[hidden] { display: none; }
.modalCard {
background: var(--bg-alt); border: 1px solid var(--border);
border-radius: 12px; width: min(560px, 92vw); max-height: 86vh;
display: grid; grid-template-rows: auto 1fr auto; overflow: hidden;
}
.modalCard > header {
display: flex; justify-content: space-between; align-items: center;
padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.modalCard > header h3 { margin: 0; font-size: 16px; }
.modalCard > footer { padding: 12px 16px; border-top: 1px solid var(--border); }
.modalClose { background: transparent; border: none; color: var(--text-muted); font-size: 22px; cursor: pointer; }
.modalClose:hover { color: var(--text); }
.modalBody { padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.modalBody label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-muted); }
/* 토글 버튼 (segmented) */
.segmentedRow { display: flex; gap: 4px; }
.segBtn {
background: var(--bg-card); border: 1px solid var(--border); color: var(--text-muted);
padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 13px;
}
.segBtn.active { border-color: var(--accent); color: var(--text); background: rgba(47,129,247,0.15); }
/* 데이터팩 페이지 */
.dpControls { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.dpActions { display: flex; gap: 8px; align-items: center; margin: 12px 0; }
.codeBlock {
background: var(--bg-card); border: 1px solid var(--border);
border-radius: 10px; padding: 14px 16px; overflow-x: auto;
font-family: 'Consolas','SFMono-Regular',monospace; font-size: 13px;
white-space: pre-wrap; word-break: break-word;
max-height: 60vh; overflow-y: auto;
}
.packCard.pickable { cursor: pointer; }
.packCard.pickable:hover { border-color: var(--accent); }