agentcss 0.0.0-stage → 0.11.3

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 (274) hide show
  1. package/01-tokens/README.md +236 -0
  2. package/01-tokens/behavior/dismissable.js +132 -0
  3. package/01-tokens/behavior/emit.js +76 -0
  4. package/01-tokens/behavior/focus-return.js +81 -0
  5. package/01-tokens/behavior/roving.js +152 -0
  6. package/01-tokens/behavior/typeahead.js +124 -0
  7. package/01-tokens/focus-ring-demo.html +133 -0
  8. package/01-tokens/focus-ring.css +102 -0
  9. package/01-tokens/page.css +244 -0
  10. package/01-tokens/polyfill.js +116 -0
  11. package/01-tokens/responsive-demo.html +171 -0
  12. package/01-tokens/scrollbar-demo.html +194 -0
  13. package/01-tokens/scrollbar.css +179 -0
  14. package/01-tokens/theme-toggle.js +103 -0
  15. package/01-tokens/tokens.css +972 -0
  16. package/01-tokens/typography.css +156 -0
  17. package/02-primitives/badge/README.md +71 -0
  18. package/02-primitives/badge/badge.css +141 -0
  19. package/02-primitives/badge/demo.html +101 -0
  20. package/02-primitives/button/README.md +99 -0
  21. package/02-primitives/button/button.css +353 -0
  22. package/02-primitives/button/demo.html +200 -0
  23. package/02-primitives/card/README.md +145 -0
  24. package/02-primitives/card/card.css +246 -0
  25. package/02-primitives/card/demo.html +170 -0
  26. package/02-primitives/choice/README.md +161 -0
  27. package/02-primitives/choice/choice.css +395 -0
  28. package/02-primitives/choice/demo.html +277 -0
  29. package/02-primitives/combobox/README.md +79 -0
  30. package/02-primitives/combobox/combobox.css +223 -0
  31. package/02-primitives/combobox/combobox.js +485 -0
  32. package/02-primitives/combobox/demo.html +109 -0
  33. package/02-primitives/date-range/README.md +100 -0
  34. package/02-primitives/date-range/date-range.css +206 -0
  35. package/02-primitives/date-range/date-range.js +301 -0
  36. package/02-primitives/date-range/demo.html +104 -0
  37. package/02-primitives/input/README.md +170 -0
  38. package/02-primitives/input/demo.html +246 -0
  39. package/02-primitives/input/input.css +239 -0
  40. package/02-primitives/popover/README.md +80 -0
  41. package/02-primitives/popover/demo.html +150 -0
  42. package/02-primitives/popover/popover.css +187 -0
  43. package/02-primitives/popover/popover.js +331 -0
  44. package/02-primitives/progress/README.md +82 -0
  45. package/02-primitives/progress/demo.html +154 -0
  46. package/02-primitives/progress/progress.css +172 -0
  47. package/02-primitives/select/README.md +95 -0
  48. package/02-primitives/select/demo.html +121 -0
  49. package/02-primitives/select/select.css +151 -0
  50. package/02-primitives/select/select.js +549 -0
  51. package/02-primitives/separator/README.md +63 -0
  52. package/02-primitives/separator/demo.html +84 -0
  53. package/02-primitives/separator/separator.css +73 -0
  54. package/02-primitives/skeleton/README.md +69 -0
  55. package/02-primitives/skeleton/demo.html +110 -0
  56. package/02-primitives/skeleton/skeleton.css +96 -0
  57. package/02-primitives/switch/README.md +65 -0
  58. package/02-primitives/switch/demo.html +115 -0
  59. package/02-primitives/switch/switch.css +370 -0
  60. package/03-patterns/accordion/README.md +121 -0
  61. package/03-patterns/accordion/accordion.css +453 -0
  62. package/03-patterns/accordion/accordion.js +369 -0
  63. package/03-patterns/accordion/demo.html +223 -0
  64. package/03-patterns/content/README.md +103 -0
  65. package/03-patterns/content/content.css +286 -0
  66. package/03-patterns/content/demo.html +88 -0
  67. package/03-patterns/drawer/README.md +79 -0
  68. package/03-patterns/drawer/demo.html +101 -0
  69. package/03-patterns/drawer/drawer.css +129 -0
  70. package/03-patterns/drawer/drawer.js +258 -0
  71. package/03-patterns/dropdown/README.md +78 -0
  72. package/03-patterns/dropdown/demo.html +101 -0
  73. package/03-patterns/dropdown/dropdown.css +135 -0
  74. package/03-patterns/dropdown/dropdown.js +451 -0
  75. package/03-patterns/form-validation/README.md +147 -0
  76. package/03-patterns/form-validation/demo.html +280 -0
  77. package/03-patterns/form-validation/form-validation.css +263 -0
  78. package/03-patterns/list/README.md +150 -0
  79. package/03-patterns/list/demo.html +225 -0
  80. package/03-patterns/list/flip.js +201 -0
  81. package/03-patterns/list/list.css +162 -0
  82. package/03-patterns/nav/README.md +225 -0
  83. package/03-patterns/nav/demo.html +131 -0
  84. package/03-patterns/nav/nav.css +314 -0
  85. package/03-patterns/nav/nav.js +430 -0
  86. package/03-patterns/nav/toc.js +111 -0
  87. package/03-patterns/overlay/README.md +196 -0
  88. package/03-patterns/overlay/demo.html +241 -0
  89. package/03-patterns/overlay/overlay.css +319 -0
  90. package/03-patterns/overlay/overlay.js +563 -0
  91. package/03-patterns/pagination/README.md +114 -0
  92. package/03-patterns/pagination/demo.html +165 -0
  93. package/03-patterns/pagination/pagination.css +195 -0
  94. package/03-patterns/pagination/pagination.js +395 -0
  95. package/03-patterns/reveal/README.md +91 -0
  96. package/03-patterns/reveal/demo.html +106 -0
  97. package/03-patterns/reveal/reveal.css +93 -0
  98. package/03-patterns/reveal/reveal.js +172 -0
  99. package/03-patterns/states/README.md +141 -0
  100. package/03-patterns/states/demo.html +240 -0
  101. package/03-patterns/states/states.css +252 -0
  102. package/03-patterns/tabs/README.md +84 -0
  103. package/03-patterns/tabs/demo.html +139 -0
  104. package/03-patterns/tabs/tabs.css +172 -0
  105. package/03-patterns/tabs/tabs.js +307 -0
  106. package/03-patterns/tooltip/README.md +96 -0
  107. package/03-patterns/tooltip/demo.html +78 -0
  108. package/03-patterns/tooltip/tooltip.css +89 -0
  109. package/03-patterns/tooltip/tooltip.js +288 -0
  110. package/03-patterns/tree/README.md +94 -0
  111. package/03-patterns/tree/demo.html +138 -0
  112. package/03-patterns/tree/tree.css +113 -0
  113. package/03-patterns/tree/tree.js +456 -0
  114. package/04-recipes/analysis-report/README.md +80 -0
  115. package/04-recipes/analysis-report/analysis-report.css +187 -0
  116. package/04-recipes/analysis-report/demo.html +274 -0
  117. package/04-recipes/data-showcase/README.md +45 -0
  118. package/04-recipes/data-showcase/demo.html +247 -0
  119. package/04-recipes/detail-page/README.md +93 -0
  120. package/04-recipes/detail-page/demo.html +55 -0
  121. package/04-recipes/detail-page/detail-page.css +190 -0
  122. package/04-recipes/detail-page/full.html +60 -0
  123. package/04-recipes/detail-page/null.html +60 -0
  124. package/04-recipes/detail-page/partial.html +60 -0
  125. package/04-recipes/detail-page/verify-skeleton.py +19 -0
  126. package/04-recipes/longform/README.md +93 -0
  127. package/04-recipes/longform/agc-memory.svg +4 -0
  128. package/04-recipes/longform/content.html +610 -0
  129. package/04-recipes/longform/content.md +51 -0
  130. package/04-recipes/longform/longform.html +627 -0
  131. package/04-recipes/report/README.md +176 -0
  132. package/04-recipes/report/demo.html +355 -0
  133. package/04-recipes/report/report.css +364 -0
  134. package/04-recipes/table/README.md +103 -0
  135. package/04-recipes/table/demo.html +455 -0
  136. package/04-recipes/table/table.css +372 -0
  137. package/04-recipes/tierA-tokens.css +189 -0
  138. package/09-assets/README.md +74 -0
  139. package/09-assets/bar/README.md +94 -0
  140. package/09-assets/bar/bar.css +166 -0
  141. package/09-assets/bar/bar.js +320 -0
  142. package/09-assets/bar/demo.html +176 -0
  143. package/09-assets/echarts-adapter/demo.html +192 -0
  144. package/09-assets/echarts-adapter/echarts-adapter.js +277 -0
  145. package/09-assets/model-viewer/README.md +155 -0
  146. package/09-assets/model-viewer/demo.html +105 -0
  147. package/09-assets/model-viewer/model-viewer.css +143 -0
  148. package/09-assets/model-viewer/model-viewer.js +423 -0
  149. package/09-assets/scientific-plot/README.md +94 -0
  150. package/09-assets/scientific-plot/demo.html +252 -0
  151. package/09-assets/scientific-plot/scientific-plot.css +141 -0
  152. package/09-assets/scientific-plot/scientific-plot.js +610 -0
  153. package/09-assets/sparkline/README.md +153 -0
  154. package/09-assets/sparkline/demo.html +163 -0
  155. package/09-assets/sparkline/sparkline.css +158 -0
  156. package/09-assets/sparkline/sparkline.js +508 -0
  157. package/API.md +332 -0
  158. package/CHANGELOG.md +3138 -0
  159. package/CODE_OF_CONDUCT.md +64 -0
  160. package/CONTRIBUTING.md +89 -0
  161. package/ERRORS.md +1658 -0
  162. package/LICENSE +21 -0
  163. package/README.md +497 -2
  164. package/SECURITY.md +72 -0
  165. package/START-HERE.md +164 -0
  166. package/SUPPORT.md +109 -0
  167. package/adapters/presentation/README.md +113 -0
  168. package/adapters/presentation/check.js +101 -0
  169. package/adapters/presentation/deck.schema.json +74 -0
  170. package/adapters/presentation/to-doc.js +138 -0
  171. package/ai/START-HERE.md +104 -0
  172. package/ai/behaviors.json +380 -0
  173. package/ai/behaviors.schema.json +61 -0
  174. package/ai/capabilities.json +56 -0
  175. package/ai/cli.js +387 -0
  176. package/ai/components.json +1944 -0
  177. package/ai/components.meta.json +168 -0
  178. package/ai/components.schema.json +220 -0
  179. package/ai/contract.schema.json +147 -0
  180. package/ai/deprecations.json +55 -0
  181. package/ai/deprecations.schema.json +85 -0
  182. package/ai/motion-policy.json +22 -0
  183. package/ai/patch.js +323 -0
  184. package/ai/patch.schema.json +63 -0
  185. package/ai/profiles.json +92 -0
  186. package/ai/tokens.audience.json +55 -0
  187. package/ai/tokens.audience.schema.json +73 -0
  188. package/ai/tokens.json +762 -0
  189. package/ai/tokens.schema.json +58 -0
  190. package/ai/tokens.tree.json +752 -0
  191. package/ai/tokens.tree.schema.json +56 -0
  192. package/ai/validate.js +383 -0
  193. package/dist/01-tokens/behavior/dismissable.js +60 -0
  194. package/dist/01-tokens/behavior/emit.js +21 -0
  195. package/dist/01-tokens/behavior/focus-return.js +31 -0
  196. package/dist/01-tokens/behavior/roving.js +77 -0
  197. package/dist/01-tokens/behavior/typeahead.js +61 -0
  198. package/dist/01-tokens/focus-ring.css +1 -0
  199. package/dist/01-tokens/page.css +1 -0
  200. package/dist/01-tokens/polyfill.js +78 -0
  201. package/dist/01-tokens/scrollbar.css +1 -0
  202. package/dist/01-tokens/theme-toggle.js +61 -0
  203. package/dist/01-tokens/tokens.css +1 -0
  204. package/dist/01-tokens/typography.css +1 -0
  205. package/dist/02-primitives/badge/badge.css +1 -0
  206. package/dist/02-primitives/button/button.css +1 -0
  207. package/dist/02-primitives/card/card.css +1 -0
  208. package/dist/02-primitives/choice/choice.css +1 -0
  209. package/dist/02-primitives/combobox/combobox.css +1 -0
  210. package/dist/02-primitives/combobox/combobox.js +439 -0
  211. package/dist/02-primitives/date-range/date-range.css +1 -0
  212. package/dist/02-primitives/date-range/date-range.js +267 -0
  213. package/dist/02-primitives/input/input.css +1 -0
  214. package/dist/02-primitives/popover/popover.css +1 -0
  215. package/dist/02-primitives/popover/popover.js +257 -0
  216. package/dist/02-primitives/progress/progress.css +1 -0
  217. package/dist/02-primitives/select/select.css +1 -0
  218. package/dist/02-primitives/select/select.js +449 -0
  219. package/dist/02-primitives/separator/separator.css +1 -0
  220. package/dist/02-primitives/skeleton/skeleton.css +1 -0
  221. package/dist/02-primitives/switch/switch.css +1 -0
  222. package/dist/03-patterns/accordion/accordion.css +1 -0
  223. package/dist/03-patterns/accordion/accordion.js +219 -0
  224. package/dist/03-patterns/content/content.css +1 -0
  225. package/dist/03-patterns/drawer/drawer.css +1 -0
  226. package/dist/03-patterns/drawer/drawer.js +229 -0
  227. package/dist/03-patterns/dropdown/dropdown.css +1 -0
  228. package/dist/03-patterns/dropdown/dropdown.js +365 -0
  229. package/dist/03-patterns/form-validation/form-validation.css +1 -0
  230. package/dist/03-patterns/list/flip.js +117 -0
  231. package/dist/03-patterns/list/list.css +1 -0
  232. package/dist/03-patterns/nav/nav.css +1 -0
  233. package/dist/03-patterns/nav/nav.js +322 -0
  234. package/dist/03-patterns/nav/toc.js +76 -0
  235. package/dist/03-patterns/overlay/overlay.css +1 -0
  236. package/dist/03-patterns/overlay/overlay.js +398 -0
  237. package/dist/03-patterns/pagination/pagination.css +1 -0
  238. package/dist/03-patterns/pagination/pagination.js +273 -0
  239. package/dist/03-patterns/reveal/reveal.css +1 -0
  240. package/dist/03-patterns/reveal/reveal.js +138 -0
  241. package/dist/03-patterns/states/states.css +1 -0
  242. package/dist/03-patterns/tabs/tabs.css +1 -0
  243. package/dist/03-patterns/tabs/tabs.js +242 -0
  244. package/dist/03-patterns/tooltip/tooltip.css +1 -0
  245. package/dist/03-patterns/tooltip/tooltip.js +213 -0
  246. package/dist/03-patterns/tree/tree.css +1 -0
  247. package/dist/03-patterns/tree/tree.js +383 -0
  248. package/dist/04-recipes/analysis-report/analysis-report.css +1 -0
  249. package/dist/04-recipes/detail-page/detail-page.css +1 -0
  250. package/dist/04-recipes/report/report.css +1 -0
  251. package/dist/04-recipes/table/table.css +1 -0
  252. package/dist/04-recipes/tierA-tokens.css +1 -0
  253. package/dist/09-assets/bar/bar.css +1 -0
  254. package/dist/09-assets/bar/bar.js +222 -0
  255. package/dist/09-assets/echarts-adapter/echarts-adapter.js +185 -0
  256. package/dist/09-assets/model-viewer/model-viewer.css +1 -0
  257. package/dist/09-assets/model-viewer/model-viewer.js +320 -0
  258. package/dist/09-assets/scientific-plot/scientific-plot.css +1 -0
  259. package/dist/09-assets/scientific-plot/scientific-plot.js +568 -0
  260. package/dist/09-assets/sparkline/sparkline.css +1 -0
  261. package/dist/09-assets/sparkline/sparkline.js +265 -0
  262. package/dist/COSTS.md +56 -0
  263. package/docs/AI-CONTRACT.md +197 -0
  264. package/docs/BACKLOG.md +127 -0
  265. package/docs/BENCHMARK.md +252 -0
  266. package/docs/GUIDANCE.md +154 -0
  267. package/docs/INVARIANT.md +372 -0
  268. package/docs/LAYER-BASELINE.md +158 -0
  269. package/docs/RELEASING.md +311 -0
  270. package/docs/RFC-THEME-SCOPE.md +141 -0
  271. package/docs/ROADMAP.md +182 -0
  272. package/index.html +82 -0
  273. package/package.json +107 -4
  274. package/types/index.d.ts +310 -0
