Peach: Local-first video metadata scraper and media manager.
feat(web): 换批键忙态改画线条,两条分开画完再一起淡出
longmeidao4f8419d53899
diff --git a/tests/test_web_ui.py b/tests/test_web_ui.pyindex 0d3ab8b84..9deb43e16 100644--- a/tests/test_web_ui.py+++ b/tests/test_web_ui.py@@ -2547,8 +2547,8 @@ class WebUiSourceTests(unittest.TestCase):self.assertPageContains("$('#count').removeAttribute('aria-busy');$('#count').removeAttribute('aria-label');")- def test_the_count_placeholder_and_the_spinning_refresh_key_keep_the_row_height(self):- """计数骨架宽高定死,等数据时只有换批键在转,行高不变。+ def test_the_count_placeholder_and_the_redrawn_refresh_key_keep_the_row_height(self):+ """计数骨架宽高定死,等数据时只有换批键在画,行高不变。骨架跟着真实文本走的话,数字回来那一刻整行会横向弹一下;14px 远低于筛选条按钮的 32px,而两条计数行都有 `min-height:var(--sortH)` 兜底,所以换成真@@ -2561,13 +2561,36 @@ class WebUiSourceTests(unittest.TestCase):self.assertPageContains(".entitycollectionhead h3 .countskeleton{width:96px}")self.assertPageContains(" min-height:var(--sortH);color:var(--ink-2);margin:0 -16px 16px;padding:8px 16px;")self.assertPageContains(" min-height:var(--sortH);margin:0 -16px 12px;padding:8px 16px;min-width:0;")- # 转动复用既有的转圈关键帧;全局 prefers-reduced-motion 规则会把它关掉。+ # 图标拆成两条线,各自 pathLength 归一到 100,dash 的算法就与真实弧长无关了。+ self.assertPageContains(+ '<path class="strand strand-a" pathLength="100" '+ 'd="M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22M18 2l4 4-4 4" />')+ self.assertPageContains(+ '<path class="strand strand-b" pathLength="100" '+ 'd="M2 6h1.972a4 4 0 0 1 3.6 2.2M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45'+ 'M18 14l4 4-4 4" />')+ # 一圈 2.2 秒:第一条画 748ms,第二条接着画 748ms,停 352ms,两条一起淡出 308ms。+ self.assertPageContains(+ "@keyframes peach-strand-draw{\n"+ " 0%{stroke-dashoffset:100;opacity:1}\n"+ " 34%,86%{stroke-dashoffset:0;opacity:1}\n"+ " 100%{stroke-dashoffset:0;opacity:0}}")+ self.assertPageContains(+ "@keyframes peach-strand-draw-late{\n"+ " 0%,36%{stroke-dashoffset:100;opacity:1}\n"+ " 70%,86%{stroke-dashoffset:0;opacity:1}\n"+ " 100%{stroke-dashoffset:0;opacity:0}}")+ # 忙态只传自定义属性:`<use>` 的影子树里选不到外层的忙态标记,继承的属性进得去。+ self.assertPageContains(+ "#i-shuffle .strand{stroke-dasharray:var(--strand-dash,none);\n"+ " animation:peach-strand-draw var(--strand-cycle,0s) linear infinite}")+ self.assertPageContains(+ "#i-shuffle .strand-b{animation-name:peach-strand-draw-late}")self.assertPageContains('.count[aria-busy="true"] #batchAction svg,\n''body.refreshing #batchAction svg,\n''.entitycollectionhead[aria-busy="true"] .entitybatch svg{\n'- " animation:peach-spinner-linspin .9s linear infinite}")- self.assertPageContains("@keyframes peach-spinner-linspin{to{transform:rotate(1turn)}}")+ " --strand-dash:100;--strand-cycle:2.2s}")def test_skeletons_shimmer_by_sweeping_instead_of_breathing(self):"""微光是横向扫光,不是整块呼吸。@@ -5482,11 +5505,11 @@ class WebUiSourceTests(unittest.TestCase):self.assertPageContains("const seededRank=(seed,value)=>{")self.assertPageContains("const followDiscoveryRank=value=>seededRank(followDiscoverySeed,value);")- def test_the_refresh_key_keeps_spinning_until_the_bars_land_too(self):- """转圈归「换一批」这一层,不挂在计数行上。+ def test_the_refresh_key_keeps_redrawing_until_the_bars_land_too(self):+ """忙态动效归「换一批」这一层,不挂在计数行上。网格和顶部三层一起换,两边耗时不一样。挂在计数行的 aria-busy 上时,网格- 先到就被 renderCount 摘掉,标签条还在等的那段时间按钮已经停了。顶部三层+ 先到就被 renderCount 摘掉,标签条还在等的那段时间按钮已经不动了。顶部三层与标签条不铺骨架:它们此刻有内容在屏幕上,撕成灰条再填回去比直接换掉更晃眼,骨架留给从无到有的首屏。"""diff --git a/web/css/12-cards.css b/web/css/12-cards.cssindex 5f4f7d81e..1a717074c 100644--- a/web/css/12-cards.css+++ b/web/css/12-cards.css@@ -51,12 +51,27 @@ main{position:relative;z-index:1;padding:14px 16px 90px}-webkit-backdrop-filter:saturate(1.35) blur(16px)}.count:empty{display:none}.count>span:first-child{flex:none}-/* 等数据时换批键自己转:它是这一行唯一还在动的东西,其余部分必须保持静止。- 全局的 prefers-reduced-motion 规则会关掉它。 */+/* 等数据时换批键自己画:先画完第一条线,再从左到右画第二条,停住让图案看清,两条一起+ 淡出,下一圈立刻起笔。淡出结束正好落在一圈的末尾,所以中间没有一帧是空的。让它整圈+ 旋转的话,这枚两条交叉箭头的图标指向会一直变,读起来像图标画错了而不是像在忙。+ 动效写在 #i-shuffle 自己的两条线上,忙态只负责把两个自定义属性传下去:`<use>` 的影子树+ 里选不到外层那些忙态标记,但继承来的自定义属性进得去。它是这一行唯一还在动的东西,+ 其余部分必须保持静止。全局的 prefers-reduced-motion 规则会关掉它,图标停在画满的样子。 */+@keyframes peach-strand-draw{+ 0%{stroke-dashoffset:100;opacity:1}+ 34%,86%{stroke-dashoffset:0;opacity:1}+ 100%{stroke-dashoffset:0;opacity:0}}+@keyframes peach-strand-draw-late{+ 0%,36%{stroke-dashoffset:100;opacity:1}+ 70%,86%{stroke-dashoffset:0;opacity:1}+ 100%{stroke-dashoffset:0;opacity:0}}+#i-shuffle .strand{stroke-dasharray:var(--strand-dash,none);+ animation:peach-strand-draw var(--strand-cycle,0s) linear infinite}+#i-shuffle .strand-b{animation-name:peach-strand-draw-late}.count[aria-busy="true"] #batchAction svg,body.refreshing #batchAction svg,.entitycollectionhead[aria-busy="true"] .entitybatch svg{- animation:peach-spinner-linspin .9s linear infinite}+ --strand-dash:100;--strand-cycle:2.2s}.count .sorts,.entitycollectionhead .sorts{display:flex;gap:5px;margin-left:auto;flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;min-width:0}.count .sorts::-webkit-scrollbar,.entitycollectionhead .sorts::-webkit-scrollbar{display:none}diff --git a/web/index.html b/web/index.htmlindex bff758ba6..d49a5a723 100644--- a/web/index.html+++ b/web/index.html@@ -88,7 +88,7 @@<symbol id="i-thumbs-up" viewBox="0 0 24 24"><path d="M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z" /><path d="M7 10v12" /></symbol><symbol id="i-thumbs-down" viewBox="0 0 24 24"><path d="M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z" /><path d="M17 14V2" /></symbol><symbol id="i-eye" viewBox="0 0 24 24"><path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0" /><circle cx="12" cy="12" r="3" /></symbol>- <symbol id="i-eye-off" viewBox="0 0 24 24"><path d="M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49" /><path d="M14.084 14.158a3 3 0 0 1-4.242-4.242" /><path d="M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143" /><path d="m2 2 20 20" /></symbol><symbol id="i-ellipsis" viewBox="0 0 24 24"><circle cx="12" cy="12" r="1" /><circle cx="19" cy="12" r="1" /><circle cx="5" cy="12" r="1" /></symbol><symbol id="i-pencil" viewBox="0 0 24 24"><path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z" /><path d="m15 5 4 4" /></symbol><symbol id="i-shuffle" viewBox="0 0 24 24"><path d="m18 14 4 4-4 4" /><path d="m18 2 4 4-4 4" /><path d="M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22" /><path d="M2 6h1.972a4 4 0 0 1 3.6 2.2" /><path d="M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45" /></symbol><symbol id="i-unlink" viewBox="0 0 24 24"><path d="m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71" /><path d="m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71" /><line x1="8" x2="8" y1="2" y2="5" /><line x1="2" x2="5" y1="8" y2="8" /><line x1="16" x2="16" y1="19" y2="22" /><line x1="19" x2="22" y1="16" y2="16" /></symbol><symbol id="i-git-compare" viewBox="0 0 24 24"><circle cx="18" cy="18" r="3" /><circle cx="6" cy="6" r="3" /><path d="M13 6h3a2 2 0 0 1 2 2v7" /><path d="M11 18H8a2 2 0 0 1-2-2V9" /></symbol><symbol id="i-compass" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10" /><path d="m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z" /></symbol><symbol id="i-folder-sync" viewBox="0 0 24 24"><path d="M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v.5" /><path d="M12 10v4h4" /><path d="m12 14 1.535-1.605a5 5 0 0 1 8 1.5" /><path d="M22 22v-4h-4" /><path d="m22 18-1.535 1.605a5 5 0 0 1-8-1.5" /></symbol><symbol id="i-expand" viewBox="0 0 24 24"><path d="m15 15 6 6" /><path d="m15 9 6-6" /><path d="M21 16v5h-5" /><path d="M21 8V3h-5" /><path d="M3 16v5h5" /><path d="m3 21 6-6" /><path d="M3 8V3h5" /><path d="M9 9 3 3" /></symbol><symbol id="i-zoom-in" viewBox="0 0 24 24"><circle cx="11" cy="11" r="8" /><line x1="21" x2="16.65" y1="21" y2="16.65" /><line x1="11" x2="11" y1="8" y2="14" /><line x1="8" x2="14" y1="11" y2="11" /></symbol><symbol id="i-zoom-out" viewBox="0 0 24 24"><circle cx="11" cy="11" r="8" /><line x1="21" x2="16.65" y1="21" y2="16.65" /><line x1="8" x2="14" y1="11" y2="11" /></symbol>+ <symbol id="i-eye-off" viewBox="0 0 24 24"><path d="M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49" /><path d="M14.084 14.158a3 3 0 0 1-4.242-4.242" /><path d="M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143" /><path d="m2 2 20 20" /></symbol><symbol id="i-ellipsis" viewBox="0 0 24 24"><circle cx="12" cy="12" r="1" /><circle cx="19" cy="12" r="1" /><circle cx="5" cy="12" r="1" /></symbol><symbol id="i-pencil" viewBox="0 0 24 24"><path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z" /><path d="m15 5 4 4" /></symbol><symbol id="i-shuffle" viewBox="0 0 24 24"><path class="strand strand-a" pathLength="100" d="M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22M18 2l4 4-4 4" /><path class="strand strand-b" pathLength="100" d="M2 6h1.972a4 4 0 0 1 3.6 2.2M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45M18 14l4 4-4 4" /></symbol><symbol id="i-unlink" viewBox="0 0 24 24"><path d="m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71" /><path d="m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71" /><line x1="8" x2="8" y1="2" y2="5" /><line x1="2" x2="5" y1="8" y2="8" /><line x1="16" x2="16" y1="19" y2="22" /><line x1="19" x2="22" y1="16" y2="16" /></symbol><symbol id="i-git-compare" viewBox="0 0 24 24"><circle cx="18" cy="18" r="3" /><circle cx="6" cy="6" r="3" /><path d="M13 6h3a2 2 0 0 1 2 2v7" /><path d="M11 18H8a2 2 0 0 1-2-2V9" /></symbol><symbol id="i-compass" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10" /><path d="m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z" /></symbol><symbol id="i-folder-sync" viewBox="0 0 24 24"><path d="M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v.5" /><path d="M12 10v4h4" /><path d="m12 14 1.535-1.605a5 5 0 0 1 8 1.5" /><path d="M22 22v-4h-4" /><path d="m22 18-1.535 1.605a5 5 0 0 1-8-1.5" /></symbol><symbol id="i-expand" viewBox="0 0 24 24"><path d="m15 15 6 6" /><path d="m15 9 6-6" /><path d="M21 16v5h-5" /><path d="M21 8V3h-5" /><path d="M3 16v5h5" /><path d="m3 21 6-6" /><path d="M3 8V3h5" /><path d="M9 9 3 3" /></symbol><symbol id="i-zoom-in" viewBox="0 0 24 24"><circle cx="11" cy="11" r="8" /><line x1="21" x2="16.65" y1="21" y2="16.65" /><line x1="11" x2="11" y1="8" y2="14" /><line x1="8" x2="14" y1="11" y2="11" /></symbol><symbol id="i-zoom-out" viewBox="0 0 24 24"><circle cx="11" cy="11" r="8" /><line x1="21" x2="16.65" y1="21" y2="16.65" /><line x1="8" x2="14" y1="11" y2="11" /></symbol><symbol id="i-grip-vertical" viewBox="0 0 24 24"><circle cx="9" cy="12" r="1" fill="currentColor" stroke="none"/><circle cx="9" cy="5" r="1" fill="currentColor" stroke="none"/><circle cx="9" cy="19" r="1" fill="currentColor" stroke="none"/><circle cx="15" cy="12" r="1" fill="currentColor" stroke="none"/><circle cx="15" cy="5" r="1" fill="currentColor" stroke="none"/><circle cx="15" cy="19" r="1" fill="currentColor" stroke="none"/></symbol><!-- 图标库里没有表示广告的图形;按 Lucide 的 24×24 描边风格自绘一个感叹号圆标,线宽、圆角端点与其余图标一致,不至于在同一条导航里显得格格不入。 -->