Spaces:
Running
Running
Upload 2 files
Browse files- 前端页面/market/创作者卡片组件.js +14 -8
- 前端页面/styles/主题基础.css +2 -2
前端页面/market/创作者卡片组件.js
CHANGED
|
@@ -324,9 +324,12 @@ export function createCreatorCard(creatorData, currentUser = null) {
|
|
| 324 |
<div class="creator-card__stats">${stat('likes',t('creator.stats.likes'),creatorData.likes)}${stat('favorites',t('creator.stats.favorites'),creatorData.favorites)}${stat('followers',t('creator.stats.followers'),creatorData.followers)}</div>
|
| 325 |
<div class="creator-card__outputs">${stat('toolsCount',t('creator.output.tools'),creatorData.toolsCount,t('creator.output.unit'))}${stat('skillsCount',t('creator.output.skills'),creatorData.skillsCount || 0,t('creator.output.unit'))}${stat('appsCount',t('creator.output.apps'),creatorData.appsCount,t('creator.output.unit'))}</div>
|
| 326 |
</div>
|
| 327 |
-
<button type="button" class="creator-card__toggle" aria-expanded="false" aria-controls="detail-${chartContainerId}">${escapeHtml(t('creator.expand_details'))}<span aria-hidden="true">⌄</span></button>
|
| 328 |
`;
|
| 329 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 330 |
|
| 331 |
const jumpToProfile = (e) => {
|
| 332 |
e.stopPropagation();
|
|
@@ -386,7 +389,7 @@ export function createCreatorCard(creatorData, currentUser = null) {
|
|
| 386 |
const notice = document.createElement('div');
|
| 387 |
notice.setAttribute('role', 'status'); notice.textContent = t('auth.session_changed');
|
| 388 |
detailView.append(notice); detailView.hidden = false; detailView.style.display = 'block';
|
| 389 |
-
|
| 390 |
}
|
| 391 |
});
|
| 392 |
const current = token => scope.isCurrent() && card.isConnected && detailView.style.display !== 'none' && token === generation;
|
|
@@ -603,20 +606,23 @@ export function createCreatorCard(creatorData, currentUser = null) {
|
|
| 603 |
pauseDetails(); detailView.hidden = true; detailView.style.display = "none";
|
| 604 |
if (currentExpandedCard === card) currentExpandedCard = null;
|
| 605 |
}
|
| 606 |
-
|
| 607 |
-
|
| 608 |
if (expanded) loadCreatorDetails();
|
| 609 |
}
|
| 610 |
const toggleDetails = () => setExpanded(detailView.hidden);
|
| 611 |
summaryView.onclick = event => {
|
| 612 |
-
if (event.target.closest('button')
|
| 613 |
toggleDetails();
|
| 614 |
};
|
| 615 |
card._closeDetails = () => setExpanded(false);
|
| 616 |
const keyHandler = event => {
|
|
|
|
|
|
|
|
|
|
| 617 |
if (event.key !== 'Escape' || detailView.hidden || !card.contains(document.activeElement)) return;
|
| 618 |
event.preventDefault(); event.stopPropagation();
|
| 619 |
-
setExpanded(false);
|
| 620 |
};
|
| 621 |
card.addEventListener('keydown', keyHandler);
|
| 622 |
|
|
@@ -627,7 +633,7 @@ export function createCreatorCard(creatorData, currentUser = null) {
|
|
| 627 |
scope.addCleanup(() => {
|
| 628 |
pauseDetails(); stopTrackingRemoval?.(); stopTrackingRemoval = null;
|
| 629 |
summaryView.onclick = null; card.removeEventListener('keydown', keyHandler);
|
| 630 |
-
|
| 631 |
commentUI?._cleanup?.();
|
| 632 |
if (currentExpandedCard === card) currentExpandedCard = null;
|
| 633 |
if (resizeSubscribed) window.removeEventListener('resize', resizeHandler);
|
|
|
|
| 324 |
<div class="creator-card__stats">${stat('likes',t('creator.stats.likes'),creatorData.likes)}${stat('favorites',t('creator.stats.favorites'),creatorData.favorites)}${stat('followers',t('creator.stats.followers'),creatorData.followers)}</div>
|
| 325 |
<div class="creator-card__outputs">${stat('toolsCount',t('creator.output.tools'),creatorData.toolsCount,t('creator.output.unit'))}${stat('skillsCount',t('creator.output.skills'),creatorData.skillsCount || 0,t('creator.output.unit'))}${stat('appsCount',t('creator.output.apps'),creatorData.appsCount,t('creator.output.unit'))}</div>
|
| 326 |
</div>
|
|
|
|
| 327 |
`;
|
| 328 |
+
summaryView.tabIndex = 0;
|
| 329 |
+
summaryView.setAttribute('role', 'button');
|
| 330 |
+
summaryView.setAttribute('aria-expanded', 'false');
|
| 331 |
+
summaryView.setAttribute('aria-controls', `detail-${chartContainerId}`);
|
| 332 |
+
summaryView.setAttribute('aria-label', `${profileName}: ${t('creator.expand_details')}`);
|
| 333 |
|
| 334 |
const jumpToProfile = (e) => {
|
| 335 |
e.stopPropagation();
|
|
|
|
| 389 |
const notice = document.createElement('div');
|
| 390 |
notice.setAttribute('role', 'status'); notice.textContent = t('auth.session_changed');
|
| 391 |
detailView.append(notice); detailView.hidden = false; detailView.style.display = 'block';
|
| 392 |
+
summaryView.setAttribute('aria-disabled', 'true'); summaryView.tabIndex = -1; summaryView.setAttribute('aria-expanded', 'true');
|
| 393 |
}
|
| 394 |
});
|
| 395 |
const current = token => scope.isCurrent() && card.isConnected && detailView.style.display !== 'none' && token === generation;
|
|
|
|
| 606 |
pauseDetails(); detailView.hidden = true; detailView.style.display = "none";
|
| 607 |
if (currentExpandedCard === card) currentExpandedCard = null;
|
| 608 |
}
|
| 609 |
+
summaryView.setAttribute('aria-expanded', String(expanded));
|
| 610 |
+
summaryView.setAttribute('aria-label', `${profileName}: ${t(expanded ? 'creator.collapse_details' : 'creator.expand_details')}`);
|
| 611 |
if (expanded) loadCreatorDetails();
|
| 612 |
}
|
| 613 |
const toggleDetails = () => setExpanded(detailView.hidden);
|
| 614 |
summaryView.onclick = event => {
|
| 615 |
+
if (event.target.closest('button')) return;
|
| 616 |
toggleDetails();
|
| 617 |
};
|
| 618 |
card._closeDetails = () => setExpanded(false);
|
| 619 |
const keyHandler = event => {
|
| 620 |
+
if (event.target === summaryView && (event.key === 'Enter' || event.key === ' ')) {
|
| 621 |
+
event.preventDefault(); event.stopPropagation(); toggleDetails(); return;
|
| 622 |
+
}
|
| 623 |
if (event.key !== 'Escape' || detailView.hidden || !card.contains(document.activeElement)) return;
|
| 624 |
event.preventDefault(); event.stopPropagation();
|
| 625 |
+
setExpanded(false); summaryView.focus();
|
| 626 |
};
|
| 627 |
card.addEventListener('keydown', keyHandler);
|
| 628 |
|
|
|
|
| 633 |
scope.addCleanup(() => {
|
| 634 |
pauseDetails(); stopTrackingRemoval?.(); stopTrackingRemoval = null;
|
| 635 |
summaryView.onclick = null; card.removeEventListener('keydown', keyHandler);
|
| 636 |
+
summaryView.setAttribute('aria-disabled', 'true'); summaryView.tabIndex = -1;
|
| 637 |
commentUI?._cleanup?.();
|
| 638 |
if (currentExpandedCard === card) currentExpandedCard = null;
|
| 639 |
if (resizeSubscribed) window.removeEventListener('resize', resizeHandler);
|
前端页面/styles/主题基础.css
CHANGED
|
@@ -1555,8 +1555,6 @@ button.ranking-rating__star { cursor: pointer; min-width: 28px; min-height: 28px
|
|
| 1555 |
.creator-card__stat-value > span { min-width:0; }
|
| 1556 |
.creator-card__number { white-space:nowrap; }
|
| 1557 |
.creator-card__stat small { font-weight:400; font-size:10px; }
|
| 1558 |
-
.creator-card__toggle { width:100%; min-height:36px; display:flex; align-items:center; justify-content:space-between; gap:8px; margin-top:10px; padding:6px 10px; border:1px solid var(--rk-border,#454545); border-radius:6px; background:var(--rk-panel,var(--comfy-input-bg,#292929)); color:var(--rk-text,var(--fg-color,#f1f1f1)); font:inherit; font-size:12px; cursor:pointer; }
|
| 1559 |
-
.creator-card__toggle[aria-expanded="true"] > span { transform:rotate(180deg); }
|
| 1560 |
.creator-card button:hover, .creator-tip-board button:hover { text-decoration:underline; }
|
| 1561 |
.creator-card button:focus-visible, .creator-tip-board button:focus-visible { outline:2px solid var(--rk-focus,#8ab4ff); outline-offset:2px; }
|
| 1562 |
.creator-card button:disabled { cursor:default; opacity:.65; }
|
|
@@ -1706,3 +1704,5 @@ button.ranking-rating__star { cursor: pointer; min-width: 28px; min-height: 28px
|
|
| 1706 |
@container ranking-posts (max-width: 280px) { .posts-grid { grid-template-columns: minmax(0, 1fr); padding: 10px; } }
|
| 1707 |
@media (prefers-reduced-motion: reduce) { .posts-skeleton { animation: none; } }
|
| 1708 |
@media (forced-colors: active) { .posts-card__play { background: Canvas; border: 1px solid CanvasText; } .posts-card__play-icon { border-left-color: CanvasText; } }
|
|
|
|
|
|
|
|
|
| 1555 |
.creator-card__stat-value > span { min-width:0; }
|
| 1556 |
.creator-card__number { white-space:nowrap; }
|
| 1557 |
.creator-card__stat small { font-weight:400; font-size:10px; }
|
|
|
|
|
|
|
| 1558 |
.creator-card button:hover, .creator-tip-board button:hover { text-decoration:underline; }
|
| 1559 |
.creator-card button:focus-visible, .creator-tip-board button:focus-visible { outline:2px solid var(--rk-focus,#8ab4ff); outline-offset:2px; }
|
| 1560 |
.creator-card button:disabled { cursor:default; opacity:.65; }
|
|
|
|
| 1704 |
@container ranking-posts (max-width: 280px) { .posts-grid { grid-template-columns: minmax(0, 1fr); padding: 10px; } }
|
| 1705 |
@media (prefers-reduced-motion: reduce) { .posts-skeleton { animation: none; } }
|
| 1706 |
@media (forced-colors: active) { .posts-card__play { background: Canvas; border: 1px solid CanvasText; } .posts-card__play-icon { border-left-color: CanvasText; } }
|
| 1707 |
+
|
| 1708 |
+
.creator-card__summary:focus-visible { outline:2px solid var(--rk-focus,#8ab4ff); outline-offset:-3px; }
|