@@ -0,0 +1,398 @@
1
+ (function (global) {
2
+ 'use strict';
3
+
4
+ var FOCUSABLE = [
5
+ 'a[href]',
6
+ 'button:not([disabled])',
7
+ 'input:not([disabled]):not([type="hidden"])',
8
+ 'select:not([disabled])',
9
+ 'textarea:not([disabled])',
10
+ '[tabindex]:not([tabindex="-1"])'
11
+ ].join(',');
12
+
13
+ var lockCount = 0;
14
+
15
+ var scrollLock = { changed: false, saved: '', varSet: false };
16
+
17
+ var inertRefs = [];
18
+
19
+ var ariaRefs = [];
20
+
21
+ function focusableIn(root) {
22
+ var all = Array.prototype.slice.call(root.querySelectorAll(FOCUSABLE));
23
+
24
+ return all.filter(function (el) {
25
+ return el.offsetParent !== null || el === document.activeElement;
26
+ });
27
+ }
28
+
29
+ function lockScroll() {
30
+ if (lockCount++ > 0) return;
31
+
32
+ var sbw = window.innerWidth - document.documentElement.clientWidth;
33
+ if (sbw > 0) {
34
+ var cur = parseFloat(getComputedStyle(document.body).paddingRight) || 0;
35
+ scrollLock.saved = document.body.style.paddingRight;
36
+ document.body.style.paddingRight = (cur + sbw) + 'px';
37
+ scrollLock.changed = true;
38
+ document.documentElement.style.setProperty(
39
+ '--overlay-scrollbar-width', sbw + 'px');
40
+ scrollLock.varSet = true;
41
+ }
42
+ document.body.setAttribute('data-scroll-locked', 'true');
43
+ }
44
+
45
+ function unlockScroll() {
46
+ if (--lockCount > 0) return;
47
+ document.body.removeAttribute('data-scroll-locked');
48
+ if (scrollLock.varSet) {
49
+ document.documentElement.style.removeProperty('--overlay-scrollbar-width');
50
+ scrollLock.varSet = false;
51
+ }
52
+
53
+ if (scrollLock.changed) {
54
+ document.body.style.paddingRight = scrollLock.saved;
55
+ scrollLock.changed = false;
56
+ scrollLock.saved = '';
57
+ }
58
+ }
59
+
60
+ function inertAcquire(node) {
61
+ for (var i = 0; i < inertRefs.length; i++) {
62
+ if (inertRefs[i].node === node) { inertRefs[i].count++; return; }
63
+ }
64
+ inertRefs.push({ node: node, count: 1 });
65
+ node.inert = true;
66
+ }
67
+
68
+ function inertRelease(node) {
69
+ for (var i = 0; i < inertRefs.length; i++) {
70
+ if (inertRefs[i].node !== node) continue;
71
+ inertRefs[i].count--;
72
+ if (inertRefs[i].count <= 0) {
73
+ node.inert = false;
74
+ inertRefs.splice(i, 1);
75
+ }
76
+ return;
77
+ }
78
+ }
79
+
80
+ function ariaAcquire(node) {
81
+ for (var i = 0; i < ariaRefs.length; i++) {
82
+ if (ariaRefs[i].node === node) { ariaRefs[i].count++; return; }
83
+ }
84
+
85
+ ariaRefs.push({ node: node, count: 1, prev: node.getAttribute('aria-hidden') });
86
+ node.setAttribute('aria-hidden', 'true');
87
+ }
88
+
89
+ function ariaRelease(node) {
90
+ for (var i = 0; i < ariaRefs.length; i++) {
91
+ if (ariaRefs[i].node !== node) continue;
92
+ ariaRefs[i].count--;
93
+ if (ariaRefs[i].count <= 0) {
94
+ var prev = ariaRefs[i].prev;
95
+ if (prev === null) node.removeAttribute('aria-hidden');
96
+ else node.setAttribute('aria-hidden', prev);
97
+ ariaRefs.splice(i, 1);
98
+ }
99
+ return;
100
+ }
101
+ }
102
+
103
+ var openStack = [];
104
+
105
+ function installIsolation(entry) {
106
+ var box = entry.box;
107
+ var backdrop = entry.backdrop;
108
+ var lastInside = null;
109
+
110
+ function topmost() { return openStack[openStack.length - 1]; }
111
+
112
+ function pullBack() {
113
+ if (lastInside && document.contains(lastInside) && box.contains(lastInside)) {
114
+ lastInside.focus();
115
+ return;
116
+ }
117
+ var f = focusableIn(box);
118
+ if (f.length) { f[0].focus(); return; }
119
+ box.focus();
120
+ }
121
+
122
+ function onFocusIn(e) {
123
+ if (topmost() !== entry) return;
124
+ var t = e.target;
125
+ if (box.contains(t) || backdrop.contains(t)) { lastInside = t; return; }
126
+ pullBack();
127
+ }
128
+
129
+ function onPointer(e) {
130
+ if (topmost() !== entry) return;
131
+ if (backdrop.contains(e.target)) return;
132
+ if (e.cancelable) e.preventDefault();
133
+ e.stopPropagation();
134
+ }
135
+
136
+ document.addEventListener('focusin', onFocusIn, true);
137
+ document.addEventListener('pointerdown', onPointer, true);
138
+ document.addEventListener('mousedown', onPointer, true);
139
+ document.addEventListener('touchstart', onPointer, true);
140
+
141
+ document.addEventListener('click', onPointer, true);
142
+
143
+ return function uninstall() {
144
+ document.removeEventListener('focusin', onFocusIn, true);
145
+ document.removeEventListener('pointerdown', onPointer, true);
146
+ document.removeEventListener('mousedown', onPointer, true);
147
+ document.removeEventListener('touchstart', onPointer, true);
148
+ document.removeEventListener('click', onPointer, true);
149
+ };
150
+ }
151
+
152
+ function toast(opts) {
153
+ opts = opts || {};
154
+
155
+ var region = document.querySelector('.toast-region');
156
+ if (!region) {
157
+ region = document.createElement('div');
158
+ region.className = 'toast-region';
159
+
160
+ region.setAttribute('role', 'status');
161
+ region.setAttribute('aria-live', 'polite');
162
+ document.body.appendChild(region);
163
+ }
164
+
165
+ var el = document.createElement('div');
166
+ el.className = 'toast' + (opts.variant ? ' toast--' + opts.variant : '');
167
+
168
+ var body = document.createElement('div');
169
+ body.className = 'toast__body';
170
+ if (opts.title) {
171
+ var t = document.createElement('p');
172
+ t.className = 'toast__title';
173
+ t.textContent = opts.title;
174
+ body.appendChild(t);
175
+ }
176
+ if (opts.desc) {
177
+ var d = document.createElement('p');
178
+ d.className = 'toast__desc';
179
+ d.textContent = opts.desc;
180
+ body.appendChild(d);
181
+ }
182
+ el.appendChild(body);
183
+
184
+ var auto = opts.duration;
185
+ if (auto === undefined) {
186
+ auto = (opts.variant === 'error') ? 0 : 4000;
187
+ }
188
+
189
+ if (auto > 0) {
190
+ var timer = document.createElement('div');
191
+ timer.className = 'toast__timer';
192
+ timer.style.animationDuration = auto + 'ms';
193
+ el.appendChild(timer);
194
+ }
195
+
196
+ var closeBtn = document.createElement('button');
197
+ closeBtn.className = 'toast__close';
198
+ closeBtn.type = 'button';
199
+ closeBtn.setAttribute('aria-label', '关闭提示');
200
+ closeBtn.textContent = '×';
201
+ el.appendChild(closeBtn);
202
+
203
+ var closed = false;
204
+ function close() {
205
+ if (closed) return;
206
+ closed = true;
207
+ if (auto) clearTimeout(timerId);
208
+ el.setAttribute('data-state', 'leaving');
209
+
210
+ setTimeout(function () {
211
+ if (el.parentNode) el.parentNode.removeChild(el);
212
+ }, 220);
213
+ }
214
+
215
+ closeBtn.addEventListener('click', close);
216
+ region.appendChild(el);
217
+
218
+ var timerId = auto > 0 ? setTimeout(close, auto) : null;
219
+ return { el: el, close: close };
220
+ }
221
+
222
+ var flFocusReturn = function (opts) {
223
+ var opt = opts || {};
224
+ var saved = null;
225
+
226
+ return {
227
+ save: function () {
228
+ var a = document.activeElement;
229
+ saved = (a && a !== document.body && a.focus) ? a : null;
230
+ return saved;
231
+ },
232
+
233
+ restore: function () {
234
+ var target = saved;
235
+
236
+ if (!target || !document.contains(target)) target = opt.fallback || null;
237
+ if (!target) { saved = null; return false; }
238
+ try {
239
+ target.focus();
240
+ } catch (e) {
241
+ saved = null;
242
+ return false;
243
+ }
244
+ var ok = document.activeElement === target;
245
+ saved = null;
246
+ return ok;
247
+ },
248
+
249
+ target: function () { return saved; },
250
+ clear: function () { saved = null; },
251
+ };
252
+ };
253
+
254
+ function dialog(opts) {
255
+ opts = opts || {};
256
+
257
+ var fr = flFocusReturn();
258
+ fr.save();
259
+
260
+ var backdrop = document.createElement('div');
261
+ backdrop.className = 'dialog-backdrop';
262
+
263
+ var box = document.createElement('div');
264
+ box.className = 'dialog' + (opts.danger ? ' dialog--danger' : '');
265
+ box.setAttribute('role', 'dialog');
266
+ box.setAttribute('aria-modal', 'true');
267
+
268
+ box.setAttribute('tabindex', '-1');
269
+
270
+ if (opts.title) {
271
+ var h = document.createElement('h2');
272
+ h.className = 'dialog__title';
273
+ h.id = 'dlg-title-' + Date.now();
274
+ h.textContent = opts.title;
275
+ box.appendChild(h);
276
+ box.setAttribute('aria-labelledby', h.id);
277
+ }
278
+ if (opts.desc) {
279
+ var p = document.createElement('p');
280
+ p.className = 'dialog__desc';
281
+ p.id = 'dlg-desc-' + Date.now();
282
+ p.textContent = opts.desc;
283
+ box.appendChild(p);
284
+ box.setAttribute('aria-describedby', p.id);
285
+ }
286
+
287
+ var act = document.createElement('div');
288
+ act.className = 'dialog__actions';
289
+ (opts.actions || []).forEach(function (a) {
290
+ var b = document.createElement('button');
291
+ b.type = 'button';
292
+ b.className = 'btn ' + (a.variant === 'danger' ? 'btn--danger'
293
+ : a.variant === 'primary' ? 'btn--primary' : 'btn--secondary');
294
+ b.textContent = a.label;
295
+ b.addEventListener('click', function () {
296
+ if (a.onClick) a.onClick(close);
297
+ if (a.keepOpen !== true) close();
298
+ });
299
+ act.appendChild(b);
300
+ });
301
+ box.appendChild(act);
302
+
303
+ backdrop.appendChild(box);
304
+ document.body.appendChild(backdrop);
305
+ lockScroll();
306
+
307
+ var useInert = 'inert' in HTMLElement.prototype;
308
+ var stackEntry = { backdrop: backdrop, box: box };
309
+ var uninstallIsolation = null;
310
+ openStack.push(stackEntry);
311
+ if (!useInert) uninstallIsolation = installIsolation(stackEntry);
312
+
313
+ function focusables() { return focusableIn(box); }
314
+
315
+ box.addEventListener('keydown', function (e) {
316
+ if (e.key === 'Escape') {
317
+ e.preventDefault();
318
+
319
+ e.stopPropagation();
320
+ close();
321
+ return;
322
+ }
323
+ if (e.key !== 'Tab') return;
324
+
325
+ var f = focusables();
326
+ if (!f.length) { e.preventDefault(); box.focus(); return; }
327
+ var first = f[0], last = f[f.length - 1];
328
+
329
+ if (e.shiftKey && (document.activeElement === first || document.activeElement === box)) {
330
+ e.preventDefault(); last.focus();
331
+ } else if (!e.shiftKey && document.activeElement === last) {
332
+ e.preventDefault(); first.focus();
333
+ }
334
+ });
335
+
336
+ if (opts.initialFocus === 'cancel') {
337
+ var cancel = box.querySelector('.btn:not(.btn--danger)');
338
+ if (cancel) cancel.focus();
339
+ else box.focus();
340
+ } else {
341
+ box.focus();
342
+ }
343
+
344
+ if (opts.closeOnBackdrop !== false && !opts.danger) {
345
+ backdrop.addEventListener('mousedown', function (e) {
346
+ if (e.target === backdrop) close();
347
+ });
348
+ }
349
+
350
+ var closed = false;
351
+ var inerted = [];
352
+ var ariaed = [];
353
+
354
+ var nodes = Array.prototype.slice.call(
355
+ document.body.querySelectorAll('body > *')
356
+ );
357
+ nodes.forEach(function (n) {
358
+
359
+ if (n.classList.contains('dialog-backdrop')) return;
360
+ if (useInert) {
361
+ inerted.push(n);
362
+ inertAcquire(n);
363
+ } else {
364
+ ariaed.push(n);
365
+ ariaAcquire(n);
366
+ }
367
+ });
368
+
369
+ function close() {
370
+ if (closed) return;
371
+ closed = true;
372
+
373
+ var ae = document.activeElement;
374
+ var focusIsMine = !ae || ae === document.body ||
375
+ box.contains(ae) || backdrop.contains(ae);
376
+
377
+ if (backdrop.parentNode) backdrop.parentNode.removeChild(backdrop);
378
+
379
+ for (var si = openStack.length - 1; si >= 0; si--) {
380
+ if (openStack[si] === stackEntry) { openStack.splice(si, 1); break; }
381
+ }
382
+ if (uninstallIsolation) { uninstallIsolation(); uninstallIsolation = null; }
383
+
384
+ inerted.forEach(inertRelease);
385
+
386
+ ariaed.forEach(ariaRelease);
387
+ unlockScroll();
388
+
389
+ fr.restore();
390
+
391
+ }
392
+
393
+ return { el: box, close: close };
394
+ }
395
+
396
+ global.Overlay = { toast: toast, dialog: dialog };
397
+
398
+ })(window);
@@ -0,0 +1 @@
1
+ .pagination {display:flex;align-items:center;gap:var(--sp-2);flex-wrap:wrap;}.pagination__list {display:flex;align-items:center;gap:2px;flex-wrap:wrap;list-style:none;margin:0;padding:0;}.pagination__item {margin:0;}.pagination__link {display:inline-flex;align-items:center;justify-content:center;min-width:var(--sz-touch);min-height:var(--sz-touch);padding:0 var(--sp-2);font-size:var(--fs-sm);font-family:var(--mono);font-variant-numeric:tabular-nums;color:var(--text-primary);text-decoration:none;background:var(--surface);border:1px solid var(--border-decor);border-radius:var(--r-sm);cursor:pointer;-webkit-tap-highlight-color:transparent;transition:background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);}.pagination__link:hover:not([aria-disabled="true"]):not([disabled]) {background:var(--surface-sunken);}.pagination__link:focus-visible {outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);}.pagination__link[aria-disabled="true"], .pagination__link:disabled {color:var(--text-tertiary);background:var(--surface-sunken);border-color:transparent;cursor:not-allowed;}.pagination__link[aria-current="page"]:not([disabled]) {color:var(--text-on-accent);background:var(--accent);border-color:var(--accent);font-weight:600;box-shadow:var(--lift-sm);cursor:default;opacity:1;z-index:var(--z-raised);}.pagination__ellipsis {display:inline-flex;align-items:center;justify-content:center;min-width:var(--sz-touch);min-height:var(--sz-touch);color:var(--text-tertiary);font-size:var(--fs-sm);user-select:none;}.pagination__status {margin-inline-start:auto;font-size:var(--fs-xs);color:var(--text-secondary);font-variant-numeric:tabular-nums;}.pagination__status:empty {display:none;}.pagination__sr {position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;}.pagination__live {position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;}@media (max-width:480px) {.pagination__status {margin-inline-start:0;width:100%;}}@media (prefers-reduced-motion:reduce) {.pagination__link {transition:none;}}@media (hover:hover) and (pointer:fine) {.pagination__link:hover:not([aria-disabled="true"]):not([disabled]) {background:var(--surface-sunken);}}
@@ -0,0 +1,273 @@
1
+ (function () {
2
+ 'use strict';
3
+
4
+ var flEmit = function (el, name, detail) {
5
+ if (!el || !el.dispatchEvent) return null;
6
+ var type = name.indexOf('fl-') === 0 ? name : 'fl-' + name;
7
+ var ev = null;
8
+
9
+ if (typeof window.CustomEvent === 'function') {
10
+ try {
11
+ ev = new window.CustomEvent(type, {
12
+ detail: detail || null, bubbles: true, cancelable: false
13
+ });
14
+ } catch (e) { ev = null; }
15
+ }
16
+ if (!ev) {
17
+ try {
18
+ ev = document.createEvent('CustomEvent');
19
+ ev.initCustomEvent(type, true, false, detail || null);
20
+ } catch (e2) { return null; }
21
+ }
22
+ el.dispatchEvent(ev);
23
+ return ev;
24
+ };
25
+
26
+ var SLOTS = 7;
27
+
28
+ function el(tag, cls, text) {
29
+ var n = document.createElement(tag);
30
+ if (cls) n.className = cls;
31
+ if (text !== undefined && text !== null) n.textContent = text;
32
+ return n;
33
+ }
34
+
35
+ function pageWindow(cur, total, slots) {
36
+ slots = slots || SLOTS;
37
+ if (total <= slots - 2) {
38
+ var all = [];
39
+ for (var i = 1; i <= total; i++) all.push(i);
40
+ return all;
41
+ }
42
+
43
+ var MAX_MID = slots - 4;
44
+ if (MAX_MID < 1) MAX_MID = 1;
45
+
46
+ var mid = [];
47
+ var start = cur - Math.floor(MAX_MID / 2);
48
+ if (start < 2) start = 2;
49
+ if (start + MAX_MID - 1 > total - 1) start = total - MAX_MID;
50
+ if (start < 2) start = 2;
51
+ for (var j = start; j < start + MAX_MID; j++) {
52
+ if (j > 1 && j < total) mid.push(j);
53
+ }
54
+
55
+ var out = [1];
56
+
57
+ if (mid.length && mid[0] > 2) out.push('…');
58
+ for (var k = 0; k < mid.length; k++) out.push(mid[k]);
59
+ if (mid.length && mid[mid.length - 1] < total - 1) out.push('…');
60
+ if (total > 1) out.push(total);
61
+ return out;
62
+ }
63
+
64
+ function Pagination(node) {
65
+ this.node = node;
66
+ this.total = Math.max(1, parseInt(node.getAttribute('data-total') || '1', 10));
67
+ this.size = Math.max(1, parseInt(node.getAttribute('data-page-size') || '20', 10));
68
+ this.page = Math.max(1, parseInt(node.getAttribute('data-page') || '1', 10));
69
+ this.label = node.getAttribute('aria-label') || '分页';
70
+ this.pages = Math.max(1, Math.ceil(this.total / this.size));
71
+ this.onChange = null;
72
+
73
+ try {
74
+ var u = node.getAttribute('data-pg-param') || 'page';
75
+ var q = parseInt(new URL(location.href).searchParams.get(u) || '0', 10);
76
+ if (q > 0) this.page = Math.min(q, this.pages);
77
+ } catch (e) { }
78
+
79
+ this.listNode = node.querySelector('[data-pg-list]');
80
+ this.statusNode = node.querySelector('[data-pg-status]');
81
+ this.liveNode = node.querySelector('[data-pg-live]');
82
+
83
+ var self = this;
84
+ node.addEventListener('click', function (e) {
85
+ var t = e.target;
86
+ while (t && t !== node && t.tagName !== 'BUTTON' && t.tagName !== 'A') {
87
+ t = t.parentNode;
88
+ }
89
+ if (!t || t === node) return;
90
+ if (t.disabled || t.getAttribute('aria-disabled') === 'true') return;
91
+ var to = t.getAttribute('data-goto');
92
+ if (to === 'prev') { self.go(self.page - 1); }
93
+ else if (to === 'next') { self.go(self.page + 1); }
94
+ else if (to === 'first') { self.go(1); }
95
+ else if (to === 'last') { self.go(self.pages); }
96
+ else if (to) { self.go(parseInt(to, 10)); }
97
+ });
98
+
99
+ this._onKey = function (e) {
100
+ if (e.metaKey || e.ctrlKey || e.altKey) return;
101
+ var act = document.activeElement;
102
+ var inside = act && (act === self.node || self.node.contains(act));
103
+
104
+ if (act && /^(INPUT|TEXTAREA|SELECT)$/.test(act.tagName)) return;
105
+ if (act && act.isContentEditable) return;
106
+
107
+ if (!inside && act && act !== document.body) return;
108
+
109
+ var k = e.key;
110
+ if (k === 'ArrowLeft') { self.go(self.page - 1); }
111
+ else if (k === 'ArrowRight') { self.go(self.page + 1); }
112
+ else if (k === 'Home') { self.go(1); }
113
+ else if (k === 'End') { self.go(self.pages); }
114
+ else return;
115
+ e.preventDefault();
116
+
117
+ self.focusCurrent();
118
+ };
119
+ document.addEventListener('keydown', this._onKey);
120
+
121
+ this.render();
122
+ }
123
+
124
+ Pagination.prototype.pages = 1;
125
+
126
+ Pagination.prototype.destroy = function () {
127
+ if (this._destroyed) return;
128
+ this._destroyed = true;
129
+ document.removeEventListener('keydown', this._onKey);
130
+
131
+ if (this.node && document.activeElement &&
132
+ this.node.contains &&
133
+ this.node.contains(document.activeElement)) {
134
+ document.activeElement.blur();
135
+ }
136
+ };
137
+
138
+ Pagination.prototype.go = function (n, opts) {
139
+ opts = opts || {};
140
+ n = Math.max(1, Math.min(this.pages, n));
141
+ if (n === this.page && !opts.force) { this.focusCurrent(); return; }
142
+ this.page = n;
143
+ this.render();
144
+ this.announce();
145
+
146
+ if (opts.scroll !== false) this.scrollToTop();
147
+ this.syncURL();
148
+ flEmit(this.node, 'fl-change', { value: n, page: n });
149
+ if (typeof this.onChange === 'function') this.onChange(n);
150
+ };
151
+
152
+ Pagination.prototype.scrollToTop = function () {
153
+ var target = this.node.getAttribute('data-pg-scroll-target')
154
+ || this.node.getAttribute('aria-controls');
155
+ var el = target ? document.getElementById(target) : null;
156
+ if (!el || !el.scrollIntoView) {
157
+
158
+ if (this.node.scrollIntoView) {
159
+ try { this.node.scrollIntoView({ block: 'nearest' }); } catch (e) {}
160
+ }
161
+ return;
162
+ }
163
+ try {
164
+ el.scrollIntoView({ block: 'start' });
165
+ } catch (e) {
166
+ el.scrollIntoView(true);
167
+ }
168
+ };
169
+
170
+ Pagination.prototype.syncURL = function () {
171
+ if (typeof history === 'undefined' || !history.replaceState) return;
172
+ if (this.node.getAttribute('data-pg-nourl') === 'true') return;
173
+ try {
174
+ var u = this.node.getAttribute('data-pg-param') || 'page';
175
+ var url = new URL(location.href);
176
+ if (this.page <= 1) url.searchParams.delete(u);
177
+ else url.searchParams.set(u, String(this.page));
178
+ history.replaceState(null, '', url.toString());
179
+ } catch (e) { }
180
+ };
181
+
182
+ Pagination.prototype.focusCurrent = function () {
183
+ var cur = this.listNode.querySelector('[aria-current="page"]');
184
+ if (cur && cur.focus) cur.focus();
185
+ };
186
+
187
+ Pagination.prototype.announce = function () {
188
+ if (!this.liveNode) return;
189
+ this.liveNode.textContent = '第 ' + this.page + ' 页,共 ' + this.pages + ' 页';
190
+ };
191
+
192
+ Pagination.prototype.render = function () {
193
+ if (!this.listNode) return;
194
+ var L = this.listNode;
195
+ while (L.firstChild) L.removeChild(L.firstChild);
196
+ var self = this;
197
+
198
+ function addBtn(text, ariaLabel, goto, disabled) {
199
+ var li = el('li', 'pagination__item');
200
+ var b = el('button', 'pagination__link', text);
201
+ b.type = 'button';
202
+ b.setAttribute('data-goto', goto);
203
+
204
+ if (disabled) { b.disabled = true; b.setAttribute('aria-disabled', 'true'); }
205
+ if (ariaLabel) b.setAttribute('aria-label', ariaLabel);
206
+ li.appendChild(b);
207
+ L.appendChild(li);
208
+ return b;
209
+ }
210
+
211
+ addBtn('‹', '上一页', 'prev', self.page <= 1);
212
+
213
+ var win = pageWindow(self.page, self.pages, SLOTS);
214
+ for (var i = 0; i < win.length; i++) {
215
+ var p = win[i];
216
+ if (p === '…') {
217
+ var li = el('li', 'pagination__item');
218
+ li.appendChild(el('span', 'pagination__ellipsis', '…'));
219
+
220
+ li.firstChild.setAttribute('aria-hidden', 'true');
221
+ L.appendChild(li);
222
+ continue;
223
+ }
224
+
225
+ var isCur = (p === self.page);
226
+ var li2 = el('li', 'pagination__item');
227
+ var b2 = el('button', 'pagination__link', String(p));
228
+ b2.type = 'button';
229
+ b2.setAttribute('data-goto', String(p));
230
+ b2.setAttribute('aria-label', '第 ' + p + ' 页' + (isCur ? '(当前页)' : ''));
231
+ if (isCur) {
232
+ b2.setAttribute('aria-current', 'page');
233
+ b2.setAttribute('aria-disabled', 'true');
234
+ }
235
+ li2.appendChild(b2);
236
+ L.appendChild(li2);
237
+ }
238
+
239
+ addBtn('›', '下一页', 'next', self.page >= self.pages);
240
+
241
+ if (this.statusNode) {
242
+ this.statusNode.textContent =
243
+ '第 '+ self.page + ' 页 / 共 ' + self.pages + ' 页';
244
+ }
245
+ };
246
+
247
+ var API = {
248
+
249
+ create: function (node) {
250
+ if (!node) return null;
251
+ if (node.__pg) return node.__pg;
252
+ node.__pg = new Pagination(node);
253
+ return node.__pg;
254
+ },
255
+
256
+ update: function (root) {
257
+ var list = (root || document).querySelectorAll('[data-pagination]');
258
+ for (var i = 0; i < list.length; i++) API.create(list[i]);
259
+ },
260
+
261
+ pagesOf: function (total, pageSize) {
262
+ return Math.max(1, Math.ceil((total || 1) / (pageSize || 20)));
263
+ },
264
+ };
265
+
266
+ if (typeof window !== 'undefined') window.Pagination = API;
267
+
268
+ if (document.readyState === 'loading') {
269
+ document.addEventListener('DOMContentLoaded', function () { API.update(); });
270
+ } else {
271
+ API.update();
272
+ }
273
+ })();
@@ -0,0 +1 @@
1
+ [data-reveal], .reveal {--reveal-x:0px;--reveal-y:0px;--reveal-scale:1;--reveal-delay:0ms;transform:translate(var(--reveal-x), var(--reveal-y)) scale(var(--reveal-scale));transition-property:transform, opacity;transition-duration:var(--dur-base);transition-timing-function:var(--ease-out);transition-delay:var(--reveal-delay);}[data-reveal="up"] {--reveal-y:8px;}[data-reveal="down"] {--reveal-y:-8px;}[data-reveal="left"] {--reveal-x:8px;}[data-reveal="right"] {--reveal-x:-8px;}[data-reveal="scale"] {--reveal-scale:.97;}[data-reveal="none"] {--reveal-x:0px;--reveal-y:0px;--reveal-scale:1;}[data-reveal-ready] [data-reveal]:not([data-reveal-done]) {opacity:0;}[data-reveal-ready] [data-reveal][data-reveal-done] {opacity:1;--reveal-x:0px;--reveal-y:0px;--reveal-scale:1;}[data-reveal-children] > * {transition-delay:var(--reveal-delay, 0ms);}@media (prefers-reduced-motion:reduce) {[data-reveal] {transform:none;transition-property:opacity;transition-duration:var(--dur-fast);}[data-reveal-ready] [data-reveal]:not([data-reveal-done]) {opacity:1;}}