@mooncellwiki/prts-design-css 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.
Files changed (123) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +38 -0
  3. package/dist/prts-design.css +6762 -0
  4. package/dist/prts-design.min.css +2 -0
  5. package/package.json +55 -0
  6. package/src/arknights/archive.css +21 -0
  7. package/src/arknights/attrs.css +11 -0
  8. package/src/arknights/camp.css +8 -0
  9. package/src/arknights/dialogue.css +7 -0
  10. package/src/arknights/dossier.css +13 -0
  11. package/src/arknights/elite.css +5 -0
  12. package/src/arknights/enemy.css +12 -0
  13. package/src/arknights/event.css +14 -0
  14. package/src/arknights/hero.css +11 -0
  15. package/src/arknights/index.css +41 -0
  16. package/src/arknights/item.css +32 -0
  17. package/src/arknights/kv.css +15 -0
  18. package/src/arknights/level.css +9 -0
  19. package/src/arknights/materials.css +6 -0
  20. package/src/arknights/module.css +49 -0
  21. package/src/arknights/news.css +6 -0
  22. package/src/arknights/op-card.css +26 -0
  23. package/src/arknights/op-row.css +6 -0
  24. package/src/arknights/phase-tabs.css +8 -0
  25. package/src/arknights/pot-list.css +7 -0
  26. package/src/arknights/potential.css +4 -0
  27. package/src/arknights/profession.css +16 -0
  28. package/src/arknights/range.css +10 -0
  29. package/src/arknights/rarity.css +21 -0
  30. package/src/arknights/rich-text.css +18 -0
  31. package/src/arknights/skill-levels.css +13 -0
  32. package/src/arknights/skill-matrix.css +25 -0
  33. package/src/arknights/skill-sheet.css +30 -0
  34. package/src/arknights/skill.css +28 -0
  35. package/src/arknights/sp.css +15 -0
  36. package/src/arknights/stage.css +22 -0
  37. package/src/arknights/table-numerals.css +7 -0
  38. package/src/arknights/talent-table.css +30 -0
  39. package/src/arknights/talent.css +7 -0
  40. package/src/arknights/trust.css +4 -0
  41. package/src/arknights/voice.css +21 -0
  42. package/src/base/catlinks.css +64 -0
  43. package/src/base/collapsible.css +10 -0
  44. package/src/base/forms.css +121 -0
  45. package/src/base/index.css +20 -0
  46. package/src/base/media.css +26 -0
  47. package/src/base/notices.css +17 -0
  48. package/src/base/print.css +11 -0
  49. package/src/base/references.css +9 -0
  50. package/src/base/root.css +16 -0
  51. package/src/base/special-pages.css +43 -0
  52. package/src/base/tabber.css +31 -0
  53. package/src/base/tables.css +45 -0
  54. package/src/base/toc.css +19 -0
  55. package/src/base/typography.css +133 -0
  56. package/src/bridge-codex.css +98 -0
  57. package/src/chrome/body.css +13 -0
  58. package/src/chrome/footer.css +34 -0
  59. package/src/chrome/header.css +104 -0
  60. package/src/chrome/index.css +29 -0
  61. package/src/chrome/keyart.css +15 -0
  62. package/src/chrome/layout.css +15 -0
  63. package/src/chrome/local-nav.css +17 -0
  64. package/src/chrome/page-header.css +68 -0
  65. package/src/chrome/responsive.css +127 -0
  66. package/src/chrome/search-palette.css +121 -0
  67. package/src/chrome/shell.css +4 -0
  68. package/src/chrome/sidebar-tree.css +36 -0
  69. package/src/chrome/sidebar.css +39 -0
  70. package/src/chrome/special-pages.css +4 -0
  71. package/src/chrome/theme-toggle.css +10 -0
  72. package/src/chrome/toc.css +38 -0
  73. package/src/components/accordion.css +10 -0
  74. package/src/components/avatar.css +8 -0
  75. package/src/components/badge.css +16 -0
  76. package/src/components/breadcrumb.css +7 -0
  77. package/src/components/button.css +45 -0
  78. package/src/components/card.css +28 -0
  79. package/src/components/cbox.css +18 -0
  80. package/src/components/chip.css +9 -0
  81. package/src/components/dialog.css +14 -0
  82. package/src/components/divider.css +8 -0
  83. package/src/components/dropdown.css +30 -0
  84. package/src/components/empty.css +5 -0
  85. package/src/components/fab.css +9 -0
  86. package/src/components/form.css +66 -0
  87. package/src/components/heading.css +11 -0
  88. package/src/components/index.css +38 -0
  89. package/src/components/keyframes.css +14 -0
  90. package/src/components/message.css +21 -0
  91. package/src/components/pagination.css +11 -0
  92. package/src/components/panel.css +15 -0
  93. package/src/components/progress.css +19 -0
  94. package/src/components/skeleton.css +5 -0
  95. package/src/components/spinner.css +23 -0
  96. package/src/components/stat.css +12 -0
  97. package/src/components/stepper.css +14 -0
  98. package/src/components/table.css +17 -0
  99. package/src/components/tabs.css +29 -0
  100. package/src/components/tag.css +26 -0
  101. package/src/components/timeline.css +13 -0
  102. package/src/components/title-reset.css +8 -0
  103. package/src/components/toast.css +14 -0
  104. package/src/components/tooltip.css +31 -0
  105. package/src/decor/bilingual.css +6 -0
  106. package/src/decor/brackets.css +6 -0
  107. package/src/decor/chevrons.css +5 -0
  108. package/src/decor/corner.css +12 -0
  109. package/src/decor/glyph.css +7 -0
  110. package/src/decor/halftone.css +13 -0
  111. package/src/decor/index.css +18 -0
  112. package/src/decor/inverse.css +4 -0
  113. package/src/decor/patterns.css +7 -0
  114. package/src/decor/stripes.css +10 -0
  115. package/src/decor/type.css +10 -0
  116. package/src/forced-colors.css +54 -0
  117. package/src/index.css +18 -0
  118. package/src/scope.css +120 -0
  119. package/src/search-palette.js +549 -0
  120. package/src/sidebar-tree.js +220 -0
  121. package/src/standalone.css +12 -0
  122. package/src/tokens.css +665 -0
  123. package/src/utilities.css +43 -0
