yt-playlist-features/src/content/ui/styles.ts
2026-04-09 17:14:32 +09:00

799 lines
14 KiB
TypeScript

const STYLE_ID = "ytpf-styles";
const CSS = `
.ytpf-wrapper {
margin: 16px 0;
font-family: "Roboto", "Arial", sans-serif;
font-size: 13px;
color: var(--yt-spec-text-primary, #0f0f0f);
}
html[dark] .ytpf-wrapper {
color: #f1f1f1;
}
.ytpf-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 12px 16px;
cursor: pointer;
user-select: none;
}
.ytpf-header-title {
font-size: 14px;
font-weight: 500;
}
.ytpf-header-meta {
font-size: 12px;
color: var(--yt-spec-text-secondary, #606060);
}
html[dark] .ytpf-header-meta {
color: #aaa;
}
.ytpf-toggle {
font-size: 12px;
color: var(--yt-spec-text-secondary, #606060);
transition: transform 0.2s;
}
html[dark] .ytpf-toggle {
color: #aaa;
}
.ytpf-toggle--collapsed {
transform: rotate(-90deg);
}
.ytpf-stats {
display: flex;
align-items: center;
gap: 12px;
padding: 6px 16px;
flex-wrap: wrap;
border-bottom: 1px solid var(--yt-spec-10-percent-layer, rgba(0,0,0,0.06));
}
html[dark] .ytpf-stats {
border-bottom-color: rgba(255,255,255,0.06);
}
.ytpf-stats--hidden {
display: none;
}
.ytpf-stat {
font-size: 12px;
color: var(--yt-spec-text-secondary, #606060);
white-space: nowrap;
}
html[dark] .ytpf-stat {
color: #aaa;
}
.ytpf-stat-value {
font-family: "Roboto Mono", monospace;
color: var(--yt-spec-text-primary, #0f0f0f);
}
html[dark] .ytpf-stat-value {
color: #f1f1f1;
}
.ytpf-stats-detail-btn {
padding: 2px 8px;
border: 1px solid var(--yt-spec-10-percent-layer, rgba(0,0,0,0.2));
border-radius: 12px;
background: transparent;
color: var(--yt-spec-text-secondary, #606060);
font-size: 11px;
font-family: "Roboto", "Arial", sans-serif;
cursor: pointer;
white-space: nowrap;
}
html[dark] .ytpf-stats-detail-btn {
border-color: rgba(255,255,255,0.2);
color: #aaa;
}
.ytpf-stats-detail-btn:hover {
background: var(--yt-spec-badge-chip-background, #f2f2f2);
}
html[dark] .ytpf-stats-detail-btn:hover {
background: #3e3e3e;
}
.ytpf-stats-spacer {
flex: 1;
}
.ytpf-detail-popup {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: #fff;
border: 1px solid rgba(0,0,0,0.1);
border-radius: 12px;
padding: 20px 24px;
min-width: 360px;
max-width: 560px;
max-height: 70vh;
overflow-y: auto;
z-index: 3000;
box-shadow: 0 8px 24px rgba(0,0,0,0.2);
font-family: "Roboto", "Arial", sans-serif;
font-size: 13px;
color: var(--yt-spec-text-primary, #0f0f0f);
}
html[dark] .ytpf-detail-popup {
background: #212121;
border-color: rgba(255,255,255,0.1);
box-shadow: 0 8px 24px rgba(0,0,0,0.5);
color: #f1f1f1;
}
.ytpf-detail-popup-backdrop {
position: fixed;
inset: 0;
background: rgba(0,0,0,0.4);
z-index: 2999;
}
.ytpf-detail-popup h3 {
font-size: 15px;
font-weight: 500;
margin: 0 0 16px;
}
.ytpf-detail-section {
margin-bottom: 16px;
}
.ytpf-detail-section:last-child {
margin-bottom: 0;
}
.ytpf-detail-section-title {
font-size: 12px;
font-weight: 500;
color: var(--yt-spec-text-secondary, #606060);
text-transform: uppercase;
letter-spacing: 0.5px;
margin-bottom: 6px;
}
html[dark] .ytpf-detail-section-title {
color: #aaa;
}
.ytpf-detail-bar-row {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 3px;
font-size: 12px;
}
.ytpf-detail-bar-label {
width: 140px;
flex-shrink: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.ytpf-detail-bar-track {
flex: 1;
height: 14px;
background: var(--yt-spec-10-percent-layer, rgba(0,0,0,0.06));
border-radius: 3px;
overflow: hidden;
}
html[dark] .ytpf-detail-bar-track {
background: rgba(255,255,255,0.08);
}
.ytpf-detail-bar-fill {
height: 100%;
border-radius: 3px;
background: var(--yt-spec-call-to-action, #065fd4);
opacity: 0.7;
}
html[dark] .ytpf-detail-bar-fill {
background: #3ea6ff;
}
.ytpf-detail-bar-count {
width: 48px;
flex-shrink: 0;
text-align: right;
font-family: "Roboto Mono", monospace;
font-size: 11px;
color: var(--yt-spec-text-secondary, #606060);
}
html[dark] .ytpf-detail-bar-count {
color: #aaa;
}
.ytpf-detail-kv {
display: flex;
gap: 12px;
flex-wrap: wrap;
font-size: 12px;
}
.ytpf-detail-kv-item {
color: var(--yt-spec-text-secondary, #606060);
}
html[dark] .ytpf-detail-kv-item {
color: #aaa;
}
.ytpf-detail-kv-value {
font-family: "Roboto Mono", monospace;
color: var(--yt-spec-text-primary, #0f0f0f);
}
html[dark] .ytpf-detail-kv-value {
color: #f1f1f1;
}
.ytpf-filters {
display: flex;
align-items: flex-start;
gap: 8px;
padding: 8px 16px;
flex-wrap: wrap;
}
.ytpf-filter-input {
flex: 1;
min-width: 120px;
height: 32px;
box-sizing: border-box;
padding: 0 10px;
border: 1px solid var(--yt-spec-10-percent-layer, rgba(0,0,0,0.2));
border-radius: 8px;
background: transparent;
color: var(--yt-spec-text-primary, #0f0f0f);
font-size: 13px;
font-family: "Roboto", "Arial", sans-serif;
outline: none;
}
html[dark] .ytpf-filter-input {
border-color: rgba(255,255,255,0.2);
color: #f1f1f1;
}
.ytpf-filter-input:focus {
border-color: var(--yt-spec-call-to-action, #065fd4);
}
html[dark] .ytpf-filter-input:focus {
border-color: #3ea6ff;
}
.ytpf-filter-input::placeholder {
color: var(--yt-spec-text-secondary, #606060);
}
html[dark] .ytpf-filter-input::placeholder {
color: #aaa;
}
.ytpf-tag-input {
position: relative;
flex: 1;
min-width: 160px;
min-height: 32px;
box-sizing: border-box;
display: flex;
flex-wrap: wrap;
gap: 4px;
padding: 3px 8px;
border: 1px solid var(--yt-spec-10-percent-layer, rgba(0,0,0,0.2));
border-radius: 8px;
background: transparent;
align-items: center;
cursor: text;
}
html[dark] .ytpf-tag-input {
border-color: rgba(255,255,255,0.2);
}
.ytpf-tag-input:focus-within {
border-color: var(--yt-spec-call-to-action, #065fd4);
}
html[dark] .ytpf-tag-input:focus-within {
border-color: #3ea6ff;
}
.ytpf-tag {
display: inline-flex;
align-items: center;
gap: 4px;
height: 24px;
box-sizing: border-box;
padding: 0 8px;
border-radius: 4px;
font-size: 12px;
line-height: 24px;
white-space: nowrap;
}
.ytpf-tag-remove {
cursor: pointer;
font-size: 14px;
line-height: 1;
opacity: 0.6;
}
.ytpf-tag-remove:hover {
opacity: 1;
}
.ytpf-tag-text-input {
border: none;
outline: none;
background: transparent;
color: var(--yt-spec-text-primary, #0f0f0f);
font-size: 13px;
font-family: "Roboto", "Arial", sans-serif;
flex: 1;
min-width: 30px;
height: 24px;
padding: 0;
}
html[dark] .ytpf-tag-text-input {
color: #f1f1f1;
}
.ytpf-tag-text-input::placeholder {
color: var(--yt-spec-text-secondary, #606060);
}
html[dark] .ytpf-tag-text-input::placeholder {
color: #aaa;
}
.ytpf-autocomplete {
position: absolute;
top: 100%;
left: 0;
right: 0;
margin-top: 4px;
background: #fff;
border: 1px solid rgba(0,0,0,0.1);
border-radius: 8px;
max-height: 200px;
overflow-y: auto;
z-index: 2000;
box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}
html[dark] .ytpf-autocomplete {
background: #282828;
border-color: rgba(255,255,255,0.1);
}
.ytpf-autocomplete-item {
padding: 6px 12px;
cursor: pointer;
font-size: 13px;
color: #0f0f0f;
}
html[dark] .ytpf-autocomplete-item {
color: #f1f1f1;
}
.ytpf-autocomplete-item:hover,
.ytpf-autocomplete-item--active {
background: #f2f2f2;
}
html[dark] .ytpf-autocomplete-item:hover,
html[dark] .ytpf-autocomplete-item--active {
background: #3e3e3e;
}
.ytpf-filters--hidden {
display: none;
}
.ytpf-filter-count {
font-size: 12px;
color: var(--yt-spec-text-secondary, #606060);
align-self: center;
white-space: nowrap;
}
html[dark] .ytpf-filter-count {
color: #aaa;
}
.ytpf-body {
overflow-x: auto;
}
.ytpf-body--hidden {
display: none;
}
.ytpf-table {
width: 100%;
border-collapse: collapse;
table-layout: fixed;
}
.ytpf-th {
position: relative;
text-align: left;
padding: 8px 12px;
font-weight: 500;
font-size: 12px;
color: var(--yt-spec-text-secondary, #606060);
border-bottom: 1px solid var(--yt-spec-10-percent-layer, rgba(0,0,0,0.1));
white-space: nowrap;
}
html[dark] .ytpf-th {
color: #aaa;
border-bottom-color: rgba(255,255,255,0.1);
}
.ytpf-th--sortable {
cursor: pointer;
user-select: none;
}
.ytpf-th--sortable:hover {
color: var(--yt-spec-text-primary, #0f0f0f);
}
html[dark] .ytpf-th--sortable:hover {
color: #f1f1f1;
}
.ytpf-th--sortable::after {
content: "";
margin-left: 4px;
}
.ytpf-th[data-sort-dir="asc"]::after {
content: " \\25B2";
}
.ytpf-th[data-sort-dir="desc"]::after {
content: " \\25BC";
}
.ytpf-td {
padding: 6px 12px;
border-bottom: 1px solid var(--yt-spec-10-percent-layer, rgba(0,0,0,0.1));
vertical-align: middle;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
html[dark] .ytpf-td {
border-bottom-color: rgba(255,255,255,0.1);
}
.ytpf-tr:hover {
background: var(--yt-spec-badge-chip-background, #f2f2f2);
}
html[dark] .ytpf-tr:hover {
background: #272727;
}
.ytpf-col-index { width: 48px; text-align: right; }
.ytpf-col-title { width: auto; }
.ytpf-col-channel { width: 180px; }
.ytpf-col-duration { width: 80px; font-family: "Roboto Mono", monospace; }
.ytpf-col-views { width: 120px; text-align: right; font-family: "Roboto Mono", monospace; }
.ytpf-col-published { width: 110px; font-family: "Roboto Mono", monospace; }
.ytpf-col-category { width: 120px; }
.ytpf-col-likes { width: 90px; text-align: right; font-family: "Roboto Mono", monospace; }
.ytpf-col-addedby { width: 140px; }
.ytpf-col-votes { width: 90px; text-align: center; font-family: "Roboto Mono", monospace; }
.ytpf-vote {
display: inline-flex;
align-items: center;
gap: 2px;
}
.ytpf-vote-btn {
padding: 0;
border: none;
background: transparent;
color: var(--yt-spec-text-secondary, #606060);
font-size: 10px;
line-height: 1;
cursor: pointer;
width: 20px;
height: 20px;
display: inline-flex;
align-items: center;
justify-content: center;
border-radius: 50%;
}
html[dark] .ytpf-vote-btn {
color: #aaa;
}
.ytpf-vote-btn:hover:not(:disabled) {
background: var(--yt-spec-badge-chip-background, #f2f2f2);
color: var(--yt-spec-text-primary, #0f0f0f);
}
html[dark] .ytpf-vote-btn:hover:not(:disabled) {
background: #3e3e3e;
color: #f1f1f1;
}
.ytpf-vote-btn:disabled {
opacity: 0.3;
cursor: default;
}
.ytpf-vote-count {
min-width: 16px;
text-align: center;
font-size: 12px;
}
.ytpf-vote-count--voted {
font-weight: 700;
}
.ytpf-vote-btn--active {
color: var(--yt-spec-call-to-action, #065fd4);
}
html[dark] .ytpf-vote-btn--active {
color: #3ea6ff;
}
.ytpf-vote-btn--dim {
opacity: 0.25;
}
.ytpf-fetch-views-btn {
padding: 4px 12px;
border: 1px solid var(--yt-spec-10-percent-layer, rgba(0,0,0,0.2));
border-radius: 16px;
background: transparent;
color: var(--yt-spec-text-secondary, #606060);
font-size: 12px;
font-family: "Roboto", "Arial", sans-serif;
cursor: pointer;
white-space: nowrap;
}
html[dark] .ytpf-fetch-views-btn {
border-color: rgba(255,255,255,0.2);
color: #aaa;
}
.ytpf-fetch-views-btn:hover:not(:disabled) {
background: var(--yt-spec-badge-chip-background, #f2f2f2);
}
html[dark] .ytpf-fetch-views-btn:hover:not(:disabled) {
background: #3e3e3e;
}
.ytpf-fetch-views-btn:disabled {
opacity: 0.6;
cursor: default;
}
.ytpf-menu-anchor {
position: relative;
}
.ytpf-menu-btn {
padding: 4px 8px;
border: none;
background: transparent;
color: var(--yt-spec-text-secondary, #606060);
font-size: 20px;
line-height: 1;
cursor: pointer;
border-radius: 50%;
}
.ytpf-menu-btn:hover {
background: var(--yt-spec-badge-chip-background, #f2f2f2);
}
html[dark] .ytpf-menu-btn {
color: #aaa;
}
html[dark] .ytpf-menu-btn:hover {
background: #3e3e3e;
}
.ytpf-menu {
position: absolute;
top: 100%;
right: 0;
margin-top: 4px;
background: #fff;
border: 1px solid rgba(0,0,0,0.1);
border-radius: 8px;
padding: 4px 0;
min-width: 160px;
z-index: 2001;
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
html[dark] .ytpf-menu {
background: #282828;
border-color: rgba(255,255,255,0.1);
box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.ytpf-menu-heading {
padding: 6px 12px 2px;
font-size: 11px;
font-weight: 500;
color: var(--yt-spec-text-secondary, #606060);
text-transform: uppercase;
letter-spacing: 0.5px;
}
html[dark] .ytpf-menu-heading {
color: #aaa;
}
.ytpf-menu-item {
display: flex;
align-items: center;
gap: 8px;
padding: 5px 12px;
font-size: 13px;
color: var(--yt-spec-text-primary, #0f0f0f);
cursor: pointer;
}
html[dark] .ytpf-menu-item {
color: #f1f1f1;
}
.ytpf-menu-item:hover {
background: var(--yt-spec-badge-chip-background, #f2f2f2);
}
html[dark] .ytpf-menu-item:hover {
background: #3e3e3e;
}
.ytpf-menu-item input[type="checkbox"] {
margin: 0;
flex-shrink: 0;
}
.ytpf-menu-sep {
height: 1px;
margin: 4px 0;
background: var(--yt-spec-10-percent-layer, rgba(0,0,0,0.1));
}
html[dark] .ytpf-menu-sep {
background: rgba(255,255,255,0.1);
}
.ytpf-menu-action {
display: block;
width: 100%;
padding: 5px 12px;
border: none;
background: transparent;
color: var(--yt-spec-text-secondary, #606060);
font-size: 12px;
font-family: "Roboto", "Arial", sans-serif;
cursor: pointer;
text-align: left;
}
html[dark] .ytpf-menu-action {
color: #aaa;
}
.ytpf-menu-action:hover {
background: var(--yt-spec-badge-chip-background, #f2f2f2);
}
html[dark] .ytpf-menu-action:hover {
background: #3e3e3e;
}
.ytpf-resize-handle {
position: absolute;
top: 0;
right: -2px;
width: 5px;
height: 100%;
cursor: col-resize;
z-index: 1;
}
.ytpf-resize-handle:hover,
.ytpf-resize-handle--active {
background: var(--yt-spec-call-to-action, #065fd4);
opacity: 0.4;
}
html[dark] .ytpf-resize-handle:hover,
html[dark] .ytpf-resize-handle--active {
background: #3ea6ff;
opacity: 0.4;
}
.ytpf-tr--unplayable {
opacity: 0.45;
}
.ytpf-tr--unplayable .ytpf-link {
text-decoration: line-through;
}
.ytpf-link {
color: var(--yt-spec-text-primary, #0f0f0f);
text-decoration: none;
}
html[dark] .ytpf-link {
color: #f1f1f1;
}
.ytpf-link:hover {
text-decoration: underline;
}
.ytpf-live {
display: inline-block;
padding: 1px 6px;
border-radius: 4px;
font-size: 11px;
font-weight: 500;
background: #c00;
color: #fff;
}
`;
export function injectStyles(): void {
if (document.getElementById(STYLE_ID)) return;
const style = document.createElement("style");
style.id = STYLE_ID;
style.textContent = CSS;
document.head.appendChild(style);
}
export function removeStyles(): void {
document.getElementById(STYLE_ID)?.remove();
}