Files
kate522andClaude Fable 5 cf4554e7c8 fix(ajax): show the reference skeleton on every load-more surface
Clicking 加载更多 in the 多栏目文章 widget showed no skeleton at all — the
list simply stayed still until the response arrived, then the new cards
appeared. The homepage stream, archives and comments already had a working
skeleton; the widget's AJAX load goes through a different client and never
found its loader.

Root cause was DOM placement, not visibility: ContentRenderer emitted
.post_ajax_loader as a *sibling* of .widget-ajaxpager, while the widget REST
client resolves it with container.querySelector('.post_ajax_loader'). The
node existed but could never match, so .is-loading was never added and the
skeleton stayed display:none. Inactive tab panes had the same shape, and the
direct-load branch of ajaxpager() emitted no loader at all.

Changes, all following the reference theme's post_ajax() contract in
zibll/js/main.js (beforeSend anchors the loader to the end of the list;
success only hides it, never removes it):

- ContentRenderer: nest the loader inside .widget-ajaxpager for both the
  direct-load and inactive-tab branches, and drop the sibling append.
- widgets/frontend.js: anchorLoader() moves the loader to the end of the
  list before .ajax-pag on every request; appended cards are inserted before
  it; a replace preserves the node instead of wiping it with innerHTML; a
  fallback loader is created when the DOM has none; loadItems() now returns
  its promise; drop the unreachable is-loading auto-load branch.
- Message centre, user-home panels and the search page switch from spinner /
  opacity feedback to the same .posts-item-shaped skeleton, so all AJAX
  surfaces share one loading contract.
- Remove the second, never-wired skeleton system (.aksrt-skeleton-* in
  core-ui.css) and the dead spinner stylesheets/rules (skeleton.css,
  ajax-spinner.css, .load-more__*, --skeleton-base/--skeleton-shine) plus the
  unregistered assets/js/waterfall.js.
- Extend the widget, message-centre, user-home and asset-ledger contract
  tests to pin the loader inside the container, the class-only visibility
  switch, and the absence of the deleted dead code.

Verified: 470 node tests, 136 PHP widget assertions, admin-contract and
widget-system audits all green; rebuilt public assets after the CSS/JS
removals.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-03 22:22:15 +08:00

705 lines
15 KiB
CSS

