@madeinbruno/music-plug 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,3 +1,81 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
1
+ # @madeinbruno/music-plug
2
+
3
+ 글 속 노래 한 곡을, 듣는 사람이 쓰는 음원 앱에서 듣게 하는 플러그예요. [Music plug](https://musicplug.madeinbruno.com)의 듣기 플러그를 다른 사이트에 붙이는 패키지예요.
4
+
5
+ ```
6
+ ♪ 밤편지 · 아이유 ← 처음 누르면 Music plug 듣기 플러그가 뜬다
7
+ ♪ 밤편지 · 아이유 멜론 · 바꾸기 ← 고른 뒤에는 누르면 바로 멜론에서
8
+ ```
9
+
10
+ - 처음 누르면 **듣기 플러그**(Music plug 창)가 떠서 어디서 들을지 골라요: YouTube(기본) · 멜론 · 지니 · 벅스 · FLO · VIBE · Spotify · Apple Music · YouTube Music. YouTube는 유튜브 영상이 있으면 이 페이지에서 바로, 없으면 YouTube로 열어요.
11
+ - 고르면 그곳에서 이 곡을 열어요 (폰에서는 앱으로). Music plug가 곡을 찾아 보내요: YouTube·YouTube Music은 그 곡을 바로(시작 시각까지), Apple Music은 곡 페이지, 나머지는 그곳의 검색 결과.
12
+ - 고른 곳은 기억해서 다음부터는 누르면 바로 그곳에서 열어요. 곡 옆의 **바꾸기**로 다시 골라요. madeinbruno.com 아래에서는 Music plug와 같이 기억해요 (쿠키 `mp_service`).
13
+ - YouTube를 고르면 글 안에 유튜브 플레이어를 열어요. 읽어 내려가면 왼쪽 아래에 멈추기·다시 듣기 단추가 떠요. 브라우저가 소리 있는 자동재생을 막아서 한 번은 눌러야 나오고, 유튜브 정책상 플레이어는 보이게 둬요.
14
+ - 곡 정보를 모르면(유튜브에서 제목을 못 받으면) 다른 곳에서 찾을 수 없어서 이 페이지에서 YouTube로만 틀어요.
15
+
16
+ ## 설치
17
+
18
+ ```bash
19
+ pnpm add @madeinbruno/music-plug
20
+ ```
21
+
22
+ ## 쓰기 (Next.js 예)
23
+
24
+ ```tsx
25
+ // 서버 컴포넌트
26
+ import { songFromYoutube, youtubeId, youtubeStart } from '@madeinbruno/music-plug';
27
+ import { PlugPlayer } from '@madeinbruno/music-plug/player';
28
+ import '@madeinbruno/music-plug/styles.css'; // 앱에서 한 번만
29
+
30
+ export default async function Post({ music }: { music: string }) {
31
+ const id = youtubeId(music); // 유튜브(뮤직) 주소 → 영상 번호
32
+ if (!id) return null;
33
+ return (
34
+ <PlugPlayer
35
+ song={await songFromYoutube(id)} // 곡 제목·가수 짐작 (하루 캐시). 모르면 null
36
+ fallbackLabel="테마 음악"
37
+ youtube={{ id, start: youtubeStart(music) }}
38
+ avoid=".mib-footer"
39
+ />
40
+ );
41
+ }
42
+ ```
43
+
44
+ | 내보내는 것 | 설명 |
45
+ |---|---|
46
+ | `PlugPlayer` (`/player`) | 곡 한 줄과 듣기 플러그. `song`(제목·가수, 모르면 `null`), `fallbackLabel`, `youtube`(`id`, `start` 초. 있으면 YouTube를 글 안에서, 없으면 YouTube로 연다), `avoid`(이 요소가 보이면 멈추기 단추를 숨김), `base`(Music plug 주소, 기본 `https://musicplug.madeinbruno.com`) |
47
+ | `PlugSheet` (`/player`) | 듣기 플러그 창만 따로 |
48
+ | `listenPageUrl(song, youtube?)` | Music plug의 고르는 화면 주소 (`/listen`). 링크로만 걸고 싶을 때. 전에 고른 곳이 있으면 그 화면 없이 바로 그곳으로 가요 |
49
+ | `listenGoUrl(service, song, youtube?)` | 고른 곳에서 이 곡을 여는 주소 (`/listen/go`) |
50
+ | `youtubeId(url)`, `youtubeStart(url)` | youtube.com · youtu.be · music.youtube.com · shorts 주소에서 영상 번호와 시작 시각(`t=`) |
51
+ | `songFromYoutube(id)` | 유튜브 oEmbed로 영상 제목·채널을 받아 곡 제목·가수를 짐작 (서버에서). 못 받으면 `null` |
52
+ | `songFromVideo(title, channel)`, `cleanTitle(title)` | 위의 짐작만 따로 ("가수 - 제목", "가수 '제목'", 유튜브 뮤직의 "가수 - Topic" 채널, `(Official MV)` 같은 꼬리표 지우기) |
53
+ | `SERVICES`, `getService(id)` | 들을 수 있는 곳 |
54
+
55
+ 곡 줄은 둘러싼 글의 색을 따르고, 듣기 플러그 창은 Music plug 색이에요. 멈추기 단추의 바탕은 `--mp-ground`로 바꿀 수 있어요.
56
+
57
+ ## Music plug 쪽
58
+
59
+ 듣기 플러그의 본체는 Music plug 앱(`apps/music-plug`)에 있어요.
60
+ - `/listen?t=제목&a=가수[&v=유튜브번호][&start=초][&pick=1]`: 어디서 들을지 고르는 화면. 전에 고른 곳이 있으면 바로 그곳으로 (`pick=1`이면 다시 고른다). 공유받은 플레이리스트의 곡마다 붙은 '듣기'도 여기로 와요.
61
+ - `/listen/go?s=고른곳&…[&remember=1]`: 그곳에서 이 곡을 찾아 보내요 (`src/server/listen.ts`). `remember=1`이면 고른 곳을 기억해요.
62
+
63
+ ## 개발
64
+
65
+ ```bash
66
+ pnpm --filter @madeinbruno/music-plug test # 곡 정보 짐작 시험
67
+ pnpm --filter @madeinbruno/music-plug build # dist/ 생성
68
+ ```
69
+
70
+ ## 배포 (npm)
71
+
72
+ atelier와 같아요 (`.github/workflows/publish-music-plug.yml`). `package.json`의 `version`을 올려 `main`에 푸시하면 Actions가 npm 승인 대기열에 올리고, npmjs.com에서 승인하면 공개돼요.
73
+
74
+ **처음 한 번은 손으로 올려야 해요.** npm의 trusted publishing은 이미 있는 패키지에만 설정할 수 있어서요.
75
+
76
+ ```bash
77
+ npm login
78
+ cd packages/music-plug && pnpm install && pnpm build && npm publish --access public
79
+ ```
80
+
81
+ 그다음 npmjs.com → `@madeinbruno/music-plug` → Settings → Trusted publishing에 저장소 `codingbotPark/madeinbruno`, 워크플로 `publish-music-plug.yml`을 등록해 두면, 다음 버전부터는 Actions가 올려요.
@@ -0,0 +1,71 @@
1
+ /**
2
+ * 들을 수 있는 곳. 앱 Music plug(apps/music-plug/src/server/listen.ts)의 목록과 이름(id)이 같다.
3
+ * 고른 곳은 쿠키 mp_service에 두고, madeinbruno.com 아래에서는 Music plug와 같이 쓴다.
4
+ * - here: YouTube를 이 페이지에서 바로 (글 안에 유튜브 플레이어를 연다). 화면에는 그냥 'YouTube'로 보인다
5
+ * - ytvideo: YouTube (앱·사이트)
6
+ * - youtube: YouTube Music (Music plug의 이름을 따른다)
7
+ */
8
+ type ServiceId = 'here' | 'ytvideo' | 'melon' | 'genie' | 'bugs' | 'flo' | 'vibe' | 'spotify' | 'apple' | 'youtube';
9
+ type Service = {
10
+ id: ServiceId;
11
+ name: string;
12
+ color: string;
13
+ initial: string;
14
+ };
15
+ declare const SERVICES: Service[];
16
+ declare function getService(id: string | null | undefined): Service | undefined;
17
+ /** Music plug 주소 (듣기 플러그 화면, 고른 곳으로 보내기) */
18
+ declare const MUSIC_PLUG_URL = "https://musicplug.madeinbruno.com";
19
+ type ListenSong = {
20
+ title: string;
21
+ artist: string;
22
+ };
23
+ /**
24
+ * 고른 곳에서 이 곡을 여는 주소 (Music plug가 받아서 곡을 찾아 보낸다: YouTube·YouTube Music은 그 곡 바로, Apple Music은 곡 페이지, 나머지는 검색 결과).
25
+ * remember면 Music plug가 고른 곳을 기억한다.
26
+ */
27
+ declare function listenGoUrl(service: ServiceId, song: ListenSong | null, youtube?: {
28
+ id: string;
29
+ start?: number;
30
+ }, { base, remember }?: {
31
+ base?: string | undefined;
32
+ remember?: boolean | undefined;
33
+ }): string;
34
+ /** Music plug의 고르는 화면 주소 (링크로 걸 때) */
35
+ declare function listenPageUrl(song: ListenSong | null, youtube?: {
36
+ id: string;
37
+ start?: number;
38
+ }, { base }?: {
39
+ base?: string | undefined;
40
+ }): string;
41
+
42
+ /**
43
+ * 유튜브 주소 읽기. 받는 주소: youtube.com/watch?v=…, youtu.be/…, music.youtube.com/watch?v=…, youtube.com/shorts/…, /embed/…, /live/…
44
+ */
45
+ declare function youtubeId(url: string | null | undefined): string | null;
46
+ /** 시작 시각 (t=90, t=1m30s) → 초 */
47
+ declare function youtubeStart(url: string | null | undefined): number;
48
+
49
+ /** 한 곡. 다른 음원 앱에서 찾을 때 "제목 가수"로 찾는다 */
50
+ type Song = {
51
+ title: string;
52
+ artist: string;
53
+ };
54
+ /** 영상 제목에서 꼬리표 괄호와 'Official MV' 같은 말을 지운다 */
55
+ declare function cleanTitle(title: string): string;
56
+ /**
57
+ * 유튜브 영상 제목·채널로 곡 정보를 짐작한다.
58
+ * - 유튜브 뮤직 곡(채널이 "가수 - Topic")이면 제목이 곧 곡 제목
59
+ * - "가수 - 제목", "가수 '제목'", "가수 「제목」"
60
+ * - 그 밖에는 채널 이름을 가수로
61
+ */
62
+ declare function songFromVideo(videoTitle: string, channel: string): Song;
63
+ /** 다른 음원 앱에서 찾을 말 */
64
+ declare const songQuery: (song: Song) => string;
65
+ /**
66
+ * 유튜브 영상 하나의 곡 정보 (서버에서). 유튜브 oEmbed로 제목·채널을 받아 짐작한다. 못 받으면 null.
67
+ * Next.js에서는 하루 캐시한다.
68
+ */
69
+ declare function songFromYoutube(id: string): Promise<Song | null>;
70
+
71
+ export { MUSIC_PLUG_URL, SERVICES, type Service, type ServiceId, type Song, cleanTitle, getService, listenGoUrl, listenPageUrl, songFromVideo, songFromYoutube, songQuery, youtubeId, youtubeStart };
package/dist/index.js ADDED
@@ -0,0 +1,103 @@
1
+ // src/services.ts
2
+ var SERVICES = [
3
+ { id: "here", name: "YouTube", color: "#ff0033", initial: "Y" },
4
+ { id: "ytvideo", name: "YouTube", color: "#ff0033", initial: "Y" },
5
+ { id: "melon", name: "\uBA5C\uB860", color: "#00cd3c", initial: "M" },
6
+ { id: "genie", name: "\uC9C0\uB2C8", color: "#2aa8ff", initial: "G" },
7
+ { id: "bugs", name: "\uBC85\uC2A4", color: "#ff5a3c", initial: "B" },
8
+ { id: "flo", name: "FLO", color: "#7a6bff", initial: "F" },
9
+ { id: "vibe", name: "VIBE", color: "#ff4d8d", initial: "V" },
10
+ { id: "spotify", name: "Spotify", color: "#1ed760", initial: "S" },
11
+ { id: "apple", name: "Apple Music", color: "#fa586a", initial: "A" },
12
+ { id: "youtube", name: "YouTube Music", color: "#ff4444", initial: "Y" }
13
+ ];
14
+ function getService(id) {
15
+ return SERVICES.find((s) => s.id === id);
16
+ }
17
+ var MUSIC_PLUG_URL = "https://musicplug.madeinbruno.com";
18
+ function tail(song, youtube) {
19
+ const p = new URLSearchParams();
20
+ if (song?.title) p.set("t", song.title);
21
+ if (song?.artist) p.set("a", song.artist);
22
+ if (youtube?.id) p.set("v", youtube.id);
23
+ if (youtube?.start) p.set("start", String(youtube.start));
24
+ return p.toString();
25
+ }
26
+ function listenGoUrl(service, song, youtube, { base = MUSIC_PLUG_URL, remember = false } = {}) {
27
+ return `${base}/listen/go?s=${service}${remember ? "&remember=1" : ""}&${tail(song, youtube)}`;
28
+ }
29
+ function listenPageUrl(song, youtube, { base = MUSIC_PLUG_URL } = {}) {
30
+ return `${base}/listen?${tail(song, youtube)}`;
31
+ }
32
+
33
+ // src/youtube.ts
34
+ function youtubeId(url) {
35
+ if (!url) return null;
36
+ try {
37
+ const u = new URL(url.trim());
38
+ const host = u.hostname.replace(/^(www|m|music)\./, "");
39
+ let id = null;
40
+ if (host === "youtu.be") id = u.pathname.slice(1).split("/")[0];
41
+ else if (host === "youtube.com" || host === "youtube-nocookie.com") {
42
+ id = u.searchParams.get("v") ?? u.pathname.match(/^\/(?:shorts|embed|live)\/([^/]+)/)?.[1] ?? null;
43
+ }
44
+ return id && /^[\w-]{11}$/.test(id) ? id : null;
45
+ } catch {
46
+ return null;
47
+ }
48
+ }
49
+ function youtubeStart(url) {
50
+ if (!url) return 0;
51
+ try {
52
+ const t = new URL(url.trim()).searchParams.get("t") ?? "";
53
+ const m = t.match(/^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s?)?$/);
54
+ return m ? Number(m[1] ?? 0) * 3600 + Number(m[2] ?? 0) * 60 + Number(m[3] ?? 0) : 0;
55
+ } catch {
56
+ return 0;
57
+ }
58
+ }
59
+
60
+ // src/song.ts
61
+ var TAG = /official|music\s*video|m\/?v|\bmv\b|audio|lyrics?|visuali[sz]er|video|teaser|performance|special|clip|\b4k\b|\bhd\b|\bhq\b|가사|뮤직\s*비디오|공식|full\s*ver/i;
62
+ var BRACKETS = /\s*[([【「『〔{]([^)\]】」』〕}]*)[)\]】」』〕}]/g;
63
+ function cleanTitle(title) {
64
+ return title.replace(BRACKETS, (all, inner) => TAG.test(inner) ? "" : all).replace(/\s*(official\s*)?(music\s*video|m\/v|mv|audio|lyric\s*video)\s*$/i, "").replace(/\s{2,}/g, " ").trim();
65
+ }
66
+ function cleanChannel(name) {
67
+ return name.replace(/\s*-\s*Topic$/i, "").replace(/vevo$/i, "").replace(/\s*(official|공식|channel|채널)\s*$/i, "").trim();
68
+ }
69
+ function songFromVideo(videoTitle, channel) {
70
+ if (/\s-\s*Topic$/i.test(channel)) return { title: cleanTitle(videoTitle), artist: cleanChannel(channel) };
71
+ const t = cleanTitle(videoTitle);
72
+ const dash = t.match(/^(.+?)\s+[-–—]\s+(.+)$/);
73
+ if (dash) return { artist: dash[1].trim(), title: dash[2].trim() };
74
+ const quoted = t.match(/^(.+?)\s*['"‘“「『](.+?)['"’”」』]/);
75
+ if (quoted) return { artist: quoted[1].trim(), title: quoted[2].trim() };
76
+ return { title: t, artist: cleanChannel(channel) };
77
+ }
78
+ var songQuery = (song) => [song.title, song.artist].filter(Boolean).join(" ");
79
+ async function songFromYoutube(id) {
80
+ try {
81
+ const url = `https://www.youtube.com/oembed?url=${encodeURIComponent(`https://www.youtube.com/watch?v=${id}`)}&format=json`;
82
+ const res = await fetch(url, { next: { revalidate: 86400 }, signal: AbortSignal.timeout(3e3) });
83
+ if (!res.ok) return null;
84
+ const data = await res.json();
85
+ if (!data.title) return null;
86
+ return songFromVideo(data.title, data.author_name ?? "");
87
+ } catch {
88
+ return null;
89
+ }
90
+ }
91
+ export {
92
+ MUSIC_PLUG_URL,
93
+ SERVICES,
94
+ cleanTitle,
95
+ getService,
96
+ listenGoUrl,
97
+ listenPageUrl,
98
+ songFromVideo,
99
+ songFromYoutube,
100
+ songQuery,
101
+ youtubeId,
102
+ youtubeStart
103
+ };
@@ -0,0 +1,69 @@
1
+ import * as react from 'react';
2
+
3
+ /**
4
+ * 들을 수 있는 곳. 앱 Music plug(apps/music-plug/src/server/listen.ts)의 목록과 이름(id)이 같다.
5
+ * 고른 곳은 쿠키 mp_service에 두고, madeinbruno.com 아래에서는 Music plug와 같이 쓴다.
6
+ * - here: YouTube를 이 페이지에서 바로 (글 안에 유튜브 플레이어를 연다). 화면에는 그냥 'YouTube'로 보인다
7
+ * - ytvideo: YouTube (앱·사이트)
8
+ * - youtube: YouTube Music (Music plug의 이름을 따른다)
9
+ */
10
+ type ServiceId = 'here' | 'ytvideo' | 'melon' | 'genie' | 'bugs' | 'flo' | 'vibe' | 'spotify' | 'apple' | 'youtube';
11
+ type Service = {
12
+ id: ServiceId;
13
+ name: string;
14
+ color: string;
15
+ initial: string;
16
+ };
17
+
18
+ /** 한 곡. 다른 음원 앱에서 찾을 때 "제목 가수"로 찾는다 */
19
+ type Song = {
20
+ title: string;
21
+ artist: string;
22
+ };
23
+
24
+ /**
25
+ * 글 속 노래 한 곡의 '음악 듣기'.
26
+ *
27
+ * ♪ 밤편지 · 아이유
28
+ *
29
+ * - 처음 누르면 Music plug 듣기 플러그(PlugSheet)가 떠서 어디서 들을지 고른다:
30
+ * YouTube(기본) · 멜론 · 지니 · 벅스 · FLO · VIBE · Spotify · Apple Music · YouTube Music
31
+ * YouTube는 유튜브 영상이 있으면 이 페이지에서 바로(글 안의 플레이어), 없으면 YouTube로 연다.
32
+ * - 고르면 그곳에서 이 곡을 연다 (Music plug가 곡을 찾아 보낸다. 폰에서는 앱으로). YouTube면 글 안에서 유튜브 플레이어가 열린다.
33
+ * - 고른 곳은 기억해서 다음부터는 누르면 바로 그곳에서 연다. 곡 옆에 옅게 '멜론 · 바꾸기'가 보이고, 바꾸기로 다시 고른다.
34
+ * 기억은 쿠키 mp_service(madeinbruno.com 아래에서는 Music plug와 같이)와 이 브라우저(localStorage)에 둔다.
35
+ * - 곡을 모르면(song이 null) 다른 곳에서 찾을 수 없어서 이 페이지에서 YouTube로만 튼다.
36
+ * - 유튜브로 듣는 중에 읽어 내려가 플레이어가 화면 밖으로 나가면 왼쪽 아래에 멈추기·다시 듣기 단추가 뜬다 (avoid로 준 요소가 보일 때는 숨긴다).
37
+ *
38
+ * 스타일은 '@madeinbruno/music-plug/styles.css' (클래스는 모두 mp-). 곡 줄은 둘러싼 글의 색을 따르고, 듣기 플러그는 Music plug 색이다.
39
+ */
40
+ type PlugPlayerProps = {
41
+ /** 곡 제목·가수. 모르면 null */
42
+ song: Song | null;
43
+ /** 곡을 모를 때 보일 이름 (기본: '음악 듣기') */
44
+ fallbackLabel?: string;
45
+ /** 유튜브 영상. 있으면 YouTube를 고를 때 글 안에서 바로 틀고, 없으면 YouTube로 연다 */
46
+ youtube?: {
47
+ id: string;
48
+ start?: number;
49
+ };
50
+ /** 유튜브 플레이어가 화면 밖일 때 뜨는 멈추기 단추를, 이 요소가 보이면 숨긴다 (예: '.mib-footer') */
51
+ avoid?: string;
52
+ /** Music plug 주소 (기본 https://musicplug.madeinbruno.com) */
53
+ base?: string;
54
+ className?: string;
55
+ };
56
+ declare function PlugPlayer({ song, fallbackLabel, youtube, avoid, base, className }: PlugPlayerProps): react.JSX.Element;
57
+ /**
58
+ * Music plug 듣기 플러그: 어디서 들을지 고르는 창. Music plug의 /listen 화면과 같은 모양.
59
+ * 바깥을 누르거나 Esc로 닫는다.
60
+ */
61
+ declare function PlugSheet({ song, services, current, onChoose, onClose, }: {
62
+ song: Song | null;
63
+ services: Service[];
64
+ current: ServiceId | null;
65
+ onChoose: (s: Service) => void;
66
+ onClose: () => void;
67
+ }): react.JSX.Element;
68
+
69
+ export { PlugPlayer, type PlugPlayerProps, PlugSheet };
package/dist/player.js ADDED
@@ -0,0 +1,225 @@
1
+ "use client";
2
+
3
+ // src/player.tsx
4
+ import { useEffect, useRef, useState } from "react";
5
+
6
+ // src/logos.ts
7
+ var YT = "M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z";
8
+ var LOGO_PATHS = {
9
+ here: YT,
10
+ ytvideo: YT,
11
+ spotify: "M12 0C5.4 0 0 5.4 0 12s5.4 12 12 12 12-5.4 12-12S18.66 0 12 0zm5.521 17.34c-.24.359-.66.48-1.021.24-2.82-1.74-6.36-2.101-10.561-1.141-.418.122-.779-.179-.899-.539-.12-.421.18-.78.54-.9 4.56-1.021 8.52-.6 11.64 1.32.42.18.479.659.301 1.02zm1.44-3.3c-.301.42-.841.6-1.262.3-3.239-1.98-8.159-2.58-11.939-1.38-.479.12-1.02-.12-1.14-.6-.12-.48.12-1.021.6-1.141C9.6 9.9 15 10.561 18.72 12.84c.361.181.54.78.241 1.2zm.12-3.36C15.24 8.4 8.82 8.16 5.16 9.301c-.6.179-1.2-.181-1.38-.721-.18-.601.18-1.2.72-1.381 4.26-1.26 11.28-1.02 15.721 1.621.539.3.719 1.02.419 1.56-.299.421-1.02.599-1.559.3z",
12
+ apple: "M23.994 6.124a9.23 9.23 0 00-.24-2.19c-.317-1.31-1.062-2.31-2.18-3.043a5.022 5.022 0 00-1.877-.726 10.496 10.496 0 00-1.564-.15c-.04-.003-.083-.01-.124-.013H5.986c-.152.01-.303.017-.455.026-.747.043-1.49.123-2.193.4-1.336.53-2.3 1.452-2.865 2.78-.192.448-.292.925-.363 1.408-.056.392-.088.785-.1 1.18 0 .032-.007.062-.01.093v12.223c.01.14.017.283.027.424.05.815.154 1.624.497 2.373.65 1.42 1.738 2.353 3.234 2.801.42.127.856.187 1.293.228.555.053 1.11.06 1.667.06h11.03a12.5 12.5 0 001.57-.1c.822-.106 1.596-.35 2.295-.81a5.046 5.046 0 001.88-2.207c.186-.42.293-.87.37-1.324.113-.675.138-1.358.137-2.04-.002-3.8 0-7.595-.003-11.393zm-6.423 3.99v5.712c0 .417-.058.827-.244 1.206-.29.59-.76.962-1.388 1.14-.35.1-.706.157-1.07.173-.95.045-1.773-.6-1.943-1.536a1.88 1.88 0 011.038-2.022c.323-.16.67-.25 1.018-.324.378-.082.758-.153 1.134-.24.274-.063.457-.23.51-.516a.904.904 0 00.02-.193c0-1.815 0-3.63-.002-5.443a.725.725 0 00-.026-.185c-.04-.15-.15-.243-.304-.234-.16.01-.318.035-.475.066-.76.15-1.52.303-2.28.456l-2.325.47-1.374.278c-.016.003-.032.01-.048.013-.277.077-.377.203-.39.49-.002.042 0 .086 0 .13-.002 2.602 0 5.204-.003 7.805 0 .42-.047.836-.215 1.227-.278.64-.77 1.04-1.434 1.233-.35.1-.71.16-1.075.172-.96.036-1.755-.6-1.92-1.544-.14-.812.23-1.685 1.154-2.075.357-.15.73-.232 1.108-.31.287-.06.575-.116.86-.177.383-.083.583-.323.6-.714v-.15c0-2.96 0-5.922.002-8.882 0-.123.013-.25.042-.37.07-.285.273-.448.546-.518.255-.066.515-.112.774-.165.733-.15 1.466-.296 2.2-.444l2.27-.46c.67-.134 1.34-.27 2.01-.403.22-.043.442-.088.663-.106.31-.025.523.17.554.482.008.073.012.148.012.223.002 1.91.002 3.822 0 5.732z",
13
+ youtube: "M12 0C5.376 0 0 5.376 0 12s5.376 12 12 12 12-5.376 12-12S18.624 0 12 0zm0 19.104c-3.924 0-7.104-3.18-7.104-7.104S8.076 4.896 12 4.896s7.104 3.18 7.104 7.104-3.18 7.104-7.104 7.104zm0-13.332c-3.432 0-6.228 2.796-6.228 6.228S8.568 18.228 12 18.228s6.228-2.796 6.228-6.228S15.432 5.772 12 5.772zM9.684 15.54V8.46L15.816 12l-6.132 3.54z"
14
+ };
15
+
16
+ // src/services.ts
17
+ var SERVICES = [
18
+ { id: "here", name: "YouTube", color: "#ff0033", initial: "Y" },
19
+ { id: "ytvideo", name: "YouTube", color: "#ff0033", initial: "Y" },
20
+ { id: "melon", name: "\uBA5C\uB860", color: "#00cd3c", initial: "M" },
21
+ { id: "genie", name: "\uC9C0\uB2C8", color: "#2aa8ff", initial: "G" },
22
+ { id: "bugs", name: "\uBC85\uC2A4", color: "#ff5a3c", initial: "B" },
23
+ { id: "flo", name: "FLO", color: "#7a6bff", initial: "F" },
24
+ { id: "vibe", name: "VIBE", color: "#ff4d8d", initial: "V" },
25
+ { id: "spotify", name: "Spotify", color: "#1ed760", initial: "S" },
26
+ { id: "apple", name: "Apple Music", color: "#fa586a", initial: "A" },
27
+ { id: "youtube", name: "YouTube Music", color: "#ff4444", initial: "Y" }
28
+ ];
29
+ function getService(id) {
30
+ return SERVICES.find((s) => s.id === id);
31
+ }
32
+ var MUSIC_PLUG_URL = "https://musicplug.madeinbruno.com";
33
+ function tail(song, youtube) {
34
+ const p = new URLSearchParams();
35
+ if (song?.title) p.set("t", song.title);
36
+ if (song?.artist) p.set("a", song.artist);
37
+ if (youtube?.id) p.set("v", youtube.id);
38
+ if (youtube?.start) p.set("start", String(youtube.start));
39
+ return p.toString();
40
+ }
41
+ function listenGoUrl(service, song, youtube, { base = MUSIC_PLUG_URL, remember = false } = {}) {
42
+ return `${base}/listen/go?s=${service}${remember ? "&remember=1" : ""}&${tail(song, youtube)}`;
43
+ }
44
+
45
+ // src/player.tsx
46
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
47
+ var KEY = "musicplug.service";
48
+ var SHARED_DOMAIN = "madeinbruno.com";
49
+ function readChoice() {
50
+ const cookie = document.cookie.match(/(?:^|;\s*)mp_service=([^;]+)/)?.[1];
51
+ let stored = null;
52
+ try {
53
+ stored = localStorage.getItem(KEY);
54
+ } catch {
55
+ }
56
+ return getService(cookie)?.id ?? getService(stored)?.id ?? null;
57
+ }
58
+ function saveChoice(id) {
59
+ try {
60
+ localStorage.setItem(KEY, id);
61
+ } catch {
62
+ }
63
+ const host = location.hostname;
64
+ const shared = host === SHARED_DOMAIN || host.endsWith(`.${SHARED_DOMAIN}`) ? `; domain=.${SHARED_DOMAIN}` : "";
65
+ document.cookie = `mp_service=${id}; path=/; max-age=31536000; samesite=lax${shared}`;
66
+ }
67
+ function PlugPlayer({ song, fallbackLabel = "\uC74C\uC545 \uB4E3\uAE30", youtube, avoid, base = MUSIC_PLUG_URL, className }) {
68
+ const [choice, setChoice] = useState(null);
69
+ const [sheet, setSheet] = useState(false);
70
+ const [open, setOpen] = useState(false);
71
+ const [playing, setPlaying] = useState(false);
72
+ const [chip, setChip] = useState(false);
73
+ const frame = useRef(null);
74
+ useEffect(() => setChoice(readChoice()), []);
75
+ const known = Boolean(song?.title);
76
+ const services = SERVICES.filter((s) => s.id === "here" ? Boolean(youtube) : s.id === "ytvideo" ? !youtube : known);
77
+ const isYoutube = (id) => id === "here" || id === "ytvideo";
78
+ const remembered = services.find((s) => s.id === choice || isYoutube(choice) && isYoutube(s.id)) ?? null;
79
+ function play(s) {
80
+ if (s.id === "here") {
81
+ setOpen(true);
82
+ setPlaying(true);
83
+ return;
84
+ }
85
+ window.open(listenGoUrl(s.id, song, youtube, { base }), "_blank", "noopener");
86
+ }
87
+ function choose(s) {
88
+ saveChoice(s.id);
89
+ setChoice(s.id);
90
+ setSheet(false);
91
+ play(s);
92
+ }
93
+ function tap() {
94
+ if (!known && youtube) return play(SERVICES[0]);
95
+ if (remembered) play(remembered);
96
+ else setSheet(true);
97
+ }
98
+ const command = (func) => frame.current?.contentWindow?.postMessage(JSON.stringify({ event: "command", func, args: [] }), "https://www.youtube-nocookie.com");
99
+ useEffect(() => {
100
+ if (!open) return;
101
+ const seen = /* @__PURE__ */ new Map();
102
+ const io = new IntersectionObserver((entries) => {
103
+ for (const e of entries) seen.set(e.target, e.isIntersecting);
104
+ setChip(![...seen.values()].some(Boolean));
105
+ });
106
+ const targets = [frame.current, avoid ? document.querySelector(avoid) : null].filter((el) => el !== null);
107
+ for (const el of targets) {
108
+ seen.set(el, false);
109
+ io.observe(el);
110
+ }
111
+ return () => io.disconnect();
112
+ }, [open, avoid]);
113
+ const label = song && [song.title, song.artist].filter(Boolean).join(" \xB7 ") || fallbackLabel;
114
+ return /* @__PURE__ */ jsxs("div", { className: ["mp-plug", className].filter(Boolean).join(" "), children: [
115
+ /* @__PURE__ */ jsxs("div", { className: "mp-plug__row", children: [
116
+ /* @__PURE__ */ jsxs("button", { type: "button", className: "mp-plug__song", onClick: tap, children: [
117
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: "\u266A" }),
118
+ " ",
119
+ label
120
+ ] }),
121
+ known && remembered && /* @__PURE__ */ jsxs("span", { className: "mp-plug__where", children: [
122
+ remembered.name,
123
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: " \xB7 " }),
124
+ /* @__PURE__ */ jsx("button", { type: "button", onClick: () => setSheet(true), children: "\uBC14\uAFB8\uAE30" })
125
+ ] })
126
+ ] }),
127
+ open && youtube && /* @__PURE__ */ jsx("div", { className: "mp-plug__frame", children: /* @__PURE__ */ jsx(
128
+ "iframe",
129
+ {
130
+ ref: frame,
131
+ src: `https://www.youtube-nocookie.com/embed/${youtube.id}?autoplay=1&playsinline=1&rel=0&enablejsapi=1${youtube.start ? `&start=${youtube.start}` : ""}`,
132
+ title: label,
133
+ allow: "autoplay; encrypted-media; picture-in-picture",
134
+ allowFullScreen: true
135
+ }
136
+ ) }),
137
+ open && chip && /* @__PURE__ */ jsxs(
138
+ "button",
139
+ {
140
+ type: "button",
141
+ className: "mp-plug__chip",
142
+ onClick: () => {
143
+ command(playing ? "pauseVideo" : "playVideo");
144
+ setPlaying(!playing);
145
+ },
146
+ children: [
147
+ "\u266A ",
148
+ playing ? "\uBA48\uCD94\uAE30" : "\uB2E4\uC2DC \uB4E3\uAE30"
149
+ ]
150
+ }
151
+ ),
152
+ sheet && /* @__PURE__ */ jsx(PlugSheet, { song, services, current: remembered?.id ?? null, onChoose: choose, onClose: () => setSheet(false) })
153
+ ] });
154
+ }
155
+ function PlugSheet({
156
+ song,
157
+ services,
158
+ current,
159
+ onChoose,
160
+ onClose
161
+ }) {
162
+ useEffect(() => {
163
+ const onKey = (e) => e.key === "Escape" && onClose();
164
+ window.addEventListener("keydown", onKey);
165
+ const prev = document.body.style.overflow;
166
+ document.body.style.overflow = "hidden";
167
+ return () => {
168
+ window.removeEventListener("keydown", onKey);
169
+ document.body.style.overflow = prev;
170
+ };
171
+ }, [onClose]);
172
+ return /* @__PURE__ */ jsx("div", { className: "mp-sheet", role: "dialog", "aria-modal": "true", "aria-label": "\uC5B4\uB514\uC11C \uB4E4\uC744\uAE4C\uC694", onClick: (e) => e.target === e.currentTarget && onClose(), children: /* @__PURE__ */ jsxs("div", { className: "mp-sheet__panel", children: [
173
+ /* @__PURE__ */ jsxs("div", { className: "mp-sheet__head", children: [
174
+ /* @__PURE__ */ jsxs("span", { className: "mp-sheet__brand", children: [
175
+ /* @__PURE__ */ jsx(Symbol, {}),
176
+ " Music plug"
177
+ ] }),
178
+ /* @__PURE__ */ jsx("button", { type: "button", className: "mp-sheet__close", onClick: onClose, "aria-label": "\uB2EB\uAE30", children: "\xD7" })
179
+ ] }),
180
+ song?.title && /* @__PURE__ */ jsxs("div", { className: "mp-sheet__song", children: [
181
+ /* @__PURE__ */ jsx("p", { className: "mp-sheet__song-title", children: song.title }),
182
+ song.artist && /* @__PURE__ */ jsx("p", { className: "mp-sheet__sub", children: song.artist })
183
+ ] }),
184
+ /* @__PURE__ */ jsx("p", { className: "mp-sheet__ask", children: "\uC5B4\uB514\uC11C \uB4E4\uC744\uAE4C\uC694?" }),
185
+ /* @__PURE__ */ jsx("ul", { className: "mp-sheet__grid", children: services.map((s) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
186
+ "button",
187
+ {
188
+ type: "button",
189
+ "aria-current": (current ? s.id === current : s.id === "here" || s.id === "ytvideo") ? "true" : void 0,
190
+ onClick: () => onChoose(s),
191
+ children: [
192
+ /* @__PURE__ */ jsx(Mark, { service: s }),
193
+ /* @__PURE__ */ jsx("span", { children: s.name }),
194
+ (s.id === "here" || s.id === "ytvideo") && /* @__PURE__ */ jsx("span", { className: "mp-sheet__tag", children: "\uAE30\uBCF8" })
195
+ ]
196
+ }
197
+ ) }, s.id)) }),
198
+ /* @__PURE__ */ jsx("p", { className: "mp-sheet__note", children: "\uACE0\uB978 \uACF3\uC740 \uAE30\uC5B5\uD574 \uB450\uACE0 \uB2E4\uC74C\uBD80\uD130 \uBC14\uB85C \uADF8\uACF3\uC5D0\uC11C \uC5F4\uC5B4\uC694. \uACE1 \uC606\uC758 \u2018\uBC14\uAFB8\uAE30\u2019\uB85C \uB2E4\uC2DC \uACE0\uB97C \uC218 \uC788\uC5B4\uC694." })
199
+ ] }) });
200
+ }
201
+ function Mark({ service }) {
202
+ const logo = LOGO_PATHS[service.id];
203
+ return /* @__PURE__ */ jsx("svg", { width: "26", height: "26", viewBox: "0 0 24 24", "aria-hidden": "true", className: "mp-sheet__mark", children: logo ? /* @__PURE__ */ jsx("path", { d: logo, fill: service.color }) : /* @__PURE__ */ jsxs(Fragment, { children: [
204
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "12", fill: service.color }),
205
+ /* @__PURE__ */ jsx("text", { x: "12", y: "16.8", textAnchor: "middle", fontSize: "13.5", fontWeight: "800", fill: "#0b0b0d", children: service.initial })
206
+ ] }) });
207
+ }
208
+ function Symbol() {
209
+ return /* @__PURE__ */ jsx("svg", { width: "20", height: "20", viewBox: "0 0 64 64", "aria-hidden": "true", children: /* @__PURE__ */ jsxs("g", { transform: "translate(0 3.5)", children: [
210
+ /* @__PURE__ */ jsx("rect", { x: "21.5", y: "8.5", width: "5.5", height: "13", rx: "2.75", fill: "#f2f2ee" }),
211
+ /* @__PURE__ */ jsx("rect", { x: "37", y: "8.5", width: "5.5", height: "13", rx: "2.75", fill: "#f2f2ee" }),
212
+ /* @__PURE__ */ jsx("rect", { x: "12", y: "19", width: "40", height: "29", rx: "5", fill: "#f2f2ee" }),
213
+ /* @__PURE__ */ jsxs("g", { fill: "#141417", children: [
214
+ /* @__PURE__ */ jsx("rect", { x: "17.9", y: "30.25", width: "3.4", height: "6.5", rx: "1.7" }),
215
+ /* @__PURE__ */ jsx("rect", { x: "24.1", y: "27.25", width: "3.4", height: "12.5", rx: "1.7" }),
216
+ /* @__PURE__ */ jsx("rect", { x: "30.3", y: "24.5", width: "3.4", height: "18", rx: "1.7" }),
217
+ /* @__PURE__ */ jsx("rect", { x: "36.5", y: "27.25", width: "3.4", height: "12.5", rx: "1.7" }),
218
+ /* @__PURE__ */ jsx("rect", { x: "42.7", y: "30.25", width: "3.4", height: "6.5", rx: "1.7" })
219
+ ] })
220
+ ] }) });
221
+ }
222
+ export {
223
+ PlugPlayer,
224
+ PlugSheet
225
+ };
package/package.json CHANGED
@@ -1,6 +1,50 @@
1
- {
2
- "name": "@madeinbruno/music-plug",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
1
+ {
2
+ "name": "@madeinbruno/music-plug",
3
+ "version": "0.1.0",
4
+ "description": "글 속 노래를 듣는 사람이 쓰는 음원 앱(멜론·지니·벅스·FLO·VIBE·Spotify·Apple Music·YouTube Music)에서, 없으면 YouTube로 바로 듣게 하는 플러그",
5
+ "license": "MIT",
6
+ "author": "codingbotPark <pbk575@gmail.com>",
7
+ "homepage": "https://madeinbruno.com",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/codingbotPark/madeinbruno.git",
11
+ "directory": "packages/music-plug"
12
+ },
13
+ "type": "module",
14
+ "sideEffects": [
15
+ "*.css"
16
+ ],
17
+ "main": "./dist/index.js",
18
+ "types": "./dist/index.d.ts",
19
+ "exports": {
20
+ ".": {
21
+ "types": "./dist/index.d.ts",
22
+ "import": "./dist/index.js"
23
+ },
24
+ "./player": {
25
+ "types": "./dist/player.d.ts",
26
+ "import": "./dist/player.js"
27
+ },
28
+ "./styles.css": "./styles.css"
29
+ },
30
+ "files": [
31
+ "dist",
32
+ "styles.css"
33
+ ],
34
+ "scripts": {
35
+ "build": "tsup",
36
+ "dev": "tsup --watch",
37
+ "check": "tsc --noEmit",
38
+ "test": "node --test --experimental-strip-types src/*.test.ts",
39
+ "prepublishOnly": "pnpm build"
40
+ },
41
+ "peerDependencies": {
42
+ "react": ">=18"
43
+ },
44
+ "devDependencies": {
45
+ "@types/react": "^19",
46
+ "react": "19.2.3",
47
+ "tsup": "^8.5.0",
48
+ "typescript": "^5"
49
+ }
50
+ }
package/styles.css ADDED
@@ -0,0 +1,232 @@
1
+ /* @madeinbruno/music-plug 스타일. 쓰는 쪽에서 한 번만 불러온다: import '@madeinbruno/music-plug/styles.css'
2
+ 클래스 이름은 모두 mp- 로 시작한다.
3
+ - 곡 줄(.mp-plug)은 둘러싼 글의 색(currentColor)을 따라서 밝은·어두운 화면 어디서나 맞는다.
4
+ 멈추기 단추의 바탕은 --mp-ground로 바꿀 수 있다 (기본: 흰색 반투명).
5
+ - 듣기 플러그(.mp-sheet)는 Music plug 색(검은 바탕, 노란 고른 표시)이다. */
6
+
7
+ .mp-plug {
8
+ --mp-ground: rgba(255, 255, 255, 0.92);
9
+ font-size: 14px;
10
+ }
11
+
12
+ .mp-plug button,
13
+ .mp-sheet button {
14
+ padding: 0;
15
+ border: 0;
16
+ background: none;
17
+ color: inherit;
18
+ font: inherit;
19
+ cursor: pointer;
20
+ }
21
+
22
+ .mp-plug__row {
23
+ display: flex;
24
+ flex-wrap: wrap;
25
+ align-items: baseline;
26
+ gap: 4px 10px;
27
+ }
28
+
29
+ .mp-plug__song {
30
+ text-align: left;
31
+ }
32
+
33
+ .mp-plug__where {
34
+ opacity: 0.55;
35
+ font-size: 13px;
36
+ }
37
+
38
+ .mp-plug__where button {
39
+ text-decoration: underline;
40
+ text-underline-offset: 3px;
41
+ }
42
+
43
+ .mp-plug__frame {
44
+ margin-top: 10px;
45
+ overflow: hidden;
46
+ border-radius: 2px;
47
+ }
48
+
49
+ .mp-plug__frame iframe {
50
+ display: block;
51
+ width: 100%;
52
+ aspect-ratio: 16 / 9;
53
+ border: 0;
54
+ }
55
+
56
+ .mp-plug__chip {
57
+ position: fixed;
58
+ bottom: 16px;
59
+ left: 16px;
60
+ z-index: 40;
61
+ max-width: 60vw;
62
+ padding: 6px 14px !important;
63
+ border: 1px solid currentColor !important;
64
+ border-radius: 999px;
65
+ background: var(--mp-ground) !important;
66
+ opacity: 0.85;
67
+ white-space: nowrap;
68
+ overflow: hidden;
69
+ text-overflow: ellipsis;
70
+ }
71
+
72
+ /* ───────── 듣기 플러그 (Music plug) ───────── */
73
+
74
+ .mp-sheet {
75
+ --mp-bg: #0b0b0d;
76
+ --mp-panel: #141417;
77
+ --mp-line: #2c2c33;
78
+ --mp-ink: #f2f2ee;
79
+ --mp-sub: #9a9aa5;
80
+ --mp-core: #ffe14a;
81
+ position: fixed;
82
+ inset: 0;
83
+ z-index: 60;
84
+ display: flex;
85
+ align-items: flex-end;
86
+ justify-content: center;
87
+ background: rgba(0, 0, 0, 0.45);
88
+ font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Noto Sans KR', 'Segoe UI', sans-serif;
89
+ animation: mp-fade 140ms ease-out;
90
+ }
91
+
92
+ @media (min-width: 640px) {
93
+ .mp-sheet {
94
+ align-items: center;
95
+ }
96
+ }
97
+
98
+ .mp-sheet__panel {
99
+ box-sizing: border-box;
100
+ width: 100%;
101
+ max-width: 420px;
102
+ max-height: 88vh;
103
+ overflow-y: auto;
104
+ padding: 20px 20px 24px;
105
+ border-radius: 20px 20px 0 0;
106
+ background: var(--mp-bg);
107
+ color: var(--mp-ink);
108
+ animation: mp-rise 180ms ease-out;
109
+ }
110
+
111
+ @media (min-width: 640px) {
112
+ .mp-sheet__panel {
113
+ border-radius: 20px;
114
+ }
115
+ }
116
+
117
+ .mp-sheet__head {
118
+ display: flex;
119
+ align-items: center;
120
+ justify-content: space-between;
121
+ }
122
+
123
+ .mp-sheet__brand {
124
+ display: inline-flex;
125
+ align-items: center;
126
+ gap: 8px;
127
+ font-size: 14px;
128
+ font-weight: 700;
129
+ }
130
+
131
+ .mp-sheet__close {
132
+ font-size: 24px !important;
133
+ line-height: 1;
134
+ color: var(--mp-sub) !important;
135
+ }
136
+
137
+ .mp-sheet__song {
138
+ margin-top: 18px;
139
+ }
140
+
141
+ .mp-sheet__song p {
142
+ margin: 0;
143
+ }
144
+
145
+ .mp-sheet__song-title {
146
+ font-size: 20px;
147
+ font-weight: 700;
148
+ letter-spacing: -0.01em;
149
+ }
150
+
151
+ .mp-sheet__sub {
152
+ color: var(--mp-sub);
153
+ font-size: 13px;
154
+ }
155
+
156
+ .mp-sheet__ask {
157
+ margin: 22px 0 10px;
158
+ font-size: 15px;
159
+ font-weight: 600;
160
+ }
161
+
162
+ .mp-sheet__grid {
163
+ display: grid;
164
+ grid-template-columns: 1fr 1fr;
165
+ gap: 8px;
166
+ margin: 0;
167
+ padding: 0;
168
+ list-style: none;
169
+ }
170
+
171
+ .mp-sheet__grid button {
172
+ box-sizing: border-box;
173
+ display: flex !important;
174
+ align-items: center;
175
+ gap: 10px;
176
+ width: 100%;
177
+ padding: 11px 12px !important;
178
+ border: 1px solid var(--mp-line) !important;
179
+ border-radius: 12px;
180
+ background: var(--mp-panel) !important;
181
+ font-size: 14px !important;
182
+ text-align: left;
183
+ }
184
+
185
+ .mp-sheet__grid button:hover {
186
+ border-color: var(--mp-sub) !important;
187
+ }
188
+
189
+ .mp-sheet__grid button[aria-current='true'] {
190
+ border-color: var(--mp-core) !important;
191
+ }
192
+
193
+ .mp-sheet__mark {
194
+ flex-shrink: 0;
195
+ }
196
+
197
+ /* 아직 고른 곳이 없을 때 골라져 있는 곳 (YouTube) */
198
+ .mp-sheet__tag {
199
+ margin-left: auto;
200
+ padding: 1px 7px;
201
+ border-radius: 999px;
202
+ background: var(--mp-line);
203
+ color: var(--mp-sub);
204
+ font-size: 11px;
205
+ font-weight: 700;
206
+ }
207
+
208
+ .mp-sheet__note {
209
+ margin: 14px 0 0;
210
+ color: var(--mp-sub);
211
+ font-size: 12px;
212
+ line-height: 1.6;
213
+ }
214
+
215
+ @keyframes mp-fade {
216
+ from {
217
+ opacity: 0;
218
+ }
219
+ }
220
+
221
+ @keyframes mp-rise {
222
+ from {
223
+ transform: translateY(16px);
224
+ }
225
+ }
226
+
227
+ @media (prefers-reduced-motion: reduce) {
228
+ .mp-sheet,
229
+ .mp-sheet__panel {
230
+ animation: none;
231
+ }
232
+ }