@@ -0,0 +1,220 @@
1
+ /*! ═══════════════════════════════════════════════════════════════════════════
2
+ * PRTS Design · sidebar-tree.js — 侧栏多层导航(树形展开 + 桌面悬停飞出)
3
+ * 皮肤(skins.akds.js 通过 require 引入)与 preview 共用;无依赖,ES5。
4
+ *
5
+ * 适配对象:.ak-sidebar 内的任意嵌套列表 ——
6
+ * · MediaWiki:Sidebar 门户(.ak-portlet > h3 + ul)
7
+ * · PRTS #MenuSidebar 的原始 wikitext 输出(p 分组标题 / ul / li > b|a + ul,任意深度)
8
+ * · 模板或小工具生成的 ul
9
+ *
10
+ * 增强后的结构(类名由本脚本添加,CSS 见 chrome/sidebar-tree.css):
11
+ * li.ak-tree__branch[.is-open][.is-current-path]
12
+ * > (a|b|span).ak-tree__label ← 原有标签元素(非链接时点击整行也可切换)
13
+ * > button.ak-tree__toggle[aria-expanded][aria-controls][aria-labelledby]
14
+ * > ul.ak-tree__list
15
+ *
16
+ * 状态:localStorage['akds-sidebar-tree'] = { "<分组>/<标签路径>": 1|0, "portlet:<id|标题>": 1|0 }
17
+ * 当前页所在分支(a.selflink / .mw-selflink / li.is-active / li.selected / [aria-current] / href==location)总是自动展开。
18
+ * 飞出:hover + fine pointer 且 ≥1120px 时,悬停「折叠中」的分支 → 右侧飞出预览(position:fixed,不受侧栏 overflow 裁切);
19
+ * 点击 / 键盘 → 行内展开并记忆。关闭方式:<aside class="ak-sidebar" data-flyout="off"> 或 <html data-akds-flyout="off">。
20
+ * ═══════════════════════════════════════════════════════════════════════════ */
21
+ ( function () {
22
+ 'use strict';
23
+ var ROOT = '.ak-sidebar';
24
+ var STORE = 'akds-sidebar-tree';
25
+ var uid = 0;
26
+ var state = load();
27
+
28
+ function load() { try { return JSON.parse( localStorage.getItem( STORE ) ) || {}; } catch ( e ) { return {}; } }
29
+ function save() { try { localStorage.setItem( STORE, JSON.stringify( state ) ); } catch ( e ) { /* private mode */ } }
30
+ function txt( el ) { return el ? ( el.textContent || '' ).replace( /\s+/g, ' ' ).trim() : ''; }
31
+ function each( list, fn ) { Array.prototype.forEach.call( list, fn ); }
32
+ function child( el, sel ) { return el ? el.querySelector( ':scope > ' + sel ) : null; }
33
+
34
+ /* ── 标签元素:li 中位于子 ul 之前的内容;多节点或裸文本时包一层 span ── */
35
+ function ensureLabel( li, ul ) {
36
+ var nodes = [], n;
37
+ for ( n = li.firstChild; n && n !== ul; n = n.nextSibling ) { nodes.push( n ); }
38
+ var els = nodes.filter( function ( x ) { return x.nodeType === 1 && x.tagName !== 'BUTTON' && x.tagName !== 'SCRIPT'; } );
39
+ var text = nodes.filter( function ( x ) { return x.nodeType === 3 && x.nodeValue.trim(); } );
40
+ if ( els.length === 1 && !text.length ) { return els[ 0 ]; }
41
+ var span = document.createElement( 'span' );
42
+ li.insertBefore( span, ul );
43
+ nodes.forEach( function ( x ) { if ( x.nodeType !== 1 || x.tagName !== 'BUTTON' ) { span.appendChild( x ); } } );
44
+ return span;
45
+ }
46
+ function labelOf( li ) { return child( li, '.ak-tree__label' ); }
47
+
48
+ /* ── 持久化键:分组标题 + 分支标签路径 ── */
49
+ function groupOf( li ) {
50
+ var top = li, root = li.closest( ROOT );
51
+ while ( top.parentElement && top.parentElement !== root && top.parentElement.tagName !== 'DIV' && top.parentElement.tagName !== 'NAV' && top.parentElement.tagName !== 'ASIDE' ) { top = top.parentElement; }
52
+ var h = top.previousElementSibling;
53
+ while ( h && !/^(P|H[1-6])$/.test( h.tagName ) ) { h = h.previousElementSibling; }
54
+ if ( h ) { return txt( h ); }
55
+ var box = top.parentElement;
56
+ var t = box && ( child( box, '.ak-portlet__title' ) || child( box, 'h3' ) || child( box, 'h2' ) );
57
+ return t ? txt( t ) : ( box && box.id ) || '';
58
+ }
59
+ function keyOf( li ) {
60
+ if ( li.dataset.akKey ) { return li.dataset.akKey; }
61
+ var parts = [], n = li;
62
+ while ( n && !n.matches( ROOT ) ) { if ( n.tagName === 'LI' && n.classList.contains( 'ak-tree__branch' ) ) { parts.unshift( txt( labelOf( n ) ) ); } n = n.parentElement; }
63
+ return groupOf( li ) + '/' + parts.join( '/' );
64
+ }
65
+
66
+ function setOpen( li, open, persist ) {
67
+ li.classList.toggle( 'is-open', open );
68
+ var b = child( li, '.ak-tree__toggle' );
69
+ if ( b ) { b.setAttribute( 'aria-expanded', open ? 'true' : 'false' ); }
70
+ if ( persist !== false && li.dataset.akKey ) { state[ li.dataset.akKey ] = open ? 1 : 0; save(); }
71
+ hideFlyout();
72
+ }
73
+
74
+ /* ── 增强(幂等;可对同一 root 反复调用,例如站点脚本晚于皮肤注入 #MenuSidebar) ── */
75
+ function enhance( root ) {
76
+ each( root.querySelectorAll( 'li > ul' ), function ( ul ) {
77
+ var li = ul.parentElement;
78
+ if ( !ul.id ) { ul.id = 'ak-tree-' + ( ++uid ); }
79
+ ul.classList.add( 'ak-tree__list' );
80
+ var label = ensureLabel( li, ul );
81
+ label.classList.add( 'ak-tree__label' );
82
+ if ( !label.id ) { label.id = ul.id + '-label'; }
83
+ var fresh = !li.classList.contains( 'ak-tree__branch' );
84
+ li.classList.add( 'ak-tree__branch' );
85
+ var btn = child( li, '.ak-tree__toggle' );
86
+ if ( !btn ) {
87
+ btn = document.createElement( 'button' ); btn.type = 'button'; btn.className = 'ak-tree__toggle';
88
+ btn.setAttribute( 'aria-controls', ul.id ); btn.setAttribute( 'aria-labelledby', label.id );
89
+ li.insertBefore( btn, ul );
90
+ }
91
+ if ( fresh ) {
92
+ var k = keyOf( li ); li.dataset.akKey = k;
93
+ if ( Object.prototype.hasOwnProperty.call( state, k ) ) { li.classList.toggle( 'is-open', !!state[ k ] ); } /* 用户记忆 > 作者默认(is-open) */
94
+ }
95
+ btn.setAttribute( 'aria-expanded', li.classList.contains( 'is-open' ) ? 'true' : 'false' );
96
+ } );
97
+ /* 当前页所在路径:自动展开 + 高亮(不写入记忆) */
98
+ var cur = root.querySelectorAll( 'a.selflink, a.mw-selflink, li.is-active > a, li.selected > a, a[aria-current="page"]' );
99
+ if ( !cur.length ) {
100
+ cur = Array.prototype.filter.call( root.querySelectorAll( 'li > a[href]' ), function ( a ) {
101
+ try { var u = new URL( a.href, location.href ); return u.origin === location.origin && u.pathname === location.pathname && u.search === location.search && !u.hash; } catch ( e ) { return false; }
102
+ } );
103
+ }
104
+ each( cur, function ( a ) {
105
+ var li = a.closest( 'li' ); if ( li ) { li.classList.add( 'is-current' ); }
106
+ for ( var n = a.parentElement; n && n !== root; n = n.parentElement ) {
107
+ if ( n.tagName === 'LI' && n.classList.contains( 'ak-tree__branch' ) ) { n.classList.add( 'is-open', 'is-current-path' ); var b = child( n, '.ak-tree__toggle' ); if ( b ) { b.setAttribute( 'aria-expanded', 'true' ); } }
108
+ }
109
+ } );
110
+ /* 可折叠门户(.ak-portlet--collapsible)恢复记忆 */
111
+ each( root.querySelectorAll( '.ak-portlet--collapsible' ), function ( p ) {
112
+ var k = 'portlet:' + ( p.id || txt( child( p, '.ak-portlet__title' ) || child( p, 'h3' ) ) );
113
+ p.dataset.akKey = k;
114
+ if ( Object.prototype.hasOwnProperty.call( state, k ) ) { p.classList.toggle( 'is-collapsed', !state[ k ] ); }
115
+ var t = child( p, '.ak-portlet__title' ) || child( p, 'h3' );
116
+ if ( t ) { t.setAttribute( 'role', 'button' ); t.tabIndex = 0; t.setAttribute( 'aria-expanded', p.classList.contains( 'is-collapsed' ) ? 'false' : 'true' ); }
117
+ } );
118
+ }
119
+
120
+ /* ── 点击 / 键盘 ── */
121
+ document.addEventListener( 'click', function ( e ) {
122
+ var root = e.target.closest( ROOT );
123
+ if ( !root ) { if ( !fly || !fly.contains( e.target ) ) { hideFlyout(); } return; }
124
+ var li = null, t = e.target.closest( '.ak-tree__toggle' );
125
+ if ( t ) { li = t.parentElement; }
126
+ else {
127
+ var lab = e.target.closest( '.ak-tree__branch > .ak-tree__label' );
128
+ if ( lab && lab.tagName !== 'A' && !e.target.closest( 'a' ) ) { li = lab.parentElement; } /* 非链接标签:整行可切换 */
129
+ }
130
+ if ( li ) { e.preventDefault(); setOpen( li, !li.classList.contains( 'is-open' ) ); return; }
131
+ var pt = e.target.closest( '.ak-portlet--collapsible > .ak-portlet__title, .ak-portlet--collapsible > h3' );
132
+ if ( pt ) {
133
+ var p = pt.parentElement, collapsed = p.classList.toggle( 'is-collapsed' );
134
+ pt.setAttribute( 'aria-expanded', collapsed ? 'false' : 'true' );
135
+ if ( p.dataset.akKey ) { state[ p.dataset.akKey ] = collapsed ? 0 : 1; save(); }
136
+ }
137
+ } );
138
+ document.addEventListener( 'keydown', function ( e ) {
139
+ if ( e.key === 'Escape' ) { hideFlyout(); return; }
140
+ var root = e.target.closest && e.target.closest( ROOT ); if ( !root ) { return; }
141
+ var pt = e.target.closest( '.ak-portlet--collapsible > .ak-portlet__title[role="button"]' );
142
+ if ( pt && ( e.key === 'Enter' || e.key === ' ' ) ) { e.preventDefault(); pt.click(); return; }
143
+ var li = e.target.closest( '.ak-tree__branch' ); if ( !li ) { return; }
144
+ var mine = e.target.parentElement === li; /* 焦点在本分支自己的标签/切换钮上 */
145
+ if ( e.key === 'ArrowRight' ) {
146
+ if ( mine && !li.classList.contains( 'is-open' ) ) { e.preventDefault(); setOpen( li, true ); }
147
+ } else if ( e.key === 'ArrowLeft' ) {
148
+ /* 自己已展开 → 收起自己;否则收起最近的已展开祖先分支并聚焦其切换钮 */
149
+ var target = ( mine && li.classList.contains( 'is-open' ) ) ? li : ( mine ? li.parentElement.closest( '.ak-tree__branch.is-open' ) : li );
150
+ if ( target ) { e.preventDefault(); setOpen( target, false ); var b = child( target, '.ak-tree__toggle' ); if ( b ) { b.focus(); } }
151
+ }
152
+ } );
153
+
154
+ /* ── 桌面悬停飞出(peek) ── */
155
+ var fly = null, flyLi = null, showTimer = 0, hideTimer = 0;
156
+ var mq = window.matchMedia ? window.matchMedia( '(hover: hover) and (pointer: fine) and (min-width: 1120px)' ) : { matches: false };
157
+ function flyoutEnabled( root ) { return mq.matches && root.getAttribute( 'data-flyout' ) !== 'off' && document.documentElement.getAttribute( 'data-akds-flyout' ) !== 'off'; }
158
+ function hideFlyout() {
159
+ clearTimeout( showTimer ); clearTimeout( hideTimer ); showTimer = 0;
160
+ if ( fly ) { fly.parentNode.removeChild( fly ); fly = null; } /* 每次重建,不复用(避免残留状态) */
161
+ if ( flyLi ) { flyLi.classList.remove( 'is-peek' ); flyLi = null; }
162
+ }
163
+ function scheduleHide() { clearTimeout( hideTimer ); hideTimer = setTimeout( hideFlyout, 180 ); }
164
+ function showFlyout( li ) {
165
+ var ul = child( li, 'ul' ); if ( !ul ) { return; }
166
+ hideFlyout();
167
+ fly = document.createElement( 'div' ); fly.className = 'ak-flyout'; fly.setAttribute( 'aria-hidden', 'true' );
168
+ fly.addEventListener( 'mouseenter', function () { clearTimeout( hideTimer ); } );
169
+ fly.addEventListener( 'mouseleave', scheduleHide );
170
+ var title = document.createElement( 'div' ); title.className = 'ak-flyout__title'; title.textContent = txt( labelOf( li ) ); fly.appendChild( title );
171
+ var clone = ul.cloneNode( true );
172
+ each( clone.querySelectorAll( '[id]' ), function ( n ) { n.removeAttribute( 'id' ); } );
173
+ each( clone.querySelectorAll( '.ak-tree__toggle, script' ), function ( n ) { n.parentNode.removeChild( n ); } );
174
+ fly.appendChild( clone );
175
+ var r = li.getBoundingClientRect();
176
+ fly.style.maxHeight = ( window.innerHeight - 16 ) + 'px';
177
+ fly.style.left = Math.round( r.right + 6 ) + 'px';
178
+ fly.style.top = '0px';
179
+ document.body.appendChild( fly );
180
+ var top = Math.max( 8, Math.min( r.top, window.innerHeight - 8 - fly.offsetHeight ) );
181
+ fly.style.top = Math.round( top ) + 'px';
182
+ li.classList.add( 'is-peek' ); flyLi = li;
183
+ }
184
+ document.addEventListener( 'mouseover', function ( e ) {
185
+ var root = e.target.closest ? e.target.closest( ROOT ) : null;
186
+ if ( !root ) { return; }
187
+ if ( !flyoutEnabled( root ) ) { return; }
188
+ var row = e.target.closest( '.ak-tree__label, .ak-tree__toggle' );
189
+ var li = row && row.parentElement;
190
+ if ( li && li.classList.contains( 'ak-tree__branch' ) && !li.classList.contains( 'is-open' ) ) {
191
+ if ( flyLi === li ) { clearTimeout( hideTimer ); return; }
192
+ clearTimeout( showTimer ); clearTimeout( hideTimer );
193
+ showTimer = setTimeout( function () { showFlyout( li ); }, 120 );
194
+ } else if ( flyLi || showTimer ) { clearTimeout( showTimer ); showTimer = 0; scheduleHide(); }
195
+ } );
196
+ document.addEventListener( 'mouseout', function ( e ) {
197
+ if ( !flyLi && !showTimer ) { return; }
198
+ var to = e.relatedTarget;
199
+ if ( !to || ( !to.closest( ROOT ) && !( fly && fly.contains( to ) ) ) ) { clearTimeout( showTimer ); showTimer = 0; scheduleHide(); }
200
+ } );
201
+ document.addEventListener( 'scroll', function () { if ( flyLi ) { hideFlyout(); } }, true );
202
+ window.addEventListener( 'resize', hideFlyout );
203
+
204
+ /* ── 初始化:立即增强 + 监听后续注入(如 PRTS 站点脚本把 #MenuSidebar 移入 #mw-panel) ── */
205
+ function init( scope ) {
206
+ scope = scope || document;
207
+ var roots = scope.matches && scope.matches( ROOT ) ? [ scope ] : scope.querySelectorAll( ROOT );
208
+ each( roots, function ( root ) {
209
+ enhance( root );
210
+ if ( !root.__akTree && window.MutationObserver ) {
211
+ var raf = 0;
212
+ var mo = new MutationObserver( function () { if ( raf ) { return; } raf = requestAnimationFrame( function () { raf = 0; enhance( root ); } ); } );
213
+ mo.observe( root, { childList: true, subtree: true } );
214
+ root.__akTree = mo;
215
+ }
216
+ } );
217
+ }
218
+ if ( document.readyState === 'loading' ) { document.addEventListener( 'DOMContentLoaded', function () { init(); } ); } else { init(); }
219
+ window.akdsSidebarTree = { init: init, refresh: enhance, setOpen: setOpen, hideFlyout: hideFlyout };
220
+ }() );
@@ -0,0 +1,12 @@
1
+ /*! PRTS Design — 明日方舟网页设计系统 · 组件入口(npm 包 @mooncellwiki/prts-design-css 的默认入口;prts.wiki 上别的皮肤、站外页面用)
2
+ * 只有随组件走的部分:令牌 + 作用域根 + 组件 / 装饰 / 方舟组件 + 工具类 + 强制色模式。组件放在 .ak-scope 里(Vue:<AkScope>)才有排版基线。
3
+ * 不含:字体(fonts.css,不可转授;退到令牌里的 Oswald / Chakra Petch / 系统字链)· Codex 桥接(bridge-codex.css,会改掉宿主的 Codex 配色)·
4
+ * 游戏素材(base/skin-assets.css + img/;.ak-item--bare 无底框,自己覆盖 --ak-item-bg-* 可补)· MW 正文排版(base/)· 皮肤骨架(chrome/)。
5
+ * 顺序是 index.css 的子序列(scripts/css-order.ts 检查),层叠结果与皮肤全套一致。 */
6
+ @import url("tokens.css");
7
+ @import url("scope.css");
8
+ @import url("components/index.css");
9
+ @import url("decor/index.css");
10
+ @import url("arknights/index.css");
11
+ @import url("utilities.css");
12
+ @import url("forced-colors.css");