/* ============================================================
* Messages Center — 独立消息中心页面
* ============================================================ */
.messages-center {
display: grid;
grid-template-columns: 220px 1fr;
gap: 24px;
min-height: 60vh;
padding-top: 24px;
padding-bottom: 48px;
}
/* ---- 左侧导航 ---- */
.messages-center__nav {
position: sticky;
top: calc(var(--nav-height, 60px) + 24px);
align-self: start;
background: var(--surface-card, #fff);
border-radius: 12px;
padding: 16px 12px;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}
.messages-nav__list {
list-style: none;
margin: 0;
padding: 0;
}
.messages-nav__item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px 12px;
border-radius: 8px;
color: var(--color-ink);
text-decoration: none;
font-size: 14px;
transition: background 0.15s, color 0.15s;
cursor: pointer;
}
.messages-nav__item:hover {
background: var(--surface-hover, rgba(0, 0, 0, 0.04));
}
.messages-nav__item.is-active {
background: var(--color-primary-light, rgba(59, 130, 246, 0.08));
color: var(--color-primary, #3b82f6);
font-weight: 600;
}
.messages-nav__badge {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 20px;
height: 20px;
padding: 0 6px;
border-radius: 10px;
background: var(--color-primary, #3b82f6);
color: #fff;
font-size: 11px;
font-weight: 600;
line-height: 1;
}
.messages-nav__badge:empty,
.messages-nav__badge[data-count="0"] {
display: none;
}
.messages-nav__actions {
display: flex;
flex-direction: column;
gap: 6px;
margin-top: 16px;
padding-top: 12px;
border-top: 1px solid var(--color-line);
}
.messages-nav__action-btn {
display: block;
width: 100%;
padding: 8px 12px;
border: none;
border-radius: 6px;
background: var(--surface-hover, rgba(0, 0, 0, 0.04));
color: var(--color-ink-3, #666);
font-size: 13px;
cursor: pointer;
text-align: center;
transition: background 0.15s;
}
.messages-nav__action-btn:hover {
background: var(--surface-active, rgba(0, 0, 0, 0.08));
}
/* ---- 右侧内容 ---- */
.messages-center__content {
min-width: 0;
outline: none;
transition: opacity 0.15s ease;
}
.messages-center.is-loading .messages-center__content {
pointer-events: none;
}
/* 加载态由消息骨架承担(与文章列表 .post_ajax_loader 同一契约),
不再让按钮 spinner 与内容透明度抢反馈。 */
.messages-list > .post_ajax_loader {
display: none;
}
.messages-list > .post_ajax_loader.is-loading {
display: block;
animation: aksrtFadeIn 0.2s ease both;
}
.messages-list {
display: flex;
flex-direction: column;
gap: 1px;
background: var(--surface-card, #fff);
border-radius: 12px;
overflow: hidden;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}
.message-item {
display: flex;
align-items: flex-start;
gap: 12px;
padding: 16px 20px;
background: var(--surface-card, #fff);
border-bottom: 1px solid var(--color-border-light, #f3f4f6);
transition: background 0.15s;
}
.message-item:last-child {
border-bottom: none;
}
.message-item:hover {
background: var(--surface-hover, rgba(0, 0, 0, 0.02));
}
.message-item.is-unread {
border-left: 3px solid var(--color-primary, #3b82f6);
}
.message-item.is-unread .message-item__title {
font-weight: 600;
}
.message-item__icon {
display: flex;
align-items: center;
justify-content: center;
width: 36px;
height: 36px;
min-width: 36px;
border-radius: 50%;
background: var(--color-primary-light, rgba(59, 130, 246, 0.1));
color: var(--color-primary, #3b82f6);
font-size: 14px;
}
.message-item__body {
flex: 1;
min-width: 0;
}
.message-item__title {
font-size: 14px;
color: var(--color-ink);
margin-bottom: 4px;
display: flex;
align-items: center;
gap: 8px;
}
button.message-item__title {
width: 100%;
padding: 0;
border: 0;
background: transparent;
font-family: inherit;
text-align: left;
cursor: pointer;
}
button.message-item__title:hover {
color: var(--color-primary, #3b82f6);
}
.message-item__new-badge {
display: inline-block;
padding: 1px 6px;
border-radius: 3px;
background: var(--color-danger, #ef4444);
color: #fff;
font-size: 10px;
font-weight: 600;
line-height: 1.4;
}
/* ---- 消息详情(右侧 DOM 视图,不改变地址) ---- */
.message-detail {
min-height: 360px;
padding: 28px 32px;
background: var(--surface-card, #fff);
border-radius: 12px;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}
.message-detail__header {
position: relative;
padding: 48px 0 22px;
border-bottom: 1px solid var(--color-line);
text-align: center;
}
.message-detail__back {
position: absolute;
top: 0;
left: 0;
padding: 7px 10px;
border: 0;
border-radius: 6px;
background: var(--surface-hover, rgba(0, 0, 0, 0.04));
color: var(--color-ink-3, #666);
cursor: pointer;
}
.message-detail__icon {
display: inline-flex;
align-items: center;
justify-content: center;
width: 52px;
height: 52px;
margin-bottom: 14px;
border-radius: 50%;
background: var(--color-primary-light, rgba(59, 130, 246, 0.1));
color: var(--color-primary, #3b82f6);
font-size: 20px;
}
.message-detail__title {
margin: 0 0 8px;
color: var(--color-ink);
font-size: 22px;
}
.message-detail__meta {
margin: 0;
color: var(--color-ink-4, #999);
font-size: 12px;
}
.message-detail__content {
min-height: 140px;
padding: 28px 4px;
color: var(--color-ink-2, #444);
font-size: 15px;
line-height: 1.9;
overflow-wrap: anywhere;
}
.message-detail__content p {
margin: 0 0 1em;
}
.message-detail__actions {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 10px;
padding-top: 18px;
border-top: 1px solid var(--color-line);
}
html.dark .message-detail {
background: var(--surface-1);
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
.message-item__desc {
font-size: 13px;
color: var(--color-ink-3, #666);
margin-bottom: 4px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.message-item__time {
font-size: 12px;
color: var(--color-ink-4, #999);
}
.message-item__actions {
display: flex;
align-items: center;
gap: 8px;
flex-shrink: 0;
}
.message-item__action-btn {
padding: 4px 10px;
border: none;
border-radius: 4px;
background: transparent;
color: var(--color-ink-3, #666);
font-size: 12px;
cursor: pointer;
transition: background 0.15s, color 0.15s;
}
.message-item__action-btn:hover {
background: var(--surface-hover, rgba(0, 0, 0, 0.06));
color: var(--color-primary, #3b82f6);
}
.message-item__action-btn--danger:hover {
color: var(--color-danger, #ef4444);
}
/* ---- 空状态 ---- */
.messages-empty {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 64px 24px;
background: var(--surface-card, #fff);
border-radius: 12px;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}
.messages-empty__icon {
font-size: 48px;
color: var(--color-ink-4, #ccc);
margin-bottom: 16px;
}
.messages-empty__text {
font-size: 14px;
color: var(--color-ink-3, #666);
}
.messages-empty__hint {
margin-top: 4px;
font-size: 12px;
color: var(--color-ink-4, #999);
}
/* ---- 分页 ---- */
.messages-pagination {
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
margin-top: 24px;
}
.messages-pagination__button,
.messages-pagination__more {
border: 1px solid var(--color-line, rgba(50, 50, 50, 0.08));
background: var(--surface-card, #fff);
color: var(--color-ink-3, #666);
font: inherit;
cursor: pointer;
transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.messages-pagination__button {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 38px;
height: 38px;
padding: 0 10px;
border-radius: 10px;
font-size: 13px;
font-weight: 600;
}
.messages-pagination__button--edge {
color: var(--color-ink-4, #999);
}
.messages-pagination__button:hover:not(:disabled),
.messages-pagination__button:focus-visible {
border-color: var(--color-primary, #3b82f6);
color: var(--color-primary, #3b82f6);
outline: none;
transform: translateY(-1px);
}
.messages-pagination__button.is-current {
border-color: var(--color-primary, #3b82f6);
background: var(--color-primary, #3b82f6);
color: #fff;
box-shadow: 0 6px 16px color-mix(in srgb, var(--color-primary, #3b82f6) 24%, transparent);
}
.messages-pagination__button:disabled {
cursor: default;
opacity: 0.42;
}
.messages-pagination__button.is-current:disabled {
opacity: 1;
}
.messages-pagination__ellipsis {
min-width: 18px;
color: var(--color-ink-4, #999);
font-size: 13px;
text-align: center;
}
.messages-pagination--load-more {
width: min(100%, 440px);
margin-right: auto;
margin-left: auto;
}
.messages-pagination__more {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
min-height: 48px;
padding: 9px 14px 9px 18px;
border-radius: 14px;
box-shadow: 0 3px 14px rgba(30, 40, 60, 0.04);
text-align: left;
}
.messages-pagination__more span {
color: var(--color-primary, #3b82f6);
font-size: 14px;
font-weight: 600;
}
.messages-pagination__more small {
padding: 4px 9px;
border-radius: 999px;
background: var(--color-primary-light, rgba(59, 130, 246, 0.08));
color: var(--color-ink-4, #999);
font-size: 11px;
line-height: 1.4;
}
.messages-pagination__more:hover,
.messages-pagination__more:focus-visible {
border-color: var(--color-primary, #3b82f6);
background: var(--color-primary-light, rgba(59, 130, 246, 0.04));
outline: none;
transform: translateY(-1px);
}
/* 消息骨架:复用真实 .message-item 结构与 .placeholder 动画契约,
只把内容换成灰块(参考主题 post_ajax loader 的同构思路)。 */
.messages-list > .post_ajax_loader .message-item--placeholder {
cursor: default;
}
.messages-list > .post_ajax_loader .message-item--placeholder .message-item__icon {
color: transparent;
}
.messages-list > .post_ajax_loader .message-item--placeholder .message-item__body {
display: flex;
flex-direction: column;
}
.messages-list > .post_ajax_loader .message-item--placeholder .placeholder {
display: block;
}
.messages-list > .post_ajax_loader .message-item--placeholder .placeholder.s1 {
height: 12px;
}
.messages-list > .post_ajax_loader .message-item--placeholder .message-item__actions {
align-self: center;
}
@media (prefers-reduced-motion: reduce) {
.messages-list > .post_ajax_loader .placeholder {
animation: none;
}
}
@media (prefers-reduced-motion: reduce) {
.messages-pagination__button,
.messages-pagination__more {
transition: none;
}
}
/* ---- 响应式 ---- */
@media (max-width: 767px) {
.messages-center {
grid-template-columns: 1fr;
gap: 16px;
padding-top: 16px;
}
.messages-center__nav {
position: static;
padding: 12px;
border-radius: 8px;
}
.messages-nav__list {
display: flex;
overflow-x: auto;
gap: 4px;
scrollbar-width: none;
}
.messages-nav__list::-webkit-scrollbar {
display: none;
}
.messages-nav__item {
white-space: nowrap;
padding: 8px 12px;
font-size: 13px;
border-radius: 20px;
}
.messages-nav__actions {
flex-direction: row;
margin-top: 12px;
padding-top: 10px;
}
.message-item {
padding: 12px 14px;
}
.message-item__actions {
flex-direction: column;
gap: 4px;
}
.message-detail {
min-height: 300px;
padding: 20px 16px;
}
.message-detail__title {
font-size: 18px;
}
.message-detail__actions {
align-items: stretch;
flex-direction: column;
}
.message-detail__actions .message-item__action-btn {
text-align: center;
}
.messages-pagination {
gap: 5px;
margin-top: 18px;
}
.messages-pagination__button {
min-width: 34px;
height: 34px;
padding: 0 8px;
border-radius: 9px;
}
.messages-pagination__ellipsis {
min-width: 10px;
}
.messages-pagination__more {
min-height: 46px;
border-radius: 12px;
}
}
/* ---- 暗色模式 ---- */
html.dark .messages-center__nav,
html.dark .messages-center__nav {
background: var(--surface-1);
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
html.dark .messages-nav__item:hover,
html.dark .messages-nav__item:hover {
background: rgba(255, 255, 255, 0.05);
}
html.dark .messages-nav__item.is-active,
html.dark .messages-nav__item.is-active {
background: var(--color-primary-soft, rgba(240, 68, 148, 0.16));
}
html.dark .messages-nav__action-btn,
html.dark .messages-nav__action-btn {
background: var(--surface-2);
color: var(--color-ink-3);
}
html.dark .messages-nav__action-btn:hover,
html.dark .messages-nav__action-btn:hover {
background: var(--surface-3);
}
html.dark .messages-list,
html.dark .messages-list {
background: var(--surface-1);
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
html.dark .message-item,
html.dark .message-item {
background: var(--surface-1);
border-bottom-color: var(--color-line);
}
html.dark .message-item:hover,
html.dark .message-item:hover {
background: var(--surface-2);
}
html.dark .messages-pagination__button,
html.dark .messages-pagination__more {
border-color: var(--color-line);
background: var(--surface-1);
}
html.dark .messages-pagination__more:hover,
html.dark .messages-pagination__more:focus-visible {
border-color: var(--color-primary);
background: var(--surface-2);
}
html.dark .message-item__icon,
html.dark .message-item__icon {
background: var(--color-primary-soft, rgba(240, 68, 148, 0.16));
}
html.dark .message-item__action-btn:hover,
html.dark .message-item__action-btn:hover {
background: var(--surface-3);
}
html.dark .messages-empty,
html.dark .messages-empty {
background: var(--surface-1);
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
html.dark .messages-nav__actions,
html.dark .messages-nav__actions {
border-top-color: var(--color-line);
}
/* Page header */
.messages-center__header {
margin: 8px 0 16px;
}
.messages-center__title {
margin: 0 0 6px;
font-size: 22px;
font-weight: 700;
color: var(--color-ink, #1f2937);
}
.messages-center__subtitle {
margin: 0;
font-size: 14px;
color: var(--color-ink-3, #6b7280);
}
.messages-center--disabled {
display: block;
min-height: 40vh;
}
.message-item__new-badge {
display: inline-block;
margin-left: 6px;
padding: 1px 6px;
border-radius: 999px;
background: var(--color-primary, #3b82f6);
color: #fff;
font-size: 11px;
font-weight: 600;
vertical-align: middle;
}